aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore31
-rw-r--r--README.md24
-rwxr-xr-xbootstrap.sh3
-rw-r--r--doc/Makefile223
-rw-r--r--doc/build/.gitignore4
-rw-r--r--doc/source/.gitignore1
-rw-r--r--doc/source/conf.py292
-rw-r--r--doc/source/index.rst23
-rw-r--r--emu-radio/lte-emulator/CMakeLists.txt73
-rw-r--r--emu-radio/scripts/build-package.sh36
-rw-r--r--emu-radio/wifi-emulator/CMakeLists.txt71
-rw-r--r--examples/tutorial/tutorial01.json23
-rw-r--r--examples/tutorial/tutorial02-dumbell.json60
-rw-r--r--examples/tutorial/tutorial03-hetnet.json47
-rw-r--r--examples/tutorial/tutorial04-caching.json44
-rw-r--r--examples/tutorial/tutorial05-icn2020-emulator.json98
-rw-r--r--examples/tutorial/tutorial05-icn2020.json96
-rw-r--r--netmodel/interfaces/process/__init__.py49
-rw-r--r--netmodel/interfaces/vicn.py39
-rw-r--r--netmodel/interfaces/vpp/__init__.py225
-rw-r--r--netmodel/interfaces/websocket/__init__.py38
-rw-r--r--netmodel/model/attribute.py120
-rw-r--r--netmodel/model/collection.py5
-rw-r--r--netmodel/model/key.py19
-rw-r--r--netmodel/model/mapper.py4
-rw-r--r--netmodel/model/object.py126
-rw-r--r--netmodel/model/query.py13
-rw-r--r--netmodel/model/sa_collections.py (renamed from vicn/core/sa_collections.py)9
-rw-r--r--netmodel/model/sa_compat.py (renamed from vicn/core/sa_compat.py)0
-rw-r--r--netmodel/model/type.py185
-rw-r--r--netmodel/model/uuid.py51
-rw-r--r--netmodel/network/fib.py10
-rw-r--r--netmodel/network/flow_table.py145
-rw-r--r--netmodel/network/interface.py20
-rw-r--r--netmodel/network/packet.py34
-rw-r--r--netmodel/network/prefix.py13
-rw-r--r--netmodel/network/router.py35
-rw-r--r--netmodel/util/daemon.py2
-rwxr-xr-xnetmon/bin/netmon.py4
-rw-r--r--requirements.txt3
-rw-r--r--scripts/vppctl_wrapper4
-rwxr-xr-xsetup.py51
-rw-r--r--vicn/core/api.py11
-rw-r--r--vicn/core/attribute.py136
-rw-r--r--vicn/core/collection.py23
-rw-r--r--vicn/core/commands.py2
-rw-r--r--vicn/core/exception.py2
-rw-r--r--vicn/core/resource.py341
-rw-r--r--vicn/core/resource_mgr.py357
-rw-r--r--vicn/core/state.py37
-rw-r--r--vicn/core/task.py96
-rw-r--r--vicn/resource/application.py9
-rw-r--r--vicn/resource/central.py535
-rw-r--r--vicn/resource/group.py9
-rw-r--r--vicn/resource/gui.py96
-rw-r--r--vicn/resource/icn/ccnx_keystore.py9
-rw-r--r--vicn/resource/icn/ccnx_metis.py83
-rw-r--r--vicn/resource/icn/ccnx_simpleTrafficGenerator.py9
-rw-r--r--vicn/resource/icn/central.py236
-rw-r--r--vicn/resource/icn/cicn.py (renamed from vicn/resource/vpp/cicn.py)17
-rw-r--r--vicn/resource/icn/face.py87
-rw-r--r--vicn/resource/icn/forwarder.py2
-rw-r--r--vicn/resource/icn/icn_application.py1
-rw-r--r--vicn/resource/icn/iping.py26
-rw-r--r--vicn/resource/icn/ndnpingserver.py2
-rw-r--r--vicn/resource/icn/nfd.py8
-rw-r--r--vicn/resource/icn/producer.py6
-rw-r--r--vicn/resource/icn/route.py6
-rw-r--r--vicn/resource/interface.py8
-rw-r--r--vicn/resource/ip/central.py288
-rw-r--r--vicn/resource/ip/prefix_tree.py156
-rw-r--r--vicn/resource/ip/route.py10
-rw-r--r--vicn/resource/ip/routing_table.py51
-rw-r--r--vicn/resource/ip_assignment.py106
-rw-r--r--vicn/resource/linux/bridge.py28
-rw-r--r--vicn/resource/linux/certificate.py30
-rw-r--r--vicn/resource/linux/certificate_store.py54
-rw-r--r--vicn/resource/linux/dnsmasq.py14
-rw-r--r--vicn/resource/linux/file.py12
-rw-r--r--vicn/resource/linux/folder.py88
-rw-r--r--vicn/resource/linux/gre_tunnel.py63
-rw-r--r--vicn/resource/linux/iperf.py4
-rw-r--r--vicn/resource/linux/keypair.py8
-rw-r--r--vicn/resource/linux/link.py26
-rw-r--r--vicn/resource/linux/macvlan.py8
-rw-r--r--vicn/resource/linux/macvtap.py8
-rw-r--r--vicn/resource/linux/net_device.py106
-rw-r--r--vicn/resource/linux/netmon.py2
-rw-r--r--vicn/resource/linux/ovs.py6
-rw-r--r--vicn/resource/linux/package_manager.py17
-rw-r--r--vicn/resource/linux/phy_interface.py20
-rw-r--r--vicn/resource/linux/phy_link.py51
-rw-r--r--vicn/resource/linux/physical.py6
-rw-r--r--vicn/resource/linux/qtplayer.py5
-rw-r--r--vicn/resource/linux/repository.py6
-rw-r--r--vicn/resource/linux/service.py29
-rw-r--r--vicn/resource/linux/sym_veth_pair.py52
-rw-r--r--vicn/resource/linux/tap_device.py25
-rw-r--r--vicn/resource/linux/veth_pair.py94
-rw-r--r--vicn/resource/linux/veth_pair_lxc.py74
-rw-r--r--vicn/resource/lxd/lxc_container.py69
-rw-r--r--vicn/resource/lxd/lxc_image.py7
-rw-r--r--vicn/resource/lxd/lxd_certificate_store.py48
-rw-r--r--vicn/resource/lxd/lxd_hypervisor.py30
-rw-r--r--vicn/resource/lxd/lxd_profile.py12
-rw-r--r--vicn/resource/lxd/lxd_remote.py99
-rw-r--r--vicn/resource/node.py20
-rw-r--r--vicn/resource/ns3/emulated_channel.py65
-rw-r--r--vicn/resource/ns3/emulated_lte_channel.py57
-rw-r--r--vicn/resource/ns3/emulated_wifi_channel.py23
-rw-r--r--vicn/resource/symmetric_channel.py16
-rw-r--r--vicn/resource/vpp/dpdk_device.py2
-rw-r--r--vicn/resource/vpp/interface.py103
-rw-r--r--vicn/resource/vpp/memif_device.py77
-rw-r--r--vicn/resource/vpp/memif_link.py144
-rw-r--r--vicn/resource/vpp/scripts.py2
-rw-r--r--vicn/resource/vpp/vpp.py96
-rw-r--r--vicn/resource/vpp/vpp_bridge.py7
-rw-r--r--vicn/resource/vpp/vpp_commands.py50
-rw-r--r--vicn/resource/vpp/vpp_host.py10
-rw-r--r--www/css/contrib/bootstrap-dropmenu.min.css5
-rw-r--r--www/css/contrib/bootstrap-table.min.css1
-rw-r--r--www/css/contrib/bootstrap.min.css5
-rw-r--r--www/css/contrib/jasny-bootstrap.min.css7
-rw-r--r--www/css/contrib/led.css37
-rw-r--r--www/css/contrib/vis-timeline-graph2d.min.css1
-rw-r--r--www/css/contrib/vis.css1295
-rw-r--r--www/css/contrib/vis.min.css1
-rw-r--r--www/css/main.css204
-rw-r--r--www/favicon.ico0
-rw-r--r--www/fonts/glyphicons-halflings-regular.eot0
-rw-r--r--www/fonts/glyphicons-halflings-regular.svg288
-rw-r--r--www/fonts/glyphicons-halflings-regular.ttf0
-rw-r--r--www/fonts/glyphicons-halflings-regular.woff0
-rw-r--r--www/fonts/glyphicons-halflings-regular.woff20
-rw-r--r--www/img/icn-router-vpp.png0
-rw-r--r--www/img/icn-router.png0
-rw-r--r--www/img/ip-router-vpp.png0
-rw-r--r--www/img/ip-router.png0
-rw-r--r--www/img/lte.png0
-rw-r--r--www/img/pc-video-client.png0
-rw-r--r--www/img/server.png0
-rw-r--r--www/img/smartphone.png0
-rw-r--r--www/img/tablet.png0
-rw-r--r--www/img/undefined.png0
-rw-r--r--www/img/user.png0
-rw-r--r--www/img/vicn-logo.png0
-rw-r--r--www/img/video-server.png0
-rw-r--r--www/img/wifi.png0
-rw-r--r--www/index.html94
-rw-r--r--www/js/class.js64
-rw-r--r--www/js/contrib/bootstrap-table.min.js8
-rw-r--r--www/js/contrib/bootstrap.min.js6
-rw-r--r--www/js/contrib/d3-array.v1.min.js2
-rw-r--r--www/js/contrib/d3-collection.v1.min.js2
-rw-r--r--www/js/contrib/d3-color.v1.min.js2
-rw-r--r--www/js/contrib/d3-format.v1.min.js2
-rw-r--r--www/js/contrib/d3-interpolate.v1.min.js2
-rw-r--r--www/js/contrib/d3-scale.js903
-rw-r--r--www/js/contrib/d3-scale.min.js2
-rw-r--r--www/js/contrib/d3-scale.v1.min.js2
-rw-r--r--www/js/contrib/d3-scale.zip0
-rw-r--r--www/js/contrib/d3-time-format.v2.min.js2
-rw-r--r--www/js/contrib/d3-time.v1.min.js2
-rw-r--r--www/js/contrib/jasny-bootstrap.min.js6
-rw-r--r--www/js/contrib/jquery-1.11.3.min.js5
-rw-r--r--www/js/contrib/jquery-3.1.1.min.js4
-rw-r--r--www/js/contrib/jquery.flot.js3168
-rw-r--r--www/js/contrib/jquery.flot.threshold.js142
-rw-r--r--www/js/contrib/jquery.flot.time.js432
-rw-r--r--www/js/contrib/vis.js51961
-rw-r--r--www/js/contrib/vis.min.js46
-rw-r--r--www/js/main.js39
-rw-r--r--www/js/network.js356
-rw-r--r--www/js/query.js55
-rw-r--r--www/js/server-event-dispatcher.js66
176 files changed, 63954 insertions, 2154 deletions
diff --git a/.gitignore b/.gitignore
index b354d71a..327a1542 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,31 +1,2 @@
-build/
-=======
-liblongbow*tar.gz
-lib
-bin
-include
-*.o
-*.lo
-*.a
-*.la
-.libs
-a.out
-.DS_Store
-.gcda
-.gcno
-.dSYM
-autom4te.cache
-config.h
-config.log
-config.status
-stamp-h1
-*.trs
-Makefile
-.deps
*.pyc
-.dirstamp
-*.swp
-libtool
-*~
-*.pyc
-.idea
+.pybuild
diff --git a/README.md b/README.md
index 217ae9ad..08a1365d 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,30 @@ python3-pylxd (>=2.2.2, use pip3 if necessary, depends on libssl-dev)
python3-requests-unixsocket
+== Installation
+
+Install vICN from either a debian package or by cloning the git repositoy.
+
+Add the image server certificate to your trusted certificates:
+
+ sudo apt-get install ca-certificates
+ wget https://46.105.122.213/cicn.crt
+ sudo cp cicn.crt /usr/share/ca-certificates
+ sudo dpkg-reconfigure ca-certificates
+
+ # This should be done by the LXD remote add
+ cp /usr/share/ca-certificates/cicn.crt ~/.config/lxc/servercerts/
+
+ lxc remote add cicn https://46.105.122.213 --protocol=simplestreams
+
+You can now list image with:
+
+ lxc image list cicn:
+
+or run containers:
+
+ lxc launch cicn:cicn/1.0 test
+
== Getting started
You can have a look at the tutorials available in the fd.io wiki:
diff --git a/bootstrap.sh b/bootstrap.sh
deleted file mode 100755
index 3ba8abcb..00000000
--- a/bootstrap.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-mkdir -p ~/.vicn/ssh_client_cert/ && ssh-keygen -t rsa -N "" -f ~/.vicn/ssh_client_cert/ssh_client_key
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 00000000..ae9b2b0f
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,223 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+
+.PHONY: all
+all: apidoc html
+
+.PHONY: apidoc
+apidoc:
+ sphinx-apidoc -o source/apidoc ../vicn/
+
+.PHONY: help
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " applehelp to make an Apple Help Book"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+ @echo " coverage to run coverage check of the documentation (if enabled)"
+
+.PHONY: clean
+clean:
+ rm -rf $(BUILDDIR)/*
+
+.PHONY: html
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+.PHONY: dirhtml
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+.PHONY: singlehtml
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+.PHONY: pickle
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+.PHONY: json
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+.PHONY: htmlhelp
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+.PHONY: qthelp
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/vicn.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/vicn.qhc"
+
+.PHONY: applehelp
+applehelp:
+ $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
+ @echo
+ @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
+ @echo "N.B. You won't be able to view it unless you put it in" \
+ "~/Library/Documentation/Help or install it in your application" \
+ "bundle."
+
+.PHONY: devhelp
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/vicn"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/vicn"
+ @echo "# devhelp"
+
+.PHONY: epub
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+.PHONY: latex
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+.PHONY: latexpdf
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: latexpdfja
+latexpdfja:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: text
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+.PHONY: man
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+.PHONY: texinfo
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+.PHONY: info
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+.PHONY: gettext
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+.PHONY: changes
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+.PHONY: linkcheck
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+.PHONY: doctest
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+.PHONY: coverage
+coverage:
+ $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
+ @echo "Testing of coverage in the sources finished, look at the " \
+ "results in $(BUILDDIR)/coverage/python.txt."
+
+.PHONY: xml
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+.PHONY: pseudoxml
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/doc/build/.gitignore b/doc/build/.gitignore
new file mode 100644
index 00000000..40e4c1e3
--- /dev/null
+++ b/doc/build/.gitignore
@@ -0,0 +1,4 @@
+!.gitignore
+doctrees
+html
+
diff --git a/doc/source/.gitignore b/doc/source/.gitignore
new file mode 100644
index 00000000..73f85073
--- /dev/null
+++ b/doc/source/.gitignore
@@ -0,0 +1 @@
+apidoc
diff --git a/doc/source/conf.py b/doc/source/conf.py
new file mode 100644
index 00000000..0b26e6ee
--- /dev/null
+++ b/doc/source/conf.py
@@ -0,0 +1,292 @@
+# -*- coding: utf-8 -*-
+#
+# vicn documentation build configuration file, created by
+# sphinx-quickstart on Wed Jul 12 11:40:27 2017.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('../..'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.intersphinx',
+ 'sphinx.ext.ifconfig',
+ 'sphinx.ext.viewcode',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+# source_suffix = ['.rst', '.md']
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'vicn'
+copyright = u'2017, Cisco Systems'
+author = u'Cisco Systems'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = u'0.1'
+# The full version, including alpha/beta/rc tags.
+release = u'0.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'alabaster'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (relative to this directory) to use as a favicon of
+# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
+# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
+#html_search_language = 'en'
+
+# A dictionary with options for the search language support, empty by default.
+# Now only 'ja' uses this config value
+#html_search_options = {'type': 'default'}
+
+# The name of a javascript file (relative to the configuration directory) that
+# implements a search results scorer. If empty, the default will be used.
+#html_search_scorer = 'scorer.js'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'vicndoc'
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+
+# Latex figure (float) alignment
+#'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'vicn.tex', u'vicn Documentation',
+ u'Cisco Systems', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, 'vicn', u'vicn Documentation',
+ [author], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'vicn', u'vicn Documentation',
+ author, 'vicn', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'https://docs.python.org/': None}
diff --git a/doc/source/index.rst b/doc/source/index.rst
new file mode 100644
index 00000000..f205f88b
--- /dev/null
+++ b/doc/source/index.rst
@@ -0,0 +1,23 @@
+.. vicn documentation master file, created by
+ sphinx-quickstart on Wed Jul 12 11:40:27 2017.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to vicn's documentation!
+================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+
+ apidoc/modules.rst
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/emu-radio/lte-emulator/CMakeLists.txt b/emu-radio/lte-emulator/CMakeLists.txt
index 6b8113b0..a265fff5 100644
--- a/emu-radio/lte-emulator/CMakeLists.txt
+++ b/emu-radio/lte-emulator/CMakeLists.txt
@@ -39,60 +39,51 @@ add_executable(lte_emulator ${SOURCE_FILES} ${COMMON_FILES})
target_link_libraries(lte_emulator ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Lte_Ns3_LIBRARIES})
install(TARGETS lte_emulator DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
-install(FILES ${PROJECT_SOURCE_DIR}/fading-traces/fading_trace_EPA_3kmph.fad DESTINATION share/lte-emulator)
-install(FILES ${PROJECT_SOURCE_DIR}/fading-traces/fading_trace_ETU_3kmph.fad DESTINATION share/lte-emulator)
-install(FILES ${PROJECT_SOURCE_DIR}/fading-traces/fading_trace_EVA_60kmph.fad DESTINATION share/lte-emulator)
-install(FILES ${PROJECT_SOURCE_DIR}/fading-traces/fading_trace_generator.m DESTINATION share/lte-emulator)
# Generate DEB / RPM packages
option(DEB_PACKAGE "Create deb package" OFF)
option(RPM_PACKAGE "Create deb package" OFF)
-set(VENDOR "Cisco Systems" CACHE STRING "Vendor")
-set(CONTACT "msardara@cisco.com" CACHE STRING "Contact")
-set(DISTRIBUTION "xenial" CACHE STRING "Distribution")
-set(ARCHITECTURE "amd64" CACHE STRING "Architecture")
-set(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer")
-set(BUILD_NUMBER "1" CACHE STRING "Build Number")
-set(PACKAGE_NAME lte-emulator)
-set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
-set(CPACK_PACKAGE_VENDOR ${VENDOR})
-set(CPACK_PACKAGE_CONTACT ${CONTACT})
+SET(VENDOR "Cisco Systems" CACHE STRING "Vendor")
+SET(CONTACT "msardara@cisco.com" CACHE STRING "Contact")
+SET(DISTRIBUTION "xenial" CACHE STRING "Distribution")
+SET(ARCHITECTURE "amd64" CACHE STRING "Architecture")
+SET(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer")
+SET(BUILD_NUMBER "1" CACHE STRING "Build Number")
+SET(PACKAGE_NAME lte-emulator)
+SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+SET(CPACK_PACKAGE_VENDOR ${VENDOR})
+SET(CPACK_PACKAGE_CONTACT ${CONTACT})
# Get the version
execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/version
OUTPUT_VARIABLE PACKAGE_VERSION)
-
-if (PACKAGE_VERSION)
- string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION)
-else()
- set(PACKAGE_VERSION 1.0)
-endif()
+string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION)
if(DEB_PACKAGE)
- set(TYPE "DEBIAN")
- set(GENERATOR "DEB")
- set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}")
- set(CPACK_${TYPE}_PACKAGE_DEPENDS "libns3sx-3v5, ns3sx, libboost-system1.58.0")
+ SET(TYPE "DEBIAN")
+ SET(GENERATOR "DEB")
+ SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}")
+ SET(CPACK_${TYPE}_PACKAGE_DEPENDS "libns3sx-3v5, ns3sx, libboost-system1.58.0")
elseif(RPM_PACKAGE)
- set(TYPE "RPM")
- set(GENERATOR "RPM")
- set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}")
- set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
- set(CPACK_${TYPE}_PACKAGE_REQUIRES "")
+ SET(TYPE "RPM")
+ SET(GENERATOR "RPM")
+ SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}")
+ SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
+ SET(CPACK_${TYPE}_PACKAGE_REQUIRES "")
else()
- return()
+ RETURN()
endif()
-set(CPACK_GENERATOR ${GENERATOR})
-set(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER})
-set(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME})
-set(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION})
-set(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE})
-set(CPACK_${TYPE}_PACKAGE_RELEASE 1)
-set(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR})
-set(CPACK_${TYPE}_PACKAGE_DESCRIPTION "LTE channel emulator.")
-set(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Vicn")
-
-include(CPack)
+SET(CPACK_GENERATOR ${GENERATOR})
+SET(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER})
+SET(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME})
+SET(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION})
+SET(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE})
+SET(CPACK_${TYPE}_PACKAGE_RELEASE 1)
+SET(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR})
+SET(CPACK_${TYPE}_PACKAGE_DESCRIPTION "LTE channel emulator.")
+SET(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Vicn")
+
+INCLUDE(CPack)
diff --git a/emu-radio/scripts/build-package.sh b/emu-radio/scripts/build-package.sh
index 1aa828d0..487f538a 100644
--- a/emu-radio/scripts/build-package.sh
+++ b/emu-radio/scripts/build-package.sh
@@ -3,7 +3,6 @@
set -euxo pipefail
IFS=$'\n\t'
-SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
APT_PATH=`which apt-get` || true
apt_get=${APT_PATH:-"/usr/local/bin/apt-get"}
@@ -154,22 +153,6 @@ build() {
make
}
-change_version() {
- OLD_PACKAGE=$1
- NEW_PACKAGE=$2
- B_NUMBER=$3
-
- mkdir tmp
- pushd tmp
- ar p ../${OLD_PACKAGE} control.tar.gz | tar -xz
- sed -i s/3.24.1-8/3.24.1-${B_NUMBER}/g control
- mv ../${OLD_PACKAGE} ../${NEW_PACKAGE}
- tar czf control.tar.gz *[!z]
- ar r ../${NEW_PACKAGE} control.tar.gz
- popd
- rm -rf tmp
-}
-
ARCHITECTURE=`uname -m`
# Figure out what system we are running on
@@ -217,30 +200,31 @@ fi
BLD_NUMBER=${BUILD_NUMBER:-"1"}
+mkdir -p ../ns3-packages
+
# Install libns3
-pushd ${SCRIPT_PATH}/../ns3-packages
+pushd ../ns3-packages
sudo dpkg -i *.deb || true
sudo apt-get -f install -y --allow-unauthenticated || true
popd
# Build wifi-emualtor
-pushd ${SCRIPT_PATH}/..
+pushd ..
build "-DWIFI=ON -DLTE=OFF"
make package
find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
popd
# Build lte-emualtor
-pushd ${SCRIPT_PATH}/..
+pushd ..
build "-DLTE=ON -DWIFI=OFF"
make package
find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
popd
# Change build number to ns3 packages
-pushd ${SCRIPT_PATH}/../ns3-packages
-
-change_version libns3sx-3v5_3.24.1-8~xenial_amd64.deb libns3sx-3v5_3.24.1-$BLD_NUMBER~xenial_amd64.deb ${BLD_NUMBER} || true
-change_version libns3sx-dev_3.24.1-8~xenial_amd64.deb libns3sx-dev_3.24.1-$BLD_NUMBER~xenial_amd64.deb ${BLD_NUMBER} || true
-change_version ns3sx_3.24.1-8~xenial_amd64.deb ns3sx_3.24.1-$BLD_NUMBER~xenial_amd64.deb ${BLD_NUMBER} || true
-popd
+pushd ../ns3-packages
+mv libns3sx-3v5_3.24.1-6~xenial_amd64.deb libns3sx-3v5_3.24.1-$BLD_NUMBER~xenial_amd64.deb || true
+mv libns3sx-dev_3.24.1-6~xenial_amd64.deb libns3sx-dev_3.24.1-$BLD_NUMBER~xenial_amd64.deb || true
+mv ns3sx_3.24.1-6~xenial_amd64.deb ns3sx_3.24.1-$BLD_NUMBER~xenial_amd64.deb || true
+popd \ No newline at end of file
diff --git a/emu-radio/wifi-emulator/CMakeLists.txt b/emu-radio/wifi-emulator/CMakeLists.txt
index eb551fe2..558a751f 100644
--- a/emu-radio/wifi-emulator/CMakeLists.txt
+++ b/emu-radio/wifi-emulator/CMakeLists.txt
@@ -38,51 +38,46 @@ install(TARGETS wifi_emulator DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
option(DEB_PACKAGE "Create deb package" OFF)
option(RPM_PACKAGE "Create deb package" OFF)
-set(VENDOR "Cisco Systems" CACHE STRING "Vendor")
-set(CONTACT "msardara@cisco.com" CACHE STRING "Contact")
-set(DISTRIBUTION "xenial" CACHE STRING "Distribution")
-set(ARCHITECTURE "amd64" CACHE STRING "Architecture")
-set(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer")
-set(BUILD_NUMBER "1" CACHE STRING "Build Number")
-set(PACKAGE_NAME wifi-emulator)
-
-set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
-set(CPACK_PACKAGE_VENDOR ${VENDOR})
-set(CPACK_PACKAGE_CONTACT ${CONTACT})
+SET(VENDOR "Cisco Systems" CACHE STRING "Vendor")
+SET(CONTACT "msardara@cisco.com" CACHE STRING "Contact")
+SET(DISTRIBUTION "xenial" CACHE STRING "Distribution")
+SET(ARCHITECTURE "amd64" CACHE STRING "Architecture")
+SET(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer")
+SET(BUILD_NUMBER "1" CACHE STRING "Build Number")
+SET(PACKAGE_NAME wifi-emulator)
+
+SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+SET(CPACK_PACKAGE_VENDOR ${VENDOR})
+SET(CPACK_PACKAGE_CONTACT ${CONTACT})
# Get the version
execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/version
OUTPUT_VARIABLE PACKAGE_VERSION)
-
-if (PACKAGE_VERSION)
- string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION)
-else()
- set(PACKAGE_VERSION 1.0)
-endif()
+string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION)
if(DEB_PACKAGE)
- set(TYPE "DEBIAN")
- set(GENERATOR "DEB")
- set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}")
- set(CPACK_${TYPE}_PACKAGE_DEPENDS "libns3sx-3v5, ns3sx, libboost-system1.58.0")
+ SET(TYPE "DEBIAN")
+ SET(GENERATOR "DEB")
+ SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}")
+ SET(CPACK_${TYPE}_PACKAGE_DEPENDS "libns3sx-3v5, ns3sx, libboost-system1.58.0")
elseif(RPM_PACKAGE)
- set(TYPE "RPM")
- set(GENERATOR "RPM")
- set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}")
- set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
- set(CPACK_${TYPE}_PACKAGE_REQUIRES "")
+ SET(TYPE "RPM")
+ SET(GENERATOR "RPM")
+ SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}")
+ SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
+ SET(CPACK_${TYPE}_PACKAGE_REQUIRES "")
else()
- return()
+ RETURN()
endif()
-set(CPACK_GENERATOR ${GENERATOR})
-set(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER})
-set(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME})
-set(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION})
-set(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE})
-set(CPACK_${TYPE}_PACKAGE_RELEASE 1)
-set(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR})
-set(CPACK_${TYPE}_PACKAGE_DESCRIPTION "Wifi N channel emulator.")
-set(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Vicn")
-
-include(CPack)
+SET(CPACK_GENERATOR ${GENERATOR})
+SET(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER})
+SET(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME})
+SET(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION})
+SET(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE})
+SET(CPACK_${TYPE}_PACKAGE_RELEASE 1)
+SET(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR})
+SET(CPACK_${TYPE}_PACKAGE_DESCRIPTION "Wifi N channel emulator.")
+SET(CPACK_${TYPE}_PACKAGE_HOMEPAGE "https://wiki.fd.io/view/Vicn")
+
+INCLUDE(CPack)
diff --git a/examples/tutorial/tutorial01.json b/examples/tutorial/tutorial01.json
index fd203cff..e1e97800 100644
--- a/examples/tutorial/tutorial01.json
+++ b/examples/tutorial/tutorial01.json
@@ -9,49 +9,44 @@
"name": "server",
"hostname": "localhost"
},
- {
- "type": "NetDevice",
- "device_name": "eth0",
- "node": "server",
- "managed": false
- },
- {
+ {
"type": "LxcImage",
- "name": "ubuntu1604-cicnsuite-rc3",
+ "name": "cicn-image",
+ "image": "ubuntu1604-cicnsuite-rc3",
"groups": ["topology"],
"node": "server"
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"groups": ["topology"],
"name": "prod1",
"node": "server"
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"groups": ["topology"],
"name": "prod2",
"node": "server"
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"groups": ["topology"],
"name": "core2",
"node": "server"
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"groups": ["topology"],
"name": "core1",
"node": "server"
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"groups": ["topology"],
"name": "cons1",
"node": "server"
@@ -61,7 +56,7 @@
"name": "cons2",
"groups": ["topology"],
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3"
+ "image": "cicn-image"
},
{
"type": "MetisForwarder",
diff --git a/examples/tutorial/tutorial02-dumbell.json b/examples/tutorial/tutorial02-dumbell.json
index 29ba3042..28873c2f 100644
--- a/examples/tutorial/tutorial02-dumbell.json
+++ b/examples/tutorial/tutorial02-dumbell.json
@@ -1,6 +1,10 @@
{
"resources": [
{
+ "type": "Group",
+ "name": "topology"
+ },
+ {
"type": "Physical",
"name": "server",
"hostname": "localhost",
@@ -15,7 +19,8 @@
},
{
"type": "LxcImage",
- "name": "ubuntu1604-cicnsuite-rc3",
+ "name": "lxcimage",
+ "image": "ubuntu1604-cicnsuite-rc3",
"node": "server",
"managed": false
},
@@ -23,7 +28,8 @@
"type": "LxcContainer",
"node": "server",
"name": "bridge1",
- "image": "ubuntu1604-cicnsuite-rc3"
+ "groups": ["topology"],
+ "image": "lxcimage"
},
{
"type": "VPP",
@@ -34,7 +40,7 @@
"type": "DpdkDevice",
"node": "bridge1",
"device_name": "GigabitEthernet0/8/0",
- "pci_address" : "0000:00:08.0",
+ "pci_address": "0000:00:08.0",
"ip_address" : "172.17.1.20",
"mac_address": "08:00:27:b8:f3:a3",
"name": "bridge1-dpdk1"
@@ -43,7 +49,8 @@
"type": "LxcContainer",
"node": "server",
"name": "core1",
- "image": "ubuntu1604-cicnsuite-rc3"
+ "groups": ["topology"],
+ "image": "lxcimage"
},
{
"type": "VPP",
@@ -93,7 +100,8 @@
"type": "LxcContainer",
"node": "server",
"name": "core2",
- "image": "ubuntu1604-cicnsuite-rc3"
+ "groups": ["topology"],
+ "image": "lxcimage"
},
{
"type": "VPP",
@@ -143,7 +151,8 @@
"type": "LxcContainer",
"node": "server",
"name": "bridge2",
- "image": "ubuntu1604-cicnsuite-rc3"
+ "groups": ["topology"],
+ "image": "lxcimage"
},
{
"type": "VPP",
@@ -162,7 +171,7 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
"name": "cons1"
},
{
@@ -174,7 +183,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "cons2"
},
{
@@ -186,7 +196,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "cons3"
},
{
@@ -198,7 +209,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "cons4"
},
{
@@ -210,7 +222,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "cons5"
},
{
@@ -222,7 +235,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "prod1"
},
{
@@ -234,7 +248,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "prod2"
},
{
@@ -246,7 +261,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "prod3"
},
{
@@ -258,7 +274,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "prod4"
},
{
@@ -270,7 +287,8 @@
{
"type": "LxcContainer",
"node": "server",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "lxcimage",
+ "groups": ["topology"],
"name": "prod5"
},
{
@@ -304,15 +322,19 @@
},
{
"type": "CentralIP",
- "ip_routing_strategy" : "spt"
+ "ip_routing_strategy" : "spt",
+ "ip6_data_prefix": "2001::/50",
+ "ip4_data_prefix": "192.168.128.0/24",
+ "groups": ["topology"]
},
{
"type" : "CentralICN",
- "face_protocol": "udp4"
+ "face_protocol": "udp4",
+ "groups": ["topology"]
}
],
"settings": {
- "network": "192.168.133.0/24",
+ "network": "192.168.128.0/24",
"ulimit-n": 10000
}
}
diff --git a/examples/tutorial/tutorial03-hetnet.json b/examples/tutorial/tutorial03-hetnet.json
index a909e8aa..9a9238fb 100644
--- a/examples/tutorial/tutorial03-hetnet.json
+++ b/examples/tutorial/tutorial03-hetnet.json
@@ -3,51 +3,58 @@
{
"type": "Physical",
"name": "server",
- "hostname": "MY-SERVER"
- },
- {
- "type": "NetDevice",
- "device_name": "br0",
- "node": "server",
- "managed": false
+ "hostname": "localhost"
},
+ {
+ "type": "Group",
+ "name": "routed"
+ },
+ {
+ "type": "GUI",
+ "groups": [ "routed" ]
+ },
{
"type": "LxcImage",
- "name": "ubuntu1604-cicnsuite-rc3",
+ "name": "cicn-image",
+ "image": "ubuntu1604-cicnsuite-rc3",
"node": "server"
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"name": "cons",
"node": "server",
+ "groups": [ "routed" ],
"category": "tablet",
"x": 1,
"y": 2
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"name": "wifi",
"node": "server",
+ "groups": [ "routed" ],
"category": "wifi",
"x": 2,
"y": 1
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"name": "lte",
"node": "server",
+ "groups": [ "routed" ],
"category": "lte",
"x": 2,
"y": 3
},
{
"type": "LxcContainer",
- "image": "ubuntu1604-cicnsuite-rc3",
+ "image": "cicn-image",
"name": "prod",
"node": "server",
+ "groups": [ "routed" ],
"category": "video-server",
"x": 3,
"y": 2
@@ -77,11 +84,13 @@
},
{
"type": "Link",
+ "groups": [ "routed" ],
"src_node": "wifi",
"dst_node": "prod"
},
{
"type": "Link",
+ "groups": [ "routed" ],
"src_node": "lte",
"dst_node": "prod"
},
@@ -91,6 +100,7 @@
"node": "server",
"ap": "wifi",
"stations": ["cons"],
+ "groups": [ "routed" ],
"control_port": 30001
},
{
@@ -98,20 +108,21 @@
"name": "lch",
"node": "server",
"ap": "lte",
+ "groups": [ "routed" ],
"stations": ["cons"],
"control_port": 30002
},
{
"type": "CentralIP",
- "ip_routing_strategy": "spt"
+ "ip_routing_strategy": "spt",
+ "groups": [ "routed" ],
+ "ip4_data_prefix": "192.168.42.0/23",
+ "ip6_data_prefix": "9002::/16"
},
{
"type": "CentralICN",
- "icnip_routing_strategy": "spt",
+ "groups": [ "routed" ],
"face_protocol": "udp4"
}
- ],
- "settings": {
- "network": "192.168.2.0/24"
- }
+ ]
}
diff --git a/examples/tutorial/tutorial04-caching.json b/examples/tutorial/tutorial04-caching.json
index eef652cb..1ee63507 100644
--- a/examples/tutorial/tutorial04-caching.json
+++ b/examples/tutorial/tutorial04-caching.json
@@ -11,19 +11,30 @@
},
{
"type": "NetDevice",
- "device_name": "eth0",
+ "device_name": "enp16s0f0",
"managed": false,
"node": "server"
},
{
+ "type": "Group",
+ "name": "routed"
+ },
+ {
+ "type": "GUI",
+ "groups": ["routed"],
+ "port": 8000
+ },
+ {
"type": "LxcImage",
"name": "ubuntu1604-cicnsuite-rc3",
+ "image": "ubuntu1604-cicnsuite-rc3",
"node": "server"
},
{
"name": "u1core",
+ "groups": [ "routed" ],
"image": "ubuntu1604-cicnsuite-rc3",
- "category": "asr",
+ "category": "ip-router",
"type": "LxcContainer",
"y": 10,
"x": 5,
@@ -31,6 +42,7 @@
},
{
"name": "u1srv1",
+ "groups": [ "routed" ],
"image": "ubuntu1604-cicnsuite-rc3",
"category": "user",
"type": "LxcContainer",
@@ -40,6 +52,7 @@
},
{
"name": "u1srv2",
+ "groups": [ "routed" ],
"image": "ubuntu1604-cicnsuite-rc3",
"category": "user",
"type": "LxcContainer",
@@ -49,8 +62,9 @@
},
{
"name": "u2core",
+ "groups": [ "routed" ],
"image": "ubuntu1604-cicnsuite-rc3",
- "category": "asr",
+ "category": "ip-router",
"type": "LxcContainer",
"y": 6,
"x": 9,
@@ -58,6 +72,7 @@
},
{
"name": "u2srv1",
+ "groups": [ "routed" ],
"image": "ubuntu1604-cicnsuite-rc3",
"category": "user",
"type": "LxcContainer",
@@ -67,8 +82,9 @@
},
{
"name": "u3core",
+ "groups": [ "routed" ],
"image": "ubuntu1604-cicnsuite-rc3",
- "category": "asr",
+ "category": "ip-router",
"type": "LxcContainer",
"y": 12,
"x": 13,
@@ -76,8 +92,9 @@
},
{
"name": "u3srv1",
+ "groups": [ "routed" ],
"image": "ubuntu1604-cicnsuite-rc3",
- "category": "serverDemo",
+ "category": "server",
"type": "LxcContainer",
"y": 10,
"x": 16,
@@ -85,8 +102,9 @@
},
{
"name": "u3srv2",
+ "groups": [ "routed" ],
"image": "ubuntu1604-cicnsuite-rc3",
- "category": "serverDemo",
+ "category": "server",
"type": "LxcContainer",
"y": 14,
"x": 16,
@@ -148,58 +166,70 @@
},
{
"type": "Link",
+ "groups": [ "routed" ],
"dst_node": "u1srv1",
"capacity": 200,
"src_node": "u1core"
},
{
"type": "Link",
+ "groups": [ "routed" ],
"dst_node": "u1srv2",
"capacity": 200,
"src_node": "u1core"
},
{
"type": "Link",
+ "groups": [ "routed" ],
"dst_node": "u2srv1",
"capacity": 200,
"src_node": "u2core"
},
{
"type": "Link",
+ "groups": [ "routed" ],
"dst_node": "u3srv1",
"capacity": 100,
"src_node": "u3core"
},
{
"type": "Link",
+ "groups": [ "routed" ],
"dst_node": "u3srv2",
"capacity": 100,
"src_node": "u3core"
},
{
"type": "Link",
+ "groups": [ "routed" ],
"capacity": 200,
"dst_node": "u2core",
"src_node": "u1core"
},
{
"type": "Link",
+ "groups": [ "routed" ],
"capacity": 200,
"dst_node": "u3core",
"src_node": "u1core"
},
{
"type": "Link",
+ "groups": [ "routed" ],
"capacity": 200,
"dst_node": "u2core",
"src_node": "u3core"
},
{
"type": "CentralIP",
- "ip_routing_strategy": "spt"
+ "groups": [ "routed" ],
+ "ip_routing_strategy": "spt",
+ "ip6_data_prefix": "9002::/16",
+ "ip4_data_prefix": "192.168.15.0/24"
},
{
"type": "CentralICN",
+ "groups": [ "routed" ],
"face_protocol": "udp4"
}
]
diff --git a/examples/tutorial/tutorial05-icn2020-emulator.json b/examples/tutorial/tutorial05-icn2020-emulator.json
new file mode 100644
index 00000000..e020f232
--- /dev/null
+++ b/examples/tutorial/tutorial05-icn2020-emulator.json
@@ -0,0 +1,98 @@
+{
+ "resources": [
+ {
+ "type": "Group",
+ "name": "virtual"
+ },
+ {
+ "type": "Physical",
+ "name": "server",
+ "hostname": "localhost"
+ },
+ {
+ "type": "GUI",
+ "groups": ["virtual"]
+ },
+ {
+ "type": "LxcImage",
+ "name": "cicn-image",
+ "node": "server",
+ "image": "ubuntu1604-cicnsuite-rc3"
+ },
+ {
+ "type" : "LxcContainer",
+ "image": "cicn-image",
+ "name" : "cons",
+ "groups": [ "virtual" ],
+ "node" : "server",
+ "category": "smartphone"
+ },
+ {
+ "type" : "LxcContainer",
+ "image": "cicn-image",
+ "name" : "prod",
+ "groups": [ "virtual" ],
+ "category": "video-server",
+ "node" : "server"
+ },
+ {
+ "type" : "LxcContainer",
+ "image": "cicn-image",
+ "name" : "relay",
+ "groups": [ "virtual" ],
+ "node" : "server",
+ "category": "lte-antenna"
+ },
+ {
+ "type": "EmulatedLteChannel",
+ "name": "lch",
+ "ap": "relay",
+ "stations": [ "cons" ],
+ "control_port": 30002,
+ "node": "server",
+ "groups": [ "virtual" ]
+ },
+ {
+ "type": "Link",
+ "src_node": "relay",
+ "dst_node": "prod",
+ "groups": [ "virtual" ]
+ },
+ {
+ "type": "CentralIP",
+ "ip4_data_prefix": "192.168.42.0/23",
+ "ip6_data_prefix": "9002::/16",
+ "ip_routing_strategy": "spt",
+ "groups": [
+ "virtual"
+ ]
+ },
+ {
+ "type": "MetisForwarder",
+ "cache_size": 0,
+ "node": "cons"
+ },
+ {
+ "type": "MetisForwarder",
+ "cache_size": 2000,
+ "node": "relay"
+ },
+ {
+ "type": "MetisForwarder",
+ "cache_size": 0,
+ "node": "prod"
+ },
+ {
+ "type": "WebServer",
+ "prefixes": [
+ "/webserver"
+ ],
+ "node": "prod"
+ },
+ {
+ "type": "CentralICN",
+ "groups": [ "virtual" ],
+ "face_protocol": "udp4"
+ }
+ ]
+}
diff --git a/examples/tutorial/tutorial05-icn2020.json b/examples/tutorial/tutorial05-icn2020.json
new file mode 100644
index 00000000..0eeb59aa
--- /dev/null
+++ b/examples/tutorial/tutorial05-icn2020.json
@@ -0,0 +1,96 @@
+{
+ "resources": [
+ {
+ "type": "Group",
+ "name": "virtual"
+ },
+ {
+ "type": "Physical",
+ "name": "server",
+ "hostname": "localhost"
+ },
+ {
+ "type": "LxcImage",
+ "name": "cicn-image",
+ "node": "server",
+ "image": "ubuntu1604-cicnsuite-rc3"
+ },
+ {
+ "type": "GUI",
+ "port": 8000,
+ "groups": ["virtual"]
+ },
+ {
+ "type" : "LxcContainer",
+ "image": "cicn-image",
+ "name" : "cons",
+ "groups": [ "virtual" ],
+ "category": "pc-video-client",
+ "node" : "server"
+ },
+ {
+ "type" : "LxcContainer",
+ "image": "cicn-image",
+ "name" : "prod",
+ "groups": [ "virtual" ],
+ "category": "video-server",
+ "node" : "server"
+ },
+ {
+ "type" : "LxcContainer",
+ "image": "cicn-image",
+ "name" : "relay",
+ "groups": [ "virtual" ],
+ "category": "icn-router",
+ "node" : "server"
+ },
+ {
+ "type": "Link",
+ "src_node": "cons",
+ "dst_node": "relay",
+ "groups": [ "virtual" ]
+ },
+ {
+ "type": "Link",
+ "src_node": "relay",
+ "dst_node": "prod",
+ "groups": [ "virtual" ]
+ },
+ {
+ "type": "CentralIP",
+ "ip4_data_prefix": "192.168.42.0/24",
+ "ip6_data_prefix": "9002::/16",
+ "ip_routing_strategy": "spt",
+ "groups": [
+ "virtual"
+ ]
+ },
+ {
+ "type": "MetisForwarder",
+ "cache_size": 0,
+ "node": "cons"
+ },
+ {
+ "type": "MetisForwarder",
+ "cache_size": 2000,
+ "node": "relay"
+ },
+ {
+ "type": "MetisForwarder",
+ "cache_size": 0,
+ "node": "prod"
+ },
+ {
+ "type": "WebServer",
+ "prefixes": [
+ "/webserver"
+ ],
+ "node": "prod"
+ },
+ {
+ "type": "CentralICN",
+ "groups": [ "virtual" ],
+ "face_protocol": "udp4"
+ }
+ ]
+}
diff --git a/netmodel/interfaces/process/__init__.py b/netmodel/interfaces/process/__init__.py
index b985c32f..59bf6f9f 100644
--- a/netmodel/interfaces/process/__init__.py
+++ b/netmodel/interfaces/process/__init__.py
@@ -16,6 +16,7 @@
# limitations under the License.
#
+import logging
import shlex
import socket
import subprocess
@@ -27,10 +28,13 @@ from netmodel.network.prefix import Prefix
from netmodel.model.attribute import Attribute
from netmodel.model.filter import Filter
from netmodel.model.object import Object
-from netmodel.model.query import Query, ACTION_UPDATE
-from netmodel.model.query import ACTION_SUBSCRIBE, FUNCTION_SUM
+from netmodel.model.query import Query, ACTION_UPDATE, ACTION2STR
+from netmodel.model.query import ACTION_SUBSCRIBE, ACTION_UNSUBSCRIBE
+from netmodel.model.query import FUNCTION_SUM
from netmodel.model.type import String, Integer, Double
+log = logging.getLogger(__name__)
+
DEFAULT_INTERVAL = 1 # s
KEY_FIELD = 'device_name'
@@ -48,19 +52,19 @@ class Process(threading.Thread):
class BWMThread(Process):
SEP=';'
- CMD="stdbuf -oL bwm-ng -t 1000 -N -o csv -c 0 -C '%s'"
+ CMD="stdbuf -oL bwm-ng -t 1000 -N -o csv -c 0 -C '%s'"
# Parsing information (from README, specs section)
# https://github.com/jgjl/bwm-ng/blob/master/README
#
# Type rate:
- FIELDS_RATE = ['timestamp', 'iface_name', 'bytes_out_s', 'bytes_in_s',
+ FIELDS_RATE = ['timestamp', 'iface_name', 'bytes_out_s', 'bytes_in_s',
'bytes_total_s', 'bytes_in', 'bytes_out', 'packets_out_s',
'packets_in_s', 'packets_total_s', 'packets_in', 'packets_out',
'errors_out_s', 'errors_in_s', 'errors_in', 'errors_out']
# Type svg, sum, max
- FIELDS_SUM = ['timestamp', 'iface_name', 'bytes_out', 'bytes_in',
- 'bytes_total', 'packets_out', 'packets_in', 'packets_total',
+ FIELDS_SUM = ['timestamp', 'iface_name', 'bytes_out', 'bytes_in',
+ 'bytes_total', 'packets_out', 'packets_in', 'packets_total',
'errors_out', 'errors_in']
def __init__(self, interfaces, callback):
@@ -74,7 +78,7 @@ class BWMThread(Process):
def run(self):
cmd = self.CMD % (self.SEP)
- p = subprocess.Popen(shlex.split(cmd), stdout = subprocess.PIPE,
+ p = subprocess.Popen(shlex.split(cmd), stdout = subprocess.PIPE,
stderr = subprocess.STDOUT)
stdout = []
self._is_running = True
@@ -85,18 +89,18 @@ class BWMThread(Process):
break
if line:
record = self._parse_line(line.strip())
- # We use 'total' to push the statistics back to VICN
+ # We use 'total' to push the statistics back to VICN
if record['iface_name'] == 'total':
for interfaces in self.groups_of_interfaces:
if not len(interfaces) > 1:
# If the tuple contains only one interface, grab
# the information from bwm_stats and sends it back
- # to VICN
+ # to VICN
if interfaces[0] not in self.bwm_stats:
continue
interface = self.bwm_stats[interfaces[0]]
f_list = [[KEY_FIELD, '==', interface.device_name]]
- query = Query(ACTION_UPDATE, Interface.__type__,
+ query = Query(ACTION_UPDATE, Interface.__type__,
filter = Filter.from_list(f_list),
params = interface.get_attribute_dict())
self._callback(query)
@@ -133,7 +137,7 @@ class BWMThread(Process):
# sum function specified because it is used to
# match the subscribe query
attrs = aggregated_interface.get_attribute_dict()
- query = Query(ACTION_UPDATE, Interface.__type__,
+ query = Query(ACTION_UPDATE, Interface.__type__,
filter = Filter.from_list([predicate]),
params = attrs,
aggregate = FUNCTION_SUM)
@@ -148,7 +152,7 @@ class BWMThread(Process):
bw_upstream = float(record['bytes_out_s']),
bw_downstream = float(record['bytes_in_s']),
)
-
+
self.bwm_stats[record['iface_name']] = interface
rc = p.poll()
@@ -176,17 +180,17 @@ class BWMInterface(BaseInterface):
packet = Packet.from_query(reply, reply = True)
self.receive(packet)
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
# Router interface
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def send_impl(self, packet):
query = packet.to_query()
- assert query.action == ACTION_SUBSCRIBE
- interval = query.params.get('interval', DEFAULT_INTERVAL) \
- if query.params else DEFAULT_INTERVAL
- assert interval
+ if query.action not in [ACTION_SUBSCRIBE]: # , ACTION_UNSUBSCRIBE]:
+ log.warning("Ignore unknown action {}".format(
+ ACTION2STR[query.action]))
+ return
# TODO: Add the sum operator. If sum the list of interfaces is
# added to the BWMThread as a tuple, otherwise every single
@@ -194,15 +198,18 @@ class BWMInterface(BaseInterface):
# We currently simply extract it from the filter
interfaces_list = [p.value for p in query.filter if p.key == KEY_FIELD]
-
+
# interfaces is a list of tuple. If someone sbscribe to mulitple
# interfaces interfaces will be a list of 1 tuple. The tuple will
# contain the set of interfaces
- assert len(interfaces_list) == 1
+ if len(interfaces_list) != 1:
+ log.warning("interfaces_list should have len = 1: {}".format(interfaces_list))
+ return
+
interfaces = interfaces_list[0] \
if isinstance(interfaces_list[0], tuple) \
else tuple([interfaces_list[0]])
-
+
# Check if interfaces is more than one. In this case, we only support
# The SUM function on the list of field.
if len(interfaces) > 1:
diff --git a/netmodel/interfaces/vicn.py b/netmodel/interfaces/vicn.py
index 9ec9672e..80195f9a 100644
--- a/netmodel/interfaces/vicn.py
+++ b/netmodel/interfaces/vicn.py
@@ -16,16 +16,20 @@
# limitations under the License.
#
+import logging
+
from vicn.core.task import BashTask
from netmodel.model.object import Object
from netmodel.model.attribute import Attribute
-from netmodel.model.query import Query, ACTION_INSERT
+from netmodel.model.query import Query, ACTION_INSERT, ACTION_SELECT
from netmodel.model.type import String
from netmodel.network.interface import Interface, InterfaceState
from netmodel.network.packet import Packet
from netmodel.network.prefix import Prefix
from netmodel.util.misc import lookahead
+log = logging.getLogger(__name__)
+
class VICNBaseResource(Object):
__type__ = 'vicn/'
@@ -50,18 +54,27 @@ class VICNBaseResource(Object):
elif query.object_name == 'resource':
resources = interface._manager.get_resources()
else:
- resources = interface._manager.by_type_str(query.object_name)
-
- for resource, last in lookahead(resources):
- params = resource.get_attribute_dict(aggregates = True)
- params['id'] = resource._state.uuid._uuid
- params['type'] = resource.get_types()
- params['state'] = resource._state.state
- params['log'] = resource._state.log
- reply = Query(ACTION_INSERT, query.object_name, params = params)
- reply.last = last
- packet = Packet.from_query(reply, reply = True)
- cb(packet, ingress_interface = interface)
+ _resources = interface._manager.by_type_str(query.object_name)
+ resources = list()
+ for resource in _resources:
+ group_names = [r.name for r in resource.groups]
+ resources.append(resource)
+
+ if query.action == ACTION_SELECT:
+ for resource, last in lookahead(resources):
+ params = resource.get_attribute_dict(aggregates = True)
+ params['id'] = resource._state.uuid._uuid
+ params['type'] = resource.get_types()
+ params['state'] = resource._state.state
+ params['log'] = resource._state.log
+ reply = Query(ACTION_INSERT, query.object_name, params = params)
+ reply.last = last
+ packet = Packet.from_query(reply, reply = True)
+ cb(packet, ingress_interface = interface)
+ else:
+ log.warning("Unknown action in query {}".format(query))
+
+ interface._manager._broadcast(query)
class L2Graph(Object):
__type__ = 'vicn/l2graph'
diff --git a/netmodel/interfaces/vpp/__init__.py b/netmodel/interfaces/vpp/__init__.py
new file mode 100644
index 00000000..34d106fd
--- /dev/null
+++ b/netmodel/interfaces/vpp/__init__.py
@@ -0,0 +1,225 @@
+#!/usr/bin/env python3
+
+# Dependency: vpp-api-python
+
+import asyncio
+import asyncio.subprocess
+import collections
+import copy
+import logging
+import pyparsing as pp
+import socket
+import time
+
+from netmodel.model.attribute import Attribute
+from netmodel.model.filter import Filter
+from netmodel.model.query import Query, ACTION2STR, ACTION_UPDATE
+from netmodel.model.query import ACTION_SUBSCRIBE, ACTION_UNSUBSCRIBE
+from netmodel.model.object import Object
+from netmodel.model.type import Double, String
+from netmodel.network.interface import Interface as BaseInterface
+from netmodel.network.packet import Packet
+
+log = logging.getLogger(__name__)
+
+DEFAULT_INTERVAL = 1 # s
+KEY_FIELD = 'device_name'
+
+def parse(s):
+ kw_name = pp.Keyword('Name')
+ kw_idx = pp.Keyword('Idx')
+ kw_state = pp.Keyword('State')
+ kw_counter = pp.Keyword('Counter')
+ kw_count = pp.Keyword('Count')
+
+ kw_up = pp.CaselessKeyword('up')
+ kw_down = pp.CaselessKeyword('down')
+ kw_rx_packets = pp.CaselessKeyword('rx packets')
+ kw_rx_bytes = pp.CaselessKeyword('rx bytes')
+ kw_tx_packets = pp.CaselessKeyword('tx packets')
+ kw_tx_bytes = pp.CaselessKeyword('tx bytes')
+ kw_drops = pp.CaselessKeyword('drops')
+ kw_ip4 = pp.CaselessKeyword('ip4')
+ kw_ip6 = pp.CaselessKeyword('ip6')
+ kw_tx_error = pp.CaselessKeyword('tx-error')
+ kw_rx_miss = pp.CaselessKeyword('rx-miss')
+
+ header = kw_name + kw_idx + kw_state + kw_counter + kw_count
+
+ interface = (pp.Word(pp.alphanums + '/' + '-').setResultsName('device_name') + \
+ pp.Word(pp.nums).setResultsName('index') + \
+ pp.oneOf(['up', 'down']).setResultsName('state') + \
+ pp.Optional(kw_rx_packets + pp.Word(pp.nums).setResultsName('rx_packets')) + \
+ pp.Optional(kw_rx_bytes + pp.Word(pp.nums).setResultsName('rx_bytes')) + \
+ pp.Optional(kw_tx_packets + pp.Word(pp.nums).setResultsName('tx_packets')) + \
+ pp.Optional(kw_tx_bytes + pp.Word(pp.nums).setResultsName('tx_bytes')) + \
+ pp.Optional(kw_drops + pp.Word(pp.nums).setResultsName('drops')) + \
+ pp.Optional(kw_ip4 + pp.Word(pp.nums).setResultsName('ip4')) + \
+ pp.Optional(kw_ip6 + pp.Word(pp.nums).setResultsName('ip6')) + \
+ pp.Optional(kw_rx_miss + pp.Word(pp.nums).setResultsName('rx_miss')) + \
+ pp.Optional(kw_tx_error + pp.Word(pp.nums).setResultsName('tx_error'))
+ ).setParseAction(lambda t: t.asDict())
+
+ bnf = (
+ header.suppress() +
+ pp.OneOrMore(interface)
+ ).setParseAction(lambda t: t.asList())
+
+ return bnf.parseString(s, parseAll = True).asList()
+
+class VPPInterface(Object):
+ __type__ = 'vpp_interface'
+
+ node = Attribute(String)
+ device_name = Attribute(String)
+ bw_upstream = Attribute(Double) # bytes
+ bw_downstream = Attribute(Double) # bytes
+
+class VPPCtlInterface(BaseInterface):
+ __interface__ = 'vppctl'
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.register_object(VPPInterface)
+
+ # Set of monitored interfaces
+ self._interfaces = collections.defaultdict(int)
+ self._running = False
+
+ # interface -> (time, rx, tx)
+ self._last = dict()
+
+ async def _tick(self):
+ while self._running:
+ try:
+ create = asyncio.create_subprocess_exec(
+ 'vppctl_wrapper', 'show', 'int',
+ stdout=asyncio.subprocess.PIPE,
+ )
+ proc = await create
+ await proc.wait()
+ stdout = await proc.stdout.read()
+
+ if proc.returncode:
+ log.error("error")
+ return
+
+ interfaces = parse(stdout.decode())
+ last = copy.copy(self._last)
+ self._last = dict()
+ now = time.time()
+ for interface in interfaces:
+ if not interface['device_name'] in self._interfaces:
+ continue
+ tx = float(interface['tx_bytes'])
+ rx = float(interface['rx_bytes'])
+ self._last[interface['device_name']] = (now, rx, tx)
+
+ if not interface['device_name'] in last:
+ continue
+ prev_now, prev_rx, prev_tx = last[interface['device_name']]
+
+ # Per interface throughput computation
+ ret = {
+ 'node' : socket.gethostname(),
+ 'device_name' : interface['device_name'],
+ 'bw_upstream' : (tx - prev_tx) / (now - prev_now),
+ 'bw_downstream' : (rx - prev_rx) / (now - prev_now),
+ }
+
+ f_list = [[KEY_FIELD, '==', interface['device_name']]]
+ del interface['device_name']
+ query = Query(ACTION_UPDATE, VPPInterface.__type__,
+ filter = Filter.from_list(f_list),
+ params = ret)
+ self.receive(Packet.from_query(query, reply = True))
+ except Exception as e:
+ import traceback; traceback.print_exc()
+ log.error("Could not perform measurement {}".format(e))
+
+ await asyncio.sleep(DEFAULT_INTERVAL)
+
+ #--------------------------------------------------------------------------
+ # Router interface
+ #--------------------------------------------------------------------------
+
+ def send_impl(self, packet):
+ query = packet.to_query()
+
+ if query.action not in (ACTION_SUBSCRIBE, ACTION_UNSUBSCRIBE):
+ log.warning("Ignore unknown action {}".format(
+ ACTION2STR[query.action]))
+ return
+
+ # We currently simply extract it from the filter
+ interfaces = set([p.value for p in query.filter if p.key == KEY_FIELD])
+
+ for interface in interfaces:
+ if query.action == ACTION_SUBSCRIBE:
+ self._interfaces[interface] += 1
+ else:
+ self._interfaces[interface] -= 1
+
+ all_interfaces = set([k for k, v in self._interfaces.items() if v > 0])
+
+ if all_interfaces and not self._running:
+ self._running = True
+ asyncio.ensure_future(self._tick())
+ elif not all_interfaces and self._running:
+ self._running = False
+
+
+#-------------------------------------------------------------------------------
+
+if __name__ == '__main__':
+ x=""" Name Idx State Counter Count
+ TenGigabitEthernetc/0/1 1 up rx packets 3511586
+ rx bytes 4785592030
+ tx packets 3511678
+ tx bytes 313021701
+ drops 7
+ ip4 161538
+ ip6 3350047
+ tx-error 2
+ host-bh1 4 up rx packets 5
+ rx bytes 394
+ tx packets 10
+ tx bytes 860
+ drops 4
+ ip6 4
+ host-bh2 6 up rx packets 3164301
+ rx bytes 287315869
+ tx packets 3164238
+ tx bytes 4290944332
+ drops 4
+ ip4 161539
+ ip6 3002759
+ host-bh3 7 up rx packets 33066
+ rx bytes 2446928
+ tx packets 33060
+ tx bytes 47058708
+ drops 5
+ ip6 33065
+ host-bh4 5 up rx packets 114407
+ rx bytes 8466166
+ tx packets 114412
+ tx bytes 162905294
+ drops 7
+ ip6 114406
+ host-bh5 3 up rx packets 150574
+ rx bytes 11142524
+ tx packets 150578
+ tx bytes 214407016
+ drops 7
+ ip6 150573
+ host-bh6 2 up rx packets 49380
+ rx bytes 3654160
+ tx packets 49368
+ tx bytes 70283976
+ drops 9
+ ip6 49377
+ local0 0 down drops 3
+ """
+
+ r = parse(x)
+ print(r)
diff --git a/netmodel/interfaces/websocket/__init__.py b/netmodel/interfaces/websocket/__init__.py
index cb79fc39..b6402aca 100644
--- a/netmodel/interfaces/websocket/__init__.py
+++ b/netmodel/interfaces/websocket/__init__.py
@@ -97,7 +97,7 @@ class ClientProtocol(WebSocketClientProtocol):
Websocket opening handshake has completed.
"""
self.factory.interface._on_client_open(self)
-
+
def onMessage(self, payload, isBinary):
self.factory.interface._on_client_message(self, payload, isBinary)
@@ -109,7 +109,7 @@ class ClientProtocol(WebSocketClientProtocol):
class WebSocketClientInterface(Interface):
"""
All messages are exchanged using text (non-binary) mode.
- """
+ """
__interface__ = 'websocketclient'
def __init__(self, *args, **kwargs):
@@ -149,6 +149,11 @@ class WebSocketClientInterface(Interface):
# Holds the instance of the connect client protocol
self._client = None
+ def __repr__(self):
+ return '<WebSocketClientInterface {}>'.format(self._client)
+
+ __str__ = __repr__
+
#--------------------------------------------------------------------------
# Interface API
#--------------------------------------------------------------------------
@@ -168,10 +173,10 @@ class WebSocketClientInterface(Interface):
async def _connect(self):
loop = asyncio.get_event_loop()
try:
- self._instance = await loop.create_connection(self._factory,
+ self._instance = await loop.create_connection(self._factory,
self._address, self._port)
except Exception as e:
- log.warning('Connect failed : {}'.format(e))
+ log.warning('Connect failed on {} : {}'.format(self, e))
self._instance = None
# don't await for retry, since it cause an infinite recursion...
asyncio.ensure_future(self._retry())
@@ -206,7 +211,7 @@ class WebSocketClientInterface(Interface):
query, record = args
else:
query = args
-
+
if isinstance(query, dict):
query = Query.from_dict(query)
else:
@@ -226,7 +231,7 @@ class WebSocketClientInterface(Interface):
asyncio.ensure_future(self._retry())
#------------------------------------------------------------------------------
-
+
class ServerProtocol(WebSocketServerProtocol, Interface):
"""
Default WebSocket server protocol.
@@ -244,7 +249,7 @@ class ServerProtocol(WebSocketServerProtocol, Interface):
Constructor.
Args:
- callback (Function[ -> ]) :
+ callback (Function[ -> ]) :
hook (Function[->]) : Hook method to be called for every packet to
be sent on the interface. Processing continues with the packet
returned by this function, or is interrupted in case of a None
@@ -252,6 +257,12 @@ class ServerProtocol(WebSocketServerProtocol, Interface):
"""
WebSocketServerProtocol.__init__(self)
Interface.__init__(self, callback=callback, hook=hook)
+ self._last_peer = None
+
+ def __repr__(self):
+ return '<WebSocketInterface {}>'.format(self._last_peer if self._last_peer else 'N/A')
+
+ __str__ = __repr__
#--------------------------------------------------------------------------
# Interface API
@@ -272,9 +283,10 @@ class ServerProtocol(WebSocketServerProtocol, Interface):
# Websocket events
def onConnect(self, request):
+ self._last_peer = request.peer
self.factory._instances.append(self)
self.set_state(InterfaceState.Up)
-
+
def onOpen(self):
#print("WebSocket connection open.")
pass
@@ -305,7 +317,7 @@ class WebSocketServerInterface(Interface):
It is also used to broadcast packets to all connected clients.
All messages are exchanged using text (non-binary) mode.
- """
+ """
__interface__ = 'websocketserver'
@@ -331,6 +343,12 @@ class WebSocketServerInterface(Interface):
# packets.
self._factory._instances = list()
+ def __repr__(self):
+ return '<WebSocketServerInterface ws://{}:{}'.format(
+ self._address, self._port)
+
+ __str__ = __repr__
+
#--------------------------------------------------------------------------
# Interface API
#--------------------------------------------------------------------------
@@ -343,7 +361,7 @@ class WebSocketServerInterface(Interface):
loop = asyncio.get_event_loop()
# Websocket server
log.info('WebSocket server started')
- self._server = await loop.create_server(self._factory, self._address,
+ self._server = await loop.create_server(self._factory, self._address,
self._port)
await self._set_state(InterfaceState.Up)
diff --git a/netmodel/model/attribute.py b/netmodel/model/attribute.py
index b69ee1bf..b2fa2331 100644
--- a/netmodel/model/attribute.py
+++ b/netmodel/model/attribute.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Cisco and/or its affiliates.
@@ -22,11 +22,10 @@ import logging
import operator
import types
-from netmodel.model.mapper import ObjectSpecification
-from netmodel.model.type import is_type
-from netmodel.util.meta import inheritors
-from netmodel.util.misc import is_iterable
-from vicn.core.sa_collections import InstrumentedList, _list_decorators
+from netmodel.model.mapper import ObjectSpecification
+from netmodel.model.type import Type, Self
+from netmodel.util.misc import is_iterable
+from netmodel.model.collection import Collection
log = logging.getLogger(__name__)
instance_dict = operator.attrgetter('__dict__')
@@ -38,26 +37,25 @@ class NEVER_SET: None
#------------------------------------------------------------------------------
class Multiplicity:
- _1_1 = '1_1'
- _1_N = '1_N'
- _N_1 = 'N_1'
- _N_N = 'N_N'
-
+ OneToOne = '1_1'
+ OneToMany = '1_N'
+ ManyToOne = 'N_1'
+ ManyToMany = 'N_N'
@staticmethod
def reverse(value):
reverse_map = {
- Multiplicity._1_1: Multiplicity._1_1,
- Multiplicity._1_N: Multiplicity._N_1,
- Multiplicity._N_1: Multiplicity._1_N,
- Multiplicity._N_N: Multiplicity._N_N,
+ Multiplicity.OneToOne: Multiplicity.OneToOne,
+ Multiplicity.OneToMany: Multiplicity.ManyToOne,
+ Multiplicity.ManyToOne: Multiplicity.OneToMany,
+ Multiplicity.ManyToMany: Multiplicity.ManyToMany,
}
return reverse_map[value]
# Default attribute properties values (default to None)
DEFAULT = {
- 'multiplicity' : Multiplicity._1_1,
+ 'multiplicity' : Multiplicity.OneToOne,
'mandatory' : False,
}
@@ -71,33 +69,36 @@ class Attribute(abc.ABC, ObjectSpecification):
'type',
'description',
'default',
- 'choices',
'mandatory',
'multiplicity',
'ro',
'auto',
'func',
- 'requirements',
'reverse_name',
'reverse_description',
'reverse_auto'
]
def __init__(self, *args, **kwargs):
- for key in Attribute.properties:
+ for key in kwargs.keys():
+ if not key in self.properties:
+ raise ValueError("Invalid attribute property {}".format(key))
+ for key in self.properties:
value = kwargs.pop(key, NEVER_SET)
setattr(self, key, value)
if len(args) == 1:
self.type, = args
- elif len(args) == 2:
- self.name, self.type = args
- assert is_type(self.type)
+ # self.type is optional since the type can be inherited. Although we
+ # will have to verify the attribute is complete at some point
+ if isinstance(self.type, str):
+ self.type = Type.from_string(self.type)
+ assert self.type is Self or Type.exists(self.type)
self.is_aggregate = False
self._reverse_attributes = list()
-
+
#--------------------------------------------------------------------------
# Display
#--------------------------------------------------------------------------
@@ -107,6 +108,15 @@ class Attribute(abc.ABC, ObjectSpecification):
__str__ = __repr__
+ # The following functions are required to allow comparing attributes, and
+ # using them as dict keys
+
+ def __eq__(self, other):
+ return self.name == other.name
+
+ def __hash__(self):
+ return hash(self.name)
+
#--------------------------------------------------------------------------
# Descriptor protocol
#
@@ -118,7 +128,7 @@ class Attribute(abc.ABC, ObjectSpecification):
return self
value = instance_dict(instance).get(self.name, NEVER_SET)
-
+
# Case : collection attribute
if self.is_collection:
if value is NEVER_SET:
@@ -126,12 +136,12 @@ class Attribute(abc.ABC, ObjectSpecification):
default = self.default(instance)
else:
default = self.default
- value = InstrumentedList(default)
+ value = Collection(default)
value._attribute = self
value._instance = instance
self.__set__(instance, value)
return value
- return value
+ return value
# Case : scalar attribute
@@ -159,8 +169,8 @@ class Attribute(abc.ABC, ObjectSpecification):
return
if self.is_collection:
- if not isinstance(value, InstrumentedList):
- value = InstrumentedList(value)
+ if not isinstance(value, Collection):
+ value = Collection(value)
value._attribute = self
value._instance = instance
@@ -172,6 +182,10 @@ class Attribute(abc.ABC, ObjectSpecification):
def __delete__(self, instance):
raise NotImplementedError
+ def __set_name__(self, owner, name):
+ self.name = name
+ self.owner = owner
+
#--------------------------------------------------------------------------
# Accessors
#--------------------------------------------------------------------------
@@ -184,17 +198,16 @@ class Attribute(abc.ABC, ObjectSpecification):
return DEFAULT.get(name, None)
return value
- # Shortcuts
-
def has_reverse_attribute(self):
return self.reverse_name and self.multiplicity
@property
def is_collection(self):
- return self.multiplicity in (Multiplicity._1_N, Multiplicity._N_N)
+ return self.multiplicity in (Multiplicity.OneToMany,
+ Multiplicity.ManyToMany)
def is_set(self, instance):
- return self.name in instance_dict(instance)
+ return instance.is_set(self.name)
#--------------------------------------------------------------------------
# Operations
@@ -217,46 +230,3 @@ class Attribute(abc.ABC, ObjectSpecification):
value.extend(parent_value)
else:
setattr(self, prop, parent_value)
-
- #--------------------------------------------------------------------------
- # Attribute values
- #--------------------------------------------------------------------------
-
- def _handle_getitem(self, instance, item):
- return item
-
- def _handle_add(self, instance, item):
- instance._state.dirty = True
- instance._state.attr_dirty.add(self.name)
- print('marking', self.name, 'as dirty')
- return item
-
- def _handle_remove(self, instance, item):
- instance._state.dirty = True
- instance._state.attr_dirty.add(self.name)
- print('marking', self.name, 'as dirty')
-
- def _handle_before_remove(self, instance):
- pass
-
- #--------------------------------------------------------------------------
- # Attribute values
- #--------------------------------------------------------------------------
-
-class Relation(Attribute):
- properties = Attribute.properties[:]
- properties.extend([
- 'reverse_name',
- 'reverse_description',
- 'multiplicity',
- ])
-
-class SelfRelation(Relation):
- def __init__(self, *args, **kwargs):
- if args:
- if not len(args) == 1:
- raise ValueError('Bad initialized for SelfRelation')
- name, = args
- super().__init__(name, None, *args, **kwargs)
- else:
- super().__init__(None, *args, **kwargs)
diff --git a/netmodel/model/collection.py b/netmodel/model/collection.py
index 21be84d8..01a63299 100644
--- a/netmodel/model/collection.py
+++ b/netmodel/model/collection.py
@@ -16,9 +16,10 @@
# limitations under the License.
#
-from netmodel.model.filter import Filter
+from netmodel.model.sa_collections import InstrumentedList
+from netmodel.model.filter import Filter
-class Collection(list):
+class Collection(InstrumentedList):
"""
A collection corresponds to a list of objects, and includes processing functionalities to
manipulate them.
diff --git a/netmodel/model/key.py b/netmodel/model/key.py
new file mode 100644
index 00000000..bc49af03
--- /dev/null
+++ b/netmodel/model/key.py
@@ -0,0 +1,19 @@
+from netmodel.model.mapper import ObjectSpecification
+
+class Key(ObjectSpecification):
+ def __init__(self, *attributes):
+ self._attributes = attributes
+
+ #--------------------------------------------------------------------------
+ # Descriptor protocol
+ #
+ # see. https://docs.python.org/3/howto/descriptor.html
+ #--------------------------------------------------------------------------
+
+ def __set_name__(self, owner, name):
+ self._name = name
+ self._owner = owner
+
+ def __iter__(self):
+ for attribute in self._attributes:
+ yield attribute
diff --git a/netmodel/model/mapper.py b/netmodel/model/mapper.py
index 9be46a14..856238c7 100644
--- a/netmodel/model/mapper.py
+++ b/netmodel/model/mapper.py
@@ -16,5 +16,7 @@
# limitations under the License.
#
-class ObjectSpecification:
+import sys
+
+class ObjectSpecification:
pass
diff --git a/netmodel/model/object.py b/netmodel/model/object.py
index 32d3a833..99dbe0c2 100644
--- a/netmodel/model/object.py
+++ b/netmodel/model/object.py
@@ -18,7 +18,10 @@
from abc import ABCMeta
-from netmodel.model.attribute import Attribute
+import sys
+
+from netmodel.model.attribute import Attribute, Multiplicity
+from netmodel.model.key import Key
from netmodel.model.type import BaseType
from netmodel.model.mapper import ObjectSpecification
@@ -26,11 +29,21 @@ from netmodel.model.mapper import ObjectSpecification
E_UNK_RES_NAME = 'Unknown resource name for attribute {} in {} ({}) : {}'
-class ObjectMetaclass(ABCMeta):
+class ObjectMetaclass(type):
"""
Object metaclass allowing non-uniform attribute declaration.
"""
+ def __new__(mcls, name, bases, attrs):
+ cls = super(ObjectMetaclass, mcls).__new__(mcls, name, bases, attrs)
+ if (sys.version_info < (3, 6)):
+ # Before Python 3.6, descriptor protocol does not include __set_name__.
+ # We use a metaclass to emulate the functionality.
+ for attr, obj in attrs.items():
+ if isinstance(obj, ObjectSpecification):
+ obj.__set_name__(cls, attr)
+ return cls
+
def __init__(cls, class_name, parents, attrs):
"""
Args:
@@ -67,19 +80,19 @@ class Object(BaseType, metaclass = ObjectMetaclass):
else:
resource = x
if not resource:
- raise LurchException(E_UNK_RES_NAME.format(key,
+ raise LurchException(E_UNK_RES_NAME.format(key,
self.name, self.__class__.__name__, x))
new_value.append(resource._state.uuid)
value = new_value
else:
if isinstance(value, str):
- resource = self._state.manager.by_name(value)
+ resource = self._state.manager.by_name(value)
elif isinstance(value, UUID):
- resource = self._state.manager.by_uuid(value)
+ resource = self._state.manager.by_uuid(value)
else:
resource = value
if not resource:
- raise LurchException(E_UNK_RES_NAME.format(key,
+ raise LurchException(E_UNK_RES_NAME.format(key,
self.name, self.__class__.__name__, value))
value = resource._state.uuid
setattr(self, key, value)
@@ -111,19 +124,20 @@ class Object(BaseType, metaclass = ObjectMetaclass):
@classmethod
def _sanitize(cls):
- """Sanitize the object model to accomodate for multiple declaration
- styles
+ """
+ This methods performs sanitization of the object declaration.
+
+ More specifically:
+ - it goes over all attributes and sets their name based on the python
+ object attribute name.
+ - it establishes mutual object relationships through reverse attributes.
- In particular, this method:
- - set names to all attributes
"""
cls._reverse_attributes = dict()
cur_reverse_attributes = dict()
for name, obj in vars(cls).items():
- if not isinstance(obj, ObjectSpecification):
+ if not isinstance(obj, Attribute):
continue
- if isinstance(obj, Attribute):
- obj.name = name
# Remember whether a reverse_name is defined before loading
# inherited properties from parent
@@ -135,30 +149,72 @@ class Object(BaseType, metaclass = ObjectMetaclass):
if hasattr(base, name):
parent_attribute = getattr(base, name)
obj.merge(parent_attribute)
- assert obj.type
+ assert obj.type, "No type for obj={} cls={}, base={}".format(obj, cls, base)
# Handle reverse attribute
#
# NOTE: we need to do this after merging to be sure we get all
# properties inherited from parent (eg. multiplicity)
+ #
+ # See "Reverse attributes" section in BaseResource docstring.
+ #
+ # Continueing with the same example, let's detail how it is handled:
+ #
+ # Original declaration:
+ # >>>
+ # class Group(Resource):
+ # resources = Attribute(Resource, description = 'Resources belonging to the group',
+ # multiplicity = Multiplicity.ManyToMany,
+ # default = [],
+ # reverse_name = 'groups',
+ # reverse_description = 'Groups to which the resource belongs')
+ # <<<
+ #
+ # Local variables:
+ # cls = <class 'vicn.resource.group.Group'>
+ # obj = <Attribute resources>
+ # obj.type = <class 'vicn.core.Resource'>
+ # reverse_attribute = <Attribute groups>
+ #
+ # Result:
+ # 1) Group._reverse_attributes =
+ # { <Attribute resources> : [<Attribute groups>, ...], ...}
+ # 2) Add attribute <Attribute groups> to class Resource
+ # 3) Resource._reverse_attributes =
+ # { <Attribute groups> : [<Attribute resources], ...], ...}
+ #
if has_reverse:
a = {
- 'name' : obj.reverse_name,
- 'description' : obj.reverse_description,
- 'multiplicity' : Multiplicity.reverse(obj.multiplicity),
- 'auto' : obj.reverse_auto,
+ 'name' : obj.reverse_name,
+ 'description' : obj.reverse_description,
+ 'multiplicity' : Multiplicity.reverse(obj.multiplicity),
+ 'reverse_name' : obj.name,
+ 'reverse_description' : obj.description,
+ 'auto' : obj.reverse_auto,
}
- reverse_attribute = Attribute(cls, **a)
+
+ # We need to use the same class as the Attribute !
+ reverse_attribute = obj.__class__(cls, **a)
reverse_attribute.is_aggregate = True
+ # 1) Store the reverse attributes to be later inserted in the
+ # remote class, at the end of the function
+ # TODO : clarify the reasons to perform this in two steps
cur_reverse_attributes[obj.type] = reverse_attribute
+ # 2)
if not obj in cls._reverse_attributes:
cls._reverse_attributes[obj] = list()
cls._reverse_attributes[obj].append(reverse_attribute)
- for cls, a in cur_reverse_attributes.items():
- setattr(cls, a.name, a)
+ # 3)
+ if not reverse_attribute in obj.type._reverse_attributes:
+ obj.type._reverse_attributes[reverse_attribute] = list()
+ obj.type._reverse_attributes[reverse_attribute].append(obj)
+
+ # Insert newly created reverse attributes in the remote class
+ for kls, a in cur_reverse_attributes.items():
+ setattr(kls, a.name, a)
@classmethod
def iter_attributes(cls, aggregates = False):
@@ -168,7 +224,7 @@ class Object(BaseType, metaclass = ObjectMetaclass):
continue
if attribute.is_aggregate and not aggregates:
continue
-
+
yield attribute
def get_attributes(self, aggregates = False):
@@ -178,7 +234,7 @@ class Object(BaseType, metaclass = ObjectMetaclass):
return set(a.name for a in self.iter_attributes(aggregates = \
aggregates))
- def get_attribute_dict(self, field_names = None, aggregates = False,
+ def get_attribute_dict(self, field_names = None, aggregates = False,
uuid = True):
assert not field_names or field_names.is_star()
attributes = self.get_attributes(aggregates = aggregates)
@@ -192,14 +248,29 @@ class Object(BaseType, metaclass = ObjectMetaclass):
ret[a.name] = list()
for x in value:
if uuid and isinstance(x, Object):
- x = x._state.uuid._uuid
+ x = x._state.uuid._uuid
ret[a.name].append(x)
else:
if uuid and isinstance(value, Object):
- value = value._state.uuid._uuid
+ value = value._state.uuid._uuid
ret[a.name] = value
return ret
+ @classmethod
+ def iter_keys(cls):
+ for name in dir(cls):
+ key = getattr(cls, name)
+ if not isinstance(key, Key):
+ continue
+ yield key
+
+ @classmethod
+ def get_keys(cls):
+ return list(cls.iter_keys())
+
+ def get_key_dicts(self):
+ return [{attribute: self.get(attribute.name) for attribute in key} for key in self.iter_keys()]
+
def get_tuple(self):
return (self.__class__, self._get_attribute_dict())
@@ -229,3 +300,8 @@ class Object(BaseType, metaclass = ObjectMetaclass):
def has_attribute(cls, name):
return name in [a.name for a in cls.attributes()]
+ def get(self, attribute_name):
+ raise NotImplementedError
+
+ def set(self, attribute_name, value):
+ raise NotImplementedError
diff --git a/netmodel/model/query.py b/netmodel/model/query.py
index c182cb45..a1d331fb 100644
--- a/netmodel/model/query.py
+++ b/netmodel/model/query.py
@@ -46,7 +46,7 @@ FUNCTION2STR = {
STR2FUNCTION = dict((v, k) for k, v in FUNCTION2STR.items())
class Query:
- def __init__(self, action, object_name, filter = None, params = None,
+ def __init__(self, action, object_name, filter = None, params = None,
field_names = None, aggregate = None, last = False, reply = False):
self.action = action
self.object_name = object_name
@@ -64,13 +64,13 @@ class Query:
if field_names:
if isinstance(field_names, FieldNames):
self.field_names = field_names
- else:
+ else:
self.field_names = FieldNames(field_names)
else:
self.field_names = FieldNames()
self.aggregate = aggregate
-
+
self.last = last
self.reply = reply
@@ -100,7 +100,7 @@ class Query:
field_names = FieldNames(star = True)
last = dic.get('last', False)
reply = dic.get('reply', False)
- return Query(action, object_name, filter, params, field_names,
+ return Query(action, object_name, filter, params, field_names,
aggregate, last)
def to_sql(self, multiline = False):
@@ -140,8 +140,7 @@ class Query:
return strmap[self.action] % locals()
- def __str__(self):
- return self.to_sql()
-
def __repr__(self):
return self.to_sql()
+
+ __str__ = __repr__
diff --git a/vicn/core/sa_collections.py b/netmodel/model/sa_collections.py
index a4a24f85..5e651061 100644
--- a/vicn/core/sa_collections.py
+++ b/netmodel/model/sa_collections.py
@@ -12,9 +12,10 @@
import logging
-from vicn.core.exception import VICNListException
-from vicn.core.sa_compat import py2k
-from vicn.core.state import UUID
+from netmodel.model.sa_compat import py2k
+from netmodel.model.uuid import UUID
+
+class InstrumentedListException(Exception): pass
log = logging.getLogger(__name__)
@@ -30,7 +31,7 @@ def _list_decorators():
try:
item = self._attribute.do_list_add(self._instance, item)
fn(self, item)
- except VICNListException as e:
+ except InstrumentedListException as e:
pass
_tidy(append)
return append
diff --git a/vicn/core/sa_compat.py b/netmodel/model/sa_compat.py
index 34211455..34211455 100644
--- a/vicn/core/sa_compat.py
+++ b/netmodel/model/sa_compat.py
diff --git a/netmodel/model/type.py b/netmodel/model/type.py
index 20dc2580..9a7b8740 100644
--- a/netmodel/model/type.py
+++ b/netmodel/model/type.py
@@ -16,27 +16,47 @@
# limitations under the License.
#
+from socket import inet_pton, inet_ntop, AF_INET6
+from struct import unpack, pack
+from abc import ABCMeta
+
from netmodel.util.meta import inheritors
class BaseType:
+ __choices__ = None
+
@staticmethod
def name():
return self.__class__.__name__.lower()
+ @classmethod
+ def restrict(cls, **kwargs):
+ class BaseType(cls):
+ __choices__ = kwargs.pop('choices', None)
+ return BaseType
+
class String(BaseType):
- def __init__(self, *args, **kwargs):
- self._min_size = kwargs.pop('min_size', None)
- self._max_size = kwargs.pop('max_size', None)
- self._ascii = kwargs.pop('ascii', False)
- self._forbidden = kwargs.pop('forbidden', None)
- super().__init__()
+ __min_size__ = None
+ __max_size__ = None
+ __ascii__ = None
+ __forbidden__ = None
+
+ @classmethod
+ def restrict(cls, **kwargs):
+ base = super().restrict(**kwargs)
+ class String(base):
+ __max_size__ = kwargs.pop('max_size', None)
+ __min_size__ = kwargs.pop('min_size', None)
+ __ascii__ = kwargs.pop('ascii', None)
+ __forbidden__ = kwargs.pop('forbidden', None)
+ return String
class Integer(BaseType):
def __init__(self, *args, **kwargs):
self._min_value = kwargs.pop('min_value', None)
self._max_value = kwargs.pop('max_value', None)
super().__init__()
-
+
class Double(BaseType):
def __init__(self, *args, **kwargs):
self._min_value = kwargs.pop('min_value', None)
@@ -49,12 +69,161 @@ class Bool(BaseType):
class Dict(BaseType):
pass
+class PrefixTreeException(Exception): pass
+class NotEnoughAddresses(PrefixTreeException): pass
+class UnassignablePrefix(PrefixTreeException): pass
+
+class Prefix(BaseType, metaclass=ABCMeta):
+
+ def __init__(self, ip_address, prefix_len=None):
+ if not prefix_len:
+ if not isinstance(ip_address, str):
+ import pdb; pdb.set_trace()
+ if '/' in ip_address:
+ ip_address, prefix_len = ip_address.split('/')
+ prefix_len = int(prefix_len)
+ else:
+ prefix_len = self.MAX_PREFIX_SIZE
+ if isinstance(ip_address, str):
+ ip_address = self.aton(ip_address)
+ self.ip_address = ip_address
+ self.prefix_len = prefix_len
+
+ def __contains__(self, obj):
+ #it can be an IP as a integer
+ if isinstance(obj, int):
+ obj = type(self)(obj, self.MAX_PREFIX_SIZE)
+ #Or it's an IP string
+ if isinstance(obj, str):
+ #It's a prefix as 'IP/prefix'
+ if '/' in obj:
+ split_obj = obj.split('/')
+ obj = type(self)(split_obj[0], int(split_obj[1]))
+ else:
+ obj = type(self)(obj, self.MAX_PREFIX_SIZE)
+
+ return self._contains_prefix(obj)
+
+ @classmethod
+ def mask(cls):
+ mask_len = cls.MAX_PREFIX_SIZE//8 #Converts from bits to bytes
+ mask = 0
+ for step in range(0,mask_len):
+ mask = (mask << 8) | 0xff
+ return mask
+
+ def _contains_prefix(self, prefix):
+ assert isinstance(prefix, type(self))
+ return (prefix.prefix_len >= self.prefix_len and
+ prefix.ip_address >= self.first_prefix_address() and
+ prefix.ip_address <= self.last_prefix_address())
+
+ #Returns the first address of a prefix
+ def first_prefix_address(self):
+ return self.ip_address & (self.mask() << (self.MAX_PREFIX_SIZE-self.prefix_len))
+
+ def canonical_prefix(self):
+ return type(self)(self.first_prefix_address(), self.prefix_len)
+
+ def last_prefix_address(self):
+ return self.ip_address | (self.mask() >> self.prefix_len)
+
+ def limits(self):
+ return self.first_prefix_address(), self.last_prefix_address()
+
+ def __str__(self):
+ return "{}/{}".format(self.ntoa(self.first_prefix_address()), self.prefix_len)
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return False
+ return self.get_tuple() == other.get_tuple()
+
+ def get_tuple(self):
+ return (self.first_prefix_address(), self.prefix_len)
+
+ def __hash__(self):
+ return hash(self.get_tuple())
+
+ def __iter__(self):
+ return self.get_iterator()
+
+ #Iterates by steps of prefix_len, e.g., on all available /31 in a /24
+ def get_iterator(self, prefix_len=None):
+ if prefix_len is None:
+ prefix_len=self.MAX_PREFIX_SIZE
+ assert (prefix_len >= self.prefix_len and prefix_len<=self.MAX_PREFIX_SIZE)
+ step = 2**(self.MAX_PREFIX_SIZE - prefix_len)
+ for ip in range(self.first_prefix_address(), self.last_prefix_address()+1, step):
+ yield type(self)(ip, prefix_len)
+
+class Inet4Prefix(Prefix):
+
+ MAX_PREFIX_SIZE = 32
+
+ @classmethod
+ def aton(cls, address):
+ ret = 0
+ components = address.split('.')
+ for comp in components:
+ ret = (ret << 8) + int(comp)
+ return ret
+
+ @classmethod
+ def ntoa(cls, address):
+ components = []
+ for _ in range(0,4):
+ components.insert(0,'{}'.format(address % 256))
+ address = address >> 8
+ return '.'.join(components)
+
+class Inet6Prefix(Prefix):
+
+ MAX_PREFIX_SIZE = 128
+
+ @classmethod
+ def aton (cls, address):
+ prefix, suffix = unpack(">QQ", inet_pton(AF_INET6, address))
+ return (prefix << 64) | suffix
+
+ @classmethod
+ def ntoa (cls, address):
+ return inet_ntop(AF_INET6, pack(">QQ", address >> 64, address & ((1 << 64) -1)))
+
+ #skip_internet_address: skip a:b::0, as v6 often use default /64 prefixes
+ def get_iterator(self, prefix_len=None, skip_internet_address=None):
+ if skip_internet_address is None:
+ #We skip the internet address if we iterate over Addresses
+ if prefix_len is None:
+ skip_internet_address = True
+ #But not if we iterate over prefixes
+ else:
+ skip_internet_address = False
+ it = super().get_iterator(prefix_len)
+ if skip_internet_address:
+ next(it)
+ return it
+
+class InetAddress(Prefix):
+
+ def get_tuple(self):
+ return (self.ip_address, self.prefix_len)
+
+ def __str__(self):
+ return self.ntoa(self.ip_address)
+
+class Inet4Address(InetAddress, Inet4Prefix):
+ pass
+
+class Inet6Address(InetAddress, Inet6Prefix):
+ pass
+
class Self(BaseType):
"""Self-reference
"""
class Type:
- BASE_TYPES = (String, Integer, Double, Bool)
+ BASE_TYPES = (String, Integer, Double, Bool)
_registry = dict()
@staticmethod
diff --git a/netmodel/model/uuid.py b/netmodel/model/uuid.py
new file mode 100644
index 00000000..dae51d75
--- /dev/null
+++ b/netmodel/model/uuid.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import random
+import string
+
+# Separator for components of the UUID
+UUID_SEP = '-'
+
+# Length of the random component of the UUID
+UUID_LEN = 5
+
+class UUID:
+ def __init__(self, name, cls):
+ self._uuid = self._make_uuid(name, cls)
+
+ def _make_uuid(self, name, cls):
+ """Generate a unique resource identifier
+
+ The UUID consists in the type of the resource, to which is added a
+ random identifier of length UUID_LEN. Components of the UUID are
+ separated by UUID_SEP.
+ """
+ uuid = ''.join(random.choice(string.ascii_uppercase + string.digits)
+ for _ in range(UUID_LEN))
+ if name:
+ uuid = name # + UUID_SEP + uuid
+ return UUID_SEP.join([cls.__name__, uuid])
+
+ def __repr__(self):
+ return '<UUID {}>'.format(self._uuid)
+
+ def __lt__(self, other):
+ return self._uuid < other._uuid
+
+ __str__ = __repr__
diff --git a/netmodel/network/fib.py b/netmodel/network/fib.py
index e6b81607..11b90b22 100644
--- a/netmodel/network/fib.py
+++ b/netmodel/network/fib.py
@@ -39,7 +39,10 @@ class FIB:
self._entries = dict()
def add(self, prefix, next_hops = None):
- self._entries[prefix] = FIBEntry(prefix, next_hops)
+ if prefix not in self._entries:
+ self._entries[prefix] = FIBEntry(prefix, next_hops)
+ else:
+ self._entries[prefix].update(next_hops)
def update(self, prefix, next_hops = None):
entry = self._entries.get(prefix)
@@ -54,10 +57,11 @@ class FIB:
raise Exception('prefix not found')
entry.remove(next_hops)
return
-
+
del self._entries[prefix]
def get(self, object_name):
for entry in self._entries.values():
if entry._prefix.object_name == object_name:
- return next(iter(entry._next_hops))
+ return entry._next_hops
+ return None
diff --git a/netmodel/network/flow_table.py b/netmodel/network/flow_table.py
index 99e42e99..2da40d1c 100644
--- a/netmodel/network/flow_table.py
+++ b/netmodel/network/flow_table.py
@@ -16,7 +16,10 @@
# limitations under the License.
#
-from netmodel.model.query import ACTION_SUBSCRIBE, ACTION_UNSUBSCRIBE
+import copy
+from collections import defaultdict, Counter
+
+from netmodel.model.query import Query, ACTION_SUBSCRIBE, ACTION_UNSUBSCRIBE
# Per-interface flow table
class SubFlowTable:
@@ -25,21 +28,33 @@ class SubFlowTable:
self._interface = interface
# Flow -> ingress interface
- self._flows = dict()
-
- # Ingress interface -> list of subscription
- self._subscriptions = dict()
+ self._flows = defaultdict(set)
def add(self, packet, ingress_interface):
flow = packet.get_flow()
- self._flows[flow] = ingress_interface
+ self._flows[flow].add(ingress_interface)
def match(self, packet):
flow = packet.get_flow()
return self._flows.get(flow.get_reverse())
+ def _on_interface_delete(self, interface):
+ """
+ Returns:
+ False is the flow table is empty.
+ """
+ to_remove = set()
+ for flow, ingress_interfaces in self._flows.items():
+ ingress_interfaces.discard(interface)
+ if not ingress_interfaces:
+ to_remove.add(flow)
+ for flow in to_remove:
+ del self._flows[flow]
+
+ return len(self._flows) > 0
+
class Subscription:
- def __init__(self, packet, ingress_list, egress_list):
+ def __init__(self, packet, ingress_set, egress_set):
"""
Args:
packet : subscription packet
@@ -47,8 +62,22 @@ class Subscription:
egress_list (List[Interface]) : list of egress interface
"""
self._packet = packet
- self._ingress_list = ingress_list
- self._egress_list = egress_list
+ #self._ingress_set = ingress_set
+ #self._egress_set = egress_set
+
+ def get_tuple(self):
+ return (self._packet,)
+
+ def __eq__(self, other):
+ return self.get_tuple() == other.get_tuple()
+
+ def __hash__(self):
+ return hash(self.get_tuple())
+
+ def __repr__(self):
+ return '<Subscription {}>'.format(self._packet.to_query())
+
+ __str__ = __repr__
class FlowTable:
"""
@@ -76,12 +105,30 @@ class FlowTable:
# The Flow Table also maintains a list of subscriptions doubly indexed
# by both subscriptors, and egress interfaces
- # ingress_interface -> list of subscriptions
- self._ingress_subscriptions = dict()
-
- # egress_interface -> list of subscriptions
- self._egress_subscriptions = dict()
-
+ # ingress_interface -> bag of subscriptions
+ self._ingress_subscriptions = defaultdict(Counter)
+
+ # egress_interface -> bag of subscriptions
+ self._egress_subscriptions = defaultdict(Counter)
+
+ def dump(self, msg=''):
+ print("="*80)
+ print("FLOW TABLE {}".format(msg))
+ print("-" * 80)
+ print("SubFlowTables")
+ for interface, flow_table in self._sub_flow_tables.items():
+ for k, v in flow_table._flows.items():
+ print(interface, "\t", k, "\t", v)
+ print("-" * 80)
+ print("Ingress subscriptions")
+ for interface, subscriptions in self._ingress_subscriptions.items():
+ print(interface, "\t", subscriptions)
+ print("-" * 80)
+ print("Egress subscriptions")
+ for interface, subscriptions in self._egress_subscriptions.items():
+ print(interface, "\t", subscriptions)
+ print("=" * 80)
+ print("")
def match(self, packet, interface):
"""
@@ -95,34 +142,30 @@ class FlowTable:
if not sub_flow_table:
return None
return sub_flow_table.match(packet)
-
- def add(self, packet, ingress_interface, interface):
- sub_flow_table = self._sub_flow_tables.get(interface)
- if not sub_flow_table:
- sub_flow_table = SubFlowTable(interface)
- self._sub_flow_tables[interface] = sub_flow_table
- sub_flow_table.add(packet, ingress_interface)
+
+ def add(self, packet, ingress_interface, interfaces):
+ for interface in interfaces:
+ sub_flow_table = self._sub_flow_tables.get(interface)
+ if not sub_flow_table:
+ sub_flow_table = SubFlowTable(interface)
+ self._sub_flow_tables[interface] = sub_flow_table
+ sub_flow_table.add(packet, ingress_interface)
# If the flow is a subscription, we need to associate it to the list
query = packet.to_query()
if query.action == ACTION_SUBSCRIBE:
# XXX we currently don't merge subscriptions, and assume a single
# next hop interface
- s = Subscription(packet, [ingress_interface], [interface])
+ s = Subscription(packet, set([ingress_interface]), interfaces)
if ingress_interface:
- if not ingress_interface in self._ingress_subscriptions:
- self._ingress_subscriptions[ingress_interface] = list()
- self._ingress_subscriptions[ingress_interface].append(s)
-
- if not interface in self._egress_subscriptions:
- self._egress_subscriptions[interface] = list()
- self._egress_subscriptions[interface].append(s)
+ self._ingress_subscriptions[ingress_interface] += Counter([s])
+ for interface in interfaces:
+ self._egress_subscriptions[interface] += Counter([s])
elif query.action == ACTION_UNSUBSCRIBE:
raise NotImplementedError
-
# Events
def _on_interface_up(self, interface):
@@ -141,9 +184,47 @@ class FlowTable:
"""
Callback: an interface has been deleted
- Cancel all subscriptions that have been issues from
+ Cancel all subscriptions that have been issues from
netmodel.network.interface.
Remove all pointers to subscriptions pending on this interface
"""
+
if interface in self._ingress_subscriptions:
+ # If the interface we delete at the origin of the subscription,
+ # let's also remove corresponding egress subscriptions
+ subs = self._ingress_subscriptions[interface]
+ if not subs:
+ return
+
+ to_remove = set()
+ for _interface, subscriptions in self._egress_subscriptions.items():
+
+ removed = subs & subscriptions
+ if removed:
+ for s in removed:
+ # We found a subscription of this interface on an other
+ # interface; send unsubscribe...
+ action, params = s._packet.payload
+ p = copy.deepcopy(s._packet)
+ p.payload = (ACTION_UNSUBSCRIBE, params)
+ _interface.send(p)
+ # ... and remove them
+ subscriptions -= removed
+
+ # if the interface has no more subscription remove it.
+ if not subscriptions:
+ to_remove.add(_interface)
+
+ for i in to_remove:
+ del self._egress_subscriptions[i]
+
del self._ingress_subscriptions[interface]
+
+ # Remove interface from flow table destination
+ to_remove = set()
+ for _interface, sub_flow_table in self._sub_flow_tables.items():
+ remove = sub_flow_table._on_interface_delete(interface)
+ if not remove:
+ to_remove.add(_interface)
+ for _interface in to_remove:
+ del self._sub_flow_tables[_interface]
diff --git a/netmodel/network/interface.py b/netmodel/network/interface.py
index c9e31422..3bad4c41 100644
--- a/netmodel/network/interface.py
+++ b/netmodel/network/interface.py
@@ -44,7 +44,7 @@ class InterfaceState(enum.Enum):
def register_interfaces():
Interface._factory = dict()
- for loader, module_name, is_pkg in pkgutil.walk_packages(interfaces.__path__,
+ for loader, module_name, is_pkg in pkgutil.walk_packages(interfaces.__path__,
interfaces.__name__ + '.'):
# Note: we cannot skip files using is_pkg otherwise it will ignore
# interfaces defined outside of __init__.py
@@ -95,12 +95,12 @@ class Interface:
self._tx_buffer = list()
self._state = InterfaceState.Down
- self._error = None
+ self._error = None
self._reconnecting = True
self._reconnection_delay = RECONNECTION_DELAY
self._registered_objects = dict()
-
+
# Callbacks
self._up_callbacks = list()
self._down_callbacks = list()
@@ -119,7 +119,7 @@ class Interface:
def __hash__(self):
return hash(self._name)
- #---------------------------------------------------------------------------
+ #---------------------------------------------------------------------------
def register_object(self, obj):
self._registered_objects[obj.__type__] = obj
@@ -127,9 +127,9 @@ class Interface:
def get_prefixes(self):
return [ Prefix(v.__type__) for v in self._registered_objects.values() ]
- #---------------------------------------------------------------------------
+ #---------------------------------------------------------------------------
# State management, callbacks
- #---------------------------------------------------------------------------
+ #---------------------------------------------------------------------------
def set_state(self, state):
asyncio.ensure_future(self._set_state(state))
@@ -170,7 +170,7 @@ class Interface:
for cb, args, kwargs in self._delete_callbacks:
cb(interface, *args, **kwargs)
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def set_reconnecting(self, reconnecting):
self._reconnecting = reconnecting
@@ -253,13 +253,13 @@ class Interface:
def receive_impl(self, packet):
ingress_interface = self
cb = self._callback
- if cb is None:
- return
if self._hook:
new_packet = self._hook(packet)
- if new_packet is not None:
+ if cb is not None and new_packet is not None:
cb(new_packet, ingress_interface=ingress_interface)
return
+ if cb is None:
+ return
cb(packet, ingress_interface=ingress_interface)
#--------------------------------------------------------------------------
diff --git a/netmodel/network/packet.py b/netmodel/network/packet.py
index 9552b0e7..7edcccc4 100644
--- a/netmodel/network/packet.py
+++ b/netmodel/network/packet.py
@@ -109,7 +109,7 @@ class VICNTLV:
@staticmethod
def get_type(buf):
- (typelen, ) = struct.unpack(NETMODEL_TLV_TYPELEN_STR,
+ (typelen, ) = struct.unpack(NETMODEL_TLV_TYPELEN_STR,
buf[:NETMODEL_TLV_SIZE])
return (typelen & NETMODEL_TLV_TYPE_MASK) >> NETMODEL_TLV_TYPE_SHIFT
@@ -179,7 +179,7 @@ class VICNTLV:
class ObjectName(VICNTLV): pass
@VICNTLV.set_tlv_type(NETMODEL_TLV_FIELD)
-class Field(VICNTLV):
+class Field(VICNTLV):
"""Field == STR
"""
@@ -217,7 +217,7 @@ class Prefix(Object, Prefix_, VICNTLV):
def __hash__(self):
return hash(self.get_tuple())
-
+
@VICNTLV.set_tlv_type(NETMODEL_TLV_SRC)
class Source(Prefix):
"""Source address
@@ -251,12 +251,12 @@ class Packet(Object, VICNTLV):
source = Source()
destination = Destination(Prefix)
protocol = Protocol(String, default = 'query')
- flags = Flags()
- payload = Payload()
+ flags = Flags(String)
+ payload = Payload(String)
# This should be dispatched across L3 L4 L7
- def __init__(self, source = None, destination = None, protocol = None,
+ def __init__(self, source = None, destination = None, protocol = None,
flags = 0, payload = None):
self.source = source
self.destination = destination
@@ -272,8 +272,8 @@ class Packet(Object, VICNTLV):
packet = Packet()
if src_query:
address = Prefix(
- object_name = src_query.object_name,
- filter = src_query.filter,
+ object_name = src_query.object_name,
+ filter = src_query.filter,
field_names = src_query.field_names,
aggregate = src_query.aggregate)
if reply:
@@ -283,8 +283,8 @@ class Packet(Object, VICNTLV):
if query:
address = Prefix(
- object_name = query.object_name,
- filter = query.filter,
+ object_name = query.object_name,
+ filter = query.filter,
field_names = query.field_names,
aggregate = query.aggregate)
@@ -310,7 +310,7 @@ class Packet(Object, VICNTLV):
field_names = address.field_names
aggregate = address.aggregate
- return Query(action, object_name, filter, params, field_names,
+ return Query(action, object_name, filter, params, field_names,
aggregate = aggregate, last = self.last, reply = self.reply)
@property
@@ -335,6 +335,16 @@ class Packet(Object, VICNTLV):
else:
self.flags &= ~FLAG_REPLY
+ def get_tuple(self):
+ return (self.source, self.destination, self.protocol, self.flags,
+ self.payload)
+
+ def __eq__(self, other):
+ return self.get_tuple() == other.get_tuple()
+
+ def __hash__(self):
+ return hash(self.get_tuple())
+
class ErrorPacket(Packet):
"""
Analog with ICMP errors packets in IP networks
@@ -344,7 +354,7 @@ class ErrorPacket(Packet):
# Constructor
#--------------------------------------------------------------------------
- def __init__(self, type = ERROR, code = ERROR, message = None,
+ def __init__(self, type = ERROR, code = ERROR, message = None,
traceback = None, **kwargs):
assert not traceback or isinstance(traceback, str)
diff --git a/netmodel/network/prefix.py b/netmodel/network/prefix.py
index 00b5db71..d444a56d 100644
--- a/netmodel/network/prefix.py
+++ b/netmodel/network/prefix.py
@@ -17,20 +17,23 @@
#
class Prefix:
- def __init__(self, object_name = None, filter = None, field_names = None,
+ def __init__(self, object_name = None, filter = None, field_names = None,
aggregate = None):
self.object_name = object_name
self.filter = filter
self.field_names = field_names
self.aggregate = aggregate
- def __hash__(self):
- return hash(self.get_tuple())
-
def get_tuple(self):
- return (self.object_name, self.filter, self.field_names,
+ return (self.object_name, self.filter, self.field_names,
self.aggregate)
+ def __eq__(self, other):
+ return self.get_tuple() == other.get_tuple()
+
+ def __hash__(self):
+ return hash(self.get_tuple())
+
def __repr__(self):
return '<Prefix {}>'.format(self.get_tuple())
diff --git a/netmodel/network/router.py b/netmodel/network/router.py
index 84d69dca..871cefe0 100644
--- a/netmodel/network/router.py
+++ b/netmodel/network/router.py
@@ -68,7 +68,7 @@ class Router:
#--------------------------------------------------------------------------
def register_local_collection(self, cls):
- self.get_interface(LOCAL_NAMESPACE).register_collection(cls,
+ self.get_interface(LOCAL_NAMESPACE).register_collection(cls,
LOCAL_NAMESPACE)
def register_collection(self, cls, namespace=None):
@@ -97,7 +97,7 @@ class Router:
interface.set_state(InterfaceState.PendingUp)
for prefix in interface.get_prefixes():
- self._fib.add(prefix, [interface])
+ self._fib.add(prefix, set([interface]))
return interface
@@ -112,8 +112,8 @@ class Router:
def on_interface_up(self, interface):
"""
- This callback is triggered when an interface becomes up.
-
+ This callback is triggered when an interface becomes up.
+
The router will request metadata.
The flow table is notified.
"""
@@ -139,7 +139,7 @@ class Router:
# Public API
#---------------------------------------------------------------------------
- def add_interface(self, interface_type, name=None, namespace=None,
+ def add_interface(self, interface_type, name=None, namespace=None,
**platform_config):
"""
namespace is used to force appending of a namespace to the tables.
@@ -161,7 +161,7 @@ class Router:
interface = interface_cls(self, **platform_config)
except Exception as e:
traceback.print_exc()
- raise Exception("Cannot create interface %s of type %s with parameters %r: %s"
+ raise Exception("Cannot create interface %s of type %s with parameters %r: %s"
% (name, interface_type,
platform_config, e))
self._register_interface(interface, name)
@@ -231,9 +231,10 @@ class Router:
interface flow table
- using the FIB if no match is found
"""
- orig_interface = self._flow_table.match(packet, ingress_interface)
- if orig_interface:
- orig_interface.send(packet)
+ orig_interfaces = self._flow_table.match(packet, ingress_interface)
+ if orig_interfaces:
+ for orig_interface in orig_interfaces:
+ orig_interface.send(packet)
return
if isinstance(packet, str):
@@ -247,11 +248,17 @@ class Router:
return
# Get route from FIB
- interface = self._fib.get(packet.destination.object_name)
- if not interface:
+ if packet.destination is None:
+ log.warning("Ignored reply packet with no match in flow table {}".format(
+ packet.to_query()))
+ return
+ interfaces = self._fib.get(packet.destination.object_name)
+ if not interfaces:
+ log.error('No match in FIB for {}'.format(
+ packet.destination.object_name))
return
# Update flow table before sending
- self._flow_table.add(packet, ingress_interface, interface)
-
- interface.send(packet)
+ self._flow_table.add(packet, ingress_interface, interfaces)
+ for interface in interfaces:
+ interface.send(packet)
diff --git a/netmodel/util/daemon.py b/netmodel/util/daemon.py
index 29683a54..eb8cd1a2 100644
--- a/netmodel/util/daemon.py
+++ b/netmodel/util/daemon.py
@@ -231,7 +231,7 @@ class Daemon:
"""
Overload this method if you use twisted (see xmlrpc.py)
"""
- sys.exit(0)
+ os._exit(0)
# Overload these...
diff --git a/netmon/bin/netmon.py b/netmon/bin/netmon.py
index 46e6327e..0f96d2b9 100755
--- a/netmon/bin/netmon.py
+++ b/netmon/bin/netmon.py
@@ -24,7 +24,8 @@ import sys
PATH=os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)
sys.path.insert(0, os.path.abspath(PATH))
-import netmodel.network.interfaces
+import netmodel.interfaces
+from netmodel.network.interface import register_interfaces
from netmodel.network.router import Router
from netmodel.model.query import Query, ACTION_SELECT, ACTION_SUBSCRIBE
from netmodel.util.daemon import Daemon
@@ -44,6 +45,7 @@ class RouterDaemon(Daemon):
self._router.add_interface('websocketserver')
self._router.add_interface('bwm')
+ self._router.add_interface('vppctl')
self._router.add_interface('local', router = self._router)
diff --git a/requirements.txt b/requirements.txt
index 77b44ead..db0e0699 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,4 +4,5 @@ ws4py==0.3.4
pyparsing
lockfile
-autobahn
+#autobahn
+websockets
diff --git a/scripts/vppctl_wrapper b/scripts/vppctl_wrapper
new file mode 100644
index 00000000..940e5784
--- /dev/null
+++ b/scripts/vppctl_wrapper
@@ -0,0 +1,4 @@
+#!/bin/bash
+TIMEOUT=5
+
+flock /tmp/vppctl.lock -c "timeout $TIMEOUT vppctl $*"
diff --git a/setup.py b/setup.py
index 170833c6..4ebd21c4 100755
--- a/setup.py
+++ b/setup.py
@@ -36,8 +36,16 @@ with open('README.md') as f:
# XXX TODO
required_modules = list()
+data_files = list()
+
+data_files.extend([
+ ("/lib/systemd/system/", ["etc/netmon.service"]),
+ ("/etc/init/", ["etc/netmon.conf"]),
+])
+
+
setup(
- name = 'vICN',
+ name = 'vicn',
version = version,
description = 'vICN experiment controller',
long_description = long_description,
@@ -61,6 +69,7 @@ setup(
keywords = 'Experiment Controller; Orchestrator; ICN; LXC; Containers',
platforms = "Linux, OSX",
packages = find_packages(),
+ data_files = data_files,
install_requires = required_modules,
@@ -73,3 +82,43 @@ setup(
],
},
)
+
+setup(
+ name = 'netmon',
+ version = version,
+ description = 'Netmon',
+ long_description = long_description,
+ license = 'Apache 2.0',
+
+ download_url = 'https://gerrit.fd.io/r/cicn',
+ url = 'https://wiki.fd.io/view/Vicn',
+
+ # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=[
+ 'Development Status :: 3 - Alpha',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: Science/Research',
+ 'Topic :: Software Development :: Build Tools',
+ 'Operating System :: POSIX :: Linux',
+ 'Operating System :: MacOS :: MacOS X',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ ],
+ keywords = 'Experiment Controller; Orchestrator; ICN; LXC; Containers',
+ platforms = "Linux, OSX",
+ packages = find_packages(),
+ data_files = data_files,
+
+ install_requires = required_modules,
+
+ # To provide executable scripts, use entry points in preference to the
+ # "scripts" keyword. Entry points provide cross-platform support and allow
+ # pip to create the appropriate form of executable for the target platform.
+ entry_points = {
+ 'console_scripts': [
+ 'netmon = netmon.bin.netmon:main',
+ ],
+ },
+)
+
diff --git a/vicn/core/api.py b/vicn/core/api.py
index 708e2581..ccbb9b24 100644
--- a/vicn/core/api.py
+++ b/vicn/core/api.py
@@ -19,6 +19,7 @@
import asyncio
import json
import logging
+import os
import resource as ulimit
import sys
@@ -51,6 +52,7 @@ class API(metaclass = Singleton):
def terminate(self):
# XXX not valid if nothing has been initialized
ResourceManager().terminate()
+ os._exit(0)
def parse_topology_file(self, topology_fn, resources, settings):
log.info("Parsing topology file %(topology_fn)s" % locals())
@@ -87,7 +89,7 @@ class API(metaclass = Singleton):
if nofile is not None and nofile > 0:
if nofile < 1024:
log.error('Too few allowed open files for the process')
- import os; os._exit(1)
+ os._exit(1)
log.info('Setting open file descriptor limit to {}'.format(
nofile))
@@ -95,15 +97,18 @@ class API(metaclass = Singleton):
ulimit.RLIMIT_NOFILE,
(nofile, nofile))
- ResourceManager(base=scenario[-1], settings=settings)
+ base = os.path.dirname(scenario_list[-1])
+ base = os.path.abspath(base)
+ ResourceManager(base = base, settings = settings)
for resource in resources:
try:
ResourceManager().create_from_dict(**resource)
except Exception as e:
+ import traceback; traceback.print_exc()
log.error("Could not create resource '%r': %r" % \
(resource, e,))
- import os; os._exit(1)
+ os._exit(1)
self._configured = True
diff --git a/vicn/core/attribute.py b/vicn/core/attribute.py
index 3afe0d6e..02520cbd 100644
--- a/vicn/core/attribute.py
+++ b/vicn/core/attribute.py
@@ -22,109 +22,34 @@ import logging
import operator
import types
-from netmodel.model.mapper import ObjectSpecification
-from netmodel.model.type import Type, Self
-from netmodel.util.meta import inheritors
-from netmodel.util.misc import is_iterable
-from vicn.core.exception import VICNListException
-from vicn.core.requirement import Requirement, RequirementList
-from vicn.core.sa_collections import InstrumentedList
-from vicn.core.state import UUID, NEVER_SET, Operations
+from netmodel.model.attribute import Attribute as BaseAttribute, NEVER_SET
+from netmodel.model.attribute import Multiplicity, DEFAULT
+from netmodel.model.type import Self
+from netmodel.model.uuid import UUID
+from netmodel.util.misc import is_iterable
+from vicn.core.requirement import Requirement, RequirementList
+from vicn.core.state import Operations
log = logging.getLogger(__name__)
#------------------------------------------------------------------------------
-# Attribute Multiplicity
-#------------------------------------------------------------------------------
-
-class Multiplicity:
- OneToOne = '1_1'
- OneToMany = '1_N'
- ManyToOne = 'N_1'
- ManyToMany = 'N_N'
-
- @staticmethod
- def reverse(value):
- reverse_map = {
- Multiplicity.OneToOne: Multiplicity.OneToOne,
- Multiplicity.OneToMany: Multiplicity.ManyToOne,
- Multiplicity.ManyToOne: Multiplicity.OneToMany,
- Multiplicity.ManyToMany: Multiplicity.ManyToMany,
- }
- return reverse_map[value]
-
-
-# Default attribute properties values (default to None)
-DEFAULT = {
- 'multiplicity' : Multiplicity.OneToOne,
- 'mandatory' : False,
-}
-
-#------------------------------------------------------------------------------
# Attribute
#------------------------------------------------------------------------------
-class Attribute(abc.ABC, ObjectSpecification):
- properties = [
- 'name',
- 'type',
- 'key',
- 'description',
- 'default',
- 'choices',
- 'mandatory',
- 'multiplicity',
- 'ro',
- 'auto',
- 'func',
+class Attribute(BaseAttribute):
+ properties = BaseAttribute.properties
+ properties.extend([
'requirements',
- 'reverse_name',
- 'reverse_description',
- 'reverse_auto'
- ]
+ 'remote_default'
+ ])
def __init__(self, *args, **kwargs):
- for key in Attribute.properties:
- value = kwargs.pop(key, NEVER_SET)
- setattr(self, key, value)
-
- if len(args) == 1:
- self.type, = args
- elif len(args) == 2:
- self.name, self.type = args
-
- # self.type is optional since the type can be inherited. Although we
- # will have to verify the attribute is complete at some point
- if self.type:
- if isinstance(self.type, str):
- self.type = Type.from_string(self.type)
- assert self.type is Self or Type.exists(self.type)
+ super().__init__(*args, **kwargs)
# Post processing attribute properties
if self.requirements is not NEVER_SET:
self.requirements = RequirementList(self.requirements)
- self.is_aggregate = False
-
- self._reverse_attributes = list()
-
- #--------------------------------------------------------------------------
- # Display
- #--------------------------------------------------------------------------
-
- def __repr__(self):
- return '<Attribute {}>'.format(self.name)
-
- __str__ = __repr__
-
- # The following functions are required to allow comparing attributes, and
- # using them as dict keys
-
- def __eq__(self, other):
- return self.name == other.name
-
- def __hash__(self):
- return hash(self.name)
#--------------------------------------------------------------------------
# Descriptor protocol
@@ -132,6 +57,8 @@ class Attribute(abc.ABC, ObjectSpecification):
# see. https://docs.python.org/3/howto/descriptor.html
#--------------------------------------------------------------------------
+ # XXX Overloaded & simpler
+
def __get__(self, instance, owner=None):
if not instance:
return self
@@ -144,9 +71,6 @@ class Attribute(abc.ABC, ObjectSpecification):
instance.set(self.name, value, blocking=False)
- def __delete__(self, instance):
- raise NotImplementedError
-
#--------------------------------------------------------------------------
def do_list_add(self, instance, value):
@@ -170,7 +94,7 @@ class Attribute(abc.ABC, ObjectSpecification):
value, cur_value)
# prevent instrumented list to perform operation
- raise VICNListException
+ raise InstrumentedListException
def do_list_remove(self, instance, value):
if instance.is_local_attribute(self.name):
@@ -187,7 +111,7 @@ class Attribute(abc.ABC, ObjectSpecification):
value, cur_value)
# prevent instrumented list to perform operation
- raise VICNListException
+ raise InstrumentedListException
def do_list_clear(self, instance):
if instance.is_local_attribute(self.name):
@@ -201,7 +125,7 @@ class Attribute(abc.ABC, ObjectSpecification):
value, cur_value)
# prevent instrumented list to perform operation
- raise VICNListException
+ raise InstrumentedListException
def handle_getitem(self, instance, item):
if isinstance(item, UUID):
@@ -210,29 +134,6 @@ class Attribute(abc.ABC, ObjectSpecification):
return item
#--------------------------------------------------------------------------
- # Accessors
- #--------------------------------------------------------------------------
-
- def __getattribute__(self, name):
- value = super().__getattribute__(name)
- if value is NEVER_SET:
- if name == 'default':
- return list() if self.is_collection else None
- return DEFAULT.get(name, None)
- return value
-
- def has_reverse_attribute(self):
- return self.reverse_name and self.multiplicity
-
- @property
- def is_collection(self):
- return self.multiplicity in (Multiplicity.OneToMany,
- Multiplicity.ManyToMany)
-
- def is_set(self, instance):
- return instance.is_set(self.name)
-
- #--------------------------------------------------------------------------
# Operations
#--------------------------------------------------------------------------
@@ -256,6 +157,7 @@ class Attribute(abc.ABC, ObjectSpecification):
#------------------------------------------------------------------------------
+# XXX Move this to object, be careful of access to self._reference !
class Reference:
"""
Value reference.
diff --git a/vicn/core/collection.py b/vicn/core/collection.py
deleted file mode 100644
index fb222891..00000000
--- a/vicn/core/collection.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# Copyright (c) 2017 Cisco and/or its affiliates.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-from vicn.core.sa_collections import InstrumentedList
-from netmodel.model.collection import Collection
-
-class Collection(InstrumentedList, Collection):
- pass
diff --git a/vicn/core/commands.py b/vicn/core/commands.py
index 41c06bf5..c04ab264 100644
--- a/vicn/core/commands.py
+++ b/vicn/core/commands.py
@@ -65,7 +65,7 @@ class ReturnValue:
def _clean(self, value):
if value is None or isinstance(value, str):
return value
- return value.decode('utf-8')
+ return value.decode('utf-8').strip()
def _set_stdout(self, value):
self._stdout = self._clean(value)
diff --git a/vicn/core/exception.py b/vicn/core/exception.py
index 977fc8ad..4389531f 100644
--- a/vicn/core/exception.py
+++ b/vicn/core/exception.py
@@ -34,8 +34,6 @@ class InitializeException(VICNException): pass
class CheckException(VICNException): pass
class SetupException(VICNException): pass
-class VICNListException(VICNException): pass
-
class ResourceNotFound(VICNException): pass
class VICNWouldBlock(VICNException):
diff --git a/vicn/core/resource.py b/vicn/core/resource.py
index f92e1255..878a8108 100644
--- a/vicn/core/resource.py
+++ b/vicn/core/resource.py
@@ -32,14 +32,17 @@ from threading import Event as ThreadEvent
# LXD workaround
from pylxd.exceptions import NotFound as LXDAPIException
+from netmodel.model.collection import Collection
+from netmodel.model.key import Key
from netmodel.model.mapper import ObjectSpecification
+from netmodel.model.object import Object
from netmodel.model.type import String, Bool, Integer, Dict
from netmodel.model.type import BaseType, Self
+from netmodel.model.uuid import UUID
from netmodel.util.deprecated import deprecated
from netmodel.util.singleton import Singleton
from vicn.core.attribute import Attribute, Multiplicity, Reference
from vicn.core.attribute import NEVER_SET
-from vicn.core.collection import Collection
from vicn.core.commands import ReturnValue
from vicn.core.event import Event, AttributeChangedEvent
from vicn.core.exception import VICNException, ResourceNotFound
@@ -47,7 +50,7 @@ from vicn.core.exception import VICNWouldBlock
from vicn.core.resource_factory import ResourceFactory
from vicn.core.requirement import Requirement, Property
from vicn.core.scheduling_algebra import SchedulingAlgebra
-from vicn.core.state import ResourceState, UUID
+from vicn.core.state import ResourceState
from vicn.core.state import Operations, InstanceState
from vicn.core.task import run_task, BashTask
@@ -73,29 +76,29 @@ class TopLevelResource: pass
class FactoryResource(TopLevelResource): pass
class CategoryResource(TopLevelResource): pass
-#------------------------------------------------------------------------------
-
-class ResourceMetaclass(ABCMeta):
- def __init__(cls, class_name, parents, attrs):
- """
- Args:
- cls: The class type we're registering.
- class_name: A String containing the class_name.
- parents: The parent class types of 'cls'.
- attrs: The attribute (members) of 'cls'.
- """
- super().__init__(class_name, parents, attrs)
-
- # We use the metaclass to create attributes for instance, even before
- # the Resource Factory is called. They are needed both for initializing
- # attributes and reverse attributes, in whatever order. Only class
- # creation allow us to clear _attributes, otherwise, we will just add
- # those from the parent, siblings, etc...
- cls._sanitize()
+##------------------------------------------------------------------------------
+#
+#class ResourceMetaclass(ABCMeta, ObjectSpecification):
+# def __init__(cls, class_name, parents, attrs):
+# """
+# Args:
+# cls: The class type we're registering.
+# class_name: A String containing the class_name.
+# parents: The parent class types of 'cls'.
+# attrs: The attribute (members) of 'cls'.
+# """
+# super().__init__(class_name, parents, attrs)
+#
+# # We use the metaclass to create attributes for instance, even before
+# # the Resource Factory is called. They are needed both for initializing
+# # attributes and reverse attributes, in whatever order. Only class
+# # creation allow us to clear _attributes, otherwise, we will just add
+# # those from the parent, siblings, etc...
+# cls._sanitize()
#------------------------------------------------------------------------------
-class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
+class BaseResource(Object): #, ABC, metaclass=ResourceMetaclass):
"""Base Resource class
The base Resource class implements all the logic related to resource
@@ -409,6 +412,12 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
if isinstance(value, UUID):
value = self.from_uuid(value)
+ # XXX XXX quick fix
+ from netmodel.model.type import InetAddress
+ if issubclass(attribute.type, InetAddress) and value is not None \
+ and not isinstance(value, InetAddress) and not isinstance(value, Reference):
+ value = attribute.type(value)
+
if set_reverse and attribute.reverse_name:
for base in self.__class__.mro():
if not hasattr(base, '_reverse_attributes'):
@@ -420,7 +429,7 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
value.set(ra.name, self, set_reverse = False)
elif ra.multiplicity == Multiplicity.ManyToOne:
for element in value:
- value.set(ra.name, self, set_reverse = False)
+ element.set(ra.name, self, set_reverse = False)
elif ra.multiplicity == Multiplicity.OneToMany:
if value is not None:
collection = value.get(ra.name)
@@ -445,7 +454,7 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
return value
def set(self, attribute_name, value, current=False, set_reverse=True,
- blocking = True):
+ blocking = None):
value = self._set(attribute_name, value, current=current,
set_reverse=set_reverse)
if self.is_local_attribute(attribute_name) or current:
@@ -455,11 +464,10 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
vars(self)[attribute_name] = value
else:
- fut = self._state.manager.attribute_set(self, attribute_name, value)
- asyncio.ensure_future(fut)
+ self._state.manager.attribute_set(self, attribute_name, value)
async def async_set(self, attribute_name, value, current=False,
- set_reverse=True, blocking=True):
+ set_reverse=True, blocking=None):
"""
Example:
- setting the ip address on a node's interface
@@ -470,8 +478,7 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
"""
value = self._set(attribute_name, value, current=current,
set_reverse=set_reverse)
- await self._state.manager.attribute_set(self, attribute_name, value,
- blocking=blocking)
+ await self._state.manager.attribute_set_async(self, attribute_name, value)
def set_many(self, attribute_dict, current=False):
if not attribute_dict:
@@ -541,101 +548,101 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
except AttributeError:
return None
- @classmethod
- def _sanitize(cls):
- """
- This methods performs sanitization of the object declaration.
-
- More specifically:
- - it goes over all attributes and sets their name based on the python
- object attribute name.
- - it establishes mutual object relationships through reverse attributes.
-
- """
- cls._reverse_attributes = dict()
- cur_reverse_attributes = dict()
- for name, obj in vars(cls).items():
- if not isinstance(obj, ObjectSpecification):
- continue
-
- # XXX it seems obj should always be an attribute, confirm !
- if isinstance(obj, Attribute):
- obj.name = name
-
- # Remember whether a reverse_name is defined before loading
- # inherited properties from parent
- has_reverse = bool(obj.reverse_name)
-
- # Handle overloaded attributes
- # By recursion, it is sufficient to look into the parent
- for base in cls.__bases__:
- if hasattr(base, name):
- parent_attribute = getattr(base, name)
- obj.merge(parent_attribute)
- assert obj.type
-
- # Handle reverse attribute
- #
- # NOTE: we need to do this after merging to be sure we get all
- # properties inherited from parent (eg. multiplicity)
- #
- # See "Reverse attributes" section in BaseResource docstring.
- #
- # Continueing with the same example, let's detail how it is handled:
- #
- # Original declaration:
- # >>>
- # class Group(Resource):
- # resources = Attribute(Resource, description = 'Resources belonging to the group',
- # multiplicity = Multiplicity.ManyToMany,
- # default = [],
- # reverse_name = 'groups',
- # reverse_description = 'Groups to which the resource belongs')
- # <<<
- #
- # Local variables:
- # cls = <class 'vicn.resource.group.Group'>
- # obj = <Attribute resources>
- # obj.type = <class 'vicn.core.Resource'>
- # reverse_attribute = <Attribute groups>
- #
- # Result:
- # 1) Group._reverse_attributes =
- # { <Attribute resources> : [<Attribute groups>, ...], ...}
- # 2) Add attribute <Attribute groups> to class Resource
- # 3) Resource._reverse_attributes =
- # { <Attribute groups> : [<Attribute resources], ...], ...}
- #
- if has_reverse:
- a = {
- 'name' : obj.reverse_name,
- 'description' : obj.reverse_description,
- 'multiplicity' : Multiplicity.reverse(obj.multiplicity),
- 'reverse_name' : obj.name,
- 'reverse_description' : obj.description,
- 'auto' : obj.reverse_auto,
- }
- reverse_attribute = Attribute(cls, **a)
- reverse_attribute.is_aggregate = True
-
- # 1) Store the reverse attributes to be later inserted in the
- # remote class, at the end of the function
- # TODO : clarify the reasons to perform this in two steps
- cur_reverse_attributes[obj.type] = reverse_attribute
-
- # 2)
- if not obj in cls._reverse_attributes:
- cls._reverse_attributes[obj] = list()
- cls._reverse_attributes[obj].append(reverse_attribute)
-
- # 3)
- if not reverse_attribute in obj.type._reverse_attributes:
- obj.type._reverse_attributes[reverse_attribute] = list()
- obj.type._reverse_attributes[reverse_attribute].append(obj)
-
- # Insert newly created reverse attributes in the remote class
- for kls, a in cur_reverse_attributes.items():
- setattr(kls, a.name, a)
+####### @classmethod
+####### def _sanitize(cls):
+####### """
+####### This methods performs sanitization of the object declaration.
+#######
+####### More specifically:
+####### - it goes over all attributes and sets their name based on the python
+####### object attribute name.
+####### - it establishes mutual object relationships through reverse attributes.
+#######
+####### """
+####### cls._reverse_attributes = dict()
+####### cur_reverse_attributes = dict()
+####### for name, obj in vars(cls).items():
+####### if not isinstance(obj, ObjectSpecification):
+####### continue
+#######
+####### # XXX it seems obj should always be an attribute, confirm !
+####### if isinstance(obj, Attribute):
+####### obj.name = name
+#######
+####### # Remember whether a reverse_name is defined before loading
+####### # inherited properties from parent
+####### has_reverse = bool(obj.reverse_name)
+#######
+####### # Handle overloaded attributes
+####### # By recursion, it is sufficient to look into the parent
+####### for base in cls.__bases__:
+####### if hasattr(base, name):
+####### parent_attribute = getattr(base, name)
+####### obj.merge(parent_attribute)
+####### assert obj.type
+#######
+####### # Handle reverse attribute
+####### #
+####### # NOTE: we need to do this after merging to be sure we get all
+####### # properties inherited from parent (eg. multiplicity)
+####### #
+####### # See "Reverse attributes" section in BaseResource docstring.
+####### #
+####### # Continueing with the same example, let's detail how it is handled:
+####### #
+####### # Original declaration:
+####### # >>>
+####### # class Group(Resource):
+####### # resources = Attribute(Resource, description = 'Resources belonging to the group',
+####### # multiplicity = Multiplicity.ManyToMany,
+####### # default = [],
+####### # reverse_name = 'groups',
+####### # reverse_description = 'Groups to which the resource belongs')
+####### # <<<
+####### #
+####### # Local variables:
+####### # cls = <class 'vicn.resource.group.Group'>
+####### # obj = <Attribute resources>
+####### # obj.type = <class 'vicn.core.Resource'>
+####### # reverse_attribute = <Attribute groups>
+####### #
+####### # Result:
+####### # 1) Group._reverse_attributes =
+####### # { <Attribute resources> : [<Attribute groups>, ...], ...}
+####### # 2) Add attribute <Attribute groups> to class Resource
+####### # 3) Resource._reverse_attributes =
+####### # { <Attribute groups> : [<Attribute resources], ...], ...}
+####### #
+####### if has_reverse:
+####### a = {
+####### 'name' : obj.reverse_name,
+####### 'description' : obj.reverse_description,
+####### 'multiplicity' : Multiplicity.reverse(obj.multiplicity),
+####### 'reverse_name' : obj.name,
+####### 'reverse_description' : obj.description,
+####### 'auto' : obj.reverse_auto,
+####### }
+####### reverse_attribute = Attribute(cls, **a)
+####### reverse_attribute.is_aggregate = True
+#######
+####### # 1) Store the reverse attributes to be later inserted in the
+####### # remote class, at the end of the function
+####### # TODO : clarify the reasons to perform this in two steps
+####### cur_reverse_attributes[obj.type] = reverse_attribute
+#######
+####### # 2)
+####### if not obj in cls._reverse_attributes:
+####### cls._reverse_attributes[obj] = list()
+####### cls._reverse_attributes[obj].append(reverse_attribute)
+#######
+####### # 3)
+####### if not reverse_attribute in obj.type._reverse_attributes:
+####### obj.type._reverse_attributes[reverse_attribute] = list()
+####### obj.type._reverse_attributes[reverse_attribute].append(obj)
+#######
+####### # Insert newly created reverse attributes in the remote class
+####### for kls, a in cur_reverse_attributes.items():
+####### setattr(kls, a.name, a)
@classmethod
def iter_attributes(cls, aggregates = False):
@@ -648,13 +655,54 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
yield attribute
- def iter_keys(self):
- for attribute in self.iter_attributes():
- if attribute.key == True:
- yield attribute
+ @classmethod
+ def iter_keys(cls):
+ for name in dir(cls):
+ key = getattr(cls, name)
+ if not isinstance(key, Key):
+ continue
+ yield key
+
+ def get_attributes(self, aggregates = False):
+ return list(self.iter_attributes(aggregates = aggregates))
+
+ @classmethod
+ def has_attribute(cls, name):
+ return name in [a.name for a in cls.attributes()]
+
+ def get_attribute_names(self, aggregates = False):
+ return set(a.name
+ for a in self.iter_attributes(aggregates = aggregates))
+
+ def get_attribute_dict(self, field_names = None, aggregates = False,
+ uuid = True):
+ assert not field_names or field_names.is_star()
+ attributes = self.get_attributes(aggregates = aggregates)
+
+ ret = dict()
+ for a in attributes:
+ if not a.is_set(self):
+ continue
+ value = getattr(self, a.name)
+ if a.is_collection:
+ ret[a.name] = list()
+ for x in value:
+ if uuid and isinstance(x, Resource):
+ x = x._state.uuid._uuid
+ ret[a.name].append(x)
+ else:
+ if uuid and isinstance(value, Resource):
+ value = value._state.uuid._uuid
+ ret[a.name] = value
+ return ret
+
+ @classmethod
+ def get_keys(cls):
+ return list(cls.iter_keys())
- def get_keys(self):
- return list(self.iter_keys())
+ @classmethod
+ def has_key_attribute(cls, attribute):
+ return any(attribute in key for key in cls.iter_keys())
def auto_instanciate(self, attribute):
if self.managed is False:
@@ -694,35 +742,6 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
self._state.manager.commit_resource(resource)
return resource
- def get_attributes(self, aggregates = False):
- return list(self.iter_attributes(aggregates = aggregates))
-
- def get_attribute_names(self, aggregates = False):
- return set(a.name
- for a in self.iter_attributes(aggregates = aggregates))
-
- def get_attribute_dict(self, field_names = None, aggregates = False,
- uuid = True):
- assert not field_names or field_names.is_star()
- attributes = self.get_attributes(aggregates = aggregates)
-
- ret = dict()
- for a in attributes:
- if not a.is_set(self):
- continue
- value = getattr(self, a.name)
- if a.is_collection:
- ret[a.name] = list()
- for x in value:
- if uuid and isinstance(x, Resource):
- x = x._state.uuid._uuid
- ret[a.name].append(x)
- else:
- if uuid and isinstance(value, Resource):
- value = value._state.uuid._uuid
- ret[a.name] = value
- return ret
-
def get_tuple(self):
return (self.__class__, self._get_attribute_dict())
@@ -877,10 +896,6 @@ class BaseResource(BaseType, ABC, metaclass=ResourceMetaclass):
# Accessors
#---------------------------------------------------------------------------
- @classmethod
- def has_attribute(cls, name):
- return name in [a.name for a in cls.attributes()]
-
def has_callback(self, action, attribute):
return hasattr(self, '_{}_{}'.format(action, attribute.name))
diff --git a/vicn/core/resource_mgr.py b/vicn/core/resource_mgr.py
index 84deb7b4..8db7f04d 100644
--- a/vicn/core/resource_mgr.py
+++ b/vicn/core/resource_mgr.py
@@ -22,6 +22,7 @@ import time
# LXD workaround
from pylxd.exceptions import NotFound as LxdNotFound, LXDAPIException
+from netmodel.model.collection import Collection
from netmodel.model.filter import Filter
from netmodel.model.query import Query, ACTION_SELECT, ACTION_INSERT
from netmodel.model.query import ACTION_UPDATE, ACTION_SUBSCRIBE
@@ -33,10 +34,10 @@ from netmodel.util.meta import inheritors
from netmodel.util.singleton import Singleton
from netmodel.util.misc import is_iterable
from vicn.core.attribute import NEVER_SET
+from vicn.core.commands import ReturnValue
from vicn.core.exception import VICNException, ResourceNotFound
from vicn.core.resource_factory import ResourceFactory
from vicn.core.resource import Resource, FactoryResource, EmptyResource
-from vicn.core.sa_collections import InstrumentedList
from vicn.core.state import InstanceState, ResourceState
from vicn.core.state import AttributeState, Operations, PendingValue
from vicn.core.task import TaskManager, wait_task, task, async_task
@@ -46,12 +47,14 @@ log = logging.getLogger(__name__)
# NOTE: Do not fully reinitialize a resource after a step fails since it will
# call initialize several times, and might created spurious resources.
-ENABLE_LXD_WORKAROUND = True
+ENABLE_LXD_WORKAROUND = False
+DEFAULT_QTPLAYER_PORT = 8999
# Monitoring queries
Q_SUB_VPP = 'SUBSCRIBE SUM(*) FROM interface WHERE device_name INCLUDED [{}]'
Q_SUB_IF = 'SUBSCRIBE * FROM interface WHERE device_name == "{}"'
+Q_SUB_VPP_IF = 'SUBSCRIBE * FROM vpp_interface WHERE device_name == "{}"'
Q_SUB_STATS = 'SUBSCRIBE * FROM stats'
Q_SUB_EMULATOR_IF = 'SUBSCRIBE * FROM interface WHERE id == "{}"'
Q_SUB_EMULATOR = 'SUBSCRIBE * FROM interface WHERE device_name == "{}"'
@@ -146,6 +149,8 @@ class ResourceManager(metaclass=Singleton):
# Monitoring
self._monitored = set()
self._pending_monitoring = set()
+ self._map_ip_interface = dict()
+ self._monitored_channels = set()
# For debug
self._committed = set()
@@ -200,6 +205,13 @@ class ResourceManager(metaclass=Singleton):
def _broadcast_packet(self, packet):
self._broadcast(packet.to_query())
+ def _on_qtplayer_packet(self, name, packet):
+ query = packet.to_query()
+ query.params['name'] = name
+ query.reply = True
+ self._ws.execute(query)
+ return None
+
def _on_ns_record(self, packet):
query = packet.to_query()
@@ -240,6 +252,35 @@ class ResourceManager(metaclass=Singleton):
return None
return None
return None
+ elif query.object_name == 'vpp_interface':
+ device_names = [value for key, op, value in query.filter.to_list()
+ if key == 'device_name']
+ if not device_names:
+ log.error('No device name in packet=', packet)
+ return
+ device_name = device_names[0]
+ node_name = query.params['node']
+ node = ResourceManager().by_name(node_name)
+ if node is None:
+ print("no node")
+ return None
+ for interface in node.interfaces:
+ if not hasattr(interface, 'vppinterface') or not interface.vppinterface:
+ continue
+ if interface.vppinterface.device_name == device_name:
+ if interface.channel:
+ f = Filter.from_list([['id', '==',
+ interface.channel._state.uuid._uuid]])
+ q = Query(ACTION_UPDATE, 'channel', filter = f,
+ params = query.params)
+ q.reply = True
+ self._ws.execute(q)
+ return None
+ print("no channel")
+ return None
+ print("no vpp interface found")
+ return None
+
return None
def _on_netmon_channel_record(self, packet):
@@ -546,14 +587,8 @@ class ResourceManager(metaclass=Singleton):
await self.wait_attr_init(resource, attribute)
return resource.get(attribute)
- async def attribute_set(self, resource, attribute_name, value,
- blocking=True):
+ async def _attribute_set(self, resource, attribute_name, value):
with await resource._state.write_lock:
- # Add the current operation to the pending list
- # NOTE: collections are unordered and can be updated concurrently
- #self._attribute_set_pending_value(resource, attribute_name)
- resource._state.dirty[attribute_name].trigger(Operations.SET,
- value)
attr_state = resource._state.attr_state[attribute_name]
if attr_state == AttributeState.CLEAN:
@@ -597,8 +632,26 @@ class ResourceManager(metaclass=Singleton):
raise RuntimeError("Resource cannot be in state".format(
resource_state))
- if blocking:
- await self.wait_attr_clean(resource, attribute_name)
+# if blocking:
+# await self.wait_attr_clean(resource, attribute_name)
+
+ def attribute_set(self, resource, attribute_name, value):
+ # Add the current operation to the pending list
+ # NOTE: collections are unordered and can be updated concurrently
+ #self._attribute_set_pending_value(resource, attribute_name)
+ resource._state.dirty[attribute_name].trigger(Operations.SET,
+ value)
+ asyncio.ensure_future(self._attribute_set(resource, attribute_name, value))
+
+ async def attribute_set_async(self, resource, attribute_name, value):
+ # Add the current operation to the pending list
+ # NOTE: collections are unordered and can be updated concurrently
+ #self._attribute_set_pending_value(resource, attribute_name)
+ resource._state.dirty[attribute_name].trigger(Operations.SET,
+ value)
+ await self._attribute_set(resource, attribute_name, value)
+
+
#---------------------------------------------------------------------------
# Resource dependency management
@@ -623,7 +676,7 @@ class ResourceManager(metaclass=Singleton):
deps = [deps]
for dep in deps:
- if attr.key:
+ if resource.has_key_attribute(attr):
if not dep.managed:
continue
dep_pfx = '{}:{}'.format(dep.get_type(), dep.get_uuid())
@@ -687,13 +740,7 @@ class ResourceManager(metaclass=Singleton):
async def _resource_wait_subresources(self, resource):
self.log(resource, S_WAIT_SRS)
- # We should accumulate subresources through the hierarchy
- sr = EmptyResource()
- for base in reversed(resource.__class__.mro()):
- if '__subresources__' not in vars(base):
- continue
- sr = sr > base.__subresources__(resource)
-
+ sr = resource.__subresources__()
if sr is not None and not isinstance(sr, EmptyResource):
resource.set_subresources(sr)
pfx_sr = '{}:{}'.format(sr.get_type(), sr.get_uuid())
@@ -713,19 +760,8 @@ class ResourceManager(metaclass=Singleton):
"""Perform action: __get__, __create__, __delete__ on the full class
hierarchy.
"""
- task = EmptyTask()
- for base in reversed(resource.__class__.mro()):
- # To avoid adding several times the same task
- if action not in vars(base):
- continue
- func = getattr(base, action, None)
- if func is None:
- continue
- t = func(resource)
-
- task = task > t
-
- return task
+ method = getattr(resource, action, None)
+ return method() if method else EmptyTask()
#--------------------------------------------------------------------------
# Resource model
@@ -788,7 +824,11 @@ class ResourceManager(metaclass=Singleton):
ret = fut.result()
resource._state.attr_change_success[attribute.name] = True
resource._state.attr_change_value[attribute.name] = ret
+ except ResourceNotFound as e:
+ resource._state.attr_change_success[attribute.name] = False
+ resource._state.attr_change_value[attribute.name] = e
except Exception as e:
+ import traceback; traceback.print_exc()
resource._state.attr_change_success[attribute.name] = False
resource._state.attr_change_value[attribute.name] = e
resource._state.attr_change_event[attribute.name].set()
@@ -899,7 +939,10 @@ class ResourceManager(metaclass=Singleton):
attrs = resource._state.attr_change_value[attribute.name]
self.attr_log(resource, attribute,
'INIT success. Value = {}'.format(attrs))
- found = self._process_attr_dict(resource, attribute, attrs)
+ if not isinstance(attrs, ReturnValue):
+ found = self._process_attr_dict(resource, attribute, attrs)
+ else:
+ found = self._process_attr_dict(resource, attribute, attrs.stdout)
if not found:
log.error('Attribute missing return attrs: {}'.format(
attrs))
@@ -923,7 +966,7 @@ class ResourceManager(metaclass=Singleton):
if resource._state.attr_change_success[attribute.name] == True:
self.attr_log(resource, attribute,
'UPDATE success. Value = {}. Attribute is CLEAN'.format(attrs))
- if attrs != NEVER_SET:
+ if not isinstance(attrs, ReturnValue) and attrs != NEVER_SET:
# None could be interpreted as the return value. Also,
# we need not to overwrite the value from get
self._process_attr_dict(resource, attribute, attrs)
@@ -931,7 +974,7 @@ class ResourceManager(metaclass=Singleton):
# We might do this for all returned attributes
cur_value = vars(resource)[attribute.name]
if attribute.is_collection:
- tmp = InstrumentedList(pending_value.value)
+ tmp = Collection(pending_value.value)
tmp._attribute = cur_value._attribute
tmp._instance = cur_value._instance
else:
@@ -974,8 +1017,25 @@ class ResourceManager(metaclass=Singleton):
return Query.from_dict(dic)
+ def _monitor_qtplayer(self, resource):
+ try:
+ ip = resource.node.hostname
+ except:
+ ip = str(resource.node.management_interface.ip4_address)
+
+ hook = functools.partial(self._on_qtplayer_packet, resource.node.name)
+ ws = self._router.add_interface('websocketclient', address=ip,
+ port = DEFAULT_QTPLAYER_PORT,
+ hook = hook)
+ q_str = 'SUBSCRIBE * FROM stats'
+ q = self.parse_query(q_str)
+ packet = Packet.from_query(q)
+ self._router._flow_table.add(packet, None, set([ws]))
+ ws.send(packet)
+
def _monitor_netmon(self, resource):
- ip = resource.node.management_interface.ip4_address
+ print("MONITOR NODE", resource.node)
+ ip = str(resource.node.management_interface.ip4_address)
if not ip:
log.error('IP of monitored Node {} is None'.format(resource.node))
import os; os._exit(1)
@@ -986,49 +1046,146 @@ class ResourceManager(metaclass=Singleton):
node = resource.node
for interface in node.interfaces:
if not interface.monitored:
+ print("non monitored interface", interface)
continue
+ print("NETMON MONITOR INTERFACE", interface)
+
+# if interface.get_type() == 'dpdkdevice' and hasattr(node,'vpp'):
+#
+# # Check if vICN has already subscribed for one interface in
+# # the channel
+# if hasattr(interface.channel,'already_subscribed'):
+# continue
+#
+# channel_id = interface.channel._state.uuid._uuid
+#
+# update_vpp = functools.partial(self._on_vpp_record,
+# pylink_id = channel_id)
+# ws_vpp = self._router.add_interface('websocketclient',
+# address=ip, hook=update_vpp)
+#
+# aggregate_interfaces = list()
+# for _interface in node.interfaces:
+# if not _interface.get_type() == 'dpdkdevice' and \
+# _interface.monitored:
+# aggregate_interfaces.append('"' +
+# _interface.device_name + '"')
+#
+# q_str = Q_SUB_VPP.format(','.join(aggregate_interfaces))
+# q = self.parse_query(q_str)
+# packet = Packet.from_query(q)
+# self._router._flow_table.add(packet, None, ws_vpp)
+# ws_vpp.send(packet)
+#
+# # Prevent vICN to subscribe to other interfaces of the same
+# # channel
+# interface.channel.already_subscribed = True
+#
+# else:
+ if hasattr(node, 'vpp') and node.vpp is not None:
+ q_str = Q_SUB_VPP_IF.format(interface.vppinterface.device_name)
+ else:
+ q_str = Q_SUB_IF.format(interface.device_name)
+ log.warning(" -- MONITOR {}".format(q_str))
+ q = self.parse_query(q_str)
+ packet = Packet.from_query(q)
+ self._router._flow_table.add(packet, None, set([ws]))
+ ws.send(packet)
- if interface.get_type() == 'dpdkdevice' and hasattr(node,'vpp'):
+ def _monitor_vpp_interface(self, vpp_interface):
+ print("MONITOR interface", vpp_interface)
+ interface = vpp_interface.parent
+ node = interface.node
+ # XXX only monitor in the topology group
+ if node.get_type() != 'lxccontainer':
+ print("MONITOR -> Ignored: not in container")
+ return
- # Check if vICN has already subscribed for one interface in
- # the channel
- if hasattr(interface.channel,'already_subscribed'):
- continue
+ # We only monitor interfaces to provide data for wired channels
+ channel = interface.channel
+ if channel is None:
+ print("MONITOR -> Ignored: no channel")
+ return
+ if channel.has_type('emulatedchannel'):
+ print("MONITOR -> Ignored: belong to wireless channel")
+ return
- channel_id = interface.channel._state.uuid._uuid
+ # Don't monitor multiple interfaces per channel
+ if channel in self._monitored_channels:
+ print("MONITOR -> Ignored: channel already monitored")
+ return
+ self._monitored_channels.add(channel)
- update_vpp = functools.partial(self._on_vpp_record,
- pylink_id = channel_id)
- ws_vpp = self._router.add_interface('websocketclient',
- address=ip, hook=update_vpp)
+ ip = str(node.management_interface.ip4_address)
+ if not ip:
+ log.error('IP of monitored Node {} is None'.format(resource.node))
+ import os; os._exit(1)
- aggregate_interfaces = list()
- for _interface in node.interfaces:
- if not _interface.get_type() == 'dpdkdevice' and \
- _interface.monitored:
- aggregate_interfaces.append('"' +
- _interface.device_name + '"')
+ # Reuse existing websockets
+ ws = self._map_ip_interface.get(ip)
+ if not ws:
+ ws = self._router.add_interface('websocketclient', address=ip,
+ hook=self._on_netmon_record)
+ self._map_ip_interface[ip] = ws
+
+ q_str = Q_SUB_VPP_IF.format(vpp_interface.device_name)
+ print("MONITOR -> query= {}".format(q_str))
+ q = self.parse_query(q_str)
+ packet = Packet.from_query(q)
+ self._router._flow_table.add(packet, None, set([ws]))
+ ws.send(packet)
+
+ def _monitor_interface(self, interface):
+ print("MONITOR interface", interface)
+ node = interface.node
+ # XXX only monitor in the topology group
+ if node.get_type() != 'lxccontainer':
+ print("MONITOR -> Ignored: not in container")
+ return
- q_str = Q_SUB_VPP.format(','.join(aggregate_interfaces))
- q = self.parse_query(q_str)
- packet = Packet.from_query(q)
- self._router._flow_table.add(packet, None, ws_vpp)
- ws_vpp.send(packet)
+ # Only monitor vpp interfaces on vpp node
+ if hasattr(node, 'vpp') and node.vpp is not None:
+ print("MONITOR -> Ignored: non-vpp interface on vpp node")
+ return
- # Prevent vICN to subscribe to other interfaces of the same
- # channel
- interface.channel.already_subscribed = True
+ # We only monitor interfaces to provide data for wired channels
+ channel = interface.channel
+ if channel is None:
+ print("MONITOR -> Ignored: no channel")
+ return
+ if channel.has_type('emulatedchannel'):
+ print("MONITOR -> Ignored: belong to wireless channel")
+ return
- else:
- q_str = Q_SUB_IF.format(interface.device_name)
- q = self.parse_query(q_str)
- packet = Packet.from_query(q)
- self._router._flow_table.add(packet, None, ws)
- ws.send(packet)
+ # Don't monitor multiple interfaces per channel
+ if channel in self._monitored_channels:
+ print("MONITOR -> Ignored: channel already monitored")
+ return
+ self._monitored_channels.add(channel)
+
+ ip = str(node.management_interface.ip4_address)
+ if not ip:
+ log.error('IP of monitored Node {} is None'.format(resource.node))
+ import os; os._exit(1)
+
+ # Reuse existing websockets
+ ws = self._map_ip_interface.get(ip)
+ if not ws:
+ ws = self._router.add_interface('websocketclient', address=ip,
+ hook=self._on_netmon_record)
+ self._map_ip_interface[ip] = ws
+
+ q_str = Q_SUB_IF.format(interface.device_name)
+ print("MONITOR -> query= {}".format(q_str))
+ q = self.parse_query(q_str)
+ packet = Packet.from_query(q)
+ self._router._flow_table.add(packet, None, set([ws]))
+ ws.send(packet)
def _monitor_emulator(self, resource):
ns = resource
- ip = ns.node.bridge.ip4_address # management_interface.ip_address
+ # XXX UGLY, we have no management interface
+ ip = ns.node.hostname # str(ns.node.interfaces[0].ip4_address)
ws_ns = self._router.add_interface('websocketclient', address = ip,
port = ns.control_port,
@@ -1050,7 +1207,7 @@ class ResourceManager(metaclass=Singleton):
q_str = Q_SUB_EMULATOR_IF.format(identifier)
q = self.parse_query(q_str)
packet = Packet.from_query(q)
- self._router._flow_table.add(packet, None, ws_ns)
+ self._router._flow_table.add(packet, None, set([ws_ns]))
ws_ns.send(packet)
# We also need to subscribe on the node for the tap interfaces
@@ -1059,7 +1216,7 @@ class ResourceManager(metaclass=Singleton):
q_str = Q_SUB_EMULATOR.format(tap.device_name)
q = self.parse_query(q_str)
packet = Packet.from_query(q)
- self._router._flow_table.add(packet, None, ws)
+ self._router._flow_table.add(packet, None, set([ws]))
ws.send(packet)
def _monitor(self, resource):
@@ -1070,29 +1227,37 @@ class ResourceManager(metaclass=Singleton):
self._pending_monitoring.clear()
return
- central_ip = self.by_type_str('centralip')
- if not central_ip:
- raise NotImplementedError('Missing CentralIP in experiment')
- central_ip = central_ip[0]
-
uuid = resource.get_uuid()
- if central_ip._state.state != ResourceState.CLEAN:
- self._pending_monitoring.add(uuid)
- return
+ central_ip = self.by_type_str('centralip')
+ if central_ip:
+ central_ip = central_ip[0]
+
+ if central_ip._state.state != ResourceState.CLEAN:
+ self._pending_monitoring.add(uuid)
+ return
if uuid in self._monitored:
return
self._monitored.add(uuid)
- if resource.get_type() == 'netmon':
- if resource.node.get_type() != 'lxccontainer':
- return
- self._monitor_netmon(resource)
+# if resource.get_type() == 'netmon':
+# if resource.node.get_type() != 'lxccontainer':
+# return
+# self._monitor_netmon(resource)
+
+ if resource.get_type() == 'qtplayer':
+ self._monitor_qtplayer(resource)
elif resource.has_type('emulatedchannel'):
self._monitor_emulator(resource)
+ elif resource.has_type('interface'):
+ self._monitor_interface(resource)
+
+ elif resource.has_type('vppinterface'):
+ self._monitor_vpp_interface(resource)
+
async def __set_resource_state(self, resource, state):
"""Sets the resource state (no-lock version)
@@ -1128,6 +1293,9 @@ class ResourceManager(metaclass=Singleton):
ret = fut.result()
resource._state.change_success = True
resource._state.change_value = ret
+ except ResourceNotFound as e:
+ resource._state.change_success = False
+ resource._state.change_value = e
except Exception as e:
resource._state.change_success = False
resource._state.change_value = e
@@ -1148,7 +1316,7 @@ class ResourceManager(metaclass=Singleton):
for attr in resource.iter_attributes():
if resource.is_local_attribute(attr.name):
continue
- if attr.key:
+ if resource.has_key_attribute(attr):
# Those attributes are already done
continue
@@ -1182,12 +1350,14 @@ class ResourceManager(metaclass=Singleton):
# Monitor all FSM one by one and inform about errors.
futs = list()
attrs = list()
- for attr in resource.get_keys():
- if resource.is_local_attribute(attr.name):
- continue
- attrs.append(attr)
- fut = self.attribute_process(resource, attr)
- futs.append(fut)
+
+ for key in resource.get_keys():
+ for attr in key:
+ if resource.is_local_attribute(attr.name):
+ continue
+ attrs.append(attr)
+ fut = self.attribute_process(resource, attr)
+ futs.append(fut)
if not futs:
self.log(resource, 'No key attribute to update')
@@ -1277,6 +1447,7 @@ class ResourceManager(metaclass=Singleton):
print("------")
import traceback; traceback.print_tb(e.__traceback__)
log.error('Resource: {} - Exception: {}'.format(pfx, e))
+ return
import os; os._exit(1)
elif state == ResourceState.UNINITIALIZED:
pending_state = ResourceState.PENDING_DEPS
@@ -1398,8 +1569,9 @@ class ResourceManager(metaclass=Singleton):
elif pending_state == ResourceState.PENDING_GET:
if resource._state.change_success == True:
attrs = resource._state.change_value
- self.log(resource, S_INIT_DONE.format(attrs))
- self._process_attr_dict(resource, None, attrs)
+ if not isinstance(attrs, ReturnValue):
+ self.log(resource, S_INIT_DONE.format(attrs))
+ self._process_attr_dict(resource, None, attrs)
new_state = ResourceState.CREATED
else:
e = resource._state.change_value
@@ -1452,8 +1624,9 @@ class ResourceManager(metaclass=Singleton):
elif pending_state == ResourceState.PENDING_CREATE:
if resource._state.change_success == True:
attrs = resource._state.change_value
- self.log(resource, S_CREATE_OK.format(attrs))
- self._process_attr_dict(resource, None, attrs)
+ if not isinstance(attrs, ReturnValue):
+ self.log(resource, S_CREATE_OK.format(attrs))
+ self._process_attr_dict(resource, None, attrs)
new_state = ResourceState.CREATED
else:
e = resource._state.change_value
diff --git a/vicn/core/state.py b/vicn/core/state.py
index a116ba82..aa68341e 100644
--- a/vicn/core/state.py
+++ b/vicn/core/state.py
@@ -17,17 +17,9 @@
#
import asyncio
-import random
-import string
-class NEVER_SET:
- pass
-
-# Separator for components of the UUID
-UUID_SEP = '-'
-
-# Length of the random component of the UUID
-UUID_LEN = 5
+from netmodel.model.uuid import UUID
+from vicn.core.attribute import NEVER_SET
class ResourceState:
UNINITIALIZED = 'UNINITIALIZED'
@@ -64,31 +56,6 @@ class Operations:
LIST_REMOVE = 'remove'
LIST_CLEAR = 'clear'
-class UUID:
- def __init__(self, name, cls):
- self._uuid = self._make_uuid(name, cls)
-
- def _make_uuid(self, name, cls):
- """Generate a unique resource identifier
-
- The UUID consists in the type of the resource, to which is added a
- random identifier of length UUID_LEN. Components of the UUID are
- separated by UUID_SEP.
- """
- uuid = ''.join(random.choice(string.ascii_uppercase + string.digits)
- for _ in range(UUID_LEN))
- if name:
- uuid = name # + UUID_SEP + uuid
- return UUID_SEP.join([cls.__name__, uuid])
-
- def __repr__(self):
- return '<UUID {}>'.format(self._uuid)
-
- def __lt__(self, other):
- return self._uuid < other._uuid
-
- __str__ = __repr__
-
class PendingValue:
def __init__(self, value = None):
self.clear(value)
diff --git a/vicn/core/task.py b/vicn/core/task.py
index 49c34b1f..72c80716 100644
--- a/vicn/core/task.py
+++ b/vicn/core/task.py
@@ -24,11 +24,12 @@ import shlex
import subprocess
import os
-from vicn.core.scheduling_algebra import SchedulingAlgebra
+from netmodel.util.process import execute_local
+
from vicn.core.commands import ReturnValue
-from vicn.core.exception import ResourceNotFound
from vicn.core.commands import Command, SequentialCommands
-from netmodel.util.process import execute_local
+from vicn.core.exception import ResourceNotFound
+from vicn.core.scheduling_algebra import SchedulingAlgebra
log = logging.getLogger(__name__)
@@ -150,6 +151,86 @@ async def wait_concurrent_tasks(tasks):
wait_task_task = async_task(wait_task)
+#------------------------------------------------------------------------------
+# Task inheritance
+#------------------------------------------------------------------------------
+
+# NOTES:
+# - delete is a special case where we have to reverse operations
+# - subresources is also a special case, since it deals with resources, but it
+# works the same since the algebra is similar
+
+def inherit_parent(fn):
+ def f(self, *args, **kwargs):
+ # Break loops
+ if fn.__name__ not in vars(self.__class__):
+ return fn(self, *args, **kwargs)
+
+ parent_tasks = EmptyTask()
+ for parent in self.__class__.__bases__:
+ if not fn.__name__ in vars(parent):
+ continue
+ for cls in self.__class__.__mro__:
+ if cls.__dict__.get(fn.__name__) is fn:
+ break
+
+ parent_task = getattr(super(cls, self), fn.__name__, None)
+ if not parent_task:
+ continue
+ parent_tasks = parent_tasks | parent_task(self)
+ if fn.__name__ == 'delete':
+ return fn(*args, **kwargs) > parent_tasks
+ else:
+ return parent_tasks > fn(self, *args, **kwargs)
+ return f
+
+def override_parent(fn):
+ def f(self, *args, **kwargs):
+ # Break loops
+ if fn.__name__ not in vars(self.__class__):
+ return fn(self, *args, **kwargs)
+
+ bases = set([ancestor for parent in self.__class__.__bases__
+ for ancestor in parent.__bases__])
+
+ ancestor_tasks = EmptyTask()
+ for base in bases:
+ if not fn.__name__ in vars(base):
+ continue
+ ancestor_task = getattr(base, fn.__name__, None)
+ if not ancestor_task:
+ continue
+ ancestor_tasks = ancestor_tasks | ancestor_task(self)
+ if fn.__name__ == 'delete':
+ return fn(*args, **kwargs) > ancestor_tasks
+ else:
+ return ancestor_tasks > fn(self, *args, **kwargs)
+ return f
+
+def inherit(*classes):
+ def decorator(fn):
+ def f(self, *args, **kwargs):
+ # Break loops
+ if fn.__name__ not in vars(self.__class__):
+ return fn(self, *args, **kwargs)
+
+ parent_tasks = EmptyTask()
+ for parent in classes:
+ if not fn.__name__ in vars(parent):
+ continue
+ parent_task = getattr(parent, fn.__name__, None)
+ if not parent_task:
+ continue
+ parent_tasks = parent_tasks | parent_task(self)
+ if fn.__name__ == 'delete':
+ return fn(*args, **kwargs) > parent_tasks
+ else:
+ return parent_tasks > fn(self, *args, **kwargs)
+ return f
+ return decorator
+
+#------------------------------------------------------------------------------
+
def get_attribute_task(resource, attribute_name):
@async_task
async def func():
@@ -308,7 +389,10 @@ class BashTask(Task):
def get_full_cmd(self):
c = SequentialCommands()
desc = None
- for line in self._cmd.splitlines():
+ cmd = self._cmd
+ if callable(cmd):
+ cmd = cmd()
+ for line in cmd.splitlines():
line = line.strip()
if not line:
continue
@@ -341,10 +425,10 @@ class BashTask(Task):
# executed, so that any object passed as parameters is deferenced right
# on time.
cmd = self.get_full_cmd()
- partial = functools.partial(func, cmd, output = bool(self._parse))
+ partial = functools.partial(func, cmd, output = self._output or bool(self._parse))
node_str = self._node.name if self._node else '(LOCAL)'
- cmd_str = cmd[:77] + '...' if len(cmd) > 80 else cmd
+ cmd_str = cmd#[:77] + '...' if len(cmd) > 80 else cmd
log.info('Execute: {} - {}'.format(node_str, cmd_str))
if self._lock:
diff --git a/vicn/resource/application.py b/vicn/resource/application.py
index 0f245496..b5502f39 100644
--- a/vicn/resource/application.py
+++ b/vicn/resource/application.py
@@ -16,9 +16,10 @@
# limitations under the License.
#
-from vicn.core.attribute import Attribute, Multiplicity
-from vicn.core.resource import Resource
-from vicn.resource.node import Node
+from netmodel.model.key import Key
+from vicn.core.attribute import Attribute, Multiplicity
+from vicn.core.resource import Resource
+from vicn.resource.node import Node
class Application(Resource):
node = Attribute(Node,
@@ -26,5 +27,5 @@ class Application(Resource):
mandatory = True,
multiplicity = Multiplicity.ManyToOne,
reverse_name = 'applications',
- key = True,
reverse_description = 'Applications installed on node')
+ __key__ = Key(node)
diff --git a/vicn/resource/central.py b/vicn/resource/central.py
index bf1c8f7a..d1ef267a 100644
--- a/vicn/resource/central.py
+++ b/vicn/resource/central.py
@@ -20,43 +20,12 @@ import logging
import networkx as nx
import os
-from netmodel.model.type import String, Integer
from netmodel.util.misc import pairwise
from vicn.core.attribute import Attribute, Reference
-from vicn.core.exception import ResourceNotFound
-from vicn.core.resource import Resource
-from vicn.core.task import async_task, inline_task
-from vicn.core.task import EmptyTask, BashTask
from vicn.resource.channel import Channel
-from vicn.resource.ip.route import IPRoute
-from vicn.resource.group import Group
-from vicn.resource.icn.forwarder import Forwarder
-from vicn.resource.icn.face import L2Face, L4Face, FaceProtocol
-from vicn.resource.icn.producer import Producer
-from vicn.resource.icn.route import Route as ICNRoute
-from vicn.resource.lxd.lxc_container import LxcContainer
-from vicn.resource.node import Node
-from vicn.resource.ip_assignment import Ipv4Assignment, Ipv6Assignment
log = logging.getLogger(__name__)
-TMP_DEFAULT_PORT = 6363
-
-CMD_CONTAINER_SET_DNS = 'echo "nameserver {ip_dns}" | ' \
- 'resolvconf -a {interface_name}'
-
-# For host
-CMD_NAT = '\n'.join([
- 'iptables -t nat -A POSTROUTING -o {interface_name} -s {network} ' \
- '! -d {network} -j MASQUERADE',
- 'echo 1 > /proc/sys/net/ipv4/ip_forward'
-])
-
-# For containers
-CMD_IP_FORWARD = 'echo 1 > /proc/sys/net/ipv4/ip_forward'
-
-HOST_FILE = "hosts.vicn"
-
#------------------------------------------------------------------------------
# Routing strategies
#------------------------------------------------------------------------------
@@ -84,6 +53,8 @@ def routing_strategy_spt(G, origins, weight_key = None):
origin_nodes = origins.keys()
seen = set()
for dst_node in origin_nodes:
+ if not G.has_node(dst_node):
+ continue
sssp = nx.shortest_path(G, target = dst_node)
# Notes from the documentation:
# - If only the target is specified, return a dictionary keyed by
@@ -122,9 +93,13 @@ def routing_strategy_max_flow(G, origins, weight_key = 'capacity'):
origin_nodes = origins.keys()
for dst_node in origin_nodes:
+ if not G.has_node(dst_node):
+ continue
for src_node in G.nodes:
if src_node == dst_node:
continue
+ if not G.has_node(src_node):
+ continue
_, flow_dict = nx.maximum_flow(G, src_node, dst_node,
capacity=weight_key)
@@ -149,17 +124,24 @@ MAP_ROUTING_STRATEGY = {
# L2 and L4/ICN graphs
#------------------------------------------------------------------------------
-def _get_l2_graph(groups, with_managed = False):
+def _get_l2_graph(groups):
+ """
+ We iterate on all the channels that belong to the same groups as the
+ resources.
+
+ NOTE: We have to make sure the nodes also belong to the group.
+ """
G = nx.Graph()
-# for node in manager.by_type(Node):
-# G.add_node(node._state.uuid)
for group in groups:
for channel in group.iter_by_type_str('channel'):
if channel.has_type('emulatedchannel'):
src = channel._ap_if
+ # XXX bug in reverse collections, resources and not UUIDs seem to be stored inside
+ if group.name not in [x.name for x in src.node.groups]:
+ continue
for dst in channel._sta_ifs.values():
- if not with_managed and (not src.managed or not dst.managed):
+ if group.name not in [x.name for x in dst.node.groups]:
continue
if G.has_edge(src.node._state.uuid, dst.node._state.uuid):
continue
@@ -172,15 +154,16 @@ def _get_l2_graph(groups, with_managed = False):
# This is for a normal Channel
for src_it in range(0, len(channel.interfaces)):
src = channel.interfaces[src_it]
+ if group.name not in [x.name for x in src.node.groups]:
+ continue
# Iterate over the remaining interface to create all the
# possible combination
for dst_it in range(src_it+1,len(channel.interfaces)):
dst = channel.interfaces[dst_it]
-
- if not with_managed and (not src.managed or
- not dst.managed):
+ if group.name not in [x.name for x in dst.node.groups]:
continue
+
if G.has_edge(src.node._state.uuid, dst.node._state.uuid):
continue
map_node_interface = {
@@ -189,479 +172,3 @@ def _get_l2_graph(groups, with_managed = False):
G.add_edge(src.node._state.uuid, dst.node._state.uuid,
map_node_interface = map_node_interface)
return G
-
-def _get_icn_graph(manager, groups):
- G = nx.Graph()
- for group in groups:
- # It's safer to iterate on node which we know are in the right groups,
- # while it might not be the case for the forwarders...
- for node in group.iter_by_type_str('node'):
- G.add_node(node._state.uuid)
- for face in node.forwarder.faces:
- other_face = manager.by_uuid(face._internal_data['sibling_face'])
- other_node = other_face.node
- if G.has_edge(node._state.uuid, other_node._state.uuid):
- continue
- map_node_face = { node._state.uuid: face._state.uuid,
- other_node._state.uuid: other_face._state.uuid }
- G.add_edge(node._state.uuid, other_node._state.uuid,
- map_node_face = map_node_face)
-
- return G
-
-#-------------------------------------------------------------------------------
-
-class IPRoutes(Resource):
- """
- Resource: IPRoutes
-
- Centralized IP route computation.
- """
- routing_strategy = Attribute(String)
-
- def __after__(self):
- return ("IpAssignment",)
-
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
-
- @inline_task
- def __get__(self):
- raise ResourceNotFound
-
- @inline_task
- def __create__(self):
- routes = list()
- pre_routes, routes = self._get_ip_routes()
- routes.extend(pre_routes)
- routes.extend(routes)
- for route in routes:
- route.node.routing_table.routes << route
-
- def __delete__(self):
- raise NotImplementedError
-
- #--------------------------------------------------------------------------
- # Internal methods
- #--------------------------------------------------------------------------
-
- def _get_ip_origins(self):
- origins = dict()
- for group in self.groups:
- for channel in group.iter_by_type_str('channel'):
- for interface in channel.interfaces:
- node_uuid = interface.node._state.uuid
- if not node_uuid in origins:
- origins[node_uuid] = list()
- ip4 = interface.ip4_address
- origins[node_uuid].append(interface.ip4_address)
- if interface.ip6_address:
- ip6 = interface.ip6_address
- origins[node_uuid].append(interface.ip6_address)
- return origins
-
- def _get_ip_routes(self):
- if self.routing_strategy == 'pair':
- return [], self._get_pair_ip_routes()
-
- strategy = MAP_ROUTING_STRATEGY.get(self.routing_strategy)
-
- G = _get_l2_graph(self.groups)
- origins = self._get_ip_origins()
-
- # node -> list(origins for which we have routes)
- ip_routes = dict()
-
- pre_routes = list()
- routes = list()
- for src, prefix, dst in strategy(G, origins):
- data = G.get_edge_data(src, dst)
-
- map_ = data['map_node_interface']
- next_hop_interface = map_[src]
-
-
- next_hop_ingress = self._state.manager.by_uuid(map_[dst])
- src_node = self._state.manager.by_uuid(src)
-
- mac_addr = None
- if ((hasattr(next_hop_ingress, 'vpp') and
- next_hop_ingress.vpp is not None) or
- (hasattr(src_node, 'vpp') and src_node.vpp is not None)):
- mac_addr = next_hop_ingress.mac_address
-
- # Avoid duplicate routes due to multiple paths in the network
- if not src_node in ip_routes:
- ip_routes[src_node] = list()
- if prefix in ip_routes[src_node]:
- continue
-
- #FIXME: should test for IP format
- ip_version = 6 if ":" in prefix else 4
- next_hop_ingress_ip = (next_hop_ingress.ip6_address if ip_version is 6 else
- next_hop_ingress.ip4_address)
- if prefix == next_hop_ingress_ip:
- # Direct route on src_node.name :
- # route add [prefix] dev [next_hop_interface_.device_name]
- route = IPRoute(node = src_node,
- managed = False,
- owner = self,
- ip_address = prefix,
- mac_address = mac_addr,
- ip_version = ip_version,
- interface = next_hop_interface)
- else:
- # We need to be sure we have a route to the gw from the node
- if not next_hop_ingress_ip in ip_routes[src_node]:
- pre_route = IPRoute(node = src_node,
- managed = False,
- owner = self,
- ip_address = next_hop_ingress_ip,
- ip_version = ip_version,
- mac_address = mac_addr,
- interface = next_hop_interface)
- ip_routes[src_node].append(next_hop_ingress_ip)
- pre_routes.append(pre_route)
-
- # Route on src_node.name:
- # route add [prefix] dev [next_hop_interface_.device_name]
- # via [next_hop_ingress.ip_address]
- route = IPRoute(node = src_node,
- managed = False,
- owner = self,
- ip_address = prefix,
- ip_version = ip_version,
- interface = next_hop_interface,
- mac_address = mac_addr,
- gateway = next_hop_ingress_ip)
- ip_routes[src_node].append(prefix)
- routes.append(route)
- return pre_routes, routes
-
- def _get_pair_ip_routes(self):
- """
- IP routing strategy : direct routes only
- """
- routes = list()
- G = _get_l2_graph(self.groups)
- for src_node_uuid, dst_node_uuid, data in G.edges_iter(data = True):
- src_node = self._state.manager.by_uuid(src_node_uuid)
- dst_node = self._state.manager.by_uuid(dst_node_uuid)
-
- map_ = data['map_node_interface']
- src = self._state.manager.by_uuid(map_[src_node_uuid])
- dst = self._state.manager.by_uuid(map_[dst_node_uuid])
-
- log.debug('[IP ROUTE] NODES {}/{}/{} -> {}/{}/{}'.format(
- src_node.name, src.device_name, src.ip4_address,
- dst_node.name, dst.device_name, dst.ip4_address))
- log.debug('[IP ROUTE] NODES {}/{}/{} -> {}/{}/{}'.format(
- dst_node.name, dst.device_name, dst.ip4_address,
- src_node.name, src.device_name, src.ip4_address))
-
- route = IPRoute(node = src_node,
- managed = False,
- owner = self,
- ip_address = dst.ip4_address,
- mac_address = dst.mac_address,
- interface = src)
- routes.append(route)
- route = IPRoute(node = src_node,
- managed = False,
- owner = self,
- ip_address = dst.ip6_address,
- ip_version = 6,
- mac_address = dst.mac_address,
- interface = src)
- routes.append(route)
-
- route = IPRoute(node = dst_node,
- managed = False,
- owner = self,
- ip_address = src.ip4_address,
- mac_address = src.mac_address,
- interface = dst)
- routes.append(route)
- route = IPRoute(node = dst_node,
- managed = False,
- owner = self,
- ip_address = src.ip6_address,
- ip_version = 6,
- mac_address = src.mac_address,
- interface = dst)
- routes.append(route)
-
- return routes
-
-#-------------------------------------------------------------------------------
-
-class ICNFaces(Resource):
- """
- Resource: ICNFaces
-
- Centralized ICN face creation.
- """
- protocol_name = Attribute(String)
-
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
-
- @inline_task
- def __get__(self):
- raise ResourceNotFound # always create faces
-
- @inline_task
- def __create__(self):
- icn_faces = self._get_faces()
- for face in icn_faces:
- face.node.forwarder.faces << face
-
- def __delete__(self):
- raise NotImplementedError
-
- #--------------------------------------------------------------------------
- # Internal methods
- #--------------------------------------------------------------------------
-
- def _get_faces(self):
- """
- Face creation (heuristic: facemgr)
-
- Requires: at least direct IP links
- """
- protocol = FaceProtocol.from_string(self.protocol_name)
-
- faces = list()
- G = _get_l2_graph(self.groups)
- for src_node_uuid, dst_node_uuid, data in G.edges_iter(data = True):
- src_node = self._state.manager.by_uuid(src_node_uuid)
- dst_node = self._state.manager.by_uuid(dst_node_uuid)
-
- map_ = data['map_node_interface']
- src = self._state.manager.by_uuid(map_[src_node_uuid])
- dst = self._state.manager.by_uuid(map_[dst_node_uuid])
-
- log.debug('{} -> {} ({} -> {})'.format(src_node_uuid,
- dst_node_uuid, src.device_name, dst.device_name))
-
- # XXX This should be moved to the various faces, that register to a
- # factory
- if protocol == FaceProtocol.ether:
- src_face = L2Face(node = src_node,
- owner = self,
- protocol = protocol,
- src_nic = src,
- dst_mac = dst.mac_address)
- dst_face = L2Face(node = dst_node,
- owner = self,
- protocol = protocol,
- src_nic = dst,
- dst_mac = src.mac_address)
-
- elif protocol in (FaceProtocol.tcp4, FaceProtocol.tcp6,
- FaceProtocol.udp4, FaceProtocol.udp6):
- src_face = L4Face(node = src_node,
- owner = self,
- protocol = protocol,
- src_ip = src.ip4_address,
- dst_ip = dst.ip4_address,
- src_port = TMP_DEFAULT_PORT,
- dst_port = TMP_DEFAULT_PORT)
- dst_face = L4Face(node = dst_node,
- owner = self,
- protocol = protocol,
- src_ip = dst.ip4_address,
- dst_ip = src.ip4_address,
- src_port = TMP_DEFAULT_PORT,
- dst_port = TMP_DEFAULT_PORT)
- else:
- raise NotImplementedError
-
- # We key the sibling face for easier building of the ICN graph
- src_face._internal_data['sibling_face'] = dst_face._state.uuid
- dst_face._internal_data['sibling_face'] = src_face._state.uuid
-
- faces.append(src_face)
- faces.append(dst_face)
-
- return faces
-
-#------------------------------------------------------------------------------
-
-class ICNRoutes(Resource):
- """
- Resource: ICNRoutes
-
- Centralized ICN route computation.
- """
-
- routing_strategy = Attribute(String)
-
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
-
- @inline_task
- def __get__(self):
- raise ResourceNotFound # always create routes
-
- @inline_task
- def __create__(self):
- icn_routes = self._get_icn_routes()
- for route in icn_routes:
- route.node.forwarder.routes << route
-
- def __delete__(self):
- raise NotImplementedError
-
- #--------------------------------------------------------------------------
- # Internal methods
- #--------------------------------------------------------------------------
-
- def _get_prefix_origins(self):
- origins = dict()
- for group in self.groups:
- for node in group.iter_by_type_str('node'):
- node_uuid = node._state.uuid
- if not node_uuid in origins:
- origins[node_uuid] = list()
- for producer in node.producers:
- origins[node_uuid].extend(producer.prefixes)
- return origins
-
- def _get_icn_routes(self):
- strategy = MAP_ROUTING_STRATEGY.get(self.routing_strategy)
-
- G = _get_icn_graph(self._state.manager, self.groups)
- origins = self._get_prefix_origins()
-
- routes = list()
- for src, prefix, dst in strategy(G, origins):
- data = G.get_edge_data(src, dst)
-
- map_ = data['map_node_face']
- next_hop_face = map_[src]
-
- route = ICNRoute(node = src,
- owner = self,
- prefix = prefix,
- face = next_hop_face)
- routes.append(route)
- return routes
-
-#------------------------------------------------------------------------------
-
-class DnsServerEntry(Resource):
- """
- Resource: DnsServerEntry
-
- Setup of DNS resolver for LxcContainers
-
- Todo:
- - This should be merged into the LxcContainer resource
- """
-
- node = Attribute(String)
- ip_address = Attribute(String)
- interface_name = Attribute(String)
-
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
-
- @inline_task
- def __get__(self):
- raise ResourceNotFound
-
- def __create__(self):
- return BashTask(self.node, CMD_CONTAINER_SET_DNS,
- {'ip_dns': self.ip_address,
- 'interface_name': self.interface_name})
-
- def __delete__(self):
- raise NotImplementedError
-
-#------------------------------------------------------------------------------
-
-class CentralIP(Resource):
- """
- Resource: CentralIP
-
- Central IP management (main resource)
- """
-
- ip_routing_strategy = Attribute(String, description = 'IP routing strategy',
- default = 'pair') # spt, pair
- ip6_data_prefix = Attribute(String, description="Prefix for IPv6 forwarding",
- mandatory = True)
- ip4_data_prefix = Attribute(String, description="Prefix for IPv4 forwarding",
- mandatory = True)
- ip6_max_link_prefix = Attribute(Integer,
- description = 'Maximum prefix size assigned to each link',
- default = 64)
-
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
-
- def __after_init__(self):
- return ('Node', 'Channel', 'Interface')
-
- def __after__(self):
- return ('EmulatedChannel')
-
- def __subresources__(self):
- ip4_assign = Ipv4Assignment(prefix = self.ip4_data_prefix,
- groups = Reference(self, 'groups'))
- ip6_assign = Ipv6Assignment(prefix = self.ip6_data_prefix,
- groups = Reference(self, 'groups'),
- max_prefix_size = self.ip6_max_link_prefix)
- ip_routes = IPRoutes(owner = self,
- groups = Reference(self, 'groups'),
- routing_strategy = self.ip_routing_strategy)
-
- return (ip4_assign | ip6_assign) > ip_routes
-
-#------------------------------------------------------------------------------
-
-class CentralICN(Resource):
- """
- Resource: CentralICN
-
- Central ICN management (main resource)
- """
-
- # Choices: spt, max_flow
- icn_routing_strategy = Attribute(String,
- description = 'ICN routing strategy',
- default = 'spt')
- face_protocol = Attribute(String,
- description = 'Protocol used to create faces',
- default = 'ether')
-
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
-
- def __after__(self):
- """
- We need to wait for IP configuration in order to be able to build
- overload ICN faces, and producers for prefix origins.
- """
- return ('CentralIP',)
-
- def __subresources__(self):
- icn_faces = ICNFaces(owner = self, protocol_name = self.face_protocol,
- groups = Reference(self, 'groups'))
- icn_routes = ICNRoutes(owner = self,
- routing_strategy = self.icn_routing_strategy,
- groups = Reference(self, 'groups'))
- return icn_faces > icn_routes
-
- @inline_task
- def __get__(self):
- raise ResourceNotFound
-
- __delete__ = None
diff --git a/vicn/resource/group.py b/vicn/resource/group.py
index 1557c42e..a1422c69 100644
--- a/vicn/resource/group.py
+++ b/vicn/resource/group.py
@@ -36,3 +36,12 @@ class Group(Resource):
if not cls:
return list()
return self.iter_by_type(cls)
+
+# def get_tuple(self):
+# return (self.name,)
+#
+# def hash(self):
+# return hash(self.get_tuple())
+#
+# def __eq__(self, other):
+# return self.get_tuple() == other.get_tuple()
diff --git a/vicn/resource/gui.py b/vicn/resource/gui.py
new file mode 100644
index 00000000..26129b3e
--- /dev/null
+++ b/vicn/resource/gui.py
@@ -0,0 +1,96 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import http.server
+import io
+import os
+import socket
+import socketserver
+import sys
+import threading
+
+from vicn.core.resource_mgr import ResourceManager
+from vicn.helpers.resource_definition import *
+
+DEFAULT_GUI_ADDRESS = ''
+DEFAULT_GUI_PORT = 8000
+
+class GUIHandler(http.server.SimpleHTTPRequestHandler):
+ def send_head(self):
+ if self.path == '/js/settings.js':
+ return self.get_settings()
+ return super().send_head()
+
+ def get_settings(self):
+ host = self.request.getsockname()[0]
+ port = ResourceManager().get('websocket_port');
+ r = []
+ r.append("var URL='ws://{}:{}';\n".format(host, port))
+ enc = sys.getfilesystemencoding()
+ encoded = '\n'.join(r).encode(enc, 'surrogateescape')
+ f = io.BytesIO()
+ f.write(encoded)
+ f.seek(0)
+ self.send_response(http.server.HTTPStatus.OK)
+ self.send_header("Content-type", "text/javascript;")
+ self.send_header("Content-Length", str(len(encoded)))
+ self.end_headers()
+ return f
+
+
+class GUI(Resource):
+ """
+ Resource: GUI
+
+ This resource is empty on purpose. It is a temporary resource used as a
+ placeholder for controlling the GUI and should be deprecated in future
+ releases.
+ """
+ address = Attribute(String, description = 'Address on which the Webserver listens',
+ default = DEFAULT_GUI_ADDRESS)
+ port = Attribute(Integer, description = 'Port on which the Webserver listens',
+ default = DEFAULT_GUI_PORT)
+ path = Attribute(String, default='www')
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+
+ thread = threading.Thread(target = self.run)
+ thread.daemon = True
+ # XXX vICN should expose internal resources for interaction
+ try:
+ thread.start()
+ except KeyboardInterrupt:
+ server.shutdown()
+ sys.exit(0)
+
+ def run(self):
+ if not self.path.startswith(os.path.sep):
+ # XXX we might also search in the experiment folder
+ base_dir = os.path.join(os.path.dirname(__file__), os.path.pardir,
+ os.path.pardir)
+ web_dir = os.path.join(base_dir, self.path)
+ else:
+ web_dir = self.path
+ os.chdir(web_dir)
+ socketserver.TCPServer.allow_reuse_address = True
+ httpd = socketserver.TCPServer((self.address, self.port), GUIHandler)
+ httpd.serve_forever()
+
+ def __del__(self):
+ pass
diff --git a/vicn/resource/icn/ccnx_keystore.py b/vicn/resource/icn/ccnx_keystore.py
index ddd87019..ceff1647 100644
--- a/vicn/resource/icn/ccnx_keystore.py
+++ b/vicn/resource/icn/ccnx_keystore.py
@@ -18,7 +18,7 @@
from netmodel.model.type import String, Integer
from vicn.core.attribute import Attribute, Reference
-from vicn.core.task import BashTask
+from vicn.core.task import BashTask, inherit_parent
from vicn.resource.linux.file import File
from vicn.resource.linux.package_manager import Packages
@@ -39,13 +39,13 @@ class MetisKeystore(File):
filename = Attribute(String, description = "File containing the keystore",
default = DEFAULT_KEYSTORE_FILE, mandatory=False)
- password = Attribute(String,
+ password = Attribute(String,
description = "Password for the keystore file",
default = DEFAULT_KEYSTORE_PASSWD)
- subject_name = Attribute(String,
+ subject_name = Attribute(String,
description = "Subject name for the keystore",
default = DEFAULT_KEYSTORE_SUBJ)
- validity = Attribute(String,
+ validity = Attribute(String,
description = "Validity period of the keystore",
default = DEFAULT_KEYSTORE_VALIDITY)
size = Attribute(Integer, description = 'Length of the keys',
@@ -62,6 +62,7 @@ class MetisKeystore(File):
names=self._get_package_names(), owner=self)
return packages
+ @inherit_parent
def __create__(self):
args = {'filename' : self.filename, 'password' : self.password,
'subject_name' : self.subject_name, 'validity' : self.validity,
diff --git a/vicn/resource/icn/ccnx_metis.py b/vicn/resource/icn/ccnx_metis.py
index ead9b9bf..418c7683 100644
--- a/vicn/resource/icn/ccnx_metis.py
+++ b/vicn/resource/icn/ccnx_metis.py
@@ -23,9 +23,9 @@ from vicn.core.attribute import Attribute
from vicn.core.exception import ResourceNotFound
from vicn.core.resource_mgr import wait_resource_task
from vicn.core.task import BashTask, EmptyTask, task
+from vicn.core.task import inherit_parent
from vicn.resource.icn.ccnx_keystore import MetisKeystore
-from vicn.resource.icn.face import L2Face, L4Face, FaceProtocol
-from vicn.resource.icn.face import DEFAULT_ETHER_PROTO
+from vicn.resource.icn.face import L2Face, L4Face
from vicn.resource.icn.forwarder import Forwarder
from vicn.resource.linux.file import TextFile
from vicn.resource.linux.service import Service
@@ -37,10 +37,12 @@ CMD_ADD_LISTENER_ETHER = (
'add listener ether ether{conn_id} {listener.src_nic.device_name} '
'{listener.ether_proto}')
CMD_ADD_LISTENER_L4 = 'add listener {protocol} transport{conn_id} {infos}'
-CMD_ADD_CONNECTION_ETHER = ('add connection ether {face.id} {face.dst_mac} '
+CMD_ADD_CX_ETHER = ('add connection ether {face.id} {face.dst_mac} '
'{face.src_nic.device_name}')
-CMD_ADD_CONNECTION_L4 = ('add connection {protocol} {face.id} {face.dst_ip} '
- '{face.dst_port} {face.src_ip} {face.src_port}')
+CMD_ADD_CX_L4_IPV4 = ('add connection {protocol} {face.id} {face.dst.ip4_address} '
+ '{face.dst_port} {face.src.ip4_address} {face.src_port}')
+CMD_ADD_CX_L4_IPV6 = ('add connection {protocol} {face.id} {face.dst.ip6_address} '
+ '{face.dst_port} {face.src.ip6_address} {face.src_port}')
CMD_ADD_ROUTE = 'add route {route.face.id} ccnx:{route.prefix} {route.cost}'
METIS_DAEMON_BOOTSTRAP = (
'metis_daemon --port {port} --daemon --log-file {log_file} '
@@ -64,24 +66,25 @@ class MetisListener:
@staticmethod
def listener_from_face(face):
- if face.protocol is FaceProtocol.ether:
- return MetisEtherListener(face.protocol, face.src_nic,
+ if face.protocol == 'ether':
+ return MetisEtherListener(face.protocol, face.src_nic,
face.ether_proto)
- elif face.protocol in [FaceProtocol.tcp4, FaceProtocol.tcp6,
- FaceProtocol.udp4, FaceProtocol.udp6]:
- return MetisL4Listener(face.protocol, face.src_ip, face.src_port)
+ elif face.protocol in ('tcp4', 'udp4'):
+ return MetisL4Listener(face.protocol, face.src.ip4_address, face.src_port)
+ elif face.protocol in ('tcp6', 'udp6'):
+ return MetisL4Listener(face.protocol, face.src.ip6_address, face.src_port)
else:
raise ValueError("Metis only supports Ethernet and TCP/UDP faces")
class MetisEtherListener(MetisListener):
- def __init__(self, protocol, src_nic, ether_proto=DEFAULT_ETHER_PROTO):
+ def __init__(self, protocol, src_nic, ether_proto):
super().__init__(protocol)
self.src_nic = src_nic
self.ether_proto = ether_proto
def get_setup_command(self, conn_id):
- return CMD_ADD_LISTENER_ETHER.format(listener = self,
+ return CMD_ADD_LISTENER_ETHER.format(listener = self,
conn_id = conn_id)
def __eq__(self, other):
@@ -102,9 +105,9 @@ class MetisL4Listener(MetisListener):
self.src_port = src_port
def _get_proto_as_str(self):
- if self.protocol in (FaceProtocol.tcp4, FaceProtocol.tcp6):
+ if self.protocol in ('tcp4', 'tcp6'):
return "tcp"
- elif self.protocol in (FaceProtocol.udp4, FaceProtocol.udp6):
+ elif self.protocol in ('udp4', 'udp6'):
return "udp"
def get_setup_command(self, conn_id):
@@ -126,14 +129,14 @@ class MetisForwarder(Forwarder, Service):
__package_names__ = ['metis-forwarder']
__service_name__ = "metis-forwarder"
- log_file = Attribute(String, description = 'File for metis logging',
+ log_file = Attribute(String, description = 'File for metis logging',
default = '/tmp/ccnx-metis.log') # '/dev/null')
- port = Attribute(Integer, description = 'TCP port for metis',
+ port = Attribute(Integer, description = 'TCP port for metis',
default = 9695)
- gen_config = Attribute(Bool,
+ gen_config = Attribute(Bool,
description = 'Set to record all metis commands in a config file',
default = True)
- config_file = Attribute(String, default = '/root/.ccnx_metis.conf')
+ config_file = Attribute(String, default = '/root/.ccnx_metis.conf')
#--------------------------------------------------------------------------
# Constructor and Accessors
@@ -160,15 +163,18 @@ class MetisForwarder(Forwarder, Service):
def __after__(self):
return ('CentralICN',)
+ @inherit_parent
def __subresources__(self):
self.keystore = MetisKeystore(node = self.node, owner = self)
self.env_file = self._write_environment_file()
return self.keystore | self.env_file
+ @inherit_parent
@task
def __get__(self):
raise ResourceNotFound
+ @inherit_parent
def __create__(self):
# Alternatively, we might put all commands in a configuration file
@@ -222,7 +228,7 @@ class MetisForwarder(Forwarder, Service):
"""
command = METIS_DAEMON_BOOTSTRAP
- args = {'port' : self.port, 'log_file' : self.log_file,
+ args = {'port' : self.port, 'log_file' : self.log_file,
'cs_size' : self.cache_size, 'config' : self.config_file}
return BashTask(self.node, command, parameters = args)
@@ -232,7 +238,7 @@ class MetisForwarder(Forwarder, Service):
"""
command = METIS_DAEMON_STOP + '; ' + METIS_DAEMON_BOOTSTRAP
- args = {'port' : self.port, 'log_file' : self.log_file,
+ args = {'port' : self.port, 'log_file' : self.log_file,
'cs_size' : self.cache_size, 'config' : self.config_file}
return BashTask(self.node, command, parameters = args)
@@ -287,23 +293,16 @@ class MetisForwarder(Forwarder, Service):
face.id = 'conn{}'.format(self._nb_conn)
self._nb_conn += 1
- if face.protocol is FaceProtocol.ether:
- assert isinstance(face, L2Face), \
- 'Ethernet face should be instance of L2Face'
- cmd = CMD_ADD_CONNECTION_ETHER.format(face = face)
-
- elif face.protocol in (FaceProtocol.tcp4, FaceProtocol.tcp6):
- assert isinstance(face, L4Face), \
- "TCP/UDP face should be instance of L4Face"
- cmd = CMD_ADD_CONNECTION_L4.format(face = face,
- protocol = 'tcp')
-
- elif face.protocol in (FaceProtocol.udp4, FaceProtocol.udp6):
- assert isinstance(face, L4Face), \
- 'TCP/UDP face should be instance of L4Face'
- cmd = CMD_ADD_CONNECTION_L4.format(face = face,
- protocol = 'udp')
-
+ if face.protocol == 'ether':
+ cmd = CMD_ADD_CX_ETHER.format(face = face)
+ elif face.protocol == 'tcp4':
+ cmd = CMD_ADD_CX_L4_IPV4.format(face = face, protocol = 'tcp')
+ elif face.protocol == 'tcp6':
+ cmd = CMD_ADD_CX_L4_IPV6.format(face = face, protocol = 'tcp')
+ elif face.protocol == 'udp4':
+ cmd = CMD_ADD_CX_L4_IPV4.format(face = face, protocol = 'udp')
+ elif face.protocol == 'udp6':
+ cmd = CMD_ADD_CX_L4_IPV6.format(face = face, protocol = 'udp')
else:
raise ValueError('Unsupported face type for Metis')
@@ -324,13 +323,13 @@ class MetisForwarder(Forwarder, Service):
delete_task = EmptyTask()
if len(delete_cmds) > 0:
- cmds = '\n'.join('{} {}'.format(self._baseline, command)
+ cmds = '\n'.join('{} {}'.format(self._baseline, command)
for command in delete_cmds)
delete_task = BashTask(self.node, cmds)
create_task = EmptyTask()
if len(create_cmds) > 0:
- cmds = '\n'.join('{} {}'.format(self._baseline, command)
+ cmds = '\n'.join('{} {}'.format(self._baseline, command)
for command in create_cmds)
create_task = BashTask(self.node, cmds)
@@ -348,16 +347,16 @@ class MetisForwarder(Forwarder, Service):
create_task = BashTask(self.node, '\n'.join(create_cmds))
return delete_task > create_task
-
+
def _write_environment_file(self):
param_port = "PORT={port}"
param_log_file = "LOG_FILE={log_file}"
param_cs_capacity = "CS_SIZE={cs_size}"
param_config = "CONFIG={config}"
- env = [param_port.format(port = self.port),
+ env = [param_port.format(port = self.port),
param_log_file.format(log_file = self.log_file),
- param_cs_capacity.format(cs_size = self.cache_size),
+ param_cs_capacity.format(cs_size = self.cache_size),
param_config.format(config = self.config_file)]
environment_file = TextFile(filename = METIS_ETC_DEFAULT,
diff --git a/vicn/resource/icn/ccnx_simpleTrafficGenerator.py b/vicn/resource/icn/ccnx_simpleTrafficGenerator.py
index 221298fc..41a1b855 100644
--- a/vicn/resource/icn/ccnx_simpleTrafficGenerator.py
+++ b/vicn/resource/icn/ccnx_simpleTrafficGenerator.py
@@ -19,7 +19,7 @@
from netmodel.model.type import String
from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.resource import Resource, EmptyResource
-from vicn.core.task import EmptyTask
+from vicn.core.task import EmptyTask, inherit_parent
from vicn.resource.icn.icn_application import ICN_SUITE_CCNX_1_0
from vicn.resource.node import Node
@@ -28,7 +28,7 @@ from vicn.resource.icn.ccnx_consumer_producer_test import CcnxProducerTest
class CcnxSimpleTrafficGenerator(Resource):
- prefix = Attribute(String,
+ prefix = Attribute(String,
description = "Routable prefix for the applications",
default = lambda self: self.default_name(),
mandatory = False)
@@ -44,11 +44,12 @@ class CcnxSimpleTrafficGenerator(Resource):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._sr = None
-
+
#--------------------------------------------------------------------------
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
def __subresources__(self):
"""
Create the list of consumers and producers.
@@ -57,7 +58,7 @@ class CcnxSimpleTrafficGenerator(Resource):
sr = EmptyResource()
for producer in self.producers:
- producer = CcnxProducerTest(node = producer,
+ producer = CcnxProducerTest(node = producer,
owner = self,
prefixes = [self.prefix])
sr = sr | producer
diff --git a/vicn/resource/icn/central.py b/vicn/resource/icn/central.py
new file mode 100644
index 00000000..aa8ea357
--- /dev/null
+++ b/vicn/resource/icn/central.py
@@ -0,0 +1,236 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import logging
+import networkx as nx
+
+from netmodel.model.type import String
+from vicn.core.attribute import Attribute, Reference
+from vicn.core.exception import ResourceNotFound
+from vicn.core.resource import Resource
+from vicn.core.task import inline_task
+from vicn.resource.central import _get_l2_graph, MAP_ROUTING_STRATEGY
+from vicn.resource.icn.face import Face
+from vicn.resource.icn.route import Route
+
+log = logging.getLogger(__name__)
+
+
+def _get_icn_graph(manager, groups):
+ G = nx.Graph()
+ for group in groups:
+ # It's safer to iterate on node which we know are in the right groups,
+ # while it might not be the case for the forwarders...
+ for node in group.iter_by_type_str('node'):
+ G.add_node(node._state.uuid)
+ try:
+ forwarder = node.forwarder
+ except ResourceNotFound:
+ continue
+ for face in forwarder.faces:
+ other_face = manager.by_uuid(face._internal_data['sibling_face'])
+ other_node = other_face.node
+ if G.has_edge(node._state.uuid, other_node._state.uuid):
+ continue
+ map_node_face = { node._state.uuid: face._state.uuid,
+ other_node._state.uuid: other_face._state.uuid }
+ G.add_edge(node._state.uuid, other_node._state.uuid,
+ map_node_face = map_node_face)
+
+ return G
+
+#-------------------------------------------------------------------------------
+
+class ICNFaces(Resource):
+ """
+ Resource: ICNFaces
+
+ Centralized ICN face creation.
+ """
+ protocol_name = Attribute(String)
+
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ @inline_task
+ def __get__(self):
+ raise ResourceNotFound # always create faces
+
+ @inline_task
+ def __create__(self):
+ icn_faces = self._get_faces()
+ for face in icn_faces:
+ face.node.forwarder.faces << face
+
+ def __delete__(self):
+ raise NotImplementedError
+
+ #--------------------------------------------------------------------------
+ # Internal methods
+ #--------------------------------------------------------------------------
+
+ def _get_faces(self):
+ """
+ Face creation (heuristic: facemgr)
+
+ Requires: at least direct IP links
+ """
+ faces = list()
+ G = _get_l2_graph(self.groups)
+ for src_node_uuid, dst_node_uuid, data in G.edges_iter(data = True):
+ src_node = self._state.manager.by_uuid(src_node_uuid)
+ dst_node = self._state.manager.by_uuid(dst_node_uuid)
+
+ if not src_node.managed or not dst_node.managed:
+ continue
+
+ map_ = data['map_node_interface']
+ src = self._state.manager.by_uuid(map_[src_node_uuid])
+ dst = self._state.manager.by_uuid(map_[dst_node_uuid])
+
+ log.debug('{} -> {} ({} -> {})'.format(src_node_uuid,
+ dst_node_uuid, src.device_name, dst.device_name))
+
+ face_cls = Face.from_protocol(self.protocol_name)
+ if face_cls is None:
+ raise NotImplementedError
+
+ src_face = face_cls(protocol = self.protocol_name,
+ owner = self,
+ node = src_node,
+ src = src,
+ dst = dst)
+ dst_face = face_cls(protocol = self.protocol_name,
+ owner = self,
+ node = dst_node,
+ src = dst,
+ dst = src)
+
+
+ # We key the sibling face for easier building of the ICN graph
+ src_face._internal_data['sibling_face'] = dst_face._state.uuid
+ dst_face._internal_data['sibling_face'] = src_face._state.uuid
+
+ faces.append(src_face)
+ faces.append(dst_face)
+
+ return faces
+
+#------------------------------------------------------------------------------
+
+class ICNRoutes(Resource):
+ """
+ Resource: Routes
+
+ Centralized ICN route computation.
+ """
+
+ routing_strategy = Attribute(String)
+
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ @inline_task
+ def __get__(self):
+ raise ResourceNotFound # always create routes
+
+ @inline_task
+ def __create__(self):
+ icn_routes = self._get_icn_routes()
+ for route in icn_routes:
+ route.node.forwarder.routes << route
+
+ def __delete__(self):
+ raise NotImplementedError
+
+ #--------------------------------------------------------------------------
+ # Internal methods
+ #--------------------------------------------------------------------------
+
+ def _get_prefix_origins(self):
+ origins = dict()
+ for group in self.groups:
+ for node in group.iter_by_type_str('node'):
+ node_uuid = node._state.uuid
+ if not node_uuid in origins:
+ origins[node_uuid] = list()
+ for producer in node.producers:
+ origins[node_uuid].extend(producer.prefixes)
+ return origins
+
+ def _get_icn_routes(self):
+ strategy = MAP_ROUTING_STRATEGY.get(self.routing_strategy)
+
+ G = _get_icn_graph(self._state.manager, self.groups)
+ origins = self._get_prefix_origins()
+
+ routes = list()
+ for src, prefix, dst in strategy(G, origins):
+ src_node = self._state.manager.by_uuid(src)
+ if not src_node.managed:
+ continue
+ data = G.get_edge_data(src, dst)
+
+ map_ = data['map_node_face']
+ next_hop_face = map_[src]
+
+ route = Route(node = src,
+ owner = self,
+ prefix = prefix,
+ face = next_hop_face)
+ routes.append(route)
+
+ return routes
+
+#------------------------------------------------------------------------------
+
+class CentralICN(Resource):
+ """
+ Resource: CentralICN
+
+ Central ICN management (main resource)
+ """
+
+ # Choices: spt, max_flow
+ icn_routing_strategy = Attribute(String,
+ description = 'ICN routing strategy',
+ default = 'spt')
+ face_protocol = Attribute(String,
+ description = 'Protocol used to create faces',
+ default = 'ether')
+
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ def __after__(self):
+ """
+ We need to wait for IP configuration in order to be able to build
+ overload ICN faces, and producers for prefix origins.
+ """
+ return ('CentralIP',)
+
+ def __subresources__(self):
+ icn_faces = ICNFaces(owner = self, protocol_name = self.face_protocol,
+ groups = Reference(self, 'groups'))
+ icn_routes = ICNRoutes(owner = self,
+ routing_strategy = self.icn_routing_strategy,
+ groups = Reference(self, 'groups'))
+ return icn_faces > icn_routes
diff --git a/vicn/resource/vpp/cicn.py b/vicn/resource/icn/cicn.py
index 1a68f11f..76dafe0e 100644
--- a/vicn/resource/vpp/cicn.py
+++ b/vicn/resource/icn/cicn.py
@@ -24,15 +24,17 @@ from vicn.core.exception import ResourceNotFound
from vicn.core.requirement import Requirement
from vicn.core.resource_mgr import wait_resource_task
from vicn.core.task import async_task, task, BashTask, EmptyTask
+from vicn.core.task import inherit_parent
from vicn.resource.icn.forwarder import Forwarder
from vicn.resource.node import Node
from vicn.resource.vpp.vpp_commands import CMD_VPP_ENABLE_PLUGIN
-from vicn.resource.vpp.vpp_commands import CMD_VPP_CICN_GET
-from vicn.resource.vpp.vpp_commands import CMD_VPP_ADD_ICN_FACE
-from vicn.resource.vpp.vpp_commands import CMD_VPP_ADD_ICN_ROUTE
-from vicn.resource.vpp.vpp_commands import CMD_VPP_CICN_GET_CACHE_SIZE
-from vicn.resource.vpp.vpp_commands import CMD_VPP_CICN_SET_CACHE_SIZE
+CMD_VPP_CICN_GET = "vppctl_wrapper cicn show"
+CMD_VPP_ADD_ICN_ROUTE = 'vppctl_wrapper cicn cfg fib add prefix {route.prefix} face {route.face.id}'
+CMD_VPP_ADD_ICN_FACE = 'vppctl_wrapper cicn cfg face add local {face.src_ip}:{face.src_port} remote {face.dst_ip}:{face.dst_port}'
+
+CMD_VPP_CICN_GET_CACHE_SIZE = 'vppctl_wrapper cicn show | grep "CS entries" | grep -Eo "[0-9]+"'
+CMD_VPP_CICN_SET_CACHE_SIZE = 'vppctl_wrapper cicn control param cs size {self.cache_size}'
_ADD_FACE_RETURN_FORMAT = "Face ID: [0-9]+"
def check_face_id_return_format(data):
@@ -66,6 +68,7 @@ class CICNForwarder(Forwarder):
def __after__(self):
return ['CentralICN']
+ @inherit_parent
def __get__(self):
def parse(rv):
if rv.return_value > 0 or 'cicn: not enabled' in rv.stdout:
@@ -73,6 +76,7 @@ class CICNForwarder(Forwarder):
return BashTask(self.node, CMD_VPP_CICN_GET,
lock = self.node.vpp.vppctl_lock, parse=parse)
+ @inherit_parent
def __create__(self):
#self.node.vpp.plugins.append("cicn")
@@ -104,9 +108,6 @@ class CICNForwarder(Forwarder):
return (wait_resource_task(self.node.vpp) > create_task) > (face_task > route_task)
- # Nothing to do
- __delete__ = None
-
#--------------------------------------------------------------------------
# Attributes
#--------------------------------------------------------------------------
diff --git a/vicn/resource/icn/face.py b/vicn/resource/icn/face.py
index 641d10e7..4fd07883 100644
--- a/vicn/resource/icn/face.py
+++ b/vicn/resource/icn/face.py
@@ -16,36 +16,31 @@
# limitations under the License.
#
-from enum import Enum
-
-from netmodel.model.type import Integer, String, Bool
-from vicn.core.attribute import Attribute
-from vicn.core.requirement import Requirement
-from vicn.core.resource import Resource
-from vicn.resource.node import Node
-from vicn.resource.interface import Interface
+from netmodel.model.type import Integer, String, Bool, InetAddress
+from netmodel.model.object import ObjectMetaclass
+from vicn.core.attribute import Attribute
+from vicn.core.requirement import Requirement
+from vicn.core.resource import Resource
+from vicn.resource.interface import Interface
+from vicn.resource.node import Node
DEFAULT_ETHER_PROTO = 0x0801
-FMT_L4FACE = '{protocol.name}://{dst_ip}:{dst_port}/'
-FMT_L2FACE = '{protocol.name}://[{dst_mac}]/{src_nic.device_name}'
-
-class FaceProtocol(Enum):
- ether = 0
- ip4 = 1
- ip6 = 2
- tcp4 = 3
- tcp6 = 4
- udp4 = 5
- udp6 = 7
- app = 8
-
- @staticmethod
- def from_string(protocol):
- return getattr(FaceProtocol, protocol)
+DEFAULT_PORT = 6363
+
+FMT_L4FACE_IPV4 = '{protocol}://{dst.ip4_address}:{dst_port}/'
+FMT_L4FACE_IPV6 = '{protocol}://{dst.ip6_address}:{dst_port}/'
+FMT_L2FACE = '{protocol}://[{dst.mac_address}]/{src.device_name}'
#------------------------------------------------------------------------------
-class Face(Resource):
+class FaceMetaclass(ObjectMetaclass):
+ def __new__(mcls, name, bases, attrs):
+ cls = super(FaceMetaclass, mcls).__new__(mcls, name, bases, attrs)
+ if name != 'Face':
+ cls.register()
+ return cls
+
+class Face(Resource, metaclass=FaceMetaclass):
"""
Resource: Face
"""
@@ -57,6 +52,10 @@ class Face(Resource):
protocol = Attribute(String,
description = 'Face underlying protocol',
mandatory = True)
+
+ src = Attribute(Interface, mandatory = True)
+ dst = Attribute(Interface, mandatory = True)
+
id = Attribute(String, description = 'Local face ID',
ro = True)
@@ -75,6 +74,18 @@ class Face(Resource):
description = 'Flags for face creation with NFDC',
func = lambda self : self._lambda_nfdc_flags())
+ # map protocol -> face class
+ _map_protocol = dict()
+
+ @classmethod
+ def register(cls):
+ for protocol in cls.__protocols__:
+ Face._map_protocol[protocol] = cls
+
+ @classmethod
+ def from_protocol(cls, protocol):
+ return cls._map_protocol.get(protocol)
+
def __repr__(self):
flags = ''
if self.permanent:
@@ -95,7 +106,7 @@ class Face(Resource):
# NFD specifics
def _lambda_nfd_uri(self):
- raise NotImplementedError
+ return 'N/A' # raise NotImplementedError
def _lambda_nfdc_flags(self):
flags = ''
@@ -111,14 +122,11 @@ class Face(Resource):
class L2Face(Face):
- src_nic = Attribute(Interface,
- description = "Name of the network interface linked to the face",
- mandatory=True)
- dst_mac = Attribute(String, description = "destination MAC address",
- mandatory=True)
+ __protocols__ = ['ether']
+
ether_proto = Attribute(String,
description = "Ethernet protocol number used by the face",
- default=DEFAULT_ETHER_PROTO)
+ default = DEFAULT_ETHER_PROTO)
def _lambda_nfd_uri(self):
return self.format(FMT_L2FACE)
@@ -127,14 +135,13 @@ class L2Face(Face):
class L4Face(Face):
- ip_version = Attribute(Integer, description = "IPv4 or IPv6", default = 4)
- src_ip = Attribute(String, description = "local IP address",
- mandatory = True)
- src_port = Attribute(Integer, description = "local TCP/UDP port")
- dst_ip = Attribute(String, descrition = "remote IP address",
- mandatory=True)
+ __protocols__ = ['tcp4', 'tcp6', 'udp4', 'udp6']
+
+ src_port = Attribute(Integer, description = "local TCP/UDP port",
+ default = DEFAULT_PORT)
dst_port = Attribute(Integer, description = "remote TCP/UDP port",
- mandatory=True)
+ default = DEFAULT_PORT)
def _lambda_nfd_uri(self):
- return self.format(FMT_L4FACE)
+ fmt = FMT_L4FACE_IPV4 if self.protocol in ['tcp4', 'udp4'] else FMT_L4FACE_IPV6
+ return self.format(fmt)
diff --git a/vicn/resource/icn/forwarder.py b/vicn/resource/icn/forwarder.py
index 748532cf..e2ad944f 100644
--- a/vicn/resource/icn/forwarder.py
+++ b/vicn/resource/icn/forwarder.py
@@ -30,7 +30,7 @@ DEFAULT_CACHE_SIZE = 1000 # pk
DEFAULT_CACHE_POLICY = 'LRU'
DEFAULT_STRATEGY = 'best-route'
-class Forwarder(ICNApplication, ABC):
+class Forwarder(ICNApplication):
"""
Resource: Forwarder
"""
diff --git a/vicn/resource/icn/icn_application.py b/vicn/resource/icn/icn_application.py
index 817d9403..e8b6e19c 100644
--- a/vicn/resource/icn/icn_application.py
+++ b/vicn/resource/icn/icn_application.py
@@ -20,6 +20,7 @@ from vicn.resource.linux.application import LinuxApplication
from vicn.core.attribute import Attribute
from netmodel.model.type import Integer
+ICN_SUITE_HICN_1_0=0
ICN_SUITE_CCNX_1_0=1
ICN_SUITE_NDN=2
diff --git a/vicn/resource/icn/iping.py b/vicn/resource/icn/iping.py
index 0e04eadc..4494c79f 100644
--- a/vicn/resource/icn/iping.py
+++ b/vicn/resource/icn/iping.py
@@ -36,28 +36,28 @@ class IPing(ICNApplication):
__package_names__ = ["libicnet"]
- prefixes = Attribute(String,
+ prefixes = Attribute(String,
description = "name served by the ping server",
default = lambda self: self.default_name(),
mandatory = False,
multiplicity = Multiplicity.OneToMany)
node = Attribute(Node,
requirements=[
- Requirement("forwarder",
- capabilities = set(['ICN_SUITE_CCNX_1_0']),
+ Requirement("forwarder",
+ capabilities = set(['ICN_SUITE_CCNX_1_0']),
properties = {"protocol_suites" : ICN_SUITE_CCNX_1_0})
])
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
# Methods
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def __method_start__(self):
return self._build_command()
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
# Internal methods
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def default_name(self):
return ['/iping']
@@ -72,16 +72,16 @@ class IPingClient(IPing, Producer):
Resource: IPingClient
"""
- flood = Attribute(Bool, description = 'enable flood mode',
+ flood = Attribute(Bool, description = 'enable flood mode',
default = False)
count = Attribute(Integer, description = 'number of ping to send')
- interval = Attribute(Integer,
+ interval = Attribute(Integer,
description = 'interval between interests in ping mode')
size = Attribute(Integer, description = 'size of the interests')
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
# Internal methods
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def _build_command(self):
template = ["iPing_Client", "-l ccnx:{prefix}"]
@@ -110,9 +110,9 @@ class IPingServer(IPing, Consumer):
size = Attribute(Integer, description = "size of the payload")
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
# Internal methods
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def _build_command(self):
template = ["iPing_Server", "-l ccnx:{prefix}"]
diff --git a/vicn/resource/icn/ndnpingserver.py b/vicn/resource/icn/ndnpingserver.py
index f9cfa7cc..8fbb5fb6 100644
--- a/vicn/resource/icn/ndnpingserver.py
+++ b/vicn/resource/icn/ndnpingserver.py
@@ -54,7 +54,7 @@ class NDNPingServerBase(Producer):
default = lambda self: self._default_prefixes())
node = Attribute(requirements = [
- Requirement("forwarder",
+ Requirement("forwarder",
capabilities = set(['ICN_SUITE_NDN_1_0'])) ])
__package_names__ = ['ndnping']
diff --git a/vicn/resource/icn/nfd.py b/vicn/resource/icn/nfd.py
index c65fdeb8..1b7f39f7 100644
--- a/vicn/resource/icn/nfd.py
+++ b/vicn/resource/icn/nfd.py
@@ -22,6 +22,7 @@ import re
from vicn.core.exception import ResourceNotFound
from vicn.core.task import inline_task, BashTask
from vicn.core.task import ParseRegexTask
+from vicn.core.task import inherit_parent
from vicn.resource.icn.forwarder import Forwarder
from vicn.resource.icn.icn_application import ICN_SUITE_NDN
@@ -74,17 +75,20 @@ class NFD(Forwarder):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
@inline_task
def __get__(self):
# NFD is assumed not to exist
raise ResourceNotFound
+ @inherit_parent
def __create__(self):
# Modify the configuration file before running the forwarder service
conf = BashTask(self.node, CMD_SET_STRATEGY_CACHE, {'nfd': self})
- forwarder = Forwarder.__create__(self)
- return conf.then(forwarder)
+ forwarder = super().__create__()
+ return conf > forwarder
+ @inherit_parent
def __delete__(self):
raise NotImplementedError
diff --git a/vicn/resource/icn/producer.py b/vicn/resource/icn/producer.py
index 131097f2..36cbea77 100644
--- a/vicn/resource/icn/producer.py
+++ b/vicn/resource/icn/producer.py
@@ -16,6 +16,7 @@
# limitations under the License.
#
+from netmodel.model.key import Key
from netmodel.model.type import String
from vicn.resource.icn.icn_application import ICNApplication
from vicn.core.attribute import Attribute, Multiplicity
@@ -33,5 +34,6 @@ class Producer(ICNApplication):
description = 'Node on which the producer is installed',
mandatory = True,
multiplicity = Multiplicity.ManyToOne,
- reverse_name = 'producers',
- key = True)
+ reverse_name = 'producers')
+
+ __key__ = Key(node)
diff --git a/vicn/resource/icn/route.py b/vicn/resource/icn/route.py
index 0dc2ed2f..6efd909b 100644
--- a/vicn/resource/icn/route.py
+++ b/vicn/resource/icn/route.py
@@ -25,12 +25,10 @@ from vicn.resource.node import Node
class Route(Resource):
node = Attribute(Node, mandatory = True)
prefix = Attribute(String, mandatory = True)
- face = Attribute(Face, description = "face used to forward interests",
+ face = Attribute(Face, description = "face used to forward interests",
mandatory=True)
cost = Attribute(Integer, default=1)
def __repr__(self):
- return '<Route {} {} on node {}>'.format(self.prefix, self.face,
+ return '<Route {} {} on node {}>'.format(self.prefix, self.face,
self.node.name)
-
- __str__ = __repr__
diff --git a/vicn/resource/interface.py b/vicn/resource/interface.py
index 0ae2dc94..3aa40fb4 100644
--- a/vicn/resource/interface.py
+++ b/vicn/resource/interface.py
@@ -16,8 +16,9 @@
# limitations under the License.
#
-from vicn.core.attribute import Attribute, Multiplicity
+from netmodel.model.key import Key
from netmodel.model.type import Bool
+from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.resource import Resource
from vicn.resource.node import Node
from vicn.resource.channel import Channel
@@ -30,8 +31,7 @@ class Interface(Resource):
node = Attribute(Node, description = 'Node to which the interface belongs',
multiplicity = Multiplicity.ManyToOne,
reverse_name = 'interfaces',
- mandatory = True,
- key = True)
+ mandatory = True)
channel = Attribute(Channel, description = 'Channel to which the interface is attached',
multiplicity = Multiplicity.ManyToOne,
reverse_name = 'interfaces')
@@ -41,6 +41,8 @@ class Interface(Resource):
default = True)
monitored = Attribute(Bool, default = True)
+ __key__ = Key(node, Resource.name)
+
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
diff --git a/vicn/resource/ip/central.py b/vicn/resource/ip/central.py
new file mode 100644
index 00000000..0c397728
--- /dev/null
+++ b/vicn/resource/ip/central.py
@@ -0,0 +1,288 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import logging
+import networkx as nx
+import os
+
+from netmodel.model.type import String, Integer, Bool
+from vicn.core.attribute import Attribute, Reference
+from vicn.core.exception import ResourceNotFound
+from vicn.core.resource import Resource
+from vicn.core.task import inline_task, BashTask
+from vicn.resource.central import _get_l2_graph, MAP_ROUTING_STRATEGY
+from vicn.resource.channel import Channel
+from vicn.resource.ip_assignment import Ipv4Assignment, Ipv6Assignment
+from vicn.resource.ip.route import IPRoute
+
+log = logging.getLogger(__name__)
+
+CMD_CONTAINER_SET_DNS = 'echo "nameserver {ip_dns}" | ' \
+ 'resolvconf -a {interface_name}'
+
+#-------------------------------------------------------------------------------
+
+class IPRoutes(Resource):
+ """
+ Resource: IPRoutes
+
+ Centralized IP route computation.
+ """
+ routing_strategy = Attribute(String)
+
+ def __after__(self):
+ return ("IpAssignment",)
+
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ @inline_task
+ def __get__(self):
+ raise ResourceNotFound
+
+ @inline_task
+ def __create__(self):
+ routes = list()
+ pre_routes, routes = self._get_ip_routes()
+ routes.extend(pre_routes)
+ routes.extend(routes)
+ for route in routes:
+ route.node.routing_table.routes << route
+
+ def __delete__(self):
+ raise NotImplementedError
+
+ #--------------------------------------------------------------------------
+ # Internal methods
+ #--------------------------------------------------------------------------
+
+ def _get_ip_origins(self):
+ origins = dict()
+ for group in self.groups:
+ for channel in group.iter_by_type_str('channel'):
+ for interface in channel.interfaces:
+ if group.name not in [x.name for x in interface.node.groups]:
+ continue
+ node_uuid = interface.node._state.uuid
+ if not node_uuid in origins:
+ origins[node_uuid] = list()
+ origins[node_uuid].append(interface.ip4_address.canonical_prefix())
+ if interface.ip6_address:
+ origins[node_uuid].append(interface.ip6_address.canonical_prefix())
+ return origins
+
+ def _get_ip_routes(self):
+ if self.routing_strategy == 'pair':
+ return [], self._get_pair_ip_routes()
+
+ strategy = MAP_ROUTING_STRATEGY.get(self.routing_strategy)
+
+ G = _get_l2_graph(self.groups)
+ origins = self._get_ip_origins()
+
+ # node -> list(origins for which we have routes)
+ ip_routes = dict()
+
+ pre_routes = list()
+ routes = list()
+ for src, prefix, dst in strategy(G, origins):
+ data = G.get_edge_data(src, dst)
+
+ map_ = data['map_node_interface']
+ next_hop_interface = map_[src]
+
+ next_hop_ingress = self._state.manager.by_uuid(map_[dst])
+ src_node = self._state.manager.by_uuid(src)
+
+ # Avoid duplicate routes due to multiple paths in the network
+ if not src_node in ip_routes:
+ ip_routes[src_node] = set()
+ #XXX Untested for VPP
+ #When you set up an IP address ip/prefix_len (ip addr add), you already create a route
+ #towards ip/prefix_len
+ for interface in src_node.interfaces:
+ ip_routes[src_node].add(interface.ip4_address.canonical_prefix())
+ ip_routes[src_node].add(interface.ip6_address.canonical_prefix())
+ if prefix in ip_routes[src_node]:
+ continue
+ ip_routes[src_node].add(prefix)
+
+ ip_version = 6 if ":" in str(prefix) else 4
+ next_hop_ingress_ip = (next_hop_ingress.ip6_address if ip_version is 6 else
+ next_hop_ingress.ip4_address)
+ if prefix == next_hop_ingress_ip:
+ # Direct route on src_node.name :
+ # route add [prefix] dev [next_hop_interface_.device_name]
+ route = IPRoute(node = src_node,
+ managed = False,
+ owner = self,
+ ip_address = prefix,
+ ip_version = ip_version,
+ interface = next_hop_interface)
+ else:
+ # We need to be sure we have a route to the gw from the node
+ if not next_hop_ingress_ip.canonical_prefix() in ip_routes[src_node]:
+ pre_route = IPRoute(node = src_node,
+ managed = False,
+ owner = self,
+ ip_address = next_hop_ingress_ip.canonical_prefix(),
+ ip_version = ip_version,
+ interface = next_hop_interface)
+ ip_routes[src_node].add(next_hop_ingress_ip.canonical_prefix())
+ pre_routes.append(pre_route)
+
+ # Route on src_node.name:
+ # route add [prefix] dev [next_hop_interface_.device_name]
+ # via [next_hop_ingress.ip_address]
+ route = IPRoute(node = src_node,
+ managed = False,
+ owner = self,
+ ip_address = prefix,
+ ip_version = ip_version,
+ interface = next_hop_interface,
+ gateway = next_hop_ingress_ip)
+ routes.append(route)
+ return pre_routes, routes
+
+ def _get_pair_ip_routes(self):
+ """
+ IP routing strategy : direct routes only
+ """
+ routes = list()
+ G = _get_l2_graph(self.groups)
+ for src_node_uuid, dst_node_uuid, data in G.edges_iter(data = True):
+ src_node = self._state.manager.by_uuid(src_node_uuid)
+ dst_node = self._state.manager.by_uuid(dst_node_uuid)
+
+ map_ = data['map_node_interface']
+ src = self._state.manager.by_uuid(map_[src_node_uuid])
+ dst = self._state.manager.by_uuid(map_[dst_node_uuid])
+
+ log.debug('[IP ROUTE] NODES {}/{}/{} -> {}/{}/{}'.format(
+ src_node.name, src.device_name, src.ip4_address,
+ dst_node.name, dst.device_name, dst.ip4_address))
+ log.debug('[IP ROUTE] NODES {}/{}/{} -> {}/{}/{}'.format(
+ dst_node.name, dst.device_name, dst.ip4_address,
+ src_node.name, src.device_name, src.ip4_address))
+
+ route = IPRoute(node = src_node,
+ managed = False,
+ owner = self,
+ ip_address = dst.ip4_address,
+ mac_address = dst.mac_address,
+ interface = src)
+ routes.append(route)
+ route = IPRoute(node = src_node,
+ managed = False,
+ owner = self,
+ ip_address = dst.ip6_address,
+ ip_version = 6,
+ mac_address = dst.mac_address,
+ interface = src)
+ routes.append(route)
+
+ route = IPRoute(node = dst_node,
+ managed = False,
+ owner = self,
+ ip_address = src.ip4_address,
+ mac_address = src.mac_address,
+ interface = dst)
+ routes.append(route)
+ route = IPRoute(node = dst_node,
+ managed = False,
+ owner = self,
+ ip_address = src.ip6_address,
+ ip_version = 6,
+ mac_address = src.mac_address,
+ interface = dst)
+ routes.append(route)
+
+ return routes
+
+#------------------------------------------------------------------------------
+
+class DnsServerEntry(Resource):
+ """
+ Resource: DnsServerEntry
+
+ Setup of DNS resolver for LxcContainers
+
+ Todo:
+ - This should be merged into the LxcContainer resource
+ """
+
+ node = Attribute(String)
+ ip_address = Attribute(String)
+ interface_name = Attribute(String)
+
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ @inline_task
+ def __get__(self):
+ raise ResourceNotFound
+
+ def __create__(self):
+ return BashTask(self.node, CMD_CONTAINER_SET_DNS,
+ {'ip_dns': str(self.ip_address),
+ 'interface_name': self.interface_name})
+
+ def __delete__(self):
+ raise NotImplementedError
+
+#------------------------------------------------------------------------------
+
+class CentralIP(Resource):
+ """
+ Resource: CentralIP
+
+ Central IP management (main resource)
+ """
+
+ ip_routing_strategy = Attribute(String, description = 'IP routing strategy',
+ default = 'pair') # spt, pair
+ ip6_data_prefix = Attribute(String, description="Prefix for IPv6 forwarding",
+ mandatory = True)
+ ip4_data_prefix = Attribute(String, description="Prefix for IPv4 forwarding",
+ mandatory = True)
+ ip6_max_link_prefix = Attribute(Integer,
+ description = 'Maximum prefix size assigned to each link',
+ default = 64)
+ ip6_disjoint_addresses = Attribute(Bool, description="assign disjoint addresses spanning over the whole prefix", default=False)
+
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ def __after_init__(self):
+ return ('Node', 'Channel', 'Interface', 'EmulatedChannel')
+
+ def __subresources__(self):
+ ip4_assign = Ipv4Assignment(prefix = self.ip4_data_prefix,
+ groups = Reference(self, 'groups'))
+ ip6_assign = Ipv6Assignment(prefix = self.ip6_data_prefix,
+ groups = Reference(self, 'groups'),
+ max_prefix_len = self.ip6_max_link_prefix,
+ disjoint_addresses = self.ip6_disjoint_addresses)
+ ip_routes = IPRoutes(owner = self,
+ groups = Reference(self, 'groups'),
+ routing_strategy = self.ip_routing_strategy)
+
+ return (ip4_assign | ip6_assign) > ip_routes
diff --git a/vicn/resource/ip/prefix_tree.py b/vicn/resource/ip/prefix_tree.py
index 34af1d14..1fec2d47 100644
--- a/vicn/resource/ip/prefix_tree.py
+++ b/vicn/resource/ip/prefix_tree.py
@@ -16,134 +16,7 @@
# limitations under the License.
#
-from socket import inet_pton, inet_ntop, AF_INET6
-from struct import unpack, pack
-from abc import ABCMeta
-
-class PrefixTreeException(Exception): pass
-class NotEnoughAddresses(PrefixTreeException): pass
-class UnassignablePrefix(PrefixTreeException): pass
-
-class Prefix(metaclass=ABCMeta):
-
- def __init__(self, ip_address, prefix_size=None):
- if not prefix_size:
- ip_address, prefix_size = ip_address.split('/')
- prefix_size = int(prefix_size)
- if isinstance(ip_address, str):
- ip_address = self.aton(ip_address)
- self.ip_address = ip_address
- self.prefix_size = prefix_size
-
- def __contains__(self, obj):
- #it can be an IP as a integer
- if isinstance(obj, int):
- obj = type(self)(obj, self.MAX_PREFIX_SIZE)
- #Or it's an IP string
- if isinstance(obj, str):
- #It's a prefix as 'IP/prefix'
- if '/' in obj:
- split_obj = obj.split('/')
- obj = type(self)(split_obj[0], int(split_obj[1]))
- else:
- obj = type(self)(obj, self.MAX_PREFIX_SIZE)
-
- return self._contains_prefix(obj)
-
- @classmethod
- def mask(cls):
- mask_len = cls.MAX_PREFIX_SIZE//8 #Converts from bits to bytes
- mask = 0
- for step in range(0,mask_len):
- mask = (mask << 8) | 0xff
- return mask
-
- def _contains_prefix(self, prefix):
- assert isinstance(prefix, type(self))
- return (prefix.prefix_size >= self.prefix_size and
- prefix.ip_address >= self.first_prefix_address() and
- prefix.ip_address <= self.last_prefix_address())
-
- #Returns the first address of a prefix
- def first_prefix_address(self):
- return self.ip_address & (self.mask() << (self.MAX_PREFIX_SIZE-self.prefix_size))
-
- def last_prefix_address(self):
- return self.ip_address | (self.mask() >> self.prefix_size)
-
- def limits(self):
- return self.first_prefix_address(), self.last_prefix_address()
-
- def __str__(self):
- return "{}/{}".format(self.ntoa(self.first_prefix_address()), self.prefix_size)
-
- def __eq__(self, other):
- return (self.first_prefix_address() == other.first_prefix_address() and
- self.prefix_size == other.prefix_size)
-
- def __hash__(self):
- return hash(str(self))
-
- def __iter__(self):
- return self.get_iterator()
-
- #Iterates by steps of prefix_size, e.g., on all available /31 in a /24
- def get_iterator(self, prefix_size=None):
- if prefix_size is None:
- prefix_size=self.MAX_PREFIX_SIZE
- assert (prefix_size >= self.prefix_size and prefix_size<=self.MAX_PREFIX_SIZE)
- step = 2**(self.MAX_PREFIX_SIZE - prefix_size)
- for ip in range(self.first_prefix_address(), self.last_prefix_address()+1, step):
- yield type(self)(ip, prefix_size)
-
-class Inet4Prefix(Prefix):
-
- MAX_PREFIX_SIZE = 32
-
- @classmethod
- def aton(cls, address):
- ret = 0
- components = address.split('.')
- for comp in components:
- ret = (ret << 8) + int(comp)
- return ret
-
- @classmethod
- def ntoa(cls, address):
- components = []
- for _ in range(0,4):
- components.insert(0,'{}'.format(address % 256))
- address = address >> 8
- return '.'.join(components)
-
-class Inet6Prefix(Prefix):
-
- MAX_PREFIX_SIZE = 128
-
- @classmethod
- def aton (cls, address):
- prefix, suffix = unpack(">QQ", inet_pton(AF_INET6, address))
- return (prefix << 64) | suffix
-
- @classmethod
- def ntoa (cls, address):
- return inet_ntop(AF_INET6, pack(">QQ", address >> 64, address & ((1 << 64) -1)))
-
- #skip_internet_address: skip a:b::0, as v6 often use default /64 prefixes
- def get_iterator(self, prefix_size=None, skip_internet_address=None):
- if skip_internet_address is None:
- #We skip the internet address if we iterate over Addresses
- if prefix_size is None:
- skip_internet_address = True
- #But not if we iterate over prefixes
- else:
- skip_internet_address = False
- it = super().get_iterator(prefix_size)
- if skip_internet_address:
- next(it)
- return it
-
-###### PREFIX TREE ######
+from netmodel.model.type import Inet4Prefix, Inet6Prefix
class PrefixTree:
@@ -160,21 +33,21 @@ class PrefixTree:
self.full = False
- def find_prefix(self, prefix_size):
+ def find_prefix(self, prefix_len):
ret, lret, rret = [None]*3
- if prefix_size > self.prefix.prefix_size and not self.full:
+ if prefix_len > self.prefix.prefix_len and not self.full:
if self.left is None:
- lret = self.prefix_cls(self.prefix.first_prefix_address(), self.prefix.prefix_size+1)
+ lret = self.prefix_cls(self.prefix.first_prefix_address(), self.prefix.prefix_len+1)
else:
- lret = self.left.find_prefix(prefix_size)
+ lret = self.left.find_prefix(prefix_len)
if self.right is None:
- rret = self.prefix_cls(self.prefix.last_prefix_address(), self.prefix.prefix_size+1)
+ rret = self.prefix_cls(self.prefix.last_prefix_address(), self.prefix.prefix_len+1)
else:
- rret = self.right.find_prefix(prefix_size)
+ rret = self.right.find_prefix(prefix_len)
#Now we look for the longer prefix to assign
- if not lret or (rret and rret.prefix_size > lret.prefix_size):
+ if not lret or (rret and rret.prefix_len > lret.prefix_len):
ret = rret
else:
ret = lret
@@ -183,9 +56,9 @@ class PrefixTree:
def assign_prefix(self, prefix):
assert prefix in self.prefix
- if prefix.prefix_size > self.prefix.prefix_size:
+ if prefix.prefix_len > self.prefix.prefix_len:
#Existing prefix on the left
- lp = self.prefix_cls(self.prefix.first_prefix_address(), self.prefix.prefix_size+1)
+ lp = self.prefix_cls(self.prefix.first_prefix_address(), self.prefix.prefix_len+1)
#It's on the left branch
if prefix in lp:
if not self.left:
@@ -193,7 +66,7 @@ class PrefixTree:
self.left.assign_prefix(prefix)
#It's on the right branch
else:
- rp = self.prefix_cls(self.prefix.last_prefix_address(), self.prefix.prefix_size+1)
+ rp = self.prefix_cls(self.prefix.last_prefix_address(), self.prefix.prefix_len+1)
if not self.right:
self.right = PrefixTree(rp)
self.right.assign_prefix(prefix)
@@ -202,13 +75,14 @@ class PrefixTree:
else:
raise RuntimeError("And you may ask yourself, well, how did I get here?")
- def get_prefix(self, prefix_size):
- ret = self.find_prefix(prefix_size)
+ def get_prefix(self, prefix_len):
+ ret = self.find_prefix(prefix_len)
if not ret:
raise NotEnoughAddresses
#find_prefix returns the size of the largest available prefix in our space
#not necessarily the one we asked for
- ret.prefix_size = prefix_size
+ ret.ip_address = ret.first_prefix_address()
+ ret.prefix_len = prefix_len
self.assign_prefix(ret)
return ret
diff --git a/vicn/resource/ip/route.py b/vicn/resource/ip/route.py
index b9f82960..2f5807b6 100644
--- a/vicn/resource/ip/route.py
+++ b/vicn/resource/ip/route.py
@@ -16,7 +16,7 @@
# limitations under the License.
#
-from netmodel.model.type import String, Integer
+from netmodel.model.type import String, Integer, InetAddress
from vicn.resource.node import Node
from vicn.core.attribute import Attribute
from vicn.core.resource import Resource
@@ -24,10 +24,8 @@ from vicn.resource.interface import Interface
class IPRoute(Resource):
node = Attribute(Node, mandatory = True)
- ip_address = Attribute(String, mandatory = True)
+ ip_address = Attribute(InetAddress, mandatory = True)
interface = Attribute(Interface, mandatory = True)
- gateway = Attribute(String)
+ gateway = Attribute(InetAddress)
ip_version = Attribute(Integer, default=4)
-
- # FIXME Temp hack for VPP, migrate this to an ARP table resource
- mac_address = Attribute(String)
+ metric = Attribute(Integer)
diff --git a/vicn/resource/ip/routing_table.py b/vicn/resource/ip/routing_table.py
index e45793cc..ce16524c 100644
--- a/vicn/resource/ip/routing_table.py
+++ b/vicn/resource/ip/routing_table.py
@@ -20,28 +20,31 @@ from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import Resource
from vicn.core.task import EmptyTask, BashTask
+from vicn.core.task import inherit_parent
from vicn.resource.ip.route import IPRoute
from vicn.resource.node import Node
from vicn.resource.vpp.vpp_commands import CMD_VPP_ADD_ROUTE
from vicn.resource.vpp.vpp_commands import CMD_VPP_ADD_ROUTE_GW
-CMD_ADD_ROUTE = ('ip -{route.ip_version} route add {route.ip_address} '
- 'dev {route.interface.device_name} || true')
-CMD_ADD_ROUTE_GW = ('ip -{route.ip_version} route add {route.ip_address} '
- 'dev {route.interface.device_name} via {route.gateway} || true')
-CMD_DEL_ROUTE = ('ip -{route.ip_version} route del {route.ip_address} '
+CMD_ADD_ROUTE = ('ip -{route.ip_version} route add {route.ip_address}/{route.ip_address.prefix_len} '
+ 'dev {route.interface.device_name}')
+CMD_ADD_ROUTE_GW = ('ip -{route.ip_version} route add {route.ip_address}/{route.ip_address.prefix_len} '
+ 'dev {route.interface.device_name} via {route.gateway}')
+CMD_ADD_ROUTE_GWM = ('ip -{route.ip_version} route add {route.ip_address}/{route.ip_address.prefix_len} '
+ 'dev {route.interface.device_name} via {route.gateway} metric {route.metric}')
+CMD_DEL_ROUTE = ('ip -{route.ip_version} route del {route.ip_address}/{route.ip_address.prefix_len} '
'dev {route.interface.device_name}')
CMD_SHOW_ROUTES = 'ip route show'
-CMD_ADD_ARP_ENTRY = 'arp -s {route.ip_address} {route.mac_address}'
-CMD_ADD_NDB_ENTRY = ('ip -6 neigh add {route.ip_address} lladr {route.mac_address} '
- 'dev {route.interface.device_name}')
+#CMD_ADD_ARP_ENTRY = 'arp -s {route.ip_address} {route.mac_address}'
+#CMD_ADD_NDB_ENTRY = ('ip -6 neigh add {route.ip_address} lladr {route.mac_address} '
+# 'dev {route.interface.device_name}')
# Populate arp table too. The current configuration with one single bridge
# connecting every container and vpp nodes seem to create loops that prevent
# vpp from netmodel.network.interface for routing ip packets.
-VPP_ARP_FIX = True
+#VPP_ARP_FIX = True
def _iter_routes(out):
for line in out.splitlines():
@@ -97,6 +100,7 @@ class RoutingTable(Resource):
def __after__(self):
return ('CentralIP', 'VPPInterface', 'ContainerSetup')
+ @inherit_parent
def __get__(self):
def cache(rv):
for route in _iter_routes(rv.stdout):
@@ -106,6 +110,7 @@ class RoutingTable(Resource):
raise ResourceNotFound
return BashTask(self.node, CMD_SHOW_ROUTES, parse=cache)
+ @inherit_parent
def __create__(self):
"""
Create a single BashTask for all routes
@@ -114,7 +119,6 @@ class RoutingTable(Resource):
done = set()
routes_cmd = list()
routes_via_cmd = list()
- arp_cmd = list()
# vppctl lock
# NOTE: we currently lock vppctl during the whole route update
@@ -122,7 +126,7 @@ class RoutingTable(Resource):
routes_via_lock = None
for route in self.routes:
- if route.ip_address in self._routes:
+ if str(route.ip_address) in self._routes:
continue
if route.ip_address in done:
continue
@@ -135,21 +139,22 @@ class RoutingTable(Resource):
cmd = CMD_ADD_ROUTE.format(route = route)
routes_cmd.append(cmd)
else:
- cmd = CMD_ADD_ROUTE_GW.format(route = route)
- routes_via_cmd.append(cmd)
- if VPP_ARP_FIX and route.mac_address:
- if route.ip_address != "default":
- cmd = CMD_ADD_ARP_ENTRY.format(route = route)
- arp_cmd.append(cmd)
+ if route.metric is None:
+ cmd = CMD_ADD_ROUTE_GW.format(route = route)
+ routes_via_cmd.append(cmd)
+ else:
+ cmd = CMD_ADD_ROUTE_GWM.format(route = route)
+ routes_via_cmd.append(cmd)
else:
+ if route.metric == 1025:
+ continue
if route.gateway is None:
cmd = CMD_VPP_ADD_ROUTE.format(route = route)
- routes_cmd.append(cmd)
routes_lock = route.node.vpp.vppctl_lock
else:
cmd = CMD_VPP_ADD_ROUTE_GW.format(route = route)
- routes_via_cmd.append(cmd)
routes_via_lock = route.node.vpp.vppctl_lock
+ routes_via_cmd.append(cmd)
# TODO: checks
clean_routes_task = EmptyTask()
@@ -166,12 +171,8 @@ class RoutingTable(Resource):
else:
routes_via_task = EmptyTask()
- if len(arp_cmd) > 0:
- arp_task = BashTask(self.node, '\n'.join(arp_cmd))
- else:
- arp_task = EmptyTask()
-
- return ((clean_routes_task > routes_task) > routes_via_task) > arp_task
+ return ((clean_routes_task > routes_task) > routes_via_task)
+ @inherit_parent
def __delete__(self):
raise NotImplementedError
diff --git a/vicn/resource/ip_assignment.py b/vicn/resource/ip_assignment.py
index 55401ecd..3bb16ff9 100644
--- a/vicn/resource/ip_assignment.py
+++ b/vicn/resource/ip_assignment.py
@@ -20,10 +20,12 @@ import math
import logging
from vicn.core.resource import Resource
-from netmodel.model.type import String
+from netmodel.model.type import String, Bool
from vicn.core.attribute import Attribute
from vicn.resource.ip.prefix_tree import Inet6Prefix, PrefixTree, Inet4Prefix
+from netmodel.model.type import Inet4Address, Inet6Address
from vicn.core.task import inline_task, async_task, EmptyTask
+from vicn.core.task import inherit_parent
from vicn.core.exception import ResourceNotFound
log = logging.getLogger(__name__)
@@ -31,8 +33,9 @@ log = logging.getLogger(__name__)
class IpAssignment(Resource):
prefix = Attribute(String, mandatory=True)
control_prefix = Attribute(String, description="prefix for control plane")
- max_prefix_size = Attribute(String,
+ max_prefix_len = Attribute(String,
description="Maximum assigned prefix size for a link")
+ disjoint_addresses = Attribute(Bool, default=False)
PrefixClass = None
@@ -41,20 +44,20 @@ class IpAssignment(Resource):
self._prefix = self.PrefixClass(self.prefix)
self._prefix_tree = PrefixTree(self._prefix)
self._assigned_prefixes = {}
- if not self.max_prefix_size:
- self.max_prefix_size = self.PrefixClass.MAX_PREFIX_SIZE
+ if not self.max_prefix_len:
+ self.max_prefix_len = self.PrefixClass.MAX_PREFIX_SIZE
if self.control_prefix:
self._ctrl_prefix = self.PrefixClass(self.control_prefix)
self._ctrl_prefix_it = iter(self._ctrl_prefix)
next(self._ctrl_prefix_it) #Removes internet address
self._assigned_addresses = {}
- def get_prefix(self, obj, prefix_size):
+ def get_prefix(self, obj, prefix_len):
ret = None
if obj in self._assigned_prefixes:
ret = self._assigned_prefixes[obj]
else:
- ret = self._prefix_tree.get_prefix(prefix_size)
+ ret = self._prefix_tree.get_prefix(prefix_len)
self._assigned_prefixes[obj] = ret
return ret
@@ -69,10 +72,12 @@ class IpAssignment(Resource):
self._assigned_addresses[obj] = ret
return ret
+ @inherit_parent
@inline_task
def __get__(self):
raise ResourceNotFound
+ @inherit_parent
#@inline_task
def __create__(self):
# XXX code from Channel.__create__, until Events are properly implemented.
@@ -80,38 +85,77 @@ class IpAssignment(Resource):
task = EmptyTask()
for group in self.groups:
for channel in group.iter_by_type_str('channel'):
- interfaces = sorted(channel.interfaces, key = lambda x : x.device_name)
- if not interfaces:
- continue
-
- min_prefix_size = math.ceil(math.log(len(channel.interfaces), 2))
- prefix_size = min(self.max_prefix_size,
- self.PrefixClass.MAX_PREFIX_SIZE - min_prefix_size)
- prefix = self.get_prefix(channel, prefix_size)
-
- it = prefix.get_iterator()
+ if channel.has_type("emulatedchannel"):
+ interfaces = [channel._ap_if]
+ interfaces.extend(channel._sta_ifs.values())
+ else:
+ interfaces = sorted(channel.interfaces, key = lambda x : x.device_name)
+ if not interfaces:
+ continue
+
+ if self.PrefixClass is Inet6Prefix:
+ # 0 is forbidden
+ num_required_ip = len(interfaces) + 1
+ elif channel.has_type("emulatedchannel"): #EmulatedChannel + IPv4
+ num_required_ip = len(interfaces) + 2 + channel.nb_base_stations #Internet address + bcast
+ else:
+ num_required_ip = len(interfaces)
+ min_prefix_len = math.ceil(math.log(num_required_ip, 2))
+
+ prefix_len = min(self.max_prefix_len,
+ self.PrefixClass.MAX_PREFIX_SIZE - min_prefix_len)
+
+ #XXX lte-emulator expects /24
+ if channel.has_type("emulatedltechannel") and self.PrefixClass is Inet4Prefix:
+ prefix_len = 24
+
+ # Retrieve a prefix for the whole channel
+ prefix = self.get_prefix(channel, prefix_len)
+
+ # by default iterate on /32 or /128, unless we require to
+ # iterate on less specific
+ it_prefix_len = self.PrefixClass.MAX_PREFIX_SIZE
+
+ if self.disjoint_addresses and prefix_len+min_prefix_len <= self.PrefixClass.MAX_PREFIX_SIZE:
+ it_prefix_len = min_prefix_len + prefix_len
+
+ # Use an iterator to assign IPs from the prefix to the
+ # interfaces
+ it = prefix.get_iterator(it_prefix_len)
+ # XXX MACCHA it is a prefix
+
+ if channel.has_type("emulatedchannel"):
+ #Internet address
+ next(it)
for interface in interfaces:
- ip = next(it)
- interface.set(self.ATTR_PREFIX, prefix_size)
- #XXX Why do we need to create that async task?
- #XXX Probably because the PendingValue is not created
- #XXX in the main thread
+ if_prefix = next(it)
+ #XXX We cannot assign prefix::0 as a valid address to an interface.
+ #XXX For each interface with an ip6 address belonging to prefix,
+ #XXX linux add prefix::0 to the local routing table. Therefore prefix::0 cannot be
+ #XXX the address of a non local interface
+ ip = if_prefix.ip_address
+ if ip == prefix.first_prefix_address() and self.PrefixClass is Inet6Prefix:
+ if if_prefix.prefix_len < if_prefix.MAX_PREFIX_SIZE:
+ if_prefix.ip_address = ip+1
+ else:
+ if_prefix = next(it)
+
+ if_prefix.prefix_len = prefix_len
+ if self.PrefixClass is Inet6Prefix:
+ address = Inet6Address(if_prefix.ip_address, prefix_len)
+ else:
+ address = Inet4Address(if_prefix.ip_address, prefix_len)
@async_task
- async def set_ip(interface, ip):
- await interface.async_set(self.ATTR_ADDRESS, self.PrefixClass.ntoa(ip.ip_address))
- task = task | set_ip(interface, ip)
-
+ async def set_ip(interface, address):
+ await interface.async_set(self.ATTR_ADDRESS, address)
+ task = task | set_ip(interface, address)
return task
- __delete__ = None
-
class Ipv6Assignment(IpAssignment):
PrefixClass = Inet6Prefix
- ATTR_ADDRESS = 'ip6_address'
- ATTR_PREFIX = 'ip6_prefix'
+ ATTR_ADDRESS = 'ip6_address'
class Ipv4Assignment(IpAssignment):
PrefixClass = Inet4Prefix
- ATTR_ADDRESS = 'ip4_address'
- ATTR_PREFIX = 'ip4_prefix'
+ ATTR_ADDRESS = 'ip4_address'
diff --git a/vicn/resource/linux/bridge.py b/vicn/resource/linux/bridge.py
index 7b5ceed7..edc8acdc 100644
--- a/vicn/resource/linux/bridge.py
+++ b/vicn/resource/linux/bridge.py
@@ -22,18 +22,15 @@ from vicn.core.address_mgr import AddressManager
from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.requirement import Requirement
-from vicn.core.task import inline_task
+from vicn.core.task import inline_task, inherit
from vicn.resource.channel import Channel
+from vicn.resource.interface import Interface
from vicn.resource.linux.bridge_mgr import BridgeManager
-from vicn.resource.linux.net_device import BaseNetDevice
+from vicn.resource.linux.net_device import NetDevice
log = logging.getLogger(__name__)
-# FIXME This should use the AddressManager to get allocated a name that does
-# not exist
-DEFAULT_BRIDGE_NAME = 'br0'
-
-class Bridge(Channel, BaseNetDevice):
+class Bridge(Channel, NetDevice):
"""
Resource: Bridge
"""
@@ -62,21 +59,10 @@ class Bridge(Channel, BaseNetDevice):
# Resource lifecycle
#--------------------------------------------------------------------------
- @inline_task
- def __get__(self):
- # FIXME we currently force the recreation of the bridge, delegating the
- # check to the creation function
- raise ResourceNotFound
-
+ @inherit(Channel, Interface)
def __create__(self):
- # FIXME : reserves .1 IP address for the bridge, provided no other
- # class uses this trick
- AddressManager().get_ip(self)
return self.node.bridge_manager.add_bridge(self.device_name)
- # Everything should be handled by BaseNetDevice
- __delete__ = None
-
#--------------------------------------------------------------------------
# Resource lifecycle
#--------------------------------------------------------------------------
@@ -86,7 +72,7 @@ class Bridge(Channel, BaseNetDevice):
Returns:
Task
"""
- return self.node.bridge_manager.add_interface(self.device_name,
+ return self.node.bridge_manager.add_interface(self.device_name,
interface.device_name, vlan)
def __method_add_interface__(self, interface, vlan=None):
@@ -99,6 +85,6 @@ class Bridge(Channel, BaseNetDevice):
"""
log.info('Removing interface {} from bridge {}'.format(
interface.device_name, self.name))
- return self.node.bridge_manager.del_interface(self.device_name,
+ return self.node.bridge_manager.del_interface(self.device_name,
interface.device_name)
diff --git a/vicn/resource/linux/certificate.py b/vicn/resource/linux/certificate.py
index dd451770..2cc6c9b0 100644
--- a/vicn/resource/linux/certificate.py
+++ b/vicn/resource/linux/certificate.py
@@ -23,6 +23,7 @@ from vicn.core.attribute import Attribute, Multiplicity, Reference
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import Resource
from vicn.core.task import task, inline_task, BashTask
+from vicn.core.task import inherit_parent
from vicn.resource.linux.file import File
from vicn.resource.node import Node
@@ -49,29 +50,40 @@ class Certificate(Resource):
multiplicity = Multiplicity.ManyToOne)
cert = Attribute(String, description = 'Certificate path',
mandatory = True)
- key = Attribute(String, description = 'Key path',
- mandatory = True)
+ key = Attribute(String, description = 'Key path')
#--------------------------------------------------------------------------
# Resource lifecycle
#--------------------------------------------------------------------------
- @inline_task
- def __initialize__(self):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
self._cert_file = File(node = Reference(self, 'node'),
filename = Reference(self, 'cert'),
managed = False)
- self._key_file = File(node = Reference(self, 'node'),
- filename = Reference(self, 'key'),
- managed = False)
+ if self.key:
+ self._key_file = File(node = Reference(self, 'node'),
+ filename = Reference(self, 'key'),
+ managed = False)
+ else:
+ self._key_file = None
+ @inherit_parent
def __get__(self):
- return self._cert_file.__get__() | self._key_file.__get__()
+ if self.key:
+ return self._cert_file.__get__() | self._key_file.__get__()
+ else:
+ return self._cert_file.__get__()
+ @inherit_parent
def __create__(self):
return BashTask(self.node, CMD_CREATE, {'self': self})
+ @inherit_parent
def __delete__(self):
- return self._cert_file.__delete__() | self._key_file.__delete__()
+ if self.key:
+ return self._cert_file.__delete__() | self._key_file.__delete__()
+ else:
+ return self._cert_file.__delete__()
diff --git a/vicn/resource/linux/certificate_store.py b/vicn/resource/linux/certificate_store.py
new file mode 100644
index 00000000..59d9a239
--- /dev/null
+++ b/vicn/resource/linux/certificate_store.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from vicn.core.attribute import Attribute, Multiplicity
+from vicn.core.resource import Resource
+from vicn.resource.linux.certificate import Certificate
+from vicn.resource.node import Node
+
+PACKAGE = 'ca-certificates'
+
+CMD_ADD_CERTIFICATE = '''
+cp {certificate.cert} {store.PATH}
+dpkg-reconfigure ca-certificates
+'''
+
+class CertificateStore(Resource):
+ """
+ Resource: System-wide Certificate Store
+
+ This resource allows manipulation of the trusted certificates on the system.
+ Use with care.
+
+ TODO:
+ - Ensure ca-certificates package is installed.
+ - Issue a warning to the user when it is used.
+ """
+
+ PATH = '/usr/share/ca-certificates'
+
+ certificates = Attribute(Certificate, multiplicity = Multiplicity.OneToMany)
+ node = Attribute(Node, mandatory = True, requirements = [
+ #Requirement(PACKAGE, 'in', 'packages')
+ ])
+
+ def _add_certificate(self):
+ # Return a task that takes a certificate as parameter
+ PARAM = None
+ return BashTask(self.node, CMD_ADD_CERTIFICATE, {'store': self, 'certificate': PARAM},
+ root = True)
diff --git a/vicn/resource/linux/dnsmasq.py b/vicn/resource/linux/dnsmasq.py
index b5aa8053..70358ecb 100644
--- a/vicn/resource/linux/dnsmasq.py
+++ b/vicn/resource/linux/dnsmasq.py
@@ -24,6 +24,7 @@ from string import Template
from netmodel.model.type import String, Bool
from vicn.core.attribute import Attribute
from vicn.core.resource import EmptyResource
+from vicn.core.task import inherit_parent, override_parent
from vicn.resource.dns_server import DnsServer
from vicn.resource.interface import Interface
from vicn.resource.linux.file import TextFile
@@ -72,15 +73,16 @@ class DnsMasq(Service, DnsServer):
log_dhcp = Attribute(Bool, description = 'Flag: log DHCP queries',
default = True)
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
-
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if not self.interface:
raise Exception("Cannot initialize bridge without interface")
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ @inherit_parent
def __subresources__(self):
# Overwrite configuration file
flags = list()
@@ -112,3 +114,7 @@ class DnsMasq(Service, DnsServer):
return TextFile(node = self.node, owner = self, filename = FN_CONF,
content = conf, overwrite = True)
+
+ @override_parent
+ def __create__(self):
+ return self.__method_stop_start()
diff --git a/vicn/resource/linux/file.py b/vicn/resource/linux/file.py
index 44b4b5be..2a62f60e 100644
--- a/vicn/resource/linux/file.py
+++ b/vicn/resource/linux/file.py
@@ -16,11 +16,12 @@
# limitations under the License.
#
+from netmodel.model.key import Key
from netmodel.model.type import String, Bool
from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import Resource
-from vicn.core.task import BashTask, inline_task
+from vicn.core.task import BashTask, inline_task, inherit_parent
from vicn.resource.node import Node
CREATE_DIR_CMD = "mkdir -p {dir}"
@@ -38,22 +39,23 @@ class File(Resource):
Resource: File
"""
filename = Attribute(String, description = 'Path to the file',
- key = True,
mandatory = True)
node = Attribute(Node, description = 'Node on which the file is created',
mandatory = True,
multiplicity = Multiplicity.ManyToOne,
reverse_name = 'files',
- key = True,
reverse_description = 'Files created on the node')
overwrite = Attribute(Bool,
description = 'Determines whether an existing file is overwritten',
default = False)
+ __key__ = Key(node, filename)
+
#--------------------------------------------------------------------------
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
def __get__(self):
# UGLY
@inline_task
@@ -72,12 +74,14 @@ class File(Resource):
test = BashTask(self.node, GET_FILE_CMD, {"file": self}, parse=is_path)
return test
+ @inherit_parent
def __create__(self):
ctask = BashTask(self.node, CREATE_FILE_CMD, {"file": self})
if self.overwrite:
ctask = BashTask(self.node, DELETE_FILE_CMD, {'file': self}) > ctask
return ctask
+ @inherit_parent
def __delete__(self):
return BashTask(self.node, DELETE_FILE_CMD, { "file" : self})
@@ -96,6 +100,8 @@ class TextFile(File):
# Resource lifecycle
#--------------------------------------------------------------------------
+ # XXX REDUNDANT !!!
+ @inherit_parent
def __create__(self):
return BashTask(self.node, CMD_PRINT_TO_FILE, {'file': self})
diff --git a/vicn/resource/linux/folder.py b/vicn/resource/linux/folder.py
new file mode 100644
index 00000000..636ecbcd
--- /dev/null
+++ b/vicn/resource/linux/folder.py
@@ -0,0 +1,88 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from netmodel.model.key import Key
+from netmodel.model.type import String, Bool, Integer
+from vicn.core.attribute import Attribute, Multiplicity
+from vicn.core.exception import ResourceNotFound
+from vicn.core.resource import Resource
+from vicn.core.task import BashTask, inline_task, EmptyTask
+from vicn.resource.node import Node
+
+CREATE_FOLDER_CMD = "mkdir -p {folder.foldername}"
+DELETE_FOLDER_CMD = "rm -f {folder.foldername}"
+
+GET_FOLDER_CMD = 'test -d {folder.foldername} && readlink -e {folder.foldername}'
+
+SET_FOLDER_PERMISSION_CMD = 'chmod {folder.permission} {folder.foldername}'
+
+class Folder(Resource):
+ """
+ Resource: Folder
+ """
+ foldername = Attribute(String, description = 'Path to the folder',
+ mandatory = True)
+ node = Attribute(Node, description = 'Node on which the directory is created',
+ mandatory = True,
+ multiplicity = Multiplicity.ManyToOne,
+ reverse_name = 'folders',
+ reverse_description = 'Folders created on the node')
+ overwrite = Attribute(Bool,
+ description = 'Determines whether an existing folder is overwritten',
+ default = False)
+ permission = Attribute(Integer,
+ description = 'Permission to set in the folder',
+ default = 775)
+
+ __key__ = Key(node, foldername)
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ @inline_task
+ def __get__(self):
+ # UGLY
+# @inline_task
+# def not_found():
+ raise ResourceNotFound
+
+ # if self.overwrite:
+ # return not_found()
+
+ # def is_path (rv):
+ # if rv is None or rv.stdout is None or len(rv.stdout) == 0 or \
+ # rv.return_value != 0:
+ # raise ResourceNotFound
+ # return {} # 'filename': rv.stdout}
+
+ # create = BashTask(self.node, GET_FOLDER_CMD, {"folder": self}, parse=is_path)
+
+ # return create
+
+ def __create__(self):
+ ctask = BashTask(self.node, CREATE_FOLDER_CMD, {"folder": self})
+
+ if self.overwrite:
+ ctask = BashTask(self.node, DELETE_FOLDER_CMD, {'folder': self}) > ctask
+
+ set_permission = BashTask(self.node, SET_FOLDER_PERMISSION_CMD, {"folder": self})
+
+ return ctask > set_permission
+
+ def __delete__(self):
+ return BashTask(self.node, DELETE_FOLFER_CMD, { "folder" : self})
diff --git a/vicn/resource/linux/gre_tunnel.py b/vicn/resource/linux/gre_tunnel.py
new file mode 100644
index 00000000..c5a25307
--- /dev/null
+++ b/vicn/resource/linux/gre_tunnel.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import string
+
+from netmodel.model.type import Integer, String
+from vicn.core.attribute import Attribute
+from vicn.core.resource import Resource
+from vicn.core.task import BashTask, inherit_parent, override_parent
+from vicn.resource.channel import Channel
+from vicn.resource.linux.net_device import NetDevice, SlaveNetDevice
+
+CMD_CREATE_GRE_TUNNEL='''
+ip tunnel add {device_name} mode gre remote {dst} local {src} ttl 255
+'''
+
+class GREChannel(Channel):
+ """
+ Resource: GRETunnel
+ """
+ pass
+
+class GREInterface(SlaveNetDevice):
+
+ remote_address = Attribute(String, description ='',
+ mandatory = True)
+
+ @override_parent
+ def __create__(self):
+ return BashTask(self.src_interface.node, CMD_CREATE_GRE_TUNNEL, {
+ 'device_name': self.device_name,
+ 'src': str(self.parent.ip4_address),
+ 'dst': self.remote_address})
+
+class GRETunnel(Resource):
+
+ src_interface = Attribute(NetDevice, description = 'source interface',
+ mandatory = True)
+ dst_interface = Attribute(NetDevice, description = 'destination interface',
+ mandatory = True)
+
+ @inherit_parent
+ def __subresources__(self):
+ channel = GREChannel()
+ src = GREInterface(node=src_interface.node, device_name="gre0",
+ parent=src_interface, channel=channel)
+ dst = GREInterface(node=dst_interface.node, device_name="gre0",
+ parent=dst_interface, channel=channel)
+ return (src | dst) | channel
diff --git a/vicn/resource/linux/iperf.py b/vicn/resource/linux/iperf.py
index a0780a1c..e4b8e94c 100644
--- a/vicn/resource/linux/iperf.py
+++ b/vicn/resource/linux/iperf.py
@@ -16,12 +16,10 @@
# limitations under the License.
#
-from abc import ABC
-
from netmodel.model.type import Integer
from vicn.core.attribute import Attribute
from vicn.resource.linux.application import LinuxApplication
-class Iperf3(LinuxApplication, ABC):
+class Iperf3(LinuxApplication):
__package_names__ = ['iperf3']
diff --git a/vicn/resource/linux/keypair.py b/vicn/resource/linux/keypair.py
index 66c98e5b..b748b756 100644
--- a/vicn/resource/linux/keypair.py
+++ b/vicn/resource/linux/keypair.py
@@ -23,6 +23,7 @@ from vicn.core.attribute import Attribute, Multiplicity, Reference
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import Resource
from vicn.core.task import task, inline_task, BashTask
+from vicn.core.task import inherit_parent
from vicn.resource.linux.file import File
from vicn.resource.node import Node
@@ -48,8 +49,8 @@ class Keypair(Resource):
# Resource lifecycle
#--------------------------------------------------------------------------
- @inline_task
- def __initialize__(self):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
self._pubkey_file = File(node = Reference(self, 'node'),
filename = self.key + '.pub',
managed = False)
@@ -57,14 +58,17 @@ class Keypair(Resource):
filename = self.key,
managed = False)
+ @inherit_parent
def __get__(self):
return self._pubkey_file.__get__() | self._key_file.__get__()
+ @inherit_parent
def __create__(self):
return BashTask(self.node, CMD_CREATE, {
'dirname': os.path.dirname(self.key),
'self': self})
+ @inherit_parent
def __delete__(self):
return self._pubkey_file.__delete__() | self._key_file.__delete__()
diff --git a/vicn/resource/linux/link.py b/vicn/resource/linux/link.py
index da41fbe1..3ffaae97 100644
--- a/vicn/resource/linux/link.py
+++ b/vicn/resource/linux/link.py
@@ -20,12 +20,14 @@ import random
import string
import logging
+from netmodel.model.key import Key
from netmodel.model.type import Integer, String
from vicn.core.attribute import Attribute, Reference
from vicn.core.exception import ResourceNotFound
from vicn.core.state import ResourceState, AttributeState
from vicn.core.task import inline_task, async_task, run_task
from vicn.core.task import get_attributes_task, BashTask
+from vicn.core.task import inherit_parent
from vicn.resource.channel import Channel
from vicn.resource.interface import Interface
from vicn.resource.linux.net_device import NonTapBaseNetDevice
@@ -53,7 +55,7 @@ ip link set dev {tmp_src} netns {pid} name {interface.device_name}
ip link set dev {tmp_dst} up
ovs-vsctl add-port {host.bridge.device_name} {tmp_dst}'''
-CMD_UP='''
+CMD_SET_UP='''
ip link set dev {interface.device_name} up
'''
@@ -73,18 +75,19 @@ class Link(Channel):
delay = Attribute(String, description = 'Link propagation delay')
src_node = Attribute(Node, description = 'Source node',
- key = True,
mandatory = True)
dst_node = Attribute(Node, description = 'Destination node',
- key = True,
mandatory = True)
+ __key__ = Key(src_node, dst_node)
+
def __init__(self, *args, **kwargs):
assert 'src_node' in kwargs and 'dst_node' in kwargs
self._src = None
self._dst = None
super().__init__(*args, **kwargs)
+ @inherit_parent
@inline_task
def __initialize__(self):
# We create two managed net devices that are pre-setup
@@ -124,23 +127,27 @@ class Link(Channel):
vpp_src = VPPInterface(parent = self._src,
vpp = self.src_node.vpp,
ip4_address = Reference(self._src, 'ip4_address'),
- device_name = 'vpp' + self._src.device_name)
+ ip6_address = Reference(self._src, 'ip6_address'),
+ device_name = 'host-' + self._src.device_name)
manager.commit_resource(vpp_src)
if hasattr(self.dst_node, 'vpp') and not self.dst_node.vpp is None:
vpp_dst = VPPInterface(parent = self._dst,
vpp = self.dst_node.vpp,
ip4_address = Reference(self._dst, 'ip4_address'),
- device_name = 'vpp' + self._dst.device_name)
+ ip6_address = Reference(self._dst, 'ip6_address'),
+ device_name = 'host-' + self._dst.device_name)
manager.commit_resource(vpp_dst)
#--------------------------------------------------------------------------
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
def __get__(self):
return (self._src.__get__() | self._dst.__get__()) > async_task(self._commit)()
+ @inherit_parent
def __create__(self):
assert self.src_node.get_type() == 'lxccontainer'
assert self.dst_node.get_type() == 'lxccontainer'
@@ -168,8 +175,8 @@ class Link(Channel):
host = src_host
create = BashTask(host, CMD_CREATE, {'interface': self,
'tmp_src': tmp_src, 'tmp_dst': tmp_dst})
- up_src = BashTask(self.src_node, CMD_UP, {'interface': self._src})
- up_dst = BashTask(self.dst_node, CMD_UP, {'interface': self._dst})
+ up_src = BashTask(self.src_node, CMD_SET_UP, {'interface': self._src})
+ up_dst = BashTask(self.dst_node, CMD_SET_UP, {'interface': self._dst})
up = up_src | up_dst
delif = delif_src | delif_dst
return ((delif > (pid @ create)) > up) > async_task(self._commit)()
@@ -178,10 +185,11 @@ class Link(Channel):
'tmp_src': tmp_src, 'tmp_dst': tmp_dst, 'host' : src_host})
create2 = BashTask(dst_host, CMD_CREATE_BR_TO_LXC, {'interface': self._dst,
'tmp_src': tmp_dst, 'tmp_dst': tmp_src, 'host' : dst_host})
- up_src = BashTask(self.src_node, CMD_UP, {'interface': self._src})
- up_dst = BashTask(self.dst_node, CMD_UP, {'interface': self._dst})
+ up_src = BashTask(self.src_node, CMD_SET_UP, {'interface': self._src})
+ up_dst = BashTask(self.dst_node, CMD_SET_UP, {'interface': self._dst})
return (((pid_src @ create) | (pid_dst @ create2)) > (up_src | up_dst)) > async_task(self._commit)()
+ @inherit_parent
def __delete__(self):
return self._src.__delete__() | self._dst.__delete__()
diff --git a/vicn/resource/linux/macvlan.py b/vicn/resource/linux/macvlan.py
index ea9c37c1..3c81cde1 100644
--- a/vicn/resource/linux/macvlan.py
+++ b/vicn/resource/linux/macvlan.py
@@ -18,14 +18,15 @@
from netmodel.model.type import String
from vicn.core.attribute import Attribute
-from vicn.core.task import BashTask
-from vicn.resource.linux.net_device import SlaveBaseNetDevice
+from vicn.core.task import BashTask, inherit
+from vicn.resource.interface import Interface
+from vicn.resource.linux.net_device import SlaveNetDevice
CMD_CREATE_PARENT = 'ip link add name {netdevice.device_name} ' \
'link {netdevice.parent.device_name} ' \
'type {netdevice.netdevice_type} mode {netdevice.mode}'
-class MacVlan(SlaveBaseNetDevice):
+class MacVlan(SlaveNetDevice):
"""
Resource: MacVlan
@@ -48,5 +49,6 @@ class MacVlan(SlaveBaseNetDevice):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit(Interface)
def __create__(self):
return BashTask(self.node, CMD_CREATE_PARENT, {'netdevice': self})
diff --git a/vicn/resource/linux/macvtap.py b/vicn/resource/linux/macvtap.py
index 82002e02..23176763 100644
--- a/vicn/resource/linux/macvtap.py
+++ b/vicn/resource/linux/macvtap.py
@@ -18,14 +18,15 @@
from netmodel.model.type import String
from vicn.core.attribute import Attribute
-from vicn.core.task import BashTask
-from vicn.resource.linux.net_device import SlaveBaseNetDevice
+from vicn.core.task import BashTask, inherit
+from vicn.resource.interface import Interface
+from vicn.resource.linux.net_device import SlaveNetDevice
CMD_CREATE_PARENT = 'ip link add name {netdevice.device_name} ' \
'link {netdevice.parent.device_name} ' \
'type {netdevice.netdevice_type} mode {netdevice.mode}'
-class MacVtap(SlaveBaseNetDevice):
+class MacVtap(SlaveNetDevice):
"""
Resource: MacVtap
@@ -48,5 +49,6 @@ class MacVtap(SlaveBaseNetDevice):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit(Interface)
def __create__(self):
return BashTask(self.node, CMD_CREATE_PARENT, {'netdevice': self})
diff --git a/vicn/resource/linux/net_device.py b/vicn/resource/linux/net_device.py
index c393ac1a..f9ab40b1 100644
--- a/vicn/resource/linux/net_device.py
+++ b/vicn/resource/linux/net_device.py
@@ -23,11 +23,13 @@ import random
import string
from netmodel.model.type import Integer, String, Bool
+from netmodel.model.type import Inet4Address, Inet6Address
from vicn.core.address_mgr import AddressManager
from vicn.core.attribute import Attribute
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import BaseResource
-from vicn.core.task import BashTask, task, EmptyTask
+from vicn.core.task import BashTask, task, EmptyTask, inherit
+from vicn.core.task import inherit_parent, override_parent
from vicn.resource.linux.application import LinuxApplication as Application
from vicn.resource.interface import Interface
@@ -59,11 +61,11 @@ CMD_SET_MAC_ADDRESS = 'ip link set dev {netdevice.device_name} ' \
'address {netdevice.mac_address}'
CMD_GET_IP_ADDRESS = 'ip addr show {netdevice.device_name}'
CMD_SET_IP4_ADDRESS = 'ip addr add dev {netdevice.device_name} ' \
- '{netdevice.ip4_address} brd + || true'
+ '{netdevice.ip4_address}/{netdevice.ip4_address.prefix_len} brd + || true'
CMD_SET_IP6_ADDRESS = 'ip addr add dev {netdevice.device_name} ' \
- '{netdevice.ip6_address}/{netdevice.ip6_prefix} || true'
+ '{netdevice.ip6_address}/{netdevice.ip6_address.prefix_len} || true'
CMD_SET_PROMISC = 'ip link set dev {netdevice.device_name} promisc {on_off}'
-CMD_SET_UP = 'ip link set {netdevice.device_name} {up_down}'
+CMD_SET_UP = 'ip link set {netdevice.device_name} {state}'
CMD_SET_CAPACITY='\n'.join([
'tc qdisc del dev {netdevice.device_name} root || true',
'tc qdisc add dev {netdevice.device_name} root handle 1: tbf rate '
@@ -92,6 +94,10 @@ CMD_UNSET_IP6_FWD = 'sysctl -w net.ipv6.conf.{netdevice.device_name}.forwarding=
CMD_SET_IP6_FWD = 'sysctl -w net.ipv6.conf.{netdevice.device_name}.forwarding=1'
CMD_GET_IP6_FWD = 'sysctl -n net.ipv6.conf.{netdevice.device_name}.forwarding'
+DEFAULT_IP4_PREFIX_LEN = 31
+DEFAULT_IP6_PREFIX_LEN = 64
+
+NetDeviceName = String.restrict(max_size = MAX_DEVICE_NAME_SIZE)
#-------------------------------------------------------------------------------
@@ -265,22 +271,20 @@ def parse_ip_addr(data):
#------------------------------------------------------------------------------
-class BaseNetDevice(Interface, Application):
+class NetDevice(Interface, Application):
__type__ = BaseResource
# XXX note: ethtool only required if we need to get the pci address
__package_names__ = ['ethtool']
- device_name = Attribute(String, description = 'Name of the NetDevice',
- default = lambda x : x._default_device_name(),
- max_size = MAX_DEVICE_NAME_SIZE)
+ device_name = Attribute(NetDeviceName, description = 'Name of the NetDevice',
+ default = lambda x : x._default_device_name())
capacity = Attribute(Integer,
- description = 'Capacity for interface shaping (Mb/s)')
+ description = 'Capacity for interface shaping (Mb/s)',
+ default = None)
mac_address = Attribute(String, description = 'Mac address of the device')
- ip4_address = Attribute(String, description = 'IP address of the device')
- ip4_prefix = Attribute(Integer, description = 'Prefix for the IPv4link', default=31) #XXX 31?
- ip6_address = Attribute(String, description = 'IPv6 address of the device')
- ip6_prefix = Attribute(Integer, description = 'Prefix for the IPv6 link', default=64)
+ ip4_address = Attribute(Inet4Address, description = 'IP address of the device')
+ ip6_address = Attribute(Inet6Address, description = 'IPv6 address of the device')
ip6_forwarding = Attribute(Bool, description = 'IPv6 forwarding', default = True)
pci_address = Attribute(String,
description = 'PCI bus address of the device',
@@ -308,6 +312,7 @@ class BaseNetDevice(Interface, Application):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
def __get__(self):
def check(rv):
if not bool(rv):
@@ -315,8 +320,11 @@ class BaseNetDevice(Interface, Application):
return BashTask(self.node, CMD_GET, {'netdevice' : self}, output=True,
parse=check)
- __create__ = None
+ @inherit_parent
+ def __create__(self):
+ return BashTask(self.node, CMD_CREATE, {'netdevice': self})
+ @inherit_parent
def __delete__(self):
return BashTask(self.node, CMD_DELETE, {'netdevice': self})
@@ -369,7 +377,7 @@ class BaseNetDevice(Interface, Application):
if len(ips) > 1:
log.warning('Keeping only first of many IP addresses...')
ip = ips[0]
- attrs['ip4_address'] = ip['ip-address']
+ attrs['ip4_address'] = Inet4Address(ip['ip-address'], DEFAULT_IP4_PREFIX_LEN)
else:
attrs['ip4_address'] = None
return attrs
@@ -413,8 +421,7 @@ class BaseNetDevice(Interface, Application):
if len(ips) > 1:
log.warning('Keeping only first of many IPv6 addresses...')
ip = ips[0]
- attrs['ip6_address'] = ip['ip-address']
- attrs['ip6_prefix'] = ip['prefix']
+ attrs['ip6_address'] = Inet6Address(ip_address = ip['ip-address'], prefix_len = ip['prefix'])
else:
attrs['ip6_address'] = None
return attrs
@@ -457,9 +464,9 @@ class BaseNetDevice(Interface, Application):
return {'up': False}
def _set_up(self):
- up_down = 'up' if self.up else 'down'
+ state = 'up' if self.up else 'down'
return BashTask(self.node, CMD_SET_UP,
- {'netdevice': self, 'up_down': up_down})
+ {'netdevice': self, 'state': state})
@task
def _get_capacity(self):
@@ -526,7 +533,7 @@ class BaseNetDevice(Interface, Application):
#------------------------------------------------------------------------------
-class NonTapBaseNetDevice(BaseNetDevice):
+class NonTapBaseNetDevice(NetDevice):
# Tap devices for instance don't have offload
offload = Attribute(Bool, description = 'Offload', default=True)
@@ -534,59 +541,34 @@ class NonTapBaseNetDevice(BaseNetDevice):
# Attributes
#--------------------------------------------------------------------------
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
-
def _get_offload(self):
return BashTask(self.node, CMD_GET_OFFLOAD, {'netdevice': self},
parse = lambda rv : rv.stdout.strip() == 'on')
def _set_offload(self):
- cmd = None
- if self.offload:
- cmd = CMD_SET_OFFLOAD
- else:
- cmd = CMD_UNSET_OFFLOAD
+ cmd = CMD_SET_OFFLOAD if self.offload else CMD_UNSET_OFFLOAD
return BashTask(self.node, cmd, {'netdevice' : self})
#------------------------------------------------------------------------------
-class NetDevice(NonTapBaseNetDevice):
-
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
-
- def __create__(self):
- return BashTask(self.node, CMD_CREATE, {'netdevice': self})
-
-#------------------------------------------------------------------------------
-
-class SlaveBaseNetDevice(BaseNetDevice):
+class SlaveNetDevice(NetDevice):
parent = Attribute(NetDevice, description = 'Parent NetDevice')
- host = Attribute(NetDevice, description = 'Host interface',
- default = lambda x : x._default_host())
-
- def _default_host(self):
- if self.node.__class__.__name__ == 'LxcContainer':
- host = self.node.node
- else:
- host = self.node
- max_len = MAX_DEVICE_NAME_SIZE - len(self.node.name) - 1
- device_name = self.device_name[:max_len]
-
- return NetDevice(node = host,
- device_name = '{}-{}'.format(self.node.name, device_name),
- managed = False)
-
-#------------------------------------------------------------------------------
-
-class SlaveNetDevice(SlaveBaseNetDevice):
-
- #--------------------------------------------------------------------------
- # Resource lifecycle
- #--------------------------------------------------------------------------
+# host = Attribute(NetDevice, description = 'Host interface',
+# default = lambda x : x._default_host())
+#
+# def _default_host(self):
+# if self.node.__class__.__name__ == 'LxcContainer':
+# host = self.node.node
+# else:
+# host = self.node
+# max_len = MAX_DEVICE_NAME_SIZE - len(self.node.name) - 1
+# device_name = self.device_name[:max_len]
+#
+# return NetDevice(node = host,
+# device_name = '{}-{}'.format(self.node.name, device_name),
+# managed = False)
+ @override_parent
def __create__(self):
return BashTask(self.node, CMD_CREATE_PARENT, {'netdevice': self})
diff --git a/vicn/resource/linux/netmon.py b/vicn/resource/linux/netmon.py
index 8472f308..9c5c97fd 100644
--- a/vicn/resource/linux/netmon.py
+++ b/vicn/resource/linux/netmon.py
@@ -25,5 +25,5 @@ class NetMon(Service):
Generic network monitoring daemon, used internally by VICN for resource
monitoring.
"""
- __package_names__ = ['netmon']
+ __package_names__ = [] # XXX transition 'netmon']
__service_name__ = 'netmon'
diff --git a/vicn/resource/linux/ovs.py b/vicn/resource/linux/ovs.py
index d67e4bca..c0b57151 100644
--- a/vicn/resource/linux/ovs.py
+++ b/vicn/resource/linux/ovs.py
@@ -46,12 +46,12 @@ class OVS(BridgeManager):
#---------------------------------------------------------------------------
def add_bridge(self, bridge_name):
- return BashTask(self.node, CMD_ADD_BRIDGE,
+ return BashTask(self.node, CMD_ADD_BRIDGE,
{'bridge_name': bridge_name},
output = False, as_root = True)
def del_bridge(self, bridge_name):
- return BashTask(self.node, CMD_DEL_BRIDGE,
+ return BashTask(self.node, CMD_DEL_BRIDGE,
{'bridge_name': bridge_name},
output = False, as_root = True)
@@ -62,7 +62,7 @@ class OVS(BridgeManager):
output = False, as_root = True)
def del_interface(self, bridge_name, interface_name, vlan=None):
- return BashTask(self.node, CMD_DEL_INTERFACE,
+ return BashTask(self.node, CMD_DEL_INTERFACE,
{'bridge_name': bridge_name, 'interface_name': interface_name,
'vlan': vlan},
output = False, as_root = True)
diff --git a/vicn/resource/linux/package_manager.py b/vicn/resource/linux/package_manager.py
index 93241502..04a47986 100644
--- a/vicn/resource/linux/package_manager.py
+++ b/vicn/resource/linux/package_manager.py
@@ -19,13 +19,14 @@
import asyncio
import logging
+from netmodel.model.key import Key
from netmodel.model.type import String, Bool
from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.requirement import Requirement
from vicn.core.resource import Resource
from vicn.core.task import BashTask, EmptyTask, async_task
-from vicn.core.task import inline_task, run_task
+from vicn.core.task import inline_task, run_task, inherit_parent
from vicn.resource.node import Node
log = logging.getLogger(__name__)
@@ -78,12 +79,13 @@ class PackageManager(Resource):
reverse_name = 'package_manager',
reverse_auto = True,
mandatory = True,
- key = True,
multiplicity = Multiplicity.OneToOne)
trusted = Attribute(Bool,
description="Force repository trust",
default=False)
+ __key__ = Key(node)
+
#--------------------------------------------------------------------------
# Constructor and Accessors
#--------------------------------------------------------------------------
@@ -100,6 +102,7 @@ class PackageManager(Resource):
def __after__(self):
return ('Repository',)
+ @inherit_parent
@inline_task
def __get__(self):
raise ResourceNotFound
@@ -182,21 +185,25 @@ class Package(Resource):
package_name = Attribute(String, mandatory = True)
node = Attribute(Node,
mandatory = True,
- key = True,
requirements=[
Requirement('package_manager')
])
+ __key__ = Key(node)
+
#---------------------------------------------------------------------------
# Resource lifecycle
#---------------------------------------------------------------------------
+ @inherit_parent
def __get__(self):
return BashTask(self.node, CMD_PKG_TEST, {'self': self})
+ @inherit_parent
def __create__(self):
return self.node.package_manager.__method_install__(self.package_name)
+ @inherit_parent
@async_task
async def __delete__(self):
with await self.node.package_manager._lock:
@@ -218,15 +225,17 @@ class Packages(Resource):
names = Attribute(String, multiplicity = Multiplicity.OneToMany)
node = Attribute(Node,
mandatory = True,
- key = True,
requirements=[
Requirement('package_manager')
])
+ __key__ = Key(node)
+
#---------------------------------------------------------------------------
# Resource lifecycle
#---------------------------------------------------------------------------
+ @inherit_parent
def __subresources__(self):
"""
Note: Although packages are (rightfully) specified concurrent, apt tasks
diff --git a/vicn/resource/linux/phy_interface.py b/vicn/resource/linux/phy_interface.py
index 81d2950c..8d7f02c8 100644
--- a/vicn/resource/linux/phy_interface.py
+++ b/vicn/resource/linux/phy_interface.py
@@ -16,7 +16,8 @@
# limitations under the License.
#
-from netmodel.model.type import String
+from netmodel.model.type import String, Integer
+from netmodel.model.type import Inet4Address, Inet6Address
from vicn.core.attribute import Attribute
from vicn.core.resource import BaseResource
from vicn.resource.interface import Interface
@@ -34,17 +35,6 @@ class PhyInterface(Interface):
mandatory = True)
pci_address = Attribute(String, description = "Device's PCI bus address",
mandatory = True)
- mac_address = Attribute(String, description = "Device's MAC address",
- mandatory=True)
- ip4_address = Attribute(String, description = "Device's IP address")
- ip6_address = Attribute(String, description = "Device's IP address")
-
- #--------------------------------------------------------------------------
- # Constructor and Accessors
- #--------------------------------------------------------------------------
-
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
-
- if not self.name:
- self.name = self.node.name + '-' + self.device_name
+ mac_address = Attribute(String, description = "Device's MAC address")
+ ip4_address = Attribute(Inet4Address, description = "Device's IP address")
+ ip6_address = Attribute(Inet6Address, description = "Device's IP address")
diff --git a/vicn/resource/linux/phy_link.py b/vicn/resource/linux/phy_link.py
index 878cf7c6..2976b7f0 100644
--- a/vicn/resource/linux/phy_link.py
+++ b/vicn/resource/linux/phy_link.py
@@ -16,10 +16,12 @@
# limitations under the License.
#
-from vicn.core.attribute import Attribute
-from vicn.core.task import inline_task
+from vicn.core.attribute import Attribute, Reference
+from vicn.core.task import inline_task, async_task
+from vicn.core.task import inherit_parent
from vicn.resource.channel import Channel
from vicn.resource.linux.phy_interface import PhyInterface
+from vicn.resource.vpp.interface import VPPInterface
class PhyLink(Channel):
"""
@@ -28,12 +30,53 @@ class PhyLink(Channel):
Physical Link to inform the orchestrator about Layer2 connectivity.
"""
- src = Attribute(PhyInterface, description = 'Source interface',
+ src = Attribute(PhyInterface, description = 'Source interface',
mandatory = True)
- dst = Attribute(PhyInterface, description = 'Destination interface',
+ dst = Attribute(PhyInterface, description = 'Destination interface',
mandatory = True)
+ @inherit_parent
@inline_task
def __initialize__(self):
self.src.set('channel', self)
self.dst.set('channel', self)
+
+ #--------------------------------------------------------------------------
+ # Internal methods
+ #--------------------------------------------------------------------------
+
+ async def _commit(self):
+ manager = self._state.manager
+
+ # Disable rp_filtering
+ # self.src.rp_filter = False
+ # self.dst.rp_filter = False
+
+ #XXX VPP
+ vpp_src = VPPInterface(parent = self.src,
+ vpp = self.src.node.vpp,
+ ip4_address = Reference(self.src, 'ip4_address'),
+ ip6_address = Reference(self.src, 'ip6_address'),
+ device_name = self.src.device_name)
+ manager.commit_resource(vpp_src)
+
+
+ vpp_dst = VPPInterface(parent = self.dst,
+ vpp = self.dst.node.vpp,
+ ip4_address = Reference(self.dst, 'ip4_address'),
+ ip6_address = Reference(self.dst, 'ip6_address'),
+ device_name = self.dst.device_name)
+ manager.commit_resource(vpp_dst)
+
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
+ def __get__(self):
+ return async_task(self._commit)()
+
+ def __create__(self):
+ assert self.src.node.get_type() == 'lxccontainer'
+ assert self.dst.node.get_type() == 'lxccontainer'
+
+ return async_task(self._commit)()
diff --git a/vicn/resource/linux/physical.py b/vicn/resource/linux/physical.py
index f71b5856..c058ff16 100644
--- a/vicn/resource/linux/physical.py
+++ b/vicn/resource/linux/physical.py
@@ -29,6 +29,7 @@ from vicn.core.attribute import Attribute
from vicn.core.commands import Command, ReturnValue
from vicn.core.exception import ResourceNotFound, VICNException
from vicn.core.task import Task, task, EmptyTask
+from vicn.core.task import inherit_parent
from vicn.resource.linux.keypair import Keypair
from vicn.resource.node import Node, DEFAULT_USERNAME
from vicn.resource.node import DEFAULT_SSH_PUBLIC_KEY
@@ -71,14 +72,16 @@ class Physical(Node):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
def __subresources__(self):
"""
Require a SSH keypair to be present for authentication on nodes
"""
return Keypair(node = self, key = FN_KEY)
+ @inherit_parent
def __initialize__(self):
- if not is_local_host(self.hostname):
+ if self.managed and not is_local_host(self.hostname):
"""
Initialization require the ssh port to be open on the node, and the ssh
public key to be copied on the remote node.
@@ -124,6 +127,7 @@ class Physical(Node):
p = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE)
if output:
out, err = p.communicate()
+ #print('error {}, output {}'.format(err,out))
return ReturnValue(p.returncode, stdout=out, stderr=err)
p.wait()
diff --git a/vicn/resource/linux/qtplayer.py b/vicn/resource/linux/qtplayer.py
new file mode 100644
index 00000000..44b10ccf
--- /dev/null
+++ b/vicn/resource/linux/qtplayer.py
@@ -0,0 +1,5 @@
+from vicn.resource.linux.application import LinuxApplication
+
+class QtPlayer(LinuxApplication):
+ pass
+
diff --git a/vicn/resource/linux/repository.py b/vicn/resource/linux/repository.py
index cd740d38..f07421ba 100644
--- a/vicn/resource/linux/repository.py
+++ b/vicn/resource/linux/repository.py
@@ -31,14 +31,14 @@ class Repository(Application):
part of any basic distribution install.
"""
- repo_name = Attribute(String, description = 'Name of the repository',
+ repo_name = Attribute(String, description = 'Name of the repository',
default = 'vicn')
- directory = Attribute(String, description = 'Directory holding packages',
+ directory = Attribute(String, description = 'Directory holding packages',
default = '')
sections = Attribute(String, description = 'Sections',
multiplicity = Multiplicity.OneToMany,
default = [])
- distributions = Attribute(String,
+ distributions = Attribute(String,
description = 'List of distributions served by this repository',
multiplicity = Multiplicity.ManyToMany,
default = ['sid', 'trusty', 'xenial'])
diff --git a/vicn/resource/linux/service.py b/vicn/resource/linux/service.py
index 3eb753fc..1143461a 100644
--- a/vicn/resource/linux/service.py
+++ b/vicn/resource/linux/service.py
@@ -21,6 +21,7 @@ import logging
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import CategoryResource
from vicn.core.task import inline_task, BashTask, EmptyTask
+from vicn.core.task import inherit_parent
from vicn.resource.linux.application import LinuxApplication
log = logging.getLogger(__name__)
@@ -51,33 +52,33 @@ class Service(LinuxApplication):
__type__ = CategoryResource
-
+ @inherit_parent
@inline_task
def __get__(self):
raise ResourceNotFound
-
+
def __method_restart__(self):
- return BashTask(self.node, CMD_RESTART,
+ return BashTask(self.node, CMD_RESTART,
{'service_name': self.__service_name__})
-
+
def __method_start__(self):
return BashTask(self.node, CMD_START,
{'service_name': self.__service_name__})
-
- def __create__(self):
- if self.__service_name__ == 'lxd':
- log.warning('Not restarting LXD')
- return EmptyTask()
+ def __method_stop__(self):
+ return BashTask(self.node, CMD_STOP,
+ {'service_name': self.__service_name__})
- if self.__service_name__ == 'dnsmasq':
- return BashTask(self.node, CMD_STOP_START,
- {'service_name': self.__service_name__})
+ def __method_stop_start(self):
+ return BashTask(self.node, CMD_STOP_START,
+ {'service_name': self.__service_name__})
+ @inherit_parent
+ def __create__(self):
return self.__method_restart__()
-
+ @inherit_parent
def __delete__(self):
- return BashTask(self.node, CMD_STOP,
+ return BashTask(self.node, CMD_STOP,
{'service_name': self.__service_name__})
diff --git a/vicn/resource/linux/sym_veth_pair.py b/vicn/resource/linux/sym_veth_pair.py
index bf79a69b..ebfe2968 100644
--- a/vicn/resource/linux/sym_veth_pair.py
+++ b/vicn/resource/linux/sym_veth_pair.py
@@ -26,12 +26,12 @@ from vicn.core.resource import Resource
from vicn.core.state import ResourceState, AttributeState
from vicn.core.task import BashTask, get_attributes_task
from vicn.core.task import async_task, task, inline_task
-from vicn.core.task import run_task
+from vicn.core.task import run_task, inherit_parent
from vicn.resource.interface import Interface
from vicn.resource.node import Node
from vicn.resource.linux.net_device import NonTapBaseNetDevice
from vicn.resource.linux.link import CMD_DELETE_IF_EXISTS
-from vicn.resource.linux.link import CMD_UP
+from vicn.resource.linux.link import CMD_SET_UP
CMD_CREATE='''
# Create veth pair in the host node
@@ -48,13 +48,13 @@ class SymVethPair(Resource):
resource is that is it not a channel.
"""
- node1 = Attribute(Node,
+ node1 = Attribute(Node,
description = 'Node on which one side of the veth will sit',
mandatory = True)
- node2 = Attribute(Node,
+ node2 = Attribute(Node,
description = 'Node on which the other side of the veth will sit',
mandatory = True)
- capacity = Attribute(Integer,
+ capacity = Attribute(Integer,
description = 'Capacity of the veth pair (Mb/s)')
side1 = Attribute(Interface, description = 'Source interface')
side2 = Attribute(Interface, description = 'Destination interface')
@@ -66,21 +66,22 @@ class SymVethPair(Resource):
async def _commit(self):
# see link.py for explanations
manager = self._state.manager
- await manager._set_resource_state(self.side1,
+ await manager._set_resource_state(self.side1,
ResourceState.INITIALIZED)
- await manager._set_resource_state(self.side2,
+ await manager._set_resource_state(self.side2,
ResourceState.INITIALIZED)
await manager._set_resource_state(self.side1, ResourceState.CREATED)
await manager._set_resource_state(self.side2, ResourceState.CREATED)
await manager._set_attribute_state(self, 'side1', AttributeState.CLEAN)
await manager._set_attribute_state(self, 'side2', AttributeState.CLEAN)
manager.commit_resource(self.side1)
- manager.commit_resource(self.side2)
+ manager.commit_resource(self.side2)
#--------------------------------------------------------------------------
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
@inline_task
def __initialize__(self):
self.side1 = NonTapBaseNetDevice(node = self.node1,
@@ -94,6 +95,7 @@ class SymVethPair(Resource):
self.side1.remote = self.side2
self.side2.remote = self.side1
+ @inherit_parent
@async_task
async def __get__(self):
manager = self._state.manager
@@ -106,46 +108,48 @@ class SymVethPair(Resource):
await self._commit()
+ @inherit_parent
def __create__(self):
assert self.node1.get_type() == 'lxccontainer'
assert self.node2.get_type() == 'lxccontainer'
-
+
node1_host = self.node1.node
node2_host = self.node2.node
-
+
assert node1_host == node2_host
host = node1_host
-
+
# Sometimes a down interface persists on one side
- delif_side1 = BashTask(self.node1, CMD_DELETE_IF_EXISTS,
+ delif_side1 = BashTask(self.node1, CMD_DELETE_IF_EXISTS,
{'interface': self.side1})
- delif_side2 = BashTask(self.node2, CMD_DELETE_IF_EXISTS,
+ delif_side2 = BashTask(self.node2, CMD_DELETE_IF_EXISTS,
{'interface': self.side2})
-
+
pid_node1 = get_attributes_task(self.node1, ['pid'])
pid_node2 = get_attributes_task(self.node2, ['pid'])
-
+
tmp_side1 = 'tmp-veth-' + ''.join(random.choice(
string.ascii_uppercase + string.digits) for _ in range(5))
tmp_side2 = 'tmp-veth-' + ''.join(random.choice(
string.ascii_uppercase + string.digits) for _ in range(5))
-
- create = BashTask(host, CMD_CREATE,
+
+ create = BashTask(host, CMD_CREATE,
{'side1_device_name': self.side1.device_name,
- 'side2_device_name': self.side2.device_name,
+ 'side2_device_name': self.side2.device_name,
'tmp_side1': tmp_side1, 'tmp_side2': tmp_side2})
-
- up_side1 = BashTask(self.node1, CMD_UP, {'interface': self.side1})
- up_side2 = BashTask(self.node2, CMD_UP, {'interface': self.side2})
-
+
+ up_side1 = BashTask(self.node1, CMD_SET_UP, {'interface': self.side1})
+ up_side2 = BashTask(self.node2, CMD_SET_UP, {'interface': self.side2})
+
@async_task
async def set_state():
await self._commit()
-
+
delif = delif_side1 | delif_side2
up = up_side1 | up_side2
pid = pid_node1 | pid_node2
return ((delif > (pid @ create)) > up) > set_state()
-
+
+ @inherit_parent
def __delete__(self):
raise NotImplementedError
diff --git a/vicn/resource/linux/tap_device.py b/vicn/resource/linux/tap_device.py
index b7c9f967..88ca055d 100644
--- a/vicn/resource/linux/tap_device.py
+++ b/vicn/resource/linux/tap_device.py
@@ -18,39 +18,22 @@
from netmodel.model.type import String
from vicn.core.attribute import Attribute
-from vicn.core.task import BashTask
-from vicn.resource.linux.net_device import BaseNetDevice, IPV4, IPV6, CMD_FLUSH_IP
+from vicn.core.task import BashTask, override_parent
+from vicn.resource.linux.net_device import NetDevice, IPV4, IPV6, CMD_FLUSH_IP
CMD_CREATE='ip tuntap add name {netdevice.device_name} mode tap'
-#CMD_SET_IP_ADDRESS='ip -{version} addr add dev {netdevice.device_name} 0.0.0.0'
-class TapDevice(BaseNetDevice):
+class TapDevice(NetDevice):
def __init__(self, *args, **kwargs):
super().__init__(self, *args, **kwargs)
self.prefix = 'tap'
self.netdevice_type = 'tap'
+ @override_parent
def __create__(self):
return BashTask(self.node, CMD_CREATE, {'netdevice': self})
-##mengueha: do we actually need that?
-# def _set_ip4_address(self):
-# if self.ip4_address is None:
-# # Unset IP
-# return BashTask(self.node, CMD_FLUSH_IP,
-# {'device_name': self.device_name})
-# return BashTask(self.node, CMD_SET_IP_ADDRESS,
-# {'netdevice': self})
-#
-# def _set_ip6_address(self):
-# if self.ip6_address is None:
-# # Unset IP
-# return BashTask(self.node, CMD_FLUSH_IP,
-# {'ip_version': IPV6, 'device_name': self.device_name})
-# return BashTask(self.node, CMD_SET_IP_ADDRESS,
-# {'netdevice': self})
-
class TapChannel(TapDevice):
station_name = Attribute(String)
channel_name = Attribute(String)
diff --git a/vicn/resource/linux/veth_pair.py b/vicn/resource/linux/veth_pair.py
index 53fa9bf8..52050074 100644
--- a/vicn/resource/linux/veth_pair.py
+++ b/vicn/resource/linux/veth_pair.py
@@ -15,48 +15,82 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-import random
-import string
-from vicn.resource.linux.net_device import SlaveBaseNetDevice
-from vicn.core.task import BashTask, get_attributes_task
-
-# ip link add veth0 type veth peer name veth1
+from netmodel.model.key import Key
+from netmodel.model.type import String, Bool
+from vicn.core.attribute import Attribute, Reference
+from vicn.core.task import BashTask, inline_task, get_attributes_task
+from vicn.resource.linux.net_device import NetDevice, NetDeviceName
+from vicn.resource.node import Node
+from vicn.resource.symmetric_channel import SymmetricChannel
CMD_CREATE='''
# Create veth pair in the host node
-ip link add name {interface.host.device_name} type veth peer name {tmp_name}
+ip link add name {self.device_name} type veth peer name {self.peer_device_name}
+'''
+
+DEPRECATED_CMD_UP='''
# The host interface will always be up...
ip link set dev {interface.host.device_name} up
+
# Move interface into container and rename it
ip link set dev {tmp_name} netns {pid} name {interface.device_name}
-'''
-CMD_UP='''
ip link set dev {interface.device_name} up
'''
-# see:
-# http://stackoverflow.com/questions/22780927/lxc-linux-containers-add-new-network-interface-without-restarting
+# Forward declaration
+class VethPair(SymmetricChannel):
+ pass
+
+class VethNetDevice(NetDevice):
+ parent = Attribute(VethPair, mandatory = True, ro = True)
-class VethPair(SlaveBaseNetDevice):
- # Do not need the parent attribute...
+ __get__ = None
+ __create__ = None
+ __delete__ = None
- def __init__(self, *args, **kwargs):
- super().__init__(self, *args, **kwargs)
- self.prefix = 'veth'
- self.netdevice_type = 'veth'
+class VethPair(SymmetricChannel):
+ # Mimics NetDevice for using its __get__ and __delete__ functions
+ node = Attribute(Node)
+ device_name = Attribute(NetDeviceName)
+ peer_device_name = Attribute(NetDeviceName)
+ capacity = Attribute(String)
+ src = Attribute(ro = True, mandatory = False)
+ dst = Attribute(ro = True, mandatory = False)
+ auto_commit = Attribute(Bool, description = 'Auto commit interfaces')
+
+ __key1__ = Key(node, device_name)
+ __key2__ = Key(node, peer_device_name)
+
+ @inline_task
+ def _commit(self):
+ if self.auto_commit:
+ manager = self._state.manager
+
+ manager.commit_resource(self.src)
+ manager.commit_resource(self.dst)
+
+ def __initialize__(self):
+ # XXX owner prevents the resource to be committed
+ self.src = VethNetDevice(node = self.node,
+ parent = self,
+ device_name = self.device_name,
+ channel = self,
+ capacity = Reference(self, 'capacity'),
+ owner = self)
+ self.dst = VethNetDevice(node = self.node,
+ parent = self,
+ device_name = self.peer_device_name,
+ channel = self,
+ capacity = Reference(self, 'capacity'),
+ owner = self)
def __create__(self):
- assert self.node.__class__.__name__ == 'LxcContainer'
- host = self.node.node
- pid = get_attributes_task(self.node, ['pid'])
- tmp_name = 'tmp-veth-' + ''.join(random.choice(string.ascii_uppercase \
- + string.digits) for _ in range(5))
- create = BashTask(host, CMD_CREATE, {'tmp_name': tmp_name,
- 'interface': self})
- up = BashTask(self.node, CMD_UP, {'interface': self})
- bridge = host.bridge_manager.add_interface(host.bridge.device_name,
- self.host.device_name)
- return ((pid @ create) > up) > bridge
-
- # ... IP and UP missing...
+ veth = BashTask(self.node, CMD_CREATE, {'self': self})
+ return (veth > super().__create__()) > self._commit()
+
+ def __get__(self):
+ return NetDevice.__get__(self) > self._commit()
+
+ def __delete__(self):
+ return NetDevice.__delete__(self)
diff --git a/vicn/resource/linux/veth_pair_lxc.py b/vicn/resource/linux/veth_pair_lxc.py
new file mode 100644
index 00000000..dd26b7bb
--- /dev/null
+++ b/vicn/resource/linux/veth_pair_lxc.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+import random
+import string
+
+from vicn.core.attribute import Attribute
+from vicn.resource.linux.net_device import NetDevice, SlaveNetDevice
+from vicn.core.task import BashTask, get_attributes_task
+from vicn.core.task import override_parent
+from vicn.core.attribute import Attribute
+
+# ip link add veth0 type veth peer name veth1
+
+CMD_CREATE='''
+# Create veth pair in the host node
+ip link add name {interface.host.device_name} type veth peer name {tmp_name}
+# The host interface will always be up...
+ip link set dev {interface.host.device_name} up
+# Move interface into container and rename it
+ip link set dev {tmp_name} netns {pid} name {interface.device_name}
+'''
+CMD_UP='''
+ip link set dev {interface.device_name} up
+'''
+
+# see:
+# http://stackoverflow.com/questions/22780927/lxc-linux-containers-add-new-network-interface-without-restarting
+
+class VethPairLxc(SlaveNetDevice):
+
+ host = Attribute(NetDevice, description = 'Host interface',
+ default = lambda x : x._default_host())
+
+ def _default_host(self):
+ if self.node.__class__.__name__ == 'LxcContainer':
+ host = self.node.node
+ else:
+ host = self.node
+ max_len = MAX_DEVICE_NAME_SIZE - len(self.node.name) - 1
+ device_name = self.device_name[:max_len]
+
+ return NetDevice(node = host,
+ device_name = '{}-{}'.format(self.node.name, device_name),
+ managed = False)
+
+ def __create__(self):
+ assert self.node.__class__.__name__ == 'LxcContainer'
+ host = self.node.node
+ pid = get_attributes_task(self.node, ['pid'])
+ tmp_name = 'tmp-veth-' + ''.join(random.choice(string.ascii_uppercase \
+ + string.digits) for _ in range(5))
+ create = BashTask(host, CMD_CREATE, {'tmp_name': tmp_name,
+ 'interface': self})
+ up = BashTask(self.node, CMD_UP, {'interface': self})
+ bridge = host.bridge_manager.add_interface(host.bridge.device_name,
+ self.host.device_name)
+ return ((pid @ create) > up) > bridge
+
+ # ... IP and UP missing...
diff --git a/vicn/resource/lxd/lxc_container.py b/vicn/resource/lxd/lxc_container.py
index 8c8b4816..5b1d4e3b 100644
--- a/vicn/resource/lxd/lxc_container.py
+++ b/vicn/resource/lxd/lxc_container.py
@@ -32,9 +32,11 @@ from vicn.core.exception import ResourceNotFound
from vicn.core.requirement import Requirement
from vicn.core.resource_mgr import wait_resource_task
from vicn.core.task import task, inline_task, BashTask, EmptyTask
+from vicn.core.task import inherit_parent
from vicn.resource.linux.net_device import NetDevice
from vicn.resource.node import Node
from vicn.resource.vpp.scripts import APPARMOR_VPP_PROFILE
+from vicn.resource.lxd.lxc_image import LxcImage
from vicn.resource.lxd.lxd_profile import LXD_PROFILE_DEFAULT_IFNAME
log = logging.getLogger(__name__)
@@ -54,9 +56,20 @@ CMD_GET_IP6_FWD = 'sysctl -n net.ipv6.conf.all.forwarding'
CMD_NETWORK_DHCP='dhclient {container.management_interface.device_name}'
+CMD_MOUNT_FOLDER='''
+lxc config device add {container.name} {device-name} disk source={host_path} path={container_path}
+sleep 1
+'''
+
# Type: ContainerName
-ContainerName = String(max_size = 64, ascii = True,
- forbidden = ('/', ',', ':'))
+# https://github.com/lxc/lxd/issues/1431
+# [...] all container names must be a valid hostname under the most
+#restrictive definition of this, that is, maximum 63 characters, may not contain
+#dots, may not start by a digit or dash, may not end by a dash and must be made
+#entirely of letters, digits or hyphens.
+# XXX better have a allowed property
+ContainerName = String.restrict(max_size = 63, ascii = True,
+ forbidden = ('/', ',', ':', '_'))
class LxcContainer(Node):
"""
@@ -93,9 +106,9 @@ class LxcContainer(Node):
])
profiles = Attribute(String, multiplicity = Multiplicity.OneToMany,
default = ['vicn'])
- image = Attribute(String, description = 'image', default = None)
- is_image = Attribute(Bool, defaut = False)
- pid = Attribute(Integer, description = 'PID of the container')
+ image = Attribute(LxcImage, description = 'image', default = None)
+ is_image = Attribute(Bool, default = False)
+ pid = Attribute(Integer, description = 'PID of the container', ro = True)
ip6_forwarding = Attribute(Bool, default=True)
#--------------------------------------------------------------------------
@@ -110,6 +123,7 @@ class LxcContainer(Node):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
@inline_task
def __initialize__(self):
"""
@@ -128,6 +142,7 @@ class LxcContainer(Node):
if iface.get_type() == "dpdkdevice":
self.node.vpp_host.dpdk_devices.append(iface.pci_address)
+ @inherit_parent
@task
def __get__(self):
client = self.node.lxd_hypervisor.client
@@ -136,6 +151,7 @@ class LxcContainer(Node):
except pylxd.exceptions.NotFound:
raise ResourceNotFound
+ @inherit_parent
def __create__(self):
"""
Make sure vpp_host is instanciated before starting the container.
@@ -153,6 +169,7 @@ class LxcContainer(Node):
def _create_container(self):
container = self._get_container_description()
log.debug('Container description: {}'.format(container))
+ print('Container description: {}'.format(container))
client = self.node.lxd_hypervisor.client
self._container = client.containers.create(container, wait=True)
@@ -188,13 +205,13 @@ class LxcContainer(Node):
# SOURCE
image_names = [alias['name'] for alias in self.node.lxd_hypervisor.aliases]
- image_exists = self.image is not None and self.image in image_names
+ image_exists = self.image.image is not None and self.image.image in image_names
if image_exists:
container['source'] = {
'type' : 'image',
'mode' : 'local',
- 'alias' : self.image,
+ 'alias' : self.image.image,
}
else:
container['source'] = {
@@ -234,6 +251,7 @@ class LxcContainer(Node):
Method: Start the container
"""
self._container.start(wait = True)
+ import time; time.sleep(1)
@task
def __method_stop__(self):
@@ -288,10 +306,35 @@ class LxcContainer(Node):
"""
if not self._container:
- log.error("Executing command on uninitialized container", self, command)
+ log.error("Executing command on uninitialized container {} {}".format(self, command))
import os; os._exit(1)
- ret = self._container.execute(shlex.split(command))
+ if 'vppctl_wrapper' in command:
+ vpp_log = '{}/vpp-{}.sh'.format(self._state.manager._base, self.name)
+ with open(vpp_log, 'a') as f:
+ print("lxc exec {} -- {}".format(self.name, command), file=f)
+
+ # XXX Workaround: pylxd 2.2.3 buggy (w/ lxd 2.14) ?
+ # But this workaround is broken with lxd 2.15 and pylxd 2.2.4 works
+ # lxc exec freezes
+ #return self.node.execute('lxc exec {} -- {}'.format(self.name, command),
+ # output = output, as_root = as_root)
+
+ print("lxc exec {} -- {}".format(self.name, command))
+ while True:
+ try:
+ ret = self._container.execute(shlex.split(command))
+ break
+ except pylxd.exceptions.NotFound:
+ print("=====> pylxd not found during {}".format(command))
+ time.sleep(1)
+ except pylxd.exceptions.ClientConnectionFailed:
+ print("=====> pylxd connection failed during {}".format(command))
+ time.sleep(1)
+ except requests.exceptions.SSLError:
+ print("=====> ssl error during {}".format(command))
+ time.sleep(1)
+
# NOTE: pylxd documents the return value as a tuple, while it is in
# fact a ContainerExecuteResult object
@@ -306,12 +349,8 @@ class LxcContainer(Node):
return ReturnValue(*args)
def _get_ip6_forwarding(self):
- def parse(rv):
- ret = {"ip6_forwarding" : False}
- if rv.stdout == "1":
- ret["ip6_forwarding"] = True
- return ret
- return BashTask(self, CMD_GET_IP6_FWD, parse=parse)
+ return BashTask(self, CMD_GET_IP6_FWD,
+ parse = lambda rv: {'ip6_forwarding' : rv.stdout == "1"})
def _set_ip6_forwarding(self):
cmd = CMD_SET_IP6_FWD if self.ip6_forwarding else CMD_UNSET_IP6_FWD
diff --git a/vicn/resource/lxd/lxc_image.py b/vicn/resource/lxd/lxc_image.py
index a3a03245..f630fe2f 100644
--- a/vicn/resource/lxd/lxc_image.py
+++ b/vicn/resource/lxd/lxc_image.py
@@ -24,7 +24,7 @@ from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.requirement import Requirement
from vicn.core.resource import Resource
-from vicn.core.task import task, inline_task
+from vicn.core.task import task, inline_task, inherit_parent
from vicn.resource.linux.application import LinuxApplication as Application
from vicn.resource.node import Node
@@ -56,8 +56,11 @@ class LxcImage(Resource):
# Resource lifecycle
#---------------------------------------------------------------------------
+ @inherit_parent
@task
def __get__(self):
+ log.warning('Image test is currently disabled')
+ return
aliases = [alias['name'] for images in self.node.lxd_hypervisor.client.images.all()
for alias in images.aliases]
if not self.image in aliases:
@@ -69,6 +72,7 @@ class LxcImage(Resource):
return
+ @inherit_parent
@task
def __create_DISABLED__(self):
"""
@@ -97,6 +101,7 @@ class LxcImage(Resource):
tmp_container.delete()
+ @inherit_parent
@task
def __delete__(self):
self.node.lxd_hypervisor.client.images.delete(self.name)
diff --git a/vicn/resource/lxd/lxd_certificate_store.py b/vicn/resource/lxd/lxd_certificate_store.py
new file mode 100644
index 00000000..97a8cada
--- /dev/null
+++ b/vicn/resource/lxd/lxd_certificate_store.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from vicn.core.attribute import Attribute, Multiplicity
+from vicn.core.resource import Resource
+from vicn.resource.linux.certificate import Certificate
+from vicn.resource.node import Node
+
+PACKAGE = 'ca-certificates'
+
+CMD_ADD_CERTIFICATE = 'cp {certificate.cert} {store.PATH}'
+
+class LxdCertificateStore(Resource):
+ """
+ Resource: System-wide Certificate Store
+
+ This resource allows manipulation of the trusted certificates on the system.
+ Use with care.
+
+ See. vicn.resource.linux.certificate_store
+ """
+
+ PATH = '~/.config/lxc/servercerts/'
+
+ certificates = Attribute(Certificate, multiplicity = Multiplicity.OneToMany)
+ node = Attribute(Node, mandatory = True, requirements = [
+ #Requirement(PACKAGE, 'in', 'packages')
+ ])
+
+ def _add_certificate(self):
+ # Return a task that takes a certificate as parameter
+ PARAM = None
+ return BashTask(self.node, CMD_ADD_CERTIFICATE, {'store': self, 'certificate': PARAM})
diff --git a/vicn/resource/lxd/lxd_hypervisor.py b/vicn/resource/lxd/lxd_hypervisor.py
index bbdba7c6..fa63b96b 100644
--- a/vicn/resource/lxd/lxd_hypervisor.py
+++ b/vicn/resource/lxd/lxd_hypervisor.py
@@ -16,15 +16,6 @@
# limitations under the License.
#
-#-------------------------------------------------------------------------------
-# NOTES
-#-------------------------------------------------------------------------------
-# - lxd >= 2.0.4 is required
-# daemon/container: Remember the return code in the non wait-for-websocket
-# case (Issue #2243)
-# - Reference: https://github.com/lxc/lxd/tree/master/doc
-#-------------------------------------------------------------------------------
-
import logging
import os
from pylxd import Client
@@ -34,7 +25,8 @@ from netmodel.model.type import String, Integer
from vicn.core.attribute import Attribute, Multiplicity, Reference
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import Resource
-from vicn.core.task import BashTask, task
+from vicn.core.task import EmptyTask, BashTask, task
+from vicn.core.task import inherit_parent, override_parent
from vicn.resource.linux.application import LinuxApplication as Application
from vicn.resource.linux.service import Service
from vicn.resource.linux.certificate import Certificate
@@ -74,10 +66,12 @@ CMD_LXD_NETWORK_SET = 'lxc network create {lxd_hypervisor.network} || true'
class LxdInit(Application):
__package_names__ = ['lxd', 'zfsutils-linux', 'lsof']
+ @inherit_parent
def __get__(self):
return BashTask(self.owner.node, CMD_LXD_CHECK_INIT,
{'lxd': self.owner})
+ @inherit_parent
def __create__(self):
cmd_params = {
'storage-backend' : self.owner.storage_backend,
@@ -107,12 +101,14 @@ class LxdInit(Application):
# zfs-dkms in the host
return BashTask(self.owner.node, cmd, as_root = True)
+ @inherit_parent
def __delete__(self):
raise NotImplementedError
class LxdInstallCert(Resource):
certificate = Attribute(Certificate, mandatory = True)
+ @inherit_parent
@task
def __get__(self):
try:
@@ -126,6 +122,7 @@ class LxdInstallCert(Resource):
raise ResourceNotFound
+ @inherit_parent
@task
def __create__(self):
"""
@@ -140,6 +137,8 @@ class LxdInstallCert(Resource):
#------------------------------------------------------------------------------
+LxdStorageType = String.restrict(choices=('zfs'))
+
class LxdHypervisor(Service):
"""
Resource: LxdHypervisor
@@ -150,9 +149,8 @@ class LxdHypervisor(Service):
lxd_port = Attribute(Integer, description = 'LXD REST API port',
default = 8443)
- storage_backend = Attribute(String, description = 'Storage backend',
- default = 'zfs',
- choices = ['zfs'])
+ storage_backend = Attribute(LxdStorageType, description = 'Storage backend',
+ default = 'zfs')
storage_size = Attribute(Integer, description = 'Storage size',
default = LXD_STORAGE_SIZE_DEFAULT) # GB
zfs_pool = Attribute(String, description = 'ZFS pool',
@@ -190,6 +188,7 @@ class LxdHypervisor(Service):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
def __subresources__(self):
lxd_init = LxdInit(owner=self, node = self.node)
lxd_local_cert = Certificate(node = Reference(self, 'node'),
@@ -208,6 +207,11 @@ class LxdHypervisor(Service):
return (lxd_init | lxd_local_cert) > (lxd_vicn_profile | lxd_cert_install)
+ @override_parent
+ def __create__(self):
+ log.warning('Not restarting LXD')
+ return EmptyTask()
+
#--------------------------------------------------------------------------
# Private methods
#--------------------------------------------------------------------------
diff --git a/vicn/resource/lxd/lxd_profile.py b/vicn/resource/lxd/lxd_profile.py
index db871671..e8e022d4 100644
--- a/vicn/resource/lxd/lxd_profile.py
+++ b/vicn/resource/lxd/lxd_profile.py
@@ -19,7 +19,7 @@
from vicn.core.resource import Resource
from netmodel.model.type import String
from vicn.core.attribute import Attribute, Multiplicity
-from vicn.core.task import BashTask
+from vicn.core.task import BashTask, inherit_parent
from vicn.core.exception import ResourceNotFound
CMD_LXD_PROFILE_CREATE = '''
@@ -41,18 +41,20 @@ LXD_PROFILE_DEFAULT_IFNAME = 'vicn_mgmt'
class LxdProfile(Resource):
- description = Attribute(String, descr="profile description", mandatory=True)
- pool = Attribute(String, descr="ZFS pool used by the containers", mandatory=True)
- network = Attribute(String, description='Network on which to attach', mandatory=True)
- iface_name = Attribute(String, description='Default interface name',
+ description = Attribute(String, description = "profile description", mandatory=True)
+ pool = Attribute(String, description = "ZFS pool used by the containers", mandatory=True)
+ network = Attribute(String, description = 'Network on which to attach', mandatory=True)
+ iface_name = Attribute(String, description = 'Default interface name',
default = LXD_PROFILE_DEFAULT_IFNAME)
node = Attribute(Resource, mandatory=True)
+ @inherit_parent
def __get__(self):
def parse(rv):
if not rv.stdout:
raise ResourceNotFound
return BashTask(self.node, CMD_LXD_PROFILE_GET, {'profile':self}, parse=parse)
+ @inherit_parent
def __create__(self):
return BashTask(self.node, CMD_LXD_PROFILE_CREATE, {'profile':self})
diff --git a/vicn/resource/lxd/lxd_remote.py b/vicn/resource/lxd/lxd_remote.py
new file mode 100644
index 00000000..b5f8454a
--- /dev/null
+++ b/vicn/resource/lxd/lxd_remote.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from vicn.core.resource import Resource
+from netmodel.model.type import String, Bool
+from vicn.core.attribute import Attribute, Multiplicity
+from vicn.core.task import BashTask, EmptyTask, inherit_parent
+from vicn.core.exception import ResourceNotFound
+
+# From LXD 2.14
+#
+# lxc remote add [<remote>] <IP|FQDN|URL> [--accept-certificate] [--password=PASSWORD] [--public] [--protocol=PROTOCOL]
+# lxc remote remove <remote>
+# lxc remote list
+# lxc remote rename <old name> <new name>
+# lxc remote set-url <remote> <url>
+# lxc remote set-default <remote>
+# lxc remote get-default
+
+CMD_GET = 'lxc remote list | grep {remote.name}'
+
+CMD_CREATE = 'lxc remote add {remote.name} {remote.url}{public}'
+CMD_CREATE += ' --protocol {remote.protocol}'
+
+CMD_DELETE = 'lxc remote remove {remote.name}'
+
+CMD_SET_URL = 'lxc remote set-url {remote.name} {remote.url}'
+
+CMD_GET_DEFAULT = 'lxc remote get-default'
+CMD_SET_DEFAULT = 'lxc remote set-default {remote.name}'
+
+LxdProtocol = String.restrict(choices = ('simplestreams', 'lxd'))
+
+class LxdRemote(Resource):
+ # name (inherited)
+ url = Attribute(String, mandatory = True)
+ protocol = Attribute(LxdProtocol, default='lxd')
+ public = Attribute(Bool, default = True)
+ static = Attribute(Bool, default = False)
+ default = Attribute(Bool, default = False)
+
+ # Used to identify the LXD instance
+ node = Attribute(Resource, mandatory=True)
+
+ @inherit_parent
+ def __get__(self):
+ def parse(rv):
+ if not rv.stdout:
+ raise ResourceNotFound
+ return {
+ 'url': self.url,
+ 'protocol': self.protocol,
+ 'public': self.public,
+ 'static': self.static,
+ 'default': self.default,
+ }
+ return BashTask(self.node, CMD_GET, {'remote': self}, parse = parse)
+
+ @inherit_parent
+ def __create__(self):
+ public = ' --public' if self.public else ''
+ return BashTask(self.node, CMD_CREATE, {'remote': self, 'public': public})
+
+ @inherit_parent
+ def __delete__(self):
+ return BashTask(self.node, CMD_DELETE, {'remote': self})
+
+ def _get_url(self):
+ return None
+
+ def _set_url(self):
+ return BashTask(self.node, CMD_SET_URL, {'remote': self})
+
+ def _get_default(self):
+ def parse(rv):
+ return {'default': rv.stdout == self.name}
+ return BashTask(self.node, CMD_GET_DEFAULT, {'remote': self},
+ parse = parse)
+
+ def _set_default(self):
+ if self.default:
+ return BashTask(self.node, CMD_SET_DEFAULT, {'remote': self})
+ else:
+ return EmptyTask()
diff --git a/vicn/resource/node.py b/vicn/resource/node.py
index c785e32b..3805677e 100644
--- a/vicn/resource/node.py
+++ b/vicn/resource/node.py
@@ -32,6 +32,10 @@ DEFAULT_SSH_PRIVATE_KEY = os.path.expanduser(os.path.join(
DEFAULT_SSH_PUBLIC_KEY = os.path.expanduser(os.path.join(
'~', '.vicn', 'ssh_client_cert', 'ssh_client_key.pub'))
+OS = String.restrict(choices=('debian', 'ubuntu'))
+Distribution = String.restrict(choices=('trusty', 'xenial', 'sid'))
+Architecture = String.restrict(choices=('amd64'))
+
class Node(Resource):
"""
Resource: Node
@@ -42,15 +46,13 @@ class Node(Resource):
y = Attribute(Double, description = 'Y coordinate',
default = 0.0)
category = Attribute(String)
- os = Attribute(String, description = 'OS',
- default = 'ubuntu',
- choices = ['debian', 'ubuntu'])
- dist = Attribute(String, description = 'Distribution name',
- default = 'xenial',
- choices = ['trusty', 'xenial', 'sid'])
- arch = Attribute(String, description = 'Architecture',
- default = 'amd64',
- choices = ['amd64'])
+ scale = Attribute(Double, default = 1)
+ os = Attribute(OS, description = 'OS',
+ default = 'ubuntu')
+ dist = Attribute(Distribution, description = 'Distribution name',
+ default = 'xenial')
+ arch = Attribute(Architecture, description = 'Architecture',
+ default = 'amd64')
node_with_kernel = Attribute(Self,
description = 'Node on which the kernel sits',
ro = True)
diff --git a/vicn/resource/ns3/emulated_channel.py b/vicn/resource/ns3/emulated_channel.py
index 5f61960c..3c090a9e 100644
--- a/vicn/resource/ns3/emulated_channel.py
+++ b/vicn/resource/ns3/emulated_channel.py
@@ -16,30 +16,33 @@
# limitations under the License.
#
+import functools
import logging
import random
+from netmodel.model.key import Key
from netmodel.model.type import Integer
from netmodel.util.socket import check_port
from vicn.core.address_mgr import AddressManager
-from vicn.core.attribute import Attribute, Multiplicity
+from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.requirement import Requirement
from vicn.core.resource import BaseResource
from vicn.core.resource_mgr import wait_resources
from vicn.core.task import inline_task, async_task, task
from vicn.core.task import BashTask, run_task
+from vicn.core.task import inherit_parent
from vicn.resource.channel import Channel
-from vicn.resource.linux.application import LinuxApplication as Application
+from vicn.resource.linux.application import LinuxApplication
from vicn.resource.linux.net_device import NetDevice
from vicn.resource.linux.tap_device import TapDevice
-from vicn.resource.linux.veth_pair import VethPair
+from vicn.resource.linux.veth_pair_lxc import VethPairLxc
from vicn.resource.lxd.lxc_container import LxcContainer
from vicn.resource.node import Node
log = logging.getLogger(__name__)
-class EmulatedChannel(Channel, Application):
+class EmulatedChannel(Channel, LinuxApplication):
"""EmulatedChannel resource
This resources serves as a base class for wireless channels emulated by
@@ -56,7 +59,7 @@ class EmulatedChannel(Channel, Application):
traffic and prevent loops on the bridge.
- We also need that all interfaces related to ap and stations are created
before we run the commandline (currently, dynamically adding/removing
- AP and stations is not supported by the emulator). This is made
+ AP and stations is not supported by the emulator). This is made
possible thanks to the key=True parameter, which makes sure the
attributes are processed before the __create__ is called.
@@ -66,11 +69,15 @@ class EmulatedChannel(Channel, Application):
__resource_type__ = BaseResource
- ap = Attribute(Node, description = 'AP', key = True)
+ ap = Attribute(Node, description = 'AP')
stations = Attribute(Node, description = 'List of stations',
- multiplicity = Multiplicity.OneToMany, key = True)
+ multiplicity = Multiplicity.OneToMany)
control_port = Attribute(Integer,
description = 'Control port for the simulation')
+ nb_base_stations = Attribute(Integer, description='Number of nodes emulated by the AP',
+ default=1)
+
+ __key__ = Key(ap, stations)
# Overloaded attributes
node = Attribute(requirements = [
@@ -101,20 +108,29 @@ class EmulatedChannel(Channel, Application):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
+ def __initialize__(self):
+ return self.__set_ap() > self.__set_stations()
+
+ @inherit_parent
@inline_task
def __get__(self):
raise ResourceNotFound
+
+ @inherit_parent
def __create__(self):
# NOTE: http://stackoverflow.com/questions/21141352/python-subprocess-
# calling-a-script-which-runs-a-background-process-hanging
# The output of the background scripts is still going to the same file
# descriptor as the child script, thus the parent script waits for it
# to finish.
- cmd = '(' + self.__app_name__ + ' ' + self._get_cmdline_params() + \
- '>/dev/null 2>&1) &'
- return BashTask(self.node, cmd)
+ def get_cmdline(channel):
+ return '(' + channel.__app_name__ + ' ' + \
+ channel._get_cmdline_params() + '>/dev/null 2>&1) &'
+ return BashTask(self.node, functools.partial(get_cmdline, self))
+ @inherit_parent
def __delete__(self):
raise NotImplementedError
@@ -123,9 +139,8 @@ class EmulatedChannel(Channel, Application):
#--------------------------------------------------------------------------
@async_task
- async def _set_ap(self, ap=None):
- if ap is None:
- ap = self.ap
+ async def __set_ap(self):
+ ap = self.ap
if ap is None:
log.info('Ignored setting ap to None...')
return
@@ -133,13 +148,13 @@ class EmulatedChannel(Channel, Application):
# Add a WiFi interface for the AP...
interfaces = list()
if isinstance(ap, LxcContainer):
- # Ideally, We need to create a VethPair for each station
+ # Ideally, We need to create a VethPairLxc for each station
# This should be monitored for the total channel bw
host = NetDevice(node = ap.node,
device_name='vhh-' + ap.name + '-' + self.name,
monitored = False,
managed = False)
- self._ap_if = VethPair(node = self.ap,
+ self._ap_if = VethPairLxc(node = self.ap,
name = 'vh-' + ap.name + '-' + self.name,
device_name = 'vh-' + ap.name + '-' + self.name,
host = host,
@@ -171,37 +186,35 @@ class EmulatedChannel(Channel, Application):
# Add interfaces to bridge
vlan = AddressManager().get('vlan', self, tag='ap')
- # AS the container has created the VethPair already without Vlan, we
+ # AS the container has created the VethPairLxc already without Vlan, we
# need to delete and recreate it
task = self.node.bridge._remove_interface(self._ap_bridged)
await run_task(task, self._state.manager)
task = self.node.bridge._add_interface(self._ap_bridged, vlan = vlan)
await run_task(task, self._state.manager)
+ task = self.node.bridge._remove_interface(self._ap_tap)
+ await run_task(task, self._state.manager)
task = self.node.bridge._add_interface(self._ap_tap, vlan = vlan)
await run_task(task, self._state.manager)
@inline_task
- def _get_ap(self):
+ def __get_ap(self):
return {'ap': None}
@inline_task
- def _get_stations(self):
+ def __get_stations(self):
return {'stations': list()}
@async_task
- async def _set_stations(self, stations=None):
- print('adding stations...')
- if stations is None:
- stations = self.stations
-
- for station in stations:
+ async def __set_stations(self):
+ for station in self.stations:
await self._add_station(station)
- def _add_stations(self, stations):
+ def __add_stations(self, stations):
raise NotImplementedError
@inline_task
- def _remove_stations(self, station):
+ def __remove_stations(self, station):
raise NotImplementedError
diff --git a/vicn/resource/ns3/emulated_lte_channel.py b/vicn/resource/ns3/emulated_lte_channel.py
index bf0f7097..0847a403 100644
--- a/vicn/resource/ns3/emulated_lte_channel.py
+++ b/vicn/resource/ns3/emulated_lte_channel.py
@@ -16,11 +16,15 @@
# limitations under the License.
#
+import math
+
from vicn.core.address_mgr import AddressManager
-from vicn.core.resource_mgr import wait_resources
-from vicn.core.task import run_task
+from vicn.core.resource_mgr import wait_resources, wait_resource_task
+from vicn.core.task import run_task, EmptyTask
from vicn.resource.ns3.emulated_channel import EmulatedChannel
from vicn.resource.linux.net_device import NetDevice
+from vicn.core.attribute import Attribute
+from netmodel.model.type import Integer
DEFAULT_FADING_ENABLED = True
DEFAULT_TW_BUFFER = 800000
@@ -48,13 +52,24 @@ class EmulatedLteChannel(EmulatedChannel):
__package_names__ = ['lte-emulator']
__app_name__ = 'lte_emulator'
+ nb_base_stations = Attribute(Integer, description='Number of nodes emulated by the AP',
+ default=8)
+
+ def __create__(self):
+ task = EmptyTask()
+ for group in self.groups:
+ ip4_assigns = group.iter_by_type_str("ipv4assignment")
+ for ip4_assign in ip4_assigns:
+ task = task | wait_resource_task(ip4_assign)
+
+ return task > super().__create__()
#---------------------------------------------------------------------------
# Attribute handlers
#---------------------------------------------------------------------------
async def _add_station(self, station):
from vicn.resource.lxd.lxc_container import LxcContainer
- from vicn.resource.linux.veth_pair import VethPair
+ from vicn.resource.linux.veth_pair_lxc import VethPairLxc
from vicn.resource.linux.tap_device import TapChannel
interfaces = list()
@@ -66,9 +81,9 @@ class EmulatedLteChannel(EmulatedChannel):
host = NetDevice(node = station.node,
device_name='vhh-' + station.name + '-' + self.name,
managed = False)
- sta_if = VethPair(node = station,
+ sta_if = VethPairLxc(node = station,
name = 'vh-' + station.name + '-' + self.name,
- device_name = 'vh-' + station.name + '-' + self.name,
+ device_name = 'vh-' + station.name + '-' + self.name,
host = host,
owner = self)
bridged_sta = sta_if.host
@@ -104,31 +119,24 @@ class EmulatedLteChannel(EmulatedChannel):
task = self.node.bridge._remove_interface(bridged_sta)
await run_task(task, self._state.manager)
- task = self.node.bridge._add_interface(bridged_sta,
- vlan = vlan)
+ task = self.node.bridge._add_interface(bridged_sta, vlan = vlan)
await run_task(task, self._state.manager)
+ task = self.node.bridge._remove_interface(sta_tap)
+ await run_task(task, self._state.manager)
task = self.node.bridge._add_interface(sta_tap, vlan = vlan)
await run_task(task, self._state.manager)
def _get_cmdline_params(self):
- # IP have not been assign, use AddressManager for simplicity since it
- # will remember the assignment
- # NOTE: here the IP address passed to emulator program is hardcoded with
- # a /24 mask(even if the associated IP with the station does not have a
- # /24 mask). This is not a problem at all because the netmask passed to
- # the emulator program has no impact on configuration in the emulator
- # program. Indeed, the IP routing table in the emulator program are
- # configured on a per address basis(one route per IP address) instead of
- # on a per prefix basis(one route per prefix). This guarantees the IP
- # routing will not change regardless of what netmask is. That is why we
- # can always safely pass a hardcoded /24 mask to the emulator program.
-
sta_list = list() # list of identifiers
sta_macs = list() # list of macs
sta_taps = list()
sta_ips = list()
+
+ bs_ip_addr = self._ap_if.ip4_address
+ bs_ip = str(bs_ip_addr) + '/' + str(bs_ip_addr.prefix_len)
+
for station in self.stations:
if not station.managed:
interface = [i for i in station.interfaces if i.channel == self]
@@ -137,17 +145,15 @@ class EmulatedLteChannel(EmulatedChannel):
sta_list.append(interface.name)
sta_macs.append(interface.mac_address)
- sta_ips.append(interface.ip4_address + '/24')
+ sta_ips.append(str(interface.ip4_address)+'/'+str(prefix_len))
else:
identifier = self._sta_ifs[station]._state.uuid._uuid
sta_list.append(identifier)
mac = self._sta_ifs[station].mac_address
sta_macs.append(mac)
-
- # Preallocate IP address
- ip = AddressManager().get_ip(self._sta_ifs[station]) + '/24'
- sta_ips.append(ip)
+ ip = self._sta_ifs[station].ip4_address
+ sta_ips.append(str(ip)+'/'+str(ip.prefix_len))
tap = self._sta_taps[station].device_name
sta_taps.append(tap)
@@ -178,8 +184,7 @@ class EmulatedLteChannel(EmulatedChannel):
# Coma-separated list of stations' IP/netmask len
'sta-ips' : ','.join(sta_ips),
# Base station IP/netmask len
- 'bs-ip' : AddressManager().get_ip(self._ap_if) + '/' +
- str(DEFAULT_NETMASK),
+ 'bs-ip' : bs_ip,
'txBuffer' : '800000',
'isFading' : 'true' if DEFAULT_FADING_ENABLED else 'false',
}
diff --git a/vicn/resource/ns3/emulated_wifi_channel.py b/vicn/resource/ns3/emulated_wifi_channel.py
index 088d4444..d8838e47 100644
--- a/vicn/resource/ns3/emulated_wifi_channel.py
+++ b/vicn/resource/ns3/emulated_wifi_channel.py
@@ -38,7 +38,7 @@ class EmulatedWiFiChannel(EmulatedChannel):
async def _add_station(self, station):
from vicn.resource.lxd.lxc_container import LxcContainer
- from vicn.resource.linux.veth_pair import VethPair
+ from vicn.resource.linux.veth_pair_lxc import VethPairLxc
from vicn.resource.linux.tap_device import TapChannel
from vicn.resource.linux.macvlan import MacVlan
@@ -46,18 +46,21 @@ class EmulatedWiFiChannel(EmulatedChannel):
if not station.managed:
sta_if = None
else:
+ # To connect a container to the EmulatedWifiChannel, we use a
+ # VethPairLxc connected to the bridge, that will be in the same VLAN as
+ # the station TAP entering the emulator
if isinstance(station, LxcContainer):
host = NetDevice(node = station.node,
device_name='vhh-' + station.name + '-' + self.name,
managed = False)
- sta_if = VethPair(node = station,
+ sta_if = VethPairLxc(node = station,
name = 'vh-' + station.name + '-' + self.name,
- device_name = 'vh-' + station.name + '-' + self.name,
+ device_name = 'vh-' + station.name + '-' + self.name,
host = host,
owner = self)
bridged_sta = sta_if.host
else:
- raise NotImplementedError
+ raise NotImplementedError
if sta_if:
self._sta_ifs[station] = sta_if
@@ -65,7 +68,7 @@ class EmulatedWiFiChannel(EmulatedChannel):
interfaces.append(sta_if)
self._state.manager.commit_resource(sta_if)
- sta_tap = TapChannel(node = self.node,
+ sta_tap = TapChannel(node = self.node,
owner = self,
device_name = 'tap-' + station.name + '-' + self.name,
up = True,
@@ -81,23 +84,23 @@ class EmulatedWiFiChannel(EmulatedChannel):
# Add interfaces to bridge
# One vlan per station is needed to avoid broadcast loops
- vlan = AddressManager().get('vlan', sta_tap)
+ vlan = AddressManager().get('vlan', sta_tap)
# sta_tap choosen because always there
if sta_if:
sta_if.set('channel', self)
task = self.node.bridge._remove_interface(bridged_sta)
await run_task(task, self._state.manager)
- task = self.node.bridge._add_interface(bridged_sta,
- vlan = vlan)
+ task = self.node.bridge._add_interface(bridged_sta, vlan = vlan)
await run_task(task, self._state.manager)
+ task = self.node.bridge._remove_interface(sta_tap)
+ await run_task(task, self._state.manager)
task = self.node.bridge._add_interface(sta_tap, vlan = vlan)
await run_task(task, self._state.manager)
def _get_cmdline_params(self, ):
-
# sta-macs and sta-list for unmanaged stations
sta_list = list() # list of identifiers
sta_macs = list() # list of macs
@@ -136,7 +139,7 @@ class EmulatedWiFiChannel(EmulatedChannel):
# Y position of the Base Station
'bs-y' : 0, #self.ap.y,
# Experiment ID
- 'experiment-id' : 'vicn',
+ 'experiment-id' : 'vicn',
# Index of the base station
'bs-name' : self._ap_tap.device_name,
# Base station MAC address
diff --git a/vicn/resource/symmetric_channel.py b/vicn/resource/symmetric_channel.py
new file mode 100644
index 00000000..d8a35030
--- /dev/null
+++ b/vicn/resource/symmetric_channel.py
@@ -0,0 +1,16 @@
+from netmodel.model.key import Key
+from vicn.core.attribute import Attribute
+from vicn.core.task import inherit_parent
+from vicn.resource.interface import Interface
+from vicn.resource.channel import Channel
+
+class SymmetricChannel(Channel):
+ src = Attribute(Interface, mandatory = True)
+ dst = Attribute(Interface, mandatory = True)
+
+ __key__ = Key(src, dst)
+
+ @inherit_parent
+ def __create__(self):
+ self.interfaces << self.src
+ self.interfaces << self.dst
diff --git a/vicn/resource/vpp/dpdk_device.py b/vicn/resource/vpp/dpdk_device.py
index 472ee26f..76659129 100644
--- a/vicn/resource/vpp/dpdk_device.py
+++ b/vicn/resource/vpp/dpdk_device.py
@@ -19,6 +19,7 @@
from netmodel.model.type import Integer, String
from vicn.core.attribute import Attribute
from vicn.resource.linux.phy_interface import PhyInterface
+from vicn.core.task import BashTask, task
class DpdkDevice(PhyInterface):
"""
@@ -32,4 +33,3 @@ class DpdkDevice(PhyInterface):
socket_mem = Attribute(Integer,
description = 'Memory used by the vpp forwarder',
default = 512)
- mac_address = Attribute(String)
diff --git a/vicn/resource/vpp/interface.py b/vicn/resource/vpp/interface.py
index 5f8f5018..d0538661 100644
--- a/vicn/resource/vpp/interface.py
+++ b/vicn/resource/vpp/interface.py
@@ -16,17 +16,63 @@
# limitations under the License.
#
+import pyparsing as pp
+
+from netmodel.model.key import Key
from netmodel.model.type import Integer, String, Bool
+from netmodel.model.type import Inet4Address, Inet6Address
from vicn.core.resource import Resource
from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.task import inline_task, BashTask, task
+from vicn.core.task import inherit_parent
from vicn.core.task import EmptyTask
from vicn.resource.interface import Interface
from vicn.resource.linux.net_device import NonTapBaseNetDevice
from vicn.resource.vpp.vpp import VPP
-from vicn.resource.vpp.vpp_commands import CMD_VPP_CREATE_IFACE
+from vicn.resource.vpp.vpp_commands import CMD_VPP_CREATE_IFACE, CMD_VPP_CREATE_MEMIFACE
from vicn.resource.vpp.vpp_commands import CMD_VPP_SET_IP, CMD_VPP_SET_UP
+from vicn.resource.vpp.memif_device import MemifDevice
+
+GREP_MEMIF_INFO = 'vppctl_wrapper show memif | grep interface --no-group-separator -A 1'
+
+def parse_memif(rv, vppinterface):
+ kw_interface = pp.CaselessKeyword('interface')
+ kw_key = pp.CaselessKeyword('key')
+ kw_file = pp.CaselessKeyword('file')
+ kw_listener = pp.CaselessKeyword('listener')
+ kw_connfd = pp.CaselessKeyword('conn-fd')
+ kw_intfd = pp.CaselessKeyword('int-fd')
+ kw_ringsize = pp.CaselessKeyword('ring-size')
+ kw_numc2srings = pp.CaselessKeyword('num-c2s-rings')
+ kw_nums2crings = pp.CaselessKeyword('num-s2c-rings')
+ kw_buffersize = pp.CaselessKeyword('buffer_size')
+
+ r_path = ' *(/[a-zA-Z0-9_\-]*)*\.[a-zA-Z0-9_\-]*'
+ r_id = ' *-+[0-9]*'
+
+ single = kw_interface.suppress() + pp.Word(pp.alphanums).setResultsName('interface') + \
+ kw_key.suppress() + pp.Word(pp.alphanums).setResultsName('key') + \
+ kw_file.suppress() + pp.Regex(r_path).setResultsName('path') # + \
+ # kw_listener.suppress() + pp.Word(pp.alphanums).setResultsName('listener') + \
+ # kw_connfd.suppress() + pp.Regex(r_id).setResultsName('conn-fd') + \
+ # kw_intfd.suppress() + pp.Regex(r_id).setResultsName('int-fd') + \
+ # kw_ringsize.suppress() + pp.Word(pp.nums).setResultsName('ring-size') + \
+ # kw_numc2srings.suppress() + pp.Word(pp.nums).setResultsName('num-c2s-rings') + \
+ # kw_nums2crings.suppress() + pp.Word(pp.nums).setResultsName('num-s2c-rings') + \
+ # kw_buffersize.suppress() + pp.Word(pp.nums).setResultsName('buffer-size')
+
+ multiple = pp.OneOrMore(pp.Group(single))
+
+ results = multiple.parseString(rv.stdout)
+
+ for interface in results:
+ if interface['path'] == vppinterface.parent.path_unix_socket + vppinterface.parent.socket_name:
+ vppinterface.device_name = interface['interface']
+ vppinterface.parent.device_name = interface['interface']
+
+ return vppinterface.device_name
+
class VPPInterface(Resource):
"""
@@ -39,18 +85,21 @@ class VPPInterface(Resource):
description = 'Forwarder to which this interface belong to',
mandatory = True,
multiplicity = Multiplicity.ManyToOne,
- key = True,
reverse_name = 'interfaces')
parent = Attribute(Interface, description = 'parent',
mandatory = True, reverse_name = 'vppinterface')
- ip4_address = Attribute(String)
- ip6_address = Attribute(String)
- prefix_len = Attribute(Integer, default = 31)
+ ip4_address = Attribute(Inet4Address)
+ ip6_address = Attribute(Inet6Address)
up = Attribute(Bool, description = 'Interface up/down status')
monitored = Attribute(Bool, default = True)
device_name = Attribute(String)
+ __key__ = Key(vpp, Resource.name)
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+
#--------------------------------------------------------------------------
# Resource lifecycle
#--------------------------------------------------------------------------
@@ -61,10 +110,12 @@ class VPPInterface(Resource):
"""
return ['CentralIP']
+ @inherit_parent
@inline_task
def __get__(self):
raise ResourceNotFound
+ @inherit_parent
def __create__(self):
# We must control what is the type of the parent netDevice (currently
# supported only veths, physical nics are coming)
@@ -73,15 +124,27 @@ class VPPInterface(Resource):
# We must let the routing algorithm know that the parent interface
# belongs to vpp
self.parent.has_vpp_child = True
-
- self.ip4_address = self.parent.ip4_address
- self.ip6_address = self.parent.ip6_address
self.up = True
- if isinstance(self.parent,NonTapBaseNetDevice):
+ if isinstance(self.parent, MemifDevice):
+ #TODO: add output parsing to get the interface name
+ create_task = BashTask(self.vpp.node, CMD_VPP_CREATE_MEMIFACE, {
+ 'key': hex(self.parent.key),
+ 'vpp_interface': self,
+ 'master_slave': 'master' if self.parent.master else 'slave'},
+ lock = self.vpp.vppctl_lock)
+ fill_name = BashTask(self.vpp.node, GREP_MEMIF_INFO,
+ parse = (lambda x, y=self : parse_memif(x, y)),
+ lock = self.vpp.vppctl_lock)
+
+ create_task = create_task > fill_name
+
+ elif isinstance(self.parent,NonTapBaseNetDevice):
# Remove ip address in the parent device, it must only be set in
# the vpp interface otherwise vpp and the linux kernel will reply
# to non-icn request (e.g., ARP replies, port ureachable etc)
+ self.ip4_address = self.parent.ip4_address
+ self.ip6_address = self.parent.ip6_address
self.device_name = 'host-' + self.parent.device_name
create_task = BashTask(self.vpp.node, CMD_VPP_CREATE_IFACE,
@@ -94,6 +157,8 @@ class VPPInterface(Resource):
self.parent.remote.set('offload', False)
elif self.parent.get_type() == 'dpdkdevice':
+ self.ip4_address = self.parent.ip4_address
+ self.ip6_address = self.parent.ip6_address
self.device_name = self.parent.device_name
else :
# Currently assume naively that everything else will be a physical
@@ -112,13 +177,27 @@ class VPPInterface(Resource):
def _set_ip4_address(self):
if self.ip4_address:
- return BashTask(self.vpp.node, CMD_VPP_SET_IP, {'netdevice': self},
+ return BashTask(self.vpp.node, CMD_VPP_SET_IP, {
+ 'device_name': self.device_name,
+ 'ip_address': str(self.ip4_address),
+ 'prefix_len': self.ip4_address.prefix_len},
lock = self.vpp.vppctl_lock)
- def _set_up(self):
- return BashTask(self.vpp.node, CMD_VPP_SET_UP, {'netdevice': self},
+ def _set_ip6_address(self):
+ if self.ip6_address:
+ return BashTask(self.vpp.node, CMD_VPP_SET_IP, {
+ 'device_name': self.device_name,
+ 'ip_address': str(self.ip6_address),
+ 'prefix_len': self.ip6_address.prefix_len},
lock = self.vpp.vppctl_lock)
+ def _set_up(self):
+ state = 'up' if self.up else 'down'
+ return BashTask(self.vpp.node, CMD_VPP_SET_UP, {
+ 'netdevice': self,
+ 'state': state},
+ lock = self.vpp.vppctl_lock)
+
@task
def _get_up(self):
return {'up' : False}
diff --git a/vicn/resource/vpp/memif_device.py b/vicn/resource/vpp/memif_device.py
new file mode 100644
index 00000000..a114900a
--- /dev/null
+++ b/vicn/resource/vpp/memif_device.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from netmodel.model.key import Key
+from netmodel.model.type import Bool, String, Integer
+from netmodel.model.type import Inet4Address, Inet6Address
+from vicn.core.attribute import Attribute
+from vicn.resource.interface import Interface
+from vicn.resource.lxd.lxc_container import CMD_MOUNT_FOLDER
+from vicn.resource.linux.folder import Folder
+from vicn.core.task import inline_task, BashTask
+from vicn.core.task import inherit_parent
+from vicn.core.exception import ResourceNotFound
+from vicn.core.address_mgr import AddressManager
+
+class MemifDevice(Interface):
+ """
+ Resource: Memory interface device
+
+ A MemifDevice is device build on top of a the memory interface provided by vpp.
+ It uses a unix socket to connect the two vpp-s (one master and one slave).
+ The unix socket must be shared between the two vpp-s.
+ """
+ path_unix_socket = Attribute(String,
+ mandatory = True,
+ description = 'Path to the shared folder holding the unix socket')
+ socket_name = Attribute(String,
+ mandatory = True,
+ description = 'Path to the shared folder holding the unix socket')
+ folder_host = Attribute(Folder,
+ mandatory = True,
+ description = 'Folder in the host to be mounted in the container ih path_unix_socket')
+ master= Attribute(Bool,
+ description = 'True if this interface is connected to the master vpp',
+ default = False)
+ # We need to automatically assign a mac address to the memif so that we can
+ # recreate it after vpp reboots thanks to a config file or bash script.
+ # Just reading the actual value would not work since we need to use an
+ # external script and this mac address would thus not be prevent in the list
+ # of executed commands.
+ mac_address = Attribute(String, description = 'Mac address of the device',
+ default = lambda self: AddressManager().get_mac(self))
+ ip4_address = Attribute(Inet4Address, description = "Device's IP address")
+ ip6_address = Attribute(Inet6Address, description = "Device's IP address")
+ device_name = Attribute(String)
+ key = Attribute(Integer)
+
+ __key__ = Key(folder_host)
+
+ @inline_task
+ def __get__(self):
+ raise ResourceNotFound
+
+ @inherit_parent
+ def __create__(self):
+ return BashTask(self.node.node_with_kernel, CMD_MOUNT_FOLDER, {
+ 'container': self.node,
+ 'device-name': self.socket_name,
+ 'host_path': self.folder_host.foldername,
+ 'container_path': self.path_unix_socket}, output=True,
+ lock=self.node.vpp.memif_lock)
+
diff --git a/vicn/resource/vpp/memif_link.py b/vicn/resource/vpp/memif_link.py
new file mode 100644
index 00000000..62de03c6
--- /dev/null
+++ b/vicn/resource/vpp/memif_link.py
@@ -0,0 +1,144 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2017 Cisco and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import random
+import string
+import logging
+import asyncio
+
+from netmodel.model.type import Integer, String
+from netmodel.model.key import Key
+from vicn.core.attribute import Attribute, Reference
+from vicn.core.exception import ResourceNotFound
+from vicn.core.state import ResourceState, AttributeState
+from vicn.core.task import inline_task, async_task, run_task
+from vicn.core.task import get_attributes_task, BashTask
+from vicn.core.task import inherit_parent
+from vicn.resource.channel import Channel
+from vicn.resource.interface import Interface
+from vicn.resource.linux.net_device import NonTapBaseNetDevice
+from vicn.resource.node import Node
+from vicn.resource.lxd.lxc_container import CMD_MOUNT_FOLDER, LxcContainer
+from vicn.resource.vpp.memif_device import MemifDevice
+from vicn.resource.linux.folder import Folder
+
+# FIXME remove VPP specific code
+from vicn.resource.vpp.interface import VPPInterface
+
+log = logging.getLogger(__name__)
+
+CONTAINER_SOCKET_PATH='/root/{}'
+SHARED_FOLDER_PATH='/tmp/{}'
+
+class MemifLink(Channel):
+ """
+ Resource: MemifLink
+
+ Implements a virtual wired link between containers. It is made
+ with a pair of MemifDevice which are created in the two containers.
+
+ Because of this, the resource only supports passing source and destination
+ containers, and not interfaces. It also explains the relative complexity of
+ the current implementation.
+ """
+
+ src_node = Attribute(LxcContainer, description = 'Source node',
+ mandatory = True)
+ dst_node = Attribute(LxcContainer, description = 'Destination node',
+ mandatory = True)
+ folder = Attribute(Folder, description = 'Shared folder holding the socket used by the MemifDevices')
+ key = Attribute(Integer)
+
+ __key__ = Key(src_node, dst_node)
+
+ def __init__(self, *args, **kwargs):
+ assert 'src_node' in kwargs and 'dst_node' in kwargs
+ self._src = None
+ self._dst = None
+ self._folder = None
+ super().__init__(*args, **kwargs)
+
+ @inherit_parent
+ def __subresources__(self):
+ assert self.src_node.node_with_kernel == self.dst_node.node_with_kernel
+
+ host = self.src_node.node_with_kernel
+ # We create two managed net devices that are pre-setup
+ # but the resource manager has to take over for IP addresses etc.
+ # Being done in initialize, those attributes won't be considered as
+ # dependencies and will thus not block the resource state machine.
+
+ socket_name = 'socket-' + ''.join(random.choice(string.ascii_uppercase
+ + string.digits) for _ in range(5)) +'.file'
+
+ _folder = Folder(node = host,
+ foldername = SHARED_FOLDER_PATH.format(self.src_node.name + '-' + self.dst_node.name),
+ permission = 777)
+
+ self.key = random.randint(0, 2**64)
+
+ self._src = MemifDevice(node = self.src_node,
+ channel = self,
+ owner = self,
+ path_unix_socket = CONTAINER_SOCKET_PATH.format(self.src_node.name + '-'
+ + self.dst_node.name) + '/',
+ folder_host = _folder,
+ socket_name = socket_name,
+ device_name = 'memif-'+self.dst_node.name,
+ key = Reference(self, 'key'),
+ master = False)
+ self._dst = MemifDevice(node = self.dst_node,
+ channel = self,
+ owner = self,
+ path_unix_socket = CONTAINER_SOCKET_PATH.format(self.src_node.name + '-'
+ + self.dst_node.name) + '/',
+ socket_name = socket_name,
+ folder_host = _folder,
+ device_name = 'memif-'+self.src_node.name,
+ key = Reference(self, 'key'),
+ master = True)
+ self._dst.remote = self._src
+ self._src.remote = self._dst
+
+ return _folder | (self._src | self._dst)
+
+
+ #--------------------------------------------------------------------------
+ # Internal methods
+ #--------------------------------------------------------------------------
+
+ async def _commit(self):
+ manager = self._state.manager
+
+ if hasattr(self.src_node, 'vpp') and not self.src_node.vpp is None:
+ vpp_src = VPPInterface(parent = self._src,
+ vpp = self.src_node.vpp,
+ ip4_address = Reference(self._src, 'ip4_address'),
+ ip6_address = Reference(self._src, 'ip6_address'))
+ manager.commit_resource(vpp_src)
+
+ if hasattr(self.dst_node, 'vpp') and not self.dst_node.vpp is None:
+ vpp_dst = VPPInterface(parent = self._dst,
+ vpp = self.dst_node.vpp,
+ ip4_address = Reference(self._dst, 'ip4_address'),
+ ip6_address = Reference(self._dst, 'ip6_address'))
+ manager.commit_resource(vpp_dst)
+
+ @inherit_parent
+ def __get__(self):
+ return async_task(self._commit)()
diff --git a/vicn/resource/vpp/scripts.py b/vicn/resource/vpp/scripts.py
index 3a3d5e8f..d5130212 100644
--- a/vicn/resource/vpp/scripts.py
+++ b/vicn/resource/vpp/scripts.py
@@ -282,6 +282,6 @@ api-segment {
'''
APPARMOR_VPP_PROFILE = '''
-lxc.aa_profile = lxc-dpdk
+lxc.aa_profile = lxc-dpdk
lxc.mount.entry = hugetlbfs dev/hugepages hugetlbfs rw,relatime,create=dir 0 0
lxc.mount.auto = sys:rw'''
diff --git a/vicn/resource/vpp/vpp.py b/vicn/resource/vpp/vpp.py
index 9edcfea3..8250f99a 100644
--- a/vicn/resource/vpp/vpp.py
+++ b/vicn/resource/vpp/vpp.py
@@ -23,6 +23,7 @@ from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import Resource
from vicn.core.task import BashTask, task, inline_task
+from vicn.core.task import inherit_parent, EmptyTask
from vicn.resource.lxd.lxc_container import LxcContainer
from vicn.resource.node import Node
from vicn.resource.linux.application import LinuxApplication
@@ -33,6 +34,7 @@ from vicn.resource.vpp.scripts import TPL_VPP_DPDK_DAEMON_SCRIPT
from vicn.resource.vpp.vpp_commands import CMD_VPP_DISABLE, CMD_VPP_STOP
from vicn.resource.vpp.vpp_commands import CMD_VPP_START
from vicn.resource.vpp.vpp_commands import CMD_VPP_ENABLE_PLUGIN
+from vicn.resource.vpp.vpp_commands import CMD_REMOVE_DPDK_PLUGIN
from vicn.resource.vpp.vpp_host import VPPHost
#------------------------------------------------------------------------------
@@ -50,7 +52,7 @@ class VPP(LinuxApplication):
start and stop commands
"""
- __package_names__ = ['vpp', 'vpp-dbg', 'vpp-dpdk-dev']
+ __package_names__ = ['vpp', 'vpp-dpdk-dev']
plugins = Attribute(String,
multiplicity = Multiplicity.OneToMany)
@@ -72,12 +74,15 @@ class VPP(LinuxApplication):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
- self.vppctl_lock = asyncio.Lock()
+ self.vppctl_lock = asyncio.Lock()
+
+ # needed by "lxc config device add"
+ self.memif_lock = asyncio.Lock()
- self.dpdk_setup_file = None
if isinstance(self.node, LxcContainer):
if not 'vpp' in self.node.profiles:
self.node.profiles.append('vpp')
+ self.dpdk_setup_file = None
#--------------------------------------------------------------------------
# Resource lifecycle
@@ -86,16 +91,14 @@ class VPP(LinuxApplication):
def __after__(self):
return ['BaseNetDevice']
+ @inherit_parent
+ @task
def __get__(self):
+ raise ResourceNotFound
return BashTask(self.node, CMD_GET)
+ @inherit_parent
def __subresources__(self):
- self.dpdk_setup_file = TextFile(node = self.node,
- filename = FN_VPP_DPDK_SCRIPT,
- overwrite = True)
- return self.dpdk_setup_file
-
- def __create__(self):
socket_mem = dict()
numa_mgr = self.node.node_with_kernel.numa_mgr
@@ -117,25 +120,6 @@ class VPP(LinuxApplication):
self.numa_node, self.core = \
numa_mgr.get_numa_core(numa_node = self.numa_node)
- dpdk_list = list()
-
- # On numa architecture socket-mem requires to set the amount of memory
- # to be reserved on each numa node
- socket_mem_str = 'socket-mem '
- for numa in range (0,numa_mgr.get_number_of_numa()):
- if numa in socket_mem:
- socket_mem_str = socket_mem_str + str(socket_mem[numa])
- else:
- socket_mem_str = socket_mem_str + '0'
-
- if numa < numa_mgr.get_number_of_numa()-1:
- socket_mem_str = socket_mem_str + ','
-
- dpdk_list.append(socket_mem_str)
-
- for interface in self.node.interfaces:
- if isinstance(interface, DpdkDevice):
- dpdk_list.append('dev ' + interface.pci_address)
# Add the core on which running vpp and the dpdk parameters
setup = TPL_VPP_DPDK_DAEMON_SCRIPT + 'cpu {'
@@ -146,19 +130,42 @@ class VPP(LinuxApplication):
self.numa_node, cpu_worker =numa_mgr.get_numa_core(self.numa_node)
setup = setup + '''\n corelist-workers ''' + str(cpu_worker)
- setup = setup + '''\n}\n\n dpdk { '''
-
- for dpdk_dev in dpdk_list:
- setup = setup + ''' \n ''' + dpdk_dev
-
- setup = setup + '\n}'
+ dpdk_list = list()
+ for interface in self.node.interfaces:
+ if isinstance(interface, DpdkDevice):
+ dpdk_list.append('dev ' + interface.pci_address)
+ setup = setup + '''\n}\n\n'''
+ if dpdk_list:
+ setup = setup + 'dpdk {'
+ # add socket_mem
+ # On numa architecture socket-mem requires to set the amount of memory
+ # to be reserved on each numa node
+ socket_mem_str = 'socket-mem '
+ for numa in range (0,numa_mgr.get_number_of_numa()):
+ if numa in socket_mem:
+ socket_mem_str = socket_mem_str + str(socket_mem[numa])
+ else:
+ socket_mem_str = socket_mem_str + '0'
+
+ if numa < numa_mgr.get_number_of_numa()-1:
+ socket_mem_str = socket_mem_str + ','
+
+ dpdk_list.append(socket_mem_str)
+
+ for dpdk_dev in dpdk_list:
+ setup = setup + ''' \n ''' + dpdk_dev
+ setup = setup + '''\n}'''
+
+ dpdk_setup_file = TextFile(node = self.node,
+ filename = FN_VPP_DPDK_SCRIPT,
+ content = setup,
+ overwrite = True)
- if any([isinstance(interface,DpdkDevice) for interface in self.node.interfaces]):
- self.dpdk_setup_file.content = setup
- else:
- self.dpdk_setup_file.content = TPL_VPP_DPDK_DAEMON_SCRIPT
+ return dpdk_setup_file
+ @inherit_parent
+ def __create__(self):
lock = self.node.node_with_kernel.vpp_host.vppstart_lock
vpp_disable = BashTask(self.node, CMD_VPP_DISABLE, lock = lock)
@@ -166,8 +173,19 @@ class VPP(LinuxApplication):
enable_ip_forward = BashTask(self.node, CMD_DISABLE_IP_FORWARD)
start_vpp = BashTask(self.node, CMD_VPP_START, lock = lock)
- return ((vpp_disable > vpp_stop) | enable_ip_forward) > start_vpp
+ found = False
+ for iface in self.interfaces:
+ if isinstance(iface.parent, DpdkDevice):
+ found = True
+ break
+
+ remove_dpdk_plugin = EmptyTask()
+ if (not found):
+ remove_dpdk_plugin = BashTask(self.node, CMD_REMOVE_DPDK_PLUGIN, lock = lock)
+
+ return (((vpp_disable > vpp_stop) | enable_ip_forward) > (remove_dpdk_plugin > start_vpp))
+ @inherit_parent
def __delete__(self):
return BashTask(self.node, CMD_VPP_STOP)
diff --git a/vicn/resource/vpp/vpp_bridge.py b/vicn/resource/vpp/vpp_bridge.py
index 612145d9..53523c17 100644
--- a/vicn/resource/vpp/vpp_bridge.py
+++ b/vicn/resource/vpp/vpp_bridge.py
@@ -24,6 +24,7 @@ from vicn.core.requirement import Requirement
from vicn.core.resource_mgr import wait_resource_task
from vicn.core.resource import Resource
from vicn.core.task import task, BashTask, EmptyTask
+from vicn.core.task import inherit_parent
from vicn.resource.channel import Channel
from vicn.resource.linux.application import LinuxApplication
from vicn.resource.linux.sym_veth_pair import SymVethPair
@@ -33,7 +34,7 @@ from vicn.resource.vpp.dpdk_device import DpdkDevice
from vicn.resource.vpp.interface import VPPInterface
from vicn.resource.vpp.vpp import VPP
-CMD_ADD_INTERFACE_TO_BR = ('vppctl set interface l2 bridge '
+CMD_ADD_INTERFACE_TO_BR = ('vppctl_wrapper set interface l2 bridge '
'{interface.device_name} {br_domain}')
class VPPBridge(Channel, LinuxApplication):
@@ -69,6 +70,7 @@ class VPPBridge(Channel, LinuxApplication):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
def __subresources__ (self):
# We don't need any reference to the list of SymVethPair because each
# side of a veth will be included in the node.interfaces list
@@ -77,12 +79,14 @@ class VPPBridge(Channel, LinuxApplication):
return Resource.__concurrent__(*self._veths)
+ @inherit_parent
@task
def __initialize__ (self):
# Add the veth side on the connected_nodes to the set of interfaces of
# the channel
self.interfaces.extend([veth.side2 for veth in self._veths])
+ @inherit_parent
@task
def __get__(self):
# Forces creation
@@ -91,6 +95,7 @@ class VPPBridge(Channel, LinuxApplication):
# Nothing to do
__delete__ = None
+ @inherit_parent
def __create__(self):
manager = self._state.manager
diff --git a/vicn/resource/vpp/vpp_commands.py b/vicn/resource/vpp/vpp_commands.py
index 40315c19..30898eae 100644
--- a/vicn/resource/vpp/vpp_commands.py
+++ b/vicn/resource/vpp/vpp_commands.py
@@ -5,37 +5,41 @@ CMD_VPP_DISABLE = 'systemctl disable vpp.service'
# 'sleep 1' ensures that VPP has enough time to start
CMD_VPP_START = '''
-systemctl start vpp
-sleep 1
+flock /tmp/vppctl.lock -c "systemctl start vpp"
'''
CMD_VPP_STOP = '''
-systemctl stop vpp
-killall -9 vpp_main || true
+flock /tmp/vppctl.lock -c "systemctl stop vpp"
+'''
+#killall -9 vpp_main || true
+CMD_VPP_ENABLE_PLUGIN = 'vppctl_wrapper {plugin} control start'
+
+CMD_REMOVE_DPDK_PLUGIN = '''
+rm /usr/lib/vpp_api_test_plugins/dpdk_test_plugin.so
+rm /usr/lib/vpp_plugins/dpdk_plugin.so
'''
-CMD_VPP_ENABLE_PLUGIN = 'vppctl {plugin} enable'
##### VPP INTERFACES #####
CMD_VPP_CREATE_IFACE = '''
-# Create vpp interface from netmodel.network.interface.device_name} with mac {self.parent.mac_address}
-vppctl create host-interface name {vpp_interface.parent.device_name} hw-addr {vpp_interface.parent.mac_address}
-vppctl set interface state {vpp_interface.device_name} up
+# Create vpp interface from {vpp_interface.parent.device_name} with mac {vpp_interface.parent.mac_address}
+vppctl_wrapper create host-interface name {vpp_interface.parent.device_name} hw-addr {vpp_interface.parent.mac_address}
+vppctl_wrapper set interface state {vpp_interface.device_name} up
'''
-CMD_VPP_SET_IP = 'vppctl set int ip address {netdevice.device_name} {netdevice.ip4_address}/{netdevice.prefix_len}'
-CMD_VPP_SET_UP = 'vppctl set int state {netdevice.device_name} up'
-
-##### VPP IP ROUTING #####
-CMD_VPP_ADD_ROUTE = 'vppctl set ip arp static {route.interface.vppinterface.device_name} {route.ip_address} {route.mac_address}'
-CMD_VPP_DEL_ROUTE = 'vppctl set ip arp del static {route.interface.vppinterface.device_name} {route.ip_address} {route.mac_address}'
-CMD_VPP_ADD_ROUTE_GW = 'vppctl ip route add {route.ip_address}/32 via {route.gateway} {route.interface.vppinterface.device_name}'
-CMD_VPP_DEL_ROUTE_GW = 'vppctl ip route del {route.ip_address}/32 via {route.gateway} {route.interface.vppinterface.device_name}'
-
-##### VPP CICN PLUGIN #####
+# It is important to pass the mac address so that it does not get randomly
+# generated by VPP, preventing any reboot of VPP and recreation of commands
+CMD_VPP_CREATE_MEMIFACE = '''
+# Create vpp interface from shared_memory
+vppctl_wrapper create memif key {key} socket {vpp_interface.parent.path_unix_socket}{vpp_interface.parent.socket_name} hw-addr {vpp_interface.parent.mac_address} {master_slave}
+'''
+CMD_VPP_SET_IP = 'vppctl_wrapper set int ip address {device_name} {ip_address}/{prefix_len}'
+CMD_VPP_SET_UP = 'vppctl_wrapper set int state {netdevice.device_name} {state}'
-CMD_VPP_CICN_GET = "timeout 1 vppctl cicn show" #We timeout if vpp is not started
-CMD_VPP_ADD_ICN_ROUTE = 'vppctl cicn cfg fib add prefix {route.prefix} face {route.face.id}'
-CMD_VPP_ADD_ICN_FACE = 'vppctl cicn cfg face add local {face.src_ip}:{face.src_port} remote {face.dst_ip}:{face.dst_port}'
+##### VPP IP ROUTING #####
-CMD_VPP_CICN_GET_CACHE_SIZE = 'vppctl cicn show | grep "CS entries" | grep -Eo "[0-9]+"'
-CMD_VPP_CICN_SET_CACHE_SIZE = 'vppctl cicn control param cs size {self.cache_size}'
+CMD_VPP_ADD_ARP = 'vppctl_wrapper set ip arp static {route.interface.vppinterface.device_name} {route.ip_address} {route.mac_address}'
+CMD_VPP_DEL_ARP = 'vppctl_wrapper set ip arp del static {route.interface.vppinterface.device_name} {route.ip_address} {route.mac_address}'
+CMD_VPP_ADD_ROUTE = 'vppctl_wrapper ip route add {route.ip_address}/{route.ip_address.prefix_len} via {route.interface.vppinterface.device_name}'
+CMD_VPP_DEL_ROUTE = 'vppctl_wrapper ip route del {route.ip_address}/{route.ip_address.prefix_len} via {route.interface.vppinterface.device_name}'
+CMD_VPP_ADD_ROUTE_GW = 'vppctl_wrapper ip route add {route.ip_address}/{route.ip_address.prefix_len} via {route.gateway} {route.interface.vppinterface.device_name}'
+CMD_VPP_DEL_ROUTE_GW = 'vppctl_wrapper ip route del {route.ip_address}/{route.ip_address.prefix_len} via {route.gateway} {route.interface.vppinterface.device_name}'
diff --git a/vicn/resource/vpp/vpp_host.py b/vicn/resource/vpp/vpp_host.py
index 954d1d32..29094451 100644
--- a/vicn/resource/vpp/vpp_host.py
+++ b/vicn/resource/vpp/vpp_host.py
@@ -23,6 +23,7 @@ from vicn.core.attribute import Attribute, Multiplicity
from vicn.core.exception import ResourceNotFound
from vicn.core.requirement import Requirement
from vicn.core.task import BashTask, task, EmptyTask
+from vicn.core.task import inherit_parent
from vicn.resource.linux.application import LinuxApplication
from vicn.resource.linux.file import TextFile
from vicn.resource.node import Node
@@ -41,7 +42,7 @@ CMD_APP_ARMOR_RELOAD = '''
CMD_SYSCTL_HUGEPAGES = 'sysctl -w vm.nr_hugepages={nb_hp}'
DEFAULT_NB_HUGEPAGES = 1024
CMD_GREP_UIO_DEV = 'ls /dev | grep uio'
-CMD_CREATE_UIO_DEVICES = "dpdk_nic_bind --bind=igb_uio {pci_address}"
+CMD_CREATE_UIO_DEVICES = "dpdk-devbind --bind=igb_uio {pci_address}"
class VPPHost(LinuxApplication):
"""
@@ -75,7 +76,7 @@ class VPPHost(LinuxApplication):
description = 'Dpdk devices on the node',
multiplicity = Multiplicity.OneToMany)
- __package_names__ = ['dpdk', 'vpp-dpdk-dkms']
+ __package_names__ = ['vpp-dpdk-dkms', 'vpp-dpdk-dev']
#--------------------------------------------------------------------------
# Constructor and Accessors
@@ -89,6 +90,7 @@ class VPPHost(LinuxApplication):
# Resource lifecycle
#--------------------------------------------------------------------------
+ @inherit_parent
def __subresources__(self):
app_armor_file = TextFile(node = self.node,
filename = FN_APPARMOR_DPDK_SCRIPT,
@@ -100,6 +102,7 @@ class VPPHost(LinuxApplication):
overwrite = True)
return app_armor_file | startup_conf
+ @inherit_parent
@task
def __get__(self):
"""
@@ -108,6 +111,7 @@ class VPPHost(LinuxApplication):
"""
raise ResourceNotFound
+ @inherit_parent
def __create__(self):
modules = BashTask(self.node, CMD_INSERT_MODULES)
app_armor_reload = BashTask(self.node, CMD_APP_ARMOR_RELOAD)
@@ -132,8 +136,6 @@ class VPPHost(LinuxApplication):
return ((modules | app_armor_reload) | sysctl_hugepages) > \
(disable_vpp > create_uio)
- __delete__ = None
-
#--------------------------------------------------------------------------
# Attributes
#--------------------------------------------------------------------------
diff --git a/www/css/contrib/bootstrap-dropmenu.min.css b/www/css/contrib/bootstrap-dropmenu.min.css
new file mode 100644
index 00000000..3378c140
--- /dev/null
+++ b/www/css/contrib/bootstrap-dropmenu.min.css
@@ -0,0 +1,5 @@
+/*!
+ * bootstrap-dropmenu v0.9.0 (https://skywalkapps.github.io/bootstrap-dropmenu)
+ * Copyright 2016 Martin Staněk
+ * Licensed under MIT
+ */.navbar-toggle{line-height:1}.navbar-toggle.navbar-toggle-left{float:left;margin-left:15px}.navbar-toggle-label{text-transform:uppercase;display:inline-block;vertical-align:top;margin-right:4px;color:#888;font-size:14px;font-weight:bold}.navbar-toggle-icon{display:inline-block}.navbar-default .navbar-toggle{border-color:#e7e7e7}.navbar-inverse .navbar-toggle{border-color:#080808}.navbar-inverse .navbar-toggle-label{color:#fff}.sw-example>nav .navbar-toggle{display:block !important} \ No newline at end of file
diff --git a/www/css/contrib/bootstrap-table.min.css b/www/css/contrib/bootstrap-table.min.css
new file mode 100644
index 00000000..d72d0655
--- /dev/null
+++ b/www/css/contrib/bootstrap-table.min.css
@@ -0,0 +1 @@
+.fixed-table-container .bs-checkbox,.fixed-table-container .no-records-found{text-align:center}.fixed-table-body thead th .th-inner,.table td,.table th{box-sizing:border-box}.bootstrap-table .table{margin-bottom:0!important;border-bottom:1px solid #ddd;border-collapse:collapse!important;border-radius:1px}.bootstrap-table .table:not(.table-condensed),.bootstrap-table .table:not(.table-condensed)>tbody>tr>td,.bootstrap-table .table:not(.table-condensed)>tbody>tr>th,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>td,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>th,.bootstrap-table .table:not(.table-condensed)>thead>tr>td{padding:8px}.bootstrap-table .table.table-no-bordered>tbody>tr>td,.bootstrap-table .table.table-no-bordered>thead>tr>th{border-right:2px solid transparent}.bootstrap-table .table.table-no-bordered>tbody>tr>td:last-child{border-right:none}.fixed-table-container{position:relative;clear:both;border:1px solid #ddd;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px}.fixed-table-container.table-no-bordered{border:1px solid transparent}.fixed-table-footer,.fixed-table-header{overflow:hidden}.fixed-table-footer{border-top:1px solid #ddd}.fixed-table-body{overflow-x:auto;overflow-y:auto;height:100%}.fixed-table-container table{width:100%}.fixed-table-container thead th{height:0;padding:0;margin:0;border-left:1px solid #ddd}.fixed-table-container thead th:focus{outline:transparent solid 0}.fixed-table-container thead th:first-child{border-left:none;border-top-left-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px}.fixed-table-container tbody td .th-inner,.fixed-table-container thead th .th-inner{padding:8px;line-height:24px;vertical-align:top;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fixed-table-container thead th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px}.fixed-table-container thead th .both{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC')}.fixed-table-container thead th .asc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==)}.fixed-table-container thead th .desc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII=)}.fixed-table-container th.detail{width:30px}.fixed-table-container tbody td{border-left:1px solid #ddd}.fixed-table-container tbody tr:first-child td{border-top:none}.fixed-table-container tbody td:first-child{border-left:none}.fixed-table-container tbody .selected td{background-color:#f5f5f5}.fixed-table-container .bs-checkbox .th-inner{padding:8px 0}.fixed-table-container input[type=radio],.fixed-table-container input[type=checkbox]{margin:0 auto!important}.fixed-table-pagination .pagination-detail,.fixed-table-pagination div.pagination{margin-top:10px;margin-bottom:10px}.fixed-table-pagination div.pagination .pagination{margin:0}.fixed-table-pagination .pagination a{padding:6px 12px;line-height:1.428571429}.fixed-table-pagination .pagination-info{line-height:34px;margin-right:5px}.fixed-table-pagination .btn-group{position:relative;display:inline-block;vertical-align:middle}.fixed-table-pagination .dropup .dropdown-menu{margin-bottom:0}.fixed-table-pagination .page-list{display:inline-block}.fixed-table-toolbar .columns-left{margin-right:5px}.fixed-table-toolbar .columns-right{margin-left:5px}.fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429}.fixed-table-toolbar .bs-bars,.fixed-table-toolbar .columns,.fixed-table-toolbar .search{position:relative;margin-top:10px;margin-bottom:10px;line-height:34px}.fixed-table-pagination li.disabled a{pointer-events:none;cursor:default}.fixed-table-loading{display:none;position:absolute;top:42px;right:0;bottom:0;left:0;z-index:99;background-color:#fff;text-align:center}.fixed-table-body .card-view .title{font-weight:700;display:inline-block;min-width:30%;text-align:left!important}.table td,.table th{vertical-align:middle}.fixed-table-toolbar .dropdown-menu{text-align:left;max-height:300px;overflow:auto}.fixed-table-toolbar .btn-group>.btn-group{display:inline-block;margin-left:-1px!important}.fixed-table-toolbar .btn-group>.btn-group>.btn{border-radius:0}.fixed-table-toolbar .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.fixed-table-toolbar .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .table>thead>tr>th{vertical-align:bottom;border-bottom:1px solid #ddd}.bootstrap-table .table thead>tr>th{padding:0;margin:0}.bootstrap-table .fixed-table-footer tbody>tr>td{padding:0!important}.bootstrap-table .fixed-table-footer .table{border-bottom:none;border-radius:0;padding:0!important}.pull-right .dropdown-menu{right:0;left:auto}p.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden} \ No newline at end of file
diff --git a/www/css/contrib/bootstrap.min.css b/www/css/contrib/bootstrap.min.css
new file mode 100644
index 00000000..a9f35cee
--- /dev/null
+++ b/www/css/contrib/bootstrap.min.css
@@ -0,0 +1,5 @@
+/*!
+ * Bootstrap v3.2.0 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ *//*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}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%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;width:100% \9;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;width:100% \9;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;color:#777}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}mark,.mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#428bca}a.text-primary:hover{color:#3071a9}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#428bca}a.bg-primary:hover{background-color:#3071a9}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#777;opacity:1}.form-control:-ms-input-placeholder{color:#777}.form-control::-webkit-input-placeholder{color:#777}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px;line-height:1.42857143 \0}input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;min-height:20px;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{position:absolute;margin-top:4px \9;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],input[type=radio].disabled,input[type=checkbox].disabled,fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm,.form-horizontal .form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm,select[multiple].input-sm{height:auto}.input-lg,.form-horizontal .form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:46px;line-height:46px}textarea.input-lg,select[multiple].input-lg{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:25px;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{top:0;right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.3px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn:focus,.btn:active:focus,.btn.active:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#3071a9;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#428bca;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#777;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#777}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn>input[type=radio],[data-toggle=buttons]>.btn>input[type=checkbox]{position:absolute;z-index:-1;filter:alpha(opacity=0);opacity:0}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}@media (max-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#333}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#777}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#777}.navbar-inverse .navbar-nav>li>a{color:#777}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#777}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#777}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#fff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#428bca;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#2a6496;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:hover,.label-default[href]:focus{background-color:#5e5e5e}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar[aria-valuenow="1"],.progress-bar[aria-valuenow="2"]{min-width:30px}.progress-bar[aria-valuenow="0"]{min-width:30px;color:#777;background-color:transparent;background-image:none;-webkit-box-shadow:none;box-shadow:none}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{color:#777;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#428bca}.panel-primary>.panel-heading .badge{color:#428bca;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate3d(0,-25%,0);-o-transform:translate3d(0,-25%,0);transform:translate3d(0,-25%,0)}.modal.in .modal-dialog{-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-size:12px;line-height:1.4;visibility:visible;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{display:table;content:" "}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed;-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} \ No newline at end of file
diff --git a/www/css/contrib/jasny-bootstrap.min.css b/www/css/contrib/jasny-bootstrap.min.css
new file mode 100644
index 00000000..04af127a
--- /dev/null
+++ b/www/css/contrib/jasny-bootstrap.min.css
@@ -0,0 +1,7 @@
+/*!
+ * Jasny Bootstrap v3.1.3 (http://jasny.github.io/bootstrap)
+ * Copyright 2012-2014 Arnold Daniels
+ * Licensed under Apache-2.0 (https://github.com/jasny/bootstrap/blob/master/LICENSE)
+ */
+
+.container-smooth{max-width:1170px}@media (min-width:1px){.container-smooth{width:auto}}.btn-labeled{padding-top:0;padding-bottom:0}.btn-label{position:relative;background:0 0;background:rgba(0,0,0,.15);display:inline-block;padding:6px 12px;left:-12px;border-radius:3px 0 0 3px}.btn-label.btn-label-right{left:auto;right:-12px;border-radius:0 3px 3px 0}.btn-lg .btn-label{padding:10px 16px;left:-16px;border-radius:5px 0 0 5px}.btn-lg .btn-label.btn-label-right{left:auto;right:-16px;border-radius:0 5px 5px 0}.btn-sm .btn-label{padding:5px 10px;left:-10px;border-radius:2px 0 0 2px}.btn-sm .btn-label.btn-label-right{left:auto;right:-10px;border-radius:0 2px 2px 0}.btn-xs .btn-label{padding:1px 5px;left:-5px;border-radius:2px 0 0 2px}.btn-xs .btn-label.btn-label-right{left:auto;right:-5px;border-radius:0 2px 2px 0}.nav-tabs-bottom{border-bottom:0;border-top:1px solid #ddd}.nav-tabs-bottom>li{margin-bottom:0;margin-top:-1px}.nav-tabs-bottom>li>a{border-radius:0 0 4px 4px}.nav-tabs-bottom>li>a:hover,.nav-tabs-bottom>li>a:focus,.nav-tabs-bottom>li.active>a,.nav-tabs-bottom>li.active>a:hover,.nav-tabs-bottom>li.active>a:focus{border:1px solid #ddd;border-top-color:transparent}.nav-tabs-left{border-bottom:0;border-right:1px solid #ddd}.nav-tabs-left>li{margin-bottom:0;margin-right:-1px;float:none}.nav-tabs-left>li>a{border-radius:4px 0 0 4px;margin-right:0;margin-bottom:2px}.nav-tabs-left>li>a:hover,.nav-tabs-left>li>a:focus,.nav-tabs-left>li.active>a,.nav-tabs-left>li.active>a:hover,.nav-tabs-left>li.active>a:focus{border:1px solid #ddd;border-right-color:transparent}.row>.nav-tabs-left{padding-right:0;padding-left:15px;margin-right:-1px;position:relative;z-index:1}.row>.nav-tabs-left+.tab-content{border-left:1px solid #ddd}.nav-tabs-right{border-bottom:0;border-left:1px solid #ddd}.nav-tabs-right>li{margin-bottom:0;margin-left:-1px;float:none}.nav-tabs-right>li>a{border-radius:0 4px 4px 0;margin-left:0;margin-bottom:2px}.nav-tabs-right>li>a:hover,.nav-tabs-right>li>a:focus,.nav-tabs-right>li.active>a,.nav-tabs-right>li.active>a:hover,.nav-tabs-right>li.active>a:focus{border:1px solid #ddd;border-left-color:transparent}.row>.nav-tabs-right{padding-left:0;padding-right:15px}.navmenu,.navbar-offcanvas{width:300px;height:auto;border-width:1px;border-style:solid;border-radius:4px}.navmenu-fixed-left,.navmenu-fixed-right,.navbar-offcanvas{position:fixed;z-index:1050;top:0;bottom:0;overflow-y:auto;border-radius:0}.navmenu-fixed-left,.navbar-offcanvas.navmenu-fixed-left{left:0;right:auto;border-width:0 1px 0 0}.navmenu-fixed-right,.navbar-offcanvas{left:auto;right:0;border-width:0 0 0 1px}.navmenu-nav{margin-bottom:10px}.navmenu-nav.dropdown-menu{position:static;margin:0;padding-top:0;float:none;border:none;-webkit-box-shadow:none;box-shadow:none;border-radius:0}.navbar-offcanvas .navbar-nav{margin:0}@media (min-width:768px){.navbar-offcanvas{width:auto;border-top:0;box-shadow:none}.navbar-offcanvas.offcanvas{position:static;display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-offcanvas .navbar-nav.navbar-left:first-child{margin-left:-15px}.navbar-offcanvas .navbar-nav.navbar-right:last-child{margin-right:-15px}.navbar-offcanvas .navmenu-brand{display:none}}.navmenu-brand{display:block;font-size:18px;line-height:20px;padding:10px 15px;margin:10px 0}.navmenu-brand:hover,.navmenu-brand:focus{text-decoration:none}.navmenu-default,.navbar-default .navbar-offcanvas{background-color:#f8f8f8;border-color:#e7e7e7}.navmenu-default .navmenu-brand,.navbar-default .navbar-offcanvas .navmenu-brand{color:#777}.navmenu-default .navmenu-brand:hover,.navbar-default .navbar-offcanvas .navmenu-brand:hover,.navmenu-default .navmenu-brand:focus,.navbar-default .navbar-offcanvas .navmenu-brand:focus{color:#5e5e5e;background-color:transparent}.navmenu-default .navmenu-text,.navbar-default .navbar-offcanvas .navmenu-text{color:#777}.navmenu-default .navmenu-nav>.dropdown>a:hover .caret,.navbar-default .navbar-offcanvas .navmenu-nav>.dropdown>a:hover .caret,.navmenu-default .navmenu-nav>.dropdown>a:focus .caret,.navbar-default .navbar-offcanvas .navmenu-nav>.dropdown>a:focus .caret{border-top-color:#333;border-bottom-color:#333}.navmenu-default .navmenu-nav>.open>a,.navbar-default .navbar-offcanvas .navmenu-nav>.open>a,.navmenu-default .navmenu-nav>.open>a:hover,.navbar-default .navbar-offcanvas .navmenu-nav>.open>a:hover,.navmenu-default .navmenu-nav>.open>a:focus,.navbar-default .navbar-offcanvas .navmenu-nav>.open>a:focus{background-color:#e7e7e7;color:#555}.navmenu-default .navmenu-nav>.open>a .caret,.navbar-default .navbar-offcanvas .navmenu-nav>.open>a .caret,.navmenu-default .navmenu-nav>.open>a:hover .caret,.navbar-default .navbar-offcanvas .navmenu-nav>.open>a:hover .caret,.navmenu-default .navmenu-nav>.open>a:focus .caret,.navbar-default .navbar-offcanvas .navmenu-nav>.open>a:focus .caret{border-top-color:#555;border-bottom-color:#555}.navmenu-default .navmenu-nav>.dropdown>a .caret,.navbar-default .navbar-offcanvas .navmenu-nav>.dropdown>a .caret{border-top-color:#777;border-bottom-color:#777}.navmenu-default .navmenu-nav.dropdown-menu,.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu{background-color:#e7e7e7}.navmenu-default .navmenu-nav.dropdown-menu>.divider,.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu>.divider{background-color:#f8f8f8}.navmenu-default .navmenu-nav.dropdown-menu>.active>a,.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu>.active>a,.navmenu-default .navmenu-nav.dropdown-menu>.active>a:hover,.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu>.active>a:hover,.navmenu-default .navmenu-nav.dropdown-menu>.active>a:focus,.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu>.active>a:focus{background-color:#d7d7d7}.navmenu-default .navmenu-nav>li>a,.navbar-default .navbar-offcanvas .navmenu-nav>li>a{color:#777}.navmenu-default .navmenu-nav>li>a:hover,.navbar-default .navbar-offcanvas .navmenu-nav>li>a:hover,.navmenu-default .navmenu-nav>li>a:focus,.navbar-default .navbar-offcanvas .navmenu-nav>li>a:focus{color:#333;background-color:transparent}.navmenu-default .navmenu-nav>.active>a,.navbar-default .navbar-offcanvas .navmenu-nav>.active>a,.navmenu-default .navmenu-nav>.active>a:hover,.navbar-default .navbar-offcanvas .navmenu-nav>.active>a:hover,.navmenu-default .navmenu-nav>.active>a:focus,.navbar-default .navbar-offcanvas .navmenu-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navmenu-default .navmenu-nav>.disabled>a,.navbar-default .navbar-offcanvas .navmenu-nav>.disabled>a,.navmenu-default .navmenu-nav>.disabled>a:hover,.navbar-default .navbar-offcanvas .navmenu-nav>.disabled>a:hover,.navmenu-default .navmenu-nav>.disabled>a:focus,.navbar-default .navbar-offcanvas .navmenu-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navmenu-inverse,.navbar-inverse .navbar-offcanvas{background-color:#222;border-color:#080808}.navmenu-inverse .navmenu-brand,.navbar-inverse .navbar-offcanvas .navmenu-brand{color:#999}.navmenu-inverse .navmenu-brand:hover,.navbar-inverse .navbar-offcanvas .navmenu-brand:hover,.navmenu-inverse .navmenu-brand:focus,.navbar-inverse .navbar-offcanvas .navmenu-brand:focus{color:#fff;background-color:transparent}.navmenu-inverse .navmenu-text,.navbar-inverse .navbar-offcanvas .navmenu-text{color:#999}.navmenu-inverse .navmenu-nav>.dropdown>a:hover .caret,.navbar-inverse .navbar-offcanvas .navmenu-nav>.dropdown>a:hover .caret,.navmenu-inverse .navmenu-nav>.dropdown>a:focus .caret,.navbar-inverse .navbar-offcanvas .navmenu-nav>.dropdown>a:focus .caret{border-top-color:#fff;border-bottom-color:#fff}.navmenu-inverse .navmenu-nav>.open>a,.navbar-inverse .navbar-offcanvas .navmenu-nav>.open>a,.navmenu-inverse .navmenu-nav>.open>a:hover,.navbar-inverse .navbar-offcanvas .navmenu-nav>.open>a:hover,.navmenu-inverse .navmenu-nav>.open>a:focus,.navbar-inverse .navbar-offcanvas .navmenu-nav>.open>a:focus{background-color:#080808;color:#fff}.navmenu-inverse .navmenu-nav>.open>a .caret,.navbar-inverse .navbar-offcanvas .navmenu-nav>.open>a .caret,.navmenu-inverse .navmenu-nav>.open>a:hover .caret,.navbar-inverse .navbar-offcanvas .navmenu-nav>.open>a:hover .caret,.navmenu-inverse .navmenu-nav>.open>a:focus .caret,.navbar-inverse .navbar-offcanvas .navmenu-nav>.open>a:focus .caret{border-top-color:#fff;border-bottom-color:#fff}.navmenu-inverse .navmenu-nav>.dropdown>a .caret,.navbar-inverse .navbar-offcanvas .navmenu-nav>.dropdown>a .caret{border-top-color:#999;border-bottom-color:#999}.navmenu-inverse .navmenu-nav.dropdown-menu,.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu{background-color:#080808}.navmenu-inverse .navmenu-nav.dropdown-menu>.divider,.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu>.divider{background-color:#222}.navmenu-inverse .navmenu-nav.dropdown-menu>.active>a,.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu>.active>a,.navmenu-inverse .navmenu-nav.dropdown-menu>.active>a:hover,.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu>.active>a:hover,.navmenu-inverse .navmenu-nav.dropdown-menu>.active>a:focus,.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu>.active>a:focus{background-color:#000}.navmenu-inverse .navmenu-nav>li>a,.navbar-inverse .navbar-offcanvas .navmenu-nav>li>a{color:#999}.navmenu-inverse .navmenu-nav>li>a:hover,.navbar-inverse .navbar-offcanvas .navmenu-nav>li>a:hover,.navmenu-inverse .navmenu-nav>li>a:focus,.navbar-inverse .navbar-offcanvas .navmenu-nav>li>a:focus{color:#fff;background-color:transparent}.navmenu-inverse .navmenu-nav>.active>a,.navbar-inverse .navbar-offcanvas .navmenu-nav>.active>a,.navmenu-inverse .navmenu-nav>.active>a:hover,.navbar-inverse .navbar-offcanvas .navmenu-nav>.active>a:hover,.navmenu-inverse .navmenu-nav>.active>a:focus,.navbar-inverse .navbar-offcanvas .navmenu-nav>.active>a:focus{color:#fff;background-color:#080808}.navmenu-inverse .navmenu-nav>.disabled>a,.navbar-inverse .navbar-offcanvas .navmenu-nav>.disabled>a,.navmenu-inverse .navmenu-nav>.disabled>a:hover,.navbar-inverse .navbar-offcanvas .navmenu-nav>.disabled>a:hover,.navmenu-inverse .navmenu-nav>.disabled>a:focus,.navbar-inverse .navbar-offcanvas .navmenu-nav>.disabled>a:focus{color:#444;background-color:transparent}.alert-fixed-top,.alert-fixed-bottom{position:fixed;width:100%;z-index:1035;border-radius:0;margin:0;left:0}@media (min-width:992px){.alert-fixed-top,.alert-fixed-bottom{width:992px;left:50%;margin-left:-496px}}.alert-fixed-top{top:0;border-width:0 0 1px}@media (min-width:992px){.alert-fixed-top{border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-width:0 1px 1px}}.alert-fixed-bottom{bottom:0;border-width:1px 0 0}@media (min-width:992px){.alert-fixed-bottom{border-top-right-radius:4px;border-top-left-radius:4px;border-width:1px 1px 0}}.offcanvas{display:none}.offcanvas.in{display:block}@media (max-width:767px){.offcanvas-xs{display:none}.offcanvas-xs.in{display:block}}@media (max-width:991px){.offcanvas-sm{display:none}.offcanvas-sm.in{display:block}}@media (max-width:1199px){.offcanvas-md{display:none}.offcanvas-md.in{display:block}}.offcanvas-lg{display:none}.offcanvas-lg.in{display:block}.canvas-sliding{-webkit-transition:top .35s,left .35s,bottom .35s,right .35s;transition:top .35s,left .35s,bottom .35s,right .35s}.offcanvas-clone{height:0!important;width:0!important;overflow:hidden!important;border:none!important;margin:0!important;padding:0!important;position:absolute!important;top:auto!important;left:auto!important;bottom:0!important;right:0!important;opacity:0!important}.table.rowlink td:not(.rowlink-skip),.table .rowlink td:not(.rowlink-skip){cursor:pointer}.table.rowlink td:not(.rowlink-skip) a,.table .rowlink td:not(.rowlink-skip) a{color:inherit;font:inherit;text-decoration:inherit}.table-hover.rowlink tr:hover td,.table-hover .rowlink tr:hover td{background-color:#cfcfcf}.btn-file{overflow:hidden;position:relative;vertical-align:middle}.btn-file>input{position:absolute;top:0;right:0;margin:0;opacity:0;filter:alpha(opacity=0);font-size:23px;height:100%;width:100%;direction:ltr;cursor:pointer}.fileinput{margin-bottom:9px;display:inline-block}.fileinput .form-control{padding-top:7px;padding-bottom:5px;display:inline-block;margin-bottom:0;vertical-align:middle;cursor:text}.fileinput .thumbnail{overflow:hidden;display:inline-block;margin-bottom:5px;vertical-align:middle;text-align:center}.fileinput .thumbnail>img{max-height:100%}.fileinput .btn{vertical-align:middle}.fileinput-exists .fileinput-new,.fileinput-new .fileinput-exists{display:none}.fileinput-inline .fileinput-controls{display:inline}.fileinput-filename{vertical-align:middle;display:inline-block;overflow:hidden}.form-control .fileinput-filename{vertical-align:bottom}.fileinput.input-group{display:table}.fileinput.input-group>*{position:relative;z-index:2}.fileinput.input-group>.btn-file{z-index:1}.fileinput-new.input-group .btn-file,.fileinput-new .input-group .btn-file{border-radius:0 4px 4px 0}.fileinput-new.input-group .btn-file.btn-xs,.fileinput-new .input-group .btn-file.btn-xs,.fileinput-new.input-group .btn-file.btn-sm,.fileinput-new .input-group .btn-file.btn-sm{border-radius:0 3px 3px 0}.fileinput-new.input-group .btn-file.btn-lg,.fileinput-new .input-group .btn-file.btn-lg{border-radius:0 6px 6px 0}.form-group.has-warning .fileinput .fileinput-preview{color:#8a6d3b}.form-group.has-warning .fileinput .thumbnail{border-color:#faebcc}.form-group.has-error .fileinput .fileinput-preview{color:#a94442}.form-group.has-error .fileinput .thumbnail{border-color:#ebccd1}.form-group.has-success .fileinput .fileinput-preview{color:#3c763d}.form-group.has-success .fileinput .thumbnail{border-color:#d6e9c6}.input-group-addon:not(:first-child){border-left:0} \ No newline at end of file
diff --git a/www/css/contrib/led.css b/www/css/contrib/led.css
new file mode 100644
index 00000000..07a1e3b9
--- /dev/null
+++ b/www/css/contrib/led.css
@@ -0,0 +1,37 @@
+/* Adapted from http://cssdeck.com/labs/css-leds */
+
+.led-red {
+ /*margin: 20px auto;*/
+ width: 12px;
+ height: 12px;
+ background-color: #940;
+ border-radius: 50%;
+ box-shadow: #000 0 -1px 7px 1px, inset #600 0 -1px 9px, #F00 0 2px 12px;
+}
+
+.led-yellow {
+ /*margin: 20px auto;*/
+ width: 12px;
+ height: 12px;
+ background-color: #A90;
+ border-radius: 50%;
+ box-shadow: #000 0 -1px 7px 1px, inset #660 0 -1px 9px, #DD0 0 2px 12px;
+}
+
+.led-green {
+ /*margin: 20px auto;*/
+ width: 12px;
+ height: 12px;
+ background-color: #690;
+ border-radius: 50%;
+ box-shadow: #000 0 -1px 7px 1px, inset #460 0 -1px 9px, #7D0 0 2px 12px;
+}
+
+.led-blue {
+ /*margin: 20px auto;*/
+ width: 12px;
+ height: 12px;
+ background-color: #4AB;
+ border-radius: 50%;
+ box-shadow: #000 0 -1px 7px 1px, inset #006 0 -1px 9px, #06F 0 2px 14px;
+}
diff --git a/www/css/contrib/vis-timeline-graph2d.min.css b/www/css/contrib/vis-timeline-graph2d.min.css
new file mode 100644
index 00000000..67fec46c
--- /dev/null
+++ b/www/css/contrib/vis-timeline-graph2d.min.css
@@ -0,0 +1 @@
+.vis .overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10}.vis-active{box-shadow:0 0 10px #86d5f8}.vis [class*=span]{min-height:0;width:auto}div.vis-configuration{position:relative;display:block;float:left;font-size:12px}div.vis-configuration-wrapper{display:block;width:700px}div.vis-configuration-wrapper::after{clear:both;content:"";display:block}div.vis-configuration.vis-config-option-container{display:block;width:495px;background-color:#fff;border:2px solid #f7f8fa;border-radius:4px;margin-top:20px;left:10px;padding-left:5px}div.vis-configuration.vis-config-button{display:block;width:495px;height:25px;vertical-align:middle;line-height:25px;background-color:#f7f8fa;border:2px solid #ceced0;border-radius:4px;margin-top:20px;left:10px;padding-left:5px;cursor:pointer;margin-bottom:30px}div.vis-configuration.vis-config-button.hover{background-color:#4588e6;border:2px solid #214373;color:#fff}div.vis-configuration.vis-config-item{display:block;float:left;width:495px;height:25px;vertical-align:middle;line-height:25px}div.vis-configuration.vis-config-item.vis-config-s2{left:10px;background-color:#f7f8fa;padding-left:5px;border-radius:3px}div.vis-configuration.vis-config-item.vis-config-s3{left:20px;background-color:#e4e9f0;padding-left:5px;border-radius:3px}div.vis-configuration.vis-config-item.vis-config-s4{left:30px;background-color:#cfd8e6;padding-left:5px;border-radius:3px}div.vis-configuration.vis-config-header{font-size:18px;font-weight:700}div.vis-configuration.vis-config-label{width:120px;height:25px;line-height:25px}div.vis-configuration.vis-config-label.vis-config-s3{width:110px}div.vis-configuration.vis-config-label.vis-config-s4{width:100px}div.vis-configuration.vis-config-colorBlock{top:1px;width:30px;height:19px;border:1px solid #444;border-radius:2px;padding:0;margin:0;cursor:pointer}input.vis-configuration.vis-config-checkbox{left:-5px}input.vis-configuration.vis-config-rangeinput{position:relative;top:-5px;width:60px;padding:1px;margin:0;pointer-events:none}input.vis-configuration.vis-config-range{-webkit-appearance:none;border:0 solid #fff;background-color:rgba(0,0,0,0);width:300px;height:20px}input.vis-configuration.vis-config-range::-webkit-slider-runnable-track{width:300px;height:5px;background:#dedede;background:-moz-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#dedede),color-stop(99%,#c8c8c8));background:-webkit-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-o-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-ms-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:linear-gradient(to bottom,#dedede 0,#c8c8c8 99%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8', GradientType=0 );border:1px solid #999;box-shadow:#aaa 0 0 3px 0;border-radius:3px}input.vis-configuration.vis-config-range::-webkit-slider-thumb{-webkit-appearance:none;border:1px solid #14334b;height:17px;width:17px;border-radius:50%;background:#3876c2;background:-moz-linear-gradient(top,#3876c2 0,#385380 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#3876c2),color-stop(100%,#385380));background:-webkit-linear-gradient(top,#3876c2 0,#385380 100%);background:-o-linear-gradient(top,#3876c2 0,#385380 100%);background:-ms-linear-gradient(top,#3876c2 0,#385380 100%);background:linear-gradient(to bottom,#3876c2 0,#385380 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#3876c2', endColorstr='#385380', GradientType=0 );box-shadow:#111927 0 0 1px 0;margin-top:-7px}input.vis-configuration.vis-config-range:focus{outline:0}input.vis-configuration.vis-config-range:focus::-webkit-slider-runnable-track{background:#9d9d9d;background:-moz-linear-gradient(top,#9d9d9d 0,#c8c8c8 99%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#9d9d9d),color-stop(99%,#c8c8c8));background:-webkit-linear-gradient(top,#9d9d9d 0,#c8c8c8 99%);background:-o-linear-gradient(top,#9d9d9d 0,#c8c8c8 99%);background:-ms-linear-gradient(top,#9d9d9d 0,#c8c8c8 99%);background:linear-gradient(to bottom,#9d9d9d 0,#c8c8c8 99%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#9d9d9d', endColorstr='#c8c8c8', GradientType=0 )}input.vis-configuration.vis-config-range::-moz-range-track{width:300px;height:10px;background:#dedede;background:-moz-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#dedede),color-stop(99%,#c8c8c8));background:-webkit-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-o-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-ms-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:linear-gradient(to bottom,#dedede 0,#c8c8c8 99%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8', GradientType=0 );border:1px solid #999;box-shadow:#aaa 0 0 3px 0;border-radius:3px}input.vis-configuration.vis-config-range::-moz-range-thumb{border:none;height:16px;width:16px;border-radius:50%;background:#385380}input.vis-configuration.vis-config-range:-moz-focusring{outline:#fff solid 1px;outline-offset:-1px}input.vis-configuration.vis-config-range::-ms-track{width:300px;height:5px;background:0 0;border-color:transparent;border-width:6px 0;color:transparent}input.vis-configuration.vis-config-range::-ms-fill-lower{background:#777;border-radius:10px}input.vis-configuration.vis-config-range::-ms-fill-upper{background:#ddd;border-radius:10px}input.vis-configuration.vis-config-range::-ms-thumb{border:none;height:16px;width:16px;border-radius:50%;background:#385380}input.vis-configuration.vis-config-range:focus::-ms-fill-lower{background:#888}input.vis-configuration.vis-config-range:focus::-ms-fill-upper{background:#ccc}.vis-configuration-popup{position:absolute;background:rgba(57,76,89,.85);border:2px solid #f2faff;line-height:30px;height:30px;width:150px;text-align:center;color:#fff;font-size:14px;border-radius:4px;-webkit-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.vis-configuration-popup:after,.vis-configuration-popup:before{left:100%;top:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.vis-configuration-popup:after{border-color:rgba(136,183,213,0);border-left-color:rgba(57,76,89,.85);border-width:8px;margin-top:-8px}.vis-configuration-popup:before{border-color:rgba(194,225,245,0);border-left-color:#f2faff;border-width:12px;margin-top:-12px}div.vis-tooltip{position:absolute;visibility:hidden;padding:5px;white-space:nowrap;font-family:verdana;font-size:14px;color:#000;background-color:#f5f4ed;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;border:1px solid #808074;box-shadow:3px 3px 10px rgba(0,0,0,.2);pointer-events:none;z-index:5}.vis-current-time{background-color:#FF7F6E;width:2px;z-index:1;pointer-events:none}.vis-rolling-mode-btn{height:40px;width:40px;position:absolute;top:7px;right:20px;border-radius:50%;font-size:28px;cursor:pointer;opacity:.8;color:#fff;font-weight:700;text-align:center;background:#3876c2}.vis-rolling-mode-btn:before{content:"\26F6"}.vis-rolling-mode-btn:hover{opacity:1}.vis-custom-time{background-color:#6E94FF;width:2px;cursor:move;z-index:1}.vis-panel.vis-background.vis-horizontal .vis-grid.vis-horizontal{position:absolute;width:100%;height:0;border-bottom:1px solid}.vis-panel.vis-background.vis-horizontal .vis-grid.vis-minor{border-color:#e5e5e5}.vis-panel.vis-background.vis-horizontal .vis-grid.vis-major{border-color:#bfbfbf}.vis-data-axis .vis-y-axis.vis-major{width:100%;position:absolute;color:#4d4d4d;white-space:nowrap}.vis-data-axis .vis-y-axis.vis-major.vis-measure{padding:0;margin:0;border:0;visibility:hidden;width:auto}.vis-data-axis .vis-y-axis.vis-minor{position:absolute;width:100%;color:#bebebe;white-space:nowrap}.vis-data-axis .vis-y-axis.vis-minor.vis-measure{padding:0;margin:0;border:0;visibility:hidden;width:auto}.vis-data-axis .vis-y-axis.vis-title{position:absolute;color:#4d4d4d;white-space:nowrap;bottom:20px;text-align:center}.vis-data-axis .vis-y-axis.vis-title.vis-measure{padding:0;margin:0;visibility:hidden;width:auto}.vis-data-axis .vis-y-axis.vis-title.vis-left{bottom:0;-webkit-transform-origin:left top;-moz-transform-origin:left top;-ms-transform-origin:left top;-o-transform-origin:left top;transform-origin:left bottom;-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);-o-transform:rotate(-90deg);transform:rotate(-90deg)}.vis-data-axis .vis-y-axis.vis-title.vis-right{bottom:0;-webkit-transform-origin:right bottom;-moz-transform-origin:right bottom;-ms-transform-origin:right bottom;-o-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.vis-legend{background-color:rgba(247,252,255,.65);padding:5px;border:1px solid #b3b3b3;box-shadow:2px 2px 10px rgba(154,154,154,.55)}.vis-legend-text{white-space:nowrap;display:inline-block}.vis-item{position:absolute;color:#1A1A1A;border-color:#97B0F8;border-width:1px;background-color:#D5DDF6;display:inline-block}.vis-item.vis-point.vis-selected,.vis-item.vis-selected{background-color:#FFF785}.vis-item.vis-selected{border-color:#FFC200;z-index:2}.vis-editable.vis-selected{cursor:move}.vis-item.vis-box{text-align:center;border-style:solid;border-radius:2px}.vis-item.vis-point{background:0 0}.vis-item.vis-dot{position:absolute;padding:0;border-width:4px;border-style:solid;border-radius:4px}.vis-item.vis-range{border-style:solid;border-radius:2px;box-sizing:border-box}.vis-item.vis-background{border:none;background-color:rgba(213,221,246,.4);box-sizing:border-box;padding:0;margin:0}.vis-item .vis-item-overflow{position:relative;width:100%;height:100%;padding:0;margin:0;overflow:hidden}.vis-item-visible-frame{white-space:nowrap}.vis-item.vis-range .vis-item-content{position:relative;display:inline-block}.vis-item.vis-background .vis-item-content{position:absolute;display:inline-block}.vis-item.vis-line{padding:0;position:absolute;width:0;border-left-width:1px;border-left-style:solid}.vis-item .vis-item-content{white-space:nowrap;box-sizing:border-box;padding:5px}.vis-item .vis-onUpdateTime-tooltip{position:absolute;background:#4f81bd;color:#fff;width:200px;text-align:center;white-space:nowrap;padding:5px;border-radius:1px}.vis-item .vis-delete,.vis-item .vis-delete-rtl{position:absolute;top:0;width:24px;height:24px;box-sizing:border-box;padding:0 5px;cursor:pointer;-webkit-transition:background .2s linear;-moz-transition:background .2s linear;-ms-transition:background .2s linear;-o-transition:background .2s linear;transition:background .2s linear}.vis-item .vis-delete{right:-24px}.vis-item .vis-delete-rtl{left:-24px}.vis-item .vis-delete-rtl:after,.vis-item .vis-delete:after{content:"\00D7";color:red;font-family:arial,sans-serif;font-size:22px;font-weight:700;-webkit-transition:color .2s linear;-moz-transition:color .2s linear;-ms-transition:color .2s linear;-o-transition:color .2s linear;transition:color .2s linear}.vis-item .vis-delete-rtl:hover,.vis-item .vis-delete:hover{background:red}.vis-item .vis-delete-rtl:hover:after,.vis-item .vis-delete:hover:after{color:#fff}.vis-item .vis-drag-center{position:absolute;width:100%;height:100%;top:0;left:0;cursor:move}.vis-item.vis-range .vis-drag-left,.vis-item.vis-range .vis-drag-right{position:absolute;width:24px;max-width:20%;min-width:2px;height:100%;top:0}.vis-item.vis-range .vis-drag-left{left:-4px;cursor:w-resize}.vis-item.vis-range .vis-drag-right{right:-4px;cursor:e-resize}.vis-range.vis-item.vis-readonly .vis-drag-left,.vis-range.vis-item.vis-readonly .vis-drag-right{cursor:auto}.vis-labelset .vis-label.draggable,.vis-nesting-group{cursor:pointer}.vis-itemset{position:relative;padding:0;margin:0;box-sizing:border-box}.vis-itemset .vis-background,.vis-itemset .vis-foreground{position:absolute;width:100%;height:100%;overflow:visible}.vis-axis{position:absolute;width:100%;height:0;left:0;z-index:1}.vis-foreground .vis-group{position:relative;box-sizing:border-box;border-bottom:1px solid #bfbfbf}.vis-foreground .vis-group:last-child{border-bottom:none}.vis-nested-group{background:#f5f5f5}.vis-label.vis-nesting-group.expanded:before{content:"\25BC"}.vis-label.vis-nesting-group.collapsed-rtl:before{content:"\25C0"}.vis-label.vis-nesting-group.collapsed:before{content:"\25B6"}.vis-overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10}.vis-labelset,.vis-labelset .vis-label{position:relative;box-sizing:border-box}.vis-labelset{overflow:hidden}.vis-labelset .vis-label{left:0;top:0;width:100%;color:#4d4d4d;border-bottom:1px solid #bfbfbf}.vis-labelset .vis-label:last-child{border-bottom:none}.vis-labelset .vis-label .vis-inner{display:inline-block;padding:5px}.vis-labelset .vis-label .vis-inner.vis-hidden{padding:0}.vis-panel{position:absolute;padding:0;margin:0;box-sizing:border-box}.vis-panel.vis-bottom,.vis-panel.vis-center,.vis-panel.vis-left,.vis-panel.vis-right,.vis-panel.vis-top{border:1px #bfbfbf}.vis-panel.vis-center,.vis-panel.vis-left,.vis-panel.vis-right{border-top-style:solid;border-bottom-style:solid;overflow:hidden}.vis-left.vis-panel.vis-vertical-scroll,.vis-right.vis-panel.vis-vertical-scroll{height:100%;overflow-x:hidden;overflow-y:scroll}.vis-background,.vis-time-axis,.vis-timeline{overflow:hidden}.vis-left.vis-panel.vis-vertical-scroll{direction:rtl}.vis-left.vis-panel.vis-vertical-scroll .vis-content,.vis-right.vis-panel.vis-vertical-scroll{direction:ltr}.vis-right.vis-panel.vis-vertical-scroll .vis-content{direction:rtl}.vis-panel.vis-bottom,.vis-panel.vis-center,.vis-panel.vis-top{border-left-style:solid;border-right-style:solid}.vis-panel>.vis-content{position:relative}.vis-panel .vis-shadow{position:absolute;width:100%;height:1px;box-shadow:0 0 10px rgba(0,0,0,.8)}.vis-panel .vis-shadow.vis-top{top:-1px;left:0}.vis-panel .vis-shadow.vis-bottom{bottom:-1px;left:0}.vis-graph-group0{fill:#4f81bd;fill-opacity:0;stroke-width:2px;stroke:#4f81bd}.vis-graph-group1{fill:#f79646;fill-opacity:0;stroke-width:2px;stroke:#f79646}.vis-graph-group2{fill:#8c51cf;fill-opacity:0;stroke-width:2px;stroke:#8c51cf}.vis-graph-group3{fill:#75c841;fill-opacity:0;stroke-width:2px;stroke:#75c841}.vis-graph-group4{fill:#ff0100;fill-opacity:0;stroke-width:2px;stroke:#ff0100}.vis-graph-group5{fill:#37d8e6;fill-opacity:0;stroke-width:2px;stroke:#37d8e6}.vis-graph-group6{fill:#042662;fill-opacity:0;stroke-width:2px;stroke:#042662}.vis-graph-group7{fill:#00ff26;fill-opacity:0;stroke-width:2px;stroke:#00ff26}.vis-graph-group8{fill:#f0f;fill-opacity:0;stroke-width:2px;stroke:#f0f}.vis-graph-group9{fill:#8f3938;fill-opacity:0;stroke-width:2px;stroke:#8f3938}.vis-timeline .vis-fill{fill-opacity:.1;stroke:none}.vis-timeline .vis-bar{fill-opacity:.5;stroke-width:1px}.vis-timeline .vis-point{stroke-width:2px;fill-opacity:1}.vis-timeline .vis-legend-background{stroke-width:1px;fill-opacity:.9;fill:#fff;stroke:#c2c2c2}.vis-timeline .vis-outline{stroke-width:1px;fill-opacity:1;fill:#fff;stroke:#e5e5e5}.vis-timeline .vis-icon-fill{fill-opacity:.3;stroke:none}.vis-time-axis{position:relative}.vis-time-axis.vis-foreground{top:0;left:0;width:100%}.vis-time-axis.vis-background{position:absolute;top:0;left:0;width:100%;height:100%}.vis-time-axis .vis-text{position:absolute;color:#4d4d4d;padding:3px;overflow:hidden;box-sizing:border-box;white-space:nowrap}.vis-time-axis .vis-text.vis-measure{position:absolute;padding-left:0;padding-right:0;margin-left:0;margin-right:0;visibility:hidden}.vis-time-axis .vis-grid.vis-vertical{position:absolute;border-left:1px solid}.vis-time-axis .vis-grid.vis-vertical-rtl{position:absolute;border-right:1px solid}.vis-time-axis .vis-grid.vis-minor{border-color:#e5e5e5}.vis-time-axis .vis-grid.vis-major{border-color:#bfbfbf}.vis-timeline{position:relative;border:1px solid #bfbfbf;padding:0;margin:0;box-sizing:border-box} \ No newline at end of file
diff --git a/www/css/contrib/vis.css b/www/css/contrib/vis.css
new file mode 100644
index 00000000..23cd790f
--- /dev/null
+++ b/www/css/contrib/vis.css
@@ -0,0 +1,1295 @@
+.vis .overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+
+ /* Must be displayed above for example selected Timeline items */
+ z-index: 10;
+}
+
+.vis-active {
+ box-shadow: 0 0 10px #86d5f8;
+}
+
+/* override some bootstrap styles screwing up the timelines css */
+
+.vis [class*="span"] {
+ min-height: 0;
+ width: auto;
+}
+
+div.vis-configuration {
+ position:relative;
+ display:block;
+ float:left;
+ font-size:12px;
+}
+
+div.vis-configuration-wrapper {
+ display:block;
+ width:700px;
+}
+
+
+div.vis-configuration.vis-config-option-container{
+ display:block;
+ width:495px;
+ background-color: #ffffff;
+ border:2px solid #f7f8fa;
+ border-radius:4px;
+ margin-top:20px;
+ left:10px;
+ padding-left:5px;
+}
+
+div.vis-configuration.vis-config-button{
+ display:block;
+ width:495px;
+ height:25px;
+ vertical-align: middle;
+ line-height:25px;
+ background-color: #f7f8fa;
+ border:2px solid #ceced0;
+ border-radius:4px;
+ margin-top:20px;
+ left:10px;
+ padding-left:5px;
+ cursor: pointer;
+ margin-bottom:30px;
+}
+
+div.vis-configuration.vis-config-button.hover{
+ background-color: #4588e6;
+ border:2px solid #214373;
+ color:#ffffff;
+}
+
+div.vis-configuration.vis-config-item{
+ display:block;
+ float:left;
+ width:495px;
+ height:25px;
+ vertical-align: middle;
+ line-height:25px;
+}
+
+
+div.vis-configuration.vis-config-item.vis-config-s2{
+ left:10px;
+ background-color: #f7f8fa;
+ padding-left:5px;
+ border-radius:3px;
+}
+div.vis-configuration.vis-config-item.vis-config-s3{
+ left:20px;
+ background-color: #e4e9f0;
+ padding-left:5px;
+ border-radius:3px;
+}
+div.vis-configuration.vis-config-item.vis-config-s4{
+ left:30px;
+ background-color: #cfd8e6;
+ padding-left:5px;
+ border-radius:3px;
+}
+
+div.vis-configuration.vis-config-header{
+ font-size:18px;
+ font-weight: bold;
+}
+
+div.vis-configuration.vis-config-label{
+ width:120px;
+ height:25px;
+ line-height: 25px;
+}
+
+div.vis-configuration.vis-config-label.vis-config-s3{
+ width:110px;
+}
+div.vis-configuration.vis-config-label.vis-config-s4{
+ width:100px;
+}
+
+div.vis-configuration.vis-config-colorBlock{
+ top:1px;
+ width:30px;
+ height:19px;
+ border:1px solid #444444;
+ border-radius:2px;
+ padding:0px;
+ margin:0px;
+ cursor:pointer;
+}
+
+input.vis-configuration.vis-config-checkbox {
+ left:-5px;
+}
+
+
+input.vis-configuration.vis-config-rangeinput{
+ position:relative;
+ top:-5px;
+ width:60px;
+ height:13px;
+ padding:1px;
+ margin:0;
+ pointer-events:none;
+}
+
+input.vis-configuration.vis-config-range{
+ /*removes default webkit styles*/
+ -webkit-appearance: none;
+
+ /*fix for FF unable to apply focus style bug */
+ border: 0px solid white;
+ background-color:rgba(0,0,0,0);
+
+ /*required for proper track sizing in FF*/
+ width: 300px;
+ height:20px;
+}
+input.vis-configuration.vis-config-range::-webkit-slider-runnable-track {
+ width: 300px;
+ height: 5px;
+ background: #dedede; /* Old browsers */
+ background: -moz-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dedede), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #dedede 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #dedede 0%,#c8c8c8 99%); /* IE10+ */
+ background: linear-gradient(to bottom, #dedede 0%,#c8c8c8 99%); /* W3C */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */
+
+ border: 1px solid #999999;
+ box-shadow: #aaaaaa 0px 0px 3px 0px;
+ border-radius: 3px;
+}
+input.vis-configuration.vis-config-range::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ border: 1px solid #14334b;
+ height: 17px;
+ width: 17px;
+ border-radius: 50%;
+ background: #3876c2; /* Old browsers */
+ background: -moz-linear-gradient(top, #3876c2 0%, #385380 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3876c2), color-stop(100%,#385380)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #3876c2 0%,#385380 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #3876c2 0%,#385380 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #3876c2 0%,#385380 100%); /* IE10+ */
+ background: linear-gradient(to bottom, #3876c2 0%,#385380 100%); /* W3C */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3876c2', endColorstr='#385380',GradientType=0 ); /* IE6-9 */
+ box-shadow: #111927 0px 0px 1px 0px;
+ margin-top: -7px;
+}
+input.vis-configuration.vis-config-range:focus {
+ outline: none;
+}
+input.vis-configuration.vis-config-range:focus::-webkit-slider-runnable-track {
+ background: #9d9d9d; /* Old browsers */
+ background: -moz-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9d9d9d), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #9d9d9d 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #9d9d9d 0%,#c8c8c8 99%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #9d9d9d 0%,#c8c8c8 99%); /* IE10+ */
+ background: linear-gradient(to bottom, #9d9d9d 0%,#c8c8c8 99%); /* W3C */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9d9d9d', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */
+}
+
+input.vis-configuration.vis-config-range::-moz-range-track {
+ width: 300px;
+ height: 10px;
+ background: #dedede; /* Old browsers */
+ background: -moz-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dedede), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #dedede 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #dedede 0%,#c8c8c8 99%); /* IE10+ */
+ background: linear-gradient(to bottom, #dedede 0%,#c8c8c8 99%); /* W3C */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */
+
+ border: 1px solid #999999;
+ box-shadow: #aaaaaa 0px 0px 3px 0px;
+ border-radius: 3px;
+}
+input.vis-configuration.vis-config-range::-moz-range-thumb {
+ border: none;
+ height: 16px;
+ width: 16px;
+
+ border-radius: 50%;
+ background: #385380;
+}
+
+/*hide the outline behind the border*/
+input.vis-configuration.vis-config-range:-moz-focusring{
+ outline: 1px solid white;
+ outline-offset: -1px;
+}
+
+input.vis-configuration.vis-config-range::-ms-track {
+ width: 300px;
+ height: 5px;
+
+ /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
+ background: transparent;
+
+ /*leave room for the larger thumb to overflow with a transparent border */
+ border-color: transparent;
+ border-width: 6px 0;
+
+ /*remove default tick marks*/
+ color: transparent;
+}
+input.vis-configuration.vis-config-range::-ms-fill-lower {
+ background: #777;
+ border-radius: 10px;
+}
+input.vis-configuration.vis-config-range::-ms-fill-upper {
+ background: #ddd;
+ border-radius: 10px;
+}
+input.vis-configuration.vis-config-range::-ms-thumb {
+ border: none;
+ height: 16px;
+ width: 16px;
+ border-radius: 50%;
+ background: #385380;
+}
+input.vis-configuration.vis-config-range:focus::-ms-fill-lower {
+ background: #888;
+}
+input.vis-configuration.vis-config-range:focus::-ms-fill-upper {
+ background: #ccc;
+}
+
+.vis-configuration-popup {
+ position: absolute;
+ background: rgba(57, 76, 89, 0.85);
+ border: 2px solid #f2faff;
+ line-height:30px;
+ height:30px;
+ width:150px;
+ text-align:center;
+ color: #ffffff;
+ font-size:14px;
+ border-radius:4px;
+ -webkit-transition: opacity 0.3s ease-in-out;
+ -moz-transition: opacity 0.3s ease-in-out;
+ transition: opacity 0.3s ease-in-out;
+}
+.vis-configuration-popup:after, .vis-configuration-popup:before {
+ left: 100%;
+ top: 50%;
+ border: solid transparent;
+ content: " ";
+ height: 0;
+ width: 0;
+ position: absolute;
+ pointer-events: none;
+}
+
+.vis-configuration-popup:after {
+ border-color: rgba(136, 183, 213, 0);
+ border-left-color: rgba(57, 76, 89, 0.85);
+ border-width: 8px;
+ margin-top: -8px;
+}
+.vis-configuration-popup:before {
+ border-color: rgba(194, 225, 245, 0);
+ border-left-color: #f2faff;
+ border-width: 12px;
+ margin-top: -12px;
+}
+
+.vis-timeline {
+ position: relative;
+ border: 1px solid #bfbfbf;
+
+ overflow: hidden;
+ padding: 0;
+ margin: 0;
+
+ box-sizing: border-box;
+}
+
+
+.vis-panel {
+ position: absolute;
+
+ padding: 0;
+ margin: 0;
+
+ box-sizing: border-box;
+}
+
+.vis-panel.vis-center,
+.vis-panel.vis-left,
+.vis-panel.vis-right,
+.vis-panel.vis-top,
+.vis-panel.vis-bottom {
+ border: 1px #bfbfbf;
+}
+
+.vis-panel.vis-center,
+.vis-panel.vis-left,
+.vis-panel.vis-right {
+ border-top-style: solid;
+ border-bottom-style: solid;
+ overflow: hidden;
+}
+
+.vis-panel.vis-center,
+.vis-panel.vis-top,
+.vis-panel.vis-bottom {
+ border-left-style: solid;
+ border-right-style: solid;
+}
+
+.vis-background {
+ overflow: hidden;
+}
+
+.vis-panel > .vis-content {
+ position: relative;
+}
+
+.vis-panel .vis-shadow {
+ position: absolute;
+ width: 100%;
+ height: 1px;
+ box-shadow: 0 0 10px rgba(0,0,0,0.8);
+ /* TODO: find a nice way to ensure vis-shadows are drawn on top of items
+ z-index: 1;
+ */
+}
+
+.vis-panel .vis-shadow.vis-top {
+ top: -1px;
+ left: 0;
+}
+
+.vis-panel .vis-shadow.vis-bottom {
+ bottom: -1px;
+ left: 0;
+}
+
+.vis-labelset {
+ position: relative;
+
+ overflow: hidden;
+
+ box-sizing: border-box;
+}
+
+.vis-labelset .vis-label {
+ position: relative;
+ left: 0;
+ top: 0;
+ width: 100%;
+ color: #4d4d4d;
+
+ box-sizing: border-box;
+}
+
+.vis-labelset .vis-label {
+ border-bottom: 1px solid #bfbfbf;
+}
+
+.vis-labelset .vis-label.draggable {
+ cursor: pointer;
+}
+
+.vis-labelset .vis-label:last-child {
+ border-bottom: none;
+}
+
+.vis-labelset .vis-label .vis-inner {
+ display: inline-block;
+ padding: 5px;
+}
+
+.vis-labelset .vis-label .vis-inner.vis-hidden {
+ padding: 0;
+}
+
+
+.vis-itemset {
+ position: relative;
+ padding: 0;
+ margin: 0;
+
+ box-sizing: border-box;
+}
+
+.vis-itemset .vis-background,
+.vis-itemset .vis-foreground {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ overflow: visible;
+}
+
+.vis-axis {
+ position: absolute;
+ width: 100%;
+ height: 0;
+ left: 0;
+ z-index: 1;
+}
+
+.vis-foreground .vis-group {
+ position: relative;
+ box-sizing: border-box;
+ border-bottom: 1px solid #bfbfbf;
+}
+
+.vis-foreground .vis-group:last-child {
+ border-bottom: none;
+}
+
+.vis-overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 10;
+}
+
+.vis-item {
+ position: absolute;
+ color: #1A1A1A;
+ border-color: #97B0F8;
+ border-width: 1px;
+ background-color: #D5DDF6;
+ display: inline-block;
+ /*overflow: hidden;*/
+}
+
+.vis-item.vis-selected {
+ border-color: #FFC200;
+ background-color: #FFF785;
+
+ /* z-index must be higher than the z-index of custom time bar and current time bar */
+ z-index: 2;
+}
+
+.vis-editable.vis-selected {
+ cursor: move;
+}
+
+.vis-item.vis-point.vis-selected {
+ background-color: #FFF785;
+}
+
+.vis-item.vis-box {
+ text-align: center;
+ border-style: solid;
+ border-radius: 2px;
+}
+
+.vis-item.vis-point {
+ background: none;
+}
+
+.vis-item.vis-dot {
+ position: absolute;
+ padding: 0;
+ border-width: 4px;
+ border-style: solid;
+ border-radius: 4px;
+}
+
+.vis-item.vis-range {
+ border-style: solid;
+ border-radius: 2px;
+ box-sizing: border-box;
+}
+
+.vis-item.vis-background {
+ border: none;
+ background-color: rgba(213, 221, 246, 0.4);
+ box-sizing: border-box;
+ padding: 0;
+ margin: 0;
+}
+
+.vis-item .vis-item-overflow {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ padding: 0;
+ margin: 0;
+ overflow: hidden;
+}
+
+.vis-item.vis-range .vis-item-content {
+ position: relative;
+ display: inline-block;
+}
+
+.vis-item.vis-background .vis-item-content {
+ position: absolute;
+ display: inline-block;
+}
+
+.vis-item.vis-line {
+ padding: 0;
+ position: absolute;
+ width: 0;
+ border-left-width: 1px;
+ border-left-style: solid;
+}
+
+.vis-item .vis-item-content {
+ white-space: nowrap;
+ box-sizing: border-box;
+ padding: 5px;
+}
+
+.vis-item .vis-delete {
+ background: url('img/timeline/delete.png') no-repeat center;
+ position: absolute;
+ width: 24px;
+ height: 24px;
+ top: -4px;
+ right: -24px;
+ cursor: pointer;
+}
+
+.vis-item.vis-range .vis-drag-left {
+ position: absolute;
+ width: 24px;
+ max-width: 20%;
+ min-width: 2px;
+ height: 100%;
+ top: 0;
+ left: -4px;
+
+ cursor: w-resize;
+}
+
+.vis-item.vis-range .vis-drag-right {
+ position: absolute;
+ width: 24px;
+ max-width: 20%;
+ min-width: 2px;
+ height: 100%;
+ top: 0;
+ right: -4px;
+
+ cursor: e-resize;
+}
+
+.vis-time-axis {
+ position: relative;
+ overflow: hidden;
+}
+
+.vis-time-axis.vis-foreground {
+ top: 0;
+ left: 0;
+ width: 100%;
+}
+
+.vis-time-axis.vis-background {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.vis-time-axis .vis-text {
+ position: absolute;
+ color: #4d4d4d;
+ padding: 3px;
+ overflow: hidden;
+ box-sizing: border-box;
+
+ white-space: nowrap;
+}
+
+.vis-time-axis .vis-text.vis-measure {
+ position: absolute;
+ padding-left: 0;
+ padding-right: 0;
+ margin-left: 0;
+ margin-right: 0;
+ visibility: hidden;
+}
+
+.vis-time-axis .vis-grid.vis-vertical {
+ position: absolute;
+ border-left: 1px solid;
+}
+
+.vis-time-axis .vis-grid.vis-minor {
+ border-color: #e5e5e5;
+}
+
+.vis-time-axis .vis-grid.vis-major {
+ border-color: #bfbfbf;
+}
+
+.vis-current-time {
+ background-color: #FF7F6E;
+ width: 2px;
+ z-index: 1;
+}
+.vis-custom-time {
+ background-color: #6E94FF;
+ width: 2px;
+ cursor: move;
+ z-index: 1;
+}
+.vis-timeline {
+ /*
+ -webkit-transition: height .4s ease-in-out;
+ transition: height .4s ease-in-out;
+ */
+}
+
+.vis-panel {
+ /*
+ -webkit-transition: height .4s ease-in-out, top .4s ease-in-out;
+ transition: height .4s ease-in-out, top .4s ease-in-out;
+ */
+}
+
+.vis-axis {
+ /*
+ -webkit-transition: top .4s ease-in-out;
+ transition: top .4s ease-in-out;
+ */
+}
+
+/* TODO: get animation working nicely
+
+.vis-item {
+ -webkit-transition: top .4s ease-in-out;
+ transition: top .4s ease-in-out;
+}
+
+.vis-item.line {
+ -webkit-transition: height .4s ease-in-out, top .4s ease-in-out;
+ transition: height .4s ease-in-out, top .4s ease-in-out;
+}
+/**/
+
+.vis-panel.vis-background.vis-horizontal .vis-grid.vis-horizontal {
+ position: absolute;
+ width: 100%;
+ height: 0;
+ border-bottom: 1px solid;
+}
+
+.vis-panel.vis-background.vis-horizontal .vis-grid.vis-minor {
+ border-color: #e5e5e5;
+}
+
+.vis-panel.vis-background.vis-horizontal .vis-grid.vis-major {
+ border-color: #bfbfbf;
+}
+
+
+.vis-data-axis .vis-y-axis.vis-major {
+ width: 100%;
+ position: absolute;
+ color: #4d4d4d;
+ white-space: nowrap;
+}
+
+.vis-data-axis .vis-y-axis.vis-major.vis-measure {
+ padding: 0;
+ margin: 0;
+ border: 0;
+ visibility: hidden;
+ width: auto;
+}
+
+
+.vis-data-axis .vis-y-axis.vis-minor {
+ position: absolute;
+ width: 100%;
+ color: #bebebe;
+ white-space: nowrap;
+}
+
+.vis-data-axis .vis-y-axis.vis-minor.vis-measure {
+ padding: 0;
+ margin: 0;
+ border: 0;
+ visibility: hidden;
+ width: auto;
+}
+
+.vis-data-axis .vis-y-axis.vis-title {
+ position: absolute;
+ color: #4d4d4d;
+ white-space: nowrap;
+ bottom: 20px;
+ text-align: center;
+}
+
+.vis-data-axis .vis-y-axis.vis-title.vis-measure {
+ padding: 0;
+ margin: 0;
+ visibility: hidden;
+ width: auto;
+}
+
+.vis-data-axis .vis-y-axis.vis-title.vis-left {
+ bottom: 0;
+ -webkit-transform-origin: left top;
+ -moz-transform-origin: left top;
+ -ms-transform-origin: left top;
+ -o-transform-origin: left top;
+ transform-origin: left bottom;
+ -webkit-transform: rotate(-90deg);
+ -moz-transform: rotate(-90deg);
+ -ms-transform: rotate(-90deg);
+ -o-transform: rotate(-90deg);
+ transform: rotate(-90deg);
+}
+
+.vis-data-axis .vis-y-axis.vis-title.vis-right {
+ bottom: 0;
+ -webkit-transform-origin: right bottom;
+ -moz-transform-origin: right bottom;
+ -ms-transform-origin: right bottom;
+ -o-transform-origin: right bottom;
+ transform-origin: right bottom;
+ -webkit-transform: rotate(90deg);
+ -moz-transform: rotate(90deg);
+ -ms-transform: rotate(90deg);
+ -o-transform: rotate(90deg);
+ transform: rotate(90deg);
+}
+
+.vis-legend {
+ background-color: rgba(247, 252, 255, 0.65);
+ padding: 5px;
+ border: 1px solid #b3b3b3;
+ box-shadow: 2px 2px 10px rgba(154, 154, 154, 0.55);
+}
+
+.vis-legend-text {
+ /*font-size: 10px;*/
+ white-space: nowrap;
+ display: inline-block
+}
+.vis-graph-group0 {
+ fill:#4f81bd;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #4f81bd;
+}
+
+.vis-graph-group1 {
+ fill:#f79646;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #f79646;
+}
+
+.vis-graph-group2 {
+ fill: #8c51cf;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #8c51cf;
+}
+
+.vis-graph-group3 {
+ fill: #75c841;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #75c841;
+}
+
+.vis-graph-group4 {
+ fill: #ff0100;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #ff0100;
+}
+
+.vis-graph-group5 {
+ fill: #37d8e6;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #37d8e6;
+}
+
+.vis-graph-group6 {
+ fill: #042662;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #042662;
+}
+
+.vis-graph-group7 {
+ fill:#00ff26;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #00ff26;
+}
+
+.vis-graph-group8 {
+ fill:#ff00ff;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #ff00ff;
+}
+
+.vis-graph-group9 {
+ fill: #8f3938;
+ fill-opacity:0;
+ stroke-width:2px;
+ stroke: #8f3938;
+}
+
+.vis-timeline .vis-fill {
+ fill-opacity:0.1;
+ stroke: none;
+}
+
+
+.vis-timeline .vis-bar {
+ fill-opacity:0.5;
+ stroke-width:1px;
+}
+
+.vis-timeline .vis-point {
+ stroke-width:2px;
+ fill-opacity:1.0;
+}
+
+
+.vis-timeline .vis-legend-background {
+ stroke-width:1px;
+ fill-opacity:0.9;
+ fill: #ffffff;
+ stroke: #c2c2c2;
+}
+
+
+.vis-timeline .vis-outline {
+ stroke-width:1px;
+ fill-opacity:1;
+ fill: #ffffff;
+ stroke: #e5e5e5;
+}
+
+.vis-timeline .vis-icon-fill {
+ fill-opacity:0.3;
+ stroke: none;
+}
+
+div.vis-network div.vis-manipulation {
+ border-width: 0;
+ border-bottom: 1px;
+ border-style:solid;
+ border-color: #d6d9d8;
+ background: #ffffff; /* Old browsers */
+ background: -moz-linear-gradient(top, #ffffff 0%, #fcfcfc 48%, #fafafa 50%, #fcfcfc 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(48%,#fcfcfc), color-stop(50%,#fafafa), color-stop(100%,#fcfcfc)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* IE10+ */
+ background: linear-gradient(to bottom, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* W3C */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fcfcfc',GradientType=0 ); /* IE6-9 */
+
+ padding-top:4px;
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 28px;
+}
+
+div.vis-network div.vis-edit-mode {
+ position:absolute;
+ left: 0;
+ top: 5px;
+ height: 30px;
+}
+
+/* FIXME: shouldn't the vis-close button be a child of the vis-manipulation div? */
+
+div.vis-network div.vis-close {
+ position:absolute;
+ right: 0;
+ top: 0;
+ width: 30px;
+ height: 30px;
+
+ background-position: 20px 3px;
+ background-repeat: no-repeat;
+ background-image: url("img/network/cross.png");
+ cursor: pointer;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+div.vis-network div.vis-close:hover {
+ opacity: 0.6;
+}
+
+div.vis-network div.vis-manipulation div.vis-button,
+div.vis-network div.vis-edit-mode div.vis-button {
+ float:left;
+ font-family: verdana;
+ font-size: 12px;
+ -moz-border-radius: 15px;
+ border-radius: 15px;
+ display:inline-block;
+ background-position: 0px 0px;
+ background-repeat:no-repeat;
+ height:24px;
+ margin-left: 10px;
+ /*vertical-align:middle;*/
+ cursor: pointer;
+ padding: 0px 8px 0px 8px;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+div.vis-network div.vis-manipulation div.vis-button:hover {
+ box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.20);
+}
+
+div.vis-network div.vis-manipulation div.vis-button:active {
+ box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.50);
+}
+
+div.vis-network div.vis-manipulation div.vis-button.vis-back {
+ background-image: url("img/network/backIcon.png");
+}
+
+div.vis-network div.vis-manipulation div.vis-button.vis-none:hover {
+ box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.0);
+ cursor: default;
+}
+div.vis-network div.vis-manipulation div.vis-button.vis-none:active {
+ box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.0);
+}
+div.vis-network div.vis-manipulation div.vis-button.vis-none {
+ padding: 0;
+}
+div.vis-network div.vis-manipulation div.notification {
+ margin: 2px;
+ font-weight: bold;
+}
+
+div.vis-network div.vis-manipulation div.vis-button.vis-add {
+ background-image: url("img/network/addNodeIcon.png");
+}
+
+div.vis-network div.vis-manipulation div.vis-button.vis-edit,
+div.vis-network div.vis-edit-mode div.vis-button.vis-edit {
+ background-image: url("img/network/editIcon.png");
+}
+
+div.vis-network div.vis-edit-mode div.vis-button.vis-edit.vis-edit-mode {
+ background-color: #fcfcfc;
+ border: 1px solid #cccccc;
+}
+
+div.vis-network div.vis-manipulation div.vis-button.vis-connect {
+ background-image: url("img/network/connectIcon.png");
+}
+
+div.vis-network div.vis-manipulation div.vis-button.vis-delete {
+ background-image: url("img/network/deleteIcon.png");
+}
+/* top right bottom left */
+div.vis-network div.vis-manipulation div.vis-label,
+div.vis-network div.vis-edit-mode div.vis-label {
+ margin: 0 0 0 23px;
+ line-height: 25px;
+}
+div.vis-network div.vis-manipulation div.vis-separator-line {
+ float:left;
+ display:inline-block;
+ width:1px;
+ height:21px;
+ background-color: #bdbdbd;
+ margin: 0px 7px 0 15px; /*top right bottom left*/
+}
+
+/* TODO: is this redundant?
+div.network-navigation_wrapper {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+}
+*/
+div.vis-network-tooltip {
+ position: absolute;
+ visibility: hidden;
+ padding: 5px;
+ white-space: nowrap;
+
+ font-family: verdana;
+ font-size:14px;
+ font-color:#000000;
+ background-color: #f5f4ed;
+
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ border: 1px solid #808074;
+
+ box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
+ pointer-events: none;
+}
+div.vis-network div.vis-navigation div.vis-button {
+ width:34px;
+ height:34px;
+ -moz-border-radius: 17px;
+ border-radius: 17px;
+ position:absolute;
+ display:inline-block;
+ background-position: 2px 2px;
+ background-repeat:no-repeat;
+ cursor: pointer;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+div.vis-network div.vis-navigation div.vis-button:hover {
+ box-shadow: 0 0 3px 3px rgba(56, 207, 21, 0.30);
+}
+
+div.vis-network div.vis-navigation div.vis-button:active {
+ box-shadow: 0 0 1px 3px rgba(56, 207, 21, 0.95);
+}
+
+div.vis-network div.vis-navigation div.vis-button.vis-up {
+ background-image: url("img/network/upArrow.png");
+ bottom:50px;
+ left:55px;
+}
+div.vis-network div.vis-navigation div.vis-button.vis-down {
+ background-image: url("img/network/downArrow.png");
+ bottom:10px;
+ left:55px;
+}
+div.vis-network div.vis-navigation div.vis-button.vis-left {
+ background-image: url("img/network/leftArrow.png");
+ bottom:10px;
+ left:15px;
+}
+div.vis-network div.vis-navigation div.vis-button.vis-right {
+ background-image: url("img/network/rightArrow.png");
+ bottom:10px;
+ left:95px;
+}
+div.vis-network div.vis-navigation div.vis-button.vis-zoomIn {
+ background-image: url("img/network/plus.png");
+ bottom:10px;
+ right:15px;
+}
+div.vis-network div.vis-navigation div.vis-button.vis-zoomOut {
+ background-image: url("img/network/minus.png");
+ bottom:10px;
+ right:55px;
+}
+div.vis-network div.vis-navigation div.vis-button.vis-zoomExtends {
+ background-image: url("img/network/zoomExtends.png");
+ bottom:50px;
+ right:15px;
+}
+
+div.vis-color-picker {
+ position:absolute;
+ margin-top:-140px;
+ margin-left:30px;
+ width:293px;
+ height:425px;
+ padding: 10px;
+ border-radius:15px;
+ background-color:#ffffff;
+ display:none;
+ box-shadow: rgba(0,0,0,0.5) 0px 0px 10px 0px;
+}
+
+div.vis-color-picker div.vis-arrow {
+ position: absolute;
+ top:147px;
+ left:5px;
+}
+
+div.vis-color-picker div.vis-arrow:after,
+div.vis-color-picker div.vis-arrow:before {
+ right: 100%;
+ top: 50%;
+ border: solid transparent;
+ content: " ";
+ height: 0;
+ width: 0;
+ position: absolute;
+ pointer-events: none;
+}
+
+div.vis-color-picker div.vis-arrow:after {
+ border-color: rgba(255, 255, 255, 0);
+ border-right-color: #ffffff;
+ border-width: 30px;
+ margin-top: -30px;
+}
+
+div.vis-color-picker div.vis-color {
+ position:absolute;
+ width: 289px;
+ height: 289px;
+ cursor: pointer;
+}
+
+
+
+div.vis-color-picker div.vis-brightness {
+ position: absolute;
+ top:313px;
+}
+
+div.vis-color-picker div.vis-opacity {
+ position:absolute;
+ top:350px;
+}
+
+div.vis-color-picker div.vis-selector {
+ position:absolute;
+ top:137px;
+ left:137px;
+ width:15px;
+ height:15px;
+ border-radius:15px;
+ border:1px solid #ffffff;
+ background: #4c4c4c; /* Old browsers */
+ background: -moz-linear-gradient(top, #4c4c4c 0%, #595959 12%, #666666 25%, #474747 39%, #2c2c2c 50%, #000000 51%, #111111 60%, #2b2b2b 76%, #1c1c1c 91%, #131313 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4c4c4c), color-stop(12%,#595959), color-stop(25%,#666666), color-stop(39%,#474747), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(60%,#111111), color-stop(76%,#2b2b2b), color-stop(91%,#1c1c1c), color-stop(100%,#131313)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #4c4c4c 0%,#595959 12%,#666666 25%,#474747 39%,#2c2c2c 50%,#000000 51%,#111111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #4c4c4c 0%,#595959 12%,#666666 25%,#474747 39%,#2c2c2c 50%,#000000 51%,#111111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #4c4c4c 0%,#595959 12%,#666666 25%,#474747 39%,#2c2c2c 50%,#000000 51%,#111111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%); /* IE10+ */
+ background: linear-gradient(to bottom, #4c4c4c 0%,#595959 12%,#666666 25%,#474747 39%,#2c2c2c 50%,#000000 51%,#111111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%); /* W3C */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313',GradientType=0 ); /* IE6-9 */
+}
+
+
+
+div.vis-color-picker div.vis-new-color {
+ position:absolute;
+ width:140px;
+ height:20px;
+ border:1px solid rgba(0,0,0,0.1);
+ border-radius:5px;
+ top:380px;
+ left:159px;
+ text-align:right;
+ padding-right:2px;
+ font-size:10px;
+ color:rgba(0,0,0,0.4);
+ vertical-align:middle;
+ line-height:20px;
+
+}
+
+div.vis-color-picker div.vis-initial-color {
+ position:absolute;
+ width:140px;
+ height:20px;
+ border:1px solid rgba(0,0,0,0.1);
+ border-radius:5px;
+ top:380px;
+ left:10px;
+ text-align:left;
+ padding-left:2px;
+ font-size:10px;
+ color:rgba(0,0,0,0.4);
+ vertical-align:middle;
+ line-height:20px;
+}
+
+div.vis-color-picker div.vis-label {
+ position:absolute;
+ width:300px;
+ left:10px;
+}
+
+div.vis-color-picker div.vis-label.vis-brightness {
+ top:300px;
+}
+
+div.vis-color-picker div.vis-label.vis-opacity {
+ top:338px;
+}
+
+div.vis-color-picker div.vis-button {
+ position:absolute;
+ width:68px;
+ height:25px;
+ border-radius:10px;
+ vertical-align: middle;
+ text-align:center;
+ line-height: 25px;
+ top:410px;
+ border:2px solid #d9d9d9;
+ background-color: #f7f7f7;
+ cursor:pointer;
+}
+
+div.vis-color-picker div.vis-button.vis-cancel {
+ /*border:2px solid #ff4e33;*/
+ /*background-color: #ff7761;*/
+ left:5px;
+}
+div.vis-color-picker div.vis-button.vis-load {
+ /*border:2px solid #a153e6;*/
+ /*background-color: #cb8dff;*/
+ left:82px;
+}
+div.vis-color-picker div.vis-button.vis-apply {
+ /*border:2px solid #4588e6;*/
+ /*background-color: #82b6ff;*/
+ left:159px;
+}
+div.vis-color-picker div.vis-button.vis-save {
+ /*border:2px solid #45e655;*/
+ /*background-color: #6dff7c;*/
+ left:236px;
+}
+
+
+div.vis-color-picker input.vis-range {
+ width: 290px;
+ height:20px;
+}
+
+/* TODO: is this redundant?
+div.vis-color-picker input.vis-range-brightness {
+ width: 289px !important;
+}
+
+
+div.vis-color-picker input.vis-saturation-range {
+ width: 289px !important;
+}*/ \ No newline at end of file
diff --git a/www/css/contrib/vis.min.css b/www/css/contrib/vis.min.css
new file mode 100644
index 00000000..4c4f34be
--- /dev/null
+++ b/www/css/contrib/vis.min.css
@@ -0,0 +1 @@
+.vis-background,.vis-labelset,.vis-timeline{overflow:hidden}.vis .overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10}.vis-active{box-shadow:0 0 10px #86d5f8}.vis [class*=span]{min-height:0;width:auto}div.vis-configuration{position:relative;display:block;float:left;font-size:12px}div.vis-configuration-wrapper{display:block;width:700px}div.vis-configuration.vis-config-option-container{display:block;width:495px;background-color:#fff;border:2px solid #f7f8fa;border-radius:4px;margin-top:20px;left:10px;padding-left:5px}div.vis-configuration.vis-config-button{display:block;width:495px;height:25px;vertical-align:middle;line-height:25px;background-color:#f7f8fa;border:2px solid #ceced0;border-radius:4px;margin-top:20px;left:10px;padding-left:5px;cursor:pointer;margin-bottom:30px}div.vis-configuration.vis-config-button.hover{background-color:#4588e6;border:2px solid #214373;color:#fff}div.vis-configuration.vis-config-item{display:block;float:left;width:495px;height:25px;vertical-align:middle;line-height:25px}div.vis-configuration.vis-config-item.vis-config-s2{left:10px;background-color:#f7f8fa;padding-left:5px;border-radius:3px}div.vis-configuration.vis-config-item.vis-config-s3{left:20px;background-color:#e4e9f0;padding-left:5px;border-radius:3px}div.vis-configuration.vis-config-item.vis-config-s4{left:30px;background-color:#cfd8e6;padding-left:5px;border-radius:3px}div.vis-configuration.vis-config-header{font-size:18px;font-weight:700}div.vis-configuration.vis-config-label{width:120px;height:25px;line-height:25px}div.vis-configuration.vis-config-label.vis-config-s3{width:110px}div.vis-configuration.vis-config-label.vis-config-s4{width:100px}div.vis-configuration.vis-config-colorBlock{top:1px;width:30px;height:19px;border:1px solid #444;border-radius:2px;padding:0;margin:0;cursor:pointer}input.vis-configuration.vis-config-checkbox{left:-5px}input.vis-configuration.vis-config-rangeinput{position:relative;top:-5px;width:60px;height:13px;padding:1px;margin:0;pointer-events:none}.vis-panel,.vis-timeline{padding:0;box-sizing:border-box}input.vis-configuration.vis-config-range{-webkit-appearance:none;border:0 solid #fff;background-color:rgba(0,0,0,0);width:300px;height:20px}input.vis-configuration.vis-config-range::-webkit-slider-runnable-track{width:300px;height:5px;background:#dedede;background:-moz-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#dedede),color-stop(99%,#c8c8c8));background:-webkit-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-o-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-ms-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:linear-gradient(to bottom,#dedede 0,#c8c8c8 99%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8', GradientType=0 );border:1px solid #999;box-shadow:#aaa 0 0 3px 0;border-radius:3px}input.vis-configuration.vis-config-range::-webkit-slider-thumb{-webkit-appearance:none;border:1px solid #14334b;height:17px;width:17px;border-radius:50%;background:#3876c2;background:-moz-linear-gradient(top,#3876c2 0,#385380 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#3876c2),color-stop(100%,#385380));background:-webkit-linear-gradient(top,#3876c2 0,#385380 100%);background:-o-linear-gradient(top,#3876c2 0,#385380 100%);background:-ms-linear-gradient(top,#3876c2 0,#385380 100%);background:linear-gradient(to bottom,#3876c2 0,#385380 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#3876c2', endColorstr='#385380', GradientType=0 );box-shadow:#111927 0 0 1px 0;margin-top:-7px}input.vis-configuration.vis-config-range:focus{outline:0}input.vis-configuration.vis-config-range:focus::-webkit-slider-runnable-track{background:#9d9d9d;background:-moz-linear-gradient(top,#9d9d9d 0,#c8c8c8 99%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#9d9d9d),color-stop(99%,#c8c8c8));background:-webkit-linear-gradient(top,#9d9d9d 0,#c8c8c8 99%);background:-o-linear-gradient(top,#9d9d9d 0,#c8c8c8 99%);background:-ms-linear-gradient(top,#9d9d9d 0,#c8c8c8 99%);background:linear-gradient(to bottom,#9d9d9d 0,#c8c8c8 99%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#9d9d9d', endColorstr='#c8c8c8', GradientType=0 )}input.vis-configuration.vis-config-range::-moz-range-track{width:300px;height:10px;background:#dedede;background:-moz-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#dedede),color-stop(99%,#c8c8c8));background:-webkit-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-o-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:-ms-linear-gradient(top,#dedede 0,#c8c8c8 99%);background:linear-gradient(to bottom,#dedede 0,#c8c8c8 99%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8', GradientType=0 );border:1px solid #999;box-shadow:#aaa 0 0 3px 0;border-radius:3px}input.vis-configuration.vis-config-range::-moz-range-thumb{border:none;height:16px;width:16px;border-radius:50%;background:#385380}input.vis-configuration.vis-config-range:-moz-focusring{outline:#fff solid 1px;outline-offset:-1px}input.vis-configuration.vis-config-range::-ms-track{width:300px;height:5px;background:0 0;border-color:transparent;border-width:6px 0;color:transparent}input.vis-configuration.vis-config-range::-ms-fill-lower{background:#777;border-radius:10px}input.vis-configuration.vis-config-range::-ms-fill-upper{background:#ddd;border-radius:10px}input.vis-configuration.vis-config-range::-ms-thumb{border:none;height:16px;width:16px;border-radius:50%;background:#385380}input.vis-configuration.vis-config-range:focus::-ms-fill-lower{background:#888}input.vis-configuration.vis-config-range:focus::-ms-fill-upper{background:#ccc}.vis-configuration-popup{position:absolute;background:rgba(57,76,89,.85);border:2px solid #f2faff;line-height:30px;height:30px;width:150px;text-align:center;color:#fff;font-size:14px;border-radius:4px;-webkit-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.vis-configuration-popup:after,.vis-configuration-popup:before{left:100%;top:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.vis-configuration-popup:after{border-color:rgba(136,183,213,0);border-left-color:rgba(57,76,89,.85);border-width:8px;margin-top:-8px}.vis-configuration-popup:before{border-color:rgba(194,225,245,0);border-left-color:#f2faff;border-width:12px;margin-top:-12px}.vis-timeline{position:relative;border:1px solid #bfbfbf;margin:0}.vis-panel{position:absolute;margin:0}.vis-panel.vis-bottom,.vis-panel.vis-center,.vis-panel.vis-left,.vis-panel.vis-right,.vis-panel.vis-top{border:1px #bfbfbf}.vis-panel.vis-center,.vis-panel.vis-left,.vis-panel.vis-right{border-top-style:solid;border-bottom-style:solid;overflow:hidden}.vis-panel.vis-bottom,.vis-panel.vis-center,.vis-panel.vis-top{border-left-style:solid;border-right-style:solid}.vis-panel>.vis-content{position:relative}.vis-panel .vis-shadow{position:absolute;width:100%;height:1px;box-shadow:0 0 10px rgba(0,0,0,.8)}.vis-itemset,.vis-labelset,.vis-labelset .vis-label{position:relative;box-sizing:border-box}.vis-panel .vis-shadow.vis-top{top:-1px;left:0}.vis-panel .vis-shadow.vis-bottom{bottom:-1px;left:0}.vis-labelset .vis-label{left:0;top:0;width:100%;color:#4d4d4d;border-bottom:1px solid #bfbfbf}.vis-labelset .vis-label.draggable{cursor:pointer}.vis-labelset .vis-label:last-child{border-bottom:none}.vis-labelset .vis-label .vis-inner{display:inline-block;padding:5px}.vis-labelset .vis-label .vis-inner.vis-hidden{padding:0}.vis-itemset{padding:0;margin:0}.vis-itemset .vis-background,.vis-itemset .vis-foreground{position:absolute;width:100%;height:100%;overflow:visible}.vis-axis{position:absolute;width:100%;height:0;left:0;z-index:1}.vis-foreground .vis-group{position:relative;box-sizing:border-box;border-bottom:1px solid #bfbfbf}.vis-foreground .vis-group:last-child{border-bottom:none}.vis-overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10}.vis-item{position:absolute;color:#1A1A1A;border-color:#97B0F8;border-width:1px;background-color:#D5DDF6;display:inline-block}.vis-item.vis-point.vis-selected,.vis-item.vis-selected{background-color:#FFF785}.vis-item.vis-selected{border-color:#FFC200;z-index:2}.vis-editable.vis-selected{cursor:move}.vis-item.vis-box{text-align:center;border-style:solid;border-radius:2px}.vis-item.vis-point{background:0 0}.vis-item.vis-dot{position:absolute;padding:0;border-width:4px;border-style:solid;border-radius:4px}.vis-item.vis-range{border-style:solid;border-radius:2px;box-sizing:border-box}.vis-item.vis-background{border:none;background-color:rgba(213,221,246,.4);box-sizing:border-box;padding:0;margin:0}.vis-item .vis-item-overflow{position:relative;width:100%;height:100%;padding:0;margin:0;overflow:hidden}.vis-item.vis-range .vis-item-content{position:relative;display:inline-block}.vis-item.vis-background .vis-item-content{position:absolute;display:inline-block}.vis-item.vis-line{padding:0;position:absolute;width:0;border-left-width:1px;border-left-style:solid}.vis-item .vis-item-content{white-space:nowrap;box-sizing:border-box;padding:5px}.vis-item .vis-delete{background:url(img/timeline/delete.png) center no-repeat;position:absolute;width:24px;height:24px;top:-4px;right:-24px;cursor:pointer}.vis-item.vis-range .vis-drag-left{position:absolute;width:24px;max-width:20%;min-width:2px;height:100%;top:0;left:-4px;cursor:w-resize}.vis-item.vis-range .vis-drag-right{position:absolute;width:24px;max-width:20%;min-width:2px;height:100%;top:0;right:-4px;cursor:e-resize}.vis-time-axis{position:relative;overflow:hidden}.vis-time-axis.vis-foreground{top:0;left:0;width:100%}.vis-time-axis.vis-background{position:absolute;top:0;left:0;width:100%;height:100%}.vis-time-axis .vis-text{position:absolute;color:#4d4d4d;padding:3px;overflow:hidden;box-sizing:border-box;white-space:nowrap}.vis-time-axis .vis-text.vis-measure{position:absolute;padding-left:0;padding-right:0;margin-left:0;margin-right:0;visibility:hidden}.vis-time-axis .vis-grid.vis-vertical{position:absolute;border-left:1px solid}.vis-time-axis .vis-grid.vis-minor{border-color:#e5e5e5}.vis-time-axis .vis-grid.vis-major{border-color:#bfbfbf}.vis-current-time{background-color:#FF7F6E;width:2px;z-index:1}.vis-custom-time{background-color:#6E94FF;width:2px;cursor:move;z-index:1}div.vis-network div.vis-close,div.vis-network div.vis-edit-mode div.vis-button,div.vis-network div.vis-manipulation div.vis-button{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-touch-callout:none;-khtml-user-select:none}.vis-panel.vis-background.vis-horizontal .vis-grid.vis-horizontal{position:absolute;width:100%;height:0;border-bottom:1px solid}.vis-panel.vis-background.vis-horizontal .vis-grid.vis-minor{border-color:#e5e5e5}.vis-panel.vis-background.vis-horizontal .vis-grid.vis-major{border-color:#bfbfbf}.vis-data-axis .vis-y-axis.vis-major{width:100%;position:absolute;color:#4d4d4d;white-space:nowrap}.vis-data-axis .vis-y-axis.vis-major.vis-measure{padding:0;margin:0;border:0;visibility:hidden;width:auto}.vis-data-axis .vis-y-axis.vis-minor{position:absolute;width:100%;color:#bebebe;white-space:nowrap}.vis-data-axis .vis-y-axis.vis-minor.vis-measure{padding:0;margin:0;border:0;visibility:hidden;width:auto}.vis-data-axis .vis-y-axis.vis-title{position:absolute;color:#4d4d4d;white-space:nowrap;bottom:20px;text-align:center}.vis-data-axis .vis-y-axis.vis-title.vis-measure{padding:0;margin:0;visibility:hidden;width:auto}.vis-data-axis .vis-y-axis.vis-title.vis-left{bottom:0;-webkit-transform-origin:left top;-moz-transform-origin:left top;-ms-transform-origin:left top;-o-transform-origin:left top;transform-origin:left bottom;-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);-o-transform:rotate(-90deg);transform:rotate(-90deg)}.vis-data-axis .vis-y-axis.vis-title.vis-right{bottom:0;-webkit-transform-origin:right bottom;-moz-transform-origin:right bottom;-ms-transform-origin:right bottom;-o-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.vis-legend{background-color:rgba(247,252,255,.65);padding:5px;border:1px solid #b3b3b3;box-shadow:2px 2px 10px rgba(154,154,154,.55)}.vis-legend-text{white-space:nowrap;display:inline-block}.vis-graph-group0{fill:#4f81bd;fill-opacity:0;stroke-width:2px;stroke:#4f81bd}.vis-graph-group1{fill:#f79646;fill-opacity:0;stroke-width:2px;stroke:#f79646}.vis-graph-group2{fill:#8c51cf;fill-opacity:0;stroke-width:2px;stroke:#8c51cf}.vis-graph-group3{fill:#75c841;fill-opacity:0;stroke-width:2px;stroke:#75c841}.vis-graph-group4{fill:#ff0100;fill-opacity:0;stroke-width:2px;stroke:#ff0100}.vis-graph-group5{fill:#37d8e6;fill-opacity:0;stroke-width:2px;stroke:#37d8e6}.vis-graph-group6{fill:#042662;fill-opacity:0;stroke-width:2px;stroke:#042662}.vis-graph-group7{fill:#00ff26;fill-opacity:0;stroke-width:2px;stroke:#00ff26}.vis-graph-group8{fill:#f0f;fill-opacity:0;stroke-width:2px;stroke:#f0f}.vis-graph-group9{fill:#8f3938;fill-opacity:0;stroke-width:2px;stroke:#8f3938}.vis-timeline .vis-fill{fill-opacity:.1;stroke:none}.vis-timeline .vis-bar{fill-opacity:.5;stroke-width:1px}.vis-timeline .vis-point{stroke-width:2px;fill-opacity:1}.vis-timeline .vis-legend-background{stroke-width:1px;fill-opacity:.9;fill:#fff;stroke:#c2c2c2}.vis-timeline .vis-outline{stroke-width:1px;fill-opacity:1;fill:#fff;stroke:#e5e5e5}.vis-timeline .vis-icon-fill{fill-opacity:.3;stroke:none}div.vis-network div.vis-manipulation{border-width:0;border-bottom:1px;border-style:solid;border-color:#d6d9d8;background:#fff;background:-moz-linear-gradient(top,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(48%,#fcfcfc),color-stop(50%,#fafafa),color-stop(100%,#fcfcfc));background:-webkit-linear-gradient(top,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);background:-o-linear-gradient(top,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);background:-ms-linear-gradient(top,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);background:linear-gradient(to bottom,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fcfcfc', GradientType=0 );padding-top:4px;position:absolute;left:0;top:0;width:100%;height:28px}div.vis-network div.vis-edit-mode{position:absolute;left:0;top:5px;height:30px}div.vis-network div.vis-close{position:absolute;right:0;top:0;width:30px;height:30px;background-position:20px 3px;background-repeat:no-repeat;background-image:url(img/network/cross.png);user-select:none}div.vis-network div.vis-close:hover{opacity:.6}div.vis-network div.vis-edit-mode div.vis-button,div.vis-network div.vis-manipulation div.vis-button{float:left;font-family:verdana;font-size:12px;-moz-border-radius:15px;border-radius:15px;display:inline-block;background-position:0 0;background-repeat:no-repeat;height:24px;margin-left:10px;padding:0 8px;user-select:none}div.vis-network div.vis-manipulation div.vis-button:hover{box-shadow:1px 1px 8px rgba(0,0,0,.2)}div.vis-network div.vis-manipulation div.vis-button:active{box-shadow:1px 1px 8px rgba(0,0,0,.5)}div.vis-network div.vis-manipulation div.vis-button.vis-back{background-image:url(img/network/backIcon.png)}div.vis-network div.vis-manipulation div.vis-button.vis-none:hover{box-shadow:1px 1px 8px transparent;cursor:default}div.vis-network div.vis-manipulation div.vis-button.vis-none:active{box-shadow:1px 1px 8px transparent}div.vis-network div.vis-manipulation div.vis-button.vis-none{padding:0}div.vis-network div.vis-manipulation div.notification{margin:2px;font-weight:700}div.vis-network div.vis-manipulation div.vis-button.vis-add{background-image:url(img/network/addNodeIcon.png)}div.vis-network div.vis-edit-mode div.vis-button.vis-edit,div.vis-network div.vis-manipulation div.vis-button.vis-edit{background-image:url(img/network/editIcon.png)}div.vis-network div.vis-edit-mode div.vis-button.vis-edit.vis-edit-mode{background-color:#fcfcfc;border:1px solid #ccc}div.vis-network div.vis-manipulation div.vis-button.vis-connect{background-image:url(img/network/connectIcon.png)}div.vis-network div.vis-manipulation div.vis-button.vis-delete{background-image:url(img/network/deleteIcon.png)}div.vis-network div.vis-edit-mode div.vis-label,div.vis-network div.vis-manipulation div.vis-label{margin:0 0 0 23px;line-height:25px}div.vis-network div.vis-manipulation div.vis-separator-line{float:left;display:inline-block;width:1px;height:21px;background-color:#bdbdbd;margin:0 7px 0 15px}div.vis-network-tooltip{position:absolute;visibility:hidden;padding:5px;white-space:nowrap;font-family:verdana;font-size:14px;font-color:#000;background-color:#f5f4ed;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;border:1px solid #808074;box-shadow:3px 3px 10px rgba(0,0,0,.2);pointer-events:none}div.vis-network div.vis-navigation div.vis-button{width:34px;height:34px;-moz-border-radius:17px;border-radius:17px;position:absolute;display:inline-block;background-position:2px 2px;background-repeat:no-repeat;cursor:pointer;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.vis-network div.vis-navigation div.vis-button:hover{box-shadow:0 0 3px 3px rgba(56,207,21,.3)}div.vis-network div.vis-navigation div.vis-button:active{box-shadow:0 0 1px 3px rgba(56,207,21,.95)}div.vis-network div.vis-navigation div.vis-button.vis-up{background-image:url(img/network/upArrow.png);bottom:50px;left:55px}div.vis-network div.vis-navigation div.vis-button.vis-down{background-image:url(img/network/downArrow.png);bottom:10px;left:55px}div.vis-network div.vis-navigation div.vis-button.vis-left{background-image:url(img/network/leftArrow.png);bottom:10px;left:15px}div.vis-network div.vis-navigation div.vis-button.vis-right{background-image:url(img/network/rightArrow.png);bottom:10px;left:95px}div.vis-network div.vis-navigation div.vis-button.vis-zoomIn{background-image:url(img/network/plus.png);bottom:10px;right:15px}div.vis-network div.vis-navigation div.vis-button.vis-zoomOut{background-image:url(img/network/minus.png);bottom:10px;right:55px}div.vis-network div.vis-navigation div.vis-button.vis-zoomExtends{background-image:url(img/network/zoomExtends.png);bottom:50px;right:15px}div.vis-color-picker{position:absolute;margin-top:-140px;margin-left:30px;width:293px;height:425px;padding:10px;border-radius:15px;background-color:#fff;display:none;box-shadow:rgba(0,0,0,.5) 0 0 10px 0}div.vis-color-picker div.vis-arrow{position:absolute;top:147px;left:5px}div.vis-color-picker div.vis-arrow:after,div.vis-color-picker div.vis-arrow:before{right:100%;top:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.vis-color-picker div.vis-arrow:after{border-color:rgba(255,255,255,0);border-right-color:#fff;border-width:30px;margin-top:-30px}div.vis-color-picker div.vis-color{position:absolute;width:289px;height:289px;cursor:pointer}div.vis-color-picker div.vis-brightness{position:absolute;top:313px}div.vis-color-picker div.vis-opacity{position:absolute;top:350px}div.vis-color-picker div.vis-selector{position:absolute;top:137px;left:137px;width:15px;height:15px;border-radius:15px;border:1px solid #fff;background:#4c4c4c;background:-moz-linear-gradient(top,#4c4c4c 0,#595959 12%,#666 25%,#474747 39%,#2c2c2c 50%,#000 51%,#111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#4c4c4c),color-stop(12%,#595959),color-stop(25%,#666),color-stop(39%,#474747),color-stop(50%,#2c2c2c),color-stop(51%,#000),color-stop(60%,#111),color-stop(76%,#2b2b2b),color-stop(91%,#1c1c1c),color-stop(100%,#131313));background:-webkit-linear-gradient(top,#4c4c4c 0,#595959 12%,#666 25%,#474747 39%,#2c2c2c 50%,#000 51%,#111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%);background:-o-linear-gradient(top,#4c4c4c 0,#595959 12%,#666 25%,#474747 39%,#2c2c2c 50%,#000 51%,#111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%);background:-ms-linear-gradient(top,#4c4c4c 0,#595959 12%,#666 25%,#474747 39%,#2c2c2c 50%,#000 51%,#111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%);background:linear-gradient(to bottom,#4c4c4c 0,#595959 12%,#666 25%,#474747 39%,#2c2c2c 50%,#000 51%,#111 60%,#2b2b2b 76%,#1c1c1c 91%,#131313 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313', GradientType=0 )}div.vis-color-picker div.vis-initial-color,div.vis-color-picker div.vis-new-color{width:140px;height:20px;top:380px;font-size:10px;color:rgba(0,0,0,.4);line-height:20px;position:absolute;vertical-align:middle}div.vis-color-picker div.vis-new-color{border:1px solid rgba(0,0,0,.1);border-radius:5px;left:159px;text-align:right;padding-right:2px}div.vis-color-picker div.vis-initial-color{border:1px solid rgba(0,0,0,.1);border-radius:5px;left:10px;text-align:left;padding-left:2px}div.vis-color-picker div.vis-label{position:absolute;width:300px;left:10px}div.vis-color-picker div.vis-label.vis-brightness{top:300px}div.vis-color-picker div.vis-label.vis-opacity{top:338px}div.vis-color-picker div.vis-button{position:absolute;width:68px;height:25px;border-radius:10px;vertical-align:middle;text-align:center;line-height:25px;top:410px;border:2px solid #d9d9d9;background-color:#f7f7f7;cursor:pointer}div.vis-color-picker div.vis-button.vis-cancel{left:5px}div.vis-color-picker div.vis-button.vis-load{left:82px}div.vis-color-picker div.vis-button.vis-apply{left:159px}div.vis-color-picker div.vis-button.vis-save{left:236px}div.vis-color-picker input.vis-range{width:290px;height:20px} \ No newline at end of file
diff --git a/www/css/main.css b/www/css/main.css
new file mode 100644
index 00000000..c27855e8
--- /dev/null
+++ b/www/css/main.css
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+ul, a {
+ font-size: 20px !important;
+}
+
+.navbar-nav>li.leftmenu {
+ width: 100%;
+}
+
+.navbar-default {
+ opacity: 0.95 !important;
+}
+
+.buttons {
+position: relative;
+margin: 50px;
+top: 20px;
+}
+
+network {
+ width: 100%;
+ margin: 0;
+ padding: 1em;
+}
+
+graphs {
+ padding: 1em;
+ overflow: hidden;
+}
+
+#canvas {
+ top: 0px;
+ bottom: 50px;
+}
+
+#viewport {
+ top: 50px;
+ height: 94%;
+ position: relative;
+}
+
+
+.slidebar-nav {
+ left: 250px;
+ list-style: none;
+ height: 95%;
+ margin: 0;
+ margin-left: -250px;
+ overflow-y: auto;
+ padding: 0;
+ position: fixed;
+ top: 50px;
+ width: 0;
+ z-index: 1000;
+}
+#wrapper.toggled .slidebar-nav {
+ width: 250px;
+}
+.slidebar-nav .navbar-collapse {
+ padding: 0;
+ max-height: none;
+}
+
+.slidebar-nav ul {
+ float: none;
+ width: 100%;
+}
+.slidebar-nav ul:not {
+ display: block;
+}
+.slidebar-nav li {
+ float: none;
+ display: block;
+}
+.slidebar-nav li a {
+ padding-top: 12px;
+ padding-bottom: 12px;
+}
+.slidebar-nav .open .dropdown-menu {
+ position: static;
+ float: none;
+ width: auto;
+ margin: 0;
+ padding: 5px 0;
+ background-color: transparent;
+ border: 0;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+.slidebar-nav .open .dropdown-menu > li > a {
+ padding: 5px 15px 5px 25px;
+}
+.slidebar-nav .navbar-brand {
+ width: 100%;
+}
+.slidebar-nav .open > a > b.caret {
+ border-top: none;
+ border-bottom: 4px solid;
+}
+.slidebar-nav .navbar-nav {
+ margin: 0;
+}
+
+#wrapper {
+ padding-left: 0;
+ -webkit-transition: all 0.5s ease;
+ -moz-transition: all 0.5s ease;
+ -o-transition: all 0.5s ease;
+ transition: all 0.5s ease;
+}
+#wrapper.toggled {
+ padding-left: 250px;
+}
+#page-wrapper6 {
+ width: 100%;
+ position: absolute;
+ padding: 15px;
+ top: 50px;
+}
+#wrapper.toggled #page-wrapper6 {
+ position: absolute;
+ margin-right: -250px;
+}
+@media(min-width:768px) {
+ #wrapper {
+ padding-left: 250px;
+ }
+ #wrapper.toggled {
+ padding-left: 0;
+ }
+ #page-wrapper6 {
+ padding: 20px;
+ position: relative;
+ }
+ #wrapper.toggled #page-wrapper6 {
+ position: relative;
+ margin-right: 0;
+ }
+ .slidebar-nav {
+ width: 250px;;
+ }
+ #wrapper.toggled .slidebar-nav {
+ width: 0;
+ }
+}
+
+.slidebar-toggle {
+ position: relative;
+ float: left;
+ padding: 9px 10px;
+ margin-top: 8px;
+ margin-left: 15px;
+/*
+ margin-bottom: 8px;
+ */
+ background-color: transparent;
+ background-image: none;
+ border: 1px solid transparent;
+ border-radius: 4px;
+}
+.slidebar-toggle:focus {
+ outline: 0;
+}
+.slidebar-toggle .icon-bar {
+ display: block;
+ width: 22px;
+ height: 2px;
+ border-radius: 1px;
+}
+.slidebar-toggle .icon-bar + .icon-bar {
+ margin-top: 4px;
+}
+.navbar-header {
+ height: 50px;
+}
+
+.navbar-default .slidebar-toggle {
+ /* Border of hamburger button */
+ width: 75px;
+
+ float: left;
+ background: url(../img/vicn-logo.png);
+ background-size: 60px;
+ height: 60px;
+ top: 6px;
+
+ background-repeat: no-repeat;
+}
diff --git a/www/favicon.ico b/www/favicon.ico
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/favicon.ico
diff --git a/www/fonts/glyphicons-halflings-regular.eot b/www/fonts/glyphicons-halflings-regular.eot
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/fonts/glyphicons-halflings-regular.eot
diff --git a/www/fonts/glyphicons-halflings-regular.svg b/www/fonts/glyphicons-halflings-regular.svg
new file mode 100644
index 00000000..94fb5490
--- /dev/null
+++ b/www/fonts/glyphicons-halflings-regular.svg
@@ -0,0 +1,288 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata></metadata>
+<defs>
+<font id="glyphicons_halflingsregular" horiz-adv-x="1200" >
+<font-face units-per-em="1200" ascent="960" descent="-240" />
+<missing-glyph horiz-adv-x="500" />
+<glyph horiz-adv-x="0" />
+<glyph horiz-adv-x="400" />
+<glyph unicode=" " />
+<glyph unicode="*" d="M600 1100q15 0 34 -1.5t30 -3.5l11 -1q10 -2 17.5 -10.5t7.5 -18.5v-224l158 158q7 7 18 8t19 -6l106 -106q7 -8 6 -19t-8 -18l-158 -158h224q10 0 18.5 -7.5t10.5 -17.5q6 -41 6 -75q0 -15 -1.5 -34t-3.5 -30l-1 -11q-2 -10 -10.5 -17.5t-18.5 -7.5h-224l158 -158 q7 -7 8 -18t-6 -19l-106 -106q-8 -7 -19 -6t-18 8l-158 158v-224q0 -10 -7.5 -18.5t-17.5 -10.5q-41 -6 -75 -6q-15 0 -34 1.5t-30 3.5l-11 1q-10 2 -17.5 10.5t-7.5 18.5v224l-158 -158q-7 -7 -18 -8t-19 6l-106 106q-7 8 -6 19t8 18l158 158h-224q-10 0 -18.5 7.5 t-10.5 17.5q-6 41 -6 75q0 15 1.5 34t3.5 30l1 11q2 10 10.5 17.5t18.5 7.5h224l-158 158q-7 7 -8 18t6 19l106 106q8 7 19 6t18 -8l158 -158v224q0 10 7.5 18.5t17.5 10.5q41 6 75 6z" />
+<glyph unicode="+" d="M450 1100h200q21 0 35.5 -14.5t14.5 -35.5v-350h350q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-350v-350q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v350h-350q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5 h350v350q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xa0;" />
+<glyph unicode="&#xa5;" d="M825 1100h250q10 0 12.5 -5t-5.5 -13l-364 -364q-6 -6 -11 -18h268q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-125v-100h275q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-125v-174q0 -11 -7.5 -18.5t-18.5 -7.5h-148q-11 0 -18.5 7.5t-7.5 18.5v174 h-275q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h125v100h-275q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h118q-5 12 -11 18l-364 364q-8 8 -5.5 13t12.5 5h250q25 0 43 -18l164 -164q8 -8 18 -8t18 8l164 164q18 18 43 18z" />
+<glyph unicode="&#x2000;" horiz-adv-x="650" />
+<glyph unicode="&#x2001;" horiz-adv-x="1300" />
+<glyph unicode="&#x2002;" horiz-adv-x="650" />
+<glyph unicode="&#x2003;" horiz-adv-x="1300" />
+<glyph unicode="&#x2004;" horiz-adv-x="433" />
+<glyph unicode="&#x2005;" horiz-adv-x="325" />
+<glyph unicode="&#x2006;" horiz-adv-x="216" />
+<glyph unicode="&#x2007;" horiz-adv-x="216" />
+<glyph unicode="&#x2008;" horiz-adv-x="162" />
+<glyph unicode="&#x2009;" horiz-adv-x="260" />
+<glyph unicode="&#x200a;" horiz-adv-x="72" />
+<glyph unicode="&#x202f;" horiz-adv-x="260" />
+<glyph unicode="&#x205f;" horiz-adv-x="325" />
+<glyph unicode="&#x20ac;" d="M744 1198q242 0 354 -189q60 -104 66 -209h-181q0 45 -17.5 82.5t-43.5 61.5t-58 40.5t-60.5 24t-51.5 7.5q-19 0 -40.5 -5.5t-49.5 -20.5t-53 -38t-49 -62.5t-39 -89.5h379l-100 -100h-300q-6 -50 -6 -100h406l-100 -100h-300q9 -74 33 -132t52.5 -91t61.5 -54.5t59 -29 t47 -7.5q22 0 50.5 7.5t60.5 24.5t58 41t43.5 61t17.5 80h174q-30 -171 -128 -278q-107 -117 -274 -117q-206 0 -324 158q-36 48 -69 133t-45 204h-217l100 100h112q1 47 6 100h-218l100 100h134q20 87 51 153.5t62 103.5q117 141 297 141z" />
+<glyph unicode="&#x20bd;" d="M428 1200h350q67 0 120 -13t86 -31t57 -49.5t35 -56.5t17 -64.5t6.5 -60.5t0.5 -57v-16.5v-16.5q0 -36 -0.5 -57t-6.5 -61t-17 -65t-35 -57t-57 -50.5t-86 -31.5t-120 -13h-178l-2 -100h288q10 0 13 -6t-3 -14l-120 -160q-6 -8 -18 -14t-22 -6h-138v-175q0 -11 -5.5 -18 t-15.5 -7h-149q-10 0 -17.5 7.5t-7.5 17.5v175h-267q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h117v100h-267q-10 0 -13 6t3 14l120 160q6 8 18 14t22 6h117v475q0 10 7.5 17.5t17.5 7.5zM600 1000v-300h203q64 0 86.5 33t22.5 119q0 84 -22.5 116t-86.5 32h-203z" />
+<glyph unicode="&#x2212;" d="M250 700h800q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#x231b;" d="M1000 1200v-150q0 -21 -14.5 -35.5t-35.5 -14.5h-50v-100q0 -91 -49.5 -165.5t-130.5 -109.5q81 -35 130.5 -109.5t49.5 -165.5v-150h50q21 0 35.5 -14.5t14.5 -35.5v-150h-800v150q0 21 14.5 35.5t35.5 14.5h50v150q0 91 49.5 165.5t130.5 109.5q-81 35 -130.5 109.5 t-49.5 165.5v100h-50q-21 0 -35.5 14.5t-14.5 35.5v150h800zM400 1000v-100q0 -60 32.5 -109.5t87.5 -73.5q28 -12 44 -37t16 -55t-16 -55t-44 -37q-55 -24 -87.5 -73.5t-32.5 -109.5v-150h400v150q0 60 -32.5 109.5t-87.5 73.5q-28 12 -44 37t-16 55t16 55t44 37 q55 24 87.5 73.5t32.5 109.5v100h-400z" />
+<glyph unicode="&#x25fc;" horiz-adv-x="500" d="M0 0z" />
+<glyph unicode="&#x2601;" d="M503 1089q110 0 200.5 -59.5t134.5 -156.5q44 14 90 14q120 0 205 -86.5t85 -206.5q0 -121 -85 -207.5t-205 -86.5h-750q-79 0 -135.5 57t-56.5 137q0 69 42.5 122.5t108.5 67.5q-2 12 -2 37q0 153 108 260.5t260 107.5z" />
+<glyph unicode="&#x26fa;" d="M774 1193.5q16 -9.5 20.5 -27t-5.5 -33.5l-136 -187l467 -746h30q20 0 35 -18.5t15 -39.5v-42h-1200v42q0 21 15 39.5t35 18.5h30l468 746l-135 183q-10 16 -5.5 34t20.5 28t34 5.5t28 -20.5l111 -148l112 150q9 16 27 20.5t34 -5zM600 200h377l-182 112l-195 534v-646z " />
+<glyph unicode="&#x2709;" d="M25 1100h1150q10 0 12.5 -5t-5.5 -13l-564 -567q-8 -8 -18 -8t-18 8l-564 567q-8 8 -5.5 13t12.5 5zM18 882l264 -264q8 -8 8 -18t-8 -18l-264 -264q-8 -8 -13 -5.5t-5 12.5v550q0 10 5 12.5t13 -5.5zM918 618l264 264q8 8 13 5.5t5 -12.5v-550q0 -10 -5 -12.5t-13 5.5 l-264 264q-8 8 -8 18t8 18zM818 482l364 -364q8 -8 5.5 -13t-12.5 -5h-1150q-10 0 -12.5 5t5.5 13l364 364q8 8 18 8t18 -8l164 -164q8 -8 18 -8t18 8l164 164q8 8 18 8t18 -8z" />
+<glyph unicode="&#x270f;" d="M1011 1210q19 0 33 -13l153 -153q13 -14 13 -33t-13 -33l-99 -92l-214 214l95 96q13 14 32 14zM1013 800l-615 -614l-214 214l614 614zM317 96l-333 -112l110 335z" />
+<glyph unicode="&#xe001;" d="M700 650v-550h250q21 0 35.5 -14.5t14.5 -35.5v-50h-800v50q0 21 14.5 35.5t35.5 14.5h250v550l-500 550h1200z" />
+<glyph unicode="&#xe002;" d="M368 1017l645 163q39 15 63 0t24 -49v-831q0 -55 -41.5 -95.5t-111.5 -63.5q-79 -25 -147 -4.5t-86 75t25.5 111.5t122.5 82q72 24 138 8v521l-600 -155v-606q0 -42 -44 -90t-109 -69q-79 -26 -147 -5.5t-86 75.5t25.5 111.5t122.5 82.5q72 24 138 7v639q0 38 14.5 59 t53.5 34z" />
+<glyph unicode="&#xe003;" d="M500 1191q100 0 191 -39t156.5 -104.5t104.5 -156.5t39 -191l-1 -2l1 -5q0 -141 -78 -262l275 -274q23 -26 22.5 -44.5t-22.5 -42.5l-59 -58q-26 -20 -46.5 -20t-39.5 20l-275 274q-119 -77 -261 -77l-5 1l-2 -1q-100 0 -191 39t-156.5 104.5t-104.5 156.5t-39 191 t39 191t104.5 156.5t156.5 104.5t191 39zM500 1022q-88 0 -162 -43t-117 -117t-43 -162t43 -162t117 -117t162 -43t162 43t117 117t43 162t-43 162t-117 117t-162 43z" />
+<glyph unicode="&#xe005;" d="M649 949q48 68 109.5 104t121.5 38.5t118.5 -20t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-150 152.5t-126.5 127.5t-93.5 124.5t-33.5 117.5q0 64 28 123t73 100.5t104 64t119 20 t120.5 -38.5t104.5 -104z" />
+<glyph unicode="&#xe006;" d="M407 800l131 353q7 19 17.5 19t17.5 -19l129 -353h421q21 0 24 -8.5t-14 -20.5l-342 -249l130 -401q7 -20 -0.5 -25.5t-24.5 6.5l-343 246l-342 -247q-17 -12 -24.5 -6.5t-0.5 25.5l130 400l-347 251q-17 12 -14 20.5t23 8.5h429z" />
+<glyph unicode="&#xe007;" d="M407 800l131 353q7 19 17.5 19t17.5 -19l129 -353h421q21 0 24 -8.5t-14 -20.5l-342 -249l130 -401q7 -20 -0.5 -25.5t-24.5 6.5l-343 246l-342 -247q-17 -12 -24.5 -6.5t-0.5 25.5l130 400l-347 251q-17 12 -14 20.5t23 8.5h429zM477 700h-240l197 -142l-74 -226 l193 139l195 -140l-74 229l192 140h-234l-78 211z" />
+<glyph unicode="&#xe008;" d="M600 1200q124 0 212 -88t88 -212v-250q0 -46 -31 -98t-69 -52v-75q0 -10 6 -21.5t15 -17.5l358 -230q9 -5 15 -16.5t6 -21.5v-93q0 -10 -7.5 -17.5t-17.5 -7.5h-1150q-10 0 -17.5 7.5t-7.5 17.5v93q0 10 6 21.5t15 16.5l358 230q9 6 15 17.5t6 21.5v75q-38 0 -69 52 t-31 98v250q0 124 88 212t212 88z" />
+<glyph unicode="&#xe009;" d="M25 1100h1150q10 0 17.5 -7.5t7.5 -17.5v-1050q0 -10 -7.5 -17.5t-17.5 -7.5h-1150q-10 0 -17.5 7.5t-7.5 17.5v1050q0 10 7.5 17.5t17.5 7.5zM100 1000v-100h100v100h-100zM875 1000h-550q-10 0 -17.5 -7.5t-7.5 -17.5v-350q0 -10 7.5 -17.5t17.5 -7.5h550 q10 0 17.5 7.5t7.5 17.5v350q0 10 -7.5 17.5t-17.5 7.5zM1000 1000v-100h100v100h-100zM100 800v-100h100v100h-100zM1000 800v-100h100v100h-100zM100 600v-100h100v100h-100zM1000 600v-100h100v100h-100zM875 500h-550q-10 0 -17.5 -7.5t-7.5 -17.5v-350q0 -10 7.5 -17.5 t17.5 -7.5h550q10 0 17.5 7.5t7.5 17.5v350q0 10 -7.5 17.5t-17.5 7.5zM100 400v-100h100v100h-100zM1000 400v-100h100v100h-100zM100 200v-100h100v100h-100zM1000 200v-100h100v100h-100z" />
+<glyph unicode="&#xe010;" d="M50 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM650 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5zM50 500h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM650 500h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe011;" d="M50 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5zM850 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM850 700h200q21 0 35.5 -14.5t14.5 -35.5v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 300h200 q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM850 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5 t35.5 14.5z" />
+<glyph unicode="&#xe012;" d="M50 1100h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 1100h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5zM50 700h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 700h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM50 300h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5zM450 300h700q21 0 35.5 -14.5t14.5 -35.5v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe013;" d="M465 477l571 571q8 8 18 8t17 -8l177 -177q8 -7 8 -17t-8 -18l-783 -784q-7 -8 -17.5 -8t-17.5 8l-384 384q-8 8 -8 18t8 17l177 177q7 8 17 8t18 -8l171 -171q7 -7 18 -7t18 7z" />
+<glyph unicode="&#xe014;" d="M904 1083l178 -179q8 -8 8 -18.5t-8 -17.5l-267 -268l267 -268q8 -7 8 -17.5t-8 -18.5l-178 -178q-8 -8 -18.5 -8t-17.5 8l-268 267l-268 -267q-7 -8 -17.5 -8t-18.5 8l-178 178q-8 8 -8 18.5t8 17.5l267 268l-267 268q-8 7 -8 17.5t8 18.5l178 178q8 8 18.5 8t17.5 -8 l268 -267l268 268q7 7 17.5 7t18.5 -7z" />
+<glyph unicode="&#xe015;" d="M507 1177q98 0 187.5 -38.5t154.5 -103.5t103.5 -154.5t38.5 -187.5q0 -141 -78 -262l300 -299q8 -8 8 -18.5t-8 -18.5l-109 -108q-7 -8 -17.5 -8t-18.5 8l-300 299q-119 -77 -261 -77q-98 0 -188 38.5t-154.5 103t-103 154.5t-38.5 188t38.5 187.5t103 154.5 t154.5 103.5t188 38.5zM506.5 1023q-89.5 0 -165.5 -44t-120 -120.5t-44 -166t44 -165.5t120 -120t165.5 -44t166 44t120.5 120t44 165.5t-44 166t-120.5 120.5t-166 44zM425 900h150q10 0 17.5 -7.5t7.5 -17.5v-75h75q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5 t-17.5 -7.5h-75v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-75q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h75v75q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe016;" d="M507 1177q98 0 187.5 -38.5t154.5 -103.5t103.5 -154.5t38.5 -187.5q0 -141 -78 -262l300 -299q8 -8 8 -18.5t-8 -18.5l-109 -108q-7 -8 -17.5 -8t-18.5 8l-300 299q-119 -77 -261 -77q-98 0 -188 38.5t-154.5 103t-103 154.5t-38.5 188t38.5 187.5t103 154.5 t154.5 103.5t188 38.5zM506.5 1023q-89.5 0 -165.5 -44t-120 -120.5t-44 -166t44 -165.5t120 -120t165.5 -44t166 44t120.5 120t44 165.5t-44 166t-120.5 120.5t-166 44zM325 800h350q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-350q-10 0 -17.5 7.5 t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe017;" d="M550 1200h100q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM800 975v166q167 -62 272 -209.5t105 -331.5q0 -117 -45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5 t-184.5 123t-123 184.5t-45.5 224q0 184 105 331.5t272 209.5v-166q-103 -55 -165 -155t-62 -220q0 -116 57 -214.5t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5q0 120 -62 220t-165 155z" />
+<glyph unicode="&#xe018;" d="M1025 1200h150q10 0 17.5 -7.5t7.5 -17.5v-1150q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v1150q0 10 7.5 17.5t17.5 7.5zM725 800h150q10 0 17.5 -7.5t7.5 -17.5v-750q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v750 q0 10 7.5 17.5t17.5 7.5zM425 500h150q10 0 17.5 -7.5t7.5 -17.5v-450q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v450q0 10 7.5 17.5t17.5 7.5zM125 300h150q10 0 17.5 -7.5t7.5 -17.5v-250q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5 v250q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe019;" d="M600 1174q33 0 74 -5l38 -152l5 -1q49 -14 94 -39l5 -2l134 80q61 -48 104 -105l-80 -134l3 -5q25 -44 39 -93l1 -6l152 -38q5 -43 5 -73q0 -34 -5 -74l-152 -38l-1 -6q-15 -49 -39 -93l-3 -5l80 -134q-48 -61 -104 -105l-134 81l-5 -3q-44 -25 -94 -39l-5 -2l-38 -151 q-43 -5 -74 -5q-33 0 -74 5l-38 151l-5 2q-49 14 -94 39l-5 3l-134 -81q-60 48 -104 105l80 134l-3 5q-25 45 -38 93l-2 6l-151 38q-6 42 -6 74q0 33 6 73l151 38l2 6q13 48 38 93l3 5l-80 134q47 61 105 105l133 -80l5 2q45 25 94 39l5 1l38 152q43 5 74 5zM600 815 q-89 0 -152 -63t-63 -151.5t63 -151.5t152 -63t152 63t63 151.5t-63 151.5t-152 63z" />
+<glyph unicode="&#xe020;" d="M500 1300h300q41 0 70.5 -29.5t29.5 -70.5v-100h275q10 0 17.5 -7.5t7.5 -17.5v-75h-1100v75q0 10 7.5 17.5t17.5 7.5h275v100q0 41 29.5 70.5t70.5 29.5zM500 1200v-100h300v100h-300zM1100 900v-800q0 -41 -29.5 -70.5t-70.5 -29.5h-700q-41 0 -70.5 29.5t-29.5 70.5 v800h900zM300 800v-700h100v700h-100zM500 800v-700h100v700h-100zM700 800v-700h100v700h-100zM900 800v-700h100v700h-100z" />
+<glyph unicode="&#xe021;" d="M18 618l620 608q8 7 18.5 7t17.5 -7l608 -608q8 -8 5.5 -13t-12.5 -5h-175v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v375h-300v-375q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v575h-175q-10 0 -12.5 5t5.5 13z" />
+<glyph unicode="&#xe022;" d="M600 1200v-400q0 -41 29.5 -70.5t70.5 -29.5h300v-650q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v1100q0 21 14.5 35.5t35.5 14.5h450zM1000 800h-250q-21 0 -35.5 14.5t-14.5 35.5v250z" />
+<glyph unicode="&#xe023;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM525 900h50q10 0 17.5 -7.5t7.5 -17.5v-275h175q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe024;" d="M1300 0h-538l-41 400h-242l-41 -400h-538l431 1200h209l-21 -300h162l-20 300h208zM515 800l-27 -300h224l-27 300h-170z" />
+<glyph unicode="&#xe025;" d="M550 1200h200q21 0 35.5 -14.5t14.5 -35.5v-450h191q20 0 25.5 -11.5t-7.5 -27.5l-327 -400q-13 -16 -32 -16t-32 16l-327 400q-13 16 -7.5 27.5t25.5 11.5h191v450q0 21 14.5 35.5t35.5 14.5zM1125 400h50q10 0 17.5 -7.5t7.5 -17.5v-350q0 -10 -7.5 -17.5t-17.5 -7.5 h-1050q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h50q10 0 17.5 -7.5t7.5 -17.5v-175h900v175q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe026;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM525 900h150q10 0 17.5 -7.5t7.5 -17.5v-275h137q21 0 26 -11.5t-8 -27.5l-223 -275q-13 -16 -32 -16t-32 16l-223 275q-13 16 -8 27.5t26 11.5h137v275q0 10 7.5 17.5t17.5 7.5z " />
+<glyph unicode="&#xe027;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM632 914l223 -275q13 -16 8 -27.5t-26 -11.5h-137v-275q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v275h-137q-21 0 -26 11.5t8 27.5l223 275q13 16 32 16 t32 -16z" />
+<glyph unicode="&#xe028;" d="M225 1200h750q10 0 19.5 -7t12.5 -17l186 -652q7 -24 7 -49v-425q0 -12 -4 -27t-9 -17q-12 -6 -37 -6h-1100q-12 0 -27 4t-17 8q-6 13 -6 38l1 425q0 25 7 49l185 652q3 10 12.5 17t19.5 7zM878 1000h-556q-10 0 -19 -7t-11 -18l-87 -450q-2 -11 4 -18t16 -7h150 q10 0 19.5 -7t11.5 -17l38 -152q2 -10 11.5 -17t19.5 -7h250q10 0 19.5 7t11.5 17l38 152q2 10 11.5 17t19.5 7h150q10 0 16 7t4 18l-87 450q-2 11 -11 18t-19 7z" />
+<glyph unicode="&#xe029;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM540 820l253 -190q17 -12 17 -30t-17 -30l-253 -190q-16 -12 -28 -6.5t-12 26.5v400q0 21 12 26.5t28 -6.5z" />
+<glyph unicode="&#xe030;" d="M947 1060l135 135q7 7 12.5 5t5.5 -13v-362q0 -10 -7.5 -17.5t-17.5 -7.5h-362q-11 0 -13 5.5t5 12.5l133 133q-109 76 -238 76q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5h150q0 -117 -45.5 -224 t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5q192 0 347 -117z" />
+<glyph unicode="&#xe031;" d="M947 1060l135 135q7 7 12.5 5t5.5 -13v-361q0 -11 -7.5 -18.5t-18.5 -7.5h-361q-11 0 -13 5.5t5 12.5l134 134q-110 75 -239 75q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5h-150q0 117 45.5 224t123 184.5t184.5 123t224 45.5q192 0 347 -117zM1027 600h150 q0 -117 -45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5q-192 0 -348 118l-134 -134q-7 -8 -12.5 -5.5t-5.5 12.5v360q0 11 7.5 18.5t18.5 7.5h360q10 0 12.5 -5.5t-5.5 -12.5l-133 -133q110 -76 240 -76q116 0 214.5 57t155.5 155.5t57 214.5z" />
+<glyph unicode="&#xe032;" d="M125 1200h1050q10 0 17.5 -7.5t7.5 -17.5v-1150q0 -10 -7.5 -17.5t-17.5 -7.5h-1050q-10 0 -17.5 7.5t-7.5 17.5v1150q0 10 7.5 17.5t17.5 7.5zM1075 1000h-850q-10 0 -17.5 -7.5t-7.5 -17.5v-850q0 -10 7.5 -17.5t17.5 -7.5h850q10 0 17.5 7.5t7.5 17.5v850 q0 10 -7.5 17.5t-17.5 7.5zM325 900h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 900h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 700h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 700h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 500h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 500h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5zM325 300h50q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM525 300h450q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-450q-10 0 -17.5 7.5t-7.5 17.5v50 q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe033;" d="M900 800v200q0 83 -58.5 141.5t-141.5 58.5h-300q-82 0 -141 -59t-59 -141v-200h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h900q41 0 70.5 29.5t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5h-100zM400 800v150q0 21 15 35.5t35 14.5h200 q20 0 35 -14.5t15 -35.5v-150h-300z" />
+<glyph unicode="&#xe034;" d="M125 1100h50q10 0 17.5 -7.5t7.5 -17.5v-1075h-100v1075q0 10 7.5 17.5t17.5 7.5zM1075 1052q4 0 9 -2q16 -6 16 -23v-421q0 -6 -3 -12q-33 -59 -66.5 -99t-65.5 -58t-56.5 -24.5t-52.5 -6.5q-26 0 -57.5 6.5t-52.5 13.5t-60 21q-41 15 -63 22.5t-57.5 15t-65.5 7.5 q-85 0 -160 -57q-7 -5 -15 -5q-6 0 -11 3q-14 7 -14 22v438q22 55 82 98.5t119 46.5q23 2 43 0.5t43 -7t32.5 -8.5t38 -13t32.5 -11q41 -14 63.5 -21t57 -14t63.5 -7q103 0 183 87q7 8 18 8z" />
+<glyph unicode="&#xe035;" d="M600 1175q116 0 227 -49.5t192.5 -131t131 -192.5t49.5 -227v-300q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v300q0 127 -70.5 231.5t-184.5 161.5t-245 57t-245 -57t-184.5 -161.5t-70.5 -231.5v-300q0 -10 -7.5 -17.5t-17.5 -7.5h-50 q-10 0 -17.5 7.5t-7.5 17.5v300q0 116 49.5 227t131 192.5t192.5 131t227 49.5zM220 500h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460q0 8 6 14t14 6zM820 500h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460 q0 8 6 14t14 6z" />
+<glyph unicode="&#xe036;" d="M321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM900 668l120 120q7 7 17 7t17 -7l34 -34q7 -7 7 -17t-7 -17l-120 -120l120 -120q7 -7 7 -17 t-7 -17l-34 -34q-7 -7 -17 -7t-17 7l-120 119l-120 -119q-7 -7 -17 -7t-17 7l-34 34q-7 7 -7 17t7 17l119 120l-119 120q-7 7 -7 17t7 17l34 34q7 8 17 8t17 -8z" />
+<glyph unicode="&#xe037;" d="M321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM766 900h4q10 -1 16 -10q96 -129 96 -290q0 -154 -90 -281q-6 -9 -17 -10l-3 -1q-9 0 -16 6 l-29 23q-7 7 -8.5 16.5t4.5 17.5q72 103 72 229q0 132 -78 238q-6 8 -4.5 18t9.5 17l29 22q7 5 15 5z" />
+<glyph unicode="&#xe038;" d="M967 1004h3q11 -1 17 -10q135 -179 135 -396q0 -105 -34 -206.5t-98 -185.5q-7 -9 -17 -10h-3q-9 0 -16 6l-42 34q-8 6 -9 16t5 18q111 150 111 328q0 90 -29.5 176t-84.5 157q-6 9 -5 19t10 16l42 33q7 5 15 5zM321 814l258 172q9 6 15 2.5t6 -13.5v-750q0 -10 -6 -13.5 t-15 2.5l-258 172q-21 14 -46 14h-250q-10 0 -17.5 7.5t-7.5 17.5v350q0 10 7.5 17.5t17.5 7.5h250q25 0 46 14zM766 900h4q10 -1 16 -10q96 -129 96 -290q0 -154 -90 -281q-6 -9 -17 -10l-3 -1q-9 0 -16 6l-29 23q-7 7 -8.5 16.5t4.5 17.5q72 103 72 229q0 132 -78 238 q-6 8 -4.5 18.5t9.5 16.5l29 22q7 5 15 5z" />
+<glyph unicode="&#xe039;" d="M500 900h100v-100h-100v-100h-400v-100h-100v600h500v-300zM1200 700h-200v-100h200v-200h-300v300h-200v300h-100v200h600v-500zM100 1100v-300h300v300h-300zM800 1100v-300h300v300h-300zM300 900h-100v100h100v-100zM1000 900h-100v100h100v-100zM300 500h200v-500 h-500v500h200v100h100v-100zM800 300h200v-100h-100v-100h-200v100h-100v100h100v200h-200v100h300v-300zM100 400v-300h300v300h-300zM300 200h-100v100h100v-100zM1200 200h-100v100h100v-100zM700 0h-100v100h100v-100zM1200 0h-300v100h300v-100z" />
+<glyph unicode="&#xe040;" d="M100 200h-100v1000h100v-1000zM300 200h-100v1000h100v-1000zM700 200h-200v1000h200v-1000zM900 200h-100v1000h100v-1000zM1200 200h-200v1000h200v-1000zM400 0h-300v100h300v-100zM600 0h-100v91h100v-91zM800 0h-100v91h100v-91zM1100 0h-200v91h200v-91z" />
+<glyph unicode="&#xe041;" d="M500 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-682 682l1 475q0 10 7.5 17.5t17.5 7.5h474zM319.5 1024.5q-29.5 29.5 -71 29.5t-71 -29.5t-29.5 -71.5t29.5 -71.5t71 -29.5t71 29.5t29.5 71.5t-29.5 71.5z" />
+<glyph unicode="&#xe042;" d="M500 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-682 682l1 475q0 10 7.5 17.5t17.5 7.5h474zM800 1200l682 -682q8 -8 8 -18t-8 -18l-464 -464q-8 -8 -18 -8t-18 8l-56 56l424 426l-700 700h150zM319.5 1024.5q-29.5 29.5 -71 29.5t-71 -29.5 t-29.5 -71.5t29.5 -71.5t71 -29.5t71 29.5t29.5 71.5t-29.5 71.5z" />
+<glyph unicode="&#xe043;" d="M300 1200h825q75 0 75 -75v-900q0 -25 -18 -43l-64 -64q-8 -8 -13 -5.5t-5 12.5v950q0 10 -7.5 17.5t-17.5 7.5h-700q-25 0 -43 -18l-64 -64q-8 -8 -5.5 -13t12.5 -5h700q10 0 17.5 -7.5t7.5 -17.5v-950q0 -10 -7.5 -17.5t-17.5 -7.5h-850q-10 0 -17.5 7.5t-7.5 17.5v975 q0 25 18 43l139 139q18 18 43 18z" />
+<glyph unicode="&#xe044;" d="M250 1200h800q21 0 35.5 -14.5t14.5 -35.5v-1150l-450 444l-450 -445v1151q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe045;" d="M822 1200h-444q-11 0 -19 -7.5t-9 -17.5l-78 -301q-7 -24 7 -45l57 -108q6 -9 17.5 -15t21.5 -6h450q10 0 21.5 6t17.5 15l62 108q14 21 7 45l-83 301q-1 10 -9 17.5t-19 7.5zM1175 800h-150q-10 0 -21 -6.5t-15 -15.5l-78 -156q-4 -9 -15 -15.5t-21 -6.5h-550 q-10 0 -21 6.5t-15 15.5l-78 156q-4 9 -15 15.5t-21 6.5h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-650q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h750q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5 t7.5 17.5v650q0 10 -7.5 17.5t-17.5 7.5zM850 200h-500q-10 0 -19.5 -7t-11.5 -17l-38 -152q-2 -10 3.5 -17t15.5 -7h600q10 0 15.5 7t3.5 17l-38 152q-2 10 -11.5 17t-19.5 7z" />
+<glyph unicode="&#xe046;" d="M500 1100h200q56 0 102.5 -20.5t72.5 -50t44 -59t25 -50.5l6 -20h150q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5h150q2 8 6.5 21.5t24 48t45 61t72 48t102.5 21.5zM900 800v-100 h100v100h-100zM600 730q-95 0 -162.5 -67.5t-67.5 -162.5t67.5 -162.5t162.5 -67.5t162.5 67.5t67.5 162.5t-67.5 162.5t-162.5 67.5zM600 603q43 0 73 -30t30 -73t-30 -73t-73 -30t-73 30t-30 73t30 73t73 30z" />
+<glyph unicode="&#xe047;" d="M681 1199l385 -998q20 -50 60 -92q18 -19 36.5 -29.5t27.5 -11.5l10 -2v-66h-417v66q53 0 75 43.5t5 88.5l-82 222h-391q-58 -145 -92 -234q-11 -34 -6.5 -57t25.5 -37t46 -20t55 -6v-66h-365v66q56 24 84 52q12 12 25 30.5t20 31.5l7 13l399 1006h93zM416 521h340 l-162 457z" />
+<glyph unicode="&#xe048;" d="M753 641q5 -1 14.5 -4.5t36 -15.5t50.5 -26.5t53.5 -40t50.5 -54.5t35.5 -70t14.5 -87q0 -67 -27.5 -125.5t-71.5 -97.5t-98.5 -66.5t-108.5 -40.5t-102 -13h-500v89q41 7 70.5 32.5t29.5 65.5v827q0 24 -0.5 34t-3.5 24t-8.5 19.5t-17 13.5t-28 12.5t-42.5 11.5v71 l471 -1q57 0 115.5 -20.5t108 -57t80.5 -94t31 -124.5q0 -51 -15.5 -96.5t-38 -74.5t-45 -50.5t-38.5 -30.5zM400 700h139q78 0 130.5 48.5t52.5 122.5q0 41 -8.5 70.5t-29.5 55.5t-62.5 39.5t-103.5 13.5h-118v-350zM400 200h216q80 0 121 50.5t41 130.5q0 90 -62.5 154.5 t-156.5 64.5h-159v-400z" />
+<glyph unicode="&#xe049;" d="M877 1200l2 -57q-83 -19 -116 -45.5t-40 -66.5l-132 -839q-9 -49 13 -69t96 -26v-97h-500v97q186 16 200 98l173 832q3 17 3 30t-1.5 22.5t-9 17.5t-13.5 12.5t-21.5 10t-26 8.5t-33.5 10q-13 3 -19 5v57h425z" />
+<glyph unicode="&#xe050;" d="M1300 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-850q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v850h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM175 1000h-75v-800h75l-125 -167l-125 167h75v800h-75l125 167z" />
+<glyph unicode="&#xe051;" d="M1100 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-650q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v650h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM1167 50l-167 -125v75h-800v-75l-167 125l167 125v-75h800v75z" />
+<glyph unicode="&#xe052;" d="M50 1100h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 500h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe053;" d="M250 1100h700q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM250 500h700q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe054;" d="M500 950v100q0 21 14.5 35.5t35.5 14.5h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5zM100 650v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000 q-21 0 -35.5 14.5t-14.5 35.5zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5zM0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100 q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5z" />
+<glyph unicode="&#xe055;" d="M50 1100h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 800h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 500h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe056;" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 1100h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 800h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 500h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 500h800q21 0 35.5 -14.5t14.5 -35.5v-100 q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM350 200h800 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe057;" d="M400 0h-100v1100h100v-1100zM550 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM550 800h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM267 550l-167 -125v75h-200v100h200v75zM550 500h300q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM550 200h600 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe058;" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM900 0h-100v1100h100v-1100zM50 800h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM1100 600h200v-100h-200v-75l-167 125l167 125v-75zM50 500h300q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5zM50 200h600 q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-600q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe059;" d="M75 1000h750q31 0 53 -22t22 -53v-650q0 -31 -22 -53t-53 -22h-750q-31 0 -53 22t-22 53v650q0 31 22 53t53 22zM1200 300l-300 300l300 300v-600z" />
+<glyph unicode="&#xe060;" d="M44 1100h1112q18 0 31 -13t13 -31v-1012q0 -18 -13 -31t-31 -13h-1112q-18 0 -31 13t-13 31v1012q0 18 13 31t31 13zM100 1000v-737l247 182l298 -131l-74 156l293 318l236 -288v500h-1000zM342 884q56 0 95 -39t39 -94.5t-39 -95t-95 -39.5t-95 39.5t-39 95t39 94.5 t95 39z" />
+<glyph unicode="&#xe062;" d="M648 1169q117 0 216 -60t156.5 -161t57.5 -218q0 -115 -70 -258q-69 -109 -158 -225.5t-143 -179.5l-54 -62q-9 8 -25.5 24.5t-63.5 67.5t-91 103t-98.5 128t-95.5 148q-60 132 -60 249q0 88 34 169.5t91.5 142t137 96.5t166.5 36zM652.5 974q-91.5 0 -156.5 -65 t-65 -157t65 -156.5t156.5 -64.5t156.5 64.5t65 156.5t-65 157t-156.5 65z" />
+<glyph unicode="&#xe063;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 173v854q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57z" />
+<glyph unicode="&#xe064;" d="M554 1295q21 -72 57.5 -143.5t76 -130t83 -118t82.5 -117t70 -116t49.5 -126t18.5 -136.5q0 -71 -25.5 -135t-68.5 -111t-99 -82t-118.5 -54t-125.5 -23q-84 5 -161.5 34t-139.5 78.5t-99 125t-37 164.5q0 69 18 136.5t49.5 126.5t69.5 116.5t81.5 117.5t83.5 119 t76.5 131t58.5 143zM344 710q-23 -33 -43.5 -70.5t-40.5 -102.5t-17 -123q1 -37 14.5 -69.5t30 -52t41 -37t38.5 -24.5t33 -15q21 -7 32 -1t13 22l6 34q2 10 -2.5 22t-13.5 19q-5 4 -14 12t-29.5 40.5t-32.5 73.5q-26 89 6 271q2 11 -6 11q-8 1 -15 -10z" />
+<glyph unicode="&#xe065;" d="M1000 1013l108 115q2 1 5 2t13 2t20.5 -1t25 -9.5t28.5 -21.5q22 -22 27 -43t0 -32l-6 -10l-108 -115zM350 1100h400q50 0 105 -13l-187 -187h-368q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v182l200 200v-332 q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5zM1009 803l-362 -362l-161 -50l55 170l355 355z" />
+<glyph unicode="&#xe066;" d="M350 1100h361q-164 -146 -216 -200h-195q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5l200 153v-103q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5z M824 1073l339 -301q8 -7 8 -17.5t-8 -17.5l-340 -306q-7 -6 -12.5 -4t-6.5 11v203q-26 1 -54.5 0t-78.5 -7.5t-92 -17.5t-86 -35t-70 -57q10 59 33 108t51.5 81.5t65 58.5t68.5 40.5t67 24.5t56 13.5t40 4.5v210q1 10 6.5 12.5t13.5 -4.5z" />
+<glyph unicode="&#xe067;" d="M350 1100h350q60 0 127 -23l-178 -177h-349q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v69l200 200v-219q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5z M643 639l395 395q7 7 17.5 7t17.5 -7l101 -101q7 -7 7 -17.5t-7 -17.5l-531 -532q-7 -7 -17.5 -7t-17.5 7l-248 248q-7 7 -7 17.5t7 17.5l101 101q7 7 17.5 7t17.5 -7l111 -111q8 -7 18 -7t18 7z" />
+<glyph unicode="&#xe068;" d="M318 918l264 264q8 8 18 8t18 -8l260 -264q7 -8 4.5 -13t-12.5 -5h-170v-200h200v173q0 10 5 12t13 -5l264 -260q8 -7 8 -17.5t-8 -17.5l-264 -265q-8 -7 -13 -5t-5 12v173h-200v-200h170q10 0 12.5 -5t-4.5 -13l-260 -264q-8 -8 -18 -8t-18 8l-264 264q-8 8 -5.5 13 t12.5 5h175v200h-200v-173q0 -10 -5 -12t-13 5l-264 265q-8 7 -8 17.5t8 17.5l264 260q8 7 13 5t5 -12v-173h200v200h-175q-10 0 -12.5 5t5.5 13z" />
+<glyph unicode="&#xe069;" d="M250 1100h100q21 0 35.5 -14.5t14.5 -35.5v-438l464 453q15 14 25.5 10t10.5 -25v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe070;" d="M50 1100h100q21 0 35.5 -14.5t14.5 -35.5v-438l464 453q15 14 25.5 10t10.5 -25v-438l464 453q15 14 25.5 10t10.5 -25v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5 t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe071;" d="M1200 1050v-1000q0 -21 -10.5 -25t-25.5 10l-464 453v-438q0 -21 -10.5 -25t-25.5 10l-492 480q-15 14 -15 35t15 35l492 480q15 14 25.5 10t10.5 -25v-438l464 453q15 14 25.5 10t10.5 -25z" />
+<glyph unicode="&#xe072;" d="M243 1074l814 -498q18 -11 18 -26t-18 -26l-814 -498q-18 -11 -30.5 -4t-12.5 28v1000q0 21 12.5 28t30.5 -4z" />
+<glyph unicode="&#xe073;" d="M250 1000h200q21 0 35.5 -14.5t14.5 -35.5v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5zM650 1000h200q21 0 35.5 -14.5t14.5 -35.5v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v800 q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe074;" d="M1100 950v-800q0 -21 -14.5 -35.5t-35.5 -14.5h-800q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5z" />
+<glyph unicode="&#xe075;" d="M500 612v438q0 21 10.5 25t25.5 -10l492 -480q15 -14 15 -35t-15 -35l-492 -480q-15 -14 -25.5 -10t-10.5 25v438l-464 -453q-15 -14 -25.5 -10t-10.5 25v1000q0 21 10.5 25t25.5 -10z" />
+<glyph unicode="&#xe076;" d="M1048 1102l100 1q20 0 35 -14.5t15 -35.5l5 -1000q0 -21 -14.5 -35.5t-35.5 -14.5l-100 -1q-21 0 -35.5 14.5t-14.5 35.5l-2 437l-463 -454q-14 -15 -24.5 -10.5t-10.5 25.5l-2 437l-462 -455q-15 -14 -25.5 -9.5t-10.5 24.5l-5 1000q0 21 10.5 25.5t25.5 -10.5l466 -450 l-2 438q0 20 10.5 24.5t25.5 -9.5l466 -451l-2 438q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe077;" d="M850 1100h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-464 -453q-15 -14 -25.5 -10t-10.5 25v1000q0 21 10.5 25t25.5 -10l464 -453v438q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe078;" d="M686 1081l501 -540q15 -15 10.5 -26t-26.5 -11h-1042q-22 0 -26.5 11t10.5 26l501 540q15 15 36 15t36 -15zM150 400h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe079;" d="M885 900l-352 -353l352 -353l-197 -198l-552 552l552 550z" />
+<glyph unicode="&#xe080;" d="M1064 547l-551 -551l-198 198l353 353l-353 353l198 198z" />
+<glyph unicode="&#xe081;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM650 900h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-150h-150 q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5t35.5 -14.5h150v-150q0 -21 14.5 -35.5t35.5 -14.5h100q21 0 35.5 14.5t14.5 35.5v150h150q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5h-150v150q0 21 -14.5 35.5t-35.5 14.5z" />
+<glyph unicode="&#xe082;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM850 700h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5 t35.5 -14.5h500q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5z" />
+<glyph unicode="&#xe083;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM741.5 913q-12.5 0 -21.5 -9l-120 -120l-120 120q-9 9 -21.5 9 t-21.5 -9l-141 -141q-9 -9 -9 -21.5t9 -21.5l120 -120l-120 -120q-9 -9 -9 -21.5t9 -21.5l141 -141q9 -9 21.5 -9t21.5 9l120 120l120 -120q9 -9 21.5 -9t21.5 9l141 141q9 9 9 21.5t-9 21.5l-120 120l120 120q9 9 9 21.5t-9 21.5l-141 141q-9 9 -21.5 9z" />
+<glyph unicode="&#xe084;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM546 623l-84 85q-7 7 -17.5 7t-18.5 -7l-139 -139q-7 -8 -7 -18t7 -18 l242 -241q7 -8 17.5 -8t17.5 8l375 375q7 7 7 17.5t-7 18.5l-139 139q-7 7 -17.5 7t-17.5 -7z" />
+<glyph unicode="&#xe085;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM588 941q-29 0 -59 -5.5t-63 -20.5t-58 -38.5t-41.5 -63t-16.5 -89.5 q0 -25 20 -25h131q30 -5 35 11q6 20 20.5 28t45.5 8q20 0 31.5 -10.5t11.5 -28.5q0 -23 -7 -34t-26 -18q-1 0 -13.5 -4t-19.5 -7.5t-20 -10.5t-22 -17t-18.5 -24t-15.5 -35t-8 -46q-1 -8 5.5 -16.5t20.5 -8.5h173q7 0 22 8t35 28t37.5 48t29.5 74t12 100q0 47 -17 83 t-42.5 57t-59.5 34.5t-64 18t-59 4.5zM675 400h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5z" />
+<glyph unicode="&#xe086;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM675 1000h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5 t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5zM675 700h-250q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h75v-200h-75q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h350q10 0 17.5 7.5t7.5 17.5v50q0 10 -7.5 17.5 t-17.5 7.5h-75v275q0 10 -7.5 17.5t-17.5 7.5z" />
+<glyph unicode="&#xe087;" d="M525 1200h150q10 0 17.5 -7.5t7.5 -17.5v-194q103 -27 178.5 -102.5t102.5 -178.5h194q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-194q-27 -103 -102.5 -178.5t-178.5 -102.5v-194q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v194 q-103 27 -178.5 102.5t-102.5 178.5h-194q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h194q27 103 102.5 178.5t178.5 102.5v194q0 10 7.5 17.5t17.5 7.5zM700 893v-168q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v168q-68 -23 -119 -74 t-74 -119h168q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-168q23 -68 74 -119t119 -74v168q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-168q68 23 119 74t74 119h-168q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h168 q-23 68 -74 119t-119 74z" />
+<glyph unicode="&#xe088;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM759 823l64 -64q7 -7 7 -17.5t-7 -17.5l-124 -124l124 -124q7 -7 7 -17.5t-7 -17.5l-64 -64q-7 -7 -17.5 -7t-17.5 7l-124 124l-124 -124q-7 -7 -17.5 -7t-17.5 7l-64 64 q-7 7 -7 17.5t7 17.5l124 124l-124 124q-7 7 -7 17.5t7 17.5l64 64q7 7 17.5 7t17.5 -7l124 -124l124 124q7 7 17.5 7t17.5 -7z" />
+<glyph unicode="&#xe089;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5t57 -214.5 t155.5 -155.5t214.5 -57t214.5 57t155.5 155.5t57 214.5t-57 214.5t-155.5 155.5t-214.5 57zM782 788l106 -106q7 -7 7 -17.5t-7 -17.5l-320 -321q-8 -7 -18 -7t-18 7l-202 203q-8 7 -8 17.5t8 17.5l106 106q7 8 17.5 8t17.5 -8l79 -79l197 197q7 7 17.5 7t17.5 -7z" />
+<glyph unicode="&#xe090;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM600 1027q-116 0 -214.5 -57t-155.5 -155.5t-57 -214.5q0 -120 65 -225 l587 587q-105 65 -225 65zM965 819l-584 -584q104 -62 219 -62q116 0 214.5 57t155.5 155.5t57 214.5q0 115 -62 219z" />
+<glyph unicode="&#xe091;" d="M39 582l522 427q16 13 27.5 8t11.5 -26v-291h550q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-550v-291q0 -21 -11.5 -26t-27.5 8l-522 427q-16 13 -16 32t16 32z" />
+<glyph unicode="&#xe092;" d="M639 1009l522 -427q16 -13 16 -32t-16 -32l-522 -427q-16 -13 -27.5 -8t-11.5 26v291h-550q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h550v291q0 21 11.5 26t27.5 -8z" />
+<glyph unicode="&#xe093;" d="M682 1161l427 -522q13 -16 8 -27.5t-26 -11.5h-291v-550q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v550h-291q-21 0 -26 11.5t8 27.5l427 522q13 16 32 16t32 -16z" />
+<glyph unicode="&#xe094;" d="M550 1200h200q21 0 35.5 -14.5t14.5 -35.5v-550h291q21 0 26 -11.5t-8 -27.5l-427 -522q-13 -16 -32 -16t-32 16l-427 522q-13 16 -8 27.5t26 11.5h291v550q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe095;" d="M639 1109l522 -427q16 -13 16 -32t-16 -32l-522 -427q-16 -13 -27.5 -8t-11.5 26v291q-94 -2 -182 -20t-170.5 -52t-147 -92.5t-100.5 -135.5q5 105 27 193.5t67.5 167t113 135t167 91.5t225.5 42v262q0 21 11.5 26t27.5 -8z" />
+<glyph unicode="&#xe096;" d="M850 1200h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94l-249 -249q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l249 249l-94 94q-14 14 -10 24.5t25 10.5zM350 0h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l249 249 q8 7 18 7t18 -7l106 -106q7 -8 7 -18t-7 -18l-249 -249l94 -94q14 -14 10 -24.5t-25 -10.5z" />
+<glyph unicode="&#xe097;" d="M1014 1120l106 -106q7 -8 7 -18t-7 -18l-249 -249l94 -94q14 -14 10 -24.5t-25 -10.5h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l249 249q8 7 18 7t18 -7zM250 600h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94 l-249 -249q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l249 249l-94 94q-14 14 -10 24.5t25 10.5z" />
+<glyph unicode="&#xe101;" d="M600 1177q117 0 224 -45.5t184.5 -123t123 -184.5t45.5 -224t-45.5 -224t-123 -184.5t-184.5 -123t-224 -45.5t-224 45.5t-184.5 123t-123 184.5t-45.5 224t45.5 224t123 184.5t184.5 123t224 45.5zM704 900h-208q-20 0 -32 -14.5t-8 -34.5l58 -302q4 -20 21.5 -34.5 t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5zM675 400h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5z" />
+<glyph unicode="&#xe102;" d="M260 1200q9 0 19 -2t15 -4l5 -2q22 -10 44 -23l196 -118q21 -13 36 -24q29 -21 37 -12q11 13 49 35l196 118q22 13 45 23q17 7 38 7q23 0 47 -16.5t37 -33.5l13 -16q14 -21 18 -45l25 -123l8 -44q1 -9 8.5 -14.5t17.5 -5.5h61q10 0 17.5 -7.5t7.5 -17.5v-50 q0 -10 -7.5 -17.5t-17.5 -7.5h-50q-10 0 -17.5 -7.5t-7.5 -17.5v-175h-400v300h-200v-300h-400v175q0 10 -7.5 17.5t-17.5 7.5h-50q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5h61q11 0 18 3t7 8q0 4 9 52l25 128q5 25 19 45q2 3 5 7t13.5 15t21.5 19.5t26.5 15.5 t29.5 7zM915 1079l-166 -162q-7 -7 -5 -12t12 -5h219q10 0 15 7t2 17l-51 149q-3 10 -11 12t-15 -6zM463 917l-177 157q-8 7 -16 5t-11 -12l-51 -143q-3 -10 2 -17t15 -7h231q11 0 12.5 5t-5.5 12zM500 0h-375q-10 0 -17.5 7.5t-7.5 17.5v375h400v-400zM1100 400v-375 q0 -10 -7.5 -17.5t-17.5 -7.5h-375v400h400z" />
+<glyph unicode="&#xe103;" d="M1165 1190q8 3 21 -6.5t13 -17.5q-2 -178 -24.5 -323.5t-55.5 -245.5t-87 -174.5t-102.5 -118.5t-118 -68.5t-118.5 -33t-120 -4.5t-105 9.5t-90 16.5q-61 12 -78 11q-4 1 -12.5 0t-34 -14.5t-52.5 -40.5l-153 -153q-26 -24 -37 -14.5t-11 43.5q0 64 42 102q8 8 50.5 45 t66.5 58q19 17 35 47t13 61q-9 55 -10 102.5t7 111t37 130t78 129.5q39 51 80 88t89.5 63.5t94.5 45t113.5 36t129 31t157.5 37t182 47.5zM1116 1098q-8 9 -22.5 -3t-45.5 -50q-38 -47 -119 -103.5t-142 -89.5l-62 -33q-56 -30 -102 -57t-104 -68t-102.5 -80.5t-85.5 -91 t-64 -104.5q-24 -56 -31 -86t2 -32t31.5 17.5t55.5 59.5q25 30 94 75.5t125.5 77.5t147.5 81q70 37 118.5 69t102 79.5t99 111t86.5 148.5q22 50 24 60t-6 19z" />
+<glyph unicode="&#xe104;" d="M653 1231q-39 -67 -54.5 -131t-10.5 -114.5t24.5 -96.5t47.5 -80t63.5 -62.5t68.5 -46.5t65 -30q-4 7 -17.5 35t-18.5 39.5t-17 39.5t-17 43t-13 42t-9.5 44.5t-2 42t4 43t13.5 39t23 38.5q96 -42 165 -107.5t105 -138t52 -156t13 -159t-19 -149.5q-13 -55 -44 -106.5 t-68 -87t-78.5 -64.5t-72.5 -45t-53 -22q-72 -22 -127 -11q-31 6 -13 19q6 3 17 7q13 5 32.5 21t41 44t38.5 63.5t21.5 81.5t-6.5 94.5t-50 107t-104 115.5q10 -104 -0.5 -189t-37 -140.5t-65 -93t-84 -52t-93.5 -11t-95 24.5q-80 36 -131.5 114t-53.5 171q-2 23 0 49.5 t4.5 52.5t13.5 56t27.5 60t46 64.5t69.5 68.5q-8 -53 -5 -102.5t17.5 -90t34 -68.5t44.5 -39t49 -2q31 13 38.5 36t-4.5 55t-29 64.5t-36 75t-26 75.5q-15 85 2 161.5t53.5 128.5t85.5 92.5t93.5 61t81.5 25.5z" />
+<glyph unicode="&#xe105;" d="M600 1094q82 0 160.5 -22.5t140 -59t116.5 -82.5t94.5 -95t68 -95t42.5 -82.5t14 -57.5t-14 -57.5t-43 -82.5t-68.5 -95t-94.5 -95t-116.5 -82.5t-140 -59t-159.5 -22.5t-159.5 22.5t-140 59t-116.5 82.5t-94.5 95t-68.5 95t-43 82.5t-14 57.5t14 57.5t42.5 82.5t68 95 t94.5 95t116.5 82.5t140 59t160.5 22.5zM888 829q-15 15 -18 12t5 -22q25 -57 25 -119q0 -124 -88 -212t-212 -88t-212 88t-88 212q0 59 23 114q8 19 4.5 22t-17.5 -12q-70 -69 -160 -184q-13 -16 -15 -40.5t9 -42.5q22 -36 47 -71t70 -82t92.5 -81t113 -58.5t133.5 -24.5 t133.5 24t113 58.5t92.5 81.5t70 81.5t47 70.5q11 18 9 42.5t-14 41.5q-90 117 -163 189zM448 727l-35 -36q-15 -15 -19.5 -38.5t4.5 -41.5q37 -68 93 -116q16 -13 38.5 -11t36.5 17l35 34q14 15 12.5 33.5t-16.5 33.5q-44 44 -89 117q-11 18 -28 20t-32 -12z" />
+<glyph unicode="&#xe106;" d="M592 0h-148l31 120q-91 20 -175.5 68.5t-143.5 106.5t-103.5 119t-66.5 110t-22 76q0 21 14 57.5t42.5 82.5t68 95t94.5 95t116.5 82.5t140 59t160.5 22.5q61 0 126 -15l32 121h148zM944 770l47 181q108 -85 176.5 -192t68.5 -159q0 -26 -19.5 -71t-59.5 -102t-93 -112 t-129 -104.5t-158 -75.5l46 173q77 49 136 117t97 131q11 18 9 42.5t-14 41.5q-54 70 -107 130zM310 824q-70 -69 -160 -184q-13 -16 -15 -40.5t9 -42.5q18 -30 39 -60t57 -70.5t74 -73t90 -61t105 -41.5l41 154q-107 18 -178.5 101.5t-71.5 193.5q0 59 23 114q8 19 4.5 22 t-17.5 -12zM448 727l-35 -36q-15 -15 -19.5 -38.5t4.5 -41.5q37 -68 93 -116q16 -13 38.5 -11t36.5 17l12 11l22 86l-3 4q-44 44 -89 117q-11 18 -28 20t-32 -12z" />
+<glyph unicode="&#xe107;" d="M-90 100l642 1066q20 31 48 28.5t48 -35.5l642 -1056q21 -32 7.5 -67.5t-50.5 -35.5h-1294q-37 0 -50.5 34t7.5 66zM155 200h345v75q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-75h345l-445 723zM496 700h208q20 0 32 -14.5t8 -34.5l-58 -252 q-4 -20 -21.5 -34.5t-37.5 -14.5h-54q-20 0 -37.5 14.5t-21.5 34.5l-58 252q-4 20 8 34.5t32 14.5z" />
+<glyph unicode="&#xe108;" d="M650 1200q62 0 106 -44t44 -106v-339l363 -325q15 -14 26 -38.5t11 -44.5v-41q0 -20 -12 -26.5t-29 5.5l-359 249v-263q100 -93 100 -113v-64q0 -21 -13 -29t-32 1l-205 128l-205 -128q-19 -9 -32 -1t-13 29v64q0 20 100 113v263l-359 -249q-17 -12 -29 -5.5t-12 26.5v41 q0 20 11 44.5t26 38.5l363 325v339q0 62 44 106t106 44z" />
+<glyph unicode="&#xe109;" d="M850 1200h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-150h-1100v150q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-50h500v50q0 21 14.5 35.5t35.5 14.5zM1100 800v-750q0 -21 -14.5 -35.5 t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v750h1100zM100 600v-100h100v100h-100zM300 600v-100h100v100h-100zM500 600v-100h100v100h-100zM700 600v-100h100v100h-100zM900 600v-100h100v100h-100zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400 v-100h100v100h-100zM700 400v-100h100v100h-100zM900 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100zM500 200v-100h100v100h-100zM700 200v-100h100v100h-100zM900 200v-100h100v100h-100z" />
+<glyph unicode="&#xe110;" d="M1135 1165l249 -230q15 -14 15 -35t-15 -35l-249 -230q-14 -14 -24.5 -10t-10.5 25v150h-159l-600 -600h-291q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h209l600 600h241v150q0 21 10.5 25t24.5 -10zM522 819l-141 -141l-122 122h-209q-21 0 -35.5 14.5 t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h291zM1135 565l249 -230q15 -14 15 -35t-15 -35l-249 -230q-14 -14 -24.5 -10t-10.5 25v150h-241l-181 181l141 141l122 -122h159v150q0 21 10.5 25t24.5 -10z" />
+<glyph unicode="&#xe111;" d="M100 1100h1000q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-596l-304 -300v300h-100q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5z" />
+<glyph unicode="&#xe112;" d="M150 1200h200q21 0 35.5 -14.5t14.5 -35.5v-250h-300v250q0 21 14.5 35.5t35.5 14.5zM850 1200h200q21 0 35.5 -14.5t14.5 -35.5v-250h-300v250q0 21 14.5 35.5t35.5 14.5zM1100 800v-300q0 -41 -3 -77.5t-15 -89.5t-32 -96t-58 -89t-89 -77t-129 -51t-174 -20t-174 20 t-129 51t-89 77t-58 89t-32 96t-15 89.5t-3 77.5v300h300v-250v-27v-42.5t1.5 -41t5 -38t10 -35t16.5 -30t25.5 -24.5t35 -19t46.5 -12t60 -4t60 4.5t46.5 12.5t35 19.5t25 25.5t17 30.5t10 35t5 38t2 40.5t-0.5 42v25v250h300z" />
+<glyph unicode="&#xe113;" d="M1100 411l-198 -199l-353 353l-353 -353l-197 199l551 551z" />
+<glyph unicode="&#xe114;" d="M1101 789l-550 -551l-551 551l198 199l353 -353l353 353z" />
+<glyph unicode="&#xe115;" d="M404 1000h746q21 0 35.5 -14.5t14.5 -35.5v-551h150q21 0 25 -10.5t-10 -24.5l-230 -249q-14 -15 -35 -15t-35 15l-230 249q-14 14 -10 24.5t25 10.5h150v401h-381zM135 984l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-400h385l215 -200h-750q-21 0 -35.5 14.5 t-14.5 35.5v550h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" />
+<glyph unicode="&#xe116;" d="M56 1200h94q17 0 31 -11t18 -27l38 -162h896q24 0 39 -18.5t10 -42.5l-100 -475q-5 -21 -27 -42.5t-55 -21.5h-633l48 -200h535q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-50q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v50h-300v-50 q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v50h-31q-18 0 -32.5 10t-20.5 19l-5 10l-201 961h-54q-20 0 -35 14.5t-15 35.5t15 35.5t35 14.5z" />
+<glyph unicode="&#xe117;" d="M1200 1000v-100h-1200v100h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500zM0 800h1200v-800h-1200v800z" />
+<glyph unicode="&#xe118;" d="M200 800l-200 -400v600h200q0 41 29.5 70.5t70.5 29.5h300q42 0 71 -29.5t29 -70.5h500v-200h-1000zM1500 700l-300 -700h-1200l300 700h1200z" />
+<glyph unicode="&#xe119;" d="M635 1184l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-601h150q21 0 25 -10.5t-10 -24.5l-230 -249q-14 -15 -35 -15t-35 15l-230 249q-14 14 -10 24.5t25 10.5h150v601h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" />
+<glyph unicode="&#xe120;" d="M936 864l249 -229q14 -15 14 -35.5t-14 -35.5l-249 -229q-15 -15 -25.5 -10.5t-10.5 24.5v151h-600v-151q0 -20 -10.5 -24.5t-25.5 10.5l-249 229q-14 15 -14 35.5t14 35.5l249 229q15 15 25.5 10.5t10.5 -25.5v-149h600v149q0 21 10.5 25.5t25.5 -10.5z" />
+<glyph unicode="&#xe121;" d="M1169 400l-172 732q-5 23 -23 45.5t-38 22.5h-672q-20 0 -38 -20t-23 -41l-172 -739h1138zM1100 300h-1000q-41 0 -70.5 -29.5t-29.5 -70.5v-100q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5v100q0 41 -29.5 70.5t-70.5 29.5zM800 100v100h100v-100h-100 zM1000 100v100h100v-100h-100z" />
+<glyph unicode="&#xe122;" d="M1150 1100q21 0 35.5 -14.5t14.5 -35.5v-850q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v850q0 21 14.5 35.5t35.5 14.5zM1000 200l-675 200h-38l47 -276q3 -16 -5.5 -20t-29.5 -4h-7h-84q-20 0 -34.5 14t-18.5 35q-55 337 -55 351v250v6q0 16 1 23.5t6.5 14 t17.5 6.5h200l675 250v-850zM0 750v-250q-4 0 -11 0.5t-24 6t-30 15t-24 30t-11 48.5v50q0 26 10.5 46t25 30t29 16t25.5 7z" />
+<glyph unicode="&#xe123;" d="M553 1200h94q20 0 29 -10.5t3 -29.5l-18 -37q83 -19 144 -82.5t76 -140.5l63 -327l118 -173h17q19 0 33 -14.5t14 -35t-13 -40.5t-31 -27q-8 -4 -23 -9.5t-65 -19.5t-103 -25t-132.5 -20t-158.5 -9q-57 0 -115 5t-104 12t-88.5 15.5t-73.5 17.5t-54.5 16t-35.5 12l-11 4 q-18 8 -31 28t-13 40.5t14 35t33 14.5h17l118 173l63 327q15 77 76 140t144 83l-18 32q-6 19 3.5 32t28.5 13zM498 110q50 -6 102 -6q53 0 102 6q-12 -49 -39.5 -79.5t-62.5 -30.5t-63 30.5t-39 79.5z" />
+<glyph unicode="&#xe124;" d="M800 946l224 78l-78 -224l234 -45l-180 -155l180 -155l-234 -45l78 -224l-224 78l-45 -234l-155 180l-155 -180l-45 234l-224 -78l78 224l-234 45l180 155l-180 155l234 45l-78 224l224 -78l45 234l155 -180l155 180z" />
+<glyph unicode="&#xe125;" d="M650 1200h50q40 0 70 -40.5t30 -84.5v-150l-28 -125h328q40 0 70 -40.5t30 -84.5v-100q0 -45 -29 -74l-238 -344q-16 -24 -38 -40.5t-45 -16.5h-250q-7 0 -42 25t-66 50l-31 25h-61q-45 0 -72.5 18t-27.5 57v400q0 36 20 63l145 196l96 198q13 28 37.5 48t51.5 20z M650 1100l-100 -212l-150 -213v-375h100l136 -100h214l250 375v125h-450l50 225v175h-50zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe126;" d="M600 1100h250q23 0 45 -16.5t38 -40.5l238 -344q29 -29 29 -74v-100q0 -44 -30 -84.5t-70 -40.5h-328q28 -118 28 -125v-150q0 -44 -30 -84.5t-70 -40.5h-50q-27 0 -51.5 20t-37.5 48l-96 198l-145 196q-20 27 -20 63v400q0 39 27.5 57t72.5 18h61q124 100 139 100z M50 1000h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5zM636 1000l-136 -100h-100v-375l150 -213l100 -212h50v175l-50 225h450v125l-250 375h-214z" />
+<glyph unicode="&#xe127;" d="M356 873l363 230q31 16 53 -6l110 -112q13 -13 13.5 -32t-11.5 -34l-84 -121h302q84 0 138 -38t54 -110t-55 -111t-139 -39h-106l-131 -339q-6 -21 -19.5 -41t-28.5 -20h-342q-7 0 -90 81t-83 94v525q0 17 14 35.5t28 28.5zM400 792v-503l100 -89h293l131 339 q6 21 19.5 41t28.5 20h203q21 0 30.5 25t0.5 50t-31 25h-456h-7h-6h-5.5t-6 0.5t-5 1.5t-5 2t-4 2.5t-4 4t-2.5 4.5q-12 25 5 47l146 183l-86 83zM50 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v500 q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe128;" d="M475 1103l366 -230q2 -1 6 -3.5t14 -10.5t18 -16.5t14.5 -20t6.5 -22.5v-525q0 -13 -86 -94t-93 -81h-342q-15 0 -28.5 20t-19.5 41l-131 339h-106q-85 0 -139.5 39t-54.5 111t54 110t138 38h302l-85 121q-11 15 -10.5 34t13.5 32l110 112q22 22 53 6zM370 945l146 -183 q17 -22 5 -47q-2 -2 -3.5 -4.5t-4 -4t-4 -2.5t-5 -2t-5 -1.5t-6 -0.5h-6h-6.5h-6h-475v-100h221q15 0 29 -20t20 -41l130 -339h294l106 89v503l-342 236zM1050 800h100q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5 v500q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe129;" d="M550 1294q72 0 111 -55t39 -139v-106l339 -131q21 -6 41 -19.5t20 -28.5v-342q0 -7 -81 -90t-94 -83h-525q-17 0 -35.5 14t-28.5 28l-9 14l-230 363q-16 31 6 53l112 110q13 13 32 13.5t34 -11.5l121 -84v302q0 84 38 138t110 54zM600 972v203q0 21 -25 30.5t-50 0.5 t-25 -31v-456v-7v-6v-5.5t-0.5 -6t-1.5 -5t-2 -5t-2.5 -4t-4 -4t-4.5 -2.5q-25 -12 -47 5l-183 146l-83 -86l236 -339h503l89 100v293l-339 131q-21 6 -41 19.5t-20 28.5zM450 200h500q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-500 q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe130;" d="M350 1100h500q21 0 35.5 14.5t14.5 35.5v100q0 21 -14.5 35.5t-35.5 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -21 14.5 -35.5t35.5 -14.5zM600 306v-106q0 -84 -39 -139t-111 -55t-110 54t-38 138v302l-121 -84q-15 -12 -34 -11.5t-32 13.5l-112 110 q-22 22 -6 53l230 363q1 2 3.5 6t10.5 13.5t16.5 17t20 13.5t22.5 6h525q13 0 94 -83t81 -90v-342q0 -15 -20 -28.5t-41 -19.5zM308 900l-236 -339l83 -86l183 146q22 17 47 5q2 -1 4.5 -2.5t4 -4t2.5 -4t2 -5t1.5 -5t0.5 -6v-5.5v-6v-7v-456q0 -22 25 -31t50 0.5t25 30.5 v203q0 15 20 28.5t41 19.5l339 131v293l-89 100h-503z" />
+<glyph unicode="&#xe131;" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM914 632l-275 223q-16 13 -27.5 8t-11.5 -26v-137h-275 q-10 0 -17.5 -7.5t-7.5 -17.5v-150q0 -10 7.5 -17.5t17.5 -7.5h275v-137q0 -21 11.5 -26t27.5 8l275 223q16 13 16 32t-16 32z" />
+<glyph unicode="&#xe132;" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM561 855l-275 -223q-16 -13 -16 -32t16 -32l275 -223q16 -13 27.5 -8 t11.5 26v137h275q10 0 17.5 7.5t7.5 17.5v150q0 10 -7.5 17.5t-17.5 7.5h-275v137q0 21 -11.5 26t-27.5 -8z" />
+<glyph unicode="&#xe133;" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM855 639l-223 275q-13 16 -32 16t-32 -16l-223 -275q-13 -16 -8 -27.5 t26 -11.5h137v-275q0 -10 7.5 -17.5t17.5 -7.5h150q10 0 17.5 7.5t7.5 17.5v275h137q21 0 26 11.5t-8 27.5z" />
+<glyph unicode="&#xe134;" d="M600 1178q118 0 225 -45.5t184.5 -123t123 -184.5t45.5 -225t-45.5 -225t-123 -184.5t-184.5 -123t-225 -45.5t-225 45.5t-184.5 123t-123 184.5t-45.5 225t45.5 225t123 184.5t184.5 123t225 45.5zM675 900h-150q-10 0 -17.5 -7.5t-7.5 -17.5v-275h-137q-21 0 -26 -11.5 t8 -27.5l223 -275q13 -16 32 -16t32 16l223 275q13 16 8 27.5t-26 11.5h-137v275q0 10 -7.5 17.5t-17.5 7.5z" />
+<glyph unicode="&#xe135;" d="M600 1176q116 0 222.5 -46t184 -123.5t123.5 -184t46 -222.5t-46 -222.5t-123.5 -184t-184 -123.5t-222.5 -46t-222.5 46t-184 123.5t-123.5 184t-46 222.5t46 222.5t123.5 184t184 123.5t222.5 46zM627 1101q-15 -12 -36.5 -20.5t-35.5 -12t-43 -8t-39 -6.5 q-15 -3 -45.5 0t-45.5 -2q-20 -7 -51.5 -26.5t-34.5 -34.5q-3 -11 6.5 -22.5t8.5 -18.5q-3 -34 -27.5 -91t-29.5 -79q-9 -34 5 -93t8 -87q0 -9 17 -44.5t16 -59.5q12 0 23 -5t23.5 -15t19.5 -14q16 -8 33 -15t40.5 -15t34.5 -12q21 -9 52.5 -32t60 -38t57.5 -11 q7 -15 -3 -34t-22.5 -40t-9.5 -38q13 -21 23 -34.5t27.5 -27.5t36.5 -18q0 -7 -3.5 -16t-3.5 -14t5 -17q104 -2 221 112q30 29 46.5 47t34.5 49t21 63q-13 8 -37 8.5t-36 7.5q-15 7 -49.5 15t-51.5 19q-18 0 -41 -0.5t-43 -1.5t-42 -6.5t-38 -16.5q-51 -35 -66 -12 q-4 1 -3.5 25.5t0.5 25.5q-6 13 -26.5 17.5t-24.5 6.5q1 15 -0.5 30.5t-7 28t-18.5 11.5t-31 -21q-23 -25 -42 4q-19 28 -8 58q6 16 22 22q6 -1 26 -1.5t33.5 -4t19.5 -13.5q7 -12 18 -24t21.5 -20.5t20 -15t15.5 -10.5l5 -3q2 12 7.5 30.5t8 34.5t-0.5 32q-3 18 3.5 29 t18 22.5t15.5 24.5q6 14 10.5 35t8 31t15.5 22.5t34 22.5q-6 18 10 36q8 0 24 -1.5t24.5 -1.5t20 4.5t20.5 15.5q-10 23 -31 42.5t-37.5 29.5t-49 27t-43.5 23q0 1 2 8t3 11.5t1.5 10.5t-1 9.5t-4.5 4.5q31 -13 58.5 -14.5t38.5 2.5l12 5q5 28 -9.5 46t-36.5 24t-50 15 t-41 20q-18 -4 -37 0zM613 994q0 -17 8 -42t17 -45t9 -23q-8 1 -39.5 5.5t-52.5 10t-37 16.5q3 11 16 29.5t16 25.5q10 -10 19 -10t14 6t13.5 14.5t16.5 12.5z" />
+<glyph unicode="&#xe136;" d="M756 1157q164 92 306 -9l-259 -138l145 -232l251 126q6 -89 -34 -156.5t-117 -110.5q-60 -34 -127 -39.5t-126 16.5l-596 -596q-15 -16 -36.5 -16t-36.5 16l-111 110q-15 15 -15 36.5t15 37.5l600 599q-34 101 5.5 201.5t135.5 154.5z" />
+<glyph unicode="&#xe137;" horiz-adv-x="1220" d="M100 1196h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 1096h-200v-100h200v100zM100 796h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 696h-500v-100h500v100zM100 396h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 296h-300v-100h300v100z " />
+<glyph unicode="&#xe138;" d="M150 1200h900q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM700 500v-300l-200 -200v500l-350 500h900z" />
+<glyph unicode="&#xe139;" d="M500 1200h200q41 0 70.5 -29.5t29.5 -70.5v-100h300q41 0 70.5 -29.5t29.5 -70.5v-400h-500v100h-200v-100h-500v400q0 41 29.5 70.5t70.5 29.5h300v100q0 41 29.5 70.5t70.5 29.5zM500 1100v-100h200v100h-200zM1200 400v-200q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v200h1200z" />
+<glyph unicode="&#xe140;" d="M50 1200h300q21 0 25 -10.5t-10 -24.5l-94 -94l199 -199q7 -8 7 -18t-7 -18l-106 -106q-8 -7 -18 -7t-18 7l-199 199l-94 -94q-14 -14 -24.5 -10t-10.5 25v300q0 21 14.5 35.5t35.5 14.5zM850 1200h300q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -10.5 -25t-24.5 10l-94 94 l-199 -199q-8 -7 -18 -7t-18 7l-106 106q-7 8 -7 18t7 18l199 199l-94 94q-14 14 -10 24.5t25 10.5zM364 470l106 -106q7 -8 7 -18t-7 -18l-199 -199l94 -94q14 -14 10 -24.5t-25 -10.5h-300q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 10.5 25t24.5 -10l94 -94l199 199 q8 7 18 7t18 -7zM1071 271l94 94q14 14 24.5 10t10.5 -25v-300q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -25 10.5t10 24.5l94 94l-199 199q-7 8 -7 18t7 18l106 106q8 7 18 7t18 -7z" />
+<glyph unicode="&#xe141;" d="M596 1192q121 0 231.5 -47.5t190 -127t127 -190t47.5 -231.5t-47.5 -231.5t-127 -190.5t-190 -127t-231.5 -47t-231.5 47t-190.5 127t-127 190.5t-47 231.5t47 231.5t127 190t190.5 127t231.5 47.5zM596 1010q-112 0 -207.5 -55.5t-151 -151t-55.5 -207.5t55.5 -207.5 t151 -151t207.5 -55.5t207.5 55.5t151 151t55.5 207.5t-55.5 207.5t-151 151t-207.5 55.5zM454.5 905q22.5 0 38.5 -16t16 -38.5t-16 -39t-38.5 -16.5t-38.5 16.5t-16 39t16 38.5t38.5 16zM754.5 905q22.5 0 38.5 -16t16 -38.5t-16 -39t-38 -16.5q-14 0 -29 10l-55 -145 q17 -23 17 -51q0 -36 -25.5 -61.5t-61.5 -25.5t-61.5 25.5t-25.5 61.5q0 32 20.5 56.5t51.5 29.5l122 126l1 1q-9 14 -9 28q0 23 16 39t38.5 16zM345.5 709q22.5 0 38.5 -16t16 -38.5t-16 -38.5t-38.5 -16t-38.5 16t-16 38.5t16 38.5t38.5 16zM854.5 709q22.5 0 38.5 -16 t16 -38.5t-16 -38.5t-38.5 -16t-38.5 16t-16 38.5t16 38.5t38.5 16z" />
+<glyph unicode="&#xe142;" d="M546 173l469 470q91 91 99 192q7 98 -52 175.5t-154 94.5q-22 4 -47 4q-34 0 -66.5 -10t-56.5 -23t-55.5 -38t-48 -41.5t-48.5 -47.5q-376 -375 -391 -390q-30 -27 -45 -41.5t-37.5 -41t-32 -46.5t-16 -47.5t-1.5 -56.5q9 -62 53.5 -95t99.5 -33q74 0 125 51l548 548 q36 36 20 75q-7 16 -21.5 26t-32.5 10q-26 0 -50 -23q-13 -12 -39 -38l-341 -338q-15 -15 -35.5 -15.5t-34.5 13.5t-14 34.5t14 34.5q327 333 361 367q35 35 67.5 51.5t78.5 16.5q14 0 29 -1q44 -8 74.5 -35.5t43.5 -68.5q14 -47 2 -96.5t-47 -84.5q-12 -11 -32 -32 t-79.5 -81t-114.5 -115t-124.5 -123.5t-123 -119.5t-96.5 -89t-57 -45q-56 -27 -120 -27q-70 0 -129 32t-93 89q-48 78 -35 173t81 163l511 511q71 72 111 96q91 55 198 55q80 0 152 -33q78 -36 129.5 -103t66.5 -154q17 -93 -11 -183.5t-94 -156.5l-482 -476 q-15 -15 -36 -16t-37 14t-17.5 34t14.5 35z" />
+<glyph unicode="&#xe143;" d="M649 949q48 68 109.5 104t121.5 38.5t118.5 -20t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-150 152.5t-126.5 127.5t-93.5 124.5t-33.5 117.5q0 64 28 123t73 100.5t104 64t119 20 t120.5 -38.5t104.5 -104zM896 972q-33 0 -64.5 -19t-56.5 -46t-47.5 -53.5t-43.5 -45.5t-37.5 -19t-36 19t-40 45.5t-43 53.5t-54 46t-65.5 19q-67 0 -122.5 -55.5t-55.5 -132.5q0 -23 13.5 -51t46 -65t57.5 -63t76 -75l22 -22q15 -14 44 -44t50.5 -51t46 -44t41 -35t23 -12 t23.5 12t42.5 36t46 44t52.5 52t44 43q4 4 12 13q43 41 63.5 62t52 55t46 55t26 46t11.5 44q0 79 -53 133.5t-120 54.5z" />
+<glyph unicode="&#xe144;" d="M776.5 1214q93.5 0 159.5 -66l141 -141q66 -66 66 -160q0 -42 -28 -95.5t-62 -87.5l-29 -29q-31 53 -77 99l-18 18l95 95l-247 248l-389 -389l212 -212l-105 -106l-19 18l-141 141q-66 66 -66 159t66 159l283 283q65 66 158.5 66zM600 706l105 105q10 -8 19 -17l141 -141 q66 -66 66 -159t-66 -159l-283 -283q-66 -66 -159 -66t-159 66l-141 141q-66 66 -66 159.5t66 159.5l55 55q29 -55 75 -102l18 -17l-95 -95l247 -248l389 389z" />
+<glyph unicode="&#xe145;" d="M603 1200q85 0 162 -15t127 -38t79 -48t29 -46v-953q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5v953q0 21 30 46.5t81 48t129 37.5t163 15zM300 1000v-700h600v700h-600zM600 254q-43 0 -73.5 -30.5t-30.5 -73.5t30.5 -73.5t73.5 -30.5t73.5 30.5 t30.5 73.5t-30.5 73.5t-73.5 30.5z" />
+<glyph unicode="&#xe146;" d="M902 1185l283 -282q15 -15 15 -36t-14.5 -35.5t-35.5 -14.5t-35 15l-36 35l-279 -267v-300l-212 210l-308 -307l-280 -203l203 280l307 308l-210 212h300l267 279l-35 36q-15 14 -15 35t14.5 35.5t35.5 14.5t35 -15z" />
+<glyph unicode="&#xe148;" d="M700 1248v-78q38 -5 72.5 -14.5t75.5 -31.5t71 -53.5t52 -84t24 -118.5h-159q-4 36 -10.5 59t-21 45t-40 35.5t-64.5 20.5v-307l64 -13q34 -7 64 -16.5t70 -32t67.5 -52.5t47.5 -80t20 -112q0 -139 -89 -224t-244 -97v-77h-100v79q-150 16 -237 103q-40 40 -52.5 93.5 t-15.5 139.5h139q5 -77 48.5 -126t117.5 -65v335l-27 8q-46 14 -79 26.5t-72 36t-63 52t-40 72.5t-16 98q0 70 25 126t67.5 92t94.5 57t110 27v77h100zM600 754v274q-29 -4 -50 -11t-42 -21.5t-31.5 -41.5t-10.5 -65q0 -29 7 -50.5t16.5 -34t28.5 -22.5t31.5 -14t37.5 -10 q9 -3 13 -4zM700 547v-310q22 2 42.5 6.5t45 15.5t41.5 27t29 42t12 59.5t-12.5 59.5t-38 44.5t-53 31t-66.5 24.5z" />
+<glyph unicode="&#xe149;" d="M561 1197q84 0 160.5 -40t123.5 -109.5t47 -147.5h-153q0 40 -19.5 71.5t-49.5 48.5t-59.5 26t-55.5 9q-37 0 -79 -14.5t-62 -35.5q-41 -44 -41 -101q0 -26 13.5 -63t26.5 -61t37 -66q6 -9 9 -14h241v-100h-197q8 -50 -2.5 -115t-31.5 -95q-45 -62 -99 -112 q34 10 83 17.5t71 7.5q32 1 102 -16t104 -17q83 0 136 30l50 -147q-31 -19 -58 -30.5t-55 -15.5t-42 -4.5t-46 -0.5q-23 0 -76 17t-111 32.5t-96 11.5q-39 -3 -82 -16t-67 -25l-23 -11l-55 145q4 3 16 11t15.5 10.5t13 9t15.5 12t14.5 14t17.5 18.5q48 55 54 126.5 t-30 142.5h-221v100h166q-23 47 -44 104q-7 20 -12 41.5t-6 55.5t6 66.5t29.5 70.5t58.5 71q97 88 263 88z" />
+<glyph unicode="&#xe150;" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM935 1184l230 -249q14 -14 10 -24.5t-25 -10.5h-150v-900h-200v900h-150q-21 0 -25 10.5t10 24.5l230 249q14 15 35 15t35 -15z" />
+<glyph unicode="&#xe151;" d="M1000 700h-100v100h-100v-100h-100v500h300v-500zM400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM801 1100v-200h100v200h-100zM1000 350l-200 -250h200v-100h-300v150l200 250h-200v100h300v-150z " />
+<glyph unicode="&#xe152;" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1000 1050l-200 -250h200v-100h-300v150l200 250h-200v100h300v-150zM1000 0h-100v100h-100v-100h-100v500h300v-500zM801 400v-200h100v200h-100z " />
+<glyph unicode="&#xe153;" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1000 700h-100v400h-100v100h200v-500zM1100 0h-100v100h-200v400h300v-500zM901 400v-200h100v200h-100z" />
+<glyph unicode="&#xe154;" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1100 700h-100v100h-200v400h300v-500zM901 1100v-200h100v200h-100zM1000 0h-100v400h-100v100h200v-500z" />
+<glyph unicode="&#xe155;" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM900 1000h-200v200h200v-200zM1000 700h-300v200h300v-200zM1100 400h-400v200h400v-200zM1200 100h-500v200h500v-200z" />
+<glyph unicode="&#xe156;" d="M400 300h150q21 0 25 -11t-10 -25l-230 -250q-14 -15 -35 -15t-35 15l-230 250q-14 14 -10 25t25 11h150v900h200v-900zM1200 1000h-500v200h500v-200zM1100 700h-400v200h400v-200zM1000 400h-300v200h300v-200zM900 100h-200v200h200v-200z" />
+<glyph unicode="&#xe157;" d="M350 1100h400q162 0 256 -93.5t94 -256.5v-400q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5z" />
+<glyph unicode="&#xe158;" d="M350 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-163 0 -256.5 92.5t-93.5 257.5v400q0 163 94 256.5t256 93.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM440 770l253 -190q17 -12 17 -30t-17 -30l-253 -190q-16 -12 -28 -6.5t-12 26.5v400q0 21 12 26.5t28 -6.5z" />
+<glyph unicode="&#xe159;" d="M350 1100h400q163 0 256.5 -94t93.5 -256v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 163 92.5 256.5t257.5 93.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM350 700h400q21 0 26.5 -12t-6.5 -28l-190 -253q-12 -17 -30 -17t-30 17l-190 253q-12 16 -6.5 28t26.5 12z" />
+<glyph unicode="&#xe160;" d="M350 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -163 -92.5 -256.5t-257.5 -93.5h-400q-163 0 -256.5 94t-93.5 256v400q0 165 92.5 257.5t257.5 92.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5 v500q0 41 -29.5 70.5t-70.5 29.5zM580 693l190 -253q12 -16 6.5 -28t-26.5 -12h-400q-21 0 -26.5 12t6.5 28l190 253q12 17 30 17t30 -17z" />
+<glyph unicode="&#xe161;" d="M550 1100h400q165 0 257.5 -92.5t92.5 -257.5v-400q0 -165 -92.5 -257.5t-257.5 -92.5h-400q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h450q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-450q-21 0 -35.5 14.5t-14.5 35.5v100 q0 21 14.5 35.5t35.5 14.5zM338 867l324 -284q16 -14 16 -33t-16 -33l-324 -284q-16 -14 -27 -9t-11 26v150h-250q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h250v150q0 21 11 26t27 -9z" />
+<glyph unicode="&#xe162;" d="M793 1182l9 -9q8 -10 5 -27q-3 -11 -79 -225.5t-78 -221.5l300 1q24 0 32.5 -17.5t-5.5 -35.5q-1 0 -133.5 -155t-267 -312.5t-138.5 -162.5q-12 -15 -26 -15h-9l-9 8q-9 11 -4 32q2 9 42 123.5t79 224.5l39 110h-302q-23 0 -31 19q-10 21 6 41q75 86 209.5 237.5 t228 257t98.5 111.5q9 16 25 16h9z" />
+<glyph unicode="&#xe163;" d="M350 1100h400q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-450q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h450q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400 q0 165 92.5 257.5t257.5 92.5zM938 867l324 -284q16 -14 16 -33t-16 -33l-324 -284q-16 -14 -27 -9t-11 26v150h-250q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h250v150q0 21 11 26t27 -9z" />
+<glyph unicode="&#xe164;" d="M750 1200h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -10.5 -25t-24.5 10l-109 109l-312 -312q-15 -15 -35.5 -15t-35.5 15l-141 141q-15 15 -15 35.5t15 35.5l312 312l-109 109q-14 14 -10 24.5t25 10.5zM456 900h-156q-41 0 -70.5 -29.5t-29.5 -70.5v-500 q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v148l200 200v-298q0 -165 -93.5 -257.5t-256.5 -92.5h-400q-165 0 -257.5 92.5t-92.5 257.5v400q0 165 92.5 257.5t257.5 92.5h300z" />
+<glyph unicode="&#xe165;" d="M600 1186q119 0 227.5 -46.5t187 -125t125 -187t46.5 -227.5t-46.5 -227.5t-125 -187t-187 -125t-227.5 -46.5t-227.5 46.5t-187 125t-125 187t-46.5 227.5t46.5 227.5t125 187t187 125t227.5 46.5zM600 1022q-115 0 -212 -56.5t-153.5 -153.5t-56.5 -212t56.5 -212 t153.5 -153.5t212 -56.5t212 56.5t153.5 153.5t56.5 212t-56.5 212t-153.5 153.5t-212 56.5zM600 794q80 0 137 -57t57 -137t-57 -137t-137 -57t-137 57t-57 137t57 137t137 57z" />
+<glyph unicode="&#xe166;" d="M450 1200h200q21 0 35.5 -14.5t14.5 -35.5v-350h245q20 0 25 -11t-9 -26l-383 -426q-14 -15 -33.5 -15t-32.5 15l-379 426q-13 15 -8.5 26t25.5 11h250v350q0 21 14.5 35.5t35.5 14.5zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5z M900 200v-50h100v50h-100z" />
+<glyph unicode="&#xe167;" d="M583 1182l378 -435q14 -15 9 -31t-26 -16h-244v-250q0 -20 -17 -35t-39 -15h-200q-20 0 -32 14.5t-12 35.5v250h-250q-20 0 -25.5 16.5t8.5 31.5l383 431q14 16 33.5 17t33.5 -14zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5z M900 200v-50h100v50h-100z" />
+<glyph unicode="&#xe168;" d="M396 723l369 369q7 7 17.5 7t17.5 -7l139 -139q7 -8 7 -18.5t-7 -17.5l-525 -525q-7 -8 -17.5 -8t-17.5 8l-292 291q-7 8 -7 18t7 18l139 139q8 7 18.5 7t17.5 -7zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50 h-100z" />
+<glyph unicode="&#xe169;" d="M135 1023l142 142q14 14 35 14t35 -14l77 -77l-212 -212l-77 76q-14 15 -14 36t14 35zM655 855l210 210q14 14 24.5 10t10.5 -25l-2 -599q-1 -20 -15.5 -35t-35.5 -15l-597 -1q-21 0 -25 10.5t10 24.5l208 208l-154 155l212 212zM50 300h1000q21 0 35.5 -14.5t14.5 -35.5 v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50h-100z" />
+<glyph unicode="&#xe170;" d="M350 1200l599 -2q20 -1 35 -15.5t15 -35.5l1 -597q0 -21 -10.5 -25t-24.5 10l-208 208l-155 -154l-212 212l155 154l-210 210q-14 14 -10 24.5t25 10.5zM524 512l-76 -77q-15 -14 -36 -14t-35 14l-142 142q-14 14 -14 35t14 35l77 77zM50 300h1000q21 0 35.5 -14.5 t14.5 -35.5v-250h-1100v250q0 21 14.5 35.5t35.5 14.5zM900 200v-50h100v50h-100z" />
+<glyph unicode="&#xe171;" d="M1200 103l-483 276l-314 -399v423h-399l1196 796v-1096zM483 424v-230l683 953z" />
+<glyph unicode="&#xe172;" d="M1100 1000v-850q0 -21 -14.5 -35.5t-35.5 -14.5h-150v400h-700v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200z" />
+<glyph unicode="&#xe173;" d="M1100 1000l-2 -149l-299 -299l-95 95q-9 9 -21.5 9t-21.5 -9l-149 -147h-312v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM1132 638l106 -106q7 -7 7 -17.5t-7 -17.5l-420 -421q-8 -7 -18 -7 t-18 7l-202 203q-8 7 -8 17.5t8 17.5l106 106q7 8 17.5 8t17.5 -8l79 -79l297 297q7 7 17.5 7t17.5 -7z" />
+<glyph unicode="&#xe174;" d="M1100 1000v-269l-103 -103l-134 134q-15 15 -33.5 16.5t-34.5 -12.5l-266 -266h-329v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM1202 572l70 -70q15 -15 15 -35.5t-15 -35.5l-131 -131 l131 -131q15 -15 15 -35.5t-15 -35.5l-70 -70q-15 -15 -35.5 -15t-35.5 15l-131 131l-131 -131q-15 -15 -35.5 -15t-35.5 15l-70 70q-15 15 -15 35.5t15 35.5l131 131l-131 131q-15 15 -15 35.5t15 35.5l70 70q15 15 35.5 15t35.5 -15l131 -131l131 131q15 15 35.5 15 t35.5 -15z" />
+<glyph unicode="&#xe175;" d="M1100 1000v-300h-350q-21 0 -35.5 -14.5t-14.5 -35.5v-150h-500v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM850 600h100q21 0 35.5 -14.5t14.5 -35.5v-250h150q21 0 25 -10.5t-10 -24.5 l-230 -230q-14 -14 -35 -14t-35 14l-230 230q-14 14 -10 24.5t25 10.5h150v250q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe176;" d="M1100 1000v-400l-165 165q-14 15 -35 15t-35 -15l-263 -265h-402v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1000h-100v200h100v-200zM935 565l230 -229q14 -15 10 -25.5t-25 -10.5h-150v-250q0 -20 -14.5 -35 t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35v250h-150q-21 0 -25 10.5t10 25.5l230 229q14 15 35 15t35 -15z" />
+<glyph unicode="&#xe177;" d="M50 1100h1100q21 0 35.5 -14.5t14.5 -35.5v-150h-1200v150q0 21 14.5 35.5t35.5 14.5zM1200 800v-550q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v550h1200zM100 500v-200h400v200h-400z" />
+<glyph unicode="&#xe178;" d="M935 1165l248 -230q14 -14 14 -35t-14 -35l-248 -230q-14 -14 -24.5 -10t-10.5 25v150h-400v200h400v150q0 21 10.5 25t24.5 -10zM200 800h-50q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v-200zM400 800h-100v200h100v-200zM18 435l247 230 q14 14 24.5 10t10.5 -25v-150h400v-200h-400v-150q0 -21 -10.5 -25t-24.5 10l-247 230q-15 14 -15 35t15 35zM900 300h-100v200h100v-200zM1000 500h51q20 0 34.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-34.5 -14.5h-51v200z" />
+<glyph unicode="&#xe179;" d="M862 1073l276 116q25 18 43.5 8t18.5 -41v-1106q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v397q-4 1 -11 5t-24 17.5t-30 29t-24 42t-11 56.5v359q0 31 18.5 65t43.5 52zM550 1200q22 0 34.5 -12.5t14.5 -24.5l1 -13v-450q0 -28 -10.5 -59.5 t-25 -56t-29 -45t-25.5 -31.5l-10 -11v-447q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v447q-4 4 -11 11.5t-24 30.5t-30 46t-24 55t-11 60v450q0 2 0.5 5.5t4 12t8.5 15t14.5 12t22.5 5.5q20 0 32.5 -12.5t14.5 -24.5l3 -13v-350h100v350v5.5t2.5 12 t7 15t15 12t25.5 5.5q23 0 35.5 -12.5t13.5 -24.5l1 -13v-350h100v350q0 2 0.5 5.5t3 12t7 15t15 12t24.5 5.5z" />
+<glyph unicode="&#xe180;" d="M1200 1100v-56q-4 0 -11 -0.5t-24 -3t-30 -7.5t-24 -15t-11 -24v-888q0 -22 25 -34.5t50 -13.5l25 -2v-56h-400v56q75 0 87.5 6.5t12.5 43.5v394h-500v-394q0 -37 12.5 -43.5t87.5 -6.5v-56h-400v56q4 0 11 0.5t24 3t30 7.5t24 15t11 24v888q0 22 -25 34.5t-50 13.5 l-25 2v56h400v-56q-75 0 -87.5 -6.5t-12.5 -43.5v-394h500v394q0 37 -12.5 43.5t-87.5 6.5v56h400z" />
+<glyph unicode="&#xe181;" d="M675 1000h375q21 0 35.5 -14.5t14.5 -35.5v-150h-105l-295 -98v98l-200 200h-400l100 100h375zM100 900h300q41 0 70.5 -29.5t29.5 -70.5v-500q0 -41 -29.5 -70.5t-70.5 -29.5h-300q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5zM100 800v-200h300v200 h-300zM1100 535l-400 -133v163l400 133v-163zM100 500v-200h300v200h-300zM1100 398v-248q0 -21 -14.5 -35.5t-35.5 -14.5h-375l-100 -100h-375l-100 100h400l200 200h105z" />
+<glyph unicode="&#xe182;" d="M17 1007l162 162q17 17 40 14t37 -22l139 -194q14 -20 11 -44.5t-20 -41.5l-119 -118q102 -142 228 -268t267 -227l119 118q17 17 42.5 19t44.5 -12l192 -136q19 -14 22.5 -37.5t-13.5 -40.5l-163 -162q-3 -1 -9.5 -1t-29.5 2t-47.5 6t-62.5 14.5t-77.5 26.5t-90 42.5 t-101.5 60t-111 83t-119 108.5q-74 74 -133.5 150.5t-94.5 138.5t-60 119.5t-34.5 100t-15 74.5t-4.5 48z" />
+<glyph unicode="&#xe183;" d="M600 1100q92 0 175 -10.5t141.5 -27t108.5 -36.5t81.5 -40t53.5 -37t31 -27l9 -10v-200q0 -21 -14.5 -33t-34.5 -9l-202 34q-20 3 -34.5 20t-14.5 38v146q-141 24 -300 24t-300 -24v-146q0 -21 -14.5 -38t-34.5 -20l-202 -34q-20 -3 -34.5 9t-14.5 33v200q3 4 9.5 10.5 t31 26t54 37.5t80.5 39.5t109 37.5t141 26.5t175 10.5zM600 795q56 0 97 -9.5t60 -23.5t30 -28t12 -24l1 -10v-50l365 -303q14 -15 24.5 -40t10.5 -45v-212q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v212q0 20 10.5 45t24.5 40l365 303v50 q0 4 1 10.5t12 23t30 29t60 22.5t97 10z" />
+<glyph unicode="&#xe184;" d="M1100 700l-200 -200h-600l-200 200v500h200v-200h200v200h200v-200h200v200h200v-500zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-12l137 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5 t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe185;" d="M700 1100h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-1000h300v1000q0 41 -29.5 70.5t-70.5 29.5zM1100 800h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-700h300v700q0 41 -29.5 70.5t-70.5 29.5zM400 0h-300v400q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-400z " />
+<glyph unicode="&#xe186;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-100h200v-300h-300v100h200v100h-200v300h300v-100zM900 700v-300l-100 -100h-200v500h200z M700 700v-300h100v300h-100z" />
+<glyph unicode="&#xe187;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 300h-100v200h-100v-200h-100v500h100v-200h100v200h100v-500zM900 700v-300l-100 -100h-200v500h200z M700 700v-300h100v300h-100z" />
+<glyph unicode="&#xe188;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-300h200v-100h-300v500h300v-100zM900 700h-200v-300h200v-100h-300v500h300v-100z" />
+<glyph unicode="&#xe189;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 400l-300 150l300 150v-300zM900 550l-300 -150v300z" />
+<glyph unicode="&#xe190;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM900 300h-700v500h700v-500zM800 700h-130q-38 0 -66.5 -43t-28.5 -108t27 -107t68 -42h130v300zM300 700v-300 h130q41 0 68 42t27 107t-28.5 108t-66.5 43h-130z" />
+<glyph unicode="&#xe191;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 700h-200v-100h200v-300h-300v100h200v100h-200v300h300v-100zM900 300h-100v400h-100v100h200v-500z M700 300h-100v100h100v-100z" />
+<glyph unicode="&#xe192;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM300 700h200v-400h-300v500h100v-100zM900 300h-100v400h-100v100h200v-500zM300 600v-200h100v200h-100z M700 300h-100v100h100v-100z" />
+<glyph unicode="&#xe193;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM100 900v-700h900v700h-900zM500 500l-199 -200h-100v50l199 200v150h-200v100h300v-300zM900 300h-100v400h-100v100h200v-500zM701 300h-100 v100h100v-100z" />
+<glyph unicode="&#xe194;" d="M600 1191q120 0 229.5 -47t188.5 -126t126 -188.5t47 -229.5t-47 -229.5t-126 -188.5t-188.5 -126t-229.5 -47t-229.5 47t-188.5 126t-126 188.5t-47 229.5t47 229.5t126 188.5t188.5 126t229.5 47zM600 1021q-114 0 -211 -56.5t-153.5 -153.5t-56.5 -211t56.5 -211 t153.5 -153.5t211 -56.5t211 56.5t153.5 153.5t56.5 211t-56.5 211t-153.5 153.5t-211 56.5zM800 700h-300v-200h300v-100h-300l-100 100v200l100 100h300v-100z" />
+<glyph unicode="&#xe195;" d="M600 1191q120 0 229.5 -47t188.5 -126t126 -188.5t47 -229.5t-47 -229.5t-126 -188.5t-188.5 -126t-229.5 -47t-229.5 47t-188.5 126t-126 188.5t-47 229.5t47 229.5t126 188.5t188.5 126t229.5 47zM600 1021q-114 0 -211 -56.5t-153.5 -153.5t-56.5 -211t56.5 -211 t153.5 -153.5t211 -56.5t211 56.5t153.5 153.5t56.5 211t-56.5 211t-153.5 153.5t-211 56.5zM800 700v-100l-50 -50l100 -100v-50h-100l-100 100h-150v-100h-100v400h300zM500 700v-100h200v100h-200z" />
+<glyph unicode="&#xe197;" d="M503 1089q110 0 200.5 -59.5t134.5 -156.5q44 14 90 14q120 0 205 -86.5t85 -207t-85 -207t-205 -86.5h-128v250q0 21 -14.5 35.5t-35.5 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-250h-222q-80 0 -136 57.5t-56 136.5q0 69 43 122.5t108 67.5q-2 19 -2 37q0 100 49 185 t134 134t185 49zM525 500h150q10 0 17.5 -7.5t7.5 -17.5v-275h137q21 0 26 -11.5t-8 -27.5l-223 -244q-13 -16 -32 -16t-32 16l-223 244q-13 16 -8 27.5t26 11.5h137v275q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe198;" d="M502 1089q110 0 201 -59.5t135 -156.5q43 15 89 15q121 0 206 -86.5t86 -206.5q0 -99 -60 -181t-150 -110l-378 360q-13 16 -31.5 16t-31.5 -16l-381 -365h-9q-79 0 -135.5 57.5t-56.5 136.5q0 69 43 122.5t108 67.5q-2 19 -2 38q0 100 49 184.5t133.5 134t184.5 49.5z M632 467l223 -228q13 -16 8 -27.5t-26 -11.5h-137v-275q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v275h-137q-21 0 -26 11.5t8 27.5q199 204 223 228q19 19 31.5 19t32.5 -19z" />
+<glyph unicode="&#xe199;" d="M700 100v100h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170l-270 -300h400v-100h-50q-21 0 -35.5 -14.5t-14.5 -35.5v-50h400v50q0 21 -14.5 35.5t-35.5 14.5h-50z" />
+<glyph unicode="&#xe200;" d="M600 1179q94 0 167.5 -56.5t99.5 -145.5q89 -6 150.5 -71.5t61.5 -155.5q0 -61 -29.5 -112.5t-79.5 -82.5q9 -29 9 -55q0 -74 -52.5 -126.5t-126.5 -52.5q-55 0 -100 30v-251q21 0 35.5 -14.5t14.5 -35.5v-50h-300v50q0 21 14.5 35.5t35.5 14.5v251q-45 -30 -100 -30 q-74 0 -126.5 52.5t-52.5 126.5q0 18 4 38q-47 21 -75.5 65t-28.5 97q0 74 52.5 126.5t126.5 52.5q5 0 23 -2q0 2 -1 10t-1 13q0 116 81.5 197.5t197.5 81.5z" />
+<glyph unicode="&#xe201;" d="M1010 1010q111 -111 150.5 -260.5t0 -299t-150.5 -260.5q-83 -83 -191.5 -126.5t-218.5 -43.5t-218.5 43.5t-191.5 126.5q-111 111 -150.5 260.5t0 299t150.5 260.5q83 83 191.5 126.5t218.5 43.5t218.5 -43.5t191.5 -126.5zM476 1065q-4 0 -8 -1q-121 -34 -209.5 -122.5 t-122.5 -209.5q-4 -12 2.5 -23t18.5 -14l36 -9q3 -1 7 -1q23 0 29 22q27 96 98 166q70 71 166 98q11 3 17.5 13.5t3.5 22.5l-9 35q-3 13 -14 19q-7 4 -15 4zM512 920q-4 0 -9 -2q-80 -24 -138.5 -82.5t-82.5 -138.5q-4 -13 2 -24t19 -14l34 -9q4 -1 8 -1q22 0 28 21 q18 58 58.5 98.5t97.5 58.5q12 3 18 13.5t3 21.5l-9 35q-3 12 -14 19q-7 4 -15 4zM719.5 719.5q-49.5 49.5 -119.5 49.5t-119.5 -49.5t-49.5 -119.5t49.5 -119.5t119.5 -49.5t119.5 49.5t49.5 119.5t-49.5 119.5zM855 551q-22 0 -28 -21q-18 -58 -58.5 -98.5t-98.5 -57.5 q-11 -4 -17 -14.5t-3 -21.5l9 -35q3 -12 14 -19q7 -4 15 -4q4 0 9 2q80 24 138.5 82.5t82.5 138.5q4 13 -2.5 24t-18.5 14l-34 9q-4 1 -8 1zM1000 515q-23 0 -29 -22q-27 -96 -98 -166q-70 -71 -166 -98q-11 -3 -17.5 -13.5t-3.5 -22.5l9 -35q3 -13 14 -19q7 -4 15 -4 q4 0 8 1q121 34 209.5 122.5t122.5 209.5q4 12 -2.5 23t-18.5 14l-36 9q-3 1 -7 1z" />
+<glyph unicode="&#xe202;" d="M700 800h300v-380h-180v200h-340v-200h-380v755q0 10 7.5 17.5t17.5 7.5h575v-400zM1000 900h-200v200zM700 300h162l-212 -212l-212 212h162v200h100v-200zM520 0h-395q-10 0 -17.5 7.5t-7.5 17.5v395zM1000 220v-195q0 -10 -7.5 -17.5t-17.5 -7.5h-195z" />
+<glyph unicode="&#xe203;" d="M700 800h300v-520l-350 350l-550 -550v1095q0 10 7.5 17.5t17.5 7.5h575v-400zM1000 900h-200v200zM862 200h-162v-200h-100v200h-162l212 212zM480 0h-355q-10 0 -17.5 7.5t-7.5 17.5v55h380v-80zM1000 80v-55q0 -10 -7.5 -17.5t-17.5 -7.5h-155v80h180z" />
+<glyph unicode="&#xe204;" d="M1162 800h-162v-200h100l100 -100h-300v300h-162l212 212zM200 800h200q27 0 40 -2t29.5 -10.5t23.5 -30t7 -57.5h300v-100h-600l-200 -350v450h100q0 36 7 57.5t23.5 30t29.5 10.5t40 2zM800 400h240l-240 -400h-800l300 500h500v-100z" />
+<glyph unicode="&#xe205;" d="M650 1100h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5zM1000 850v150q41 0 70.5 -29.5t29.5 -70.5v-800 q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-1 0 -20 4l246 246l-326 326v324q0 41 29.5 70.5t70.5 29.5v-150q0 -62 44 -106t106 -44h300q62 0 106 44t44 106zM412 250l-212 -212v162h-200v100h200v162z" />
+<glyph unicode="&#xe206;" d="M450 1100h100q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-300q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h50v50q0 21 14.5 35.5t35.5 14.5zM800 850v150q41 0 70.5 -29.5t29.5 -70.5v-500 h-200v-300h200q0 -36 -7 -57.5t-23.5 -30t-29.5 -10.5t-40 -2h-600q-41 0 -70.5 29.5t-29.5 70.5v800q0 41 29.5 70.5t70.5 29.5v-150q0 -62 44 -106t106 -44h300q62 0 106 44t44 106zM1212 250l-212 -212v162h-200v100h200v162z" />
+<glyph unicode="&#xe209;" d="M658 1197l637 -1104q23 -38 7 -65.5t-60 -27.5h-1276q-44 0 -60 27.5t7 65.5l637 1104q22 39 54 39t54 -39zM704 800h-208q-20 0 -32 -14.5t-8 -34.5l58 -302q4 -20 21.5 -34.5t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5zM500 300v-100h200 v100h-200z" />
+<glyph unicode="&#xe210;" d="M425 1100h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM425 800h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5 t17.5 7.5zM825 800h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM25 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150 q0 10 7.5 17.5t17.5 7.5zM425 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM825 500h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5 v150q0 10 7.5 17.5t17.5 7.5zM25 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM425 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5 t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM825 200h250q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-250q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe211;" d="M700 1200h100v-200h-100v-100h350q62 0 86.5 -39.5t-3.5 -94.5l-66 -132q-41 -83 -81 -134h-772q-40 51 -81 134l-66 132q-28 55 -3.5 94.5t86.5 39.5h350v100h-100v200h100v100h200v-100zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-12l137 -100 h-950l138 100h-13q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe212;" d="M600 1300q40 0 68.5 -29.5t28.5 -70.5h-194q0 41 28.5 70.5t68.5 29.5zM443 1100h314q18 -37 18 -75q0 -8 -3 -25h328q41 0 44.5 -16.5t-30.5 -38.5l-175 -145h-678l-178 145q-34 22 -29 38.5t46 16.5h328q-3 17 -3 25q0 38 18 75zM250 700h700q21 0 35.5 -14.5 t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-150v-200l275 -200h-950l275 200v200h-150q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe213;" d="M600 1181q75 0 128 -53t53 -128t-53 -128t-128 -53t-128 53t-53 128t53 128t128 53zM602 798h46q34 0 55.5 -28.5t21.5 -86.5q0 -76 39 -183h-324q39 107 39 183q0 58 21.5 86.5t56.5 28.5h45zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13 l138 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe214;" d="M600 1300q47 0 92.5 -53.5t71 -123t25.5 -123.5q0 -78 -55.5 -133.5t-133.5 -55.5t-133.5 55.5t-55.5 133.5q0 62 34 143l144 -143l111 111l-163 163q34 26 63 26zM602 798h46q34 0 55.5 -28.5t21.5 -86.5q0 -76 39 -183h-324q39 107 39 183q0 58 21.5 86.5t56.5 28.5h45 zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13l138 -100h-950l137 100h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe215;" d="M600 1200l300 -161v-139h-300q0 -57 18.5 -108t50 -91.5t63 -72t70 -67.5t57.5 -61h-530q-60 83 -90.5 177.5t-30.5 178.5t33 164.5t87.5 139.5t126 96.5t145.5 41.5v-98zM250 400h700q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-13l138 -100h-950l137 100 h-12q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM50 100h1100q21 0 35.5 -14.5t14.5 -35.5v-50h-1200v50q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe216;" d="M600 1300q41 0 70.5 -29.5t29.5 -70.5v-78q46 -26 73 -72t27 -100v-50h-400v50q0 54 27 100t73 72v78q0 41 29.5 70.5t70.5 29.5zM400 800h400q54 0 100 -27t72 -73h-172v-100h200v-100h-200v-100h200v-100h-200v-100h200q0 -83 -58.5 -141.5t-141.5 -58.5h-400 q-83 0 -141.5 58.5t-58.5 141.5v400q0 83 58.5 141.5t141.5 58.5z" />
+<glyph unicode="&#xe218;" d="M150 1100h900q21 0 35.5 -14.5t14.5 -35.5v-500q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v500q0 21 14.5 35.5t35.5 14.5zM125 400h950q10 0 17.5 -7.5t7.5 -17.5v-50q0 -10 -7.5 -17.5t-17.5 -7.5h-283l224 -224q13 -13 13 -31.5t-13 -32 t-31.5 -13.5t-31.5 13l-88 88h-524l-87 -88q-13 -13 -32 -13t-32 13.5t-13 32t13 31.5l224 224h-289q-10 0 -17.5 7.5t-7.5 17.5v50q0 10 7.5 17.5t17.5 7.5zM541 300l-100 -100h324l-100 100h-124z" />
+<glyph unicode="&#xe219;" d="M200 1100h800q83 0 141.5 -58.5t58.5 -141.5v-200h-100q0 41 -29.5 70.5t-70.5 29.5h-250q-41 0 -70.5 -29.5t-29.5 -70.5h-100q0 41 -29.5 70.5t-70.5 29.5h-250q-41 0 -70.5 -29.5t-29.5 -70.5h-100v200q0 83 58.5 141.5t141.5 58.5zM100 600h1000q41 0 70.5 -29.5 t29.5 -70.5v-300h-1200v300q0 41 29.5 70.5t70.5 29.5zM300 100v-50q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v50h200zM1100 100v-50q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v50h200z" />
+<glyph unicode="&#xe221;" d="M480 1165l682 -683q31 -31 31 -75.5t-31 -75.5l-131 -131h-481l-517 518q-32 31 -32 75.5t32 75.5l295 296q31 31 75.5 31t76.5 -31zM108 794l342 -342l303 304l-341 341zM250 100h800q21 0 35.5 -14.5t14.5 -35.5v-50h-900v50q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe223;" d="M1057 647l-189 506q-8 19 -27.5 33t-40.5 14h-400q-21 0 -40.5 -14t-27.5 -33l-189 -506q-8 -19 1.5 -33t30.5 -14h625v-150q0 -21 14.5 -35.5t35.5 -14.5t35.5 14.5t14.5 35.5v150h125q21 0 30.5 14t1.5 33zM897 0h-595v50q0 21 14.5 35.5t35.5 14.5h50v50 q0 21 14.5 35.5t35.5 14.5h48v300h200v-300h47q21 0 35.5 -14.5t14.5 -35.5v-50h50q21 0 35.5 -14.5t14.5 -35.5v-50z" />
+<glyph unicode="&#xe224;" d="M900 800h300v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-375v591l-300 300v84q0 10 7.5 17.5t17.5 7.5h375v-400zM1200 900h-200v200zM400 600h300v-575q0 -10 -7.5 -17.5t-17.5 -7.5h-650q-10 0 -17.5 7.5t-7.5 17.5v950q0 10 7.5 17.5t17.5 7.5h375v-400zM700 700h-200v200z " />
+<glyph unicode="&#xe225;" d="M484 1095h195q75 0 146 -32.5t124 -86t89.5 -122.5t48.5 -142q18 -14 35 -20q31 -10 64.5 6.5t43.5 48.5q10 34 -15 71q-19 27 -9 43q5 8 12.5 11t19 -1t23.5 -16q41 -44 39 -105q-3 -63 -46 -106.5t-104 -43.5h-62q-7 -55 -35 -117t-56 -100l-39 -234q-3 -20 -20 -34.5 t-38 -14.5h-100q-21 0 -33 14.5t-9 34.5l12 70q-49 -14 -91 -14h-195q-24 0 -65 8l-11 -64q-3 -20 -20 -34.5t-38 -14.5h-100q-21 0 -33 14.5t-9 34.5l26 157q-84 74 -128 175l-159 53q-19 7 -33 26t-14 40v50q0 21 14.5 35.5t35.5 14.5h124q11 87 56 166l-111 95 q-16 14 -12.5 23.5t24.5 9.5h203q116 101 250 101zM675 1000h-250q-10 0 -17.5 -7.5t-7.5 -17.5v-50q0 -10 7.5 -17.5t17.5 -7.5h250q10 0 17.5 7.5t7.5 17.5v50q0 10 -7.5 17.5t-17.5 7.5z" />
+<glyph unicode="&#xe226;" d="M641 900l423 247q19 8 42 2.5t37 -21.5l32 -38q14 -15 12.5 -36t-17.5 -34l-139 -120h-390zM50 1100h106q67 0 103 -17t66 -71l102 -212h823q21 0 35.5 -14.5t14.5 -35.5v-50q0 -21 -14 -40t-33 -26l-737 -132q-23 -4 -40 6t-26 25q-42 67 -100 67h-300q-62 0 -106 44 t-44 106v200q0 62 44 106t106 44zM173 928h-80q-19 0 -28 -14t-9 -35v-56q0 -51 42 -51h134q16 0 21.5 8t5.5 24q0 11 -16 45t-27 51q-18 28 -43 28zM550 727q-32 0 -54.5 -22.5t-22.5 -54.5t22.5 -54.5t54.5 -22.5t54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5zM130 389 l152 130q18 19 34 24t31 -3.5t24.5 -17.5t25.5 -28q28 -35 50.5 -51t48.5 -13l63 5l48 -179q13 -61 -3.5 -97.5t-67.5 -79.5l-80 -69q-47 -40 -109 -35.5t-103 51.5l-130 151q-40 47 -35.5 109.5t51.5 102.5zM380 377l-102 -88q-31 -27 2 -65l37 -43q13 -15 27.5 -19.5 t31.5 6.5l61 53q19 16 14 49q-2 20 -12 56t-17 45q-11 12 -19 14t-23 -8z" />
+<glyph unicode="&#xe227;" d="M625 1200h150q10 0 17.5 -7.5t7.5 -17.5v-109q79 -33 131 -87.5t53 -128.5q1 -46 -15 -84.5t-39 -61t-46 -38t-39 -21.5l-17 -6q6 0 15 -1.5t35 -9t50 -17.5t53 -30t50 -45t35.5 -64t14.5 -84q0 -59 -11.5 -105.5t-28.5 -76.5t-44 -51t-49.5 -31.5t-54.5 -16t-49.5 -6.5 t-43.5 -1v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-100v-75q0 -10 -7.5 -17.5t-17.5 -7.5h-150q-10 0 -17.5 7.5t-7.5 17.5v75h-175q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5h75v600h-75q-10 0 -17.5 7.5t-7.5 17.5v150 q0 10 7.5 17.5t17.5 7.5h175v75q0 10 7.5 17.5t17.5 7.5h150q10 0 17.5 -7.5t7.5 -17.5v-75h100v75q0 10 7.5 17.5t17.5 7.5zM400 900v-200h263q28 0 48.5 10.5t30 25t15 29t5.5 25.5l1 10q0 4 -0.5 11t-6 24t-15 30t-30 24t-48.5 11h-263zM400 500v-200h363q28 0 48.5 10.5 t30 25t15 29t5.5 25.5l1 10q0 4 -0.5 11t-6 24t-15 30t-30 24t-48.5 11h-363z" />
+<glyph unicode="&#xe230;" d="M212 1198h780q86 0 147 -61t61 -147v-416q0 -51 -18 -142.5t-36 -157.5l-18 -66q-29 -87 -93.5 -146.5t-146.5 -59.5h-572q-82 0 -147 59t-93 147q-8 28 -20 73t-32 143.5t-20 149.5v416q0 86 61 147t147 61zM600 1045q-70 0 -132.5 -11.5t-105.5 -30.5t-78.5 -41.5 t-57 -45t-36 -41t-20.5 -30.5l-6 -12l156 -243h560l156 243q-2 5 -6 12.5t-20 29.5t-36.5 42t-57 44.5t-79 42t-105 29.5t-132.5 12zM762 703h-157l195 261z" />
+<glyph unicode="&#xe231;" d="M475 1300h150q103 0 189 -86t86 -189v-500q0 -41 -42 -83t-83 -42h-450q-41 0 -83 42t-42 83v500q0 103 86 189t189 86zM700 300v-225q0 -21 -27 -48t-48 -27h-150q-21 0 -48 27t-27 48v225h300z" />
+<glyph unicode="&#xe232;" d="M475 1300h96q0 -150 89.5 -239.5t239.5 -89.5v-446q0 -41 -42 -83t-83 -42h-450q-41 0 -83 42t-42 83v500q0 103 86 189t189 86zM700 300v-225q0 -21 -27 -48t-48 -27h-150q-21 0 -48 27t-27 48v225h300z" />
+<glyph unicode="&#xe233;" d="M1294 767l-638 -283l-378 170l-78 -60v-224l100 -150v-199l-150 148l-150 -149v200l100 150v250q0 4 -0.5 10.5t0 9.5t1 8t3 8t6.5 6l47 40l-147 65l642 283zM1000 380l-350 -166l-350 166v147l350 -165l350 165v-147z" />
+<glyph unicode="&#xe234;" d="M250 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM650 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM1050 800q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" />
+<glyph unicode="&#xe235;" d="M550 1100q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM550 700q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM550 300q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" />
+<glyph unicode="&#xe236;" d="M125 1100h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5zM125 700h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5 t17.5 7.5zM125 300h950q10 0 17.5 -7.5t7.5 -17.5v-150q0 -10 -7.5 -17.5t-17.5 -7.5h-950q-10 0 -17.5 7.5t-7.5 17.5v150q0 10 7.5 17.5t17.5 7.5z" />
+<glyph unicode="&#xe237;" d="M350 1200h500q162 0 256 -93.5t94 -256.5v-500q0 -165 -93.5 -257.5t-256.5 -92.5h-500q-165 0 -257.5 92.5t-92.5 257.5v500q0 165 92.5 257.5t257.5 92.5zM900 1000h-600q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h600q41 0 70.5 29.5 t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5zM350 900h500q21 0 35.5 -14.5t14.5 -35.5v-300q0 -21 -14.5 -35.5t-35.5 -14.5h-500q-21 0 -35.5 14.5t-14.5 35.5v300q0 21 14.5 35.5t35.5 14.5zM400 800v-200h400v200h-400z" />
+<glyph unicode="&#xe238;" d="M150 1100h1000q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5h-50v-200h50q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5 t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5h50v200h-50q-21 0 -35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe239;" d="M650 1187q87 -67 118.5 -156t0 -178t-118.5 -155q-87 66 -118.5 155t0 178t118.5 156zM300 800q124 0 212 -88t88 -212q-124 0 -212 88t-88 212zM1000 800q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM300 500q124 0 212 -88t88 -212q-124 0 -212 88t-88 212z M1000 500q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM700 199v-144q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v142q40 -4 43 -4q17 0 57 6z" />
+<glyph unicode="&#xe240;" d="M745 878l69 19q25 6 45 -12l298 -295q11 -11 15 -26.5t-2 -30.5q-5 -14 -18 -23.5t-28 -9.5h-8q1 0 1 -13q0 -29 -2 -56t-8.5 -62t-20 -63t-33 -53t-51 -39t-72.5 -14h-146q-184 0 -184 288q0 24 10 47q-20 4 -62 4t-63 -4q11 -24 11 -47q0 -288 -184 -288h-142 q-48 0 -84.5 21t-56 51t-32 71.5t-16 75t-3.5 68.5q0 13 2 13h-7q-15 0 -27.5 9.5t-18.5 23.5q-6 15 -2 30.5t15 25.5l298 296q20 18 46 11l76 -19q20 -5 30.5 -22.5t5.5 -37.5t-22.5 -31t-37.5 -5l-51 12l-182 -193h891l-182 193l-44 -12q-20 -5 -37.5 6t-22.5 31t6 37.5 t31 22.5z" />
+<glyph unicode="&#xe241;" d="M1200 900h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-200v-850q0 -22 25 -34.5t50 -13.5l25 -2v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v850h-200q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h1000v-300zM500 450h-25q0 15 -4 24.5t-9 14.5t-17 7.5t-20 3t-25 0.5h-100v-425q0 -11 12.5 -17.5t25.5 -7.5h12v-50h-200v50q50 0 50 25v425h-100q-17 0 -25 -0.5t-20 -3t-17 -7.5t-9 -14.5t-4 -24.5h-25v150h500v-150z" />
+<glyph unicode="&#xe242;" d="M1000 300v50q-25 0 -55 32q-14 14 -25 31t-16 27l-4 11l-289 747h-69l-300 -754q-18 -35 -39 -56q-9 -9 -24.5 -18.5t-26.5 -14.5l-11 -5v-50h273v50q-49 0 -78.5 21.5t-11.5 67.5l69 176h293l61 -166q13 -34 -3.5 -66.5t-55.5 -32.5v-50h312zM412 691l134 342l121 -342 h-255zM1100 150v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5z" />
+<glyph unicode="&#xe243;" d="M50 1200h1100q21 0 35.5 -14.5t14.5 -35.5v-1100q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v1100q0 21 14.5 35.5t35.5 14.5zM611 1118h-70q-13 0 -18 -12l-299 -753q-17 -32 -35 -51q-18 -18 -56 -34q-12 -5 -12 -18v-50q0 -8 5.5 -14t14.5 -6 h273q8 0 14 6t6 14v50q0 8 -6 14t-14 6q-55 0 -71 23q-10 14 0 39l63 163h266l57 -153q11 -31 -6 -55q-12 -17 -36 -17q-8 0 -14 -6t-6 -14v-50q0 -8 6 -14t14 -6h313q8 0 14 6t6 14v50q0 7 -5.5 13t-13.5 7q-17 0 -42 25q-25 27 -40 63h-1l-288 748q-5 12 -19 12zM639 611 h-197l103 264z" />
+<glyph unicode="&#xe244;" d="M1200 1100h-1200v100h1200v-100zM50 1000h400q21 0 35.5 -14.5t14.5 -35.5v-900q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v900q0 21 14.5 35.5t35.5 14.5zM650 1000h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM700 900v-300h300v300h-300z" />
+<glyph unicode="&#xe245;" d="M50 1200h400q21 0 35.5 -14.5t14.5 -35.5v-900q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v900q0 21 14.5 35.5t35.5 14.5zM650 700h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5zM700 600v-300h300v300h-300zM1200 0h-1200v100h1200v-100z" />
+<glyph unicode="&#xe246;" d="M50 1000h400q21 0 35.5 -14.5t14.5 -35.5v-350h100v150q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-150h100v-100h-100v-150q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v150h-100v-350q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5v800q0 21 14.5 35.5t35.5 14.5zM700 700v-300h300v300h-300z" />
+<glyph unicode="&#xe247;" d="M100 0h-100v1200h100v-1200zM250 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM300 1000v-300h300v300h-300zM250 500h900q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe248;" d="M600 1100h150q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-150v-100h450q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h350v100h-150q-21 0 -35.5 14.5 t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h150v100h100v-100zM400 1000v-300h300v300h-300z" />
+<glyph unicode="&#xe249;" d="M1200 0h-100v1200h100v-1200zM550 1100h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM600 1000v-300h300v300h-300zM50 500h900q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-900q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5z" />
+<glyph unicode="&#xe250;" d="M865 565l-494 -494q-23 -23 -41 -23q-14 0 -22 13.5t-8 38.5v1000q0 25 8 38.5t22 13.5q18 0 41 -23l494 -494q14 -14 14 -35t-14 -35z" />
+<glyph unicode="&#xe251;" d="M335 635l494 494q29 29 50 20.5t21 -49.5v-1000q0 -41 -21 -49.5t-50 20.5l-494 494q-14 14 -14 35t14 35z" />
+<glyph unicode="&#xe252;" d="M100 900h1000q41 0 49.5 -21t-20.5 -50l-494 -494q-14 -14 -35 -14t-35 14l-494 494q-29 29 -20.5 50t49.5 21z" />
+<glyph unicode="&#xe253;" d="M635 865l494 -494q29 -29 20.5 -50t-49.5 -21h-1000q-41 0 -49.5 21t20.5 50l494 494q14 14 35 14t35 -14z" />
+<glyph unicode="&#xe254;" d="M700 741v-182l-692 -323v221l413 193l-413 193v221zM1200 0h-800v200h800v-200z" />
+<glyph unicode="&#xe255;" d="M1200 900h-200v-100h200v-100h-300v300h200v100h-200v100h300v-300zM0 700h50q0 21 4 37t9.5 26.5t18 17.5t22 11t28.5 5.5t31 2t37 0.5h100v-550q0 -22 -25 -34.5t-50 -13.5l-25 -2v-100h400v100q-4 0 -11 0.5t-24 3t-30 7t-24 15t-11 24.5v550h100q25 0 37 -0.5t31 -2 t28.5 -5.5t22 -11t18 -17.5t9.5 -26.5t4 -37h50v300h-800v-300z" />
+<glyph unicode="&#xe256;" d="M800 700h-50q0 21 -4 37t-9.5 26.5t-18 17.5t-22 11t-28.5 5.5t-31 2t-37 0.5h-100v-550q0 -22 25 -34.5t50 -14.5l25 -1v-100h-400v100q4 0 11 0.5t24 3t30 7t24 15t11 24.5v550h-100q-25 0 -37 -0.5t-31 -2t-28.5 -5.5t-22 -11t-18 -17.5t-9.5 -26.5t-4 -37h-50v300 h800v-300zM1100 200h-200v-100h200v-100h-300v300h200v100h-200v100h300v-300z" />
+<glyph unicode="&#xe257;" d="M701 1098h160q16 0 21 -11t-7 -23l-464 -464l464 -464q12 -12 7 -23t-21 -11h-160q-13 0 -23 9l-471 471q-7 8 -7 18t7 18l471 471q10 9 23 9z" />
+<glyph unicode="&#xe258;" d="M339 1098h160q13 0 23 -9l471 -471q7 -8 7 -18t-7 -18l-471 -471q-10 -9 -23 -9h-160q-16 0 -21 11t7 23l464 464l-464 464q-12 12 -7 23t21 11z" />
+<glyph unicode="&#xe259;" d="M1087 882q11 -5 11 -21v-160q0 -13 -9 -23l-471 -471q-8 -7 -18 -7t-18 7l-471 471q-9 10 -9 23v160q0 16 11 21t23 -7l464 -464l464 464q12 12 23 7z" />
+<glyph unicode="&#xe260;" d="M618 993l471 -471q9 -10 9 -23v-160q0 -16 -11 -21t-23 7l-464 464l-464 -464q-12 -12 -23 -7t-11 21v160q0 13 9 23l471 471q8 7 18 7t18 -7z" />
+<glyph unicode="&#xf8ff;" d="M1000 1200q0 -124 -88 -212t-212 -88q0 124 88 212t212 88zM450 1000h100q21 0 40 -14t26 -33l79 -194q5 1 16 3q34 6 54 9.5t60 7t65.5 1t61 -10t56.5 -23t42.5 -42t29 -64t5 -92t-19.5 -121.5q-1 -7 -3 -19.5t-11 -50t-20.5 -73t-32.5 -81.5t-46.5 -83t-64 -70 t-82.5 -50q-13 -5 -42 -5t-65.5 2.5t-47.5 2.5q-14 0 -49.5 -3.5t-63 -3.5t-43.5 7q-57 25 -104.5 78.5t-75 111.5t-46.5 112t-26 90l-7 35q-15 63 -18 115t4.5 88.5t26 64t39.5 43.5t52 25.5t58.5 13t62.5 2t59.5 -4.5t55.5 -8l-147 192q-12 18 -5.5 30t27.5 12z" />
+<glyph unicode="&#x1f511;" d="M250 1200h600q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-150v-500l-255 -178q-19 -9 -32 -1t-13 29v650h-150q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5zM400 1100v-100h300v100h-300z" />
+<glyph unicode="&#x1f6aa;" d="M250 1200h750q39 0 69.5 -40.5t30.5 -84.5v-933l-700 -117v950l600 125h-700v-1000h-100v1025q0 23 15.5 49t34.5 26zM500 525v-100l100 20v100z" />
+</font>
+</defs></svg> \ No newline at end of file
diff --git a/www/fonts/glyphicons-halflings-regular.ttf b/www/fonts/glyphicons-halflings-regular.ttf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/fonts/glyphicons-halflings-regular.ttf
diff --git a/www/fonts/glyphicons-halflings-regular.woff b/www/fonts/glyphicons-halflings-regular.woff
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/fonts/glyphicons-halflings-regular.woff
diff --git a/www/fonts/glyphicons-halflings-regular.woff2 b/www/fonts/glyphicons-halflings-regular.woff2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/fonts/glyphicons-halflings-regular.woff2
diff --git a/www/img/icn-router-vpp.png b/www/img/icn-router-vpp.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/icn-router-vpp.png
diff --git a/www/img/icn-router.png b/www/img/icn-router.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/icn-router.png
diff --git a/www/img/ip-router-vpp.png b/www/img/ip-router-vpp.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/ip-router-vpp.png
diff --git a/www/img/ip-router.png b/www/img/ip-router.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/ip-router.png
diff --git a/www/img/lte.png b/www/img/lte.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/lte.png
diff --git a/www/img/pc-video-client.png b/www/img/pc-video-client.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/pc-video-client.png
diff --git a/www/img/server.png b/www/img/server.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/server.png
diff --git a/www/img/smartphone.png b/www/img/smartphone.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/smartphone.png
diff --git a/www/img/tablet.png b/www/img/tablet.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/tablet.png
diff --git a/www/img/undefined.png b/www/img/undefined.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/undefined.png
diff --git a/www/img/user.png b/www/img/user.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/user.png
diff --git a/www/img/vicn-logo.png b/www/img/vicn-logo.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/vicn-logo.png
diff --git a/www/img/video-server.png b/www/img/video-server.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/video-server.png
diff --git a/www/img/wifi.png b/www/img/wifi.png
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/img/wifi.png
diff --git a/www/index.html b/www/index.html
new file mode 100644
index 00000000..0060b0a4
--- /dev/null
+++ b/www/index.html
@@ -0,0 +1,94 @@
+<!--
+
+ Copyright (c) 2017 Cisco and/or its affiliates.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at:
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>vICN | Network graph</title>
+ <link rel="stylesheet" type="text/css" href="css/contrib/vis.css">
+ <link rel="stylesheet" type="text/css" href="css/contrib/vis-timeline-graph2d.min.css">
+ <link rel="stylesheet" type="text/css" href="css/contrib/bootstrap.min.css">
+ <link rel="stylesheet" type="text/css" href="css/contrib/bootstrap-dropmenu.min.css">
+ <link rel="stylesheet" type="text/css" href="css/contrib/led.css">
+ <link rel="stylesheet" type="text/css" href="css/main.css">
+ </head>
+ <body>
+
+ <div class="canvas">
+
+ <div class='menu'>
+ <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="navbar-header">
+ <button href="#menu-toggle" class="slidebar-toggle" id="menu-toggle">
+ <span class="sr-only">Toggle sidebar</span>
+ </button>
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ </button>
+ <span><a class="navbar-brand" href="/">Network view</a></span>
+ </div>
+
+ <div class="navbar-collapse collapse">
+ <div class="container-fluid">
+ <div>
+ <div id='cnxled' class='led-red' style="float: right; margin-top: 18px;"></div>
+ </div>
+ </div>
+ </div>
+
+ </nav>
+
+ </div> <!-- menu -->
+
+ <div id="viewport">
+ <div id="network"></div>
+ </div> <!-- viewport -->
+ </div> <!-- canvas -->
+
+ <script type="text/javascript" src="js/contrib/jquery-3.1.1.min.js"></script>
+ <script type="text/javascript" src="js/contrib/bootstrap.min.js"></script>
+ <script type="text/javascript" src="js/contrib/d3-array.v1.min.js"></script>
+ <script type="text/javascript" src="js/contrib/d3-collection.v1.min.js"></script>
+ <script type="text/javascript" src="js/contrib/d3-color.v1.min.js"></script>
+ <script type="text/javascript" src="js/contrib/d3-format.v1.min.js"></script>
+ <script type="text/javascript" src="js/contrib/d3-interpolate.v1.min.js"></script>
+ <script type="text/javascript" src="js/contrib/d3-time.v1.min.js"></script>
+ <script type="text/javascript" src="js/contrib/d3-time-format.v2.min.js"></script>
+ <script type="text/javascript" src="js/contrib/d3-scale.v1.min.js"></script>
+ <script type="text/javascript" src="js/contrib/vis.js"></script>
+
+ <!-- server-event-dispatcher : REQUIRES jquery -->
+ <script type="text/javascript" src="js/server-event-dispatcher.js"></script>
+
+ <!-- class.js -->
+ <script type="text/javascript" src="js/class.js"></script>
+
+ <!-- query.js : REQUIRES class.js -->
+ <script type="text/javascript" src="js/query.js"></script>
+
+ <!-- network.js : REQUIRES settings.js, query.js -->
+ <script type="text/javascript" src="js/settings.js"></script>
+ <script type="text/javascript" src="js/network.js"></script>
+ <script type="text/javascript" src="js/main.js"></script>
+
+ <script type="text/javascript">
+ $("#menu-toggle").click(function(e){e.preventDefault();$("#wrapper").toggleClass("toggled");});
+ </script>
+
+ </body>
+</html>
diff --git a/www/js/class.js b/www/js/class.js
new file mode 100644
index 00000000..abdecbe2
--- /dev/null
+++ b/www/js/class.js
@@ -0,0 +1,64 @@
+/* Simple JavaScript Inheritance
+ * By John Resig http://ejohn.org/
+ * MIT Licensed.
+ */
+// Inspired by base2 and Prototype
+(function(){
+ var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
+
+ // The base Class implementation (does nothing)
+ this.Class = function(){};
+
+ // Create a new Class that inherits from this class
+ Class.extend = function(prop) {
+ var _super = this.prototype;
+
+ // Instantiate a base class (but only create the instance,
+ // don't run the init constructor)
+ initializing = true;
+ var prototype = new this();
+ initializing = false;
+
+ // Copy the properties over onto the new prototype
+ for (var name in prop) {
+ // Check if we're overwriting an existing function
+ prototype[name] = typeof prop[name] == "function" &&
+ typeof _super[name] == "function" && fnTest.test(prop[name]) ?
+ (function(name, fn){
+ return function() {
+ var tmp = this._super;
+
+ // Add a new ._super() method that is the same method
+ // but on the super-class
+ this._super = _super[name];
+
+ // The method only need to be bound temporarily, so we
+ // remove it when we're done executing
+ var ret = fn.apply(this, arguments);
+ this._super = tmp;
+
+ return ret;
+ };
+ })(name, prop[name]) :
+ prop[name];
+ }
+
+ // The dummy class constructor
+ function Class() {
+ // All construction is actually done in the init method
+ if ( !initializing && this.init )
+ this.init.apply(this, arguments);
+ }
+
+ // Populate our constructed prototype object
+ Class.prototype = prototype;
+
+ // Enforce the constructor to be what we expect
+ Class.prototype.constructor = Class;
+
+ // And make this class extendable
+ Class.extend = arguments.callee;
+
+ return Class;
+ };
+})();
diff --git a/www/js/contrib/bootstrap-table.min.js b/www/js/contrib/bootstrap-table.min.js
new file mode 100644
index 00000000..aa8e6854
--- /dev/null
+++ b/www/js/contrib/bootstrap-table.min.js
@@ -0,0 +1,8 @@
+/*
+* bootstrap-table - v1.11.0 - 2016-07-02
+* https://github.com/wenzhixin/bootstrap-table
+* Copyright (c) 2016 zhixin wen
+* Licensed MIT License
+*/
+!function(a){"use strict";var b=null,c=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},d=function(b,c,d,e){var f="";return a.each(b,function(a,b){return b[c]===e?(f=b[d],!1):!0}),f},e=function(b,c){var d=-1;return a.each(b,function(a,b){return b.field===c?(d=a,!1):!0}),d},f=function(b){var c,d,e,f=0,g=[];for(c=0;c<b[0].length;c++)f+=b[0][c].colspan||1;for(c=0;c<b.length;c++)for(g[c]=[],d=0;f>d;d++)g[c][d]=!1;for(c=0;c<b.length;c++)for(d=0;d<b[c].length;d++){var h=b[c][d],i=h.rowspan||1,j=h.colspan||1,k=a.inArray(!1,g[c]);for(1===j&&(h.fieldIndex=k,"undefined"==typeof h.field&&(h.field=k)),e=0;i>e;e++)g[c+e][k]=!0;for(e=0;j>e;e++)g[c][k+e]=!0}},g=function(){if(null===b){var c,d,e=a("<p/>").addClass("fixed-table-scroll-inner"),f=a("<div/>").addClass("fixed-table-scroll-outer");f.append(e),a("body").append(f),c=e[0].offsetWidth,f.css("overflow","scroll"),d=e[0].offsetWidth,c===d&&(d=f[0].clientWidth),f.remove(),b=c-d}return b},h=function(b,d,e,f){var g=d;if("string"==typeof d){var h=d.split(".");h.length>1?(g=window,a.each(h,function(a,b){g=g[b]})):g=window[d]}return"object"==typeof g?g:"function"==typeof g?g.apply(b,e):!g&&"string"==typeof d&&c.apply(this,[d].concat(e))?c.apply(this,[d].concat(e)):f},i=function(b,c,d){var e=Object.getOwnPropertyNames(b),f=Object.getOwnPropertyNames(c),g="";if(d&&e.length!==f.length)return!1;for(var h=0;h<e.length;h++)if(g=e[h],a.inArray(g,f)>-1&&b[g]!==c[g])return!1;return!0},j=function(a){return"string"==typeof a?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/`/g,"&#x60;"):a},k=function(b){var c=0;return b.children().each(function(){c<a(this).outerHeight(!0)&&(c=a(this).outerHeight(!0))}),c},l=function(a){for(var b in a){var c=b.split(/(?=[A-Z])/).join("-").toLowerCase();c!==b&&(a[c]=a[b],delete a[b])}return a},m=function(a,b,c){var d=a;if("string"!=typeof b||a.hasOwnProperty(b))return c?j(a[b]):a[b];var e=b.split(".");for(var f in e)d=d&&d[e[f]];return c?j(d):d},n=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},o=function(){Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}())},p=function(b,c){this.options=c,this.$el=a(b),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};p.DEFAULTS={classes:"table table-hover",locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",sortStable:!1,striped:!1,columns:[[]],data:[],dataField:"rows",method:"get",url:void 0,ajax:void 0,cache:!0,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(a){return a},queryParamsType:"limit",responseHandler:function(a){return a},pagination:!1,onlyInfoPagination:!1,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"&lsaquo;",paginationNextText:"&rsaquo;",search:!1,searchOnEnterKey:!1,strictSearch:!1,searchAlign:"right",selectItemName:"btSelectItem",showHeader:!0,showFooter:!1,showColumns:!1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,buttonsAlign:"right",smartDisplay:!0,escape:!1,minimumCountColumns:1,idField:void 0,uniqueId:void 0,cardView:!1,detailView:!1,detailFormatter:function(){return""},trimOnSearch:!0,clickToSelect:!1,singleSelect:!1,toolbar:void 0,toolbarAlign:"left",checkboxHeader:!0,sortable:!0,silentSort:!0,maintainSelected:!1,searchTimeOut:500,searchText:"",iconSize:void 0,buttonsClass:"default",iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},customSearch:a.noop,customSort:a.noop,rowStyle:function(){return{}},rowAttributes:function(){return{}},footerStyle:function(){return{}},onAll:function(){return!1},onClickCell:function(){return!1},onDblClickCell:function(){return!1},onClickRow:function(){return!1},onDblClickRow:function(){return!1},onSort:function(){return!1},onCheck:function(){return!1},onUncheck:function(){return!1},onCheckAll:function(){return!1},onUncheckAll:function(){return!1},onCheckSome:function(){return!1},onUncheckSome:function(){return!1},onLoadSuccess:function(){return!1},onLoadError:function(){return!1},onColumnSwitch:function(){return!1},onPageChange:function(){return!1},onSearch:function(){return!1},onToggle:function(){return!1},onPreBody:function(){return!1},onPostBody:function(){return!1},onPostHeader:function(){return!1},onExpandRow:function(){return!1},onCollapseRow:function(){return!1},onRefreshOptions:function(){return!1},onRefresh:function(){return!1},onResetView:function(){return!1}},p.LOCALES={},p.LOCALES["en-US"]=p.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(a){return c("%s rows per page",a)},formatShowingRows:function(a,b,d){return c("Showing %s to %s of %s rows",a,b,d)},formatDetailPagination:function(a){return c("Showing %s rows",a)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}},a.extend(p.DEFAULTS,p.LOCALES["en-US"]),p.COLUMN_DEFAULTS={radio:!1,checkbox:!1,checkboxEnabled:!0,field:void 0,title:void 0,titleTooltip:void 0,"class":void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,width:void 0,sortable:!1,order:"asc",visible:!0,switchable:!0,clickToSelect:!0,formatter:void 0,footerFormatter:void 0,events:void 0,sorter:void 0,sortName:void 0,cellStyle:void 0,searchable:!0,searchFormatter:!0,cardVisible:!0},p.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh"},p.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},p.prototype.initLocale=function(){if(this.options.locale){var b=this.options.locale.split(/-|_/);b[0].toLowerCase(),b[1]&&b[1].toUpperCase(),a.fn.bootstrapTable.locales[this.options.locale]?a.extend(this.options,a.fn.bootstrapTable.locales[this.options.locale]):a.fn.bootstrapTable.locales[b.join("-")]?a.extend(this.options,a.fn.bootstrapTable.locales[b.join("-")]):a.fn.bootstrapTable.locales[b[0]]&&a.extend(this.options,a.fn.bootstrapTable.locales[b[0]])}},p.prototype.initContainer=function(){this.$container=a(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination" style="clear: both;"></div>':"",'<div class="fixed-table-container">','<div class="fixed-table-header"><table></table></div>','<div class="fixed-table-body">','<div class="fixed-table-loading">',this.options.formatLoadingMessage(),"</div>","</div>",'<div class="fixed-table-footer"><table><tr></tr></table></div>',"bottom"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination"></div>':"","</div>","</div>"].join("")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$container.find(".fixed-table-footer"),this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('<div class="clearfix"></div>'),this.$el.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),-1!==a.inArray("table-no-bordered",this.options.classes.split(" "))&&this.$tableContainer.addClass("table-no-bordered")},p.prototype.initTable=function(){var b=this,c=[],d=[];if(this.$header=this.$el.find(">thead"),this.$header.length||(this.$header=a("<thead></thead>").appendTo(this.$el)),this.$header.find("tr").each(function(){var b=[];a(this).find("th").each(function(){"undefined"!=typeof a(this).data("field")&&a(this).data("field",a(this).data("field")+""),b.push(a.extend({},{title:a(this).html(),"class":a(this).attr("class"),titleTooltip:a(this).attr("title"),rowspan:a(this).attr("rowspan")?+a(this).attr("rowspan"):void 0,colspan:a(this).attr("colspan")?+a(this).attr("colspan"):void 0},a(this).data()))}),c.push(b)}),a.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=a.extend(!0,[],c,this.options.columns),this.columns=[],f(this.options.columns),a.each(this.options.columns,function(c,d){a.each(d,function(d,e){e=a.extend({},p.COLUMN_DEFAULTS,e),"undefined"!=typeof e.fieldIndex&&(b.columns[e.fieldIndex]=e),b.options.columns[c][d]=e})}),!this.options.data.length){var e=[];this.$el.find(">tbody>tr").each(function(c){var f={};f._id=a(this).attr("id"),f._class=a(this).attr("class"),f._data=l(a(this).data()),a(this).find(">td").each(function(d){for(var g,h,i=a(this),j=+i.attr("colspan")||1,k=+i.attr("rowspan")||1;e[c]&&e[c][d];d++);for(g=d;d+j>g;g++)for(h=c;c+k>h;h++)e[h]||(e[h]=[]),e[h][g]=!0;var m=b.columns[d].field;f[m]=a(this).html(),f["_"+m+"_id"]=a(this).attr("id"),f["_"+m+"_class"]=a(this).attr("class"),f["_"+m+"_rowspan"]=a(this).attr("rowspan"),f["_"+m+"_colspan"]=a(this).attr("colspan"),f["_"+m+"_title"]=a(this).attr("title"),f["_"+m+"_data"]=l(a(this).data())}),d.push(f)}),this.options.data=d,d.length&&(this.fromHtml=!0)}},p.prototype.initHeader=function(){var b=this,d={},e=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]},a.each(this.options.columns,function(f,g){e.push("<tr>"),0===f&&!b.options.cardView&&b.options.detailView&&e.push(c('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',b.options.columns.length)),a.each(g,function(a,f){var g="",h="",i="",j="",k=c(' class="%s"',f["class"]),l=(b.options.sortOrder||f.order,"px"),m=f.width;if(void 0===f.width||b.options.cardView||"string"==typeof f.width&&-1!==f.width.indexOf("%")&&(l="%"),f.width&&"string"==typeof f.width&&(m=f.width.replace("%","").replace("px","")),h=c("text-align: %s; ",f.halign?f.halign:f.align),i=c("text-align: %s; ",f.align),j=c("vertical-align: %s; ",f.valign),j+=c("width: %s; ",!f.checkbox&&!f.radio||m?m?m+l:void 0:"36px"),"undefined"!=typeof f.fieldIndex){if(b.header.fields[f.fieldIndex]=f.field,b.header.styles[f.fieldIndex]=i+j,b.header.classes[f.fieldIndex]=k,b.header.formatters[f.fieldIndex]=f.formatter,b.header.events[f.fieldIndex]=f.events,b.header.sorters[f.fieldIndex]=f.sorter,b.header.sortNames[f.fieldIndex]=f.sortName,b.header.cellStyles[f.fieldIndex]=f.cellStyle,b.header.searchables[f.fieldIndex]=f.searchable,!f.visible)return;if(b.options.cardView&&!f.cardVisible)return;d[f.field]=f}e.push("<th"+c(' title="%s"',f.titleTooltip),f.checkbox||f.radio?c(' class="bs-checkbox %s"',f["class"]||""):k,c(' style="%s"',h+j),c(' rowspan="%s"',f.rowspan),c(' colspan="%s"',f.colspan),c(' data-field="%s"',f.field),"tabindex='0'",">"),e.push(c('<div class="th-inner %s">',b.options.sortable&&f.sortable?"sortable both":"")),g=f.title,f.checkbox&&(!b.options.singleSelect&&b.options.checkboxHeader&&(g='<input name="btSelectAll" type="checkbox" />'),b.header.stateField=f.field),f.radio&&(g="",b.header.stateField=f.field,b.options.singleSelect=!0),e.push(g),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</th>")}),e.push("</tr>")}),this.$header.html(e.join("")),this.$header.find("th[data-field]").each(function(){a(this).data(d[a(this).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(c){var d=a(this);return b.options.detailView&&d.closest(".bootstrap-table")[0]!==b.$container[0]?!1:void(b.options.sortable&&d.parent().data().sortable&&b.onSort(c))}),this.$header.children().children().off("keypress").on("keypress",function(c){if(b.options.sortable&&a(this).data().sortable){var d=c.keyCode||c.which;13==d&&b.onSort(c)}}),a(window).off("resize.bootstrap-table"),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret(),a(window).on("resize.bootstrap-table",a.proxy(this.resetWidth,this))),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(){var c=a(this).prop("checked");b[c?"checkAll":"uncheckAll"](),b.updateSelected()})},p.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},p.prototype.initData=function(a,b){this.data="append"===b?this.data.concat(a):"prepend"===b?[].concat(a).concat(this.data):a||this.options.data,this.options.data="append"===b?this.options.data.concat(a):"prepend"===b?[].concat(a).concat(this.options.data):this.data,"server"!==this.options.sidePagination&&this.initSort()},p.prototype.initSort=function(){var b=this,c=this.options.sortName,d="desc"===this.options.sortOrder?-1:1,e=a.inArray(this.options.sortName,this.header.fields);return this.options.customSort!==a.noop?void this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]):void(-1!==e&&(this.options.sortStable&&a.each(this.data,function(a,b){b.hasOwnProperty("_position")||(b._position=a)}),this.data.sort(function(f,g){b.header.sortNames[e]&&(c=b.header.sortNames[e]);var i=m(f,c,b.options.escape),j=m(g,c,b.options.escape),k=h(b.header,b.header.sorters[e],[i,j]);return void 0!==k?d*k:((void 0===i||null===i)&&(i=""),(void 0===j||null===j)&&(j=""),b.options.sortStable&&i===j&&(i=f._position,j=g._position),a.isNumeric(i)&&a.isNumeric(j)?(i=parseFloat(i),j=parseFloat(j),j>i?-1*d:d):i===j?0:("string"!=typeof i&&(i=i.toString()),-1===i.localeCompare(j)?-1*d:d))})))},p.prototype.onSort=function(b){var c="keypress"===b.type?a(b.currentTarget):a(b.currentTarget).parent(),d=this.$header.find("th").eq(c.index());return this.$header.add(this.$header_).find("span.order").remove(),this.options.sortName===c.data("field")?this.options.sortOrder="asc"===this.options.sortOrder?"desc":"asc":(this.options.sortName=c.data("field"),this.options.sortOrder="asc"===c.data("order")?"desc":"asc"),this.trigger("sort",this.options.sortName,this.options.sortOrder),c.add(d).data("order",this.options.sortOrder),this.getCaret(),"server"===this.options.sidePagination?void this.initServer(this.options.silentSort):(this.initSort(),void this.initBody())},p.prototype.initToolbar=function(){var b,d,e=this,f=[],g=0,i=0;this.$toolbar.find(".bs-bars").children().length&&a("body").append(a(this.options.toolbar)),this.$toolbar.html(""),("string"==typeof this.options.toolbar||"object"==typeof this.options.toolbar)&&a(c('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append(a(this.options.toolbar)),f=[c('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)],"string"==typeof this.options.icons&&(this.options.icons=h(null,this.options.icons)),this.options.showPaginationSwitch&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" title="%s">',this.options.formatPaginationSwitch()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>"),this.options.showRefresh&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" title="%s">',this.options.formatRefresh()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>"),this.options.showToggle&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" title="%s">',this.options.formatToggle()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>"),this.options.showColumns&&(f.push(c('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'),a.each(this.columns,function(a,b){if(!(b.radio||b.checkbox||e.options.cardView&&!b.cardVisible)){var d=b.visible?' checked="checked"':"";b.switchable&&(f.push(c('<li><label><input type="checkbox" data-field="%s" value="%s"%s> %s</label></li>',b.field,a,d,b.title)),i++)}}),f.push("</ul>","</div>")),f.push("</div>"),(this.showToolbar||f.length>2)&&this.$toolbar.append(f.join("")),this.options.showPaginationSwitch&&this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",a.proxy(this.togglePagination,this)),this.options.showRefresh&&this.$toolbar.find('button[name="refresh"]').off("click").on("click",a.proxy(this.refresh,this)),this.options.showToggle&&this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){e.toggleView()}),this.options.showColumns&&(b=this.$toolbar.find(".keep-open"),i<=this.options.minimumCountColumns&&b.find("input").prop("disabled",!0),b.find("li").off("click").on("click",function(a){a.stopImmediatePropagation()}),b.find("input").off("click").on("click",function(){var b=a(this);e.toggleColumn(a(this).val(),b.prop("checked"),!1),e.trigger("column-switch",a(this).data("field"),b.prop("checked"))})),this.options.search&&(f=[],f.push('<div class="pull-'+this.options.searchAlign+' search">',c('<input class="form-control'+c(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>"),this.$toolbar.append(f.join("")),d=this.$toolbar.find(".search input"),d.off("keyup drop").on("keyup drop",function(b){e.options.searchOnEnterKey&&13!==b.keyCode||a.inArray(b.keyCode,[37,38,39,40])>-1||(clearTimeout(g),g=setTimeout(function(){e.onSearch(b)},e.options.searchTimeOut))}),n()&&d.off("mouseup").on("mouseup",function(a){clearTimeout(g),g=setTimeout(function(){e.onSearch(a)},e.options.searchTimeOut)}))},p.prototype.onSearch=function(b){var c=a.trim(a(b.currentTarget).val());this.options.trimOnSearch&&a(b.currentTarget).val()!==c&&a(b.currentTarget).val(c),c!==this.searchText&&(this.searchText=c,this.options.searchText=c,this.options.pageNumber=1,this.initSearch(),this.updatePagination(),this.trigger("search",c))},p.prototype.initSearch=function(){var b=this;if("server"!==this.options.sidePagination){if(this.options.customSearch!==a.noop)return void this.options.customSearch.apply(this,[this.searchText]);var c=this.searchText&&(this.options.escape?j(this.searchText):this.searchText).toLowerCase(),d=a.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=d?a.grep(this.options.data,function(b){for(var c in d)if(a.isArray(d[c])&&-1===a.inArray(b[c],d[c])||b[c]!==d[c])return!1;return!0}):this.options.data,this.data=c?a.grep(this.data,function(d,f){for(var g=0;g<b.header.fields.length;g++)if(b.header.searchables[g]){var i,j=a.isNumeric(b.header.fields[g])?parseInt(b.header.fields[g],10):b.header.fields[g],k=b.columns[e(b.columns,j)];if("string"==typeof j){i=d;for(var l=j.split("."),m=0;m<l.length;m++)i=i[l[m]];k&&k.searchFormatter&&(i=h(k,b.header.formatters[g],[i,d,f],i))}else i=d[j];if("string"==typeof i||"number"==typeof i)if(b.options.strictSearch){if((i+"").toLowerCase()===c)return!0}else if(-1!==(i+"").toLowerCase().indexOf(c))return!0}return!1}):this.data}},p.prototype.initPagination=function(){if(!this.options.pagination)return void this.$pagination.hide();this.$pagination.show();var b,d,e,f,g,h,i,j,k,l=this,m=[],n=!1,o=this.getData(),p=this.options.pageList;if("server"!==this.options.sidePagination&&(this.options.totalRows=o.length),this.totalPages=0,this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows())this.options.pageSize=this.options.totalRows,n=!0;else if(this.options.pageSize===this.options.totalRows){var q="string"==typeof this.options.pageList?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;a.inArray(this.options.formatAllRows().toLowerCase(),q)>-1&&(n=!0)}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1,this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages&&(this.options.pageNumber=this.totalPages),this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1,this.pageTo=this.options.pageNumber*this.options.pageSize,this.pageTo>this.options.totalRows&&(this.pageTo=this.options.totalRows),m.push('<div class="pull-'+this.options.paginationDetailHAlign+' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"</span>"),!this.options.onlyInfoPagination){m.push('<span class="page-list">');var r=[c('<span class="btn-group %s">',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?"dropdown":"dropup"),'<button type="button" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',n?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if("string"==typeof this.options.pageList){var s=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");p=[],a.each(s,function(a,b){p.push(b.toUpperCase()===l.options.formatAllRows().toUpperCase()?l.options.formatAllRows():+b)})}for(a.each(p,function(a,b){if(!l.options.smartDisplay||0===a||p[a-1]<=l.options.totalRows){var d;d=n?b===l.options.formatAllRows()?' class="active"':"":b===l.options.pageSize?' class="active"':"",r.push(c('<li%s><a href="javascript:void(0)">%s</a></li>',d,b))}}),r.push("</ul></span>"),m.push(this.options.formatRecordsPerPage(r.join(""))),m.push("</span>"),m.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+c(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="javascript:void(0)">'+this.options.paginationPreText+"</a></li>"),this.totalPages<5?(d=1,e=this.totalPages):(d=this.options.pageNumber-2,e=d+4,1>d&&(d=1,e=5),e>this.totalPages&&(e=this.totalPages,d=e-4)),this.totalPages>=6&&(this.options.pageNumber>=3&&(m.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="javascript:void(0)">',1,"</a>","</li>"),d++),this.options.pageNumber>=4&&(4==this.options.pageNumber||6==this.totalPages||7==this.totalPages?d--:m.push('<li class="page-first-separator disabled">','<a href="javascript:void(0)">...</a>',"</li>"),e--)),this.totalPages>=7&&this.options.pageNumber>=this.totalPages-2&&d--,6==this.totalPages?this.options.pageNumber>=this.totalPages-2&&e++:this.totalPages>=7&&(7==this.totalPages||this.options.pageNumber>=this.totalPages-3)&&e++,b=d;e>=b;b++)m.push('<li class="page-number'+(b===this.options.pageNumber?" active":"")+'">','<a href="javascript:void(0)">',b,"</a>","</li>");this.totalPages>=8&&this.options.pageNumber<=this.totalPages-4&&m.push('<li class="page-last-separator disabled">','<a href="javascript:void(0)">...</a>',"</li>"),this.totalPages>=6&&this.options.pageNumber<=this.totalPages-3&&m.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="javascript:void(0)">',this.totalPages,"</a>","</li>"),m.push('<li class="page-next"><a href="javascript:void(0)">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(m.join("")),this.options.onlyInfoPagination||(f=this.$pagination.find(".page-list a"),g=this.$pagination.find(".page-first"),h=this.$pagination.find(".page-pre"),i=this.$pagination.find(".page-next"),j=this.$pagination.find(".page-last"),k=this.$pagination.find(".page-number"),this.options.smartDisplay&&(this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),(p.length<2||this.options.totalRows<=p[0])&&this.$pagination.find("span.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"]()),n&&(this.options.pageSize=this.options.formatAllRows()),f.off("click").on("click",a.proxy(this.onPageListChange,this)),g.off("click").on("click",a.proxy(this.onPageFirst,this)),h.off("click").on("click",a.proxy(this.onPagePre,this)),i.off("click").on("click",a.proxy(this.onPageNext,this)),j.off("click").on("click",a.proxy(this.onPageLast,this)),k.off("click").on("click",a.proxy(this.onPageNumber,this)))},p.prototype.updatePagination=function(b){b&&a(b.currentTarget).hasClass("disabled")||(this.options.maintainSelected||this.resetRows(),this.initPagination(),"server"===this.options.sidePagination?this.initServer():this.initBody(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize))},p.prototype.onPageListChange=function(b){var c=a(b.currentTarget);c.parent().addClass("active").siblings().removeClass("active"),this.options.pageSize=c.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+c.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(b)},p.prototype.onPageFirst=function(a){this.options.pageNumber=1,this.updatePagination(a)},p.prototype.onPagePre=function(a){this.options.pageNumber-1===0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(a)},p.prototype.onPageNext=function(a){this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(a)},p.prototype.onPageLast=function(a){this.options.pageNumber=this.totalPages,this.updatePagination(a)},p.prototype.onPageNumber=function(b){this.options.pageNumber!==+a(b.currentTarget).text()&&(this.options.pageNumber=+a(b.currentTarget).text(),this.updatePagination(b))},p.prototype.initBody=function(b){var f=this,g=[],i=this.getData();this.trigger("pre-body",i),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=a("<tbody></tbody>").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=i.length);for(var k=this.pageFrom-1;k<this.pageTo;k++){var l,n=i[k],o={},p=[],q="",r={},s=[];if(o=h(this.options,this.options.rowStyle,[n,k],o),o&&o.css)for(l in o.css)p.push(l+": "+o.css[l]);if(r=h(this.options,this.options.rowAttributes,[n,k],r))for(l in r)s.push(c('%s="%s"',l,j(r[l])));n._data&&!a.isEmptyObject(n._data)&&a.each(n._data,function(a,b){"index"!==a&&(q+=c(' data-%s="%s"',a,b))}),g.push("<tr",c(" %s",s.join(" ")),c(' id="%s"',a.isArray(n)?void 0:n._id),c(' class="%s"',o.classes||(a.isArray(n)?void 0:n._class)),c(' data-index="%s"',k),c(' data-uniqueid="%s"',n[this.options.uniqueId]),c("%s",q),">"),this.options.cardView&&g.push(c('<td colspan="%s"><div class="card-views">',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&g.push("<td>",'<a class="detail-icon" href="javascript:">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>"),a.each(this.header.fields,function(b,e){var i="",j=m(n,e,f.options.escape),l="",q={},r="",s=f.header.classes[b],t="",u="",v="",w="",x=f.columns[b];if(!(f.fromHtml&&"undefined"==typeof j||!x.visible||f.options.cardView&&!x.cardVisible)){if(o=c('style="%s"',p.concat(f.header.styles[b]).join("; ")),n["_"+e+"_id"]&&(r=c(' id="%s"',n["_"+e+"_id"])),n["_"+e+"_class"]&&(s=c(' class="%s"',n["_"+e+"_class"])),n["_"+e+"_rowspan"]&&(u=c(' rowspan="%s"',n["_"+e+"_rowspan"])),n["_"+e+"_colspan"]&&(v=c(' colspan="%s"',n["_"+e+"_colspan"])),n["_"+e+"_title"]&&(w=c(' title="%s"',n["_"+e+"_title"])),q=h(f.header,f.header.cellStyles[b],[j,n,k,e],q),q.classes&&(s=c(' class="%s"',q.classes)),q.css){var y=[];for(var z in q.css)y.push(z+": "+q.css[z]);o=c('style="%s"',y.concat(f.header.styles[b]).join("; "))}j=h(x,f.header.formatters[b],[j,n,k],j),n["_"+e+"_data"]&&!a.isEmptyObject(n["_"+e+"_data"])&&a.each(n["_"+e+"_data"],function(a,b){"index"!==a&&(t+=c(' data-%s="%s"',a,b))}),x.checkbox||x.radio?(l=x.checkbox?"checkbox":l,l=x.radio?"radio":l,i=[c(f.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',x["class"]||""),"<input"+c(' data-index="%s"',k)+c(' name="%s"',f.options.selectItemName)+c(' type="%s"',l)+c(' value="%s"',n[f.options.idField])+c(' checked="%s"',j===!0||j&&j.checked?"checked":void 0)+c(' disabled="%s"',!x.checkboxEnabled||j&&j.disabled?"disabled":void 0)+" />",f.header.formatters[b]&&"string"==typeof j?j:"",f.options.cardView?"</div>":"</td>"].join(""),n[f.header.stateField]=j===!0||j&&j.checked):(j="undefined"==typeof j||null===j?f.options.undefinedText:j,i=f.options.cardView?['<div class="card-view">',f.options.showHeader?c('<span class="title" %s>%s</span>',o,d(f.columns,"field","title",e)):"",c('<span class="value">%s</span>',j),"</div>"].join(""):[c("<td%s %s %s %s %s %s %s>",r,s,o,t,u,v,w),j,"</td>"].join(""),f.options.cardView&&f.options.smartDisplay&&""===j&&(i='<div class="card-view"></div>')),g.push(i)}}),this.options.cardView&&g.push("</div></td>"),g.push("</tr>")}g.length||g.push('<tr class="no-records-found">',c('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches()),"</tr>"),this.$body.html(g.join("")),b||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(b){var d=a(this),g=d.parent(),h=f.data[g.data("index")],i=d[0].cellIndex,j=f.getVisibleFields(),k=j[f.options.detailView&&!f.options.cardView?i-1:i],l=f.columns[e(f.columns,k)],n=m(h,k,f.options.escape);if(!d.find(".detail-icon").length&&(f.trigger("click"===b.type?"click-cell":"dbl-click-cell",k,n,h,d),f.trigger("click"===b.type?"click-row":"dbl-click-row",h,g,k),
+"click"===b.type&&f.options.clickToSelect&&l.clickToSelect)){var o=g.find(c('[name="%s"]',f.options.selectItemName));o.length&&o[0].click()}}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var b=a(this),d=b.parent().parent(),e=d.data("index"),g=i[e];if(d.next().is("tr.detail-view"))b.find("i").attr("class",c("%s %s",f.options.iconsPrefix,f.options.icons.detailOpen)),d.next().remove(),f.trigger("collapse-row",e,g);else{b.find("i").attr("class",c("%s %s",f.options.iconsPrefix,f.options.icons.detailClose)),d.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>',d.find("td").length));var j=d.next().find("td"),k=h(f.options,f.options.detailFormatter,[e,g,j],"");1===j.length&&j.append(k),f.trigger("expand-row",e,g,j)}f.resetView()}),this.$selectItem=this.$body.find(c('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(b){b.stopImmediatePropagation();var c=a(this),d=c.prop("checked"),e=f.data[c.data("index")];f.options.maintainSelected&&a(this).is(":radio")&&a.each(f.options.data,function(a,b){b[f.header.stateField]=!1}),e[f.header.stateField]=d,f.options.singleSelect&&(f.$selectItem.not(this).each(function(){f.data[a(this).data("index")][f.header.stateField]=!1}),f.$selectItem.filter(":checked").not(this).prop("checked",!1)),f.updateSelected(),f.trigger(d?"check":"uncheck",e,c)}),a.each(this.header.events,function(b,c){if(c){"string"==typeof c&&(c=h(null,c));var d=f.header.fields[b],e=a.inArray(d,f.getVisibleFields());f.options.detailView&&!f.options.cardView&&(e+=1);for(var g in c)f.$body.find(">tr:not(.no-records-found)").each(function(){var b=a(this),h=b.find(f.options.cardView?".card-view":"td").eq(e),i=g.indexOf(" "),j=g.substring(0,i),k=g.substring(i+1),l=c[g];h.find(k).off(j).on(j,function(a){var c=b.data("index"),e=f.data[c],g=e[d];l.apply(this,[a,g,e,c])})})}}),this.updateSelected(),this.resetView(),this.trigger("post-body",i)},p.prototype.initServer=function(b,c,d){var e,f=this,g={},i={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};this.options.pagination&&(i.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,i.pageNumber=this.options.pageNumber),(d||this.options.url||this.options.ajax)&&("limit"===this.options.queryParamsType&&(i={search:i.searchText,sort:i.sortName,order:i.sortOrder},this.options.pagination&&(i.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1),i.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)),a.isEmptyObject(this.filterColumnsPartial)||(i.filter=JSON.stringify(this.filterColumnsPartial,null)),g=h(this.options,this.options.queryParams,[i],g),a.extend(g,c||{}),g!==!1&&(b||this.$tableLoading.show(),e=a.extend({},h(null,this.options.ajaxOptions),{type:this.options.method,url:d||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(g):g,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(a){a=h(f.options,f.options.responseHandler,[a],a),f.load(a),f.trigger("load-success",a),b||f.$tableLoading.hide()},error:function(a){f.trigger("load-error",a.status,a),b||f.$tableLoading.hide()}}),this.options.ajax?h(this,this.options.ajax,[e],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=a.ajax(e))))},p.prototype.initSearchText=function(){if(this.options.search&&""!==this.options.searchText){var a=this.$toolbar.find(".search input");a.val(this.options.searchText),this.onSearch({currentTarget:a})}},p.prototype.getCaret=function(){var b=this;a.each(this.$header.find("th"),function(c,d){a(d).find(".sortable").removeClass("desc asc").addClass(a(d).data("field")===b.options.sortName?b.options.sortOrder:"both")})},p.prototype.updateSelected=function(){var b=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",b),this.$selectItem.each(function(){a(this).closest("tr")[a(this).prop("checked")?"addClass":"removeClass"]("selected")})},p.prototype.updateRows=function(){var b=this;this.$selectItem.each(function(){b.data[a(this).data("index")][b.header.stateField]=a(this).prop("checked")})},p.prototype.resetRows=function(){var b=this;a.each(this.data,function(a,c){b.$selectAll.prop("checked",!1),b.$selectItem.prop("checked",!1),b.header.stateField&&(c[b.header.stateField]=!1)})},p.prototype.trigger=function(b){var c=Array.prototype.slice.call(arguments,1);b+=".bs.table",this.options[p.EVENTS[b]].apply(this.options,c),this.$el.trigger(a.Event(b),c),this.options.onAll(b,c),this.$el.trigger(a.Event("all.bs.table"),[b,c])},p.prototype.resetHeader=function(){clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(a.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)},p.prototype.fitHeader=function(){var b,d,e,f,h=this;if(h.$el.is(":hidden"))return void(h.timeoutId_=setTimeout(a.proxy(h.fitHeader,h),100));if(b=this.$tableBody.get(0),d=b.scrollWidth>b.clientWidth&&b.scrollHeight>b.clientHeight+this.$header.outerHeight()?g():0,this.$el.css("margin-top",-this.$header.outerHeight()),e=a(":focus"),e.length>0){var i=e.parents("th");if(i.length>0){var j=i.attr("data-field");if(void 0!==j){var k=this.$header.find("[data-field='"+j+"']");k.length>0&&k.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css({"margin-right":d}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),f=a(".focus-temp:visible:eq(0)"),f.length>0&&(f.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(){h.$header_.find(c('th[data-field="%s"]',a(this).data("field"))).data(a(this).data())});var l=this.getVisibleFields(),m=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(b){var d=a(this),e=b;h.options.detailView&&!h.options.cardView&&(0===b&&h.$header_.find("th.detail").find(".fht-cell").width(d.innerWidth()),e=b-1);var f=h.$header_.find(c('th[data-field="%s"]',l[e]));f.length>1&&(f=a(m[d[0].cellIndex])),f.find(".fht-cell").width(d.innerWidth())}),this.$tableBody.off("scroll").on("scroll",function(){h.$tableHeader.scrollLeft(a(this).scrollLeft()),h.options.showFooter&&!h.options.cardView&&h.$tableFooter.scrollLeft(a(this).scrollLeft())}),h.trigger("post-header")},p.prototype.resetFooter=function(){var b=this,d=b.getData(),e=[];this.options.showFooter&&!this.options.cardView&&(!this.options.cardView&&this.options.detailView&&e.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>'),a.each(this.columns,function(a,f){var g,i="",j="",k=[],l={},m=c(' class="%s"',f["class"]);if(f.visible&&(!b.options.cardView||f.cardVisible)){if(i=c("text-align: %s; ",f.falign?f.falign:f.align),j=c("vertical-align: %s; ",f.valign),l=h(null,b.options.footerStyle),l&&l.css)for(g in l.css)k.push(g+": "+l.css[g]);e.push("<td",m,c(' style="%s"',i+j+k.concat().join("; ")),">"),e.push('<div class="th-inner">'),e.push(h(f,f.footerFormatter,[d],"&nbsp;")||"&nbsp;"),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</td>")}}),this.$tableFooter.find("tr").html(e.join("")),this.$tableFooter.show(),clearTimeout(this.timeoutFooter_),this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0))},p.prototype.fitFooter=function(){var b,c,d;return clearTimeout(this.timeoutFooter_),this.$el.is(":hidden")?void(this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),100)):(c=this.$el.css("width"),d=c>this.$tableBody.width()?g():0,this.$tableFooter.css({"margin-right":d}).find("table").css("width",c).attr("class",this.$el.attr("class")),b=this.$tableFooter.find("td"),void this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(c){var d=a(this);b.eq(c).find(".fht-cell").width(d.innerWidth())}))},p.prototype.toggleColumn=function(a,b,d){if(-1!==a&&(this.columns[a].visible=b,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var e=this.$toolbar.find(".keep-open input").prop("disabled",!1);d&&e.filter(c('[value="%s"]',a)).prop("checked",b),e.filter(":checked").length<=this.options.minimumCountColumns&&e.filter(":checked").prop("disabled",!0)}},p.prototype.toggleRow=function(a,b,d){-1!==a&&this.$body.find("undefined"!=typeof a?c('tr[data-index="%s"]',a):c('tr[data-uniqueid="%s"]',b))[d?"show":"hide"]()},p.prototype.getVisibleFields=function(){var b=this,c=[];return a.each(this.header.fields,function(a,d){var f=b.columns[e(b.columns,d)];f.visible&&c.push(d)}),c},p.prototype.resetView=function(a){var b=0;if(a&&a.height&&(this.options.height=a.height),this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length),this.options.height){var c=k(this.$toolbar),d=k(this.$pagination),e=this.options.height-c-d;this.$tableContainer.css("height",e+"px")}return this.options.cardView?(this.$el.css("margin-top","0"),this.$tableContainer.css("padding-bottom","0"),void this.$tableFooter.hide()):(this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),b+=this.$header.outerHeight()):(this.$tableHeader.hide(),this.trigger("post-header")),this.options.showFooter&&(this.resetFooter(),this.options.height&&(b+=this.$tableFooter.outerHeight()+1)),this.getCaret(),this.$tableContainer.css("padding-bottom",b+"px"),void this.trigger("reset-view"))},p.prototype.getData=function(b){return!this.searchText&&a.isEmptyObject(this.filterColumns)&&a.isEmptyObject(this.filterColumnsPartial)?b?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data:b?this.data.slice(this.pageFrom-1,this.pageTo):this.data},p.prototype.load=function(b){var c=!1;"server"===this.options.sidePagination?(this.options.totalRows=b.total,c=b.fixedScroll,b=b[this.options.dataField]):a.isArray(b)||(c=b.fixedScroll,b=b.data),this.initData(b),this.initSearch(),this.initPagination(),this.initBody(c)},p.prototype.append=function(a){this.initData(a,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},p.prototype.prepend=function(a){this.initData(a,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},p.prototype.remove=function(b){var c,d,e=this.options.data.length;if(b.hasOwnProperty("field")&&b.hasOwnProperty("values")){for(c=e-1;c>=0;c--)d=this.options.data[c],d.hasOwnProperty(b.field)&&-1!==a.inArray(d[b.field],b.values)&&this.options.data.splice(c,1);e!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},p.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},p.prototype.getRowByUniqueId=function(a){var b,c,d,e=this.options.uniqueId,f=this.options.data.length,g=null;for(b=f-1;b>=0;b--){if(c=this.options.data[b],c.hasOwnProperty(e))d=c[e];else{if(!c._data.hasOwnProperty(e))continue;d=c._data[e]}if("string"==typeof d?a=a.toString():"number"==typeof d&&(Number(d)===d&&d%1===0?a=parseInt(a):d===Number(d)&&0!==d&&(a=parseFloat(a))),d===a){g=c;break}}return g},p.prototype.removeByUniqueId=function(a){var b=this.options.data.length,c=this.getRowByUniqueId(a);c&&this.options.data.splice(this.options.data.indexOf(c),1),b!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initBody(!0))},p.prototype.updateByUniqueId=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){var e;d.hasOwnProperty("id")&&d.hasOwnProperty("row")&&(e=a.inArray(c.getRowByUniqueId(d.id),c.options.data),-1!==e&&a.extend(c.options.data[e],d.row))}),this.initSearch(),this.initSort(),this.initBody(!0)},p.prototype.insertRow=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("row")&&(this.data.splice(a.index,0,a.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))},p.prototype.updateRow=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){d.hasOwnProperty("index")&&d.hasOwnProperty("row")&&a.extend(c.options.data[d.index],d.row)}),this.initSearch(),this.initSort(),this.initBody(!0)},p.prototype.showRow=function(a){(a.hasOwnProperty("index")||a.hasOwnProperty("uniqueId"))&&this.toggleRow(a.index,a.uniqueId,!0)},p.prototype.hideRow=function(a){(a.hasOwnProperty("index")||a.hasOwnProperty("uniqueId"))&&this.toggleRow(a.index,a.uniqueId,!1)},p.prototype.getRowsHidden=function(b){var c=a(this.$body[0]).children().filter(":hidden"),d=0;if(b)for(;d<c.length;d++)a(c[d]).show();return c},p.prototype.mergeCells=function(b){var c,d,e,f=b.index,g=a.inArray(b.field,this.getVisibleFields()),h=b.rowspan||1,i=b.colspan||1,j=this.$body.find(">tr");if(this.options.detailView&&!this.options.cardView&&(g+=1),e=j.eq(f).find(">td").eq(g),!(0>f||0>g||f>=this.data.length)){for(c=f;f+h>c;c++)for(d=g;g+i>d;d++)j.eq(c).find(">td").eq(d).hide();e.attr("rowspan",h).attr("colspan",i).show()}},p.prototype.updateCell=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("field")&&a.hasOwnProperty("value")&&(this.data[a.index][a.field]=a.value,a.reinit!==!1&&(this.initSort(),this.initBody(!0)))},p.prototype.getOptions=function(){return this.options},p.prototype.getSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},p.prototype.getAllSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},p.prototype.checkAll=function(){this.checkAll_(!0)},p.prototype.uncheckAll=function(){this.checkAll_(!1)},p.prototype.checkInvert=function(){var b=this,c=b.$selectItem.filter(":enabled"),d=c.filter(":checked");c.each(function(){a(this).prop("checked",!a(this).prop("checked"))}),b.updateRows(),b.updateSelected(),b.trigger("uncheck-some",d),d=b.getSelections(),b.trigger("check-some",d)},p.prototype.checkAll_=function(a){var b;a||(b=this.getSelections()),this.$selectAll.add(this.$selectAll_).prop("checked",a),this.$selectItem.filter(":enabled").prop("checked",a),this.updateRows(),a&&(b=this.getSelections()),this.trigger(a?"check-all":"uncheck-all",b)},p.prototype.check=function(a){this.check_(!0,a)},p.prototype.uncheck=function(a){this.check_(!1,a)},p.prototype.check_=function(a,b){var d=this.$selectItem.filter(c('[data-index="%s"]',b)).prop("checked",a);this.data[b][this.header.stateField]=a,this.updateSelected(),this.trigger(a?"check":"uncheck",this.data[b],d)},p.prototype.checkBy=function(a){this.checkBy_(!0,a)},p.prototype.uncheckBy=function(a){this.checkBy_(!1,a)},p.prototype.checkBy_=function(b,d){if(d.hasOwnProperty("field")&&d.hasOwnProperty("values")){var e=this,f=[];a.each(this.options.data,function(g,h){if(!h.hasOwnProperty(d.field))return!1;if(-1!==a.inArray(h[d.field],d.values)){var i=e.$selectItem.filter(":enabled").filter(c('[data-index="%s"]',g)).prop("checked",b);h[e.header.stateField]=b,f.push(h),e.trigger(b?"check":"uncheck",h,i)}}),this.updateSelected(),this.trigger(b?"check-some":"uncheck-some",f)}},p.prototype.destroy=function(){this.$el.insertBefore(this.$container),a(this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")},p.prototype.showLoading=function(){this.$tableLoading.show()},p.prototype.hideLoading=function(){this.$tableLoading.hide()},p.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var a=this.$toolbar.find('button[name="paginationSwitch"] i');this.options.pagination?a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown):a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp),this.updatePagination()},p.prototype.refresh=function(a){a&&a.url&&(this.options.pageNumber=1),this.initServer(a&&a.silent,a&&a.query,a&&a.url),this.trigger("refresh",a)},p.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},p.prototype.showColumn=function(a){this.toggleColumn(e(this.columns,a),!0,!0)},p.prototype.hideColumn=function(a){this.toggleColumn(e(this.columns,a),!1,!0)},p.prototype.getHiddenColumns=function(){return a.grep(this.columns,function(a){return!a.visible})},p.prototype.getVisibleColumns=function(){return a.grep(this.columns,function(a){return a.visible})},p.prototype.toggleAllColumns=function(b){if(a.each(this.columns,function(a){this.columns[a].visible=b}),this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns){var c=this.$toolbar.find(".keep-open input").prop("disabled",!1);c.filter(":checked").length<=this.options.minimumCountColumns&&c.filter(":checked").prop("disabled",!0)}},p.prototype.showAllColumns=function(){this.toggleAllColumns(!0)},p.prototype.hideAllColumns=function(){this.toggleAllColumns(!1)},p.prototype.filterBy=function(b){this.filterColumns=a.isEmptyObject(b)?{}:b,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},p.prototype.scrollTo=function(a){return"string"==typeof a&&(a="bottom"===a?this.$tableBody[0].scrollHeight:0),"number"==typeof a&&this.$tableBody.scrollTop(a),"undefined"==typeof a?this.$tableBody.scrollTop():void 0},p.prototype.getScrollPosition=function(){return this.scrollTo()},p.prototype.selectPage=function(a){a>0&&a<=this.options.totalPages&&(this.options.pageNumber=a,this.updatePagination())},p.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},p.prototype.nextPage=function(){this.options.pageNumber<this.options.totalPages&&(this.options.pageNumber++,this.updatePagination())},p.prototype.toggleView=function(){this.options.cardView=!this.options.cardView,this.initHeader(),this.initBody(),this.trigger("toggle",this.options.cardView)},p.prototype.refreshOptions=function(b){i(this.options,b,!0)||(this.options=a.extend(this.options,b),this.trigger("refresh-options",this.options),this.destroy(),this.init())},p.prototype.resetSearch=function(a){var b=this.$toolbar.find(".search input");b.val(a||""),this.onSearch({currentTarget:b})},p.prototype.expandRow_=function(a,b){var d=this.$body.find(c('> tr[data-index="%s"]',b));d.next().is("tr.detail-view")===(a?!1:!0)&&d.find("> td > .detail-icon").click()},p.prototype.expandRow=function(a){this.expandRow_(!0,a)},p.prototype.collapseRow=function(a){this.expandRow_(!1,a)},p.prototype.expandAllRows=function(b){if(b){var d=this.$body.find(c('> tr[data-index="%s"]',0)),e=this,f=null,g=!1,h=-1;if(d.next().is("tr.detail-view")?d.next().next().is("tr.detail-view")||(d.next().find(".detail-icon").click(),g=!0):(d.find("> td > .detail-icon").click(),g=!0),g)try{h=setInterval(function(){f=e.$body.find("tr.detail-view").last().find(".detail-icon"),f.length>0?f.click():clearInterval(h)},1)}catch(i){clearInterval(h)}}else for(var j=this.$body.children(),k=0;k<j.length;k++)this.expandRow_(!0,a(j[k]).data("index"))},p.prototype.collapseAllRows=function(b){if(b)this.expandRow_(!1,0);else for(var c=this.$body.children(),d=0;d<c.length;d++)this.expandRow_(!1,a(c[d]).data("index"))},p.prototype.updateFormatText=function(a,b){this.options[c("format%s",a)]&&("string"==typeof b?this.options[c("format%s",a)]=function(){return b}:"function"==typeof b&&(this.options[c("format%s",a)]=b)),this.initToolbar(),this.initPagination(),this.initBody()};var q=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getRowsHidden","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","getVisibleColumns","showAllColumns","hideAllColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];a.fn.bootstrapTable=function(b){var c,d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("bootstrap.table"),g=a.extend({},p.DEFAULTS,e.data(),"object"==typeof b&&b);if("string"==typeof b){if(a.inArray(b,q)<0)throw new Error("Unknown method: "+b);if(!f)return;c=f[b].apply(f,d),"destroy"===b&&e.removeData("bootstrap.table")}f||e.data("bootstrap.table",f=new p(this,g))}),"undefined"==typeof c?this:c},a.fn.bootstrapTable.Constructor=p,a.fn.bootstrapTable.defaults=p.DEFAULTS,a.fn.bootstrapTable.columnDefaults=p.COLUMN_DEFAULTS,a.fn.bootstrapTable.locales=p.LOCALES,a.fn.bootstrapTable.methods=q,a.fn.bootstrapTable.utils={sprintf:c,getFieldIndex:e,compareObjects:i,calculateObjectValue:h,getItemField:m,objectKeys:o,isIEBrowser:n},a(function(){a('[data-toggle="table"]').bootstrapTable()})}(jQuery); \ No newline at end of file
diff --git a/www/js/contrib/bootstrap.min.js b/www/js/contrib/bootstrap.min.js
new file mode 100644
index 00000000..7c1561a8
--- /dev/null
+++ b/www/js/contrib/bootstrap.min.js
@@ -0,0 +1,6 @@
+/*!
+ * Bootstrap v3.2.0 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f+', [role="menu"], [role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.2.0",c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(300):c.$element.trigger("focus").trigger(e)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-k<o.left?"right":g,e.removeClass(m).addClass(g)}var p=this.getCalculatedOffset(g,j,k,l);this.applyPlacement(p,g);var q=function(){d.$element.trigger("shown.bs."+d.type),d.hoverState=null};a.support.transition&&this.$tip.hasClass("fade")?e.one("bsTransitionEnd",q).emulateTransitionEnd(150):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=k.left?2*k.left-e+i:2*k.top-f+j,m=k.left?"left":"top",n=k.left?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(l,d[0][n],m)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one("bsTransitionEnd",b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName;return a.extend({},"function"==typeof c.getBoundingClientRect?c.getBoundingClientRect():null,{scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop(),width:d?a(window).width():b.outerWidth(),height:d?a(window).height():b.outerHeight()},d?{top:0,left:0}:b.offset())},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); \ No newline at end of file
diff --git a/www/js/contrib/d3-array.v1.min.js b/www/js/contrib/d3-array.v1.min.js
new file mode 100644
index 00000000..97b5ae8a
--- /dev/null
+++ b/www/js/contrib/d3-array.v1.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-array/ Version 1.0.2. Copyright 2016 Mike Bostock.
+!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.d3=n.d3||{})}(this,function(n){"use strict";function r(n){return function(r,t){return u(n(r),t)}}function t(n,r,t){var e=Math.abs(r-n)/Math.max(0,t),u=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),o=e/u;return o>=m?u*=10:o>=b?u*=5:o>=A&&(u*=2),r<n?-u:u}function e(n){return n.length}var u=function(n,r){return n<r?-1:n>r?1:n>=r?0:NaN},o=function(n){return 1===n.length&&(n=r(n)),{left:function(r,t,e,u){for(null==e&&(e=0),null==u&&(u=r.length);e<u;){var o=e+u>>>1;n(r[o],t)<0?e=o+1:u=o}return e},right:function(r,t,e,u){for(null==e&&(e=0),null==u&&(u=r.length);e<u;){var o=e+u>>>1;n(r[o],t)>0?u=o:e=o+1}return e}}},f=o(u),l=f.right,i=f.left,a=function(n,r){return r<n?-1:r>n?1:r>=n?0:NaN},h=function(n){return null===n?NaN:+n},c=function(n,r){var t,e,u=n.length,o=0,f=0,l=-1,i=0;if(null==r)for(;++l<u;)isNaN(t=h(n[l]))||(e=t-o,o+=e/++i,f+=e*(t-o));else for(;++l<u;)isNaN(t=h(r(n[l],l,n)))||(e=t-o,o+=e/++i,f+=e*(t-o));if(i>1)return f/(i-1)},s=function(n,r){var t=c(n,r);return t?Math.sqrt(t):t},g=function(n,r){var t,e,u,o=-1,f=n.length;if(null==r){for(;++o<f;)if(null!=(e=n[o])&&e>=e){t=u=e;break}for(;++o<f;)null!=(e=n[o])&&(t>e&&(t=e),u<e&&(u=e))}else{for(;++o<f;)if(null!=(e=r(n[o],o,n))&&e>=e){t=u=e;break}for(;++o<f;)null!=(e=r(n[o],o,n))&&(t>e&&(t=e),u<e&&(u=e))}return[t,u]},v=Array.prototype,p=v.slice,d=v.map,M=function(n){return function(){return n}},y=function(n){return n},N=function(n,r,t){n=+n,r=+r,t=(u=arguments.length)<2?(r=n,n=0,1):u<3?1:+t;for(var e=-1,u=0|Math.max(0,Math.ceil((r-n)/t)),o=new Array(u);++e<u;)o[e]=n+e*t;return o},m=Math.sqrt(50),b=Math.sqrt(10),A=Math.sqrt(2),w=function(n,r,e){var u=t(n,r,e);return N(Math.ceil(n/u)*u,Math.floor(r/u)*u+u/2,u)},x=function(n){return Math.ceil(Math.log(n.length)/Math.LN2)+1},k=function(){function n(n){var u,o,f=n.length,i=new Array(f);for(u=0;u<f;++u)i[u]=r(n[u],u,n);var a=t(i),h=a[0],c=a[1],s=e(i,h,c);Array.isArray(s)||(s=w(h,c,s));for(var g=s.length;s[0]<=h;)s.shift(),--g;for(;s[g-1]>=c;)s.pop(),--g;var v,p=new Array(g+1);for(u=0;u<=g;++u)v=p[u]=[],v.x0=u>0?s[u-1]:h,v.x1=u<g?s[u]:c;for(u=0;u<f;++u)o=i[u],h<=o&&o<=c&&p[l(s,o,0,g)].push(n[u]);return p}var r=y,t=g,e=x;return n.value=function(t){return arguments.length?(r="function"==typeof t?t:M(t),n):r},n.domain=function(r){return arguments.length?(t="function"==typeof r?r:M([r[0],r[1]]),n):t},n.thresholds=function(r){return arguments.length?(e="function"==typeof r?r:M(Array.isArray(r)?p.call(r):r),n):e},n},q=function(n,r,t){if(null==t&&(t=h),e=n.length){if((r=+r)<=0||e<2)return+t(n[0],0,n);if(r>=1)return+t(n[e-1],e-1,n);var e,u=(e-1)*r,o=Math.floor(u),f=+t(n[o],o,n),l=+t(n[o+1],o+1,n);return f+(l-f)*(u-o)}},L=function(n,r,t){return n=d.call(n,h).sort(u),Math.ceil((t-r)/(2*(q(n,.75)-q(n,.25))*Math.pow(n.length,-1/3)))},S=function(n,r,t){return Math.ceil((t-r)/(3.5*s(n)*Math.pow(n.length,-1/3)))},j=function(n,r){var t,e,u=-1,o=n.length;if(null==r){for(;++u<o;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<o;)null!=(e=n[u])&&e>t&&(t=e)}else{for(;++u<o;)if(null!=(e=r(n[u],u,n))&&e>=e){t=e;break}for(;++u<o;)null!=(e=r(n[u],u,n))&&e>t&&(t=e)}return t},_=function(n,r){var t,e=0,u=n.length,o=-1,f=u;if(null==r)for(;++o<u;)isNaN(t=h(n[o]))?--f:e+=t;else for(;++o<u;)isNaN(t=h(r(n[o],o,n)))?--f:e+=t;if(f)return e/f},z=function(n,r){var t,e=[],o=n.length,f=-1;if(null==r)for(;++f<o;)isNaN(t=h(n[f]))||e.push(t);else for(;++f<o;)isNaN(t=h(r(n[f],f,n)))||e.push(t);return q(e.sort(u),.5)},D=function(n){for(var r,t,e,u=n.length,o=-1,f=0;++o<u;)f+=n[o].length;for(t=new Array(f);--u>=0;)for(e=n[u],r=e.length;--r>=0;)t[--f]=e[r];return t},F=function(n,r){var t,e,u=-1,o=n.length;if(null==r){for(;++u<o;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<o;)null!=(e=n[u])&&t>e&&(t=e)}else{for(;++u<o;)if(null!=(e=r(n[u],u,n))&&e>=e){t=e;break}for(;++u<o;)null!=(e=r(n[u],u,n))&&t>e&&(t=e)}return t},O=function(n){for(var r=0,t=n.length-1,e=n[0],u=new Array(t<0?0:t);r<t;)u[r]=[e,e=n[++r]];return u},P=function(n,r){for(var t=r.length,e=new Array(t);t--;)e[t]=n[r[t]];return e},R=function(n,r){if(t=n.length){var t,e,o=0,f=0,l=n[f];for(r||(r=u);++o<t;)(r(e=n[o],l)<0||0!==r(l,l))&&(l=e,f=o);return 0===r(l,l)?f:void 0}},B=function(n,r,t){for(var e,u,o=(null==t?n.length:t)-(r=null==r?0:+r);o;)u=Math.random()*o--|0,e=n[o+r],n[o+r]=n[u+r],n[u+r]=e;return n},C=function(n,r){var t,e=0,u=n.length,o=-1;if(null==r)for(;++o<u;)(t=+n[o])&&(e+=t);else for(;++o<u;)(t=+r(n[o],o,n))&&(e+=t);return e},E=function(n){if(!(o=n.length))return[];for(var r=-1,t=F(n,e),u=new Array(t);++r<t;)for(var o,f=-1,l=u[r]=new Array(o);++f<o;)l[f]=n[f][r];return u},G=function(){return E(arguments)};n.bisect=l,n.bisectRight=l,n.bisectLeft=i,n.ascending=u,n.bisector=o,n.descending=a,n.deviation=s,n.extent=g,n.histogram=k,n.thresholdFreedmanDiaconis=L,n.thresholdScott=S,n.thresholdSturges=x,n.max=j,n.mean=_,n.median=z,n.merge=D,n.min=F,n.pairs=O,n.permute=P,n.quantile=q,n.range=N,n.scan=R,n.shuffle=B,n.sum=C,n.ticks=w,n.tickStep=t,n.transpose=E,n.variance=c,n.zip=G,Object.defineProperty(n,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/d3-collection.v1.min.js b/www/js/contrib/d3-collection.v1.min.js
new file mode 100644
index 00000000..9eba8b28
--- /dev/null
+++ b/www/js/contrib/d3-collection.v1.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-collection/ Version 1.0.2. Copyright 2016 Mike Bostock.
+!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.d3=n.d3||{})}(this,function(n){"use strict";function t(){}function e(n,e){var r=new t;if(n instanceof t)n.each(function(n,t){r.set(t,n)});else if(Array.isArray(n)){var i,u=-1,o=n.length;if(null==e)for(;++u<o;)r.set(u,n[u]);else for(;++u<o;)r.set(e(i=n[u],u,n),i)}else if(n)for(var s in n)r.set(s,n[s]);return r}function r(){return{}}function i(n,t,e){n[t]=e}function u(){return e()}function o(n,t,e){n.set(t,e)}function s(){}function f(n,t){var e=new s;if(n instanceof s)n.each(function(n){e.add(n)});else if(n){var r=-1,i=n.length;if(null==t)for(;++r<i;)e.add(n[r]);else for(;++r<i;)e.add(t(n[r],r,n))}return e}var c="$";t.prototype=e.prototype={constructor:t,has:function(n){return c+n in this},get:function(n){return this[c+n]},set:function(n,t){return this[c+n]=t,this},remove:function(n){var t=c+n;return t in this&&delete this[t]},clear:function(){for(var n in this)n[0]===c&&delete this[n]},keys:function(){var n=[];for(var t in this)t[0]===c&&n.push(t.slice(1));return n},values:function(){var n=[];for(var t in this)t[0]===c&&n.push(this[t]);return n},entries:function(){var n=[];for(var t in this)t[0]===c&&n.push({key:t.slice(1),value:this[t]});return n},size:function(){var n=0;for(var t in this)t[0]===c&&++n;return n},empty:function(){for(var n in this)if(n[0]===c)return!1;return!0},each:function(n){for(var t in this)t[0]===c&&n(this[t],t.slice(1),this)}};var a=function(){function n(t,r,i,u){if(r>=a.length)return null!=f?f(t):null!=s?t.sort(s):t;for(var o,c,h,l=-1,v=t.length,p=a[r++],y=e(),d=i();++l<v;)(h=y.get(o=p(c=t[l])+""))?h.push(c):y.set(o,[c]);return y.each(function(t,e){u(d,e,n(t,r,i,u))}),d}function t(n,e){if(++e>a.length)return n;var r,i=h[e-1];return null!=f&&e>=a.length?r=n.entries():(r=[],n.each(function(n,i){r.push({key:i,values:t(n,e)})})),null!=i?r.sort(function(n,t){return i(n.key,t.key)}):r}var s,f,c,a=[],h=[];return c={object:function(t){return n(t,0,r,i)},map:function(t){return n(t,0,u,o)},entries:function(e){return t(n(e,0,u,o),0)},key:function(n){return a.push(n),c},sortKeys:function(n){return h[a.length-1]=n,c},sortValues:function(n){return s=n,c},rollup:function(n){return f=n,c}}},h=e.prototype;s.prototype=f.prototype={constructor:s,has:h.has,add:function(n){return n+="",this[c+n]=n,this},remove:h.remove,clear:h.clear,values:h.keys,size:h.size,empty:h.empty,each:h.each};var l=function(n){var t=[];for(var e in n)t.push(e);return t},v=function(n){var t=[];for(var e in n)t.push(n[e]);return t},p=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t};n.nest=a,n.set=f,n.map=e,n.keys=l,n.values=v,n.entries=p,Object.defineProperty(n,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/d3-color.v1.min.js b/www/js/contrib/d3-color.v1.min.js
new file mode 100644
index 00000000..3d72780c
--- /dev/null
+++ b/www/js/contrib/d3-color.v1.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-color/ Version 1.0.2. Copyright 2016 Mike Bostock.
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.d3=t.d3||{})}(this,function(t){"use strict";function e(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function n(){}function i(t){var e;return t=(t+"").trim().toLowerCase(),(e=S.exec(t))?(e=parseInt(e[1],16),new h(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=_.exec(t))?r(parseInt(e[1],16)):(e=z.exec(t))?new h(e[1],e[2],e[3],1):(e=C.exec(t))?new h(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=L.exec(t))?a(e[1],e[2],e[3],e[4]):(e=A.exec(t))?a(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=B.exec(t))?l(e[1],e[2]/100,e[3]/100,1):(e=D.exec(t))?l(e[1],e[2]/100,e[3]/100,e[4]):F.hasOwnProperty(t)?r(F[t]):"transparent"===t?new h(NaN,NaN,NaN,0):null}function r(t){return new h(t>>16&255,t>>8&255,255&t,1)}function a(t,e,n,i){return i<=0&&(t=e=n=NaN),new h(t,e,n,i)}function s(t){return t instanceof n||(t=i(t)),t?(t=t.rgb(),new h(t.r,t.g,t.b,t.opacity)):new h}function o(t,e,n,i){return 1===arguments.length?s(t):new h(t,e,n,null==i?1:i)}function h(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function l(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new g(t,e,n,i)}function u(t){if(t instanceof g)return new g(t.h,t.s,t.l,t.opacity);if(t instanceof n||(t=i(t)),!t)return new g;if(t instanceof g)return t;t=t.rgb();var e=t.r/255,r=t.g/255,a=t.b/255,s=Math.min(e,r,a),o=Math.max(e,r,a),h=NaN,l=o-s,u=(o+s)/2;return l?(h=e===o?(r-a)/l+6*(r<a):r===o?(a-e)/l+2:(e-r)/l+4,l/=u<.5?o+s:2-o-s,h*=60):l=u>0&&u<1?0:h,new g(h,l,u,t.opacity)}function c(t,e,n,i){return 1===arguments.length?u(t):new g(t,e,n,null==i?1:i)}function g(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function d(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function p(t){if(t instanceof b)return new b(t.l,t.a,t.b,t.opacity);if(t instanceof v){var e=t.h*G;return new b(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof h||(t=s(t));var n=k(t.r),i=k(t.g),r=k(t.b),a=y((.4124564*n+.3575761*i+.1804375*r)/K),o=y((.2126729*n+.7151522*i+.072175*r)/Q),l=y((.0193339*n+.119192*i+.9503041*r)/T);return new b(116*o-16,500*(a-o),200*(o-l),t.opacity)}function f(t,e,n,i){return 1===arguments.length?p(t):new b(t,e,n,null==i?1:i)}function b(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function y(t){return t>X?Math.pow(t,1/3):t/W+U}function w(t){return t>V?t*t*t:W*(t-U)}function m(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function k(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function N(t){if(t instanceof v)return new v(t.h,t.c,t.l,t.opacity);t instanceof b||(t=p(t));var e=Math.atan2(t.b,t.a)*H;return new v(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function M(t,e,n,i){return 1===arguments.length?N(t):new v(t,e,n,null==i?1:i)}function v(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}function x(t){if(t instanceof E)return new E(t.h,t.s,t.l,t.opacity);t instanceof h||(t=s(t));var e=t.r/255,n=t.g/255,i=t.b/255,r=(at*i+it*e-rt*n)/(at+it-rt),a=i-r,o=(nt*(n-r)-tt*a)/et,l=Math.sqrt(o*o+a*a)/(nt*r*(1-r)),u=l?Math.atan2(o,a)*H-120:NaN;return new E(u<0?u+360:u,l,r,t.opacity)}function q(t,e,n,i){return 1===arguments.length?x(t):new E(t,e,n,null==i?1:i)}function E(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}var $=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t},R=.7,j=1/R,I="\\s*([+-]?\\d+)\\s*",P="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",O="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",S=/^#([0-9a-f]{3})$/,_=/^#([0-9a-f]{6})$/,z=new RegExp("^rgb\\("+[I,I,I]+"\\)$"),C=new RegExp("^rgb\\("+[O,O,O]+"\\)$"),L=new RegExp("^rgba\\("+[I,I,I,P]+"\\)$"),A=new RegExp("^rgba\\("+[O,O,O,P]+"\\)$"),B=new RegExp("^hsl\\("+[P,O,O]+"\\)$"),D=new RegExp("^hsla\\("+[P,O,O,P]+"\\)$"),F={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};$(n,i,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),$(h,o,e(n,{brighter:function(t){return t=null==t?j:Math.pow(j,t),new h(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?R:Math.pow(R,t),new h(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),$(g,c,e(n,{brighter:function(t){return t=null==t?j:Math.pow(j,t),new g(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?R:Math.pow(R,t),new g(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new h(d(t>=240?t-240:t+120,r,i),d(t,r,i),d(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var G=Math.PI/180,H=180/Math.PI,J=18,K=.95047,Q=1,T=1.08883,U=4/29,V=6/29,W=3*V*V,X=V*V*V;$(b,f,e(n,{brighter:function(t){return new b(this.l+J*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new b(this.l-J*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return t=Q*w(t),e=K*w(e),n=T*w(n),new h(m(3.2404542*e-1.5371385*t-.4985314*n),m(-.969266*e+1.8760108*t+.041556*n),m(.0556434*e-.2040259*t+1.0572252*n),this.opacity)}})),$(v,M,e(n,{brighter:function(t){return new v(this.h,this.c,this.l+J*(null==t?1:t),this.opacity)},darker:function(t){return new v(this.h,this.c,this.l-J*(null==t?1:t),this.opacity)},rgb:function(){return p(this).rgb()}}));var Y=-.14861,Z=1.78277,tt=-.29227,et=-.90649,nt=1.97294,it=nt*et,rt=nt*Z,at=Z*tt-et*Y;$(E,q,e(n,{brighter:function(t){return t=null==t?j:Math.pow(j,t),new E(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?R:Math.pow(R,t),new E(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*G,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),i=Math.cos(t),r=Math.sin(t);return new h(255*(e+n*(Y*i+Z*r)),255*(e+n*(tt*i+et*r)),255*(e+n*(nt*i)),this.opacity)}})),t.color=i,t.rgb=o,t.hsl=c,t.lab=f,t.hcl=M,t.cubehelix=q,Object.defineProperty(t,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/d3-format.v1.min.js b/www/js/contrib/d3-format.v1.min.js
new file mode 100644
index 00000000..0133dcd3
--- /dev/null
+++ b/www/js/contrib/d3-format.v1.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-format/ Version 1.0.2. Copyright 2016 Mike Bostock.
+!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(t,n){if((r=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var r,e=t.slice(0,r);return[e.length>1?e[0]+e.slice(2):e,+t.slice(r+1)]}function r(t){return t=n(Math.abs(t)),t?t[1]:NaN}function e(t,n){return function(r,e){for(var i=r.length,o=[],a=0,u=t[0],s=0;i>0&&u>0&&(s+u+1>e&&(u=Math.max(1,e-s)),o.push(r.substring(i-=u,i+u)),!((s+=u+1)>e));)u=t[a=(a+1)%t.length];return o.reverse().join(n)}}function i(t,n){t=t.toPrecision(n);t:for(var r,e=t.length,i=1,o=-1;i<e;++i)switch(t[i]){case".":o=r=i;break;case"0":0===o&&(o=i),r=i;break;case"e":break t;default:o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(r+1):t}function o(t,r){var e=n(t,r);if(!e)return t+"";var i=e[0],o=e[1],a=o-(d=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,u=i.length;return a===u?i:a>u?i+new Array(a-u+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+n(t,Math.max(0,r+a-1))[0]}function a(t,r){var e=n(t,r);if(!e)return t+"";var i=e[0],o=e[1];return o<0?"0."+new Array((-o)).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}function u(t){return new s(t)}function s(t){if(!(n=M.exec(t)))throw new Error("invalid format: "+t);var n,r=n[1]||" ",e=n[2]||">",i=n[3]||"-",o=n[4]||"",a=!!n[5],u=n[6]&&+n[6],s=!!n[7],c=n[8]&&+n[8].slice(1),f=n[9]||"";"n"===f?(s=!0,f="g"):p[f]||(f=""),(a||"0"===r&&"="===e)&&(a=!0,r="0",e="="),this.fill=r,this.align=e,this.sign=i,this.symbol=o,this.zero=a,this.width=u,this.comma=s,this.precision=c,this.type=f}function c(t){return t}function f(t){function n(t){function n(t){var n,a,u,c=M,p=x;if("c"===g)p=v(t)+p,t="";else{t=+t;var w=(t<0||1/t<0)&&(t*=-1,!0);if(t=v(t,m),w)for(n=-1,a=t.length,w=!1;++n<a;)if(u=t.charCodeAt(n),48<u&&u<58||"x"===g&&96<u&&u<103||"X"===g&&64<u&&u<71){w=!0;break}if(c=(w?"("===i?i:"-":"-"===i||"("===i?"":i)+c,p=p+("s"===g?y[8+d/3]:"")+(w&&"("===i?")":""),b)for(n=-1,a=t.length;++n<a;)if(u=t.charCodeAt(n),48>u||u>57){p=(46===u?s+t.slice(n+1):t.slice(n))+p,t=t.slice(0,n);break}}l&&!f&&(t=o(t,1/0));var j=c.length+t.length+p.length,P=j<h?new Array(h-j+1).join(r):"";switch(l&&f&&(t=o(P+t,P.length?h-p.length:1/0),P=""),e){case"<":return c+t+p+P;case"=":return c+P+t+p;case"^":return P.slice(0,j=P.length>>1)+c+t+p+P.slice(j)}return P+c+t+p}t=u(t);var r=t.fill,e=t.align,i=t.sign,c=t.symbol,f=t.zero,h=t.width,l=t.comma,m=t.precision,g=t.type,M="$"===c?a[0]:"#"===c&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",x="$"===c?a[1]:/[%p]/.test(g)?"%":"",v=p[g],b=!g||/[defgprs%]/.test(g);return m=null==m?g?6:12:/[gprs]/.test(g)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),n.toString=function(){return t+""},n}function i(t,e){var i=n((t=u(t),t.type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor(r(e)/3))),a=Math.pow(10,-o),s=y[8+o/3];return function(t){return i(a*t)+s}}var o=t.grouping&&t.thousands?e(t.grouping,t.thousands):c,a=t.currency,s=t.decimal;return{format:n,formatPrefix:i}}function h(n){return x=f(n),t.format=x.format,t.formatPrefix=x.formatPrefix,x}function l(t){return Math.max(0,-r(Math.abs(t)))}function m(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(r(n)/3)))-r(Math.abs(t)))}function g(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,r(n)-r(t))+1}var d,p={"":i,"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return a(100*t,n)},r:a,s:o,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},M=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;s.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var x,y=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];h({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),t.formatDefaultLocale=h,t.formatLocale=f,t.formatSpecifier=u,t.precisionFixed=l,t.precisionPrefix=m,t.precisionRound=g,Object.defineProperty(t,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/d3-interpolate.v1.min.js b/www/js/contrib/d3-interpolate.v1.min.js
new file mode 100644
index 00000000..6afd41dd
--- /dev/null
+++ b/www/js/contrib/d3-interpolate.v1.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-interpolate/ Version 1.1.3. Copyright 2017 Mike Bostock.
+!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-color"],n):n(t.d3=t.d3||{},t.d3)}(this,function(t,n){"use strict";function r(t,n,r,e,o){var a=t*t,u=a*t;return((1-3*t+3*a-u)*n+(4-6*a+3*u)*r+(1+3*t+3*a-3*u)*e+u*o)/6}function e(t,n){return function(r){return t+r*n}}function o(t,n,r){return t=Math.pow(t,r),n=Math.pow(n,r)-t,r=1/r,function(e){return Math.pow(t+e*n,r)}}function a(t,n){var r=n-t;return r?e(t,r>180||r<-180?r-360*Math.round(r/360):r):Y(isNaN(t)?n:t)}function u(t){return 1===(t=+t)?i:function(n,r){return r-n?o(n,r,t):Y(isNaN(n)?r:n)}}function i(t,n){var r=n-t;return r?e(t,r):Y(isNaN(t)?n:t)}function l(t){return function(r){var e,o,a=r.length,u=new Array(a),i=new Array(a),l=new Array(a);for(e=0;e<a;++e)o=n.rgb(r[e]),u[e]=o.r||0,i[e]=o.g||0,l[e]=o.b||0;return u=t(u),i=t(i),l=t(l),o.opacity=1,function(t){return o.r=u(t),o.g=i(t),o.b=l(t),o+""}}}function c(t){return function(){return t}}function f(t){return function(n){return t(n)+""}}function s(t){return"none"===t?P:(M||(M=document.createElement("DIV"),w=document.documentElement,X=document.defaultView),M.style.transform=t,t=X.getComputedStyle(w.appendChild(M),null).getPropertyValue("transform"),w.removeChild(M),t=t.slice(7,-1).split(","),O(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}function p(t){return null==t?P:(A||(A=document.createElementNS("http://www.w3.org/2000/svg","g")),A.setAttribute("transform",t),(t=A.transform.baseVal.consolidate())?(t=t.matrix,O(t.a,t.b,t.c,t.d,t.e,t.f)):P)}function h(t,n,r,e){function o(t){return t.length?t.pop()+" ":""}function a(t,e,o,a,u,i){if(t!==o||e!==a){var l=u.push("translate(",null,n,null,r);i.push({i:l-4,x:I(t,o)},{i:l-2,x:I(e,a)})}else(o||a)&&u.push("translate("+o+n+a+r)}function u(t,n,r,a){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),a.push({i:r.push(o(r)+"rotate(",null,e)-2,x:I(t,n)})):n&&r.push(o(r)+"rotate("+n+e)}function i(t,n,r,a){t!==n?a.push({i:r.push(o(r)+"skewX(",null,e)-2,x:I(t,n)}):n&&r.push(o(r)+"skewX("+n+e)}function l(t,n,r,e,a,u){if(t!==r||n!==e){var i=a.push(o(a)+"scale(",null,",",null,")");u.push({i:i-4,x:I(t,r)},{i:i-2,x:I(n,e)})}else 1===r&&1===e||a.push(o(a)+"scale("+r+","+e+")")}return function(n,r){var e=[],o=[];return n=t(n),r=t(r),a(n.translateX,n.translateY,r.translateX,r.translateY,e,o),u(n.rotate,r.rotate,e,o),i(n.skewX,r.skewX,e,o),l(n.scaleX,n.scaleY,r.scaleX,r.scaleY,e,o),n=r=null,function(t){for(var n,r=-1,a=o.length;++r<a;)e[(n=o[r]).i]=n.x(t);return e.join("")}}}function d(t){return((t=Math.exp(t))+1/t)/2}function g(t){return((t=Math.exp(t))-1/t)/2}function y(t){return((t=Math.exp(2*t))-1)/(t+1)}function v(t){return function(r,e){var o=t((r=n.hsl(r)).h,(e=n.hsl(e)).h),a=i(r.s,e.s),u=i(r.l,e.l),l=i(r.opacity,e.opacity);return function(t){return r.h=o(t),r.s=a(t),r.l=u(t),r.opacity=l(t),r+""}}}function b(t,r){var e=i((t=n.lab(t)).l,(r=n.lab(r)).l),o=i(t.a,r.a),a=i(t.b,r.b),u=i(t.opacity,r.opacity);return function(n){return t.l=e(n),t.a=o(n),t.b=a(n),t.opacity=u(n),t+""}}function x(t){return function(r,e){var o=t((r=n.hcl(r)).h,(e=n.hcl(e)).h),a=i(r.c,e.c),u=i(r.l,e.l),l=i(r.opacity,e.opacity);return function(t){return r.h=o(t),r.c=a(t),r.l=u(t),r.opacity=l(t),r+""}}}function m(t){return function r(e){function o(r,o){var a=t((r=n.cubehelix(r)).h,(o=n.cubehelix(o)).h),u=i(r.s,o.s),l=i(r.l,o.l),c=i(r.opacity,o.opacity);return function(t){return r.h=a(t),r.s=u(t),r.l=l(Math.pow(t,e)),r.opacity=c(t),r+""}}return e=+e,o.gamma=r,o}(1)}var M,w,X,A,N=function(t){var n=t.length-1;return function(e){var o=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),a=t[o],u=t[o+1],i=o>0?t[o-1]:2*a-u,l=o<n-1?t[o+2]:2*u-a;return r((e-o/n)*n,i,a,u,l)}},C=function(t){var n=t.length;return function(e){var o=Math.floor(((e%=1)<0?++e:e)*n),a=t[(o+n-1)%n],u=t[o%n],i=t[(o+1)%n],l=t[(o+2)%n];return r((e-o/n)*n,a,u,i,l)}},Y=function(t){return function(){return t}},j=function t(r){function e(t,r){var e=o((t=n.rgb(t)).r,(r=n.rgb(r)).r),a=o(t.g,r.g),u=o(t.b,r.b),l=i(t.opacity,r.opacity);return function(n){return t.r=e(n),t.g=a(n),t.b=u(n),t.opacity=l(n),t+""}}var o=u(r);return e.gamma=t,e}(1),q=l(N),k=l(C),R=function(t,n){var r,e=n?n.length:0,o=t?Math.min(e,t.length):0,a=new Array(e),u=new Array(e);for(r=0;r<o;++r)a[r]=L(t[r],n[r]);for(;r<e;++r)u[r]=n[r];return function(t){for(r=0;r<o;++r)u[r]=a[r](t);return u}},E=function(t,n){var r=new Date;return t=+t,n-=t,function(e){return r.setTime(t+n*e),r}},I=function(t,n){return t=+t,n-=t,function(r){return t+n*r}},S=function(t,n){var r,e={},o={};null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={});for(r in n)r in t?e[r]=L(t[r],n[r]):o[r]=n[r];return function(t){for(r in e)o[r]=e[r](t);return o}},B=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,D=new RegExp(B.source,"g"),H=function(t,n){var r,e,o,a=B.lastIndex=D.lastIndex=0,u=-1,i=[],l=[];for(t+="",n+="";(r=B.exec(t))&&(e=D.exec(n));)(o=e.index)>a&&(o=n.slice(a,o),i[u]?i[u]+=o:i[++u]=o),(r=r[0])===(e=e[0])?i[u]?i[u]+=e:i[++u]=e:(i[++u]=null,l.push({i:u,x:I(r,e)})),a=D.lastIndex;return a<n.length&&(o=n.slice(a),i[u]?i[u]+=o:i[++u]=o),i.length<2?l[0]?f(l[0].x):c(n):(n=l.length,function(t){for(var r,e=0;e<n;++e)i[(r=l[e]).i]=r.x(t);return i.join("")})},L=function(t,r){var e,o=typeof r;return null==r||"boolean"===o?Y(r):("number"===o?I:"string"===o?(e=n.color(r))?(r=e,j):H:r instanceof n.color?j:r instanceof Date?E:Array.isArray(r)?R:isNaN(r)?S:I)(t,r)},T=function(t,n){return t=+t,n-=t,function(r){return Math.round(t+n*r)}},V=180/Math.PI,P={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},O=function(t,n,r,e,o,a){var u,i,l;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(l=t*r+n*e)&&(r-=t*l,e-=n*l),(i=Math.sqrt(r*r+e*e))&&(r/=i,e/=i,l/=i),t*e<n*r&&(t=-t,n=-n,l=-l,u=-u),{translateX:o,translateY:a,rotate:Math.atan2(n,t)*V,skewX:Math.atan(l)*V,scaleX:u,scaleY:i}},_=h(s,"px, ","px)","deg)"),z=h(p,", ",")",")"),Q=Math.SQRT2,Z=2,F=4,G=1e-12,J=function(t,n){var r,e,o=t[0],a=t[1],u=t[2],i=n[0],l=n[1],c=n[2],f=i-o,s=l-a,p=f*f+s*s;if(p<G)e=Math.log(c/u)/Q,r=function(t){return[o+t*f,a+t*s,u*Math.exp(Q*t*e)]};else{var h=Math.sqrt(p),v=(c*c-u*u+F*p)/(2*u*Z*h),b=(c*c-u*u-F*p)/(2*c*Z*h),x=Math.log(Math.sqrt(v*v+1)-v),m=Math.log(Math.sqrt(b*b+1)-b);e=(m-x)/Q,r=function(t){var n=t*e,r=d(x),i=u/(Z*h)*(r*y(Q*n+x)-g(x));return[o+i*f,a+i*s,u*r/d(Q*n+x)]}}return r.duration=1e3*e,r},K=v(a),U=v(i),W=x(a),$=x(i),tt=m(a),nt=m(i),rt=function(t,n){for(var r=new Array(n),e=0;e<n;++e)r[e]=t(e/(n-1));return r};t.interpolate=L,t.interpolateArray=R,t.interpolateBasis=N,t.interpolateBasisClosed=C,t.interpolateDate=E,t.interpolateNumber=I,t.interpolateObject=S,t.interpolateRound=T,t.interpolateString=H,t.interpolateTransformCss=_,t.interpolateTransformSvg=z,t.interpolateZoom=J,t.interpolateRgb=j,t.interpolateRgbBasis=q,t.interpolateRgbBasisClosed=k,t.interpolateHsl=K,t.interpolateHslLong=U,t.interpolateLab=b,t.interpolateHcl=W,t.interpolateHclLong=$,t.interpolateCubehelix=tt,t.interpolateCubehelixLong=nt,t.quantize=rt,Object.defineProperty(t,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/d3-scale.js b/www/js/contrib/d3-scale.js
new file mode 100644
index 00000000..4f41d0a1
--- /dev/null
+++ b/www/js/contrib/d3-scale.js
@@ -0,0 +1,903 @@
+// https://d3js.org/d3-scale/ Version 1.0.4. Copyright 2016 Mike Bostock.
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format'), require('d3-color')) :
+ typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-collection', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format', 'd3-color'], factory) :
+ (factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3,global.d3));
+}(this, (function (exports,d3Array,d3Collection,d3Interpolate,d3Format,d3Time,d3TimeFormat,d3Color) { 'use strict';
+
+var array = Array.prototype;
+
+var map$1 = array.map;
+var slice = array.slice;
+
+var implicit = {name: "implicit"};
+
+function ordinal(range$$1) {
+ var index = d3Collection.map(),
+ domain = [],
+ unknown = implicit;
+
+ range$$1 = range$$1 == null ? [] : slice.call(range$$1);
+
+ function scale(d) {
+ var key = d + "", i = index.get(key);
+ if (!i) {
+ if (unknown !== implicit) return unknown;
+ index.set(key, i = domain.push(d));
+ }
+ return range$$1[(i - 1) % range$$1.length];
+ }
+
+ scale.domain = function(_) {
+ if (!arguments.length) return domain.slice();
+ domain = [], index = d3Collection.map();
+ var i = -1, n = _.length, d, key;
+ while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d));
+ return scale;
+ };
+
+ scale.range = function(_) {
+ return arguments.length ? (range$$1 = slice.call(_), scale) : range$$1.slice();
+ };
+
+ scale.unknown = function(_) {
+ return arguments.length ? (unknown = _, scale) : unknown;
+ };
+
+ scale.copy = function() {
+ return ordinal()
+ .domain(domain)
+ .range(range$$1)
+ .unknown(unknown);
+ };
+
+ return scale;
+}
+
+function band() {
+ var scale = ordinal().unknown(undefined),
+ domain = scale.domain,
+ ordinalRange = scale.range,
+ range$$1 = [0, 1],
+ step,
+ bandwidth,
+ round = false,
+ paddingInner = 0,
+ paddingOuter = 0,
+ align = 0.5;
+
+ delete scale.unknown;
+
+ function rescale() {
+ var n = domain().length,
+ reverse = range$$1[1] < range$$1[0],
+ start = range$$1[reverse - 0],
+ stop = range$$1[1 - reverse];
+ step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
+ if (round) step = Math.floor(step);
+ start += (stop - start - step * (n - paddingInner)) * align;
+ bandwidth = step * (1 - paddingInner);
+ if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
+ var values = d3Array.range(n).map(function(i) { return start + step * i; });
+ return ordinalRange(reverse ? values.reverse() : values);
+ }
+
+ scale.domain = function(_) {
+ return arguments.length ? (domain(_), rescale()) : domain();
+ };
+
+ scale.range = function(_) {
+ return arguments.length ? (range$$1 = [+_[0], +_[1]], rescale()) : range$$1.slice();
+ };
+
+ scale.rangeRound = function(_) {
+ return range$$1 = [+_[0], +_[1]], round = true, rescale();
+ };
+
+ scale.bandwidth = function() {
+ return bandwidth;
+ };
+
+ scale.step = function() {
+ return step;
+ };
+
+ scale.round = function(_) {
+ return arguments.length ? (round = !!_, rescale()) : round;
+ };
+
+ scale.padding = function(_) {
+ return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
+ };
+
+ scale.paddingInner = function(_) {
+ return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
+ };
+
+ scale.paddingOuter = function(_) {
+ return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;
+ };
+
+ scale.align = function(_) {
+ return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
+ };
+
+ scale.copy = function() {
+ return band()
+ .domain(domain())
+ .range(range$$1)
+ .round(round)
+ .paddingInner(paddingInner)
+ .paddingOuter(paddingOuter)
+ .align(align);
+ };
+
+ return rescale();
+}
+
+function pointish(scale) {
+ var copy = scale.copy;
+
+ scale.padding = scale.paddingOuter;
+ delete scale.paddingInner;
+ delete scale.paddingOuter;
+
+ scale.copy = function() {
+ return pointish(copy());
+ };
+
+ return scale;
+}
+
+function point() {
+ return pointish(band().paddingInner(1));
+}
+
+var constant = function(x) {
+ return function() {
+ return x;
+ };
+};
+
+var number = function(x) {
+ return +x;
+};
+
+var unit = [0, 1];
+
+function deinterpolateLinear(a, b) {
+ return (b -= (a = +a))
+ ? function(x) { return (x - a) / b; }
+ : constant(b);
+}
+
+function deinterpolateClamp(deinterpolate) {
+ return function(a, b) {
+ var d = deinterpolate(a = +a, b = +b);
+ return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };
+ };
+}
+
+function reinterpolateClamp(reinterpolate) {
+ return function(a, b) {
+ var r = reinterpolate(a = +a, b = +b);
+ return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };
+ };
+}
+
+function bimap(domain, range$$1, deinterpolate, reinterpolate) {
+ var d0 = domain[0], d1 = domain[1], r0 = range$$1[0], r1 = range$$1[1];
+ if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);
+ else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);
+ return function(x) { return r0(d0(x)); };
+}
+
+function polymap(domain, range$$1, deinterpolate, reinterpolate) {
+ var j = Math.min(domain.length, range$$1.length) - 1,
+ d = new Array(j),
+ r = new Array(j),
+ i = -1;
+
+ // Reverse descending domains.
+ if (domain[j] < domain[0]) {
+ domain = domain.slice().reverse();
+ range$$1 = range$$1.slice().reverse();
+ }
+
+ while (++i < j) {
+ d[i] = deinterpolate(domain[i], domain[i + 1]);
+ r[i] = reinterpolate(range$$1[i], range$$1[i + 1]);
+ }
+
+ return function(x) {
+ var i = d3Array.bisect(domain, x, 1, j) - 1;
+ return r[i](d[i](x));
+ };
+}
+
+function copy(source, target) {
+ return target
+ .domain(source.domain())
+ .range(source.range())
+ .interpolate(source.interpolate())
+ .clamp(source.clamp());
+}
+
+// deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
+// reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].
+function continuous(deinterpolate, reinterpolate) {
+ var domain = unit,
+ range$$1 = unit,
+ interpolate$$1 = d3Interpolate.interpolate,
+ clamp = false,
+ piecewise,
+ output,
+ input;
+
+ function rescale() {
+ piecewise = Math.min(domain.length, range$$1.length) > 2 ? polymap : bimap;
+ output = input = null;
+ return scale;
+ }
+
+ function scale(x) {
+ return (output || (output = piecewise(domain, range$$1, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x);
+ }
+
+ scale.invert = function(y) {
+ return (input || (input = piecewise(range$$1, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);
+ };
+
+ scale.domain = function(_) {
+ return arguments.length ? (domain = map$1.call(_, number), rescale()) : domain.slice();
+ };
+
+ scale.range = function(_) {
+ return arguments.length ? (range$$1 = slice.call(_), rescale()) : range$$1.slice();
+ };
+
+ scale.rangeRound = function(_) {
+ return range$$1 = slice.call(_), interpolate$$1 = d3Interpolate.interpolateRound, rescale();
+ };
+
+ scale.clamp = function(_) {
+ return arguments.length ? (clamp = !!_, rescale()) : clamp;
+ };
+
+ scale.interpolate = function(_) {
+ return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1;
+ };
+
+ return rescale();
+}
+
+var tickFormat = function(domain, count, specifier) {
+ var start = domain[0],
+ stop = domain[domain.length - 1],
+ step = d3Array.tickStep(start, stop, count == null ? 10 : count),
+ precision;
+ specifier = d3Format.formatSpecifier(specifier == null ? ",f" : specifier);
+ switch (specifier.type) {
+ case "s": {
+ var value = Math.max(Math.abs(start), Math.abs(stop));
+ if (specifier.precision == null && !isNaN(precision = d3Format.precisionPrefix(step, value))) specifier.precision = precision;
+ return d3Format.formatPrefix(specifier, value);
+ }
+ case "":
+ case "e":
+ case "g":
+ case "p":
+ case "r": {
+ if (specifier.precision == null && !isNaN(precision = d3Format.precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
+ break;
+ }
+ case "f":
+ case "%": {
+ if (specifier.precision == null && !isNaN(precision = d3Format.precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
+ break;
+ }
+ }
+ return d3Format.format(specifier);
+};
+
+function linearish(scale) {
+ var domain = scale.domain;
+
+ scale.ticks = function(count) {
+ var d = domain();
+ return d3Array.ticks(d[0], d[d.length - 1], count == null ? 10 : count);
+ };
+
+ scale.tickFormat = function(count, specifier) {
+ return tickFormat(domain(), count, specifier);
+ };
+
+ scale.nice = function(count) {
+ var d = domain(),
+ i = d.length - 1,
+ n = count == null ? 10 : count,
+ start = d[0],
+ stop = d[i],
+ step = d3Array.tickStep(start, stop, n);
+
+ if (step) {
+ step = d3Array.tickStep(Math.floor(start / step) * step, Math.ceil(stop / step) * step, n);
+ d[0] = Math.floor(start / step) * step;
+ d[i] = Math.ceil(stop / step) * step;
+ domain(d);
+ }
+
+ return scale;
+ };
+
+ return scale;
+}
+
+function linear() {
+ var scale = continuous(deinterpolateLinear, d3Interpolate.interpolateNumber);
+
+ scale.copy = function() {
+ return copy(scale, linear());
+ };
+
+ return linearish(scale);
+}
+
+function identity() {
+ var domain = [0, 1];
+
+ function scale(x) {
+ return +x;
+ }
+
+ scale.invert = scale;
+
+ scale.domain = scale.range = function(_) {
+ return arguments.length ? (domain = map$1.call(_, number), scale) : domain.slice();
+ };
+
+ scale.copy = function() {
+ return identity().domain(domain);
+ };
+
+ return linearish(scale);
+}
+
+var nice = function(domain, interval) {
+ domain = domain.slice();
+
+ var i0 = 0,
+ i1 = domain.length - 1,
+ x0 = domain[i0],
+ x1 = domain[i1],
+ t;
+
+ if (x1 < x0) {
+ t = i0, i0 = i1, i1 = t;
+ t = x0, x0 = x1, x1 = t;
+ }
+
+ domain[i0] = interval.floor(x0);
+ domain[i1] = interval.ceil(x1);
+ return domain;
+};
+
+function deinterpolate(a, b) {
+ return (b = Math.log(b / a))
+ ? function(x) { return Math.log(x / a) / b; }
+ : constant(b);
+}
+
+function reinterpolate(a, b) {
+ return a < 0
+ ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }
+ : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };
+}
+
+function pow10(x) {
+ return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
+}
+
+function powp(base) {
+ return base === 10 ? pow10
+ : base === Math.E ? Math.exp
+ : function(x) { return Math.pow(base, x); };
+}
+
+function logp(base) {
+ return base === Math.E ? Math.log
+ : base === 10 && Math.log10
+ || base === 2 && Math.log2
+ || (base = Math.log(base), function(x) { return Math.log(x) / base; });
+}
+
+function reflect(f) {
+ return function(x) {
+ return -f(-x);
+ };
+}
+
+function log() {
+ var scale = continuous(deinterpolate, reinterpolate).domain([1, 10]),
+ domain = scale.domain,
+ base = 10,
+ logs = logp(10),
+ pows = powp(10);
+
+ function rescale() {
+ logs = logp(base), pows = powp(base);
+ if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows);
+ return scale;
+ }
+
+ scale.base = function(_) {
+ return arguments.length ? (base = +_, rescale()) : base;
+ };
+
+ scale.domain = function(_) {
+ return arguments.length ? (domain(_), rescale()) : domain();
+ };
+
+ scale.ticks = function(count) {
+ var d = domain(),
+ u = d[0],
+ v = d[d.length - 1],
+ r;
+
+ if (r = v < u) i = u, u = v, v = i;
+
+ var i = logs(u),
+ j = logs(v),
+ p,
+ k,
+ t,
+ n = count == null ? 10 : +count,
+ z = [];
+
+ if (!(base % 1) && j - i < n) {
+ i = Math.round(i) - 1, j = Math.round(j) + 1;
+ if (u > 0) for (; i < j; ++i) {
+ for (k = 1, p = pows(i); k < base; ++k) {
+ t = p * k;
+ if (t < u) continue;
+ if (t > v) break;
+ z.push(t);
+ }
+ } else for (; i < j; ++i) {
+ for (k = base - 1, p = pows(i); k >= 1; --k) {
+ t = p * k;
+ if (t < u) continue;
+ if (t > v) break;
+ z.push(t);
+ }
+ }
+ } else {
+ z = d3Array.ticks(i, j, Math.min(j - i, n)).map(pows);
+ }
+
+ return r ? z.reverse() : z;
+ };
+
+ scale.tickFormat = function(count, specifier) {
+ if (specifier == null) specifier = base === 10 ? ".0e" : ",";
+ if (typeof specifier !== "function") specifier = d3Format.format(specifier);
+ if (count === Infinity) return specifier;
+ if (count == null) count = 10;
+ var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
+ return function(d) {
+ var i = d / pows(Math.round(logs(d)));
+ if (i * base < base - 0.5) i *= base;
+ return i <= k ? specifier(d) : "";
+ };
+ };
+
+ scale.nice = function() {
+ return domain(nice(domain(), {
+ floor: function(x) { return pows(Math.floor(logs(x))); },
+ ceil: function(x) { return pows(Math.ceil(logs(x))); }
+ }));
+ };
+
+ scale.copy = function() {
+ return copy(scale, log().base(base));
+ };
+
+ return scale;
+}
+
+function raise(x, exponent) {
+ return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
+}
+
+function pow() {
+ var exponent = 1,
+ scale = continuous(deinterpolate, reinterpolate),
+ domain = scale.domain;
+
+ function deinterpolate(a, b) {
+ return (b = raise(b, exponent) - (a = raise(a, exponent)))
+ ? function(x) { return (raise(x, exponent) - a) / b; }
+ : constant(b);
+ }
+
+ function reinterpolate(a, b) {
+ b = raise(b, exponent) - (a = raise(a, exponent));
+ return function(t) { return raise(a + b * t, 1 / exponent); };
+ }
+
+ scale.exponent = function(_) {
+ return arguments.length ? (exponent = +_, domain(domain())) : exponent;
+ };
+
+ scale.copy = function() {
+ return copy(scale, pow().exponent(exponent));
+ };
+
+ return linearish(scale);
+}
+
+function sqrt() {
+ return pow().exponent(0.5);
+}
+
+function quantile$1() {
+ var domain = [],
+ range$$1 = [],
+ thresholds = [];
+
+ function rescale() {
+ var i = 0, n = Math.max(1, range$$1.length);
+ thresholds = new Array(n - 1);
+ while (++i < n) thresholds[i - 1] = d3Array.quantile(domain, i / n);
+ return scale;
+ }
+
+ function scale(x) {
+ if (!isNaN(x = +x)) return range$$1[d3Array.bisect(thresholds, x)];
+ }
+
+ scale.invertExtent = function(y) {
+ var i = range$$1.indexOf(y);
+ return i < 0 ? [NaN, NaN] : [
+ i > 0 ? thresholds[i - 1] : domain[0],
+ i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
+ ];
+ };
+
+ scale.domain = function(_) {
+ if (!arguments.length) return domain.slice();
+ domain = [];
+ for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
+ domain.sort(d3Array.ascending);
+ return rescale();
+ };
+
+ scale.range = function(_) {
+ return arguments.length ? (range$$1 = slice.call(_), rescale()) : range$$1.slice();
+ };
+
+ scale.quantiles = function() {
+ return thresholds.slice();
+ };
+
+ scale.copy = function() {
+ return quantile$1()
+ .domain(domain)
+ .range(range$$1);
+ };
+
+ return scale;
+}
+
+function quantize() {
+ var x0 = 0,
+ x1 = 1,
+ n = 1,
+ domain = [0.5],
+ range$$1 = [0, 1];
+
+ function scale(x) {
+ if (x <= x) return range$$1[d3Array.bisect(domain, x, 0, n)];
+ }
+
+ function rescale() {
+ var i = -1;
+ domain = new Array(n);
+ while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
+ return scale;
+ }
+
+ scale.domain = function(_) {
+ return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];
+ };
+
+ scale.range = function(_) {
+ return arguments.length ? (n = (range$$1 = slice.call(_)).length - 1, rescale()) : range$$1.slice();
+ };
+
+ scale.invertExtent = function(y) {
+ var i = range$$1.indexOf(y);
+ return i < 0 ? [NaN, NaN]
+ : i < 1 ? [x0, domain[0]]
+ : i >= n ? [domain[n - 1], x1]
+ : [domain[i - 1], domain[i]];
+ };
+
+ scale.copy = function() {
+ return quantize()
+ .domain([x0, x1])
+ .range(range$$1);
+ };
+
+ return linearish(scale);
+}
+
+function threshold() {
+ var domain = [0.5],
+ range$$1 = [0, 1],
+ n = 1;
+
+ function scale(x) {
+ if (x <= x) return range$$1[d3Array.bisect(domain, x, 0, n)];
+ }
+
+ scale.domain = function(_) {
+ return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : domain.slice();
+ };
+
+ scale.range = function(_) {
+ return arguments.length ? (range$$1 = slice.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : range$$1.slice();
+ };
+
+ scale.invertExtent = function(y) {
+ var i = range$$1.indexOf(y);
+ return [domain[i - 1], domain[i]];
+ };
+
+ scale.copy = function() {
+ return threshold()
+ .domain(domain)
+ .range(range$$1);
+ };
+
+ return scale;
+}
+
+var durationSecond = 1000;
+var durationMinute = durationSecond * 60;
+var durationHour = durationMinute * 60;
+var durationDay = durationHour * 24;
+var durationWeek = durationDay * 7;
+var durationMonth = durationDay * 30;
+var durationYear = durationDay * 365;
+
+function date(t) {
+ return new Date(t);
+}
+
+function number$1(t) {
+ return t instanceof Date ? +t : +new Date(+t);
+}
+
+function calendar(year, month, week, day, hour, minute, second, millisecond, format$$1) {
+ var scale = continuous(deinterpolateLinear, d3Interpolate.interpolateNumber),
+ invert = scale.invert,
+ domain = scale.domain;
+
+ var formatMillisecond = format$$1(".%L"),
+ formatSecond = format$$1(":%S"),
+ formatMinute = format$$1("%I:%M"),
+ formatHour = format$$1("%I %p"),
+ formatDay = format$$1("%a %d"),
+ formatWeek = format$$1("%b %d"),
+ formatMonth = format$$1("%B"),
+ formatYear = format$$1("%Y");
+
+ var tickIntervals = [
+ [second, 1, durationSecond],
+ [second, 5, 5 * durationSecond],
+ [second, 15, 15 * durationSecond],
+ [second, 30, 30 * durationSecond],
+ [minute, 1, durationMinute],
+ [minute, 5, 5 * durationMinute],
+ [minute, 15, 15 * durationMinute],
+ [minute, 30, 30 * durationMinute],
+ [ hour, 1, durationHour ],
+ [ hour, 3, 3 * durationHour ],
+ [ hour, 6, 6 * durationHour ],
+ [ hour, 12, 12 * durationHour ],
+ [ day, 1, durationDay ],
+ [ day, 2, 2 * durationDay ],
+ [ week, 1, durationWeek ],
+ [ month, 1, durationMonth ],
+ [ month, 3, 3 * durationMonth ],
+ [ year, 1, durationYear ]
+ ];
+
+ function tickFormat(date) {
+ return (second(date) < date ? formatMillisecond
+ : minute(date) < date ? formatSecond
+ : hour(date) < date ? formatMinute
+ : day(date) < date ? formatHour
+ : month(date) < date ? (week(date) < date ? formatDay : formatWeek)
+ : year(date) < date ? formatMonth
+ : formatYear)(date);
+ }
+
+ function tickInterval(interval, start, stop, step) {
+ if (interval == null) interval = 10;
+
+ // If a desired tick count is specified, pick a reasonable tick interval
+ // based on the extent of the domain and a rough estimate of tick size.
+ // Otherwise, assume interval is already a time interval and use it.
+ if (typeof interval === "number") {
+ var target = Math.abs(stop - start) / interval,
+ i = d3Array.bisector(function(i) { return i[2]; }).right(tickIntervals, target);
+ if (i === tickIntervals.length) {
+ step = d3Array.tickStep(start / durationYear, stop / durationYear, interval);
+ interval = year;
+ } else if (i) {
+ i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
+ step = i[1];
+ interval = i[0];
+ } else {
+ step = d3Array.tickStep(start, stop, interval);
+ interval = millisecond;
+ }
+ }
+
+ return step == null ? interval : interval.every(step);
+ }
+
+ scale.invert = function(y) {
+ return new Date(invert(y));
+ };
+
+ scale.domain = function(_) {
+ return arguments.length ? domain(map$1.call(_, number$1)) : domain().map(date);
+ };
+
+ scale.ticks = function(interval, step) {
+ var d = domain(),
+ t0 = d[0],
+ t1 = d[d.length - 1],
+ r = t1 < t0,
+ t;
+ if (r) t = t0, t0 = t1, t1 = t;
+ t = tickInterval(interval, t0, t1, step);
+ t = t ? t.range(t0, t1 + 1) : []; // inclusive stop
+ return r ? t.reverse() : t;
+ };
+
+ scale.tickFormat = function(count, specifier) {
+ return specifier == null ? tickFormat : format$$1(specifier);
+ };
+
+ scale.nice = function(interval, step) {
+ var d = domain();
+ return (interval = tickInterval(interval, d[0], d[d.length - 1], step))
+ ? domain(nice(d, interval))
+ : scale;
+ };
+
+ scale.copy = function() {
+ return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format$$1));
+ };
+
+ return scale;
+}
+
+var time = function() {
+ return calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);
+};
+
+var utcTime = function() {
+ return calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);
+};
+
+var colors = function(s) {
+ return s.match(/.{6}/g).map(function(x) {
+ return "#" + x;
+ });
+};
+
+var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
+
+var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6");
+
+var category20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9");
+
+var category20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5");
+
+var cubehelix$1 = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(300, 0.5, 0.0), d3Color.cubehelix(-240, 0.5, 1.0));
+
+var warm = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(-100, 0.75, 0.35), d3Color.cubehelix(80, 1.50, 0.8));
+
+var cool = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(260, 0.75, 0.35), d3Color.cubehelix(80, 1.50, 0.8));
+
+var rainbow = d3Color.cubehelix();
+
+var rainbow$1 = function(t) {
+ if (t < 0 || t > 1) t -= Math.floor(t);
+ var ts = Math.abs(t - 0.5);
+ rainbow.h = 360 * t - 100;
+ rainbow.s = 1.5 - 1.5 * ts;
+ rainbow.l = 0.8 - 0.9 * ts;
+ return rainbow + "";
+};
+
+function ramp(range$$1) {
+ var n = range$$1.length;
+ return function(t) {
+ return range$$1[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
+ };
+}
+
+var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
+
+var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
+
+var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
+
+var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
+
+function sequential(interpolator) {
+ var x0 = 0,
+ x1 = 1,
+ clamp = false;
+
+ function scale(x) {
+ var t = (x - x0) / (x1 - x0);
+ return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
+ }
+
+ scale.domain = function(_) {
+ return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1];
+ };
+
+ scale.clamp = function(_) {
+ return arguments.length ? (clamp = !!_, scale) : clamp;
+ };
+
+ scale.interpolator = function(_) {
+ return arguments.length ? (interpolator = _, scale) : interpolator;
+ };
+
+ scale.copy = function() {
+ return sequential(interpolator).domain([x0, x1]).clamp(clamp);
+ };
+
+ return linearish(scale);
+}
+
+exports.scaleBand = band;
+exports.scalePoint = point;
+exports.scaleIdentity = identity;
+exports.scaleLinear = linear;
+exports.scaleLog = log;
+exports.scaleOrdinal = ordinal;
+exports.scaleImplicit = implicit;
+exports.scalePow = pow;
+exports.scaleSqrt = sqrt;
+exports.scaleQuantile = quantile$1;
+exports.scaleQuantize = quantize;
+exports.scaleThreshold = threshold;
+exports.scaleTime = time;
+exports.scaleUtc = utcTime;
+exports.schemeCategory10 = category10;
+exports.schemeCategory20b = category20b;
+exports.schemeCategory20c = category20c;
+exports.schemeCategory20 = category20;
+exports.interpolateCubehelixDefault = cubehelix$1;
+exports.interpolateRainbow = rainbow$1;
+exports.interpolateWarm = warm;
+exports.interpolateCool = cool;
+exports.interpolateViridis = viridis;
+exports.interpolateMagma = magma;
+exports.interpolateInferno = inferno;
+exports.interpolatePlasma = plasma;
+exports.scaleSequential = sequential;
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/www/js/contrib/d3-scale.min.js b/www/js/contrib/d3-scale.min.js
new file mode 100644
index 00000000..ab8b5c01
--- /dev/null
+++ b/www/js/contrib/d3-scale.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-scale/ Version 1.0.4. Copyright 2016 Mike Bostock.
+!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array"),require("d3-collection"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format"),require("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-interpolate","d3-format","d3-time","d3-time-format","d3-color"],n):n(e.d3=e.d3||{},e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3)}(this,function(e,n,a,f,c,t,r,d){"use strict";function i(e){function n(n){var a=n+"",r=f.get(a);if(!r){if(t!==H)return t;f.set(a,r=c.push(n))}return e[(r-1)%e.length]}var f=a.map(),c=[],t=H;return e=null==e?[]:B.call(e),n.domain=function(e){if(!arguments.length)return c.slice();c=[],f=a.map();for(var t,r,d=-1,i=e.length;++d<i;)f.has(r=(t=e[d])+"")||f.set(r,c.push(t));return n},n.range=function(a){return arguments.length?(e=B.call(a),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return i().domain(c).range(e).unknown(t)},n}function u(){function e(){var e=t().length,c=d[1]<d[0],i=d[c-0],u=d[1-c];a=(u-i)/Math.max(1,e-o+2*l),b&&(a=Math.floor(a)),i+=(u-i-a*(e-o))*h,f=a*(1-o),b&&(i=Math.round(i),f=Math.round(f));var s=n.range(e).map(function(e){return i+a*e});return r(c?s.reverse():s)}var a,f,c=i().unknown(void 0),t=c.domain,r=c.range,d=[0,1],b=!1,o=0,l=0,h=.5;return delete c.unknown,c.domain=function(n){return arguments.length?(t(n),e()):t()},c.range=function(n){return arguments.length?(d=[+n[0],+n[1]],e()):d.slice()},c.rangeRound=function(n){return d=[+n[0],+n[1]],b=!0,e()},c.bandwidth=function(){return f},c.step=function(){return a},c.round=function(n){return arguments.length?(b=!!n,e()):b},c.padding=function(n){return arguments.length?(o=l=Math.max(0,Math.min(1,n)),e()):o},c.paddingInner=function(n){return arguments.length?(o=Math.max(0,Math.min(1,n)),e()):o},c.paddingOuter=function(n){return arguments.length?(l=Math.max(0,Math.min(1,n)),e()):l},c.align=function(n){return arguments.length?(h=Math.max(0,Math.min(1,n)),e()):h},c.copy=function(){return u().domain(t()).range(d).round(b).paddingInner(o).paddingOuter(l).align(h)},e()}function b(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return b(n())},e}function o(){return b(u().paddingInner(1))}function l(e,n){return(n-=e=+e)?function(a){return(a-e)/n}:Q(n)}function h(e){return function(n,a){var f=e(n=+n,a=+a);return function(e){return e<=n?0:e>=a?1:f(e)}}}function s(e){return function(n,a){var f=e(n=+n,a=+a);return function(e){return e<=0?n:e>=1?a:f(e)}}}function g(e,n,a,f){var c=e[0],t=e[1],r=n[0],d=n[1];return t<c?(c=a(t,c),r=f(d,r)):(c=a(c,t),r=f(r,d)),function(e){return r(c(e))}}function p(e,a,f,c){var t=Math.min(e.length,a.length)-1,r=new Array(t),d=new Array(t),i=-1;for(e[t]<e[0]&&(e=e.slice().reverse(),a=a.slice().reverse());++i<t;)r[i]=f(e[i],e[i+1]),d[i]=c(a[i],a[i+1]);return function(a){var f=n.bisect(e,a,1,t)-1;return d[f](r[f](a))}}function m(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp())}function M(e,n){function a(){return t=Math.min(i.length,u.length)>2?p:g,r=d=null,c}function c(n){return(r||(r=t(i,u,o?h(e):e,b)))(+n)}var t,r,d,i=z,u=z,b=f.interpolate,o=!1;return c.invert=function(e){return(d||(d=t(u,i,l,o?s(n):n)))(+e)},c.domain=function(e){return arguments.length?(i=j.call(e,_),a()):i.slice()},c.range=function(e){return arguments.length?(u=B.call(e),a()):u.slice()},c.rangeRound=function(e){return u=B.call(e),b=f.interpolateRound,a()},c.clamp=function(e){return arguments.length?(o=!!e,a()):o},c.interpolate=function(e){return arguments.length?(b=e,a()):b},a()}function v(e){var a=e.domain;return e.ticks=function(e){var f=a();return n.ticks(f[0],f[f.length-1],null==e?10:e)},e.tickFormat=function(e,n){return V(a(),e,n)},e.nice=function(f){var c=a(),t=c.length-1,r=null==f?10:f,d=c[0],i=c[t],u=n.tickStep(d,i,r);return u&&(u=n.tickStep(Math.floor(d/u)*u,Math.ceil(i/u)*u,r),c[0]=Math.floor(d/u)*u,c[t]=Math.ceil(i/u)*u,a(c)),e},e}function x(){var e=M(l,f.interpolateNumber);return e.copy=function(){return m(e,x())},v(e)}function y(){function e(e){return+e}var n=[0,1];return e.invert=e,e.domain=e.range=function(a){return arguments.length?(n=j.call(a,_),e):n.slice()},e.copy=function(){return y().domain(n)},v(e)}function w(e,n){return(n=Math.log(n/e))?function(a){return Math.log(a/e)/n}:Q(n)}function k(e,n){return e<0?function(a){return-Math.pow(-n,a)*Math.pow(-e,1-a)}:function(a){return Math.pow(n,a)*Math.pow(e,1-a)}}function N(e){return isFinite(e)?+("1e"+e):e<0?0:e}function q(e){return 10===e?N:e===Math.E?Math.exp:function(n){return Math.pow(e,n)}}function C(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),function(n){return Math.log(n)/e})}function D(e){return function(n){return-e(-n)}}function S(){function e(){return r=C(t),d=q(t),f()[0]<0&&(r=D(r),d=D(d)),a}var a=M(w,k).domain([1,10]),f=a.domain,t=10,r=C(10),d=q(10);return a.base=function(n){return arguments.length?(t=+n,e()):t},a.domain=function(n){return arguments.length?(f(n),e()):f()},a.ticks=function(e){var a,c=f(),i=c[0],u=c[c.length-1];(a=u<i)&&(h=i,i=u,u=h);var b,o,l,h=r(i),s=r(u),g=null==e?10:+e,p=[];if(!(t%1)&&s-h<g){if(h=Math.round(h)-1,s=Math.round(s)+1,i>0){for(;h<s;++h)for(o=1,b=d(h);o<t;++o)if(l=b*o,!(l<i)){if(l>u)break;p.push(l)}}else for(;h<s;++h)for(o=t-1,b=d(h);o>=1;--o)if(l=b*o,!(l<i)){if(l>u)break;p.push(l)}}else p=n.ticks(h,s,Math.min(s-h,g)).map(d);return a?p.reverse():p},a.tickFormat=function(e,n){if(null==n&&(n=10===t?".0e":","),"function"!=typeof n&&(n=c.format(n)),e===1/0)return n;null==e&&(e=10);var f=Math.max(1,t*e/a.ticks().length);return function(e){var a=e/d(Math.round(r(e)));return a*t<t-.5&&(a*=t),a<=f?n(e):""}},a.nice=function(){return f(G(f(),{floor:function(e){return d(Math.floor(r(e)))},ceil:function(e){return d(Math.ceil(r(e)))}}))},a.copy=function(){return m(a,S().base(t))},a}function I(e,n){return e<0?-Math.pow(-e,n):Math.pow(e,n)}function O(){function e(e,n){return(n=I(n,a)-(e=I(e,a)))?function(f){return(I(f,a)-e)/n}:Q(n)}function n(e,n){return n=I(n,a)-(e=I(e,a)),function(f){return I(e+n*f,1/a)}}var a=1,f=M(e,n),c=f.domain;return f.exponent=function(e){return arguments.length?(a=+e,c(c())):a},f.copy=function(){return m(f,O().exponent(a))},v(f)}function F(){return O().exponent(.5)}function L(){function e(){var e=0,r=Math.max(1,c.length);for(t=new Array(r-1);++e<r;)t[e-1]=n.quantile(f,e/r);return a}function a(e){if(!isNaN(e=+e))return c[n.bisect(t,e)]}var f=[],c=[],t=[];return a.invertExtent=function(e){var n=c.indexOf(e);return n<0?[NaN,NaN]:[n>0?t[n-1]:f[0],n<t.length?t[n]:f[f.length-1]]},a.domain=function(a){if(!arguments.length)return f.slice();f=[];for(var c,t=0,r=a.length;t<r;++t)c=a[t],null==c||isNaN(c=+c)||f.push(c);return f.sort(n.ascending),e()},a.range=function(n){return arguments.length?(c=B.call(n),e()):c.slice()},a.quantiles=function(){return t.slice()},a.copy=function(){return L().domain(f).range(c)},a}function P(){function e(e){if(e<=e)return d[n.bisect(r,e,0,t)]}function a(){var n=-1;for(r=new Array(t);++n<t;)r[n]=((n+1)*c-(n-t)*f)/(t+1);return e}var f=0,c=1,t=1,r=[.5],d=[0,1];return e.domain=function(e){return arguments.length?(f=+e[0],c=+e[1],a()):[f,c]},e.range=function(e){return arguments.length?(t=(d=B.call(e)).length-1,a()):d.slice()},e.invertExtent=function(e){var n=d.indexOf(e);return n<0?[NaN,NaN]:n<1?[f,r[0]]:n>=t?[r[t-1],c]:[r[n-1],r[n]]},e.copy=function(){return P().domain([f,c]).range(d)},v(e)}function A(){function e(e){if(e<=e)return f[n.bisect(a,e,0,c)]}var a=[.5],f=[0,1],c=1;return e.domain=function(n){return arguments.length?(a=B.call(n),c=Math.min(a.length,f.length-1),e):a.slice()},e.range=function(n){return arguments.length?(f=B.call(n),c=Math.min(a.length,f.length-1),e):f.slice()},e.invertExtent=function(e){var n=f.indexOf(e);return[a[n-1],a[n]]},e.copy=function(){return A().domain(a).range(f)},e}function E(e){return new Date(e)}function R(e){return e instanceof Date?+e:+new Date(+e)}function T(e,a,c,t,r,d,i,u,b){function o(n){return(i(n)<n?v:d(n)<n?x:r(n)<n?y:t(n)<n?w:a(n)<n?c(n)<n?k:N:e(n)<n?q:C)(n)}function h(a,f,c,t){if(null==a&&(a=10),"number"==typeof a){var r=Math.abs(c-f)/a,d=n.bisector(function(e){return e[2]}).right(D,r);d===D.length?(t=n.tickStep(f/ne,c/ne,a),a=e):d?(d=D[r/D[d-1][2]<D[d][2]/r?d-1:d],t=d[1],a=d[0]):(t=n.tickStep(f,c,a),a=u)}return null==t?a:a.every(t)}var s=M(l,f.interpolateNumber),g=s.invert,p=s.domain,v=b(".%L"),x=b(":%S"),y=b("%I:%M"),w=b("%I %p"),k=b("%a %d"),N=b("%b %d"),q=b("%B"),C=b("%Y"),D=[[i,1,J],[i,5,5*J],[i,15,15*J],[i,30,30*J],[d,1,K],[d,5,5*K],[d,15,15*K],[d,30,30*K],[r,1,X],[r,3,3*X],[r,6,6*X],[r,12,12*X],[t,1,Z],[t,2,2*Z],[c,1,$],[a,1,ee],[a,3,3*ee],[e,1,ne]];return s.invert=function(e){return new Date(g(e))},s.domain=function(e){return arguments.length?p(j.call(e,R)):p().map(E)},s.ticks=function(e,n){var a,f=p(),c=f[0],t=f[f.length-1],r=t<c;return r&&(a=c,c=t,t=a),a=h(e,c,t,n),a=a?a.range(c,t+1):[],r?a.reverse():a},s.tickFormat=function(e,n){return null==n?o:b(n)},s.nice=function(e,n){var a=p();return(e=h(e,a[0],a[a.length-1],n))?p(G(a,e)):s},s.copy=function(){return m(s,T(e,a,c,t,r,d,i,u,b))},s}function U(e){var n=e.length;return function(a){return e[Math.max(0,Math.min(n-1,Math.floor(a*n)))]}}function W(e){function n(n){var t=(n-a)/(f-a);return e(c?Math.max(0,Math.min(1,t)):t)}var a=0,f=1,c=!1;return n.domain=function(e){return arguments.length?(a=+e[0],f=+e[1],n):[a,f]},n.clamp=function(e){return arguments.length?(c=!!e,n):c},n.interpolator=function(a){return arguments.length?(e=a,n):e},n.copy=function(){return W(e).domain([a,f]).clamp(c)},v(n)}var Y=Array.prototype,j=Y.map,B=Y.slice,H={name:"implicit"},Q=function(e){return function(){return e}},_=function(e){return+e},z=[0,1],V=function(e,a,f){var t,r=e[0],d=e[e.length-1],i=n.tickStep(r,d,null==a?10:a);switch(f=c.formatSpecifier(null==f?",f":f),f.type){case"s":var u=Math.max(Math.abs(r),Math.abs(d));return null!=f.precision||isNaN(t=c.precisionPrefix(i,u))||(f.precision=t),c.formatPrefix(f,u);case"":case"e":case"g":case"p":case"r":null!=f.precision||isNaN(t=c.precisionRound(i,Math.max(Math.abs(r),Math.abs(d))))||(f.precision=t-("e"===f.type));break;case"f":case"%":null!=f.precision||isNaN(t=c.precisionFixed(i))||(f.precision=t-2*("%"===f.type))}return c.format(f)},G=function(e,n){e=e.slice();var a,f=0,c=e.length-1,t=e[f],r=e[c];return r<t&&(a=f,f=c,c=a,a=t,t=r,r=a),e[f]=n.floor(t),e[c]=n.ceil(r),e},J=1e3,K=60*J,X=60*K,Z=24*X,$=7*Z,ee=30*Z,ne=365*Z,ae=function(){return T(t.timeYear,t.timeMonth,t.timeWeek,t.timeDay,t.timeHour,t.timeMinute,t.timeSecond,t.timeMillisecond,r.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},fe=function(){return T(t.utcYear,t.utcMonth,t.utcWeek,t.utcDay,t.utcHour,t.utcMinute,t.utcSecond,t.utcMillisecond,r.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},ce=function(e){return e.match(/.{6}/g).map(function(e){return"#"+e})},te=ce("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),re=ce("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),de=ce("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),ie=ce("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),ue=f.interpolateCubehelixLong(d.cubehelix(300,.5,0),d.cubehelix(-240,.5,1)),be=f.interpolateCubehelixLong(d.cubehelix(-100,.75,.35),d.cubehelix(80,1.5,.8)),oe=f.interpolateCubehelixLong(d.cubehelix(260,.75,.35),d.cubehelix(80,1.5,.8)),le=d.cubehelix(),he=function(e){(e<0||e>1)&&(e-=Math.floor(e));var n=Math.abs(e-.5);return le.h=360*e-100,le.s=1.5-1.5*n,le.l=.8-.9*n,le+""},se=U(ce("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),ge=U(ce("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),pe=U(ce("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),me=U(ce("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));e.scaleBand=u,e.scalePoint=o,e.scaleIdentity=y,e.scaleLinear=x,e.scaleLog=S,e.scaleOrdinal=i,e.scaleImplicit=H,e.scalePow=O,e.scaleSqrt=F,e.scaleQuantile=L,e.scaleQuantize=P,e.scaleThreshold=A,e.scaleTime=ae,e.scaleUtc=fe,e.schemeCategory10=te,e.schemeCategory20b=re,e.schemeCategory20c=de,e.schemeCategory20=ie,e.interpolateCubehelixDefault=ue,e.interpolateRainbow=he,e.interpolateWarm=be,e.interpolateCool=oe,e.interpolateViridis=se,e.interpolateMagma=ge,e.interpolateInferno=pe,e.interpolatePlasma=me,e.scaleSequential=W,Object.defineProperty(e,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/d3-scale.v1.min.js b/www/js/contrib/d3-scale.v1.min.js
new file mode 100644
index 00000000..ab8b5c01
--- /dev/null
+++ b/www/js/contrib/d3-scale.v1.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-scale/ Version 1.0.4. Copyright 2016 Mike Bostock.
+!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array"),require("d3-collection"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format"),require("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-interpolate","d3-format","d3-time","d3-time-format","d3-color"],n):n(e.d3=e.d3||{},e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3)}(this,function(e,n,a,f,c,t,r,d){"use strict";function i(e){function n(n){var a=n+"",r=f.get(a);if(!r){if(t!==H)return t;f.set(a,r=c.push(n))}return e[(r-1)%e.length]}var f=a.map(),c=[],t=H;return e=null==e?[]:B.call(e),n.domain=function(e){if(!arguments.length)return c.slice();c=[],f=a.map();for(var t,r,d=-1,i=e.length;++d<i;)f.has(r=(t=e[d])+"")||f.set(r,c.push(t));return n},n.range=function(a){return arguments.length?(e=B.call(a),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return i().domain(c).range(e).unknown(t)},n}function u(){function e(){var e=t().length,c=d[1]<d[0],i=d[c-0],u=d[1-c];a=(u-i)/Math.max(1,e-o+2*l),b&&(a=Math.floor(a)),i+=(u-i-a*(e-o))*h,f=a*(1-o),b&&(i=Math.round(i),f=Math.round(f));var s=n.range(e).map(function(e){return i+a*e});return r(c?s.reverse():s)}var a,f,c=i().unknown(void 0),t=c.domain,r=c.range,d=[0,1],b=!1,o=0,l=0,h=.5;return delete c.unknown,c.domain=function(n){return arguments.length?(t(n),e()):t()},c.range=function(n){return arguments.length?(d=[+n[0],+n[1]],e()):d.slice()},c.rangeRound=function(n){return d=[+n[0],+n[1]],b=!0,e()},c.bandwidth=function(){return f},c.step=function(){return a},c.round=function(n){return arguments.length?(b=!!n,e()):b},c.padding=function(n){return arguments.length?(o=l=Math.max(0,Math.min(1,n)),e()):o},c.paddingInner=function(n){return arguments.length?(o=Math.max(0,Math.min(1,n)),e()):o},c.paddingOuter=function(n){return arguments.length?(l=Math.max(0,Math.min(1,n)),e()):l},c.align=function(n){return arguments.length?(h=Math.max(0,Math.min(1,n)),e()):h},c.copy=function(){return u().domain(t()).range(d).round(b).paddingInner(o).paddingOuter(l).align(h)},e()}function b(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return b(n())},e}function o(){return b(u().paddingInner(1))}function l(e,n){return(n-=e=+e)?function(a){return(a-e)/n}:Q(n)}function h(e){return function(n,a){var f=e(n=+n,a=+a);return function(e){return e<=n?0:e>=a?1:f(e)}}}function s(e){return function(n,a){var f=e(n=+n,a=+a);return function(e){return e<=0?n:e>=1?a:f(e)}}}function g(e,n,a,f){var c=e[0],t=e[1],r=n[0],d=n[1];return t<c?(c=a(t,c),r=f(d,r)):(c=a(c,t),r=f(r,d)),function(e){return r(c(e))}}function p(e,a,f,c){var t=Math.min(e.length,a.length)-1,r=new Array(t),d=new Array(t),i=-1;for(e[t]<e[0]&&(e=e.slice().reverse(),a=a.slice().reverse());++i<t;)r[i]=f(e[i],e[i+1]),d[i]=c(a[i],a[i+1]);return function(a){var f=n.bisect(e,a,1,t)-1;return d[f](r[f](a))}}function m(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp())}function M(e,n){function a(){return t=Math.min(i.length,u.length)>2?p:g,r=d=null,c}function c(n){return(r||(r=t(i,u,o?h(e):e,b)))(+n)}var t,r,d,i=z,u=z,b=f.interpolate,o=!1;return c.invert=function(e){return(d||(d=t(u,i,l,o?s(n):n)))(+e)},c.domain=function(e){return arguments.length?(i=j.call(e,_),a()):i.slice()},c.range=function(e){return arguments.length?(u=B.call(e),a()):u.slice()},c.rangeRound=function(e){return u=B.call(e),b=f.interpolateRound,a()},c.clamp=function(e){return arguments.length?(o=!!e,a()):o},c.interpolate=function(e){return arguments.length?(b=e,a()):b},a()}function v(e){var a=e.domain;return e.ticks=function(e){var f=a();return n.ticks(f[0],f[f.length-1],null==e?10:e)},e.tickFormat=function(e,n){return V(a(),e,n)},e.nice=function(f){var c=a(),t=c.length-1,r=null==f?10:f,d=c[0],i=c[t],u=n.tickStep(d,i,r);return u&&(u=n.tickStep(Math.floor(d/u)*u,Math.ceil(i/u)*u,r),c[0]=Math.floor(d/u)*u,c[t]=Math.ceil(i/u)*u,a(c)),e},e}function x(){var e=M(l,f.interpolateNumber);return e.copy=function(){return m(e,x())},v(e)}function y(){function e(e){return+e}var n=[0,1];return e.invert=e,e.domain=e.range=function(a){return arguments.length?(n=j.call(a,_),e):n.slice()},e.copy=function(){return y().domain(n)},v(e)}function w(e,n){return(n=Math.log(n/e))?function(a){return Math.log(a/e)/n}:Q(n)}function k(e,n){return e<0?function(a){return-Math.pow(-n,a)*Math.pow(-e,1-a)}:function(a){return Math.pow(n,a)*Math.pow(e,1-a)}}function N(e){return isFinite(e)?+("1e"+e):e<0?0:e}function q(e){return 10===e?N:e===Math.E?Math.exp:function(n){return Math.pow(e,n)}}function C(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),function(n){return Math.log(n)/e})}function D(e){return function(n){return-e(-n)}}function S(){function e(){return r=C(t),d=q(t),f()[0]<0&&(r=D(r),d=D(d)),a}var a=M(w,k).domain([1,10]),f=a.domain,t=10,r=C(10),d=q(10);return a.base=function(n){return arguments.length?(t=+n,e()):t},a.domain=function(n){return arguments.length?(f(n),e()):f()},a.ticks=function(e){var a,c=f(),i=c[0],u=c[c.length-1];(a=u<i)&&(h=i,i=u,u=h);var b,o,l,h=r(i),s=r(u),g=null==e?10:+e,p=[];if(!(t%1)&&s-h<g){if(h=Math.round(h)-1,s=Math.round(s)+1,i>0){for(;h<s;++h)for(o=1,b=d(h);o<t;++o)if(l=b*o,!(l<i)){if(l>u)break;p.push(l)}}else for(;h<s;++h)for(o=t-1,b=d(h);o>=1;--o)if(l=b*o,!(l<i)){if(l>u)break;p.push(l)}}else p=n.ticks(h,s,Math.min(s-h,g)).map(d);return a?p.reverse():p},a.tickFormat=function(e,n){if(null==n&&(n=10===t?".0e":","),"function"!=typeof n&&(n=c.format(n)),e===1/0)return n;null==e&&(e=10);var f=Math.max(1,t*e/a.ticks().length);return function(e){var a=e/d(Math.round(r(e)));return a*t<t-.5&&(a*=t),a<=f?n(e):""}},a.nice=function(){return f(G(f(),{floor:function(e){return d(Math.floor(r(e)))},ceil:function(e){return d(Math.ceil(r(e)))}}))},a.copy=function(){return m(a,S().base(t))},a}function I(e,n){return e<0?-Math.pow(-e,n):Math.pow(e,n)}function O(){function e(e,n){return(n=I(n,a)-(e=I(e,a)))?function(f){return(I(f,a)-e)/n}:Q(n)}function n(e,n){return n=I(n,a)-(e=I(e,a)),function(f){return I(e+n*f,1/a)}}var a=1,f=M(e,n),c=f.domain;return f.exponent=function(e){return arguments.length?(a=+e,c(c())):a},f.copy=function(){return m(f,O().exponent(a))},v(f)}function F(){return O().exponent(.5)}function L(){function e(){var e=0,r=Math.max(1,c.length);for(t=new Array(r-1);++e<r;)t[e-1]=n.quantile(f,e/r);return a}function a(e){if(!isNaN(e=+e))return c[n.bisect(t,e)]}var f=[],c=[],t=[];return a.invertExtent=function(e){var n=c.indexOf(e);return n<0?[NaN,NaN]:[n>0?t[n-1]:f[0],n<t.length?t[n]:f[f.length-1]]},a.domain=function(a){if(!arguments.length)return f.slice();f=[];for(var c,t=0,r=a.length;t<r;++t)c=a[t],null==c||isNaN(c=+c)||f.push(c);return f.sort(n.ascending),e()},a.range=function(n){return arguments.length?(c=B.call(n),e()):c.slice()},a.quantiles=function(){return t.slice()},a.copy=function(){return L().domain(f).range(c)},a}function P(){function e(e){if(e<=e)return d[n.bisect(r,e,0,t)]}function a(){var n=-1;for(r=new Array(t);++n<t;)r[n]=((n+1)*c-(n-t)*f)/(t+1);return e}var f=0,c=1,t=1,r=[.5],d=[0,1];return e.domain=function(e){return arguments.length?(f=+e[0],c=+e[1],a()):[f,c]},e.range=function(e){return arguments.length?(t=(d=B.call(e)).length-1,a()):d.slice()},e.invertExtent=function(e){var n=d.indexOf(e);return n<0?[NaN,NaN]:n<1?[f,r[0]]:n>=t?[r[t-1],c]:[r[n-1],r[n]]},e.copy=function(){return P().domain([f,c]).range(d)},v(e)}function A(){function e(e){if(e<=e)return f[n.bisect(a,e,0,c)]}var a=[.5],f=[0,1],c=1;return e.domain=function(n){return arguments.length?(a=B.call(n),c=Math.min(a.length,f.length-1),e):a.slice()},e.range=function(n){return arguments.length?(f=B.call(n),c=Math.min(a.length,f.length-1),e):f.slice()},e.invertExtent=function(e){var n=f.indexOf(e);return[a[n-1],a[n]]},e.copy=function(){return A().domain(a).range(f)},e}function E(e){return new Date(e)}function R(e){return e instanceof Date?+e:+new Date(+e)}function T(e,a,c,t,r,d,i,u,b){function o(n){return(i(n)<n?v:d(n)<n?x:r(n)<n?y:t(n)<n?w:a(n)<n?c(n)<n?k:N:e(n)<n?q:C)(n)}function h(a,f,c,t){if(null==a&&(a=10),"number"==typeof a){var r=Math.abs(c-f)/a,d=n.bisector(function(e){return e[2]}).right(D,r);d===D.length?(t=n.tickStep(f/ne,c/ne,a),a=e):d?(d=D[r/D[d-1][2]<D[d][2]/r?d-1:d],t=d[1],a=d[0]):(t=n.tickStep(f,c,a),a=u)}return null==t?a:a.every(t)}var s=M(l,f.interpolateNumber),g=s.invert,p=s.domain,v=b(".%L"),x=b(":%S"),y=b("%I:%M"),w=b("%I %p"),k=b("%a %d"),N=b("%b %d"),q=b("%B"),C=b("%Y"),D=[[i,1,J],[i,5,5*J],[i,15,15*J],[i,30,30*J],[d,1,K],[d,5,5*K],[d,15,15*K],[d,30,30*K],[r,1,X],[r,3,3*X],[r,6,6*X],[r,12,12*X],[t,1,Z],[t,2,2*Z],[c,1,$],[a,1,ee],[a,3,3*ee],[e,1,ne]];return s.invert=function(e){return new Date(g(e))},s.domain=function(e){return arguments.length?p(j.call(e,R)):p().map(E)},s.ticks=function(e,n){var a,f=p(),c=f[0],t=f[f.length-1],r=t<c;return r&&(a=c,c=t,t=a),a=h(e,c,t,n),a=a?a.range(c,t+1):[],r?a.reverse():a},s.tickFormat=function(e,n){return null==n?o:b(n)},s.nice=function(e,n){var a=p();return(e=h(e,a[0],a[a.length-1],n))?p(G(a,e)):s},s.copy=function(){return m(s,T(e,a,c,t,r,d,i,u,b))},s}function U(e){var n=e.length;return function(a){return e[Math.max(0,Math.min(n-1,Math.floor(a*n)))]}}function W(e){function n(n){var t=(n-a)/(f-a);return e(c?Math.max(0,Math.min(1,t)):t)}var a=0,f=1,c=!1;return n.domain=function(e){return arguments.length?(a=+e[0],f=+e[1],n):[a,f]},n.clamp=function(e){return arguments.length?(c=!!e,n):c},n.interpolator=function(a){return arguments.length?(e=a,n):e},n.copy=function(){return W(e).domain([a,f]).clamp(c)},v(n)}var Y=Array.prototype,j=Y.map,B=Y.slice,H={name:"implicit"},Q=function(e){return function(){return e}},_=function(e){return+e},z=[0,1],V=function(e,a,f){var t,r=e[0],d=e[e.length-1],i=n.tickStep(r,d,null==a?10:a);switch(f=c.formatSpecifier(null==f?",f":f),f.type){case"s":var u=Math.max(Math.abs(r),Math.abs(d));return null!=f.precision||isNaN(t=c.precisionPrefix(i,u))||(f.precision=t),c.formatPrefix(f,u);case"":case"e":case"g":case"p":case"r":null!=f.precision||isNaN(t=c.precisionRound(i,Math.max(Math.abs(r),Math.abs(d))))||(f.precision=t-("e"===f.type));break;case"f":case"%":null!=f.precision||isNaN(t=c.precisionFixed(i))||(f.precision=t-2*("%"===f.type))}return c.format(f)},G=function(e,n){e=e.slice();var a,f=0,c=e.length-1,t=e[f],r=e[c];return r<t&&(a=f,f=c,c=a,a=t,t=r,r=a),e[f]=n.floor(t),e[c]=n.ceil(r),e},J=1e3,K=60*J,X=60*K,Z=24*X,$=7*Z,ee=30*Z,ne=365*Z,ae=function(){return T(t.timeYear,t.timeMonth,t.timeWeek,t.timeDay,t.timeHour,t.timeMinute,t.timeSecond,t.timeMillisecond,r.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},fe=function(){return T(t.utcYear,t.utcMonth,t.utcWeek,t.utcDay,t.utcHour,t.utcMinute,t.utcSecond,t.utcMillisecond,r.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},ce=function(e){return e.match(/.{6}/g).map(function(e){return"#"+e})},te=ce("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),re=ce("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),de=ce("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),ie=ce("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),ue=f.interpolateCubehelixLong(d.cubehelix(300,.5,0),d.cubehelix(-240,.5,1)),be=f.interpolateCubehelixLong(d.cubehelix(-100,.75,.35),d.cubehelix(80,1.5,.8)),oe=f.interpolateCubehelixLong(d.cubehelix(260,.75,.35),d.cubehelix(80,1.5,.8)),le=d.cubehelix(),he=function(e){(e<0||e>1)&&(e-=Math.floor(e));var n=Math.abs(e-.5);return le.h=360*e-100,le.s=1.5-1.5*n,le.l=.8-.9*n,le+""},se=U(ce("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),ge=U(ce("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),pe=U(ce("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),me=U(ce("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));e.scaleBand=u,e.scalePoint=o,e.scaleIdentity=y,e.scaleLinear=x,e.scaleLog=S,e.scaleOrdinal=i,e.scaleImplicit=H,e.scalePow=O,e.scaleSqrt=F,e.scaleQuantile=L,e.scaleQuantize=P,e.scaleThreshold=A,e.scaleTime=ae,e.scaleUtc=fe,e.schemeCategory10=te,e.schemeCategory20b=re,e.schemeCategory20c=de,e.schemeCategory20=ie,e.interpolateCubehelixDefault=ue,e.interpolateRainbow=he,e.interpolateWarm=be,e.interpolateCool=oe,e.interpolateViridis=se,e.interpolateMagma=ge,e.interpolateInferno=pe,e.interpolatePlasma=me,e.scaleSequential=W,Object.defineProperty(e,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/d3-scale.zip b/www/js/contrib/d3-scale.zip
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/www/js/contrib/d3-scale.zip
diff --git a/www/js/contrib/d3-time-format.v2.min.js b/www/js/contrib/d3-time-format.v2.min.js
new file mode 100644
index 00000000..73e18904
--- /dev/null
+++ b/www/js/contrib/d3-time-format.v2.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-time-format/ Version 2.0.3. Copyright 2016 Mike Bostock.
+!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-time")):"function"==typeof define&&define.amd?define(["exports","d3-time"],t):t(n.d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";function e(n){if(0<=n.y&&n.y<100){var t=new Date(-1,n.m,n.d,n.H,n.M,n.S,n.L);return t.setFullYear(n.y),t}return new Date(n.y,n.m,n.d,n.H,n.M,n.S,n.L)}function r(n){if(0<=n.y&&n.y<100){var t=new Date(Date.UTC(-1,n.m,n.d,n.H,n.M,n.S,n.L));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(n.y,n.m,n.d,n.H,n.M,n.S,n.L))}function u(n){return{y:n,m:0,d:1,H:0,M:0,S:0,L:0}}function o(n){function t(n,t){return function(e){var r,u,o,c=[],i=-1,a=0,f=n.length;for(e instanceof Date||(e=new Date(+e));++i<f;)37===n.charCodeAt(i)&&(c.push(n.slice(a,i)),null!=(u=rn[r=n.charAt(++i)])?r=n.charAt(++i):u="e"===r?" ":"0",(o=t[r])&&(r=o(e,u)),c.push(r),a=i+1);return c.push(n.slice(a,i)),c.join("")}}function o(n,t){return function(e){var o=u(1900),i=c(o,n,e+="",0);if(i!=e.length)return null;if("p"in o&&(o.H=o.H%12+12*o.p),"W"in o||"U"in o){"w"in o||(o.w="W"in o?1:0);var a="Z"in o?r(u(o.y)).getUTCDay():t(u(o.y)).getDay();o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(a+5)%7:o.w+7*o.U-(a+6)%7}return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,r(o)):t(o)}}function c(n,t,e,r){for(var u,o,c=0,i=t.length,a=e.length;c<i;){if(r>=a)return-1;if(u=t.charCodeAt(c++),37===u){if(u=t.charAt(c++),o=Jn[u in rn?t.charAt(c++):u],!o||(r=o(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function i(n,t,e){var r=Un.exec(t.slice(e));return r?(n.p=Hn[r[0].toLowerCase()],e+r[0].length):-1}function V(n,t,e){var r=Yn.exec(t.slice(e));return r?(n.w=An[r[0].toLowerCase()],e+r[0].length):-1}function nn(n,t,e){var r=Fn.exec(t.slice(e));return r?(n.w=Ln[r[0].toLowerCase()],e+r[0].length):-1}function tn(n,t,e){var r=Wn.exec(t.slice(e));return r?(n.m=jn[r[0].toLowerCase()],e+r[0].length):-1}function en(n,t,e){var r=bn.exec(t.slice(e));return r?(n.m=Zn[r[0].toLowerCase()],e+r[0].length):-1}function un(n,t,e){return c(n,Mn,t,e)}function on(n,t,e){return c(n,pn,t,e)}function cn(n,t,e){return c(n,xn,t,e)}function an(n){return Dn[n.getDay()]}function fn(n){return Cn[n.getDay()]}function ln(n){return wn[n.getMonth()]}function sn(n){return Tn[n.getMonth()]}function gn(n){return Sn[+(n.getHours()>=12)]}function dn(n){return Dn[n.getUTCDay()]}function hn(n){return Cn[n.getUTCDay()]}function yn(n){return wn[n.getUTCMonth()]}function mn(n){return Tn[n.getUTCMonth()]}function vn(n){return Sn[+(n.getUTCHours()>=12)]}var Mn=n.dateTime,pn=n.date,xn=n.time,Sn=n.periods,Cn=n.days,Dn=n.shortDays,Tn=n.months,wn=n.shortMonths,Un=a(Sn),Hn=f(Sn),Fn=a(Cn),Ln=f(Cn),Yn=a(Dn),An=f(Dn),bn=a(Tn),Zn=f(Tn),Wn=a(wn),jn=f(wn),Pn={a:an,A:fn,b:ln,B:sn,c:null,d:T,e:T,H:w,I:U,j:H,L:F,m:L,M:Y,p:gn,S:A,U:b,w:Z,W:W,x:null,X:null,y:j,Y:P,Z:I,"%":Q},In={a:dn,A:hn,b:yn,B:mn,c:null,d:J,e:J,H:O,I:X,j:N,L:B,m:_,M:$,p:vn,S:q,U:z,w:E,W:R,x:null,X:null,y:k,Y:G,Z:K,"%":Q},Jn={a:V,A:nn,b:tn,B:en,c:un,d:v,e:v,H:p,I:p,j:M,L:C,m:m,M:x,p:i,S:S,U:s,w:l,W:g,x:on,X:cn,y:h,Y:d,Z:y,"%":D};return Pn.x=t(pn,Pn),Pn.X=t(xn,Pn),Pn.c=t(Mn,Pn),In.x=t(pn,In),In.X=t(xn,In),In.c=t(Mn,In),{format:function(n){var e=t(n+="",Pn);return e.toString=function(){return n},e},parse:function(n){var t=o(n+="",e);return t.toString=function(){return n},t},utcFormat:function(n){var e=t(n+="",In);return e.toString=function(){return n},e},utcParse:function(n){var t=o(n,r);return t.toString=function(){return n},t}}}function c(n,t,e){var r=n<0?"-":"",u=(r?-n:n)+"",o=u.length;return r+(o<e?new Array(e-o+1).join(t)+u:u)}function i(n){return n.replace(cn,"\\$&")}function a(n){return new RegExp("^(?:"+n.map(i).join("|")+")","i")}function f(n){for(var t={},e=-1,r=n.length;++e<r;)t[n[e].toLowerCase()]=e;return t}function l(n,t,e){var r=un.exec(t.slice(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function s(n,t,e){var r=un.exec(t.slice(e));return r?(n.U=+r[0],e+r[0].length):-1}function g(n,t,e){var r=un.exec(t.slice(e));return r?(n.W=+r[0],e+r[0].length):-1}function d(n,t,e){var r=un.exec(t.slice(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function h(n,t,e){var r=un.exec(t.slice(e,e+2));return r?(n.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function y(n,t,e){var r=/^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(t.slice(e,e+6));return r?(n.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function m(n,t,e){var r=un.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function v(n,t,e){var r=un.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function M(n,t,e){var r=un.exec(t.slice(e,e+3));return r?(n.m=0,n.d=+r[0],e+r[0].length):-1}function p(n,t,e){var r=un.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function x(n,t,e){var r=un.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function S(n,t,e){var r=un.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function C(n,t,e){var r=un.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function D(n,t,e){var r=on.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function T(n,t){return c(n.getDate(),t,2)}function w(n,t){return c(n.getHours(),t,2)}function U(n,t){return c(n.getHours()%12||12,t,2)}function H(n,e){return c(1+t.timeDay.count(t.timeYear(n),n),e,3)}function F(n,t){return c(n.getMilliseconds(),t,3)}function L(n,t){return c(n.getMonth()+1,t,2)}function Y(n,t){return c(n.getMinutes(),t,2)}function A(n,t){return c(n.getSeconds(),t,2)}function b(n,e){return c(t.timeSunday.count(t.timeYear(n),n),e,2)}function Z(n){return n.getDay()}function W(n,e){return c(t.timeMonday.count(t.timeYear(n),n),e,2)}function j(n,t){return c(n.getFullYear()%100,t,2)}function P(n,t){return c(n.getFullYear()%1e4,t,4)}function I(n){var t=n.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+c(t/60|0,"0",2)+c(t%60,"0",2)}function J(n,t){return c(n.getUTCDate(),t,2)}function O(n,t){return c(n.getUTCHours(),t,2)}function X(n,t){return c(n.getUTCHours()%12||12,t,2)}function N(n,e){return c(1+t.utcDay.count(t.utcYear(n),n),e,3)}function B(n,t){return c(n.getUTCMilliseconds(),t,3)}function _(n,t){return c(n.getUTCMonth()+1,t,2)}function $(n,t){return c(n.getUTCMinutes(),t,2)}function q(n,t){return c(n.getUTCSeconds(),t,2)}function z(n,e){return c(t.utcSunday.count(t.utcYear(n),n),e,2)}function E(n){return n.getUTCDay()}function R(n,e){return c(t.utcMonday.count(t.utcYear(n),n),e,2)}function k(n,t){return c(n.getUTCFullYear()%100,t,2)}function G(n,t){return c(n.getUTCFullYear()%1e4,t,4)}function K(){return"+0000"}function Q(){return"%"}function V(t){return en=o(t),n.timeFormat=en.format,n.timeParse=en.parse,n.utcFormat=en.utcFormat,n.utcParse=en.utcParse,en}function nn(n){return n.toISOString()}function tn(n){var t=new Date(n);return isNaN(t)?null:t}var en,rn={"-":"",_:" ",0:"0"},un=/^\s*\d+/,on=/^%/,cn=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;V({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var an="%Y-%m-%dT%H:%M:%S.%LZ",fn=Date.prototype.toISOString?nn:n.utcFormat(an),ln=+new Date("2000-01-01T00:00:00.000Z")?tn:n.utcParse(an);n.timeFormatDefaultLocale=V,n.timeFormatLocale=o,n.isoFormat=fn,n.isoParse=ln,Object.defineProperty(n,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/d3-time.v1.min.js b/www/js/contrib/d3-time.v1.min.js
new file mode 100644
index 00000000..bebf3c90
--- /dev/null
+++ b/www/js/contrib/d3-time.v1.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org/d3-time/ Version 1.0.4. Copyright 2016 Mike Bostock.
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.d3=t.d3||{})}(this,function(t){"use strict";function e(t,n,u,i){function a(e){return t(e=new Date(+e)),e}return a.floor=a,a.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},a.round=function(t){var e=a(t),n=a.ceil(t);return t-e<n-t?e:n},a.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},a.range=function(e,u,r){var o=[];if(e=a.ceil(e),r=null==r?1:Math.floor(r),!(e<u&&r>0))return o;do o.push(new Date(+e));while(n(e,r),t(e),e<u);return o},a.filter=function(u){return e(function(e){if(e>=e)for(;t(e),!u(e);)e.setTime(e-1)},function(t,e){if(t>=t)for(;--e>=0;)for(;n(t,1),!u(t););})},u&&(a.count=function(e,n){return r.setTime(+e),o.setTime(+n),t(r),t(o),Math.floor(u(r,o))},a.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?a.filter(i?function(e){return i(e)%t===0}:function(e){return a.count(0,e)%t===0}):a:null}),a}function n(t){return e(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*s)/g})}function u(t){return e(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/g})}var r=new Date,o=new Date,i=e(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?e(function(e){e.setTime(Math.floor(e/t)*t)},function(e,n){e.setTime(+e+n*t)},function(e,n){return(n-e)/t}):i:null};var a=i.range,c=1e3,s=6e4,f=36e5,l=864e5,g=6048e5,T=e(function(t){t.setTime(Math.floor(t/c)*c)},function(t,e){t.setTime(+t+e*c)},function(t,e){return(e-t)/c},function(t){return t.getUTCSeconds()}),d=T.range,m=e(function(t){t.setTime(Math.floor(t/s)*s)},function(t,e){t.setTime(+t+e*s)},function(t,e){return(e-t)/s},function(t){return t.getMinutes()}),M=m.range,y=e(function(t){var e=t.getTimezoneOffset()*s%f;e<0&&(e+=f),t.setTime(Math.floor((+t-e)/f)*f+e)},function(t,e){t.setTime(+t+e*f)},function(t,e){return(e-t)/f},function(t){return t.getHours()}),h=y.range,C=e(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*s)/l},function(t){return t.getDate()-1}),U=C.range,F=n(0),D=n(1),Y=n(2),H=n(3),S=n(4),v=n(5),p=n(6),W=F.range,w=D.range,O=Y.range,z=H.range,k=S.range,x=v.range,b=p.range,j=e(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),_=j.range,I=e(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});I.every=function(t){return isFinite(t=Math.floor(t))&&t>0?e(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n*t)}):null};var P=I.range,q=e(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*s)},function(t,e){return(e-t)/s},function(t){return t.getUTCMinutes()}),A=q.range,B=e(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+e*f)},function(t,e){return(e-t)/f},function(t){return t.getUTCHours()}),E=B.range,G=e(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/l},function(t){return t.getUTCDate()-1}),J=G.range,K=u(0),L=u(1),N=u(2),Q=u(3),R=u(4),V=u(5),X=u(6),Z=K.range,$=L.range,tt=N.range,et=Q.range,nt=R.range,ut=V.range,rt=X.range,ot=e(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),it=ot.range,at=e(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});at.every=function(t){return isFinite(t=Math.floor(t))&&t>0?e(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null};var ct=at.range;t.timeInterval=e,t.timeMillisecond=i,t.timeMilliseconds=a,t.utcMillisecond=i,t.utcMilliseconds=a,t.timeSecond=T,t.timeSeconds=d,t.utcSecond=T,t.utcSeconds=d,t.timeMinute=m,t.timeMinutes=M,t.timeHour=y,t.timeHours=h,t.timeDay=C,t.timeDays=U,t.timeWeek=F,t.timeWeeks=W,t.timeSunday=F,t.timeSundays=W,t.timeMonday=D,t.timeMondays=w,t.timeTuesday=Y,t.timeTuesdays=O,t.timeWednesday=H,t.timeWednesdays=z,t.timeThursday=S,t.timeThursdays=k,t.timeFriday=v,t.timeFridays=x,t.timeSaturday=p,t.timeSaturdays=b,t.timeMonth=j,t.timeMonths=_,t.timeYear=I,t.timeYears=P,t.utcMinute=q,t.utcMinutes=A,t.utcHour=B,t.utcHours=E,t.utcDay=G,t.utcDays=J,t.utcWeek=K,t.utcWeeks=Z,t.utcSunday=K,t.utcSundays=Z,t.utcMonday=L,t.utcMondays=$,t.utcTuesday=N,t.utcTuesdays=tt,t.utcWednesday=Q,t.utcWednesdays=et,t.utcThursday=R,t.utcThursdays=nt,t.utcFriday=V,t.utcFridays=ut,t.utcSaturday=X,t.utcSaturdays=rt,t.utcMonth=ot,t.utcMonths=it,t.utcYear=at,t.utcYears=ct,Object.defineProperty(t,"__esModule",{value:!0})}); \ No newline at end of file
diff --git a/www/js/contrib/jasny-bootstrap.min.js b/www/js/contrib/jasny-bootstrap.min.js
new file mode 100644
index 00000000..f33cafd3
--- /dev/null
+++ b/www/js/contrib/jasny-bootstrap.min.js
@@ -0,0 +1,6 @@
+/*!
+ * Jasny Bootstrap v3.1.3 (http://jasny.github.io/bootstrap)
+ * Copyright 2012-2014 Arnold Daniels
+ * Licensed under Apache-2.0 (https://github.com/jasny/bootstrap/blob/master/LICENSE)
+ */
+if("undefined"==typeof jQuery)throw new Error("Jasny Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}void 0===a.support.transition&&(a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()}))}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.state=null,this.placement=null,this.options.recalc&&(this.calcClone(),a(window).on("resize",a.proxy(this.recalc,this))),this.options.autohide&&a(document).on("click",a.proxy(this.autohide,this)),this.options.toggle&&this.toggle(),this.options.disablescrolling&&(this.options.disableScrolling=this.options.disablescrolling,delete this.options.disablescrolling)};b.DEFAULTS={toggle:!0,placement:"auto",autohide:!0,recalc:!0,disableScrolling:!0,modal:!1},b.prototype.offset=function(){switch(this.placement){case"left":case"right":return this.$element.outerWidth();case"top":case"bottom":return this.$element.outerHeight()}},b.prototype.calcPlacement=function(){function b(a,b){if("auto"===e.css(b))return a;if("auto"===e.css(a))return b;var c=parseInt(e.css(a),10),d=parseInt(e.css(b),10);return c>d?b:a}if("auto"!==this.options.placement)return void(this.placement=this.options.placement);this.$element.hasClass("in")||this.$element.css("visiblity","hidden !important").addClass("in");var c=a(window).width()/this.$element.width(),d=a(window).height()/this.$element.height(),e=this.$element;this.placement=c>=d?b("left","right"):b("top","bottom"),"hidden !important"===this.$element.css("visibility")&&this.$element.removeClass("in").css("visiblity","")},b.prototype.opposite=function(a){switch(a){case"top":return"bottom";case"left":return"right";case"bottom":return"top";case"right":return"left"}},b.prototype.getCanvasElements=function(){var b=this.options.canvas?a(this.options.canvas):this.$element,c=b.find("*").filter(function(){return"fixed"===a(this).css("position")}).not(this.options.exclude);return b.add(c)},b.prototype.slide=function(b,c,d){if(!a.support.transition){var e={};return e[this.placement]="+="+c,b.animate(e,350,d)}var f=this.placement,g=this.opposite(f);b.each(function(){"auto"!==a(this).css(f)&&a(this).css(f,(parseInt(a(this).css(f),10)||0)+c),"auto"!==a(this).css(g)&&a(this).css(g,(parseInt(a(this).css(g),10)||0)-c)}),this.$element.one(a.support.transition.end,d).emulateTransitionEnd(350)},b.prototype.disableScrolling=function(){var b=a("body").width(),c="padding-"+this.opposite(this.placement);if(void 0===a("body").data("offcanvas-style")&&a("body").data("offcanvas-style",a("body").attr("style")||""),a("body").css("overflow","hidden"),a("body").width()>b){var d=parseInt(a("body").css(c),10)+a("body").width()-b;setTimeout(function(){a("body").css(c,d)},1)}a("body").on("touchmove.bs",function(a){a.preventDefault()})},b.prototype.enableScrolling=function(){a("body").off("touchmove.bs")},b.prototype.show=function(){if(!this.state){var b=a.Event("show.bs.offcanvas");if(this.$element.trigger(b),!b.isDefaultPrevented()){this.state="slide-in",this.calcPlacement();var c=this.getCanvasElements(),d=this.placement,e=this.opposite(d),f=this.offset();-1!==c.index(this.$element)&&(a(this.$element).data("offcanvas-style",a(this.$element).attr("style")||""),this.$element.css(d,-1*f),this.$element.css(d)),c.addClass("canvas-sliding").each(function(){void 0===a(this).data("offcanvas-style")&&a(this).data("offcanvas-style",a(this).attr("style")||""),"static"===a(this).css("position")&&a(this).css("position","relative"),"auto"!==a(this).css(d)&&"0px"!==a(this).css(d)||"auto"!==a(this).css(e)&&"0px"!==a(this).css(e)||a(this).css(d,0)}),this.options.disableScrolling&&this.disableScrolling(),this.options.modal&&this.toggleBackdrop();var g=function(){"slide-in"==this.state&&(this.state="slid",c.removeClass("canvas-sliding").addClass("canvas-slid"),this.$element.trigger("shown.bs.offcanvas"))};setTimeout(a.proxy(function(){this.$element.addClass("in"),this.slide(c,f,a.proxy(g,this))},this),1)}}},b.prototype.hide=function(){if("slid"===this.state){var b=a.Event("hide.bs.offcanvas");if(this.$element.trigger(b),!b.isDefaultPrevented()){this.state="slide-out";var c=a(".canvas-slid"),d=(this.placement,-1*this.offset()),e=function(){"slide-out"==this.state&&(this.state=null,this.placement=null,this.$element.removeClass("in"),c.removeClass("canvas-sliding"),c.add(this.$element).add("body").each(function(){a(this).attr("style",a(this).data("offcanvas-style")).removeData("offcanvas-style")}),this.$element.trigger("hidden.bs.offcanvas"))};this.options.disableScrolling&&this.enableScrolling(),this.options.modal&&this.toggleBackdrop(),c.removeClass("canvas-slid").addClass("canvas-sliding"),setTimeout(a.proxy(function(){this.slide(c,d,a.proxy(e,this))},this),1)}}},b.prototype.toggle=function(){"slide-in"!==this.state&&"slide-out"!==this.state&&this["slid"===this.state?"hide":"show"]()},b.prototype.toggleBackdrop=function(b){if(b=b||a.noop,"slide-in"==this.state){var c=a.support.transition;this.$backdrop=a('<div class="modal-backdrop fade" />').insertAfter(this.$element),c&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),c?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else if("slide-out"==this.state&&this.$backdrop){this.$backdrop.removeClass("in"),a("body").off("touchmove.bs");var d=this;a.support.transition?this.$backdrop.one(a.support.transition.end,function(){d.$backdrop.remove(),b(),d.$backdrop=null}).emulateTransitionEnd(150):(this.$backdrop.remove(),this.$backdrop=null,b())}else b&&b()},b.prototype.calcClone=function(){this.$calcClone=this.$element.clone().html("").addClass("offcanvas-clone").removeClass("in").appendTo(a("body"))},b.prototype.recalc=function(){if("none"!==this.$calcClone.css("display")&&("slid"===this.state||"slide-in"===this.state)){this.state=null,this.placement=null;var b=this.getCanvasElements();this.$element.removeClass("in"),b.removeClass("canvas-slid"),b.add(this.$element).add("body").each(function(){a(this).attr("style",a(this).data("offcanvas-style")).removeData("offcanvas-style")})}},b.prototype.autohide=function(b){0===a(b.target).closest(this.$element).length&&this.hide()};var c=a.fn.offcanvas;a.fn.offcanvas=function(c){return this.each(function(){var d=a(this),e=d.data("bs.offcanvas"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.offcanvas",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.offcanvas.Constructor=b,a.fn.offcanvas.noConflict=function(){return a.fn.offcanvas=c,this},a(document).on("click.bs.offcanvas.data-api","[data-toggle=offcanvas]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.offcanvas"),h=g?"toggle":d.data();b.stopPropagation(),g?g.toggle():f.offcanvas(h)})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.$element.on("click.bs.rowlink","td:not(.rowlink-skip)",a.proxy(this.click,this))};b.DEFAULTS={target:"a"},b.prototype.click=function(b){var c=a(b.currentTarget).closest("tr").find(this.options.target)[0];if(a(b.target)[0]!==c)if(b.preventDefault(),c.click)c.click();else if(document.createEvent){var d=document.createEvent("MouseEvents");d.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),c.dispatchEvent(d)}};var c=a.fn.rowlink;a.fn.rowlink=function(c){return this.each(function(){var d=a(this),e=d.data("bs.rowlink");e||d.data("bs.rowlink",e=new b(this,c))})},a.fn.rowlink.Constructor=b,a.fn.rowlink.noConflict=function(){return a.fn.rowlink=c,this},a(document).on("click.bs.rowlink.data-api",'[data-link="row"]',function(b){if(0===a(b.target).closest(".rowlink-skip").length){var c=a(this);c.data("bs.rowlink")||(c.rowlink(c.data()),a(b.target).trigger("click.bs.rowlink"))}})}(window.jQuery),+function(a){"use strict";var b=void 0!==window.orientation,c=navigator.userAgent.toLowerCase().indexOf("android")>-1,d="Microsoft Internet Explorer"==window.navigator.appName,e=function(b,d){c||(this.$element=a(b),this.options=a.extend({},e.DEFAULTS,d),this.mask=String(this.options.mask),this.init(),this.listen(),this.checkVal())};e.DEFAULTS={mask:"",placeholder:"_",definitions:{9:"[0-9]",a:"[A-Za-z]",w:"[A-Za-z0-9]","*":"."}},e.prototype.init=function(){var b=this.options.definitions,c=this.mask.length;this.tests=[],this.partialPosition=this.mask.length,this.firstNonMaskPos=null,a.each(this.mask.split(""),a.proxy(function(a,d){"?"==d?(c--,this.partialPosition=a):b[d]?(this.tests.push(new RegExp(b[d])),null===this.firstNonMaskPos&&(this.firstNonMaskPos=this.tests.length-1)):this.tests.push(null)},this)),this.buffer=a.map(this.mask.split(""),a.proxy(function(a){return"?"!=a?b[a]?this.options.placeholder:a:void 0},this)),this.focusText=this.$element.val(),this.$element.data("rawMaskFn",a.proxy(function(){return a.map(this.buffer,function(a,b){return this.tests[b]&&a!=this.options.placeholder?a:null}).join("")},this))},e.prototype.listen=function(){if(!this.$element.attr("readonly")){var b=(d?"paste":"input")+".bs.inputmask";this.$element.on("unmask.bs.inputmask",a.proxy(this.unmask,this)).on("focus.bs.inputmask",a.proxy(this.focusEvent,this)).on("blur.bs.inputmask",a.proxy(this.blurEvent,this)).on("keydown.bs.inputmask",a.proxy(this.keydownEvent,this)).on("keypress.bs.inputmask",a.proxy(this.keypressEvent,this)).on(b,a.proxy(this.pasteEvent,this))}},e.prototype.caret=function(a,b){if(0!==this.$element.length){if("number"==typeof a)return b="number"==typeof b?b:a,this.$element.each(function(){if(this.setSelectionRange)this.setSelectionRange(a,b);else if(this.createTextRange){var c=this.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select()}});if(this.$element[0].setSelectionRange)a=this.$element[0].selectionStart,b=this.$element[0].selectionEnd;else if(document.selection&&document.selection.createRange){var c=document.selection.createRange();a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length}return{begin:a,end:b}}},e.prototype.seekNext=function(a){for(var b=this.mask.length;++a<=b&&!this.tests[a];);return a},e.prototype.seekPrev=function(a){for(;--a>=0&&!this.tests[a];);return a},e.prototype.shiftL=function(a,b){var c=this.mask.length;if(!(0>a)){for(var d=a,e=this.seekNext(b);c>d;d++)if(this.tests[d]){if(!(c>e&&this.tests[d].test(this.buffer[e])))break;this.buffer[d]=this.buffer[e],this.buffer[e]=this.options.placeholder,e=this.seekNext(e)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,a))}},e.prototype.shiftR=function(a){for(var b=this.mask.length,c=a,d=this.options.placeholder;b>c;c++)if(this.tests[c]){var e=this.seekNext(c),f=this.buffer[c];if(this.buffer[c]=d,!(b>e&&this.tests[e].test(f)))break;d=f}},e.prototype.unmask=function(){this.$element.unbind(".bs.inputmask").removeData("bs.inputmask")},e.prototype.focusEvent=function(){this.focusText=this.$element.val();var a=this.mask.length,b=this.checkVal();this.writeBuffer();var c=this,d=function(){b==a?c.caret(0,b):c.caret(b)};d(),setTimeout(d,50)},e.prototype.blurEvent=function(){this.checkVal(),this.$element.val()!==this.focusText&&(this.$element.trigger("change"),this.$element.trigger("input"))},e.prototype.keydownEvent=function(a){var c=a.which;if(8==c||46==c||b&&127==c){var d=this.caret(),e=d.begin,f=d.end;return f-e===0&&(e=46!=c?this.seekPrev(e):f=this.seekNext(e-1),f=46==c?this.seekNext(f):f),this.clearBuffer(e,f),this.shiftL(e,f-1),!1}return 27==c?(this.$element.val(this.focusText),this.caret(0,this.checkVal()),!1):void 0},e.prototype.keypressEvent=function(a){var b=this.mask.length,c=a.which,d=this.caret();if(a.ctrlKey||a.altKey||a.metaKey||32>c)return!0;if(c){d.end-d.begin!==0&&(this.clearBuffer(d.begin,d.end),this.shiftL(d.begin,d.end-1));var e=this.seekNext(d.begin-1);if(b>e){var f=String.fromCharCode(c);if(this.tests[e].test(f)){this.shiftR(e),this.buffer[e]=f,this.writeBuffer();var g=this.seekNext(e);this.caret(g)}}return!1}},e.prototype.pasteEvent=function(){var a=this;setTimeout(function(){a.caret(a.checkVal(!0))},0)},e.prototype.clearBuffer=function(a,b){for(var c=this.mask.length,d=a;b>d&&c>d;d++)this.tests[d]&&(this.buffer[d]=this.options.placeholder)},e.prototype.writeBuffer=function(){return this.$element.val(this.buffer.join("")).val()},e.prototype.checkVal=function(a){for(var b=this.mask.length,c=this.$element.val(),d=-1,e=0,f=0;b>e;e++)if(this.tests[e]){for(this.buffer[e]=this.options.placeholder;f++<c.length;){var g=c.charAt(f-1);if(this.tests[e].test(g)){this.buffer[e]=g,d=e;break}}if(f>c.length)break}else this.buffer[e]==c.charAt(f)&&e!=this.partialPosition&&(f++,d=e);return!a&&d+1<this.partialPosition?(this.$element.val(""),this.clearBuffer(0,b)):(a||d+1>=this.partialPosition)&&(this.writeBuffer(),a||this.$element.val(this.$element.val().substring(0,d+1))),this.partialPosition?e:this.firstNonMaskPos};var f=a.fn.inputmask;a.fn.inputmask=function(b){return this.each(function(){var c=a(this),d=c.data("bs.inputmask");d||c.data("bs.inputmask",d=new e(this,b))})},a.fn.inputmask.Constructor=e,a.fn.inputmask.noConflict=function(){return a.fn.inputmask=f,this},a(document).on("focus.bs.inputmask.data-api","[data-mask]",function(){var b=a(this);b.data("bs.inputmask")||b.inputmask(b.data())})}(window.jQuery),+function(a){"use strict";var b="Microsoft Internet Explorer"==window.navigator.appName,c=function(b,c){if(this.$element=a(b),this.$input=this.$element.find(":file"),0!==this.$input.length){this.name=this.$input.attr("name")||c.name,this.$hidden=this.$element.find('input[type=hidden][name="'+this.name+'"]'),0===this.$hidden.length&&(this.$hidden=a('<input type="hidden">').insertBefore(this.$input)),this.$preview=this.$element.find(".fileinput-preview");var d=this.$preview.css("height");"inline"!==this.$preview.css("display")&&"0px"!==d&&"none"!==d&&this.$preview.css("line-height",d),this.original={exists:this.$element.hasClass("fileinput-exists"),preview:this.$preview.html(),hiddenVal:this.$hidden.val()},this.listen()}};c.prototype.listen=function(){this.$input.on("change.bs.fileinput",a.proxy(this.change,this)),a(this.$input[0].form).on("reset.bs.fileinput",a.proxy(this.reset,this)),this.$element.find('[data-trigger="fileinput"]').on("click.bs.fileinput",a.proxy(this.trigger,this)),this.$element.find('[data-dismiss="fileinput"]').on("click.bs.fileinput",a.proxy(this.clear,this))},c.prototype.change=function(b){var c=void 0===b.target.files?b.target&&b.target.value?[{name:b.target.value.replace(/^.+\\/,"")}]:[]:b.target.files;if(b.stopPropagation(),0===c.length)return void this.clear();this.$hidden.val(""),this.$hidden.attr("name",""),this.$input.attr("name",this.name);var d=c[0];if(this.$preview.length>0&&("undefined"!=typeof d.type?d.type.match(/^image\/(gif|png|jpeg)$/):d.name.match(/\.(gif|png|jpe?g)$/i))&&"undefined"!=typeof FileReader){var e=new FileReader,f=this.$preview,g=this.$element;e.onload=function(b){var e=a("<img>");e[0].src=b.target.result,c[0].result=b.target.result,g.find(".fileinput-filename").text(d.name),"none"!=f.css("max-height")&&e.css("max-height",parseInt(f.css("max-height"),10)-parseInt(f.css("padding-top"),10)-parseInt(f.css("padding-bottom"),10)-parseInt(f.css("border-top"),10)-parseInt(f.css("border-bottom"),10)),f.html(e),g.addClass("fileinput-exists").removeClass("fileinput-new"),g.trigger("change.bs.fileinput",c)},e.readAsDataURL(d)}else this.$element.find(".fileinput-filename").text(d.name),this.$preview.text(d.name),this.$element.addClass("fileinput-exists").removeClass("fileinput-new"),this.$element.trigger("change.bs.fileinput")},c.prototype.clear=function(a){if(a&&a.preventDefault(),this.$hidden.val(""),this.$hidden.attr("name",this.name),this.$input.attr("name",""),b){var c=this.$input.clone(!0);this.$input.after(c),this.$input.remove(),this.$input=c}else this.$input.val("");this.$preview.html(""),this.$element.find(".fileinput-filename").text(""),this.$element.addClass("fileinput-new").removeClass("fileinput-exists"),void 0!==a&&(this.$input.trigger("change"),this.$element.trigger("clear.bs.fileinput"))},c.prototype.reset=function(){this.clear(),this.$hidden.val(this.original.hiddenVal),this.$preview.html(this.original.preview),this.$element.find(".fileinput-filename").text(""),this.original.exists?this.$element.addClass("fileinput-exists").removeClass("fileinput-new"):this.$element.addClass("fileinput-new").removeClass("fileinput-exists"),this.$element.trigger("reset.bs.fileinput")},c.prototype.trigger=function(a){this.$input.trigger("click"),a.preventDefault()};var d=a.fn.fileinput;a.fn.fileinput=function(b){return this.each(function(){var d=a(this),e=d.data("bs.fileinput");e||d.data("bs.fileinput",e=new c(this,b)),"string"==typeof b&&e[b]()})},a.fn.fileinput.Constructor=c,a.fn.fileinput.noConflict=function(){return a.fn.fileinput=d,this},a(document).on("click.fileinput.data-api",'[data-provides="fileinput"]',function(b){var c=a(this);if(!c.data("bs.fileinput")){c.fileinput(c.data());var d=a(b.target).closest('[data-dismiss="fileinput"],[data-trigger="fileinput"]');d.length>0&&(b.preventDefault(),d.trigger("click.bs.fileinput"))}})}(window.jQuery); \ No newline at end of file
diff --git a/www/js/contrib/jquery-1.11.3.min.js b/www/js/contrib/jquery-1.11.3.min.js
new file mode 100644
index 00000000..0f60b7bd
--- /dev/null
+++ b/www/js/contrib/jquery-1.11.3.min.js
@@ -0,0 +1,5 @@
+/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
+
+return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},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(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ca()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ca()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?aa:ba):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=aa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=aa,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=aa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=ba;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=ba),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function da(a){var b=ea.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var ea="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fa=/ jQuery\d+="(?:null|\d+)"/g,ga=new RegExp("<(?:"+ea+")[\\s/>]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/<tbody/i,la=/<|&#?\w+;/,ma=/<(?:script|style|link)/i,na=/checked\s*(?:[^=]|=\s*.checked.)/i,oa=/^$|\/(?:java|ecma)script/i,pa=/^true\/(.*)/,qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ra={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:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?"<table>"!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.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",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.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",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.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",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},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":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){
+return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$a=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_a||(_a=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_a),_a=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.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(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,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":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
diff --git a/www/js/contrib/jquery-3.1.1.min.js b/www/js/contrib/jquery-3.1.1.min.js
new file mode 100644
index 00000000..4c5be4c0
--- /dev/null
+++ b/www/js/contrib/jquery-3.1.1.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */
+!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),
+a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:X.test(a)?JSON.parse(a):a)}function $(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=Z(c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),$(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=$(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=V.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var _=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,aa=new RegExp("^(?:([+-])=|)("+_+")([a-z%]*)$","i"),ba=["Top","Right","Bottom","Left"],ca=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function ea(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&aa.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var fa={};function ga(a){var b,c=a.ownerDocument,d=a.nodeName,e=fa[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),fa[d]=e,e)}function ha(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ca(d)&&(e[f]=ga(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ha(this,!0)},hide:function(){return ha(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ca(this)?r(this).show():r(this).hide()})}});var ia=/^(?:checkbox|radio)$/i,ja=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var oa=/<|&#?\w+;/;function pa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(oa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ja.exec(f)||["",""])[1].toLowerCase(),i=la[h]||la._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!("click"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==wa()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===wa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&r.nodeName(this,"input"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ua:va,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:va,isPropagationStopped:va,isImmediatePropagationStopped:va,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ua,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ua,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ua,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&ra.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&sa.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return xa(this,a,b,c,d)},one:function(a,b,c,d){return xa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=va),this.each(function(){r.event.remove(this,a,c,b)})}});var ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/<script|<style|<link/i,Aa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ba=/^true\/(.*)/,Ca=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Da(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ha(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ia.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ia(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,"script"),Ea),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,ma(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Fa),l=0;l<i;l++)j=h[l],ka.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ca,""),k))}return a}function Ja(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(ma(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&na(ma(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(ya,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);if(b)if(c)for(f=f||ma(a),g=g||ma(h),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);else Ga(a,h);return g=ma(h,"script"),g.length>0&&na(g,!i&&ma(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!za.test(a)&&!la[(ja.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(ma(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ia(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(ma(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ka=/^margin/,La=new RegExp("^("+_+")(?!px)[a-z%]+$","i"),Ma=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",qa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,qa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Na(a,b,c){var d,e,f,g,h=a.style;return c=c||Ma(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&La.test(g)&&Ka.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Oa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Pa=/^(none|table(?!-c[ea]).+)/,Qa={position:"absolute",visibility:"hidden",display:"block"},Ra={letterSpacing:"0",fontWeight:"400"},Sa=["Webkit","Moz","ms"],Ta=d.createElement("div").style;function Ua(a){if(a in Ta)return a;var b=a[0].toUpperCase()+a.slice(1),c=Sa.length;while(c--)if(a=Sa[c]+b,a in Ta)return a}function Va(a,b,c){var d=aa.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Wa(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+ba[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+ba[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+ba[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ba[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+ba[f]+"Width",!0,e)));return g}function Xa(a,b,c){var d,e=!0,f=Ma(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Na(a,b,f),(d<0||null==d)&&(d=a.style[b]),La.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Wa(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Na(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,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":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=aa.exec(c))&&e[1]&&(c=ea(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Na(a,b,d)),"normal"===e&&b in Ra&&(e=Ra[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Pa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Xa(a,b,d):da(a,Qa,function(){return Xa(a,b,d)})},set:function(a,c,d){var e,f=d&&Ma(a),g=d&&Wa(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=aa.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Va(a,c,g)}}}),r.cssHooks.marginLeft=Oa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Na(a,"marginLeft"))||a.getBoundingClientRect().left-da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+ba[d]+b]=f[d]||f[d-2]||f[0];return e}},Ka.test(a)||(r.cssHooks[a+b].set=Va)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=Ma(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Ya(a,b,c,d,e){return new Ya.prototype.init(a,b,c,d,e)}r.Tween=Ya,Ya.prototype={constructor:Ya,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Ya.propHooks[this.prop];return a&&a.get?a.get(this):Ya.propHooks._default.get(this)},run:function(a){var b,c=Ya.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ya.propHooks._default.set(this),this}},Ya.prototype.init.prototype=Ya.prototype,Ya.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Ya.propHooks.scrollTop=Ya.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Ya.prototype.init,r.fx.step={};var Za,$a,_a=/^(?:toggle|show|hide)$/,ab=/queueHooks$/;function bb(){$a&&(a.requestAnimationFrame(bb),r.fx.tick())}function cb(){return a.setTimeout(function(){Za=void 0}),Za=r.now()}function db(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ba[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function eb(a,b,c){for(var d,e=(hb.tweeners[b]||[]).concat(hb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function fb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ca(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],_a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ha([a],!0),j=a.style.display||j,k=r.css(a,"display"),ha([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ha([a],!0),m.done(function(){p||ha([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=eb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function gb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function hb(a,b,c){var d,e,f=0,g=hb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Za||cb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Za||cb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(gb(k,j.opts.specialEasing);f<g;f++)if(d=hb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,eb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}r.Animation=r.extend(hb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return ea(c.elem,a,aa.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;d<e;d++)c=a[d],hb.tweeners[c]=hb.tweeners[c]||[],hb.tweeners[c].unshift(b)},prefilters:[fb],prefilter:function(a,b){b?hb.prefilters.unshift(a):hb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:"number"!=typeof e.duration&&(e.duration in r.fx.speeds?e.duration=r.fx.speeds[e.duration]:e.duration=r.fx.speeds._default),null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ca).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=hb(this,r.extend({},a),f);(e||V.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&ab.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(db(b,!0),a,d,e)}}),r.each({slideDown:db("show"),slideUp:db("hide"),slideToggle:db("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Za=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),Za=void 0},r.fx.timer=function(a){r.timers.push(a),a()?r.fx.start():r.timers.pop()},r.fx.interval=13,r.fx.start=function(){$a||($a=a.requestAnimationFrame?a.requestAnimationFrame(bb):a.setInterval(r.fx.tick,r.fx.interval))},r.fx.stop=function(){a.cancelAnimationFrame?a.cancelAnimationFrame($a):a.clearInterval($a),$a=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var ib,jb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?ib:void 0)),
+void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),ib={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||r.find.attr;jb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=jb[g],jb[g]=e,e=null!=c(a,b,d)?g:null,jb[g]=f),e}});var kb=/^(?:input|select|textarea|button)$/i,lb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):kb.test(a.nodeName)||lb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function mb(a){var b=a.match(K)||[];return b.join(" ")}function nb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,nb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,nb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,nb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=nb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(nb(c))+" ").indexOf(b)>-1)return!0;return!1}});var ob=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ob,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:mb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,"$1"),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Qb=[],Rb=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Qb.pop()||r.expando+"_"+rb++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Rb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rb.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Rb,"$1"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Qb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=pa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=mb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length};function Sb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=Sb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||qa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=Sb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Oa(o.pixelPosition,function(a,c){if(c)return c=Na(a,b),La.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Tb=a.jQuery,Ub=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Ub),b&&a.jQuery===r&&(a.jQuery=Tb),r},b||(a.jQuery=a.$=r),r});
diff --git a/www/js/contrib/jquery.flot.js b/www/js/contrib/jquery.flot.js
new file mode 100644
index 00000000..39f3e4cf
--- /dev/null
+++ b/www/js/contrib/jquery.flot.js
@@ -0,0 +1,3168 @@
+/* Javascript plotting library for jQuery, version 0.8.3.
+
+Copyright (c) 2007-2014 IOLA and Ole Laursen.
+Licensed under the MIT license.
+
+*/
+
+// first an inline dependency, jquery.colorhelpers.js, we inline it here
+// for convenience
+
+/* Plugin for jQuery for working with colors.
+ *
+ * Version 1.1.
+ *
+ * Inspiration from jQuery color animation plugin by John Resig.
+ *
+ * Released under the MIT license by Ole Laursen, October 2009.
+ *
+ * Examples:
+ *
+ * $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()
+ * var c = $.color.extract($("#mydiv"), 'background-color');
+ * console.log(c.r, c.g, c.b, c.a);
+ * $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"
+ *
+ * Note that .scale() and .add() return the same modified object
+ * instead of making a new one.
+ *
+ * V. 1.1: Fix error handling so e.g. parsing an empty string does
+ * produce a color rather than just crashing.
+ */
+(function($){$.color={};$.color.make=function(r,g,b,a){var o={};o.r=r||0;o.g=g||0;o.b=b||0;o.a=a!=null?a:1;o.add=function(c,d){for(var i=0;i<c.length;++i)o[c.charAt(i)]+=d;return o.normalize()};o.scale=function(c,f){for(var i=0;i<c.length;++i)o[c.charAt(i)]*=f;return o.normalize()};o.toString=function(){if(o.a>=1){return"rgb("+[o.r,o.g,o.b].join(",")+")"}else{return"rgba("+[o.r,o.g,o.b,o.a].join(",")+")"}};o.normalize=function(){function clamp(min,value,max){return value<min?min:value>max?max:value}o.r=clamp(0,parseInt(o.r),255);o.g=clamp(0,parseInt(o.g),255);o.b=clamp(0,parseInt(o.b),255);o.a=clamp(0,o.a,1);return o};o.clone=function(){return $.color.make(o.r,o.b,o.g,o.a)};return o.normalize()};$.color.extract=function(elem,css){var c;do{c=elem.css(css).toLowerCase();if(c!=""&&c!="transparent")break;elem=elem.parent()}while(elem.length&&!$.nodeName(elem.get(0),"body"));if(c=="rgba(0, 0, 0, 0)")c="transparent";return $.color.parse(c)};$.color.parse=function(str){var res,m=$.color.make;if(res=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str))return m(parseInt(res[1],10),parseInt(res[2],10),parseInt(res[3],10));if(res=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))return m(parseInt(res[1],10),parseInt(res[2],10),parseInt(res[3],10),parseFloat(res[4]));if(res=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str))return m(parseFloat(res[1])*2.55,parseFloat(res[2])*2.55,parseFloat(res[3])*2.55);if(res=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))return m(parseFloat(res[1])*2.55,parseFloat(res[2])*2.55,parseFloat(res[3])*2.55,parseFloat(res[4]));if(res=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str))return m(parseInt(res[1],16),parseInt(res[2],16),parseInt(res[3],16));if(res=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str))return m(parseInt(res[1]+res[1],16),parseInt(res[2]+res[2],16),parseInt(res[3]+res[3],16));var name=$.trim(str).toLowerCase();if(name=="transparent")return m(255,255,255,0);else{res=lookupColors[name]||[0,0,0];return m(res[0],res[1],res[2])}};var lookupColors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
+
+// the actual Flot code
+(function($) {
+
+ // Cache the prototype hasOwnProperty for faster access
+
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+ // A shim to provide 'detach' to jQuery versions prior to 1.4. Using a DOM
+ // operation produces the same effect as detach, i.e. removing the element
+ // without touching its jQuery data.
+
+ // Do not merge this into Flot 0.9, since it requires jQuery 1.4.4+.
+
+ if (!$.fn.detach) {
+ $.fn.detach = function() {
+ return this.each(function() {
+ if (this.parentNode) {
+ this.parentNode.removeChild( this );
+ }
+ });
+ };
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // The Canvas object is a wrapper around an HTML5 <canvas> tag.
+ //
+ // @constructor
+ // @param {string} cls List of classes to apply to the canvas.
+ // @param {element} container Element onto which to append the canvas.
+ //
+ // Requiring a container is a little iffy, but unfortunately canvas
+ // operations don't work unless the canvas is attached to the DOM.
+
+ function Canvas(cls, container) {
+
+ var element = container.children("." + cls)[0];
+
+ if (element == null) {
+
+ element = document.createElement("canvas");
+ element.className = cls;
+
+ $(element).css({ direction: "ltr", position: "absolute", left: 0, top: 0 })
+ .appendTo(container);
+
+ // If HTML5 Canvas isn't available, fall back to [Ex|Flash]canvas
+
+ if (!element.getContext) {
+ if (window.G_vmlCanvasManager) {
+ element = window.G_vmlCanvasManager.initElement(element);
+ } else {
+ throw new Error("Canvas is not available. If you're using IE with a fall-back such as Excanvas, then there's either a mistake in your conditional include, or the page has no DOCTYPE and is rendering in Quirks Mode.");
+ }
+ }
+ }
+
+ this.element = element;
+
+ var context = this.context = element.getContext("2d");
+
+ // Determine the screen's ratio of physical to device-independent
+ // pixels. This is the ratio between the canvas width that the browser
+ // advertises and the number of pixels actually present in that space.
+
+ // The iPhone 4, for example, has a device-independent width of 320px,
+ // but its screen is actually 640px wide. It therefore has a pixel
+ // ratio of 2, while most normal devices have a ratio of 1.
+
+ var devicePixelRatio = window.devicePixelRatio || 1,
+ backingStoreRatio =
+ context.webkitBackingStorePixelRatio ||
+ context.mozBackingStorePixelRatio ||
+ context.msBackingStorePixelRatio ||
+ context.oBackingStorePixelRatio ||
+ context.backingStorePixelRatio || 1;
+
+ this.pixelRatio = devicePixelRatio / backingStoreRatio;
+
+ // Size the canvas to match the internal dimensions of its container
+
+ this.resize(container.width(), container.height());
+
+ // Collection of HTML div layers for text overlaid onto the canvas
+
+ this.textContainer = null;
+ this.text = {};
+
+ // Cache of text fragments and metrics, so we can avoid expensively
+ // re-calculating them when the plot is re-rendered in a loop.
+
+ this._textCache = {};
+ }
+
+ // Resizes the canvas to the given dimensions.
+ //
+ // @param {number} width New width of the canvas, in pixels.
+ // @param {number} width New height of the canvas, in pixels.
+
+ Canvas.prototype.resize = function(width, height) {
+
+ if (width <= 0 || height <= 0) {
+ throw new Error("Invalid dimensions for plot, width = " + width + ", height = " + height);
+ }
+
+ var element = this.element,
+ context = this.context,
+ pixelRatio = this.pixelRatio;
+
+ // Resize the canvas, increasing its density based on the display's
+ // pixel ratio; basically giving it more pixels without increasing the
+ // size of its element, to take advantage of the fact that retina
+ // displays have that many more pixels in the same advertised space.
+
+ // Resizing should reset the state (excanvas seems to be buggy though)
+
+ if (this.width != width) {
+ element.width = width * pixelRatio;
+ element.style.width = width + "px";
+ this.width = width;
+ }
+
+ if (this.height != height) {
+ element.height = height * pixelRatio;
+ element.style.height = height + "px";
+ this.height = height;
+ }
+
+ // Save the context, so we can reset in case we get replotted. The
+ // restore ensure that we're really back at the initial state, and
+ // should be safe even if we haven't saved the initial state yet.
+
+ context.restore();
+ context.save();
+
+ // Scale the coordinate space to match the display density; so even though we
+ // may have twice as many pixels, we still want lines and other drawing to
+ // appear at the same size; the extra pixels will just make them crisper.
+
+ context.scale(pixelRatio, pixelRatio);
+ };
+
+ // Clears the entire canvas area, not including any overlaid HTML text
+
+ Canvas.prototype.clear = function() {
+ this.context.clearRect(0, 0, this.width, this.height);
+ };
+
+ // Finishes rendering the canvas, including managing the text overlay.
+
+ Canvas.prototype.render = function() {
+
+ var cache = this._textCache;
+
+ // For each text layer, add elements marked as active that haven't
+ // already been rendered, and remove those that are no longer active.
+
+ for (var layerKey in cache) {
+ if (hasOwnProperty.call(cache, layerKey)) {
+
+ var layer = this.getTextLayer(layerKey),
+ layerCache = cache[layerKey];
+
+ layer.hide();
+
+ for (var styleKey in layerCache) {
+ if (hasOwnProperty.call(layerCache, styleKey)) {
+ var styleCache = layerCache[styleKey];
+ for (var key in styleCache) {
+ if (hasOwnProperty.call(styleCache, key)) {
+
+ var positions = styleCache[key].positions;
+
+ for (var i = 0, position; position = positions[i]; i++) {
+ if (position.active) {
+ if (!position.rendered) {
+ layer.append(position.element);
+ position.rendered = true;
+ }
+ } else {
+ positions.splice(i--, 1);
+ if (position.rendered) {
+ position.element.detach();
+ }
+ }
+ }
+
+ if (positions.length == 0) {
+ delete styleCache[key];
+ }
+ }
+ }
+ }
+ }
+
+ layer.show();
+ }
+ }
+ };
+
+ // Creates (if necessary) and returns the text overlay container.
+ //
+ // @param {string} classes String of space-separated CSS classes used to
+ // uniquely identify the text layer.
+ // @return {object} The jQuery-wrapped text-layer div.
+
+ Canvas.prototype.getTextLayer = function(classes) {
+
+ var layer = this.text[classes];
+
+ // Create the text layer if it doesn't exist
+
+ if (layer == null) {
+
+ // Create the text layer container, if it doesn't exist
+
+ if (this.textContainer == null) {
+ this.textContainer = $("<div class='flot-text'></div>")
+ .css({
+ position: "absolute",
+ top: 0,
+ left: 0,
+ bottom: 0,
+ right: 0,
+ 'font-size': "smaller",
+ color: "#545454"
+ })
+ .insertAfter(this.element);
+ }
+
+ layer = this.text[classes] = $("<div></div>")
+ .addClass(classes)
+ .css({
+ position: "absolute",
+ top: 0,
+ left: 0,
+ bottom: 0,
+ right: 0
+ })
+ .appendTo(this.textContainer);
+ }
+
+ return layer;
+ };
+
+ // Creates (if necessary) and returns a text info object.
+ //
+ // The object looks like this:
+ //
+ // {
+ // width: Width of the text's wrapper div.
+ // height: Height of the text's wrapper div.
+ // element: The jQuery-wrapped HTML div containing the text.
+ // positions: Array of positions at which this text is drawn.
+ // }
+ //
+ // The positions array contains objects that look like this:
+ //
+ // {
+ // active: Flag indicating whether the text should be visible.
+ // rendered: Flag indicating whether the text is currently visible.
+ // element: The jQuery-wrapped HTML div containing the text.
+ // x: X coordinate at which to draw the text.
+ // y: Y coordinate at which to draw the text.
+ // }
+ //
+ // Each position after the first receives a clone of the original element.
+ //
+ // The idea is that that the width, height, and general 'identity' of the
+ // text is constant no matter where it is placed; the placements are a
+ // secondary property.
+ //
+ // Canvas maintains a cache of recently-used text info objects; getTextInfo
+ // either returns the cached element or creates a new entry.
+ //
+ // @param {string} layer A string of space-separated CSS classes uniquely
+ // identifying the layer containing this text.
+ // @param {string} text Text string to retrieve info for.
+ // @param {(string|object)=} font Either a string of space-separated CSS
+ // classes or a font-spec object, defining the text's font and style.
+ // @param {number=} angle Angle at which to rotate the text, in degrees.
+ // Angle is currently unused, it will be implemented in the future.
+ // @param {number=} width Maximum width of the text before it wraps.
+ // @return {object} a text info object.
+
+ Canvas.prototype.getTextInfo = function(layer, text, font, angle, width) {
+
+ var textStyle, layerCache, styleCache, info;
+
+ // Cast the value to a string, in case we were given a number or such
+
+ text = "" + text;
+
+ // If the font is a font-spec object, generate a CSS font definition
+
+ if (typeof font === "object") {
+ textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px/" + font.lineHeight + "px " + font.family;
+ } else {
+ textStyle = font;
+ }
+
+ // Retrieve (or create) the cache for the text's layer and styles
+
+ layerCache = this._textCache[layer];
+
+ if (layerCache == null) {
+ layerCache = this._textCache[layer] = {};
+ }
+
+ styleCache = layerCache[textStyle];
+
+ if (styleCache == null) {
+ styleCache = layerCache[textStyle] = {};
+ }
+
+ info = styleCache[text];
+
+ // If we can't find a matching element in our cache, create a new one
+
+ if (info == null) {
+
+ var element = $("<div></div>").html(text)
+ .css({
+ position: "absolute",
+ 'max-width': width,
+ top: -9999
+ })
+ .appendTo(this.getTextLayer(layer));
+
+ if (typeof font === "object") {
+ element.css({
+ font: textStyle,
+ color: font.color
+ });
+ } else if (typeof font === "string") {
+ element.addClass(font);
+ }
+
+ info = styleCache[text] = {
+ width: element.outerWidth(true),
+ height: element.outerHeight(true),
+ element: element,
+ positions: []
+ };
+
+ element.detach();
+ }
+
+ return info;
+ };
+
+ // Adds a text string to the canvas text overlay.
+ //
+ // The text isn't drawn immediately; it is marked as rendering, which will
+ // result in its addition to the canvas on the next render pass.
+ //
+ // @param {string} layer A string of space-separated CSS classes uniquely
+ // identifying the layer containing this text.
+ // @param {number} x X coordinate at which to draw the text.
+ // @param {number} y Y coordinate at which to draw the text.
+ // @param {string} text Text string to draw.
+ // @param {(string|object)=} font Either a string of space-separated CSS
+ // classes or a font-spec object, defining the text's font and style.
+ // @param {number=} angle Angle at which to rotate the text, in degrees.
+ // Angle is currently unused, it will be implemented in the future.
+ // @param {number=} width Maximum width of the text before it wraps.
+ // @param {string=} halign Horizontal alignment of the text; either "left",
+ // "center" or "right".
+ // @param {string=} valign Vertical alignment of the text; either "top",
+ // "middle" or "bottom".
+
+ Canvas.prototype.addText = function(layer, x, y, text, font, angle, width, halign, valign) {
+
+ var info = this.getTextInfo(layer, text, font, angle, width),
+ positions = info.positions;
+
+ // Tweak the div's position to match the text's alignment
+
+ if (halign == "center") {
+ x -= info.width / 2;
+ } else if (halign == "right") {
+ x -= info.width;
+ }
+
+ if (valign == "middle") {
+ y -= info.height / 2;
+ } else if (valign == "bottom") {
+ y -= info.height;
+ }
+
+ // Determine whether this text already exists at this position.
+ // If so, mark it for inclusion in the next render pass.
+
+ for (var i = 0, position; position = positions[i]; i++) {
+ if (position.x == x && position.y == y) {
+ position.active = true;
+ return;
+ }
+ }
+
+ // If the text doesn't exist at this position, create a new entry
+
+ // For the very first position we'll re-use the original element,
+ // while for subsequent ones we'll clone it.
+
+ position = {
+ active: true,
+ rendered: false,
+ element: positions.length ? info.element.clone() : info.element,
+ x: x,
+ y: y
+ };
+
+ positions.push(position);
+
+ // Move the element to its final position within the container
+
+ position.element.css({
+ top: Math.round(y),
+ left: Math.round(x),
+ 'text-align': halign // In case the text wraps
+ });
+ };
+
+ // Removes one or more text strings from the canvas text overlay.
+ //
+ // If no parameters are given, all text within the layer is removed.
+ //
+ // Note that the text is not immediately removed; it is simply marked as
+ // inactive, which will result in its removal on the next render pass.
+ // This avoids the performance penalty for 'clear and redraw' behavior,
+ // where we potentially get rid of all text on a layer, but will likely
+ // add back most or all of it later, as when redrawing axes, for example.
+ //
+ // @param {string} layer A string of space-separated CSS classes uniquely
+ // identifying the layer containing this text.
+ // @param {number=} x X coordinate of the text.
+ // @param {number=} y Y coordinate of the text.
+ // @param {string=} text Text string to remove.
+ // @param {(string|object)=} font Either a string of space-separated CSS
+ // classes or a font-spec object, defining the text's font and style.
+ // @param {number=} angle Angle at which the text is rotated, in degrees.
+ // Angle is currently unused, it will be implemented in the future.
+
+ Canvas.prototype.removeText = function(layer, x, y, text, font, angle) {
+ if (text == null) {
+ var layerCache = this._textCache[layer];
+ if (layerCache != null) {
+ for (var styleKey in layerCache) {
+ if (hasOwnProperty.call(layerCache, styleKey)) {
+ var styleCache = layerCache[styleKey];
+ for (var key in styleCache) {
+ if (hasOwnProperty.call(styleCache, key)) {
+ var positions = styleCache[key].positions;
+ for (var i = 0, position; position = positions[i]; i++) {
+ position.active = false;
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ var positions = this.getTextInfo(layer, text, font, angle).positions;
+ for (var i = 0, position; position = positions[i]; i++) {
+ if (position.x == x && position.y == y) {
+ position.active = false;
+ }
+ }
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // The top-level container for the entire plot.
+
+ function Plot(placeholder, data_, options_, plugins) {
+ // data is on the form:
+ // [ series1, series2 ... ]
+ // where series is either just the data as [ [x1, y1], [x2, y2], ... ]
+ // or { data: [ [x1, y1], [x2, y2], ... ], label: "some label", ... }
+
+ var series = [],
+ options = {
+ // the color theme used for graphs
+ colors: ["#edc240", "#afd8f8", "#cb4b4b", "#4da74d", "#9440ed"],
+ legend: {
+ show: true,
+ noColumns: 1, // number of colums in legend table
+ labelFormatter: null, // fn: string -> string
+ labelBoxBorderColor: "#ccc", // border color for the little label boxes
+ container: null, // container (as jQuery object) to put legend in, null means default on top of graph
+ position: "ne", // position of default legend container within plot
+ margin: 5, // distance from grid edge to default legend container within plot
+ backgroundColor: null, // null means auto-detect
+ backgroundOpacity: 0.85, // set to 0 to avoid background
+ sorted: null // default to no legend sorting
+ },
+ xaxis: {
+ show: null, // null = auto-detect, true = always, false = never
+ position: "bottom", // or "top"
+ mode: null, // null or "time"
+ font: null, // null (derived from CSS in placeholder) or object like { size: 11, lineHeight: 13, style: "italic", weight: "bold", family: "sans-serif", variant: "small-caps" }
+ color: null, // base color, labels, ticks
+ tickColor: null, // possibly different color of ticks, e.g. "rgba(0,0,0,0.15)"
+ transform: null, // null or f: number -> number to transform axis
+ inverseTransform: null, // if transform is set, this should be the inverse function
+ min: null, // min. value to show, null means set automatically
+ max: null, // max. value to show, null means set automatically
+ autoscaleMargin: null, // margin in % to add if auto-setting min/max
+ ticks: null, // either [1, 3] or [[1, "a"], 3] or (fn: axis info -> ticks) or app. number of ticks for auto-ticks
+ tickFormatter: null, // fn: number -> string
+ labelWidth: null, // size of tick labels in pixels
+ labelHeight: null,
+ reserveSpace: null, // whether to reserve space even if axis isn't shown
+ tickLength: null, // size in pixels of ticks, or "full" for whole line
+ alignTicksWithAxis: null, // axis number or null for no sync
+ tickDecimals: null, // no. of decimals, null means auto
+ tickSize: null, // number or [number, "unit"]
+ minTickSize: null // number or [number, "unit"]
+ },
+ yaxis: {
+ autoscaleMargin: 0.02,
+ position: "left" // or "right"
+ },
+ xaxes: [],
+ yaxes: [],
+ series: {
+ points: {
+ show: false,
+ radius: 3,
+ lineWidth: 2, // in pixels
+ fill: true,
+ fillColor: "#ffffff",
+ symbol: "circle" // or callback
+ },
+ lines: {
+ // we don't put in show: false so we can see
+ // whether lines were actively disabled
+ lineWidth: 2, // in pixels
+ fill: false,
+ fillColor: null,
+ steps: false
+ // Omit 'zero', so we can later default its value to
+ // match that of the 'fill' option.
+ },
+ bars: {
+ show: false,
+ lineWidth: 2, // in pixels
+ barWidth: 1, // in units of the x axis
+ fill: true,
+ fillColor: null,
+ align: "left", // "left", "right", or "center"
+ horizontal: false,
+ zero: true
+ },
+ shadowSize: 3,
+ highlightColor: null
+ },
+ grid: {
+ show: true,
+ aboveData: false,
+ color: "#545454", // primary color used for outline and labels
+ backgroundColor: null, // null for transparent, else color
+ borderColor: null, // set if different from the grid color
+ tickColor: null, // color for the ticks, e.g. "rgba(0,0,0,0.15)"
+ margin: 0, // distance from the canvas edge to the grid
+ labelMargin: 5, // in pixels
+ axisMargin: 8, // in pixels
+ borderWidth: 2, // in pixels
+ minBorderMargin: null, // in pixels, null means taken from points radius
+ markings: null, // array of ranges or fn: axes -> array of ranges
+ markingsColor: "#f4f4f4",
+ markingsLineWidth: 2,
+ // interactive stuff
+ clickable: false,
+ hoverable: false,
+ autoHighlight: true, // highlight in case mouse is near
+ mouseActiveRadius: 10 // how far the mouse can be away to activate an item
+ },
+ interaction: {
+ redrawOverlayInterval: 1000/60 // time between updates, -1 means in same flow
+ },
+ hooks: {}
+ },
+ surface = null, // the canvas for the plot itself
+ overlay = null, // canvas for interactive stuff on top of plot
+ eventHolder = null, // jQuery object that events should be bound to
+ ctx = null, octx = null,
+ xaxes = [], yaxes = [],
+ plotOffset = { left: 0, right: 0, top: 0, bottom: 0},
+ plotWidth = 0, plotHeight = 0,
+ hooks = {
+ processOptions: [],
+ processRawData: [],
+ processDatapoints: [],
+ processOffset: [],
+ drawBackground: [],
+ drawSeries: [],
+ draw: [],
+ bindEvents: [],
+ drawOverlay: [],
+ shutdown: []
+ },
+ plot = this;
+
+ // public functions
+ plot.setData = setData;
+ plot.setupGrid = setupGrid;
+ plot.draw = draw;
+ plot.getPlaceholder = function() { return placeholder; };
+ plot.getCanvas = function() { return surface.element; };
+ plot.getPlotOffset = function() { return plotOffset; };
+ plot.width = function () { return plotWidth; };
+ plot.height = function () { return plotHeight; };
+ plot.offset = function () {
+ var o = eventHolder.offset();
+ o.left += plotOffset.left;
+ o.top += plotOffset.top;
+ return o;
+ };
+ plot.getData = function () { return series; };
+ plot.getAxes = function () {
+ var res = {}, i;
+ $.each(xaxes.concat(yaxes), function (_, axis) {
+ if (axis)
+ res[axis.direction + (axis.n != 1 ? axis.n : "") + "axis"] = axis;
+ });
+ return res;
+ };
+ plot.getXAxes = function () { return xaxes; };
+ plot.getYAxes = function () { return yaxes; };
+ plot.c2p = canvasToAxisCoords;
+ plot.p2c = axisToCanvasCoords;
+ plot.getOptions = function () { return options; };
+ plot.highlight = highlight;
+ plot.unhighlight = unhighlight;
+ plot.triggerRedrawOverlay = triggerRedrawOverlay;
+ plot.pointOffset = function(point) {
+ return {
+ left: parseInt(xaxes[axisNumber(point, "x") - 1].p2c(+point.x) + plotOffset.left, 10),
+ top: parseInt(yaxes[axisNumber(point, "y") - 1].p2c(+point.y) + plotOffset.top, 10)
+ };
+ };
+ plot.shutdown = shutdown;
+ plot.destroy = function () {
+ shutdown();
+ placeholder.removeData("plot").empty();
+
+ series = [];
+ options = null;
+ surface = null;
+ overlay = null;
+ eventHolder = null;
+ ctx = null;
+ octx = null;
+ xaxes = [];
+ yaxes = [];
+ hooks = null;
+ highlights = [];
+ plot = null;
+ };
+ plot.resize = function () {
+ var width = placeholder.width(),
+ height = placeholder.height();
+ surface.resize(width, height);
+ overlay.resize(width, height);
+ };
+
+ // public attributes
+ plot.hooks = hooks;
+
+ // initialize
+ initPlugins(plot);
+ parseOptions(options_);
+ setupCanvases();
+ setData(data_);
+ setupGrid();
+ draw();
+ bindEvents();
+
+
+ function executeHooks(hook, args) {
+ args = [plot].concat(args);
+ for (var i = 0; i < hook.length; ++i)
+ hook[i].apply(this, args);
+ }
+
+ function initPlugins() {
+
+ // References to key classes, allowing plugins to modify them
+
+ var classes = {
+ Canvas: Canvas
+ };
+
+ for (var i = 0; i < plugins.length; ++i) {
+ var p = plugins[i];
+ p.init(plot, classes);
+ if (p.options)
+ $.extend(true, options, p.options);
+ }
+ }
+
+ function parseOptions(opts) {
+
+ $.extend(true, options, opts);
+
+ // $.extend merges arrays, rather than replacing them. When less
+ // colors are provided than the size of the default palette, we
+ // end up with those colors plus the remaining defaults, which is
+ // not expected behavior; avoid it by replacing them here.
+
+ if (opts && opts.colors) {
+ options.colors = opts.colors;
+ }
+
+ if (options.xaxis.color == null)
+ options.xaxis.color = $.color.parse(options.grid.color).scale('a', 0.22).toString();
+ if (options.yaxis.color == null)
+ options.yaxis.color = $.color.parse(options.grid.color).scale('a', 0.22).toString();
+
+ if (options.xaxis.tickColor == null) // grid.tickColor for back-compatibility
+ options.xaxis.tickColor = options.grid.tickColor || options.xaxis.color;
+ if (options.yaxis.tickColor == null) // grid.tickColor for back-compatibility
+ options.yaxis.tickColor = options.grid.tickColor || options.yaxis.color;
+
+ if (options.grid.borderColor == null)
+ options.grid.borderColor = options.grid.color;
+ if (options.grid.tickColor == null)
+ options.grid.tickColor = $.color.parse(options.grid.color).scale('a', 0.22).toString();
+
+ // Fill in defaults for axis options, including any unspecified
+ // font-spec fields, if a font-spec was provided.
+
+ // If no x/y axis options were provided, create one of each anyway,
+ // since the rest of the code assumes that they exist.
+
+ var i, axisOptions, axisCount,
+ fontSize = placeholder.css("font-size"),
+ fontSizeDefault = fontSize ? +fontSize.replace("px", "") : 13,
+ fontDefaults = {
+ style: placeholder.css("font-style"),
+ size: Math.round(0.8 * fontSizeDefault),
+ variant: placeholder.css("font-variant"),
+ weight: placeholder.css("font-weight"),
+ family: placeholder.css("font-family")
+ };
+
+ axisCount = options.xaxes.length || 1;
+ for (i = 0; i < axisCount; ++i) {
+
+ axisOptions = options.xaxes[i];
+ if (axisOptions && !axisOptions.tickColor) {
+ axisOptions.tickColor = axisOptions.color;
+ }
+
+ axisOptions = $.extend(true, {}, options.xaxis, axisOptions);
+ options.xaxes[i] = axisOptions;
+
+ if (axisOptions.font) {
+ axisOptions.font = $.extend({}, fontDefaults, axisOptions.font);
+ if (!axisOptions.font.color) {
+ axisOptions.font.color = axisOptions.color;
+ }
+ if (!axisOptions.font.lineHeight) {
+ axisOptions.font.lineHeight = Math.round(axisOptions.font.size * 1.15);
+ }
+ }
+ }
+
+ axisCount = options.yaxes.length || 1;
+ for (i = 0; i < axisCount; ++i) {
+
+ axisOptions = options.yaxes[i];
+ if (axisOptions && !axisOptions.tickColor) {
+ axisOptions.tickColor = axisOptions.color;
+ }
+
+ axisOptions = $.extend(true, {}, options.yaxis, axisOptions);
+ options.yaxes[i] = axisOptions;
+
+ if (axisOptions.font) {
+ axisOptions.font = $.extend({}, fontDefaults, axisOptions.font);
+ if (!axisOptions.font.color) {
+ axisOptions.font.color = axisOptions.color;
+ }
+ if (!axisOptions.font.lineHeight) {
+ axisOptions.font.lineHeight = Math.round(axisOptions.font.size * 1.15);
+ }
+ }
+ }
+
+ // backwards compatibility, to be removed in future
+ if (options.xaxis.noTicks && options.xaxis.ticks == null)
+ options.xaxis.ticks = options.xaxis.noTicks;
+ if (options.yaxis.noTicks && options.yaxis.ticks == null)
+ options.yaxis.ticks = options.yaxis.noTicks;
+ if (options.x2axis) {
+ options.xaxes[1] = $.extend(true, {}, options.xaxis, options.x2axis);
+ options.xaxes[1].position = "top";
+ // Override the inherit to allow the axis to auto-scale
+ if (options.x2axis.min == null) {
+ options.xaxes[1].min = null;
+ }
+ if (options.x2axis.max == null) {
+ options.xaxes[1].max = null;
+ }
+ }
+ if (options.y2axis) {
+ options.yaxes[1] = $.extend(true, {}, options.yaxis, options.y2axis);
+ options.yaxes[1].position = "right";
+ // Override the inherit to allow the axis to auto-scale
+ if (options.y2axis.min == null) {
+ options.yaxes[1].min = null;
+ }
+ if (options.y2axis.max == null) {
+ options.yaxes[1].max = null;
+ }
+ }
+ if (options.grid.coloredAreas)
+ options.grid.markings = options.grid.coloredAreas;
+ if (options.grid.coloredAreasColor)
+ options.grid.markingsColor = options.grid.coloredAreasColor;
+ if (options.lines)
+ $.extend(true, options.series.lines, options.lines);
+ if (options.points)
+ $.extend(true, options.series.points, options.points);
+ if (options.bars)
+ $.extend(true, options.series.bars, options.bars);
+ if (options.shadowSize != null)
+ options.series.shadowSize = options.shadowSize;
+ if (options.highlightColor != null)
+ options.series.highlightColor = options.highlightColor;
+
+ // save options on axes for future reference
+ for (i = 0; i < options.xaxes.length; ++i)
+ getOrCreateAxis(xaxes, i + 1).options = options.xaxes[i];
+ for (i = 0; i < options.yaxes.length; ++i)
+ getOrCreateAxis(yaxes, i + 1).options = options.yaxes[i];
+
+ // add hooks from options
+ for (var n in hooks)
+ if (options.hooks[n] && options.hooks[n].length)
+ hooks[n] = hooks[n].concat(options.hooks[n]);
+
+ executeHooks(hooks.processOptions, [options]);
+ }
+
+ function setData(d) {
+ series = parseData(d);
+ fillInSeriesOptions();
+ processData();
+ }
+
+ function parseData(d) {
+ var res = [];
+ for (var i = 0; i < d.length; ++i) {
+ var s = $.extend(true, {}, options.series);
+
+ if (d[i].data != null) {
+ s.data = d[i].data; // move the data instead of deep-copy
+ delete d[i].data;
+
+ $.extend(true, s, d[i]);
+
+ d[i].data = s.data;
+ }
+ else
+ s.data = d[i];
+ res.push(s);
+ }
+
+ return res;
+ }
+
+ function axisNumber(obj, coord) {
+ var a = obj[coord + "axis"];
+ if (typeof a == "object") // if we got a real axis, extract number
+ a = a.n;
+ if (typeof a != "number")
+ a = 1; // default to first axis
+ return a;
+ }
+
+ function allAxes() {
+ // return flat array without annoying null entries
+ return $.grep(xaxes.concat(yaxes), function (a) { return a; });
+ }
+
+ function canvasToAxisCoords(pos) {
+ // return an object with x/y corresponding to all used axes
+ var res = {}, i, axis;
+ for (i = 0; i < xaxes.length; ++i) {
+ axis = xaxes[i];
+ if (axis && axis.used)
+ res["x" + axis.n] = axis.c2p(pos.left);
+ }
+
+ for (i = 0; i < yaxes.length; ++i) {
+ axis = yaxes[i];
+ if (axis && axis.used)
+ res["y" + axis.n] = axis.c2p(pos.top);
+ }
+
+ if (res.x1 !== undefined)
+ res.x = res.x1;
+ if (res.y1 !== undefined)
+ res.y = res.y1;
+
+ return res;
+ }
+
+ function axisToCanvasCoords(pos) {
+ // get canvas coords from the first pair of x/y found in pos
+ var res = {}, i, axis, key;
+
+ for (i = 0; i < xaxes.length; ++i) {
+ axis = xaxes[i];
+ if (axis && axis.used) {
+ key = "x" + axis.n;
+ if (pos[key] == null && axis.n == 1)
+ key = "x";
+
+ if (pos[key] != null) {
+ res.left = axis.p2c(pos[key]);
+ break;
+ }
+ }
+ }
+
+ for (i = 0; i < yaxes.length; ++i) {
+ axis = yaxes[i];
+ if (axis && axis.used) {
+ key = "y" + axis.n;
+ if (pos[key] == null && axis.n == 1)
+ key = "y";
+
+ if (pos[key] != null) {
+ res.top = axis.p2c(pos[key]);
+ break;
+ }
+ }
+ }
+
+ return res;
+ }
+
+ function getOrCreateAxis(axes, number) {
+ if (!axes[number - 1])
+ axes[number - 1] = {
+ n: number, // save the number for future reference
+ direction: axes == xaxes ? "x" : "y",
+ options: $.extend(true, {}, axes == xaxes ? options.xaxis : options.yaxis)
+ };
+
+ return axes[number - 1];
+ }
+
+ function fillInSeriesOptions() {
+
+ var neededColors = series.length, maxIndex = -1, i;
+
+ // Subtract the number of series that already have fixed colors or
+ // color indexes from the number that we still need to generate.
+
+ for (i = 0; i < series.length; ++i) {
+ var sc = series[i].color;
+ if (sc != null) {
+ neededColors--;
+ if (typeof sc == "number" && sc > maxIndex) {
+ maxIndex = sc;
+ }
+ }
+ }
+
+ // If any of the series have fixed color indexes, then we need to
+ // generate at least as many colors as the highest index.
+
+ if (neededColors <= maxIndex) {
+ neededColors = maxIndex + 1;
+ }
+
+ // Generate all the colors, using first the option colors and then
+ // variations on those colors once they're exhausted.
+
+ var c, colors = [], colorPool = options.colors,
+ colorPoolSize = colorPool.length, variation = 0;
+
+ for (i = 0; i < neededColors; i++) {
+
+ c = $.color.parse(colorPool[i % colorPoolSize] || "#666");
+
+ // Each time we exhaust the colors in the pool we adjust
+ // a scaling factor used to produce more variations on
+ // those colors. The factor alternates negative/positive
+ // to produce lighter/darker colors.
+
+ // Reset the variation after every few cycles, or else
+ // it will end up producing only white or black colors.
+
+ if (i % colorPoolSize == 0 && i) {
+ if (variation >= 0) {
+ if (variation < 0.5) {
+ variation = -variation - 0.2;
+ } else variation = 0;
+ } else variation = -variation;
+ }
+
+ colors[i] = c.scale('rgb', 1 + variation);
+ }
+
+ // Finalize the series options, filling in their colors
+
+ var colori = 0, s;
+ for (i = 0; i < series.length; ++i) {
+ s = series[i];
+
+ // assign colors
+ if (s.color == null) {
+ s.color = colors[colori].toString();
+ ++colori;
+ }
+ else if (typeof s.color == "number")
+ s.color = colors[s.color].toString();
+
+ // turn on lines automatically in case nothing is set
+ if (s.lines.show == null) {
+ var v, show = true;
+ for (v in s)
+ if (s[v] && s[v].show) {
+ show = false;
+ break;
+ }
+ if (show)
+ s.lines.show = true;
+ }
+
+ // If nothing was provided for lines.zero, default it to match
+ // lines.fill, since areas by default should extend to zero.
+
+ if (s.lines.zero == null) {
+ s.lines.zero = !!s.lines.fill;
+ }
+
+ // setup axes
+ s.xaxis = getOrCreateAxis(xaxes, axisNumber(s, "x"));
+ s.yaxis = getOrCreateAxis(yaxes, axisNumber(s, "y"));
+ }
+ }
+
+ function processData() {
+ var topSentry = Number.POSITIVE_INFINITY,
+ bottomSentry = Number.NEGATIVE_INFINITY,
+ fakeInfinity = Number.MAX_VALUE,
+ i, j, k, m, length,
+ s, points, ps, x, y, axis, val, f, p,
+ data, format;
+
+ function updateAxis(axis, min, max) {
+ if (min < axis.datamin && min != -fakeInfinity)
+ axis.datamin = min;
+ if (max > axis.datamax && max != fakeInfinity)
+ axis.datamax = max;
+ }
+
+ $.each(allAxes(), function (_, axis) {
+ // init axis
+ axis.datamin = topSentry;
+ axis.datamax = bottomSentry;
+ axis.used = false;
+ });
+
+ for (i = 0; i < series.length; ++i) {
+ s = series[i];
+ s.datapoints = { points: [] };
+
+ executeHooks(hooks.processRawData, [ s, s.data, s.datapoints ]);
+ }
+
+ // first pass: clean and copy data
+ for (i = 0; i < series.length; ++i) {
+ s = series[i];
+
+ data = s.data;
+ format = s.datapoints.format;
+
+ if (!format) {
+ format = [];
+ // find out how to copy
+ format.push({ x: true, number: true, required: true });
+ format.push({ y: true, number: true, required: true });
+
+ if (s.bars.show || (s.lines.show && s.lines.fill)) {
+ var autoscale = !!((s.bars.show && s.bars.zero) || (s.lines.show && s.lines.zero));
+ format.push({ y: true, number: true, required: false, defaultValue: 0, autoscale: autoscale });
+ if (s.bars.horizontal) {
+ delete format[format.length - 1].y;
+ format[format.length - 1].x = true;
+ }
+ }
+
+ s.datapoints.format = format;
+ }
+
+ if (s.datapoints.pointsize != null)
+ continue; // already filled in
+
+ s.datapoints.pointsize = format.length;
+
+ ps = s.datapoints.pointsize;
+ points = s.datapoints.points;
+
+ var insertSteps = s.lines.show && s.lines.steps;
+ s.xaxis.used = s.yaxis.used = true;
+
+ for (j = k = 0; j < data.length; ++j, k += ps) {
+ p = data[j];
+
+ var nullify = p == null;
+ if (!nullify) {
+ for (m = 0; m < ps; ++m) {
+ val = p[m];
+ f = format[m];
+
+ if (f) {
+ if (f.number && val != null) {
+ val = +val; // convert to number
+ if (isNaN(val))
+ val = null;
+ else if (val == Infinity)
+ val = fakeInfinity;
+ else if (val == -Infinity)
+ val = -fakeInfinity;
+ }
+
+ if (val == null) {
+ if (f.required)
+ nullify = true;
+
+ if (f.defaultValue != null)
+ val = f.defaultValue;
+ }
+ }
+
+ points[k + m] = val;
+ }
+ }
+
+ if (nullify) {
+ for (m = 0; m < ps; ++m) {
+ val = points[k + m];
+ if (val != null) {
+ f = format[m];
+ // extract min/max info
+ if (f.autoscale !== false) {
+ if (f.x) {
+ updateAxis(s.xaxis, val, val);
+ }
+ if (f.y) {
+ updateAxis(s.yaxis, val, val);
+ }
+ }
+ }
+ points[k + m] = null;
+ }
+ }
+ else {
+ // a little bit of line specific stuff that
+ // perhaps shouldn't be here, but lacking
+ // better means...
+ if (insertSteps && k > 0
+ && points[k - ps] != null
+ && points[k - ps] != points[k]
+ && points[k - ps + 1] != points[k + 1]) {
+ // copy the point to make room for a middle point
+ for (m = 0; m < ps; ++m)
+ points[k + ps + m] = points[k + m];
+
+ // middle point has same y
+ points[k + 1] = points[k - ps + 1];
+
+ // we've added a point, better reflect that
+ k += ps;
+ }
+ }
+ }
+ }
+
+ // give the hooks a chance to run
+ for (i = 0; i < series.length; ++i) {
+ s = series[i];
+
+ executeHooks(hooks.processDatapoints, [ s, s.datapoints]);
+ }
+
+ // second pass: find datamax/datamin for auto-scaling
+ for (i = 0; i < series.length; ++i) {
+ s = series[i];
+ points = s.datapoints.points;
+ ps = s.datapoints.pointsize;
+ format = s.datapoints.format;
+
+ var xmin = topSentry, ymin = topSentry,
+ xmax = bottomSentry, ymax = bottomSentry;
+
+ for (j = 0; j < points.length; j += ps) {
+ if (points[j] == null)
+ continue;
+
+ for (m = 0; m < ps; ++m) {
+ val = points[j + m];
+ f = format[m];
+ if (!f || f.autoscale === false || val == fakeInfinity || val == -fakeInfinity)
+ continue;
+
+ if (f.x) {
+ if (val < xmin)
+ xmin = val;
+ if (val > xmax)
+ xmax = val;
+ }
+ if (f.y) {
+ if (val < ymin)
+ ymin = val;
+ if (val > ymax)
+ ymax = val;
+ }
+ }
+ }
+
+ if (s.bars.show) {
+ // make sure we got room for the bar on the dancing floor
+ var delta;
+
+ switch (s.bars.align) {
+ case "left":
+ delta = 0;
+ break;
+ case "right":
+ delta = -s.bars.barWidth;
+ break;
+ default:
+ delta = -s.bars.barWidth / 2;
+ }
+
+ if (s.bars.horizontal) {
+ ymin += delta;
+ ymax += delta + s.bars.barWidth;
+ }
+ else {
+ xmin += delta;
+ xmax += delta + s.bars.barWidth;
+ }
+ }
+
+ updateAxis(s.xaxis, xmin, xmax);
+ updateAxis(s.yaxis, ymin, ymax);
+ }
+
+ $.each(allAxes(), function (_, axis) {
+ if (axis.datamin == topSentry)
+ axis.datamin = null;
+ if (axis.datamax == bottomSentry)
+ axis.datamax = null;
+ });
+ }
+
+ function setupCanvases() {
+
+ // Make sure the placeholder is clear of everything except canvases
+ // from a previous plot in this container that we'll try to re-use.
+
+ placeholder.css("padding", 0) // padding messes up the positioning
+ .children().filter(function(){
+ return !$(this).hasClass("flot-overlay") && !$(this).hasClass('flot-base');
+ }).remove();
+
+ if (placeholder.css("position") == 'static')
+ placeholder.css("position", "relative"); // for positioning labels and overlay
+
+ surface = new Canvas("flot-base", placeholder);
+ overlay = new Canvas("flot-overlay", placeholder); // overlay canvas for interactive features
+
+ ctx = surface.context;
+ octx = overlay.context;
+
+ // define which element we're listening for events on
+ eventHolder = $(overlay.element).unbind();
+
+ // If we're re-using a plot object, shut down the old one
+
+ var existing = placeholder.data("plot");
+
+ if (existing) {
+ existing.shutdown();
+ overlay.clear();
+ }
+
+ // save in case we get replotted
+ placeholder.data("plot", plot);
+ }
+
+ function bindEvents() {
+ // bind events
+ if (options.grid.hoverable) {
+ eventHolder.mousemove(onMouseMove);
+
+ // Use bind, rather than .mouseleave, because we officially
+ // still support jQuery 1.2.6, which doesn't define a shortcut
+ // for mouseenter or mouseleave. This was a bug/oversight that
+ // was fixed somewhere around 1.3.x. We can return to using
+ // .mouseleave when we drop support for 1.2.6.
+
+ eventHolder.bind("mouseleave", onMouseLeave);
+ }
+
+ if (options.grid.clickable)
+ eventHolder.click(onClick);
+
+ executeHooks(hooks.bindEvents, [eventHolder]);
+ }
+
+ function shutdown() {
+ if (redrawTimeout)
+ clearTimeout(redrawTimeout);
+
+ eventHolder.unbind("mousemove", onMouseMove);
+ eventHolder.unbind("mouseleave", onMouseLeave);
+ eventHolder.unbind("click", onClick);
+
+ executeHooks(hooks.shutdown, [eventHolder]);
+ }
+
+ function setTransformationHelpers(axis) {
+ // set helper functions on the axis, assumes plot area
+ // has been computed already
+
+ function identity(x) { return x; }
+
+ var s, m, t = axis.options.transform || identity,
+ it = axis.options.inverseTransform;
+
+ // precompute how much the axis is scaling a point
+ // in canvas space
+ if (axis.direction == "x") {
+ s = axis.scale = plotWidth / Math.abs(t(axis.max) - t(axis.min));
+ m = Math.min(t(axis.max), t(axis.min));
+ }
+ else {
+ s = axis.scale = plotHeight / Math.abs(t(axis.max) - t(axis.min));
+ s = -s;
+ m = Math.max(t(axis.max), t(axis.min));
+ }
+
+ // data point to canvas coordinate
+ if (t == identity) // slight optimization
+ axis.p2c = function (p) { return (p - m) * s; };
+ else
+ axis.p2c = function (p) { return (t(p) - m) * s; };
+ // canvas coordinate to data point
+ if (!it)
+ axis.c2p = function (c) { return m + c / s; };
+ else
+ axis.c2p = function (c) { return it(m + c / s); };
+ }
+
+ function measureTickLabels(axis) {
+
+ var opts = axis.options,
+ ticks = axis.ticks || [],
+ labelWidth = opts.labelWidth || 0,
+ labelHeight = opts.labelHeight || 0,
+ maxWidth = labelWidth || (axis.direction == "x" ? Math.floor(surface.width / (ticks.length || 1)) : null),
+ legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis",
+ layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles,
+ font = opts.font || "flot-tick-label tickLabel";
+
+ for (var i = 0; i < ticks.length; ++i) {
+
+ var t = ticks[i];
+
+ if (!t.label)
+ continue;
+
+ var info = surface.getTextInfo(layer, t.label, font, null, maxWidth);
+
+ labelWidth = Math.max(labelWidth, info.width);
+ labelHeight = Math.max(labelHeight, info.height);
+ }
+
+ axis.labelWidth = opts.labelWidth || labelWidth;
+ axis.labelHeight = opts.labelHeight || labelHeight;
+ }
+
+ function allocateAxisBoxFirstPhase(axis) {
+ // find the bounding box of the axis by looking at label
+ // widths/heights and ticks, make room by diminishing the
+ // plotOffset; this first phase only looks at one
+ // dimension per axis, the other dimension depends on the
+ // other axes so will have to wait
+
+ var lw = axis.labelWidth,
+ lh = axis.labelHeight,
+ pos = axis.options.position,
+ isXAxis = axis.direction === "x",
+ tickLength = axis.options.tickLength,
+ axisMargin = options.grid.axisMargin,
+ padding = options.grid.labelMargin,
+ innermost = true,
+ outermost = true,
+ first = true,
+ found = false;
+
+ // Determine the axis's position in its direction and on its side
+
+ $.each(isXAxis ? xaxes : yaxes, function(i, a) {
+ if (a && (a.show || a.reserveSpace)) {
+ if (a === axis) {
+ found = true;
+ } else if (a.options.position === pos) {
+ if (found) {
+ outermost = false;
+ } else {
+ innermost = false;
+ }
+ }
+ if (!found) {
+ first = false;
+ }
+ }
+ });
+
+ // The outermost axis on each side has no margin
+
+ if (outermost) {
+ axisMargin = 0;
+ }
+
+ // The ticks for the first axis in each direction stretch across
+
+ if (tickLength == null) {
+ tickLength = first ? "full" : 5;
+ }
+
+ if (!isNaN(+tickLength))
+ padding += +tickLength;
+
+ if (isXAxis) {
+ lh += padding;
+
+ if (pos == "bottom") {
+ plotOffset.bottom += lh + axisMargin;
+ axis.box = { top: surface.height - plotOffset.bottom, height: lh };
+ }
+ else {
+ axis.box = { top: plotOffset.top + axisMargin, height: lh };
+ plotOffset.top += lh + axisMargin;
+ }
+ }
+ else {
+ lw += padding;
+
+ if (pos == "left") {
+ axis.box = { left: plotOffset.left + axisMargin, width: lw };
+ plotOffset.left += lw + axisMargin;
+ }
+ else {
+ plotOffset.right += lw + axisMargin;
+ axis.box = { left: surface.width - plotOffset.right, width: lw };
+ }
+ }
+
+ // save for future reference
+ axis.position = pos;
+ axis.tickLength = tickLength;
+ axis.box.padding = padding;
+ axis.innermost = innermost;
+ }
+
+ function allocateAxisBoxSecondPhase(axis) {
+ // now that all axis boxes have been placed in one
+ // dimension, we can set the remaining dimension coordinates
+ if (axis.direction == "x") {
+ axis.box.left = plotOffset.left - axis.labelWidth / 2;
+ axis.box.width = surface.width - plotOffset.left - plotOffset.right + axis.labelWidth;
+ }
+ else {
+ axis.box.top = plotOffset.top - axis.labelHeight / 2;
+ axis.box.height = surface.height - plotOffset.bottom - plotOffset.top + axis.labelHeight;
+ }
+ }
+
+ function adjustLayoutForThingsStickingOut() {
+ // possibly adjust plot offset to ensure everything stays
+ // inside the canvas and isn't clipped off
+
+ var minMargin = options.grid.minBorderMargin,
+ axis, i;
+
+ // check stuff from the plot (FIXME: this should just read
+ // a value from the series, otherwise it's impossible to
+ // customize)
+ if (minMargin == null) {
+ minMargin = 0;
+ for (i = 0; i < series.length; ++i)
+ minMargin = Math.max(minMargin, 2 * (series[i].points.radius + series[i].points.lineWidth/2));
+ }
+
+ var margins = {
+ left: minMargin,
+ right: minMargin,
+ top: minMargin,
+ bottom: minMargin
+ };
+
+ // check axis labels, note we don't check the actual
+ // labels but instead use the overall width/height to not
+ // jump as much around with replots
+ $.each(allAxes(), function (_, axis) {
+ if (axis.reserveSpace && axis.ticks && axis.ticks.length) {
+ if (axis.direction === "x") {
+ margins.left = Math.max(margins.left, axis.labelWidth / 2);
+ margins.right = Math.max(margins.right, axis.labelWidth / 2);
+ } else {
+ margins.bottom = Math.max(margins.bottom, axis.labelHeight / 2);
+ margins.top = Math.max(margins.top, axis.labelHeight / 2);
+ }
+ }
+ });
+
+ plotOffset.left = Math.ceil(Math.max(margins.left, plotOffset.left));
+ plotOffset.right = Math.ceil(Math.max(margins.right, plotOffset.right));
+ plotOffset.top = Math.ceil(Math.max(margins.top, plotOffset.top));
+ plotOffset.bottom = Math.ceil(Math.max(margins.bottom, plotOffset.bottom));
+ }
+
+ function setupGrid() {
+ var i, axes = allAxes(), showGrid = options.grid.show;
+
+ // Initialize the plot's offset from the edge of the canvas
+
+ for (var a in plotOffset) {
+ var margin = options.grid.margin || 0;
+ plotOffset[a] = typeof margin == "number" ? margin : margin[a] || 0;
+ }
+
+ executeHooks(hooks.processOffset, [plotOffset]);
+
+ // If the grid is visible, add its border width to the offset
+
+ for (var a in plotOffset) {
+ if(typeof(options.grid.borderWidth) == "object") {
+ plotOffset[a] += showGrid ? options.grid.borderWidth[a] : 0;
+ }
+ else {
+ plotOffset[a] += showGrid ? options.grid.borderWidth : 0;
+ }
+ }
+
+ $.each(axes, function (_, axis) {
+ var axisOpts = axis.options;
+ axis.show = axisOpts.show == null ? axis.used : axisOpts.show;
+ axis.reserveSpace = axisOpts.reserveSpace == null ? axis.show : axisOpts.reserveSpace;
+ setRange(axis);
+ });
+
+ if (showGrid) {
+
+ var allocatedAxes = $.grep(axes, function (axis) {
+ return axis.show || axis.reserveSpace;
+ });
+
+ $.each(allocatedAxes, function (_, axis) {
+ // make the ticks
+ setupTickGeneration(axis);
+ setTicks(axis);
+ snapRangeToTicks(axis, axis.ticks);
+ // find labelWidth/Height for axis
+ measureTickLabels(axis);
+ });
+
+ // with all dimensions calculated, we can compute the
+ // axis bounding boxes, start from the outside
+ // (reverse order)
+ for (i = allocatedAxes.length - 1; i >= 0; --i)
+ allocateAxisBoxFirstPhase(allocatedAxes[i]);
+
+ // make sure we've got enough space for things that
+ // might stick out
+ adjustLayoutForThingsStickingOut();
+
+ $.each(allocatedAxes, function (_, axis) {
+ allocateAxisBoxSecondPhase(axis);
+ });
+ }
+
+ plotWidth = surface.width - plotOffset.left - plotOffset.right;
+ plotHeight = surface.height - plotOffset.bottom - plotOffset.top;
+
+ // now we got the proper plot dimensions, we can compute the scaling
+ $.each(axes, function (_, axis) {
+ setTransformationHelpers(axis);
+ });
+
+ if (showGrid) {
+ drawAxisLabels();
+ }
+
+ insertLegend();
+ }
+
+ function setRange(axis) {
+ var opts = axis.options,
+ min = +(opts.min != null ? opts.min : axis.datamin),
+ max = +(opts.max != null ? opts.max : axis.datamax),
+ delta = max - min;
+
+ if (delta == 0.0) {
+ // degenerate case
+ var widen = max == 0 ? 1 : 0.01;
+
+ if (opts.min == null)
+ min -= widen;
+ // always widen max if we couldn't widen min to ensure we
+ // don't fall into min == max which doesn't work
+ if (opts.max == null || opts.min != null)
+ max += widen;
+ }
+ else {
+ // consider autoscaling
+ var margin = opts.autoscaleMargin;
+ if (margin != null) {
+ if (opts.min == null) {
+ min -= delta * margin;
+ // make sure we don't go below zero if all values
+ // are positive
+ if (min < 0 && axis.datamin != null && axis.datamin >= 0)
+ min = 0;
+ }
+ if (opts.max == null) {
+ max += delta * margin;
+ if (max > 0 && axis.datamax != null && axis.datamax <= 0)
+ max = 0;
+ }
+ }
+ }
+ axis.min = min;
+ axis.max = max;
+ }
+
+ function setupTickGeneration(axis) {
+ var opts = axis.options;
+
+ // estimate number of ticks
+ var noTicks;
+ if (typeof opts.ticks == "number" && opts.ticks > 0)
+ noTicks = opts.ticks;
+ else
+ // heuristic based on the model a*sqrt(x) fitted to
+ // some data points that seemed reasonable
+ noTicks = 0.3 * Math.sqrt(axis.direction == "x" ? surface.width : surface.height);
+
+ var delta = (axis.max - axis.min) / noTicks,
+ dec = -Math.floor(Math.log(delta) / Math.LN10),
+ maxDec = opts.tickDecimals;
+
+ if (maxDec != null && dec > maxDec) {
+ dec = maxDec;
+ }
+
+ var magn = Math.pow(10, -dec),
+ norm = delta / magn, // norm is between 1.0 and 10.0
+ size;
+
+ if (norm < 1.5) {
+ size = 1;
+ } else if (norm < 3) {
+ size = 2;
+ // special case for 2.5, requires an extra decimal
+ if (norm > 2.25 && (maxDec == null || dec + 1 <= maxDec)) {
+ size = 2.5;
+ ++dec;
+ }
+ } else if (norm < 7.5) {
+ size = 5;
+ } else {
+ size = 10;
+ }
+
+ size *= magn;
+
+ if (opts.minTickSize != null && size < opts.minTickSize) {
+ size = opts.minTickSize;
+ }
+
+ axis.delta = delta;
+ axis.tickDecimals = Math.max(0, maxDec != null ? maxDec : dec);
+ axis.tickSize = opts.tickSize || size;
+
+ // Time mode was moved to a plug-in in 0.8, and since so many people use it
+ // we'll add an especially friendly reminder to make sure they included it.
+
+ if (opts.mode == "time" && !axis.tickGenerator) {
+ throw new Error("Time mode requires the flot.time plugin.");
+ }
+
+ // Flot supports base-10 axes; any other mode else is handled by a plug-in,
+ // like flot.time.js.
+
+ if (!axis.tickGenerator) {
+
+ axis.tickGenerator = function (axis) {
+
+ var ticks = [],
+ start = floorInBase(axis.min, axis.tickSize),
+ i = 0,
+ v = Number.NaN,
+ prev;
+
+ do {
+ prev = v;
+ v = start + i * axis.tickSize;
+ ticks.push(v);
+ ++i;
+ } while (v < axis.max && v != prev);
+ return ticks;
+ };
+
+ axis.tickFormatter = function (value, axis) {
+
+ var factor = axis.tickDecimals ? Math.pow(10, axis.tickDecimals) : 1;
+ var formatted = "" + Math.round(value * factor) / factor;
+
+ // If tickDecimals was specified, ensure that we have exactly that
+ // much precision; otherwise default to the value's own precision.
+
+ if (axis.tickDecimals != null) {
+ var decimal = formatted.indexOf(".");
+ var precision = decimal == -1 ? 0 : formatted.length - decimal - 1;
+ if (precision < axis.tickDecimals) {
+ return (precision ? formatted : formatted + ".") + ("" + factor).substr(1, axis.tickDecimals - precision);
+ }
+ }
+
+ return formatted;
+ };
+ }
+
+ if ($.isFunction(opts.tickFormatter))
+ axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); };
+
+ if (opts.alignTicksWithAxis != null) {
+ var otherAxis = (axis.direction == "x" ? xaxes : yaxes)[opts.alignTicksWithAxis - 1];
+ if (otherAxis && otherAxis.used && otherAxis != axis) {
+ // consider snapping min/max to outermost nice ticks
+ var niceTicks = axis.tickGenerator(axis);
+ if (niceTicks.length > 0) {
+ if (opts.min == null)
+ axis.min = Math.min(axis.min, niceTicks[0]);
+ if (opts.max == null && niceTicks.length > 1)
+ axis.max = Math.max(axis.max, niceTicks[niceTicks.length - 1]);
+ }
+
+ axis.tickGenerator = function (axis) {
+ // copy ticks, scaled to this axis
+ var ticks = [], v, i;
+ for (i = 0; i < otherAxis.ticks.length; ++i) {
+ v = (otherAxis.ticks[i].v - otherAxis.min) / (otherAxis.max - otherAxis.min);
+ v = axis.min + v * (axis.max - axis.min);
+ ticks.push(v);
+ }
+ return ticks;
+ };
+
+ // we might need an extra decimal since forced
+ // ticks don't necessarily fit naturally
+ if (!axis.mode && opts.tickDecimals == null) {
+ var extraDec = Math.max(0, -Math.floor(Math.log(axis.delta) / Math.LN10) + 1),
+ ts = axis.tickGenerator(axis);
+
+ // only proceed if the tick interval rounded
+ // with an extra decimal doesn't give us a
+ // zero at end
+ if (!(ts.length > 1 && /\..*0$/.test((ts[1] - ts[0]).toFixed(extraDec))))
+ axis.tickDecimals = extraDec;
+ }
+ }
+ }
+ }
+
+ function setTicks(axis) {
+ var oticks = axis.options.ticks, ticks = [];
+ if (oticks == null || (typeof oticks == "number" && oticks > 0))
+ ticks = axis.tickGenerator(axis);
+ else if (oticks) {
+ if ($.isFunction(oticks))
+ // generate the ticks
+ ticks = oticks(axis);
+ else
+ ticks = oticks;
+ }
+
+ // clean up/labelify the supplied ticks, copy them over
+ var i, v;
+ axis.ticks = [];
+ for (i = 0; i < ticks.length; ++i) {
+ var label = null;
+ var t = ticks[i];
+ if (typeof t == "object") {
+ v = +t[0];
+ if (t.length > 1)
+ label = t[1];
+ }
+ else
+ v = +t;
+ if (label == null)
+ label = axis.tickFormatter(v, axis);
+ if (!isNaN(v))
+ axis.ticks.push({ v: v, label: label });
+ }
+ }
+
+ function snapRangeToTicks(axis, ticks) {
+ if (axis.options.autoscaleMargin && ticks.length > 0) {
+ // snap to ticks
+ if (axis.options.min == null)
+ axis.min = Math.min(axis.min, ticks[0].v);
+ if (axis.options.max == null && ticks.length > 1)
+ axis.max = Math.max(axis.max, ticks[ticks.length - 1].v);
+ }
+ }
+
+ function draw() {
+
+ surface.clear();
+
+ executeHooks(hooks.drawBackground, [ctx]);
+
+ var grid = options.grid;
+
+ // draw background, if any
+ if (grid.show && grid.backgroundColor)
+ drawBackground();
+
+ if (grid.show && !grid.aboveData) {
+ drawGrid();
+ }
+
+ for (var i = 0; i < series.length; ++i) {
+ executeHooks(hooks.drawSeries, [ctx, series[i]]);
+ drawSeries(series[i]);
+ }
+
+ executeHooks(hooks.draw, [ctx]);
+
+ if (grid.show && grid.aboveData) {
+ drawGrid();
+ }
+
+ surface.render();
+
+ // A draw implies that either the axes or data have changed, so we
+ // should probably update the overlay highlights as well.
+
+ triggerRedrawOverlay();
+ }
+
+ function extractRange(ranges, coord) {
+ var axis, from, to, key, axes = allAxes();
+
+ for (var i = 0; i < axes.length; ++i) {
+ axis = axes[i];
+ if (axis.direction == coord) {
+ key = coord + axis.n + "axis";
+ if (!ranges[key] && axis.n == 1)
+ key = coord + "axis"; // support x1axis as xaxis
+ if (ranges[key]) {
+ from = ranges[key].from;
+ to = ranges[key].to;
+ break;
+ }
+ }
+ }
+
+ // backwards-compat stuff - to be removed in future
+ if (!ranges[key]) {
+ axis = coord == "x" ? xaxes[0] : yaxes[0];
+ from = ranges[coord + "1"];
+ to = ranges[coord + "2"];
+ }
+
+ // auto-reverse as an added bonus
+ if (from != null && to != null && from > to) {
+ var tmp = from;
+ from = to;
+ to = tmp;
+ }
+
+ return { from: from, to: to, axis: axis };
+ }
+
+ function drawBackground() {
+ ctx.save();
+ ctx.translate(plotOffset.left, plotOffset.top);
+
+ ctx.fillStyle = getColorOrGradient(options.grid.backgroundColor, plotHeight, 0, "rgba(255, 255, 255, 0)");
+ ctx.fillRect(0, 0, plotWidth, plotHeight);
+ ctx.restore();
+ }
+
+ function drawGrid() {
+ var i, axes, bw, bc;
+
+ ctx.save();
+ ctx.translate(plotOffset.left, plotOffset.top);
+
+ // draw markings
+ var markings = options.grid.markings;
+ if (markings) {
+ if ($.isFunction(markings)) {
+ axes = plot.getAxes();
+ // xmin etc. is backwards compatibility, to be
+ // removed in the future
+ axes.xmin = axes.xaxis.min;
+ axes.xmax = axes.xaxis.max;
+ axes.ymin = axes.yaxis.min;
+ axes.ymax = axes.yaxis.max;
+
+ markings = markings(axes);
+ }
+
+ for (i = 0; i < markings.length; ++i) {
+ var m = markings[i],
+ xrange = extractRange(m, "x"),
+ yrange = extractRange(m, "y");
+
+ // fill in missing
+ if (xrange.from == null)
+ xrange.from = xrange.axis.min;
+ if (xrange.to == null)
+ xrange.to = xrange.axis.max;
+ if (yrange.from == null)
+ yrange.from = yrange.axis.min;
+ if (yrange.to == null)
+ yrange.to = yrange.axis.max;
+
+ // clip
+ if (xrange.to < xrange.axis.min || xrange.from > xrange.axis.max ||
+ yrange.to < yrange.axis.min || yrange.from > yrange.axis.max)
+ continue;
+
+ xrange.from = Math.max(xrange.from, xrange.axis.min);
+ xrange.to = Math.min(xrange.to, xrange.axis.max);
+ yrange.from = Math.max(yrange.from, yrange.axis.min);
+ yrange.to = Math.min(yrange.to, yrange.axis.max);
+
+ var xequal = xrange.from === xrange.to,
+ yequal = yrange.from === yrange.to;
+
+ if (xequal && yequal) {
+ continue;
+ }
+
+ // then draw
+ xrange.from = Math.floor(xrange.axis.p2c(xrange.from));
+ xrange.to = Math.floor(xrange.axis.p2c(xrange.to));
+ yrange.from = Math.floor(yrange.axis.p2c(yrange.from));
+ yrange.to = Math.floor(yrange.axis.p2c(yrange.to));
+
+ if (xequal || yequal) {
+ var lineWidth = m.lineWidth || options.grid.markingsLineWidth,
+ subPixel = lineWidth % 2 ? 0.5 : 0;
+ ctx.beginPath();
+ ctx.strokeStyle = m.color || options.grid.markingsColor;
+ ctx.lineWidth = lineWidth;
+ if (xequal) {
+ ctx.moveTo(xrange.to + subPixel, yrange.from);
+ ctx.lineTo(xrange.to + subPixel, yrange.to);
+ } else {
+ ctx.moveTo(xrange.from, yrange.to + subPixel);
+ ctx.lineTo(xrange.to, yrange.to + subPixel);
+ }
+ ctx.stroke();
+ } else {
+ ctx.fillStyle = m.color || options.grid.markingsColor;
+ ctx.fillRect(xrange.from, yrange.to,
+ xrange.to - xrange.from,
+ yrange.from - yrange.to);
+ }
+ }
+ }
+
+ // draw the ticks
+ axes = allAxes();
+ bw = options.grid.borderWidth;
+
+ for (var j = 0; j < axes.length; ++j) {
+ var axis = axes[j], box = axis.box,
+ t = axis.tickLength, x, y, xoff, yoff;
+ if (!axis.show || axis.ticks.length == 0)
+ continue;
+
+ ctx.lineWidth = 1;
+
+ // find the edges
+ if (axis.direction == "x") {
+ x = 0;
+ if (t == "full")
+ y = (axis.position == "top" ? 0 : plotHeight);
+ else
+ y = box.top - plotOffset.top + (axis.position == "top" ? box.height : 0);
+ }
+ else {
+ y = 0;
+ if (t == "full")
+ x = (axis.position == "left" ? 0 : plotWidth);
+ else
+ x = box.left - plotOffset.left + (axis.position == "left" ? box.width : 0);
+ }
+
+ // draw tick bar
+ if (!axis.innermost) {
+ ctx.strokeStyle = axis.options.color;
+ ctx.beginPath();
+ xoff = yoff = 0;
+ if (axis.direction == "x")
+ xoff = plotWidth + 1;
+ else
+ yoff = plotHeight + 1;
+
+ if (ctx.lineWidth == 1) {
+ if (axis.direction == "x") {
+ y = Math.floor(y) + 0.5;
+ } else {
+ x = Math.floor(x) + 0.5;
+ }
+ }
+
+ ctx.moveTo(x, y);
+ ctx.lineTo(x + xoff, y + yoff);
+ ctx.stroke();
+ }
+
+ // draw ticks
+
+ ctx.strokeStyle = axis.options.tickColor;
+
+ ctx.beginPath();
+ for (i = 0; i < axis.ticks.length; ++i) {
+ var v = axis.ticks[i].v;
+
+ xoff = yoff = 0;
+
+ if (isNaN(v) || v < axis.min || v > axis.max
+ // skip those lying on the axes if we got a border
+ || (t == "full"
+ && ((typeof bw == "object" && bw[axis.position] > 0) || bw > 0)
+ && (v == axis.min || v == axis.max)))
+ continue;
+
+ if (axis.direction == "x") {
+ x = axis.p2c(v);
+ yoff = t == "full" ? -plotHeight : t;
+
+ if (axis.position == "top")
+ yoff = -yoff;
+ }
+ else {
+ y = axis.p2c(v);
+ xoff = t == "full" ? -plotWidth : t;
+
+ if (axis.position == "left")
+ xoff = -xoff;
+ }
+
+ if (ctx.lineWidth == 1) {
+ if (axis.direction == "x")
+ x = Math.floor(x) + 0.5;
+ else
+ y = Math.floor(y) + 0.5;
+ }
+
+ ctx.moveTo(x, y);
+ ctx.lineTo(x + xoff, y + yoff);
+ }
+
+ ctx.stroke();
+ }
+
+
+ // draw border
+ if (bw) {
+ // If either borderWidth or borderColor is an object, then draw the border
+ // line by line instead of as one rectangle
+ bc = options.grid.borderColor;
+ if(typeof bw == "object" || typeof bc == "object") {
+ if (typeof bw !== "object") {
+ bw = {top: bw, right: bw, bottom: bw, left: bw};
+ }
+ if (typeof bc !== "object") {
+ bc = {top: bc, right: bc, bottom: bc, left: bc};
+ }
+
+ if (bw.top > 0) {
+ ctx.strokeStyle = bc.top;
+ ctx.lineWidth = bw.top;
+ ctx.beginPath();
+ ctx.moveTo(0 - bw.left, 0 - bw.top/2);
+ ctx.lineTo(plotWidth, 0 - bw.top/2);
+ ctx.stroke();
+ }
+
+ if (bw.right > 0) {
+ ctx.strokeStyle = bc.right;
+ ctx.lineWidth = bw.right;
+ ctx.beginPath();
+ ctx.moveTo(plotWidth + bw.right / 2, 0 - bw.top);
+ ctx.lineTo(plotWidth + bw.right / 2, plotHeight);
+ ctx.stroke();
+ }
+
+ if (bw.bottom > 0) {
+ ctx.strokeStyle = bc.bottom;
+ ctx.lineWidth = bw.bottom;
+ ctx.beginPath();
+ ctx.moveTo(plotWidth + bw.right, plotHeight + bw.bottom / 2);
+ ctx.lineTo(0, plotHeight + bw.bottom / 2);
+ ctx.stroke();
+ }
+
+ if (bw.left > 0) {
+ ctx.strokeStyle = bc.left;
+ ctx.lineWidth = bw.left;
+ ctx.beginPath();
+ ctx.moveTo(0 - bw.left/2, plotHeight + bw.bottom);
+ ctx.lineTo(0- bw.left/2, 0);
+ ctx.stroke();
+ }
+ }
+ else {
+ ctx.lineWidth = bw;
+ ctx.strokeStyle = options.grid.borderColor;
+ ctx.strokeRect(-bw/2, -bw/2, plotWidth + bw, plotHeight + bw);
+ }
+ }
+
+ ctx.restore();
+ }
+
+ function drawAxisLabels() {
+
+ $.each(allAxes(), function (_, axis) {
+ var box = axis.box,
+ legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis",
+ layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles,
+ font = axis.options.font || "flot-tick-label tickLabel",
+ tick, x, y, halign, valign;
+
+ // Remove text before checking for axis.show and ticks.length;
+ // otherwise plugins, like flot-tickrotor, that draw their own
+ // tick labels will end up with both theirs and the defaults.
+
+ surface.removeText(layer);
+
+ if (!axis.show || axis.ticks.length == 0)
+ return;
+
+ for (var i = 0; i < axis.ticks.length; ++i) {
+
+ tick = axis.ticks[i];
+ if (!tick.label || tick.v < axis.min || tick.v > axis.max)
+ continue;
+
+ if (axis.direction == "x") {
+ halign = "center";
+ x = plotOffset.left + axis.p2c(tick.v);
+ if (axis.position == "bottom") {
+ y = box.top + box.padding;
+ } else {
+ y = box.top + box.height - box.padding;
+ valign = "bottom";
+ }
+ } else {
+ valign = "middle";
+ y = plotOffset.top + axis.p2c(tick.v);
+ if (axis.position == "left") {
+ x = box.left + box.width - box.padding;
+ halign = "right";
+ } else {
+ x = box.left + box.padding;
+ }
+ }
+
+ surface.addText(layer, x, y, tick.label, font, null, null, halign, valign);
+ }
+ });
+ }
+
+ function drawSeries(series) {
+ if (series.lines.show)
+ drawSeriesLines(series);
+ if (series.bars.show)
+ drawSeriesBars(series);
+ if (series.points.show)
+ drawSeriesPoints(series);
+ }
+
+ function drawSeriesLines(series) {
+ function plotLine(datapoints, xoffset, yoffset, axisx, axisy) {
+ var points = datapoints.points,
+ ps = datapoints.pointsize,
+ prevx = null, prevy = null;
+
+ ctx.beginPath();
+ for (var i = ps; i < points.length; i += ps) {
+ var x1 = points[i - ps], y1 = points[i - ps + 1],
+ x2 = points[i], y2 = points[i + 1];
+
+ if (x1 == null || x2 == null)
+ continue;
+
+ // clip with ymin
+ if (y1 <= y2 && y1 < axisy.min) {
+ if (y2 < axisy.min)
+ continue; // line segment is outside
+ // compute new intersection point
+ x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y1 = axisy.min;
+ }
+ else if (y2 <= y1 && y2 < axisy.min) {
+ if (y1 < axisy.min)
+ continue;
+ x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y2 = axisy.min;
+ }
+
+ // clip with ymax
+ if (y1 >= y2 && y1 > axisy.max) {
+ if (y2 > axisy.max)
+ continue;
+ x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y1 = axisy.max;
+ }
+ else if (y2 >= y1 && y2 > axisy.max) {
+ if (y1 > axisy.max)
+ continue;
+ x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y2 = axisy.max;
+ }
+
+ // clip with xmin
+ if (x1 <= x2 && x1 < axisx.min) {
+ if (x2 < axisx.min)
+ continue;
+ y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x1 = axisx.min;
+ }
+ else if (x2 <= x1 && x2 < axisx.min) {
+ if (x1 < axisx.min)
+ continue;
+ y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x2 = axisx.min;
+ }
+
+ // clip with xmax
+ if (x1 >= x2 && x1 > axisx.max) {
+ if (x2 > axisx.max)
+ continue;
+ y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x1 = axisx.max;
+ }
+ else if (x2 >= x1 && x2 > axisx.max) {
+ if (x1 > axisx.max)
+ continue;
+ y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x2 = axisx.max;
+ }
+
+ if (x1 != prevx || y1 != prevy)
+ ctx.moveTo(axisx.p2c(x1) + xoffset, axisy.p2c(y1) + yoffset);
+
+ prevx = x2;
+ prevy = y2;
+ ctx.lineTo(axisx.p2c(x2) + xoffset, axisy.p2c(y2) + yoffset);
+ }
+ ctx.stroke();
+ }
+
+ function plotLineArea(datapoints, axisx, axisy) {
+ var points = datapoints.points,
+ ps = datapoints.pointsize,
+ bottom = Math.min(Math.max(0, axisy.min), axisy.max),
+ i = 0, top, areaOpen = false,
+ ypos = 1, segmentStart = 0, segmentEnd = 0;
+
+ // we process each segment in two turns, first forward
+ // direction to sketch out top, then once we hit the
+ // end we go backwards to sketch the bottom
+ while (true) {
+ if (ps > 0 && i > points.length + ps)
+ break;
+
+ i += ps; // ps is negative if going backwards
+
+ var x1 = points[i - ps],
+ y1 = points[i - ps + ypos],
+ x2 = points[i], y2 = points[i + ypos];
+
+ if (areaOpen) {
+ if (ps > 0 && x1 != null && x2 == null) {
+ // at turning point
+ segmentEnd = i;
+ ps = -ps;
+ ypos = 2;
+ continue;
+ }
+
+ if (ps < 0 && i == segmentStart + ps) {
+ // done with the reverse sweep
+ ctx.fill();
+ areaOpen = false;
+ ps = -ps;
+ ypos = 1;
+ i = segmentStart = segmentEnd + ps;
+ continue;
+ }
+ }
+
+ if (x1 == null || x2 == null)
+ continue;
+
+ // clip x values
+
+ // clip with xmin
+ if (x1 <= x2 && x1 < axisx.min) {
+ if (x2 < axisx.min)
+ continue;
+ y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x1 = axisx.min;
+ }
+ else if (x2 <= x1 && x2 < axisx.min) {
+ if (x1 < axisx.min)
+ continue;
+ y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x2 = axisx.min;
+ }
+
+ // clip with xmax
+ if (x1 >= x2 && x1 > axisx.max) {
+ if (x2 > axisx.max)
+ continue;
+ y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x1 = axisx.max;
+ }
+ else if (x2 >= x1 && x2 > axisx.max) {
+ if (x1 > axisx.max)
+ continue;
+ y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;
+ x2 = axisx.max;
+ }
+
+ if (!areaOpen) {
+ // open area
+ ctx.beginPath();
+ ctx.moveTo(axisx.p2c(x1), axisy.p2c(bottom));
+ areaOpen = true;
+ }
+
+ // now first check the case where both is outside
+ if (y1 >= axisy.max && y2 >= axisy.max) {
+ ctx.lineTo(axisx.p2c(x1), axisy.p2c(axisy.max));
+ ctx.lineTo(axisx.p2c(x2), axisy.p2c(axisy.max));
+ continue;
+ }
+ else if (y1 <= axisy.min && y2 <= axisy.min) {
+ ctx.lineTo(axisx.p2c(x1), axisy.p2c(axisy.min));
+ ctx.lineTo(axisx.p2c(x2), axisy.p2c(axisy.min));
+ continue;
+ }
+
+ // else it's a bit more complicated, there might
+ // be a flat maxed out rectangle first, then a
+ // triangular cutout or reverse; to find these
+ // keep track of the current x values
+ var x1old = x1, x2old = x2;
+
+ // clip the y values, without shortcutting, we
+ // go through all cases in turn
+
+ // clip with ymin
+ if (y1 <= y2 && y1 < axisy.min && y2 >= axisy.min) {
+ x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y1 = axisy.min;
+ }
+ else if (y2 <= y1 && y2 < axisy.min && y1 >= axisy.min) {
+ x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y2 = axisy.min;
+ }
+
+ // clip with ymax
+ if (y1 >= y2 && y1 > axisy.max && y2 <= axisy.max) {
+ x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y1 = axisy.max;
+ }
+ else if (y2 >= y1 && y2 > axisy.max && y1 <= axisy.max) {
+ x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;
+ y2 = axisy.max;
+ }
+
+ // if the x value was changed we got a rectangle
+ // to fill
+ if (x1 != x1old) {
+ ctx.lineTo(axisx.p2c(x1old), axisy.p2c(y1));
+ // it goes to (x1, y1), but we fill that below
+ }
+
+ // fill triangular section, this sometimes result
+ // in redundant points if (x1, y1) hasn't changed
+ // from previous line to, but we just ignore that
+ ctx.lineTo(axisx.p2c(x1), axisy.p2c(y1));
+ ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2));
+
+ // fill the other rectangle if it's there
+ if (x2 != x2old) {
+ ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2));
+ ctx.lineTo(axisx.p2c(x2old), axisy.p2c(y2));
+ }
+ }
+ }
+
+ ctx.save();
+ ctx.translate(plotOffset.left, plotOffset.top);
+ ctx.lineJoin = "round";
+
+ var lw = series.lines.lineWidth,
+ sw = series.shadowSize;
+ // FIXME: consider another form of shadow when filling is turned on
+ if (lw > 0 && sw > 0) {
+ // draw shadow as a thick and thin line with transparency
+ ctx.lineWidth = sw;
+ ctx.strokeStyle = "rgba(0,0,0,0.1)";
+ // position shadow at angle from the mid of line
+ var angle = Math.PI/18;
+ plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/2), Math.cos(angle) * (lw/2 + sw/2), series.xaxis, series.yaxis);
+ ctx.lineWidth = sw/2;
+ plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/4), Math.cos(angle) * (lw/2 + sw/4), series.xaxis, series.yaxis);
+ }
+
+ ctx.lineWidth = lw;
+ ctx.strokeStyle = series.color;
+ var fillStyle = getFillStyle(series.lines, series.color, 0, plotHeight);
+ if (fillStyle) {
+ ctx.fillStyle = fillStyle;
+ plotLineArea(series.datapoints, series.xaxis, series.yaxis);
+ }
+
+ if (lw > 0)
+ plotLine(series.datapoints, 0, 0, series.xaxis, series.yaxis);
+ ctx.restore();
+ }
+
+ function drawSeriesPoints(series) {
+ function plotPoints(datapoints, radius, fillStyle, offset, shadow, axisx, axisy, symbol) {
+ var points = datapoints.points, ps = datapoints.pointsize;
+
+ for (var i = 0; i < points.length; i += ps) {
+ var x = points[i], y = points[i + 1];
+ if (x == null || x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)
+ continue;
+
+ ctx.beginPath();
+ x = axisx.p2c(x);
+ y = axisy.p2c(y) + offset;
+ if (symbol == "circle")
+ ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false);
+ else
+ symbol(ctx, x, y, radius, shadow);
+ ctx.closePath();
+
+ if (fillStyle) {
+ ctx.fillStyle = fillStyle;
+ ctx.fill();
+ }
+ ctx.stroke();
+ }
+ }
+
+ ctx.save();
+ ctx.translate(plotOffset.left, plotOffset.top);
+
+ var lw = series.points.lineWidth,
+ sw = series.shadowSize,
+ radius = series.points.radius,
+ symbol = series.points.symbol;
+
+ // If the user sets the line width to 0, we change it to a very
+ // small value. A line width of 0 seems to force the default of 1.
+ // Doing the conditional here allows the shadow setting to still be
+ // optional even with a lineWidth of 0.
+
+ if( lw == 0 )
+ lw = 0.0001;
+
+ if (lw > 0 && sw > 0) {
+ // draw shadow in two steps
+ var w = sw / 2;
+ ctx.lineWidth = w;
+ ctx.strokeStyle = "rgba(0,0,0,0.1)";
+ plotPoints(series.datapoints, radius, null, w + w/2, true,
+ series.xaxis, series.yaxis, symbol);
+
+ ctx.strokeStyle = "rgba(0,0,0,0.2)";
+ plotPoints(series.datapoints, radius, null, w/2, true,
+ series.xaxis, series.yaxis, symbol);
+ }
+
+ ctx.lineWidth = lw;
+ ctx.strokeStyle = series.color;
+ plotPoints(series.datapoints, radius,
+ getFillStyle(series.points, series.color), 0, false,
+ series.xaxis, series.yaxis, symbol);
+ ctx.restore();
+ }
+
+ function drawBar(x, y, b, barLeft, barRight, fillStyleCallback, axisx, axisy, c, horizontal, lineWidth) {
+ var left, right, bottom, top,
+ drawLeft, drawRight, drawTop, drawBottom,
+ tmp;
+
+ // in horizontal mode, we start the bar from the left
+ // instead of from the bottom so it appears to be
+ // horizontal rather than vertical
+ if (horizontal) {
+ drawBottom = drawRight = drawTop = true;
+ drawLeft = false;
+ left = b;
+ right = x;
+ top = y + barLeft;
+ bottom = y + barRight;
+
+ // account for negative bars
+ if (right < left) {
+ tmp = right;
+ right = left;
+ left = tmp;
+ drawLeft = true;
+ drawRight = false;
+ }
+ }
+ else {
+ drawLeft = drawRight = drawTop = true;
+ drawBottom = false;
+ left = x + barLeft;
+ right = x + barRight;
+ bottom = b;
+ top = y;
+
+ // account for negative bars
+ if (top < bottom) {
+ tmp = top;
+ top = bottom;
+ bottom = tmp;
+ drawBottom = true;
+ drawTop = false;
+ }
+ }
+
+ // clip
+ if (right < axisx.min || left > axisx.max ||
+ top < axisy.min || bottom > axisy.max)
+ return;
+
+ if (left < axisx.min) {
+ left = axisx.min;
+ drawLeft = false;
+ }
+
+ if (right > axisx.max) {
+ right = axisx.max;
+ drawRight = false;
+ }
+
+ if (bottom < axisy.min) {
+ bottom = axisy.min;
+ drawBottom = false;
+ }
+
+ if (top > axisy.max) {
+ top = axisy.max;
+ drawTop = false;
+ }
+
+ left = axisx.p2c(left);
+ bottom = axisy.p2c(bottom);
+ right = axisx.p2c(right);
+ top = axisy.p2c(top);
+
+ // fill the bar
+ if (fillStyleCallback) {
+ c.fillStyle = fillStyleCallback(bottom, top);
+ c.fillRect(left, top, right - left, bottom - top)
+ }
+
+ // draw outline
+ if (lineWidth > 0 && (drawLeft || drawRight || drawTop || drawBottom)) {
+ c.beginPath();
+
+ // FIXME: inline moveTo is buggy with excanvas
+ c.moveTo(left, bottom);
+ if (drawLeft)
+ c.lineTo(left, top);
+ else
+ c.moveTo(left, top);
+ if (drawTop)
+ c.lineTo(right, top);
+ else
+ c.moveTo(right, top);
+ if (drawRight)
+ c.lineTo(right, bottom);
+ else
+ c.moveTo(right, bottom);
+ if (drawBottom)
+ c.lineTo(left, bottom);
+ else
+ c.moveTo(left, bottom);
+ c.stroke();
+ }
+ }
+
+ function drawSeriesBars(series) {
+ function plotBars(datapoints, barLeft, barRight, fillStyleCallback, axisx, axisy) {
+ var points = datapoints.points, ps = datapoints.pointsize;
+
+ for (var i = 0; i < points.length; i += ps) {
+ if (points[i] == null)
+ continue;
+ drawBar(points[i], points[i + 1], points[i + 2], barLeft, barRight, fillStyleCallback, axisx, axisy, ctx, series.bars.horizontal, series.bars.lineWidth);
+ }
+ }
+
+ ctx.save();
+ ctx.translate(plotOffset.left, plotOffset.top);
+
+ // FIXME: figure out a way to add shadows (for instance along the right edge)
+ ctx.lineWidth = series.bars.lineWidth;
+ ctx.strokeStyle = series.color;
+
+ var barLeft;
+
+ switch (series.bars.align) {
+ case "left":
+ barLeft = 0;
+ break;
+ case "right":
+ barLeft = -series.bars.barWidth;
+ break;
+ default:
+ barLeft = -series.bars.barWidth / 2;
+ }
+
+ var fillStyleCallback = series.bars.fill ? function (bottom, top) { return getFillStyle(series.bars, series.color, bottom, top); } : null;
+ plotBars(series.datapoints, barLeft, barLeft + series.bars.barWidth, fillStyleCallback, series.xaxis, series.yaxis);
+ ctx.restore();
+ }
+
+ function getFillStyle(filloptions, seriesColor, bottom, top) {
+ var fill = filloptions.fill;
+ if (!fill)
+ return null;
+
+ if (filloptions.fillColor)
+ return getColorOrGradient(filloptions.fillColor, bottom, top, seriesColor);
+
+ var c = $.color.parse(seriesColor);
+ c.a = typeof fill == "number" ? fill : 0.4;
+ c.normalize();
+ return c.toString();
+ }
+
+ function insertLegend() {
+
+ if (options.legend.container != null) {
+ $(options.legend.container).html("");
+ } else {
+ placeholder.find(".legend").remove();
+ }
+
+ if (!options.legend.show) {
+ return;
+ }
+
+ var fragments = [], entries = [], rowStarted = false,
+ lf = options.legend.labelFormatter, s, label;
+
+ // Build a list of legend entries, with each having a label and a color
+
+ for (var i = 0; i < series.length; ++i) {
+ s = series[i];
+ if (s.label) {
+ label = lf ? lf(s.label, s) : s.label;
+ if (label) {
+ entries.push({
+ label: label,
+ color: s.color
+ });
+ }
+ }
+ }
+
+ // Sort the legend using either the default or a custom comparator
+
+ if (options.legend.sorted) {
+ if ($.isFunction(options.legend.sorted)) {
+ entries.sort(options.legend.sorted);
+ } else if (options.legend.sorted == "reverse") {
+ entries.reverse();
+ } else {
+ var ascending = options.legend.sorted != "descending";
+ entries.sort(function(a, b) {
+ return a.label == b.label ? 0 : (
+ (a.label < b.label) != ascending ? 1 : -1 // Logical XOR
+ );
+ });
+ }
+ }
+
+ // Generate markup for the list of entries, in their final order
+
+ for (var i = 0; i < entries.length; ++i) {
+
+ var entry = entries[i];
+
+ if (i % options.legend.noColumns == 0) {
+ if (rowStarted)
+ fragments.push('</tr>');
+ fragments.push('<tr>');
+ rowStarted = true;
+ }
+
+ fragments.push(
+ '<td class="legendColorBox"><div style="border:1px solid ' + options.legend.labelBoxBorderColor + ';padding:1px"><div style="width:4px;height:0;border:5px solid ' + entry.color + ';overflow:hidden"></div></div></td>' +
+ '<td class="legendLabel">' + entry.label + '</td>'
+ );
+ }
+
+ if (rowStarted)
+ fragments.push('</tr>');
+
+ if (fragments.length == 0)
+ return;
+
+ var table = '<table style="font-size:smaller;color:' + options.grid.color + '">' + fragments.join("") + '</table>';
+ if (options.legend.container != null)
+ $(options.legend.container).html(table);
+ else {
+ var pos = "",
+ p = options.legend.position,
+ m = options.legend.margin;
+ if (m[0] == null)
+ m = [m, m];
+ if (p.charAt(0) == "n")
+ pos += 'top:' + (m[1] + plotOffset.top) + 'px;';
+ else if (p.charAt(0) == "s")
+ pos += 'bottom:' + (m[1] + plotOffset.bottom) + 'px;';
+ if (p.charAt(1) == "e")
+ pos += 'right:' + (m[0] + plotOffset.right) + 'px;';
+ else if (p.charAt(1) == "w")
+ pos += 'left:' + (m[0] + plotOffset.left) + 'px;';
+ var legend = $('<div class="legend">' + table.replace('style="', 'style="position:absolute;' + pos +';') + '</div>').appendTo(placeholder);
+ if (options.legend.backgroundOpacity != 0.0) {
+ // put in the transparent background
+ // separately to avoid blended labels and
+ // label boxes
+ var c = options.legend.backgroundColor;
+ if (c == null) {
+ c = options.grid.backgroundColor;
+ if (c && typeof c == "string")
+ c = $.color.parse(c);
+ else
+ c = $.color.extract(legend, 'background-color');
+ c.a = 1;
+ c = c.toString();
+ }
+ var div = legend.children();
+ $('<div style="position:absolute;width:' + div.width() + 'px;height:' + div.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').prependTo(legend).css('opacity', options.legend.backgroundOpacity);
+ }
+ }
+ }
+
+
+ // interactive features
+
+ var highlights = [],
+ redrawTimeout = null;
+
+ // returns the data item the mouse is over, or null if none is found
+ function findNearbyItem(mouseX, mouseY, seriesFilter) {
+ var maxDistance = options.grid.mouseActiveRadius,
+ smallestDistance = maxDistance * maxDistance + 1,
+ item = null, foundPoint = false, i, j, ps;
+
+ for (i = series.length - 1; i >= 0; --i) {
+ if (!seriesFilter(series[i]))
+ continue;
+
+ var s = series[i],
+ axisx = s.xaxis,
+ axisy = s.yaxis,
+ points = s.datapoints.points,
+ mx = axisx.c2p(mouseX), // precompute some stuff to make the loop faster
+ my = axisy.c2p(mouseY),
+ maxx = maxDistance / axisx.scale,
+ maxy = maxDistance / axisy.scale;
+
+ ps = s.datapoints.pointsize;
+ // with inverse transforms, we can't use the maxx/maxy
+ // optimization, sadly
+ if (axisx.options.inverseTransform)
+ maxx = Number.MAX_VALUE;
+ if (axisy.options.inverseTransform)
+ maxy = Number.MAX_VALUE;
+
+ if (s.lines.show || s.points.show) {
+ for (j = 0; j < points.length; j += ps) {
+ var x = points[j], y = points[j + 1];
+ if (x == null)
+ continue;
+
+ // For points and lines, the cursor must be within a
+ // certain distance to the data point
+ if (x - mx > maxx || x - mx < -maxx ||
+ y - my > maxy || y - my < -maxy)
+ continue;
+
+ // We have to calculate distances in pixels, not in
+ // data units, because the scales of the axes may be different
+ var dx = Math.abs(axisx.p2c(x) - mouseX),
+ dy = Math.abs(axisy.p2c(y) - mouseY),
+ dist = dx * dx + dy * dy; // we save the sqrt
+
+ // use <= to ensure last point takes precedence
+ // (last generally means on top of)
+ if (dist < smallestDistance) {
+ smallestDistance = dist;
+ item = [i, j / ps];
+ }
+ }
+ }
+
+ if (s.bars.show && !item) { // no other point can be nearby
+
+ var barLeft, barRight;
+
+ switch (s.bars.align) {
+ case "left":
+ barLeft = 0;
+ break;
+ case "right":
+ barLeft = -s.bars.barWidth;
+ break;
+ default:
+ barLeft = -s.bars.barWidth / 2;
+ }
+
+ barRight = barLeft + s.bars.barWidth;
+
+ for (j = 0; j < points.length; j += ps) {
+ var x = points[j], y = points[j + 1], b = points[j + 2];
+ if (x == null)
+ continue;
+
+ // for a bar graph, the cursor must be inside the bar
+ if (series[i].bars.horizontal ?
+ (mx <= Math.max(b, x) && mx >= Math.min(b, x) &&
+ my >= y + barLeft && my <= y + barRight) :
+ (mx >= x + barLeft && mx <= x + barRight &&
+ my >= Math.min(b, y) && my <= Math.max(b, y)))
+ item = [i, j / ps];
+ }
+ }
+ }
+
+ if (item) {
+ i = item[0];
+ j = item[1];
+ ps = series[i].datapoints.pointsize;
+
+ return { datapoint: series[i].datapoints.points.slice(j * ps, (j + 1) * ps),
+ dataIndex: j,
+ series: series[i],
+ seriesIndex: i };
+ }
+
+ return null;
+ }
+
+ function onMouseMove(e) {
+ if (options.grid.hoverable)
+ triggerClickHoverEvent("plothover", e,
+ function (s) { return s["hoverable"] != false; });
+ }
+
+ function onMouseLeave(e) {
+ if (options.grid.hoverable)
+ triggerClickHoverEvent("plothover", e,
+ function (s) { return false; });
+ }
+
+ function onClick(e) {
+ triggerClickHoverEvent("plotclick", e,
+ function (s) { return s["clickable"] != false; });
+ }
+
+ // trigger click or hover event (they send the same parameters
+ // so we share their code)
+ function triggerClickHoverEvent(eventname, event, seriesFilter) {
+ var offset = eventHolder.offset(),
+ canvasX = event.pageX - offset.left - plotOffset.left,
+ canvasY = event.pageY - offset.top - plotOffset.top,
+ pos = canvasToAxisCoords({ left: canvasX, top: canvasY });
+
+ pos.pageX = event.pageX;
+ pos.pageY = event.pageY;
+
+ var item = findNearbyItem(canvasX, canvasY, seriesFilter);
+
+ if (item) {
+ // fill in mouse pos for any listeners out there
+ item.pageX = parseInt(item.series.xaxis.p2c(item.datapoint[0]) + offset.left + plotOffset.left, 10);
+ item.pageY = parseInt(item.series.yaxis.p2c(item.datapoint[1]) + offset.top + plotOffset.top, 10);
+ }
+
+ if (options.grid.autoHighlight) {
+ // clear auto-highlights
+ for (var i = 0; i < highlights.length; ++i) {
+ var h = highlights[i];
+ if (h.auto == eventname &&
+ !(item && h.series == item.series &&
+ h.point[0] == item.datapoint[0] &&
+ h.point[1] == item.datapoint[1]))
+ unhighlight(h.series, h.point);
+ }
+
+ if (item)
+ highlight(item.series, item.datapoint, eventname);
+ }
+
+ placeholder.trigger(eventname, [ pos, item ]);
+ }
+
+ function triggerRedrawOverlay() {
+ var t = options.interaction.redrawOverlayInterval;
+ if (t == -1) { // skip event queue
+ drawOverlay();
+ return;
+ }
+
+ if (!redrawTimeout)
+ redrawTimeout = setTimeout(drawOverlay, t);
+ }
+
+ function drawOverlay() {
+ redrawTimeout = null;
+
+ // draw highlights
+ octx.save();
+ overlay.clear();
+ octx.translate(plotOffset.left, plotOffset.top);
+
+ var i, hi;
+ for (i = 0; i < highlights.length; ++i) {
+ hi = highlights[i];
+
+ if (hi.series.bars.show)
+ drawBarHighlight(hi.series, hi.point);
+ else
+ drawPointHighlight(hi.series, hi.point);
+ }
+ octx.restore();
+
+ executeHooks(hooks.drawOverlay, [octx]);
+ }
+
+ function highlight(s, point, auto) {
+ if (typeof s == "number")
+ s = series[s];
+
+ if (typeof point == "number") {
+ var ps = s.datapoints.pointsize;
+ point = s.datapoints.points.slice(ps * point, ps * (point + 1));
+ }
+
+ var i = indexOfHighlight(s, point);
+ if (i == -1) {
+ highlights.push({ series: s, point: point, auto: auto });
+
+ triggerRedrawOverlay();
+ }
+ else if (!auto)
+ highlights[i].auto = false;
+ }
+
+ function unhighlight(s, point) {
+ if (s == null && point == null) {
+ highlights = [];
+ triggerRedrawOverlay();
+ return;
+ }
+
+ if (typeof s == "number")
+ s = series[s];
+
+ if (typeof point == "number") {
+ var ps = s.datapoints.pointsize;
+ point = s.datapoints.points.slice(ps * point, ps * (point + 1));
+ }
+
+ var i = indexOfHighlight(s, point);
+ if (i != -1) {
+ highlights.splice(i, 1);
+
+ triggerRedrawOverlay();
+ }
+ }
+
+ function indexOfHighlight(s, p) {
+ for (var i = 0; i < highlights.length; ++i) {
+ var h = highlights[i];
+ if (h.series == s && h.point[0] == p[0]
+ && h.point[1] == p[1])
+ return i;
+ }
+ return -1;
+ }
+
+ function drawPointHighlight(series, point) {
+ var x = point[0], y = point[1],
+ axisx = series.xaxis, axisy = series.yaxis,
+ highlightColor = (typeof series.highlightColor === "string") ? series.highlightColor : $.color.parse(series.color).scale('a', 0.5).toString();
+
+ if (x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)
+ return;
+
+ var pointRadius = series.points.radius + series.points.lineWidth / 2;
+ octx.lineWidth = pointRadius;
+ octx.strokeStyle = highlightColor;
+ var radius = 1.5 * pointRadius;
+ x = axisx.p2c(x);
+ y = axisy.p2c(y);
+
+ octx.beginPath();
+ if (series.points.symbol == "circle")
+ octx.arc(x, y, radius, 0, 2 * Math.PI, false);
+ else
+ series.points.symbol(octx, x, y, radius, false);
+ octx.closePath();
+ octx.stroke();
+ }
+
+ function drawBarHighlight(series, point) {
+ var highlightColor = (typeof series.highlightColor === "string") ? series.highlightColor : $.color.parse(series.color).scale('a', 0.5).toString(),
+ fillStyle = highlightColor,
+ barLeft;
+
+ switch (series.bars.align) {
+ case "left":
+ barLeft = 0;
+ break;
+ case "right":
+ barLeft = -series.bars.barWidth;
+ break;
+ default:
+ barLeft = -series.bars.barWidth / 2;
+ }
+
+ octx.lineWidth = series.bars.lineWidth;
+ octx.strokeStyle = highlightColor;
+
+ drawBar(point[0], point[1], point[2] || 0, barLeft, barLeft + series.bars.barWidth,
+ function () { return fillStyle; }, series.xaxis, series.yaxis, octx, series.bars.horizontal, series.bars.lineWidth);
+ }
+
+ function getColorOrGradient(spec, bottom, top, defaultColor) {
+ if (typeof spec == "string")
+ return spec;
+ else {
+ // assume this is a gradient spec; IE currently only
+ // supports a simple vertical gradient properly, so that's
+ // what we support too
+ var gradient = ctx.createLinearGradient(0, top, 0, bottom);
+
+ for (var i = 0, l = spec.colors.length; i < l; ++i) {
+ var c = spec.colors[i];
+ if (typeof c != "string") {
+ var co = $.color.parse(defaultColor);
+ if (c.brightness != null)
+ co = co.scale('rgb', c.brightness);
+ if (c.opacity != null)
+ co.a *= c.opacity;
+ c = co.toString();
+ }
+ gradient.addColorStop(i / (l - 1), c);
+ }
+
+ return gradient;
+ }
+ }
+ }
+
+ // Add the plot function to the top level of the jQuery object
+
+ $.plot = function(placeholder, data, options) {
+ //var t0 = new Date();
+ var plot = new Plot($(placeholder), data, options, $.plot.plugins);
+ //(window.console ? console.log : alert)("time used (msecs): " + ((new Date()).getTime() - t0.getTime()));
+ return plot;
+ };
+
+ $.plot.version = "0.8.3";
+
+ $.plot.plugins = [];
+
+ // Also add the plot function as a chainable property
+
+ $.fn.plot = function(data, options) {
+ return this.each(function() {
+ $.plot(this, data, options);
+ });
+ };
+
+ // round to nearby lower multiple of base
+ function floorInBase(n, base) {
+ return base * Math.floor(n / base);
+ }
+
+})(jQuery);
diff --git a/www/js/contrib/jquery.flot.threshold.js b/www/js/contrib/jquery.flot.threshold.js
new file mode 100644
index 00000000..8c99c401
--- /dev/null
+++ b/www/js/contrib/jquery.flot.threshold.js
@@ -0,0 +1,142 @@
+/* Flot plugin for thresholding data.
+
+Copyright (c) 2007-2014 IOLA and Ole Laursen.
+Licensed under the MIT license.
+
+The plugin supports these options:
+
+ series: {
+ threshold: {
+ below: number
+ color: colorspec
+ }
+ }
+
+It can also be applied to a single series, like this:
+
+ $.plot( $("#placeholder"), [{
+ data: [ ... ],
+ threshold: { ... }
+ }])
+
+An array can be passed for multiple thresholding, like this:
+
+ threshold: [{
+ below: number1
+ color: color1
+ },{
+ below: number2
+ color: color2
+ }]
+
+These multiple threshold objects can be passed in any order since they are
+sorted by the processing function.
+
+The data points below "below" are drawn with the specified color. This makes
+it easy to mark points below 0, e.g. for budget data.
+
+Internally, the plugin works by splitting the data into two series, above and
+below the threshold. The extra series below the threshold will have its label
+cleared and the special "originSeries" attribute set to the original series.
+You may need to check for this in hover events.
+
+*/
+
+(function ($) {
+ var options = {
+ series: { threshold: null } // or { below: number, color: color spec}
+ };
+
+ function init(plot) {
+ function thresholdData(plot, s, datapoints, below, color) {
+ var ps = datapoints.pointsize, i, x, y, p, prevp,
+ thresholded = $.extend({}, s); // note: shallow copy
+
+ thresholded.datapoints = { points: [], pointsize: ps, format: datapoints.format };
+ thresholded.label = null;
+ thresholded.color = color;
+ thresholded.threshold = null;
+ thresholded.originSeries = s;
+ thresholded.data = [];
+
+ var origpoints = datapoints.points,
+ addCrossingPoints = s.lines.show;
+
+ var threspoints = [];
+ var newpoints = [];
+ var m;
+
+ for (i = 0; i < origpoints.length; i += ps) {
+ x = origpoints[i];
+ y = origpoints[i + 1];
+
+ prevp = p;
+ if (y < below)
+ p = threspoints;
+ else
+ p = newpoints;
+
+ if (addCrossingPoints && prevp != p && x != null
+ && i > 0 && origpoints[i - ps] != null) {
+ var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]);
+ prevp.push(interx);
+ prevp.push(below);
+ for (m = 2; m < ps; ++m)
+ prevp.push(origpoints[i + m]);
+
+ p.push(null); // start new segment
+ p.push(null);
+ for (m = 2; m < ps; ++m)
+ p.push(origpoints[i + m]);
+ p.push(interx);
+ p.push(below);
+ for (m = 2; m < ps; ++m)
+ p.push(origpoints[i + m]);
+ }
+
+ p.push(x);
+ p.push(y);
+ for (m = 2; m < ps; ++m)
+ p.push(origpoints[i + m]);
+ }
+
+ datapoints.points = newpoints;
+ thresholded.datapoints.points = threspoints;
+
+ if (thresholded.datapoints.points.length > 0) {
+ var origIndex = $.inArray(s, plot.getData());
+ // Insert newly-generated series right after original one (to prevent it from becoming top-most)
+ plot.getData().splice(origIndex + 1, 0, thresholded);
+ }
+
+ // FIXME: there are probably some edge cases left in bars
+ }
+
+ function processThresholds(plot, s, datapoints) {
+ if (!s.threshold)
+ return;
+
+ if (s.threshold instanceof Array) {
+ s.threshold.sort(function(a, b) {
+ return a.below - b.below;
+ });
+
+ $(s.threshold).each(function(i, th) {
+ thresholdData(plot, s, datapoints, th.below, th.color);
+ });
+ }
+ else {
+ thresholdData(plot, s, datapoints, s.threshold.below, s.threshold.color);
+ }
+ }
+
+ plot.hooks.processDatapoints.push(processThresholds);
+ }
+
+ $.plot.plugins.push({
+ init: init,
+ options: options,
+ name: 'threshold',
+ version: '1.2'
+ });
+})(jQuery);
diff --git a/www/js/contrib/jquery.flot.time.js b/www/js/contrib/jquery.flot.time.js
new file mode 100644
index 00000000..34c1d121
--- /dev/null
+++ b/www/js/contrib/jquery.flot.time.js
@@ -0,0 +1,432 @@
+/* Pretty handling of time axes.
+
+Copyright (c) 2007-2014 IOLA and Ole Laursen.
+Licensed under the MIT license.
+
+Set axis.mode to "time" to enable. See the section "Time series data" in
+API.txt for details.
+
+*/
+
+(function($) {
+
+ var options = {
+ xaxis: {
+ timezone: null, // "browser" for local to the client or timezone for timezone-js
+ timeformat: null, // format string to use
+ twelveHourClock: false, // 12 or 24 time in time mode
+ monthNames: null // list of names of months
+ }
+ };
+
+ // round to nearby lower multiple of base
+
+ function floorInBase(n, base) {
+ return base * Math.floor(n / base);
+ }
+
+ // Returns a string with the date d formatted according to fmt.
+ // A subset of the Open Group's strftime format is supported.
+
+ function formatDate(d, fmt, monthNames, dayNames) {
+
+ if (typeof d.strftime == "function") {
+ return d.strftime(fmt);
+ }
+
+ var leftPad = function(n, pad) {
+ n = "" + n;
+ pad = "" + (pad == null ? "0" : pad);
+ return n.length == 1 ? pad + n : n;
+ };
+
+ var r = [];
+ var escape = false;
+ var hours = d.getHours();
+ var isAM = hours < 12;
+
+ if (monthNames == null) {
+ monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+ }
+
+ if (dayNames == null) {
+ dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
+ }
+
+ var hours12;
+
+ if (hours > 12) {
+ hours12 = hours - 12;
+ } else if (hours == 0) {
+ hours12 = 12;
+ } else {
+ hours12 = hours;
+ }
+
+ for (var i = 0; i < fmt.length; ++i) {
+
+ var c = fmt.charAt(i);
+
+ if (escape) {
+ switch (c) {
+ case 'a': c = "" + dayNames[d.getDay()]; break;
+ case 'b': c = "" + monthNames[d.getMonth()]; break;
+ case 'd': c = leftPad(d.getDate()); break;
+ case 'e': c = leftPad(d.getDate(), " "); break;
+ case 'h': // For back-compat with 0.7; remove in 1.0
+ case 'H': c = leftPad(hours); break;
+ case 'I': c = leftPad(hours12); break;
+ case 'l': c = leftPad(hours12, " "); break;
+ case 'm': c = leftPad(d.getMonth() + 1); break;
+ case 'M': c = leftPad(d.getMinutes()); break;
+ // quarters not in Open Group's strftime specification
+ case 'q':
+ c = "" + (Math.floor(d.getMonth() / 3) + 1); break;
+ case 'S': c = leftPad(d.getSeconds()); break;
+ case 'y': c = leftPad(d.getFullYear() % 100); break;
+ case 'Y': c = "" + d.getFullYear(); break;
+ case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break;
+ case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break;
+ case 'w': c = "" + d.getDay(); break;
+ }
+ r.push(c);
+ escape = false;
+ } else {
+ if (c == "%") {
+ escape = true;
+ } else {
+ r.push(c);
+ }
+ }
+ }
+
+ return r.join("");
+ }
+
+ // To have a consistent view of time-based data independent of which time
+ // zone the client happens to be in we need a date-like object independent
+ // of time zones. This is done through a wrapper that only calls the UTC
+ // versions of the accessor methods.
+
+ function makeUtcWrapper(d) {
+
+ function addProxyMethod(sourceObj, sourceMethod, targetObj, targetMethod) {
+ sourceObj[sourceMethod] = function() {
+ return targetObj[targetMethod].apply(targetObj, arguments);
+ };
+ };
+
+ var utc = {
+ date: d
+ };
+
+ // support strftime, if found
+
+ if (d.strftime != undefined) {
+ addProxyMethod(utc, "strftime", d, "strftime");
+ }
+
+ addProxyMethod(utc, "getTime", d, "getTime");
+ addProxyMethod(utc, "setTime", d, "setTime");
+
+ var props = ["Date", "Day", "FullYear", "Hours", "Milliseconds", "Minutes", "Month", "Seconds"];
+
+ for (var p = 0; p < props.length; p++) {
+ addProxyMethod(utc, "get" + props[p], d, "getUTC" + props[p]);
+ addProxyMethod(utc, "set" + props[p], d, "setUTC" + props[p]);
+ }
+
+ return utc;
+ };
+
+ // select time zone strategy. This returns a date-like object tied to the
+ // desired timezone
+
+ function dateGenerator(ts, opts) {
+ if (opts.timezone == "browser") {
+ return new Date(ts);
+ } else if (!opts.timezone || opts.timezone == "utc") {
+ return makeUtcWrapper(new Date(ts));
+ } else if (typeof timezoneJS != "undefined" && typeof timezoneJS.Date != "undefined") {
+ var d = new timezoneJS.Date();
+ // timezone-js is fickle, so be sure to set the time zone before
+ // setting the time.
+ d.setTimezone(opts.timezone);
+ d.setTime(ts);
+ return d;
+ } else {
+ return makeUtcWrapper(new Date(ts));
+ }
+ }
+
+ // map of app. size of time units in milliseconds
+
+ var timeUnitSize = {
+ "second": 1000,
+ "minute": 60 * 1000,
+ "hour": 60 * 60 * 1000,
+ "day": 24 * 60 * 60 * 1000,
+ "month": 30 * 24 * 60 * 60 * 1000,
+ "quarter": 3 * 30 * 24 * 60 * 60 * 1000,
+ "year": 365.2425 * 24 * 60 * 60 * 1000
+ };
+
+ // the allowed tick sizes, after 1 year we use
+ // an integer algorithm
+
+ var baseSpec = [
+ [1, "second"], [2, "second"], [5, "second"], [10, "second"],
+ [30, "second"],
+ [1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"],
+ [30, "minute"],
+ [1, "hour"], [2, "hour"], [4, "hour"],
+ [8, "hour"], [12, "hour"],
+ [1, "day"], [2, "day"], [3, "day"],
+ [0.25, "month"], [0.5, "month"], [1, "month"],
+ [2, "month"]
+ ];
+
+ // we don't know which variant(s) we'll need yet, but generating both is
+ // cheap
+
+ var specMonths = baseSpec.concat([[3, "month"], [6, "month"],
+ [1, "year"]]);
+ var specQuarters = baseSpec.concat([[1, "quarter"], [2, "quarter"],
+ [1, "year"]]);
+
+ function init(plot) {
+ plot.hooks.processOptions.push(function (plot, options) {
+ $.each(plot.getAxes(), function(axisName, axis) {
+
+ var opts = axis.options;
+
+ if (opts.mode == "time") {
+ axis.tickGenerator = function(axis) {
+
+ var ticks = [];
+ var d = dateGenerator(axis.min, opts);
+ var minSize = 0;
+
+ // make quarter use a possibility if quarters are
+ // mentioned in either of these options
+
+ var spec = (opts.tickSize && opts.tickSize[1] ===
+ "quarter") ||
+ (opts.minTickSize && opts.minTickSize[1] ===
+ "quarter") ? specQuarters : specMonths;
+
+ if (opts.minTickSize != null) {
+ if (typeof opts.tickSize == "number") {
+ minSize = opts.tickSize;
+ } else {
+ minSize = opts.minTickSize[0] * timeUnitSize[opts.minTickSize[1]];
+ }
+ }
+
+ for (var i = 0; i < spec.length - 1; ++i) {
+ if (axis.delta < (spec[i][0] * timeUnitSize[spec[i][1]]
+ + spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2
+ && spec[i][0] * timeUnitSize[spec[i][1]] >= minSize) {
+ break;
+ }
+ }
+
+ var size = spec[i][0];
+ var unit = spec[i][1];
+
+ // special-case the possibility of several years
+
+ if (unit == "year") {
+
+ // if given a minTickSize in years, just use it,
+ // ensuring that it's an integer
+
+ if (opts.minTickSize != null && opts.minTickSize[1] == "year") {
+ size = Math.floor(opts.minTickSize[0]);
+ } else {
+
+ var magn = Math.pow(10, Math.floor(Math.log(axis.delta / timeUnitSize.year) / Math.LN10));
+ var norm = (axis.delta / timeUnitSize.year) / magn;
+
+ if (norm < 1.5) {
+ size = 1;
+ } else if (norm < 3) {
+ size = 2;
+ } else if (norm < 7.5) {
+ size = 5;
+ } else {
+ size = 10;
+ }
+
+ size *= magn;
+ }
+
+ // minimum size for years is 1
+
+ if (size < 1) {
+ size = 1;
+ }
+ }
+
+ axis.tickSize = opts.tickSize || [size, unit];
+ var tickSize = axis.tickSize[0];
+ unit = axis.tickSize[1];
+
+ var step = tickSize * timeUnitSize[unit];
+
+ if (unit == "second") {
+ d.setSeconds(floorInBase(d.getSeconds(), tickSize));
+ } else if (unit == "minute") {
+ d.setMinutes(floorInBase(d.getMinutes(), tickSize));
+ } else if (unit == "hour") {
+ d.setHours(floorInBase(d.getHours(), tickSize));
+ } else if (unit == "month") {
+ d.setMonth(floorInBase(d.getMonth(), tickSize));
+ } else if (unit == "quarter") {
+ d.setMonth(3 * floorInBase(d.getMonth() / 3,
+ tickSize));
+ } else if (unit == "year") {
+ d.setFullYear(floorInBase(d.getFullYear(), tickSize));
+ }
+
+ // reset smaller components
+
+ d.setMilliseconds(0);
+
+ if (step >= timeUnitSize.minute) {
+ d.setSeconds(0);
+ }
+ if (step >= timeUnitSize.hour) {
+ d.setMinutes(0);
+ }
+ if (step >= timeUnitSize.day) {
+ d.setHours(0);
+ }
+ if (step >= timeUnitSize.day * 4) {
+ d.setDate(1);
+ }
+ if (step >= timeUnitSize.month * 2) {
+ d.setMonth(floorInBase(d.getMonth(), 3));
+ }
+ if (step >= timeUnitSize.quarter * 2) {
+ d.setMonth(floorInBase(d.getMonth(), 6));
+ }
+ if (step >= timeUnitSize.year) {
+ d.setMonth(0);
+ }
+
+ var carry = 0;
+ var v = Number.NaN;
+ var prev;
+
+ do {
+
+ prev = v;
+ v = d.getTime();
+ ticks.push(v);
+
+ if (unit == "month" || unit == "quarter") {
+ if (tickSize < 1) {
+
+ // a bit complicated - we'll divide the
+ // month/quarter up but we need to take
+ // care of fractions so we don't end up in
+ // the middle of a day
+
+ d.setDate(1);
+ var start = d.getTime();
+ d.setMonth(d.getMonth() +
+ (unit == "quarter" ? 3 : 1));
+ var end = d.getTime();
+ d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize);
+ carry = d.getHours();
+ d.setHours(0);
+ } else {
+ d.setMonth(d.getMonth() +
+ tickSize * (unit == "quarter" ? 3 : 1));
+ }
+ } else if (unit == "year") {
+ d.setFullYear(d.getFullYear() + tickSize);
+ } else {
+ d.setTime(v + step);
+ }
+ } while (v < axis.max && v != prev);
+
+ return ticks;
+ };
+
+ axis.tickFormatter = function (v, axis) {
+
+ var d = dateGenerator(v, axis.options);
+
+ // first check global format
+
+ if (opts.timeformat != null) {
+ return formatDate(d, opts.timeformat, opts.monthNames, opts.dayNames);
+ }
+
+ // possibly use quarters if quarters are mentioned in
+ // any of these places
+
+ var useQuarters = (axis.options.tickSize &&
+ axis.options.tickSize[1] == "quarter") ||
+ (axis.options.minTickSize &&
+ axis.options.minTickSize[1] == "quarter");
+
+ var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]];
+ var span = axis.max - axis.min;
+ var suffix = (opts.twelveHourClock) ? " %p" : "";
+ var hourCode = (opts.twelveHourClock) ? "%I" : "%H";
+ var fmt;
+
+ if (t < timeUnitSize.minute) {
+ fmt = hourCode + ":%M:%S" + suffix;
+ } else if (t < timeUnitSize.day) {
+ if (span < 2 * timeUnitSize.day) {
+ fmt = hourCode + ":%M" + suffix;
+ } else {
+ fmt = "%b %d " + hourCode + ":%M" + suffix;
+ }
+ } else if (t < timeUnitSize.month) {
+ fmt = "%b %d";
+ } else if ((useQuarters && t < timeUnitSize.quarter) ||
+ (!useQuarters && t < timeUnitSize.year)) {
+ if (span < timeUnitSize.year) {
+ fmt = "%b";
+ } else {
+ fmt = "%b %Y";
+ }
+ } else if (useQuarters && t < timeUnitSize.year) {
+ if (span < timeUnitSize.year) {
+ fmt = "Q%q";
+ } else {
+ fmt = "Q%q %Y";
+ }
+ } else {
+ fmt = "%Y";
+ }
+
+ var rt = formatDate(d, fmt, opts.monthNames, opts.dayNames);
+
+ return rt;
+ };
+ }
+ });
+ });
+ }
+
+ $.plot.plugins.push({
+ init: init,
+ options: options,
+ name: 'time',
+ version: '1.0'
+ });
+
+ // Time-axis support used to be in Flot core, which exposed the
+ // formatDate function on the plot object. Various plugins depend
+ // on the function, so we need to re-expose it here.
+
+ $.plot.formatDate = formatDate;
+ $.plot.dateGenerator = dateGenerator;
+
+})(jQuery);
diff --git a/www/js/contrib/vis.js b/www/js/contrib/vis.js
new file mode 100644
index 00000000..2e170c8b
--- /dev/null
+++ b/www/js/contrib/vis.js
@@ -0,0 +1,51961 @@
+/**
+ * vis.js
+ * https://github.com/almende/vis
+ *
+ * A dynamic, browser-based visualization library.
+ *
+ * @version 4.18.1
+ * @date 2017-01-29
+ *
+ * @license
+ * Copyright (C) 2011-2016 Almende B.V, http://almende.com
+ *
+ * Vis.js is dual licensed under both
+ *
+ * * The Apache 2.0 License
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * and
+ *
+ * * The MIT License
+ * http://opensource.org/licenses/MIT
+ *
+ * Vis.js may be distributed under either license.
+ */
+
+"use strict";
+
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(typeof exports === 'object' && typeof module === 'object')
+ module.exports = factory();
+ else if(typeof define === 'function' && define.amd)
+ define([], factory);
+ else if(typeof exports === 'object')
+ exports["vis"] = factory();
+ else
+ root["vis"] = factory();
+})(this, function() {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var util = __webpack_require__(1);
+
+ // Graph3d
+ util.extend(exports, __webpack_require__(89));
+
+ // Timeline & Graph2d
+ util.extend(exports, __webpack_require__(112));
+
+ // Network
+ util.extend(exports, __webpack_require__(154));
+
+/***/ },
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _getIterator2 = __webpack_require__(2);
+
+ var _getIterator3 = _interopRequireDefault(_getIterator2);
+
+ var _create = __webpack_require__(55);
+
+ var _create2 = _interopRequireDefault(_create);
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ // utility functions
+
+ // first check if moment.js is already loaded in the browser window, if so,
+ // use this instance. Else, load via commonjs.
+
+
+ var moment = __webpack_require__(84);
+ var uuid = __webpack_require__(88);
+
+ /**
+ * Test whether given object is a number
+ * @param {*} object
+ * @return {Boolean} isNumber
+ */
+ exports.isNumber = function (object) {
+ return object instanceof Number || typeof object == 'number';
+ };
+
+ /**
+ * Censors object elements containing dom elements
+ * @param {*} object
+ * @return {Object} object without elements
+ */
+ exports.elementsCensor = function (object) {
+ if (!object) return;
+ var replacer = function replacer(key, value) {
+ if (value instanceof Element) {
+ return "DOM Element";
+ } else {
+ return value;
+ }
+ };
+ return JSON.parse((0, _stringify2['default'])(object, replacer));
+ };
+
+ /**
+ * Remove everything in the DOM object
+ * @param DOMobject
+ */
+ exports.recursiveDOMDelete = function (DOMobject) {
+ if (DOMobject) {
+ while (DOMobject.hasChildNodes() === true) {
+ exports.recursiveDOMDelete(DOMobject.firstChild);
+ DOMobject.removeChild(DOMobject.firstChild);
+ }
+ }
+ };
+
+ /**
+ * this function gives you a range between 0 and 1 based on the min and max values in the set, the total sum of all values and the current value.
+ *
+ * @param min
+ * @param max
+ * @param total
+ * @param value
+ * @returns {number}
+ */
+ exports.giveRange = function (min, max, total, value) {
+ if (max == min) {
+ return 0.5;
+ } else {
+ var scale = 1 / (max - min);
+ return Math.max(0, (value - min) * scale);
+ }
+ };
+
+ /**
+ * Test whether given object is a string
+ * @param {*} object
+ * @return {Boolean} isString
+ */
+ exports.isString = function (object) {
+ return object instanceof String || typeof object == 'string';
+ };
+
+ /**
+ * Test whether given object is a Date, or a String containing a Date
+ * @param {Date | String} object
+ * @return {Boolean} isDate
+ */
+ exports.isDate = function (object) {
+ if (object instanceof Date) {
+ return true;
+ } else if (exports.isString(object)) {
+ // test whether this string contains a date
+ var match = ASPDateRegex.exec(object);
+ if (match) {
+ return true;
+ } else if (!isNaN(Date.parse(object))) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ /**
+ * Create a semi UUID
+ * source: http://stackoverflow.com/a/105074/1262753
+ * @return {String} uuid
+ */
+ exports.randomUUID = function () {
+ return uuid.v4();
+ };
+
+ /**
+ * assign all keys of an object that are not nested objects to a certain value (used for color objects).
+ * @param obj
+ * @param value
+ */
+ exports.assignAllKeys = function (obj, value) {
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ if ((0, _typeof3['default'])(obj[prop]) !== 'object') {
+ obj[prop] = value;
+ }
+ }
+ }
+ };
+
+ /**
+ * Fill an object with a possibly partially defined other object. Only copies values if the a object has an object requiring values.
+ * That means an object is not created on a property if only the b object has it.
+ * @param obj
+ * @param value
+ */
+ exports.fillIfDefined = function (a, b) {
+ var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ for (var prop in a) {
+ if (b[prop] !== undefined) {
+ if ((0, _typeof3['default'])(b[prop]) !== 'object') {
+ if ((b[prop] === undefined || b[prop] === null) && a[prop] !== undefined && allowDeletion === true) {
+ delete a[prop];
+ } else {
+ a[prop] = b[prop];
+ }
+ } else {
+ if ((0, _typeof3['default'])(a[prop]) === 'object') {
+ exports.fillIfDefined(a[prop], b[prop], allowDeletion);
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ * Extend object a with the properties of object b or a series of objects
+ * Only properties with defined values are copied
+ * @param {Object} a
+ * @param {... Object} b
+ * @return {Object} a
+ */
+ exports.protoExtend = function (a, b) {
+ for (var i = 1; i < arguments.length; i++) {
+ var other = arguments[i];
+ for (var prop in other) {
+ a[prop] = other[prop];
+ }
+ }
+ return a;
+ };
+
+ /**
+ * Extend object a with the properties of object b or a series of objects
+ * Only properties with defined values are copied
+ * @param {Object} a
+ * @param {... Object} b
+ * @return {Object} a
+ */
+ exports.extend = function (a, b) {
+ for (var i = 1; i < arguments.length; i++) {
+ var other = arguments[i];
+ for (var prop in other) {
+ if (other.hasOwnProperty(prop)) {
+ a[prop] = other[prop];
+ }
+ }
+ }
+ return a;
+ };
+
+ /**
+ * Extend object a with selected properties of object b or a series of objects
+ * Only properties with defined values are copied
+ * @param {Array.<String>} props
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Object} a
+ */
+ exports.selectiveExtend = function (props, a, b) {
+ if (!Array.isArray(props)) {
+ throw new Error('Array with property names expected as first argument');
+ }
+
+ for (var i = 2; i < arguments.length; i++) {
+ var other = arguments[i];
+
+ for (var p = 0; p < props.length; p++) {
+ var prop = props[p];
+ if (other.hasOwnProperty(prop)) {
+ a[prop] = other[prop];
+ }
+ }
+ }
+ return a;
+ };
+
+ /**
+ * Extend object a with selected properties of object b or a series of objects
+ * Only properties with defined values are copied
+ * @param {Array.<String>} props
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Object} a
+ */
+ exports.selectiveDeepExtend = function (props, a, b) {
+ var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+
+ // TODO: add support for Arrays to deepExtend
+ if (Array.isArray(b)) {
+ throw new TypeError('Arrays are not supported by deepExtend');
+ }
+ for (var i = 2; i < arguments.length; i++) {
+ var other = arguments[i];
+ for (var p = 0; p < props.length; p++) {
+ var prop = props[p];
+ if (other.hasOwnProperty(prop)) {
+ if (b[prop] && b[prop].constructor === Object) {
+ if (a[prop] === undefined) {
+ a[prop] = {};
+ }
+ if (a[prop].constructor === Object) {
+ exports.deepExtend(a[prop], b[prop], false, allowDeletion);
+ } else {
+ if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) {
+ delete a[prop];
+ } else {
+ a[prop] = b[prop];
+ }
+ }
+ } else if (Array.isArray(b[prop])) {
+ throw new TypeError('Arrays are not supported by deepExtend');
+ } else {
+ if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) {
+ delete a[prop];
+ } else {
+ a[prop] = b[prop];
+ }
+ }
+ }
+ }
+ }
+ return a;
+ };
+
+ /**
+ * Extend object a with selected properties of object b or a series of objects
+ * Only properties with defined values are copied
+ * @param {Array.<String>} props
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Object} a
+ */
+ exports.selectiveNotDeepExtend = function (props, a, b) {
+ var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+
+ // TODO: add support for Arrays to deepExtend
+ if (Array.isArray(b)) {
+ throw new TypeError('Arrays are not supported by deepExtend');
+ }
+ for (var prop in b) {
+ if (b.hasOwnProperty(prop)) {
+ if (props.indexOf(prop) == -1) {
+ if (b[prop] && b[prop].constructor === Object) {
+ if (a[prop] === undefined) {
+ a[prop] = {};
+ }
+ if (a[prop].constructor === Object) {
+ exports.deepExtend(a[prop], b[prop]);
+ } else {
+ if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) {
+ delete a[prop];
+ } else {
+ a[prop] = b[prop];
+ }
+ }
+ } else if (Array.isArray(b[prop])) {
+ a[prop] = [];
+ for (var i = 0; i < b[prop].length; i++) {
+ a[prop].push(b[prop][i]);
+ }
+ } else {
+ if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) {
+ delete a[prop];
+ } else {
+ a[prop] = b[prop];
+ }
+ }
+ }
+ }
+ }
+ return a;
+ };
+
+ /**
+ * Deep extend an object a with the properties of object b
+ * @param {Object} a
+ * @param {Object} b
+ * @param [Boolean] protoExtend --> optional parameter. If true, the prototype values will also be extended.
+ * (ie. the options objects that inherit from others will also get the inherited options)
+ * @param [Boolean] global --> optional parameter. If true, the values of fields that are null will not deleted
+ * @returns {Object}
+ */
+ exports.deepExtend = function (a, b, protoExtend, allowDeletion) {
+ for (var prop in b) {
+ if (b.hasOwnProperty(prop) || protoExtend === true) {
+ if (b[prop] && b[prop].constructor === Object) {
+ if (a[prop] === undefined) {
+ a[prop] = {};
+ }
+ if (a[prop].constructor === Object) {
+ exports.deepExtend(a[prop], b[prop], protoExtend);
+ } else {
+ if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) {
+ delete a[prop];
+ } else {
+ a[prop] = b[prop];
+ }
+ }
+ } else if (Array.isArray(b[prop])) {
+ a[prop] = [];
+ for (var i = 0; i < b[prop].length; i++) {
+ a[prop].push(b[prop][i]);
+ }
+ } else {
+ if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) {
+ delete a[prop];
+ } else {
+ a[prop] = b[prop];
+ }
+ }
+ }
+ }
+ return a;
+ };
+
+ /**
+ * Test whether all elements in two arrays are equal.
+ * @param {Array} a
+ * @param {Array} b
+ * @return {boolean} Returns true if both arrays have the same length and same
+ * elements.
+ */
+ exports.equalArray = function (a, b) {
+ if (a.length != b.length) return false;
+
+ for (var i = 0, len = a.length; i < len; i++) {
+ if (a[i] != b[i]) return false;
+ }
+
+ return true;
+ };
+
+ /**
+ * Convert an object to another type
+ * @param {Boolean | Number | String | Date | Moment | Null | undefined} object
+ * @param {String | undefined} type Name of the type. Available types:
+ * 'Boolean', 'Number', 'String',
+ * 'Date', 'Moment', ISODate', 'ASPDate'.
+ * @return {*} object
+ * @throws Error
+ */
+ exports.convert = function (object, type) {
+ var match;
+
+ if (object === undefined) {
+ return undefined;
+ }
+ if (object === null) {
+ return null;
+ }
+
+ if (!type) {
+ return object;
+ }
+ if (!(typeof type === 'string') && !(type instanceof String)) {
+ throw new Error('Type must be a string');
+ }
+
+ //noinspection FallthroughInSwitchStatementJS
+ switch (type) {
+ case 'boolean':
+ case 'Boolean':
+ return Boolean(object);
+
+ case 'number':
+ case 'Number':
+ if (exports.isString(object) && !isNaN(Date.parse(object))) {
+ return moment(object).valueOf();
+ } else {
+ return Number(object.valueOf());
+ }
+ case 'string':
+ case 'String':
+ return String(object);
+
+ case 'Date':
+ if (exports.isNumber(object)) {
+ return new Date(object);
+ }
+ if (object instanceof Date) {
+ return new Date(object.valueOf());
+ } else if (moment.isMoment(object)) {
+ return new Date(object.valueOf());
+ }
+ if (exports.isString(object)) {
+ match = ASPDateRegex.exec(object);
+ if (match) {
+ // object is an ASP date
+ return new Date(Number(match[1])); // parse number
+ } else {
+ return moment(new Date(object)).toDate(); // parse string
+ }
+ } else {
+ throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date');
+ }
+
+ case 'Moment':
+ if (exports.isNumber(object)) {
+ return moment(object);
+ }
+ if (object instanceof Date) {
+ return moment(object.valueOf());
+ } else if (moment.isMoment(object)) {
+ return moment(object);
+ }
+ if (exports.isString(object)) {
+ match = ASPDateRegex.exec(object);
+ if (match) {
+ // object is an ASP date
+ return moment(Number(match[1])); // parse number
+ } else {
+ return moment(object); // parse string
+ }
+ } else {
+ throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date');
+ }
+
+ case 'ISODate':
+ if (exports.isNumber(object)) {
+ return new Date(object);
+ } else if (object instanceof Date) {
+ return object.toISOString();
+ } else if (moment.isMoment(object)) {
+ return object.toDate().toISOString();
+ } else if (exports.isString(object)) {
+ match = ASPDateRegex.exec(object);
+ if (match) {
+ // object is an ASP date
+ return new Date(Number(match[1])).toISOString(); // parse number
+ } else {
+ return moment(object).format(); // ISO 8601
+ }
+ } else {
+ throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ISODate');
+ }
+
+ case 'ASPDate':
+ if (exports.isNumber(object)) {
+ return '/Date(' + object + ')/';
+ } else if (object instanceof Date) {
+ return '/Date(' + object.valueOf() + ')/';
+ } else if (exports.isString(object)) {
+ match = ASPDateRegex.exec(object);
+ var value;
+ if (match) {
+ // object is an ASP date
+ value = new Date(Number(match[1])).valueOf(); // parse number
+ } else {
+ value = new Date(object).valueOf(); // parse string
+ }
+ return '/Date(' + value + ')/';
+ } else {
+ throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ASPDate');
+ }
+
+ default:
+ throw new Error('Unknown type "' + type + '"');
+ }
+ };
+
+ // parse ASP.Net Date pattern,
+ // for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/'
+ // code from http://momentjs.com/
+ var ASPDateRegex = /^\/?Date\((\-?\d+)/i;
+
+ /**
+ * Get the type of an object, for example exports.getType([]) returns 'Array'
+ * @param {*} object
+ * @return {String} type
+ */
+ exports.getType = function (object) {
+ var type = typeof object === 'undefined' ? 'undefined' : (0, _typeof3['default'])(object);
+
+ if (type == 'object') {
+ if (object === null) {
+ return 'null';
+ }
+ if (object instanceof Boolean) {
+ return 'Boolean';
+ }
+ if (object instanceof Number) {
+ return 'Number';
+ }
+ if (object instanceof String) {
+ return 'String';
+ }
+ if (Array.isArray(object)) {
+ return 'Array';
+ }
+ if (object instanceof Date) {
+ return 'Date';
+ }
+ return 'Object';
+ } else if (type == 'number') {
+ return 'Number';
+ } else if (type == 'boolean') {
+ return 'Boolean';
+ } else if (type == 'string') {
+ return 'String';
+ } else if (type === undefined) {
+ return 'undefined';
+ }
+
+ return type;
+ };
+
+ /**
+ * Used to extend an array and copy it. This is used to propagate paths recursively.
+ *
+ * @param arr
+ * @param newValue
+ * @returns {Array}
+ */
+ exports.copyAndExtendArray = function (arr, newValue) {
+ var newArr = [];
+ for (var i = 0; i < arr.length; i++) {
+ newArr.push(arr[i]);
+ }
+ newArr.push(newValue);
+ return newArr;
+ };
+
+ /**
+ * Used to extend an array and copy it. This is used to propagate paths recursively.
+ *
+ * @param arr
+ * @param newValue
+ * @returns {Array}
+ */
+ exports.copyArray = function (arr) {
+ var newArr = [];
+ for (var i = 0; i < arr.length; i++) {
+ newArr.push(arr[i]);
+ }
+ return newArr;
+ };
+
+ /**
+ * Retrieve the absolute left value of a DOM element
+ * @param {Element} elem A dom element, for example a div
+ * @return {number} left The absolute left position of this element
+ * in the browser page.
+ */
+ exports.getAbsoluteLeft = function (elem) {
+ return elem.getBoundingClientRect().left;
+ };
+
+ exports.getAbsoluteRight = function (elem) {
+ return elem.getBoundingClientRect().right;
+ };
+
+ /**
+ * Retrieve the absolute top value of a DOM element
+ * @param {Element} elem A dom element, for example a div
+ * @return {number} top The absolute top position of this element
+ * in the browser page.
+ */
+ exports.getAbsoluteTop = function (elem) {
+ return elem.getBoundingClientRect().top;
+ };
+
+ /**
+ * add a className to the given elements style
+ * @param {Element} elem
+ * @param {String} className
+ */
+ exports.addClassName = function (elem, className) {
+ var classes = elem.className.split(' ');
+ if (classes.indexOf(className) == -1) {
+ classes.push(className); // add the class to the array
+ elem.className = classes.join(' ');
+ }
+ };
+
+ /**
+ * add a className to the given elements style
+ * @param {Element} elem
+ * @param {String} className
+ */
+ exports.removeClassName = function (elem, className) {
+ var classes = elem.className.split(' ');
+ var index = classes.indexOf(className);
+ if (index != -1) {
+ classes.splice(index, 1); // remove the class from the array
+ elem.className = classes.join(' ');
+ }
+ };
+
+ /**
+ * For each method for both arrays and objects.
+ * In case of an array, the built-in Array.forEach() is applied.
+ * In case of an Object, the method loops over all properties of the object.
+ * @param {Object | Array} object An Object or Array
+ * @param {function} callback Callback method, called for each item in
+ * the object or array with three parameters:
+ * callback(value, index, object)
+ */
+ exports.forEach = function (object, callback) {
+ var i, len;
+ if (Array.isArray(object)) {
+ // array
+ for (i = 0, len = object.length; i < len; i++) {
+ callback(object[i], i, object);
+ }
+ } else {
+ // object
+ for (i in object) {
+ if (object.hasOwnProperty(i)) {
+ callback(object[i], i, object);
+ }
+ }
+ }
+ };
+
+ /**
+ * Convert an object into an array: all objects properties are put into the
+ * array. The resulting array is unordered.
+ * @param {Object} object
+ * @param {Array} array
+ */
+ exports.toArray = function (object) {
+ var array = [];
+
+ for (var prop in object) {
+ if (object.hasOwnProperty(prop)) array.push(object[prop]);
+ }
+
+ return array;
+ };
+
+ /**
+ * Update a property in an object
+ * @param {Object} object
+ * @param {String} key
+ * @param {*} value
+ * @return {Boolean} changed
+ */
+ exports.updateProperty = function (object, key, value) {
+ if (object[key] !== value) {
+ object[key] = value;
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /**
+ * Throttle the given function to be only executed once per animation frame
+ * @param {function} fn
+ * @returns {function} Returns the throttled function
+ */
+ exports.throttle = function (fn) {
+ var scheduled = false;
+
+ return function throttled() {
+ if (!scheduled) {
+ scheduled = true;
+ requestAnimationFrame(function () {
+ scheduled = false;
+ fn();
+ });
+ }
+ };
+ };
+
+ /**
+ * Add and event listener. Works for all browsers
+ * @param {Element} element An html element
+ * @param {string} action The action, for example "click",
+ * without the prefix "on"
+ * @param {function} listener The callback function to be executed
+ * @param {boolean} [useCapture]
+ */
+ exports.addEventListener = function (element, action, listener, useCapture) {
+ if (element.addEventListener) {
+ if (useCapture === undefined) useCapture = false;
+
+ if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) {
+ action = "DOMMouseScroll"; // For Firefox
+ }
+
+ element.addEventListener(action, listener, useCapture);
+ } else {
+ element.attachEvent("on" + action, listener); // IE browsers
+ }
+ };
+
+ /**
+ * Remove an event listener from an element
+ * @param {Element} element An html dom element
+ * @param {string} action The name of the event, for example "mousedown"
+ * @param {function} listener The listener function
+ * @param {boolean} [useCapture]
+ */
+ exports.removeEventListener = function (element, action, listener, useCapture) {
+ if (element.removeEventListener) {
+ // non-IE browsers
+ if (useCapture === undefined) useCapture = false;
+
+ if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) {
+ action = "DOMMouseScroll"; // For Firefox
+ }
+
+ element.removeEventListener(action, listener, useCapture);
+ } else {
+ // IE browsers
+ element.detachEvent("on" + action, listener);
+ }
+ };
+
+ /**
+ * Cancels the event if it is cancelable, without stopping further propagation of the event.
+ */
+ exports.preventDefault = function (event) {
+ if (!event) event = window.event;
+
+ if (event.preventDefault) {
+ event.preventDefault(); // non-IE browsers
+ } else {
+ event.returnValue = false; // IE browsers
+ }
+ };
+
+ /**
+ * Get HTML element which is the target of the event
+ * @param {Event} event
+ * @return {Element} target element
+ */
+ exports.getTarget = function (event) {
+ // code from http://www.quirksmode.org/js/events_properties.html
+ if (!event) {
+ event = window.event;
+ }
+
+ var target;
+
+ if (event.target) {
+ target = event.target;
+ } else if (event.srcElement) {
+ target = event.srcElement;
+ }
+
+ if (target.nodeType != undefined && target.nodeType == 3) {
+ // defeat Safari bug
+ target = target.parentNode;
+ }
+
+ return target;
+ };
+
+ /**
+ * Check if given element contains given parent somewhere in the DOM tree
+ * @param {Element} element
+ * @param {Element} parent
+ */
+ exports.hasParent = function (element, parent) {
+ var e = element;
+
+ while (e) {
+ if (e === parent) {
+ return true;
+ }
+ e = e.parentNode;
+ }
+
+ return false;
+ };
+
+ exports.option = {};
+
+ /**
+ * Convert a value into a boolean
+ * @param {Boolean | function | undefined} value
+ * @param {Boolean} [defaultValue]
+ * @returns {Boolean} bool
+ */
+ exports.option.asBoolean = function (value, defaultValue) {
+ if (typeof value == 'function') {
+ value = value();
+ }
+
+ if (value != null) {
+ return value != false;
+ }
+
+ return defaultValue || null;
+ };
+
+ /**
+ * Convert a value into a number
+ * @param {Boolean | function | undefined} value
+ * @param {Number} [defaultValue]
+ * @returns {Number} number
+ */
+ exports.option.asNumber = function (value, defaultValue) {
+ if (typeof value == 'function') {
+ value = value();
+ }
+
+ if (value != null) {
+ return Number(value) || defaultValue || null;
+ }
+
+ return defaultValue || null;
+ };
+
+ /**
+ * Convert a value into a string
+ * @param {String | function | undefined} value
+ * @param {String} [defaultValue]
+ * @returns {String} str
+ */
+ exports.option.asString = function (value, defaultValue) {
+ if (typeof value == 'function') {
+ value = value();
+ }
+
+ if (value != null) {
+ return String(value);
+ }
+
+ return defaultValue || null;
+ };
+
+ /**
+ * Convert a size or location into a string with pixels or a percentage
+ * @param {String | Number | function | undefined} value
+ * @param {String} [defaultValue]
+ * @returns {String} size
+ */
+ exports.option.asSize = function (value, defaultValue) {
+ if (typeof value == 'function') {
+ value = value();
+ }
+
+ if (exports.isString(value)) {
+ return value;
+ } else if (exports.isNumber(value)) {
+ return value + 'px';
+ } else {
+ return defaultValue || null;
+ }
+ };
+
+ /**
+ * Convert a value into a DOM element
+ * @param {HTMLElement | function | undefined} value
+ * @param {HTMLElement} [defaultValue]
+ * @returns {HTMLElement | null} dom
+ */
+ exports.option.asElement = function (value, defaultValue) {
+ if (typeof value == 'function') {
+ value = value();
+ }
+
+ return value || defaultValue || null;
+ };
+
+ /**
+ * http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
+ *
+ * @param {String} hex
+ * @returns {{r: *, g: *, b: *}} | 255 range
+ */
+ exports.hexToRGB = function (hex) {
+ // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
+ var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
+ hex = hex.replace(shorthandRegex, function (m, r, g, b) {
+ return r + r + g + g + b + b;
+ });
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
+ return result ? {
+ r: parseInt(result[1], 16),
+ g: parseInt(result[2], 16),
+ b: parseInt(result[3], 16)
+ } : null;
+ };
+
+ /**
+ * This function takes color in hex format or rgb() or rgba() format and overrides the opacity. Returns rgba() string.
+ * @param color
+ * @param opacity
+ * @returns {*}
+ */
+ exports.overrideOpacity = function (color, opacity) {
+ if (color.indexOf("rgba") != -1) {
+ return color;
+ } else if (color.indexOf("rgb") != -1) {
+ var rgb = color.substr(color.indexOf("(") + 1).replace(")", "").split(",");
+ return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")";
+ } else {
+ var rgb = exports.hexToRGB(color);
+ if (rgb == null) {
+ return color;
+ } else {
+ return "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + opacity + ")";
+ }
+ }
+ };
+
+ /**
+ *
+ * @param red 0 -- 255
+ * @param green 0 -- 255
+ * @param blue 0 -- 255
+ * @returns {string}
+ * @constructor
+ */
+ exports.RGBToHex = function (red, green, blue) {
+ return "#" + ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1);
+ };
+
+ /**
+ * Parse a color property into an object with border, background, and
+ * highlight colors
+ * @param {Object | String} color
+ * @return {Object} colorObject
+ */
+ exports.parseColor = function (color) {
+ var c;
+ if (exports.isString(color) === true) {
+ if (exports.isValidRGB(color) === true) {
+ var rgb = color.substr(4).substr(0, color.length - 5).split(',').map(function (value) {
+ return parseInt(value);
+ });
+ color = exports.RGBToHex(rgb[0], rgb[1], rgb[2]);
+ }
+ if (exports.isValidHex(color) === true) {
+ var hsv = exports.hexToHSV(color);
+ var lighterColorHSV = { h: hsv.h, s: hsv.s * 0.8, v: Math.min(1, hsv.v * 1.02) };
+ var darkerColorHSV = { h: hsv.h, s: Math.min(1, hsv.s * 1.25), v: hsv.v * 0.8 };
+ var darkerColorHex = exports.HSVToHex(darkerColorHSV.h, darkerColorHSV.s, darkerColorHSV.v);
+ var lighterColorHex = exports.HSVToHex(lighterColorHSV.h, lighterColorHSV.s, lighterColorHSV.v);
+ c = {
+ background: color,
+ border: darkerColorHex,
+ highlight: {
+ background: lighterColorHex,
+ border: darkerColorHex
+ },
+ hover: {
+ background: lighterColorHex,
+ border: darkerColorHex
+ }
+ };
+ } else {
+ c = {
+ background: color,
+ border: color,
+ highlight: {
+ background: color,
+ border: color
+ },
+ hover: {
+ background: color,
+ border: color
+ }
+ };
+ }
+ } else {
+ c = {};
+ c.background = color.background || undefined;
+ c.border = color.border || undefined;
+
+ if (exports.isString(color.highlight)) {
+ c.highlight = {
+ border: color.highlight,
+ background: color.highlight
+ };
+ } else {
+ c.highlight = {};
+ c.highlight.background = color.highlight && color.highlight.background || undefined;
+ c.highlight.border = color.highlight && color.highlight.border || undefined;
+ }
+
+ if (exports.isString(color.hover)) {
+ c.hover = {
+ border: color.hover,
+ background: color.hover
+ };
+ } else {
+ c.hover = {};
+ c.hover.background = color.hover && color.hover.background || undefined;
+ c.hover.border = color.hover && color.hover.border || undefined;
+ }
+ }
+
+ return c;
+ };
+
+ /**
+ * http://www.javascripter.net/faq/rgb2hsv.htm
+ *
+ * @param red
+ * @param green
+ * @param blue
+ * @returns {*}
+ * @constructor
+ */
+ exports.RGBToHSV = function (red, green, blue) {
+ red = red / 255;green = green / 255;blue = blue / 255;
+ var minRGB = Math.min(red, Math.min(green, blue));
+ var maxRGB = Math.max(red, Math.max(green, blue));
+
+ // Black-gray-white
+ if (minRGB == maxRGB) {
+ return { h: 0, s: 0, v: minRGB };
+ }
+
+ // Colors other than black-gray-white:
+ var d = red == minRGB ? green - blue : blue == minRGB ? red - green : blue - red;
+ var h = red == minRGB ? 3 : blue == minRGB ? 1 : 5;
+ var hue = 60 * (h - d / (maxRGB - minRGB)) / 360;
+ var saturation = (maxRGB - minRGB) / maxRGB;
+ var value = maxRGB;
+ return { h: hue, s: saturation, v: value };
+ };
+
+ var cssUtil = {
+ // split a string with css styles into an object with key/values
+ split: function split(cssText) {
+ var styles = {};
+
+ cssText.split(';').forEach(function (style) {
+ if (style.trim() != '') {
+ var parts = style.split(':');
+ var key = parts[0].trim();
+ var value = parts[1].trim();
+ styles[key] = value;
+ }
+ });
+
+ return styles;
+ },
+
+ // build a css text string from an object with key/values
+ join: function join(styles) {
+ return (0, _keys2['default'])(styles).map(function (key) {
+ return key + ': ' + styles[key];
+ }).join('; ');
+ }
+ };
+
+ /**
+ * Append a string with css styles to an element
+ * @param {Element} element
+ * @param {String} cssText
+ */
+ exports.addCssText = function (element, cssText) {
+ var currentStyles = cssUtil.split(element.style.cssText);
+ var newStyles = cssUtil.split(cssText);
+ var styles = exports.extend(currentStyles, newStyles);
+
+ element.style.cssText = cssUtil.join(styles);
+ };
+
+ /**
+ * Remove a string with css styles from an element
+ * @param {Element} element
+ * @param {String} cssText
+ */
+ exports.removeCssText = function (element, cssText) {
+ var styles = cssUtil.split(element.style.cssText);
+ var removeStyles = cssUtil.split(cssText);
+
+ for (var key in removeStyles) {
+ if (removeStyles.hasOwnProperty(key)) {
+ delete styles[key];
+ }
+ }
+
+ element.style.cssText = cssUtil.join(styles);
+ };
+
+ /**
+ * https://gist.github.com/mjijackson/5311256
+ * @param h
+ * @param s
+ * @param v
+ * @returns {{r: number, g: number, b: number}}
+ * @constructor
+ */
+ exports.HSVToRGB = function (h, s, v) {
+ var r, g, b;
+
+ var i = Math.floor(h * 6);
+ var f = h * 6 - i;
+ var p = v * (1 - s);
+ var q = v * (1 - f * s);
+ var t = v * (1 - (1 - f) * s);
+
+ switch (i % 6) {
+ case 0:
+ r = v, g = t, b = p;break;
+ case 1:
+ r = q, g = v, b = p;break;
+ case 2:
+ r = p, g = v, b = t;break;
+ case 3:
+ r = p, g = q, b = v;break;
+ case 4:
+ r = t, g = p, b = v;break;
+ case 5:
+ r = v, g = p, b = q;break;
+ }
+
+ return { r: Math.floor(r * 255), g: Math.floor(g * 255), b: Math.floor(b * 255) };
+ };
+
+ exports.HSVToHex = function (h, s, v) {
+ var rgb = exports.HSVToRGB(h, s, v);
+ return exports.RGBToHex(rgb.r, rgb.g, rgb.b);
+ };
+
+ exports.hexToHSV = function (hex) {
+ var rgb = exports.hexToRGB(hex);
+ return exports.RGBToHSV(rgb.r, rgb.g, rgb.b);
+ };
+
+ exports.isValidHex = function (hex) {
+ var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex);
+ return isOk;
+ };
+
+ exports.isValidRGB = function (rgb) {
+ rgb = rgb.replace(" ", "");
+ var isOk = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(rgb);
+ return isOk;
+ };
+ exports.isValidRGBA = function (rgba) {
+ rgba = rgba.replace(" ", "");
+ var isOk = /rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(rgba);
+ return isOk;
+ };
+
+ /**
+ * This recursively redirects the prototype of JSON objects to the referenceObject
+ * This is used for default options.
+ *
+ * @param referenceObject
+ * @returns {*}
+ */
+ exports.selectiveBridgeObject = function (fields, referenceObject) {
+ if ((typeof referenceObject === 'undefined' ? 'undefined' : (0, _typeof3['default'])(referenceObject)) == "object") {
+ var objectTo = (0, _create2['default'])(referenceObject);
+ for (var i = 0; i < fields.length; i++) {
+ if (referenceObject.hasOwnProperty(fields[i])) {
+ if ((0, _typeof3['default'])(referenceObject[fields[i]]) == "object") {
+ objectTo[fields[i]] = exports.bridgeObject(referenceObject[fields[i]]);
+ }
+ }
+ }
+ return objectTo;
+ } else {
+ return null;
+ }
+ };
+
+ /**
+ * This recursively redirects the prototype of JSON objects to the referenceObject
+ * This is used for default options.
+ *
+ * @param referenceObject
+ * @returns {*}
+ */
+ exports.bridgeObject = function (referenceObject) {
+ if ((typeof referenceObject === 'undefined' ? 'undefined' : (0, _typeof3['default'])(referenceObject)) == "object") {
+ var objectTo = (0, _create2['default'])(referenceObject);
+ for (var i in referenceObject) {
+ if (referenceObject.hasOwnProperty(i)) {
+ if ((0, _typeof3['default'])(referenceObject[i]) == "object") {
+ objectTo[i] = exports.bridgeObject(referenceObject[i]);
+ }
+ }
+ }
+ return objectTo;
+ } else {
+ return null;
+ }
+ };
+
+ /**
+ * This method provides a stable sort implementation, very fast for presorted data
+ *
+ * @param a the array
+ * @param a order comparator
+ * @returns {the array}
+ */
+ exports.insertSort = function (a, compare) {
+ for (var i = 0; i < a.length; i++) {
+ var k = a[i];
+ for (var j = i; j > 0 && compare(k, a[j - 1]) < 0; j--) {
+ a[j] = a[j - 1];
+ }
+ a[j] = k;
+ }
+ return a;
+ };
+
+ /**
+ * this is used to set the options of subobjects in the options object. A requirement of these subobjects
+ * is that they have an 'enabled' element which is optional for the user but mandatory for the program.
+ *
+ * @param [object] mergeTarget | this is either this.options or the options used for the groups.
+ * @param [object] options | options
+ * @param [String] option | this is the option key in the options argument
+ */
+ exports.mergeOptions = function (mergeTarget, options, option) {
+ var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+ var globalOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
+
+ if (options[option] === null) {
+ mergeTarget[option] = (0, _create2['default'])(globalOptions[option]);
+ } else {
+ if (options[option] !== undefined) {
+ if (typeof options[option] === 'boolean') {
+ mergeTarget[option].enabled = options[option];
+ } else {
+ if (options[option].enabled === undefined) {
+ mergeTarget[option].enabled = true;
+ }
+ for (var prop in options[option]) {
+ if (options[option].hasOwnProperty(prop)) {
+ mergeTarget[option][prop] = options[option][prop];
+ }
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ * This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses
+ * this function will then iterate in both directions over this sorted list to find all visible items.
+ *
+ * @param {Item[]} orderedItems | Items ordered by start
+ * @param {function} comparator | -1 is lower, 0 is equal, 1 is higher
+ * @param {String} field
+ * @param {String} field2
+ * @returns {number}
+ * @private
+ */
+ exports.binarySearchCustom = function (orderedItems, comparator, field, field2) {
+ var maxIterations = 10000;
+ var iteration = 0;
+ var low = 0;
+ var high = orderedItems.length - 1;
+
+ while (low <= high && iteration < maxIterations) {
+ var middle = Math.floor((low + high) / 2);
+
+ var item = orderedItems[middle];
+ var value = field2 === undefined ? item[field] : item[field][field2];
+
+ var searchResult = comparator(value);
+ if (searchResult == 0) {
+ // jihaa, found a visible item!
+ return middle;
+ } else if (searchResult == -1) {
+ // it is too small --> increase low
+ low = middle + 1;
+ } else {
+ // it is too big --> decrease high
+ high = middle - 1;
+ }
+
+ iteration++;
+ }
+
+ return -1;
+ };
+
+ /**
+ * This function does a binary search for a specific value in a sorted array. If it does not exist but is in between of
+ * two values, we return either the one before or the one after, depending on user input
+ * If it is found, we return the index, else -1.
+ *
+ * @param {Array} orderedItems
+ * @param {{start: number, end: number}} target
+ * @param {String} field
+ * @param {String} sidePreference 'before' or 'after'
+ * @param {function} comparator an optional comparator, returning -1,0,1 for <,==,>.
+ * @returns {number}
+ * @private
+ */
+ exports.binarySearchValue = function (orderedItems, target, field, sidePreference, comparator) {
+ var maxIterations = 10000;
+ var iteration = 0;
+ var low = 0;
+ var high = orderedItems.length - 1;
+ var prevValue, value, nextValue, middle;
+
+ var comparator = comparator != undefined ? comparator : function (a, b) {
+ return a == b ? 0 : a < b ? -1 : 1;
+ };
+
+ while (low <= high && iteration < maxIterations) {
+ // get a new guess
+ middle = Math.floor(0.5 * (high + low));
+ prevValue = orderedItems[Math.max(0, middle - 1)][field];
+ value = orderedItems[middle][field];
+ nextValue = orderedItems[Math.min(orderedItems.length - 1, middle + 1)][field];
+
+ if (comparator(value, target) == 0) {
+ // we found the target
+ return middle;
+ } else if (comparator(prevValue, target) < 0 && comparator(value, target) > 0) {
+ // target is in between of the previous and the current
+ return sidePreference == 'before' ? Math.max(0, middle - 1) : middle;
+ } else if (comparator(value, target) < 0 && comparator(nextValue, target) > 0) {
+ // target is in between of the current and the next
+ return sidePreference == 'before' ? middle : Math.min(orderedItems.length - 1, middle + 1);
+ } else {
+ // didnt find the target, we need to change our boundaries.
+ if (comparator(value, target) < 0) {
+ // it is too small --> increase low
+ low = middle + 1;
+ } else {
+ // it is too big --> decrease high
+ high = middle - 1;
+ }
+ }
+ iteration++;
+ }
+
+ // didnt find anything. Return -1.
+ return -1;
+ };
+
+ /*
+ * Easing Functions - inspired from http://gizma.com/easing/
+ * only considering the t value for the range [0, 1] => [0, 1]
+ * https://gist.github.com/gre/1650294
+ */
+ exports.easingFunctions = {
+ // no easing, no acceleration
+ linear: function linear(t) {
+ return t;
+ },
+ // accelerating from zero velocity
+ easeInQuad: function easeInQuad(t) {
+ return t * t;
+ },
+ // decelerating to zero velocity
+ easeOutQuad: function easeOutQuad(t) {
+ return t * (2 - t);
+ },
+ // acceleration until halfway, then deceleration
+ easeInOutQuad: function easeInOutQuad(t) {
+ return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
+ },
+ // accelerating from zero velocity
+ easeInCubic: function easeInCubic(t) {
+ return t * t * t;
+ },
+ // decelerating to zero velocity
+ easeOutCubic: function easeOutCubic(t) {
+ return --t * t * t + 1;
+ },
+ // acceleration until halfway, then deceleration
+ easeInOutCubic: function easeInOutCubic(t) {
+ return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
+ },
+ // accelerating from zero velocity
+ easeInQuart: function easeInQuart(t) {
+ return t * t * t * t;
+ },
+ // decelerating to zero velocity
+ easeOutQuart: function easeOutQuart(t) {
+ return 1 - --t * t * t * t;
+ },
+ // acceleration until halfway, then deceleration
+ easeInOutQuart: function easeInOutQuart(t) {
+ return t < .5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
+ },
+ // accelerating from zero velocity
+ easeInQuint: function easeInQuint(t) {
+ return t * t * t * t * t;
+ },
+ // decelerating to zero velocity
+ easeOutQuint: function easeOutQuint(t) {
+ return 1 + --t * t * t * t * t;
+ },
+ // acceleration until halfway, then deceleration
+ easeInOutQuint: function easeInOutQuint(t) {
+ return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
+ }
+ };
+
+ exports.getScrollBarWidth = function () {
+ var inner = document.createElement('p');
+ inner.style.width = "100%";
+ inner.style.height = "200px";
+
+ var outer = document.createElement('div');
+ outer.style.position = "absolute";
+ outer.style.top = "0px";
+ outer.style.left = "0px";
+ outer.style.visibility = "hidden";
+ outer.style.width = "200px";
+ outer.style.height = "150px";
+ outer.style.overflow = "hidden";
+ outer.appendChild(inner);
+
+ document.body.appendChild(outer);
+ var w1 = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ var w2 = inner.offsetWidth;
+ if (w1 == w2) w2 = outer.clientWidth;
+
+ document.body.removeChild(outer);
+
+ return w1 - w2;
+ };
+
+ exports.topMost = function (pile, accessors) {
+ var candidate = void 0;
+ if (!Array.isArray(accessors)) {
+ accessors = [accessors];
+ }
+ var _iteratorNormalCompletion = true;
+ var _didIteratorError = false;
+ var _iteratorError = undefined;
+
+ try {
+ for (var _iterator = (0, _getIterator3['default'])(pile), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
+ var member = _step.value;
+
+ if (member) {
+ candidate = member[accessors[0]];
+ for (var i = 1; i < accessors.length; i++) {
+ if (candidate) {
+ candidate = candidate[accessors[i]];
+ } else {
+ continue;
+ }
+ }
+ if (typeof candidate != 'undefined') {
+ break;
+ }
+ }
+ }
+ } catch (err) {
+ _didIteratorError = true;
+ _iteratorError = err;
+ } finally {
+ try {
+ if (!_iteratorNormalCompletion && _iterator['return']) {
+ _iterator['return']();
+ }
+ } finally {
+ if (_didIteratorError) {
+ throw _iteratorError;
+ }
+ }
+ }
+
+ return candidate;
+ };
+
+/***/ },
+/* 2 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(3), __esModule: true };
+
+/***/ },
+/* 3 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(4);
+ __webpack_require__(50);
+ module.exports = __webpack_require__(52);
+
+/***/ },
+/* 4 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(5);
+ var global = __webpack_require__(16)
+ , hide = __webpack_require__(20)
+ , Iterators = __webpack_require__(8)
+ , TO_STRING_TAG = __webpack_require__(47)('toStringTag');
+
+ for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
+ var NAME = collections[i]
+ , Collection = global[NAME]
+ , proto = Collection && Collection.prototype;
+ if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
+ Iterators[NAME] = Iterators.Array;
+ }
+
+/***/ },
+/* 5 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+ var addToUnscopables = __webpack_require__(6)
+ , step = __webpack_require__(7)
+ , Iterators = __webpack_require__(8)
+ , toIObject = __webpack_require__(9);
+
+ // 22.1.3.4 Array.prototype.entries()
+ // 22.1.3.13 Array.prototype.keys()
+ // 22.1.3.29 Array.prototype.values()
+ // 22.1.3.30 Array.prototype[@@iterator]()
+ module.exports = __webpack_require__(13)(Array, 'Array', function(iterated, kind){
+ this._t = toIObject(iterated); // target
+ this._i = 0; // next index
+ this._k = kind; // kind
+ // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
+ }, function(){
+ var O = this._t
+ , kind = this._k
+ , index = this._i++;
+ if(!O || index >= O.length){
+ this._t = undefined;
+ return step(1);
+ }
+ if(kind == 'keys' )return step(0, index);
+ if(kind == 'values')return step(0, O[index]);
+ return step(0, [index, O[index]]);
+ }, 'values');
+
+ // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
+ Iterators.Arguments = Iterators.Array;
+
+ addToUnscopables('keys');
+ addToUnscopables('values');
+ addToUnscopables('entries');
+
+/***/ },
+/* 6 */
+/***/ function(module, exports) {
+
+ module.exports = function(){ /* empty */ };
+
+/***/ },
+/* 7 */
+/***/ function(module, exports) {
+
+ module.exports = function(done, value){
+ return {value: value, done: !!done};
+ };
+
+/***/ },
+/* 8 */
+/***/ function(module, exports) {
+
+ module.exports = {};
+
+/***/ },
+/* 9 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // to indexed object, toObject with fallback for non-array-like ES3 strings
+ var IObject = __webpack_require__(10)
+ , defined = __webpack_require__(12);
+ module.exports = function(it){
+ return IObject(defined(it));
+ };
+
+/***/ },
+/* 10 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
+ var cof = __webpack_require__(11);
+ module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
+ return cof(it) == 'String' ? it.split('') : Object(it);
+ };
+
+/***/ },
+/* 11 */
+/***/ function(module, exports) {
+
+ var toString = {}.toString;
+
+ module.exports = function(it){
+ return toString.call(it).slice(8, -1);
+ };
+
+/***/ },
+/* 12 */
+/***/ function(module, exports) {
+
+ // 7.2.1 RequireObjectCoercible(argument)
+ module.exports = function(it){
+ if(it == undefined)throw TypeError("Can't call method on " + it);
+ return it;
+ };
+
+/***/ },
+/* 13 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+ var LIBRARY = __webpack_require__(14)
+ , $export = __webpack_require__(15)
+ , redefine = __webpack_require__(30)
+ , hide = __webpack_require__(20)
+ , has = __webpack_require__(31)
+ , Iterators = __webpack_require__(8)
+ , $iterCreate = __webpack_require__(32)
+ , setToStringTag = __webpack_require__(46)
+ , getPrototypeOf = __webpack_require__(48)
+ , ITERATOR = __webpack_require__(47)('iterator')
+ , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
+ , FF_ITERATOR = '@@iterator'
+ , KEYS = 'keys'
+ , VALUES = 'values';
+
+ var returnThis = function(){ return this; };
+
+ module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
+ $iterCreate(Constructor, NAME, next);
+ var getMethod = function(kind){
+ if(!BUGGY && kind in proto)return proto[kind];
+ switch(kind){
+ case KEYS: return function keys(){ return new Constructor(this, kind); };
+ case VALUES: return function values(){ return new Constructor(this, kind); };
+ } return function entries(){ return new Constructor(this, kind); };
+ };
+ var TAG = NAME + ' Iterator'
+ , DEF_VALUES = DEFAULT == VALUES
+ , VALUES_BUG = false
+ , proto = Base.prototype
+ , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
+ , $default = $native || getMethod(DEFAULT)
+ , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
+ , $anyNative = NAME == 'Array' ? proto.entries || $native : $native
+ , methods, key, IteratorPrototype;
+ // Fix native
+ if($anyNative){
+ IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
+ if(IteratorPrototype !== Object.prototype){
+ // Set @@toStringTag to native iterators
+ setToStringTag(IteratorPrototype, TAG, true);
+ // fix for some old engines
+ if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
+ }
+ }
+ // fix Array#{values, @@iterator}.name in V8 / FF
+ if(DEF_VALUES && $native && $native.name !== VALUES){
+ VALUES_BUG = true;
+ $default = function values(){ return $native.call(this); };
+ }
+ // Define iterator
+ if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
+ hide(proto, ITERATOR, $default);
+ }
+ // Plug for library
+ Iterators[NAME] = $default;
+ Iterators[TAG] = returnThis;
+ if(DEFAULT){
+ methods = {
+ values: DEF_VALUES ? $default : getMethod(VALUES),
+ keys: IS_SET ? $default : getMethod(KEYS),
+ entries: $entries
+ };
+ if(FORCED)for(key in methods){
+ if(!(key in proto))redefine(proto, key, methods[key]);
+ } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
+ }
+ return methods;
+ };
+
+/***/ },
+/* 14 */
+/***/ function(module, exports) {
+
+ module.exports = true;
+
+/***/ },
+/* 15 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var global = __webpack_require__(16)
+ , core = __webpack_require__(17)
+ , ctx = __webpack_require__(18)
+ , hide = __webpack_require__(20)
+ , PROTOTYPE = 'prototype';
+
+ var $export = function(type, name, source){
+ var IS_FORCED = type & $export.F
+ , IS_GLOBAL = type & $export.G
+ , IS_STATIC = type & $export.S
+ , IS_PROTO = type & $export.P
+ , IS_BIND = type & $export.B
+ , IS_WRAP = type & $export.W
+ , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
+ , expProto = exports[PROTOTYPE]
+ , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
+ , key, own, out;
+ if(IS_GLOBAL)source = name;
+ for(key in source){
+ // contains in native
+ own = !IS_FORCED && target && target[key] !== undefined;
+ if(own && key in exports)continue;
+ // export native or passed
+ out = own ? target[key] : source[key];
+ // prevent global pollution for namespaces
+ exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
+ // bind timers to global for call from export context
+ : IS_BIND && own ? ctx(out, global)
+ // wrap global constructors for prevent change them in library
+ : IS_WRAP && target[key] == out ? (function(C){
+ var F = function(a, b, c){
+ if(this instanceof C){
+ switch(arguments.length){
+ case 0: return new C;
+ case 1: return new C(a);
+ case 2: return new C(a, b);
+ } return new C(a, b, c);
+ } return C.apply(this, arguments);
+ };
+ F[PROTOTYPE] = C[PROTOTYPE];
+ return F;
+ // make static versions for prototype methods
+ })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
+ // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
+ if(IS_PROTO){
+ (exports.virtual || (exports.virtual = {}))[key] = out;
+ // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
+ if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
+ }
+ }
+ };
+ // type bitmap
+ $export.F = 1; // forced
+ $export.G = 2; // global
+ $export.S = 4; // static
+ $export.P = 8; // proto
+ $export.B = 16; // bind
+ $export.W = 32; // wrap
+ $export.U = 64; // safe
+ $export.R = 128; // real proto method for `library`
+ module.exports = $export;
+
+/***/ },
+/* 16 */
+/***/ function(module, exports) {
+
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
+ var global = module.exports = typeof window != 'undefined' && window.Math == Math
+ ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
+ if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
+
+/***/ },
+/* 17 */
+/***/ function(module, exports) {
+
+ var core = module.exports = {version: '2.4.0'};
+ if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
+
+/***/ },
+/* 18 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // optional / simple context binding
+ var aFunction = __webpack_require__(19);
+ module.exports = function(fn, that, length){
+ aFunction(fn);
+ if(that === undefined)return fn;
+ switch(length){
+ case 1: return function(a){
+ return fn.call(that, a);
+ };
+ case 2: return function(a, b){
+ return fn.call(that, a, b);
+ };
+ case 3: return function(a, b, c){
+ return fn.call(that, a, b, c);
+ };
+ }
+ return function(/* ...args */){
+ return fn.apply(that, arguments);
+ };
+ };
+
+/***/ },
+/* 19 */
+/***/ function(module, exports) {
+
+ module.exports = function(it){
+ if(typeof it != 'function')throw TypeError(it + ' is not a function!');
+ return it;
+ };
+
+/***/ },
+/* 20 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var dP = __webpack_require__(21)
+ , createDesc = __webpack_require__(29);
+ module.exports = __webpack_require__(25) ? function(object, key, value){
+ return dP.f(object, key, createDesc(1, value));
+ } : function(object, key, value){
+ object[key] = value;
+ return object;
+ };
+
+/***/ },
+/* 21 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var anObject = __webpack_require__(22)
+ , IE8_DOM_DEFINE = __webpack_require__(24)
+ , toPrimitive = __webpack_require__(28)
+ , dP = Object.defineProperty;
+
+ exports.f = __webpack_require__(25) ? Object.defineProperty : function defineProperty(O, P, Attributes){
+ anObject(O);
+ P = toPrimitive(P, true);
+ anObject(Attributes);
+ if(IE8_DOM_DEFINE)try {
+ return dP(O, P, Attributes);
+ } catch(e){ /* empty */ }
+ if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
+ if('value' in Attributes)O[P] = Attributes.value;
+ return O;
+ };
+
+/***/ },
+/* 22 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isObject = __webpack_require__(23);
+ module.exports = function(it){
+ if(!isObject(it))throw TypeError(it + ' is not an object!');
+ return it;
+ };
+
+/***/ },
+/* 23 */
+/***/ function(module, exports) {
+
+ module.exports = function(it){
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
+ };
+
+/***/ },
+/* 24 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = !__webpack_require__(25) && !__webpack_require__(26)(function(){
+ return Object.defineProperty(__webpack_require__(27)('div'), 'a', {get: function(){ return 7; }}).a != 7;
+ });
+
+/***/ },
+/* 25 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // Thank's IE8 for his funny defineProperty
+ module.exports = !__webpack_require__(26)(function(){
+ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
+ });
+
+/***/ },
+/* 26 */
+/***/ function(module, exports) {
+
+ module.exports = function(exec){
+ try {
+ return !!exec();
+ } catch(e){
+ return true;
+ }
+ };
+
+/***/ },
+/* 27 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isObject = __webpack_require__(23)
+ , document = __webpack_require__(16).document
+ // in old IE typeof document.createElement is 'object'
+ , is = isObject(document) && isObject(document.createElement);
+ module.exports = function(it){
+ return is ? document.createElement(it) : {};
+ };
+
+/***/ },
+/* 28 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 7.1.1 ToPrimitive(input [, PreferredType])
+ var isObject = __webpack_require__(23);
+ // instead of the ES6 spec version, we didn't implement @@toPrimitive case
+ // and the second argument - flag - preferred type is a string
+ module.exports = function(it, S){
+ if(!isObject(it))return it;
+ var fn, val;
+ if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
+ if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
+ if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
+ throw TypeError("Can't convert object to primitive value");
+ };
+
+/***/ },
+/* 29 */
+/***/ function(module, exports) {
+
+ module.exports = function(bitmap, value){
+ return {
+ enumerable : !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable : !(bitmap & 4),
+ value : value
+ };
+ };
+
+/***/ },
+/* 30 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = __webpack_require__(20);
+
+/***/ },
+/* 31 */
+/***/ function(module, exports) {
+
+ var hasOwnProperty = {}.hasOwnProperty;
+ module.exports = function(it, key){
+ return hasOwnProperty.call(it, key);
+ };
+
+/***/ },
+/* 32 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+ var create = __webpack_require__(33)
+ , descriptor = __webpack_require__(29)
+ , setToStringTag = __webpack_require__(46)
+ , IteratorPrototype = {};
+
+ // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
+ __webpack_require__(20)(IteratorPrototype, __webpack_require__(47)('iterator'), function(){ return this; });
+
+ module.exports = function(Constructor, NAME, next){
+ Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
+ setToStringTag(Constructor, NAME + ' Iterator');
+ };
+
+/***/ },
+/* 33 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
+ var anObject = __webpack_require__(22)
+ , dPs = __webpack_require__(34)
+ , enumBugKeys = __webpack_require__(44)
+ , IE_PROTO = __webpack_require__(41)('IE_PROTO')
+ , Empty = function(){ /* empty */ }
+ , PROTOTYPE = 'prototype';
+
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
+ var createDict = function(){
+ // Thrash, waste and sodomy: IE GC bug
+ var iframe = __webpack_require__(27)('iframe')
+ , i = enumBugKeys.length
+ , lt = '<'
+ , gt = '>'
+ , iframeDocument;
+ iframe.style.display = 'none';
+ __webpack_require__(45).appendChild(iframe);
+ iframe.src = 'javascript:'; // eslint-disable-line no-script-url
+ // createDict = iframe.contentWindow.Object;
+ // html.removeChild(iframe);
+ iframeDocument = iframe.contentWindow.document;
+ iframeDocument.open();
+ iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
+ iframeDocument.close();
+ createDict = iframeDocument.F;
+ while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
+ return createDict();
+ };
+
+ module.exports = Object.create || function create(O, Properties){
+ var result;
+ if(O !== null){
+ Empty[PROTOTYPE] = anObject(O);
+ result = new Empty;
+ Empty[PROTOTYPE] = null;
+ // add "__proto__" for Object.getPrototypeOf polyfill
+ result[IE_PROTO] = O;
+ } else result = createDict();
+ return Properties === undefined ? result : dPs(result, Properties);
+ };
+
+
+/***/ },
+/* 34 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var dP = __webpack_require__(21)
+ , anObject = __webpack_require__(22)
+ , getKeys = __webpack_require__(35);
+
+ module.exports = __webpack_require__(25) ? Object.defineProperties : function defineProperties(O, Properties){
+ anObject(O);
+ var keys = getKeys(Properties)
+ , length = keys.length
+ , i = 0
+ , P;
+ while(length > i)dP.f(O, P = keys[i++], Properties[P]);
+ return O;
+ };
+
+/***/ },
+/* 35 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 19.1.2.14 / 15.2.3.14 Object.keys(O)
+ var $keys = __webpack_require__(36)
+ , enumBugKeys = __webpack_require__(44);
+
+ module.exports = Object.keys || function keys(O){
+ return $keys(O, enumBugKeys);
+ };
+
+/***/ },
+/* 36 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var has = __webpack_require__(31)
+ , toIObject = __webpack_require__(9)
+ , arrayIndexOf = __webpack_require__(37)(false)
+ , IE_PROTO = __webpack_require__(41)('IE_PROTO');
+
+ module.exports = function(object, names){
+ var O = toIObject(object)
+ , i = 0
+ , result = []
+ , key;
+ for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
+ // Don't enum bug & hidden keys
+ while(names.length > i)if(has(O, key = names[i++])){
+ ~arrayIndexOf(result, key) || result.push(key);
+ }
+ return result;
+ };
+
+/***/ },
+/* 37 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // false -> Array#indexOf
+ // true -> Array#includes
+ var toIObject = __webpack_require__(9)
+ , toLength = __webpack_require__(38)
+ , toIndex = __webpack_require__(40);
+ module.exports = function(IS_INCLUDES){
+ return function($this, el, fromIndex){
+ var O = toIObject($this)
+ , length = toLength(O.length)
+ , index = toIndex(fromIndex, length)
+ , value;
+ // Array#includes uses SameValueZero equality algorithm
+ if(IS_INCLUDES && el != el)while(length > index){
+ value = O[index++];
+ if(value != value)return true;
+ // Array#toIndex ignores holes, Array#includes - not
+ } else for(;length > index; index++)if(IS_INCLUDES || index in O){
+ if(O[index] === el)return IS_INCLUDES || index || 0;
+ } return !IS_INCLUDES && -1;
+ };
+ };
+
+/***/ },
+/* 38 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 7.1.15 ToLength
+ var toInteger = __webpack_require__(39)
+ , min = Math.min;
+ module.exports = function(it){
+ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
+ };
+
+/***/ },
+/* 39 */
+/***/ function(module, exports) {
+
+ // 7.1.4 ToInteger
+ var ceil = Math.ceil
+ , floor = Math.floor;
+ module.exports = function(it){
+ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
+ };
+
+/***/ },
+/* 40 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var toInteger = __webpack_require__(39)
+ , max = Math.max
+ , min = Math.min;
+ module.exports = function(index, length){
+ index = toInteger(index);
+ return index < 0 ? max(index + length, 0) : min(index, length);
+ };
+
+/***/ },
+/* 41 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var shared = __webpack_require__(42)('keys')
+ , uid = __webpack_require__(43);
+ module.exports = function(key){
+ return shared[key] || (shared[key] = uid(key));
+ };
+
+/***/ },
+/* 42 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var global = __webpack_require__(16)
+ , SHARED = '__core-js_shared__'
+ , store = global[SHARED] || (global[SHARED] = {});
+ module.exports = function(key){
+ return store[key] || (store[key] = {});
+ };
+
+/***/ },
+/* 43 */
+/***/ function(module, exports) {
+
+ var id = 0
+ , px = Math.random();
+ module.exports = function(key){
+ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
+ };
+
+/***/ },
+/* 44 */
+/***/ function(module, exports) {
+
+ // IE 8- don't enum bug keys
+ module.exports = (
+ 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
+ ).split(',');
+
+/***/ },
+/* 45 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = __webpack_require__(16).document && document.documentElement;
+
+/***/ },
+/* 46 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var def = __webpack_require__(21).f
+ , has = __webpack_require__(31)
+ , TAG = __webpack_require__(47)('toStringTag');
+
+ module.exports = function(it, tag, stat){
+ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
+ };
+
+/***/ },
+/* 47 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var store = __webpack_require__(42)('wks')
+ , uid = __webpack_require__(43)
+ , Symbol = __webpack_require__(16).Symbol
+ , USE_SYMBOL = typeof Symbol == 'function';
+
+ var $exports = module.exports = function(name){
+ return store[name] || (store[name] =
+ USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
+ };
+
+ $exports.store = store;
+
+/***/ },
+/* 48 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
+ var has = __webpack_require__(31)
+ , toObject = __webpack_require__(49)
+ , IE_PROTO = __webpack_require__(41)('IE_PROTO')
+ , ObjectProto = Object.prototype;
+
+ module.exports = Object.getPrototypeOf || function(O){
+ O = toObject(O);
+ if(has(O, IE_PROTO))return O[IE_PROTO];
+ if(typeof O.constructor == 'function' && O instanceof O.constructor){
+ return O.constructor.prototype;
+ } return O instanceof Object ? ObjectProto : null;
+ };
+
+/***/ },
+/* 49 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 7.1.13 ToObject(argument)
+ var defined = __webpack_require__(12);
+ module.exports = function(it){
+ return Object(defined(it));
+ };
+
+/***/ },
+/* 50 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+ var $at = __webpack_require__(51)(true);
+
+ // 21.1.3.27 String.prototype[@@iterator]()
+ __webpack_require__(13)(String, 'String', function(iterated){
+ this._t = String(iterated); // target
+ this._i = 0; // next index
+ // 21.1.5.2.1 %StringIteratorPrototype%.next()
+ }, function(){
+ var O = this._t
+ , index = this._i
+ , point;
+ if(index >= O.length)return {value: undefined, done: true};
+ point = $at(O, index);
+ this._i += point.length;
+ return {value: point, done: false};
+ });
+
+/***/ },
+/* 51 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var toInteger = __webpack_require__(39)
+ , defined = __webpack_require__(12);
+ // true -> String#at
+ // false -> String#codePointAt
+ module.exports = function(TO_STRING){
+ return function(that, pos){
+ var s = String(defined(that))
+ , i = toInteger(pos)
+ , l = s.length
+ , a, b;
+ if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
+ a = s.charCodeAt(i);
+ return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
+ ? TO_STRING ? s.charAt(i) : a
+ : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
+ };
+ };
+
+/***/ },
+/* 52 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var anObject = __webpack_require__(22)
+ , get = __webpack_require__(53);
+ module.exports = __webpack_require__(17).getIterator = function(it){
+ var iterFn = get(it);
+ if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');
+ return anObject(iterFn.call(it));
+ };
+
+/***/ },
+/* 53 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var classof = __webpack_require__(54)
+ , ITERATOR = __webpack_require__(47)('iterator')
+ , Iterators = __webpack_require__(8);
+ module.exports = __webpack_require__(17).getIteratorMethod = function(it){
+ if(it != undefined)return it[ITERATOR]
+ || it['@@iterator']
+ || Iterators[classof(it)];
+ };
+
+/***/ },
+/* 54 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // getting tag from 19.1.3.6 Object.prototype.toString()
+ var cof = __webpack_require__(11)
+ , TAG = __webpack_require__(47)('toStringTag')
+ // ES3 wrong here
+ , ARG = cof(function(){ return arguments; }()) == 'Arguments';
+
+ // fallback for IE11 Script Access Denied error
+ var tryGet = function(it, key){
+ try {
+ return it[key];
+ } catch(e){ /* empty */ }
+ };
+
+ module.exports = function(it){
+ var O, T, B;
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
+ // @@toStringTag case
+ : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
+ // builtinTag case
+ : ARG ? cof(O)
+ // ES3 arguments fallback
+ : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
+ };
+
+/***/ },
+/* 55 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(56), __esModule: true };
+
+/***/ },
+/* 56 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(57);
+ var $Object = __webpack_require__(17).Object;
+ module.exports = function create(P, D){
+ return $Object.create(P, D);
+ };
+
+/***/ },
+/* 57 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var $export = __webpack_require__(15)
+ // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
+ $export($export.S, 'Object', {create: __webpack_require__(33)});
+
+/***/ },
+/* 58 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(59), __esModule: true };
+
+/***/ },
+/* 59 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(60);
+ module.exports = __webpack_require__(17).Object.keys;
+
+/***/ },
+/* 60 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 19.1.2.14 Object.keys(O)
+ var toObject = __webpack_require__(49)
+ , $keys = __webpack_require__(35);
+
+ __webpack_require__(61)('keys', function(){
+ return function keys(it){
+ return $keys(toObject(it));
+ };
+ });
+
+/***/ },
+/* 61 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // most Object methods by ES6 should accept primitives
+ var $export = __webpack_require__(15)
+ , core = __webpack_require__(17)
+ , fails = __webpack_require__(26);
+ module.exports = function(KEY, exec){
+ var fn = (core.Object || {})[KEY] || Object[KEY]
+ , exp = {};
+ exp[KEY] = exec(fn);
+ $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
+ };
+
+/***/ },
+/* 62 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ exports.__esModule = true;
+
+ var _iterator = __webpack_require__(63);
+
+ var _iterator2 = _interopRequireDefault(_iterator);
+
+ var _symbol = __webpack_require__(66);
+
+ var _symbol2 = _interopRequireDefault(_symbol);
+
+ var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
+ return typeof obj === "undefined" ? "undefined" : _typeof(obj);
+ } : function (obj) {
+ return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
+ };
+
+/***/ },
+/* 63 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(64), __esModule: true };
+
+/***/ },
+/* 64 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(50);
+ __webpack_require__(4);
+ module.exports = __webpack_require__(65).f('iterator');
+
+/***/ },
+/* 65 */
+/***/ function(module, exports, __webpack_require__) {
+
+ exports.f = __webpack_require__(47);
+
+/***/ },
+/* 66 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(67), __esModule: true };
+
+/***/ },
+/* 67 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(68);
+ __webpack_require__(79);
+ __webpack_require__(80);
+ __webpack_require__(81);
+ module.exports = __webpack_require__(17).Symbol;
+
+/***/ },
+/* 68 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+ // ECMAScript 6 symbols shim
+ var global = __webpack_require__(16)
+ , has = __webpack_require__(31)
+ , DESCRIPTORS = __webpack_require__(25)
+ , $export = __webpack_require__(15)
+ , redefine = __webpack_require__(30)
+ , META = __webpack_require__(69).KEY
+ , $fails = __webpack_require__(26)
+ , shared = __webpack_require__(42)
+ , setToStringTag = __webpack_require__(46)
+ , uid = __webpack_require__(43)
+ , wks = __webpack_require__(47)
+ , wksExt = __webpack_require__(65)
+ , wksDefine = __webpack_require__(70)
+ , keyOf = __webpack_require__(71)
+ , enumKeys = __webpack_require__(72)
+ , isArray = __webpack_require__(75)
+ , anObject = __webpack_require__(22)
+ , toIObject = __webpack_require__(9)
+ , toPrimitive = __webpack_require__(28)
+ , createDesc = __webpack_require__(29)
+ , _create = __webpack_require__(33)
+ , gOPNExt = __webpack_require__(76)
+ , $GOPD = __webpack_require__(78)
+ , $DP = __webpack_require__(21)
+ , $keys = __webpack_require__(35)
+ , gOPD = $GOPD.f
+ , dP = $DP.f
+ , gOPN = gOPNExt.f
+ , $Symbol = global.Symbol
+ , $JSON = global.JSON
+ , _stringify = $JSON && $JSON.stringify
+ , PROTOTYPE = 'prototype'
+ , HIDDEN = wks('_hidden')
+ , TO_PRIMITIVE = wks('toPrimitive')
+ , isEnum = {}.propertyIsEnumerable
+ , SymbolRegistry = shared('symbol-registry')
+ , AllSymbols = shared('symbols')
+ , OPSymbols = shared('op-symbols')
+ , ObjectProto = Object[PROTOTYPE]
+ , USE_NATIVE = typeof $Symbol == 'function'
+ , QObject = global.QObject;
+ // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
+ var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
+
+ // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
+ var setSymbolDesc = DESCRIPTORS && $fails(function(){
+ return _create(dP({}, 'a', {
+ get: function(){ return dP(this, 'a', {value: 7}).a; }
+ })).a != 7;
+ }) ? function(it, key, D){
+ var protoDesc = gOPD(ObjectProto, key);
+ if(protoDesc)delete ObjectProto[key];
+ dP(it, key, D);
+ if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
+ } : dP;
+
+ var wrap = function(tag){
+ var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
+ sym._k = tag;
+ return sym;
+ };
+
+ var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
+ return typeof it == 'symbol';
+ } : function(it){
+ return it instanceof $Symbol;
+ };
+
+ var $defineProperty = function defineProperty(it, key, D){
+ if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
+ anObject(it);
+ key = toPrimitive(key, true);
+ anObject(D);
+ if(has(AllSymbols, key)){
+ if(!D.enumerable){
+ if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
+ it[HIDDEN][key] = true;
+ } else {
+ if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
+ D = _create(D, {enumerable: createDesc(0, false)});
+ } return setSymbolDesc(it, key, D);
+ } return dP(it, key, D);
+ };
+ var $defineProperties = function defineProperties(it, P){
+ anObject(it);
+ var keys = enumKeys(P = toIObject(P))
+ , i = 0
+ , l = keys.length
+ , key;
+ while(l > i)$defineProperty(it, key = keys[i++], P[key]);
+ return it;
+ };
+ var $create = function create(it, P){
+ return P === undefined ? _create(it) : $defineProperties(_create(it), P);
+ };
+ var $propertyIsEnumerable = function propertyIsEnumerable(key){
+ var E = isEnum.call(this, key = toPrimitive(key, true));
+ if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
+ return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
+ };
+ var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
+ it = toIObject(it);
+ key = toPrimitive(key, true);
+ if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
+ var D = gOPD(it, key);
+ if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
+ return D;
+ };
+ var $getOwnPropertyNames = function getOwnPropertyNames(it){
+ var names = gOPN(toIObject(it))
+ , result = []
+ , i = 0
+ , key;
+ while(names.length > i){
+ if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
+ } return result;
+ };
+ var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
+ var IS_OP = it === ObjectProto
+ , names = gOPN(IS_OP ? OPSymbols : toIObject(it))
+ , result = []
+ , i = 0
+ , key;
+ while(names.length > i){
+ if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
+ } return result;
+ };
+
+ // 19.4.1.1 Symbol([description])
+ if(!USE_NATIVE){
+ $Symbol = function Symbol(){
+ if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
+ var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
+ var $set = function(value){
+ if(this === ObjectProto)$set.call(OPSymbols, value);
+ if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
+ setSymbolDesc(this, tag, createDesc(1, value));
+ };
+ if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
+ return wrap(tag);
+ };
+ redefine($Symbol[PROTOTYPE], 'toString', function toString(){
+ return this._k;
+ });
+
+ $GOPD.f = $getOwnPropertyDescriptor;
+ $DP.f = $defineProperty;
+ __webpack_require__(77).f = gOPNExt.f = $getOwnPropertyNames;
+ __webpack_require__(74).f = $propertyIsEnumerable;
+ __webpack_require__(73).f = $getOwnPropertySymbols;
+
+ if(DESCRIPTORS && !__webpack_require__(14)){
+ redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
+ }
+
+ wksExt.f = function(name){
+ return wrap(wks(name));
+ }
+ }
+
+ $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
+
+ for(var symbols = (
+ // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
+ 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
+ ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
+
+ for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
+
+ $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
+ // 19.4.2.1 Symbol.for(key)
+ 'for': function(key){
+ return has(SymbolRegistry, key += '')
+ ? SymbolRegistry[key]
+ : SymbolRegistry[key] = $Symbol(key);
+ },
+ // 19.4.2.5 Symbol.keyFor(sym)
+ keyFor: function keyFor(key){
+ if(isSymbol(key))return keyOf(SymbolRegistry, key);
+ throw TypeError(key + ' is not a symbol!');
+ },
+ useSetter: function(){ setter = true; },
+ useSimple: function(){ setter = false; }
+ });
+
+ $export($export.S + $export.F * !USE_NATIVE, 'Object', {
+ // 19.1.2.2 Object.create(O [, Properties])
+ create: $create,
+ // 19.1.2.4 Object.defineProperty(O, P, Attributes)
+ defineProperty: $defineProperty,
+ // 19.1.2.3 Object.defineProperties(O, Properties)
+ defineProperties: $defineProperties,
+ // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
+ getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
+ // 19.1.2.7 Object.getOwnPropertyNames(O)
+ getOwnPropertyNames: $getOwnPropertyNames,
+ // 19.1.2.8 Object.getOwnPropertySymbols(O)
+ getOwnPropertySymbols: $getOwnPropertySymbols
+ });
+
+ // 24.3.2 JSON.stringify(value [, replacer [, space]])
+ $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
+ var S = $Symbol();
+ // MS Edge converts symbol values to JSON as {}
+ // WebKit converts symbol values to JSON as null
+ // V8 throws on boxed symbols
+ return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
+ })), 'JSON', {
+ stringify: function stringify(it){
+ if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
+ var args = [it]
+ , i = 1
+ , replacer, $replacer;
+ while(arguments.length > i)args.push(arguments[i++]);
+ replacer = args[1];
+ if(typeof replacer == 'function')$replacer = replacer;
+ if($replacer || !isArray(replacer))replacer = function(key, value){
+ if($replacer)value = $replacer.call(this, key, value);
+ if(!isSymbol(value))return value;
+ };
+ args[1] = replacer;
+ return _stringify.apply($JSON, args);
+ }
+ });
+
+ // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
+ $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(20)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
+ // 19.4.3.5 Symbol.prototype[@@toStringTag]
+ setToStringTag($Symbol, 'Symbol');
+ // 20.2.1.9 Math[@@toStringTag]
+ setToStringTag(Math, 'Math', true);
+ // 24.3.3 JSON[@@toStringTag]
+ setToStringTag(global.JSON, 'JSON', true);
+
+/***/ },
+/* 69 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var META = __webpack_require__(43)('meta')
+ , isObject = __webpack_require__(23)
+ , has = __webpack_require__(31)
+ , setDesc = __webpack_require__(21).f
+ , id = 0;
+ var isExtensible = Object.isExtensible || function(){
+ return true;
+ };
+ var FREEZE = !__webpack_require__(26)(function(){
+ return isExtensible(Object.preventExtensions({}));
+ });
+ var setMeta = function(it){
+ setDesc(it, META, {value: {
+ i: 'O' + ++id, // object ID
+ w: {} // weak collections IDs
+ }});
+ };
+ var fastKey = function(it, create){
+ // return primitive with prefix
+ if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
+ if(!has(it, META)){
+ // can't set metadata to uncaught frozen object
+ if(!isExtensible(it))return 'F';
+ // not necessary to add metadata
+ if(!create)return 'E';
+ // add missing metadata
+ setMeta(it);
+ // return object ID
+ } return it[META].i;
+ };
+ var getWeak = function(it, create){
+ if(!has(it, META)){
+ // can't set metadata to uncaught frozen object
+ if(!isExtensible(it))return true;
+ // not necessary to add metadata
+ if(!create)return false;
+ // add missing metadata
+ setMeta(it);
+ // return hash weak collections IDs
+ } return it[META].w;
+ };
+ // add metadata on freeze-family methods calling
+ var onFreeze = function(it){
+ if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
+ return it;
+ };
+ var meta = module.exports = {
+ KEY: META,
+ NEED: false,
+ fastKey: fastKey,
+ getWeak: getWeak,
+ onFreeze: onFreeze
+ };
+
+/***/ },
+/* 70 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var global = __webpack_require__(16)
+ , core = __webpack_require__(17)
+ , LIBRARY = __webpack_require__(14)
+ , wksExt = __webpack_require__(65)
+ , defineProperty = __webpack_require__(21).f;
+ module.exports = function(name){
+ var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
+ if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
+ };
+
+/***/ },
+/* 71 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var getKeys = __webpack_require__(35)
+ , toIObject = __webpack_require__(9);
+ module.exports = function(object, el){
+ var O = toIObject(object)
+ , keys = getKeys(O)
+ , length = keys.length
+ , index = 0
+ , key;
+ while(length > index)if(O[key = keys[index++]] === el)return key;
+ };
+
+/***/ },
+/* 72 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // all enumerable object keys, includes symbols
+ var getKeys = __webpack_require__(35)
+ , gOPS = __webpack_require__(73)
+ , pIE = __webpack_require__(74);
+ module.exports = function(it){
+ var result = getKeys(it)
+ , getSymbols = gOPS.f;
+ if(getSymbols){
+ var symbols = getSymbols(it)
+ , isEnum = pIE.f
+ , i = 0
+ , key;
+ while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
+ } return result;
+ };
+
+/***/ },
+/* 73 */
+/***/ function(module, exports) {
+
+ exports.f = Object.getOwnPropertySymbols;
+
+/***/ },
+/* 74 */
+/***/ function(module, exports) {
+
+ exports.f = {}.propertyIsEnumerable;
+
+/***/ },
+/* 75 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 7.2.2 IsArray(argument)
+ var cof = __webpack_require__(11);
+ module.exports = Array.isArray || function isArray(arg){
+ return cof(arg) == 'Array';
+ };
+
+/***/ },
+/* 76 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
+ var toIObject = __webpack_require__(9)
+ , gOPN = __webpack_require__(77).f
+ , toString = {}.toString;
+
+ var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
+ ? Object.getOwnPropertyNames(window) : [];
+
+ var getWindowNames = function(it){
+ try {
+ return gOPN(it);
+ } catch(e){
+ return windowNames.slice();
+ }
+ };
+
+ module.exports.f = function getOwnPropertyNames(it){
+ return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
+ };
+
+
+/***/ },
+/* 77 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
+ var $keys = __webpack_require__(36)
+ , hiddenKeys = __webpack_require__(44).concat('length', 'prototype');
+
+ exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
+ return $keys(O, hiddenKeys);
+ };
+
+/***/ },
+/* 78 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var pIE = __webpack_require__(74)
+ , createDesc = __webpack_require__(29)
+ , toIObject = __webpack_require__(9)
+ , toPrimitive = __webpack_require__(28)
+ , has = __webpack_require__(31)
+ , IE8_DOM_DEFINE = __webpack_require__(24)
+ , gOPD = Object.getOwnPropertyDescriptor;
+
+ exports.f = __webpack_require__(25) ? gOPD : function getOwnPropertyDescriptor(O, P){
+ O = toIObject(O);
+ P = toPrimitive(P, true);
+ if(IE8_DOM_DEFINE)try {
+ return gOPD(O, P);
+ } catch(e){ /* empty */ }
+ if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
+ };
+
+/***/ },
+/* 79 */
+/***/ function(module, exports) {
+
+
+
+/***/ },
+/* 80 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(70)('asyncIterator');
+
+/***/ },
+/* 81 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(70)('observable');
+
+/***/ },
+/* 82 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(83), __esModule: true };
+
+/***/ },
+/* 83 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var core = __webpack_require__(17)
+ , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});
+ module.exports = function stringify(it){ // eslint-disable-line no-unused-vars
+ return $JSON.stringify.apply($JSON, arguments);
+ };
+
+/***/ },
+/* 84 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ // first check if moment.js is already loaded in the browser window, if so,
+ // use this instance. Else, load via commonjs.
+ module.exports = typeof window !== 'undefined' && window['moment'] || __webpack_require__(85);
+
+/***/ },
+/* 85 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* WEBPACK VAR INJECTION */(function(module) {//! moment.js
+ //! version : 2.17.1
+ //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
+ //! license : MIT
+ //! momentjs.com
+
+ ;(function (global, factory) {
+ true ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ global.moment = factory()
+ }(this, (function () { 'use strict';
+
+ var hookCallback;
+
+ function hooks () {
+ return hookCallback.apply(null, arguments);
+ }
+
+ // This is done to register the method called with moment()
+ // without creating circular dependencies.
+ function setHookCallback (callback) {
+ hookCallback = callback;
+ }
+
+ function isArray(input) {
+ return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
+ }
+
+ function isObject(input) {
+ // IE8 will treat undefined and null as object if it wasn't for
+ // input != null
+ return input != null && Object.prototype.toString.call(input) === '[object Object]';
+ }
+
+ function isObjectEmpty(obj) {
+ var k;
+ for (k in obj) {
+ // even if its not own property I'd still call it non-empty
+ return false;
+ }
+ return true;
+ }
+
+ function isNumber(input) {
+ return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
+ }
+
+ function isDate(input) {
+ return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
+ }
+
+ function map(arr, fn) {
+ var res = [], i;
+ for (i = 0; i < arr.length; ++i) {
+ res.push(fn(arr[i], i));
+ }
+ return res;
+ }
+
+ function hasOwnProp(a, b) {
+ return Object.prototype.hasOwnProperty.call(a, b);
+ }
+
+ function extend(a, b) {
+ for (var i in b) {
+ if (hasOwnProp(b, i)) {
+ a[i] = b[i];
+ }
+ }
+
+ if (hasOwnProp(b, 'toString')) {
+ a.toString = b.toString;
+ }
+
+ if (hasOwnProp(b, 'valueOf')) {
+ a.valueOf = b.valueOf;
+ }
+
+ return a;
+ }
+
+ function createUTC (input, format, locale, strict) {
+ return createLocalOrUTC(input, format, locale, strict, true).utc();
+ }
+
+ function defaultParsingFlags() {
+ // We need to deep clone this object.
+ return {
+ empty : false,
+ unusedTokens : [],
+ unusedInput : [],
+ overflow : -2,
+ charsLeftOver : 0,
+ nullInput : false,
+ invalidMonth : null,
+ invalidFormat : false,
+ userInvalidated : false,
+ iso : false,
+ parsedDateParts : [],
+ meridiem : null
+ };
+ }
+
+ function getParsingFlags(m) {
+ if (m._pf == null) {
+ m._pf = defaultParsingFlags();
+ }
+ return m._pf;
+ }
+
+ var some;
+ if (Array.prototype.some) {
+ some = Array.prototype.some;
+ } else {
+ some = function (fun) {
+ var t = Object(this);
+ var len = t.length >>> 0;
+
+ for (var i = 0; i < len; i++) {
+ if (i in t && fun.call(this, t[i], i, t)) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+ }
+
+ var some$1 = some;
+
+ function isValid(m) {
+ if (m._isValid == null) {
+ var flags = getParsingFlags(m);
+ var parsedParts = some$1.call(flags.parsedDateParts, function (i) {
+ return i != null;
+ });
+ var isNowValid = !isNaN(m._d.getTime()) &&
+ flags.overflow < 0 &&
+ !flags.empty &&
+ !flags.invalidMonth &&
+ !flags.invalidWeekday &&
+ !flags.nullInput &&
+ !flags.invalidFormat &&
+ !flags.userInvalidated &&
+ (!flags.meridiem || (flags.meridiem && parsedParts));
+
+ if (m._strict) {
+ isNowValid = isNowValid &&
+ flags.charsLeftOver === 0 &&
+ flags.unusedTokens.length === 0 &&
+ flags.bigHour === undefined;
+ }
+
+ if (Object.isFrozen == null || !Object.isFrozen(m)) {
+ m._isValid = isNowValid;
+ }
+ else {
+ return isNowValid;
+ }
+ }
+ return m._isValid;
+ }
+
+ function createInvalid (flags) {
+ var m = createUTC(NaN);
+ if (flags != null) {
+ extend(getParsingFlags(m), flags);
+ }
+ else {
+ getParsingFlags(m).userInvalidated = true;
+ }
+
+ return m;
+ }
+
+ function isUndefined(input) {
+ return input === void 0;
+ }
+
+ // Plugins that add properties should also add the key here (null value),
+ // so we can properly clone ourselves.
+ var momentProperties = hooks.momentProperties = [];
+
+ function copyConfig(to, from) {
+ var i, prop, val;
+
+ if (!isUndefined(from._isAMomentObject)) {
+ to._isAMomentObject = from._isAMomentObject;
+ }
+ if (!isUndefined(from._i)) {
+ to._i = from._i;
+ }
+ if (!isUndefined(from._f)) {
+ to._f = from._f;
+ }
+ if (!isUndefined(from._l)) {
+ to._l = from._l;
+ }
+ if (!isUndefined(from._strict)) {
+ to._strict = from._strict;
+ }
+ if (!isUndefined(from._tzm)) {
+ to._tzm = from._tzm;
+ }
+ if (!isUndefined(from._isUTC)) {
+ to._isUTC = from._isUTC;
+ }
+ if (!isUndefined(from._offset)) {
+ to._offset = from._offset;
+ }
+ if (!isUndefined(from._pf)) {
+ to._pf = getParsingFlags(from);
+ }
+ if (!isUndefined(from._locale)) {
+ to._locale = from._locale;
+ }
+
+ if (momentProperties.length > 0) {
+ for (i in momentProperties) {
+ prop = momentProperties[i];
+ val = from[prop];
+ if (!isUndefined(val)) {
+ to[prop] = val;
+ }
+ }
+ }
+
+ return to;
+ }
+
+ var updateInProgress = false;
+
+ // Moment prototype object
+ function Moment(config) {
+ copyConfig(this, config);
+ this._d = new Date(config._d != null ? config._d.getTime() : NaN);
+ if (!this.isValid()) {
+ this._d = new Date(NaN);
+ }
+ // Prevent infinite loop in case updateOffset creates new moment
+ // objects.
+ if (updateInProgress === false) {
+ updateInProgress = true;
+ hooks.updateOffset(this);
+ updateInProgress = false;
+ }
+ }
+
+ function isMoment (obj) {
+ return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
+ }
+
+ function absFloor (number) {
+ if (number < 0) {
+ // -0 -> 0
+ return Math.ceil(number) || 0;
+ } else {
+ return Math.floor(number);
+ }
+ }
+
+ function toInt(argumentForCoercion) {
+ var coercedNumber = +argumentForCoercion,
+ value = 0;
+
+ if (coercedNumber !== 0 && isFinite(coercedNumber)) {
+ value = absFloor(coercedNumber);
+ }
+
+ return value;
+ }
+
+ // compare two arrays, return the number of differences
+ function compareArrays(array1, array2, dontConvert) {
+ var len = Math.min(array1.length, array2.length),
+ lengthDiff = Math.abs(array1.length - array2.length),
+ diffs = 0,
+ i;
+ for (i = 0; i < len; i++) {
+ if ((dontConvert && array1[i] !== array2[i]) ||
+ (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
+ diffs++;
+ }
+ }
+ return diffs + lengthDiff;
+ }
+
+ function warn(msg) {
+ if (hooks.suppressDeprecationWarnings === false &&
+ (typeof console !== 'undefined') && console.warn) {
+ console.warn('Deprecation warning: ' + msg);
+ }
+ }
+
+ function deprecate(msg, fn) {
+ var firstTime = true;
+
+ return extend(function () {
+ if (hooks.deprecationHandler != null) {
+ hooks.deprecationHandler(null, msg);
+ }
+ if (firstTime) {
+ var args = [];
+ var arg;
+ for (var i = 0; i < arguments.length; i++) {
+ arg = '';
+ if (typeof arguments[i] === 'object') {
+ arg += '\n[' + i + '] ';
+ for (var key in arguments[0]) {
+ arg += key + ': ' + arguments[0][key] + ', ';
+ }
+ arg = arg.slice(0, -2); // Remove trailing comma and space
+ } else {
+ arg = arguments[i];
+ }
+ args.push(arg);
+ }
+ warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
+ firstTime = false;
+ }
+ return fn.apply(this, arguments);
+ }, fn);
+ }
+
+ var deprecations = {};
+
+ function deprecateSimple(name, msg) {
+ if (hooks.deprecationHandler != null) {
+ hooks.deprecationHandler(name, msg);
+ }
+ if (!deprecations[name]) {
+ warn(msg);
+ deprecations[name] = true;
+ }
+ }
+
+ hooks.suppressDeprecationWarnings = false;
+ hooks.deprecationHandler = null;
+
+ function isFunction(input) {
+ return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
+ }
+
+ function set (config) {
+ var prop, i;
+ for (i in config) {
+ prop = config[i];
+ if (isFunction(prop)) {
+ this[i] = prop;
+ } else {
+ this['_' + i] = prop;
+ }
+ }
+ this._config = config;
+ // Lenient ordinal parsing accepts just a number in addition to
+ // number + (possibly) stuff coming from _ordinalParseLenient.
+ this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
+ }
+
+ function mergeConfigs(parentConfig, childConfig) {
+ var res = extend({}, parentConfig), prop;
+ for (prop in childConfig) {
+ if (hasOwnProp(childConfig, prop)) {
+ if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
+ res[prop] = {};
+ extend(res[prop], parentConfig[prop]);
+ extend(res[prop], childConfig[prop]);
+ } else if (childConfig[prop] != null) {
+ res[prop] = childConfig[prop];
+ } else {
+ delete res[prop];
+ }
+ }
+ }
+ for (prop in parentConfig) {
+ if (hasOwnProp(parentConfig, prop) &&
+ !hasOwnProp(childConfig, prop) &&
+ isObject(parentConfig[prop])) {
+ // make sure changes to properties don't modify parent config
+ res[prop] = extend({}, res[prop]);
+ }
+ }
+ return res;
+ }
+
+ function Locale(config) {
+ if (config != null) {
+ this.set(config);
+ }
+ }
+
+ var keys;
+
+ if (Object.keys) {
+ keys = Object.keys;
+ } else {
+ keys = function (obj) {
+ var i, res = [];
+ for (i in obj) {
+ if (hasOwnProp(obj, i)) {
+ res.push(i);
+ }
+ }
+ return res;
+ };
+ }
+
+ var keys$1 = keys;
+
+ var defaultCalendar = {
+ sameDay : '[Today at] LT',
+ nextDay : '[Tomorrow at] LT',
+ nextWeek : 'dddd [at] LT',
+ lastDay : '[Yesterday at] LT',
+ lastWeek : '[Last] dddd [at] LT',
+ sameElse : 'L'
+ };
+
+ function calendar (key, mom, now) {
+ var output = this._calendar[key] || this._calendar['sameElse'];
+ return isFunction(output) ? output.call(mom, now) : output;
+ }
+
+ var defaultLongDateFormat = {
+ LTS : 'h:mm:ss A',
+ LT : 'h:mm A',
+ L : 'MM/DD/YYYY',
+ LL : 'MMMM D, YYYY',
+ LLL : 'MMMM D, YYYY h:mm A',
+ LLLL : 'dddd, MMMM D, YYYY h:mm A'
+ };
+
+ function longDateFormat (key) {
+ var format = this._longDateFormat[key],
+ formatUpper = this._longDateFormat[key.toUpperCase()];
+
+ if (format || !formatUpper) {
+ return format;
+ }
+
+ this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
+ return val.slice(1);
+ });
+
+ return this._longDateFormat[key];
+ }
+
+ var defaultInvalidDate = 'Invalid date';
+
+ function invalidDate () {
+ return this._invalidDate;
+ }
+
+ var defaultOrdinal = '%d';
+ var defaultOrdinalParse = /\d{1,2}/;
+
+ function ordinal (number) {
+ return this._ordinal.replace('%d', number);
+ }
+
+ var defaultRelativeTime = {
+ 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'
+ };
+
+ function relativeTime (number, withoutSuffix, string, isFuture) {
+ var output = this._relativeTime[string];
+ return (isFunction(output)) ?
+ output(number, withoutSuffix, string, isFuture) :
+ output.replace(/%d/i, number);
+ }
+
+ function pastFuture (diff, output) {
+ var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
+ return isFunction(format) ? format(output) : format.replace(/%s/i, output);
+ }
+
+ var aliases = {};
+
+ function addUnitAlias (unit, shorthand) {
+ var lowerCase = unit.toLowerCase();
+ aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
+ }
+
+ function normalizeUnits(units) {
+ return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
+ }
+
+ function normalizeObjectUnits(inputObject) {
+ var normalizedInput = {},
+ normalizedProp,
+ prop;
+
+ for (prop in inputObject) {
+ if (hasOwnProp(inputObject, prop)) {
+ normalizedProp = normalizeUnits(prop);
+ if (normalizedProp) {
+ normalizedInput[normalizedProp] = inputObject[prop];
+ }
+ }
+ }
+
+ return normalizedInput;
+ }
+
+ var priorities = {};
+
+ function addUnitPriority(unit, priority) {
+ priorities[unit] = priority;
+ }
+
+ function getPrioritizedUnits(unitsObj) {
+ var units = [];
+ for (var u in unitsObj) {
+ units.push({unit: u, priority: priorities[u]});
+ }
+ units.sort(function (a, b) {
+ return a.priority - b.priority;
+ });
+ return units;
+ }
+
+ function makeGetSet (unit, keepTime) {
+ return function (value) {
+ if (value != null) {
+ set$1(this, unit, value);
+ hooks.updateOffset(this, keepTime);
+ return this;
+ } else {
+ return get(this, unit);
+ }
+ };
+ }
+
+ function get (mom, unit) {
+ return mom.isValid() ?
+ mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
+ }
+
+ function set$1 (mom, unit, value) {
+ if (mom.isValid()) {
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
+ }
+ }
+
+ // MOMENTS
+
+ function stringGet (units) {
+ units = normalizeUnits(units);
+ if (isFunction(this[units])) {
+ return this[units]();
+ }
+ return this;
+ }
+
+
+ function stringSet (units, value) {
+ if (typeof units === 'object') {
+ units = normalizeObjectUnits(units);
+ var prioritized = getPrioritizedUnits(units);
+ for (var i = 0; i < prioritized.length; i++) {
+ this[prioritized[i].unit](units[prioritized[i].unit]);
+ }
+ } else {
+ units = normalizeUnits(units);
+ if (isFunction(this[units])) {
+ return this[units](value);
+ }
+ }
+ return this;
+ }
+
+ function zeroFill(number, targetLength, forceSign) {
+ var absNumber = '' + Math.abs(number),
+ zerosToFill = targetLength - absNumber.length,
+ sign = number >= 0;
+ return (sign ? (forceSign ? '+' : '') : '-') +
+ Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
+ }
+
+ var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
+
+ var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
+
+ var formatFunctions = {};
+
+ var formatTokenFunctions = {};
+
+ // token: 'M'
+ // padded: ['MM', 2]
+ // ordinal: 'Mo'
+ // callback: function () { this.month() + 1 }
+ function addFormatToken (token, padded, ordinal, callback) {
+ var func = callback;
+ if (typeof callback === 'string') {
+ func = function () {
+ return this[callback]();
+ };
+ }
+ if (token) {
+ formatTokenFunctions[token] = func;
+ }
+ if (padded) {
+ formatTokenFunctions[padded[0]] = function () {
+ return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
+ };
+ }
+ if (ordinal) {
+ formatTokenFunctions[ordinal] = function () {
+ return this.localeData().ordinal(func.apply(this, arguments), token);
+ };
+ }
+ }
+
+ function removeFormattingTokens(input) {
+ if (input.match(/\[[\s\S]/)) {
+ return input.replace(/^\[|\]$/g, '');
+ }
+ return input.replace(/\\/g, '');
+ }
+
+ function makeFormatFunction(format) {
+ var array = format.match(formattingTokens), i, length;
+
+ for (i = 0, length = array.length; i < length; i++) {
+ if (formatTokenFunctions[array[i]]) {
+ array[i] = formatTokenFunctions[array[i]];
+ } else {
+ array[i] = removeFormattingTokens(array[i]);
+ }
+ }
+
+ return function (mom) {
+ var output = '', i;
+ for (i = 0; i < length; i++) {
+ output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
+ }
+ return output;
+ };
+ }
+
+ // format date using native date object
+ function formatMoment(m, format) {
+ if (!m.isValid()) {
+ return m.localeData().invalidDate();
+ }
+
+ format = expandFormat(format, m.localeData());
+ formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
+
+ return formatFunctions[format](m);
+ }
+
+ function expandFormat(format, locale) {
+ var i = 5;
+
+ function replaceLongDateFormatTokens(input) {
+ return locale.longDateFormat(input) || input;
+ }
+
+ localFormattingTokens.lastIndex = 0;
+ while (i >= 0 && localFormattingTokens.test(format)) {
+ format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
+ localFormattingTokens.lastIndex = 0;
+ i -= 1;
+ }
+
+ return format;
+ }
+
+ var match1 = /\d/; // 0 - 9
+ var match2 = /\d\d/; // 00 - 99
+ var match3 = /\d{3}/; // 000 - 999
+ var match4 = /\d{4}/; // 0000 - 9999
+ var match6 = /[+-]?\d{6}/; // -999999 - 999999
+ var match1to2 = /\d\d?/; // 0 - 99
+ var match3to4 = /\d\d\d\d?/; // 999 - 9999
+ var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
+ var match1to3 = /\d{1,3}/; // 0 - 999
+ var match1to4 = /\d{1,4}/; // 0 - 9999
+ var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
+
+ var matchUnsigned = /\d+/; // 0 - inf
+ var matchSigned = /[+-]?\d+/; // -inf - inf
+
+ var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
+ var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
+
+ var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
+
+ // any word (or two) characters or numbers including two/three word month in arabic.
+ // includes scottish gaelic two word and hyphenated months
+ var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
+
+
+ var regexes = {};
+
+ function addRegexToken (token, regex, strictRegex) {
+ regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
+ return (isStrict && strictRegex) ? strictRegex : regex;
+ };
+ }
+
+ function getParseRegexForToken (token, config) {
+ if (!hasOwnProp(regexes, token)) {
+ return new RegExp(unescapeFormat(token));
+ }
+
+ return regexes[token](config._strict, config._locale);
+ }
+
+ // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
+ function unescapeFormat(s) {
+ return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
+ return p1 || p2 || p3 || p4;
+ }));
+ }
+
+ function regexEscape(s) {
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+ }
+
+ var tokens = {};
+
+ function addParseToken (token, callback) {
+ var i, func = callback;
+ if (typeof token === 'string') {
+ token = [token];
+ }
+ if (isNumber(callback)) {
+ func = function (input, array) {
+ array[callback] = toInt(input);
+ };
+ }
+ for (i = 0; i < token.length; i++) {
+ tokens[token[i]] = func;
+ }
+ }
+
+ function addWeekParseToken (token, callback) {
+ addParseToken(token, function (input, array, config, token) {
+ config._w = config._w || {};
+ callback(input, config._w, config, token);
+ });
+ }
+
+ function addTimeToArrayFromToken(token, input, config) {
+ if (input != null && hasOwnProp(tokens, token)) {
+ tokens[token](input, config._a, config, token);
+ }
+ }
+
+ var YEAR = 0;
+ var MONTH = 1;
+ var DATE = 2;
+ var HOUR = 3;
+ var MINUTE = 4;
+ var SECOND = 5;
+ var MILLISECOND = 6;
+ var WEEK = 7;
+ var WEEKDAY = 8;
+
+ var indexOf;
+
+ if (Array.prototype.indexOf) {
+ indexOf = Array.prototype.indexOf;
+ } else {
+ indexOf = function (o) {
+ // I know
+ var i;
+ for (i = 0; i < this.length; ++i) {
+ if (this[i] === o) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ }
+
+ var indexOf$1 = indexOf;
+
+ function daysInMonth(year, month) {
+ return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
+ }
+
+ // FORMATTING
+
+ addFormatToken('M', ['MM', 2], 'Mo', function () {
+ return this.month() + 1;
+ });
+
+ addFormatToken('MMM', 0, 0, function (format) {
+ return this.localeData().monthsShort(this, format);
+ });
+
+ addFormatToken('MMMM', 0, 0, function (format) {
+ return this.localeData().months(this, format);
+ });
+
+ // ALIASES
+
+ addUnitAlias('month', 'M');
+
+ // PRIORITY
+
+ addUnitPriority('month', 8);
+
+ // PARSING
+
+ addRegexToken('M', match1to2);
+ addRegexToken('MM', match1to2, match2);
+ addRegexToken('MMM', function (isStrict, locale) {
+ return locale.monthsShortRegex(isStrict);
+ });
+ addRegexToken('MMMM', function (isStrict, locale) {
+ return locale.monthsRegex(isStrict);
+ });
+
+ addParseToken(['M', 'MM'], function (input, array) {
+ array[MONTH] = toInt(input) - 1;
+ });
+
+ addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
+ var month = config._locale.monthsParse(input, token, config._strict);
+ // if we didn't find a month name, mark the date as invalid.
+ if (month != null) {
+ array[MONTH] = month;
+ } else {
+ getParsingFlags(config).invalidMonth = input;
+ }
+ });
+
+ // LOCALES
+
+ var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
+ var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
+ function localeMonths (m, format) {
+ if (!m) {
+ return this._months;
+ }
+ return isArray(this._months) ? this._months[m.month()] :
+ this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
+ }
+
+ var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
+ function localeMonthsShort (m, format) {
+ if (!m) {
+ return this._monthsShort;
+ }
+ return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
+ this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
+ }
+
+ function handleStrictParse(monthName, format, strict) {
+ var i, ii, mom, llc = monthName.toLocaleLowerCase();
+ if (!this._monthsParse) {
+ // this is not used
+ this._monthsParse = [];
+ this._longMonthsParse = [];
+ this._shortMonthsParse = [];
+ for (i = 0; i < 12; ++i) {
+ mom = createUTC([2000, i]);
+ this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
+ this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
+ }
+ }
+
+ if (strict) {
+ if (format === 'MMM') {
+ ii = indexOf$1.call(this._shortMonthsParse, llc);
+ return ii !== -1 ? ii : null;
+ } else {
+ ii = indexOf$1.call(this._longMonthsParse, llc);
+ return ii !== -1 ? ii : null;
+ }
+ } else {
+ if (format === 'MMM') {
+ ii = indexOf$1.call(this._shortMonthsParse, llc);
+ if (ii !== -1) {
+ return ii;
+ }
+ ii = indexOf$1.call(this._longMonthsParse, llc);
+ return ii !== -1 ? ii : null;
+ } else {
+ ii = indexOf$1.call(this._longMonthsParse, llc);
+ if (ii !== -1) {
+ return ii;
+ }
+ ii = indexOf$1.call(this._shortMonthsParse, llc);
+ return ii !== -1 ? ii : null;
+ }
+ }
+ }
+
+ function localeMonthsParse (monthName, format, strict) {
+ var i, mom, regex;
+
+ if (this._monthsParseExact) {
+ return handleStrictParse.call(this, monthName, format, strict);
+ }
+
+ if (!this._monthsParse) {
+ this._monthsParse = [];
+ this._longMonthsParse = [];
+ this._shortMonthsParse = [];
+ }
+
+ // TODO: add sorting
+ // Sorting makes sure if one month (or abbr) is a prefix of another
+ // see sorting in computeMonthsParse
+ for (i = 0; i < 12; i++) {
+ // make the regex if we don't have it already
+ mom = createUTC([2000, i]);
+ if (strict && !this._longMonthsParse[i]) {
+ this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
+ this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
+ }
+ if (!strict && !this._monthsParse[i]) {
+ regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
+ this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
+ }
+ // test the regex
+ if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
+ return i;
+ } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
+ return i;
+ } else if (!strict && this._monthsParse[i].test(monthName)) {
+ return i;
+ }
+ }
+ }
+
+ // MOMENTS
+
+ function setMonth (mom, value) {
+ var dayOfMonth;
+
+ if (!mom.isValid()) {
+ // No op
+ return mom;
+ }
+
+ if (typeof value === 'string') {
+ if (/^\d+$/.test(value)) {
+ value = toInt(value);
+ } else {
+ value = mom.localeData().monthsParse(value);
+ // TODO: Another silent failure?
+ if (!isNumber(value)) {
+ return mom;
+ }
+ }
+ }
+
+ dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
+ return mom;
+ }
+
+ function getSetMonth (value) {
+ if (value != null) {
+ setMonth(this, value);
+ hooks.updateOffset(this, true);
+ return this;
+ } else {
+ return get(this, 'Month');
+ }
+ }
+
+ function getDaysInMonth () {
+ return daysInMonth(this.year(), this.month());
+ }
+
+ var defaultMonthsShortRegex = matchWord;
+ function monthsShortRegex (isStrict) {
+ if (this._monthsParseExact) {
+ if (!hasOwnProp(this, '_monthsRegex')) {
+ computeMonthsParse.call(this);
+ }
+ if (isStrict) {
+ return this._monthsShortStrictRegex;
+ } else {
+ return this._monthsShortRegex;
+ }
+ } else {
+ if (!hasOwnProp(this, '_monthsShortRegex')) {
+ this._monthsShortRegex = defaultMonthsShortRegex;
+ }
+ return this._monthsShortStrictRegex && isStrict ?
+ this._monthsShortStrictRegex : this._monthsShortRegex;
+ }
+ }
+
+ var defaultMonthsRegex = matchWord;
+ function monthsRegex (isStrict) {
+ if (this._monthsParseExact) {
+ if (!hasOwnProp(this, '_monthsRegex')) {
+ computeMonthsParse.call(this);
+ }
+ if (isStrict) {
+ return this._monthsStrictRegex;
+ } else {
+ return this._monthsRegex;
+ }
+ } else {
+ if (!hasOwnProp(this, '_monthsRegex')) {
+ this._monthsRegex = defaultMonthsRegex;
+ }
+ return this._monthsStrictRegex && isStrict ?
+ this._monthsStrictRegex : this._monthsRegex;
+ }
+ }
+
+ function computeMonthsParse () {
+ function cmpLenRev(a, b) {
+ return b.length - a.length;
+ }
+
+ var shortPieces = [], longPieces = [], mixedPieces = [],
+ i, mom;
+ for (i = 0; i < 12; i++) {
+ // make the regex if we don't have it already
+ mom = createUTC([2000, i]);
+ shortPieces.push(this.monthsShort(mom, ''));
+ longPieces.push(this.months(mom, ''));
+ mixedPieces.push(this.months(mom, ''));
+ mixedPieces.push(this.monthsShort(mom, ''));
+ }
+ // Sorting makes sure if one month (or abbr) is a prefix of another it
+ // will match the longer piece.
+ shortPieces.sort(cmpLenRev);
+ longPieces.sort(cmpLenRev);
+ mixedPieces.sort(cmpLenRev);
+ for (i = 0; i < 12; i++) {
+ shortPieces[i] = regexEscape(shortPieces[i]);
+ longPieces[i] = regexEscape(longPieces[i]);
+ }
+ for (i = 0; i < 24; i++) {
+ mixedPieces[i] = regexEscape(mixedPieces[i]);
+ }
+
+ this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
+ this._monthsShortRegex = this._monthsRegex;
+ this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
+ this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
+ }
+
+ // FORMATTING
+
+ addFormatToken('Y', 0, 0, function () {
+ var y = this.year();
+ return y <= 9999 ? '' + y : '+' + y;
+ });
+
+ addFormatToken(0, ['YY', 2], 0, function () {
+ return this.year() % 100;
+ });
+
+ addFormatToken(0, ['YYYY', 4], 0, 'year');
+ addFormatToken(0, ['YYYYY', 5], 0, 'year');
+ addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
+
+ // ALIASES
+
+ addUnitAlias('year', 'y');
+
+ // PRIORITIES
+
+ addUnitPriority('year', 1);
+
+ // PARSING
+
+ addRegexToken('Y', matchSigned);
+ addRegexToken('YY', match1to2, match2);
+ addRegexToken('YYYY', match1to4, match4);
+ addRegexToken('YYYYY', match1to6, match6);
+ addRegexToken('YYYYYY', match1to6, match6);
+
+ addParseToken(['YYYYY', 'YYYYYY'], YEAR);
+ addParseToken('YYYY', function (input, array) {
+ array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
+ });
+ addParseToken('YY', function (input, array) {
+ array[YEAR] = hooks.parseTwoDigitYear(input);
+ });
+ addParseToken('Y', function (input, array) {
+ array[YEAR] = parseInt(input, 10);
+ });
+
+ // HELPERS
+
+ function daysInYear(year) {
+ return isLeapYear(year) ? 366 : 365;
+ }
+
+ function isLeapYear(year) {
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
+ }
+
+ // HOOKS
+
+ hooks.parseTwoDigitYear = function (input) {
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
+ };
+
+ // MOMENTS
+
+ var getSetYear = makeGetSet('FullYear', true);
+
+ function getIsLeapYear () {
+ return isLeapYear(this.year());
+ }
+
+ function createDate (y, m, d, h, M, s, ms) {
+ //can't just apply() to create a date:
+ //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
+ var date = new Date(y, m, d, h, M, s, ms);
+
+ //the date constructor remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
+ date.setFullYear(y);
+ }
+ return date;
+ }
+
+ function createUTCDate (y) {
+ var date = new Date(Date.UTC.apply(null, arguments));
+
+ //the Date.UTC function remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
+ date.setUTCFullYear(y);
+ }
+ return date;
+ }
+
+ // start-of-first-week - start-of-year
+ function firstWeekOffset(year, dow, doy) {
+ var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
+ fwd = 7 + dow - doy,
+ // first-week day local weekday -- which local weekday is fwd
+ fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
+
+ return -fwdlw + fwd - 1;
+ }
+
+ //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
+ function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
+ var localWeekday = (7 + weekday - dow) % 7,
+ weekOffset = firstWeekOffset(year, dow, doy),
+ dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
+ resYear, resDayOfYear;
+
+ if (dayOfYear <= 0) {
+ resYear = year - 1;
+ resDayOfYear = daysInYear(resYear) + dayOfYear;
+ } else if (dayOfYear > daysInYear(year)) {
+ resYear = year + 1;
+ resDayOfYear = dayOfYear - daysInYear(year);
+ } else {
+ resYear = year;
+ resDayOfYear = dayOfYear;
+ }
+
+ return {
+ year: resYear,
+ dayOfYear: resDayOfYear
+ };
+ }
+
+ function weekOfYear(mom, dow, doy) {
+ var weekOffset = firstWeekOffset(mom.year(), dow, doy),
+ week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
+ resWeek, resYear;
+
+ if (week < 1) {
+ resYear = mom.year() - 1;
+ resWeek = week + weeksInYear(resYear, dow, doy);
+ } else if (week > weeksInYear(mom.year(), dow, doy)) {
+ resWeek = week - weeksInYear(mom.year(), dow, doy);
+ resYear = mom.year() + 1;
+ } else {
+ resYear = mom.year();
+ resWeek = week;
+ }
+
+ return {
+ week: resWeek,
+ year: resYear
+ };
+ }
+
+ function weeksInYear(year, dow, doy) {
+ var weekOffset = firstWeekOffset(year, dow, doy),
+ weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
+ return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
+ }
+
+ // FORMATTING
+
+ addFormatToken('w', ['ww', 2], 'wo', 'week');
+ addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
+
+ // ALIASES
+
+ addUnitAlias('week', 'w');
+ addUnitAlias('isoWeek', 'W');
+
+ // PRIORITIES
+
+ addUnitPriority('week', 5);
+ addUnitPriority('isoWeek', 5);
+
+ // PARSING
+
+ addRegexToken('w', match1to2);
+ addRegexToken('ww', match1to2, match2);
+ addRegexToken('W', match1to2);
+ addRegexToken('WW', match1to2, match2);
+
+ addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
+ week[token.substr(0, 1)] = toInt(input);
+ });
+
+ // HELPERS
+
+ // LOCALES
+
+ function localeWeek (mom) {
+ return weekOfYear(mom, this._week.dow, this._week.doy).week;
+ }
+
+ var defaultLocaleWeek = {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ };
+
+ function localeFirstDayOfWeek () {
+ return this._week.dow;
+ }
+
+ function localeFirstDayOfYear () {
+ return this._week.doy;
+ }
+
+ // MOMENTS
+
+ function getSetWeek (input) {
+ var week = this.localeData().week(this);
+ return input == null ? week : this.add((input - week) * 7, 'd');
+ }
+
+ function getSetISOWeek (input) {
+ var week = weekOfYear(this, 1, 4).week;
+ return input == null ? week : this.add((input - week) * 7, 'd');
+ }
+
+ // FORMATTING
+
+ addFormatToken('d', 0, 'do', 'day');
+
+ addFormatToken('dd', 0, 0, function (format) {
+ return this.localeData().weekdaysMin(this, format);
+ });
+
+ addFormatToken('ddd', 0, 0, function (format) {
+ return this.localeData().weekdaysShort(this, format);
+ });
+
+ addFormatToken('dddd', 0, 0, function (format) {
+ return this.localeData().weekdays(this, format);
+ });
+
+ addFormatToken('e', 0, 0, 'weekday');
+ addFormatToken('E', 0, 0, 'isoWeekday');
+
+ // ALIASES
+
+ addUnitAlias('day', 'd');
+ addUnitAlias('weekday', 'e');
+ addUnitAlias('isoWeekday', 'E');
+
+ // PRIORITY
+ addUnitPriority('day', 11);
+ addUnitPriority('weekday', 11);
+ addUnitPriority('isoWeekday', 11);
+
+ // PARSING
+
+ addRegexToken('d', match1to2);
+ addRegexToken('e', match1to2);
+ addRegexToken('E', match1to2);
+ addRegexToken('dd', function (isStrict, locale) {
+ return locale.weekdaysMinRegex(isStrict);
+ });
+ addRegexToken('ddd', function (isStrict, locale) {
+ return locale.weekdaysShortRegex(isStrict);
+ });
+ addRegexToken('dddd', function (isStrict, locale) {
+ return locale.weekdaysRegex(isStrict);
+ });
+
+ addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
+ var weekday = config._locale.weekdaysParse(input, token, config._strict);
+ // if we didn't get a weekday name, mark the date as invalid
+ if (weekday != null) {
+ week.d = weekday;
+ } else {
+ getParsingFlags(config).invalidWeekday = input;
+ }
+ });
+
+ addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
+ week[token] = toInt(input);
+ });
+
+ // HELPERS
+
+ function parseWeekday(input, locale) {
+ if (typeof input !== 'string') {
+ return input;
+ }
+
+ if (!isNaN(input)) {
+ return parseInt(input, 10);
+ }
+
+ input = locale.weekdaysParse(input);
+ if (typeof input === 'number') {
+ return input;
+ }
+
+ return null;
+ }
+
+ function parseIsoWeekday(input, locale) {
+ if (typeof input === 'string') {
+ return locale.weekdaysParse(input) % 7 || 7;
+ }
+ return isNaN(input) ? null : input;
+ }
+
+ // LOCALES
+
+ var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
+ function localeWeekdays (m, format) {
+ if (!m) {
+ return this._weekdays;
+ }
+ return isArray(this._weekdays) ? this._weekdays[m.day()] :
+ this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
+ }
+
+ var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
+ function localeWeekdaysShort (m) {
+ return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
+ }
+
+ var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
+ function localeWeekdaysMin (m) {
+ return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
+ }
+
+ function handleStrictParse$1(weekdayName, format, strict) {
+ var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
+ if (!this._weekdaysParse) {
+ this._weekdaysParse = [];
+ this._shortWeekdaysParse = [];
+ this._minWeekdaysParse = [];
+
+ for (i = 0; i < 7; ++i) {
+ mom = createUTC([2000, 1]).day(i);
+ this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
+ this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
+ this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
+ }
+ }
+
+ if (strict) {
+ if (format === 'dddd') {
+ ii = indexOf$1.call(this._weekdaysParse, llc);
+ return ii !== -1 ? ii : null;
+ } else if (format === 'ddd') {
+ ii = indexOf$1.call(this._shortWeekdaysParse, llc);
+ return ii !== -1 ? ii : null;
+ } else {
+ ii = indexOf$1.call(this._minWeekdaysParse, llc);
+ return ii !== -1 ? ii : null;
+ }
+ } else {
+ if (format === 'dddd') {
+ ii = indexOf$1.call(this._weekdaysParse, llc);
+ if (ii !== -1) {
+ return ii;
+ }
+ ii = indexOf$1.call(this._shortWeekdaysParse, llc);
+ if (ii !== -1) {
+ return ii;
+ }
+ ii = indexOf$1.call(this._minWeekdaysParse, llc);
+ return ii !== -1 ? ii : null;
+ } else if (format === 'ddd') {
+ ii = indexOf$1.call(this._shortWeekdaysParse, llc);
+ if (ii !== -1) {
+ return ii;
+ }
+ ii = indexOf$1.call(this._weekdaysParse, llc);
+ if (ii !== -1) {
+ return ii;
+ }
+ ii = indexOf$1.call(this._minWeekdaysParse, llc);
+ return ii !== -1 ? ii : null;
+ } else {
+ ii = indexOf$1.call(this._minWeekdaysParse, llc);
+ if (ii !== -1) {
+ return ii;
+ }
+ ii = indexOf$1.call(this._weekdaysParse, llc);
+ if (ii !== -1) {
+ return ii;
+ }
+ ii = indexOf$1.call(this._shortWeekdaysParse, llc);
+ return ii !== -1 ? ii : null;
+ }
+ }
+ }
+
+ function localeWeekdaysParse (weekdayName, format, strict) {
+ var i, mom, regex;
+
+ if (this._weekdaysParseExact) {
+ return handleStrictParse$1.call(this, weekdayName, format, strict);
+ }
+
+ if (!this._weekdaysParse) {
+ this._weekdaysParse = [];
+ this._minWeekdaysParse = [];
+ this._shortWeekdaysParse = [];
+ this._fullWeekdaysParse = [];
+ }
+
+ for (i = 0; i < 7; i++) {
+ // make the regex if we don't have it already
+
+ mom = createUTC([2000, 1]).day(i);
+ if (strict && !this._fullWeekdaysParse[i]) {
+ this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
+ this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
+ this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
+ }
+ if (!this._weekdaysParse[i]) {
+ regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
+ this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
+ }
+ // test the regex
+ if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
+ return i;
+ } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
+ return i;
+ }
+ }
+ }
+
+ // MOMENTS
+
+ function getSetDayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
+ if (input != null) {
+ input = parseWeekday(input, this.localeData());
+ return this.add(input - day, 'd');
+ } else {
+ return day;
+ }
+ }
+
+ function getSetLocaleDayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
+ return input == null ? weekday : this.add(input - weekday, 'd');
+ }
+
+ function getSetISODayOfWeek (input) {
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+
+ // behaves the same as moment#day except
+ // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
+ // as a setter, sunday should belong to the previous week.
+
+ if (input != null) {
+ var weekday = parseIsoWeekday(input, this.localeData());
+ return this.day(this.day() % 7 ? weekday : weekday - 7);
+ } else {
+ return this.day() || 7;
+ }
+ }
+
+ var defaultWeekdaysRegex = matchWord;
+ function weekdaysRegex (isStrict) {
+ if (this._weekdaysParseExact) {
+ if (!hasOwnProp(this, '_weekdaysRegex')) {
+ computeWeekdaysParse.call(this);
+ }
+ if (isStrict) {
+ return this._weekdaysStrictRegex;
+ } else {
+ return this._weekdaysRegex;
+ }
+ } else {
+ if (!hasOwnProp(this, '_weekdaysRegex')) {
+ this._weekdaysRegex = defaultWeekdaysRegex;
+ }
+ return this._weekdaysStrictRegex && isStrict ?
+ this._weekdaysStrictRegex : this._weekdaysRegex;
+ }
+ }
+
+ var defaultWeekdaysShortRegex = matchWord;
+ function weekdaysShortRegex (isStrict) {
+ if (this._weekdaysParseExact) {
+ if (!hasOwnProp(this, '_weekdaysRegex')) {
+ computeWeekdaysParse.call(this);
+ }
+ if (isStrict) {
+ return this._weekdaysShortStrictRegex;
+ } else {
+ return this._weekdaysShortRegex;
+ }
+ } else {
+ if (!hasOwnProp(this, '_weekdaysShortRegex')) {
+ this._weekdaysShortRegex = defaultWeekdaysShortRegex;
+ }
+ return this._weekdaysShortStrictRegex && isStrict ?
+ this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
+ }
+ }
+
+ var defaultWeekdaysMinRegex = matchWord;
+ function weekdaysMinRegex (isStrict) {
+ if (this._weekdaysParseExact) {
+ if (!hasOwnProp(this, '_weekdaysRegex')) {
+ computeWeekdaysParse.call(this);
+ }
+ if (isStrict) {
+ return this._weekdaysMinStrictRegex;
+ } else {
+ return this._weekdaysMinRegex;
+ }
+ } else {
+ if (!hasOwnProp(this, '_weekdaysMinRegex')) {
+ this._weekdaysMinRegex = defaultWeekdaysMinRegex;
+ }
+ return this._weekdaysMinStrictRegex && isStrict ?
+ this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
+ }
+ }
+
+
+ function computeWeekdaysParse () {
+ function cmpLenRev(a, b) {
+ return b.length - a.length;
+ }
+
+ var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
+ i, mom, minp, shortp, longp;
+ for (i = 0; i < 7; i++) {
+ // make the regex if we don't have it already
+ mom = createUTC([2000, 1]).day(i);
+ minp = this.weekdaysMin(mom, '');
+ shortp = this.weekdaysShort(mom, '');
+ longp = this.weekdays(mom, '');
+ minPieces.push(minp);
+ shortPieces.push(shortp);
+ longPieces.push(longp);
+ mixedPieces.push(minp);
+ mixedPieces.push(shortp);
+ mixedPieces.push(longp);
+ }
+ // Sorting makes sure if one weekday (or abbr) is a prefix of another it
+ // will match the longer piece.
+ minPieces.sort(cmpLenRev);
+ shortPieces.sort(cmpLenRev);
+ longPieces.sort(cmpLenRev);
+ mixedPieces.sort(cmpLenRev);
+ for (i = 0; i < 7; i++) {
+ shortPieces[i] = regexEscape(shortPieces[i]);
+ longPieces[i] = regexEscape(longPieces[i]);
+ mixedPieces[i] = regexEscape(mixedPieces[i]);
+ }
+
+ this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
+ this._weekdaysShortRegex = this._weekdaysRegex;
+ this._weekdaysMinRegex = this._weekdaysRegex;
+
+ this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
+ this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
+ this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
+ }
+
+ // FORMATTING
+
+ function hFormat() {
+ return this.hours() % 12 || 12;
+ }
+
+ function kFormat() {
+ return this.hours() || 24;
+ }
+
+ addFormatToken('H', ['HH', 2], 0, 'hour');
+ addFormatToken('h', ['hh', 2], 0, hFormat);
+ addFormatToken('k', ['kk', 2], 0, kFormat);
+
+ addFormatToken('hmm', 0, 0, function () {
+ return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
+ });
+
+ addFormatToken('hmmss', 0, 0, function () {
+ return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
+ zeroFill(this.seconds(), 2);
+ });
+
+ addFormatToken('Hmm', 0, 0, function () {
+ return '' + this.hours() + zeroFill(this.minutes(), 2);
+ });
+
+ addFormatToken('Hmmss', 0, 0, function () {
+ return '' + this.hours() + zeroFill(this.minutes(), 2) +
+ zeroFill(this.seconds(), 2);
+ });
+
+ function meridiem (token, lowercase) {
+ addFormatToken(token, 0, 0, function () {
+ return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
+ });
+ }
+
+ meridiem('a', true);
+ meridiem('A', false);
+
+ // ALIASES
+
+ addUnitAlias('hour', 'h');
+
+ // PRIORITY
+ addUnitPriority('hour', 13);
+
+ // PARSING
+
+ function matchMeridiem (isStrict, locale) {
+ return locale._meridiemParse;
+ }
+
+ addRegexToken('a', matchMeridiem);
+ addRegexToken('A', matchMeridiem);
+ addRegexToken('H', match1to2);
+ addRegexToken('h', match1to2);
+ addRegexToken('HH', match1to2, match2);
+ addRegexToken('hh', match1to2, match2);
+
+ addRegexToken('hmm', match3to4);
+ addRegexToken('hmmss', match5to6);
+ addRegexToken('Hmm', match3to4);
+ addRegexToken('Hmmss', match5to6);
+
+ addParseToken(['H', 'HH'], HOUR);
+ addParseToken(['a', 'A'], function (input, array, config) {
+ config._isPm = config._locale.isPM(input);
+ config._meridiem = input;
+ });
+ addParseToken(['h', 'hh'], function (input, array, config) {
+ array[HOUR] = toInt(input);
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('hmm', function (input, array, config) {
+ var pos = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos));
+ array[MINUTE] = toInt(input.substr(pos));
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('hmmss', function (input, array, config) {
+ var pos1 = input.length - 4;
+ var pos2 = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos1));
+ array[MINUTE] = toInt(input.substr(pos1, 2));
+ array[SECOND] = toInt(input.substr(pos2));
+ getParsingFlags(config).bigHour = true;
+ });
+ addParseToken('Hmm', function (input, array, config) {
+ var pos = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos));
+ array[MINUTE] = toInt(input.substr(pos));
+ });
+ addParseToken('Hmmss', function (input, array, config) {
+ var pos1 = input.length - 4;
+ var pos2 = input.length - 2;
+ array[HOUR] = toInt(input.substr(0, pos1));
+ array[MINUTE] = toInt(input.substr(pos1, 2));
+ array[SECOND] = toInt(input.substr(pos2));
+ });
+
+ // LOCALES
+
+ function localeIsPM (input) {
+ // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
+ // Using charAt should be more compatible.
+ return ((input + '').toLowerCase().charAt(0) === 'p');
+ }
+
+ var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
+ function localeMeridiem (hours, minutes, isLower) {
+ if (hours > 11) {
+ return isLower ? 'pm' : 'PM';
+ } else {
+ return isLower ? 'am' : 'AM';
+ }
+ }
+
+
+ // MOMENTS
+
+ // Setting the hour should keep the time, because the user explicitly
+ // specified which hour he wants. So trying to maintain the same hour (in
+ // a new timezone) makes sense. Adding/subtracting hours does not follow
+ // this rule.
+ var getSetHour = makeGetSet('Hours', true);
+
+ // months
+ // week
+ // weekdays
+ // meridiem
+ var baseConfig = {
+ calendar: defaultCalendar,
+ longDateFormat: defaultLongDateFormat,
+ invalidDate: defaultInvalidDate,
+ ordinal: defaultOrdinal,
+ ordinalParse: defaultOrdinalParse,
+ relativeTime: defaultRelativeTime,
+
+ months: defaultLocaleMonths,
+ monthsShort: defaultLocaleMonthsShort,
+
+ week: defaultLocaleWeek,
+
+ weekdays: defaultLocaleWeekdays,
+ weekdaysMin: defaultLocaleWeekdaysMin,
+ weekdaysShort: defaultLocaleWeekdaysShort,
+
+ meridiemParse: defaultLocaleMeridiemParse
+ };
+
+ // internal storage for locale config files
+ var locales = {};
+ var localeFamilies = {};
+ var globalLocale;
+
+ function normalizeLocale(key) {
+ return key ? key.toLowerCase().replace('_', '-') : key;
+ }
+
+ // pick the locale from the array
+ // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
+ // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
+ function chooseLocale(names) {
+ var i = 0, j, next, locale, split;
+
+ while (i < names.length) {
+ split = normalizeLocale(names[i]).split('-');
+ j = split.length;
+ next = normalizeLocale(names[i + 1]);
+ next = next ? next.split('-') : null;
+ while (j > 0) {
+ locale = loadLocale(split.slice(0, j).join('-'));
+ if (locale) {
+ return locale;
+ }
+ if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
+ //the next array item is better than a shallower substring of this one
+ break;
+ }
+ j--;
+ }
+ i++;
+ }
+ return null;
+ }
+
+ function loadLocale(name) {
+ var oldLocale = null;
+ // TODO: Find a better way to register and load all the locales in Node
+ if (!locales[name] && (typeof module !== 'undefined') &&
+ module && module.exports) {
+ try {
+ oldLocale = globalLocale._abbr;
+ !(function webpackMissingModule() { var e = new Error("Cannot find module \"./locale\""); e.code = 'MODULE_NOT_FOUND'; throw e; }());
+ // because defineLocale currently also sets the global locale, we
+ // want to undo that for lazy loaded locales
+ getSetGlobalLocale(oldLocale);
+ } catch (e) { }
+ }
+ return locales[name];
+ }
+
+ // This function will load locale and then set the global locale. If
+ // no arguments are passed in, it will simply return the current global
+ // locale key.
+ function getSetGlobalLocale (key, values) {
+ var data;
+ if (key) {
+ if (isUndefined(values)) {
+ data = getLocale(key);
+ }
+ else {
+ data = defineLocale(key, values);
+ }
+
+ if (data) {
+ // moment.duration._locale = moment._locale = data;
+ globalLocale = data;
+ }
+ }
+
+ return globalLocale._abbr;
+ }
+
+ function defineLocale (name, config) {
+ if (config !== null) {
+ var parentConfig = baseConfig;
+ config.abbr = name;
+ if (locales[name] != null) {
+ deprecateSimple('defineLocaleOverride',
+ 'use moment.updateLocale(localeName, config) to change ' +
+ 'an existing locale. moment.defineLocale(localeName, ' +
+ 'config) should only be used for creating a new locale ' +
+ 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
+ parentConfig = locales[name]._config;
+ } else if (config.parentLocale != null) {
+ if (locales[config.parentLocale] != null) {
+ parentConfig = locales[config.parentLocale]._config;
+ } else {
+ if (!localeFamilies[config.parentLocale]) {
+ localeFamilies[config.parentLocale] = [];
+ }
+ localeFamilies[config.parentLocale].push({
+ name: name,
+ config: config
+ });
+ return null;
+ }
+ }
+ locales[name] = new Locale(mergeConfigs(parentConfig, config));
+
+ if (localeFamilies[name]) {
+ localeFamilies[name].forEach(function (x) {
+ defineLocale(x.name, x.config);
+ });
+ }
+
+ // backwards compat for now: also set the locale
+ // make sure we set the locale AFTER all child locales have been
+ // created, so we won't end up with the child locale set.
+ getSetGlobalLocale(name);
+
+
+ return locales[name];
+ } else {
+ // useful for testing
+ delete locales[name];
+ return null;
+ }
+ }
+
+ function updateLocale(name, config) {
+ if (config != null) {
+ var locale, parentConfig = baseConfig;
+ // MERGE
+ if (locales[name] != null) {
+ parentConfig = locales[name]._config;
+ }
+ config = mergeConfigs(parentConfig, config);
+ locale = new Locale(config);
+ locale.parentLocale = locales[name];
+ locales[name] = locale;
+
+ // backwards compat for now: also set the locale
+ getSetGlobalLocale(name);
+ } else {
+ // pass null for config to unupdate, useful for tests
+ if (locales[name] != null) {
+ if (locales[name].parentLocale != null) {
+ locales[name] = locales[name].parentLocale;
+ } else if (locales[name] != null) {
+ delete locales[name];
+ }
+ }
+ }
+ return locales[name];
+ }
+
+ // returns locale data
+ function getLocale (key) {
+ var locale;
+
+ if (key && key._locale && key._locale._abbr) {
+ key = key._locale._abbr;
+ }
+
+ if (!key) {
+ return globalLocale;
+ }
+
+ if (!isArray(key)) {
+ //short-circuit everything else
+ locale = loadLocale(key);
+ if (locale) {
+ return locale;
+ }
+ key = [key];
+ }
+
+ return chooseLocale(key);
+ }
+
+ function listLocales() {
+ return keys$1(locales);
+ }
+
+ function checkOverflow (m) {
+ var overflow;
+ var a = m._a;
+
+ if (a && getParsingFlags(m).overflow === -2) {
+ overflow =
+ a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
+ a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
+ a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
+ a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
+ a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
+ a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
+ -1;
+
+ if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
+ overflow = DATE;
+ }
+ if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
+ overflow = WEEK;
+ }
+ if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
+ overflow = WEEKDAY;
+ }
+
+ getParsingFlags(m).overflow = overflow;
+ }
+
+ return m;
+ }
+
+ // iso 8601 regex
+ // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
+ var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
+ var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
+
+ var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
+
+ var isoDates = [
+ ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
+ ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
+ ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
+ ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
+ ['YYYY-DDD', /\d{4}-\d{3}/],
+ ['YYYY-MM', /\d{4}-\d\d/, false],
+ ['YYYYYYMMDD', /[+-]\d{10}/],
+ ['YYYYMMDD', /\d{8}/],
+ // YYYYMM is NOT allowed by the standard
+ ['GGGG[W]WWE', /\d{4}W\d{3}/],
+ ['GGGG[W]WW', /\d{4}W\d{2}/, false],
+ ['YYYYDDD', /\d{7}/]
+ ];
+
+ // iso time formats and regexes
+ var isoTimes = [
+ ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
+ ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
+ ['HH:mm:ss', /\d\d:\d\d:\d\d/],
+ ['HH:mm', /\d\d:\d\d/],
+ ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
+ ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
+ ['HHmmss', /\d\d\d\d\d\d/],
+ ['HHmm', /\d\d\d\d/],
+ ['HH', /\d\d/]
+ ];
+
+ var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
+
+ // date from iso format
+ function configFromISO(config) {
+ var i, l,
+ string = config._i,
+ match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
+ allowTime, dateFormat, timeFormat, tzFormat;
+
+ if (match) {
+ getParsingFlags(config).iso = true;
+
+ for (i = 0, l = isoDates.length; i < l; i++) {
+ if (isoDates[i][1].exec(match[1])) {
+ dateFormat = isoDates[i][0];
+ allowTime = isoDates[i][2] !== false;
+ break;
+ }
+ }
+ if (dateFormat == null) {
+ config._isValid = false;
+ return;
+ }
+ if (match[3]) {
+ for (i = 0, l = isoTimes.length; i < l; i++) {
+ if (isoTimes[i][1].exec(match[3])) {
+ // match[2] should be 'T' or space
+ timeFormat = (match[2] || ' ') + isoTimes[i][0];
+ break;
+ }
+ }
+ if (timeFormat == null) {
+ config._isValid = false;
+ return;
+ }
+ }
+ if (!allowTime && timeFormat != null) {
+ config._isValid = false;
+ return;
+ }
+ if (match[4]) {
+ if (tzRegex.exec(match[4])) {
+ tzFormat = 'Z';
+ } else {
+ config._isValid = false;
+ return;
+ }
+ }
+ config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
+ configFromStringAndFormat(config);
+ } else {
+ config._isValid = false;
+ }
+ }
+
+ // date from iso format or fallback
+ function configFromString(config) {
+ var matched = aspNetJsonRegex.exec(config._i);
+
+ if (matched !== null) {
+ config._d = new Date(+matched[1]);
+ return;
+ }
+
+ configFromISO(config);
+ if (config._isValid === false) {
+ delete config._isValid;
+ hooks.createFromInputFallback(config);
+ }
+ }
+
+ hooks.createFromInputFallback = deprecate(
+ 'value provided is not in a recognized ISO format. moment construction falls back to js Date(), ' +
+ 'which is not reliable across all browsers and versions. Non ISO date formats are ' +
+ 'discouraged and will be removed in an upcoming major release. Please refer to ' +
+ 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
+ function (config) {
+ config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
+ }
+ );
+
+ // Pick the first defined of two or three arguments.
+ function defaults(a, b, c) {
+ if (a != null) {
+ return a;
+ }
+ if (b != null) {
+ return b;
+ }
+ return c;
+ }
+
+ function currentDateArray(config) {
+ // hooks is actually the exported moment object
+ var nowValue = new Date(hooks.now());
+ if (config._useUTC) {
+ return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
+ }
+ return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
+ }
+
+ // convert an array to a date.
+ // the array should mirror the parameters below
+ // note: all values past the year are optional and will default to the lowest possible value.
+ // [year, month, day , hour, minute, second, millisecond]
+ function configFromArray (config) {
+ var i, date, input = [], currentDate, yearToUse;
+
+ if (config._d) {
+ return;
+ }
+
+ currentDate = currentDateArray(config);
+
+ //compute day of the year from weeks and weekdays
+ if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
+ dayOfYearFromWeekInfo(config);
+ }
+
+ //if the day of the year is set, figure out what it is
+ if (config._dayOfYear) {
+ yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
+
+ if (config._dayOfYear > daysInYear(yearToUse)) {
+ getParsingFlags(config)._overflowDayOfYear = true;
+ }
+
+ date = createUTCDate(yearToUse, 0, config._dayOfYear);
+ config._a[MONTH] = date.getUTCMonth();
+ config._a[DATE] = date.getUTCDate();
+ }
+
+ // Default to current date.
+ // * if no year, month, day of month are given, default to today
+ // * if day of month is given, default month and year
+ // * if month is given, default only year
+ // * if year is given, don't default anything
+ for (i = 0; i < 3 && config._a[i] == null; ++i) {
+ config._a[i] = input[i] = currentDate[i];
+ }
+
+ // Zero out whatever was not defaulted, including time
+ for (; i < 7; i++) {
+ config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
+ }
+
+ // Check for 24:00:00.000
+ if (config._a[HOUR] === 24 &&
+ config._a[MINUTE] === 0 &&
+ config._a[SECOND] === 0 &&
+ config._a[MILLISECOND] === 0) {
+ config._nextDay = true;
+ config._a[HOUR] = 0;
+ }
+
+ config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
+ // Apply timezone offset from input. The actual utcOffset can be changed
+ // with parseZone.
+ if (config._tzm != null) {
+ config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
+ }
+
+ if (config._nextDay) {
+ config._a[HOUR] = 24;
+ }
+ }
+
+ function dayOfYearFromWeekInfo(config) {
+ var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
+
+ w = config._w;
+ if (w.GG != null || w.W != null || w.E != null) {
+ dow = 1;
+ doy = 4;
+
+ // TODO: We need to take the current isoWeekYear, but that depends on
+ // how we interpret now (local, utc, fixed offset). So create
+ // a now version of current config (take local/utc/offset flags, and
+ // create now).
+ weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
+ week = defaults(w.W, 1);
+ weekday = defaults(w.E, 1);
+ if (weekday < 1 || weekday > 7) {
+ weekdayOverflow = true;
+ }
+ } else {
+ dow = config._locale._week.dow;
+ doy = config._locale._week.doy;
+
+ var curWeek = weekOfYear(createLocal(), dow, doy);
+
+ weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
+
+ // Default to current week.
+ week = defaults(w.w, curWeek.week);
+
+ if (w.d != null) {
+ // weekday -- low day numbers are considered next week
+ weekday = w.d;
+ if (weekday < 0 || weekday > 6) {
+ weekdayOverflow = true;
+ }
+ } else if (w.e != null) {
+ // local weekday -- counting starts from begining of week
+ weekday = w.e + dow;
+ if (w.e < 0 || w.e > 6) {
+ weekdayOverflow = true;
+ }
+ } else {
+ // default to begining of week
+ weekday = dow;
+ }
+ }
+ if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
+ getParsingFlags(config)._overflowWeeks = true;
+ } else if (weekdayOverflow != null) {
+ getParsingFlags(config)._overflowWeekday = true;
+ } else {
+ temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
+ config._a[YEAR] = temp.year;
+ config._dayOfYear = temp.dayOfYear;
+ }
+ }
+
+ // constant that refers to the ISO standard
+ hooks.ISO_8601 = function () {};
+
+ // date from string and format string
+ function configFromStringAndFormat(config) {
+ // TODO: Move this to another part of the creation flow to prevent circular deps
+ if (config._f === hooks.ISO_8601) {
+ configFromISO(config);
+ return;
+ }
+
+ config._a = [];
+ getParsingFlags(config).empty = true;
+
+ // This array is used to make a Date, either with `new Date` or `Date.UTC`
+ var string = '' + config._i,
+ i, parsedInput, tokens, token, skipped,
+ stringLength = string.length,
+ totalParsedInputLength = 0;
+
+ tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
+
+ for (i = 0; i < tokens.length; i++) {
+ token = tokens[i];
+ parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
+ // console.log('token', token, 'parsedInput', parsedInput,
+ // 'regex', getParseRegexForToken(token, config));
+ if (parsedInput) {
+ skipped = string.substr(0, string.indexOf(parsedInput));
+ if (skipped.length > 0) {
+ getParsingFlags(config).unusedInput.push(skipped);
+ }
+ string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
+ totalParsedInputLength += parsedInput.length;
+ }
+ // don't parse if it's not a known token
+ if (formatTokenFunctions[token]) {
+ if (parsedInput) {
+ getParsingFlags(config).empty = false;
+ }
+ else {
+ getParsingFlags(config).unusedTokens.push(token);
+ }
+ addTimeToArrayFromToken(token, parsedInput, config);
+ }
+ else if (config._strict && !parsedInput) {
+ getParsingFlags(config).unusedTokens.push(token);
+ }
+ }
+
+ // add remaining unparsed input length to the string
+ getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
+ if (string.length > 0) {
+ getParsingFlags(config).unusedInput.push(string);
+ }
+
+ // clear _12h flag if hour is <= 12
+ if (config._a[HOUR] <= 12 &&
+ getParsingFlags(config).bigHour === true &&
+ config._a[HOUR] > 0) {
+ getParsingFlags(config).bigHour = undefined;
+ }
+
+ getParsingFlags(config).parsedDateParts = config._a.slice(0);
+ getParsingFlags(config).meridiem = config._meridiem;
+ // handle meridiem
+ config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
+
+ configFromArray(config);
+ checkOverflow(config);
+ }
+
+
+ function meridiemFixWrap (locale, hour, meridiem) {
+ var isPm;
+
+ if (meridiem == null) {
+ // nothing to do
+ return hour;
+ }
+ if (locale.meridiemHour != null) {
+ return locale.meridiemHour(hour, meridiem);
+ } else if (locale.isPM != null) {
+ // Fallback
+ isPm = locale.isPM(meridiem);
+ if (isPm && hour < 12) {
+ hour += 12;
+ }
+ if (!isPm && hour === 12) {
+ hour = 0;
+ }
+ return hour;
+ } else {
+ // this is not supposed to happen
+ return hour;
+ }
+ }
+
+ // date from string and array of format strings
+ function configFromStringAndArray(config) {
+ var tempConfig,
+ bestMoment,
+
+ scoreToBeat,
+ i,
+ currentScore;
+
+ if (config._f.length === 0) {
+ getParsingFlags(config).invalidFormat = true;
+ config._d = new Date(NaN);
+ return;
+ }
+
+ for (i = 0; i < config._f.length; i++) {
+ currentScore = 0;
+ tempConfig = copyConfig({}, config);
+ if (config._useUTC != null) {
+ tempConfig._useUTC = config._useUTC;
+ }
+ tempConfig._f = config._f[i];
+ configFromStringAndFormat(tempConfig);
+
+ if (!isValid(tempConfig)) {
+ continue;
+ }
+
+ // if there is any input that was not parsed add a penalty for that format
+ currentScore += getParsingFlags(tempConfig).charsLeftOver;
+
+ //or tokens
+ currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
+
+ getParsingFlags(tempConfig).score = currentScore;
+
+ if (scoreToBeat == null || currentScore < scoreToBeat) {
+ scoreToBeat = currentScore;
+ bestMoment = tempConfig;
+ }
+ }
+
+ extend(config, bestMoment || tempConfig);
+ }
+
+ function configFromObject(config) {
+ if (config._d) {
+ return;
+ }
+
+ var i = normalizeObjectUnits(config._i);
+ config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
+ return obj && parseInt(obj, 10);
+ });
+
+ configFromArray(config);
+ }
+
+ function createFromConfig (config) {
+ var res = new Moment(checkOverflow(prepareConfig(config)));
+ if (res._nextDay) {
+ // Adding is smart enough around DST
+ res.add(1, 'd');
+ res._nextDay = undefined;
+ }
+
+ return res;
+ }
+
+ function prepareConfig (config) {
+ var input = config._i,
+ format = config._f;
+
+ config._locale = config._locale || getLocale(config._l);
+
+ if (input === null || (format === undefined && input === '')) {
+ return createInvalid({nullInput: true});
+ }
+
+ if (typeof input === 'string') {
+ config._i = input = config._locale.preparse(input);
+ }
+
+ if (isMoment(input)) {
+ return new Moment(checkOverflow(input));
+ } else if (isDate(input)) {
+ config._d = input;
+ } else if (isArray(format)) {
+ configFromStringAndArray(config);
+ } else if (format) {
+ configFromStringAndFormat(config);
+ } else {
+ configFromInput(config);
+ }
+
+ if (!isValid(config)) {
+ config._d = null;
+ }
+
+ return config;
+ }
+
+ function configFromInput(config) {
+ var input = config._i;
+ if (input === undefined) {
+ config._d = new Date(hooks.now());
+ } else if (isDate(input)) {
+ config._d = new Date(input.valueOf());
+ } else if (typeof input === 'string') {
+ configFromString(config);
+ } else if (isArray(input)) {
+ config._a = map(input.slice(0), function (obj) {
+ return parseInt(obj, 10);
+ });
+ configFromArray(config);
+ } else if (typeof(input) === 'object') {
+ configFromObject(config);
+ } else if (isNumber(input)) {
+ // from milliseconds
+ config._d = new Date(input);
+ } else {
+ hooks.createFromInputFallback(config);
+ }
+ }
+
+ function createLocalOrUTC (input, format, locale, strict, isUTC) {
+ var c = {};
+
+ if (locale === true || locale === false) {
+ strict = locale;
+ locale = undefined;
+ }
+
+ if ((isObject(input) && isObjectEmpty(input)) ||
+ (isArray(input) && input.length === 0)) {
+ input = undefined;
+ }
+ // object construction must be done this way.
+ // https://github.com/moment/moment/issues/1423
+ c._isAMomentObject = true;
+ c._useUTC = c._isUTC = isUTC;
+ c._l = locale;
+ c._i = input;
+ c._f = format;
+ c._strict = strict;
+
+ return createFromConfig(c);
+ }
+
+ function createLocal (input, format, locale, strict) {
+ return createLocalOrUTC(input, format, locale, strict, false);
+ }
+
+ var prototypeMin = deprecate(
+ 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
+ function () {
+ var other = createLocal.apply(null, arguments);
+ if (this.isValid() && other.isValid()) {
+ return other < this ? this : other;
+ } else {
+ return createInvalid();
+ }
+ }
+ );
+
+ var prototypeMax = deprecate(
+ 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
+ function () {
+ var other = createLocal.apply(null, arguments);
+ if (this.isValid() && other.isValid()) {
+ return other > this ? this : other;
+ } else {
+ return createInvalid();
+ }
+ }
+ );
+
+ // Pick a moment m from moments so that m[fn](other) is true for all
+ // other. This relies on the function fn to be transitive.
+ //
+ // moments should either be an array of moment objects or an array, whose
+ // first element is an array of moment objects.
+ function pickBy(fn, moments) {
+ var res, i;
+ if (moments.length === 1 && isArray(moments[0])) {
+ moments = moments[0];
+ }
+ if (!moments.length) {
+ return createLocal();
+ }
+ res = moments[0];
+ for (i = 1; i < moments.length; ++i) {
+ if (!moments[i].isValid() || moments[i][fn](res)) {
+ res = moments[i];
+ }
+ }
+ return res;
+ }
+
+ // TODO: Use [].sort instead?
+ function min () {
+ var args = [].slice.call(arguments, 0);
+
+ return pickBy('isBefore', args);
+ }
+
+ function max () {
+ var args = [].slice.call(arguments, 0);
+
+ return pickBy('isAfter', args);
+ }
+
+ var now = function () {
+ return Date.now ? Date.now() : +(new Date());
+ };
+
+ function Duration (duration) {
+ var normalizedInput = normalizeObjectUnits(duration),
+ years = normalizedInput.year || 0,
+ quarters = normalizedInput.quarter || 0,
+ months = normalizedInput.month || 0,
+ weeks = normalizedInput.week || 0,
+ days = normalizedInput.day || 0,
+ hours = normalizedInput.hour || 0,
+ minutes = normalizedInput.minute || 0,
+ seconds = normalizedInput.second || 0,
+ milliseconds = normalizedInput.millisecond || 0;
+
+ // representation for dateAddRemove
+ this._milliseconds = +milliseconds +
+ seconds * 1e3 + // 1000
+ minutes * 6e4 + // 1000 * 60
+ hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
+ // Because of dateAddRemove treats 24 hours as different from a
+ // day when working around DST, we need to store them separately
+ this._days = +days +
+ weeks * 7;
+ // It is impossible translate months into days without knowing
+ // which months you are are talking about, so we have to store
+ // it separately.
+ this._months = +months +
+ quarters * 3 +
+ years * 12;
+
+ this._data = {};
+
+ this._locale = getLocale();
+
+ this._bubble();
+ }
+
+ function isDuration (obj) {
+ return obj instanceof Duration;
+ }
+
+ function absRound (number) {
+ if (number < 0) {
+ return Math.round(-1 * number) * -1;
+ } else {
+ return Math.round(number);
+ }
+ }
+
+ // FORMATTING
+
+ function offset (token, separator) {
+ addFormatToken(token, 0, 0, function () {
+ var offset = this.utcOffset();
+ var sign = '+';
+ if (offset < 0) {
+ offset = -offset;
+ sign = '-';
+ }
+ return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
+ });
+ }
+
+ offset('Z', ':');
+ offset('ZZ', '');
+
+ // PARSING
+
+ addRegexToken('Z', matchShortOffset);
+ addRegexToken('ZZ', matchShortOffset);
+ addParseToken(['Z', 'ZZ'], function (input, array, config) {
+ config._useUTC = true;
+ config._tzm = offsetFromString(matchShortOffset, input);
+ });
+
+ // HELPERS
+
+ // timezone chunker
+ // '+10:00' > ['10', '00']
+ // '-1530' > ['-15', '30']
+ var chunkOffset = /([\+\-]|\d\d)/gi;
+
+ function offsetFromString(matcher, string) {
+ var matches = (string || '').match(matcher);
+
+ if (matches === null) {
+ return null;
+ }
+
+ var chunk = matches[matches.length - 1] || [];
+ var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
+ var minutes = +(parts[1] * 60) + toInt(parts[2]);
+
+ return minutes === 0 ?
+ 0 :
+ parts[0] === '+' ? minutes : -minutes;
+ }
+
+ // Return a moment from input, that is local/utc/zone equivalent to model.
+ function cloneWithOffset(input, model) {
+ var res, diff;
+ if (model._isUTC) {
+ res = model.clone();
+ diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
+ // Use low-level api, because this fn is low-level api.
+ res._d.setTime(res._d.valueOf() + diff);
+ hooks.updateOffset(res, false);
+ return res;
+ } else {
+ return createLocal(input).local();
+ }
+ }
+
+ function getDateOffset (m) {
+ // On Firefox.24 Date#getTimezoneOffset returns a floating point.
+ // https://github.com/moment/moment/pull/1871
+ return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
+ }
+
+ // HOOKS
+
+ // This function will be called whenever a moment is mutated.
+ // It is intended to keep the offset in sync with the timezone.
+ hooks.updateOffset = function () {};
+
+ // MOMENTS
+
+ // keepLocalTime = true means only change the timezone, without
+ // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
+ // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
+ // +0200, so we adjust the time as needed, to be valid.
+ //
+ // Keeping the time actually adds/subtracts (one hour)
+ // from the actual represented time. That is why we call updateOffset
+ // a second time. In case it wants us to change the offset again
+ // _changeInProgress == true case, then we have to adjust, because
+ // there is no such time in the given timezone.
+ function getSetOffset (input, keepLocalTime) {
+ var offset = this._offset || 0,
+ localAdjust;
+ if (!this.isValid()) {
+ return input != null ? this : NaN;
+ }
+ if (input != null) {
+ if (typeof input === 'string') {
+ input = offsetFromString(matchShortOffset, input);
+ if (input === null) {
+ return this;
+ }
+ } else if (Math.abs(input) < 16) {
+ input = input * 60;
+ }
+ if (!this._isUTC && keepLocalTime) {
+ localAdjust = getDateOffset(this);
+ }
+ this._offset = input;
+ this._isUTC = true;
+ if (localAdjust != null) {
+ this.add(localAdjust, 'm');
+ }
+ if (offset !== input) {
+ if (!keepLocalTime || this._changeInProgress) {
+ addSubtract(this, createDuration(input - offset, 'm'), 1, false);
+ } else if (!this._changeInProgress) {
+ this._changeInProgress = true;
+ hooks.updateOffset(this, true);
+ this._changeInProgress = null;
+ }
+ }
+ return this;
+ } else {
+ return this._isUTC ? offset : getDateOffset(this);
+ }
+ }
+
+ function getSetZone (input, keepLocalTime) {
+ if (input != null) {
+ if (typeof input !== 'string') {
+ input = -input;
+ }
+
+ this.utcOffset(input, keepLocalTime);
+
+ return this;
+ } else {
+ return -this.utcOffset();
+ }
+ }
+
+ function setOffsetToUTC (keepLocalTime) {
+ return this.utcOffset(0, keepLocalTime);
+ }
+
+ function setOffsetToLocal (keepLocalTime) {
+ if (this._isUTC) {
+ this.utcOffset(0, keepLocalTime);
+ this._isUTC = false;
+
+ if (keepLocalTime) {
+ this.subtract(getDateOffset(this), 'm');
+ }
+ }
+ return this;
+ }
+
+ function setOffsetToParsedOffset () {
+ if (this._tzm != null) {
+ this.utcOffset(this._tzm);
+ } else if (typeof this._i === 'string') {
+ var tZone = offsetFromString(matchOffset, this._i);
+ if (tZone != null) {
+ this.utcOffset(tZone);
+ }
+ else {
+ this.utcOffset(0, true);
+ }
+ }
+ return this;
+ }
+
+ function hasAlignedHourOffset (input) {
+ if (!this.isValid()) {
+ return false;
+ }
+ input = input ? createLocal(input).utcOffset() : 0;
+
+ return (this.utcOffset() - input) % 60 === 0;
+ }
+
+ function isDaylightSavingTime () {
+ return (
+ this.utcOffset() > this.clone().month(0).utcOffset() ||
+ this.utcOffset() > this.clone().month(5).utcOffset()
+ );
+ }
+
+ function isDaylightSavingTimeShifted () {
+ if (!isUndefined(this._isDSTShifted)) {
+ return this._isDSTShifted;
+ }
+
+ var c = {};
+
+ copyConfig(c, this);
+ c = prepareConfig(c);
+
+ if (c._a) {
+ var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
+ this._isDSTShifted = this.isValid() &&
+ compareArrays(c._a, other.toArray()) > 0;
+ } else {
+ this._isDSTShifted = false;
+ }
+
+ return this._isDSTShifted;
+ }
+
+ function isLocal () {
+ return this.isValid() ? !this._isUTC : false;
+ }
+
+ function isUtcOffset () {
+ return this.isValid() ? this._isUTC : false;
+ }
+
+ function isUtc () {
+ return this.isValid() ? this._isUTC && this._offset === 0 : false;
+ }
+
+ // ASP.NET json date format regex
+ var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
+
+ // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
+ // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
+ // and further modified to allow for strings containing both week and day
+ var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;
+
+ function createDuration (input, key) {
+ var duration = input,
+ // matching against regexp is expensive, do it on demand
+ match = null,
+ sign,
+ ret,
+ diffRes;
+
+ if (isDuration(input)) {
+ duration = {
+ ms : input._milliseconds,
+ d : input._days,
+ M : input._months
+ };
+ } else if (isNumber(input)) {
+ duration = {};
+ if (key) {
+ duration[key] = input;
+ } else {
+ duration.milliseconds = input;
+ }
+ } else if (!!(match = aspNetRegex.exec(input))) {
+ sign = (match[1] === '-') ? -1 : 1;
+ duration = {
+ y : 0,
+ d : toInt(match[DATE]) * sign,
+ h : toInt(match[HOUR]) * sign,
+ m : toInt(match[MINUTE]) * sign,
+ s : toInt(match[SECOND]) * sign,
+ ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
+ };
+ } else if (!!(match = isoRegex.exec(input))) {
+ sign = (match[1] === '-') ? -1 : 1;
+ duration = {
+ y : parseIso(match[2], sign),
+ M : parseIso(match[3], sign),
+ w : parseIso(match[4], sign),
+ d : parseIso(match[5], sign),
+ h : parseIso(match[6], sign),
+ m : parseIso(match[7], sign),
+ s : parseIso(match[8], sign)
+ };
+ } else if (duration == null) {// checks for null or undefined
+ duration = {};
+ } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
+ diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
+
+ duration = {};
+ duration.ms = diffRes.milliseconds;
+ duration.M = diffRes.months;
+ }
+
+ ret = new Duration(duration);
+
+ if (isDuration(input) && hasOwnProp(input, '_locale')) {
+ ret._locale = input._locale;
+ }
+
+ return ret;
+ }
+
+ createDuration.fn = Duration.prototype;
+
+ function parseIso (inp, sign) {
+ // We'd normally use ~~inp for this, but unfortunately it also
+ // converts floats to ints.
+ // inp may be undefined, so careful calling replace on it.
+ var res = inp && parseFloat(inp.replace(',', '.'));
+ // apply sign while we're at it
+ return (isNaN(res) ? 0 : res) * sign;
+ }
+
+ function positiveMomentsDifference(base, other) {
+ var res = {milliseconds: 0, months: 0};
+
+ res.months = other.month() - base.month() +
+ (other.year() - base.year()) * 12;
+ if (base.clone().add(res.months, 'M').isAfter(other)) {
+ --res.months;
+ }
+
+ res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
+
+ return res;
+ }
+
+ function momentsDifference(base, other) {
+ var res;
+ if (!(base.isValid() && other.isValid())) {
+ return {milliseconds: 0, months: 0};
+ }
+
+ other = cloneWithOffset(other, base);
+ if (base.isBefore(other)) {
+ res = positiveMomentsDifference(base, other);
+ } else {
+ res = positiveMomentsDifference(other, base);
+ res.milliseconds = -res.milliseconds;
+ res.months = -res.months;
+ }
+
+ return res;
+ }
+
+ // TODO: remove 'name' arg after deprecation is removed
+ function createAdder(direction, name) {
+ return function (val, period) {
+ var dur, tmp;
+ //invert the arguments, but complain about it
+ if (period !== null && !isNaN(+period)) {
+ deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
+ 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
+ tmp = val; val = period; period = tmp;
+ }
+
+ val = typeof val === 'string' ? +val : val;
+ dur = createDuration(val, period);
+ addSubtract(this, dur, direction);
+ return this;
+ };
+ }
+
+ function addSubtract (mom, duration, isAdding, updateOffset) {
+ var milliseconds = duration._milliseconds,
+ days = absRound(duration._days),
+ months = absRound(duration._months);
+
+ if (!mom.isValid()) {
+ // No op
+ return;
+ }
+
+ updateOffset = updateOffset == null ? true : updateOffset;
+
+ if (milliseconds) {
+ mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
+ }
+ if (days) {
+ set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
+ }
+ if (months) {
+ setMonth(mom, get(mom, 'Month') + months * isAdding);
+ }
+ if (updateOffset) {
+ hooks.updateOffset(mom, days || months);
+ }
+ }
+
+ var add = createAdder(1, 'add');
+ var subtract = createAdder(-1, 'subtract');
+
+ function getCalendarFormat(myMoment, now) {
+ var diff = myMoment.diff(now, 'days', true);
+ return diff < -6 ? 'sameElse' :
+ diff < -1 ? 'lastWeek' :
+ diff < 0 ? 'lastDay' :
+ diff < 1 ? 'sameDay' :
+ diff < 2 ? 'nextDay' :
+ diff < 7 ? 'nextWeek' : 'sameElse';
+ }
+
+ function calendar$1 (time, formats) {
+ // We want to compare the start of today, vs this.
+ // Getting start-of-today depends on whether we're local/utc/offset or not.
+ var now = time || createLocal(),
+ sod = cloneWithOffset(now, this).startOf('day'),
+ format = hooks.calendarFormat(this, sod) || 'sameElse';
+
+ var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
+
+ return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
+ }
+
+ function clone () {
+ return new Moment(this);
+ }
+
+ function isAfter (input, units) {
+ var localInput = isMoment(input) ? input : createLocal(input);
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
+ if (units === 'millisecond') {
+ return this.valueOf() > localInput.valueOf();
+ } else {
+ return localInput.valueOf() < this.clone().startOf(units).valueOf();
+ }
+ }
+
+ function isBefore (input, units) {
+ var localInput = isMoment(input) ? input : createLocal(input);
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
+ if (units === 'millisecond') {
+ return this.valueOf() < localInput.valueOf();
+ } else {
+ return this.clone().endOf(units).valueOf() < localInput.valueOf();
+ }
+ }
+
+ function isBetween (from, to, units, inclusivity) {
+ inclusivity = inclusivity || '()';
+ return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
+ (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
+ }
+
+ function isSame (input, units) {
+ var localInput = isMoment(input) ? input : createLocal(input),
+ inputMs;
+ if (!(this.isValid() && localInput.isValid())) {
+ return false;
+ }
+ units = normalizeUnits(units || 'millisecond');
+ if (units === 'millisecond') {
+ return this.valueOf() === localInput.valueOf();
+ } else {
+ inputMs = localInput.valueOf();
+ return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
+ }
+ }
+
+ function isSameOrAfter (input, units) {
+ return this.isSame(input, units) || this.isAfter(input,units);
+ }
+
+ function isSameOrBefore (input, units) {
+ return this.isSame(input, units) || this.isBefore(input,units);
+ }
+
+ function diff (input, units, asFloat) {
+ var that,
+ zoneDelta,
+ delta, output;
+
+ if (!this.isValid()) {
+ return NaN;
+ }
+
+ that = cloneWithOffset(input, this);
+
+ if (!that.isValid()) {
+ return NaN;
+ }
+
+ zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
+
+ units = normalizeUnits(units);
+
+ if (units === 'year' || units === 'month' || units === 'quarter') {
+ output = monthDiff(this, that);
+ if (units === 'quarter') {
+ output = output / 3;
+ } else if (units === 'year') {
+ output = output / 12;
+ }
+ } else {
+ delta = this - that;
+ output = units === 'second' ? delta / 1e3 : // 1000
+ units === 'minute' ? delta / 6e4 : // 1000 * 60
+ units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
+ units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
+ units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
+ delta;
+ }
+ return asFloat ? output : absFloor(output);
+ }
+
+ function monthDiff (a, b) {
+ // difference in months
+ var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
+ // b is in (anchor - 1 month, anchor + 1 month)
+ anchor = a.clone().add(wholeMonthDiff, 'months'),
+ anchor2, adjust;
+
+ if (b - anchor < 0) {
+ anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
+ // linear across the month
+ adjust = (b - anchor) / (anchor - anchor2);
+ } else {
+ anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
+ // linear across the month
+ adjust = (b - anchor) / (anchor2 - anchor);
+ }
+
+ //check for negative zero, return zero if negative zero
+ return -(wholeMonthDiff + adjust) || 0;
+ }
+
+ hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
+ hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
+
+ function toString () {
+ return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
+ }
+
+ function toISOString () {
+ var m = this.clone().utc();
+ if (0 < m.year() && m.year() <= 9999) {
+ if (isFunction(Date.prototype.toISOString)) {
+ // native implementation is ~50x faster, use it when we can
+ return this.toDate().toISOString();
+ } else {
+ return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ }
+ } else {
+ return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ }
+ }
+
+ /**
+ * Return a human readable representation of a moment that can
+ * also be evaluated to get a new moment which is the same
+ *
+ * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
+ */
+ function inspect () {
+ if (!this.isValid()) {
+ return 'moment.invalid(/* ' + this._i + ' */)';
+ }
+ var func = 'moment';
+ var zone = '';
+ if (!this.isLocal()) {
+ func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
+ zone = 'Z';
+ }
+ var prefix = '[' + func + '("]';
+ var year = (0 < this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
+ var datetime = '-MM-DD[T]HH:mm:ss.SSS';
+ var suffix = zone + '[")]';
+
+ return this.format(prefix + year + datetime + suffix);
+ }
+
+ function format (inputString) {
+ if (!inputString) {
+ inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
+ }
+ var output = formatMoment(this, inputString);
+ return this.localeData().postformat(output);
+ }
+
+ function from (time, withoutSuffix) {
+ if (this.isValid() &&
+ ((isMoment(time) && time.isValid()) ||
+ createLocal(time).isValid())) {
+ return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
+ } else {
+ return this.localeData().invalidDate();
+ }
+ }
+
+ function fromNow (withoutSuffix) {
+ return this.from(createLocal(), withoutSuffix);
+ }
+
+ function to (time, withoutSuffix) {
+ if (this.isValid() &&
+ ((isMoment(time) && time.isValid()) ||
+ createLocal(time).isValid())) {
+ return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
+ } else {
+ return this.localeData().invalidDate();
+ }
+ }
+
+ function toNow (withoutSuffix) {
+ return this.to(createLocal(), withoutSuffix);
+ }
+
+ // If passed a locale key, it will set the locale for this
+ // instance. Otherwise, it will return the locale configuration
+ // variables for this instance.
+ function locale (key) {
+ var newLocaleData;
+
+ if (key === undefined) {
+ return this._locale._abbr;
+ } else {
+ newLocaleData = getLocale(key);
+ if (newLocaleData != null) {
+ this._locale = newLocaleData;
+ }
+ return this;
+ }
+ }
+
+ var lang = deprecate(
+ 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
+ function (key) {
+ if (key === undefined) {
+ return this.localeData();
+ } else {
+ return this.locale(key);
+ }
+ }
+ );
+
+ function localeData () {
+ return this._locale;
+ }
+
+ function startOf (units) {
+ units = normalizeUnits(units);
+ // the following switch intentionally omits break keywords
+ // to utilize falling through the cases.
+ switch (units) {
+ case 'year':
+ this.month(0);
+ /* falls through */
+ case 'quarter':
+ case 'month':
+ this.date(1);
+ /* falls through */
+ case 'week':
+ case 'isoWeek':
+ case 'day':
+ case 'date':
+ this.hours(0);
+ /* falls through */
+ case 'hour':
+ this.minutes(0);
+ /* falls through */
+ case 'minute':
+ this.seconds(0);
+ /* falls through */
+ case 'second':
+ this.milliseconds(0);
+ }
+
+ // weeks are a special case
+ if (units === 'week') {
+ this.weekday(0);
+ }
+ if (units === 'isoWeek') {
+ this.isoWeekday(1);
+ }
+
+ // quarters are also special
+ if (units === 'quarter') {
+ this.month(Math.floor(this.month() / 3) * 3);
+ }
+
+ return this;
+ }
+
+ function endOf (units) {
+ units = normalizeUnits(units);
+ if (units === undefined || units === 'millisecond') {
+ return this;
+ }
+
+ // 'date' is an alias for 'day', so it should be considered as such.
+ if (units === 'date') {
+ units = 'day';
+ }
+
+ return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
+ }
+
+ function valueOf () {
+ return this._d.valueOf() - ((this._offset || 0) * 60000);
+ }
+
+ function unix () {
+ return Math.floor(this.valueOf() / 1000);
+ }
+
+ function toDate () {
+ return new Date(this.valueOf());
+ }
+
+ function toArray () {
+ var m = this;
+ return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
+ }
+
+ function toObject () {
+ var m = this;
+ return {
+ years: m.year(),
+ months: m.month(),
+ date: m.date(),
+ hours: m.hours(),
+ minutes: m.minutes(),
+ seconds: m.seconds(),
+ milliseconds: m.milliseconds()
+ };
+ }
+
+ function toJSON () {
+ // new Date(NaN).toJSON() === null
+ return this.isValid() ? this.toISOString() : null;
+ }
+
+ function isValid$1 () {
+ return isValid(this);
+ }
+
+ function parsingFlags () {
+ return extend({}, getParsingFlags(this));
+ }
+
+ function invalidAt () {
+ return getParsingFlags(this).overflow;
+ }
+
+ function creationData() {
+ return {
+ input: this._i,
+ format: this._f,
+ locale: this._locale,
+ isUTC: this._isUTC,
+ strict: this._strict
+ };
+ }
+
+ // FORMATTING
+
+ addFormatToken(0, ['gg', 2], 0, function () {
+ return this.weekYear() % 100;
+ });
+
+ addFormatToken(0, ['GG', 2], 0, function () {
+ return this.isoWeekYear() % 100;
+ });
+
+ function addWeekYearFormatToken (token, getter) {
+ addFormatToken(0, [token, token.length], 0, getter);
+ }
+
+ addWeekYearFormatToken('gggg', 'weekYear');
+ addWeekYearFormatToken('ggggg', 'weekYear');
+ addWeekYearFormatToken('GGGG', 'isoWeekYear');
+ addWeekYearFormatToken('GGGGG', 'isoWeekYear');
+
+ // ALIASES
+
+ addUnitAlias('weekYear', 'gg');
+ addUnitAlias('isoWeekYear', 'GG');
+
+ // PRIORITY
+
+ addUnitPriority('weekYear', 1);
+ addUnitPriority('isoWeekYear', 1);
+
+
+ // PARSING
+
+ addRegexToken('G', matchSigned);
+ addRegexToken('g', matchSigned);
+ addRegexToken('GG', match1to2, match2);
+ addRegexToken('gg', match1to2, match2);
+ addRegexToken('GGGG', match1to4, match4);
+ addRegexToken('gggg', match1to4, match4);
+ addRegexToken('GGGGG', match1to6, match6);
+ addRegexToken('ggggg', match1to6, match6);
+
+ addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
+ week[token.substr(0, 2)] = toInt(input);
+ });
+
+ addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
+ week[token] = hooks.parseTwoDigitYear(input);
+ });
+
+ // MOMENTS
+
+ function getSetWeekYear (input) {
+ return getSetWeekYearHelper.call(this,
+ input,
+ this.week(),
+ this.weekday(),
+ this.localeData()._week.dow,
+ this.localeData()._week.doy);
+ }
+
+ function getSetISOWeekYear (input) {
+ return getSetWeekYearHelper.call(this,
+ input, this.isoWeek(), this.isoWeekday(), 1, 4);
+ }
+
+ function getISOWeeksInYear () {
+ return weeksInYear(this.year(), 1, 4);
+ }
+
+ function getWeeksInYear () {
+ var weekInfo = this.localeData()._week;
+ return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
+ }
+
+ function getSetWeekYearHelper(input, week, weekday, dow, doy) {
+ var weeksTarget;
+ if (input == null) {
+ return weekOfYear(this, dow, doy).year;
+ } else {
+ weeksTarget = weeksInYear(input, dow, doy);
+ if (week > weeksTarget) {
+ week = weeksTarget;
+ }
+ return setWeekAll.call(this, input, week, weekday, dow, doy);
+ }
+ }
+
+ function setWeekAll(weekYear, week, weekday, dow, doy) {
+ var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
+ date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
+
+ this.year(date.getUTCFullYear());
+ this.month(date.getUTCMonth());
+ this.date(date.getUTCDate());
+ return this;
+ }
+
+ // FORMATTING
+
+ addFormatToken('Q', 0, 'Qo', 'quarter');
+
+ // ALIASES
+
+ addUnitAlias('quarter', 'Q');
+
+ // PRIORITY
+
+ addUnitPriority('quarter', 7);
+
+ // PARSING
+
+ addRegexToken('Q', match1);
+ addParseToken('Q', function (input, array) {
+ array[MONTH] = (toInt(input) - 1) * 3;
+ });
+
+ // MOMENTS
+
+ function getSetQuarter (input) {
+ return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
+ }
+
+ // FORMATTING
+
+ addFormatToken('D', ['DD', 2], 'Do', 'date');
+
+ // ALIASES
+
+ addUnitAlias('date', 'D');
+
+ // PRIOROITY
+ addUnitPriority('date', 9);
+
+ // PARSING
+
+ addRegexToken('D', match1to2);
+ addRegexToken('DD', match1to2, match2);
+ addRegexToken('Do', function (isStrict, locale) {
+ return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
+ });
+
+ addParseToken(['D', 'DD'], DATE);
+ addParseToken('Do', function (input, array) {
+ array[DATE] = toInt(input.match(match1to2)[0], 10);
+ });
+
+ // MOMENTS
+
+ var getSetDayOfMonth = makeGetSet('Date', true);
+
+ // FORMATTING
+
+ addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
+
+ // ALIASES
+
+ addUnitAlias('dayOfYear', 'DDD');
+
+ // PRIORITY
+ addUnitPriority('dayOfYear', 4);
+
+ // PARSING
+
+ addRegexToken('DDD', match1to3);
+ addRegexToken('DDDD', match3);
+ addParseToken(['DDD', 'DDDD'], function (input, array, config) {
+ config._dayOfYear = toInt(input);
+ });
+
+ // HELPERS
+
+ // MOMENTS
+
+ function getSetDayOfYear (input) {
+ var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
+ return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
+ }
+
+ // FORMATTING
+
+ addFormatToken('m', ['mm', 2], 0, 'minute');
+
+ // ALIASES
+
+ addUnitAlias('minute', 'm');
+
+ // PRIORITY
+
+ addUnitPriority('minute', 14);
+
+ // PARSING
+
+ addRegexToken('m', match1to2);
+ addRegexToken('mm', match1to2, match2);
+ addParseToken(['m', 'mm'], MINUTE);
+
+ // MOMENTS
+
+ var getSetMinute = makeGetSet('Minutes', false);
+
+ // FORMATTING
+
+ addFormatToken('s', ['ss', 2], 0, 'second');
+
+ // ALIASES
+
+ addUnitAlias('second', 's');
+
+ // PRIORITY
+
+ addUnitPriority('second', 15);
+
+ // PARSING
+
+ addRegexToken('s', match1to2);
+ addRegexToken('ss', match1to2, match2);
+ addParseToken(['s', 'ss'], SECOND);
+
+ // MOMENTS
+
+ var getSetSecond = makeGetSet('Seconds', false);
+
+ // FORMATTING
+
+ addFormatToken('S', 0, 0, function () {
+ return ~~(this.millisecond() / 100);
+ });
+
+ addFormatToken(0, ['SS', 2], 0, function () {
+ return ~~(this.millisecond() / 10);
+ });
+
+ addFormatToken(0, ['SSS', 3], 0, 'millisecond');
+ addFormatToken(0, ['SSSS', 4], 0, function () {
+ return this.millisecond() * 10;
+ });
+ addFormatToken(0, ['SSSSS', 5], 0, function () {
+ return this.millisecond() * 100;
+ });
+ addFormatToken(0, ['SSSSSS', 6], 0, function () {
+ return this.millisecond() * 1000;
+ });
+ addFormatToken(0, ['SSSSSSS', 7], 0, function () {
+ return this.millisecond() * 10000;
+ });
+ addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
+ return this.millisecond() * 100000;
+ });
+ addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
+ return this.millisecond() * 1000000;
+ });
+
+
+ // ALIASES
+
+ addUnitAlias('millisecond', 'ms');
+
+ // PRIORITY
+
+ addUnitPriority('millisecond', 16);
+
+ // PARSING
+
+ addRegexToken('S', match1to3, match1);
+ addRegexToken('SS', match1to3, match2);
+ addRegexToken('SSS', match1to3, match3);
+
+ var token;
+ for (token = 'SSSS'; token.length <= 9; token += 'S') {
+ addRegexToken(token, matchUnsigned);
+ }
+
+ function parseMs(input, array) {
+ array[MILLISECOND] = toInt(('0.' + input) * 1000);
+ }
+
+ for (token = 'S'; token.length <= 9; token += 'S') {
+ addParseToken(token, parseMs);
+ }
+ // MOMENTS
+
+ var getSetMillisecond = makeGetSet('Milliseconds', false);
+
+ // FORMATTING
+
+ addFormatToken('z', 0, 0, 'zoneAbbr');
+ addFormatToken('zz', 0, 0, 'zoneName');
+
+ // MOMENTS
+
+ function getZoneAbbr () {
+ return this._isUTC ? 'UTC' : '';
+ }
+
+ function getZoneName () {
+ return this._isUTC ? 'Coordinated Universal Time' : '';
+ }
+
+ var proto = Moment.prototype;
+
+ proto.add = add;
+ proto.calendar = calendar$1;
+ proto.clone = clone;
+ proto.diff = diff;
+ proto.endOf = endOf;
+ proto.format = format;
+ proto.from = from;
+ proto.fromNow = fromNow;
+ proto.to = to;
+ proto.toNow = toNow;
+ proto.get = stringGet;
+ proto.invalidAt = invalidAt;
+ proto.isAfter = isAfter;
+ proto.isBefore = isBefore;
+ proto.isBetween = isBetween;
+ proto.isSame = isSame;
+ proto.isSameOrAfter = isSameOrAfter;
+ proto.isSameOrBefore = isSameOrBefore;
+ proto.isValid = isValid$1;
+ proto.lang = lang;
+ proto.locale = locale;
+ proto.localeData = localeData;
+ proto.max = prototypeMax;
+ proto.min = prototypeMin;
+ proto.parsingFlags = parsingFlags;
+ proto.set = stringSet;
+ proto.startOf = startOf;
+ proto.subtract = subtract;
+ proto.toArray = toArray;
+ proto.toObject = toObject;
+ proto.toDate = toDate;
+ proto.toISOString = toISOString;
+ proto.inspect = inspect;
+ proto.toJSON = toJSON;
+ proto.toString = toString;
+ proto.unix = unix;
+ proto.valueOf = valueOf;
+ proto.creationData = creationData;
+
+ // Year
+ proto.year = getSetYear;
+ proto.isLeapYear = getIsLeapYear;
+
+ // Week Year
+ proto.weekYear = getSetWeekYear;
+ proto.isoWeekYear = getSetISOWeekYear;
+
+ // Quarter
+ proto.quarter = proto.quarters = getSetQuarter;
+
+ // Month
+ proto.month = getSetMonth;
+ proto.daysInMonth = getDaysInMonth;
+
+ // Week
+ proto.week = proto.weeks = getSetWeek;
+ proto.isoWeek = proto.isoWeeks = getSetISOWeek;
+ proto.weeksInYear = getWeeksInYear;
+ proto.isoWeeksInYear = getISOWeeksInYear;
+
+ // Day
+ proto.date = getSetDayOfMonth;
+ proto.day = proto.days = getSetDayOfWeek;
+ proto.weekday = getSetLocaleDayOfWeek;
+ proto.isoWeekday = getSetISODayOfWeek;
+ proto.dayOfYear = getSetDayOfYear;
+
+ // Hour
+ proto.hour = proto.hours = getSetHour;
+
+ // Minute
+ proto.minute = proto.minutes = getSetMinute;
+
+ // Second
+ proto.second = proto.seconds = getSetSecond;
+
+ // Millisecond
+ proto.millisecond = proto.milliseconds = getSetMillisecond;
+
+ // Offset
+ proto.utcOffset = getSetOffset;
+ proto.utc = setOffsetToUTC;
+ proto.local = setOffsetToLocal;
+ proto.parseZone = setOffsetToParsedOffset;
+ proto.hasAlignedHourOffset = hasAlignedHourOffset;
+ proto.isDST = isDaylightSavingTime;
+ proto.isLocal = isLocal;
+ proto.isUtcOffset = isUtcOffset;
+ proto.isUtc = isUtc;
+ proto.isUTC = isUtc;
+
+ // Timezone
+ proto.zoneAbbr = getZoneAbbr;
+ proto.zoneName = getZoneName;
+
+ // Deprecations
+ proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
+ proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
+ proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
+ proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
+ proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
+
+ function createUnix (input) {
+ return createLocal(input * 1000);
+ }
+
+ function createInZone () {
+ return createLocal.apply(null, arguments).parseZone();
+ }
+
+ function preParsePostFormat (string) {
+ return string;
+ }
+
+ var proto$1 = Locale.prototype;
+
+ proto$1.calendar = calendar;
+ proto$1.longDateFormat = longDateFormat;
+ proto$1.invalidDate = invalidDate;
+ proto$1.ordinal = ordinal;
+ proto$1.preparse = preParsePostFormat;
+ proto$1.postformat = preParsePostFormat;
+ proto$1.relativeTime = relativeTime;
+ proto$1.pastFuture = pastFuture;
+ proto$1.set = set;
+
+ // Month
+ proto$1.months = localeMonths;
+ proto$1.monthsShort = localeMonthsShort;
+ proto$1.monthsParse = localeMonthsParse;
+ proto$1.monthsRegex = monthsRegex;
+ proto$1.monthsShortRegex = monthsShortRegex;
+
+ // Week
+ proto$1.week = localeWeek;
+ proto$1.firstDayOfYear = localeFirstDayOfYear;
+ proto$1.firstDayOfWeek = localeFirstDayOfWeek;
+
+ // Day of Week
+ proto$1.weekdays = localeWeekdays;
+ proto$1.weekdaysMin = localeWeekdaysMin;
+ proto$1.weekdaysShort = localeWeekdaysShort;
+ proto$1.weekdaysParse = localeWeekdaysParse;
+
+ proto$1.weekdaysRegex = weekdaysRegex;
+ proto$1.weekdaysShortRegex = weekdaysShortRegex;
+ proto$1.weekdaysMinRegex = weekdaysMinRegex;
+
+ // Hours
+ proto$1.isPM = localeIsPM;
+ proto$1.meridiem = localeMeridiem;
+
+ function get$1 (format, index, field, setter) {
+ var locale = getLocale();
+ var utc = createUTC().set(setter, index);
+ return locale[field](utc, format);
+ }
+
+ function listMonthsImpl (format, index, field) {
+ if (isNumber(format)) {
+ index = format;
+ format = undefined;
+ }
+
+ format = format || '';
+
+ if (index != null) {
+ return get$1(format, index, field, 'month');
+ }
+
+ var i;
+ var out = [];
+ for (i = 0; i < 12; i++) {
+ out[i] = get$1(format, i, field, 'month');
+ }
+ return out;
+ }
+
+ // ()
+ // (5)
+ // (fmt, 5)
+ // (fmt)
+ // (true)
+ // (true, 5)
+ // (true, fmt, 5)
+ // (true, fmt)
+ function listWeekdaysImpl (localeSorted, format, index, field) {
+ if (typeof localeSorted === 'boolean') {
+ if (isNumber(format)) {
+ index = format;
+ format = undefined;
+ }
+
+ format = format || '';
+ } else {
+ format = localeSorted;
+ index = format;
+ localeSorted = false;
+
+ if (isNumber(format)) {
+ index = format;
+ format = undefined;
+ }
+
+ format = format || '';
+ }
+
+ var locale = getLocale(),
+ shift = localeSorted ? locale._week.dow : 0;
+
+ if (index != null) {
+ return get$1(format, (index + shift) % 7, field, 'day');
+ }
+
+ var i;
+ var out = [];
+ for (i = 0; i < 7; i++) {
+ out[i] = get$1(format, (i + shift) % 7, field, 'day');
+ }
+ return out;
+ }
+
+ function listMonths (format, index) {
+ return listMonthsImpl(format, index, 'months');
+ }
+
+ function listMonthsShort (format, index) {
+ return listMonthsImpl(format, index, 'monthsShort');
+ }
+
+ function listWeekdays (localeSorted, format, index) {
+ return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
+ }
+
+ function listWeekdaysShort (localeSorted, format, index) {
+ return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
+ }
+
+ function listWeekdaysMin (localeSorted, format, index) {
+ return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
+ }
+
+ getSetGlobalLocale('en', {
+ ordinalParse: /\d{1,2}(th|st|nd|rd)/,
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (toInt(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ }
+ });
+
+ // Side effect imports
+ hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
+ hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
+
+ var mathAbs = Math.abs;
+
+ function abs () {
+ var data = this._data;
+
+ this._milliseconds = mathAbs(this._milliseconds);
+ this._days = mathAbs(this._days);
+ this._months = mathAbs(this._months);
+
+ data.milliseconds = mathAbs(data.milliseconds);
+ data.seconds = mathAbs(data.seconds);
+ data.minutes = mathAbs(data.minutes);
+ data.hours = mathAbs(data.hours);
+ data.months = mathAbs(data.months);
+ data.years = mathAbs(data.years);
+
+ return this;
+ }
+
+ function addSubtract$1 (duration, input, value, direction) {
+ var other = createDuration(input, value);
+
+ duration._milliseconds += direction * other._milliseconds;
+ duration._days += direction * other._days;
+ duration._months += direction * other._months;
+
+ return duration._bubble();
+ }
+
+ // supports only 2.0-style add(1, 's') or add(duration)
+ function add$1 (input, value) {
+ return addSubtract$1(this, input, value, 1);
+ }
+
+ // supports only 2.0-style subtract(1, 's') or subtract(duration)
+ function subtract$1 (input, value) {
+ return addSubtract$1(this, input, value, -1);
+ }
+
+ function absCeil (number) {
+ if (number < 0) {
+ return Math.floor(number);
+ } else {
+ return Math.ceil(number);
+ }
+ }
+
+ function bubble () {
+ var milliseconds = this._milliseconds;
+ var days = this._days;
+ var months = this._months;
+ var data = this._data;
+ var seconds, minutes, hours, years, monthsFromDays;
+
+ // if we have a mix of positive and negative values, bubble down first
+ // check: https://github.com/moment/moment/issues/2166
+ if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
+ (milliseconds <= 0 && days <= 0 && months <= 0))) {
+ milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
+ days = 0;
+ months = 0;
+ }
+
+ // The following code bubbles up values, see the tests for
+ // examples of what that means.
+ data.milliseconds = milliseconds % 1000;
+
+ seconds = absFloor(milliseconds / 1000);
+ data.seconds = seconds % 60;
+
+ minutes = absFloor(seconds / 60);
+ data.minutes = minutes % 60;
+
+ hours = absFloor(minutes / 60);
+ data.hours = hours % 24;
+
+ days += absFloor(hours / 24);
+
+ // convert days to months
+ monthsFromDays = absFloor(daysToMonths(days));
+ months += monthsFromDays;
+ days -= absCeil(monthsToDays(monthsFromDays));
+
+ // 12 months -> 1 year
+ years = absFloor(months / 12);
+ months %= 12;
+
+ data.days = days;
+ data.months = months;
+ data.years = years;
+
+ return this;
+ }
+
+ function daysToMonths (days) {
+ // 400 years have 146097 days (taking into account leap year rules)
+ // 400 years have 12 months === 4800
+ return days * 4800 / 146097;
+ }
+
+ function monthsToDays (months) {
+ // the reverse of daysToMonths
+ return months * 146097 / 4800;
+ }
+
+ function as (units) {
+ var days;
+ var months;
+ var milliseconds = this._milliseconds;
+
+ units = normalizeUnits(units);
+
+ if (units === 'month' || units === 'year') {
+ days = this._days + milliseconds / 864e5;
+ months = this._months + daysToMonths(days);
+ return units === 'month' ? months : months / 12;
+ } else {
+ // handle milliseconds separately because of floating point math errors (issue #1867)
+ days = this._days + Math.round(monthsToDays(this._months));
+ switch (units) {
+ case 'week' : return days / 7 + milliseconds / 6048e5;
+ case 'day' : return days + milliseconds / 864e5;
+ case 'hour' : return days * 24 + milliseconds / 36e5;
+ case 'minute' : return days * 1440 + milliseconds / 6e4;
+ case 'second' : return days * 86400 + milliseconds / 1000;
+ // Math.floor prevents floating point math errors here
+ case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
+ default: throw new Error('Unknown unit ' + units);
+ }
+ }
+ }
+
+ // TODO: Use this.as('ms')?
+ function valueOf$1 () {
+ return (
+ this._milliseconds +
+ this._days * 864e5 +
+ (this._months % 12) * 2592e6 +
+ toInt(this._months / 12) * 31536e6
+ );
+ }
+
+ function makeAs (alias) {
+ return function () {
+ return this.as(alias);
+ };
+ }
+
+ var asMilliseconds = makeAs('ms');
+ var asSeconds = makeAs('s');
+ var asMinutes = makeAs('m');
+ var asHours = makeAs('h');
+ var asDays = makeAs('d');
+ var asWeeks = makeAs('w');
+ var asMonths = makeAs('M');
+ var asYears = makeAs('y');
+
+ function get$2 (units) {
+ units = normalizeUnits(units);
+ return this[units + 's']();
+ }
+
+ function makeGetter(name) {
+ return function () {
+ return this._data[name];
+ };
+ }
+
+ var milliseconds = makeGetter('milliseconds');
+ var seconds = makeGetter('seconds');
+ var minutes = makeGetter('minutes');
+ var hours = makeGetter('hours');
+ var days = makeGetter('days');
+ var months = makeGetter('months');
+ var years = makeGetter('years');
+
+ function weeks () {
+ return absFloor(this.days() / 7);
+ }
+
+ var round = Math.round;
+ var thresholds = {
+ s: 45, // seconds to minute
+ m: 45, // minutes to hour
+ h: 22, // hours to day
+ d: 26, // days to month
+ M: 11 // months to year
+ };
+
+ // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
+ function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
+ return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
+ }
+
+ function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
+ var duration = createDuration(posNegDuration).abs();
+ var seconds = round(duration.as('s'));
+ var minutes = round(duration.as('m'));
+ var hours = round(duration.as('h'));
+ var days = round(duration.as('d'));
+ var months = round(duration.as('M'));
+ var years = round(duration.as('y'));
+
+ var a = seconds < thresholds.s && ['s', seconds] ||
+ minutes <= 1 && ['m'] ||
+ minutes < thresholds.m && ['mm', minutes] ||
+ hours <= 1 && ['h'] ||
+ hours < thresholds.h && ['hh', hours] ||
+ days <= 1 && ['d'] ||
+ days < thresholds.d && ['dd', days] ||
+ months <= 1 && ['M'] ||
+ months < thresholds.M && ['MM', months] ||
+ years <= 1 && ['y'] || ['yy', years];
+
+ a[2] = withoutSuffix;
+ a[3] = +posNegDuration > 0;
+ a[4] = locale;
+ return substituteTimeAgo.apply(null, a);
+ }
+
+ // This function allows you to set the rounding function for relative time strings
+ function getSetRelativeTimeRounding (roundingFunction) {
+ if (roundingFunction === undefined) {
+ return round;
+ }
+ if (typeof(roundingFunction) === 'function') {
+ round = roundingFunction;
+ return true;
+ }
+ return false;
+ }
+
+ // This function allows you to set a threshold for relative time strings
+ function getSetRelativeTimeThreshold (threshold, limit) {
+ if (thresholds[threshold] === undefined) {
+ return false;
+ }
+ if (limit === undefined) {
+ return thresholds[threshold];
+ }
+ thresholds[threshold] = limit;
+ return true;
+ }
+
+ function humanize (withSuffix) {
+ var locale = this.localeData();
+ var output = relativeTime$1(this, !withSuffix, locale);
+
+ if (withSuffix) {
+ output = locale.pastFuture(+this, output);
+ }
+
+ return locale.postformat(output);
+ }
+
+ var abs$1 = Math.abs;
+
+ function toISOString$1() {
+ // for ISO strings we do not use the normal bubbling rules:
+ // * milliseconds bubble up until they become hours
+ // * days do not bubble at all
+ // * months bubble up until they become years
+ // This is because there is no context-free conversion between hours and days
+ // (think of clock changes)
+ // and also not between days and months (28-31 days per month)
+ var seconds = abs$1(this._milliseconds) / 1000;
+ var days = abs$1(this._days);
+ var months = abs$1(this._months);
+ var minutes, hours, years;
+
+ // 3600 seconds -> 60 minutes -> 1 hour
+ minutes = absFloor(seconds / 60);
+ hours = absFloor(minutes / 60);
+ seconds %= 60;
+ minutes %= 60;
+
+ // 12 months -> 1 year
+ years = absFloor(months / 12);
+ months %= 12;
+
+
+ // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
+ var Y = years;
+ var M = months;
+ var D = days;
+ var h = hours;
+ var m = minutes;
+ var s = seconds;
+ var total = this.asSeconds();
+
+ if (!total) {
+ // this is the same as C#'s (Noda) and python (isodate)...
+ // but not other JS (goog.date)
+ return 'P0D';
+ }
+
+ return (total < 0 ? '-' : '') +
+ 'P' +
+ (Y ? Y + 'Y' : '') +
+ (M ? M + 'M' : '') +
+ (D ? D + 'D' : '') +
+ ((h || m || s) ? 'T' : '') +
+ (h ? h + 'H' : '') +
+ (m ? m + 'M' : '') +
+ (s ? s + 'S' : '');
+ }
+
+ var proto$2 = Duration.prototype;
+
+ proto$2.abs = abs;
+ proto$2.add = add$1;
+ proto$2.subtract = subtract$1;
+ proto$2.as = as;
+ proto$2.asMilliseconds = asMilliseconds;
+ proto$2.asSeconds = asSeconds;
+ proto$2.asMinutes = asMinutes;
+ proto$2.asHours = asHours;
+ proto$2.asDays = asDays;
+ proto$2.asWeeks = asWeeks;
+ proto$2.asMonths = asMonths;
+ proto$2.asYears = asYears;
+ proto$2.valueOf = valueOf$1;
+ proto$2._bubble = bubble;
+ proto$2.get = get$2;
+ proto$2.milliseconds = milliseconds;
+ proto$2.seconds = seconds;
+ proto$2.minutes = minutes;
+ proto$2.hours = hours;
+ proto$2.days = days;
+ proto$2.weeks = weeks;
+ proto$2.months = months;
+ proto$2.years = years;
+ proto$2.humanize = humanize;
+ proto$2.toISOString = toISOString$1;
+ proto$2.toString = toISOString$1;
+ proto$2.toJSON = toISOString$1;
+ proto$2.locale = locale;
+ proto$2.localeData = localeData;
+
+ // Deprecations
+ proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
+ proto$2.lang = lang;
+
+ // Side effect imports
+
+ // FORMATTING
+
+ addFormatToken('X', 0, 0, 'unix');
+ addFormatToken('x', 0, 0, 'valueOf');
+
+ // PARSING
+
+ addRegexToken('x', matchSigned);
+ addRegexToken('X', matchTimestamp);
+ addParseToken('X', function (input, array, config) {
+ config._d = new Date(parseFloat(input, 10) * 1000);
+ });
+ addParseToken('x', function (input, array, config) {
+ config._d = new Date(toInt(input));
+ });
+
+ // Side effect imports
+
+
+ hooks.version = '2.17.1';
+
+ setHookCallback(createLocal);
+
+ hooks.fn = proto;
+ hooks.min = min;
+ hooks.max = max;
+ hooks.now = now;
+ hooks.utc = createUTC;
+ hooks.unix = createUnix;
+ hooks.months = listMonths;
+ hooks.isDate = isDate;
+ hooks.locale = getSetGlobalLocale;
+ hooks.invalid = createInvalid;
+ hooks.duration = createDuration;
+ hooks.isMoment = isMoment;
+ hooks.weekdays = listWeekdays;
+ hooks.parseZone = createInZone;
+ hooks.localeData = getLocale;
+ hooks.isDuration = isDuration;
+ hooks.monthsShort = listMonthsShort;
+ hooks.weekdaysMin = listWeekdaysMin;
+ hooks.defineLocale = defineLocale;
+ hooks.updateLocale = updateLocale;
+ hooks.locales = listLocales;
+ hooks.weekdaysShort = listWeekdaysShort;
+ hooks.normalizeUnits = normalizeUnits;
+ hooks.relativeTimeRounding = getSetRelativeTimeRounding;
+ hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
+ hooks.calendarFormat = getCalendarFormat;
+ hooks.prototype = proto;
+
+ return hooks;
+
+ })));
+
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(86)(module)))
+
+/***/ },
+/* 86 */
+/***/ function(module, exports) {
+
+ module.exports = function(module) {
+ if(!module.webpackPolyfill) {
+ module.deprecate = function() {};
+ module.paths = [];
+ // module.parent = undefined by default
+ module.children = [];
+ module.webpackPolyfill = 1;
+ }
+ return module;
+ }
+
+
+/***/ },
+/* 87 */
+/***/ function(module, exports) {
+
+ function webpackContext(req) {
+ throw new Error("Cannot find module '" + req + "'.");
+ }
+ webpackContext.keys = function() { return []; };
+ webpackContext.resolve = webpackContext;
+ module.exports = webpackContext;
+ webpackContext.id = 87;
+
+
+/***/ },
+/* 88 */
+/***/ function(module, exports) {
+
+ /* WEBPACK VAR INJECTION */(function(global) {'use strict';
+
+ var _rng;
+
+ var globalVar = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : null;
+
+ if (globalVar && globalVar.crypto && crypto.getRandomValues) {
+ // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
+ // Moderately fast, high quality
+ var _rnds8 = new Uint8Array(16);
+ _rng = function whatwgRNG() {
+ crypto.getRandomValues(_rnds8);
+ return _rnds8;
+ };
+ }
+
+ if (!_rng) {
+ // Math.random()-based (RNG)
+ //
+ // If all else fails, use Math.random(). It's fast, but is of unspecified
+ // quality.
+ var _rnds = new Array(16);
+ _rng = function _rng() {
+ for (var i = 0, r; i < 16; i++) {
+ if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
+ _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
+ }
+
+ return _rnds;
+ };
+ }
+
+ // uuid.js
+ //
+ // Copyright (c) 2010-2012 Robert Kieffer
+ // MIT License - http://opensource.org/licenses/mit-license.php
+
+ // Unique ID creation requires a high quality random # generator. We feature
+ // detect to determine the best RNG source, normalizing to a function that
+ // returns 128-bits of randomness, since that's what's usually required
+
+ //var _rng = require('./rng');
+
+ // Maps for number <-> hex string conversion
+ var _byteToHex = [];
+ var _hexToByte = {};
+ for (var i = 0; i < 256; i++) {
+ _byteToHex[i] = (i + 0x100).toString(16).substr(1);
+ _hexToByte[_byteToHex[i]] = i;
+ }
+
+ // **`parse()` - Parse a UUID into it's component bytes**
+ function parse(s, buf, offset) {
+ var i = buf && offset || 0,
+ ii = 0;
+
+ buf = buf || [];
+ s.toLowerCase().replace(/[0-9a-f]{2}/g, function (oct) {
+ if (ii < 16) {
+ // Don't overflow!
+ buf[i + ii++] = _hexToByte[oct];
+ }
+ });
+
+ // Zero out remaining bytes if string was short
+ while (ii < 16) {
+ buf[i + ii++] = 0;
+ }
+
+ return buf;
+ }
+
+ // **`unparse()` - Convert UUID byte array (ala parse()) into a string**
+ function unparse(buf, offset) {
+ var i = offset || 0,
+ bth = _byteToHex;
+ return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]];
+ }
+
+ // **`v1()` - Generate time-based UUID**
+ //
+ // Inspired by https://github.com/LiosK/UUID.js
+ // and http://docs.python.org/library/uuid.html
+
+ // random #'s we need to init node and clockseq
+ var _seedBytes = _rng();
+
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
+ var _nodeId = [_seedBytes[0] | 0x01, _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]];
+
+ // Per 4.2.2, randomize (14 bit) clockseq
+ var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
+
+ // Previous uuid creation time
+ var _lastMSecs = 0,
+ _lastNSecs = 0;
+
+ // See https://github.com/broofa/node-uuid for API details
+ function v1(options, buf, offset) {
+ var i = buf && offset || 0;
+ var b = buf || [];
+
+ options = options || {};
+
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
+
+ // UUID timestamps are 100 nano-second units since the Gregorian epoch,
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
+
+ // Per 4.2.1.2, use count of uuid's generated during the current clock
+ // cycle to simulate higher resolution clock
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
+
+ // Time since last uuid creation (in msecs)
+ var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000;
+
+ // Per 4.2.1.2, Bump clockseq on clock regression
+ if (dt < 0 && options.clockseq === undefined) {
+ clockseq = clockseq + 1 & 0x3fff;
+ }
+
+ // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
+ // time interval
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
+ nsecs = 0;
+ }
+
+ // Per 4.2.1.2 Throw error if too many uuids are requested
+ if (nsecs >= 10000) {
+ throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
+ }
+
+ _lastMSecs = msecs;
+ _lastNSecs = nsecs;
+ _clockseq = clockseq;
+
+ // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
+ msecs += 12219292800000;
+
+ // `time_low`
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
+ b[i++] = tl >>> 24 & 0xff;
+ b[i++] = tl >>> 16 & 0xff;
+ b[i++] = tl >>> 8 & 0xff;
+ b[i++] = tl & 0xff;
+
+ // `time_mid`
+ var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
+ b[i++] = tmh >>> 8 & 0xff;
+ b[i++] = tmh & 0xff;
+
+ // `time_high_and_version`
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
+ b[i++] = tmh >>> 16 & 0xff;
+
+ // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
+ b[i++] = clockseq >>> 8 | 0x80;
+
+ // `clock_seq_low`
+ b[i++] = clockseq & 0xff;
+
+ // `node`
+ var node = options.node || _nodeId;
+ for (var n = 0; n < 6; n++) {
+ b[i + n] = node[n];
+ }
+
+ return buf ? buf : unparse(b);
+ }
+
+ // **`v4()` - Generate random UUID**
+
+ // See https://github.com/broofa/node-uuid for API details
+ function v4(options, buf, offset) {
+ // Deprecated - 'format' argument, as supported in v1.2
+ var i = buf && offset || 0;
+
+ if (typeof options == 'string') {
+ buf = options == 'binary' ? new Array(16) : null;
+ options = null;
+ }
+ options = options || {};
+
+ var rnds = options.random || (options.rng || _rng)();
+
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
+ rnds[6] = rnds[6] & 0x0f | 0x40;
+ rnds[8] = rnds[8] & 0x3f | 0x80;
+
+ // Copy bytes to buffer, if provided
+ if (buf) {
+ for (var ii = 0; ii < 16; ii++) {
+ buf[i + ii] = rnds[ii];
+ }
+ }
+
+ return buf || unparse(rnds);
+ }
+
+ // Export public API
+ var uuid = v4;
+ uuid.v1 = v1;
+ uuid.v4 = v4;
+ uuid.parse = parse;
+ uuid.unparse = unparse;
+
+ module.exports = uuid;
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
+
+/***/ },
+/* 89 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ // utils
+ exports.util = __webpack_require__(1);
+ exports.DOMutil = __webpack_require__(90);
+
+ // data
+ exports.DataSet = __webpack_require__(91);
+ exports.DataView = __webpack_require__(93);
+ exports.Queue = __webpack_require__(92);
+
+ // Graph3d
+ exports.Graph3d = __webpack_require__(94);
+ exports.graph3d = {
+ Camera: __webpack_require__(98),
+ Filter: __webpack_require__(103),
+ Point2d: __webpack_require__(97),
+ Point3d: __webpack_require__(96),
+ Slider: __webpack_require__(104),
+ StepNumber: __webpack_require__(105)
+ };
+
+ // bundled external libraries
+ exports.moment = __webpack_require__(84);
+ exports.Hammer = __webpack_require__(108);
+ exports.keycharm = __webpack_require__(111);
+
+/***/ },
+/* 90 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ // DOM utility methods
+
+ /**
+ * this prepares the JSON container for allocating SVG elements
+ * @param JSONcontainer
+ * @private
+ */
+ exports.prepareElements = function (JSONcontainer) {
+ // cleanup the redundant svgElements;
+ for (var elementType in JSONcontainer) {
+ if (JSONcontainer.hasOwnProperty(elementType)) {
+ JSONcontainer[elementType].redundant = JSONcontainer[elementType].used;
+ JSONcontainer[elementType].used = [];
+ }
+ }
+ };
+
+ /**
+ * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from
+ * which to remove the redundant elements.
+ *
+ * @param JSONcontainer
+ * @private
+ */
+ exports.cleanupElements = function (JSONcontainer) {
+ // cleanup the redundant svgElements;
+ for (var elementType in JSONcontainer) {
+ if (JSONcontainer.hasOwnProperty(elementType)) {
+ if (JSONcontainer[elementType].redundant) {
+ for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) {
+ JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]);
+ }
+ JSONcontainer[elementType].redundant = [];
+ }
+ }
+ }
+ };
+
+ /**
+ * Ensures that all elements are removed first up so they can be recreated cleanly
+ * @param JSONcontainer
+ */
+ exports.resetElements = function (JSONcontainer) {
+ exports.prepareElements(JSONcontainer);
+ exports.cleanupElements(JSONcontainer);
+ exports.prepareElements(JSONcontainer);
+ };
+
+ /**
+ * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
+ * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.
+ *
+ * @param elementType
+ * @param JSONcontainer
+ * @param svgContainer
+ * @returns {*}
+ * @private
+ */
+ exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) {
+ var element;
+ // allocate SVG element, if it doesnt yet exist, create one.
+ if (JSONcontainer.hasOwnProperty(elementType)) {
+ // this element has been created before
+ // check if there is an redundant element
+ if (JSONcontainer[elementType].redundant.length > 0) {
+ element = JSONcontainer[elementType].redundant[0];
+ JSONcontainer[elementType].redundant.shift();
+ } else {
+ // create a new element and add it to the SVG
+ element = document.createElementNS('http://www.w3.org/2000/svg', elementType);
+ svgContainer.appendChild(element);
+ }
+ } else {
+ // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it.
+ element = document.createElementNS('http://www.w3.org/2000/svg', elementType);
+ JSONcontainer[elementType] = { used: [], redundant: [] };
+ svgContainer.appendChild(element);
+ }
+ JSONcontainer[elementType].used.push(element);
+ return element;
+ };
+
+ /**
+ * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
+ * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.
+ *
+ * @param elementType
+ * @param JSONcontainer
+ * @param DOMContainer
+ * @returns {*}
+ * @private
+ */
+ exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, insertBefore) {
+ var element;
+ // allocate DOM element, if it doesnt yet exist, create one.
+ if (JSONcontainer.hasOwnProperty(elementType)) {
+ // this element has been created before
+ // check if there is an redundant element
+ if (JSONcontainer[elementType].redundant.length > 0) {
+ element = JSONcontainer[elementType].redundant[0];
+ JSONcontainer[elementType].redundant.shift();
+ } else {
+ // create a new element and add it to the SVG
+ element = document.createElement(elementType);
+ if (insertBefore !== undefined) {
+ DOMContainer.insertBefore(element, insertBefore);
+ } else {
+ DOMContainer.appendChild(element);
+ }
+ }
+ } else {
+ // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it.
+ element = document.createElement(elementType);
+ JSONcontainer[elementType] = { used: [], redundant: [] };
+ if (insertBefore !== undefined) {
+ DOMContainer.insertBefore(element, insertBefore);
+ } else {
+ DOMContainer.appendChild(element);
+ }
+ }
+ JSONcontainer[elementType].used.push(element);
+ return element;
+ };
+
+ /**
+ * Draw a point object. This is a separate function because it can also be called by the legend.
+ * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions
+ * as well.
+ *
+ * @param x
+ * @param y
+ * @param groupTemplate: A template containing the necessary information to draw the datapoint e.g., {style: 'circle', size: 5, className: 'className' }
+ * @param JSONcontainer
+ * @param svgContainer
+ * @param labelObj
+ * @returns {*}
+ */
+ exports.drawPoint = function (x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) {
+ var point;
+ if (groupTemplate.style == 'circle') {
+ point = exports.getSVGElement('circle', JSONcontainer, svgContainer);
+ point.setAttributeNS(null, "cx", x);
+ point.setAttributeNS(null, "cy", y);
+ point.setAttributeNS(null, "r", 0.5 * groupTemplate.size);
+ } else {
+ point = exports.getSVGElement('rect', JSONcontainer, svgContainer);
+ point.setAttributeNS(null, "x", x - 0.5 * groupTemplate.size);
+ point.setAttributeNS(null, "y", y - 0.5 * groupTemplate.size);
+ point.setAttributeNS(null, "width", groupTemplate.size);
+ point.setAttributeNS(null, "height", groupTemplate.size);
+ }
+
+ if (groupTemplate.styles !== undefined) {
+ point.setAttributeNS(null, "style", groupTemplate.styles);
+ }
+ point.setAttributeNS(null, "class", groupTemplate.className + " vis-point");
+ //handle label
+
+
+ if (labelObj) {
+ var label = exports.getSVGElement('text', JSONcontainer, svgContainer);
+ if (labelObj.xOffset) {
+ x = x + labelObj.xOffset;
+ }
+
+ if (labelObj.yOffset) {
+ y = y + labelObj.yOffset;
+ }
+ if (labelObj.content) {
+ label.textContent = labelObj.content;
+ }
+
+ if (labelObj.className) {
+ label.setAttributeNS(null, "class", labelObj.className + " vis-label");
+ }
+ label.setAttributeNS(null, "x", x);
+ label.setAttributeNS(null, "y", y);
+ }
+
+ return point;
+ };
+
+ /**
+ * draw a bar SVG element centered on the X coordinate
+ *
+ * @param x
+ * @param y
+ * @param className
+ */
+ exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer, style) {
+ if (height != 0) {
+ if (height < 0) {
+ height *= -1;
+ y -= height;
+ }
+ var rect = exports.getSVGElement('rect', JSONcontainer, svgContainer);
+ rect.setAttributeNS(null, "x", x - 0.5 * width);
+ rect.setAttributeNS(null, "y", y);
+ rect.setAttributeNS(null, "width", width);
+ rect.setAttributeNS(null, "height", height);
+ rect.setAttributeNS(null, "class", className);
+ if (style) {
+ rect.setAttributeNS(null, "style", style);
+ }
+ }
+ };
+
+/***/ },
+/* 91 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var Queue = __webpack_require__(92);
+
+ /**
+ * DataSet
+ *
+ * Usage:
+ * var dataSet = new DataSet({
+ * fieldId: '_id',
+ * type: {
+ * // ...
+ * }
+ * });
+ *
+ * dataSet.add(item);
+ * dataSet.add(data);
+ * dataSet.update(item);
+ * dataSet.update(data);
+ * dataSet.remove(id);
+ * dataSet.remove(ids);
+ * var data = dataSet.get();
+ * var data = dataSet.get(id);
+ * var data = dataSet.get(ids);
+ * var data = dataSet.get(ids, options, data);
+ * dataSet.clear();
+ *
+ * A data set can:
+ * - add/remove/update data
+ * - gives triggers upon changes in the data
+ * - can import/export data in various data formats
+ *
+ * @param {Array} [data] Optional array with initial data
+ * @param {Object} [options] Available options:
+ * {String} fieldId Field name of the id in the
+ * items, 'id' by default.
+ * {Object.<String, String} type
+ * A map with field names as key,
+ * and the field type as value.
+ * {Object} queue Queue changes to the DataSet,
+ * flush them all at once.
+ * Queue options:
+ * - {number} delay Delay in ms, null by default
+ * - {number} max Maximum number of entries in the queue, Infinity by default
+ * @constructor DataSet
+ */
+ // TODO: add a DataSet constructor DataSet(data, options)
+ function DataSet(data, options) {
+ // correctly read optional arguments
+ if (data && !Array.isArray(data)) {
+ options = data;
+ data = null;
+ }
+
+ this._options = options || {};
+ this._data = {}; // map with data indexed by id
+ this.length = 0; // number of items in the DataSet
+ this._fieldId = this._options.fieldId || 'id'; // name of the field containing id
+ this._type = {}; // internal field types (NOTE: this can differ from this._options.type)
+
+ // all variants of a Date are internally stored as Date, so we can convert
+ // from everything to everything (also from ISODate to Number for example)
+ if (this._options.type) {
+ var fields = (0, _keys2['default'])(this._options.type);
+ for (var i = 0, len = fields.length; i < len; i++) {
+ var field = fields[i];
+ var value = this._options.type[field];
+ if (value == 'Date' || value == 'ISODate' || value == 'ASPDate') {
+ this._type[field] = 'Date';
+ } else {
+ this._type[field] = value;
+ }
+ }
+ }
+
+ // TODO: deprecated since version 1.1.1 (or 2.0.0?)
+ if (this._options.convert) {
+ throw new Error('Option "convert" is deprecated. Use "type" instead.');
+ }
+
+ this._subscribers = {}; // event subscribers
+
+ // add initial data when provided
+ if (data) {
+ this.add(data);
+ }
+
+ this.setOptions(options);
+ }
+
+ /**
+ * @param {Object} [options] Available options:
+ * {Object} queue Queue changes to the DataSet,
+ * flush them all at once.
+ * Queue options:
+ * - {number} delay Delay in ms, null by default
+ * - {number} max Maximum number of entries in the queue, Infinity by default
+ * @param options
+ */
+ DataSet.prototype.setOptions = function (options) {
+ if (options && options.queue !== undefined) {
+ if (options.queue === false) {
+ // delete queue if loaded
+ if (this._queue) {
+ this._queue.destroy();
+ delete this._queue;
+ }
+ } else {
+ // create queue and update its options
+ if (!this._queue) {
+ this._queue = Queue.extend(this, {
+ replace: ['add', 'update', 'remove']
+ });
+ }
+
+ if ((0, _typeof3['default'])(options.queue) === 'object') {
+ this._queue.setOptions(options.queue);
+ }
+ }
+ }
+ };
+
+ /**
+ * Subscribe to an event, add an event listener
+ * @param {String} event Event name. Available events: 'put', 'update',
+ * 'remove'
+ * @param {function} callback Callback method. Called with three parameters:
+ * {String} event
+ * {Object | null} params
+ * {String | Number} senderId
+ */
+ DataSet.prototype.on = function (event, callback) {
+ var subscribers = this._subscribers[event];
+ if (!subscribers) {
+ subscribers = [];
+ this._subscribers[event] = subscribers;
+ }
+
+ subscribers.push({
+ callback: callback
+ });
+ };
+
+ // TODO: remove this deprecated function some day (replaced with `on` since version 0.5, deprecated since v4.0)
+ DataSet.prototype.subscribe = function () {
+ throw new Error('DataSet.subscribe is deprecated. Use DataSet.on instead.');
+ };
+
+ /**
+ * Unsubscribe from an event, remove an event listener
+ * @param {String} event
+ * @param {function} callback
+ */
+ DataSet.prototype.off = function (event, callback) {
+ var subscribers = this._subscribers[event];
+ if (subscribers) {
+ this._subscribers[event] = subscribers.filter(function (listener) {
+ return listener.callback != callback;
+ });
+ }
+ };
+
+ // TODO: remove this deprecated function some day (replaced with `on` since version 0.5, deprecated since v4.0)
+ DataSet.prototype.unsubscribe = function () {
+ throw new Error('DataSet.unsubscribe is deprecated. Use DataSet.off instead.');
+ };
+
+ /**
+ * Trigger an event
+ * @param {String} event
+ * @param {Object | null} params
+ * @param {String} [senderId] Optional id of the sender.
+ * @private
+ */
+ DataSet.prototype._trigger = function (event, params, senderId) {
+ if (event == '*') {
+ throw new Error('Cannot trigger event *');
+ }
+
+ var subscribers = [];
+ if (event in this._subscribers) {
+ subscribers = subscribers.concat(this._subscribers[event]);
+ }
+ if ('*' in this._subscribers) {
+ subscribers = subscribers.concat(this._subscribers['*']);
+ }
+
+ for (var i = 0, len = subscribers.length; i < len; i++) {
+ var subscriber = subscribers[i];
+ if (subscriber.callback) {
+ subscriber.callback(event, params, senderId || null);
+ }
+ }
+ };
+
+ /**
+ * Add data.
+ * Adding an item will fail when there already is an item with the same id.
+ * @param {Object | Array} data
+ * @param {String} [senderId] Optional sender id
+ * @return {Array} addedIds Array with the ids of the added items
+ */
+ DataSet.prototype.add = function (data, senderId) {
+ var addedIds = [],
+ id,
+ me = this;
+
+ if (Array.isArray(data)) {
+ // Array
+ for (var i = 0, len = data.length; i < len; i++) {
+ id = me._addItem(data[i]);
+ addedIds.push(id);
+ }
+ } else if (data instanceof Object) {
+ // Single item
+ id = me._addItem(data);
+ addedIds.push(id);
+ } else {
+ throw new Error('Unknown dataType');
+ }
+
+ if (addedIds.length) {
+ this._trigger('add', { items: addedIds }, senderId);
+ }
+
+ return addedIds;
+ };
+
+ /**
+ * Update existing items. When an item does not exist, it will be created
+ * @param {Object | Array} data
+ * @param {String} [senderId] Optional sender id
+ * @return {Array} updatedIds The ids of the added or updated items
+ */
+ DataSet.prototype.update = function (data, senderId) {
+ var addedIds = [];
+ var updatedIds = [];
+ var oldData = [];
+ var updatedData = [];
+ var me = this;
+ var fieldId = me._fieldId;
+
+ var addOrUpdate = function addOrUpdate(item) {
+ var id = item[fieldId];
+ if (me._data[id]) {
+ var oldItem = util.extend({}, me._data[id]);
+ // update item
+ id = me._updateItem(item);
+ updatedIds.push(id);
+ updatedData.push(item);
+ oldData.push(oldItem);
+ } else {
+ // add new item
+ id = me._addItem(item);
+ addedIds.push(id);
+ }
+ };
+
+ if (Array.isArray(data)) {
+ // Array
+ for (var i = 0, len = data.length; i < len; i++) {
+ if (data[i] instanceof Object) {
+ addOrUpdate(data[i]);
+ } else {
+ console.warn('Ignoring input item, which is not an object at index ' + i);
+ }
+ }
+ } else if (data instanceof Object) {
+ // Single item
+ addOrUpdate(data);
+ } else {
+ throw new Error('Unknown dataType');
+ }
+
+ if (addedIds.length) {
+ this._trigger('add', { items: addedIds }, senderId);
+ }
+ if (updatedIds.length) {
+ var props = { items: updatedIds, oldData: oldData, data: updatedData };
+ // TODO: remove deprecated property 'data' some day
+ //Object.defineProperty(props, 'data', {
+ // 'get': (function() {
+ // console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');
+ // return updatedData;
+ // }).bind(this)
+ //});
+ this._trigger('update', props, senderId);
+ }
+
+ return addedIds.concat(updatedIds);
+ };
+
+ /**
+ * Get a data item or multiple items.
+ *
+ * Usage:
+ *
+ * get()
+ * get(options: Object)
+ *
+ * get(id: Number | String)
+ * get(id: Number | String, options: Object)
+ *
+ * get(ids: Number[] | String[])
+ * get(ids: Number[] | String[], options: Object)
+ *
+ * Where:
+ *
+ * {Number | String} id The id of an item
+ * {Number[] | String{}} ids An array with ids of items
+ * {Object} options An Object with options. Available options:
+ * {String} [returnType] Type of data to be returned.
+ * Can be 'Array' (default) or 'Object'.
+ * {Object.<String, String>} [type]
+ * {String[]} [fields] field names to be returned
+ * {function} [filter] filter items
+ * {String | function} [order] Order the items by a field name or custom sort function.
+ * @throws Error
+ */
+ DataSet.prototype.get = function (args) {
+ var me = this;
+
+ // parse the arguments
+ var id, ids, options;
+ var firstType = util.getType(arguments[0]);
+ if (firstType == 'String' || firstType == 'Number') {
+ // get(id [, options])
+ id = arguments[0];
+ options = arguments[1];
+ } else if (firstType == 'Array') {
+ // get(ids [, options])
+ ids = arguments[0];
+ options = arguments[1];
+ } else {
+ // get([, options])
+ options = arguments[0];
+ }
+
+ // determine the return type
+ var returnType;
+ if (options && options.returnType) {
+ var allowedValues = ['Array', 'Object'];
+ returnType = allowedValues.indexOf(options.returnType) == -1 ? 'Array' : options.returnType;
+ } else {
+ returnType = 'Array';
+ }
+
+ // build options
+ var type = options && options.type || this._options.type;
+ var filter = options && options.filter;
+ var items = [],
+ item,
+ itemIds,
+ itemId,
+ i,
+ len;
+
+ // convert items
+ if (id != undefined) {
+ // return a single item
+ item = me._getItem(id, type);
+ if (item && filter && !filter(item)) {
+ item = null;
+ }
+ } else if (ids != undefined) {
+ // return a subset of items
+ for (i = 0, len = ids.length; i < len; i++) {
+ item = me._getItem(ids[i], type);
+ if (!filter || filter(item)) {
+ items.push(item);
+ }
+ }
+ } else {
+ // return all items
+ itemIds = (0, _keys2['default'])(this._data);
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ itemId = itemIds[i];
+ item = me._getItem(itemId, type);
+ if (!filter || filter(item)) {
+ items.push(item);
+ }
+ }
+ }
+
+ // order the results
+ if (options && options.order && id == undefined) {
+ this._sort(items, options.order);
+ }
+
+ // filter fields of the items
+ if (options && options.fields) {
+ var fields = options.fields;
+ if (id != undefined) {
+ item = this._filterFields(item, fields);
+ } else {
+ for (i = 0, len = items.length; i < len; i++) {
+ items[i] = this._filterFields(items[i], fields);
+ }
+ }
+ }
+
+ // return the results
+ if (returnType == 'Object') {
+ var result = {},
+ resultant;
+ for (i = 0, len = items.length; i < len; i++) {
+ resultant = items[i];
+ result[resultant.id] = resultant;
+ }
+ return result;
+ } else {
+ if (id != undefined) {
+ // a single item
+ return item;
+ } else {
+ // just return our array
+ return items;
+ }
+ }
+ };
+
+ /**
+ * Get ids of all items or from a filtered set of items.
+ * @param {Object} [options] An Object with options. Available options:
+ * {function} [filter] filter items
+ * {String | function} [order] Order the items by
+ * a field name or custom sort function.
+ * @return {Array} ids
+ */
+ DataSet.prototype.getIds = function (options) {
+ var data = this._data,
+ filter = options && options.filter,
+ order = options && options.order,
+ type = options && options.type || this._options.type,
+ itemIds = (0, _keys2['default'])(data),
+ i,
+ len,
+ id,
+ item,
+ items,
+ ids = [];
+
+ if (filter) {
+ // get filtered items
+ if (order) {
+ // create ordered list
+ items = [];
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ id = itemIds[i];
+ item = this._getItem(id, type);
+ if (filter(item)) {
+ items.push(item);
+ }
+ }
+
+ this._sort(items, order);
+
+ for (i = 0, len = items.length; i < len; i++) {
+ ids.push(items[i][this._fieldId]);
+ }
+ } else {
+ // create unordered list
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ id = itemIds[i];
+ item = this._getItem(id, type);
+ if (filter(item)) {
+ ids.push(item[this._fieldId]);
+ }
+ }
+ }
+ } else {
+ // get all items
+ if (order) {
+ // create an ordered list
+ items = [];
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ id = itemIds[i];
+ items.push(data[id]);
+ }
+
+ this._sort(items, order);
+
+ for (i = 0, len = items.length; i < len; i++) {
+ ids.push(items[i][this._fieldId]);
+ }
+ } else {
+ // create unordered list
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ id = itemIds[i];
+ item = data[id];
+ ids.push(item[this._fieldId]);
+ }
+ }
+ }
+
+ return ids;
+ };
+
+ /**
+ * Returns the DataSet itself. Is overwritten for example by the DataView,
+ * which returns the DataSet it is connected to instead.
+ */
+ DataSet.prototype.getDataSet = function () {
+ return this;
+ };
+
+ /**
+ * Execute a callback function for every item in the dataset.
+ * @param {function} callback
+ * @param {Object} [options] Available options:
+ * {Object.<String, String>} [type]
+ * {String[]} [fields] filter fields
+ * {function} [filter] filter items
+ * {String | function} [order] Order the items by
+ * a field name or custom sort function.
+ */
+ DataSet.prototype.forEach = function (callback, options) {
+ var filter = options && options.filter,
+ type = options && options.type || this._options.type,
+ data = this._data,
+ itemIds = (0, _keys2['default'])(data),
+ i,
+ len,
+ item,
+ id;
+
+ if (options && options.order) {
+ // execute forEach on ordered list
+ var items = this.get(options);
+
+ for (i = 0, len = items.length; i < len; i++) {
+ item = items[i];
+ id = item[this._fieldId];
+ callback(item, id);
+ }
+ } else {
+ // unordered
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ id = itemIds[i];
+ item = this._getItem(id, type);
+ if (!filter || filter(item)) {
+ callback(item, id);
+ }
+ }
+ }
+ };
+
+ /**
+ * Map every item in the dataset.
+ * @param {function} callback
+ * @param {Object} [options] Available options:
+ * {Object.<String, String>} [type]
+ * {String[]} [fields] filter fields
+ * {function} [filter] filter items
+ * {String | function} [order] Order the items by
+ * a field name or custom sort function.
+ * @return {Object[]} mappedItems
+ */
+ DataSet.prototype.map = function (callback, options) {
+ var filter = options && options.filter,
+ type = options && options.type || this._options.type,
+ mappedItems = [],
+ data = this._data,
+ itemIds = (0, _keys2['default'])(data),
+ i,
+ len,
+ id,
+ item;
+
+ // convert and filter items
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ id = itemIds[i];
+ item = this._getItem(id, type);
+ if (!filter || filter(item)) {
+ mappedItems.push(callback(item, id));
+ }
+ }
+
+ // order items
+ if (options && options.order) {
+ this._sort(mappedItems, options.order);
+ }
+
+ return mappedItems;
+ };
+
+ /**
+ * Filter the fields of an item
+ * @param {Object | null} item
+ * @param {String[]} fields Field names
+ * @return {Object | null} filteredItem or null if no item is provided
+ * @private
+ */
+ DataSet.prototype._filterFields = function (item, fields) {
+ if (!item) {
+ // item is null
+ return item;
+ }
+
+ var filteredItem = {},
+ itemFields = (0, _keys2['default'])(item),
+ len = itemFields.length,
+ i,
+ field;
+
+ if (Array.isArray(fields)) {
+ for (i = 0; i < len; i++) {
+ field = itemFields[i];
+ if (fields.indexOf(field) != -1) {
+ filteredItem[field] = item[field];
+ }
+ }
+ } else {
+ for (i = 0; i < len; i++) {
+ field = itemFields[i];
+ if (fields.hasOwnProperty(field)) {
+ filteredItem[fields[field]] = item[field];
+ }
+ }
+ }
+
+ return filteredItem;
+ };
+
+ /**
+ * Sort the provided array with items
+ * @param {Object[]} items
+ * @param {String | function} order A field name or custom sort function.
+ * @private
+ */
+ DataSet.prototype._sort = function (items, order) {
+ if (util.isString(order)) {
+ // order by provided field name
+ var name = order; // field name
+ items.sort(function (a, b) {
+ var av = a[name];
+ var bv = b[name];
+ return av > bv ? 1 : av < bv ? -1 : 0;
+ });
+ } else if (typeof order === 'function') {
+ // order by sort function
+ items.sort(order);
+ }
+ // TODO: extend order by an Object {field:String, direction:String}
+ // where direction can be 'asc' or 'desc'
+ else {
+ throw new TypeError('Order must be a function or a string');
+ }
+ };
+
+ /**
+ * Remove an object by pointer or by id
+ * @param {String | Number | Object | Array} id Object or id, or an array with
+ * objects or ids to be removed
+ * @param {String} [senderId] Optional sender id
+ * @return {Array} removedIds
+ */
+ DataSet.prototype.remove = function (id, senderId) {
+ var removedIds = [],
+ removedItems = [],
+ ids = [],
+ i,
+ len,
+ itemId,
+ item;
+
+ // force everything to be an array for simplicity
+ ids = Array.isArray(id) ? id : [id];
+
+ for (i = 0, len = ids.length; i < len; i++) {
+ item = this._remove(ids[i]);
+ if (item) {
+ itemId = item[this._fieldId];
+ if (itemId != undefined) {
+ removedIds.push(itemId);
+ removedItems.push(item);
+ }
+ }
+ }
+
+ if (removedIds.length) {
+ this._trigger('remove', { items: removedIds, oldData: removedItems }, senderId);
+ }
+
+ return removedIds;
+ };
+
+ /**
+ * Remove an item by its id
+ * @param {Number | String | Object} id id or item
+ * @returns {Number | String | null} id
+ * @private
+ */
+ DataSet.prototype._remove = function (id) {
+ var item, ident;
+
+ // confirm the id to use based on the args type
+ if (util.isNumber(id) || util.isString(id)) {
+ ident = id;
+ } else if (id instanceof Object) {
+ ident = id[this._fieldId]; // look for the identifier field using _fieldId
+ }
+
+ // do the remove if the item is found
+ if (ident !== undefined && this._data[ident]) {
+ item = this._data[ident];
+ delete this._data[ident];
+ this.length--;
+ return item;
+ }
+ return null;
+ };
+
+ /**
+ * Clear the data
+ * @param {String} [senderId] Optional sender id
+ * @return {Array} removedIds The ids of all removed items
+ */
+ DataSet.prototype.clear = function (senderId) {
+ var i, len;
+ var ids = (0, _keys2['default'])(this._data);
+ var items = [];
+
+ for (i = 0, len = ids.length; i < len; i++) {
+ items.push(this._data[ids[i]]);
+ }
+
+ this._data = {};
+ this.length = 0;
+
+ this._trigger('remove', { items: ids, oldData: items }, senderId);
+
+ return ids;
+ };
+
+ /**
+ * Find the item with maximum value of a specified field
+ * @param {String} field
+ * @return {Object | null} item Item containing max value, or null if no items
+ */
+ DataSet.prototype.max = function (field) {
+ var data = this._data,
+ itemIds = (0, _keys2['default'])(data),
+ max = null,
+ maxField = null,
+ i,
+ len;
+
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ var id = itemIds[i];
+ var item = data[id];
+ var itemField = item[field];
+ if (itemField != null && (!max || itemField > maxField)) {
+ max = item;
+ maxField = itemField;
+ }
+ }
+
+ return max;
+ };
+
+ /**
+ * Find the item with minimum value of a specified field
+ * @param {String} field
+ * @return {Object | null} item Item containing max value, or null if no items
+ */
+ DataSet.prototype.min = function (field) {
+ var data = this._data,
+ itemIds = (0, _keys2['default'])(data),
+ min = null,
+ minField = null,
+ i,
+ len;
+
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ var id = itemIds[i];
+ var item = data[id];
+ var itemField = item[field];
+ if (itemField != null && (!min || itemField < minField)) {
+ min = item;
+ minField = itemField;
+ }
+ }
+
+ return min;
+ };
+
+ /**
+ * Find all distinct values of a specified field
+ * @param {String} field
+ * @return {Array} values Array containing all distinct values. If data items
+ * do not contain the specified field are ignored.
+ * The returned array is unordered.
+ */
+ DataSet.prototype.distinct = function (field) {
+ var data = this._data;
+ var itemIds = (0, _keys2['default'])(data);
+ var values = [];
+ var fieldType = this._options.type && this._options.type[field] || null;
+ var count = 0;
+ var i, j, len;
+
+ for (i = 0, len = itemIds.length; i < len; i++) {
+ var id = itemIds[i];
+ var item = data[id];
+ var value = item[field];
+ var exists = false;
+ for (j = 0; j < count; j++) {
+ if (values[j] == value) {
+ exists = true;
+ break;
+ }
+ }
+ if (!exists && value !== undefined) {
+ values[count] = value;
+ count++;
+ }
+ }
+
+ if (fieldType) {
+ for (i = 0, len = values.length; i < len; i++) {
+ values[i] = util.convert(values[i], fieldType);
+ }
+ }
+
+ return values;
+ };
+
+ /**
+ * Add a single item. Will fail when an item with the same id already exists.
+ * @param {Object} item
+ * @return {String} id
+ * @private
+ */
+ DataSet.prototype._addItem = function (item) {
+ var id = item[this._fieldId];
+
+ if (id != undefined) {
+ // check whether this id is already taken
+ if (this._data[id]) {
+ // item already exists
+ throw new Error('Cannot add item: item with id ' + id + ' already exists');
+ }
+ } else {
+ // generate an id
+ id = util.randomUUID();
+ item[this._fieldId] = id;
+ }
+
+ var d = {},
+ fields = (0, _keys2['default'])(item),
+ i,
+ len;
+ for (i = 0, len = fields.length; i < len; i++) {
+ var field = fields[i];
+ var fieldType = this._type[field]; // type may be undefined
+ d[field] = util.convert(item[field], fieldType);
+ }
+ this._data[id] = d;
+ this.length++;
+
+ return id;
+ };
+
+ /**
+ * Get an item. Fields can be converted to a specific type
+ * @param {String} id
+ * @param {Object.<String, String>} [types] field types to convert
+ * @return {Object | null} item
+ * @private
+ */
+ DataSet.prototype._getItem = function (id, types) {
+ var field, value, i, len;
+
+ // get the item from the dataset
+ var raw = this._data[id];
+ if (!raw) {
+ return null;
+ }
+
+ // convert the items field types
+ var converted = {},
+ fields = (0, _keys2['default'])(raw);
+
+ if (types) {
+ for (i = 0, len = fields.length; i < len; i++) {
+ field = fields[i];
+ value = raw[field];
+ converted[field] = util.convert(value, types[field]);
+ }
+ } else {
+ // no field types specified, no converting needed
+ for (i = 0, len = fields.length; i < len; i++) {
+ field = fields[i];
+ value = raw[field];
+ converted[field] = value;
+ }
+ }
+
+ if (!converted[this._fieldId]) {
+ converted[this._fieldId] = raw.id;
+ }
+
+ return converted;
+ };
+
+ /**
+ * Update a single item: merge with existing item.
+ * Will fail when the item has no id, or when there does not exist an item
+ * with the same id.
+ * @param {Object} item
+ * @return {String} id
+ * @private
+ */
+ DataSet.prototype._updateItem = function (item) {
+ var id = item[this._fieldId];
+ if (id == undefined) {
+ throw new Error('Cannot update item: item has no id (item: ' + (0, _stringify2['default'])(item) + ')');
+ }
+ var d = this._data[id];
+ if (!d) {
+ // item doesn't exist
+ throw new Error('Cannot update item: no item with id ' + id + ' found');
+ }
+
+ // merge with current item
+ var fields = (0, _keys2['default'])(item);
+ for (var i = 0, len = fields.length; i < len; i++) {
+ var field = fields[i];
+ var fieldType = this._type[field]; // type may be undefined
+ d[field] = util.convert(item[field], fieldType);
+ }
+
+ return id;
+ };
+
+ module.exports = DataSet;
+
+/***/ },
+/* 92 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * A queue
+ * @param {Object} options
+ * Available options:
+ * - delay: number When provided, the queue will be flushed
+ * automatically after an inactivity of this delay
+ * in milliseconds.
+ * Default value is null.
+ * - max: number When the queue exceeds the given maximum number
+ * of entries, the queue is flushed automatically.
+ * Default value of max is Infinity.
+ * @constructor
+ */
+ function Queue(options) {
+ // options
+ this.delay = null;
+ this.max = Infinity;
+
+ // properties
+ this._queue = [];
+ this._timeout = null;
+ this._extended = null;
+
+ this.setOptions(options);
+ }
+
+ /**
+ * Update the configuration of the queue
+ * @param {Object} options
+ * Available options:
+ * - delay: number When provided, the queue will be flushed
+ * automatically after an inactivity of this delay
+ * in milliseconds.
+ * Default value is null.
+ * - max: number When the queue exceeds the given maximum number
+ * of entries, the queue is flushed automatically.
+ * Default value of max is Infinity.
+ * @param options
+ */
+ Queue.prototype.setOptions = function (options) {
+ if (options && typeof options.delay !== 'undefined') {
+ this.delay = options.delay;
+ }
+ if (options && typeof options.max !== 'undefined') {
+ this.max = options.max;
+ }
+
+ this._flushIfNeeded();
+ };
+
+ /**
+ * Extend an object with queuing functionality.
+ * The object will be extended with a function flush, and the methods provided
+ * in options.replace will be replaced with queued ones.
+ * @param {Object} object
+ * @param {Object} options
+ * Available options:
+ * - replace: Array.<string>
+ * A list with method names of the methods
+ * on the object to be replaced with queued ones.
+ * - delay: number When provided, the queue will be flushed
+ * automatically after an inactivity of this delay
+ * in milliseconds.
+ * Default value is null.
+ * - max: number When the queue exceeds the given maximum number
+ * of entries, the queue is flushed automatically.
+ * Default value of max is Infinity.
+ * @return {Queue} Returns the created queue
+ */
+ Queue.extend = function (object, options) {
+ var queue = new Queue(options);
+
+ if (object.flush !== undefined) {
+ throw new Error('Target object already has a property flush');
+ }
+ object.flush = function () {
+ queue.flush();
+ };
+
+ var methods = [{
+ name: 'flush',
+ original: undefined
+ }];
+
+ if (options && options.replace) {
+ for (var i = 0; i < options.replace.length; i++) {
+ var name = options.replace[i];
+ methods.push({
+ name: name,
+ original: object[name]
+ });
+ queue.replace(object, name);
+ }
+ }
+
+ queue._extended = {
+ object: object,
+ methods: methods
+ };
+
+ return queue;
+ };
+
+ /**
+ * Destroy the queue. The queue will first flush all queued actions, and in
+ * case it has extended an object, will restore the original object.
+ */
+ Queue.prototype.destroy = function () {
+ this.flush();
+
+ if (this._extended) {
+ var object = this._extended.object;
+ var methods = this._extended.methods;
+ for (var i = 0; i < methods.length; i++) {
+ var method = methods[i];
+ if (method.original) {
+ object[method.name] = method.original;
+ } else {
+ delete object[method.name];
+ }
+ }
+ this._extended = null;
+ }
+ };
+
+ /**
+ * Replace a method on an object with a queued version
+ * @param {Object} object Object having the method
+ * @param {string} method The method name
+ */
+ Queue.prototype.replace = function (object, method) {
+ var me = this;
+ var original = object[method];
+ if (!original) {
+ throw new Error('Method ' + method + ' undefined');
+ }
+
+ object[method] = function () {
+ // create an Array with the arguments
+ var args = [];
+ for (var i = 0; i < arguments.length; i++) {
+ args[i] = arguments[i];
+ }
+
+ // add this call to the queue
+ me.queue({
+ args: args,
+ fn: original,
+ context: this
+ });
+ };
+ };
+
+ /**
+ * Queue a call
+ * @param {function | {fn: function, args: Array} | {fn: function, args: Array, context: Object}} entry
+ */
+ Queue.prototype.queue = function (entry) {
+ if (typeof entry === 'function') {
+ this._queue.push({ fn: entry });
+ } else {
+ this._queue.push(entry);
+ }
+
+ this._flushIfNeeded();
+ };
+
+ /**
+ * Check whether the queue needs to be flushed
+ * @private
+ */
+ Queue.prototype._flushIfNeeded = function () {
+ // flush when the maximum is exceeded.
+ if (this._queue.length > this.max) {
+ this.flush();
+ }
+
+ // flush after a period of inactivity when a delay is configured
+ clearTimeout(this._timeout);
+ if (this.queue.length > 0 && typeof this.delay === 'number') {
+ var me = this;
+ this._timeout = setTimeout(function () {
+ me.flush();
+ }, this.delay);
+ }
+ };
+
+ /**
+ * Flush all queued calls
+ */
+ Queue.prototype.flush = function () {
+ while (this._queue.length > 0) {
+ var entry = this._queue.shift();
+ entry.fn.apply(entry.context || entry.fn, entry.args || []);
+ }
+ };
+
+ module.exports = Queue;
+
+/***/ },
+/* 93 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var DataSet = __webpack_require__(91);
+
+ /**
+ * DataView
+ *
+ * a dataview offers a filtered view on a dataset or an other dataview.
+ *
+ * @param {DataSet | DataView} data
+ * @param {Object} [options] Available options: see method get
+ *
+ * @constructor DataView
+ */
+ function DataView(data, options) {
+ this._data = null;
+ this._ids = {}; // ids of the items currently in memory (just contains a boolean true)
+ this.length = 0; // number of items in the DataView
+ this._options = options || {};
+ this._fieldId = 'id'; // name of the field containing id
+ this._subscribers = {}; // event subscribers
+
+ var me = this;
+ this.listener = function () {
+ me._onEvent.apply(me, arguments);
+ };
+
+ this.setData(data);
+ }
+
+ // TODO: implement a function .config() to dynamically update things like configured filter
+ // and trigger changes accordingly
+
+ /**
+ * Set a data source for the view
+ * @param {DataSet | DataView} data
+ */
+ DataView.prototype.setData = function (data) {
+ var ids, id, i, len, items;
+
+ if (this._data) {
+ // unsubscribe from current dataset
+ if (this._data.off) {
+ this._data.off('*', this.listener);
+ }
+
+ // trigger a remove of all items in memory
+ ids = this._data.getIds({ filter: this._options && this._options.filter });
+ items = [];
+
+ for (i = 0, len = ids.length; i < len; i++) {
+ items.push(this._data._data[ids[i]]);
+ }
+
+ this._ids = {};
+ this.length = 0;
+ this._trigger('remove', { items: ids, oldData: items });
+ }
+
+ this._data = data;
+
+ if (this._data) {
+ // update fieldId
+ this._fieldId = this._options.fieldId || this._data && this._data.options && this._data.options.fieldId || 'id';
+
+ // trigger an add of all added items
+ ids = this._data.getIds({ filter: this._options && this._options.filter });
+ for (i = 0, len = ids.length; i < len; i++) {
+ id = ids[i];
+ this._ids[id] = true;
+ }
+ this.length = ids.length;
+ this._trigger('add', { items: ids });
+
+ // subscribe to new dataset
+ if (this._data.on) {
+ this._data.on('*', this.listener);
+ }
+ }
+ };
+
+ /**
+ * Refresh the DataView. Useful when the DataView has a filter function
+ * containing a variable parameter.
+ */
+ DataView.prototype.refresh = function () {
+ var id, i, len;
+ var ids = this._data.getIds({ filter: this._options && this._options.filter }),
+ oldIds = (0, _keys2['default'])(this._ids),
+ newIds = {},
+ addedIds = [],
+ removedIds = [],
+ removedItems = [];
+
+ // check for additions
+ for (i = 0, len = ids.length; i < len; i++) {
+ id = ids[i];
+ newIds[id] = true;
+ if (!this._ids[id]) {
+ addedIds.push(id);
+ this._ids[id] = true;
+ }
+ }
+
+ // check for removals
+ for (i = 0, len = oldIds.length; i < len; i++) {
+ id = oldIds[i];
+ if (!newIds[id]) {
+ removedIds.push(id);
+ removedItems.push(this._data._data[id]);
+ delete this._ids[id];
+ }
+ }
+
+ this.length += addedIds.length - removedIds.length;
+
+ // trigger events
+ if (addedIds.length) {
+ this._trigger('add', { items: addedIds });
+ }
+ if (removedIds.length) {
+ this._trigger('remove', { items: removedIds, oldData: removedItems });
+ }
+ };
+
+ /**
+ * Get data from the data view
+ *
+ * Usage:
+ *
+ * get()
+ * get(options: Object)
+ * get(options: Object, data: Array | DataTable)
+ *
+ * get(id: Number)
+ * get(id: Number, options: Object)
+ * get(id: Number, options: Object, data: Array | DataTable)
+ *
+ * get(ids: Number[])
+ * get(ids: Number[], options: Object)
+ * get(ids: Number[], options: Object, data: Array | DataTable)
+ *
+ * Where:
+ *
+ * {Number | String} id The id of an item
+ * {Number[] | String{}} ids An array with ids of items
+ * {Object} options An Object with options. Available options:
+ * {String} [type] Type of data to be returned. Can
+ * be 'DataTable' or 'Array' (default)
+ * {Object.<String, String>} [convert]
+ * {String[]} [fields] field names to be returned
+ * {function} [filter] filter items
+ * {String | function} [order] Order the items by
+ * a field name or custom sort function.
+ * {Array | DataTable} [data] If provided, items will be appended to this
+ * array or table. Required in case of Google
+ * DataTable.
+ * @param args
+ */
+ DataView.prototype.get = function (args) {
+ var me = this;
+
+ // parse the arguments
+ var ids, options, data;
+ var firstType = util.getType(arguments[0]);
+ if (firstType == 'String' || firstType == 'Number' || firstType == 'Array') {
+ // get(id(s) [, options] [, data])
+ ids = arguments[0]; // can be a single id or an array with ids
+ options = arguments[1];
+ data = arguments[2];
+ } else {
+ // get([, options] [, data])
+ options = arguments[0];
+ data = arguments[1];
+ }
+
+ // extend the options with the default options and provided options
+ var viewOptions = util.extend({}, this._options, options);
+
+ // create a combined filter method when needed
+ if (this._options.filter && options && options.filter) {
+ viewOptions.filter = function (item) {
+ return me._options.filter(item) && options.filter(item);
+ };
+ }
+
+ // build up the call to the linked data set
+ var getArguments = [];
+ if (ids != undefined) {
+ getArguments.push(ids);
+ }
+ getArguments.push(viewOptions);
+ getArguments.push(data);
+
+ return this._data && this._data.get.apply(this._data, getArguments);
+ };
+
+ /**
+ * Get ids of all items or from a filtered set of items.
+ * @param {Object} [options] An Object with options. Available options:
+ * {function} [filter] filter items
+ * {String | function} [order] Order the items by
+ * a field name or custom sort function.
+ * @return {Array} ids
+ */
+ DataView.prototype.getIds = function (options) {
+ var ids;
+
+ if (this._data) {
+ var defaultFilter = this._options.filter;
+ var filter;
+
+ if (options && options.filter) {
+ if (defaultFilter) {
+ filter = function filter(item) {
+ return defaultFilter(item) && options.filter(item);
+ };
+ } else {
+ filter = options.filter;
+ }
+ } else {
+ filter = defaultFilter;
+ }
+
+ ids = this._data.getIds({
+ filter: filter,
+ order: options && options.order
+ });
+ } else {
+ ids = [];
+ }
+
+ return ids;
+ };
+
+ /**
+ * Map every item in the dataset.
+ * @param {function} callback
+ * @param {Object} [options] Available options:
+ * {Object.<String, String>} [type]
+ * {String[]} [fields] filter fields
+ * {function} [filter] filter items
+ * {String | function} [order] Order the items by
+ * a field name or custom sort function.
+ * @return {Object[]} mappedItems
+ */
+ DataView.prototype.map = function (callback, options) {
+ var mappedItems = [];
+ if (this._data) {
+ var defaultFilter = this._options.filter;
+ var filter;
+
+ if (options && options.filter) {
+ if (defaultFilter) {
+ filter = function filter(item) {
+ return defaultFilter(item) && options.filter(item);
+ };
+ } else {
+ filter = options.filter;
+ }
+ } else {
+ filter = defaultFilter;
+ }
+
+ mappedItems = this._data.map(callback, {
+ filter: filter,
+ order: options && options.order
+ });
+ } else {
+ mappedItems = [];
+ }
+
+ return mappedItems;
+ };
+
+ /**
+ * Get the DataSet to which this DataView is connected. In case there is a chain
+ * of multiple DataViews, the root DataSet of this chain is returned.
+ * @return {DataSet} dataSet
+ */
+ DataView.prototype.getDataSet = function () {
+ var dataSet = this;
+ while (dataSet instanceof DataView) {
+ dataSet = dataSet._data;
+ }
+ return dataSet || null;
+ };
+
+ /**
+ * Event listener. Will propagate all events from the connected data set to
+ * the subscribers of the DataView, but will filter the items and only trigger
+ * when there are changes in the filtered data set.
+ * @param {String} event
+ * @param {Object | null} params
+ * @param {String} senderId
+ * @private
+ */
+ DataView.prototype._onEvent = function (event, params, senderId) {
+ var i, len, id, item;
+ var ids = params && params.items;
+ var addedIds = [],
+ updatedIds = [],
+ removedIds = [],
+ oldItems = [],
+ updatedItems = [],
+ removedItems = [];
+
+ if (ids && this._data) {
+ switch (event) {
+ case 'add':
+ // filter the ids of the added items
+ for (i = 0, len = ids.length; i < len; i++) {
+ id = ids[i];
+ item = this.get(id);
+ if (item) {
+ this._ids[id] = true;
+ addedIds.push(id);
+ }
+ }
+
+ break;
+
+ case 'update':
+ // determine the event from the views viewpoint: an updated
+ // item can be added, updated, or removed from this view.
+ for (i = 0, len = ids.length; i < len; i++) {
+ id = ids[i];
+ item = this.get(id);
+
+ if (item) {
+ if (this._ids[id]) {
+ updatedIds.push(id);
+ updatedItems.push(params.data[i]);
+ oldItems.push(params.oldData[i]);
+ } else {
+ this._ids[id] = true;
+ addedIds.push(id);
+ }
+ } else {
+ if (this._ids[id]) {
+ delete this._ids[id];
+ removedIds.push(id);
+ removedItems.push(params.oldData[i]);
+ } else {
+ // nothing interesting for me :-(
+ }
+ }
+ }
+
+ break;
+
+ case 'remove':
+ // filter the ids of the removed items
+ for (i = 0, len = ids.length; i < len; i++) {
+ id = ids[i];
+ if (this._ids[id]) {
+ delete this._ids[id];
+ removedIds.push(id);
+ removedItems.push(params.oldData[i]);
+ }
+ }
+
+ break;
+ }
+
+ this.length += addedIds.length - removedIds.length;
+
+ if (addedIds.length) {
+ this._trigger('add', { items: addedIds }, senderId);
+ }
+ if (updatedIds.length) {
+ this._trigger('update', { items: updatedIds, oldData: oldItems, data: updatedItems }, senderId);
+ }
+ if (removedIds.length) {
+ this._trigger('remove', { items: removedIds, oldData: removedItems }, senderId);
+ }
+ }
+ };
+
+ // copy subscription functionality from DataSet
+ DataView.prototype.on = DataSet.prototype.on;
+ DataView.prototype.off = DataSet.prototype.off;
+ DataView.prototype._trigger = DataSet.prototype._trigger;
+
+ // TODO: make these functions deprecated (replaced with `on` and `off` since version 0.5)
+ DataView.prototype.subscribe = DataView.prototype.on;
+ DataView.prototype.unsubscribe = DataView.prototype.off;
+
+ module.exports = DataView;
+
+/***/ },
+/* 94 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var Emitter = __webpack_require__(95);var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+ var util = __webpack_require__(1);
+ var Point3d = __webpack_require__(96);
+ var Point2d = __webpack_require__(97);
+ var Camera = __webpack_require__(98);
+ var Filter = __webpack_require__(103);
+ var Slider = __webpack_require__(104);
+ var StepNumber = __webpack_require__(105);
+ var Range = __webpack_require__(106);
+ var Settings = __webpack_require__(107);
+
+ /// enumerate the available styles
+ Graph3d.STYLE = Settings.STYLE;
+
+ /**
+ * Following label is used in the settings to describe values which should be
+ * determined by the code while running, from the current data and graph style.
+ *
+ * Using 'undefined' directly achieves the same thing, but this is more
+ * descriptive by describing the intent.
+ */
+ var autoByDefault = undefined;
+
+ /**
+ * Default values for option settings.
+ *
+ * These are the values used when a Graph3d instance is initialized without
+ * custom settings.
+ *
+ * If a field is not in this list, a default value of 'autoByDefault' is assumed,
+ * which is just an alias for 'undefined'.
+ */
+ var DEFAULTS = {
+ width: '400px',
+ height: '400px',
+ filterLabel: 'time',
+ legendLabel: 'value',
+ xLabel: 'x',
+ yLabel: 'y',
+ zLabel: 'z',
+ xValueLabel: function xValueLabel(v) {
+ return v;
+ },
+ yValueLabel: function yValueLabel(v) {
+ return v;
+ },
+ zValueLabel: function zValueLabel(v) {
+ return v;
+ },
+ showGrid: true,
+ showPerspective: true,
+ showShadow: false,
+ keepAspectRatio: true,
+ verticalRatio: 0.5, // 0.1 to 1.0, where 1.0 results in a 'cube'
+ dotSizeRatio: 0.02, // size of the dots as a fraction of the graph width
+
+ showAnimationControls: autoByDefault,
+ animationInterval: 1000, // milliseconds
+ animationPreload: false,
+ animationAutoStart: autoByDefault,
+
+ axisColor: '#4D4D4D',
+ gridColor: '#D3D3D3',
+ xCenter: '55%',
+ yCenter: '50%',
+
+ style: Graph3d.STYLE.DOT,
+ tooltip: false,
+ showLegend: autoByDefault, // determined by graph style
+ backgroundColor: autoByDefault,
+
+ dataColor: {
+ fill: '#7DC1FF',
+ stroke: '#3267D2',
+ strokeWidth: 1 // px
+ },
+
+ cameraPosition: {
+ horizontal: 1.0,
+ vertical: 0.5,
+ distance: 1.7
+ },
+
+ xBarWidth: autoByDefault,
+ yBarWidth: autoByDefault,
+ valueMin: autoByDefault,
+ valueMax: autoByDefault,
+ xMin: autoByDefault,
+ xMax: autoByDefault,
+ xStep: autoByDefault,
+ yMin: autoByDefault,
+ yMax: autoByDefault,
+ yStep: autoByDefault,
+ zMin: autoByDefault,
+ zMax: autoByDefault,
+ zStep: autoByDefault
+ };
+
+ // -----------------------------------------------------------------------------
+ // Class Graph3d
+ // -----------------------------------------------------------------------------
+
+
+ /**
+ * @constructor Graph3d
+ * Graph3d displays data in 3d.
+ *
+ * Graph3d is developed in javascript as a Google Visualization Chart.
+ *
+ * @param {Element} container The DOM element in which the Graph3d will
+ * be created. Normally a div element.
+ * @param {DataSet | DataView | Array} [data]
+ * @param {Object} [options]
+ */
+ function Graph3d(container, data, options) {
+ if (!(this instanceof Graph3d)) {
+ throw new SyntaxError('Constructor must be called with the new operator');
+ }
+
+ // create variables and set default values
+ this.containerElement = container;
+
+ this.dataTable = null; // The original data table
+ this.dataPoints = null; // The table with point objects
+
+ // create a frame and canvas
+ this.create();
+
+ Settings.setDefaults(DEFAULTS, this);
+
+ // the column indexes
+ this.colX = undefined;
+ this.colY = undefined;
+ this.colZ = undefined;
+ this.colValue = undefined;
+ this.colFilter = undefined;
+
+ // TODO: customize axis range
+
+ // apply options (also when undefined)
+ this.setOptions(options);
+
+ // apply data
+ if (data) {
+ this.setData(data);
+ }
+ }
+
+ // Extend Graph3d with an Emitter mixin
+ Emitter(Graph3d.prototype);
+
+ /**
+ * Calculate the scaling values, dependent on the range in x, y, and z direction
+ */
+ Graph3d.prototype._setScale = function () {
+ this.scale = new Point3d(1 / this.xRange.range(), 1 / this.yRange.range(), 1 / this.zRange.range());
+
+ // keep aspect ration between x and y scale if desired
+ if (this.keepAspectRatio) {
+ if (this.scale.x < this.scale.y) {
+ //noinspection JSSuspiciousNameCombination
+ this.scale.y = this.scale.x;
+ } else {
+ //noinspection JSSuspiciousNameCombination
+ this.scale.x = this.scale.y;
+ }
+ }
+
+ // scale the vertical axis
+ this.scale.z *= this.verticalRatio;
+ // TODO: can this be automated? verticalRatio?
+
+ // determine scale for (optional) value
+ if (this.valueRange !== undefined) {
+ this.scale.value = 1 / this.valueRange.range();
+ }
+
+ // position the camera arm
+ var xCenter = this.xRange.center() * this.scale.x;
+ var yCenter = this.yRange.center() * this.scale.y;
+ var zCenter = this.zRange.center() * this.scale.z;
+ this.camera.setArmLocation(xCenter, yCenter, zCenter);
+ };
+
+ /**
+ * Convert a 3D location to a 2D location on screen
+ * Source: ttp://en.wikipedia.org/wiki/3D_projection
+ *
+ * @param {Point3d} point3d A 3D point with parameters x, y, z
+ * @returns {Point2d} point2d A 2D point with parameters x, y
+ */
+ Graph3d.prototype._convert3Dto2D = function (point3d) {
+ var translation = this._convertPointToTranslation(point3d);
+ return this._convertTranslationToScreen(translation);
+ };
+
+ /**
+ * Convert a 3D location its translation seen from the camera
+ * Source: http://en.wikipedia.org/wiki/3D_projection
+ *
+ * @param {Point3d} point3d A 3D point with parameters x, y, z
+ * @returns {Point3d} translation A 3D point with parameters x, y, z This is
+ * the translation of the point, seen from the
+ * camera.
+ */
+ Graph3d.prototype._convertPointToTranslation = function (point3d) {
+ var cameraLocation = this.camera.getCameraLocation(),
+ cameraRotation = this.camera.getCameraRotation(),
+ ax = point3d.x * this.scale.x,
+ ay = point3d.y * this.scale.y,
+ az = point3d.z * this.scale.z,
+ cx = cameraLocation.x,
+ cy = cameraLocation.y,
+ cz = cameraLocation.z,
+
+
+ // calculate angles
+ sinTx = Math.sin(cameraRotation.x),
+ cosTx = Math.cos(cameraRotation.x),
+ sinTy = Math.sin(cameraRotation.y),
+ cosTy = Math.cos(cameraRotation.y),
+ sinTz = Math.sin(cameraRotation.z),
+ cosTz = Math.cos(cameraRotation.z),
+
+
+ // calculate translation
+ dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz),
+ dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax - cx)),
+ dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax - cx));
+
+ return new Point3d(dx, dy, dz);
+ };
+
+ /**
+ * Convert a translation point to a point on the screen
+ *
+ * @param {Point3d} translation A 3D point with parameters x, y, z This is
+ * the translation of the point, seen from the
+ * camera.
+ * @returns {Point2d} point2d A 2D point with parameters x, y
+ */
+ Graph3d.prototype._convertTranslationToScreen = function (translation) {
+ var ex = this.eye.x,
+ ey = this.eye.y,
+ ez = this.eye.z,
+ dx = translation.x,
+ dy = translation.y,
+ dz = translation.z;
+
+ // calculate position on screen from translation
+ var bx;
+ var by;
+ if (this.showPerspective) {
+ bx = (dx - ex) * (ez / dz);
+ by = (dy - ey) * (ez / dz);
+ } else {
+ bx = dx * -(ez / this.camera.getArmLength());
+ by = dy * -(ez / this.camera.getArmLength());
+ }
+
+ // shift and scale the point to the center of the screen
+ // use the width of the graph to scale both horizontally and vertically.
+ return new Point2d(this.currentXCenter + bx * this.frame.canvas.clientWidth, this.currentYCenter - by * this.frame.canvas.clientWidth);
+ };
+
+ /**
+ * Calculate the translations and screen positions of all points
+ */
+ Graph3d.prototype._calcTranslations = function (points, sort) {
+ if (sort === undefined) {
+ sort = true;
+ }
+
+ for (var i = 0; i < points.length; i++) {
+ var point = points[i];
+ point.trans = this._convertPointToTranslation(point.point);
+ point.screen = this._convertTranslationToScreen(point.trans);
+
+ // calculate the translation of the point at the bottom (needed for sorting)
+ var transBottom = this._convertPointToTranslation(point.bottom);
+ point.dist = this.showPerspective ? transBottom.length() : -transBottom.z;
+ }
+
+ if (!sort) {
+ return;
+ }
+
+ // sort the points on depth of their (x,y) position (not on z)
+ var sortDepth = function sortDepth(a, b) {
+ return b.dist - a.dist;
+ };
+ points.sort(sortDepth);
+ };
+
+ Graph3d.prototype.getNumberOfRows = function (data) {
+ return data.length;
+ };
+
+ Graph3d.prototype.getNumberOfColumns = function (data) {
+ var counter = 0;
+ for (var column in data[0]) {
+ if (data[0].hasOwnProperty(column)) {
+ counter++;
+ }
+ }
+ return counter;
+ };
+
+ Graph3d.prototype.getDistinctValues = function (data, column) {
+ var distinctValues = [];
+ for (var i = 0; i < data.length; i++) {
+ if (distinctValues.indexOf(data[i][column]) == -1) {
+ distinctValues.push(data[i][column]);
+ }
+ }
+ return distinctValues;
+ };
+
+ /**
+ * Get the absolute min/max values for the passed data column.
+ *
+ * @returns {Range} A Range instance with min/max members properly set.
+ */
+ Graph3d.prototype.getColumnRange = function (data, column) {
+ var range = new Range();
+
+ // Adjust the range so that it covers all values in the passed data elements.
+ for (var i = 0; i < data.length; i++) {
+ var item = data[i][column];
+ range.adjust(item);
+ }
+
+ return range;
+ };
+
+ /**
+ * Check if the state is consistent for the use of the value field.
+ *
+ * Throws if a problem is detected.
+ */
+ Graph3d.prototype._checkValueField = function (data) {
+
+ var hasValueField = this.style === Graph3d.STYLE.BARCOLOR || this.style === Graph3d.STYLE.BARSIZE || this.style === Graph3d.STYLE.DOTCOLOR || this.style === Graph3d.STYLE.DOTSIZE;
+
+ if (!hasValueField) {
+ return; // No need to check further
+ }
+
+ // Following field must be present for the current graph style
+ if (this.colValue === undefined) {
+ throw new Error('Expected data to have ' + ' field \'style\' ' + ' for graph style \'' + this.style + '\'');
+ }
+
+ // The data must also contain this field.
+ // Note that only first data element is checked.
+ if (data[0][this.colValue] === undefined) {
+ throw new Error('Expected data to have ' + ' field \'' + this.colValue + '\' ' + ' for graph style \'' + this.style + '\'');
+ }
+ };
+
+ /**
+ * Set default values for range
+ *
+ * The default values override the range values, if defined.
+ *
+ * Because it's possible that only defaultMin or defaultMax is set, it's better
+ * to pass in a range already set with the min/max set from the data. Otherwise,
+ * it's quite hard to process the min/max properly.
+ */
+ Graph3d.prototype._setRangeDefaults = function (range, defaultMin, defaultMax) {
+ if (defaultMin !== undefined) {
+ range.min = defaultMin;
+ }
+
+ if (defaultMax !== undefined) {
+ range.max = defaultMax;
+ }
+
+ // This is the original way that the default min/max values were adjusted.
+ // TODO: Perhaps it's better if an error is thrown if the values do not agree.
+ // But this will change the behaviour.
+ if (range.max <= range.min) range.max = range.min + 1;
+ };
+
+ /**
+ * Initialize the data from the data table. Calculate minimum and maximum values
+ * and column index values
+ * @param {Array | DataSet | DataView} rawData The data containing the items for
+ * the Graph.
+ * @param {Number} style Style Number
+ */
+ Graph3d.prototype._dataInitialize = function (rawData, style) {
+ var me = this;
+
+ // unsubscribe from the dataTable
+ if (this.dataSet) {
+ this.dataSet.off('*', this._onChange);
+ }
+
+ if (rawData === undefined) return;
+
+ if (Array.isArray(rawData)) {
+ rawData = new DataSet(rawData);
+ }
+
+ var data;
+ if (rawData instanceof DataSet || rawData instanceof DataView) {
+ data = rawData.get();
+ } else {
+ throw new Error('Array, DataSet, or DataView expected');
+ }
+
+ if (data.length == 0) return;
+
+ this.dataSet = rawData;
+ this.dataTable = data;
+
+ // subscribe to changes in the dataset
+ this._onChange = function () {
+ me.setData(me.dataSet);
+ };
+ this.dataSet.on('*', this._onChange);
+
+ // determine the location of x,y,z,value,filter columns
+ this.colX = 'x';
+ this.colY = 'y';
+ this.colZ = 'z';
+
+ var withBars = this.style == Graph3d.STYLE.BAR || this.style == Graph3d.STYLE.BARCOLOR || this.style == Graph3d.STYLE.BARSIZE;
+
+ // determine barWidth from data
+ if (withBars) {
+ if (this.defaultXBarWidth !== undefined) {
+ this.xBarWidth = this.defaultXBarWidth;
+ } else {
+ var dataX = this.getDistinctValues(data, this.colX);
+ this.xBarWidth = dataX[1] - dataX[0] || 1;
+ }
+
+ if (this.defaultYBarWidth !== undefined) {
+ this.yBarWidth = this.defaultYBarWidth;
+ } else {
+ var dataY = this.getDistinctValues(data, this.colY);
+ this.yBarWidth = dataY[1] - dataY[0] || 1;
+ }
+ }
+
+ // calculate minimums and maximums
+ var NUMSTEPS = 5;
+
+ var xRange = this.getColumnRange(data, this.colX);
+ if (withBars) {
+ xRange.expand(this.xBarWidth / 2);
+ }
+ this._setRangeDefaults(xRange, this.defaultXMin, this.defaultXMax);
+ this.xRange = xRange;
+ this.xStep = this.defaultXStep !== undefined ? this.defaultXStep : xRange.range() / NUMSTEPS;
+
+ var yRange = this.getColumnRange(data, this.colY);
+ if (withBars) {
+ yRange.expand(this.yBarWidth / 2);
+ }
+ this._setRangeDefaults(yRange, this.defaultYMin, this.defaultYMax);
+ this.yRange = yRange;
+ this.yStep = this.defaultYStep !== undefined ? this.defaultYStep : yRange.range() / NUMSTEPS;
+
+ var zRange = this.getColumnRange(data, this.colZ);
+ this._setRangeDefaults(zRange, this.defaultZMin, this.defaultZMax);
+ this.zRange = zRange;
+ this.zStep = this.defaultZStep !== undefined ? this.defaultZStep : zRange.range() / NUMSTEPS;
+
+ if (data[0].hasOwnProperty('style')) {
+ this.colValue = 'style';
+ var valueRange = this.getColumnRange(data, this.colValue);
+ this._setRangeDefaults(valueRange, this.defaultValueMin, this.defaultValueMax);
+ this.valueRange = valueRange;
+ }
+
+ // check if a filter column is provided
+ // Needs to be started after zRange is defined
+ if (data[0].hasOwnProperty('filter')) {
+ // Only set this field if it's actually present
+ this.colFilter = 'filter';
+
+ if (this.dataFilter === undefined) {
+ this.dataFilter = new Filter(rawData, this.colFilter, this);
+ this.dataFilter.setOnLoadCallback(function () {
+ me.redraw();
+ });
+ }
+ }
+
+ // set the scale dependent on the ranges.
+ this._setScale();
+ };
+
+ /**
+ * Filter the data based on the current filter
+ *
+ * @param {Array} data
+ * @returns {Array} dataPoints Array with point objects which can be drawn on
+ * screen
+ */
+ Graph3d.prototype._getDataPoints = function (data) {
+ // TODO: store the created matrix dataPoints in the filters instead of
+ // reloading each time.
+ var x, y, i, z, obj, point;
+
+ var dataPoints = [];
+
+ if (this.style === Graph3d.STYLE.GRID || this.style === Graph3d.STYLE.SURFACE) {
+ // copy all values from the google data table to a matrix
+ // the provided values are supposed to form a grid of (x,y) positions
+
+ // create two lists with all present x and y values
+ var dataX = [];
+ var dataY = [];
+ for (i = 0; i < this.getNumberOfRows(data); i++) {
+ x = data[i][this.colX] || 0;
+ y = data[i][this.colY] || 0;
+
+ if (dataX.indexOf(x) === -1) {
+ dataX.push(x);
+ }
+ if (dataY.indexOf(y) === -1) {
+ dataY.push(y);
+ }
+ }
+
+ var sortNumber = function sortNumber(a, b) {
+ return a - b;
+ };
+ dataX.sort(sortNumber);
+ dataY.sort(sortNumber);
+
+ // create a grid, a 2d matrix, with all values.
+ var dataMatrix = []; // temporary data matrix
+ for (i = 0; i < data.length; i++) {
+ x = data[i][this.colX] || 0;
+ y = data[i][this.colY] || 0;
+ z = data[i][this.colZ] || 0;
+
+ // TODO: implement Array().indexOf() for Internet Explorer
+ var xIndex = dataX.indexOf(x);
+ var yIndex = dataY.indexOf(y);
+
+ if (dataMatrix[xIndex] === undefined) {
+ dataMatrix[xIndex] = [];
+ }
+
+ var point3d = new Point3d();
+ point3d.x = x;
+ point3d.y = y;
+ point3d.z = z;
+ point3d.data = data[i];
+
+ obj = {};
+ obj.point = point3d;
+ obj.trans = undefined;
+ obj.screen = undefined;
+ obj.bottom = new Point3d(x, y, this.zRange.min);
+
+ dataMatrix[xIndex][yIndex] = obj;
+
+ dataPoints.push(obj);
+ }
+
+ // fill in the pointers to the neighbors.
+ for (x = 0; x < dataMatrix.length; x++) {
+ for (y = 0; y < dataMatrix[x].length; y++) {
+ if (dataMatrix[x][y]) {
+ dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined;
+ dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined;
+ dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined;
+ }
+ }
+ }
+ } else {
+ // 'dot', 'dot-line', etc.
+ this._checkValueField(data);
+
+ // copy all values from the google data table to a list with Point3d objects
+ for (i = 0; i < data.length; i++) {
+ point = new Point3d();
+ point.x = data[i][this.colX] || 0;
+ point.y = data[i][this.colY] || 0;
+ point.z = data[i][this.colZ] || 0;
+ point.data = data[i];
+
+ if (this.colValue !== undefined) {
+ point.value = data[i][this.colValue] || 0;
+ }
+
+ obj = {};
+ obj.point = point;
+ obj.bottom = new Point3d(point.x, point.y, this.zRange.min);
+ obj.trans = undefined;
+ obj.screen = undefined;
+
+ if (this.style === Graph3d.STYLE.LINE) {
+ if (i > 0) {
+ // Add next point for line drawing
+ dataPoints[i - 1].pointNext = obj;
+ }
+ }
+
+ dataPoints.push(obj);
+ }
+ }
+
+ return dataPoints;
+ };
+
+ /**
+ * Create the main frame for the Graph3d.
+ *
+ * This function is executed once when a Graph3d object is created. The frame
+ * contains a canvas, and this canvas contains all objects like the axis and
+ * nodes.
+ */
+ Graph3d.prototype.create = function () {
+ // remove all elements from the container element.
+ while (this.containerElement.hasChildNodes()) {
+ this.containerElement.removeChild(this.containerElement.firstChild);
+ }
+
+ this.frame = document.createElement('div');
+ this.frame.style.position = 'relative';
+ this.frame.style.overflow = 'hidden';
+
+ // create the graph canvas (HTML canvas element)
+ this.frame.canvas = document.createElement('canvas');
+ this.frame.canvas.style.position = 'relative';
+ this.frame.appendChild(this.frame.canvas);
+ //if (!this.frame.canvas.getContext) {
+ {
+ var noCanvas = document.createElement('DIV');
+ noCanvas.style.color = 'red';
+ noCanvas.style.fontWeight = 'bold';
+ noCanvas.style.padding = '10px';
+ noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
+ this.frame.canvas.appendChild(noCanvas);
+ }
+
+ this.frame.filter = document.createElement('div');
+ this.frame.filter.style.position = 'absolute';
+ this.frame.filter.style.bottom = '0px';
+ this.frame.filter.style.left = '0px';
+ this.frame.filter.style.width = '100%';
+ this.frame.appendChild(this.frame.filter);
+
+ // add event listeners to handle moving and zooming the contents
+ var me = this;
+ var onmousedown = function onmousedown(event) {
+ me._onMouseDown(event);
+ };
+ var ontouchstart = function ontouchstart(event) {
+ me._onTouchStart(event);
+ };
+ var onmousewheel = function onmousewheel(event) {
+ me._onWheel(event);
+ };
+ var ontooltip = function ontooltip(event) {
+ me._onTooltip(event);
+ };
+ var onclick = function onclick(event) {
+ me._onClick(event);
+ };
+ // TODO: these events are never cleaned up... can give a 'memory leakage'
+
+ util.addEventListener(this.frame.canvas, 'keydown', onkeydown);
+ util.addEventListener(this.frame.canvas, 'mousedown', onmousedown);
+ util.addEventListener(this.frame.canvas, 'touchstart', ontouchstart);
+ util.addEventListener(this.frame.canvas, 'mousewheel', onmousewheel);
+ util.addEventListener(this.frame.canvas, 'mousemove', ontooltip);
+ util.addEventListener(this.frame.canvas, 'click', onclick);
+
+ // add the new graph to the container element
+ this.containerElement.appendChild(this.frame);
+ };
+
+ /**
+ * Set a new size for the graph
+ */
+ Graph3d.prototype._setSize = function (width, height) {
+ this.frame.style.width = width;
+ this.frame.style.height = height;
+
+ this._resizeCanvas();
+ };
+
+ /**
+ * Resize the canvas to the current size of the frame
+ */
+ Graph3d.prototype._resizeCanvas = function () {
+ this.frame.canvas.style.width = '100%';
+ this.frame.canvas.style.height = '100%';
+
+ this.frame.canvas.width = this.frame.canvas.clientWidth;
+ this.frame.canvas.height = this.frame.canvas.clientHeight;
+
+ // adjust with for margin
+ this.frame.filter.style.width = this.frame.canvas.clientWidth - 2 * 10 + 'px';
+ };
+
+ /**
+ * Start animation
+ */
+ Graph3d.prototype.animationStart = function () {
+ if (!this.frame.filter || !this.frame.filter.slider) throw new Error('No animation available');
+
+ this.frame.filter.slider.play();
+ };
+
+ /**
+ * Stop animation
+ */
+ Graph3d.prototype.animationStop = function () {
+ if (!this.frame.filter || !this.frame.filter.slider) return;
+
+ this.frame.filter.slider.stop();
+ };
+
+ /**
+ * Resize the center position based on the current values in this.xCenter
+ * and this.yCenter (which are strings with a percentage or a value
+ * in pixels). The center positions are the variables this.currentXCenter
+ * and this.currentYCenter
+ */
+ Graph3d.prototype._resizeCenter = function () {
+ // calculate the horizontal center position
+ if (this.xCenter.charAt(this.xCenter.length - 1) === '%') {
+ this.currentXCenter = parseFloat(this.xCenter) / 100 * this.frame.canvas.clientWidth;
+ } else {
+ this.currentXCenter = parseFloat(this.xCenter); // supposed to be in px
+ }
+
+ // calculate the vertical center position
+ if (this.yCenter.charAt(this.yCenter.length - 1) === '%') {
+ this.currentYCenter = parseFloat(this.yCenter) / 100 * (this.frame.canvas.clientHeight - this.frame.filter.clientHeight);
+ } else {
+ this.currentYCenter = parseFloat(this.yCenter); // supposed to be in px
+ }
+ };
+
+ /**
+ * Retrieve the current camera rotation
+ *
+ * @returns {object} An object with parameters horizontal, vertical, and
+ * distance
+ */
+ Graph3d.prototype.getCameraPosition = function () {
+ var pos = this.camera.getArmRotation();
+ pos.distance = this.camera.getArmLength();
+ return pos;
+ };
+
+ /**
+ * Load data into the 3D Graph
+ */
+ Graph3d.prototype._readData = function (data) {
+ // read the data
+ this._dataInitialize(data, this.style);
+
+ if (this.dataFilter) {
+ // apply filtering
+ this.dataPoints = this.dataFilter._getDataPoints();
+ } else {
+ // no filtering. load all data
+ this.dataPoints = this._getDataPoints(this.dataTable);
+ }
+
+ // draw the filter
+ this._redrawFilter();
+ };
+
+ /**
+ * Replace the dataset of the Graph3d
+ *
+ * @param {Array | DataSet | DataView} data
+ */
+ Graph3d.prototype.setData = function (data) {
+ this._readData(data);
+ this.redraw();
+
+ // start animation when option is true
+ if (this.animationAutoStart && this.dataFilter) {
+ this.animationStart();
+ }
+ };
+
+ /**
+ * Update the options. Options will be merged with current options
+ *
+ * @param {Object} options
+ */
+ Graph3d.prototype.setOptions = function (options) {
+ var cameraPosition = undefined;
+
+ this.animationStop();
+
+ Settings.setOptions(options, this);
+
+ this.setPointDrawingMethod();
+ this._setSize(this.width, this.height);
+
+ // re-load the data
+ if (this.dataTable) {
+ this.setData(this.dataTable);
+ }
+
+ // start animation when option is true
+ if (this.animationAutoStart && this.dataFilter) {
+ this.animationStart();
+ }
+ };
+
+ /**
+ * Determine which point drawing method to use for the current graph style.
+ */
+ Graph3d.prototype.setPointDrawingMethod = function () {
+ var method = undefined;
+
+ switch (this.style) {
+ case Graph3d.STYLE.BAR:
+ method = Graph3d.prototype._redrawBarGraphPoint;
+ break;
+ case Graph3d.STYLE.BARCOLOR:
+ method = Graph3d.prototype._redrawBarColorGraphPoint;
+ break;
+ case Graph3d.STYLE.BARSIZE:
+ method = Graph3d.prototype._redrawBarSizeGraphPoint;
+ break;
+ case Graph3d.STYLE.DOT:
+ method = Graph3d.prototype._redrawDotGraphPoint;
+ break;
+ case Graph3d.STYLE.DOTLINE:
+ method = Graph3d.prototype._redrawDotLineGraphPoint;
+ break;
+ case Graph3d.STYLE.DOTCOLOR:
+ method = Graph3d.prototype._redrawDotColorGraphPoint;
+ break;
+ case Graph3d.STYLE.DOTSIZE:
+ method = Graph3d.prototype._redrawDotSizeGraphPoint;
+ break;
+ case Graph3d.STYLE.SURFACE:
+ method = Graph3d.prototype._redrawSurfaceGraphPoint;
+ break;
+ case Graph3d.STYLE.GRID:
+ method = Graph3d.prototype._redrawGridGraphPoint;
+ break;
+ case Graph3d.STYLE.LINE:
+ method = Graph3d.prototype._redrawLineGraphPoint;
+ break;
+ default:
+ throw new Error('Can not determine point drawing method ' + 'for graph style \'' + this.style + '\'');
+ break;
+ }
+
+ this._pointDrawingMethod = method;
+ };
+
+ /**
+ * Redraw the Graph.
+ */
+ Graph3d.prototype.redraw = function () {
+ if (this.dataPoints === undefined) {
+ throw new Error('Graph data not initialized');
+ }
+
+ this._resizeCanvas();
+ this._resizeCenter();
+ this._redrawSlider();
+ this._redrawClear();
+ this._redrawAxis();
+
+ this._redrawDataGraph();
+
+ this._redrawInfo();
+ this._redrawLegend();
+ };
+
+ /**
+ * Get drawing context without exposing canvas
+ */
+ Graph3d.prototype._getContext = function () {
+ var canvas = this.frame.canvas;
+ var ctx = canvas.getContext('2d');
+
+ ctx.lineJoin = 'round';
+ ctx.lineCap = 'round';
+
+ return ctx;
+ };
+
+ /**
+ * Clear the canvas before redrawing
+ */
+ Graph3d.prototype._redrawClear = function () {
+ var canvas = this.frame.canvas;
+ var ctx = canvas.getContext('2d');
+
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ };
+
+ Graph3d.prototype._dotSize = function () {
+ return this.frame.clientWidth * this.dotSizeRatio;
+ };
+
+ /**
+ * Get legend width
+ */
+ Graph3d.prototype._getLegendWidth = function () {
+ var width;
+
+ if (this.style === Graph3d.STYLE.DOTSIZE) {
+ var dotSize = this._dotSize();
+ width = dotSize / 2 + dotSize * 2;
+ } else if (this.style === Graph3d.STYLE.BARSIZE) {
+ width = this.xBarWidth;
+ } else {
+ width = 20;
+ }
+ return width;
+ };
+
+ /**
+ * Redraw the legend based on size, dot color, or surface height
+ */
+ Graph3d.prototype._redrawLegend = function () {
+
+ //Return without drawing anything, if no legend is specified
+ if (this.showLegend !== true) {
+ return;
+ }
+
+ // Do not draw legend when graph style does not support
+ if (this.style === Graph3d.STYLE.LINE || this.style === Graph3d.STYLE.BARSIZE //TODO add legend support for BARSIZE
+ ) {
+ return;
+ }
+
+ // Legend types - size and color. Determine if size legend.
+ var isSizeLegend = this.style === Graph3d.STYLE.BARSIZE || this.style === Graph3d.STYLE.DOTSIZE;
+
+ // Legend is either tracking z values or style values. This flag if false means use z values.
+ var isValueLegend = this.style === Graph3d.STYLE.DOTSIZE || this.style === Graph3d.STYLE.DOTCOLOR || this.style === Graph3d.STYLE.BARCOLOR;
+
+ var height = Math.max(this.frame.clientHeight * 0.25, 100);
+ var top = this.margin;
+ var width = this._getLegendWidth(); // px - overwritten by size legend
+ var right = this.frame.clientWidth - this.margin;
+ var left = right - width;
+ var bottom = top + height;
+
+ var ctx = this._getContext();
+ ctx.lineWidth = 1;
+ ctx.font = '14px arial'; // TODO: put in options
+
+ if (isSizeLegend === false) {
+ // draw the color bar
+ var ymin = 0;
+ var ymax = height; // Todo: make height customizable
+ var y;
+
+ for (y = ymin; y < ymax; y++) {
+ var f = (y - ymin) / (ymax - ymin);
+ var hue = f * 240;
+ var color = this._hsv2rgb(hue, 1, 1);
+
+ ctx.strokeStyle = color;
+ ctx.beginPath();
+ ctx.moveTo(left, top + y);
+ ctx.lineTo(right, top + y);
+ ctx.stroke();
+ }
+ ctx.strokeStyle = this.axisColor;
+ ctx.strokeRect(left, top, width, height);
+ } else {
+
+ // draw the size legend box
+ var widthMin;
+ if (this.style === Graph3d.STYLE.DOTSIZE) {
+ var dotSize = this._dotSize();
+ widthMin = dotSize / 2; // px
+ } else if (this.style === Graph3d.STYLE.BARSIZE) {
+ //widthMin = this.xBarWidth * 0.2 this is wrong - barwidth measures in terms of xvalues
+ }
+ ctx.strokeStyle = this.axisColor;
+ ctx.fillStyle = this.dataColor.fill;
+ ctx.beginPath();
+ ctx.moveTo(left, top);
+ ctx.lineTo(right, top);
+ ctx.lineTo(right - width + widthMin, bottom);
+ ctx.lineTo(left, bottom);
+ ctx.closePath();
+ ctx.fill();
+ ctx.stroke();
+ }
+
+ // print value text along the legend edge
+ var gridLineLen = 5; // px
+
+ var legendMin = isValueLegend ? this.valueRange.min : this.zRange.min;
+ var legendMax = isValueLegend ? this.valueRange.max : this.zRange.max;
+ var step = new StepNumber(legendMin, legendMax, (legendMax - legendMin) / 5, true);
+ step.start(true);
+
+ var y;
+ var from;
+ var to;
+ while (!step.end()) {
+ y = bottom - (step.getCurrent() - legendMin) / (legendMax - legendMin) * height;
+ from = new Point2d(left - gridLineLen, y);
+ to = new Point2d(left, y);
+ this._line(ctx, from, to);
+
+ ctx.textAlign = 'right';
+ ctx.textBaseline = 'middle';
+ ctx.fillStyle = this.axisColor;
+ ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y);
+
+ step.next();
+ }
+
+ ctx.textAlign = 'right';
+ ctx.textBaseline = 'top';
+ var label = this.legendLabel;
+ ctx.fillText(label, right, bottom + this.margin);
+ };
+
+ /**
+ * Redraw the filter
+ */
+ Graph3d.prototype._redrawFilter = function () {
+ this.frame.filter.innerHTML = '';
+
+ if (this.dataFilter) {
+ var options = {
+ 'visible': this.showAnimationControls
+ };
+ var slider = new Slider(this.frame.filter, options);
+ this.frame.filter.slider = slider;
+
+ // TODO: css here is not nice here...
+ this.frame.filter.style.padding = '10px';
+ //this.frame.filter.style.backgroundColor = '#EFEFEF';
+
+ slider.setValues(this.dataFilter.values);
+ slider.setPlayInterval(this.animationInterval);
+
+ // create an event handler
+ var me = this;
+ var onchange = function onchange() {
+ var index = slider.getIndex();
+
+ me.dataFilter.selectValue(index);
+ me.dataPoints = me.dataFilter._getDataPoints();
+
+ me.redraw();
+ };
+ slider.setOnChangeCallback(onchange);
+ } else {
+ this.frame.filter.slider = undefined;
+ }
+ };
+
+ /**
+ * Redraw the slider
+ */
+ Graph3d.prototype._redrawSlider = function () {
+ if (this.frame.filter.slider !== undefined) {
+ this.frame.filter.slider.redraw();
+ }
+ };
+
+ /**
+ * Redraw common information
+ */
+ Graph3d.prototype._redrawInfo = function () {
+ if (this.dataFilter) {
+ var ctx = this._getContext();
+
+ ctx.font = '14px arial'; // TODO: put in options
+ ctx.lineStyle = 'gray';
+ ctx.fillStyle = 'gray';
+ ctx.textAlign = 'left';
+ ctx.textBaseline = 'top';
+
+ var x = this.margin;
+ var y = this.margin;
+ ctx.fillText(this.dataFilter.getLabel() + ': ' + this.dataFilter.getSelectedValue(), x, y);
+ }
+ };
+
+ /**
+ * Draw a line between 2d points 'from' and 'to'.
+ *
+ * If stroke style specified, set that as well.
+ */
+ Graph3d.prototype._line = function (ctx, from, to, strokeStyle) {
+ if (strokeStyle !== undefined) {
+ ctx.strokeStyle = strokeStyle;
+ }
+
+ ctx.beginPath();
+ ctx.moveTo(from.x, from.y);
+ ctx.lineTo(to.x, to.y);
+ ctx.stroke();
+ };
+
+ Graph3d.prototype.drawAxisLabelX = function (ctx, point3d, text, armAngle, yMargin) {
+ if (yMargin === undefined) {
+ yMargin = 0;
+ }
+
+ var point2d = this._convert3Dto2D(point3d);
+
+ if (Math.cos(armAngle * 2) > 0) {
+ ctx.textAlign = 'center';
+ ctx.textBaseline = 'top';
+ point2d.y += yMargin;
+ } else if (Math.sin(armAngle * 2) < 0) {
+ ctx.textAlign = 'right';
+ ctx.textBaseline = 'middle';
+ } else {
+ ctx.textAlign = 'left';
+ ctx.textBaseline = 'middle';
+ }
+
+ ctx.fillStyle = this.axisColor;
+ ctx.fillText(text, point2d.x, point2d.y);
+ };
+
+ Graph3d.prototype.drawAxisLabelY = function (ctx, point3d, text, armAngle, yMargin) {
+ if (yMargin === undefined) {
+ yMargin = 0;
+ }
+
+ var point2d = this._convert3Dto2D(point3d);
+
+ if (Math.cos(armAngle * 2) < 0) {
+ ctx.textAlign = 'center';
+ ctx.textBaseline = 'top';
+ point2d.y += yMargin;
+ } else if (Math.sin(armAngle * 2) > 0) {
+ ctx.textAlign = 'right';
+ ctx.textBaseline = 'middle';
+ } else {
+ ctx.textAlign = 'left';
+ ctx.textBaseline = 'middle';
+ }
+
+ ctx.fillStyle = this.axisColor;
+ ctx.fillText(text, point2d.x, point2d.y);
+ };
+
+ Graph3d.prototype.drawAxisLabelZ = function (ctx, point3d, text, offset) {
+ if (offset === undefined) {
+ offset = 0;
+ }
+
+ var point2d = this._convert3Dto2D(point3d);
+ ctx.textAlign = 'right';
+ ctx.textBaseline = 'middle';
+ ctx.fillStyle = this.axisColor;
+ ctx.fillText(text, point2d.x - offset, point2d.y);
+ };
+
+ /**
+
+
+ /**
+ * Draw a line between 2d points 'from' and 'to'.
+ *
+ * If stroke style specified, set that as well.
+ */
+ Graph3d.prototype._line3d = function (ctx, from, to, strokeStyle) {
+ var from2d = this._convert3Dto2D(from);
+ var to2d = this._convert3Dto2D(to);
+
+ this._line(ctx, from2d, to2d, strokeStyle);
+ };
+
+ /**
+ * Redraw the axis
+ */
+ Graph3d.prototype._redrawAxis = function () {
+ var ctx = this._getContext(),
+ from,
+ to,
+ step,
+ prettyStep,
+ text,
+ xText,
+ yText,
+ zText,
+ offset,
+ xOffset,
+ yOffset;
+
+ // TODO: get the actual rendered style of the containerElement
+ //ctx.font = this.containerElement.style.font;
+ ctx.font = 24 / this.camera.getArmLength() + 'px arial';
+
+ // calculate the length for the short grid lines
+ var gridLenX = 0.025 / this.scale.x;
+ var gridLenY = 0.025 / this.scale.y;
+ var textMargin = 5 / this.camera.getArmLength(); // px
+ var armAngle = this.camera.getArmRotation().horizontal;
+ var armVector = new Point2d(Math.cos(armAngle), Math.sin(armAngle));
+
+ var xRange = this.xRange;
+ var yRange = this.yRange;
+ var zRange = this.zRange;
+
+ // draw x-grid lines
+ ctx.lineWidth = 1;
+ prettyStep = this.defaultXStep === undefined;
+ step = new StepNumber(xRange.min, xRange.max, this.xStep, prettyStep);
+ step.start(true);
+
+ while (!step.end()) {
+ var x = step.getCurrent();
+
+ if (this.showGrid) {
+ from = new Point3d(x, yRange.min, zRange.min);
+ to = new Point3d(x, yRange.max, zRange.min);
+ this._line3d(ctx, from, to, this.gridColor);
+ } else {
+ from = new Point3d(x, yRange.min, zRange.min);
+ to = new Point3d(x, yRange.min + gridLenX, zRange.min);
+ this._line3d(ctx, from, to, this.axisColor);
+
+ from = new Point3d(x, yRange.max, zRange.min);
+ to = new Point3d(x, yRange.max - gridLenX, zRange.min);
+ this._line3d(ctx, from, to, this.axisColor);
+ }
+
+ yText = armVector.x > 0 ? yRange.min : yRange.max;
+ var point3d = new Point3d(x, yText, zRange.min);
+ var msg = ' ' + this.xValueLabel(x) + ' ';
+ this.drawAxisLabelX(ctx, point3d, msg, armAngle, textMargin);
+
+ step.next();
+ }
+
+ // draw y-grid lines
+ ctx.lineWidth = 1;
+ prettyStep = this.defaultYStep === undefined;
+ step = new StepNumber(yRange.min, yRange.max, this.yStep, prettyStep);
+ step.start(true);
+
+ while (!step.end()) {
+ var y = step.getCurrent();
+
+ if (this.showGrid) {
+ from = new Point3d(xRange.min, y, zRange.min);
+ to = new Point3d(xRange.max, y, zRange.min);
+ this._line3d(ctx, from, to, this.gridColor);
+ } else {
+ from = new Point3d(xRange.min, y, zRange.min);
+ to = new Point3d(xRange.min + gridLenY, y, zRange.min);
+ this._line3d(ctx, from, to, this.axisColor);
+
+ from = new Point3d(xRange.max, y, zRange.min);
+ to = new Point3d(xRange.max - gridLenY, y, zRange.min);
+ this._line3d(ctx, from, to, this.axisColor);
+ }
+
+ xText = armVector.y > 0 ? xRange.min : xRange.max;
+ point3d = new Point3d(xText, y, zRange.min);
+ var msg = ' ' + this.yValueLabel(y) + ' ';
+ this.drawAxisLabelY(ctx, point3d, msg, armAngle, textMargin);
+
+ step.next();
+ }
+
+ // draw z-grid lines and axis
+ ctx.lineWidth = 1;
+ prettyStep = this.defaultZStep === undefined;
+ step = new StepNumber(zRange.min, zRange.max, this.zStep, prettyStep);
+ step.start(true);
+
+ xText = armVector.x > 0 ? xRange.min : xRange.max;
+ yText = armVector.y < 0 ? yRange.min : yRange.max;
+
+ while (!step.end()) {
+ var z = step.getCurrent();
+
+ // TODO: make z-grid lines really 3d?
+ var from3d = new Point3d(xText, yText, z);
+ var from2d = this._convert3Dto2D(from3d);
+ to = new Point2d(from2d.x - textMargin, from2d.y);
+ this._line(ctx, from2d, to, this.axisColor);
+
+ var msg = this.zValueLabel(z) + ' ';
+ this.drawAxisLabelZ(ctx, from3d, msg, 5);
+
+ step.next();
+ }
+
+ ctx.lineWidth = 1;
+ from = new Point3d(xText, yText, zRange.min);
+ to = new Point3d(xText, yText, zRange.max);
+ this._line3d(ctx, from, to, this.axisColor);
+
+ // draw x-axis
+ var xMin2d;
+ var xMax2d;
+ ctx.lineWidth = 1;
+
+ // line at yMin
+ xMin2d = new Point3d(xRange.min, yRange.min, zRange.min);
+ xMax2d = new Point3d(xRange.max, yRange.min, zRange.min);
+ this._line3d(ctx, xMin2d, xMax2d, this.axisColor);
+ // line at ymax
+ xMin2d = new Point3d(xRange.min, yRange.max, zRange.min);
+ xMax2d = new Point3d(xRange.max, yRange.max, zRange.min);
+ this._line3d(ctx, xMin2d, xMax2d, this.axisColor);
+
+ // draw y-axis
+ ctx.lineWidth = 1;
+ // line at xMin
+ from = new Point3d(xRange.min, yRange.min, zRange.min);
+ to = new Point3d(xRange.min, yRange.max, zRange.min);
+ this._line3d(ctx, from, to, this.axisColor);
+ // line at xMax
+ from = new Point3d(xRange.max, yRange.min, zRange.min);
+ to = new Point3d(xRange.max, yRange.max, zRange.min);
+ this._line3d(ctx, from, to, this.axisColor);
+
+ // draw x-label
+ var xLabel = this.xLabel;
+ if (xLabel.length > 0) {
+ yOffset = 0.1 / this.scale.y;
+ xText = (xRange.max + 3 * xRange.min) / 4;
+ yText = armVector.x > 0 ? yRange.min - yOffset : yRange.max + yOffset;
+ text = new Point3d(xText, yText, zRange.min);
+ this.drawAxisLabelX(ctx, text, xLabel, armAngle);
+ }
+
+ // draw y-label
+ var yLabel = this.yLabel;
+ if (yLabel.length > 0) {
+ xOffset = 0.1 / this.scale.x;
+ xText = armVector.y > 0 ? xRange.min - xOffset : xRange.max + xOffset;
+ yText = (yRange.max + 3 * yRange.min) / 4;
+ text = new Point3d(xText, yText, zRange.min);
+
+ this.drawAxisLabelY(ctx, text, yLabel, armAngle);
+ }
+
+ // draw z-label
+ var zLabel = this.zLabel;
+ if (zLabel.length > 0) {
+ offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis?
+ xText = armVector.x > 0 ? xRange.min : xRange.max;
+ yText = armVector.y < 0 ? yRange.min : yRange.max;
+ zText = (zRange.max + 3 * zRange.min) / 4;
+ text = new Point3d(xText, yText, zText);
+
+ this.drawAxisLabelZ(ctx, text, zLabel, offset);
+ }
+ };
+
+ /**
+ * Calculate the color based on the given value.
+ * @param {Number} H Hue, a value be between 0 and 360
+ * @param {Number} S Saturation, a value between 0 and 1
+ * @param {Number} V Value, a value between 0 and 1
+ */
+ Graph3d.prototype._hsv2rgb = function (H, S, V) {
+ var R, G, B, C, Hi, X;
+
+ C = V * S;
+ Hi = Math.floor(H / 60); // hi = 0,1,2,3,4,5
+ X = C * (1 - Math.abs(H / 60 % 2 - 1));
+
+ switch (Hi) {
+ case 0:
+ R = C;G = X;B = 0;break;
+ case 1:
+ R = X;G = C;B = 0;break;
+ case 2:
+ R = 0;G = C;B = X;break;
+ case 3:
+ R = 0;G = X;B = C;break;
+ case 4:
+ R = X;G = 0;B = C;break;
+ case 5:
+ R = C;G = 0;B = X;break;
+
+ default:
+ R = 0;G = 0;B = 0;break;
+ }
+
+ return 'RGB(' + parseInt(R * 255) + ',' + parseInt(G * 255) + ',' + parseInt(B * 255) + ')';
+ };
+
+ Graph3d.prototype._getStrokeWidth = function (point) {
+ if (point !== undefined) {
+ if (this.showPerspective) {
+ return 1 / -point.trans.z * this.dataColor.strokeWidth;
+ } else {
+ return -(this.eye.z / this.camera.getArmLength()) * this.dataColor.strokeWidth;
+ }
+ }
+
+ return this.dataColor.strokeWidth;
+ };
+
+ // -----------------------------------------------------------------------------
+ // Drawing primitives for the graphs
+ // -----------------------------------------------------------------------------
+
+
+ /**
+ * Draw a bar element in the view with the given properties.
+ */
+ Graph3d.prototype._redrawBar = function (ctx, point, xWidth, yWidth, color, borderColor) {
+ var i, j, surface;
+
+ // calculate all corner points
+ var me = this;
+ var point3d = point.point;
+ var zMin = this.zRange.min;
+ var top = [{ point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, point3d.z) }, { point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, point3d.z) }, { point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, point3d.z) }, { point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, point3d.z) }];
+ var bottom = [{ point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, zMin) }, { point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, zMin) }, { point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, zMin) }, { point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, zMin) }];
+
+ // calculate screen location of the points
+ top.forEach(function (obj) {
+ obj.screen = me._convert3Dto2D(obj.point);
+ });
+ bottom.forEach(function (obj) {
+ obj.screen = me._convert3Dto2D(obj.point);
+ });
+
+ // create five sides, calculate both corner points and center points
+ var surfaces = [{ corners: top, center: Point3d.avg(bottom[0].point, bottom[2].point) }, { corners: [top[0], top[1], bottom[1], bottom[0]], center: Point3d.avg(bottom[1].point, bottom[0].point) }, { corners: [top[1], top[2], bottom[2], bottom[1]], center: Point3d.avg(bottom[2].point, bottom[1].point) }, { corners: [top[2], top[3], bottom[3], bottom[2]], center: Point3d.avg(bottom[3].point, bottom[2].point) }, { corners: [top[3], top[0], bottom[0], bottom[3]], center: Point3d.avg(bottom[0].point, bottom[3].point) }];
+ point.surfaces = surfaces;
+
+ // calculate the distance of each of the surface centers to the camera
+ for (j = 0; j < surfaces.length; j++) {
+ surface = surfaces[j];
+ var transCenter = this._convertPointToTranslation(surface.center);
+ surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z;
+ // TODO: this dept calculation doesn't work 100% of the cases due to perspective,
+ // but the current solution is fast/simple and works in 99.9% of all cases
+ // the issue is visible in example 14, with graph.setCameraPosition({horizontal: 2.97, vertical: 0.5, distance: 0.9})
+ }
+
+ // order the surfaces by their (translated) depth
+ surfaces.sort(function (a, b) {
+ var diff = b.dist - a.dist;
+ if (diff) return diff;
+
+ // if equal depth, sort the top surface last
+ if (a.corners === top) return 1;
+ if (b.corners === top) return -1;
+
+ // both are equal
+ return 0;
+ });
+
+ // draw the ordered surfaces
+ ctx.lineWidth = this._getStrokeWidth(point);
+ ctx.strokeStyle = borderColor;
+ ctx.fillStyle = color;
+ // NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside
+ for (j = 2; j < surfaces.length; j++) {
+ surface = surfaces[j];
+ this._polygon(ctx, surface.corners);
+ }
+ };
+
+ /**
+ * Draw a polygon using the passed points and fill it with the passed style and stroke.
+ *
+ * @param points an array of points.
+ * @param fillStyle optional; the fill style to set
+ * @param strokeStyle optional; the stroke style to set
+ */
+ Graph3d.prototype._polygon = function (ctx, points, fillStyle, strokeStyle) {
+ if (points.length < 2) {
+ return;
+ }
+
+ if (fillStyle !== undefined) {
+ ctx.fillStyle = fillStyle;
+ }
+ if (strokeStyle !== undefined) {
+ ctx.strokeStyle = strokeStyle;
+ }
+ ctx.beginPath();
+ ctx.moveTo(points[0].screen.x, points[0].screen.y);
+
+ for (var i = 1; i < points.length; ++i) {
+ var point = points[i];
+ ctx.lineTo(point.screen.x, point.screen.y);
+ }
+
+ ctx.closePath();
+ ctx.fill();
+ ctx.stroke(); // TODO: only draw stroke when strokeWidth > 0
+ };
+
+ /**
+ * @param size optional; if not specified use value from 'this._dotSize()`
+ */
+ Graph3d.prototype._drawCircle = function (ctx, point, color, borderColor, size) {
+ var radius = this._calcRadius(point, size);
+
+ ctx.lineWidth = this._getStrokeWidth(point);
+ ctx.strokeStyle = borderColor;
+ ctx.fillStyle = color;
+ ctx.beginPath();
+ ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI * 2, true);
+ ctx.fill();
+ ctx.stroke();
+ };
+
+ /**
+ * Determine the colors for the 'regular' graph styles.
+ */
+ Graph3d.prototype._getColorsRegular = function (point) {
+ // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0
+ var hue = (1 - (point.point.z - this.zRange.min) * this.scale.z / this.verticalRatio) * 240;
+ var color = this._hsv2rgb(hue, 1, 1);
+ var borderColor = this._hsv2rgb(hue, 1, 0.8);
+
+ return {
+ fill: color,
+ border: borderColor
+ };
+ };
+
+ /**
+ * Get the colors for the 'color' graph styles.
+ * These styles are currently: 'bar-color' and 'dot-color'
+ * Color may be set as a string representation of HTML color, like #ff00ff,
+ * or calculated from a number, for example, distance from this point
+ * The first option is useful when we have some pre-given legend, to which we have to adjust ourselves
+ * The second option is useful when we are interested in automatically setting the color, from some value,
+ * using some color scale
+ */
+ Graph3d.prototype._getColorsColor = function (point) {
+ // calculate the color based on the value
+ var color, borderColor;
+
+ if (typeof point.point.value === "string") {
+ color = point.point.value;
+ borderColor = point.point.value;
+ } else {
+ var hue = (1 - (point.point.value - this.valueRange.min) * this.scale.value) * 240;
+ color = this._hsv2rgb(hue, 1, 1);
+ borderColor = this._hsv2rgb(hue, 1, 0.8);
+ }
+ return {
+ fill: color,
+ border: borderColor
+ };
+ };
+
+ /**
+ * Get the colors for the 'size' graph styles.
+ * These styles are currently: 'bar-size' and 'dot-size'
+ */
+ Graph3d.prototype._getColorsSize = function () {
+ return {
+ fill: this.dataColor.fill,
+ border: this.dataColor.stroke
+ };
+ };
+
+ /**
+ * Determine the size of a point on-screen, as determined by the
+ * distance to the camera.
+ *
+ * @param size the size that needs to be translated to screen coordinates.
+ * optional; if not passed, use the default point size.
+ */
+ Graph3d.prototype._calcRadius = function (point, size) {
+ if (size === undefined) {
+ size = this._dotSize();
+ }
+
+ var radius;
+ if (this.showPerspective) {
+ radius = size / -point.trans.z;
+ } else {
+ radius = size * -(this.eye.z / this.camera.getArmLength());
+ }
+ if (radius < 0) {
+ radius = 0;
+ }
+
+ return radius;
+ };
+
+ // -----------------------------------------------------------------------------
+ // Methods for drawing points per graph style.
+ // -----------------------------------------------------------------------------
+
+
+ /**
+ * Draw single datapoint for graph style 'bar'.
+ */
+ Graph3d.prototype._redrawBarGraphPoint = function (ctx, point) {
+ var xWidth = this.xBarWidth / 2;
+ var yWidth = this.yBarWidth / 2;
+ var colors = this._getColorsRegular(point);
+
+ this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'bar-color'.
+ */
+ Graph3d.prototype._redrawBarColorGraphPoint = function (ctx, point) {
+ var xWidth = this.xBarWidth / 2;
+ var yWidth = this.yBarWidth / 2;
+ var colors = this._getColorsColor(point);
+
+ this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'bar-size'.
+ */
+ Graph3d.prototype._redrawBarSizeGraphPoint = function (ctx, point) {
+ // calculate size for the bar
+ var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range();
+ var xWidth = this.xBarWidth / 2 * (fraction * 0.8 + 0.2);
+ var yWidth = this.yBarWidth / 2 * (fraction * 0.8 + 0.2);
+
+ var colors = this._getColorsSize();
+
+ this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'dot'.
+ */
+ Graph3d.prototype._redrawDotGraphPoint = function (ctx, point) {
+ var colors = this._getColorsRegular(point);
+
+ this._drawCircle(ctx, point, colors.fill, colors.border);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'dot-line'.
+ */
+ Graph3d.prototype._redrawDotLineGraphPoint = function (ctx, point) {
+ // draw a vertical line from the XY-plane to the graph value
+ var from = this._convert3Dto2D(point.bottom);
+ ctx.lineWidth = 1;
+ this._line(ctx, from, point.screen, this.gridColor);
+
+ this._redrawDotGraphPoint(ctx, point);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'dot-color'.
+ */
+ Graph3d.prototype._redrawDotColorGraphPoint = function (ctx, point) {
+ var colors = this._getColorsColor(point);
+
+ this._drawCircle(ctx, point, colors.fill, colors.border);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'dot-size'.
+ */
+ Graph3d.prototype._redrawDotSizeGraphPoint = function (ctx, point) {
+ var dotSize = this._dotSize();
+ var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range();
+ var size = dotSize / 2 + 2 * dotSize * fraction;
+ var colors = this._getColorsSize();
+
+ this._drawCircle(ctx, point, colors.fill, colors.border, size);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'surface'.
+ */
+ Graph3d.prototype._redrawSurfaceGraphPoint = function (ctx, point) {
+ var right = point.pointRight;
+ var top = point.pointTop;
+ var cross = point.pointCross;
+
+ if (point === undefined || right === undefined || top === undefined || cross === undefined) {
+ return;
+ }
+
+ var topSideVisible = true;
+ var fillStyle;
+ var strokeStyle;
+ var lineWidth;
+
+ if (this.showGrayBottom || this.showShadow) {
+ // calculate the cross product of the two vectors from center
+ // to left and right, in order to know whether we are looking at the
+ // bottom or at the top side. We can also use the cross product
+ // for calculating light intensity
+ var aDiff = Point3d.subtract(cross.trans, point.trans);
+ var bDiff = Point3d.subtract(top.trans, right.trans);
+ var crossproduct = Point3d.crossProduct(aDiff, bDiff);
+ var len = crossproduct.length();
+ // FIXME: there is a bug with determining the surface side (shadow or colored)
+
+ topSideVisible = crossproduct.z > 0;
+ }
+
+ if (topSideVisible) {
+
+ // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0
+ var zAvg = (point.point.z + right.point.z + top.point.z + cross.point.z) / 4;
+ var h = (1 - (zAvg - this.zRange.min) * this.scale.z / this.verticalRatio) * 240;
+ var s = 1; // saturation
+ var v;
+
+ if (this.showShadow) {
+ v = Math.min(1 + crossproduct.x / len / 2, 1); // value. TODO: scale
+ fillStyle = this._hsv2rgb(h, s, v);
+ strokeStyle = fillStyle;
+ } else {
+ v = 1;
+ fillStyle = this._hsv2rgb(h, s, v);
+ strokeStyle = this.axisColor; // TODO: should be customizable
+ }
+ } else {
+ fillStyle = 'gray';
+ strokeStyle = this.axisColor;
+ }
+
+ ctx.lineWidth = this._getStrokeWidth(point);
+ // TODO: only draw stroke when strokeWidth > 0
+
+ var points = [point, right, cross, top];
+ this._polygon(ctx, points, fillStyle, strokeStyle);
+ };
+
+ /**
+ * Helper method for _redrawGridGraphPoint()
+ */
+ Graph3d.prototype._drawGridLine = function (ctx, from, to) {
+ if (from === undefined || to === undefined) {
+ return;
+ }
+
+ // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0
+ var zAvg = (from.point.z + to.point.z) / 2;
+ var h = (1 - (zAvg - this.zRange.min) * this.scale.z / this.verticalRatio) * 240;
+
+ ctx.lineWidth = this._getStrokeWidth(from) * 2;
+ ctx.strokeStyle = this._hsv2rgb(h, 1, 1);
+ this._line(ctx, from.screen, to.screen);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'Grid'.
+ */
+ Graph3d.prototype._redrawGridGraphPoint = function (ctx, point) {
+ this._drawGridLine(ctx, point, point.pointRight);
+ this._drawGridLine(ctx, point, point.pointTop);
+ };
+
+ /**
+ * Draw single datapoint for graph style 'line'.
+ */
+ Graph3d.prototype._redrawLineGraphPoint = function (ctx, point) {
+ if (point.pointNext === undefined) {
+ return;
+ }
+
+ ctx.lineWidth = this._getStrokeWidth(point);
+ ctx.strokeStyle = this.dataColor.stroke;
+
+ this._line(ctx, point.screen, point.pointNext.screen);
+ };
+
+ /**
+ * Draw all datapoints for currently selected graph style.
+ *
+ */
+ Graph3d.prototype._redrawDataGraph = function () {
+ var ctx = this._getContext();
+ var i;
+
+ if (this.dataPoints === undefined || this.dataPoints.length <= 0) return; // TODO: throw exception?
+
+ this._calcTranslations(this.dataPoints);
+
+ for (i = 0; i < this.dataPoints.length; i++) {
+ var point = this.dataPoints[i];
+
+ // Using call() ensures that the correct context is used
+ this._pointDrawingMethod.call(this, ctx, point);
+ }
+ };
+
+ // -----------------------------------------------------------------------------
+ // End methods for drawing points per graph style.
+ // -----------------------------------------------------------------------------
+
+ /**
+ * Store startX, startY and startOffset for mouse operations
+ *
+ * @param {Event} event The event that occurred
+ */
+ Graph3d.prototype._storeMousePosition = function (event) {
+ // get mouse position (different code for IE and all other browsers)
+ this.startMouseX = getMouseX(event);
+ this.startMouseY = getMouseY(event);
+
+ this._startCameraOffset = this.camera.getOffset();
+ };
+
+ /**
+ * Start a moving operation inside the provided parent element
+ * @param {Event} event The event that occurred (required for
+ * retrieving the mouse position)
+ */
+ Graph3d.prototype._onMouseDown = function (event) {
+ event = event || window.event;
+
+ // check if mouse is still down (may be up when focus is lost for example
+ // in an iframe)
+ if (this.leftButtonDown) {
+ this._onMouseUp(event);
+ }
+
+ // only react on left mouse button down
+ this.leftButtonDown = event.which ? event.which === 1 : event.button === 1;
+ if (!this.leftButtonDown && !this.touchDown) return;
+
+ this._storeMousePosition(event);
+
+ this.startStart = new Date(this.start);
+ this.startEnd = new Date(this.end);
+ this.startArmRotation = this.camera.getArmRotation();
+
+ this.frame.style.cursor = 'move';
+
+ // add event listeners to handle moving the contents
+ // we store the function onmousemove and onmouseup in the graph, so we can
+ // remove the eventlisteners lateron in the function mouseUp()
+ var me = this;
+ this.onmousemove = function (event) {
+ me._onMouseMove(event);
+ };
+ this.onmouseup = function (event) {
+ me._onMouseUp(event);
+ };
+ util.addEventListener(document, 'mousemove', me.onmousemove);
+ util.addEventListener(document, 'mouseup', me.onmouseup);
+ util.preventDefault(event);
+ };
+
+ /**
+ * Perform moving operating.
+ * This function activated from within the funcion Graph.mouseDown().
+ * @param {Event} event Well, eehh, the event
+ */
+ Graph3d.prototype._onMouseMove = function (event) {
+ this.moving = true;
+ event = event || window.event;
+
+ // calculate change in mouse position
+ var diffX = parseFloat(getMouseX(event)) - this.startMouseX;
+ var diffY = parseFloat(getMouseY(event)) - this.startMouseY;
+
+ // move with ctrl or rotate by other
+ if (event && event.ctrlKey === true) {
+ // calculate change in mouse position
+ var scaleX = this.frame.clientWidth * 0.5;
+ var scaleY = this.frame.clientHeight * 0.5;
+
+ var offXNew = (this._startCameraOffset.x || 0) - diffX / scaleX * this.camera.armLength * 0.8;
+ var offYNew = (this._startCameraOffset.y || 0) + diffY / scaleY * this.camera.armLength * 0.8;
+
+ this.camera.setOffset(offXNew, offYNew);
+ this._storeMousePosition(event);
+ } else {
+ var horizontalNew = this.startArmRotation.horizontal + diffX / 200;
+ var verticalNew = this.startArmRotation.vertical + diffY / 200;
+
+ var snapAngle = 4; // degrees
+ var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI);
+
+ // snap horizontally to nice angles at 0pi, 0.5pi, 1pi, 1.5pi, etc...
+ // the -0.001 is to take care that the vertical axis is always drawn at the left front corner
+ if (Math.abs(Math.sin(horizontalNew)) < snapValue) {
+ horizontalNew = Math.round(horizontalNew / Math.PI) * Math.PI - 0.001;
+ }
+ if (Math.abs(Math.cos(horizontalNew)) < snapValue) {
+ horizontalNew = (Math.round(horizontalNew / Math.PI - 0.5) + 0.5) * Math.PI - 0.001;
+ }
+
+ // snap vertically to nice angles
+ if (Math.abs(Math.sin(verticalNew)) < snapValue) {
+ verticalNew = Math.round(verticalNew / Math.PI) * Math.PI;
+ }
+ if (Math.abs(Math.cos(verticalNew)) < snapValue) {
+ verticalNew = (Math.round(verticalNew / Math.PI - 0.5) + 0.5) * Math.PI;
+ }
+ this.camera.setArmRotation(horizontalNew, verticalNew);
+ }
+
+ this.redraw();
+
+ // fire a cameraPositionChange event
+ var parameters = this.getCameraPosition();
+ this.emit('cameraPositionChange', parameters);
+
+ util.preventDefault(event);
+ };
+
+ /**
+ * Stop moving operating.
+ * This function activated from within the funcion Graph.mouseDown().
+ * @param {event} event The event
+ */
+ Graph3d.prototype._onMouseUp = function (event) {
+ this.frame.style.cursor = 'auto';
+ this.leftButtonDown = false;
+
+ // remove event listeners here
+ util.removeEventListener(document, 'mousemove', this.onmousemove);
+ util.removeEventListener(document, 'mouseup', this.onmouseup);
+ util.preventDefault(event);
+ };
+
+ /**
+ * @param {event} event The event
+ */
+ Graph3d.prototype._onClick = function (event) {
+ if (!this.onclick_callback) return;
+ if (!this.moving) {
+ var boundingRect = this.frame.getBoundingClientRect();
+ var mouseX = getMouseX(event) - boundingRect.left;
+ var mouseY = getMouseY(event) - boundingRect.top;
+ var dataPoint = this._dataPointFromXY(mouseX, mouseY);
+ if (dataPoint) this.onclick_callback(dataPoint.point.data);
+ } else {
+ // disable onclick callback, if it came immediately after rotate/pan
+ this.moving = false;
+ }
+ util.preventDefault(event);
+ };
+
+ /**
+ * After having moved the mouse, a tooltip should pop up when the mouse is resting on a data point
+ * @param {Event} event A mouse move event
+ */
+ Graph3d.prototype._onTooltip = function (event) {
+ var delay = 300; // ms
+ var boundingRect = this.frame.getBoundingClientRect();
+ var mouseX = getMouseX(event) - boundingRect.left;
+ var mouseY = getMouseY(event) - boundingRect.top;
+
+ if (!this.showTooltip) {
+ return;
+ }
+
+ if (this.tooltipTimeout) {
+ clearTimeout(this.tooltipTimeout);
+ }
+
+ // (delayed) display of a tooltip only if no mouse button is down
+ if (this.leftButtonDown) {
+ this._hideTooltip();
+ return;
+ }
+
+ if (this.tooltip && this.tooltip.dataPoint) {
+ // tooltip is currently visible
+ var dataPoint = this._dataPointFromXY(mouseX, mouseY);
+ if (dataPoint !== this.tooltip.dataPoint) {
+ // datapoint changed
+ if (dataPoint) {
+ this._showTooltip(dataPoint);
+ } else {
+ this._hideTooltip();
+ }
+ }
+ } else {
+ // tooltip is currently not visible
+ var me = this;
+ this.tooltipTimeout = setTimeout(function () {
+ me.tooltipTimeout = null;
+
+ // show a tooltip if we have a data point
+ var dataPoint = me._dataPointFromXY(mouseX, mouseY);
+ if (dataPoint) {
+ me._showTooltip(dataPoint);
+ }
+ }, delay);
+ }
+ };
+
+ /**
+ * Event handler for touchstart event on mobile devices
+ */
+ Graph3d.prototype._onTouchStart = function (event) {
+ this.touchDown = true;
+
+ var me = this;
+ this.ontouchmove = function (event) {
+ me._onTouchMove(event);
+ };
+ this.ontouchend = function (event) {
+ me._onTouchEnd(event);
+ };
+ util.addEventListener(document, 'touchmove', me.ontouchmove);
+ util.addEventListener(document, 'touchend', me.ontouchend);
+
+ this._onMouseDown(event);
+ };
+
+ /**
+ * Event handler for touchmove event on mobile devices
+ */
+ Graph3d.prototype._onTouchMove = function (event) {
+ this._onMouseMove(event);
+ };
+
+ /**
+ * Event handler for touchend event on mobile devices
+ */
+ Graph3d.prototype._onTouchEnd = function (event) {
+ this.touchDown = false;
+
+ util.removeEventListener(document, 'touchmove', this.ontouchmove);
+ util.removeEventListener(document, 'touchend', this.ontouchend);
+
+ this._onMouseUp(event);
+ };
+
+ /**
+ * Event handler for mouse wheel event, used to zoom the graph
+ * Code from http://adomas.org/javascript-mouse-wheel/
+ * @param {event} event The event
+ */
+ Graph3d.prototype._onWheel = function (event) {
+ if (!event) /* For IE. */
+ event = window.event;
+
+ // retrieve delta
+ var delta = 0;
+ if (event.wheelDelta) {
+ /* IE/Opera. */
+ delta = event.wheelDelta / 120;
+ } else if (event.detail) {
+ /* Mozilla case. */
+ // In Mozilla, sign of delta is different than in IE.
+ // Also, delta is multiple of 3.
+ delta = -event.detail / 3;
+ }
+
+ // If delta is nonzero, handle it.
+ // Basically, delta is now positive if wheel was scrolled up,
+ // and negative, if wheel was scrolled down.
+ if (delta) {
+ var oldLength = this.camera.getArmLength();
+ var newLength = oldLength * (1 - delta / 10);
+
+ this.camera.setArmLength(newLength);
+ this.redraw();
+
+ this._hideTooltip();
+ }
+
+ // fire a cameraPositionChange event
+ var parameters = this.getCameraPosition();
+ this.emit('cameraPositionChange', parameters);
+
+ // Prevent default actions caused by mouse wheel.
+ // That might be ugly, but we handle scrolls somehow
+ // anyway, so don't bother here..
+ util.preventDefault(event);
+ };
+
+ /**
+ * Test whether a point lies inside given 2D triangle
+ *
+ * @param {Point2d} point
+ * @param {Point2d[]} triangle
+ * @returns {boolean} true if given point lies inside or on the edge of the
+ * triangle, false otherwise
+ * @private
+ */
+ Graph3d.prototype._insideTriangle = function (point, triangle) {
+ var a = triangle[0],
+ b = triangle[1],
+ c = triangle[2];
+
+ function sign(x) {
+ return x > 0 ? 1 : x < 0 ? -1 : 0;
+ }
+
+ var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x));
+ var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x));
+ var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x));
+
+ // each of the three signs must be either equal to each other or zero
+ return (as == 0 || bs == 0 || as == bs) && (bs == 0 || cs == 0 || bs == cs) && (as == 0 || cs == 0 || as == cs);
+ };
+
+ /**
+ * Find a data point close to given screen position (x, y)
+ *
+ * @param {Number} x
+ * @param {Number} y
+ * @returns {Object | null} The closest data point or null if not close to any
+ * data point
+ * @private
+ */
+ Graph3d.prototype._dataPointFromXY = function (x, y) {
+ var i,
+ distMax = 100,
+ // px
+ dataPoint = null,
+ closestDataPoint = null,
+ closestDist = null,
+ center = new Point2d(x, y);
+
+ if (this.style === Graph3d.STYLE.BAR || this.style === Graph3d.STYLE.BARCOLOR || this.style === Graph3d.STYLE.BARSIZE) {
+ // the data points are ordered from far away to closest
+ for (i = this.dataPoints.length - 1; i >= 0; i--) {
+ dataPoint = this.dataPoints[i];
+ var surfaces = dataPoint.surfaces;
+ if (surfaces) {
+ for (var s = surfaces.length - 1; s >= 0; s--) {
+ // split each surface in two triangles, and see if the center point is inside one of these
+ var surface = surfaces[s];
+ var corners = surface.corners;
+ var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen];
+ var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen];
+ if (this._insideTriangle(center, triangle1) || this._insideTriangle(center, triangle2)) {
+ // return immediately at the first hit
+ return dataPoint;
+ }
+ }
+ }
+ }
+ } else {
+ // find the closest data point, using distance to the center of the point on 2d screen
+ for (i = 0; i < this.dataPoints.length; i++) {
+ dataPoint = this.dataPoints[i];
+ var point = dataPoint.screen;
+ if (point) {
+ var distX = Math.abs(x - point.x);
+ var distY = Math.abs(y - point.y);
+ var dist = Math.sqrt(distX * distX + distY * distY);
+
+ if ((closestDist === null || dist < closestDist) && dist < distMax) {
+ closestDist = dist;
+ closestDataPoint = dataPoint;
+ }
+ }
+ }
+ }
+
+ return closestDataPoint;
+ };
+
+ /**
+ * Display a tooltip for given data point
+ * @param {Object} dataPoint
+ * @private
+ */
+ Graph3d.prototype._showTooltip = function (dataPoint) {
+ var content, line, dot;
+
+ if (!this.tooltip) {
+ content = document.createElement('div');
+ content.style.position = 'absolute';
+ content.style.padding = '10px';
+ content.style.border = '1px solid #4d4d4d';
+ content.style.color = '#1a1a1a';
+ content.style.background = 'rgba(255,255,255,0.7)';
+ content.style.borderRadius = '2px';
+ content.style.boxShadow = '5px 5px 10px rgba(128,128,128,0.5)';
+
+ line = document.createElement('div');
+ line.style.position = 'absolute';
+ line.style.height = '40px';
+ line.style.width = '0';
+ line.style.borderLeft = '1px solid #4d4d4d';
+
+ dot = document.createElement('div');
+ dot.style.position = 'absolute';
+ dot.style.height = '0';
+ dot.style.width = '0';
+ dot.style.border = '5px solid #4d4d4d';
+ dot.style.borderRadius = '5px';
+
+ this.tooltip = {
+ dataPoint: null,
+ dom: {
+ content: content,
+ line: line,
+ dot: dot
+ }
+ };
+ } else {
+ content = this.tooltip.dom.content;
+ line = this.tooltip.dom.line;
+ dot = this.tooltip.dom.dot;
+ }
+
+ this._hideTooltip();
+
+ this.tooltip.dataPoint = dataPoint;
+ if (typeof this.showTooltip === 'function') {
+ content.innerHTML = this.showTooltip(dataPoint.point);
+ } else {
+ content.innerHTML = '<table>' + '<tr><td>' + this.xLabel + ':</td><td>' + dataPoint.point.x + '</td></tr>' + '<tr><td>' + this.yLabel + ':</td><td>' + dataPoint.point.y + '</td></tr>' + '<tr><td>' + this.zLabel + ':</td><td>' + dataPoint.point.z + '</td></tr>' + '</table>';
+ }
+
+ content.style.left = '0';
+ content.style.top = '0';
+ this.frame.appendChild(content);
+ this.frame.appendChild(line);
+ this.frame.appendChild(dot);
+
+ // calculate sizes
+ var contentWidth = content.offsetWidth;
+ var contentHeight = content.offsetHeight;
+ var lineHeight = line.offsetHeight;
+ var dotWidth = dot.offsetWidth;
+ var dotHeight = dot.offsetHeight;
+
+ var left = dataPoint.screen.x - contentWidth / 2;
+ left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth);
+
+ line.style.left = dataPoint.screen.x + 'px';
+ line.style.top = dataPoint.screen.y - lineHeight + 'px';
+ content.style.left = left + 'px';
+ content.style.top = dataPoint.screen.y - lineHeight - contentHeight + 'px';
+ dot.style.left = dataPoint.screen.x - dotWidth / 2 + 'px';
+ dot.style.top = dataPoint.screen.y - dotHeight / 2 + 'px';
+ };
+
+ /**
+ * Hide the tooltip when displayed
+ * @private
+ */
+ Graph3d.prototype._hideTooltip = function () {
+ if (this.tooltip) {
+ this.tooltip.dataPoint = null;
+
+ for (var prop in this.tooltip.dom) {
+ if (this.tooltip.dom.hasOwnProperty(prop)) {
+ var elem = this.tooltip.dom[prop];
+ if (elem && elem.parentNode) {
+ elem.parentNode.removeChild(elem);
+ }
+ }
+ }
+ }
+ };
+
+ /**--------------------------------------------------------------------------**/
+
+ /**
+ * Get the horizontal mouse position from a mouse event
+ *
+ * @param {Event} event
+ * @returns {Number} mouse x
+ */
+ function getMouseX(event) {
+ if ('clientX' in event) return event.clientX;
+ return event.targetTouches[0] && event.targetTouches[0].clientX || 0;
+ }
+
+ /**
+ * Get the vertical mouse position from a mouse event
+ *
+ * @param {Event} event
+ * @returns {Number} mouse y
+ */
+ function getMouseY(event) {
+ if ('clientY' in event) return event.clientY;
+ return event.targetTouches[0] && event.targetTouches[0].clientY || 0;
+ }
+
+ // -----------------------------------------------------------------------------
+ // Public methods for specific settings
+ // -----------------------------------------------------------------------------
+
+ /**
+ * Set the rotation and distance of the camera
+ *
+ * @param {Object} pos An object with the camera position
+ * @param {?Number} pos.horizontal The horizontal rotation, between 0 and 2*PI.
+ * Optional, can be left undefined.
+ * @param {?Number} pos.vertical The vertical rotation, between 0 and 0.5*PI.
+ * if vertical=0.5*PI, the graph is shown from
+ * the top. Optional, can be left undefined.
+ * @param {?Number} pos.distance The (normalized) distance of the camera to the
+ * center of the graph, a value between 0.71 and
+ * 5.0. Optional, can be left undefined.
+ */
+ Graph3d.prototype.setCameraPosition = function (pos) {
+ Settings.setCameraPosition(pos, this);
+ this.redraw();
+ };
+
+ /**
+ * Set a new size for the graph
+ *
+ * @param {string} width Width in pixels or percentage (for example '800px'
+ * or '50%')
+ * @param {string} height Height in pixels or percentage (for example '400px'
+ * or '30%')
+ */
+ Graph3d.prototype.setSize = function (width, height) {
+ this._setSize(width, height);
+ this.redraw();
+ };
+
+ // -----------------------------------------------------------------------------
+ // End public methods for specific settings
+ // -----------------------------------------------------------------------------
+
+
+ module.exports = Graph3d;
+
+/***/ },
+/* 95 */
+/***/ function(module, exports) {
+
+
+ /**
+ * Expose `Emitter`.
+ */
+
+ module.exports = Emitter;
+
+ /**
+ * Initialize a new `Emitter`.
+ *
+ * @api public
+ */
+
+ function Emitter(obj) {
+ if (obj) return mixin(obj);
+ };
+
+ /**
+ * Mixin the emitter properties.
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+ function mixin(obj) {
+ for (var key in Emitter.prototype) {
+ obj[key] = Emitter.prototype[key];
+ }
+ return obj;
+ }
+
+ /**
+ * Listen on the given `event` with `fn`.
+ *
+ * @param {String} event
+ * @param {Function} fn
+ * @return {Emitter}
+ * @api public
+ */
+
+ Emitter.prototype.on =
+ Emitter.prototype.addEventListener = function(event, fn){
+ this._callbacks = this._callbacks || {};
+ (this._callbacks[event] = this._callbacks[event] || [])
+ .push(fn);
+ return this;
+ };
+
+ /**
+ * Adds an `event` listener that will be invoked a single
+ * time then automatically removed.
+ *
+ * @param {String} event
+ * @param {Function} fn
+ * @return {Emitter}
+ * @api public
+ */
+
+ Emitter.prototype.once = function(event, fn){
+ var self = this;
+ this._callbacks = this._callbacks || {};
+
+ function on() {
+ self.off(event, on);
+ fn.apply(this, arguments);
+ }
+
+ on.fn = fn;
+ this.on(event, on);
+ return this;
+ };
+
+ /**
+ * Remove the given callback for `event` or all
+ * registered callbacks.
+ *
+ * @param {String} event
+ * @param {Function} fn
+ * @return {Emitter}
+ * @api public
+ */
+
+ Emitter.prototype.off =
+ Emitter.prototype.removeListener =
+ Emitter.prototype.removeAllListeners =
+ Emitter.prototype.removeEventListener = function(event, fn){
+ this._callbacks = this._callbacks || {};
+
+ // all
+ if (0 == arguments.length) {
+ this._callbacks = {};
+ return this;
+ }
+
+ // specific event
+ var callbacks = this._callbacks[event];
+ if (!callbacks) return this;
+
+ // remove all handlers
+ if (1 == arguments.length) {
+ delete this._callbacks[event];
+ return this;
+ }
+
+ // remove specific handler
+ var cb;
+ for (var i = 0; i < callbacks.length; i++) {
+ cb = callbacks[i];
+ if (cb === fn || cb.fn === fn) {
+ callbacks.splice(i, 1);
+ break;
+ }
+ }
+ return this;
+ };
+
+ /**
+ * Emit `event` with the given args.
+ *
+ * @param {String} event
+ * @param {Mixed} ...
+ * @return {Emitter}
+ */
+
+ Emitter.prototype.emit = function(event){
+ this._callbacks = this._callbacks || {};
+ var args = [].slice.call(arguments, 1)
+ , callbacks = this._callbacks[event];
+
+ if (callbacks) {
+ callbacks = callbacks.slice(0);
+ for (var i = 0, len = callbacks.length; i < len; ++i) {
+ callbacks[i].apply(this, args);
+ }
+ }
+
+ return this;
+ };
+
+ /**
+ * Return array of callbacks for `event`.
+ *
+ * @param {String} event
+ * @return {Array}
+ * @api public
+ */
+
+ Emitter.prototype.listeners = function(event){
+ this._callbacks = this._callbacks || {};
+ return this._callbacks[event] || [];
+ };
+
+ /**
+ * Check if this emitter has `event` handlers.
+ *
+ * @param {String} event
+ * @return {Boolean}
+ * @api public
+ */
+
+ Emitter.prototype.hasListeners = function(event){
+ return !! this.listeners(event).length;
+ };
+
+
+/***/ },
+/* 96 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ /**
+ * @prototype Point3d
+ * @param {Number} [x]
+ * @param {Number} [y]
+ * @param {Number} [z]
+ */
+ function Point3d(x, y, z) {
+ this.x = x !== undefined ? x : 0;
+ this.y = y !== undefined ? y : 0;
+ this.z = z !== undefined ? z : 0;
+ };
+
+ /**
+ * Subtract the two provided points, returns a-b
+ * @param {Point3d} a
+ * @param {Point3d} b
+ * @return {Point3d} a-b
+ */
+ Point3d.subtract = function (a, b) {
+ var sub = new Point3d();
+ sub.x = a.x - b.x;
+ sub.y = a.y - b.y;
+ sub.z = a.z - b.z;
+ return sub;
+ };
+
+ /**
+ * Add the two provided points, returns a+b
+ * @param {Point3d} a
+ * @param {Point3d} b
+ * @return {Point3d} a+b
+ */
+ Point3d.add = function (a, b) {
+ var sum = new Point3d();
+ sum.x = a.x + b.x;
+ sum.y = a.y + b.y;
+ sum.z = a.z + b.z;
+ return sum;
+ };
+
+ /**
+ * Calculate the average of two 3d points
+ * @param {Point3d} a
+ * @param {Point3d} b
+ * @return {Point3d} The average, (a+b)/2
+ */
+ Point3d.avg = function (a, b) {
+ return new Point3d((a.x + b.x) / 2, (a.y + b.y) / 2, (a.z + b.z) / 2);
+ };
+
+ /**
+ * Calculate the cross product of the two provided points, returns axb
+ * Documentation: http://en.wikipedia.org/wiki/Cross_product
+ * @param {Point3d} a
+ * @param {Point3d} b
+ * @return {Point3d} cross product axb
+ */
+ Point3d.crossProduct = function (a, b) {
+ var crossproduct = new Point3d();
+
+ crossproduct.x = a.y * b.z - a.z * b.y;
+ crossproduct.y = a.z * b.x - a.x * b.z;
+ crossproduct.z = a.x * b.y - a.y * b.x;
+
+ return crossproduct;
+ };
+
+ /**
+ * Rtrieve the length of the vector (or the distance from this point to the origin
+ * @return {Number} length
+ */
+ Point3d.prototype.length = function () {
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
+ };
+
+ module.exports = Point3d;
+
+/***/ },
+/* 97 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ /**
+ * @prototype Point2d
+ * @param {Number} [x]
+ * @param {Number} [y]
+ */
+ function Point2d(x, y) {
+ this.x = x !== undefined ? x : 0;
+ this.y = y !== undefined ? y : 0;
+ }
+
+ module.exports = Point2d;
+
+/***/ },
+/* 98 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _sign = __webpack_require__(99);
+
+ var _sign2 = _interopRequireDefault(_sign);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Point3d = __webpack_require__(96);
+
+ /**
+ * @class Camera
+ * The camera is mounted on a (virtual) camera arm. The camera arm can rotate
+ * The camera is always looking in the direction of the origin of the arm.
+ * This way, the camera always rotates around one fixed point, the location
+ * of the camera arm.
+ *
+ * Documentation:
+ * http://en.wikipedia.org/wiki/3D_projection
+ */
+ function Camera() {
+ this.armLocation = new Point3d();
+ this.armRotation = {};
+ this.armRotation.horizontal = 0;
+ this.armRotation.vertical = 0;
+ this.armLength = 1.7;
+ this.cameraOffset = new Point3d();
+ this.offsetMultiplier = 0.6;
+
+ this.cameraLocation = new Point3d();
+ this.cameraRotation = new Point3d(0.5 * Math.PI, 0, 0);
+
+ this.calculateCameraOrientation();
+ }
+
+ /**
+ * Set offset camera in camera coordinates
+ * @param {Number} x offset by camera horisontal
+ * @param {Number} y offset by camera vertical
+ */
+ Camera.prototype.setOffset = function (x, y) {
+ var abs = Math.abs,
+ sign = _sign2['default'],
+ mul = this.offsetMultiplier,
+ border = this.armLength * mul;
+
+ if (abs(x) > border) {
+ x = sign(x) * border;
+ }
+ if (abs(y) > border) {
+ y = sign(y) * border;
+ }
+ this.cameraOffset.x = x;
+ this.cameraOffset.y = y;
+ this.calculateCameraOrientation();
+ };
+
+ /**
+ * Get camera offset by horizontal and vertical
+ * @return {Point3d} x - horizontal offset, y - vertical offset, z - not used
+ */
+ Camera.prototype.getOffset = function (x, y) {
+ return this.cameraOffset;
+ };
+
+ /**
+ * Set the location (origin) of the arm
+ * @param {Number} x Normalized value of x
+ * @param {Number} y Normalized value of y
+ * @param {Number} z Normalized value of z
+ */
+ Camera.prototype.setArmLocation = function (x, y, z) {
+ this.armLocation.x = x;
+ this.armLocation.y = y;
+ this.armLocation.z = z;
+
+ this.calculateCameraOrientation();
+ };
+
+ /**
+ * Set the rotation of the camera arm
+ * @param {Number} horizontal The horizontal rotation, between 0 and 2*PI.
+ * Optional, can be left undefined.
+ * @param {Number} vertical The vertical rotation, between 0 and 0.5*PI
+ * if vertical=0.5*PI, the graph is shown from the
+ * top. Optional, can be left undefined.
+ */
+ Camera.prototype.setArmRotation = function (horizontal, vertical) {
+ if (horizontal !== undefined) {
+ this.armRotation.horizontal = horizontal;
+ }
+
+ if (vertical !== undefined) {
+ this.armRotation.vertical = vertical;
+ if (this.armRotation.vertical < 0) this.armRotation.vertical = 0;
+ if (this.armRotation.vertical > 0.5 * Math.PI) this.armRotation.vertical = 0.5 * Math.PI;
+ }
+
+ if (horizontal !== undefined || vertical !== undefined) {
+ this.calculateCameraOrientation();
+ }
+ };
+
+ /**
+ * Retrieve the current arm rotation
+ * @return {object} An object with parameters horizontal and vertical
+ */
+ Camera.prototype.getArmRotation = function () {
+ var rot = {};
+ rot.horizontal = this.armRotation.horizontal;
+ rot.vertical = this.armRotation.vertical;
+
+ return rot;
+ };
+
+ /**
+ * Set the (normalized) length of the camera arm.
+ * @param {Number} length A length between 0.71 and 5.0
+ */
+ Camera.prototype.setArmLength = function (length) {
+ if (length === undefined) return;
+
+ this.armLength = length;
+
+ // Radius must be larger than the corner of the graph,
+ // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the
+ // graph
+ if (this.armLength < 0.71) this.armLength = 0.71;
+ if (this.armLength > 5.0) this.armLength = 5.0;
+
+ this.setOffset(this.cameraOffset.x, this.cameraOffset.y);
+ this.calculateCameraOrientation();
+ };
+
+ /**
+ * Retrieve the arm length
+ * @return {Number} length
+ */
+ Camera.prototype.getArmLength = function () {
+ return this.armLength;
+ };
+
+ /**
+ * Retrieve the camera location
+ * @return {Point3d} cameraLocation
+ */
+ Camera.prototype.getCameraLocation = function () {
+ return this.cameraLocation;
+ };
+
+ /**
+ * Retrieve the camera rotation
+ * @return {Point3d} cameraRotation
+ */
+ Camera.prototype.getCameraRotation = function () {
+ return this.cameraRotation;
+ };
+
+ /**
+ * Calculate the location and rotation of the camera based on the
+ * position and orientation of the camera arm
+ */
+ Camera.prototype.calculateCameraOrientation = function () {
+ // calculate location of the camera
+ this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical);
+ this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical);
+ this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical);
+
+ // calculate rotation of the camera
+ this.cameraRotation.x = Math.PI / 2 - this.armRotation.vertical;
+ this.cameraRotation.y = 0;
+ this.cameraRotation.z = -this.armRotation.horizontal;
+
+ var xa = this.cameraRotation.x;
+ var ya = this.cameraRotation.y;
+ var za = this.cameraRotation.z;
+ var dx = this.cameraOffset.x;
+ var dy = this.cameraOffset.y;
+ var sin = Math.sin,
+ cos = Math.cos;
+
+ this.cameraLocation.x = this.cameraLocation.x + dx * cos(za) + dy * -sin(za) * cos(xa);
+ this.cameraLocation.y = this.cameraLocation.y + dx * sin(za) + dy * cos(za) * cos(xa);
+ this.cameraLocation.z = this.cameraLocation.z + dy * sin(xa);
+ };
+
+ module.exports = Camera;
+
+/***/ },
+/* 99 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(100), __esModule: true };
+
+/***/ },
+/* 100 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(101);
+ module.exports = __webpack_require__(17).Math.sign;
+
+/***/ },
+/* 101 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 20.2.2.28 Math.sign(x)
+ var $export = __webpack_require__(15);
+
+ $export($export.S, 'Math', {sign: __webpack_require__(102)});
+
+/***/ },
+/* 102 */
+/***/ function(module, exports) {
+
+ // 20.2.2.28 Math.sign(x)
+ module.exports = Math.sign || function sign(x){
+ return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
+ };
+
+/***/ },
+/* 103 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var DataView = __webpack_require__(93);
+
+ /**
+ * @class Filter
+ *
+ * @param {DataSet} data The google data table
+ * @param {Number} column The index of the column to be filtered
+ * @param {Graph} graph The graph
+ */
+ function Filter(data, column, graph) {
+ this.data = data;
+ this.column = column;
+ this.graph = graph; // the parent graph
+
+ this.index = undefined;
+ this.value = undefined;
+
+ // read all distinct values and select the first one
+ this.values = graph.getDistinctValues(data.get(), this.column);
+
+ // sort both numeric and string values correctly
+ this.values.sort(function (a, b) {
+ return a > b ? 1 : a < b ? -1 : 0;
+ });
+
+ if (this.values.length > 0) {
+ this.selectValue(0);
+ }
+
+ // create an array with the filtered datapoints. this will be loaded afterwards
+ this.dataPoints = [];
+
+ this.loaded = false;
+ this.onLoadCallback = undefined;
+
+ if (graph.animationPreload) {
+ this.loaded = false;
+ this.loadInBackground();
+ } else {
+ this.loaded = true;
+ }
+ };
+
+ /**
+ * Return the label
+ * @return {string} label
+ */
+ Filter.prototype.isLoaded = function () {
+ return this.loaded;
+ };
+
+ /**
+ * Return the loaded progress
+ * @return {Number} percentage between 0 and 100
+ */
+ Filter.prototype.getLoadedProgress = function () {
+ var len = this.values.length;
+
+ var i = 0;
+ while (this.dataPoints[i]) {
+ i++;
+ }
+
+ return Math.round(i / len * 100);
+ };
+
+ /**
+ * Return the label
+ * @return {string} label
+ */
+ Filter.prototype.getLabel = function () {
+ return this.graph.filterLabel;
+ };
+
+ /**
+ * Return the columnIndex of the filter
+ * @return {Number} columnIndex
+ */
+ Filter.prototype.getColumn = function () {
+ return this.column;
+ };
+
+ /**
+ * Return the currently selected value. Returns undefined if there is no selection
+ * @return {*} value
+ */
+ Filter.prototype.getSelectedValue = function () {
+ if (this.index === undefined) return undefined;
+
+ return this.values[this.index];
+ };
+
+ /**
+ * Retrieve all values of the filter
+ * @return {Array} values
+ */
+ Filter.prototype.getValues = function () {
+ return this.values;
+ };
+
+ /**
+ * Retrieve one value of the filter
+ * @param {Number} index
+ * @return {*} value
+ */
+ Filter.prototype.getValue = function (index) {
+ if (index >= this.values.length) throw new Error('Index out of range');
+
+ return this.values[index];
+ };
+
+ /**
+ * Retrieve the (filtered) dataPoints for the currently selected filter index
+ * @param {Number} [index] (optional)
+ * @return {Array} dataPoints
+ */
+ Filter.prototype._getDataPoints = function (index) {
+ if (index === undefined) index = this.index;
+
+ if (index === undefined) return [];
+
+ var dataPoints;
+ if (this.dataPoints[index]) {
+ dataPoints = this.dataPoints[index];
+ } else {
+ var f = {};
+ f.column = this.column;
+ f.value = this.values[index];
+
+ var dataView = new DataView(this.data, { filter: function filter(item) {
+ return item[f.column] == f.value;
+ } }).get();
+ dataPoints = this.graph._getDataPoints(dataView);
+
+ this.dataPoints[index] = dataPoints;
+ }
+
+ return dataPoints;
+ };
+
+ /**
+ * Set a callback function when the filter is fully loaded.
+ */
+ Filter.prototype.setOnLoadCallback = function (callback) {
+ this.onLoadCallback = callback;
+ };
+
+ /**
+ * Add a value to the list with available values for this filter
+ * No double entries will be created.
+ * @param {Number} index
+ */
+ Filter.prototype.selectValue = function (index) {
+ if (index >= this.values.length) throw new Error('Index out of range');
+
+ this.index = index;
+ this.value = this.values[index];
+ };
+
+ /**
+ * Load all filtered rows in the background one by one
+ * Start this method without providing an index!
+ */
+ Filter.prototype.loadInBackground = function (index) {
+ if (index === undefined) index = 0;
+
+ var frame = this.graph.frame;
+
+ if (index < this.values.length) {
+ var dataPointsTemp = this._getDataPoints(index);
+ //this.graph.redrawInfo(); // TODO: not neat
+
+ // create a progress box
+ if (frame.progress === undefined) {
+ frame.progress = document.createElement('DIV');
+ frame.progress.style.position = 'absolute';
+ frame.progress.style.color = 'gray';
+ frame.appendChild(frame.progress);
+ }
+ var progress = this.getLoadedProgress();
+ frame.progress.innerHTML = 'Loading animation... ' + progress + '%';
+ // TODO: this is no nice solution...
+ frame.progress.style.bottom = 60 + 'px'; // TODO: use height of slider
+ frame.progress.style.left = 10 + 'px';
+
+ var me = this;
+ setTimeout(function () {
+ me.loadInBackground(index + 1);
+ }, 10);
+ this.loaded = false;
+ } else {
+ this.loaded = true;
+
+ // remove the progress box
+ if (frame.progress !== undefined) {
+ frame.removeChild(frame.progress);
+ frame.progress = undefined;
+ }
+
+ if (this.onLoadCallback) this.onLoadCallback();
+ }
+ };
+
+ module.exports = Filter;
+
+/***/ },
+/* 104 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var util = __webpack_require__(1);
+
+ /**
+ * @constructor Slider
+ *
+ * An html slider control with start/stop/prev/next buttons
+ * @param {Element} container The element where the slider will be created
+ * @param {Object} options Available options:
+ * {boolean} visible If true (default) the
+ * slider is visible.
+ */
+ function Slider(container, options) {
+ if (container === undefined) {
+ throw new Error('No container element defined');
+ }
+ this.container = container;
+ this.visible = options && options.visible != undefined ? options.visible : true;
+
+ if (this.visible) {
+ this.frame = document.createElement('DIV');
+ //this.frame.style.backgroundColor = '#E5E5E5';
+ this.frame.style.width = '100%';
+ this.frame.style.position = 'relative';
+ this.container.appendChild(this.frame);
+
+ this.frame.prev = document.createElement('INPUT');
+ this.frame.prev.type = 'BUTTON';
+ this.frame.prev.value = 'Prev';
+ this.frame.appendChild(this.frame.prev);
+
+ this.frame.play = document.createElement('INPUT');
+ this.frame.play.type = 'BUTTON';
+ this.frame.play.value = 'Play';
+ this.frame.appendChild(this.frame.play);
+
+ this.frame.next = document.createElement('INPUT');
+ this.frame.next.type = 'BUTTON';
+ this.frame.next.value = 'Next';
+ this.frame.appendChild(this.frame.next);
+
+ this.frame.bar = document.createElement('INPUT');
+ this.frame.bar.type = 'BUTTON';
+ this.frame.bar.style.position = 'absolute';
+ this.frame.bar.style.border = '1px solid red';
+ this.frame.bar.style.width = '100px';
+ this.frame.bar.style.height = '6px';
+ this.frame.bar.style.borderRadius = '2px';
+ this.frame.bar.style.MozBorderRadius = '2px';
+ this.frame.bar.style.border = '1px solid #7F7F7F';
+ this.frame.bar.style.backgroundColor = '#E5E5E5';
+ this.frame.appendChild(this.frame.bar);
+
+ this.frame.slide = document.createElement('INPUT');
+ this.frame.slide.type = 'BUTTON';
+ this.frame.slide.style.margin = '0px';
+ this.frame.slide.value = ' ';
+ this.frame.slide.style.position = 'relative';
+ this.frame.slide.style.left = '-100px';
+ this.frame.appendChild(this.frame.slide);
+
+ // create events
+ var me = this;
+ this.frame.slide.onmousedown = function (event) {
+ me._onMouseDown(event);
+ };
+ this.frame.prev.onclick = function (event) {
+ me.prev(event);
+ };
+ this.frame.play.onclick = function (event) {
+ me.togglePlay(event);
+ };
+ this.frame.next.onclick = function (event) {
+ me.next(event);
+ };
+ }
+
+ this.onChangeCallback = undefined;
+
+ this.values = [];
+ this.index = undefined;
+
+ this.playTimeout = undefined;
+ this.playInterval = 1000; // milliseconds
+ this.playLoop = true;
+ }
+
+ /**
+ * Select the previous index
+ */
+ Slider.prototype.prev = function () {
+ var index = this.getIndex();
+ if (index > 0) {
+ index--;
+ this.setIndex(index);
+ }
+ };
+
+ /**
+ * Select the next index
+ */
+ Slider.prototype.next = function () {
+ var index = this.getIndex();
+ if (index < this.values.length - 1) {
+ index++;
+ this.setIndex(index);
+ }
+ };
+
+ /**
+ * Select the next index
+ */
+ Slider.prototype.playNext = function () {
+ var start = new Date();
+
+ var index = this.getIndex();
+ if (index < this.values.length - 1) {
+ index++;
+ this.setIndex(index);
+ } else if (this.playLoop) {
+ // jump to the start
+ index = 0;
+ this.setIndex(index);
+ }
+
+ var end = new Date();
+ var diff = end - start;
+
+ // calculate how much time it to to set the index and to execute the callback
+ // function.
+ var interval = Math.max(this.playInterval - diff, 0);
+ // document.title = diff // TODO: cleanup
+
+ var me = this;
+ this.playTimeout = setTimeout(function () {
+ me.playNext();
+ }, interval);
+ };
+
+ /**
+ * Toggle start or stop playing
+ */
+ Slider.prototype.togglePlay = function () {
+ if (this.playTimeout === undefined) {
+ this.play();
+ } else {
+ this.stop();
+ }
+ };
+
+ /**
+ * Start playing
+ */
+ Slider.prototype.play = function () {
+ // Test whether already playing
+ if (this.playTimeout) return;
+
+ this.playNext();
+
+ if (this.frame) {
+ this.frame.play.value = 'Stop';
+ }
+ };
+
+ /**
+ * Stop playing
+ */
+ Slider.prototype.stop = function () {
+ clearInterval(this.playTimeout);
+ this.playTimeout = undefined;
+
+ if (this.frame) {
+ this.frame.play.value = 'Play';
+ }
+ };
+
+ /**
+ * Set a callback function which will be triggered when the value of the
+ * slider bar has changed.
+ */
+ Slider.prototype.setOnChangeCallback = function (callback) {
+ this.onChangeCallback = callback;
+ };
+
+ /**
+ * Set the interval for playing the list
+ * @param {Number} interval The interval in milliseconds
+ */
+ Slider.prototype.setPlayInterval = function (interval) {
+ this.playInterval = interval;
+ };
+
+ /**
+ * Retrieve the current play interval
+ * @return {Number} interval The interval in milliseconds
+ */
+ Slider.prototype.getPlayInterval = function (interval) {
+ return this.playInterval;
+ };
+
+ /**
+ * Set looping on or off
+ * @pararm {boolean} doLoop If true, the slider will jump to the start when
+ * the end is passed, and will jump to the end
+ * when the start is passed.
+ */
+ Slider.prototype.setPlayLoop = function (doLoop) {
+ this.playLoop = doLoop;
+ };
+
+ /**
+ * Execute the onchange callback function
+ */
+ Slider.prototype.onChange = function () {
+ if (this.onChangeCallback !== undefined) {
+ this.onChangeCallback();
+ }
+ };
+
+ /**
+ * redraw the slider on the correct place
+ */
+ Slider.prototype.redraw = function () {
+ if (this.frame) {
+ // resize the bar
+ this.frame.bar.style.top = this.frame.clientHeight / 2 - this.frame.bar.offsetHeight / 2 + 'px';
+ this.frame.bar.style.width = this.frame.clientWidth - this.frame.prev.clientWidth - this.frame.play.clientWidth - this.frame.next.clientWidth - 30 + 'px';
+
+ // position the slider button
+ var left = this.indexToLeft(this.index);
+ this.frame.slide.style.left = left + 'px';
+ }
+ };
+
+ /**
+ * Set the list with values for the slider
+ * @param {Array} values A javascript array with values (any type)
+ */
+ Slider.prototype.setValues = function (values) {
+ this.values = values;
+
+ if (this.values.length > 0) this.setIndex(0);else this.index = undefined;
+ };
+
+ /**
+ * Select a value by its index
+ * @param {Number} index
+ */
+ Slider.prototype.setIndex = function (index) {
+ if (index < this.values.length) {
+ this.index = index;
+
+ this.redraw();
+ this.onChange();
+ } else {
+ throw new Error('Index out of range');
+ }
+ };
+
+ /**
+ * retrieve the index of the currently selected vaue
+ * @return {Number} index
+ */
+ Slider.prototype.getIndex = function () {
+ return this.index;
+ };
+
+ /**
+ * retrieve the currently selected value
+ * @return {*} value
+ */
+ Slider.prototype.get = function () {
+ return this.values[this.index];
+ };
+
+ Slider.prototype._onMouseDown = function (event) {
+ // only react on left mouse button down
+ var leftButtonDown = event.which ? event.which === 1 : event.button === 1;
+ if (!leftButtonDown) return;
+
+ this.startClientX = event.clientX;
+ this.startSlideX = parseFloat(this.frame.slide.style.left);
+
+ this.frame.style.cursor = 'move';
+
+ // add event listeners to handle moving the contents
+ // we store the function onmousemove and onmouseup in the graph, so we can
+ // remove the eventlisteners lateron in the function mouseUp()
+ var me = this;
+ this.onmousemove = function (event) {
+ me._onMouseMove(event);
+ };
+ this.onmouseup = function (event) {
+ me._onMouseUp(event);
+ };
+ util.addEventListener(document, 'mousemove', this.onmousemove);
+ util.addEventListener(document, 'mouseup', this.onmouseup);
+ util.preventDefault(event);
+ };
+
+ Slider.prototype.leftToIndex = function (left) {
+ var width = parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10;
+ var x = left - 3;
+
+ var index = Math.round(x / width * (this.values.length - 1));
+ if (index < 0) index = 0;
+ if (index > this.values.length - 1) index = this.values.length - 1;
+
+ return index;
+ };
+
+ Slider.prototype.indexToLeft = function (index) {
+ var width = parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10;
+
+ var x = index / (this.values.length - 1) * width;
+ var left = x + 3;
+
+ return left;
+ };
+
+ Slider.prototype._onMouseMove = function (event) {
+ var diff = event.clientX - this.startClientX;
+ var x = this.startSlideX + diff;
+
+ var index = this.leftToIndex(x);
+
+ this.setIndex(index);
+
+ util.preventDefault();
+ };
+
+ Slider.prototype._onMouseUp = function (event) {
+ this.frame.style.cursor = 'auto';
+
+ // remove event listeners
+ util.removeEventListener(document, 'mousemove', this.onmousemove);
+ util.removeEventListener(document, 'mouseup', this.onmouseup);
+
+ util.preventDefault();
+ };
+
+ module.exports = Slider;
+
+/***/ },
+/* 105 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * @prototype StepNumber
+ * The class StepNumber is an iterator for Numbers. You provide a start and end
+ * value, and a best step size. StepNumber itself rounds to fixed values and
+ * a finds the step that best fits the provided step.
+ *
+ * If prettyStep is true, the step size is chosen as close as possible to the
+ * provided step, but being a round value like 1, 2, 5, 10, 20, 50, ....
+ *
+ * Example usage:
+ * var step = new StepNumber(0, 10, 2.5, true);
+ * step.start();
+ * while (!step.end()) {
+ * alert(step.getCurrent());
+ * step.next();
+ * }
+ *
+ * Version: 1.0
+ *
+ * @param {Number} start The start value
+ * @param {Number} end The end value
+ * @param {Number} step Optional. Step size. Must be a positive value.
+ * @param {boolean} prettyStep Optional. If true, the step size is rounded
+ * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
+ */
+ function StepNumber(start, end, step, prettyStep) {
+ // set default values
+ this._start = 0;
+ this._end = 0;
+ this._step = 1;
+ this.prettyStep = true;
+ this.precision = 5;
+
+ this._current = 0;
+ this.setRange(start, end, step, prettyStep);
+ };
+
+ /**
+ * Check for input values, to prevent disasters from happening
+ *
+ * Source: http://stackoverflow.com/a/1830844
+ */
+ StepNumber.prototype.isNumeric = function (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n);
+ };
+
+ /**
+ * Set a new range: start, end and step.
+ *
+ * @param {Number} start The start value
+ * @param {Number} end The end value
+ * @param {Number} step Optional. Step size. Must be a positive value.
+ * @param {boolean} prettyStep Optional. If true, the step size is rounded
+ * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
+ */
+ StepNumber.prototype.setRange = function (start, end, step, prettyStep) {
+ if (!this.isNumeric(start)) {
+ throw new Error('Parameter \'start\' is not numeric; value: ' + start);
+ }
+ if (!this.isNumeric(end)) {
+ throw new Error('Parameter \'end\' is not numeric; value: ' + start);
+ }
+ if (!this.isNumeric(step)) {
+ throw new Error('Parameter \'step\' is not numeric; value: ' + start);
+ }
+
+ this._start = start ? start : 0;
+ this._end = end ? end : 0;
+
+ this.setStep(step, prettyStep);
+ };
+
+ /**
+ * Set a new step size
+ * @param {Number} step New step size. Must be a positive value
+ * @param {boolean} prettyStep Optional. If true, the provided step is rounded
+ * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
+ */
+ StepNumber.prototype.setStep = function (step, prettyStep) {
+ if (step === undefined || step <= 0) return;
+
+ if (prettyStep !== undefined) this.prettyStep = prettyStep;
+
+ if (this.prettyStep === true) this._step = StepNumber.calculatePrettyStep(step);else this._step = step;
+ };
+
+ /**
+ * Calculate a nice step size, closest to the desired step size.
+ * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an
+ * integer Number. For example 1, 2, 5, 10, 20, 50, etc...
+ * @param {Number} step Desired step size
+ * @return {Number} Nice step size
+ */
+ StepNumber.calculatePrettyStep = function (step) {
+ var log10 = function log10(x) {
+ return Math.log(x) / Math.LN10;
+ };
+
+ // try three steps (multiple of 1, 2, or 5
+ var step1 = Math.pow(10, Math.round(log10(step))),
+ step2 = 2 * Math.pow(10, Math.round(log10(step / 2))),
+ step5 = 5 * Math.pow(10, Math.round(log10(step / 5)));
+
+ // choose the best step (closest to minimum step)
+ var prettyStep = step1;
+ if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2;
+ if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5;
+
+ // for safety
+ if (prettyStep <= 0) {
+ prettyStep = 1;
+ }
+
+ return prettyStep;
+ };
+
+ /**
+ * returns the current value of the step
+ * @return {Number} current value
+ */
+ StepNumber.prototype.getCurrent = function () {
+ return parseFloat(this._current.toPrecision(this.precision));
+ };
+
+ /**
+ * returns the current step size
+ * @return {Number} current step size
+ */
+ StepNumber.prototype.getStep = function () {
+ return this._step;
+ };
+
+ /**
+ * Set the current to its starting value.
+ *
+ * By default, this will be the largest value smaller than start, which
+ * is a multiple of the step size.
+ *
+ * Parameters checkFirst is optional, default false.
+ * If set to true, move the current value one step if smaller than start.
+ */
+ StepNumber.prototype.start = function (checkFirst) {
+ if (checkFirst === undefined) {
+ checkFirst = false;
+ }
+
+ this._current = this._start - this._start % this._step;
+
+ if (checkFirst) {
+ if (this.getCurrent() < this._start) {
+ this.next();
+ }
+ }
+ };
+
+ /**
+ * Do a step, add the step size to the current value
+ */
+ StepNumber.prototype.next = function () {
+ this._current += this._step;
+ };
+
+ /**
+ * Returns true whether the end is reached
+ * @return {boolean} True if the current value has passed the end value.
+ */
+ StepNumber.prototype.end = function () {
+ return this._current > this._end;
+ };
+
+ module.exports = StepNumber;
+
+/***/ },
+/* 106 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * @prototype Range
+ *
+ * Helper class to make working with related min and max values easier.
+ *
+ * The range is inclusive; a given value is considered part of the range if:
+ *
+ * this.min <= value <= this.max
+ */
+ function Range() {
+ this.min = undefined;
+ this.max = undefined;
+ }
+
+ /**
+ * Adjust the range so that the passed value fits in it.
+ *
+ * If the value is outside of the current extremes, adjust
+ * the min or max so that the value is within the range.
+ *
+ * @param {number} value Numeric value to fit in range
+ */
+ Range.prototype.adjust = function (value) {
+ if (value === undefined) return;
+
+ if (this.min === undefined || this.min > value) {
+ this.min = value;
+ }
+
+ if (this.max === undefined || this.max < value) {
+ this.max = value;
+ }
+ };
+
+ /**
+ * Adjust the current range so that the passed range fits in it.
+ *
+ * @param {Range} range Range instance to fit in current instance
+ */
+ Range.prototype.combine = function (range) {
+ this.add(range.min);
+ this.add(range.max);
+ };
+
+ /**
+ * Expand the range by the given value
+ *
+ * min will be lowered by given value;
+ * max will be raised by given value
+ *
+ * Shrinking by passing a negative value is allowed.
+ *
+ * @param {number} val Amount by which to expand or shrink current range with
+ */
+ Range.prototype.expand = function (val) {
+ if (val === undefined) {
+ return;
+ }
+
+ var newMin = this.min - val;
+ var newMax = this.max + val;
+
+ // Note that following allows newMin === newMax.
+ // This should be OK, since method expand() allows this also.
+ if (newMin > newMax) {
+ throw new Error('Passed expansion value makes range invalid');
+ }
+
+ this.min = newMin;
+ this.max = newMax;
+ };
+
+ /**
+ * Determine the full range width of current instance.
+ *
+ * @returns {num} The calculated width of this range
+ */
+ Range.prototype.range = function () {
+ return this.max - this.min;
+ };
+
+ /**
+ * Determine the central point of current instance.
+ *
+ * @returns {number} the value in the middle of min and max
+ */
+ Range.prototype.center = function () {
+ return (this.min + this.max) / 2;
+ };
+
+ module.exports = Range;
+
+/***/ },
+/* 107 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // This modules handles the options for Graph3d.
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+ var Camera = __webpack_require__(98);
+ var Point3d = __webpack_require__(96);
+
+ // enumerate the available styles
+ var STYLE = {
+ BAR: 0,
+ BARCOLOR: 1,
+ BARSIZE: 2,
+ DOT: 3,
+ DOTLINE: 4,
+ DOTCOLOR: 5,
+ DOTSIZE: 6,
+ GRID: 7,
+ LINE: 8,
+ SURFACE: 9
+ };
+
+ // The string representations of the styles
+ var STYLENAME = {
+ 'dot': STYLE.DOT,
+ 'dot-line': STYLE.DOTLINE,
+ 'dot-color': STYLE.DOTCOLOR,
+ 'dot-size': STYLE.DOTSIZE,
+ 'line': STYLE.LINE,
+ 'grid': STYLE.GRID,
+ 'surface': STYLE.SURFACE,
+ 'bar': STYLE.BAR,
+ 'bar-color': STYLE.BARCOLOR,
+ 'bar-size': STYLE.BARSIZE
+ };
+
+ /**
+ * Field names in the options hash which are of relevance to the user.
+ *
+ * Specifically, these are the fields which require no special handling,
+ * and can be directly copied over.
+ */
+ var OPTIONKEYS = ['width', 'height', 'filterLabel', 'legendLabel', 'xLabel', 'yLabel', 'zLabel', 'xValueLabel', 'yValueLabel', 'zValueLabel', 'showGrid', 'showPerspective', 'showShadow', 'keepAspectRatio', 'verticalRatio', 'dotSizeRatio', 'showAnimationControls', 'animationInterval', 'animationPreload', 'animationAutoStart', 'axisColor', 'gridColor', 'xCenter', 'yCenter'];
+
+ /**
+ * Field names in the options hash which are of relevance to the user.
+ *
+ * Same as OPTIONKEYS, but internally these fields are stored with
+ * prefix 'default' in the name.
+ */
+ var PREFIXEDOPTIONKEYS = ['xBarWidth', 'yBarWidth', 'valueMin', 'valueMax', 'xMin', 'xMax', 'xStep', 'yMin', 'yMax', 'yStep', 'zMin', 'zMax', 'zStep'];
+
+ // Placeholder for DEFAULTS reference
+ var DEFAULTS = undefined;
+
+ /**
+ * Check if given hash is empty.
+ *
+ * Source: http://stackoverflow.com/a/679937
+ */
+ function isEmpty(obj) {
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Make first letter of parameter upper case.
+ *
+ * Source: http://stackoverflow.com/a/1026087
+ */
+ function capitalize(str) {
+ if (str === undefined || str === "" || typeof str != "string") {
+ return str;
+ }
+
+ return str.charAt(0).toUpperCase() + str.slice(1);
+ }
+
+ /**
+ * Add a prefix to a field name, taking style guide into account
+ */
+ function prefixFieldName(prefix, fieldName) {
+ if (prefix === undefined || prefix === "") {
+ return fieldName;
+ }
+
+ return prefix + capitalize(fieldName);
+ }
+
+ /**
+ * Forcibly copy fields from src to dst in a controlled manner.
+ *
+ * A given field in dst will always be overwitten. If this field
+ * is undefined or not present in src, the field in dst will
+ * be explicitly set to undefined.
+ *
+ * The intention here is to be able to reset all option fields.
+ *
+ * Only the fields mentioned in array 'fields' will be handled.
+ *
+ * @param fields array with names of fields to copy
+ * @param prefix optional; prefix to use for the target fields.
+ */
+ function forceCopy(src, dst, fields, prefix) {
+ var srcKey;
+ var dstKey;
+
+ for (var i in fields) {
+ srcKey = fields[i];
+ dstKey = prefixFieldName(prefix, srcKey);
+
+ dst[dstKey] = src[srcKey];
+ }
+ }
+
+ /**
+ * Copy fields from src to dst in a safe and controlled manner.
+ *
+ * Only the fields mentioned in array 'fields' will be copied over,
+ * and only if these are actually defined.
+ *
+ * @param fields array with names of fields to copy
+ * @param prefix optional; prefix to use for the target fields.
+ */
+ function safeCopy(src, dst, fields, prefix) {
+ var srcKey;
+ var dstKey;
+
+ for (var i in fields) {
+ srcKey = fields[i];
+ if (src[srcKey] === undefined) continue;
+
+ dstKey = prefixFieldName(prefix, srcKey);
+
+ dst[dstKey] = src[srcKey];
+ }
+ }
+
+ /**
+ * Initialize dst with the values in src.
+ *
+ * src is the hash with the default values.
+ * A reference DEFAULTS to this hash is stored locally for
+ * further handling.
+ *
+ * For now, dst is assumed to be a Graph3d instance.
+ */
+ function setDefaults(src, dst) {
+ if (src === undefined || isEmpty(src)) {
+ throw new Error('No DEFAULTS passed');
+ }
+ if (dst === undefined) {
+ throw new Error('No dst passed');
+ }
+
+ // Remember defaults for future reference
+ DEFAULTS = src;
+
+ // Handle the defaults which can be simply copied over
+ forceCopy(src, dst, OPTIONKEYS);
+ forceCopy(src, dst, PREFIXEDOPTIONKEYS, 'default');
+
+ // Handle the more complex ('special') fields
+ setSpecialSettings(src, dst);
+
+ // Following are internal fields, not part of the user settings
+ dst.margin = 10; // px
+ dst.showGrayBottom = false; // TODO: this does not work correctly
+ dst.showTooltip = false;
+ dst.onclick_callback = null;
+ dst.eye = new Point3d(0, 0, -1); // TODO: set eye.z about 3/4 of the width of the window?
+ }
+
+ function setOptions(options, dst) {
+ if (options === undefined) {
+ return;
+ }
+ if (dst === undefined) {
+ throw new Error('No dst passed');
+ }
+
+ if (DEFAULTS === undefined || isEmpty(DEFAULTS)) {
+ throw new Error('DEFAULTS not set for module Settings');
+ }
+
+ // Handle the parameters which can be simply copied over
+ safeCopy(options, dst, OPTIONKEYS);
+ safeCopy(options, dst, PREFIXEDOPTIONKEYS, 'default');
+
+ // Handle the more complex ('special') fields
+ setSpecialSettings(options, dst);
+ }
+
+ /**
+ * Special handling for certain parameters
+ *
+ * 'Special' here means: setting requires more than a simple copy
+ */
+ function setSpecialSettings(src, dst) {
+ if (src.backgroundColor !== undefined) {
+ setBackgroundColor(src.backgroundColor, dst);
+ }
+
+ setDataColor(src.dataColor, dst);
+ setStyle(src.style, dst);
+ setShowLegend(src.showLegend, dst);
+ setCameraPosition(src.cameraPosition, dst);
+
+ // As special fields go, this is an easy one; just a translation of the name.
+ // Can't use this.tooltip directly, because that field exists internally
+ if (src.tooltip !== undefined) {
+ dst.showTooltip = src.tooltip;
+ }
+ if (src.onclick != undefined) {
+ dst.onclick_callback = src.onclick;
+ }
+ }
+
+ /**
+ * Set the value of setting 'showLegend'
+ *
+ * This depends on the value of the style fields, so it must be called
+ * after the style field has been initialized.
+ */
+ function setShowLegend(showLegend, dst) {
+ if (showLegend === undefined) {
+ // If the default was auto, make a choice for this field
+ var isAutoByDefault = DEFAULTS.showLegend === undefined;
+
+ if (isAutoByDefault) {
+ // these styles default to having legends
+ var isLegendGraphStyle = dst.style === STYLE.DOTCOLOR || dst.style === STYLE.DOTSIZE;
+
+ dst.showLegend = isLegendGraphStyle;
+ } else {
+ // Leave current value as is
+ }
+ } else {
+ dst.showLegend = showLegend;
+ }
+ }
+
+ /**
+ * Retrieve the style index from given styleName
+ * @param {string} styleName Style name such as 'dot', 'grid', 'dot-line'
+ * @return {Number} styleNumber Enumeration value representing the style, or -1
+ * when not found
+ */
+ function getStyleNumberByName(styleName) {
+ var number = STYLENAME[styleName];
+
+ if (number === undefined) {
+ return -1;
+ }
+
+ return number;
+ }
+
+ /**
+ * Check if given number is a valid style number.
+ *
+ * @return true if valid, false otherwise
+ */
+ function checkStyleNumber(style) {
+ var valid = false;
+
+ for (var n in STYLE) {
+ if (STYLE[n] === style) {
+ valid = true;
+ break;
+ }
+ }
+
+ return valid;
+ }
+
+ function setStyle(style, dst) {
+ if (style === undefined) {
+ return; // Nothing to do
+ }
+
+ var styleNumber;
+
+ if (typeof style === 'string') {
+ styleNumber = getStyleNumberByName(style);
+
+ if (styleNumber === -1) {
+ throw new Error('Style \'' + style + '\' is invalid');
+ }
+ } else {
+ // Do a pedantic check on style number value
+ if (!checkStyleNumber(style)) {
+ throw new Error('Style \'' + style + '\' is invalid');
+ }
+
+ styleNumber = style;
+ }
+
+ dst.style = styleNumber;
+ }
+
+ /**
+ * Set the background styling for the graph
+ * @param {string | {fill: string, stroke: string, strokeWidth: string}} backgroundColor
+ */
+ function setBackgroundColor(backgroundColor, dst) {
+ var fill = 'white';
+ var stroke = 'gray';
+ var strokeWidth = 1;
+
+ if (typeof backgroundColor === 'string') {
+ fill = backgroundColor;
+ stroke = 'none';
+ strokeWidth = 0;
+ } else if ((typeof backgroundColor === 'undefined' ? 'undefined' : (0, _typeof3['default'])(backgroundColor)) === 'object') {
+ if (backgroundColor.fill !== undefined) fill = backgroundColor.fill;
+ if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke;
+ if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth;
+ } else {
+ throw new Error('Unsupported type of backgroundColor');
+ }
+
+ dst.frame.style.backgroundColor = fill;
+ dst.frame.style.borderColor = stroke;
+ dst.frame.style.borderWidth = strokeWidth + 'px';
+ dst.frame.style.borderStyle = 'solid';
+ }
+
+ function setDataColor(dataColor, dst) {
+ if (dataColor === undefined) {
+ return; // Nothing to do
+ }
+
+ if (dst.dataColor === undefined) {
+ dst.dataColor = {};
+ }
+
+ if (typeof dataColor === 'string') {
+ dst.dataColor.fill = dataColor;
+ dst.dataColor.stroke = dataColor;
+ } else {
+ if (dataColor.fill) {
+ dst.dataColor.fill = dataColor.fill;
+ }
+ if (dataColor.stroke) {
+ dst.dataColor.stroke = dataColor.stroke;
+ }
+ if (dataColor.strokeWidth !== undefined) {
+ dst.dataColor.strokeWidth = dataColor.strokeWidth;
+ }
+ }
+ }
+
+ function setCameraPosition(cameraPosition, dst) {
+ var camPos = cameraPosition;
+ if (camPos === undefined) {
+ return;
+ }
+
+ if (dst.camera === undefined) {
+ dst.camera = new Camera();
+ }
+
+ dst.camera.setArmRotation(camPos.horizontal, camPos.vertical);
+ dst.camera.setArmLength(camPos.distance);
+ }
+
+ module.exports.STYLE = STYLE;
+ module.exports.setDefaults = setDefaults;
+ module.exports.setOptions = setOptions;
+ module.exports.setCameraPosition = setCameraPosition;
+
+/***/ },
+/* 108 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ // Only load hammer.js when in a browser environment
+ // (loading hammer.js in a node.js environment gives errors)
+ if (typeof window !== 'undefined') {
+ var propagating = __webpack_require__(109);
+ var Hammer = window['Hammer'] || __webpack_require__(110);
+ module.exports = propagating(Hammer, {
+ preventDefault: 'mouse'
+ });
+ } else {
+ module.exports = function () {
+ throw Error('hammer.js is only available in a browser, not in node.js.');
+ };
+ }
+
+/***/ },
+/* 109 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
+
+ (function (factory) {
+ if (true) {
+ // AMD. Register as an anonymous module.
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ } else if (typeof exports === 'object') {
+ // Node. Does not work with strict CommonJS, but
+ // only CommonJS-like environments that support module.exports,
+ // like Node.
+ module.exports = factory();
+ } else {
+ // Browser globals (root is window)
+ window.propagating = factory();
+ }
+ }(function () {
+ var _firstTarget = null; // singleton, will contain the target element where the touch event started
+
+ /**
+ * Extend an Hammer.js instance with event propagation.
+ *
+ * Features:
+ * - Events emitted by hammer will propagate in order from child to parent
+ * elements.
+ * - Events are extended with a function `event.stopPropagation()` to stop
+ * propagation to parent elements.
+ * - An option `preventDefault` to stop all default browser behavior.
+ *
+ * Usage:
+ * var hammer = propagatingHammer(new Hammer(element));
+ * var hammer = propagatingHammer(new Hammer(element), {preventDefault: true});
+ *
+ * @param {Hammer.Manager} hammer An hammer instance.
+ * @param {Object} [options] Available options:
+ * - `preventDefault: true | false | 'mouse' | 'touch' | 'pen'`.
+ * Enforce preventing the default browser behavior.
+ * Cannot be set to `false`.
+ * @return {Hammer.Manager} Returns the same hammer instance with extended
+ * functionality
+ */
+ return function propagating(hammer, options) {
+ var _options = options || {
+ preventDefault: false
+ };
+
+ if (hammer.Manager) {
+ // This looks like the Hammer constructor.
+ // Overload the constructors with our own.
+ var Hammer = hammer;
+
+ var PropagatingHammer = function(element, options) {
+ var o = Object.create(_options);
+ if (options) Hammer.assign(o, options);
+ return propagating(new Hammer(element, o), o);
+ };
+ Hammer.assign(PropagatingHammer, Hammer);
+
+ PropagatingHammer.Manager = function (element, options) {
+ var o = Object.create(_options);
+ if (options) Hammer.assign(o, options);
+ return propagating(new Hammer.Manager(element, o), o);
+ };
+
+ return PropagatingHammer;
+ }
+
+ // create a wrapper object which will override the functions
+ // `on`, `off`, `destroy`, and `emit` of the hammer instance
+ var wrapper = Object.create(hammer);
+
+ // attach to DOM element
+ var element = hammer.element;
+
+ if(!element.hammer) element.hammer = [];
+ element.hammer.push(wrapper);
+
+ // register an event to catch the start of a gesture and store the
+ // target in a singleton
+ hammer.on('hammer.input', function (event) {
+ if (_options.preventDefault === true || (_options.preventDefault === event.pointerType)) {
+ event.preventDefault();
+ }
+ if (event.isFirst) {
+ _firstTarget = event.target;
+ }
+ });
+
+ /** @type {Object.<String, Array.<function>>} */
+ wrapper._handlers = {};
+
+ /**
+ * Register a handler for one or multiple events
+ * @param {String} events A space separated string with events
+ * @param {function} handler A callback function, called as handler(event)
+ * @returns {Hammer.Manager} Returns the hammer instance
+ */
+ wrapper.on = function (events, handler) {
+ // register the handler
+ split(events).forEach(function (event) {
+ var _handlers = wrapper._handlers[event];
+ if (!_handlers) {
+ wrapper._handlers[event] = _handlers = [];
+
+ // register the static, propagated handler
+ hammer.on(event, propagatedHandler);
+ }
+ _handlers.push(handler);
+ });
+
+ return wrapper;
+ };
+
+ /**
+ * Unregister a handler for one or multiple events
+ * @param {String} events A space separated string with events
+ * @param {function} [handler] Optional. The registered handler. If not
+ * provided, all handlers for given events
+ * are removed.
+ * @returns {Hammer.Manager} Returns the hammer instance
+ */
+ wrapper.off = function (events, handler) {
+ // unregister the handler
+ split(events).forEach(function (event) {
+ var _handlers = wrapper._handlers[event];
+ if (_handlers) {
+ _handlers = handler ? _handlers.filter(function (h) {
+ return h !== handler;
+ }) : [];
+
+ if (_handlers.length > 0) {
+ wrapper._handlers[event] = _handlers;
+ }
+ else {
+ // remove static, propagated handler
+ hammer.off(event, propagatedHandler);
+ delete wrapper._handlers[event];
+ }
+ }
+ });
+
+ return wrapper;
+ };
+
+ /**
+ * Emit to the event listeners
+ * @param {string} eventType
+ * @param {Event} event
+ */
+ wrapper.emit = function(eventType, event) {
+ _firstTarget = event.target;
+ hammer.emit(eventType, event);
+ };
+
+ wrapper.destroy = function () {
+ // Detach from DOM element
+ var hammers = hammer.element.hammer;
+ var idx = hammers.indexOf(wrapper);
+ if(idx !== -1) hammers.splice(idx,1);
+ if(!hammers.length) delete hammer.element.hammer;
+
+ // clear all handlers
+ wrapper._handlers = {};
+
+ // call original hammer destroy
+ hammer.destroy();
+ };
+
+ // split a string with space separated words
+ function split(events) {
+ return events.match(/[^ ]+/g);
+ }
+
+ /**
+ * A static event handler, applying event propagation.
+ * @param {Object} event
+ */
+ function propagatedHandler(event) {
+ // let only a single hammer instance handle this event
+ if (event.type !== 'hammer.input') {
+ // it is possible that the same srcEvent is used with multiple hammer events,
+ // we keep track on which events are handled in an object _handled
+ if (!event.srcEvent._handled) {
+ event.srcEvent._handled = {};
+ }
+
+ if (event.srcEvent._handled[event.type]) {
+ return;
+ }
+ else {
+ event.srcEvent._handled[event.type] = true;
+ }
+ }
+
+ // attach a stopPropagation function to the event
+ var stopped = false;
+ event.stopPropagation = function () {
+ stopped = true;
+ };
+
+ //wrap the srcEvent's stopPropagation to also stop hammer propagation:
+ var srcStop = event.srcEvent.stopPropagation.bind(event.srcEvent);
+ if(typeof srcStop == "function") {
+ event.srcEvent.stopPropagation = function(){
+ srcStop();
+ event.stopPropagation();
+ }
+ }
+
+ // attach firstTarget property to the event
+ event.firstTarget = _firstTarget;
+
+ // propagate over all elements (until stopped)
+ var elem = _firstTarget;
+ while (elem && !stopped) {
+ var elemHammer = elem.hammer;
+ if(elemHammer){
+ var _handlers;
+ for(var k = 0; k < elemHammer.length; k++){
+ _handlers = elemHammer[k]._handlers[event.type];
+ if(_handlers) for (var i = 0; i < _handlers.length && !stopped; i++) {
+ _handlers[i](event);
+ }
+ }
+ }
+ elem = elem.parentNode;
+ }
+ }
+
+ return wrapper;
+ };
+ }));
+
+
+/***/ },
+/* 110 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.7 - 2016-04-22
+ * http://hammerjs.github.io/
+ *
+ * Copyright (c) 2016 Jorik Tangelder;
+ * Licensed under the MIT license */
+ (function(window, document, exportName, undefined) {
+ 'use strict';
+
+ var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
+ var TEST_ELEMENT = document.createElement('div');
+
+ var TYPE_FUNCTION = 'function';
+
+ var round = Math.round;
+ var abs = Math.abs;
+ var now = Date.now;
+
+ /**
+ * set a timeout with a given scope
+ * @param {Function} fn
+ * @param {Number} timeout
+ * @param {Object} context
+ * @returns {number}
+ */
+ function setTimeoutContext(fn, timeout, context) {
+ return setTimeout(bindFn(fn, context), timeout);
+ }
+
+ /**
+ * if the argument is an array, we want to execute the fn on each entry
+ * if it aint an array we don't want to do a thing.
+ * this is used by all the methods that accept a single and array argument.
+ * @param {*|Array} arg
+ * @param {String} fn
+ * @param {Object} [context]
+ * @returns {Boolean}
+ */
+ function invokeArrayArg(arg, fn, context) {
+ if (Array.isArray(arg)) {
+ each(arg, context[fn], context);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * walk objects and arrays
+ * @param {Object} obj
+ * @param {Function} iterator
+ * @param {Object} context
+ */
+ function each(obj, iterator, context) {
+ var i;
+
+ if (!obj) {
+ return;
+ }
+
+ if (obj.forEach) {
+ obj.forEach(iterator, context);
+ } else if (obj.length !== undefined) {
+ i = 0;
+ while (i < obj.length) {
+ iterator.call(context, obj[i], i, obj);
+ i++;
+ }
+ } else {
+ for (i in obj) {
+ obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
+ }
+ }
+ }
+
+ /**
+ * wrap a method with a deprecation warning and stack trace
+ * @param {Function} method
+ * @param {String} name
+ * @param {String} message
+ * @returns {Function} A new function wrapping the supplied method.
+ */
+ function deprecate(method, name, message) {
+ var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
+ return function() {
+ var e = new Error('get-stack-trace');
+ var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
+ .replace(/^\s+at\s+/gm, '')
+ .replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
+
+ var log = window.console && (window.console.warn || window.console.log);
+ if (log) {
+ log.call(window.console, deprecationMessage, stack);
+ }
+ return method.apply(this, arguments);
+ };
+ }
+
+ /**
+ * extend object.
+ * means that properties in dest will be overwritten by the ones in src.
+ * @param {Object} target
+ * @param {...Object} objects_to_assign
+ * @returns {Object} target
+ */
+ var assign;
+ if (typeof Object.assign !== 'function') {
+ assign = function assign(target) {
+ if (target === undefined || target === null) {
+ throw new TypeError('Cannot convert undefined or null to object');
+ }
+
+ var output = Object(target);
+ for (var index = 1; index < arguments.length; index++) {
+ var source = arguments[index];
+ if (source !== undefined && source !== null) {
+ for (var nextKey in source) {
+ if (source.hasOwnProperty(nextKey)) {
+ output[nextKey] = source[nextKey];
+ }
+ }
+ }
+ }
+ return output;
+ };
+ } else {
+ assign = Object.assign;
+ }
+
+ /**
+ * extend object.
+ * means that properties in dest will be overwritten by the ones in src.
+ * @param {Object} dest
+ * @param {Object} src
+ * @param {Boolean} [merge=false]
+ * @returns {Object} dest
+ */
+ var extend = deprecate(function extend(dest, src, merge) {
+ var keys = Object.keys(src);
+ var i = 0;
+ while (i < keys.length) {
+ if (!merge || (merge && dest[keys[i]] === undefined)) {
+ dest[keys[i]] = src[keys[i]];
+ }
+ i++;
+ }
+ return dest;
+ }, 'extend', 'Use `assign`.');
+
+ /**
+ * merge the values from src in the dest.
+ * means that properties that exist in dest will not be overwritten by src
+ * @param {Object} dest
+ * @param {Object} src
+ * @returns {Object} dest
+ */
+ var merge = deprecate(function merge(dest, src) {
+ return extend(dest, src, true);
+ }, 'merge', 'Use `assign`.');
+
+ /**
+ * simple class inheritance
+ * @param {Function} child
+ * @param {Function} base
+ * @param {Object} [properties]
+ */
+ function inherit(child, base, properties) {
+ var baseP = base.prototype,
+ childP;
+
+ childP = child.prototype = Object.create(baseP);
+ childP.constructor = child;
+ childP._super = baseP;
+
+ if (properties) {
+ assign(childP, properties);
+ }
+ }
+
+ /**
+ * simple function bind
+ * @param {Function} fn
+ * @param {Object} context
+ * @returns {Function}
+ */
+ function bindFn(fn, context) {
+ return function boundFn() {
+ return fn.apply(context, arguments);
+ };
+ }
+
+ /**
+ * let a boolean value also be a function that must return a boolean
+ * this first item in args will be used as the context
+ * @param {Boolean|Function} val
+ * @param {Array} [args]
+ * @returns {Boolean}
+ */
+ function boolOrFn(val, args) {
+ if (typeof val == TYPE_FUNCTION) {
+ return val.apply(args ? args[0] || undefined : undefined, args);
+ }
+ return val;
+ }
+
+ /**
+ * use the val2 when val1 is undefined
+ * @param {*} val1
+ * @param {*} val2
+ * @returns {*}
+ */
+ function ifUndefined(val1, val2) {
+ return (val1 === undefined) ? val2 : val1;
+ }
+
+ /**
+ * addEventListener with multiple events at once
+ * @param {EventTarget} target
+ * @param {String} types
+ * @param {Function} handler
+ */
+ function addEventListeners(target, types, handler) {
+ each(splitStr(types), function(type) {
+ target.addEventListener(type, handler, false);
+ });
+ }
+
+ /**
+ * removeEventListener with multiple events at once
+ * @param {EventTarget} target
+ * @param {String} types
+ * @param {Function} handler
+ */
+ function removeEventListeners(target, types, handler) {
+ each(splitStr(types), function(type) {
+ target.removeEventListener(type, handler, false);
+ });
+ }
+
+ /**
+ * find if a node is in the given parent
+ * @method hasParent
+ * @param {HTMLElement} node
+ * @param {HTMLElement} parent
+ * @return {Boolean} found
+ */
+ function hasParent(node, parent) {
+ while (node) {
+ if (node == parent) {
+ return true;
+ }
+ node = node.parentNode;
+ }
+ return false;
+ }
+
+ /**
+ * small indexOf wrapper
+ * @param {String} str
+ * @param {String} find
+ * @returns {Boolean} found
+ */
+ function inStr(str, find) {
+ return str.indexOf(find) > -1;
+ }
+
+ /**
+ * split string on whitespace
+ * @param {String} str
+ * @returns {Array} words
+ */
+ function splitStr(str) {
+ return str.trim().split(/\s+/g);
+ }
+
+ /**
+ * find if a array contains the object using indexOf or a simple polyFill
+ * @param {Array} src
+ * @param {String} find
+ * @param {String} [findByKey]
+ * @return {Boolean|Number} false when not found, or the index
+ */
+ function inArray(src, find, findByKey) {
+ if (src.indexOf && !findByKey) {
+ return src.indexOf(find);
+ } else {
+ var i = 0;
+ while (i < src.length) {
+ if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
+ return i;
+ }
+ i++;
+ }
+ return -1;
+ }
+ }
+
+ /**
+ * convert array-like objects to real arrays
+ * @param {Object} obj
+ * @returns {Array}
+ */
+ function toArray(obj) {
+ return Array.prototype.slice.call(obj, 0);
+ }
+
+ /**
+ * unique array with objects based on a key (like 'id') or just by the array's value
+ * @param {Array} src [{id:1},{id:2},{id:1}]
+ * @param {String} [key]
+ * @param {Boolean} [sort=False]
+ * @returns {Array} [{id:1},{id:2}]
+ */
+ function uniqueArray(src, key, sort) {
+ var results = [];
+ var values = [];
+ var i = 0;
+
+ while (i < src.length) {
+ var val = key ? src[i][key] : src[i];
+ if (inArray(values, val) < 0) {
+ results.push(src[i]);
+ }
+ values[i] = val;
+ i++;
+ }
+
+ if (sort) {
+ if (!key) {
+ results = results.sort();
+ } else {
+ results = results.sort(function sortUniqueArray(a, b) {
+ return a[key] > b[key];
+ });
+ }
+ }
+
+ return results;
+ }
+
+ /**
+ * get the prefixed property
+ * @param {Object} obj
+ * @param {String} property
+ * @returns {String|Undefined} prefixed
+ */
+ function prefixed(obj, property) {
+ var prefix, prop;
+ var camelProp = property[0].toUpperCase() + property.slice(1);
+
+ var i = 0;
+ while (i < VENDOR_PREFIXES.length) {
+ prefix = VENDOR_PREFIXES[i];
+ prop = (prefix) ? prefix + camelProp : property;
+
+ if (prop in obj) {
+ return prop;
+ }
+ i++;
+ }
+ return undefined;
+ }
+
+ /**
+ * get a unique id
+ * @returns {number} uniqueId
+ */
+ var _uniqueId = 1;
+ function uniqueId() {
+ return _uniqueId++;
+ }
+
+ /**
+ * get the window object of an element
+ * @param {HTMLElement} element
+ * @returns {DocumentView|Window}
+ */
+ function getWindowForElement(element) {
+ var doc = element.ownerDocument || element;
+ return (doc.defaultView || doc.parentWindow || window);
+ }
+
+ var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
+
+ var SUPPORT_TOUCH = ('ontouchstart' in window);
+ var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
+ var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
+
+ var INPUT_TYPE_TOUCH = 'touch';
+ var INPUT_TYPE_PEN = 'pen';
+ var INPUT_TYPE_MOUSE = 'mouse';
+ var INPUT_TYPE_KINECT = 'kinect';
+
+ var COMPUTE_INTERVAL = 25;
+
+ var INPUT_START = 1;
+ var INPUT_MOVE = 2;
+ var INPUT_END = 4;
+ var INPUT_CANCEL = 8;
+
+ var DIRECTION_NONE = 1;
+ var DIRECTION_LEFT = 2;
+ var DIRECTION_RIGHT = 4;
+ var DIRECTION_UP = 8;
+ var DIRECTION_DOWN = 16;
+
+ var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
+ var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
+ var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
+
+ var PROPS_XY = ['x', 'y'];
+ var PROPS_CLIENT_XY = ['clientX', 'clientY'];
+
+ /**
+ * create new input type manager
+ * @param {Manager} manager
+ * @param {Function} callback
+ * @returns {Input}
+ * @constructor
+ */
+ function Input(manager, callback) {
+ var self = this;
+ this.manager = manager;
+ this.callback = callback;
+ this.element = manager.element;
+ this.target = manager.options.inputTarget;
+
+ // smaller wrapper around the handler, for the scope and the enabled state of the manager,
+ // so when disabled the input events are completely bypassed.
+ this.domHandler = function(ev) {
+ if (boolOrFn(manager.options.enable, [manager])) {
+ self.handler(ev);
+ }
+ };
+
+ this.init();
+
+ }
+
+ Input.prototype = {
+ /**
+ * should handle the inputEvent data and trigger the callback
+ * @virtual
+ */
+ handler: function() { },
+
+ /**
+ * bind the events
+ */
+ init: function() {
+ this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
+ this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
+ this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
+ },
+
+ /**
+ * unbind the events
+ */
+ destroy: function() {
+ this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
+ this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
+ this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
+ }
+ };
+
+ /**
+ * create new input type manager
+ * called by the Manager constructor
+ * @param {Hammer} manager
+ * @returns {Input}
+ */
+ function createInputInstance(manager) {
+ var Type;
+ var inputClass = manager.options.inputClass;
+
+ if (inputClass) {
+ Type = inputClass;
+ } else if (SUPPORT_POINTER_EVENTS) {
+ Type = PointerEventInput;
+ } else if (SUPPORT_ONLY_TOUCH) {
+ Type = TouchInput;
+ } else if (!SUPPORT_TOUCH) {
+ Type = MouseInput;
+ } else {
+ Type = TouchMouseInput;
+ }
+ return new (Type)(manager, inputHandler);
+ }
+
+ /**
+ * handle input events
+ * @param {Manager} manager
+ * @param {String} eventType
+ * @param {Object} input
+ */
+ function inputHandler(manager, eventType, input) {
+ var pointersLen = input.pointers.length;
+ var changedPointersLen = input.changedPointers.length;
+ var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
+ var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));
+
+ input.isFirst = !!isFirst;
+ input.isFinal = !!isFinal;
+
+ if (isFirst) {
+ manager.session = {};
+ }
+
+ // source event is the normalized value of the domEvents
+ // like 'touchstart, mouseup, pointerdown'
+ input.eventType = eventType;
+
+ // compute scale, rotation etc
+ computeInputData(manager, input);
+
+ // emit secret event
+ manager.emit('hammer.input', input);
+
+ manager.recognize(input);
+ manager.session.prevInput = input;
+ }
+
+ /**
+ * extend the data with some usable properties like scale, rotate, velocity etc
+ * @param {Object} manager
+ * @param {Object} input
+ */
+ function computeInputData(manager, input) {
+ var session = manager.session;
+ var pointers = input.pointers;
+ var pointersLength = pointers.length;
+
+ // store the first input to calculate the distance and direction
+ if (!session.firstInput) {
+ session.firstInput = simpleCloneInputData(input);
+ }
+
+ // to compute scale and rotation we need to store the multiple touches
+ if (pointersLength > 1 && !session.firstMultiple) {
+ session.firstMultiple = simpleCloneInputData(input);
+ } else if (pointersLength === 1) {
+ session.firstMultiple = false;
+ }
+
+ var firstInput = session.firstInput;
+ var firstMultiple = session.firstMultiple;
+ var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
+
+ var center = input.center = getCenter(pointers);
+ input.timeStamp = now();
+ input.deltaTime = input.timeStamp - firstInput.timeStamp;
+
+ input.angle = getAngle(offsetCenter, center);
+ input.distance = getDistance(offsetCenter, center);
+
+ computeDeltaXY(session, input);
+ input.offsetDirection = getDirection(input.deltaX, input.deltaY);
+
+ var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
+ input.overallVelocityX = overallVelocity.x;
+ input.overallVelocityY = overallVelocity.y;
+ input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;
+
+ input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
+ input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
+
+ input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >
+ session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);
+
+ computeIntervalInputData(session, input);
+
+ // find the correct target
+ var target = manager.element;
+ if (hasParent(input.srcEvent.target, target)) {
+ target = input.srcEvent.target;
+ }
+ input.target = target;
+ }
+
+ function computeDeltaXY(session, input) {
+ var center = input.center;
+ var offset = session.offsetDelta || {};
+ var prevDelta = session.prevDelta || {};
+ var prevInput = session.prevInput || {};
+
+ if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
+ prevDelta = session.prevDelta = {
+ x: prevInput.deltaX || 0,
+ y: prevInput.deltaY || 0
+ };
+
+ offset = session.offsetDelta = {
+ x: center.x,
+ y: center.y
+ };
+ }
+
+ input.deltaX = prevDelta.x + (center.x - offset.x);
+ input.deltaY = prevDelta.y + (center.y - offset.y);
+ }
+
+ /**
+ * velocity is calculated every x ms
+ * @param {Object} session
+ * @param {Object} input
+ */
+ function computeIntervalInputData(session, input) {
+ var last = session.lastInterval || input,
+ deltaTime = input.timeStamp - last.timeStamp,
+ velocity, velocityX, velocityY, direction;
+
+ if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
+ var deltaX = input.deltaX - last.deltaX;
+ var deltaY = input.deltaY - last.deltaY;
+
+ var v = getVelocity(deltaTime, deltaX, deltaY);
+ velocityX = v.x;
+ velocityY = v.y;
+ velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;
+ direction = getDirection(deltaX, deltaY);
+
+ session.lastInterval = input;
+ } else {
+ // use latest velocity info if it doesn't overtake a minimum period
+ velocity = last.velocity;
+ velocityX = last.velocityX;
+ velocityY = last.velocityY;
+ direction = last.direction;
+ }
+
+ input.velocity = velocity;
+ input.velocityX = velocityX;
+ input.velocityY = velocityY;
+ input.direction = direction;
+ }
+
+ /**
+ * create a simple clone from the input used for storage of firstInput and firstMultiple
+ * @param {Object} input
+ * @returns {Object} clonedInputData
+ */
+ function simpleCloneInputData(input) {
+ // make a simple copy of the pointers because we will get a reference if we don't
+ // we only need clientXY for the calculations
+ var pointers = [];
+ var i = 0;
+ while (i < input.pointers.length) {
+ pointers[i] = {
+ clientX: round(input.pointers[i].clientX),
+ clientY: round(input.pointers[i].clientY)
+ };
+ i++;
+ }
+
+ return {
+ timeStamp: now(),
+ pointers: pointers,
+ center: getCenter(pointers),
+ deltaX: input.deltaX,
+ deltaY: input.deltaY
+ };
+ }
+
+ /**
+ * get the center of all the pointers
+ * @param {Array} pointers
+ * @return {Object} center contains `x` and `y` properties
+ */
+ function getCenter(pointers) {
+ var pointersLength = pointers.length;
+
+ // no need to loop when only one touch
+ if (pointersLength === 1) {
+ return {
+ x: round(pointers[0].clientX),
+ y: round(pointers[0].clientY)
+ };
+ }
+
+ var x = 0, y = 0, i = 0;
+ while (i < pointersLength) {
+ x += pointers[i].clientX;
+ y += pointers[i].clientY;
+ i++;
+ }
+
+ return {
+ x: round(x / pointersLength),
+ y: round(y / pointersLength)
+ };
+ }
+
+ /**
+ * calculate the velocity between two points. unit is in px per ms.
+ * @param {Number} deltaTime
+ * @param {Number} x
+ * @param {Number} y
+ * @return {Object} velocity `x` and `y`
+ */
+ function getVelocity(deltaTime, x, y) {
+ return {
+ x: x / deltaTime || 0,
+ y: y / deltaTime || 0
+ };
+ }
+
+ /**
+ * get the direction between two points
+ * @param {Number} x
+ * @param {Number} y
+ * @return {Number} direction
+ */
+ function getDirection(x, y) {
+ if (x === y) {
+ return DIRECTION_NONE;
+ }
+
+ if (abs(x) >= abs(y)) {
+ return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
+ }
+ return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
+ }
+
+ /**
+ * calculate the absolute distance between two points
+ * @param {Object} p1 {x, y}
+ * @param {Object} p2 {x, y}
+ * @param {Array} [props] containing x and y keys
+ * @return {Number} distance
+ */
+ function getDistance(p1, p2, props) {
+ if (!props) {
+ props = PROPS_XY;
+ }
+ var x = p2[props[0]] - p1[props[0]],
+ y = p2[props[1]] - p1[props[1]];
+
+ return Math.sqrt((x * x) + (y * y));
+ }
+
+ /**
+ * calculate the angle between two coordinates
+ * @param {Object} p1
+ * @param {Object} p2
+ * @param {Array} [props] containing x and y keys
+ * @return {Number} angle
+ */
+ function getAngle(p1, p2, props) {
+ if (!props) {
+ props = PROPS_XY;
+ }
+ var x = p2[props[0]] - p1[props[0]],
+ y = p2[props[1]] - p1[props[1]];
+ return Math.atan2(y, x) * 180 / Math.PI;
+ }
+
+ /**
+ * calculate the rotation degrees between two pointersets
+ * @param {Array} start array of pointers
+ * @param {Array} end array of pointers
+ * @return {Number} rotation
+ */
+ function getRotation(start, end) {
+ return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
+ }
+
+ /**
+ * calculate the scale factor between two pointersets
+ * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
+ * @param {Array} start array of pointers
+ * @param {Array} end array of pointers
+ * @return {Number} scale
+ */
+ function getScale(start, end) {
+ return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
+ }
+
+ var MOUSE_INPUT_MAP = {
+ mousedown: INPUT_START,
+ mousemove: INPUT_MOVE,
+ mouseup: INPUT_END
+ };
+
+ var MOUSE_ELEMENT_EVENTS = 'mousedown';
+ var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
+
+ /**
+ * Mouse events input
+ * @constructor
+ * @extends Input
+ */
+ function MouseInput() {
+ this.evEl = MOUSE_ELEMENT_EVENTS;
+ this.evWin = MOUSE_WINDOW_EVENTS;
+
+ this.pressed = false; // mousedown state
+
+ Input.apply(this, arguments);
+ }
+
+ inherit(MouseInput, Input, {
+ /**
+ * handle mouse events
+ * @param {Object} ev
+ */
+ handler: function MEhandler(ev) {
+ var eventType = MOUSE_INPUT_MAP[ev.type];
+
+ // on start we want to have the left mouse button down
+ if (eventType & INPUT_START && ev.button === 0) {
+ this.pressed = true;
+ }
+
+ if (eventType & INPUT_MOVE && ev.which !== 1) {
+ eventType = INPUT_END;
+ }
+
+ // mouse must be down
+ if (!this.pressed) {
+ return;
+ }
+
+ if (eventType & INPUT_END) {
+ this.pressed = false;
+ }
+
+ this.callback(this.manager, eventType, {
+ pointers: [ev],
+ changedPointers: [ev],
+ pointerType: INPUT_TYPE_MOUSE,
+ srcEvent: ev
+ });
+ }
+ });
+
+ var POINTER_INPUT_MAP = {
+ pointerdown: INPUT_START,
+ pointermove: INPUT_MOVE,
+ pointerup: INPUT_END,
+ pointercancel: INPUT_CANCEL,
+ pointerout: INPUT_CANCEL
+ };
+
+ // in IE10 the pointer types is defined as an enum
+ var IE10_POINTER_TYPE_ENUM = {
+ 2: INPUT_TYPE_TOUCH,
+ 3: INPUT_TYPE_PEN,
+ 4: INPUT_TYPE_MOUSE,
+ 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
+ };
+
+ var POINTER_ELEMENT_EVENTS = 'pointerdown';
+ var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
+
+ // IE10 has prefixed support, and case-sensitive
+ if (window.MSPointerEvent && !window.PointerEvent) {
+ POINTER_ELEMENT_EVENTS = 'MSPointerDown';
+ POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
+ }
+
+ /**
+ * Pointer events input
+ * @constructor
+ * @extends Input
+ */
+ function PointerEventInput() {
+ this.evEl = POINTER_ELEMENT_EVENTS;
+ this.evWin = POINTER_WINDOW_EVENTS;
+
+ Input.apply(this, arguments);
+
+ this.store = (this.manager.session.pointerEvents = []);
+ }
+
+ inherit(PointerEventInput, Input, {
+ /**
+ * handle mouse events
+ * @param {Object} ev
+ */
+ handler: function PEhandler(ev) {
+ var store = this.store;
+ var removePointer = false;
+
+ var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
+ var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
+ var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
+
+ var isTouch = (pointerType == INPUT_TYPE_TOUCH);
+
+ // get index of the event in the store
+ var storeIndex = inArray(store, ev.pointerId, 'pointerId');
+
+ // start and mouse must be down
+ if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
+ if (storeIndex < 0) {
+ store.push(ev);
+ storeIndex = store.length - 1;
+ }
+ } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
+ removePointer = true;
+ }
+
+ // it not found, so the pointer hasn't been down (so it's probably a hover)
+ if (storeIndex < 0) {
+ return;
+ }
+
+ // update the event in the store
+ store[storeIndex] = ev;
+
+ this.callback(this.manager, eventType, {
+ pointers: store,
+ changedPointers: [ev],
+ pointerType: pointerType,
+ srcEvent: ev
+ });
+
+ if (removePointer) {
+ // remove from the store
+ store.splice(storeIndex, 1);
+ }
+ }
+ });
+
+ var SINGLE_TOUCH_INPUT_MAP = {
+ touchstart: INPUT_START,
+ touchmove: INPUT_MOVE,
+ touchend: INPUT_END,
+ touchcancel: INPUT_CANCEL
+ };
+
+ var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
+ var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
+
+ /**
+ * Touch events input
+ * @constructor
+ * @extends Input
+ */
+ function SingleTouchInput() {
+ this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
+ this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
+ this.started = false;
+
+ Input.apply(this, arguments);
+ }
+
+ inherit(SingleTouchInput, Input, {
+ handler: function TEhandler(ev) {
+ var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
+
+ // should we handle the touch events?
+ if (type === INPUT_START) {
+ this.started = true;
+ }
+
+ if (!this.started) {
+ return;
+ }
+
+ var touches = normalizeSingleTouches.call(this, ev, type);
+
+ // when done, reset the started state
+ if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
+ this.started = false;
+ }
+
+ this.callback(this.manager, type, {
+ pointers: touches[0],
+ changedPointers: touches[1],
+ pointerType: INPUT_TYPE_TOUCH,
+ srcEvent: ev
+ });
+ }
+ });
+
+ /**
+ * @this {TouchInput}
+ * @param {Object} ev
+ * @param {Number} type flag
+ * @returns {undefined|Array} [all, changed]
+ */
+ function normalizeSingleTouches(ev, type) {
+ var all = toArray(ev.touches);
+ var changed = toArray(ev.changedTouches);
+
+ if (type & (INPUT_END | INPUT_CANCEL)) {
+ all = uniqueArray(all.concat(changed), 'identifier', true);
+ }
+
+ return [all, changed];
+ }
+
+ var TOUCH_INPUT_MAP = {
+ touchstart: INPUT_START,
+ touchmove: INPUT_MOVE,
+ touchend: INPUT_END,
+ touchcancel: INPUT_CANCEL
+ };
+
+ var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
+
+ /**
+ * Multi-user touch events input
+ * @constructor
+ * @extends Input
+ */
+ function TouchInput() {
+ this.evTarget = TOUCH_TARGET_EVENTS;
+ this.targetIds = {};
+
+ Input.apply(this, arguments);
+ }
+
+ inherit(TouchInput, Input, {
+ handler: function MTEhandler(ev) {
+ var type = TOUCH_INPUT_MAP[ev.type];
+ var touches = getTouches.call(this, ev, type);
+ if (!touches) {
+ return;
+ }
+
+ this.callback(this.manager, type, {
+ pointers: touches[0],
+ changedPointers: touches[1],
+ pointerType: INPUT_TYPE_TOUCH,
+ srcEvent: ev
+ });
+ }
+ });
+
+ /**
+ * @this {TouchInput}
+ * @param {Object} ev
+ * @param {Number} type flag
+ * @returns {undefined|Array} [all, changed]
+ */
+ function getTouches(ev, type) {
+ var allTouches = toArray(ev.touches);
+ var targetIds = this.targetIds;
+
+ // when there is only one touch, the process can be simplified
+ if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
+ targetIds[allTouches[0].identifier] = true;
+ return [allTouches, allTouches];
+ }
+
+ var i,
+ targetTouches,
+ changedTouches = toArray(ev.changedTouches),
+ changedTargetTouches = [],
+ target = this.target;
+
+ // get target touches from touches
+ targetTouches = allTouches.filter(function(touch) {
+ return hasParent(touch.target, target);
+ });
+
+ // collect touches
+ if (type === INPUT_START) {
+ i = 0;
+ while (i < targetTouches.length) {
+ targetIds[targetTouches[i].identifier] = true;
+ i++;
+ }
+ }
+
+ // filter changed touches to only contain touches that exist in the collected target ids
+ i = 0;
+ while (i < changedTouches.length) {
+ if (targetIds[changedTouches[i].identifier]) {
+ changedTargetTouches.push(changedTouches[i]);
+ }
+
+ // cleanup removed touches
+ if (type & (INPUT_END | INPUT_CANCEL)) {
+ delete targetIds[changedTouches[i].identifier];
+ }
+ i++;
+ }
+
+ if (!changedTargetTouches.length) {
+ return;
+ }
+
+ return [
+ // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
+ uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),
+ changedTargetTouches
+ ];
+ }
+
+ /**
+ * Combined touch and mouse input
+ *
+ * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
+ * This because touch devices also emit mouse events while doing a touch.
+ *
+ * @constructor
+ * @extends Input
+ */
+
+ var DEDUP_TIMEOUT = 2500;
+ var DEDUP_DISTANCE = 25;
+
+ function TouchMouseInput() {
+ Input.apply(this, arguments);
+
+ var handler = bindFn(this.handler, this);
+ this.touch = new TouchInput(this.manager, handler);
+ this.mouse = new MouseInput(this.manager, handler);
+
+ this.primaryTouch = null;
+ this.lastTouches = [];
+ }
+
+ inherit(TouchMouseInput, Input, {
+ /**
+ * handle mouse and touch events
+ * @param {Hammer} manager
+ * @param {String} inputEvent
+ * @param {Object} inputData
+ */
+ handler: function TMEhandler(manager, inputEvent, inputData) {
+ var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
+ isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
+
+ if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
+ return;
+ }
+
+ // when we're in a touch event, record touches to de-dupe synthetic mouse event
+ if (isTouch) {
+ recordTouches.call(this, inputEvent, inputData);
+ } else if (isMouse && isSyntheticEvent.call(this, inputData)) {
+ return;
+ }
+
+ this.callback(manager, inputEvent, inputData);
+ },
+
+ /**
+ * remove the event listeners
+ */
+ destroy: function destroy() {
+ this.touch.destroy();
+ this.mouse.destroy();
+ }
+ });
+
+ function recordTouches(eventType, eventData) {
+ if (eventType & INPUT_START) {
+ this.primaryTouch = eventData.changedPointers[0].identifier;
+ setLastTouch.call(this, eventData);
+ } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
+ setLastTouch.call(this, eventData);
+ }
+ }
+
+ function setLastTouch(eventData) {
+ var touch = eventData.changedPointers[0];
+
+ if (touch.identifier === this.primaryTouch) {
+ var lastTouch = {x: touch.clientX, y: touch.clientY};
+ this.lastTouches.push(lastTouch);
+ var lts = this.lastTouches;
+ var removeLastTouch = function() {
+ var i = lts.indexOf(lastTouch);
+ if (i > -1) {
+ lts.splice(i, 1);
+ }
+ };
+ setTimeout(removeLastTouch, DEDUP_TIMEOUT);
+ }
+ }
+
+ function isSyntheticEvent(eventData) {
+ var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;
+ for (var i = 0; i < this.lastTouches.length; i++) {
+ var t = this.lastTouches[i];
+ var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
+ if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
+ var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
+
+ // magical touchAction value
+ var TOUCH_ACTION_COMPUTE = 'compute';
+ var TOUCH_ACTION_AUTO = 'auto';
+ var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
+ var TOUCH_ACTION_NONE = 'none';
+ var TOUCH_ACTION_PAN_X = 'pan-x';
+ var TOUCH_ACTION_PAN_Y = 'pan-y';
+ var TOUCH_ACTION_MAP = getTouchActionProps();
+
+ /**
+ * Touch Action
+ * sets the touchAction property or uses the js alternative
+ * @param {Manager} manager
+ * @param {String} value
+ * @constructor
+ */
+ function TouchAction(manager, value) {
+ this.manager = manager;
+ this.set(value);
+ }
+
+ TouchAction.prototype = {
+ /**
+ * set the touchAction value on the element or enable the polyfill
+ * @param {String} value
+ */
+ set: function(value) {
+ // find out the touch-action by the event handlers
+ if (value == TOUCH_ACTION_COMPUTE) {
+ value = this.compute();
+ }
+
+ if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
+ this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
+ }
+ this.actions = value.toLowerCase().trim();
+ },
+
+ /**
+ * just re-set the touchAction value
+ */
+ update: function() {
+ this.set(this.manager.options.touchAction);
+ },
+
+ /**
+ * compute the value for the touchAction property based on the recognizer's settings
+ * @returns {String} value
+ */
+ compute: function() {
+ var actions = [];
+ each(this.manager.recognizers, function(recognizer) {
+ if (boolOrFn(recognizer.options.enable, [recognizer])) {
+ actions = actions.concat(recognizer.getTouchAction());
+ }
+ });
+ return cleanTouchActions(actions.join(' '));
+ },
+
+ /**
+ * this method is called on each input cycle and provides the preventing of the browser behavior
+ * @param {Object} input
+ */
+ preventDefaults: function(input) {
+ var srcEvent = input.srcEvent;
+ var direction = input.offsetDirection;
+
+ // if the touch action did prevented once this session
+ if (this.manager.session.prevented) {
+ srcEvent.preventDefault();
+ return;
+ }
+
+ var actions = this.actions;
+ var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
+ var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
+ var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
+
+ if (hasNone) {
+ //do not prevent defaults if this is a tap gesture
+
+ var isTapPointer = input.pointers.length === 1;
+ var isTapMovement = input.distance < 2;
+ var isTapTouchTime = input.deltaTime < 250;
+
+ if (isTapPointer && isTapMovement && isTapTouchTime) {
+ return;
+ }
+ }
+
+ if (hasPanX && hasPanY) {
+ // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
+ return;
+ }
+
+ if (hasNone ||
+ (hasPanY && direction & DIRECTION_HORIZONTAL) ||
+ (hasPanX && direction & DIRECTION_VERTICAL)) {
+ return this.preventSrc(srcEvent);
+ }
+ },
+
+ /**
+ * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
+ * @param {Object} srcEvent
+ */
+ preventSrc: function(srcEvent) {
+ this.manager.session.prevented = true;
+ srcEvent.preventDefault();
+ }
+ };
+
+ /**
+ * when the touchActions are collected they are not a valid value, so we need to clean things up. *
+ * @param {String} actions
+ * @returns {*}
+ */
+ function cleanTouchActions(actions) {
+ // none
+ if (inStr(actions, TOUCH_ACTION_NONE)) {
+ return TOUCH_ACTION_NONE;
+ }
+
+ var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
+ var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
+
+ // if both pan-x and pan-y are set (different recognizers
+ // for different directions, e.g. horizontal pan but vertical swipe?)
+ // we need none (as otherwise with pan-x pan-y combined none of these
+ // recognizers will work, since the browser would handle all panning
+ if (hasPanX && hasPanY) {
+ return TOUCH_ACTION_NONE;
+ }
+
+ // pan-x OR pan-y
+ if (hasPanX || hasPanY) {
+ return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
+ }
+
+ // manipulation
+ if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
+ return TOUCH_ACTION_MANIPULATION;
+ }
+
+ return TOUCH_ACTION_AUTO;
+ }
+
+ function getTouchActionProps() {
+ if (!NATIVE_TOUCH_ACTION) {
+ return false;
+ }
+ var touchMap = {};
+ var cssSupports = window.CSS && window.CSS.supports;
+ ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {
+
+ // If css.supports is not supported but there is native touch-action assume it supports
+ // all values. This is the case for IE 10 and 11.
+ touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
+ });
+ return touchMap;
+ }
+
+ /**
+ * Recognizer flow explained; *
+ * All recognizers have the initial state of POSSIBLE when a input session starts.
+ * The definition of a input session is from the first input until the last input, with all it's movement in it. *
+ * Example session for mouse-input: mousedown -> mousemove -> mouseup
+ *
+ * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
+ * which determines with state it should be.
+ *
+ * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
+ * POSSIBLE to give it another change on the next cycle.
+ *
+ * Possible
+ * |
+ * +-----+---------------+
+ * | |
+ * +-----+-----+ |
+ * | | |
+ * Failed Cancelled |
+ * +-------+------+
+ * | |
+ * Recognized Began
+ * |
+ * Changed
+ * |
+ * Ended/Recognized
+ */
+ var STATE_POSSIBLE = 1;
+ var STATE_BEGAN = 2;
+ var STATE_CHANGED = 4;
+ var STATE_ENDED = 8;
+ var STATE_RECOGNIZED = STATE_ENDED;
+ var STATE_CANCELLED = 16;
+ var STATE_FAILED = 32;
+
+ /**
+ * Recognizer
+ * Every recognizer needs to extend from this class.
+ * @constructor
+ * @param {Object} options
+ */
+ function Recognizer(options) {
+ this.options = assign({}, this.defaults, options || {});
+
+ this.id = uniqueId();
+
+ this.manager = null;
+
+ // default is enable true
+ this.options.enable = ifUndefined(this.options.enable, true);
+
+ this.state = STATE_POSSIBLE;
+
+ this.simultaneous = {};
+ this.requireFail = [];
+ }
+
+ Recognizer.prototype = {
+ /**
+ * @virtual
+ * @type {Object}
+ */
+ defaults: {},
+
+ /**
+ * set options
+ * @param {Object} options
+ * @return {Recognizer}
+ */
+ set: function(options) {
+ assign(this.options, options);
+
+ // also update the touchAction, in case something changed about the directions/enabled state
+ this.manager && this.manager.touchAction.update();
+ return this;
+ },
+
+ /**
+ * recognize simultaneous with an other recognizer.
+ * @param {Recognizer} otherRecognizer
+ * @returns {Recognizer} this
+ */
+ recognizeWith: function(otherRecognizer) {
+ if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
+ return this;
+ }
+
+ var simultaneous = this.simultaneous;
+ otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
+ if (!simultaneous[otherRecognizer.id]) {
+ simultaneous[otherRecognizer.id] = otherRecognizer;
+ otherRecognizer.recognizeWith(this);
+ }
+ return this;
+ },
+
+ /**
+ * drop the simultaneous link. it doesnt remove the link on the other recognizer.
+ * @param {Recognizer} otherRecognizer
+ * @returns {Recognizer} this
+ */
+ dropRecognizeWith: function(otherRecognizer) {
+ if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
+ return this;
+ }
+
+ otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
+ delete this.simultaneous[otherRecognizer.id];
+ return this;
+ },
+
+ /**
+ * recognizer can only run when an other is failing
+ * @param {Recognizer} otherRecognizer
+ * @returns {Recognizer} this
+ */
+ requireFailure: function(otherRecognizer) {
+ if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
+ return this;
+ }
+
+ var requireFail = this.requireFail;
+ otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
+ if (inArray(requireFail, otherRecognizer) === -1) {
+ requireFail.push(otherRecognizer);
+ otherRecognizer.requireFailure(this);
+ }
+ return this;
+ },
+
+ /**
+ * drop the requireFailure link. it does not remove the link on the other recognizer.
+ * @param {Recognizer} otherRecognizer
+ * @returns {Recognizer} this
+ */
+ dropRequireFailure: function(otherRecognizer) {
+ if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
+ return this;
+ }
+
+ otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
+ var index = inArray(this.requireFail, otherRecognizer);
+ if (index > -1) {
+ this.requireFail.splice(index, 1);
+ }
+ return this;
+ },
+
+ /**
+ * has require failures boolean
+ * @returns {boolean}
+ */
+ hasRequireFailures: function() {
+ return this.requireFail.length > 0;
+ },
+
+ /**
+ * if the recognizer can recognize simultaneous with an other recognizer
+ * @param {Recognizer} otherRecognizer
+ * @returns {Boolean}
+ */
+ canRecognizeWith: function(otherRecognizer) {
+ return !!this.simultaneous[otherRecognizer.id];
+ },
+
+ /**
+ * You should use `tryEmit` instead of `emit` directly to check
+ * that all the needed recognizers has failed before emitting.
+ * @param {Object} input
+ */
+ emit: function(input) {
+ var self = this;
+ var state = this.state;
+
+ function emit(event) {
+ self.manager.emit(event, input);
+ }
+
+ // 'panstart' and 'panmove'
+ if (state < STATE_ENDED) {
+ emit(self.options.event + stateStr(state));
+ }
+
+ emit(self.options.event); // simple 'eventName' events
+
+ if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)
+ emit(input.additionalEvent);
+ }
+
+ // panend and pancancel
+ if (state >= STATE_ENDED) {
+ emit(self.options.event + stateStr(state));
+ }
+ },
+
+ /**
+ * Check that all the require failure recognizers has failed,
+ * if true, it emits a gesture event,
+ * otherwise, setup the state to FAILED.
+ * @param {Object} input
+ */
+ tryEmit: function(input) {
+ if (this.canEmit()) {
+ return this.emit(input);
+ }
+ // it's failing anyway
+ this.state = STATE_FAILED;
+ },
+
+ /**
+ * can we emit?
+ * @returns {boolean}
+ */
+ canEmit: function() {
+ var i = 0;
+ while (i < this.requireFail.length) {
+ if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
+ return false;
+ }
+ i++;
+ }
+ return true;
+ },
+
+ /**
+ * update the recognizer
+ * @param {Object} inputData
+ */
+ recognize: function(inputData) {
+ // make a new copy of the inputData
+ // so we can change the inputData without messing up the other recognizers
+ var inputDataClone = assign({}, inputData);
+
+ // is is enabled and allow recognizing?
+ if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
+ this.reset();
+ this.state = STATE_FAILED;
+ return;
+ }
+
+ // reset when we've reached the end
+ if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
+ this.state = STATE_POSSIBLE;
+ }
+
+ this.state = this.process(inputDataClone);
+
+ // the recognizer has recognized a gesture
+ // so trigger an event
+ if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
+ this.tryEmit(inputDataClone);
+ }
+ },
+
+ /**
+ * return the state of the recognizer
+ * the actual recognizing happens in this method
+ * @virtual
+ * @param {Object} inputData
+ * @returns {Const} STATE
+ */
+ process: function(inputData) { }, // jshint ignore:line
+
+ /**
+ * return the preferred touch-action
+ * @virtual
+ * @returns {Array}
+ */
+ getTouchAction: function() { },
+
+ /**
+ * called when the gesture isn't allowed to recognize
+ * like when another is being recognized or it is disabled
+ * @virtual
+ */
+ reset: function() { }
+ };
+
+ /**
+ * get a usable string, used as event postfix
+ * @param {Const} state
+ * @returns {String} state
+ */
+ function stateStr(state) {
+ if (state & STATE_CANCELLED) {
+ return 'cancel';
+ } else if (state & STATE_ENDED) {
+ return 'end';
+ } else if (state & STATE_CHANGED) {
+ return 'move';
+ } else if (state & STATE_BEGAN) {
+ return 'start';
+ }
+ return '';
+ }
+
+ /**
+ * direction cons to string
+ * @param {Const} direction
+ * @returns {String}
+ */
+ function directionStr(direction) {
+ if (direction == DIRECTION_DOWN) {
+ return 'down';
+ } else if (direction == DIRECTION_UP) {
+ return 'up';
+ } else if (direction == DIRECTION_LEFT) {
+ return 'left';
+ } else if (direction == DIRECTION_RIGHT) {
+ return 'right';
+ }
+ return '';
+ }
+
+ /**
+ * get a recognizer by name if it is bound to a manager
+ * @param {Recognizer|String} otherRecognizer
+ * @param {Recognizer} recognizer
+ * @returns {Recognizer}
+ */
+ function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
+ var manager = recognizer.manager;
+ if (manager) {
+ return manager.get(otherRecognizer);
+ }
+ return otherRecognizer;
+ }
+
+ /**
+ * This recognizer is just used as a base for the simple attribute recognizers.
+ * @constructor
+ * @extends Recognizer
+ */
+ function AttrRecognizer() {
+ Recognizer.apply(this, arguments);
+ }
+
+ inherit(AttrRecognizer, Recognizer, {
+ /**
+ * @namespace
+ * @memberof AttrRecognizer
+ */
+ defaults: {
+ /**
+ * @type {Number}
+ * @default 1
+ */
+ pointers: 1
+ },
+
+ /**
+ * Used to check if it the recognizer receives valid input, like input.distance > 10.
+ * @memberof AttrRecognizer
+ * @param {Object} input
+ * @returns {Boolean} recognized
+ */
+ attrTest: function(input) {
+ var optionPointers = this.options.pointers;
+ return optionPointers === 0 || input.pointers.length === optionPointers;
+ },
+
+ /**
+ * Process the input and return the state for the recognizer
+ * @memberof AttrRecognizer
+ * @param {Object} input
+ * @returns {*} State
+ */
+ process: function(input) {
+ var state = this.state;
+ var eventType = input.eventType;
+
+ var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
+ var isValid = this.attrTest(input);
+
+ // on cancel input and we've recognized before, return STATE_CANCELLED
+ if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
+ return state | STATE_CANCELLED;
+ } else if (isRecognized || isValid) {
+ if (eventType & INPUT_END) {
+ return state | STATE_ENDED;
+ } else if (!(state & STATE_BEGAN)) {
+ return STATE_BEGAN;
+ }
+ return state | STATE_CHANGED;
+ }
+ return STATE_FAILED;
+ }
+ });
+
+ /**
+ * Pan
+ * Recognized when the pointer is down and moved in the allowed direction.
+ * @constructor
+ * @extends AttrRecognizer
+ */
+ function PanRecognizer() {
+ AttrRecognizer.apply(this, arguments);
+
+ this.pX = null;
+ this.pY = null;
+ }
+
+ inherit(PanRecognizer, AttrRecognizer, {
+ /**
+ * @namespace
+ * @memberof PanRecognizer
+ */
+ defaults: {
+ event: 'pan',
+ threshold: 10,
+ pointers: 1,
+ direction: DIRECTION_ALL
+ },
+
+ getTouchAction: function() {
+ var direction = this.options.direction;
+ var actions = [];
+ if (direction & DIRECTION_HORIZONTAL) {
+ actions.push(TOUCH_ACTION_PAN_Y);
+ }
+ if (direction & DIRECTION_VERTICAL) {
+ actions.push(TOUCH_ACTION_PAN_X);
+ }
+ return actions;
+ },
+
+ directionTest: function(input) {
+ var options = this.options;
+ var hasMoved = true;
+ var distance = input.distance;
+ var direction = input.direction;
+ var x = input.deltaX;
+ var y = input.deltaY;
+
+ // lock to axis?
+ if (!(direction & options.direction)) {
+ if (options.direction & DIRECTION_HORIZONTAL) {
+ direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
+ hasMoved = x != this.pX;
+ distance = Math.abs(input.deltaX);
+ } else {
+ direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
+ hasMoved = y != this.pY;
+ distance = Math.abs(input.deltaY);
+ }
+ }
+ input.direction = direction;
+ return hasMoved && distance > options.threshold && direction & options.direction;
+ },
+
+ attrTest: function(input) {
+ return AttrRecognizer.prototype.attrTest.call(this, input) &&
+ (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
+ },
+
+ emit: function(input) {
+
+ this.pX = input.deltaX;
+ this.pY = input.deltaY;
+
+ var direction = directionStr(input.direction);
+
+ if (direction) {
+ input.additionalEvent = this.options.event + direction;
+ }
+ this._super.emit.call(this, input);
+ }
+ });
+
+ /**
+ * Pinch
+ * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
+ * @constructor
+ * @extends AttrRecognizer
+ */
+ function PinchRecognizer() {
+ AttrRecognizer.apply(this, arguments);
+ }
+
+ inherit(PinchRecognizer, AttrRecognizer, {
+ /**
+ * @namespace
+ * @memberof PinchRecognizer
+ */
+ defaults: {
+ event: 'pinch',
+ threshold: 0,
+ pointers: 2
+ },
+
+ getTouchAction: function() {
+ return [TOUCH_ACTION_NONE];
+ },
+
+ attrTest: function(input) {
+ return this._super.attrTest.call(this, input) &&
+ (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
+ },
+
+ emit: function(input) {
+ if (input.scale !== 1) {
+ var inOut = input.scale < 1 ? 'in' : 'out';
+ input.additionalEvent = this.options.event + inOut;
+ }
+ this._super.emit.call(this, input);
+ }
+ });
+
+ /**
+ * Press
+ * Recognized when the pointer is down for x ms without any movement.
+ * @constructor
+ * @extends Recognizer
+ */
+ function PressRecognizer() {
+ Recognizer.apply(this, arguments);
+
+ this._timer = null;
+ this._input = null;
+ }
+
+ inherit(PressRecognizer, Recognizer, {
+ /**
+ * @namespace
+ * @memberof PressRecognizer
+ */
+ defaults: {
+ event: 'press',
+ pointers: 1,
+ time: 251, // minimal time of the pointer to be pressed
+ threshold: 9 // a minimal movement is ok, but keep it low
+ },
+
+ getTouchAction: function() {
+ return [TOUCH_ACTION_AUTO];
+ },
+
+ process: function(input) {
+ var options = this.options;
+ var validPointers = input.pointers.length === options.pointers;
+ var validMovement = input.distance < options.threshold;
+ var validTime = input.deltaTime > options.time;
+
+ this._input = input;
+
+ // we only allow little movement
+ // and we've reached an end event, so a tap is possible
+ if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {
+ this.reset();
+ } else if (input.eventType & INPUT_START) {
+ this.reset();
+ this._timer = setTimeoutContext(function() {
+ this.state = STATE_RECOGNIZED;
+ this.tryEmit();
+ }, options.time, this);
+ } else if (input.eventType & INPUT_END) {
+ return STATE_RECOGNIZED;
+ }
+ return STATE_FAILED;
+ },
+
+ reset: function() {
+ clearTimeout(this._timer);
+ },
+
+ emit: function(input) {
+ if (this.state !== STATE_RECOGNIZED) {
+ return;
+ }
+
+ if (input && (input.eventType & INPUT_END)) {
+ this.manager.emit(this.options.event + 'up', input);
+ } else {
+ this._input.timeStamp = now();
+ this.manager.emit(this.options.event, this._input);
+ }
+ }
+ });
+
+ /**
+ * Rotate
+ * Recognized when two or more pointer are moving in a circular motion.
+ * @constructor
+ * @extends AttrRecognizer
+ */
+ function RotateRecognizer() {
+ AttrRecognizer.apply(this, arguments);
+ }
+
+ inherit(RotateRecognizer, AttrRecognizer, {
+ /**
+ * @namespace
+ * @memberof RotateRecognizer
+ */
+ defaults: {
+ event: 'rotate',
+ threshold: 0,
+ pointers: 2
+ },
+
+ getTouchAction: function() {
+ return [TOUCH_ACTION_NONE];
+ },
+
+ attrTest: function(input) {
+ return this._super.attrTest.call(this, input) &&
+ (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
+ }
+ });
+
+ /**
+ * Swipe
+ * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
+ * @constructor
+ * @extends AttrRecognizer
+ */
+ function SwipeRecognizer() {
+ AttrRecognizer.apply(this, arguments);
+ }
+
+ inherit(SwipeRecognizer, AttrRecognizer, {
+ /**
+ * @namespace
+ * @memberof SwipeRecognizer
+ */
+ defaults: {
+ event: 'swipe',
+ threshold: 10,
+ velocity: 0.3,
+ direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
+ pointers: 1
+ },
+
+ getTouchAction: function() {
+ return PanRecognizer.prototype.getTouchAction.call(this);
+ },
+
+ attrTest: function(input) {
+ var direction = this.options.direction;
+ var velocity;
+
+ if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
+ velocity = input.overallVelocity;
+ } else if (direction & DIRECTION_HORIZONTAL) {
+ velocity = input.overallVelocityX;
+ } else if (direction & DIRECTION_VERTICAL) {
+ velocity = input.overallVelocityY;
+ }
+
+ return this._super.attrTest.call(this, input) &&
+ direction & input.offsetDirection &&
+ input.distance > this.options.threshold &&
+ input.maxPointers == this.options.pointers &&
+ abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
+ },
+
+ emit: function(input) {
+ var direction = directionStr(input.offsetDirection);
+ if (direction) {
+ this.manager.emit(this.options.event + direction, input);
+ }
+
+ this.manager.emit(this.options.event, input);
+ }
+ });
+
+ /**
+ * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
+ * between the given interval and position. The delay option can be used to recognize multi-taps without firing
+ * a single tap.
+ *
+ * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
+ * multi-taps being recognized.
+ * @constructor
+ * @extends Recognizer
+ */
+ function TapRecognizer() {
+ Recognizer.apply(this, arguments);
+
+ // previous time and center,
+ // used for tap counting
+ this.pTime = false;
+ this.pCenter = false;
+
+ this._timer = null;
+ this._input = null;
+ this.count = 0;
+ }
+
+ inherit(TapRecognizer, Recognizer, {
+ /**
+ * @namespace
+ * @memberof PinchRecognizer
+ */
+ defaults: {
+ event: 'tap',
+ pointers: 1,
+ taps: 1,
+ interval: 300, // max time between the multi-tap taps
+ time: 250, // max time of the pointer to be down (like finger on the screen)
+ threshold: 9, // a minimal movement is ok, but keep it low
+ posThreshold: 10 // a multi-tap can be a bit off the initial position
+ },
+
+ getTouchAction: function() {
+ return [TOUCH_ACTION_MANIPULATION];
+ },
+
+ process: function(input) {
+ var options = this.options;
+
+ var validPointers = input.pointers.length === options.pointers;
+ var validMovement = input.distance < options.threshold;
+ var validTouchTime = input.deltaTime < options.time;
+
+ this.reset();
+
+ if ((input.eventType & INPUT_START) && (this.count === 0)) {
+ return this.failTimeout();
+ }
+
+ // we only allow little movement
+ // and we've reached an end event, so a tap is possible
+ if (validMovement && validTouchTime && validPointers) {
+ if (input.eventType != INPUT_END) {
+ return this.failTimeout();
+ }
+
+ var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
+ var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
+
+ this.pTime = input.timeStamp;
+ this.pCenter = input.center;
+
+ if (!validMultiTap || !validInterval) {
+ this.count = 1;
+ } else {
+ this.count += 1;
+ }
+
+ this._input = input;
+
+ // if tap count matches we have recognized it,
+ // else it has began recognizing...
+ var tapCount = this.count % options.taps;
+ if (tapCount === 0) {
+ // no failing requirements, immediately trigger the tap event
+ // or wait as long as the multitap interval to trigger
+ if (!this.hasRequireFailures()) {
+ return STATE_RECOGNIZED;
+ } else {
+ this._timer = setTimeoutContext(function() {
+ this.state = STATE_RECOGNIZED;
+ this.tryEmit();
+ }, options.interval, this);
+ return STATE_BEGAN;
+ }
+ }
+ }
+ return STATE_FAILED;
+ },
+
+ failTimeout: function() {
+ this._timer = setTimeoutContext(function() {
+ this.state = STATE_FAILED;
+ }, this.options.interval, this);
+ return STATE_FAILED;
+ },
+
+ reset: function() {
+ clearTimeout(this._timer);
+ },
+
+ emit: function() {
+ if (this.state == STATE_RECOGNIZED) {
+ this._input.tapCount = this.count;
+ this.manager.emit(this.options.event, this._input);
+ }
+ }
+ });
+
+ /**
+ * Simple way to create a manager with a default set of recognizers.
+ * @param {HTMLElement} element
+ * @param {Object} [options]
+ * @constructor
+ */
+ function Hammer(element, options) {
+ options = options || {};
+ options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
+ return new Manager(element, options);
+ }
+
+ /**
+ * @const {string}
+ */
+ Hammer.VERSION = '2.0.7';
+
+ /**
+ * default settings
+ * @namespace
+ */
+ Hammer.defaults = {
+ /**
+ * set if DOM events are being triggered.
+ * But this is slower and unused by simple implementations, so disabled by default.
+ * @type {Boolean}
+ * @default false
+ */
+ domEvents: false,
+
+ /**
+ * The value for the touchAction property/fallback.
+ * When set to `compute` it will magically set the correct value based on the added recognizers.
+ * @type {String}
+ * @default compute
+ */
+ touchAction: TOUCH_ACTION_COMPUTE,
+
+ /**
+ * @type {Boolean}
+ * @default true
+ */
+ enable: true,
+
+ /**
+ * EXPERIMENTAL FEATURE -- can be removed/changed
+ * Change the parent input target element.
+ * If Null, then it is being set the to main element.
+ * @type {Null|EventTarget}
+ * @default null
+ */
+ inputTarget: null,
+
+ /**
+ * force an input class
+ * @type {Null|Function}
+ * @default null
+ */
+ inputClass: null,
+
+ /**
+ * Default recognizer setup when calling `Hammer()`
+ * When creating a new Manager these will be skipped.
+ * @type {Array}
+ */
+ preset: [
+ // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
+ [RotateRecognizer, {enable: false}],
+ [PinchRecognizer, {enable: false}, ['rotate']],
+ [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],
+ [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],
+ [TapRecognizer],
+ [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],
+ [PressRecognizer]
+ ],
+
+ /**
+ * Some CSS properties can be used to improve the working of Hammer.
+ * Add them to this method and they will be set when creating a new Manager.
+ * @namespace
+ */
+ cssProps: {
+ /**
+ * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
+ * @type {String}
+ * @default 'none'
+ */
+ userSelect: 'none',
+
+ /**
+ * Disable the Windows Phone grippers when pressing an element.
+ * @type {String}
+ * @default 'none'
+ */
+ touchSelect: 'none',
+
+ /**
+ * Disables the default callout shown when you touch and hold a touch target.
+ * On iOS, when you touch and hold a touch target such as a link, Safari displays
+ * a callout containing information about the link. This property allows you to disable that callout.
+ * @type {String}
+ * @default 'none'
+ */
+ touchCallout: 'none',
+
+ /**
+ * Specifies whether zooming is enabled. Used by IE10>
+ * @type {String}
+ * @default 'none'
+ */
+ contentZooming: 'none',
+
+ /**
+ * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
+ * @type {String}
+ * @default 'none'
+ */
+ userDrag: 'none',
+
+ /**
+ * Overrides the highlight color shown when the user taps a link or a JavaScript
+ * clickable element in iOS. This property obeys the alpha value, if specified.
+ * @type {String}
+ * @default 'rgba(0,0,0,0)'
+ */
+ tapHighlightColor: 'rgba(0,0,0,0)'
+ }
+ };
+
+ var STOP = 1;
+ var FORCED_STOP = 2;
+
+ /**
+ * Manager
+ * @param {HTMLElement} element
+ * @param {Object} [options]
+ * @constructor
+ */
+ function Manager(element, options) {
+ this.options = assign({}, Hammer.defaults, options || {});
+
+ this.options.inputTarget = this.options.inputTarget || element;
+
+ this.handlers = {};
+ this.session = {};
+ this.recognizers = [];
+ this.oldCssProps = {};
+
+ this.element = element;
+ this.input = createInputInstance(this);
+ this.touchAction = new TouchAction(this, this.options.touchAction);
+
+ toggleCssProps(this, true);
+
+ each(this.options.recognizers, function(item) {
+ var recognizer = this.add(new (item[0])(item[1]));
+ item[2] && recognizer.recognizeWith(item[2]);
+ item[3] && recognizer.requireFailure(item[3]);
+ }, this);
+ }
+
+ Manager.prototype = {
+ /**
+ * set options
+ * @param {Object} options
+ * @returns {Manager}
+ */
+ set: function(options) {
+ assign(this.options, options);
+
+ // Options that need a little more setup
+ if (options.touchAction) {
+ this.touchAction.update();
+ }
+ if (options.inputTarget) {
+ // Clean up existing event listeners and reinitialize
+ this.input.destroy();
+ this.input.target = options.inputTarget;
+ this.input.init();
+ }
+ return this;
+ },
+
+ /**
+ * stop recognizing for this session.
+ * This session will be discarded, when a new [input]start event is fired.
+ * When forced, the recognizer cycle is stopped immediately.
+ * @param {Boolean} [force]
+ */
+ stop: function(force) {
+ this.session.stopped = force ? FORCED_STOP : STOP;
+ },
+
+ /**
+ * run the recognizers!
+ * called by the inputHandler function on every movement of the pointers (touches)
+ * it walks through all the recognizers and tries to detect the gesture that is being made
+ * @param {Object} inputData
+ */
+ recognize: function(inputData) {
+ var session = this.session;
+ if (session.stopped) {
+ return;
+ }
+
+ // run the touch-action polyfill
+ this.touchAction.preventDefaults(inputData);
+
+ var recognizer;
+ var recognizers = this.recognizers;
+
+ // this holds the recognizer that is being recognized.
+ // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
+ // if no recognizer is detecting a thing, it is set to `null`
+ var curRecognizer = session.curRecognizer;
+
+ // reset when the last recognizer is recognized
+ // or when we're in a new session
+ if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
+ curRecognizer = session.curRecognizer = null;
+ }
+
+ var i = 0;
+ while (i < recognizers.length) {
+ recognizer = recognizers[i];
+
+ // find out if we are allowed try to recognize the input for this one.
+ // 1. allow if the session is NOT forced stopped (see the .stop() method)
+ // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
+ // that is being recognized.
+ // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
+ // this can be setup with the `recognizeWith()` method on the recognizer.
+ if (session.stopped !== FORCED_STOP && ( // 1
+ !curRecognizer || recognizer == curRecognizer || // 2
+ recognizer.canRecognizeWith(curRecognizer))) { // 3
+ recognizer.recognize(inputData);
+ } else {
+ recognizer.reset();
+ }
+
+ // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
+ // current active recognizer. but only if we don't already have an active recognizer
+ if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
+ curRecognizer = session.curRecognizer = recognizer;
+ }
+ i++;
+ }
+ },
+
+ /**
+ * get a recognizer by its event name.
+ * @param {Recognizer|String} recognizer
+ * @returns {Recognizer|Null}
+ */
+ get: function(recognizer) {
+ if (recognizer instanceof Recognizer) {
+ return recognizer;
+ }
+
+ var recognizers = this.recognizers;
+ for (var i = 0; i < recognizers.length; i++) {
+ if (recognizers[i].options.event == recognizer) {
+ return recognizers[i];
+ }
+ }
+ return null;
+ },
+
+ /**
+ * add a recognizer to the manager
+ * existing recognizers with the same event name will be removed
+ * @param {Recognizer} recognizer
+ * @returns {Recognizer|Manager}
+ */
+ add: function(recognizer) {
+ if (invokeArrayArg(recognizer, 'add', this)) {
+ return this;
+ }
+
+ // remove existing
+ var existing = this.get(recognizer.options.event);
+ if (existing) {
+ this.remove(existing);
+ }
+
+ this.recognizers.push(recognizer);
+ recognizer.manager = this;
+
+ this.touchAction.update();
+ return recognizer;
+ },
+
+ /**
+ * remove a recognizer by name or instance
+ * @param {Recognizer|String} recognizer
+ * @returns {Manager}
+ */
+ remove: function(recognizer) {
+ if (invokeArrayArg(recognizer, 'remove', this)) {
+ return this;
+ }
+
+ recognizer = this.get(recognizer);
+
+ // let's make sure this recognizer exists
+ if (recognizer) {
+ var recognizers = this.recognizers;
+ var index = inArray(recognizers, recognizer);
+
+ if (index !== -1) {
+ recognizers.splice(index, 1);
+ this.touchAction.update();
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * bind event
+ * @param {String} events
+ * @param {Function} handler
+ * @returns {EventEmitter} this
+ */
+ on: function(events, handler) {
+ if (events === undefined) {
+ return;
+ }
+ if (handler === undefined) {
+ return;
+ }
+
+ var handlers = this.handlers;
+ each(splitStr(events), function(event) {
+ handlers[event] = handlers[event] || [];
+ handlers[event].push(handler);
+ });
+ return this;
+ },
+
+ /**
+ * unbind event, leave emit blank to remove all handlers
+ * @param {String} events
+ * @param {Function} [handler]
+ * @returns {EventEmitter} this
+ */
+ off: function(events, handler) {
+ if (events === undefined) {
+ return;
+ }
+
+ var handlers = this.handlers;
+ each(splitStr(events), function(event) {
+ if (!handler) {
+ delete handlers[event];
+ } else {
+ handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
+ }
+ });
+ return this;
+ },
+
+ /**
+ * emit event to the listeners
+ * @param {String} event
+ * @param {Object} data
+ */
+ emit: function(event, data) {
+ // we also want to trigger dom events
+ if (this.options.domEvents) {
+ triggerDomEvent(event, data);
+ }
+
+ // no handlers, so skip it all
+ var handlers = this.handlers[event] && this.handlers[event].slice();
+ if (!handlers || !handlers.length) {
+ return;
+ }
+
+ data.type = event;
+ data.preventDefault = function() {
+ data.srcEvent.preventDefault();
+ };
+
+ var i = 0;
+ while (i < handlers.length) {
+ handlers[i](data);
+ i++;
+ }
+ },
+
+ /**
+ * destroy the manager and unbinds all events
+ * it doesn't unbind dom events, that is the user own responsibility
+ */
+ destroy: function() {
+ this.element && toggleCssProps(this, false);
+
+ this.handlers = {};
+ this.session = {};
+ this.input.destroy();
+ this.element = null;
+ }
+ };
+
+ /**
+ * add/remove the css properties as defined in manager.options.cssProps
+ * @param {Manager} manager
+ * @param {Boolean} add
+ */
+ function toggleCssProps(manager, add) {
+ var element = manager.element;
+ if (!element.style) {
+ return;
+ }
+ var prop;
+ each(manager.options.cssProps, function(value, name) {
+ prop = prefixed(element.style, name);
+ if (add) {
+ manager.oldCssProps[prop] = element.style[prop];
+ element.style[prop] = value;
+ } else {
+ element.style[prop] = manager.oldCssProps[prop] || '';
+ }
+ });
+ if (!add) {
+ manager.oldCssProps = {};
+ }
+ }
+
+ /**
+ * trigger dom event
+ * @param {String} event
+ * @param {Object} data
+ */
+ function triggerDomEvent(event, data) {
+ var gestureEvent = document.createEvent('Event');
+ gestureEvent.initEvent(event, true, true);
+ gestureEvent.gesture = data;
+ data.target.dispatchEvent(gestureEvent);
+ }
+
+ assign(Hammer, {
+ INPUT_START: INPUT_START,
+ INPUT_MOVE: INPUT_MOVE,
+ INPUT_END: INPUT_END,
+ INPUT_CANCEL: INPUT_CANCEL,
+
+ STATE_POSSIBLE: STATE_POSSIBLE,
+ STATE_BEGAN: STATE_BEGAN,
+ STATE_CHANGED: STATE_CHANGED,
+ STATE_ENDED: STATE_ENDED,
+ STATE_RECOGNIZED: STATE_RECOGNIZED,
+ STATE_CANCELLED: STATE_CANCELLED,
+ STATE_FAILED: STATE_FAILED,
+
+ DIRECTION_NONE: DIRECTION_NONE,
+ DIRECTION_LEFT: DIRECTION_LEFT,
+ DIRECTION_RIGHT: DIRECTION_RIGHT,
+ DIRECTION_UP: DIRECTION_UP,
+ DIRECTION_DOWN: DIRECTION_DOWN,
+ DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
+ DIRECTION_VERTICAL: DIRECTION_VERTICAL,
+ DIRECTION_ALL: DIRECTION_ALL,
+
+ Manager: Manager,
+ Input: Input,
+ TouchAction: TouchAction,
+
+ TouchInput: TouchInput,
+ MouseInput: MouseInput,
+ PointerEventInput: PointerEventInput,
+ TouchMouseInput: TouchMouseInput,
+ SingleTouchInput: SingleTouchInput,
+
+ Recognizer: Recognizer,
+ AttrRecognizer: AttrRecognizer,
+ Tap: TapRecognizer,
+ Pan: PanRecognizer,
+ Swipe: SwipeRecognizer,
+ Pinch: PinchRecognizer,
+ Rotate: RotateRecognizer,
+ Press: PressRecognizer,
+
+ on: addEventListeners,
+ off: removeEventListeners,
+ each: each,
+ merge: merge,
+ extend: extend,
+ assign: assign,
+ inherit: inherit,
+ bindFn: bindFn,
+ prefixed: prefixed
+ });
+
+ // this prevents errors when Hammer is loaded in the presence of an AMD
+ // style loader but by script tag, not by the loader.
+ var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line
+ freeGlobal.Hammer = Hammer;
+
+ if (true) {
+ !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
+ return Hammer;
+ }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ } else if (typeof module != 'undefined' && module.exports) {
+ module.exports = Hammer;
+ } else {
+ window[exportName] = Hammer;
+ }
+
+ })(window, document, 'Hammer');
+
+
+/***/ },
+/* 111 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;"use strict";
+ /**
+ * Created by Alex on 11/6/2014.
+ */
+
+ // https://github.com/umdjs/umd/blob/master/returnExports.js#L40-L60
+ // if the module has no dependencies, the above pattern can be simplified to
+ (function (root, factory) {
+ if (true) {
+ // AMD. Register as an anonymous module.
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ } else if (typeof exports === 'object') {
+ // Node. Does not work with strict CommonJS, but
+ // only CommonJS-like environments that support module.exports,
+ // like Node.
+ module.exports = factory();
+ } else {
+ // Browser globals (root is window)
+ root.keycharm = factory();
+ }
+ }(this, function () {
+
+ function keycharm(options) {
+ var preventDefault = options && options.preventDefault || false;
+
+ var container = options && options.container || window;
+
+ var _exportFunctions = {};
+ var _bound = {keydown:{}, keyup:{}};
+ var _keys = {};
+ var i;
+
+ // a - z
+ for (i = 97; i <= 122; i++) {_keys[String.fromCharCode(i)] = {code:65 + (i - 97), shift: false};}
+ // A - Z
+ for (i = 65; i <= 90; i++) {_keys[String.fromCharCode(i)] = {code:i, shift: true};}
+ // 0 - 9
+ for (i = 0; i <= 9; i++) {_keys['' + i] = {code:48 + i, shift: false};}
+ // F1 - F12
+ for (i = 1; i <= 12; i++) {_keys['F' + i] = {code:111 + i, shift: false};}
+ // num0 - num9
+ for (i = 0; i <= 9; i++) {_keys['num' + i] = {code:96 + i, shift: false};}
+
+ // numpad misc
+ _keys['num*'] = {code:106, shift: false};
+ _keys['num+'] = {code:107, shift: false};
+ _keys['num-'] = {code:109, shift: false};
+ _keys['num/'] = {code:111, shift: false};
+ _keys['num.'] = {code:110, shift: false};
+ // arrows
+ _keys['left'] = {code:37, shift: false};
+ _keys['up'] = {code:38, shift: false};
+ _keys['right'] = {code:39, shift: false};
+ _keys['down'] = {code:40, shift: false};
+ // extra keys
+ _keys['space'] = {code:32, shift: false};
+ _keys['enter'] = {code:13, shift: false};
+ _keys['shift'] = {code:16, shift: undefined};
+ _keys['esc'] = {code:27, shift: false};
+ _keys['backspace'] = {code:8, shift: false};
+ _keys['tab'] = {code:9, shift: false};
+ _keys['ctrl'] = {code:17, shift: false};
+ _keys['alt'] = {code:18, shift: false};
+ _keys['delete'] = {code:46, shift: false};
+ _keys['pageup'] = {code:33, shift: false};
+ _keys['pagedown'] = {code:34, shift: false};
+ // symbols
+ _keys['='] = {code:187, shift: false};
+ _keys['-'] = {code:189, shift: false};
+ _keys[']'] = {code:221, shift: false};
+ _keys['['] = {code:219, shift: false};
+
+
+
+ var down = function(event) {handleEvent(event,'keydown');};
+ var up = function(event) {handleEvent(event,'keyup');};
+
+ // handle the actualy bound key with the event
+ var handleEvent = function(event,type) {
+ if (_bound[type][event.keyCode] !== undefined) {
+ var bound = _bound[type][event.keyCode];
+ for (var i = 0; i < bound.length; i++) {
+ if (bound[i].shift === undefined) {
+ bound[i].fn(event);
+ }
+ else if (bound[i].shift == true && event.shiftKey == true) {
+ bound[i].fn(event);
+ }
+ else if (bound[i].shift == false && event.shiftKey == false) {
+ bound[i].fn(event);
+ }
+ }
+
+ if (preventDefault == true) {
+ event.preventDefault();
+ }
+ }
+ };
+
+ // bind a key to a callback
+ _exportFunctions.bind = function(key, callback, type) {
+ if (type === undefined) {
+ type = 'keydown';
+ }
+ if (_keys[key] === undefined) {
+ throw new Error("unsupported key: " + key);
+ }
+ if (_bound[type][_keys[key].code] === undefined) {
+ _bound[type][_keys[key].code] = [];
+ }
+ _bound[type][_keys[key].code].push({fn:callback, shift:_keys[key].shift});
+ };
+
+
+ // bind all keys to a call back (demo purposes)
+ _exportFunctions.bindAll = function(callback, type) {
+ if (type === undefined) {
+ type = 'keydown';
+ }
+ for (var key in _keys) {
+ if (_keys.hasOwnProperty(key)) {
+ _exportFunctions.bind(key,callback,type);
+ }
+ }
+ };
+
+ // get the key label from an event
+ _exportFunctions.getKey = function(event) {
+ for (var key in _keys) {
+ if (_keys.hasOwnProperty(key)) {
+ if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {
+ return key;
+ }
+ else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) {
+ return key;
+ }
+ else if (event.keyCode == _keys[key].code && key == 'shift') {
+ return key;
+ }
+ }
+ }
+ return "unknown key, currently not supported";
+ };
+
+ // unbind either a specific callback from a key or all of them (by leaving callback undefined)
+ _exportFunctions.unbind = function(key, callback, type) {
+ if (type === undefined) {
+ type = 'keydown';
+ }
+ if (_keys[key] === undefined) {
+ throw new Error("unsupported key: " + key);
+ }
+ if (callback !== undefined) {
+ var newBindings = [];
+ var bound = _bound[type][_keys[key].code];
+ if (bound !== undefined) {
+ for (var i = 0; i < bound.length; i++) {
+ if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) {
+ newBindings.push(_bound[type][_keys[key].code][i]);
+ }
+ }
+ }
+ _bound[type][_keys[key].code] = newBindings;
+ }
+ else {
+ _bound[type][_keys[key].code] = [];
+ }
+ };
+
+ // reset all bound variables.
+ _exportFunctions.reset = function() {
+ _bound = {keydown:{}, keyup:{}};
+ };
+
+ // unbind all listeners and reset all variables.
+ _exportFunctions.destroy = function() {
+ _bound = {keydown:{}, keyup:{}};
+ container.removeEventListener('keydown', down, true);
+ container.removeEventListener('keyup', up, true);
+ };
+
+ // create listeners.
+ container.addEventListener('keydown',down,true);
+ container.addEventListener('keyup',up,true);
+
+ // return the public functions.
+ return _exportFunctions;
+ }
+
+ return keycharm;
+ }));
+
+
+
+
+/***/ },
+/* 112 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ // utils
+ exports.util = __webpack_require__(1);
+ exports.DOMutil = __webpack_require__(90);
+
+ // data
+ exports.DataSet = __webpack_require__(91);
+ exports.DataView = __webpack_require__(93);
+ exports.Queue = __webpack_require__(92);
+
+ // Timeline
+ exports.Timeline = __webpack_require__(113);
+ exports.Graph2d = __webpack_require__(144);
+ exports.timeline = {
+ Core: __webpack_require__(126),
+ DateUtil: __webpack_require__(125),
+ Range: __webpack_require__(123),
+ stack: __webpack_require__(131),
+ TimeStep: __webpack_require__(129),
+
+ components: {
+ items: {
+ Item: __webpack_require__(133),
+ BackgroundItem: __webpack_require__(137),
+ BoxItem: __webpack_require__(135),
+ PointItem: __webpack_require__(136),
+ RangeItem: __webpack_require__(132)
+ },
+
+ BackgroundGroup: __webpack_require__(134),
+ Component: __webpack_require__(124),
+ CurrentTime: __webpack_require__(142),
+ CustomTime: __webpack_require__(140),
+ DataAxis: __webpack_require__(146),
+ DataScale: __webpack_require__(147),
+ GraphGroup: __webpack_require__(148),
+ Group: __webpack_require__(130),
+ ItemSet: __webpack_require__(127),
+ Legend: __webpack_require__(152),
+ LineGraph: __webpack_require__(145),
+ TimeAxis: __webpack_require__(138)
+ }
+ };
+
+ // bundled external libraries
+ exports.moment = __webpack_require__(84);
+ exports.Hammer = __webpack_require__(108);
+ exports.keycharm = __webpack_require__(111);
+
+/***/ },
+/* 113 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _Configurator = __webpack_require__(114);
+
+ var _Configurator2 = _interopRequireDefault(_Configurator);
+
+ var _Validator = __webpack_require__(122);
+
+ var _Validator2 = _interopRequireDefault(_Validator);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Emitter = __webpack_require__(95);
+ var Hammer = __webpack_require__(108);
+ var moment = __webpack_require__(84);
+ var util = __webpack_require__(1);
+ var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+ var Range = __webpack_require__(123);
+ var Core = __webpack_require__(126);
+ var TimeAxis = __webpack_require__(138);
+ var CurrentTime = __webpack_require__(142);
+ var CustomTime = __webpack_require__(140);
+ var ItemSet = __webpack_require__(127);
+
+ var printStyle = __webpack_require__(122).printStyle;
+ var allOptions = __webpack_require__(143).allOptions;
+ var configureOptions = __webpack_require__(143).configureOptions;
+
+ /**
+ * Create a timeline visualization
+ * @param {HTMLElement} container
+ * @param {vis.DataSet | vis.DataView | Array} [items]
+ * @param {vis.DataSet | vis.DataView | Array} [groups]
+ * @param {Object} [options] See Timeline.setOptions for the available options.
+ * @constructor
+ * @extends Core
+ */
+ function Timeline(container, items, groups, options) {
+
+ if (!(this instanceof Timeline)) {
+ throw new SyntaxError('Constructor must be called with the new operator');
+ }
+
+ // if the third element is options, the forth is groups (optionally);
+ if (!(Array.isArray(groups) || groups instanceof DataSet || groups instanceof DataView) && groups instanceof Object) {
+ var forthArgument = options;
+ options = groups;
+ groups = forthArgument;
+ }
+
+ // TODO: REMOVE THIS in the next MAJOR release
+ // see https://github.com/almende/vis/issues/2511
+ if (options && options.throttleRedraw) {
+ console.warn("Timeline option \"throttleRedraw\" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release.");
+ }
+
+ var me = this;
+ this.defaultOptions = {
+ start: null,
+ end: null,
+ autoResize: true,
+ orientation: {
+ axis: 'bottom', // axis orientation: 'bottom', 'top', or 'both'
+ item: 'bottom' // not relevant
+ },
+ moment: moment,
+ width: null,
+ height: null,
+ maxHeight: null,
+ minHeight: null
+ };
+ this.options = util.deepExtend({}, this.defaultOptions);
+
+ // Create the DOM, props, and emitter
+ this._create(container);
+ if (!options || options && typeof options.rtl == "undefined") {
+ var directionFromDom,
+ domNode = this.dom.root;
+ while (!directionFromDom && domNode) {
+ directionFromDom = window.getComputedStyle(domNode, null).direction;
+ domNode = domNode.parentElement;
+ }
+ this.options.rtl = directionFromDom && directionFromDom.toLowerCase() == "rtl";
+ } else {
+ this.options.rtl = options.rtl;
+ }
+
+ this.options.rollingMode = options && options.rollingMode;
+
+ // all components listed here will be repainted automatically
+ this.components = [];
+
+ this.body = {
+ dom: this.dom,
+ domProps: this.props,
+ emitter: {
+ on: this.on.bind(this),
+ off: this.off.bind(this),
+ emit: this.emit.bind(this)
+ },
+ hiddenDates: [],
+ util: {
+ getScale: function getScale() {
+ return me.timeAxis.step.scale;
+ },
+ getStep: function getStep() {
+ return me.timeAxis.step.step;
+ },
+
+ toScreen: me._toScreen.bind(me),
+ toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width
+ toTime: me._toTime.bind(me),
+ toGlobalTime: me._toGlobalTime.bind(me)
+ }
+ };
+
+ // range
+ this.range = new Range(this.body, this.options);
+ this.components.push(this.range);
+ this.body.range = this.range;
+
+ // time axis
+ this.timeAxis = new TimeAxis(this.body, this.options);
+ this.timeAxis2 = null; // used in case of orientation option 'both'
+ this.components.push(this.timeAxis);
+
+ // current time bar
+ this.currentTime = new CurrentTime(this.body, this.options);
+ this.components.push(this.currentTime);
+
+ // item set
+ this.itemSet = new ItemSet(this.body, this.options);
+ this.components.push(this.itemSet);
+
+ this.itemsData = null; // DataSet
+ this.groupsData = null; // DataSet
+
+ this.dom.root.onclick = function (event) {
+ me.emit('click', me.getEventProperties(event));
+ };
+ this.dom.root.ondblclick = function (event) {
+ me.emit('doubleClick', me.getEventProperties(event));
+ };
+ this.dom.root.oncontextmenu = function (event) {
+ me.emit('contextmenu', me.getEventProperties(event));
+ };
+ this.dom.root.onmouseover = function (event) {
+ me.emit('mouseOver', me.getEventProperties(event));
+ };
+ this.dom.root.onmousemove = function (event) {
+ me.emit('mouseMove', me.getEventProperties(event));
+ };
+
+ //Single time autoscale/fit
+ this.fitDone = false;
+ this.on('changed', function () {
+ if (this.itemsData == null || this.options.rollingMode) return;
+ if (!me.fitDone) {
+ me.fitDone = true;
+ if (me.options.start != undefined || me.options.end != undefined) {
+ if (me.options.start == undefined || me.options.end == undefined) {
+ var range = me.getItemRange();
+ }
+
+ var start = me.options.start != undefined ? me.options.start : range.min;
+ var end = me.options.end != undefined ? me.options.end : range.max;
+ me.setWindow(start, end, { animation: false });
+ } else {
+ me.fit({ animation: false });
+ }
+ }
+ });
+
+ // apply options
+ if (options) {
+ this.setOptions(options);
+ }
+
+ // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS!
+ if (groups) {
+ this.setGroups(groups);
+ }
+
+ // create itemset
+ if (items) {
+ this.setItems(items);
+ }
+
+ // draw for the first time
+ this._redraw();
+ }
+
+ // Extend the functionality from Core
+ Timeline.prototype = new Core();
+
+ /**
+ * Load a configurator
+ * @return {Object}
+ * @private
+ */
+ Timeline.prototype._createConfigurator = function () {
+ return new _Configurator2['default'](this, this.dom.container, configureOptions);
+ };
+
+ /**
+ * Force a redraw. The size of all items will be recalculated.
+ * Can be useful to manually redraw when option autoResize=false and the window
+ * has been resized, or when the items CSS has been changed.
+ *
+ * Note: this function will be overridden on construction with a trottled version
+ */
+ Timeline.prototype.redraw = function () {
+ this.itemSet && this.itemSet.markDirty({ refreshItems: true });
+ this._redraw();
+ };
+
+ Timeline.prototype.setOptions = function (options) {
+ // validate options
+ var errorFound = _Validator2['default'].validate(options, allOptions);
+
+ if (errorFound === true) {
+ console.log('%cErrors have been found in the supplied options object.', printStyle);
+ }
+ Core.prototype.setOptions.call(this, options);
+
+ if ('type' in options) {
+ if (options.type !== this.options.type) {
+ this.options.type = options.type;
+
+ // force recreation of all items
+ var itemsData = this.itemsData;
+ if (itemsData) {
+ var selection = this.getSelection();
+ this.setItems(null); // remove all
+ this.setItems(itemsData); // add all
+ this.setSelection(selection); // restore selection
+ }
+ }
+ }
+ };
+
+ /**
+ * Set items
+ * @param {vis.DataSet | Array | null} items
+ */
+ Timeline.prototype.setItems = function (items) {
+ // convert to type DataSet when needed
+ var newDataSet;
+ if (!items) {
+ newDataSet = null;
+ } else if (items instanceof DataSet || items instanceof DataView) {
+ newDataSet = items;
+ } else {
+ // turn an array into a dataset
+ newDataSet = new DataSet(items, {
+ type: {
+ start: 'Date',
+ end: 'Date'
+ }
+ });
+ }
+
+ // set items
+ this.itemsData = newDataSet;
+ this.itemSet && this.itemSet.setItems(newDataSet);
+ };
+
+ /**
+ * Set groups
+ * @param {vis.DataSet | Array} groups
+ */
+ Timeline.prototype.setGroups = function (groups) {
+ // convert to type DataSet when needed
+ var newDataSet;
+ if (!groups) {
+ newDataSet = null;
+ } else {
+ var filter = function filter(group) {
+ return group.visible !== false;
+ };
+ if (groups instanceof DataSet || groups instanceof DataView) {
+ newDataSet = new DataView(groups, { filter: filter });
+ } else {
+ // turn an array into a dataset
+ newDataSet = new DataSet(groups.filter(filter));
+ }
+ }
+
+ this.groupsData = newDataSet;
+ this.itemSet.setGroups(newDataSet);
+ };
+
+ /**
+ * Set both items and groups in one go
+ * @param {{items: Array | vis.DataSet, groups: Array | vis.DataSet}} data
+ */
+ Timeline.prototype.setData = function (data) {
+ if (data && data.groups) {
+ this.setGroups(data.groups);
+ }
+
+ if (data && data.items) {
+ this.setItems(data.items);
+ }
+ };
+
+ /**
+ * Set selected items by their id. Replaces the current selection
+ * Unknown id's are silently ignored.
+ * @param {string[] | string} [ids] An array with zero or more id's of the items to be
+ * selected. If ids is an empty array, all items will be
+ * unselected.
+ * @param {Object} [options] Available options:
+ * `focus: boolean`
+ * If true, focus will be set to the selected item(s)
+ * `animation: boolean | {duration: number, easingFunction: string}`
+ * If true (default), the range is animated
+ * smoothly to the new window. An object can be
+ * provided to specify duration and easing function.
+ * Default duration is 500 ms, and default easing
+ * function is 'easeInOutQuad'.
+ * Only applicable when option focus is true.
+ */
+ Timeline.prototype.setSelection = function (ids, options) {
+ this.itemSet && this.itemSet.setSelection(ids);
+
+ if (options && options.focus) {
+ this.focus(ids, options);
+ }
+ };
+
+ /**
+ * Get the selected items by their id
+ * @return {Array} ids The ids of the selected items
+ */
+ Timeline.prototype.getSelection = function () {
+ return this.itemSet && this.itemSet.getSelection() || [];
+ };
+
+ /**
+ * Adjust the visible window such that the selected item (or multiple items)
+ * are centered on screen.
+ * @param {String | String[]} id An item id or array with item ids
+ * @param {Object} [options] Available options:
+ * `animation: boolean | {duration: number, easingFunction: string}`
+ * If true (default), the range is animated
+ * smoothly to the new window. An object can be
+ * provided to specify duration and easing function.
+ * Default duration is 500 ms, and default easing
+ * function is 'easeInOutQuad'.
+ */
+ Timeline.prototype.focus = function (id, options) {
+ if (!this.itemsData || id == undefined) return;
+
+ var ids = Array.isArray(id) ? id : [id];
+
+ // get the specified item(s)
+ var itemsData = this.itemsData.getDataSet().get(ids, {
+ type: {
+ start: 'Date',
+ end: 'Date'
+ }
+ });
+
+ // calculate minimum start and maximum end of specified items
+ var start = null;
+ var end = null;
+ itemsData.forEach(function (itemData) {
+ var s = itemData.start.valueOf();
+ var e = 'end' in itemData ? itemData.end.valueOf() : itemData.start.valueOf();
+
+ if (start === null || s < start) {
+ start = s;
+ }
+
+ if (end === null || e > end) {
+ end = e;
+ }
+ });
+
+ if (start !== null && end !== null) {
+ // calculate the new middle and interval for the window
+ var middle = (start + end) / 2;
+ var interval = Math.max(this.range.end - this.range.start, (end - start) * 1.1);
+
+ var animation = options && options.animation !== undefined ? options.animation : true;
+ this.range.setRange(middle - interval / 2, middle + interval / 2, animation);
+ }
+ };
+
+ /**
+ * Set Timeline window such that it fits all items
+ * @param {Object} [options] Available options:
+ * `animation: boolean | {duration: number, easingFunction: string}`
+ * If true (default), the range is animated
+ * smoothly to the new window. An object can be
+ * provided to specify duration and easing function.
+ * Default duration is 500 ms, and default easing
+ * function is 'easeInOutQuad'.
+ */
+ Timeline.prototype.fit = function (options) {
+ var animation = options && options.animation !== undefined ? options.animation : true;
+ var range;
+
+ var dataset = this.itemsData && this.itemsData.getDataSet();
+ if (dataset.length === 1 && dataset.get()[0].end === undefined) {
+ // a single item -> don't fit, just show a range around the item from -4 to +3 days
+ range = this.getDataRange();
+ this.moveTo(range.min.valueOf(), { animation: animation });
+ } else {
+ // exactly fit the items (plus a small margin)
+ range = this.getItemRange();
+ this.range.setRange(range.min, range.max, animation);
+ }
+ };
+
+ /**
+ * Determine the range of the items, taking into account their actual width
+ * and a margin of 10 pixels on both sides.
+ * @return {{min: Date | null, max: Date | null}}
+ */
+ Timeline.prototype.getItemRange = function () {
+ var _this = this;
+
+ // get a rough approximation for the range based on the items start and end dates
+ var range = this.getDataRange();
+ var min = range.min !== null ? range.min.valueOf() : null;
+ var max = range.max !== null ? range.max.valueOf() : null;
+ var minItem = null;
+ var maxItem = null;
+
+ if (min != null && max != null) {
+ var interval;
+ var factor;
+ var lhs;
+ var rhs;
+ var delta;
+
+ (function () {
+ var getStart = function getStart(item) {
+ return util.convert(item.data.start, 'Date').valueOf();
+ };
+
+ var getEnd = function getEnd(item) {
+ var end = item.data.end != undefined ? item.data.end : item.data.start;
+ return util.convert(end, 'Date').valueOf();
+ };
+
+ // calculate the date of the left side and right side of the items given
+
+
+ interval = max - min; // ms
+
+ if (interval <= 0) {
+ interval = 10;
+ }
+ factor = interval / _this.props.center.width;
+ util.forEach(_this.itemSet.items, function (item) {
+ if (item.groupShowing) {
+ item.show();
+ item.repositionX();
+ }
+
+ var start = getStart(item);
+ var end = getEnd(item);
+
+ if (this.options.rtl) {
+ var startSide = start - (item.getWidthRight() + 10) * factor;
+ var endSide = end + (item.getWidthLeft() + 10) * factor;
+ } else {
+ var startSide = start - (item.getWidthLeft() + 10) * factor;
+ var endSide = end + (item.getWidthRight() + 10) * factor;
+ }
+
+ if (startSide < min) {
+ min = startSide;
+ minItem = item;
+ }
+ if (endSide > max) {
+ max = endSide;
+ maxItem = item;
+ }
+ }.bind(_this));
+
+ if (minItem && maxItem) {
+ lhs = minItem.getWidthLeft() + 10;
+ rhs = maxItem.getWidthRight() + 10;
+ delta = _this.props.center.width - lhs - rhs; // px
+
+ if (delta > 0) {
+ if (_this.options.rtl) {
+ min = getStart(minItem) - rhs * interval / delta; // ms
+ max = getEnd(maxItem) + lhs * interval / delta; // ms
+ } else {
+ min = getStart(minItem) - lhs * interval / delta; // ms
+ max = getEnd(maxItem) + rhs * interval / delta; // ms
+ }
+ }
+ }
+ })();
+ }
+
+ return {
+ min: min != null ? new Date(min) : null,
+ max: max != null ? new Date(max) : null
+ };
+ };
+
+ /**
+ * Calculate the data range of the items start and end dates
+ * @returns {{min: Date | null, max: Date | null}}
+ */
+ Timeline.prototype.getDataRange = function () {
+ var min = null;
+ var max = null;
+
+ var dataset = this.itemsData && this.itemsData.getDataSet();
+ if (dataset) {
+ dataset.forEach(function (item) {
+ var start = util.convert(item.start, 'Date').valueOf();
+ var end = util.convert(item.end != undefined ? item.end : item.start, 'Date').valueOf();
+ if (min === null || start < min) {
+ min = start;
+ }
+ if (max === null || end > max) {
+ max = end;
+ }
+ });
+ }
+
+ return {
+ min: min != null ? new Date(min) : null,
+ max: max != null ? new Date(max) : null
+ };
+ };
+
+ /**
+ * Generate Timeline related information from an event
+ * @param {Event} event
+ * @return {Object} An object with related information, like on which area
+ * The event happened, whether clicked on an item, etc.
+ */
+ Timeline.prototype.getEventProperties = function (event) {
+ var clientX = event.center ? event.center.x : event.clientX;
+ var clientY = event.center ? event.center.y : event.clientY;
+ if (this.options.rtl) {
+ var x = util.getAbsoluteRight(this.dom.centerContainer) - clientX;
+ } else {
+ var x = clientX - util.getAbsoluteLeft(this.dom.centerContainer);
+ }
+ var y = clientY - util.getAbsoluteTop(this.dom.centerContainer);
+
+ var item = this.itemSet.itemFromTarget(event);
+ var group = this.itemSet.groupFromTarget(event);
+ var customTime = CustomTime.customTimeFromTarget(event);
+
+ var snap = this.itemSet.options.snap || null;
+ var scale = this.body.util.getScale();
+ var step = this.body.util.getStep();
+ var time = this._toTime(x);
+ var snappedTime = snap ? snap(time, scale, step) : time;
+
+ var element = util.getTarget(event);
+ var what = null;
+ if (item != null) {
+ what = 'item';
+ } else if (customTime != null) {
+ what = 'custom-time';
+ } else if (util.hasParent(element, this.timeAxis.dom.foreground)) {
+ what = 'axis';
+ } else if (this.timeAxis2 && util.hasParent(element, this.timeAxis2.dom.foreground)) {
+ what = 'axis';
+ } else if (util.hasParent(element, this.itemSet.dom.labelSet)) {
+ what = 'group-label';
+ } else if (util.hasParent(element, this.currentTime.bar)) {
+ what = 'current-time';
+ } else if (util.hasParent(element, this.dom.center)) {
+ what = 'background';
+ }
+
+ return {
+ event: event,
+ item: item ? item.id : null,
+ group: group ? group.groupId : null,
+ what: what,
+ pageX: event.srcEvent ? event.srcEvent.pageX : event.pageX,
+ pageY: event.srcEvent ? event.srcEvent.pageY : event.pageY,
+ x: x,
+ y: y,
+ time: time,
+ snappedTime: snappedTime
+ };
+ };
+
+ module.exports = Timeline;
+
+/***/ },
+/* 114 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _ColorPicker = __webpack_require__(120);
+
+ var _ColorPicker2 = _interopRequireDefault(_ColorPicker);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ /**
+ * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options.
+ * Boolean options are recognised as Boolean
+ * Number options should be written as array: [default value, min value, max value, stepsize]
+ * Colors should be written as array: ['color', '#ffffff']
+ * Strings with should be written as array: [option1, option2, option3, ..]
+ *
+ * The options are matched with their counterparts in each of the modules and the values used in the configuration are
+ *
+ * @param parentModule | the location where parentModule.setOptions() can be called
+ * @param defaultContainer | the default container of the module
+ * @param configureOptions | the fully configured and predefined options set found in allOptions.js
+ * @param pixelRatio | canvas pixel ratio
+ */
+ var Configurator = function () {
+ function Configurator(parentModule, defaultContainer, configureOptions) {
+ var pixelRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
+ (0, _classCallCheck3['default'])(this, Configurator);
+
+ this.parent = parentModule;
+ this.changedOptions = [];
+ this.container = defaultContainer;
+ this.allowCreation = false;
+
+ this.options = {};
+ this.initialized = false;
+ this.popupCounter = 0;
+ this.defaultOptions = {
+ enabled: false,
+ filter: true,
+ container: undefined,
+ showButton: true
+ };
+ util.extend(this.options, this.defaultOptions);
+
+ this.configureOptions = configureOptions;
+ this.moduleOptions = {};
+ this.domElements = [];
+ this.popupDiv = {};
+ this.popupLimit = 5;
+ this.popupHistory = {};
+ this.colorPicker = new _ColorPicker2['default'](pixelRatio);
+ this.wrapper = undefined;
+ }
+
+ /**
+ * refresh all options.
+ * Because all modules parse their options by themselves, we just use their options. We copy them here.
+ *
+ * @param options
+ */
+
+
+ (0, _createClass3['default'])(Configurator, [{
+ key: 'setOptions',
+ value: function setOptions(options) {
+ if (options !== undefined) {
+ // reset the popup history because the indices may have been changed.
+ this.popupHistory = {};
+ this._removePopup();
+
+ var enabled = true;
+ if (typeof options === 'string') {
+ this.options.filter = options;
+ } else if (options instanceof Array) {
+ this.options.filter = options.join();
+ } else if ((typeof options === 'undefined' ? 'undefined' : (0, _typeof3['default'])(options)) === 'object') {
+ if (options.container !== undefined) {
+ this.options.container = options.container;
+ }
+ if (options.filter !== undefined) {
+ this.options.filter = options.filter;
+ }
+ if (options.showButton !== undefined) {
+ this.options.showButton = options.showButton;
+ }
+ if (options.enabled !== undefined) {
+ enabled = options.enabled;
+ }
+ } else if (typeof options === 'boolean') {
+ this.options.filter = true;
+ enabled = options;
+ } else if (typeof options === 'function') {
+ this.options.filter = options;
+ enabled = true;
+ }
+ if (this.options.filter === false) {
+ enabled = false;
+ }
+
+ this.options.enabled = enabled;
+ }
+ this._clean();
+ }
+ }, {
+ key: 'setModuleOptions',
+ value: function setModuleOptions(moduleOptions) {
+ this.moduleOptions = moduleOptions;
+ if (this.options.enabled === true) {
+ this._clean();
+ if (this.options.container !== undefined) {
+ this.container = this.options.container;
+ }
+ this._create();
+ }
+ }
+
+ /**
+ * Create all DOM elements
+ * @private
+ */
+
+ }, {
+ key: '_create',
+ value: function _create() {
+ var _this = this;
+
+ this._clean();
+ this.changedOptions = [];
+
+ var filter = this.options.filter;
+ var counter = 0;
+ var show = false;
+ for (var option in this.configureOptions) {
+ if (this.configureOptions.hasOwnProperty(option)) {
+ this.allowCreation = false;
+ show = false;
+ if (typeof filter === 'function') {
+ show = filter(option, []);
+ show = show || this._handleObject(this.configureOptions[option], [option], true);
+ } else if (filter === true || filter.indexOf(option) !== -1) {
+ show = true;
+ }
+
+ if (show !== false) {
+ this.allowCreation = true;
+
+ // linebreak between categories
+ if (counter > 0) {
+ this._makeItem([]);
+ }
+ // a header for the category
+ this._makeHeader(option);
+
+ // get the sub options
+ this._handleObject(this.configureOptions[option], [option]);
+ }
+ counter++;
+ }
+ }
+
+ if (this.options.showButton === true) {
+ (function () {
+ var generateButton = document.createElement('div');
+ generateButton.className = 'vis-configuration vis-config-button';
+ generateButton.innerHTML = 'generate options';
+ generateButton.onclick = function () {
+ _this._printOptions();
+ };
+ generateButton.onmouseover = function () {
+ generateButton.className = 'vis-configuration vis-config-button hover';
+ };
+ generateButton.onmouseout = function () {
+ generateButton.className = 'vis-configuration vis-config-button';
+ };
+
+ _this.optionsContainer = document.createElement('div');
+ _this.optionsContainer.className = 'vis-configuration vis-config-option-container';
+
+ _this.domElements.push(_this.optionsContainer);
+ _this.domElements.push(generateButton);
+ })();
+ }
+
+ this._push();
+ //~ this.colorPicker.insertTo(this.container);
+ }
+
+ /**
+ * draw all DOM elements on the screen
+ * @private
+ */
+
+ }, {
+ key: '_push',
+ value: function _push() {
+ this.wrapper = document.createElement('div');
+ this.wrapper.className = 'vis-configuration-wrapper';
+ this.container.appendChild(this.wrapper);
+ for (var i = 0; i < this.domElements.length; i++) {
+ this.wrapper.appendChild(this.domElements[i]);
+ }
+
+ this._showPopupIfNeeded();
+ }
+
+ /**
+ * delete all DOM elements
+ * @private
+ */
+
+ }, {
+ key: '_clean',
+ value: function _clean() {
+ for (var i = 0; i < this.domElements.length; i++) {
+ this.wrapper.removeChild(this.domElements[i]);
+ }
+
+ if (this.wrapper !== undefined) {
+ this.container.removeChild(this.wrapper);
+ this.wrapper = undefined;
+ }
+ this.domElements = [];
+
+ this._removePopup();
+ }
+
+ /**
+ * get the value from the actualOptions if it exists
+ * @param {array} path | where to look for the actual option
+ * @returns {*}
+ * @private
+ */
+
+ }, {
+ key: '_getValue',
+ value: function _getValue(path) {
+ var base = this.moduleOptions;
+ for (var i = 0; i < path.length; i++) {
+ if (base[path[i]] !== undefined) {
+ base = base[path[i]];
+ } else {
+ base = undefined;
+ break;
+ }
+ }
+ return base;
+ }
+
+ /**
+ * all option elements are wrapped in an item
+ * @param path
+ * @param domElements
+ * @private
+ */
+
+ }, {
+ key: '_makeItem',
+ value: function _makeItem(path) {
+ var _arguments = arguments,
+ _this2 = this;
+
+ if (this.allowCreation === true) {
+ var _len, domElements, _key;
+
+ var _ret2 = function () {
+ var item = document.createElement('div');
+ item.className = 'vis-configuration vis-config-item vis-config-s' + path.length;
+
+ for (_len = _arguments.length, domElements = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ domElements[_key - 1] = _arguments[_key];
+ }
+
+ domElements.forEach(function (element) {
+ item.appendChild(element);
+ });
+ _this2.domElements.push(item);
+ return {
+ v: _this2.domElements.length
+ };
+ }();
+
+ if ((typeof _ret2 === 'undefined' ? 'undefined' : (0, _typeof3['default'])(_ret2)) === "object") return _ret2.v;
+ }
+ return 0;
+ }
+
+ /**
+ * header for major subjects
+ * @param name
+ * @private
+ */
+
+ }, {
+ key: '_makeHeader',
+ value: function _makeHeader(name) {
+ var div = document.createElement('div');
+ div.className = 'vis-configuration vis-config-header';
+ div.innerHTML = name;
+ this._makeItem([], div);
+ }
+
+ /**
+ * make a label, if it is an object label, it gets different styling.
+ * @param name
+ * @param path
+ * @param objectLabel
+ * @returns {HTMLElement}
+ * @private
+ */
+
+ }, {
+ key: '_makeLabel',
+ value: function _makeLabel(name, path) {
+ var objectLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ var div = document.createElement('div');
+ div.className = 'vis-configuration vis-config-label vis-config-s' + path.length;
+ if (objectLabel === true) {
+ div.innerHTML = '<i><b>' + name + ':</b></i>';
+ } else {
+ div.innerHTML = name + ':';
+ }
+ return div;
+ }
+
+ /**
+ * make a dropdown list for multiple possible string optoins
+ * @param arr
+ * @param value
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_makeDropdown',
+ value: function _makeDropdown(arr, value, path) {
+ var select = document.createElement('select');
+ select.className = 'vis-configuration vis-config-select';
+ var selectedValue = 0;
+ if (value !== undefined) {
+ if (arr.indexOf(value) !== -1) {
+ selectedValue = arr.indexOf(value);
+ }
+ }
+
+ for (var i = 0; i < arr.length; i++) {
+ var option = document.createElement('option');
+ option.value = arr[i];
+ if (i === selectedValue) {
+ option.selected = 'selected';
+ }
+ option.innerHTML = arr[i];
+ select.appendChild(option);
+ }
+
+ var me = this;
+ select.onchange = function () {
+ me._update(this.value, path);
+ };
+
+ var label = this._makeLabel(path[path.length - 1], path);
+ this._makeItem(path, label, select);
+ }
+
+ /**
+ * make a range object for numeric options
+ * @param arr
+ * @param value
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_makeRange',
+ value: function _makeRange(arr, value, path) {
+ var defaultValue = arr[0];
+ var min = arr[1];
+ var max = arr[2];
+ var step = arr[3];
+ var range = document.createElement('input');
+ range.className = 'vis-configuration vis-config-range';
+ try {
+ range.type = 'range'; // not supported on IE9
+ range.min = min;
+ range.max = max;
+ } catch (err) {}
+ range.step = step;
+
+ // set up the popup settings in case they are needed.
+ var popupString = '';
+ var popupValue = 0;
+
+ if (value !== undefined) {
+ var factor = 1.20;
+ if (value < 0 && value * factor < min) {
+ range.min = Math.ceil(value * factor);
+ popupValue = range.min;
+ popupString = 'range increased';
+ } else if (value / factor < min) {
+ range.min = Math.ceil(value / factor);
+ popupValue = range.min;
+ popupString = 'range increased';
+ }
+ if (value * factor > max && max !== 1) {
+ range.max = Math.ceil(value * factor);
+ popupValue = range.max;
+ popupString = 'range increased';
+ }
+ range.value = value;
+ } else {
+ range.value = defaultValue;
+ }
+
+ var input = document.createElement('input');
+ input.className = 'vis-configuration vis-config-rangeinput';
+ input.value = range.value;
+
+ var me = this;
+ range.onchange = function () {
+ input.value = this.value;me._update(Number(this.value), path);
+ };
+ range.oninput = function () {
+ input.value = this.value;
+ };
+
+ var label = this._makeLabel(path[path.length - 1], path);
+ var itemIndex = this._makeItem(path, label, range, input);
+
+ // if a popup is needed AND it has not been shown for this value, show it.
+ if (popupString !== '' && this.popupHistory[itemIndex] !== popupValue) {
+ this.popupHistory[itemIndex] = popupValue;
+ this._setupPopup(popupString, itemIndex);
+ }
+ }
+
+ /**
+ * prepare the popup
+ * @param string
+ * @param index
+ * @private
+ */
+
+ }, {
+ key: '_setupPopup',
+ value: function _setupPopup(string, index) {
+ var _this3 = this;
+
+ if (this.initialized === true && this.allowCreation === true && this.popupCounter < this.popupLimit) {
+ var div = document.createElement("div");
+ div.id = "vis-configuration-popup";
+ div.className = "vis-configuration-popup";
+ div.innerHTML = string;
+ div.onclick = function () {
+ _this3._removePopup();
+ };
+ this.popupCounter += 1;
+ this.popupDiv = { html: div, index: index };
+ }
+ }
+
+ /**
+ * remove the popup from the dom
+ * @private
+ */
+
+ }, {
+ key: '_removePopup',
+ value: function _removePopup() {
+ if (this.popupDiv.html !== undefined) {
+ this.popupDiv.html.parentNode.removeChild(this.popupDiv.html);
+ clearTimeout(this.popupDiv.hideTimeout);
+ clearTimeout(this.popupDiv.deleteTimeout);
+ this.popupDiv = {};
+ }
+ }
+
+ /**
+ * Show the popup if it is needed.
+ * @private
+ */
+
+ }, {
+ key: '_showPopupIfNeeded',
+ value: function _showPopupIfNeeded() {
+ var _this4 = this;
+
+ if (this.popupDiv.html !== undefined) {
+ var correspondingElement = this.domElements[this.popupDiv.index];
+ var rect = correspondingElement.getBoundingClientRect();
+ this.popupDiv.html.style.left = rect.left + "px";
+ this.popupDiv.html.style.top = rect.top - 30 + "px"; // 30 is the height;
+ document.body.appendChild(this.popupDiv.html);
+ this.popupDiv.hideTimeout = setTimeout(function () {
+ _this4.popupDiv.html.style.opacity = 0;
+ }, 1500);
+ this.popupDiv.deleteTimeout = setTimeout(function () {
+ _this4._removePopup();
+ }, 1800);
+ }
+ }
+
+ /**
+ * make a checkbox for boolean options.
+ * @param defaultValue
+ * @param value
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_makeCheckbox',
+ value: function _makeCheckbox(defaultValue, value, path) {
+ var checkbox = document.createElement('input');
+ checkbox.type = 'checkbox';
+ checkbox.className = 'vis-configuration vis-config-checkbox';
+ checkbox.checked = defaultValue;
+ if (value !== undefined) {
+ checkbox.checked = value;
+ if (value !== defaultValue) {
+ if ((typeof defaultValue === 'undefined' ? 'undefined' : (0, _typeof3['default'])(defaultValue)) === 'object') {
+ if (value !== defaultValue.enabled) {
+ this.changedOptions.push({ path: path, value: value });
+ }
+ } else {
+ this.changedOptions.push({ path: path, value: value });
+ }
+ }
+ }
+
+ var me = this;
+ checkbox.onchange = function () {
+ me._update(this.checked, path);
+ };
+
+ var label = this._makeLabel(path[path.length - 1], path);
+ this._makeItem(path, label, checkbox);
+ }
+
+ /**
+ * make a text input field for string options.
+ * @param defaultValue
+ * @param value
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_makeTextInput',
+ value: function _makeTextInput(defaultValue, value, path) {
+ var checkbox = document.createElement('input');
+ checkbox.type = 'text';
+ checkbox.className = 'vis-configuration vis-config-text';
+ checkbox.value = value;
+ if (value !== defaultValue) {
+ this.changedOptions.push({ path: path, value: value });
+ }
+
+ var me = this;
+ checkbox.onchange = function () {
+ me._update(this.value, path);
+ };
+
+ var label = this._makeLabel(path[path.length - 1], path);
+ this._makeItem(path, label, checkbox);
+ }
+
+ /**
+ * make a color field with a color picker for color fields
+ * @param arr
+ * @param value
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_makeColorField',
+ value: function _makeColorField(arr, value, path) {
+ var _this5 = this;
+
+ var defaultColor = arr[1];
+ var div = document.createElement('div');
+ value = value === undefined ? defaultColor : value;
+
+ if (value !== 'none') {
+ div.className = 'vis-configuration vis-config-colorBlock';
+ div.style.backgroundColor = value;
+ } else {
+ div.className = 'vis-configuration vis-config-colorBlock none';
+ }
+
+ value = value === undefined ? defaultColor : value;
+ div.onclick = function () {
+ _this5._showColorPicker(value, div, path);
+ };
+
+ var label = this._makeLabel(path[path.length - 1], path);
+ this._makeItem(path, label, div);
+ }
+
+ /**
+ * used by the color buttons to call the color picker.
+ * @param event
+ * @param value
+ * @param div
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_showColorPicker',
+ value: function _showColorPicker(value, div, path) {
+ var _this6 = this;
+
+ // clear the callback from this div
+ div.onclick = function () {};
+
+ this.colorPicker.insertTo(div);
+ this.colorPicker.show();
+
+ this.colorPicker.setColor(value);
+ this.colorPicker.setUpdateCallback(function (color) {
+ var colorString = 'rgba(' + color.r + ',' + color.g + ',' + color.b + ',' + color.a + ')';
+ div.style.backgroundColor = colorString;
+ _this6._update(colorString, path);
+ });
+
+ // on close of the colorpicker, restore the callback.
+ this.colorPicker.setCloseCallback(function () {
+ div.onclick = function () {
+ _this6._showColorPicker(value, div, path);
+ };
+ });
+ }
+
+ /**
+ * parse an object and draw the correct items
+ * @param obj
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_handleObject',
+ value: function _handleObject(obj) {
+ var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
+ var checkOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ var show = false;
+ var filter = this.options.filter;
+ var visibleInSet = false;
+ for (var subObj in obj) {
+ if (obj.hasOwnProperty(subObj)) {
+ show = true;
+ var item = obj[subObj];
+ var newPath = util.copyAndExtendArray(path, subObj);
+ if (typeof filter === 'function') {
+ show = filter(subObj, path);
+
+ // if needed we must go deeper into the object.
+ if (show === false) {
+ if (!(item instanceof Array) && typeof item !== 'string' && typeof item !== 'boolean' && item instanceof Object) {
+ this.allowCreation = false;
+ show = this._handleObject(item, newPath, true);
+ this.allowCreation = checkOnly === false;
+ }
+ }
+ }
+
+ if (show !== false) {
+ visibleInSet = true;
+ var value = this._getValue(newPath);
+
+ if (item instanceof Array) {
+ this._handleArray(item, value, newPath);
+ } else if (typeof item === 'string') {
+ this._makeTextInput(item, value, newPath);
+ } else if (typeof item === 'boolean') {
+ this._makeCheckbox(item, value, newPath);
+ } else if (item instanceof Object) {
+ // collapse the physics options that are not enabled
+ var draw = true;
+ if (path.indexOf('physics') !== -1) {
+ if (this.moduleOptions.physics.solver !== subObj) {
+ draw = false;
+ }
+ }
+
+ if (draw === true) {
+ // initially collapse options with an disabled enabled option.
+ if (item.enabled !== undefined) {
+ var enabledPath = util.copyAndExtendArray(newPath, 'enabled');
+ var enabledValue = this._getValue(enabledPath);
+ if (enabledValue === true) {
+ var label = this._makeLabel(subObj, newPath, true);
+ this._makeItem(newPath, label);
+ visibleInSet = this._handleObject(item, newPath) || visibleInSet;
+ } else {
+ this._makeCheckbox(item, enabledValue, newPath);
+ }
+ } else {
+ var _label = this._makeLabel(subObj, newPath, true);
+ this._makeItem(newPath, _label);
+ visibleInSet = this._handleObject(item, newPath) || visibleInSet;
+ }
+ }
+ } else {
+ console.error('dont know how to handle', item, subObj, newPath);
+ }
+ }
+ }
+ }
+ return visibleInSet;
+ }
+
+ /**
+ * handle the array type of option
+ * @param optionName
+ * @param arr
+ * @param value
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_handleArray',
+ value: function _handleArray(arr, value, path) {
+ if (typeof arr[0] === 'string' && arr[0] === 'color') {
+ this._makeColorField(arr, value, path);
+ if (arr[1] !== value) {
+ this.changedOptions.push({ path: path, value: value });
+ }
+ } else if (typeof arr[0] === 'string') {
+ this._makeDropdown(arr, value, path);
+ if (arr[0] !== value) {
+ this.changedOptions.push({ path: path, value: value });
+ }
+ } else if (typeof arr[0] === 'number') {
+ this._makeRange(arr, value, path);
+ if (arr[0] !== value) {
+ this.changedOptions.push({ path: path, value: Number(value) });
+ }
+ }
+ }
+
+ /**
+ * called to update the network with the new settings.
+ * @param value
+ * @param path
+ * @private
+ */
+
+ }, {
+ key: '_update',
+ value: function _update(value, path) {
+ var options = this._constructOptions(value, path);
+
+ if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) {
+ this.parent.body.emitter.emit("configChange", options);
+ }
+ this.initialized = true;
+ this.parent.setOptions(options);
+ }
+ }, {
+ key: '_constructOptions',
+ value: function _constructOptions(value, path) {
+ var optionsObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
+
+ var pointer = optionsObj;
+
+ // when dropdown boxes can be string or boolean, we typecast it into correct types
+ value = value === 'true' ? true : value;
+ value = value === 'false' ? false : value;
+
+ for (var i = 0; i < path.length; i++) {
+ if (path[i] !== 'global') {
+ if (pointer[path[i]] === undefined) {
+ pointer[path[i]] = {};
+ }
+ if (i !== path.length - 1) {
+ pointer = pointer[path[i]];
+ } else {
+ pointer[path[i]] = value;
+ }
+ }
+ }
+ return optionsObj;
+ }
+ }, {
+ key: '_printOptions',
+ value: function _printOptions() {
+ var options = this.getOptions();
+ this.optionsContainer.innerHTML = '<pre>var options = ' + (0, _stringify2['default'])(options, null, 2) + '</pre>';
+ }
+ }, {
+ key: 'getOptions',
+ value: function getOptions() {
+ var options = {};
+ for (var i = 0; i < this.changedOptions.length; i++) {
+ this._constructOptions(this.changedOptions[i].value, this.changedOptions[i].path, options);
+ }
+ return options;
+ }
+ }]);
+ return Configurator;
+ }();
+
+ exports['default'] = Configurator;
+
+/***/ },
+/* 115 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ exports.__esModule = true;
+
+ exports.default = function (instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+ };
+
+/***/ },
+/* 116 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ exports.__esModule = true;
+
+ var _defineProperty = __webpack_require__(117);
+
+ var _defineProperty2 = _interopRequireDefault(_defineProperty);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ exports.default = function () {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ (0, _defineProperty2.default)(target, descriptor.key, descriptor);
+ }
+ }
+
+ return function (Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+ }();
+
+/***/ },
+/* 117 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(118), __esModule: true };
+
+/***/ },
+/* 118 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(119);
+ var $Object = __webpack_require__(17).Object;
+ module.exports = function defineProperty(it, key, desc){
+ return $Object.defineProperty(it, key, desc);
+ };
+
+/***/ },
+/* 119 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var $export = __webpack_require__(15);
+ // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
+ $export($export.S + $export.F * !__webpack_require__(25), 'Object', {defineProperty: __webpack_require__(21).f});
+
+/***/ },
+/* 120 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Hammer = __webpack_require__(108);
+ var hammerUtil = __webpack_require__(121);
+ var util = __webpack_require__(1);
+
+ var ColorPicker = function () {
+ function ColorPicker() {
+ var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
+ (0, _classCallCheck3['default'])(this, ColorPicker);
+
+ this.pixelRatio = pixelRatio;
+ this.generated = false;
+ this.centerCoordinates = { x: 289 / 2, y: 289 / 2 };
+ this.r = 289 * 0.49;
+ this.color = { r: 255, g: 255, b: 255, a: 1.0 };
+ this.hueCircle = undefined;
+ this.initialColor = { r: 255, g: 255, b: 255, a: 1.0 };
+ this.previousColor = undefined;
+ this.applied = false;
+
+ // bound by
+ this.updateCallback = function () {};
+ this.closeCallback = function () {};
+
+ // create all DOM elements
+ this._create();
+ }
+
+ /**
+ * this inserts the colorPicker into a div from the DOM
+ * @param container
+ */
+
+
+ (0, _createClass3['default'])(ColorPicker, [{
+ key: 'insertTo',
+ value: function insertTo(container) {
+ if (this.hammer !== undefined) {
+ this.hammer.destroy();
+ this.hammer = undefined;
+ }
+ this.container = container;
+ this.container.appendChild(this.frame);
+ this._bindHammer();
+
+ this._setSize();
+ }
+
+ /**
+ * the callback is executed on apply and save. Bind it to the application
+ * @param callback
+ */
+
+ }, {
+ key: 'setUpdateCallback',
+ value: function setUpdateCallback(callback) {
+ if (typeof callback === 'function') {
+ this.updateCallback = callback;
+ } else {
+ throw new Error("Function attempted to set as colorPicker update callback is not a function.");
+ }
+ }
+
+ /**
+ * the callback is executed on apply and save. Bind it to the application
+ * @param callback
+ */
+
+ }, {
+ key: 'setCloseCallback',
+ value: function setCloseCallback(callback) {
+ if (typeof callback === 'function') {
+ this.closeCallback = callback;
+ } else {
+ throw new Error("Function attempted to set as colorPicker closing callback is not a function.");
+ }
+ }
+ }, {
+ key: '_isColorString',
+ value: function _isColorString(color) {
+ var htmlColors = { black: '#000000', navy: '#000080', darkblue: '#00008B', mediumblue: '#0000CD', blue: '#0000FF', darkgreen: '#006400', green: '#008000', teal: '#008080', darkcyan: '#008B8B', deepskyblue: '#00BFFF', darkturquoise: '#00CED1', mediumspringgreen: '#00FA9A', lime: '#00FF00', springgreen: '#00FF7F', aqua: '#00FFFF', cyan: '#00FFFF', midnightblue: '#191970', dodgerblue: '#1E90FF', lightseagreen: '#20B2AA', forestgreen: '#228B22', seagreen: '#2E8B57', darkslategray: '#2F4F4F', limegreen: '#32CD32', mediumseagreen: '#3CB371', turquoise: '#40E0D0', royalblue: '#4169E1', steelblue: '#4682B4', darkslateblue: '#483D8B', mediumturquoise: '#48D1CC', indigo: '#4B0082', darkolivegreen: '#556B2F', cadetblue: '#5F9EA0', cornflowerblue: '#6495ED', mediumaquamarine: '#66CDAA', dimgray: '#696969', slateblue: '#6A5ACD', olivedrab: '#6B8E23', slategray: '#708090', lightslategray: '#778899', mediumslateblue: '#7B68EE', lawngreen: '#7CFC00', chartreuse: '#7FFF00', aquamarine: '#7FFFD4', maroon: '#800000', purple: '#800080', olive: '#808000', gray: '#808080', skyblue: '#87CEEB', lightskyblue: '#87CEFA', blueviolet: '#8A2BE2', darkred: '#8B0000', darkmagenta: '#8B008B', saddlebrown: '#8B4513', darkseagreen: '#8FBC8F', lightgreen: '#90EE90', mediumpurple: '#9370D8', darkviolet: '#9400D3', palegreen: '#98FB98', darkorchid: '#9932CC', yellowgreen: '#9ACD32', sienna: '#A0522D', brown: '#A52A2A', darkgray: '#A9A9A9', lightblue: '#ADD8E6', greenyellow: '#ADFF2F', paleturquoise: '#AFEEEE', lightsteelblue: '#B0C4DE', powderblue: '#B0E0E6', firebrick: '#B22222', darkgoldenrod: '#B8860B', mediumorchid: '#BA55D3', rosybrown: '#BC8F8F', darkkhaki: '#BDB76B', silver: '#C0C0C0', mediumvioletred: '#C71585', indianred: '#CD5C5C', peru: '#CD853F', chocolate: '#D2691E', tan: '#D2B48C', lightgrey: '#D3D3D3', palevioletred: '#D87093', thistle: '#D8BFD8', orchid: '#DA70D6', goldenrod: '#DAA520', crimson: '#DC143C', gainsboro: '#DCDCDC', plum: '#DDA0DD', burlywood: '#DEB887', lightcyan: '#E0FFFF', lavender: '#E6E6FA', darksalmon: '#E9967A', violet: '#EE82EE', palegoldenrod: '#EEE8AA', lightcoral: '#F08080', khaki: '#F0E68C', aliceblue: '#F0F8FF', honeydew: '#F0FFF0', azure: '#F0FFFF', sandybrown: '#F4A460', wheat: '#F5DEB3', beige: '#F5F5DC', whitesmoke: '#F5F5F5', mintcream: '#F5FFFA', ghostwhite: '#F8F8FF', salmon: '#FA8072', antiquewhite: '#FAEBD7', linen: '#FAF0E6', lightgoldenrodyellow: '#FAFAD2', oldlace: '#FDF5E6', red: '#FF0000', fuchsia: '#FF00FF', magenta: '#FF00FF', deeppink: '#FF1493', orangered: '#FF4500', tomato: '#FF6347', hotpink: '#FF69B4', coral: '#FF7F50', darkorange: '#FF8C00', lightsalmon: '#FFA07A', orange: '#FFA500', lightpink: '#FFB6C1', pink: '#FFC0CB', gold: '#FFD700', peachpuff: '#FFDAB9', navajowhite: '#FFDEAD', moccasin: '#FFE4B5', bisque: '#FFE4C4', mistyrose: '#FFE4E1', blanchedalmond: '#FFEBCD', papayawhip: '#FFEFD5', lavenderblush: '#FFF0F5', seashell: '#FFF5EE', cornsilk: '#FFF8DC', lemonchiffon: '#FFFACD', floralwhite: '#FFFAF0', snow: '#FFFAFA', yellow: '#FFFF00', lightyellow: '#FFFFE0', ivory: '#FFFFF0', white: '#FFFFFF' };
+ if (typeof color === 'string') {
+ return htmlColors[color];
+ }
+ }
+
+ /**
+ * Set the color of the colorPicker
+ * Supported formats:
+ * 'red' --> HTML color string
+ * '#ffffff' --> hex string
+ * 'rbg(255,255,255)' --> rgb string
+ * 'rgba(255,255,255,1.0)' --> rgba string
+ * {r:255,g:255,b:255} --> rgb object
+ * {r:255,g:255,b:255,a:1.0} --> rgba object
+ * @param color
+ * @param setInitial
+ */
+
+ }, {
+ key: 'setColor',
+ value: function setColor(color) {
+ var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (color === 'none') {
+ return;
+ }
+
+ var rgba = void 0;
+
+ // if a html color shorthand is used, convert to hex
+ var htmlColor = this._isColorString(color);
+ if (htmlColor !== undefined) {
+ color = htmlColor;
+ }
+
+ // check format
+ if (util.isString(color) === true) {
+ if (util.isValidRGB(color) === true) {
+ var rgbaArray = color.substr(4).substr(0, color.length - 5).split(',');
+ rgba = { r: rgbaArray[0], g: rgbaArray[1], b: rgbaArray[2], a: 1.0 };
+ } else if (util.isValidRGBA(color) === true) {
+ var _rgbaArray = color.substr(5).substr(0, color.length - 6).split(',');
+ rgba = { r: _rgbaArray[0], g: _rgbaArray[1], b: _rgbaArray[2], a: _rgbaArray[3] };
+ } else if (util.isValidHex(color) === true) {
+ var rgbObj = util.hexToRGB(color);
+ rgba = { r: rgbObj.r, g: rgbObj.g, b: rgbObj.b, a: 1.0 };
+ }
+ } else {
+ if (color instanceof Object) {
+ if (color.r !== undefined && color.g !== undefined && color.b !== undefined) {
+ var alpha = color.a !== undefined ? color.a : '1.0';
+ rgba = { r: color.r, g: color.g, b: color.b, a: alpha };
+ }
+ }
+ }
+
+ // set color
+ if (rgba === undefined) {
+ throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + (0, _stringify2['default'])(color));
+ } else {
+ this._setColor(rgba, setInitial);
+ }
+ }
+
+ /**
+ * this shows the color picker.
+ * The hue circle is constructed once and stored.
+ */
+
+ }, {
+ key: 'show',
+ value: function show() {
+ if (this.closeCallback !== undefined) {
+ this.closeCallback();
+ this.closeCallback = undefined;
+ }
+
+ this.applied = false;
+ this.frame.style.display = 'block';
+ this._generateHueCircle();
+ }
+
+ // ------------------------------------------ PRIVATE ----------------------------- //
+
+ /**
+ * Hide the picker. Is called by the cancel button.
+ * Optional boolean to store the previous color for easy access later on.
+ * @param storePrevious
+ * @private
+ */
+
+ }, {
+ key: '_hide',
+ value: function _hide() {
+ var _this = this;
+
+ var storePrevious = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+
+ // store the previous color for next time;
+ if (storePrevious === true) {
+ this.previousColor = util.extend({}, this.color);
+ }
+
+ if (this.applied === true) {
+ this.updateCallback(this.initialColor);
+ }
+
+ this.frame.style.display = 'none';
+
+ // call the closing callback, restoring the onclick method.
+ // this is in a setTimeout because it will trigger the show again before the click is done.
+ setTimeout(function () {
+ if (_this.closeCallback !== undefined) {
+ _this.closeCallback();
+ _this.closeCallback = undefined;
+ }
+ }, 0);
+ }
+
+ /**
+ * bound to the save button. Saves and hides.
+ * @private
+ */
+
+ }, {
+ key: '_save',
+ value: function _save() {
+ this.updateCallback(this.color);
+ this.applied = false;
+ this._hide();
+ }
+
+ /**
+ * Bound to apply button. Saves but does not close. Is undone by the cancel button.
+ * @private
+ */
+
+ }, {
+ key: '_apply',
+ value: function _apply() {
+ this.applied = true;
+ this.updateCallback(this.color);
+ this._updatePicker(this.color);
+ }
+
+ /**
+ * load the color from the previous session.
+ * @private
+ */
+
+ }, {
+ key: '_loadLast',
+ value: function _loadLast() {
+ if (this.previousColor !== undefined) {
+ this.setColor(this.previousColor, false);
+ } else {
+ alert("There is no last color to load...");
+ }
+ }
+
+ /**
+ * set the color, place the picker
+ * @param rgba
+ * @param setInitial
+ * @private
+ */
+
+ }, {
+ key: '_setColor',
+ value: function _setColor(rgba) {
+ var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // store the initial color
+ if (setInitial === true) {
+ this.initialColor = util.extend({}, rgba);
+ }
+
+ this.color = rgba;
+ var hsv = util.RGBToHSV(rgba.r, rgba.g, rgba.b);
+
+ var angleConvert = 2 * Math.PI;
+ var radius = this.r * hsv.s;
+ var x = this.centerCoordinates.x + radius * Math.sin(angleConvert * hsv.h);
+ var y = this.centerCoordinates.y + radius * Math.cos(angleConvert * hsv.h);
+
+ this.colorPickerSelector.style.left = x - 0.5 * this.colorPickerSelector.clientWidth + 'px';
+ this.colorPickerSelector.style.top = y - 0.5 * this.colorPickerSelector.clientHeight + 'px';
+
+ this._updatePicker(rgba);
+ }
+
+ /**
+ * bound to opacity control
+ * @param value
+ * @private
+ */
+
+ }, {
+ key: '_setOpacity',
+ value: function _setOpacity(value) {
+ this.color.a = value / 100;
+ this._updatePicker(this.color);
+ }
+
+ /**
+ * bound to brightness control
+ * @param value
+ * @private
+ */
+
+ }, {
+ key: '_setBrightness',
+ value: function _setBrightness(value) {
+ var hsv = util.RGBToHSV(this.color.r, this.color.g, this.color.b);
+ hsv.v = value / 100;
+ var rgba = util.HSVToRGB(hsv.h, hsv.s, hsv.v);
+ rgba['a'] = this.color.a;
+ this.color = rgba;
+ this._updatePicker();
+ }
+
+ /**
+ * update the color picker. A black circle overlays the hue circle to mimic the brightness decreasing.
+ * @param rgba
+ * @private
+ */
+
+ }, {
+ key: '_updatePicker',
+ value: function _updatePicker() {
+ var rgba = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.color;
+
+ var hsv = util.RGBToHSV(rgba.r, rgba.g, rgba.b);
+ var ctx = this.colorPickerCanvas.getContext('2d');
+ if (this.pixelRation === undefined) {
+ this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
+ }
+ ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
+
+ // clear the canvas
+ var w = this.colorPickerCanvas.clientWidth;
+ var h = this.colorPickerCanvas.clientHeight;
+ ctx.clearRect(0, 0, w, h);
+
+ ctx.putImageData(this.hueCircle, 0, 0);
+ ctx.fillStyle = 'rgba(0,0,0,' + (1 - hsv.v) + ')';
+ ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r);
+ ctx.fill();
+
+ this.brightnessRange.value = 100 * hsv.v;
+ this.opacityRange.value = 100 * rgba.a;
+
+ this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')';
+ this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')';
+ }
+
+ /**
+ * used by create to set the size of the canvas.
+ * @private
+ */
+
+ }, {
+ key: '_setSize',
+ value: function _setSize() {
+ this.colorPickerCanvas.style.width = '100%';
+ this.colorPickerCanvas.style.height = '100%';
+
+ this.colorPickerCanvas.width = 289 * this.pixelRatio;
+ this.colorPickerCanvas.height = 289 * this.pixelRatio;
+ }
+
+ /**
+ * create all dom elements
+ * TODO: cleanup, lots of similar dom elements
+ * @private
+ */
+
+ }, {
+ key: '_create',
+ value: function _create() {
+ this.frame = document.createElement('div');
+ this.frame.className = 'vis-color-picker';
+
+ this.colorPickerDiv = document.createElement('div');
+ this.colorPickerSelector = document.createElement('div');
+ this.colorPickerSelector.className = 'vis-selector';
+ this.colorPickerDiv.appendChild(this.colorPickerSelector);
+
+ this.colorPickerCanvas = document.createElement('canvas');
+ this.colorPickerDiv.appendChild(this.colorPickerCanvas);
+
+ if (!this.colorPickerCanvas.getContext) {
+ var noCanvas = document.createElement('DIV');
+ noCanvas.style.color = 'red';
+ noCanvas.style.fontWeight = 'bold';
+ noCanvas.style.padding = '10px';
+ noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
+ this.colorPickerCanvas.appendChild(noCanvas);
+ } else {
+ var ctx = this.colorPickerCanvas.getContext("2d");
+ this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
+
+ this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
+ }
+
+ this.colorPickerDiv.className = 'vis-color';
+
+ this.opacityDiv = document.createElement('div');
+ this.opacityDiv.className = 'vis-opacity';
+
+ this.brightnessDiv = document.createElement('div');
+ this.brightnessDiv.className = 'vis-brightness';
+
+ this.arrowDiv = document.createElement('div');
+ this.arrowDiv.className = 'vis-arrow';
+
+ this.opacityRange = document.createElement('input');
+ try {
+ this.opacityRange.type = 'range'; // Not supported on IE9
+ this.opacityRange.min = '0';
+ this.opacityRange.max = '100';
+ } catch (err) {}
+ this.opacityRange.value = '100';
+ this.opacityRange.className = 'vis-range';
+
+ this.brightnessRange = document.createElement('input');
+ try {
+ this.brightnessRange.type = 'range'; // Not supported on IE9
+ this.brightnessRange.min = '0';
+ this.brightnessRange.max = '100';
+ } catch (err) {}
+ this.brightnessRange.value = '100';
+ this.brightnessRange.className = 'vis-range';
+
+ this.opacityDiv.appendChild(this.opacityRange);
+ this.brightnessDiv.appendChild(this.brightnessRange);
+
+ var me = this;
+ this.opacityRange.onchange = function () {
+ me._setOpacity(this.value);
+ };
+ this.opacityRange.oninput = function () {
+ me._setOpacity(this.value);
+ };
+ this.brightnessRange.onchange = function () {
+ me._setBrightness(this.value);
+ };
+ this.brightnessRange.oninput = function () {
+ me._setBrightness(this.value);
+ };
+
+ this.brightnessLabel = document.createElement("div");
+ this.brightnessLabel.className = "vis-label vis-brightness";
+ this.brightnessLabel.innerHTML = 'brightness:';
+
+ this.opacityLabel = document.createElement("div");
+ this.opacityLabel.className = "vis-label vis-opacity";
+ this.opacityLabel.innerHTML = 'opacity:';
+
+ this.newColorDiv = document.createElement("div");
+ this.newColorDiv.className = "vis-new-color";
+ this.newColorDiv.innerHTML = 'new';
+
+ this.initialColorDiv = document.createElement("div");
+ this.initialColorDiv.className = "vis-initial-color";
+ this.initialColorDiv.innerHTML = 'initial';
+
+ this.cancelButton = document.createElement("div");
+ this.cancelButton.className = "vis-button vis-cancel";
+ this.cancelButton.innerHTML = 'cancel';
+ this.cancelButton.onclick = this._hide.bind(this, false);
+
+ this.applyButton = document.createElement("div");
+ this.applyButton.className = "vis-button vis-apply";
+ this.applyButton.innerHTML = 'apply';
+ this.applyButton.onclick = this._apply.bind(this);
+
+ this.saveButton = document.createElement("div");
+ this.saveButton.className = "vis-button vis-save";
+ this.saveButton.innerHTML = 'save';
+ this.saveButton.onclick = this._save.bind(this);
+
+ this.loadButton = document.createElement("div");
+ this.loadButton.className = "vis-button vis-load";
+ this.loadButton.innerHTML = 'load last';
+ this.loadButton.onclick = this._loadLast.bind(this);
+
+ this.frame.appendChild(this.colorPickerDiv);
+ this.frame.appendChild(this.arrowDiv);
+ this.frame.appendChild(this.brightnessLabel);
+ this.frame.appendChild(this.brightnessDiv);
+ this.frame.appendChild(this.opacityLabel);
+ this.frame.appendChild(this.opacityDiv);
+ this.frame.appendChild(this.newColorDiv);
+ this.frame.appendChild(this.initialColorDiv);
+
+ this.frame.appendChild(this.cancelButton);
+ this.frame.appendChild(this.applyButton);
+ this.frame.appendChild(this.saveButton);
+ this.frame.appendChild(this.loadButton);
+ }
+
+ /**
+ * bind hammer to the color picker
+ * @private
+ */
+
+ }, {
+ key: '_bindHammer',
+ value: function _bindHammer() {
+ var _this2 = this;
+
+ this.drag = {};
+ this.pinch = {};
+ this.hammer = new Hammer(this.colorPickerCanvas);
+ this.hammer.get('pinch').set({ enable: true });
+
+ hammerUtil.onTouch(this.hammer, function (event) {
+ _this2._moveSelector(event);
+ });
+ this.hammer.on('tap', function (event) {
+ _this2._moveSelector(event);
+ });
+ this.hammer.on('panstart', function (event) {
+ _this2._moveSelector(event);
+ });
+ this.hammer.on('panmove', function (event) {
+ _this2._moveSelector(event);
+ });
+ this.hammer.on('panend', function (event) {
+ _this2._moveSelector(event);
+ });
+ }
+
+ /**
+ * generate the hue circle. This is relatively heavy (200ms) and is done only once on the first time it is shown.
+ * @private
+ */
+
+ }, {
+ key: '_generateHueCircle',
+ value: function _generateHueCircle() {
+ if (this.generated === false) {
+ var ctx = this.colorPickerCanvas.getContext('2d');
+ if (this.pixelRation === undefined) {
+ this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
+ }
+ ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
+
+ // clear the canvas
+ var w = this.colorPickerCanvas.clientWidth;
+ var h = this.colorPickerCanvas.clientHeight;
+ ctx.clearRect(0, 0, w, h);
+
+ // draw hue circle
+ var x = void 0,
+ y = void 0,
+ hue = void 0,
+ sat = void 0;
+ this.centerCoordinates = { x: w * 0.5, y: h * 0.5 };
+ this.r = 0.49 * w;
+ var angleConvert = 2 * Math.PI / 360;
+ var hfac = 1 / 360;
+ var sfac = 1 / this.r;
+ var rgb = void 0;
+ for (hue = 0; hue < 360; hue++) {
+ for (sat = 0; sat < this.r; sat++) {
+ x = this.centerCoordinates.x + sat * Math.sin(angleConvert * hue);
+ y = this.centerCoordinates.y + sat * Math.cos(angleConvert * hue);
+ rgb = util.HSVToRGB(hue * hfac, sat * sfac, 1);
+ ctx.fillStyle = 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')';
+ ctx.fillRect(x - 0.5, y - 0.5, 2, 2);
+ }
+ }
+ ctx.strokeStyle = 'rgba(0,0,0,1)';
+ ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r);
+ ctx.stroke();
+
+ this.hueCircle = ctx.getImageData(0, 0, w, h);
+ }
+ this.generated = true;
+ }
+
+ /**
+ * move the selector. This is called by hammer functions.
+ *
+ * @param event
+ * @private
+ */
+
+ }, {
+ key: '_moveSelector',
+ value: function _moveSelector(event) {
+ var rect = this.colorPickerDiv.getBoundingClientRect();
+ var left = event.center.x - rect.left;
+ var top = event.center.y - rect.top;
+
+ var centerY = 0.5 * this.colorPickerDiv.clientHeight;
+ var centerX = 0.5 * this.colorPickerDiv.clientWidth;
+
+ var x = left - centerX;
+ var y = top - centerY;
+
+ var angle = Math.atan2(x, y);
+ var radius = 0.98 * Math.min(Math.sqrt(x * x + y * y), centerX);
+
+ var newTop = Math.cos(angle) * radius + centerY;
+ var newLeft = Math.sin(angle) * radius + centerX;
+
+ this.colorPickerSelector.style.top = newTop - 0.5 * this.colorPickerSelector.clientHeight + 'px';
+ this.colorPickerSelector.style.left = newLeft - 0.5 * this.colorPickerSelector.clientWidth + 'px';
+
+ // set color
+ var h = angle / (2 * Math.PI);
+ h = h < 0 ? h + 1 : h;
+ var s = radius / this.r;
+ var hsv = util.RGBToHSV(this.color.r, this.color.g, this.color.b);
+ hsv.h = h;
+ hsv.s = s;
+ var rgba = util.HSVToRGB(hsv.h, hsv.s, hsv.v);
+ rgba['a'] = this.color.a;
+ this.color = rgba;
+
+ // update previews
+ this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')';
+ this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')';
+ }
+ }]);
+ return ColorPicker;
+ }();
+
+ exports['default'] = ColorPicker;
+
+/***/ },
+/* 121 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var Hammer = __webpack_require__(108);
+
+ /**
+ * Register a touch event, taking place before a gesture
+ * @param {Hammer} hammer A hammer instance
+ * @param {function} callback Callback, called as callback(event)
+ */
+ exports.onTouch = function (hammer, callback) {
+ callback.inputHandler = function (event) {
+ if (event.isFirst) {
+ callback(event);
+ }
+ };
+
+ hammer.on('hammer.input', callback.inputHandler);
+ };
+
+ /**
+ * Register a release event, taking place after a gesture
+ * @param {Hammer} hammer A hammer instance
+ * @param {function} callback Callback, called as callback(event)
+ */
+ exports.onRelease = function (hammer, callback) {
+ callback.inputHandler = function (event) {
+ if (event.isFinal) {
+ callback(event);
+ }
+ };
+
+ return hammer.on('hammer.input', callback.inputHandler);
+ };
+
+ /**
+ * Unregister a touch event, taking place before a gesture
+ * @param {Hammer} hammer A hammer instance
+ * @param {function} callback Callback, called as callback(event)
+ */
+ exports.offTouch = function (hammer, callback) {
+ hammer.off('hammer.input', callback.inputHandler);
+ };
+
+ /**
+ * Unregister a release event, taking place before a gesture
+ * @param {Hammer} hammer A hammer instance
+ * @param {function} callback Callback, called as callback(event)
+ */
+ exports.offRelease = exports.offTouch;
+
+ /**
+ * Hack the PinchRecognizer such that it doesn't prevent default behavior
+ * for vertical panning.
+ *
+ * Yeah ... this is quite a hack ... see https://github.com/hammerjs/hammer.js/issues/932
+ *
+ * @param {Hammer.Pinch} pinchRecognizer
+ * @return {Hammer.Pinch} returns the pinchRecognizer
+ */
+ exports.disablePreventDefaultVertically = function (pinchRecognizer) {
+ var TOUCH_ACTION_PAN_Y = 'pan-y';
+
+ pinchRecognizer.getTouchAction = function () {
+ // default method returns [TOUCH_ACTION_NONE]
+ return [TOUCH_ACTION_PAN_Y];
+ };
+
+ return pinchRecognizer;
+ };
+
+/***/ },
+/* 122 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports.printStyle = undefined;
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var errorFound = false;
+ var allOptions = void 0;
+ var printStyle = 'background: #FFeeee; color: #dd0000';
+ /**
+ * Used to validate options.
+ */
+
+ var Validator = function () {
+ function Validator() {
+ (0, _classCallCheck3['default'])(this, Validator);
+ }
+
+ /**
+ * Main function to be called
+ * @param options
+ * @param subObject
+ * @returns {boolean}
+ */
+
+
+ (0, _createClass3['default'])(Validator, null, [{
+ key: 'validate',
+ value: function validate(options, referenceOptions, subObject) {
+ errorFound = false;
+ allOptions = referenceOptions;
+ var usedOptions = referenceOptions;
+ if (subObject !== undefined) {
+ usedOptions = referenceOptions[subObject];
+ }
+ Validator.parse(options, usedOptions, []);
+ return errorFound;
+ }
+
+ /**
+ * Will traverse an object recursively and check every value
+ * @param options
+ * @param referenceOptions
+ * @param path
+ */
+
+ }, {
+ key: 'parse',
+ value: function parse(options, referenceOptions, path) {
+ for (var option in options) {
+ if (options.hasOwnProperty(option)) {
+ Validator.check(option, options, referenceOptions, path);
+ }
+ }
+ }
+
+ /**
+ * Check every value. If the value is an object, call the parse function on that object.
+ * @param option
+ * @param options
+ * @param referenceOptions
+ * @param path
+ */
+
+ }, {
+ key: 'check',
+ value: function check(option, options, referenceOptions, path) {
+ if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) {
+ Validator.getSuggestion(option, referenceOptions, path);
+ } else if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) {
+ // __any__ is a wildcard. Any value is accepted and will be further analysed by reference.
+ if (Validator.getType(options[option]) === 'object' && referenceOptions['__any__'].__type__ !== undefined) {
+ // if the any subgroup is not a predefined object int he configurator we do not look deeper into the object.
+ Validator.checkFields(option, options, referenceOptions, '__any__', referenceOptions['__any__'].__type__, path);
+ } else {
+ Validator.checkFields(option, options, referenceOptions, '__any__', referenceOptions['__any__'], path);
+ }
+ } else {
+ // Since all options in the reference are objects, we can check whether they are supposed to be object to look for the __type__ field.
+ if (referenceOptions[option].__type__ !== undefined) {
+ // if this should be an object, we check if the correct type has been supplied to account for shorthand options.
+ Validator.checkFields(option, options, referenceOptions, option, referenceOptions[option].__type__, path);
+ } else {
+ Validator.checkFields(option, options, referenceOptions, option, referenceOptions[option], path);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param {String} option | the option property
+ * @param {Object} options | The supplied options object
+ * @param {Object} referenceOptions | The reference options containing all options and their allowed formats
+ * @param {String} referenceOption | Usually this is the same as option, except when handling an __any__ tag.
+ * @param {String} refOptionType | This is the type object from the reference options
+ * @param {Array} path | where in the object is the option
+ */
+
+ }, {
+ key: 'checkFields',
+ value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) {
+ var optionType = Validator.getType(options[option]);
+ var refOptionType = refOptionObj[optionType];
+ if (refOptionType !== undefined) {
+ // if the type is correct, we check if it is supposed to be one of a few select values
+ if (Validator.getType(refOptionType) === 'array') {
+ if (refOptionType.indexOf(options[option]) === -1) {
+ console.log('%cInvalid option detected in "' + option + '".' + ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ' + Validator.printLocation(path, option), printStyle);
+ errorFound = true;
+ } else if (optionType === 'object' && referenceOption !== "__any__") {
+ path = util.copyAndExtendArray(path, option);
+ Validator.parse(options[option], referenceOptions[referenceOption], path);
+ }
+ } else if (optionType === 'object' && referenceOption !== "__any__") {
+ path = util.copyAndExtendArray(path, option);
+ Validator.parse(options[option], referenceOptions[referenceOption], path);
+ }
+ } else if (refOptionObj['any'] === undefined) {
+ // type of the field is incorrect and the field cannot be any
+ console.log('%cInvalid type received for "' + option + '". Expected: ' + Validator.print((0, _keys2['default'])(refOptionObj)) + '. Received [' + optionType + '] "' + options[option] + '"' + Validator.printLocation(path, option), printStyle);
+ errorFound = true;
+ }
+ }
+ }, {
+ key: 'getType',
+ value: function getType(object) {
+ var type = typeof object === 'undefined' ? 'undefined' : (0, _typeof3['default'])(object);
+
+ if (type === 'object') {
+ if (object === null) {
+ return 'null';
+ }
+ if (object instanceof Boolean) {
+ return 'boolean';
+ }
+ if (object instanceof Number) {
+ return 'number';
+ }
+ if (object instanceof String) {
+ return 'string';
+ }
+ if (Array.isArray(object)) {
+ return 'array';
+ }
+ if (object instanceof Date) {
+ return 'date';
+ }
+ if (object.nodeType !== undefined) {
+ return 'dom';
+ }
+ if (object._isAMomentObject === true) {
+ return 'moment';
+ }
+ return 'object';
+ } else if (type === 'number') {
+ return 'number';
+ } else if (type === 'boolean') {
+ return 'boolean';
+ } else if (type === 'string') {
+ return 'string';
+ } else if (type === undefined) {
+ return 'undefined';
+ }
+ return type;
+ }
+ }, {
+ key: 'getSuggestion',
+ value: function getSuggestion(option, options, path) {
+ var localSearch = Validator.findInOptions(option, options, path, false);
+ var globalSearch = Validator.findInOptions(option, allOptions, [], true);
+
+ var localSearchThreshold = 8;
+ var globalSearchThreshold = 4;
+
+ if (localSearch.indexMatch !== undefined) {
+ console.log('%cUnknown option detected: "' + option + '" in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n', printStyle);
+ } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) {
+ console.log('%cUnknown option detected: "' + option + '" in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was misplaced? Matching option found at: ' + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, ''), printStyle);
+ } else if (localSearch.distance <= localSearchThreshold) {
+ console.log('%cUnknown option detected: "' + option + '". Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option), printStyle);
+ } else {
+ console.log('%cUnknown option detected: "' + option + '". Did you mean one of these: ' + Validator.print((0, _keys2['default'])(options)) + Validator.printLocation(path, option), printStyle);
+ }
+
+ errorFound = true;
+ }
+
+ /**
+ * traverse the options in search for a match.
+ * @param option
+ * @param options
+ * @param path
+ * @param recursive
+ * @returns {{closestMatch: string, path: Array, distance: number}}
+ */
+
+ }, {
+ key: 'findInOptions',
+ value: function findInOptions(option, options, path) {
+ var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+
+ var min = 1e9;
+ var closestMatch = '';
+ var closestMatchPath = [];
+ var lowerCaseOption = option.toLowerCase();
+ var indexMatch = undefined;
+ for (var op in options) {
+ var distance = void 0;
+ if (options[op].__type__ !== undefined && recursive === true) {
+ var result = Validator.findInOptions(option, options[op], util.copyAndExtendArray(path, op));
+ if (min > result.distance) {
+ closestMatch = result.closestMatch;
+ closestMatchPath = result.path;
+ min = result.distance;
+ indexMatch = result.indexMatch;
+ }
+ } else {
+ if (op.toLowerCase().indexOf(lowerCaseOption) !== -1) {
+ indexMatch = op;
+ }
+ distance = Validator.levenshteinDistance(option, op);
+ if (min > distance) {
+ closestMatch = op;
+ closestMatchPath = util.copyArray(path);
+ min = distance;
+ }
+ }
+ }
+ return { closestMatch: closestMatch, path: closestMatchPath, distance: min, indexMatch: indexMatch };
+ }
+ }, {
+ key: 'printLocation',
+ value: function printLocation(path, option) {
+ var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Problem value found at: \n';
+
+ var str = '\n\n' + prefix + 'options = {\n';
+ for (var i = 0; i < path.length; i++) {
+ for (var j = 0; j < i + 1; j++) {
+ str += ' ';
+ }
+ str += path[i] + ': {\n';
+ }
+ for (var _j = 0; _j < path.length + 1; _j++) {
+ str += ' ';
+ }
+ str += option + '\n';
+ for (var _i = 0; _i < path.length + 1; _i++) {
+ for (var _j2 = 0; _j2 < path.length - _i; _j2++) {
+ str += ' ';
+ }
+ str += '}\n';
+ }
+ return str + '\n\n';
+ }
+ }, {
+ key: 'print',
+ value: function print(options) {
+ return (0, _stringify2['default'])(options).replace(/(\")|(\[)|(\])|(,"__type__")/g, "").replace(/(\,)/g, ', ');
+ }
+
+ // Compute the edit distance between the two given strings
+ // http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript
+ /*
+ Copyright (c) 2011 Andrei Mackenzie
+ 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.
+ */
+
+ }, {
+ key: 'levenshteinDistance',
+ value: function levenshteinDistance(a, b) {
+ if (a.length === 0) return b.length;
+ if (b.length === 0) return a.length;
+
+ var matrix = [];
+
+ // increment along the first column of each row
+ var i;
+ for (i = 0; i <= b.length; i++) {
+ matrix[i] = [i];
+ }
+
+ // increment each column in the first row
+ var j;
+ for (j = 0; j <= a.length; j++) {
+ matrix[0][j] = j;
+ }
+
+ // Fill in the rest of the matrix
+ for (i = 1; i <= b.length; i++) {
+ for (j = 1; j <= a.length; j++) {
+ if (b.charAt(i - 1) == a.charAt(j - 1)) {
+ matrix[i][j] = matrix[i - 1][j - 1];
+ } else {
+ matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
+ Math.min(matrix[i][j - 1] + 1, // insertion
+ matrix[i - 1][j] + 1)); // deletion
+ }
+ }
+ }
+
+ return matrix[b.length][a.length];
+ }
+ }]);
+ return Validator;
+ }();
+
+ exports['default'] = Validator;
+ exports.printStyle = printStyle;
+
+/***/ },
+/* 123 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var hammerUtil = __webpack_require__(121);
+ var moment = __webpack_require__(84);
+ var Component = __webpack_require__(124);
+ var DateUtil = __webpack_require__(125);
+
+ /**
+ * @constructor Range
+ * A Range controls a numeric range with a start and end value.
+ * The Range adjusts the range based on mouse events or programmatic changes,
+ * and triggers events when the range is changing or has been changed.
+ * @param {{dom: Object, domProps: Object, emitter: Emitter}} body
+ * @param {Object} [options] See description at Range.setOptions
+ */
+ function Range(body, options) {
+ var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0);
+ var start = now.clone().add(-3, 'days').valueOf();
+ var end = now.clone().add(3, 'days').valueOf();
+
+ if (options === undefined) {
+ this.start = start;
+ this.end = end;
+ } else {
+ this.start = options.start || start;
+ this.end = options.end || end;
+ }
+
+ this.rolling = false;
+
+ this.body = body;
+ this.deltaDifference = 0;
+ this.scaleOffset = 0;
+ this.startToFront = false;
+ this.endToFront = true;
+
+ // default options
+ this.defaultOptions = {
+ rtl: false,
+ start: null,
+ end: null,
+ moment: moment,
+ direction: 'horizontal', // 'horizontal' or 'vertical'
+ moveable: true,
+ zoomable: true,
+ min: null,
+ max: null,
+ zoomMin: 10, // milliseconds
+ zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000 // milliseconds
+ };
+ this.options = util.extend({}, this.defaultOptions);
+ this.props = {
+ touch: {}
+ };
+ this.animationTimer = null;
+
+ // drag listeners for dragging
+ this.body.emitter.on('panstart', this._onDragStart.bind(this));
+ this.body.emitter.on('panmove', this._onDrag.bind(this));
+ this.body.emitter.on('panend', this._onDragEnd.bind(this));
+
+ // mouse wheel for zooming
+ this.body.emitter.on('mousewheel', this._onMouseWheel.bind(this));
+
+ // pinch to zoom
+ this.body.emitter.on('touch', this._onTouch.bind(this));
+ this.body.emitter.on('pinch', this._onPinch.bind(this));
+
+ // on click of rolling mode button
+ this.body.dom.rollingModeBtn.addEventListener('click', this.startRolling.bind(this));
+
+ this.setOptions(options);
+ }
+
+ Range.prototype = new Component();
+
+ /**
+ * Set options for the range controller
+ * @param {Object} options Available options:
+ * {Number | Date | String} start Start date for the range
+ * {Number | Date | String} end End date for the range
+ * {Number} min Minimum value for start
+ * {Number} max Maximum value for end
+ * {Number} zoomMin Set a minimum value for
+ * (end - start).
+ * {Number} zoomMax Set a maximum value for
+ * (end - start).
+ * {Boolean} moveable Enable moving of the range
+ * by dragging. True by default
+ * {Boolean} zoomable Enable zooming of the range
+ * by pinching/scrolling. True by default
+ */
+ Range.prototype.setOptions = function (options) {
+ if (options) {
+ // copy the options that we know
+ var fields = ['animation', 'direction', 'min', 'max', 'zoomMin', 'zoomMax', 'moveable', 'zoomable', 'moment', 'activate', 'hiddenDates', 'zoomKey', 'rtl', 'showCurrentTime', 'rollMode', 'horizontalScroll'];
+ util.selectiveExtend(fields, this.options, options);
+
+ if (options.rollingMode) {
+ this.startRolling();
+ }
+ if ('start' in options || 'end' in options) {
+ // apply a new range. both start and end are optional
+ this.setRange(options.start, options.end);
+ }
+ }
+ };
+
+ /**
+ * Test whether direction has a valid value
+ * @param {String} direction 'horizontal' or 'vertical'
+ */
+ function validateDirection(direction) {
+ if (direction != 'horizontal' && direction != 'vertical') {
+ throw new TypeError('Unknown direction "' + direction + '". ' + 'Choose "horizontal" or "vertical".');
+ }
+ }
+
+ /**
+ * Start auto refreshing the current time bar
+ */
+ Range.prototype.startRolling = function () {
+ var me = this;
+
+ function update() {
+ me.stopRolling();
+ me.rolling = true;
+
+ var interval = me.end - me.start;
+ var t = util.convert(new Date(), 'Date').valueOf();
+
+ var start = t - interval / 2;
+ var end = t + interval / 2;
+ var animation = me.options && me.options.animation !== undefined ? me.options.animation : true;
+
+ me.setRange(start, end, false);
+
+ // determine interval to refresh
+ var scale = me.conversion(me.body.domProps.center.width).scale;
+ var interval = 1 / scale / 10;
+ if (interval < 30) interval = 30;
+ if (interval > 1000) interval = 1000;
+
+ me.body.dom.rollingModeBtn.style.visibility = "hidden";
+ // start a renderTimer to adjust for the new time
+ me.currentTimeTimer = setTimeout(update, interval);
+ }
+
+ update();
+ };
+
+ /**
+ * Stop auto refreshing the current time bar
+ */
+ Range.prototype.stopRolling = function () {
+ if (this.currentTimeTimer !== undefined) {
+ clearTimeout(this.currentTimeTimer);
+ this.rolling = false;
+ this.body.dom.rollingModeBtn.style.visibility = "visible";
+ }
+ };
+
+ /**
+ * Set a new start and end range
+ * @param {Date | Number | String} [start]
+ * @param {Date | Number | String} [end]
+ * @param {boolean | {duration: number, easingFunction: string}} [animation=false]
+ * If true (default), the range is animated
+ * smoothly to the new window. An object can be
+ * provided to specify duration and easing function.
+ * Default duration is 500 ms, and default easing
+ * function is 'easeInOutQuad'.
+ * @param {Boolean} [byUser=false]
+ *
+ */
+ Range.prototype.setRange = function (start, end, animation, byUser, event) {
+ if (byUser !== true) {
+ byUser = false;
+ }
+ var finalStart = start != undefined ? util.convert(start, 'Date').valueOf() : null;
+ var finalEnd = end != undefined ? util.convert(end, 'Date').valueOf() : null;
+ this._cancelAnimation();
+
+ if (animation) {
+ // true or an Object
+ var me = this;
+ var initStart = this.start;
+ var initEnd = this.end;
+ var duration = (typeof animation === 'undefined' ? 'undefined' : (0, _typeof3['default'])(animation)) === 'object' && 'duration' in animation ? animation.duration : 500;
+ var easingName = (typeof animation === 'undefined' ? 'undefined' : (0, _typeof3['default'])(animation)) === 'object' && 'easingFunction' in animation ? animation.easingFunction : 'easeInOutQuad';
+ var easingFunction = util.easingFunctions[easingName];
+ if (!easingFunction) {
+ throw new Error('Unknown easing function ' + (0, _stringify2['default'])(easingName) + '. ' + 'Choose from: ' + (0, _keys2['default'])(util.easingFunctions).join(', '));
+ }
+
+ var initTime = new Date().valueOf();
+ var anyChanged = false;
+
+ var next = function next() {
+ if (!me.props.touch.dragging) {
+ var now = new Date().valueOf();
+ var time = now - initTime;
+ var ease = easingFunction(time / duration);
+ var done = time > duration;
+ var s = done || finalStart === null ? finalStart : initStart + (finalStart - initStart) * ease;
+ var e = done || finalEnd === null ? finalEnd : initEnd + (finalEnd - initEnd) * ease;
+
+ changed = me._applyRange(s, e);
+ DateUtil.updateHiddenDates(me.options.moment, me.body, me.options.hiddenDates);
+ anyChanged = anyChanged || changed;
+
+ var params = {
+ start: new Date(me.start),
+ end: new Date(me.end),
+ byUser: byUser,
+ event: util.elementsCensor(event)
+ };
+
+ if (changed) {
+ me.body.emitter.emit('rangechange', params);
+ }
+
+ if (done) {
+ if (anyChanged) {
+ me.body.emitter.emit('rangechanged', params);
+ }
+ } else {
+ // animate with as high as possible frame rate, leave 20 ms in between
+ // each to prevent the browser from blocking
+ me.animationTimer = setTimeout(next, 20);
+ }
+ }
+ };
+
+ return next();
+ } else {
+ var changed = this._applyRange(finalStart, finalEnd);
+ DateUtil.updateHiddenDates(this.options.moment, this.body, this.options.hiddenDates);
+ if (changed) {
+ var params = {
+ start: new Date(this.start),
+ end: new Date(this.end),
+ byUser: byUser,
+ event: util.elementsCensor(event)
+ };
+ this.body.emitter.emit('rangechange', params);
+ this.body.emitter.emit('rangechanged', params);
+ }
+ }
+ };
+
+ /**
+ * Get the number of milliseconds per pixel.
+ */
+ Range.prototype.getMillisecondsPerPixel = function () {
+ return (this.end - this.start) / this.body.dom.center.clientWidth;
+ };
+
+ /**
+ * Stop an animation
+ * @private
+ */
+ Range.prototype._cancelAnimation = function () {
+ if (this.animationTimer) {
+ clearTimeout(this.animationTimer);
+ this.animationTimer = null;
+ }
+ };
+
+ /**
+ * Set a new start and end range. This method is the same as setRange, but
+ * does not trigger a range change and range changed event, and it returns
+ * true when the range is changed
+ * @param {Number} [start]
+ * @param {Number} [end]
+ * @return {Boolean} changed
+ * @private
+ */
+ Range.prototype._applyRange = function (start, end) {
+ var newStart = start != null ? util.convert(start, 'Date').valueOf() : this.start,
+ newEnd = end != null ? util.convert(end, 'Date').valueOf() : this.end,
+ max = this.options.max != null ? util.convert(this.options.max, 'Date').valueOf() : null,
+ min = this.options.min != null ? util.convert(this.options.min, 'Date').valueOf() : null,
+ diff;
+
+ // check for valid number
+ if (isNaN(newStart) || newStart === null) {
+ throw new Error('Invalid start "' + start + '"');
+ }
+ if (isNaN(newEnd) || newEnd === null) {
+ throw new Error('Invalid end "' + end + '"');
+ }
+
+ // prevent end < start
+ if (newEnd < newStart) {
+ newEnd = newStart;
+ }
+
+ // prevent start < min
+ if (min !== null) {
+ if (newStart < min) {
+ diff = min - newStart;
+ newStart += diff;
+ newEnd += diff;
+
+ // prevent end > max
+ if (max != null) {
+ if (newEnd > max) {
+ newEnd = max;
+ }
+ }
+ }
+ }
+
+ // prevent end > max
+ if (max !== null) {
+ if (newEnd > max) {
+ diff = newEnd - max;
+ newStart -= diff;
+ newEnd -= diff;
+
+ // prevent start < min
+ if (min != null) {
+ if (newStart < min) {
+ newStart = min;
+ }
+ }
+ }
+ }
+
+ // prevent (end-start) < zoomMin
+ if (this.options.zoomMin !== null) {
+ var zoomMin = parseFloat(this.options.zoomMin);
+ if (zoomMin < 0) {
+ zoomMin = 0;
+ }
+ if (newEnd - newStart < zoomMin) {
+ // compensate for a scale of 0.5 ms
+ var compensation = 0.5;
+ if (this.end - this.start === zoomMin && newStart >= this.start - compensation && newEnd <= this.end) {
+ // ignore this action, we are already zoomed to the minimum
+ newStart = this.start;
+ newEnd = this.end;
+ } else {
+ // zoom to the minimum
+ diff = zoomMin - (newEnd - newStart);
+ newStart -= diff / 2;
+ newEnd += diff / 2;
+ }
+ }
+ }
+
+ // prevent (end-start) > zoomMax
+ if (this.options.zoomMax !== null) {
+ var zoomMax = parseFloat(this.options.zoomMax);
+ if (zoomMax < 0) {
+ zoomMax = 0;
+ }
+
+ if (newEnd - newStart > zoomMax) {
+ if (this.end - this.start === zoomMax && newStart < this.start && newEnd > this.end) {
+ // ignore this action, we are already zoomed to the maximum
+ newStart = this.start;
+ newEnd = this.end;
+ } else {
+ // zoom to the maximum
+ diff = newEnd - newStart - zoomMax;
+ newStart += diff / 2;
+ newEnd -= diff / 2;
+ }
+ }
+ }
+
+ var changed = this.start != newStart || this.end != newEnd;
+
+ // if the new range does NOT overlap with the old range, emit checkRangedItems to avoid not showing ranged items (ranged meaning has end time, not necessarily of type Range)
+ if (!(newStart >= this.start && newStart <= this.end || newEnd >= this.start && newEnd <= this.end) && !(this.start >= newStart && this.start <= newEnd || this.end >= newStart && this.end <= newEnd)) {
+ this.body.emitter.emit('checkRangedItems');
+ }
+
+ this.start = newStart;
+ this.end = newEnd;
+ return changed;
+ };
+
+ /**
+ * Retrieve the current range.
+ * @return {Object} An object with start and end properties
+ */
+ Range.prototype.getRange = function () {
+ return {
+ start: this.start,
+ end: this.end
+ };
+ };
+
+ /**
+ * Calculate the conversion offset and scale for current range, based on
+ * the provided width
+ * @param {Number} width
+ * @returns {{offset: number, scale: number}} conversion
+ */
+ Range.prototype.conversion = function (width, totalHidden) {
+ return Range.conversion(this.start, this.end, width, totalHidden);
+ };
+
+ /**
+ * Static method to calculate the conversion offset and scale for a range,
+ * based on the provided start, end, and width
+ * @param {Number} start
+ * @param {Number} end
+ * @param {Number} width
+ * @returns {{offset: number, scale: number}} conversion
+ */
+ Range.conversion = function (start, end, width, totalHidden) {
+ if (totalHidden === undefined) {
+ totalHidden = 0;
+ }
+ if (width != 0 && end - start != 0) {
+ return {
+ offset: start,
+ scale: width / (end - start - totalHidden)
+ };
+ } else {
+ return {
+ offset: 0,
+ scale: 1
+ };
+ }
+ };
+
+ /**
+ * Start dragging horizontally or vertically
+ * @param {Event} event
+ * @private
+ */
+ Range.prototype._onDragStart = function (event) {
+ this.deltaDifference = 0;
+ this.previousDelta = 0;
+
+ // only allow dragging when configured as movable
+ if (!this.options.moveable) return;
+
+ // only start dragging when the mouse is inside the current range
+ if (!this._isInsideRange(event)) return;
+
+ // refuse to drag when we where pinching to prevent the timeline make a jump
+ // when releasing the fingers in opposite order from the touch screen
+ if (!this.props.touch.allowDragging) return;
+
+ this.stopRolling();
+
+ this.props.touch.start = this.start;
+ this.props.touch.end = this.end;
+ this.props.touch.dragging = true;
+
+ if (this.body.dom.root) {
+ this.body.dom.root.style.cursor = 'move';
+ }
+ };
+
+ /**
+ * Perform dragging operation
+ * @param {Event} event
+ * @private
+ */
+ Range.prototype._onDrag = function (event) {
+ if (!event) return;
+
+ if (!this.props.touch.dragging) return;
+
+ // only allow dragging when configured as movable
+ if (!this.options.moveable) return;
+
+ // TODO: this may be redundant in hammerjs2
+ // refuse to drag when we where pinching to prevent the timeline make a jump
+ // when releasing the fingers in opposite order from the touch screen
+ if (!this.props.touch.allowDragging) return;
+
+ var direction = this.options.direction;
+ validateDirection(direction);
+ var delta = direction == 'horizontal' ? event.deltaX : event.deltaY;
+ delta -= this.deltaDifference;
+ var interval = this.props.touch.end - this.props.touch.start;
+
+ // normalize dragging speed if cutout is in between.
+ var duration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end);
+ interval -= duration;
+
+ var width = direction == 'horizontal' ? this.body.domProps.center.width : this.body.domProps.center.height;
+
+ if (this.options.rtl) {
+ var diffRange = delta / width * interval;
+ } else {
+ var diffRange = -delta / width * interval;
+ }
+
+ var newStart = this.props.touch.start + diffRange;
+ var newEnd = this.props.touch.end + diffRange;
+
+ // snapping times away from hidden zones
+ var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, this.previousDelta - delta, true);
+ var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, this.previousDelta - delta, true);
+ if (safeStart != newStart || safeEnd != newEnd) {
+ this.deltaDifference += delta;
+ this.props.touch.start = safeStart;
+ this.props.touch.end = safeEnd;
+ this._onDrag(event);
+ return;
+ }
+
+ this.previousDelta = delta;
+ this._applyRange(newStart, newEnd);
+
+ var startDate = new Date(this.start);
+ var endDate = new Date(this.end);
+
+ // fire a rangechange event
+ this.body.emitter.emit('rangechange', {
+ start: startDate,
+ end: endDate,
+ byUser: true,
+ event: util.elementsCensor(event)
+ });
+
+ // fire a panmove event
+ this.body.emitter.emit('panmove');
+ };
+
+ /**
+ * Stop dragging operation
+ * @param {event} event
+ * @private
+ */
+ Range.prototype._onDragEnd = function (event) {
+ if (!this.props.touch.dragging) return;
+
+ // only allow dragging when configured as movable
+ if (!this.options.moveable) return;
+
+ // TODO: this may be redundant in hammerjs2
+ // refuse to drag when we where pinching to prevent the timeline make a jump
+ // when releasing the fingers in opposite order from the touch screen
+ if (!this.props.touch.allowDragging) return;
+
+ this.props.touch.dragging = false;
+ if (this.body.dom.root) {
+ this.body.dom.root.style.cursor = 'auto';
+ }
+
+ // fire a rangechanged event
+ this.body.emitter.emit('rangechanged', {
+ start: new Date(this.start),
+ end: new Date(this.end),
+ byUser: true,
+ event: util.elementsCensor(event)
+ });
+ };
+
+ /**
+ * Event handler for mouse wheel event, used to zoom
+ * Code from http://adomas.org/javascript-mouse-wheel/
+ * @param {Event} event
+ * @private
+ */
+ Range.prototype._onMouseWheel = function (event) {
+ // retrieve delta
+ var delta = 0;
+ if (event.wheelDelta) {
+ /* IE/Opera. */
+ delta = event.wheelDelta / 120;
+ } else if (event.detail) {
+ /* Mozilla case. */
+ // In Mozilla, sign of delta is different than in IE.
+ // Also, delta is multiple of 3.
+ delta = -event.detail / 3;
+ }
+
+ // don't allow zoom when the according key is pressed and the zoomKey option or not zoomable but movable
+ if (this.options.zoomKey && !event[this.options.zoomKey] && this.options.zoomable || !this.options.zoomable && this.options.moveable) {
+ if (this.options.horizontalScroll) {
+ // Prevent default actions caused by mouse wheel
+ // (else the page and timeline both scroll)
+ event.preventDefault();
+
+ // calculate a single scroll jump relative to the range scale
+ var diff = delta * (this.end - this.start) / 20;
+ // calculate new start and end
+ var newStart = this.start - diff;
+ var newEnd = this.end - diff;
+
+ this.setRange(newStart, newEnd, false, true, event);
+ }
+ return;
+ }
+
+ // only allow zooming when configured as zoomable and moveable
+ if (!(this.options.zoomable && this.options.moveable)) return;
+
+ // only zoom when the mouse is inside the current range
+ if (!this._isInsideRange(event)) return;
+
+ // If delta is nonzero, handle it.
+ // Basically, delta is now positive if wheel was scrolled up,
+ // and negative, if wheel was scrolled down.
+ if (delta) {
+ // perform the zoom action. Delta is normally 1 or -1
+
+ // adjust a negative delta such that zooming in with delta 0.1
+ // equals zooming out with a delta -0.1
+ var scale;
+ if (delta < 0) {
+ scale = 1 - delta / 5;
+ } else {
+ scale = 1 / (1 + delta / 5);
+ }
+
+ // calculate center, the date to zoom around
+ var pointerDate;
+ if (this.rolling) {
+ pointerDate = (this.start + this.end) / 2;
+ } else {
+ var pointer = this.getPointer({ x: event.clientX, y: event.clientY }, this.body.dom.center);
+ pointerDate = this._pointerToDate(pointer);
+ }
+ this.zoom(scale, pointerDate, delta, event);
+
+ // Prevent default actions caused by mouse wheel
+ // (else the page and timeline both scroll)
+ event.preventDefault();
+ }
+ };
+
+ /**
+ * Start of a touch gesture
+ * @private
+ */
+ Range.prototype._onTouch = function (event) {
+ this.props.touch.start = this.start;
+ this.props.touch.end = this.end;
+ this.props.touch.allowDragging = true;
+ this.props.touch.center = null;
+ this.scaleOffset = 0;
+ this.deltaDifference = 0;
+ };
+
+ /**
+ * Handle pinch event
+ * @param {Event} event
+ * @private
+ */
+ Range.prototype._onPinch = function (event) {
+ // only allow zooming when configured as zoomable and moveable
+ if (!(this.options.zoomable && this.options.moveable)) return;
+
+ this.props.touch.allowDragging = false;
+
+ if (!this.props.touch.center) {
+ this.props.touch.center = this.getPointer(event.center, this.body.dom.center);
+ }
+
+ this.stopRolling();
+
+ var scale = 1 / (event.scale + this.scaleOffset);
+ var centerDate = this._pointerToDate(this.props.touch.center);
+
+ var hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end);
+ var hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, centerDate);
+ var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore;
+
+ // calculate new start and end
+ var newStart = centerDate - hiddenDurationBefore + (this.props.touch.start - (centerDate - hiddenDurationBefore)) * scale;
+ var newEnd = centerDate + hiddenDurationAfter + (this.props.touch.end - (centerDate + hiddenDurationAfter)) * scale;
+
+ // snapping times away from hidden zones
+ this.startToFront = 1 - scale <= 0; // used to do the right auto correction with periodic hidden times
+ this.endToFront = scale - 1 <= 0; // used to do the right auto correction with periodic hidden times
+
+ var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, 1 - scale, true);
+ var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, scale - 1, true);
+ if (safeStart != newStart || safeEnd != newEnd) {
+ this.props.touch.start = safeStart;
+ this.props.touch.end = safeEnd;
+ this.scaleOffset = 1 - event.scale;
+ newStart = safeStart;
+ newEnd = safeEnd;
+ }
+
+ this.setRange(newStart, newEnd, false, true, event);
+
+ this.startToFront = false; // revert to default
+ this.endToFront = true; // revert to default
+ };
+
+ /**
+ * Test whether the mouse from a mouse event is inside the visible window,
+ * between the current start and end date
+ * @param {Object} event
+ * @return {boolean} Returns true when inside the visible window
+ * @private
+ */
+ Range.prototype._isInsideRange = function (event) {
+ // calculate the time where the mouse is, check whether inside
+ // and no scroll action should happen.
+ var clientX = event.center ? event.center.x : event.clientX;
+ if (this.options.rtl) {
+ var x = clientX - util.getAbsoluteLeft(this.body.dom.centerContainer);
+ } else {
+ var x = util.getAbsoluteRight(this.body.dom.centerContainer) - clientX;
+ }
+ var time = this.body.util.toTime(x);
+
+ return time >= this.start && time <= this.end;
+ };
+
+ /**
+ * Helper function to calculate the center date for zooming
+ * @param {{x: Number, y: Number}} pointer
+ * @return {number} date
+ * @private
+ */
+ Range.prototype._pointerToDate = function (pointer) {
+ var conversion;
+ var direction = this.options.direction;
+
+ validateDirection(direction);
+
+ if (direction == 'horizontal') {
+ return this.body.util.toTime(pointer.x).valueOf();
+ } else {
+ var height = this.body.domProps.center.height;
+ conversion = this.conversion(height);
+ return pointer.y / conversion.scale + conversion.offset;
+ }
+ };
+
+ /**
+ * Get the pointer location relative to the location of the dom element
+ * @param {{x: Number, y: Number}} touch
+ * @param {Element} element HTML DOM element
+ * @return {{x: Number, y: Number}} pointer
+ * @private
+ */
+ Range.prototype.getPointer = function (touch, element) {
+ if (this.options.rtl) {
+ return {
+ x: util.getAbsoluteRight(element) - touch.x,
+ y: touch.y - util.getAbsoluteTop(element)
+ };
+ } else {
+ return {
+ x: touch.x - util.getAbsoluteLeft(element),
+ y: touch.y - util.getAbsoluteTop(element)
+ };
+ }
+ };
+
+ /**
+ * Zoom the range the given scale in or out. Start and end date will
+ * be adjusted, and the timeline will be redrawn. You can optionally give a
+ * date around which to zoom.
+ * For example, try scale = 0.9 or 1.1
+ * @param {Number} scale Scaling factor. Values above 1 will zoom out,
+ * values below 1 will zoom in.
+ * @param {Number} [center] Value representing a date around which will
+ * be zoomed.
+ */
+ Range.prototype.zoom = function (scale, center, delta, event) {
+ // if centerDate is not provided, take it half between start Date and end Date
+ if (center == null) {
+ center = (this.start + this.end) / 2;
+ }
+
+ var hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end);
+ var hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, center);
+ var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore;
+
+ // calculate new start and end
+ var newStart = center - hiddenDurationBefore + (this.start - (center - hiddenDurationBefore)) * scale;
+ var newEnd = center + hiddenDurationAfter + (this.end - (center + hiddenDurationAfter)) * scale;
+
+ // snapping times away from hidden zones
+ this.startToFront = delta > 0 ? false : true; // used to do the right autocorrection with periodic hidden times
+ this.endToFront = -delta > 0 ? false : true; // used to do the right autocorrection with periodic hidden times
+ var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, delta, true);
+ var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, -delta, true);
+ if (safeStart != newStart || safeEnd != newEnd) {
+ newStart = safeStart;
+ newEnd = safeEnd;
+ }
+
+ this.setRange(newStart, newEnd, false, true, event);
+
+ this.startToFront = false; // revert to default
+ this.endToFront = true; // revert to default
+ };
+
+ /**
+ * Move the range with a given delta to the left or right. Start and end
+ * value will be adjusted. For example, try delta = 0.1 or -0.1
+ * @param {Number} delta Moving amount. Positive value will move right,
+ * negative value will move left
+ */
+ Range.prototype.move = function (delta) {
+ // zoom start Date and end Date relative to the centerDate
+ var diff = this.end - this.start;
+
+ // apply new values
+ var newStart = this.start + diff * delta;
+ var newEnd = this.end + diff * delta;
+
+ // TODO: reckon with min and max range
+
+ this.start = newStart;
+ this.end = newEnd;
+ };
+
+ /**
+ * Move the range to a new center point
+ * @param {Number} moveTo New center point of the range
+ */
+ Range.prototype.moveTo = function (moveTo) {
+ var center = (this.start + this.end) / 2;
+
+ var diff = center - moveTo;
+
+ // calculate new start and end
+ var newStart = this.start - diff;
+ var newEnd = this.end - diff;
+
+ this.setRange(newStart, newEnd, false, true, event);
+ };
+
+ module.exports = Range;
+
+/***/ },
+/* 124 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var util = __webpack_require__(1);
+
+ /**
+ * Prototype for visual components
+ * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} [body]
+ * @param {Object} [options]
+ */
+ function Component(body, options) {
+ this.options = null;
+ this.props = null;
+ }
+
+ /**
+ * Set options for the component. The new options will be merged into the
+ * current options.
+ * @param {Object} options
+ */
+ Component.prototype.setOptions = function (options) {
+ if (options) {
+ util.extend(this.options, options);
+ }
+ };
+
+ /**
+ * Repaint the component
+ * @return {boolean} Returns true if the component is resized
+ */
+ Component.prototype.redraw = function () {
+ // should be implemented by the component
+ return false;
+ };
+
+ /**
+ * Destroy the component. Cleanup DOM and event listeners
+ */
+ Component.prototype.destroy = function () {
+ // should be implemented by the component
+ };
+
+ /**
+ * Test whether the component is resized since the last time _isResized() was
+ * called.
+ * @return {Boolean} Returns true if the component is resized
+ * @protected
+ */
+ Component.prototype._isResized = function () {
+ var resized = this.props._previousWidth !== this.props.width || this.props._previousHeight !== this.props.height;
+
+ this.props._previousWidth = this.props.width;
+ this.props._previousHeight = this.props.height;
+
+ return resized;
+ };
+
+ module.exports = Component;
+
+/***/ },
+/* 125 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ /**
+ * used in Core to convert the options into a volatile variable
+ *
+ * @param {function} moment
+ * @param {Object} body
+ * @param {Array | Object} hiddenDates
+ */
+ exports.convertHiddenOptions = function (moment, body, hiddenDates) {
+ if (hiddenDates && !Array.isArray(hiddenDates)) {
+ return exports.convertHiddenOptions(moment, body, [hiddenDates]);
+ }
+
+ body.hiddenDates = [];
+ if (hiddenDates) {
+ if (Array.isArray(hiddenDates) == true) {
+ for (var i = 0; i < hiddenDates.length; i++) {
+ if (hiddenDates[i].repeat === undefined) {
+ var dateItem = {};
+ dateItem.start = moment(hiddenDates[i].start).toDate().valueOf();
+ dateItem.end = moment(hiddenDates[i].end).toDate().valueOf();
+ body.hiddenDates.push(dateItem);
+ }
+ }
+ body.hiddenDates.sort(function (a, b) {
+ return a.start - b.start;
+ }); // sort by start time
+ }
+ }
+ };
+
+ /**
+ * create new entrees for the repeating hidden dates
+ * @param {function} moment
+ * @param {Object} body
+ * @param {Array | Object} hiddenDates
+ */
+ exports.updateHiddenDates = function (moment, body, hiddenDates) {
+ if (hiddenDates && !Array.isArray(hiddenDates)) {
+ return exports.updateHiddenDates(moment, body, [hiddenDates]);
+ }
+
+ if (hiddenDates && body.domProps.centerContainer.width !== undefined) {
+ exports.convertHiddenOptions(moment, body, hiddenDates);
+
+ var start = moment(body.range.start);
+ var end = moment(body.range.end);
+
+ var totalRange = body.range.end - body.range.start;
+ var pixelTime = totalRange / body.domProps.centerContainer.width;
+
+ for (var i = 0; i < hiddenDates.length; i++) {
+ if (hiddenDates[i].repeat !== undefined) {
+ var startDate = moment(hiddenDates[i].start);
+ var endDate = moment(hiddenDates[i].end);
+
+ if (startDate._d == "Invalid Date") {
+ throw new Error("Supplied start date is not valid: " + hiddenDates[i].start);
+ }
+ if (endDate._d == "Invalid Date") {
+ throw new Error("Supplied end date is not valid: " + hiddenDates[i].end);
+ }
+
+ var duration = endDate - startDate;
+ if (duration >= 4 * pixelTime) {
+
+ var offset = 0;
+ var runUntil = end.clone();
+ switch (hiddenDates[i].repeat) {
+ case "daily":
+ // case of time
+ if (startDate.day() != endDate.day()) {
+ offset = 1;
+ }
+ startDate.dayOfYear(start.dayOfYear());
+ startDate.year(start.year());
+ startDate.subtract(7, 'days');
+
+ endDate.dayOfYear(start.dayOfYear());
+ endDate.year(start.year());
+ endDate.subtract(7 - offset, 'days');
+
+ runUntil.add(1, 'weeks');
+ break;
+ case "weekly":
+ var dayOffset = endDate.diff(startDate, 'days');
+ var day = startDate.day();
+
+ // set the start date to the range.start
+ startDate.date(start.date());
+ startDate.month(start.month());
+ startDate.year(start.year());
+ endDate = startDate.clone();
+
+ // force
+ startDate.day(day);
+ endDate.day(day);
+ endDate.add(dayOffset, 'days');
+
+ startDate.subtract(1, 'weeks');
+ endDate.subtract(1, 'weeks');
+
+ runUntil.add(1, 'weeks');
+ break;
+ case "monthly":
+ if (startDate.month() != endDate.month()) {
+ offset = 1;
+ }
+ startDate.month(start.month());
+ startDate.year(start.year());
+ startDate.subtract(1, 'months');
+
+ endDate.month(start.month());
+ endDate.year(start.year());
+ endDate.subtract(1, 'months');
+ endDate.add(offset, 'months');
+
+ runUntil.add(1, 'months');
+ break;
+ case "yearly":
+ if (startDate.year() != endDate.year()) {
+ offset = 1;
+ }
+ startDate.year(start.year());
+ startDate.subtract(1, 'years');
+ endDate.year(start.year());
+ endDate.subtract(1, 'years');
+ endDate.add(offset, 'years');
+
+ runUntil.add(1, 'years');
+ break;
+ default:
+ console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat);
+ return;
+ }
+ while (startDate < runUntil) {
+ body.hiddenDates.push({ start: startDate.valueOf(), end: endDate.valueOf() });
+ switch (hiddenDates[i].repeat) {
+ case "daily":
+ startDate.add(1, 'days');
+ endDate.add(1, 'days');
+ break;
+ case "weekly":
+ startDate.add(1, 'weeks');
+ endDate.add(1, 'weeks');
+ break;
+ case "monthly":
+ startDate.add(1, 'months');
+ endDate.add(1, 'months');
+ break;
+ case "yearly":
+ startDate.add(1, 'y');
+ endDate.add(1, 'y');
+ break;
+ default:
+ console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat);
+ return;
+ }
+ }
+ body.hiddenDates.push({ start: startDate.valueOf(), end: endDate.valueOf() });
+ }
+ }
+ }
+ // remove duplicates, merge where possible
+ exports.removeDuplicates(body);
+ // ensure the new positions are not on hidden dates
+ var startHidden = exports.isHidden(body.range.start, body.hiddenDates);
+ var endHidden = exports.isHidden(body.range.end, body.hiddenDates);
+ var rangeStart = body.range.start;
+ var rangeEnd = body.range.end;
+ if (startHidden.hidden == true) {
+ rangeStart = body.range.startToFront == true ? startHidden.startDate - 1 : startHidden.endDate + 1;
+ }
+ if (endHidden.hidden == true) {
+ rangeEnd = body.range.endToFront == true ? endHidden.startDate - 1 : endHidden.endDate + 1;
+ }
+ if (startHidden.hidden == true || endHidden.hidden == true) {
+ body.range._applyRange(rangeStart, rangeEnd);
+ }
+ }
+ };
+
+ /**
+ * remove duplicates from the hidden dates list. Duplicates are evil. They mess everything up.
+ * Scales with N^2
+ * @param body
+ */
+ exports.removeDuplicates = function (body) {
+ var hiddenDates = body.hiddenDates;
+ var safeDates = [];
+ for (var i = 0; i < hiddenDates.length; i++) {
+ for (var j = 0; j < hiddenDates.length; j++) {
+ if (i != j && hiddenDates[j].remove != true && hiddenDates[i].remove != true) {
+ // j inside i
+ if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) {
+ hiddenDates[j].remove = true;
+ }
+ // j start inside i
+ else if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].start <= hiddenDates[i].end) {
+ hiddenDates[i].end = hiddenDates[j].end;
+ hiddenDates[j].remove = true;
+ }
+ // j end inside i
+ else if (hiddenDates[j].end >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) {
+ hiddenDates[i].start = hiddenDates[j].start;
+ hiddenDates[j].remove = true;
+ }
+ }
+ }
+ }
+
+ for (var i = 0; i < hiddenDates.length; i++) {
+ if (hiddenDates[i].remove !== true) {
+ safeDates.push(hiddenDates[i]);
+ }
+ }
+
+ body.hiddenDates = safeDates;
+ body.hiddenDates.sort(function (a, b) {
+ return a.start - b.start;
+ }); // sort by start time
+ };
+
+ exports.printDates = function (dates) {
+ for (var i = 0; i < dates.length; i++) {
+ console.log(i, new Date(dates[i].start), new Date(dates[i].end), dates[i].start, dates[i].end, dates[i].remove);
+ }
+ };
+
+ /**
+ * Used in TimeStep to avoid the hidden times.
+ * @param {function} moment
+ * @param {TimeStep} timeStep
+ * @param previousTime
+ */
+ exports.stepOverHiddenDates = function (moment, timeStep, previousTime) {
+ var stepInHidden = false;
+ var currentValue = timeStep.current.valueOf();
+ for (var i = 0; i < timeStep.hiddenDates.length; i++) {
+ var startDate = timeStep.hiddenDates[i].start;
+ var endDate = timeStep.hiddenDates[i].end;
+ if (currentValue >= startDate && currentValue < endDate) {
+ stepInHidden = true;
+ break;
+ }
+ }
+
+ if (stepInHidden == true && currentValue < timeStep._end.valueOf() && currentValue != previousTime) {
+ var prevValue = moment(previousTime);
+ var newValue = moment(endDate);
+ //check if the next step should be major
+ if (prevValue.year() != newValue.year()) {
+ timeStep.switchedYear = true;
+ } else if (prevValue.month() != newValue.month()) {
+ timeStep.switchedMonth = true;
+ } else if (prevValue.dayOfYear() != newValue.dayOfYear()) {
+ timeStep.switchedDay = true;
+ }
+
+ timeStep.current = newValue;
+ }
+ };
+
+ ///**
+ // * Used in TimeStep to avoid the hidden times.
+ // * @param timeStep
+ // * @param previousTime
+ // */
+ //exports.checkFirstStep = function(timeStep) {
+ // var stepInHidden = false;
+ // var currentValue = timeStep.current.valueOf();
+ // for (var i = 0; i < timeStep.hiddenDates.length; i++) {
+ // var startDate = timeStep.hiddenDates[i].start;
+ // var endDate = timeStep.hiddenDates[i].end;
+ // if (currentValue >= startDate && currentValue < endDate) {
+ // stepInHidden = true;
+ // break;
+ // }
+ // }
+ //
+ // if (stepInHidden == true && currentValue <= timeStep._end.valueOf()) {
+ // var newValue = moment(endDate);
+ // timeStep.current = newValue.toDate();
+ // }
+ //};
+
+ /**
+ * replaces the Core toScreen methods
+ * @param Core
+ * @param time
+ * @param width
+ * @returns {number}
+ */
+ exports.toScreen = function (Core, time, width) {
+ if (Core.body.hiddenDates.length == 0) {
+ var conversion = Core.range.conversion(width);
+ return (time.valueOf() - conversion.offset) * conversion.scale;
+ } else {
+ var hidden = exports.isHidden(time, Core.body.hiddenDates);
+ if (hidden.hidden == true) {
+ time = hidden.startDate;
+ }
+
+ var duration = exports.getHiddenDurationBetween(Core.body.hiddenDates, Core.range.start, Core.range.end);
+ if (time < Core.range.start) {
+ var conversion = Core.range.conversion(width, duration);
+ var hiddenBeforeStart = exports.getHiddenDurationBeforeStart(Core.body.hiddenDates, time, conversion.offset);
+ time = Core.options.moment(time).toDate().valueOf();
+ time = time + hiddenBeforeStart;
+ return -(conversion.offset - time.valueOf()) * conversion.scale;
+ } else if (time > Core.range.end) {
+ var rangeAfterEnd = { start: Core.range.start, end: time };
+ time = exports.correctTimeForHidden(Core.options.moment, Core.body.hiddenDates, rangeAfterEnd, time);
+ var conversion = Core.range.conversion(width, duration);
+ return (time.valueOf() - conversion.offset) * conversion.scale;
+ } else {
+ time = exports.correctTimeForHidden(Core.options.moment, Core.body.hiddenDates, Core.range, time);
+ var conversion = Core.range.conversion(width, duration);
+ return (time.valueOf() - conversion.offset) * conversion.scale;
+ }
+ }
+ };
+
+ /**
+ * Replaces the core toTime methods
+ * @param body
+ * @param range
+ * @param x
+ * @param width
+ * @returns {Date}
+ */
+ exports.toTime = function (Core, x, width) {
+ if (Core.body.hiddenDates.length == 0) {
+ var conversion = Core.range.conversion(width);
+ return new Date(x / conversion.scale + conversion.offset);
+ } else {
+ var hiddenDuration = exports.getHiddenDurationBetween(Core.body.hiddenDates, Core.range.start, Core.range.end);
+ var totalDuration = Core.range.end - Core.range.start - hiddenDuration;
+ var partialDuration = totalDuration * x / width;
+ var accumulatedHiddenDuration = exports.getAccumulatedHiddenDuration(Core.body.hiddenDates, Core.range, partialDuration);
+
+ var newTime = new Date(accumulatedHiddenDuration + partialDuration + Core.range.start);
+ return newTime;
+ }
+ };
+
+ /**
+ * Support function
+ *
+ * @param hiddenDates
+ * @param range
+ * @returns {number}
+ */
+ exports.getHiddenDurationBetween = function (hiddenDates, start, end) {
+ var duration = 0;
+ for (var i = 0; i < hiddenDates.length; i++) {
+ var startDate = hiddenDates[i].start;
+ var endDate = hiddenDates[i].end;
+ // if time after the cutout, and the
+ if (startDate >= start && endDate < end) {
+ duration += endDate - startDate;
+ }
+ }
+ return duration;
+ };
+
+ /**
+ * Support function
+ *
+ * @param hiddenDates
+ * @param start
+ * @param end
+ * @returns {number}
+ */
+ exports.getHiddenDurationBeforeStart = function (hiddenDates, start, end) {
+ var duration = 0;
+ for (var i = 0; i < hiddenDates.length; i++) {
+ var startDate = hiddenDates[i].start;
+ var endDate = hiddenDates[i].end;
+
+ if (startDate >= start && endDate <= end) {
+ duration += endDate - startDate;
+ }
+ }
+ return duration;
+ };
+
+ /**
+ * Support function
+ * @param moment
+ * @param hiddenDates
+ * @param range
+ * @param time
+ * @returns {{duration: number, time: *, offset: number}}
+ */
+ exports.correctTimeForHidden = function (moment, hiddenDates, range, time) {
+ time = moment(time).toDate().valueOf();
+ time -= exports.getHiddenDurationBefore(moment, hiddenDates, range, time);
+ return time;
+ };
+
+ exports.getHiddenDurationBefore = function (moment, hiddenDates, range, time) {
+ var timeOffset = 0;
+ time = moment(time).toDate().valueOf();
+
+ for (var i = 0; i < hiddenDates.length; i++) {
+ var startDate = hiddenDates[i].start;
+ var endDate = hiddenDates[i].end;
+ // if time after the cutout, and the
+ if (startDate >= range.start && endDate < range.end) {
+ if (time >= endDate) {
+ timeOffset += endDate - startDate;
+ }
+ }
+ }
+ return timeOffset;
+ };
+
+ /**
+ * sum the duration from start to finish, including the hidden duration,
+ * until the required amount has been reached, return the accumulated hidden duration
+ * @param hiddenDates
+ * @param range
+ * @param time
+ * @returns {{duration: number, time: *, offset: number}}
+ */
+ exports.getAccumulatedHiddenDuration = function (hiddenDates, range, requiredDuration) {
+ var hiddenDuration = 0;
+ var duration = 0;
+ var previousPoint = range.start;
+ //exports.printDates(hiddenDates)
+ for (var i = 0; i < hiddenDates.length; i++) {
+ var startDate = hiddenDates[i].start;
+ var endDate = hiddenDates[i].end;
+ // if time after the cutout, and the
+ if (startDate >= range.start && endDate < range.end) {
+ duration += startDate - previousPoint;
+ previousPoint = endDate;
+ if (duration >= requiredDuration) {
+ break;
+ } else {
+ hiddenDuration += endDate - startDate;
+ }
+ }
+ }
+
+ return hiddenDuration;
+ };
+
+ /**
+ * used to step over to either side of a hidden block. Correction is disabled on tablets, might be set to true
+ * @param hiddenDates
+ * @param time
+ * @param direction
+ * @param correctionEnabled
+ * @returns {*}
+ */
+ exports.snapAwayFromHidden = function (hiddenDates, time, direction, correctionEnabled) {
+ var isHidden = exports.isHidden(time, hiddenDates);
+ if (isHidden.hidden == true) {
+ if (direction < 0) {
+ if (correctionEnabled == true) {
+ return isHidden.startDate - (isHidden.endDate - time) - 1;
+ } else {
+ return isHidden.startDate - 1;
+ }
+ } else {
+ if (correctionEnabled == true) {
+ return isHidden.endDate + (time - isHidden.startDate) + 1;
+ } else {
+ return isHidden.endDate + 1;
+ }
+ }
+ } else {
+ return time;
+ }
+ };
+
+ /**
+ * Check if a time is hidden
+ *
+ * @param time
+ * @param hiddenDates
+ * @returns {{hidden: boolean, startDate: Window.start, endDate: *}}
+ */
+ exports.isHidden = function (time, hiddenDates) {
+ for (var i = 0; i < hiddenDates.length; i++) {
+ var startDate = hiddenDates[i].start;
+ var endDate = hiddenDates[i].end;
+
+ if (time >= startDate && time < endDate) {
+ // if the start is entering a hidden zone
+ return { hidden: true, startDate: startDate, endDate: endDate };
+ break;
+ }
+ }
+ return { hidden: false, startDate: startDate, endDate: endDate };
+ };
+
+/***/ },
+/* 126 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Emitter = __webpack_require__(95);
+ var Hammer = __webpack_require__(108);
+ var hammerUtil = __webpack_require__(121);
+ var util = __webpack_require__(1);
+ var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+ var Range = __webpack_require__(123);
+ var ItemSet = __webpack_require__(127);
+ var TimeAxis = __webpack_require__(138);
+ var Activator = __webpack_require__(139);
+ var DateUtil = __webpack_require__(125);
+ var CustomTime = __webpack_require__(140);
+
+ /**
+ * Create a timeline visualization
+ * @constructor
+ */
+ function Core() {}
+
+ // turn Core into an event emitter
+ Emitter(Core.prototype);
+
+ /**
+ * Create the main DOM for the Core: a root panel containing left, right,
+ * top, bottom, content, and background panel.
+ * @param {Element} container The container element where the Core will
+ * be attached.
+ * @protected
+ */
+ Core.prototype._create = function (container) {
+ this.dom = {};
+
+ this.dom.container = container;
+
+ this.dom.root = document.createElement('div');
+ this.dom.background = document.createElement('div');
+ this.dom.backgroundVertical = document.createElement('div');
+ this.dom.backgroundHorizontal = document.createElement('div');
+ this.dom.centerContainer = document.createElement('div');
+ this.dom.leftContainer = document.createElement('div');
+ this.dom.rightContainer = document.createElement('div');
+ this.dom.center = document.createElement('div');
+ this.dom.left = document.createElement('div');
+ this.dom.right = document.createElement('div');
+ this.dom.top = document.createElement('div');
+ this.dom.bottom = document.createElement('div');
+ this.dom.shadowTop = document.createElement('div');
+ this.dom.shadowBottom = document.createElement('div');
+ this.dom.shadowTopLeft = document.createElement('div');
+ this.dom.shadowBottomLeft = document.createElement('div');
+ this.dom.shadowTopRight = document.createElement('div');
+ this.dom.shadowBottomRight = document.createElement('div');
+ this.dom.rollingModeBtn = document.createElement('div');
+
+ this.dom.root.className = 'vis-timeline';
+ this.dom.background.className = 'vis-panel vis-background';
+ this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical';
+ this.dom.backgroundHorizontal.className = 'vis-panel vis-background vis-horizontal';
+ this.dom.centerContainer.className = 'vis-panel vis-center';
+ this.dom.leftContainer.className = 'vis-panel vis-left';
+ this.dom.rightContainer.className = 'vis-panel vis-right';
+ this.dom.top.className = 'vis-panel vis-top';
+ this.dom.bottom.className = 'vis-panel vis-bottom';
+ this.dom.left.className = 'vis-content';
+ this.dom.center.className = 'vis-content';
+ this.dom.right.className = 'vis-content';
+ this.dom.shadowTop.className = 'vis-shadow vis-top';
+ this.dom.shadowBottom.className = 'vis-shadow vis-bottom';
+ this.dom.shadowTopLeft.className = 'vis-shadow vis-top';
+ this.dom.shadowBottomLeft.className = 'vis-shadow vis-bottom';
+ this.dom.shadowTopRight.className = 'vis-shadow vis-top';
+ this.dom.shadowBottomRight.className = 'vis-shadow vis-bottom';
+ this.dom.rollingModeBtn.className = 'vis-rolling-mode-btn';
+
+ this.dom.root.appendChild(this.dom.background);
+ this.dom.root.appendChild(this.dom.backgroundVertical);
+ this.dom.root.appendChild(this.dom.backgroundHorizontal);
+ this.dom.root.appendChild(this.dom.centerContainer);
+ this.dom.root.appendChild(this.dom.leftContainer);
+ this.dom.root.appendChild(this.dom.rightContainer);
+ this.dom.root.appendChild(this.dom.top);
+ this.dom.root.appendChild(this.dom.bottom);
+ this.dom.root.appendChild(this.dom.bottom);
+ this.dom.root.appendChild(this.dom.rollingModeBtn);
+
+ this.dom.centerContainer.appendChild(this.dom.center);
+ this.dom.leftContainer.appendChild(this.dom.left);
+ this.dom.rightContainer.appendChild(this.dom.right);
+ this.dom.centerContainer.appendChild(this.dom.shadowTop);
+ this.dom.centerContainer.appendChild(this.dom.shadowBottom);
+ this.dom.leftContainer.appendChild(this.dom.shadowTopLeft);
+ this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft);
+ this.dom.rightContainer.appendChild(this.dom.shadowTopRight);
+ this.dom.rightContainer.appendChild(this.dom.shadowBottomRight);
+
+ // size properties of each of the panels
+ this.props = {
+ root: {},
+ background: {},
+ centerContainer: {},
+ leftContainer: {},
+ rightContainer: {},
+ center: {},
+ left: {},
+ right: {},
+ top: {},
+ bottom: {},
+ border: {},
+ scrollTop: 0,
+ scrollTopMin: 0
+ };
+
+ this.on('rangechange', function () {
+ if (this.initialDrawDone === true) {
+ this._redraw();
+ }
+ }.bind(this));
+ this.on('touch', this._onTouch.bind(this));
+ this.on('panmove', this._onDrag.bind(this));
+
+ var me = this;
+ this._origRedraw = this._redraw.bind(this);
+ this._redraw = util.throttle(this._origRedraw);
+
+ this.on('_change', function (properties) {
+ if (me.itemSet && me.itemSet.initialItemSetDrawn && properties && properties.queue == true) {
+ me._redraw();
+ } else {
+ me._origRedraw();
+ }
+ });
+
+ // create event listeners for all interesting events, these events will be
+ // emitted via emitter
+ this.hammer = new Hammer(this.dom.root);
+ var pinchRecognizer = this.hammer.get('pinch').set({ enable: true });
+ hammerUtil.disablePreventDefaultVertically(pinchRecognizer);
+ this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL });
+ this.listeners = {};
+
+ var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend'
+ // TODO: cleanup
+ //'touch', 'pinch',
+ //'tap', 'doubletap', 'hold',
+ //'dragstart', 'drag', 'dragend',
+ //'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox
+ ];
+ events.forEach(function (type) {
+ var listener = function listener(event) {
+ if (me.isActive()) {
+ me.emit(type, event);
+ }
+ };
+ me.hammer.on(type, listener);
+ me.listeners[type] = listener;
+ });
+
+ // emulate a touch event (emitted before the start of a pan, pinch, tap, or press)
+ hammerUtil.onTouch(this.hammer, function (event) {
+ me.emit('touch', event);
+ }.bind(this));
+
+ // emulate a release event (emitted after a pan, pinch, tap, or press)
+ hammerUtil.onRelease(this.hammer, function (event) {
+ me.emit('release', event);
+ }.bind(this));
+
+ function onMouseWheel(event) {
+ if (this.isActive()) {
+ this.emit('mousewheel', event);
+ }
+
+ // prevent scrolling if not specified explicitly or when horizontalScroll is true
+ if (!this.options.verticalScroll || this.options.horizontalScroll) return;
+
+ // prevent scrolling when zoomKey defined or activated
+ if (!this.options.zoomKey || event[this.options.zoomKey]) return;
+
+ // Prevent default actions caused by mouse wheel
+ // (else the page and timeline both scroll)
+ event.preventDefault();
+
+ var delta = 0;
+ if (event.wheelDelta) {
+ /* IE/Opera. */
+ delta = event.wheelDelta / 120;
+ } else if (event.detail) {
+ /* Mozilla case. */
+ // In Mozilla, sign of delta is different than in IE.
+ // Also, delta is multiple of 3.
+ delta = -event.detail / 3;
+ }
+
+ var current = this.props.scrollTop;
+ var adjusted = current + delta * 120;
+
+ if (this.isActive()) {
+ this._setScrollTop(adjusted);
+ this._redraw();
+ this.emit('scroll', event);
+ }
+ }
+
+ if (this.dom.centerContainer.addEventListener) {
+ // IE9, Chrome, Safari, Opera
+ this.dom.centerContainer.addEventListener("mousewheel", onMouseWheel.bind(this), false);
+ // Firefox
+ this.dom.centerContainer.addEventListener("DOMMouseScroll", onMouseWheel.bind(this), false);
+ } else {
+ // IE 6/7/8
+ this.dom.centerContainer.attachEvent("onmousewheel", onMouseWheel.bind(this));
+ }
+
+ function onMouseScrollSide(event) {
+ if (!me.options.verticalScroll) return;
+ event.preventDefault();
+ if (me.isActive()) {
+ var adjusted = -event.target.scrollTop;
+ me._setScrollTop(adjusted);
+ me._redraw();
+ me.emit('scrollSide', event);
+ }
+ }
+
+ this.dom.left.parentNode.addEventListener('scroll', onMouseScrollSide.bind(this));
+ this.dom.right.parentNode.addEventListener('scroll', onMouseScrollSide.bind(this));
+
+ var itemAddedToTimeline = false;
+
+ function handleDragOver(event) {
+ if (event.preventDefault) {
+ event.preventDefault(); // Necessary. Allows us to drop.
+ }
+
+ // make sure your target is a vis element
+ if (!event.target.className.indexOf("vis") > -1) return;
+
+ // make sure only one item is added every time you're over the timeline
+ if (itemAddedToTimeline) return;
+
+ event.dataTransfer.dropEffect = 'move';
+ itemAddedToTimeline = true;
+ return false;
+ }
+
+ function handleDrop(event) {
+ // return when dropping non-vis items
+ try {
+ var itemData = JSON.parse(event.dataTransfer.getData("text"));
+ if (!itemData.content) return;
+ } catch (err) {
+ return false;
+ }
+
+ itemAddedToTimeline = false;
+ event.center = {
+ x: event.clientX,
+ y: event.clientY
+ };
+ me.itemSet._onAddItem(event);
+
+ return false;
+ }
+
+ this.dom.center.addEventListener('dragover', handleDragOver.bind(this), false);
+ this.dom.center.addEventListener('drop', handleDrop.bind(this), false);
+
+ this.customTimes = [];
+
+ // store state information needed for touch events
+ this.touch = {};
+
+ this.redrawCount = 0;
+ this.initialDrawDone = false;
+
+ // attach the root panel to the provided container
+ if (!container) throw new Error('No container provided');
+ container.appendChild(this.dom.root);
+ };
+
+ /**
+ * Set options. Options will be passed to all components loaded in the Timeline.
+ * @param {Object} [options]
+ * {String} orientation
+ * Vertical orientation for the Timeline,
+ * can be 'bottom' (default) or 'top'.
+ * {String | Number} width
+ * Width for the timeline, a number in pixels or
+ * a css string like '1000px' or '75%'. '100%' by default.
+ * {String | Number} height
+ * Fixed height for the Timeline, a number in pixels or
+ * a css string like '400px' or '75%'. If undefined,
+ * The Timeline will automatically size such that
+ * its contents fit.
+ * {String | Number} minHeight
+ * Minimum height for the Timeline, a number in pixels or
+ * a css string like '400px' or '75%'.
+ * {String | Number} maxHeight
+ * Maximum height for the Timeline, a number in pixels or
+ * a css string like '400px' or '75%'.
+ * {Number | Date | String} start
+ * Start date for the visible window
+ * {Number | Date | String} end
+ * End date for the visible window
+ */
+ Core.prototype.setOptions = function (options) {
+ if (options) {
+ // copy the known options
+ var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates', 'locale', 'locales', 'moment', 'rtl', 'zoomKey', 'horizontalScroll', 'verticalScroll'];
+ util.selectiveExtend(fields, this.options, options);
+
+ this.dom.rollingModeBtn.style.visibility = 'hidden';
+
+ if (this.options.rtl) {
+ this.dom.container.style.direction = "rtl";
+ this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical-rtl';
+ }
+
+ if (this.options.verticalScroll) {
+ if (this.options.rtl) {
+ this.dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll';
+ } else {
+ this.dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll';
+ }
+ }
+
+ this.options.orientation = { item: undefined, axis: undefined };
+ if ('orientation' in options) {
+ if (typeof options.orientation === 'string') {
+ this.options.orientation = {
+ item: options.orientation,
+ axis: options.orientation
+ };
+ } else if ((0, _typeof3['default'])(options.orientation) === 'object') {
+ if ('item' in options.orientation) {
+ this.options.orientation.item = options.orientation.item;
+ }
+ if ('axis' in options.orientation) {
+ this.options.orientation.axis = options.orientation.axis;
+ }
+ }
+ }
+
+ if (this.options.orientation.axis === 'both') {
+ if (!this.timeAxis2) {
+ var timeAxis2 = this.timeAxis2 = new TimeAxis(this.body);
+ timeAxis2.setOptions = function (options) {
+ var _options = options ? util.extend({}, options) : {};
+ _options.orientation = 'top'; // override the orientation option, always top
+ TimeAxis.prototype.setOptions.call(timeAxis2, _options);
+ };
+ this.components.push(timeAxis2);
+ }
+ } else {
+ if (this.timeAxis2) {
+ var index = this.components.indexOf(this.timeAxis2);
+ if (index !== -1) {
+ this.components.splice(index, 1);
+ }
+ this.timeAxis2.destroy();
+ this.timeAxis2 = null;
+ }
+ }
+
+ // if the graph2d's drawPoints is a function delegate the callback to the onRender property
+ if (typeof options.drawPoints == 'function') {
+ options.drawPoints = {
+ onRender: options.drawPoints
+ };
+ }
+
+ if ('hiddenDates' in this.options) {
+ DateUtil.convertHiddenOptions(this.options.moment, this.body, this.options.hiddenDates);
+ }
+
+ if ('clickToUse' in options) {
+ if (options.clickToUse) {
+ if (!this.activator) {
+ this.activator = new Activator(this.dom.root);
+ }
+ } else {
+ if (this.activator) {
+ this.activator.destroy();
+ delete this.activator;
+ }
+ }
+ }
+
+ if ('showCustomTime' in options) {
+ throw new Error('Option `showCustomTime` is deprecated. Create a custom time bar via timeline.addCustomTime(time [, id])');
+ }
+
+ // enable/disable autoResize
+ this._initAutoResize();
+ }
+
+ // propagate options to all components
+ this.components.forEach(function (component) {
+ return component.setOptions(options);
+ });
+
+ // enable/disable configure
+ if ('configure' in options) {
+ if (!this.configurator) {
+ this.configurator = this._createConfigurator();
+ }
+
+ this.configurator.setOptions(options.configure);
+
+ // collect the settings of all components, and pass them to the configuration system
+ var appliedOptions = util.deepExtend({}, this.options);
+ this.components.forEach(function (component) {
+ util.deepExtend(appliedOptions, component.options);
+ });
+ this.configurator.setModuleOptions({ global: appliedOptions });
+ }
+
+ this._redraw();
+ };
+
+ /**
+ * Returns true when the Timeline is active.
+ * @returns {boolean}
+ */
+ Core.prototype.isActive = function () {
+ return !this.activator || this.activator.active;
+ };
+
+ /**
+ * Destroy the Core, clean up all DOM elements and event listeners.
+ */
+ Core.prototype.destroy = function () {
+ // unbind datasets
+ this.setItems(null);
+ this.setGroups(null);
+
+ // remove all event listeners
+ this.off();
+
+ // stop checking for changed size
+ this._stopAutoResize();
+
+ // remove from DOM
+ if (this.dom.root.parentNode) {
+ this.dom.root.parentNode.removeChild(this.dom.root);
+ }
+ this.dom = null;
+
+ // remove Activator
+ if (this.activator) {
+ this.activator.destroy();
+ delete this.activator;
+ }
+
+ // cleanup hammer touch events
+ for (var event in this.listeners) {
+ if (this.listeners.hasOwnProperty(event)) {
+ delete this.listeners[event];
+ }
+ }
+ this.listeners = null;
+ this.hammer = null;
+
+ // give all components the opportunity to cleanup
+ this.components.forEach(function (component) {
+ return component.destroy();
+ });
+
+ this.body = null;
+ };
+
+ /**
+ * Set a custom time bar
+ * @param {Date} time
+ * @param {number} [id=undefined] Optional id of the custom time bar to be adjusted.
+ */
+ Core.prototype.setCustomTime = function (time, id) {
+ var customTimes = this.customTimes.filter(function (component) {
+ return id === component.options.id;
+ });
+
+ if (customTimes.length === 0) {
+ throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id));
+ }
+
+ if (customTimes.length > 0) {
+ customTimes[0].setCustomTime(time);
+ }
+ };
+
+ /**
+ * Retrieve the current custom time.
+ * @param {number} [id=undefined] Id of the custom time bar.
+ * @return {Date | undefined} customTime
+ */
+ Core.prototype.getCustomTime = function (id) {
+ var customTimes = this.customTimes.filter(function (component) {
+ return component.options.id === id;
+ });
+
+ if (customTimes.length === 0) {
+ throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id));
+ }
+ return customTimes[0].getCustomTime();
+ };
+
+ /**
+ * Set a custom title for the custom time bar.
+ * @param {String} [title] Custom title
+ * @param {number} [id=undefined] Id of the custom time bar.
+ */
+ Core.prototype.setCustomTimeTitle = function (title, id) {
+ var customTimes = this.customTimes.filter(function (component) {
+ return component.options.id === id;
+ });
+
+ if (customTimes.length === 0) {
+ throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id));
+ }
+ if (customTimes.length > 0) {
+ return customTimes[0].setCustomTitle(title);
+ }
+ };
+
+ /**
+ * Retrieve meta information from an event.
+ * Should be overridden by classes extending Core
+ * @param {Event} event
+ * @return {Object} An object with related information.
+ */
+ Core.prototype.getEventProperties = function (event) {
+ return { event: event };
+ };
+
+ /**
+ * Add custom vertical bar
+ * @param {Date | String | Number} [time] A Date, unix timestamp, or
+ * ISO date string. Time point where
+ * the new bar should be placed.
+ * If not provided, `new Date()` will
+ * be used.
+ * @param {Number | String} [id=undefined] Id of the new bar. Optional
+ * @return {Number | String} Returns the id of the new bar
+ */
+ Core.prototype.addCustomTime = function (time, id) {
+ var timestamp = time !== undefined ? util.convert(time, 'Date').valueOf() : new Date();
+
+ var exists = this.customTimes.some(function (customTime) {
+ return customTime.options.id === id;
+ });
+ if (exists) {
+ throw new Error('A custom time with id ' + (0, _stringify2['default'])(id) + ' already exists');
+ }
+
+ var customTime = new CustomTime(this.body, util.extend({}, this.options, {
+ time: timestamp,
+ id: id
+ }));
+
+ this.customTimes.push(customTime);
+ this.components.push(customTime);
+ this._redraw();
+
+ return id;
+ };
+
+ /**
+ * Remove previously added custom bar
+ * @param {int} id ID of the custom bar to be removed
+ * @return {boolean} True if the bar exists and is removed, false otherwise
+ */
+ Core.prototype.removeCustomTime = function (id) {
+ var customTimes = this.customTimes.filter(function (bar) {
+ return bar.options.id === id;
+ });
+
+ if (customTimes.length === 0) {
+ throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id));
+ }
+
+ customTimes.forEach(function (customTime) {
+ this.customTimes.splice(this.customTimes.indexOf(customTime), 1);
+ this.components.splice(this.components.indexOf(customTime), 1);
+ customTime.destroy();
+ }.bind(this));
+ };
+
+ /**
+ * Get the id's of the currently visible items.
+ * @returns {Array} The ids of the visible items
+ */
+ Core.prototype.getVisibleItems = function () {
+ return this.itemSet && this.itemSet.getVisibleItems() || [];
+ };
+
+ /**
+ * Set Core window such that it fits all items
+ * @param {Object} [options] Available options:
+ * `animation: boolean | {duration: number, easingFunction: string}`
+ * If true (default), the range is animated
+ * smoothly to the new window. An object can be
+ * provided to specify duration and easing function.
+ * Default duration is 500 ms, and default easing
+ * function is 'easeInOutQuad'.
+ */
+ Core.prototype.fit = function (options) {
+ var range = this.getDataRange();
+
+ // skip range set if there is no min and max date
+ if (range.min === null && range.max === null) {
+ return;
+ }
+
+ // apply a margin of 1% left and right of the data
+ var interval = range.max - range.min;
+ var min = new Date(range.min.valueOf() - interval * 0.01);
+ var max = new Date(range.max.valueOf() + interval * 0.01);
+ var animation = options && options.animation !== undefined ? options.animation : true;
+ this.range.setRange(min, max, animation);
+ };
+
+ /**
+ * Calculate the data range of the items start and end dates
+ * @returns {{min: Date | null, max: Date | null}}
+ * @protected
+ */
+ Core.prototype.getDataRange = function () {
+ // must be implemented by Timeline and Graph2d
+ throw new Error('Cannot invoke abstract method getDataRange');
+ };
+
+ /**
+ * Set the visible window. Both parameters are optional, you can change only
+ * start or only end. Syntax:
+ *
+ * TimeLine.setWindow(start, end)
+ * TimeLine.setWindow(start, end, options)
+ * TimeLine.setWindow(range)
+ *
+ * Where start and end can be a Date, number, or string, and range is an
+ * object with properties start and end.
+ *
+ * @param {Date | Number | String | Object} [start] Start date of visible window
+ * @param {Date | Number | String} [end] End date of visible window
+ * @param {Object} [options] Available options:
+ * `animation: boolean | {duration: number, easingFunction: string}`
+ * If true (default), the range is animated
+ * smoothly to the new window. An object can be
+ * provided to specify duration and easing function.
+ * Default duration is 500 ms, and default easing
+ * function is 'easeInOutQuad'.
+ */
+ Core.prototype.setWindow = function (start, end, options) {
+ var animation;
+ if (arguments.length == 1) {
+ var range = arguments[0];
+ animation = range.animation !== undefined ? range.animation : true;
+ this.range.setRange(range.start, range.end, animation);
+ } else {
+ animation = options && options.animation !== undefined ? options.animation : true;
+ this.range.setRange(start, end, animation);
+ }
+ };
+
+ /**
+ * Move the window such that given time is centered on screen.
+ * @param {Date | Number | String} time
+ * @param {Object} [options] Available options:
+ * `animation: boolean | {duration: number, easingFunction: string}`
+ * If true (default), the range is animated
+ * smoothly to the new window. An object can be
+ * provided to specify duration and easing function.
+ * Default duration is 500 ms, and default easing
+ * function is 'easeInOutQuad'.
+ */
+ Core.prototype.moveTo = function (time, options) {
+ var interval = this.range.end - this.range.start;
+ var t = util.convert(time, 'Date').valueOf();
+
+ var start = t - interval / 2;
+ var end = t + interval / 2;
+ var animation = options && options.animation !== undefined ? options.animation : true;
+
+ this.range.setRange(start, end, animation);
+ };
+
+ /**
+ * Get the visible window
+ * @return {{start: Date, end: Date}} Visible range
+ */
+ Core.prototype.getWindow = function () {
+ var range = this.range.getRange();
+ return {
+ start: new Date(range.start),
+ end: new Date(range.end)
+ };
+ };
+
+ /**
+ * Zoom in the window such that given time is centered on screen.
+ * @param {Number} percentage - must be between [0..1]
+ */
+ Core.prototype.zoomIn = function (percentage) {
+ if (!percentage || percentage < 0 || percentage > 1) return;
+ var range = this.getWindow();
+ var start = range.start.valueOf();
+ var end = range.end.valueOf();
+ var interval = end - start;
+ var newInterval = interval / (1 + percentage);
+ var distance = (interval - newInterval) / 2;
+ var newStart = start + distance;
+ var newEnd = end - distance;
+
+ this.setWindow({
+ start: newStart,
+ end: newEnd
+ });
+ };
+
+ /**
+ * Zoom out the window such that given time is centered on screen.
+ * @param {Number} percentage - must be between [0..1]
+ */
+ Core.prototype.zoomOut = function (percentage) {
+ if (!percentage || percentage < 0 || percentage > 1) return;
+ var range = this.getWindow();
+ var start = range.start.valueOf();
+ var end = range.end.valueOf();
+ var interval = end - start;
+ var newStart = start - interval * percentage / 2;
+ var newEnd = end + interval * percentage / 2;
+
+ this.setWindow({
+ start: newStart,
+ end: newEnd
+ });
+ };
+
+ /**
+ * Force a redraw. Can be overridden by implementations of Core
+ *
+ * Note: this function will be overridden on construction with a trottled version
+ */
+ Core.prototype.redraw = function () {
+ this._redraw();
+ };
+
+ /**
+ * Redraw for internal use. Redraws all components. See also the public
+ * method redraw.
+ * @protected
+ */
+ Core.prototype._redraw = function () {
+ this.redrawCount++;
+ var resized = false;
+ var options = this.options;
+ var props = this.props;
+ var dom = this.dom;
+
+ if (!dom || !dom.container || dom.root.offsetWidth == 0) return; // when destroyed, or invisible
+
+ DateUtil.updateHiddenDates(this.options.moment, this.body, this.options.hiddenDates);
+
+ // update class names
+ if (options.orientation == 'top') {
+ util.addClassName(dom.root, 'vis-top');
+ util.removeClassName(dom.root, 'vis-bottom');
+ } else {
+ util.removeClassName(dom.root, 'vis-top');
+ util.addClassName(dom.root, 'vis-bottom');
+ }
+
+ // update root width and height options
+ dom.root.style.maxHeight = util.option.asSize(options.maxHeight, '');
+ dom.root.style.minHeight = util.option.asSize(options.minHeight, '');
+ dom.root.style.width = util.option.asSize(options.width, '');
+
+ // calculate border widths
+ props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2;
+ props.border.right = props.border.left;
+ props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2;
+ props.border.bottom = props.border.top;
+ props.borderRootHeight = dom.root.offsetHeight - dom.root.clientHeight;
+ props.borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth;
+
+ // workaround for a bug in IE: the clientWidth of an element with
+ // a height:0px and overflow:hidden is not calculated and always has value 0
+ if (dom.centerContainer.clientHeight === 0) {
+ props.border.left = props.border.top;
+ props.border.right = props.border.left;
+ }
+ if (dom.root.clientHeight === 0) {
+ props.borderRootWidth = props.borderRootHeight;
+ }
+
+ // calculate the heights. If any of the side panels is empty, we set the height to
+ // minus the border width, such that the border will be invisible
+ props.center.height = dom.center.offsetHeight;
+ props.left.height = dom.left.offsetHeight;
+ props.right.height = dom.right.offsetHeight;
+ props.top.height = dom.top.clientHeight || -props.border.top;
+ props.bottom.height = dom.bottom.clientHeight || -props.border.bottom;
+
+ // TODO: compensate borders when any of the panels is empty.
+
+ // apply auto height
+ // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM)
+ var contentHeight = Math.max(props.left.height, props.center.height, props.right.height);
+ var autoHeight = props.top.height + contentHeight + props.bottom.height + props.borderRootHeight + props.border.top + props.border.bottom;
+ dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px');
+
+ // calculate heights of the content panels
+ props.root.height = dom.root.offsetHeight;
+ props.background.height = props.root.height - props.borderRootHeight;
+ var containerHeight = props.root.height - props.top.height - props.bottom.height - props.borderRootHeight;
+ props.centerContainer.height = containerHeight;
+ props.leftContainer.height = containerHeight;
+ props.rightContainer.height = props.leftContainer.height;
+
+ // calculate the widths of the panels
+ props.root.width = dom.root.offsetWidth;
+ props.background.width = props.root.width - props.borderRootWidth;
+
+ if (!this.initialDrawDone) {
+ props.scrollbarWidth = util.getScrollBarWidth();
+ }
+
+ if (options.verticalScroll) {
+ if (options.rtl) {
+ props.left.width = dom.leftContainer.clientWidth || -props.border.left;
+ props.right.width = dom.rightContainer.clientWidth + props.scrollbarWidth || -props.border.right;
+ } else {
+ props.left.width = dom.leftContainer.clientWidth + props.scrollbarWidth || -props.border.left;
+ props.right.width = dom.rightContainer.clientWidth || -props.border.right;
+ }
+ } else {
+ props.left.width = dom.leftContainer.clientWidth || -props.border.left;
+ props.right.width = dom.rightContainer.clientWidth || -props.border.right;
+ }
+
+ this._setDOM();
+
+ // update the scrollTop, feasible range for the offset can be changed
+ // when the height of the Core or of the contents of the center changed
+ var offset = this._updateScrollTop();
+
+ // reposition the scrollable contents
+ if (options.orientation.item != 'top') {
+ offset += Math.max(props.centerContainer.height - props.center.height - props.border.top - props.border.bottom, 0);
+ }
+ dom.center.style.top = offset + 'px';
+
+ // show shadows when vertical scrolling is available
+ var visibilityTop = props.scrollTop == 0 ? 'hidden' : '';
+ var visibilityBottom = props.scrollTop == props.scrollTopMin ? 'hidden' : '';
+ dom.shadowTop.style.visibility = visibilityTop;
+ dom.shadowBottom.style.visibility = visibilityBottom;
+ dom.shadowTopLeft.style.visibility = visibilityTop;
+ dom.shadowBottomLeft.style.visibility = visibilityBottom;
+ dom.shadowTopRight.style.visibility = visibilityTop;
+ dom.shadowBottomRight.style.visibility = visibilityBottom;
+
+ if (options.verticalScroll) {
+ dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll';
+ dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll';
+
+ dom.shadowTopRight.style.visibility = "hidden";
+ dom.shadowBottomRight.style.visibility = "hidden";
+ dom.shadowTopLeft.style.visibility = "hidden";
+ dom.shadowBottomLeft.style.visibility = "hidden";
+
+ dom.left.style.top = '0px';
+ dom.right.style.top = '0px';
+ }
+
+ if (!options.verticalScroll || props.center.height < props.centerContainer.height) {
+ dom.left.style.top = offset + 'px';
+ dom.right.style.top = offset + 'px';
+ dom.rightContainer.className = dom.rightContainer.className.replace(new RegExp('(?:^|\\s)' + 'vis-vertical-scroll' + '(?:\\s|$)'), ' ');
+ dom.leftContainer.className = dom.leftContainer.className.replace(new RegExp('(?:^|\\s)' + 'vis-vertical-scroll' + '(?:\\s|$)'), ' ');
+ props.left.width = dom.leftContainer.clientWidth || -props.border.left;
+ props.right.width = dom.rightContainer.clientWidth || -props.border.right;
+ this._setDOM();
+ }
+
+ // enable/disable vertical panning
+ var contentsOverflow = props.center.height > props.centerContainer.height;
+ this.hammer.get('pan').set({
+ direction: contentsOverflow ? Hammer.DIRECTION_ALL : Hammer.DIRECTION_HORIZONTAL
+ });
+
+ // redraw all components
+ this.components.forEach(function (component) {
+ resized = component.redraw() || resized;
+ });
+ var MAX_REDRAW = 5;
+ if (resized) {
+ if (this.redrawCount < MAX_REDRAW) {
+ this.body.emitter.emit('_change');
+ return;
+ } else {
+ console.log('WARNING: infinite loop in redraw?');
+ }
+ } else {
+ this.redrawCount = 0;
+ }
+ this.initialDrawDone = true;
+
+ //Emit public 'changed' event for UI updates, see issue #1592
+ this.body.emitter.emit("changed");
+ };
+
+ Core.prototype._setDOM = function () {
+ var props = this.props;
+ var dom = this.dom;
+
+ props.leftContainer.width = props.left.width;
+ props.rightContainer.width = props.right.width;
+ var centerWidth = props.root.width - props.left.width - props.right.width - props.borderRootWidth;
+ props.center.width = centerWidth;
+ props.centerContainer.width = centerWidth;
+ props.top.width = centerWidth;
+ props.bottom.width = centerWidth;
+
+ // resize the panels
+ dom.background.style.height = props.background.height + 'px';
+ dom.backgroundVertical.style.height = props.background.height + 'px';
+ dom.backgroundHorizontal.style.height = props.centerContainer.height + 'px';
+ dom.centerContainer.style.height = props.centerContainer.height + 'px';
+ dom.leftContainer.style.height = props.leftContainer.height + 'px';
+ dom.rightContainer.style.height = props.rightContainer.height + 'px';
+
+ dom.background.style.width = props.background.width + 'px';
+ dom.backgroundVertical.style.width = props.centerContainer.width + 'px';
+ dom.backgroundHorizontal.style.width = props.background.width + 'px';
+ dom.centerContainer.style.width = props.center.width + 'px';
+ dom.top.style.width = props.top.width + 'px';
+ dom.bottom.style.width = props.bottom.width + 'px';
+
+ // reposition the panels
+ dom.background.style.left = '0';
+ dom.background.style.top = '0';
+ dom.backgroundVertical.style.left = props.left.width + props.border.left + 'px';
+ dom.backgroundVertical.style.top = '0';
+ dom.backgroundHorizontal.style.left = '0';
+ dom.backgroundHorizontal.style.top = props.top.height + 'px';
+ dom.centerContainer.style.left = props.left.width + 'px';
+ dom.centerContainer.style.top = props.top.height + 'px';
+ dom.leftContainer.style.left = '0';
+ dom.leftContainer.style.top = props.top.height + 'px';
+ dom.rightContainer.style.left = props.left.width + props.center.width + 'px';
+ dom.rightContainer.style.top = props.top.height + 'px';
+ dom.top.style.left = props.left.width + 'px';
+ dom.top.style.top = '0';
+ dom.bottom.style.left = props.left.width + 'px';
+ dom.bottom.style.top = props.top.height + props.centerContainer.height + 'px';
+ dom.center.style.left = '0';
+ dom.left.style.left = '0';
+ dom.right.style.left = '0';
+ };
+
+ // TODO: deprecated since version 1.1.0, remove some day
+ Core.prototype.repaint = function () {
+ throw new Error('Function repaint is deprecated. Use redraw instead.');
+ };
+
+ /**
+ * Set a current time. This can be used for example to ensure that a client's
+ * time is synchronized with a shared server time.
+ * Only applicable when option `showCurrentTime` is true.
+ * @param {Date | String | Number} time A Date, unix timestamp, or
+ * ISO date string.
+ */
+ Core.prototype.setCurrentTime = function (time) {
+ if (!this.currentTime) {
+ throw new Error('Option showCurrentTime must be true');
+ }
+
+ this.currentTime.setCurrentTime(time);
+ };
+
+ /**
+ * Get the current time.
+ * Only applicable when option `showCurrentTime` is true.
+ * @return {Date} Returns the current time.
+ */
+ Core.prototype.getCurrentTime = function () {
+ if (!this.currentTime) {
+ throw new Error('Option showCurrentTime must be true');
+ }
+
+ return this.currentTime.getCurrentTime();
+ };
+
+ /**
+ * Convert a position on screen (pixels) to a datetime
+ * @param {int} x Position on the screen in pixels
+ * @return {Date} time The datetime the corresponds with given position x
+ * @protected
+ */
+ // TODO: move this function to Range
+ Core.prototype._toTime = function (x) {
+ return DateUtil.toTime(this, x, this.props.center.width);
+ };
+
+ /**
+ * Convert a position on the global screen (pixels) to a datetime
+ * @param {int} x Position on the screen in pixels
+ * @return {Date} time The datetime the corresponds with given position x
+ * @protected
+ */
+ // TODO: move this function to Range
+ Core.prototype._toGlobalTime = function (x) {
+ return DateUtil.toTime(this, x, this.props.root.width);
+ //var conversion = this.range.conversion(this.props.root.width);
+ //return new Date(x / conversion.scale + conversion.offset);
+ };
+
+ /**
+ * Convert a datetime (Date object) into a position on the screen
+ * @param {Date} time A date
+ * @return {int} x The position on the screen in pixels which corresponds
+ * with the given date.
+ * @protected
+ */
+ // TODO: move this function to Range
+ Core.prototype._toScreen = function (time) {
+ return DateUtil.toScreen(this, time, this.props.center.width);
+ };
+
+ /**
+ * Convert a datetime (Date object) into a position on the root
+ * This is used to get the pixel density estimate for the screen, not the center panel
+ * @param {Date} time A date
+ * @return {int} x The position on root in pixels which corresponds
+ * with the given date.
+ * @protected
+ */
+ // TODO: move this function to Range
+ Core.prototype._toGlobalScreen = function (time) {
+ return DateUtil.toScreen(this, time, this.props.root.width);
+ //var conversion = this.range.conversion(this.props.root.width);
+ //return (time.valueOf() - conversion.offset) * conversion.scale;
+ };
+
+ /**
+ * Initialize watching when option autoResize is true
+ * @private
+ */
+ Core.prototype._initAutoResize = function () {
+ if (this.options.autoResize == true) {
+ this._startAutoResize();
+ } else {
+ this._stopAutoResize();
+ }
+ };
+
+ /**
+ * Watch for changes in the size of the container. On resize, the Panel will
+ * automatically redraw itself.
+ * @private
+ */
+ Core.prototype._startAutoResize = function () {
+ var me = this;
+
+ this._stopAutoResize();
+
+ this._onResize = function () {
+ if (me.options.autoResize != true) {
+ // stop watching when the option autoResize is changed to false
+ me._stopAutoResize();
+ return;
+ }
+
+ if (me.dom.root) {
+ // check whether the frame is resized
+ // Note: we compare offsetWidth here, not clientWidth. For some reason,
+ // IE does not restore the clientWidth from 0 to the actual width after
+ // changing the timeline's container display style from none to visible
+ if (me.dom.root.offsetWidth != me.props.lastWidth || me.dom.root.offsetHeight != me.props.lastHeight) {
+ me.props.lastWidth = me.dom.root.offsetWidth;
+ me.props.lastHeight = me.dom.root.offsetHeight;
+ me.props.scrollbarWidth = util.getScrollBarWidth();
+
+ me.body.emitter.emit('_change');
+ }
+ }
+ };
+
+ // add event listener to window resize
+ util.addEventListener(window, 'resize', this._onResize);
+
+ //Prevent initial unnecessary redraw
+ if (me.dom.root) {
+ me.props.lastWidth = me.dom.root.offsetWidth;
+ me.props.lastHeight = me.dom.root.offsetHeight;
+ }
+
+ this.watchTimer = setInterval(this._onResize, 1000);
+ };
+
+ /**
+ * Stop watching for a resize of the frame.
+ * @private
+ */
+ Core.prototype._stopAutoResize = function () {
+ if (this.watchTimer) {
+ clearInterval(this.watchTimer);
+ this.watchTimer = undefined;
+ }
+
+ // remove event listener on window.resize
+ if (this._onResize) {
+ util.removeEventListener(window, 'resize', this._onResize);
+ this._onResize = null;
+ }
+ };
+
+ /**
+ * Start moving the timeline vertically
+ * @param {Event} event
+ * @private
+ */
+ Core.prototype._onTouch = function (event) {
+ this.touch.allowDragging = true;
+ this.touch.initialScrollTop = this.props.scrollTop;
+ };
+
+ /**
+ * Start moving the timeline vertically
+ * @param {Event} event
+ * @private
+ */
+ Core.prototype._onPinch = function (event) {
+ this.touch.allowDragging = false;
+ };
+
+ /**
+ * Move the timeline vertically
+ * @param {Event} event
+ * @private
+ */
+ Core.prototype._onDrag = function (event) {
+ if (!event) return;
+ // refuse to drag when we where pinching to prevent the timeline make a jump
+ // when releasing the fingers in opposite order from the touch screen
+ if (!this.touch.allowDragging) return;
+
+ var delta = event.deltaY;
+
+ var oldScrollTop = this._getScrollTop();
+ var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta);
+
+ if (this.options.verticalScroll) {
+ this.dom.left.parentNode.scrollTop = -this.props.scrollTop;
+ this.dom.right.parentNode.scrollTop = -this.props.scrollTop;
+ }
+
+ if (newScrollTop != oldScrollTop) {
+ this.emit("verticalDrag");
+ }
+ };
+
+ /**
+ * Apply a scrollTop
+ * @param {Number} scrollTop
+ * @returns {Number} scrollTop Returns the applied scrollTop
+ * @private
+ */
+ Core.prototype._setScrollTop = function (scrollTop) {
+ this.props.scrollTop = scrollTop;
+ this._updateScrollTop();
+ return this.props.scrollTop;
+ };
+
+ /**
+ * Update the current scrollTop when the height of the containers has been changed
+ * @returns {Number} scrollTop Returns the applied scrollTop
+ * @private
+ */
+ Core.prototype._updateScrollTop = function () {
+ // recalculate the scrollTopMin
+ var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero
+ if (scrollTopMin != this.props.scrollTopMin) {
+ // in case of bottom orientation, change the scrollTop such that the contents
+ // do not move relative to the time axis at the bottom
+ if (this.options.orientation.item != 'top') {
+ this.props.scrollTop += scrollTopMin - this.props.scrollTopMin;
+ }
+ this.props.scrollTopMin = scrollTopMin;
+ }
+
+ // limit the scrollTop to the feasible scroll range
+ if (this.props.scrollTop > 0) this.props.scrollTop = 0;
+ if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin;
+
+ if (this.options.verticalScroll) {
+ this.dom.left.parentNode.scrollTop = -this.props.scrollTop;
+ this.dom.right.parentNode.scrollTop = -this.props.scrollTop;
+ }
+
+ return this.props.scrollTop;
+ };
+
+ /**
+ * Get the current scrollTop
+ * @returns {number} scrollTop
+ * @private
+ */
+ Core.prototype._getScrollTop = function () {
+ return this.props.scrollTop;
+ };
+
+ /**
+ * Load a configurator
+ * @return {Object}
+ * @private
+ */
+ Core.prototype._createConfigurator = function () {
+ throw new Error('Cannot invoke abstract method _createConfigurator');
+ };
+
+ module.exports = Core;
+
+/***/ },
+/* 127 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _create = __webpack_require__(55);
+
+ var _create2 = _interopRequireDefault(_create);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _Popup = __webpack_require__(128);
+
+ var _Popup2 = _interopRequireDefault(_Popup);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Hammer = __webpack_require__(108);
+ var util = __webpack_require__(1);
+ var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+ var TimeStep = __webpack_require__(129);
+ var Component = __webpack_require__(124);
+ var Group = __webpack_require__(130);
+ var BackgroundGroup = __webpack_require__(134);
+ var BoxItem = __webpack_require__(135);
+ var PointItem = __webpack_require__(136);
+ var RangeItem = __webpack_require__(132);
+ var BackgroundItem = __webpack_require__(137);
+
+
+ var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items
+ var BACKGROUND = '__background__'; // reserved group id for background items without group
+
+ /**
+ * An ItemSet holds a set of items and ranges which can be displayed in a
+ * range. The width is determined by the parent of the ItemSet, and the height
+ * is determined by the size of the items.
+ * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body
+ * @param {Object} [options] See ItemSet.setOptions for the available options.
+ * @constructor ItemSet
+ * @extends Component
+ */
+ function ItemSet(body, options) {
+ this.body = body;
+ this.defaultOptions = {
+ type: null, // 'box', 'point', 'range', 'background'
+ orientation: {
+ item: 'bottom' // item orientation: 'top' or 'bottom'
+ },
+ align: 'auto', // alignment of box items
+ stack: true,
+ stackSubgroups: true,
+ groupOrderSwap: function groupOrderSwap(fromGroup, toGroup, groups) {
+ var targetOrder = toGroup.order;
+ toGroup.order = fromGroup.order;
+ fromGroup.order = targetOrder;
+ },
+ groupOrder: 'order',
+
+ selectable: true,
+ multiselect: false,
+ itemsAlwaysDraggable: false,
+
+ editable: {
+ updateTime: false,
+ updateGroup: false,
+ add: false,
+ remove: false,
+ overrideItems: false
+ },
+
+ groupEditable: {
+ order: false,
+ add: false,
+ remove: false
+ },
+
+ snap: TimeStep.snap,
+
+ onAdd: function onAdd(item, callback) {
+ callback(item);
+ },
+ onUpdate: function onUpdate(item, callback) {
+ callback(item);
+ },
+ onMove: function onMove(item, callback) {
+ callback(item);
+ },
+ onRemove: function onRemove(item, callback) {
+ callback(item);
+ },
+ onMoving: function onMoving(item, callback) {
+ callback(item);
+ },
+ onAddGroup: function onAddGroup(item, callback) {
+ callback(item);
+ },
+ onMoveGroup: function onMoveGroup(item, callback) {
+ callback(item);
+ },
+ onRemoveGroup: function onRemoveGroup(item, callback) {
+ callback(item);
+ },
+
+ margin: {
+ item: {
+ horizontal: 10,
+ vertical: 10
+ },
+ axis: 20
+ },
+
+ tooltip: {
+ followMouse: false,
+ overflowMethod: 'flip'
+ },
+
+ tooltipOnItemUpdateTime: false
+ };
+
+ // options is shared by this ItemSet and all its items
+ this.options = util.extend({}, this.defaultOptions);
+ this.options.rtl = options.rtl;
+
+ // options for getting items from the DataSet with the correct type
+ this.itemOptions = {
+ type: { start: 'Date', end: 'Date' }
+ };
+
+ this.conversion = {
+ toScreen: body.util.toScreen,
+ toTime: body.util.toTime
+ };
+ this.dom = {};
+ this.props = {};
+ this.hammer = null;
+
+ var me = this;
+ this.itemsData = null; // DataSet
+ this.groupsData = null; // DataSet
+
+ // listeners for the DataSet of the items
+ this.itemListeners = {
+ 'add': function add(event, params, senderId) {
+ me._onAdd(params.items);
+ },
+ 'update': function update(event, params, senderId) {
+ me._onUpdate(params.items);
+ },
+ 'remove': function remove(event, params, senderId) {
+ me._onRemove(params.items);
+ }
+ };
+
+ // listeners for the DataSet of the groups
+ this.groupListeners = {
+ 'add': function add(event, params, senderId) {
+ me._onAddGroups(params.items);
+ },
+ 'update': function update(event, params, senderId) {
+ me._onUpdateGroups(params.items);
+ },
+ 'remove': function remove(event, params, senderId) {
+ me._onRemoveGroups(params.items);
+ }
+ };
+
+ this.items = {}; // object with an Item for every data item
+ this.groups = {}; // Group object for every group
+ this.groupIds = [];
+
+ this.selection = []; // list with the ids of all selected nodes
+ this.stackDirty = true; // if true, all items will be restacked on next redraw
+
+ this.touchParams = {}; // stores properties while dragging
+ this.groupTouchParams = {};
+ // create the HTML DOM
+
+ this._create();
+
+ this.setOptions(options);
+ }
+
+ ItemSet.prototype = new Component();
+
+ // available item types will be registered here
+ ItemSet.types = {
+ background: BackgroundItem,
+ box: BoxItem,
+ range: RangeItem,
+ point: PointItem
+ };
+
+ /**
+ * Create the HTML DOM for the ItemSet
+ */
+ ItemSet.prototype._create = function () {
+ var frame = document.createElement('div');
+ frame.className = 'vis-itemset';
+ frame['timeline-itemset'] = this;
+ this.dom.frame = frame;
+
+ // create background panel
+ var background = document.createElement('div');
+ background.className = 'vis-background';
+ frame.appendChild(background);
+ this.dom.background = background;
+
+ // create foreground panel
+ var foreground = document.createElement('div');
+ foreground.className = 'vis-foreground';
+ frame.appendChild(foreground);
+ this.dom.foreground = foreground;
+
+ // create axis panel
+ var axis = document.createElement('div');
+ axis.className = 'vis-axis';
+ this.dom.axis = axis;
+
+ // create labelset
+ var labelSet = document.createElement('div');
+ labelSet.className = 'vis-labelset';
+ this.dom.labelSet = labelSet;
+
+ // create ungrouped Group
+ this._updateUngrouped();
+
+ // create background Group
+ var backgroundGroup = new BackgroundGroup(BACKGROUND, null, this);
+ backgroundGroup.show();
+ this.groups[BACKGROUND] = backgroundGroup;
+
+ // attach event listeners
+ // Note: we bind to the centerContainer for the case where the height
+ // of the center container is larger than of the ItemSet, so we
+ // can click in the empty area to create a new item or deselect an item.
+ this.hammer = new Hammer(this.body.dom.centerContainer);
+
+ // drag items when selected
+ this.hammer.on('hammer.input', function (event) {
+ if (event.isFirst) {
+ this._onTouch(event);
+ }
+ }.bind(this));
+ this.hammer.on('panstart', this._onDragStart.bind(this));
+ this.hammer.on('panmove', this._onDrag.bind(this));
+ this.hammer.on('panend', this._onDragEnd.bind(this));
+ this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL });
+
+ // single select (or unselect) when tapping an item
+ this.hammer.on('tap', this._onSelectItem.bind(this));
+
+ // multi select when holding mouse/touch, or on ctrl+click
+ this.hammer.on('press', this._onMultiSelectItem.bind(this));
+
+ // add item on doubletap
+ this.hammer.on('doubletap', this._onAddItem.bind(this));
+
+ if (this.options.rtl) {
+ this.groupHammer = new Hammer(this.body.dom.rightContainer);
+ } else {
+ this.groupHammer = new Hammer(this.body.dom.leftContainer);
+ }
+
+ this.groupHammer.on('tap', this._onGroupClick.bind(this));
+ this.groupHammer.on('panstart', this._onGroupDragStart.bind(this));
+ this.groupHammer.on('panmove', this._onGroupDrag.bind(this));
+ this.groupHammer.on('panend', this._onGroupDragEnd.bind(this));
+ this.groupHammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_VERTICAL });
+
+ this.body.dom.centerContainer.addEventListener('mouseover', this._onMouseOver.bind(this));
+ this.body.dom.centerContainer.addEventListener('mouseout', this._onMouseOut.bind(this));
+ this.body.dom.centerContainer.addEventListener('mousemove', this._onMouseMove.bind(this));
+ // right-click on timeline
+ this.body.dom.centerContainer.addEventListener('contextmenu', this._onDragEnd.bind(this));
+
+ this.body.dom.centerContainer.addEventListener('mousewheel', this._onMouseWheel.bind(this));
+
+ // attach to the DOM
+ this.show();
+ };
+
+ /**
+ * Set options for the ItemSet. Existing options will be extended/overwritten.
+ * @param {Object} [options] The following options are available:
+ * {String} type
+ * Default type for the items. Choose from 'box'
+ * (default), 'point', 'range', or 'background'.
+ * The default style can be overwritten by
+ * individual items.
+ * {String} align
+ * Alignment for the items, only applicable for
+ * BoxItem. Choose 'center' (default), 'left', or
+ * 'right'.
+ * {String} orientation.item
+ * Orientation of the item set. Choose 'top' or
+ * 'bottom' (default).
+ * {Function} groupOrder
+ * A sorting function for ordering groups
+ * {Boolean} stack
+ * If true (default), items will be stacked on
+ * top of each other.
+ * {Number} margin.axis
+ * Margin between the axis and the items in pixels.
+ * Default is 20.
+ * {Number} margin.item.horizontal
+ * Horizontal margin between items in pixels.
+ * Default is 10.
+ * {Number} margin.item.vertical
+ * Vertical Margin between items in pixels.
+ * Default is 10.
+ * {Number} margin.item
+ * Margin between items in pixels in both horizontal
+ * and vertical direction. Default is 10.
+ * {Number} margin
+ * Set margin for both axis and items in pixels.
+ * {Boolean} selectable
+ * If true (default), items can be selected.
+ * {Boolean} multiselect
+ * If true, multiple items can be selected.
+ * False by default.
+ * {Boolean} editable
+ * Set all editable options to true or false
+ * {Boolean} editable.updateTime
+ * Allow dragging an item to an other moment in time
+ * {Boolean} editable.updateGroup
+ * Allow dragging an item to an other group
+ * {Boolean} editable.add
+ * Allow creating new items on double tap
+ * {Boolean} editable.remove
+ * Allow removing items by clicking the delete button
+ * top right of a selected item.
+ * {Function(item: Item, callback: Function)} onAdd
+ * Callback function triggered when an item is about to be added:
+ * when the user double taps an empty space in the Timeline.
+ * {Function(item: Item, callback: Function)} onUpdate
+ * Callback function fired when an item is about to be updated.
+ * This function typically has to show a dialog where the user
+ * change the item. If not implemented, nothing happens.
+ * {Function(item: Item, callback: Function)} onMove
+ * Fired when an item has been moved. If not implemented,
+ * the move action will be accepted.
+ * {Function(item: Item, callback: Function)} onRemove
+ * Fired when an item is about to be deleted.
+ * If not implemented, the item will be always removed.
+ */
+ ItemSet.prototype.setOptions = function (options) {
+ if (options) {
+ // copy all options that we know
+ var fields = ['type', 'rtl', 'align', 'order', 'stack', 'stackSubgroups', 'selectable', 'multiselect', 'itemsAlwaysDraggable', 'multiselectPerGroup', 'groupOrder', 'dataAttributes', 'template', 'groupTemplate', 'visibleFrameTemplate', 'hide', 'snap', 'groupOrderSwap', 'tooltip', 'tooltipOnItemUpdateTime'];
+ util.selectiveExtend(fields, this.options, options);
+
+ if ('orientation' in options) {
+ if (typeof options.orientation === 'string') {
+ this.options.orientation.item = options.orientation === 'top' ? 'top' : 'bottom';
+ } else if ((0, _typeof3['default'])(options.orientation) === 'object' && 'item' in options.orientation) {
+ this.options.orientation.item = options.orientation.item;
+ }
+ }
+
+ if ('margin' in options) {
+ if (typeof options.margin === 'number') {
+ this.options.margin.axis = options.margin;
+ this.options.margin.item.horizontal = options.margin;
+ this.options.margin.item.vertical = options.margin;
+ } else if ((0, _typeof3['default'])(options.margin) === 'object') {
+ util.selectiveExtend(['axis'], this.options.margin, options.margin);
+ if ('item' in options.margin) {
+ if (typeof options.margin.item === 'number') {
+ this.options.margin.item.horizontal = options.margin.item;
+ this.options.margin.item.vertical = options.margin.item;
+ } else if ((0, _typeof3['default'])(options.margin.item) === 'object') {
+ util.selectiveExtend(['horizontal', 'vertical'], this.options.margin.item, options.margin.item);
+ }
+ }
+ }
+ }
+
+ if ('editable' in options) {
+ if (typeof options.editable === 'boolean') {
+ this.options.editable.updateTime = options.editable;
+ this.options.editable.updateGroup = options.editable;
+ this.options.editable.add = options.editable;
+ this.options.editable.remove = options.editable;
+ this.options.editable.overrideItems = false;
+ } else if ((0, _typeof3['default'])(options.editable) === 'object') {
+ util.selectiveExtend(['updateTime', 'updateGroup', 'add', 'remove', 'overrideItems'], this.options.editable, options.editable);
+ }
+ }
+
+ if ('groupEditable' in options) {
+ if (typeof options.groupEditable === 'boolean') {
+ this.options.groupEditable.order = options.groupEditable;
+ this.options.groupEditable.add = options.groupEditable;
+ this.options.groupEditable.remove = options.groupEditable;
+ } else if ((0, _typeof3['default'])(options.groupEditable) === 'object') {
+ util.selectiveExtend(['order', 'add', 'remove'], this.options.groupEditable, options.groupEditable);
+ }
+ }
+
+ // callback functions
+ var addCallback = function (name) {
+ var fn = options[name];
+ if (fn) {
+ if (!(fn instanceof Function)) {
+ throw new Error('option ' + name + ' must be a function ' + name + '(item, callback)');
+ }
+ this.options[name] = fn;
+ }
+ }.bind(this);
+ ['onAdd', 'onUpdate', 'onRemove', 'onMove', 'onMoving', 'onAddGroup', 'onMoveGroup', 'onRemoveGroup'].forEach(addCallback);
+
+ // force the itemSet to refresh: options like orientation and margins may be changed
+ this.markDirty();
+ }
+ };
+
+ /**
+ * Mark the ItemSet dirty so it will refresh everything with next redraw.
+ * Optionally, all items can be marked as dirty and be refreshed.
+ * @param {{refreshItems: boolean}} [options]
+ */
+ ItemSet.prototype.markDirty = function (options) {
+ this.groupIds = [];
+ this.stackDirty = true;
+
+ if (options && options.refreshItems) {
+ util.forEach(this.items, function (item) {
+ item.dirty = true;
+ if (item.displayed) item.redraw();
+ });
+ }
+ };
+
+ /**
+ * Destroy the ItemSet
+ */
+ ItemSet.prototype.destroy = function () {
+ this.hide();
+ this.setItems(null);
+ this.setGroups(null);
+
+ this.hammer = null;
+
+ this.body = null;
+ this.conversion = null;
+ };
+
+ /**
+ * Hide the component from the DOM
+ */
+ ItemSet.prototype.hide = function () {
+ // remove the frame containing the items
+ if (this.dom.frame.parentNode) {
+ this.dom.frame.parentNode.removeChild(this.dom.frame);
+ }
+
+ // remove the axis with dots
+ if (this.dom.axis.parentNode) {
+ this.dom.axis.parentNode.removeChild(this.dom.axis);
+ }
+
+ // remove the labelset containing all group labels
+ if (this.dom.labelSet.parentNode) {
+ this.dom.labelSet.parentNode.removeChild(this.dom.labelSet);
+ }
+ };
+
+ /**
+ * Show the component in the DOM (when not already visible).
+ * @return {Boolean} changed
+ */
+ ItemSet.prototype.show = function () {
+ // show frame containing the items
+ if (!this.dom.frame.parentNode) {
+ this.body.dom.center.appendChild(this.dom.frame);
+ }
+
+ // show axis with dots
+ if (!this.dom.axis.parentNode) {
+ this.body.dom.backgroundVertical.appendChild(this.dom.axis);
+ }
+
+ // show labelset containing labels
+ if (!this.dom.labelSet.parentNode) {
+ if (this.options.rtl) {
+ this.body.dom.right.appendChild(this.dom.labelSet);
+ } else {
+ this.body.dom.left.appendChild(this.dom.labelSet);
+ }
+ }
+ };
+
+ /**
+ * Set selected items by their id. Replaces the current selection
+ * Unknown id's are silently ignored.
+ * @param {string[] | string} [ids] An array with zero or more id's of the items to be
+ * selected, or a single item id. If ids is undefined
+ * or an empty array, all items will be unselected.
+ */
+ ItemSet.prototype.setSelection = function (ids) {
+ var i, ii, id, item;
+
+ if (ids == undefined) ids = [];
+ if (!Array.isArray(ids)) ids = [ids];
+
+ // unselect currently selected items
+ for (i = 0, ii = this.selection.length; i < ii; i++) {
+ id = this.selection[i];
+ item = this.items[id];
+ if (item) item.unselect();
+ }
+
+ // select items
+ this.selection = [];
+ for (i = 0, ii = ids.length; i < ii; i++) {
+ id = ids[i];
+ item = this.items[id];
+ if (item) {
+ this.selection.push(id);
+ item.select();
+ }
+ }
+ };
+
+ /**
+ * Get the selected items by their id
+ * @return {Array} ids The ids of the selected items
+ */
+ ItemSet.prototype.getSelection = function () {
+ return this.selection.concat([]);
+ };
+
+ /**
+ * Get the id's of the currently visible items.
+ * @returns {Array} The ids of the visible items
+ */
+ ItemSet.prototype.getVisibleItems = function () {
+ var range = this.body.range.getRange();
+
+ if (this.options.rtl) {
+ var right = this.body.util.toScreen(range.start);
+ var left = this.body.util.toScreen(range.end);
+ } else {
+ var left = this.body.util.toScreen(range.start);
+ var right = this.body.util.toScreen(range.end);
+ }
+
+ var ids = [];
+ for (var groupId in this.groups) {
+ if (this.groups.hasOwnProperty(groupId)) {
+ var group = this.groups[groupId];
+ var rawVisibleItems = group.visibleItems;
+
+ // filter the "raw" set with visibleItems into a set which is really
+ // visible by pixels
+ for (var i = 0; i < rawVisibleItems.length; i++) {
+ var item = rawVisibleItems[i];
+ // TODO: also check whether visible vertically
+ if (this.options.rtl) {
+ if (item.right < left && item.right + item.width > right) {
+ ids.push(item.id);
+ }
+ } else {
+ if (item.left < right && item.left + item.width > left) {
+ ids.push(item.id);
+ }
+ }
+ }
+ }
+ }
+
+ return ids;
+ };
+
+ /**
+ * Deselect a selected item
+ * @param {String | Number} id
+ * @private
+ */
+ ItemSet.prototype._deselect = function (id) {
+ var selection = this.selection;
+ for (var i = 0, ii = selection.length; i < ii; i++) {
+ if (selection[i] == id) {
+ // non-strict comparison!
+ selection.splice(i, 1);
+ break;
+ }
+ }
+ };
+
+ /**
+ * Repaint the component
+ * @return {boolean} Returns true if the component is resized
+ */
+ ItemSet.prototype.redraw = function () {
+ var margin = this.options.margin,
+ range = this.body.range,
+ asSize = util.option.asSize,
+ options = this.options,
+ orientation = options.orientation.item,
+ resized = false,
+ frame = this.dom.frame;
+
+ // recalculate absolute position (before redrawing groups)
+ this.props.top = this.body.domProps.top.height + this.body.domProps.border.top;
+
+ if (this.options.rtl) {
+ this.props.right = this.body.domProps.right.width + this.body.domProps.border.right;
+ } else {
+ this.props.left = this.body.domProps.left.width + this.body.domProps.border.left;
+ }
+
+ // update class name
+ frame.className = 'vis-itemset';
+
+ // reorder the groups (if needed)
+ resized = this._orderGroups() || resized;
+
+ // check whether zoomed (in that case we need to re-stack everything)
+ // TODO: would be nicer to get this as a trigger from Range
+ var visibleInterval = range.end - range.start;
+ var zoomed = visibleInterval != this.lastVisibleInterval || this.props.width != this.props.lastWidth;
+ if (zoomed) this.stackDirty = true;
+ this.lastVisibleInterval = visibleInterval;
+ this.props.lastWidth = this.props.width;
+
+ var restack = this.stackDirty;
+ var firstGroup = this._firstGroup();
+ var firstMargin = {
+ item: margin.item,
+ axis: margin.axis
+ };
+ var nonFirstMargin = {
+ item: margin.item,
+ axis: margin.item.vertical / 2
+ };
+ var height = 0;
+ var minHeight = margin.axis + margin.item.vertical;
+
+ // redraw the background group
+ this.groups[BACKGROUND].redraw(range, nonFirstMargin, restack);
+
+ // redraw all regular groups
+ util.forEach(this.groups, function (group) {
+ var groupMargin = group == firstGroup ? firstMargin : nonFirstMargin;
+ var groupResized = group.redraw(range, groupMargin, restack);
+ resized = groupResized || resized;
+ height += group.height;
+ });
+ height = Math.max(height, minHeight);
+ this.stackDirty = false;
+
+ // update frame height
+ frame.style.height = asSize(height);
+
+ // calculate actual size
+ this.props.width = frame.offsetWidth;
+ this.props.height = height;
+
+ // reposition axis
+ this.dom.axis.style.top = asSize(orientation == 'top' ? this.body.domProps.top.height + this.body.domProps.border.top : this.body.domProps.top.height + this.body.domProps.centerContainer.height);
+ if (this.options.rtl) {
+ this.dom.axis.style.right = '0';
+ } else {
+ this.dom.axis.style.left = '0';
+ }
+
+ this.initialItemSetDrawn = true;
+ // check if this component is resized
+ resized = this._isResized() || resized;
+
+ return resized;
+ };
+
+ /**
+ * Get the first group, aligned with the axis
+ * @return {Group | null} firstGroup
+ * @private
+ */
+ ItemSet.prototype._firstGroup = function () {
+ var firstGroupIndex = this.options.orientation.item == 'top' ? 0 : this.groupIds.length - 1;
+ var firstGroupId = this.groupIds[firstGroupIndex];
+ var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED];
+
+ return firstGroup || null;
+ };
+
+ /**
+ * Create or delete the group holding all ungrouped items. This group is used when
+ * there are no groups specified.
+ * @protected
+ */
+ ItemSet.prototype._updateUngrouped = function () {
+ var ungrouped = this.groups[UNGROUPED];
+ var background = this.groups[BACKGROUND];
+ var item, itemId;
+
+ if (this.groupsData) {
+ // remove the group holding all ungrouped items
+ if (ungrouped) {
+ ungrouped.hide();
+ delete this.groups[UNGROUPED];
+
+ for (itemId in this.items) {
+ if (this.items.hasOwnProperty(itemId)) {
+ item = this.items[itemId];
+ item.parent && item.parent.remove(item);
+ var groupId = this._getGroupId(item.data);
+ var group = this.groups[groupId];
+ group && group.add(item) || item.hide();
+ }
+ }
+ }
+ } else {
+ // create a group holding all (unfiltered) items
+ if (!ungrouped) {
+ var id = null;
+ var data = null;
+ ungrouped = new Group(id, data, this);
+ this.groups[UNGROUPED] = ungrouped;
+
+ for (itemId in this.items) {
+ if (this.items.hasOwnProperty(itemId)) {
+ item = this.items[itemId];
+ ungrouped.add(item);
+ }
+ }
+
+ ungrouped.show();
+ }
+ }
+ };
+
+ /**
+ * Get the element for the labelset
+ * @return {HTMLElement} labelSet
+ */
+ ItemSet.prototype.getLabelSet = function () {
+ return this.dom.labelSet;
+ };
+
+ /**
+ * Set items
+ * @param {vis.DataSet | null} items
+ */
+ ItemSet.prototype.setItems = function (items) {
+ var me = this,
+ ids,
+ oldItemsData = this.itemsData;
+
+ // replace the dataset
+ if (!items) {
+ this.itemsData = null;
+ } else if (items instanceof DataSet || items instanceof DataView) {
+ this.itemsData = items;
+ } else {
+ throw new TypeError('Data must be an instance of DataSet or DataView');
+ }
+
+ if (oldItemsData) {
+ // unsubscribe from old dataset
+ util.forEach(this.itemListeners, function (callback, event) {
+ oldItemsData.off(event, callback);
+ });
+
+ // remove all drawn items
+ ids = oldItemsData.getIds();
+ this._onRemove(ids);
+ }
+
+ if (this.itemsData) {
+ // subscribe to new dataset
+ var id = this.id;
+ util.forEach(this.itemListeners, function (callback, event) {
+ me.itemsData.on(event, callback, id);
+ });
+
+ // add all new items
+ ids = this.itemsData.getIds();
+ this._onAdd(ids);
+
+ // update the group holding all ungrouped items
+ this._updateUngrouped();
+ }
+
+ this.body.emitter.emit('_change', { queue: true });
+ };
+
+ /**
+ * Get the current items
+ * @returns {vis.DataSet | null}
+ */
+ ItemSet.prototype.getItems = function () {
+ return this.itemsData;
+ };
+
+ /**
+ * Set groups
+ * @param {vis.DataSet} groups
+ */
+ ItemSet.prototype.setGroups = function (groups) {
+ var me = this,
+ ids;
+
+ // unsubscribe from current dataset
+ if (this.groupsData) {
+ util.forEach(this.groupListeners, function (callback, event) {
+ me.groupsData.off(event, callback);
+ });
+
+ // remove all drawn groups
+ ids = this.groupsData.getIds();
+ this.groupsData = null;
+ this._onRemoveGroups(ids); // note: this will cause a redraw
+ }
+
+ // replace the dataset
+ if (!groups) {
+ this.groupsData = null;
+ } else if (groups instanceof DataSet || groups instanceof DataView) {
+ this.groupsData = groups;
+ } else {
+ throw new TypeError('Data must be an instance of DataSet or DataView');
+ }
+
+ if (this.groupsData) {
+ // go over all groups nesting
+ var groupsData = this.groupsData;
+ if (this.groupsData instanceof DataView) {
+ groupsData = this.groupsData.getDataSet();
+ }
+
+ groupsData.get().forEach(function (group) {
+ if (group.nestedGroups) {
+ group.nestedGroups.forEach(function (nestedGroupId) {
+ var updatedNestedGroup = groupsData.get(nestedGroupId);
+ updatedNestedGroup.nestedInGroup = group.id;
+ if (group.showNested == false) {
+ updatedNestedGroup.visible = false;
+ }
+ groupsData.update(updatedNestedGroup);
+ });
+ }
+ });
+
+ // subscribe to new dataset
+ var id = this.id;
+ util.forEach(this.groupListeners, function (callback, event) {
+ me.groupsData.on(event, callback, id);
+ });
+
+ // draw all ms
+ ids = this.groupsData.getIds();
+ this._onAddGroups(ids);
+ }
+
+ // update the group holding all ungrouped items
+ this._updateUngrouped();
+
+ // update the order of all items in each group
+ this._order();
+
+ this.body.emitter.emit('_change', { queue: true });
+ };
+
+ /**
+ * Get the current groups
+ * @returns {vis.DataSet | null} groups
+ */
+ ItemSet.prototype.getGroups = function () {
+ return this.groupsData;
+ };
+
+ /**
+ * Remove an item by its id
+ * @param {String | Number} id
+ */
+ ItemSet.prototype.removeItem = function (id) {
+ var item = this.itemsData.get(id),
+ dataset = this.itemsData.getDataSet(),
+ itemObj = this.items[id];
+
+ if (item) {
+ // confirm deletion
+ this.options.onRemove(item, function (item) {
+ if (item) {
+ // remove by id here, it is possible that an item has no id defined
+ // itself, so better not delete by the item itself
+ dataset.remove(id);
+
+ // Remove it's popup
+ if (itemObj.popup) {
+ itemObj.popup.destroy();
+ itemObj.popup = null;
+ }
+ }
+ });
+ }
+ };
+
+ /**
+ * Get the time of an item based on it's data and options.type
+ * @param {Object} itemData
+ * @returns {string} Returns the type
+ * @private
+ */
+ ItemSet.prototype._getType = function (itemData) {
+ return itemData.type || this.options.type || (itemData.end ? 'range' : 'box');
+ };
+
+ /**
+ * Get the group id for an item
+ * @param {Object} itemData
+ * @returns {string} Returns the groupId
+ * @private
+ */
+ ItemSet.prototype._getGroupId = function (itemData) {
+ var type = this._getType(itemData);
+ if (type == 'background' && itemData.group == undefined) {
+ return BACKGROUND;
+ } else {
+ return this.groupsData ? itemData.group : UNGROUPED;
+ }
+ };
+
+ /**
+ * Handle updated items
+ * @param {Number[]} ids
+ * @protected
+ */
+ ItemSet.prototype._onUpdate = function (ids) {
+ var me = this;
+
+ ids.forEach(function (id) {
+ var itemData = me.itemsData.get(id, me.itemOptions);
+ var item = me.items[id];
+ var type = itemData ? me._getType(itemData) : null;
+
+ var constructor = ItemSet.types[type];
+ var selected;
+
+ if (item) {
+ // update item
+ if (!constructor || !(item instanceof constructor)) {
+ // item type has changed, delete the item and recreate it
+ selected = item.selected; // preserve selection of this item
+ me._removeItem(item);
+ item = null;
+ } else {
+ me._updateItem(item, itemData);
+ }
+ }
+
+ if (!item && itemData) {
+ // create item
+ if (constructor) {
+ item = new constructor(itemData, me.conversion, me.options);
+ item.id = id; // TODO: not so nice setting id afterwards
+
+ me._addItem(item);
+ if (selected) {
+ this.selection.push(id);
+ item.select();
+ }
+ } else if (type == 'rangeoverflow') {
+ // TODO: deprecated since version 2.1.0 (or 3.0.0?). cleanup some day
+ throw new TypeError('Item type "rangeoverflow" is deprecated. Use css styling instead: ' + '.vis-item.vis-range .vis-item-content {overflow: visible;}');
+ } else {
+ throw new TypeError('Unknown item type "' + type + '"');
+ }
+ }
+ }.bind(this));
+
+ this._order();
+ this.stackDirty = true; // force re-stacking of all items next redraw
+ this.body.emitter.emit('_change', { queue: true });
+ };
+
+ /**
+ * Handle added items
+ * @param {Number[]} ids
+ * @protected
+ */
+ ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate;
+
+ /**
+ * Handle removed items
+ * @param {Number[]} ids
+ * @protected
+ */
+ ItemSet.prototype._onRemove = function (ids) {
+ var count = 0;
+ var me = this;
+ ids.forEach(function (id) {
+ var item = me.items[id];
+ if (item) {
+ count++;
+ me._removeItem(item);
+ }
+ });
+
+ if (count) {
+ // update order
+ this._order();
+ this.stackDirty = true; // force re-stacking of all items next redraw
+ this.body.emitter.emit('_change', { queue: true });
+ }
+ };
+
+ /**
+ * Update the order of item in all groups
+ * @private
+ */
+ ItemSet.prototype._order = function () {
+ // reorder the items in all groups
+ // TODO: optimization: only reorder groups affected by the changed items
+ util.forEach(this.groups, function (group) {
+ group.order();
+ });
+ };
+
+ /**
+ * Handle updated groups
+ * @param {Number[]} ids
+ * @private
+ */
+ ItemSet.prototype._onUpdateGroups = function (ids) {
+ this._onAddGroups(ids);
+ };
+
+ /**
+ * Handle changed groups (added or updated)
+ * @param {Number[]} ids
+ * @private
+ */
+ ItemSet.prototype._onAddGroups = function (ids) {
+ var me = this;
+
+ ids.forEach(function (id) {
+ var groupData = me.groupsData.get(id);
+ var group = me.groups[id];
+
+ if (!group) {
+ // check for reserved ids
+ if (id == UNGROUPED || id == BACKGROUND) {
+ throw new Error('Illegal group id. ' + id + ' is a reserved id.');
+ }
+
+ var groupOptions = (0, _create2['default'])(me.options);
+ util.extend(groupOptions, {
+ height: null
+ });
+
+ group = new Group(id, groupData, me);
+ me.groups[id] = group;
+
+ // add items with this groupId to the new group
+ for (var itemId in me.items) {
+ if (me.items.hasOwnProperty(itemId)) {
+ var item = me.items[itemId];
+ if (item.data.group == id) {
+ group.add(item);
+ }
+ }
+ }
+
+ group.order();
+ group.show();
+ } else {
+ // update group
+ group.setData(groupData);
+ }
+ });
+
+ this.body.emitter.emit('_change', { queue: true });
+ };
+
+ /**
+ * Handle removed groups
+ * @param {Number[]} ids
+ * @private
+ */
+ ItemSet.prototype._onRemoveGroups = function (ids) {
+ var groups = this.groups;
+ ids.forEach(function (id) {
+ var group = groups[id];
+
+ if (group) {
+ group.hide();
+ delete groups[id];
+ }
+ });
+
+ this.markDirty();
+
+ this.body.emitter.emit('_change', { queue: true });
+ };
+
+ /**
+ * Reorder the groups if needed
+ * @return {boolean} changed
+ * @private
+ */
+ ItemSet.prototype._orderGroups = function () {
+ if (this.groupsData) {
+ // reorder the groups
+ var groupIds = this.groupsData.getIds({
+ order: this.options.groupOrder
+ });
+
+ groupIds = this._orderNestedGroups(groupIds);
+
+ var changed = !util.equalArray(groupIds, this.groupIds);
+ if (changed) {
+ // hide all groups, removes them from the DOM
+ var groups = this.groups;
+ groupIds.forEach(function (groupId) {
+ groups[groupId].hide();
+ });
+
+ // show the groups again, attach them to the DOM in correct order
+ groupIds.forEach(function (groupId) {
+ groups[groupId].show();
+ });
+
+ this.groupIds = groupIds;
+ }
+
+ return changed;
+ } else {
+ return false;
+ }
+ };
+
+ /**
+ * Reorder the nested groups
+ * @return {boolean} changed
+ * @private
+ */
+ ItemSet.prototype._orderNestedGroups = function (groupIds) {
+ var newGroupIdsOrder = [];
+
+ groupIds.forEach(function (groupId) {
+ var groupData = this.groupsData.get(groupId);
+ if (!groupData.nestedInGroup) {
+ newGroupIdsOrder.push(groupId);
+ }
+ if (groupData.nestedGroups) {
+ var nestedGroups = this.groupsData.get({
+ filter: function filter(nestedGroup) {
+ return nestedGroup.nestedInGroup == groupId;
+ }
+ });
+ var nestedGroupIds = nestedGroups.map(function (nestedGroup) {
+ return nestedGroup.id;
+ });
+ newGroupIdsOrder = newGroupIdsOrder.concat(nestedGroupIds);
+ }
+ }, this);
+ return newGroupIdsOrder;
+ };
+
+ /**
+ * Add a new item
+ * @param {Item} item
+ * @private
+ */
+ ItemSet.prototype._addItem = function (item) {
+ this.items[item.id] = item;
+
+ // add to group
+ var groupId = this._getGroupId(item.data);
+ var group = this.groups[groupId];
+
+ if (!group) {
+ item.groupShowing = false;
+ } else if (group && group.data && group.data.showNested) {
+ item.groupShowing = true;
+ }
+
+ if (group) group.add(item);
+ };
+
+ /**
+ * Update an existing item
+ * @param {Item} item
+ * @param {Object} itemData
+ * @private
+ */
+ ItemSet.prototype._updateItem = function (item, itemData) {
+ var oldGroupId = item.data.group;
+ var oldSubGroupId = item.data.subgroup;
+
+ // update the items data (will redraw the item when displayed)
+ item.setData(itemData);
+
+ var groupId = this._getGroupId(item.data);
+ var group = this.groups[groupId];
+ if (!group) {
+ item.groupShowing = false;
+ } else if (group && group.data && group.data.showNested) {
+ item.groupShowing = true;
+ }
+ // update group
+ if (oldGroupId != item.data.group || oldSubGroupId != item.data.subgroup) {
+ var oldGroup = this.groups[oldGroupId];
+ if (oldGroup) oldGroup.remove(item);
+ if (group) group.add(item);
+ }
+ };
+
+ /**
+ * Delete an item from the ItemSet: remove it from the DOM, from the map
+ * with items, and from the map with visible items, and from the selection
+ * @param {Item} item
+ * @private
+ */
+ ItemSet.prototype._removeItem = function (item) {
+ // remove from DOM
+ item.hide();
+
+ // remove from items
+ delete this.items[item.id];
+
+ // remove from selection
+ var index = this.selection.indexOf(item.id);
+ if (index != -1) this.selection.splice(index, 1);
+
+ // remove from group
+ item.parent && item.parent.remove(item);
+ };
+
+ /**
+ * Create an array containing all items being a range (having an end date)
+ * @param array
+ * @returns {Array}
+ * @private
+ */
+ ItemSet.prototype._constructByEndArray = function (array) {
+ var endArray = [];
+
+ for (var i = 0; i < array.length; i++) {
+ if (array[i] instanceof RangeItem) {
+ endArray.push(array[i]);
+ }
+ }
+ return endArray;
+ };
+
+ /**
+ * Register the clicked item on touch, before dragStart is initiated.
+ *
+ * dragStart is initiated from a mousemove event, AFTER the mouse/touch is
+ * already moving. Therefore, the mouse/touch can sometimes be above an other
+ * DOM element than the item itself.
+ *
+ * @param {Event} event
+ * @private
+ */
+ ItemSet.prototype._onTouch = function (event) {
+ // store the touched item, used in _onDragStart
+ this.touchParams.item = this.itemFromTarget(event);
+ this.touchParams.dragLeftItem = event.target.dragLeftItem || false;
+ this.touchParams.dragRightItem = event.target.dragRightItem || false;
+ this.touchParams.itemProps = null;
+ };
+
+ /**
+ * Given an group id, returns the index it has.
+ *
+ * @param {Number} groupID
+ * @private
+ */
+ ItemSet.prototype._getGroupIndex = function (groupId) {
+ for (var i = 0; i < this.groupIds.length; i++) {
+ if (groupId == this.groupIds[i]) return i;
+ }
+ };
+
+ /**
+ * Start dragging the selected events
+ * @param {Event} event
+ * @private
+ */
+ ItemSet.prototype._onDragStart = function (event) {
+ if (this.touchParams.itemIsDragging) {
+ return;
+ }
+ var item = this.touchParams.item || null;
+ var me = this;
+ var props;
+
+ if (item && (item.selected || this.options.itemsAlwaysDraggable)) {
+
+ if (this.options.editable.overrideItems && !this.options.editable.updateTime && !this.options.editable.updateGroup) {
+ return;
+ }
+
+ // override options.editable
+ if (item.editable != null && !item.editable.updateTime && !item.editable.updateGroup && !this.options.editable.overrideItems) {
+ return;
+ }
+
+ var dragLeftItem = this.touchParams.dragLeftItem;
+ var dragRightItem = this.touchParams.dragRightItem;
+ this.touchParams.itemIsDragging = true;
+ this.touchParams.selectedItem = item;
+
+ if (dragLeftItem) {
+ props = {
+ item: dragLeftItem,
+ initialX: event.center.x,
+ dragLeft: true,
+ data: this._cloneItemData(item.data)
+ };
+
+ this.touchParams.itemProps = [props];
+ } else if (dragRightItem) {
+ props = {
+ item: dragRightItem,
+ initialX: event.center.x,
+ dragRight: true,
+ data: this._cloneItemData(item.data)
+ };
+
+ this.touchParams.itemProps = [props];
+ } else {
+ var baseGroupIndex = this._getGroupIndex(item.data.group);
+
+ var itemsToDrag = this.options.itemsAlwaysDraggable && !item.selected ? [item.id] : this.getSelection();
+
+ this.touchParams.itemProps = itemsToDrag.map(function (id) {
+ var item = me.items[id];
+ var groupIndex = me._getGroupIndex(item.data.group);
+ return {
+ item: item,
+ initialX: event.center.x,
+ groupOffset: baseGroupIndex - groupIndex,
+ data: this._cloneItemData(item.data)
+ };
+ }.bind(this));
+ }
+
+ event.stopPropagation();
+ } else if (this.options.editable.add && (event.srcEvent.ctrlKey || event.srcEvent.metaKey)) {
+ // create a new range item when dragging with ctrl key down
+ this._onDragStartAddItem(event);
+ }
+ };
+
+ /**
+ * Start creating a new range item by dragging.
+ * @param {Event} event
+ * @private
+ */
+ ItemSet.prototype._onDragStartAddItem = function (event) {
+ var snap = this.options.snap || null;
+
+ if (this.options.rtl) {
+ var xAbs = util.getAbsoluteRight(this.dom.frame);
+ var x = xAbs - event.center.x + 10; // plus 10 to compensate for the drag starting as soon as you've moved 10px
+ } else {
+ var xAbs = util.getAbsoluteLeft(this.dom.frame);
+ var x = event.center.x - xAbs - 10; // minus 10 to compensate for the drag starting as soon as you've moved 10px
+ }
+
+ var time = this.body.util.toTime(x);
+ var scale = this.body.util.getScale();
+ var step = this.body.util.getStep();
+ var start = snap ? snap(time, scale, step) : time;
+ var end = start;
+
+ var itemData = {
+ type: 'range',
+ start: start,
+ end: end,
+ content: 'new item'
+ };
+
+ var id = util.randomUUID();
+ itemData[this.itemsData._fieldId] = id;
+
+ var group = this.groupFromTarget(event);
+ if (group) {
+ itemData.group = group.groupId;
+ }
+ var newItem = new RangeItem(itemData, this.conversion, this.options);
+ newItem.id = id; // TODO: not so nice setting id afterwards
+ newItem.data = this._cloneItemData(itemData);
+ this._addItem(newItem);
+ this.touchParams.selectedItem = newItem;
+
+ var props = {
+ item: newItem,
+ initialX: event.center.x,
+ data: newItem.data
+ };
+
+ if (this.options.rtl) {
+ props.dragLeft = true;
+ } else {
+ props.dragRight = true;
+ }
+ this.touchParams.itemProps = [props];
+
+ event.stopPropagation();
+ };
+
+ /**
+ * Drag selected items
+ * @param {Event} event
+ * @private
+ */
+ ItemSet.prototype._onDrag = function (event) {
+ if (this.touchParams.itemProps) {
+ event.stopPropagation();
+
+ var me = this;
+ var snap = this.options.snap || null;
+
+ if (this.options.rtl) {
+ var xOffset = this.body.dom.root.offsetLeft + this.body.domProps.right.width;
+ } else {
+ var xOffset = this.body.dom.root.offsetLeft + this.body.domProps.left.width;
+ }
+
+ var scale = this.body.util.getScale();
+ var step = this.body.util.getStep();
+
+ //only calculate the new group for the item that's actually dragged
+ var selectedItem = this.touchParams.selectedItem;
+ var updateGroupAllowed = (this.options.editable.overrideItems || selectedItem.editable == null) && this.options.editable.updateGroup || !this.options.editable.overrideItems && selectedItem.editable != null && selectedItem.editable.updateGroup;
+ var newGroupBase = null;
+ if (updateGroupAllowed && selectedItem) {
+ if (selectedItem.data.group != undefined) {
+ // drag from one group to another
+ var group = me.groupFromTarget(event);
+ if (group) {
+ //we know the offset for all items, so the new group for all items
+ //will be relative to this one.
+ newGroupBase = this._getGroupIndex(group.groupId);
+ }
+ }
+ }
+
+ // move
+ this.touchParams.itemProps.forEach(function (props) {
+ var current = me.body.util.toTime(event.center.x - xOffset);
+ var initial = me.body.util.toTime(props.initialX - xOffset);
+
+ if (this.options.rtl) {
+ var offset = -(current - initial); // ms
+ } else {
+ var offset = current - initial; // ms
+ }
+
+ var itemData = this._cloneItemData(props.item.data); // clone the data
+ if (props.item.editable != null && !props.item.editable.updateTime && !props.item.editable.updateGroup && !me.options.editable.overrideItems) {
+ return;
+ }
+
+ var updateTimeAllowed = (this.options.editable.overrideItems || selectedItem.editable == null) && this.options.editable.updateTime || !this.options.editable.overrideItems && selectedItem.editable != null && selectedItem.editable.updateTime;
+ if (updateTimeAllowed) {
+ if (props.dragLeft) {
+ // drag left side of a range item
+ if (this.options.rtl) {
+ if (itemData.end != undefined) {
+ var initialEnd = util.convert(props.data.end, 'Date');
+ var end = new Date(initialEnd.valueOf() + offset);
+ // TODO: pass a Moment instead of a Date to snap(). (Breaking change)
+ itemData.end = snap ? snap(end, scale, step) : end;
+ }
+ } else {
+ if (itemData.start != undefined) {
+ var initialStart = util.convert(props.data.start, 'Date');
+ var start = new Date(initialStart.valueOf() + offset);
+ // TODO: pass a Moment instead of a Date to snap(). (Breaking change)
+ itemData.start = snap ? snap(start, scale, step) : start;
+ }
+ }
+ } else if (props.dragRight) {
+ // drag right side of a range item
+ if (this.options.rtl) {
+ if (itemData.start != undefined) {
+ var initialStart = util.convert(props.data.start, 'Date');
+ var start = new Date(initialStart.valueOf() + offset);
+ // TODO: pass a Moment instead of a Date to snap(). (Breaking change)
+ itemData.start = snap ? snap(start, scale, step) : start;
+ }
+ } else {
+ if (itemData.end != undefined) {
+ var initialEnd = util.convert(props.data.end, 'Date');
+ var end = new Date(initialEnd.valueOf() + offset);
+ // TODO: pass a Moment instead of a Date to snap(). (Breaking change)
+ itemData.end = snap ? snap(end, scale, step) : end;
+ }
+ }
+ } else {
+ // drag both start and end
+ if (itemData.start != undefined) {
+
+ var initialStart = util.convert(props.data.start, 'Date').valueOf();
+ var start = new Date(initialStart + offset);
+
+ if (itemData.end != undefined) {
+ var initialEnd = util.convert(props.data.end, 'Date');
+ var duration = initialEnd.valueOf() - initialStart.valueOf();
+
+ // TODO: pass a Moment instead of a Date to snap(). (Breaking change)
+ itemData.start = snap ? snap(start, scale, step) : start;
+ itemData.end = new Date(itemData.start.valueOf() + duration);
+ } else {
+ // TODO: pass a Moment instead of a Date to snap(). (Breaking change)
+ itemData.start = snap ? snap(start, scale, step) : start;
+ }
+ }
+ }
+ }
+
+ if (updateGroupAllowed && !props.dragLeft && !props.dragRight && newGroupBase != null) {
+ if (itemData.group != undefined) {
+ var newOffset = newGroupBase - props.groupOffset;
+
+ //make sure we stay in bounds
+ newOffset = Math.max(0, newOffset);
+ newOffset = Math.min(me.groupIds.length - 1, newOffset);
+
+ itemData.group = me.groupIds[newOffset];
+ }
+ }
+
+ // confirm moving the item
+ itemData = this._cloneItemData(itemData); // convert start and end to the correct type
+ me.options.onMoving(itemData, function (itemData) {
+ if (itemData) {
+ props.item.setData(this._cloneItemData(itemData, 'Date'));
+ }
+ }.bind(this));
+ }.bind(this));
+
+ this.stackDirty = true; // force re-stacking of all items next redraw
+ this.body.emitter.emit('_change');
+ }
+ };
+
+ /**
+ * Move an item to another group
+ * @param {Item} item
+ * @param {String | Number} groupId
+ * @private
+ */
+ ItemSet.prototype._moveToGroup = function (item, groupId) {
+ var group = this.groups[groupId];
+ if (group && group.groupId != item.data.group) {
+ var oldGroup = item.parent;
+ oldGroup.remove(item);
+ oldGroup.order();
+ group.add(item);
+ group.order();
+
+ item.data.group = group.groupId;
+ }
+ };
+
+ /**
+ * End of dragging selected items
+ * @param {Event} event
+ * @private
+ */
+ ItemSet.prototype._onDragEnd = function (event) {
+ this.touchParams.itemIsDragging = false;
+ if (this.touchParams.itemProps) {
+ event.stopPropagation();
+
+ var me = this;
+ var dataset = this.itemsData.getDataSet();
+ var itemProps = this.touchParams.itemProps;
+ this.touchParams.itemProps = null;
+
+ itemProps.forEach(function (props) {
+ var id = props.item.id;
+ var exists = me.itemsData.get(id, me.itemOptions) != null;
+
+ if (!exists) {
+ // add a new item
+ me.options.onAdd(props.item.data, function (itemData) {
+ me._removeItem(props.item); // remove temporary item
+ if (itemData) {
+ me.itemsData.getDataSet().add(itemData);
+ }
+
+ // force re-stacking of all items next redraw
+ me.stackDirty = true;
+ me.body.emitter.emit('_change');
+ });
+ } else {
+ // update existing item
+ var itemData = this._cloneItemData(props.item.data); // convert start and end to the correct type
+ me.options.onMove(itemData, function (itemData) {
+ if (itemData) {
+ // apply changes
+ itemData[dataset._fieldId] = id; // ensure the item contains its id (can be undefined)
+ dataset.update(itemData);
+ } else {
+ // restore original values
+ props.item.setData(props.data);
+
+ me.stackDirty = true; // force re-stacking of all items next redraw
+ me.body.emitter.emit('_change');
+ }
+ });
+ }
+ }.bind(this));
+ }
+ };
+
+ ItemSet.prototype._onGroupClick = function (event) {
+ var group = this.groupFromTarget(event);
+
+ if (!group.nestedGroups) return;
+
+ var groupsData = this.groupsData;
+ if (this.groupsData instanceof DataView) {
+ groupsData = this.groupsData.getDataSet();
+ }
+
+ group.showNested = !group.showNested;
+
+ var nestedGroups = groupsData.get(group.nestedGroups).map(function (nestedGroup) {
+ if (nestedGroup.visible == undefined) {
+ nestedGroup.visible = true;
+ }
+ nestedGroup.visible = !!group.showNested;
+ return nestedGroup;
+ });
+ groupsData.update(nestedGroups);
+
+ if (group.showNested) {
+ util.removeClassName(group.dom.label, 'collapsed');
+ util.addClassName(group.dom.label, 'expanded');
+ } else {
+ util.removeClassName(group.dom.label, 'expanded');
+ var collapsedDirClassName = this.options.rtl ? 'collapsed-rtl' : 'collapsed';
+ util.addClassName(group.dom.label, collapsedDirClassName);
+ }
+ };
+
+ ItemSet.prototype._onGroupDragStart = function (event) {
+ if (this.options.groupEditable.order) {
+ this.groupTouchParams.group = this.groupFromTarget(event);
+
+ if (this.groupTouchParams.group) {
+ event.stopPropagation();
+
+ this.groupTouchParams.originalOrder = this.groupsData.getIds({
+ order: this.options.groupOrder
+ });
+ }
+ }
+ };
+
+ ItemSet.prototype._onGroupDrag = function (event) {
+ if (this.options.groupEditable.order && this.groupTouchParams.group) {
+ event.stopPropagation();
+
+ var groupsData = this.groupsData;
+ if (this.groupsData instanceof DataView) {
+ groupsData = this.groupsData.getDataSet();
+ }
+ // drag from one group to another
+ var group = this.groupFromTarget(event);
+
+ // try to avoid toggling when groups differ in height
+ if (group && group.height != this.groupTouchParams.group.height) {
+ var movingUp = group.top < this.groupTouchParams.group.top;
+ var clientY = event.center ? event.center.y : event.clientY;
+ var targetGroupTop = util.getAbsoluteTop(group.dom.foreground);
+ var draggedGroupHeight = this.groupTouchParams.group.height;
+ if (movingUp) {
+ // skip swapping the groups when the dragged group is not below clientY afterwards
+ if (targetGroupTop + draggedGroupHeight < clientY) {
+ return;
+ }
+ } else {
+ var targetGroupHeight = group.height;
+ // skip swapping the groups when the dragged group is not below clientY afterwards
+ if (targetGroupTop + targetGroupHeight - draggedGroupHeight > clientY) {
+ return;
+ }
+ }
+ }
+
+ if (group && group != this.groupTouchParams.group) {
+ var targetGroup = groupsData.get(group.groupId);
+ var draggedGroup = groupsData.get(this.groupTouchParams.group.groupId);
+
+ // switch groups
+ if (draggedGroup && targetGroup) {
+ this.options.groupOrderSwap(draggedGroup, targetGroup, groupsData);
+ groupsData.update(draggedGroup);
+ groupsData.update(targetGroup);
+ }
+
+ // fetch current order of groups
+ var newOrder = groupsData.getIds({
+ order: this.options.groupOrder
+ });
+
+ // in case of changes since _onGroupDragStart
+ if (!util.equalArray(newOrder, this.groupTouchParams.originalOrder)) {
+ var origOrder = this.groupTouchParams.originalOrder;
+ var draggedId = this.groupTouchParams.group.groupId;
+ var numGroups = Math.min(origOrder.length, newOrder.length);
+ var curPos = 0;
+ var newOffset = 0;
+ var orgOffset = 0;
+ while (curPos < numGroups) {
+ // as long as the groups are where they should be step down along the groups order
+ while (curPos + newOffset < numGroups && curPos + orgOffset < numGroups && newOrder[curPos + newOffset] == origOrder[curPos + orgOffset]) {
+ curPos++;
+ }
+
+ // all ok
+ if (curPos + newOffset >= numGroups) {
+ break;
+ }
+
+ // not all ok
+ // if dragged group was move upwards everything below should have an offset
+ if (newOrder[curPos + newOffset] == draggedId) {
+ newOffset = 1;
+ continue;
+ }
+ // if dragged group was move downwards everything above should have an offset
+ else if (origOrder[curPos + orgOffset] == draggedId) {
+ orgOffset = 1;
+ continue;
+ }
+ // found a group (apart from dragged group) that has the wrong position -> switch with the
+ // group at the position where other one should be, fix index arrays and continue
+ else {
+ var slippedPosition = newOrder.indexOf(origOrder[curPos + orgOffset]);
+ var switchGroup = groupsData.get(newOrder[curPos + newOffset]);
+ var shouldBeGroup = groupsData.get(origOrder[curPos + orgOffset]);
+ this.options.groupOrderSwap(switchGroup, shouldBeGroup, groupsData);
+ groupsData.update(switchGroup);
+ groupsData.update(shouldBeGroup);
+
+ var switchGroupId = newOrder[curPos + newOffset];
+ newOrder[curPos + newOffset] = origOrder[curPos + orgOffset];
+ newOrder[slippedPosition] = switchGroupId;
+
+ curPos++;
+ }
+ }
+ }
+ }
+ }
+ };
+
+ ItemSet.prototype._onGroupDragEnd = function (event) {
+ if (this.options.groupEditable.order && this.groupTouchParams.group) {
+ event.stopPropagation();
+
+ // update existing group
+ var me = this;
+ var id = me.groupTouchParams.group.groupId;
+ var dataset = me.groupsData.getDataSet();
+ var groupData = util.extend({}, dataset.get(id)); // clone the data
+ me.options.onMoveGroup(groupData, function (groupData) {
+ if (groupData) {
+ // apply changes
+ groupData[dataset._fieldId] = id; // ensure the group contains its id (can be undefined)
+ dataset.update(groupData);
+ } else {
+
+ // fetch current order of groups
+ var newOrder = dataset.getIds({
+ order: me.options.groupOrder
+ });
+
+ // restore original order
+ if (!util.equalArray(newOrder, me.groupTouchParams.originalOrder)) {
+ var origOrder = me.groupTouchParams.originalOrder;
+ var numGroups = Math.min(origOrder.length, newOrder.length);
+ var curPos = 0;
+ while (curPos < numGroups) {
+ // as long as the groups are where they should be step down along the groups order
+ while (curPos < numGroups && newOrder[curPos] == origOrder[curPos]) {
+ curPos++;
+ }
+
+ // all ok
+ if (curPos >= numGroups) {
+ break;
+ }
+
+ // found a group that has the wrong position -> switch with the
+ // group at the position where other one should be, fix index arrays and continue
+ var slippedPosition = newOrder.indexOf(origOrder[curPos]);
+ var switchGroup = dataset.get(newOrder[curPos]);
+ var shouldBeGroup = dataset.get(origOrder[curPos]);
+ me.options.groupOrderSwap(switchGroup, shouldBeGroup, dataset);
+ groupsData.update(switchGroup);
+ groupsData.update(shouldBeGroup);
+
+ var switchGroupId = newOrder[curPos];
+ newOrder[curPos] = origOrder[curPos];
+ newOrder[slippedPosition] = switchGroupId;
+
+ curPos++;
+ }
+ }
+ }
+ });
+
+ me.body.emitter.emit('groupDragged', { groupId: id });
+ }
+ };
+
+ /**
+ * Handle selecting/deselecting an item when tapping it
+ * @param {Event} event
+ * @private
+ */
+ ItemSet.prototype._onSelectItem = function (event) {
+ if (!this.options.selectable) return;
+
+ var ctrlKey = event.srcEvent && (event.srcEvent.ctrlKey || event.srcEvent.metaKey);
+ var shiftKey = event.srcEvent && event.srcEvent.shiftKey;
+ if (ctrlKey || shiftKey) {
+ this._onMultiSelectItem(event);
+ return;
+ }
+
+ var oldSelection = this.getSelection();
+
+ var item = this.itemFromTarget(event);
+ var selection = item ? [item.id] : [];
+ this.setSelection(selection);
+
+ var newSelection = this.getSelection();
+
+ // emit a select event,
+ // except when old selection is empty and new selection is still empty
+ if (newSelection.length > 0 || oldSelection.length > 0) {
+ this.body.emitter.emit('select', {
+ items: newSelection,
+ event: util.elementsCensor(event)
+ });
+ }
+ };
+
+ /**
+ * Handle hovering an item
+ * @param {Event} event
+ * @private
+ */
+ ItemSet.prototype._onMouseOver = function (event) {
+ var item = this.itemFromTarget(event);
+ if (!item) return;
+
+ // Item we just left
+ var related = this.itemFromRelatedTarget(event);
+ if (item === related) {
+ // We haven't changed item, just element in the item
+ return;
+ }
+
+ if (item.getTitle()) {
+ if (item.popup == null) {
+ item.setPopup(new _Popup2['default'](this.body.dom.root, this.options.tooltip.overflowMethod || 'flip'));
+ }
+
+ var container = this.body.dom.centerContainer;
+ item.popup.setPosition(event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, event.clientY - util.getAbsoluteTop(container) + container.offsetTop);
+ item.popup.show();
+ }
+
+ this.body.emitter.emit('itemover', {
+ item: item.id,
+ event: util.elementsCensor(event)
+ });
+ };
+ ItemSet.prototype._onMouseOut = function (event) {
+ var item = this.itemFromTarget(event);
+ if (!item) return;
+
+ // Item we are going to
+ var related = this.itemFromRelatedTarget(event);
+ if (item === related) {
+ // We aren't changing item, just element in the item
+ return;
+ }
+
+ if (item.popup != null) {
+ item.popup.hide();
+ }
+
+ this.body.emitter.emit('itemout', {
+ item: item.id,
+ event: util.elementsCensor(event)
+ });
+ };
+ ItemSet.prototype._onMouseMove = function (event) {
+ var item = this.itemFromTarget(event);
+ if (!item) return;
+
+ if (this.options.tooltip.followMouse) {
+ if (item.popup) {
+ if (!item.popup.hidden) {
+ var container = this.body.dom.centerContainer;
+ item.popup.setPosition(event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, event.clientY - util.getAbsoluteTop(container) + container.offsetTop);
+ item.popup.show(); // Redraw
+ }
+ }
+ }
+ };
+
+ /**
+ * Handle mousewheel
+ * @param event
+ * @private
+ */
+ ItemSet.prototype._onMouseWheel = function (event) {
+ if (this.touchParams.itemIsDragging) {
+ this._onDragEnd(event);
+ }
+ };
+
+ /**
+ * Handle updates of an item on double tap
+ * @param event
+ * @private
+ */
+ ItemSet.prototype._onUpdateItem = function (item) {
+ if (!this.options.selectable) return;
+ if (!this.options.editable.add) return;
+
+ var me = this;
+
+ if (item) {
+ // execute async handler to update the item (or cancel it)
+ var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset
+ this.options.onUpdate(itemData, function (itemData) {
+ if (itemData) {
+ me.itemsData.getDataSet().update(itemData);
+ }
+ });
+ }
+ };
+
+ /**
+ * Handle creation of an item on double tap
+ * @param event
+ * @private
+ */
+ ItemSet.prototype._onAddItem = function (event) {
+ if (!this.options.selectable) return;
+ if (!this.options.editable.add) return;
+
+ var me = this;
+ var snap = this.options.snap || null;
+ var item = this.itemFromTarget(event);
+
+ if (!item) {
+ // add item
+ if (this.options.rtl) {
+ var xAbs = util.getAbsoluteRight(this.dom.frame);
+ var x = xAbs - event.center.x;
+ } else {
+ var xAbs = util.getAbsoluteLeft(this.dom.frame);
+ var x = event.center.x - xAbs;
+ }
+ // var xAbs = util.getAbsoluteLeft(this.dom.frame);
+ // var x = event.center.x - xAbs;
+ var start = this.body.util.toTime(x);
+ var scale = this.body.util.getScale();
+ var step = this.body.util.getStep();
+
+ var newItemData = {
+ start: snap ? snap(start, scale, step) : start,
+ content: 'new item'
+ };
+
+ if (event.type == 'drop') {
+ var itemData = JSON.parse(event.dataTransfer.getData("text"));
+ newItemData.content = itemData.content; // content is required
+ newItemData.type = itemData.type || 'box';
+ newItemData[this.itemsData._fieldId] = itemData.id || util.randomUUID();
+
+ if (itemData.type == 'range' || itemData.end && itemData.start) {
+ if (!itemData.end) {
+ var end = this.body.util.toTime(x + this.props.width / 5);
+ newItemData.end = snap ? snap(end, scale, step) : end;
+ } else {
+ newItemData.end = itemData.end;
+ newItemData.start = itemData.start;
+ }
+ }
+ } else {
+ newItemData[this.itemsData._fieldId] = util.randomUUID();
+
+ // when default type is a range, add a default end date to the new item
+ if (this.options.type === 'range') {
+ var end = this.body.util.toTime(x + this.props.width / 5);
+ newItemData.end = snap ? snap(end, scale, step) : end;
+ }
+ }
+
+ var group = this.groupFromTarget(event);
+ if (group) {
+ newItemData.group = group.groupId;
+ }
+
+ // execute async handler to customize (or cancel) adding an item
+ newItemData = this._cloneItemData(newItemData); // convert start and end to the correct type
+ this.options.onAdd(newItemData, function (item) {
+ if (item) {
+ me.itemsData.getDataSet().add(item);
+ if (event.type == 'drop') {
+ me.setSelection([item.id]);
+ }
+ // TODO: need to trigger a redraw?
+ }
+ });
+ }
+ };
+
+ /**
+ * Handle selecting/deselecting multiple items when holding an item
+ * @param {Event} event
+ * @private
+ */
+ ItemSet.prototype._onMultiSelectItem = function (event) {
+ if (!this.options.selectable) return;
+
+ var item = this.itemFromTarget(event);
+
+ if (item) {
+ // multi select items (if allowed)
+
+ var selection = this.options.multiselect ? this.getSelection() // take current selection
+ : []; // deselect current selection
+
+ var shiftKey = event.srcEvent && event.srcEvent.shiftKey || false;
+
+ if (shiftKey && this.options.multiselect) {
+ // select all items between the old selection and the tapped item
+ var itemGroup = this.itemsData.get(item.id).group;
+
+ // when filtering get the group of the last selected item
+ var lastSelectedGroup = undefined;
+ if (this.options.multiselectPerGroup) {
+ if (selection.length > 0) {
+ lastSelectedGroup = this.itemsData.get(selection[0]).group;
+ }
+ }
+
+ // determine the selection range
+ if (!this.options.multiselectPerGroup || lastSelectedGroup == undefined || lastSelectedGroup == itemGroup) {
+ selection.push(item.id);
+ }
+ var range = ItemSet._getItemRange(this.itemsData.get(selection, this.itemOptions));
+
+ if (!this.options.multiselectPerGroup || lastSelectedGroup == itemGroup) {
+ // select all items within the selection range
+ selection = [];
+ for (var id in this.items) {
+ if (this.items.hasOwnProperty(id)) {
+ var _item = this.items[id];
+ var start = _item.data.start;
+ var end = _item.data.end !== undefined ? _item.data.end : start;
+
+ if (start >= range.min && end <= range.max && (!this.options.multiselectPerGroup || lastSelectedGroup == this.itemsData.get(_item.id).group) && !(_item instanceof BackgroundItem)) {
+ selection.push(_item.id); // do not use id but item.id, id itself is stringified
+ }
+ }
+ }
+ }
+ } else {
+ // add/remove this item from the current selection
+ var index = selection.indexOf(item.id);
+ if (index == -1) {
+ // item is not yet selected -> select it
+ selection.push(item.id);
+ } else {
+ // item is already selected -> deselect it
+ selection.splice(index, 1);
+ }
+ }
+
+ this.setSelection(selection);
+
+ this.body.emitter.emit('select', {
+ items: this.getSelection(),
+ event: util.elementsCensor(event)
+ });
+ }
+ };
+
+ /**
+ * Calculate the time range of a list of items
+ * @param {Array.<Object>} itemsData
+ * @return {{min: Date, max: Date}} Returns the range of the provided items
+ * @private
+ */
+ ItemSet._getItemRange = function (itemsData) {
+ var max = null;
+ var min = null;
+
+ itemsData.forEach(function (data) {
+ if (min == null || data.start < min) {
+ min = data.start;
+ }
+
+ if (data.end != undefined) {
+ if (max == null || data.end > max) {
+ max = data.end;
+ }
+ } else {
+ if (max == null || data.start > max) {
+ max = data.start;
+ }
+ }
+ });
+
+ return {
+ min: min,
+ max: max
+ };
+ };
+
+ /**
+ * Find an item from an element:
+ * searches for the attribute 'timeline-item' in the element's tree
+ * @param {HTMLElement} element
+ * @return {Item | null} item
+ */
+ ItemSet.prototype.itemFromElement = function (element) {
+ var cur = element;
+ while (cur) {
+ if (cur.hasOwnProperty('timeline-item')) {
+ return cur['timeline-item'];
+ }
+ cur = cur.parentNode;
+ }
+
+ return null;
+ };
+
+ /**
+ * Find an item from an event target:
+ * searches for the attribute 'timeline-item' in the event target's element tree
+ * @param {Event} event
+ * @return {Item | null} item
+ */
+ ItemSet.prototype.itemFromTarget = function (event) {
+ return this.itemFromElement(event.target);
+ };
+
+ /**
+ * Find an item from an event's related target:
+ * searches for the attribute 'timeline-item' in the related target's element tree
+ * @param {Event} event
+ * @return {Item | null} item
+ */
+ ItemSet.prototype.itemFromRelatedTarget = function (event) {
+ return this.itemFromElement(event.relatedTarget);
+ };
+
+ /**
+ * Find the Group from an event target:
+ * searches for the attribute 'timeline-group' in the event target's element tree
+ * @param {Event} event
+ * @return {Group | null} group
+ */
+ ItemSet.prototype.groupFromTarget = function (event) {
+ var clientY = event.center ? event.center.y : event.clientY;
+ for (var i = 0; i < this.groupIds.length; i++) {
+ var groupId = this.groupIds[i];
+ var group = this.groups[groupId];
+ var foreground = group.dom.foreground;
+ var top = util.getAbsoluteTop(foreground);
+ if (clientY > top && clientY < top + foreground.offsetHeight) {
+ return group;
+ }
+
+ if (this.options.orientation.item === 'top') {
+ if (i === this.groupIds.length - 1 && clientY > top) {
+ return group;
+ }
+ } else {
+ if (i === 0 && clientY < top + foreground.offset) {
+ return group;
+ }
+ }
+ }
+
+ return null;
+ };
+
+ /**
+ * Find the ItemSet from an event target:
+ * searches for the attribute 'timeline-itemset' in the event target's element tree
+ * @param {Event} event
+ * @return {ItemSet | null} item
+ */
+ ItemSet.itemSetFromTarget = function (event) {
+ var target = event.target;
+ while (target) {
+ if (target.hasOwnProperty('timeline-itemset')) {
+ return target['timeline-itemset'];
+ }
+ target = target.parentNode;
+ }
+
+ return null;
+ };
+
+ /**
+ * Clone the data of an item, and "normalize" it: convert the start and end date
+ * to the type (Date, Moment, ...) configured in the DataSet. If not configured,
+ * start and end are converted to Date.
+ * @param {Object} itemData, typically `item.data`
+ * @param {string} [type] Optional Date type. If not provided, the type from the DataSet is taken
+ * @return {Object} The cloned object
+ * @private
+ */
+ ItemSet.prototype._cloneItemData = function (itemData, type) {
+ var clone = util.extend({}, itemData);
+
+ if (!type) {
+ // convert start and end date to the type (Date, Moment, ...) configured in the DataSet
+ type = this.itemsData.getDataSet()._options.type;
+ }
+
+ if (clone.start != undefined) {
+ clone.start = util.convert(clone.start, type && type.start || 'Date');
+ }
+ if (clone.end != undefined) {
+ clone.end = util.convert(clone.end, type && type.end || 'Date');
+ }
+
+ return clone;
+ };
+
+ module.exports = ItemSet;
+
+/***/ },
+/* 128 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ /**
+ * Popup is a class to create a popup window with some text
+ * @param {Element} container The container object.
+ * @param {string} overflowMethod How the popup should act to overflowing ('flip' or 'cap')
+ */
+ var Popup = function () {
+ function Popup(container, overflowMethod) {
+ (0, _classCallCheck3['default'])(this, Popup);
+
+ this.container = container;
+ this.overflowMethod = overflowMethod || 'cap';
+
+ this.x = 0;
+ this.y = 0;
+ this.padding = 5;
+ this.hidden = false;
+
+ // create the frame
+ this.frame = document.createElement('div');
+ this.frame.className = 'vis-tooltip';
+ this.container.appendChild(this.frame);
+ }
+
+ /**
+ * @param {number} x Horizontal position of the popup window
+ * @param {number} y Vertical position of the popup window
+ */
+
+
+ (0, _createClass3['default'])(Popup, [{
+ key: 'setPosition',
+ value: function setPosition(x, y) {
+ this.x = parseInt(x);
+ this.y = parseInt(y);
+ }
+
+ /**
+ * Set the content for the popup window. This can be HTML code or text.
+ * @param {string | Element} content
+ */
+
+ }, {
+ key: 'setText',
+ value: function setText(content) {
+ if (content instanceof Element) {
+ this.frame.innerHTML = '';
+ this.frame.appendChild(content);
+ } else {
+ this.frame.innerHTML = content; // string containing text or HTML
+ }
+ }
+
+ /**
+ * Show the popup window
+ * @param {boolean} [doShow] Show or hide the window
+ */
+
+ }, {
+ key: 'show',
+ value: function show(doShow) {
+ if (doShow === undefined) {
+ doShow = true;
+ }
+
+ if (doShow === true) {
+ var height = this.frame.clientHeight;
+ var width = this.frame.clientWidth;
+ var maxHeight = this.frame.parentNode.clientHeight;
+ var maxWidth = this.frame.parentNode.clientWidth;
+
+ var left = 0,
+ top = 0;
+
+ if (this.overflowMethod == 'flip') {
+ var isLeft = false,
+ isTop = true; // Where around the position it's located
+
+ if (this.y - height < this.padding) {
+ isTop = false;
+ }
+
+ if (this.x + width > maxWidth - this.padding) {
+ isLeft = true;
+ }
+
+ if (isLeft) {
+ left = this.x - width;
+ } else {
+ left = this.x;
+ }
+
+ if (isTop) {
+ top = this.y - height;
+ } else {
+ top = this.y;
+ }
+ } else {
+ top = this.y - height;
+ if (top + height + this.padding > maxHeight) {
+ top = maxHeight - height - this.padding;
+ }
+ if (top < this.padding) {
+ top = this.padding;
+ }
+
+ left = this.x;
+ if (left + width + this.padding > maxWidth) {
+ left = maxWidth - width - this.padding;
+ }
+ if (left < this.padding) {
+ left = this.padding;
+ }
+ }
+
+ this.frame.style.left = left + "px";
+ this.frame.style.top = top + "px";
+ this.frame.style.visibility = "visible";
+ this.hidden = false;
+ } else {
+ this.hide();
+ }
+ }
+
+ /**
+ * Hide the popup window
+ */
+
+ }, {
+ key: 'hide',
+ value: function hide() {
+ this.hidden = true;
+ this.frame.style.visibility = "hidden";
+ }
+
+ /**
+ * Remove the popup window
+ */
+
+ }, {
+ key: 'destroy',
+ value: function destroy() {
+ this.frame.parentNode.removeChild(this.frame); // Remove element from DOM
+ }
+ }]);
+ return Popup;
+ }();
+
+ exports['default'] = Popup;
+
+/***/ },
+/* 129 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var moment = __webpack_require__(84);
+ var DateUtil = __webpack_require__(125);
+ var util = __webpack_require__(1);
+
+ /**
+ * @constructor TimeStep
+ * The class TimeStep is an iterator for dates. You provide a start date and an
+ * end date. The class itself determines the best scale (step size) based on the
+ * provided start Date, end Date, and minimumStep.
+ *
+ * If minimumStep is provided, the step size is chosen as close as possible
+ * to the minimumStep but larger than minimumStep. If minimumStep is not
+ * provided, the scale is set to 1 DAY.
+ * The minimumStep should correspond with the onscreen size of about 6 characters
+ *
+ * Alternatively, you can set a scale by hand.
+ * After creation, you can initialize the class by executing first(). Then you
+ * can iterate from the start date to the end date via next(). You can check if
+ * the end date is reached with the function hasNext(). After each step, you can
+ * retrieve the current date via getCurrent().
+ * The TimeStep has scales ranging from milliseconds, seconds, minutes, hours,
+ * days, to years.
+ *
+ * Version: 1.2
+ *
+ * @param {Date} [start] The start date, for example new Date(2010, 9, 21)
+ * or new Date(2010, 9, 21, 23, 45, 00)
+ * @param {Date} [end] The end date
+ * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds
+ */
+ function TimeStep(start, end, minimumStep, hiddenDates) {
+ this.moment = moment;
+
+ // variables
+ this.current = this.moment();
+ this._start = this.moment();
+ this._end = this.moment();
+
+ this.autoScale = true;
+ this.scale = 'day';
+ this.step = 1;
+
+ // initialize the range
+ this.setRange(start, end, minimumStep);
+
+ // hidden Dates options
+ this.switchedDay = false;
+ this.switchedMonth = false;
+ this.switchedYear = false;
+ if (Array.isArray(hiddenDates)) {
+ this.hiddenDates = hiddenDates;
+ } else if (hiddenDates != undefined) {
+ this.hiddenDates = [hiddenDates];
+ } else {
+ this.hiddenDates = [];
+ }
+
+ this.format = TimeStep.FORMAT; // default formatting
+ }
+
+ // Time formatting
+ TimeStep.FORMAT = {
+ minorLabels: {
+ millisecond: 'SSS',
+ second: 's',
+ minute: 'HH:mm',
+ hour: 'HH:mm',
+ weekday: 'ddd D',
+ day: 'D',
+ month: 'MMM',
+ year: 'YYYY'
+ },
+ majorLabels: {
+ millisecond: 'HH:mm:ss',
+ second: 'D MMMM HH:mm',
+ minute: 'ddd D MMMM',
+ hour: 'ddd D MMMM',
+ weekday: 'MMMM YYYY',
+ day: 'MMMM YYYY',
+ month: 'YYYY',
+ year: ''
+ }
+ };
+
+ /**
+ * Set custom constructor function for moment. Can be used to set dates
+ * to UTC or to set a utcOffset.
+ * @param {function} moment
+ */
+ TimeStep.prototype.setMoment = function (moment) {
+ this.moment = moment;
+
+ // update the date properties, can have a new utcOffset
+ this.current = this.moment(this.current.valueOf());
+ this._start = this.moment(this._start.valueOf());
+ this._end = this.moment(this._end.valueOf());
+ };
+
+ /**
+ * Set custom formatting for the minor an major labels of the TimeStep.
+ * Both `minorLabels` and `majorLabels` are an Object with properties:
+ * 'millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'.
+ * @param {{minorLabels: Object, majorLabels: Object}} format
+ */
+ TimeStep.prototype.setFormat = function (format) {
+ var defaultFormat = util.deepExtend({}, TimeStep.FORMAT);
+ this.format = util.deepExtend(defaultFormat, format);
+ };
+
+ /**
+ * Set a new range
+ * If minimumStep is provided, the step size is chosen as close as possible
+ * to the minimumStep but larger than minimumStep. If minimumStep is not
+ * provided, the scale is set to 1 DAY.
+ * The minimumStep should correspond with the onscreen size of about 6 characters
+ * @param {Date} [start] The start date and time.
+ * @param {Date} [end] The end date and time.
+ * @param {int} [minimumStep] Optional. Minimum step size in milliseconds
+ */
+ TimeStep.prototype.setRange = function (start, end, minimumStep) {
+ if (!(start instanceof Date) || !(end instanceof Date)) {
+ throw "No legal start or end date in method setRange";
+ }
+
+ this._start = start != undefined ? this.moment(start.valueOf()) : new Date();
+ this._end = end != undefined ? this.moment(end.valueOf()) : new Date();
+
+ if (this.autoScale) {
+ this.setMinimumStep(minimumStep);
+ }
+ };
+
+ /**
+ * Set the range iterator to the start date.
+ */
+ TimeStep.prototype.start = function () {
+ this.current = this._start.clone();
+ this.roundToMinor();
+ };
+
+ /**
+ * Round the current date to the first minor date value
+ * This must be executed once when the current date is set to start Date
+ */
+ TimeStep.prototype.roundToMinor = function () {
+ // round to floor
+ // IMPORTANT: we have no breaks in this switch! (this is no bug)
+ // noinspection FallThroughInSwitchStatementJS
+ switch (this.scale) {
+ case 'year':
+ this.current.year(this.step * Math.floor(this.current.year() / this.step));
+ this.current.month(0);
+ case 'month':
+ this.current.date(1);
+ case 'day': // intentional fall through
+ case 'weekday':
+ this.current.hours(0);
+ case 'hour':
+ this.current.minutes(0);
+ case 'minute':
+ this.current.seconds(0);
+ case 'second':
+ this.current.milliseconds(0);
+ //case 'millisecond': // nothing to do for milliseconds
+ }
+
+ if (this.step != 1) {
+ // round down to the first minor value that is a multiple of the current step size
+ switch (this.scale) {
+ case 'millisecond':
+ this.current.subtract(this.current.milliseconds() % this.step, 'milliseconds');break;
+ case 'second':
+ this.current.subtract(this.current.seconds() % this.step, 'seconds');break;
+ case 'minute':
+ this.current.subtract(this.current.minutes() % this.step, 'minutes');break;
+ case 'hour':
+ this.current.subtract(this.current.hours() % this.step, 'hours');break;
+ case 'weekday': // intentional fall through
+ case 'day':
+ this.current.subtract((this.current.date() - 1) % this.step, 'day');break;
+ case 'month':
+ this.current.subtract(this.current.month() % this.step, 'month');break;
+ case 'year':
+ this.current.subtract(this.current.year() % this.step, 'year');break;
+ default:
+ break;
+ }
+ }
+ };
+
+ /**
+ * Check if the there is a next step
+ * @return {boolean} true if the current date has not passed the end date
+ */
+ TimeStep.prototype.hasNext = function () {
+ return this.current.valueOf() <= this._end.valueOf();
+ };
+
+ /**
+ * Do the next step
+ */
+ TimeStep.prototype.next = function () {
+ var prev = this.current.valueOf();
+
+ // Two cases, needed to prevent issues with switching daylight savings
+ // (end of March and end of October)
+ if (this.current.month() < 6) {
+ switch (this.scale) {
+ case 'millisecond':
+ this.current.add(this.step, 'millisecond');break;
+ case 'second':
+ this.current.add(this.step, 'second');break;
+ case 'minute':
+ this.current.add(this.step, 'minute');break;
+ case 'hour':
+ this.current.add(this.step, 'hour');
+ // in case of skipping an hour for daylight savings, adjust the hour again (else you get: 0h 5h 9h ... instead of 0h 4h 8h ...)
+ // TODO: is this still needed now we use the function of moment.js?
+ this.current.subtract(this.current.hours() % this.step, 'hour');
+ break;
+ case 'weekday': // intentional fall through
+ case 'day':
+ this.current.add(this.step, 'day');break;
+ case 'month':
+ this.current.add(this.step, 'month');break;
+ case 'year':
+ this.current.add(this.step, 'year');break;
+ default:
+ break;
+ }
+ } else {
+ switch (this.scale) {
+ case 'millisecond':
+ this.current.add(this.step, 'millisecond');break;
+ case 'second':
+ this.current.add(this.step, 'second');break;
+ case 'minute':
+ this.current.add(this.step, 'minute');break;
+ case 'hour':
+ this.current.add(this.moment.duration(this.step, 'hour'));
+
+ // correct for daylight saving
+ // FIXME: use this.current.add(moment.duration(this.step, 'hour'))
+ // see http://momentjs.com/docs/#special-considerations-for-months-and-years
+ if (this.current.hours() % this.step !== 0) {
+ this.current.add(this.step - this.current.hours() % this.step, 'hour');
+ }
+
+ break;
+ case 'weekday': // intentional fall through
+ case 'day':
+ this.current.add(this.step, 'day');break;
+ case 'month':
+ this.current.add(this.step, 'month');break;
+ case 'year':
+ this.current.add(this.step, 'year');break;
+ default:
+ break;
+ }
+ }
+
+ if (this.step != 1) {
+ // round down to the correct major value
+ switch (this.scale) {
+ case 'millisecond':
+ if (this.current.milliseconds() > 0 && this.current.milliseconds() < this.step) this.current.milliseconds(0);break;
+ case 'second':
+ if (this.current.seconds() > 0 && this.current.seconds() < this.step) this.current.seconds(0);break;
+ case 'minute':
+ if (this.current.minutes() > 0 && this.current.minutes() < this.step) this.current.minutes(0);break;
+ case 'hour':
+ if (this.current.hours() > 0 && this.current.hours() < this.step) this.current.hours(0);break;
+ case 'weekday': // intentional fall through
+ case 'day':
+ if (this.current.date() < this.step + 1) this.current.date(1);break;
+ case 'month':
+ if (this.current.month() < this.step) this.current.month(0);break;
+ case 'year':
+ break; // nothing to do for year
+ default:
+ break;
+ }
+ }
+
+ // safety mechanism: if current time is still unchanged, move to the end
+ if (this.current.valueOf() == prev) {
+ this.current = this._end.clone();
+ }
+
+ // Reset switches for year, month and day. Will get set to true where appropriate in DateUtil.stepOverHiddenDates
+ this.switchedDay = false;
+ this.switchedMonth = false;
+ this.switchedYear = false;
+
+ DateUtil.stepOverHiddenDates(this.moment, this, prev);
+ };
+
+ /**
+ * Get the current datetime
+ * @return {Moment} current The current date
+ */
+ TimeStep.prototype.getCurrent = function () {
+ return this.current;
+ };
+
+ /**
+ * Set a custom scale. Autoscaling will be disabled.
+ * For example setScale('minute', 5) will result
+ * in minor steps of 5 minutes, and major steps of an hour.
+ *
+ * @param {{scale: string, step: number}} params
+ * An object containing two properties:
+ * - A string 'scale'. Choose from 'millisecond', 'second',
+ * 'minute', 'hour', 'weekday', 'day', 'month', 'year'.
+ * - A number 'step'. A step size, by default 1.
+ * Choose for example 1, 2, 5, or 10.
+ */
+ TimeStep.prototype.setScale = function (params) {
+ if (params && typeof params.scale == 'string') {
+ this.scale = params.scale;
+ this.step = params.step > 0 ? params.step : 1;
+ this.autoScale = false;
+ }
+ };
+
+ /**
+ * Enable or disable autoscaling
+ * @param {boolean} enable If true, autoascaling is set true
+ */
+ TimeStep.prototype.setAutoScale = function (enable) {
+ this.autoScale = enable;
+ };
+
+ /**
+ * Automatically determine the scale that bests fits the provided minimum step
+ * @param {Number} [minimumStep] The minimum step size in milliseconds
+ */
+ TimeStep.prototype.setMinimumStep = function (minimumStep) {
+ if (minimumStep == undefined) {
+ return;
+ }
+
+ //var b = asc + ds;
+
+ var stepYear = 1000 * 60 * 60 * 24 * 30 * 12;
+ var stepMonth = 1000 * 60 * 60 * 24 * 30;
+ var stepDay = 1000 * 60 * 60 * 24;
+ var stepHour = 1000 * 60 * 60;
+ var stepMinute = 1000 * 60;
+ var stepSecond = 1000;
+ var stepMillisecond = 1;
+
+ // find the smallest step that is larger than the provided minimumStep
+ if (stepYear * 1000 > minimumStep) {
+ this.scale = 'year';this.step = 1000;
+ }
+ if (stepYear * 500 > minimumStep) {
+ this.scale = 'year';this.step = 500;
+ }
+ if (stepYear * 100 > minimumStep) {
+ this.scale = 'year';this.step = 100;
+ }
+ if (stepYear * 50 > minimumStep) {
+ this.scale = 'year';this.step = 50;
+ }
+ if (stepYear * 10 > minimumStep) {
+ this.scale = 'year';this.step = 10;
+ }
+ if (stepYear * 5 > minimumStep) {
+ this.scale = 'year';this.step = 5;
+ }
+ if (stepYear > minimumStep) {
+ this.scale = 'year';this.step = 1;
+ }
+ if (stepMonth * 3 > minimumStep) {
+ this.scale = 'month';this.step = 3;
+ }
+ if (stepMonth > minimumStep) {
+ this.scale = 'month';this.step = 1;
+ }
+ if (stepDay * 5 > minimumStep) {
+ this.scale = 'day';this.step = 5;
+ }
+ if (stepDay * 2 > minimumStep) {
+ this.scale = 'day';this.step = 2;
+ }
+ if (stepDay > minimumStep) {
+ this.scale = 'day';this.step = 1;
+ }
+ if (stepDay / 2 > minimumStep) {
+ this.scale = 'weekday';this.step = 1;
+ }
+ if (stepHour * 4 > minimumStep) {
+ this.scale = 'hour';this.step = 4;
+ }
+ if (stepHour > minimumStep) {
+ this.scale = 'hour';this.step = 1;
+ }
+ if (stepMinute * 15 > minimumStep) {
+ this.scale = 'minute';this.step = 15;
+ }
+ if (stepMinute * 10 > minimumStep) {
+ this.scale = 'minute';this.step = 10;
+ }
+ if (stepMinute * 5 > minimumStep) {
+ this.scale = 'minute';this.step = 5;
+ }
+ if (stepMinute > minimumStep) {
+ this.scale = 'minute';this.step = 1;
+ }
+ if (stepSecond * 15 > minimumStep) {
+ this.scale = 'second';this.step = 15;
+ }
+ if (stepSecond * 10 > minimumStep) {
+ this.scale = 'second';this.step = 10;
+ }
+ if (stepSecond * 5 > minimumStep) {
+ this.scale = 'second';this.step = 5;
+ }
+ if (stepSecond > minimumStep) {
+ this.scale = 'second';this.step = 1;
+ }
+ if (stepMillisecond * 200 > minimumStep) {
+ this.scale = 'millisecond';this.step = 200;
+ }
+ if (stepMillisecond * 100 > minimumStep) {
+ this.scale = 'millisecond';this.step = 100;
+ }
+ if (stepMillisecond * 50 > minimumStep) {
+ this.scale = 'millisecond';this.step = 50;
+ }
+ if (stepMillisecond * 10 > minimumStep) {
+ this.scale = 'millisecond';this.step = 10;
+ }
+ if (stepMillisecond * 5 > minimumStep) {
+ this.scale = 'millisecond';this.step = 5;
+ }
+ if (stepMillisecond > minimumStep) {
+ this.scale = 'millisecond';this.step = 1;
+ }
+ };
+
+ /**
+ * Snap a date to a rounded value.
+ * The snap intervals are dependent on the current scale and step.
+ * Static function
+ * @param {Date} date the date to be snapped.
+ * @param {string} scale Current scale, can be 'millisecond', 'second',
+ * 'minute', 'hour', 'weekday, 'day', 'month', 'year'.
+ * @param {number} step Current step (1, 2, 4, 5, ...
+ * @return {Date} snappedDate
+ */
+ TimeStep.snap = function (date, scale, step) {
+ var clone = moment(date);
+
+ if (scale == 'year') {
+ var year = clone.year() + Math.round(clone.month() / 12);
+ clone.year(Math.round(year / step) * step);
+ clone.month(0);
+ clone.date(0);
+ clone.hours(0);
+ clone.minutes(0);
+ clone.seconds(0);
+ clone.milliseconds(0);
+ } else if (scale == 'month') {
+ if (clone.date() > 15) {
+ clone.date(1);
+ clone.add(1, 'month');
+ // important: first set Date to 1, after that change the month.
+ } else {
+ clone.date(1);
+ }
+
+ clone.hours(0);
+ clone.minutes(0);
+ clone.seconds(0);
+ clone.milliseconds(0);
+ } else if (scale == 'day') {
+ //noinspection FallthroughInSwitchStatementJS
+ switch (step) {
+ case 5:
+ case 2:
+ clone.hours(Math.round(clone.hours() / 24) * 24);break;
+ default:
+ clone.hours(Math.round(clone.hours() / 12) * 12);break;
+ }
+ clone.minutes(0);
+ clone.seconds(0);
+ clone.milliseconds(0);
+ } else if (scale == 'weekday') {
+ //noinspection FallthroughInSwitchStatementJS
+ switch (step) {
+ case 5:
+ case 2:
+ clone.hours(Math.round(clone.hours() / 12) * 12);break;
+ default:
+ clone.hours(Math.round(clone.hours() / 6) * 6);break;
+ }
+ clone.minutes(0);
+ clone.seconds(0);
+ clone.milliseconds(0);
+ } else if (scale == 'hour') {
+ switch (step) {
+ case 4:
+ clone.minutes(Math.round(clone.minutes() / 60) * 60);break;
+ default:
+ clone.minutes(Math.round(clone.minutes() / 30) * 30);break;
+ }
+ clone.seconds(0);
+ clone.milliseconds(0);
+ } else if (scale == 'minute') {
+ //noinspection FallthroughInSwitchStatementJS
+ switch (step) {
+ case 15:
+ case 10:
+ clone.minutes(Math.round(clone.minutes() / 5) * 5);
+ clone.seconds(0);
+ break;
+ case 5:
+ clone.seconds(Math.round(clone.seconds() / 60) * 60);break;
+ default:
+ clone.seconds(Math.round(clone.seconds() / 30) * 30);break;
+ }
+ clone.milliseconds(0);
+ } else if (scale == 'second') {
+ //noinspection FallthroughInSwitchStatementJS
+ switch (step) {
+ case 15:
+ case 10:
+ clone.seconds(Math.round(clone.seconds() / 5) * 5);
+ clone.milliseconds(0);
+ break;
+ case 5:
+ clone.milliseconds(Math.round(clone.milliseconds() / 1000) * 1000);break;
+ default:
+ clone.milliseconds(Math.round(clone.milliseconds() / 500) * 500);break;
+ }
+ } else if (scale == 'millisecond') {
+ var _step = step > 5 ? step / 2 : 1;
+ clone.milliseconds(Math.round(clone.milliseconds() / _step) * _step);
+ }
+
+ return clone;
+ };
+
+ /**
+ * Check if the current value is a major value (for example when the step
+ * is DAY, a major value is each first day of the MONTH)
+ * @return {boolean} true if current date is major, else false.
+ */
+ TimeStep.prototype.isMajor = function () {
+ if (this.switchedYear == true) {
+ switch (this.scale) {
+ case 'year':
+ case 'month':
+ case 'weekday':
+ case 'day':
+ case 'hour':
+ case 'minute':
+ case 'second':
+ case 'millisecond':
+ return true;
+ default:
+ return false;
+ }
+ } else if (this.switchedMonth == true) {
+ switch (this.scale) {
+ case 'weekday':
+ case 'day':
+ case 'hour':
+ case 'minute':
+ case 'second':
+ case 'millisecond':
+ return true;
+ default:
+ return false;
+ }
+ } else if (this.switchedDay == true) {
+ switch (this.scale) {
+ case 'millisecond':
+ case 'second':
+ case 'minute':
+ case 'hour':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ var date = this.moment(this.current);
+ switch (this.scale) {
+ case 'millisecond':
+ return date.milliseconds() == 0;
+ case 'second':
+ return date.seconds() == 0;
+ case 'minute':
+ return date.hours() == 0 && date.minutes() == 0;
+ case 'hour':
+ return date.hours() == 0;
+ case 'weekday': // intentional fall through
+ case 'day':
+ return date.date() == 1;
+ case 'month':
+ return date.month() == 0;
+ case 'year':
+ return false;
+ default:
+ return false;
+ }
+ };
+
+ /**
+ * Returns formatted text for the minor axislabel, depending on the current
+ * date and the scale. For example when scale is MINUTE, the current time is
+ * formatted as "hh:mm".
+ * @param {Date} [date] custom date. if not provided, current date is taken
+ */
+ TimeStep.prototype.getLabelMinor = function (date) {
+ if (date == undefined) {
+ date = this.current;
+ }
+
+ if (typeof this.format.minorLabels === "function") {
+ return this.format.minorLabels(date, this.scale, this.step);
+ }
+
+ var format = this.format.minorLabels[this.scale];
+ return format && format.length > 0 ? this.moment(date).format(format) : '';
+ };
+
+ /**
+ * Returns formatted text for the major axis label, depending on the current
+ * date and the scale. For example when scale is MINUTE, the major scale is
+ * hours, and the hour will be formatted as "hh".
+ * @param {Date} [date] custom date. if not provided, current date is taken
+ */
+ TimeStep.prototype.getLabelMajor = function (date) {
+ if (date == undefined) {
+ date = this.current;
+ }
+
+ if (typeof this.format.majorLabels === "function") {
+ return this.format.majorLabels(date, this.scale, this.step);
+ }
+
+ var format = this.format.majorLabels[this.scale];
+ return format && format.length > 0 ? this.moment(date).format(format) : '';
+ };
+
+ TimeStep.prototype.getClassName = function () {
+ var _moment = this.moment;
+ var m = this.moment(this.current);
+ var current = m.locale ? m.locale('en') : m.lang('en'); // old versions of moment have .lang() function
+ var step = this.step;
+
+ function even(value) {
+ return value / step % 2 == 0 ? ' vis-even' : ' vis-odd';
+ }
+
+ function today(date) {
+ if (date.isSame(new Date(), 'day')) {
+ return ' vis-today';
+ }
+ if (date.isSame(_moment().add(1, 'day'), 'day')) {
+ return ' vis-tomorrow';
+ }
+ if (date.isSame(_moment().add(-1, 'day'), 'day')) {
+ return ' vis-yesterday';
+ }
+ return '';
+ }
+
+ function currentWeek(date) {
+ return date.isSame(new Date(), 'week') ? ' vis-current-week' : '';
+ }
+
+ function currentMonth(date) {
+ return date.isSame(new Date(), 'month') ? ' vis-current-month' : '';
+ }
+
+ function currentYear(date) {
+ return date.isSame(new Date(), 'year') ? ' vis-current-year' : '';
+ }
+
+ switch (this.scale) {
+ case 'millisecond':
+ return today(current) + even(current.milliseconds()).trim();
+
+ case 'second':
+ return today(current) + even(current.seconds()).trim();
+
+ case 'minute':
+ return today(current) + even(current.minutes()).trim();
+
+ case 'hour':
+ return 'vis-h' + current.hours() + (this.step == 4 ? '-h' + (current.hours() + 4) : '') + today(current) + even(current.hours());
+
+ case 'weekday':
+ return 'vis-' + current.format('dddd').toLowerCase() + today(current) + currentWeek(current) + even(current.date());
+
+ case 'day':
+ return 'vis-day' + current.date() + ' vis-' + current.format('MMMM').toLowerCase() + today(current) + currentMonth(current) + (this.step <= 2 ? today(current) : '') + (this.step <= 2 ? ' vis-' + current.format('dddd').toLowerCase() : '' + even(current.date() - 1));
+
+ case 'month':
+ return 'vis-' + current.format('MMMM').toLowerCase() + currentMonth(current) + even(current.month());
+
+ case 'year':
+ var year = current.year();
+ return 'vis-year' + year + currentYear(current) + even(year);
+
+ default:
+ return '';
+ }
+ };
+
+ module.exports = TimeStep;
+
+/***/ },
+/* 130 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var stack = __webpack_require__(131);
+ var RangeItem = __webpack_require__(132);
+
+ /**
+ * @constructor Group
+ * @param {Number | String} groupId
+ * @param {Object} data
+ * @param {ItemSet} itemSet
+ */
+ function Group(groupId, data, itemSet) {
+ this.groupId = groupId;
+ this.subgroups = {};
+ this.subgroupIndex = 0;
+ this.subgroupOrderer = data && data.subgroupOrder;
+ this.itemSet = itemSet;
+ this.isVisible = null;
+
+ if (data && data.nestedGroups) {
+ this.nestedGroups = data.nestedGroups;
+ if (data.showNested == false) {
+ this.showNested = false;
+ } else {
+ this.showNested = true;
+ }
+ }
+
+ this.nestedInGroup = null;
+
+ this.dom = {};
+ this.props = {
+ label: {
+ width: 0,
+ height: 0
+ }
+ };
+ this.className = null;
+
+ this.items = {}; // items filtered by groupId of this group
+ this.visibleItems = []; // items currently visible in window
+ this.itemsInRange = []; // items currently in range
+ this.orderedItems = {
+ byStart: [],
+ byEnd: []
+ };
+ this.checkRangedItems = false; // needed to refresh the ranged items if the window is programatically changed with NO overlap.
+ var me = this;
+ this.itemSet.body.emitter.on("checkRangedItems", function () {
+ me.checkRangedItems = true;
+ });
+
+ this._create();
+
+ this.setData(data);
+ }
+
+ /**
+ * Create DOM elements for the group
+ * @private
+ */
+ Group.prototype._create = function () {
+ var label = document.createElement('div');
+ if (this.itemSet.options.groupEditable.order) {
+ label.className = 'vis-label draggable';
+ } else {
+ label.className = 'vis-label';
+ }
+ this.dom.label = label;
+
+ var inner = document.createElement('div');
+ inner.className = 'vis-inner';
+ label.appendChild(inner);
+ this.dom.inner = inner;
+
+ var foreground = document.createElement('div');
+ foreground.className = 'vis-group';
+ foreground['timeline-group'] = this;
+ this.dom.foreground = foreground;
+
+ this.dom.background = document.createElement('div');
+ this.dom.background.className = 'vis-group';
+
+ this.dom.axis = document.createElement('div');
+ this.dom.axis.className = 'vis-group';
+
+ // create a hidden marker to detect when the Timelines container is attached
+ // to the DOM, or the style of a parent of the Timeline is changed from
+ // display:none is changed to visible.
+ this.dom.marker = document.createElement('div');
+ this.dom.marker.style.visibility = 'hidden';
+ this.dom.marker.style.position = 'absolute';
+ this.dom.marker.innerHTML = '';
+ this.dom.background.appendChild(this.dom.marker);
+ };
+
+ /**
+ * Set the group data for this group
+ * @param {Object} data Group data, can contain properties content and className
+ */
+ Group.prototype.setData = function (data) {
+ // update contents
+ var content;
+ var templateFunction;
+
+ if (this.itemSet.options && this.itemSet.options.groupTemplate) {
+ templateFunction = this.itemSet.options.groupTemplate.bind(this);
+ content = templateFunction(data, this.dom.inner);
+ } else {
+ content = data && data.content;
+ }
+
+ if (content instanceof Element) {
+ this.dom.inner.appendChild(content);
+ while (this.dom.inner.firstChild) {
+ this.dom.inner.removeChild(this.dom.inner.firstChild);
+ }
+ this.dom.inner.appendChild(content);
+ } else if (content instanceof Object) {
+ templateFunction(data, this.dom.inner);
+ } else if (content !== undefined && content !== null) {
+ this.dom.inner.innerHTML = content;
+ } else {
+ this.dom.inner.innerHTML = this.groupId || ''; // groupId can be null
+ }
+
+ // update title
+ this.dom.label.title = data && data.title || '';
+ if (!this.dom.inner.firstChild) {
+ util.addClassName(this.dom.inner, 'vis-hidden');
+ } else {
+ util.removeClassName(this.dom.inner, 'vis-hidden');
+ }
+
+ if (data && data.nestedGroups) {
+ if (data.showNested == false) {
+ this.showNested = false;
+ } else {
+ this.showNested = true;
+ }
+
+ util.addClassName(this.dom.label, 'vis-nesting-group');
+ if (this.showNested) {
+ util.removeClassName(this.dom.label, 'collapsed');
+ util.addClassName(this.dom.label, 'expanded');
+ } else {
+ util.removeClassName(this.dom.label, 'expanded');
+ var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed';
+ util.addClassName(this.dom.label, collapsedDirClassName);
+ }
+ }
+
+ if (data && data.nestedInGroup) {
+ util.addClassName(this.dom.label, 'vis-nested-group');
+ if (this.itemSet.options && this.itemSet.options.rtl) {
+ this.dom.inner.style.paddingRight = '30px';
+ } else {
+ this.dom.inner.style.paddingLeft = '30px';
+ }
+ }
+
+ // update className
+ var className = data && data.className || null;
+ if (className != this.className) {
+ if (this.className) {
+ util.removeClassName(this.dom.label, this.className);
+ util.removeClassName(this.dom.foreground, this.className);
+ util.removeClassName(this.dom.background, this.className);
+ util.removeClassName(this.dom.axis, this.className);
+ }
+ util.addClassName(this.dom.label, className);
+ util.addClassName(this.dom.foreground, className);
+ util.addClassName(this.dom.background, className);
+ util.addClassName(this.dom.axis, className);
+ this.className = className;
+ }
+
+ // update style
+ if (this.style) {
+ util.removeCssText(this.dom.label, this.style);
+ this.style = null;
+ }
+ if (data && data.style) {
+ util.addCssText(this.dom.label, data.style);
+ this.style = data.style;
+ }
+ };
+
+ /**
+ * Get the width of the group label
+ * @return {number} width
+ */
+ Group.prototype.getLabelWidth = function () {
+ return this.props.label.width;
+ };
+
+ /**
+ * Repaint this group
+ * @param {{start: number, end: number}} range
+ * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin
+ * @param {boolean} [restack=false] Force restacking of all items
+ * @return {boolean} Returns true if the group is resized
+ */
+ Group.prototype.redraw = function (range, margin, restack) {
+ var resized = false;
+
+ // force recalculation of the height of the items when the marker height changed
+ // (due to the Timeline being attached to the DOM or changed from display:none to visible)
+ var markerHeight = this.dom.marker.clientHeight;
+ if (markerHeight != this.lastMarkerHeight) {
+ this.lastMarkerHeight = markerHeight;
+ util.forEach(this.items, function (item) {
+ item.dirty = true;
+ if (item.displayed) item.redraw();
+ });
+
+ restack = true;
+ }
+
+ // recalculate the height of the subgroups
+ this._calculateSubGroupHeights(margin);
+
+ // calculate actual size and position
+ var foreground = this.dom.foreground;
+ this.top = foreground.offsetTop;
+ this.right = foreground.offsetLeft;
+ this.width = foreground.offsetWidth;
+
+ this.isVisible = this._isGroupVisible(range, margin);
+ // reposition visible items vertically
+ if (typeof this.itemSet.options.order === 'function') {
+ // a custom order function
+
+ if (restack) {
+ // brute force restack of all items
+
+ // show all items
+ var me = this;
+ var limitSize = false;
+ util.forEach(this.items, function (item) {
+ if (!item.displayed) {
+ item.redraw();
+ me.visibleItems.push(item);
+ }
+ item.repositionX(limitSize);
+ });
+
+ // order all items and force a restacking
+ var customOrderedItems = this.orderedItems.byStart.slice().sort(function (a, b) {
+ return me.itemSet.options.order(a.data, b.data);
+ });
+ stack.stack(customOrderedItems, margin, true /* restack=true */);
+ }
+
+ this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range);
+ } else {
+ // no custom order function, lazy stacking
+
+ this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range);
+
+ if (this.itemSet.options.stack) {
+ // TODO: ugly way to access options...
+ stack.stack(this.visibleItems, margin, restack);
+ } else {
+ // no stacking
+ stack.nostack(this.visibleItems, margin, this.subgroups, this.itemSet.options.stackSubgroups);
+ }
+ }
+
+ this._updateSubgroupsSizes();
+
+ // recalculate the height of the group
+ var height = this._calculateHeight(margin);
+
+ // calculate actual size and position
+ var foreground = this.dom.foreground;
+ this.top = foreground.offsetTop;
+ this.right = foreground.offsetLeft;
+ this.width = foreground.offsetWidth;
+ resized = util.updateProperty(this, 'height', height) || resized;
+ // recalculate size of label
+ resized = util.updateProperty(this.props.label, 'width', this.dom.inner.clientWidth) || resized;
+ resized = util.updateProperty(this.props.label, 'height', this.dom.inner.clientHeight) || resized;
+
+ // apply new height
+ this.dom.background.style.height = height + 'px';
+ this.dom.foreground.style.height = height + 'px';
+ this.dom.label.style.height = height + 'px';
+
+ // update vertical position of items after they are re-stacked and the height of the group is calculated
+ for (var i = 0, ii = this.visibleItems.length; i < ii; i++) {
+ var item = this.visibleItems[i];
+ item.repositionY(margin);
+ if (!this.isVisible && this.groupId != "__background__") {
+ if (item.displayed) item.hide();
+ }
+ }
+
+ if (!this.isVisible && this.height) {
+ return resized = false;
+ }
+
+ return resized;
+ };
+
+ /**
+ * recalculate the height of the subgroups
+ * @private
+ */
+ Group.prototype._calculateSubGroupHeights = function (margin) {
+ if ((0, _keys2['default'])(this.subgroups).length > 0) {
+ var me = this;
+
+ this.resetSubgroups();
+
+ util.forEach(this.visibleItems, function (item) {
+ if (item.data.subgroup !== undefined) {
+ me.subgroups[item.data.subgroup].height = Math.max(me.subgroups[item.data.subgroup].height, item.height + margin.item.vertical);
+ me.subgroups[item.data.subgroup].visible = true;
+ }
+ });
+ }
+ };
+
+ /**
+ * check if group is visible
+ * @private
+ */
+ Group.prototype._isGroupVisible = function (range, margin) {
+ var isVisible = this.top <= range.body.domProps.centerContainer.height - range.body.domProps.scrollTop + margin.axis && this.top + this.height + margin.axis >= -range.body.domProps.scrollTop;
+ return isVisible;
+ };
+
+ /**
+ * recalculate the height of the group
+ * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin
+ * @returns {number} Returns the height
+ * @private
+ */
+ Group.prototype._calculateHeight = function (margin) {
+ // recalculate the height of the group
+ var height;
+ var itemsInRange = this.visibleItems;
+ if (itemsInRange.length > 0) {
+ var min = itemsInRange[0].top;
+ var max = itemsInRange[0].top + itemsInRange[0].height;
+ util.forEach(itemsInRange, function (item) {
+ min = Math.min(min, item.top);
+ max = Math.max(max, item.top + item.height);
+ });
+ if (min > margin.axis) {
+ // there is an empty gap between the lowest item and the axis
+ var offset = min - margin.axis;
+ max -= offset;
+ util.forEach(itemsInRange, function (item) {
+ item.top -= offset;
+ });
+ }
+ height = max + margin.item.vertical / 2;
+ } else {
+ height = 0;
+ }
+ height = Math.max(height, this.props.label.height);
+
+ return height;
+ };
+
+ /**
+ * Show this group: attach to the DOM
+ */
+ Group.prototype.show = function () {
+ if (!this.dom.label.parentNode) {
+ this.itemSet.dom.labelSet.appendChild(this.dom.label);
+ }
+
+ if (!this.dom.foreground.parentNode) {
+ this.itemSet.dom.foreground.appendChild(this.dom.foreground);
+ }
+
+ if (!this.dom.background.parentNode) {
+ this.itemSet.dom.background.appendChild(this.dom.background);
+ }
+
+ if (!this.dom.axis.parentNode) {
+ this.itemSet.dom.axis.appendChild(this.dom.axis);
+ }
+ };
+
+ /**
+ * Hide this group: remove from the DOM
+ */
+ Group.prototype.hide = function () {
+ var label = this.dom.label;
+ if (label.parentNode) {
+ label.parentNode.removeChild(label);
+ }
+
+ var foreground = this.dom.foreground;
+ if (foreground.parentNode) {
+ foreground.parentNode.removeChild(foreground);
+ }
+
+ var background = this.dom.background;
+ if (background.parentNode) {
+ background.parentNode.removeChild(background);
+ }
+
+ var axis = this.dom.axis;
+ if (axis.parentNode) {
+ axis.parentNode.removeChild(axis);
+ }
+ };
+
+ /**
+ * Add an item to the group
+ * @param {Item} item
+ */
+ Group.prototype.add = function (item) {
+ this.items[item.id] = item;
+ item.setParent(this);
+
+ // add to
+ if (item.data.subgroup !== undefined) {
+ if (this.subgroups[item.data.subgroup] === undefined) {
+ this.subgroups[item.data.subgroup] = {
+ height: 0,
+ top: 0,
+ start: item.data.start,
+ end: item.data.end,
+ visible: false,
+ index: this.subgroupIndex,
+ items: []
+ };
+ this.subgroupIndex++;
+ }
+
+ if (new Date(item.data.start) < new Date(this.subgroups[item.data.subgroup].start)) {
+ this.subgroups[item.data.subgroup].start = item.data.start;
+ }
+ if (new Date(item.data.end) > new Date(this.subgroups[item.data.subgroup].end)) {
+ this.subgroups[item.data.subgroup].end = item.data.end;
+ }
+
+ this.subgroups[item.data.subgroup].items.push(item);
+ }
+ this.orderSubgroups();
+
+ if (this.visibleItems.indexOf(item) == -1) {
+ var range = this.itemSet.body.range; // TODO: not nice accessing the range like this
+ this._checkIfVisible(item, this.visibleItems, range);
+ }
+ };
+
+ Group.prototype._updateSubgroupsSizes = function () {
+ var me = this;
+ if (me.subgroups) {
+ for (var subgroup in me.subgroups) {
+ var newStart = me.subgroups[subgroup].items[0].data.start;
+ var newEnd = me.subgroups[subgroup].items[0].data.end;
+
+ me.subgroups[subgroup].items.forEach(function (item) {
+ if (new Date(item.data.start) < new Date(newStart)) {
+ newStart = item.data.start;
+ }
+ if (new Date(item.data.end) > new Date(newEnd)) {
+ newEnd = item.data.end;
+ }
+ });
+
+ me.subgroups[subgroup].start = newStart;
+ me.subgroups[subgroup].end = newEnd;
+ }
+ }
+ };
+
+ Group.prototype.orderSubgroups = function () {
+ if (this.subgroupOrderer !== undefined) {
+ var sortArray = [];
+ if (typeof this.subgroupOrderer == 'string') {
+ for (var subgroup in this.subgroups) {
+ sortArray.push({ subgroup: subgroup, sortField: this.subgroups[subgroup].items[0].data[this.subgroupOrderer] });
+ }
+ sortArray.sort(function (a, b) {
+ return a.sortField - b.sortField;
+ });
+ } else if (typeof this.subgroupOrderer == 'function') {
+ for (var subgroup in this.subgroups) {
+ sortArray.push(this.subgroups[subgroup].items[0].data);
+ }
+ sortArray.sort(this.subgroupOrderer);
+ }
+
+ if (sortArray.length > 0) {
+ for (var i = 0; i < sortArray.length; i++) {
+ this.subgroups[sortArray[i].subgroup].index = i;
+ }
+ }
+ }
+ };
+
+ Group.prototype.resetSubgroups = function () {
+ for (var subgroup in this.subgroups) {
+ if (this.subgroups.hasOwnProperty(subgroup)) {
+ this.subgroups[subgroup].visible = false;
+ }
+ }
+ };
+
+ /**
+ * Remove an item from the group
+ * @param {Item} item
+ */
+ Group.prototype.remove = function (item) {
+ delete this.items[item.id];
+ item.setParent(null);
+
+ // remove from visible items
+ var index = this.visibleItems.indexOf(item);
+ if (index != -1) this.visibleItems.splice(index, 1);
+
+ if (item.data.subgroup !== undefined) {
+ var subgroup = this.subgroups[item.data.subgroup];
+ if (subgroup) {
+ var itemIndex = subgroup.items.indexOf(item);
+ subgroup.items.splice(itemIndex, 1);
+ if (!subgroup.items.length) {
+ delete this.subgroups[item.data.subgroup];
+ this.subgroupIndex--;
+ } else {
+ this._updateSubgroupsSizes();
+ }
+ this.orderSubgroups();
+ }
+ }
+ };
+
+ /**
+ * Remove an item from the corresponding DataSet
+ * @param {Item} item
+ */
+ Group.prototype.removeFromDataSet = function (item) {
+ this.itemSet.removeItem(item.id);
+ };
+
+ /**
+ * Reorder the items
+ */
+ Group.prototype.order = function () {
+ var array = util.toArray(this.items);
+ var startArray = [];
+ var endArray = [];
+
+ for (var i = 0; i < array.length; i++) {
+ if (array[i].data.end !== undefined) {
+ endArray.push(array[i]);
+ }
+ startArray.push(array[i]);
+ }
+ this.orderedItems = {
+ byStart: startArray,
+ byEnd: endArray
+ };
+
+ stack.orderByStart(this.orderedItems.byStart);
+ stack.orderByEnd(this.orderedItems.byEnd);
+ };
+
+ /**
+ * Update the visible items
+ * @param {{byStart: Item[], byEnd: Item[]}} orderedItems All items ordered by start date and by end date
+ * @param {Item[]} visibleItems The previously visible items.
+ * @param {{start: number, end: number}} range Visible range
+ * @return {Item[]} visibleItems The new visible items.
+ * @private
+ */
+ Group.prototype._updateItemsInRange = function (orderedItems, oldVisibleItems, range) {
+ var visibleItems = [];
+ var visibleItemsLookup = {}; // we keep this to quickly look up if an item already exists in the list without using indexOf on visibleItems
+
+ var interval = (range.end - range.start) / 4;
+ var lowerBound = range.start - interval;
+ var upperBound = range.end + interval;
+
+ // this function is used to do the binary search.
+ var searchFunction = function searchFunction(value) {
+ if (value < lowerBound) {
+ return -1;
+ } else if (value <= upperBound) {
+ return 0;
+ } else {
+ return 1;
+ }
+ };
+
+ // first check if the items that were in view previously are still in view.
+ // IMPORTANT: this handles the case for the items with startdate before the window and enddate after the window!
+ // also cleans up invisible items.
+ if (oldVisibleItems.length > 0) {
+ for (var i = 0; i < oldVisibleItems.length; i++) {
+ this._checkIfVisibleWithReference(oldVisibleItems[i], visibleItems, visibleItemsLookup, range);
+ }
+ }
+
+ // we do a binary search for the items that have only start values.
+ var initialPosByStart = util.binarySearchCustom(orderedItems.byStart, searchFunction, 'data', 'start');
+
+ // trace the visible items from the inital start pos both ways until an invisible item is found, we only look at the start values.
+ this._traceVisible(initialPosByStart, orderedItems.byStart, visibleItems, visibleItemsLookup, function (item) {
+ return item.data.start < lowerBound || item.data.start > upperBound;
+ });
+
+ // if the window has changed programmatically without overlapping the old window, the ranged items with start < lowerBound and end > upperbound are not shown.
+ // We therefore have to brute force check all items in the byEnd list
+ if (this.checkRangedItems == true) {
+ this.checkRangedItems = false;
+ for (i = 0; i < orderedItems.byEnd.length; i++) {
+ this._checkIfVisibleWithReference(orderedItems.byEnd[i], visibleItems, visibleItemsLookup, range);
+ }
+ } else {
+ // we do a binary search for the items that have defined end times.
+ var initialPosByEnd = util.binarySearchCustom(orderedItems.byEnd, searchFunction, 'data', 'end');
+
+ // trace the visible items from the inital start pos both ways until an invisible item is found, we only look at the end values.
+ this._traceVisible(initialPosByEnd, orderedItems.byEnd, visibleItems, visibleItemsLookup, function (item) {
+ return item.data.end < lowerBound || item.data.end > upperBound;
+ });
+ }
+
+ // finally, we reposition all the visible items.
+ for (var i = 0; i < visibleItems.length; i++) {
+ var item = visibleItems[i];
+ if (!item.displayed) item.show();
+ // reposition item horizontally
+ item.repositionX();
+ }
+
+ return visibleItems;
+ };
+
+ Group.prototype._traceVisible = function (initialPos, items, visibleItems, visibleItemsLookup, breakCondition) {
+ if (initialPos != -1) {
+ for (var i = initialPos; i >= 0; i--) {
+ var item = items[i];
+ if (breakCondition(item)) {
+ break;
+ } else {
+ if (visibleItemsLookup[item.id] === undefined) {
+ visibleItemsLookup[item.id] = true;
+ visibleItems.push(item);
+ }
+ }
+ }
+
+ for (var i = initialPos + 1; i < items.length; i++) {
+ var item = items[i];
+ if (breakCondition(item)) {
+ break;
+ } else {
+ if (visibleItemsLookup[item.id] === undefined) {
+ visibleItemsLookup[item.id] = true;
+ visibleItems.push(item);
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ * this function is very similar to the _checkIfInvisible() but it does not
+ * return booleans, hides the item if it should not be seen and always adds to
+ * the visibleItems.
+ * this one is for brute forcing and hiding.
+ *
+ * @param {Item} item
+ * @param {Array} visibleItems
+ * @param {{start:number, end:number}} range
+ * @private
+ */
+ Group.prototype._checkIfVisible = function (item, visibleItems, range) {
+ if (item.isVisible(range)) {
+ if (!item.displayed) item.show();
+ // reposition item horizontally
+ item.repositionX();
+ visibleItems.push(item);
+ } else {
+ if (item.displayed) item.hide();
+ }
+ };
+
+ /**
+ * this function is very similar to the _checkIfInvisible() but it does not
+ * return booleans, hides the item if it should not be seen and always adds to
+ * the visibleItems.
+ * this one is for brute forcing and hiding.
+ *
+ * @param {Item} item
+ * @param {Array} visibleItems
+ * @param {{start:number, end:number}} range
+ * @private
+ */
+ Group.prototype._checkIfVisibleWithReference = function (item, visibleItems, visibleItemsLookup, range) {
+ if (item.isVisible(range)) {
+ if (visibleItemsLookup[item.id] === undefined) {
+ visibleItemsLookup[item.id] = true;
+ visibleItems.push(item);
+ }
+ } else {
+ if (item.displayed) item.hide();
+ }
+ };
+
+ module.exports = Group;
+
+/***/ },
+/* 131 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ // Utility functions for ordering and stacking of items
+ var EPSILON = 0.001; // used when checking collisions, to prevent round-off errors
+
+ /**
+ * Order items by their start data
+ * @param {Item[]} items
+ */
+ exports.orderByStart = function (items) {
+ items.sort(function (a, b) {
+ return a.data.start - b.data.start;
+ });
+ };
+
+ /**
+ * Order items by their end date. If they have no end date, their start date
+ * is used.
+ * @param {Item[]} items
+ */
+ exports.orderByEnd = function (items) {
+ items.sort(function (a, b) {
+ var aTime = 'end' in a.data ? a.data.end : a.data.start,
+ bTime = 'end' in b.data ? b.data.end : b.data.start;
+
+ return aTime - bTime;
+ });
+ };
+
+ /**
+ * Adjust vertical positions of the items such that they don't overlap each
+ * other.
+ * @param {Item[]} items
+ * All visible items
+ * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin
+ * Margins between items and between items and the axis.
+ * @param {boolean} [force=false]
+ * If true, all items will be repositioned. If false (default), only
+ * items having a top===null will be re-stacked
+ */
+ exports.stack = function (items, margin, force) {
+ if (force) {
+ // reset top position of all items
+ for (var i = 0; i < items.length; i++) {
+ items[i].top = null;
+ }
+ }
+
+ // calculate new, non-overlapping positions
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i];
+ if (item.stack && item.top === null) {
+ // initialize top position
+ item.top = margin.axis;
+
+ do {
+ // TODO: optimize checking for overlap. when there is a gap without items,
+ // you only need to check for items from the next item on, not from zero
+ var collidingItem = null;
+ for (var j = 0, jj = items.length; j < jj; j++) {
+ var other = items[j];
+ if (other.top !== null && other !== item && other.stack && exports.collision(item, other, margin.item, other.options.rtl)) {
+ collidingItem = other;
+ break;
+ }
+ }
+
+ if (collidingItem != null) {
+ // There is a collision. Reposition the items above the colliding element
+ item.top = collidingItem.top + collidingItem.height + margin.item.vertical;
+ }
+ } while (collidingItem);
+ }
+ }
+ };
+
+ /**
+ * Adjust vertical positions of the items without stacking them
+ * @param {Item[]} items
+ * All visible items
+ * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin
+ * Margins between items and between items and the axis.
+ * @param {subgroups[]} subgroups
+ * All subgroups
+ */
+ exports.nostack = function (items, margin, subgroups, stackSubgroups) {
+ for (var i = 0; i < items.length; i++) {
+ if (items[i].data.subgroup == undefined) {
+ items[i].top = margin.item.vertical;
+ } else if (items[i].data.subgroup !== undefined && stackSubgroups) {
+ var newTop = 0;
+ for (var subgroup in subgroups) {
+ if (subgroups.hasOwnProperty(subgroup)) {
+ if (subgroups[subgroup].visible == true && subgroups[subgroup].index < subgroups[items[i].data.subgroup].index) {
+ newTop += subgroups[subgroup].height;
+ subgroups[items[i].data.subgroup].top = newTop;
+ }
+ }
+ }
+ items[i].top = newTop + 0.5 * margin.item.vertical;
+ }
+ }
+ if (!stackSubgroups) {
+ exports.stackSubgroups(items, margin, subgroups);
+ }
+ };
+
+ /**
+ * Adjust vertical positions of the subgroups such that they don't overlap each
+ * other.
+ * @param {subgroups[]} subgroups
+ * All subgroups
+ * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin
+ * Margins between items and between items and the axis.
+ */
+ exports.stackSubgroups = function (items, margin, subgroups) {
+ for (var subgroup in subgroups) {
+ if (subgroups.hasOwnProperty(subgroup)) {
+
+ subgroups[subgroup].top = 0;
+ do {
+ // TODO: optimize checking for overlap. when there is a gap without items,
+ // you only need to check for items from the next item on, not from zero
+ var collidingItem = null;
+ for (var otherSubgroup in subgroups) {
+ if (subgroups[otherSubgroup].top !== null && otherSubgroup !== subgroup && subgroups[subgroup].index > subgroups[otherSubgroup].index && exports.collisionByTimes(subgroups[subgroup], subgroups[otherSubgroup])) {
+ collidingItem = subgroups[otherSubgroup];
+ break;
+ }
+ }
+
+ if (collidingItem != null) {
+ // There is a collision. Reposition the subgroups above the colliding element
+ subgroups[subgroup].top = collidingItem.top + collidingItem.height;
+ }
+ } while (collidingItem);
+ }
+ }
+ for (var i = 0; i < items.length; i++) {
+ if (items[i].data.subgroup !== undefined) {
+ items[i].top = subgroups[items[i].data.subgroup].top + 0.5 * margin.item.vertical;
+ }
+ }
+ };
+
+ /**
+ * Test if the two provided items collide
+ * The items must have parameters left, width, top, and height.
+ * @param {Item} a The first item
+ * @param {Item} b The second item
+ * @param {{horizontal: number, vertical: number}} margin
+ * An object containing a horizontal and vertical
+ * minimum required margin.
+ * @param {boolean} rtl
+ * @return {boolean} true if a and b collide, else false
+ */
+ exports.collision = function (a, b, margin, rtl) {
+ if (rtl) {
+ return a.right - margin.horizontal + EPSILON < b.right + b.width && a.right + a.width + margin.horizontal - EPSILON > b.right && a.top - margin.vertical + EPSILON < b.top + b.height && a.top + a.height + margin.vertical - EPSILON > b.top;
+ } else {
+ return a.left - margin.horizontal + EPSILON < b.left + b.width && a.left + a.width + margin.horizontal - EPSILON > b.left && a.top - margin.vertical + EPSILON < b.top + b.height && a.top + a.height + margin.vertical - EPSILON > b.top;
+ }
+ };
+
+ /**
+ * Test if the two provided objects collide
+ * The objects must have parameters start, end, top, and height.
+ * @param {Object} a The first Object
+ * @param {Object} b The second Object
+ * @return {boolean} true if a and b collide, else false
+ */
+ exports.collisionByTimes = function (a, b) {
+ return a.start <= b.start && a.end >= b.start && a.top < b.top + b.height && a.top + a.height > b.top || b.start <= a.start && b.end >= a.start && b.top < a.top + a.height && b.top + b.height > a.top;
+ };
+
+/***/ },
+/* 132 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var Hammer = __webpack_require__(108);
+ var Item = __webpack_require__(133);
+
+ /**
+ * @constructor RangeItem
+ * @extends Item
+ * @param {Object} data Object containing parameters start, end
+ * content, className.
+ * @param {{toScreen: function, toTime: function}} conversion
+ * Conversion functions from time to screen and vice versa
+ * @param {Object} [options] Configuration options
+ * // TODO: describe options
+ */
+ function RangeItem(data, conversion, options) {
+ this.props = {
+ content: {
+ width: 0
+ }
+ };
+ this.overflow = false; // if contents can overflow (css styling), this flag is set to true
+ this.options = options;
+ // validate data
+ if (data) {
+ if (data.start == undefined) {
+ throw new Error('Property "start" missing in item ' + data.id);
+ }
+ if (data.end == undefined) {
+ throw new Error('Property "end" missing in item ' + data.id);
+ }
+ }
+
+ Item.call(this, data, conversion, options);
+ }
+
+ RangeItem.prototype = new Item(null, null, null);
+
+ RangeItem.prototype.baseClassName = 'vis-item vis-range';
+
+ /**
+ * Check whether this item is visible inside given range
+ * @returns {{start: Number, end: Number}} range with a timestamp for start and end
+ * @returns {boolean} True if visible
+ */
+ RangeItem.prototype.isVisible = function (range) {
+ // determine visibility
+ return this.data.start < range.end && this.data.end > range.start;
+ };
+
+ /**
+ * Repaint the item
+ */
+ RangeItem.prototype.redraw = function () {
+ var dom = this.dom;
+ if (!dom) {
+ // create DOM
+ this.dom = {};
+ dom = this.dom;
+
+ // background box
+ dom.box = document.createElement('div');
+ // className is updated in redraw()
+
+ // frame box (to prevent the item contents from overflowing)
+ dom.frame = document.createElement('div');
+ dom.frame.className = 'vis-item-overflow';
+ dom.box.appendChild(dom.frame);
+
+ // visible frame box (showing the frame that is always visible)
+ dom.visibleFrame = document.createElement('div');
+ dom.visibleFrame.className = 'vis-item-visible-frame';
+ dom.box.appendChild(dom.visibleFrame);
+
+ // contents box
+ dom.content = document.createElement('div');
+ dom.content.className = 'vis-item-content';
+ dom.frame.appendChild(dom.content);
+
+ // attach this item as attribute
+ dom.box['timeline-item'] = this;
+
+ this.dirty = true;
+ }
+
+ // append DOM to parent DOM
+ if (!this.parent) {
+ throw new Error('Cannot redraw item: no parent attached');
+ }
+ if (!dom.box.parentNode) {
+ var foreground = this.parent.dom.foreground;
+ if (!foreground) {
+ throw new Error('Cannot redraw item: parent has no foreground container element');
+ }
+ foreground.appendChild(dom.box);
+ }
+ this.displayed = true;
+
+ // Update DOM when item is marked dirty. An item is marked dirty when:
+ // - the item is not yet rendered
+ // - the item's data is changed
+ // - the item is selected/deselected
+ if (this.dirty) {
+ this._updateContents(this.dom.content);
+ this._updateTitle();
+ this._updateDataAttributes(this.dom.box);
+ this._updateStyle(this.dom.box);
+
+ var editable = (this.options.editable.updateTime || this.options.editable.updateGroup || this.editable === true) && this.editable !== false;
+
+ // update class
+ var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly');
+ dom.box.className = this.baseClassName + className;
+
+ // determine from css whether this box has overflow
+ this.overflow = window.getComputedStyle(dom.frame).overflow !== 'hidden';
+
+ // recalculate size
+ // turn off max-width to be able to calculate the real width
+ // this causes an extra browser repaint/reflow, but so be it
+ this.dom.content.style.maxWidth = 'none';
+ this.props.content.width = this.dom.content.offsetWidth;
+ this.height = this.dom.box.offsetHeight;
+ this.dom.content.style.maxWidth = '';
+
+ this.dirty = false;
+ }
+
+ this._repaintOnItemUpdateTimeTooltip(dom.box);
+ this._repaintDeleteButton(dom.box);
+ this._repaintDragCenter();
+ this._repaintDragLeft();
+ this._repaintDragRight();
+ };
+
+ /**
+ * Show the item in the DOM (when not already visible). The items DOM will
+ * be created when needed.
+ */
+ RangeItem.prototype.show = function () {
+ if (!this.displayed) {
+ this.redraw();
+ }
+ };
+
+ /**
+ * Hide the item from the DOM (when visible)
+ * @return {Boolean} changed
+ */
+ RangeItem.prototype.hide = function () {
+ if (this.displayed) {
+ var box = this.dom.box;
+
+ if (box.parentNode) {
+ box.parentNode.removeChild(box);
+ }
+
+ this.displayed = false;
+ }
+ };
+
+ /**
+ * Reposition the item horizontally
+ * @param {boolean} [limitSize=true] If true (default), the width of the range
+ * item will be limited, as the browser cannot
+ * display very wide divs. This means though
+ * that the applied left and width may
+ * not correspond to the ranges start and end
+ * @Override
+ */
+ RangeItem.prototype.repositionX = function (limitSize) {
+ var parentWidth = this.parent.width;
+ var start = this.conversion.toScreen(this.data.start);
+ var end = this.conversion.toScreen(this.data.end);
+ var contentStartPosition;
+ var contentWidth;
+
+ // limit the width of the range, as browsers cannot draw very wide divs
+ if (limitSize === undefined || limitSize === true) {
+ if (start < -parentWidth) {
+ start = -parentWidth;
+ }
+ if (end > 2 * parentWidth) {
+ end = 2 * parentWidth;
+ }
+ }
+
+ // add 0.5 to compensate floating-point values rounding
+ var boxWidth = Math.max(end - start + 0.5, 1);
+
+ if (this.overflow) {
+ if (this.options.rtl) {
+ this.right = start;
+ } else {
+ this.left = start;
+ }
+ this.width = boxWidth + this.props.content.width;
+ contentWidth = this.props.content.width;
+
+ // Note: The calculation of width is an optimistic calculation, giving
+ // a width which will not change when moving the Timeline
+ // So no re-stacking needed, which is nicer for the eye;
+ } else {
+ if (this.options.rtl) {
+ this.right = start;
+ } else {
+ this.left = start;
+ }
+ this.width = boxWidth;
+ contentWidth = Math.min(end - start, this.props.content.width);
+ }
+
+ if (this.options.rtl) {
+ this.dom.box.style.right = this.right + 'px';
+ } else {
+ this.dom.box.style.left = this.left + 'px';
+ }
+ this.dom.box.style.width = boxWidth + 'px';
+
+ switch (this.options.align) {
+ case 'left':
+ if (this.options.rtl) {
+ this.dom.content.style.right = '0';
+ } else {
+ this.dom.content.style.left = '0';
+ }
+ break;
+
+ case 'right':
+ if (this.options.rtl) {
+ this.dom.content.style.right = Math.max(boxWidth - contentWidth, 0) + 'px';
+ } else {
+ this.dom.content.style.left = Math.max(boxWidth - contentWidth, 0) + 'px';
+ }
+ break;
+
+ case 'center':
+ if (this.options.rtl) {
+ this.dom.content.style.right = Math.max((boxWidth - contentWidth) / 2, 0) + 'px';
+ } else {
+ this.dom.content.style.left = Math.max((boxWidth - contentWidth) / 2, 0) + 'px';
+ }
+
+ break;
+
+ default:
+ // 'auto'
+ // when range exceeds left of the window, position the contents at the left of the visible area
+ if (this.overflow) {
+ if (end > 0) {
+ contentStartPosition = Math.max(-start, 0);
+ } else {
+ contentStartPosition = -contentWidth; // ensure it's not visible anymore
+ }
+ } else {
+ if (start < 0) {
+ contentStartPosition = -start;
+ } else {
+ contentStartPosition = 0;
+ }
+ }
+ if (this.options.rtl) {
+ this.dom.content.style.right = contentStartPosition + 'px';
+ } else {
+ this.dom.content.style.left = contentStartPosition + 'px';
+ this.dom.content.style.width = 'calc(100% - ' + contentStartPosition + 'px)';
+ }
+ }
+ };
+
+ /**
+ * Reposition the item vertically
+ * @Override
+ */
+ RangeItem.prototype.repositionY = function () {
+ var orientation = this.options.orientation.item;
+ var box = this.dom.box;
+
+ if (orientation == 'top') {
+ box.style.top = this.top + 'px';
+ } else {
+ box.style.top = this.parent.height - this.top - this.height + 'px';
+ }
+ };
+
+ /**
+ * Repaint a drag area on the left side of the range when the range is selected
+ * @protected
+ */
+ RangeItem.prototype._repaintDragLeft = function () {
+ if (this.selected && this.options.editable.updateTime && !this.dom.dragLeft) {
+ // create and show drag area
+ var dragLeft = document.createElement('div');
+ dragLeft.className = 'vis-drag-left';
+ dragLeft.dragLeftItem = this;
+
+ this.dom.box.appendChild(dragLeft);
+ this.dom.dragLeft = dragLeft;
+ } else if (!this.selected && this.dom.dragLeft) {
+ // delete drag area
+ if (this.dom.dragLeft.parentNode) {
+ this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft);
+ }
+ this.dom.dragLeft = null;
+ }
+ };
+
+ /**
+ * Repaint a drag area on the right side of the range when the range is selected
+ * @protected
+ */
+ RangeItem.prototype._repaintDragRight = function () {
+ if (this.selected && this.options.editable.updateTime && !this.dom.dragRight) {
+ // create and show drag area
+ var dragRight = document.createElement('div');
+ dragRight.className = 'vis-drag-right';
+ dragRight.dragRightItem = this;
+
+ this.dom.box.appendChild(dragRight);
+ this.dom.dragRight = dragRight;
+ } else if (!this.selected && this.dom.dragRight) {
+ // delete drag area
+ if (this.dom.dragRight.parentNode) {
+ this.dom.dragRight.parentNode.removeChild(this.dom.dragRight);
+ }
+ this.dom.dragRight = null;
+ }
+ };
+
+ module.exports = RangeItem;
+
+/***/ },
+/* 133 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Hammer = __webpack_require__(108);
+ var util = __webpack_require__(1);
+ var moment = __webpack_require__(84);
+
+ /**
+ * @constructor Item
+ * @param {Object} data Object containing (optional) parameters type,
+ * start, end, content, group, className.
+ * @param {{toScreen: function, toTime: function}} conversion
+ * Conversion functions from time to screen and vice versa
+ * @param {Object} options Configuration options
+ * // TODO: describe available options
+ */
+ function Item(data, conversion, options) {
+ this.id = null;
+ this.parent = null;
+ this.data = data;
+ this.dom = null;
+ this.conversion = conversion || {};
+ this.options = options || {};
+ this.selected = false;
+ this.displayed = false;
+ this.groupShowing = true;
+ this.dirty = true;
+ this.popup = null;
+
+ this.top = null;
+ this.right = null;
+ this.left = null;
+ this.width = null;
+ this.height = null;
+
+ this.editable = null;
+ if (this.data && this.data.hasOwnProperty('editable')) {
+ if (typeof this.data.editable === 'boolean') {
+ this.editable = {
+ updateTime: this.data.editable,
+ updateGroup: this.data.editable,
+ remove: this.data.editable
+ };
+ } else if ((0, _typeof3['default'])(options.editable) === 'object') {
+ this.editable = {};
+ util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, data.editable);
+ };
+ }
+ }
+
+ Item.prototype.stack = true;
+
+ /**
+ * Select current item
+ */
+ Item.prototype.select = function () {
+ this.selected = true;
+ this.dirty = true;
+ if (this.displayed) this.redraw();
+ };
+
+ /**
+ * Unselect current item
+ */
+ Item.prototype.unselect = function () {
+ this.selected = false;
+ this.dirty = true;
+ if (this.displayed) this.redraw();
+ };
+
+ /**
+ * Set data for the item. Existing data will be updated. The id should not
+ * be changed. When the item is displayed, it will be redrawn immediately.
+ * @param {Object} data
+ */
+ Item.prototype.setData = function (data) {
+ var groupChanged = data.group != undefined && this.data.group != data.group;
+ if (groupChanged) {
+ this.parent.itemSet._moveToGroup(this, data.group);
+ }
+
+ if (data.hasOwnProperty('editable')) {
+ if (typeof data.editable === 'boolean') {
+ this.editable = {
+ updateTime: this.data.editable,
+ updateGroup: this.data.editable,
+ remove: this.data.editable
+ };
+ } else if ((0, _typeof3['default'])(options.editable) === 'object') {
+ this.editable = {};
+ util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, data.editable);
+ }
+ }
+
+ this.data = data;
+ this.dirty = true;
+ if (this.displayed) this.redraw();
+ };
+
+ /**
+ * Set a parent for the item
+ * @param {ItemSet | Group} parent
+ */
+ Item.prototype.setParent = function (parent) {
+ if (this.displayed) {
+ this.hide();
+ this.parent = parent;
+ if (this.parent) {
+ this.show();
+ }
+ } else {
+ this.parent = parent;
+ }
+ };
+
+ /**
+ * Check whether this item is visible inside given range
+ * @returns {{start: Number, end: Number}} range with a timestamp for start and end
+ * @returns {boolean} True if visible
+ */
+ Item.prototype.isVisible = function (range) {
+ return false;
+ };
+
+ /**
+ * Show the Item in the DOM (when not already visible)
+ * @return {Boolean} changed
+ */
+ Item.prototype.show = function () {
+ return false;
+ };
+
+ /**
+ * Hide the Item from the DOM (when visible)
+ * @return {Boolean} changed
+ */
+ Item.prototype.hide = function () {
+ return false;
+ };
+
+ /**
+ * Repaint the item
+ */
+ Item.prototype.redraw = function () {
+ // should be implemented by the item
+ };
+
+ /**
+ * Reposition the Item horizontally
+ */
+ Item.prototype.repositionX = function () {
+ // should be implemented by the item
+ };
+
+ /**
+ * Reposition the Item vertically
+ */
+ Item.prototype.repositionY = function () {
+ // should be implemented by the item
+ };
+
+ /**
+ * Repaint a drag area on the center of the item when the item is selected
+ * @protected
+ */
+ Item.prototype._repaintDragCenter = function () {
+ if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) {
+ var me = this;
+
+ // create and show drag area
+ var dragCenter = document.createElement('div');
+ dragCenter.className = 'vis-drag-center';
+ dragCenter.dragCenterItem = this;
+
+ new Hammer(dragCenter).on('doubletap', function (event) {
+ event.stopPropagation();
+ me.parent.itemSet._onUpdateItem(me);
+ });
+
+ if (this.dom.box) {
+ this.dom.box.appendChild(dragCenter);
+ } else if (this.dom.point) {
+ this.dom.point.appendChild(dragCenter);
+ }
+
+ this.dom.dragCenter = dragCenter;
+ } else if (!this.selected && this.dom.dragCenter) {
+ // delete drag area
+ if (this.dom.dragCenter.parentNode) {
+ this.dom.dragCenter.parentNode.removeChild(this.dom.dragCenter);
+ }
+ this.dom.dragCenter = null;
+ }
+ };
+
+ /**
+ * Repaint a delete button on the top right of the item when the item is selected
+ * @param {HTMLElement} anchor
+ * @protected
+ */
+ Item.prototype._repaintDeleteButton = function (anchor) {
+ var editable = (this.options.editable.overrideItems || this.editable == null) && this.options.editable.remove || !this.options.editable.overrideItems && this.editable != null && this.editable.remove;
+
+ if (this.selected && editable && !this.dom.deleteButton) {
+ // create and show button
+ var me = this;
+
+ var deleteButton = document.createElement('div');
+
+ if (this.options.rtl) {
+ deleteButton.className = 'vis-delete-rtl';
+ } else {
+ deleteButton.className = 'vis-delete';
+ }
+ deleteButton.title = 'Delete this item';
+
+ // TODO: be able to destroy the delete button
+ new Hammer(deleteButton).on('tap', function (event) {
+ event.stopPropagation();
+ me.parent.removeFromDataSet(me);
+ });
+
+ anchor.appendChild(deleteButton);
+ this.dom.deleteButton = deleteButton;
+ } else if (!this.selected && this.dom.deleteButton) {
+ // remove button
+ if (this.dom.deleteButton.parentNode) {
+ this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton);
+ }
+ this.dom.deleteButton = null;
+ }
+ };
+
+ /**
+ * Repaint a onChange tooltip on the top right of the item when the item is selected
+ * @param {HTMLElement} anchor
+ * @protected
+ */
+ Item.prototype._repaintOnItemUpdateTimeTooltip = function (anchor) {
+ if (!this.options.tooltipOnItemUpdateTime) return;
+
+ var editable = (this.options.editable.updateTime || this.data.editable === true) && this.data.editable !== false;
+
+ if (this.selected && editable && !this.dom.onItemUpdateTimeTooltip) {
+ // create and show tooltip
+ var me = this;
+
+ var onItemUpdateTimeTooltip = document.createElement('div');
+
+ onItemUpdateTimeTooltip.className = 'vis-onUpdateTime-tooltip';
+ anchor.appendChild(onItemUpdateTimeTooltip);
+ this.dom.onItemUpdateTimeTooltip = onItemUpdateTimeTooltip;
+ } else if (!this.selected && this.dom.onItemUpdateTimeTooltip) {
+ // remove button
+ if (this.dom.onItemUpdateTimeTooltip.parentNode) {
+ this.dom.onItemUpdateTimeTooltip.parentNode.removeChild(this.dom.onItemUpdateTimeTooltip);
+ }
+ this.dom.onItemUpdateTimeTooltip = null;
+ }
+
+ // position onChange tooltip
+ if (this.dom.onItemUpdateTimeTooltip) {
+
+ // only show when editing
+ this.dom.onItemUpdateTimeTooltip.style.visibility = this.parent.itemSet.touchParams.itemIsDragging ? 'visible' : 'hidden';
+
+ // position relative to item's content
+ if (this.options.rtl) {
+ this.dom.onItemUpdateTimeTooltip.style.right = this.dom.content.style.right;
+ } else {
+ this.dom.onItemUpdateTimeTooltip.style.left = this.dom.content.style.left;
+ }
+
+ // position above or below the item depending on the item's position in the window
+ var tooltipOffset = 50; // TODO: should be tooltip height (depends on template)
+ var scrollTop = this.parent.itemSet.body.domProps.scrollTop;
+
+ // TODO: this.top for orientation:true is actually the items distance from the bottom...
+ // (should be this.bottom)
+ var itemDistanceFromTop;
+ if (this.options.orientation.item == 'top') {
+ itemDistanceFromTop = this.top;
+ } else {
+ itemDistanceFromTop = this.parent.height - this.top - this.height;
+ }
+ var isCloseToTop = itemDistanceFromTop + this.parent.top - tooltipOffset < -scrollTop;
+
+ if (isCloseToTop) {
+ this.dom.onItemUpdateTimeTooltip.style.bottom = "";
+ this.dom.onItemUpdateTimeTooltip.style.top = this.height + 2 + "px";
+ } else {
+ this.dom.onItemUpdateTimeTooltip.style.top = "";
+ this.dom.onItemUpdateTimeTooltip.style.bottom = this.height + 2 + "px";
+ }
+
+ // handle tooltip content
+ var content;
+ var templateFunction;
+
+ if (this.options.tooltipOnItemUpdateTime && this.options.tooltipOnItemUpdateTime.template) {
+ templateFunction = this.options.tooltipOnItemUpdateTime.template.bind(this);
+ content = templateFunction(this.data);
+ } else {
+ content = 'start: ' + moment(this.data.start).format('MM/DD/YYYY hh:mm');
+ if (this.data.end) {
+ content += '<br> end: ' + moment(this.data.end).format('MM/DD/YYYY hh:mm');
+ }
+ }
+ this.dom.onItemUpdateTimeTooltip.innerHTML = content;
+ }
+ };
+
+ /**
+ * Set HTML contents for the item
+ * @param {Element} element HTML element to fill with the contents
+ * @private
+ */
+ Item.prototype._updateContents = function (element) {
+ var content;
+ var templateFunction;
+ var itemVisibleFrameContent;
+ var visibleFrameTemplateFunction;
+ var itemData = this.parent.itemSet.itemsData.get(this.id); // get a clone of the data from the dataset
+
+ var frameElement = this.dom.box || this.dom.point;
+ var itemVisibleFrameContentElement = frameElement.getElementsByClassName('vis-item-visible-frame')[0];
+
+ if (this.options.visibleFrameTemplate) {
+ visibleFrameTemplateFunction = this.options.visibleFrameTemplate.bind(this);
+ itemVisibleFrameContent = visibleFrameTemplateFunction(itemData, frameElement);
+ } else {
+ itemVisibleFrameContent = '';
+ }
+
+ if (itemVisibleFrameContentElement) {
+ if (itemVisibleFrameContent instanceof Object && !(itemVisibleFrameContent instanceof Element)) {
+ visibleFrameTemplateFunction(itemData, itemVisibleFrameContentElement);
+ } else {
+ var changed = this._contentToString(this.itemVisibleFrameContent) !== this._contentToString(itemVisibleFrameContent);
+ if (changed) {
+ // only replace the content when changed
+ if (itemVisibleFrameContent instanceof Element) {
+ itemVisibleFrameContentElement.innerHTML = '';
+ itemVisibleFrameContentElement.appendChild(itemVisibleFrameContent);
+ } else if (itemVisibleFrameContent != undefined) {
+ itemVisibleFrameContentElement.innerHTML = itemVisibleFrameContent;
+ } else {
+ if (!(this.data.type == 'background' && this.data.content === undefined)) {
+ throw new Error('Property "content" missing in item ' + this.id);
+ }
+ }
+
+ this.itemVisibleFrameContent = itemVisibleFrameContent;
+ }
+ }
+ }
+
+ if (this.options.template) {
+ templateFunction = this.options.template.bind(this);
+ content = templateFunction(itemData, element);
+ } else {
+ content = this.data.content;
+ }
+
+ if (content instanceof Object && !(content instanceof Element)) {
+ templateFunction(itemData, element);
+ } else {
+ var changed = this._contentToString(this.content) !== this._contentToString(content);
+ if (changed) {
+ // only replace the content when changed
+ if (content instanceof Element) {
+ element.innerHTML = '';
+ element.appendChild(content);
+ } else if (content != undefined) {
+ element.innerHTML = content;
+ } else {
+ if (!(this.data.type == 'background' && this.data.content === undefined)) {
+ throw new Error('Property "content" missing in item ' + this.id);
+ }
+ }
+
+ this.content = content;
+ }
+ }
+ };
+
+ /**
+ * Set HTML contents for the item
+ * @private
+ */
+ Item.prototype._updateTitle = function () {
+ if (this.data.title != null) {
+ if (this.popup != null) {
+ this.popup.setText(this.data.title || '');
+ }
+ }
+ };
+
+ /**
+ * Process dataAttributes timeline option and set as data- attributes on dom.content
+ * @param {Element} element HTML element to which the attributes will be attached
+ * @private
+ */
+ Item.prototype._updateDataAttributes = function (element) {
+ if (this.options.dataAttributes && this.options.dataAttributes.length > 0) {
+ var attributes = [];
+
+ if (Array.isArray(this.options.dataAttributes)) {
+ attributes = this.options.dataAttributes;
+ } else if (this.options.dataAttributes == 'all') {
+ attributes = (0, _keys2['default'])(this.data);
+ } else {
+ return;
+ }
+
+ for (var i = 0; i < attributes.length; i++) {
+ var name = attributes[i];
+ var value = this.data[name];
+
+ if (value != null) {
+ element.setAttribute('data-' + name, value);
+ } else {
+ element.removeAttribute('data-' + name);
+ }
+ }
+ }
+ };
+
+ /**
+ * Update custom styles of the element
+ * @param element
+ * @private
+ */
+ Item.prototype._updateStyle = function (element) {
+ // remove old styles
+ if (this.style) {
+ util.removeCssText(element, this.style);
+ this.style = null;
+ }
+
+ // append new styles
+ if (this.data.style) {
+ util.addCssText(element, this.data.style);
+ this.style = this.data.style;
+ }
+ };
+
+ /**
+ * Stringify the items contents
+ * @param {string | Element | undefined} content
+ * @returns {string | undefined}
+ * @private
+ */
+ Item.prototype._contentToString = function (content) {
+ if (typeof content === 'string') return content;
+ if (content && 'outerHTML' in content) return content.outerHTML;
+ return content;
+ };
+
+ /**
+ * Return the width of the item left from its start date
+ * @return {number}
+ */
+ Item.prototype.getWidthLeft = function () {
+ return 0;
+ };
+
+ /**
+ * Return the width of the item right from the max of its start and end date
+ * @return {number}
+ */
+ Item.prototype.getWidthRight = function () {
+ return 0;
+ };
+
+ /**
+ * Return the title of the item
+ * @return {string | undefined}
+ */
+ Item.prototype.getTitle = function () {
+ return this.data.title;
+ };
+
+ /**
+ * Set the popup object, and update the title
+ * @param {Popup} popup
+ */
+ Item.prototype.setPopup = function (popup) {
+ this.popup = popup;
+ this._updateTitle();
+ };
+
+ module.exports = Item;
+
+/***/ },
+/* 134 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _create = __webpack_require__(55);
+
+ var _create2 = _interopRequireDefault(_create);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var Group = __webpack_require__(130);
+
+ /**
+ * @constructor BackgroundGroup
+ * @param {Number | String} groupId
+ * @param {Object} data
+ * @param {ItemSet} itemSet
+ */
+ function BackgroundGroup(groupId, data, itemSet) {
+ Group.call(this, groupId, data, itemSet);
+
+ this.width = 0;
+ this.height = 0;
+ this.top = 0;
+ this.left = 0;
+ }
+
+ BackgroundGroup.prototype = (0, _create2['default'])(Group.prototype);
+
+ /**
+ * Repaint this group
+ * @param {{start: number, end: number}} range
+ * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin
+ * @param {boolean} [restack=false] Force restacking of all items
+ * @return {boolean} Returns true if the group is resized
+ */
+ BackgroundGroup.prototype.redraw = function (range, margin, restack) {
+ var resized = false;
+
+ this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range);
+
+ // calculate actual size
+ this.width = this.dom.background.offsetWidth;
+
+ // apply new height (just always zero for BackgroundGroup
+ this.dom.background.style.height = '0';
+
+ // update vertical position of items after they are re-stacked and the height of the group is calculated
+ for (var i = 0, ii = this.visibleItems.length; i < ii; i++) {
+ var item = this.visibleItems[i];
+ item.repositionY(margin);
+ }
+
+ return resized;
+ };
+
+ /**
+ * Show this group: attach to the DOM
+ */
+ BackgroundGroup.prototype.show = function () {
+ if (!this.dom.background.parentNode) {
+ this.itemSet.dom.background.appendChild(this.dom.background);
+ }
+ };
+
+ module.exports = BackgroundGroup;
+
+/***/ },
+/* 135 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var Item = __webpack_require__(133);
+ var util = __webpack_require__(1);
+
+ /**
+ * @constructor BoxItem
+ * @extends Item
+ * @param {Object} data Object containing parameters start
+ * content, className.
+ * @param {{toScreen: function, toTime: function}} conversion
+ * Conversion functions from time to screen and vice versa
+ * @param {Object} [options] Configuration options
+ * // TODO: describe available options
+ */
+ function BoxItem(data, conversion, options) {
+ this.props = {
+ dot: {
+ width: 0,
+ height: 0
+ },
+ line: {
+ width: 0,
+ height: 0
+ }
+ };
+ this.options = options;
+ // validate data
+ if (data) {
+ if (data.start == undefined) {
+ throw new Error('Property "start" missing in item ' + data);
+ }
+ }
+
+ Item.call(this, data, conversion, options);
+ }
+
+ BoxItem.prototype = new Item(null, null, null);
+
+ /**
+ * Check whether this item is visible inside given range
+ * @param {{start: Number, end: Number}} range with a timestamp for start and end
+ * @returns {boolean} True if visible
+ */
+ BoxItem.prototype.isVisible = function (range) {
+ // determine visibility
+ var isVisible;
+ var align = this.options.align;
+ var widthInMs = this.width * range.getMillisecondsPerPixel();
+
+ if (align == 'right') {
+ isVisible = this.data.start.getTime() > range.start && this.data.start.getTime() - widthInMs < range.end;
+ } else if (align == 'left') {
+ isVisible = this.data.start.getTime() + widthInMs > range.start && this.data.start.getTime() < range.end;
+ } else {
+ // default or 'center'
+ isVisible = this.data.start.getTime() + widthInMs / 2 > range.start && this.data.start.getTime() - widthInMs / 2 < range.end;
+ }
+ return isVisible;
+ };
+
+ /**
+ * Repaint the item
+ */
+ BoxItem.prototype.redraw = function () {
+ var dom = this.dom;
+ if (!dom) {
+ // create DOM
+ this.dom = {};
+ dom = this.dom;
+
+ // create main box
+ dom.box = document.createElement('DIV');
+
+ // contents box (inside the background box). used for making margins
+ dom.content = document.createElement('DIV');
+ dom.content.className = 'vis-item-content';
+ dom.box.appendChild(dom.content);
+
+ // line to axis
+ dom.line = document.createElement('DIV');
+ dom.line.className = 'vis-line';
+
+ // dot on axis
+ dom.dot = document.createElement('DIV');
+ dom.dot.className = 'vis-dot';
+
+ // attach this item as attribute
+ dom.box['timeline-item'] = this;
+
+ this.dirty = true;
+ }
+
+ // append DOM to parent DOM
+ if (!this.parent) {
+ throw new Error('Cannot redraw item: no parent attached');
+ }
+ if (!dom.box.parentNode) {
+ var foreground = this.parent.dom.foreground;
+ if (!foreground) throw new Error('Cannot redraw item: parent has no foreground container element');
+ foreground.appendChild(dom.box);
+ }
+ if (!dom.line.parentNode) {
+ var background = this.parent.dom.background;
+ if (!background) throw new Error('Cannot redraw item: parent has no background container element');
+ background.appendChild(dom.line);
+ }
+ if (!dom.dot.parentNode) {
+ var axis = this.parent.dom.axis;
+ if (!background) throw new Error('Cannot redraw item: parent has no axis container element');
+ axis.appendChild(dom.dot);
+ }
+ this.displayed = true;
+
+ // Update DOM when item is marked dirty. An item is marked dirty when:
+ // - the item is not yet rendered
+ // - the item's data is changed
+ // - the item is selected/deselected
+ if (this.dirty) {
+ this._updateContents(this.dom.content);
+ this._updateTitle();
+ this._updateDataAttributes(this.dom.box);
+ this._updateStyle(this.dom.box);
+
+ var editable = (this.options.editable.updateTime || this.options.editable.updateGroup || this.editable === true) && this.editable !== false;
+
+ // update class
+ var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly');
+ dom.box.className = 'vis-item vis-box' + className;
+ dom.line.className = 'vis-item vis-line' + className;
+ dom.dot.className = 'vis-item vis-dot' + className;
+
+ // set initial position in the visible range of the grid so that the
+ // rendered box size can be determinated correctly, even the content
+ // has a dynamic width (fixes #2032).
+ var previousRight = dom.box.style.right;
+ var previousLeft = dom.box.style.left;
+ if (this.options.rtl) {
+ dom.box.style.right = "0px";
+ } else {
+ dom.box.style.left = "0px";
+ }
+
+ // recalculate size
+ this.props.dot.height = dom.dot.offsetHeight;
+ this.props.dot.width = dom.dot.offsetWidth;
+ this.props.line.width = dom.line.offsetWidth;
+ this.width = dom.box.offsetWidth;
+ this.height = dom.box.offsetHeight;
+
+ // restore previous position
+ if (this.options.rtl) {
+ dom.box.style.right = previousRight;
+ } else {
+ dom.box.style.left = previousLeft;
+ }
+
+ this.dirty = false;
+ }
+
+ this._repaintOnItemUpdateTimeTooltip(dom.box);
+ this._repaintDragCenter();
+ this._repaintDeleteButton(dom.box);
+ };
+
+ /**
+ * Show the item in the DOM (when not already displayed). The items DOM will
+ * be created when needed.
+ */
+ BoxItem.prototype.show = function () {
+ if (!this.displayed) {
+ this.redraw();
+ }
+ };
+
+ /**
+ * Hide the item from the DOM (when visible)
+ */
+ BoxItem.prototype.hide = function () {
+ if (this.displayed) {
+ var dom = this.dom;
+
+ if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box);
+ if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line);
+ if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot);
+
+ this.displayed = false;
+ }
+ };
+
+ /**
+ * Reposition the item horizontally
+ * @Override
+ */
+ BoxItem.prototype.repositionX = function () {
+ var start = this.conversion.toScreen(this.data.start);
+ var align = this.options.align;
+
+ // calculate left position of the box
+ if (align == 'right') {
+ if (this.options.rtl) {
+ this.right = start - this.width;
+
+ // reposition box, line, and dot
+ this.dom.box.style.right = this.right + 'px';
+ this.dom.line.style.right = start - this.props.line.width + 'px';
+ this.dom.dot.style.right = start - this.props.line.width / 2 - this.props.dot.width / 2 + 'px';
+ } else {
+ this.left = start - this.width;
+
+ // reposition box, line, and dot
+ this.dom.box.style.left = this.left + 'px';
+ this.dom.line.style.left = start - this.props.line.width + 'px';
+ this.dom.dot.style.left = start - this.props.line.width / 2 - this.props.dot.width / 2 + 'px';
+ }
+ } else if (align == 'left') {
+ if (this.options.rtl) {
+ this.right = start;
+
+ // reposition box, line, and dot
+ this.dom.box.style.right = this.right + 'px';
+ this.dom.line.style.right = start + 'px';
+ this.dom.dot.style.right = start + this.props.line.width / 2 - this.props.dot.width / 2 + 'px';
+ } else {
+ this.left = start;
+
+ // reposition box, line, and dot
+ this.dom.box.style.left = this.left + 'px';
+ this.dom.line.style.left = start + 'px';
+ this.dom.dot.style.left = start + this.props.line.width / 2 - this.props.dot.width / 2 + 'px';
+ }
+ } else {
+ // default or 'center'
+ if (this.options.rtl) {
+ this.right = start - this.width / 2;
+
+ // reposition box, line, and dot
+ this.dom.box.style.right = this.right + 'px';
+ this.dom.line.style.right = start - this.props.line.width + 'px';
+ this.dom.dot.style.right = start - this.props.dot.width / 2 + 'px';
+ } else {
+ this.left = start - this.width / 2;
+
+ // reposition box, line, and dot
+ this.dom.box.style.left = this.left + 'px';
+ this.dom.line.style.left = start - this.props.line.width / 2 + 'px';
+ this.dom.dot.style.left = start - this.props.dot.width / 2 + 'px';
+ }
+ }
+ };
+
+ /**
+ * Reposition the item vertically
+ * @Override
+ */
+ BoxItem.prototype.repositionY = function () {
+ var orientation = this.options.orientation.item;
+ var box = this.dom.box;
+ var line = this.dom.line;
+ var dot = this.dom.dot;
+
+ if (orientation == 'top') {
+ box.style.top = (this.top || 0) + 'px';
+
+ line.style.top = '0';
+ line.style.height = this.parent.top + this.top + 1 + 'px';
+ line.style.bottom = '';
+ } else {
+ // orientation 'bottom'
+ var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty
+ var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top;
+
+ box.style.top = (this.parent.height - this.top - this.height || 0) + 'px';
+ line.style.top = itemSetHeight - lineHeight + 'px';
+ line.style.bottom = '0';
+ }
+
+ dot.style.top = -this.props.dot.height / 2 + 'px';
+ };
+
+ /**
+ * Return the width of the item left from its start date
+ * @return {number}
+ */
+ BoxItem.prototype.getWidthLeft = function () {
+ return this.width / 2;
+ };
+
+ /**
+ * Return the width of the item right from its start date
+ * @return {number}
+ */
+ BoxItem.prototype.getWidthRight = function () {
+ return this.width / 2;
+ };
+
+ module.exports = BoxItem;
+
+/***/ },
+/* 136 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var Item = __webpack_require__(133);
+
+ /**
+ * @constructor PointItem
+ * @extends Item
+ * @param {Object} data Object containing parameters start
+ * content, className.
+ * @param {{toScreen: function, toTime: function}} conversion
+ * Conversion functions from time to screen and vice versa
+ * @param {Object} [options] Configuration options
+ * // TODO: describe available options
+ */
+ function PointItem(data, conversion, options) {
+ this.props = {
+ dot: {
+ top: 0,
+ width: 0,
+ height: 0
+ },
+ content: {
+ height: 0,
+ marginLeft: 0,
+ marginRight: 0
+ }
+ };
+ this.options = options;
+ // validate data
+ if (data) {
+ if (data.start == undefined) {
+ throw new Error('Property "start" missing in item ' + data);
+ }
+ }
+
+ Item.call(this, data, conversion, options);
+ }
+
+ PointItem.prototype = new Item(null, null, null);
+
+ /**
+ * Check whether this item is visible inside given range
+ * @param {{start: Number, end: Number}} range with a timestamp for start and end
+ * @returns {boolean} True if visible
+ */
+ PointItem.prototype.isVisible = function (range) {
+ // determine visibility
+ var widthInMs = this.width * range.getMillisecondsPerPixel();
+
+ return this.data.start.getTime() + widthInMs > range.start && this.data.start < range.end;
+ };
+
+ /**
+ * Repaint the item
+ */
+ PointItem.prototype.redraw = function () {
+ var dom = this.dom;
+ if (!dom) {
+ // create DOM
+ this.dom = {};
+ dom = this.dom;
+
+ // background box
+ dom.point = document.createElement('div');
+ // className is updated in redraw()
+
+ // contents box, right from the dot
+ dom.content = document.createElement('div');
+ dom.content.className = 'vis-item-content';
+ dom.point.appendChild(dom.content);
+
+ // dot at start
+ dom.dot = document.createElement('div');
+ dom.point.appendChild(dom.dot);
+
+ // attach this item as attribute
+ dom.point['timeline-item'] = this;
+
+ this.dirty = true;
+ }
+
+ // append DOM to parent DOM
+ if (!this.parent) {
+ throw new Error('Cannot redraw item: no parent attached');
+ }
+ if (!dom.point.parentNode) {
+ var foreground = this.parent.dom.foreground;
+ if (!foreground) {
+ throw new Error('Cannot redraw item: parent has no foreground container element');
+ }
+ foreground.appendChild(dom.point);
+ }
+ this.displayed = true;
+
+ // Update DOM when item is marked dirty. An item is marked dirty when:
+ // - the item is not yet rendered
+ // - the item's data is changed
+ // - the item is selected/deselected
+ if (this.dirty) {
+ this._updateContents(this.dom.content);
+ this._updateTitle();
+ this._updateDataAttributes(this.dom.point);
+ this._updateStyle(this.dom.point);
+
+ var editable = (this.options.editable.updateTime || this.options.editable.updateGroup || this.editable === true) && this.editable !== false;
+
+ // update class
+ var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly');
+ dom.point.className = 'vis-item vis-point' + className;
+ dom.dot.className = 'vis-item vis-dot' + className;
+
+ // recalculate size of dot and contents
+ this.props.dot.width = dom.dot.offsetWidth;
+ this.props.dot.height = dom.dot.offsetHeight;
+ this.props.content.height = dom.content.offsetHeight;
+
+ // resize contents
+ if (this.options.rtl) {
+ dom.content.style.marginRight = 2 * this.props.dot.width + 'px';
+ } else {
+ dom.content.style.marginLeft = 2 * this.props.dot.width + 'px';
+ }
+ //dom.content.style.marginRight = ... + 'px'; // TODO: margin right
+
+ // recalculate size
+ this.width = dom.point.offsetWidth;
+ this.height = dom.point.offsetHeight;
+
+ // reposition the dot
+ dom.dot.style.top = (this.height - this.props.dot.height) / 2 + 'px';
+ if (this.options.rtl) {
+ dom.dot.style.right = this.props.dot.width / 2 + 'px';
+ } else {
+ dom.dot.style.left = this.props.dot.width / 2 + 'px';
+ }
+
+ this.dirty = false;
+ }
+
+ this._repaintOnItemUpdateTimeTooltip(dom.point);
+ this._repaintDragCenter();
+ this._repaintDeleteButton(dom.point);
+ };
+
+ /**
+ * Show the item in the DOM (when not already visible). The items DOM will
+ * be created when needed.
+ */
+ PointItem.prototype.show = function () {
+ if (!this.displayed) {
+ this.redraw();
+ }
+ };
+
+ /**
+ * Hide the item from the DOM (when visible)
+ */
+ PointItem.prototype.hide = function () {
+ if (this.displayed) {
+ if (this.dom.point.parentNode) {
+ this.dom.point.parentNode.removeChild(this.dom.point);
+ }
+
+ this.displayed = false;
+ }
+ };
+
+ /**
+ * Reposition the item horizontally
+ * @Override
+ */
+ PointItem.prototype.repositionX = function () {
+ var start = this.conversion.toScreen(this.data.start);
+
+ if (this.options.rtl) {
+ this.right = start - this.props.dot.width;
+
+ // reposition point
+ this.dom.point.style.right = this.right + 'px';
+ } else {
+ this.left = start - this.props.dot.width;
+
+ // reposition point
+ this.dom.point.style.left = this.left + 'px';
+ }
+ };
+
+ /**
+ * Reposition the item vertically
+ * @Override
+ */
+ PointItem.prototype.repositionY = function () {
+ var orientation = this.options.orientation.item;
+ var point = this.dom.point;
+ if (orientation == 'top') {
+ point.style.top = this.top + 'px';
+ } else {
+ point.style.top = this.parent.height - this.top - this.height + 'px';
+ }
+ };
+
+ /**
+ * Return the width of the item left from its start date
+ * @return {number}
+ */
+ PointItem.prototype.getWidthLeft = function () {
+ return this.props.dot.width;
+ };
+
+ /**
+ * Return the width of the item right from its start date
+ * @return {number}
+ */
+ PointItem.prototype.getWidthRight = function () {
+ return this.props.dot.width;
+ };
+
+ module.exports = PointItem;
+
+/***/ },
+/* 137 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var Hammer = __webpack_require__(108);
+ var Item = __webpack_require__(133);
+ var BackgroundGroup = __webpack_require__(134);
+ var RangeItem = __webpack_require__(132);
+
+ /**
+ * @constructor BackgroundItem
+ * @extends Item
+ * @param {Object} data Object containing parameters start, end
+ * content, className.
+ * @param {{toScreen: function, toTime: function}} conversion
+ * Conversion functions from time to screen and vice versa
+ * @param {Object} [options] Configuration options
+ * // TODO: describe options
+ */
+ // TODO: implement support for the BackgroundItem just having a start, then being displayed as a sort of an annotation
+ function BackgroundItem(data, conversion, options) {
+ this.props = {
+ content: {
+ width: 0
+ }
+ };
+ this.overflow = false; // if contents can overflow (css styling), this flag is set to true
+
+ // validate data
+ if (data) {
+ if (data.start == undefined) {
+ throw new Error('Property "start" missing in item ' + data.id);
+ }
+ if (data.end == undefined) {
+ throw new Error('Property "end" missing in item ' + data.id);
+ }
+ }
+
+ Item.call(this, data, conversion, options);
+ }
+
+ BackgroundItem.prototype = new Item(null, null, null);
+
+ BackgroundItem.prototype.baseClassName = 'vis-item vis-background';
+ BackgroundItem.prototype.stack = false;
+
+ /**
+ * Check whether this item is visible inside given range
+ * @returns {{start: Number, end: Number}} range with a timestamp for start and end
+ * @returns {boolean} True if visible
+ */
+ BackgroundItem.prototype.isVisible = function (range) {
+ // determine visibility
+ return this.data.start < range.end && this.data.end > range.start;
+ };
+
+ /**
+ * Repaint the item
+ */
+ BackgroundItem.prototype.redraw = function () {
+ var dom = this.dom;
+ if (!dom) {
+ // create DOM
+ this.dom = {};
+ dom = this.dom;
+
+ // background box
+ dom.box = document.createElement('div');
+ // className is updated in redraw()
+
+ // frame box (to prevent the item contents from overflowing
+ dom.frame = document.createElement('div');
+ dom.frame.className = 'vis-item-overflow';
+ dom.box.appendChild(dom.frame);
+
+ // contents box
+ dom.content = document.createElement('div');
+ dom.content.className = 'vis-item-content';
+ dom.frame.appendChild(dom.content);
+
+ // Note: we do NOT attach this item as attribute to the DOM,
+ // such that background items cannot be selected
+ //dom.box['timeline-item'] = this;
+
+ this.dirty = true;
+ }
+
+ // append DOM to parent DOM
+ if (!this.parent) {
+ throw new Error('Cannot redraw item: no parent attached');
+ }
+ if (!dom.box.parentNode) {
+ var background = this.parent.dom.background;
+ if (!background) {
+ throw new Error('Cannot redraw item: parent has no background container element');
+ }
+ background.appendChild(dom.box);
+ }
+ this.displayed = true;
+
+ // Update DOM when item is marked dirty. An item is marked dirty when:
+ // - the item is not yet rendered
+ // - the item's data is changed
+ // - the item is selected/deselected
+ if (this.dirty) {
+ this._updateContents(this.dom.content);
+ this._updateTitle();
+ this._updateDataAttributes(this.dom.content);
+ this._updateStyle(this.dom.box);
+
+ // update class
+ var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '');
+ dom.box.className = this.baseClassName + className;
+
+ // determine from css whether this box has overflow
+ this.overflow = window.getComputedStyle(dom.content).overflow !== 'hidden';
+
+ // recalculate size
+ this.props.content.width = this.dom.content.offsetWidth;
+ this.height = 0; // set height zero, so this item will be ignored when stacking items
+
+ this.dirty = false;
+ }
+ };
+
+ /**
+ * Show the item in the DOM (when not already visible). The items DOM will
+ * be created when needed.
+ */
+ BackgroundItem.prototype.show = RangeItem.prototype.show;
+
+ /**
+ * Hide the item from the DOM (when visible)
+ * @return {Boolean} changed
+ */
+ BackgroundItem.prototype.hide = RangeItem.prototype.hide;
+
+ /**
+ * Reposition the item horizontally
+ * @Override
+ */
+ BackgroundItem.prototype.repositionX = RangeItem.prototype.repositionX;
+
+ /**
+ * Reposition the item vertically
+ * @Override
+ */
+ BackgroundItem.prototype.repositionY = function (margin) {
+ var height;
+
+ // special positioning for subgroups
+ if (this.data.subgroup !== undefined) {
+ // TODO: instead of calculating the top position of the subgroups here for every BackgroundItem, calculate the top of the subgroup once in Itemset
+
+ var itemSubgroup = this.data.subgroup;
+ var subgroups = this.parent.subgroups;
+ var subgroupIndex = subgroups[itemSubgroup].index;
+
+ this.dom.box.style.height = this.parent.subgroups[itemSubgroup].height + 'px';
+
+ var orientation = this.options.orientation.item;
+ if (orientation == 'top') {
+ this.dom.box.style.top = this.parent.top + this.parent.subgroups[itemSubgroup].top + 'px';
+ } else {
+ this.dom.box.style.top = this.parent.top + this.parent.height - this.parent.subgroups[itemSubgroup].top - this.parent.subgroups[itemSubgroup].height + 'px';
+ }
+ this.dom.box.style.bottom = '';
+ }
+ // and in the case of no subgroups:
+ else {
+ // we want backgrounds with groups to only show in groups.
+ if (this.parent instanceof BackgroundGroup) {
+ // if the item is not in a group:
+ height = Math.max(this.parent.height, this.parent.itemSet.body.domProps.center.height, this.parent.itemSet.body.domProps.centerContainer.height);
+ this.dom.box.style.top = orientation == 'top' ? '0' : '';
+ this.dom.box.style.bottom = orientation == 'top' ? '' : '0';
+ } else {
+ height = this.parent.height;
+ // same alignment for items when orientation is top or bottom
+ this.dom.box.style.top = this.parent.top + 'px';
+ this.dom.box.style.bottom = '';
+ }
+ }
+ this.dom.box.style.height = height + 'px';
+ };
+
+ module.exports = BackgroundItem;
+
+/***/ },
+/* 138 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var Component = __webpack_require__(124);
+ var TimeStep = __webpack_require__(129);
+ var DateUtil = __webpack_require__(125);
+ var moment = __webpack_require__(84);
+
+ /**
+ * A horizontal time axis
+ * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body
+ * @param {Object} [options] See TimeAxis.setOptions for the available
+ * options.
+ * @constructor TimeAxis
+ * @extends Component
+ */
+ function TimeAxis(body, options) {
+ this.dom = {
+ foreground: null,
+ lines: [],
+ majorTexts: [],
+ minorTexts: [],
+ redundant: {
+ lines: [],
+ majorTexts: [],
+ minorTexts: []
+ }
+ };
+ this.props = {
+ range: {
+ start: 0,
+ end: 0,
+ minimumStep: 0
+ },
+ lineTop: 0
+ };
+
+ this.defaultOptions = {
+ orientation: {
+ axis: 'bottom'
+ }, // axis orientation: 'top' or 'bottom'
+ showMinorLabels: true,
+ showMajorLabels: true,
+ maxMinorChars: 7,
+ format: TimeStep.FORMAT,
+ moment: moment,
+ timeAxis: null
+ };
+ this.options = util.extend({}, this.defaultOptions);
+
+ this.body = body;
+
+ // create the HTML DOM
+ this._create();
+
+ this.setOptions(options);
+ }
+
+ TimeAxis.prototype = new Component();
+
+ /**
+ * Set options for the TimeAxis.
+ * Parameters will be merged in current options.
+ * @param {Object} options Available options:
+ * {string} [orientation.axis]
+ * {boolean} [showMinorLabels]
+ * {boolean} [showMajorLabels]
+ */
+ TimeAxis.prototype.setOptions = function (options) {
+ if (options) {
+ // copy all options that we know
+ util.selectiveExtend(['showMinorLabels', 'showMajorLabels', 'maxMinorChars', 'hiddenDates', 'timeAxis', 'moment', 'rtl'], this.options, options);
+
+ // deep copy the format options
+ util.selectiveDeepExtend(['format'], this.options, options);
+
+ if ('orientation' in options) {
+ if (typeof options.orientation === 'string') {
+ this.options.orientation.axis = options.orientation;
+ } else if ((0, _typeof3['default'])(options.orientation) === 'object' && 'axis' in options.orientation) {
+ this.options.orientation.axis = options.orientation.axis;
+ }
+ }
+
+ // apply locale to moment.js
+ // TODO: not so nice, this is applied globally to moment.js
+ if ('locale' in options) {
+ if (typeof moment.locale === 'function') {
+ // moment.js 2.8.1+
+ moment.locale(options.locale);
+ } else {
+ moment.lang(options.locale);
+ }
+ }
+ }
+ };
+
+ /**
+ * Create the HTML DOM for the TimeAxis
+ */
+ TimeAxis.prototype._create = function () {
+ this.dom.foreground = document.createElement('div');
+ this.dom.background = document.createElement('div');
+
+ this.dom.foreground.className = 'vis-time-axis vis-foreground';
+ this.dom.background.className = 'vis-time-axis vis-background';
+ };
+
+ /**
+ * Destroy the TimeAxis
+ */
+ TimeAxis.prototype.destroy = function () {
+ // remove from DOM
+ if (this.dom.foreground.parentNode) {
+ this.dom.foreground.parentNode.removeChild(this.dom.foreground);
+ }
+ if (this.dom.background.parentNode) {
+ this.dom.background.parentNode.removeChild(this.dom.background);
+ }
+
+ this.body = null;
+ };
+
+ /**
+ * Repaint the component
+ * @return {boolean} Returns true if the component is resized
+ */
+ TimeAxis.prototype.redraw = function () {
+ var props = this.props;
+ var foreground = this.dom.foreground;
+ var background = this.dom.background;
+
+ // determine the correct parent DOM element (depending on option orientation)
+ var parent = this.options.orientation.axis == 'top' ? this.body.dom.top : this.body.dom.bottom;
+ var parentChanged = foreground.parentNode !== parent;
+
+ // calculate character width and height
+ this._calculateCharSize();
+
+ // TODO: recalculate sizes only needed when parent is resized or options is changed
+ var showMinorLabels = this.options.showMinorLabels && this.options.orientation.axis !== 'none';
+ var showMajorLabels = this.options.showMajorLabels && this.options.orientation.axis !== 'none';
+
+ // determine the width and height of the elemens for the axis
+ props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0;
+ props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0;
+ props.height = props.minorLabelHeight + props.majorLabelHeight;
+ props.width = foreground.offsetWidth;
+
+ props.minorLineHeight = this.body.domProps.root.height - props.majorLabelHeight - (this.options.orientation.axis == 'top' ? this.body.domProps.bottom.height : this.body.domProps.top.height);
+ props.minorLineWidth = 1; // TODO: really calculate width
+ props.majorLineHeight = props.minorLineHeight + props.majorLabelHeight;
+ props.majorLineWidth = 1; // TODO: really calculate width
+
+ // take foreground and background offline while updating (is almost twice as fast)
+ var foregroundNextSibling = foreground.nextSibling;
+ var backgroundNextSibling = background.nextSibling;
+ foreground.parentNode && foreground.parentNode.removeChild(foreground);
+ background.parentNode && background.parentNode.removeChild(background);
+
+ foreground.style.height = this.props.height + 'px';
+
+ this._repaintLabels();
+
+ // put DOM online again (at the same place)
+ if (foregroundNextSibling) {
+ parent.insertBefore(foreground, foregroundNextSibling);
+ } else {
+ parent.appendChild(foreground);
+ }
+ if (backgroundNextSibling) {
+ this.body.dom.backgroundVertical.insertBefore(background, backgroundNextSibling);
+ } else {
+ this.body.dom.backgroundVertical.appendChild(background);
+ }
+ return this._isResized() || parentChanged;
+ };
+
+ /**
+ * Repaint major and minor text labels and vertical grid lines
+ * @private
+ */
+ TimeAxis.prototype._repaintLabels = function () {
+ var orientation = this.options.orientation.axis;
+
+ // calculate range and step (step such that we have space for 7 characters per label)
+ var start = util.convert(this.body.range.start, 'Number');
+ var end = util.convert(this.body.range.end, 'Number');
+ var timeLabelsize = this.body.util.toTime((this.props.minorCharWidth || 10) * this.options.maxMinorChars).valueOf();
+ var minimumStep = timeLabelsize - DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this.body.range, timeLabelsize);
+ minimumStep -= this.body.util.toTime(0).valueOf();
+
+ var step = new TimeStep(new Date(start), new Date(end), minimumStep, this.body.hiddenDates);
+ step.setMoment(this.options.moment);
+ if (this.options.format) {
+ step.setFormat(this.options.format);
+ }
+ if (this.options.timeAxis) {
+ step.setScale(this.options.timeAxis);
+ }
+ this.step = step;
+
+ // Move all DOM elements to a "redundant" list, where they
+ // can be picked for re-use, and clear the lists with lines and texts.
+ // At the end of the function _repaintLabels, left over elements will be cleaned up
+ var dom = this.dom;
+ dom.redundant.lines = dom.lines;
+ dom.redundant.majorTexts = dom.majorTexts;
+ dom.redundant.minorTexts = dom.minorTexts;
+ dom.lines = [];
+ dom.majorTexts = [];
+ dom.minorTexts = [];
+
+ var current;
+ var next;
+ var x;
+ var xNext;
+ var isMajor, nextIsMajor;
+ var width = 0,
+ prevWidth;
+ var line;
+ var labelMinor;
+ var xFirstMajorLabel = undefined;
+ var count = 0;
+ var MAX = 1000;
+ var className;
+
+ step.start();
+ next = step.getCurrent();
+ xNext = this.body.util.toScreen(next);
+ while (step.hasNext() && count < MAX) {
+ count++;
+
+ isMajor = step.isMajor();
+ className = step.getClassName();
+ labelMinor = step.getLabelMinor();
+
+ current = next;
+ x = xNext;
+
+ step.next();
+ next = step.getCurrent();
+ nextIsMajor = step.isMajor();
+ xNext = this.body.util.toScreen(next);
+
+ prevWidth = width;
+ width = xNext - x;
+ var showMinorGrid = width >= prevWidth * 0.4; // prevent displaying of the 31th of the month on a scale of 5 days
+
+ if (this.options.showMinorLabels && showMinorGrid) {
+ var label = this._repaintMinorText(x, labelMinor, orientation, className);
+ label.style.width = width + 'px'; // set width to prevent overflow
+ }
+
+ if (isMajor && this.options.showMajorLabels) {
+ if (x > 0) {
+ if (xFirstMajorLabel == undefined) {
+ xFirstMajorLabel = x;
+ }
+ label = this._repaintMajorText(x, step.getLabelMajor(), orientation, className);
+ }
+ line = this._repaintMajorLine(x, width, orientation, className);
+ } else {
+ // minor line
+ if (showMinorGrid) {
+ line = this._repaintMinorLine(x, width, orientation, className);
+ } else {
+ if (line) {
+ // adjust the width of the previous grid
+ line.style.width = parseInt(line.style.width) + width + 'px';
+ }
+ }
+ }
+ }
+
+ if (count === MAX && !warnedForOverflow) {
+ console.warn('Something is wrong with the Timeline scale. Limited drawing of grid lines to ' + MAX + ' lines.');
+ warnedForOverflow = true;
+ }
+
+ // create a major label on the left when needed
+ if (this.options.showMajorLabels) {
+ var leftTime = this.body.util.toTime(0),
+ leftText = step.getLabelMajor(leftTime),
+ widthText = leftText.length * (this.props.majorCharWidth || 10) + 10; // upper bound estimation
+
+ if (xFirstMajorLabel == undefined || widthText < xFirstMajorLabel) {
+ this._repaintMajorText(0, leftText, orientation, className);
+ }
+ }
+
+ // Cleanup leftover DOM elements from the redundant list
+ util.forEach(this.dom.redundant, function (arr) {
+ while (arr.length) {
+ var elem = arr.pop();
+ if (elem && elem.parentNode) {
+ elem.parentNode.removeChild(elem);
+ }
+ }
+ });
+ };
+
+ /**
+ * Create a minor label for the axis at position x
+ * @param {Number} x
+ * @param {String} text
+ * @param {String} orientation "top" or "bottom" (default)
+ * @param {String} className
+ * @return {Element} Returns the HTML element of the created label
+ * @private
+ */
+ TimeAxis.prototype._repaintMinorText = function (x, text, orientation, className) {
+ // reuse redundant label
+ var label = this.dom.redundant.minorTexts.shift();
+
+ if (!label) {
+ // create new label
+ var content = document.createTextNode('');
+ label = document.createElement('div');
+ label.appendChild(content);
+ this.dom.foreground.appendChild(label);
+ }
+ this.dom.minorTexts.push(label);
+ label.innerHTML = text;
+
+ label.style.top = orientation == 'top' ? this.props.majorLabelHeight + 'px' : '0';
+
+ if (this.options.rtl) {
+ label.style.left = "";
+ label.style.right = x + 'px';
+ } else {
+ label.style.left = x + 'px';
+ };
+ label.className = 'vis-text vis-minor ' + className;
+ //label.title = title; // TODO: this is a heavy operation
+
+ return label;
+ };
+
+ /**
+ * Create a Major label for the axis at position x
+ * @param {Number} x
+ * @param {String} text
+ * @param {String} orientation "top" or "bottom" (default)
+ * @param {String} className
+ * @return {Element} Returns the HTML element of the created label
+ * @private
+ */
+ TimeAxis.prototype._repaintMajorText = function (x, text, orientation, className) {
+ // reuse redundant label
+ var label = this.dom.redundant.majorTexts.shift();
+
+ if (!label) {
+ // create label
+ var content = document.createElement('div');
+ label = document.createElement('div');
+ label.appendChild(content);
+ this.dom.foreground.appendChild(label);
+ }
+
+ label.childNodes[0].innerHTML = text;
+ label.className = 'vis-text vis-major ' + className;
+ //label.title = title; // TODO: this is a heavy operation
+
+ label.style.top = orientation == 'top' ? '0' : this.props.minorLabelHeight + 'px';
+ if (this.options.rtl) {
+ label.style.left = "";
+ label.style.right = x + 'px';
+ } else {
+ label.style.left = x + 'px';
+ };
+
+ this.dom.majorTexts.push(label);
+ return label;
+ };
+
+ /**
+ * Create a minor line for the axis at position x
+ * @param {Number} x
+ * @param {Number} width
+ * @param {String} orientation "top" or "bottom" (default)
+ * @param {String} className
+ * @return {Element} Returns the created line
+ * @private
+ */
+ TimeAxis.prototype._repaintMinorLine = function (x, width, orientation, className) {
+ // reuse redundant line
+ var line = this.dom.redundant.lines.shift();
+ if (!line) {
+ // create vertical line
+ line = document.createElement('div');
+ this.dom.background.appendChild(line);
+ }
+ this.dom.lines.push(line);
+
+ var props = this.props;
+ if (orientation == 'top') {
+ line.style.top = props.majorLabelHeight + 'px';
+ } else {
+ line.style.top = this.body.domProps.top.height + 'px';
+ }
+ line.style.height = props.minorLineHeight + 'px';
+ if (this.options.rtl) {
+ line.style.left = "";
+ line.style.right = x - props.minorLineWidth / 2 + 'px';
+ line.className = 'vis-grid vis-vertical-rtl vis-minor ' + className;
+ } else {
+ line.style.left = x - props.minorLineWidth / 2 + 'px';
+ line.className = 'vis-grid vis-vertical vis-minor ' + className;
+ };
+ line.style.width = width + 'px';
+
+ return line;
+ };
+
+ /**
+ * Create a Major line for the axis at position x
+ * @param {Number} x
+ * @param {Number} width
+ * @param {String} orientation "top" or "bottom" (default)
+ * @param {String} className
+ * @return {Element} Returns the created line
+ * @private
+ */
+ TimeAxis.prototype._repaintMajorLine = function (x, width, orientation, className) {
+ // reuse redundant line
+ var line = this.dom.redundant.lines.shift();
+ if (!line) {
+ // create vertical line
+ line = document.createElement('div');
+ this.dom.background.appendChild(line);
+ }
+ this.dom.lines.push(line);
+
+ var props = this.props;
+ if (orientation == 'top') {
+ line.style.top = '0';
+ } else {
+ line.style.top = this.body.domProps.top.height + 'px';
+ }
+
+ if (this.options.rtl) {
+ line.style.left = "";
+ line.style.right = x - props.majorLineWidth / 2 + 'px';
+ line.className = 'vis-grid vis-vertical-rtl vis-major ' + className;
+ } else {
+ line.style.left = x - props.majorLineWidth / 2 + 'px';
+ line.className = 'vis-grid vis-vertical vis-major ' + className;
+ }
+
+ line.style.height = props.majorLineHeight + 'px';
+ line.style.width = width + 'px';
+
+ return line;
+ };
+
+ /**
+ * Determine the size of text on the axis (both major and minor axis).
+ * The size is calculated only once and then cached in this.props.
+ * @private
+ */
+ TimeAxis.prototype._calculateCharSize = function () {
+ // Note: We calculate char size with every redraw. Size may change, for
+ // example when any of the timelines parents had display:none for example.
+
+ // determine the char width and height on the minor axis
+ if (!this.dom.measureCharMinor) {
+ this.dom.measureCharMinor = document.createElement('DIV');
+ this.dom.measureCharMinor.className = 'vis-text vis-minor vis-measure';
+ this.dom.measureCharMinor.style.position = 'absolute';
+
+ this.dom.measureCharMinor.appendChild(document.createTextNode('0'));
+ this.dom.foreground.appendChild(this.dom.measureCharMinor);
+ }
+ this.props.minorCharHeight = this.dom.measureCharMinor.clientHeight;
+ this.props.minorCharWidth = this.dom.measureCharMinor.clientWidth;
+
+ // determine the char width and height on the major axis
+ if (!this.dom.measureCharMajor) {
+ this.dom.measureCharMajor = document.createElement('DIV');
+ this.dom.measureCharMajor.className = 'vis-text vis-major vis-measure';
+ this.dom.measureCharMajor.style.position = 'absolute';
+
+ this.dom.measureCharMajor.appendChild(document.createTextNode('0'));
+ this.dom.foreground.appendChild(this.dom.measureCharMajor);
+ }
+ this.props.majorCharHeight = this.dom.measureCharMajor.clientHeight;
+ this.props.majorCharWidth = this.dom.measureCharMajor.clientWidth;
+ };
+
+ var warnedForOverflow = false;
+
+ module.exports = TimeAxis;
+
+/***/ },
+/* 139 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var keycharm = __webpack_require__(111);
+ var Emitter = __webpack_require__(95);
+ var Hammer = __webpack_require__(108);
+ var util = __webpack_require__(1);
+
+ /**
+ * Turn an element into an clickToUse element.
+ * When not active, the element has a transparent overlay. When the overlay is
+ * clicked, the mode is changed to active.
+ * When active, the element is displayed with a blue border around it, and
+ * the interactive contents of the element can be used. When clicked outside
+ * the element, the elements mode is changed to inactive.
+ * @param {Element} container
+ * @constructor
+ */
+ function Activator(container) {
+ this.active = false;
+
+ this.dom = {
+ container: container
+ };
+
+ this.dom.overlay = document.createElement('div');
+ this.dom.overlay.className = 'vis-overlay';
+
+ this.dom.container.appendChild(this.dom.overlay);
+
+ this.hammer = Hammer(this.dom.overlay);
+ this.hammer.on('tap', this._onTapOverlay.bind(this));
+
+ // block all touch events (except tap)
+ var me = this;
+ var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend'];
+ events.forEach(function (event) {
+ me.hammer.on(event, function (event) {
+ event.stopPropagation();
+ });
+ });
+
+ // attach a click event to the window, in order to deactivate when clicking outside the timeline
+ if (document && document.body) {
+ this.onClick = function (event) {
+ if (!_hasParent(event.target, container)) {
+ me.deactivate();
+ }
+ };
+ document.body.addEventListener('click', this.onClick);
+ }
+
+ if (this.keycharm !== undefined) {
+ this.keycharm.destroy();
+ }
+ this.keycharm = keycharm();
+
+ // keycharm listener only bounded when active)
+ this.escListener = this.deactivate.bind(this);
+ }
+
+ // turn into an event emitter
+ Emitter(Activator.prototype);
+
+ // The currently active activator
+ Activator.current = null;
+
+ /**
+ * Destroy the activator. Cleans up all created DOM and event listeners
+ */
+ Activator.prototype.destroy = function () {
+ this.deactivate();
+
+ // remove dom
+ this.dom.overlay.parentNode.removeChild(this.dom.overlay);
+
+ // remove global event listener
+ if (this.onClick) {
+ document.body.removeEventListener('click', this.onClick);
+ }
+
+ // cleanup hammer instances
+ this.hammer.destroy();
+ this.hammer = null;
+ // FIXME: cleaning up hammer instances doesn't work (Timeline not removed from memory)
+ };
+
+ /**
+ * Activate the element
+ * Overlay is hidden, element is decorated with a blue shadow border
+ */
+ Activator.prototype.activate = function () {
+ // we allow only one active activator at a time
+ if (Activator.current) {
+ Activator.current.deactivate();
+ }
+ Activator.current = this;
+
+ this.active = true;
+ this.dom.overlay.style.display = 'none';
+ util.addClassName(this.dom.container, 'vis-active');
+
+ this.emit('change');
+ this.emit('activate');
+
+ // ugly hack: bind ESC after emitting the events, as the Network rebinds all
+ // keyboard events on a 'change' event
+ this.keycharm.bind('esc', this.escListener);
+ };
+
+ /**
+ * Deactivate the element
+ * Overlay is displayed on top of the element
+ */
+ Activator.prototype.deactivate = function () {
+ this.active = false;
+ this.dom.overlay.style.display = '';
+ util.removeClassName(this.dom.container, 'vis-active');
+ this.keycharm.unbind('esc', this.escListener);
+
+ this.emit('change');
+ this.emit('deactivate');
+ };
+
+ /**
+ * Handle a tap event: activate the container
+ * @param event
+ * @private
+ */
+ Activator.prototype._onTapOverlay = function (event) {
+ // activate the container
+ this.activate();
+ event.stopPropagation();
+ };
+
+ /**
+ * Test whether the element has the requested parent element somewhere in
+ * its chain of parent nodes.
+ * @param {HTMLElement} element
+ * @param {HTMLElement} parent
+ * @returns {boolean} Returns true when the parent is found somewhere in the
+ * chain of parent nodes.
+ * @private
+ */
+ function _hasParent(element, parent) {
+ while (element) {
+ if (element === parent) {
+ return true;
+ }
+ element = element.parentNode;
+ }
+ return false;
+ }
+
+ module.exports = Activator;
+
+/***/ },
+/* 140 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var Hammer = __webpack_require__(108);
+ var util = __webpack_require__(1);
+ var Component = __webpack_require__(124);
+ var moment = __webpack_require__(84);
+ var locales = __webpack_require__(141);
+
+ /**
+ * A custom time bar
+ * @param {{range: Range, dom: Object}} body
+ * @param {Object} [options] Available parameters:
+ * {number | string} id
+ * {string} locales
+ * {string} locale
+ * @constructor CustomTime
+ * @extends Component
+ */
+
+ function CustomTime(body, options) {
+ this.body = body;
+
+ // default options
+ this.defaultOptions = {
+ moment: moment,
+ locales: locales,
+ locale: 'en',
+ id: undefined,
+ title: undefined
+ };
+ this.options = util.extend({}, this.defaultOptions);
+
+ if (options && options.time) {
+ this.customTime = options.time;
+ } else {
+ this.customTime = new Date();
+ }
+
+ this.eventParams = {}; // stores state parameters while dragging the bar
+
+ this.setOptions(options);
+
+ // create the DOM
+ this._create();
+ }
+
+ CustomTime.prototype = new Component();
+
+ /**
+ * Set options for the component. Options will be merged in current options.
+ * @param {Object} options Available parameters:
+ * {number | string} id
+ * {string} locales
+ * {string} locale
+ */
+ CustomTime.prototype.setOptions = function (options) {
+ if (options) {
+ // copy all options that we know
+ util.selectiveExtend(['moment', 'locale', 'locales', 'id'], this.options, options);
+ }
+ };
+
+ /**
+ * Create the DOM for the custom time
+ * @private
+ */
+ CustomTime.prototype._create = function () {
+ var bar = document.createElement('div');
+ bar['custom-time'] = this;
+ bar.className = 'vis-custom-time ' + (this.options.id || '');
+ bar.style.position = 'absolute';
+ bar.style.top = '0px';
+ bar.style.height = '100%';
+ this.bar = bar;
+
+ var drag = document.createElement('div');
+ drag.style.position = 'relative';
+ drag.style.top = '0px';
+ drag.style.left = '-10px';
+ drag.style.height = '100%';
+ drag.style.width = '20px';
+
+ function onMouseWheel(e) {
+ this.body.range._onMouseWheel(e);
+ }
+
+ if (drag.addEventListener) {
+ // IE9, Chrome, Safari, Opera
+ drag.addEventListener("mousewheel", onMouseWheel.bind(this), false);
+ // Firefox
+ drag.addEventListener("DOMMouseScroll", onMouseWheel.bind(this), false);
+ } else {
+ // IE 6/7/8
+ drag.attachEvent("onmousewheel", onMouseWheel.bind(this));
+ }
+
+ bar.appendChild(drag);
+ // attach event listeners
+ this.hammer = new Hammer(drag);
+ this.hammer.on('panstart', this._onDragStart.bind(this));
+ this.hammer.on('panmove', this._onDrag.bind(this));
+ this.hammer.on('panend', this._onDragEnd.bind(this));
+ this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL });
+ };
+
+ /**
+ * Destroy the CustomTime bar
+ */
+ CustomTime.prototype.destroy = function () {
+ this.hide();
+
+ this.hammer.destroy();
+ this.hammer = null;
+
+ this.body = null;
+ };
+
+ /**
+ * Repaint the component
+ * @return {boolean} Returns true if the component is resized
+ */
+ CustomTime.prototype.redraw = function () {
+ var parent = this.body.dom.backgroundVertical;
+ if (this.bar.parentNode != parent) {
+ // attach to the dom
+ if (this.bar.parentNode) {
+ this.bar.parentNode.removeChild(this.bar);
+ }
+ parent.appendChild(this.bar);
+ }
+
+ var x = this.body.util.toScreen(this.customTime);
+
+ var locale = this.options.locales[this.options.locale];
+ if (!locale) {
+ if (!this.warned) {
+ console.log('WARNING: options.locales[\'' + this.options.locale + '\'] not found. See http://visjs.org/docs/timeline/#Localization');
+ this.warned = true;
+ }
+ locale = this.options.locales['en']; // fall back on english when not available
+ }
+
+ var title = this.options.title;
+ // To hide the title completely use empty string ''.
+ if (title === undefined) {
+ title = locale.time + ': ' + this.options.moment(this.customTime).format('dddd, MMMM Do YYYY, H:mm:ss');
+ title = title.charAt(0).toUpperCase() + title.substring(1);
+ }
+
+ this.bar.style.left = x + 'px';
+ this.bar.title = title;
+
+ return false;
+ };
+
+ /**
+ * Remove the CustomTime from the DOM
+ */
+ CustomTime.prototype.hide = function () {
+ // remove the line from the DOM
+ if (this.bar.parentNode) {
+ this.bar.parentNode.removeChild(this.bar);
+ }
+ };
+
+ /**
+ * Set custom time.
+ * @param {Date | number | string} time
+ */
+ CustomTime.prototype.setCustomTime = function (time) {
+ this.customTime = util.convert(time, 'Date');
+ this.redraw();
+ };
+
+ /**
+ * Retrieve the current custom time.
+ * @return {Date} customTime
+ */
+ CustomTime.prototype.getCustomTime = function () {
+ return new Date(this.customTime.valueOf());
+ };
+
+ /**
+ * Set custom title.
+ * @param {Date | number | string} title
+ */
+ CustomTime.prototype.setCustomTitle = function (title) {
+ this.options.title = title;
+ };
+
+ /**
+ * Start moving horizontally
+ * @param {Event} event
+ * @private
+ */
+ CustomTime.prototype._onDragStart = function (event) {
+ this.eventParams.dragging = true;
+ this.eventParams.customTime = this.customTime;
+
+ event.stopPropagation();
+ };
+
+ /**
+ * Perform moving operating.
+ * @param {Event} event
+ * @private
+ */
+ CustomTime.prototype._onDrag = function (event) {
+ if (!this.eventParams.dragging) return;
+
+ var x = this.body.util.toScreen(this.eventParams.customTime) + event.deltaX;
+ var time = this.body.util.toTime(x);
+
+ this.setCustomTime(time);
+
+ // fire a timechange event
+ this.body.emitter.emit('timechange', {
+ id: this.options.id,
+ time: new Date(this.customTime.valueOf()),
+ event: util.elementsCensor(event)
+ });
+
+ event.stopPropagation();
+ };
+
+ /**
+ * Stop moving operating.
+ * @param {Event} event
+ * @private
+ */
+ CustomTime.prototype._onDragEnd = function (event) {
+ if (!this.eventParams.dragging) return;
+
+ // fire a timechanged event
+ this.body.emitter.emit('timechanged', {
+ id: this.options.id,
+ time: new Date(this.customTime.valueOf()),
+ event: util.elementsCensor(event)
+ });
+
+ event.stopPropagation();
+ };
+
+ /**
+ * Find a custom time from an event target:
+ * searches for the attribute 'custom-time' in the event target's element tree
+ * @param {Event} event
+ * @return {CustomTime | null} customTime
+ */
+ CustomTime.customTimeFromTarget = function (event) {
+ var target = event.target;
+ while (target) {
+ if (target.hasOwnProperty('custom-time')) {
+ return target['custom-time'];
+ }
+ target = target.parentNode;
+ }
+
+ return null;
+ };
+
+ module.exports = CustomTime;
+
+/***/ },
+/* 141 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ // English
+ exports['en'] = {
+ current: 'current',
+ time: 'time'
+ };
+ exports['en_EN'] = exports['en'];
+ exports['en_US'] = exports['en'];
+
+ // Italiano
+ exports['it'] = {
+ current: 'attuale',
+ time: 'tempo'
+ };
+ exports['it_IT'] = exports['it'];
+ exports['it_CH'] = exports['it'];
+
+ // Dutch
+ exports['nl'] = {
+ current: 'huidige',
+ time: 'tijd'
+ };
+ exports['nl_NL'] = exports['nl'];
+ exports['nl_BE'] = exports['nl'];
+
+ // German
+ exports['de'] = {
+ current: 'Aktuelle',
+ time: 'Zeit'
+ };
+ exports['de_DE'] = exports['de'];
+
+/***/ },
+/* 142 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var util = __webpack_require__(1);
+ var Component = __webpack_require__(124);
+ var moment = __webpack_require__(84);
+ var locales = __webpack_require__(141);
+
+ /**
+ * A current time bar
+ * @param {{range: Range, dom: Object, domProps: Object}} body
+ * @param {Object} [options] Available parameters:
+ * {Boolean} [showCurrentTime]
+ * @constructor CurrentTime
+ * @extends Component
+ */
+ function CurrentTime(body, options) {
+ this.body = body;
+
+ // default options
+ this.defaultOptions = {
+ rtl: false,
+ showCurrentTime: true,
+
+ moment: moment,
+ locales: locales,
+ locale: 'en'
+ };
+ this.options = util.extend({}, this.defaultOptions);
+ this.offset = 0;
+
+ this._create();
+
+ this.setOptions(options);
+ }
+
+ CurrentTime.prototype = new Component();
+
+ /**
+ * Create the HTML DOM for the current time bar
+ * @private
+ */
+ CurrentTime.prototype._create = function () {
+ var bar = document.createElement('div');
+ bar.className = 'vis-current-time';
+ bar.style.position = 'absolute';
+ bar.style.top = '0px';
+ bar.style.height = '100%';
+
+ this.bar = bar;
+ };
+
+ /**
+ * Destroy the CurrentTime bar
+ */
+ CurrentTime.prototype.destroy = function () {
+ this.options.showCurrentTime = false;
+ this.redraw(); // will remove the bar from the DOM and stop refreshing
+
+ this.body = null;
+ };
+
+ /**
+ * Set options for the component. Options will be merged in current options.
+ * @param {Object} options Available parameters:
+ * {boolean} [showCurrentTime]
+ */
+ CurrentTime.prototype.setOptions = function (options) {
+ if (options) {
+ // copy all options that we know
+ util.selectiveExtend(['rtl', 'showCurrentTime', 'moment', 'locale', 'locales'], this.options, options);
+ }
+ };
+
+ /**
+ * Repaint the component
+ * @return {boolean} Returns true if the component is resized
+ */
+ CurrentTime.prototype.redraw = function () {
+ if (this.options.showCurrentTime) {
+ var parent = this.body.dom.backgroundVertical;
+ if (this.bar.parentNode != parent) {
+ // attach to the dom
+ if (this.bar.parentNode) {
+ this.bar.parentNode.removeChild(this.bar);
+ }
+ parent.appendChild(this.bar);
+
+ this.start();
+ }
+
+ var now = this.options.moment(new Date().valueOf() + this.offset);
+ var x = this.body.util.toScreen(now);
+
+ var locale = this.options.locales[this.options.locale];
+ if (!locale) {
+ if (!this.warned) {
+ console.log('WARNING: options.locales[\'' + this.options.locale + '\'] not found. See http://visjs.org/docs/timeline/#Localization');
+ this.warned = true;
+ }
+ locale = this.options.locales['en']; // fall back on english when not available
+ }
+ var title = locale.current + ' ' + locale.time + ': ' + now.format('dddd, MMMM Do YYYY, H:mm:ss');
+ title = title.charAt(0).toUpperCase() + title.substring(1);
+
+ if (this.options.rtl) {
+ this.bar.style.right = x + 'px';
+ } else {
+ this.bar.style.left = x + 'px';
+ }
+ this.bar.title = title;
+ } else {
+ // remove the line from the DOM
+ if (this.bar.parentNode) {
+ this.bar.parentNode.removeChild(this.bar);
+ }
+ this.stop();
+ }
+
+ return false;
+ };
+
+ /**
+ * Start auto refreshing the current time bar
+ */
+ CurrentTime.prototype.start = function () {
+ var me = this;
+
+ function update() {
+ me.stop();
+
+ // determine interval to refresh
+ var scale = me.body.range.conversion(me.body.domProps.center.width).scale;
+ var interval = 1 / scale / 10;
+ if (interval < 30) interval = 30;
+ if (interval > 1000) interval = 1000;
+
+ me.redraw();
+ me.body.emitter.emit('currentTimeTick');
+
+ // start a renderTimer to adjust for the new time
+ me.currentTimeTimer = setTimeout(update, interval);
+ }
+
+ update();
+ };
+
+ /**
+ * Stop auto refreshing the current time bar
+ */
+ CurrentTime.prototype.stop = function () {
+ if (this.currentTimeTimer !== undefined) {
+ clearTimeout(this.currentTimeTimer);
+ delete this.currentTimeTimer;
+ }
+ };
+
+ /**
+ * Set a current time. This can be used for example to ensure that a client's
+ * time is synchronized with a shared server time.
+ * @param {Date | String | Number} time A Date, unix timestamp, or
+ * ISO date string.
+ */
+ CurrentTime.prototype.setCurrentTime = function (time) {
+ var t = util.convert(time, 'Date').valueOf();
+ var now = new Date().valueOf();
+ this.offset = t - now;
+ this.redraw();
+ };
+
+ /**
+ * Get the current time.
+ * @return {Date} Returns the current time.
+ */
+ CurrentTime.prototype.getCurrentTime = function () {
+ return new Date(new Date().valueOf() + this.offset);
+ };
+
+ module.exports = CurrentTime;
+
+/***/ },
+/* 143 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ /**
+ * This object contains all possible options. It will check if the types are correct, if required if the option is one
+ * of the allowed values.
+ *
+ * __any__ means that the name of the property does not matter.
+ * __type__ is a required field for all objects and contains the allowed types of all objects
+ */
+ var string = 'string';
+ var bool = 'boolean';
+ var number = 'number';
+ var array = 'array';
+ var date = 'date';
+ var object = 'object'; // should only be in a __type__ property
+ var dom = 'dom';
+ var moment = 'moment';
+ var any = 'any';
+
+ var allOptions = {
+ configure: {
+ enabled: { 'boolean': bool },
+ filter: { 'boolean': bool, 'function': 'function' },
+ container: { dom: dom },
+ __type__: { object: object, 'boolean': bool, 'function': 'function' }
+ },
+
+ //globals :
+ align: { string: string },
+ rtl: { 'boolean': bool, 'undefined': 'undefined' },
+ rollingMode: { 'boolean': bool, 'undefined': 'undefined' },
+ verticalScroll: { 'boolean': bool, 'undefined': 'undefined' },
+ horizontalScroll: { 'boolean': bool, 'undefined': 'undefined' },
+ autoResize: { 'boolean': bool },
+ throttleRedraw: { number: number }, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511
+ clickToUse: { 'boolean': bool },
+ dataAttributes: { string: string, array: array },
+ editable: {
+ add: { 'boolean': bool, 'undefined': 'undefined' },
+ remove: { 'boolean': bool, 'undefined': 'undefined' },
+ updateGroup: { 'boolean': bool, 'undefined': 'undefined' },
+ updateTime: { 'boolean': bool, 'undefined': 'undefined' },
+ overrideItems: { 'boolean': bool, 'undefined': 'undefined' },
+ __type__: { 'boolean': bool, object: object }
+ },
+ end: { number: number, date: date, string: string, moment: moment },
+ format: {
+ minorLabels: {
+ millisecond: { string: string, 'undefined': 'undefined' },
+ second: { string: string, 'undefined': 'undefined' },
+ minute: { string: string, 'undefined': 'undefined' },
+ hour: { string: string, 'undefined': 'undefined' },
+ weekday: { string: string, 'undefined': 'undefined' },
+ day: { string: string, 'undefined': 'undefined' },
+ month: { string: string, 'undefined': 'undefined' },
+ year: { string: string, 'undefined': 'undefined' },
+ __type__: { object: object, 'function': 'function' }
+ },
+ majorLabels: {
+ millisecond: { string: string, 'undefined': 'undefined' },
+ second: { string: string, 'undefined': 'undefined' },
+ minute: { string: string, 'undefined': 'undefined' },
+ hour: { string: string, 'undefined': 'undefined' },
+ weekday: { string: string, 'undefined': 'undefined' },
+ day: { string: string, 'undefined': 'undefined' },
+ month: { string: string, 'undefined': 'undefined' },
+ year: { string: string, 'undefined': 'undefined' },
+ __type__: { object: object, 'function': 'function' }
+ },
+ __type__: { object: object }
+ },
+ moment: { 'function': 'function' },
+ groupOrder: { string: string, 'function': 'function' },
+ groupEditable: {
+ add: { 'boolean': bool, 'undefined': 'undefined' },
+ remove: { 'boolean': bool, 'undefined': 'undefined' },
+ order: { 'boolean': bool, 'undefined': 'undefined' },
+ __type__: { 'boolean': bool, object: object }
+ },
+ groupOrderSwap: { 'function': 'function' },
+ height: { string: string, number: number },
+ hiddenDates: {
+ start: { date: date, number: number, string: string, moment: moment },
+ end: { date: date, number: number, string: string, moment: moment },
+ repeat: { string: string },
+ __type__: { object: object, array: array }
+ },
+ itemsAlwaysDraggable: { 'boolean': bool },
+ locale: { string: string },
+ locales: {
+ __any__: { any: any },
+ __type__: { object: object }
+ },
+ margin: {
+ axis: { number: number },
+ item: {
+ horizontal: { number: number, 'undefined': 'undefined' },
+ vertical: { number: number, 'undefined': 'undefined' },
+ __type__: { object: object, number: number }
+ },
+ __type__: { object: object, number: number }
+ },
+ max: { date: date, number: number, string: string, moment: moment },
+ maxHeight: { number: number, string: string },
+ maxMinorChars: { number: number },
+ min: { date: date, number: number, string: string, moment: moment },
+ minHeight: { number: number, string: string },
+ moveable: { 'boolean': bool },
+ multiselect: { 'boolean': bool },
+ multiselectPerGroup: { 'boolean': bool },
+ onAdd: { 'function': 'function' },
+ onUpdate: { 'function': 'function' },
+ onMove: { 'function': 'function' },
+ onMoving: { 'function': 'function' },
+ onRemove: { 'function': 'function' },
+ onAddGroup: { 'function': 'function' },
+ onMoveGroup: { 'function': 'function' },
+ onRemoveGroup: { 'function': 'function' },
+ order: { 'function': 'function' },
+ orientation: {
+ axis: { string: string, 'undefined': 'undefined' },
+ item: { string: string, 'undefined': 'undefined' },
+ __type__: { string: string, object: object }
+ },
+ selectable: { 'boolean': bool },
+ showCurrentTime: { 'boolean': bool },
+ showMajorLabels: { 'boolean': bool },
+ showMinorLabels: { 'boolean': bool },
+ stack: { 'boolean': bool },
+ stackSubgroups: { 'boolean': bool },
+ snap: { 'function': 'function', 'null': 'null' },
+ start: { date: date, number: number, string: string, moment: moment },
+ template: { 'function': 'function' },
+ groupTemplate: { 'function': 'function' },
+ visibleFrameTemplate: { string: string, 'function': 'function' },
+ tooltip: {
+ followMouse: { 'boolean': bool },
+ overflowMethod: { 'string': ['cap', 'flip'] },
+ __type__: { object: object }
+ },
+ tooltipOnItemUpdateTime: {
+ template: { 'function': 'function' },
+ __type__: { 'boolean': bool, object: object }
+ },
+ timeAxis: {
+ scale: { string: string, 'undefined': 'undefined' },
+ step: { number: number, 'undefined': 'undefined' },
+ __type__: { object: object }
+ },
+ type: { string: string },
+ width: { string: string, number: number },
+ zoomable: { 'boolean': bool },
+ zoomKey: { string: ['ctrlKey', 'altKey', 'metaKey', ''] },
+ zoomMax: { number: number },
+ zoomMin: { number: number },
+
+ __type__: { object: object }
+ };
+
+ var configureOptions = {
+ global: {
+ align: ['center', 'left', 'right'],
+ direction: false,
+ autoResize: true,
+ clickToUse: false,
+ // dataAttributes: ['all'], // FIXME: can be 'all' or string[]
+ editable: {
+ add: false,
+ remove: false,
+ updateGroup: false,
+ updateTime: false
+ },
+ end: '',
+ format: {
+ minorLabels: {
+ millisecond: 'SSS',
+ second: 's',
+ minute: 'HH:mm',
+ hour: 'HH:mm',
+ weekday: 'ddd D',
+ day: 'D',
+ month: 'MMM',
+ year: 'YYYY'
+ },
+ majorLabels: {
+ millisecond: 'HH:mm:ss',
+ second: 'D MMMM HH:mm',
+ minute: 'ddd D MMMM',
+ hour: 'ddd D MMMM',
+ weekday: 'MMMM YYYY',
+ day: 'MMMM YYYY',
+ month: 'YYYY',
+ year: ''
+ }
+ },
+
+ //groupOrder: {string, 'function': 'function'},
+ groupsDraggable: false,
+ height: '',
+ //hiddenDates: {object, array},
+ locale: '',
+ margin: {
+ axis: [20, 0, 100, 1],
+ item: {
+ horizontal: [10, 0, 100, 1],
+ vertical: [10, 0, 100, 1]
+ }
+ },
+ max: '',
+ maxHeight: '',
+ maxMinorChars: [7, 0, 20, 1],
+ min: '',
+ minHeight: '',
+ moveable: false,
+ multiselect: false,
+ multiselectPerGroup: false,
+ //onAdd: {'function': 'function'},
+ //onUpdate: {'function': 'function'},
+ //onMove: {'function': 'function'},
+ //onMoving: {'function': 'function'},
+ //onRename: {'function': 'function'},
+ //order: {'function': 'function'},
+ orientation: {
+ axis: ['both', 'bottom', 'top'],
+ item: ['bottom', 'top']
+ },
+ selectable: true,
+ showCurrentTime: false,
+ showMajorLabels: true,
+ showMinorLabels: true,
+ stack: true,
+ stackSubgroups: true,
+ //snap: {'function': 'function', nada},
+ start: '',
+ //template: {'function': 'function'},
+ //timeAxis: {
+ // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'],
+ // step: [1, 1, 10, 1]
+ //},
+ tooltip: {
+ followMouse: false,
+ overflowMethod: 'flip'
+ },
+ tooltipOnItemUpdateTime: false,
+ type: ['box', 'point', 'range', 'background'],
+ width: '100%',
+ zoomable: true,
+ zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
+ zoomMax: [315360000000000, 10, 315360000000000, 1],
+ zoomMin: [10, 10, 315360000000000, 1]
+ }
+ };
+
+ exports.allOptions = allOptions;
+ exports.configureOptions = configureOptions;
+
+/***/ },
+/* 144 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _Configurator = __webpack_require__(114);
+
+ var _Configurator2 = _interopRequireDefault(_Configurator);
+
+ var _Validator = __webpack_require__(122);
+
+ var _Validator2 = _interopRequireDefault(_Validator);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Emitter = __webpack_require__(95);
+ var Hammer = __webpack_require__(108);
+ var moment = __webpack_require__(84);
+ var util = __webpack_require__(1);
+ var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+ var Range = __webpack_require__(123);
+ var Core = __webpack_require__(126);
+ var TimeAxis = __webpack_require__(138);
+ var CurrentTime = __webpack_require__(142);
+ var CustomTime = __webpack_require__(140);
+ var LineGraph = __webpack_require__(145);
+
+ var printStyle = __webpack_require__(122).printStyle;
+ var allOptions = __webpack_require__(153).allOptions;
+ var configureOptions = __webpack_require__(153).configureOptions;
+
+ /**
+ * Create a timeline visualization
+ * @param {HTMLElement} container
+ * @param {vis.DataSet | Array} [items]
+ * @param {Object} [options] See Graph2d.setOptions for the available options.
+ * @constructor
+ * @extends Core
+ */
+ function Graph2d(container, items, groups, options) {
+ // if the third element is options, the forth is groups (optionally);
+ if (!(Array.isArray(groups) || groups instanceof DataSet || groups instanceof DataView) && groups instanceof Object) {
+ var forthArgument = options;
+ options = groups;
+ groups = forthArgument;
+ }
+
+ // TODO: REMOVE THIS in the next MAJOR release
+ // see https://github.com/almende/vis/issues/2511
+ if (options && options.throttleRedraw) {
+ console.warn("Graph2d option \"throttleRedraw\" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release.");
+ }
+
+ var me = this;
+ this.defaultOptions = {
+ start: null,
+ end: null,
+
+ autoResize: true,
+
+ orientation: {
+ axis: 'bottom', // axis orientation: 'bottom', 'top', or 'both'
+ item: 'bottom' // not relevant for Graph2d
+ },
+
+ moment: moment,
+
+ width: null,
+ height: null,
+ maxHeight: null,
+ minHeight: null
+ };
+ this.options = util.deepExtend({}, this.defaultOptions);
+
+ // Create the DOM, props, and emitter
+ this._create(container);
+
+ // all components listed here will be repainted automatically
+ this.components = [];
+
+ this.body = {
+ dom: this.dom,
+ domProps: this.props,
+ emitter: {
+ on: this.on.bind(this),
+ off: this.off.bind(this),
+ emit: this.emit.bind(this)
+ },
+ hiddenDates: [],
+ util: {
+ toScreen: me._toScreen.bind(me),
+ toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width
+ toTime: me._toTime.bind(me),
+ toGlobalTime: me._toGlobalTime.bind(me)
+ }
+ };
+
+ // range
+ this.range = new Range(this.body);
+ this.components.push(this.range);
+ this.body.range = this.range;
+
+ // time axis
+ this.timeAxis = new TimeAxis(this.body);
+ this.components.push(this.timeAxis);
+ //this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis);
+
+ // current time bar
+ this.currentTime = new CurrentTime(this.body);
+ this.components.push(this.currentTime);
+
+ // item set
+ this.linegraph = new LineGraph(this.body);
+
+ this.components.push(this.linegraph);
+
+ this.itemsData = null; // DataSet
+ this.groupsData = null; // DataSet
+
+
+ this.on('tap', function (event) {
+ me.emit('click', me.getEventProperties(event));
+ });
+ this.on('doubletap', function (event) {
+ me.emit('doubleClick', me.getEventProperties(event));
+ });
+ this.dom.root.oncontextmenu = function (event) {
+ me.emit('contextmenu', me.getEventProperties(event));
+ };
+
+ // apply options
+ if (options) {
+ this.setOptions(options);
+ }
+
+ // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS!
+ if (groups) {
+ this.setGroups(groups);
+ }
+
+ // create itemset
+ if (items) {
+ this.setItems(items);
+ }
+
+ // draw for the first time
+ this._redraw();
+ }
+
+ // Extend the functionality from Core
+ Graph2d.prototype = new Core();
+
+ Graph2d.prototype.setOptions = function (options) {
+ // validate options
+ var errorFound = _Validator2['default'].validate(options, allOptions);
+ if (errorFound === true) {
+ console.log('%cErrors have been found in the supplied options object.', printStyle);
+ }
+
+ Core.prototype.setOptions.call(this, options);
+ };
+
+ /**
+ * Set items
+ * @param {vis.DataSet | Array | null} items
+ */
+ Graph2d.prototype.setItems = function (items) {
+ var initialLoad = this.itemsData == null;
+
+ // convert to type DataSet when needed
+ var newDataSet;
+ if (!items) {
+ newDataSet = null;
+ } else if (items instanceof DataSet || items instanceof DataView) {
+ newDataSet = items;
+ } else {
+ // turn an array into a dataset
+ newDataSet = new DataSet(items, {
+ type: {
+ start: 'Date',
+ end: 'Date'
+ }
+ });
+ }
+
+ // set items
+ this.itemsData = newDataSet;
+ this.linegraph && this.linegraph.setItems(newDataSet);
+
+ if (initialLoad) {
+ if (this.options.start != undefined || this.options.end != undefined) {
+ var start = this.options.start != undefined ? this.options.start : null;
+ var end = this.options.end != undefined ? this.options.end : null;
+ this.setWindow(start, end, { animation: false });
+ } else {
+ this.fit({ animation: false });
+ }
+ }
+ };
+
+ /**
+ * Set groups
+ * @param {vis.DataSet | Array} groups
+ */
+ Graph2d.prototype.setGroups = function (groups) {
+ // convert to type DataSet when needed
+ var newDataSet;
+ if (!groups) {
+ newDataSet = null;
+ } else if (groups instanceof DataSet || groups instanceof DataView) {
+ newDataSet = groups;
+ } else {
+ // turn an array into a dataset
+ newDataSet = new DataSet(groups);
+ }
+
+ this.groupsData = newDataSet;
+ this.linegraph.setGroups(newDataSet);
+ };
+
+ /**
+ * Returns an object containing an SVG element with the icon of the group (size determined by iconWidth and iconHeight), the label of the group (content) and the yAxisOrientation of the group (left or right).
+ * @param groupId
+ * @param width
+ * @param height
+ */
+ Graph2d.prototype.getLegend = function (groupId, width, height) {
+ if (width === undefined) {
+ width = 15;
+ }
+ if (height === undefined) {
+ height = 15;
+ }
+ if (this.linegraph.groups[groupId] !== undefined) {
+ return this.linegraph.groups[groupId].getLegend(width, height);
+ } else {
+ return "cannot find group:'" + groupId + "'";
+ }
+ };
+
+ /**
+ * This checks if the visible option of the supplied group (by ID) is true or false.
+ * @param groupId
+ * @returns {*}
+ */
+ Graph2d.prototype.isGroupVisible = function (groupId) {
+ if (this.linegraph.groups[groupId] !== undefined) {
+ return this.linegraph.groups[groupId].visible && (this.linegraph.options.groups.visibility[groupId] === undefined || this.linegraph.options.groups.visibility[groupId] == true);
+ } else {
+ return false;
+ }
+ };
+
+ /**
+ * Get the data range of the item set.
+ * @returns {{min: Date, max: Date}} range A range with a start and end Date.
+ * When no minimum is found, min==null
+ * When no maximum is found, max==null
+ */
+ Graph2d.prototype.getDataRange = function () {
+ var min = null;
+ var max = null;
+
+ // calculate min from start filed
+ for (var groupId in this.linegraph.groups) {
+ if (this.linegraph.groups.hasOwnProperty(groupId)) {
+ if (this.linegraph.groups[groupId].visible == true) {
+ for (var i = 0; i < this.linegraph.groups[groupId].itemsData.length; i++) {
+ var item = this.linegraph.groups[groupId].itemsData[i];
+ var value = util.convert(item.x, 'Date').valueOf();
+ min = min == null ? value : min > value ? value : min;
+ max = max == null ? value : max < value ? value : max;
+ }
+ }
+ }
+ }
+
+ return {
+ min: min != null ? new Date(min) : null,
+ max: max != null ? new Date(max) : null
+ };
+ };
+
+ /**
+ * Generate Timeline related information from an event
+ * @param {Event} event
+ * @return {Object} An object with related information, like on which area
+ * The event happened, whether clicked on an item, etc.
+ */
+ Graph2d.prototype.getEventProperties = function (event) {
+ var clientX = event.center ? event.center.x : event.clientX;
+ var clientY = event.center ? event.center.y : event.clientY;
+ var x = clientX - util.getAbsoluteLeft(this.dom.centerContainer);
+ var y = clientY - util.getAbsoluteTop(this.dom.centerContainer);
+ var time = this._toTime(x);
+
+ var customTime = CustomTime.customTimeFromTarget(event);
+
+ var element = util.getTarget(event);
+ var what = null;
+ if (util.hasParent(element, this.timeAxis.dom.foreground)) {
+ what = 'axis';
+ } else if (this.timeAxis2 && util.hasParent(element, this.timeAxis2.dom.foreground)) {
+ what = 'axis';
+ } else if (util.hasParent(element, this.linegraph.yAxisLeft.dom.frame)) {
+ what = 'data-axis';
+ } else if (util.hasParent(element, this.linegraph.yAxisRight.dom.frame)) {
+ what = 'data-axis';
+ } else if (util.hasParent(element, this.linegraph.legendLeft.dom.frame)) {
+ what = 'legend';
+ } else if (util.hasParent(element, this.linegraph.legendRight.dom.frame)) {
+ what = 'legend';
+ } else if (customTime != null) {
+ what = 'custom-time';
+ } else if (util.hasParent(element, this.currentTime.bar)) {
+ what = 'current-time';
+ } else if (util.hasParent(element, this.dom.center)) {
+ what = 'background';
+ }
+
+ var value = [];
+ var yAxisLeft = this.linegraph.yAxisLeft;
+ var yAxisRight = this.linegraph.yAxisRight;
+ if (!yAxisLeft.hidden && this.itemsData.length > 0) {
+ value.push(yAxisLeft.screenToValue(y));
+ }
+ if (!yAxisRight.hidden && this.itemsData.length > 0) {
+ value.push(yAxisRight.screenToValue(y));
+ }
+
+ return {
+ event: event,
+ what: what,
+ pageX: event.srcEvent ? event.srcEvent.pageX : event.pageX,
+ pageY: event.srcEvent ? event.srcEvent.pageY : event.pageY,
+ x: x,
+ y: y,
+ time: time,
+ value: value
+ };
+ };
+
+ /**
+ * Load a configurator
+ * @return {Object}
+ * @private
+ */
+ Graph2d.prototype._createConfigurator = function () {
+ return new _Configurator2['default'](this, this.dom.container, configureOptions);
+ };
+
+ module.exports = Graph2d;
+
+/***/ },
+/* 145 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var DOMutil = __webpack_require__(90);
+ var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+ var Component = __webpack_require__(124);
+ var DataAxis = __webpack_require__(146);
+ var GraphGroup = __webpack_require__(148);
+ var Legend = __webpack_require__(152);
+ var Bars = __webpack_require__(149);
+ var Lines = __webpack_require__(151);
+ var Points = __webpack_require__(150);
+
+ var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items
+
+ /**
+ * This is the constructor of the LineGraph. It requires a Timeline body and options.
+ *
+ * @param body
+ * @param options
+ * @constructor
+ */
+ function LineGraph(body, options) {
+ this.id = util.randomUUID();
+ this.body = body;
+
+ this.defaultOptions = {
+ yAxisOrientation: 'left',
+ defaultGroup: 'default',
+ sort: true,
+ sampling: true,
+ stack: false,
+ graphHeight: '400px',
+ shaded: {
+ enabled: false,
+ orientation: 'bottom' // top, bottom, zero
+ },
+ style: 'line', // line, bar
+ barChart: {
+ width: 50,
+ sideBySide: false,
+ align: 'center' // left, center, right
+ },
+ interpolation: {
+ enabled: true,
+ parametrization: 'centripetal', // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
+ alpha: 0.5
+ },
+ drawPoints: {
+ enabled: true,
+ size: 6,
+ style: 'square' // square, circle
+ },
+ dataAxis: {}, //Defaults are done on DataAxis level
+ legend: {}, //Defaults are done on Legend level
+ groups: {
+ visibility: {}
+ }
+ };
+
+ // options is shared by this lineGraph and all its items
+ this.options = util.extend({}, this.defaultOptions);
+ this.dom = {};
+ this.props = {};
+ this.hammer = null;
+ this.groups = {};
+ this.abortedGraphUpdate = false;
+ this.updateSVGheight = false;
+ this.updateSVGheightOnResize = false;
+ this.forceGraphUpdate = true;
+
+ var me = this;
+ this.itemsData = null; // DataSet
+ this.groupsData = null; // DataSet
+
+ // listeners for the DataSet of the items
+ this.itemListeners = {
+ 'add': function add(event, params, senderId) {
+ me._onAdd(params.items);
+ },
+ 'update': function update(event, params, senderId) {
+ me._onUpdate(params.items);
+ },
+ 'remove': function remove(event, params, senderId) {
+ me._onRemove(params.items);
+ }
+ };
+
+ // listeners for the DataSet of the groups
+ this.groupListeners = {
+ 'add': function add(event, params, senderId) {
+ me._onAddGroups(params.items);
+ },
+ 'update': function update(event, params, senderId) {
+ me._onUpdateGroups(params.items);
+ },
+ 'remove': function remove(event, params, senderId) {
+ me._onRemoveGroups(params.items);
+ }
+ };
+
+ this.items = {}; // object with an Item for every data item
+ this.selection = []; // list with the ids of all selected nodes
+ this.lastStart = this.body.range.start;
+ this.touchParams = {}; // stores properties while dragging
+
+ this.svgElements = {};
+ this.setOptions(options);
+ this.groupsUsingDefaultStyles = [0];
+ this.body.emitter.on('rangechanged', function () {
+ me.lastStart = me.body.range.start;
+ me.svg.style.left = util.option.asSize(-me.props.width);
+
+ me.forceGraphUpdate = true;
+ //Is this local redraw necessary? (Core also does a change event!)
+ me.redraw.call(me);
+ });
+
+ // create the HTML DOM
+ this._create();
+ this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups };
+ }
+
+ LineGraph.prototype = new Component();
+
+ /**
+ * Create the HTML DOM for the ItemSet
+ */
+ LineGraph.prototype._create = function () {
+ var frame = document.createElement('div');
+ frame.className = 'vis-line-graph';
+ this.dom.frame = frame;
+
+ // create svg element for graph drawing.
+ this.svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
+ this.svg.style.position = 'relative';
+ this.svg.style.height = ('' + this.options.graphHeight).replace('px', '') + 'px';
+ this.svg.style.display = 'block';
+ frame.appendChild(this.svg);
+
+ // data axis
+ this.options.dataAxis.orientation = 'left';
+ this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups);
+
+ this.options.dataAxis.orientation = 'right';
+ this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups);
+ delete this.options.dataAxis.orientation;
+
+ // legends
+ this.legendLeft = new Legend(this.body, this.options.legend, 'left', this.options.groups);
+ this.legendRight = new Legend(this.body, this.options.legend, 'right', this.options.groups);
+
+ this.show();
+ };
+
+ /**
+ * set the options of the LineGraph. the mergeOptions is used for subObjects that have an enabled element.
+ * @param {object} options
+ */
+ LineGraph.prototype.setOptions = function (options) {
+ if (options) {
+ var fields = ['sampling', 'defaultGroup', 'stack', 'height', 'graphHeight', 'yAxisOrientation', 'style', 'barChart', 'dataAxis', 'sort', 'groups'];
+ if (options.graphHeight === undefined && options.height !== undefined) {
+ this.updateSVGheight = true;
+ this.updateSVGheightOnResize = true;
+ } else if (this.body.domProps.centerContainer.height !== undefined && options.graphHeight !== undefined) {
+ if (parseInt((options.graphHeight + '').replace("px", '')) < this.body.domProps.centerContainer.height) {
+ this.updateSVGheight = true;
+ }
+ }
+ util.selectiveDeepExtend(fields, this.options, options);
+ util.mergeOptions(this.options, options, 'interpolation');
+ util.mergeOptions(this.options, options, 'drawPoints');
+ util.mergeOptions(this.options, options, 'shaded');
+ util.mergeOptions(this.options, options, 'legend');
+
+ if (options.interpolation) {
+ if ((0, _typeof3['default'])(options.interpolation) == 'object') {
+ if (options.interpolation.parametrization) {
+ if (options.interpolation.parametrization == 'uniform') {
+ this.options.interpolation.alpha = 0;
+ } else if (options.interpolation.parametrization == 'chordal') {
+ this.options.interpolation.alpha = 1.0;
+ } else {
+ this.options.interpolation.parametrization = 'centripetal';
+ this.options.interpolation.alpha = 0.5;
+ }
+ }
+ }
+ }
+
+ if (this.yAxisLeft) {
+ if (options.dataAxis !== undefined) {
+ this.yAxisLeft.setOptions(this.options.dataAxis);
+ this.yAxisRight.setOptions(this.options.dataAxis);
+ }
+ }
+
+ if (this.legendLeft) {
+ if (options.legend !== undefined) {
+ this.legendLeft.setOptions(this.options.legend);
+ this.legendRight.setOptions(this.options.legend);
+ }
+ }
+
+ if (this.groups.hasOwnProperty(UNGROUPED)) {
+ this.groups[UNGROUPED].setOptions(options);
+ }
+ }
+
+ // this is used to redraw the graph if the visibility of the groups is changed.
+ if (this.dom.frame) {
+ //not on initial run?
+ this.forceGraphUpdate = true;
+ this.body.emitter.emit("_change", { queue: true });
+ }
+ };
+
+ /**
+ * Hide the component from the DOM
+ */
+ LineGraph.prototype.hide = function () {
+ // remove the frame containing the items
+ if (this.dom.frame.parentNode) {
+ this.dom.frame.parentNode.removeChild(this.dom.frame);
+ }
+ };
+
+ /**
+ * Show the component in the DOM (when not already visible).
+ * @return {Boolean} changed
+ */
+ LineGraph.prototype.show = function () {
+ // show frame containing the items
+ if (!this.dom.frame.parentNode) {
+ this.body.dom.center.appendChild(this.dom.frame);
+ }
+ };
+
+ /**
+ * Set items
+ * @param {vis.DataSet | null} items
+ */
+ LineGraph.prototype.setItems = function (items) {
+ var me = this,
+ ids,
+ oldItemsData = this.itemsData;
+
+ // replace the dataset
+ if (!items) {
+ this.itemsData = null;
+ } else if (items instanceof DataSet || items instanceof DataView) {
+ this.itemsData = items;
+ } else {
+ throw new TypeError('Data must be an instance of DataSet or DataView');
+ }
+
+ if (oldItemsData) {
+ // unsubscribe from old dataset
+ util.forEach(this.itemListeners, function (callback, event) {
+ oldItemsData.off(event, callback);
+ });
+
+ // remove all drawn items
+ ids = oldItemsData.getIds();
+ this._onRemove(ids);
+ }
+
+ if (this.itemsData) {
+ // subscribe to new dataset
+ var id = this.id;
+ util.forEach(this.itemListeners, function (callback, event) {
+ me.itemsData.on(event, callback, id);
+ });
+
+ // add all new items
+ ids = this.itemsData.getIds();
+ this._onAdd(ids);
+ }
+ };
+
+ /**
+ * Set groups
+ * @param {vis.DataSet} groups
+ */
+ LineGraph.prototype.setGroups = function (groups) {
+ var me = this;
+ var ids;
+
+ // unsubscribe from current dataset
+ if (this.groupsData) {
+ util.forEach(this.groupListeners, function (callback, event) {
+ me.groupsData.off(event, callback);
+ });
+
+ // remove all drawn groups
+ ids = this.groupsData.getIds();
+ this.groupsData = null;
+ for (var i = 0; i < ids.length; i++) {
+ this._removeGroup(ids[i]);
+ }
+ }
+
+ // replace the dataset
+ if (!groups) {
+ this.groupsData = null;
+ } else if (groups instanceof DataSet || groups instanceof DataView) {
+ this.groupsData = groups;
+ } else {
+ throw new TypeError('Data must be an instance of DataSet or DataView');
+ }
+
+ if (this.groupsData) {
+ // subscribe to new dataset
+ var id = this.id;
+ util.forEach(this.groupListeners, function (callback, event) {
+ me.groupsData.on(event, callback, id);
+ });
+
+ // draw all ms
+ ids = this.groupsData.getIds();
+ this._onAddGroups(ids);
+ }
+ };
+
+ LineGraph.prototype._onUpdate = function (ids) {
+ this._updateAllGroupData(ids);
+ };
+ LineGraph.prototype._onAdd = function (ids) {
+ this._onUpdate(ids);
+ };
+ LineGraph.prototype._onRemove = function (ids) {
+ this._onUpdate(ids);
+ };
+ LineGraph.prototype._onUpdateGroups = function (groupIds) {
+ this._updateAllGroupData(null, groupIds);
+ };
+ LineGraph.prototype._onAddGroups = function (groupIds) {
+ this._onUpdateGroups(groupIds);
+ };
+
+ /**
+ * this cleans the group out off the legends and the dataaxis, updates the ungrouped and updates the graph
+ * @param {Array} groupIds
+ * @private
+ */
+ LineGraph.prototype._onRemoveGroups = function (groupIds) {
+ for (var i = 0; i < groupIds.length; i++) {
+ this._removeGroup(groupIds[i]);
+ }
+ this.forceGraphUpdate = true;
+ this.body.emitter.emit("_change", { queue: true });
+ };
+
+ /**
+ * this cleans the group out off the legends and the dataaxis
+ * @param groupId
+ * @private
+ */
+ LineGraph.prototype._removeGroup = function (groupId) {
+ if (this.groups.hasOwnProperty(groupId)) {
+ if (this.groups[groupId].options.yAxisOrientation == 'right') {
+ this.yAxisRight.removeGroup(groupId);
+ this.legendRight.removeGroup(groupId);
+ this.legendRight.redraw();
+ } else {
+ this.yAxisLeft.removeGroup(groupId);
+ this.legendLeft.removeGroup(groupId);
+ this.legendLeft.redraw();
+ }
+ delete this.groups[groupId];
+ }
+ };
+
+ /**
+ * update a group object with the group dataset entree
+ *
+ * @param group
+ * @param groupId
+ * @private
+ */
+ LineGraph.prototype._updateGroup = function (group, groupId) {
+ if (!this.groups.hasOwnProperty(groupId)) {
+ this.groups[groupId] = new GraphGroup(group, groupId, this.options, this.groupsUsingDefaultStyles);
+ if (this.groups[groupId].options.yAxisOrientation == 'right') {
+ this.yAxisRight.addGroup(groupId, this.groups[groupId]);
+ this.legendRight.addGroup(groupId, this.groups[groupId]);
+ } else {
+ this.yAxisLeft.addGroup(groupId, this.groups[groupId]);
+ this.legendLeft.addGroup(groupId, this.groups[groupId]);
+ }
+ } else {
+ this.groups[groupId].update(group);
+ if (this.groups[groupId].options.yAxisOrientation == 'right') {
+ this.yAxisRight.updateGroup(groupId, this.groups[groupId]);
+ this.legendRight.updateGroup(groupId, this.groups[groupId]);
+ //If yAxisOrientation changed, clean out the group from the other axis.
+ this.yAxisLeft.removeGroup(groupId);
+ this.legendLeft.removeGroup(groupId);
+ } else {
+ this.yAxisLeft.updateGroup(groupId, this.groups[groupId]);
+ this.legendLeft.updateGroup(groupId, this.groups[groupId]);
+ //If yAxisOrientation changed, clean out the group from the other axis.
+ this.yAxisRight.removeGroup(groupId);
+ this.legendRight.removeGroup(groupId);
+ }
+ }
+ this.legendLeft.redraw();
+ this.legendRight.redraw();
+ };
+
+ /**
+ * this updates all groups, it is used when there is an update the the itemset.
+ *
+ * @param {Array} ids
+ * @param {Array} groupIds
+ * @private
+ */
+ LineGraph.prototype._updateAllGroupData = function (ids, groupIds) {
+ if (this.itemsData != null) {
+ var groupsContent = {};
+ var items = this.itemsData.get();
+ var fieldId = this.itemsData._fieldId;
+ var idMap = {};
+ if (ids) {
+ ids.map(function (id) {
+ idMap[id] = id;
+ });
+ }
+
+ //pre-Determine array sizes, for more efficient memory claim
+ var groupCounts = {};
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i];
+ var groupId = item.group;
+ if (groupId === null || groupId === undefined) {
+ groupId = UNGROUPED;
+ }
+ groupCounts.hasOwnProperty(groupId) ? groupCounts[groupId]++ : groupCounts[groupId] = 1;
+ }
+
+ //Pre-load arrays from existing groups if items are not changed (not in ids)
+ if (!groupIds && ids) {
+ for (var groupId in this.groups) {
+ if (this.groups.hasOwnProperty(groupId)) {
+ var group = this.groups[groupId];
+ var existing_items = group.getItems();
+
+ groupsContent[groupId] = existing_items.filter(function (item) {
+ return item[fieldId] !== idMap[item[fieldId]];
+ });
+ var newLength = groupCounts[groupId];
+ groupCounts[groupId] -= groupsContent[groupId].length;
+ if (groupsContent[groupId].length < newLength) {
+ groupsContent[groupId][newLength - 1] = {};
+ }
+ }
+ }
+ }
+
+ //Now insert data into the arrays.
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i];
+ var groupId = item.group;
+ if (groupId === null || groupId === undefined) {
+ groupId = UNGROUPED;
+ }
+ if (!groupIds && ids && item[fieldId] !== idMap[item[fieldId]]) {
+ continue;
+ }
+ if (!groupsContent.hasOwnProperty(groupId)) {
+ groupsContent[groupId] = new Array(groupCounts[groupId]);
+ }
+ //Copy data (because of unmodifiable DataView input.
+ var extended = util.bridgeObject(item);
+ extended.x = util.convert(item.x, 'Date');
+ extended.orginalY = item.y; //real Y
+ extended.y = Number(item.y);
+ extended[fieldId] = item[fieldId];
+
+ var index = groupsContent[groupId].length - groupCounts[groupId]--;
+ groupsContent[groupId][index] = extended;
+ }
+
+ //Make sure all groups are present, to allow removal of old groups
+ for (var groupId in this.groups) {
+ if (this.groups.hasOwnProperty(groupId)) {
+ if (!groupsContent.hasOwnProperty(groupId)) {
+ groupsContent[groupId] = new Array(0);
+ }
+ }
+ }
+
+ //Update legendas, style and axis
+ for (var groupId in groupsContent) {
+ if (groupsContent.hasOwnProperty(groupId)) {
+ if (groupsContent[groupId].length == 0) {
+ if (this.groups.hasOwnProperty(groupId)) {
+ this._removeGroup(groupId);
+ }
+ } else {
+ var group = undefined;
+ if (this.groupsData != undefined) {
+ group = this.groupsData.get(groupId);
+ }
+ if (group == undefined) {
+ group = { id: groupId, content: this.options.defaultGroup + groupId };
+ }
+ this._updateGroup(group, groupId);
+ this.groups[groupId].setItems(groupsContent[groupId]);
+ }
+ }
+ }
+ this.forceGraphUpdate = true;
+ this.body.emitter.emit("_change", { queue: true });
+ }
+ };
+
+ /**
+ * Redraw the component, mandatory function
+ * @return {boolean} Returns true if the component is resized
+ */
+ LineGraph.prototype.redraw = function () {
+ var resized = false;
+
+ // calculate actual size and position
+ this.props.width = this.dom.frame.offsetWidth;
+ this.props.height = this.body.domProps.centerContainer.height - this.body.domProps.border.top - this.body.domProps.border.bottom;
+
+ // check if this component is resized
+ resized = this._isResized() || resized;
+
+ // check whether zoomed (in that case we need to re-stack everything)
+ var visibleInterval = this.body.range.end - this.body.range.start;
+ var zoomed = visibleInterval != this.lastVisibleInterval;
+ this.lastVisibleInterval = visibleInterval;
+
+ // the svg element is three times as big as the width, this allows for fully dragging left and right
+ // without reloading the graph. the controls for this are bound to events in the constructor
+ if (resized == true) {
+ this.svg.style.width = util.option.asSize(3 * this.props.width);
+ this.svg.style.left = util.option.asSize(-this.props.width);
+
+ // if the height of the graph is set as proportional, change the height of the svg
+ if ((this.options.height + '').indexOf("%") != -1 || this.updateSVGheightOnResize == true) {
+ this.updateSVGheight = true;
+ }
+ }
+
+ // update the height of the graph on each redraw of the graph.
+ if (this.updateSVGheight == true) {
+ if (this.options.graphHeight != this.props.height + 'px') {
+ this.options.graphHeight = this.props.height + 'px';
+ this.svg.style.height = this.props.height + 'px';
+ }
+ this.updateSVGheight = false;
+ } else {
+ this.svg.style.height = ('' + this.options.graphHeight).replace('px', '') + 'px';
+ }
+
+ // zoomed is here to ensure that animations are shown correctly.
+ if (resized == true || zoomed == true || this.abortedGraphUpdate == true || this.forceGraphUpdate == true) {
+ resized = this._updateGraph() || resized;
+ this.forceGraphUpdate = false;
+ } else {
+ // move the whole svg while dragging
+ if (this.lastStart != 0) {
+ var offset = this.body.range.start - this.lastStart;
+ var range = this.body.range.end - this.body.range.start;
+ if (this.props.width != 0) {
+ var rangePerPixelInv = this.props.width / range;
+ var xOffset = offset * rangePerPixelInv;
+ this.svg.style.left = -this.props.width - xOffset + 'px';
+ }
+ }
+ }
+ this.legendLeft.redraw();
+ this.legendRight.redraw();
+ return resized;
+ };
+
+ LineGraph.prototype._getSortedGroupIds = function () {
+ // getting group Ids
+ var grouplist = [];
+ for (var groupId in this.groups) {
+ if (this.groups.hasOwnProperty(groupId)) {
+ var group = this.groups[groupId];
+ if (group.visible == true && (this.options.groups.visibility[groupId] === undefined || this.options.groups.visibility[groupId] == true)) {
+ grouplist.push({ id: groupId, zIndex: group.options.zIndex });
+ }
+ }
+ }
+ util.insertSort(grouplist, function (a, b) {
+ var az = a.zIndex;
+ var bz = b.zIndex;
+ if (az === undefined) az = 0;
+ if (bz === undefined) bz = 0;
+ return az == bz ? 0 : az < bz ? -1 : 1;
+ });
+ var groupIds = new Array(grouplist.length);
+ for (var i = 0; i < grouplist.length; i++) {
+ groupIds[i] = grouplist[i].id;
+ }
+ return groupIds;
+ };
+
+ /**
+ * Update and redraw the graph.
+ *
+ */
+ LineGraph.prototype._updateGraph = function () {
+ // reset the svg elements
+ DOMutil.prepareElements(this.svgElements);
+ if (this.props.width != 0 && this.itemsData != null) {
+ var group, i;
+ var groupRanges = {};
+ var changeCalled = false;
+ // this is the range of the SVG canvas
+ var minDate = this.body.util.toGlobalTime(-this.body.domProps.root.width);
+ var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width);
+
+ // getting group Ids
+ var groupIds = this._getSortedGroupIds();
+ if (groupIds.length > 0) {
+ var groupsData = {};
+
+ // fill groups data, this only loads the data we require based on the timewindow
+ this._getRelevantData(groupIds, groupsData, minDate, maxDate);
+
+ // apply sampling, if disabled, it will pass through this function.
+ this._applySampling(groupIds, groupsData);
+
+ // we transform the X coordinates to detect collisions
+ for (i = 0; i < groupIds.length; i++) {
+ this._convertXcoordinates(groupsData[groupIds[i]]);
+ }
+
+ // now all needed data has been collected we start the processing.
+ this._getYRanges(groupIds, groupsData, groupRanges);
+
+ // update the Y axis first, we use this data to draw at the correct Y points
+ changeCalled = this._updateYAxis(groupIds, groupRanges);
+
+ // at changeCalled, abort this update cycle as the graph needs another update with new Width input from the Redraw container.
+ // Cleanup SVG elements on abort.
+ if (changeCalled == true) {
+ DOMutil.cleanupElements(this.svgElements);
+ this.abortedGraphUpdate = true;
+ return true;
+ }
+ this.abortedGraphUpdate = false;
+
+ // With the yAxis scaled correctly, use this to get the Y values of the points.
+ var below = undefined;
+ for (i = 0; i < groupIds.length; i++) {
+ group = this.groups[groupIds[i]];
+ if (this.options.stack === true && this.options.style === 'line') {
+ if (group.options.excludeFromStacking == undefined || !group.options.excludeFromStacking) {
+ if (below != undefined) {
+ this._stack(groupsData[group.id], groupsData[below.id]);
+ if (group.options.shaded.enabled == true && group.options.shaded.orientation !== "group") {
+ if (group.options.shaded.orientation == "top" && below.options.shaded.orientation !== "group") {
+ below.options.shaded.orientation = "group";
+ below.options.shaded.groupId = group.id;
+ } else {
+ group.options.shaded.orientation = "group";
+ group.options.shaded.groupId = below.id;
+ }
+ }
+ }
+ below = group;
+ }
+ }
+ this._convertYcoordinates(groupsData[groupIds[i]], group);
+ }
+
+ //Precalculate paths and draw shading if appropriate. This will make sure the shading is always behind any lines.
+ var paths = {};
+ for (i = 0; i < groupIds.length; i++) {
+ group = this.groups[groupIds[i]];
+ if (group.options.style === 'line' && group.options.shaded.enabled == true) {
+ var dataset = groupsData[groupIds[i]];
+ if (dataset == null || dataset.length == 0) {
+ continue;
+ }
+ if (!paths.hasOwnProperty(groupIds[i])) {
+ paths[groupIds[i]] = Lines.calcPath(dataset, group);
+ }
+ if (group.options.shaded.orientation === "group") {
+ var subGroupId = group.options.shaded.groupId;
+ if (groupIds.indexOf(subGroupId) === -1) {
+ console.log(group.id + ": Unknown shading group target given:" + subGroupId);
+ continue;
+ }
+ if (!paths.hasOwnProperty(subGroupId)) {
+ paths[subGroupId] = Lines.calcPath(groupsData[subGroupId], this.groups[subGroupId]);
+ }
+ Lines.drawShading(paths[groupIds[i]], group, paths[subGroupId], this.framework);
+ } else {
+ Lines.drawShading(paths[groupIds[i]], group, undefined, this.framework);
+ }
+ }
+ }
+
+ // draw the groups, calculating paths if still necessary.
+ Bars.draw(groupIds, groupsData, this.framework);
+ for (i = 0; i < groupIds.length; i++) {
+ group = this.groups[groupIds[i]];
+ if (groupsData[groupIds[i]].length > 0) {
+ switch (group.options.style) {
+ case "line":
+ if (!paths.hasOwnProperty(groupIds[i])) {
+ paths[groupIds[i]] = Lines.calcPath(groupsData[groupIds[i]], group);
+ }
+ Lines.draw(paths[groupIds[i]], group, this.framework);
+ //explicit no break;
+ case "point":
+ //explicit no break;
+ case "points":
+ if (group.options.style == "point" || group.options.style == "points" || group.options.drawPoints.enabled == true) {
+ Points.draw(groupsData[groupIds[i]], group, this.framework);
+ }
+ break;
+ case "bar":
+ // bar needs to be drawn enmasse
+ //explicit no break
+ default:
+ //do nothing...
+ }
+ }
+ }
+ }
+ }
+
+ // cleanup unused svg elements
+ DOMutil.cleanupElements(this.svgElements);
+ return false;
+ };
+
+ LineGraph.prototype._stack = function (data, subData) {
+ var index, dx, dy, subPrevPoint, subNextPoint;
+ index = 0;
+ // for each data point we look for a matching on in the set below
+ for (var j = 0; j < data.length; j++) {
+ subPrevPoint = undefined;
+ subNextPoint = undefined;
+ // we look for time matches or a before-after point
+ for (var k = index; k < subData.length; k++) {
+ // if times match exactly
+ if (subData[k].x === data[j].x) {
+ subPrevPoint = subData[k];
+ subNextPoint = subData[k];
+ index = k;
+ break;
+ } else if (subData[k].x > data[j].x) {
+ // overshoot
+ subNextPoint = subData[k];
+ if (k == 0) {
+ subPrevPoint = subNextPoint;
+ } else {
+ subPrevPoint = subData[k - 1];
+ }
+ index = k;
+ break;
+ }
+ }
+ // in case the last data point has been used, we assume it stays like this.
+ if (subNextPoint === undefined) {
+ subPrevPoint = subData[subData.length - 1];
+ subNextPoint = subData[subData.length - 1];
+ }
+ // linear interpolation
+ dx = subNextPoint.x - subPrevPoint.x;
+ dy = subNextPoint.y - subPrevPoint.y;
+ if (dx == 0) {
+ data[j].y = data[j].orginalY + subNextPoint.y;
+ } else {
+ data[j].y = data[j].orginalY + dy / dx * (data[j].x - subPrevPoint.x) + subPrevPoint.y; // ax + b where b is data[j].y
+ }
+ }
+ };
+
+ /**
+ * first select and preprocess the data from the datasets.
+ * the groups have their preselection of data, we now loop over this data to see
+ * what data we need to draw. Sorted data is much faster.
+ * more optimization is possible by doing the sampling before and using the binary search
+ * to find the end date to determine the increment.
+ *
+ * @param {array} groupIds
+ * @param {object} groupsData
+ * @param {date} minDate
+ * @param {date} maxDate
+ * @private
+ */
+ LineGraph.prototype._getRelevantData = function (groupIds, groupsData, minDate, maxDate) {
+ var group, i, j, item;
+ if (groupIds.length > 0) {
+ for (i = 0; i < groupIds.length; i++) {
+ group = this.groups[groupIds[i]];
+ var itemsData = group.getItems();
+ // optimization for sorted data
+ if (group.options.sort == true) {
+ var dateComparator = function dateComparator(a, b) {
+ return a.getTime() == b.getTime() ? 0 : a < b ? -1 : 1;
+ };
+ var first = Math.max(0, util.binarySearchValue(itemsData, minDate, 'x', 'before', dateComparator));
+ var last = Math.min(itemsData.length, util.binarySearchValue(itemsData, maxDate, 'x', 'after', dateComparator) + 1);
+ if (last <= 0) {
+ last = itemsData.length;
+ }
+ var dataContainer = new Array(last - first);
+ for (j = first; j < last; j++) {
+ item = group.itemsData[j];
+ dataContainer[j - first] = item;
+ }
+ groupsData[groupIds[i]] = dataContainer;
+ } else {
+ // If unsorted data, all data is relevant, just returning entire structure
+ groupsData[groupIds[i]] = group.itemsData;
+ }
+ }
+ }
+ };
+
+ /**
+ *
+ * @param groupIds
+ * @param groupsData
+ * @private
+ */
+ LineGraph.prototype._applySampling = function (groupIds, groupsData) {
+ var group;
+ if (groupIds.length > 0) {
+ for (var i = 0; i < groupIds.length; i++) {
+ group = this.groups[groupIds[i]];
+ if (group.options.sampling == true) {
+ var dataContainer = groupsData[groupIds[i]];
+ if (dataContainer.length > 0) {
+ var increment = 1;
+ var amountOfPoints = dataContainer.length;
+
+ // the global screen is used because changing the width of the yAxis may affect the increment, resulting in an endless loop
+ // of width changing of the yAxis.
+ //TODO: This assumes sorted data, but that's not guaranteed!
+ var xDistance = this.body.util.toGlobalScreen(dataContainer[dataContainer.length - 1].x) - this.body.util.toGlobalScreen(dataContainer[0].x);
+ var pointsPerPixel = amountOfPoints / xDistance;
+ increment = Math.min(Math.ceil(0.2 * amountOfPoints), Math.max(1, Math.round(pointsPerPixel)));
+
+ var sampledData = new Array(amountOfPoints);
+ for (var j = 0; j < amountOfPoints; j += increment) {
+ var idx = Math.round(j / increment);
+ sampledData[idx] = dataContainer[j];
+ }
+ groupsData[groupIds[i]] = sampledData.splice(0, Math.round(amountOfPoints / increment));
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ *
+ *
+ * @param {array} groupIds
+ * @param {object} groupsData
+ * @param {object} groupRanges | this is being filled here
+ * @private
+ */
+ LineGraph.prototype._getYRanges = function (groupIds, groupsData, groupRanges) {
+ var groupData, group, i;
+ var combinedDataLeft = [];
+ var combinedDataRight = [];
+ var options;
+ if (groupIds.length > 0) {
+ for (i = 0; i < groupIds.length; i++) {
+ groupData = groupsData[groupIds[i]];
+ options = this.groups[groupIds[i]].options;
+ if (groupData.length > 0) {
+ group = this.groups[groupIds[i]];
+ // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups.
+ if (options.stack === true && options.style === 'bar') {
+ if (options.yAxisOrientation === 'left') {
+ combinedDataLeft = combinedDataLeft.concat(group.getItems());
+ } else {
+ combinedDataRight = combinedDataRight.concat(group.getItems());
+ }
+ } else {
+ groupRanges[groupIds[i]] = group.getYRange(groupData, groupIds[i]);
+ }
+ }
+ }
+
+ // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups.
+ Bars.getStackedYRange(combinedDataLeft, groupRanges, groupIds, '__barStackLeft', 'left');
+ Bars.getStackedYRange(combinedDataRight, groupRanges, groupIds, '__barStackRight', 'right');
+ }
+ };
+
+ /**
+ * this sets the Y ranges for the Y axis. It also determines which of the axis should be shown or hidden.
+ * @param {Array} groupIds
+ * @param {Object} groupRanges
+ * @private
+ */
+ LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) {
+ var resized = false;
+ var yAxisLeftUsed = false;
+ var yAxisRightUsed = false;
+ var minLeft = 1e9,
+ minRight = 1e9,
+ maxLeft = -1e9,
+ maxRight = -1e9,
+ minVal,
+ maxVal;
+ // if groups are present
+ if (groupIds.length > 0) {
+ // this is here to make sure that if there are no items in the axis but there are groups, that there is no infinite draw/redraw loop.
+ for (var i = 0; i < groupIds.length; i++) {
+ var group = this.groups[groupIds[i]];
+ if (group && group.options.yAxisOrientation != 'right') {
+ yAxisLeftUsed = true;
+ minLeft = 1e9;
+ maxLeft = -1e9;
+ } else if (group && group.options.yAxisOrientation) {
+ yAxisRightUsed = true;
+ minRight = 1e9;
+ maxRight = -1e9;
+ }
+ }
+
+ // if there are items:
+ for (var i = 0; i < groupIds.length; i++) {
+ if (groupRanges.hasOwnProperty(groupIds[i])) {
+ if (groupRanges[groupIds[i]].ignore !== true) {
+ minVal = groupRanges[groupIds[i]].min;
+ maxVal = groupRanges[groupIds[i]].max;
+
+ if (groupRanges[groupIds[i]].yAxisOrientation != 'right') {
+ yAxisLeftUsed = true;
+ minLeft = minLeft > minVal ? minVal : minLeft;
+ maxLeft = maxLeft < maxVal ? maxVal : maxLeft;
+ } else {
+ yAxisRightUsed = true;
+ minRight = minRight > minVal ? minVal : minRight;
+ maxRight = maxRight < maxVal ? maxVal : maxRight;
+ }
+ }
+ }
+ }
+
+ if (yAxisLeftUsed == true) {
+ this.yAxisLeft.setRange(minLeft, maxLeft);
+ }
+ if (yAxisRightUsed == true) {
+ this.yAxisRight.setRange(minRight, maxRight);
+ }
+ }
+ resized = this._toggleAxisVisiblity(yAxisLeftUsed, this.yAxisLeft) || resized;
+ resized = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || resized;
+
+ if (yAxisRightUsed == true && yAxisLeftUsed == true) {
+ this.yAxisLeft.drawIcons = true;
+ this.yAxisRight.drawIcons = true;
+ } else {
+ this.yAxisLeft.drawIcons = false;
+ this.yAxisRight.drawIcons = false;
+ }
+ this.yAxisRight.master = !yAxisLeftUsed;
+ this.yAxisRight.masterAxis = this.yAxisLeft;
+
+ if (this.yAxisRight.master == false) {
+ if (yAxisRightUsed == true) {
+ this.yAxisLeft.lineOffset = this.yAxisRight.width;
+ } else {
+ this.yAxisLeft.lineOffset = 0;
+ }
+
+ resized = this.yAxisLeft.redraw() || resized;
+ resized = this.yAxisRight.redraw() || resized;
+ } else {
+ resized = this.yAxisRight.redraw() || resized;
+ }
+
+ // clean the accumulated lists
+ var tempGroups = ['__barStackLeft', '__barStackRight', '__lineStackLeft', '__lineStackRight'];
+ for (var i = 0; i < tempGroups.length; i++) {
+ if (groupIds.indexOf(tempGroups[i]) != -1) {
+ groupIds.splice(groupIds.indexOf(tempGroups[i]), 1);
+ }
+ }
+
+ return resized;
+ };
+
+ /**
+ * This shows or hides the Y axis if needed. If there is a change, the changed event is emitted by the updateYAxis function
+ *
+ * @param {boolean} axisUsed
+ * @returns {boolean}
+ * @private
+ * @param axis
+ */
+ LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) {
+ var changed = false;
+ if (axisUsed == false) {
+ if (axis.dom.frame.parentNode && axis.hidden == false) {
+ axis.hide();
+ changed = true;
+ }
+ } else {
+ if (!axis.dom.frame.parentNode && axis.hidden == true) {
+ axis.show();
+ changed = true;
+ }
+ }
+ return changed;
+ };
+
+ /**
+ * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the
+ * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for
+ * the yAxis.
+ *
+ * @param datapoints
+ * @returns {Array}
+ * @private
+ */
+ LineGraph.prototype._convertXcoordinates = function (datapoints) {
+ var toScreen = this.body.util.toScreen;
+ for (var i = 0; i < datapoints.length; i++) {
+ datapoints[i].screen_x = toScreen(datapoints[i].x) + this.props.width;
+ datapoints[i].screen_y = datapoints[i].y; //starting point for range calculations
+ }
+ };
+
+ /**
+ * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the
+ * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for
+ * the yAxis.
+ *
+ * @param datapoints
+ * @param group
+ * @returns {Array}
+ * @private
+ */
+ LineGraph.prototype._convertYcoordinates = function (datapoints, group) {
+ var axis = this.yAxisLeft;
+ var svgHeight = Number(this.svg.style.height.replace('px', ''));
+ if (group.options.yAxisOrientation == 'right') {
+ axis = this.yAxisRight;
+ }
+ for (var i = 0; i < datapoints.length; i++) {
+ datapoints[i].screen_y = Math.round(axis.convertValue(datapoints[i].y));
+ }
+ group.setZeroPosition(Math.min(svgHeight, axis.convertValue(0)));
+ };
+
+ module.exports = LineGraph;
+
+/***/ },
+/* 146 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var DOMutil = __webpack_require__(90);
+ var Component = __webpack_require__(124);
+ var DataScale = __webpack_require__(147);
+ /**
+ * A horizontal time axis
+ * @param {Object} [options] See DataAxis.setOptions for the available
+ * options.
+ * @constructor DataAxis
+ * @extends Component
+ * @param body
+ */
+ function DataAxis(body, options, svg, linegraphOptions) {
+ this.id = util.randomUUID();
+ this.body = body;
+
+ this.defaultOptions = {
+ orientation: 'left', // supported: 'left', 'right'
+ showMinorLabels: true,
+ showMajorLabels: true,
+ icons: false,
+ majorLinesOffset: 7,
+ minorLinesOffset: 4,
+ labelOffsetX: 10,
+ labelOffsetY: 2,
+ iconWidth: 20,
+ width: '40px',
+ visible: true,
+ alignZeros: true,
+ left: {
+ range: { min: undefined, max: undefined },
+ format: function format(value) {
+ return '' + parseFloat(value.toPrecision(3));
+ },
+ title: { text: undefined, style: undefined }
+ },
+ right: {
+ range: { min: undefined, max: undefined },
+ format: function format(value) {
+ return '' + parseFloat(value.toPrecision(3));
+ },
+ title: { text: undefined, style: undefined }
+ }
+ };
+
+ this.linegraphOptions = linegraphOptions;
+ this.linegraphSVG = svg;
+ this.props = {};
+ this.DOMelements = { // dynamic elements
+ lines: {},
+ labels: {},
+ title: {}
+ };
+
+ this.dom = {};
+ this.scale = undefined;
+ this.range = { start: 0, end: 0 };
+
+ this.options = util.extend({}, this.defaultOptions);
+ this.conversionFactor = 1;
+
+ this.setOptions(options);
+ this.width = Number(('' + this.options.width).replace("px", ""));
+ this.minWidth = this.width;
+ this.height = this.linegraphSVG.getBoundingClientRect().height;
+ this.hidden = false;
+
+ this.stepPixels = 25;
+ this.zeroCrossing = -1;
+ this.amountOfSteps = -1;
+
+ this.lineOffset = 0;
+ this.master = true;
+ this.masterAxis = null;
+ this.svgElements = {};
+ this.iconsRemoved = false;
+
+ this.groups = {};
+ this.amountOfGroups = 0;
+
+ // create the HTML DOM
+ this._create();
+ this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups };
+
+ var me = this;
+ this.body.emitter.on("verticalDrag", function () {
+ me.dom.lineContainer.style.top = me.body.domProps.scrollTop + 'px';
+ });
+ }
+
+ DataAxis.prototype = new Component();
+
+ DataAxis.prototype.addGroup = function (label, graphOptions) {
+ if (!this.groups.hasOwnProperty(label)) {
+ this.groups[label] = graphOptions;
+ }
+ this.amountOfGroups += 1;
+ };
+
+ DataAxis.prototype.updateGroup = function (label, graphOptions) {
+ if (!this.groups.hasOwnProperty(label)) {
+ this.amountOfGroups += 1;
+ }
+ this.groups[label] = graphOptions;
+ };
+
+ DataAxis.prototype.removeGroup = function (label) {
+ if (this.groups.hasOwnProperty(label)) {
+ delete this.groups[label];
+ this.amountOfGroups -= 1;
+ }
+ };
+
+ DataAxis.prototype.setOptions = function (options) {
+ if (options) {
+ var redraw = false;
+ if (this.options.orientation != options.orientation && options.orientation !== undefined) {
+ redraw = true;
+ }
+ var fields = ['orientation', 'showMinorLabels', 'showMajorLabels', 'icons', 'majorLinesOffset', 'minorLinesOffset', 'labelOffsetX', 'labelOffsetY', 'iconWidth', 'width', 'visible', 'left', 'right', 'alignZeros'];
+ util.selectiveDeepExtend(fields, this.options, options);
+
+ this.minWidth = Number(('' + this.options.width).replace("px", ""));
+ if (redraw === true && this.dom.frame) {
+ this.hide();
+ this.show();
+ }
+ }
+ };
+
+ /**
+ * Create the HTML DOM for the DataAxis
+ */
+ DataAxis.prototype._create = function () {
+ this.dom.frame = document.createElement('div');
+ this.dom.frame.style.width = this.options.width;
+ this.dom.frame.style.height = this.height;
+
+ this.dom.lineContainer = document.createElement('div');
+ this.dom.lineContainer.style.width = '100%';
+ this.dom.lineContainer.style.height = this.height;
+ this.dom.lineContainer.style.position = 'relative';
+
+ // create svg element for graph drawing.
+ this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg");
+ this.svg.style.position = "absolute";
+ this.svg.style.top = '0px';
+ this.svg.style.height = '100%';
+ this.svg.style.width = '100%';
+ this.svg.style.display = "block";
+ this.dom.frame.appendChild(this.svg);
+ };
+
+ DataAxis.prototype._redrawGroupIcons = function () {
+ DOMutil.prepareElements(this.svgElements);
+
+ var x;
+ var iconWidth = this.options.iconWidth;
+ var iconHeight = 15;
+ var iconOffset = 4;
+ var y = iconOffset + 0.5 * iconHeight;
+
+ if (this.options.orientation === 'left') {
+ x = iconOffset;
+ } else {
+ x = this.width - iconWidth - iconOffset;
+ }
+
+ var groupArray = (0, _keys2['default'])(this.groups);
+ groupArray.sort(function (a, b) {
+ return a < b ? -1 : 1;
+ });
+
+ for (var i = 0; i < groupArray.length; i++) {
+ var groupId = groupArray[i];
+ if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) {
+ this.groups[groupId].getLegend(iconWidth, iconHeight, this.framework, x, y);
+ y += iconHeight + iconOffset;
+ }
+ }
+
+ DOMutil.cleanupElements(this.svgElements);
+ this.iconsRemoved = false;
+ };
+
+ DataAxis.prototype._cleanupIcons = function () {
+ if (this.iconsRemoved === false) {
+ DOMutil.prepareElements(this.svgElements);
+ DOMutil.cleanupElements(this.svgElements);
+ this.iconsRemoved = true;
+ }
+ };
+
+ /**
+ * Create the HTML DOM for the DataAxis
+ */
+ DataAxis.prototype.show = function () {
+ this.hidden = false;
+ if (!this.dom.frame.parentNode) {
+ if (this.options.orientation === 'left') {
+ this.body.dom.left.appendChild(this.dom.frame);
+ } else {
+ this.body.dom.right.appendChild(this.dom.frame);
+ }
+ }
+
+ if (!this.dom.lineContainer.parentNode) {
+ this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer);
+ }
+ };
+
+ /**
+ * Create the HTML DOM for the DataAxis
+ */
+ DataAxis.prototype.hide = function () {
+ this.hidden = true;
+ if (this.dom.frame.parentNode) {
+ this.dom.frame.parentNode.removeChild(this.dom.frame);
+ }
+
+ if (this.dom.lineContainer.parentNode) {
+ this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer);
+ }
+ };
+
+ /**
+ * Set a range (start and end)
+ * @param end
+ * @param start
+ * @param end
+ */
+ DataAxis.prototype.setRange = function (start, end) {
+ this.range.start = start;
+ this.range.end = end;
+ };
+
+ /**
+ * Repaint the component
+ * @return {boolean} Returns true if the component is resized
+ */
+ DataAxis.prototype.redraw = function () {
+ var resized = false;
+ var activeGroups = 0;
+
+ // Make sure the line container adheres to the vertical scrolling.
+ this.dom.lineContainer.style.top = this.body.domProps.scrollTop + 'px';
+
+ for (var groupId in this.groups) {
+ if (this.groups.hasOwnProperty(groupId)) {
+ if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) {
+ activeGroups++;
+ }
+ }
+ }
+ if (this.amountOfGroups === 0 || activeGroups === 0) {
+ this.hide();
+ } else {
+ this.show();
+ this.height = Number(this.linegraphSVG.style.height.replace("px", ""));
+
+ // svg offsetheight did not work in firefox and explorer...
+ this.dom.lineContainer.style.height = this.height + 'px';
+ this.width = this.options.visible === true ? Number(('' + this.options.width).replace("px", "")) : 0;
+
+ var props = this.props;
+ var frame = this.dom.frame;
+
+ // update classname
+ frame.className = 'vis-data-axis';
+
+ // calculate character width and height
+ this._calculateCharSize();
+
+ var orientation = this.options.orientation;
+ var showMinorLabels = this.options.showMinorLabels;
+ var showMajorLabels = this.options.showMajorLabels;
+
+ // determine the width and height of the elements for the axis
+ props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0;
+ props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0;
+
+ props.minorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.minorLinesOffset;
+ props.minorLineHeight = 1;
+ props.majorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.majorLinesOffset;
+ props.majorLineHeight = 1;
+
+ // take frame offline while updating (is almost twice as fast)
+ if (orientation === 'left') {
+ frame.style.top = '0';
+ frame.style.left = '0';
+ frame.style.bottom = '';
+ frame.style.width = this.width + 'px';
+ frame.style.height = this.height + "px";
+ this.props.width = this.body.domProps.left.width;
+ this.props.height = this.body.domProps.left.height;
+ } else {
+ // right
+ frame.style.top = '';
+ frame.style.bottom = '0';
+ frame.style.left = '0';
+ frame.style.width = this.width + 'px';
+ frame.style.height = this.height + "px";
+ this.props.width = this.body.domProps.right.width;
+ this.props.height = this.body.domProps.right.height;
+ }
+
+ resized = this._redrawLabels();
+ resized = this._isResized() || resized;
+
+ if (this.options.icons === true) {
+ this._redrawGroupIcons();
+ } else {
+ this._cleanupIcons();
+ }
+
+ this._redrawTitle(orientation);
+ }
+ return resized;
+ };
+
+ /**
+ * Repaint major and minor text labels and vertical grid lines
+ * @private
+ */
+ DataAxis.prototype._redrawLabels = function () {
+ var _this = this;
+
+ var resized = false;
+ DOMutil.prepareElements(this.DOMelements.lines);
+ DOMutil.prepareElements(this.DOMelements.labels);
+ var orientation = this.options['orientation'];
+ var customRange = this.options[orientation].range != undefined ? this.options[orientation].range : {};
+
+ //Override range with manual options:
+ var autoScaleEnd = true;
+ if (customRange.max != undefined) {
+ this.range.end = customRange.max;
+ autoScaleEnd = false;
+ }
+ var autoScaleStart = true;
+ if (customRange.min != undefined) {
+ this.range.start = customRange.min;
+ autoScaleStart = false;
+ }
+
+ this.scale = new DataScale(this.range.start, this.range.end, autoScaleStart, autoScaleEnd, this.dom.frame.offsetHeight, this.props.majorCharHeight, this.options.alignZeros, this.options[orientation].format);
+
+ if (this.master === false && this.masterAxis != undefined) {
+ this.scale.followScale(this.masterAxis.scale);
+ }
+
+ //Is updated in side-effect of _redrawLabel():
+ this.maxLabelSize = 0;
+
+ var lines = this.scale.getLines();
+ lines.forEach(function (line) {
+ var y = line.y;
+ var isMajor = line.major;
+ if (_this.options['showMinorLabels'] && isMajor === false) {
+ _this._redrawLabel(y - 2, line.val, orientation, 'vis-y-axis vis-minor', _this.props.minorCharHeight);
+ }
+ if (isMajor) {
+ if (y >= 0) {
+ _this._redrawLabel(y - 2, line.val, orientation, 'vis-y-axis vis-major', _this.props.majorCharHeight);
+ }
+ }
+ if (_this.master === true) {
+ if (isMajor) {
+ _this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-major', _this.options.majorLinesOffset, _this.props.majorLineWidth);
+ } else {
+ _this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-minor', _this.options.minorLinesOffset, _this.props.minorLineWidth);
+ }
+ }
+ });
+
+ // Note that title is rotated, so we're using the height, not width!
+ var titleWidth = 0;
+ if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) {
+ titleWidth = this.props.titleCharHeight;
+ }
+ var offset = this.options.icons === true ? Math.max(this.options.iconWidth, titleWidth) + this.options.labelOffsetX + 15 : titleWidth + this.options.labelOffsetX + 15;
+
+ // this will resize the yAxis to accommodate the labels.
+ if (this.maxLabelSize > this.width - offset && this.options.visible === true) {
+ this.width = this.maxLabelSize + offset;
+ this.options.width = this.width + "px";
+ DOMutil.cleanupElements(this.DOMelements.lines);
+ DOMutil.cleanupElements(this.DOMelements.labels);
+ this.redraw();
+ resized = true;
+ }
+ // this will resize the yAxis if it is too big for the labels.
+ else if (this.maxLabelSize < this.width - offset && this.options.visible === true && this.width > this.minWidth) {
+ this.width = Math.max(this.minWidth, this.maxLabelSize + offset);
+ this.options.width = this.width + "px";
+ DOMutil.cleanupElements(this.DOMelements.lines);
+ DOMutil.cleanupElements(this.DOMelements.labels);
+ this.redraw();
+ resized = true;
+ } else {
+ DOMutil.cleanupElements(this.DOMelements.lines);
+ DOMutil.cleanupElements(this.DOMelements.labels);
+ resized = false;
+ }
+
+ return resized;
+ };
+
+ DataAxis.prototype.convertValue = function (value) {
+ return this.scale.convertValue(value);
+ };
+
+ DataAxis.prototype.screenToValue = function (x) {
+ return this.scale.screenToValue(x);
+ };
+
+ /**
+ * Create a label for the axis at position x
+ * @private
+ * @param y
+ * @param text
+ * @param orientation
+ * @param className
+ * @param characterHeight
+ */
+ DataAxis.prototype._redrawLabel = function (y, text, orientation, className, characterHeight) {
+ // reuse redundant label
+ var label = DOMutil.getDOMElement('div', this.DOMelements.labels, this.dom.frame); //this.dom.redundant.labels.shift();
+ label.className = className;
+ label.innerHTML = text;
+ if (orientation === 'left') {
+ label.style.left = '-' + this.options.labelOffsetX + 'px';
+ label.style.textAlign = "right";
+ } else {
+ label.style.right = '-' + this.options.labelOffsetX + 'px';
+ label.style.textAlign = "left";
+ }
+
+ label.style.top = y - 0.5 * characterHeight + this.options.labelOffsetY + 'px';
+
+ text += '';
+
+ var largestWidth = Math.max(this.props.majorCharWidth, this.props.minorCharWidth);
+ if (this.maxLabelSize < text.length * largestWidth) {
+ this.maxLabelSize = text.length * largestWidth;
+ }
+ };
+
+ /**
+ * Create a minor line for the axis at position y
+ * @param y
+ * @param orientation
+ * @param className
+ * @param offset
+ * @param width
+ */
+ DataAxis.prototype._redrawLine = function (y, orientation, className, offset, width) {
+ if (this.master === true) {
+ var line = DOMutil.getDOMElement('div', this.DOMelements.lines, this.dom.lineContainer); //this.dom.redundant.lines.shift();
+ line.className = className;
+ line.innerHTML = '';
+
+ if (orientation === 'left') {
+ line.style.left = this.width - offset + 'px';
+ } else {
+ line.style.right = this.width - offset + 'px';
+ }
+
+ line.style.width = width + 'px';
+ line.style.top = y + 'px';
+ }
+ };
+
+ /**
+ * Create a title for the axis
+ * @private
+ * @param orientation
+ */
+ DataAxis.prototype._redrawTitle = function (orientation) {
+ DOMutil.prepareElements(this.DOMelements.title);
+
+ // Check if the title is defined for this axes
+ if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) {
+ var title = DOMutil.getDOMElement('div', this.DOMelements.title, this.dom.frame);
+ title.className = 'vis-y-axis vis-title vis-' + orientation;
+ title.innerHTML = this.options[orientation].title.text;
+
+ // Add style - if provided
+ if (this.options[orientation].title.style !== undefined) {
+ util.addCssText(title, this.options[orientation].title.style);
+ }
+
+ if (orientation === 'left') {
+ title.style.left = this.props.titleCharHeight + 'px';
+ } else {
+ title.style.right = this.props.titleCharHeight + 'px';
+ }
+
+ title.style.width = this.height + 'px';
+ }
+
+ // we need to clean up in case we did not use all elements.
+ DOMutil.cleanupElements(this.DOMelements.title);
+ };
+
+ /**
+ * Determine the size of text on the axis (both major and minor axis).
+ * The size is calculated only once and then cached in this.props.
+ * @private
+ */
+ DataAxis.prototype._calculateCharSize = function () {
+ // determine the char width and height on the minor axis
+ if (!('minorCharHeight' in this.props)) {
+ var textMinor = document.createTextNode('0');
+ var measureCharMinor = document.createElement('div');
+ measureCharMinor.className = 'vis-y-axis vis-minor vis-measure';
+ measureCharMinor.appendChild(textMinor);
+ this.dom.frame.appendChild(measureCharMinor);
+
+ this.props.minorCharHeight = measureCharMinor.clientHeight;
+ this.props.minorCharWidth = measureCharMinor.clientWidth;
+
+ this.dom.frame.removeChild(measureCharMinor);
+ }
+
+ if (!('majorCharHeight' in this.props)) {
+ var textMajor = document.createTextNode('0');
+ var measureCharMajor = document.createElement('div');
+ measureCharMajor.className = 'vis-y-axis vis-major vis-measure';
+ measureCharMajor.appendChild(textMajor);
+ this.dom.frame.appendChild(measureCharMajor);
+
+ this.props.majorCharHeight = measureCharMajor.clientHeight;
+ this.props.majorCharWidth = measureCharMajor.clientWidth;
+
+ this.dom.frame.removeChild(measureCharMajor);
+ }
+
+ if (!('titleCharHeight' in this.props)) {
+ var textTitle = document.createTextNode('0');
+ var measureCharTitle = document.createElement('div');
+ measureCharTitle.className = 'vis-y-axis vis-title vis-measure';
+ measureCharTitle.appendChild(textTitle);
+ this.dom.frame.appendChild(measureCharTitle);
+
+ this.props.titleCharHeight = measureCharTitle.clientHeight;
+ this.props.titleCharWidth = measureCharTitle.clientWidth;
+
+ this.dom.frame.removeChild(measureCharTitle);
+ }
+ };
+
+ module.exports = DataAxis;
+
+/***/ },
+/* 147 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * Created by ludo on 25-1-16.
+ */
+
+ function DataScale(start, end, autoScaleStart, autoScaleEnd, containerHeight, majorCharHeight) {
+ var zeroAlign = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
+ var formattingFunction = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
+
+ this.majorSteps = [1, 2, 5, 10];
+ this.minorSteps = [0.25, 0.5, 1, 2];
+ this.customLines = null;
+
+ this.containerHeight = containerHeight;
+ this.majorCharHeight = majorCharHeight;
+ this._start = start;
+ this._end = end;
+
+ this.scale = 1;
+ this.minorStepIdx = -1;
+ this.magnitudefactor = 1;
+ this.determineScale();
+
+ this.zeroAlign = zeroAlign;
+ this.autoScaleStart = autoScaleStart;
+ this.autoScaleEnd = autoScaleEnd;
+
+ this.formattingFunction = formattingFunction;
+
+ if (autoScaleStart || autoScaleEnd) {
+ var me = this;
+ var roundToMinor = function roundToMinor(value) {
+ var rounded = value - value % (me.magnitudefactor * me.minorSteps[me.minorStepIdx]);
+ if (value % (me.magnitudefactor * me.minorSteps[me.minorStepIdx]) > 0.5 * (me.magnitudefactor * me.minorSteps[me.minorStepIdx])) {
+ return rounded + me.magnitudefactor * me.minorSteps[me.minorStepIdx];
+ } else {
+ return rounded;
+ }
+ };
+ if (autoScaleStart) {
+ this._start -= this.magnitudefactor * 2 * this.minorSteps[this.minorStepIdx];
+ this._start = roundToMinor(this._start);
+ }
+
+ if (autoScaleEnd) {
+ this._end += this.magnitudefactor * this.minorSteps[this.minorStepIdx];
+ this._end = roundToMinor(this._end);
+ }
+ this.determineScale();
+ }
+ }
+
+ DataScale.prototype.setCharHeight = function (majorCharHeight) {
+ this.majorCharHeight = majorCharHeight;
+ };
+
+ DataScale.prototype.setHeight = function (containerHeight) {
+ this.containerHeight = containerHeight;
+ };
+
+ DataScale.prototype.determineScale = function () {
+ var range = this._end - this._start;
+ this.scale = this.containerHeight / range;
+ var minimumStepValue = this.majorCharHeight / this.scale;
+ var orderOfMagnitude = range > 0 ? Math.round(Math.log(range) / Math.LN10) : 0;
+
+ this.minorStepIdx = -1;
+ this.magnitudefactor = Math.pow(10, orderOfMagnitude);
+
+ var start = 0;
+ if (orderOfMagnitude < 0) {
+ start = orderOfMagnitude;
+ }
+
+ var solutionFound = false;
+ for (var l = start; Math.abs(l) <= Math.abs(orderOfMagnitude); l++) {
+ this.magnitudefactor = Math.pow(10, l);
+ for (var j = 0; j < this.minorSteps.length; j++) {
+ var stepSize = this.magnitudefactor * this.minorSteps[j];
+ if (stepSize >= minimumStepValue) {
+ solutionFound = true;
+ this.minorStepIdx = j;
+ break;
+ }
+ }
+ if (solutionFound === true) {
+ break;
+ }
+ }
+ };
+
+ DataScale.prototype.is_major = function (value) {
+ return value % (this.magnitudefactor * this.majorSteps[this.minorStepIdx]) === 0;
+ };
+
+ DataScale.prototype.getStep = function () {
+ return this.magnitudefactor * this.minorSteps[this.minorStepIdx];
+ };
+
+ DataScale.prototype.getFirstMajor = function () {
+ var majorStep = this.magnitudefactor * this.majorSteps[this.minorStepIdx];
+ return this.convertValue(this._start + (majorStep - this._start % majorStep) % majorStep);
+ };
+
+ DataScale.prototype.formatValue = function (current) {
+ var returnValue = current.toPrecision(5);
+ if (typeof this.formattingFunction === 'function') {
+ returnValue = this.formattingFunction(current);
+ }
+
+ if (typeof returnValue === 'number') {
+ return '' + returnValue;
+ } else if (typeof returnValue === 'string') {
+ return returnValue;
+ } else {
+ return current.toPrecision(5);
+ }
+ };
+
+ DataScale.prototype.getLines = function () {
+ var lines = [];
+ var step = this.getStep();
+ var bottomOffset = (step - this._start % step) % step;
+ for (var i = this._start + bottomOffset; this._end - i > 0.00001; i += step) {
+ if (i != this._start) {
+ //Skip the bottom line
+ lines.push({ major: this.is_major(i), y: this.convertValue(i), val: this.formatValue(i) });
+ }
+ }
+ return lines;
+ };
+
+ DataScale.prototype.followScale = function (other) {
+ var oldStepIdx = this.minorStepIdx;
+ var oldStart = this._start;
+ var oldEnd = this._end;
+
+ var me = this;
+ var increaseMagnitude = function increaseMagnitude() {
+ me.magnitudefactor *= 2;
+ };
+ var decreaseMagnitude = function decreaseMagnitude() {
+ me.magnitudefactor /= 2;
+ };
+
+ if (other.minorStepIdx <= 1 && this.minorStepIdx <= 1 || other.minorStepIdx > 1 && this.minorStepIdx > 1) {
+ //easy, no need to change stepIdx nor multiplication factor
+ } else if (other.minorStepIdx < this.minorStepIdx) {
+ //I'm 5, they are 4 per major.
+ this.minorStepIdx = 1;
+ if (oldStepIdx == 2) {
+ increaseMagnitude();
+ } else {
+ increaseMagnitude();
+ increaseMagnitude();
+ }
+ } else {
+ //I'm 4, they are 5 per major
+ this.minorStepIdx = 2;
+ if (oldStepIdx == 1) {
+ decreaseMagnitude();
+ } else {
+ decreaseMagnitude();
+ decreaseMagnitude();
+ }
+ }
+
+ //Get masters stats:
+ var lines = other.getLines();
+ var otherZero = other.convertValue(0);
+ var otherStep = other.getStep() * other.scale;
+
+ var done = false;
+ var count = 0;
+ //Loop until magnitude is correct for given constrains.
+ while (!done && count++ < 5) {
+
+ //Get my stats:
+ this.scale = otherStep / (this.minorSteps[this.minorStepIdx] * this.magnitudefactor);
+ var newRange = this.containerHeight / this.scale;
+
+ //For the case the magnitudefactor has changed:
+ this._start = oldStart;
+ this._end = this._start + newRange;
+
+ var myOriginalZero = this._end * this.scale;
+ var majorStep = this.magnitudefactor * this.majorSteps[this.minorStepIdx];
+ var majorOffset = this.getFirstMajor() - other.getFirstMajor();
+
+ if (this.zeroAlign) {
+ var zeroOffset = otherZero - myOriginalZero;
+ this._end += zeroOffset / this.scale;
+ this._start = this._end - newRange;
+ } else {
+ if (!this.autoScaleStart) {
+ this._start += majorStep - majorOffset / this.scale;
+ this._end = this._start + newRange;
+ } else {
+ this._start -= majorOffset / this.scale;
+ this._end = this._start + newRange;
+ }
+ }
+ if (!this.autoScaleEnd && this._end > oldEnd + 0.00001) {
+ //Need to decrease magnitude to prevent scale overshoot! (end)
+ decreaseMagnitude();
+ done = false;
+ continue;
+ }
+ if (!this.autoScaleStart && this._start < oldStart - 0.00001) {
+ if (this.zeroAlign && oldStart >= 0) {
+ console.warn("Can't adhere to given 'min' range, due to zeroalign");
+ } else {
+ //Need to decrease magnitude to prevent scale overshoot! (start)
+ decreaseMagnitude();
+ done = false;
+ continue;
+ }
+ }
+ if (this.autoScaleStart && this.autoScaleEnd && newRange < oldEnd - oldStart) {
+ increaseMagnitude();
+ done = false;
+ continue;
+ }
+ done = true;
+ }
+ };
+
+ DataScale.prototype.convertValue = function (value) {
+ return this.containerHeight - (value - this._start) * this.scale;
+ };
+
+ DataScale.prototype.screenToValue = function (pixels) {
+ return (this.containerHeight - pixels) / this.scale + this._start;
+ };
+
+ module.exports = DataScale;
+
+/***/ },
+/* 148 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var DOMutil = __webpack_require__(90);
+ var Bars = __webpack_require__(149);
+ var Lines = __webpack_require__(151);
+ var Points = __webpack_require__(150);
+
+ /**
+ * /**
+ * @param {object} group | the object of the group from the dataset
+ * @param {string} groupId | ID of the group
+ * @param {object} options | the default options
+ * @param {array} groupsUsingDefaultStyles | this array has one entree.
+ * It is passed as an array so it is passed by reference.
+ * It enumerates through the default styles
+ * @constructor
+ */
+ function GraphGroup(group, groupId, options, groupsUsingDefaultStyles) {
+ this.id = groupId;
+ var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'drawPoints', 'shaded', 'interpolation', 'zIndex', 'excludeFromStacking', 'excludeFromLegend'];
+ this.options = util.selectiveBridgeObject(fields, options);
+ this.usingDefaultStyle = group.className === undefined;
+ this.groupsUsingDefaultStyles = groupsUsingDefaultStyles;
+ this.zeroPosition = 0;
+ this.update(group);
+ if (this.usingDefaultStyle == true) {
+ this.groupsUsingDefaultStyles[0] += 1;
+ }
+ this.itemsData = [];
+ this.visible = group.visible === undefined ? true : group.visible;
+ }
+
+ /**
+ * this loads a reference to all items in this group into this group.
+ * @param {array} items
+ */
+ GraphGroup.prototype.setItems = function (items) {
+ if (items != null) {
+ this.itemsData = items;
+ if (this.options.sort == true) {
+ util.insertSort(this.itemsData, function (a, b) {
+ return a.x > b.x ? 1 : -1;
+ });
+ }
+ } else {
+ this.itemsData = [];
+ }
+ };
+
+ GraphGroup.prototype.getItems = function () {
+ return this.itemsData;
+ };
+
+ /**
+ * this is used for barcharts and shading, this way, we only have to calculate it once.
+ * @param pos
+ */
+ GraphGroup.prototype.setZeroPosition = function (pos) {
+ this.zeroPosition = pos;
+ };
+
+ /**
+ * set the options of the graph group over the default options.
+ * @param options
+ */
+ GraphGroup.prototype.setOptions = function (options) {
+ if (options !== undefined) {
+ var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'zIndex', 'excludeFromStacking', 'excludeFromLegend'];
+ util.selectiveDeepExtend(fields, this.options, options);
+
+ // if the group's drawPoints is a function delegate the callback to the onRender property
+ if (typeof options.drawPoints == 'function') {
+ options.drawPoints = {
+ onRender: options.drawPoints
+ };
+ }
+
+ util.mergeOptions(this.options, options, 'interpolation');
+ util.mergeOptions(this.options, options, 'drawPoints');
+ util.mergeOptions(this.options, options, 'shaded');
+
+ if (options.interpolation) {
+ if ((0, _typeof3['default'])(options.interpolation) == 'object') {
+ if (options.interpolation.parametrization) {
+ if (options.interpolation.parametrization == 'uniform') {
+ this.options.interpolation.alpha = 0;
+ } else if (options.interpolation.parametrization == 'chordal') {
+ this.options.interpolation.alpha = 1.0;
+ } else {
+ this.options.interpolation.parametrization = 'centripetal';
+ this.options.interpolation.alpha = 0.5;
+ }
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ * this updates the current group class with the latest group dataset entree, used in _updateGroup in linegraph
+ * @param group
+ */
+ GraphGroup.prototype.update = function (group) {
+ this.group = group;
+ this.content = group.content || 'graph';
+ this.className = group.className || this.className || 'vis-graph-group' + this.groupsUsingDefaultStyles[0] % 10;
+ this.visible = group.visible === undefined ? true : group.visible;
+ this.style = group.style;
+ this.setOptions(group.options);
+ };
+
+ /**
+ * return the legend entree for this group.
+ *
+ * @param iconWidth
+ * @param iconHeight
+ * @returns {{icon: HTMLElement, label: (group.content|*|string), orientation: (.options.yAxisOrientation|*)}}
+ */
+ GraphGroup.prototype.getLegend = function (iconWidth, iconHeight, framework, x, y) {
+ if (framework == undefined || framework == null) {
+ var svg = document.createElementNS('http://www.w3.org/2000/svg', "svg");
+ framework = { svg: svg, svgElements: {}, options: this.options, groups: [this] };
+ }
+ if (x == undefined || x == null) {
+ x = 0;
+ }
+ if (y == undefined || y == null) {
+ y = 0.5 * iconHeight;
+ }
+ switch (this.options.style) {
+ case "line":
+ Lines.drawIcon(this, x, y, iconWidth, iconHeight, framework);
+ break;
+ case "points": //explicit no break
+ case "point":
+ Points.drawIcon(this, x, y, iconWidth, iconHeight, framework);
+ break;
+ case "bar":
+ Bars.drawIcon(this, x, y, iconWidth, iconHeight, framework);
+ break;
+ }
+ return { icon: framework.svg, label: this.content, orientation: this.options.yAxisOrientation };
+ };
+
+ GraphGroup.prototype.getYRange = function (groupData) {
+ var yMin = groupData[0].y;
+ var yMax = groupData[0].y;
+ for (var j = 0; j < groupData.length; j++) {
+ yMin = yMin > groupData[j].y ? groupData[j].y : yMin;
+ yMax = yMax < groupData[j].y ? groupData[j].y : yMax;
+ }
+ return { min: yMin, max: yMax, yAxisOrientation: this.options.yAxisOrientation };
+ };
+
+ module.exports = GraphGroup;
+
+/***/ },
+/* 149 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var DOMutil = __webpack_require__(90);
+ var Points = __webpack_require__(150);
+
+ function Bargraph(groupId, options) {}
+
+ Bargraph.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) {
+ var fillHeight = iconHeight * 0.5;
+ var path, fillPath;
+
+ var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg);
+ outline.setAttributeNS(null, "x", x);
+ outline.setAttributeNS(null, "y", y - fillHeight);
+ outline.setAttributeNS(null, "width", iconWidth);
+ outline.setAttributeNS(null, "height", 2 * fillHeight);
+ outline.setAttributeNS(null, "class", "vis-outline");
+
+ var barWidth = Math.round(0.3 * iconWidth);
+ var originalWidth = group.options.barChart.width;
+ var scale = originalWidth / barWidth;
+ var bar1Height = Math.round(0.4 * iconHeight);
+ var bar2Height = Math.round(0.75 * iconHeight);
+
+ var offset = Math.round((iconWidth - 2 * barWidth) / 3);
+
+ DOMutil.drawBar(x + 0.5 * barWidth + offset, y + fillHeight - bar1Height - 1, barWidth, bar1Height, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style);
+ DOMutil.drawBar(x + 1.5 * barWidth + offset + 2, y + fillHeight - bar2Height - 1, barWidth, bar2Height, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style);
+
+ if (group.options.drawPoints.enabled == true) {
+ var groupTemplate = {
+ style: group.options.drawPoints.style,
+ styles: group.options.drawPoints.styles,
+ size: group.options.drawPoints.size / scale,
+ className: group.className
+ };
+ DOMutil.drawPoint(x + 0.5 * barWidth + offset, y + fillHeight - bar1Height - 1, groupTemplate, framework.svgElements, framework.svg);
+ DOMutil.drawPoint(x + 1.5 * barWidth + offset + 2, y + fillHeight - bar2Height - 1, groupTemplate, framework.svgElements, framework.svg);
+ }
+ };
+
+ /**
+ * draw a bar graph
+ *
+ * @param groupIds
+ * @param processedGroupData
+ */
+ Bargraph.draw = function (groupIds, processedGroupData, framework) {
+ var combinedData = [];
+ var intersections = {};
+ var coreDistance;
+ var key, drawData;
+ var group;
+ var i, j;
+ var barPoints = 0;
+
+ // combine all barchart data
+ for (i = 0; i < groupIds.length; i++) {
+ group = framework.groups[groupIds[i]];
+ if (group.options.style === 'bar') {
+ if (group.visible === true && (framework.options.groups.visibility[groupIds[i]] === undefined || framework.options.groups.visibility[groupIds[i]] === true)) {
+ for (j = 0; j < processedGroupData[groupIds[i]].length; j++) {
+ combinedData.push({
+ screen_x: processedGroupData[groupIds[i]][j].screen_x,
+ screen_y: processedGroupData[groupIds[i]][j].screen_y,
+ x: processedGroupData[groupIds[i]][j].x,
+ y: processedGroupData[groupIds[i]][j].y,
+ groupId: groupIds[i],
+ label: processedGroupData[groupIds[i]][j].label
+ });
+ barPoints += 1;
+ }
+ }
+ }
+ }
+
+ if (barPoints === 0) {
+ return;
+ }
+
+ // sort by time and by group
+ combinedData.sort(function (a, b) {
+ if (a.screen_x === b.screen_x) {
+ return a.groupId < b.groupId ? -1 : 1;
+ } else {
+ return a.screen_x - b.screen_x;
+ }
+ });
+
+ // get intersections
+ Bargraph._getDataIntersections(intersections, combinedData);
+
+ // plot barchart
+ for (i = 0; i < combinedData.length; i++) {
+ group = framework.groups[combinedData[i].groupId];
+ var minWidth = group.options.barChart.minWidth != undefined ? group.options.barChart.minWidth : 0.1 * group.options.barChart.width;
+
+ key = combinedData[i].screen_x;
+ var heightOffset = 0;
+ if (intersections[key] === undefined) {
+ if (i + 1 < combinedData.length) {
+ coreDistance = Math.abs(combinedData[i + 1].screen_x - key);
+ }
+ drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth);
+ } else {
+ var nextKey = i + (intersections[key].amount - intersections[key].resolved);
+ var prevKey = i - (intersections[key].resolved + 1);
+ if (nextKey < combinedData.length) {
+ coreDistance = Math.abs(combinedData[nextKey].screen_x - key);
+ }
+ drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth);
+ intersections[key].resolved += 1;
+
+ if (group.options.stack === true && group.options.excludeFromStacking !== true) {
+ if (combinedData[i].screen_y < group.zeroPosition) {
+ heightOffset = intersections[key].accumulatedNegative;
+ intersections[key].accumulatedNegative += group.zeroPosition - combinedData[i].screen_y;
+ } else {
+ heightOffset = intersections[key].accumulatedPositive;
+ intersections[key].accumulatedPositive += group.zeroPosition - combinedData[i].screen_y;
+ }
+ } else if (group.options.barChart.sideBySide === true) {
+ drawData.width = drawData.width / intersections[key].amount;
+ drawData.offset += intersections[key].resolved * drawData.width - 0.5 * drawData.width * (intersections[key].amount + 1);
+ }
+ }
+ DOMutil.drawBar(combinedData[i].screen_x + drawData.offset, combinedData[i].screen_y - heightOffset, drawData.width, group.zeroPosition - combinedData[i].screen_y, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style);
+ // draw points
+ if (group.options.drawPoints.enabled === true) {
+ var pointData = {
+ screen_x: combinedData[i].screen_x,
+ screen_y: combinedData[i].screen_y - heightOffset,
+ x: combinedData[i].x,
+ y: combinedData[i].y,
+ groupId: combinedData[i].groupId,
+ label: combinedData[i].label
+ };
+ Points.draw([pointData], group, framework, drawData.offset);
+ //DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg);
+ }
+ }
+ };
+
+ /**
+ * Fill the intersections object with counters of how many datapoints share the same x coordinates
+ * @param intersections
+ * @param combinedData
+ * @private
+ */
+ Bargraph._getDataIntersections = function (intersections, combinedData) {
+ // get intersections
+ var coreDistance;
+ for (var i = 0; i < combinedData.length; i++) {
+ if (i + 1 < combinedData.length) {
+ coreDistance = Math.abs(combinedData[i + 1].screen_x - combinedData[i].screen_x);
+ }
+ if (i > 0) {
+ coreDistance = Math.min(coreDistance, Math.abs(combinedData[i - 1].screen_x - combinedData[i].screen_x));
+ }
+ if (coreDistance === 0) {
+ if (intersections[combinedData[i].screen_x] === undefined) {
+ intersections[combinedData[i].screen_x] = {
+ amount: 0,
+ resolved: 0,
+ accumulatedPositive: 0,
+ accumulatedNegative: 0
+ };
+ }
+ intersections[combinedData[i].screen_x].amount += 1;
+ }
+ }
+ };
+
+ /**
+ * Get the width and offset for bargraphs based on the coredistance between datapoints
+ *
+ * @param coreDistance
+ * @param group
+ * @param minWidth
+ * @returns {{width: Number, offset: Number}}
+ * @private
+ */
+ Bargraph._getSafeDrawData = function (coreDistance, group, minWidth) {
+ var width, offset;
+ if (coreDistance < group.options.barChart.width && coreDistance > 0) {
+ width = coreDistance < minWidth ? minWidth : coreDistance;
+
+ offset = 0; // recalculate offset with the new width;
+ if (group.options.barChart.align === 'left') {
+ offset -= 0.5 * coreDistance;
+ } else if (group.options.barChart.align === 'right') {
+ offset += 0.5 * coreDistance;
+ }
+ } else {
+ // default settings
+ width = group.options.barChart.width;
+ offset = 0;
+ if (group.options.barChart.align === 'left') {
+ offset -= 0.5 * group.options.barChart.width;
+ } else if (group.options.barChart.align === 'right') {
+ offset += 0.5 * group.options.barChart.width;
+ }
+ }
+
+ return { width: width, offset: offset };
+ };
+
+ Bargraph.getStackedYRange = function (combinedData, groupRanges, groupIds, groupLabel, orientation) {
+ if (combinedData.length > 0) {
+ // sort by time and by group
+ combinedData.sort(function (a, b) {
+ if (a.screen_x === b.screen_x) {
+ return a.groupId < b.groupId ? -1 : 1;
+ } else {
+ return a.screen_x - b.screen_x;
+ }
+ });
+ var intersections = {};
+
+ Bargraph._getDataIntersections(intersections, combinedData);
+ groupRanges[groupLabel] = Bargraph._getStackedYRange(intersections, combinedData);
+ groupRanges[groupLabel].yAxisOrientation = orientation;
+ groupIds.push(groupLabel);
+ }
+ };
+
+ Bargraph._getStackedYRange = function (intersections, combinedData) {
+ var key;
+ var yMin = combinedData[0].screen_y;
+ var yMax = combinedData[0].screen_y;
+ for (var i = 0; i < combinedData.length; i++) {
+ key = combinedData[i].screen_x;
+ if (intersections[key] === undefined) {
+ yMin = yMin > combinedData[i].screen_y ? combinedData[i].screen_y : yMin;
+ yMax = yMax < combinedData[i].screen_y ? combinedData[i].screen_y : yMax;
+ } else {
+ if (combinedData[i].screen_y < 0) {
+ intersections[key].accumulatedNegative += combinedData[i].screen_y;
+ } else {
+ intersections[key].accumulatedPositive += combinedData[i].screen_y;
+ }
+ }
+ }
+ for (var xpos in intersections) {
+ if (intersections.hasOwnProperty(xpos)) {
+ yMin = yMin > intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMin;
+ yMin = yMin > intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMin;
+ yMax = yMax < intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMax;
+ yMax = yMax < intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMax;
+ }
+ }
+
+ return { min: yMin, max: yMax };
+ };
+
+ module.exports = Bargraph;
+
+/***/ },
+/* 150 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var DOMutil = __webpack_require__(90);
+
+ function Points(groupId, options) {}
+
+ /**
+ * draw the data points
+ *
+ * @param {Array} dataset
+ * @param {Object} JSONcontainer
+ * @param {Object} svg | SVG DOM element
+ * @param {GraphGroup} group
+ * @param {Number} [offset]
+ */
+ Points.draw = function (dataset, group, framework, offset) {
+ offset = offset || 0;
+ var callback = getCallback(framework, group);
+
+ for (var i = 0; i < dataset.length; i++) {
+ if (!callback) {
+ // draw the point the simple way.
+ DOMutil.drawPoint(dataset[i].screen_x + offset, dataset[i].screen_y, getGroupTemplate(group), framework.svgElements, framework.svg, dataset[i].label);
+ } else {
+ var callbackResult = callback(dataset[i], group); // result might be true, false or an object
+ if (callbackResult === true || (typeof callbackResult === 'undefined' ? 'undefined' : (0, _typeof3['default'])(callbackResult)) === 'object') {
+ DOMutil.drawPoint(dataset[i].screen_x + offset, dataset[i].screen_y, getGroupTemplate(group, callbackResult), framework.svgElements, framework.svg, dataset[i].label);
+ }
+ }
+ }
+ };
+
+ Points.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) {
+ var fillHeight = iconHeight * 0.5;
+ var path, fillPath;
+
+ var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg);
+ outline.setAttributeNS(null, "x", x);
+ outline.setAttributeNS(null, "y", y - fillHeight);
+ outline.setAttributeNS(null, "width", iconWidth);
+ outline.setAttributeNS(null, "height", 2 * fillHeight);
+ outline.setAttributeNS(null, "class", "vis-outline");
+
+ //Don't call callback on icon
+ DOMutil.drawPoint(x + 0.5 * iconWidth, y, getGroupTemplate(group), framework.svgElements, framework.svg);
+ };
+
+ function getGroupTemplate(group, callbackResult) {
+ callbackResult = typeof callbackResult === 'undefined' ? {} : callbackResult;
+ return {
+ style: callbackResult.style || group.options.drawPoints.style,
+ styles: callbackResult.styles || group.options.drawPoints.styles,
+ size: callbackResult.size || group.options.drawPoints.size,
+ className: callbackResult.className || group.className
+ };
+ }
+
+ function getCallback(framework, group) {
+ var callback = undefined;
+ // check for the graph2d onRender
+ if (framework.options && framework.options.drawPoints && framework.options.drawPoints.onRender && typeof framework.options.drawPoints.onRender == 'function') {
+ callback = framework.options.drawPoints.onRender;
+ }
+
+ // override it with the group onRender if defined
+ if (group.group.options && group.group.options.drawPoints && group.group.options.drawPoints.onRender && typeof group.group.options.drawPoints.onRender == 'function') {
+ callback = group.group.options.drawPoints.onRender;
+ }
+ return callback;
+ }
+
+ module.exports = Points;
+
+/***/ },
+/* 151 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ var DOMutil = __webpack_require__(90);
+
+ function Line(groupId, options) {}
+
+ Line.calcPath = function (dataset, group) {
+ if (dataset != null) {
+ if (dataset.length > 0) {
+ var d = [];
+
+ // construct path from dataset
+ if (group.options.interpolation.enabled == true) {
+ d = Line._catmullRom(dataset, group);
+ } else {
+ d = Line._linear(dataset);
+ }
+ return d;
+ }
+ }
+ };
+
+ Line.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) {
+ var fillHeight = iconHeight * 0.5;
+ var path, fillPath;
+
+ var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg);
+ outline.setAttributeNS(null, "x", x);
+ outline.setAttributeNS(null, "y", y - fillHeight);
+ outline.setAttributeNS(null, "width", iconWidth);
+ outline.setAttributeNS(null, "height", 2 * fillHeight);
+ outline.setAttributeNS(null, "class", "vis-outline");
+
+ path = DOMutil.getSVGElement("path", framework.svgElements, framework.svg);
+ path.setAttributeNS(null, "class", group.className);
+ if (group.style !== undefined) {
+ path.setAttributeNS(null, "style", group.style);
+ }
+
+ path.setAttributeNS(null, "d", "M" + x + "," + y + " L" + (x + iconWidth) + "," + y + "");
+ if (group.options.shaded.enabled == true) {
+ fillPath = DOMutil.getSVGElement("path", framework.svgElements, framework.svg);
+ if (group.options.shaded.orientation == 'top') {
+ fillPath.setAttributeNS(null, "d", "M" + x + ", " + (y - fillHeight) + "L" + x + "," + y + " L" + (x + iconWidth) + "," + y + " L" + (x + iconWidth) + "," + (y - fillHeight));
+ } else {
+ fillPath.setAttributeNS(null, "d", "M" + x + "," + y + " " + "L" + x + "," + (y + fillHeight) + " " + "L" + (x + iconWidth) + "," + (y + fillHeight) + "L" + (x + iconWidth) + "," + y);
+ }
+ fillPath.setAttributeNS(null, "class", group.className + " vis-icon-fill");
+ if (group.options.shaded.style !== undefined && group.options.shaded.style !== "") {
+ fillPath.setAttributeNS(null, "style", group.options.shaded.style);
+ }
+ }
+
+ if (group.options.drawPoints.enabled == true) {
+ var groupTemplate = {
+ style: group.options.drawPoints.style,
+ styles: group.options.drawPoints.styles,
+ size: group.options.drawPoints.size,
+ className: group.className
+ };
+ DOMutil.drawPoint(x + 0.5 * iconWidth, y, groupTemplate, framework.svgElements, framework.svg);
+ }
+ };
+
+ Line.drawShading = function (pathArray, group, subPathArray, framework) {
+ // append shading to the path
+ if (group.options.shaded.enabled == true) {
+ var svgHeight = Number(framework.svg.style.height.replace('px', ''));
+ var fillPath = DOMutil.getSVGElement('path', framework.svgElements, framework.svg);
+ var type = "L";
+ if (group.options.interpolation.enabled == true) {
+ type = "C";
+ }
+ var dFill;
+ var zero = 0;
+ if (group.options.shaded.orientation == 'top') {
+ zero = 0;
+ } else if (group.options.shaded.orientation == 'bottom') {
+ zero = svgHeight;
+ } else {
+ zero = Math.min(Math.max(0, group.zeroPosition), svgHeight);
+ }
+ if (group.options.shaded.orientation == 'group' && subPathArray != null && subPathArray != undefined) {
+ dFill = 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false) + ' L' + subPathArray[subPathArray.length - 1][0] + "," + subPathArray[subPathArray.length - 1][1] + " " + this.serializePath(subPathArray, type, true) + subPathArray[0][0] + "," + subPathArray[0][1] + " Z";
+ } else {
+ dFill = 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false) + ' V' + zero + ' H' + pathArray[0][0] + " Z";
+ }
+
+ fillPath.setAttributeNS(null, 'class', group.className + ' vis-fill');
+ if (group.options.shaded.style !== undefined) {
+ fillPath.setAttributeNS(null, 'style', group.options.shaded.style);
+ }
+ fillPath.setAttributeNS(null, 'd', dFill);
+ }
+ };
+
+ /**
+ * draw a line graph
+ *
+ * @param dataset
+ * @param group
+ */
+ Line.draw = function (pathArray, group, framework) {
+ if (pathArray != null && pathArray != undefined) {
+ var path = DOMutil.getSVGElement('path', framework.svgElements, framework.svg);
+ path.setAttributeNS(null, "class", group.className);
+ if (group.style !== undefined) {
+ path.setAttributeNS(null, "style", group.style);
+ }
+
+ var type = "L";
+ if (group.options.interpolation.enabled == true) {
+ type = "C";
+ }
+ // copy properties to path for drawing.
+ path.setAttributeNS(null, 'd', 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false));
+ }
+ };
+
+ Line.serializePath = function (pathArray, type, inverse) {
+ if (pathArray.length < 2) {
+ //Too little data to create a path.
+ return "";
+ }
+ var d = type;
+ if (inverse) {
+ for (var i = pathArray.length - 2; i > 0; i--) {
+ d += pathArray[i][0] + "," + pathArray[i][1] + " ";
+ }
+ } else {
+ for (var i = 1; i < pathArray.length; i++) {
+ d += pathArray[i][0] + "," + pathArray[i][1] + " ";
+ }
+ }
+ return d;
+ };
+
+ /**
+ * This uses an uniform parametrization of the interpolation algorithm:
+ * 'On the Parameterization of Catmull-Rom Curves' by Cem Yuksel et al.
+ * @param data
+ * @returns {string}
+ * @private
+ */
+ Line._catmullRomUniform = function (data) {
+ // catmull rom
+ var p0, p1, p2, p3, bp1, bp2;
+ var d = [];
+ d.push([Math.round(data[0].screen_x), Math.round(data[0].screen_y)]);
+ var normalization = 1 / 6;
+ var length = data.length;
+ for (var i = 0; i < length - 1; i++) {
+
+ p0 = i == 0 ? data[0] : data[i - 1];
+ p1 = data[i];
+ p2 = data[i + 1];
+ p3 = i + 2 < length ? data[i + 2] : p2;
+
+ // Catmull-Rom to Cubic Bezier conversion matrix
+ // 0 1 0 0
+ // -1/6 1 1/6 0
+ // 0 1/6 1 -1/6
+ // 0 0 1 0
+
+ // bp0 = { x: p1.x, y: p1.y };
+ bp1 = {
+ screen_x: (-p0.screen_x + 6 * p1.screen_x + p2.screen_x) * normalization,
+ screen_y: (-p0.screen_y + 6 * p1.screen_y + p2.screen_y) * normalization
+ };
+ bp2 = {
+ screen_x: (p1.screen_x + 6 * p2.screen_x - p3.screen_x) * normalization,
+ screen_y: (p1.screen_y + 6 * p2.screen_y - p3.screen_y) * normalization
+ };
+ // bp0 = { x: p2.x, y: p2.y };
+
+ d.push([bp1.screen_x, bp1.screen_y]);
+ d.push([bp2.screen_x, bp2.screen_y]);
+ d.push([p2.screen_x, p2.screen_y]);
+ }
+
+ return d;
+ };
+
+ /**
+ * This uses either the chordal or centripetal parameterization of the catmull-rom algorithm.
+ * By default, the centripetal parameterization is used because this gives the nicest results.
+ * These parameterizations are relatively heavy because the distance between 4 points have to be calculated.
+ *
+ * One optimization can be used to reuse distances since this is a sliding window approach.
+ * @param data
+ * @param group
+ * @returns {string}
+ * @private
+ */
+ Line._catmullRom = function (data, group) {
+ var alpha = group.options.interpolation.alpha;
+ if (alpha == 0 || alpha === undefined) {
+ return this._catmullRomUniform(data);
+ } else {
+ var p0, p1, p2, p3, bp1, bp2, d1, d2, d3, A, B, N, M;
+ var d3powA, d2powA, d3pow2A, d2pow2A, d1pow2A, d1powA;
+ var d = [];
+ d.push([Math.round(data[0].screen_x), Math.round(data[0].screen_y)]);
+ var length = data.length;
+ for (var i = 0; i < length - 1; i++) {
+
+ p0 = i == 0 ? data[0] : data[i - 1];
+ p1 = data[i];
+ p2 = data[i + 1];
+ p3 = i + 2 < length ? data[i + 2] : p2;
+
+ d1 = Math.sqrt(Math.pow(p0.screen_x - p1.screen_x, 2) + Math.pow(p0.screen_y - p1.screen_y, 2));
+ d2 = Math.sqrt(Math.pow(p1.screen_x - p2.screen_x, 2) + Math.pow(p1.screen_y - p2.screen_y, 2));
+ d3 = Math.sqrt(Math.pow(p2.screen_x - p3.screen_x, 2) + Math.pow(p2.screen_y - p3.screen_y, 2));
+
+ // Catmull-Rom to Cubic Bezier conversion matrix
+
+ // A = 2d1^2a + 3d1^a * d2^a + d3^2a
+ // B = 2d3^2a + 3d3^a * d2^a + d2^2a
+
+ // [ 0 1 0 0 ]
+ // [ -d2^2a /N A/N d1^2a /N 0 ]
+ // [ 0 d3^2a /M B/M -d2^2a /M ]
+ // [ 0 0 1 0 ]
+
+ d3powA = Math.pow(d3, alpha);
+ d3pow2A = Math.pow(d3, 2 * alpha);
+ d2powA = Math.pow(d2, alpha);
+ d2pow2A = Math.pow(d2, 2 * alpha);
+ d1powA = Math.pow(d1, alpha);
+ d1pow2A = Math.pow(d1, 2 * alpha);
+
+ A = 2 * d1pow2A + 3 * d1powA * d2powA + d2pow2A;
+ B = 2 * d3pow2A + 3 * d3powA * d2powA + d2pow2A;
+ N = 3 * d1powA * (d1powA + d2powA);
+ if (N > 0) {
+ N = 1 / N;
+ }
+ M = 3 * d3powA * (d3powA + d2powA);
+ if (M > 0) {
+ M = 1 / M;
+ }
+
+ bp1 = {
+ screen_x: (-d2pow2A * p0.screen_x + A * p1.screen_x + d1pow2A * p2.screen_x) * N,
+ screen_y: (-d2pow2A * p0.screen_y + A * p1.screen_y + d1pow2A * p2.screen_y) * N
+ };
+
+ bp2 = {
+ screen_x: (d3pow2A * p1.screen_x + B * p2.screen_x - d2pow2A * p3.screen_x) * M,
+ screen_y: (d3pow2A * p1.screen_y + B * p2.screen_y - d2pow2A * p3.screen_y) * M
+ };
+
+ if (bp1.screen_x == 0 && bp1.screen_y == 0) {
+ bp1 = p1;
+ }
+ if (bp2.screen_x == 0 && bp2.screen_y == 0) {
+ bp2 = p2;
+ }
+ d.push([bp1.screen_x, bp1.screen_y]);
+ d.push([bp2.screen_x, bp2.screen_y]);
+ d.push([p2.screen_x, p2.screen_y]);
+ }
+
+ return d;
+ }
+ };
+
+ /**
+ * this generates the SVG path for a linear drawing between datapoints.
+ * @param data
+ * @returns {string}
+ * @private
+ */
+ Line._linear = function (data) {
+ // linear
+ var d = [];
+ for (var i = 0; i < data.length; i++) {
+ d.push([data[i].screen_x, data[i].screen_y]);
+ }
+ return d;
+ };
+
+ module.exports = Line;
+
+/***/ },
+/* 152 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var DOMutil = __webpack_require__(90);
+ var Component = __webpack_require__(124);
+
+ /**
+ * Legend for Graph2d
+ */
+ function Legend(body, options, side, linegraphOptions) {
+ this.body = body;
+ this.defaultOptions = {
+ enabled: false,
+ icons: true,
+ iconSize: 20,
+ iconSpacing: 6,
+ left: {
+ visible: true,
+ position: 'top-left' // top/bottom - left,center,right
+ },
+ right: {
+ visible: true,
+ position: 'top-right' // top/bottom - left,center,right
+ }
+ };
+
+ this.side = side;
+ this.options = util.extend({}, this.defaultOptions);
+ this.linegraphOptions = linegraphOptions;
+
+ this.svgElements = {};
+ this.dom = {};
+ this.groups = {};
+ this.amountOfGroups = 0;
+ this._create();
+ this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups };
+
+ this.setOptions(options);
+ }
+
+ Legend.prototype = new Component();
+
+ Legend.prototype.clear = function () {
+ this.groups = {};
+ this.amountOfGroups = 0;
+ };
+
+ Legend.prototype.addGroup = function (label, graphOptions) {
+
+ // Include a group only if the group option 'excludeFromLegend: false' is not set.
+ if (graphOptions.options.excludeFromLegend != true) {
+ if (!this.groups.hasOwnProperty(label)) {
+ this.groups[label] = graphOptions;
+ }
+ this.amountOfGroups += 1;
+ }
+ };
+
+ Legend.prototype.updateGroup = function (label, graphOptions) {
+ this.groups[label] = graphOptions;
+ };
+
+ Legend.prototype.removeGroup = function (label) {
+ if (this.groups.hasOwnProperty(label)) {
+ delete this.groups[label];
+ this.amountOfGroups -= 1;
+ }
+ };
+
+ Legend.prototype._create = function () {
+ this.dom.frame = document.createElement('div');
+ this.dom.frame.className = 'vis-legend';
+ this.dom.frame.style.position = "absolute";
+ this.dom.frame.style.top = "10px";
+ this.dom.frame.style.display = "block";
+
+ this.dom.textArea = document.createElement('div');
+ this.dom.textArea.className = 'vis-legend-text';
+ this.dom.textArea.style.position = "relative";
+ this.dom.textArea.style.top = "0px";
+
+ this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg");
+ this.svg.style.position = 'absolute';
+ this.svg.style.top = 0 + 'px';
+ this.svg.style.width = this.options.iconSize + 5 + 'px';
+ this.svg.style.height = '100%';
+
+ this.dom.frame.appendChild(this.svg);
+ this.dom.frame.appendChild(this.dom.textArea);
+ };
+
+ /**
+ * Hide the component from the DOM
+ */
+ Legend.prototype.hide = function () {
+ // remove the frame containing the items
+ if (this.dom.frame.parentNode) {
+ this.dom.frame.parentNode.removeChild(this.dom.frame);
+ }
+ };
+
+ /**
+ * Show the component in the DOM (when not already visible).
+ * @return {Boolean} changed
+ */
+ Legend.prototype.show = function () {
+ // show frame containing the items
+ if (!this.dom.frame.parentNode) {
+ this.body.dom.center.appendChild(this.dom.frame);
+ }
+ };
+
+ Legend.prototype.setOptions = function (options) {
+ var fields = ['enabled', 'orientation', 'icons', 'left', 'right'];
+ util.selectiveDeepExtend(fields, this.options, options);
+ };
+
+ Legend.prototype.redraw = function () {
+ var activeGroups = 0;
+ var groupArray = (0, _keys2['default'])(this.groups);
+ groupArray.sort(function (a, b) {
+ return a < b ? -1 : 1;
+ });
+
+ for (var i = 0; i < groupArray.length; i++) {
+ var groupId = groupArray[i];
+ if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
+ activeGroups++;
+ }
+ }
+
+ if (this.options[this.side].visible == false || this.amountOfGroups == 0 || this.options.enabled == false || activeGroups == 0) {
+ this.hide();
+ } else {
+ this.show();
+ if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'bottom-left') {
+ this.dom.frame.style.left = '4px';
+ this.dom.frame.style.textAlign = "left";
+ this.dom.textArea.style.textAlign = "left";
+ this.dom.textArea.style.left = this.options.iconSize + 15 + 'px';
+ this.dom.textArea.style.right = '';
+ this.svg.style.left = 0 + 'px';
+ this.svg.style.right = '';
+ } else {
+ this.dom.frame.style.right = '4px';
+ this.dom.frame.style.textAlign = "right";
+ this.dom.textArea.style.textAlign = "right";
+ this.dom.textArea.style.right = this.options.iconSize + 15 + 'px';
+ this.dom.textArea.style.left = '';
+ this.svg.style.right = 0 + 'px';
+ this.svg.style.left = '';
+ }
+
+ if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'top-right') {
+ this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace("px", "")) + 'px';
+ this.dom.frame.style.bottom = '';
+ } else {
+ var scrollableHeight = this.body.domProps.center.height - this.body.domProps.centerContainer.height;
+ this.dom.frame.style.bottom = 4 + scrollableHeight + Number(this.body.dom.center.style.top.replace("px", "")) + 'px';
+ this.dom.frame.style.top = '';
+ }
+
+ if (this.options.icons == false) {
+ this.dom.frame.style.width = this.dom.textArea.offsetWidth + 10 + 'px';
+ this.dom.textArea.style.right = '';
+ this.dom.textArea.style.left = '';
+ this.svg.style.width = '0px';
+ } else {
+ this.dom.frame.style.width = this.options.iconSize + 15 + this.dom.textArea.offsetWidth + 10 + 'px';
+ this.drawLegendIcons();
+ }
+
+ var content = '';
+ for (var i = 0; i < groupArray.length; i++) {
+ var groupId = groupArray[i];
+ if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
+ content += this.groups[groupId].content + '<br />';
+ }
+ }
+ this.dom.textArea.innerHTML = content;
+ this.dom.textArea.style.lineHeight = 0.75 * this.options.iconSize + this.options.iconSpacing + 'px';
+ }
+ };
+
+ Legend.prototype.drawLegendIcons = function () {
+ if (this.dom.frame.parentNode) {
+ var groupArray = (0, _keys2['default'])(this.groups);
+ groupArray.sort(function (a, b) {
+ return a < b ? -1 : 1;
+ });
+
+ // this resets the elements so the order is maintained
+ DOMutil.resetElements(this.svgElements);
+
+ var padding = window.getComputedStyle(this.dom.frame).paddingTop;
+ var iconOffset = Number(padding.replace('px', ''));
+ var x = iconOffset;
+ var iconWidth = this.options.iconSize;
+ var iconHeight = 0.75 * this.options.iconSize;
+ var y = iconOffset + 0.5 * iconHeight + 3;
+
+ this.svg.style.width = iconWidth + 5 + iconOffset + 'px';
+
+ for (var i = 0; i < groupArray.length; i++) {
+ var groupId = groupArray[i];
+ if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) {
+ this.groups[groupId].getLegend(iconWidth, iconHeight, this.framework, x, y);
+ y += iconHeight + this.options.iconSpacing;
+ }
+ }
+ }
+ };
+
+ module.exports = Legend;
+
+/***/ },
+/* 153 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ /**
+ * This object contains all possible options. It will check if the types are correct, if required if the option is one
+ * of the allowed values.
+ *
+ * __any__ means that the name of the property does not matter.
+ * __type__ is a required field for all objects and contains the allowed types of all objects
+ */
+ var string = 'string';
+ var bool = 'boolean';
+ var number = 'number';
+ var array = 'array';
+ var date = 'date';
+ var object = 'object'; // should only be in a __type__ property
+ var dom = 'dom';
+ var moment = 'moment';
+ var any = 'any';
+
+ var allOptions = {
+ configure: {
+ enabled: { 'boolean': bool },
+ filter: { 'boolean': bool, 'function': 'function' },
+ container: { dom: dom },
+ __type__: { object: object, 'boolean': bool, 'function': 'function' }
+ },
+
+ //globals :
+ yAxisOrientation: { string: ['left', 'right'] },
+ defaultGroup: { string: string },
+ sort: { 'boolean': bool },
+ sampling: { 'boolean': bool },
+ stack: { 'boolean': bool },
+ graphHeight: { string: string, number: number },
+ shaded: {
+ enabled: { 'boolean': bool },
+ orientation: { string: ['bottom', 'top', 'zero', 'group'] }, // top, bottom, zero, group
+ groupId: { object: object },
+ __type__: { 'boolean': bool, object: object }
+ },
+ style: { string: ['line', 'bar', 'points'] }, // line, bar
+ barChart: {
+ width: { number: number },
+ minWidth: { number: number },
+ sideBySide: { 'boolean': bool },
+ align: { string: ['left', 'center', 'right'] },
+ __type__: { object: object }
+ },
+ interpolation: {
+ enabled: { 'boolean': bool },
+ parametrization: { string: ['centripetal', 'chordal', 'uniform'] }, // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
+ alpha: { number: number },
+ __type__: { object: object, 'boolean': bool }
+ },
+ drawPoints: {
+ enabled: { 'boolean': bool },
+ onRender: { 'function': 'function' },
+ size: { number: number },
+ style: { string: ['square', 'circle'] }, // square, circle
+ __type__: { object: object, 'boolean': bool, 'function': 'function' }
+ },
+ dataAxis: {
+ showMinorLabels: { 'boolean': bool },
+ showMajorLabels: { 'boolean': bool },
+ icons: { 'boolean': bool },
+ width: { string: string, number: number },
+ visible: { 'boolean': bool },
+ alignZeros: { 'boolean': bool },
+ left: {
+ range: { min: { number: number, 'undefined': 'undefined' }, max: { number: number, 'undefined': 'undefined' }, __type__: { object: object } },
+ format: { 'function': 'function' },
+ title: { text: { string: string, number: number, 'undefined': 'undefined' }, style: { string: string, 'undefined': 'undefined' }, __type__: { object: object } },
+ __type__: { object: object }
+ },
+ right: {
+ range: { min: { number: number, 'undefined': 'undefined' }, max: { number: number, 'undefined': 'undefined' }, __type__: { object: object } },
+ format: { 'function': 'function' },
+ title: { text: { string: string, number: number, 'undefined': 'undefined' }, style: { string: string, 'undefined': 'undefined' }, __type__: { object: object } },
+ __type__: { object: object }
+ },
+ __type__: { object: object }
+ },
+ legend: {
+ enabled: { 'boolean': bool },
+ icons: { 'boolean': bool },
+ left: {
+ visible: { 'boolean': bool },
+ position: { string: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] },
+ __type__: { object: object }
+ },
+ right: {
+ visible: { 'boolean': bool },
+ position: { string: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] },
+ __type__: { object: object }
+ },
+ __type__: { object: object, 'boolean': bool }
+ },
+ groups: {
+ visibility: { any: any },
+ __type__: { object: object }
+ },
+
+ autoResize: { 'boolean': bool },
+ throttleRedraw: { number: number }, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511
+ clickToUse: { 'boolean': bool },
+ end: { number: number, date: date, string: string, moment: moment },
+ format: {
+ minorLabels: {
+ millisecond: { string: string, 'undefined': 'undefined' },
+ second: { string: string, 'undefined': 'undefined' },
+ minute: { string: string, 'undefined': 'undefined' },
+ hour: { string: string, 'undefined': 'undefined' },
+ weekday: { string: string, 'undefined': 'undefined' },
+ day: { string: string, 'undefined': 'undefined' },
+ month: { string: string, 'undefined': 'undefined' },
+ year: { string: string, 'undefined': 'undefined' },
+ __type__: { object: object }
+ },
+ majorLabels: {
+ millisecond: { string: string, 'undefined': 'undefined' },
+ second: { string: string, 'undefined': 'undefined' },
+ minute: { string: string, 'undefined': 'undefined' },
+ hour: { string: string, 'undefined': 'undefined' },
+ weekday: { string: string, 'undefined': 'undefined' },
+ day: { string: string, 'undefined': 'undefined' },
+ month: { string: string, 'undefined': 'undefined' },
+ year: { string: string, 'undefined': 'undefined' },
+ __type__: { object: object }
+ },
+ __type__: { object: object }
+ },
+ moment: { 'function': 'function' },
+ height: { string: string, number: number },
+ hiddenDates: {
+ start: { date: date, number: number, string: string, moment: moment },
+ end: { date: date, number: number, string: string, moment: moment },
+ repeat: { string: string },
+ __type__: { object: object, array: array }
+ },
+ locale: { string: string },
+ locales: {
+ __any__: { any: any },
+ __type__: { object: object }
+ },
+ max: { date: date, number: number, string: string, moment: moment },
+ maxHeight: { number: number, string: string },
+ maxMinorChars: { number: number },
+ min: { date: date, number: number, string: string, moment: moment },
+ minHeight: { number: number, string: string },
+ moveable: { 'boolean': bool },
+ multiselect: { 'boolean': bool },
+ orientation: { string: string },
+ showCurrentTime: { 'boolean': bool },
+ showMajorLabels: { 'boolean': bool },
+ showMinorLabels: { 'boolean': bool },
+ start: { date: date, number: number, string: string, moment: moment },
+ timeAxis: {
+ scale: { string: string, 'undefined': 'undefined' },
+ step: { number: number, 'undefined': 'undefined' },
+ __type__: { object: object }
+ },
+ width: { string: string, number: number },
+ zoomable: { 'boolean': bool },
+ zoomKey: { string: ['ctrlKey', 'altKey', 'metaKey', ''] },
+ zoomMax: { number: number },
+ zoomMin: { number: number },
+ zIndex: { number: number },
+ __type__: { object: object }
+ };
+
+ var configureOptions = {
+ global: {
+ //yAxisOrientation: ['left','right'], // TDOO: enable as soon as Grahp2d doesn't crash when changing this on the fly
+ sort: true,
+ sampling: true,
+ stack: false,
+ shaded: {
+ enabled: false,
+ orientation: ['zero', 'top', 'bottom', 'group'] // zero, top, bottom
+ },
+ style: ['line', 'bar', 'points'], // line, bar
+ barChart: {
+ width: [50, 5, 100, 5],
+ minWidth: [50, 5, 100, 5],
+ sideBySide: false,
+ align: ['left', 'center', 'right'] // left, center, right
+ },
+ interpolation: {
+ enabled: true,
+ parametrization: ['centripetal', 'chordal', 'uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
+ },
+ drawPoints: {
+ enabled: true,
+ size: [6, 2, 30, 1],
+ style: ['square', 'circle'] // square, circle
+ },
+ dataAxis: {
+ showMinorLabels: true,
+ showMajorLabels: true,
+ icons: false,
+ width: [40, 0, 200, 1],
+ visible: true,
+ alignZeros: true,
+ left: {
+ //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
+ //format: function (value) {return value;},
+ title: { text: '', style: '' }
+ },
+ right: {
+ //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
+ //format: function (value) {return value;},
+ title: { text: '', style: '' }
+ }
+ },
+ legend: {
+ enabled: false,
+ icons: true,
+ left: {
+ visible: true,
+ position: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] // top/bottom - left,right
+ },
+ right: {
+ visible: true,
+ position: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] // top/bottom - left,right
+ }
+ },
+
+ autoResize: true,
+ clickToUse: false,
+ end: '',
+ format: {
+ minorLabels: {
+ millisecond: 'SSS',
+ second: 's',
+ minute: 'HH:mm',
+ hour: 'HH:mm',
+ weekday: 'ddd D',
+ day: 'D',
+ month: 'MMM',
+ year: 'YYYY'
+ },
+ majorLabels: {
+ millisecond: 'HH:mm:ss',
+ second: 'D MMMM HH:mm',
+ minute: 'ddd D MMMM',
+ hour: 'ddd D MMMM',
+ weekday: 'MMMM YYYY',
+ day: 'MMMM YYYY',
+ month: 'YYYY',
+ year: ''
+ }
+ },
+
+ height: '',
+ locale: '',
+ max: '',
+ maxHeight: '',
+ maxMinorChars: [7, 0, 20, 1],
+ min: '',
+ minHeight: '',
+ moveable: true,
+ orientation: ['both', 'bottom', 'top'],
+ showCurrentTime: false,
+ showMajorLabels: true,
+ showMinorLabels: true,
+ start: '',
+ width: '100%',
+ zoomable: true,
+ zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
+ zoomMax: [315360000000000, 10, 315360000000000, 1],
+ zoomMin: [10, 10, 315360000000000, 1],
+ zIndex: 0
+ }
+ };
+
+ exports.allOptions = allOptions;
+ exports.configureOptions = configureOptions;
+
+/***/ },
+/* 154 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ // utils
+ exports.util = __webpack_require__(1);
+ exports.DOMutil = __webpack_require__(90);
+
+ // data
+ exports.DataSet = __webpack_require__(91);
+ exports.DataView = __webpack_require__(93);
+ exports.Queue = __webpack_require__(92);
+
+ // Network
+ exports.Network = __webpack_require__(155);
+ exports.network = {
+ Images: __webpack_require__(156),
+ dotparser: __webpack_require__(224),
+ gephiParser: __webpack_require__(225),
+ allOptions: __webpack_require__(220)
+ };
+ exports.network.convertDot = function (input) {
+ return exports.network.dotparser.DOTToGraph(input);
+ };
+ exports.network.convertGephi = function (input, options) {
+ return exports.network.gephiParser.parseGephi(input, options);
+ };
+
+ // bundled external libraries
+ exports.moment = __webpack_require__(84);
+ exports.Hammer = __webpack_require__(108);
+ exports.keycharm = __webpack_require__(111);
+
+/***/ },
+/* 155 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _Images = __webpack_require__(156);
+
+ var _Images2 = _interopRequireDefault(_Images);
+
+ var _Groups = __webpack_require__(157);
+
+ var _Groups2 = _interopRequireDefault(_Groups);
+
+ var _NodesHandler = __webpack_require__(158);
+
+ var _NodesHandler2 = _interopRequireDefault(_NodesHandler);
+
+ var _EdgesHandler = __webpack_require__(191);
+
+ var _EdgesHandler2 = _interopRequireDefault(_EdgesHandler);
+
+ var _PhysicsEngine = __webpack_require__(200);
+
+ var _PhysicsEngine2 = _interopRequireDefault(_PhysicsEngine);
+
+ var _Clustering = __webpack_require__(209);
+
+ var _Clustering2 = _interopRequireDefault(_Clustering);
+
+ var _CanvasRenderer = __webpack_require__(212);
+
+ var _CanvasRenderer2 = _interopRequireDefault(_CanvasRenderer);
+
+ var _Canvas = __webpack_require__(213);
+
+ var _Canvas2 = _interopRequireDefault(_Canvas);
+
+ var _View = __webpack_require__(214);
+
+ var _View2 = _interopRequireDefault(_View);
+
+ var _InteractionHandler = __webpack_require__(215);
+
+ var _InteractionHandler2 = _interopRequireDefault(_InteractionHandler);
+
+ var _SelectionHandler = __webpack_require__(217);
+
+ var _SelectionHandler2 = _interopRequireDefault(_SelectionHandler);
+
+ var _LayoutEngine = __webpack_require__(218);
+
+ var _LayoutEngine2 = _interopRequireDefault(_LayoutEngine);
+
+ var _ManipulationSystem = __webpack_require__(219);
+
+ var _ManipulationSystem2 = _interopRequireDefault(_ManipulationSystem);
+
+ var _Configurator = __webpack_require__(114);
+
+ var _Configurator2 = _interopRequireDefault(_Configurator);
+
+ var _Validator = __webpack_require__(122);
+
+ var _Validator2 = _interopRequireDefault(_Validator);
+
+ var _options = __webpack_require__(220);
+
+ var _KamadaKawai = __webpack_require__(221);
+
+ var _KamadaKawai2 = _interopRequireDefault(_KamadaKawai);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ // Load custom shapes into CanvasRenderingContext2D
+ __webpack_require__(223);
+
+ var Emitter = __webpack_require__(95);
+ var util = __webpack_require__(1);
+ var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+ var dotparser = __webpack_require__(224);
+ var gephiParser = __webpack_require__(225);
+ var Activator = __webpack_require__(139);
+ var locales = __webpack_require__(226);
+
+ /**
+ * @constructor Network
+ * Create a network visualization, displaying nodes and edges.
+ *
+ * @param {Element} container The DOM element in which the Network will
+ * be created. Normally a div element.
+ * @param {Object} data An object containing parameters
+ * {Array} nodes
+ * {Array} edges
+ * @param {Object} options Options
+ */
+ function Network(container, data, options) {
+ var _this = this;
+
+ if (!(this instanceof Network)) {
+ throw new SyntaxError('Constructor must be called with the new operator');
+ }
+
+ // set constant values
+ this.options = {};
+ this.defaultOptions = {
+ locale: 'en',
+ locales: locales,
+ clickToUse: false
+ };
+ util.extend(this.options, this.defaultOptions);
+
+ // containers for nodes and edges
+ this.body = {
+ container: container,
+ nodes: {},
+ nodeIndices: [],
+ edges: {},
+ edgeIndices: [],
+ emitter: {
+ on: this.on.bind(this),
+ off: this.off.bind(this),
+ emit: this.emit.bind(this),
+ once: this.once.bind(this)
+ },
+ eventListeners: {
+ onTap: function onTap() {},
+ onTouch: function onTouch() {},
+ onDoubleTap: function onDoubleTap() {},
+ onHold: function onHold() {},
+ onDragStart: function onDragStart() {},
+ onDrag: function onDrag() {},
+ onDragEnd: function onDragEnd() {},
+ onMouseWheel: function onMouseWheel() {},
+ onPinch: function onPinch() {},
+ onMouseMove: function onMouseMove() {},
+ onRelease: function onRelease() {},
+ onContext: function onContext() {}
+ },
+ data: {
+ nodes: null, // A DataSet or DataView
+ edges: null // A DataSet or DataView
+ },
+ functions: {
+ createNode: function createNode() {},
+ createEdge: function createEdge() {},
+ getPointer: function getPointer() {}
+ },
+ modules: {},
+ view: {
+ scale: 1,
+ translation: { x: 0, y: 0 }
+ }
+ };
+
+ // bind the event listeners
+ this.bindEventListeners();
+
+ // setting up all modules
+ this.images = new _Images2['default'](function () {
+ return _this.body.emitter.emit("_requestRedraw");
+ }); // object with images
+ this.groups = new _Groups2['default'](); // object with groups
+ this.canvas = new _Canvas2['default'](this.body); // DOM handler
+ this.selectionHandler = new _SelectionHandler2['default'](this.body, this.canvas); // Selection handler
+ this.interactionHandler = new _InteractionHandler2['default'](this.body, this.canvas, this.selectionHandler); // Interaction handler handles all the hammer bindings (that are bound by canvas), key
+ this.view = new _View2['default'](this.body, this.canvas); // camera handler, does animations and zooms
+ this.renderer = new _CanvasRenderer2['default'](this.body, this.canvas); // renderer, starts renderloop, has events that modules can hook into
+ this.physics = new _PhysicsEngine2['default'](this.body); // physics engine, does all the simulations
+ this.layoutEngine = new _LayoutEngine2['default'](this.body); // layout engine for inital layout and hierarchical layout
+ this.clustering = new _Clustering2['default'](this.body); // clustering api
+ this.manipulation = new _ManipulationSystem2['default'](this.body, this.canvas, this.selectionHandler); // data manipulation system
+
+ this.nodesHandler = new _NodesHandler2['default'](this.body, this.images, this.groups, this.layoutEngine); // Handle adding, deleting and updating of nodes as well as global options
+ this.edgesHandler = new _EdgesHandler2['default'](this.body, this.images, this.groups); // Handle adding, deleting and updating of edges as well as global options
+
+ this.body.modules["kamadaKawai"] = new _KamadaKawai2['default'](this.body, 150, 0.05); // Layouting algorithm.
+ this.body.modules["clustering"] = this.clustering;
+
+ // create the DOM elements
+ this.canvas._create();
+
+ // apply options
+ this.setOptions(options);
+
+ // load data (the disable start variable will be the same as the enabled clustering)
+ this.setData(data);
+ }
+
+ // Extend Network with an Emitter mixin
+ Emitter(Network.prototype);
+
+ /**
+ * Set options
+ * @param {Object} options
+ */
+ Network.prototype.setOptions = function (options) {
+ var _this2 = this;
+
+ if (options !== undefined) {
+ var errorFound = _Validator2['default'].validate(options, _options.allOptions);
+ if (errorFound === true) {
+ console.log('%cErrors have been found in the supplied options object.', _Validator.printStyle);
+ }
+
+ // copy the global fields over
+ var fields = ['locale', 'locales', 'clickToUse'];
+ util.selectiveDeepExtend(fields, this.options, options);
+
+ // the hierarchical system can adapt the edges and the physics to it's own options because not all combinations work with the hierarichical system.
+ options = this.layoutEngine.setOptions(options.layout, options);
+
+ this.canvas.setOptions(options); // options for canvas are in globals
+
+ // pass the options to the modules
+ this.groups.setOptions(options.groups);
+ this.nodesHandler.setOptions(options.nodes);
+ this.edgesHandler.setOptions(options.edges);
+ this.physics.setOptions(options.physics);
+ this.manipulation.setOptions(options.manipulation, options, this.options); // manipulation uses the locales in the globals
+
+ this.interactionHandler.setOptions(options.interaction);
+ this.renderer.setOptions(options.interaction); // options for rendering are in interaction
+ this.selectionHandler.setOptions(options.interaction); // options for selection are in interaction
+
+ // reload the settings of the nodes to apply changes in groups that are not referenced by pointer.
+ if (options.groups !== undefined) {
+ this.body.emitter.emit("refreshNodes");
+ }
+ // these two do not have options at the moment, here for completeness
+ //this.view.setOptions(options.view);
+ //this.clustering.setOptions(options.clustering);
+
+ if ('configure' in options) {
+ if (!this.configurator) {
+ this.configurator = new _Configurator2['default'](this, this.body.container, _options.configureOptions, this.canvas.pixelRatio);
+ }
+
+ this.configurator.setOptions(options.configure);
+ }
+
+ // if the configuration system is enabled, copy all options and put them into the config system
+ if (this.configurator && this.configurator.options.enabled === true) {
+ var networkOptions = { nodes: {}, edges: {}, layout: {}, interaction: {}, manipulation: {}, physics: {}, global: {} };
+ util.deepExtend(networkOptions.nodes, this.nodesHandler.options);
+ util.deepExtend(networkOptions.edges, this.edgesHandler.options);
+ util.deepExtend(networkOptions.layout, this.layoutEngine.options);
+ // load the selectionHandler and render default options in to the interaction group
+ util.deepExtend(networkOptions.interaction, this.selectionHandler.options);
+ util.deepExtend(networkOptions.interaction, this.renderer.options);
+
+ util.deepExtend(networkOptions.interaction, this.interactionHandler.options);
+ util.deepExtend(networkOptions.manipulation, this.manipulation.options);
+ util.deepExtend(networkOptions.physics, this.physics.options);
+
+ // load globals into the global object
+ util.deepExtend(networkOptions.global, this.canvas.options);
+ util.deepExtend(networkOptions.global, this.options);
+
+ this.configurator.setModuleOptions(networkOptions);
+ }
+
+ // handle network global options
+ if (options.clickToUse !== undefined) {
+ if (options.clickToUse === true) {
+ if (this.activator === undefined) {
+ this.activator = new Activator(this.canvas.frame);
+ this.activator.on('change', function () {
+ _this2.body.emitter.emit("activate");
+ });
+ }
+ } else {
+ if (this.activator !== undefined) {
+ this.activator.destroy();
+ delete this.activator;
+ }
+ this.body.emitter.emit("activate");
+ }
+ } else {
+ this.body.emitter.emit("activate");
+ }
+
+ this.canvas.setSize();
+ // start the physics simulation. Can be safely called multiple times.
+ this.body.emitter.emit("startSimulation");
+ }
+ };
+
+ /**
+ * Update the this.body.nodeIndices with the most recent node index list
+ * @private
+ */
+ Network.prototype._updateVisibleIndices = function () {
+ var nodes = this.body.nodes;
+ var edges = this.body.edges;
+ this.body.nodeIndices = [];
+ this.body.edgeIndices = [];
+
+ for (var nodeId in nodes) {
+ if (nodes.hasOwnProperty(nodeId)) {
+ if (nodes[nodeId].options.hidden === false) {
+ this.body.nodeIndices.push(nodes[nodeId].id);
+ }
+ }
+ }
+
+ for (var edgeId in edges) {
+ if (edges.hasOwnProperty(edgeId)) {
+ if (edges[edgeId].options.hidden === false) {
+ this.body.edgeIndices.push(edges[edgeId].id);
+ }
+ }
+ }
+ };
+
+ /**
+ * Bind all events
+ */
+ Network.prototype.bindEventListeners = function () {
+ var _this3 = this;
+
+ // this event will trigger a rebuilding of the cache everything. Used when nodes or edges have been added or removed.
+ this.body.emitter.on("_dataChanged", function () {
+ // update shortcut lists
+ _this3._updateVisibleIndices();
+ _this3.body.emitter.emit("_requestRedraw");
+ // call the dataUpdated event because the only difference between the two is the updating of the indices
+ _this3.body.emitter.emit("_dataUpdated");
+ });
+
+ // this is called when options of EXISTING nodes or edges have changed.
+ this.body.emitter.on("_dataUpdated", function () {
+ // update values
+ _this3._updateValueRange(_this3.body.nodes);
+ _this3._updateValueRange(_this3.body.edges);
+ // start simulation (can be called safely, even if already running)
+ _this3.body.emitter.emit("startSimulation");
+ _this3.body.emitter.emit("_requestRedraw");
+ });
+ };
+
+ /**
+ * Set nodes and edges, and optionally options as well.
+ *
+ * @param {Object} data Object containing parameters:
+ * {Array | DataSet | DataView} [nodes] Array with nodes
+ * {Array | DataSet | DataView} [edges] Array with edges
+ * {String} [dot] String containing data in DOT format
+ * {String} [gephi] String containing data in gephi JSON format
+ * {Options} [options] Object with options
+ */
+ Network.prototype.setData = function (data) {
+ // reset the physics engine.
+ this.body.emitter.emit("resetPhysics");
+ this.body.emitter.emit("_resetData");
+
+ // unselect all to ensure no selections from old data are carried over.
+ this.selectionHandler.unselectAll();
+
+ if (data && data.dot && (data.nodes || data.edges)) {
+ throw new SyntaxError('Data must contain either parameter "dot" or ' + ' parameter pair "nodes" and "edges", but not both.');
+ }
+
+ // set options
+ this.setOptions(data && data.options);
+ // set all data
+ if (data && data.dot) {
+ console.log('The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);');
+ // parse DOT file
+ var dotData = dotparser.DOTToGraph(data.dot);
+ this.setData(dotData);
+ return;
+ } else if (data && data.gephi) {
+ // parse DOT file
+ console.log('The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);');
+ var gephiData = gephiParser.parseGephi(data.gephi);
+ this.setData(gephiData);
+ return;
+ } else {
+ this.nodesHandler.setData(data && data.nodes, true);
+ this.edgesHandler.setData(data && data.edges, true);
+ }
+
+ // emit change in data
+ this.body.emitter.emit("_dataChanged");
+
+ // emit data loaded
+ this.body.emitter.emit("_dataLoaded");
+
+ // find a stable position or start animating to a stable position
+ this.body.emitter.emit("initPhysics");
+ };
+
+ /**
+ * Cleans up all bindings of the network, removing it fully from the memory IF the variable is set to null after calling this function.
+ * var network = new vis.Network(..);
+ * network.destroy();
+ * network = null;
+ */
+ Network.prototype.destroy = function () {
+ this.body.emitter.emit("destroy");
+ // clear events
+ this.body.emitter.off();
+ this.off();
+
+ // delete modules
+ delete this.groups;
+ delete this.canvas;
+ delete this.selectionHandler;
+ delete this.interactionHandler;
+ delete this.view;
+ delete this.renderer;
+ delete this.physics;
+ delete this.layoutEngine;
+ delete this.clustering;
+ delete this.manipulation;
+ delete this.nodesHandler;
+ delete this.edgesHandler;
+ delete this.configurator;
+ delete this.images;
+
+ for (var nodeId in this.body.nodes) {
+ delete this.body.nodes[nodeId];
+ }
+ for (var edgeId in this.body.edges) {
+ delete this.body.edges[edgeId];
+ }
+
+ // remove the container and everything inside it recursively
+ util.recursiveDOMDelete(this.body.container);
+ };
+
+ /**
+ * Update the values of all object in the given array according to the current
+ * value range of the objects in the array.
+ * @param {Object} obj An object containing a set of Edges or Nodes
+ * The objects must have a method getValue() and
+ * setValueRange(min, max).
+ * @private
+ */
+ Network.prototype._updateValueRange = function (obj) {
+ var id;
+
+ // determine the range of the objects
+ var valueMin = undefined;
+ var valueMax = undefined;
+ var valueTotal = 0;
+ for (id in obj) {
+ if (obj.hasOwnProperty(id)) {
+ var value = obj[id].getValue();
+ if (value !== undefined) {
+ valueMin = valueMin === undefined ? value : Math.min(value, valueMin);
+ valueMax = valueMax === undefined ? value : Math.max(value, valueMax);
+ valueTotal += value;
+ }
+ }
+ }
+
+ // adjust the range of all objects
+ if (valueMin !== undefined && valueMax !== undefined) {
+ for (id in obj) {
+ if (obj.hasOwnProperty(id)) {
+ obj[id].setValueRange(valueMin, valueMax, valueTotal);
+ }
+ }
+ }
+ };
+
+ /**
+ * Returns true when the Network is active.
+ * @returns {boolean}
+ */
+ Network.prototype.isActive = function () {
+ return !this.activator || this.activator.active;
+ };
+
+ Network.prototype.setSize = function () {
+ return this.canvas.setSize.apply(this.canvas, arguments);
+ };
+ Network.prototype.canvasToDOM = function () {
+ return this.canvas.canvasToDOM.apply(this.canvas, arguments);
+ };
+ Network.prototype.DOMtoCanvas = function () {
+ return this.canvas.DOMtoCanvas.apply(this.canvas, arguments);
+ };
+ Network.prototype.findNode = function () {
+ return this.clustering.findNode.apply(this.clustering, arguments);
+ };
+ Network.prototype.isCluster = function () {
+ return this.clustering.isCluster.apply(this.clustering, arguments);
+ };
+ Network.prototype.openCluster = function () {
+ return this.clustering.openCluster.apply(this.clustering, arguments);
+ };
+ Network.prototype.cluster = function () {
+ return this.clustering.cluster.apply(this.clustering, arguments);
+ };
+ Network.prototype.getNodesInCluster = function () {
+ return this.clustering.getNodesInCluster.apply(this.clustering, arguments);
+ };
+ Network.prototype.clusterByConnection = function () {
+ return this.clustering.clusterByConnection.apply(this.clustering, arguments);
+ };
+ Network.prototype.clusterByHubsize = function () {
+ return this.clustering.clusterByHubsize.apply(this.clustering, arguments);
+ };
+ Network.prototype.clusterOutliers = function () {
+ return this.clustering.clusterOutliers.apply(this.clustering, arguments);
+ };
+ Network.prototype.getSeed = function () {
+ return this.layoutEngine.getSeed.apply(this.layoutEngine, arguments);
+ };
+ Network.prototype.enableEditMode = function () {
+ return this.manipulation.enableEditMode.apply(this.manipulation, arguments);
+ };
+ Network.prototype.disableEditMode = function () {
+ return this.manipulation.disableEditMode.apply(this.manipulation, arguments);
+ };
+ Network.prototype.addNodeMode = function () {
+ return this.manipulation.addNodeMode.apply(this.manipulation, arguments);
+ };
+ Network.prototype.editNode = function () {
+ return this.manipulation.editNode.apply(this.manipulation, arguments);
+ };
+ Network.prototype.editNodeMode = function () {
+ console.log("Deprecated: Please use editNode instead of editNodeMode.");return this.manipulation.editNode.apply(this.manipulation, arguments);
+ };
+ Network.prototype.addEdgeMode = function () {
+ return this.manipulation.addEdgeMode.apply(this.manipulation, arguments);
+ };
+ Network.prototype.editEdgeMode = function () {
+ return this.manipulation.editEdgeMode.apply(this.manipulation, arguments);
+ };
+ Network.prototype.deleteSelected = function () {
+ return this.manipulation.deleteSelected.apply(this.manipulation, arguments);
+ };
+ Network.prototype.getPositions = function () {
+ return this.nodesHandler.getPositions.apply(this.nodesHandler, arguments);
+ };
+ Network.prototype.storePositions = function () {
+ return this.nodesHandler.storePositions.apply(this.nodesHandler, arguments);
+ };
+ Network.prototype.moveNode = function () {
+ return this.nodesHandler.moveNode.apply(this.nodesHandler, arguments);
+ };
+ Network.prototype.getBoundingBox = function () {
+ return this.nodesHandler.getBoundingBox.apply(this.nodesHandler, arguments);
+ };
+ Network.prototype.getConnectedNodes = function (objectId) {
+ if (this.body.nodes[objectId] !== undefined) {
+ return this.nodesHandler.getConnectedNodes.apply(this.nodesHandler, arguments);
+ } else {
+ return this.edgesHandler.getConnectedNodes.apply(this.edgesHandler, arguments);
+ }
+ };
+ Network.prototype.getConnectedEdges = function () {
+ return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler, arguments);
+ };
+ Network.prototype.startSimulation = function () {
+ return this.physics.startSimulation.apply(this.physics, arguments);
+ };
+ Network.prototype.stopSimulation = function () {
+ return this.physics.stopSimulation.apply(this.physics, arguments);
+ };
+ Network.prototype.stabilize = function () {
+ return this.physics.stabilize.apply(this.physics, arguments);
+ };
+ Network.prototype.getSelection = function () {
+ return this.selectionHandler.getSelection.apply(this.selectionHandler, arguments);
+ };
+ Network.prototype.setSelection = function () {
+ return this.selectionHandler.setSelection.apply(this.selectionHandler, arguments);
+ };
+ Network.prototype.getSelectedNodes = function () {
+ return this.selectionHandler.getSelectedNodes.apply(this.selectionHandler, arguments);
+ };
+ Network.prototype.getSelectedEdges = function () {
+ return this.selectionHandler.getSelectedEdges.apply(this.selectionHandler, arguments);
+ };
+ Network.prototype.getNodeAt = function () {
+ var node = this.selectionHandler.getNodeAt.apply(this.selectionHandler, arguments);
+ if (node !== undefined && node.id !== undefined) {
+ return node.id;
+ }
+ return node;
+ };
+ Network.prototype.getEdgeAt = function () {
+ var edge = this.selectionHandler.getEdgeAt.apply(this.selectionHandler, arguments);
+ if (edge !== undefined && edge.id !== undefined) {
+ return edge.id;
+ }
+ return edge;
+ };
+ Network.prototype.selectNodes = function () {
+ return this.selectionHandler.selectNodes.apply(this.selectionHandler, arguments);
+ };
+ Network.prototype.selectEdges = function () {
+ return this.selectionHandler.selectEdges.apply(this.selectionHandler, arguments);
+ };
+ Network.prototype.unselectAll = function () {
+ this.selectionHandler.unselectAll.apply(this.selectionHandler, arguments);
+ this.redraw();
+ };
+ Network.prototype.redraw = function () {
+ return this.renderer.redraw.apply(this.renderer, arguments);
+ };
+ Network.prototype.getScale = function () {
+ return this.view.getScale.apply(this.view, arguments);
+ };
+ Network.prototype.getViewPosition = function () {
+ return this.view.getViewPosition.apply(this.view, arguments);
+ };
+ Network.prototype.fit = function () {
+ return this.view.fit.apply(this.view, arguments);
+ };
+ Network.prototype.moveTo = function () {
+ return this.view.moveTo.apply(this.view, arguments);
+ };
+ Network.prototype.focus = function () {
+ return this.view.focus.apply(this.view, arguments);
+ };
+ Network.prototype.releaseNode = function () {
+ return this.view.releaseNode.apply(this.view, arguments);
+ };
+ Network.prototype.getOptionsFromConfigurator = function () {
+ var options = {};
+ if (this.configurator) {
+ options = this.configurator.getOptions.apply(this.configurator);
+ }
+ return options;
+ };
+
+ module.exports = Network;
+
+/***/ },
+/* 156 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ /**
+ * @class Images
+ * This class loads images and keeps them stored.
+ */
+ var Images = function () {
+ function Images(callback) {
+ (0, _classCallCheck3["default"])(this, Images);
+
+ this.images = {};
+ this.imageBroken = {};
+ this.callback = callback;
+ }
+
+ /**
+ * @param {string} url The Url to cache the image as
+ * @return {Image} imageToLoadBrokenUrlOn The image object
+ */
+
+
+ (0, _createClass3["default"])(Images, [{
+ key: "_addImageToCache",
+ value: function _addImageToCache(url, imageToCache) {
+ // IE11 fix -- thanks dponch!
+ if (imageToCache.width === 0) {
+ document.body.appendChild(imageToCache);
+ imageToCache.width = imageToCache.offsetWidth;
+ imageToCache.height = imageToCache.offsetHeight;
+ document.body.removeChild(imageToCache);
+ }
+
+ this.images[url] = imageToCache;
+ }
+
+ /**
+ * @param {string} url The original Url that failed to load, if the broken image is successfully loaded it will be added to the cache using this Url as the key so that subsequent requests for this Url will return the broken image
+ * @param {string} brokenUrl Url the broken image to try and load
+ * @return {Image} imageToLoadBrokenUrlOn The image object
+ */
+
+ }, {
+ key: "_tryloadBrokenUrl",
+ value: function _tryloadBrokenUrl(url, brokenUrl, imageToLoadBrokenUrlOn) {
+ var _this = this;
+
+ //If any of the parameters aren't specified then exit the function because nothing constructive can be done
+ if (url === undefined || brokenUrl === undefined || imageToLoadBrokenUrlOn === undefined) return;
+
+ //Clear the old subscription to the error event and put a new in place that only handle errors in loading the brokenImageUrl
+ imageToLoadBrokenUrlOn.onerror = function () {
+ console.error("Could not load brokenImage:", brokenUrl);
+ //Add an empty image to the cache so that when subsequent load calls are made for the url we don't try load the image and broken image again
+ _this._addImageToCache(url, new Image());
+ };
+
+ //Set the source of the image to the brokenUrl, this is actually what kicks off the loading of the broken image
+ imageToLoadBrokenUrlOn.src = brokenUrl;
+ }
+
+ /**
+ * @return {Image} imageToRedrawWith The images that will be passed to the callback when it is invoked
+ */
+
+ }, {
+ key: "_redrawWithImage",
+ value: function _redrawWithImage(imageToRedrawWith) {
+ if (this.callback) {
+ this.callback(imageToRedrawWith);
+ }
+ }
+
+ /**
+ * @param {string} url Url of the image
+ * @param {string} brokenUrl Url of an image to use if the url image is not found
+ * @return {Image} img The image object
+ */
+
+ }, {
+ key: "load",
+ value: function load(url, brokenUrl, id) {
+ var _this2 = this;
+
+ //Try and get the image from the cache, if successful then return the cached image
+ var cachedImage = this.images[url];
+ if (cachedImage) return cachedImage;
+
+ //Create a new image
+ var img = new Image();
+
+ //Subscribe to the event that is raised if the image loads successfully
+ img.onload = function () {
+ //Add the image to the cache and then request a redraw
+ _this2._addImageToCache(url, img);
+ _this2._redrawWithImage(img);
+ };
+
+ //Subscribe to the event that is raised if the image fails to load
+ img.onerror = function () {
+ console.error("Could not load image:", url);
+ //Try and load the image specified by the brokenUrl using
+ _this2._tryloadBrokenUrl(url, brokenUrl, img);
+ };
+
+ //Set the source of the image to the url, this is actuall what kicks off the loading of the image
+ img.src = url;
+
+ //Return the new image
+ return img;
+ }
+ }]);
+ return Images;
+ }();
+
+ exports["default"] = Images;
+
+/***/ },
+/* 157 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var util = __webpack_require__(1);
+
+ /**
+ * @class Groups
+ * This class can store groups and options specific for groups.
+ */
+
+ var Groups = function () {
+ function Groups() {
+ (0, _classCallCheck3["default"])(this, Groups);
+
+ this.clear();
+ this.defaultIndex = 0;
+ this.groupsArray = [];
+ this.groupIndex = 0;
+
+ this.defaultGroups = [{ border: "#2B7CE9", background: "#97C2FC", highlight: { border: "#2B7CE9", background: "#D2E5FF" }, hover: { border: "#2B7CE9", background: "#D2E5FF" } }, // 0: blue
+ { border: "#FFA500", background: "#FFFF00", highlight: { border: "#FFA500", background: "#FFFFA3" }, hover: { border: "#FFA500", background: "#FFFFA3" } }, // 1: yellow
+ { border: "#FA0A10", background: "#FB7E81", highlight: { border: "#FA0A10", background: "#FFAFB1" }, hover: { border: "#FA0A10", background: "#FFAFB1" } }, // 2: red
+ { border: "#41A906", background: "#7BE141", highlight: { border: "#41A906", background: "#A1EC76" }, hover: { border: "#41A906", background: "#A1EC76" } }, // 3: green
+ { border: "#E129F0", background: "#EB7DF4", highlight: { border: "#E129F0", background: "#F0B3F5" }, hover: { border: "#E129F0", background: "#F0B3F5" } }, // 4: magenta
+ { border: "#7C29F0", background: "#AD85E4", highlight: { border: "#7C29F0", background: "#D3BDF0" }, hover: { border: "#7C29F0", background: "#D3BDF0" } }, // 5: purple
+ { border: "#C37F00", background: "#FFA807", highlight: { border: "#C37F00", background: "#FFCA66" }, hover: { border: "#C37F00", background: "#FFCA66" } }, // 6: orange
+ { border: "#4220FB", background: "#6E6EFD", highlight: { border: "#4220FB", background: "#9B9BFD" }, hover: { border: "#4220FB", background: "#9B9BFD" } }, // 7: darkblue
+ { border: "#FD5A77", background: "#FFC0CB", highlight: { border: "#FD5A77", background: "#FFD1D9" }, hover: { border: "#FD5A77", background: "#FFD1D9" } }, // 8: pink
+ { border: "#4AD63A", background: "#C2FABC", highlight: { border: "#4AD63A", background: "#E6FFE3" }, hover: { border: "#4AD63A", background: "#E6FFE3" } }, // 9: mint
+
+ { border: "#990000", background: "#EE0000", highlight: { border: "#BB0000", background: "#FF3333" }, hover: { border: "#BB0000", background: "#FF3333" } }, // 10:bright red
+
+ { border: "#FF6000", background: "#FF6000", highlight: { border: "#FF6000", background: "#FF6000" }, hover: { border: "#FF6000", background: "#FF6000" } }, // 12: real orange
+ { border: "#97C2FC", background: "#2B7CE9", highlight: { border: "#D2E5FF", background: "#2B7CE9" }, hover: { border: "#D2E5FF", background: "#2B7CE9" } }, // 13: blue
+ { border: "#399605", background: "#255C03", highlight: { border: "#399605", background: "#255C03" }, hover: { border: "#399605", background: "#255C03" } }, // 14: green
+ { border: "#B70054", background: "#FF007E", highlight: { border: "#B70054", background: "#FF007E" }, hover: { border: "#B70054", background: "#FF007E" } }, // 15: magenta
+ { border: "#AD85E4", background: "#7C29F0", highlight: { border: "#D3BDF0", background: "#7C29F0" }, hover: { border: "#D3BDF0", background: "#7C29F0" } }, // 16: purple
+ { border: "#4557FA", background: "#000EA1", highlight: { border: "#6E6EFD", background: "#000EA1" }, hover: { border: "#6E6EFD", background: "#000EA1" } }, // 17: darkblue
+ { border: "#FFC0CB", background: "#FD5A77", highlight: { border: "#FFD1D9", background: "#FD5A77" }, hover: { border: "#FFD1D9", background: "#FD5A77" } }, // 18: pink
+ { border: "#C2FABC", background: "#74D66A", highlight: { border: "#E6FFE3", background: "#74D66A" }, hover: { border: "#E6FFE3", background: "#74D66A" } }, // 19: mint
+
+ { border: "#EE0000", background: "#990000", highlight: { border: "#FF3333", background: "#BB0000" }, hover: { border: "#FF3333", background: "#BB0000" } } // 20:bright red
+ ];
+
+ this.options = {};
+ this.defaultOptions = {
+ useDefaultGroups: true
+ };
+ util.extend(this.options, this.defaultOptions);
+ }
+
+ (0, _createClass3["default"])(Groups, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ var optionFields = ['useDefaultGroups'];
+
+ if (options !== undefined) {
+ for (var groupName in options) {
+ if (options.hasOwnProperty(groupName)) {
+ if (optionFields.indexOf(groupName) === -1) {
+ var group = options[groupName];
+ this.add(groupName, group);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Clear all groups
+ */
+
+ }, {
+ key: "clear",
+ value: function clear() {
+ this.groups = {};
+ this.groupsArray = [];
+ }
+
+ /**
+ * get group options of a groupname. If groupname is not found, a new group
+ * is added.
+ * @param {*} groupname Can be a number, string, Date, etc.
+ * @return {Object} group The created group, containing all group options
+ */
+
+ }, {
+ key: "get",
+ value: function get(groupname) {
+ var group = this.groups[groupname];
+ if (group === undefined) {
+ if (this.options.useDefaultGroups === false && this.groupsArray.length > 0) {
+ // create new group
+ var index = this.groupIndex % this.groupsArray.length;
+ this.groupIndex++;
+ group = {};
+ group.color = this.groups[this.groupsArray[index]];
+ this.groups[groupname] = group;
+ } else {
+ // create new group
+ var _index = this.defaultIndex % this.defaultGroups.length;
+ this.defaultIndex++;
+ group = {};
+ group.color = this.defaultGroups[_index];
+ this.groups[groupname] = group;
+ }
+ }
+
+ return group;
+ }
+
+ /**
+ * Add a custom group style
+ * @param {String} groupName
+ * @param {Object} style An object containing borderColor,
+ * backgroundColor, etc.
+ * @return {Object} group The created group object
+ */
+
+ }, {
+ key: "add",
+ value: function add(groupName, style) {
+ this.groups[groupName] = style;
+ this.groupsArray.push(groupName);
+ return style;
+ }
+ }]);
+ return Groups;
+ }();
+
+ exports["default"] = Groups;
+
+/***/ },
+/* 158 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _Node = __webpack_require__(159);
+
+ var _Node2 = _interopRequireDefault(_Node);
+
+ var _Label = __webpack_require__(160);
+
+ var _Label2 = _interopRequireDefault(_Label);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+
+ var NodesHandler = function () {
+ function NodesHandler(body, images, groups, layoutEngine) {
+ var _this = this;
+
+ (0, _classCallCheck3['default'])(this, NodesHandler);
+
+ this.body = body;
+ this.images = images;
+ this.groups = groups;
+ this.layoutEngine = layoutEngine;
+
+ // create the node API in the body container
+ this.body.functions.createNode = this.create.bind(this);
+
+ this.nodesListeners = {
+ add: function add(event, params) {
+ _this.add(params.items);
+ },
+ update: function update(event, params) {
+ _this.update(params.items, params.data);
+ },
+ remove: function remove(event, params) {
+ _this.remove(params.items);
+ }
+ };
+
+ this.options = {};
+ this.defaultOptions = {
+ borderWidth: 1,
+ borderWidthSelected: 2,
+ brokenImage: undefined,
+ color: {
+ border: '#2B7CE9',
+ background: '#97C2FC',
+ highlight: {
+ border: '#2B7CE9',
+ background: '#D2E5FF'
+ },
+ hover: {
+ border: '#2B7CE9',
+ background: '#D2E5FF'
+ }
+ },
+ fixed: {
+ x: false,
+ y: false
+ },
+ font: {
+ color: '#343434',
+ size: 14, // px
+ face: 'arial',
+ background: 'none',
+ strokeWidth: 0, // px
+ strokeColor: '#ffffff',
+ align: 'center',
+ vadjust: 0,
+ multi: false,
+ bold: {
+ mod: 'bold'
+ },
+ boldital: {
+ mod: 'bold italic'
+ },
+ ital: {
+ mod: 'italic'
+ },
+ mono: {
+ mod: '',
+ size: 15, // px
+ face: 'courier new',
+ vadjust: 2
+ }
+ },
+ group: undefined,
+ hidden: false,
+ icon: {
+ face: 'FontAwesome', //'FontAwesome',
+ code: undefined, //'\uf007',
+ size: 50, //50,
+ color: '#2B7CE9' //'#aa00ff'
+ },
+ image: undefined, // --> URL
+ label: undefined,
+ labelHighlightBold: true,
+ level: undefined,
+ margin: {
+ top: 5,
+ right: 5,
+ bottom: 5,
+ left: 5
+ },
+ mass: 1,
+ physics: true,
+ scaling: {
+ min: 10,
+ max: 30,
+ label: {
+ enabled: false,
+ min: 14,
+ max: 30,
+ maxVisible: 30,
+ drawThreshold: 5
+ },
+ customScalingFunction: function customScalingFunction(min, max, total, value) {
+ if (max === min) {
+ return 0.5;
+ } else {
+ var scale = 1 / (max - min);
+ return Math.max(0, (value - min) * scale);
+ }
+ }
+ },
+ shadow: {
+ enabled: false,
+ color: 'rgba(0,0,0,0.5)',
+ size: 10,
+ x: 5,
+ y: 5
+ },
+ shape: 'ellipse',
+ shapeProperties: {
+ borderDashes: false, // only for borders
+ borderRadius: 6, // only for box shape
+ interpolation: true, // only for image and circularImage shapes
+ useImageSize: false, // only for image and circularImage shapes
+ useBorderWithImage: false // only for image shape
+ },
+ size: 25,
+ title: undefined,
+ value: undefined,
+ x: undefined,
+ y: undefined
+ };
+ util.extend(this.options, this.defaultOptions);
+
+ this.bindEventListeners();
+ }
+
+ (0, _createClass3['default'])(NodesHandler, [{
+ key: 'bindEventListeners',
+ value: function bindEventListeners() {
+ var _this2 = this;
+
+ // refresh the nodes. Used when reverting from hierarchical layout
+ this.body.emitter.on('refreshNodes', this.refresh.bind(this));
+ this.body.emitter.on('refresh', this.refresh.bind(this));
+ this.body.emitter.on('destroy', function () {
+ util.forEach(_this2.nodesListeners, function (callback, event) {
+ if (_this2.body.data.nodes) _this2.body.data.nodes.off(event, callback);
+ });
+ delete _this2.body.functions.createNode;
+ delete _this2.nodesListeners.add;
+ delete _this2.nodesListeners.update;
+ delete _this2.nodesListeners.remove;
+ delete _this2.nodesListeners;
+ });
+ }
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ this.nodeOptions = options;
+ if (options !== undefined) {
+ _Node2['default'].parseOptions(this.options, options);
+
+ // update the shape in all nodes
+ if (options.shape !== undefined) {
+ for (var nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(nodeId)) {
+ this.body.nodes[nodeId].updateShape();
+ }
+ }
+ }
+
+ // update the font in all nodes
+ if (options.font !== undefined) {
+ _Label2['default'].parseOptions(this.options.font, options);
+ for (var _nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(_nodeId)) {
+ this.body.nodes[_nodeId].updateLabelModule();
+ this.body.nodes[_nodeId]._reset();
+ }
+ }
+ }
+
+ // update the shape size in all nodes
+ if (options.size !== undefined) {
+ for (var _nodeId2 in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(_nodeId2)) {
+ this.body.nodes[_nodeId2]._reset();
+ }
+ }
+ }
+
+ // update the state of the letiables if needed
+ if (options.hidden !== undefined || options.physics !== undefined) {
+ this.body.emitter.emit('_dataChanged');
+ }
+ }
+ }
+
+ /**
+ * Set a data set with nodes for the network
+ * @param {Array | DataSet | DataView} nodes The data containing the nodes.
+ * @private
+ */
+
+ }, {
+ key: 'setData',
+ value: function setData(nodes) {
+ var _this3 = this;
+
+ var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ var oldNodesData = this.body.data.nodes;
+
+ if (nodes instanceof DataSet || nodes instanceof DataView) {
+ this.body.data.nodes = nodes;
+ } else if (Array.isArray(nodes)) {
+ this.body.data.nodes = new DataSet();
+ this.body.data.nodes.add(nodes);
+ } else if (!nodes) {
+ this.body.data.nodes = new DataSet();
+ } else {
+ throw new TypeError('Array or DataSet expected');
+ }
+
+ if (oldNodesData) {
+ // unsubscribe from old dataset
+ util.forEach(this.nodesListeners, function (callback, event) {
+ oldNodesData.off(event, callback);
+ });
+ }
+
+ // remove drawn nodes
+ this.body.nodes = {};
+
+ if (this.body.data.nodes) {
+ (function () {
+ // subscribe to new dataset
+ var me = _this3;
+ util.forEach(_this3.nodesListeners, function (callback, event) {
+ me.body.data.nodes.on(event, callback);
+ });
+
+ // draw all new nodes
+ var ids = _this3.body.data.nodes.getIds();
+ _this3.add(ids, true);
+ })();
+ }
+
+ if (doNotEmit === false) {
+ this.body.emitter.emit("_dataChanged");
+ }
+ }
+
+ /**
+ * Add nodes
+ * @param {Number[] | String[]} ids
+ * @private
+ */
+
+ }, {
+ key: 'add',
+ value: function add(ids) {
+ var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ var id = void 0;
+ var newNodes = [];
+ for (var i = 0; i < ids.length; i++) {
+ id = ids[i];
+ var properties = this.body.data.nodes.get(id);
+ var node = this.create(properties);
+ newNodes.push(node);
+ this.body.nodes[id] = node; // note: this may replace an existing node
+ }
+
+ this.layoutEngine.positionInitially(newNodes);
+
+ if (doNotEmit === false) {
+ this.body.emitter.emit("_dataChanged");
+ }
+ }
+
+ /**
+ * Update existing nodes, or create them when not yet existing
+ * @param {Number[] | String[]} ids
+ * @private
+ */
+
+ }, {
+ key: 'update',
+ value: function update(ids, changedData) {
+ var nodes = this.body.nodes;
+ var dataChanged = false;
+ for (var i = 0; i < ids.length; i++) {
+ var id = ids[i];
+ var node = nodes[id];
+ var data = changedData[i];
+ if (node !== undefined) {
+ // update node
+ dataChanged = node.setOptions(data);
+ } else {
+ dataChanged = true;
+ // create node
+ node = this.create(data);
+ nodes[id] = node;
+ }
+ }
+ if (dataChanged === true) {
+ this.body.emitter.emit("_dataChanged");
+ } else {
+ this.body.emitter.emit("_dataUpdated");
+ }
+ }
+
+ /**
+ * Remove existing nodes. If nodes do not exist, the method will just ignore it.
+ * @param {Number[] | String[]} ids
+ * @private
+ */
+
+ }, {
+ key: 'remove',
+ value: function remove(ids) {
+ var nodes = this.body.nodes;
+
+ for (var i = 0; i < ids.length; i++) {
+ var id = ids[i];
+ delete nodes[id];
+ }
+
+ this.body.emitter.emit("_dataChanged");
+ }
+
+ /**
+ * create a node
+ * @param properties
+ * @param constructorClass
+ */
+
+ }, {
+ key: 'create',
+ value: function create(properties) {
+ var constructorClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _Node2['default'];
+
+ return new constructorClass(properties, this.body, this.images, this.groups, this.options, this.defaultOptions, this.nodeOptions);
+ }
+ }, {
+ key: 'refresh',
+ value: function refresh() {
+ var clearPositions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ var nodes = this.body.nodes;
+ for (var nodeId in nodes) {
+ var node = undefined;
+ if (nodes.hasOwnProperty(nodeId)) {
+ node = nodes[nodeId];
+ }
+ var data = this.body.data.nodes._data[nodeId];
+ if (node !== undefined && data !== undefined) {
+ if (clearPositions === true) {
+ node.setOptions({ x: null, y: null });
+ }
+ node.setOptions({ fixed: false });
+ node.setOptions(data);
+ }
+ }
+ }
+
+ /**
+ * Returns the positions of the nodes.
+ * @param ids --> optional, can be array of nodeIds, can be string
+ * @returns {{}}
+ */
+
+ }, {
+ key: 'getPositions',
+ value: function getPositions(ids) {
+ var dataArray = {};
+ if (ids !== undefined) {
+ if (Array.isArray(ids) === true) {
+ for (var i = 0; i < ids.length; i++) {
+ if (this.body.nodes[ids[i]] !== undefined) {
+ var node = this.body.nodes[ids[i]];
+ dataArray[ids[i]] = { x: Math.round(node.x), y: Math.round(node.y) };
+ }
+ }
+ } else {
+ if (this.body.nodes[ids] !== undefined) {
+ var _node = this.body.nodes[ids];
+ dataArray[ids] = { x: Math.round(_node.x), y: Math.round(_node.y) };
+ }
+ }
+ } else {
+ for (var _i = 0; _i < this.body.nodeIndices.length; _i++) {
+ var _node2 = this.body.nodes[this.body.nodeIndices[_i]];
+ dataArray[this.body.nodeIndices[_i]] = { x: Math.round(_node2.x), y: Math.round(_node2.y) };
+ }
+ }
+ return dataArray;
+ }
+
+ /**
+ * Load the XY positions of the nodes into the dataset.
+ */
+
+ }, {
+ key: 'storePositions',
+ value: function storePositions() {
+ // todo: add support for clusters and hierarchical.
+ var dataArray = [];
+ var dataset = this.body.data.nodes.getDataSet();
+
+ for (var nodeId in dataset._data) {
+ if (dataset._data.hasOwnProperty(nodeId)) {
+ var node = this.body.nodes[nodeId];
+ if (dataset._data[nodeId].x != Math.round(node.x) || dataset._data[nodeId].y != Math.round(node.y)) {
+ dataArray.push({ id: node.id, x: Math.round(node.x), y: Math.round(node.y) });
+ }
+ }
+ }
+ dataset.update(dataArray);
+ }
+
+ /**
+ * get the bounding box of a node.
+ * @param nodeId
+ * @returns {j|*}
+ */
+
+ }, {
+ key: 'getBoundingBox',
+ value: function getBoundingBox(nodeId) {
+ if (this.body.nodes[nodeId] !== undefined) {
+ return this.body.nodes[nodeId].shape.boundingBox;
+ }
+ }
+
+ /**
+ * Get the Ids of nodes connected to this node.
+ * @param nodeId
+ * @returns {Array}
+ */
+
+ }, {
+ key: 'getConnectedNodes',
+ value: function getConnectedNodes(nodeId) {
+ var nodeList = [];
+ if (this.body.nodes[nodeId] !== undefined) {
+ var node = this.body.nodes[nodeId];
+ var nodeObj = {}; // used to quickly check if node already exists
+ for (var i = 0; i < node.edges.length; i++) {
+ var edge = node.edges[i];
+ if (edge.toId == node.id) {
+ // these are double equals since ids can be numeric or string
+ if (nodeObj[edge.fromId] === undefined) {
+ nodeList.push(edge.fromId);
+ nodeObj[edge.fromId] = true;
+ }
+ } else if (edge.fromId == node.id) {
+ // these are double equals since ids can be numeric or string
+ if (nodeObj[edge.toId] === undefined) {
+ nodeList.push(edge.toId);
+ nodeObj[edge.toId] = true;
+ }
+ }
+ }
+ }
+ return nodeList;
+ }
+
+ /**
+ * Get the ids of the edges connected to this node.
+ * @param nodeId
+ * @returns {*}
+ */
+
+ }, {
+ key: 'getConnectedEdges',
+ value: function getConnectedEdges(nodeId) {
+ var edgeList = [];
+ if (this.body.nodes[nodeId] !== undefined) {
+ var node = this.body.nodes[nodeId];
+ for (var i = 0; i < node.edges.length; i++) {
+ edgeList.push(node.edges[i].id);
+ }
+ } else {
+ console.log("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId);
+ }
+ return edgeList;
+ }
+
+ /**
+ * Move a node.
+ * @param String nodeId
+ * @param Number x
+ * @param Number y
+ */
+
+ }, {
+ key: 'moveNode',
+ value: function moveNode(nodeId, x, y) {
+ var _this4 = this;
+
+ if (this.body.nodes[nodeId] !== undefined) {
+ this.body.nodes[nodeId].x = Number(x);
+ this.body.nodes[nodeId].y = Number(y);
+ setTimeout(function () {
+ _this4.body.emitter.emit("startSimulation");
+ }, 0);
+ } else {
+ console.log("Node id supplied to moveNode does not exist. Provided: ", nodeId);
+ }
+ }
+ }]);
+ return NodesHandler;
+ }();
+
+ exports['default'] = NodesHandler;
+
+/***/ },
+/* 159 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _Label = __webpack_require__(160);
+
+ var _Label2 = _interopRequireDefault(_Label);
+
+ var _Box = __webpack_require__(165);
+
+ var _Box2 = _interopRequireDefault(_Box);
+
+ var _Circle = __webpack_require__(176);
+
+ var _Circle2 = _interopRequireDefault(_Circle);
+
+ var _CircularImage = __webpack_require__(178);
+
+ var _CircularImage2 = _interopRequireDefault(_CircularImage);
+
+ var _Database = __webpack_require__(179);
+
+ var _Database2 = _interopRequireDefault(_Database);
+
+ var _Diamond = __webpack_require__(180);
+
+ var _Diamond2 = _interopRequireDefault(_Diamond);
+
+ var _Dot = __webpack_require__(182);
+
+ var _Dot2 = _interopRequireDefault(_Dot);
+
+ var _Ellipse = __webpack_require__(183);
+
+ var _Ellipse2 = _interopRequireDefault(_Ellipse);
+
+ var _Icon = __webpack_require__(184);
+
+ var _Icon2 = _interopRequireDefault(_Icon);
+
+ var _Image = __webpack_require__(185);
+
+ var _Image2 = _interopRequireDefault(_Image);
+
+ var _Square = __webpack_require__(186);
+
+ var _Square2 = _interopRequireDefault(_Square);
+
+ var _Star = __webpack_require__(187);
+
+ var _Star2 = _interopRequireDefault(_Star);
+
+ var _Text = __webpack_require__(188);
+
+ var _Text2 = _interopRequireDefault(_Text);
+
+ var _Triangle = __webpack_require__(189);
+
+ var _Triangle2 = _interopRequireDefault(_Triangle);
+
+ var _TriangleDown = __webpack_require__(190);
+
+ var _TriangleDown2 = _interopRequireDefault(_TriangleDown);
+
+ var _Validator = __webpack_require__(122);
+
+ var _Validator2 = _interopRequireDefault(_Validator);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ /**
+ * @class Node
+ * A node. A node can be connected to other nodes via one or multiple edges.
+ * @param {object} options An object containing options for the node. All
+ * options are optional, except for the id.
+ * {number} id Id of the node. Required
+ * {string} label Text label for the node
+ * {number} x Horizontal position of the node
+ * {number} y Vertical position of the node
+ * {string} shape Node shape, available:
+ * "database", "circle", "ellipse",
+ * "box", "image", "text", "dot",
+ * "star", "triangle", "triangleDown",
+ * "square", "icon"
+ * {string} image An image url
+ * {string} title An title text, can be HTML
+ * {anytype} group A group name or number
+ * @param {Network.Images} imagelist A list with images. Only needed
+ * when the node has an image
+ * @param {Network.Groups} grouplist A list with groups. Needed for
+ * retrieving group options
+ * @param {Object} constants An object with default values for
+ * example for the color
+ *
+ */
+ var Node = function () {
+ function Node(options, body, imagelist, grouplist, globalOptions, defaultOptions, nodeOptions) {
+ (0, _classCallCheck3['default'])(this, Node);
+
+ this.options = util.bridgeObject(globalOptions);
+ this.globalOptions = globalOptions;
+ this.defaultOptions = defaultOptions;
+ this.nodeOptions = nodeOptions;
+ this.body = body;
+
+ this.edges = []; // all edges connected to this node
+
+ // set defaults for the options
+ this.id = undefined;
+ this.imagelist = imagelist;
+ this.grouplist = grouplist;
+
+ // state options
+ this.x = undefined;
+ this.y = undefined;
+ this.baseSize = this.options.size;
+ this.baseFontSize = this.options.font.size;
+ this.predefinedPosition = false; // used to check if initial fit should just take the range or approximate
+ this.selected = false;
+ this.hover = false;
+
+ this.labelModule = new _Label2['default'](this.body, this.options, false /* Not edge label */);
+ this.setOptions(options);
+ }
+
+ /**
+ * Attach a edge to the node
+ * @param {Edge} edge
+ */
+
+
+ (0, _createClass3['default'])(Node, [{
+ key: 'attachEdge',
+ value: function attachEdge(edge) {
+ if (this.edges.indexOf(edge) === -1) {
+ this.edges.push(edge);
+ }
+ }
+
+ /**
+ * Detach a edge from the node
+ * @param {Edge} edge
+ */
+
+ }, {
+ key: 'detachEdge',
+ value: function detachEdge(edge) {
+ var index = this.edges.indexOf(edge);
+ if (index != -1) {
+ this.edges.splice(index, 1);
+ }
+ }
+
+ /**
+ * Set or overwrite options for the node
+ * @param {Object} options an object with options
+ * @param {Object} constants and object with default, global options
+ */
+
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ var currentShape = this.options.shape;
+ if (!options) {
+ return;
+ }
+ // basic options
+ if (options.id !== undefined) {
+ this.id = options.id;
+ }
+
+ if (this.id === undefined) {
+ throw "Node must have an id";
+ }
+
+ // set these options locally
+ // clear x and y positions
+ if (options.x !== undefined) {
+ if (options.x === null) {
+ this.x = undefined;this.predefinedPosition = false;
+ } else {
+ this.x = parseInt(options.x);this.predefinedPosition = true;
+ }
+ }
+ if (options.y !== undefined) {
+ if (options.y === null) {
+ this.y = undefined;this.predefinedPosition = false;
+ } else {
+ this.y = parseInt(options.y);this.predefinedPosition = true;
+ }
+ }
+ if (options.size !== undefined) {
+ this.baseSize = options.size;
+ }
+ if (options.value !== undefined) {
+ options.value = parseFloat(options.value);
+ }
+
+ // copy group options
+ if (typeof options.group === 'number' || typeof options.group === 'string' && options.group != '') {
+ var groupObj = this.grouplist.get(options.group);
+ util.deepExtend(this.options, groupObj);
+ // the color object needs to be completely defined. Since groups can partially overwrite the colors, we parse it again, just in case.
+ this.options.color = util.parseColor(this.options.color);
+ }
+
+ // this transforms all shorthands into fully defined options
+ Node.parseOptions(this.options, options, true, this.globalOptions);
+
+ this.choosify(options);
+
+ // load the images
+ if (this.options.image !== undefined) {
+ if (this.imagelist) {
+ this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id);
+ } else {
+ throw "No imagelist provided";
+ }
+ }
+
+ this.updateLabelModule(options);
+ this.updateShape(currentShape);
+ this.labelModule.propagateFonts(this.nodeOptions, options, this.defaultOptions);
+
+ if (options.hidden !== undefined || options.physics !== undefined) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined.
+ * Static so it can also be used by the handler.
+ * @param parentOptions
+ * @param newOptions
+ * @param allowDeletion
+ * @param globalOptions
+ */
+
+ }, {
+ key: 'choosify',
+ value: function choosify(options) {
+ this.chooser = true;
+
+ var pile = [options, this.options, this.defaultOptions];
+
+ var chosen = util.topMost(pile, 'chosen');
+ if (typeof chosen === 'boolean') {
+ this.chooser = chosen;
+ } else if ((typeof chosen === 'undefined' ? 'undefined' : (0, _typeof3['default'])(chosen)) === 'object') {
+ var chosenNode = util.topMost(pile, ['chosen', 'node']);
+ if (typeof chosenNode === 'boolean' || typeof chosenNode === 'function') {
+ this.chooser = chosenNode;
+ }
+ }
+ }
+ }, {
+ key: 'getFormattingValues',
+ value: function getFormattingValues() {
+ var values = {
+ color: this.options.color.background,
+ borderWidth: this.options.borderWidth,
+ borderColor: this.options.color.border,
+ size: this.options.size,
+ borderDashes: this.options.shapeProperties.borderDashes,
+ borderRadius: this.options.shapeProperties.borderRadius,
+ shadow: this.options.shadow.enabled,
+ shadowColor: this.options.shadow.color,
+ shadowSize: this.options.shadow.size,
+ shadowX: this.options.shadow.x,
+ shadowY: this.options.shadow.y
+ };
+ if (this.selected || this.hover) {
+ if (this.chooser === true) {
+ if (this.selected) {
+ values.borderWidth *= 2;
+ values.color = this.options.color.highlight.background;
+ values.borderColor = this.options.color.highlight.border;
+ values.shadow = this.options.shadow.enabled;
+ } else if (this.hover) {
+ values.color = this.options.color.hover.background;
+ values.borderColor = this.options.color.hover.border;
+ values.shadow = this.options.shadow.enabled;
+ }
+ } else if (typeof this.chooser === 'function') {
+ this.chooser(values, this.options.id, this.selected, this.hover);
+ if (values.shadow === false) {
+ if (values.shadowColor !== this.options.shadow.color || values.shadowSize !== this.options.shadow.size || values.shadowX !== this.options.shadow.x || values.shadowY !== this.options.shadow.y) {
+ values.shadow = true;
+ }
+ }
+ }
+ } else {
+ values.shadow = this.options.shadow.enabled;
+ }
+ return values;
+ }
+ }, {
+ key: 'updateLabelModule',
+ value: function updateLabelModule(options) {
+ if (this.options.label === undefined || this.options.label === null) {
+ this.options.label = '';
+ }
+ this.labelModule.setOptions(this.options, true);
+ if (this.labelModule.baseSize !== undefined) {
+ this.baseFontSize = this.labelModule.baseSize;
+ }
+ this.labelModule.constrain(this.nodeOptions, options, this.defaultOptions);
+ this.labelModule.choosify(this.nodeOptions, options, this.defaultOptions);
+ }
+ }, {
+ key: 'updateShape',
+ value: function updateShape(currentShape) {
+ if (currentShape === this.options.shape && this.shape) {
+ this.shape.setOptions(this.options, this.imageObj);
+ } else {
+ // choose draw method depending on the shape
+ switch (this.options.shape) {
+ case 'box':
+ this.shape = new _Box2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'circle':
+ this.shape = new _Circle2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'circularImage':
+ this.shape = new _CircularImage2['default'](this.options, this.body, this.labelModule, this.imageObj);
+ break;
+ case 'database':
+ this.shape = new _Database2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'diamond':
+ this.shape = new _Diamond2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'dot':
+ this.shape = new _Dot2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'ellipse':
+ this.shape = new _Ellipse2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'icon':
+ this.shape = new _Icon2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'image':
+ this.shape = new _Image2['default'](this.options, this.body, this.labelModule, this.imageObj);
+ break;
+ case 'square':
+ this.shape = new _Square2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'star':
+ this.shape = new _Star2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'text':
+ this.shape = new _Text2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'triangle':
+ this.shape = new _Triangle2['default'](this.options, this.body, this.labelModule);
+ break;
+ case 'triangleDown':
+ this.shape = new _TriangleDown2['default'](this.options, this.body, this.labelModule);
+ break;
+ default:
+ this.shape = new _Ellipse2['default'](this.options, this.body, this.labelModule);
+ break;
+ }
+ }
+ this._reset();
+ }
+
+ /**
+ * select this node
+ */
+
+ }, {
+ key: 'select',
+ value: function select() {
+ this.selected = true;
+ this._reset();
+ }
+
+ /**
+ * unselect this node
+ */
+
+ }, {
+ key: 'unselect',
+ value: function unselect() {
+ this.selected = false;
+ this._reset();
+ }
+
+ /**
+ * Reset the calculated size of the node, forces it to recalculate its size
+ * @private
+ */
+
+ }, {
+ key: '_reset',
+ value: function _reset() {
+ this.shape.width = undefined;
+ this.shape.height = undefined;
+ }
+
+ /**
+ * get the title of this node.
+ * @return {string} title The title of the node, or undefined when no title
+ * has been set.
+ */
+
+ }, {
+ key: 'getTitle',
+ value: function getTitle() {
+ return this.options.title;
+ }
+
+ /**
+ * Calculate the distance to the border of the Node
+ * @param {CanvasRenderingContext2D} ctx
+ * @param {Number} angle Angle in radians
+ * @returns {number} distance Distance to the border in pixels
+ */
+
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this.shape.distanceToBorder(ctx, angle);
+ }
+
+ /**
+ * Check if this node has a fixed x and y position
+ * @return {boolean} true if fixed, false if not
+ */
+
+ }, {
+ key: 'isFixed',
+ value: function isFixed() {
+ return this.options.fixed.x && this.options.fixed.y;
+ }
+
+ /**
+ * check if this node is selecte
+ * @return {boolean} selected True if node is selected, else false
+ */
+
+ }, {
+ key: 'isSelected',
+ value: function isSelected() {
+ return this.selected;
+ }
+
+ /**
+ * Retrieve the value of the node. Can be undefined
+ * @return {Number} value
+ */
+
+ }, {
+ key: 'getValue',
+ value: function getValue() {
+ return this.options.value;
+ }
+
+ /**
+ * Adjust the value range of the node. The node will adjust it's size
+ * based on its value.
+ * @param {Number} min
+ * @param {Number} max
+ */
+
+ }, {
+ key: 'setValueRange',
+ value: function setValueRange(min, max, total) {
+ if (this.options.value !== undefined) {
+ var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value);
+ var sizeDiff = this.options.scaling.max - this.options.scaling.min;
+ if (this.options.scaling.label.enabled === true) {
+ var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min;
+ this.options.font.size = this.options.scaling.label.min + scale * fontDiff;
+ }
+ this.options.size = this.options.scaling.min + scale * sizeDiff;
+ } else {
+ this.options.size = this.baseSize;
+ this.options.font.size = this.baseFontSize;
+ }
+
+ this.updateLabelModule();
+ }
+
+ /**
+ * Draw this node in the given canvas
+ * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
+ * @param {CanvasRenderingContext2D} ctx
+ */
+
+ }, {
+ key: 'draw',
+ value: function draw(ctx) {
+ var values = this.getFormattingValues();
+ this.shape.draw(ctx, this.x, this.y, this.selected, this.hover, values);
+ }
+
+ /**
+ * Update the bounding box of the shape
+ */
+
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(ctx) {
+ this.shape.updateBoundingBox(this.x, this.y, ctx);
+ }
+
+ /**
+ * Recalculate the size of this node in the given canvas
+ * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
+ * @param {CanvasRenderingContext2D} ctx
+ */
+
+ }, {
+ key: 'resize',
+ value: function resize(ctx) {
+ var values = this.getFormattingValues();
+ this.shape.resize(ctx, this.selected, this.hover, values);
+ }
+
+ /**
+ * Check if this object is overlapping with the provided object
+ * @param {Object} obj an object with parameters left, top, right, bottom
+ * @return {boolean} True if location is located on node
+ */
+
+ }, {
+ key: 'isOverlappingWith',
+ value: function isOverlappingWith(obj) {
+ return this.shape.left < obj.right && this.shape.left + this.shape.width > obj.left && this.shape.top < obj.bottom && this.shape.top + this.shape.height > obj.top;
+ }
+
+ /**
+ * Check if this object is overlapping with the provided object
+ * @param {Object} obj an object with parameters left, top, right, bottom
+ * @return {boolean} True if location is located on node
+ */
+
+ }, {
+ key: 'isBoundingBoxOverlappingWith',
+ value: function isBoundingBoxOverlappingWith(obj) {
+ return this.shape.boundingBox.left < obj.right && this.shape.boundingBox.right > obj.left && this.shape.boundingBox.top < obj.bottom && this.shape.boundingBox.bottom > obj.top;
+ }
+ }], [{
+ key: 'parseOptions',
+ value: function parseOptions(parentOptions, newOptions) {
+ var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ var fields = ['color', 'font', 'fixed', 'shadow'];
+ util.selectiveNotDeepExtend(fields, parentOptions, newOptions, allowDeletion);
+
+ // merge the shadow options into the parent.
+ util.mergeOptions(parentOptions, newOptions, 'shadow', allowDeletion, globalOptions);
+
+ // individual shape newOptions
+ if (newOptions.color !== undefined && newOptions.color !== null) {
+ var parsedColor = util.parseColor(newOptions.color);
+ util.fillIfDefined(parentOptions.color, parsedColor);
+ } else if (allowDeletion === true && newOptions.color === null) {
+ parentOptions.color = util.bridgeObject(globalOptions.color); // set the object back to the global options
+ }
+
+ // handle the fixed options
+ if (newOptions.fixed !== undefined && newOptions.fixed !== null) {
+ if (typeof newOptions.fixed === 'boolean') {
+ parentOptions.fixed.x = newOptions.fixed;
+ parentOptions.fixed.y = newOptions.fixed;
+ } else {
+ if (newOptions.fixed.x !== undefined && typeof newOptions.fixed.x === 'boolean') {
+ parentOptions.fixed.x = newOptions.fixed.x;
+ }
+ if (newOptions.fixed.y !== undefined && typeof newOptions.fixed.y === 'boolean') {
+ parentOptions.fixed.y = newOptions.fixed.y;
+ }
+ }
+ }
+
+ // handle the font options
+ if (newOptions.font !== undefined && newOptions.font !== null) {
+ _Label2['default'].parseOptions(parentOptions.font, newOptions);
+ } else if (allowDeletion === true && newOptions.font === null) {
+ parentOptions.font = util.bridgeObject(globalOptions.font); // set the object back to the global options
+ }
+
+ // handle the scaling options, specifically the label part
+ if (newOptions.scaling !== undefined) {
+ util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', allowDeletion, globalOptions.scaling);
+ }
+ }
+ }]);
+ return Node;
+ }();
+
+ exports['default'] = Node;
+
+/***/ },
+/* 160 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _slicedToArray2 = __webpack_require__(161);
+
+ var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
+
+ var _getIterator2 = __webpack_require__(2);
+
+ var _getIterator3 = _interopRequireDefault(_getIterator2);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var Label = function () {
+ function Label(body, options) {
+ var edgelabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ (0, _classCallCheck3['default'])(this, Label);
+
+ this.body = body;
+
+ this.pointToSelf = false;
+ this.baseSize = undefined;
+ this.fontOptions = {};
+ this.setOptions(options);
+ this.size = { top: 0, left: 0, width: 0, height: 0, yLine: 0 }; // could be cached
+ this.isEdgeLabel = edgelabel;
+ }
+
+ (0, _createClass3['default'])(Label, [{
+ key: 'setOptions',
+ value: function setOptions(options) {
+ var allowDeletion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ this.elementOptions = options;
+
+ // We want to keep the font options seperated from the node options.
+ // The node options have to mirror the globals when they are not overruled.
+ this.fontOptions = util.deepExtend({}, options.font, true);
+
+ if (options.label !== undefined) {
+ this.labelDirty = true;
+ }
+
+ if (options.font !== undefined) {
+ Label.parseOptions(this.fontOptions, options, allowDeletion);
+ if (typeof options.font === 'string') {
+ this.baseSize = this.fontOptions.size;
+ } else if ((0, _typeof3['default'])(options.font) === 'object') {
+ if (options.font.size !== undefined) {
+ this.baseSize = options.font.size;
+ }
+ }
+ }
+ }
+ }, {
+ key: 'constrain',
+
+
+ // set the width and height constraints based on 'nearest' value
+ value: function constrain(elementOptions, options, defaultOptions) {
+ this.fontOptions.constrainWidth = false;
+ this.fontOptions.maxWdt = -1;
+ this.fontOptions.minWdt = -1;
+
+ var pile = [options, elementOptions, defaultOptions];
+
+ var widthConstraint = util.topMost(pile, 'widthConstraint');
+ if (typeof widthConstraint === 'number') {
+ this.fontOptions.maxWdt = Number(widthConstraint);
+ this.fontOptions.minWdt = Number(widthConstraint);
+ } else if ((typeof widthConstraint === 'undefined' ? 'undefined' : (0, _typeof3['default'])(widthConstraint)) === 'object') {
+ var widthConstraintMaximum = util.topMost(pile, ['widthConstraint', 'maximum']);
+ if (typeof widthConstraintMaximum === 'number') {
+ this.fontOptions.maxWdt = Number(widthConstraintMaximum);
+ }
+ var widthConstraintMinimum = util.topMost(pile, ['widthConstraint', 'minimum']);
+ if (typeof widthConstraintMinimum === 'number') {
+ this.fontOptions.minWdt = Number(widthConstraintMinimum);
+ }
+ }
+
+ this.fontOptions.constrainHeight = false;
+ this.fontOptions.minHgt = -1;
+ this.fontOptions.valign = 'middle';
+
+ var heightConstraint = util.topMost(pile, 'heightConstraint');
+ if (typeof heightConstraint === 'number') {
+ this.fontOptions.minHgt = Number(heightConstraint);
+ } else if ((typeof heightConstraint === 'undefined' ? 'undefined' : (0, _typeof3['default'])(heightConstraint)) === 'object') {
+ var heightConstraintMinimum = util.topMost(pile, ['heightConstraint', 'minimum']);
+ if (typeof heightConstraintMinimum === 'number') {
+ this.fontOptions.minHgt = Number(heightConstraintMinimum);
+ }
+ var heightConstraintValign = util.topMost(pile, ['heightConstraint', 'valign']);
+ if (typeof heightConstraintValign === 'string') {
+ if (heightConstraintValign === 'top' || heightConstraintValign === 'bottom') {
+ this.fontOptions.valign = heightConstraintValign;
+ }
+ }
+ }
+ }
+
+ // set the selected functions based on 'nearest' value
+
+ }, {
+ key: 'choosify',
+ value: function choosify(elementOptions, options, defaultOptions) {
+ this.fontOptions.chooser = true;
+
+ var pile = [options, elementOptions, defaultOptions];
+
+ var chosen = util.topMost(pile, 'chosen');
+ if (typeof chosen === 'boolean') {
+ this.fontOptions.chooser = chosen;
+ } else if ((typeof chosen === 'undefined' ? 'undefined' : (0, _typeof3['default'])(chosen)) === 'object') {
+ var chosenLabel = util.topMost(pile, ['chosen', 'label']);
+ if (typeof chosenLabel === 'boolean' || typeof chosenLabel === 'function') {
+ this.fontOptions.chooser = chosenLabel;
+ }
+ }
+ }
+
+ // When margins are set in an element, adjust sizes is called to remove them
+ // from the width/height constraints. This must be done prior to label sizing.
+
+ }, {
+ key: 'adjustSizes',
+ value: function adjustSizes(margins) {
+ var widthBias = margins ? margins.right + margins.left : 0;
+ if (this.fontOptions.constrainWidth) {
+ this.fontOptions.maxWdt -= widthBias;
+ this.fontOptions.minWdt -= widthBias;
+ }
+ var heightBias = margins ? margins.top + margins.bottom : 0;
+ if (this.fontOptions.constrainHeight) {
+ this.fontOptions.minHgt -= heightBias;
+ }
+ }
+ }, {
+ key: 'propagateFonts',
+ value: function propagateFonts(options, groupOptions, defaultOptions) {
+ if (this.fontOptions.multi) {
+ var mods = ['bold', 'ital', 'boldital', 'mono'];
+ var _iteratorNormalCompletion = true;
+ var _didIteratorError = false;
+ var _iteratorError = undefined;
+
+ try {
+ for (var _iterator = (0, _getIterator3['default'])(mods), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
+ var mod = _step.value;
+
+ var optionsFontMod = void 0;
+ if (options.font) {
+ optionsFontMod = options.font[mod];
+ }
+ if (typeof optionsFontMod === 'string') {
+ var modOptionsArray = optionsFontMod.split(" ");
+ this.fontOptions[mod].size = modOptionsArray[0].replace("px", "");
+ this.fontOptions[mod].face = modOptionsArray[1];
+ this.fontOptions[mod].color = modOptionsArray[2];
+ this.fontOptions[mod].vadjust = this.fontOptions.vadjust;
+ this.fontOptions[mod].mod = defaultOptions.font[mod].mod;
+ } else {
+ // We need to be crafty about loading the modded fonts. We want as
+ // much 'natural' versatility as we can get, so a simple global
+ // change propagates in an expected way, even if not stictly logical.
+
+ // face: We want to capture any direct settings and overrides, but
+ // fall back to the base font if there aren't any. We make a
+ // special exception for mono, since we probably don't want to
+ // sync to a the base font face.
+ //
+ // if the mod face is in the node's options, use it
+ // else if the mod face is in the global options, use it
+ // else if the face is in the global options, use it
+ // else use the base font's face.
+ if (optionsFontMod && optionsFontMod.hasOwnProperty('face')) {
+ this.fontOptions[mod].face = optionsFontMod.face;
+ } else if (groupOptions.font && groupOptions.font[mod] && groupOptions.font[mod].hasOwnProperty('face')) {
+ this.fontOptions[mod].face = groupOptions.font[mod].face;
+ } else if (mod === 'mono') {
+ this.fontOptions[mod].face = defaultOptions.font[mod].face;
+ } else if (groupOptions.font && groupOptions.font.hasOwnProperty('face')) {
+ this.fontOptions[mod].face = groupOptions.font.face;
+ } else {
+ this.fontOptions[mod].face = this.fontOptions.face;
+ }
+
+ // color: this is handled just like the face.
+ if (optionsFontMod && optionsFontMod.hasOwnProperty('color')) {
+ this.fontOptions[mod].color = optionsFontMod.color;
+ } else if (groupOptions.font && groupOptions.font[mod] && groupOptions.font[mod].hasOwnProperty('color')) {
+ this.fontOptions[mod].color = groupOptions.font[mod].color;
+ } else if (groupOptions.font && groupOptions.font.hasOwnProperty('color')) {
+ this.fontOptions[mod].color = groupOptions.font.color;
+ } else {
+ this.fontOptions[mod].color = this.fontOptions.color;
+ }
+
+ // mod: this is handled just like the face, except we never grab the
+ // base font's mod. We know they're in the defaultOptions, and unless
+ // we've been steered away from them, we use the default.
+ if (optionsFontMod && optionsFontMod.hasOwnProperty('mod')) {
+ this.fontOptions[mod].mod = optionsFontMod.mod;
+ } else if (groupOptions.font && groupOptions.font[mod] && groupOptions.font[mod].hasOwnProperty('mod')) {
+ this.fontOptions[mod].mod = groupOptions.font[mod].mod;
+ } else if (groupOptions.font && groupOptions.font.hasOwnProperty('mod')) {
+ this.fontOptions[mod].mod = groupOptions.font.mod;
+ } else {
+ this.fontOptions[mod].mod = defaultOptions.font[mod].mod;
+ }
+
+ // size: It's important that we size up defaults similarly if we're
+ // using default faces unless overriden. We want to preserve the
+ // ratios closely - but if faces have changed, all bets are off.
+ //
+ // if the mod size is in the node's options, use it
+ // else if the mod size is in the global options, use it
+ // else if the mod face is the same as the default and the base face
+ // is the same as the default, scale the mod size using the same
+ // ratio
+ // else if the size is in the global options, use it
+ // else use the base font's size.
+ if (optionsFontMod && optionsFontMod.hasOwnProperty('size')) {
+ this.fontOptions[mod].size = optionsFontMod.size;
+ } else if (groupOptions.font && groupOptions.font[mod] && groupOptions.font[mod].hasOwnProperty('size')) {
+ this.fontOptions[mod].size = groupOptions.font[mod].size;
+ } else if (this.fontOptions[mod].face === defaultOptions.font[mod].face && this.fontOptions.face === defaultOptions.font.face) {
+ var ratio = this.fontOptions.size / Number(defaultOptions.font.size);
+ this.fontOptions[mod].size = defaultOptions.font[mod].size * ratio;
+ } else if (groupOptions.font && groupOptions.font.hasOwnProperty('size')) {
+ this.fontOptions[mod].size = groupOptions.font.size;
+ } else {
+ this.fontOptions[mod].size = this.fontOptions.size;
+ }
+
+ // vadjust: this is handled just like the size.
+ if (optionsFontMod && optionsFontMod.hasOwnProperty('vadjust')) {
+ this.fontOptions[mod].vadjust = optionsFontMod.vadjust;
+ } else if (groupOptions.font && groupOptions.font[mod] && groupOptions.font[mod].hasOwnProperty('vadjust')) {
+ this.fontOptions[mod].vadjust = groupOptions.font[mod].vadjust;
+ } else if (this.fontOptions[mod].face === defaultOptions.font[mod].face && this.fontOptions.face === defaultOptions.font.face) {
+ var _ratio = this.fontOptions.size / Number(defaultOptions.font.size);
+ this.fontOptions[mod].vadjust = defaultOptions.font[mod].vadjust * Math.round(_ratio);
+ } else if (groupOptions.font && groupOptions.font.hasOwnProperty('vadjust')) {
+ this.fontOptions[mod].vadjust = groupOptions.font.vadjust;
+ } else {
+ this.fontOptions[mod].vadjust = this.fontOptions.vadjust;
+ }
+ }
+ this.fontOptions[mod].size = Number(this.fontOptions[mod].size);
+ this.fontOptions[mod].vadjust = Number(this.fontOptions[mod].vadjust);
+ }
+ } catch (err) {
+ _didIteratorError = true;
+ _iteratorError = err;
+ } finally {
+ try {
+ if (!_iteratorNormalCompletion && _iterator['return']) {
+ _iterator['return']();
+ }
+ } finally {
+ if (_didIteratorError) {
+ throw _iteratorError;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Main function. This is called from anything that wants to draw a label.
+ * @param ctx
+ * @param x
+ * @param y
+ * @param selected
+ * @param baseline
+ */
+
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover) {
+ var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle';
+
+ // if no label, return
+ if (this.elementOptions.label === undefined) return;
+
+ // check if we have to render the label
+ var viewFontSize = this.fontOptions.size * this.body.view.scale;
+ if (this.elementOptions.label && viewFontSize < this.elementOptions.scaling.label.drawThreshold - 1) return;
+
+ // update the size cache if required
+ this.calculateLabelSize(ctx, selected, hover, x, y, baseline);
+
+ // create the fontfill background
+ this._drawBackground(ctx);
+ // draw text
+ this._drawText(ctx, selected, hover, x, y, baseline);
+ }
+
+ /**
+ * Draws the label background
+ * @param {CanvasRenderingContext2D} ctx
+ * @private
+ */
+
+ }, {
+ key: '_drawBackground',
+ value: function _drawBackground(ctx) {
+ if (this.fontOptions.background !== undefined && this.fontOptions.background !== "none") {
+ ctx.fillStyle = this.fontOptions.background;
+
+ var lineMargin = 2;
+
+ if (this.isEdgeLabel) {
+ switch (this.fontOptions.align) {
+ case 'middle':
+ ctx.fillRect(-this.size.width * 0.5, -this.size.height * 0.5, this.size.width, this.size.height);
+ break;
+ case 'top':
+ ctx.fillRect(-this.size.width * 0.5, -(this.size.height + lineMargin), this.size.width, this.size.height);
+ break;
+ case 'bottom':
+ ctx.fillRect(-this.size.width * 0.5, lineMargin, this.size.width, this.size.height);
+ break;
+ default:
+ ctx.fillRect(this.size.left, this.size.top - 0.5 * lineMargin, this.size.width, this.size.height);
+ break;
+ }
+ } else {
+ ctx.fillRect(this.size.left, this.size.top - 0.5 * lineMargin, this.size.width, this.size.height);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param ctx
+ * @param x
+ * @param baseline
+ * @private
+ */
+
+ }, {
+ key: '_drawText',
+ value: function _drawText(ctx, selected, hover, x, y) {
+ var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle';
+
+ var fontSize = this.fontOptions.size;
+ var viewFontSize = fontSize * this.body.view.scale;
+ // this ensures that there will not be HUGE letters on screen by setting an upper limit on the visible text size (regardless of zoomLevel)
+ if (viewFontSize >= this.elementOptions.scaling.label.maxVisible) {
+ fontSize = Number(this.elementOptions.scaling.label.maxVisible) / this.body.view.scale;
+ }
+
+ var yLine = this.size.yLine;
+
+ var _setAlignment2 = this._setAlignment(ctx, x, yLine, baseline);
+
+ var _setAlignment3 = (0, _slicedToArray3['default'])(_setAlignment2, 2);
+
+ x = _setAlignment3[0];
+ yLine = _setAlignment3[1];
+
+
+ ctx.textAlign = 'left';
+ x = x - this.size.width / 2; // Shift label 1/2-distance to the left
+ if (this.fontOptions.valign && this.size.height > this.size.labelHeight) {
+ if (this.fontOptions.valign === 'top') {
+ yLine -= (this.size.height - this.size.labelHeight) / 2;
+ }
+ if (this.fontOptions.valign === 'bottom') {
+ yLine += (this.size.height - this.size.labelHeight) / 2;
+ }
+ }
+
+ // draw the text
+ for (var i = 0; i < this.lineCount; i++) {
+ if (this.lines[i] && this.lines[i].blocks) {
+ var width = 0;
+ if (this.isEdgeLabel || this.fontOptions.align === 'center') {
+ width += (this.size.width - this.lines[i].width) / 2;
+ } else if (this.fontOptions.align === 'right') {
+ width += this.size.width - this.lines[i].width;
+ }
+ for (var j = 0; j < this.lines[i].blocks.length; j++) {
+ var block = this.lines[i].blocks[j];
+ ctx.font = block.font;
+
+ var _getColor2 = this._getColor(block.color, viewFontSize, block.strokeColor),
+ _getColor3 = (0, _slicedToArray3['default'])(_getColor2, 2),
+ fontColor = _getColor3[0],
+ strokeColor = _getColor3[1];
+
+ if (block.strokeWidth > 0) {
+ ctx.lineWidth = block.strokeWidth;
+ ctx.strokeStyle = strokeColor;
+ ctx.lineJoin = 'round';
+ }
+ ctx.fillStyle = fontColor;
+
+ if (block.strokeWidth > 0) {
+ ctx.strokeText(block.text, x + width, yLine + block.vadjust);
+ }
+ ctx.fillText(block.text, x + width, yLine + block.vadjust);
+ width += block.width;
+ }
+ yLine += this.lines[i].height;
+ }
+ }
+ }
+ }, {
+ key: '_setAlignment',
+ value: function _setAlignment(ctx, x, yLine, baseline) {
+ // check for label alignment (for edges)
+ // TODO: make alignment for nodes
+ if (this.isEdgeLabel && this.fontOptions.align !== 'horizontal' && this.pointToSelf === false) {
+ x = 0;
+ yLine = 0;
+
+ var lineMargin = 2;
+ if (this.fontOptions.align === 'top') {
+ ctx.textBaseline = 'alphabetic';
+ yLine -= 2 * lineMargin; // distance from edge, required because we use alphabetic. Alphabetic has less difference between browsers
+ } else if (this.fontOptions.align === 'bottom') {
+ ctx.textBaseline = 'hanging';
+ yLine += 2 * lineMargin; // distance from edge, required because we use hanging. Hanging has less difference between browsers
+ } else {
+ ctx.textBaseline = 'middle';
+ }
+ } else {
+ ctx.textBaseline = baseline;
+ }
+ return [x, yLine];
+ }
+
+ /**
+ * fade in when relative scale is between threshold and threshold - 1.
+ * If the relative scale would be smaller than threshold -1 the draw function would have returned before coming here.
+ *
+ * @param viewFontSize
+ * @returns {*[]}
+ * @private
+ */
+
+ }, {
+ key: '_getColor',
+ value: function _getColor(color, viewFontSize, initialStrokeColor) {
+ var fontColor = color || '#000000';
+ var strokeColor = initialStrokeColor || '#ffffff';
+ if (viewFontSize <= this.elementOptions.scaling.label.drawThreshold) {
+ var opacity = Math.max(0, Math.min(1, 1 - (this.elementOptions.scaling.label.drawThreshold - viewFontSize)));
+ fontColor = util.overrideOpacity(fontColor, opacity);
+ strokeColor = util.overrideOpacity(strokeColor, opacity);
+ }
+ return [fontColor, strokeColor];
+ }
+
+ /**
+ *
+ * @param ctx
+ * @param selected
+ * @returns {{width: number, height: number}}
+ */
+
+ }, {
+ key: 'getTextSize',
+ value: function getTextSize(ctx) {
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ this._processLabel(ctx, selected, hover);
+ return {
+ width: this.size.width,
+ height: this.size.height,
+ lineCount: this.lineCount
+ };
+ }
+
+ /**
+ *
+ * @param ctx
+ * @param selected
+ * @param x
+ * @param y
+ * @param baseline
+ */
+
+ }, {
+ key: 'calculateLabelSize',
+ value: function calculateLabelSize(ctx, selected, hover) {
+ var x = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
+ var y = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
+ var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle';
+
+ if (this.labelDirty === true) {
+ this._processLabel(ctx, selected, hover);
+ }
+ this.size.left = x - this.size.width * 0.5;
+ this.size.top = y - this.size.height * 0.5;
+ this.size.yLine = y + (1 - this.lineCount) * 0.5 * this.fontOptions.size;
+ if (baseline === "hanging") {
+ this.size.top += 0.5 * this.fontOptions.size;
+ this.size.top += 4; // distance from node, required because we use hanging. Hanging has less difference between browsers
+ this.size.yLine += 4; // distance from node
+ }
+ this.labelDirty = false;
+ }
+
+ /**
+ * normalize the markup system
+ */
+
+ }, {
+ key: 'decodeMarkupSystem',
+ value: function decodeMarkupSystem(markupSystem) {
+ var system = 'none';
+ if (markupSystem === 'markdown' || markupSystem === 'md') {
+ system = 'markdown';
+ } else if (markupSystem === true || markupSystem === 'html') {
+ system = 'html';
+ }
+ return system;
+ }
+
+ /**
+ * Explodes a piece of text into single-font blocks using a given markup
+ * @param text
+ * @param markupSystem
+ * @returns [{ text, mod }]
+ */
+
+ }, {
+ key: 'splitBlocks',
+ value: function splitBlocks(text, markupSystem) {
+ var system = this.decodeMarkupSystem(markupSystem);
+ if (system === 'none') {
+ return [{
+ text: text,
+ mod: 'normal'
+ }];
+ } else if (system === 'markdown') {
+ return this.splitMarkdownBlocks(text);
+ } else if (system === 'html') {
+ return this.splitHtmlBlocks(text);
+ }
+ }
+ }, {
+ key: 'splitMarkdownBlocks',
+ value: function splitMarkdownBlocks(text) {
+ var blocks = [];
+ var s = {
+ bold: false,
+ ital: false,
+ mono: false,
+ beginable: true,
+ spacing: false,
+ position: 0,
+ buffer: "",
+ modStack: []
+ };
+ s.mod = function () {
+ return this.modStack.length === 0 ? 'normal' : this.modStack[0];
+ };
+ s.modName = function () {
+ if (this.modStack.length === 0) return 'normal';else if (this.modStack[0] === 'mono') return 'mono';else {
+ if (s.bold && s.ital) {
+ return 'boldital';
+ } else if (s.bold) {
+ return 'bold';
+ } else if (s.ital) {
+ return 'ital';
+ }
+ }
+ };
+ s.emitBlock = function () {
+ var override = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (this.spacing) {
+ this.add(" ");
+ this.spacing = false;
+ }
+ if (this.buffer.length > 0) {
+ blocks.push({ text: this.buffer, mod: this.modName() });
+ this.buffer = "";
+ }
+ };
+ s.add = function (text) {
+ if (text === " ") {
+ s.spacing = true;
+ }
+ if (s.spacing) {
+ this.buffer += " ";
+ this.spacing = false;
+ }
+ if (text != " ") {
+ this.buffer += text;
+ }
+ };
+ while (s.position < text.length) {
+ var ch = text.charAt(s.position);
+ if (/[ \t]/.test(ch)) {
+ if (!s.mono) {
+ s.spacing = true;
+ } else {
+ s.add(ch);
+ }
+ s.beginable = true;
+ } else if (/\\/.test(ch)) {
+ if (s.position < text.length + 1) {
+ s.position++;
+ ch = text.charAt(s.position);
+ if (/ \t/.test(ch)) {
+ s.spacing = true;
+ } else {
+ s.add(ch);
+ s.beginable = false;
+ }
+ }
+ } else if (!s.mono && !s.bold && (s.beginable || s.spacing) && /\*/.test(ch)) {
+ s.emitBlock();
+ s.bold = true;
+ s.modStack.unshift("bold");
+ } else if (!s.mono && !s.ital && (s.beginable || s.spacing) && /\_/.test(ch)) {
+ s.emitBlock();
+ s.ital = true;
+ s.modStack.unshift("ital");
+ } else if (!s.mono && (s.beginable || s.spacing) && /`/.test(ch)) {
+ s.emitBlock();
+ s.mono = true;
+ s.modStack.unshift("mono");
+ } else if (!s.mono && s.mod() === "bold" && /\*/.test(ch)) {
+ if (s.position === text.length - 1 || /[.,_` \t\n]/.test(text.charAt(s.position + 1))) {
+ s.emitBlock();
+ s.bold = false;
+ s.modStack.shift();
+ } else {
+ s.add(ch);
+ }
+ } else if (!s.mono && s.mod() === "ital" && /\_/.test(ch)) {
+ if (s.position === text.length - 1 || /[.,*` \t\n]/.test(text.charAt(s.position + 1))) {
+ s.emitBlock();
+ s.ital = false;
+ s.modStack.shift();
+ } else {
+ s.add(ch);
+ }
+ } else if (s.mono && s.mod() === "mono" && /`/.test(ch)) {
+ if (s.position === text.length - 1 || /[.,*_ \t\n]/.test(text.charAt(s.position + 1))) {
+ s.emitBlock();
+ s.mono = false;
+ s.modStack.shift();
+ } else {
+ s.add(ch);
+ }
+ } else {
+ s.add(ch);
+ s.beginable = false;
+ }
+ s.position++;
+ }
+ s.emitBlock();
+ return blocks;
+ }
+ }, {
+ key: 'splitHtmlBlocks',
+ value: function splitHtmlBlocks(text) {
+ var blocks = [];
+ var s = {
+ bold: false,
+ ital: false,
+ mono: false,
+ spacing: false,
+ position: 0,
+ buffer: "",
+ modStack: []
+ };
+ s.mod = function () {
+ return this.modStack.length === 0 ? 'normal' : this.modStack[0];
+ };
+ s.modName = function () {
+ if (this.modStack.length === 0) return 'normal';else if (this.modStack[0] === 'mono') return 'mono';else {
+ if (s.bold && s.ital) {
+ return 'boldital';
+ } else if (s.bold) {
+ return 'bold';
+ } else if (s.ital) {
+ return 'ital';
+ }
+ }
+ };
+ s.emitBlock = function () {
+ var override = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (this.spacing) {
+ this.add(" ");
+ this.spacing = false;
+ }
+ if (this.buffer.length > 0) {
+ blocks.push({ text: this.buffer, mod: this.modName() });
+ this.buffer = "";
+ }
+ };
+ s.add = function (text) {
+ if (text === " ") {
+ s.spacing = true;
+ }
+ if (s.spacing) {
+ this.buffer += " ";
+ this.spacing = false;
+ }
+ if (text != " ") {
+ this.buffer += text;
+ }
+ };
+ while (s.position < text.length) {
+ var ch = text.charAt(s.position);
+ if (/[ \t]/.test(ch)) {
+ if (!s.mono) {
+ s.spacing = true;
+ } else {
+ s.add(ch);
+ }
+ } else if (/</.test(ch)) {
+ if (!s.mono && !s.bold && /<b>/.test(text.substr(s.position, 3))) {
+ s.emitBlock();
+ s.bold = true;
+ s.modStack.unshift("bold");
+ s.position += 2;
+ } else if (!s.mono && !s.ital && /<i>/.test(text.substr(s.position, 3))) {
+ s.emitBlock();
+ s.ital = true;
+ s.modStack.unshift("ital");
+ s.position += 2;
+ } else if (!s.mono && /<code>/.test(text.substr(s.position, 6))) {
+ s.emitBlock();
+ s.mono = true;
+ s.modStack.unshift("mono");
+ s.position += 5;
+ } else if (!s.mono && s.mod() === 'bold' && /<\/b>/.test(text.substr(s.position, 4))) {
+ s.emitBlock();
+ s.bold = false;
+ s.modStack.shift();
+ s.position += 3;
+ } else if (!s.mono && s.mod() === 'ital' && /<\/i>/.test(text.substr(s.position, 4))) {
+ s.emitBlock();
+ s.ital = false;
+ s.modStack.shift();
+ s.position += 3;
+ } else if (s.mod() === 'mono' && /<\/code>/.test(text.substr(s.position, 7))) {
+ s.emitBlock();
+ s.mono = false;
+ s.modStack.shift();
+ s.position += 6;
+ } else {
+ s.add(ch);
+ }
+ } else if (/&/.test(ch)) {
+ if (/&lt;/.test(text.substr(s.position, 4))) {
+ s.add("<");
+ s.position += 3;
+ } else if (/&amp;/.test(text.substr(s.position, 5))) {
+ s.add("&");
+ s.position += 4;
+ } else {
+ s.add("&");
+ }
+ } else {
+ s.add(ch);
+ }
+ s.position++;
+ }
+ s.emitBlock();
+ return blocks;
+ }
+ }, {
+ key: 'getFormattingValues',
+ value: function getFormattingValues(ctx, selected, hover, mod) {
+ var values = {
+ color: mod === "normal" ? this.fontOptions.color : this.fontOptions[mod].color,
+ size: mod === "normal" ? this.fontOptions.size : this.fontOptions[mod].size,
+ face: mod === "normal" ? this.fontOptions.face : this.fontOptions[mod].face,
+ mod: mod === "normal" ? "" : this.fontOptions[mod].mod,
+ vadjust: mod === "normal" ? this.fontOptions.vadjust : this.fontOptions[mod].vadjust,
+ strokeWidth: this.fontOptions.strokeWidth,
+ strokeColor: this.fontOptions.strokeColor
+ };
+ if (mod === "normal") {
+ if (selected || hover) {
+ if (this.fontOptions.chooser === true && this.elementOptions.labelHighlightBold) {
+ values.mod = 'bold';
+ } else if (typeof this.fontOptions.chooser === 'function') {
+ this.fontOptions.chooser(ctx, values, this.elementOptions.id, selected, hover);
+ }
+ }
+ } else {
+ if ((selected || hover) && typeof this.fontOptions.chooser === 'function') {
+ this.fontOptions.chooser(ctx, values, this.elementOptions.id, selected, hover);
+ }
+ }
+ ctx.font = (values.mod + " " + values.size + "px " + values.face).replace(/"/g, "");
+ values.font = ctx.font;
+ values.height = values.size;
+ return values;
+ }
+ }, {
+ key: 'differentState',
+ value: function differentState(selected, hover) {
+ return selected !== this.fontOptions.selectedState && hover !== this.fontOptions.hoverState;
+ }
+
+ /**
+ * This explodes the label string into lines and sets the width, height and number of lines.
+ * @param ctx
+ * @param selected
+ * @private
+ */
+
+ }, {
+ key: '_processLabel',
+ value: function _processLabel(ctx, selected, hover) {
+ var width = 0;
+ var height = 0;
+ var nlLines = [];
+ var lines = [];
+ var k = 0;
+ lines.add = function (l, text, font, color, width, height, vadjust, mod, strokeWidth, strokeColor) {
+ if (this.length == l) {
+ this[l] = { width: 0, height: 0, blocks: [] };
+ }
+ this[l].blocks.push({ text: text, font: font, color: color, width: width, height: height, vadjust: vadjust, mod: mod, strokeWidth: strokeWidth, strokeColor: strokeColor });
+ };
+ lines.accumulate = function (l, width, height) {
+ this[l].width += width;
+ this[l].height = height > this[l].height ? height : this[l].height;
+ };
+ lines.addAndAccumulate = function (l, text, font, color, width, height, vadjust, mod, strokeWidth, strokeColor) {
+ this.add(l, text, font, color, width, height, vadjust, mod, strokeWidth, strokeColor);
+ this.accumulate(l, width, height);
+ };
+ if (this.elementOptions.label !== undefined) {
+ var _nlLines = String(this.elementOptions.label).split('\n');
+ var lineCount = _nlLines.length;
+ if (this.elementOptions.font.multi) {
+ for (var i = 0; i < lineCount; i++) {
+ var blocks = this.splitBlocks(_nlLines[i], this.elementOptions.font.multi);
+ var lineWidth = 0;
+ var lineHeight = 0;
+ if (blocks) {
+ if (blocks.length == 0) {
+ var values = this.getFormattingValues(ctx, selected, hover, "normal");
+ lines.addAndAccumulate(k, "", values.font, values.color, 0, values.size, values.vadjust, "normal", values.strokeWidth, values.strokeColor);
+ height += lines[k].height;
+ k++;
+ continue;
+ }
+ for (var j = 0; j < blocks.length; j++) {
+ if (this.fontOptions.maxWdt > 0) {
+ var _values = this.getFormattingValues(ctx, selected, hover, blocks[j].mod);
+ var words = blocks[j].text.split(" ");
+ var atStart = true;
+ var text = "";
+ var measure = { width: 0 };
+ var lastMeasure = void 0;
+ var w = 0;
+ while (w < words.length) {
+ var pre = atStart ? "" : " ";
+ lastMeasure = measure;
+ measure = ctx.measureText(text + pre + words[w]);
+ if (lineWidth + measure.width > this.fontOptions.maxWdt && lastMeasure.width != 0) {
+ lineHeight = _values.height > lineHeight ? _values.height : lineHeight;
+ lines.add(k, text, _values.font, _values.color, lastMeasure.width, _values.height, _values.vadjust, blocks[j].mod, _values.strokeWidth, _values.strokeColor);
+ lines.accumulate(k, lastMeasure.width, lineHeight);
+ text = "";
+ atStart = true;
+ lineWidth = 0;
+ width = lines[k].width > width ? lines[k].width : width;
+ height += lines[k].height;
+ k++;
+ } else {
+ text = text + pre + words[w];
+ if (w === words.length - 1) {
+ lineHeight = _values.height > lineHeight ? _values.height : lineHeight;
+ lineWidth += measure.width;
+ lines.add(k, text, _values.font, _values.color, measure.width, _values.height, _values.vadjust, blocks[j].mod, _values.strokeWidth, _values.strokeColor);
+ lines.accumulate(k, measure.width, lineHeight);
+ if (j === blocks.length - 1) {
+ width = lines[k].width > width ? lines[k].width : width;
+ height += lines[k].height;
+ k++;
+ }
+ }
+ w++;
+ atStart = false;
+ }
+ }
+ } else {
+ var _values2 = this.getFormattingValues(ctx, selected, hover, blocks[j].mod);
+ var _measure = ctx.measureText(blocks[j].text);
+ lines.addAndAccumulate(k, blocks[j].text, _values2.font, _values2.color, _measure.width, _values2.height, _values2.vadjust, blocks[j].mod, _values2.strokeWidth, _values2.strokeColor);
+ width = lines[k].width > width ? lines[k].width : width;
+ if (blocks.length - 1 === j) {
+ height += lines[k].height;
+ k++;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ for (var _i = 0; _i < lineCount; _i++) {
+ var _values3 = this.getFormattingValues(ctx, selected, hover, "normal");
+ if (this.fontOptions.maxWdt > 0) {
+ var _words = _nlLines[_i].split(" ");
+ var _text = "";
+ var _measure2 = { width: 0 };
+ var _lastMeasure = void 0;
+ var _w = 0;
+ while (_w < _words.length) {
+ var _pre = _text === "" ? "" : " ";
+ _lastMeasure = _measure2;
+ _measure2 = ctx.measureText(_text + _pre + _words[_w]);
+ if (_measure2.width > this.fontOptions.maxWdt && _lastMeasure.width != 0) {
+ lines.addAndAccumulate(k, _text, _values3.font, _values3.color, _lastMeasure.width, _values3.size, _values3.vadjust, "normal", _values3.strokeWidth, _values3.strokeColor);
+ width = lines[k].width > width ? lines[k].width : width;
+ height += lines[k].height;
+ _text = "";
+ k++;
+ } else {
+ _text = _text + _pre + _words[_w];
+ if (_w === _words.length - 1) {
+ lines.addAndAccumulate(k, _text, _values3.font, _values3.color, _measure2.width, _values3.size, _values3.vadjust, "normal", _values3.strokeWidth, _values3.strokeColor);
+ width = lines[k].width > width ? lines[k].width : width;
+ height += lines[k].height;
+ k++;
+ }
+ _w++;
+ }
+ }
+ } else {
+ var _text2 = _nlLines[_i];
+ var _measure3 = ctx.measureText(_text2);
+ lines.addAndAccumulate(k, _text2, _values3.font, _values3.color, _measure3.width, _values3.size, _values3.vadjust, "normal", _values3.strokeWidth, _values3.strokeColor);
+ width = lines[k].width > width ? lines[k].width : width;
+ height += lines[k].height;
+ k++;
+ }
+ }
+ }
+ }
+ if (this.fontOptions.minWdt > 0 && width < this.fontOptions.minWdt) {
+ width = this.fontOptions.minWdt;
+ }
+ this.size.labelHeight = height;
+ if (this.fontOptions.minHgt > 0 && height < this.fontOptions.minHgt) {
+ height = this.fontOptions.minHgt;
+ }
+ this.lines = lines;
+ this.lineCount = lines.length;
+ this.size.width = width;
+ this.size.height = height;
+ this.selectedState = selected;
+ this.hoverState = hover;
+ }
+ }], [{
+ key: 'parseOptions',
+ value: function parseOptions(parentOptions, newOptions) {
+ var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ if (typeof newOptions.font === 'string') {
+ var newOptionsArray = newOptions.font.split(" ");
+ parentOptions.size = newOptionsArray[0].replace("px", '');
+ parentOptions.face = newOptionsArray[1];
+ parentOptions.color = newOptionsArray[2];
+ parentOptions.vadjust = 0;
+ } else if ((0, _typeof3['default'])(newOptions.font) === 'object') {
+ util.fillIfDefined(parentOptions, newOptions.font, allowDeletion);
+ }
+ parentOptions.size = Number(parentOptions.size);
+ parentOptions.vadjust = Number(parentOptions.vadjust);
+ }
+ }]);
+ return Label;
+ }();
+
+ exports['default'] = Label;
+
+/***/ },
+/* 161 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ exports.__esModule = true;
+
+ var _isIterable2 = __webpack_require__(162);
+
+ var _isIterable3 = _interopRequireDefault(_isIterable2);
+
+ var _getIterator2 = __webpack_require__(2);
+
+ var _getIterator3 = _interopRequireDefault(_getIterator2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ exports.default = function () {
+ function sliceIterator(arr, i) {
+ var _arr = [];
+ var _n = true;
+ var _d = false;
+ var _e = undefined;
+
+ try {
+ for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
+ _arr.push(_s.value);
+
+ if (i && _arr.length === i) break;
+ }
+ } catch (err) {
+ _d = true;
+ _e = err;
+ } finally {
+ try {
+ if (!_n && _i["return"]) _i["return"]();
+ } finally {
+ if (_d) throw _e;
+ }
+ }
+
+ return _arr;
+ }
+
+ return function (arr, i) {
+ if (Array.isArray(arr)) {
+ return arr;
+ } else if ((0, _isIterable3.default)(Object(arr))) {
+ return sliceIterator(arr, i);
+ } else {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
+ }
+ };
+ }();
+
+/***/ },
+/* 162 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(163), __esModule: true };
+
+/***/ },
+/* 163 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(4);
+ __webpack_require__(50);
+ module.exports = __webpack_require__(164);
+
+/***/ },
+/* 164 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var classof = __webpack_require__(54)
+ , ITERATOR = __webpack_require__(47)('iterator')
+ , Iterators = __webpack_require__(8);
+ module.exports = __webpack_require__(17).isIterable = function(it){
+ var O = Object(it);
+ return O[ITERATOR] !== undefined
+ || '@@iterator' in O
+ || Iterators.hasOwnProperty(classof(O));
+ };
+
+/***/ },
+/* 165 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _NodeBase2 = __webpack_require__(175);
+
+ var _NodeBase3 = _interopRequireDefault(_NodeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Box = function (_NodeBase) {
+ (0, _inherits3['default'])(Box, _NodeBase);
+
+ function Box(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Box);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (Box.__proto__ || (0, _getPrototypeOf2['default'])(Box)).call(this, options, body, labelModule));
+
+ _this._setMargins(labelModule);
+ return _this;
+ }
+
+ (0, _createClass3['default'])(Box, [{
+ key: 'resize',
+ value: function resize(ctx) {
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
+ var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
+
+ if (this.width === undefined || this.labelModule.differentState(selected, hover)) {
+ this.textSize = this.labelModule.getTextSize(ctx, selected, hover);
+ this.width = this.textSize.width + this.margin.right + this.margin.left;
+ this.height = this.textSize.height + this.margin.top + this.margin.bottom;
+ this.radius = this.width / 2;
+ }
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this.resize(ctx, selected, hover);
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ ctx.strokeStyle = values.borderColor;
+ ctx.lineWidth = values.borderWidth;
+ ctx.lineWidth /= this.body.view.scale;
+ ctx.lineWidth = Math.min(this.width, ctx.lineWidth);
+
+ ctx.fillStyle = values.color;
+
+ ctx.roundRect(this.left, this.top, this.width, this.height, values.borderRadius);
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ // draw the background
+ ctx.fill();
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+
+ //draw dashed border if enabled, save and restore is required for firefox not to crash on unix.
+ ctx.save();
+ // if borders are zero width, they will be drawn with width 1 by default. This prevents that
+ if (values.borderWidth > 0) {
+ this.enableBorderDashes(ctx, values);
+ //draw the border
+ ctx.stroke();
+ //disable dashed border for other elements
+ this.disableBorderDashes(ctx, values);
+ }
+ ctx.restore();
+
+ this.updateBoundingBox(x, y, ctx, selected, hover);
+ this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y, ctx, selected, hover) {
+ this.resize(ctx, selected, hover);
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ var borderRadius = this.options.shapeProperties.borderRadius; // only effective for box
+ this.boundingBox.left = this.left - borderRadius;
+ this.boundingBox.top = this.top - borderRadius;
+ this.boundingBox.bottom = this.top + this.height + borderRadius;
+ this.boundingBox.right = this.left + this.width + borderRadius;
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ this.resize(ctx);
+ var borderWidth = this.options.borderWidth;
+
+ return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth;
+ }
+ }]);
+ return Box;
+ }(_NodeBase3['default']);
+
+ exports['default'] = Box;
+
+/***/ },
+/* 166 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(167), __esModule: true };
+
+/***/ },
+/* 167 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(168);
+ module.exports = __webpack_require__(17).Object.getPrototypeOf;
+
+/***/ },
+/* 168 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 19.1.2.9 Object.getPrototypeOf(O)
+ var toObject = __webpack_require__(49)
+ , $getPrototypeOf = __webpack_require__(48);
+
+ __webpack_require__(61)('getPrototypeOf', function(){
+ return function getPrototypeOf(it){
+ return $getPrototypeOf(toObject(it));
+ };
+ });
+
+/***/ },
+/* 169 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ exports.__esModule = true;
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ exports.default = function (self, call) {
+ if (!self) {
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
+ }
+
+ return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
+ };
+
+/***/ },
+/* 170 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ exports.__esModule = true;
+
+ var _setPrototypeOf = __webpack_require__(171);
+
+ var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
+
+ var _create = __webpack_require__(55);
+
+ var _create2 = _interopRequireDefault(_create);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ exports.default = function (subClass, superClass) {
+ if (typeof superClass !== "function" && superClass !== null) {
+ throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
+ }
+
+ subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
+ constructor: {
+ value: subClass,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+ if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
+ };
+
+/***/ },
+/* 171 */
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = { "default": __webpack_require__(172), __esModule: true };
+
+/***/ },
+/* 172 */
+/***/ function(module, exports, __webpack_require__) {
+
+ __webpack_require__(173);
+ module.exports = __webpack_require__(17).Object.setPrototypeOf;
+
+/***/ },
+/* 173 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // 19.1.3.19 Object.setPrototypeOf(O, proto)
+ var $export = __webpack_require__(15);
+ $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(174).set});
+
+/***/ },
+/* 174 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
+ /* eslint-disable no-proto */
+ var isObject = __webpack_require__(23)
+ , anObject = __webpack_require__(22);
+ var check = function(O, proto){
+ anObject(O);
+ if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
+ };
+ module.exports = {
+ set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
+ function(test, buggy, set){
+ try {
+ set = __webpack_require__(18)(Function.call, __webpack_require__(78).f(Object.prototype, '__proto__').set, 2);
+ set(test, []);
+ buggy = !(test instanceof Array);
+ } catch(e){ buggy = true; }
+ return function setPrototypeOf(O, proto){
+ check(O, proto);
+ if(buggy)O.__proto__ = proto;
+ else set(O, proto);
+ return O;
+ };
+ }({}, false) : undefined),
+ check: check
+ };
+
+/***/ },
+/* 175 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var NodeBase = function () {
+ function NodeBase(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, NodeBase);
+
+ this.body = body;
+ this.labelModule = labelModule;
+ this.setOptions(options);
+ this.top = undefined;
+ this.left = undefined;
+ this.height = undefined;
+ this.width = undefined;
+ this.radius = undefined;
+ this.margin = undefined;
+ this.boundingBox = { top: 0, left: 0, right: 0, bottom: 0 };
+ }
+
+ (0, _createClass3['default'])(NodeBase, [{
+ key: 'setOptions',
+ value: function setOptions(options) {
+ this.options = options;
+ }
+ }, {
+ key: '_setMargins',
+ value: function _setMargins(labelModule) {
+ this.margin = {};
+ if (this.options.margin) {
+ if ((0, _typeof3['default'])(this.options.margin) == 'object') {
+ this.margin.top = this.options.margin.top;
+ this.margin.right = this.options.margin.right;
+ this.margin.bottom = this.options.margin.bottom;
+ this.margin.left = this.options.margin.left;
+ } else {
+ this.margin.top = this.options.margin;
+ this.margin.right = this.options.margin;
+ this.margin.bottom = this.options.margin;
+ this.margin.left = this.options.margin;
+ }
+ }
+ labelModule.adjustSizes(this.margin);
+ }
+ }, {
+ key: '_distanceToBorder',
+ value: function _distanceToBorder(ctx, angle) {
+ var borderWidth = this.options.borderWidth;
+ this.resize(ctx);
+ return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth;
+ }
+ }, {
+ key: 'enableShadow',
+ value: function enableShadow(ctx, values) {
+ if (values.shadow) {
+ ctx.shadowColor = values.shadowColor;
+ ctx.shadowBlur = values.shadowSize;
+ ctx.shadowOffsetX = values.shadowX;
+ ctx.shadowOffsetY = values.shadowY;
+ }
+ }
+ }, {
+ key: 'disableShadow',
+ value: function disableShadow(ctx, values) {
+ if (values.shadow) {
+ ctx.shadowColor = 'rgba(0,0,0,0)';
+ ctx.shadowBlur = 0;
+ ctx.shadowOffsetX = 0;
+ ctx.shadowOffsetY = 0;
+ }
+ }
+ }, {
+ key: 'enableBorderDashes',
+ value: function enableBorderDashes(ctx, values) {
+ if (values.borderDashes !== false) {
+ if (ctx.setLineDash !== undefined) {
+ var dashes = values.borderDashes;
+ if (dashes === true) {
+ dashes = [5, 15];
+ }
+ ctx.setLineDash(dashes);
+ } else {
+ console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used.");
+ this.options.shapeProperties.borderDashes = false;
+ values.borderDashes = false;
+ }
+ }
+ }
+ }, {
+ key: 'disableBorderDashes',
+ value: function disableBorderDashes(ctx, values) {
+ if (values.borderDashes !== false) {
+ if (ctx.setLineDash !== undefined) {
+ ctx.setLineDash([0]);
+ } else {
+ console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used.");
+ this.options.shapeProperties.borderDashes = false;
+ values.borderDashes = false;
+ }
+ }
+ }
+ }]);
+ return NodeBase;
+ }();
+
+ exports['default'] = NodeBase;
+
+/***/ },
+/* 176 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _CircleImageBase2 = __webpack_require__(177);
+
+ var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Circle = function (_CircleImageBase) {
+ (0, _inherits3['default'])(Circle, _CircleImageBase);
+
+ function Circle(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Circle);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (Circle.__proto__ || (0, _getPrototypeOf2['default'])(Circle)).call(this, options, body, labelModule));
+
+ _this._setMargins(labelModule);
+ return _this;
+ }
+
+ (0, _createClass3['default'])(Circle, [{
+ key: 'resize',
+ value: function resize(ctx) {
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
+ var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
+ var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : { size: this.options.size };
+
+ if (this.width === undefined || this.labelModule.differentState(selected, hover)) {
+ this.textSize = this.labelModule.getTextSize(ctx, selected, hover);
+ var diameter = Math.max(this.textSize.width + this.margin.right + this.margin.left, this.textSize.height + this.margin.top + this.margin.bottom);
+ this.options.size = diameter / 2;
+
+ this.width = diameter;
+ this.height = diameter;
+ this.radius = this.width / 2;
+ }
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this.resize(ctx, selected, hover);
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ this._drawRawCircle(ctx, x, y, selected, hover, values);
+
+ this.boundingBox.top = y - values.size;
+ this.boundingBox.left = x - values.size;
+ this.boundingBox.right = x + values.size;
+ this.boundingBox.bottom = y + values.size;
+
+ this.updateBoundingBox(x, y);
+ this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, y, selected, hover);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y) {
+ this.boundingBox.top = y - this.options.size;
+ this.boundingBox.left = x - this.options.size;
+ this.boundingBox.right = x + this.options.size;
+ this.boundingBox.bottom = y + this.options.size;
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ this.resize(ctx);
+ return this.width * 0.5;
+ }
+ }]);
+ return Circle;
+ }(_CircleImageBase3['default']);
+
+ exports['default'] = Circle;
+
+/***/ },
+/* 177 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _NodeBase2 = __webpack_require__(175);
+
+ var _NodeBase3 = _interopRequireDefault(_NodeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var CircleImageBase = function (_NodeBase) {
+ (0, _inherits3['default'])(CircleImageBase, _NodeBase);
+
+ function CircleImageBase(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, CircleImageBase);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (CircleImageBase.__proto__ || (0, _getPrototypeOf2['default'])(CircleImageBase)).call(this, options, body, labelModule));
+
+ _this.labelOffset = 0;
+ _this.imageLoaded = false;
+ return _this;
+ }
+
+ (0, _createClass3['default'])(CircleImageBase, [{
+ key: 'setOptions',
+ value: function setOptions(options, imageObj) {
+ this.options = options;
+ if (imageObj) {
+ this.imageObj = imageObj;
+ }
+ }
+
+ /**
+ * This function resizes the image by the options size when the image has not yet loaded. If the image has loaded, we
+ * force the update of the size again.
+ *
+ * @private
+ */
+
+ }, {
+ key: '_resizeImage',
+ value: function _resizeImage() {
+ var force = false;
+ if (!this.imageObj.width || !this.imageObj.height) {
+ // undefined or 0
+ this.imageLoaded = false;
+ } else if (this.imageLoaded === false) {
+ this.imageLoaded = true;
+ force = true;
+ }
+
+ if (!this.width || !this.height || force === true) {
+ // undefined or 0
+ var width, height, ratio;
+ if (this.imageObj.width && this.imageObj.height) {
+ // not undefined or 0
+ width = 0;
+ height = 0;
+ }
+ if (this.options.shapeProperties.useImageSize === false) {
+ if (this.imageObj.width > this.imageObj.height) {
+ ratio = this.imageObj.width / this.imageObj.height;
+ width = this.options.size * 2 * ratio || this.imageObj.width;
+ height = this.options.size * 2 || this.imageObj.height;
+ } else {
+ if (this.imageObj.width && this.imageObj.height) {
+ // not undefined or 0
+ ratio = this.imageObj.height / this.imageObj.width;
+ } else {
+ ratio = 1;
+ }
+ width = this.options.size * 2;
+ height = this.options.size * 2 * ratio;
+ }
+ } else {
+ // when not using the size property, we use the image size
+ width = this.imageObj.width;
+ height = this.imageObj.height;
+ }
+ this.width = width;
+ this.height = height;
+ this.radius = 0.5 * this.width;
+ }
+ }
+ }, {
+ key: '_drawRawCircle',
+ value: function _drawRawCircle(ctx, x, y, selected, hover, values) {
+ var borderWidth = values.borderWidth / this.body.view.scale;
+ ctx.lineWidth = Math.min(this.width, borderWidth);
+
+ ctx.strokeStyle = values.borderColor;
+ ctx.fillStyle = values.color;
+ ctx.circle(x, y, values.size);
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ // draw the background
+ ctx.fill();
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+
+ //draw dashed border if enabled, save and restore is required for firefox not to crash on unix.
+ ctx.save();
+ // if borders are zero width, they will be drawn with width 1 by default. This prevents that
+ if (borderWidth > 0) {
+ this.enableBorderDashes(ctx, values);
+ //draw the border
+ ctx.stroke();
+ //disable dashed border for other elements
+ this.disableBorderDashes(ctx, values);
+ }
+ ctx.restore();
+ }
+ }, {
+ key: '_drawImageAtPosition',
+ value: function _drawImageAtPosition(ctx, values) {
+ if (this.imageObj.width != 0) {
+ // draw the image
+ ctx.globalAlpha = 1.0;
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+
+ var factor = this.imageObj.width / this.width / this.body.view.scale;
+ if (factor > 2 && this.options.shapeProperties.interpolation === true) {
+ var w = this.imageObj.width;
+ var h = this.imageObj.height;
+ var can2 = document.createElement('canvas');
+ can2.width = w;
+ can2.height = w;
+ var ctx2 = can2.getContext('2d');
+
+ factor *= 0.5;
+ w *= 0.5;
+ h *= 0.5;
+ ctx2.drawImage(this.imageObj, 0, 0, w, h);
+
+ var distance = 0;
+ var iterations = 1;
+ while (factor > 2 && iterations < 4) {
+ ctx2.drawImage(can2, distance, 0, w, h, distance + w, 0, w / 2, h / 2);
+ distance += w;
+ factor *= 0.5;
+ w *= 0.5;
+ h *= 0.5;
+ iterations += 1;
+ }
+ ctx.drawImage(can2, distance, 0, w, h, this.left, this.top, this.width, this.height);
+ } else {
+ // draw image
+ ctx.drawImage(this.imageObj, this.left, this.top, this.width, this.height);
+ }
+
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+ }
+ }
+ }, {
+ key: '_drawImageLabel',
+ value: function _drawImageLabel(ctx, x, y, selected, hover) {
+ var yLabel;
+ var offset = 0;
+
+ if (this.height !== undefined) {
+ offset = this.height * 0.5;
+ var labelDimensions = this.labelModule.getTextSize(ctx, selected, hover);
+ if (labelDimensions.lineCount >= 1) {
+ offset += labelDimensions.height / 2;
+ }
+ }
+
+ yLabel = y + offset;
+
+ if (this.options.label) {
+ this.labelOffset = offset;
+ }
+ this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging');
+ }
+ }]);
+ return CircleImageBase;
+ }(_NodeBase3['default']);
+
+ exports['default'] = CircleImageBase;
+
+/***/ },
+/* 178 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _CircleImageBase2 = __webpack_require__(177);
+
+ var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var CircularImage = function (_CircleImageBase) {
+ (0, _inherits3['default'])(CircularImage, _CircleImageBase);
+
+ function CircularImage(options, body, labelModule, imageObj) {
+ (0, _classCallCheck3['default'])(this, CircularImage);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (CircularImage.__proto__ || (0, _getPrototypeOf2['default'])(CircularImage)).call(this, options, body, labelModule));
+
+ _this.imageObj = imageObj;
+ _this._swapToImageResizeWhenImageLoaded = true;
+ return _this;
+ }
+
+ (0, _createClass3['default'])(CircularImage, [{
+ key: 'resize',
+ value: function resize(ctx) {
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
+ var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
+
+ if (this.imageObj.src === undefined || this.imageObj.width === undefined || this.imageObj.height === undefined || this.labelModule.differentState(selected, hover)) {
+ var diameter = this.options.size * 2;
+ this.width = diameter;
+ this.height = diameter;
+ this._swapToImageResizeWhenImageLoaded = true;
+ this.radius = 0.5 * this.width;
+ } else {
+ if (this._swapToImageResizeWhenImageLoaded) {
+ this.width = undefined;
+ this.height = undefined;
+ this._swapToImageResizeWhenImageLoaded = false;
+ }
+ this._resizeImage();
+ }
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this.resize();
+
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ var size = Math.min(0.5 * this.height, 0.5 * this.width);
+
+ // draw the background circle. IMPORTANT: the stroke in this method is used by the clip method below.
+ this._drawRawCircle(ctx, x, y, selected, hover, values);
+
+ // now we draw in the circle, we save so we can revert the clip operation after drawing.
+ ctx.save();
+ // clip is used to use the stroke in drawRawCircle as an area that we can draw in.
+ ctx.clip();
+ // draw the image
+ this._drawImageAtPosition(ctx, values);
+ // restore so we can again draw on the full canvas
+ ctx.restore();
+
+ this._drawImageLabel(ctx, x, y, selected, hover);
+
+ this.updateBoundingBox(x, y);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y) {
+ this.boundingBox.top = y - this.options.size;
+ this.boundingBox.left = x - this.options.size;
+ this.boundingBox.right = x + this.options.size;
+ this.boundingBox.bottom = y + this.options.size;
+ this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
+ this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
+ this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset);
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ this.resize(ctx);
+ return this.width * 0.5;
+ }
+ }]);
+ return CircularImage;
+ }(_CircleImageBase3['default']);
+
+ exports['default'] = CircularImage;
+
+/***/ },
+/* 179 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _NodeBase2 = __webpack_require__(175);
+
+ var _NodeBase3 = _interopRequireDefault(_NodeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Database = function (_NodeBase) {
+ (0, _inherits3['default'])(Database, _NodeBase);
+
+ function Database(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Database);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (Database.__proto__ || (0, _getPrototypeOf2['default'])(Database)).call(this, options, body, labelModule));
+
+ _this._setMargins(labelModule);
+ return _this;
+ }
+
+ (0, _createClass3['default'])(Database, [{
+ key: 'resize',
+ value: function resize(ctx, selected, hover) {
+ if (this.width === undefined || this.labelModule.differentState(selected, hover)) {
+ this.textSize = this.labelModule.getTextSize(ctx, selected, hover);
+ var size = this.textSize.width + this.margin.right + this.margin.left;
+ this.width = size;
+ this.height = size;
+ this.radius = this.width / 2;
+ }
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this.resize(ctx, selected, hover);
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ var borderWidth = values.borderWidth / this.body.view.scale;
+ ctx.lineWidth = Math.min(this.width, borderWidth);
+
+ ctx.strokeStyle = values.borderColor;
+
+ ctx.fillStyle = values.color;
+ ctx.database(x - this.width / 2, y - this.height / 2, this.width, this.height);
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ // draw the background
+ ctx.fill();
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+
+ //draw dashed border if enabled, save and restore is required for firefox not to crash on unix.
+ ctx.save();
+ // if borders are zero width, they will be drawn with width 1 by default. This prevents that
+ if (borderWidth > 0) {
+ this.enableBorderDashes(ctx, values);
+ //draw the border
+ ctx.stroke();
+ //disable dashed border for other elements
+ this.disableBorderDashes(ctx, values);
+ }
+ ctx.restore();
+
+ this.updateBoundingBox(x, y, ctx, selected, hover);
+ this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y, ctx, selected, hover) {
+ this.resize(ctx, selected, hover);
+
+ this.left = x - this.width * 0.5;
+ this.top = y - this.height * 0.5;
+
+ this.boundingBox.left = this.left;
+ this.boundingBox.top = this.top;
+ this.boundingBox.bottom = this.top + this.height;
+ this.boundingBox.right = this.left + this.width;
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return Database;
+ }(_NodeBase3['default']);
+
+ exports['default'] = Database;
+
+/***/ },
+/* 180 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _ShapeBase2 = __webpack_require__(181);
+
+ var _ShapeBase3 = _interopRequireDefault(_ShapeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Diamond = function (_ShapeBase) {
+ (0, _inherits3['default'])(Diamond, _ShapeBase);
+
+ function Diamond(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Diamond);
+ return (0, _possibleConstructorReturn3['default'])(this, (Diamond.__proto__ || (0, _getPrototypeOf2['default'])(Diamond)).call(this, options, body, labelModule));
+ }
+
+ (0, _createClass3['default'])(Diamond, [{
+ key: 'resize',
+ value: function resize(ctx) {
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
+ var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
+ var values = arguments[3];
+
+ this._resizeShape(selected, hover, values);
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this._drawShape(ctx, 'diamond', 4, x, y, selected, hover, values);
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return Diamond;
+ }(_ShapeBase3['default']);
+
+ exports['default'] = Diamond;
+
+/***/ },
+/* 181 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _NodeBase2 = __webpack_require__(175);
+
+ var _NodeBase3 = _interopRequireDefault(_NodeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var ShapeBase = function (_NodeBase) {
+ (0, _inherits3['default'])(ShapeBase, _NodeBase);
+
+ function ShapeBase(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, ShapeBase);
+ return (0, _possibleConstructorReturn3['default'])(this, (ShapeBase.__proto__ || (0, _getPrototypeOf2['default'])(ShapeBase)).call(this, options, body, labelModule));
+ }
+
+ (0, _createClass3['default'])(ShapeBase, [{
+ key: '_resizeShape',
+ value: function _resizeShape() {
+ var selected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.selected;
+ var hover = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.hover;
+ var values = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { size: this.options.size };
+
+ if (this.width === undefined || this.labelModule.differentState(selected, hover)) {
+ var size = 2 * values.size;
+ this.width = size;
+ this.height = size;
+ this.radius = 0.5 * this.width;
+ }
+ }
+ }, {
+ key: '_drawShape',
+ value: function _drawShape(ctx, shape, sizeMultiplier, x, y, selected, hover, values) {
+ this._resizeShape(selected, hover, values);
+
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ var borderWidth = values.borderWidth / this.body.view.scale;
+ ctx.lineWidth = Math.min(this.width, borderWidth);
+
+ ctx.strokeStyle = values.borderColor;
+ ctx.fillStyle = values.color;
+ ctx[shape](x, y, values.size);
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ // draw the background
+ ctx.fill();
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+
+ //draw dashed border if enabled, save and restore is required for firefox not to crash on unix.
+ ctx.save();
+ // if borders are zero width, they will be drawn with width 1 by default. This prevents that
+ if (borderWidth > 0) {
+ this.enableBorderDashes(ctx, values);
+ //draw the border
+ ctx.stroke();
+ //disable dashed border for other elements
+ this.disableBorderDashes(ctx, values);
+ }
+ ctx.restore();
+
+ if (this.options.label !== undefined) {
+ var yLabel = y + 0.5 * this.height + 3; // the + 3 is to offset it a bit below the node.
+ this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging');
+ }
+
+ this.updateBoundingBox(x, y);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y) {
+ this.boundingBox.top = y - this.options.size;
+ this.boundingBox.left = x - this.options.size;
+ this.boundingBox.right = x + this.options.size;
+ this.boundingBox.bottom = y + this.options.size;
+
+ if (this.options.label !== undefined && this.labelModule.size.width > 0) {
+ this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
+ this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
+ this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height + 3);
+ }
+ }
+ }]);
+ return ShapeBase;
+ }(_NodeBase3['default']);
+
+ exports['default'] = ShapeBase;
+
+/***/ },
+/* 182 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _ShapeBase2 = __webpack_require__(181);
+
+ var _ShapeBase3 = _interopRequireDefault(_ShapeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Dot = function (_ShapeBase) {
+ (0, _inherits3['default'])(Dot, _ShapeBase);
+
+ function Dot(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Dot);
+ return (0, _possibleConstructorReturn3['default'])(this, (Dot.__proto__ || (0, _getPrototypeOf2['default'])(Dot)).call(this, options, body, labelModule));
+ }
+
+ (0, _createClass3['default'])(Dot, [{
+ key: 'resize',
+ value: function resize(ctx) {
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
+ var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
+ var values = arguments[3];
+
+ this._resizeShape(selected, hover, values);
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this._drawShape(ctx, 'circle', 2, x, y, selected, hover, values);
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ this.resize(ctx);
+ return this.options.size;
+ }
+ }]);
+ return Dot;
+ }(_ShapeBase3['default']);
+
+ exports['default'] = Dot;
+
+/***/ },
+/* 183 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _NodeBase2 = __webpack_require__(175);
+
+ var _NodeBase3 = _interopRequireDefault(_NodeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Ellipse = function (_NodeBase) {
+ (0, _inherits3['default'])(Ellipse, _NodeBase);
+
+ function Ellipse(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Ellipse);
+ return (0, _possibleConstructorReturn3['default'])(this, (Ellipse.__proto__ || (0, _getPrototypeOf2['default'])(Ellipse)).call(this, options, body, labelModule));
+ }
+
+ (0, _createClass3['default'])(Ellipse, [{
+ key: 'resize',
+ value: function resize(ctx) {
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected;
+ var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover;
+
+ if (this.width === undefined || this.labelModule.differentState(selected, hover)) {
+ var textSize = this.labelModule.getTextSize(ctx, selected, hover);
+
+ this.height = textSize.height * 2;
+ this.width = textSize.width + this.height;
+ this.radius = 0.5 * this.width;
+ }
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this.resize(ctx, selected, hover);
+ this.left = x - this.width * 0.5;
+ this.top = y - this.height * 0.5;
+
+ var borderWidth = values.borderWidth / this.body.view.scale;
+ ctx.lineWidth = Math.min(this.width, borderWidth);
+
+ ctx.strokeStyle = values.borderColor;
+
+ ctx.fillStyle = values.color;
+ ctx.ellipse(this.left, this.top, this.width, this.height);
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ // draw the background
+ ctx.fill();
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+
+ //draw dashed border if enabled, save and restore is required for firefox not to crash on unix.
+ ctx.save();
+
+ // if borders are zero width, they will be drawn with width 1 by default. This prevents that
+ if (borderWidth > 0) {
+ this.enableBorderDashes(ctx, values);
+ //draw the border
+ ctx.stroke();
+ //disable dashed border for other elements
+ this.disableBorderDashes(ctx, values);
+ }
+
+ ctx.restore();
+
+ this.updateBoundingBox(x, y, ctx, selected, hover);
+ this.labelModule.draw(ctx, x, y, selected, hover);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y, ctx, selected, hover) {
+ this.resize(ctx, selected, hover); // just in case
+
+ this.left = x - this.width * 0.5;
+ this.top = y - this.height * 0.5;
+
+ this.boundingBox.left = this.left;
+ this.boundingBox.top = this.top;
+ this.boundingBox.bottom = this.top + this.height;
+ this.boundingBox.right = this.left + this.width;
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ this.resize(ctx);
+ var a = this.width * 0.5;
+ var b = this.height * 0.5;
+ var w = Math.sin(angle) * a;
+ var h = Math.cos(angle) * b;
+ return a * b / Math.sqrt(w * w + h * h);
+ }
+ }]);
+ return Ellipse;
+ }(_NodeBase3['default']);
+
+ exports['default'] = Ellipse;
+
+/***/ },
+/* 184 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _NodeBase2 = __webpack_require__(175);
+
+ var _NodeBase3 = _interopRequireDefault(_NodeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Icon = function (_NodeBase) {
+ (0, _inherits3['default'])(Icon, _NodeBase);
+
+ function Icon(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Icon);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (Icon.__proto__ || (0, _getPrototypeOf2['default'])(Icon)).call(this, options, body, labelModule));
+
+ _this._setMargins(labelModule);
+ return _this;
+ }
+
+ (0, _createClass3['default'])(Icon, [{
+ key: 'resize',
+ value: function resize(ctx, selected, hover) {
+ if (this.width === undefined || this.labelModule.differentState(selected, hover)) {
+ this.iconSize = {
+ width: Number(this.options.icon.size),
+ height: Number(this.options.icon.size)
+ };
+ this.width = this.iconSize.width + this.margin.right + this.margin.left;
+ this.height = this.iconSize.height + this.margin.top + this.margin.bottom;
+ this.radius = 0.5 * this.width;
+ }
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this.resize(ctx, selected, hover);
+ this.options.icon.size = this.options.icon.size || 50;
+
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+ this._icon(ctx, x, y, selected, hover, values);
+
+ if (this.options.label !== undefined) {
+ var iconTextSpacing = 5;
+ this.labelModule.draw(ctx, this.left + this.iconSize.width / 2 + this.margin.left, y + this.height / 2 + iconTextSpacing, selected);
+ }
+
+ this.updateBoundingBox(x, y);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y) {
+ this.boundingBox.top = y - this.options.icon.size * 0.5;
+ this.boundingBox.left = x - this.options.icon.size * 0.5;
+ this.boundingBox.right = x + this.options.icon.size * 0.5;
+ this.boundingBox.bottom = y + this.options.icon.size * 0.5;
+
+ if (this.options.label !== undefined && this.labelModule.size.width > 0) {
+ var iconTextSpacing = 5;
+ this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
+ this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
+ this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height + iconTextSpacing);
+ }
+ }
+ }, {
+ key: '_icon',
+ value: function _icon(ctx, x, y, selected, hover, values) {
+ var iconSize = Number(this.options.icon.size);
+
+ if (this.options.icon.code !== undefined) {
+ ctx.font = (selected ? "bold " : "") + iconSize + "px " + this.options.icon.face;
+
+ // draw icon
+ ctx.fillStyle = this.options.icon.color || "black";
+ ctx.textAlign = "center";
+ ctx.textBaseline = "middle";
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ ctx.fillText(this.options.icon.code, x, y);
+
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+ } else {
+ console.error('When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.');
+ }
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return Icon;
+ }(_NodeBase3['default']);
+
+ exports['default'] = Icon;
+
+/***/ },
+/* 185 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _CircleImageBase2 = __webpack_require__(177);
+
+ var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Image = function (_CircleImageBase) {
+ (0, _inherits3['default'])(Image, _CircleImageBase);
+
+ function Image(options, body, labelModule, imageObj) {
+ (0, _classCallCheck3['default'])(this, Image);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (Image.__proto__ || (0, _getPrototypeOf2['default'])(Image)).call(this, options, body, labelModule));
+
+ _this.imageObj = imageObj;
+ return _this;
+ }
+
+ (0, _createClass3['default'])(Image, [{
+ key: 'resize',
+ value: function resize() {
+ this._resizeImage();
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this.resize();
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ if (this.options.shapeProperties.useBorderWithImage === true) {
+ var neutralborderWidth = this.options.borderWidth;
+ var selectionLineWidth = this.options.borderWidthSelected || 2 * this.options.borderWidth;
+ var borderWidth = (selected ? selectionLineWidth : neutralborderWidth) / this.body.view.scale;
+ ctx.lineWidth = Math.min(this.width, borderWidth);
+
+ ctx.beginPath();
+
+ // setup the line properties.
+ ctx.strokeStyle = selected ? this.options.color.highlight.border : hover ? this.options.color.hover.border : this.options.color.border;
+
+ // set a fillstyle
+ ctx.fillStyle = selected ? this.options.color.highlight.background : hover ? this.options.color.hover.background : this.options.color.background;
+
+ // draw a rectangle to form the border around. This rectangle is filled so the opacity of a picture (in future vis releases?) can be used to tint the image
+ ctx.rect(this.left - 0.5 * ctx.lineWidth, this.top - 0.5 * ctx.lineWidth, this.width + ctx.lineWidth, this.height + ctx.lineWidth);
+ ctx.fill();
+
+ //draw dashed border if enabled, save and restore is required for firefox not to crash on unix.
+ ctx.save();
+ // if borders are zero width, they will be drawn with width 1 by default. This prevents that
+ if (borderWidth > 0) {
+ this.enableBorderDashes(ctx, values);
+ //draw the border
+ ctx.stroke();
+ //disable dashed border for other elements
+ this.disableBorderDashes(ctx, values);
+ }
+ ctx.restore();
+
+ ctx.closePath();
+ }
+
+ this._drawImageAtPosition(ctx, values);
+
+ this._drawImageLabel(ctx, x, y, selected, hover);
+
+ this.updateBoundingBox(x, y);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y) {
+ this.resize();
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ this.boundingBox.top = this.top;
+ this.boundingBox.left = this.left;
+ this.boundingBox.right = this.left + this.width;
+ this.boundingBox.bottom = this.top + this.height;
+
+ if (this.options.label !== undefined && this.labelModule.size.width > 0) {
+ this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left);
+ this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width);
+ this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset);
+ }
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return Image;
+ }(_CircleImageBase3['default']);
+
+ exports['default'] = Image;
+
+/***/ },
+/* 186 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _ShapeBase2 = __webpack_require__(181);
+
+ var _ShapeBase3 = _interopRequireDefault(_ShapeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Square = function (_ShapeBase) {
+ (0, _inherits3['default'])(Square, _ShapeBase);
+
+ function Square(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Square);
+ return (0, _possibleConstructorReturn3['default'])(this, (Square.__proto__ || (0, _getPrototypeOf2['default'])(Square)).call(this, options, body, labelModule));
+ }
+
+ (0, _createClass3['default'])(Square, [{
+ key: 'resize',
+ value: function resize() {
+ this._resizeShape();
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this._drawShape(ctx, 'square', 2, x, y, selected, hover, values);
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return Square;
+ }(_ShapeBase3['default']);
+
+ exports['default'] = Square;
+
+/***/ },
+/* 187 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _ShapeBase2 = __webpack_require__(181);
+
+ var _ShapeBase3 = _interopRequireDefault(_ShapeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Star = function (_ShapeBase) {
+ (0, _inherits3['default'])(Star, _ShapeBase);
+
+ function Star(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Star);
+ return (0, _possibleConstructorReturn3['default'])(this, (Star.__proto__ || (0, _getPrototypeOf2['default'])(Star)).call(this, options, body, labelModule));
+ }
+
+ (0, _createClass3['default'])(Star, [{
+ key: 'resize',
+ value: function resize(ctx, selected, hover, values) {
+ this._resizeShape(selected, hover, values);
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this._drawShape(ctx, 'star', 4, x, y, selected, hover, values);
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return Star;
+ }(_ShapeBase3['default']);
+
+ exports['default'] = Star;
+
+/***/ },
+/* 188 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _NodeBase2 = __webpack_require__(175);
+
+ var _NodeBase3 = _interopRequireDefault(_NodeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Text = function (_NodeBase) {
+ (0, _inherits3['default'])(Text, _NodeBase);
+
+ function Text(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Text);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (Text.__proto__ || (0, _getPrototypeOf2['default'])(Text)).call(this, options, body, labelModule));
+
+ _this._setMargins(labelModule);
+ return _this;
+ }
+
+ (0, _createClass3['default'])(Text, [{
+ key: 'resize',
+ value: function resize(ctx, selected, hover) {
+ if (this.width === undefined || this.labelModule.differentState(selected, hover)) {
+ this.textSize = this.labelModule.getTextSize(ctx, selected, hover);
+ this.width = this.textSize.width + this.margin.right + this.margin.left;
+ this.height = this.textSize.height + this.margin.top + this.margin.bottom;
+ this.radius = 0.5 * this.width;
+ }
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this.resize(ctx, selected, hover);
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover);
+
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+
+ this.updateBoundingBox(x, y, ctx, selected, hover);
+ }
+ }, {
+ key: 'updateBoundingBox',
+ value: function updateBoundingBox(x, y, ctx, selected, hover) {
+ this.resize(ctx, selected, hover);
+
+ this.left = x - this.width / 2;
+ this.top = y - this.height / 2;
+
+ this.boundingBox.top = this.top;
+ this.boundingBox.left = this.left;
+ this.boundingBox.right = this.left + this.width;
+ this.boundingBox.bottom = this.top + this.height;
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return Text;
+ }(_NodeBase3['default']);
+
+ exports['default'] = Text;
+
+/***/ },
+/* 189 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _ShapeBase2 = __webpack_require__(181);
+
+ var _ShapeBase3 = _interopRequireDefault(_ShapeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Triangle = function (_ShapeBase) {
+ (0, _inherits3['default'])(Triangle, _ShapeBase);
+
+ function Triangle(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, Triangle);
+ return (0, _possibleConstructorReturn3['default'])(this, (Triangle.__proto__ || (0, _getPrototypeOf2['default'])(Triangle)).call(this, options, body, labelModule));
+ }
+
+ (0, _createClass3['default'])(Triangle, [{
+ key: 'resize',
+ value: function resize(ctx) {
+ this._resizeShape();
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this._drawShape(ctx, 'triangle', 3, x, y, selected, hover, values);
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return Triangle;
+ }(_ShapeBase3['default']);
+
+ exports['default'] = Triangle;
+
+/***/ },
+/* 190 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _ShapeBase2 = __webpack_require__(181);
+
+ var _ShapeBase3 = _interopRequireDefault(_ShapeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var TriangleDown = function (_ShapeBase) {
+ (0, _inherits3['default'])(TriangleDown, _ShapeBase);
+
+ function TriangleDown(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, TriangleDown);
+ return (0, _possibleConstructorReturn3['default'])(this, (TriangleDown.__proto__ || (0, _getPrototypeOf2['default'])(TriangleDown)).call(this, options, body, labelModule));
+ }
+
+ (0, _createClass3['default'])(TriangleDown, [{
+ key: 'resize',
+ value: function resize(ctx) {
+ this._resizeShape();
+ }
+ }, {
+ key: 'draw',
+ value: function draw(ctx, x, y, selected, hover, values) {
+ this._drawShape(ctx, 'triangleDown', 3, x, y, selected, hover, values);
+ }
+ }, {
+ key: 'distanceToBorder',
+ value: function distanceToBorder(ctx, angle) {
+ return this._distanceToBorder(ctx, angle);
+ }
+ }]);
+ return TriangleDown;
+ }(_ShapeBase3['default']);
+
+ exports['default'] = TriangleDown;
+
+/***/ },
+/* 191 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _Edge = __webpack_require__(192);
+
+ var _Edge2 = _interopRequireDefault(_Edge);
+
+ var _Label = __webpack_require__(160);
+
+ var _Label2 = _interopRequireDefault(_Label);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var DataSet = __webpack_require__(91);
+ var DataView = __webpack_require__(93);
+
+ var EdgesHandler = function () {
+ function EdgesHandler(body, images, groups) {
+ var _this = this;
+
+ (0, _classCallCheck3['default'])(this, EdgesHandler);
+
+ this.body = body;
+ this.images = images;
+ this.groups = groups;
+
+ // create the edge API in the body container
+ this.body.functions.createEdge = this.create.bind(this);
+
+ this.edgesListeners = {
+ add: function add(event, params) {
+ _this.add(params.items);
+ },
+ update: function update(event, params) {
+ _this.update(params.items);
+ },
+ remove: function remove(event, params) {
+ _this.remove(params.items);
+ }
+ };
+
+ this.options = {};
+ this.defaultOptions = {
+ arrows: {
+ to: { enabled: false, scaleFactor: 1, type: 'arrow' }, // boolean / {arrowScaleFactor:1} / {enabled: false, arrowScaleFactor:1}
+ middle: { enabled: false, scaleFactor: 1, type: 'arrow' },
+ from: { enabled: false, scaleFactor: 1, type: 'arrow' }
+ },
+ arrowStrikethrough: true,
+ color: {
+ color: '#848484',
+ highlight: '#848484',
+ hover: '#848484',
+ inherit: 'from',
+ opacity: 1.0
+ },
+ dashes: false,
+ font: {
+ color: '#343434',
+ size: 14, // px
+ face: 'arial',
+ background: 'none',
+ strokeWidth: 2, // px
+ strokeColor: '#ffffff',
+ align: 'horizontal',
+ multi: false,
+ vadjust: 0,
+ bold: {
+ mod: 'bold'
+ },
+ boldital: {
+ mod: 'bold italic'
+ },
+ ital: {
+ mod: 'italic'
+ },
+ mono: {
+ mod: '',
+ size: 15, // px
+ face: 'courier new',
+ vadjust: 2
+ }
+ },
+ hidden: false,
+ hoverWidth: 1.5,
+ label: undefined,
+ labelHighlightBold: true,
+ length: undefined,
+ physics: true,
+ scaling: {
+ min: 1,
+ max: 15,
+ label: {
+ enabled: true,
+ min: 14,
+ max: 30,
+ maxVisible: 30,
+ drawThreshold: 5
+ },
+ customScalingFunction: function customScalingFunction(min, max, total, value) {
+ if (max === min) {
+ return 0.5;
+ } else {
+ var scale = 1 / (max - min);
+ return Math.max(0, (value - min) * scale);
+ }
+ }
+ },
+ selectionWidth: 1.5,
+ selfReferenceSize: 20,
+ shadow: {
+ enabled: false,
+ color: 'rgba(0,0,0,0.5)',
+ size: 10,
+ x: 5,
+ y: 5
+ },
+ smooth: {
+ enabled: true,
+ type: "dynamic",
+ forceDirection: 'none',
+ roundness: 0.5
+ },
+ title: undefined,
+ width: 1,
+ value: undefined
+ };
+
+ util.extend(this.options, this.defaultOptions);
+
+ this.bindEventListeners();
+ }
+
+ (0, _createClass3['default'])(EdgesHandler, [{
+ key: 'bindEventListeners',
+ value: function bindEventListeners() {
+ var _this2 = this;
+
+ // this allows external modules to force all dynamic curves to turn static.
+ this.body.emitter.on("_forceDisableDynamicCurves", function (type) {
+ if (type === 'dynamic') {
+ type = 'continuous';
+ }
+ var emitChange = false;
+ for (var edgeId in _this2.body.edges) {
+ if (_this2.body.edges.hasOwnProperty(edgeId)) {
+ var edge = _this2.body.edges[edgeId];
+ var edgeData = _this2.body.data.edges._data[edgeId];
+
+ // only forcibly remove the smooth curve if the data has been set of the edge has the smooth curves defined.
+ // this is because a change in the global would not affect these curves.
+ if (edgeData !== undefined) {
+ var edgeOptions = edgeData.smooth;
+ if (edgeOptions !== undefined) {
+ if (edgeOptions.enabled === true && edgeOptions.type === 'dynamic') {
+ if (type === undefined) {
+ edge.setOptions({ smooth: false });
+ } else {
+ edge.setOptions({ smooth: { type: type } });
+ }
+ emitChange = true;
+ }
+ }
+ }
+ }
+ }
+ if (emitChange === true) {
+ _this2.body.emitter.emit("_dataChanged");
+ }
+ });
+
+ // this is called when options of EXISTING nodes or edges have changed.
+ this.body.emitter.on("_dataUpdated", function () {
+ _this2.reconnectEdges();
+ });
+
+ // refresh the edges. Used when reverting from hierarchical layout
+ this.body.emitter.on("refreshEdges", this.refresh.bind(this));
+ this.body.emitter.on("refresh", this.refresh.bind(this));
+ this.body.emitter.on("destroy", function () {
+ util.forEach(_this2.edgesListeners, function (callback, event) {
+ if (_this2.body.data.edges) _this2.body.data.edges.off(event, callback);
+ });
+ delete _this2.body.functions.createEdge;
+ delete _this2.edgesListeners.add;
+ delete _this2.edgesListeners.update;
+ delete _this2.edgesListeners.remove;
+ delete _this2.edgesListeners;
+ });
+ }
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ this.edgeOptions = options;
+ if (options !== undefined) {
+ // use the parser from the Edge class to fill in all shorthand notations
+ _Edge2['default'].parseOptions(this.options, options);
+
+ // update smooth settings in all edges
+ var dataChanged = false;
+ if (options.smooth !== undefined) {
+ for (var edgeId in this.body.edges) {
+ if (this.body.edges.hasOwnProperty(edgeId)) {
+ dataChanged = this.body.edges[edgeId].updateEdgeType() || dataChanged;
+ }
+ }
+ }
+
+ // update fonts in all edges
+ if (options.font !== undefined) {
+ // use the parser from the Label class to fill in all shorthand notations
+ _Label2['default'].parseOptions(this.options.font, options);
+ for (var _edgeId in this.body.edges) {
+ if (this.body.edges.hasOwnProperty(_edgeId)) {
+ this.body.edges[_edgeId].updateLabelModule();
+ }
+ }
+ }
+
+ // update the state of the variables if needed
+ if (options.hidden !== undefined || options.physics !== undefined || dataChanged === true) {
+ this.body.emitter.emit('_dataChanged');
+ }
+ }
+ }
+
+ /**
+ * Load edges by reading the data table
+ * @param {Array | DataSet | DataView} edges The data containing the edges.
+ * @private
+ * @private
+ */
+
+ }, {
+ key: 'setData',
+ value: function setData(edges) {
+ var _this3 = this;
+
+ var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ var oldEdgesData = this.body.data.edges;
+
+ if (edges instanceof DataSet || edges instanceof DataView) {
+ this.body.data.edges = edges;
+ } else if (Array.isArray(edges)) {
+ this.body.data.edges = new DataSet();
+ this.body.data.edges.add(edges);
+ } else if (!edges) {
+ this.body.data.edges = new DataSet();
+ } else {
+ throw new TypeError('Array or DataSet expected');
+ }
+
+ // TODO: is this null or undefined or false?
+ if (oldEdgesData) {
+ // unsubscribe from old dataset
+ util.forEach(this.edgesListeners, function (callback, event) {
+ oldEdgesData.off(event, callback);
+ });
+ }
+
+ // remove drawn edges
+ this.body.edges = {};
+
+ // TODO: is this null or undefined or false?
+ if (this.body.data.edges) {
+ // subscribe to new dataset
+ util.forEach(this.edgesListeners, function (callback, event) {
+ _this3.body.data.edges.on(event, callback);
+ });
+
+ // draw all new nodes
+ var ids = this.body.data.edges.getIds();
+ this.add(ids, true);
+ }
+
+ if (doNotEmit === false) {
+ this.body.emitter.emit("_dataChanged");
+ }
+ }
+
+ /**
+ * Add edges
+ * @param {Number[] | String[]} ids
+ * @private
+ */
+
+ }, {
+ key: 'add',
+ value: function add(ids) {
+ var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ var edges = this.body.edges;
+ var edgesData = this.body.data.edges;
+
+ for (var i = 0; i < ids.length; i++) {
+ var id = ids[i];
+
+ var oldEdge = edges[id];
+ if (oldEdge) {
+ oldEdge.disconnect();
+ }
+
+ var data = edgesData.get(id, { "showInternalIds": true });
+ edges[id] = this.create(data);
+ }
+
+ if (doNotEmit === false) {
+ this.body.emitter.emit("_dataChanged");
+ }
+ }
+
+ /**
+ * Update existing edges, or create them when not yet existing
+ * @param {Number[] | String[]} ids
+ * @private
+ */
+
+ }, {
+ key: 'update',
+ value: function update(ids) {
+ var edges = this.body.edges;
+ var edgesData = this.body.data.edges;
+ var dataChanged = false;
+ for (var i = 0; i < ids.length; i++) {
+ var id = ids[i];
+ var data = edgesData.get(id);
+ var edge = edges[id];
+ if (edge !== undefined) {
+ // update edge
+ edge.disconnect();
+ dataChanged = edge.setOptions(data) || dataChanged; // if a support node is added, data can be changed.
+ edge.connect();
+ } else {
+ // create edge
+ this.body.edges[id] = this.create(data);
+ dataChanged = true;
+ }
+ }
+
+ if (dataChanged === true) {
+ this.body.emitter.emit("_dataChanged");
+ } else {
+ this.body.emitter.emit("_dataUpdated");
+ }
+ }
+
+ /**
+ * Remove existing edges. Non existing ids will be ignored
+ * @param {Number[] | String[]} ids
+ * @private
+ */
+
+ }, {
+ key: 'remove',
+ value: function remove(ids) {
+ var edges = this.body.edges;
+ for (var i = 0; i < ids.length; i++) {
+ var id = ids[i];
+ var edge = edges[id];
+ if (edge !== undefined) {
+ edge.cleanup();
+ edge.disconnect();
+ delete edges[id];
+ }
+ }
+
+ this.body.emitter.emit("_dataChanged");
+ }
+ }, {
+ key: 'refresh',
+ value: function refresh() {
+ var edges = this.body.edges;
+ for (var edgeId in edges) {
+ var edge = undefined;
+ if (edges.hasOwnProperty(edgeId)) {
+ edge = edges[edgeId];
+ }
+ var data = this.body.data.edges._data[edgeId];
+ if (edge !== undefined && data !== undefined) {
+ edge.setOptions(data);
+ }
+ }
+ }
+ }, {
+ key: 'create',
+ value: function create(properties) {
+ return new _Edge2['default'](properties, this.body, this.options, this.defaultOptions, this.edgeOptions);
+ }
+
+ /**
+ * Reconnect all edges
+ * @private
+ */
+
+ }, {
+ key: 'reconnectEdges',
+ value: function reconnectEdges() {
+ var id;
+ var nodes = this.body.nodes;
+ var edges = this.body.edges;
+
+ for (id in nodes) {
+ if (nodes.hasOwnProperty(id)) {
+ nodes[id].edges = [];
+ }
+ }
+
+ for (id in edges) {
+ if (edges.hasOwnProperty(id)) {
+ var edge = edges[id];
+ edge.from = null;
+ edge.to = null;
+ edge.connect();
+ }
+ }
+ }
+ }, {
+ key: 'getConnectedNodes',
+ value: function getConnectedNodes(edgeId) {
+ var nodeList = [];
+ if (this.body.edges[edgeId] !== undefined) {
+ var edge = this.body.edges[edgeId];
+ if (edge.fromId) {
+ nodeList.push(edge.fromId);
+ }
+ if (edge.toId) {
+ nodeList.push(edge.toId);
+ }
+ }
+ return nodeList;
+ }
+ }]);
+ return EdgesHandler;
+ }();
+
+ exports['default'] = EdgesHandler;
+
+/***/ },
+/* 192 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ var _create = __webpack_require__(55);
+
+ var _create2 = _interopRequireDefault(_create);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _Label = __webpack_require__(160);
+
+ var _Label2 = _interopRequireDefault(_Label);
+
+ var _CubicBezierEdge = __webpack_require__(193);
+
+ var _CubicBezierEdge2 = _interopRequireDefault(_CubicBezierEdge);
+
+ var _BezierEdgeDynamic = __webpack_require__(197);
+
+ var _BezierEdgeDynamic2 = _interopRequireDefault(_BezierEdgeDynamic);
+
+ var _BezierEdgeStatic = __webpack_require__(198);
+
+ var _BezierEdgeStatic2 = _interopRequireDefault(_BezierEdgeStatic);
+
+ var _StraightEdge = __webpack_require__(199);
+
+ var _StraightEdge2 = _interopRequireDefault(_StraightEdge);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ /**
+ * @class Edge
+ *
+ * A edge connects two nodes
+ * @param {Object} properties Object with options. Must contain
+ * At least options from and to.
+ * Available options: from (number),
+ * to (number), label (string, color (string),
+ * width (number), style (string),
+ * length (number), title (string)
+ * @param {Network} network A Network object, used to find and edge to
+ * nodes.
+ * @param {Object} constants An object with default values for
+ * example for the color
+ */
+ var Edge = function () {
+ function Edge(options, body, globalOptions, defaultOptions, edgeOptions) {
+ (0, _classCallCheck3['default'])(this, Edge);
+
+ if (body === undefined) {
+ throw "No body provided";
+ }
+ this.options = util.bridgeObject(globalOptions);
+ this.globalOptions = globalOptions;
+ this.defaultOptions = defaultOptions;
+ this.edgeOptions = edgeOptions;
+ this.body = body;
+
+ // initialize variables
+ this.id = undefined;
+ this.fromId = undefined;
+ this.toId = undefined;
+ this.selected = false;
+ this.hover = false;
+ this.labelDirty = true;
+
+ this.baseWidth = this.options.width;
+ this.baseFontSize = this.options.font.size;
+
+ this.from = undefined; // a node
+ this.to = undefined; // a node
+
+ this.edgeType = undefined;
+
+ this.connected = false;
+
+ this.labelModule = new _Label2['default'](this.body, this.options, true /* It's an edge label */);
+ this.setOptions(options);
+ }
+
+ /**
+ * Set or overwrite options for the edge
+ * @param {Object} options an object with options
+ * @param doNotEmit
+ */
+
+
+ (0, _createClass3['default'])(Edge, [{
+ key: 'setOptions',
+ value: function setOptions(options) {
+ if (!options) {
+ return;
+ }
+
+ Edge.parseOptions(this.options, options, true, this.globalOptions);
+
+ if (options.id !== undefined) {
+ this.id = options.id;
+ }
+ if (options.from !== undefined) {
+ this.fromId = options.from;
+ }
+ if (options.to !== undefined) {
+ this.toId = options.to;
+ }
+ if (options.title !== undefined) {
+ this.title = options.title;
+ }
+ if (options.value !== undefined) {
+ options.value = parseFloat(options.value);
+ }
+
+ this.choosify(options);
+
+ // update label Module
+ this.updateLabelModule(options);
+ this.labelModule.propagateFonts(this.edgeOptions, options, this.defaultOptions);
+
+ var dataChanged = this.updateEdgeType();
+
+ // if anything has been updates, reset the selection width and the hover width
+ this._setInteractionWidths();
+
+ // A node is connected when it has a from and to node that both exist in the network.body.nodes.
+ this.connect();
+
+ if (options.hidden !== undefined || options.physics !== undefined) {
+ dataChanged = true;
+ }
+
+ return dataChanged;
+ }
+ }, {
+ key: 'choosify',
+ value: function choosify(options) {
+ this.chooser = true;
+
+ var pile = [options, this.options, this.defaultOptions];
+
+ var chosen = util.topMost(pile, 'chosen');
+ if (typeof chosen === 'boolean') {
+ this.chooser = chosen;
+ } else if ((typeof chosen === 'undefined' ? 'undefined' : (0, _typeof3['default'])(chosen)) === 'object') {
+ var chosenEdge = util.topMost(pile, ['chosen', 'edge']);
+ if (typeof chosenEdge === 'boolean' || typeof chosenEdge === 'function') {
+ this.chooser = chosenEdge;
+ }
+ }
+ }
+ }, {
+ key: 'getFormattingValues',
+ value: function getFormattingValues() {
+ var toArrow = this.options.arrows.to === true || this.options.arrows.to.enabled === true;
+ var fromArrow = this.options.arrows.from === true || this.options.arrows.from.enabled === true;
+ var middleArrow = this.options.arrows.middle === true || this.options.arrows.middle.enabled === true;
+ var inheritsColor = this.options.color.inherit;
+ var values = {
+ toArrow: toArrow,
+ toArrowScale: this.options.arrows.to.scaleFactor,
+ toArrowType: this.options.arrows.to.type,
+ middleArrow: middleArrow,
+ middleArrowScale: this.options.arrows.middle.scaleFactor,
+ middleArrowType: this.options.arrows.middle.type,
+ fromArrow: fromArrow,
+ fromArrowScale: this.options.arrows.from.scaleFactor,
+ fromArrowType: this.options.arrows.from.type,
+ arrowStrikethrough: this.options.arrowStrikethrough,
+ color: inheritsColor ? undefined : this.options.color.color,
+ inheritsColor: inheritsColor,
+ opacity: this.options.color.opacity,
+ hidden: this.options.hidden,
+ length: this.options.length,
+ shadow: this.options.shadow.enabled,
+ shadowColor: this.options.shadow.color,
+ shadowSize: this.options.shadow.size,
+ shadowX: this.options.shadow.x,
+ shadowY: this.options.shadow.y,
+ dashes: this.options.dashes,
+ width: this.options.width
+ };
+ if (this.selected || this.hover) {
+ if (this.chooser === true) {
+ if (this.selected) {
+ var selectedWidth = this.options.selectionWidth;
+ if (typeof selectedWidth === 'function') {
+ values.width = selectedWidth(values.width);
+ } else if (typeof selectedWidth === 'number') {
+ values.width += selectedWidth;
+ }
+ values.width = Math.max(values.width, 0.3 / this.body.view.scale);
+ values.color = this.options.color.highlight;
+ values.shadow = this.options.shadow.enabled;
+ } else if (this.hover) {
+ var hoverWidth = this.options.hoverWidth;
+ if (typeof hoverWidth === 'function') {
+ values.width = hoverWidth(values.width);
+ } else if (typeof hoverWidth === 'number') {
+ values.width += hoverWidth;
+ }
+ values.width = Math.max(values.width, 0.3 / this.body.view.scale);
+ values.color = this.options.color.hover;
+ values.shadow = this.options.shadow.enabled;
+ }
+ } else if (typeof this.chooser === 'function') {
+ this.chooser(values, this.options.id, this.selected, this.hover);
+ if (values.color !== undefined) {
+ values.inheritsColor = false;
+ }
+ if (values.shadow === false) {
+ if (values.shadowColor !== this.options.shadow.color || values.shadowSize !== this.options.shadow.size || values.shadowX !== this.options.shadow.x || values.shadowY !== this.options.shadow.y) {
+ values.shadow = true;
+ }
+ }
+ }
+ } else {
+ values.shadow = this.options.shadow.enabled;
+ values.width = Math.max(values.width, 0.3 / this.body.view.scale);
+ }
+ return values;
+ }
+
+ /**
+ * update the options in the label module
+ */
+
+ }, {
+ key: 'updateLabelModule',
+ value: function updateLabelModule(options) {
+ this.labelModule.setOptions(this.options, true);
+ if (this.labelModule.baseSize !== undefined) {
+ this.baseFontSize = this.labelModule.baseSize;
+ }
+ this.labelModule.constrain(this.edgeOptions, options, this.defaultOptions);
+ this.labelModule.choosify(this.edgeOptions, options, this.defaultOptions);
+ }
+
+ /**
+ * update the edge type, set the options
+ * @returns {boolean}
+ */
+
+ }, {
+ key: 'updateEdgeType',
+ value: function updateEdgeType() {
+ var smooth = this.options.smooth;
+ var dataChanged = false;
+ var changeInType = true;
+ if (this.edgeType !== undefined) {
+ if (this.edgeType instanceof _BezierEdgeDynamic2['default'] && smooth.enabled === true && smooth.type === 'dynamic' || this.edgeType instanceof _CubicBezierEdge2['default'] && smooth.enabled === true && smooth.type === 'cubicBezier' || this.edgeType instanceof _BezierEdgeStatic2['default'] && smooth.enabled === true && smooth.type !== 'dynamic' && smooth.type !== 'cubicBezier' || this.edgeType instanceof _StraightEdge2['default'] && smooth.type.enabled === false) {
+ changeInType = false;
+ }
+ if (changeInType === true) {
+ dataChanged = this.cleanup();
+ }
+ }
+ if (changeInType === true) {
+ if (smooth.enabled === true) {
+ if (smooth.type === 'dynamic') {
+ dataChanged = true;
+ this.edgeType = new _BezierEdgeDynamic2['default'](this.options, this.body, this.labelModule);
+ } else if (smooth.type === 'cubicBezier') {
+ this.edgeType = new _CubicBezierEdge2['default'](this.options, this.body, this.labelModule);
+ } else {
+ this.edgeType = new _BezierEdgeStatic2['default'](this.options, this.body, this.labelModule);
+ }
+ } else {
+ this.edgeType = new _StraightEdge2['default'](this.options, this.body, this.labelModule);
+ }
+ } else {
+ // if nothing changes, we just set the options.
+ this.edgeType.setOptions(this.options);
+ }
+ return dataChanged;
+ }
+
+ /**
+ * Connect an edge to its nodes
+ */
+
+ }, {
+ key: 'connect',
+ value: function connect() {
+ this.disconnect();
+
+ this.from = this.body.nodes[this.fromId] || undefined;
+ this.to = this.body.nodes[this.toId] || undefined;
+ this.connected = this.from !== undefined && this.to !== undefined;
+
+ if (this.connected === true) {
+ this.from.attachEdge(this);
+ this.to.attachEdge(this);
+ } else {
+ if (this.from) {
+ this.from.detachEdge(this);
+ }
+ if (this.to) {
+ this.to.detachEdge(this);
+ }
+ }
+
+ this.edgeType.connect();
+ }
+
+ /**
+ * Disconnect an edge from its nodes
+ */
+
+ }, {
+ key: 'disconnect',
+ value: function disconnect() {
+ if (this.from) {
+ this.from.detachEdge(this);
+ this.from = undefined;
+ }
+ if (this.to) {
+ this.to.detachEdge(this);
+ this.to = undefined;
+ }
+
+ this.connected = false;
+ }
+
+ /**
+ * get the title of this edge.
+ * @return {string} title The title of the edge, or undefined when no title
+ * has been set.
+ */
+
+ }, {
+ key: 'getTitle',
+ value: function getTitle() {
+ return this.title;
+ }
+
+ /**
+ * check if this node is selecte
+ * @return {boolean} selected True if node is selected, else false
+ */
+
+ }, {
+ key: 'isSelected',
+ value: function isSelected() {
+ return this.selected;
+ }
+
+ /**
+ * Retrieve the value of the edge. Can be undefined
+ * @return {Number} value
+ */
+
+ }, {
+ key: 'getValue',
+ value: function getValue() {
+ return this.options.value;
+ }
+
+ /**
+ * Adjust the value range of the edge. The edge will adjust it's width
+ * based on its value.
+ * @param {Number} min
+ * @param {Number} max
+ * @param total
+ */
+
+ }, {
+ key: 'setValueRange',
+ value: function setValueRange(min, max, total) {
+ if (this.options.value !== undefined) {
+ var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value);
+ var widthDiff = this.options.scaling.max - this.options.scaling.min;
+ if (this.options.scaling.label.enabled === true) {
+ var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min;
+ this.options.font.size = this.options.scaling.label.min + scale * fontDiff;
+ }
+ this.options.width = this.options.scaling.min + scale * widthDiff;
+ } else {
+ this.options.width = this.baseWidth;
+ this.options.font.size = this.baseFontSize;
+ }
+
+ this._setInteractionWidths();
+ this.updateLabelModule();
+ }
+ }, {
+ key: '_setInteractionWidths',
+ value: function _setInteractionWidths() {
+ if (typeof this.options.hoverWidth === 'function') {
+ this.edgeType.hoverWidth = this.options.hoverWidth(this.options.width);
+ } else {
+ this.edgeType.hoverWidth = this.options.hoverWidth + this.options.width;
+ }
+ if (typeof this.options.selectionWidth === 'function') {
+ this.edgeType.selectionWidth = this.options.selectionWidth(this.options.width);
+ } else {
+ this.edgeType.selectionWidth = this.options.selectionWidth + this.options.width;
+ }
+ }
+
+ /**
+ * Redraw a edge
+ * Draw this edge in the given canvas
+ * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
+ * @param {CanvasRenderingContext2D} ctx
+ */
+
+ }, {
+ key: 'draw',
+ value: function draw(ctx) {
+ var values = this.getFormattingValues();
+ if (values.hidden) {
+ return;
+ }
+
+ // get the via node from the edge type
+ var viaNode = this.edgeType.getViaNode();
+ var arrowData = {};
+
+ // restore edge targets to defaults
+ this.edgeType.fromPoint = this.edgeType.from;
+ this.edgeType.toPoint = this.edgeType.to;
+
+ // from and to arrows give a different end point for edges. we set them here
+ if (values.fromArrow) {
+ arrowData.from = this.edgeType.getArrowData(ctx, 'from', viaNode, this.selected, this.hover, values);
+ if (values.arrowStrikethrough === false) this.edgeType.fromPoint = arrowData.from.core;
+ }
+ if (values.toArrow) {
+ arrowData.to = this.edgeType.getArrowData(ctx, 'to', viaNode, this.selected, this.hover, values);
+ if (values.arrowStrikethrough === false) this.edgeType.toPoint = arrowData.to.core;
+ }
+
+ // the middle arrow depends on the line, which can depend on the to and from arrows so we do this one lastly.
+ if (values.middleArrow) {
+ arrowData.middle = this.edgeType.getArrowData(ctx, 'middle', viaNode, this.selected, this.hover, values);
+ }
+
+ // draw everything
+ this.edgeType.drawLine(ctx, values, this.selected, this.hover, viaNode);
+ this.drawArrows(ctx, arrowData, values);
+ this.drawLabel(ctx, viaNode);
+ }
+ }, {
+ key: 'drawArrows',
+ value: function drawArrows(ctx, arrowData, values) {
+ if (values.fromArrow) {
+ this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.from);
+ }
+ if (values.middleArrow) {
+ this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.middle);
+ }
+ if (values.toArrow) {
+ this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.to);
+ }
+ }
+ }, {
+ key: 'drawLabel',
+ value: function drawLabel(ctx, viaNode) {
+ if (this.options.label !== undefined) {
+ // set style
+ var node1 = this.from;
+ var node2 = this.to;
+ var selected = this.from.selected || this.to.selected || this.selected;
+ if (node1.id != node2.id) {
+ this.labelModule.pointToSelf = false;
+ var point = this.edgeType.getPoint(0.5, viaNode);
+ ctx.save();
+
+ // if the label has to be rotated:
+ if (this.options.font.align !== "horizontal") {
+ this.labelModule.calculateLabelSize(ctx, selected, this.hover, point.x, point.y);
+ ctx.translate(point.x, this.labelModule.size.yLine);
+ this._rotateForLabelAlignment(ctx);
+ }
+
+ // draw the label
+ this.labelModule.draw(ctx, point.x, point.y, selected, this.hover);
+ ctx.restore();
+ } else {
+ // Ignore the orientations.
+ this.labelModule.pointToSelf = true;
+ var x, y;
+ var radius = this.options.selfReferenceSize;
+ if (node1.shape.width > node1.shape.height) {
+ x = node1.x + node1.shape.width * 0.5;
+ y = node1.y - radius;
+ } else {
+ x = node1.x + radius;
+ y = node1.y - node1.shape.height * 0.5;
+ }
+ point = this._pointOnCircle(x, y, radius, 0.125);
+ this.labelModule.draw(ctx, point.x, point.y, selected, this.hover);
+ }
+ }
+ }
+
+ /**
+ * Check if this object is overlapping with the provided object
+ * @param {Object} obj an object with parameters left, top
+ * @return {boolean} True if location is located on the edge
+ */
+
+ }, {
+ key: 'isOverlappingWith',
+ value: function isOverlappingWith(obj) {
+ if (this.connected) {
+ var distMax = 10;
+ var xFrom = this.from.x;
+ var yFrom = this.from.y;
+ var xTo = this.to.x;
+ var yTo = this.to.y;
+ var xObj = obj.left;
+ var yObj = obj.top;
+
+ var dist = this.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj);
+
+ return dist < distMax;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Rotates the canvas so the text is most readable
+ * @param {CanvasRenderingContext2D} ctx
+ * @private
+ */
+
+ }, {
+ key: '_rotateForLabelAlignment',
+ value: function _rotateForLabelAlignment(ctx) {
+ var dy = this.from.y - this.to.y;
+ var dx = this.from.x - this.to.x;
+ var angleInDegrees = Math.atan2(dy, dx);
+
+ // rotate so label it is readable
+ if (angleInDegrees < -1 && dx < 0 || angleInDegrees > 0 && dx < 0) {
+ angleInDegrees = angleInDegrees + Math.PI;
+ }
+
+ ctx.rotate(angleInDegrees);
+ }
+
+ /**
+ * Get a point on a circle
+ * @param {Number} x
+ * @param {Number} y
+ * @param {Number} radius
+ * @param {Number} percentage. Value between 0 (line start) and 1 (line end)
+ * @return {Object} point
+ * @private
+ */
+
+ }, {
+ key: '_pointOnCircle',
+ value: function _pointOnCircle(x, y, radius, percentage) {
+ var angle = percentage * 2 * Math.PI;
+ return {
+ x: x + radius * Math.cos(angle),
+ y: y - radius * Math.sin(angle)
+ };
+ }
+ }, {
+ key: 'select',
+ value: function select() {
+ this.selected = true;
+ }
+ }, {
+ key: 'unselect',
+ value: function unselect() {
+ this.selected = false;
+ }
+
+ /**
+ * cleans all required things on delete
+ * @returns {*}
+ */
+
+ }, {
+ key: 'cleanup',
+ value: function cleanup() {
+ return this.edgeType.cleanup();
+ }
+ }], [{
+ key: 'parseOptions',
+ value: function parseOptions(parentOptions, newOptions) {
+ var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ var fields = ['arrowStrikethrough', 'id', 'from', 'hidden', 'hoverWidth', 'label', 'labelHighlightBold', 'length', 'line', 'opacity', 'physics', 'scaling', 'selectionWidth', 'selfReferenceSize', 'to', 'title', 'value', 'width'];
+
+ // only deep extend the items in the field array. These do not have shorthand.
+ util.selectiveDeepExtend(fields, parentOptions, newOptions, allowDeletion);
+
+ util.mergeOptions(parentOptions, newOptions, 'smooth', allowDeletion, globalOptions);
+ util.mergeOptions(parentOptions, newOptions, 'shadow', allowDeletion, globalOptions);
+
+ if (newOptions.dashes !== undefined && newOptions.dashes !== null) {
+ parentOptions.dashes = newOptions.dashes;
+ } else if (allowDeletion === true && newOptions.dashes === null) {
+ parentOptions.dashes = (0, _create2['default'])(globalOptions.dashes); // this sets the pointer of the option back to the global option.
+ }
+
+ // set the scaling newOptions
+ if (newOptions.scaling !== undefined && newOptions.scaling !== null) {
+ if (newOptions.scaling.min !== undefined) {
+ parentOptions.scaling.min = newOptions.scaling.min;
+ }
+ if (newOptions.scaling.max !== undefined) {
+ parentOptions.scaling.max = newOptions.scaling.max;
+ }
+ util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', allowDeletion, globalOptions.scaling);
+ } else if (allowDeletion === true && newOptions.scaling === null) {
+ parentOptions.scaling = (0, _create2['default'])(globalOptions.scaling); // this sets the pointer of the option back to the global option.
+ }
+
+ // handle multiple input cases for arrows
+ if (newOptions.arrows !== undefined && newOptions.arrows !== null) {
+ if (typeof newOptions.arrows === 'string') {
+ var arrows = newOptions.arrows.toLowerCase();
+ parentOptions.arrows.to.enabled = arrows.indexOf("to") != -1;
+ parentOptions.arrows.middle.enabled = arrows.indexOf("middle") != -1;
+ parentOptions.arrows.from.enabled = arrows.indexOf("from") != -1;
+ } else if ((0, _typeof3['default'])(newOptions.arrows) === 'object') {
+ util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'to', allowDeletion, globalOptions.arrows);
+ util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'middle', allowDeletion, globalOptions.arrows);
+ util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'from', allowDeletion, globalOptions.arrows);
+ } else {
+ throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:" + (0, _stringify2['default'])(newOptions.arrows));
+ }
+ } else if (allowDeletion === true && newOptions.arrows === null) {
+ parentOptions.arrows = (0, _create2['default'])(globalOptions.arrows); // this sets the pointer of the option back to the global option.
+ }
+
+ // handle multiple input cases for color
+ if (newOptions.color !== undefined && newOptions.color !== null) {
+ // make a copy of the parent object in case this is referring to the global one (due to object create once, then update)
+ parentOptions.color = util.deepExtend({}, parentOptions.color, true);
+ if (util.isString(newOptions.color)) {
+ parentOptions.color.color = newOptions.color;
+ parentOptions.color.highlight = newOptions.color;
+ parentOptions.color.hover = newOptions.color;
+ parentOptions.color.inherit = false;
+ } else {
+ var colorsDefined = false;
+ if (newOptions.color.color !== undefined) {
+ parentOptions.color.color = newOptions.color.color;colorsDefined = true;
+ }
+ if (newOptions.color.highlight !== undefined) {
+ parentOptions.color.highlight = newOptions.color.highlight;colorsDefined = true;
+ }
+ if (newOptions.color.hover !== undefined) {
+ parentOptions.color.hover = newOptions.color.hover;colorsDefined = true;
+ }
+ if (newOptions.color.inherit !== undefined) {
+ parentOptions.color.inherit = newOptions.color.inherit;
+ }
+ if (newOptions.color.opacity !== undefined) {
+ parentOptions.color.opacity = Math.min(1, Math.max(0, newOptions.color.opacity));
+ }
+
+ if (newOptions.color.inherit === undefined && colorsDefined === true) {
+ parentOptions.color.inherit = false;
+ }
+ }
+ } else if (allowDeletion === true && newOptions.color === null) {
+ parentOptions.color = util.bridgeObject(globalOptions.color); // set the object back to the global options
+ }
+
+ // handle the font settings
+ if (newOptions.font !== undefined && newOptions.font !== null) {
+ _Label2['default'].parseOptions(parentOptions.font, newOptions);
+ } else if (allowDeletion === true && newOptions.font === null) {
+ parentOptions.font = util.bridgeObject(globalOptions.font); // set the object back to the global options
+ }
+ }
+ }]);
+ return Edge;
+ }();
+
+ exports['default'] = Edge;
+
+/***/ },
+/* 193 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _slicedToArray2 = __webpack_require__(161);
+
+ var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _CubicBezierEdgeBase2 = __webpack_require__(194);
+
+ var _CubicBezierEdgeBase3 = _interopRequireDefault(_CubicBezierEdgeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var CubicBezierEdge = function (_CubicBezierEdgeBase) {
+ (0, _inherits3['default'])(CubicBezierEdge, _CubicBezierEdgeBase);
+
+ function CubicBezierEdge(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, CubicBezierEdge);
+ return (0, _possibleConstructorReturn3['default'])(this, (CubicBezierEdge.__proto__ || (0, _getPrototypeOf2['default'])(CubicBezierEdge)).call(this, options, body, labelModule));
+ }
+
+ /**
+ * Draw a line between two nodes
+ * @param {CanvasRenderingContext2D} ctx
+ * @private
+ */
+
+
+ (0, _createClass3['default'])(CubicBezierEdge, [{
+ key: '_line',
+ value: function _line(ctx, values, viaNodes) {
+ // get the coordinates of the support points.
+ var via1 = viaNodes[0];
+ var via2 = viaNodes[1];
+
+ // start drawing the line.
+ ctx.beginPath();
+ ctx.moveTo(this.fromPoint.x, this.fromPoint.y);
+
+ // fallback to normal straight edges
+ if (viaNodes === undefined || via1.x === undefined) {
+ ctx.lineTo(this.toPoint.x, this.toPoint.y);
+ } else {
+ ctx.bezierCurveTo(via1.x, via1.y, via2.x, via2.y, this.toPoint.x, this.toPoint.y);
+ }
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ ctx.stroke();
+ this.disableShadow(ctx, values);
+ }
+ }, {
+ key: '_getViaCoordinates',
+ value: function _getViaCoordinates() {
+ var dx = this.from.x - this.to.x;
+ var dy = this.from.y - this.to.y;
+
+ var x1 = void 0,
+ y1 = void 0,
+ x2 = void 0,
+ y2 = void 0;
+ var roundness = this.options.smooth.roundness;
+
+ // horizontal if x > y or if direction is forced or if direction is horizontal
+ if ((Math.abs(dx) > Math.abs(dy) || this.options.smooth.forceDirection === true || this.options.smooth.forceDirection === 'horizontal') && this.options.smooth.forceDirection !== 'vertical') {
+ y1 = this.from.y;
+ y2 = this.to.y;
+ x1 = this.from.x - roundness * dx;
+ x2 = this.to.x + roundness * dx;
+ } else {
+ y1 = this.from.y - roundness * dy;
+ y2 = this.to.y + roundness * dy;
+ x1 = this.from.x;
+ x2 = this.to.x;
+ }
+
+ return [{ x: x1, y: y1 }, { x: x2, y: y2 }];
+ }
+ }, {
+ key: 'getViaNode',
+ value: function getViaNode() {
+ return this._getViaCoordinates();
+ }
+ }, {
+ key: '_findBorderPosition',
+ value: function _findBorderPosition(nearNode, ctx) {
+ return this._findBorderPositionBezier(nearNode, ctx);
+ }
+ }, {
+ key: '_getDistanceToEdge',
+ value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
+ var _ref = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : this._getViaCoordinates(),
+ _ref2 = (0, _slicedToArray3['default'])(_ref, 2),
+ via1 = _ref2[0],
+ via2 = _ref2[1];
+
+ // x3,y3 is the point
+ return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via1, via2);
+ }
+
+ /**
+ * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way
+ * @param percentage
+ * @param via
+ * @returns {{x: number, y: number}}
+ * @private
+ */
+
+ }, {
+ key: 'getPoint',
+ value: function getPoint(percentage) {
+ var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._getViaCoordinates(),
+ _ref4 = (0, _slicedToArray3['default'])(_ref3, 2),
+ via1 = _ref4[0],
+ via2 = _ref4[1];
+
+ var t = percentage;
+ var vec = [];
+ vec[0] = Math.pow(1 - t, 3);
+ vec[1] = 3 * t * Math.pow(1 - t, 2);
+ vec[2] = 3 * Math.pow(t, 2) * (1 - t);
+ vec[3] = Math.pow(t, 3);
+ var x = vec[0] * this.fromPoint.x + vec[1] * via1.x + vec[2] * via2.x + vec[3] * this.toPoint.x;
+ var y = vec[0] * this.fromPoint.y + vec[1] * via1.y + vec[2] * via2.y + vec[3] * this.toPoint.y;
+
+ return { x: x, y: y };
+ }
+ }]);
+ return CubicBezierEdge;
+ }(_CubicBezierEdgeBase3['default']);
+
+ exports['default'] = CubicBezierEdge;
+
+/***/ },
+/* 194 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _BezierEdgeBase2 = __webpack_require__(195);
+
+ var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var CubicBezierEdgeBase = function (_BezierEdgeBase) {
+ (0, _inherits3['default'])(CubicBezierEdgeBase, _BezierEdgeBase);
+
+ function CubicBezierEdgeBase(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, CubicBezierEdgeBase);
+ return (0, _possibleConstructorReturn3['default'])(this, (CubicBezierEdgeBase.__proto__ || (0, _getPrototypeOf2['default'])(CubicBezierEdgeBase)).call(this, options, body, labelModule));
+ }
+
+ /**
+ * Calculate the distance between a point (x3,y3) and a line segment from
+ * (x1,y1) to (x2,y2).
+ * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
+ * https://en.wikipedia.org/wiki/B%C3%A9zier_curve
+ * @param {number} x1 from x
+ * @param {number} y1 from y
+ * @param {number} x2 to x
+ * @param {number} y2 to y
+ * @param {number} x3 point to check x
+ * @param {number} y3 point to check y
+ * @private
+ */
+
+
+ (0, _createClass3['default'])(CubicBezierEdgeBase, [{
+ key: '_getDistanceToBezierEdge',
+ value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via1, via2) {
+ // x3,y3 is the point
+ var minDistance = 1e9;
+ var distance = void 0;
+ var i = void 0,
+ t = void 0,
+ x = void 0,
+ y = void 0;
+ var lastX = x1;
+ var lastY = y1;
+ var vec = [0, 0, 0, 0];
+ for (i = 1; i < 10; i++) {
+ t = 0.1 * i;
+ vec[0] = Math.pow(1 - t, 3);
+ vec[1] = 3 * t * Math.pow(1 - t, 2);
+ vec[2] = 3 * Math.pow(t, 2) * (1 - t);
+ vec[3] = Math.pow(t, 3);
+ x = vec[0] * x1 + vec[1] * via1.x + vec[2] * via2.x + vec[3] * x2;
+ y = vec[0] * y1 + vec[1] * via1.y + vec[2] * via2.y + vec[3] * y2;
+ if (i > 0) {
+ distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3);
+ minDistance = distance < minDistance ? distance : minDistance;
+ }
+ lastX = x;
+ lastY = y;
+ }
+
+ return minDistance;
+ }
+ }]);
+ return CubicBezierEdgeBase;
+ }(_BezierEdgeBase3['default']);
+
+ exports['default'] = CubicBezierEdgeBase;
+
+/***/ },
+/* 195 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _EdgeBase2 = __webpack_require__(196);
+
+ var _EdgeBase3 = _interopRequireDefault(_EdgeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var BezierEdgeBase = function (_EdgeBase) {
+ (0, _inherits3['default'])(BezierEdgeBase, _EdgeBase);
+
+ function BezierEdgeBase(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, BezierEdgeBase);
+ return (0, _possibleConstructorReturn3['default'])(this, (BezierEdgeBase.__proto__ || (0, _getPrototypeOf2['default'])(BezierEdgeBase)).call(this, options, body, labelModule));
+ }
+
+ /**
+ * This function uses binary search to look for the point where the bezier curve crosses the border of the node.
+ *
+ * @param nearNode
+ * @param ctx
+ * @param viaNode
+ * @param nearNode
+ * @param ctx
+ * @param viaNode
+ * @param nearNode
+ * @param ctx
+ * @param viaNode
+ */
+
+
+ (0, _createClass3['default'])(BezierEdgeBase, [{
+ key: '_findBorderPositionBezier',
+ value: function _findBorderPositionBezier(nearNode, ctx) {
+ var viaNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this._getViaCoordinates();
+
+ var maxIterations = 10;
+ var iteration = 0;
+ var low = 0;
+ var high = 1;
+ var pos, angle, distanceToBorder, distanceToPoint, difference;
+ var threshold = 0.2;
+ var node = this.to;
+ var from = false;
+ if (nearNode.id === this.from.id) {
+ node = this.from;
+ from = true;
+ }
+
+ while (low <= high && iteration < maxIterations) {
+ var middle = (low + high) * 0.5;
+
+ pos = this.getPoint(middle, viaNode);
+ angle = Math.atan2(node.y - pos.y, node.x - pos.x);
+ distanceToBorder = node.distanceToBorder(ctx, angle);
+ distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2));
+ difference = distanceToBorder - distanceToPoint;
+ if (Math.abs(difference) < threshold) {
+ break; // found
+ } else if (difference < 0) {
+ // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node.
+ if (from === false) {
+ low = middle;
+ } else {
+ high = middle;
+ }
+ } else {
+ if (from === false) {
+ high = middle;
+ } else {
+ low = middle;
+ }
+ }
+
+ iteration++;
+ }
+ pos.t = middle;
+
+ return pos;
+ }
+
+ /**
+ * Calculate the distance between a point (x3,y3) and a line segment from
+ * (x1,y1) to (x2,y2).
+ * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
+ * @param {number} x1 from x
+ * @param {number} y1 from y
+ * @param {number} x2 to x
+ * @param {number} y2 to y
+ * @param {number} x3 point to check x
+ * @param {number} y3 point to check y
+ * @private
+ */
+
+ }, {
+ key: '_getDistanceToBezierEdge',
+ value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via) {
+ // x3,y3 is the point
+ var minDistance = 1e9;
+ var distance = void 0;
+ var i = void 0,
+ t = void 0,
+ x = void 0,
+ y = void 0;
+ var lastX = x1;
+ var lastY = y1;
+ for (i = 1; i < 10; i++) {
+ t = 0.1 * i;
+ x = Math.pow(1 - t, 2) * x1 + 2 * t * (1 - t) * via.x + Math.pow(t, 2) * x2;
+ y = Math.pow(1 - t, 2) * y1 + 2 * t * (1 - t) * via.y + Math.pow(t, 2) * y2;
+ if (i > 0) {
+ distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3);
+ minDistance = distance < minDistance ? distance : minDistance;
+ }
+ lastX = x;
+ lastY = y;
+ }
+
+ return minDistance;
+ }
+ }]);
+ return BezierEdgeBase;
+ }(_EdgeBase3['default']);
+
+ exports['default'] = BezierEdgeBase;
+
+/***/ },
+/* 196 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _slicedToArray2 = __webpack_require__(161);
+
+ var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var EdgeBase = function () {
+ function EdgeBase(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, EdgeBase);
+
+ this.body = body;
+ this.labelModule = labelModule;
+ this.options = {};
+ this.setOptions(options);
+ this.colorDirty = true;
+ this.color = {};
+ this.selectionWidth = 2;
+ this.hoverWidth = 1.5;
+ this.fromPoint = this.from;
+ this.toPoint = this.to;
+ }
+
+ (0, _createClass3['default'])(EdgeBase, [{
+ key: 'connect',
+ value: function connect() {
+ this.from = this.body.nodes[this.options.from];
+ this.to = this.body.nodes[this.options.to];
+ }
+ }, {
+ key: 'cleanup',
+ value: function cleanup() {
+ return false;
+ }
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ this.options = options;
+ this.from = this.body.nodes[this.options.from];
+ this.to = this.body.nodes[this.options.to];
+ this.id = this.options.id;
+ }
+
+ /**
+ * Redraw a edge as a line
+ * Draw this edge in the given canvas
+ * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
+ * @param {CanvasRenderingContext2D} ctx
+ * @private
+ */
+
+ }, {
+ key: 'drawLine',
+ value: function drawLine(ctx, values, selected, hover, viaNode) {
+ // set style
+ ctx.strokeStyle = this.getColor(ctx, values, selected, hover);
+ ctx.lineWidth = values.width;
+
+ if (values.dashes !== false) {
+ this._drawDashedLine(ctx, values, viaNode);
+ } else {
+ this._drawLine(ctx, values, viaNode);
+ }
+ }
+ }, {
+ key: '_drawLine',
+ value: function _drawLine(ctx, values, viaNode, fromPoint, toPoint) {
+ if (this.from != this.to) {
+ // draw line
+ this._line(ctx, values, viaNode, fromPoint, toPoint);
+ } else {
+ var _getCircleData2 = this._getCircleData(ctx),
+ _getCircleData3 = (0, _slicedToArray3['default'])(_getCircleData2, 3),
+ x = _getCircleData3[0],
+ y = _getCircleData3[1],
+ radius = _getCircleData3[2];
+
+ this._circle(ctx, values, x, y, radius);
+ }
+ }
+ }, {
+ key: '_drawDashedLine',
+ value: function _drawDashedLine(ctx, values, viaNode, fromPoint, toPoint) {
+ ctx.lineCap = 'round';
+ var pattern = [5, 5];
+ if (Array.isArray(values.dashes) === true) {
+ pattern = values.dashes;
+ }
+
+ // only firefox and chrome support this method, else we use the legacy one.
+ if (ctx.setLineDash !== undefined) {
+ ctx.save();
+
+ // set dash settings for chrome or firefox
+ ctx.setLineDash(pattern);
+ ctx.lineDashOffset = 0;
+
+ // draw the line
+ if (this.from != this.to) {
+ // draw line
+ this._line(ctx, values, viaNode);
+ } else {
+ var _getCircleData4 = this._getCircleData(ctx),
+ _getCircleData5 = (0, _slicedToArray3['default'])(_getCircleData4, 3),
+ x = _getCircleData5[0],
+ y = _getCircleData5[1],
+ radius = _getCircleData5[2];
+
+ this._circle(ctx, values, x, y, radius);
+ }
+
+ // restore the dash settings.
+ ctx.setLineDash([0]);
+ ctx.lineDashOffset = 0;
+ ctx.restore();
+ } else {
+ // unsupporting smooth lines
+ if (this.from != this.to) {
+ // draw line
+ ctx.dashedLine(this.from.x, this.from.y, this.to.x, this.to.y, pattern);
+ } else {
+ var _getCircleData6 = this._getCircleData(ctx),
+ _getCircleData7 = (0, _slicedToArray3['default'])(_getCircleData6, 3),
+ _x = _getCircleData7[0],
+ _y = _getCircleData7[1],
+ _radius = _getCircleData7[2];
+
+ this._circle(ctx, values, _x, _y, _radius);
+ }
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+
+ ctx.stroke();
+
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+ }
+ }
+ }, {
+ key: 'findBorderPosition',
+ value: function findBorderPosition(nearNode, ctx, options) {
+ if (this.from != this.to) {
+ return this._findBorderPosition(nearNode, ctx, options);
+ } else {
+ return this._findBorderPositionCircle(nearNode, ctx, options);
+ }
+ }
+ }, {
+ key: 'findBorderPositions',
+ value: function findBorderPositions(ctx) {
+ var from = {};
+ var to = {};
+ if (this.from != this.to) {
+ from = this._findBorderPosition(this.from, ctx);
+ to = this._findBorderPosition(this.to, ctx);
+ } else {
+ var _getCircleData8 = this._getCircleData(ctx),
+ _getCircleData9 = (0, _slicedToArray3['default'])(_getCircleData8, 3),
+ x = _getCircleData9[0],
+ y = _getCircleData9[1],
+ radius = _getCircleData9[2];
+
+ from = this._findBorderPositionCircle(this.from, ctx, { x: x, y: y, low: 0.25, high: 0.6, direction: -1 });
+ to = this._findBorderPositionCircle(this.from, ctx, { x: x, y: y, low: 0.6, high: 0.8, direction: 1 });
+ }
+ return { from: from, to: to };
+ }
+ }, {
+ key: '_getCircleData',
+ value: function _getCircleData(ctx) {
+ var x = void 0,
+ y = void 0;
+ var node = this.from;
+ var radius = this.options.selfReferenceSize;
+
+ if (ctx !== undefined) {
+ if (node.shape.width === undefined) {
+ node.shape.resize(ctx);
+ }
+ }
+
+ // get circle coordinates
+ if (node.shape.width > node.shape.height) {
+ x = node.x + node.shape.width * 0.5;
+ y = node.y - radius;
+ } else {
+ x = node.x + radius;
+ y = node.y - node.shape.height * 0.5;
+ }
+ return [x, y, radius];
+ }
+
+ /**
+ * Get a point on a circle
+ * @param {Number} x
+ * @param {Number} y
+ * @param {Number} radius
+ * @param {Number} percentage. Value between 0 (line start) and 1 (line end)
+ * @return {Object} point
+ * @private
+ */
+
+ }, {
+ key: '_pointOnCircle',
+ value: function _pointOnCircle(x, y, radius, percentage) {
+ var angle = percentage * 2 * Math.PI;
+ return {
+ x: x + radius * Math.cos(angle),
+ y: y - radius * Math.sin(angle)
+ };
+ }
+
+ /**
+ * This function uses binary search to look for the point where the circle crosses the border of the node.
+ * @param node
+ * @param ctx
+ * @param options
+ * @returns {*}
+ * @private
+ */
+
+ }, {
+ key: '_findBorderPositionCircle',
+ value: function _findBorderPositionCircle(node, ctx, options) {
+ var x = options.x;
+ var y = options.y;
+ var low = options.low;
+ var high = options.high;
+ var direction = options.direction;
+
+ var maxIterations = 10;
+ var iteration = 0;
+ var radius = this.options.selfReferenceSize;
+ var pos = void 0,
+ angle = void 0,
+ distanceToBorder = void 0,
+ distanceToPoint = void 0,
+ difference = void 0;
+ var threshold = 0.05;
+ var middle = (low + high) * 0.5;
+
+ while (low <= high && iteration < maxIterations) {
+ middle = (low + high) * 0.5;
+
+ pos = this._pointOnCircle(x, y, radius, middle);
+ angle = Math.atan2(node.y - pos.y, node.x - pos.x);
+ distanceToBorder = node.distanceToBorder(ctx, angle);
+ distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2));
+ difference = distanceToBorder - distanceToPoint;
+ if (Math.abs(difference) < threshold) {
+ break; // found
+ } else if (difference > 0) {
+ // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node.
+ if (direction > 0) {
+ low = middle;
+ } else {
+ high = middle;
+ }
+ } else {
+ if (direction > 0) {
+ high = middle;
+ } else {
+ low = middle;
+ }
+ }
+ iteration++;
+ }
+ pos.t = middle;
+
+ return pos;
+ }
+
+ /**
+ * Get the line width of the edge. Depends on width and whether one of the
+ * connected nodes is selected.
+ * @return {Number} width
+ * @private
+ */
+
+ }, {
+ key: 'getLineWidth',
+ value: function getLineWidth(selected, hover) {
+ if (selected === true) {
+ return Math.max(this.selectionWidth, 0.3 / this.body.view.scale);
+ } else {
+ if (hover === true) {
+ return Math.max(this.hoverWidth, 0.3 / this.body.view.scale);
+ } else {
+ return Math.max(this.options.width, 0.3 / this.body.view.scale);
+ }
+ }
+ }
+ }, {
+ key: 'getColor',
+ value: function getColor(ctx, values, selected, hover) {
+ if (values.inheritsColor !== false) {
+ // when this is a loop edge, just use the 'from' method
+ if (values.inheritsColor === 'both' && this.from.id !== this.to.id) {
+ var grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y);
+ var fromColor = void 0,
+ toColor = void 0;
+ fromColor = this.from.options.color.highlight.border;
+ toColor = this.to.options.color.highlight.border;
+
+ if (this.from.selected === false && this.to.selected === false) {
+ fromColor = util.overrideOpacity(this.from.options.color.border, values.opacity);
+ toColor = util.overrideOpacity(this.to.options.color.border, values.opacity);
+ } else if (this.from.selected === true && this.to.selected === false) {
+ toColor = this.to.options.color.border;
+ } else if (this.from.selected === false && this.to.selected === true) {
+ fromColor = this.from.options.color.border;
+ }
+ grd.addColorStop(0, fromColor);
+ grd.addColorStop(1, toColor);
+
+ // -------------------- this returns -------------------- //
+ return grd;
+ }
+
+ if (values.inheritsColor === "to") {
+ return util.overrideOpacity(this.to.options.color.border, values.opacity);
+ } else {
+ // "from"
+ return util.overrideOpacity(this.from.options.color.border, values.opacity);
+ }
+ } else {
+ return util.overrideOpacity(values.color, values.opacity);
+ }
+ }
+
+ /**
+ * Draw a line from a node to itself, a circle
+ * @param {CanvasRenderingContext2D} ctx
+ * @param {Number} x
+ * @param {Number} y
+ * @param {Number} radius
+ * @private
+ */
+
+ }, {
+ key: '_circle',
+ value: function _circle(ctx, values, x, y, radius) {
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+
+ // draw a circle
+ ctx.beginPath();
+ ctx.arc(x, y, radius, 0, 2 * Math.PI, false);
+ ctx.stroke();
+
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+ }
+
+ /**
+ * Calculate the distance between a point (x3,y3) and a line segment from
+ * (x1,y1) to (x2,y2).
+ * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
+ * @param {number} x1
+ * @param {number} y1
+ * @param {number} x2
+ * @param {number} y2
+ * @param {number} x3
+ * @param {number} y3
+ * @private
+ */
+
+ }, {
+ key: 'getDistanceToEdge',
+ value: function getDistanceToEdge(x1, y1, x2, y2, x3, y3, via, values) {
+ // x3,y3 is the point
+ var returnValue = 0;
+ if (this.from != this.to) {
+ returnValue = this._getDistanceToEdge(x1, y1, x2, y2, x3, y3, via);
+ } else {
+ var _getCircleData10 = this._getCircleData(undefined),
+ _getCircleData11 = (0, _slicedToArray3['default'])(_getCircleData10, 3),
+ x = _getCircleData11[0],
+ y = _getCircleData11[1],
+ radius = _getCircleData11[2];
+
+ var dx = x - x3;
+ var dy = y - y3;
+ returnValue = Math.abs(Math.sqrt(dx * dx + dy * dy) - radius);
+ }
+
+ if (this.labelModule.size.left < x3 && this.labelModule.size.left + this.labelModule.size.width > x3 && this.labelModule.size.top < y3 && this.labelModule.size.top + this.labelModule.size.height > y3) {
+ return 0;
+ } else {
+ return returnValue;
+ }
+ }
+ }, {
+ key: '_getDistanceToLine',
+ value: function _getDistanceToLine(x1, y1, x2, y2, x3, y3) {
+ var px = x2 - x1;
+ var py = y2 - y1;
+ var something = px * px + py * py;
+ var u = ((x3 - x1) * px + (y3 - y1) * py) / something;
+
+ if (u > 1) {
+ u = 1;
+ } else if (u < 0) {
+ u = 0;
+ }
+
+ var x = x1 + u * px;
+ var y = y1 + u * py;
+ var dx = x - x3;
+ var dy = y - y3;
+
+ //# Note: If the actual distance does not matter,
+ //# if you only want to compare what this function
+ //# returns to other results of this function, you
+ //# can just return the squared distance instead
+ //# (i.e. remove the sqrt) to gain a little performance
+
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+
+ /**
+ *
+ * @param ctx
+ * @param position
+ * @param viaNode
+ */
+
+ }, {
+ key: 'getArrowData',
+ value: function getArrowData(ctx, position, viaNode, selected, hover, values) {
+ // set lets
+ var angle = void 0;
+ var arrowPoint = void 0;
+ var node1 = void 0;
+ var node2 = void 0;
+ var guideOffset = void 0;
+ var scaleFactor = void 0;
+ var type = void 0;
+ var lineWidth = values.width;
+
+ if (position === 'from') {
+ node1 = this.from;
+ node2 = this.to;
+ guideOffset = 0.1;
+ scaleFactor = values.fromArrowScale;
+ type = values.fromArrowType;
+ } else if (position === 'to') {
+ node1 = this.to;
+ node2 = this.from;
+ guideOffset = -0.1;
+ scaleFactor = values.toArrowScale;
+ type = values.toArrowType;
+ } else {
+ node1 = this.to;
+ node2 = this.from;
+ scaleFactor = values.middleArrowScale;
+ type = values.middleArrowType;
+ }
+
+ // if not connected to itself
+ if (node1 != node2) {
+ if (position !== 'middle') {
+ // draw arrow head
+ if (this.options.smooth.enabled === true) {
+ arrowPoint = this.findBorderPosition(node1, ctx, { via: viaNode });
+ var guidePos = this.getPoint(Math.max(0.0, Math.min(1.0, arrowPoint.t + guideOffset)), viaNode);
+ angle = Math.atan2(arrowPoint.y - guidePos.y, arrowPoint.x - guidePos.x);
+ } else {
+ angle = Math.atan2(node1.y - node2.y, node1.x - node2.x);
+ arrowPoint = this.findBorderPosition(node1, ctx);
+ }
+ } else {
+ angle = Math.atan2(node1.y - node2.y, node1.x - node2.x);
+ arrowPoint = this.getPoint(0.5, viaNode); // this is 0.6 to account for the size of the arrow.
+ }
+ } else {
+ // draw circle
+ var _getCircleData12 = this._getCircleData(ctx),
+ _getCircleData13 = (0, _slicedToArray3['default'])(_getCircleData12, 3),
+ x = _getCircleData13[0],
+ y = _getCircleData13[1],
+ radius = _getCircleData13[2];
+
+ if (position === 'from') {
+ arrowPoint = this.findBorderPosition(this.from, ctx, { x: x, y: y, low: 0.25, high: 0.6, direction: -1 });
+ angle = arrowPoint.t * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI;
+ } else if (position === 'to') {
+ arrowPoint = this.findBorderPosition(this.from, ctx, { x: x, y: y, low: 0.6, high: 1.0, direction: 1 });
+ angle = arrowPoint.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI;
+ } else {
+ arrowPoint = this._pointOnCircle(x, y, radius, 0.175);
+ angle = 3.9269908169872414; // === 0.175 * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI;
+ }
+ }
+
+ var length = 15 * scaleFactor + 3 * lineWidth; // 3* lineWidth is the width of the edge.
+
+ var xi = arrowPoint.x - length * 0.9 * Math.cos(angle);
+ var yi = arrowPoint.y - length * 0.9 * Math.sin(angle);
+ var arrowCore = { x: xi, y: yi };
+
+ return { point: arrowPoint, core: arrowCore, angle: angle, length: length, type: type };
+ }
+
+ /**
+ *
+ * @param ctx
+ * @param selected
+ * @param hover
+ * @param arrowData
+ */
+
+ }, {
+ key: 'drawArrowHead',
+ value: function drawArrowHead(ctx, values, selected, hover, arrowData) {
+ // set style
+ ctx.strokeStyle = this.getColor(ctx, values, selected, hover);
+ ctx.fillStyle = ctx.strokeStyle;
+ ctx.lineWidth = values.width;
+
+ if (arrowData.type && arrowData.type.toLowerCase() === 'circle') {
+ // draw circle at the end of the line
+ ctx.circleEndpoint(arrowData.point.x, arrowData.point.y, arrowData.angle, arrowData.length);
+ } else {
+ // draw arrow at the end of the line
+ ctx.arrowEndpoint(arrowData.point.x, arrowData.point.y, arrowData.angle, arrowData.length);
+ }
+
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ ctx.fill();
+ // disable shadows for other elements.
+ this.disableShadow(ctx, values);
+ }
+ }, {
+ key: 'enableShadow',
+ value: function enableShadow(ctx, values) {
+ if (values.shadow === true) {
+ ctx.shadowColor = values.shadowColor;
+ ctx.shadowBlur = values.shadowSize;
+ ctx.shadowOffsetX = values.shadowX;
+ ctx.shadowOffsetY = values.shadowY;
+ }
+ }
+ }, {
+ key: 'disableShadow',
+ value: function disableShadow(ctx, values) {
+ if (values.shadow === true) {
+ ctx.shadowColor = 'rgba(0,0,0,0)';
+ ctx.shadowBlur = 0;
+ ctx.shadowOffsetX = 0;
+ ctx.shadowOffsetY = 0;
+ }
+ }
+ }]);
+ return EdgeBase;
+ }();
+
+ exports['default'] = EdgeBase;
+
+/***/ },
+/* 197 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _slicedToArray2 = __webpack_require__(161);
+
+ var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _BezierEdgeBase2 = __webpack_require__(195);
+
+ var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var BezierEdgeDynamic = function (_BezierEdgeBase) {
+ (0, _inherits3["default"])(BezierEdgeDynamic, _BezierEdgeBase);
+
+ function BezierEdgeDynamic(options, body, labelModule) {
+ (0, _classCallCheck3["default"])(this, BezierEdgeDynamic);
+
+ // --> this calls the setOptions below
+ var _this = (0, _possibleConstructorReturn3["default"])(this, (BezierEdgeDynamic.__proto__ || (0, _getPrototypeOf2["default"])(BezierEdgeDynamic)).call(this, options, body, labelModule));
+ //this.via = undefined; // Here for completeness but not allowed to defined before super() is invoked.
+
+
+ _this._boundFunction = function () {
+ _this.positionBezierNode();
+ };
+ _this.body.emitter.on("_repositionBezierNodes", _this._boundFunction);
+ return _this;
+ }
+
+ (0, _createClass3["default"])(BezierEdgeDynamic, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ // check if the physics has changed.
+ var physicsChange = false;
+ if (this.options.physics !== options.physics) {
+ physicsChange = true;
+ }
+
+ // set the options and the to and from nodes
+ this.options = options;
+ this.id = this.options.id;
+ this.from = this.body.nodes[this.options.from];
+ this.to = this.body.nodes[this.options.to];
+
+ // setup the support node and connect
+ this.setupSupportNode();
+ this.connect();
+
+ // when we change the physics state of the edge, we reposition the support node.
+ if (physicsChange === true) {
+ this.via.setOptions({ physics: this.options.physics });
+ this.positionBezierNode();
+ }
+ }
+ }, {
+ key: "connect",
+ value: function connect() {
+ this.from = this.body.nodes[this.options.from];
+ this.to = this.body.nodes[this.options.to];
+ if (this.from === undefined || this.to === undefined || this.options.physics === false) {
+ this.via.setOptions({ physics: false });
+ } else {
+ // fix weird behaviour where a self referencing node has physics enabled
+ if (this.from.id === this.to.id) {
+ this.via.setOptions({ physics: false });
+ } else {
+ this.via.setOptions({ physics: true });
+ }
+ }
+ }
+
+ /**
+ * remove the support nodes
+ * @returns {boolean}
+ */
+
+ }, {
+ key: "cleanup",
+ value: function cleanup() {
+ this.body.emitter.off("_repositionBezierNodes", this._boundFunction);
+ if (this.via !== undefined) {
+ delete this.body.nodes[this.via.id];
+ this.via = undefined;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Bezier curves require an anchor point to calculate the smooth flow. These points are nodes. These nodes are invisible but
+ * are used for the force calculation.
+ *
+ * The changed data is not called, if needed, it is returned by the main edge constructor.
+ * @private
+ */
+
+ }, {
+ key: "setupSupportNode",
+ value: function setupSupportNode() {
+ if (this.via === undefined) {
+ var nodeId = "edgeId:" + this.id;
+ var node = this.body.functions.createNode({
+ id: nodeId,
+ shape: 'circle',
+ physics: true,
+ hidden: true
+ });
+ this.body.nodes[nodeId] = node;
+ this.via = node;
+ this.via.parentEdgeId = this.id;
+ this.positionBezierNode();
+ }
+ }
+ }, {
+ key: "positionBezierNode",
+ value: function positionBezierNode() {
+ if (this.via !== undefined && this.from !== undefined && this.to !== undefined) {
+ this.via.x = 0.5 * (this.from.x + this.to.x);
+ this.via.y = 0.5 * (this.from.y + this.to.y);
+ } else if (this.via !== undefined) {
+ this.via.x = 0;
+ this.via.y = 0;
+ }
+ }
+
+ /**
+ * Draw a line between two nodes
+ * @param {CanvasRenderingContext2D} ctx
+ * @private
+ */
+
+ }, {
+ key: "_line",
+ value: function _line(ctx, values, viaNode) {
+ // draw a straight line
+ ctx.beginPath();
+ ctx.moveTo(this.fromPoint.x, this.fromPoint.y);
+ // fallback to normal straight edges
+ if (viaNode.x === undefined) {
+ ctx.lineTo(this.toPoint.x, this.toPoint.y);
+ } else {
+ ctx.quadraticCurveTo(viaNode.x, viaNode.y, this.toPoint.x, this.toPoint.y);
+ }
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ ctx.stroke();
+ this.disableShadow(ctx, values);
+ }
+ }, {
+ key: "getViaNode",
+ value: function getViaNode() {
+ return this.via;
+ }
+
+ /**
+ * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way
+ * @param percentage
+ * @param viaNode
+ * @returns {{x: number, y: number}}
+ * @private
+ */
+
+ }, {
+ key: "getPoint",
+ value: function getPoint(percentage) {
+ var viaNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.via;
+
+ var t = percentage;
+ var x = void 0,
+ y = void 0;
+ if (this.from === this.to) {
+ var _getCircleData = this._getCircleData(this.from),
+ _getCircleData2 = (0, _slicedToArray3["default"])(_getCircleData, 3),
+ cx = _getCircleData2[0],
+ cy = _getCircleData2[1],
+ cr = _getCircleData2[2];
+
+ var a = 2 * Math.PI * (1 - t);
+ x = cx + cr * Math.sin(a);
+ y = cy + cr - cr * (1 - Math.cos(a));
+ } else {
+ x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x;
+ y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y;
+ }
+
+ return { x: x, y: y };
+ }
+ }, {
+ key: "_findBorderPosition",
+ value: function _findBorderPosition(nearNode, ctx) {
+ return this._findBorderPositionBezier(nearNode, ctx, this.via);
+ }
+ }, {
+ key: "_getDistanceToEdge",
+ value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
+ // x3,y3 is the point
+ return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, this.via);
+ }
+ }]);
+ return BezierEdgeDynamic;
+ }(_BezierEdgeBase3["default"]);
+
+ exports["default"] = BezierEdgeDynamic;
+
+/***/ },
+/* 198 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _BezierEdgeBase2 = __webpack_require__(195);
+
+ var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var BezierEdgeStatic = function (_BezierEdgeBase) {
+ (0, _inherits3['default'])(BezierEdgeStatic, _BezierEdgeBase);
+
+ function BezierEdgeStatic(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, BezierEdgeStatic);
+ return (0, _possibleConstructorReturn3['default'])(this, (BezierEdgeStatic.__proto__ || (0, _getPrototypeOf2['default'])(BezierEdgeStatic)).call(this, options, body, labelModule));
+ }
+
+ /**
+ * Draw a line between two nodes
+ * @param {CanvasRenderingContext2D} ctx
+ * @private
+ */
+
+
+ (0, _createClass3['default'])(BezierEdgeStatic, [{
+ key: '_line',
+ value: function _line(ctx, values, viaNode) {
+ // draw a straight line
+ ctx.beginPath();
+ ctx.moveTo(this.fromPoint.x, this.fromPoint.y);
+
+ // fallback to normal straight edges
+ if (viaNode.x === undefined) {
+ ctx.lineTo(this.toPoint.x, this.toPoint.y);
+ } else {
+ ctx.quadraticCurveTo(viaNode.x, viaNode.y, this.toPoint.x, this.toPoint.y);
+ }
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ ctx.stroke();
+ this.disableShadow(ctx, values);
+ }
+ }, {
+ key: 'getViaNode',
+ value: function getViaNode() {
+ return this._getViaCoordinates();
+ }
+
+ /**
+ * We do not use the to and fromPoints here to make the via nodes the same as edges without arrows.
+ * @returns {{x: undefined, y: undefined}}
+ * @private
+ */
+
+ }, {
+ key: '_getViaCoordinates',
+ value: function _getViaCoordinates() {
+ var xVia = undefined;
+ var yVia = undefined;
+ var factor = this.options.smooth.roundness;
+ var type = this.options.smooth.type;
+ var dx = Math.abs(this.from.x - this.to.x);
+ var dy = Math.abs(this.from.y - this.to.y);
+ if (type === 'discrete' || type === 'diagonalCross') {
+ if (Math.abs(this.from.x - this.to.x) <= Math.abs(this.from.y - this.to.y)) {
+ if (this.from.y >= this.to.y) {
+ if (this.from.x <= this.to.x) {
+ xVia = this.from.x + factor * dy;
+ yVia = this.from.y - factor * dy;
+ } else if (this.from.x > this.to.x) {
+ xVia = this.from.x - factor * dy;
+ yVia = this.from.y - factor * dy;
+ }
+ } else if (this.from.y < this.to.y) {
+ if (this.from.x <= this.to.x) {
+ xVia = this.from.x + factor * dy;
+ yVia = this.from.y + factor * dy;
+ } else if (this.from.x > this.to.x) {
+ xVia = this.from.x - factor * dy;
+ yVia = this.from.y + factor * dy;
+ }
+ }
+ if (type === "discrete") {
+ xVia = dx < factor * dy ? this.from.x : xVia;
+ }
+ } else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) {
+ if (this.from.y >= this.to.y) {
+ if (this.from.x <= this.to.x) {
+ xVia = this.from.x + factor * dx;
+ yVia = this.from.y - factor * dx;
+ } else if (this.from.x > this.to.x) {
+ xVia = this.from.x - factor * dx;
+ yVia = this.from.y - factor * dx;
+ }
+ } else if (this.from.y < this.to.y) {
+ if (this.from.x <= this.to.x) {
+ xVia = this.from.x + factor * dx;
+ yVia = this.from.y + factor * dx;
+ } else if (this.from.x > this.to.x) {
+ xVia = this.from.x - factor * dx;
+ yVia = this.from.y + factor * dx;
+ }
+ }
+ if (type === "discrete") {
+ yVia = dy < factor * dx ? this.from.y : yVia;
+ }
+ }
+ } else if (type === "straightCross") {
+ if (Math.abs(this.from.x - this.to.x) <= Math.abs(this.from.y - this.to.y)) {
+ // up - down
+ xVia = this.from.x;
+ if (this.from.y < this.to.y) {
+ yVia = this.to.y - (1 - factor) * dy;
+ } else {
+ yVia = this.to.y + (1 - factor) * dy;
+ }
+ } else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) {
+ // left - right
+ if (this.from.x < this.to.x) {
+ xVia = this.to.x - (1 - factor) * dx;
+ } else {
+ xVia = this.to.x + (1 - factor) * dx;
+ }
+ yVia = this.from.y;
+ }
+ } else if (type === 'horizontal') {
+ if (this.from.x < this.to.x) {
+ xVia = this.to.x - (1 - factor) * dx;
+ } else {
+ xVia = this.to.x + (1 - factor) * dx;
+ }
+ yVia = this.from.y;
+ } else if (type === 'vertical') {
+ xVia = this.from.x;
+ if (this.from.y < this.to.y) {
+ yVia = this.to.y - (1 - factor) * dy;
+ } else {
+ yVia = this.to.y + (1 - factor) * dy;
+ }
+ } else if (type === 'curvedCW') {
+ dx = this.to.x - this.from.x;
+ dy = this.from.y - this.to.y;
+ var radius = Math.sqrt(dx * dx + dy * dy);
+ var pi = Math.PI;
+
+ var originalAngle = Math.atan2(dy, dx);
+ var myAngle = (originalAngle + (factor * 0.5 + 0.5) * pi) % (2 * pi);
+
+ xVia = this.from.x + (factor * 0.5 + 0.5) * radius * Math.sin(myAngle);
+ yVia = this.from.y + (factor * 0.5 + 0.5) * radius * Math.cos(myAngle);
+ } else if (type === 'curvedCCW') {
+ dx = this.to.x - this.from.x;
+ dy = this.from.y - this.to.y;
+ var _radius = Math.sqrt(dx * dx + dy * dy);
+ var _pi = Math.PI;
+
+ var _originalAngle = Math.atan2(dy, dx);
+ var _myAngle = (_originalAngle + (-factor * 0.5 + 0.5) * _pi) % (2 * _pi);
+
+ xVia = this.from.x + (factor * 0.5 + 0.5) * _radius * Math.sin(_myAngle);
+ yVia = this.from.y + (factor * 0.5 + 0.5) * _radius * Math.cos(_myAngle);
+ } else {
+ // continuous
+ if (Math.abs(this.from.x - this.to.x) <= Math.abs(this.from.y - this.to.y)) {
+ if (this.from.y >= this.to.y) {
+ if (this.from.x <= this.to.x) {
+ xVia = this.from.x + factor * dy;
+ yVia = this.from.y - factor * dy;
+ xVia = this.to.x < xVia ? this.to.x : xVia;
+ } else if (this.from.x > this.to.x) {
+ xVia = this.from.x - factor * dy;
+ yVia = this.from.y - factor * dy;
+ xVia = this.to.x > xVia ? this.to.x : xVia;
+ }
+ } else if (this.from.y < this.to.y) {
+ if (this.from.x <= this.to.x) {
+ xVia = this.from.x + factor * dy;
+ yVia = this.from.y + factor * dy;
+ xVia = this.to.x < xVia ? this.to.x : xVia;
+ } else if (this.from.x > this.to.x) {
+ xVia = this.from.x - factor * dy;
+ yVia = this.from.y + factor * dy;
+ xVia = this.to.x > xVia ? this.to.x : xVia;
+ }
+ }
+ } else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) {
+ if (this.from.y >= this.to.y) {
+ if (this.from.x <= this.to.x) {
+ xVia = this.from.x + factor * dx;
+ yVia = this.from.y - factor * dx;
+ yVia = this.to.y > yVia ? this.to.y : yVia;
+ } else if (this.from.x > this.to.x) {
+ xVia = this.from.x - factor * dx;
+ yVia = this.from.y - factor * dx;
+ yVia = this.to.y > yVia ? this.to.y : yVia;
+ }
+ } else if (this.from.y < this.to.y) {
+ if (this.from.x <= this.to.x) {
+ xVia = this.from.x + factor * dx;
+ yVia = this.from.y + factor * dx;
+ yVia = this.to.y < yVia ? this.to.y : yVia;
+ } else if (this.from.x > this.to.x) {
+ xVia = this.from.x - factor * dx;
+ yVia = this.from.y + factor * dx;
+ yVia = this.to.y < yVia ? this.to.y : yVia;
+ }
+ }
+ }
+ }
+ return { x: xVia, y: yVia };
+ }
+ }, {
+ key: '_findBorderPosition',
+ value: function _findBorderPosition(nearNode, ctx) {
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
+
+ return this._findBorderPositionBezier(nearNode, ctx, options.via);
+ }
+ }, {
+ key: '_getDistanceToEdge',
+ value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
+ var viaNode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : this._getViaCoordinates();
+ // x3,y3 is the point
+ return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, viaNode);
+ }
+
+ /**
+ * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way
+ * @param percentage
+ * @param viaNode
+ * @returns {{x: number, y: number}}
+ * @private
+ */
+
+ }, {
+ key: 'getPoint',
+ value: function getPoint(percentage) {
+ var viaNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._getViaCoordinates();
+
+ var t = percentage;
+ var x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x;
+ var y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y;
+
+ return { x: x, y: y };
+ }
+ }]);
+ return BezierEdgeStatic;
+ }(_BezierEdgeBase3['default']);
+
+ exports['default'] = BezierEdgeStatic;
+
+/***/ },
+/* 199 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _EdgeBase2 = __webpack_require__(196);
+
+ var _EdgeBase3 = _interopRequireDefault(_EdgeBase2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var StraightEdge = function (_EdgeBase) {
+ (0, _inherits3['default'])(StraightEdge, _EdgeBase);
+
+ function StraightEdge(options, body, labelModule) {
+ (0, _classCallCheck3['default'])(this, StraightEdge);
+ return (0, _possibleConstructorReturn3['default'])(this, (StraightEdge.__proto__ || (0, _getPrototypeOf2['default'])(StraightEdge)).call(this, options, body, labelModule));
+ }
+
+ /**
+ * Draw a line between two nodes
+ * @param {CanvasRenderingContext2D} ctx
+ * @private
+ */
+
+
+ (0, _createClass3['default'])(StraightEdge, [{
+ key: '_line',
+ value: function _line(ctx, values) {
+ // draw a straight line
+ ctx.beginPath();
+ ctx.moveTo(this.fromPoint.x, this.fromPoint.y);
+ ctx.lineTo(this.toPoint.x, this.toPoint.y);
+ // draw shadow if enabled
+ this.enableShadow(ctx, values);
+ ctx.stroke();
+ this.disableShadow(ctx, values);
+ }
+ }, {
+ key: 'getViaNode',
+ value: function getViaNode() {
+ return undefined;
+ }
+
+ /**
+ * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way
+ * @param percentage
+ * @param via
+ * @returns {{x: number, y: number}}
+ * @private
+ */
+
+ }, {
+ key: 'getPoint',
+ value: function getPoint(percentage) {
+ return {
+ x: (1 - percentage) * this.fromPoint.x + percentage * this.toPoint.x,
+ y: (1 - percentage) * this.fromPoint.y + percentage * this.toPoint.y
+ };
+ }
+ }, {
+ key: '_findBorderPosition',
+ value: function _findBorderPosition(nearNode, ctx) {
+ var node1 = this.to;
+ var node2 = this.from;
+ if (nearNode.id === this.from.id) {
+ node1 = this.from;
+ node2 = this.to;
+ }
+
+ var angle = Math.atan2(node1.y - node2.y, node1.x - node2.x);
+ var dx = node1.x - node2.x;
+ var dy = node1.y - node2.y;
+ var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy);
+ var toBorderDist = nearNode.distanceToBorder(ctx, angle);
+ var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength;
+
+ var borderPos = {};
+ borderPos.x = (1 - toBorderPoint) * node2.x + toBorderPoint * node1.x;
+ borderPos.y = (1 - toBorderPoint) * node2.y + toBorderPoint * node1.y;
+
+ return borderPos;
+ }
+ }, {
+ key: '_getDistanceToEdge',
+ value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) {
+ // x3,y3 is the point
+ return this._getDistanceToLine(x1, y1, x2, y2, x3, y3);
+ }
+ }]);
+ return StraightEdge;
+ }(_EdgeBase3['default']);
+
+ exports['default'] = StraightEdge;
+
+/***/ },
+/* 200 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _BarnesHutSolver = __webpack_require__(201);
+
+ var _BarnesHutSolver2 = _interopRequireDefault(_BarnesHutSolver);
+
+ var _RepulsionSolver = __webpack_require__(202);
+
+ var _RepulsionSolver2 = _interopRequireDefault(_RepulsionSolver);
+
+ var _HierarchicalRepulsionSolver = __webpack_require__(203);
+
+ var _HierarchicalRepulsionSolver2 = _interopRequireDefault(_HierarchicalRepulsionSolver);
+
+ var _SpringSolver = __webpack_require__(204);
+
+ var _SpringSolver2 = _interopRequireDefault(_SpringSolver);
+
+ var _HierarchicalSpringSolver = __webpack_require__(205);
+
+ var _HierarchicalSpringSolver2 = _interopRequireDefault(_HierarchicalSpringSolver);
+
+ var _CentralGravitySolver = __webpack_require__(206);
+
+ var _CentralGravitySolver2 = _interopRequireDefault(_CentralGravitySolver);
+
+ var _FA2BasedRepulsionSolver = __webpack_require__(207);
+
+ var _FA2BasedRepulsionSolver2 = _interopRequireDefault(_FA2BasedRepulsionSolver);
+
+ var _FA2BasedCentralGravitySolver = __webpack_require__(208);
+
+ var _FA2BasedCentralGravitySolver2 = _interopRequireDefault(_FA2BasedCentralGravitySolver);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var PhysicsEngine = function () {
+ function PhysicsEngine(body) {
+ (0, _classCallCheck3['default'])(this, PhysicsEngine);
+
+ this.body = body;
+ this.physicsBody = { physicsNodeIndices: [], physicsEdgeIndices: [], forces: {}, velocities: {} };
+
+ this.physicsEnabled = true;
+ this.simulationInterval = 1000 / 60;
+ this.requiresTimeout = true;
+ this.previousStates = {};
+ this.referenceState = {};
+ this.freezeCache = {};
+ this.renderTimer = undefined;
+
+ // parameters for the adaptive timestep
+ this.adaptiveTimestep = false;
+ this.adaptiveTimestepEnabled = false;
+ this.adaptiveCounter = 0;
+ this.adaptiveInterval = 3;
+
+ this.stabilized = false;
+ this.startedStabilization = false;
+ this.stabilizationIterations = 0;
+ this.ready = false; // will be set to true if the stabilize
+
+ // default options
+ this.options = {};
+ this.defaultOptions = {
+ enabled: true,
+ barnesHut: {
+ theta: 0.5,
+ gravitationalConstant: -2000,
+ centralGravity: 0.3,
+ springLength: 95,
+ springConstant: 0.04,
+ damping: 0.09,
+ avoidOverlap: 0
+ },
+ forceAtlas2Based: {
+ theta: 0.5,
+ gravitationalConstant: -50,
+ centralGravity: 0.01,
+ springConstant: 0.08,
+ springLength: 100,
+ damping: 0.4,
+ avoidOverlap: 0
+ },
+ repulsion: {
+ centralGravity: 0.2,
+ springLength: 200,
+ springConstant: 0.05,
+ nodeDistance: 100,
+ damping: 0.09,
+ avoidOverlap: 0
+ },
+ hierarchicalRepulsion: {
+ centralGravity: 0.0,
+ springLength: 100,
+ springConstant: 0.01,
+ nodeDistance: 120,
+ damping: 0.09
+ },
+ maxVelocity: 50,
+ minVelocity: 0.75, // px/s
+ solver: 'barnesHut',
+ stabilization: {
+ enabled: true,
+ iterations: 1000, // maximum number of iteration to stabilize
+ updateInterval: 50,
+ onlyDynamicEdges: false,
+ fit: true
+ },
+ timestep: 0.5,
+ adaptiveTimestep: true
+ };
+ util.extend(this.options, this.defaultOptions);
+ this.timestep = 0.5;
+ this.layoutFailed = false;
+
+ this.bindEventListeners();
+ }
+
+ (0, _createClass3['default'])(PhysicsEngine, [{
+ key: 'bindEventListeners',
+ value: function bindEventListeners() {
+ var _this = this;
+
+ this.body.emitter.on('initPhysics', function () {
+ _this.initPhysics();
+ });
+ this.body.emitter.on('_layoutFailed', function () {
+ _this.layoutFailed = true;
+ });
+ this.body.emitter.on('resetPhysics', function () {
+ _this.stopSimulation();_this.ready = false;
+ });
+ this.body.emitter.on('disablePhysics', function () {
+ _this.physicsEnabled = false;_this.stopSimulation();
+ });
+ this.body.emitter.on('restorePhysics', function () {
+ _this.setOptions(_this.options);
+ if (_this.ready === true) {
+ _this.startSimulation();
+ }
+ });
+ this.body.emitter.on('startSimulation', function () {
+ if (_this.ready === true) {
+ _this.startSimulation();
+ }
+ });
+ this.body.emitter.on('stopSimulation', function () {
+ _this.stopSimulation();
+ });
+ this.body.emitter.on('destroy', function () {
+ _this.stopSimulation(false);
+ _this.body.emitter.off();
+ });
+ // this event will trigger a rebuilding of the cache everything. Used when nodes or edges have been added or removed.
+ this.body.emitter.on("_dataChanged", function () {
+ // update shortcut lists
+ _this.updatePhysicsData();
+ });
+
+ // debug: show forces
+ // this.body.emitter.on("afterDrawing", (ctx) => {this._drawForces(ctx);});
+ }
+
+ /**
+ * set the physics options
+ * @param options
+ */
+
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ if (options !== undefined) {
+ if (options === false) {
+ this.options.enabled = false;
+ this.physicsEnabled = false;
+ this.stopSimulation();
+ } else {
+ this.physicsEnabled = true;
+ util.selectiveNotDeepExtend(['stabilization'], this.options, options);
+ util.mergeOptions(this.options, options, 'stabilization');
+
+ if (options.enabled === undefined) {
+ this.options.enabled = true;
+ }
+
+ if (this.options.enabled === false) {
+ this.physicsEnabled = false;
+ this.stopSimulation();
+ }
+
+ // set the timestep
+ this.timestep = this.options.timestep;
+ }
+ }
+ this.init();
+ }
+
+ /**
+ * configure the engine.
+ */
+
+ }, {
+ key: 'init',
+ value: function init() {
+ var options;
+ if (this.options.solver === 'forceAtlas2Based') {
+ options = this.options.forceAtlas2Based;
+ this.nodesSolver = new _FA2BasedRepulsionSolver2['default'](this.body, this.physicsBody, options);
+ this.edgesSolver = new _SpringSolver2['default'](this.body, this.physicsBody, options);
+ this.gravitySolver = new _FA2BasedCentralGravitySolver2['default'](this.body, this.physicsBody, options);
+ } else if (this.options.solver === 'repulsion') {
+ options = this.options.repulsion;
+ this.nodesSolver = new _RepulsionSolver2['default'](this.body, this.physicsBody, options);
+ this.edgesSolver = new _SpringSolver2['default'](this.body, this.physicsBody, options);
+ this.gravitySolver = new _CentralGravitySolver2['default'](this.body, this.physicsBody, options);
+ } else if (this.options.solver === 'hierarchicalRepulsion') {
+ options = this.options.hierarchicalRepulsion;
+ this.nodesSolver = new _HierarchicalRepulsionSolver2['default'](this.body, this.physicsBody, options);
+ this.edgesSolver = new _HierarchicalSpringSolver2['default'](this.body, this.physicsBody, options);
+ this.gravitySolver = new _CentralGravitySolver2['default'](this.body, this.physicsBody, options);
+ } else {
+ // barnesHut
+ options = this.options.barnesHut;
+ this.nodesSolver = new _BarnesHutSolver2['default'](this.body, this.physicsBody, options);
+ this.edgesSolver = new _SpringSolver2['default'](this.body, this.physicsBody, options);
+ this.gravitySolver = new _CentralGravitySolver2['default'](this.body, this.physicsBody, options);
+ }
+
+ this.modelOptions = options;
+ }
+
+ /**
+ * initialize the engine
+ */
+
+ }, {
+ key: 'initPhysics',
+ value: function initPhysics() {
+ if (this.physicsEnabled === true && this.options.enabled === true) {
+ if (this.options.stabilization.enabled === true) {
+ this.stabilize();
+ } else {
+ this.stabilized = false;
+ this.ready = true;
+ this.body.emitter.emit('fit', {}, this.layoutFailed); // if the layout failed, we use the approximation for the zoom
+ this.startSimulation();
+ }
+ } else {
+ this.ready = true;
+ this.body.emitter.emit('fit');
+ }
+ }
+
+ /**
+ * Start the simulation
+ */
+
+ }, {
+ key: 'startSimulation',
+ value: function startSimulation() {
+ if (this.physicsEnabled === true && this.options.enabled === true) {
+ this.stabilized = false;
+
+ // when visible, adaptivity is disabled.
+ this.adaptiveTimestep = false;
+
+ // this sets the width of all nodes initially which could be required for the avoidOverlap
+ this.body.emitter.emit("_resizeNodes");
+ if (this.viewFunction === undefined) {
+ this.viewFunction = this.simulationStep.bind(this);
+ this.body.emitter.on('initRedraw', this.viewFunction);
+ this.body.emitter.emit('_startRendering');
+ }
+ } else {
+ this.body.emitter.emit('_redraw');
+ }
+ }
+
+ /**
+ * Stop the simulation, force stabilization.
+ */
+
+ }, {
+ key: 'stopSimulation',
+ value: function stopSimulation() {
+ var emit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+
+ this.stabilized = true;
+ if (emit === true) {
+ this._emitStabilized();
+ }
+ if (this.viewFunction !== undefined) {
+ this.body.emitter.off('initRedraw', this.viewFunction);
+ this.viewFunction = undefined;
+ if (emit === true) {
+ this.body.emitter.emit('_stopRendering');
+ }
+ }
+ }
+
+ /**
+ * The viewFunction inserts this step into each render loop. It calls the physics tick and handles the cleanup at stabilized.
+ *
+ */
+
+ }, {
+ key: 'simulationStep',
+ value: function simulationStep() {
+ // check if the physics have settled
+ var startTime = Date.now();
+ this.physicsTick();
+ var physicsTime = Date.now() - startTime;
+
+ // run double speed if it is a little graph
+ if ((physicsTime < 0.4 * this.simulationInterval || this.runDoubleSpeed === true) && this.stabilized === false) {
+ this.physicsTick();
+
+ // this makes sure there is no jitter. The decision is taken once to run it at double speed.
+ this.runDoubleSpeed = true;
+ }
+
+ if (this.stabilized === true) {
+ this.stopSimulation();
+ }
+ }
+
+ /**
+ * trigger the stabilized event.
+ * @private
+ */
+
+ }, {
+ key: '_emitStabilized',
+ value: function _emitStabilized() {
+ var _this2 = this;
+
+ var amountOfIterations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.stabilizationIterations;
+
+ if (this.stabilizationIterations > 1 || this.startedStabilization === true) {
+ setTimeout(function () {
+ _this2.body.emitter.emit('stabilized', { iterations: amountOfIterations });
+ _this2.startedStabilization = false;
+ _this2.stabilizationIterations = 0;
+ }, 0);
+ }
+ }
+
+ /**
+ * A single simulation step (or 'tick') in the physics simulation
+ *
+ * @private
+ */
+
+ }, {
+ key: 'physicsTick',
+ value: function physicsTick() {
+ // this is here to ensure that there is no start event when the network is already stable.
+ if (this.startedStabilization === false) {
+ this.body.emitter.emit('startStabilizing');
+ this.startedStabilization = true;
+ }
+
+ if (this.stabilized === false) {
+ // adaptivity means the timestep adapts to the situation, only applicable for stabilization
+ if (this.adaptiveTimestep === true && this.adaptiveTimestepEnabled === true) {
+ // this is the factor for increasing the timestep on success.
+ var factor = 1.2;
+
+ // we assume the adaptive interval is
+ if (this.adaptiveCounter % this.adaptiveInterval === 0) {
+ // we leave the timestep stable for "interval" iterations.
+ // first the big step and revert. Revert saves the reference state.
+ this.timestep = 2 * this.timestep;
+ this.calculateForces();
+ this.moveNodes();
+ this.revert();
+
+ // now the normal step. Since this is the last step, it is the more stable one and we will take this.
+ this.timestep = 0.5 * this.timestep;
+
+ // since it's half the step, we do it twice.
+ this.calculateForces();
+ this.moveNodes();
+ this.calculateForces();
+ this.moveNodes();
+
+ // we compare the two steps. if it is acceptable we double the step.
+ if (this._evaluateStepQuality() === true) {
+ this.timestep = factor * this.timestep;
+ } else {
+ // if not, we decrease the step to a minimum of the options timestep.
+ // if the decreased timestep is smaller than the options step, we do not reset the counter
+ // we assume that the options timestep is stable enough.
+ if (this.timestep / factor < this.options.timestep) {
+ this.timestep = this.options.timestep;
+ } else {
+ // if the timestep was larger than 2 times the option one we check the adaptivity again to ensure
+ // that large instabilities do not form.
+ this.adaptiveCounter = -1; // check again next iteration
+ this.timestep = Math.max(this.options.timestep, this.timestep / factor);
+ }
+ }
+ } else {
+ // normal step, keeping timestep constant
+ this.calculateForces();
+ this.moveNodes();
+ }
+
+ // increment the counter
+ this.adaptiveCounter += 1;
+ } else {
+ // case for the static timestep, we reset it to the one in options and take a normal step.
+ this.timestep = this.options.timestep;
+ this.calculateForces();
+ this.moveNodes();
+ }
+
+ // determine if the network has stabilzied
+ if (this.stabilized === true) {
+ this.revert();
+ }
+
+ this.stabilizationIterations++;
+ }
+ }
+
+ /**
+ * Nodes and edges can have the physics toggles on or off. A collection of indices is created here so we can skip the check all the time.
+ *
+ * @private
+ */
+
+ }, {
+ key: 'updatePhysicsData',
+ value: function updatePhysicsData() {
+ this.physicsBody.forces = {};
+ this.physicsBody.physicsNodeIndices = [];
+ this.physicsBody.physicsEdgeIndices = [];
+ var nodes = this.body.nodes;
+ var edges = this.body.edges;
+
+ // get node indices for physics
+ for (var nodeId in nodes) {
+ if (nodes.hasOwnProperty(nodeId)) {
+ if (nodes[nodeId].options.physics === true) {
+ this.physicsBody.physicsNodeIndices.push(nodes[nodeId].id);
+ }
+ }
+ }
+
+ // get edge indices for physics
+ for (var edgeId in edges) {
+ if (edges.hasOwnProperty(edgeId)) {
+ if (edges[edgeId].options.physics === true) {
+ this.physicsBody.physicsEdgeIndices.push(edges[edgeId].id);
+ }
+ }
+ }
+
+ // get the velocity and the forces vector
+ for (var i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) {
+ var _nodeId = this.physicsBody.physicsNodeIndices[i];
+ this.physicsBody.forces[_nodeId] = { x: 0, y: 0 };
+
+ // forces can be reset because they are recalculated. Velocities have to persist.
+ if (this.physicsBody.velocities[_nodeId] === undefined) {
+ this.physicsBody.velocities[_nodeId] = { x: 0, y: 0 };
+ }
+ }
+
+ // clean deleted nodes from the velocity vector
+ for (var _nodeId2 in this.physicsBody.velocities) {
+ if (nodes[_nodeId2] === undefined) {
+ delete this.physicsBody.velocities[_nodeId2];
+ }
+ }
+ }
+
+ /**
+ * Revert the simulation one step. This is done so after stabilization, every new start of the simulation will also say stabilized.
+ */
+
+ }, {
+ key: 'revert',
+ value: function revert() {
+ var nodeIds = (0, _keys2['default'])(this.previousStates);
+ var nodes = this.body.nodes;
+ var velocities = this.physicsBody.velocities;
+ this.referenceState = {};
+
+ for (var i = 0; i < nodeIds.length; i++) {
+ var nodeId = nodeIds[i];
+ if (nodes[nodeId] !== undefined) {
+ if (nodes[nodeId].options.physics === true) {
+ this.referenceState[nodeId] = {
+ positions: { x: nodes[nodeId].x, y: nodes[nodeId].y }
+ };
+ velocities[nodeId].x = this.previousStates[nodeId].vx;
+ velocities[nodeId].y = this.previousStates[nodeId].vy;
+ nodes[nodeId].x = this.previousStates[nodeId].x;
+ nodes[nodeId].y = this.previousStates[nodeId].y;
+ }
+ } else {
+ delete this.previousStates[nodeId];
+ }
+ }
+ }
+
+ /**
+ * This compares the reference state to the current state
+ */
+
+ }, {
+ key: '_evaluateStepQuality',
+ value: function _evaluateStepQuality() {
+ var dx = void 0,
+ dy = void 0,
+ dpos = void 0;
+ var nodes = this.body.nodes;
+ var reference = this.referenceState;
+ var posThreshold = 0.3;
+
+ for (var nodeId in this.referenceState) {
+ if (this.referenceState.hasOwnProperty(nodeId) && nodes[nodeId] !== undefined) {
+ dx = nodes[nodeId].x - reference[nodeId].positions.x;
+ dy = nodes[nodeId].y - reference[nodeId].positions.y;
+
+ dpos = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
+
+ if (dpos > posThreshold) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * move the nodes one timestep and check if they are stabilized
+ * @returns {boolean}
+ */
+
+ }, {
+ key: 'moveNodes',
+ value: function moveNodes() {
+ var nodeIndices = this.physicsBody.physicsNodeIndices;
+ var maxVelocity = this.options.maxVelocity ? this.options.maxVelocity : 1e9;
+ var maxNodeVelocity = 0;
+ var averageNodeVelocity = 0;
+
+ // the velocity threshold (energy in the system) for the adaptivity toggle
+ var velocityAdaptiveThreshold = 5;
+
+ for (var i = 0; i < nodeIndices.length; i++) {
+ var nodeId = nodeIndices[i];
+ var nodeVelocity = this._performStep(nodeId, maxVelocity);
+ // stabilized is true if stabilized is true and velocity is smaller than vmin --> all nodes must be stabilized
+ maxNodeVelocity = Math.max(maxNodeVelocity, nodeVelocity);
+ averageNodeVelocity += nodeVelocity;
+ }
+
+ // evaluating the stabilized and adaptiveTimestepEnabled conditions
+ this.adaptiveTimestepEnabled = averageNodeVelocity / nodeIndices.length < velocityAdaptiveThreshold;
+ this.stabilized = maxNodeVelocity < this.options.minVelocity;
+ }
+
+ /**
+ * Perform the actual step
+ *
+ * @param nodeId
+ * @param maxVelocity
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_performStep',
+ value: function _performStep(nodeId, maxVelocity) {
+ var node = this.body.nodes[nodeId];
+ var timestep = this.timestep;
+ var forces = this.physicsBody.forces;
+ var velocities = this.physicsBody.velocities;
+
+ // store the state so we can revert
+ this.previousStates[nodeId] = { x: node.x, y: node.y, vx: velocities[nodeId].x, vy: velocities[nodeId].y };
+
+ if (node.options.fixed.x === false) {
+ var dx = this.modelOptions.damping * velocities[nodeId].x; // damping force
+ var ax = (forces[nodeId].x - dx) / node.options.mass; // acceleration
+ velocities[nodeId].x += ax * timestep; // velocity
+ velocities[nodeId].x = Math.abs(velocities[nodeId].x) > maxVelocity ? velocities[nodeId].x > 0 ? maxVelocity : -maxVelocity : velocities[nodeId].x;
+ node.x += velocities[nodeId].x * timestep; // position
+ } else {
+ forces[nodeId].x = 0;
+ velocities[nodeId].x = 0;
+ }
+
+ if (node.options.fixed.y === false) {
+ var dy = this.modelOptions.damping * velocities[nodeId].y; // damping force
+ var ay = (forces[nodeId].y - dy) / node.options.mass; // acceleration
+ velocities[nodeId].y += ay * timestep; // velocity
+ velocities[nodeId].y = Math.abs(velocities[nodeId].y) > maxVelocity ? velocities[nodeId].y > 0 ? maxVelocity : -maxVelocity : velocities[nodeId].y;
+ node.y += velocities[nodeId].y * timestep; // position
+ } else {
+ forces[nodeId].y = 0;
+ velocities[nodeId].y = 0;
+ }
+
+ var totalVelocity = Math.sqrt(Math.pow(velocities[nodeId].x, 2) + Math.pow(velocities[nodeId].y, 2));
+ return totalVelocity;
+ }
+
+ /**
+ * calculate the forces for one physics iteration.
+ */
+
+ }, {
+ key: 'calculateForces',
+ value: function calculateForces() {
+ this.gravitySolver.solve();
+ this.nodesSolver.solve();
+ this.edgesSolver.solve();
+ }
+
+ /**
+ * When initializing and stabilizing, we can freeze nodes with a predefined position. This greatly speeds up stabilization
+ * because only the supportnodes for the smoothCurves have to settle.
+ *
+ * @private
+ */
+
+ }, {
+ key: '_freezeNodes',
+ value: function _freezeNodes() {
+ var nodes = this.body.nodes;
+ for (var id in nodes) {
+ if (nodes.hasOwnProperty(id)) {
+ if (nodes[id].x && nodes[id].y) {
+ this.freezeCache[id] = { x: nodes[id].options.fixed.x, y: nodes[id].options.fixed.y };
+ nodes[id].options.fixed.x = true;
+ nodes[id].options.fixed.y = true;
+ }
+ }
+ }
+ }
+
+ /**
+ * Unfreezes the nodes that have been frozen by _freezeDefinedNodes.
+ *
+ * @private
+ */
+
+ }, {
+ key: '_restoreFrozenNodes',
+ value: function _restoreFrozenNodes() {
+ var nodes = this.body.nodes;
+ for (var id in nodes) {
+ if (nodes.hasOwnProperty(id)) {
+ if (this.freezeCache[id] !== undefined) {
+ nodes[id].options.fixed.x = this.freezeCache[id].x;
+ nodes[id].options.fixed.y = this.freezeCache[id].y;
+ }
+ }
+ }
+ this.freezeCache = {};
+ }
+
+ /**
+ * Find a stable position for all nodes
+ */
+
+ }, {
+ key: 'stabilize',
+ value: function stabilize() {
+ var _this3 = this;
+
+ var iterations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.stabilization.iterations;
+
+ if (typeof iterations !== 'number') {
+ console.log('The stabilize method needs a numeric amount of iterations. Switching to default: ', this.options.stabilization.iterations);
+ iterations = this.options.stabilization.iterations;
+ }
+
+ if (this.physicsBody.physicsNodeIndices.length === 0) {
+ this.ready = true;
+ return;
+ }
+
+ // enable adaptive timesteps
+ this.adaptiveTimestep = true && this.options.adaptiveTimestep;
+
+ // this sets the width of all nodes initially which could be required for the avoidOverlap
+ this.body.emitter.emit("_resizeNodes");
+
+ // stop the render loop
+ this.stopSimulation();
+
+ // set stabilze to false
+ this.stabilized = false;
+
+ // block redraw requests
+ this.body.emitter.emit('_blockRedraw');
+ this.targetIterations = iterations;
+
+ // start the stabilization
+ if (this.options.stabilization.onlyDynamicEdges === true) {
+ this._freezeNodes();
+ }
+ this.stabilizationIterations = 0;
+
+ setTimeout(function () {
+ return _this3._stabilizationBatch();
+ }, 0);
+ }
+
+ /**
+ * One batch of stabilization
+ * @private
+ */
+
+ }, {
+ key: '_stabilizationBatch',
+ value: function _stabilizationBatch() {
+ // this is here to ensure that there is at least one start event.
+ if (this.startedStabilization === false) {
+ this.body.emitter.emit('startStabilizing');
+ this.startedStabilization = true;
+ }
+
+ var count = 0;
+ while (this.stabilized === false && count < this.options.stabilization.updateInterval && this.stabilizationIterations < this.targetIterations) {
+ this.physicsTick();
+ count++;
+ }
+
+ if (this.stabilized === false && this.stabilizationIterations < this.targetIterations) {
+ this.body.emitter.emit('stabilizationProgress', { iterations: this.stabilizationIterations, total: this.targetIterations });
+ setTimeout(this._stabilizationBatch.bind(this), 0);
+ } else {
+ this._finalizeStabilization();
+ }
+ }
+
+ /**
+ * Wrap up the stabilization, fit and emit the events.
+ * @private
+ */
+
+ }, {
+ key: '_finalizeStabilization',
+ value: function _finalizeStabilization() {
+ this.body.emitter.emit('_allowRedraw');
+ if (this.options.stabilization.fit === true) {
+ this.body.emitter.emit('fit');
+ }
+
+ if (this.options.stabilization.onlyDynamicEdges === true) {
+ this._restoreFrozenNodes();
+ }
+
+ this.body.emitter.emit('stabilizationIterationsDone');
+ this.body.emitter.emit('_requestRedraw');
+
+ if (this.stabilized === true) {
+ this._emitStabilized();
+ } else {
+ this.startSimulation();
+ }
+
+ this.ready = true;
+ }
+ }, {
+ key: '_drawForces',
+ value: function _drawForces(ctx) {
+ for (var i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) {
+ var node = this.body.nodes[this.physicsBody.physicsNodeIndices[i]];
+ var force = this.physicsBody.forces[this.physicsBody.physicsNodeIndices[i]];
+ var factor = 20;
+ var colorFactor = 0.03;
+ var forceSize = Math.sqrt(Math.pow(force.x, 2) + Math.pow(force.x, 2));
+
+ var size = Math.min(Math.max(5, forceSize), 15);
+ var arrowSize = 3 * size;
+
+ var color = util.HSVToHex((180 - Math.min(1, Math.max(0, colorFactor * forceSize)) * 180) / 360, 1, 1);
+
+ ctx.lineWidth = size;
+ ctx.strokeStyle = color;
+ ctx.beginPath();
+ ctx.moveTo(node.x, node.y);
+ ctx.lineTo(node.x + factor * force.x, node.y + factor * force.y);
+ ctx.stroke();
+
+ var angle = Math.atan2(force.y, force.x);
+ ctx.fillStyle = color;
+ ctx.arrowEndpoint(node.x + factor * force.x + Math.cos(angle) * arrowSize, node.y + factor * force.y + Math.sin(angle) * arrowSize, angle, arrowSize);
+ ctx.fill();
+ }
+ }
+ }]);
+ return PhysicsEngine;
+ }();
+
+ exports['default'] = PhysicsEngine;
+
+/***/ },
+/* 201 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var BarnesHutSolver = function () {
+ function BarnesHutSolver(body, physicsBody, options) {
+ (0, _classCallCheck3["default"])(this, BarnesHutSolver);
+
+ this.body = body;
+ this.physicsBody = physicsBody;
+ this.barnesHutTree;
+ this.setOptions(options);
+ this.randomSeed = 5;
+
+ // debug: show grid
+ //this.body.emitter.on("afterDrawing", (ctx) => {this._debug(ctx,'#ff0000')})
+ }
+
+ (0, _createClass3["default"])(BarnesHutSolver, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ this.options = options;
+ this.thetaInversed = 1 / this.options.theta;
+ this.overlapAvoidanceFactor = 1 - Math.max(0, Math.min(1, this.options.avoidOverlap)); // if 1 then min distance = 0.5, if 0.5 then min distance = 0.5 + 0.5*node.shape.radius
+ }
+ }, {
+ key: "seededRandom",
+ value: function seededRandom() {
+ var x = Math.sin(this.randomSeed++) * 10000;
+ return x - Math.floor(x);
+ }
+
+ /**
+ * This function calculates the forces the nodes apply on each other based on a gravitational model.
+ * The Barnes Hut method is used to speed up this N-body simulation.
+ *
+ * @private
+ */
+
+ }, {
+ key: "solve",
+ value: function solve() {
+ if (this.options.gravitationalConstant !== 0 && this.physicsBody.physicsNodeIndices.length > 0) {
+ var node = void 0;
+ var nodes = this.body.nodes;
+ var nodeIndices = this.physicsBody.physicsNodeIndices;
+ var nodeCount = nodeIndices.length;
+
+ // create the tree
+ var barnesHutTree = this._formBarnesHutTree(nodes, nodeIndices);
+
+ // for debugging
+ this.barnesHutTree = barnesHutTree;
+
+ // place the nodes one by one recursively
+ for (var i = 0; i < nodeCount; i++) {
+ node = nodes[nodeIndices[i]];
+ if (node.options.mass > 0) {
+ // starting with root is irrelevant, it never passes the BarnesHutSolver condition
+ this._getForceContribution(barnesHutTree.root.children.NW, node);
+ this._getForceContribution(barnesHutTree.root.children.NE, node);
+ this._getForceContribution(barnesHutTree.root.children.SW, node);
+ this._getForceContribution(barnesHutTree.root.children.SE, node);
+ }
+ }
+ }
+ }
+
+ /**
+ * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass.
+ * If a region contains a single node, we check if it is not itself, then we apply the force.
+ *
+ * @param parentBranch
+ * @param node
+ * @private
+ */
+
+ }, {
+ key: "_getForceContribution",
+ value: function _getForceContribution(parentBranch, node) {
+ // we get no force contribution from an empty region
+ if (parentBranch.childrenCount > 0) {
+ var dx = void 0,
+ dy = void 0,
+ distance = void 0;
+
+ // get the distance from the center of mass to the node.
+ dx = parentBranch.centerOfMass.x - node.x;
+ dy = parentBranch.centerOfMass.y - node.y;
+ distance = Math.sqrt(dx * dx + dy * dy);
+
+ // BarnesHutSolver condition
+ // original condition : s/d < theta = passed === d/s > 1/theta = passed
+ // calcSize = 1/s --> d * 1/s > 1/theta = passed
+ if (distance * parentBranch.calcSize > this.thetaInversed) {
+ this._calculateForces(distance, dx, dy, node, parentBranch);
+ } else {
+ // Did not pass the condition, go into children if available
+ if (parentBranch.childrenCount === 4) {
+ this._getForceContribution(parentBranch.children.NW, node);
+ this._getForceContribution(parentBranch.children.NE, node);
+ this._getForceContribution(parentBranch.children.SW, node);
+ this._getForceContribution(parentBranch.children.SE, node);
+ } else {
+ // parentBranch must have only one node, if it was empty we wouldnt be here
+ if (parentBranch.children.data.id != node.id) {
+ // if it is not self
+ this._calculateForces(distance, dx, dy, node, parentBranch);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Calculate the forces based on the distance.
+ *
+ * @param distance
+ * @param dx
+ * @param dy
+ * @param node
+ * @param parentBranch
+ * @private
+ */
+
+ }, {
+ key: "_calculateForces",
+ value: function _calculateForces(distance, dx, dy, node, parentBranch) {
+ if (distance === 0) {
+ distance = 0.1;
+ dx = distance;
+ }
+
+ if (this.overlapAvoidanceFactor < 1 && node.shape.radius) {
+ distance = Math.max(0.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius);
+ }
+
+ // the dividing by the distance cubed instead of squared allows us to get the fx and fy components without sines and cosines
+ // it is shorthand for gravityforce with distance squared and fx = dx/distance * gravityForce
+ var gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass / Math.pow(distance, 3);
+ var fx = dx * gravityForce;
+ var fy = dy * gravityForce;
+
+ this.physicsBody.forces[node.id].x += fx;
+ this.physicsBody.forces[node.id].y += fy;
+ }
+
+ /**
+ * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes.
+ *
+ * @param nodes
+ * @param nodeIndices
+ * @private
+ */
+
+ }, {
+ key: "_formBarnesHutTree",
+ value: function _formBarnesHutTree(nodes, nodeIndices) {
+ var node = void 0;
+ var nodeCount = nodeIndices.length;
+
+ var minX = nodes[nodeIndices[0]].x;
+ var minY = nodes[nodeIndices[0]].y;
+ var maxX = nodes[nodeIndices[0]].x;
+ var maxY = nodes[nodeIndices[0]].y;
+
+ // get the range of the nodes
+ for (var i = 1; i < nodeCount; i++) {
+ var x = nodes[nodeIndices[i]].x;
+ var y = nodes[nodeIndices[i]].y;
+ if (nodes[nodeIndices[i]].options.mass > 0) {
+ if (x < minX) {
+ minX = x;
+ }
+ if (x > maxX) {
+ maxX = x;
+ }
+ if (y < minY) {
+ minY = y;
+ }
+ if (y > maxY) {
+ maxY = y;
+ }
+ }
+ }
+ // make the range a square
+ var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y
+ if (sizeDiff > 0) {
+ minY -= 0.5 * sizeDiff;
+ maxY += 0.5 * sizeDiff;
+ } // xSize > ySize
+ else {
+ minX += 0.5 * sizeDiff;
+ maxX -= 0.5 * sizeDiff;
+ } // xSize < ySize
+
+
+ var minimumTreeSize = 1e-5;
+ var rootSize = Math.max(minimumTreeSize, Math.abs(maxX - minX));
+ var halfRootSize = 0.5 * rootSize;
+ var centerX = 0.5 * (minX + maxX),
+ centerY = 0.5 * (minY + maxY);
+
+ // construct the barnesHutTree
+ var barnesHutTree = {
+ root: {
+ centerOfMass: { x: 0, y: 0 },
+ mass: 0,
+ range: {
+ minX: centerX - halfRootSize, maxX: centerX + halfRootSize,
+ minY: centerY - halfRootSize, maxY: centerY + halfRootSize
+ },
+ size: rootSize,
+ calcSize: 1 / rootSize,
+ children: { data: null },
+ maxWidth: 0,
+ level: 0,
+ childrenCount: 4
+ }
+ };
+ this._splitBranch(barnesHutTree.root);
+
+ // place the nodes one by one recursively
+ for (var _i = 0; _i < nodeCount; _i++) {
+ node = nodes[nodeIndices[_i]];
+ if (node.options.mass > 0) {
+ this._placeInTree(barnesHutTree.root, node);
+ }
+ }
+
+ // make global
+ return barnesHutTree;
+ }
+
+ /**
+ * this updates the mass of a branch. this is increased by adding a node.
+ *
+ * @param parentBranch
+ * @param node
+ * @private
+ */
+
+ }, {
+ key: "_updateBranchMass",
+ value: function _updateBranchMass(parentBranch, node) {
+ var totalMass = parentBranch.mass + node.options.mass;
+ var totalMassInv = 1 / totalMass;
+
+ parentBranch.centerOfMass.x = parentBranch.centerOfMass.x * parentBranch.mass + node.x * node.options.mass;
+ parentBranch.centerOfMass.x *= totalMassInv;
+
+ parentBranch.centerOfMass.y = parentBranch.centerOfMass.y * parentBranch.mass + node.y * node.options.mass;
+ parentBranch.centerOfMass.y *= totalMassInv;
+
+ parentBranch.mass = totalMass;
+ var biggestSize = Math.max(Math.max(node.height, node.radius), node.width);
+ parentBranch.maxWidth = parentBranch.maxWidth < biggestSize ? biggestSize : parentBranch.maxWidth;
+ }
+
+ /**
+ * determine in which branch the node will be placed.
+ *
+ * @param parentBranch
+ * @param node
+ * @param skipMassUpdate
+ * @private
+ */
+
+ }, {
+ key: "_placeInTree",
+ value: function _placeInTree(parentBranch, node, skipMassUpdate) {
+ if (skipMassUpdate != true || skipMassUpdate === undefined) {
+ // update the mass of the branch.
+ this._updateBranchMass(parentBranch, node);
+ }
+
+ if (parentBranch.children.NW.range.maxX > node.x) {
+ // in NW or SW
+ if (parentBranch.children.NW.range.maxY > node.y) {
+ // in NW
+ this._placeInRegion(parentBranch, node, "NW");
+ } else {
+ // in SW
+ this._placeInRegion(parentBranch, node, "SW");
+ }
+ } else {
+ // in NE or SE
+ if (parentBranch.children.NW.range.maxY > node.y) {
+ // in NE
+ this._placeInRegion(parentBranch, node, "NE");
+ } else {
+ // in SE
+ this._placeInRegion(parentBranch, node, "SE");
+ }
+ }
+ }
+
+ /**
+ * actually place the node in a region (or branch)
+ *
+ * @param parentBranch
+ * @param node
+ * @param region
+ * @private
+ */
+
+ }, {
+ key: "_placeInRegion",
+ value: function _placeInRegion(parentBranch, node, region) {
+ switch (parentBranch.children[region].childrenCount) {
+ case 0:
+ // place node here
+ parentBranch.children[region].children.data = node;
+ parentBranch.children[region].childrenCount = 1;
+ this._updateBranchMass(parentBranch.children[region], node);
+ break;
+ case 1:
+ // convert into children
+ // if there are two nodes exactly overlapping (on init, on opening of cluster etc.)
+ // we move one node a little bit and we do not put it in the tree.
+ if (parentBranch.children[region].children.data.x === node.x && parentBranch.children[region].children.data.y === node.y) {
+ node.x += this.seededRandom();
+ node.y += this.seededRandom();
+ } else {
+ this._splitBranch(parentBranch.children[region]);
+ this._placeInTree(parentBranch.children[region], node);
+ }
+ break;
+ case 4:
+ // place in branch
+ this._placeInTree(parentBranch.children[region], node);
+ break;
+ }
+ }
+
+ /**
+ * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch
+ * after the split is complete.
+ *
+ * @param parentBranch
+ * @private
+ */
+
+ }, {
+ key: "_splitBranch",
+ value: function _splitBranch(parentBranch) {
+ // if the branch is shaded with a node, replace the node in the new subset.
+ var containedNode = null;
+ if (parentBranch.childrenCount === 1) {
+ containedNode = parentBranch.children.data;
+ parentBranch.mass = 0;
+ parentBranch.centerOfMass.x = 0;
+ parentBranch.centerOfMass.y = 0;
+ }
+ parentBranch.childrenCount = 4;
+ parentBranch.children.data = null;
+ this._insertRegion(parentBranch, "NW");
+ this._insertRegion(parentBranch, "NE");
+ this._insertRegion(parentBranch, "SW");
+ this._insertRegion(parentBranch, "SE");
+
+ if (containedNode != null) {
+ this._placeInTree(parentBranch, containedNode);
+ }
+ }
+
+ /**
+ * This function subdivides the region into four new segments.
+ * Specifically, this inserts a single new segment.
+ * It fills the children section of the parentBranch
+ *
+ * @param parentBranch
+ * @param region
+ * @param parentRange
+ * @private
+ */
+
+ }, {
+ key: "_insertRegion",
+ value: function _insertRegion(parentBranch, region) {
+ var minX = void 0,
+ maxX = void 0,
+ minY = void 0,
+ maxY = void 0;
+ var childSize = 0.5 * parentBranch.size;
+ switch (region) {
+ case "NW":
+ minX = parentBranch.range.minX;
+ maxX = parentBranch.range.minX + childSize;
+ minY = parentBranch.range.minY;
+ maxY = parentBranch.range.minY + childSize;
+ break;
+ case "NE":
+ minX = parentBranch.range.minX + childSize;
+ maxX = parentBranch.range.maxX;
+ minY = parentBranch.range.minY;
+ maxY = parentBranch.range.minY + childSize;
+ break;
+ case "SW":
+ minX = parentBranch.range.minX;
+ maxX = parentBranch.range.minX + childSize;
+ minY = parentBranch.range.minY + childSize;
+ maxY = parentBranch.range.maxY;
+ break;
+ case "SE":
+ minX = parentBranch.range.minX + childSize;
+ maxX = parentBranch.range.maxX;
+ minY = parentBranch.range.minY + childSize;
+ maxY = parentBranch.range.maxY;
+ break;
+ }
+
+ parentBranch.children[region] = {
+ centerOfMass: { x: 0, y: 0 },
+ mass: 0,
+ range: { minX: minX, maxX: maxX, minY: minY, maxY: maxY },
+ size: 0.5 * parentBranch.size,
+ calcSize: 2 * parentBranch.calcSize,
+ children: { data: null },
+ maxWidth: 0,
+ level: parentBranch.level + 1,
+ childrenCount: 0
+ };
+ }
+
+ //--------------------------- DEBUGGING BELOW ---------------------------//
+
+
+ /**
+ * This function is for debugging purposed, it draws the tree.
+ *
+ * @param ctx
+ * @param color
+ * @private
+ */
+
+ }, {
+ key: "_debug",
+ value: function _debug(ctx, color) {
+ if (this.barnesHutTree !== undefined) {
+
+ ctx.lineWidth = 1;
+
+ this._drawBranch(this.barnesHutTree.root, ctx, color);
+ }
+ }
+
+ /**
+ * This function is for debugging purposes. It draws the branches recursively.
+ *
+ * @param branch
+ * @param ctx
+ * @param color
+ * @private
+ */
+
+ }, {
+ key: "_drawBranch",
+ value: function _drawBranch(branch, ctx, color) {
+ if (color === undefined) {
+ color = "#FF0000";
+ }
+
+ if (branch.childrenCount === 4) {
+ this._drawBranch(branch.children.NW, ctx);
+ this._drawBranch(branch.children.NE, ctx);
+ this._drawBranch(branch.children.SE, ctx);
+ this._drawBranch(branch.children.SW, ctx);
+ }
+ ctx.strokeStyle = color;
+ ctx.beginPath();
+ ctx.moveTo(branch.range.minX, branch.range.minY);
+ ctx.lineTo(branch.range.maxX, branch.range.minY);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(branch.range.maxX, branch.range.minY);
+ ctx.lineTo(branch.range.maxX, branch.range.maxY);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(branch.range.maxX, branch.range.maxY);
+ ctx.lineTo(branch.range.minX, branch.range.maxY);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(branch.range.minX, branch.range.maxY);
+ ctx.lineTo(branch.range.minX, branch.range.minY);
+ ctx.stroke();
+
+ /*
+ if (branch.mass > 0) {
+ ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass);
+ ctx.stroke();
+ }
+ */
+ }
+ }]);
+ return BarnesHutSolver;
+ }();
+
+ exports["default"] = BarnesHutSolver;
+
+/***/ },
+/* 202 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var RepulsionSolver = function () {
+ function RepulsionSolver(body, physicsBody, options) {
+ (0, _classCallCheck3["default"])(this, RepulsionSolver);
+
+ this.body = body;
+ this.physicsBody = physicsBody;
+ this.setOptions(options);
+ }
+
+ (0, _createClass3["default"])(RepulsionSolver, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ this.options = options;
+ }
+ /**
+ * Calculate the forces the nodes apply on each other based on a repulsion field.
+ * This field is linearly approximated.
+ *
+ * @private
+ */
+
+ }, {
+ key: "solve",
+ value: function solve() {
+ var dx, dy, distance, fx, fy, repulsingForce, node1, node2;
+
+ var nodes = this.body.nodes;
+ var nodeIndices = this.physicsBody.physicsNodeIndices;
+ var forces = this.physicsBody.forces;
+
+ // repulsing forces between nodes
+ var nodeDistance = this.options.nodeDistance;
+
+ // approximation constants
+ var a = -2 / 3 / nodeDistance;
+ var b = 4 / 3;
+
+ // we loop from i over all but the last entree in the array
+ // j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j
+ for (var i = 0; i < nodeIndices.length - 1; i++) {
+ node1 = nodes[nodeIndices[i]];
+ for (var j = i + 1; j < nodeIndices.length; j++) {
+ node2 = nodes[nodeIndices[j]];
+
+ dx = node2.x - node1.x;
+ dy = node2.y - node1.y;
+ distance = Math.sqrt(dx * dx + dy * dy);
+
+ // same condition as BarnesHutSolver, making sure nodes are never 100% overlapping.
+ if (distance === 0) {
+ distance = 0.1 * Math.random();
+ dx = distance;
+ }
+
+ if (distance < 2 * nodeDistance) {
+ if (distance < 0.5 * nodeDistance) {
+ repulsingForce = 1.0;
+ } else {
+ repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / nodeDistance - 1) * steepness))
+ }
+ repulsingForce = repulsingForce / distance;
+
+ fx = dx * repulsingForce;
+ fy = dy * repulsingForce;
+
+ forces[node1.id].x -= fx;
+ forces[node1.id].y -= fy;
+ forces[node2.id].x += fx;
+ forces[node2.id].y += fy;
+ }
+ }
+ }
+ }
+ }]);
+ return RepulsionSolver;
+ }();
+
+ exports["default"] = RepulsionSolver;
+
+/***/ },
+/* 203 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var HierarchicalRepulsionSolver = function () {
+ function HierarchicalRepulsionSolver(body, physicsBody, options) {
+ (0, _classCallCheck3["default"])(this, HierarchicalRepulsionSolver);
+
+ this.body = body;
+ this.physicsBody = physicsBody;
+ this.setOptions(options);
+ }
+
+ (0, _createClass3["default"])(HierarchicalRepulsionSolver, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ this.options = options;
+ }
+
+ /**
+ * Calculate the forces the nodes apply on each other based on a repulsion field.
+ * This field is linearly approximated.
+ *
+ * @private
+ */
+
+ }, {
+ key: "solve",
+ value: function solve() {
+ var dx, dy, distance, fx, fy, repulsingForce, node1, node2, i, j;
+
+ var nodes = this.body.nodes;
+ var nodeIndices = this.physicsBody.physicsNodeIndices;
+ var forces = this.physicsBody.forces;
+
+ // repulsing forces between nodes
+ var nodeDistance = this.options.nodeDistance;
+
+ // we loop from i over all but the last entree in the array
+ // j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j
+ for (i = 0; i < nodeIndices.length - 1; i++) {
+ node1 = nodes[nodeIndices[i]];
+ for (j = i + 1; j < nodeIndices.length; j++) {
+ node2 = nodes[nodeIndices[j]];
+
+ // nodes only affect nodes on their level
+ if (node1.level === node2.level) {
+ dx = node2.x - node1.x;
+ dy = node2.y - node1.y;
+ distance = Math.sqrt(dx * dx + dy * dy);
+
+ var steepness = 0.05;
+ if (distance < nodeDistance) {
+ repulsingForce = -Math.pow(steepness * distance, 2) + Math.pow(steepness * nodeDistance, 2);
+ } else {
+ repulsingForce = 0;
+ }
+ // normalize force with
+ if (distance === 0) {
+ distance = 0.01;
+ } else {
+ repulsingForce = repulsingForce / distance;
+ }
+ fx = dx * repulsingForce;
+ fy = dy * repulsingForce;
+
+ forces[node1.id].x -= fx;
+ forces[node1.id].y -= fy;
+ forces[node2.id].x += fx;
+ forces[node2.id].y += fy;
+ }
+ }
+ }
+ }
+ }]);
+ return HierarchicalRepulsionSolver;
+ }();
+
+ exports["default"] = HierarchicalRepulsionSolver;
+
+/***/ },
+/* 204 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var SpringSolver = function () {
+ function SpringSolver(body, physicsBody, options) {
+ (0, _classCallCheck3["default"])(this, SpringSolver);
+
+ this.body = body;
+ this.physicsBody = physicsBody;
+ this.setOptions(options);
+ }
+
+ (0, _createClass3["default"])(SpringSolver, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ this.options = options;
+ }
+
+ /**
+ * This function calculates the springforces on the nodes, accounting for the support nodes.
+ *
+ * @private
+ */
+
+ }, {
+ key: "solve",
+ value: function solve() {
+ var edgeLength = void 0,
+ edge = void 0;
+ var edgeIndices = this.physicsBody.physicsEdgeIndices;
+ var edges = this.body.edges;
+ var node1 = void 0,
+ node2 = void 0,
+ node3 = void 0;
+
+ // forces caused by the edges, modelled as springs
+ for (var i = 0; i < edgeIndices.length; i++) {
+ edge = edges[edgeIndices[i]];
+ if (edge.connected === true && edge.toId !== edge.fromId) {
+ // only calculate forces if nodes are in the same sector
+ if (this.body.nodes[edge.toId] !== undefined && this.body.nodes[edge.fromId] !== undefined) {
+ if (edge.edgeType.via !== undefined) {
+ edgeLength = edge.options.length === undefined ? this.options.springLength : edge.options.length;
+ node1 = edge.to;
+ node2 = edge.edgeType.via;
+ node3 = edge.from;
+
+ this._calculateSpringForce(node1, node2, 0.5 * edgeLength);
+ this._calculateSpringForce(node2, node3, 0.5 * edgeLength);
+ } else {
+ // the * 1.5 is here so the edge looks as large as a smooth edge. It does not initially because the smooth edges use
+ // the support nodes which exert a repulsive force on the to and from nodes, making the edge appear larger.
+ edgeLength = edge.options.length === undefined ? this.options.springLength * 1.5 : edge.options.length;
+ this._calculateSpringForce(edge.from, edge.to, edgeLength);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is the code actually performing the calculation for the function above.
+ *
+ * @param node1
+ * @param node2
+ * @param edgeLength
+ * @private
+ */
+
+ }, {
+ key: "_calculateSpringForce",
+ value: function _calculateSpringForce(node1, node2, edgeLength) {
+ var dx = node1.x - node2.x;
+ var dy = node1.y - node2.y;
+ var distance = Math.max(Math.sqrt(dx * dx + dy * dy), 0.01);
+
+ // the 1/distance is so the fx and fy can be calculated without sine or cosine.
+ var springForce = this.options.springConstant * (edgeLength - distance) / distance;
+
+ var fx = dx * springForce;
+ var fy = dy * springForce;
+
+ // handle the case where one node is not part of the physcis
+ if (this.physicsBody.forces[node1.id] !== undefined) {
+ this.physicsBody.forces[node1.id].x += fx;
+ this.physicsBody.forces[node1.id].y += fy;
+ }
+
+ if (this.physicsBody.forces[node2.id] !== undefined) {
+ this.physicsBody.forces[node2.id].x -= fx;
+ this.physicsBody.forces[node2.id].y -= fy;
+ }
+ }
+ }]);
+ return SpringSolver;
+ }();
+
+ exports["default"] = SpringSolver;
+
+/***/ },
+/* 205 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var HierarchicalSpringSolver = function () {
+ function HierarchicalSpringSolver(body, physicsBody, options) {
+ (0, _classCallCheck3["default"])(this, HierarchicalSpringSolver);
+
+ this.body = body;
+ this.physicsBody = physicsBody;
+ this.setOptions(options);
+ }
+
+ (0, _createClass3["default"])(HierarchicalSpringSolver, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ this.options = options;
+ }
+
+ /**
+ * This function calculates the springforces on the nodes, accounting for the support nodes.
+ *
+ * @private
+ */
+
+ }, {
+ key: "solve",
+ value: function solve() {
+ var edgeLength, edge;
+ var dx, dy, fx, fy, springForce, distance;
+ var edges = this.body.edges;
+ var factor = 0.5;
+
+ var edgeIndices = this.physicsBody.physicsEdgeIndices;
+ var nodeIndices = this.physicsBody.physicsNodeIndices;
+ var forces = this.physicsBody.forces;
+
+ // initialize the spring force counters
+ for (var i = 0; i < nodeIndices.length; i++) {
+ var nodeId = nodeIndices[i];
+ forces[nodeId].springFx = 0;
+ forces[nodeId].springFy = 0;
+ }
+
+ // forces caused by the edges, modelled as springs
+ for (var _i = 0; _i < edgeIndices.length; _i++) {
+ edge = edges[edgeIndices[_i]];
+ if (edge.connected === true) {
+ edgeLength = edge.options.length === undefined ? this.options.springLength : edge.options.length;
+
+ dx = edge.from.x - edge.to.x;
+ dy = edge.from.y - edge.to.y;
+ distance = Math.sqrt(dx * dx + dy * dy);
+ distance = distance === 0 ? 0.01 : distance;
+
+ // the 1/distance is so the fx and fy can be calculated without sine or cosine.
+ springForce = this.options.springConstant * (edgeLength - distance) / distance;
+
+ fx = dx * springForce;
+ fy = dy * springForce;
+
+ if (edge.to.level != edge.from.level) {
+ if (forces[edge.toId] !== undefined) {
+ forces[edge.toId].springFx -= fx;
+ forces[edge.toId].springFy -= fy;
+ }
+ if (forces[edge.fromId] !== undefined) {
+ forces[edge.fromId].springFx += fx;
+ forces[edge.fromId].springFy += fy;
+ }
+ } else {
+ if (forces[edge.toId] !== undefined) {
+ forces[edge.toId].x -= factor * fx;
+ forces[edge.toId].y -= factor * fy;
+ }
+ if (forces[edge.fromId] !== undefined) {
+ forces[edge.fromId].x += factor * fx;
+ forces[edge.fromId].y += factor * fy;
+ }
+ }
+ }
+ }
+
+ // normalize spring forces
+ var springForce = 1;
+ var springFx, springFy;
+ for (var _i2 = 0; _i2 < nodeIndices.length; _i2++) {
+ var _nodeId = nodeIndices[_i2];
+ springFx = Math.min(springForce, Math.max(-springForce, forces[_nodeId].springFx));
+ springFy = Math.min(springForce, Math.max(-springForce, forces[_nodeId].springFy));
+
+ forces[_nodeId].x += springFx;
+ forces[_nodeId].y += springFy;
+ }
+
+ // retain energy balance
+ var totalFx = 0;
+ var totalFy = 0;
+ for (var _i3 = 0; _i3 < nodeIndices.length; _i3++) {
+ var _nodeId2 = nodeIndices[_i3];
+ totalFx += forces[_nodeId2].x;
+ totalFy += forces[_nodeId2].y;
+ }
+ var correctionFx = totalFx / nodeIndices.length;
+ var correctionFy = totalFy / nodeIndices.length;
+
+ for (var _i4 = 0; _i4 < nodeIndices.length; _i4++) {
+ var _nodeId3 = nodeIndices[_i4];
+ forces[_nodeId3].x -= correctionFx;
+ forces[_nodeId3].y -= correctionFy;
+ }
+ }
+ }]);
+ return HierarchicalSpringSolver;
+ }();
+
+ exports["default"] = HierarchicalSpringSolver;
+
+/***/ },
+/* 206 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var CentralGravitySolver = function () {
+ function CentralGravitySolver(body, physicsBody, options) {
+ (0, _classCallCheck3["default"])(this, CentralGravitySolver);
+
+ this.body = body;
+ this.physicsBody = physicsBody;
+ this.setOptions(options);
+ }
+
+ (0, _createClass3["default"])(CentralGravitySolver, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ this.options = options;
+ }
+ }, {
+ key: "solve",
+ value: function solve() {
+ var dx = void 0,
+ dy = void 0,
+ distance = void 0,
+ node = void 0;
+ var nodes = this.body.nodes;
+ var nodeIndices = this.physicsBody.physicsNodeIndices;
+ var forces = this.physicsBody.forces;
+
+ for (var i = 0; i < nodeIndices.length; i++) {
+ var nodeId = nodeIndices[i];
+ node = nodes[nodeId];
+ dx = -node.x;
+ dy = -node.y;
+ distance = Math.sqrt(dx * dx + dy * dy);
+
+ this._calculateForces(distance, dx, dy, forces, node);
+ }
+ }
+
+ /**
+ * Calculate the forces based on the distance.
+ * @private
+ */
+
+ }, {
+ key: "_calculateForces",
+ value: function _calculateForces(distance, dx, dy, forces, node) {
+ var gravityForce = distance === 0 ? 0 : this.options.centralGravity / distance;
+ forces[node.id].x = dx * gravityForce;
+ forces[node.id].y = dy * gravityForce;
+ }
+ }]);
+ return CentralGravitySolver;
+ }();
+
+ exports["default"] = CentralGravitySolver;
+
+/***/ },
+/* 207 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _BarnesHutSolver2 = __webpack_require__(201);
+
+ var _BarnesHutSolver3 = _interopRequireDefault(_BarnesHutSolver2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var ForceAtlas2BasedRepulsionSolver = function (_BarnesHutSolver) {
+ (0, _inherits3["default"])(ForceAtlas2BasedRepulsionSolver, _BarnesHutSolver);
+
+ function ForceAtlas2BasedRepulsionSolver(body, physicsBody, options) {
+ (0, _classCallCheck3["default"])(this, ForceAtlas2BasedRepulsionSolver);
+ return (0, _possibleConstructorReturn3["default"])(this, (ForceAtlas2BasedRepulsionSolver.__proto__ || (0, _getPrototypeOf2["default"])(ForceAtlas2BasedRepulsionSolver)).call(this, body, physicsBody, options));
+ }
+
+ /**
+ * Calculate the forces based on the distance.
+ *
+ * @param distance
+ * @param dx
+ * @param dy
+ * @param node
+ * @param parentBranch
+ * @private
+ */
+
+
+ (0, _createClass3["default"])(ForceAtlas2BasedRepulsionSolver, [{
+ key: "_calculateForces",
+ value: function _calculateForces(distance, dx, dy, node, parentBranch) {
+ if (distance === 0) {
+ distance = 0.1 * Math.random();
+ dx = distance;
+ }
+
+ if (this.overlapAvoidanceFactor < 1 && node.shape.radius) {
+ distance = Math.max(0.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius);
+ }
+
+ var degree = node.edges.length + 1;
+ // the dividing by the distance cubed instead of squared allows us to get the fx and fy components without sines and cosines
+ // it is shorthand for gravityforce with distance squared and fx = dx/distance * gravityForce
+ var gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass * degree / Math.pow(distance, 2);
+ var fx = dx * gravityForce;
+ var fy = dy * gravityForce;
+
+ this.physicsBody.forces[node.id].x += fx;
+ this.physicsBody.forces[node.id].y += fy;
+ }
+ }]);
+ return ForceAtlas2BasedRepulsionSolver;
+ }(_BarnesHutSolver3["default"]);
+
+ exports["default"] = ForceAtlas2BasedRepulsionSolver;
+
+/***/ },
+/* 208 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _CentralGravitySolver2 = __webpack_require__(206);
+
+ var _CentralGravitySolver3 = _interopRequireDefault(_CentralGravitySolver2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var ForceAtlas2BasedCentralGravitySolver = function (_CentralGravitySolver) {
+ (0, _inherits3["default"])(ForceAtlas2BasedCentralGravitySolver, _CentralGravitySolver);
+
+ function ForceAtlas2BasedCentralGravitySolver(body, physicsBody, options) {
+ (0, _classCallCheck3["default"])(this, ForceAtlas2BasedCentralGravitySolver);
+ return (0, _possibleConstructorReturn3["default"])(this, (ForceAtlas2BasedCentralGravitySolver.__proto__ || (0, _getPrototypeOf2["default"])(ForceAtlas2BasedCentralGravitySolver)).call(this, body, physicsBody, options));
+ }
+
+ /**
+ * Calculate the forces based on the distance.
+ * @private
+ */
+
+
+ (0, _createClass3["default"])(ForceAtlas2BasedCentralGravitySolver, [{
+ key: "_calculateForces",
+ value: function _calculateForces(distance, dx, dy, forces, node) {
+ if (distance > 0) {
+ var degree = node.edges.length + 1;
+ var gravityForce = this.options.centralGravity * degree * node.options.mass;
+ forces[node.id].x = dx * gravityForce;
+ forces[node.id].y = dy * gravityForce;
+ }
+ }
+ }]);
+ return ForceAtlas2BasedCentralGravitySolver;
+ }(_CentralGravitySolver3["default"]);
+
+ exports["default"] = ForceAtlas2BasedCentralGravitySolver;
+
+/***/ },
+/* 209 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _NetworkUtil = __webpack_require__(210);
+
+ var _NetworkUtil2 = _interopRequireDefault(_NetworkUtil);
+
+ var _Cluster = __webpack_require__(211);
+
+ var _Cluster2 = _interopRequireDefault(_Cluster);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var ClusterEngine = function () {
+ function ClusterEngine(body) {
+ var _this = this;
+
+ (0, _classCallCheck3['default'])(this, ClusterEngine);
+
+ this.body = body;
+ this.clusteredNodes = {};
+ this.clusteredEdges = {};
+
+ this.options = {};
+ this.defaultOptions = {};
+ util.extend(this.options, this.defaultOptions);
+
+ this.body.emitter.on('_resetData', function () {
+ _this.clusteredNodes = {};_this.clusteredEdges = {};
+ });
+ }
+
+ /**
+ *
+ * @param hubsize
+ * @param options
+ */
+
+
+ (0, _createClass3['default'])(ClusterEngine, [{
+ key: 'clusterByHubsize',
+ value: function clusterByHubsize(hubsize, options) {
+ if (hubsize === undefined) {
+ hubsize = this._getHubSize();
+ } else if ((typeof hubsize === 'undefined' ? 'undefined' : (0, _typeof3['default'])(hubsize)) === "object") {
+ options = this._checkOptions(hubsize);
+ hubsize = this._getHubSize();
+ }
+
+ var nodesToCluster = [];
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ var node = this.body.nodes[this.body.nodeIndices[i]];
+ if (node.edges.length >= hubsize) {
+ nodesToCluster.push(node.id);
+ }
+ }
+
+ for (var _i = 0; _i < nodesToCluster.length; _i++) {
+ this.clusterByConnection(nodesToCluster[_i], options, true);
+ }
+
+ this.body.emitter.emit('_dataChanged');
+ }
+
+ /**
+ * loop over all nodes, check if they adhere to the condition and cluster if needed.
+ * @param options
+ * @param refreshData
+ */
+
+ }, {
+ key: 'cluster',
+ value: function cluster() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (options.joinCondition === undefined) {
+ throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");
+ }
+
+ // check if the options object is fine, append if needed
+ options = this._checkOptions(options);
+
+ var childNodesObj = {};
+ var childEdgesObj = {};
+
+ // collect the nodes that will be in the cluster
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ var nodeId = this.body.nodeIndices[i];
+ var node = this.body.nodes[nodeId];
+ var clonedOptions = _NetworkUtil2['default'].cloneOptions(node);
+ if (options.joinCondition(clonedOptions) === true) {
+ childNodesObj[nodeId] = this.body.nodes[nodeId];
+
+ // collect the nodes that will be in the cluster
+ for (var _i2 = 0; _i2 < node.edges.length; _i2++) {
+ var edge = node.edges[_i2];
+ if (this.clusteredEdges[edge.id] === undefined) {
+ childEdgesObj[edge.id] = edge;
+ }
+ }
+ }
+ }
+
+ this._cluster(childNodesObj, childEdgesObj, options, refreshData);
+ }
+
+ /**
+ * Cluster all nodes in the network that have only X edges
+ * @param edgeCount
+ * @param options
+ * @param refreshData
+ */
+
+ }, {
+ key: 'clusterByEdgeCount',
+ value: function clusterByEdgeCount(edgeCount, options) {
+ var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
+
+ options = this._checkOptions(options);
+ var clusters = [];
+ var usedNodes = {};
+ var edge = void 0,
+ edges = void 0,
+ node = void 0,
+ nodeId = void 0,
+ relevantEdgeCount = void 0;
+ // collect the nodes that will be in the cluster
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ var childNodesObj = {};
+ var childEdgesObj = {};
+ nodeId = this.body.nodeIndices[i];
+
+ // if this node is already used in another cluster this session, we do not have to re-evaluate it.
+ if (usedNodes[nodeId] === undefined) {
+ relevantEdgeCount = 0;
+ node = this.body.nodes[nodeId];
+ edges = [];
+ for (var j = 0; j < node.edges.length; j++) {
+ edge = node.edges[j];
+ if (this.clusteredEdges[edge.id] === undefined) {
+ if (edge.toId !== edge.fromId) {
+ relevantEdgeCount++;
+ }
+ edges.push(edge);
+ }
+ }
+
+ // this node qualifies, we collect its neighbours to start the clustering process.
+ if (relevantEdgeCount === edgeCount) {
+ var gatheringSuccessful = true;
+ for (var _j = 0; _j < edges.length; _j++) {
+ edge = edges[_j];
+ var childNodeId = this._getConnectedId(edge, nodeId);
+ // add the nodes to the list by the join condition.
+ if (options.joinCondition === undefined) {
+ childEdgesObj[edge.id] = edge;
+ childNodesObj[nodeId] = this.body.nodes[nodeId];
+ childNodesObj[childNodeId] = this.body.nodes[childNodeId];
+ usedNodes[nodeId] = true;
+ } else {
+ var clonedOptions = _NetworkUtil2['default'].cloneOptions(this.body.nodes[nodeId]);
+ if (options.joinCondition(clonedOptions) === true) {
+ childEdgesObj[edge.id] = edge;
+ childNodesObj[nodeId] = this.body.nodes[nodeId];
+ usedNodes[nodeId] = true;
+ } else {
+ // this node does not qualify after all.
+ gatheringSuccessful = false;
+ break;
+ }
+ }
+ }
+
+ // add to the cluster queue
+ if ((0, _keys2['default'])(childNodesObj).length > 0 && (0, _keys2['default'])(childEdgesObj).length > 0 && gatheringSuccessful === true) {
+ clusters.push({ nodes: childNodesObj, edges: childEdgesObj });
+ }
+ }
+ }
+ }
+
+ for (var _i3 = 0; _i3 < clusters.length; _i3++) {
+ this._cluster(clusters[_i3].nodes, clusters[_i3].edges, options, false);
+ }
+
+ if (refreshData === true) {
+ this.body.emitter.emit('_dataChanged');
+ }
+ }
+
+ /**
+ * Cluster all nodes in the network that have only 1 edge
+ * @param options
+ * @param refreshData
+ */
+
+ }, {
+ key: 'clusterOutliers',
+ value: function clusterOutliers(options) {
+ var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ this.clusterByEdgeCount(1, options, refreshData);
+ }
+
+ /**
+ * Cluster all nodes in the network that have only 2 edge
+ * @param options
+ * @param refreshData
+ */
+
+ }, {
+ key: 'clusterBridges',
+ value: function clusterBridges(options) {
+ var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ this.clusterByEdgeCount(2, options, refreshData);
+ }
+
+ /**
+ * suck all connected nodes of a node into the node.
+ * @param nodeId
+ * @param options
+ * @param refreshData
+ */
+
+ }, {
+ key: 'clusterByConnection',
+ value: function clusterByConnection(nodeId, options) {
+ var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
+
+ // kill conditions
+ if (nodeId === undefined) {
+ throw new Error("No nodeId supplied to clusterByConnection!");
+ }
+ if (this.body.nodes[nodeId] === undefined) {
+ throw new Error("The nodeId given to clusterByConnection does not exist!");
+ }
+
+ var node = this.body.nodes[nodeId];
+ options = this._checkOptions(options, node);
+ if (options.clusterNodeProperties.x === undefined) {
+ options.clusterNodeProperties.x = node.x;
+ }
+ if (options.clusterNodeProperties.y === undefined) {
+ options.clusterNodeProperties.y = node.y;
+ }
+ if (options.clusterNodeProperties.fixed === undefined) {
+ options.clusterNodeProperties.fixed = {};
+ options.clusterNodeProperties.fixed.x = node.options.fixed.x;
+ options.clusterNodeProperties.fixed.y = node.options.fixed.y;
+ }
+
+ var childNodesObj = {};
+ var childEdgesObj = {};
+ var parentNodeId = node.id;
+ var parentClonedOptions = _NetworkUtil2['default'].cloneOptions(node);
+ childNodesObj[parentNodeId] = node;
+
+ // collect the nodes that will be in the cluster
+ for (var i = 0; i < node.edges.length; i++) {
+ var edge = node.edges[i];
+ if (this.clusteredEdges[edge.id] === undefined) {
+ var childNodeId = this._getConnectedId(edge, parentNodeId);
+
+ // if the child node is not in a cluster
+ if (this.clusteredNodes[childNodeId] === undefined) {
+ if (childNodeId !== parentNodeId) {
+ if (options.joinCondition === undefined) {
+ childEdgesObj[edge.id] = edge;
+ childNodesObj[childNodeId] = this.body.nodes[childNodeId];
+ } else {
+ // clone the options and insert some additional parameters that could be interesting.
+ var childClonedOptions = _NetworkUtil2['default'].cloneOptions(this.body.nodes[childNodeId]);
+ if (options.joinCondition(parentClonedOptions, childClonedOptions) === true) {
+ childEdgesObj[edge.id] = edge;
+ childNodesObj[childNodeId] = this.body.nodes[childNodeId];
+ }
+ }
+ } else {
+ // swallow the edge if it is self-referencing.
+ childEdgesObj[edge.id] = edge;
+ }
+ }
+ }
+ }
+ var childNodeIDs = (0, _keys2['default'])(childNodesObj).map(function (childNode) {
+ return childNodesObj[childNode].id;
+ });
+
+ for (childNode in childNodesObj) {
+ var childNode = childNodesObj[childNode];
+ for (var y = 0; y < childNode.edges.length; y++) {
+ var childEdge = childNode.edges[y];
+ if (childNodeIDs.indexOf(this._getConnectedId(childEdge, childNode.id)) > -1) {
+ childEdgesObj[childEdge.id] = childEdge;
+ }
+ }
+ }
+ this._cluster(childNodesObj, childEdgesObj, options, refreshData);
+ }
+
+ /**
+ * This function creates the edges that will be attached to the cluster
+ * It looks for edges that are connected to the nodes from the "outside' of the cluster.
+ *
+ * @param childNodesObj
+ * @param childEdgesObj
+ * @param clusterNodeProperties
+ * @param clusterEdgeProperties
+ * @private
+ */
+
+ }, {
+ key: '_createClusterEdges',
+ value: function _createClusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, clusterEdgeProperties) {
+ var edge = void 0,
+ childNodeId = void 0,
+ childNode = void 0,
+ toId = void 0,
+ fromId = void 0,
+ otherNodeId = void 0;
+
+ // loop over all child nodes and their edges to find edges going out of the cluster
+ // these edges will be replaced by clusterEdges.
+ var childKeys = (0, _keys2['default'])(childNodesObj);
+ var createEdges = [];
+ for (var i = 0; i < childKeys.length; i++) {
+ childNodeId = childKeys[i];
+ childNode = childNodesObj[childNodeId];
+
+ // construct new edges from the cluster to others
+ for (var j = 0; j < childNode.edges.length; j++) {
+ edge = childNode.edges[j];
+ // we only handle edges that are visible to the system, not the disabled ones from the clustering process.
+ if (this.clusteredEdges[edge.id] === undefined) {
+ // self-referencing edges will be added to the "hidden" list
+ if (edge.toId == edge.fromId) {
+ childEdgesObj[edge.id] = edge;
+ } else {
+ // set up the from and to.
+ if (edge.toId == childNodeId) {
+ // this is a double equals because ints and strings can be interchanged here.
+ toId = clusterNodeProperties.id;
+ fromId = edge.fromId;
+ otherNodeId = fromId;
+ } else {
+ toId = edge.toId;
+ fromId = clusterNodeProperties.id;
+ otherNodeId = toId;
+ }
+ }
+
+ // Only edges from the cluster outwards are being replaced.
+ if (childNodesObj[otherNodeId] === undefined) {
+ createEdges.push({ edge: edge, fromId: fromId, toId: toId });
+ }
+ }
+ }
+ }
+
+ // here we actually create the replacement edges. We could not do this in the loop above as the creation process
+ // would add an edge to the edges array we are iterating over.
+ for (var _j2 = 0; _j2 < createEdges.length; _j2++) {
+ var _edge = createEdges[_j2].edge;
+ // copy the options of the edge we will replace
+ var clonedOptions = _NetworkUtil2['default'].cloneOptions(_edge, 'edge');
+ // make sure the properties of clusterEdges are superimposed on it
+ util.deepExtend(clonedOptions, clusterEdgeProperties);
+
+ // set up the edge
+ clonedOptions.from = createEdges[_j2].fromId;
+ clonedOptions.to = createEdges[_j2].toId;
+ clonedOptions.id = 'clusterEdge:' + util.randomUUID();
+ //clonedOptions.id = '(cf: ' + createEdges[j].fromId + " to: " + createEdges[j].toId + ")" + Math.random();
+
+ // create the edge and give a reference to the one it replaced.
+ var newEdge = this.body.functions.createEdge(clonedOptions);
+ newEdge.clusteringEdgeReplacingId = _edge.id;
+
+ // also reference the new edge in the old edge
+ this.body.edges[_edge.id].edgeReplacedById = newEdge.id;
+
+ // connect the edge.
+ this.body.edges[newEdge.id] = newEdge;
+ newEdge.connect();
+
+ // hide the replaced edge
+ this._backupEdgeOptions(_edge);
+ _edge.setOptions({ physics: false, hidden: true });
+ }
+ }
+
+ /**
+ * This function checks the options that can be supplied to the different cluster functions
+ * for certain fields and inserts defaults if needed
+ * @param options
+ * @returns {*}
+ * @private
+ */
+
+ }, {
+ key: '_checkOptions',
+ value: function _checkOptions() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ if (options.clusterEdgeProperties === undefined) {
+ options.clusterEdgeProperties = {};
+ }
+ if (options.clusterNodeProperties === undefined) {
+ options.clusterNodeProperties = {};
+ }
+
+ return options;
+ }
+
+ /**
+ *
+ * @param {Object} childNodesObj | object with node objects, id as keys, same as childNodes except it also contains a source node
+ * @param {Object} childEdgesObj | object with edge objects, id as keys
+ * @param {Array} options | object with {clusterNodeProperties, clusterEdgeProperties, processProperties}
+ * @param {Boolean} refreshData | when true, do not wrap up
+ * @private
+ */
+
+ }, {
+ key: '_cluster',
+ value: function _cluster(childNodesObj, childEdgesObj, options) {
+ var refreshData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+
+ // kill condition: no nodes don't bother
+ if ((0, _keys2['default'])(childNodesObj).length == 0) {
+ return;
+ }
+
+ // allow clusters of 1 if options allow
+ if ((0, _keys2['default'])(childNodesObj).length == 1 && options.clusterNodeProperties.allowSingleNodeCluster != true) {
+ return;
+ }
+
+ // check if this cluster call is not trying to cluster anything that is in another cluster.
+ for (var nodeId in childNodesObj) {
+ if (childNodesObj.hasOwnProperty(nodeId)) {
+ if (this.clusteredNodes[nodeId] !== undefined) {
+ return;
+ }
+ }
+ }
+
+ var clusterNodeProperties = util.deepExtend({}, options.clusterNodeProperties);
+
+ // construct the clusterNodeProperties
+ if (options.processProperties !== undefined) {
+ // get the childNode options
+ var childNodesOptions = [];
+ for (var _nodeId in childNodesObj) {
+ if (childNodesObj.hasOwnProperty(_nodeId)) {
+ var clonedOptions = _NetworkUtil2['default'].cloneOptions(childNodesObj[_nodeId]);
+ childNodesOptions.push(clonedOptions);
+ }
+ }
+
+ // get cluster properties based on childNodes
+ var childEdgesOptions = [];
+ for (var edgeId in childEdgesObj) {
+ if (childEdgesObj.hasOwnProperty(edgeId)) {
+ // these cluster edges will be removed on creation of the cluster.
+ if (edgeId.substr(0, 12) !== "clusterEdge:") {
+ var _clonedOptions = _NetworkUtil2['default'].cloneOptions(childEdgesObj[edgeId], 'edge');
+ childEdgesOptions.push(_clonedOptions);
+ }
+ }
+ }
+
+ clusterNodeProperties = options.processProperties(clusterNodeProperties, childNodesOptions, childEdgesOptions);
+ if (!clusterNodeProperties) {
+ throw new Error("The processProperties function does not return properties!");
+ }
+ }
+
+ // check if we have an unique id;
+ if (clusterNodeProperties.id === undefined) {
+ clusterNodeProperties.id = 'cluster:' + util.randomUUID();
+ }
+ var clusterId = clusterNodeProperties.id;
+
+ if (clusterNodeProperties.label === undefined) {
+ clusterNodeProperties.label = 'cluster';
+ }
+
+ // give the clusterNode a position if it does not have one.
+ var pos = undefined;
+ if (clusterNodeProperties.x === undefined) {
+ pos = this._getClusterPosition(childNodesObj);
+ clusterNodeProperties.x = pos.x;
+ }
+ if (clusterNodeProperties.y === undefined) {
+ if (pos === undefined) {
+ pos = this._getClusterPosition(childNodesObj);
+ }
+ clusterNodeProperties.y = pos.y;
+ }
+
+ // force the ID to remain the same
+ clusterNodeProperties.id = clusterId;
+
+ // create the clusterNode
+ var clusterNode = this.body.functions.createNode(clusterNodeProperties, _Cluster2['default']);
+ clusterNode.isCluster = true;
+ clusterNode.containedNodes = childNodesObj;
+ clusterNode.containedEdges = childEdgesObj;
+ // cache a copy from the cluster edge properties if we have to reconnect others later on
+ clusterNode.clusterEdgeProperties = options.clusterEdgeProperties;
+
+ // finally put the cluster node into global
+ this.body.nodes[clusterNodeProperties.id] = clusterNode;
+
+ // create the new edges that will connect to the cluster, all self-referencing edges will be added to childEdgesObject here.
+ this._createClusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, options.clusterEdgeProperties);
+
+ // disable the childEdges
+ for (var _edgeId in childEdgesObj) {
+ if (childEdgesObj.hasOwnProperty(_edgeId)) {
+ if (this.body.edges[_edgeId] !== undefined) {
+ var edge = this.body.edges[_edgeId];
+ // cache the options before changing
+ this._backupEdgeOptions(edge);
+ // disable physics and hide the edge
+ edge.setOptions({ physics: false, hidden: true });
+ }
+ }
+ }
+
+ // disable the childNodes
+ for (var _nodeId2 in childNodesObj) {
+ if (childNodesObj.hasOwnProperty(_nodeId2)) {
+ this.clusteredNodes[_nodeId2] = { clusterId: clusterNodeProperties.id, node: this.body.nodes[_nodeId2] };
+ this.body.nodes[_nodeId2].setOptions({ hidden: true, physics: false });
+ }
+ }
+
+ // set ID to undefined so no duplicates arise
+ clusterNodeProperties.id = undefined;
+
+ // wrap up
+ if (refreshData === true) {
+ this.body.emitter.emit('_dataChanged');
+ }
+ }
+ }, {
+ key: '_backupEdgeOptions',
+ value: function _backupEdgeOptions(edge) {
+ if (this.clusteredEdges[edge.id] === undefined) {
+ this.clusteredEdges[edge.id] = { physics: edge.options.physics, hidden: edge.options.hidden };
+ }
+ }
+ }, {
+ key: '_restoreEdge',
+ value: function _restoreEdge(edge) {
+ var originalOptions = this.clusteredEdges[edge.id];
+ if (originalOptions !== undefined) {
+ edge.setOptions({ physics: originalOptions.physics, hidden: originalOptions.hidden });
+ delete this.clusteredEdges[edge.id];
+ }
+ }
+
+ /**
+ * Check if a node is a cluster.
+ * @param nodeId
+ * @returns {*}
+ */
+
+ }, {
+ key: 'isCluster',
+ value: function isCluster(nodeId) {
+ if (this.body.nodes[nodeId] !== undefined) {
+ return this.body.nodes[nodeId].isCluster === true;
+ } else {
+ console.log("Node does not exist.");
+ return false;
+ }
+ }
+
+ /**
+ * get the position of the cluster node based on what's inside
+ * @param {object} childNodesObj | object with node objects, id as keys
+ * @returns {{x: number, y: number}}
+ * @private
+ */
+
+ }, {
+ key: '_getClusterPosition',
+ value: function _getClusterPosition(childNodesObj) {
+ var childKeys = (0, _keys2['default'])(childNodesObj);
+ var minX = childNodesObj[childKeys[0]].x;
+ var maxX = childNodesObj[childKeys[0]].x;
+ var minY = childNodesObj[childKeys[0]].y;
+ var maxY = childNodesObj[childKeys[0]].y;
+ var node = void 0;
+ for (var i = 1; i < childKeys.length; i++) {
+ node = childNodesObj[childKeys[i]];
+ minX = node.x < minX ? node.x : minX;
+ maxX = node.x > maxX ? node.x : maxX;
+ minY = node.y < minY ? node.y : minY;
+ maxY = node.y > maxY ? node.y : maxY;
+ }
+
+ return { x: 0.5 * (minX + maxX), y: 0.5 * (minY + maxY) };
+ }
+
+ /**
+ * Open a cluster by calling this function.
+ * @param {String} clusterNodeId | the ID of the cluster node
+ * @param {Boolean} refreshData | wrap up afterwards if not true
+ */
+
+ }, {
+ key: 'openCluster',
+ value: function openCluster(clusterNodeId, options) {
+ var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
+
+ // kill conditions
+ if (clusterNodeId === undefined) {
+ throw new Error("No clusterNodeId supplied to openCluster.");
+ }
+ if (this.body.nodes[clusterNodeId] === undefined) {
+ throw new Error("The clusterNodeId supplied to openCluster does not exist.");
+ }
+ if (this.body.nodes[clusterNodeId].containedNodes === undefined) {
+ console.log("The node:" + clusterNodeId + " is not a cluster.");
+ return;
+ }
+ var clusterNode = this.body.nodes[clusterNodeId];
+ var containedNodes = clusterNode.containedNodes;
+ var containedEdges = clusterNode.containedEdges;
+
+ // allow the user to position the nodes after release.
+ if (options !== undefined && options.releaseFunction !== undefined && typeof options.releaseFunction === 'function') {
+ var positions = {};
+ var clusterPosition = { x: clusterNode.x, y: clusterNode.y };
+ for (var nodeId in containedNodes) {
+ if (containedNodes.hasOwnProperty(nodeId)) {
+ var containedNode = this.body.nodes[nodeId];
+ positions[nodeId] = { x: containedNode.x, y: containedNode.y };
+ }
+ }
+ var newPositions = options.releaseFunction(clusterPosition, positions);
+
+ for (var _nodeId3 in containedNodes) {
+ if (containedNodes.hasOwnProperty(_nodeId3)) {
+ var _containedNode = this.body.nodes[_nodeId3];
+ if (newPositions[_nodeId3] !== undefined) {
+ _containedNode.x = newPositions[_nodeId3].x === undefined ? clusterNode.x : newPositions[_nodeId3].x;
+ _containedNode.y = newPositions[_nodeId3].y === undefined ? clusterNode.y : newPositions[_nodeId3].y;
+ }
+ }
+ }
+ } else {
+ // copy the position from the cluster
+ for (var _nodeId4 in containedNodes) {
+ if (containedNodes.hasOwnProperty(_nodeId4)) {
+ var _containedNode2 = this.body.nodes[_nodeId4];
+ _containedNode2 = containedNodes[_nodeId4];
+ // inherit position
+ if (_containedNode2.options.fixed.x === false) {
+ _containedNode2.x = clusterNode.x;
+ }
+ if (_containedNode2.options.fixed.y === false) {
+ _containedNode2.y = clusterNode.y;
+ }
+ }
+ }
+ }
+
+ // release nodes
+ for (var _nodeId5 in containedNodes) {
+ if (containedNodes.hasOwnProperty(_nodeId5)) {
+ var _containedNode3 = this.body.nodes[_nodeId5];
+
+ // inherit speed
+ _containedNode3.vx = clusterNode.vx;
+ _containedNode3.vy = clusterNode.vy;
+
+ // we use these methods to avoid re-instantiating the shape, which happens with setOptions.
+ _containedNode3.setOptions({ hidden: false, physics: true });
+
+ delete this.clusteredNodes[_nodeId5];
+ }
+ }
+
+ // copy the clusterNode edges because we cannot iterate over an object that we add or remove from.
+ var edgesToBeDeleted = [];
+ for (var i = 0; i < clusterNode.edges.length; i++) {
+ edgesToBeDeleted.push(clusterNode.edges[i]);
+ }
+
+ // actually handling the deleting.
+ for (var _i4 = 0; _i4 < edgesToBeDeleted.length; _i4++) {
+ var edge = edgesToBeDeleted[_i4];
+
+ var otherNodeId = this._getConnectedId(edge, clusterNodeId);
+ // if the other node is in another cluster, we transfer ownership of this edge to the other cluster
+ if (this.clusteredNodes[otherNodeId] !== undefined) {
+ // transfer ownership:
+ var otherCluster = this.body.nodes[this.clusteredNodes[otherNodeId].clusterId];
+ var transferEdge = this.body.edges[edge.clusteringEdgeReplacingId];
+ if (transferEdge !== undefined) {
+ otherCluster.containedEdges[transferEdge.id] = transferEdge;
+
+ // delete local reference
+ delete containedEdges[transferEdge.id];
+
+ // create new cluster edge from the otherCluster:
+ // get to and from
+ var fromId = transferEdge.fromId;
+ var toId = transferEdge.toId;
+ if (transferEdge.toId == otherNodeId) {
+ toId = this.clusteredNodes[otherNodeId].clusterId;
+ } else {
+ fromId = this.clusteredNodes[otherNodeId].clusterId;
+ }
+
+ // clone the options and apply the cluster options to them
+ var clonedOptions = _NetworkUtil2['default'].cloneOptions(transferEdge, 'edge');
+ util.deepExtend(clonedOptions, otherCluster.clusterEdgeProperties);
+
+ // apply the edge specific options to it.
+ var id = 'clusterEdge:' + util.randomUUID();
+ util.deepExtend(clonedOptions, { from: fromId, to: toId, hidden: false, physics: true, id: id });
+
+ // create it
+ var newEdge = this.body.functions.createEdge(clonedOptions);
+ newEdge.clusteringEdgeReplacingId = transferEdge.id;
+ this.body.edges[id] = newEdge;
+ this.body.edges[id].connect();
+ }
+ } else {
+ var replacedEdge = this.body.edges[edge.clusteringEdgeReplacingId];
+ if (replacedEdge !== undefined) {
+ this._restoreEdge(replacedEdge);
+ }
+ }
+ edge.cleanup();
+ // this removes the edge from node.edges, which is why edgeIds is formed
+ edge.disconnect();
+ delete this.body.edges[edge.id];
+ }
+
+ // handle the releasing of the edges
+ for (var edgeId in containedEdges) {
+ if (containedEdges.hasOwnProperty(edgeId)) {
+ this._restoreEdge(containedEdges[edgeId]);
+ }
+ }
+
+ // remove clusterNode
+ delete this.body.nodes[clusterNodeId];
+
+ if (refreshData === true) {
+ this.body.emitter.emit('_dataChanged');
+ }
+ }
+ }, {
+ key: 'getNodesInCluster',
+ value: function getNodesInCluster(clusterId) {
+ var nodesArray = [];
+ if (this.isCluster(clusterId) === true) {
+ var containedNodes = this.body.nodes[clusterId].containedNodes;
+ for (var nodeId in containedNodes) {
+ if (containedNodes.hasOwnProperty(nodeId)) {
+ nodesArray.push(this.body.nodes[nodeId].id);
+ }
+ }
+ }
+
+ return nodesArray;
+ }
+
+ /**
+ * Get the stack clusterId's that a certain node resides in. cluster A -> cluster B -> cluster C -> node
+ * @param nodeId
+ * @returns {Array}
+ */
+
+ }, {
+ key: 'findNode',
+ value: function findNode(nodeId) {
+ var stack = [];
+ var max = 100;
+ var counter = 0;
+
+ while (this.clusteredNodes[nodeId] !== undefined && counter < max) {
+ stack.push(this.body.nodes[nodeId].id);
+ nodeId = this.clusteredNodes[nodeId].clusterId;
+ counter++;
+ }
+ stack.push(this.body.nodes[nodeId].id);
+ stack.reverse();
+
+ return stack;
+ }
+
+ /**
+ * Using a clustered nodeId, update with the new options
+ * @param clusteredNodeId
+ * @param {object} newOptions
+ */
+
+ }, {
+ key: 'updateClusteredNode',
+ value: function updateClusteredNode(clusteredNodeId, newOptions) {
+ if (clusteredNodeId === undefined) {
+ throw new Error("No clusteredNodeId supplied to updateClusteredNode.");
+ }
+ if (newOptions === undefined) {
+ throw new Error("No newOptions supplied to updateClusteredNode.");
+ }
+ if (this.body.nodes[clusteredNodeId] === undefined) {
+ throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist.");
+ }
+
+ this.body.nodes[clusteredNodeId].setOptions(newOptions);
+ this.body.emitter.emit('_dataChanged');
+ }
+
+ /**
+ * Using a base edgeId, update all related clustered edges with the new options
+ * @param startEdgeId
+ * @param {object} newOptions
+ */
+
+ }, {
+ key: 'updateEdge',
+ value: function updateEdge(startEdgeId, newOptions) {
+ if (startEdgeId === undefined) {
+ throw new Error("No startEdgeId supplied to updateEdge.");
+ }
+ if (newOptions === undefined) {
+ throw new Error("No newOptions supplied to updateEdge.");
+ }
+ if (this.body.edges[startEdgeId] === undefined) {
+ throw new Error("The startEdgeId supplied to updateEdge does not exist.");
+ }
+
+ var allEdgeIds = this.getClusteredEdges(startEdgeId);
+ for (var i = 0; i < allEdgeIds.length; i++) {
+ var edge = this.body.edges[allEdgeIds[i]];
+ edge.setOptions(newOptions);
+ }
+ this.body.emitter.emit('_dataChanged');
+ }
+
+ /**
+ * Get a stack of clusterEdgeId's (+base edgeid) that a base edge is the same as. cluster edge C -> cluster edge B -> cluster edge A -> base edge(edgeId)
+ * @param edgeId
+ * @returns {Array}
+ */
+
+ }, {
+ key: 'getClusteredEdges',
+ value: function getClusteredEdges(edgeId) {
+ var stack = [];
+ var max = 100;
+ var counter = 0;
+
+ while (edgeId !== undefined && this.body.edges[edgeId] !== undefined && counter < max) {
+ stack.push(this.body.edges[edgeId].id);
+ edgeId = this.body.edges[edgeId].edgeReplacedById;
+ counter++;
+ }
+ stack.reverse();
+ return stack;
+ }
+
+ /**
+ * Get the base edge id of clusterEdgeId. cluster edge (clusteredEdgeId) -> cluster edge B -> cluster edge C -> base edge
+ * @param clusteredEdgeId
+ * @returns baseEdgeId
+ */
+
+ }, {
+ key: 'getBaseEdge',
+ value: function getBaseEdge(clusteredEdgeId) {
+ var baseEdgeId = clusteredEdgeId;
+ var max = 100;
+ var counter = 0;
+
+ while (clusteredEdgeId !== undefined && this.body.edges[clusteredEdgeId] !== undefined && counter < max) {
+ clusteredEdgeId = this.body.edges[clusteredEdgeId].clusteringEdgeReplacingId;
+ counter++;
+ if (clusteredEdgeId !== undefined) {
+ baseEdgeId = clusteredEdgeId;
+ }
+ }
+ return baseEdgeId;
+ }
+
+ /**
+ * Get the Id the node is connected to
+ * @param edge
+ * @param nodeId
+ * @returns {*}
+ * @private
+ */
+
+ }, {
+ key: '_getConnectedId',
+ value: function _getConnectedId(edge, nodeId) {
+ if (edge.toId != nodeId) {
+ return edge.toId;
+ } else if (edge.fromId != nodeId) {
+ return edge.fromId;
+ } else {
+ return edge.fromId;
+ }
+ }
+
+ /**
+ * We determine how many connections denote an important hub.
+ * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%)
+ *
+ * @private
+ */
+
+ }, {
+ key: '_getHubSize',
+ value: function _getHubSize() {
+ var average = 0;
+ var averageSquared = 0;
+ var hubCounter = 0;
+ var largestHub = 0;
+
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ var node = this.body.nodes[this.body.nodeIndices[i]];
+ if (node.edges.length > largestHub) {
+ largestHub = node.edges.length;
+ }
+ average += node.edges.length;
+ averageSquared += Math.pow(node.edges.length, 2);
+ hubCounter += 1;
+ }
+ average = average / hubCounter;
+ averageSquared = averageSquared / hubCounter;
+
+ var variance = averageSquared - Math.pow(average, 2);
+ var standardDeviation = Math.sqrt(variance);
+
+ var hubThreshold = Math.floor(average + 2 * standardDeviation);
+
+ // always have at least one to cluster
+ if (hubThreshold > largestHub) {
+ hubThreshold = largestHub;
+ }
+
+ return hubThreshold;
+ }
+ }]);
+ return ClusterEngine;
+ }();
+
+ exports['default'] = ClusterEngine;
+
+/***/ },
+/* 210 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var util = __webpack_require__(1);
+
+ var NetworkUtil = function () {
+ function NetworkUtil() {
+ (0, _classCallCheck3["default"])(this, NetworkUtil);
+ }
+
+ /**
+ * Find the center position of the network considering the bounding boxes
+ */
+
+
+ (0, _createClass3["default"])(NetworkUtil, null, [{
+ key: "getRange",
+ value: function getRange(allNodes) {
+ var specificNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
+
+ var minY = 1e9,
+ maxY = -1e9,
+ minX = 1e9,
+ maxX = -1e9,
+ node;
+ if (specificNodes.length > 0) {
+ for (var i = 0; i < specificNodes.length; i++) {
+ node = allNodes[specificNodes[i]];
+ if (minX > node.shape.boundingBox.left) {
+ minX = node.shape.boundingBox.left;
+ }
+ if (maxX < node.shape.boundingBox.right) {
+ maxX = node.shape.boundingBox.right;
+ }
+ if (minY > node.shape.boundingBox.top) {
+ minY = node.shape.boundingBox.top;
+ } // top is negative, bottom is positive
+ if (maxY < node.shape.boundingBox.bottom) {
+ maxY = node.shape.boundingBox.bottom;
+ } // top is negative, bottom is positive
+ }
+ }
+
+ if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) {
+ minY = 0, maxY = 0, minX = 0, maxX = 0;
+ }
+ return { minX: minX, maxX: maxX, minY: minY, maxY: maxY };
+ }
+
+ /**
+ * Find the center position of the network
+ */
+
+ }, {
+ key: "getRangeCore",
+ value: function getRangeCore(allNodes) {
+ var specificNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
+
+ var minY = 1e9,
+ maxY = -1e9,
+ minX = 1e9,
+ maxX = -1e9,
+ node;
+ if (specificNodes.length > 0) {
+ for (var i = 0; i < specificNodes.length; i++) {
+ node = allNodes[specificNodes[i]];
+ if (minX > node.x) {
+ minX = node.x;
+ }
+ if (maxX < node.x) {
+ maxX = node.x;
+ }
+ if (minY > node.y) {
+ minY = node.y;
+ } // top is negative, bottom is positive
+ if (maxY < node.y) {
+ maxY = node.y;
+ } // top is negative, bottom is positive
+ }
+ }
+
+ if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) {
+ minY = 0, maxY = 0, minX = 0, maxX = 0;
+ }
+ return { minX: minX, maxX: maxX, minY: minY, maxY: maxY };
+ }
+
+ /**
+ * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
+ * @returns {{x: number, y: number}}
+ */
+
+ }, {
+ key: "findCenter",
+ value: function findCenter(range) {
+ return { x: 0.5 * (range.maxX + range.minX),
+ y: 0.5 * (range.maxY + range.minY) };
+ }
+
+ /**
+ * This returns a clone of the options or options of the edge or node to be used for construction of new edges or check functions for new nodes.
+ * @param item
+ * @param type
+ * @returns {{}}
+ */
+
+ }, {
+ key: "cloneOptions",
+ value: function cloneOptions(item, type) {
+ var clonedOptions = {};
+ if (type === undefined || type === 'node') {
+ util.deepExtend(clonedOptions, item.options, true);
+ clonedOptions.x = item.x;
+ clonedOptions.y = item.y;
+ clonedOptions.amountOfConnections = item.edges.length;
+ } else {
+ util.deepExtend(clonedOptions, item.options, true);
+ }
+ return clonedOptions;
+ }
+ }]);
+ return NetworkUtil;
+ }();
+
+ exports["default"] = NetworkUtil;
+
+/***/ },
+/* 211 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _getPrototypeOf = __webpack_require__(166);
+
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _possibleConstructorReturn2 = __webpack_require__(169);
+
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
+
+ var _inherits2 = __webpack_require__(170);
+
+ var _inherits3 = _interopRequireDefault(_inherits2);
+
+ var _Node2 = __webpack_require__(159);
+
+ var _Node3 = _interopRequireDefault(_Node2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ /**
+ *
+ */
+ var Cluster = function (_Node) {
+ (0, _inherits3['default'])(Cluster, _Node);
+
+ function Cluster(options, body, imagelist, grouplist, globalOptions) {
+ (0, _classCallCheck3['default'])(this, Cluster);
+
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (Cluster.__proto__ || (0, _getPrototypeOf2['default'])(Cluster)).call(this, options, body, imagelist, grouplist, globalOptions));
+
+ _this.isCluster = true;
+ _this.containedNodes = {};
+ _this.containedEdges = {};
+ return _this;
+ }
+
+ return Cluster;
+ }(_Node3['default']);
+
+ exports['default'] = Cluster;
+
+/***/ },
+/* 212 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ if (typeof window !== 'undefined') {
+ window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
+ }
+
+ var util = __webpack_require__(1);
+
+ var CanvasRenderer = function () {
+ function CanvasRenderer(body, canvas) {
+ (0, _classCallCheck3['default'])(this, CanvasRenderer);
+
+ this.body = body;
+ this.canvas = canvas;
+
+ this.redrawRequested = false;
+ this.renderTimer = undefined;
+ this.requiresTimeout = true;
+ this.renderingActive = false;
+ this.renderRequests = 0;
+ this.pixelRatio = undefined;
+ this.allowRedraw = true;
+
+ this.dragging = false;
+ this.options = {};
+ this.defaultOptions = {
+ hideEdgesOnDrag: false,
+ hideNodesOnDrag: false
+ };
+ util.extend(this.options, this.defaultOptions);
+
+ this._determineBrowserMethod();
+ this.bindEventListeners();
+ }
+
+ (0, _createClass3['default'])(CanvasRenderer, [{
+ key: 'bindEventListeners',
+ value: function bindEventListeners() {
+ var _this = this;
+
+ this.body.emitter.on("dragStart", function () {
+ _this.dragging = true;
+ });
+ this.body.emitter.on("dragEnd", function () {
+ _this.dragging = false;
+ });
+ this.body.emitter.on("_resizeNodes", function () {
+ _this._resizeNodes();
+ });
+ this.body.emitter.on("_redraw", function () {
+ if (_this.renderingActive === false) {
+ _this._redraw();
+ }
+ });
+ this.body.emitter.on("_blockRedraw", function () {
+ _this.allowRedraw = false;
+ });
+ this.body.emitter.on("_allowRedraw", function () {
+ _this.allowRedraw = true;_this.redrawRequested = false;
+ });
+ this.body.emitter.on("_requestRedraw", this._requestRedraw.bind(this));
+ this.body.emitter.on("_startRendering", function () {
+ _this.renderRequests += 1;
+ _this.renderingActive = true;
+ _this._startRendering();
+ });
+ this.body.emitter.on("_stopRendering", function () {
+ _this.renderRequests -= 1;
+ _this.renderingActive = _this.renderRequests > 0;
+ _this.renderTimer = undefined;
+ });
+ this.body.emitter.on('destroy', function () {
+ _this.renderRequests = 0;
+ _this.allowRedraw = false;
+ _this.renderingActive = false;
+ if (_this.requiresTimeout === true) {
+ clearTimeout(_this.renderTimer);
+ } else {
+ cancelAnimationFrame(_this.renderTimer);
+ }
+ _this.body.emitter.off();
+ });
+ }
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ if (options !== undefined) {
+ var fields = ['hideEdgesOnDrag', 'hideNodesOnDrag'];
+ util.selectiveDeepExtend(fields, this.options, options);
+ }
+ }
+ }, {
+ key: '_startRendering',
+ value: function _startRendering() {
+ if (this.renderingActive === true) {
+ if (this.renderTimer === undefined) {
+ if (this.requiresTimeout === true) {
+ this.renderTimer = window.setTimeout(this._renderStep.bind(this), this.simulationInterval); // wait this.renderTimeStep milliseconds and perform the animation step function
+ } else {
+ this.renderTimer = window.requestAnimationFrame(this._renderStep.bind(this)); // wait this.renderTimeStep milliseconds and perform the animation step function
+ }
+ }
+ }
+ }
+ }, {
+ key: '_renderStep',
+ value: function _renderStep() {
+ if (this.renderingActive === true) {
+ // reset the renderTimer so a new scheduled animation step can be set
+ this.renderTimer = undefined;
+
+ if (this.requiresTimeout === true) {
+ // this schedules a new simulation step
+ this._startRendering();
+ }
+
+ this._redraw();
+
+ if (this.requiresTimeout === false) {
+ // this schedules a new simulation step
+ this._startRendering();
+ }
+ }
+ }
+
+ /**
+ * Redraw the network with the current data
+ * chart will be resized too.
+ */
+
+ }, {
+ key: 'redraw',
+ value: function redraw() {
+ this.body.emitter.emit('setSize');
+ this._redraw();
+ }
+
+ /**
+ * Redraw the network with the current data
+ * @param hidden | used to get the first estimate of the node sizes. only the nodes are drawn after which they are quickly drawn over.
+ * @private
+ */
+
+ }, {
+ key: '_requestRedraw',
+ value: function _requestRedraw() {
+ var _this2 = this;
+
+ if (this.redrawRequested !== true && this.renderingActive === false && this.allowRedraw === true) {
+ this.redrawRequested = true;
+ if (this.requiresTimeout === true) {
+ window.setTimeout(function () {
+ _this2._redraw(false);
+ }, 0);
+ } else {
+ window.requestAnimationFrame(function () {
+ _this2._redraw(false);
+ });
+ }
+ }
+ }
+ }, {
+ key: '_redraw',
+ value: function _redraw() {
+ var hidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ if (this.allowRedraw === true) {
+ this.body.emitter.emit("initRedraw");
+
+ this.redrawRequested = false;
+ var ctx = this.canvas.frame.canvas.getContext('2d');
+
+ // when the container div was hidden, this fixes it back up!
+ if (this.canvas.frame.canvas.width === 0 || this.canvas.frame.canvas.height === 0) {
+ this.canvas.setSize();
+ }
+
+ this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
+
+ ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
+
+ // clear the canvas
+ var w = this.canvas.frame.canvas.clientWidth;
+ var h = this.canvas.frame.canvas.clientHeight;
+ ctx.clearRect(0, 0, w, h);
+
+ // if the div is hidden, we stop the redraw here for performance.
+ if (this.canvas.frame.clientWidth === 0) {
+ return;
+ }
+
+ // set scaling and translation
+ ctx.save();
+ ctx.translate(this.body.view.translation.x, this.body.view.translation.y);
+ ctx.scale(this.body.view.scale, this.body.view.scale);
+
+ ctx.beginPath();
+ this.body.emitter.emit("beforeDrawing", ctx);
+ ctx.closePath();
+
+ if (hidden === false) {
+ if (this.dragging === false || this.dragging === true && this.options.hideEdgesOnDrag === false) {
+ this._drawEdges(ctx);
+ }
+ }
+
+ if (this.dragging === false || this.dragging === true && this.options.hideNodesOnDrag === false) {
+ this._drawNodes(ctx, hidden);
+ }
+
+ ctx.beginPath();
+ this.body.emitter.emit("afterDrawing", ctx);
+ ctx.closePath();
+
+ // restore original scaling and translation
+ ctx.restore();
+ if (hidden === true) {
+ ctx.clearRect(0, 0, w, h);
+ }
+ }
+ }
+
+ /**
+ * Redraw all nodes
+ * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d');
+ * @param {CanvasRenderingContext2D} ctx
+ * @param {Boolean} [alwaysShow]
+ * @private
+ */
+
+ }, {
+ key: '_resizeNodes',
+ value: function _resizeNodes() {
+ var ctx = this.canvas.frame.canvas.getContext('2d');
+ if (this.pixelRatio === undefined) {
+ this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
+ }
+ ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
+ ctx.save();
+ ctx.translate(this.body.view.translation.x, this.body.view.translation.y);
+ ctx.scale(this.body.view.scale, this.body.view.scale);
+
+ var nodes = this.body.nodes;
+ var node = void 0;
+
+ // resize all nodes
+ for (var nodeId in nodes) {
+ if (nodes.hasOwnProperty(nodeId)) {
+ node = nodes[nodeId];
+ node.resize(ctx);
+ node.updateBoundingBox(ctx, node.selected);
+ }
+ }
+
+ // restore original scaling and translation
+ ctx.restore();
+ }
+
+ /**
+ * Redraw all nodes
+ * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d');
+ * @param {CanvasRenderingContext2D} ctx
+ * @param {Boolean} [alwaysShow]
+ * @private
+ */
+
+ }, {
+ key: '_drawNodes',
+ value: function _drawNodes(ctx) {
+ var alwaysShow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ var nodes = this.body.nodes;
+ var nodeIndices = this.body.nodeIndices;
+ var node = void 0;
+ var selected = [];
+ var margin = 20;
+ var topLeft = this.canvas.DOMtoCanvas({ x: -margin, y: -margin });
+ var bottomRight = this.canvas.DOMtoCanvas({
+ x: this.canvas.frame.canvas.clientWidth + margin,
+ y: this.canvas.frame.canvas.clientHeight + margin
+ });
+ var viewableArea = { top: topLeft.y, left: topLeft.x, bottom: bottomRight.y, right: bottomRight.x };
+
+ // draw unselected nodes;
+ for (var i = 0; i < nodeIndices.length; i++) {
+ node = nodes[nodeIndices[i]];
+ // set selected nodes aside
+ if (node.isSelected()) {
+ selected.push(nodeIndices[i]);
+ } else {
+ if (alwaysShow === true) {
+ node.draw(ctx);
+ } else if (node.isBoundingBoxOverlappingWith(viewableArea) === true) {
+ node.draw(ctx);
+ } else {
+ node.updateBoundingBox(ctx, node.selected);
+ }
+ }
+ }
+
+ // draw the selected nodes on top
+ for (var _i = 0; _i < selected.length; _i++) {
+ node = nodes[selected[_i]];
+ node.draw(ctx);
+ }
+ }
+
+ /**
+ * Redraw all edges
+ * The 2d context of a HTML canvas can be retrieved by canvas.getContext('2d');
+ * @param {CanvasRenderingContext2D} ctx
+ * @private
+ */
+
+ }, {
+ key: '_drawEdges',
+ value: function _drawEdges(ctx) {
+ var edges = this.body.edges;
+ var edgeIndices = this.body.edgeIndices;
+ var edge = void 0;
+
+ for (var i = 0; i < edgeIndices.length; i++) {
+ edge = edges[edgeIndices[i]];
+ if (edge.connected === true) {
+ edge.draw(ctx);
+ }
+ }
+ }
+
+ /**
+ * Determine if the browser requires a setTimeout or a requestAnimationFrame. This was required because
+ * some implementations (safari and IE9) did not support requestAnimationFrame
+ * @private
+ */
+
+ }, {
+ key: '_determineBrowserMethod',
+ value: function _determineBrowserMethod() {
+ if (typeof window !== 'undefined') {
+ var browserType = navigator.userAgent.toLowerCase();
+ this.requiresTimeout = false;
+ if (browserType.indexOf('msie 9.0') != -1) {
+ // IE 9
+ this.requiresTimeout = true;
+ } else if (browserType.indexOf('safari') != -1) {
+ // safari
+ if (browserType.indexOf('chrome') <= -1) {
+ this.requiresTimeout = true;
+ }
+ }
+ } else {
+ this.requiresTimeout = true;
+ }
+ }
+ }]);
+ return CanvasRenderer;
+ }();
+
+ exports['default'] = CanvasRenderer;
+
+/***/ },
+/* 213 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var Hammer = __webpack_require__(108);
+ var hammerUtil = __webpack_require__(121);
+
+ var util = __webpack_require__(1);
+
+ /**
+ * Create the main frame for the Network.
+ * This function is executed once when a Network object is created. The frame
+ * contains a canvas, and this canvas contains all objects like the axis and
+ * nodes.
+ * @private
+ */
+
+ var Canvas = function () {
+ function Canvas(body) {
+ (0, _classCallCheck3['default'])(this, Canvas);
+
+ this.body = body;
+ this.pixelRatio = 1;
+ this.resizeTimer = undefined;
+ this.resizeFunction = this._onResize.bind(this);
+ this.cameraState = {};
+ this.initialized = false;
+ this.canvasViewCenter = {};
+
+ this.options = {};
+ this.defaultOptions = {
+ autoResize: true,
+ height: '100%',
+ width: '100%'
+ };
+ util.extend(this.options, this.defaultOptions);
+
+ this.bindEventListeners();
+ }
+
+ (0, _createClass3['default'])(Canvas, [{
+ key: 'bindEventListeners',
+ value: function bindEventListeners() {
+ var _this = this;
+
+ // bind the events
+ this.body.emitter.once("resize", function (obj) {
+ if (obj.width !== 0) {
+ _this.body.view.translation.x = obj.width * 0.5;
+ }
+ if (obj.height !== 0) {
+ _this.body.view.translation.y = obj.height * 0.5;
+ }
+ });
+ this.body.emitter.on("setSize", this.setSize.bind(this));
+ this.body.emitter.on("destroy", function () {
+ _this.hammerFrame.destroy();
+ _this.hammer.destroy();
+ _this._cleanUp();
+ });
+ }
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ var _this2 = this;
+
+ if (options !== undefined) {
+ var fields = ['width', 'height', 'autoResize'];
+ util.selectiveDeepExtend(fields, this.options, options);
+ }
+
+ if (this.options.autoResize === true) {
+ // automatically adapt to a changing size of the browser.
+ this._cleanUp();
+ this.resizeTimer = setInterval(function () {
+ var changed = _this2.setSize();
+ if (changed === true) {
+ _this2.body.emitter.emit("_requestRedraw");
+ }
+ }, 1000);
+ this.resizeFunction = this._onResize.bind(this);
+ util.addEventListener(window, 'resize', this.resizeFunction);
+ }
+ }
+ }, {
+ key: '_cleanUp',
+ value: function _cleanUp() {
+ // automatically adapt to a changing size of the browser.
+ if (this.resizeTimer !== undefined) {
+ clearInterval(this.resizeTimer);
+ }
+ util.removeEventListener(window, 'resize', this.resizeFunction);
+ this.resizeFunction = undefined;
+ }
+ }, {
+ key: '_onResize',
+ value: function _onResize() {
+ this.setSize();
+ this.body.emitter.emit("_redraw");
+ }
+
+ /**
+ * Get and store the cameraState
+ * @private
+ */
+
+ }, {
+ key: '_getCameraState',
+ value: function _getCameraState() {
+ var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pixelRatio;
+
+ if (this.initialized === true) {
+ this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio;
+ this.cameraState.previousHeight = this.frame.canvas.height / pixelRatio;
+ this.cameraState.scale = this.body.view.scale;
+ this.cameraState.position = this.DOMtoCanvas({
+ x: 0.5 * this.frame.canvas.width / pixelRatio,
+ y: 0.5 * this.frame.canvas.height / pixelRatio
+ });
+ }
+ }
+
+ /**
+ * Set the cameraState
+ * @private
+ */
+
+ }, {
+ key: '_setCameraState',
+ value: function _setCameraState() {
+ if (this.cameraState.scale !== undefined && this.frame.canvas.clientWidth !== 0 && this.frame.canvas.clientHeight !== 0 && this.pixelRatio !== 0 && this.cameraState.previousWidth > 0) {
+
+ var widthRatio = this.frame.canvas.width / this.pixelRatio / this.cameraState.previousWidth;
+ var heightRatio = this.frame.canvas.height / this.pixelRatio / this.cameraState.previousHeight;
+ var newScale = this.cameraState.scale;
+
+ if (widthRatio != 1 && heightRatio != 1) {
+ newScale = this.cameraState.scale * 0.5 * (widthRatio + heightRatio);
+ } else if (widthRatio != 1) {
+ newScale = this.cameraState.scale * widthRatio;
+ } else if (heightRatio != 1) {
+ newScale = this.cameraState.scale * heightRatio;
+ }
+
+ this.body.view.scale = newScale;
+ // this comes from the view module.
+ var currentViewCenter = this.DOMtoCanvas({
+ x: 0.5 * this.frame.canvas.clientWidth,
+ y: 0.5 * this.frame.canvas.clientHeight
+ });
+
+ var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node
+ x: currentViewCenter.x - this.cameraState.position.x,
+ y: currentViewCenter.y - this.cameraState.position.y
+ };
+ this.body.view.translation.x += distanceFromCenter.x * this.body.view.scale;
+ this.body.view.translation.y += distanceFromCenter.y * this.body.view.scale;
+ }
+ }
+ }, {
+ key: '_prepareValue',
+ value: function _prepareValue(value) {
+ if (typeof value === 'number') {
+ return value + 'px';
+ } else if (typeof value === 'string') {
+ if (value.indexOf('%') !== -1 || value.indexOf('px') !== -1) {
+ return value;
+ } else if (value.indexOf('%') === -1) {
+ return value + 'px';
+ }
+ }
+ throw new Error('Could not use the value supplied for width or height:' + value);
+ }
+
+ /**
+ * Create the HTML
+ */
+
+ }, {
+ key: '_create',
+ value: function _create() {
+ // remove all elements from the container element.
+ while (this.body.container.hasChildNodes()) {
+ this.body.container.removeChild(this.body.container.firstChild);
+ }
+
+ this.frame = document.createElement('div');
+ this.frame.className = 'vis-network';
+ this.frame.style.position = 'relative';
+ this.frame.style.overflow = 'hidden';
+ this.frame.tabIndex = 900; // tab index is required for keycharm to bind keystrokes to the div instead of the window
+
+ //////////////////////////////////////////////////////////////////
+
+ this.frame.canvas = document.createElement("canvas");
+ this.frame.canvas.style.position = 'relative';
+ this.frame.appendChild(this.frame.canvas);
+
+ if (!this.frame.canvas.getContext) {
+ var noCanvas = document.createElement('DIV');
+ noCanvas.style.color = 'red';
+ noCanvas.style.fontWeight = 'bold';
+ noCanvas.style.padding = '10px';
+ noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
+ this.frame.canvas.appendChild(noCanvas);
+ } else {
+ var ctx = this.frame.canvas.getContext("2d");
+ this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
+
+ this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
+ }
+
+ // add the frame to the container element
+ this.body.container.appendChild(this.frame);
+
+ this.body.view.scale = 1;
+ this.body.view.translation = { x: 0.5 * this.frame.canvas.clientWidth, y: 0.5 * this.frame.canvas.clientHeight };
+
+ this._bindHammer();
+ }
+
+ /**
+ * This function binds hammer, it can be repeated over and over due to the uniqueness check.
+ * @private
+ */
+
+ }, {
+ key: '_bindHammer',
+ value: function _bindHammer() {
+ var _this3 = this;
+
+ if (this.hammer !== undefined) {
+ this.hammer.destroy();
+ }
+ this.drag = {};
+ this.pinch = {};
+
+ // init hammer
+ this.hammer = new Hammer(this.frame.canvas);
+ this.hammer.get('pinch').set({ enable: true });
+ // enable to get better response, todo: test on mobile.
+ this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_ALL });
+
+ hammerUtil.onTouch(this.hammer, function (event) {
+ _this3.body.eventListeners.onTouch(event);
+ });
+ this.hammer.on('tap', function (event) {
+ _this3.body.eventListeners.onTap(event);
+ });
+ this.hammer.on('doubletap', function (event) {
+ _this3.body.eventListeners.onDoubleTap(event);
+ });
+ this.hammer.on('press', function (event) {
+ _this3.body.eventListeners.onHold(event);
+ });
+ this.hammer.on('panstart', function (event) {
+ _this3.body.eventListeners.onDragStart(event);
+ });
+ this.hammer.on('panmove', function (event) {
+ _this3.body.eventListeners.onDrag(event);
+ });
+ this.hammer.on('panend', function (event) {
+ _this3.body.eventListeners.onDragEnd(event);
+ });
+ this.hammer.on('pinch', function (event) {
+ _this3.body.eventListeners.onPinch(event);
+ });
+
+ // TODO: neatly cleanup these handlers when re-creating the Canvas, IF these are done with hammer, event.stopPropagation will not work?
+ this.frame.canvas.addEventListener('mousewheel', function (event) {
+ _this3.body.eventListeners.onMouseWheel(event);
+ });
+ this.frame.canvas.addEventListener('DOMMouseScroll', function (event) {
+ _this3.body.eventListeners.onMouseWheel(event);
+ });
+
+ this.frame.canvas.addEventListener('mousemove', function (event) {
+ _this3.body.eventListeners.onMouseMove(event);
+ });
+ this.frame.canvas.addEventListener('contextmenu', function (event) {
+ _this3.body.eventListeners.onContext(event);
+ });
+
+ this.hammerFrame = new Hammer(this.frame);
+ hammerUtil.onRelease(this.hammerFrame, function (event) {
+ _this3.body.eventListeners.onRelease(event);
+ });
+ }
+
+ /**
+ * Set a new size for the network
+ * @param {string} width Width in pixels or percentage (for example '800px'
+ * or '50%')
+ * @param {string} height Height in pixels or percentage (for example '400px'
+ * or '30%')
+ */
+
+ }, {
+ key: 'setSize',
+ value: function setSize() {
+ var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.width;
+ var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.height;
+
+ width = this._prepareValue(width);
+ height = this._prepareValue(height);
+
+ var emitEvent = false;
+ var oldWidth = this.frame.canvas.width;
+ var oldHeight = this.frame.canvas.height;
+
+ // update the pixel ratio
+ var ctx = this.frame.canvas.getContext("2d");
+ var previousRatio = this.pixelRatio; // we cache this because the camera state storage needs the old value
+ this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1);
+
+ if (width != this.options.width || height != this.options.height || this.frame.style.width != width || this.frame.style.height != height) {
+ this._getCameraState(previousRatio);
+
+ this.frame.style.width = width;
+ this.frame.style.height = height;
+
+ this.frame.canvas.style.width = '100%';
+ this.frame.canvas.style.height = '100%';
+
+ this.frame.canvas.width = Math.round(this.frame.canvas.clientWidth * this.pixelRatio);
+ this.frame.canvas.height = Math.round(this.frame.canvas.clientHeight * this.pixelRatio);
+
+ this.options.width = width;
+ this.options.height = height;
+
+ this.canvasViewCenter = {
+ x: 0.5 * this.frame.clientWidth,
+ y: 0.5 * this.frame.clientHeight
+ };
+
+ emitEvent = true;
+ } else {
+ // this would adapt the width of the canvas to the width from 100% if and only if
+ // there is a change.
+
+ // store the camera if there is a change in size.
+ if (this.frame.canvas.width != Math.round(this.frame.canvas.clientWidth * this.pixelRatio) || this.frame.canvas.height != Math.round(this.frame.canvas.clientHeight * this.pixelRatio)) {
+ this._getCameraState(previousRatio);
+ }
+
+ if (this.frame.canvas.width != Math.round(this.frame.canvas.clientWidth * this.pixelRatio)) {
+ this.frame.canvas.width = Math.round(this.frame.canvas.clientWidth * this.pixelRatio);
+ emitEvent = true;
+ }
+ if (this.frame.canvas.height != Math.round(this.frame.canvas.clientHeight * this.pixelRatio)) {
+ this.frame.canvas.height = Math.round(this.frame.canvas.clientHeight * this.pixelRatio);
+ emitEvent = true;
+ }
+ }
+
+ if (emitEvent === true) {
+ this.body.emitter.emit('resize', {
+ width: Math.round(this.frame.canvas.width / this.pixelRatio),
+ height: Math.round(this.frame.canvas.height / this.pixelRatio),
+ oldWidth: Math.round(oldWidth / this.pixelRatio),
+ oldHeight: Math.round(oldHeight / this.pixelRatio)
+ });
+
+ // restore the camera on change.
+ this._setCameraState();
+ }
+
+ // set initialized so the get and set camera will work from now on.
+ this.initialized = true;
+ return emitEvent;
+ }
+ }, {
+ key: '_XconvertDOMtoCanvas',
+
+
+ /**
+ * Convert the X coordinate in DOM-space (coordinate point in browser relative to the container div) to
+ * the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon)
+ * @param {number} x
+ * @returns {number}
+ * @private
+ */
+ value: function _XconvertDOMtoCanvas(x) {
+ return (x - this.body.view.translation.x) / this.body.view.scale;
+ }
+
+ /**
+ * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to
+ * the X coordinate in DOM-space (coordinate point in browser relative to the container div)
+ * @param {number} x
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_XconvertCanvasToDOM',
+ value: function _XconvertCanvasToDOM(x) {
+ return x * this.body.view.scale + this.body.view.translation.x;
+ }
+
+ /**
+ * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to
+ * the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon)
+ * @param {number} y
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_YconvertDOMtoCanvas',
+ value: function _YconvertDOMtoCanvas(y) {
+ return (y - this.body.view.translation.y) / this.body.view.scale;
+ }
+
+ /**
+ * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to
+ * the Y coordinate in DOM-space (coordinate point in browser relative to the container div)
+ * @param {number} y
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_YconvertCanvasToDOM',
+ value: function _YconvertCanvasToDOM(y) {
+ return y * this.body.view.scale + this.body.view.translation.y;
+ }
+
+ /**
+ *
+ * @param {object} pos = {x: number, y: number}
+ * @returns {{x: number, y: number}}
+ * @constructor
+ */
+
+ }, {
+ key: 'canvasToDOM',
+ value: function canvasToDOM(pos) {
+ return { x: this._XconvertCanvasToDOM(pos.x), y: this._YconvertCanvasToDOM(pos.y) };
+ }
+
+ /**
+ *
+ * @param {object} pos = {x: number, y: number}
+ * @returns {{x: number, y: number}}
+ * @constructor
+ */
+
+ }, {
+ key: 'DOMtoCanvas',
+ value: function DOMtoCanvas(pos) {
+ return { x: this._XconvertDOMtoCanvas(pos.x), y: this._YconvertDOMtoCanvas(pos.y) };
+ }
+ }]);
+ return Canvas;
+ }();
+
+ exports['default'] = Canvas;
+
+/***/ },
+/* 214 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _NetworkUtil = __webpack_require__(210);
+
+ var _NetworkUtil2 = _interopRequireDefault(_NetworkUtil);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var View = function () {
+ function View(body, canvas) {
+ var _this = this;
+
+ (0, _classCallCheck3['default'])(this, View);
+
+ this.body = body;
+ this.canvas = canvas;
+
+ this.animationSpeed = 1 / this.renderRefreshRate;
+ this.animationEasingFunction = "easeInOutQuint";
+ this.easingTime = 0;
+ this.sourceScale = 0;
+ this.targetScale = 0;
+ this.sourceTranslation = 0;
+ this.targetTranslation = 0;
+ this.lockedOnNodeId = undefined;
+ this.lockedOnNodeOffset = undefined;
+ this.touchTime = 0;
+
+ this.viewFunction = undefined;
+
+ this.body.emitter.on("fit", this.fit.bind(this));
+ this.body.emitter.on("animationFinished", function () {
+ _this.body.emitter.emit("_stopRendering");
+ });
+ this.body.emitter.on("unlockNode", this.releaseNode.bind(this));
+ }
+
+ (0, _createClass3['default'])(View, [{
+ key: 'setOptions',
+ value: function setOptions() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ this.options = options;
+ }
+
+ /**
+ * This function zooms out to fit all data on screen based on amount of nodes
+ * @param {Object} Options
+ * @param {Boolean} [initialZoom] | zoom based on fitted formula or range, true = fitted, default = false;
+ */
+
+ }, {
+ key: 'fit',
+ value: function fit() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { nodes: [] };
+ var initialZoom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ var range = void 0;
+ var zoomLevel = void 0;
+ if (options.nodes === undefined || options.nodes.length === 0) {
+ options.nodes = this.body.nodeIndices;
+ }
+
+ if (initialZoom === true) {
+ // check if more than half of the nodes have a predefined position. If so, we use the range, not the approximation.
+ var positionDefined = 0;
+ for (var nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(nodeId)) {
+ var node = this.body.nodes[nodeId];
+ if (node.predefinedPosition === true) {
+ positionDefined += 1;
+ }
+ }
+ }
+ if (positionDefined > 0.5 * this.body.nodeIndices.length) {
+ this.fit(options, false);
+ return;
+ }
+
+ range = _NetworkUtil2['default'].getRange(this.body.nodes, options.nodes);
+
+ var numberOfNodes = this.body.nodeIndices.length;
+ zoomLevel = 12.662 / (numberOfNodes + 7.4147) + 0.0964822; // this is obtained from fitting a dataset from 5 points with scale levels that looked good.
+
+ // correct for larger canvasses.
+ var factor = Math.min(this.canvas.frame.canvas.clientWidth / 600, this.canvas.frame.canvas.clientHeight / 600);
+ zoomLevel *= factor;
+ } else {
+ this.body.emitter.emit("_resizeNodes");
+ range = _NetworkUtil2['default'].getRange(this.body.nodes, options.nodes);
+
+ var xDistance = Math.abs(range.maxX - range.minX) * 1.1;
+ var yDistance = Math.abs(range.maxY - range.minY) * 1.1;
+
+ var xZoomLevel = this.canvas.frame.canvas.clientWidth / xDistance;
+ var yZoomLevel = this.canvas.frame.canvas.clientHeight / yDistance;
+
+ zoomLevel = xZoomLevel <= yZoomLevel ? xZoomLevel : yZoomLevel;
+ }
+
+ if (zoomLevel > 1.0) {
+ zoomLevel = 1.0;
+ } else if (zoomLevel === 0) {
+ zoomLevel = 1.0;
+ }
+
+ var center = _NetworkUtil2['default'].findCenter(range);
+ var animationOptions = { position: center, scale: zoomLevel, animation: options.animation };
+ this.moveTo(animationOptions);
+ }
+
+ // animation
+
+ /**
+ * Center a node in view.
+ *
+ * @param {Number} nodeId
+ * @param {Number} [options]
+ */
+
+ }, {
+ key: 'focus',
+ value: function focus(nodeId) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+
+ if (this.body.nodes[nodeId] !== undefined) {
+ var nodePosition = { x: this.body.nodes[nodeId].x, y: this.body.nodes[nodeId].y };
+ options.position = nodePosition;
+ options.lockedOnNode = nodeId;
+
+ this.moveTo(options);
+ } else {
+ console.log("Node: " + nodeId + " cannot be found.");
+ }
+ }
+
+ /**
+ *
+ * @param {Object} options | options.offset = {x:Number, y:Number} // offset from the center in DOM pixels
+ * | options.scale = Number // scale to move to
+ * | options.position = {x:Number, y:Number} // position to move to
+ * | options.animation = {duration:Number, easingFunction:String} || Boolean // position to move to
+ */
+
+ }, {
+ key: 'moveTo',
+ value: function moveTo(options) {
+ if (options === undefined) {
+ options = {};
+ return;
+ }
+ if (options.offset === undefined) {
+ options.offset = { x: 0, y: 0 };
+ }
+ if (options.offset.x === undefined) {
+ options.offset.x = 0;
+ }
+ if (options.offset.y === undefined) {
+ options.offset.y = 0;
+ }
+ if (options.scale === undefined) {
+ options.scale = this.body.view.scale;
+ }
+ if (options.position === undefined) {
+ options.position = this.getViewPosition();
+ }
+ if (options.animation === undefined) {
+ options.animation = { duration: 0 };
+ }
+ if (options.animation === false) {
+ options.animation = { duration: 0 };
+ }
+ if (options.animation === true) {
+ options.animation = {};
+ }
+ if (options.animation.duration === undefined) {
+ options.animation.duration = 1000;
+ } // default duration
+ if (options.animation.easingFunction === undefined) {
+ options.animation.easingFunction = "easeInOutQuad";
+ } // default easing function
+
+ this.animateView(options);
+ }
+
+ /**
+ *
+ * @param {Object} options | options.offset = {x:Number, y:Number} // offset from the center in DOM pixels
+ * | options.time = Number // animation time in milliseconds
+ * | options.scale = Number // scale to animate to
+ * | options.position = {x:Number, y:Number} // position to animate to
+ * | options.easingFunction = String // linear, easeInQuad, easeOutQuad, easeInOutQuad,
+ * // easeInCubic, easeOutCubic, easeInOutCubic,
+ * // easeInQuart, easeOutQuart, easeInOutQuart,
+ * // easeInQuint, easeOutQuint, easeInOutQuint
+ */
+
+ }, {
+ key: 'animateView',
+ value: function animateView(options) {
+ if (options === undefined) {
+ return;
+ }
+ this.animationEasingFunction = options.animation.easingFunction;
+ // release if something focussed on the node
+ this.releaseNode();
+ if (options.locked === true) {
+ this.lockedOnNodeId = options.lockedOnNode;
+ this.lockedOnNodeOffset = options.offset;
+ }
+
+ // forcefully complete the old animation if it was still running
+ if (this.easingTime != 0) {
+ this._transitionRedraw(true); // by setting easingtime to 1, we finish the animation.
+ }
+
+ this.sourceScale = this.body.view.scale;
+ this.sourceTranslation = this.body.view.translation;
+ this.targetScale = options.scale;
+
+ // set the scale so the viewCenter is based on the correct zoom level. This is overridden in the transitionRedraw
+ // but at least then we'll have the target transition
+ this.body.view.scale = this.targetScale;
+ var viewCenter = this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight });
+
+ var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node
+ x: viewCenter.x - options.position.x,
+ y: viewCenter.y - options.position.y
+ };
+ this.targetTranslation = {
+ x: this.sourceTranslation.x + distanceFromCenter.x * this.targetScale + options.offset.x,
+ y: this.sourceTranslation.y + distanceFromCenter.y * this.targetScale + options.offset.y
+ };
+
+ // if the time is set to 0, don't do an animation
+ if (options.animation.duration === 0) {
+ if (this.lockedOnNodeId != undefined) {
+ this.viewFunction = this._lockedRedraw.bind(this);
+ this.body.emitter.on("initRedraw", this.viewFunction);
+ } else {
+ this.body.view.scale = this.targetScale;
+ this.body.view.translation = this.targetTranslation;
+ this.body.emitter.emit("_requestRedraw");
+ }
+ } else {
+ this.animationSpeed = 1 / (60 * options.animation.duration * 0.001) || 1 / 60; // 60 for 60 seconds, 0.001 for milli's
+ this.animationEasingFunction = options.animation.easingFunction;
+
+ this.viewFunction = this._transitionRedraw.bind(this);
+ this.body.emitter.on("initRedraw", this.viewFunction);
+ this.body.emitter.emit("_startRendering");
+ }
+ }
+
+ /**
+ * used to animate smoothly by hijacking the redraw function.
+ * @private
+ */
+
+ }, {
+ key: '_lockedRedraw',
+ value: function _lockedRedraw() {
+ var nodePosition = { x: this.body.nodes[this.lockedOnNodeId].x, y: this.body.nodes[this.lockedOnNodeId].y };
+ var viewCenter = this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight });
+ var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node
+ x: viewCenter.x - nodePosition.x,
+ y: viewCenter.y - nodePosition.y
+ };
+ var sourceTranslation = this.body.view.translation;
+ var targetTranslation = {
+ x: sourceTranslation.x + distanceFromCenter.x * this.body.view.scale + this.lockedOnNodeOffset.x,
+ y: sourceTranslation.y + distanceFromCenter.y * this.body.view.scale + this.lockedOnNodeOffset.y
+ };
+
+ this.body.view.translation = targetTranslation;
+ }
+ }, {
+ key: 'releaseNode',
+ value: function releaseNode() {
+ if (this.lockedOnNodeId !== undefined && this.viewFunction !== undefined) {
+ this.body.emitter.off("initRedraw", this.viewFunction);
+ this.lockedOnNodeId = undefined;
+ this.lockedOnNodeOffset = undefined;
+ }
+ }
+
+ /**
+ *
+ * @param easingTime
+ * @private
+ */
+
+ }, {
+ key: '_transitionRedraw',
+ value: function _transitionRedraw() {
+ var finished = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+
+ this.easingTime += this.animationSpeed;
+ this.easingTime = finished === true ? 1.0 : this.easingTime;
+
+ var progress = util.easingFunctions[this.animationEasingFunction](this.easingTime);
+
+ this.body.view.scale = this.sourceScale + (this.targetScale - this.sourceScale) * progress;
+ this.body.view.translation = {
+ x: this.sourceTranslation.x + (this.targetTranslation.x - this.sourceTranslation.x) * progress,
+ y: this.sourceTranslation.y + (this.targetTranslation.y - this.sourceTranslation.y) * progress
+ };
+
+ // cleanup
+ if (this.easingTime >= 1.0) {
+ this.body.emitter.off("initRedraw", this.viewFunction);
+ this.easingTime = 0;
+ if (this.lockedOnNodeId != undefined) {
+ this.viewFunction = this._lockedRedraw.bind(this);
+ this.body.emitter.on("initRedraw", this.viewFunction);
+ }
+ this.body.emitter.emit("animationFinished");
+ }
+ }
+ }, {
+ key: 'getScale',
+ value: function getScale() {
+ return this.body.view.scale;
+ }
+ }, {
+ key: 'getViewPosition',
+ value: function getViewPosition() {
+ return this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight });
+ }
+ }]);
+ return View;
+ }();
+
+ exports['default'] = View;
+
+/***/ },
+/* 215 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _NavigationHandler = __webpack_require__(216);
+
+ var _NavigationHandler2 = _interopRequireDefault(_NavigationHandler);
+
+ var _Popup = __webpack_require__(128);
+
+ var _Popup2 = _interopRequireDefault(_Popup);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var InteractionHandler = function () {
+ function InteractionHandler(body, canvas, selectionHandler) {
+ (0, _classCallCheck3['default'])(this, InteractionHandler);
+
+ this.body = body;
+ this.canvas = canvas;
+ this.selectionHandler = selectionHandler;
+ this.navigationHandler = new _NavigationHandler2['default'](body, canvas);
+
+ // bind the events from hammer to functions in this object
+ this.body.eventListeners.onTap = this.onTap.bind(this);
+ this.body.eventListeners.onTouch = this.onTouch.bind(this);
+ this.body.eventListeners.onDoubleTap = this.onDoubleTap.bind(this);
+ this.body.eventListeners.onHold = this.onHold.bind(this);
+ this.body.eventListeners.onDragStart = this.onDragStart.bind(this);
+ this.body.eventListeners.onDrag = this.onDrag.bind(this);
+ this.body.eventListeners.onDragEnd = this.onDragEnd.bind(this);
+ this.body.eventListeners.onMouseWheel = this.onMouseWheel.bind(this);
+ this.body.eventListeners.onPinch = this.onPinch.bind(this);
+ this.body.eventListeners.onMouseMove = this.onMouseMove.bind(this);
+ this.body.eventListeners.onRelease = this.onRelease.bind(this);
+ this.body.eventListeners.onContext = this.onContext.bind(this);
+
+ this.touchTime = 0;
+ this.drag = {};
+ this.pinch = {};
+ this.popup = undefined;
+ this.popupObj = undefined;
+ this.popupTimer = undefined;
+
+ this.body.functions.getPointer = this.getPointer.bind(this);
+
+ this.options = {};
+ this.defaultOptions = {
+ dragNodes: true,
+ dragView: true,
+ hover: false,
+ keyboard: {
+ enabled: false,
+ speed: { x: 10, y: 10, zoom: 0.02 },
+ bindToWindow: true
+ },
+ navigationButtons: false,
+ tooltipDelay: 300,
+ zoomView: true
+ };
+ util.extend(this.options, this.defaultOptions);
+
+ this.bindEventListeners();
+ }
+
+ (0, _createClass3['default'])(InteractionHandler, [{
+ key: 'bindEventListeners',
+ value: function bindEventListeners() {
+ var _this = this;
+
+ this.body.emitter.on('destroy', function () {
+ clearTimeout(_this.popupTimer);
+ delete _this.body.functions.getPointer;
+ });
+ }
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ if (options !== undefined) {
+ // extend all but the values in fields
+ var fields = ['hideEdgesOnDrag', 'hideNodesOnDrag', 'keyboard', 'multiselect', 'selectable', 'selectConnectedEdges'];
+ util.selectiveNotDeepExtend(fields, this.options, options);
+
+ // merge the keyboard options in.
+ util.mergeOptions(this.options, options, 'keyboard');
+
+ if (options.tooltip) {
+ util.extend(this.options.tooltip, options.tooltip);
+ if (options.tooltip.color) {
+ this.options.tooltip.color = util.parseColor(options.tooltip.color);
+ }
+ }
+ }
+
+ this.navigationHandler.setOptions(this.options);
+ }
+
+ /**
+ * Get the pointer location from a touch location
+ * @param {{x: Number, y: Number}} touch
+ * @return {{x: Number, y: Number}} pointer
+ * @private
+ */
+
+ }, {
+ key: 'getPointer',
+ value: function getPointer(touch) {
+ return {
+ x: touch.x - util.getAbsoluteLeft(this.canvas.frame.canvas),
+ y: touch.y - util.getAbsoluteTop(this.canvas.frame.canvas)
+ };
+ }
+
+ /**
+ * On start of a touch gesture, store the pointer
+ * @param event
+ * @private
+ */
+
+ }, {
+ key: 'onTouch',
+ value: function onTouch(event) {
+ if (new Date().valueOf() - this.touchTime > 50) {
+ this.drag.pointer = this.getPointer(event.center);
+ this.drag.pinched = false;
+ this.pinch.scale = this.body.view.scale;
+ // to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame)
+ this.touchTime = new Date().valueOf();
+ }
+ }
+
+ /**
+ * handle tap/click event: select/unselect a node
+ * @private
+ */
+
+ }, {
+ key: 'onTap',
+ value: function onTap(event) {
+ var pointer = this.getPointer(event.center);
+ var multiselect = this.selectionHandler.options.multiselect && (event.changedPointers[0].ctrlKey || event.changedPointers[0].metaKey);
+
+ this.checkSelectionChanges(pointer, event, multiselect);
+ this.selectionHandler._generateClickEvent('click', event, pointer);
+ }
+
+ /**
+ * handle doubletap event
+ * @private
+ */
+
+ }, {
+ key: 'onDoubleTap',
+ value: function onDoubleTap(event) {
+ var pointer = this.getPointer(event.center);
+ this.selectionHandler._generateClickEvent('doubleClick', event, pointer);
+ }
+
+ /**
+ * handle long tap event: multi select nodes
+ * @private
+ */
+
+ }, {
+ key: 'onHold',
+ value: function onHold(event) {
+ var pointer = this.getPointer(event.center);
+ var multiselect = this.selectionHandler.options.multiselect;
+
+ this.checkSelectionChanges(pointer, event, multiselect);
+
+ this.selectionHandler._generateClickEvent('click', event, pointer);
+ this.selectionHandler._generateClickEvent('hold', event, pointer);
+ }
+
+ /**
+ * handle the release of the screen
+ *
+ * @private
+ */
+
+ }, {
+ key: 'onRelease',
+ value: function onRelease(event) {
+ if (new Date().valueOf() - this.touchTime > 10) {
+ var pointer = this.getPointer(event.center);
+ this.selectionHandler._generateClickEvent('release', event, pointer);
+ // to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame)
+ this.touchTime = new Date().valueOf();
+ }
+ }
+ }, {
+ key: 'onContext',
+ value: function onContext(event) {
+ var pointer = this.getPointer({ x: event.clientX, y: event.clientY });
+ this.selectionHandler._generateClickEvent('oncontext', event, pointer);
+ }
+
+ /**
+ *
+ * @param pointer
+ * @param add
+ */
+
+ }, {
+ key: 'checkSelectionChanges',
+ value: function checkSelectionChanges(pointer, event) {
+ var add = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ var previouslySelectedEdgeCount = this.selectionHandler._getSelectedEdgeCount();
+ var previouslySelectedNodeCount = this.selectionHandler._getSelectedNodeCount();
+ var previousSelection = this.selectionHandler.getSelection();
+ var selected = void 0;
+ if (add === true) {
+ selected = this.selectionHandler.selectAdditionalOnPoint(pointer);
+ } else {
+ selected = this.selectionHandler.selectOnPoint(pointer);
+ }
+ var selectedEdgesCount = this.selectionHandler._getSelectedEdgeCount();
+ var selectedNodesCount = this.selectionHandler._getSelectedNodeCount();
+ var currentSelection = this.selectionHandler.getSelection();
+
+ var _determineIfDifferent2 = this._determineIfDifferent(previousSelection, currentSelection),
+ nodesChanged = _determineIfDifferent2.nodesChanged,
+ edgesChanged = _determineIfDifferent2.edgesChanged;
+
+ var nodeSelected = false;
+
+ if (selectedNodesCount - previouslySelectedNodeCount > 0) {
+ // node was selected
+ this.selectionHandler._generateClickEvent('selectNode', event, pointer);
+ selected = true;
+ nodeSelected = true;
+ } else if (nodesChanged === true && selectedNodesCount > 0) {
+ this.selectionHandler._generateClickEvent('deselectNode', event, pointer, previousSelection);
+ this.selectionHandler._generateClickEvent('selectNode', event, pointer);
+ nodeSelected = true;
+ selected = true;
+ } else if (selectedNodesCount - previouslySelectedNodeCount < 0) {
+ // node was deselected
+ this.selectionHandler._generateClickEvent('deselectNode', event, pointer, previousSelection);
+ selected = true;
+ }
+
+ // handle the selected edges
+ if (selectedEdgesCount - previouslySelectedEdgeCount > 0 && nodeSelected === false) {
+ // edge was selected
+ this.selectionHandler._generateClickEvent('selectEdge', event, pointer);
+ selected = true;
+ } else if (selectedEdgesCount > 0 && edgesChanged === true) {
+ this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection);
+ this.selectionHandler._generateClickEvent('selectEdge', event, pointer);
+ selected = true;
+ } else if (selectedEdgesCount - previouslySelectedEdgeCount < 0) {
+ // edge was deselected
+ this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection);
+ selected = true;
+ }
+
+ // fire the select event if anything has been selected or deselected
+ if (selected === true) {
+ // select or unselect
+ this.selectionHandler._generateClickEvent('select', event, pointer);
+ }
+ }
+
+ /**
+ * This function checks if the nodes and edges previously selected have changed.
+ * @param previousSelection
+ * @param currentSelection
+ * @returns {{nodesChanged: boolean, edgesChanged: boolean}}
+ * @private
+ */
+
+ }, {
+ key: '_determineIfDifferent',
+ value: function _determineIfDifferent(previousSelection, currentSelection) {
+ var nodesChanged = false;
+ var edgesChanged = false;
+
+ for (var i = 0; i < previousSelection.nodes.length; i++) {
+ if (currentSelection.nodes.indexOf(previousSelection.nodes[i]) === -1) {
+ nodesChanged = true;
+ }
+ }
+ for (var _i = 0; _i < currentSelection.nodes.length; _i++) {
+ if (previousSelection.nodes.indexOf(previousSelection.nodes[_i]) === -1) {
+ nodesChanged = true;
+ }
+ }
+ for (var _i2 = 0; _i2 < previousSelection.edges.length; _i2++) {
+ if (currentSelection.edges.indexOf(previousSelection.edges[_i2]) === -1) {
+ edgesChanged = true;
+ }
+ }
+ for (var _i3 = 0; _i3 < currentSelection.edges.length; _i3++) {
+ if (previousSelection.edges.indexOf(previousSelection.edges[_i3]) === -1) {
+ edgesChanged = true;
+ }
+ }
+
+ return { nodesChanged: nodesChanged, edgesChanged: edgesChanged };
+ }
+
+ /**
+ * This function is called by onDragStart.
+ * It is separated out because we can then overload it for the datamanipulation system.
+ *
+ * @private
+ */
+
+ }, {
+ key: 'onDragStart',
+ value: function onDragStart(event) {
+ //in case the touch event was triggered on an external div, do the initial touch now.
+ if (this.drag.pointer === undefined) {
+ this.onTouch(event);
+ }
+
+ // note: drag.pointer is set in onTouch to get the initial touch location
+ var node = this.selectionHandler.getNodeAt(this.drag.pointer);
+
+ this.drag.dragging = true;
+ this.drag.selection = [];
+ this.drag.translation = util.extend({}, this.body.view.translation); // copy the object
+ this.drag.nodeId = undefined;
+
+ if (node !== undefined && this.options.dragNodes === true) {
+ this.drag.nodeId = node.id;
+ // select the clicked node if not yet selected
+ if (node.isSelected() === false) {
+ this.selectionHandler.unselectAll();
+ this.selectionHandler.selectObject(node);
+ }
+
+ // after select to contain the node
+ this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer);
+
+ var selection = this.selectionHandler.selectionObj.nodes;
+ // create an array with the selected nodes and their original location and status
+ for (var nodeId in selection) {
+ if (selection.hasOwnProperty(nodeId)) {
+ var object = selection[nodeId];
+ var s = {
+ id: object.id,
+ node: object,
+
+ // store original x, y, xFixed and yFixed, make the node temporarily Fixed
+ x: object.x,
+ y: object.y,
+ xFixed: object.options.fixed.x,
+ yFixed: object.options.fixed.y
+ };
+
+ object.options.fixed.x = true;
+ object.options.fixed.y = true;
+
+ this.drag.selection.push(s);
+ }
+ }
+ } else {
+ // fallback if no node is selected and thus the view is dragged.
+ this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer, undefined, true);
+ }
+ }
+
+ /**
+ * handle drag event
+ * @private
+ */
+
+ }, {
+ key: 'onDrag',
+ value: function onDrag(event) {
+ var _this2 = this;
+
+ if (this.drag.pinched === true) {
+ return;
+ }
+
+ // remove the focus on node if it is focussed on by the focusOnNode
+ this.body.emitter.emit('unlockNode');
+
+ var pointer = this.getPointer(event.center);
+
+ var selection = this.drag.selection;
+ if (selection && selection.length && this.options.dragNodes === true) {
+ (function () {
+ _this2.selectionHandler._generateClickEvent('dragging', event, pointer);
+
+ // calculate delta's and new location
+ var deltaX = pointer.x - _this2.drag.pointer.x;
+ var deltaY = pointer.y - _this2.drag.pointer.y;
+
+ // update position of all selected nodes
+ selection.forEach(function (selection) {
+ var node = selection.node;
+ // only move the node if it was not fixed initially
+ if (selection.xFixed === false) {
+ node.x = _this2.canvas._XconvertDOMtoCanvas(_this2.canvas._XconvertCanvasToDOM(selection.x) + deltaX);
+ }
+ // only move the node if it was not fixed initially
+ if (selection.yFixed === false) {
+ node.y = _this2.canvas._YconvertDOMtoCanvas(_this2.canvas._YconvertCanvasToDOM(selection.y) + deltaY);
+ }
+ });
+
+ // start the simulation of the physics
+ _this2.body.emitter.emit('startSimulation');
+ })();
+ } else {
+ // move the network
+ if (this.options.dragView === true) {
+ this.selectionHandler._generateClickEvent('dragging', event, pointer, undefined, true);
+
+ // if the drag was not started properly because the click started outside the network div, start it now.
+ if (this.drag.pointer === undefined) {
+ this.onDragStart(event);
+ return;
+ }
+ var diffX = pointer.x - this.drag.pointer.x;
+ var diffY = pointer.y - this.drag.pointer.y;
+
+ this.body.view.translation = { x: this.drag.translation.x + diffX, y: this.drag.translation.y + diffY };
+ this.body.emitter.emit('_redraw');
+ }
+ }
+ }
+
+ /**
+ * handle drag start event
+ * @private
+ */
+
+ }, {
+ key: 'onDragEnd',
+ value: function onDragEnd(event) {
+ this.drag.dragging = false;
+ var selection = this.drag.selection;
+ if (selection && selection.length) {
+ selection.forEach(function (s) {
+ // restore original xFixed and yFixed
+ s.node.options.fixed.x = s.xFixed;
+ s.node.options.fixed.y = s.yFixed;
+ });
+ this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center));
+ this.body.emitter.emit('startSimulation');
+ } else {
+ this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center), undefined, true);
+ this.body.emitter.emit('_requestRedraw');
+ }
+ }
+
+ /**
+ * Handle pinch event
+ * @param event
+ * @private
+ */
+
+ }, {
+ key: 'onPinch',
+ value: function onPinch(event) {
+ var pointer = this.getPointer(event.center);
+
+ this.drag.pinched = true;
+ if (this.pinch['scale'] === undefined) {
+ this.pinch.scale = 1;
+ }
+
+ // TODO: enabled moving while pinching?
+ var scale = this.pinch.scale * event.scale;
+ this.zoom(scale, pointer);
+ }
+
+ /**
+ * Zoom the network in or out
+ * @param {Number} scale a number around 1, and between 0.01 and 10
+ * @param {{x: Number, y: Number}} pointer Position on screen
+ * @return {Number} appliedScale scale is limited within the boundaries
+ * @private
+ */
+
+ }, {
+ key: 'zoom',
+ value: function zoom(scale, pointer) {
+ if (this.options.zoomView === true) {
+ var scaleOld = this.body.view.scale;
+ if (scale < 0.00001) {
+ scale = 0.00001;
+ }
+ if (scale > 10) {
+ scale = 10;
+ }
+
+ var preScaleDragPointer = undefined;
+ if (this.drag !== undefined) {
+ if (this.drag.dragging === true) {
+ preScaleDragPointer = this.canvas.DOMtoCanvas(this.drag.pointer);
+ }
+ }
+ // + this.canvas.frame.canvas.clientHeight / 2
+ var translation = this.body.view.translation;
+
+ var scaleFrac = scale / scaleOld;
+ var tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac;
+ var ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac;
+
+ this.body.view.scale = scale;
+ this.body.view.translation = { x: tx, y: ty };
+
+ if (preScaleDragPointer != undefined) {
+ var postScaleDragPointer = this.canvas.canvasToDOM(preScaleDragPointer);
+ this.drag.pointer.x = postScaleDragPointer.x;
+ this.drag.pointer.y = postScaleDragPointer.y;
+ }
+
+ this.body.emitter.emit('_requestRedraw');
+
+ if (scaleOld < scale) {
+ this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale, pointer: pointer });
+ } else {
+ this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale, pointer: pointer });
+ }
+ }
+ }
+
+ /**
+ * Event handler for mouse wheel event, used to zoom the timeline
+ * See http://adomas.org/javascript-mouse-wheel/
+ * https://github.com/EightMedia/hammer.js/issues/256
+ * @param {MouseEvent} event
+ * @private
+ */
+
+ }, {
+ key: 'onMouseWheel',
+ value: function onMouseWheel(event) {
+ if (this.options.zoomView === true) {
+ // retrieve delta
+ var delta = 0;
+ if (event.wheelDelta) {
+ /* IE/Opera. */
+ delta = event.wheelDelta / 120;
+ } else if (event.detail) {
+ /* Mozilla case. */
+ // In Mozilla, sign of delta is different than in IE.
+ // Also, delta is multiple of 3.
+ delta = -event.detail / 3;
+ }
+
+ // If delta is nonzero, handle it.
+ // Basically, delta is now positive if wheel was scrolled up,
+ // and negative, if wheel was scrolled down.
+ if (delta !== 0) {
+
+ // calculate the new scale
+ var scale = this.body.view.scale;
+ var zoom = delta / 10;
+ if (delta < 0) {
+ zoom = zoom / (1 - zoom);
+ }
+ scale *= 1 + zoom;
+
+ // calculate the pointer location
+ var pointer = this.getPointer({ x: event.clientX, y: event.clientY });
+
+ // apply the new scale
+ this.zoom(scale, pointer);
+ }
+
+ // Prevent default actions caused by mouse wheel.
+ event.preventDefault();
+ }
+ }
+
+ /**
+ * Mouse move handler for checking whether the title moves over a node with a title.
+ * @param {Event} event
+ * @private
+ */
+
+ }, {
+ key: 'onMouseMove',
+ value: function onMouseMove(event) {
+ var _this3 = this;
+
+ var pointer = this.getPointer({ x: event.clientX, y: event.clientY });
+ var popupVisible = false;
+
+ // check if the previously selected node is still selected
+ if (this.popup !== undefined) {
+ if (this.popup.hidden === false) {
+ this._checkHidePopup(pointer);
+ }
+
+ // if the popup was not hidden above
+ if (this.popup.hidden === false) {
+ popupVisible = true;
+ this.popup.setPosition(pointer.x + 3, pointer.y - 5);
+ this.popup.show();
+ }
+ }
+
+ // if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over.
+ if (this.options.keyboard.bindToWindow === false && this.options.keyboard.enabled === true) {
+ this.canvas.frame.focus();
+ }
+
+ // start a timeout that will check if the mouse is positioned above an element
+ if (popupVisible === false) {
+ if (this.popupTimer !== undefined) {
+ clearInterval(this.popupTimer); // stop any running calculationTimer
+ this.popupTimer = undefined;
+ }
+ if (!this.drag.dragging) {
+ this.popupTimer = setTimeout(function () {
+ return _this3._checkShowPopup(pointer);
+ }, this.options.tooltipDelay);
+ }
+ }
+
+ /**
+ * Adding hover highlights
+ */
+ if (this.options.hover === true) {
+ // adding hover highlights
+ var obj = this.selectionHandler.getNodeAt(pointer);
+ if (obj === undefined) {
+ obj = this.selectionHandler.getEdgeAt(pointer);
+ }
+ this.selectionHandler.hoverObject(obj);
+ }
+ }
+
+ /**
+ * Check if there is an element on the given position in the network
+ * (a node or edge). If so, and if this element has a title,
+ * show a popup window with its title.
+ *
+ * @param {{x:Number, y:Number}} pointer
+ * @private
+ */
+
+ }, {
+ key: '_checkShowPopup',
+ value: function _checkShowPopup(pointer) {
+ var x = this.canvas._XconvertDOMtoCanvas(pointer.x);
+ var y = this.canvas._YconvertDOMtoCanvas(pointer.y);
+ var pointerObj = {
+ left: x,
+ top: y,
+ right: x,
+ bottom: y
+ };
+
+ var previousPopupObjId = this.popupObj === undefined ? undefined : this.popupObj.id;
+ var nodeUnderCursor = false;
+ var popupType = 'node';
+
+ // check if a node is under the cursor.
+ if (this.popupObj === undefined) {
+ // search the nodes for overlap, select the top one in case of multiple nodes
+ var nodeIndices = this.body.nodeIndices;
+ var nodes = this.body.nodes;
+ var node = void 0;
+ var overlappingNodes = [];
+ for (var i = 0; i < nodeIndices.length; i++) {
+ node = nodes[nodeIndices[i]];
+ if (node.isOverlappingWith(pointerObj) === true) {
+ if (node.getTitle() !== undefined) {
+ overlappingNodes.push(nodeIndices[i]);
+ }
+ }
+ }
+
+ if (overlappingNodes.length > 0) {
+ // if there are overlapping nodes, select the last one, this is the one which is drawn on top of the others
+ this.popupObj = nodes[overlappingNodes[overlappingNodes.length - 1]];
+ // if you hover over a node, the title of the edge is not supposed to be shown.
+ nodeUnderCursor = true;
+ }
+ }
+
+ if (this.popupObj === undefined && nodeUnderCursor === false) {
+ // search the edges for overlap
+ var edgeIndices = this.body.edgeIndices;
+ var edges = this.body.edges;
+ var edge = void 0;
+ var overlappingEdges = [];
+ for (var _i4 = 0; _i4 < edgeIndices.length; _i4++) {
+ edge = edges[edgeIndices[_i4]];
+ if (edge.isOverlappingWith(pointerObj) === true) {
+ if (edge.connected === true && edge.getTitle() !== undefined) {
+ overlappingEdges.push(edgeIndices[_i4]);
+ }
+ }
+ }
+
+ if (overlappingEdges.length > 0) {
+ this.popupObj = edges[overlappingEdges[overlappingEdges.length - 1]];
+ popupType = 'edge';
+ }
+ }
+
+ if (this.popupObj !== undefined) {
+ // show popup message window
+ if (this.popupObj.id !== previousPopupObjId) {
+ if (this.popup === undefined) {
+ this.popup = new _Popup2['default'](this.canvas.frame);
+ }
+
+ this.popup.popupTargetType = popupType;
+ this.popup.popupTargetId = this.popupObj.id;
+
+ // adjust a small offset such that the mouse cursor is located in the
+ // bottom left location of the popup, and you can easily move over the
+ // popup area
+ this.popup.setPosition(pointer.x + 3, pointer.y - 5);
+ this.popup.setText(this.popupObj.getTitle());
+ this.popup.show();
+ this.body.emitter.emit('showPopup', this.popupObj.id);
+ }
+ } else {
+ if (this.popup !== undefined) {
+ this.popup.hide();
+ this.body.emitter.emit('hidePopup');
+ }
+ }
+ }
+
+ /**
+ * Check if the popup must be hidden, which is the case when the mouse is no
+ * longer hovering on the object
+ * @param {{x:Number, y:Number}} pointer
+ * @private
+ */
+
+ }, {
+ key: '_checkHidePopup',
+ value: function _checkHidePopup(pointer) {
+ var pointerObj = this.selectionHandler._pointerToPositionObject(pointer);
+
+ var stillOnObj = false;
+ if (this.popup.popupTargetType === 'node') {
+ if (this.body.nodes[this.popup.popupTargetId] !== undefined) {
+ stillOnObj = this.body.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj);
+
+ // if the mouse is still one the node, we have to check if it is not also on one that is drawn on top of it.
+ // we initially only check stillOnObj because this is much faster.
+ if (stillOnObj === true) {
+ var overNode = this.selectionHandler.getNodeAt(pointer);
+ stillOnObj = overNode === undefined ? false : overNode.id === this.popup.popupTargetId;
+ }
+ }
+ } else {
+ if (this.selectionHandler.getNodeAt(pointer) === undefined) {
+ if (this.body.edges[this.popup.popupTargetId] !== undefined) {
+ stillOnObj = this.body.edges[this.popup.popupTargetId].isOverlappingWith(pointerObj);
+ }
+ }
+ }
+
+ if (stillOnObj === false) {
+ this.popupObj = undefined;
+ this.popup.hide();
+ this.body.emitter.emit('hidePopup');
+ }
+ }
+ }]);
+ return InteractionHandler;
+ }();
+
+ exports['default'] = InteractionHandler;
+
+/***/ },
+/* 216 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var Hammer = __webpack_require__(108);
+ var hammerUtil = __webpack_require__(121);
+ var keycharm = __webpack_require__(111);
+
+ var NavigationHandler = function () {
+ function NavigationHandler(body, canvas) {
+ var _this = this;
+
+ (0, _classCallCheck3['default'])(this, NavigationHandler);
+
+ this.body = body;
+ this.canvas = canvas;
+
+ this.iconsCreated = false;
+ this.navigationHammers = [];
+ this.boundFunctions = {};
+ this.touchTime = 0;
+ this.activated = false;
+
+ this.body.emitter.on("activate", function () {
+ _this.activated = true;_this.configureKeyboardBindings();
+ });
+ this.body.emitter.on("deactivate", function () {
+ _this.activated = false;_this.configureKeyboardBindings();
+ });
+ this.body.emitter.on("destroy", function () {
+ if (_this.keycharm !== undefined) {
+ _this.keycharm.destroy();
+ }
+ });
+
+ this.options = {};
+ }
+
+ (0, _createClass3['default'])(NavigationHandler, [{
+ key: 'setOptions',
+ value: function setOptions(options) {
+ if (options !== undefined) {
+ this.options = options;
+ this.create();
+ }
+ }
+ }, {
+ key: 'create',
+ value: function create() {
+ if (this.options.navigationButtons === true) {
+ if (this.iconsCreated === false) {
+ this.loadNavigationElements();
+ }
+ } else if (this.iconsCreated === true) {
+ this.cleanNavigation();
+ }
+
+ this.configureKeyboardBindings();
+ }
+ }, {
+ key: 'cleanNavigation',
+ value: function cleanNavigation() {
+ // clean hammer bindings
+ if (this.navigationHammers.length != 0) {
+ for (var i = 0; i < this.navigationHammers.length; i++) {
+ this.navigationHammers[i].destroy();
+ }
+ this.navigationHammers = [];
+ }
+
+ // clean up previous navigation items
+ if (this.navigationDOM && this.navigationDOM['wrapper'] && this.navigationDOM['wrapper'].parentNode) {
+ this.navigationDOM['wrapper'].parentNode.removeChild(this.navigationDOM['wrapper']);
+ }
+
+ this.iconsCreated = false;
+ }
+
+ /**
+ * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation
+ * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent
+ * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false.
+ * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas.
+ *
+ * @private
+ */
+
+ }, {
+ key: 'loadNavigationElements',
+ value: function loadNavigationElements() {
+ var _this2 = this;
+
+ this.cleanNavigation();
+
+ this.navigationDOM = {};
+ var navigationDivs = ['up', 'down', 'left', 'right', 'zoomIn', 'zoomOut', 'zoomExtends'];
+ var navigationDivActions = ['_moveUp', '_moveDown', '_moveLeft', '_moveRight', '_zoomIn', '_zoomOut', '_fit'];
+
+ this.navigationDOM['wrapper'] = document.createElement('div');
+ this.navigationDOM['wrapper'].className = 'vis-navigation';
+ this.canvas.frame.appendChild(this.navigationDOM['wrapper']);
+
+ for (var i = 0; i < navigationDivs.length; i++) {
+ this.navigationDOM[navigationDivs[i]] = document.createElement('div');
+ this.navigationDOM[navigationDivs[i]].className = 'vis-button vis-' + navigationDivs[i];
+ this.navigationDOM['wrapper'].appendChild(this.navigationDOM[navigationDivs[i]]);
+
+ var hammer = new Hammer(this.navigationDOM[navigationDivs[i]]);
+ if (navigationDivActions[i] === "_fit") {
+ hammerUtil.onTouch(hammer, this._fit.bind(this));
+ } else {
+ hammerUtil.onTouch(hammer, this.bindToRedraw.bind(this, navigationDivActions[i]));
+ }
+
+ this.navigationHammers.push(hammer);
+ }
+
+ // use a hammer for the release so we do not require the one used in the rest of the network
+ // the one the rest uses can be overloaded by the manipulation system.
+ var hammerFrame = new Hammer(this.canvas.frame);
+ hammerUtil.onRelease(hammerFrame, function () {
+ _this2._stopMovement();
+ });
+ this.navigationHammers.push(hammerFrame);
+
+ this.iconsCreated = true;
+ }
+ }, {
+ key: 'bindToRedraw',
+ value: function bindToRedraw(action) {
+ if (this.boundFunctions[action] === undefined) {
+ this.boundFunctions[action] = this[action].bind(this);
+ this.body.emitter.on("initRedraw", this.boundFunctions[action]);
+ this.body.emitter.emit("_startRendering");
+ }
+ }
+ }, {
+ key: 'unbindFromRedraw',
+ value: function unbindFromRedraw(action) {
+ if (this.boundFunctions[action] !== undefined) {
+ this.body.emitter.off("initRedraw", this.boundFunctions[action]);
+ this.body.emitter.emit("_stopRendering");
+ delete this.boundFunctions[action];
+ }
+ }
+
+ /**
+ * this stops all movement induced by the navigation buttons
+ *
+ * @private
+ */
+
+ }, {
+ key: '_fit',
+ value: function _fit() {
+ if (new Date().valueOf() - this.touchTime > 700) {
+ // TODO: fix ugly hack to avoid hammer's double fireing of event (because we use release?)
+ this.body.emitter.emit("fit", { duration: 700 });
+ this.touchTime = new Date().valueOf();
+ }
+ }
+
+ /**
+ * this stops all movement induced by the navigation buttons
+ *
+ * @private
+ */
+
+ }, {
+ key: '_stopMovement',
+ value: function _stopMovement() {
+ for (var boundAction in this.boundFunctions) {
+ if (this.boundFunctions.hasOwnProperty(boundAction)) {
+ this.body.emitter.off("initRedraw", this.boundFunctions[boundAction]);
+ this.body.emitter.emit("_stopRendering");
+ }
+ }
+ this.boundFunctions = {};
+ }
+ }, {
+ key: '_moveUp',
+ value: function _moveUp() {
+ this.body.view.translation.y += this.options.keyboard.speed.y;
+ }
+ }, {
+ key: '_moveDown',
+ value: function _moveDown() {
+ this.body.view.translation.y -= this.options.keyboard.speed.y;
+ }
+ }, {
+ key: '_moveLeft',
+ value: function _moveLeft() {
+ this.body.view.translation.x += this.options.keyboard.speed.x;
+ }
+ }, {
+ key: '_moveRight',
+ value: function _moveRight() {
+ this.body.view.translation.x -= this.options.keyboard.speed.x;
+ }
+ }, {
+ key: '_zoomIn',
+ value: function _zoomIn() {
+ var scaleOld = this.body.view.scale;
+ var scale = this.body.view.scale * (1 + this.options.keyboard.speed.zoom);
+ var translation = this.body.view.translation;
+ var scaleFrac = scale / scaleOld;
+ var tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac;
+ var ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac;
+
+ this.body.view.scale = scale;
+ this.body.view.translation = { x: tx, y: ty };
+ this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale, pointer: null });
+ }
+ }, {
+ key: '_zoomOut',
+ value: function _zoomOut() {
+ var scaleOld = this.body.view.scale;
+ var scale = this.body.view.scale / (1 + this.options.keyboard.speed.zoom);
+ var translation = this.body.view.translation;
+ var scaleFrac = scale / scaleOld;
+ var tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac;
+ var ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac;
+
+ this.body.view.scale = scale;
+ this.body.view.translation = { x: tx, y: ty };
+ this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale, pointer: null });
+ }
+
+ /**
+ * bind all keys using keycharm.
+ */
+
+ }, {
+ key: 'configureKeyboardBindings',
+ value: function configureKeyboardBindings() {
+ var _this3 = this;
+
+ if (this.keycharm !== undefined) {
+ this.keycharm.destroy();
+ }
+
+ if (this.options.keyboard.enabled === true) {
+ if (this.options.keyboard.bindToWindow === true) {
+ this.keycharm = keycharm({ container: window, preventDefault: true });
+ } else {
+ this.keycharm = keycharm({ container: this.canvas.frame, preventDefault: true });
+ }
+
+ this.keycharm.reset();
+
+ if (this.activated === true) {
+ this.keycharm.bind("up", function () {
+ _this3.bindToRedraw("_moveUp");
+ }, "keydown");
+ this.keycharm.bind("down", function () {
+ _this3.bindToRedraw("_moveDown");
+ }, "keydown");
+ this.keycharm.bind("left", function () {
+ _this3.bindToRedraw("_moveLeft");
+ }, "keydown");
+ this.keycharm.bind("right", function () {
+ _this3.bindToRedraw("_moveRight");
+ }, "keydown");
+ this.keycharm.bind("=", function () {
+ _this3.bindToRedraw("_zoomIn");
+ }, "keydown");
+ this.keycharm.bind("num+", function () {
+ _this3.bindToRedraw("_zoomIn");
+ }, "keydown");
+ this.keycharm.bind("num-", function () {
+ _this3.bindToRedraw("_zoomOut");
+ }, "keydown");
+ this.keycharm.bind("-", function () {
+ _this3.bindToRedraw("_zoomOut");
+ }, "keydown");
+ this.keycharm.bind("[", function () {
+ _this3.bindToRedraw("_zoomOut");
+ }, "keydown");
+ this.keycharm.bind("]", function () {
+ _this3.bindToRedraw("_zoomIn");
+ }, "keydown");
+ this.keycharm.bind("pageup", function () {
+ _this3.bindToRedraw("_zoomIn");
+ }, "keydown");
+ this.keycharm.bind("pagedown", function () {
+ _this3.bindToRedraw("_zoomOut");
+ }, "keydown");
+
+ this.keycharm.bind("up", function () {
+ _this3.unbindFromRedraw("_moveUp");
+ }, "keyup");
+ this.keycharm.bind("down", function () {
+ _this3.unbindFromRedraw("_moveDown");
+ }, "keyup");
+ this.keycharm.bind("left", function () {
+ _this3.unbindFromRedraw("_moveLeft");
+ }, "keyup");
+ this.keycharm.bind("right", function () {
+ _this3.unbindFromRedraw("_moveRight");
+ }, "keyup");
+ this.keycharm.bind("=", function () {
+ _this3.unbindFromRedraw("_zoomIn");
+ }, "keyup");
+ this.keycharm.bind("num+", function () {
+ _this3.unbindFromRedraw("_zoomIn");
+ }, "keyup");
+ this.keycharm.bind("num-", function () {
+ _this3.unbindFromRedraw("_zoomOut");
+ }, "keyup");
+ this.keycharm.bind("-", function () {
+ _this3.unbindFromRedraw("_zoomOut");
+ }, "keyup");
+ this.keycharm.bind("[", function () {
+ _this3.unbindFromRedraw("_zoomOut");
+ }, "keyup");
+ this.keycharm.bind("]", function () {
+ _this3.unbindFromRedraw("_zoomIn");
+ }, "keyup");
+ this.keycharm.bind("pageup", function () {
+ _this3.unbindFromRedraw("_zoomIn");
+ }, "keyup");
+ this.keycharm.bind("pagedown", function () {
+ _this3.unbindFromRedraw("_zoomOut");
+ }, "keyup");
+ }
+ }
+ }
+ }]);
+ return NavigationHandler;
+ }();
+
+ exports['default'] = NavigationHandler;
+
+/***/ },
+/* 217 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _Node = __webpack_require__(159);
+
+ var _Node2 = _interopRequireDefault(_Node);
+
+ var _Edge = __webpack_require__(192);
+
+ var _Edge2 = _interopRequireDefault(_Edge);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var SelectionHandler = function () {
+ function SelectionHandler(body, canvas) {
+ var _this = this;
+
+ (0, _classCallCheck3['default'])(this, SelectionHandler);
+
+ this.body = body;
+ this.canvas = canvas;
+ this.selectionObj = { nodes: [], edges: [] };
+ this.hoverObj = { nodes: {}, edges: {} };
+
+ this.options = {};
+ this.defaultOptions = {
+ multiselect: false,
+ selectable: true,
+ selectConnectedEdges: true,
+ hoverConnectedEdges: true
+ };
+ util.extend(this.options, this.defaultOptions);
+
+ this.body.emitter.on("_dataChanged", function () {
+ _this.updateSelection();
+ });
+ }
+
+ (0, _createClass3['default'])(SelectionHandler, [{
+ key: 'setOptions',
+ value: function setOptions(options) {
+ if (options !== undefined) {
+ var fields = ['multiselect', 'hoverConnectedEdges', 'selectable', 'selectConnectedEdges'];
+ util.selectiveDeepExtend(fields, this.options, options);
+ }
+ }
+
+ /**
+ * handles the selection part of the tap;
+ *
+ * @param {Object} pointer
+ * @private
+ */
+
+ }, {
+ key: 'selectOnPoint',
+ value: function selectOnPoint(pointer) {
+ var selected = false;
+ if (this.options.selectable === true) {
+ var obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer);
+
+ // unselect after getting the objects in order to restore width and height.
+ this.unselectAll();
+
+ if (obj !== undefined) {
+ selected = this.selectObject(obj);
+ }
+ this.body.emitter.emit("_requestRedraw");
+ }
+ return selected;
+ }
+ }, {
+ key: 'selectAdditionalOnPoint',
+ value: function selectAdditionalOnPoint(pointer) {
+ var selectionChanged = false;
+ if (this.options.selectable === true) {
+ var obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer);
+
+ if (obj !== undefined) {
+ selectionChanged = true;
+ if (obj.isSelected() === true) {
+ this.deselectObject(obj);
+ } else {
+ this.selectObject(obj);
+ }
+
+ this.body.emitter.emit("_requestRedraw");
+ }
+ }
+ return selectionChanged;
+ }
+ }, {
+ key: '_generateClickEvent',
+ value: function _generateClickEvent(eventType, event, pointer, oldSelection) {
+ var emptySelection = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+
+ var properties = void 0;
+ if (emptySelection === true) {
+ properties = { nodes: [], edges: [] };
+ } else {
+ properties = this.getSelection();
+ }
+ properties['pointer'] = {
+ DOM: { x: pointer.x, y: pointer.y },
+ canvas: this.canvas.DOMtoCanvas(pointer)
+ };
+ properties['event'] = event;
+
+ if (oldSelection !== undefined) {
+ properties['previousSelection'] = oldSelection;
+ }
+ this.body.emitter.emit(eventType, properties);
+ }
+ }, {
+ key: 'selectObject',
+ value: function selectObject(obj) {
+ var highlightEdges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.selectConnectedEdges;
+
+ if (obj !== undefined) {
+ if (obj instanceof _Node2['default']) {
+ if (highlightEdges === true) {
+ this._selectConnectedEdges(obj);
+ }
+ }
+ obj.select();
+ this._addToSelection(obj);
+ return true;
+ }
+ return false;
+ }
+ }, {
+ key: 'deselectObject',
+ value: function deselectObject(obj) {
+ if (obj.isSelected() === true) {
+ obj.selected = false;
+ this._removeFromSelection(obj);
+ }
+ }
+
+ /**
+ * retrieve all nodes overlapping with given object
+ * @param {Object} object An object with parameters left, top, right, bottom
+ * @return {Number[]} An array with id's of the overlapping nodes
+ * @private
+ */
+
+ }, {
+ key: '_getAllNodesOverlappingWith',
+ value: function _getAllNodesOverlappingWith(object) {
+ var overlappingNodes = [];
+ var nodes = this.body.nodes;
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ var nodeId = this.body.nodeIndices[i];
+ if (nodes[nodeId].isOverlappingWith(object)) {
+ overlappingNodes.push(nodeId);
+ }
+ }
+ return overlappingNodes;
+ }
+
+ /**
+ * Return a position object in canvasspace from a single point in screenspace
+ *
+ * @param pointer
+ * @returns {{left: number, top: number, right: number, bottom: number}}
+ * @private
+ */
+
+ }, {
+ key: '_pointerToPositionObject',
+ value: function _pointerToPositionObject(pointer) {
+ var canvasPos = this.canvas.DOMtoCanvas(pointer);
+ return {
+ left: canvasPos.x - 1,
+ top: canvasPos.y + 1,
+ right: canvasPos.x + 1,
+ bottom: canvasPos.y - 1
+ };
+ }
+
+ /**
+ * Get the top node at the a specific point (like a click)
+ *
+ * @param {{x: Number, y: Number}} pointer
+ * @return {Node | undefined} node
+ */
+
+ }, {
+ key: 'getNodeAt',
+ value: function getNodeAt(pointer) {
+ var returnNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // we first check if this is an navigation controls element
+ var positionObject = this._pointerToPositionObject(pointer);
+ var overlappingNodes = this._getAllNodesOverlappingWith(positionObject);
+ // if there are overlapping nodes, select the last one, this is the
+ // one which is drawn on top of the others
+ if (overlappingNodes.length > 0) {
+ if (returnNode === true) {
+ return this.body.nodes[overlappingNodes[overlappingNodes.length - 1]];
+ } else {
+ return overlappingNodes[overlappingNodes.length - 1];
+ }
+ } else {
+ return undefined;
+ }
+ }
+
+ /**
+ * retrieve all edges overlapping with given object, selector is around center
+ * @param {Object} object An object with parameters left, top, right, bottom
+ * @return {Number[]} An array with id's of the overlapping nodes
+ * @private
+ */
+
+ }, {
+ key: '_getEdgesOverlappingWith',
+ value: function _getEdgesOverlappingWith(object, overlappingEdges) {
+ var edges = this.body.edges;
+ for (var i = 0; i < this.body.edgeIndices.length; i++) {
+ var edgeId = this.body.edgeIndices[i];
+ if (edges[edgeId].isOverlappingWith(object)) {
+ overlappingEdges.push(edgeId);
+ }
+ }
+ }
+
+ /**
+ * retrieve all nodes overlapping with given object
+ * @param {Object} object An object with parameters left, top, right, bottom
+ * @return {Number[]} An array with id's of the overlapping nodes
+ * @private
+ */
+
+ }, {
+ key: '_getAllEdgesOverlappingWith',
+ value: function _getAllEdgesOverlappingWith(object) {
+ var overlappingEdges = [];
+ this._getEdgesOverlappingWith(object, overlappingEdges);
+ return overlappingEdges;
+ }
+
+ /**
+ * Place holder. To implement change the getNodeAt to a _getObjectAt. Have the _getObjectAt call
+ * getNodeAt and _getEdgesAt, then priortize the selection to user preferences.
+ *
+ * @param pointer
+ * @returns {undefined}
+ */
+
+ }, {
+ key: 'getEdgeAt',
+ value: function getEdgeAt(pointer) {
+ var returnEdge = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ // Iterate over edges, pick closest within 10
+ var canvasPos = this.canvas.DOMtoCanvas(pointer);
+ var mindist = 10;
+ var overlappingEdge = null;
+ var edges = this.body.edges;
+ for (var i = 0; i < this.body.edgeIndices.length; i++) {
+ var edgeId = this.body.edgeIndices[i];
+ var edge = edges[edgeId];
+ if (edge.connected) {
+ var xFrom = edge.from.x;
+ var yFrom = edge.from.y;
+ var xTo = edge.to.x;
+ var yTo = edge.to.y;
+ var dist = edge.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, canvasPos.x, canvasPos.y);
+ if (dist < mindist) {
+ overlappingEdge = edgeId;
+ mindist = dist;
+ }
+ }
+ }
+ if (overlappingEdge) {
+ if (returnEdge === true) {
+ return this.body.edges[overlappingEdge];
+ } else {
+ return overlappingEdge;
+ }
+ } else {
+ return undefined;
+ }
+ }
+
+ /**
+ * Add object to the selection array.
+ *
+ * @param obj
+ * @private
+ */
+
+ }, {
+ key: '_addToSelection',
+ value: function _addToSelection(obj) {
+ if (obj instanceof _Node2['default']) {
+ this.selectionObj.nodes[obj.id] = obj;
+ } else {
+ this.selectionObj.edges[obj.id] = obj;
+ }
+ }
+
+ /**
+ * Add object to the selection array.
+ *
+ * @param obj
+ * @private
+ */
+
+ }, {
+ key: '_addToHover',
+ value: function _addToHover(obj) {
+ if (obj instanceof _Node2['default']) {
+ this.hoverObj.nodes[obj.id] = obj;
+ } else {
+ this.hoverObj.edges[obj.id] = obj;
+ }
+ }
+
+ /**
+ * Remove a single option from selection.
+ *
+ * @param {Object} obj
+ * @private
+ */
+
+ }, {
+ key: '_removeFromSelection',
+ value: function _removeFromSelection(obj) {
+ if (obj instanceof _Node2['default']) {
+ delete this.selectionObj.nodes[obj.id];
+ this._unselectConnectedEdges(obj);
+ } else {
+ delete this.selectionObj.edges[obj.id];
+ }
+ }
+
+ /**
+ * Unselect all. The selectionObj is useful for this.
+ */
+
+ }, {
+ key: 'unselectAll',
+ value: function unselectAll() {
+ for (var nodeId in this.selectionObj.nodes) {
+ if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
+ this.selectionObj.nodes[nodeId].unselect();
+ }
+ }
+ for (var edgeId in this.selectionObj.edges) {
+ if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
+ this.selectionObj.edges[edgeId].unselect();
+ }
+ }
+
+ this.selectionObj = { nodes: {}, edges: {} };
+ }
+
+ /**
+ * return the number of selected nodes
+ *
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_getSelectedNodeCount',
+ value: function _getSelectedNodeCount() {
+ var count = 0;
+ for (var nodeId in this.selectionObj.nodes) {
+ if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
+ count += 1;
+ }
+ }
+ return count;
+ }
+
+ /**
+ * return the selected node
+ *
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_getSelectedNode',
+ value: function _getSelectedNode() {
+ for (var nodeId in this.selectionObj.nodes) {
+ if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
+ return this.selectionObj.nodes[nodeId];
+ }
+ }
+ return undefined;
+ }
+
+ /**
+ * return the selected edge
+ *
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_getSelectedEdge',
+ value: function _getSelectedEdge() {
+ for (var edgeId in this.selectionObj.edges) {
+ if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
+ return this.selectionObj.edges[edgeId];
+ }
+ }
+ return undefined;
+ }
+
+ /**
+ * return the number of selected edges
+ *
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_getSelectedEdgeCount',
+ value: function _getSelectedEdgeCount() {
+ var count = 0;
+ for (var edgeId in this.selectionObj.edges) {
+ if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
+ count += 1;
+ }
+ }
+ return count;
+ }
+
+ /**
+ * return the number of selected objects.
+ *
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_getSelectedObjectCount',
+ value: function _getSelectedObjectCount() {
+ var count = 0;
+ for (var nodeId in this.selectionObj.nodes) {
+ if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
+ count += 1;
+ }
+ }
+ for (var edgeId in this.selectionObj.edges) {
+ if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
+ count += 1;
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Check if anything is selected
+ *
+ * @returns {boolean}
+ * @private
+ */
+
+ }, {
+ key: '_selectionIsEmpty',
+ value: function _selectionIsEmpty() {
+ for (var nodeId in this.selectionObj.nodes) {
+ if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
+ return false;
+ }
+ }
+ for (var edgeId in this.selectionObj.edges) {
+ if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * check if one of the selected nodes is a cluster.
+ *
+ * @returns {boolean}
+ * @private
+ */
+
+ }, {
+ key: '_clusterInSelection',
+ value: function _clusterInSelection() {
+ for (var nodeId in this.selectionObj.nodes) {
+ if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
+ if (this.selectionObj.nodes[nodeId].clusterSize > 1) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * select the edges connected to the node that is being selected
+ *
+ * @param {Node} node
+ * @private
+ */
+
+ }, {
+ key: '_selectConnectedEdges',
+ value: function _selectConnectedEdges(node) {
+ for (var i = 0; i < node.edges.length; i++) {
+ var edge = node.edges[i];
+ edge.select();
+ this._addToSelection(edge);
+ }
+ }
+
+ /**
+ * select the edges connected to the node that is being selected
+ *
+ * @param {Node} node
+ * @private
+ */
+
+ }, {
+ key: '_hoverConnectedEdges',
+ value: function _hoverConnectedEdges(node) {
+ for (var i = 0; i < node.edges.length; i++) {
+ var edge = node.edges[i];
+ edge.hover = true;
+ this._addToHover(edge);
+ }
+ }
+
+ /**
+ * unselect the edges connected to the node that is being selected
+ *
+ * @param {Node} node
+ * @private
+ */
+
+ }, {
+ key: '_unselectConnectedEdges',
+ value: function _unselectConnectedEdges(node) {
+ for (var i = 0; i < node.edges.length; i++) {
+ var edge = node.edges[i];
+ edge.unselect();
+ this._removeFromSelection(edge);
+ }
+ }
+
+ /**
+ * This is called when someone clicks on a node. either select or deselect it.
+ * If there is an existing selection and we don't want to append to it, clear the existing selection
+ *
+ * @param {Node || Edge} object
+ * @private
+ */
+
+ }, {
+ key: 'blurObject',
+ value: function blurObject(object) {
+ if (object.hover === true) {
+ object.hover = false;
+ if (object instanceof _Node2['default']) {
+ this.body.emitter.emit("blurNode", { node: object.id });
+ } else {
+ this.body.emitter.emit("blurEdge", { edge: object.id });
+ }
+ }
+ }
+
+ /**
+ * This is called when someone clicks on a node. either select or deselect it.
+ * If there is an existing selection and we don't want to append to it, clear the existing selection
+ *
+ * @param {Node || Edge} object
+ * @private
+ */
+
+ }, {
+ key: 'hoverObject',
+ value: function hoverObject(object) {
+ var hoverChanged = false;
+ // remove all node hover highlights
+ for (var nodeId in this.hoverObj.nodes) {
+ if (this.hoverObj.nodes.hasOwnProperty(nodeId)) {
+ if (object === undefined || object instanceof _Node2['default'] && object.id != nodeId || object instanceof _Edge2['default']) {
+ this.blurObject(this.hoverObj.nodes[nodeId]);
+ delete this.hoverObj.nodes[nodeId];
+ hoverChanged = true;
+ }
+ }
+ }
+
+ // removing all edge hover highlights
+ for (var edgeId in this.hoverObj.edges) {
+ if (this.hoverObj.edges.hasOwnProperty(edgeId)) {
+ // if the hover has been changed here it means that the node has been hovered over or off
+ // we then do not use the blurObject method here.
+ if (hoverChanged === true) {
+ this.hoverObj.edges[edgeId].hover = false;
+ delete this.hoverObj.edges[edgeId];
+ }
+ // if the blur remains the same and the object is undefined (mouse off) or another
+ // edge has been hovered, or another node has been hovered we blur the edge.
+ else if (object === undefined || object instanceof _Edge2['default'] && object.id != edgeId || object instanceof _Node2['default'] && !object.hover) {
+ this.blurObject(this.hoverObj.edges[edgeId]);
+ delete this.hoverObj.edges[edgeId];
+ hoverChanged = true;
+ }
+ }
+ }
+
+ if (object !== undefined) {
+ if (object.hover === false) {
+ object.hover = true;
+ this._addToHover(object);
+ hoverChanged = true;
+ if (object instanceof _Node2['default']) {
+ this.body.emitter.emit("hoverNode", { node: object.id });
+ } else {
+ this.body.emitter.emit("hoverEdge", { edge: object.id });
+ }
+ }
+ if (object instanceof _Node2['default'] && this.options.hoverConnectedEdges === true) {
+ this._hoverConnectedEdges(object);
+ }
+ }
+
+ if (hoverChanged === true) {
+ this.body.emitter.emit('_requestRedraw');
+ }
+ }
+
+ /**
+ *
+ * retrieve the currently selected objects
+ * @return {{nodes: Array.<String>, edges: Array.<String>}} selection
+ */
+
+ }, {
+ key: 'getSelection',
+ value: function getSelection() {
+ var nodeIds = this.getSelectedNodes();
+ var edgeIds = this.getSelectedEdges();
+ return { nodes: nodeIds, edges: edgeIds };
+ }
+
+ /**
+ *
+ * retrieve the currently selected nodes
+ * @return {String[]} selection An array with the ids of the
+ * selected nodes.
+ */
+
+ }, {
+ key: 'getSelectedNodes',
+ value: function getSelectedNodes() {
+ var idArray = [];
+ if (this.options.selectable === true) {
+ for (var nodeId in this.selectionObj.nodes) {
+ if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
+ idArray.push(this.selectionObj.nodes[nodeId].id);
+ }
+ }
+ }
+ return idArray;
+ }
+
+ /**
+ *
+ * retrieve the currently selected edges
+ * @return {Array} selection An array with the ids of the
+ * selected nodes.
+ */
+
+ }, {
+ key: 'getSelectedEdges',
+ value: function getSelectedEdges() {
+ var idArray = [];
+ if (this.options.selectable === true) {
+ for (var edgeId in this.selectionObj.edges) {
+ if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
+ idArray.push(this.selectionObj.edges[edgeId].id);
+ }
+ }
+ }
+ return idArray;
+ }
+
+ /**
+ * Updates the current selection
+ * @param {{nodes: Array.<String>, edges: Array.<String>}} Selection
+ * @param {Object} options Options
+ */
+
+ }, {
+ key: 'setSelection',
+ value: function setSelection(selection) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+
+ var i = void 0,
+ id = void 0;
+
+ if (!selection || !selection.nodes && !selection.edges) throw 'Selection must be an object with nodes and/or edges properties';
+ // first unselect any selected node, if option is true or undefined
+ if (options.unselectAll || options.unselectAll === undefined) {
+ this.unselectAll();
+ }
+ if (selection.nodes) {
+ for (i = 0; i < selection.nodes.length; i++) {
+ id = selection.nodes[i];
+
+ var node = this.body.nodes[id];
+ if (!node) {
+ throw new RangeError('Node with id "' + id + '" not found');
+ }
+ // don't select edges with it
+ this.selectObject(node, options.highlightEdges);
+ }
+ }
+
+ if (selection.edges) {
+ for (i = 0; i < selection.edges.length; i++) {
+ id = selection.edges[i];
+
+ var edge = this.body.edges[id];
+ if (!edge) {
+ throw new RangeError('Edge with id "' + id + '" not found');
+ }
+ this.selectObject(edge);
+ }
+ }
+ this.body.emitter.emit('_requestRedraw');
+ }
+
+ /**
+ * select zero or more nodes with the option to highlight edges
+ * @param {Number[] | String[]} selection An array with the ids of the
+ * selected nodes.
+ * @param {boolean} [highlightEdges]
+ */
+
+ }, {
+ key: 'selectNodes',
+ value: function selectNodes(selection) {
+ var highlightEdges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (!selection || selection.length === undefined) throw 'Selection must be an array with ids';
+
+ this.setSelection({ nodes: selection }, { highlightEdges: highlightEdges });
+ }
+
+ /**
+ * select zero or more edges
+ * @param {Number[] | String[]} selection An array with the ids of the
+ * selected nodes.
+ */
+
+ }, {
+ key: 'selectEdges',
+ value: function selectEdges(selection) {
+ if (!selection || selection.length === undefined) throw 'Selection must be an array with ids';
+
+ this.setSelection({ edges: selection });
+ }
+
+ /**
+ * Validate the selection: remove ids of nodes which no longer exist
+ * @private
+ */
+
+ }, {
+ key: 'updateSelection',
+ value: function updateSelection() {
+ for (var nodeId in this.selectionObj.nodes) {
+ if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
+ if (!this.body.nodes.hasOwnProperty(nodeId)) {
+ delete this.selectionObj.nodes[nodeId];
+ }
+ }
+ }
+ for (var edgeId in this.selectionObj.edges) {
+ if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
+ if (!this.body.edges.hasOwnProperty(edgeId)) {
+ delete this.selectionObj.edges[edgeId];
+ }
+ }
+ }
+ }
+ }]);
+ return SelectionHandler;
+ }();
+
+ exports['default'] = SelectionHandler;
+
+/***/ },
+/* 218 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ var _slicedToArray2 = __webpack_require__(161);
+
+ var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _NetworkUtil = __webpack_require__(210);
+
+ var _NetworkUtil2 = _interopRequireDefault(_NetworkUtil);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+
+ var LayoutEngine = function () {
+ function LayoutEngine(body) {
+ (0, _classCallCheck3['default'])(this, LayoutEngine);
+
+ this.body = body;
+
+ this.initialRandomSeed = Math.round(Math.random() * 1000000);
+ this.randomSeed = this.initialRandomSeed;
+ this.setPhysics = false;
+ this.options = {};
+ this.optionsBackup = { physics: {} };
+
+ this.defaultOptions = {
+ randomSeed: undefined,
+ improvedLayout: true,
+ hierarchical: {
+ enabled: false,
+ levelSeparation: 150,
+ nodeSpacing: 100,
+ treeSpacing: 200,
+ blockShifting: true,
+ edgeMinimization: true,
+ parentCentralization: true,
+ direction: 'UD', // UD, DU, LR, RL
+ sortMethod: 'hubsize' // hubsize, directed
+ }
+ };
+ util.extend(this.options, this.defaultOptions);
+ this.bindEventListeners();
+ }
+
+ (0, _createClass3['default'])(LayoutEngine, [{
+ key: 'bindEventListeners',
+ value: function bindEventListeners() {
+ var _this = this;
+
+ this.body.emitter.on('_dataChanged', function () {
+ _this.setupHierarchicalLayout();
+ });
+ this.body.emitter.on('_dataLoaded', function () {
+ _this.layoutNetwork();
+ });
+ this.body.emitter.on('_resetHierarchicalLayout', function () {
+ _this.setupHierarchicalLayout();
+ });
+ }
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options, allOptions) {
+ if (options !== undefined) {
+ var prevHierarchicalState = this.options.hierarchical.enabled;
+ util.selectiveDeepExtend(["randomSeed", "improvedLayout"], this.options, options);
+ util.mergeOptions(this.options, options, 'hierarchical');
+ if (options.randomSeed !== undefined) {
+ this.initialRandomSeed = options.randomSeed;
+ }
+
+ if (this.options.hierarchical.enabled === true) {
+ if (prevHierarchicalState === true) {
+ // refresh the overridden options for nodes and edges.
+ this.body.emitter.emit('refresh', true);
+ }
+
+ // make sure the level separation is the right way up
+ if (this.options.hierarchical.direction === 'RL' || this.options.hierarchical.direction === 'DU') {
+ if (this.options.hierarchical.levelSeparation > 0) {
+ this.options.hierarchical.levelSeparation *= -1;
+ }
+ } else {
+ if (this.options.hierarchical.levelSeparation < 0) {
+ this.options.hierarchical.levelSeparation *= -1;
+ }
+ }
+
+ this.body.emitter.emit('_resetHierarchicalLayout');
+ // because the hierarchical system needs it's own physics and smooth curve settings, we adapt the other options if needed.
+ return this.adaptAllOptionsForHierarchicalLayout(allOptions);
+ } else {
+ if (prevHierarchicalState === true) {
+ // refresh the overridden options for nodes and edges.
+ this.body.emitter.emit('refresh');
+ return util.deepExtend(allOptions, this.optionsBackup);
+ }
+ }
+ }
+ return allOptions;
+ }
+ }, {
+ key: 'adaptAllOptionsForHierarchicalLayout',
+ value: function adaptAllOptionsForHierarchicalLayout(allOptions) {
+ if (this.options.hierarchical.enabled === true) {
+ // set the physics
+ if (allOptions.physics === undefined || allOptions.physics === true) {
+ allOptions.physics = {
+ enabled: this.optionsBackup.physics.enabled === undefined ? true : this.optionsBackup.physics.enabled,
+ solver: 'hierarchicalRepulsion'
+ };
+ this.optionsBackup.physics.enabled = this.optionsBackup.physics.enabled === undefined ? true : this.optionsBackup.physics.enabled;
+ this.optionsBackup.physics.solver = this.optionsBackup.physics.solver || 'barnesHut';
+ } else if ((0, _typeof3['default'])(allOptions.physics) === 'object') {
+ this.optionsBackup.physics.enabled = allOptions.physics.enabled === undefined ? true : allOptions.physics.enabled;
+ this.optionsBackup.physics.solver = allOptions.physics.solver || 'barnesHut';
+ allOptions.physics.solver = 'hierarchicalRepulsion';
+ } else if (allOptions.physics !== false) {
+ this.optionsBackup.physics.solver = 'barnesHut';
+ allOptions.physics = { solver: 'hierarchicalRepulsion' };
+ }
+
+ // get the type of static smooth curve in case it is required
+ var type = 'horizontal';
+ if (this.options.hierarchical.direction === 'RL' || this.options.hierarchical.direction === 'LR') {
+ type = 'vertical';
+ }
+
+ // disable smooth curves if nothing is defined. If smooth curves have been turned on, turn them into static smooth curves.
+ if (allOptions.edges === undefined) {
+ this.optionsBackup.edges = { smooth: { enabled: true, type: 'dynamic' } };
+ allOptions.edges = { smooth: false };
+ } else if (allOptions.edges.smooth === undefined) {
+ this.optionsBackup.edges = { smooth: { enabled: true, type: 'dynamic' } };
+ allOptions.edges.smooth = false;
+ } else {
+ if (typeof allOptions.edges.smooth === 'boolean') {
+ this.optionsBackup.edges = { smooth: allOptions.edges.smooth };
+ allOptions.edges.smooth = { enabled: allOptions.edges.smooth, type: type };
+ } else {
+ // allow custom types except for dynamic
+ if (allOptions.edges.smooth.type !== undefined && allOptions.edges.smooth.type !== 'dynamic') {
+ type = allOptions.edges.smooth.type;
+ }
+
+ this.optionsBackup.edges = {
+ smooth: allOptions.edges.smooth.enabled === undefined ? true : allOptions.edges.smooth.enabled,
+ type: allOptions.edges.smooth.type === undefined ? 'dynamic' : allOptions.edges.smooth.type,
+ roundness: allOptions.edges.smooth.roundness === undefined ? 0.5 : allOptions.edges.smooth.roundness,
+ forceDirection: allOptions.edges.smooth.forceDirection === undefined ? false : allOptions.edges.smooth.forceDirection
+ };
+ allOptions.edges.smooth = {
+ enabled: allOptions.edges.smooth.enabled === undefined ? true : allOptions.edges.smooth.enabled,
+ type: type,
+ roundness: allOptions.edges.smooth.roundness === undefined ? 0.5 : allOptions.edges.smooth.roundness,
+ forceDirection: allOptions.edges.smooth.forceDirection === undefined ? false : allOptions.edges.smooth.forceDirection
+ };
+ }
+ }
+
+ // force all edges into static smooth curves. Only applies to edges that do not use the global options for smooth.
+ this.body.emitter.emit('_forceDisableDynamicCurves', type);
+ }
+
+ return allOptions;
+ }
+ }, {
+ key: 'seededRandom',
+ value: function seededRandom() {
+ var x = Math.sin(this.randomSeed++) * 10000;
+ return x - Math.floor(x);
+ }
+ }, {
+ key: 'positionInitially',
+ value: function positionInitially(nodesArray) {
+ if (this.options.hierarchical.enabled !== true) {
+ this.randomSeed = this.initialRandomSeed;
+ for (var i = 0; i < nodesArray.length; i++) {
+ var node = nodesArray[i];
+ var radius = 10 * 0.1 * nodesArray.length + 10;
+ var angle = 2 * Math.PI * this.seededRandom();
+ if (node.x === undefined) {
+ node.x = radius * Math.cos(angle);
+ }
+ if (node.y === undefined) {
+ node.y = radius * Math.sin(angle);
+ }
+ }
+ }
+ }
+
+ /**
+ * Use Kamada Kawai to position nodes. This is quite a heavy algorithm so if there are a lot of nodes we
+ * cluster them first to reduce the amount.
+ */
+
+ }, {
+ key: 'layoutNetwork',
+ value: function layoutNetwork() {
+ if (this.options.hierarchical.enabled !== true && this.options.improvedLayout === true) {
+ // first check if we should Kamada Kawai to layout. The threshold is if less than half of the visible
+ // nodes have predefined positions we use this.
+ var positionDefined = 0;
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ var node = this.body.nodes[this.body.nodeIndices[i]];
+ if (node.predefinedPosition === true) {
+ positionDefined += 1;
+ }
+ }
+
+ // if less than half of the nodes have a predefined position we continue
+ if (positionDefined < 0.5 * this.body.nodeIndices.length) {
+ var MAX_LEVELS = 10;
+ var level = 0;
+ var clusterThreshold = 100;
+ // if there are a lot of nodes, we cluster before we run the algorithm.
+ if (this.body.nodeIndices.length > clusterThreshold) {
+ var startLength = this.body.nodeIndices.length;
+ while (this.body.nodeIndices.length > clusterThreshold) {
+ //console.time("clustering")
+ level += 1;
+ var before = this.body.nodeIndices.length;
+ // if there are many nodes we do a hubsize cluster
+ if (level % 3 === 0) {
+ this.body.modules.clustering.clusterBridges();
+ } else {
+ this.body.modules.clustering.clusterOutliers();
+ }
+ var after = this.body.nodeIndices.length;
+ if (before == after && level % 3 !== 0 || level > MAX_LEVELS) {
+ this._declusterAll();
+ this.body.emitter.emit("_layoutFailed");
+ console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");
+ return;
+ }
+ //console.timeEnd("clustering")
+ //console.log(level,after)
+ }
+ // increase the size of the edges
+ this.body.modules.kamadaKawai.setOptions({ springLength: Math.max(150, 2 * startLength) });
+ }
+
+ // position the system for these nodes and edges
+ this.body.modules.kamadaKawai.solve(this.body.nodeIndices, this.body.edgeIndices, true);
+
+ // shift to center point
+ this._shiftToCenter();
+
+ // perturb the nodes a little bit to force the physics to kick in
+ var offset = 70;
+ for (var _i = 0; _i < this.body.nodeIndices.length; _i++) {
+ // Only perturb the nodes that aren't fixed
+ if (this.body.nodes[this.body.nodeIndices[_i]].predefinedPosition === false) {
+ this.body.nodes[this.body.nodeIndices[_i]].x += (0.5 - this.seededRandom()) * offset;
+ this.body.nodes[this.body.nodeIndices[_i]].y += (0.5 - this.seededRandom()) * offset;
+ }
+ }
+
+ // uncluster all clusters
+ this._declusterAll();
+
+ // reposition all bezier nodes.
+ this.body.emitter.emit("_repositionBezierNodes");
+ }
+ }
+ }
+
+ /**
+ * Move all the nodes towards to the center so gravitational pull wil not move the nodes away from view
+ * @private
+ */
+
+ }, {
+ key: '_shiftToCenter',
+ value: function _shiftToCenter() {
+ var range = _NetworkUtil2['default'].getRangeCore(this.body.nodes, this.body.nodeIndices);
+ var center = _NetworkUtil2['default'].findCenter(range);
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ this.body.nodes[this.body.nodeIndices[i]].x -= center.x;
+ this.body.nodes[this.body.nodeIndices[i]].y -= center.y;
+ }
+ }
+ }, {
+ key: '_declusterAll',
+ value: function _declusterAll() {
+ var clustersPresent = true;
+ while (clustersPresent === true) {
+ clustersPresent = false;
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ if (this.body.nodes[this.body.nodeIndices[i]].isCluster === true) {
+ clustersPresent = true;
+ this.body.modules.clustering.openCluster(this.body.nodeIndices[i], {}, false);
+ }
+ }
+ if (clustersPresent === true) {
+ this.body.emitter.emit('_dataChanged');
+ }
+ }
+ }
+ }, {
+ key: 'getSeed',
+ value: function getSeed() {
+ return this.initialRandomSeed;
+ }
+
+ /**
+ * This is the main function to layout the nodes in a hierarchical way.
+ * It checks if the node details are supplied correctly
+ *
+ * @private
+ */
+
+ }, {
+ key: 'setupHierarchicalLayout',
+ value: function setupHierarchicalLayout() {
+ if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) {
+ // get the size of the largest hubs and check if the user has defined a level for a node.
+ var node = void 0,
+ nodeId = void 0;
+ var definedLevel = false;
+ var definedPositions = true;
+ var undefinedLevel = false;
+ this.hierarchicalLevels = {};
+ this.lastNodeOnLevel = {};
+ this.hierarchicalChildrenReference = {};
+ this.hierarchicalParentReference = {};
+ this.hierarchicalTrees = {};
+ this.treeIndex = -1;
+
+ this.distributionOrdering = {};
+ this.distributionIndex = {};
+ this.distributionOrderingPresence = {};
+
+ for (nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(nodeId)) {
+ node = this.body.nodes[nodeId];
+ if (node.options.x === undefined && node.options.y === undefined) {
+ definedPositions = false;
+ }
+ if (node.options.level !== undefined) {
+ definedLevel = true;
+ this.hierarchicalLevels[nodeId] = node.options.level;
+ } else {
+ undefinedLevel = true;
+ }
+ }
+ }
+
+ // if the user defined some levels but not all, alert and run without hierarchical layout
+ if (undefinedLevel === true && definedLevel === true) {
+ throw new Error('To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.');
+ return;
+ } else {
+ // define levels if undefined by the users. Based on hubsize.
+ if (undefinedLevel === true) {
+ if (this.options.hierarchical.sortMethod === 'hubsize') {
+ this._determineLevelsByHubsize();
+ } else if (this.options.hierarchical.sortMethod === 'directed') {
+ this._determineLevelsDirected();
+ } else if (this.options.hierarchical.sortMethod === 'custom') {
+ this._determineLevelsCustomCallback();
+ }
+ }
+
+ // fallback for cases where there are nodes but no edges
+ for (var _nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(_nodeId)) {
+ if (this.hierarchicalLevels[_nodeId] === undefined) {
+ this.hierarchicalLevels[_nodeId] = 0;
+ }
+ }
+ }
+ // check the distribution of the nodes per level.
+ var distribution = this._getDistribution();
+
+ // get the parent children relations.
+ this._generateMap();
+
+ // place the nodes on the canvas.
+ this._placeNodesByHierarchy(distribution);
+
+ // condense the whitespace.
+ this._condenseHierarchy();
+
+ // shift to center so gravity does not have to do much
+ this._shiftToCenter();
+ }
+ }
+ }
+
+ /**
+ * @private
+ */
+
+ }, {
+ key: '_condenseHierarchy',
+ value: function _condenseHierarchy() {
+ var _this2 = this;
+
+ // Global var in this scope to define when the movement has stopped.
+ var stillShifting = false;
+ var branches = {};
+ // first we have some methods to help shifting trees around.
+ // the main method to shift the trees
+ var shiftTrees = function shiftTrees() {
+ var treeSizes = getTreeSizes();
+ var shiftBy = 0;
+ for (var i = 0; i < treeSizes.length - 1; i++) {
+ var diff = treeSizes[i].max - treeSizes[i + 1].min;
+ shiftBy += diff + _this2.options.hierarchical.treeSpacing;
+ shiftTree(i + 1, shiftBy);
+ }
+ };
+
+ // shift a single tree by an offset
+ var shiftTree = function shiftTree(index, offset) {
+ for (var nodeId in _this2.hierarchicalTrees) {
+ if (_this2.hierarchicalTrees.hasOwnProperty(nodeId)) {
+ if (_this2.hierarchicalTrees[nodeId] === index) {
+ var node = _this2.body.nodes[nodeId];
+ var pos = _this2._getPositionForHierarchy(node);
+ _this2._setPositionForHierarchy(node, pos + offset, undefined, true);
+ }
+ }
+ }
+ };
+
+ // get the width of a tree
+ var getTreeSize = function getTreeSize(index) {
+ var min = 1e9;
+ var max = -1e9;
+ for (var nodeId in _this2.hierarchicalTrees) {
+ if (_this2.hierarchicalTrees.hasOwnProperty(nodeId)) {
+ if (_this2.hierarchicalTrees[nodeId] === index) {
+ var pos = _this2._getPositionForHierarchy(_this2.body.nodes[nodeId]);
+ min = Math.min(pos, min);
+ max = Math.max(pos, max);
+ }
+ }
+ }
+ return { min: min, max: max };
+ };
+
+ // get the width of all trees
+ var getTreeSizes = function getTreeSizes() {
+ var treeWidths = [];
+ for (var i = 0; i <= _this2.treeIndex; i++) {
+ treeWidths.push(getTreeSize(i));
+ }
+ return treeWidths;
+ };
+
+ // get a map of all nodes in this branch
+ var getBranchNodes = function getBranchNodes(source, map) {
+ map[source.id] = true;
+ if (_this2.hierarchicalChildrenReference[source.id]) {
+ var children = _this2.hierarchicalChildrenReference[source.id];
+ if (children.length > 0) {
+ for (var i = 0; i < children.length; i++) {
+ getBranchNodes(_this2.body.nodes[children[i]], map);
+ }
+ }
+ }
+ };
+
+ // get a min max width as well as the maximum movement space it has on either sides
+ // we use min max terminology because width and height can interchange depending on the direction of the layout
+ var getBranchBoundary = function getBranchBoundary(branchMap) {
+ var maxLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1e9;
+
+ var minSpace = 1e9;
+ var maxSpace = 1e9;
+ var min = 1e9;
+ var max = -1e9;
+ for (var branchNode in branchMap) {
+ if (branchMap.hasOwnProperty(branchNode)) {
+ var node = _this2.body.nodes[branchNode];
+ var level = _this2.hierarchicalLevels[node.id];
+ var position = _this2._getPositionForHierarchy(node);
+
+ // get the space around the node.
+
+ var _getSpaceAroundNode2 = _this2._getSpaceAroundNode(node, branchMap),
+ _getSpaceAroundNode3 = (0, _slicedToArray3['default'])(_getSpaceAroundNode2, 2),
+ minSpaceNode = _getSpaceAroundNode3[0],
+ maxSpaceNode = _getSpaceAroundNode3[1];
+
+ minSpace = Math.min(minSpaceNode, minSpace);
+ maxSpace = Math.min(maxSpaceNode, maxSpace);
+
+ // the width is only relevant for the levels two nodes have in common. This is why we filter on this.
+ if (level <= maxLevel) {
+ min = Math.min(position, min);
+ max = Math.max(position, max);
+ }
+ }
+ }
+
+ return [min, max, minSpace, maxSpace];
+ };
+
+ // get the maximum level of a branch.
+ var getMaxLevel = function getMaxLevel(nodeId) {
+ var level = _this2.hierarchicalLevels[nodeId];
+ if (_this2.hierarchicalChildrenReference[nodeId]) {
+ var children = _this2.hierarchicalChildrenReference[nodeId];
+ if (children.length > 0) {
+ for (var i = 0; i < children.length; i++) {
+ level = Math.max(level, getMaxLevel(children[i]));
+ }
+ }
+ }
+ return level;
+ };
+
+ // check what the maximum level is these nodes have in common.
+ var getCollisionLevel = function getCollisionLevel(node1, node2) {
+ var maxLevel1 = getMaxLevel(node1.id);
+ var maxLevel2 = getMaxLevel(node2.id);
+ return Math.min(maxLevel1, maxLevel2);
+ };
+
+ // check if two nodes have the same parent(s)
+ var hasSameParent = function hasSameParent(node1, node2) {
+ var parents1 = _this2.hierarchicalParentReference[node1.id];
+ var parents2 = _this2.hierarchicalParentReference[node2.id];
+ if (parents1 === undefined || parents2 === undefined) {
+ return false;
+ }
+
+ for (var i = 0; i < parents1.length; i++) {
+ for (var j = 0; j < parents2.length; j++) {
+ if (parents1[i] == parents2[j]) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ // condense elements. These can be nodes or branches depending on the callback.
+ var shiftElementsCloser = function shiftElementsCloser(callback, levels, centerParents) {
+ for (var i = 0; i < levels.length; i++) {
+ var level = levels[i];
+ var levelNodes = _this2.distributionOrdering[level];
+ if (levelNodes.length > 1) {
+ for (var j = 0; j < levelNodes.length - 1; j++) {
+ if (hasSameParent(levelNodes[j], levelNodes[j + 1]) === true) {
+ if (_this2.hierarchicalTrees[levelNodes[j].id] === _this2.hierarchicalTrees[levelNodes[j + 1].id]) {
+ callback(levelNodes[j], levelNodes[j + 1], centerParents);
+ }
+ }
+ }
+ }
+ }
+ };
+
+ // callback for shifting branches
+ var branchShiftCallback = function branchShiftCallback(node1, node2) {
+ var centerParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ //window.CALLBACKS.push(() => {
+ var pos1 = _this2._getPositionForHierarchy(node1);
+ var pos2 = _this2._getPositionForHierarchy(node2);
+ var diffAbs = Math.abs(pos2 - pos1);
+ //console.log("NOW CHEcKING:", node1.id, node2.id, diffAbs);
+ if (diffAbs > _this2.options.hierarchical.nodeSpacing) {
+ var branchNodes1 = {};branchNodes1[node1.id] = true;
+ var branchNodes2 = {};branchNodes2[node2.id] = true;
+
+ getBranchNodes(node1, branchNodes1);
+ getBranchNodes(node2, branchNodes2);
+
+ // check the largest distance between the branches
+ var maxLevel = getCollisionLevel(node1, node2);
+
+ var _getBranchBoundary = getBranchBoundary(branchNodes1, maxLevel),
+ _getBranchBoundary2 = (0, _slicedToArray3['default'])(_getBranchBoundary, 4),
+ min1 = _getBranchBoundary2[0],
+ max1 = _getBranchBoundary2[1],
+ minSpace1 = _getBranchBoundary2[2],
+ maxSpace1 = _getBranchBoundary2[3];
+
+ var _getBranchBoundary3 = getBranchBoundary(branchNodes2, maxLevel),
+ _getBranchBoundary4 = (0, _slicedToArray3['default'])(_getBranchBoundary3, 4),
+ min2 = _getBranchBoundary4[0],
+ max2 = _getBranchBoundary4[1],
+ minSpace2 = _getBranchBoundary4[2],
+ maxSpace2 = _getBranchBoundary4[3];
+
+ //console.log(node1.id, getBranchBoundary(branchNodes1, maxLevel), node2.id, getBranchBoundary(branchNodes2, maxLevel), maxLevel);
+
+
+ var diffBranch = Math.abs(max1 - min2);
+ if (diffBranch > _this2.options.hierarchical.nodeSpacing) {
+ var offset = max1 - min2 + _this2.options.hierarchical.nodeSpacing;
+ if (offset < -minSpace2 + _this2.options.hierarchical.nodeSpacing) {
+ offset = -minSpace2 + _this2.options.hierarchical.nodeSpacing;
+ //console.log("RESETTING OFFSET", max1 - min2 + this.options.hierarchical.nodeSpacing, -minSpace2, offset);
+ }
+ if (offset < 0) {
+ //console.log("SHIFTING", node2.id, offset);
+ _this2._shiftBlock(node2.id, offset);
+ stillShifting = true;
+
+ if (centerParent === true) _this2._centerParent(node2);
+ }
+ }
+ }
+ //this.body.emitter.emit("_redraw");})
+ };
+
+ var minimizeEdgeLength = function minimizeEdgeLength(iterations, node) {
+ //window.CALLBACKS.push(() => {
+ // console.log("ts",node.id);
+ var nodeId = node.id;
+ var allEdges = node.edges;
+ var nodeLevel = _this2.hierarchicalLevels[node.id];
+
+ // gather constants
+ var C2 = _this2.options.hierarchical.levelSeparation * _this2.options.hierarchical.levelSeparation;
+ var referenceNodes = {};
+ var aboveEdges = [];
+ for (var i = 0; i < allEdges.length; i++) {
+ var edge = allEdges[i];
+ if (edge.toId != edge.fromId) {
+ var otherNode = edge.toId == nodeId ? edge.from : edge.to;
+ referenceNodes[allEdges[i].id] = otherNode;
+ if (_this2.hierarchicalLevels[otherNode.id] < nodeLevel) {
+ aboveEdges.push(edge);
+ }
+ }
+ }
+
+ // differentiated sum of lengths based on only moving one node over one axis
+ var getFx = function getFx(point, edges) {
+ var sum = 0;
+ for (var _i2 = 0; _i2 < edges.length; _i2++) {
+ if (referenceNodes[edges[_i2].id] !== undefined) {
+ var a = _this2._getPositionForHierarchy(referenceNodes[edges[_i2].id]) - point;
+ sum += a / Math.sqrt(a * a + C2);
+ }
+ }
+ return sum;
+ };
+
+ // doubly differentiated sum of lengths based on only moving one node over one axis
+ var getDFx = function getDFx(point, edges) {
+ var sum = 0;
+ for (var _i3 = 0; _i3 < edges.length; _i3++) {
+ if (referenceNodes[edges[_i3].id] !== undefined) {
+ var a = _this2._getPositionForHierarchy(referenceNodes[edges[_i3].id]) - point;
+ sum -= C2 * Math.pow(a * a + C2, -1.5);
+ }
+ }
+ return sum;
+ };
+
+ var getGuess = function getGuess(iterations, edges) {
+ var guess = _this2._getPositionForHierarchy(node);
+ // Newton's method for optimization
+ var guessMap = {};
+ for (var _i4 = 0; _i4 < iterations; _i4++) {
+ var fx = getFx(guess, edges);
+ var dfx = getDFx(guess, edges);
+
+ // we limit the movement to avoid instability.
+ var limit = 40;
+ var ratio = Math.max(-limit, Math.min(limit, Math.round(fx / dfx)));
+ guess = guess - ratio;
+ // reduce duplicates
+ if (guessMap[guess] !== undefined) {
+ break;
+ }
+ guessMap[guess] = _i4;
+ }
+ return guess;
+ };
+
+ var moveBranch = function moveBranch(guess) {
+ // position node if there is space
+ var nodePosition = _this2._getPositionForHierarchy(node);
+
+ // check movable area of the branch
+ if (branches[node.id] === undefined) {
+ var branchNodes = {};
+ branchNodes[node.id] = true;
+ getBranchNodes(node, branchNodes);
+ branches[node.id] = branchNodes;
+ }
+
+ var _getBranchBoundary5 = getBranchBoundary(branches[node.id]),
+ _getBranchBoundary6 = (0, _slicedToArray3['default'])(_getBranchBoundary5, 4),
+ minBranch = _getBranchBoundary6[0],
+ maxBranch = _getBranchBoundary6[1],
+ minSpaceBranch = _getBranchBoundary6[2],
+ maxSpaceBranch = _getBranchBoundary6[3];
+
+ var diff = guess - nodePosition;
+
+ // check if we are allowed to move the node:
+ var branchOffset = 0;
+ if (diff > 0) {
+ branchOffset = Math.min(diff, maxSpaceBranch - _this2.options.hierarchical.nodeSpacing);
+ } else if (diff < 0) {
+ branchOffset = -Math.min(-diff, minSpaceBranch - _this2.options.hierarchical.nodeSpacing);
+ }
+
+ if (branchOffset != 0) {
+ //console.log("moving branch:",branchOffset, maxSpaceBranch, minSpaceBranch)
+ _this2._shiftBlock(node.id, branchOffset);
+ //this.body.emitter.emit("_redraw");
+ stillShifting = true;
+ }
+ };
+
+ var moveNode = function moveNode(guess) {
+ var nodePosition = _this2._getPositionForHierarchy(node);
+
+ // position node if there is space
+
+ var _getSpaceAroundNode4 = _this2._getSpaceAroundNode(node),
+ _getSpaceAroundNode5 = (0, _slicedToArray3['default'])(_getSpaceAroundNode4, 2),
+ minSpace = _getSpaceAroundNode5[0],
+ maxSpace = _getSpaceAroundNode5[1];
+
+ var diff = guess - nodePosition;
+ // check if we are allowed to move the node:
+ var newPosition = nodePosition;
+ if (diff > 0) {
+ newPosition = Math.min(nodePosition + (maxSpace - _this2.options.hierarchical.nodeSpacing), guess);
+ } else if (diff < 0) {
+ newPosition = Math.max(nodePosition - (minSpace - _this2.options.hierarchical.nodeSpacing), guess);
+ }
+
+ if (newPosition !== nodePosition) {
+ //console.log("moving Node:",diff, minSpace, maxSpace);
+ _this2._setPositionForHierarchy(node, newPosition, undefined, true);
+ //this.body.emitter.emit("_redraw");
+ stillShifting = true;
+ }
+ };
+
+ var guess = getGuess(iterations, aboveEdges);
+ moveBranch(guess);
+ guess = getGuess(iterations, allEdges);
+ moveNode(guess);
+ //})
+ };
+
+ // method to remove whitespace between branches. Because we do bottom up, we can center the parents.
+ var minimizeEdgeLengthBottomUp = function minimizeEdgeLengthBottomUp(iterations) {
+ var levels = (0, _keys2['default'])(_this2.distributionOrdering);
+ levels = levels.reverse();
+ for (var i = 0; i < iterations; i++) {
+ stillShifting = false;
+ for (var j = 0; j < levels.length; j++) {
+ var level = levels[j];
+ var levelNodes = _this2.distributionOrdering[level];
+ for (var k = 0; k < levelNodes.length; k++) {
+ minimizeEdgeLength(1000, levelNodes[k]);
+ }
+ }
+ if (stillShifting !== true) {
+ //console.log("FINISHED minimizeEdgeLengthBottomUp IN " + i);
+ break;
+ }
+ }
+ };
+
+ // method to remove whitespace between branches. Because we do bottom up, we can center the parents.
+ var shiftBranchesCloserBottomUp = function shiftBranchesCloserBottomUp(iterations) {
+ var levels = (0, _keys2['default'])(_this2.distributionOrdering);
+ levels = levels.reverse();
+ for (var i = 0; i < iterations; i++) {
+ stillShifting = false;
+ shiftElementsCloser(branchShiftCallback, levels, true);
+ if (stillShifting !== true) {
+ //console.log("FINISHED shiftBranchesCloserBottomUp IN " + (i+1));
+ break;
+ }
+ }
+ };
+
+ // center all parents
+ var centerAllParents = function centerAllParents() {
+ for (var nodeId in _this2.body.nodes) {
+ if (_this2.body.nodes.hasOwnProperty(nodeId)) _this2._centerParent(_this2.body.nodes[nodeId]);
+ }
+ };
+
+ // center all parents
+ var centerAllParentsBottomUp = function centerAllParentsBottomUp() {
+ var levels = (0, _keys2['default'])(_this2.distributionOrdering);
+ levels = levels.reverse();
+ for (var i = 0; i < levels.length; i++) {
+ var level = levels[i];
+ var levelNodes = _this2.distributionOrdering[level];
+ for (var j = 0; j < levelNodes.length; j++) {
+ _this2._centerParent(levelNodes[j]);
+ }
+ }
+ };
+
+ // the actual work is done here.
+ if (this.options.hierarchical.blockShifting === true) {
+ shiftBranchesCloserBottomUp(5);
+ centerAllParents();
+ }
+
+ // minimize edge length
+ if (this.options.hierarchical.edgeMinimization === true) {
+ minimizeEdgeLengthBottomUp(20);
+ }
+
+ if (this.options.hierarchical.parentCentralization === true) {
+ centerAllParentsBottomUp();
+ }
+
+ shiftTrees();
+ }
+
+ /**
+ * This gives the space around the node. IF a map is supplied, it will only check against nodes NOT in the map.
+ * This is used to only get the distances to nodes outside of a branch.
+ * @param node
+ * @param map
+ * @returns {*[]}
+ * @private
+ */
+
+ }, {
+ key: '_getSpaceAroundNode',
+ value: function _getSpaceAroundNode(node, map) {
+ var useMap = true;
+ if (map === undefined) {
+ useMap = false;
+ }
+ var level = this.hierarchicalLevels[node.id];
+ if (level !== undefined) {
+ var index = this.distributionIndex[node.id];
+ var position = this._getPositionForHierarchy(node);
+ var minSpace = 1e9;
+ var maxSpace = 1e9;
+ if (index !== 0) {
+ var prevNode = this.distributionOrdering[level][index - 1];
+ if (useMap === true && map[prevNode.id] === undefined || useMap === false) {
+ var prevPos = this._getPositionForHierarchy(prevNode);
+ minSpace = position - prevPos;
+ }
+ }
+
+ if (index != this.distributionOrdering[level].length - 1) {
+ var nextNode = this.distributionOrdering[level][index + 1];
+ if (useMap === true && map[nextNode.id] === undefined || useMap === false) {
+ var nextPos = this._getPositionForHierarchy(nextNode);
+ maxSpace = Math.min(maxSpace, nextPos - position);
+ }
+ }
+
+ return [minSpace, maxSpace];
+ } else {
+ return [0, 0];
+ }
+ }
+
+ /**
+ * We use this method to center a parent node and check if it does not cross other nodes when it does.
+ * @param node
+ * @private
+ */
+
+ }, {
+ key: '_centerParent',
+ value: function _centerParent(node) {
+ if (this.hierarchicalParentReference[node.id]) {
+ var parents = this.hierarchicalParentReference[node.id];
+ for (var i = 0; i < parents.length; i++) {
+ var parentId = parents[i];
+ var parentNode = this.body.nodes[parentId];
+ if (this.hierarchicalChildrenReference[parentId]) {
+ // get the range of the children
+ var minPos = 1e9;
+ var maxPos = -1e9;
+ var children = this.hierarchicalChildrenReference[parentId];
+ if (children.length > 0) {
+ for (var _i5 = 0; _i5 < children.length; _i5++) {
+ var childNode = this.body.nodes[children[_i5]];
+ minPos = Math.min(minPos, this._getPositionForHierarchy(childNode));
+ maxPos = Math.max(maxPos, this._getPositionForHierarchy(childNode));
+ }
+ }
+
+ var position = this._getPositionForHierarchy(parentNode);
+
+ var _getSpaceAroundNode6 = this._getSpaceAroundNode(parentNode),
+ _getSpaceAroundNode7 = (0, _slicedToArray3['default'])(_getSpaceAroundNode6, 2),
+ minSpace = _getSpaceAroundNode7[0],
+ maxSpace = _getSpaceAroundNode7[1];
+
+ var newPosition = 0.5 * (minPos + maxPos);
+ var diff = position - newPosition;
+ if (diff < 0 && Math.abs(diff) < maxSpace - this.options.hierarchical.nodeSpacing || diff > 0 && Math.abs(diff) < minSpace - this.options.hierarchical.nodeSpacing) {
+ this._setPositionForHierarchy(parentNode, newPosition, undefined, true);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This function places the nodes on the canvas based on the hierarchial distribution.
+ *
+ * @param {Object} distribution | obtained by the function this._getDistribution()
+ * @private
+ */
+
+ }, {
+ key: '_placeNodesByHierarchy',
+ value: function _placeNodesByHierarchy(distribution) {
+ this.positionedNodes = {};
+ // start placing all the level 0 nodes first. Then recursively position their branches.
+ for (var level in distribution) {
+ if (distribution.hasOwnProperty(level)) {
+ // sort nodes in level by position:
+ var nodeArray = (0, _keys2['default'])(distribution[level]);
+ nodeArray = this._indexArrayToNodes(nodeArray);
+ this._sortNodeArray(nodeArray);
+ var handledNodeCount = 0;
+
+ for (var i = 0; i < nodeArray.length; i++) {
+ var node = nodeArray[i];
+ if (this.positionedNodes[node.id] === undefined) {
+ var pos = this.options.hierarchical.nodeSpacing * handledNodeCount;
+ // we get the X or Y values we need and store them in pos and previousPos. The get and set make sure we get X or Y
+ if (handledNodeCount > 0) {
+ pos = this._getPositionForHierarchy(nodeArray[i - 1]) + this.options.hierarchical.nodeSpacing;
+ }
+ this._setPositionForHierarchy(node, pos, level);
+ this._validataPositionAndContinue(node, level, pos);
+
+ handledNodeCount++;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes
+ * on a X position that ensures there will be no overlap.
+ *
+ * @param parentId
+ * @param parentLevel
+ * @private
+ */
+
+ }, {
+ key: '_placeBranchNodes',
+ value: function _placeBranchNodes(parentId, parentLevel) {
+ // if this is not a parent, cancel the placing. This can happen with multiple parents to one child.
+ if (this.hierarchicalChildrenReference[parentId] === undefined) {
+ return;
+ }
+
+ // get a list of childNodes
+ var childNodes = [];
+ for (var i = 0; i < this.hierarchicalChildrenReference[parentId].length; i++) {
+ childNodes.push(this.body.nodes[this.hierarchicalChildrenReference[parentId][i]]);
+ }
+
+ // use the positions to order the nodes.
+ this._sortNodeArray(childNodes);
+
+ // position the childNodes
+ for (var _i6 = 0; _i6 < childNodes.length; _i6++) {
+ var childNode = childNodes[_i6];
+ var childNodeLevel = this.hierarchicalLevels[childNode.id];
+ // check if the child node is below the parent node and if it has already been positioned.
+ if (childNodeLevel > parentLevel && this.positionedNodes[childNode.id] === undefined) {
+ // get the amount of space required for this node. If parent the width is based on the amount of children.
+ var pos = void 0;
+
+ // we get the X or Y values we need and store them in pos and previousPos. The get and set make sure we get X or Y
+ if (_i6 === 0) {
+ pos = this._getPositionForHierarchy(this.body.nodes[parentId]);
+ } else {
+ pos = this._getPositionForHierarchy(childNodes[_i6 - 1]) + this.options.hierarchical.nodeSpacing;
+ }
+ this._setPositionForHierarchy(childNode, pos, childNodeLevel);
+ this._validataPositionAndContinue(childNode, childNodeLevel, pos);
+ } else {
+ return;
+ }
+ }
+
+ // center the parent nodes.
+ var minPos = 1e9;
+ var maxPos = -1e9;
+ for (var _i7 = 0; _i7 < childNodes.length; _i7++) {
+ var childNodeId = childNodes[_i7].id;
+ minPos = Math.min(minPos, this._getPositionForHierarchy(this.body.nodes[childNodeId]));
+ maxPos = Math.max(maxPos, this._getPositionForHierarchy(this.body.nodes[childNodeId]));
+ }
+ this._setPositionForHierarchy(this.body.nodes[parentId], 0.5 * (minPos + maxPos), parentLevel);
+ }
+
+ /**
+ * This method checks for overlap and if required shifts the branch. It also keeps records of positioned nodes.
+ * Finally it will call _placeBranchNodes to place the branch nodes.
+ * @param node
+ * @param level
+ * @param pos
+ * @private
+ */
+
+ }, {
+ key: '_validataPositionAndContinue',
+ value: function _validataPositionAndContinue(node, level, pos) {
+ // if overlap has been detected, we shift the branch
+ if (this.lastNodeOnLevel[level] !== undefined) {
+ var previousPos = this._getPositionForHierarchy(this.body.nodes[this.lastNodeOnLevel[level]]);
+ if (pos - previousPos < this.options.hierarchical.nodeSpacing) {
+ var diff = previousPos + this.options.hierarchical.nodeSpacing - pos;
+ var sharedParent = this._findCommonParent(this.lastNodeOnLevel[level], node.id);
+ this._shiftBlock(sharedParent.withChild, diff);
+ }
+ }
+
+ // store change in position.
+ this.lastNodeOnLevel[level] = node.id;
+
+ this.positionedNodes[node.id] = true;
+
+ this._placeBranchNodes(node.id, level);
+ }
+
+ /**
+ * Receives an array with node indices and returns an array with the actual node references. Used for sorting based on
+ * node properties.
+ * @param idArray
+ */
+
+ }, {
+ key: '_indexArrayToNodes',
+ value: function _indexArrayToNodes(idArray) {
+ var array = [];
+ for (var i = 0; i < idArray.length; i++) {
+ array.push(this.body.nodes[idArray[i]]);
+ }
+ return array;
+ }
+
+ /**
+ * This function get the distribution of levels based on hubsize
+ *
+ * @returns {Object}
+ * @private
+ */
+
+ }, {
+ key: '_getDistribution',
+ value: function _getDistribution() {
+ var distribution = {};
+ var nodeId = void 0,
+ node = void 0;
+
+ // we fix Y because the hierarchy is vertical, we fix X so we do not give a node an x position for a second time.
+ // the fix of X is removed after the x value has been set.
+ for (nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(nodeId)) {
+ node = this.body.nodes[nodeId];
+ var level = this.hierarchicalLevels[nodeId] === undefined ? 0 : this.hierarchicalLevels[nodeId];
+ if (this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU') {
+ node.y = this.options.hierarchical.levelSeparation * level;
+ node.options.fixed.y = true;
+ } else {
+ node.x = this.options.hierarchical.levelSeparation * level;
+ node.options.fixed.x = true;
+ }
+ if (distribution[level] === undefined) {
+ distribution[level] = {};
+ }
+ distribution[level][nodeId] = node;
+ }
+ }
+ return distribution;
+ }
+
+ /**
+ * Get the hubsize from all remaining unlevelled nodes.
+ *
+ * @returns {number}
+ * @private
+ */
+
+ }, {
+ key: '_getHubSize',
+ value: function _getHubSize() {
+ var hubSize = 0;
+ for (var nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(nodeId)) {
+ var node = this.body.nodes[nodeId];
+ if (this.hierarchicalLevels[nodeId] === undefined) {
+ hubSize = node.edges.length < hubSize ? hubSize : node.edges.length;
+ }
+ }
+ }
+ return hubSize;
+ }
+
+ /**
+ * this function allocates nodes in levels based on the recursive branching from the largest hubs.
+ *
+ * @param hubsize
+ * @private
+ */
+
+ }, {
+ key: '_determineLevelsByHubsize',
+ value: function _determineLevelsByHubsize() {
+ var _this3 = this;
+
+ var hubSize = 1;
+
+ var levelDownstream = function levelDownstream(nodeA, nodeB) {
+ if (_this3.hierarchicalLevels[nodeB.id] === undefined) {
+ // set initial level
+ if (_this3.hierarchicalLevels[nodeA.id] === undefined) {
+ _this3.hierarchicalLevels[nodeA.id] = 0;
+ }
+ // set level
+ _this3.hierarchicalLevels[nodeB.id] = _this3.hierarchicalLevels[nodeA.id] + 1;
+ }
+ };
+
+ while (hubSize > 0) {
+ // determine hubs
+ hubSize = this._getHubSize();
+ if (hubSize === 0) break;
+
+ for (var nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(nodeId)) {
+ var node = this.body.nodes[nodeId];
+ if (node.edges.length === hubSize) {
+ this._crawlNetwork(levelDownstream, nodeId);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * TODO: release feature
+ * @private
+ */
+
+ }, {
+ key: '_determineLevelsCustomCallback',
+ value: function _determineLevelsCustomCallback() {
+ var _this4 = this;
+
+ var minLevel = 100000;
+
+ // TODO: this should come from options.
+ var customCallback = function customCallback(nodeA, nodeB, edge) {};
+
+ var levelByDirection = function levelByDirection(nodeA, nodeB, edge) {
+ var levelA = _this4.hierarchicalLevels[nodeA.id];
+ // set initial level
+ if (levelA === undefined) {
+ _this4.hierarchicalLevels[nodeA.id] = minLevel;
+ }
+
+ var diff = customCallback(_NetworkUtil2['default'].cloneOptions(nodeA, 'node'), _NetworkUtil2['default'].cloneOptions(nodeB, 'node'), _NetworkUtil2['default'].cloneOptions(edge, 'edge'));
+
+ _this4.hierarchicalLevels[nodeB.id] = _this4.hierarchicalLevels[nodeA.id] + diff;
+ };
+
+ this._crawlNetwork(levelByDirection);
+ this._setMinLevelToZero();
+ }
+
+ /**
+ * this function allocates nodes in levels based on the direction of the edges
+ *
+ * @param hubsize
+ * @private
+ */
+
+ }, {
+ key: '_determineLevelsDirected',
+ value: function _determineLevelsDirected() {
+ var _this5 = this;
+
+ var minLevel = 10000;
+ var levelByDirection = function levelByDirection(nodeA, nodeB, edge) {
+ var levelA = _this5.hierarchicalLevels[nodeA.id];
+ // set initial level
+ if (levelA === undefined) {
+ _this5.hierarchicalLevels[nodeA.id] = minLevel;
+ }
+ if (edge.toId == nodeB.id) {
+ _this5.hierarchicalLevels[nodeB.id] = _this5.hierarchicalLevels[nodeA.id] + 1;
+ } else {
+ _this5.hierarchicalLevels[nodeB.id] = _this5.hierarchicalLevels[nodeA.id] - 1;
+ }
+ };
+ this._crawlNetwork(levelByDirection);
+ this._setMinLevelToZero();
+ }
+
+ /**
+ * Small util method to set the minimum levels of the nodes to zero.
+ * @private
+ */
+
+ }, {
+ key: '_setMinLevelToZero',
+ value: function _setMinLevelToZero() {
+ var minLevel = 1e9;
+ // get the minimum level
+ for (var nodeId in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(nodeId)) {
+ if (this.hierarchicalLevels[nodeId] !== undefined) {
+ minLevel = Math.min(this.hierarchicalLevels[nodeId], minLevel);
+ }
+ }
+ }
+
+ // subtract the minimum from the set so we have a range starting from 0
+ for (var _nodeId2 in this.body.nodes) {
+ if (this.body.nodes.hasOwnProperty(_nodeId2)) {
+ if (this.hierarchicalLevels[_nodeId2] !== undefined) {
+ this.hierarchicalLevels[_nodeId2] -= minLevel;
+ }
+ }
+ }
+ }
+
+ /**
+ * Update the bookkeeping of parent and child.
+ * @private
+ */
+
+ }, {
+ key: '_generateMap',
+ value: function _generateMap() {
+ var _this6 = this;
+
+ var fillInRelations = function fillInRelations(parentNode, childNode) {
+ if (_this6.hierarchicalLevels[childNode.id] > _this6.hierarchicalLevels[parentNode.id]) {
+ var parentNodeId = parentNode.id;
+ var childNodeId = childNode.id;
+ if (_this6.hierarchicalChildrenReference[parentNodeId] === undefined) {
+ _this6.hierarchicalChildrenReference[parentNodeId] = [];
+ }
+ _this6.hierarchicalChildrenReference[parentNodeId].push(childNodeId);
+ if (_this6.hierarchicalParentReference[childNodeId] === undefined) {
+ _this6.hierarchicalParentReference[childNodeId] = [];
+ }
+ _this6.hierarchicalParentReference[childNodeId].push(parentNodeId);
+ }
+ };
+
+ this._crawlNetwork(fillInRelations);
+ }
+
+ /**
+ * Crawl over the entire network and use a callback on each node couple that is connected to each other.
+ * @param callback | will receive nodeA nodeB and the connecting edge. A and B are unique.
+ * @param startingNodeId
+ * @private
+ */
+
+ }, {
+ key: '_crawlNetwork',
+ value: function _crawlNetwork() {
+ var _this7 = this;
+
+ var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
+ var startingNodeId = arguments[1];
+
+ var progress = {};
+ var treeIndex = 0;
+
+ var crawler = function crawler(node, tree) {
+ if (progress[node.id] === undefined) {
+
+ if (_this7.hierarchicalTrees[node.id] === undefined) {
+ _this7.hierarchicalTrees[node.id] = tree;
+ _this7.treeIndex = Math.max(tree, _this7.treeIndex);
+ }
+
+ progress[node.id] = true;
+ var childNode = void 0;
+ for (var i = 0; i < node.edges.length; i++) {
+ if (node.edges[i].connected === true) {
+ if (node.edges[i].toId === node.id) {
+ childNode = node.edges[i].from;
+ } else {
+ childNode = node.edges[i].to;
+ }
+
+ if (node.id !== childNode.id) {
+ callback(node, childNode, node.edges[i]);
+ crawler(childNode, tree);
+ }
+ }
+ }
+ }
+ };
+
+ // we can crawl from a specific node or over all nodes.
+ if (startingNodeId === undefined) {
+ for (var i = 0; i < this.body.nodeIndices.length; i++) {
+ var node = this.body.nodes[this.body.nodeIndices[i]];
+ if (progress[node.id] === undefined) {
+ crawler(node, treeIndex);
+ treeIndex += 1;
+ }
+ }
+ } else {
+ var _node = this.body.nodes[startingNodeId];
+ if (_node === undefined) {
+ console.error("Node not found:", startingNodeId);
+ return;
+ }
+ crawler(_node);
+ }
+ }
+
+ /**
+ * Shift a branch a certain distance
+ * @param parentId
+ * @param diff
+ * @private
+ */
+
+ }, {
+ key: '_shiftBlock',
+ value: function _shiftBlock(parentId, diff) {
+ if (this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU') {
+ this.body.nodes[parentId].x += diff;
+ } else {
+ this.body.nodes[parentId].y += diff;
+ }
+ if (this.hierarchicalChildrenReference[parentId] !== undefined) {
+ for (var i = 0; i < this.hierarchicalChildrenReference[parentId].length; i++) {
+ this._shiftBlock(this.hierarchicalChildrenReference[parentId][i], diff);
+ }
+ }
+ }
+
+ /**
+ * Find a common parent between branches.
+ * @param childA
+ * @param childB
+ * @returns {{foundParent, withChild}}
+ * @private
+ */
+
+ }, {
+ key: '_findCommonParent',
+ value: function _findCommonParent(childA, childB) {
+ var _this8 = this;
+
+ var parents = {};
+ var iterateParents = function iterateParents(parents, child) {
+ if (_this8.hierarchicalParentReference[child] !== undefined) {
+ for (var i = 0; i < _this8.hierarchicalParentReference[child].length; i++) {
+ var parent = _this8.hierarchicalParentReference[child][i];
+ parents[parent] = true;
+ iterateParents(parents, parent);
+ }
+ }
+ };
+ var findParent = function findParent(parents, child) {
+ if (_this8.hierarchicalParentReference[child] !== undefined) {
+ for (var i = 0; i < _this8.hierarchicalParentReference[child].length; i++) {
+ var parent = _this8.hierarchicalParentReference[child][i];
+ if (parents[parent] !== undefined) {
+ return { foundParent: parent, withChild: child };
+ }
+ var branch = findParent(parents, parent);
+ if (branch.foundParent !== null) {
+ return branch;
+ }
+ }
+ }
+ return { foundParent: null, withChild: child };
+ };
+
+ iterateParents(parents, childA);
+ return findParent(parents, childB);
+ }
+
+ /**
+ * Abstract the getting of the position so we won't have to repeat the check for direction all the time
+ * @param node
+ * @param position
+ * @param level
+ * @private
+ */
+
+ }, {
+ key: '_setPositionForHierarchy',
+ value: function _setPositionForHierarchy(node, position, level) {
+ var doNotUpdate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
+
+ //console.log('_setPositionForHierarchy',node.id, position)
+ if (doNotUpdate !== true) {
+ if (this.distributionOrdering[level] === undefined) {
+ this.distributionOrdering[level] = [];
+ this.distributionOrderingPresence[level] = {};
+ }
+
+ if (this.distributionOrderingPresence[level][node.id] === undefined) {
+ this.distributionOrdering[level].push(node);
+ this.distributionIndex[node.id] = this.distributionOrdering[level].length - 1;
+ }
+ this.distributionOrderingPresence[level][node.id] = true;
+ }
+
+ if (this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU') {
+ node.x = position;
+ } else {
+ node.y = position;
+ }
+ }
+
+ /**
+ * Abstract the getting of the position of a node so we do not have to repeat the direction check all the time.
+ * @param node
+ * @returns {number|*}
+ * @private
+ */
+
+ }, {
+ key: '_getPositionForHierarchy',
+ value: function _getPositionForHierarchy(node) {
+ if (this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU') {
+ return node.x;
+ } else {
+ return node.y;
+ }
+ }
+
+ /**
+ * Use the x or y value to sort the array, allowing users to specify order.
+ * @param nodeArray
+ * @private
+ */
+
+ }, {
+ key: '_sortNodeArray',
+ value: function _sortNodeArray(nodeArray) {
+ if (nodeArray.length > 1) {
+ if (this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU') {
+ nodeArray.sort(function (a, b) {
+ return a.x - b.x;
+ });
+ } else {
+ nodeArray.sort(function (a, b) {
+ return a.y - b.y;
+ });
+ }
+ }
+ }
+ }]);
+ return LayoutEngine;
+ }();
+
+ exports['default'] = LayoutEngine;
+
+/***/ },
+/* 219 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _keys = __webpack_require__(58);
+
+ var _keys2 = _interopRequireDefault(_keys);
+
+ var _stringify = __webpack_require__(82);
+
+ var _stringify2 = _interopRequireDefault(_stringify);
+
+ var _typeof2 = __webpack_require__(62);
+
+ var _typeof3 = _interopRequireDefault(_typeof2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var util = __webpack_require__(1);
+ var Hammer = __webpack_require__(108);
+ var hammerUtil = __webpack_require__(121);
+
+ /**
+ * clears the toolbar div element of children
+ *
+ * @private
+ */
+
+ var ManipulationSystem = function () {
+ function ManipulationSystem(body, canvas, selectionHandler) {
+ var _this = this;
+
+ (0, _classCallCheck3['default'])(this, ManipulationSystem);
+
+ this.body = body;
+ this.canvas = canvas;
+ this.selectionHandler = selectionHandler;
+
+ this.editMode = false;
+ this.manipulationDiv = undefined;
+ this.editModeDiv = undefined;
+ this.closeDiv = undefined;
+
+ this.manipulationHammers = [];
+ this.temporaryUIFunctions = {};
+ this.temporaryEventFunctions = [];
+
+ this.touchTime = 0;
+ this.temporaryIds = { nodes: [], edges: [] };
+ this.guiEnabled = false;
+ this.inMode = false;
+ this.selectedControlNode = undefined;
+
+ this.options = {};
+ this.defaultOptions = {
+ enabled: false,
+ initiallyActive: false,
+ addNode: true,
+ addEdge: true,
+ editNode: undefined,
+ editEdge: true,
+ deleteNode: true,
+ deleteEdge: true,
+ controlNodeStyle: {
+ shape: 'dot',
+ size: 6,
+ color: { background: '#ff0000', border: '#3c3c3c', highlight: { background: '#07f968', border: '#3c3c3c' } },
+ borderWidth: 2,
+ borderWidthSelected: 2
+ }
+ };
+ util.extend(this.options, this.defaultOptions);
+
+ this.body.emitter.on('destroy', function () {
+ _this._clean();
+ });
+ this.body.emitter.on('_dataChanged', this._restore.bind(this));
+ this.body.emitter.on('_resetData', this._restore.bind(this));
+ }
+
+ /**
+ * If something changes in the data during editing, switch back to the initial datamanipulation state and close all edit modes.
+ * @private
+ */
+
+
+ (0, _createClass3['default'])(ManipulationSystem, [{
+ key: '_restore',
+ value: function _restore() {
+ if (this.inMode !== false) {
+ if (this.options.initiallyActive === true) {
+ this.enableEditMode();
+ } else {
+ this.disableEditMode();
+ }
+ }
+ }
+
+ /**
+ * Set the Options
+ * @param options
+ */
+
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options, allOptions, globalOptions) {
+ if (allOptions !== undefined) {
+ if (allOptions.locale !== undefined) {
+ this.options.locale = allOptions.locale;
+ } else {
+ this.options.locale = globalOptions.locale;
+ }
+ if (allOptions.locales !== undefined) {
+ this.options.locales = allOptions.locales;
+ } else {
+ this.options.locales = globalOptions.locales;
+ }
+ }
+
+ if (options !== undefined) {
+ if (typeof options === 'boolean') {
+ this.options.enabled = options;
+ } else {
+ this.options.enabled = true;
+ util.deepExtend(this.options, options);
+ }
+ if (this.options.initiallyActive === true) {
+ this.editMode = true;
+ }
+ this._setup();
+ }
+ }
+
+ /**
+ * Enable or disable edit-mode. Draws the DOM required and cleans up after itself.
+ *
+ * @private
+ */
+
+ }, {
+ key: 'toggleEditMode',
+ value: function toggleEditMode() {
+ if (this.editMode === true) {
+ this.disableEditMode();
+ } else {
+ this.enableEditMode();
+ }
+ }
+ }, {
+ key: 'enableEditMode',
+ value: function enableEditMode() {
+ this.editMode = true;
+
+ this._clean();
+ if (this.guiEnabled === true) {
+ this.manipulationDiv.style.display = 'block';
+ this.closeDiv.style.display = 'block';
+ this.editModeDiv.style.display = 'none';
+ this.showManipulatorToolbar();
+ }
+ }
+ }, {
+ key: 'disableEditMode',
+ value: function disableEditMode() {
+ this.editMode = false;
+
+ this._clean();
+ if (this.guiEnabled === true) {
+ this.manipulationDiv.style.display = 'none';
+ this.closeDiv.style.display = 'none';
+ this.editModeDiv.style.display = 'block';
+ this._createEditButton();
+ }
+ }
+
+ /**
+ * Creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar.
+ *
+ * @private
+ */
+
+ }, {
+ key: 'showManipulatorToolbar',
+ value: function showManipulatorToolbar() {
+ // restore the state of any bound functions or events, remove control nodes, restore physics
+ this._clean();
+
+ // reset global variables
+ this.manipulationDOM = {};
+
+ // if the gui is enabled, draw all elements.
+ if (this.guiEnabled === true) {
+ // a _restore will hide these menus
+ this.editMode = true;
+ this.manipulationDiv.style.display = 'block';
+ this.closeDiv.style.display = 'block';
+
+ var selectedNodeCount = this.selectionHandler._getSelectedNodeCount();
+ var selectedEdgeCount = this.selectionHandler._getSelectedEdgeCount();
+ var selectedTotalCount = selectedNodeCount + selectedEdgeCount;
+ var locale = this.options.locales[this.options.locale];
+ var needSeperator = false;
+
+ if (this.options.addNode !== false) {
+ this._createAddNodeButton(locale);
+ needSeperator = true;
+ }
+ if (this.options.addEdge !== false) {
+ if (needSeperator === true) {
+ this._createSeperator(1);
+ } else {
+ needSeperator = true;
+ }
+ this._createAddEdgeButton(locale);
+ }
+
+ if (selectedNodeCount === 1 && typeof this.options.editNode === 'function') {
+ if (needSeperator === true) {
+ this._createSeperator(2);
+ } else {
+ needSeperator = true;
+ }
+ this._createEditNodeButton(locale);
+ } else if (selectedEdgeCount === 1 && selectedNodeCount === 0 && this.options.editEdge !== false) {
+ if (needSeperator === true) {
+ this._createSeperator(3);
+ } else {
+ needSeperator = true;
+ }
+ this._createEditEdgeButton(locale);
+ }
+
+ // remove buttons
+ if (selectedTotalCount !== 0) {
+ if (selectedNodeCount > 0 && this.options.deleteNode !== false) {
+ if (needSeperator === true) {
+ this._createSeperator(4);
+ }
+ this._createDeleteButton(locale);
+ } else if (selectedNodeCount === 0 && this.options.deleteEdge !== false) {
+ if (needSeperator === true) {
+ this._createSeperator(4);
+ }
+ this._createDeleteButton(locale);
+ }
+ }
+
+ // bind the close button
+ this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this));
+
+ // refresh this bar based on what has been selected
+ this._temporaryBindEvent('select', this.showManipulatorToolbar.bind(this));
+ }
+
+ // redraw to show any possible changes
+ this.body.emitter.emit('_redraw');
+ }
+
+ /**
+ * Create the toolbar for adding Nodes
+ */
+
+ }, {
+ key: 'addNodeMode',
+ value: function addNodeMode() {
+ // when using the gui, enable edit mode if it wasnt already.
+ if (this.editMode !== true) {
+ this.enableEditMode();
+ }
+
+ // restore the state of any bound functions or events, remove control nodes, restore physics
+ this._clean();
+
+ this.inMode = 'addNode';
+ if (this.guiEnabled === true) {
+ var locale = this.options.locales[this.options.locale];
+ this.manipulationDOM = {};
+ this._createBackButton(locale);
+ this._createSeperator();
+ this._createDescription(locale['addDescription'] || this.options.locales['en']['addDescription']);
+
+ // bind the close button
+ this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this));
+ }
+
+ this._temporaryBindEvent('click', this._performAddNode.bind(this));
+ }
+
+ /**
+ * call the bound function to handle the editing of the node. The node has to be selected.
+ */
+
+ }, {
+ key: 'editNode',
+ value: function editNode() {
+ var _this2 = this;
+
+ // when using the gui, enable edit mode if it wasnt already.
+ if (this.editMode !== true) {
+ this.enableEditMode();
+ }
+
+ // restore the state of any bound functions or events, remove control nodes, restore physics
+ this._clean();
+ var node = this.selectionHandler._getSelectedNode();
+ if (node !== undefined) {
+ this.inMode = 'editNode';
+ if (typeof this.options.editNode === 'function') {
+ if (node.isCluster !== true) {
+ var data = util.deepExtend({}, node.options, false);
+ data.x = node.x;
+ data.y = node.y;
+
+ if (this.options.editNode.length === 2) {
+ this.options.editNode(data, function (finalizedData) {
+ if (finalizedData !== null && finalizedData !== undefined && _this2.inMode === 'editNode') {
+ // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
+ _this2.body.data.nodes.getDataSet().update(finalizedData);
+ }
+ _this2.showManipulatorToolbar();
+ });
+ } else {
+ throw new Error('The function for edit does not support two arguments (data, callback)');
+ }
+ } else {
+ alert(this.options.locales[this.options.locale]['editClusterError'] || this.options.locales['en']['editClusterError']);
+ }
+ } else {
+ throw new Error('No function has been configured to handle the editing of nodes.');
+ }
+ } else {
+ this.showManipulatorToolbar();
+ }
+ }
+
+ /**
+ * create the toolbar to connect nodes
+ */
+
+ }, {
+ key: 'addEdgeMode',
+ value: function addEdgeMode() {
+ // when using the gui, enable edit mode if it wasnt already.
+ if (this.editMode !== true) {
+ this.enableEditMode();
+ }
+
+ // restore the state of any bound functions or events, remove control nodes, restore physics
+ this._clean();
+
+ this.inMode = 'addEdge';
+ if (this.guiEnabled === true) {
+ var locale = this.options.locales[this.options.locale];
+ this.manipulationDOM = {};
+ this._createBackButton(locale);
+ this._createSeperator();
+ this._createDescription(locale['edgeDescription'] || this.options.locales['en']['edgeDescription']);
+
+ // bind the close button
+ this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this));
+ }
+
+ // temporarily overload functions
+ this._temporaryBindUI('onTouch', this._handleConnect.bind(this));
+ this._temporaryBindUI('onDragEnd', this._finishConnect.bind(this));
+ this._temporaryBindUI('onDrag', this._dragControlNode.bind(this));
+ this._temporaryBindUI('onRelease', this._finishConnect.bind(this));
+
+ this._temporaryBindUI('onDragStart', function () {});
+ this._temporaryBindUI('onHold', function () {});
+ }
+
+ /**
+ * create the toolbar to edit edges
+ */
+
+ }, {
+ key: 'editEdgeMode',
+ value: function editEdgeMode() {
+ var _this3 = this;
+
+ // when using the gui, enable edit mode if it wasn't already.
+ if (this.editMode !== true) {
+ this.enableEditMode();
+ }
+
+ // restore the state of any bound functions or events, remove control nodes, restore physics
+ this._clean();
+
+ this.inMode = 'editEdge';
+ if ((0, _typeof3['default'])(this.options.editEdge) === 'object' && typeof this.options.editEdge.editWithoutDrag === "function") {
+ this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0];
+ if (this.edgeBeingEditedId !== undefined) {
+ var edge = this.body.edges[this.edgeBeingEditedId];
+ this._performEditEdge(edge.from, edge.to);
+ return;
+ }
+ }
+ if (this.guiEnabled === true) {
+ var locale = this.options.locales[this.options.locale];
+ this.manipulationDOM = {};
+ this._createBackButton(locale);
+ this._createSeperator();
+ this._createDescription(locale['editEdgeDescription'] || this.options.locales['en']['editEdgeDescription']);
+
+ // bind the close button
+ this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this));
+ }
+
+ this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0];
+ if (this.edgeBeingEditedId !== undefined) {
+ (function () {
+ var edge = _this3.body.edges[_this3.edgeBeingEditedId];
+
+ // create control nodes
+ var controlNodeFrom = _this3._getNewTargetNode(edge.from.x, edge.from.y);
+ var controlNodeTo = _this3._getNewTargetNode(edge.to.x, edge.to.y);
+
+ _this3.temporaryIds.nodes.push(controlNodeFrom.id);
+ _this3.temporaryIds.nodes.push(controlNodeTo.id);
+
+ _this3.body.nodes[controlNodeFrom.id] = controlNodeFrom;
+ _this3.body.nodeIndices.push(controlNodeFrom.id);
+ _this3.body.nodes[controlNodeTo.id] = controlNodeTo;
+ _this3.body.nodeIndices.push(controlNodeTo.id);
+
+ // temporarily overload UI functions, cleaned up automatically because of _temporaryBindUI
+ _this3._temporaryBindUI('onTouch', _this3._controlNodeTouch.bind(_this3)); // used to get the position
+ _this3._temporaryBindUI('onTap', function () {}); // disabled
+ _this3._temporaryBindUI('onHold', function () {}); // disabled
+ _this3._temporaryBindUI('onDragStart', _this3._controlNodeDragStart.bind(_this3)); // used to select control node
+ _this3._temporaryBindUI('onDrag', _this3._controlNodeDrag.bind(_this3)); // used to drag control node
+ _this3._temporaryBindUI('onDragEnd', _this3._controlNodeDragEnd.bind(_this3)); // used to connect or revert control nodes
+ _this3._temporaryBindUI('onMouseMove', function () {}); // disabled
+
+ // create function to position control nodes correctly on movement
+ // automatically cleaned up because we use the temporary bind
+ _this3._temporaryBindEvent('beforeDrawing', function (ctx) {
+ var positions = edge.edgeType.findBorderPositions(ctx);
+ if (controlNodeFrom.selected === false) {
+ controlNodeFrom.x = positions.from.x;
+ controlNodeFrom.y = positions.from.y;
+ }
+ if (controlNodeTo.selected === false) {
+ controlNodeTo.x = positions.to.x;
+ controlNodeTo.y = positions.to.y;
+ }
+ });
+
+ _this3.body.emitter.emit('_redraw');
+ })();
+ } else {
+ this.showManipulatorToolbar();
+ }
+ }
+
+ /**
+ * delete everything in the selection
+ */
+
+ }, {
+ key: 'deleteSelected',
+ value: function deleteSelected() {
+ var _this4 = this;
+
+ // when using the gui, enable edit mode if it wasnt already.
+ if (this.editMode !== true) {
+ this.enableEditMode();
+ }
+
+ // restore the state of any bound functions or events, remove control nodes, restore physics
+ this._clean();
+
+ this.inMode = 'delete';
+ var selectedNodes = this.selectionHandler.getSelectedNodes();
+ var selectedEdges = this.selectionHandler.getSelectedEdges();
+ var deleteFunction = undefined;
+ if (selectedNodes.length > 0) {
+ for (var i = 0; i < selectedNodes.length; i++) {
+ if (this.body.nodes[selectedNodes[i]].isCluster === true) {
+ alert(this.options.locales[this.options.locale]['deleteClusterError'] || this.options.locales['en']['deleteClusterError']);
+ return;
+ }
+ }
+
+ if (typeof this.options.deleteNode === 'function') {
+ deleteFunction = this.options.deleteNode;
+ }
+ } else if (selectedEdges.length > 0) {
+ if (typeof this.options.deleteEdge === 'function') {
+ deleteFunction = this.options.deleteEdge;
+ }
+ }
+
+ if (typeof deleteFunction === 'function') {
+ var data = { nodes: selectedNodes, edges: selectedEdges };
+ if (deleteFunction.length === 2) {
+ deleteFunction(data, function (finalizedData) {
+ if (finalizedData !== null && finalizedData !== undefined && _this4.inMode === 'delete') {
+ // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
+ _this4.body.data.edges.getDataSet().remove(finalizedData.edges);
+ _this4.body.data.nodes.getDataSet().remove(finalizedData.nodes);
+ _this4.body.emitter.emit('startSimulation');
+ _this4.showManipulatorToolbar();
+ } else {
+ _this4.body.emitter.emit('startSimulation');
+ _this4.showManipulatorToolbar();
+ }
+ });
+ } else {
+ throw new Error('The function for delete does not support two arguments (data, callback)');
+ }
+ } else {
+ this.body.data.edges.getDataSet().remove(selectedEdges);
+ this.body.data.nodes.getDataSet().remove(selectedNodes);
+ this.body.emitter.emit('startSimulation');
+ this.showManipulatorToolbar();
+ }
+ }
+
+ //********************************************** PRIVATE ***************************************//
+
+ /**
+ * draw or remove the DOM
+ * @private
+ */
+
+ }, {
+ key: '_setup',
+ value: function _setup() {
+ if (this.options.enabled === true) {
+ // Enable the GUI
+ this.guiEnabled = true;
+
+ this._createWrappers();
+ if (this.editMode === false) {
+ this._createEditButton();
+ } else {
+ this.showManipulatorToolbar();
+ }
+ } else {
+ this._removeManipulationDOM();
+
+ // disable the gui
+ this.guiEnabled = false;
+ }
+ }
+
+ /**
+ * create the div overlays that contain the DOM
+ * @private
+ */
+
+ }, {
+ key: '_createWrappers',
+ value: function _createWrappers() {
+ // load the manipulator HTML elements. All styling done in css.
+ if (this.manipulationDiv === undefined) {
+ this.manipulationDiv = document.createElement('div');
+ this.manipulationDiv.className = 'vis-manipulation';
+ if (this.editMode === true) {
+ this.manipulationDiv.style.display = 'block';
+ } else {
+ this.manipulationDiv.style.display = 'none';
+ }
+ this.canvas.frame.appendChild(this.manipulationDiv);
+ }
+
+ // container for the edit button.
+ if (this.editModeDiv === undefined) {
+ this.editModeDiv = document.createElement('div');
+ this.editModeDiv.className = 'vis-edit-mode';
+ if (this.editMode === true) {
+ this.editModeDiv.style.display = 'none';
+ } else {
+ this.editModeDiv.style.display = 'block';
+ }
+ this.canvas.frame.appendChild(this.editModeDiv);
+ }
+
+ // container for the close div button
+ if (this.closeDiv === undefined) {
+ this.closeDiv = document.createElement('div');
+ this.closeDiv.className = 'vis-close';
+ this.closeDiv.style.display = this.manipulationDiv.style.display;
+ this.canvas.frame.appendChild(this.closeDiv);
+ }
+ }
+
+ /**
+ * generate a new target node. Used for creating new edges and editing edges
+ * @param x
+ * @param y
+ * @returns {*}
+ * @private
+ */
+
+ }, {
+ key: '_getNewTargetNode',
+ value: function _getNewTargetNode(x, y) {
+ var controlNodeStyle = util.deepExtend({}, this.options.controlNodeStyle);
+
+ controlNodeStyle.id = 'targetNode' + util.randomUUID();
+ controlNodeStyle.hidden = false;
+ controlNodeStyle.physics = false;
+ controlNodeStyle.x = x;
+ controlNodeStyle.y = y;
+
+ // we have to define the bounding box in order for the nodes to be drawn immediately
+ var node = this.body.functions.createNode(controlNodeStyle);
+ node.shape.boundingBox = { left: x, right: x, top: y, bottom: y };
+
+ return node;
+ }
+
+ /**
+ * Create the edit button
+ */
+
+ }, {
+ key: '_createEditButton',
+ value: function _createEditButton() {
+ // restore everything to it's original state (if applicable)
+ this._clean();
+
+ // reset the manipulationDOM
+ this.manipulationDOM = {};
+
+ // empty the editModeDiv
+ util.recursiveDOMDelete(this.editModeDiv);
+
+ // create the contents for the editMode button
+ var locale = this.options.locales[this.options.locale];
+ var button = this._createButton('editMode', 'vis-button vis-edit vis-edit-mode', locale['edit'] || this.options.locales['en']['edit']);
+ this.editModeDiv.appendChild(button);
+
+ // bind a hammer listener to the button, calling the function toggleEditMode.
+ this._bindHammerToDiv(button, this.toggleEditMode.bind(this));
+ }
+
+ /**
+ * this function cleans up after everything this module does. Temporary elements, functions and events are removed, physics restored, hammers removed.
+ * @private
+ */
+
+ }, {
+ key: '_clean',
+ value: function _clean() {
+ // not in mode
+ this.inMode = false;
+
+ // _clean the divs
+ if (this.guiEnabled === true) {
+ util.recursiveDOMDelete(this.editModeDiv);
+ util.recursiveDOMDelete(this.manipulationDiv);
+
+ // removes all the bindings and overloads
+ this._cleanManipulatorHammers();
+ }
+
+ // remove temporary nodes and edges
+ this._cleanupTemporaryNodesAndEdges();
+
+ // restore overloaded UI functions
+ this._unbindTemporaryUIs();
+
+ // remove the temporaryEventFunctions
+ this._unbindTemporaryEvents();
+
+ // restore the physics if required
+ this.body.emitter.emit('restorePhysics');
+ }
+
+ /**
+ * Each dom element has it's own hammer. They are stored in this.manipulationHammers. This cleans them up.
+ * @private
+ */
+
+ }, {
+ key: '_cleanManipulatorHammers',
+ value: function _cleanManipulatorHammers() {
+ // _clean hammer bindings
+ if (this.manipulationHammers.length != 0) {
+ for (var i = 0; i < this.manipulationHammers.length; i++) {
+ this.manipulationHammers[i].destroy();
+ }
+ this.manipulationHammers = [];
+ }
+ }
+
+ /**
+ * Remove all DOM elements created by this module.
+ * @private
+ */
+
+ }, {
+ key: '_removeManipulationDOM',
+ value: function _removeManipulationDOM() {
+ // removes all the bindings and overloads
+ this._clean();
+
+ // empty the manipulation divs
+ util.recursiveDOMDelete(this.manipulationDiv);
+ util.recursiveDOMDelete(this.editModeDiv);
+ util.recursiveDOMDelete(this.closeDiv);
+
+ // remove the manipulation divs
+ if (this.manipulationDiv) {
+ this.canvas.frame.removeChild(this.manipulationDiv);
+ }
+ if (this.editModeDiv) {
+ this.canvas.frame.removeChild(this.editModeDiv);
+ }
+ if (this.closeDiv) {
+ this.canvas.frame.removeChild(this.closeDiv);
+ }
+
+ // set the references to undefined
+ this.manipulationDiv = undefined;
+ this.editModeDiv = undefined;
+ this.closeDiv = undefined;
+ }
+
+ /**
+ * create a seperator line. the index is to differentiate in the manipulation dom
+ * @param index
+ * @private
+ */
+
+ }, {
+ key: '_createSeperator',
+ value: function _createSeperator() {
+ var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
+
+ this.manipulationDOM['seperatorLineDiv' + index] = document.createElement('div');
+ this.manipulationDOM['seperatorLineDiv' + index].className = 'vis-separator-line';
+ this.manipulationDiv.appendChild(this.manipulationDOM['seperatorLineDiv' + index]);
+ }
+
+ // ---------------------- DOM functions for buttons --------------------------//
+
+ }, {
+ key: '_createAddNodeButton',
+ value: function _createAddNodeButton(locale) {
+ var button = this._createButton('addNode', 'vis-button vis-add', locale['addNode'] || this.options.locales['en']['addNode']);
+ this.manipulationDiv.appendChild(button);
+ this._bindHammerToDiv(button, this.addNodeMode.bind(this));
+ }
+ }, {
+ key: '_createAddEdgeButton',
+ value: function _createAddEdgeButton(locale) {
+ var button = this._createButton('addEdge', 'vis-button vis-connect', locale['addEdge'] || this.options.locales['en']['addEdge']);
+ this.manipulationDiv.appendChild(button);
+ this._bindHammerToDiv(button, this.addEdgeMode.bind(this));
+ }
+ }, {
+ key: '_createEditNodeButton',
+ value: function _createEditNodeButton(locale) {
+ var button = this._createButton('editNode', 'vis-button vis-edit', locale['editNode'] || this.options.locales['en']['editNode']);
+ this.manipulationDiv.appendChild(button);
+ this._bindHammerToDiv(button, this.editNode.bind(this));
+ }
+ }, {
+ key: '_createEditEdgeButton',
+ value: function _createEditEdgeButton(locale) {
+ var button = this._createButton('editEdge', 'vis-button vis-edit', locale['editEdge'] || this.options.locales['en']['editEdge']);
+ this.manipulationDiv.appendChild(button);
+ this._bindHammerToDiv(button, this.editEdgeMode.bind(this));
+ }
+ }, {
+ key: '_createDeleteButton',
+ value: function _createDeleteButton(locale) {
+ if (this.options.rtl) {
+ var deleteBtnClass = 'vis-button vis-delete-rtl';
+ } else {
+ var deleteBtnClass = 'vis-button vis-delete';
+ }
+ var button = this._createButton('delete', deleteBtnClass, locale['del'] || this.options.locales['en']['del']);
+ this.manipulationDiv.appendChild(button);
+ this._bindHammerToDiv(button, this.deleteSelected.bind(this));
+ }
+ }, {
+ key: '_createBackButton',
+ value: function _createBackButton(locale) {
+ var button = this._createButton('back', 'vis-button vis-back', locale['back'] || this.options.locales['en']['back']);
+ this.manipulationDiv.appendChild(button);
+ this._bindHammerToDiv(button, this.showManipulatorToolbar.bind(this));
+ }
+ }, {
+ key: '_createButton',
+ value: function _createButton(id, className, label) {
+ var labelClassName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vis-label';
+
+
+ this.manipulationDOM[id + 'Div'] = document.createElement('div');
+ this.manipulationDOM[id + 'Div'].className = className;
+ this.manipulationDOM[id + 'Label'] = document.createElement('div');
+ this.manipulationDOM[id + 'Label'].className = labelClassName;
+ this.manipulationDOM[id + 'Label'].innerHTML = label;
+ this.manipulationDOM[id + 'Div'].appendChild(this.manipulationDOM[id + 'Label']);
+ return this.manipulationDOM[id + 'Div'];
+ }
+ }, {
+ key: '_createDescription',
+ value: function _createDescription(label) {
+ this.manipulationDiv.appendChild(this._createButton('description', 'vis-button vis-none', label));
+ }
+
+ // -------------------------- End of DOM functions for buttons ------------------------------//
+
+ /**
+ * this binds an event until cleanup by the clean functions.
+ * @param event
+ * @param newFunction
+ * @private
+ */
+
+ }, {
+ key: '_temporaryBindEvent',
+ value: function _temporaryBindEvent(event, newFunction) {
+ this.temporaryEventFunctions.push({ event: event, boundFunction: newFunction });
+ this.body.emitter.on(event, newFunction);
+ }
+
+ /**
+ * this overrides an UI function until cleanup by the clean function
+ * @param UIfunctionName
+ * @param newFunction
+ * @private
+ */
+
+ }, {
+ key: '_temporaryBindUI',
+ value: function _temporaryBindUI(UIfunctionName, newFunction) {
+ if (this.body.eventListeners[UIfunctionName] !== undefined) {
+ this.temporaryUIFunctions[UIfunctionName] = this.body.eventListeners[UIfunctionName];
+ this.body.eventListeners[UIfunctionName] = newFunction;
+ } else {
+ throw new Error('This UI function does not exist. Typo? You tried: ' + UIfunctionName + ' possible are: ' + (0, _stringify2['default'])((0, _keys2['default'])(this.body.eventListeners)));
+ }
+ }
+
+ /**
+ * Restore the overridden UI functions to their original state.
+ *
+ * @private
+ */
+
+ }, {
+ key: '_unbindTemporaryUIs',
+ value: function _unbindTemporaryUIs() {
+ for (var functionName in this.temporaryUIFunctions) {
+ if (this.temporaryUIFunctions.hasOwnProperty(functionName)) {
+ this.body.eventListeners[functionName] = this.temporaryUIFunctions[functionName];
+ delete this.temporaryUIFunctions[functionName];
+ }
+ }
+ this.temporaryUIFunctions = {};
+ }
+
+ /**
+ * Unbind the events created by _temporaryBindEvent
+ * @private
+ */
+
+ }, {
+ key: '_unbindTemporaryEvents',
+ value: function _unbindTemporaryEvents() {
+ for (var i = 0; i < this.temporaryEventFunctions.length; i++) {
+ var eventName = this.temporaryEventFunctions[i].event;
+ var boundFunction = this.temporaryEventFunctions[i].boundFunction;
+ this.body.emitter.off(eventName, boundFunction);
+ }
+ this.temporaryEventFunctions = [];
+ }
+
+ /**
+ * Bind an hammer instance to a DOM element.
+ * @param domElement
+ * @param funct
+ */
+
+ }, {
+ key: '_bindHammerToDiv',
+ value: function _bindHammerToDiv(domElement, boundFunction) {
+ var hammer = new Hammer(domElement, {});
+ hammerUtil.onTouch(hammer, boundFunction);
+ this.manipulationHammers.push(hammer);
+ }
+
+ /**
+ * Neatly clean up temporary edges and nodes
+ * @private
+ */
+
+ }, {
+ key: '_cleanupTemporaryNodesAndEdges',
+ value: function _cleanupTemporaryNodesAndEdges() {
+ // _clean temporary edges
+ for (var i = 0; i < this.temporaryIds.edges.length; i++) {
+ this.body.edges[this.temporaryIds.edges[i]].disconnect();
+ delete this.body.edges[this.temporaryIds.edges[i]];
+ var indexTempEdge = this.body.edgeIndices.indexOf(this.temporaryIds.edges[i]);
+ if (indexTempEdge !== -1) {
+ this.body.edgeIndices.splice(indexTempEdge, 1);
+ }
+ }
+
+ // _clean temporary nodes
+ for (var _i = 0; _i < this.temporaryIds.nodes.length; _i++) {
+ delete this.body.nodes[this.temporaryIds.nodes[_i]];
+ var indexTempNode = this.body.nodeIndices.indexOf(this.temporaryIds.nodes[_i]);
+ if (indexTempNode !== -1) {
+ this.body.nodeIndices.splice(indexTempNode, 1);
+ }
+ }
+
+ this.temporaryIds = { nodes: [], edges: [] };
+ }
+
+ // ------------------------------------------ EDIT EDGE FUNCTIONS -----------------------------------------//
+
+ /**
+ * the touch is used to get the position of the initial click
+ * @param event
+ * @private
+ */
+
+ }, {
+ key: '_controlNodeTouch',
+ value: function _controlNodeTouch(event) {
+ this.selectionHandler.unselectAll();
+ this.lastTouch = this.body.functions.getPointer(event.center);
+ this.lastTouch.translation = util.extend({}, this.body.view.translation); // copy the object
+ }
+
+ /**
+ * the drag start is used to mark one of the control nodes as selected.
+ * @param event
+ * @private
+ */
+
+ }, {
+ key: '_controlNodeDragStart',
+ value: function _controlNodeDragStart(event) {
+ var pointer = this.lastTouch;
+ var pointerObj = this.selectionHandler._pointerToPositionObject(pointer);
+ var from = this.body.nodes[this.temporaryIds.nodes[0]];
+ var to = this.body.nodes[this.temporaryIds.nodes[1]];
+ var edge = this.body.edges[this.edgeBeingEditedId];
+ this.selectedControlNode = undefined;
+
+ var fromSelect = from.isOverlappingWith(pointerObj);
+ var toSelect = to.isOverlappingWith(pointerObj);
+
+ if (fromSelect === true) {
+ this.selectedControlNode = from;
+ edge.edgeType.from = from;
+ } else if (toSelect === true) {
+ this.selectedControlNode = to;
+ edge.edgeType.to = to;
+ }
+
+ // we use the selection to find the node that is being dragged. We explicitly select it here.
+ if (this.selectedControlNode !== undefined) {
+ this.selectionHandler.selectObject(this.selectedControlNode);
+ }
+
+ this.body.emitter.emit('_redraw');
+ }
+
+ /**
+ * dragging the control nodes or the canvas
+ * @param event
+ * @private
+ */
+
+ }, {
+ key: '_controlNodeDrag',
+ value: function _controlNodeDrag(event) {
+ this.body.emitter.emit('disablePhysics');
+ var pointer = this.body.functions.getPointer(event.center);
+ var pos = this.canvas.DOMtoCanvas(pointer);
+ if (this.selectedControlNode !== undefined) {
+ this.selectedControlNode.x = pos.x;
+ this.selectedControlNode.y = pos.y;
+ } else {
+ // if the drag was not started properly because the click started outside the network div, start it now.
+ var diffX = pointer.x - this.lastTouch.x;
+ var diffY = pointer.y - this.lastTouch.y;
+ this.body.view.translation = { x: this.lastTouch.translation.x + diffX, y: this.lastTouch.translation.y + diffY };
+ }
+ this.body.emitter.emit('_redraw');
+ }
+
+ /**
+ * connecting or restoring the control nodes.
+ * @param event
+ * @private
+ */
+
+ }, {
+ key: '_controlNodeDragEnd',
+ value: function _controlNodeDragEnd(event) {
+ var pointer = this.body.functions.getPointer(event.center);
+ var pointerObj = this.selectionHandler._pointerToPositionObject(pointer);
+ var edge = this.body.edges[this.edgeBeingEditedId];
+ // if the node that was dragged is not a control node, return
+ if (this.selectedControlNode === undefined) {
+ return;
+ }
+
+ // we use the selection to find the node that is being dragged. We explicitly DEselect the control node here.
+ this.selectionHandler.unselectAll();
+ var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj);
+ var node = undefined;
+ for (var i = overlappingNodeIds.length - 1; i >= 0; i--) {
+ if (overlappingNodeIds[i] !== this.selectedControlNode.id) {
+ node = this.body.nodes[overlappingNodeIds[i]];
+ break;
+ }
+ }
+ // perform the connection
+ if (node !== undefined && this.selectedControlNode !== undefined) {
+ if (node.isCluster === true) {
+ alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']);
+ } else {
+ var from = this.body.nodes[this.temporaryIds.nodes[0]];
+ if (this.selectedControlNode.id === from.id) {
+ this._performEditEdge(node.id, edge.to.id);
+ } else {
+ this._performEditEdge(edge.from.id, node.id);
+ }
+ }
+ } else {
+ edge.updateEdgeType();
+ this.body.emitter.emit('restorePhysics');
+ }
+ this.body.emitter.emit('_redraw');
+ }
+
+ // ------------------------------------ END OF EDIT EDGE FUNCTIONS -----------------------------------------//
+
+
+ // ------------------------------------------- ADD EDGE FUNCTIONS -----------------------------------------//
+ /**
+ * the function bound to the selection event. It checks if you want to connect a cluster and changes the description
+ * to walk the user through the process.
+ *
+ * @private
+ */
+
+ }, {
+ key: '_handleConnect',
+ value: function _handleConnect(event) {
+ // check to avoid double fireing of this function.
+ if (new Date().valueOf() - this.touchTime > 100) {
+ this.lastTouch = this.body.functions.getPointer(event.center);
+ this.lastTouch.translation = util.extend({}, this.body.view.translation); // copy the object
+
+ var pointer = this.lastTouch;
+ var node = this.selectionHandler.getNodeAt(pointer);
+
+ if (node !== undefined) {
+ if (node.isCluster === true) {
+ alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']);
+ } else {
+ // create a node the temporary line can look at
+ var targetNode = this._getNewTargetNode(node.x, node.y);
+ this.body.nodes[targetNode.id] = targetNode;
+ this.body.nodeIndices.push(targetNode.id);
+
+ // create a temporary edge
+ var connectionEdge = this.body.functions.createEdge({
+ id: 'connectionEdge' + util.randomUUID(),
+ from: node.id,
+ to: targetNode.id,
+ physics: false,
+ smooth: {
+ enabled: true,
+ type: 'continuous',
+ roundness: 0.5
+ }
+ });
+ this.body.edges[connectionEdge.id] = connectionEdge;
+ this.body.edgeIndices.push(connectionEdge.id);
+
+ this.temporaryIds.nodes.push(targetNode.id);
+ this.temporaryIds.edges.push(connectionEdge.id);
+ }
+ }
+ this.touchTime = new Date().valueOf();
+ }
+ }
+ }, {
+ key: '_dragControlNode',
+ value: function _dragControlNode(event) {
+ var pointer = this.body.functions.getPointer(event.center);
+ if (this.temporaryIds.nodes[0] !== undefined) {
+ var targetNode = this.body.nodes[this.temporaryIds.nodes[0]]; // there is only one temp node in the add edge mode.
+ targetNode.x = this.canvas._XconvertDOMtoCanvas(pointer.x);
+ targetNode.y = this.canvas._YconvertDOMtoCanvas(pointer.y);
+ this.body.emitter.emit('_redraw');
+ } else {
+ var diffX = pointer.x - this.lastTouch.x;
+ var diffY = pointer.y - this.lastTouch.y;
+ this.body.view.translation = { x: this.lastTouch.translation.x + diffX, y: this.lastTouch.translation.y + diffY };
+ }
+ }
+
+ /**
+ * Connect the new edge to the target if one exists, otherwise remove temp line
+ * @param event
+ * @private
+ */
+
+ }, {
+ key: '_finishConnect',
+ value: function _finishConnect(event) {
+ var pointer = this.body.functions.getPointer(event.center);
+ var pointerObj = this.selectionHandler._pointerToPositionObject(pointer);
+
+ // remember the edge id
+ var connectFromId = undefined;
+ if (this.temporaryIds.edges[0] !== undefined) {
+ connectFromId = this.body.edges[this.temporaryIds.edges[0]].fromId;
+ }
+
+ // get the overlapping node but NOT the temporary node;
+ var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj);
+ var node = undefined;
+ for (var i = overlappingNodeIds.length - 1; i >= 0; i--) {
+ // if the node id is NOT a temporary node, accept the node.
+ if (this.temporaryIds.nodes.indexOf(overlappingNodeIds[i]) === -1) {
+ node = this.body.nodes[overlappingNodeIds[i]];
+ break;
+ }
+ }
+
+ // clean temporary nodes and edges.
+ this._cleanupTemporaryNodesAndEdges();
+
+ // perform the connection
+ if (node !== undefined) {
+ if (node.isCluster === true) {
+ alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']);
+ } else {
+ if (this.body.nodes[connectFromId] !== undefined && this.body.nodes[node.id] !== undefined) {
+ this._performAddEdge(connectFromId, node.id);
+ }
+ }
+ }
+ this.body.emitter.emit('_redraw');
+ }
+
+ // --------------------------------------- END OF ADD EDGE FUNCTIONS -------------------------------------//
+
+
+ // ------------------------------ Performing all the actual data manipulation ------------------------//
+
+ /**
+ * Adds a node on the specified location
+ */
+
+ }, {
+ key: '_performAddNode',
+ value: function _performAddNode(clickData) {
+ var _this5 = this;
+
+ var defaultData = {
+ id: util.randomUUID(),
+ x: clickData.pointer.canvas.x,
+ y: clickData.pointer.canvas.y,
+ label: 'new'
+ };
+
+ if (typeof this.options.addNode === 'function') {
+ if (this.options.addNode.length === 2) {
+ this.options.addNode(defaultData, function (finalizedData) {
+ if (finalizedData !== null && finalizedData !== undefined && _this5.inMode === 'addNode') {
+ // if for whatever reason the mode has changes (due to dataset change) disregard the callback
+ _this5.body.data.nodes.getDataSet().add(finalizedData);
+ _this5.showManipulatorToolbar();
+ }
+ });
+ } else {
+ throw new Error('The function for add does not support two arguments (data,callback)');
+ this.showManipulatorToolbar();
+ }
+ } else {
+ this.body.data.nodes.getDataSet().add(defaultData);
+ this.showManipulatorToolbar();
+ }
+ }
+
+ /**
+ * connect two nodes with a new edge.
+ *
+ * @private
+ */
+
+ }, {
+ key: '_performAddEdge',
+ value: function _performAddEdge(sourceNodeId, targetNodeId) {
+ var _this6 = this;
+
+ var defaultData = { from: sourceNodeId, to: targetNodeId };
+ if (typeof this.options.addEdge === 'function') {
+ if (this.options.addEdge.length === 2) {
+ this.options.addEdge(defaultData, function (finalizedData) {
+ if (finalizedData !== null && finalizedData !== undefined && _this6.inMode === 'addEdge') {
+ // if for whatever reason the mode has changes (due to dataset change) disregard the callback
+ _this6.body.data.edges.getDataSet().add(finalizedData);
+ _this6.selectionHandler.unselectAll();
+ _this6.showManipulatorToolbar();
+ }
+ });
+ } else {
+ throw new Error('The function for connect does not support two arguments (data,callback)');
+ }
+ } else {
+ this.body.data.edges.getDataSet().add(defaultData);
+ this.selectionHandler.unselectAll();
+ this.showManipulatorToolbar();
+ }
+ }
+
+ /**
+ * connect two nodes with a new edge.
+ *
+ * @private
+ */
+
+ }, {
+ key: '_performEditEdge',
+ value: function _performEditEdge(sourceNodeId, targetNodeId) {
+ var _this7 = this;
+
+ var defaultData = { id: this.edgeBeingEditedId, from: sourceNodeId, to: targetNodeId, label: this.body.data.edges._data[this.edgeBeingEditedId].label };
+ var eeFunct = this.options.editEdge;
+ if ((typeof eeFunct === 'undefined' ? 'undefined' : (0, _typeof3['default'])(eeFunct)) === 'object') {
+ eeFunct = eeFunct.editWithoutDrag;
+ }
+ if (typeof eeFunct === 'function') {
+ if (eeFunct.length === 2) {
+ eeFunct(defaultData, function (finalizedData) {
+ if (finalizedData === null || finalizedData === undefined || _this7.inMode !== 'editEdge') {
+ // if for whatever reason the mode has changes (due to dataset change) disregard the callback) {
+ _this7.body.edges[defaultData.id].updateEdgeType();
+ _this7.body.emitter.emit('_redraw');
+ _this7.showManipulatorToolbar();
+ } else {
+ _this7.body.data.edges.getDataSet().update(finalizedData);
+ _this7.selectionHandler.unselectAll();
+ _this7.showManipulatorToolbar();
+ }
+ });
+ } else {
+ throw new Error('The function for edit does not support two arguments (data, callback)');
+ }
+ } else {
+ this.body.data.edges.getDataSet().update(defaultData);
+ this.selectionHandler.unselectAll();
+ this.showManipulatorToolbar();
+ }
+ }
+ }]);
+ return ManipulationSystem;
+ }();
+
+ exports['default'] = ManipulationSystem;
+
+/***/ },
+/* 220 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ /**
+ * This object contains all possible options. It will check if the types are correct, if required if the option is one
+ * of the allowed values.
+ *
+ * __any__ means that the name of the property does not matter.
+ * __type__ is a required field for all objects and contains the allowed types of all objects
+ */
+ var string = 'string';
+ var bool = 'boolean';
+ var number = 'number';
+ var array = 'array';
+ var object = 'object'; // should only be in a __type__ property
+ var dom = 'dom';
+ var any = 'any';
+
+ var allOptions = {
+ configure: {
+ enabled: { boolean: bool },
+ filter: { boolean: bool, string: string, array: array, 'function': 'function' },
+ container: { dom: dom },
+ showButton: { boolean: bool },
+ __type__: { object: object, boolean: bool, string: string, array: array, 'function': 'function' }
+ },
+ edges: {
+ arrows: {
+ to: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: ['arrow', 'circle'] }, __type__: { object: object, boolean: bool } },
+ middle: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: ['arrow', 'circle'] }, __type__: { object: object, boolean: bool } },
+ from: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: ['arrow', 'circle'] }, __type__: { object: object, boolean: bool } },
+ __type__: { string: ['from', 'to', 'middle'], object: object }
+ },
+ arrowStrikethrough: { boolean: bool },
+ chosen: {
+ label: { boolean: bool, 'function': 'function' },
+ edge: { boolean: bool, 'function': 'function' },
+ __type__: { object: object, boolean: bool }
+ },
+ color: {
+ color: { string: string },
+ highlight: { string: string },
+ hover: { string: string },
+ inherit: { string: ['from', 'to', 'both'], boolean: bool },
+ opacity: { number: number },
+ __type__: { object: object, string: string }
+ },
+ dashes: { boolean: bool, array: array },
+ font: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ background: { string: string },
+ strokeWidth: { number: number }, // px
+ strokeColor: { string: string },
+ align: { string: ['horizontal', 'top', 'middle', 'bottom'] },
+ vadjust: { number: number },
+ multi: { boolean: bool, string: string },
+ bold: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ mod: { string: string },
+ vadjust: { number: number },
+ __type__: { object: object, string: string }
+ },
+ boldital: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ mod: { string: string },
+ vadjust: { number: number },
+ __type__: { object: object, string: string }
+ },
+ ital: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ mod: { string: string },
+ vadjust: { number: number },
+ __type__: { object: object, string: string }
+ },
+ mono: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ mod: { string: string },
+ vadjust: { number: number },
+ __type__: { object: object, string: string }
+ },
+ __type__: { object: object, string: string }
+ },
+ hidden: { boolean: bool },
+ hoverWidth: { 'function': 'function', number: number },
+ label: { string: string, 'undefined': 'undefined' },
+ labelHighlightBold: { boolean: bool },
+ length: { number: number, 'undefined': 'undefined' },
+ physics: { boolean: bool },
+ scaling: {
+ min: { number: number },
+ max: { number: number },
+ label: {
+ enabled: { boolean: bool },
+ min: { number: number },
+ max: { number: number },
+ maxVisible: { number: number },
+ drawThreshold: { number: number },
+ __type__: { object: object, boolean: bool }
+ },
+ customScalingFunction: { 'function': 'function' },
+ __type__: { object: object }
+ },
+ selectionWidth: { 'function': 'function', number: number },
+ selfReferenceSize: { number: number },
+ shadow: {
+ enabled: { boolean: bool },
+ color: { string: string },
+ size: { number: number },
+ x: { number: number },
+ y: { number: number },
+ __type__: { object: object, boolean: bool }
+ },
+ smooth: {
+ enabled: { boolean: bool },
+ type: { string: ['dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'] },
+ roundness: { number: number },
+ forceDirection: { string: ['horizontal', 'vertical', 'none'], boolean: bool },
+ __type__: { object: object, boolean: bool }
+ },
+ title: { string: string, 'undefined': 'undefined' },
+ width: { number: number },
+ widthConstraint: {
+ maximum: { number: number },
+ __type__: { object: object, boolean: bool, number: number }
+ },
+ value: { number: number, 'undefined': 'undefined' },
+ __type__: { object: object }
+ },
+ groups: {
+ useDefaultGroups: { boolean: bool },
+ __any__: 'get from nodes, will be overwritten below',
+ __type__: { object: object }
+ },
+ interaction: {
+ dragNodes: { boolean: bool },
+ dragView: { boolean: bool },
+ hideEdgesOnDrag: { boolean: bool },
+ hideNodesOnDrag: { boolean: bool },
+ hover: { boolean: bool },
+ keyboard: {
+ enabled: { boolean: bool },
+ speed: { x: { number: number }, y: { number: number }, zoom: { number: number }, __type__: { object: object } },
+ bindToWindow: { boolean: bool },
+ __type__: { object: object, boolean: bool }
+ },
+ multiselect: { boolean: bool },
+ navigationButtons: { boolean: bool },
+ selectable: { boolean: bool },
+ selectConnectedEdges: { boolean: bool },
+ hoverConnectedEdges: { boolean: bool },
+ tooltipDelay: { number: number },
+ zoomView: { boolean: bool },
+ __type__: { object: object }
+ },
+ layout: {
+ randomSeed: { 'undefined': 'undefined', number: number },
+ improvedLayout: { boolean: bool },
+ hierarchical: {
+ enabled: { boolean: bool },
+ levelSeparation: { number: number },
+ nodeSpacing: { number: number },
+ treeSpacing: { number: number },
+ blockShifting: { boolean: bool },
+ edgeMinimization: { boolean: bool },
+ parentCentralization: { boolean: bool },
+ direction: { string: ['UD', 'DU', 'LR', 'RL'] }, // UD, DU, LR, RL
+ sortMethod: { string: ['hubsize', 'directed'] }, // hubsize, directed
+ __type__: { object: object, boolean: bool }
+ },
+ __type__: { object: object }
+ },
+ manipulation: {
+ enabled: { boolean: bool },
+ initiallyActive: { boolean: bool },
+ addNode: { boolean: bool, 'function': 'function' },
+ addEdge: { boolean: bool, 'function': 'function' },
+ editNode: { 'function': 'function' },
+ editEdge: {
+ editWithoutDrag: { 'function': 'function' },
+ __type__: { object: object, boolean: bool, 'function': 'function' }
+ },
+ deleteNode: { boolean: bool, 'function': 'function' },
+ deleteEdge: { boolean: bool, 'function': 'function' },
+ controlNodeStyle: 'get from nodes, will be overwritten below',
+ __type__: { object: object, boolean: bool }
+ },
+ nodes: {
+ borderWidth: { number: number },
+ borderWidthSelected: { number: number, 'undefined': 'undefined' },
+ brokenImage: { string: string, 'undefined': 'undefined' },
+ chosen: {
+ label: { boolean: bool, 'function': 'function' },
+ node: { boolean: bool, 'function': 'function' },
+ __type__: { object: object, boolean: bool }
+ },
+ color: {
+ border: { string: string },
+ background: { string: string },
+ highlight: {
+ border: { string: string },
+ background: { string: string },
+ __type__: { object: object, string: string }
+ },
+ hover: {
+ border: { string: string },
+ background: { string: string },
+ __type__: { object: object, string: string }
+ },
+ __type__: { object: object, string: string }
+ },
+ fixed: {
+ x: { boolean: bool },
+ y: { boolean: bool },
+ __type__: { object: object, boolean: bool }
+ },
+ font: {
+ align: { string: string },
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ background: { string: string },
+ strokeWidth: { number: number }, // px
+ strokeColor: { string: string },
+ vadjust: { number: number },
+ multi: { boolean: bool, string: string },
+ bold: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ mod: { string: string },
+ vadjust: { number: number },
+ __type__: { object: object, string: string }
+ },
+ boldital: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ mod: { string: string },
+ vadjust: { number: number },
+ __type__: { object: object, string: string }
+ },
+ ital: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ mod: { string: string },
+ vadjust: { number: number },
+ __type__: { object: object, string: string }
+ },
+ mono: {
+ color: { string: string },
+ size: { number: number }, // px
+ face: { string: string },
+ mod: { string: string },
+ vadjust: { number: number },
+ __type__: { object: object, string: string }
+ },
+ __type__: { object: object, string: string }
+ },
+ group: { string: string, number: number, 'undefined': 'undefined' },
+ heightConstraint: {
+ minimum: { number: number },
+ valign: { string: string },
+ __type__: { object: object, boolean: bool, number: number }
+ },
+ hidden: { boolean: bool },
+ icon: {
+ face: { string: string },
+ code: { string: string }, //'\uf007',
+ size: { number: number }, //50,
+ color: { string: string },
+ __type__: { object: object }
+ },
+ id: { string: string, number: number },
+ image: { string: string, 'undefined': 'undefined' }, // --> URL
+ label: { string: string, 'undefined': 'undefined' },
+ labelHighlightBold: { boolean: bool },
+ level: { number: number, 'undefined': 'undefined' },
+ margin: {
+ top: { number: number },
+ right: { number: number },
+ bottom: { number: number },
+ left: { number: number },
+ __type__: { object: object, number: number }
+ },
+ mass: { number: number },
+ physics: { boolean: bool },
+ scaling: {
+ min: { number: number },
+ max: { number: number },
+ label: {
+ enabled: { boolean: bool },
+ min: { number: number },
+ max: { number: number },
+ maxVisible: { number: number },
+ drawThreshold: { number: number },
+ __type__: { object: object, boolean: bool }
+ },
+ customScalingFunction: { 'function': 'function' },
+ __type__: { object: object }
+ },
+ shadow: {
+ enabled: { boolean: bool },
+ color: { string: string },
+ size: { number: number },
+ x: { number: number },
+ y: { number: number },
+ __type__: { object: object, boolean: bool }
+ },
+ shape: { string: ['ellipse', 'circle', 'database', 'box', 'text', 'image', 'circularImage', 'diamond', 'dot', 'star', 'triangle', 'triangleDown', 'square', 'icon'] },
+ shapeProperties: {
+ borderDashes: { boolean: bool, array: array },
+ borderRadius: { number: number },
+ interpolation: { boolean: bool },
+ useImageSize: { boolean: bool },
+ useBorderWithImage: { boolean: bool },
+ __type__: { object: object }
+ },
+ size: { number: number },
+ title: { string: string, 'undefined': 'undefined' },
+ value: { number: number, 'undefined': 'undefined' },
+ widthConstraint: {
+ minimum: { number: number },
+ maximum: { number: number },
+ __type__: { object: object, boolean: bool, number: number }
+ },
+ x: { number: number },
+ y: { number: number },
+ __type__: { object: object }
+ },
+ physics: {
+ enabled: { boolean: bool },
+ barnesHut: {
+ gravitationalConstant: { number: number },
+ centralGravity: { number: number },
+ springLength: { number: number },
+ springConstant: { number: number },
+ damping: { number: number },
+ avoidOverlap: { number: number },
+ __type__: { object: object }
+ },
+ forceAtlas2Based: {
+ gravitationalConstant: { number: number },
+ centralGravity: { number: number },
+ springLength: { number: number },
+ springConstant: { number: number },
+ damping: { number: number },
+ avoidOverlap: { number: number },
+ __type__: { object: object }
+ },
+ repulsion: {
+ centralGravity: { number: number },
+ springLength: { number: number },
+ springConstant: { number: number },
+ nodeDistance: { number: number },
+ damping: { number: number },
+ __type__: { object: object }
+ },
+ hierarchicalRepulsion: {
+ centralGravity: { number: number },
+ springLength: { number: number },
+ springConstant: { number: number },
+ nodeDistance: { number: number },
+ damping: { number: number },
+ __type__: { object: object }
+ },
+ maxVelocity: { number: number },
+ minVelocity: { number: number }, // px/s
+ solver: { string: ['barnesHut', 'repulsion', 'hierarchicalRepulsion', 'forceAtlas2Based'] },
+ stabilization: {
+ enabled: { boolean: bool },
+ iterations: { number: number }, // maximum number of iteration to stabilize
+ updateInterval: { number: number },
+ onlyDynamicEdges: { boolean: bool },
+ fit: { boolean: bool },
+ __type__: { object: object, boolean: bool }
+ },
+ timestep: { number: number },
+ adaptiveTimestep: { boolean: bool },
+ __type__: { object: object, boolean: bool }
+ },
+
+ //globals :
+ autoResize: { boolean: bool },
+ clickToUse: { boolean: bool },
+ locale: { string: string },
+ locales: {
+ __any__: { any: any },
+ __type__: { object: object }
+ },
+ height: { string: string },
+ width: { string: string },
+ __type__: { object: object }
+ };
+
+ allOptions.groups.__any__ = allOptions.nodes;
+ allOptions.manipulation.controlNodeStyle = allOptions.nodes;
+
+ var configureOptions = {
+ nodes: {
+ borderWidth: [1, 0, 10, 1],
+ borderWidthSelected: [2, 0, 10, 1],
+ color: {
+ border: ['color', '#2B7CE9'],
+ background: ['color', '#97C2FC'],
+ highlight: {
+ border: ['color', '#2B7CE9'],
+ background: ['color', '#D2E5FF']
+ },
+ hover: {
+ border: ['color', '#2B7CE9'],
+ background: ['color', '#D2E5FF']
+ }
+ },
+ fixed: {
+ x: false,
+ y: false
+ },
+ font: {
+ color: ['color', '#343434'],
+ size: [14, 0, 100, 1], // px
+ face: ['arial', 'verdana', 'tahoma'],
+ background: ['color', 'none'],
+ strokeWidth: [0, 0, 50, 1], // px
+ strokeColor: ['color', '#ffffff']
+ },
+ //group: 'string',
+ hidden: false,
+ labelHighlightBold: true,
+ //icon: {
+ // face: 'string', //'FontAwesome',
+ // code: 'string', //'\uf007',
+ // size: [50, 0, 200, 1], //50,
+ // color: ['color','#2B7CE9'] //'#aa00ff'
+ //},
+ //image: 'string', // --> URL
+ physics: true,
+ scaling: {
+ min: [10, 0, 200, 1],
+ max: [30, 0, 200, 1],
+ label: {
+ enabled: false,
+ min: [14, 0, 200, 1],
+ max: [30, 0, 200, 1],
+ maxVisible: [30, 0, 200, 1],
+ drawThreshold: [5, 0, 20, 1]
+ }
+ },
+ shadow: {
+ enabled: false,
+ color: 'rgba(0,0,0,0.5)',
+ size: [10, 0, 20, 1],
+ x: [5, -30, 30, 1],
+ y: [5, -30, 30, 1]
+ },
+ shape: ['ellipse', 'box', 'circle', 'database', 'diamond', 'dot', 'square', 'star', 'text', 'triangle', 'triangleDown'],
+ shapeProperties: {
+ borderDashes: false,
+ borderRadius: [6, 0, 20, 1],
+ interpolation: true,
+ useImageSize: false
+ },
+ size: [25, 0, 200, 1]
+ },
+ edges: {
+ arrows: {
+ to: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' },
+ middle: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' },
+ from: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' }
+ },
+ arrowStrikethrough: true,
+ color: {
+ color: ['color', '#848484'],
+ highlight: ['color', '#848484'],
+ hover: ['color', '#848484'],
+ inherit: ['from', 'to', 'both', true, false],
+ opacity: [1, 0, 1, 0.05]
+ },
+ dashes: false,
+ font: {
+ color: ['color', '#343434'],
+ size: [14, 0, 100, 1], // px
+ face: ['arial', 'verdana', 'tahoma'],
+ background: ['color', 'none'],
+ strokeWidth: [2, 0, 50, 1], // px
+ strokeColor: ['color', '#ffffff'],
+ align: ['horizontal', 'top', 'middle', 'bottom']
+ },
+ hidden: false,
+ hoverWidth: [1.5, 0, 5, 0.1],
+ labelHighlightBold: true,
+ physics: true,
+ scaling: {
+ min: [1, 0, 100, 1],
+ max: [15, 0, 100, 1],
+ label: {
+ enabled: true,
+ min: [14, 0, 200, 1],
+ max: [30, 0, 200, 1],
+ maxVisible: [30, 0, 200, 1],
+ drawThreshold: [5, 0, 20, 1]
+ }
+ },
+ selectionWidth: [1.5, 0, 5, 0.1],
+ selfReferenceSize: [20, 0, 200, 1],
+ shadow: {
+ enabled: false,
+ color: 'rgba(0,0,0,0.5)',
+ size: [10, 0, 20, 1],
+ x: [5, -30, 30, 1],
+ y: [5, -30, 30, 1]
+ },
+ smooth: {
+ enabled: true,
+ type: ['dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'],
+ forceDirection: ['horizontal', 'vertical', 'none'],
+ roundness: [0.5, 0, 1, 0.05]
+ },
+ width: [1, 0, 30, 1]
+ },
+ layout: {
+ //randomSeed: [0, 0, 500, 1],
+ //improvedLayout: true,
+ hierarchical: {
+ enabled: false,
+ levelSeparation: [150, 20, 500, 5],
+ nodeSpacing: [100, 20, 500, 5],
+ treeSpacing: [200, 20, 500, 5],
+ blockShifting: true,
+ edgeMinimization: true,
+ parentCentralization: true,
+ direction: ['UD', 'DU', 'LR', 'RL'], // UD, DU, LR, RL
+ sortMethod: ['hubsize', 'directed'] // hubsize, directed
+ }
+ },
+ interaction: {
+ dragNodes: true,
+ dragView: true,
+ hideEdgesOnDrag: false,
+ hideNodesOnDrag: false,
+ hover: false,
+ keyboard: {
+ enabled: false,
+ speed: { x: [10, 0, 40, 1], y: [10, 0, 40, 1], zoom: [0.02, 0, 0.1, 0.005] },
+ bindToWindow: true
+ },
+ multiselect: false,
+ navigationButtons: false,
+ selectable: true,
+ selectConnectedEdges: true,
+ hoverConnectedEdges: true,
+ tooltipDelay: [300, 0, 1000, 25],
+ zoomView: true
+ },
+ manipulation: {
+ enabled: false,
+ initiallyActive: false
+ },
+ physics: {
+ enabled: true,
+ barnesHut: {
+ //theta: [0.5, 0.1, 1, 0.05],
+ gravitationalConstant: [-2000, -30000, 0, 50],
+ centralGravity: [0.3, 0, 10, 0.05],
+ springLength: [95, 0, 500, 5],
+ springConstant: [0.04, 0, 1.2, 0.005],
+ damping: [0.09, 0, 1, 0.01],
+ avoidOverlap: [0, 0, 1, 0.01]
+ },
+ forceAtlas2Based: {
+ //theta: [0.5, 0.1, 1, 0.05],
+ gravitationalConstant: [-50, -500, 0, 1],
+ centralGravity: [0.01, 0, 1, 0.005],
+ springLength: [95, 0, 500, 5],
+ springConstant: [0.08, 0, 1.2, 0.005],
+ damping: [0.4, 0, 1, 0.01],
+ avoidOverlap: [0, 0, 1, 0.01]
+ },
+ repulsion: {
+ centralGravity: [0.2, 0, 10, 0.05],
+ springLength: [200, 0, 500, 5],
+ springConstant: [0.05, 0, 1.2, 0.005],
+ nodeDistance: [100, 0, 500, 5],
+ damping: [0.09, 0, 1, 0.01]
+ },
+ hierarchicalRepulsion: {
+ centralGravity: [0.2, 0, 10, 0.05],
+ springLength: [100, 0, 500, 5],
+ springConstant: [0.01, 0, 1.2, 0.005],
+ nodeDistance: [120, 0, 500, 5],
+ damping: [0.09, 0, 1, 0.01]
+ },
+ maxVelocity: [50, 0, 150, 1],
+ minVelocity: [0.1, 0.01, 0.5, 0.01],
+ solver: ['barnesHut', 'forceAtlas2Based', 'repulsion', 'hierarchicalRepulsion'],
+ timestep: [0.5, 0.01, 1, 0.01]
+ }
+ };
+
+ exports.allOptions = allOptions;
+ exports.configureOptions = configureOptions;
+
+/***/ },
+/* 221 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _slicedToArray2 = __webpack_require__(161);
+
+ var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ var _FloydWarshall = __webpack_require__(222);
+
+ var _FloydWarshall2 = _interopRequireDefault(_FloydWarshall);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ /**
+ * KamadaKawai positions the nodes initially based on
+ *
+ * "AN ALGORITHM FOR DRAWING GENERAL UNDIRECTED GRAPHS"
+ * -- Tomihisa KAMADA and Satoru KAWAI in 1989
+ *
+ * Possible optimizations in the distance calculation can be implemented.
+ */
+ var KamadaKawai = function () {
+ function KamadaKawai(body, edgeLength, edgeStrength) {
+ (0, _classCallCheck3["default"])(this, KamadaKawai);
+
+ this.body = body;
+ this.springLength = edgeLength;
+ this.springConstant = edgeStrength;
+ this.distanceSolver = new _FloydWarshall2["default"]();
+ }
+
+ /**
+ * Not sure if needed but can be used to update the spring length and spring constant
+ * @param options
+ */
+
+
+ (0, _createClass3["default"])(KamadaKawai, [{
+ key: "setOptions",
+ value: function setOptions(options) {
+ if (options) {
+ if (options.springLength) {
+ this.springLength = options.springLength;
+ }
+ if (options.springConstant) {
+ this.springConstant = options.springConstant;
+ }
+ }
+ }
+
+ /**
+ * Position the system
+ * @param nodesArray
+ * @param edgesArray
+ */
+
+ }, {
+ key: "solve",
+ value: function solve(nodesArray, edgesArray) {
+ var ignoreClusters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ // get distance matrix
+ var D_matrix = this.distanceSolver.getDistances(this.body, nodesArray, edgesArray); // distance matrix
+
+ // get the L Matrix
+ this._createL_matrix(D_matrix);
+
+ // get the K Matrix
+ this._createK_matrix(D_matrix);
+
+ // calculate positions
+ var threshold = 0.01;
+ var innerThreshold = 1;
+ var iterations = 0;
+ var maxIterations = Math.max(1000, Math.min(10 * this.body.nodeIndices.length, 6000));
+ var maxInnerIterations = 5;
+
+ var maxEnergy = 1e9;
+ var highE_nodeId = 0,
+ dE_dx = 0,
+ dE_dy = 0,
+ delta_m = 0,
+ subIterations = 0;
+
+ while (maxEnergy > threshold && iterations < maxIterations) {
+ iterations += 1;
+
+ var _getHighestEnergyNode2 = this._getHighestEnergyNode(ignoreClusters);
+
+ var _getHighestEnergyNode3 = (0, _slicedToArray3["default"])(_getHighestEnergyNode2, 4);
+
+ highE_nodeId = _getHighestEnergyNode3[0];
+ maxEnergy = _getHighestEnergyNode3[1];
+ dE_dx = _getHighestEnergyNode3[2];
+ dE_dy = _getHighestEnergyNode3[3];
+
+ delta_m = maxEnergy;
+ subIterations = 0;
+ while (delta_m > innerThreshold && subIterations < maxInnerIterations) {
+ subIterations += 1;
+ this._moveNode(highE_nodeId, dE_dx, dE_dy);
+
+ var _getEnergy2 = this._getEnergy(highE_nodeId);
+
+ var _getEnergy3 = (0, _slicedToArray3["default"])(_getEnergy2, 3);
+
+ delta_m = _getEnergy3[0];
+ dE_dx = _getEnergy3[1];
+ dE_dy = _getEnergy3[2];
+ }
+ }
+ }
+
+ /**
+ * get the node with the highest energy
+ * @returns {*[]}
+ * @private
+ */
+
+ }, {
+ key: "_getHighestEnergyNode",
+ value: function _getHighestEnergyNode(ignoreClusters) {
+ var nodesArray = this.body.nodeIndices;
+ var nodes = this.body.nodes;
+ var maxEnergy = 0;
+ var maxEnergyNodeId = nodesArray[0];
+ var dE_dx_max = 0,
+ dE_dy_max = 0;
+
+ for (var nodeIdx = 0; nodeIdx < nodesArray.length; nodeIdx++) {
+ var m = nodesArray[nodeIdx];
+ // by not evaluating nodes with predefined positions we should only move nodes that have no positions.
+ if (nodes[m].predefinedPosition === false || nodes[m].isCluster === true && ignoreClusters === true || nodes[m].options.fixed.x === true || nodes[m].options.fixed.y === true) {
+ var _getEnergy4 = this._getEnergy(m),
+ _getEnergy5 = (0, _slicedToArray3["default"])(_getEnergy4, 3),
+ delta_m = _getEnergy5[0],
+ dE_dx = _getEnergy5[1],
+ dE_dy = _getEnergy5[2];
+
+ if (maxEnergy < delta_m) {
+ maxEnergy = delta_m;
+ maxEnergyNodeId = m;
+ dE_dx_max = dE_dx;
+ dE_dy_max = dE_dy;
+ }
+ }
+ }
+
+ return [maxEnergyNodeId, maxEnergy, dE_dx_max, dE_dy_max];
+ }
+
+ /**
+ * calculate the energy of a single node
+ * @param m
+ * @returns {*[]}
+ * @private
+ */
+
+ }, {
+ key: "_getEnergy",
+ value: function _getEnergy(m) {
+ var nodesArray = this.body.nodeIndices;
+ var nodes = this.body.nodes;
+
+ var x_m = nodes[m].x;
+ var y_m = nodes[m].y;
+ var dE_dx = 0;
+ var dE_dy = 0;
+ for (var iIdx = 0; iIdx < nodesArray.length; iIdx++) {
+ var i = nodesArray[iIdx];
+ if (i !== m) {
+ var x_i = nodes[i].x;
+ var y_i = nodes[i].y;
+ var denominator = 1.0 / Math.sqrt(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2));
+ dE_dx += this.K_matrix[m][i] * (x_m - x_i - this.L_matrix[m][i] * (x_m - x_i) * denominator);
+ dE_dy += this.K_matrix[m][i] * (y_m - y_i - this.L_matrix[m][i] * (y_m - y_i) * denominator);
+ }
+ }
+
+ var delta_m = Math.sqrt(Math.pow(dE_dx, 2) + Math.pow(dE_dy, 2));
+ return [delta_m, dE_dx, dE_dy];
+ }
+
+ /**
+ * move the node based on it's energy
+ * the dx and dy are calculated from the linear system proposed by Kamada and Kawai
+ * @param m
+ * @param dE_dx
+ * @param dE_dy
+ * @private
+ */
+
+ }, {
+ key: "_moveNode",
+ value: function _moveNode(m, dE_dx, dE_dy) {
+ var nodesArray = this.body.nodeIndices;
+ var nodes = this.body.nodes;
+ var d2E_dx2 = 0;
+ var d2E_dxdy = 0;
+ var d2E_dy2 = 0;
+
+ var x_m = nodes[m].x;
+ var y_m = nodes[m].y;
+ for (var iIdx = 0; iIdx < nodesArray.length; iIdx++) {
+ var i = nodesArray[iIdx];
+ if (i !== m) {
+ var x_i = nodes[i].x;
+ var y_i = nodes[i].y;
+ var denominator = 1.0 / Math.pow(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2), 1.5);
+ d2E_dx2 += this.K_matrix[m][i] * (1 - this.L_matrix[m][i] * Math.pow(y_m - y_i, 2) * denominator);
+ d2E_dxdy += this.K_matrix[m][i] * (this.L_matrix[m][i] * (x_m - x_i) * (y_m - y_i) * denominator);
+ d2E_dy2 += this.K_matrix[m][i] * (1 - this.L_matrix[m][i] * Math.pow(x_m - x_i, 2) * denominator);
+ }
+ }
+ // make the variable names easier to make the solving of the linear system easier to read
+ var A = d2E_dx2,
+ B = d2E_dxdy,
+ C = dE_dx,
+ D = d2E_dy2,
+ E = dE_dy;
+
+ // solve the linear system for dx and dy
+ var dy = (C / A + E / B) / (B / A - D / B);
+ var dx = -(B * dy + C) / A;
+
+ // move the node
+ nodes[m].x += dx;
+ nodes[m].y += dy;
+ }
+
+ /**
+ * Create the L matrix: edge length times shortest path
+ * @param D_matrix
+ * @private
+ */
+
+ }, {
+ key: "_createL_matrix",
+ value: function _createL_matrix(D_matrix) {
+ var nodesArray = this.body.nodeIndices;
+ var edgeLength = this.springLength;
+
+ this.L_matrix = [];
+ for (var i = 0; i < nodesArray.length; i++) {
+ this.L_matrix[nodesArray[i]] = {};
+ for (var j = 0; j < nodesArray.length; j++) {
+ this.L_matrix[nodesArray[i]][nodesArray[j]] = edgeLength * D_matrix[nodesArray[i]][nodesArray[j]];
+ }
+ }
+ }
+
+ /**
+ * Create the K matrix: spring constants times shortest path
+ * @param D_matrix
+ * @private
+ */
+
+ }, {
+ key: "_createK_matrix",
+ value: function _createK_matrix(D_matrix) {
+ var nodesArray = this.body.nodeIndices;
+ var edgeStrength = this.springConstant;
+
+ this.K_matrix = [];
+ for (var i = 0; i < nodesArray.length; i++) {
+ this.K_matrix[nodesArray[i]] = {};
+ for (var j = 0; j < nodesArray.length; j++) {
+ this.K_matrix[nodesArray[i]][nodesArray[j]] = edgeStrength * Math.pow(D_matrix[nodesArray[i]][nodesArray[j]], -2);
+ }
+ }
+ }
+ }]);
+ return KamadaKawai;
+ }(); // distance finding algorithm
+
+
+ exports["default"] = KamadaKawai;
+
+/***/ },
+/* 222 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _classCallCheck2 = __webpack_require__(115);
+
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
+
+ var _createClass2 = __webpack_require__(116);
+
+ var _createClass3 = _interopRequireDefault(_createClass2);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ /**
+ * Created by Alex on 10-Aug-15.
+ */
+
+ var FloydWarshall = function () {
+ function FloydWarshall() {
+ (0, _classCallCheck3["default"])(this, FloydWarshall);
+ }
+
+ (0, _createClass3["default"])(FloydWarshall, [{
+ key: "getDistances",
+ value: function getDistances(body, nodesArray, edgesArray) {
+ var D_matrix = {};
+ var edges = body.edges;
+
+ // prepare matrix with large numbers
+ for (var i = 0; i < nodesArray.length; i++) {
+ D_matrix[nodesArray[i]] = {};
+ D_matrix[nodesArray[i]] = {};
+ for (var j = 0; j < nodesArray.length; j++) {
+ D_matrix[nodesArray[i]][nodesArray[j]] = i == j ? 0 : 1e9;
+ D_matrix[nodesArray[i]][nodesArray[j]] = i == j ? 0 : 1e9;
+ }
+ }
+
+ // put the weights for the edges in. This assumes unidirectionality.
+ for (var _i = 0; _i < edgesArray.length; _i++) {
+ var edge = edges[edgesArray[_i]];
+ // edge has to be connected if it counts to the distances. If it is connected to inner clusters it will crash so we also check if it is in the D_matrix
+ if (edge.connected === true && D_matrix[edge.fromId] !== undefined && D_matrix[edge.toId] !== undefined) {
+ D_matrix[edge.fromId][edge.toId] = 1;
+ D_matrix[edge.toId][edge.fromId] = 1;
+ }
+ }
+
+ var nodeCount = nodesArray.length;
+
+ // Adapted FloydWarshall based on unidirectionality to greatly reduce complexity.
+ for (var k = 0; k < nodeCount; k++) {
+ for (var _i2 = 0; _i2 < nodeCount - 1; _i2++) {
+ for (var _j = _i2 + 1; _j < nodeCount; _j++) {
+ D_matrix[nodesArray[_i2]][nodesArray[_j]] = Math.min(D_matrix[nodesArray[_i2]][nodesArray[_j]], D_matrix[nodesArray[_i2]][nodesArray[k]] + D_matrix[nodesArray[k]][nodesArray[_j]]);
+ D_matrix[nodesArray[_j]][nodesArray[_i2]] = D_matrix[nodesArray[_i2]][nodesArray[_j]];
+ }
+ }
+ }
+
+ return D_matrix;
+ }
+ }]);
+ return FloydWarshall;
+ }();
+
+ exports["default"] = FloydWarshall;
+
+/***/ },
+/* 223 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ /**
+ * Canvas shapes used by Network
+ */
+ if (typeof CanvasRenderingContext2D !== 'undefined') {
+
+ /**
+ * Draw a circle shape
+ */
+ CanvasRenderingContext2D.prototype.circle = function (x, y, r) {
+ this.beginPath();
+ this.arc(x, y, r, 0, 2 * Math.PI, false);
+ this.closePath();
+ };
+
+ /**
+ * Draw a square shape
+ * @param {Number} x horizontal center
+ * @param {Number} y vertical center
+ * @param {Number} r size, width and height of the square
+ */
+ CanvasRenderingContext2D.prototype.square = function (x, y, r) {
+ this.beginPath();
+ this.rect(x - r, y - r, r * 2, r * 2);
+ this.closePath();
+ };
+
+ /**
+ * Draw a triangle shape
+ * @param {Number} x horizontal center
+ * @param {Number} y vertical center
+ * @param {Number} r radius, half the length of the sides of the triangle
+ */
+ CanvasRenderingContext2D.prototype.triangle = function (x, y, r) {
+ // http://en.wikipedia.org/wiki/Equilateral_triangle
+ this.beginPath();
+
+ // the change in radius and the offset is here to center the shape
+ r *= 1.15;
+ y += 0.275 * r;
+
+ var s = r * 2;
+ var s2 = s / 2;
+ var ir = Math.sqrt(3) / 6 * s; // radius of inner circle
+ var h = Math.sqrt(s * s - s2 * s2); // height
+
+
+ this.moveTo(x, y - (h - ir));
+ this.lineTo(x + s2, y + ir);
+ this.lineTo(x - s2, y + ir);
+ this.lineTo(x, y - (h - ir));
+ this.closePath();
+ };
+
+ /**
+ * Draw a triangle shape in downward orientation
+ * @param {Number} x horizontal center
+ * @param {Number} y vertical center
+ * @param {Number} r radius
+ */
+ CanvasRenderingContext2D.prototype.triangleDown = function (x, y, r) {
+ // http://en.wikipedia.org/wiki/Equilateral_triangle
+ this.beginPath();
+
+ // the change in radius and the offset is here to center the shape
+ r *= 1.15;
+ y -= 0.275 * r;
+
+ var s = r * 2;
+ var s2 = s / 2;
+ var ir = Math.sqrt(3) / 6 * s; // radius of inner circle
+ var h = Math.sqrt(s * s - s2 * s2); // height
+
+ this.moveTo(x, y + (h - ir));
+ this.lineTo(x + s2, y - ir);
+ this.lineTo(x - s2, y - ir);
+ this.lineTo(x, y + (h - ir));
+ this.closePath();
+ };
+
+ /**
+ * Draw a star shape, a star with 5 points
+ * @param {Number} x horizontal center
+ * @param {Number} y vertical center
+ * @param {Number} r radius, half the length of the sides of the triangle
+ */
+ CanvasRenderingContext2D.prototype.star = function (x, y, r) {
+ // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/
+ this.beginPath();
+
+ // the change in radius and the offset is here to center the shape
+ r *= 0.82;
+ y += 0.1 * r;
+
+ for (var n = 0; n < 10; n++) {
+ var radius = n % 2 === 0 ? r * 1.3 : r * 0.5;
+ this.lineTo(x + radius * Math.sin(n * 2 * Math.PI / 10), y - radius * Math.cos(n * 2 * Math.PI / 10));
+ }
+
+ this.closePath();
+ };
+
+ /**
+ * Draw a Diamond shape
+ * @param {Number} x horizontal center
+ * @param {Number} y vertical center
+ * @param {Number} r radius, half the length of the sides of the triangle
+ */
+ CanvasRenderingContext2D.prototype.diamond = function (x, y, r) {
+ // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/
+ this.beginPath();
+
+ this.lineTo(x, y + r);
+ this.lineTo(x + r, y);
+ this.lineTo(x, y - r);
+ this.lineTo(x - r, y);
+
+ this.closePath();
+ };
+
+ /**
+ * http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas
+ */
+ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
+ var r2d = Math.PI / 180;
+ if (w - 2 * r < 0) {
+ r = w / 2;
+ } //ensure that the radius isn't too large for x
+ if (h - 2 * r < 0) {
+ r = h / 2;
+ } //ensure that the radius isn't too large for y
+ this.beginPath();
+ this.moveTo(x + r, y);
+ this.lineTo(x + w - r, y);
+ this.arc(x + w - r, y + r, r, r2d * 270, r2d * 360, false);
+ this.lineTo(x + w, y + h - r);
+ this.arc(x + w - r, y + h - r, r, 0, r2d * 90, false);
+ this.lineTo(x + r, y + h);
+ this.arc(x + r, y + h - r, r, r2d * 90, r2d * 180, false);
+ this.lineTo(x, y + r);
+ this.arc(x + r, y + r, r, r2d * 180, r2d * 270, false);
+ this.closePath();
+ };
+
+ /**
+ * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
+ */
+ CanvasRenderingContext2D.prototype.ellipse = function (x, y, w, h) {
+ var kappa = .5522848,
+ ox = w / 2 * kappa,
+ // control point offset horizontal
+ oy = h / 2 * kappa,
+ // control point offset vertical
+ xe = x + w,
+ // x-end
+ ye = y + h,
+ // y-end
+ xm = x + w / 2,
+ // x-middle
+ ym = y + h / 2; // y-middle
+
+ this.beginPath();
+ this.moveTo(x, ym);
+ this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
+ this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
+ this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
+ this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
+ this.closePath();
+ };
+
+ /**
+ * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
+ */
+ CanvasRenderingContext2D.prototype.database = function (x, y, w, h) {
+ var f = 1 / 3;
+ var wEllipse = w;
+ var hEllipse = h * f;
+
+ var kappa = .5522848,
+ ox = wEllipse / 2 * kappa,
+ // control point offset horizontal
+ oy = hEllipse / 2 * kappa,
+ // control point offset vertical
+ xe = x + wEllipse,
+ // x-end
+ ye = y + hEllipse,
+ // y-end
+ xm = x + wEllipse / 2,
+ // x-middle
+ ym = y + hEllipse / 2,
+ // y-middle
+ ymb = y + (h - hEllipse / 2),
+ // y-midlle, bottom ellipse
+ yeb = y + h; // y-end, bottom ellipse
+
+ this.beginPath();
+ this.moveTo(xe, ym);
+
+ this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
+ this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
+
+ this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
+ this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
+
+ this.lineTo(xe, ymb);
+
+ this.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb);
+ this.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb);
+
+ this.lineTo(x, ym);
+ };
+
+ /**
+ * Draw an arrow at the end of a line with the given angle.
+ */
+ CanvasRenderingContext2D.prototype.arrowEndpoint = function (x, y, angle, length) {
+ // tail
+ var xt = x - length * Math.cos(angle);
+ var yt = y - length * Math.sin(angle);
+
+ // inner tail
+ var xi = x - length * 0.9 * Math.cos(angle);
+ var yi = y - length * 0.9 * Math.sin(angle);
+
+ // left
+ var xl = xt + length / 3 * Math.cos(angle + 0.5 * Math.PI);
+ var yl = yt + length / 3 * Math.sin(angle + 0.5 * Math.PI);
+
+ // right
+ var xr = xt + length / 3 * Math.cos(angle - 0.5 * Math.PI);
+ var yr = yt + length / 3 * Math.sin(angle - 0.5 * Math.PI);
+
+ this.beginPath();
+ this.moveTo(x, y);
+ this.lineTo(xl, yl);
+ this.lineTo(xi, yi);
+ this.lineTo(xr, yr);
+ this.closePath();
+ };
+
+ /**
+ * Draw an circle an the end of an line with the given angle.
+ */
+ CanvasRenderingContext2D.prototype.circleEndpoint = function (x, y, angle, length) {
+ var radius = length * 0.4;
+ var xc = x - radius * Math.cos(angle);
+ var yc = y - radius * Math.sin(angle);
+ this.circle(xc, yc, radius);
+ };
+
+ /**
+ * Sets up the dashedLine functionality for drawing
+ * Original code came from http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas
+ * @author David Jordan
+ * @date 2012-08-08
+ */
+ CanvasRenderingContext2D.prototype.dashedLine = function (x, y, x2, y2, pattern) {
+ this.beginPath();
+ this.moveTo(x, y);
+
+ var patternLength = pattern.length;
+ var dx = x2 - x;
+ var dy = y2 - y;
+ var slope = dy / dx;
+ var distRemaining = Math.sqrt(dx * dx + dy * dy);
+ var patternIndex = 0;
+ var draw = true;
+ var xStep = 0;
+ var dashLength = pattern[0];
+
+ while (distRemaining >= 0.1) {
+ dashLength = pattern[patternIndex++ % patternLength];
+ if (dashLength > distRemaining) {
+ dashLength = distRemaining;
+ }
+
+ xStep = Math.sqrt(dashLength * dashLength / (1 + slope * slope));
+ xStep = dx < 0 ? -xStep : xStep;
+ x += xStep;
+ y += slope * xStep;
+
+ if (draw === true) {
+ this.lineTo(x, y);
+ } else {
+ this.moveTo(x, y);
+ }
+
+ distRemaining -= dashLength;
+ draw = !draw;
+ }
+ };
+ }
+
+/***/ },
+/* 224 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _create = __webpack_require__(55);
+
+ var _create2 = _interopRequireDefault(_create);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ /**
+ * Parse a text source containing data in DOT language into a JSON object.
+ * The object contains two lists: one with nodes and one with edges.
+ *
+ * DOT language reference: http://www.graphviz.org/doc/info/lang.html
+ *
+ * DOT language attributes: http://graphviz.org/content/attrs
+ *
+ * @param {String} data Text containing a graph in DOT-notation
+ * @return {Object} graph An object containing two parameters:
+ * {Object[]} nodes
+ * {Object[]} edges
+ */
+ function parseDOT(data) {
+ dot = data;
+ return parseGraph();
+ }
+
+ // mapping of attributes from DOT (the keys) to vis.js (the values)
+ var NODE_ATTR_MAPPING = {
+ 'fontsize': 'font.size',
+ 'fontcolor': 'font.color',
+ 'labelfontcolor': 'font.color',
+ 'fontname': 'font.face',
+ 'color': ['color.border', 'color.background'],
+ 'fillcolor': 'color.background',
+ 'tooltip': 'title',
+ 'labeltooltip': 'title'
+ };
+ var EDGE_ATTR_MAPPING = (0, _create2['default'])(NODE_ATTR_MAPPING);
+ EDGE_ATTR_MAPPING.color = 'color.color';
+
+ // token types enumeration
+ var TOKENTYPE = {
+ NULL: 0,
+ DELIMITER: 1,
+ IDENTIFIER: 2,
+ UNKNOWN: 3
+ };
+
+ // map with all delimiters
+ var DELIMITERS = {
+ '{': true,
+ '}': true,
+ '[': true,
+ ']': true,
+ ';': true,
+ '=': true,
+ ',': true,
+
+ '->': true,
+ '--': true
+ };
+
+ var dot = ''; // current dot file
+ var index = 0; // current index in dot file
+ var c = ''; // current token character in expr
+ var token = ''; // current token
+ var tokenType = TOKENTYPE.NULL; // type of the token
+
+ /**
+ * Get the first character from the dot file.
+ * The character is stored into the char c. If the end of the dot file is
+ * reached, the function puts an empty string in c.
+ */
+ function first() {
+ index = 0;
+ c = dot.charAt(0);
+ }
+
+ /**
+ * Get the next character from the dot file.
+ * The character is stored into the char c. If the end of the dot file is
+ * reached, the function puts an empty string in c.
+ */
+ function next() {
+ index++;
+ c = dot.charAt(index);
+ }
+
+ /**
+ * Preview the next character from the dot file.
+ * @return {String} cNext
+ */
+ function nextPreview() {
+ return dot.charAt(index + 1);
+ }
+
+ /**
+ * Test whether given character is alphabetic or numeric
+ * @param {String} c
+ * @return {Boolean} isAlphaNumeric
+ */
+ var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/;
+ function isAlphaNumeric(c) {
+ return regexAlphaNumeric.test(c);
+ }
+
+ /**
+ * Merge all options of object b into object b
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Object} a
+ */
+ function merge(a, b) {
+ if (!a) {
+ a = {};
+ }
+
+ if (b) {
+ for (var name in b) {
+ if (b.hasOwnProperty(name)) {
+ a[name] = b[name];
+ }
+ }
+ }
+ return a;
+ }
+
+ /**
+ * Set a value in an object, where the provided parameter name can be a
+ * path with nested parameters. For example:
+ *
+ * var obj = {a: 2};
+ * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}}
+ *
+ * @param {Object} obj
+ * @param {String} path A parameter name or dot-separated parameter path,
+ * like "color.highlight.border".
+ * @param {*} value
+ */
+ function setValue(obj, path, value) {
+ var keys = path.split('.');
+ var o = obj;
+ while (keys.length) {
+ var key = keys.shift();
+ if (keys.length) {
+ // this isn't the end point
+ if (!o[key]) {
+ o[key] = {};
+ }
+ o = o[key];
+ } else {
+ // this is the end point
+ o[key] = value;
+ }
+ }
+ }
+
+ /**
+ * Add a node to a graph object. If there is already a node with
+ * the same id, their attributes will be merged.
+ * @param {Object} graph
+ * @param {Object} node
+ */
+ function addNode(graph, node) {
+ var i, len;
+ var current = null;
+
+ // find root graph (in case of subgraph)
+ var graphs = [graph]; // list with all graphs from current graph to root graph
+ var root = graph;
+ while (root.parent) {
+ graphs.push(root.parent);
+ root = root.parent;
+ }
+
+ // find existing node (at root level) by its id
+ if (root.nodes) {
+ for (i = 0, len = root.nodes.length; i < len; i++) {
+ if (node.id === root.nodes[i].id) {
+ current = root.nodes[i];
+ break;
+ }
+ }
+ }
+
+ if (!current) {
+ // this is a new node
+ current = {
+ id: node.id
+ };
+ if (graph.node) {
+ // clone default attributes
+ current.attr = merge(current.attr, graph.node);
+ }
+ }
+
+ // add node to this (sub)graph and all its parent graphs
+ for (i = graphs.length - 1; i >= 0; i--) {
+ var g = graphs[i];
+
+ if (!g.nodes) {
+ g.nodes = [];
+ }
+ if (g.nodes.indexOf(current) === -1) {
+ g.nodes.push(current);
+ }
+ }
+
+ // merge attributes
+ if (node.attr) {
+ current.attr = merge(current.attr, node.attr);
+ }
+ }
+
+ /**
+ * Add an edge to a graph object
+ * @param {Object} graph
+ * @param {Object} edge
+ */
+ function addEdge(graph, edge) {
+ if (!graph.edges) {
+ graph.edges = [];
+ }
+ graph.edges.push(edge);
+ if (graph.edge) {
+ var attr = merge({}, graph.edge); // clone default attributes
+ edge.attr = merge(attr, edge.attr); // merge attributes
+ }
+ }
+
+ /**
+ * Create an edge to a graph object
+ * @param {Object} graph
+ * @param {String | Number | Object} from
+ * @param {String | Number | Object} to
+ * @param {String} type
+ * @param {Object | null} attr
+ * @return {Object} edge
+ */
+ function createEdge(graph, from, to, type, attr) {
+ var edge = {
+ from: from,
+ to: to,
+ type: type
+ };
+
+ if (graph.edge) {
+ edge.attr = merge({}, graph.edge); // clone default attributes
+ }
+ edge.attr = merge(edge.attr || {}, attr); // merge attributes
+
+ return edge;
+ }
+
+ /**
+ * Get next token in the current dot file.
+ * The token and token type are available as token and tokenType
+ */
+ function getToken() {
+ tokenType = TOKENTYPE.NULL;
+ token = '';
+
+ // skip over whitespaces
+ while (c === ' ' || c === '\t' || c === '\n' || c === '\r') {
+ // space, tab, enter
+ next();
+ }
+
+ do {
+ var isComment = false;
+
+ // skip comment
+ if (c === '#') {
+ // find the previous non-space character
+ var i = index - 1;
+ while (dot.charAt(i) === ' ' || dot.charAt(i) === '\t') {
+ i--;
+ }
+ if (dot.charAt(i) === '\n' || dot.charAt(i) === '') {
+ // the # is at the start of a line, this is indeed a line comment
+ while (c != '' && c != '\n') {
+ next();
+ }
+ isComment = true;
+ }
+ }
+ if (c === '/' && nextPreview() === '/') {
+ // skip line comment
+ while (c != '' && c != '\n') {
+ next();
+ }
+ isComment = true;
+ }
+ if (c === '/' && nextPreview() === '*') {
+ // skip block comment
+ while (c != '') {
+ if (c === '*' && nextPreview() === '/') {
+ // end of block comment found. skip these last two characters
+ next();
+ next();
+ break;
+ } else {
+ next();
+ }
+ }
+ isComment = true;
+ }
+
+ // skip over whitespaces
+ while (c === ' ' || c === '\t' || c === '\n' || c === '\r') {
+ // space, tab, enter
+ next();
+ }
+ } while (isComment);
+
+ // check for end of dot file
+ if (c === '') {
+ // token is still empty
+ tokenType = TOKENTYPE.DELIMITER;
+ return;
+ }
+
+ // check for delimiters consisting of 2 characters
+ var c2 = c + nextPreview();
+ if (DELIMITERS[c2]) {
+ tokenType = TOKENTYPE.DELIMITER;
+ token = c2;
+ next();
+ next();
+ return;
+ }
+
+ // check for delimiters consisting of 1 character
+ if (DELIMITERS[c]) {
+ tokenType = TOKENTYPE.DELIMITER;
+ token = c;
+ next();
+ return;
+ }
+
+ // check for an identifier (number or string)
+ // TODO: more precise parsing of numbers/strings (and the port separator ':')
+ if (isAlphaNumeric(c) || c === '-') {
+ token += c;
+ next();
+
+ while (isAlphaNumeric(c)) {
+ token += c;
+ next();
+ }
+ if (token === 'false') {
+ token = false; // convert to boolean
+ } else if (token === 'true') {
+ token = true; // convert to boolean
+ } else if (!isNaN(Number(token))) {
+ token = Number(token); // convert to number
+ }
+ tokenType = TOKENTYPE.IDENTIFIER;
+ return;
+ }
+
+ // check for a string enclosed by double quotes
+ if (c === '"') {
+ next();
+ while (c != '' && (c != '"' || c === '"' && nextPreview() === '"')) {
+ token += c;
+ if (c === '"') {
+ // skip the escape character
+ next();
+ }
+ next();
+ }
+ if (c != '"') {
+ throw newSyntaxError('End of string " expected');
+ }
+ next();
+ tokenType = TOKENTYPE.IDENTIFIER;
+ return;
+ }
+
+ // something unknown is found, wrong characters, a syntax error
+ tokenType = TOKENTYPE.UNKNOWN;
+ while (c != '') {
+ token += c;
+ next();
+ }
+ throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"');
+ }
+
+ /**
+ * Parse a graph.
+ * @returns {Object} graph
+ */
+ function parseGraph() {
+ var graph = {};
+
+ first();
+ getToken();
+
+ // optional strict keyword
+ if (token === 'strict') {
+ graph.strict = true;
+ getToken();
+ }
+
+ // graph or digraph keyword
+ if (token === 'graph' || token === 'digraph') {
+ graph.type = token;
+ getToken();
+ }
+
+ // optional graph id
+ if (tokenType === TOKENTYPE.IDENTIFIER) {
+ graph.id = token;
+ getToken();
+ }
+
+ // open angle bracket
+ if (token != '{') {
+ throw newSyntaxError('Angle bracket { expected');
+ }
+ getToken();
+
+ // statements
+ parseStatements(graph);
+
+ // close angle bracket
+ if (token != '}') {
+ throw newSyntaxError('Angle bracket } expected');
+ }
+ getToken();
+
+ // end of file
+ if (token !== '') {
+ throw newSyntaxError('End of file expected');
+ }
+ getToken();
+
+ // remove temporary default options
+ delete graph.node;
+ delete graph.edge;
+ delete graph.graph;
+
+ return graph;
+ }
+
+ /**
+ * Parse a list with statements.
+ * @param {Object} graph
+ */
+ function parseStatements(graph) {
+ while (token !== '' && token != '}') {
+ parseStatement(graph);
+ if (token === ';') {
+ getToken();
+ }
+ }
+ }
+
+ /**
+ * Parse a single statement. Can be a an attribute statement, node
+ * statement, a series of node statements and edge statements, or a
+ * parameter.
+ * @param {Object} graph
+ */
+ function parseStatement(graph) {
+ // parse subgraph
+ var subgraph = parseSubgraph(graph);
+ if (subgraph) {
+ // edge statements
+ parseEdge(graph, subgraph);
+
+ return;
+ }
+
+ // parse an attribute statement
+ var attr = parseAttributeStatement(graph);
+ if (attr) {
+ return;
+ }
+
+ // parse node
+ if (tokenType != TOKENTYPE.IDENTIFIER) {
+ throw newSyntaxError('Identifier expected');
+ }
+ var id = token; // id can be a string or a number
+ getToken();
+
+ if (token === '=') {
+ // id statement
+ getToken();
+ if (tokenType != TOKENTYPE.IDENTIFIER) {
+ throw newSyntaxError('Identifier expected');
+ }
+ graph[id] = token;
+ getToken();
+ // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] "
+ } else {
+ parseNodeStatement(graph, id);
+ }
+ }
+
+ /**
+ * Parse a subgraph
+ * @param {Object} graph parent graph object
+ * @return {Object | null} subgraph
+ */
+ function parseSubgraph(graph) {
+ var subgraph = null;
+
+ // optional subgraph keyword
+ if (token === 'subgraph') {
+ subgraph = {};
+ subgraph.type = 'subgraph';
+ getToken();
+
+ // optional graph id
+ if (tokenType === TOKENTYPE.IDENTIFIER) {
+ subgraph.id = token;
+ getToken();
+ }
+ }
+
+ // open angle bracket
+ if (token === '{') {
+ getToken();
+
+ if (!subgraph) {
+ subgraph = {};
+ }
+ subgraph.parent = graph;
+ subgraph.node = graph.node;
+ subgraph.edge = graph.edge;
+ subgraph.graph = graph.graph;
+
+ // statements
+ parseStatements(subgraph);
+
+ // close angle bracket
+ if (token != '}') {
+ throw newSyntaxError('Angle bracket } expected');
+ }
+ getToken();
+
+ // remove temporary default options
+ delete subgraph.node;
+ delete subgraph.edge;
+ delete subgraph.graph;
+ delete subgraph.parent;
+
+ // register at the parent graph
+ if (!graph.subgraphs) {
+ graph.subgraphs = [];
+ }
+ graph.subgraphs.push(subgraph);
+ }
+
+ return subgraph;
+ }
+
+ /**
+ * parse an attribute statement like "node [shape=circle fontSize=16]".
+ * Available keywords are 'node', 'edge', 'graph'.
+ * The previous list with default attributes will be replaced
+ * @param {Object} graph
+ * @returns {String | null} keyword Returns the name of the parsed attribute
+ * (node, edge, graph), or null if nothing
+ * is parsed.
+ */
+ function parseAttributeStatement(graph) {
+ // attribute statements
+ if (token === 'node') {
+ getToken();
+
+ // node attributes
+ graph.node = parseAttributeList();
+ return 'node';
+ } else if (token === 'edge') {
+ getToken();
+
+ // edge attributes
+ graph.edge = parseAttributeList();
+ return 'edge';
+ } else if (token === 'graph') {
+ getToken();
+
+ // graph attributes
+ graph.graph = parseAttributeList();
+ return 'graph';
+ }
+
+ return null;
+ }
+
+ /**
+ * parse a node statement
+ * @param {Object} graph
+ * @param {String | Number} id
+ */
+ function parseNodeStatement(graph, id) {
+ // node statement
+ var node = {
+ id: id
+ };
+ var attr = parseAttributeList();
+ if (attr) {
+ node.attr = attr;
+ }
+ addNode(graph, node);
+
+ // edge statements
+ parseEdge(graph, id);
+ }
+
+ /**
+ * Parse an edge or a series of edges
+ * @param {Object} graph
+ * @param {String | Number} from Id of the from node
+ */
+ function parseEdge(graph, from) {
+ while (token === '->' || token === '--') {
+ var to;
+ var type = token;
+ getToken();
+
+ var subgraph = parseSubgraph(graph);
+ if (subgraph) {
+ to = subgraph;
+ } else {
+ if (tokenType != TOKENTYPE.IDENTIFIER) {
+ throw newSyntaxError('Identifier or subgraph expected');
+ }
+ to = token;
+ addNode(graph, {
+ id: to
+ });
+ getToken();
+ }
+
+ // parse edge attributes
+ var attr = parseAttributeList();
+
+ // create edge
+ var edge = createEdge(graph, from, to, type, attr);
+ addEdge(graph, edge);
+
+ from = to;
+ }
+ }
+
+ /**
+ * Parse a set with attributes,
+ * for example [label="1.000", shape=solid]
+ * @return {Object | null} attr
+ */
+ function parseAttributeList() {
+ var attr = null;
+
+ while (token === '[') {
+ getToken();
+ attr = {};
+ while (token !== '' && token != ']') {
+ if (tokenType != TOKENTYPE.IDENTIFIER) {
+ throw newSyntaxError('Attribute name expected');
+ }
+ var name = token;
+
+ getToken();
+ if (token != '=') {
+ throw newSyntaxError('Equal sign = expected');
+ }
+ getToken();
+
+ if (tokenType != TOKENTYPE.IDENTIFIER) {
+ throw newSyntaxError('Attribute value expected');
+ }
+ var value = token;
+ setValue(attr, name, value); // name can be a path
+
+ getToken();
+ if (token == ',') {
+ getToken();
+ }
+ }
+
+ if (token != ']') {
+ throw newSyntaxError('Bracket ] expected');
+ }
+ getToken();
+ }
+
+ return attr;
+ }
+
+ /**
+ * Create a syntax error with extra information on current token and index.
+ * @param {String} message
+ * @returns {SyntaxError} err
+ */
+ function newSyntaxError(message) {
+ return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')');
+ }
+
+ /**
+ * Chop off text after a maximum length
+ * @param {String} text
+ * @param {Number} maxLength
+ * @returns {String}
+ */
+ function chop(text, maxLength) {
+ return text.length <= maxLength ? text : text.substr(0, 27) + '...';
+ }
+
+ /**
+ * Execute a function fn for each pair of elements in two arrays
+ * @param {Array | *} array1
+ * @param {Array | *} array2
+ * @param {function} fn
+ */
+ function forEach2(array1, array2, fn) {
+ if (Array.isArray(array1)) {
+ array1.forEach(function (elem1) {
+ if (Array.isArray(array2)) {
+ array2.forEach(function (elem2) {
+ fn(elem1, elem2);
+ });
+ } else {
+ fn(elem1, array2);
+ }
+ });
+ } else {
+ if (Array.isArray(array2)) {
+ array2.forEach(function (elem2) {
+ fn(array1, elem2);
+ });
+ } else {
+ fn(array1, array2);
+ }
+ }
+ }
+
+ /**
+ * Set a nested property on an object
+ * When nested objects are missing, they will be created.
+ * For example setProp({}, 'font.color', 'red') will return {font: {color: 'red'}}
+ * @param {Object} object
+ * @param {string} path A dot separated string like 'font.color'
+ * @param {*} value Value for the property
+ * @return {Object} Returns the original object, allows for chaining.
+ */
+ function setProp(object, path, value) {
+ var names = path.split('.');
+ var prop = names.pop();
+
+ // traverse over the nested objects
+ var obj = object;
+ for (var i = 0; i < names.length; i++) {
+ var name = names[i];
+ if (!(name in obj)) {
+ obj[name] = {};
+ }
+ obj = obj[name];
+ }
+
+ // set the property value
+ obj[prop] = value;
+
+ return object;
+ }
+
+ /**
+ * Convert an object with DOT attributes to their vis.js equivalents.
+ * @param {Object} attr Object with DOT attributes
+ * @param {Object} mapping
+ * @return {Object} Returns an object with vis.js attributes
+ */
+ function convertAttr(attr, mapping) {
+ var converted = {};
+
+ for (var prop in attr) {
+ if (attr.hasOwnProperty(prop)) {
+ var visProp = mapping[prop];
+ if (Array.isArray(visProp)) {
+ visProp.forEach(function (visPropI) {
+ setProp(converted, visPropI, attr[prop]);
+ });
+ } else if (typeof visProp === 'string') {
+ setProp(converted, visProp, attr[prop]);
+ } else {
+ setProp(converted, prop, attr[prop]);
+ }
+ }
+ }
+
+ return converted;
+ }
+
+ /**
+ * Convert a string containing a graph in DOT language into a map containing
+ * with nodes and edges in the format of graph.
+ * @param {String} data Text containing a graph in DOT-notation
+ * @return {Object} graphData
+ */
+ function DOTToGraph(data) {
+ // parse the DOT file
+ var dotData = parseDOT(data);
+ var graphData = {
+ nodes: [],
+ edges: [],
+ options: {}
+ };
+
+ // copy the nodes
+ if (dotData.nodes) {
+ dotData.nodes.forEach(function (dotNode) {
+ var graphNode = {
+ id: dotNode.id,
+ label: String(dotNode.label || dotNode.id)
+ };
+ merge(graphNode, convertAttr(dotNode.attr, NODE_ATTR_MAPPING));
+ if (graphNode.image) {
+ graphNode.shape = 'image';
+ }
+ graphData.nodes.push(graphNode);
+ });
+ }
+
+ // copy the edges
+ if (dotData.edges) {
+ /**
+ * Convert an edge in DOT format to an edge with VisGraph format
+ * @param {Object} dotEdge
+ * @returns {Object} graphEdge
+ */
+ var convertEdge = function convertEdge(dotEdge) {
+ var graphEdge = {
+ from: dotEdge.from,
+ to: dotEdge.to
+ };
+ merge(graphEdge, convertAttr(dotEdge.attr, EDGE_ATTR_MAPPING));
+ graphEdge.arrows = dotEdge.type === '->' ? 'to' : undefined;
+
+ return graphEdge;
+ };
+
+ dotData.edges.forEach(function (dotEdge) {
+ var from, to;
+ if (dotEdge.from instanceof Object) {
+ from = dotEdge.from.nodes;
+ } else {
+ from = {
+ id: dotEdge.from
+ };
+ }
+
+ // TODO: support of solid/dotted/dashed edges (attr = 'style')
+ // TODO: support for attributes 'dir' and 'arrowhead' (edge arrows)
+
+ if (dotEdge.to instanceof Object) {
+ to = dotEdge.to.nodes;
+ } else {
+ to = {
+ id: dotEdge.to
+ };
+ }
+
+ if (dotEdge.from instanceof Object && dotEdge.from.edges) {
+ dotEdge.from.edges.forEach(function (subEdge) {
+ var graphEdge = convertEdge(subEdge);
+ graphData.edges.push(graphEdge);
+ });
+ }
+
+ forEach2(from, to, function (from, to) {
+ var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr);
+ var graphEdge = convertEdge(subEdge);
+ graphData.edges.push(graphEdge);
+ });
+
+ if (dotEdge.to instanceof Object && dotEdge.to.edges) {
+ dotEdge.to.edges.forEach(function (subEdge) {
+ var graphEdge = convertEdge(subEdge);
+ graphData.edges.push(graphEdge);
+ });
+ }
+ });
+ }
+
+ // copy the options
+ if (dotData.attr) {
+ graphData.options = dotData.attr;
+ }
+
+ return graphData;
+ }
+
+ // exports
+ exports.parseDOT = parseDOT;
+ exports.DOTToGraph = DOTToGraph;
+
+/***/ },
+/* 225 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ function parseGephi(gephiJSON, optionsObj) {
+ var edges = [];
+ var nodes = [];
+ var options = {
+ edges: {
+ inheritColor: false
+ },
+ nodes: {
+ fixed: false,
+ parseColor: false
+ }
+ };
+
+ if (optionsObj !== undefined) {
+ if (optionsObj.fixed !== undefined) {
+ options.nodes.fixed = optionsObj.fixed;
+ }
+ if (optionsObj.parseColor !== undefined) {
+ options.nodes.parseColor = optionsObj.parseColor;
+ }
+ if (optionsObj.inheritColor !== undefined) {
+ options.edges.inheritColor = optionsObj.inheritColor;
+ }
+ }
+
+ var gEdges = gephiJSON.edges;
+ var gNodes = gephiJSON.nodes;
+ for (var i = 0; i < gEdges.length; i++) {
+ var edge = {};
+ var gEdge = gEdges[i];
+ edge['id'] = gEdge.id;
+ edge['from'] = gEdge.source;
+ edge['to'] = gEdge.target;
+ edge['attributes'] = gEdge.attributes;
+ edge['label'] = gEdge.label;
+ edge['title'] = gEdge.attributes !== undefined ? gEdge.attributes.title : undefined;
+ if (gEdge['type'] === 'Directed') {
+ edge['arrows'] = 'to';
+ }
+ // edge['value'] = gEdge.attributes !== undefined ? gEdge.attributes.Weight : undefined;
+ // edge['width'] = edge['value'] !== undefined ? undefined : edgegEdge.size;
+ if (gEdge.color && options.inheritColor === false) {
+ edge['color'] = gEdge.color;
+ }
+ edges.push(edge);
+ }
+
+ for (var i = 0; i < gNodes.length; i++) {
+ var node = {};
+ var gNode = gNodes[i];
+ node['id'] = gNode.id;
+ node['attributes'] = gNode.attributes;
+ node['title'] = gNode.title;
+ node['x'] = gNode.x;
+ node['y'] = gNode.y;
+ node['label'] = gNode.label;
+ node['title'] = gNode.attributes !== undefined ? gNode.attributes.title : undefined;
+ if (options.nodes.parseColor === true) {
+ node['color'] = gNode.color;
+ } else {
+ node['color'] = gNode.color !== undefined ? { background: gNode.color, border: gNode.color, highlight: { background: gNode.color, border: gNode.color }, hover: { background: gNode.color, border: gNode.color } } : undefined;
+ }
+ node['size'] = gNode.size;
+ node['fixed'] = options.nodes.fixed && gNode.x !== undefined && gNode.y !== undefined;
+ nodes.push(node);
+ }
+
+ return { nodes: nodes, edges: edges };
+ }
+
+ exports.parseGephi = parseGephi;
+
+/***/ },
+/* 226 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ // English
+ exports['en'] = {
+ edit: 'Edit',
+ del: 'Delete selected',
+ back: 'Back',
+ addNode: 'Add Node',
+ addEdge: 'Add Edge',
+ editNode: 'Edit Node',
+ editEdge: 'Edit Edge',
+ addDescription: 'Click in an empty space to place a new node.',
+ edgeDescription: 'Click on a node and drag the edge to another node to connect them.',
+ editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.',
+ createEdgeError: 'Cannot link edges to a cluster.',
+ deleteClusterError: 'Clusters cannot be deleted.',
+ editClusterError: 'Clusters cannot be edited.'
+ };
+ exports['en_EN'] = exports['en'];
+ exports['en_US'] = exports['en'];
+
+ // German
+ exports['de'] = {
+ edit: 'Editieren',
+ del: 'L\xF6sche Auswahl',
+ back: 'Zur\xFCck',
+ addNode: 'Knoten hinzuf\xFCgen',
+ addEdge: 'Kante hinzuf\xFCgen',
+ editNode: 'Knoten editieren',
+ editEdge: 'Kante editieren',
+ addDescription: 'Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.',
+ edgeDescription: 'Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.',
+ editEdgeDescription: 'Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.',
+ createEdgeError: 'Es ist nicht m\xF6glich, Kanten mit Clustern zu verbinden.',
+ deleteClusterError: 'Cluster k\xF6nnen nicht gel\xF6scht werden.',
+ editClusterError: 'Cluster k\xF6nnen nicht editiert werden.'
+ };
+ exports['de_DE'] = exports['de'];
+
+ // Spanish
+ exports['es'] = {
+ edit: 'Editar',
+ del: 'Eliminar selecci\xF3n',
+ back: '\xC1tras',
+ addNode: 'A\xF1adir nodo',
+ addEdge: 'A\xF1adir arista',
+ editNode: 'Editar nodo',
+ editEdge: 'Editar arista',
+ addDescription: 'Haga clic en un lugar vac\xEDo para colocar un nuevo nodo.',
+ edgeDescription: 'Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.',
+ editEdgeDescription: 'Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.',
+ createEdgeError: 'No se puede conectar una arista a un grupo.',
+ deleteClusterError: 'No es posible eliminar grupos.',
+ editClusterError: 'No es posible editar grupos.'
+ };
+ exports['es_ES'] = exports['es'];
+
+ //Italiano
+ exports['it'] = {
+ edit: 'Modifica',
+ del: 'Cancella la selezione',
+ back: 'Indietro',
+ addNode: 'Aggiungi un nodo',
+ addEdge: 'Aggiungi un vertice',
+ editNode: 'Modifica il nodo',
+ editEdge: 'Modifica il vertice',
+ addDescription: 'Clicca per aggiungere un nuovo nodo',
+ edgeDescription: 'Clicca su un nodo e trascinalo ad un altro nodo per connetterli.',
+ editEdgeDescription: 'Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.',
+ createEdgeError: 'Non si possono collegare vertici ad un cluster',
+ deleteClusterError: 'I cluster non possono essere cancellati',
+ editClusterError: 'I clusters non possono essere modificati.'
+ };
+ exports['it_IT'] = exports['it'];
+
+ // Dutch
+ exports['nl'] = {
+ edit: 'Wijzigen',
+ del: 'Selectie verwijderen',
+ back: 'Terug',
+ addNode: 'Node toevoegen',
+ addEdge: 'Link toevoegen',
+ editNode: 'Node wijzigen',
+ editEdge: 'Link wijzigen',
+ addDescription: 'Klik op een leeg gebied om een nieuwe node te maken.',
+ edgeDescription: 'Klik op een node en sleep de link naar een andere node om ze te verbinden.',
+ editEdgeDescription: 'Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.',
+ createEdgeError: 'Kan geen link maken naar een cluster.',
+ deleteClusterError: 'Clusters kunnen niet worden verwijderd.',
+ editClusterError: 'Clusters kunnen niet worden aangepast.'
+ };
+ exports['nl_NL'] = exports['nl'];
+ exports['nl_BE'] = exports['nl'];
+
+ // Portuguese Brazil
+ exports['pt-br'] = {
+ edit: 'Editar',
+ del: 'Remover selecionado',
+ back: 'Voltar',
+ addNode: 'Adicionar nó',
+ addEdge: 'Adicionar aresta',
+ editNode: 'Editar nó',
+ editEdge: 'Editar aresta',
+ addDescription: 'Clique em um espaço em branco para adicionar um novo nó',
+ edgeDescription: 'Clique em um nó e arraste a aresta até outro nó para conectá-los',
+ editEdgeDescription: 'Clique nos pontos de controle e os arraste para um nó para conectá-los',
+ createEdgeError: 'Não foi possível linkar arestas a um cluster.',
+ deleteClusterError: 'Clusters não puderam ser removidos.',
+ editClusterError: 'Clusters não puderam ser editados.'
+ };
+ exports['pt-BR'] = exports['pt-br'];
+ exports['pt_BR'] = exports['pt-br'];
+ exports['pt_br'] = exports['pt-br'];
+
+ // Russian
+ exports['ru'] = {
+ edit: 'Редактировать',
+ del: 'Удалить выбранное',
+ back: 'Назад',
+ addNode: 'Добавить узел',
+ addEdge: 'Добавить ребро',
+ editNode: 'Редактировать узел',
+ editEdge: 'Редактировать ребро',
+ addDescription: 'Кликните в свободное место, чтобы добавить новый узел.',
+ edgeDescription: 'Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.',
+ editEdgeDescription: 'Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.',
+ createEdgeError: 'Невозможно соединить ребра в кластер.',
+ deleteClusterError: 'Кластеры не могут быть удалены',
+ editClusterError: 'Кластеры недоступны для редактирования.'
+ };
+ exports['ru_RU'] = exports['ru'];
+
+/***/ }
+/******/ ])
+});
+; \ No newline at end of file
diff --git a/www/js/contrib/vis.min.js b/www/js/contrib/vis.min.js
new file mode 100644
index 00000000..010c88a5
--- /dev/null
+++ b/www/js/contrib/vis.min.js
@@ -0,0 +1,46 @@
+/**
+ * vis.js
+ * https://github.com/almende/vis
+ *
+ * A dynamic, browser-based visualization library.
+ *
+ * @version 4.18.0
+ * @date 2017-01-15
+ *
+ * @license
+ * Copyright (C) 2011-2016 Almende B.V, http://almende.com
+ *
+ * Vis.js is dual licensed under both
+ *
+ * * The Apache 2.0 License
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * and
+ *
+ * * The MIT License
+ * http://opensource.org/licenses/MIT
+ *
+ * Vis.js may be distributed under either license.
+ */
+"use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.vis=e():t.vis=e()}(this,function(){return function(t){function e(o){if(i[o])return i[o].exports;var n=i[o]={exports:{},id:o,loaded:!1};return t[o].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){var o=i(1);o.extend(e,i(89)),o.extend(e,i(112)),o.extend(e,i(154))},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}var n=i(2),s=o(n),r=i(55),a=o(r),h=i(58),d=o(h),l=i(62),u=o(l),c=i(82),p=o(c),f=i(84),m=i(88);e.isNumber=function(t){return t instanceof Number||"number"==typeof t},e.elementsCensor=function(t){if(t){var e=function(t,e){return e instanceof Element?"DOM Element":e};return JSON.parse((0,p.default)(t,e))}},e.recursiveDOMDelete=function(t){if(t)for(;t.hasChildNodes()===!0;)e.recursiveDOMDelete(t.firstChild),t.removeChild(t.firstChild)},e.giveRange=function(t,e,i,o){if(e==t)return.5;var n=1/(e-t);return Math.max(0,(o-t)*n)},e.isString=function(t){return t instanceof String||"string"==typeof t},e.isDate=function(t){if(t instanceof Date)return!0;if(e.isString(t)){var i=v.exec(t);if(i)return!0;if(!isNaN(Date.parse(t)))return!0}return!1},e.randomUUID=function(){return m.v4()},e.assignAllKeys=function(t,e){for(var i in t)t.hasOwnProperty(i)&&"object"!==(0,u.default)(t[i])&&(t[i]=e)},e.fillIfDefined=function(t,i){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(var n in t)void 0!==i[n]&&("object"!==(0,u.default)(i[n])?void 0!==i[n]&&null!==i[n]||void 0===t[n]||o!==!0?t[n]=i[n]:delete t[n]:"object"===(0,u.default)(t[n])&&e.fillIfDefined(t[n],i[n],o))},e.protoExtend=function(t,e){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var n in o)t[n]=o[n]}return t},e.extend=function(t,e){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var n in o)o.hasOwnProperty(n)&&(t[n]=o[n])}return t},e.selectiveExtend=function(t,e,i){if(!Array.isArray(t))throw new Error("Array with property names expected as first argument");for(var o=2;o<arguments.length;o++)for(var n=arguments[o],s=0;s<t.length;s++){var r=t[s];n.hasOwnProperty(r)&&(e[r]=n[r])}return e},e.selectiveDeepExtend=function(t,i,o){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s=2;s<arguments.length;s++)for(var r=arguments[s],a=0;a<t.length;a++){var h=t[a];if(r.hasOwnProperty(h))if(o[h]&&o[h].constructor===Object)void 0===i[h]&&(i[h]={}),i[h].constructor===Object?e.deepExtend(i[h],o[h],!1,n):null===o[h]&&void 0!==i[h]&&n===!0?delete i[h]:i[h]=o[h];else{if(Array.isArray(o[h]))throw new TypeError("Arrays are not supported by deepExtend");null===o[h]&&void 0!==i[h]&&n===!0?delete i[h]:i[h]=o[h]}}return i},e.selectiveNotDeepExtend=function(t,i,o){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s in o)if(o.hasOwnProperty(s)&&t.indexOf(s)==-1)if(o[s]&&o[s].constructor===Object)void 0===i[s]&&(i[s]={}),i[s].constructor===Object?e.deepExtend(i[s],o[s]):null===o[s]&&void 0!==i[s]&&n===!0?delete i[s]:i[s]=o[s];else if(Array.isArray(o[s])){i[s]=[];for(var r=0;r<o[s].length;r++)i[s].push(o[s][r])}else null===o[s]&&void 0!==i[s]&&n===!0?delete i[s]:i[s]=o[s];return i},e.deepExtend=function(t,i,o,n){for(var s in i)if(i.hasOwnProperty(s)||o===!0)if(i[s]&&i[s].constructor===Object)void 0===t[s]&&(t[s]={}),t[s].constructor===Object?e.deepExtend(t[s],i[s],o):null===i[s]&&void 0!==t[s]&&n===!0?delete t[s]:t[s]=i[s];else if(Array.isArray(i[s])){t[s]=[];for(var r=0;r<i[s].length;r++)t[s].push(i[s][r])}else null===i[s]&&void 0!==t[s]&&n===!0?delete t[s]:t[s]=i[s];return t},e.equalArray=function(t,e){if(t.length!=e.length)return!1;for(var i=0,o=t.length;i<o;i++)if(t[i]!=e[i])return!1;return!0},e.convert=function(t,i){var o;if(void 0!==t){if(null===t)return null;if(!i)return t;if("string"!=typeof i&&!(i instanceof String))throw new Error("Type must be a string");switch(i){case"boolean":case"Boolean":return Boolean(t);case"number":case"Number":return e.isString(t)&&!isNaN(Date.parse(t))?f(t).valueOf():Number(t.valueOf());case"string":case"String":return String(t);case"Date":if(e.isNumber(t))return new Date(t);if(t instanceof Date)return new Date(t.valueOf());if(f.isMoment(t))return new Date(t.valueOf());if(e.isString(t))return o=v.exec(t),o?new Date(Number(o[1])):f(new Date(t)).toDate();throw new Error("Cannot convert object of type "+e.getType(t)+" to type Date");case"Moment":if(e.isNumber(t))return f(t);if(t instanceof Date)return f(t.valueOf());if(f.isMoment(t))return f(t);if(e.isString(t))return o=v.exec(t),f(o?Number(o[1]):t);throw new Error("Cannot convert object of type "+e.getType(t)+" to type Date");case"ISODate":if(e.isNumber(t))return new Date(t);if(t instanceof Date)return t.toISOString();if(f.isMoment(t))return t.toDate().toISOString();if(e.isString(t))return o=v.exec(t),o?new Date(Number(o[1])).toISOString():f(t).format();throw new Error("Cannot convert object of type "+e.getType(t)+" to type ISODate");case"ASPDate":if(e.isNumber(t))return"/Date("+t+")/";if(t instanceof Date)return"/Date("+t.valueOf()+")/";if(e.isString(t)){o=v.exec(t);var n;return n=o?new Date(Number(o[1])).valueOf():new Date(t).valueOf(),"/Date("+n+")/"}throw new Error("Cannot convert object of type "+e.getType(t)+" to type ASPDate");default:throw new Error('Unknown type "'+i+'"')}}};var v=/^\/?Date\((\-?\d+)/i;e.getType=function(t){var e="undefined"==typeof t?"undefined":(0,u.default)(t);return"object"==e?null===t?"null":t instanceof Boolean?"Boolean":t instanceof Number?"Number":t instanceof String?"String":Array.isArray(t)?"Array":t instanceof Date?"Date":"Object":"number"==e?"Number":"boolean"==e?"Boolean":"string"==e?"String":void 0===e?"undefined":e},e.copyAndExtendArray=function(t,e){for(var i=[],o=0;o<t.length;o++)i.push(t[o]);return i.push(e),i},e.copyArray=function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i]);return e},e.getAbsoluteLeft=function(t){return t.getBoundingClientRect().left},e.getAbsoluteRight=function(t){return t.getBoundingClientRect().right},e.getAbsoluteTop=function(t){return t.getBoundingClientRect().top},e.addClassName=function(t,e){var i=t.className.split(" ");i.indexOf(e)==-1&&(i.push(e),t.className=i.join(" "))},e.removeClassName=function(t,e){var i=t.className.split(" "),o=i.indexOf(e);o!=-1&&(i.splice(o,1),t.className=i.join(" "))},e.forEach=function(t,e){var i,o;if(Array.isArray(t))for(i=0,o=t.length;i<o;i++)e(t[i],i,t);else for(i in t)t.hasOwnProperty(i)&&e(t[i],i,t)},e.toArray=function(t){var e=[];for(var i in t)t.hasOwnProperty(i)&&e.push(t[i]);return e},e.updateProperty=function(t,e,i){return t[e]!==i&&(t[e]=i,!0)},e.throttle=function(t){var e=!1;return function(){e||(e=!0,requestAnimationFrame(function(){e=!1,t()}))}},e.addEventListener=function(t,e,i,o){t.addEventListener?(void 0===o&&(o=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,o)):t.attachEvent("on"+e,i)},e.removeEventListener=function(t,e,i,o){t.removeEventListener?(void 0===o&&(o=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,o)):t.detachEvent("on"+e,i)},e.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},e.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},e.hasParent=function(t,e){for(var i=t;i;){if(i===e)return!0;i=i.parentNode}return!1},e.option={},e.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},e.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},e.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},e.option.asSize=function(t,i){return"function"==typeof t&&(t=t()),e.isString(t)?t:e.isNumber(t)?t+"px":i||null},e.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},e.hexToRGB=function(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,i,o){return e+e+i+i+o+o});var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null},e.overrideOpacity=function(t,i){if(t.indexOf("rgba")!=-1)return t;if(t.indexOf("rgb")!=-1){var o=t.substr(t.indexOf("(")+1).replace(")","").split(",");return"rgba("+o[0]+","+o[1]+","+o[2]+","+i+")"}var o=e.hexToRGB(t);return null==o?t:"rgba("+o.r+","+o.g+","+o.b+","+i+")"},e.RGBToHex=function(t,e,i){return"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},e.parseColor=function(t){var i;if(e.isString(t)===!0){if(e.isValidRGB(t)===!0){var o=t.substr(4).substr(0,t.length-5).split(",").map(function(t){return parseInt(t)});t=e.RGBToHex(o[0],o[1],o[2])}if(e.isValidHex(t)===!0){var n=e.hexToHSV(t),s={h:n.h,s:.8*n.s,v:Math.min(1,1.02*n.v)},r={h:n.h,s:Math.min(1,1.25*n.s),v:.8*n.v},a=e.HSVToHex(r.h,r.s,r.v),h=e.HSVToHex(s.h,s.s,s.v);i={background:t,border:a,highlight:{background:h,border:a},hover:{background:h,border:a}}}else i={background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}else i={},i.background=t.background||void 0,i.border=t.border||void 0,e.isString(t.highlight)?i.highlight={border:t.highlight,background:t.highlight}:(i.highlight={},i.highlight.background=t.highlight&&t.highlight.background||void 0,i.highlight.border=t.highlight&&t.highlight.border||void 0),e.isString(t.hover)?i.hover={border:t.hover,background:t.hover}:(i.hover={},i.hover.background=t.hover&&t.hover.background||void 0,i.hover.border=t.hover&&t.hover.border||void 0);return i},e.RGBToHSV=function(t,e,i){t/=255,e/=255,i/=255;var o=Math.min(t,Math.min(e,i)),n=Math.max(t,Math.max(e,i));if(o==n)return{h:0,s:0,v:o};var s=t==o?e-i:i==o?t-e:i-t,r=t==o?3:i==o?1:5,a=60*(r-s/(n-o))/360,h=(n-o)/n,d=n;return{h:a,s:h,v:d}};var g={split:function(t){var e={};return t.split(";").forEach(function(t){if(""!=t.trim()){var i=t.split(":"),o=i[0].trim(),n=i[1].trim();e[o]=n}}),e},join:function(t){return(0,d.default)(t).map(function(e){return e+": "+t[e]}).join("; ")}};e.addCssText=function(t,i){var o=g.split(t.style.cssText),n=g.split(i),s=e.extend(o,n);t.style.cssText=g.join(s)},e.removeCssText=function(t,e){var i=g.split(t.style.cssText),o=g.split(e);for(var n in o)o.hasOwnProperty(n)&&delete i[n];t.style.cssText=g.join(i)},e.HSVToRGB=function(t,e,i){var o,n,s,r=Math.floor(6*t),a=6*t-r,h=i*(1-e),d=i*(1-a*e),l=i*(1-(1-a)*e);switch(r%6){case 0:o=i,n=l,s=h;break;case 1:o=d,n=i,s=h;break;case 2:o=h,n=i,s=l;break;case 3:o=h,n=d,s=i;break;case 4:o=l,n=h,s=i;break;case 5:o=i,n=h,s=d}return{r:Math.floor(255*o),g:Math.floor(255*n),b:Math.floor(255*s)}},e.HSVToHex=function(t,i,o){var n=e.HSVToRGB(t,i,o);return e.RGBToHex(n.r,n.g,n.b)},e.hexToHSV=function(t){var i=e.hexToRGB(t);return e.RGBToHSV(i.r,i.g,i.b)},e.isValidHex=function(t){var e=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t);return e},e.isValidRGB=function(t){t=t.replace(" ","");var e=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(t);return e},e.isValidRGBA=function(t){t=t.replace(" ","");var e=/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(t);return e},e.selectiveBridgeObject=function(t,i){if("object"==("undefined"==typeof i?"undefined":(0,u.default)(i))){for(var o=(0,a.default)(i),n=0;n<t.length;n++)i.hasOwnProperty(t[n])&&"object"==(0,u.default)(i[t[n]])&&(o[t[n]]=e.bridgeObject(i[t[n]]));return o}return null},e.bridgeObject=function(t){if("object"==("undefined"==typeof t?"undefined":(0,u.default)(t))){var i=(0,a.default)(t);for(var o in t)t.hasOwnProperty(o)&&"object"==(0,u.default)(t[o])&&(i[o]=e.bridgeObject(t[o]));return i}return null},e.insertSort=function(t,e){for(var i=0;i<t.length;i++){for(var o=t[i],n=i;n>0&&e(o,t[n-1])<0;n--)t[n]=t[n-1];t[n]=o}return t},e.mergeOptions=function(t,e,i){var o=(arguments.length>3&&void 0!==arguments[3]&&arguments[3],arguments.length>4&&void 0!==arguments[4]?arguments[4]:{});if(null===e[i])t[i]=(0,a.default)(o[i]);else if(void 0!==e[i])if("boolean"==typeof e[i])t[i].enabled=e[i];else{void 0===e[i].enabled&&(t[i].enabled=!0);for(var n in e[i])e[i].hasOwnProperty(n)&&(t[i][n]=e[i][n])}},e.binarySearchCustom=function(t,e,i,o){for(var n=1e4,s=0,r=0,a=t.length-1;r<=a&&s<n;){var h=Math.floor((r+a)/2),d=t[h],l=void 0===o?d[i]:d[i][o],u=e(l);if(0==u)return h;u==-1?r=h+1:a=h-1,s++}return-1},e.binarySearchValue=function(t,e,i,o,n){for(var s,r,a,h,d=1e4,l=0,u=0,c=t.length-1,n=void 0!=n?n:function(t,e){return t==e?0:t<e?-1:1};u<=c&&l<d;){if(h=Math.floor(.5*(c+u)),s=t[Math.max(0,h-1)][i],r=t[h][i],a=t[Math.min(t.length-1,h+1)][i],0==n(r,e))return h;if(n(s,e)<0&&n(r,e)>0)return"before"==o?Math.max(0,h-1):h;if(n(r,e)<0&&n(a,e)>0)return"before"==o?h:Math.min(t.length-1,h+1);n(r,e)<0?u=h+1:c=h-1,l++}return-1},e.easingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:-1+(4-2*t)*t},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},e.getScrollBarWidth=function(){var t=document.createElement("p");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);var i=t.offsetWidth;e.style.overflow="scroll";var o=t.offsetWidth;return i==o&&(o=e.clientWidth),document.body.removeChild(e),i-o},e.topMost=function(t,e){var i=void 0;Array.isArray(e)||(e=[e]);var o=!0,n=!1,r=void 0;try{for(var a,h=(0,s.default)(t);!(o=(a=h.next()).done);o=!0){var d=a.value;if(d){i=d[e[0]];for(var l=1;l<e.length;l++)i&&(i=i[e[l]]);if("undefined"!=typeof i)break}}}catch(t){n=!0,r=t}finally{try{!o&&h.return&&h.return()}finally{if(n)throw r}}return i}},function(t,e,i){t.exports={default:i(3),__esModule:!0}},function(t,e,i){i(4),i(50),t.exports=i(52)},function(t,e,i){i(5);for(var o=i(16),n=i(20),s=i(8),r=i(47)("toStringTag"),a=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],h=0;h<5;h++){var d=a[h],l=o[d],u=l&&l.prototype;u&&!u[r]&&n(u,r,d),s[d]=s.Array}},function(t,e,i){var o=i(6),n=i(7),s=i(8),r=i(9);t.exports=i(13)(Array,"Array",function(t,e){this._t=r(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,i=this._i++;return!t||i>=t.length?(this._t=void 0,n(1)):"keys"==e?n(0,i):"values"==e?n(0,t[i]):n(0,[i,t[i]])},"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e){t.exports={}},function(t,e,i){var o=i(10),n=i(12);t.exports=function(t){return o(n(t))}},function(t,e,i){var o=i(11);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==o(t)?t.split(""):Object(t)}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var o=i(14),n=i(15),s=i(30),r=i(20),a=i(31),h=i(8),d=i(32),l=i(46),u=i(48),c=i(47)("iterator"),p=!([].keys&&"next"in[].keys()),f="@@iterator",m="keys",v="values",g=function(){return this};t.exports=function(t,e,i,y,b,_,w){d(i,e,y);var x,k,O,D=function(t){if(!p&&t in T)return T[t];switch(t){case m:return function(){return new i(this,t)};case v:return function(){return new i(this,t)}}return function(){return new i(this,t)}},S=e+" Iterator",M=b==v,C=!1,T=t.prototype,E=T[c]||T[f]||b&&T[b],P=E||D(b),I=b?M?D("entries"):P:void 0,N="Array"==e?T.entries||E:E;if(N&&(O=u(N.call(new t)),O!==Object.prototype&&(l(O,S,!0),o||a(O,c)||r(O,c,g))),M&&E&&E.name!==v&&(C=!0,P=function(){return E.call(this)}),o&&!w||!p&&!C&&T[c]||r(T,c,P),h[e]=P,h[S]=g,b)if(x={values:M?P:D(v),keys:_?P:D(m),entries:I},w)for(k in x)k in T||s(T,k,x[k]);else n(n.P+n.F*(p||C),e,x);return x}},function(t,e){t.exports=!0},function(t,e,i){var o=i(16),n=i(17),s=i(18),r=i(20),a="prototype",h=function(t,e,i){var d,l,u,c=t&h.F,p=t&h.G,f=t&h.S,m=t&h.P,v=t&h.B,g=t&h.W,y=p?n:n[e]||(n[e]={}),b=y[a],_=p?o:f?o[e]:(o[e]||{})[a];p&&(i=e);for(d in i)l=!c&&_&&void 0!==_[d],l&&d in y||(u=l?_[d]:i[d],y[d]=p&&"function"!=typeof _[d]?i[d]:v&&l?s(u,o):g&&_[d]==u?function(t){var e=function(e,i,o){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,o)}return t.apply(this,arguments)};return e[a]=t[a],e}(u):m&&"function"==typeof u?s(Function.call,u):u,m&&((y.virtual||(y.virtual={}))[d]=u,t&h.R&&b&&!b[d]&&r(b,d,u)))};h.F=1,h.G=2,h.S=4,h.P=8,h.B=16,h.W=32,h.U=64,h.R=128,t.exports=h},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){var i=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=i)},function(t,e,i){var o=i(19);t.exports=function(t,e,i){if(o(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,o){return t.call(e,i,o)};case 3:return function(i,o,n){return t.call(e,i,o,n)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){var o=i(21),n=i(29);t.exports=i(25)?function(t,e,i){return o.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){var o=i(22),n=i(24),s=i(28),r=Object.defineProperty;e.f=i(25)?Object.defineProperty:function(t,e,i){if(o(t),e=s(e,!0),o(i),n)try{return r(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var o=i(23);t.exports=function(t){if(!o(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){t.exports=!i(25)&&!i(26)(function(){return 7!=Object.defineProperty(i(27)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){t.exports=!i(26)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,i){var o=i(23),n=i(16).document,s=o(n)&&o(n.createElement);t.exports=function(t){return s?n.createElement(t):{}}},function(t,e,i){var o=i(23);t.exports=function(t,e){if(!o(t))return t;var i,n;if(e&&"function"==typeof(i=t.toString)&&!o(n=i.call(t)))return n;if("function"==typeof(i=t.valueOf)&&!o(n=i.call(t)))return n;if(!e&&"function"==typeof(i=t.toString)&&!o(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){t.exports=i(20)},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){var o=i(33),n=i(29),s=i(46),r={};i(20)(r,i(47)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=o(r,{next:n(1,i)}),s(t,e+" Iterator")}},function(t,e,i){var o=i(22),n=i(34),s=i(44),r=i(41)("IE_PROTO"),a=function(){},h="prototype",d=function(){var t,e=i(27)("iframe"),o=s.length,n="<",r=">";for(e.style.display="none",i(45).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(n+"script"+r+"document.F=Object"+n+"/script"+r),t.close(),d=t.F;o--;)delete d[h][s[o]];return d()};t.exports=Object.create||function(t,e){var i;return null!==t?(a[h]=o(t),i=new a,a[h]=null,i[r]=t):i=d(),void 0===e?i:n(i,e)}},function(t,e,i){var o=i(21),n=i(22),s=i(35);t.exports=i(25)?Object.defineProperties:function(t,e){n(t);for(var i,r=s(e),a=r.length,h=0;a>h;)o.f(t,i=r[h++],e[i]);return t}},function(t,e,i){var o=i(36),n=i(44);t.exports=Object.keys||function(t){return o(t,n)}},function(t,e,i){var o=i(31),n=i(9),s=i(37)(!1),r=i(41)("IE_PROTO");t.exports=function(t,e){var i,a=n(t),h=0,d=[];for(i in a)i!=r&&o(a,i)&&d.push(i);for(;e.length>h;)o(a,i=e[h++])&&(~s(d,i)||d.push(i));return d}},function(t,e,i){var o=i(9),n=i(38),s=i(40);t.exports=function(t){return function(e,i,r){var a,h=o(e),d=n(h.length),l=s(r,d);if(t&&i!=i){for(;d>l;)if(a=h[l++],a!=a)return!0}else for(;d>l;l++)if((t||l in h)&&h[l]===i)return t||l||0;return!t&&-1}}},function(t,e,i){var o=i(39),n=Math.min;t.exports=function(t){return t>0?n(o(t),9007199254740991):0}},function(t,e){var i=Math.ceil,o=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?o:i)(t)}},function(t,e,i){var o=i(39),n=Math.max,s=Math.min;t.exports=function(t,e){return t=o(t),t<0?n(t+e,0):s(t,e)}},function(t,e,i){var o=i(42)("keys"),n=i(43);t.exports=function(t){return o[t]||(o[t]=n(t))}},function(t,e,i){var o=i(16),n="__core-js_shared__",s=o[n]||(o[n]={});t.exports=function(t){return s[t]||(s[t]={})}},function(t,e){var i=0,o=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+o).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,i){t.exports=i(16).document&&document.documentElement},function(t,e,i){var o=i(21).f,n=i(31),s=i(47)("toStringTag");t.exports=function(t,e,i){t&&!n(t=i?t:t.prototype,s)&&o(t,s,{configurable:!0,value:e})}},function(t,e,i){var o=i(42)("wks"),n=i(43),s=i(16).Symbol,r="function"==typeof s,a=t.exports=function(t){return o[t]||(o[t]=r&&s[t]||(r?s:n)("Symbol."+t))};a.store=o},function(t,e,i){var o=i(31),n=i(49),s=i(41)("IE_PROTO"),r=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=n(t),o(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?r:null}},function(t,e,i){var o=i(12);t.exports=function(t){return Object(o(t))}},function(t,e,i){var o=i(51)(!0);i(13)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,i=this._i;return i>=e.length?{value:void 0,done:!0}:(t=o(e,i),this._i+=t.length,{value:t,done:!1})})},function(t,e,i){var o=i(39),n=i(12);t.exports=function(t){return function(e,i){var s,r,a=String(n(e)),h=o(i),d=a.length;return h<0||h>=d?t?"":void 0:(s=a.charCodeAt(h),s<55296||s>56319||h+1===d||(r=a.charCodeAt(h+1))<56320||r>57343?t?a.charAt(h):s:t?a.slice(h,h+2):(s-55296<<10)+(r-56320)+65536)}}},function(t,e,i){var o=i(22),n=i(53);t.exports=i(17).getIterator=function(t){var e=n(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return o(e.call(t))}},function(t,e,i){var o=i(54),n=i(47)("iterator"),s=i(8);t.exports=i(17).getIteratorMethod=function(t){if(void 0!=t)return t[n]||t["@@iterator"]||s[o(t)]}},function(t,e,i){var o=i(11),n=i(47)("toStringTag"),s="Arguments"==o(function(){return arguments}()),r=function(t,e){try{return t[e]}catch(t){}};t.exports=function(t){var e,i,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=r(e=Object(t),n))?i:s?o(e):"Object"==(a=o(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,i){t.exports={default:i(56),__esModule:!0}},function(t,e,i){i(57);var o=i(17).Object;t.exports=function(t,e){return o.create(t,e)}},function(t,e,i){var o=i(15);o(o.S,"Object",{create:i(33)})},function(t,e,i){t.exports={default:i(59),__esModule:!0}},function(t,e,i){i(60),t.exports=i(17).Object.keys},function(t,e,i){var o=i(49),n=i(35);i(61)("keys",function(){return function(t){return n(o(t))}})},function(t,e,i){var o=i(15),n=i(17),s=i(26);t.exports=function(t,e){var i=(n.Object||{})[t]||Object[t],r={};r[t]=e(i),o(o.S+o.F*s(function(){i(1)}),"Object",r)}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var n=i(63),s=o(n),r=i(66),a=o(r),h="function"==typeof a.default&&"symbol"==typeof s.default?function(t){return typeof t}:function(t){return t&&"function"==typeof a.default&&t.constructor===a.default&&t!==a.default.prototype?"symbol":typeof t};e.default="function"==typeof a.default&&"symbol"===h(s.default)?function(t){return"undefined"==typeof t?"undefined":h(t)}:function(t){return t&&"function"==typeof a.default&&t.constructor===a.default&&t!==a.default.prototype?"symbol":"undefined"==typeof t?"undefined":h(t)}},function(t,e,i){t.exports={default:i(64),__esModule:!0}},function(t,e,i){i(50),i(4),t.exports=i(65).f("iterator")},function(t,e,i){e.f=i(47)},function(t,e,i){t.exports={default:i(67),__esModule:!0}},function(t,e,i){i(68),i(79),i(80),i(81),t.exports=i(17).Symbol},function(t,e,i){var o=i(16),n=i(31),s=i(25),r=i(15),a=i(30),h=i(69).KEY,d=i(26),l=i(42),u=i(46),c=i(43),p=i(47),f=i(65),m=i(70),v=i(71),g=i(72),y=i(75),b=i(22),_=i(9),w=i(28),x=i(29),k=i(33),O=i(76),D=i(78),S=i(21),M=i(35),C=D.f,T=S.f,E=O.f,P=o.Symbol,I=o.JSON,N=I&&I.stringify,z="prototype",R=p("_hidden"),L=p("toPrimitive"),A={}.propertyIsEnumerable,B=l("symbol-registry"),F=l("symbols"),H=l("op-symbols"),j=Object[z],W="function"==typeof P,Y=o.QObject,G=!Y||!Y[z]||!Y[z].findChild,V=s&&d(function(){return 7!=k(T({},"a",{get:function(){return T(this,"a",{value:7}).a}})).a})?function(t,e,i){var o=C(j,e);o&&delete j[e],T(t,e,i),o&&t!==j&&T(j,e,o)}:T,U=function(t){var e=F[t]=k(P[z]);return e._k=t,e},q=W&&"symbol"==typeof P.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof P},X=function(t,e,i){return t===j&&X(H,e,i),b(t),e=w(e,!0),b(i),n(F,e)?(i.enumerable?(n(t,R)&&t[R][e]&&(t[R][e]=!1),i=k(i,{enumerable:x(0,!1)})):(n(t,R)||T(t,R,x(1,{})),t[R][e]=!0),V(t,e,i)):T(t,e,i)},Z=function(t,e){b(t);for(var i,o=g(e=_(e)),n=0,s=o.length;s>n;)X(t,i=o[n++],e[i]);return t},K=function(t,e){return void 0===e?k(t):Z(k(t),e)},Q=function(t){var e=A.call(this,t=w(t,!0));return!(this===j&&n(F,t)&&!n(H,t))&&(!(e||!n(this,t)||!n(F,t)||n(this,R)&&this[R][t])||e)},J=function(t,e){if(t=_(t),e=w(e,!0),t!==j||!n(F,e)||n(H,e)){var i=C(t,e);return!i||!n(F,e)||n(t,R)&&t[R][e]||(i.enumerable=!0),i}},$=function(t){for(var e,i=E(_(t)),o=[],s=0;i.length>s;)n(F,e=i[s++])||e==R||e==h||o.push(e);return o},tt=function(t){for(var e,i=t===j,o=E(i?H:_(t)),s=[],r=0;o.length>r;)!n(F,e=o[r++])||i&&!n(j,e)||s.push(F[e]);return s};W||(P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var t=c(arguments.length>0?arguments[0]:void 0),e=function(i){this===j&&e.call(H,i),n(this,R)&&n(this[R],t)&&(this[R][t]=!1),V(this,t,x(1,i))};return s&&G&&V(j,t,{configurable:!0,set:e}),U(t)},a(P[z],"toString",function(){return this._k}),D.f=J,S.f=X,i(77).f=O.f=$,i(74).f=Q,i(73).f=tt,s&&!i(14)&&a(j,"propertyIsEnumerable",Q,!0),f.f=function(t){return U(p(t))}),r(r.G+r.W+r.F*!W,{Symbol:P});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),it=0;et.length>it;)p(et[it++]);for(var et=M(p.store),it=0;et.length>it;)m(et[it++]);r(r.S+r.F*!W,"Symbol",{for:function(t){return n(B,t+="")?B[t]:B[t]=P(t)},keyFor:function(t){if(q(t))return v(B,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){G=!0},useSimple:function(){G=!1}}),r(r.S+r.F*!W,"Object",{create:K,defineProperty:X,defineProperties:Z,getOwnPropertyDescriptor:J,getOwnPropertyNames:$,getOwnPropertySymbols:tt}),I&&r(r.S+r.F*(!W||d(function(){var t=P();return"[null]"!=N([t])||"{}"!=N({a:t})||"{}"!=N(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!q(t)){for(var e,i,o=[t],n=1;arguments.length>n;)o.push(arguments[n++]);return e=o[1],"function"==typeof e&&(i=e),!i&&y(e)||(e=function(t,e){if(i&&(e=i.call(this,t,e)),!q(e))return e}),o[1]=e,N.apply(I,o)}}}),P[z][L]||i(20)(P[z],L,P[z].valueOf),u(P,"Symbol"),u(Math,"Math",!0),u(o.JSON,"JSON",!0)},function(t,e,i){var o=i(43)("meta"),n=i(23),s=i(31),r=i(21).f,a=0,h=Object.isExtensible||function(){return!0},d=!i(26)(function(){return h(Object.preventExtensions({}))}),l=function(t){r(t,o,{value:{i:"O"+ ++a,w:{}}})},u=function(t,e){if(!n(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!s(t,o)){if(!h(t))return"F";if(!e)return"E";l(t)}return t[o].i},c=function(t,e){if(!s(t,o)){if(!h(t))return!0;if(!e)return!1;l(t)}return t[o].w},p=function(t){return d&&f.NEED&&h(t)&&!s(t,o)&&l(t),t},f=t.exports={KEY:o,NEED:!1,fastKey:u,getWeak:c,onFreeze:p}},function(t,e,i){var o=i(16),n=i(17),s=i(14),r=i(65),a=i(21).f;t.exports=function(t){var e=n.Symbol||(n.Symbol=s?{}:o.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:r.f(t)})}},function(t,e,i){var o=i(35),n=i(9);t.exports=function(t,e){for(var i,s=n(t),r=o(s),a=r.length,h=0;a>h;)if(s[i=r[h++]]===e)return i}},function(t,e,i){var o=i(35),n=i(73),s=i(74);t.exports=function(t){var e=o(t),i=n.f;if(i)for(var r,a=i(t),h=s.f,d=0;a.length>d;)h.call(t,r=a[d++])&&e.push(r);return e}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,i){var o=i(11);t.exports=Array.isArray||function(t){return"Array"==o(t)}},function(t,e,i){var o=i(9),n=i(77).f,s={}.toString,r="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return n(t)}catch(t){return r.slice()}};t.exports.f=function(t){return r&&"[object Window]"==s.call(t)?a(t):n(o(t))}},function(t,e,i){var o=i(36),n=i(44).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return o(t,n)}},function(t,e,i){var o=i(74),n=i(29),s=i(9),r=i(28),a=i(31),h=i(24),d=Object.getOwnPropertyDescriptor;e.f=i(25)?d:function(t,e){if(t=s(t),e=r(e,!0),h)try{return d(t,e)}catch(t){}if(a(t,e))return n(!o.f.call(t,e),t[e])}},function(t,e){},function(t,e,i){i(70)("asyncIterator")},function(t,e,i){i(70)("observable")},function(t,e,i){t.exports={default:i(83),__esModule:!0}},function(t,e,i){var o=i(17),n=o.JSON||(o.JSON={stringify:JSON.stringify});t.exports=function(t){return n.stringify.apply(n,arguments)}},function(t,e,i){t.exports="undefined"!=typeof window&&window.moment||i(85)},function(t,e,i){(function(t){!function(e,i){t.exports=i()}(this,function(){function e(){return vo.apply(null,arguments)}function i(t){vo=t}function o(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function n(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function s(t){var e;for(e in t)return!1;return!0}function r(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function a(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function h(t,e){var i,o=[];for(i=0;i<t.length;++i)o.push(e(t[i],i));return o}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function l(t,e){for(var i in e)d(e,i)&&(t[i]=e[i]);return d(e,"toString")&&(t.toString=e.toString),d(e,"valueOf")&&(t.valueOf=e.valueOf),t}function u(t,e,i,o){return ye(t,e,i,o,!0).utc()}function c(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function p(t){return null==t._pf&&(t._pf=c()),t._pf}function f(t){if(null==t._isValid){var e=p(t),i=yo.call(e.parsedDateParts,function(t){return null!=t}),o=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidMonth&&!e.invalidWeekday&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&i);if(t._strict&&(o=o&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour),null!=Object.isFrozen&&Object.isFrozen(t))return o;
+t._isValid=o}return t._isValid}function m(t){var e=u(NaN);return null!=t?l(p(e),t):p(e).userInvalidated=!0,e}function v(t){return void 0===t}function g(t,e){var i,o,n;if(v(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),v(e._i)||(t._i=e._i),v(e._f)||(t._f=e._f),v(e._l)||(t._l=e._l),v(e._strict)||(t._strict=e._strict),v(e._tzm)||(t._tzm=e._tzm),v(e._isUTC)||(t._isUTC=e._isUTC),v(e._offset)||(t._offset=e._offset),v(e._pf)||(t._pf=p(e)),v(e._locale)||(t._locale=e._locale),bo.length>0)for(i in bo)o=bo[i],n=e[o],v(n)||(t[o]=n);return t}function y(t){g(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),_o===!1&&(_o=!0,e.updateOffset(this),_o=!1)}function b(t){return t instanceof y||null!=t&&null!=t._isAMomentObject}function _(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function w(t){var e=+t,i=0;return 0!==e&&isFinite(e)&&(i=_(e)),i}function x(t,e,i){var o,n=Math.min(t.length,e.length),s=Math.abs(t.length-e.length),r=0;for(o=0;o<n;o++)(i&&t[o]!==e[o]||!i&&w(t[o])!==w(e[o]))&&r++;return r+s}function k(t){e.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function O(t,i){var o=!0;return l(function(){if(null!=e.deprecationHandler&&e.deprecationHandler(null,t),o){for(var n,s=[],r=0;r<arguments.length;r++){if(n="","object"==typeof arguments[r]){n+="\n["+r+"] ";for(var a in arguments[0])n+=a+": "+arguments[0][a]+", ";n=n.slice(0,-2)}else n=arguments[r];s.push(n)}k(t+"\nArguments: "+Array.prototype.slice.call(s).join("")+"\n"+(new Error).stack),o=!1}return i.apply(this,arguments)},i)}function D(t,i){null!=e.deprecationHandler&&e.deprecationHandler(t,i),wo[t]||(k(i),wo[t]=!0)}function S(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function M(t){var e,i;for(i in t)e=t[i],S(e)?this[i]=e:this["_"+i]=e;this._config=t,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function C(t,e){var i,o=l({},t);for(i in e)d(e,i)&&(n(t[i])&&n(e[i])?(o[i]={},l(o[i],t[i]),l(o[i],e[i])):null!=e[i]?o[i]=e[i]:delete o[i]);for(i in t)d(t,i)&&!d(e,i)&&n(t[i])&&(o[i]=l({},o[i]));return o}function T(t){null!=t&&this.set(t)}function E(t,e,i){var o=this._calendar[t]||this._calendar.sameElse;return S(o)?o.call(e,i):o}function P(t){var e=this._longDateFormat[t],i=this._longDateFormat[t.toUpperCase()];return e||!i?e:(this._longDateFormat[t]=i.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function I(){return this._invalidDate}function N(t){return this._ordinal.replace("%d",t)}function z(t,e,i,o){var n=this._relativeTime[i];return S(n)?n(t,e,i,o):n.replace(/%d/i,t)}function R(t,e){var i=this._relativeTime[t>0?"future":"past"];return S(i)?i(e):i.replace(/%s/i,e)}function L(t,e){var i=t.toLowerCase();Po[i]=Po[i+"s"]=Po[e]=t}function A(t){return"string"==typeof t?Po[t]||Po[t.toLowerCase()]:void 0}function B(t){var e,i,o={};for(i in t)d(t,i)&&(e=A(i),e&&(o[e]=t[i]));return o}function F(t,e){Io[t]=e}function H(t){var e=[];for(var i in t)e.push({unit:i,priority:Io[i]});return e.sort(function(t,e){return t.priority-e.priority}),e}function j(t,i){return function(o){return null!=o?(Y(this,t,o),e.updateOffset(this,i),this):W(this,t)}}function W(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function Y(t,e,i){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](i)}function G(t){return t=A(t),S(this[t])?this[t]():this}function V(t,e){if("object"==typeof t){t=B(t);for(var i=H(t),o=0;o<i.length;o++)this[i[o].unit](t[i[o].unit])}else if(t=A(t),S(this[t]))return this[t](e);return this}function U(t,e,i){var o=""+Math.abs(t),n=e-o.length,s=t>=0;return(s?i?"+":"":"-")+Math.pow(10,Math.max(0,n)).toString().substr(1)+o}function q(t,e,i,o){var n=o;"string"==typeof o&&(n=function(){return this[o]()}),t&&(Lo[t]=n),e&&(Lo[e[0]]=function(){return U(n.apply(this,arguments),e[1],e[2])}),i&&(Lo[i]=function(){return this.localeData().ordinal(n.apply(this,arguments),t)})}function X(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function Z(t){var e,i,o=t.match(No);for(e=0,i=o.length;e<i;e++)Lo[o[e]]?o[e]=Lo[o[e]]:o[e]=X(o[e]);return function(e){var n,s="";for(n=0;n<i;n++)s+=o[n]instanceof Function?o[n].call(e,t):o[n];return s}}function K(t,e){return t.isValid()?(e=Q(e,t.localeData()),Ro[e]=Ro[e]||Z(e),Ro[e](t)):t.localeData().invalidDate()}function Q(t,e){function i(t){return e.longDateFormat(t)||t}var o=5;for(zo.lastIndex=0;o>=0&&zo.test(t);)t=t.replace(zo,i),zo.lastIndex=0,o-=1;return t}function J(t,e,i){tn[t]=S(e)?e:function(t,o){return t&&i?i:e}}function $(t,e){return d(tn,t)?tn[t](e._strict,e._locale):new RegExp(tt(t))}function tt(t){return et(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,i,o,n){return e||i||o||n}))}function et(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function it(t,e){var i,o=e;for("string"==typeof t&&(t=[t]),r(e)&&(o=function(t,i){i[e]=w(t)}),i=0;i<t.length;i++)en[t[i]]=o}function ot(t,e){it(t,function(t,i,o,n){o._w=o._w||{},e(t,o._w,o,n)})}function nt(t,e,i){null!=e&&d(en,t)&&en[t](e,i._a,i,t)}function st(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function rt(t,e){return t?o(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||pn).test(e)?"format":"standalone"][t.month()]:this._months}function at(t,e){return t?o(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[pn.test(e)?"format":"standalone"][t.month()]:this._monthsShort}function ht(t,e,i){var o,n,s,r=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],o=0;o<12;++o)s=u([2e3,o]),this._shortMonthsParse[o]=this.monthsShort(s,"").toLocaleLowerCase(),this._longMonthsParse[o]=this.months(s,"").toLocaleLowerCase();return i?"MMM"===e?(n=cn.call(this._shortMonthsParse,r),n!==-1?n:null):(n=cn.call(this._longMonthsParse,r),n!==-1?n:null):"MMM"===e?(n=cn.call(this._shortMonthsParse,r),n!==-1?n:(n=cn.call(this._longMonthsParse,r),n!==-1?n:null)):(n=cn.call(this._longMonthsParse,r),n!==-1?n:(n=cn.call(this._shortMonthsParse,r),n!==-1?n:null))}function dt(t,e,i){var o,n,s;if(this._monthsParseExact)return ht.call(this,t,e,i);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),o=0;o<12;o++){if(n=u([2e3,o]),i&&!this._longMonthsParse[o]&&(this._longMonthsParse[o]=new RegExp("^"+this.months(n,"").replace(".","")+"$","i"),this._shortMonthsParse[o]=new RegExp("^"+this.monthsShort(n,"").replace(".","")+"$","i")),i||this._monthsParse[o]||(s="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[o]=new RegExp(s.replace(".",""),"i")),i&&"MMMM"===e&&this._longMonthsParse[o].test(t))return o;if(i&&"MMM"===e&&this._shortMonthsParse[o].test(t))return o;if(!i&&this._monthsParse[o].test(t))return o}}function lt(t,e){var i;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=w(e);else if(e=t.localeData().monthsParse(e),!r(e))return t;return i=Math.min(t.date(),st(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,i),t}function ut(t){return null!=t?(lt(this,t),e.updateOffset(this,!0),this):W(this,"Month")}function ct(){return st(this.year(),this.month())}function pt(t){return this._monthsParseExact?(d(this,"_monthsRegex")||mt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(d(this,"_monthsShortRegex")||(this._monthsShortRegex=vn),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function ft(t){return this._monthsParseExact?(d(this,"_monthsRegex")||mt.call(this),t?this._monthsStrictRegex:this._monthsRegex):(d(this,"_monthsRegex")||(this._monthsRegex=gn),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function mt(){function t(t,e){return e.length-t.length}var e,i,o=[],n=[],s=[];for(e=0;e<12;e++)i=u([2e3,e]),o.push(this.monthsShort(i,"")),n.push(this.months(i,"")),s.push(this.months(i,"")),s.push(this.monthsShort(i,""));for(o.sort(t),n.sort(t),s.sort(t),e=0;e<12;e++)o[e]=et(o[e]),n[e]=et(n[e]);for(e=0;e<24;e++)s[e]=et(s[e]);this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+o.join("|")+")","i")}function vt(t){return gt(t)?366:365}function gt(t){return t%4===0&&t%100!==0||t%400===0}function yt(){return gt(this.year())}function bt(t,e,i,o,n,s,r){var a=new Date(t,e,i,o,n,s,r);return t<100&&t>=0&&isFinite(a.getFullYear())&&a.setFullYear(t),a}function _t(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function wt(t,e,i){var o=7+e-i,n=(7+_t(t,0,o).getUTCDay()-e)%7;return-n+o-1}function xt(t,e,i,o,n){var s,r,a=(7+i-o)%7,h=wt(t,o,n),d=1+7*(e-1)+a+h;return d<=0?(s=t-1,r=vt(s)+d):d>vt(t)?(s=t+1,r=d-vt(t)):(s=t,r=d),{year:s,dayOfYear:r}}function kt(t,e,i){var o,n,s=wt(t.year(),e,i),r=Math.floor((t.dayOfYear()-s-1)/7)+1;return r<1?(n=t.year()-1,o=r+Ot(n,e,i)):r>Ot(t.year(),e,i)?(o=r-Ot(t.year(),e,i),n=t.year()+1):(n=t.year(),o=r),{week:o,year:n}}function Ot(t,e,i){var o=wt(t,e,i),n=wt(t+1,e,i);return(vt(t)-o+n)/7}function Dt(t){return kt(t,this._week.dow,this._week.doy).week}function St(){return this._week.dow}function Mt(){return this._week.doy}function Ct(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Tt(t){var e=kt(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Et(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Pt(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function It(t,e){return t?o(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]:this._weekdays}function Nt(t){return t?this._weekdaysShort[t.day()]:this._weekdaysShort}function zt(t){return t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Rt(t,e,i){var o,n,s,r=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],o=0;o<7;++o)s=u([2e3,1]).day(o),this._minWeekdaysParse[o]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[o]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[o]=this.weekdays(s,"").toLocaleLowerCase();return i?"dddd"===e?(n=cn.call(this._weekdaysParse,r),n!==-1?n:null):"ddd"===e?(n=cn.call(this._shortWeekdaysParse,r),n!==-1?n:null):(n=cn.call(this._minWeekdaysParse,r),n!==-1?n:null):"dddd"===e?(n=cn.call(this._weekdaysParse,r),n!==-1?n:(n=cn.call(this._shortWeekdaysParse,r),n!==-1?n:(n=cn.call(this._minWeekdaysParse,r),n!==-1?n:null))):"ddd"===e?(n=cn.call(this._shortWeekdaysParse,r),n!==-1?n:(n=cn.call(this._weekdaysParse,r),n!==-1?n:(n=cn.call(this._minWeekdaysParse,r),n!==-1?n:null))):(n=cn.call(this._minWeekdaysParse,r),n!==-1?n:(n=cn.call(this._weekdaysParse,r),n!==-1?n:(n=cn.call(this._shortWeekdaysParse,r),n!==-1?n:null)))}function Lt(t,e,i){var o,n,s;if(this._weekdaysParseExact)return Rt.call(this,t,e,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),o=0;o<7;o++){if(n=u([2e3,1]).day(o),i&&!this._fullWeekdaysParse[o]&&(this._fullWeekdaysParse[o]=new RegExp("^"+this.weekdays(n,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[o]=new RegExp("^"+this.weekdaysShort(n,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[o]=new RegExp("^"+this.weekdaysMin(n,"").replace(".",".?")+"$","i")),this._weekdaysParse[o]||(s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[o]=new RegExp(s.replace(".",""),"i")),i&&"dddd"===e&&this._fullWeekdaysParse[o].test(t))return o;if(i&&"ddd"===e&&this._shortWeekdaysParse[o].test(t))return o;if(i&&"dd"===e&&this._minWeekdaysParse[o].test(t))return o;if(!i&&this._weekdaysParse[o].test(t))return o}}function At(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Et(t,this.localeData()),this.add(t-e,"d")):e}function Bt(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function Ft(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Pt(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function Ht(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Yt.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=kn),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function jt(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Yt.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=On),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Wt(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Yt.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Dn),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Yt(){function t(t,e){return e.length-t.length}var e,i,o,n,s,r=[],a=[],h=[],d=[];for(e=0;e<7;e++)i=u([2e3,1]).day(e),o=this.weekdaysMin(i,""),n=this.weekdaysShort(i,""),s=this.weekdays(i,""),r.push(o),a.push(n),h.push(s),d.push(o),d.push(n),d.push(s);for(r.sort(t),a.sort(t),h.sort(t),d.sort(t),e=0;e<7;e++)a[e]=et(a[e]),h[e]=et(h[e]),d[e]=et(d[e]);this._weekdaysRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Gt(){return this.hours()%12||12}function Vt(){return this.hours()||24}function Ut(t,e){q(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function qt(t,e){return e._meridiemParse}function Xt(t){return"p"===(t+"").toLowerCase().charAt(0)}function Zt(t,e,i){return t>11?i?"pm":"PM":i?"am":"AM"}function Kt(t){return t?t.toLowerCase().replace("_","-"):t}function Qt(t){for(var e,i,o,n,s=0;s<t.length;){for(n=Kt(t[s]).split("-"),e=n.length,i=Kt(t[s+1]),i=i?i.split("-"):null;e>0;){if(o=Jt(n.slice(0,e).join("-")))return o;if(i&&i.length>=e&&x(n,i,!0)>=e-1)break;e--}s++}return null}function Jt(e){var i=null;if(!En[e]&&"undefined"!=typeof t&&t&&t.exports)try{i=Sn._abbr,!function(){var t=new Error('Cannot find module "./locale"');throw t.code="MODULE_NOT_FOUND",t}(),$t(i)}catch(t){}return En[e]}function $t(t,e){var i;return t&&(i=v(e)?ie(t):te(t,e),i&&(Sn=i)),Sn._abbr}function te(t,e){if(null!==e){var i=Tn;if(e.abbr=t,null!=En[t])D("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=En[t]._config;else if(null!=e.parentLocale){if(null==En[e.parentLocale])return Pn[e.parentLocale]||(Pn[e.parentLocale]=[]),Pn[e.parentLocale].push({name:t,config:e}),null;i=En[e.parentLocale]._config}return En[t]=new T(C(i,e)),Pn[t]&&Pn[t].forEach(function(t){te(t.name,t.config)}),$t(t),En[t]}return delete En[t],null}function ee(t,e){if(null!=e){var i,o=Tn;null!=En[t]&&(o=En[t]._config),e=C(o,e),i=new T(e),i.parentLocale=En[t],En[t]=i,$t(t)}else null!=En[t]&&(null!=En[t].parentLocale?En[t]=En[t].parentLocale:null!=En[t]&&delete En[t]);return En[t]}function ie(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return Sn;if(!o(t)){if(e=Jt(t))return e;t=[t]}return Qt(t)}function oe(){return Oo(En)}function ne(t){var e,i=t._a;return i&&p(t).overflow===-2&&(e=i[nn]<0||i[nn]>11?nn:i[sn]<1||i[sn]>st(i[on],i[nn])?sn:i[rn]<0||i[rn]>24||24===i[rn]&&(0!==i[an]||0!==i[hn]||0!==i[dn])?rn:i[an]<0||i[an]>59?an:i[hn]<0||i[hn]>59?hn:i[dn]<0||i[dn]>999?dn:-1,p(t)._overflowDayOfYear&&(e<on||e>sn)&&(e=sn),p(t)._overflowWeeks&&e===-1&&(e=ln),p(t)._overflowWeekday&&e===-1&&(e=un),p(t).overflow=e),t}function se(t){var e,i,o,n,s,r,a=t._i,h=In.exec(a)||Nn.exec(a);if(h){for(p(t).iso=!0,e=0,i=Rn.length;e<i;e++)if(Rn[e][1].exec(h[1])){n=Rn[e][0],o=Rn[e][2]!==!1;break}if(null==n)return void(t._isValid=!1);if(h[3]){for(e=0,i=Ln.length;e<i;e++)if(Ln[e][1].exec(h[3])){s=(h[2]||" ")+Ln[e][0];break}if(null==s)return void(t._isValid=!1)}if(!o&&null!=s)return void(t._isValid=!1);if(h[4]){if(!zn.exec(h[4]))return void(t._isValid=!1);r="Z"}t._f=n+(s||"")+(r||""),ue(t)}else t._isValid=!1}function re(t){var i=An.exec(t._i);return null!==i?void(t._d=new Date(+i[1])):(se(t),void(t._isValid===!1&&(delete t._isValid,e.createFromInputFallback(t))))}function ae(t,e,i){return null!=t?t:null!=e?e:i}function he(t){var i=new Date(e.now());return t._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()]}function de(t){var e,i,o,n,s=[];if(!t._d){for(o=he(t),t._w&&null==t._a[sn]&&null==t._a[nn]&&le(t),t._dayOfYear&&(n=ae(t._a[on],o[on]),t._dayOfYear>vt(n)&&(p(t)._overflowDayOfYear=!0),i=_t(n,0,t._dayOfYear),t._a[nn]=i.getUTCMonth(),t._a[sn]=i.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=s[e]=o[e];for(;e<7;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[rn]&&0===t._a[an]&&0===t._a[hn]&&0===t._a[dn]&&(t._nextDay=!0,t._a[rn]=0),t._d=(t._useUTC?_t:bt).apply(null,s),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[rn]=24)}}function le(t){var e,i,o,n,s,r,a,h;if(e=t._w,null!=e.GG||null!=e.W||null!=e.E)s=1,r=4,i=ae(e.GG,t._a[on],kt(be(),1,4).year),o=ae(e.W,1),n=ae(e.E,1),(n<1||n>7)&&(h=!0);else{s=t._locale._week.dow,r=t._locale._week.doy;var d=kt(be(),s,r);i=ae(e.gg,t._a[on],d.year),o=ae(e.w,d.week),null!=e.d?(n=e.d,(n<0||n>6)&&(h=!0)):null!=e.e?(n=e.e+s,(e.e<0||e.e>6)&&(h=!0)):n=s}o<1||o>Ot(i,s,r)?p(t)._overflowWeeks=!0:null!=h?p(t)._overflowWeekday=!0:(a=xt(i,o,n,s,r),t._a[on]=a.year,t._dayOfYear=a.dayOfYear)}function ue(t){if(t._f===e.ISO_8601)return void se(t);t._a=[],p(t).empty=!0;var i,o,n,s,r,a=""+t._i,h=a.length,d=0;for(n=Q(t._f,t._locale).match(No)||[],i=0;i<n.length;i++)s=n[i],o=(a.match($(s,t))||[])[0],o&&(r=a.substr(0,a.indexOf(o)),r.length>0&&p(t).unusedInput.push(r),a=a.slice(a.indexOf(o)+o.length),d+=o.length),Lo[s]?(o?p(t).empty=!1:p(t).unusedTokens.push(s),nt(s,o,t)):t._strict&&!o&&p(t).unusedTokens.push(s);p(t).charsLeftOver=h-d,a.length>0&&p(t).unusedInput.push(a),t._a[rn]<=12&&p(t).bigHour===!0&&t._a[rn]>0&&(p(t).bigHour=void 0),p(t).parsedDateParts=t._a.slice(0),p(t).meridiem=t._meridiem,t._a[rn]=ce(t._locale,t._a[rn],t._meridiem),de(t),ne(t)}function ce(t,e,i){var o;return null==i?e:null!=t.meridiemHour?t.meridiemHour(e,i):null!=t.isPM?(o=t.isPM(i),o&&e<12&&(e+=12),o||12!==e||(e=0),e):e}function pe(t){var e,i,o,n,s;if(0===t._f.length)return p(t).invalidFormat=!0,void(t._d=new Date(NaN));for(n=0;n<t._f.length;n++)s=0,e=g({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[n],ue(e),f(e)&&(s+=p(e).charsLeftOver,s+=10*p(e).unusedTokens.length,p(e).score=s,(null==o||s<o)&&(o=s,i=e));l(t,i||e)}function fe(t){if(!t._d){var e=B(t._i);t._a=h([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),de(t)}}function me(t){var e=new y(ne(ve(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function ve(t){var e=t._i,i=t._f;return t._locale=t._locale||ie(t._l),null===e||void 0===i&&""===e?m({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),b(e)?new y(ne(e)):(a(e)?t._d=e:o(i)?pe(t):i?ue(t):ge(t),f(t)||(t._d=null),t))}function ge(t){var i=t._i;void 0===i?t._d=new Date(e.now()):a(i)?t._d=new Date(i.valueOf()):"string"==typeof i?re(t):o(i)?(t._a=h(i.slice(0),function(t){return parseInt(t,10)}),de(t)):"object"==typeof i?fe(t):r(i)?t._d=new Date(i):e.createFromInputFallback(t)}function ye(t,e,i,r,a){var h={};return i!==!0&&i!==!1||(r=i,i=void 0),(n(t)&&s(t)||o(t)&&0===t.length)&&(t=void 0),h._isAMomentObject=!0,h._useUTC=h._isUTC=a,h._l=i,h._i=t,h._f=e,h._strict=r,me(h)}function be(t,e,i,o){return ye(t,e,i,o,!1)}function _e(t,e){var i,n;if(1===e.length&&o(e[0])&&(e=e[0]),!e.length)return be();for(i=e[0],n=1;n<e.length;++n)e[n].isValid()&&!e[n][t](i)||(i=e[n]);return i}function we(){var t=[].slice.call(arguments,0);return _e("isBefore",t)}function xe(){var t=[].slice.call(arguments,0);return _e("isAfter",t)}function ke(t){var e=B(t),i=e.year||0,o=e.quarter||0,n=e.month||0,s=e.week||0,r=e.day||0,a=e.hour||0,h=e.minute||0,d=e.second||0,l=e.millisecond||0;this._milliseconds=+l+1e3*d+6e4*h+1e3*a*60*60,this._days=+r+7*s,this._months=+n+3*o+12*i,this._data={},this._locale=ie(),this._bubble()}function Oe(t){return t instanceof ke}function De(t){return t<0?Math.round(-1*t)*-1:Math.round(t)}function Se(t,e){q(t,0,0,function(){var t=this.utcOffset(),i="+";return t<0&&(t=-t,i="-"),i+U(~~(t/60),2)+e+U(~~t%60,2)})}function Me(t,e){var i=(e||"").match(t);if(null===i)return null;var o=i[i.length-1]||[],n=(o+"").match(jn)||["-",0,0],s=+(60*n[1])+w(n[2]);return 0===s?0:"+"===n[0]?s:-s}function Ce(t,i){var o,n;return i._isUTC?(o=i.clone(),n=(b(t)||a(t)?t.valueOf():be(t).valueOf())-o.valueOf(),o._d.setTime(o._d.valueOf()+n),e.updateOffset(o,!1),o):be(t).local()}function Te(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Ee(t,i){var o,n=this._offset||0;if(!this.isValid())return null!=t?this:NaN;if(null!=t){if("string"==typeof t){if(t=Me(Qo,t),null===t)return this}else Math.abs(t)<16&&(t*=60);return!this._isUTC&&i&&(o=Te(this)),this._offset=t,this._isUTC=!0,null!=o&&this.add(o,"m"),n!==t&&(!i||this._changeInProgress?Ue(this,je(t-n,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?n:Te(this)}function Pe(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function Ie(t){return this.utcOffset(0,t)}function Ne(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(Te(this),"m")),this}function ze(){if(null!=this._tzm)this.utcOffset(this._tzm);else if("string"==typeof this._i){var t=Me(Ko,this._i);null!=t?this.utcOffset(t):this.utcOffset(0,!0)}return this}function Re(t){return!!this.isValid()&&(t=t?be(t).utcOffset():0,(this.utcOffset()-t)%60===0)}function Le(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ae(){if(!v(this._isDSTShifted))return this._isDSTShifted;var t={};if(g(t,this),t=ve(t),t._a){var e=t._isUTC?u(t._a):be(t._a);this._isDSTShifted=this.isValid()&&x(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Be(){return!!this.isValid()&&!this._isUTC}function Fe(){return!!this.isValid()&&this._isUTC}function He(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function je(t,e){var i,o,n,s=t,a=null;return Oe(t)?s={ms:t._milliseconds,d:t._days,M:t._months}:r(t)?(s={},e?s[e]=t:s.milliseconds=t):(a=Wn.exec(t))?(i="-"===a[1]?-1:1,s={y:0,d:w(a[sn])*i,h:w(a[rn])*i,m:w(a[an])*i,s:w(a[hn])*i,ms:w(De(1e3*a[dn]))*i}):(a=Yn.exec(t))?(i="-"===a[1]?-1:1,s={y:We(a[2],i),M:We(a[3],i),w:We(a[4],i),d:We(a[5],i),h:We(a[6],i),m:We(a[7],i),s:We(a[8],i)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(n=Ge(be(s.from),be(s.to)),s={},s.ms=n.milliseconds,s.M=n.months),o=new ke(s),Oe(t)&&d(t,"_locale")&&(o._locale=t._locale),o}function We(t,e){var i=t&&parseFloat(t.replace(",","."));return(isNaN(i)?0:i)*e}function Ye(t,e){var i={milliseconds:0,months:0};return i.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(i.months,"M").isAfter(e)&&--i.months,i.milliseconds=+e-+t.clone().add(i.months,"M"),i}function Ge(t,e){var i;return t.isValid()&&e.isValid()?(e=Ce(e,t),t.isBefore(e)?i=Ye(t,e):(i=Ye(e,t),i.milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function Ve(t,e){return function(i,o){var n,s;return null===o||isNaN(+o)||(D(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),s=i,i=o,o=s),i="string"==typeof i?+i:i,n=je(i,o),Ue(this,n,t),this}}function Ue(t,i,o,n){var s=i._milliseconds,r=De(i._days),a=De(i._months);t.isValid()&&(n=null==n||n,s&&t._d.setTime(t._d.valueOf()+s*o),r&&Y(t,"Date",W(t,"Date")+r*o),a&&lt(t,W(t,"Month")+a*o),n&&e.updateOffset(t,r||a))}function qe(t,e){var i=t.diff(e,"days",!0);return i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse"}function Xe(t,i){var o=t||be(),n=Ce(o,this).startOf("day"),s=e.calendarFormat(this,n)||"sameElse",r=i&&(S(i[s])?i[s].call(this,o):i[s]);return this.format(r||this.localeData().calendar(s,this,be(o)))}function Ze(){return new y(this)}function Ke(t,e){var i=b(t)?t:be(t);return!(!this.isValid()||!i.isValid())&&(e=A(v(e)?"millisecond":e),"millisecond"===e?this.valueOf()>i.valueOf():i.valueOf()<this.clone().startOf(e).valueOf())}function Qe(t,e){var i=b(t)?t:be(t);return!(!this.isValid()||!i.isValid())&&(e=A(v(e)?"millisecond":e),"millisecond"===e?this.valueOf()<i.valueOf():this.clone().endOf(e).valueOf()<i.valueOf())}function Je(t,e,i,o){return o=o||"()",("("===o[0]?this.isAfter(t,i):!this.isBefore(t,i))&&(")"===o[1]?this.isBefore(e,i):!this.isAfter(e,i))}function $e(t,e){var i,o=b(t)?t:be(t);return!(!this.isValid()||!o.isValid())&&(e=A(e||"millisecond"),"millisecond"===e?this.valueOf()===o.valueOf():(i=o.valueOf(),this.clone().startOf(e).valueOf()<=i&&i<=this.clone().endOf(e).valueOf()))}function ti(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function ei(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function ii(t,e,i){var o,n,s,r;return this.isValid()?(o=Ce(t,this),o.isValid()?(n=6e4*(o.utcOffset()-this.utcOffset()),e=A(e),"year"===e||"month"===e||"quarter"===e?(r=oi(this,o),"quarter"===e?r/=3:"year"===e&&(r/=12)):(s=this-o,r="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-n)/864e5:"week"===e?(s-n)/6048e5:s),i?r:_(r)):NaN):NaN}function oi(t,e){var i,o,n=12*(e.year()-t.year())+(e.month()-t.month()),s=t.clone().add(n,"months");return e-s<0?(i=t.clone().add(n-1,"months"),o=(e-s)/(s-i)):(i=t.clone().add(n+1,"months"),o=(e-s)/(i-s)),-(n+o)||0}function ni(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function si(){var t=this.clone().utc();return 0<t.year()&&t.year()<=9999?S(Date.prototype.toISOString)?this.toDate().toISOString():K(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):K(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function ri(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var i="["+t+'("]',o=0<this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",s=e+'[")]';return this.format(i+o+n+s)}function ai(t){t||(t=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var i=K(this,t);return this.localeData().postformat(i)}function hi(t,e){return this.isValid()&&(b(t)&&t.isValid()||be(t).isValid())?je({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function di(t){return this.from(be(),t)}function li(t,e){return this.isValid()&&(b(t)&&t.isValid()||be(t).isValid())?je({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function ui(t){return this.to(be(),t)}function ci(t){var e;return void 0===t?this._locale._abbr:(e=ie(t),null!=e&&(this._locale=e),this)}function pi(){return this._locale}function fi(t){switch(t=A(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this}function mi(t){return t=A(t),void 0===t||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))}function vi(){return this._d.valueOf()-6e4*(this._offset||0)}function gi(){return Math.floor(this.valueOf()/1e3)}function yi(){return new Date(this.valueOf())}function bi(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function _i(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function wi(){return this.isValid()?this.toISOString():null}function xi(){return f(this)}function ki(){return l({},p(this))}function Oi(){return p(this).overflow}function Di(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Si(t,e){q(0,[t,t.length],0,e)}function Mi(t){return Pi.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Ci(t){return Pi.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function Ti(){return Ot(this.year(),1,4)}function Ei(){var t=this.localeData()._week;return Ot(this.year(),t.dow,t.doy)}function Pi(t,e,i,o,n){var s;return null==t?kt(this,o,n).year:(s=Ot(t,o,n),e>s&&(e=s),Ii.call(this,t,e,i,o,n))}function Ii(t,e,i,o,n){var s=xt(t,e,i,o,n),r=_t(s.year,0,s.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}function Ni(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function zi(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function Ri(t,e){e[dn]=w(1e3*("0."+t))}function Li(){return this._isUTC?"UTC":""}function Ai(){return this._isUTC?"Coordinated Universal Time":""}function Bi(t){return be(1e3*t)}function Fi(){return be.apply(null,arguments).parseZone()}function Hi(t){return t}function ji(t,e,i,o){var n=ie(),s=u().set(o,e);return n[i](s,t)}function Wi(t,e,i){if(r(t)&&(e=t,t=void 0),t=t||"",null!=e)return ji(t,e,i,"month");var o,n=[];for(o=0;o<12;o++)n[o]=ji(t,o,i,"month");return n}function Yi(t,e,i,o){"boolean"==typeof t?(r(e)&&(i=e,e=void 0),e=e||""):(e=t,i=e,t=!1,r(e)&&(i=e,e=void 0),e=e||"");var n=ie(),s=t?n._week.dow:0;if(null!=i)return ji(e,(i+s)%7,o,"day");var a,h=[];for(a=0;a<7;a++)h[a]=ji(e,(a+s)%7,o,"day");return h}function Gi(t,e){return Wi(t,e,"months")}function Vi(t,e){return Wi(t,e,"monthsShort")}function Ui(t,e,i){return Yi(t,e,i,"weekdays")}function qi(t,e,i){return Yi(t,e,i,"weekdaysShort")}function Xi(t,e,i){return Yi(t,e,i,"weekdaysMin")}function Zi(){var t=this._data;return this._milliseconds=ts(this._milliseconds),this._days=ts(this._days),this._months=ts(this._months),t.milliseconds=ts(t.milliseconds),t.seconds=ts(t.seconds),t.minutes=ts(t.minutes),t.hours=ts(t.hours),t.months=ts(t.months),t.years=ts(t.years),this}function Ki(t,e,i,o){var n=je(e,i);return t._milliseconds+=o*n._milliseconds,t._days+=o*n._days,t._months+=o*n._months,t._bubble()}function Qi(t,e){return Ki(this,t,e,1)}function Ji(t,e){return Ki(this,t,e,-1)}function $i(t){return t<0?Math.floor(t):Math.ceil(t)}function to(){var t,e,i,o,n,s=this._milliseconds,r=this._days,a=this._months,h=this._data;return s>=0&&r>=0&&a>=0||s<=0&&r<=0&&a<=0||(s+=864e5*$i(io(a)+r),r=0,a=0),h.milliseconds=s%1e3,t=_(s/1e3),h.seconds=t%60,e=_(t/60),h.minutes=e%60,i=_(e/60),h.hours=i%24,r+=_(i/24),n=_(eo(r)),a+=n,r-=$i(io(n)),o=_(a/12),a%=12,h.days=r,h.months=a,h.years=o,this}function eo(t){return 4800*t/146097}function io(t){return 146097*t/4800}function oo(t){var e,i,o=this._milliseconds;if(t=A(t),"month"===t||"year"===t)return e=this._days+o/864e5,i=this._months+eo(e),
+"month"===t?i:i/12;switch(e=this._days+Math.round(io(this._months)),t){case"week":return e/7+o/6048e5;case"day":return e+o/864e5;case"hour":return 24*e+o/36e5;case"minute":return 1440*e+o/6e4;case"second":return 86400*e+o/1e3;case"millisecond":return Math.floor(864e5*e)+o;default:throw new Error("Unknown unit "+t)}}function no(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*w(this._months/12)}function so(t){return function(){return this.as(t)}}function ro(t){return t=A(t),this[t+"s"]()}function ao(t){return function(){return this._data[t]}}function ho(){return _(this.days()/7)}function lo(t,e,i,o,n){return n.relativeTime(e||1,!!i,t,o)}function uo(t,e,i){var o=je(t).abs(),n=vs(o.as("s")),s=vs(o.as("m")),r=vs(o.as("h")),a=vs(o.as("d")),h=vs(o.as("M")),d=vs(o.as("y")),l=n<gs.s&&["s",n]||s<=1&&["m"]||s<gs.m&&["mm",s]||r<=1&&["h"]||r<gs.h&&["hh",r]||a<=1&&["d"]||a<gs.d&&["dd",a]||h<=1&&["M"]||h<gs.M&&["MM",h]||d<=1&&["y"]||["yy",d];return l[2]=e,l[3]=+t>0,l[4]=i,lo.apply(null,l)}function co(t){return void 0===t?vs:"function"==typeof t&&(vs=t,!0)}function po(t,e){return void 0!==gs[t]&&(void 0===e?gs[t]:(gs[t]=e,!0))}function fo(t){var e=this.localeData(),i=uo(this,!t,e);return t&&(i=e.pastFuture(+this,i)),e.postformat(i)}function mo(){var t,e,i,o=ys(this._milliseconds)/1e3,n=ys(this._days),s=ys(this._months);t=_(o/60),e=_(t/60),o%=60,t%=60,i=_(s/12),s%=12;var r=i,a=s,h=n,d=e,l=t,u=o,c=this.asSeconds();return c?(c<0?"-":"")+"P"+(r?r+"Y":"")+(a?a+"M":"")+(h?h+"D":"")+(d||l||u?"T":"")+(d?d+"H":"")+(l?l+"M":"")+(u?u+"S":""):"P0D"}var vo,go;go=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),i=e.length>>>0,o=0;o<i;o++)if(o in e&&t.call(this,e[o],o,e))return!0;return!1};var yo=go,bo=e.momentProperties=[],_o=!1,wo={};e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;var xo;xo=Object.keys?Object.keys:function(t){var e,i=[];for(e in t)d(t,e)&&i.push(e);return i};var ko,Oo=xo,Do={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},So={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Mo="Invalid date",Co="%d",To=/\d{1,2}/,Eo={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"},Po={},Io={},No=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,zo=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ro={},Lo={},Ao=/\d/,Bo=/\d\d/,Fo=/\d{3}/,Ho=/\d{4}/,jo=/[+-]?\d{6}/,Wo=/\d\d?/,Yo=/\d\d\d\d?/,Go=/\d\d\d\d\d\d?/,Vo=/\d{1,3}/,Uo=/\d{1,4}/,qo=/[+-]?\d{1,6}/,Xo=/\d+/,Zo=/[+-]?\d+/,Ko=/Z|[+-]\d\d:?\d\d/gi,Qo=/Z|[+-]\d\d(?::?\d\d)?/gi,Jo=/[+-]?\d+(\.\d{1,3})?/,$o=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,tn={},en={},on=0,nn=1,sn=2,rn=3,an=4,hn=5,dn=6,ln=7,un=8;ko=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1};var cn=ko;q("M",["MM",2],"Mo",function(){return this.month()+1}),q("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),q("MMMM",0,0,function(t){return this.localeData().months(this,t)}),L("month","M"),F("month",8),J("M",Wo),J("MM",Wo,Bo),J("MMM",function(t,e){return e.monthsShortRegex(t)}),J("MMMM",function(t,e){return e.monthsRegex(t)}),it(["M","MM"],function(t,e){e[nn]=w(t)-1}),it(["MMM","MMMM"],function(t,e,i,o){var n=i._locale.monthsParse(t,o,i._strict);null!=n?e[nn]=n:p(i).invalidMonth=t});var pn=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,fn="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),mn="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),vn=$o,gn=$o;q("Y",0,0,function(){var t=this.year();return t<=9999?""+t:"+"+t}),q(0,["YY",2],0,function(){return this.year()%100}),q(0,["YYYY",4],0,"year"),q(0,["YYYYY",5],0,"year"),q(0,["YYYYYY",6,!0],0,"year"),L("year","y"),F("year",1),J("Y",Zo),J("YY",Wo,Bo),J("YYYY",Uo,Ho),J("YYYYY",qo,jo),J("YYYYYY",qo,jo),it(["YYYYY","YYYYYY"],on),it("YYYY",function(t,i){i[on]=2===t.length?e.parseTwoDigitYear(t):w(t)}),it("YY",function(t,i){i[on]=e.parseTwoDigitYear(t)}),it("Y",function(t,e){e[on]=parseInt(t,10)}),e.parseTwoDigitYear=function(t){return w(t)+(w(t)>68?1900:2e3)};var yn=j("FullYear",!0);q("w",["ww",2],"wo","week"),q("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),F("week",5),F("isoWeek",5),J("w",Wo),J("ww",Wo,Bo),J("W",Wo),J("WW",Wo,Bo),ot(["w","ww","W","WW"],function(t,e,i,o){e[o.substr(0,1)]=w(t)});var bn={dow:0,doy:6};q("d",0,"do","day"),q("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),q("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),q("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),q("e",0,0,"weekday"),q("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),J("d",Wo),J("e",Wo),J("E",Wo),J("dd",function(t,e){return e.weekdaysMinRegex(t)}),J("ddd",function(t,e){return e.weekdaysShortRegex(t)}),J("dddd",function(t,e){return e.weekdaysRegex(t)}),ot(["dd","ddd","dddd"],function(t,e,i,o){var n=i._locale.weekdaysParse(t,o,i._strict);null!=n?e.d=n:p(i).invalidWeekday=t}),ot(["d","e","E"],function(t,e,i,o){e[o]=w(t)});var _n="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),wn="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),xn="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),kn=$o,On=$o,Dn=$o;q("H",["HH",2],0,"hour"),q("h",["hh",2],0,Gt),q("k",["kk",2],0,Vt),q("hmm",0,0,function(){return""+Gt.apply(this)+U(this.minutes(),2)}),q("hmmss",0,0,function(){return""+Gt.apply(this)+U(this.minutes(),2)+U(this.seconds(),2)}),q("Hmm",0,0,function(){return""+this.hours()+U(this.minutes(),2)}),q("Hmmss",0,0,function(){return""+this.hours()+U(this.minutes(),2)+U(this.seconds(),2)}),Ut("a",!0),Ut("A",!1),L("hour","h"),F("hour",13),J("a",qt),J("A",qt),J("H",Wo),J("h",Wo),J("HH",Wo,Bo),J("hh",Wo,Bo),J("hmm",Yo),J("hmmss",Go),J("Hmm",Yo),J("Hmmss",Go),it(["H","HH"],rn),it(["a","A"],function(t,e,i){i._isPm=i._locale.isPM(t),i._meridiem=t}),it(["h","hh"],function(t,e,i){e[rn]=w(t),p(i).bigHour=!0}),it("hmm",function(t,e,i){var o=t.length-2;e[rn]=w(t.substr(0,o)),e[an]=w(t.substr(o)),p(i).bigHour=!0}),it("hmmss",function(t,e,i){var o=t.length-4,n=t.length-2;e[rn]=w(t.substr(0,o)),e[an]=w(t.substr(o,2)),e[hn]=w(t.substr(n)),p(i).bigHour=!0}),it("Hmm",function(t,e,i){var o=t.length-2;e[rn]=w(t.substr(0,o)),e[an]=w(t.substr(o))}),it("Hmmss",function(t,e,i){var o=t.length-4,n=t.length-2;e[rn]=w(t.substr(0,o)),e[an]=w(t.substr(o,2)),e[hn]=w(t.substr(n))});var Sn,Mn=/[ap]\.?m?\.?/i,Cn=j("Hours",!0),Tn={calendar:Do,longDateFormat:So,invalidDate:Mo,ordinal:Co,ordinalParse:To,relativeTime:Eo,months:fn,monthsShort:mn,week:bn,weekdays:_n,weekdaysMin:xn,weekdaysShort:wn,meridiemParse:Mn},En={},Pn={},In=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Nn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,zn=/Z|[+-]\d\d(?::?\d\d)?/,Rn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Ln=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],An=/^\/?Date\((\-?\d+)/i;e.createFromInputFallback=O("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),e.ISO_8601=function(){};var Bn=O("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=be.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:m()}),Fn=O("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=be.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:m()}),Hn=function(){return Date.now?Date.now():+new Date};Se("Z",":"),Se("ZZ",""),J("Z",Qo),J("ZZ",Qo),it(["Z","ZZ"],function(t,e,i){i._useUTC=!0,i._tzm=Me(Qo,t)});var jn=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Wn=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Yn=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;je.fn=ke.prototype;var Gn=Ve(1,"add"),Vn=Ve(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Un=O("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});q(0,["gg",2],0,function(){return this.weekYear()%100}),q(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Si("gggg","weekYear"),Si("ggggg","weekYear"),Si("GGGG","isoWeekYear"),Si("GGGGG","isoWeekYear"),L("weekYear","gg"),L("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),J("G",Zo),J("g",Zo),J("GG",Wo,Bo),J("gg",Wo,Bo),J("GGGG",Uo,Ho),J("gggg",Uo,Ho),J("GGGGG",qo,jo),J("ggggg",qo,jo),ot(["gggg","ggggg","GGGG","GGGGG"],function(t,e,i,o){e[o.substr(0,2)]=w(t)}),ot(["gg","GG"],function(t,i,o,n){i[n]=e.parseTwoDigitYear(t)}),q("Q",0,"Qo","quarter"),L("quarter","Q"),F("quarter",7),J("Q",Ao),it("Q",function(t,e){e[nn]=3*(w(t)-1)}),q("D",["DD",2],"Do","date"),L("date","D"),F("date",9),J("D",Wo),J("DD",Wo,Bo),J("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),it(["D","DD"],sn),it("Do",function(t,e){e[sn]=w(t.match(Wo)[0],10)});var qn=j("Date",!0);q("DDD",["DDDD",3],"DDDo","dayOfYear"),L("dayOfYear","DDD"),F("dayOfYear",4),J("DDD",Vo),J("DDDD",Fo),it(["DDD","DDDD"],function(t,e,i){i._dayOfYear=w(t)}),q("m",["mm",2],0,"minute"),L("minute","m"),F("minute",14),J("m",Wo),J("mm",Wo,Bo),it(["m","mm"],an);var Xn=j("Minutes",!1);q("s",["ss",2],0,"second"),L("second","s"),F("second",15),J("s",Wo),J("ss",Wo,Bo),it(["s","ss"],hn);var Zn=j("Seconds",!1);q("S",0,0,function(){return~~(this.millisecond()/100)}),q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),q(0,["SSS",3],0,"millisecond"),q(0,["SSSS",4],0,function(){return 10*this.millisecond()}),q(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),q(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),q(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),q(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),q(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),L("millisecond","ms"),F("millisecond",16),J("S",Vo,Ao),J("SS",Vo,Bo),J("SSS",Vo,Fo);var Kn;for(Kn="SSSS";Kn.length<=9;Kn+="S")J(Kn,Xo);for(Kn="S";Kn.length<=9;Kn+="S")it(Kn,Ri);var Qn=j("Milliseconds",!1);q("z",0,0,"zoneAbbr"),q("zz",0,0,"zoneName");var Jn=y.prototype;Jn.add=Gn,Jn.calendar=Xe,Jn.clone=Ze,Jn.diff=ii,Jn.endOf=mi,Jn.format=ai,Jn.from=hi,Jn.fromNow=di,Jn.to=li,Jn.toNow=ui,Jn.get=G,Jn.invalidAt=Oi,Jn.isAfter=Ke,Jn.isBefore=Qe,Jn.isBetween=Je,Jn.isSame=$e,Jn.isSameOrAfter=ti,Jn.isSameOrBefore=ei,Jn.isValid=xi,Jn.lang=Un,Jn.locale=ci,Jn.localeData=pi,Jn.max=Fn,Jn.min=Bn,Jn.parsingFlags=ki,Jn.set=V,Jn.startOf=fi,Jn.subtract=Vn,Jn.toArray=bi,Jn.toObject=_i,Jn.toDate=yi,Jn.toISOString=si,Jn.inspect=ri,Jn.toJSON=wi,Jn.toString=ni,Jn.unix=gi,Jn.valueOf=vi,Jn.creationData=Di,Jn.year=yn,Jn.isLeapYear=yt,Jn.weekYear=Mi,Jn.isoWeekYear=Ci,Jn.quarter=Jn.quarters=Ni,Jn.month=ut,Jn.daysInMonth=ct,Jn.week=Jn.weeks=Ct,Jn.isoWeek=Jn.isoWeeks=Tt,Jn.weeksInYear=Ei,Jn.isoWeeksInYear=Ti,Jn.date=qn,Jn.day=Jn.days=At,Jn.weekday=Bt,Jn.isoWeekday=Ft,Jn.dayOfYear=zi,Jn.hour=Jn.hours=Cn,Jn.minute=Jn.minutes=Xn,Jn.second=Jn.seconds=Zn,Jn.millisecond=Jn.milliseconds=Qn,Jn.utcOffset=Ee,Jn.utc=Ie,Jn.local=Ne,Jn.parseZone=ze,Jn.hasAlignedHourOffset=Re,Jn.isDST=Le,Jn.isLocal=Be,Jn.isUtcOffset=Fe,Jn.isUtc=He,Jn.isUTC=He,Jn.zoneAbbr=Li,Jn.zoneName=Ai,Jn.dates=O("dates accessor is deprecated. Use date instead.",qn),Jn.months=O("months accessor is deprecated. Use month instead",ut),Jn.years=O("years accessor is deprecated. Use year instead",yn),Jn.zone=O("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Pe),Jn.isDSTShifted=O("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ae);var $n=T.prototype;$n.calendar=E,$n.longDateFormat=P,$n.invalidDate=I,$n.ordinal=N,$n.preparse=Hi,$n.postformat=Hi,$n.relativeTime=z,$n.pastFuture=R,$n.set=M,$n.months=rt,$n.monthsShort=at,$n.monthsParse=dt,$n.monthsRegex=ft,$n.monthsShortRegex=pt,$n.week=Dt,$n.firstDayOfYear=Mt,$n.firstDayOfWeek=St,$n.weekdays=It,$n.weekdaysMin=zt,$n.weekdaysShort=Nt,$n.weekdaysParse=Lt,$n.weekdaysRegex=Ht,$n.weekdaysShortRegex=jt,$n.weekdaysMinRegex=Wt,$n.isPM=Xt,$n.meridiem=Zt,$t("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,i=1===w(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+i}}),e.lang=O("moment.lang is deprecated. Use moment.locale instead.",$t),e.langData=O("moment.langData is deprecated. Use moment.localeData instead.",ie);var ts=Math.abs,es=so("ms"),is=so("s"),os=so("m"),ns=so("h"),ss=so("d"),rs=so("w"),as=so("M"),hs=so("y"),ds=ao("milliseconds"),ls=ao("seconds"),us=ao("minutes"),cs=ao("hours"),ps=ao("days"),fs=ao("months"),ms=ao("years"),vs=Math.round,gs={s:45,m:45,h:22,d:26,M:11},ys=Math.abs,bs=ke.prototype;return bs.abs=Zi,bs.add=Qi,bs.subtract=Ji,bs.as=oo,bs.asMilliseconds=es,bs.asSeconds=is,bs.asMinutes=os,bs.asHours=ns,bs.asDays=ss,bs.asWeeks=rs,bs.asMonths=as,bs.asYears=hs,bs.valueOf=no,bs._bubble=to,bs.get=ro,bs.milliseconds=ds,bs.seconds=ls,bs.minutes=us,bs.hours=cs,bs.days=ps,bs.weeks=ho,bs.months=fs,bs.years=ms,bs.humanize=fo,bs.toISOString=mo,bs.toString=mo,bs.toJSON=mo,bs.locale=ci,bs.localeData=pi,bs.toIsoString=O("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",mo),bs.lang=Un,q("X",0,0,"unix"),q("x",0,0,"valueOf"),J("x",Zo),J("X",Jo),it("X",function(t,e,i){i._d=new Date(1e3*parseFloat(t,10))}),it("x",function(t,e,i){i._d=new Date(w(t))}),e.version="2.17.1",i(be),e.fn=Jn,e.min=we,e.max=xe,e.now=Hn,e.utc=u,e.unix=Bi,e.months=Gi,e.isDate=a,e.locale=$t,e.invalid=m,e.duration=je,e.isMoment=b,e.weekdays=Ui,e.parseZone=Fi,e.localeData=ie,e.isDuration=Oe,e.monthsShort=Vi,e.weekdaysMin=Xi,e.defineLocale=te,e.updateLocale=ee,e.locales=oe,e.weekdaysShort=qi,e.normalizeUnits=A,e.relativeTimeRounding=co,e.relativeTimeThreshold=po,e.calendarFormat=qe,e.prototype=Jn,e})}).call(e,i(86)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){function i(t){throw new Error("Cannot find module '"+t+"'.")}i.keys=function(){return[]},i.resolve=i,t.exports=i,i.id=87},function(t,e){(function(e){function i(t,e,i){var o=e&&i||0,n=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){n<16&&(e[o+n++]=u[t])});n<16;)e[o+n++]=0;return e}function o(t,e){var i=e||0,o=l;return o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]}function n(t,e,i){var n=e&&i||0,s=e||[];t=t||{};var r=void 0!==t.clockseq?t.clockseq:m,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),h=void 0!==t.nsecs?t.nsecs:g+1,d=a-v+(h-g)/1e4;if(d<0&&void 0===t.clockseq&&(r=r+1&16383),(d<0||a>v)&&void 0===t.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");v=a,g=h,m=r,a+=122192928e5;var l=(1e4*(268435455&a)+h)%4294967296;s[n++]=l>>>24&255,s[n++]=l>>>16&255,s[n++]=l>>>8&255,s[n++]=255&l;var u=a/4294967296*1e4&268435455;s[n++]=u>>>8&255,s[n++]=255&u,s[n++]=u>>>24&15|16,s[n++]=u>>>16&255,s[n++]=r>>>8|128,s[n++]=255&r;for(var c=t.node||f,p=0;p<6;p++)s[n+p]=c[p];return e?e:o(s)}function s(t,e,i){var n=e&&i||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;a++)e[n+a]=s[a];return e||o(s)}var r,a="undefined"!=typeof window?window:"undefined"!=typeof e?e:null;if(a&&a.crypto&&crypto.getRandomValues){var h=new Uint8Array(16);r=function(){return crypto.getRandomValues(h),h}}if(!r){var d=new Array(16);r=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),d[e]=t>>>((3&e)<<3)&255;return d}}for(var l=[],u={},c=0;c<256;c++)l[c]=(c+256).toString(16).substr(1),u[l[c]]=c;var p=r(),f=[1|p[0],p[1],p[2],p[3],p[4],p[5]],m=16383&(p[6]<<8|p[7]),v=0,g=0,y=s;y.v1=n,y.v4=s,y.parse=i,y.unparse=o,t.exports=y}).call(e,function(){return this}())},function(t,e,i){e.util=i(1),e.DOMutil=i(90),e.DataSet=i(91),e.DataView=i(93),e.Queue=i(92),e.Graph3d=i(94),e.graph3d={Camera:i(98),Filter:i(103),Point2d:i(97),Point3d:i(96),Slider:i(104),StepNumber:i(105)},e.moment=i(84),e.Hammer=i(108),e.keycharm=i(111)},function(t,e){e.prepareElements=function(t){for(var e in t)t.hasOwnProperty(e)&&(t[e].redundant=t[e].used,t[e].used=[])},e.cleanupElements=function(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e].redundant){for(var i=0;i<t[e].redundant.length;i++)t[e].redundant[i].parentNode.removeChild(t[e].redundant[i]);t[e].redundant=[]}},e.resetElements=function(t){e.prepareElements(t),e.cleanupElements(t),e.prepareElements(t)},e.getSVGElement=function(t,e,i){var o;return e.hasOwnProperty(t)?e[t].redundant.length>0?(o=e[t].redundant[0],e[t].redundant.shift()):(o=document.createElementNS("http://www.w3.org/2000/svg",t),i.appendChild(o)):(o=document.createElementNS("http://www.w3.org/2000/svg",t),e[t]={used:[],redundant:[]},i.appendChild(o)),e[t].used.push(o),o},e.getDOMElement=function(t,e,i,o){var n;return e.hasOwnProperty(t)?e[t].redundant.length>0?(n=e[t].redundant[0],e[t].redundant.shift()):(n=document.createElement(t),void 0!==o?i.insertBefore(n,o):i.appendChild(n)):(n=document.createElement(t),e[t]={used:[],redundant:[]},void 0!==o?i.insertBefore(n,o):i.appendChild(n)),e[t].used.push(n),n},e.drawPoint=function(t,i,o,n,s,r){var a;if("circle"==o.style?(a=e.getSVGElement("circle",n,s),a.setAttributeNS(null,"cx",t),a.setAttributeNS(null,"cy",i),a.setAttributeNS(null,"r",.5*o.size)):(a=e.getSVGElement("rect",n,s),a.setAttributeNS(null,"x",t-.5*o.size),a.setAttributeNS(null,"y",i-.5*o.size),a.setAttributeNS(null,"width",o.size),a.setAttributeNS(null,"height",o.size)),void 0!==o.styles&&a.setAttributeNS(null,"style",o.styles),a.setAttributeNS(null,"class",o.className+" vis-point"),r){var h=e.getSVGElement("text",n,s);r.xOffset&&(t+=r.xOffset),r.yOffset&&(i+=r.yOffset),r.content&&(h.textContent=r.content),r.className&&h.setAttributeNS(null,"class",r.className+" vis-label"),h.setAttributeNS(null,"x",t),h.setAttributeNS(null,"y",i)}return a},e.drawBar=function(t,i,o,n,s,r,a,h){if(0!=n){n<0&&(n*=-1,i-=n);var d=e.getSVGElement("rect",r,a);d.setAttributeNS(null,"x",t-.5*o),d.setAttributeNS(null,"y",i),d.setAttributeNS(null,"width",o),d.setAttributeNS(null,"height",n),d.setAttributeNS(null,"class",s),h&&d.setAttributeNS(null,"style",h)}}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){if(t&&!Array.isArray(t)&&(e=t,t=null),this._options=e||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var i=(0,l.default)(this._options.type),o=0,n=i.length;o<n;o++){var s=i[o],r=this._options.type[s];"Date"==r||"ISODate"==r||"ASPDate"==r?this._type[s]="Date":this._type[s]=r}if(this._options.convert)throw new Error('Option "convert" is deprecated. Use "type" instead.');this._subscribers={},t&&this.add(t),this.setOptions(e)}var s=i(82),r=o(s),a=i(62),h=o(a),d=i(58),l=o(d),u=i(1),c=i(92);n.prototype.setOptions=function(t){t&&void 0!==t.queue&&(t.queue===!1?this._queue&&(this._queue.destroy(),delete this._queue):(this._queue||(this._queue=c.extend(this,{replace:["add","update","remove"]})),"object"===(0,h.default)(t.queue)&&this._queue.setOptions(t.queue)))},n.prototype.on=function(t,e){var i=this._subscribers[t];i||(i=[],this._subscribers[t]=i),i.push({callback:e})},n.prototype.subscribe=function(){throw new Error("DataSet.subscribe is deprecated. Use DataSet.on instead.")},n.prototype.off=function(t,e){var i=this._subscribers[t];i&&(this._subscribers[t]=i.filter(function(t){return t.callback!=e}))},n.prototype.unsubscribe=function(){throw new Error("DataSet.unsubscribe is deprecated. Use DataSet.off instead.")},n.prototype._trigger=function(t,e,i){if("*"==t)throw new Error("Cannot trigger event *");var o=[];t in this._subscribers&&(o=o.concat(this._subscribers[t])),"*"in this._subscribers&&(o=o.concat(this._subscribers["*"]));for(var n=0,s=o.length;n<s;n++){var r=o[n];r.callback&&r.callback(t,e,i||null)}},n.prototype.add=function(t,e){var i,o=[],n=this;if(Array.isArray(t))for(var s=0,r=t.length;s<r;s++)i=n._addItem(t[s]),o.push(i);else{if(!(t instanceof Object))throw new Error("Unknown dataType");i=n._addItem(t),o.push(i)}return o.length&&this._trigger("add",{items:o},e),o},n.prototype.update=function(t,e){var i=[],o=[],n=[],s=[],r=this,a=r._fieldId,h=function(t){var e=t[a];if(r._data[e]){var h=u.extend({},r._data[e]);e=r._updateItem(t),o.push(e),s.push(t),n.push(h)}else e=r._addItem(t),i.push(e)};if(Array.isArray(t))for(var d=0,l=t.length;d<l;d++)t[d]instanceof Object?h(t[d]):console.warn("Ignoring input item, which is not an object at index "+d);else{if(!(t instanceof Object))throw new Error("Unknown dataType");h(t)}if(i.length&&this._trigger("add",{items:i},e),o.length){var c={items:o,oldData:n,data:s};this._trigger("update",c,e)}return i.concat(o)},n.prototype.get=function(t){var e,i,o,n=this,s=u.getType(arguments[0]);"String"==s||"Number"==s?(e=arguments[0],o=arguments[1]):"Array"==s?(i=arguments[0],o=arguments[1]):o=arguments[0];var r;if(o&&o.returnType){var a=["Array","Object"];r=a.indexOf(o.returnType)==-1?"Array":o.returnType}else r="Array";var h,d,c,p,f,m=o&&o.type||this._options.type,v=o&&o.filter,g=[];if(void 0!=e)h=n._getItem(e,m),h&&v&&!v(h)&&(h=null);else if(void 0!=i)for(p=0,f=i.length;p<f;p++)h=n._getItem(i[p],m),v&&!v(h)||g.push(h);else for(d=(0,l.default)(this._data),p=0,f=d.length;p<f;p++)c=d[p],h=n._getItem(c,m),v&&!v(h)||g.push(h);if(o&&o.order&&void 0==e&&this._sort(g,o.order),o&&o.fields){var y=o.fields;if(void 0!=e)h=this._filterFields(h,y);else for(p=0,f=g.length;p<f;p++)g[p]=this._filterFields(g[p],y)}if("Object"==r){var b,_={};for(p=0,f=g.length;p<f;p++)b=g[p],_[b.id]=b;return _}return void 0!=e?h:g},n.prototype.getIds=function(t){var e,i,o,n,s,r=this._data,a=t&&t.filter,h=t&&t.order,d=t&&t.type||this._options.type,u=(0,l.default)(r),c=[];if(a)if(h){for(s=[],e=0,i=u.length;e<i;e++)o=u[e],n=this._getItem(o,d),a(n)&&s.push(n);for(this._sort(s,h),e=0,i=s.length;e<i;e++)c.push(s[e][this._fieldId])}else for(e=0,i=u.length;e<i;e++)o=u[e],n=this._getItem(o,d),a(n)&&c.push(n[this._fieldId]);else if(h){for(s=[],e=0,i=u.length;e<i;e++)o=u[e],s.push(r[o]);for(this._sort(s,h),e=0,i=s.length;e<i;e++)c.push(s[e][this._fieldId])}else for(e=0,i=u.length;e<i;e++)o=u[e],n=r[o],c.push(n[this._fieldId]);return c},n.prototype.getDataSet=function(){return this},n.prototype.forEach=function(t,e){var i,o,n,s,r=e&&e.filter,a=e&&e.type||this._options.type,h=this._data,d=(0,l.default)(h);if(e&&e.order){var u=this.get(e);for(i=0,o=u.length;i<o;i++)n=u[i],s=n[this._fieldId],t(n,s)}else for(i=0,o=d.length;i<o;i++)s=d[i],n=this._getItem(s,a),r&&!r(n)||t(n,s)},n.prototype.map=function(t,e){var i,o,n,s,r=e&&e.filter,a=e&&e.type||this._options.type,h=[],d=this._data,u=(0,l.default)(d);for(i=0,o=u.length;i<o;i++)n=u[i],s=this._getItem(n,a),r&&!r(s)||h.push(t(s,n));return e&&e.order&&this._sort(h,e.order),h},n.prototype._filterFields=function(t,e){if(!t)return t;var i,o,n={},s=(0,l.default)(t),r=s.length;if(Array.isArray(e))for(i=0;i<r;i++)o=s[i],e.indexOf(o)!=-1&&(n[o]=t[o]);else for(i=0;i<r;i++)o=s[i],e.hasOwnProperty(o)&&(n[e[o]]=t[o]);return n},n.prototype._sort=function(t,e){if(u.isString(e)){var i=e;t.sort(function(t,e){var o=t[i],n=e[i];return o>n?1:o<n?-1:0})}else{if("function"!=typeof e)throw new TypeError("Order must be a function or a string");t.sort(e)}},n.prototype.remove=function(t,e){var i,o,n,s,r=[],a=[],h=[];for(h=Array.isArray(t)?t:[t],i=0,o=h.length;i<o;i++)s=this._remove(h[i]),s&&(n=s[this._fieldId],void 0!=n&&(r.push(n),a.push(s)));return r.length&&this._trigger("remove",{items:r,oldData:a},e),r},n.prototype._remove=function(t){var e,i;return u.isNumber(t)||u.isString(t)?i=t:t instanceof Object&&(i=t[this._fieldId]),void 0!==i&&this._data[i]?(e=this._data[i],delete this._data[i],this.length--,e):null},n.prototype.clear=function(t){var e,i,o=(0,l.default)(this._data),n=[];for(e=0,i=o.length;e<i;e++)n.push(this._data[o[e]]);return this._data={},this.length=0,this._trigger("remove",{items:o,oldData:n},t),o},n.prototype.max=function(t){var e,i,o=this._data,n=(0,l.default)(o),s=null,r=null;for(e=0,i=n.length;e<i;e++){var a=n[e],h=o[a],d=h[t];null!=d&&(!s||d>r)&&(s=h,r=d)}return s},n.prototype.min=function(t){var e,i,o=this._data,n=(0,l.default)(o),s=null,r=null;for(e=0,i=n.length;e<i;e++){var a=n[e],h=o[a],d=h[t];null!=d&&(!s||d<r)&&(s=h,r=d)}return s},n.prototype.distinct=function(t){var e,i,o,n=this._data,s=(0,l.default)(n),r=[],a=this._options.type&&this._options.type[t]||null,h=0;for(e=0,o=s.length;e<o;e++){var d=s[e],c=n[d],p=c[t],f=!1;for(i=0;i<h;i++)if(r[i]==p){f=!0;break}f||void 0===p||(r[h]=p,h++)}if(a)for(e=0,o=r.length;e<o;e++)r[e]=u.convert(r[e],a);return r},n.prototype._addItem=function(t){var e=t[this._fieldId];if(void 0!=e){if(this._data[e])throw new Error("Cannot add item: item with id "+e+" already exists")}else e=u.randomUUID(),t[this._fieldId]=e;var i,o,n={},s=(0,l.default)(t);for(i=0,o=s.length;i<o;i++){var r=s[i],a=this._type[r];n[r]=u.convert(t[r],a)}return this._data[e]=n,this.length++,e},n.prototype._getItem=function(t,e){var i,o,n,s,r=this._data[t];if(!r)return null;var a={},h=(0,l.default)(r);if(e)for(n=0,s=h.length;n<s;n++)i=h[n],o=r[i],a[i]=u.convert(o,e[i]);else for(n=0,s=h.length;n<s;n++)i=h[n],o=r[i],a[i]=o;return a[this._fieldId]||(a[this._fieldId]=r.id),a},n.prototype._updateItem=function(t){var e=t[this._fieldId];if(void 0==e)throw new Error("Cannot update item: item has no id (item: "+(0,r.default)(t)+")");var i=this._data[e];if(!i)throw new Error("Cannot update item: no item with id "+e+" found");for(var o=(0,l.default)(t),n=0,s=o.length;n<s;n++){var a=o[n],h=this._type[a];i[a]=u.convert(t[a],h)}return e},t.exports=n},function(t,e){function i(t){this.delay=null,this.max=1/0,this._queue=[],this._timeout=null,this._extended=null,this.setOptions(t)}i.prototype.setOptions=function(t){t&&"undefined"!=typeof t.delay&&(this.delay=t.delay),t&&"undefined"!=typeof t.max&&(this.max=t.max),this._flushIfNeeded()},i.extend=function(t,e){var o=new i(e);if(void 0!==t.flush)throw new Error("Target object already has a property flush");t.flush=function(){o.flush()};var n=[{name:"flush",original:void 0}];if(e&&e.replace)for(var s=0;s<e.replace.length;s++){var r=e.replace[s];n.push({name:r,original:t[r]}),o.replace(t,r)}return o._extended={object:t,methods:n},o},i.prototype.destroy=function(){if(this.flush(),this._extended){for(var t=this._extended.object,e=this._extended.methods,i=0;i<e.length;i++){var o=e[i];o.original?t[o.name]=o.original:delete t[o.name]}this._extended=null}},i.prototype.replace=function(t,e){var i=this,o=t[e];if(!o)throw new Error("Method "+e+" undefined");t[e]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.queue({args:t,fn:o,context:this})}},i.prototype.queue=function(t){"function"==typeof t?this._queue.push({fn:t}):this._queue.push(t),this._flushIfNeeded()},i.prototype._flushIfNeeded=function(){if(this._queue.length>this.max&&this.flush(),clearTimeout(this._timeout),this.queue.length>0&&"number"==typeof this.delay){var t=this;this._timeout=setTimeout(function(){t.flush()},this.delay)}},i.prototype.flush=function(){for(;this._queue.length>0;){var t=this._queue.shift();t.fn.apply(t.context||t.fn,t.args||[])}},t.exports=i},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){this._data=null,this._ids={},this.length=0,this._options=e||{},this._fieldId="id",this._subscribers={};var i=this;this.listener=function(){i._onEvent.apply(i,arguments)},this.setData(t)}var s=i(58),r=o(s),a=i(1),h=i(91);n.prototype.setData=function(t){var e,i,o,n,s;if(this._data){for(this._data.off&&this._data.off("*",this.listener),e=this._data.getIds({filter:this._options&&this._options.filter}),s=[],o=0,n=e.length;o<n;o++)s.push(this._data._data[e[o]]);this._ids={},this.length=0,this._trigger("remove",{items:e,oldData:s})}if(this._data=t,this._data){for(this._fieldId=this._options.fieldId||this._data&&this._data.options&&this._data.options.fieldId||"id",e=this._data.getIds({filter:this._options&&this._options.filter}),o=0,n=e.length;o<n;o++)i=e[o],this._ids[i]=!0;this.length=e.length,this._trigger("add",{items:e}),this._data.on&&this._data.on("*",this.listener)}},n.prototype.refresh=function(){var t,e,i,o=this._data.getIds({filter:this._options&&this._options.filter}),n=(0,r.default)(this._ids),s={},a=[],h=[],d=[];for(e=0,i=o.length;e<i;e++)t=o[e],s[t]=!0,this._ids[t]||(a.push(t),this._ids[t]=!0);for(e=0,i=n.length;e<i;e++)t=n[e],s[t]||(h.push(t),d.push(this._data._data[t]),delete this._ids[t]);this.length+=a.length-h.length,a.length&&this._trigger("add",{items:a}),h.length&&this._trigger("remove",{items:h,oldData:d})},n.prototype.get=function(t){var e,i,o,n=this,s=a.getType(arguments[0]);"String"==s||"Number"==s||"Array"==s?(e=arguments[0],i=arguments[1],o=arguments[2]):(i=arguments[0],o=arguments[1]);var r=a.extend({},this._options,i);this._options.filter&&i&&i.filter&&(r.filter=function(t){return n._options.filter(t)&&i.filter(t)});var h=[];return void 0!=e&&h.push(e),h.push(r),h.push(o),this._data&&this._data.get.apply(this._data,h)},n.prototype.getIds=function(t){var e;if(this._data){var i,o=this._options.filter;i=t&&t.filter?o?function(e){return o(e)&&t.filter(e)}:t.filter:o,e=this._data.getIds({filter:i,order:t&&t.order})}else e=[];return e},n.prototype.map=function(t,e){var i=[];if(this._data){var o,n=this._options.filter;o=e&&e.filter?n?function(t){return n(t)&&e.filter(t)}:e.filter:n,i=this._data.map(t,{filter:o,order:e&&e.order})}else i=[];return i},n.prototype.getDataSet=function(){for(var t=this;t instanceof n;)t=t._data;return t||null},n.prototype._onEvent=function(t,e,i){var o,n,s,r,a=e&&e.items,h=[],d=[],l=[],u=[],c=[],p=[];if(a&&this._data){switch(t){case"add":for(o=0,n=a.length;o<n;o++)s=a[o],r=this.get(s),r&&(this._ids[s]=!0,h.push(s));break;case"update":for(o=0,n=a.length;o<n;o++)s=a[o],r=this.get(s),r?this._ids[s]?(d.push(s),c.push(e.data[o]),u.push(e.oldData[o])):(this._ids[s]=!0,h.push(s)):this._ids[s]&&(delete this._ids[s],l.push(s),p.push(e.oldData[o]));break;case"remove":for(o=0,n=a.length;o<n;o++)s=a[o],this._ids[s]&&(delete this._ids[s],l.push(s),p.push(e.oldData[o]))}this.length+=h.length-l.length,h.length&&this._trigger("add",{
+items:h},i),d.length&&this._trigger("update",{items:d,oldData:u,data:c},i),l.length&&this._trigger("remove",{items:l,oldData:p},i)}},n.prototype.on=h.prototype.on,n.prototype.off=h.prototype.off,n.prototype._trigger=h.prototype._trigger,n.prototype.subscribe=n.prototype.on,n.prototype.unsubscribe=n.prototype.off,t.exports=n},function(t,e,i){function o(t,e,i){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this.containerElement=t,this.dataTable=null,this.dataPoints=null,this.create(),v.setDefaults(y,this),this.colX=void 0,this.colY=void 0,this.colZ=void 0,this.colValue=void 0,this.colFilter=void 0,this.setOptions(i),e&&this.setData(e)}function n(t){return"clientX"in t?t.clientX:t.targetTouches[0]&&t.targetTouches[0].clientX||0}function s(t){return"clientY"in t?t.clientY:t.targetTouches[0]&&t.targetTouches[0].clientY||0}var r=i(95),a=i(91),h=i(93),d=i(1),l=i(96),u=i(97),c=(i(98),i(103)),p=i(104),f=i(105),m=i(106),v=i(107);o.STYLE=v.STYLE;var g=void 0,y={width:"400px",height:"400px",filterLabel:"time",legendLabel:"value",xLabel:"x",yLabel:"y",zLabel:"z",xValueLabel:function(t){return t},yValueLabel:function(t){return t},zValueLabel:function(t){return t},showGrid:!0,showPerspective:!0,showShadow:!1,keepAspectRatio:!0,verticalRatio:.5,dotSizeRatio:.02,showAnimationControls:g,animationInterval:1e3,animationPreload:!1,animationAutoStart:g,axisColor:"#4D4D4D",gridColor:"#D3D3D3",xCenter:"55%",yCenter:"50%",style:o.STYLE.DOT,tooltip:!1,showLegend:g,backgroundColor:g,dataColor:{fill:"#7DC1FF",stroke:"#3267D2",strokeWidth:1},cameraPosition:{horizontal:1,vertical:.5,distance:1.7},xBarWidth:g,yBarWidth:g,valueMin:g,valueMax:g,xMin:g,xMax:g,xStep:g,yMin:g,yMax:g,yStep:g,zMin:g,zMax:g,zStep:g};r(o.prototype),o.prototype._setScale=function(){this.scale=new l(1/this.xRange.range(),1/this.yRange.range(),1/this.zRange.range()),this.keepAspectRatio&&(this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y),this.scale.z*=this.verticalRatio,void 0!==this.valueRange&&(this.scale.value=1/this.valueRange.range());var t=this.xRange.center()*this.scale.x,e=this.yRange.center()*this.scale.y,i=this.zRange.center()*this.scale.z;this.camera.setArmLocation(t,e,i)},o.prototype._convert3Dto2D=function(t){var e=this._convertPointToTranslation(t);return this._convertTranslationToScreen(e)},o.prototype._convertPointToTranslation=function(t){var e=this.camera.getCameraLocation(),i=this.camera.getCameraRotation(),o=t.x*this.scale.x,n=t.y*this.scale.y,s=t.z*this.scale.z,r=e.x,a=e.y,h=e.z,d=Math.sin(i.x),u=Math.cos(i.x),c=Math.sin(i.y),p=Math.cos(i.y),f=Math.sin(i.z),m=Math.cos(i.z),v=p*(f*(n-a)+m*(o-r))-c*(s-h),g=d*(p*(s-h)+c*(f*(n-a)+m*(o-r)))+u*(m*(n-a)-f*(o-r)),y=u*(p*(s-h)+c*(f*(n-a)+m*(o-r)))-d*(m*(n-a)-f*(o-r));return new l(v,g,y)},o.prototype._convertTranslationToScreen=function(t){var e,i,o=this.eye.x,n=this.eye.y,s=this.eye.z,r=t.x,a=t.y,h=t.z;return this.showPerspective?(e=(r-o)*(s/h),i=(a-n)*(s/h)):(e=r*-(s/this.camera.getArmLength()),i=a*-(s/this.camera.getArmLength())),new u(this.currentXCenter+e*this.frame.canvas.clientWidth,this.currentYCenter-i*this.frame.canvas.clientWidth)},o.prototype._calcTranslations=function(t,e){void 0===e&&(e=!0);for(var i=0;i<t.length;i++){var o=t[i];o.trans=this._convertPointToTranslation(o.point),o.screen=this._convertTranslationToScreen(o.trans);var n=this._convertPointToTranslation(o.bottom);o.dist=this.showPerspective?n.length():-n.z}if(e){var s=function(t,e){return e.dist-t.dist};t.sort(s)}},o.prototype.getNumberOfRows=function(t){return t.length},o.prototype.getNumberOfColumns=function(t){var e=0;for(var i in t[0])t[0].hasOwnProperty(i)&&e++;return e},o.prototype.getDistinctValues=function(t,e){for(var i=[],o=0;o<t.length;o++)i.indexOf(t[o][e])==-1&&i.push(t[o][e]);return i},o.prototype.getColumnRange=function(t,e){for(var i=new m,o=0;o<t.length;o++){var n=t[o][e];i.adjust(n)}return i},o.prototype._checkValueField=function(t){var e=this.style===o.STYLE.BARCOLOR||this.style===o.STYLE.BARSIZE||this.style===o.STYLE.DOTCOLOR||this.style===o.STYLE.DOTSIZE;if(e){if(void 0===this.colValue)throw new Error("Expected data to have field 'style' for graph style '"+this.style+"'");if(void 0===t[0][this.colValue])throw new Error("Expected data to have field '"+this.colValue+"' for graph style '"+this.style+"'")}},o.prototype._setRangeDefaults=function(t,e,i){void 0!==e&&(t.min=e),void 0!==i&&(t.max=i),t.max<=t.min&&(t.max=t.min+1)},o.prototype._dataInitialize=function(t,e){var i=this;if(this.dataSet&&this.dataSet.off("*",this._onChange),void 0!==t){Array.isArray(t)&&(t=new a(t));var n;if(!(t instanceof a||t instanceof h))throw new Error("Array, DataSet, or DataView expected");if(n=t.get(),0!=n.length){this.dataSet=t,this.dataTable=n,this._onChange=function(){i.setData(i.dataSet)},this.dataSet.on("*",this._onChange),this.colX="x",this.colY="y",this.colZ="z";var s=this.style==o.STYLE.BAR||this.style==o.STYLE.BARCOLOR||this.style==o.STYLE.BARSIZE;if(s){if(void 0!==this.defaultXBarWidth)this.xBarWidth=this.defaultXBarWidth;else{var r=this.getDistinctValues(n,this.colX);this.xBarWidth=r[1]-r[0]||1}if(void 0!==this.defaultYBarWidth)this.yBarWidth=this.defaultYBarWidth;else{var d=this.getDistinctValues(n,this.colY);this.yBarWidth=d[1]-d[0]||1}}var l=5,u=this.getColumnRange(n,this.colX);s&&u.expand(this.xBarWidth/2),this._setRangeDefaults(u,this.defaultXMin,this.defaultXMax),this.xRange=u,this.xStep=void 0!==this.defaultXStep?this.defaultXStep:u.range()/l;var p=this.getColumnRange(n,this.colY);s&&p.expand(this.yBarWidth/2),this._setRangeDefaults(p,this.defaultYMin,this.defaultYMax),this.yRange=p,this.yStep=void 0!==this.defaultYStep?this.defaultYStep:p.range()/l;var f=this.getColumnRange(n,this.colZ);if(this._setRangeDefaults(f,this.defaultZMin,this.defaultZMax),this.zRange=f,this.zStep=void 0!==this.defaultZStep?this.defaultZStep:f.range()/l,n[0].hasOwnProperty("style")){this.colValue="style";var m=this.getColumnRange(n,this.colValue);this._setRangeDefaults(m,this.defaultValueMin,this.defaultValueMax),this.valueRange=m}n[0].hasOwnProperty("filter")&&(this.colFilter="filter",void 0===this.dataFilter&&(this.dataFilter=new c(t,this.colFilter,this),this.dataFilter.setOnLoadCallback(function(){i.redraw()}))),this._setScale()}}},o.prototype._getDataPoints=function(t){var e,i,n,s,r,a,h=[];if(this.style===o.STYLE.GRID||this.style===o.STYLE.SURFACE){var d=[],u=[];for(n=0;n<this.getNumberOfRows(t);n++)e=t[n][this.colX]||0,i=t[n][this.colY]||0,d.indexOf(e)===-1&&d.push(e),u.indexOf(i)===-1&&u.push(i);var c=function(t,e){return t-e};d.sort(c),u.sort(c);var p=[];for(n=0;n<t.length;n++){e=t[n][this.colX]||0,i=t[n][this.colY]||0,s=t[n][this.colZ]||0;var f=d.indexOf(e),m=u.indexOf(i);void 0===p[f]&&(p[f]=[]);var v=new l;v.x=e,v.y=i,v.z=s,v.data=t[n],r={},r.point=v,r.trans=void 0,r.screen=void 0,r.bottom=new l(e,i,this.zRange.min),p[f][m]=r,h.push(r)}for(e=0;e<p.length;e++)for(i=0;i<p[e].length;i++)p[e][i]&&(p[e][i].pointRight=e<p.length-1?p[e+1][i]:void 0,p[e][i].pointTop=i<p[e].length-1?p[e][i+1]:void 0,p[e][i].pointCross=e<p.length-1&&i<p[e].length-1?p[e+1][i+1]:void 0)}else for(this._checkValueField(t),n=0;n<t.length;n++)a=new l,a.x=t[n][this.colX]||0,a.y=t[n][this.colY]||0,a.z=t[n][this.colZ]||0,a.data=t[n],void 0!==this.colValue&&(a.value=t[n][this.colValue]||0),r={},r.point=a,r.bottom=new l(a.x,a.y,this.zRange.min),r.trans=void 0,r.screen=void 0,this.style===o.STYLE.LINE&&n>0&&(h[n-1].pointNext=r),h.push(r);return h},o.prototype.create=function(){for(;this.containerElement.hasChildNodes();)this.containerElement.removeChild(this.containerElement.firstChild);this.frame=document.createElement("div"),this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas);var t=document.createElement("DIV");t.style.color="red",t.style.fontWeight="bold",t.style.padding="10px",t.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(t),this.frame.filter=document.createElement("div"),this.frame.filter.style.position="absolute",this.frame.filter.style.bottom="0px",this.frame.filter.style.left="0px",this.frame.filter.style.width="100%",this.frame.appendChild(this.frame.filter);var e=this,i=function(t){e._onMouseDown(t)},o=function(t){e._onTouchStart(t)},n=function(t){e._onWheel(t)},s=function(t){e._onTooltip(t)},r=function(t){e._onClick(t)};d.addEventListener(this.frame.canvas,"keydown",onkeydown),d.addEventListener(this.frame.canvas,"mousedown",i),d.addEventListener(this.frame.canvas,"touchstart",o),d.addEventListener(this.frame.canvas,"mousewheel",n),d.addEventListener(this.frame.canvas,"mousemove",s),d.addEventListener(this.frame.canvas,"click",r),this.containerElement.appendChild(this.frame)},o.prototype._setSize=function(t,e){this.frame.style.width=t,this.frame.style.height=e,this._resizeCanvas()},o.prototype._resizeCanvas=function(){this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=this.frame.canvas.clientWidth,this.frame.canvas.height=this.frame.canvas.clientHeight,this.frame.filter.style.width=this.frame.canvas.clientWidth-20+"px"},o.prototype.animationStart=function(){if(!this.frame.filter||!this.frame.filter.slider)throw new Error("No animation available");this.frame.filter.slider.play()},o.prototype.animationStop=function(){this.frame.filter&&this.frame.filter.slider&&this.frame.filter.slider.stop()},o.prototype._resizeCenter=function(){"%"===this.xCenter.charAt(this.xCenter.length-1)?this.currentXCenter=parseFloat(this.xCenter)/100*this.frame.canvas.clientWidth:this.currentXCenter=parseFloat(this.xCenter),"%"===this.yCenter.charAt(this.yCenter.length-1)?this.currentYCenter=parseFloat(this.yCenter)/100*(this.frame.canvas.clientHeight-this.frame.filter.clientHeight):this.currentYCenter=parseFloat(this.yCenter)},o.prototype.getCameraPosition=function(){var t=this.camera.getArmRotation();return t.distance=this.camera.getArmLength(),t},o.prototype._readData=function(t){this._dataInitialize(t,this.style),this.dataFilter?this.dataPoints=this.dataFilter._getDataPoints():this.dataPoints=this._getDataPoints(this.dataTable),this._redrawFilter()},o.prototype.setData=function(t){this._readData(t),this.redraw(),this.animationAutoStart&&this.dataFilter&&this.animationStart()},o.prototype.setOptions=function(t){this.animationStop(),v.setOptions(t,this),this.setPointDrawingMethod(),this._setSize(this.width,this.height),this.dataTable&&this.setData(this.dataTable),this.animationAutoStart&&this.dataFilter&&this.animationStart()},o.prototype.setPointDrawingMethod=function(){var t=void 0;switch(this.style){case o.STYLE.BAR:t=o.prototype._redrawBarGraphPoint;break;case o.STYLE.BARCOLOR:t=o.prototype._redrawBarColorGraphPoint;break;case o.STYLE.BARSIZE:t=o.prototype._redrawBarSizeGraphPoint;break;case o.STYLE.DOT:t=o.prototype._redrawDotGraphPoint;break;case o.STYLE.DOTLINE:t=o.prototype._redrawDotLineGraphPoint;break;case o.STYLE.DOTCOLOR:t=o.prototype._redrawDotColorGraphPoint;break;case o.STYLE.DOTSIZE:t=o.prototype._redrawDotSizeGraphPoint;break;case o.STYLE.SURFACE:t=o.prototype._redrawSurfaceGraphPoint;break;case o.STYLE.GRID:t=o.prototype._redrawGridGraphPoint;break;case o.STYLE.LINE:t=o.prototype._redrawLineGraphPoint;break;default:throw new Error("Can not determine point drawing method for graph style '"+this.style+"'")}this._pointDrawingMethod=t},o.prototype.redraw=function(){if(void 0===this.dataPoints)throw new Error("Graph data not initialized");this._resizeCanvas(),this._resizeCenter(),this._redrawSlider(),this._redrawClear(),this._redrawAxis(),this._redrawDataGraph(),this._redrawInfo(),this._redrawLegend()},o.prototype._getContext=function(){var t=this.frame.canvas,e=t.getContext("2d");return e.lineJoin="round",e.lineCap="round",e},o.prototype._redrawClear=function(){var t=this.frame.canvas,e=t.getContext("2d");e.clearRect(0,0,t.width,t.height)},o.prototype._dotSize=function(){return this.frame.clientWidth*this.dotSizeRatio},o.prototype._getLegendWidth=function(){var t;if(this.style===o.STYLE.DOTSIZE){var e=this._dotSize();t=e/2+2*e}else t=this.style===o.STYLE.BARSIZE?this.xBarWidth:20;return t},o.prototype._redrawLegend=function(){if(this.showLegend===!0&&this.style!==o.STYLE.LINE&&this.style!==o.STYLE.BARSIZE){var t=this.style===o.STYLE.BARSIZE||this.style===o.STYLE.DOTSIZE,e=this.style===o.STYLE.DOTSIZE||this.style===o.STYLE.DOTCOLOR||this.style===o.STYLE.BARCOLOR,i=Math.max(.25*this.frame.clientHeight,100),n=this.margin,s=this._getLegendWidth(),r=this.frame.clientWidth-this.margin,a=r-s,h=n+i,d=this._getContext();if(d.lineWidth=1,d.font="14px arial",t===!1){var l,c=0,p=i;for(l=c;l<p;l++){var m=(l-c)/(p-c),v=240*m,g=this._hsv2rgb(v,1,1);d.strokeStyle=g,d.beginPath(),d.moveTo(a,n+l),d.lineTo(r,n+l),d.stroke()}d.strokeStyle=this.axisColor,d.strokeRect(a,n,s,i)}else{var y;if(this.style===o.STYLE.DOTSIZE){var b=this._dotSize();y=b/2}else this.style===o.STYLE.BARSIZE;d.strokeStyle=this.axisColor,d.fillStyle=this.dataColor.fill,d.beginPath(),d.moveTo(a,n),d.lineTo(r,n),d.lineTo(r-s+y,h),d.lineTo(a,h),d.closePath(),d.fill(),d.stroke()}var _=5,w=e?this.valueRange.min:this.zRange.min,x=e?this.valueRange.max:this.zRange.max,k=new f(w,x,(x-w)/5,!0);k.start(!0);for(var l,O,D;!k.end();)l=h-(k.getCurrent()-w)/(x-w)*i,O=new u(a-_,l),D=new u(a,l),this._line(d,O,D),d.textAlign="right",d.textBaseline="middle",d.fillStyle=this.axisColor,d.fillText(k.getCurrent(),a-2*_,l),k.next();d.textAlign="right",d.textBaseline="top";var S=this.legendLabel;d.fillText(S,r,h+this.margin)}},o.prototype._redrawFilter=function(){if(this.frame.filter.innerHTML="",this.dataFilter){var t={visible:this.showAnimationControls},e=new p(this.frame.filter,t);this.frame.filter.slider=e,this.frame.filter.style.padding="10px",e.setValues(this.dataFilter.values),e.setPlayInterval(this.animationInterval);var i=this,o=function(){var t=e.getIndex();i.dataFilter.selectValue(t),i.dataPoints=i.dataFilter._getDataPoints(),i.redraw()};e.setOnChangeCallback(o)}else this.frame.filter.slider=void 0},o.prototype._redrawSlider=function(){void 0!==this.frame.filter.slider&&this.frame.filter.slider.redraw()},o.prototype._redrawInfo=function(){if(this.dataFilter){var t=this._getContext();t.font="14px arial",t.lineStyle="gray",t.fillStyle="gray",t.textAlign="left",t.textBaseline="top";var e=this.margin,i=this.margin;t.fillText(this.dataFilter.getLabel()+": "+this.dataFilter.getSelectedValue(),e,i)}},o.prototype._line=function(t,e,i,o){void 0!==o&&(t.strokeStyle=o),t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(i.x,i.y),t.stroke()},o.prototype.drawAxisLabelX=function(t,e,i,o,n){void 0===n&&(n=0);var s=this._convert3Dto2D(e);Math.cos(2*o)>0?(t.textAlign="center",t.textBaseline="top",s.y+=n):Math.sin(2*o)<0?(t.textAlign="right",t.textBaseline="middle"):(t.textAlign="left",t.textBaseline="middle"),t.fillStyle=this.axisColor,t.fillText(i,s.x,s.y)},o.prototype.drawAxisLabelY=function(t,e,i,o,n){void 0===n&&(n=0);var s=this._convert3Dto2D(e);Math.cos(2*o)<0?(t.textAlign="center",t.textBaseline="top",s.y+=n):Math.sin(2*o)>0?(t.textAlign="right",t.textBaseline="middle"):(t.textAlign="left",t.textBaseline="middle"),t.fillStyle=this.axisColor,t.fillText(i,s.x,s.y)},o.prototype.drawAxisLabelZ=function(t,e,i,o){void 0===o&&(o=0);var n=this._convert3Dto2D(e);t.textAlign="right",t.textBaseline="middle",t.fillStyle=this.axisColor,t.fillText(i,n.x-o,n.y)},o.prototype._line3d=function(t,e,i,o){var n=this._convert3Dto2D(e),s=this._convert3Dto2D(i);this._line(t,n,s,o)},o.prototype._redrawAxis=function(){var t,e,i,o,n,s,r,a,h,d,c,p=this._getContext();p.font=24/this.camera.getArmLength()+"px arial";var m=.025/this.scale.x,v=.025/this.scale.y,g=5/this.camera.getArmLength(),y=this.camera.getArmRotation().horizontal,b=new u(Math.cos(y),Math.sin(y)),_=this.xRange,w=this.yRange,x=this.zRange;for(p.lineWidth=1,o=void 0===this.defaultXStep,i=new f(_.min,_.max,this.xStep,o),i.start(!0);!i.end();){var k=i.getCurrent();this.showGrid?(t=new l(k,w.min,x.min),e=new l(k,w.max,x.min),this._line3d(p,t,e,this.gridColor)):(t=new l(k,w.min,x.min),e=new l(k,w.min+m,x.min),this._line3d(p,t,e,this.axisColor),t=new l(k,w.max,x.min),e=new l(k,w.max-m,x.min),this._line3d(p,t,e,this.axisColor)),r=b.x>0?w.min:w.max;var O=new l(k,r,x.min),D=" "+this.xValueLabel(k)+" ";this.drawAxisLabelX(p,O,D,y,g),i.next()}for(p.lineWidth=1,o=void 0===this.defaultYStep,i=new f(w.min,w.max,this.yStep,o),i.start(!0);!i.end();){var S=i.getCurrent();this.showGrid?(t=new l(_.min,S,x.min),e=new l(_.max,S,x.min),this._line3d(p,t,e,this.gridColor)):(t=new l(_.min,S,x.min),e=new l(_.min+v,S,x.min),this._line3d(p,t,e,this.axisColor),t=new l(_.max,S,x.min),e=new l(_.max-v,S,x.min),this._line3d(p,t,e,this.axisColor)),s=b.y>0?_.min:_.max,O=new l(s,S,x.min);var D=" "+this.yValueLabel(S)+" ";this.drawAxisLabelY(p,O,D,y,g),i.next()}for(p.lineWidth=1,o=void 0===this.defaultZStep,i=new f(x.min,x.max,this.zStep,o),i.start(!0),s=b.x>0?_.min:_.max,r=b.y<0?w.min:w.max;!i.end();){var M=i.getCurrent(),C=new l(s,r,M),T=this._convert3Dto2D(C);e=new u(T.x-g,T.y),this._line(p,T,e,this.axisColor);var D=this.zValueLabel(M)+" ";this.drawAxisLabelZ(p,C,D,5),i.next()}p.lineWidth=1,t=new l(s,r,x.min),e=new l(s,r,x.max),this._line3d(p,t,e,this.axisColor);var E,P;p.lineWidth=1,E=new l(_.min,w.min,x.min),P=new l(_.max,w.min,x.min),this._line3d(p,E,P,this.axisColor),E=new l(_.min,w.max,x.min),P=new l(_.max,w.max,x.min),this._line3d(p,E,P,this.axisColor),p.lineWidth=1,t=new l(_.min,w.min,x.min),e=new l(_.min,w.max,x.min),this._line3d(p,t,e,this.axisColor),t=new l(_.max,w.min,x.min),e=new l(_.max,w.max,x.min),this._line3d(p,t,e,this.axisColor);var I=this.xLabel;I.length>0&&(c=.1/this.scale.y,s=(_.max+3*_.min)/4,r=b.x>0?w.min-c:w.max+c,n=new l(s,r,x.min),this.drawAxisLabelX(p,n,I,y));var N=this.yLabel;N.length>0&&(d=.1/this.scale.x,s=b.y>0?_.min-d:_.max+d,r=(w.max+3*w.min)/4,n=new l(s,r,x.min),this.drawAxisLabelY(p,n,N,y));var z=this.zLabel;z.length>0&&(h=30,s=b.x>0?_.min:_.max,r=b.y<0?w.min:w.max,a=(x.max+3*x.min)/4,n=new l(s,r,a),this.drawAxisLabelZ(p,n,z,h))},o.prototype._hsv2rgb=function(t,e,i){var o,n,s,r,a,h;switch(r=i*e,a=Math.floor(t/60),h=r*(1-Math.abs(t/60%2-1)),a){case 0:o=r,n=h,s=0;break;case 1:o=h,n=r,s=0;break;case 2:o=0,n=r,s=h;break;case 3:o=0,n=h,s=r;break;case 4:o=h,n=0,s=r;break;case 5:o=r,n=0,s=h;break;default:o=0,n=0,s=0}return"RGB("+parseInt(255*o)+","+parseInt(255*n)+","+parseInt(255*s)+")"},o.prototype._getStrokeWidth=function(t){return void 0!==t?this.showPerspective?1/-t.trans.z*this.dataColor.strokeWidth:-(this.eye.z/this.camera.getArmLength())*this.dataColor.strokeWidth:this.dataColor.strokeWidth},o.prototype._redrawBar=function(t,e,i,o,n,s){var r,a,h=this,d=e.point,u=this.zRange.min,c=[{point:new l(d.x-i,d.y-o,d.z)},{point:new l(d.x+i,d.y-o,d.z)},{point:new l(d.x+i,d.y+o,d.z)},{point:new l(d.x-i,d.y+o,d.z)}],p=[{point:new l(d.x-i,d.y-o,u)},{point:new l(d.x+i,d.y-o,u)},{point:new l(d.x+i,d.y+o,u)},{point:new l(d.x-i,d.y+o,u)}];c.forEach(function(t){t.screen=h._convert3Dto2D(t.point)}),p.forEach(function(t){t.screen=h._convert3Dto2D(t.point)});var f=[{corners:c,center:l.avg(p[0].point,p[2].point)},{corners:[c[0],c[1],p[1],p[0]],center:l.avg(p[1].point,p[0].point)},{corners:[c[1],c[2],p[2],p[1]],center:l.avg(p[2].point,p[1].point)},{corners:[c[2],c[3],p[3],p[2]],center:l.avg(p[3].point,p[2].point)},{corners:[c[3],c[0],p[0],p[3]],center:l.avg(p[0].point,p[3].point)}];for(e.surfaces=f,r=0;r<f.length;r++){a=f[r];var m=this._convertPointToTranslation(a.center);a.dist=this.showPerspective?m.length():-m.z}for(f.sort(function(t,e){var i=e.dist-t.dist;return i?i:t.corners===c?1:e.corners===c?-1:0}),t.lineWidth=this._getStrokeWidth(e),t.strokeStyle=s,t.fillStyle=n,r=2;r<f.length;r++)a=f[r],this._polygon(t,a.corners)},o.prototype._polygon=function(t,e,i,o){if(!(e.length<2)){void 0!==i&&(t.fillStyle=i),void 0!==o&&(t.strokeStyle=o),t.beginPath(),t.moveTo(e[0].screen.x,e[0].screen.y);for(var n=1;n<e.length;++n){var s=e[n];t.lineTo(s.screen.x,s.screen.y)}t.closePath(),t.fill(),t.stroke()}},o.prototype._drawCircle=function(t,e,i,o,n){var s=this._calcRadius(e,n);t.lineWidth=this._getStrokeWidth(e),t.strokeStyle=o,t.fillStyle=i,t.beginPath(),t.arc(e.screen.x,e.screen.y,s,0,2*Math.PI,!0),t.fill(),t.stroke()},o.prototype._getColorsRegular=function(t){var e=240*(1-(t.point.z-this.zRange.min)*this.scale.z/this.verticalRatio),i=this._hsv2rgb(e,1,1),o=this._hsv2rgb(e,1,.8);return{fill:i,border:o}},o.prototype._getColorsColor=function(t){var e,i;if("string"==typeof t.point.value)e=t.point.value,i=t.point.value;else{var o=240*(1-(t.point.value-this.valueRange.min)*this.scale.value);e=this._hsv2rgb(o,1,1),i=this._hsv2rgb(o,1,.8)}return{fill:e,border:i}},o.prototype._getColorsSize=function(){return{fill:this.dataColor.fill,border:this.dataColor.stroke}},o.prototype._calcRadius=function(t,e){void 0===e&&(e=this._dotSize());var i;return i=this.showPerspective?e/-t.trans.z:e*-(this.eye.z/this.camera.getArmLength()),i<0&&(i=0),i},o.prototype._redrawBarGraphPoint=function(t,e){var i=this.xBarWidth/2,o=this.yBarWidth/2,n=this._getColorsRegular(e);this._redrawBar(t,e,i,o,n.fill,n.border)},o.prototype._redrawBarColorGraphPoint=function(t,e){var i=this.xBarWidth/2,o=this.yBarWidth/2,n=this._getColorsColor(e);this._redrawBar(t,e,i,o,n.fill,n.border)},o.prototype._redrawBarSizeGraphPoint=function(t,e){var i=(e.point.value-this.valueRange.min)/this.valueRange.range(),o=this.xBarWidth/2*(.8*i+.2),n=this.yBarWidth/2*(.8*i+.2),s=this._getColorsSize();this._redrawBar(t,e,o,n,s.fill,s.border)},o.prototype._redrawDotGraphPoint=function(t,e){var i=this._getColorsRegular(e);this._drawCircle(t,e,i.fill,i.border)},o.prototype._redrawDotLineGraphPoint=function(t,e){var i=this._convert3Dto2D(e.bottom);t.lineWidth=1,this._line(t,i,e.screen,this.gridColor),this._redrawDotGraphPoint(t,e)},o.prototype._redrawDotColorGraphPoint=function(t,e){var i=this._getColorsColor(e);this._drawCircle(t,e,i.fill,i.border)},o.prototype._redrawDotSizeGraphPoint=function(t,e){var i=this._dotSize(),o=(e.point.value-this.valueRange.min)/this.valueRange.range(),n=i/2+2*i*o,s=this._getColorsSize();this._drawCircle(t,e,s.fill,s.border,n)},o.prototype._redrawSurfaceGraphPoint=function(t,e){var i=e.pointRight,o=e.pointTop,n=e.pointCross;if(void 0!==e&&void 0!==i&&void 0!==o&&void 0!==n){var s,r,a=!0;if(this.showGrayBottom||this.showShadow){var h=l.subtract(n.trans,e.trans),d=l.subtract(o.trans,i.trans),u=l.crossProduct(h,d),c=u.length();a=u.z>0}if(a){var p,f=(e.point.z+i.point.z+o.point.z+n.point.z)/4,m=240*(1-(f-this.zRange.min)*this.scale.z/this.verticalRatio),v=1;this.showShadow?(p=Math.min(1+u.x/c/2,1),s=this._hsv2rgb(m,v,p),r=s):(p=1,s=this._hsv2rgb(m,v,p),r=this.axisColor)}else s="gray",r=this.axisColor;t.lineWidth=this._getStrokeWidth(e);var g=[e,i,n,o];this._polygon(t,g,s,r)}},o.prototype._drawGridLine=function(t,e,i){if(void 0!==e&&void 0!==i){var o=(e.point.z+i.point.z)/2,n=240*(1-(o-this.zRange.min)*this.scale.z/this.verticalRatio);t.lineWidth=2*this._getStrokeWidth(e),t.strokeStyle=this._hsv2rgb(n,1,1),this._line(t,e.screen,i.screen)}},o.prototype._redrawGridGraphPoint=function(t,e){this._drawGridLine(t,e,e.pointRight),this._drawGridLine(t,e,e.pointTop)},o.prototype._redrawLineGraphPoint=function(t,e){void 0!==e.pointNext&&(t.lineWidth=this._getStrokeWidth(e),t.strokeStyle=this.dataColor.stroke,this._line(t,e.screen,e.pointNext.screen))},o.prototype._redrawDataGraph=function(){var t,e=this._getContext();if(!(void 0===this.dataPoints||this.dataPoints.length<=0))for(this._calcTranslations(this.dataPoints),t=0;t<this.dataPoints.length;t++){var i=this.dataPoints[t];this._pointDrawingMethod.call(this,e,i)}},o.prototype._storeMousePosition=function(t){this.startMouseX=n(t),this.startMouseY=s(t),this._startCameraOffset=this.camera.getOffset()},o.prototype._onMouseDown=function(t){if(t=t||window.event,this.leftButtonDown&&this._onMouseUp(t),this.leftButtonDown=t.which?1===t.which:1===t.button,this.leftButtonDown||this.touchDown){this._storeMousePosition(t),this.startStart=new Date(this.start),this.startEnd=new Date(this.end),this.startArmRotation=this.camera.getArmRotation(),this.frame.style.cursor="move";var e=this;this.onmousemove=function(t){e._onMouseMove(t)},this.onmouseup=function(t){e._onMouseUp(t)},d.addEventListener(document,"mousemove",e.onmousemove),d.addEventListener(document,"mouseup",e.onmouseup),d.preventDefault(t)}},o.prototype._onMouseMove=function(t){this.moving=!0,t=t||window.event;var e=parseFloat(n(t))-this.startMouseX,i=parseFloat(s(t))-this.startMouseY;if(t&&t.ctrlKey===!0){var o=.5*this.frame.clientWidth,r=.5*this.frame.clientHeight,a=(this._startCameraOffset.x||0)-e/o*this.camera.armLength*.8,h=(this._startCameraOffset.y||0)+i/r*this.camera.armLength*.8;this.camera.setOffset(a,h),this._storeMousePosition(t)}else{var l=this.startArmRotation.horizontal+e/200,u=this.startArmRotation.vertical+i/200,c=4,p=Math.sin(c/360*2*Math.PI);Math.abs(Math.sin(l))<p&&(l=Math.round(l/Math.PI)*Math.PI-.001),Math.abs(Math.cos(l))<p&&(l=(Math.round(l/Math.PI-.5)+.5)*Math.PI-.001),Math.abs(Math.sin(u))<p&&(u=Math.round(u/Math.PI)*Math.PI),Math.abs(Math.cos(u))<p&&(u=(Math.round(u/Math.PI-.5)+.5)*Math.PI),this.camera.setArmRotation(l,u)}this.redraw();var f=this.getCameraPosition();this.emit("cameraPositionChange",f),d.preventDefault(t)},o.prototype._onMouseUp=function(t){this.frame.style.cursor="auto",this.leftButtonDown=!1,d.removeEventListener(document,"mousemove",this.onmousemove),d.removeEventListener(document,"mouseup",this.onmouseup),d.preventDefault(t)},o.prototype._onClick=function(t){if(this.onclick_callback){if(this.moving)this.moving=!1;else{var e=this.frame.getBoundingClientRect(),i=n(t)-e.left,o=s(t)-e.top,r=this._dataPointFromXY(i,o);r&&this.onclick_callback(r.point.data)}d.preventDefault(t)}},o.prototype._onTooltip=function(t){var e=300,i=this.frame.getBoundingClientRect(),o=n(t)-i.left,r=s(t)-i.top;if(this.showTooltip){if(this.tooltipTimeout&&clearTimeout(this.tooltipTimeout),this.leftButtonDown)return void this._hideTooltip();if(this.tooltip&&this.tooltip.dataPoint){var a=this._dataPointFromXY(o,r);a!==this.tooltip.dataPoint&&(a?this._showTooltip(a):this._hideTooltip())}else{var h=this;this.tooltipTimeout=setTimeout(function(){h.tooltipTimeout=null;var t=h._dataPointFromXY(o,r);t&&h._showTooltip(t)},e)}}},o.prototype._onTouchStart=function(t){this.touchDown=!0;var e=this;this.ontouchmove=function(t){e._onTouchMove(t)},this.ontouchend=function(t){e._onTouchEnd(t)},d.addEventListener(document,"touchmove",e.ontouchmove),d.addEventListener(document,"touchend",e.ontouchend),this._onMouseDown(t)},o.prototype._onTouchMove=function(t){this._onMouseMove(t)},o.prototype._onTouchEnd=function(t){this.touchDown=!1,d.removeEventListener(document,"touchmove",this.ontouchmove),d.removeEventListener(document,"touchend",this.ontouchend),this._onMouseUp(t)},o.prototype._onWheel=function(t){t||(t=window.event);var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),e){var i=this.camera.getArmLength(),o=i*(1-e/10);this.camera.setArmLength(o),this.redraw(),this._hideTooltip()}var n=this.getCameraPosition();this.emit("cameraPositionChange",n),d.preventDefault(t)},o.prototype._insideTriangle=function(t,e){function i(t){return t>0?1:t<0?-1:0}var o=e[0],n=e[1],s=e[2],r=i((n.x-o.x)*(t.y-o.y)-(n.y-o.y)*(t.x-o.x)),a=i((s.x-n.x)*(t.y-n.y)-(s.y-n.y)*(t.x-n.x)),h=i((o.x-s.x)*(t.y-s.y)-(o.y-s.y)*(t.x-s.x));return!(0!=r&&0!=a&&r!=a||0!=a&&0!=h&&a!=h||0!=r&&0!=h&&r!=h)},o.prototype._dataPointFromXY=function(t,e){var i,n=100,s=null,r=null,a=null,h=new u(t,e);if(this.style===o.STYLE.BAR||this.style===o.STYLE.BARCOLOR||this.style===o.STYLE.BARSIZE)for(i=this.dataPoints.length-1;i>=0;i--){s=this.dataPoints[i];var d=s.surfaces;if(d)for(var l=d.length-1;l>=0;l--){var c=d[l],p=c.corners,f=[p[0].screen,p[1].screen,p[2].screen],m=[p[2].screen,p[3].screen,p[0].screen];if(this._insideTriangle(h,f)||this._insideTriangle(h,m))return s}}else for(i=0;i<this.dataPoints.length;i++){s=this.dataPoints[i];var v=s.screen;if(v){var g=Math.abs(t-v.x),y=Math.abs(e-v.y),b=Math.sqrt(g*g+y*y);(null===a||b<a)&&b<n&&(a=b,r=s)}}return r},o.prototype._showTooltip=function(t){var e,i,o;this.tooltip?(e=this.tooltip.dom.content,i=this.tooltip.dom.line,o=this.tooltip.dom.dot):(e=document.createElement("div"),e.style.position="absolute",e.style.padding="10px",e.style.border="1px solid #4d4d4d",e.style.color="#1a1a1a",e.style.background="rgba(255,255,255,0.7)",e.style.borderRadius="2px",e.style.boxShadow="5px 5px 10px rgba(128,128,128,0.5)",i=document.createElement("div"),i.style.position="absolute",i.style.height="40px",i.style.width="0",i.style.borderLeft="1px solid #4d4d4d",o=document.createElement("div"),o.style.position="absolute",o.style.height="0",o.style.width="0",o.style.border="5px solid #4d4d4d",o.style.borderRadius="5px",this.tooltip={dataPoint:null,dom:{content:e,line:i,dot:o}}),this._hideTooltip(),this.tooltip.dataPoint=t,"function"==typeof this.showTooltip?e.innerHTML=this.showTooltip(t.point):e.innerHTML="<table><tr><td>"+this.xLabel+":</td><td>"+t.point.x+"</td></tr><tr><td>"+this.yLabel+":</td><td>"+t.point.y+"</td></tr><tr><td>"+this.zLabel+":</td><td>"+t.point.z+"</td></tr></table>",e.style.left="0",e.style.top="0",this.frame.appendChild(e),this.frame.appendChild(i),this.frame.appendChild(o);var n=e.offsetWidth,s=e.offsetHeight,r=i.offsetHeight,a=o.offsetWidth,h=o.offsetHeight,d=t.screen.x-n/2;d=Math.min(Math.max(d,10),this.frame.clientWidth-10-n),i.style.left=t.screen.x+"px",i.style.top=t.screen.y-r+"px",e.style.left=d+"px",e.style.top=t.screen.y-r-s+"px",o.style.left=t.screen.x-a/2+"px",o.style.top=t.screen.y-h/2+"px"},o.prototype._hideTooltip=function(){if(this.tooltip){this.tooltip.dataPoint=null;for(var t in this.tooltip.dom)if(this.tooltip.dom.hasOwnProperty(t)){var e=this.tooltip.dom[t];e&&e.parentNode&&e.parentNode.removeChild(e)}}},o.prototype.setCameraPosition=function(t){v.setCameraPosition(t,this),this.redraw()},o.prototype.setSize=function(t,e){this._setSize(t,e),this.redraw()},t.exports=o},function(t,e){function i(t){if(t)return o(t)}function o(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},i.prototype.once=function(t,e){function i(){o.off(t,i),e.apply(this,arguments)}var o=this;return this._callbacks=this._callbacks||{},i.fn=e,this.on(t,i),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks[t];if(!i)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var o,n=0;n<i.length;n++)if(o=i[n],o===e||o.fn===e){i.splice(n,1);break}return this},i.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),i=this._callbacks[t];if(i){i=i.slice(0);for(var o=0,n=i.length;o<n;++o)i[o].apply(this,e)}return this},i.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},i.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){function i(t,e,i){this.x=void 0!==t?t:0,this.y=void 0!==e?e:0,this.z=void 0!==i?i:0}i.subtract=function(t,e){var o=new i;return o.x=t.x-e.x,o.y=t.y-e.y,o.z=t.z-e.z,o},i.add=function(t,e){var o=new i;return o.x=t.x+e.x,o.y=t.y+e.y,o.z=t.z+e.z,o},i.avg=function(t,e){return new i((t.x+e.x)/2,(t.y+e.y)/2,(t.z+e.z)/2)},i.crossProduct=function(t,e){var o=new i;return o.x=t.y*e.z-t.z*e.y,o.y=t.z*e.x-t.x*e.z,o.z=t.x*e.y-t.y*e.x,o},i.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.exports=i},function(t,e){function i(t,e){
+this.x=void 0!==t?t:0,this.y=void 0!==e?e:0}t.exports=i},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(){this.armLocation=new a,this.armRotation={},this.armRotation.horizontal=0,this.armRotation.vertical=0,this.armLength=1.7,this.cameraOffset=new a,this.offsetMultiplier=.6,this.cameraLocation=new a,this.cameraRotation=new a(.5*Math.PI,0,0),this.calculateCameraOrientation()}var s=i(99),r=o(s),a=i(96);n.prototype.setOffset=function(t,e){var i=Math.abs,o=r.default,n=this.offsetMultiplier,s=this.armLength*n;i(t)>s&&(t=o(t)*s),i(e)>s&&(e=o(e)*s),this.cameraOffset.x=t,this.cameraOffset.y=e,this.calculateCameraOrientation()},n.prototype.getOffset=function(t,e){return this.cameraOffset},n.prototype.setArmLocation=function(t,e,i){this.armLocation.x=t,this.armLocation.y=e,this.armLocation.z=i,this.calculateCameraOrientation()},n.prototype.setArmRotation=function(t,e){void 0!==t&&(this.armRotation.horizontal=t),void 0!==e&&(this.armRotation.vertical=e,this.armRotation.vertical<0&&(this.armRotation.vertical=0),this.armRotation.vertical>.5*Math.PI&&(this.armRotation.vertical=.5*Math.PI)),void 0===t&&void 0===e||this.calculateCameraOrientation()},n.prototype.getArmRotation=function(){var t={};return t.horizontal=this.armRotation.horizontal,t.vertical=this.armRotation.vertical,t},n.prototype.setArmLength=function(t){void 0!==t&&(this.armLength=t,this.armLength<.71&&(this.armLength=.71),this.armLength>5&&(this.armLength=5),this.setOffset(this.cameraOffset.x,this.cameraOffset.y),this.calculateCameraOrientation())},n.prototype.getArmLength=function(){return this.armLength},n.prototype.getCameraLocation=function(){return this.cameraLocation},n.prototype.getCameraRotation=function(){return this.cameraRotation},n.prototype.calculateCameraOrientation=function(){this.cameraLocation.x=this.armLocation.x-this.armLength*Math.sin(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.y=this.armLocation.y-this.armLength*Math.cos(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.z=this.armLocation.z+this.armLength*Math.sin(this.armRotation.vertical),this.cameraRotation.x=Math.PI/2-this.armRotation.vertical,this.cameraRotation.y=0,this.cameraRotation.z=-this.armRotation.horizontal;var t=this.cameraRotation.x,e=(this.cameraRotation.y,this.cameraRotation.z),i=this.cameraOffset.x,o=this.cameraOffset.y,n=Math.sin,s=Math.cos;this.cameraLocation.x=this.cameraLocation.x+i*s(e)+o*-n(e)*s(t),this.cameraLocation.y=this.cameraLocation.y+i*n(e)+o*s(e)*s(t),this.cameraLocation.z=this.cameraLocation.z+o*n(t)},t.exports=n},function(t,e,i){t.exports={default:i(100),__esModule:!0}},function(t,e,i){i(101),t.exports=i(17).Math.sign},function(t,e,i){var o=i(15);o(o.S,"Math",{sign:i(102)})},function(t,e){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,e,i){function o(t,e,i){this.data=t,this.column=e,this.graph=i,this.index=void 0,this.value=void 0,this.values=i.getDistinctValues(t.get(),this.column),this.values.sort(function(t,e){return t>e?1:t<e?-1:0}),this.values.length>0&&this.selectValue(0),this.dataPoints=[],this.loaded=!1,this.onLoadCallback=void 0,i.animationPreload?(this.loaded=!1,this.loadInBackground()):this.loaded=!0}var n=i(93);o.prototype.isLoaded=function(){return this.loaded},o.prototype.getLoadedProgress=function(){for(var t=this.values.length,e=0;this.dataPoints[e];)e++;return Math.round(e/t*100)},o.prototype.getLabel=function(){return this.graph.filterLabel},o.prototype.getColumn=function(){return this.column},o.prototype.getSelectedValue=function(){if(void 0!==this.index)return this.values[this.index]},o.prototype.getValues=function(){return this.values},o.prototype.getValue=function(t){if(t>=this.values.length)throw new Error("Index out of range");return this.values[t]},o.prototype._getDataPoints=function(t){if(void 0===t&&(t=this.index),void 0===t)return[];var e;if(this.dataPoints[t])e=this.dataPoints[t];else{var i={};i.column=this.column,i.value=this.values[t];var o=new n(this.data,{filter:function(t){return t[i.column]==i.value}}).get();e=this.graph._getDataPoints(o),this.dataPoints[t]=e}return e},o.prototype.setOnLoadCallback=function(t){this.onLoadCallback=t},o.prototype.selectValue=function(t){if(t>=this.values.length)throw new Error("Index out of range");this.index=t,this.value=this.values[t]},o.prototype.loadInBackground=function(t){void 0===t&&(t=0);var e=this.graph.frame;if(t<this.values.length){this._getDataPoints(t);void 0===e.progress&&(e.progress=document.createElement("DIV"),e.progress.style.position="absolute",e.progress.style.color="gray",e.appendChild(e.progress));var i=this.getLoadedProgress();e.progress.innerHTML="Loading animation... "+i+"%",e.progress.style.bottom="60px",e.progress.style.left="10px";var o=this;setTimeout(function(){o.loadInBackground(t+1)},10),this.loaded=!1}else this.loaded=!0,void 0!==e.progress&&(e.removeChild(e.progress),e.progress=void 0),this.onLoadCallback&&this.onLoadCallback()},t.exports=o},function(t,e,i){function o(t,e){if(void 0===t)throw new Error("No container element defined");if(this.container=t,this.visible=!e||void 0==e.visible||e.visible,this.visible){this.frame=document.createElement("DIV"),this.frame.style.width="100%",this.frame.style.position="relative",this.container.appendChild(this.frame),this.frame.prev=document.createElement("INPUT"),this.frame.prev.type="BUTTON",this.frame.prev.value="Prev",this.frame.appendChild(this.frame.prev),this.frame.play=document.createElement("INPUT"),this.frame.play.type="BUTTON",this.frame.play.value="Play",this.frame.appendChild(this.frame.play),this.frame.next=document.createElement("INPUT"),this.frame.next.type="BUTTON",this.frame.next.value="Next",this.frame.appendChild(this.frame.next),this.frame.bar=document.createElement("INPUT"),this.frame.bar.type="BUTTON",this.frame.bar.style.position="absolute",this.frame.bar.style.border="1px solid red",this.frame.bar.style.width="100px",this.frame.bar.style.height="6px",this.frame.bar.style.borderRadius="2px",this.frame.bar.style.MozBorderRadius="2px",this.frame.bar.style.border="1px solid #7F7F7F",this.frame.bar.style.backgroundColor="#E5E5E5",this.frame.appendChild(this.frame.bar),this.frame.slide=document.createElement("INPUT"),this.frame.slide.type="BUTTON",this.frame.slide.style.margin="0px",this.frame.slide.value=" ",this.frame.slide.style.position="relative",this.frame.slide.style.left="-100px",this.frame.appendChild(this.frame.slide);var i=this;this.frame.slide.onmousedown=function(t){i._onMouseDown(t)},this.frame.prev.onclick=function(t){i.prev(t)},this.frame.play.onclick=function(t){i.togglePlay(t)},this.frame.next.onclick=function(t){i.next(t)}}this.onChangeCallback=void 0,this.values=[],this.index=void 0,this.playTimeout=void 0,this.playInterval=1e3,this.playLoop=!0}var n=i(1);o.prototype.prev=function(){var t=this.getIndex();t>0&&(t--,this.setIndex(t))},o.prototype.next=function(){var t=this.getIndex();t<this.values.length-1&&(t++,this.setIndex(t))},o.prototype.playNext=function(){var t=new Date,e=this.getIndex();e<this.values.length-1?(e++,this.setIndex(e)):this.playLoop&&(e=0,this.setIndex(e));var i=new Date,o=i-t,n=Math.max(this.playInterval-o,0),s=this;this.playTimeout=setTimeout(function(){s.playNext()},n)},o.prototype.togglePlay=function(){void 0===this.playTimeout?this.play():this.stop()},o.prototype.play=function(){this.playTimeout||(this.playNext(),this.frame&&(this.frame.play.value="Stop"))},o.prototype.stop=function(){clearInterval(this.playTimeout),this.playTimeout=void 0,this.frame&&(this.frame.play.value="Play")},o.prototype.setOnChangeCallback=function(t){this.onChangeCallback=t},o.prototype.setPlayInterval=function(t){this.playInterval=t},o.prototype.getPlayInterval=function(t){return this.playInterval},o.prototype.setPlayLoop=function(t){this.playLoop=t},o.prototype.onChange=function(){void 0!==this.onChangeCallback&&this.onChangeCallback()},o.prototype.redraw=function(){if(this.frame){this.frame.bar.style.top=this.frame.clientHeight/2-this.frame.bar.offsetHeight/2+"px",this.frame.bar.style.width=this.frame.clientWidth-this.frame.prev.clientWidth-this.frame.play.clientWidth-this.frame.next.clientWidth-30+"px";var t=this.indexToLeft(this.index);this.frame.slide.style.left=t+"px"}},o.prototype.setValues=function(t){this.values=t,this.values.length>0?this.setIndex(0):this.index=void 0},o.prototype.setIndex=function(t){if(!(t<this.values.length))throw new Error("Index out of range");this.index=t,this.redraw(),this.onChange()},o.prototype.getIndex=function(){return this.index},o.prototype.get=function(){return this.values[this.index]},o.prototype._onMouseDown=function(t){var e=t.which?1===t.which:1===t.button;if(e){this.startClientX=t.clientX,this.startSlideX=parseFloat(this.frame.slide.style.left),this.frame.style.cursor="move";var i=this;this.onmousemove=function(t){i._onMouseMove(t)},this.onmouseup=function(t){i._onMouseUp(t)},n.addEventListener(document,"mousemove",this.onmousemove),n.addEventListener(document,"mouseup",this.onmouseup),n.preventDefault(t)}},o.prototype.leftToIndex=function(t){var e=parseFloat(this.frame.bar.style.width)-this.frame.slide.clientWidth-10,i=t-3,o=Math.round(i/e*(this.values.length-1));return o<0&&(o=0),o>this.values.length-1&&(o=this.values.length-1),o},o.prototype.indexToLeft=function(t){var e=parseFloat(this.frame.bar.style.width)-this.frame.slide.clientWidth-10,i=t/(this.values.length-1)*e,o=i+3;return o},o.prototype._onMouseMove=function(t){var e=t.clientX-this.startClientX,i=this.startSlideX+e,o=this.leftToIndex(i);this.setIndex(o),n.preventDefault()},o.prototype._onMouseUp=function(t){this.frame.style.cursor="auto",n.removeEventListener(document,"mousemove",this.onmousemove),n.removeEventListener(document,"mouseup",this.onmouseup),n.preventDefault()},t.exports=o},function(t,e){function i(t,e,i,o){this._start=0,this._end=0,this._step=1,this.prettyStep=!0,this.precision=5,this._current=0,this.setRange(t,e,i,o)}i.prototype.isNumeric=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},i.prototype.setRange=function(t,e,i,o){if(!this.isNumeric(t))throw new Error("Parameter 'start' is not numeric; value: "+t);if(!this.isNumeric(e))throw new Error("Parameter 'end' is not numeric; value: "+t);if(!this.isNumeric(i))throw new Error("Parameter 'step' is not numeric; value: "+t);this._start=t?t:0,this._end=e?e:0,this.setStep(i,o)},i.prototype.setStep=function(t,e){void 0===t||t<=0||(void 0!==e&&(this.prettyStep=e),this.prettyStep===!0?this._step=i.calculatePrettyStep(t):this._step=t)},i.calculatePrettyStep=function(t){var e=function(t){return Math.log(t)/Math.LN10},i=Math.pow(10,Math.round(e(t))),o=2*Math.pow(10,Math.round(e(t/2))),n=5*Math.pow(10,Math.round(e(t/5))),s=i;return Math.abs(o-t)<=Math.abs(s-t)&&(s=o),Math.abs(n-t)<=Math.abs(s-t)&&(s=n),s<=0&&(s=1),s},i.prototype.getCurrent=function(){return parseFloat(this._current.toPrecision(this.precision))},i.prototype.getStep=function(){return this._step},i.prototype.start=function(t){void 0===t&&(t=!1),this._current=this._start-this._start%this._step,t&&this.getCurrent()<this._start&&this.next()},i.prototype.next=function(){this._current+=this._step},i.prototype.end=function(){return this._current>this._end},t.exports=i},function(t,e){function i(){this.min=void 0,this.max=void 0}i.prototype.adjust=function(t){void 0!==t&&((void 0===this.min||this.min>t)&&(this.min=t),(void 0===this.max||this.max<t)&&(this.max=t))},i.prototype.combine=function(t){this.add(t.min),this.add(t.max)},i.prototype.expand=function(t){if(void 0!==t){var e=this.min-t,i=this.max+t;if(e>i)throw new Error("Passed expansion value makes range invalid");this.min=e,this.max=i}},i.prototype.range=function(){return this.max-this.min},i.prototype.center=function(){return(this.min+this.max)/2},t.exports=i},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function s(t){return void 0===t||""===t||"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.slice(1)}function r(t,e){return void 0===t||""===t?e:t+s(e)}function a(t,e,i,o){var n,s;for(var a in i)n=i[a],s=r(o,n),e[s]=t[n]}function h(t,e,i,o){var n,s;for(var a in i)n=i[a],void 0!==t[n]&&(s=r(o,n),e[s]=t[n])}function d(t,e){if(void 0===t||n(t))throw new Error("No DEFAULTS passed");if(void 0===e)throw new Error("No dst passed");M=t,a(t,e,D),a(t,e,S,"default"),u(t,e),e.margin=10,e.showGrayBottom=!1,e.showTooltip=!1,e.onclick_callback=null,e.eye=new x(0,0,-1)}function l(t,e){if(void 0!==t){if(void 0===e)throw new Error("No dst passed");if(void 0===M||n(M))throw new Error("DEFAULTS not set for module Settings");h(t,e,D),h(t,e,S,"default"),u(t,e)}}function u(t,e){void 0!==t.backgroundColor&&v(t.backgroundColor,e),g(t.dataColor,e),m(t.style,e),c(t.showLegend,e),y(t.cameraPosition,e),void 0!==t.tooltip&&(e.showTooltip=t.tooltip),void 0!=t.onclick&&(e.onclick_callback=t.onclick)}function c(t,e){if(void 0===t){var i=void 0===M.showLegend;if(i){var o=e.style===k.DOTCOLOR||e.style===k.DOTSIZE;e.showLegend=o}}else e.showLegend=t}function p(t){var e=O[t];return void 0===e?-1:e}function f(t){var e=!1;for(var i in k)if(k[i]===t){e=!0;break}return e}function m(t,e){if(void 0!==t){var i;if("string"==typeof t){if(i=p(t),i===-1)throw new Error("Style '"+t+"' is invalid")}else{if(!f(t))throw new Error("Style '"+t+"' is invalid");i=t}e.style=i}}function v(t,e){var i="white",o="gray",n=1;if("string"==typeof t)i=t,o="none",n=0;else{if("object"!==("undefined"==typeof t?"undefined":(0,_.default)(t)))throw new Error("Unsupported type of backgroundColor");void 0!==t.fill&&(i=t.fill),void 0!==t.stroke&&(o=t.stroke),void 0!==t.strokeWidth&&(n=t.strokeWidth)}e.frame.style.backgroundColor=i,e.frame.style.borderColor=o,e.frame.style.borderWidth=n+"px",e.frame.style.borderStyle="solid"}function g(t,e){void 0!==t&&(void 0===e.dataColor&&(e.dataColor={}),"string"==typeof t?(e.dataColor.fill=t,e.dataColor.stroke=t):(t.fill&&(e.dataColor.fill=t.fill),t.stroke&&(e.dataColor.stroke=t.stroke),void 0!==t.strokeWidth&&(e.dataColor.strokeWidth=t.strokeWidth)))}function y(t,e){var i=t;void 0!==i&&(void 0===e.camera&&(e.camera=new w),e.camera.setArmRotation(i.horizontal,i.vertical),e.camera.setArmLength(i.distance))}var b=i(62),_=o(b),w=i(98),x=i(96),k={BAR:0,BARCOLOR:1,BARSIZE:2,DOT:3,DOTLINE:4,DOTCOLOR:5,DOTSIZE:6,GRID:7,LINE:8,SURFACE:9},O={dot:k.DOT,"dot-line":k.DOTLINE,"dot-color":k.DOTCOLOR,"dot-size":k.DOTSIZE,line:k.LINE,grid:k.GRID,surface:k.SURFACE,bar:k.BAR,"bar-color":k.BARCOLOR,"bar-size":k.BARSIZE},D=["width","height","filterLabel","legendLabel","xLabel","yLabel","zLabel","xValueLabel","yValueLabel","zValueLabel","showGrid","showPerspective","showShadow","keepAspectRatio","verticalRatio","dotSizeRatio","showAnimationControls","animationInterval","animationPreload","animationAutoStart","axisColor","gridColor","xCenter","yCenter"],S=["xBarWidth","yBarWidth","valueMin","valueMax","xMin","xMax","xStep","yMin","yMax","yStep","zMin","zMax","zStep"],M=void 0;t.exports.STYLE=k,t.exports.setDefaults=d,t.exports.setOptions=l,t.exports.setCameraPosition=y},function(t,e,i){if("undefined"!=typeof window){var o=i(109),n=window.Hammer||i(110);t.exports=o(n,{preventDefault:"mouse"})}else t.exports=function(){throw Error("hammer.js is only available in a browser, not in node.js.")}},function(t,e,i){var o,n,s;!function(i){n=[],o=i,s="function"==typeof o?o.apply(e,n):o,!(void 0!==s&&(t.exports=s))}(function(){var t=null;return function e(i,o){function n(t){return t.match(/[^ ]+/g)}function s(e){if("hammer.input"!==e.type){if(e.srcEvent._handled||(e.srcEvent._handled={}),e.srcEvent._handled[e.type])return;e.srcEvent._handled[e.type]=!0}var i=!1;e.stopPropagation=function(){i=!0};var o=e.srcEvent.stopPropagation.bind(e.srcEvent);"function"==typeof o&&(e.srcEvent.stopPropagation=function(){o(),e.stopPropagation()}),e.firstTarget=t;for(var n=t;n&&!i;){var s=n.hammer;if(s)for(var r,a=0;a<s.length;a++)if(r=s[a]._handlers[e.type])for(var h=0;h<r.length&&!i;h++)r[h](e);n=n.parentNode}}var r=o||{preventDefault:!1};if(i.Manager){var a=i,h=function(t,i){var o=Object.create(r);return i&&a.assign(o,i),e(new a(t,o),o)};return a.assign(h,a),h.Manager=function(t,i){var o=Object.create(r);return i&&a.assign(o,i),e(new a.Manager(t,o),o)},h}var d=Object.create(i),l=i.element;return l.hammer||(l.hammer=[]),l.hammer.push(d),i.on("hammer.input",function(e){r.preventDefault!==!0&&r.preventDefault!==e.pointerType||e.preventDefault(),e.isFirst&&(t=e.target)}),d._handlers={},d.on=function(t,e){return n(t).forEach(function(t){var o=d._handlers[t];o||(d._handlers[t]=o=[],i.on(t,s)),o.push(e)}),d},d.off=function(t,e){return n(t).forEach(function(t){var o=d._handlers[t];o&&(o=e?o.filter(function(t){return t!==e}):[],o.length>0?d._handlers[t]=o:(i.off(t,s),delete d._handlers[t]))}),d},d.emit=function(e,o){t=o.target,i.emit(e,o)},d.destroy=function(){var t=i.element.hammer,e=t.indexOf(d);e!==-1&&t.splice(e,1),t.length||delete i.element.hammer,d._handlers={},i.destroy()},d}})},function(t,e,i){var o;!function(n,s,r,a){function h(t,e,i){return setTimeout(p(t,i),e)}function d(t,e,i){return!!Array.isArray(t)&&(l(t,i[e],i),!0)}function l(t,e,i){var o;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==a)for(o=0;o<t.length;)e.call(i,t[o],o,t),o++;else for(o in t)t.hasOwnProperty(o)&&e.call(i,t[o],o,t)}function u(t,e,i){var o="DEPRECATED METHOD: "+e+"\n"+i+" AT \n";return function(){var e=new Error("get-stack-trace"),i=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",s=n.console&&(n.console.warn||n.console.log);return s&&s.call(n.console,o,i),t.apply(this,arguments)}}function c(t,e,i){var o,n=e.prototype;o=t.prototype=Object.create(n),o.constructor=t,o._super=n,i&&mt(o,i)}function p(t,e){return function(){return t.apply(e,arguments)}}function f(t,e){return typeof t==yt?t.apply(e?e[0]||a:a,e):t}function m(t,e){return t===a?e:t}function v(t,e,i){l(_(e),function(e){t.addEventListener(e,i,!1)})}function g(t,e,i){l(_(e),function(e){t.removeEventListener(e,i,!1)})}function y(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function b(t,e){return t.indexOf(e)>-1}function _(t){return t.trim().split(/\s+/g)}function w(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var o=0;o<t.length;){if(i&&t[o][i]==e||!i&&t[o]===e)return o;o++}return-1}function x(t){return Array.prototype.slice.call(t,0)}function k(t,e,i){for(var o=[],n=[],s=0;s<t.length;){var r=e?t[s][e]:t[s];w(n,r)<0&&o.push(t[s]),n[s]=r,s++}return i&&(o=e?o.sort(function(t,i){return t[e]>i[e]}):o.sort()),o}function O(t,e){for(var i,o,n=e[0].toUpperCase()+e.slice(1),s=0;s<vt.length;){if(i=vt[s],o=i?i+n:e,o in t)return o;s++}return a}function D(){return Ot++}function S(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||n}function M(t,e){var i=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){f(t.options.enable,[t])&&i.handler(e)},this.init()}function C(t){var e,i=t.options.inputClass;return new(e=i?i:Mt?W:Ct?V:St?q:j)(t,T)}function T(t,e,i){var o=i.pointers.length,n=i.changedPointers.length,s=e&zt&&o-n===0,r=e&(Lt|At)&&o-n===0;i.isFirst=!!s,i.isFinal=!!r,s&&(t.session={}),i.eventType=e,E(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function E(t,e){var i=t.session,o=e.pointers,n=o.length;i.firstInput||(i.firstInput=N(e)),n>1&&!i.firstMultiple?i.firstMultiple=N(e):1===n&&(i.firstMultiple=!1);var s=i.firstInput,r=i.firstMultiple,a=r?r.center:s.center,h=e.center=z(o);e.timeStamp=wt(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=B(a,h),e.distance=A(a,h),P(i,e),e.offsetDirection=L(e.deltaX,e.deltaY);var d=R(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=d.x,e.overallVelocityY=d.y,e.overallVelocity=_t(d.x)>_t(d.y)?d.x:d.y,e.scale=r?H(r.pointers,o):1,e.rotation=r?F(r.pointers,o):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,I(i,e);var l=t.element;y(e.srcEvent.target,l)&&(l=e.srcEvent.target),e.target=l}function P(t,e){var i=e.center,o=t.offsetDelta||{},n=t.prevDelta||{},s=t.prevInput||{};e.eventType!==zt&&s.eventType!==Lt||(n=t.prevDelta={x:s.deltaX||0,y:s.deltaY||0},o=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=n.x+(i.x-o.x),e.deltaY=n.y+(i.y-o.y)}function I(t,e){var i,o,n,s,r=t.lastInterval||e,h=e.timeStamp-r.timeStamp;if(e.eventType!=At&&(h>Nt||r.velocity===a)){var d=e.deltaX-r.deltaX,l=e.deltaY-r.deltaY,u=R(h,d,l);o=u.x,n=u.y,i=_t(u.x)>_t(u.y)?u.x:u.y,s=L(d,l),t.lastInterval=e}else i=r.velocity,o=r.velocityX,n=r.velocityY,s=r.direction;e.velocity=i,e.velocityX=o,e.velocityY=n,e.direction=s}function N(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:bt(t.pointers[i].clientX),clientY:bt(t.pointers[i].clientY)},i++;return{timeStamp:wt(),pointers:e,center:z(e),deltaX:t.deltaX,deltaY:t.deltaY}}function z(t){var e=t.length;if(1===e)return{x:bt(t[0].clientX),y:bt(t[0].clientY)};for(var i=0,o=0,n=0;n<e;)i+=t[n].clientX,o+=t[n].clientY,n++;return{x:bt(i/e),y:bt(o/e)}}function R(t,e,i){return{x:e/t||0,y:i/t||0}}function L(t,e){return t===e?Bt:_t(t)>=_t(e)?t<0?Ft:Ht:e<0?jt:Wt}function A(t,e,i){i||(i=Ut);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return Math.sqrt(o*o+n*n)}function B(t,e,i){i||(i=Ut);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return 180*Math.atan2(n,o)/Math.PI}function F(t,e){return B(e[1],e[0],qt)+B(t[1],t[0],qt)}function H(t,e){return A(e[0],e[1],qt)/A(t[0],t[1],qt)}function j(){this.evEl=Zt,this.evWin=Kt,this.pressed=!1,M.apply(this,arguments)}function W(){this.evEl=$t,this.evWin=te,M.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function Y(){this.evTarget=ie,this.evWin=oe,this.started=!1,M.apply(this,arguments)}function G(t,e){var i=x(t.touches),o=x(t.changedTouches);return e&(Lt|At)&&(i=k(i.concat(o),"identifier",!0)),[i,o]}function V(){this.evTarget=se,this.targetIds={},M.apply(this,arguments)}function U(t,e){var i=x(t.touches),o=this.targetIds;if(e&(zt|Rt)&&1===i.length)return o[i[0].identifier]=!0,[i,i];var n,s,r=x(t.changedTouches),a=[],h=this.target;if(s=i.filter(function(t){return y(t.target,h)}),e===zt)for(n=0;n<s.length;)o[s[n].identifier]=!0,n++;for(n=0;n<r.length;)o[r[n].identifier]&&a.push(r[n]),e&(Lt|At)&&delete o[r[n].identifier],n++;return a.length?[k(s.concat(a),"identifier",!0),a]:void 0}function q(){M.apply(this,arguments);var t=p(this.handler,this);this.touch=new V(this.manager,t),this.mouse=new j(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function X(t,e){t&zt?(this.primaryTouch=e.changedPointers[0].identifier,Z.call(this,e)):t&(Lt|At)&&Z.call(this,e)}function Z(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var i={x:e.clientX,y:e.clientY};this.lastTouches.push(i);var o=this.lastTouches,n=function(){var t=o.indexOf(i);t>-1&&o.splice(t,1)};setTimeout(n,re)}}function K(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,o=0;o<this.lastTouches.length;o++){var n=this.lastTouches[o],s=Math.abs(e-n.x),r=Math.abs(i-n.y);if(s<=ae&&r<=ae)return!0}return!1}function Q(t,e){this.manager=t,this.set(e)}function J(t){if(b(t,pe))return pe;var e=b(t,fe),i=b(t,me);return e&&i?pe:e||i?e?fe:me:b(t,ce)?ce:ue}function $(){if(!de)return!1;var t={},e=n.CSS&&n.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(i){t[i]=!e||n.CSS.supports("touch-action",i)}),t}function tt(t){this.options=mt({},this.defaults,t||{}),this.id=D(),this.manager=null,this.options.enable=m(this.options.enable,!0),this.state=ge,this.simultaneous={},this.requireFail=[]}function et(t){return t&xe?"cancel":t&_e?"end":t&be?"move":t&ye?"start":""}function it(t){return t==Wt?"down":t==jt?"up":t==Ft?"left":t==Ht?"right":""}function ot(t,e){var i=e.manager;return i?i.get(t):t}function nt(){tt.apply(this,arguments)}function st(){nt.apply(this,arguments),this.pX=null,this.pY=null}function rt(){nt.apply(this,arguments)}function at(){tt.apply(this,arguments),this._timer=null,this._input=null}function ht(){nt.apply(this,arguments)}function dt(){nt.apply(this,arguments)}function lt(){tt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ut(t,e){return e=e||{},e.recognizers=m(e.recognizers,ut.defaults.preset),new ct(t,e)}function ct(t,e){this.options=mt({},ut.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=C(this),this.touchAction=new Q(this,this.options.touchAction),pt(this,!0),l(this.options.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function pt(t,e){var i=t.element;if(i.style){var o;l(t.options.cssProps,function(n,s){o=O(i.style,s),e?(t.oldCssProps[o]=i.style[o],i.style[o]=n):i.style[o]=t.oldCssProps[o]||""}),e||(t.oldCssProps={})}}function ft(t,e){var i=s.createEvent("Event");i.initEvent(t,!0,!0),i.gesture=e,e.target.dispatchEvent(i)}var mt,vt=["","webkit","Moz","MS","ms","o"],gt=s.createElement("div"),yt="function",bt=Math.round,_t=Math.abs,wt=Date.now;mt="function"!=typeof Object.assign?function(t){if(t===a||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var o=arguments[i];if(o!==a&&null!==o)for(var n in o)o.hasOwnProperty(n)&&(e[n]=o[n])}return e}:Object.assign;var xt=u(function(t,e,i){for(var o=Object.keys(e),n=0;n<o.length;)(!i||i&&t[o[n]]===a)&&(t[o[n]]=e[o[n]]),n++;return t},"extend","Use `assign`."),kt=u(function(t,e){return xt(t,e,!0)},"merge","Use `assign`."),Ot=1,Dt=/mobile|tablet|ip(ad|hone|od)|android/i,St="ontouchstart"in n,Mt=O(n,"PointerEvent")!==a,Ct=St&&Dt.test(navigator.userAgent),Tt="touch",Et="pen",Pt="mouse",It="kinect",Nt=25,zt=1,Rt=2,Lt=4,At=8,Bt=1,Ft=2,Ht=4,jt=8,Wt=16,Yt=Ft|Ht,Gt=jt|Wt,Vt=Yt|Gt,Ut=["x","y"],qt=["clientX","clientY"];M.prototype={handler:function(){},init:function(){this.evEl&&v(this.element,this.evEl,this.domHandler),this.evTarget&&v(this.target,this.evTarget,this.domHandler),this.evWin&&v(S(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&g(this.element,this.evEl,this.domHandler),this.evTarget&&g(this.target,this.evTarget,this.domHandler),this.evWin&&g(S(this.element),this.evWin,this.domHandler)}};var Xt={mousedown:zt,mousemove:Rt,mouseup:Lt},Zt="mousedown",Kt="mousemove mouseup";c(j,M,{handler:function(t){var e=Xt[t.type];e&zt&&0===t.button&&(this.pressed=!0),e&Rt&&1!==t.which&&(e=Lt),this.pressed&&(e&Lt&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:Pt,srcEvent:t}))}});var Qt={pointerdown:zt,pointermove:Rt,pointerup:Lt,pointercancel:At,pointerout:At},Jt={2:Tt,3:Et,4:Pt,5:It},$t="pointerdown",te="pointermove pointerup pointercancel";n.MSPointerEvent&&!n.PointerEvent&&($t="MSPointerDown",te="MSPointerMove MSPointerUp MSPointerCancel"),c(W,M,{handler:function(t){var e=this.store,i=!1,o=t.type.toLowerCase().replace("ms",""),n=Qt[o],s=Jt[t.pointerType]||t.pointerType,r=s==Tt,a=w(e,t.pointerId,"pointerId");n&zt&&(0===t.button||r)?a<0&&(e.push(t),a=e.length-1):n&(Lt|At)&&(i=!0),a<0||(e[a]=t,this.callback(this.manager,n,{pointers:e,changedPointers:[t],pointerType:s,srcEvent:t}),i&&e.splice(a,1))}});var ee={touchstart:zt,touchmove:Rt,touchend:Lt,touchcancel:At},ie="touchstart",oe="touchstart touchmove touchend touchcancel";c(Y,M,{handler:function(t){var e=ee[t.type];if(e===zt&&(this.started=!0),this.started){var i=G.call(this,t,e);e&(Lt|At)&&i[0].length-i[1].length===0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:Tt,srcEvent:t})}}});var ne={touchstart:zt,touchmove:Rt,touchend:Lt,touchcancel:At},se="touchstart touchmove touchend touchcancel";c(V,M,{handler:function(t){var e=ne[t.type],i=U.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:Tt,srcEvent:t})}});var re=2500,ae=25;c(q,M,{handler:function(t,e,i){var o=i.pointerType==Tt,n=i.pointerType==Pt;if(!(n&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(o)X.call(this,e,i);else if(n&&K.call(this,i))return;this.callback(t,e,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var he=O(gt.style,"touchAction"),de=he!==a,le="compute",ue="auto",ce="manipulation",pe="none",fe="pan-x",me="pan-y",ve=$();Q.prototype={set:function(t){t==le&&(t=this.compute()),de&&this.manager.element.style&&ve[t]&&(this.manager.element.style[he]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return l(this.manager.recognizers,function(e){f(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),J(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,i=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var o=this.actions,n=b(o,pe)&&!ve[pe],s=b(o,me)&&!ve[me],r=b(o,fe)&&!ve[fe];if(n){var a=1===t.pointers.length,h=t.distance<2,d=t.deltaTime<250;if(a&&h&&d)return}return r&&s?void 0:n||s&&i&Yt||r&&i&Gt?this.preventSrc(e):void 0},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var ge=1,ye=2,be=4,_e=8,we=_e,xe=16,ke=32;tt.prototype={defaults:{},set:function(t){return mt(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(d(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=ot(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return d(t,"dropRecognizeWith",this)?this:(t=ot(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(d(t,"requireFailure",this))return this;var e=this.requireFail;return t=ot(t,this),w(e,t)===-1&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(d(t,"dropRequireFailure",this))return this;t=ot(t,this);var e=w(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){i.manager.emit(e,t)}var i=this,o=this.state;o<_e&&e(i.options.event+et(o)),e(i.options.event),t.additionalEvent&&e(t.additionalEvent),o>=_e&&e(i.options.event+et(o))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=ke)},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(ke|ge)))return!1;t++}return!0},recognize:function(t){var e=mt({},t);return f(this.options.enable,[this,e])?(this.state&(we|xe|ke)&&(this.state=ge),this.state=this.process(e),void(this.state&(ye|be|_e|xe)&&this.tryEmit(e))):(this.reset(),void(this.state=ke))},process:function(t){},getTouchAction:function(){},reset:function(){}},c(nt,tt,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,i=t.eventType,o=e&(ye|be),n=this.attrTest(t);return o&&(i&At||!n)?e|xe:o||n?i&Lt?e|_e:e&ye?e|be:ye:ke}}),c(st,nt,{defaults:{event:"pan",threshold:10,pointers:1,direction:Vt},getTouchAction:function(){var t=this.options.direction,e=[];return t&Yt&&e.push(me),t&Gt&&e.push(fe),e},directionTest:function(t){var e=this.options,i=!0,o=t.distance,n=t.direction,s=t.deltaX,r=t.deltaY;return n&e.direction||(e.direction&Yt?(n=0===s?Bt:s<0?Ft:Ht,i=s!=this.pX,o=Math.abs(t.deltaX)):(n=0===r?Bt:r<0?jt:Wt,i=r!=this.pY,o=Math.abs(t.deltaY))),t.direction=n,i&&o>e.threshold&&n&e.direction},attrTest:function(t){return nt.prototype.attrTest.call(this,t)&&(this.state&ye||!(this.state&ye)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=it(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),c(rt,nt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[pe];
+},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ye)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),c(at,tt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ue]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distance<e.threshold,n=t.deltaTime>e.time;if(this._input=t,!o||!i||t.eventType&(Lt|At)&&!n)this.reset();else if(t.eventType&zt)this.reset(),this._timer=h(function(){this.state=we,this.tryEmit()},e.time,this);else if(t.eventType&Lt)return we;return ke},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===we&&(t&&t.eventType&Lt?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=wt(),this.manager.emit(this.options.event,this._input)))}}),c(ht,nt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[pe]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ye)}}),c(dt,nt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Yt|Gt,pointers:1},getTouchAction:function(){return st.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(Yt|Gt)?e=t.overallVelocity:i&Yt?e=t.overallVelocityX:i&Gt&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&_t(e)>this.options.velocity&&t.eventType&Lt},emit:function(t){var e=it(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),c(lt,tt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ce]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distance<e.threshold,n=t.deltaTime<e.time;if(this.reset(),t.eventType&zt&&0===this.count)return this.failTimeout();if(o&&n&&i){if(t.eventType!=Lt)return this.failTimeout();var s=!this.pTime||t.timeStamp-this.pTime<e.interval,r=!this.pCenter||A(this.pCenter,t.center)<e.posThreshold;this.pTime=t.timeStamp,this.pCenter=t.center,r&&s?this.count+=1:this.count=1,this._input=t;var a=this.count%e.taps;if(0===a)return this.hasRequireFailures()?(this._timer=h(function(){this.state=we,this.tryEmit()},e.interval,this),ye):we}return ke},failTimeout:function(){return this._timer=h(function(){this.state=ke},this.options.interval,this),ke},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==we&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ut.VERSION="2.0.7",ut.defaults={domEvents:!1,touchAction:le,enable:!0,inputTarget:null,inputClass:null,preset:[[ht,{enable:!1}],[rt,{enable:!1},["rotate"]],[dt,{direction:Yt}],[st,{direction:Yt},["swipe"]],[lt],[lt,{event:"doubletap",taps:2},["tap"]],[at]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Oe=1,De=2;ct.prototype={set:function(t){return mt(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?De:Oe},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var i,o=this.recognizers,n=e.curRecognizer;(!n||n&&n.state&we)&&(n=e.curRecognizer=null);for(var s=0;s<o.length;)i=o[s],e.stopped===De||n&&i!=n&&!i.canRecognizeWith(n)?i.reset():i.recognize(t),!n&&i.state&(ye|be|_e)&&(n=e.curRecognizer=i),s++}},get:function(t){if(t instanceof tt)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event==t)return e[i];return null},add:function(t){if(d(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(d(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,i=w(e,t);i!==-1&&(e.splice(i,1),this.touchAction.update())}return this},on:function(t,e){if(t!==a&&e!==a){var i=this.handlers;return l(_(t),function(t){i[t]=i[t]||[],i[t].push(e)}),this}},off:function(t,e){if(t!==a){var i=this.handlers;return l(_(t),function(t){e?i[t]&&i[t].splice(w(i[t],e),1):delete i[t]}),this}},emit:function(t,e){this.options.domEvents&&ft(t,e);var i=this.handlers[t]&&this.handlers[t].slice();if(i&&i.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var o=0;o<i.length;)i[o](e),o++}},destroy:function(){this.element&&pt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},mt(ut,{INPUT_START:zt,INPUT_MOVE:Rt,INPUT_END:Lt,INPUT_CANCEL:At,STATE_POSSIBLE:ge,STATE_BEGAN:ye,STATE_CHANGED:be,STATE_ENDED:_e,STATE_RECOGNIZED:we,STATE_CANCELLED:xe,STATE_FAILED:ke,DIRECTION_NONE:Bt,DIRECTION_LEFT:Ft,DIRECTION_RIGHT:Ht,DIRECTION_UP:jt,DIRECTION_DOWN:Wt,DIRECTION_HORIZONTAL:Yt,DIRECTION_VERTICAL:Gt,DIRECTION_ALL:Vt,Manager:ct,Input:M,TouchAction:Q,TouchInput:V,MouseInput:j,PointerEventInput:W,TouchMouseInput:q,SingleTouchInput:Y,Recognizer:tt,AttrRecognizer:nt,Tap:lt,Pan:st,Swipe:dt,Pinch:rt,Rotate:ht,Press:at,on:v,off:g,each:l,merge:kt,extend:xt,assign:mt,inherit:c,bindFn:p,prefixed:O});var Se="undefined"!=typeof n?n:"undefined"!=typeof self?self:{};Se.Hammer=ut,o=function(){return ut}.call(e,i,e,t),!(o!==a&&(t.exports=o))}(window,document,"Hammer")},function(t,e,i){var o,n,s;!function(i,r){n=[],o=r,s="function"==typeof o?o.apply(e,n):o,!(void 0!==s&&(t.exports=s))}(this,function(){function t(t){var e,i=t&&t.preventDefault||!1,o=t&&t.container||window,n={},s={keydown:{},keyup:{}},r={};for(e=97;e<=122;e++)r[String.fromCharCode(e)]={code:65+(e-97),shift:!1};for(e=65;e<=90;e++)r[String.fromCharCode(e)]={code:e,shift:!0};for(e=0;e<=9;e++)r[""+e]={code:48+e,shift:!1};for(e=1;e<=12;e++)r["F"+e]={code:111+e,shift:!1};for(e=0;e<=9;e++)r["num"+e]={code:96+e,shift:!1};r["num*"]={code:106,shift:!1},r["num+"]={code:107,shift:!1},r["num-"]={code:109,shift:!1},r["num/"]={code:111,shift:!1},r["num."]={code:110,shift:!1},r.left={code:37,shift:!1},r.up={code:38,shift:!1},r.right={code:39,shift:!1},r.down={code:40,shift:!1},r.space={code:32,shift:!1},r.enter={code:13,shift:!1},r.shift={code:16,shift:void 0},r.esc={code:27,shift:!1},r.backspace={code:8,shift:!1},r.tab={code:9,shift:!1},r.ctrl={code:17,shift:!1},r.alt={code:18,shift:!1},r.delete={code:46,shift:!1},r.pageup={code:33,shift:!1},r.pagedown={code:34,shift:!1},r["="]={code:187,shift:!1},r["-"]={code:189,shift:!1},r["]"]={code:221,shift:!1},r["["]={code:219,shift:!1};var a=function(t){d(t,"keydown")},h=function(t){d(t,"keyup")},d=function(t,e){if(void 0!==s[e][t.keyCode]){for(var o=s[e][t.keyCode],n=0;n<o.length;n++)void 0===o[n].shift?o[n].fn(t):1==o[n].shift&&1==t.shiftKey?o[n].fn(t):0==o[n].shift&&0==t.shiftKey&&o[n].fn(t);1==i&&t.preventDefault()}};return n.bind=function(t,e,i){if(void 0===i&&(i="keydown"),void 0===r[t])throw new Error("unsupported key: "+t);void 0===s[i][r[t].code]&&(s[i][r[t].code]=[]),s[i][r[t].code].push({fn:e,shift:r[t].shift})},n.bindAll=function(t,e){void 0===e&&(e="keydown");for(var i in r)r.hasOwnProperty(i)&&n.bind(i,t,e)},n.getKey=function(t){for(var e in r)if(r.hasOwnProperty(e)){if(1==t.shiftKey&&1==r[e].shift&&t.keyCode==r[e].code)return e;if(0==t.shiftKey&&0==r[e].shift&&t.keyCode==r[e].code)return e;if(t.keyCode==r[e].code&&"shift"==e)return e}return"unknown key, currently not supported"},n.unbind=function(t,e,i){if(void 0===i&&(i="keydown"),void 0===r[t])throw new Error("unsupported key: "+t);if(void 0!==e){var o=[],n=s[i][r[t].code];if(void 0!==n)for(var a=0;a<n.length;a++)n[a].fn==e&&n[a].shift==r[t].shift||o.push(s[i][r[t].code][a]);s[i][r[t].code]=o}else s[i][r[t].code]=[]},n.reset=function(){s={keydown:{},keyup:{}}},n.destroy=function(){s={keydown:{},keyup:{}},o.removeEventListener("keydown",a,!0),o.removeEventListener("keyup",h,!0)},o.addEventListener("keydown",a,!0),o.addEventListener("keyup",h,!0),n}return t})},function(t,e,i){e.util=i(1),e.DOMutil=i(90),e.DataSet=i(91),e.DataView=i(93),e.Queue=i(92),e.Timeline=i(113),e.Graph2d=i(144),e.timeline={Core:i(126),DateUtil:i(125),Range:i(123),stack:i(131),TimeStep:i(129),components:{items:{Item:i(133),BackgroundItem:i(137),BoxItem:i(135),PointItem:i(136),RangeItem:i(132)},BackgroundGroup:i(134),Component:i(124),CurrentTime:i(142),CustomTime:i(140),DataAxis:i(146),DataScale:i(147),GraphGroup:i(148),Group:i(130),ItemSet:i(127),Legend:i(152),LineGraph:i(145),TimeAxis:i(138)}},e.moment=i(84),e.Hammer=i(108),e.keycharm=i(111)},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i,o){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!(Array.isArray(i)||i instanceof u||i instanceof c)&&i instanceof Object){var s=o;o=i,i=s}o&&o.throttleRedraw&&console.warn('Timeline option "throttleRedraw" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release.');var r=this;if(this.defaultOptions={start:null,end:null,autoResize:!0,orientation:{axis:"bottom",item:"bottom"},moment:d,width:null,height:null,maxHeight:null,minHeight:null},this.options=l.deepExtend({},this.defaultOptions),this._create(t),!o||o&&"undefined"==typeof o.rtl){for(var a,h=this.dom.root;!a&&h;)a=window.getComputedStyle(h,null).direction,h=h.parentElement;this.options.rtl=a&&"rtl"==a.toLowerCase()}else this.options.rtl=o.rtl;this.options.rollingMode=o&&o.rollingMode,this.components=[],this.body={dom:this.dom,domProps:this.props,emitter:{on:this.on.bind(this),off:this.off.bind(this),emit:this.emit.bind(this)},hiddenDates:[],util:{getScale:function(){return r.timeAxis.step.scale},getStep:function(){return r.timeAxis.step.step},toScreen:r._toScreen.bind(r),toGlobalScreen:r._toGlobalScreen.bind(r),toTime:r._toTime.bind(r),toGlobalTime:r._toGlobalTime.bind(r)}},this.range=new p(this.body,this.options),this.components.push(this.range),this.body.range=this.range,this.timeAxis=new m(this.body,this.options),this.timeAxis2=null,this.components.push(this.timeAxis),this.currentTime=new v(this.body,this.options),this.components.push(this.currentTime),this.itemSet=new y(this.body,this.options),this.components.push(this.itemSet),this.itemsData=null,this.groupsData=null,this.dom.root.onclick=function(t){r.emit("click",r.getEventProperties(t))},this.dom.root.ondblclick=function(t){r.emit("doubleClick",r.getEventProperties(t))},this.dom.root.oncontextmenu=function(t){r.emit("contextmenu",r.getEventProperties(t))},this.dom.root.onmouseover=function(t){r.emit("mouseOver",r.getEventProperties(t))},this.dom.root.onmousemove=function(t){r.emit("mouseMove",r.getEventProperties(t))},this.fitDone=!1,this.on("changed",function(){if(null!=this.itemsData&&!this.options.rollingMode&&!r.fitDone)if(r.fitDone=!0,void 0!=r.options.start||void 0!=r.options.end){if(void 0==r.options.start||void 0==r.options.end)var t=r.getItemRange();var e=void 0!=r.options.start?r.options.start:t.min,i=void 0!=r.options.end?r.options.end:t.max;r.setWindow(e,i,{animation:!1})}else r.fit({animation:!1})}),o&&this.setOptions(o),i&&this.setGroups(i),e&&this.setItems(e),this._redraw()}var s=i(114),r=o(s),a=i(122),h=o(a),d=(i(95),i(108),i(84)),l=i(1),u=i(91),c=i(93),p=i(123),f=i(126),m=i(138),v=i(142),g=i(140),y=i(127),b=i(122).printStyle,_=i(143).allOptions,w=i(143).configureOptions;n.prototype=new f,n.prototype._createConfigurator=function(){return new r.default(this,this.dom.container,w)},n.prototype.redraw=function(){this.itemSet&&this.itemSet.markDirty({refreshItems:!0}),this._redraw()},n.prototype.setOptions=function(t){var e=h.default.validate(t,_);if(e===!0&&console.log("%cErrors have been found in the supplied options object.",b),f.prototype.setOptions.call(this,t),"type"in t&&t.type!==this.options.type){this.options.type=t.type;var i=this.itemsData;if(i){var o=this.getSelection();this.setItems(null),this.setItems(i),this.setSelection(o)}}},n.prototype.setItems=function(t){var e;e=t?t instanceof u||t instanceof c?t:new u(t,{type:{start:"Date",end:"Date"}}):null,this.itemsData=e,this.itemSet&&this.itemSet.setItems(e)},n.prototype.setGroups=function(t){var e;if(t){var i=function(t){return t.visible!==!1};e=t instanceof u||t instanceof c?new c(t,{filter:i}):new u(t.filter(i))}else e=null;this.groupsData=e,this.itemSet.setGroups(e)},n.prototype.setData=function(t){t&&t.groups&&this.setGroups(t.groups),t&&t.items&&this.setItems(t.items)},n.prototype.setSelection=function(t,e){this.itemSet&&this.itemSet.setSelection(t),e&&e.focus&&this.focus(t,e)},n.prototype.getSelection=function(){return this.itemSet&&this.itemSet.getSelection()||[]},n.prototype.focus=function(t,e){if(this.itemsData&&void 0!=t){var i=Array.isArray(t)?t:[t],o=this.itemsData.getDataSet().get(i,{type:{start:"Date",end:"Date"}}),n=null,s=null;if(o.forEach(function(t){var e=t.start.valueOf(),i="end"in t?t.end.valueOf():t.start.valueOf();(null===n||e<n)&&(n=e),(null===s||i>s)&&(s=i)}),null!==n&&null!==s){var r=(n+s)/2,a=Math.max(this.range.end-this.range.start,1.1*(s-n)),h=!e||void 0===e.animation||e.animation;this.range.setRange(r-a/2,r+a/2,h)}}},n.prototype.fit=function(t){var e,i=!t||void 0===t.animation||t.animation,o=this.itemsData&&this.itemsData.getDataSet();1===o.length&&void 0===o.get()[0].end?(e=this.getDataRange(),this.moveTo(e.min.valueOf(),{animation:i})):(e=this.getItemRange(),this.range.setRange(e.min,e.max,i))},n.prototype.getItemRange=function(){var t=this,e=this.getDataRange(),i=null!==e.min?e.min.valueOf():null,o=null!==e.max?e.max.valueOf():null,n=null,s=null;if(null!=i&&null!=o){var r,a,h,d,u;!function(){var e=function(t){return l.convert(t.data.start,"Date").valueOf()},c=function(t){var e=void 0!=t.data.end?t.data.end:t.data.start;return l.convert(e,"Date").valueOf()};r=o-i,r<=0&&(r=10),a=r/t.props.center.width,l.forEach(t.itemSet.items,function(t){t.groupShowing&&(t.show(),t.repositionX());var r=e(t),h=c(t);if(this.options.rtl)var d=r-(t.getWidthRight()+10)*a,l=h+(t.getWidthLeft()+10)*a;else var d=r-(t.getWidthLeft()+10)*a,l=h+(t.getWidthRight()+10)*a;d<i&&(i=d,n=t),l>o&&(o=l,s=t)}.bind(t)),n&&s&&(h=n.getWidthLeft()+10,d=s.getWidthRight()+10,u=t.props.center.width-h-d,u>0&&(t.options.rtl?(i=e(n)-d*r/u,o=c(s)+h*r/u):(i=e(n)-h*r/u,o=c(s)+d*r/u)))}()}return{min:null!=i?new Date(i):null,max:null!=o?new Date(o):null}},n.prototype.getDataRange=function(){var t=null,e=null,i=this.itemsData&&this.itemsData.getDataSet();return i&&i.forEach(function(i){var o=l.convert(i.start,"Date").valueOf(),n=l.convert(void 0!=i.end?i.end:i.start,"Date").valueOf();(null===t||o<t)&&(t=o),(null===e||n>e)&&(e=n)}),{min:null!=t?new Date(t):null,max:null!=e?new Date(e):null}},n.prototype.getEventProperties=function(t){var e=t.center?t.center.x:t.clientX,i=t.center?t.center.y:t.clientY;if(this.options.rtl)var o=l.getAbsoluteRight(this.dom.centerContainer)-e;else var o=e-l.getAbsoluteLeft(this.dom.centerContainer);var n=i-l.getAbsoluteTop(this.dom.centerContainer),s=this.itemSet.itemFromTarget(t),r=this.itemSet.groupFromTarget(t),a=g.customTimeFromTarget(t),h=this.itemSet.options.snap||null,d=this.body.util.getScale(),u=this.body.util.getStep(),c=this._toTime(o),p=h?h(c,d,u):c,f=l.getTarget(t),m=null;return null!=s?m="item":null!=a?m="custom-time":l.hasParent(f,this.timeAxis.dom.foreground)?m="axis":this.timeAxis2&&l.hasParent(f,this.timeAxis2.dom.foreground)?m="axis":l.hasParent(f,this.itemSet.dom.labelSet)?m="group-label":l.hasParent(f,this.currentTime.bar)?m="current-time":l.hasParent(f,this.dom.center)&&(m="background"),{event:t,item:s?s.id:null,group:r?r.groupId:null,what:m,pageX:t.srcEvent?t.srcEvent.pageX:t.pageX,pageY:t.srcEvent?t.srcEvent.pageY:t.pageY,x:o,y:n,time:c,snappedTime:p}},t.exports=n},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(82),s=o(n),r=i(62),a=o(r),h=i(115),d=o(h),l=i(116),u=o(l),c=i(120),p=o(c),f=i(1),m=function(){function t(e,i,o){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;(0,d.default)(this,t),this.parent=e,this.changedOptions=[],this.container=i,this.allowCreation=!1,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},f.extend(this.options,this.defaultOptions),this.configureOptions=o,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new p.default(n),this.wrapper=void 0}return(0,u.default)(t,[{key:"setOptions",value:function(t){if(void 0!==t){this.popupHistory={},this._removePopup();var e=!0;"string"==typeof t?this.options.filter=t:t instanceof Array?this.options.filter=t.join():"object"===("undefined"==typeof t?"undefined":(0,a.default)(t))?(void 0!==t.container&&(this.options.container=t.container),void 0!==t.filter&&(this.options.filter=t.filter),void 0!==t.showButton&&(this.options.showButton=t.showButton),void 0!==t.enabled&&(e=t.enabled)):"boolean"==typeof t?(this.options.filter=!0,e=t):"function"==typeof t&&(this.options.filter=t,e=!0),this.options.filter===!1&&(e=!1),this.options.enabled=e}this._clean()}},{key:"setModuleOptions",value:function(t){this.moduleOptions=t,this.options.enabled===!0&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){var t=this;this._clean(),this.changedOptions=[];var e=this.options.filter,i=0,o=!1;for(var n in this.configureOptions)this.configureOptions.hasOwnProperty(n)&&(this.allowCreation=!1,o=!1,"function"==typeof e?(o=e(n,[]),o=o||this._handleObject(this.configureOptions[n],[n],!0)):e!==!0&&e.indexOf(n)===-1||(o=!0),o!==!1&&(this.allowCreation=!0,i>0&&this._makeItem([]),this._makeHeader(n),this._handleObject(this.configureOptions[n],[n])),i++);this.options.showButton===!0&&!function(){var e=document.createElement("div");e.className="vis-configuration vis-config-button",e.innerHTML="generate options",e.onclick=function(){t._printOptions()},e.onmouseover=function(){e.className="vis-configuration vis-config-button hover"},e.onmouseout=function(){e.className="vis-configuration vis-config-button"},t.optionsContainer=document.createElement("div"),t.optionsContainer.className="vis-configuration vis-config-option-container",t.domElements.push(t.optionsContainer),t.domElements.push(e)}(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var t=0;t<this.domElements.length;t++)this.wrapper.appendChild(this.domElements[t]);this._showPopupIfNeeded()}},{key:"_clean",value:function(){for(var t=0;t<this.domElements.length;t++)this.wrapper.removeChild(this.domElements[t]);void 0!==this.wrapper&&(this.container.removeChild(this.wrapper),this.wrapper=void 0),this.domElements=[],this._removePopup()}},{key:"_getValue",value:function(t){for(var e=this.moduleOptions,i=0;i<t.length;i++){if(void 0===e[t[i]]){e=void 0;break}e=e[t[i]]}return e}},{key:"_makeItem",value:function(t){var e=arguments,i=this;if(this.allowCreation===!0){var o,n,s,r=function(){var r=document.createElement("div");for(r.className="vis-configuration vis-config-item vis-config-s"+t.length,o=e.length,n=Array(o>1?o-1:0),s=1;s<o;s++)n[s-1]=e[s];return n.forEach(function(t){r.appendChild(t)}),i.domElements.push(r),{v:i.domElements.length}}();if("object"===("undefined"==typeof r?"undefined":(0,a.default)(r)))return r.v}return 0}},{key:"_makeHeader",value:function(t){var e=document.createElement("div");e.className="vis-configuration vis-config-header",e.innerHTML=t,this._makeItem([],e)}},{key:"_makeLabel",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=document.createElement("div");return o.className="vis-configuration vis-config-label vis-config-s"+e.length,i===!0?o.innerHTML="<i><b>"+t+":</b></i>":o.innerHTML=t+":",o}},{key:"_makeDropdown",value:function(t,e,i){var o=document.createElement("select");o.className="vis-configuration vis-config-select";var n=0;void 0!==e&&t.indexOf(e)!==-1&&(n=t.indexOf(e));for(var s=0;s<t.length;s++){var r=document.createElement("option");r.value=t[s],s===n&&(r.selected="selected"),r.innerHTML=t[s],o.appendChild(r)}var a=this;o.onchange=function(){a._update(this.value,i)};var h=this._makeLabel(i[i.length-1],i);this._makeItem(i,h,o)}},{key:"_makeRange",value:function(t,e,i){var o=t[0],n=t[1],s=t[2],r=t[3],a=document.createElement("input");a.className="vis-configuration vis-config-range";try{a.type="range",a.min=n,a.max=s}catch(t){}a.step=r;var h="",d=0;if(void 0!==e){var l=1.2;e<0&&e*l<n?(a.min=Math.ceil(e*l),d=a.min,h="range increased"):e/l<n&&(a.min=Math.ceil(e/l),d=a.min,h="range increased"),e*l>s&&1!==s&&(a.max=Math.ceil(e*l),d=a.max,h="range increased"),a.value=e}else a.value=o;var u=document.createElement("input");u.className="vis-configuration vis-config-rangeinput",u.value=a.value;var c=this;a.onchange=function(){u.value=this.value,c._update(Number(this.value),i)},a.oninput=function(){u.value=this.value};var p=this._makeLabel(i[i.length-1],i),f=this._makeItem(i,p,a,u);""!==h&&this.popupHistory[f]!==d&&(this.popupHistory[f]=d,this._setupPopup(h,f))}},{key:"_setupPopup",value:function(t,e){var i=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter<this.popupLimit){var o=document.createElement("div");o.id="vis-configuration-popup",o.className="vis-configuration-popup",o.innerHTML=t,o.onclick=function(){i._removePopup()},this.popupCounter+=1,this.popupDiv={html:o,index:e}}}},{key:"_removePopup",value:function(){void 0!==this.popupDiv.html&&(this.popupDiv.html.parentNode.removeChild(this.popupDiv.html),clearTimeout(this.popupDiv.hideTimeout),clearTimeout(this.popupDiv.deleteTimeout),this.popupDiv={})}},{key:"_showPopupIfNeeded",value:function(){var t=this;if(void 0!==this.popupDiv.html){var e=this.domElements[this.popupDiv.index],i=e.getBoundingClientRect();this.popupDiv.html.style.left=i.left+"px",this.popupDiv.html.style.top=i.top-30+"px",document.body.appendChild(this.popupDiv.html),this.popupDiv.hideTimeout=setTimeout(function(){t.popupDiv.html.style.opacity=0},1500),this.popupDiv.deleteTimeout=setTimeout(function(){t._removePopup()},1800)}}},{key:"_makeCheckbox",value:function(t,e,i){var o=document.createElement("input");o.type="checkbox",o.className="vis-configuration vis-config-checkbox",o.checked=t,void 0!==e&&(o.checked=e,e!==t&&("object"===("undefined"==typeof t?"undefined":(0,a.default)(t))?e!==t.enabled&&this.changedOptions.push({path:i,value:e}):this.changedOptions.push({path:i,value:e})));var n=this;o.onchange=function(){n._update(this.checked,i)};var s=this._makeLabel(i[i.length-1],i);this._makeItem(i,s,o)}},{key:"_makeTextInput",value:function(t,e,i){var o=document.createElement("input");o.type="text",o.className="vis-configuration vis-config-text",o.value=e,e!==t&&this.changedOptions.push({path:i,value:e});var n=this;o.onchange=function(){n._update(this.value,i)};var s=this._makeLabel(i[i.length-1],i);this._makeItem(i,s,o)}},{key:"_makeColorField",value:function(t,e,i){var o=this,n=t[1],s=document.createElement("div");e=void 0===e?n:e,"none"!==e?(s.className="vis-configuration vis-config-colorBlock",s.style.backgroundColor=e):s.className="vis-configuration vis-config-colorBlock none",e=void 0===e?n:e,s.onclick=function(){o._showColorPicker(e,s,i)};var r=this._makeLabel(i[i.length-1],i);this._makeItem(i,r,s)}},{key:"_showColorPicker",value:function(t,e,i){var o=this;e.onclick=function(){},this.colorPicker.insertTo(e),this.colorPicker.show(),this.colorPicker.setColor(t),this.colorPicker.setUpdateCallback(function(t){var n="rgba("+t.r+","+t.g+","+t.b+","+t.a+")";e.style.backgroundColor=n,o._update(n,i)}),this.colorPicker.setCloseCallback(function(){e.onclick=function(){o._showColorPicker(t,e,i)}})}},{key:"_handleObject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1,n=this.options.filter,s=!1;for(var r in t)if(t.hasOwnProperty(r)){o=!0;var a=t[r],h=f.copyAndExtendArray(e,r);if("function"==typeof n&&(o=n(r,e),o===!1&&!(a instanceof Array)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,o=this._handleObject(a,h,!0),this.allowCreation=i===!1)),o!==!1){s=!0;var d=this._getValue(h);if(a instanceof Array)this._handleArray(a,d,h);else if("string"==typeof a)this._makeTextInput(a,d,h);else if("boolean"==typeof a)this._makeCheckbox(a,d,h);else if(a instanceof Object){var l=!0;if(e.indexOf("physics")!==-1&&this.moduleOptions.physics.solver!==r&&(l=!1),l===!0)if(void 0!==a.enabled){var u=f.copyAndExtendArray(h,"enabled"),c=this._getValue(u);if(c===!0){var p=this._makeLabel(r,h,!0);this._makeItem(h,p),s=this._handleObject(a,h)||s}else this._makeCheckbox(a,c,h)}else{var m=this._makeLabel(r,h,!0);this._makeItem(h,m),s=this._handleObject(a,h)||s}}else console.error("dont know how to handle",a,r,h)}}return s}},{key:"_handleArray",value:function(t,e,i){"string"==typeof t[0]&&"color"===t[0]?(this._makeColorField(t,e,i),t[1]!==e&&this.changedOptions.push({path:i,value:e})):"string"==typeof t[0]?(this._makeDropdown(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:e})):"number"==typeof t[0]&&(this._makeRange(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:Number(e)}))}},{key:"_update",value:function(t,e){var i=this._constructOptions(t,e);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}},{key:"_constructOptions",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i;t="true"===t||t,t="false"!==t&&t;for(var n=0;n<e.length;n++)"global"!==e[n]&&(void 0===o[e[n]]&&(o[e[n]]={}),n!==e.length-1?o=o[e[n]]:o[e[n]]=t);return i}},{key:"_printOptions",value:function(){var t=this.getOptions();this.optionsContainer.innerHTML="<pre>var options = "+(0,s.default)(t,null,2)+"</pre>"}},{key:"getOptions",value:function(){for(var t={},e=0;e<this.changedOptions.length;e++)this._constructOptions(this.changedOptions[e].value,this.changedOptions[e].path,t);return t}}]),t}();e.default=m},function(t,e){e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var n=i(117),s=o(n);e.default=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),(0,s.default)(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}()},function(t,e,i){t.exports={default:i(118),__esModule:!0}},function(t,e,i){i(119);var o=i(17).Object;t.exports=function(t,e,i){return o.defineProperty(t,e,i)}},function(t,e,i){var o=i(15);o(o.S+o.F*!i(25),"Object",{defineProperty:i(21).f})},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(82),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(108),u=i(121),c=i(1),p=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;(0,a.default)(this,t),this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return(0,d.default)(t,[{key:"insertTo",value:function(t){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=t,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=t}},{key:"setCloseCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=t}},{key:"_isColorString",value:function(t){var e={black:"#000000",navy:"#000080",darkblue:"#00008B",mediumblue:"#0000CD",blue:"#0000FF",darkgreen:"#006400",green:"#008000",teal:"#008080",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",lime:"#00FF00",springgreen:"#00FF7F",aqua:"#00FFFF",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",mediumaquamarine:"#66CDAA",dimgray:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",lightslategray:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",maroon:"#800000",purple:"#800080",olive:"#808000",gray:"#808080",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370D8",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",silver:"#C0C0C0",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgrey:"#D3D3D3",palevioletred:"#D87093",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",red:"#FF0000",fuchsia:"#FF00FF",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",yellow:"#FFFF00",lightyellow:"#FFFFE0",ivory:"#FFFFF0",white:"#FFFFFF"};if("string"==typeof t)return e[t]}},{key:"setColor",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==t){var i=void 0,o=this._isColorString(t);if(void 0!==o&&(t=o),c.isString(t)===!0){if(c.isValidRGB(t)===!0){var n=t.substr(4).substr(0,t.length-5).split(",");i={r:n[0],g:n[1],b:n[2],a:1}}else if(c.isValidRGBA(t)===!0){var r=t.substr(5).substr(0,t.length-6).split(",");i={r:r[0],g:r[1],b:r[2],a:r[3]}}else if(c.isValidHex(t)===!0){var a=c.hexToRGB(t);i={r:a.r,g:a.g,b:a.b,a:1}}}else if(t instanceof Object&&void 0!==t.r&&void 0!==t.g&&void 0!==t.b){var h=void 0!==t.a?t.a:"1.0";i={r:t.r,g:t.g,b:t.b,a:h}}if(void 0===i)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+(0,
+s.default)(t));this._setColor(i,e)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];e===!0&&(this.previousColor=c.extend({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",setTimeout(function(){void 0!==t.closeCallback&&(t.closeCallback(),t.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e===!0&&(this.initialColor=c.extend({},t)),this.color=t;var i=c.RGBToHSV(t.r,t.g,t.b),o=2*Math.PI,n=this.r*i.s,s=this.centerCoordinates.x+n*Math.sin(o*i.h),r=this.centerCoordinates.y+n*Math.cos(o*i.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=r-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(t)}},{key:"_setOpacity",value:function(t){this.color.a=t/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(t){var e=c.RGBToHSV(this.color.r,this.color.g,this.color.b);e.v=t/100;var i=c.HSVToRGB(e.h,e.s,e.v);i.a=this.color.a,this.color=i,this._updatePicker()}},{key:"_updatePicker",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,e=c.RGBToHSV(t.r,t.g,t.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var o=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,o,n),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-e.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),i.fill(),this.brightnessRange.value=100*e.v,this.opacityRange.value=100*t.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var t=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerHTML="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(e)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(t){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(t){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var i=this;this.opacityRange.onchange=function(){i._setOpacity(this.value)},this.opacityRange.oninput=function(){i._setOpacity(this.value)},this.brightnessRange.onchange=function(){i._setBrightness(this.value)},this.brightnessRange.oninput=function(){i._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerHTML="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerHTML="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerHTML="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerHTML="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerHTML="cancel",this.cancelButton.onclick=this._hide.bind(this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerHTML="apply",this.applyButton.onclick=this._apply.bind(this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerHTML="save",this.saveButton.onclick=this._save.bind(this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerHTML="load last",this.loadButton.onclick=this._loadLast.bind(this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var t=this;this.drag={},this.pinch={},this.hammer=new l(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),u.onTouch(this.hammer,function(e){t._moveSelector(e)}),this.hammer.on("tap",function(e){t._moveSelector(e)}),this.hammer.on("panstart",function(e){t._moveSelector(e)}),this.hammer.on("panmove",function(e){t._moveSelector(e)}),this.hammer.on("panend",function(e){t._moveSelector(e)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var t=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)),t.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var e=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;t.clearRect(0,0,e,i);var o=void 0,n=void 0,s=void 0,r=void 0;this.centerCoordinates={x:.5*e,y:.5*i},this.r=.49*e;var a=2*Math.PI/360,h=1/360,d=1/this.r,l=void 0;for(s=0;s<360;s++)for(r=0;r<this.r;r++)o=this.centerCoordinates.x+r*Math.sin(a*s),n=this.centerCoordinates.y+r*Math.cos(a*s),l=c.HSVToRGB(s*h,r*d,1),t.fillStyle="rgb("+l.r+","+l.g+","+l.b+")",t.fillRect(o-.5,n-.5,2,2);t.strokeStyle="rgba(0,0,0,1)",t.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),t.stroke(),this.hueCircle=t.getImageData(0,0,e,i)}this.generated=!0}},{key:"_moveSelector",value:function(t){var e=this.colorPickerDiv.getBoundingClientRect(),i=t.center.x-e.left,o=t.center.y-e.top,n=.5*this.colorPickerDiv.clientHeight,s=.5*this.colorPickerDiv.clientWidth,r=i-s,a=o-n,h=Math.atan2(r,a),d=.98*Math.min(Math.sqrt(r*r+a*a),s),l=Math.cos(h)*d+n,u=Math.sin(h)*d+s;this.colorPickerSelector.style.top=l-.5*this.colorPickerSelector.clientHeight+"px",this.colorPickerSelector.style.left=u-.5*this.colorPickerSelector.clientWidth+"px";var p=h/(2*Math.PI);p=p<0?p+1:p;var f=d/this.r,m=c.RGBToHSV(this.color.r,this.color.g,this.color.b);m.h=p,m.s=f;var v=c.HSVToRGB(m.h,m.s,m.v);v.a=this.color.a,this.color=v,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}}]),t}();e.default=p},function(t,e,i){i(108);e.onTouch=function(t,e){e.inputHandler=function(t){t.isFirst&&e(t)},t.on("hammer.input",e.inputHandler)},e.onRelease=function(t,e){return e.inputHandler=function(t){t.isFinal&&e(t)},t.on("hammer.input",e.inputHandler)},e.offTouch=function(t,e){t.off("hammer.input",e.inputHandler)},e.offRelease=e.offTouch,e.disablePreventDefaultVertically=function(t){var e="pan-y";return t.getTouchAction=function(){return[e]},t}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.printStyle=void 0;var n=i(82),s=o(n),r=i(62),a=o(r),h=i(58),d=o(h),l=i(115),u=o(l),c=i(116),p=o(c),f=i(1),m=!1,v=void 0,g="background: #FFeeee; color: #dd0000",y=function(){function t(){(0,u.default)(this,t)}return(0,p.default)(t,null,[{key:"validate",value:function(e,i,o){m=!1,v=i;var n=i;return void 0!==o&&(n=i[o]),t.parse(e,n,[]),m}},{key:"parse",value:function(e,i,o){for(var n in e)e.hasOwnProperty(n)&&t.check(n,e,i,o)}},{key:"check",value:function(e,i,o,n){void 0===o[e]&&void 0===o.__any__?t.getSuggestion(e,o,n):void 0===o[e]&&void 0!==o.__any__?"object"===t.getType(i[e])&&void 0!==o.__any__.__type__?t.checkFields(e,i,o,"__any__",o.__any__.__type__,n):t.checkFields(e,i,o,"__any__",o.__any__,n):void 0!==o[e].__type__?t.checkFields(e,i,o,e,o[e].__type__,n):t.checkFields(e,i,o,e,o[e],n)}},{key:"checkFields",value:function(e,i,o,n,s,r){var a=t.getType(i[e]),h=s[a];void 0!==h?"array"===t.getType(h)&&h.indexOf(i[e])===-1?(console.log('%cInvalid option detected in "'+e+'". Allowed values are:'+t.print(h)+' not "'+i[e]+'". '+t.printLocation(r,e),g),m=!0):"object"===a&&"__any__"!==n&&(r=f.copyAndExtendArray(r,e),t.parse(i[e],o[n],r)):void 0===s.any&&(console.log('%cInvalid type received for "'+e+'". Expected: '+t.print((0,d.default)(s))+". Received ["+a+'] "'+i[e]+'"'+t.printLocation(r,e),g),m=!0)}},{key:"getType",value:function(t){var e="undefined"==typeof t?"undefined":(0,a.default)(t);return"object"===e?null===t?"null":t instanceof Boolean?"boolean":t instanceof Number?"number":t instanceof String?"string":Array.isArray(t)?"array":t instanceof Date?"date":void 0!==t.nodeType?"dom":t._isAMomentObject===!0?"moment":"object":"number"===e?"number":"boolean"===e?"boolean":"string"===e?"string":void 0===e?"undefined":e}},{key:"getSuggestion",value:function(e,i,o){var n=t.findInOptions(e,i,o,!1),s=t.findInOptions(e,v,[],!0),r=8,a=4;void 0!==n.indexMatch?console.log('%cUnknown option detected: "'+e+'" in '+t.printLocation(n.path,e,"")+'Perhaps it was incomplete? Did you mean: "'+n.indexMatch+'"?\n\n',g):s.distance<=a&&n.distance>s.distance?console.log('%cUnknown option detected: "'+e+'" in '+t.printLocation(n.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+t.printLocation(s.path,s.closestMatch,""),g):n.distance<=r?console.log('%cUnknown option detected: "'+e+'". Did you mean "'+n.closestMatch+'"?'+t.printLocation(n.path,e),g):console.log('%cUnknown option detected: "'+e+'". Did you mean one of these: '+t.print((0,d.default)(i))+t.printLocation(o,e),g),m=!0}},{key:"findInOptions",value:function(e,i,o){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=1e9,r="",a=[],h=e.toLowerCase(),d=void 0;for(var l in i){var u=void 0;if(void 0!==i[l].__type__&&n===!0){var c=t.findInOptions(e,i[l],f.copyAndExtendArray(o,l));s>c.distance&&(r=c.closestMatch,a=c.path,s=c.distance,d=c.indexMatch)}else l.toLowerCase().indexOf(h)!==-1&&(d=l),u=t.levenshteinDistance(e,l),s>u&&(r=l,a=f.copyArray(o),s=u)}return{closestMatch:r,path:a,distance:s,indexMatch:d}}},{key:"printLocation",value:function(t,e){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",o="\n\n"+i+"options = {\n",n=0;n<t.length;n++){for(var s=0;s<n+1;s++)o+=" ";o+=t[n]+": {\n"}for(var r=0;r<t.length+1;r++)o+=" ";o+=e+"\n";for(var a=0;a<t.length+1;a++){for(var h=0;h<t.length-a;h++)o+=" ";o+="}\n"}return o+"\n\n"}},{key:"print",value:function(t){return(0,s.default)(t).replace(/(\")|(\[)|(\])|(,"__type__")/g,"").replace(/(\,)/g,", ")}},{key:"levenshteinDistance",value:function(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;var i,o=[];for(i=0;i<=e.length;i++)o[i]=[i];var n;for(n=0;n<=t.length;n++)o[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)==t.charAt(n-1)?o[i][n]=o[i-1][n-1]:o[i][n]=Math.min(o[i-1][n-1]+1,Math.min(o[i][n-1]+1,o[i-1][n]+1));return o[e.length][t.length]}}]),t}();e.default=y,e.printStyle=g},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){var i=p().hours(0).minutes(0).seconds(0).milliseconds(0),o=i.clone().add(-3,"days").valueOf(),n=i.clone().add(-3,"days").valueOf();void 0===e?(this.start=o,this.end=n):(this.start=e.start||o,this.end=e.end||n),this.rolling=!1,this.body=t,this.deltaDifference=0,this.scaleOffset=0,this.startToFront=!1,this.endToFront=!0,this.defaultOptions={rtl:!1,start:null,end:null,moment:p,direction:"horizontal",moveable:!0,zoomable:!0,min:null,max:null,zoomMin:10,zoomMax:31536e10},this.options=c.extend({},this.defaultOptions),this.props={touch:{}},this.animationTimer=null,this.body.emitter.on("panstart",this._onDragStart.bind(this)),this.body.emitter.on("panmove",this._onDrag.bind(this)),this.body.emitter.on("panend",this._onDragEnd.bind(this)),this.body.emitter.on("mousewheel",this._onMouseWheel.bind(this)),this.body.emitter.on("touch",this._onTouch.bind(this)),this.body.emitter.on("pinch",this._onPinch.bind(this)),this.body.dom.rollingModeBtn.addEventListener("click",this.startRolling.bind(this)),this.setOptions(e)}function s(t){if("horizontal"!=t&&"vertical"!=t)throw new TypeError('Unknown direction "'+t+'". Choose "horizontal" or "vertical".')}var r=i(58),a=o(r),h=i(82),d=o(h),l=i(62),u=o(l),c=i(1),p=(i(121),i(84)),f=i(124),m=i(125);n.prototype=new f,n.prototype.setOptions=function(t){if(t){var e=["animation","direction","min","max","zoomMin","zoomMax","moveable","zoomable","moment","activate","hiddenDates","zoomKey","rtl","showCurrentTime","rollMode","horizontalScroll"];c.selectiveExtend(e,this.options,t),t.rollingMode&&this.startRolling(),("start"in t||"end"in t)&&this.setRange(t.start,t.end)}},n.prototype.startRolling=function(){function t(){e.stopRolling(),e.rolling=!0;var i=e.end-e.start,o=c.convert(new Date,"Date").valueOf(),n=o-i/2,s=o+i/2;!e.options||void 0===e.options.animation||e.options.animation;e.setRange(n,s,!1);var r=e.conversion(e.body.domProps.center.width).scale,i=1/r/10;i<30&&(i=30),i>1e3&&(i=1e3),e.body.dom.rollingModeBtn.style.visibility="hidden",e.currentTimeTimer=setTimeout(t,i)}var e=this;t()},n.prototype.stopRolling=function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),this.rolling=!1,this.body.dom.rollingModeBtn.style.visibility="visible")},n.prototype.setRange=function(t,e,i,o,n){o!==!0&&(o=!1);var s=void 0!=t?c.convert(t,"Date").valueOf():null,r=void 0!=e?c.convert(e,"Date").valueOf():null;if(this._cancelAnimation(),i){var h=this,l=this.start,p=this.end,f="object"===("undefined"==typeof i?"undefined":(0,u.default)(i))&&"duration"in i?i.duration:500,v="object"===("undefined"==typeof i?"undefined":(0,u.default)(i))&&"easingFunction"in i?i.easingFunction:"easeInOutQuad",g=c.easingFunctions[v];if(!g)throw new Error("Unknown easing function "+(0,d.default)(v)+". Choose from: "+(0,a.default)(c.easingFunctions).join(", "));var y=(new Date).valueOf(),b=!1,_=function t(){if(!h.props.touch.dragging){var e=(new Date).valueOf(),i=e-y,a=g(i/f),d=i>f,u=d||null===s?s:l+(s-l)*a,v=d||null===r?r:p+(r-p)*a;w=h._applyRange(u,v),m.updateHiddenDates(h.options.moment,h.body,h.options.hiddenDates),b=b||w;var _={start:new Date(h.start),end:new Date(h.end),byUser:o,event:c.elementsCensor(n)};w&&h.body.emitter.emit("rangechange",_),d?b&&h.body.emitter.emit("rangechanged",_):h.animationTimer=setTimeout(t,20)}};return _()}var w=this._applyRange(s,r);if(m.updateHiddenDates(this.options.moment,this.body,this.options.hiddenDates),w){var x={start:new Date(this.start),end:new Date(this.end),byUser:o,event:c.elementsCensor(n)};this.body.emitter.emit("rangechange",x),this.body.emitter.emit("rangechanged",x)}},n.prototype._cancelAnimation=function(){this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=null)},n.prototype._applyRange=function(t,e){var i,o=null!=t?c.convert(t,"Date").valueOf():this.start,n=null!=e?c.convert(e,"Date").valueOf():this.end,s=null!=this.options.max?c.convert(this.options.max,"Date").valueOf():null,r=null!=this.options.min?c.convert(this.options.min,"Date").valueOf():null;if(isNaN(o)||null===o)throw new Error('Invalid start "'+t+'"');if(isNaN(n)||null===n)throw new Error('Invalid end "'+e+'"');if(n<o&&(n=o),null!==r&&o<r&&(i=r-o,o+=i,n+=i,null!=s&&n>s&&(n=s)),null!==s&&n>s&&(i=n-s,o-=i,n-=i,null!=r&&o<r&&(o=r)),null!==this.options.zoomMin){var a=parseFloat(this.options.zoomMin);a<0&&(a=0),n-o<a&&(this.end-this.start===a&&o>this.start&&n<this.end?(o=this.start,n=this.end):(i=a-(n-o),o-=i/2,n+=i/2))}if(null!==this.options.zoomMax){var h=parseFloat(this.options.zoomMax);h<0&&(h=0),n-o>h&&(this.end-this.start===h&&o<this.start&&n>this.end?(o=this.start,n=this.end):(i=n-o-h,o+=i/2,n-=i/2))}var d=this.start!=o||this.end!=n;return o>=this.start&&o<=this.end||n>=this.start&&n<=this.end||this.start>=o&&this.start<=n||this.end>=o&&this.end<=n||this.body.emitter.emit("checkRangedItems"),this.start=o,this.end=n,d},n.prototype.getRange=function(){return{start:this.start,end:this.end}},n.prototype.conversion=function(t,e){return n.conversion(this.start,this.end,t,e)},n.conversion=function(t,e,i,o){return void 0===o&&(o=0),0!=i&&e-t!=0?{offset:t,scale:i/(e-t-o)}:{offset:0,scale:1}},n.prototype._onDragStart=function(t){this.deltaDifference=0,this.previousDelta=0,this.options.moveable&&this._isInsideRange(t)&&this.props.touch.allowDragging&&(this.stopRolling(),this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.dragging=!0,this.body.dom.root&&(this.body.dom.root.style.cursor="move"))},n.prototype._onDrag=function(t){if(t&&this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging){var e=this.options.direction;s(e);var i="horizontal"==e?t.deltaX:t.deltaY;i-=this.deltaDifference;var o=this.props.touch.end-this.props.touch.start,n=m.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end);o-=n;var r="horizontal"==e?this.body.domProps.center.width:this.body.domProps.center.height;if(this.options.rtl)var a=i/r*o;else var a=-i/r*o;var h=this.props.touch.start+a,d=this.props.touch.end+a,l=m.snapAwayFromHidden(this.body.hiddenDates,h,this.previousDelta-i,!0),u=m.snapAwayFromHidden(this.body.hiddenDates,d,this.previousDelta-i,!0);if(l!=h||u!=d)return this.deltaDifference+=i,this.props.touch.start=l,this.props.touch.end=u,void this._onDrag(t);this.previousDelta=i,this._applyRange(h,d);var p=new Date(this.start),f=new Date(this.end);this.body.emitter.emit("rangechange",{start:p,end:f,byUser:!0,event:c.elementsCensor(t)}),this.body.emitter.emit("panmove")}},n.prototype._onDragEnd=function(t){this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging&&(this.props.touch.dragging=!1,this.body.dom.root&&(this.body.dom.root.style.cursor="auto"),this.body.emitter.emit("rangechanged",{start:new Date(this.start),end:new Date(this.end),byUser:!0,event:c.elementsCensor(t)}))},n.prototype._onMouseWheel=function(t){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),this.options.zoomKey&&!t[this.options.zoomKey]&&this.options.zoomable||!this.options.zoomable&&this.options.moveable){if(this.options.horizontalScroll){t.preventDefault();var i=e*(this.end-this.start)/20,o=this.start-i,n=this.end-i;this.setRange(o,n,!1,!0,t)}}else if(this.options.zoomable&&this.options.moveable&&this._isInsideRange(t)&&e){var s;s=e<0?1-e/5:1/(1+e/5);var r;if(this.rolling)r=(this.start+this.end)/2;else{var a=this.getPointer({x:t.clientX,y:t.clientY},this.body.dom.center);r=this._pointerToDate(a)}this.zoom(s,r,e,t),t.preventDefault()}},n.prototype._onTouch=function(t){this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.allowDragging=!0,this.props.touch.center=null,this.scaleOffset=0,this.deltaDifference=0},n.prototype._onPinch=function(t){if(this.options.zoomable&&this.options.moveable){this.props.touch.allowDragging=!1,this.props.touch.center||(this.props.touch.center=this.getPointer(t.center,this.body.dom.center)),this.stopRolling();var e=1/(t.scale+this.scaleOffset),i=this._pointerToDate(this.props.touch.center),o=m.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end),n=m.getHiddenDurationBefore(this.options.moment,this.body.hiddenDates,this,i),s=o-n,r=i-n+(this.props.touch.start-(i-n))*e,a=i+s+(this.props.touch.end-(i+s))*e;this.startToFront=1-e<=0,this.endToFront=e-1<=0;var h=m.snapAwayFromHidden(this.body.hiddenDates,r,1-e,!0),d=m.snapAwayFromHidden(this.body.hiddenDates,a,e-1,!0);h==r&&d==a||(this.props.touch.start=h,this.props.touch.end=d,this.scaleOffset=1-t.scale,r=h,a=d),this.setRange(r,a,!1,!0,t),this.startToFront=!1,this.endToFront=!0}},n.prototype._isInsideRange=function(t){var e=t.center?t.center.x:t.clientX;if(this.options.rtl)var i=e-c.getAbsoluteLeft(this.body.dom.centerContainer);else var i=c.getAbsoluteRight(this.body.dom.centerContainer)-e;var o=this.body.util.toTime(i);return o>=this.start&&o<=this.end},n.prototype._pointerToDate=function(t){var e,i=this.options.direction;if(s(i),"horizontal"==i)return this.body.util.toTime(t.x).valueOf();var o=this.body.domProps.center.height;return e=this.conversion(o),t.y/e.scale+e.offset},n.prototype.getPointer=function(t,e){return this.options.rtl?{x:c.getAbsoluteRight(e)-t.x,y:t.y-c.getAbsoluteTop(e)}:{x:t.x-c.getAbsoluteLeft(e),y:t.y-c.getAbsoluteTop(e)}},n.prototype.zoom=function(t,e,i,o){null==e&&(e=(this.start+this.end)/2);var n=m.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end),s=m.getHiddenDurationBefore(this.options.moment,this.body.hiddenDates,this,e),r=n-s,a=e-s+(this.start-(e-s))*t,h=e+r+(this.end-(e+r))*t;this.startToFront=!(i>0),this.endToFront=!(-i>0);var d=m.snapAwayFromHidden(this.body.hiddenDates,a,i,!0),l=m.snapAwayFromHidden(this.body.hiddenDates,h,-i,!0);d==a&&l==h||(a=d,h=l),this.setRange(a,h,!1,!0,o),this.startToFront=!1,this.endToFront=!0},n.prototype.move=function(t){var e=this.end-this.start,i=this.start+e*t,o=this.end+e*t;this.start=i,this.end=o},n.prototype.moveTo=function(t){var e=(this.start+this.end)/2,i=e-t,o=this.start-i,n=this.end-i;this.setRange(o,n,!1,!0,event)},t.exports=n},function(t,e,i){function o(t,e){this.options=null,this.props=null}var n=i(1);o.prototype.setOptions=function(t){t&&n.extend(this.options,t)},o.prototype.redraw=function(){return!1},o.prototype.destroy=function(){},o.prototype._isResized=function(){var t=this.props._previousWidth!==this.props.width||this.props._previousHeight!==this.props.height;return this.props._previousWidth=this.props.width,this.props._previousHeight=this.props.height,t},t.exports=o},function(t,e){e.convertHiddenOptions=function(t,i,o){if(o&&!Array.isArray(o))return e.convertHiddenOptions(t,i,[o]);if(i.hiddenDates=[],o&&1==Array.isArray(o)){for(var n=0;n<o.length;n++)if(void 0===o[n].repeat){var s={};s.start=t(o[n].start).toDate().valueOf(),s.end=t(o[n].end).toDate().valueOf(),i.hiddenDates.push(s)}i.hiddenDates.sort(function(t,e){return t.start-e.start})}},e.updateHiddenDates=function(t,i,o){if(o&&!Array.isArray(o))return e.updateHiddenDates(t,i,[o]);if(o&&void 0!==i.domProps.centerContainer.width){e.convertHiddenOptions(t,i,o);for(var n=t(i.range.start),s=t(i.range.end),r=i.range.end-i.range.start,a=r/i.domProps.centerContainer.width,h=0;h<o.length;h++)if(void 0!==o[h].repeat){var d=t(o[h].start),l=t(o[h].end);if("Invalid Date"==d._d)throw new Error("Supplied start date is not valid: "+o[h].start);if("Invalid Date"==l._d)throw new Error("Supplied end date is not valid: "+o[h].end);var u=l-d;if(u>=4*a){var c=0,p=s.clone();switch(o[h].repeat){case"daily":d.day()!=l.day()&&(c=1),d.dayOfYear(n.dayOfYear()),d.year(n.year()),d.subtract(7,"days"),l.dayOfYear(n.dayOfYear()),l.year(n.year()),l.subtract(7-c,"days"),p.add(1,"weeks");break;case"weekly":var f=l.diff(d,"days"),m=d.day();d.date(n.date()),d.month(n.month()),d.year(n.year()),l=d.clone(),d.day(m),l.day(m),l.add(f,"days"),d.subtract(1,"weeks"),l.subtract(1,"weeks"),p.add(1,"weeks");break;case"monthly":d.month()!=l.month()&&(c=1),d.month(n.month()),d.year(n.year()),d.subtract(1,"months"),l.month(n.month()),l.year(n.year()),l.subtract(1,"months"),l.add(c,"months"),p.add(1,"months");break;case"yearly":d.year()!=l.year()&&(c=1),d.year(n.year()),d.subtract(1,"years"),l.year(n.year()),l.subtract(1,"years"),l.add(c,"years"),p.add(1,"years");break;default:return void console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:",o[h].repeat)}for(;d<p;)switch(i.hiddenDates.push({start:d.valueOf(),end:l.valueOf()}),o[h].repeat){case"daily":d.add(1,"days"),l.add(1,"days");break;case"weekly":d.add(1,"weeks"),l.add(1,"weeks");break;case"monthly":d.add(1,"months"),l.add(1,"months");break;case"yearly":d.add(1,"y"),l.add(1,"y");break;default:return void console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:",o[h].repeat)}i.hiddenDates.push({start:d.valueOf(),end:l.valueOf()})}}e.removeDuplicates(i);var v=e.isHidden(i.range.start,i.hiddenDates),g=e.isHidden(i.range.end,i.hiddenDates),y=i.range.start,b=i.range.end;1==v.hidden&&(y=1==i.range.startToFront?v.startDate-1:v.endDate+1),1==g.hidden&&(b=1==i.range.endToFront?g.startDate-1:g.endDate+1),1!=v.hidden&&1!=g.hidden||i.range._applyRange(y,b)}},e.removeDuplicates=function(t){for(var e=t.hiddenDates,i=[],o=0;o<e.length;o++)for(var n=0;n<e.length;n++)o!=n&&1!=e[n].remove&&1!=e[o].remove&&(e[n].start>=e[o].start&&e[n].end<=e[o].end?e[n].remove=!0:e[n].start>=e[o].start&&e[n].start<=e[o].end?(e[o].end=e[n].end,e[n].remove=!0):e[n].end>=e[o].start&&e[n].end<=e[o].end&&(e[o].start=e[n].start,e[n].remove=!0));for(var o=0;o<e.length;o++)e[o].remove!==!0&&i.push(e[o]);t.hiddenDates=i,t.hiddenDates.sort(function(t,e){return t.start-e.start})},e.printDates=function(t){for(var e=0;e<t.length;e++)console.log(e,new Date(t[e].start),new Date(t[e].end),t[e].start,t[e].end,t[e].remove)},e.stepOverHiddenDates=function(t,e,i){for(var o=!1,n=e.current.valueOf(),s=0;s<e.hiddenDates.length;s++){var r=e.hiddenDates[s].start,a=e.hiddenDates[s].end;if(n>=r&&n<a){o=!0;break}}if(1==o&&n<e._end.valueOf()&&n!=i){var h=t(i),d=t(a);h.year()!=d.year()?e.switchedYear=!0:h.month()!=d.month()?e.switchedMonth=!0:h.dayOfYear()!=d.dayOfYear()&&(e.switchedDay=!0),e.current=d}},e.toScreen=function(t,i,o){if(0==t.body.hiddenDates.length){var n=t.range.conversion(o);return(i.valueOf()-n.offset)*n.scale}var s=e.isHidden(i,t.body.hiddenDates);1==s.hidden&&(i=s.startDate);var r=e.getHiddenDurationBetween(t.body.hiddenDates,t.range.start,t.range.end);if(i<t.range.start){var n=t.range.conversion(o,r),a=e.getHiddenDurationBeforeStart(t.body.hiddenDates,i,n.offset);return i=t.options.moment(i).toDate().valueOf(),i+=a,-(n.offset-i.valueOf())*n.scale}if(i>t.range.end){var h={start:t.range.start,end:i};i=e.correctTimeForHidden(t.options.moment,t.body.hiddenDates,h,i);var n=t.range.conversion(o,r);return(i.valueOf()-n.offset)*n.scale}i=e.correctTimeForHidden(t.options.moment,t.body.hiddenDates,t.range,i);var n=t.range.conversion(o,r);return(i.valueOf()-n.offset)*n.scale},e.toTime=function(t,i,o){if(0==t.body.hiddenDates.length){var n=t.range.conversion(o);return new Date(i/n.scale+n.offset)}var s=e.getHiddenDurationBetween(t.body.hiddenDates,t.range.start,t.range.end),r=t.range.end-t.range.start-s,a=r*i/o,h=e.getAccumulatedHiddenDuration(t.body.hiddenDates,t.range,a),d=new Date(h+a+t.range.start);return d},e.getHiddenDurationBetween=function(t,e,i){for(var o=0,n=0;n<t.length;n++){var s=t[n].start,r=t[n].end;s>=e&&r<i&&(o+=r-s)}return o},e.getHiddenDurationBeforeStart=function(t,e,i){for(var o=0,n=0;n<t.length;n++){var s=t[n].start,r=t[n].end;s>=e&&r<=i&&(o+=r-s)}return o},e.correctTimeForHidden=function(t,i,o,n){return n=t(n).toDate().valueOf(),n-=e.getHiddenDurationBefore(t,i,o,n)},e.getHiddenDurationBefore=function(t,e,i,o){var n=0;o=t(o).toDate().valueOf();for(var s=0;s<e.length;s++){var r=e[s].start,a=e[s].end;r>=i.start&&a<i.end&&o>=a&&(n+=a-r)}return n},e.getAccumulatedHiddenDuration=function(t,e,i){for(var o=0,n=0,s=e.start,r=0;r<t.length;r++){var a=t[r].start,h=t[r].end;if(a>=e.start&&h<e.end){if(n+=a-s,s=h,n>=i)break;o+=h-a}}return o},e.snapAwayFromHidden=function(t,i,o,n){var s=e.isHidden(i,t);return 1==s.hidden?o<0?1==n?s.startDate-(s.endDate-i)-1:s.startDate-1:1==n?s.endDate+(i-s.startDate)+1:s.endDate+1:i},e.isHidden=function(t,e){for(var i=0;i<e.length;i++){var o=e[i].start,n=e[i].end;if(t>=o&&t<n)return{hidden:!0,startDate:o,endDate:n}}return{hidden:!1,startDate:o,endDate:n}}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(){}var s=i(82),r=o(s),a=i(62),h=o(a),d=i(95),l=i(108),u=i(121),c=i(1),p=(i(91),i(93),i(123),i(127),i(138)),f=i(139),m=i(125),v=i(140);d(n.prototype),n.prototype._create=function(t){function e(t){if(this.isActive()&&this.emit("mousewheel",t),this.options.verticalScroll&&!this.options.horizontalScroll&&this.options.zoomKey&&!t[this.options.zoomKey]){t.preventDefault();var e=0;t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3);var i=this.props.scrollTop,o=i+120*e;this.isActive()&&(this._setScrollTop(o),this._redraw(),this.emit("scroll",t))}}function i(t){if(s.options.verticalScroll&&(t.preventDefault(),s.isActive())){var e=-t.target.scrollTop;s._setScrollTop(e),s._redraw(),s.emit("scrollSide",t)}}function o(t){if(t.preventDefault&&t.preventDefault(),!(!t.target.className.indexOf("vis")>-1||h))return t.dataTransfer.dropEffect="move",h=!0,!1}function n(t){try{var e=JSON.parse(t.dataTransfer.getData("text"));if(!e.content)return}catch(t){return!1}return h=!1,t.center={x:t.clientX,y:t.clientY},s.itemSet._onAddItem(t),!1}this.dom={},this.dom.container=t,this.dom.root=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.backgroundVertical=document.createElement("div"),this.dom.backgroundHorizontal=document.createElement("div"),this.dom.centerContainer=document.createElement("div"),this.dom.leftContainer=document.createElement("div"),this.dom.rightContainer=document.createElement("div"),this.dom.center=document.createElement("div"),this.dom.left=document.createElement("div"),this.dom.right=document.createElement("div"),this.dom.top=document.createElement("div"),this.dom.bottom=document.createElement("div"),this.dom.shadowTop=document.createElement("div"),
+this.dom.shadowBottom=document.createElement("div"),this.dom.shadowTopLeft=document.createElement("div"),this.dom.shadowBottomLeft=document.createElement("div"),this.dom.shadowTopRight=document.createElement("div"),this.dom.shadowBottomRight=document.createElement("div"),this.dom.rollingModeBtn=document.createElement("div"),this.dom.root.className="vis-timeline",this.dom.background.className="vis-panel vis-background",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical",this.dom.backgroundHorizontal.className="vis-panel vis-background vis-horizontal",this.dom.centerContainer.className="vis-panel vis-center",this.dom.leftContainer.className="vis-panel vis-left",this.dom.rightContainer.className="vis-panel vis-right",this.dom.top.className="vis-panel vis-top",this.dom.bottom.className="vis-panel vis-bottom",this.dom.left.className="vis-content",this.dom.center.className="vis-content",this.dom.right.className="vis-content",this.dom.shadowTop.className="vis-shadow vis-top",this.dom.shadowBottom.className="vis-shadow vis-bottom",this.dom.shadowTopLeft.className="vis-shadow vis-top",this.dom.shadowBottomLeft.className="vis-shadow vis-bottom",this.dom.shadowTopRight.className="vis-shadow vis-top",this.dom.shadowBottomRight.className="vis-shadow vis-bottom",this.dom.rollingModeBtn.className="vis-rolling-mode-btn",this.dom.root.appendChild(this.dom.background),this.dom.root.appendChild(this.dom.backgroundVertical),this.dom.root.appendChild(this.dom.backgroundHorizontal),this.dom.root.appendChild(this.dom.centerContainer),this.dom.root.appendChild(this.dom.leftContainer),this.dom.root.appendChild(this.dom.rightContainer),this.dom.root.appendChild(this.dom.top),this.dom.root.appendChild(this.dom.bottom),this.dom.root.appendChild(this.dom.bottom),this.dom.root.appendChild(this.dom.rollingModeBtn),this.dom.centerContainer.appendChild(this.dom.center),this.dom.leftContainer.appendChild(this.dom.left),this.dom.rightContainer.appendChild(this.dom.right),this.dom.centerContainer.appendChild(this.dom.shadowTop),this.dom.centerContainer.appendChild(this.dom.shadowBottom),this.dom.leftContainer.appendChild(this.dom.shadowTopLeft),this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft),this.dom.rightContainer.appendChild(this.dom.shadowTopRight),this.dom.rightContainer.appendChild(this.dom.shadowBottomRight),this.props={root:{},background:{},centerContainer:{},leftContainer:{},rightContainer:{},center:{},left:{},right:{},top:{},bottom:{},border:{},scrollTop:0,scrollTopMin:0},this.on("rangechange",function(){this.initialDrawDone===!0&&this._redraw()}.bind(this)),this.on("touch",this._onTouch.bind(this)),this.on("panmove",this._onDrag.bind(this));var s=this;this._origRedraw=this._redraw.bind(this),this._redraw=c.throttle(this._origRedraw),this.on("_change",function(t){s.itemSet&&s.itemSet.initialItemSetDrawn&&t&&1==t.queue?s._redraw():s._origRedraw()}),this.hammer=new l(this.dom.root);var r=this.hammer.get("pinch").set({enable:!0});u.disablePreventDefaultVertically(r),this.hammer.get("pan").set({threshold:5,direction:l.DIRECTION_HORIZONTAL}),this.listeners={};var a=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];a.forEach(function(t){var e=function(e){s.isActive()&&s.emit(t,e)};s.hammer.on(t,e),s.listeners[t]=e}),u.onTouch(this.hammer,function(t){s.emit("touch",t)}.bind(this)),u.onRelease(this.hammer,function(t){s.emit("release",t)}.bind(this)),this.dom.centerContainer.addEventListener?(this.dom.centerContainer.addEventListener("mousewheel",e.bind(this),!1),this.dom.centerContainer.addEventListener("DOMMouseScroll",e.bind(this),!1)):this.dom.centerContainer.attachEvent("onmousewheel",e.bind(this)),this.dom.left.parentNode.addEventListener("scroll",i.bind(this)),this.dom.right.parentNode.addEventListener("scroll",i.bind(this));var h=!1;if(this.dom.center.addEventListener("dragover",o.bind(this),!1),this.dom.center.addEventListener("drop",n.bind(this),!1),this.customTimes=[],this.touch={},this.redrawCount=0,this.initialDrawDone=!1,!t)throw new Error("No container provided");t.appendChild(this.dom.root)},n.prototype.setOptions=function(t){if(t){var e=["width","height","minHeight","maxHeight","autoResize","start","end","clickToUse","dataAttributes","hiddenDates","locale","locales","moment","rtl","zoomKey","horizontalScroll","verticalScroll"];if(c.selectiveExtend(e,this.options,t),this.dom.rollingModeBtn.style.visibility="hidden",this.options.rtl&&(this.dom.container.style.direction="rtl",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical-rtl"),this.options.verticalScroll&&(this.options.rtl?this.dom.rightContainer.className="vis-panel vis-right vis-vertical-scroll":this.dom.leftContainer.className="vis-panel vis-left vis-vertical-scroll"),this.options.orientation={item:void 0,axis:void 0},"orientation"in t&&("string"==typeof t.orientation?this.options.orientation={item:t.orientation,axis:t.orientation}:"object"===(0,h.default)(t.orientation)&&("item"in t.orientation&&(this.options.orientation.item=t.orientation.item),"axis"in t.orientation&&(this.options.orientation.axis=t.orientation.axis))),"both"===this.options.orientation.axis){if(!this.timeAxis2){var i=this.timeAxis2=new p(this.body);i.setOptions=function(t){var e=t?c.extend({},t):{};e.orientation="top",p.prototype.setOptions.call(i,e)},this.components.push(i)}}else if(this.timeAxis2){var o=this.components.indexOf(this.timeAxis2);o!==-1&&this.components.splice(o,1),this.timeAxis2.destroy(),this.timeAxis2=null}if("function"==typeof t.drawPoints&&(t.drawPoints={onRender:t.drawPoints}),"hiddenDates"in this.options&&m.convertHiddenOptions(this.options.moment,this.body,this.options.hiddenDates),"clickToUse"in t&&(t.clickToUse?this.activator||(this.activator=new f(this.dom.root)):this.activator&&(this.activator.destroy(),delete this.activator)),"showCustomTime"in t)throw new Error("Option `showCustomTime` is deprecated. Create a custom time bar via timeline.addCustomTime(time [, id])");this._initAutoResize()}if(this.components.forEach(function(e){return e.setOptions(t)}),"configure"in t){this.configurator||(this.configurator=this._createConfigurator()),this.configurator.setOptions(t.configure);var n=c.deepExtend({},this.options);this.components.forEach(function(t){c.deepExtend(n,t.options)}),this.configurator.setModuleOptions({global:n})}this._redraw()},n.prototype.isActive=function(){return!this.activator||this.activator.active},n.prototype.destroy=function(){this.setItems(null),this.setGroups(null),this.off(),this._stopAutoResize(),this.dom.root.parentNode&&this.dom.root.parentNode.removeChild(this.dom.root),this.dom=null,this.activator&&(this.activator.destroy(),delete this.activator);for(var t in this.listeners)this.listeners.hasOwnProperty(t)&&delete this.listeners[t];this.listeners=null,this.hammer=null,this.components.forEach(function(t){return t.destroy()}),this.body=null},n.prototype.setCustomTime=function(t,e){var i=this.customTimes.filter(function(t){return e===t.options.id});if(0===i.length)throw new Error("No custom time bar found with id "+(0,r.default)(e));i.length>0&&i[0].setCustomTime(t)},n.prototype.getCustomTime=function(t){var e=this.customTimes.filter(function(e){return e.options.id===t});if(0===e.length)throw new Error("No custom time bar found with id "+(0,r.default)(t));return e[0].getCustomTime()},n.prototype.setCustomTimeTitle=function(t,e){var i=this.customTimes.filter(function(t){return t.options.id===e});if(0===i.length)throw new Error("No custom time bar found with id "+(0,r.default)(e));if(i.length>0)return i[0].setCustomTitle(t)},n.prototype.getEventProperties=function(t){return{event:t}},n.prototype.addCustomTime=function(t,e){var i=void 0!==t?c.convert(t,"Date").valueOf():new Date,o=this.customTimes.some(function(t){return t.options.id===e});if(o)throw new Error("A custom time with id "+(0,r.default)(e)+" already exists");var n=new v(this.body,c.extend({},this.options,{time:i,id:e}));return this.customTimes.push(n),this.components.push(n),this._redraw(),e},n.prototype.removeCustomTime=function(t){var e=this.customTimes.filter(function(e){return e.options.id===t});if(0===e.length)throw new Error("No custom time bar found with id "+(0,r.default)(t));e.forEach(function(t){this.customTimes.splice(this.customTimes.indexOf(t),1),this.components.splice(this.components.indexOf(t),1),t.destroy()}.bind(this))},n.prototype.getVisibleItems=function(){return this.itemSet&&this.itemSet.getVisibleItems()||[]},n.prototype.fit=function(t){var e=this.getDataRange();if(null!==e.min||null!==e.max){var i=e.max-e.min,o=new Date(e.min.valueOf()-.01*i),n=new Date(e.max.valueOf()+.01*i),s=!t||void 0===t.animation||t.animation;this.range.setRange(o,n,s)}},n.prototype.getDataRange=function(){throw new Error("Cannot invoke abstract method getDataRange")},n.prototype.setWindow=function(t,e,i){var o;if(1==arguments.length){var n=arguments[0];o=void 0===n.animation||n.animation,this.range.setRange(n.start,n.end,o)}else o=!i||void 0===i.animation||i.animation,this.range.setRange(t,e,o)},n.prototype.moveTo=function(t,e){var i=this.range.end-this.range.start,o=c.convert(t,"Date").valueOf(),n=o-i/2,s=o+i/2,r=!e||void 0===e.animation||e.animation;this.range.setRange(n,s,r)},n.prototype.getWindow=function(){var t=this.range.getRange();return{start:new Date(t.start),end:new Date(t.end)}},n.prototype.zoomIn=function(t){if(!(!t||t<0||t>1)){var e=this.getWindow(),i=e.start.valueOf(),o=e.end.valueOf(),n=o-i,s=n/(1+t),r=(n-s)/2,a=i+r,h=o-r;this.setWindow({start:a,end:h})}},n.prototype.zoomOut=function(t){if(!(!t||t<0||t>1)){var e=this.getWindow(),i=e.start.valueOf(),o=e.end.valueOf(),n=o-i,s=i-n*t/2,r=o+n*t/2;this.setWindow({start:s,end:r})}},n.prototype.redraw=function(){this._redraw()},n.prototype._redraw=function(){this.redrawCount++;var t=!1,e=this.options,i=this.props,o=this.dom;if(o&&o.container&&0!=o.root.offsetWidth){m.updateHiddenDates(this.options.moment,this.body,this.options.hiddenDates),"top"==e.orientation?(c.addClassName(o.root,"vis-top"),c.removeClassName(o.root,"vis-bottom")):(c.removeClassName(o.root,"vis-top"),c.addClassName(o.root,"vis-bottom")),o.root.style.maxHeight=c.option.asSize(e.maxHeight,""),o.root.style.minHeight=c.option.asSize(e.minHeight,""),o.root.style.width=c.option.asSize(e.width,""),i.border.left=(o.centerContainer.offsetWidth-o.centerContainer.clientWidth)/2,i.border.right=i.border.left,i.border.top=(o.centerContainer.offsetHeight-o.centerContainer.clientHeight)/2,i.border.bottom=i.border.top,i.borderRootHeight=o.root.offsetHeight-o.root.clientHeight,i.borderRootWidth=o.root.offsetWidth-o.root.clientWidth,0===o.centerContainer.clientHeight&&(i.border.left=i.border.top,i.border.right=i.border.left),0===o.root.clientHeight&&(i.borderRootWidth=i.borderRootHeight),i.center.height=o.center.offsetHeight,i.left.height=o.left.offsetHeight,i.right.height=o.right.offsetHeight,i.top.height=o.top.clientHeight||-i.border.top,i.bottom.height=o.bottom.clientHeight||-i.border.bottom;var n=Math.max(i.left.height,i.center.height,i.right.height),s=i.top.height+n+i.bottom.height+i.borderRootHeight+i.border.top+i.border.bottom;o.root.style.height=c.option.asSize(e.height,s+"px"),i.root.height=o.root.offsetHeight,i.background.height=i.root.height-i.borderRootHeight;var r=i.root.height-i.top.height-i.bottom.height-i.borderRootHeight;i.centerContainer.height=r,i.leftContainer.height=r,i.rightContainer.height=i.leftContainer.height,i.root.width=o.root.offsetWidth,i.background.width=i.root.width-i.borderRootWidth,this.initialDrawDone||(i.scrollbarWidth=c.getScrollBarWidth()),e.verticalScroll?e.rtl?(i.left.width=o.leftContainer.clientWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth+i.scrollbarWidth||-i.border.right):(i.left.width=o.leftContainer.clientWidth+i.scrollbarWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth||-i.border.right):(i.left.width=o.leftContainer.clientWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth||-i.border.right),this._setDOM();var a=this._updateScrollTop();"top"!=e.orientation.item&&(a+=Math.max(i.centerContainer.height-i.center.height-i.border.top-i.border.bottom,0)),o.center.style.top=a+"px";var h=0==i.scrollTop?"hidden":"",d=i.scrollTop==i.scrollTopMin?"hidden":"";o.shadowTop.style.visibility=h,o.shadowBottom.style.visibility=d,o.shadowTopLeft.style.visibility=h,o.shadowBottomLeft.style.visibility=d,o.shadowTopRight.style.visibility=h,o.shadowBottomRight.style.visibility=d,e.verticalScroll&&(o.rightContainer.className="vis-panel vis-right vis-vertical-scroll",o.leftContainer.className="vis-panel vis-left vis-vertical-scroll",o.shadowTopRight.style.visibility="hidden",o.shadowBottomRight.style.visibility="hidden",o.shadowTopLeft.style.visibility="hidden",o.shadowBottomLeft.style.visibility="hidden",o.left.style.top="0px",o.right.style.top="0px"),(!e.verticalScroll||i.center.height<i.centerContainer.height)&&(o.left.style.top=a+"px",o.right.style.top=a+"px",o.rightContainer.className=o.rightContainer.className.replace(new RegExp("(?:^|\\s)vis-vertical-scroll(?:\\s|$)")," "),o.leftContainer.className=o.leftContainer.className.replace(new RegExp("(?:^|\\s)vis-vertical-scroll(?:\\s|$)")," "),i.left.width=o.leftContainer.clientWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth||-i.border.right,this._setDOM());var u=i.center.height>i.centerContainer.height;this.hammer.get("pan").set({direction:u?l.DIRECTION_ALL:l.DIRECTION_HORIZONTAL}),this.components.forEach(function(e){t=e.redraw()||t});var p=5;if(t){if(this.redrawCount<p)return void this.body.emitter.emit("_change");console.log("WARNING: infinite loop in redraw?")}else this.redrawCount=0;this.initialDrawDone=!0,this.body.emitter.emit("changed")}},n.prototype._setDOM=function(){var t=this.props,e=this.dom;t.leftContainer.width=t.left.width,t.rightContainer.width=t.right.width;var i=t.root.width-t.left.width-t.right.width-t.borderRootWidth;t.center.width=i,t.centerContainer.width=i,t.top.width=i,t.bottom.width=i,e.background.style.height=t.background.height+"px",e.backgroundVertical.style.height=t.background.height+"px",e.backgroundHorizontal.style.height=t.centerContainer.height+"px",e.centerContainer.style.height=t.centerContainer.height+"px",e.leftContainer.style.height=t.leftContainer.height+"px",e.rightContainer.style.height=t.rightContainer.height+"px",e.background.style.width=t.background.width+"px",e.backgroundVertical.style.width=t.centerContainer.width+"px",e.backgroundHorizontal.style.width=t.background.width+"px",e.centerContainer.style.width=t.center.width+"px",e.top.style.width=t.top.width+"px",e.bottom.style.width=t.bottom.width+"px",e.background.style.left="0",e.background.style.top="0",e.backgroundVertical.style.left=t.left.width+t.border.left+"px",e.backgroundVertical.style.top="0",e.backgroundHorizontal.style.left="0",e.backgroundHorizontal.style.top=t.top.height+"px",e.centerContainer.style.left=t.left.width+"px",e.centerContainer.style.top=t.top.height+"px",e.leftContainer.style.left="0",e.leftContainer.style.top=t.top.height+"px",e.rightContainer.style.left=t.left.width+t.center.width+"px",e.rightContainer.style.top=t.top.height+"px",e.top.style.left=t.left.width+"px",e.top.style.top="0",e.bottom.style.left=t.left.width+"px",e.bottom.style.top=t.top.height+t.centerContainer.height+"px",e.center.style.left="0",e.left.style.left="0",e.right.style.left="0"},n.prototype.repaint=function(){throw new Error("Function repaint is deprecated. Use redraw instead.")},n.prototype.setCurrentTime=function(t){if(!this.currentTime)throw new Error("Option showCurrentTime must be true");this.currentTime.setCurrentTime(t)},n.prototype.getCurrentTime=function(){if(!this.currentTime)throw new Error("Option showCurrentTime must be true");return this.currentTime.getCurrentTime()},n.prototype._toTime=function(t){return m.toTime(this,t,this.props.center.width)},n.prototype._toGlobalTime=function(t){return m.toTime(this,t,this.props.root.width)},n.prototype._toScreen=function(t){return m.toScreen(this,t,this.props.center.width)},n.prototype._toGlobalScreen=function(t){return m.toScreen(this,t,this.props.root.width)},n.prototype._initAutoResize=function(){1==this.options.autoResize?this._startAutoResize():this._stopAutoResize()},n.prototype._startAutoResize=function(){var t=this;this._stopAutoResize(),this._onResize=function(){return 1!=t.options.autoResize?void t._stopAutoResize():void(t.dom.root&&(t.dom.root.offsetWidth==t.props.lastWidth&&t.dom.root.offsetHeight==t.props.lastHeight||(t.props.lastWidth=t.dom.root.offsetWidth,t.props.lastHeight=t.dom.root.offsetHeight,t.props.scrollbarWidth=c.getScrollBarWidth(),t.body.emitter.emit("_change"))))},c.addEventListener(window,"resize",this._onResize),t.dom.root&&(t.props.lastWidth=t.dom.root.offsetWidth,t.props.lastHeight=t.dom.root.offsetHeight),this.watchTimer=setInterval(this._onResize,1e3)},n.prototype._stopAutoResize=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0),this._onResize&&(c.removeEventListener(window,"resize",this._onResize),this._onResize=null)},n.prototype._onTouch=function(t){this.touch.allowDragging=!0,this.touch.initialScrollTop=this.props.scrollTop},n.prototype._onPinch=function(t){this.touch.allowDragging=!1},n.prototype._onDrag=function(t){if(t&&this.touch.allowDragging){var e=t.deltaY,i=this._getScrollTop(),o=this._setScrollTop(this.touch.initialScrollTop+e);this.options.verticalScroll&&(this.dom.left.parentNode.scrollTop=-this.props.scrollTop,this.dom.right.parentNode.scrollTop=-this.props.scrollTop),o!=i&&this.emit("verticalDrag")}},n.prototype._setScrollTop=function(t){return this.props.scrollTop=t,this._updateScrollTop(),this.props.scrollTop},n.prototype._updateScrollTop=function(){var t=Math.min(this.props.centerContainer.height-this.props.center.height,0);return t!=this.props.scrollTopMin&&("top"!=this.options.orientation.item&&(this.props.scrollTop+=t-this.props.scrollTopMin),this.props.scrollTopMin=t),this.props.scrollTop>0&&(this.props.scrollTop=0),this.props.scrollTop<t&&(this.props.scrollTop=t),this.options.verticalScroll&&(this.dom.left.parentNode.scrollTop=-this.props.scrollTop,this.dom.right.parentNode.scrollTop=-this.props.scrollTop),this.props.scrollTop},n.prototype._getScrollTop=function(){return this.props.scrollTop},n.prototype._createConfigurator=function(){throw new Error("Cannot invoke abstract method _createConfigurator")},t.exports=n},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){this.body=t,this.defaultOptions={type:null,orientation:{item:"bottom"},align:"auto",stack:!0,stackSubgroups:!0,groupOrderSwap:function(t,e,i){var o=e.order;e.order=t.order,t.order=o},groupOrder:"order",selectable:!0,multiselect:!1,itemsAlwaysDraggable:!1,editable:{updateTime:!1,updateGroup:!1,add:!1,remove:!1,overrideItems:!1},groupEditable:{order:!1,add:!1,remove:!1},snap:m.snap,onAdd:function(t,e){e(t)},onUpdate:function(t,e){e(t)},onMove:function(t,e){e(t)},onRemove:function(t,e){e(t)},onMoving:function(t,e){e(t)},onAddGroup:function(t,e){e(t)},onMoveGroup:function(t,e){e(t)},onRemoveGroup:function(t,e){e(t)},margin:{item:{horizontal:10,vertical:10},axis:20},tooltip:{followMouse:!1,overflowMethod:"flip"},tooltipOnItemUpdateTime:!1},this.options=c.extend({},this.defaultOptions),this.options.rtl=e.rtl,this.itemOptions={type:{start:"Date",end:"Date"}},this.conversion={toScreen:t.util.toScreen,toTime:t.util.toTime},this.dom={},this.props={},this.hammer=null;var i=this;this.itemsData=null,this.groupsData=null,this.itemListeners={add:function(t,e,o){i._onAdd(e.items)},update:function(t,e,o){i._onUpdate(e.items)},remove:function(t,e,o){i._onRemove(e.items)}},this.groupListeners={add:function(t,e,o){i._onAddGroups(e.items)},update:function(t,e,o){i._onUpdateGroups(e.items)},remove:function(t,e,o){i._onRemoveGroups(e.items)}},this.items={},this.groups={},this.groupIds=[],this.selection=[],this.stackDirty=!0,this.touchParams={},this.groupTouchParams={},this._create(),this.setOptions(e)}var s=i(55),r=o(s),a=i(62),h=o(a),d=i(128),l=o(d),u=i(108),c=i(1),p=i(91),f=i(93),m=i(129),v=i(124),g=i(130),y=i(134),b=i(135),_=i(136),w=i(132),x=i(137),k="__ungrouped__",O="__background__";n.prototype=new v,n.types={background:x,box:b,range:w,point:_},n.prototype._create=function(){var t=document.createElement("div");t.className="vis-itemset",t["timeline-itemset"]=this,this.dom.frame=t;var e=document.createElement("div");e.className="vis-background",t.appendChild(e),this.dom.background=e;var i=document.createElement("div");i.className="vis-foreground",t.appendChild(i),this.dom.foreground=i;var o=document.createElement("div");o.className="vis-axis",this.dom.axis=o;var n=document.createElement("div");n.className="vis-labelset",this.dom.labelSet=n,this._updateUngrouped();var s=new y(O,null,this);s.show(),this.groups[O]=s,this.hammer=new u(this.body.dom.centerContainer),this.hammer.on("hammer.input",function(t){t.isFirst&&this._onTouch(t)}.bind(this)),this.hammer.on("panstart",this._onDragStart.bind(this)),this.hammer.on("panmove",this._onDrag.bind(this)),this.hammer.on("panend",this._onDragEnd.bind(this)),this.hammer.get("pan").set({threshold:5,direction:u.DIRECTION_HORIZONTAL}),this.hammer.on("tap",this._onSelectItem.bind(this)),this.hammer.on("press",this._onMultiSelectItem.bind(this)),this.hammer.on("doubletap",this._onAddItem.bind(this)),this.options.rtl?this.groupHammer=new u(this.body.dom.rightContainer):this.groupHammer=new u(this.body.dom.leftContainer),this.groupHammer.on("tap",this._onGroupClick.bind(this)),this.groupHammer.on("panstart",this._onGroupDragStart.bind(this)),this.groupHammer.on("panmove",this._onGroupDrag.bind(this)),this.groupHammer.on("panend",this._onGroupDragEnd.bind(this)),this.groupHammer.get("pan").set({threshold:5,direction:u.DIRECTION_VERTICAL}),this.body.dom.centerContainer.addEventListener("mouseover",this._onMouseOver.bind(this)),this.body.dom.centerContainer.addEventListener("mouseout",this._onMouseOut.bind(this)),this.body.dom.centerContainer.addEventListener("mousemove",this._onMouseMove.bind(this)),this.body.dom.centerContainer.addEventListener("contextmenu",this._onDragEnd.bind(this)),this.show()},n.prototype.setOptions=function(t){if(t){var e=["type","rtl","align","order","stack","stackSubgroups","selectable","multiselect","itemsAlwaysDraggable","multiselectPerGroup","groupOrder","dataAttributes","template","groupTemplate","visibleFrameTemplate","hide","snap","groupOrderSwap","tooltip","tooltipOnItemUpdateTime"];c.selectiveExtend(e,this.options,t),"orientation"in t&&("string"==typeof t.orientation?this.options.orientation.item="top"===t.orientation?"top":"bottom":"object"===(0,h.default)(t.orientation)&&"item"in t.orientation&&(this.options.orientation.item=t.orientation.item)),"margin"in t&&("number"==typeof t.margin?(this.options.margin.axis=t.margin,this.options.margin.item.horizontal=t.margin,this.options.margin.item.vertical=t.margin):"object"===(0,h.default)(t.margin)&&(c.selectiveExtend(["axis"],this.options.margin,t.margin),"item"in t.margin&&("number"==typeof t.margin.item?(this.options.margin.item.horizontal=t.margin.item,this.options.margin.item.vertical=t.margin.item):"object"===(0,h.default)(t.margin.item)&&c.selectiveExtend(["horizontal","vertical"],this.options.margin.item,t.margin.item)))),"editable"in t&&("boolean"==typeof t.editable?(this.options.editable.updateTime=t.editable,this.options.editable.updateGroup=t.editable,this.options.editable.add=t.editable,this.options.editable.remove=t.editable,this.options.editable.overrideItems=!1):"object"===(0,h.default)(t.editable)&&c.selectiveExtend(["updateTime","updateGroup","add","remove","overrideItems"],this.options.editable,t.editable)),"groupEditable"in t&&("boolean"==typeof t.groupEditable?(this.options.groupEditable.order=t.groupEditable,this.options.groupEditable.add=t.groupEditable,this.options.groupEditable.remove=t.groupEditable):"object"===(0,h.default)(t.groupEditable)&&c.selectiveExtend(["order","add","remove"],this.options.groupEditable,t.groupEditable));var i=function(e){var i=t[e];if(i){if(!(i instanceof Function))throw new Error("option "+e+" must be a function "+e+"(item, callback)");this.options[e]=i}}.bind(this);["onAdd","onUpdate","onRemove","onMove","onMoving","onAddGroup","onMoveGroup","onRemoveGroup"].forEach(i),this.markDirty()}},n.prototype.markDirty=function(t){this.groupIds=[],this.stackDirty=!0,t&&t.refreshItems&&c.forEach(this.items,function(t){t.dirty=!0,t.displayed&&t.redraw()})},n.prototype.destroy=function(){this.hide(),this.setItems(null),this.setGroups(null),this.hammer=null,this.body=null,this.conversion=null},n.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame),this.dom.axis.parentNode&&this.dom.axis.parentNode.removeChild(this.dom.axis),this.dom.labelSet.parentNode&&this.dom.labelSet.parentNode.removeChild(this.dom.labelSet)},n.prototype.show=function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame),this.dom.axis.parentNode||this.body.dom.backgroundVertical.appendChild(this.dom.axis),this.dom.labelSet.parentNode||(this.options.rtl?this.body.dom.right.appendChild(this.dom.labelSet):this.body.dom.left.appendChild(this.dom.labelSet))},n.prototype.setSelection=function(t){var e,i,o,n;for(void 0==t&&(t=[]),Array.isArray(t)||(t=[t]),e=0,i=this.selection.length;e<i;e++)o=this.selection[e],n=this.items[o],n&&n.unselect();for(this.selection=[],e=0,i=t.length;e<i;e++)o=t[e],n=this.items[o],n&&(this.selection.push(o),n.select())},n.prototype.getSelection=function(){return this.selection.concat([])},n.prototype.getVisibleItems=function(){var t=this.body.range.getRange();if(this.options.rtl)var e=this.body.util.toScreen(t.start),i=this.body.util.toScreen(t.end);else var i=this.body.util.toScreen(t.start),e=this.body.util.toScreen(t.end);var o=[];for(var n in this.groups)if(this.groups.hasOwnProperty(n))for(var s=this.groups[n],r=s.visibleItems,a=0;a<r.length;a++){var h=r[a];this.options.rtl?h.right<i&&h.right+h.width>e&&o.push(h.id):h.left<e&&h.left+h.width>i&&o.push(h.id)}return o},n.prototype._deselect=function(t){for(var e=this.selection,i=0,o=e.length;i<o;i++)if(e[i]==t){e.splice(i,1);break}},n.prototype.redraw=function(){var t=this.options.margin,e=this.body.range,i=c.option.asSize,o=this.options,n=o.orientation.item,s=!1,r=this.dom.frame;this.props.top=this.body.domProps.top.height+this.body.domProps.border.top,this.options.rtl?this.props.right=this.body.domProps.right.width+this.body.domProps.border.right:this.props.left=this.body.domProps.left.width+this.body.domProps.border.left,r.className="vis-itemset",s=this._orderGroups()||s;var a=e.end-e.start,h=a!=this.lastVisibleInterval||this.props.width!=this.props.lastWidth;h&&(this.stackDirty=!0),this.lastVisibleInterval=a,this.props.lastWidth=this.props.width;var d=this.stackDirty,l=this._firstGroup(),u={item:t.item,axis:t.axis},p={item:t.item,axis:t.item.vertical/2},f=0,m=t.axis+t.item.vertical;return this.groups[O].redraw(e,p,d),c.forEach(this.groups,function(t){var i=t==l?u:p,o=t.redraw(e,i,d);s=o||s,f+=t.height}),f=Math.max(f,m),this.stackDirty=!1,r.style.height=i(f),this.props.width=r.offsetWidth,this.props.height=f,this.dom.axis.style.top=i("top"==n?this.body.domProps.top.height+this.body.domProps.border.top:this.body.domProps.top.height+this.body.domProps.centerContainer.height),this.options.rtl?this.dom.axis.style.right="0":this.dom.axis.style.left="0",this.initialItemSetDrawn=!0,s=this._isResized()||s},n.prototype._firstGroup=function(){var t="top"==this.options.orientation.item?0:this.groupIds.length-1,e=this.groupIds[t],i=this.groups[e]||this.groups[k];return i||null},n.prototype._updateUngrouped=function(){var t,e,i=this.groups[k];this.groups[O];if(this.groupsData){if(i){i.hide(),delete this.groups[k];for(e in this.items)if(this.items.hasOwnProperty(e)){t=this.items[e],t.parent&&t.parent.remove(t);var o=this._getGroupId(t.data),n=this.groups[o];n&&n.add(t)||t.hide()}}}else if(!i){var s=null,r=null;i=new g(s,r,this),this.groups[k]=i;for(e in this.items)this.items.hasOwnProperty(e)&&(t=this.items[e],i.add(t));i.show()}},n.prototype.getLabelSet=function(){return this.dom.labelSet},n.prototype.setItems=function(t){var e,i=this,o=this.itemsData;if(t){if(!(t instanceof p||t instanceof f))throw new TypeError("Data must be an instance of DataSet or DataView");this.itemsData=t}else this.itemsData=null;if(o&&(c.forEach(this.itemListeners,function(t,e){o.off(e,t)}),e=o.getIds(),this._onRemove(e)),this.itemsData){var n=this.id;c.forEach(this.itemListeners,function(t,e){i.itemsData.on(e,t,n)}),e=this.itemsData.getIds(),this._onAdd(e),this._updateUngrouped()}this.body.emitter.emit("_change",{queue:!0})},n.prototype.getItems=function(){return this.itemsData},n.prototype.setGroups=function(t){var e,i=this;if(this.groupsData&&(c.forEach(this.groupListeners,function(t,e){i.groupsData.off(e,t)}),e=this.groupsData.getIds(),this.groupsData=null,this._onRemoveGroups(e)),t){if(!(t instanceof p||t instanceof f))throw new TypeError("Data must be an instance of DataSet or DataView");this.groupsData=t}else this.groupsData=null;if(this.groupsData){var o=this.groupsData;this.groupsData instanceof f&&(o=this.groupsData.getDataSet()),o.get().forEach(function(t){t.nestedGroups&&t.nestedGroups.forEach(function(e){var i=o.get(e);i.nestedInGroup=t.id,0==t.showNested&&(i.visible=!1),o.update(i)})});var n=this.id;c.forEach(this.groupListeners,function(t,e){i.groupsData.on(e,t,n)}),e=this.groupsData.getIds(),this._onAddGroups(e)}this._updateUngrouped(),this._order(),this.body.emitter.emit("_change",{queue:!0})},n.prototype.getGroups=function(){return this.groupsData},n.prototype.removeItem=function(t){var e=this.itemsData.get(t),i=this.itemsData.getDataSet(),o=this.items[t];e&&this.options.onRemove(e,function(e){e&&(i.remove(t),o.popup&&(o.popup.destroy(),o.popup=null))})},n.prototype._getType=function(t){return t.type||this.options.type||(t.end?"range":"box")},n.prototype._getGroupId=function(t){var e=this._getType(t);return"background"==e&&void 0==t.group?O:this.groupsData?t.group:k},n.prototype._onUpdate=function(t){var e=this;t.forEach(function(t){var i,o=e.itemsData.get(t,e.itemOptions),s=e.items[t],r=o?e._getType(o):null,a=n.types[r];if(s&&(a&&s instanceof a?e._updateItem(s,o):(i=s.selected,e._removeItem(s),s=null)),!s&&o){if(!a)throw"rangeoverflow"==r?new TypeError('Item type "rangeoverflow" is deprecated. Use css styling instead: .vis-item.vis-range .vis-item-content {overflow: visible;}'):new TypeError('Unknown item type "'+r+'"');s=new a(o,e.conversion,e.options),s.id=t,e._addItem(s),i&&(this.selection.push(t),s.select())}}.bind(this)),this._order(),this.stackDirty=!0,this.body.emitter.emit("_change",{queue:!0})},n.prototype._onAdd=n.prototype._onUpdate,n.prototype._onRemove=function(t){var e=0,i=this;t.forEach(function(t){var o=i.items[t];o&&(e++,i._removeItem(o))}),e&&(this._order(),this.stackDirty=!0,this.body.emitter.emit("_change",{queue:!0}))},n.prototype._order=function(){c.forEach(this.groups,function(t){t.order()})},n.prototype._onUpdateGroups=function(t){this._onAddGroups(t)},n.prototype._onAddGroups=function(t){var e=this;t.forEach(function(t){var i=e.groupsData.get(t),o=e.groups[t];if(o)o.setData(i);else{if(t==k||t==O)throw new Error("Illegal group id. "+t+" is a reserved id.");var n=(0,r.default)(e.options);c.extend(n,{height:null}),o=new g(t,i,e),e.groups[t]=o;for(var s in e.items)if(e.items.hasOwnProperty(s)){var a=e.items[s];a.data.group==t&&o.add(a)}o.order(),o.show()}}),this.body.emitter.emit("_change",{queue:!0})},n.prototype._onRemoveGroups=function(t){var e=this.groups;t.forEach(function(t){var i=e[t];i&&(i.hide(),delete e[t])}),this.markDirty(),this.body.emitter.emit("_change",{queue:!0})},n.prototype._orderGroups=function(){if(this.groupsData){var t=this.groupsData.getIds({order:this.options.groupOrder});t=this._orderNestedGroups(t);var e=!c.equalArray(t,this.groupIds);
+if(e){var i=this.groups;t.forEach(function(t){i[t].hide()}),t.forEach(function(t){i[t].show()}),this.groupIds=t}return e}return!1},n.prototype._orderNestedGroups=function(t){var e=[];return t.forEach(function(t){var i=this.groupsData.get(t);if(i.nestedInGroup||e.push(t),i.nestedGroups){var o=this.groupsData.get({filter:function(e){return e.nestedInGroup==t}}),n=o.map(function(t){return t.id});e=e.concat(n)}},this),e},n.prototype._addItem=function(t){this.items[t.id]=t;var e=this._getGroupId(t.data),i=this.groups[e];i?i&&i.data&&i.data.showNested&&(t.groupShowing=!0):t.groupShowing=!1,i&&i.add(t)},n.prototype._updateItem=function(t,e){var i=t.data.group,o=t.data.subgroup;t.setData(e);var n=this._getGroupId(t.data),s=this.groups[n];if(s?s&&s.data&&s.data.showNested&&(t.groupShowing=!0):t.groupShowing=!1,i!=t.data.group||o!=t.data.subgroup){var r=this.groups[i];r&&r.remove(t),s&&s.add(t)}},n.prototype._removeItem=function(t){t.hide(),delete this.items[t.id];var e=this.selection.indexOf(t.id);e!=-1&&this.selection.splice(e,1),t.parent&&t.parent.remove(t)},n.prototype._constructByEndArray=function(t){for(var e=[],i=0;i<t.length;i++)t[i]instanceof w&&e.push(t[i]);return e},n.prototype._onTouch=function(t){this.touchParams.item=this.itemFromTarget(t),this.touchParams.dragLeftItem=t.target.dragLeftItem||!1,this.touchParams.dragRightItem=t.target.dragRightItem||!1,this.touchParams.itemProps=null},n.prototype._getGroupIndex=function(t){for(var e=0;e<this.groupIds.length;e++)if(t==this.groupIds[e])return e},n.prototype._onDragStart=function(t){if(!this.touchParams.itemIsDragging){var e,i=this.touchParams.item||null,o=this;if(i&&(i.selected||this.options.itemsAlwaysDraggable)){if(this.options.editable.overrideItems&&!this.options.editable.updateTime&&!this.options.editable.updateGroup)return;if(null!=i.editable&&!i.editable.updateTime&&!i.editable.updateGroup&&!this.options.editable.overrideItems)return;var n=this.touchParams.dragLeftItem,s=this.touchParams.dragRightItem;if(this.touchParams.itemIsDragging=!0,this.touchParams.selectedItem=i,n)e={item:n,initialX:t.center.x,dragLeft:!0,data:this._cloneItemData(i.data)},this.touchParams.itemProps=[e];else if(s)e={item:s,initialX:t.center.x,dragRight:!0,data:this._cloneItemData(i.data)},this.touchParams.itemProps=[e];else{var r=this._getGroupIndex(i.data.group),a=this.options.itemsAlwaysDraggable&&!i.selected?[i.id]:this.getSelection();this.touchParams.itemProps=a.map(function(e){var i=o.items[e],n=o._getGroupIndex(i.data.group);return{item:i,initialX:t.center.x,groupOffset:r-n,data:this._cloneItemData(i.data)}}.bind(this))}t.stopPropagation()}else this.options.editable.add&&(t.srcEvent.ctrlKey||t.srcEvent.metaKey)&&this._onDragStartAddItem(t)}},n.prototype._onDragStartAddItem=function(t){var e=this.options.snap||null;if(this.options.rtl)var i=c.getAbsoluteRight(this.dom.frame),o=i-t.center.x+10;else var i=c.getAbsoluteLeft(this.dom.frame),o=t.center.x-i-10;var n=this.body.util.toTime(o),s=this.body.util.getScale(),r=this.body.util.getStep(),a=e?e(n,s,r):n,h=a,d={type:"range",start:a,end:h,content:"new item"},l=c.randomUUID();d[this.itemsData._fieldId]=l;var u=this.groupFromTarget(t);u&&(d.group=u.groupId);var p=new w(d,this.conversion,this.options);p.id=l,p.data=this._cloneItemData(d),this._addItem(p),this.touchParams.selectedItem=p;var f={item:p,initialX:t.center.x,data:p.data};this.options.rtl?f.dragLeft=!0:f.dragRight=!0,this.touchParams.itemProps=[f],t.stopPropagation()},n.prototype._onDrag=function(t){if(this.touchParams.itemProps){t.stopPropagation();var e=this,i=this.options.snap||null;if(this.options.rtl)var o=this.body.dom.root.offsetLeft+this.body.domProps.right.width;else var o=this.body.dom.root.offsetLeft+this.body.domProps.left.width;var n=this.body.util.getScale(),s=this.body.util.getStep(),r=this.touchParams.selectedItem,a=(this.options.editable.overrideItems||null==r.editable)&&this.options.editable.updateGroup||!this.options.editable.overrideItems&&null!=r.editable&&r.editable.updateGroup,h=null;if(a&&r&&void 0!=r.data.group){var d=e.groupFromTarget(t);d&&(h=this._getGroupIndex(d.groupId))}this.touchParams.itemProps.forEach(function(d){var l=e.body.util.toTime(t.center.x-o),u=e.body.util.toTime(d.initialX-o);if(this.options.rtl)var p=-(l-u);else var p=l-u;var f=this._cloneItemData(d.item.data);if(null==d.item.editable||d.item.editable.updateTime||d.item.editable.updateGroup||e.options.editable.overrideItems){var m=(this.options.editable.overrideItems||null==r.editable)&&this.options.editable.updateTime||!this.options.editable.overrideItems&&null!=r.editable&&r.editable.updateTime;if(m)if(d.dragLeft){if(this.options.rtl){if(void 0!=f.end){var v=c.convert(d.data.end,"Date"),g=new Date(v.valueOf()+p);f.end=i?i(g,n,s):g}}else if(void 0!=f.start){var y=c.convert(d.data.start,"Date"),b=new Date(y.valueOf()+p);f.start=i?i(b,n,s):b}}else if(d.dragRight){if(this.options.rtl){if(void 0!=f.start){var y=c.convert(d.data.start,"Date"),b=new Date(y.valueOf()+p);f.start=i?i(b,n,s):b}}else if(void 0!=f.end){var v=c.convert(d.data.end,"Date"),g=new Date(v.valueOf()+p);f.end=i?i(g,n,s):g}}else if(void 0!=f.start){var y=c.convert(d.data.start,"Date").valueOf(),b=new Date(y+p);if(void 0!=f.end){var v=c.convert(d.data.end,"Date"),_=v.valueOf()-y.valueOf();f.start=i?i(b,n,s):b,f.end=new Date(f.start.valueOf()+_)}else f.start=i?i(b,n,s):b}if(a&&!d.dragLeft&&!d.dragRight&&null!=h&&void 0!=f.group){var w=h-d.groupOffset;w=Math.max(0,w),w=Math.min(e.groupIds.length-1,w),f.group=e.groupIds[w]}f=this._cloneItemData(f),e.options.onMoving(f,function(t){t&&d.item.setData(this._cloneItemData(t,"Date"))}.bind(this))}}.bind(this)),this.stackDirty=!0,this.body.emitter.emit("_change")}},n.prototype._moveToGroup=function(t,e){var i=this.groups[e];if(i&&i.groupId!=t.data.group){var o=t.parent;o.remove(t),o.order(),i.add(t),i.order(),t.data.group=i.groupId}},n.prototype._onDragEnd=function(t){if(this.touchParams.itemIsDragging=!1,this.touchParams.itemProps){t.stopPropagation();var e=this,i=this.itemsData.getDataSet(),o=this.touchParams.itemProps;this.touchParams.itemProps=null,o.forEach(function(t){var o=t.item.id,n=null!=e.itemsData.get(o,e.itemOptions);if(n){var s=this._cloneItemData(t.item.data);e.options.onMove(s,function(n){n?(n[i._fieldId]=o,i.update(n)):(t.item.setData(t.data),e.stackDirty=!0,e.body.emitter.emit("_change"))})}else e.options.onAdd(t.item.data,function(i){e._removeItem(t.item),i&&e.itemsData.getDataSet().add(i),e.stackDirty=!0,e.body.emitter.emit("_change")})}.bind(this))}},n.prototype._onGroupClick=function(t){var e=this.groupFromTarget(t);if(e.nestedGroups){var i=this.groupsData;this.groupsData instanceof f&&(i=this.groupsData.getDataSet()),e.showNested=!e.showNested;var o=i.get(e.nestedGroups).map(function(t){return void 0==t.visible&&(t.visible=!0),t.visible=!!e.showNested,t});if(i.update(o),e.showNested)c.removeClassName(e.dom.label,"collapsed"),c.addClassName(e.dom.label,"expanded");else{c.removeClassName(e.dom.label,"expanded");var n=this.options.rtl?"collapsed-rtl":"collapsed";c.addClassName(e.dom.label,n)}}},n.prototype._onGroupDragStart=function(t){this.options.groupEditable.order&&(this.groupTouchParams.group=this.groupFromTarget(t),this.groupTouchParams.group&&(t.stopPropagation(),this.groupTouchParams.originalOrder=this.groupsData.getIds({order:this.options.groupOrder})))},n.prototype._onGroupDrag=function(t){if(this.options.groupEditable.order&&this.groupTouchParams.group){t.stopPropagation();var e=this.groupsData;this.groupsData instanceof f&&(e=this.groupsData.getDataSet());var i=this.groupFromTarget(t);if(i&&i.height!=this.groupTouchParams.group.height){var o=i.top<this.groupTouchParams.group.top,n=t.center?t.center.y:t.clientY,s=c.getAbsoluteTop(i.dom.foreground),r=this.groupTouchParams.group.height;if(o){if(s+r<n)return}else{var a=i.height;if(s+a-r>n)return}}if(i&&i!=this.groupTouchParams.group){var h=e.get(i.groupId),d=e.get(this.groupTouchParams.group.groupId);d&&h&&(this.options.groupOrderSwap(d,h,e),e.update(d),e.update(h));var l=e.getIds({order:this.options.groupOrder});if(!c.equalArray(l,this.groupTouchParams.originalOrder))for(var u=this.groupTouchParams.originalOrder,p=this.groupTouchParams.group.groupId,m=Math.min(u.length,l.length),v=0,g=0,y=0;v<m;){for(;v+g<m&&v+y<m&&l[v+g]==u[v+y];)v++;if(v+g>=m)break;if(l[v+g]!=p)if(u[v+y]!=p){var b=l.indexOf(u[v+y]),_=e.get(l[v+g]),w=e.get(u[v+y]);this.options.groupOrderSwap(_,w,e),e.update(_),e.update(w);var x=l[v+g];l[v+g]=u[v+y],l[b]=x,v++}else y=1;else g=1}}}},n.prototype._onGroupDragEnd=function(t){if(this.options.groupEditable.order&&this.groupTouchParams.group){t.stopPropagation();var e=this,i=e.groupTouchParams.group.groupId,o=e.groupsData.getDataSet(),n=c.extend({},o.get(i));e.options.onMoveGroup(n,function(t){if(t)t[o._fieldId]=i,o.update(t);else{var n=o.getIds({order:e.options.groupOrder});if(!c.equalArray(n,e.groupTouchParams.originalOrder))for(var s=e.groupTouchParams.originalOrder,r=Math.min(s.length,n.length),a=0;a<r;){for(;a<r&&n[a]==s[a];)a++;if(a>=r)break;var h=n.indexOf(s[a]),d=o.get(n[a]),l=o.get(s[a]);e.options.groupOrderSwap(d,l,o),groupsData.update(d),groupsData.update(l);var u=n[a];n[a]=s[a],n[h]=u,a++}}}),e.body.emitter.emit("groupDragged",{groupId:i})}},n.prototype._onSelectItem=function(t){if(this.options.selectable){var e=t.srcEvent&&(t.srcEvent.ctrlKey||t.srcEvent.metaKey),i=t.srcEvent&&t.srcEvent.shiftKey;if(e||i)return void this._onMultiSelectItem(t);var o=this.getSelection(),n=this.itemFromTarget(t),s=n?[n.id]:[];this.setSelection(s);var r=this.getSelection();(r.length>0||o.length>0)&&this.body.emitter.emit("select",{items:r,event:c.elementsCensor(t)})}},n.prototype._onMouseOver=function(t){var e=this.itemFromTarget(t);if(e){var i=this.itemFromRelatedTarget(t);if(e!==i){if(e.getTitle()){null==e.popup&&e.setPopup(new l.default(this.body.dom.root,this.options.tooltip.overflowMethod||"flip"));var o=this.body.dom.centerContainer;e.popup.setPosition(t.clientX-c.getAbsoluteLeft(o)+o.offsetLeft,t.clientY-c.getAbsoluteTop(o)+o.offsetTop),e.popup.show()}this.body.emitter.emit("itemover",{item:e.id,event:c.elementsCensor(t)})}}},n.prototype._onMouseOut=function(t){var e=this.itemFromTarget(t);if(e){var i=this.itemFromRelatedTarget(t);e!==i&&(null!=e.popup&&e.popup.hide(),this.body.emitter.emit("itemout",{item:e.id,event:c.elementsCensor(t)}))}},n.prototype._onMouseMove=function(t){var e=this.itemFromTarget(t);if(e&&this.options.tooltip.followMouse&&e.popup&&!e.popup.hidden){var i=this.body.dom.centerContainer;e.popup.setPosition(t.clientX-c.getAbsoluteLeft(i)+i.offsetLeft,t.clientY-c.getAbsoluteTop(i)+i.offsetTop),e.popup.show()}},n.prototype._onUpdateItem=function(t){if(this.options.selectable&&this.options.editable.add){var e=this;if(t){var i=e.itemsData.get(t.id);this.options.onUpdate(i,function(t){t&&e.itemsData.getDataSet().update(t)})}}},n.prototype._onAddItem=function(t){if(this.options.selectable&&this.options.editable.add){var e=this,i=this.options.snap||null,o=this.itemFromTarget(t);if(!o){if(this.options.rtl)var n=c.getAbsoluteRight(this.dom.frame),s=n-t.center.x;else var n=c.getAbsoluteLeft(this.dom.frame),s=t.center.x-n;var r=this.body.util.toTime(s),a=this.body.util.getScale(),h=this.body.util.getStep(),d={start:i?i(r,a,h):r,content:"new item"};if("drop"==t.type){var l=JSON.parse(t.dataTransfer.getData("text"));if(d.content=l.content,d.type=l.type||"box",d[this.itemsData._fieldId]=l.id||c.randomUUID(),"range"==l.type||l.end&&l.start)if(l.end)d.end=l.end,d.start=l.start;else{var u=this.body.util.toTime(s+this.props.width/5);d.end=i?i(u,a,h):u}}else if(d[this.itemsData._fieldId]=c.randomUUID(),"range"===this.options.type){var u=this.body.util.toTime(s+this.props.width/5);d.end=i?i(u,a,h):u}var p=this.groupFromTarget(t);p&&(d.group=p.groupId),d=this._cloneItemData(d),this.options.onAdd(d,function(i){i&&(e.itemsData.getDataSet().add(i),"drop"==t.type&&e.setSelection([i.id]))})}}},n.prototype._onMultiSelectItem=function(t){if(this.options.selectable){var e=this.itemFromTarget(t);if(e){var i=this.options.multiselect?this.getSelection():[],o=t.srcEvent&&t.srcEvent.shiftKey||!1;if(o&&this.options.multiselect){var s=this.itemsData.get(e.id).group,r=void 0;this.options.multiselectPerGroup&&i.length>0&&(r=this.itemsData.get(i[0]).group),this.options.multiselectPerGroup&&void 0!=r&&r!=s||i.push(e.id);var a=n._getItemRange(this.itemsData.get(i,this.itemOptions));if(!this.options.multiselectPerGroup||r==s){i=[];for(var h in this.items)if(this.items.hasOwnProperty(h)){var d=this.items[h],l=d.data.start,u=void 0!==d.data.end?d.data.end:l;!(l>=a.min&&u<=a.max)||this.options.multiselectPerGroup&&r!=this.itemsData.get(d.id).group||d instanceof x||i.push(d.id)}}}else{var p=i.indexOf(e.id);p==-1?i.push(e.id):i.splice(p,1)}this.setSelection(i),this.body.emitter.emit("select",{items:this.getSelection(),event:c.elementsCensor(t)})}}},n._getItemRange=function(t){var e=null,i=null;return t.forEach(function(t){(null==i||t.start<i)&&(i=t.start),void 0!=t.end?(null==e||t.end>e)&&(e=t.end):(null==e||t.start>e)&&(e=t.start)}),{min:i,max:e}},n.prototype.itemFromElement=function(t){for(var e=t;e;){if(e.hasOwnProperty("timeline-item"))return e["timeline-item"];e=e.parentNode}return null},n.prototype.itemFromTarget=function(t){return this.itemFromElement(t.target)},n.prototype.itemFromRelatedTarget=function(t){return this.itemFromElement(t.relatedTarget)},n.prototype.groupFromTarget=function(t){for(var e=t.center?t.center.y:t.clientY,i=0;i<this.groupIds.length;i++){var o=this.groupIds[i],n=this.groups[o],s=n.dom.foreground,r=c.getAbsoluteTop(s);if(e>r&&e<r+s.offsetHeight)return n;if("top"===this.options.orientation.item){if(i===this.groupIds.length-1&&e>r)return n}else if(0===i&&e<r+s.offset)return n}return null},n.itemSetFromTarget=function(t){for(var e=t.target;e;){if(e.hasOwnProperty("timeline-itemset"))return e["timeline-itemset"];e=e.parentNode}return null},n.prototype._cloneItemData=function(t,e){var i=c.extend({},t);return e||(e=this.itemsData.getDataSet()._options.type),void 0!=i.start&&(i.start=c.convert(i.start,e&&e.start||"Date")),void 0!=i.end&&(i.end=c.convert(i.end,e&&e.end||"Date")),i},t.exports=n},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(e,i){(0,s.default)(this,t),this.container=e,this.overflowMethod=i||"cap",this.x=0,this.y=0,this.padding=5,this.hidden=!1,this.frame=document.createElement("div"),this.frame.className="vis-tooltip",this.container.appendChild(this.frame)}return(0,a.default)(t,[{key:"setPosition",value:function(t,e){this.x=parseInt(t),this.y=parseInt(e)}},{key:"setText",value:function(t){t instanceof Element?(this.frame.innerHTML="",this.frame.appendChild(t)):this.frame.innerHTML=t}},{key:"show",value:function(t){if(void 0===t&&(t=!0),t===!0){var e=this.frame.clientHeight,i=this.frame.clientWidth,o=this.frame.parentNode.clientHeight,n=this.frame.parentNode.clientWidth,s=0,r=0;if("flip"==this.overflowMethod){var a=!1,h=!0;this.y-e<this.padding&&(h=!1),this.x+i>n-this.padding&&(a=!0),s=a?this.x-i:this.x,r=h?this.y-e:this.y}else r=this.y-e,r+e+this.padding>o&&(r=o-e-this.padding),r<this.padding&&(r=this.padding),s=this.x,s+i+this.padding>n&&(s=n-i-this.padding),s<this.padding&&(s=this.padding);this.frame.style.left=s+"px",this.frame.style.top=r+"px",this.frame.style.visibility="visible",this.hidden=!1}else this.hide()}},{key:"hide",value:function(){this.hidden=!0,this.frame.style.visibility="hidden"}},{key:"destroy",value:function(){this.frame.parentNode.removeChild(this.frame)}}]),t}();e.default=h},function(t,e,i){function o(t,e,i,s){this.moment=n,this.current=this.moment(),this._start=this.moment(),this._end=this.moment(),this.autoScale=!0,this.scale="day",this.step=1,this.setRange(t,e,i),this.switchedDay=!1,this.switchedMonth=!1,this.switchedYear=!1,Array.isArray(s)?this.hiddenDates=s:void 0!=s?this.hiddenDates=[s]:this.hiddenDates=[],this.format=o.FORMAT}var n=i(84),s=i(125),r=i(1);o.FORMAT={minorLabels:{millisecond:"SSS",second:"s",minute:"HH:mm",hour:"HH:mm",weekday:"ddd D",day:"D",month:"MMM",year:"YYYY"},majorLabels:{millisecond:"HH:mm:ss",second:"D MMMM HH:mm",minute:"ddd D MMMM",hour:"ddd D MMMM",weekday:"MMMM YYYY",day:"MMMM YYYY",month:"YYYY",year:""}},o.prototype.setMoment=function(t){this.moment=t,this.current=this.moment(this.current.valueOf()),this._start=this.moment(this._start.valueOf()),this._end=this.moment(this._end.valueOf())},o.prototype.setFormat=function(t){var e=r.deepExtend({},o.FORMAT);this.format=r.deepExtend(e,t)},o.prototype.setRange=function(t,e,i){if(!(t instanceof Date&&e instanceof Date))throw"No legal start or end date in method setRange";this._start=void 0!=t?this.moment(t.valueOf()):new Date,this._end=void 0!=e?this.moment(e.valueOf()):new Date,this.autoScale&&this.setMinimumStep(i)},o.prototype.start=function(){this.current=this._start.clone(),this.roundToMinor()},o.prototype.roundToMinor=function(){switch(this.scale){case"year":this.current.year(this.step*Math.floor(this.current.year()/this.step)),this.current.month(0);case"month":this.current.date(1);case"day":case"weekday":this.current.hours(0);case"hour":this.current.minutes(0);case"minute":this.current.seconds(0);case"second":this.current.milliseconds(0)}if(1!=this.step)switch(this.scale){case"millisecond":this.current.subtract(this.current.milliseconds()%this.step,"milliseconds");break;case"second":this.current.subtract(this.current.seconds()%this.step,"seconds");break;case"minute":this.current.subtract(this.current.minutes()%this.step,"minutes");break;case"hour":this.current.subtract(this.current.hours()%this.step,"hours");break;case"weekday":case"day":this.current.subtract((this.current.date()-1)%this.step,"day");break;case"month":this.current.subtract(this.current.month()%this.step,"month");break;case"year":this.current.subtract(this.current.year()%this.step,"year")}},o.prototype.hasNext=function(){return this.current.valueOf()<=this._end.valueOf()},o.prototype.next=function(){var t=this.current.valueOf();if(this.current.month()<6)switch(this.scale){case"millisecond":this.current.add(this.step,"millisecond");break;case"second":this.current.add(this.step,"second");break;case"minute":this.current.add(this.step,"minute");break;case"hour":this.current.add(this.step,"hour"),this.current.subtract(this.current.hours()%this.step,"hour");break;case"weekday":case"day":this.current.add(this.step,"day");break;case"month":this.current.add(this.step,"month");break;case"year":this.current.add(this.step,"year")}else switch(this.scale){case"millisecond":this.current.add(this.step,"millisecond");break;case"second":this.current.add(this.step,"second");break;case"minute":this.current.add(this.step,"minute");break;case"hour":this.current.add(this.moment.duration(this.step,"hour")),this.current.hours()%this.step!==0&&this.current.add(this.step-this.current.hours()%this.step,"hour");break;case"weekday":case"day":this.current.add(this.step,"day");break;case"month":this.current.add(this.step,"month");break;case"year":this.current.add(this.step,"year")}if(1!=this.step)switch(this.scale){case"millisecond":this.current.milliseconds()>0&&this.current.milliseconds()<this.step&&this.current.milliseconds(0);break;case"second":this.current.seconds()>0&&this.current.seconds()<this.step&&this.current.seconds(0);break;case"minute":this.current.minutes()>0&&this.current.minutes()<this.step&&this.current.minutes(0);break;case"hour":this.current.hours()>0&&this.current.hours()<this.step&&this.current.hours(0);break;case"weekday":case"day":this.current.date()<this.step+1&&this.current.date(1);break;case"month":this.current.month()<this.step&&this.current.month(0);break;case"year":}this.current.valueOf()==t&&(this.current=this._end.clone()),this.switchedDay=!1,this.switchedMonth=!1,this.switchedYear=!1,s.stepOverHiddenDates(this.moment,this,t)},o.prototype.getCurrent=function(){return this.current},o.prototype.setScale=function(t){t&&"string"==typeof t.scale&&(this.scale=t.scale,this.step=t.step>0?t.step:1,this.autoScale=!1)},o.prototype.setAutoScale=function(t){this.autoScale=t},o.prototype.setMinimumStep=function(t){if(void 0!=t){var e=31104e6,i=2592e6,o=864e5,n=36e5,s=6e4,r=1e3,a=1;1e3*e>t&&(this.scale="year",this.step=1e3),500*e>t&&(this.scale="year",this.step=500),100*e>t&&(this.scale="year",this.step=100),50*e>t&&(this.scale="year",this.step=50),10*e>t&&(this.scale="year",this.step=10),5*e>t&&(this.scale="year",this.step=5),e>t&&(this.scale="year",this.step=1),3*i>t&&(this.scale="month",this.step=3),i>t&&(this.scale="month",this.step=1),5*o>t&&(this.scale="day",this.step=5),2*o>t&&(this.scale="day",this.step=2),o>t&&(this.scale="day",this.step=1),o/2>t&&(this.scale="weekday",this.step=1),4*n>t&&(this.scale="hour",this.step=4),n>t&&(this.scale="hour",this.step=1),15*s>t&&(this.scale="minute",this.step=15),10*s>t&&(this.scale="minute",this.step=10),5*s>t&&(this.scale="minute",this.step=5),s>t&&(this.scale="minute",this.step=1),15*r>t&&(this.scale="second",this.step=15),10*r>t&&(this.scale="second",this.step=10),5*r>t&&(this.scale="second",this.step=5),r>t&&(this.scale="second",this.step=1),200*a>t&&(this.scale="millisecond",this.step=200),100*a>t&&(this.scale="millisecond",this.step=100),50*a>t&&(this.scale="millisecond",this.step=50),10*a>t&&(this.scale="millisecond",this.step=10),5*a>t&&(this.scale="millisecond",this.step=5),a>t&&(this.scale="millisecond",this.step=1)}},o.snap=function(t,e,i){var o=n(t);if("year"==e){var s=o.year()+Math.round(o.month()/12);o.year(Math.round(s/i)*i),o.month(0),o.date(0),o.hours(0),o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("month"==e)o.date()>15?(o.date(1),o.add(1,"month")):o.date(1),o.hours(0),o.minutes(0),o.seconds(0),o.milliseconds(0);else if("day"==e){switch(i){case 5:case 2:o.hours(24*Math.round(o.hours()/24));break;default:o.hours(12*Math.round(o.hours()/12))}o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("weekday"==e){switch(i){case 5:case 2:o.hours(12*Math.round(o.hours()/12));break;default:o.hours(6*Math.round(o.hours()/6))}o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("hour"==e){switch(i){case 4:o.minutes(60*Math.round(o.minutes()/60));break;default:o.minutes(30*Math.round(o.minutes()/30))}o.seconds(0),o.milliseconds(0)}else if("minute"==e){switch(i){case 15:case 10:o.minutes(5*Math.round(o.minutes()/5)),o.seconds(0);break;case 5:o.seconds(60*Math.round(o.seconds()/60));break;default:o.seconds(30*Math.round(o.seconds()/30))}o.milliseconds(0)}else if("second"==e)switch(i){case 15:case 10:o.seconds(5*Math.round(o.seconds()/5)),o.milliseconds(0);break;case 5:o.milliseconds(1e3*Math.round(o.milliseconds()/1e3));break;default:o.milliseconds(500*Math.round(o.milliseconds()/500))}else if("millisecond"==e){var r=i>5?i/2:1;o.milliseconds(Math.round(o.milliseconds()/r)*r)}return o},o.prototype.isMajor=function(){if(1==this.switchedYear)switch(this.scale){case"year":case"month":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedMonth)switch(this.scale){case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedDay)switch(this.scale){case"millisecond":case"second":case"minute":case"hour":return!0;default:return!1}var t=this.moment(this.current);switch(this.scale){case"millisecond":return 0==t.milliseconds();case"second":return 0==t.seconds();case"minute":return 0==t.hours()&&0==t.minutes();case"hour":return 0==t.hours();case"weekday":case"day":return 1==t.date();case"month":return 0==t.month();case"year":return!1;default:return!1}},o.prototype.getLabelMinor=function(t){if(void 0==t&&(t=this.current),"function"==typeof this.format.minorLabels)return this.format.minorLabels(t,this.scale,this.step);var e=this.format.minorLabels[this.scale];return e&&e.length>0?this.moment(t).format(e):""},o.prototype.getLabelMajor=function(t){if(void 0==t&&(t=this.current),"function"==typeof this.format.majorLabels)return this.format.majorLabels(t,this.scale,this.step);var e=this.format.majorLabels[this.scale];return e&&e.length>0?this.moment(t).format(e):""},o.prototype.getClassName=function(){function t(t){return t/h%2==0?" vis-even":" vis-odd"}function e(t){return t.isSame(new Date,"day")?" vis-today":t.isSame(s().add(1,"day"),"day")?" vis-tomorrow":t.isSame(s().add(-1,"day"),"day")?" vis-yesterday":""}function i(t){return t.isSame(new Date,"week")?" vis-current-week":""}function o(t){return t.isSame(new Date,"month")?" vis-current-month":""}function n(t){return t.isSame(new Date,"year")?" vis-current-year":""}var s=this.moment,r=this.moment(this.current),a=r.locale?r.locale("en"):r.lang("en"),h=this.step;switch(this.scale){case"millisecond":return e(a)+t(a.milliseconds()).trim();case"second":return e(a)+t(a.seconds()).trim();case"minute":return e(a)+t(a.minutes()).trim();case"hour":return"vis-h"+a.hours()+(4==this.step?"-h"+(a.hours()+4):"")+e(a)+t(a.hours());case"weekday":return"vis-"+a.format("dddd").toLowerCase()+e(a)+i(a)+t(a.date());case"day":return"vis-day"+a.date()+" vis-"+a.format("MMMM").toLowerCase()+e(a)+o(a)+(this.step<=2?e(a):"")+(this.step<=2?" vis-"+a.format("dddd").toLowerCase():""+t(a.date()-1));case"month":return"vis-"+a.format("MMMM").toLowerCase()+o(a)+t(a.month());case"year":var d=a.year();return"vis-year"+d+n(a)+t(d);default:return""}},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i){this.groupId=t,this.subgroups={},this.subgroupIndex=0,this.subgroupOrderer=e&&e.subgroupOrder,this.itemSet=i,this.isVisible=null,e&&e.nestedGroups&&(this.nestedGroups=e.nestedGroups,0==e.showNested?this.showNested=!1:this.showNested=!0),this.nestedInGroup=null,this.dom={},this.props={label:{width:0,height:0}},this.className=null,this.items={},this.visibleItems=[],this.itemsInRange=[],this.orderedItems={byStart:[],byEnd:[]},this.checkRangedItems=!1;var o=this;this.itemSet.body.emitter.on("checkRangedItems",function(){o.checkRangedItems=!0}),this._create(),this.setData(e)}var s=i(58),r=o(s),a=i(1),h=i(131);i(132);n.prototype._create=function(){var t=document.createElement("div");this.itemSet.options.groupEditable.order?t.className="vis-label draggable":t.className="vis-label",this.dom.label=t;var e=document.createElement("div");e.className="vis-inner",t.appendChild(e),this.dom.inner=e;var i=document.createElement("div");i.className="vis-group",i["timeline-group"]=this,this.dom.foreground=i,this.dom.background=document.createElement("div"),this.dom.background.className="vis-group",this.dom.axis=document.createElement("div"),this.dom.axis.className="vis-group",this.dom.marker=document.createElement("div"),this.dom.marker.style.visibility="hidden",this.dom.marker.style.position="absolute",this.dom.marker.innerHTML="",this.dom.background.appendChild(this.dom.marker)},n.prototype.setData=function(t){var e,i;if(this.itemSet.options&&this.itemSet.options.groupTemplate?(i=this.itemSet.options.groupTemplate.bind(this),e=i(t,this.dom.inner)):e=t&&t.content,e instanceof Element){for(this.dom.inner.appendChild(e);this.dom.inner.firstChild;)this.dom.inner.removeChild(this.dom.inner.firstChild);this.dom.inner.appendChild(e)}else e instanceof Object?i(t,this.dom.inner):void 0!==e&&null!==e?this.dom.inner.innerHTML=e:this.dom.inner.innerHTML=this.groupId||"";if(this.dom.label.title=t&&t.title||"",this.dom.inner.firstChild?a.removeClassName(this.dom.inner,"vis-hidden"):a.addClassName(this.dom.inner,"vis-hidden"),t&&t.nestedGroups)if(0==t.showNested?this.showNested=!1:this.showNested=!0,a.addClassName(this.dom.label,"vis-nesting-group"),this.showNested)a.removeClassName(this.dom.label,"collapsed"),a.addClassName(this.dom.label,"expanded");else{a.removeClassName(this.dom.label,"expanded");var o=this.itemSet.options.rtl?"collapsed-rtl":"collapsed";a.addClassName(this.dom.label,o)}t&&t.nestedInGroup&&(a.addClassName(this.dom.label,"vis-nested-group"),this.itemSet.options&&this.itemSet.options.rtl?this.dom.inner.style.paddingRight="30px":this.dom.inner.style.paddingLeft="30px");var n=t&&t.className||null;n!=this.className&&(this.className&&(a.removeClassName(this.dom.label,this.className),a.removeClassName(this.dom.foreground,this.className),a.removeClassName(this.dom.background,this.className),a.removeClassName(this.dom.axis,this.className)),a.addClassName(this.dom.label,n),a.addClassName(this.dom.foreground,n),a.addClassName(this.dom.background,n),a.addClassName(this.dom.axis,n),this.className=n),this.style&&(a.removeCssText(this.dom.label,this.style),this.style=null),t&&t.style&&(a.addCssText(this.dom.label,t.style),this.style=t.style)},n.prototype.getLabelWidth=function(){return this.props.label.width},n.prototype.redraw=function(t,e,i){var o=!1,n=this.dom.marker.clientHeight;n!=this.lastMarkerHeight&&(this.lastMarkerHeight=n,a.forEach(this.items,function(t){t.dirty=!0,t.displayed&&t.redraw()}),i=!0),this._calculateSubGroupHeights(e);var s=this.dom.foreground;if(this.top=s.offsetTop,this.right=s.offsetLeft,this.width=s.offsetWidth,this.isVisible=this._isGroupVisible(t,e),"function"==typeof this.itemSet.options.order){if(i){var r=this,d=!1;a.forEach(this.items,function(t){t.displayed||(t.redraw(),r.visibleItems.push(t)),t.repositionX(d)});var l=this.orderedItems.byStart.slice().sort(function(t,e){return r.itemSet.options.order(t.data,e.data)});h.stack(l,e,!0)}this.visibleItems=this._updateItemsInRange(this.orderedItems,this.visibleItems,t)}else this.visibleItems=this._updateItemsInRange(this.orderedItems,this.visibleItems,t),this.itemSet.options.stack?h.stack(this.visibleItems,e,i):h.nostack(this.visibleItems,e,this.subgroups,this.itemSet.options.stackSubgroups);this._updateSubgroupsSizes();var u=this._calculateHeight(e),s=this.dom.foreground;this.top=s.offsetTop,this.right=s.offsetLeft,this.width=s.offsetWidth,o=a.updateProperty(this,"height",u)||o,o=a.updateProperty(this.props.label,"width",this.dom.inner.clientWidth)||o,o=a.updateProperty(this.props.label,"height",this.dom.inner.clientHeight)||o,this.dom.background.style.height=u+"px",this.dom.foreground.style.height=u+"px",this.dom.label.style.height=u+"px";for(var c=0,p=this.visibleItems.length;c<p;c++){var f=this.visibleItems[c];f.repositionY(e),this.isVisible||"__background__"==this.groupId||f.displayed&&f.hide()}return!this.isVisible&&this.height?o=!1:o},n.prototype._calculateSubGroupHeights=function(t){if((0,r.default)(this.subgroups).length>0){var e=this;this.resetSubgroups(),a.forEach(this.visibleItems,function(i){void 0!==i.data.subgroup&&(e.subgroups[i.data.subgroup].height=Math.max(e.subgroups[i.data.subgroup].height,i.height+t.item.vertical),e.subgroups[i.data.subgroup].visible=!0)})}},n.prototype._isGroupVisible=function(t,e){var i=this.top<=t.body.domProps.centerContainer.height-t.body.domProps.scrollTop+e.axis&&this.top+this.height+e.axis>=-t.body.domProps.scrollTop;return i},n.prototype._calculateHeight=function(t){var e,i=this.visibleItems;if(i.length>0){var o=i[0].top,n=i[0].top+i[0].height;if(a.forEach(i,function(t){o=Math.min(o,t.top),n=Math.max(n,t.top+t.height)}),o>t.axis){var s=o-t.axis;n-=s,a.forEach(i,function(t){t.top-=s})}e=n+t.item.vertical/2}else e=0;return e=Math.max(e,this.props.label.height)},n.prototype.show=function(){this.dom.label.parentNode||this.itemSet.dom.labelSet.appendChild(this.dom.label),this.dom.foreground.parentNode||this.itemSet.dom.foreground.appendChild(this.dom.foreground),this.dom.background.parentNode||this.itemSet.dom.background.appendChild(this.dom.background),this.dom.axis.parentNode||this.itemSet.dom.axis.appendChild(this.dom.axis)},n.prototype.hide=function(){var t=this.dom.label;t.parentNode&&t.parentNode.removeChild(t);var e=this.dom.foreground;e.parentNode&&e.parentNode.removeChild(e);var i=this.dom.background;i.parentNode&&i.parentNode.removeChild(i);var o=this.dom.axis;o.parentNode&&o.parentNode.removeChild(o)},n.prototype.add=function(t){
+if(this.items[t.id]=t,t.setParent(this),void 0!==t.data.subgroup&&(void 0===this.subgroups[t.data.subgroup]&&(this.subgroups[t.data.subgroup]={height:0,top:0,start:t.data.start,end:t.data.end,visible:!1,index:this.subgroupIndex,items:[]},this.subgroupIndex++),new Date(t.data.start)<new Date(this.subgroups[t.data.subgroup].start)&&(this.subgroups[t.data.subgroup].start=t.data.start),new Date(t.data.end)>new Date(this.subgroups[t.data.subgroup].end)&&(this.subgroups[t.data.subgroup].end=t.data.end),this.subgroups[t.data.subgroup].items.push(t)),this.orderSubgroups(),this.visibleItems.indexOf(t)==-1){var e=this.itemSet.body.range;this._checkIfVisible(t,this.visibleItems,e)}},n.prototype._updateSubgroupsSizes=function(){var t=this;if(t.subgroups)for(var e in t.subgroups){var i=t.subgroups[e].items[0].data.start,o=t.subgroups[e].items[0].data.end;t.subgroups[e].items.forEach(function(t){new Date(t.data.start)<new Date(i)&&(i=t.data.start),new Date(t.data.end)>new Date(o)&&(o=t.data.end)}),t.subgroups[e].start=i,t.subgroups[e].end=o}},n.prototype.orderSubgroups=function(){if(void 0!==this.subgroupOrderer){var t=[];if("string"==typeof this.subgroupOrderer){for(var e in this.subgroups)t.push({subgroup:e,sortField:this.subgroups[e].items[0].data[this.subgroupOrderer]});t.sort(function(t,e){return t.sortField-e.sortField})}else if("function"==typeof this.subgroupOrderer){for(var e in this.subgroups)t.push(this.subgroups[e].items[0].data);t.sort(this.subgroupOrderer)}if(t.length>0)for(var i=0;i<t.length;i++)this.subgroups[t[i].subgroup].index=i}},n.prototype.resetSubgroups=function(){for(var t in this.subgroups)this.subgroups.hasOwnProperty(t)&&(this.subgroups[t].visible=!1)},n.prototype.remove=function(t){delete this.items[t.id],t.setParent(null);var e=this.visibleItems.indexOf(t);if(e!=-1&&this.visibleItems.splice(e,1),void 0!==t.data.subgroup){var i=this.subgroups[t.data.subgroup];if(i){var o=i.items.indexOf(t);i.items.splice(o,1),i.items.length?this._updateSubgroupsSizes():(delete this.subgroups[t.data.subgroup],this.subgroupIndex--),this.orderSubgroups()}}},n.prototype.removeFromDataSet=function(t){this.itemSet.removeItem(t.id)},n.prototype.order=function(){for(var t=a.toArray(this.items),e=[],i=[],o=0;o<t.length;o++)void 0!==t[o].data.end&&i.push(t[o]),e.push(t[o]);this.orderedItems={byStart:e,byEnd:i},h.orderByStart(this.orderedItems.byStart),h.orderByEnd(this.orderedItems.byEnd)},n.prototype._updateItemsInRange=function(t,e,i){var o=[],n={},s=(i.end-i.start)/4,r=i.start-s,h=i.end+s,d=function(t){return t<r?-1:t<=h?0:1};if(e.length>0)for(var l=0;l<e.length;l++)this._checkIfVisibleWithReference(e[l],o,n,i);var u=a.binarySearchCustom(t.byStart,d,"data","start");if(this._traceVisible(u,t.byStart,o,n,function(t){return t.data.start<r||t.data.start>h}),1==this.checkRangedItems)for(this.checkRangedItems=!1,l=0;l<t.byEnd.length;l++)this._checkIfVisibleWithReference(t.byEnd[l],o,n,i);else{var c=a.binarySearchCustom(t.byEnd,d,"data","end");this._traceVisible(c,t.byEnd,o,n,function(t){return t.data.end<r||t.data.end>h})}for(var l=0;l<o.length;l++){var p=o[l];p.displayed||p.show(),p.repositionX()}return o},n.prototype._traceVisible=function(t,e,i,o,n){if(t!=-1){for(var s=t;s>=0;s--){var r=e[s];if(n(r))break;void 0===o[r.id]&&(o[r.id]=!0,i.push(r))}for(var s=t+1;s<e.length;s++){var r=e[s];if(n(r))break;void 0===o[r.id]&&(o[r.id]=!0,i.push(r))}}},n.prototype._checkIfVisible=function(t,e,i){t.isVisible(i)?(t.displayed||t.show(),t.repositionX(),e.push(t)):t.displayed&&t.hide()},n.prototype._checkIfVisibleWithReference=function(t,e,i,o){t.isVisible(o)?void 0===i[t.id]&&(i[t.id]=!0,e.push(t)):t.displayed&&t.hide()},t.exports=n},function(t,e){var i=.001;e.orderByStart=function(t){t.sort(function(t,e){return t.data.start-e.data.start})},e.orderByEnd=function(t){t.sort(function(t,e){var i="end"in t.data?t.data.end:t.data.start,o="end"in e.data?e.data.end:e.data.start;return i-o})},e.stack=function(t,i,o){if(o)for(var n=0;n<t.length;n++)t[n].top=null;for(var n=0;n<t.length;n++){var s=t[n];if(s.stack&&null===s.top){s.top=i.axis;do{for(var r=null,a=0,h=t.length;a<h;a++){var d=t[a];if(null!==d.top&&d!==s&&d.stack&&e.collision(s,d,i.item,d.options.rtl)){r=d;break}}null!=r&&(s.top=r.top+r.height+i.item.vertical)}while(r)}}},e.nostack=function(t,i,o,n){for(var s=0;s<t.length;s++)if(void 0==t[s].data.subgroup)t[s].top=i.item.vertical;else if(void 0!==t[s].data.subgroup&&n){var r=0;for(var a in o)o.hasOwnProperty(a)&&1==o[a].visible&&o[a].index<o[t[s].data.subgroup].index&&(r+=o[a].height,o[t[s].data.subgroup].top=r);t[s].top=r+.5*i.item.vertical}n||e.stackSubgroups(t,i,o)},e.stackSubgroups=function(t,i,o){for(var n in o)if(o.hasOwnProperty(n)){o[n].top=0;do{var s=null;for(var r in o)if(null!==o[r].top&&r!==n&&o[n].index>o[r].index&&e.collisionByTimes(o[n],o[r])){s=o[r];break}null!=s&&(o[n].top=s.top+s.height)}while(s)}for(var a=0;a<t.length;a++)void 0!==t[a].data.subgroup&&(t[a].top=o[t[a].data.subgroup].top+.5*i.item.vertical)},e.collision=function(t,e,o,n){return n?t.right-o.horizontal+i<e.right+e.width&&t.right+t.width+o.horizontal-i>e.right&&t.top-o.vertical+i<e.top+e.height&&t.top+t.height+o.vertical-i>e.top:t.left-o.horizontal+i<e.left+e.width&&t.left+t.width+o.horizontal-i>e.left&&t.top-o.vertical+i<e.top+e.height&&t.top+t.height+o.vertical-i>e.top},e.collisionByTimes=function(t,e){return t.start<=e.start&&t.end>=e.start&&t.top<e.top+e.height&&t.top+t.height>e.top||e.start<=t.start&&e.end>=t.start&&e.top<t.top+t.height&&e.top+e.height>t.top}},function(t,e,i){function o(t,e,i){if(this.props={content:{width:0}},this.overflow=!1,this.options=i,t){if(void 0==t.start)throw new Error('Property "start" missing in item '+t.id);if(void 0==t.end)throw new Error('Property "end" missing in item '+t.id)}n.call(this,t,e,i)}var n=(i(108),i(133));o.prototype=new n(null,null,null),o.prototype.baseClassName="vis-item vis-range",o.prototype.isVisible=function(t){return this.data.start<t.end&&this.data.end>t.start},o.prototype.redraw=function(){var t=this.dom;if(t||(this.dom={},t=this.dom,t.box=document.createElement("div"),t.frame=document.createElement("div"),t.frame.className="vis-item-overflow",t.box.appendChild(t.frame),t.visibleFrame=document.createElement("div"),t.visibleFrame.className="vis-item-visible-frame",t.box.appendChild(t.visibleFrame),t.content=document.createElement("div"),t.content.className="vis-item-content",t.frame.appendChild(t.content),t.box["timeline-item"]=this,this.dirty=!0),!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!t.box.parentNode){var e=this.parent.dom.foreground;if(!e)throw new Error("Cannot redraw item: parent has no foreground container element");e.appendChild(t.box)}if(this.displayed=!0,this.dirty){this._updateContents(this.dom.content),this._updateTitle(),this._updateDataAttributes(this.dom.box),this._updateStyle(this.dom.box);var i=(this.options.editable.updateTime||this.options.editable.updateGroup||this.editable===!0)&&this.editable!==!1,o=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"")+(i?" vis-editable":" vis-readonly");t.box.className=this.baseClassName+o,this.overflow="hidden"!==window.getComputedStyle(t.frame).overflow,this.dom.content.style.maxWidth="none",this.props.content.width=this.dom.content.offsetWidth,this.height=this.dom.box.offsetHeight,this.dom.content.style.maxWidth="",this.dirty=!1}this._repaintOnItemUpdateTimeTooltip(t.box),this._repaintDeleteButton(t.box),this._repaintDragCenter(),this._repaintDragLeft(),this._repaintDragRight()},o.prototype.show=function(){this.displayed||this.redraw()},o.prototype.hide=function(){if(this.displayed){var t=this.dom.box;t.parentNode&&t.parentNode.removeChild(t),this.displayed=!1}},o.prototype.repositionX=function(t){var e,i,o=this.parent.width,n=this.conversion.toScreen(this.data.start),s=this.conversion.toScreen(this.data.end);void 0!==t&&t!==!0||(n<-o&&(n=-o),s>2*o&&(s=2*o));var r=Math.max(s-n+.5,1);switch(this.overflow?(this.options.rtl?this.right=n:this.left=n,this.width=r+this.props.content.width,i=this.props.content.width):(this.options.rtl?this.right=n:this.left=n,this.width=r,i=Math.min(s-n,this.props.content.width)),this.options.rtl?this.dom.box.style.right=this.right+"px":this.dom.box.style.left=this.left+"px",this.dom.box.style.width=r+"px",this.options.align){case"left":this.options.rtl?this.dom.content.style.right="0":this.dom.content.style.left="0";break;case"right":this.options.rtl?this.dom.content.style.right=Math.max(r-i,0)+"px":this.dom.content.style.left=Math.max(r-i,0)+"px";break;case"center":this.options.rtl?this.dom.content.style.right=Math.max((r-i)/2,0)+"px":this.dom.content.style.left=Math.max((r-i)/2,0)+"px";break;default:e=this.overflow?s>0?Math.max(-n,0):-i:n<0?-n:0,this.options.rtl?this.dom.content.style.right=e+"px":(this.dom.content.style.left=e+"px",this.dom.content.style.width="calc(100% - "+e+"px)")}},o.prototype.repositionY=function(){var t=this.options.orientation.item,e=this.dom.box;"top"==t?e.style.top=this.top+"px":e.style.top=this.parent.height-this.top-this.height+"px"},o.prototype._repaintDragLeft=function(){if(this.selected&&this.options.editable.updateTime&&!this.dom.dragLeft){var t=document.createElement("div");t.className="vis-drag-left",t.dragLeftItem=this,this.dom.box.appendChild(t),this.dom.dragLeft=t}else!this.selected&&this.dom.dragLeft&&(this.dom.dragLeft.parentNode&&this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft),this.dom.dragLeft=null)},o.prototype._repaintDragRight=function(){if(this.selected&&this.options.editable.updateTime&&!this.dom.dragRight){var t=document.createElement("div");t.className="vis-drag-right",t.dragRightItem=this,this.dom.box.appendChild(t),this.dom.dragRight=t}else!this.selected&&this.dom.dragRight&&(this.dom.dragRight.parentNode&&this.dom.dragRight.parentNode.removeChild(this.dom.dragRight),this.dom.dragRight=null)},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i){this.id=null,this.parent=null,this.data=t,this.dom=null,this.conversion=e||{},this.options=i||{},this.selected=!1,this.displayed=!1,this.groupShowing=!0,this.dirty=!0,this.popup=null,this.top=null,this.right=null,this.left=null,this.width=null,this.height=null,this.editable=null,this.data&&this.data.hasOwnProperty("editable")&&("boolean"==typeof this.data.editable?this.editable={updateTime:this.data.editable,updateGroup:this.data.editable,remove:this.data.editable}:"object"===(0,h.default)(i.editable)&&(this.editable={},l.selectiveExtend(["updateTime","updateGroup","remove"],this.editable,t.editable)))}var s=i(58),r=o(s),a=i(62),h=o(a),d=i(108),l=i(1),u=i(84);n.prototype.stack=!0,n.prototype.select=function(){this.selected=!0,this.dirty=!0,this.displayed&&this.redraw()},n.prototype.unselect=function(){this.selected=!1,this.dirty=!0,this.displayed&&this.redraw()},n.prototype.setData=function(t){var e=void 0!=t.group&&this.data.group!=t.group;e&&this.parent.itemSet._moveToGroup(this,t.group),t.hasOwnProperty("editable")&&("boolean"==typeof t.editable?this.editable={updateTime:this.data.editable,updateGroup:this.data.editable,remove:this.data.editable}:"object"===(0,h.default)(options.editable)&&(this.editable={},l.selectiveExtend(["updateTime","updateGroup","remove"],this.editable,t.editable))),this.data=t,this.dirty=!0,this.displayed&&this.redraw()},n.prototype.setParent=function(t){this.displayed?(this.hide(),this.parent=t,this.parent&&this.show()):this.parent=t},n.prototype.isVisible=function(t){return!1},n.prototype.show=function(){return!1},n.prototype.hide=function(){return!1},n.prototype.redraw=function(){},n.prototype.repositionX=function(){},n.prototype.repositionY=function(){},n.prototype._repaintDragCenter=function(){if(this.selected&&this.options.editable.updateTime&&!this.dom.dragCenter){var t=this,e=document.createElement("div");e.className="vis-drag-center",e.dragCenterItem=this,new d(e).on("doubletap",function(e){e.stopPropagation(),t.parent.itemSet._onUpdateItem(t)}),this.dom.box?this.dom.box.appendChild(e):this.dom.point&&this.dom.point.appendChild(e),this.dom.dragCenter=e}else!this.selected&&this.dom.dragCenter&&(this.dom.dragCenter.parentNode&&this.dom.dragCenter.parentNode.removeChild(this.dom.dragCenter),this.dom.dragCenter=null)},n.prototype._repaintDeleteButton=function(t){var e=(this.options.editable.overrideItems||null==this.editable)&&this.options.editable.remove||!this.options.editable.overrideItems&&null!=this.editable&&this.editable.remove;if(this.selected&&e&&!this.dom.deleteButton){var i=this,o=document.createElement("div");this.options.rtl?o.className="vis-delete-rtl":o.className="vis-delete",o.title="Delete this item",new d(o).on("tap",function(t){t.stopPropagation(),i.parent.removeFromDataSet(i)}),t.appendChild(o),this.dom.deleteButton=o}else!this.selected&&this.dom.deleteButton&&(this.dom.deleteButton.parentNode&&this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton),this.dom.deleteButton=null)},n.prototype._repaintOnItemUpdateTimeTooltip=function(t){if(this.options.tooltipOnItemUpdateTime){var e=(this.options.editable.updateTime||this.data.editable===!0)&&this.data.editable!==!1;if(this.selected&&e&&!this.dom.onItemUpdateTimeTooltip){var i=document.createElement("div");i.className="vis-onUpdateTime-tooltip",t.appendChild(i),this.dom.onItemUpdateTimeTooltip=i}else!this.selected&&this.dom.onItemUpdateTimeTooltip&&(this.dom.onItemUpdateTimeTooltip.parentNode&&this.dom.onItemUpdateTimeTooltip.parentNode.removeChild(this.dom.onItemUpdateTimeTooltip),this.dom.onItemUpdateTimeTooltip=null);if(this.dom.onItemUpdateTimeTooltip){this.dom.onItemUpdateTimeTooltip.style.visibility=this.parent.itemSet.touchParams.itemIsDragging?"visible":"hidden",this.options.rtl?this.dom.onItemUpdateTimeTooltip.style.right=this.dom.content.style.right:this.dom.onItemUpdateTimeTooltip.style.left=this.dom.content.style.left;var o,n=50,s=this.parent.itemSet.body.domProps.scrollTop;o="top"==this.options.orientation.item?this.top:this.parent.height-this.top-this.height;var r=o+this.parent.top-n<-s;r?(this.dom.onItemUpdateTimeTooltip.style.bottom="",this.dom.onItemUpdateTimeTooltip.style.top=this.height+2+"px"):(this.dom.onItemUpdateTimeTooltip.style.top="",this.dom.onItemUpdateTimeTooltip.style.bottom=this.height+2+"px");var a,h;this.options.tooltipOnItemUpdateTime&&this.options.tooltipOnItemUpdateTime.template?(h=this.options.tooltipOnItemUpdateTime.template.bind(this),a=h(this.data)):(a="start: "+u(this.data.start).format("MM/DD/YYYY hh:mm"),this.data.end&&(a+="<br> end: "+u(this.data.end).format("MM/DD/YYYY hh:mm"))),this.dom.onItemUpdateTimeTooltip.innerHTML=a}}},n.prototype._updateContents=function(t){var e,i,o,n,s=this.parent.itemSet.itemsData.get(this.id),r=this.dom.box||this.dom.point,a=r.getElementsByClassName("vis-item-visible-frame")[0];if(this.options.visibleFrameTemplate?(n=this.options.visibleFrameTemplate.bind(this),o=n(s,r)):o="",a)if(o instanceof Object&&!(o instanceof Element))n(s,a);else{var h=this._contentToString(this.itemVisibleFrameContent)!==this._contentToString(o);if(h){if(o instanceof Element)a.innerHTML="",a.appendChild(o);else if(void 0!=o)a.innerHTML=o;else if("background"!=this.data.type||void 0!==this.data.content)throw new Error('Property "content" missing in item '+this.id);this.itemVisibleFrameContent=o}}if(this.options.template?(i=this.options.template.bind(this),e=i(s,t)):e=this.data.content,e instanceof Object&&!(e instanceof Element))i(s,t);else{var h=this._contentToString(this.content)!==this._contentToString(e);if(h){if(e instanceof Element)t.innerHTML="",t.appendChild(e);else if(void 0!=e)t.innerHTML=e;else if("background"!=this.data.type||void 0!==this.data.content)throw new Error('Property "content" missing in item '+this.id);this.content=e}}},n.prototype._updateTitle=function(){null!=this.data.title&&null!=this.popup&&this.popup.setText(this.data.title||"")},n.prototype._updateDataAttributes=function(t){if(this.options.dataAttributes&&this.options.dataAttributes.length>0){var e=[];if(Array.isArray(this.options.dataAttributes))e=this.options.dataAttributes;else{if("all"!=this.options.dataAttributes)return;e=(0,r.default)(this.data)}for(var i=0;i<e.length;i++){var o=e[i],n=this.data[o];null!=n?t.setAttribute("data-"+o,n):t.removeAttribute("data-"+o)}}},n.prototype._updateStyle=function(t){this.style&&(l.removeCssText(t,this.style),this.style=null),this.data.style&&(l.addCssText(t,this.data.style),this.style=this.data.style)},n.prototype._contentToString=function(t){return"string"==typeof t?t:t&&"outerHTML"in t?t.outerHTML:t},n.prototype.getWidthLeft=function(){return 0},n.prototype.getWidthRight=function(){return 0},n.prototype.getTitle=function(){return this.data.title},n.prototype.setPopup=function(t){this.popup=t,this._updateTitle()},t.exports=n},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i){a.call(this,t,e,i),this.width=0,this.height=0,this.top=0,this.left=0}var s=i(55),r=o(s),a=(i(1),i(130));n.prototype=(0,r.default)(a.prototype),n.prototype.redraw=function(t,e,i){var o=!1;this.visibleItems=this._updateItemsInRange(this.orderedItems,this.visibleItems,t),this.width=this.dom.background.offsetWidth,this.dom.background.style.height="0";for(var n=0,s=this.visibleItems.length;n<s;n++){var r=this.visibleItems[n];r.repositionY(e)}return o},n.prototype.show=function(){this.dom.background.parentNode||this.itemSet.dom.background.appendChild(this.dom.background)},t.exports=n},function(t,e,i){function o(t,e,i){if(this.props={dot:{width:0,height:0},line:{width:0,height:0}},this.options=i,t&&void 0==t.start)throw new Error('Property "start" missing in item '+t);n.call(this,t,e,i)}var n=i(133);i(1);o.prototype=new n(null,null,null),o.prototype.isVisible=function(t){var e,i=this.options.align,o=(t.end-t.start)/t.body.dom.center.clientWidth,n=this.width*o;return e="right"==i?this.data.start.getTime()>t.start&&this.data.start.getTime()-n<t.end:"left"==i?this.data.start.getTime()+n>t.start&&this.data.start.getTime()<t.end:this.data.start.getTime()+n/2>t.start&&this.data.start.getTime()-n/2<t.end},o.prototype.redraw=function(){var t=this.dom;if(t||(this.dom={},t=this.dom,t.box=document.createElement("DIV"),t.content=document.createElement("DIV"),t.content.className="vis-item-content",t.box.appendChild(t.content),t.line=document.createElement("DIV"),t.line.className="vis-line",t.dot=document.createElement("DIV"),t.dot.className="vis-dot",t.box["timeline-item"]=this,this.dirty=!0),!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!t.box.parentNode){var e=this.parent.dom.foreground;if(!e)throw new Error("Cannot redraw item: parent has no foreground container element");e.appendChild(t.box)}if(!t.line.parentNode){var i=this.parent.dom.background;if(!i)throw new Error("Cannot redraw item: parent has no background container element");i.appendChild(t.line)}if(!t.dot.parentNode){var o=this.parent.dom.axis;if(!i)throw new Error("Cannot redraw item: parent has no axis container element");o.appendChild(t.dot)}if(this.displayed=!0,this.dirty){this._updateContents(this.dom.content),this._updateTitle(),this._updateDataAttributes(this.dom.box),this._updateStyle(this.dom.box);var n=(this.options.editable.updateTime||this.options.editable.updateGroup||this.editable===!0)&&this.editable!==!1,s=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"")+(n?" vis-editable":" vis-readonly");t.box.className="vis-item vis-box"+s,t.line.className="vis-item vis-line"+s,t.dot.className="vis-item vis-dot"+s;var r=t.box.style.right,a=t.box.style.left;this.options.rtl?t.box.style.right="0px":t.box.style.left="0px",this.props.dot.height=t.dot.offsetHeight,this.props.dot.width=t.dot.offsetWidth,this.props.line.width=t.line.offsetWidth,this.width=t.box.offsetWidth,this.height=t.box.offsetHeight,this.options.rtl?t.box.style.right=r:t.box.style.left=a,this.dirty=!1}this._repaintOnItemUpdateTimeTooltip(t.box),this._repaintDragCenter(),this._repaintDeleteButton(t.box)},o.prototype.show=function(){this.displayed||this.redraw()},o.prototype.hide=function(){if(this.displayed){var t=this.dom;t.box.parentNode&&t.box.parentNode.removeChild(t.box),t.line.parentNode&&t.line.parentNode.removeChild(t.line),t.dot.parentNode&&t.dot.parentNode.removeChild(t.dot),this.displayed=!1}},o.prototype.repositionX=function(){var t=this.conversion.toScreen(this.data.start),e=this.options.align;"right"==e?this.options.rtl?(this.right=t-this.width,this.dom.box.style.right=this.right+"px",this.dom.line.style.right=t-this.props.line.width+"px",this.dom.dot.style.right=t-this.props.line.width/2-this.props.dot.width/2+"px"):(this.left=t-this.width,this.dom.box.style.left=this.left+"px",this.dom.line.style.left=t-this.props.line.width+"px",this.dom.dot.style.left=t-this.props.line.width/2-this.props.dot.width/2+"px"):"left"==e?this.options.rtl?(this.right=t,this.dom.box.style.right=this.right+"px",this.dom.line.style.right=t+"px",this.dom.dot.style.right=t+this.props.line.width/2-this.props.dot.width/2+"px"):(this.left=t,this.dom.box.style.left=this.left+"px",this.dom.line.style.left=t+"px",this.dom.dot.style.left=t+this.props.line.width/2-this.props.dot.width/2+"px"):this.options.rtl?(this.right=t-this.width/2,this.dom.box.style.right=this.right+"px",this.dom.line.style.right=t-this.props.line.width+"px",this.dom.dot.style.right=t-this.props.dot.width/2+"px"):(this.left=t-this.width/2,this.dom.box.style.left=this.left+"px",this.dom.line.style.left=t-this.props.line.width/2+"px",this.dom.dot.style.left=t-this.props.dot.width/2+"px")},o.prototype.repositionY=function(){var t=this.options.orientation.item,e=this.dom.box,i=this.dom.line,o=this.dom.dot;if("top"==t)e.style.top=(this.top||0)+"px",i.style.top="0",i.style.height=this.parent.top+this.top+1+"px",i.style.bottom="";else{var n=this.parent.itemSet.props.height,s=n-this.parent.top-this.parent.height+this.top;e.style.top=(this.parent.height-this.top-this.height||0)+"px",i.style.top=n-s+"px",i.style.bottom="0"}o.style.top=-this.props.dot.height/2+"px"},o.prototype.getWidthLeft=function(){return this.width/2},o.prototype.getWidthRight=function(){return this.width/2},t.exports=o},function(t,e,i){function o(t,e,i){if(this.props={dot:{top:0,width:0,height:0},content:{height:0,marginLeft:0,marginRight:0}},this.options=i,t&&void 0==t.start)throw new Error('Property "start" missing in item '+t);n.call(this,t,e,i)}var n=i(133);o.prototype=new n(null,null,null),o.prototype.isVisible=function(t){var e=(t.end-t.start)/t.body.dom.center.clientWidth,i=this.width*e;return this.data.start.getTime()+i>t.start&&this.data.start<t.end},o.prototype.redraw=function(){var t=this.dom;if(t||(this.dom={},t=this.dom,t.point=document.createElement("div"),t.content=document.createElement("div"),t.content.className="vis-item-content",t.point.appendChild(t.content),t.dot=document.createElement("div"),t.point.appendChild(t.dot),t.point["timeline-item"]=this,this.dirty=!0),!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!t.point.parentNode){var e=this.parent.dom.foreground;if(!e)throw new Error("Cannot redraw item: parent has no foreground container element");e.appendChild(t.point)}if(this.displayed=!0,this.dirty){this._updateContents(this.dom.content),this._updateTitle(),this._updateDataAttributes(this.dom.point),this._updateStyle(this.dom.point);var i=(this.options.editable.updateTime||this.options.editable.updateGroup||this.editable===!0)&&this.editable!==!1,o=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"")+(i?" vis-editable":" vis-readonly");t.point.className="vis-item vis-point"+o,t.dot.className="vis-item vis-dot"+o,this.props.dot.width=t.dot.offsetWidth,this.props.dot.height=t.dot.offsetHeight,this.props.content.height=t.content.offsetHeight,this.options.rtl?t.content.style.marginRight=2*this.props.dot.width+"px":t.content.style.marginLeft=2*this.props.dot.width+"px",this.width=t.point.offsetWidth,this.height=t.point.offsetHeight,t.dot.style.top=(this.height-this.props.dot.height)/2+"px",this.options.rtl?t.dot.style.right=this.props.dot.width/2+"px":t.dot.style.left=this.props.dot.width/2+"px",this.dirty=!1}this._repaintOnItemUpdateTimeTooltip(t.point),this._repaintDragCenter(),this._repaintDeleteButton(t.point)},o.prototype.show=function(){this.displayed||this.redraw()},o.prototype.hide=function(){this.displayed&&(this.dom.point.parentNode&&this.dom.point.parentNode.removeChild(this.dom.point),this.displayed=!1)},o.prototype.repositionX=function(){var t=this.conversion.toScreen(this.data.start);this.options.rtl?(this.right=t-this.props.dot.width,this.dom.point.style.right=this.right+"px"):(this.left=t-this.props.dot.width,this.dom.point.style.left=this.left+"px")},o.prototype.repositionY=function(){var t=this.options.orientation.item,e=this.dom.point;"top"==t?e.style.top=this.top+"px":e.style.top=this.parent.height-this.top-this.height+"px"},o.prototype.getWidthLeft=function(){return this.props.dot.width},o.prototype.getWidthRight=function(){return this.props.dot.width},t.exports=o},function(t,e,i){function o(t,e,i){if(this.props={content:{width:0}},this.overflow=!1,t){if(void 0==t.start)throw new Error('Property "start" missing in item '+t.id);if(void 0==t.end)throw new Error('Property "end" missing in item '+t.id)}n.call(this,t,e,i)}var n=(i(108),i(133)),s=i(134),r=i(132);o.prototype=new n(null,null,null),o.prototype.baseClassName="vis-item vis-background",o.prototype.stack=!1,o.prototype.isVisible=function(t){return this.data.start<t.end&&this.data.end>t.start},o.prototype.redraw=function(){var t=this.dom;if(t||(this.dom={},t=this.dom,t.box=document.createElement("div"),t.frame=document.createElement("div"),t.frame.className="vis-item-overflow",t.box.appendChild(t.frame),t.content=document.createElement("div"),t.content.className="vis-item-content",t.frame.appendChild(t.content),this.dirty=!0),!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!t.box.parentNode){var e=this.parent.dom.background;if(!e)throw new Error("Cannot redraw item: parent has no background container element");e.appendChild(t.box)}if(this.displayed=!0,this.dirty){this._updateContents(this.dom.content),this._updateTitle(),this._updateDataAttributes(this.dom.content),this._updateStyle(this.dom.box);var i=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"");t.box.className=this.baseClassName+i,this.overflow="hidden"!==window.getComputedStyle(t.content).overflow,this.props.content.width=this.dom.content.offsetWidth,this.height=0,this.dirty=!1}},o.prototype.show=r.prototype.show,o.prototype.hide=r.prototype.hide,o.prototype.repositionX=r.prototype.repositionX,o.prototype.repositionY=function(t){var e;if(void 0!==this.data.subgroup){var i=this.data.subgroup,o=this.parent.subgroups;o[i].index;this.dom.box.style.height=this.parent.subgroups[i].height+"px";var n=this.options.orientation.item;"top"==n?this.dom.box.style.top=this.parent.top+this.parent.subgroups[i].top+"px":this.dom.box.style.top=this.parent.top+this.parent.height-this.parent.subgroups[i].top-this.parent.subgroups[i].height+"px",this.dom.box.style.bottom=""}else this.parent instanceof s?(e=Math.max(this.parent.height,this.parent.itemSet.body.domProps.center.height,this.parent.itemSet.body.domProps.centerContainer.height),this.dom.box.style.top="top"==n?"0":"",this.dom.box.style.bottom="top"==n?"":"0"):(e=this.parent.height,this.dom.box.style.top=this.parent.top+"px",this.dom.box.style.bottom="");this.dom.box.style.height=e+"px"},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){this.dom={foreground:null,lines:[],majorTexts:[],minorTexts:[],redundant:{lines:[],majorTexts:[],minorTexts:[]}},this.props={range:{start:0,end:0,minimumStep:0},lineTop:0},this.defaultOptions={orientation:{axis:"bottom"},showMinorLabels:!0,showMajorLabels:!0,maxMinorChars:7,format:d.FORMAT,moment:u,timeAxis:null},this.options=a.extend({},this.defaultOptions),this.body=t,this._create(),this.setOptions(e)}var s=i(62),r=o(s),a=i(1),h=i(124),d=i(129),l=i(125),u=i(84);n.prototype=new h,n.prototype.setOptions=function(t){t&&(a.selectiveExtend(["showMinorLabels","showMajorLabels","maxMinorChars","hiddenDates","timeAxis","moment","rtl"],this.options,t),a.selectiveDeepExtend(["format"],this.options,t),"orientation"in t&&("string"==typeof t.orientation?this.options.orientation.axis=t.orientation:"object"===(0,r.default)(t.orientation)&&"axis"in t.orientation&&(this.options.orientation.axis=t.orientation.axis)),"locale"in t&&("function"==typeof u.locale?u.locale(t.locale):u.lang(t.locale)))},n.prototype._create=function(){this.dom.foreground=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.foreground.className="vis-time-axis vis-foreground",this.dom.background.className="vis-time-axis vis-background"},n.prototype.destroy=function(){this.dom.foreground.parentNode&&this.dom.foreground.parentNode.removeChild(this.dom.foreground),this.dom.background.parentNode&&this.dom.background.parentNode.removeChild(this.dom.background),this.body=null},n.prototype.redraw=function(){var t=this.props,e=this.dom.foreground,i=this.dom.background,o="top"==this.options.orientation.axis?this.body.dom.top:this.body.dom.bottom,n=e.parentNode!==o;this._calculateCharSize();var s=this.options.showMinorLabels&&"none"!==this.options.orientation.axis,r=this.options.showMajorLabels&&"none"!==this.options.orientation.axis;t.minorLabelHeight=s?t.minorCharHeight:0,t.majorLabelHeight=r?t.majorCharHeight:0,t.height=t.minorLabelHeight+t.majorLabelHeight,t.width=e.offsetWidth,t.minorLineHeight=this.body.domProps.root.height-t.majorLabelHeight-("top"==this.options.orientation.axis?this.body.domProps.bottom.height:this.body.domProps.top.height),t.minorLineWidth=1,t.majorLineHeight=t.minorLineHeight+t.majorLabelHeight,t.majorLineWidth=1;var a=e.nextSibling,h=i.nextSibling;return e.parentNode&&e.parentNode.removeChild(e),i.parentNode&&i.parentNode.removeChild(i),e.style.height=this.props.height+"px",this._repaintLabels(),a?o.insertBefore(e,a):o.appendChild(e),h?this.body.dom.backgroundVertical.insertBefore(i,h):this.body.dom.backgroundVertical.appendChild(i),this._isResized()||n},n.prototype._repaintLabels=function(){var t=this.options.orientation.axis,e=a.convert(this.body.range.start,"Number"),i=a.convert(this.body.range.end,"Number"),o=this.body.util.toTime((this.props.minorCharWidth||10)*this.options.maxMinorChars).valueOf(),n=o-l.getHiddenDurationBefore(this.options.moment,this.body.hiddenDates,this.body.range,o);n-=this.body.util.toTime(0).valueOf();var s=new d(new Date(e),new Date(i),n,this.body.hiddenDates);s.setMoment(this.options.moment),this.options.format&&s.setFormat(this.options.format),this.options.timeAxis&&s.setScale(this.options.timeAxis),this.step=s;var r=this.dom;r.redundant.lines=r.lines,r.redundant.majorTexts=r.majorTexts,r.redundant.minorTexts=r.minorTexts,r.lines=[],r.majorTexts=[],r.minorTexts=[];var h,u,p,f,m,v,g,y,b,_,w=0,x=void 0,k=0,O=1e3;for(s.start(),u=s.getCurrent(),f=this.body.util.toScreen(u);s.hasNext()&&k<O;){k++,m=s.isMajor(),_=s.getClassName(),b=s.getLabelMinor(),h=u,p=f,s.next(),u=s.getCurrent(),v=s.isMajor(),f=this.body.util.toScreen(u),g=w,w=f-p;var D=w>=.4*g;if(this.options.showMinorLabels&&D){var S=this._repaintMinorText(p,b,t,_);S.style.width=w+"px"}m&&this.options.showMajorLabels?(p>0&&(void 0==x&&(x=p),S=this._repaintMajorText(p,s.getLabelMajor(),t,_)),y=this._repaintMajorLine(p,w,t,_)):D?y=this._repaintMinorLine(p,w,t,_):y&&(y.style.width=parseInt(y.style.width)+w+"px")}if(k!==O||c||(console.warn("Something is wrong with the Timeline scale. Limited drawing of grid lines to "+O+" lines."),c=!0),this.options.showMajorLabels){var M=this.body.util.toTime(0),C=s.getLabelMajor(M),T=C.length*(this.props.majorCharWidth||10)+10;(void 0==x||T<x)&&this._repaintMajorText(0,C,t,_)}a.forEach(this.dom.redundant,function(t){
+for(;t.length;){var e=t.pop();e&&e.parentNode&&e.parentNode.removeChild(e)}})},n.prototype._repaintMinorText=function(t,e,i,o){var n=this.dom.redundant.minorTexts.shift();if(!n){var s=document.createTextNode("");n=document.createElement("div"),n.appendChild(s),this.dom.foreground.appendChild(n)}return this.dom.minorTexts.push(n),n.innerHTML=e,n.style.top="top"==i?this.props.majorLabelHeight+"px":"0",this.options.rtl?(n.style.left="",n.style.right=t+"px"):n.style.left=t+"px",n.className="vis-text vis-minor "+o,n},n.prototype._repaintMajorText=function(t,e,i,o){var n=this.dom.redundant.majorTexts.shift();if(!n){var s=document.createElement("div");n=document.createElement("div"),n.appendChild(s),this.dom.foreground.appendChild(n)}return n.childNodes[0].innerHTML=e,n.className="vis-text vis-major "+o,n.style.top="top"==i?"0":this.props.minorLabelHeight+"px",this.options.rtl?(n.style.left="",n.style.right=t+"px"):n.style.left=t+"px",this.dom.majorTexts.push(n),n},n.prototype._repaintMinorLine=function(t,e,i,o){var n=this.dom.redundant.lines.shift();n||(n=document.createElement("div"),this.dom.background.appendChild(n)),this.dom.lines.push(n);var s=this.props;return"top"==i?n.style.top=s.majorLabelHeight+"px":n.style.top=this.body.domProps.top.height+"px",n.style.height=s.minorLineHeight+"px",this.options.rtl?(n.style.left="",n.style.right=t-s.minorLineWidth/2+"px",n.className="vis-grid vis-vertical-rtl vis-minor "+o):(n.style.left=t-s.minorLineWidth/2+"px",n.className="vis-grid vis-vertical vis-minor "+o),n.style.width=e+"px",n},n.prototype._repaintMajorLine=function(t,e,i,o){var n=this.dom.redundant.lines.shift();n||(n=document.createElement("div"),this.dom.background.appendChild(n)),this.dom.lines.push(n);var s=this.props;return"top"==i?n.style.top="0":n.style.top=this.body.domProps.top.height+"px",this.options.rtl?(n.style.left="",n.style.right=t-s.majorLineWidth/2+"px",n.className="vis-grid vis-vertical-rtl vis-major "+o):(n.style.left=t-s.majorLineWidth/2+"px",n.className="vis-grid vis-vertical vis-major "+o),n.style.height=s.majorLineHeight+"px",n.style.width=e+"px",n},n.prototype._calculateCharSize=function(){this.dom.measureCharMinor||(this.dom.measureCharMinor=document.createElement("DIV"),this.dom.measureCharMinor.className="vis-text vis-minor vis-measure",this.dom.measureCharMinor.style.position="absolute",this.dom.measureCharMinor.appendChild(document.createTextNode("0")),this.dom.foreground.appendChild(this.dom.measureCharMinor)),this.props.minorCharHeight=this.dom.measureCharMinor.clientHeight,this.props.minorCharWidth=this.dom.measureCharMinor.clientWidth,this.dom.measureCharMajor||(this.dom.measureCharMajor=document.createElement("DIV"),this.dom.measureCharMajor.className="vis-text vis-major vis-measure",this.dom.measureCharMajor.style.position="absolute",this.dom.measureCharMajor.appendChild(document.createTextNode("0")),this.dom.foreground.appendChild(this.dom.measureCharMajor)),this.props.majorCharHeight=this.dom.measureCharMajor.clientHeight,this.props.majorCharWidth=this.dom.measureCharMajor.clientWidth};var c=!1;t.exports=n},function(t,e,i){function o(t){this.active=!1,this.dom={container:t},this.dom.overlay=document.createElement("div"),this.dom.overlay.className="vis-overlay",this.dom.container.appendChild(this.dom.overlay),this.hammer=a(this.dom.overlay),this.hammer.on("tap",this._onTapOverlay.bind(this));var e=this,i=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];i.forEach(function(t){e.hammer.on(t,function(t){t.stopPropagation()})}),document&&document.body&&(this.onClick=function(i){n(i.target,t)||e.deactivate()},document.body.addEventListener("click",this.onClick)),void 0!==this.keycharm&&this.keycharm.destroy(),this.keycharm=s(),this.escListener=this.deactivate.bind(this)}function n(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}var s=i(111),r=i(95),a=i(108),h=i(1);r(o.prototype),o.current=null,o.prototype.destroy=function(){this.deactivate(),this.dom.overlay.parentNode.removeChild(this.dom.overlay),this.onClick&&document.body.removeEventListener("click",this.onClick),this.hammer.destroy(),this.hammer=null},o.prototype.activate=function(){o.current&&o.current.deactivate(),o.current=this,this.active=!0,this.dom.overlay.style.display="none",h.addClassName(this.dom.container,"vis-active"),this.emit("change"),this.emit("activate"),this.keycharm.bind("esc",this.escListener)},o.prototype.deactivate=function(){this.active=!1,this.dom.overlay.style.display="",h.removeClassName(this.dom.container,"vis-active"),this.keycharm.unbind("esc",this.escListener),this.emit("change"),this.emit("deactivate")},o.prototype._onTapOverlay=function(t){this.activate(),t.stopPropagation()},t.exports=o},function(t,e,i){function o(t,e){this.body=t,this.defaultOptions={moment:a,locales:h,locale:"en",id:void 0,title:void 0},this.options=s.extend({},this.defaultOptions),e&&e.time?this.customTime=e.time:this.customTime=new Date,this.eventParams={},this.setOptions(e),this._create()}var n=i(108),s=i(1),r=i(124),a=i(84),h=i(141);o.prototype=new r,o.prototype.setOptions=function(t){t&&s.selectiveExtend(["moment","locale","locales","id"],this.options,t)},o.prototype._create=function(){function t(t){this.body.range._onMouseWheel(t)}var e=document.createElement("div");e["custom-time"]=this,e.className="vis-custom-time "+(this.options.id||""),e.style.position="absolute",e.style.top="0px",e.style.height="100%",this.bar=e;var i=document.createElement("div");i.style.position="relative",i.style.top="0px",i.style.left="-10px",i.style.height="100%",i.style.width="20px",i.addEventListener?(i.addEventListener("mousewheel",t.bind(this),!1),i.addEventListener("DOMMouseScroll",t.bind(this),!1)):i.attachEvent("onmousewheel",t.bind(this)),e.appendChild(i),this.hammer=new n(i),this.hammer.on("panstart",this._onDragStart.bind(this)),this.hammer.on("panmove",this._onDrag.bind(this)),this.hammer.on("panend",this._onDragEnd.bind(this)),this.hammer.get("pan").set({threshold:5,direction:n.DIRECTION_HORIZONTAL})},o.prototype.destroy=function(){this.hide(),this.hammer.destroy(),this.hammer=null,this.body=null},o.prototype.redraw=function(){var t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar));var e=this.body.util.toScreen(this.customTime),i=this.options.locales[this.options.locale];i||(this.warned||(console.log("WARNING: options.locales['"+this.options.locale+"'] not found. See http://visjs.org/docs/timeline/#Localization"),this.warned=!0),i=this.options.locales.en);var o=this.options.title;return void 0===o&&(o=i.time+": "+this.options.moment(this.customTime).format("dddd, MMMM Do YYYY, H:mm:ss"),o=o.charAt(0).toUpperCase()+o.substring(1)),this.bar.style.left=e+"px",this.bar.title=o,!1},o.prototype.hide=function(){this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar)},o.prototype.setCustomTime=function(t){this.customTime=s.convert(t,"Date"),this.redraw()},o.prototype.getCustomTime=function(){return new Date(this.customTime.valueOf())},o.prototype.setCustomTitle=function(t){this.options.title=t},o.prototype._onDragStart=function(t){this.eventParams.dragging=!0,this.eventParams.customTime=this.customTime,t.stopPropagation()},o.prototype._onDrag=function(t){if(this.eventParams.dragging){var e=this.body.util.toScreen(this.eventParams.customTime)+t.deltaX,i=this.body.util.toTime(e);this.setCustomTime(i),this.body.emitter.emit("timechange",{id:this.options.id,time:new Date(this.customTime.valueOf()),event:s.elementsCensor(t)}),t.stopPropagation()}},o.prototype._onDragEnd=function(t){this.eventParams.dragging&&(this.body.emitter.emit("timechanged",{id:this.options.id,time:new Date(this.customTime.valueOf()),event:s.elementsCensor(t)}),t.stopPropagation())},o.customTimeFromTarget=function(t){for(var e=t.target;e;){if(e.hasOwnProperty("custom-time"))return e["custom-time"];e=e.parentNode}return null},t.exports=o},function(t,e){e.en={current:"current",time:"time"},e.en_EN=e.en,e.en_US=e.en,e.it={current:"attuale",time:"tempo"},e.it_IT=e.it,e.it_CH=e.it,e.nl={current:"huidige",time:"tijd"},e.nl_NL=e.nl,e.nl_BE=e.nl,e.de={current:"Aktuelle",time:"Zeit"},e.de_DE=e.de},function(t,e,i){function o(t,e){this.body=t,this.defaultOptions={rtl:!1,showCurrentTime:!0,moment:r,locales:a,locale:"en"},this.options=n.extend({},this.defaultOptions),this.offset=0,this._create(),this.setOptions(e)}var n=i(1),s=i(124),r=i(84),a=i(141);o.prototype=new s,o.prototype._create=function(){var t=document.createElement("div");t.className="vis-current-time",t.style.position="absolute",t.style.top="0px",t.style.height="100%",this.bar=t},o.prototype.destroy=function(){this.options.showCurrentTime=!1,this.redraw(),this.body=null},o.prototype.setOptions=function(t){t&&n.selectiveExtend(["rtl","showCurrentTime","moment","locale","locales"],this.options,t)},o.prototype.redraw=function(){if(this.options.showCurrentTime){var t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar),this.start());var e=this.options.moment((new Date).valueOf()+this.offset),i=this.body.util.toScreen(e),o=this.options.locales[this.options.locale];o||(this.warned||(console.log("WARNING: options.locales['"+this.options.locale+"'] not found. See http://visjs.org/docs/timeline/#Localization"),this.warned=!0),o=this.options.locales.en);var n=o.current+" "+o.time+": "+e.format("dddd, MMMM Do YYYY, H:mm:ss");n=n.charAt(0).toUpperCase()+n.substring(1),this.options.rtl?this.bar.style.right=i+"px":this.bar.style.left=i+"px",this.bar.title=n}else this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),this.stop();return!1},o.prototype.start=function(){function t(){e.stop();var i=e.body.range.conversion(e.body.domProps.center.width).scale,o=1/i/10;o<30&&(o=30),o>1e3&&(o=1e3),e.redraw(),e.body.emitter.emit("currentTimeTick"),e.currentTimeTimer=setTimeout(t,o)}var e=this;t()},o.prototype.stop=function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),delete this.currentTimeTimer)},o.prototype.setCurrentTime=function(t){var e=n.convert(t,"Date").valueOf(),i=(new Date).valueOf();this.offset=e-i,this.redraw()},o.prototype.getCurrentTime=function(){return new Date((new Date).valueOf()+this.offset)},t.exports=o},function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var i="string",o="boolean",n="number",s="array",r="date",a="object",h="dom",d="moment",l="any",u={configure:{enabled:{boolean:o},filter:{boolean:o,function:"function"},container:{dom:h},__type__:{object:a,boolean:o,function:"function"}},align:{string:i},rtl:{boolean:o,undefined:"undefined"},rollingMode:{boolean:o,undefined:"undefined"},verticalScroll:{boolean:o,undefined:"undefined"},horizontalScroll:{boolean:o,undefined:"undefined"},autoResize:{boolean:o},throttleRedraw:{number:n},clickToUse:{boolean:o},dataAttributes:{string:i,array:s},editable:{add:{boolean:o,undefined:"undefined"},remove:{boolean:o,undefined:"undefined"},updateGroup:{boolean:o,undefined:"undefined"},updateTime:{boolean:o,undefined:"undefined"},overrideItems:{boolean:o,undefined:"undefined"},__type__:{boolean:o,object:a}},end:{number:n,date:r,string:i,moment:d},format:{minorLabels:{millisecond:{string:i,undefined:"undefined"},second:{string:i,undefined:"undefined"},minute:{string:i,undefined:"undefined"},hour:{string:i,undefined:"undefined"},weekday:{string:i,undefined:"undefined"},day:{string:i,undefined:"undefined"},month:{string:i,undefined:"undefined"},year:{string:i,undefined:"undefined"},__type__:{object:a,function:"function"}},majorLabels:{millisecond:{string:i,undefined:"undefined"},second:{string:i,undefined:"undefined"},minute:{string:i,undefined:"undefined"},hour:{string:i,undefined:"undefined"},weekday:{string:i,undefined:"undefined"},day:{string:i,undefined:"undefined"},month:{string:i,undefined:"undefined"},year:{string:i,undefined:"undefined"},__type__:{object:a,function:"function"}},__type__:{object:a}},moment:{function:"function"},groupOrder:{string:i,function:"function"},groupEditable:{add:{boolean:o,undefined:"undefined"},remove:{boolean:o,undefined:"undefined"},order:{boolean:o,undefined:"undefined"},__type__:{boolean:o,object:a}},groupOrderSwap:{function:"function"},height:{string:i,number:n},hiddenDates:{start:{date:r,number:n,string:i,moment:d},end:{date:r,number:n,string:i,moment:d},repeat:{string:i},__type__:{object:a,array:s}},itemsAlwaysDraggable:{boolean:o},locale:{string:i},locales:{__any__:{any:l},__type__:{object:a}},margin:{axis:{number:n},item:{horizontal:{number:n,undefined:"undefined"},vertical:{number:n,undefined:"undefined"},__type__:{object:a,number:n}},__type__:{object:a,number:n}},max:{date:r,number:n,string:i,moment:d},maxHeight:{number:n,string:i},maxMinorChars:{number:n},min:{date:r,number:n,string:i,moment:d},minHeight:{number:n,string:i},moveable:{boolean:o},multiselect:{boolean:o},multiselectPerGroup:{boolean:o},onAdd:{function:"function"},onUpdate:{function:"function"},onMove:{function:"function"},onMoving:{function:"function"},onRemove:{function:"function"},onAddGroup:{function:"function"},onMoveGroup:{function:"function"},onRemoveGroup:{function:"function"},order:{function:"function"},orientation:{axis:{string:i,undefined:"undefined"},item:{string:i,undefined:"undefined"},__type__:{string:i,object:a}},selectable:{boolean:o},showCurrentTime:{boolean:o},showMajorLabels:{boolean:o},showMinorLabels:{boolean:o},stack:{boolean:o},stackSubgroups:{boolean:o},snap:{function:"function",null:"null"},start:{date:r,number:n,string:i,moment:d},template:{function:"function"},groupTemplate:{function:"function"},visibleFrameTemplate:{string:i,function:"function"},tooltip:{followMouse:{boolean:o},overflowMethod:{string:["cap","flip"]},__type__:{object:a}},tooltipOnItemUpdateTime:{template:{function:"function"},__type__:{boolean:o,object:a}},timeAxis:{scale:{string:i,undefined:"undefined"},step:{number:n,undefined:"undefined"},__type__:{object:a}},type:{string:i},width:{string:i,number:n},zoomable:{boolean:o},zoomKey:{string:["ctrlKey","altKey","metaKey",""]},zoomMax:{number:n},zoomMin:{number:n},__type__:{object:a}},c={global:{align:["center","left","right"],direction:!1,autoResize:!0,clickToUse:!1,editable:{add:!1,remove:!1,updateGroup:!1,updateTime:!1},end:"",format:{minorLabels:{millisecond:"SSS",second:"s",minute:"HH:mm",hour:"HH:mm",weekday:"ddd D",day:"D",month:"MMM",year:"YYYY"},majorLabels:{millisecond:"HH:mm:ss",second:"D MMMM HH:mm",minute:"ddd D MMMM",hour:"ddd D MMMM",weekday:"MMMM YYYY",day:"MMMM YYYY",month:"YYYY",year:""}},groupsDraggable:!1,height:"",locale:"",margin:{axis:[20,0,100,1],item:{horizontal:[10,0,100,1],vertical:[10,0,100,1]}},max:"",maxHeight:"",maxMinorChars:[7,0,20,1],min:"",minHeight:"",moveable:!1,multiselect:!1,multiselectPerGroup:!1,orientation:{axis:["both","bottom","top"],item:["bottom","top"]},selectable:!0,showCurrentTime:!1,showMajorLabels:!0,showMinorLabels:!0,stack:!0,stackSubgroups:!0,start:"",tooltip:{followMouse:!1,overflowMethod:"flip"},tooltipOnItemUpdateTime:!1,type:["box","point","range","background"],width:"100%",zoomable:!0,zoomKey:["ctrlKey","altKey","metaKey",""],zoomMax:[31536e10,10,31536e10,1],zoomMin:[10,10,31536e10,1]}};e.allOptions=u,e.configureOptions=c},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i,o){if(!(Array.isArray(i)||i instanceof u||i instanceof c)&&i instanceof Object){var n=o;o=i,i=n}o&&o.throttleRedraw&&console.warn('Graph2d option "throttleRedraw" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release.');var s=this;this.defaultOptions={start:null,end:null,autoResize:!0,orientation:{axis:"bottom",item:"bottom"},moment:d,width:null,height:null,maxHeight:null,minHeight:null},this.options=l.deepExtend({},this.defaultOptions),this._create(t),this.components=[],this.body={dom:this.dom,domProps:this.props,emitter:{on:this.on.bind(this),off:this.off.bind(this),emit:this.emit.bind(this)},hiddenDates:[],util:{toScreen:s._toScreen.bind(s),toGlobalScreen:s._toGlobalScreen.bind(s),toTime:s._toTime.bind(s),toGlobalTime:s._toGlobalTime.bind(s)}},this.range=new p(this.body),this.components.push(this.range),this.body.range=this.range,this.timeAxis=new m(this.body),this.components.push(this.timeAxis),this.currentTime=new v(this.body),this.components.push(this.currentTime),this.linegraph=new y(this.body),this.components.push(this.linegraph),this.itemsData=null,this.groupsData=null,this.on("tap",function(t){s.emit("click",s.getEventProperties(t))}),this.on("doubletap",function(t){s.emit("doubleClick",s.getEventProperties(t))}),this.dom.root.oncontextmenu=function(t){s.emit("contextmenu",s.getEventProperties(t))},o&&this.setOptions(o),i&&this.setGroups(i),e&&this.setItems(e),this._redraw()}var s=i(114),r=o(s),a=i(122),h=o(a),d=(i(95),i(108),i(84)),l=i(1),u=i(91),c=i(93),p=i(123),f=i(126),m=i(138),v=i(142),g=i(140),y=i(145),b=i(122).printStyle,_=i(153).allOptions,w=i(153).configureOptions;n.prototype=new f,n.prototype.setOptions=function(t){var e=h.default.validate(t,_);e===!0&&console.log("%cErrors have been found in the supplied options object.",b),f.prototype.setOptions.call(this,t)},n.prototype.setItems=function(t){var e,i=null==this.itemsData;if(e=t?t instanceof u||t instanceof c?t:new u(t,{type:{start:"Date",end:"Date"}}):null,this.itemsData=e,this.linegraph&&this.linegraph.setItems(e),i)if(void 0!=this.options.start||void 0!=this.options.end){var o=void 0!=this.options.start?this.options.start:null,n=void 0!=this.options.end?this.options.end:null;this.setWindow(o,n,{animation:!1})}else this.fit({animation:!1})},n.prototype.setGroups=function(t){var e;e=t?t instanceof u||t instanceof c?t:new u(t):null,this.groupsData=e,this.linegraph.setGroups(e)},n.prototype.getLegend=function(t,e,i){return void 0===e&&(e=15),void 0===i&&(i=15),void 0!==this.linegraph.groups[t]?this.linegraph.groups[t].getLegend(e,i):"cannot find group:'"+t+"'"},n.prototype.isGroupVisible=function(t){return void 0!==this.linegraph.groups[t]&&(this.linegraph.groups[t].visible&&(void 0===this.linegraph.options.groups.visibility[t]||1==this.linegraph.options.groups.visibility[t]))},n.prototype.getDataRange=function(){var t=null,e=null;for(var i in this.linegraph.groups)if(this.linegraph.groups.hasOwnProperty(i)&&1==this.linegraph.groups[i].visible)for(var o=0;o<this.linegraph.groups[i].itemsData.length;o++){var n=this.linegraph.groups[i].itemsData[o],s=l.convert(n.x,"Date").valueOf();t=null==t?s:t>s?s:t,e=null==e?s:e<s?s:e}return{min:null!=t?new Date(t):null,max:null!=e?new Date(e):null}},n.prototype.getEventProperties=function(t){var e=t.center?t.center.x:t.clientX,i=t.center?t.center.y:t.clientY,o=e-l.getAbsoluteLeft(this.dom.centerContainer),n=i-l.getAbsoluteTop(this.dom.centerContainer),s=this._toTime(o),r=g.customTimeFromTarget(t),a=l.getTarget(t),h=null;l.hasParent(a,this.timeAxis.dom.foreground)?h="axis":this.timeAxis2&&l.hasParent(a,this.timeAxis2.dom.foreground)?h="axis":l.hasParent(a,this.linegraph.yAxisLeft.dom.frame)?h="data-axis":l.hasParent(a,this.linegraph.yAxisRight.dom.frame)?h="data-axis":l.hasParent(a,this.linegraph.legendLeft.dom.frame)?h="legend":l.hasParent(a,this.linegraph.legendRight.dom.frame)?h="legend":null!=r?h="custom-time":l.hasParent(a,this.currentTime.bar)?h="current-time":l.hasParent(a,this.dom.center)&&(h="background");var d=[],u=this.linegraph.yAxisLeft,c=this.linegraph.yAxisRight;return!u.hidden&&this.itemsData.length>0&&d.push(u.screenToValue(n)),!c.hidden&&this.itemsData.length>0&&d.push(c.screenToValue(n)),{event:t,what:h,pageX:t.srcEvent?t.srcEvent.pageX:t.pageX,pageY:t.srcEvent?t.srcEvent.pageY:t.pageY,x:o,y:n,time:s,value:d}},n.prototype._createConfigurator=function(){return new r.default(this,this.dom.container,w)},t.exports=n},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){this.id=a.randomUUID(),this.body=t,this.defaultOptions={yAxisOrientation:"left",defaultGroup:"default",sort:!0,sampling:!0,stack:!1,graphHeight:"400px",shaded:{enabled:!1,orientation:"bottom"},style:"line",barChart:{width:50,sideBySide:!1,align:"center"},interpolation:{enabled:!0,parametrization:"centripetal",alpha:.5},drawPoints:{enabled:!0,size:6,style:"square"},dataAxis:{},legend:{},groups:{visibility:{}}},this.options=a.extend({},this.defaultOptions),this.dom={},this.props={},this.hammer=null,this.groups={},this.abortedGraphUpdate=!1,this.updateSVGheight=!1,this.updateSVGheightOnResize=!1,this.forceGraphUpdate=!0;var i=this;this.itemsData=null,this.groupsData=null,this.itemListeners={add:function(t,e,o){i._onAdd(e.items)},update:function(t,e,o){i._onUpdate(e.items)},remove:function(t,e,o){i._onRemove(e.items)}},this.groupListeners={add:function(t,e,o){i._onAddGroups(e.items)},update:function(t,e,o){i._onUpdateGroups(e.items)},remove:function(t,e,o){i._onRemoveGroups(e.items)}},this.items={},this.selection=[],this.lastStart=this.body.range.start,this.touchParams={},this.svgElements={},this.setOptions(e),this.groupsUsingDefaultStyles=[0],this.body.emitter.on("rangechanged",function(){i.lastStart=i.body.range.start,i.svg.style.left=a.option.asSize(-i.props.width),i.forceGraphUpdate=!0,i.redraw.call(i)}),this._create(),this.framework={svg:this.svg,svgElements:this.svgElements,options:this.options,groups:this.groups}}var s=i(62),r=o(s),a=i(1),h=i(90),d=i(91),l=i(93),u=i(124),c=i(146),p=i(148),f=i(152),m=i(149),v=i(151),g=i(150),y="__ungrouped__";n.prototype=new u,n.prototype._create=function(){var t=document.createElement("div");t.className="vis-line-graph",this.dom.frame=t,this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="relative",this.svg.style.height=(""+this.options.graphHeight).replace("px","")+"px",this.svg.style.display="block",t.appendChild(this.svg),this.options.dataAxis.orientation="left",this.yAxisLeft=new c(this.body,this.options.dataAxis,this.svg,this.options.groups),this.options.dataAxis.orientation="right",this.yAxisRight=new c(this.body,this.options.dataAxis,this.svg,this.options.groups),delete this.options.dataAxis.orientation,this.legendLeft=new f(this.body,this.options.legend,"left",this.options.groups),this.legendRight=new f(this.body,this.options.legend,"right",this.options.groups),this.show()},n.prototype.setOptions=function(t){if(t){var e=["sampling","defaultGroup","stack","height","graphHeight","yAxisOrientation","style","barChart","dataAxis","sort","groups"];void 0===t.graphHeight&&void 0!==t.height?(this.updateSVGheight=!0,this.updateSVGheightOnResize=!0):void 0!==this.body.domProps.centerContainer.height&&void 0!==t.graphHeight&&parseInt((t.graphHeight+"").replace("px",""))<this.body.domProps.centerContainer.height&&(this.updateSVGheight=!0),a.selectiveDeepExtend(e,this.options,t),a.mergeOptions(this.options,t,"interpolation"),a.mergeOptions(this.options,t,"drawPoints"),a.mergeOptions(this.options,t,"shaded"),a.mergeOptions(this.options,t,"legend"),t.interpolation&&"object"==(0,r.default)(t.interpolation)&&t.interpolation.parametrization&&("uniform"==t.interpolation.parametrization?this.options.interpolation.alpha=0:"chordal"==t.interpolation.parametrization?this.options.interpolation.alpha=1:(this.options.interpolation.parametrization="centripetal",this.options.interpolation.alpha=.5)),this.yAxisLeft&&void 0!==t.dataAxis&&(this.yAxisLeft.setOptions(this.options.dataAxis),this.yAxisRight.setOptions(this.options.dataAxis)),this.legendLeft&&void 0!==t.legend&&(this.legendLeft.setOptions(this.options.legend),this.legendRight.setOptions(this.options.legend)),this.groups.hasOwnProperty(y)&&this.groups[y].setOptions(t)}this.dom.frame&&(this.forceGraphUpdate=!0,this.body.emitter.emit("_change",{queue:!0}))},n.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame)},n.prototype.show=function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame)},n.prototype.setItems=function(t){var e,i=this,o=this.itemsData;if(t){if(!(t instanceof d||t instanceof l))throw new TypeError("Data must be an instance of DataSet or DataView");this.itemsData=t}else this.itemsData=null;if(o&&(a.forEach(this.itemListeners,function(t,e){o.off(e,t)}),e=o.getIds(),this._onRemove(e)),this.itemsData){var n=this.id;a.forEach(this.itemListeners,function(t,e){i.itemsData.on(e,t,n)}),e=this.itemsData.getIds(),this._onAdd(e)}},n.prototype.setGroups=function(t){var e,i=this;if(this.groupsData){a.forEach(this.groupListeners,function(t,e){i.groupsData.off(e,t)}),e=this.groupsData.getIds(),this.groupsData=null;for(var o=0;o<e.length;o++)this._removeGroup(e[o])}if(t){if(!(t instanceof d||t instanceof l))throw new TypeError("Data must be an instance of DataSet or DataView");this.groupsData=t}else this.groupsData=null;if(this.groupsData){var n=this.id;a.forEach(this.groupListeners,function(t,e){i.groupsData.on(e,t,n)}),e=this.groupsData.getIds(),this._onAddGroups(e)}},n.prototype._onUpdate=function(t){this._updateAllGroupData(t)},n.prototype._onAdd=function(t){this._onUpdate(t)},n.prototype._onRemove=function(t){this._onUpdate(t)},n.prototype._onUpdateGroups=function(t){this._updateAllGroupData(null,t)},n.prototype._onAddGroups=function(t){this._onUpdateGroups(t)},n.prototype._onRemoveGroups=function(t){for(var e=0;e<t.length;e++)this._removeGroup(t[e]);this.forceGraphUpdate=!0,this.body.emitter.emit("_change",{queue:!0})},n.prototype._removeGroup=function(t){this.groups.hasOwnProperty(t)&&("right"==this.groups[t].options.yAxisOrientation?(this.yAxisRight.removeGroup(t),this.legendRight.removeGroup(t),this.legendRight.redraw()):(this.yAxisLeft.removeGroup(t),this.legendLeft.removeGroup(t),this.legendLeft.redraw()),delete this.groups[t])},n.prototype._updateGroup=function(t,e){this.groups.hasOwnProperty(e)?(this.groups[e].update(t),"right"==this.groups[e].options.yAxisOrientation?(this.yAxisRight.updateGroup(e,this.groups[e]),this.legendRight.updateGroup(e,this.groups[e]),this.yAxisLeft.removeGroup(e),this.legendLeft.removeGroup(e)):(this.yAxisLeft.updateGroup(e,this.groups[e]),this.legendLeft.updateGroup(e,this.groups[e]),this.yAxisRight.removeGroup(e),this.legendRight.removeGroup(e))):(this.groups[e]=new p(t,e,this.options,this.groupsUsingDefaultStyles),"right"==this.groups[e].options.yAxisOrientation?(this.yAxisRight.addGroup(e,this.groups[e]),this.legendRight.addGroup(e,this.groups[e])):(this.yAxisLeft.addGroup(e,this.groups[e]),this.legendLeft.addGroup(e,this.groups[e]))),this.legendLeft.redraw(),this.legendRight.redraw()},n.prototype._updateAllGroupData=function(t,e){if(null!=this.itemsData){var i={},o=this.itemsData.get(),n=this.itemsData._fieldId,s={};t&&t.map(function(t){s[t]=t});for(var r={},h=0;h<o.length;h++){var d=o[h],l=d.group;null!==l&&void 0!==l||(l=y),r.hasOwnProperty(l)?r[l]++:r[l]=1}if(!e&&t)for(var l in this.groups)if(this.groups.hasOwnProperty(l)){var u=this.groups[l],c=u.getItems();i[l]=c.filter(function(t){return t[n]!==s[t[n]]});var p=r[l];r[l]-=i[l].length,i[l].length<p&&(i[l][p-1]={})}for(var h=0;h<o.length;h++){var d=o[h],l=d.group;if(null!==l&&void 0!==l||(l=y),e||!t||d[n]===s[d[n]]){i.hasOwnProperty(l)||(i[l]=new Array(r[l]));var f=a.bridgeObject(d);f.x=a.convert(d.x,"Date"),f.orginalY=d.y,f.y=Number(d.y),f[n]=d[n];var m=i[l].length-r[l]--;i[l][m]=f}}for(var l in this.groups)this.groups.hasOwnProperty(l)&&(i.hasOwnProperty(l)||(i[l]=new Array(0)));for(var l in i)if(i.hasOwnProperty(l))if(0==i[l].length)this.groups.hasOwnProperty(l)&&this._removeGroup(l);else{var u=void 0;void 0!=this.groupsData&&(u=this.groupsData.get(l)),void 0==u&&(u={id:l,content:this.options.defaultGroup+l}),this._updateGroup(u,l),this.groups[l].setItems(i[l])}this.forceGraphUpdate=!0,this.body.emitter.emit("_change",{queue:!0})}},n.prototype.redraw=function(){var t=!1;this.props.width=this.dom.frame.offsetWidth,this.props.height=this.body.domProps.centerContainer.height-this.body.domProps.border.top-this.body.domProps.border.bottom,t=this._isResized()||t;var e=this.body.range.end-this.body.range.start,i=e!=this.lastVisibleInterval;if(this.lastVisibleInterval=e,1==t&&(this.svg.style.width=a.option.asSize(3*this.props.width),this.svg.style.left=a.option.asSize(-this.props.width),(this.options.height+"").indexOf("%")==-1&&1!=this.updateSVGheightOnResize||(this.updateSVGheight=!0)),1==this.updateSVGheight?(this.options.graphHeight!=this.props.height+"px"&&(this.options.graphHeight=this.props.height+"px",this.svg.style.height=this.props.height+"px"),this.updateSVGheight=!1):this.svg.style.height=(""+this.options.graphHeight).replace("px","")+"px",1==t||1==i||1==this.abortedGraphUpdate||1==this.forceGraphUpdate)t=this._updateGraph()||t,this.forceGraphUpdate=!1;else if(0!=this.lastStart){var o=this.body.range.start-this.lastStart,n=this.body.range.end-this.body.range.start;if(0!=this.props.width){var s=this.props.width/n,r=o*s;this.svg.style.left=-this.props.width-r+"px"}}return this.legendLeft.redraw(),this.legendRight.redraw(),t},n.prototype._getSortedGroupIds=function(){var t=[];for(var e in this.groups)if(this.groups.hasOwnProperty(e)){var i=this.groups[e];1!=i.visible||void 0!==this.options.groups.visibility[e]&&1!=this.options.groups.visibility[e]||t.push({id:e,zIndex:i.options.zIndex})}a.insertSort(t,function(t,e){var i=t.zIndex,o=e.zIndex;return void 0===i&&(i=0),void 0===o&&(o=0),i==o?0:i<o?-1:1});for(var o=new Array(t.length),n=0;n<t.length;n++)o[n]=t[n].id;return o},n.prototype._updateGraph=function(){if(h.prepareElements(this.svgElements),0!=this.props.width&&null!=this.itemsData){var t,e,i={},o=!1,n=this.body.util.toGlobalTime(-this.body.domProps.root.width),s=this.body.util.toGlobalTime(2*this.body.domProps.root.width),r=this._getSortedGroupIds();if(r.length>0){var a={};for(this._getRelevantData(r,a,n,s),this._applySampling(r,a),e=0;e<r.length;e++)this._convertXcoordinates(a[r[e]]);if(this._getYRanges(r,a,i),o=this._updateYAxis(r,i),1==o)return h.cleanupElements(this.svgElements),this.abortedGraphUpdate=!0,!0;this.abortedGraphUpdate=!1;var d=void 0;for(e=0;e<r.length;e++)t=this.groups[r[e]],this.options.stack===!0&&"line"===this.options.style&&(void 0!=t.options.excludeFromStacking&&t.options.excludeFromStacking||(void 0!=d&&(this._stack(a[t.id],a[d.id]),1==t.options.shaded.enabled&&"group"!==t.options.shaded.orientation&&("top"==t.options.shaded.orientation&&"group"!==d.options.shaded.orientation?(d.options.shaded.orientation="group",d.options.shaded.groupId=t.id):(t.options.shaded.orientation="group",t.options.shaded.groupId=d.id))),d=t)),this._convertYcoordinates(a[r[e]],t);var l={};for(e=0;e<r.length;e++)if(t=this.groups[r[e]],"line"===t.options.style&&1==t.options.shaded.enabled){var u=a[r[e]];if(null==u||0==u.length)continue;if(l.hasOwnProperty(r[e])||(l[r[e]]=v.calcPath(u,t)),"group"===t.options.shaded.orientation){var c=t.options.shaded.groupId;if(r.indexOf(c)===-1){console.log(t.id+": Unknown shading group target given:"+c);continue}l.hasOwnProperty(c)||(l[c]=v.calcPath(a[c],this.groups[c])),v.drawShading(l[r[e]],t,l[c],this.framework)}else v.drawShading(l[r[e]],t,void 0,this.framework)}for(m.draw(r,a,this.framework),e=0;e<r.length;e++)if(t=this.groups[r[e]],a[r[e]].length>0)switch(t.options.style){case"line":l.hasOwnProperty(r[e])||(l[r[e]]=v.calcPath(a[r[e]],t)),v.draw(l[r[e]],t,this.framework);case"point":case"points":"point"!=t.options.style&&"points"!=t.options.style&&1!=t.options.drawPoints.enabled||g.draw(a[r[e]],t,this.framework);break;case"bar":}}}return h.cleanupElements(this.svgElements),!1},n.prototype._stack=function(t,e){var i,o,n,s,r;i=0;for(var a=0;a<t.length;a++){s=void 0,r=void 0;for(var h=i;h<e.length;h++){if(e[h].x===t[a].x){s=e[h],r=e[h],i=h;break}if(e[h].x>t[a].x){r=e[h],s=0==h?r:e[h-1],i=h;break}}void 0===r&&(s=e[e.length-1],r=e[e.length-1]),o=r.x-s.x,n=r.y-s.y,0==o?t[a].y=t[a].orginalY+r.y:t[a].y=t[a].orginalY+n/o*(t[a].x-s.x)+s.y}},n.prototype._getRelevantData=function(t,e,i,o){var n,s,r,h;if(t.length>0)for(s=0;s<t.length;s++){
+n=this.groups[t[s]];var d=n.getItems();if(1==n.options.sort){var l=function(t,e){return t.getTime()==e.getTime()?0:t<e?-1:1},u=Math.max(0,a.binarySearchValue(d,i,"x","before",l)),c=Math.min(d.length,a.binarySearchValue(d,o,"x","after",l)+1);c<=0&&(c=d.length);var p=new Array(c-u);for(r=u;r<c;r++)h=n.itemsData[r],p[r-u]=h;e[t[s]]=p}else e[t[s]]=n.itemsData}},n.prototype._applySampling=function(t,e){var i;if(t.length>0)for(var o=0;o<t.length;o++)if(i=this.groups[t[o]],1==i.options.sampling){var n=e[t[o]];if(n.length>0){var s=1,r=n.length,a=this.body.util.toGlobalScreen(n[n.length-1].x)-this.body.util.toGlobalScreen(n[0].x),h=r/a;s=Math.min(Math.ceil(.2*r),Math.max(1,Math.round(h)));for(var d=new Array(r),l=0;l<r;l+=s){var u=Math.round(l/s);d[u]=n[l]}e[t[o]]=d.splice(0,Math.round(r/s))}}},n.prototype._getYRanges=function(t,e,i){var o,n,s,r,a=[],h=[];if(t.length>0){for(s=0;s<t.length;s++)o=e[t[s]],r=this.groups[t[s]].options,o.length>0&&(n=this.groups[t[s]],r.stack===!0&&"bar"===r.style?"left"===r.yAxisOrientation?a=a.concat(n.getItems()):h=h.concat(n.getItems()):i[t[s]]=n.getYRange(o,t[s]));m.getStackedYRange(a,i,t,"__barStackLeft","left"),m.getStackedYRange(h,i,t,"__barStackRight","right")}},n.prototype._updateYAxis=function(t,e){var i,o,n=!1,s=!1,r=!1,a=1e9,h=1e9,d=-1e9,l=-1e9;if(t.length>0){for(var u=0;u<t.length;u++){var c=this.groups[t[u]];c&&"right"!=c.options.yAxisOrientation?(s=!0,a=1e9,d=-1e9):c&&c.options.yAxisOrientation&&(r=!0,h=1e9,l=-1e9)}for(var u=0;u<t.length;u++)e.hasOwnProperty(t[u])&&e[t[u]].ignore!==!0&&(i=e[t[u]].min,o=e[t[u]].max,"right"!=e[t[u]].yAxisOrientation?(s=!0,a=a>i?i:a,d=d<o?o:d):(r=!0,h=h>i?i:h,l=l<o?o:l));1==s&&this.yAxisLeft.setRange(a,d),1==r&&this.yAxisRight.setRange(h,l)}n=this._toggleAxisVisiblity(s,this.yAxisLeft)||n,n=this._toggleAxisVisiblity(r,this.yAxisRight)||n,1==r&&1==s?(this.yAxisLeft.drawIcons=!0,this.yAxisRight.drawIcons=!0):(this.yAxisLeft.drawIcons=!1,this.yAxisRight.drawIcons=!1),this.yAxisRight.master=!s,this.yAxisRight.masterAxis=this.yAxisLeft,0==this.yAxisRight.master?(1==r?this.yAxisLeft.lineOffset=this.yAxisRight.width:this.yAxisLeft.lineOffset=0,n=this.yAxisLeft.redraw()||n,n=this.yAxisRight.redraw()||n):n=this.yAxisRight.redraw()||n;for(var p=["__barStackLeft","__barStackRight","__lineStackLeft","__lineStackRight"],u=0;u<p.length;u++)t.indexOf(p[u])!=-1&&t.splice(t.indexOf(p[u]),1);return n},n.prototype._toggleAxisVisiblity=function(t,e){var i=!1;return 0==t?e.dom.frame.parentNode&&0==e.hidden&&(e.hide(),i=!0):e.dom.frame.parentNode||1!=e.hidden||(e.show(),i=!0),i},n.prototype._convertXcoordinates=function(t){for(var e=this.body.util.toScreen,i=0;i<t.length;i++)t[i].screen_x=e(t[i].x)+this.props.width,t[i].screen_y=t[i].y},n.prototype._convertYcoordinates=function(t,e){var i=this.yAxisLeft,o=Number(this.svg.style.height.replace("px",""));"right"==e.options.yAxisOrientation&&(i=this.yAxisRight);for(var n=0;n<t.length;n++)t[n].screen_y=Math.round(i.convertValue(t[n].y));e.setZeroPosition(Math.min(o,i.convertValue(0)))},t.exports=n},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i,o){this.id=a.randomUUID(),this.body=t,this.defaultOptions={orientation:"left",showMinorLabels:!0,showMajorLabels:!0,icons:!1,majorLinesOffset:7,minorLinesOffset:4,labelOffsetX:10,labelOffsetY:2,iconWidth:20,width:"40px",visible:!0,alignZeros:!0,left:{range:{min:void 0,max:void 0},format:function(t){return""+parseFloat(t.toPrecision(3))},title:{text:void 0,style:void 0}},right:{range:{min:void 0,max:void 0},format:function(t){return""+parseFloat(t.toPrecision(3))},title:{text:void 0,style:void 0}}},this.linegraphOptions=o,this.linegraphSVG=i,this.props={},this.DOMelements={lines:{},labels:{},title:{}},this.dom={},this.scale=void 0,this.range={start:0,end:0},this.options=a.extend({},this.defaultOptions),this.conversionFactor=1,this.setOptions(e),this.width=Number((""+this.options.width).replace("px","")),this.minWidth=this.width,this.height=this.linegraphSVG.getBoundingClientRect().height,this.hidden=!1,this.stepPixels=25,this.zeroCrossing=-1,this.amountOfSteps=-1,this.lineOffset=0,this.master=!0,this.masterAxis=null,this.svgElements={},this.iconsRemoved=!1,this.groups={},this.amountOfGroups=0,this._create(),this.framework={svg:this.svg,svgElements:this.svgElements,options:this.options,groups:this.groups};var n=this;this.body.emitter.on("verticalDrag",function(){n.dom.lineContainer.style.top=n.body.domProps.scrollTop+"px"})}var s=i(58),r=o(s),a=i(1),h=i(90),d=i(124),l=i(147);n.prototype=new d,n.prototype.addGroup=function(t,e){this.groups.hasOwnProperty(t)||(this.groups[t]=e),this.amountOfGroups+=1},n.prototype.updateGroup=function(t,e){this.groups.hasOwnProperty(t)||(this.amountOfGroups+=1),this.groups[t]=e},n.prototype.removeGroup=function(t){this.groups.hasOwnProperty(t)&&(delete this.groups[t],this.amountOfGroups-=1)},n.prototype.setOptions=function(t){if(t){var e=!1;this.options.orientation!=t.orientation&&void 0!==t.orientation&&(e=!0);var i=["orientation","showMinorLabels","showMajorLabels","icons","majorLinesOffset","minorLinesOffset","labelOffsetX","labelOffsetY","iconWidth","width","visible","left","right","alignZeros"];a.selectiveDeepExtend(i,this.options,t),this.minWidth=Number((""+this.options.width).replace("px","")),e===!0&&this.dom.frame&&(this.hide(),this.show())}},n.prototype._create=function(){this.dom.frame=document.createElement("div"),this.dom.frame.style.width=this.options.width,this.dom.frame.style.height=this.height,this.dom.lineContainer=document.createElement("div"),this.dom.lineContainer.style.width="100%",this.dom.lineContainer.style.height=this.height,this.dom.lineContainer.style.position="relative",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="absolute",this.svg.style.top="0px",this.svg.style.height="100%",this.svg.style.width="100%",this.svg.style.display="block",this.dom.frame.appendChild(this.svg)},n.prototype._redrawGroupIcons=function(){h.prepareElements(this.svgElements);var t,e=this.options.iconWidth,i=15,o=4,n=o+.5*i;t="left"===this.options.orientation?o:this.width-e-o;var s=(0,r.default)(this.groups);s.sort(function(t,e){return t<e?-1:1});for(var a=0;a<s.length;a++){var d=s[a];this.groups[d].visible!==!0||void 0!==this.linegraphOptions.visibility[d]&&this.linegraphOptions.visibility[d]!==!0||(this.groups[d].getLegend(e,i,this.framework,t,n),n+=i+o)}h.cleanupElements(this.svgElements),this.iconsRemoved=!1},n.prototype._cleanupIcons=function(){this.iconsRemoved===!1&&(h.prepareElements(this.svgElements),h.cleanupElements(this.svgElements),this.iconsRemoved=!0)},n.prototype.show=function(){this.hidden=!1,this.dom.frame.parentNode||("left"===this.options.orientation?this.body.dom.left.appendChild(this.dom.frame):this.body.dom.right.appendChild(this.dom.frame)),this.dom.lineContainer.parentNode||this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer)},n.prototype.hide=function(){this.hidden=!0,this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame),this.dom.lineContainer.parentNode&&this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer)},n.prototype.setRange=function(t,e){this.range.start=t,this.range.end=e},n.prototype.redraw=function(){var t=!1,e=0;this.dom.lineContainer.style.top=this.body.domProps.scrollTop+"px";for(var i in this.groups)this.groups.hasOwnProperty(i)&&(this.groups[i].visible!==!0||void 0!==this.linegraphOptions.visibility[i]&&this.linegraphOptions.visibility[i]!==!0||e++);if(0===this.amountOfGroups||0===e)this.hide();else{this.show(),this.height=Number(this.linegraphSVG.style.height.replace("px","")),this.dom.lineContainer.style.height=this.height+"px",this.width=this.options.visible===!0?Number((""+this.options.width).replace("px","")):0;var o=this.props,n=this.dom.frame;n.className="vis-data-axis",this._calculateCharSize();var s=this.options.orientation,r=this.options.showMinorLabels,a=this.options.showMajorLabels;o.minorLabelHeight=r?o.minorCharHeight:0,o.majorLabelHeight=a?o.majorCharHeight:0,o.minorLineWidth=this.body.dom.backgroundHorizontal.offsetWidth-this.lineOffset-this.width+2*this.options.minorLinesOffset,o.minorLineHeight=1,o.majorLineWidth=this.body.dom.backgroundHorizontal.offsetWidth-this.lineOffset-this.width+2*this.options.majorLinesOffset,o.majorLineHeight=1,"left"===s?(n.style.top="0",n.style.left="0",n.style.bottom="",n.style.width=this.width+"px",n.style.height=this.height+"px",this.props.width=this.body.domProps.left.width,this.props.height=this.body.domProps.left.height):(n.style.top="",n.style.bottom="0",n.style.left="0",n.style.width=this.width+"px",n.style.height=this.height+"px",this.props.width=this.body.domProps.right.width,this.props.height=this.body.domProps.right.height),t=this._redrawLabels(),t=this._isResized()||t,this.options.icons===!0?this._redrawGroupIcons():this._cleanupIcons(),this._redrawTitle(s)}return t},n.prototype._redrawLabels=function(){var t=this,e=!1;h.prepareElements(this.DOMelements.lines),h.prepareElements(this.DOMelements.labels);var i=this.options.orientation,o=void 0!=this.options[i].range?this.options[i].range:{},n=!0;void 0!=o.max&&(this.range.end=o.max,n=!1);var s=!0;void 0!=o.min&&(this.range.start=o.min,s=!1),this.scale=new l(this.range.start,this.range.end,s,n,this.dom.frame.offsetHeight,this.props.majorCharHeight,this.options.alignZeros,this.options[i].format),this.master===!1&&void 0!=this.masterAxis&&this.scale.followScale(this.masterAxis.scale),this.maxLabelSize=0;var r=this.scale.getLines();r.forEach(function(e){var o=e.y,n=e.major;t.options.showMinorLabels&&n===!1&&t._redrawLabel(o-2,e.val,i,"vis-y-axis vis-minor",t.props.minorCharHeight),n&&o>=0&&t._redrawLabel(o-2,e.val,i,"vis-y-axis vis-major",t.props.majorCharHeight),t.master===!0&&(n?t._redrawLine(o,i,"vis-grid vis-horizontal vis-major",t.options.majorLinesOffset,t.props.majorLineWidth):t._redrawLine(o,i,"vis-grid vis-horizontal vis-minor",t.options.minorLinesOffset,t.props.minorLineWidth))});var a=0;void 0!==this.options[i].title&&void 0!==this.options[i].title.text&&(a=this.props.titleCharHeight);var d=this.options.icons===!0?Math.max(this.options.iconWidth,a)+this.options.labelOffsetX+15:a+this.options.labelOffsetX+15;return this.maxLabelSize>this.width-d&&this.options.visible===!0?(this.width=this.maxLabelSize+d,this.options.width=this.width+"px",h.cleanupElements(this.DOMelements.lines),h.cleanupElements(this.DOMelements.labels),this.redraw(),e=!0):this.maxLabelSize<this.width-d&&this.options.visible===!0&&this.width>this.minWidth?(this.width=Math.max(this.minWidth,this.maxLabelSize+d),this.options.width=this.width+"px",h.cleanupElements(this.DOMelements.lines),h.cleanupElements(this.DOMelements.labels),this.redraw(),e=!0):(h.cleanupElements(this.DOMelements.lines),h.cleanupElements(this.DOMelements.labels),e=!1),e},n.prototype.convertValue=function(t){return this.scale.convertValue(t)},n.prototype.screenToValue=function(t){return this.scale.screenToValue(t)},n.prototype._redrawLabel=function(t,e,i,o,n){var s=h.getDOMElement("div",this.DOMelements.labels,this.dom.frame);s.className=o,s.innerHTML=e,"left"===i?(s.style.left="-"+this.options.labelOffsetX+"px",s.style.textAlign="right"):(s.style.right="-"+this.options.labelOffsetX+"px",s.style.textAlign="left"),s.style.top=t-.5*n+this.options.labelOffsetY+"px",e+="";var r=Math.max(this.props.majorCharWidth,this.props.minorCharWidth);this.maxLabelSize<e.length*r&&(this.maxLabelSize=e.length*r)},n.prototype._redrawLine=function(t,e,i,o,n){if(this.master===!0){var s=h.getDOMElement("div",this.DOMelements.lines,this.dom.lineContainer);s.className=i,s.innerHTML="","left"===e?s.style.left=this.width-o+"px":s.style.right=this.width-o+"px",s.style.width=n+"px",s.style.top=t+"px"}},n.prototype._redrawTitle=function(t){if(h.prepareElements(this.DOMelements.title),void 0!==this.options[t].title&&void 0!==this.options[t].title.text){var e=h.getDOMElement("div",this.DOMelements.title,this.dom.frame);e.className="vis-y-axis vis-title vis-"+t,e.innerHTML=this.options[t].title.text,void 0!==this.options[t].title.style&&a.addCssText(e,this.options[t].title.style),"left"===t?e.style.left=this.props.titleCharHeight+"px":e.style.right=this.props.titleCharHeight+"px",e.style.width=this.height+"px"}h.cleanupElements(this.DOMelements.title)},n.prototype._calculateCharSize=function(){if(!("minorCharHeight"in this.props)){var t=document.createTextNode("0"),e=document.createElement("div");e.className="vis-y-axis vis-minor vis-measure",e.appendChild(t),this.dom.frame.appendChild(e),this.props.minorCharHeight=e.clientHeight,this.props.minorCharWidth=e.clientWidth,this.dom.frame.removeChild(e)}if(!("majorCharHeight"in this.props)){var i=document.createTextNode("0"),o=document.createElement("div");o.className="vis-y-axis vis-major vis-measure",o.appendChild(i),this.dom.frame.appendChild(o),this.props.majorCharHeight=o.clientHeight,this.props.majorCharWidth=o.clientWidth,this.dom.frame.removeChild(o)}if(!("titleCharHeight"in this.props)){var n=document.createTextNode("0"),s=document.createElement("div");s.className="vis-y-axis vis-title vis-measure",s.appendChild(n),this.dom.frame.appendChild(s),this.props.titleCharHeight=s.clientHeight,this.props.titleCharWidth=s.clientWidth,this.dom.frame.removeChild(s)}},t.exports=n},function(t,e){function i(t,e,i,o,n,s){var r=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]&&arguments[7];if(this.majorSteps=[1,2,5,10],this.minorSteps=[.25,.5,1,2],this.customLines=null,this.containerHeight=n,this.majorCharHeight=s,this._start=t,this._end=e,this.scale=1,this.minorStepIdx=-1,this.magnitudefactor=1,this.determineScale(),this.zeroAlign=r,this.autoScaleStart=i,this.autoScaleEnd=o,this.formattingFunction=a,i||o){var h=this,d=function(t){var e=t-t%(h.magnitudefactor*h.minorSteps[h.minorStepIdx]);return t%(h.magnitudefactor*h.minorSteps[h.minorStepIdx])>.5*(h.magnitudefactor*h.minorSteps[h.minorStepIdx])?e+h.magnitudefactor*h.minorSteps[h.minorStepIdx]:e};i&&(this._start-=2*this.magnitudefactor*this.minorSteps[this.minorStepIdx],this._start=d(this._start)),o&&(this._end+=this.magnitudefactor*this.minorSteps[this.minorStepIdx],this._end=d(this._end)),this.determineScale()}}i.prototype.setCharHeight=function(t){this.majorCharHeight=t},i.prototype.setHeight=function(t){this.containerHeight=t},i.prototype.determineScale=function(){var t=this._end-this._start;this.scale=this.containerHeight/t;var e=this.majorCharHeight/this.scale,i=t>0?Math.round(Math.log(t)/Math.LN10):0;this.minorStepIdx=-1,this.magnitudefactor=Math.pow(10,i);var o=0;i<0&&(o=i);for(var n=!1,s=o;Math.abs(s)<=Math.abs(i);s++){this.magnitudefactor=Math.pow(10,s);for(var r=0;r<this.minorSteps.length;r++){var a=this.magnitudefactor*this.minorSteps[r];if(a>=e){n=!0,this.minorStepIdx=r;break}}if(n===!0)break}},i.prototype.is_major=function(t){return t%(this.magnitudefactor*this.majorSteps[this.minorStepIdx])===0},i.prototype.getStep=function(){return this.magnitudefactor*this.minorSteps[this.minorStepIdx]},i.prototype.getFirstMajor=function(){var t=this.magnitudefactor*this.majorSteps[this.minorStepIdx];return this.convertValue(this._start+(t-this._start%t)%t)},i.prototype.formatValue=function(t){var e=t.toPrecision(5);return"function"==typeof this.formattingFunction&&(e=this.formattingFunction(t)),"number"==typeof e?""+e:"string"==typeof e?e:t.toPrecision(5)},i.prototype.getLines=function(){for(var t=[],e=this.getStep(),i=(e-this._start%e)%e,o=this._start+i;this._end-o>1e-5;o+=e)o!=this._start&&t.push({major:this.is_major(o),y:this.convertValue(o),val:this.formatValue(o)});return t},i.prototype.followScale=function(t){var e=this.minorStepIdx,i=this._start,o=this._end,n=this,s=function(){n.magnitudefactor*=2},r=function(){n.magnitudefactor/=2};t.minorStepIdx<=1&&this.minorStepIdx<=1||t.minorStepIdx>1&&this.minorStepIdx>1||(t.minorStepIdx<this.minorStepIdx?(this.minorStepIdx=1,2==e?s():(s(),s())):(this.minorStepIdx=2,1==e?r():(r(),r())));for(var a=(t.getLines(),t.convertValue(0)),h=t.getStep()*t.scale,d=!1,l=0;!d&&l++<5;){this.scale=h/(this.minorSteps[this.minorStepIdx]*this.magnitudefactor);var u=this.containerHeight/this.scale;this._start=i,this._end=this._start+u;var c=this._end*this.scale,p=this.magnitudefactor*this.majorSteps[this.minorStepIdx],f=this.getFirstMajor()-t.getFirstMajor();if(this.zeroAlign){var m=a-c;this._end+=m/this.scale,this._start=this._end-u}else this.autoScaleStart?(this._start-=f/this.scale,this._end=this._start+u):(this._start+=p-f/this.scale,this._end=this._start+u);if(!this.autoScaleEnd&&this._end>o+1e-5)r(),d=!1;else{if(!this.autoScaleStart&&this._start<i-1e-5){if(!(this.zeroAlign&&i>=0)){r(),d=!1;continue}console.warn("Can't adhere to given 'min' range, due to zeroalign")}this.autoScaleStart&&this.autoScaleEnd&&u<o-i?(s(),d=!1):d=!0}}},i.prototype.convertValue=function(t){return this.containerHeight-(t-this._start)*this.scale},i.prototype.screenToValue=function(t){return(this.containerHeight-t)/this.scale+this._start},t.exports=i},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i,o){this.id=e;var n=["sampling","style","sort","yAxisOrientation","barChart","drawPoints","shaded","interpolation","zIndex","excludeFromStacking","excludeFromLegend"];this.options=a.selectiveBridgeObject(n,i),this.usingDefaultStyle=void 0===t.className,this.groupsUsingDefaultStyles=o,this.zeroPosition=0,this.update(t),1==this.usingDefaultStyle&&(this.groupsUsingDefaultStyles[0]+=1),this.itemsData=[],this.visible=void 0===t.visible||t.visible}var s=i(62),r=o(s),a=i(1),h=(i(90),i(149)),d=i(151),l=i(150);n.prototype.setItems=function(t){null!=t?(this.itemsData=t,1==this.options.sort&&a.insertSort(this.itemsData,function(t,e){return t.x>e.x?1:-1})):this.itemsData=[]},n.prototype.getItems=function(){return this.itemsData},n.prototype.setZeroPosition=function(t){this.zeroPosition=t},n.prototype.setOptions=function(t){if(void 0!==t){var e=["sampling","style","sort","yAxisOrientation","barChart","zIndex","excludeFromStacking","excludeFromLegend"];a.selectiveDeepExtend(e,this.options,t),"function"==typeof t.drawPoints&&(t.drawPoints={onRender:t.drawPoints}),a.mergeOptions(this.options,t,"interpolation"),a.mergeOptions(this.options,t,"drawPoints"),a.mergeOptions(this.options,t,"shaded"),t.interpolation&&"object"==(0,r.default)(t.interpolation)&&t.interpolation.parametrization&&("uniform"==t.interpolation.parametrization?this.options.interpolation.alpha=0:"chordal"==t.interpolation.parametrization?this.options.interpolation.alpha=1:(this.options.interpolation.parametrization="centripetal",this.options.interpolation.alpha=.5))}},n.prototype.update=function(t){this.group=t,this.content=t.content||"graph",this.className=t.className||this.className||"vis-graph-group"+this.groupsUsingDefaultStyles[0]%10,this.visible=void 0===t.visible||t.visible,this.style=t.style,this.setOptions(t.options)},n.prototype.getLegend=function(t,e,i,o,n){if(void 0==i||null==i){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");i={svg:s,svgElements:{},options:this.options,groups:[this]}}switch(void 0!=o&&null!=o||(o=0),void 0!=n&&null!=n||(n=.5*e),this.options.style){case"line":d.drawIcon(this,o,n,t,e,i);break;case"points":case"point":l.drawIcon(this,o,n,t,e,i);break;case"bar":h.drawIcon(this,o,n,t,e,i)}return{icon:i.svg,label:this.content,orientation:this.options.yAxisOrientation}},n.prototype.getYRange=function(t){for(var e=t[0].y,i=t[0].y,o=0;o<t.length;o++)e=e>t[o].y?t[o].y:e,i=i<t[o].y?t[o].y:i;return{min:e,max:i,yAxisOrientation:this.options.yAxisOrientation}},t.exports=n},function(t,e,i){function o(t,e){}var n=i(90),s=i(150);o.drawIcon=function(t,e,i,o,s,r){var a=.5*s,h=n.getSVGElement("rect",r.svgElements,r.svg);h.setAttributeNS(null,"x",e),h.setAttributeNS(null,"y",i-a),h.setAttributeNS(null,"width",o),h.setAttributeNS(null,"height",2*a),h.setAttributeNS(null,"class","vis-outline");var d=Math.round(.3*o),l=t.options.barChart.width,u=l/d,c=Math.round(.4*s),p=Math.round(.75*s),f=Math.round((o-2*d)/3);if(n.drawBar(e+.5*d+f,i+a-c-1,d,c,t.className+" vis-bar",r.svgElements,r.svg,t.style),n.drawBar(e+1.5*d+f+2,i+a-p-1,d,p,t.className+" vis-bar",r.svgElements,r.svg,t.style),1==t.options.drawPoints.enabled){var m={style:t.options.drawPoints.style,styles:t.options.drawPoints.styles,size:t.options.drawPoints.size/u,className:t.className};n.drawPoint(e+.5*d+f,i+a-c-1,m,r.svgElements,r.svg),n.drawPoint(e+1.5*d+f+2,i+a-p-1,m,r.svgElements,r.svg)}},o.draw=function(t,e,i){var r,a,h,d,l,u,c=[],p={},f=0;for(l=0;l<t.length;l++)if(d=i.groups[t[l]],"bar"===d.options.style&&d.visible===!0&&(void 0===i.options.groups.visibility[t[l]]||i.options.groups.visibility[t[l]]===!0))for(u=0;u<e[t[l]].length;u++)c.push({screen_x:e[t[l]][u].screen_x,screen_y:e[t[l]][u].screen_y,x:e[t[l]][u].x,y:e[t[l]][u].y,groupId:t[l],label:e[t[l]][u].label}),f+=1;if(0!==f)for(c.sort(function(t,e){return t.screen_x===e.screen_x?t.groupId<e.groupId?-1:1:t.screen_x-e.screen_x}),o._getDataIntersections(p,c),l=0;l<c.length;l++){d=i.groups[c[l].groupId];var m=void 0!=d.options.barChart.minWidth?d.options.barChart.minWidth:.1*d.options.barChart.width;a=c[l].screen_x;var v=0;if(void 0===p[a])l+1<c.length&&(r=Math.abs(c[l+1].screen_x-a)),h=o._getSafeDrawData(r,d,m);else{var g=l+(p[a].amount-p[a].resolved);l-(p[a].resolved+1);g<c.length&&(r=Math.abs(c[g].screen_x-a)),h=o._getSafeDrawData(r,d,m),p[a].resolved+=1,d.options.stack===!0&&d.options.excludeFromStacking!==!0?c[l].screen_y<d.zeroPosition?(v=p[a].accumulatedNegative,p[a].accumulatedNegative+=d.zeroPosition-c[l].screen_y):(v=p[a].accumulatedPositive,p[a].accumulatedPositive+=d.zeroPosition-c[l].screen_y):d.options.barChart.sideBySide===!0&&(h.width=h.width/p[a].amount,h.offset+=p[a].resolved*h.width-.5*h.width*(p[a].amount+1))}if(n.drawBar(c[l].screen_x+h.offset,c[l].screen_y-v,h.width,d.zeroPosition-c[l].screen_y,d.className+" vis-bar",i.svgElements,i.svg,d.style),d.options.drawPoints.enabled===!0){var y={screen_x:c[l].screen_x,screen_y:c[l].screen_y-v,x:c[l].x,y:c[l].y,groupId:c[l].groupId,label:c[l].label};s.draw([y],d,i,h.offset)}}},o._getDataIntersections=function(t,e){for(var i,o=0;o<e.length;o++)o+1<e.length&&(i=Math.abs(e[o+1].screen_x-e[o].screen_x)),o>0&&(i=Math.min(i,Math.abs(e[o-1].screen_x-e[o].screen_x))),0===i&&(void 0===t[e[o].screen_x]&&(t[e[o].screen_x]={amount:0,resolved:0,accumulatedPositive:0,accumulatedNegative:0}),t[e[o].screen_x].amount+=1)},o._getSafeDrawData=function(t,e,i){var o,n;return t<e.options.barChart.width&&t>0?(o=t<i?i:t,n=0,"left"===e.options.barChart.align?n-=.5*t:"right"===e.options.barChart.align&&(n+=.5*t)):(o=e.options.barChart.width,n=0,"left"===e.options.barChart.align?n-=.5*e.options.barChart.width:"right"===e.options.barChart.align&&(n+=.5*e.options.barChart.width)),{width:o,offset:n}},o.getStackedYRange=function(t,e,i,n,s){if(t.length>0){t.sort(function(t,e){return t.screen_x===e.screen_x?t.groupId<e.groupId?-1:1:t.screen_x-e.screen_x});var r={};o._getDataIntersections(r,t),e[n]=o._getStackedYRange(r,t),e[n].yAxisOrientation=s,i.push(n)}},o._getStackedYRange=function(t,e){for(var i,o=e[0].screen_y,n=e[0].screen_y,s=0;s<e.length;s++)i=e[s].screen_x,void 0===t[i]?(o=o>e[s].screen_y?e[s].screen_y:o,n=n<e[s].screen_y?e[s].screen_y:n):e[s].screen_y<0?t[i].accumulatedNegative+=e[s].screen_y:t[i].accumulatedPositive+=e[s].screen_y;for(var r in t)t.hasOwnProperty(r)&&(o=o>t[r].accumulatedNegative?t[r].accumulatedNegative:o,o=o>t[r].accumulatedPositive?t[r].accumulatedPositive:o,n=n<t[r].accumulatedNegative?t[r].accumulatedNegative:n,n=n<t[r].accumulatedPositive?t[r].accumulatedPositive:n);return{min:o,max:n}},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){}function s(t,e){return e="undefined"==typeof e?{}:e,{style:e.style||t.options.drawPoints.style,styles:e.styles||t.options.drawPoints.styles,size:e.size||t.options.drawPoints.size,className:e.className||t.className}}function r(t,e){var i=void 0;return t.options&&t.options.drawPoints&&t.options.drawPoints.onRender&&"function"==typeof t.options.drawPoints.onRender&&(i=t.options.drawPoints.onRender),e.group.options&&e.group.options.drawPoints&&e.group.options.drawPoints.onRender&&"function"==typeof e.group.options.drawPoints.onRender&&(i=e.group.options.drawPoints.onRender),i}var a=i(62),h=o(a),d=i(90);n.draw=function(t,e,i,o){o=o||0;for(var n=r(i,e),a=0;a<t.length;a++)if(n){var l=n(t[a],e);l!==!0&&"object"!==("undefined"==typeof l?"undefined":(0,h.default)(l))||d.drawPoint(t[a].screen_x+o,t[a].screen_y,s(e,l),i.svgElements,i.svg,t[a].label)}else d.drawPoint(t[a].screen_x+o,t[a].screen_y,s(e),i.svgElements,i.svg,t[a].label)},n.drawIcon=function(t,e,i,o,n,r){var a=.5*n,h=d.getSVGElement("rect",r.svgElements,r.svg);h.setAttributeNS(null,"x",e),h.setAttributeNS(null,"y",i-a),h.setAttributeNS(null,"width",o),h.setAttributeNS(null,"height",2*a),h.setAttributeNS(null,"class","vis-outline"),d.drawPoint(e+.5*o,i,s(t),r.svgElements,r.svg)},t.exports=n},function(t,e,i){function o(t,e){}var n=i(90);o.calcPath=function(t,e){if(null!=t&&t.length>0){var i=[];return i=1==e.options.interpolation.enabled?o._catmullRom(t,e):o._linear(t)}},o.drawIcon=function(t,e,i,o,s,r){var a,h,d=.5*s,l=n.getSVGElement("rect",r.svgElements,r.svg);if(l.setAttributeNS(null,"x",e),l.setAttributeNS(null,"y",i-d),l.setAttributeNS(null,"width",o),l.setAttributeNS(null,"height",2*d),l.setAttributeNS(null,"class","vis-outline"),a=n.getSVGElement("path",r.svgElements,r.svg),a.setAttributeNS(null,"class",t.className),void 0!==t.style&&a.setAttributeNS(null,"style",t.style),a.setAttributeNS(null,"d","M"+e+","+i+" L"+(e+o)+","+i),1==t.options.shaded.enabled&&(h=n.getSVGElement("path",r.svgElements,r.svg),"top"==t.options.shaded.orientation?h.setAttributeNS(null,"d","M"+e+", "+(i-d)+"L"+e+","+i+" L"+(e+o)+","+i+" L"+(e+o)+","+(i-d)):h.setAttributeNS(null,"d","M"+e+","+i+" L"+e+","+(i+d)+" L"+(e+o)+","+(i+d)+"L"+(e+o)+","+i),h.setAttributeNS(null,"class",t.className+" vis-icon-fill"),void 0!==t.options.shaded.style&&""!==t.options.shaded.style&&h.setAttributeNS(null,"style",t.options.shaded.style)),1==t.options.drawPoints.enabled){var u={style:t.options.drawPoints.style,styles:t.options.drawPoints.styles,size:t.options.drawPoints.size,className:t.className};n.drawPoint(e+.5*o,i,u,r.svgElements,r.svg)}},o.drawShading=function(t,e,i,o){if(1==e.options.shaded.enabled){var s=Number(o.svg.style.height.replace("px","")),r=n.getSVGElement("path",o.svgElements,o.svg),a="L";1==e.options.interpolation.enabled&&(a="C");var h,d=0;d="top"==e.options.shaded.orientation?0:"bottom"==e.options.shaded.orientation?s:Math.min(Math.max(0,e.zeroPosition),s),h="group"==e.options.shaded.orientation&&null!=i&&void 0!=i?"M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,a,!1)+" L"+i[i.length-1][0]+","+i[i.length-1][1]+" "+this.serializePath(i,a,!0)+i[0][0]+","+i[0][1]+" Z":"M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,a,!1)+" V"+d+" H"+t[0][0]+" Z",r.setAttributeNS(null,"class",e.className+" vis-fill"),void 0!==e.options.shaded.style&&r.setAttributeNS(null,"style",e.options.shaded.style),r.setAttributeNS(null,"d",h)}},o.draw=function(t,e,i){if(null!=t&&void 0!=t){var o=n.getSVGElement("path",i.svgElements,i.svg);o.setAttributeNS(null,"class",e.className),void 0!==e.style&&o.setAttributeNS(null,"style",e.style);var s="L";1==e.options.interpolation.enabled&&(s="C"),o.setAttributeNS(null,"d","M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,s,!1))}},o.serializePath=function(t,e,i){if(t.length<2)return"";var o=e;if(i)for(var n=t.length-2;n>0;n--)o+=t[n][0]+","+t[n][1]+" ";else for(var n=1;n<t.length;n++)o+=t[n][0]+","+t[n][1]+" ";return o},o._catmullRomUniform=function(t){var e,i,o,n,s,r,a=[];a.push([Math.round(t[0].screen_x),Math.round(t[0].screen_y)]);for(var h=1/6,d=t.length,l=0;l<d-1;l++)e=0==l?t[0]:t[l-1],i=t[l],o=t[l+1],n=l+2<d?t[l+2]:o,s={screen_x:(-e.screen_x+6*i.screen_x+o.screen_x)*h,screen_y:(-e.screen_y+6*i.screen_y+o.screen_y)*h},r={screen_x:(i.screen_x+6*o.screen_x-n.screen_x)*h,screen_y:(i.screen_y+6*o.screen_y-n.screen_y)*h},a.push([s.screen_x,s.screen_y]),a.push([r.screen_x,r.screen_y]),a.push([o.screen_x,o.screen_y]);return a},o._catmullRom=function(t,e){var i=e.options.interpolation.alpha;if(0==i||void 0===i)return this._catmullRomUniform(t);var o,n,s,r,a,h,d,l,u,c,p,f,m,v,g,y,b,_,w,x=[];x.push([Math.round(t[0].screen_x),Math.round(t[0].screen_y)]);for(var k=t.length,O=0;O<k-1;O++)o=0==O?t[0]:t[O-1],n=t[O],s=t[O+1],r=O+2<k?t[O+2]:s,d=Math.sqrt(Math.pow(o.screen_x-n.screen_x,2)+Math.pow(o.screen_y-n.screen_y,2)),l=Math.sqrt(Math.pow(n.screen_x-s.screen_x,2)+Math.pow(n.screen_y-s.screen_y,2)),u=Math.sqrt(Math.pow(s.screen_x-r.screen_x,2)+Math.pow(s.screen_y-r.screen_y,2)),v=Math.pow(u,i),y=Math.pow(u,2*i),g=Math.pow(l,i),b=Math.pow(l,2*i),w=Math.pow(d,i),_=Math.pow(d,2*i),c=2*_+3*w*g+b,p=2*y+3*v*g+b,f=3*w*(w+g),f>0&&(f=1/f),m=3*v*(v+g),m>0&&(m=1/m),a={screen_x:(-b*o.screen_x+c*n.screen_x+_*s.screen_x)*f,screen_y:(-b*o.screen_y+c*n.screen_y+_*s.screen_y)*f},h={screen_x:(y*n.screen_x+p*s.screen_x-b*r.screen_x)*m,screen_y:(y*n.screen_y+p*s.screen_y-b*r.screen_y)*m},0==a.screen_x&&0==a.screen_y&&(a=n),0==h.screen_x&&0==h.screen_y&&(h=s),x.push([a.screen_x,a.screen_y]),x.push([h.screen_x,h.screen_y]),x.push([s.screen_x,s.screen_y]);return x},o._linear=function(t){for(var e=[],i=0;i<t.length;i++)e.push([t[i].screen_x,t[i].screen_y]);return e},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i,o){this.body=t,this.defaultOptions={enabled:!1,icons:!0,iconSize:20,iconSpacing:6,left:{visible:!0,position:"top-left"},right:{visible:!0,position:"top-right"}},this.side=i,this.options=a.extend({},this.defaultOptions),this.linegraphOptions=o,this.svgElements={},this.dom={},this.groups={},this.amountOfGroups=0,this._create(),this.framework={svg:this.svg,svgElements:this.svgElements,options:this.options,groups:this.groups},this.setOptions(e)}var s=i(58),r=o(s),a=i(1),h=i(90),d=i(124);n.prototype=new d,n.prototype.clear=function(){this.groups={},this.amountOfGroups=0},n.prototype.addGroup=function(t,e){1!=e.options.excludeFromLegend&&(this.groups.hasOwnProperty(t)||(this.groups[t]=e),this.amountOfGroups+=1)},n.prototype.updateGroup=function(t,e){this.groups[t]=e},n.prototype.removeGroup=function(t){this.groups.hasOwnProperty(t)&&(delete this.groups[t],this.amountOfGroups-=1)},n.prototype._create=function(){this.dom.frame=document.createElement("div"),this.dom.frame.className="vis-legend",this.dom.frame.style.position="absolute",this.dom.frame.style.top="10px",this.dom.frame.style.display="block",this.dom.textArea=document.createElement("div"),this.dom.textArea.className="vis-legend-text",this.dom.textArea.style.position="relative",this.dom.textArea.style.top="0px",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="absolute",this.svg.style.top="0px",this.svg.style.width=this.options.iconSize+5+"px",this.svg.style.height="100%",this.dom.frame.appendChild(this.svg),this.dom.frame.appendChild(this.dom.textArea)},n.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame)},n.prototype.show=function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame)},n.prototype.setOptions=function(t){var e=["enabled","orientation","icons","left","right"];a.selectiveDeepExtend(e,this.options,t)},n.prototype.redraw=function(){var t=0,e=(0,r.default)(this.groups);e.sort(function(t,e){return t<e?-1:1});for(var i=0;i<e.length;i++){var o=e[i];1!=this.groups[o].visible||void 0!==this.linegraphOptions.visibility[o]&&1!=this.linegraphOptions.visibility[o]||t++}if(0==this.options[this.side].visible||0==this.amountOfGroups||0==this.options.enabled||0==t)this.hide();else{if(this.show(),"top-left"==this.options[this.side].position||"bottom-left"==this.options[this.side].position?(this.dom.frame.style.left="4px",
+this.dom.frame.style.textAlign="left",this.dom.textArea.style.textAlign="left",this.dom.textArea.style.left=this.options.iconSize+15+"px",this.dom.textArea.style.right="",this.svg.style.left="0px",this.svg.style.right=""):(this.dom.frame.style.right="4px",this.dom.frame.style.textAlign="right",this.dom.textArea.style.textAlign="right",this.dom.textArea.style.right=this.options.iconSize+15+"px",this.dom.textArea.style.left="",this.svg.style.right="0px",this.svg.style.left=""),"top-left"==this.options[this.side].position||"top-right"==this.options[this.side].position)this.dom.frame.style.top=4-Number(this.body.dom.center.style.top.replace("px",""))+"px",this.dom.frame.style.bottom="";else{var n=this.body.domProps.center.height-this.body.domProps.centerContainer.height;this.dom.frame.style.bottom=4+n+Number(this.body.dom.center.style.top.replace("px",""))+"px",this.dom.frame.style.top=""}0==this.options.icons?(this.dom.frame.style.width=this.dom.textArea.offsetWidth+10+"px",this.dom.textArea.style.right="",this.dom.textArea.style.left="",this.svg.style.width="0px"):(this.dom.frame.style.width=this.options.iconSize+15+this.dom.textArea.offsetWidth+10+"px",this.drawLegendIcons());for(var s="",i=0;i<e.length;i++){var o=e[i];1!=this.groups[o].visible||void 0!==this.linegraphOptions.visibility[o]&&1!=this.linegraphOptions.visibility[o]||(s+=this.groups[o].content+"<br />")}this.dom.textArea.innerHTML=s,this.dom.textArea.style.lineHeight=.75*this.options.iconSize+this.options.iconSpacing+"px"}},n.prototype.drawLegendIcons=function(){if(this.dom.frame.parentNode){var t=(0,r.default)(this.groups);t.sort(function(t,e){return t<e?-1:1}),h.resetElements(this.svgElements);var e=window.getComputedStyle(this.dom.frame).paddingTop,i=Number(e.replace("px","")),o=i,n=this.options.iconSize,s=.75*this.options.iconSize,a=i+.5*s+3;this.svg.style.width=n+5+i+"px";for(var d=0;d<t.length;d++){var l=t[d];1!=this.groups[l].visible||void 0!==this.linegraphOptions.visibility[l]&&1!=this.linegraphOptions.visibility[l]||(this.groups[l].getLegend(n,s,this.framework,o,a),a+=s+this.options.iconSpacing)}}},t.exports=n},function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var i="string",o="boolean",n="number",s="array",r="date",a="object",h="dom",d="moment",l="any",u={configure:{enabled:{boolean:o},filter:{boolean:o,function:"function"},container:{dom:h},__type__:{object:a,boolean:o,function:"function"}},yAxisOrientation:{string:["left","right"]},defaultGroup:{string:i},sort:{boolean:o},sampling:{boolean:o},stack:{boolean:o},graphHeight:{string:i,number:n},shaded:{enabled:{boolean:o},orientation:{string:["bottom","top","zero","group"]},groupId:{object:a},__type__:{boolean:o,object:a}},style:{string:["line","bar","points"]},barChart:{width:{number:n},minWidth:{number:n},sideBySide:{boolean:o},align:{string:["left","center","right"]},__type__:{object:a}},interpolation:{enabled:{boolean:o},parametrization:{string:["centripetal","chordal","uniform"]},alpha:{number:n},__type__:{object:a,boolean:o}},drawPoints:{enabled:{boolean:o},onRender:{function:"function"},size:{number:n},style:{string:["square","circle"]},__type__:{object:a,boolean:o,function:"function"}},dataAxis:{showMinorLabels:{boolean:o},showMajorLabels:{boolean:o},icons:{boolean:o},width:{string:i,number:n},visible:{boolean:o},alignZeros:{boolean:o},left:{range:{min:{number:n},max:{number:n},__type__:{object:a}},format:{function:"function"},title:{text:{string:i,number:n},style:{string:i},__type__:{object:a}},__type__:{object:a}},right:{range:{min:{number:n},max:{number:n},__type__:{object:a}},format:{function:"function"},title:{text:{string:i,number:n},style:{string:i},__type__:{object:a}},__type__:{object:a}},__type__:{object:a}},legend:{enabled:{boolean:o},icons:{boolean:o},left:{visible:{boolean:o},position:{string:["top-right","bottom-right","top-left","bottom-left"]},__type__:{object:a}},right:{visible:{boolean:o},position:{string:["top-right","bottom-right","top-left","bottom-left"]},__type__:{object:a}},__type__:{object:a,boolean:o}},groups:{visibility:{any:l},__type__:{object:a}},autoResize:{boolean:o},throttleRedraw:{number:n},clickToUse:{boolean:o},end:{number:n,date:r,string:i,moment:d},format:{minorLabels:{millisecond:{string:i,undefined:"undefined"},second:{string:i,undefined:"undefined"},minute:{string:i,undefined:"undefined"},hour:{string:i,undefined:"undefined"},weekday:{string:i,undefined:"undefined"},day:{string:i,undefined:"undefined"},month:{string:i,undefined:"undefined"},year:{string:i,undefined:"undefined"},__type__:{object:a}},majorLabels:{millisecond:{string:i,undefined:"undefined"},second:{string:i,undefined:"undefined"},minute:{string:i,undefined:"undefined"},hour:{string:i,undefined:"undefined"},weekday:{string:i,undefined:"undefined"},day:{string:i,undefined:"undefined"},month:{string:i,undefined:"undefined"},year:{string:i,undefined:"undefined"},__type__:{object:a}},__type__:{object:a}},moment:{function:"function"},height:{string:i,number:n},hiddenDates:{start:{date:r,number:n,string:i,moment:d},end:{date:r,number:n,string:i,moment:d},repeat:{string:i},__type__:{object:a,array:s}},locale:{string:i},locales:{__any__:{any:l},__type__:{object:a}},max:{date:r,number:n,string:i,moment:d},maxHeight:{number:n,string:i},maxMinorChars:{number:n},min:{date:r,number:n,string:i,moment:d},minHeight:{number:n,string:i},moveable:{boolean:o},multiselect:{boolean:o},orientation:{string:i},showCurrentTime:{boolean:o},showMajorLabels:{boolean:o},showMinorLabels:{boolean:o},start:{date:r,number:n,string:i,moment:d},timeAxis:{scale:{string:i,undefined:"undefined"},step:{number:n,undefined:"undefined"},__type__:{object:a}},width:{string:i,number:n},zoomable:{boolean:o},zoomKey:{string:["ctrlKey","altKey","metaKey",""]},zoomMax:{number:n},zoomMin:{number:n},zIndex:{number:n},__type__:{object:a}},c={global:{sort:!0,sampling:!0,stack:!1,shaded:{enabled:!1,orientation:["zero","top","bottom","group"]},style:["line","bar","points"],barChart:{width:[50,5,100,5],minWidth:[50,5,100,5],sideBySide:!1,align:["left","center","right"]},interpolation:{enabled:!0,parametrization:["centripetal","chordal","uniform"]},drawPoints:{enabled:!0,size:[6,2,30,1],style:["square","circle"]},dataAxis:{showMinorLabels:!0,showMajorLabels:!0,icons:!1,width:[40,0,200,1],visible:!0,alignZeros:!0,left:{title:{text:"",style:""}},right:{title:{text:"",style:""}}},legend:{enabled:!1,icons:!0,left:{visible:!0,position:["top-right","bottom-right","top-left","bottom-left"]},right:{visible:!0,position:["top-right","bottom-right","top-left","bottom-left"]}},autoResize:!0,clickToUse:!1,end:"",format:{minorLabels:{millisecond:"SSS",second:"s",minute:"HH:mm",hour:"HH:mm",weekday:"ddd D",day:"D",month:"MMM",year:"YYYY"},majorLabels:{millisecond:"HH:mm:ss",second:"D MMMM HH:mm",minute:"ddd D MMMM",hour:"ddd D MMMM",weekday:"MMMM YYYY",day:"MMMM YYYY",month:"YYYY",year:""}},height:"",locale:"",max:"",maxHeight:"",maxMinorChars:[7,0,20,1],min:"",minHeight:"",moveable:!0,orientation:["both","bottom","top"],showCurrentTime:!1,showMajorLabels:!0,showMinorLabels:!0,start:"",width:"100%",zoomable:!0,zoomKey:["ctrlKey","altKey","metaKey",""],zoomMax:[31536e10,10,31536e10,1],zoomMin:[10,10,31536e10,1],zIndex:0}};e.allOptions=u,e.configureOptions=c},function(t,e,i){e.util=i(1),e.DOMutil=i(90),e.DataSet=i(91),e.DataView=i(93),e.Queue=i(92),e.Network=i(155),e.network={Images:i(156),dotparser:i(224),gephiParser:i(225),allOptions:i(220)},e.network.convertDot=function(t){return e.network.dotparser.DOTToGraph(t)},e.network.convertGephi=function(t,i){return e.network.gephiParser.parseGephi(t,i)},e.moment=i(84),e.Hammer=i(108),e.keycharm=i(111)},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i){var o=this;if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.options={},this.defaultOptions={locale:"en",locales:Y,clickToUse:!1},F.extend(this.options,this.defaultOptions),this.body={container:t,nodes:{},nodeIndices:[],edges:{},edgeIndices:[],emitter:{on:this.on.bind(this),off:this.off.bind(this),emit:this.emit.bind(this),once:this.once.bind(this)},eventListeners:{onTap:function(){},onTouch:function(){},onDoubleTap:function(){},onHold:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},onMouseWheel:function(){},onPinch:function(){},onMouseMove:function(){},onRelease:function(){},onContext:function(){}},data:{nodes:null,edges:null},functions:{createNode:function(){},createEdge:function(){},getPointer:function(){}},modules:{},view:{scale:1,translation:{x:0,y:0}}},this.bindEventListeners(),this.images=new r.default(function(){return o.body.emitter.emit("_requestRedraw")}),this.groups=new h.default,this.canvas=new _.default(this.body),this.selectionHandler=new S.default(this.body,this.canvas),this.interactionHandler=new O.default(this.body,this.canvas,this.selectionHandler),this.view=new x.default(this.body,this.canvas),this.renderer=new y.default(this.body,this.canvas),this.physics=new f.default(this.body),this.layoutEngine=new C.default(this.body),this.clustering=new v.default(this.body),this.manipulation=new E.default(this.body,this.canvas,this.selectionHandler),this.nodesHandler=new l.default(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new c.default(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new A.default(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(i),this.setData(e)}var s=i(156),r=o(s),a=i(157),h=o(a),d=i(158),l=o(d),u=i(191),c=o(u),p=i(200),f=o(p),m=i(209),v=o(m),g=i(212),y=o(g),b=i(213),_=o(b),w=i(214),x=o(w),k=i(215),O=o(k),D=i(217),S=o(D),M=i(218),C=o(M),T=i(219),E=o(T),P=i(114),I=o(P),N=i(122),z=o(N),R=i(220),L=i(221),A=o(L);i(223);var B=i(95),F=i(1),H=(i(91),i(93),i(224)),j=i(225),W=i(139),Y=i(226);B(n.prototype),n.prototype.setOptions=function(t){var e=this;if(void 0!==t){var i=z.default.validate(t,R.allOptions);i===!0&&console.log("%cErrors have been found in the supplied options object.",N.printStyle);var o=["locale","locales","clickToUse"];if(F.selectiveDeepExtend(o,this.options,t),t=this.layoutEngine.setOptions(t.layout,t),this.canvas.setOptions(t),this.groups.setOptions(t.groups),this.nodesHandler.setOptions(t.nodes),this.edgesHandler.setOptions(t.edges),this.physics.setOptions(t.physics),this.manipulation.setOptions(t.manipulation,t,this.options),this.interactionHandler.setOptions(t.interaction),this.renderer.setOptions(t.interaction),this.selectionHandler.setOptions(t.interaction),void 0!==t.groups&&this.body.emitter.emit("refreshNodes"),"configure"in t&&(this.configurator||(this.configurator=new I.default(this,this.body.container,R.configureOptions,this.canvas.pixelRatio)),this.configurator.setOptions(t.configure)),this.configurator&&this.configurator.options.enabled===!0){var n={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};F.deepExtend(n.nodes,this.nodesHandler.options),F.deepExtend(n.edges,this.edgesHandler.options),F.deepExtend(n.layout,this.layoutEngine.options),F.deepExtend(n.interaction,this.selectionHandler.options),F.deepExtend(n.interaction,this.renderer.options),F.deepExtend(n.interaction,this.interactionHandler.options),F.deepExtend(n.manipulation,this.manipulation.options),F.deepExtend(n.physics,this.physics.options),F.deepExtend(n.global,this.canvas.options),F.deepExtend(n.global,this.options),this.configurator.setModuleOptions(n)}void 0!==t.clickToUse?t.clickToUse===!0?void 0===this.activator&&(this.activator=new W(this.canvas.frame),this.activator.on("change",function(){e.body.emitter.emit("activate")})):(void 0!==this.activator&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}},n.prototype._updateVisibleIndices=function(){var t=this.body.nodes,e=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(var i in t)t.hasOwnProperty(i)&&t[i].options.hidden===!1&&this.body.nodeIndices.push(t[i].id);for(var o in e)e.hasOwnProperty(o)&&e[o].options.hidden===!1&&this.body.edgeIndices.push(e[o].id)},n.prototype.bindEventListeners=function(){var t=this;this.body.emitter.on("_dataChanged",function(){t._updateVisibleIndices(),t.body.emitter.emit("_requestRedraw"),t.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",function(){t._updateValueRange(t.body.nodes),t._updateValueRange(t.body.edges),t.body.emitter.emit("startSimulation"),t.body.emitter.emit("_requestRedraw")})},n.prototype.setData=function(t){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),t&&t.dot&&(t.nodes||t.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(t&&t.options),t&&t.dot){console.log("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");var e=H.DOTToGraph(t.dot);return void this.setData(e)}if(t&&t.gephi){console.log("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");var i=j.parseGephi(t.gephi);return void this.setData(i)}this.nodesHandler.setData(t&&t.nodes,!0),this.edgesHandler.setData(t&&t.edges,!0),this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")},n.prototype.destroy=function(){this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(var t in this.body.nodes)delete this.body.nodes[t];for(var e in this.body.edges)delete this.body.edges[e];F.recursiveDOMDelete(this.body.container)},n.prototype._updateValueRange=function(t){var e,i=void 0,o=void 0,n=0;for(e in t)if(t.hasOwnProperty(e)){var s=t[e].getValue();void 0!==s&&(i=void 0===i?s:Math.min(s,i),o=void 0===o?s:Math.max(s,o),n+=s)}if(void 0!==i&&void 0!==o)for(e in t)t.hasOwnProperty(e)&&t[e].setValueRange(i,o,n)},n.prototype.isActive=function(){return!this.activator||this.activator.active},n.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},n.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},n.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},n.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},n.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},n.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},n.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},n.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},n.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},n.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},n.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},n.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},n.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},n.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},n.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},n.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},n.prototype.editNodeMode=function(){return console.log("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},n.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},n.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},n.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},n.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},n.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},n.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},n.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},n.prototype.getConnectedNodes=function(t){return void 0!==this.body.nodes[t]?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)},n.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},n.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},n.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},n.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},n.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},n.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},n.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodes.apply(this.selectionHandler,arguments)},n.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdges.apply(this.selectionHandler,arguments)},n.prototype.getNodeAt=function(){var t=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return void 0!==t&&void 0!==t.id?t.id:t},n.prototype.getEdgeAt=function(){var t=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return void 0!==t&&void 0!==t.id?t.id:t},n.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},n.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},n.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.redraw()},n.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},n.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},n.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},n.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},n.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},n.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},n.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},n.prototype.getOptionsFromConfigurator=function(){var t={};return this.configurator&&(t=this.configurator.getOptions.apply(this.configurator)),t},t.exports=n},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(e){(0,s.default)(this,t),this.images={},this.imageBroken={},this.callback=e}return(0,a.default)(t,[{key:"_addImageToCache",value:function(t,e){0===e.width&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e)),this.images[t]=e}},{key:"_tryloadBrokenUrl",value:function(t,e,i){var o=this;void 0!==t&&void 0!==e&&void 0!==i&&(i.onerror=function(){console.error("Could not load brokenImage:",e),o._addImageToCache(t,new Image)},i.src=e)}},{key:"_redrawWithImage",value:function(t){this.callback&&this.callback(t)}},{key:"load",value:function(t,e,i){var o=this,n=this.images[t];if(n)return n;var s=new Image;return s.onload=function(){o._addImageToCache(t,s),o._redrawWithImage(s)},s.onerror=function(){console.error("Could not load image:",t),o._tryloadBrokenUrl(t,e,s)},s.src=t,s}}]),t}();e.default=h},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=i(1),d=function(){function t(){(0,s.default)(this,t),this.clear(),this.defaultIndex=0,this.groupsArray=[],this.groupIndex=0,this.defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},h.extend(this.options,this.defaultOptions)}return(0,a.default)(t,[{key:"setOptions",value:function(t){var e=["useDefaultGroups"];if(void 0!==t)for(var i in t)if(t.hasOwnProperty(i)&&e.indexOf(i)===-1){var o=t[i];this.add(i,o)}}},{key:"clear",value:function(){this.groups={},this.groupsArray=[]}},{key:"get",value:function(t){var e=this.groups[t];if(void 0===e)if(this.options.useDefaultGroups===!1&&this.groupsArray.length>0){var i=this.groupIndex%this.groupsArray.length;this.groupIndex++,e={},e.color=this.groups[this.groupsArray[i]],this.groups[t]=e}else{var o=this.defaultIndex%this.defaultGroups.length;this.defaultIndex++,e={},e.color=this.defaultGroups[o],this.groups[t]=e}return e}},{key:"add",value:function(t,e){return this.groups[t]=e,this.groupsArray.push(t),e}}]),t}();e.default=d},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=i(159),d=o(h),l=i(160),u=o(l),c=i(1),p=i(91),f=i(93),m=function(){function t(e,i,o,n){var r=this;(0,s.default)(this,t),this.body=e,this.images=i,this.groups=o,this.layoutEngine=n,this.body.functions.createNode=this.create.bind(this),this.nodesListeners={add:function(t,e){r.add(e.items)},update:function(t,e){r.update(e.items,e.data)},remove:function(t,e){r.remove(e.items)}},this.options={},this.defaultOptions={borderWidth:1,borderWidthSelected:2,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(t,e,i,o){if(e===t)return.5;var n=1/(e-t);return Math.max(0,(o-t)*n)}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1},size:25,title:void 0,value:void 0,x:void 0,y:void 0},c.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,a.default)(t,[{key:"bindEventListeners",value:function(){var t=this;this.body.emitter.on("refreshNodes",this.refresh.bind(this)),this.body.emitter.on("refresh",this.refresh.bind(this)),this.body.emitter.on("destroy",function(){c.forEach(t.nodesListeners,function(e,i){t.body.data.nodes&&t.body.data.nodes.off(i,e)}),delete t.body.functions.createNode,delete t.nodesListeners.add,delete t.nodesListeners.update,delete t.nodesListeners.remove,delete t.nodesListeners})}},{key:"setOptions",value:function(t){if(this.nodeOptions=t,void 0!==t){if(d.default.parseOptions(this.options,t),void 0!==t.shape)for(var e in this.body.nodes)this.body.nodes.hasOwnProperty(e)&&this.body.nodes[e].updateShape();if(void 0!==t.font){u.default.parseOptions(this.options.font,t);for(var i in this.body.nodes)this.body.nodes.hasOwnProperty(i)&&(this.body.nodes[i].updateLabelModule(),this.body.nodes[i]._reset())}if(void 0!==t.size)for(var o in this.body.nodes)this.body.nodes.hasOwnProperty(o)&&this.body.nodes[o]._reset();void 0===t.hidden&&void 0===t.physics||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this.body.data.nodes;if(t instanceof p||t instanceof f)this.body.data.nodes=t;else if(Array.isArray(t))this.body.data.nodes=new p,this.body.data.nodes.add(t);else{if(t)throw new TypeError("Array or DataSet expected");this.body.data.nodes=new p}o&&c.forEach(this.nodesListeners,function(t,e){o.off(e,t)}),this.body.nodes={},this.body.data.nodes&&!function(){var t=e;c.forEach(e.nodesListeners,function(e,i){t.body.data.nodes.on(i,e)});var i=e.body.data.nodes.getIds();e.add(i,!0)}(),i===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=void 0,o=[],n=0;n<t.length;n++){i=t[n];var s=this.body.data.nodes.get(i),r=this.create(s);o.push(r),this.body.nodes[i]=r}this.layoutEngine.positionInitially(o),e===!1&&this.body.emitter.emit("_dataChanged")}},{key:"update",value:function(t,e){for(var i=this.body.nodes,o=!1,n=0;n<t.length;n++){var s=t[n],r=i[s],a=e[n];void 0!==r?o=r.setOptions(a):(o=!0,r=this.create(a),i[s]=r)}o===!0?this.body.emitter.emit("_dataChanged"):this.body.emitter.emit("_dataUpdated")}},{key:"remove",value:function(t){for(var e=this.body.nodes,i=0;i<t.length;i++){var o=t[i];delete e[o]}this.body.emitter.emit("_dataChanged")}},{key:"create",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.default;return new e(t,this.body,this.images,this.groups,this.options,this.defaultOptions,this.nodeOptions)}},{key:"refresh",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.body.nodes;for(var i in e){var o=void 0;e.hasOwnProperty(i)&&(o=e[i]);var n=this.body.data.nodes._data[i];void 0!==o&&void 0!==n&&(t===!0&&o.setOptions({x:null,y:null}),o.setOptions({fixed:!1}),o.setOptions(n))}}},{key:"getPositions",value:function(t){var e={};if(void 0!==t){if(Array.isArray(t)===!0){for(var i=0;i<t.length;i++)if(void 0!==this.body.nodes[t[i]]){var o=this.body.nodes[t[i]];e[t[i]]={x:Math.round(o.x),y:Math.round(o.y)}}}else if(void 0!==this.body.nodes[t]){var n=this.body.nodes[t];e[t]={x:Math.round(n.x),y:Math.round(n.y)}}}else for(var s=0;s<this.body.nodeIndices.length;s++){var r=this.body.nodes[this.body.nodeIndices[s]];e[this.body.nodeIndices[s]]={x:Math.round(r.x),y:Math.round(r.y)}}return e}},{key:"storePositions",value:function(){var t=[],e=this.body.data.nodes.getDataSet();for(var i in e._data)if(e._data.hasOwnProperty(i)){var o=this.body.nodes[i];e._data[i].x==Math.round(o.x)&&e._data[i].y==Math.round(o.y)||t.push({id:o.id,x:Math.round(o.x),y:Math.round(o.y)})}e.update(t)}},{key:"getBoundingBox",value:function(t){if(void 0!==this.body.nodes[t])return this.body.nodes[t].shape.boundingBox}},{key:"getConnectedNodes",value:function(t){var e=[];if(void 0!==this.body.nodes[t])for(var i=this.body.nodes[t],o={},n=0;n<i.edges.length;n++){var s=i.edges[n];s.toId==i.id?void 0===o[s.fromId]&&(e.push(s.fromId),o[s.fromId]=!0):s.fromId==i.id&&void 0===o[s.toId]&&(e.push(s.toId),o[s.toId]=!0)}return e}},{key:"getConnectedEdges",value:function(t){var e=[];if(void 0!==this.body.nodes[t])for(var i=this.body.nodes[t],o=0;o<i.edges.length;o++)e.push(i.edges[o].id);else console.log("NodeId provided for getConnectedEdges does not exist. Provided: ",t);return e}},{key:"moveNode",value:function(t,e,i){var o=this;void 0!==this.body.nodes[t]?(this.body.nodes[t].x=Number(e),this.body.nodes[t].y=Number(i),setTimeout(function(){o.body.emitter.emit("startSimulation")},0)):console.log("Node id supplied to moveNode does not exist. Provided: ",t)}}]),t}();e.default=m},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(62),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(160),u=o(l),c=i(165),p=o(c),f=i(176),m=o(f),v=i(178),g=o(v),y=i(179),b=o(y),_=i(180),w=o(_),x=i(182),k=o(x),O=i(183),D=o(O),S=i(184),M=o(S),C=i(185),T=o(C),E=i(186),P=o(E),I=i(187),N=o(I),z=i(188),R=o(z),L=i(189),A=o(L),B=i(190),F=o(B),H=i(122),j=(o(H),i(1)),W=function(){function t(e,i,o,n,s,r,h){(0,a.default)(this,t),this.options=j.bridgeObject(s),this.globalOptions=s,this.defaultOptions=r,this.nodeOptions=h,this.body=i,this.edges=[],this.id=void 0,this.imagelist=o,this.grouplist=n,this.x=void 0,this.y=void 0,this.baseSize=this.options.size,
+this.baseFontSize=this.options.font.size,this.predefinedPosition=!1,this.selected=!1,this.hover=!1,this.labelModule=new u.default(this.body,this.options,!1),this.setOptions(e)}return(0,d.default)(t,[{key:"attachEdge",value:function(t){this.edges.indexOf(t)===-1&&this.edges.push(t)}},{key:"detachEdge",value:function(t){var e=this.edges.indexOf(t);e!=-1&&this.edges.splice(e,1)}},{key:"setOptions",value:function(e){var i=this.options.shape;if(e){if(void 0!==e.id&&(this.id=e.id),void 0===this.id)throw"Node must have an id";if(void 0!==e.x&&(null===e.x?(this.x=void 0,this.predefinedPosition=!1):(this.x=parseInt(e.x),this.predefinedPosition=!0)),void 0!==e.y&&(null===e.y?(this.y=void 0,this.predefinedPosition=!1):(this.y=parseInt(e.y),this.predefinedPosition=!0)),void 0!==e.size&&(this.baseSize=e.size),void 0!==e.value&&(e.value=parseFloat(e.value)),"number"==typeof e.group||"string"==typeof e.group&&""!=e.group){var o=this.grouplist.get(e.group);j.deepExtend(this.options,o),this.options.color=j.parseColor(this.options.color)}if(t.parseOptions(this.options,e,!0,this.globalOptions),this.choosify(e),void 0!==this.options.image){if(!this.imagelist)throw"No imagelist provided";this.imageObj=this.imagelist.load(this.options.image,this.options.brokenImage,this.id)}return this.updateLabelModule(e),this.updateShape(i),this.labelModule.propagateFonts(this.nodeOptions,e,this.defaultOptions),void 0!==e.hidden||void 0!==e.physics}}},{key:"choosify",value:function(t){this.chooser=!0;var e=[t,this.options,this.defaultOptions],i=j.topMost(e,"chosen");if("boolean"==typeof i)this.chooser=i;else if("object"===("undefined"==typeof i?"undefined":(0,s.default)(i))){var o=j.topMost(e,["chosen","node"]);"boolean"!=typeof o&&"function"!=typeof o||(this.chooser=o)}}},{key:"getFormattingValues",value:function(){var t={color:this.options.color.background,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};return this.selected||this.hover?this.chooser===!0?this.selected?(t.borderWidth*=2,t.color=this.options.color.highlight.background,t.borderColor=this.options.color.highlight.border,t.shadow=this.options.shadow.enabled):this.hover&&(t.color=this.options.color.hover.background,t.borderColor=this.options.color.hover.border,t.shadow=this.options.shadow.enabled):"function"==typeof this.chooser&&(this.chooser(t,this.options.id,this.selected,this.hover),t.shadow===!1&&(t.shadowColor===this.options.shadow.color&&t.shadowSize===this.options.shadow.size&&t.shadowX===this.options.shadow.x&&t.shadowY===this.options.shadow.y||(t.shadow=!0))):t.shadow=this.options.shadow.enabled,t}},{key:"updateLabelModule",value:function(t){void 0!==this.options.label&&null!==this.options.label||(this.options.label=""),this.labelModule.setOptions(this.options,!0),void 0!==this.labelModule.baseSize&&(this.baseFontSize=this.labelModule.baseSize),this.labelModule.constrain(this.nodeOptions,t,this.defaultOptions),this.labelModule.choosify(this.nodeOptions,t,this.defaultOptions)}},{key:"updateShape",value:function(t){if(t===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj);else switch(this.options.shape){case"box":this.shape=new p.default(this.options,this.body,this.labelModule);break;case"circle":this.shape=new m.default(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new g.default(this.options,this.body,this.labelModule,this.imageObj);break;case"database":this.shape=new b.default(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new w.default(this.options,this.body,this.labelModule);break;case"dot":this.shape=new k.default(this.options,this.body,this.labelModule);break;case"ellipse":this.shape=new D.default(this.options,this.body,this.labelModule);break;case"icon":this.shape=new M.default(this.options,this.body,this.labelModule);break;case"image":this.shape=new T.default(this.options,this.body,this.labelModule,this.imageObj);break;case"square":this.shape=new P.default(this.options,this.body,this.labelModule);break;case"star":this.shape=new N.default(this.options,this.body,this.labelModule);break;case"text":this.shape=new R.default(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new A.default(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new F.default(this.options,this.body,this.labelModule);break;default:this.shape=new D.default(this.options,this.body,this.labelModule)}this._reset()}},{key:"select",value:function(){this.selected=!0,this._reset()}},{key:"unselect",value:function(){this.selected=!1,this._reset()}},{key:"_reset",value:function(){this.shape.width=void 0,this.shape.height=void 0}},{key:"getTitle",value:function(){return this.options.title}},{key:"distanceToBorder",value:function(t,e){return this.shape.distanceToBorder(t,e)}},{key:"isFixed",value:function(){return this.options.fixed.x&&this.options.fixed.y}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(t,e,i){if(void 0!==this.options.value){var o=this.options.scaling.customScalingFunction(t,e,i,this.options.value),n=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){var s=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+o*s}this.options.size=this.options.scaling.min+o*n}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}},{key:"draw",value:function(t){var e=this.getFormattingValues();this.shape.draw(t,this.x,this.y,this.selected,this.hover,e)}},{key:"updateBoundingBox",value:function(t){this.shape.updateBoundingBox(this.x,this.y,t)}},{key:"resize",value:function(t){var e=this.getFormattingValues();this.shape.resize(t,this.selected,this.hover,e)}},{key:"isOverlappingWith",value:function(t){return this.shape.left<t.right&&this.shape.left+this.shape.width>t.left&&this.shape.top<t.bottom&&this.shape.top+this.shape.height>t.top}},{key:"isBoundingBoxOverlappingWith",value:function(t){return this.shape.boundingBox.left<t.right&&this.shape.boundingBox.right>t.left&&this.shape.boundingBox.top<t.bottom&&this.shape.boundingBox.bottom>t.top}}],[{key:"parseOptions",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=["color","font","fixed","shadow"];if(j.selectiveNotDeepExtend(n,t,e,i),j.mergeOptions(t,e,"shadow",i,o),void 0!==e.color&&null!==e.color){var s=j.parseColor(e.color);j.fillIfDefined(t.color,s)}else i===!0&&null===e.color&&(t.color=j.bridgeObject(o.color));void 0!==e.fixed&&null!==e.fixed&&("boolean"==typeof e.fixed?(t.fixed.x=e.fixed,t.fixed.y=e.fixed):(void 0!==e.fixed.x&&"boolean"==typeof e.fixed.x&&(t.fixed.x=e.fixed.x),void 0!==e.fixed.y&&"boolean"==typeof e.fixed.y&&(t.fixed.y=e.fixed.y))),void 0!==e.font&&null!==e.font?u.default.parseOptions(t.font,e):i===!0&&null===e.font&&(t.font=j.bridgeObject(o.font)),void 0!==e.scaling&&j.mergeOptions(t.scaling,e.scaling,"label",i,o.scaling)}}]),t}();e.default=W},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(161),s=o(n),r=i(2),a=o(r),h=i(62),d=o(h),l=i(115),u=o(l),c=i(116),p=o(c),f=i(1),m=function(){function t(e,i){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,u.default)(this,t),this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(i),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=o}return(0,p.default)(t,[{key:"setOptions",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.elementOptions=e,this.fontOptions=f.deepExtend({},e.font,!0),void 0!==e.label&&(this.labelDirty=!0),void 0!==e.font&&(t.parseOptions(this.fontOptions,e,i),"string"==typeof e.font?this.baseSize=this.fontOptions.size:"object"===(0,d.default)(e.font)&&void 0!==e.font.size&&(this.baseSize=e.font.size))}},{key:"constrain",value:function(t,e,i){this.fontOptions.constrainWidth=!1,this.fontOptions.maxWdt=-1,this.fontOptions.minWdt=-1;var o=[e,t,i],n=f.topMost(o,"widthConstraint");if("number"==typeof n)this.fontOptions.maxWdt=Number(n),this.fontOptions.minWdt=Number(n);else if("object"===("undefined"==typeof n?"undefined":(0,d.default)(n))){var s=f.topMost(o,["widthConstraint","maximum"]);"number"==typeof s&&(this.fontOptions.maxWdt=Number(s));var r=f.topMost(o,["widthConstraint","minimum"]);"number"==typeof r&&(this.fontOptions.minWdt=Number(r))}this.fontOptions.constrainHeight=!1,this.fontOptions.minHgt=-1,this.fontOptions.valign="middle";var a=f.topMost(o,"heightConstraint");if("number"==typeof a)this.fontOptions.minHgt=Number(a);else if("object"===("undefined"==typeof a?"undefined":(0,d.default)(a))){var h=f.topMost(o,["heightConstraint","minimum"]);"number"==typeof h&&(this.fontOptions.minHgt=Number(h));var l=f.topMost(o,["heightConstraint","valign"]);"string"==typeof l&&("top"!==l&&"bottom"!==l||(this.fontOptions.valign=l))}}},{key:"choosify",value:function(t,e,i){this.fontOptions.chooser=!0;var o=[e,t,i],n=f.topMost(o,"chosen");if("boolean"==typeof n)this.fontOptions.chooser=n;else if("object"===("undefined"==typeof n?"undefined":(0,d.default)(n))){var s=f.topMost(o,["chosen","label"]);"boolean"!=typeof s&&"function"!=typeof s||(this.fontOptions.chooser=s)}}},{key:"adjustSizes",value:function(t){var e=t?t.right+t.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=e,this.fontOptions.minWdt-=e);var i=t?t.top+t.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}},{key:"propagateFonts",value:function(t,e,i){if(this.fontOptions.multi){var o=["bold","ital","boldital","mono"],n=!0,s=!1,r=void 0;try{for(var h,d=(0,a.default)(o);!(n=(h=d.next()).done);n=!0){var l=h.value,u=void 0;if(t.font&&(u=t.font[l]),"string"==typeof u){var c=u.split(" ");this.fontOptions[l].size=c[0].replace("px",""),this.fontOptions[l].face=c[1],this.fontOptions[l].color=c[2],this.fontOptions[l].vadjust=this.fontOptions.vadjust,this.fontOptions[l].mod=i.font[l].mod}else{if(u&&u.hasOwnProperty("face")?this.fontOptions[l].face=u.face:e.font&&e.font[l]&&e.font[l].hasOwnProperty("face")?this.fontOptions[l].face=e.font[l].face:"mono"===l?this.fontOptions[l].face=i.font[l].face:e.font&&e.font.hasOwnProperty("face")?this.fontOptions[l].face=e.font.face:this.fontOptions[l].face=this.fontOptions.face,u&&u.hasOwnProperty("color")?this.fontOptions[l].color=u.color:e.font&&e.font[l]&&e.font[l].hasOwnProperty("color")?this.fontOptions[l].color=e.font[l].color:e.font&&e.font.hasOwnProperty("color")?this.fontOptions[l].color=e.font.color:this.fontOptions[l].color=this.fontOptions.color,u&&u.hasOwnProperty("mod")?this.fontOptions[l].mod=u.mod:e.font&&e.font[l]&&e.font[l].hasOwnProperty("mod")?this.fontOptions[l].mod=e.font[l].mod:e.font&&e.font.hasOwnProperty("mod")?this.fontOptions[l].mod=e.font.mod:this.fontOptions[l].mod=i.font[l].mod,u&&u.hasOwnProperty("size"))this.fontOptions[l].size=u.size;else if(e.font&&e.font[l]&&e.font[l].hasOwnProperty("size"))this.fontOptions[l].size=e.font[l].size;else if(this.fontOptions[l].face===i.font[l].face&&this.fontOptions.face===i.font.face){var p=this.fontOptions.size/Number(i.font.size);this.fontOptions[l].size=i.font[l].size*p}else e.font&&e.font.hasOwnProperty("size")?this.fontOptions[l].size=e.font.size:this.fontOptions[l].size=this.fontOptions.size;if(u&&u.hasOwnProperty("vadjust"))this.fontOptions[l].vadjust=u.vadjust;else if(e.font&&e.font[l]&&e.font[l].hasOwnProperty("vadjust"))this.fontOptions[l].vadjust=e.font[l].vadjust;else if(this.fontOptions[l].face===i.font[l].face&&this.fontOptions.face===i.font.face){var f=this.fontOptions.size/Number(i.font.size);this.fontOptions[l].vadjust=i.font[l].vadjust*Math.round(f)}else e.font&&e.font.hasOwnProperty("vadjust")?this.fontOptions[l].vadjust=e.font.vadjust:this.fontOptions[l].vadjust=this.fontOptions.vadjust}this.fontOptions[l].size=Number(this.fontOptions[l].size),this.fontOptions[l].vadjust=Number(this.fontOptions[l].vadjust)}}catch(t){s=!0,r=t}finally{try{!n&&d.return&&d.return()}finally{if(s)throw r}}}}},{key:"draw",value:function(t,e,i,o,n){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";if(void 0!==this.elementOptions.label){var r=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&r<this.elementOptions.scaling.label.drawThreshold-1||(this.calculateLabelSize(t,o,n,e,i,s),this._drawBackground(t),this._drawText(t,o,n,e,i,s))}}},{key:"_drawBackground",value:function(t){if(void 0!==this.fontOptions.background&&"none"!==this.fontOptions.background){t.fillStyle=this.fontOptions.background;var e=2;if(this.isEdgeLabel)switch(this.fontOptions.align){case"middle":t.fillRect(.5*-this.size.width,.5*-this.size.height,this.size.width,this.size.height);break;case"top":t.fillRect(.5*-this.size.width,-(this.size.height+e),this.size.width,this.size.height);break;case"bottom":t.fillRect(.5*-this.size.width,e,this.size.width,this.size.height);break;default:t.fillRect(this.size.left,this.size.top-.5*e,this.size.width,this.size.height)}else t.fillRect(this.size.left,this.size.top-.5*e,this.size.width,this.size.height)}}},{key:"_drawText",value:function(t,e,i,o,n){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle",a=this.fontOptions.size,h=a*this.body.view.scale;h>=this.elementOptions.scaling.label.maxVisible&&(a=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale);var d=this.size.yLine,l=this._setAlignment(t,o,d,r),u=(0,s.default)(l,2);o=u[0],d=u[1],t.textAlign="left",o-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&("top"===this.fontOptions.valign&&(d-=(this.size.height-this.size.labelHeight)/2),"bottom"===this.fontOptions.valign&&(d+=(this.size.height-this.size.labelHeight)/2));for(var c=0;c<this.lineCount;c++)if(this.lines[c]&&this.lines[c].blocks){var p=0;this.isEdgeLabel||"center"===this.fontOptions.align?p+=(this.size.width-this.lines[c].width)/2:"right"===this.fontOptions.align&&(p+=this.size.width-this.lines[c].width);for(var f=0;f<this.lines[c].blocks.length;f++){var m=this.lines[c].blocks[f];t.font=m.font;var v=this._getColor(m.color,h,m.strokeColor),g=(0,s.default)(v,2),y=g[0],b=g[1];m.strokeWidth>0&&(t.lineWidth=m.strokeWidth,t.strokeStyle=b,t.lineJoin="round"),t.fillStyle=y,m.strokeWidth>0&&t.strokeText(m.text,o+p,d+m.vadjust),t.fillText(m.text,o+p,d+m.vadjust),p+=m.width}d+=this.lines[c].height}}},{key:"_setAlignment",value:function(t,e,i,o){if(this.isEdgeLabel&&"horizontal"!==this.fontOptions.align&&this.pointToSelf===!1){e=0,i=0;var n=2;"top"===this.fontOptions.align?(t.textBaseline="alphabetic",i-=2*n):"bottom"===this.fontOptions.align?(t.textBaseline="hanging",i+=2*n):t.textBaseline="middle"}else t.textBaseline=o;return[e,i]}},{key:"_getColor",value:function(t,e,i){var o=t||"#000000",n=i||"#ffffff";if(e<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-e)));o=f.overrideOpacity(o,s),n=f.overrideOpacity(n,s)}return[o,n]}},{key:"getTextSize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._processLabel(t,e,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"calculateLabelSize",value:function(t,e,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";this.labelDirty===!0&&this._processLabel(t,e,i),this.size.left=o-.5*this.size.width,this.size.top=n-.5*this.size.height,this.size.yLine=n+.5*(1-this.lineCount)*this.fontOptions.size,"hanging"===s&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4),this.labelDirty=!1}},{key:"decodeMarkupSystem",value:function(t){var e="none";return"markdown"===t||"md"===t?e="markdown":t!==!0&&"html"!==t||(e="html"),e}},{key:"splitBlocks",value:function(t,e){var i=this.decodeMarkupSystem(e);return"none"===i?[{text:t,mod:"normal"}]:"markdown"===i?this.splitMarkdownBlocks(t):"html"===i?this.splitHtmlBlocks(t):void 0}},{key:"splitMarkdownBlocks",value:function(t){var e=[],i={bold:!1,ital:!1,mono:!1,beginable:!0,spacing:!1,position:0,buffer:"",modStack:[]};for(i.mod=function(){return 0===this.modStack.length?"normal":this.modStack[0]},i.modName=function(){return 0===this.modStack.length?"normal":"mono"===this.modStack[0]?"mono":i.bold&&i.ital?"boldital":i.bold?"bold":i.ital?"ital":void 0},i.emitBlock=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(e.push({text:this.buffer,mod:this.modName()}),this.buffer="")},i.add=function(t){" "===t&&(i.spacing=!0),i.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=t&&(this.buffer+=t)};i.position<t.length;){var o=t.charAt(i.position);/[ \t]/.test(o)?(i.mono?i.add(o):i.spacing=!0,i.beginable=!0):/\\/.test(o)?i.position<t.length+1&&(i.position++,o=t.charAt(i.position),/ \t/.test(o)?i.spacing=!0:(i.add(o),i.beginable=!1)):i.mono||i.bold||!i.beginable&&!i.spacing||!/\*/.test(o)?i.mono||i.ital||!i.beginable&&!i.spacing||!/\_/.test(o)?!i.mono&&(i.beginable||i.spacing)&&/`/.test(o)?(i.emitBlock(),i.mono=!0,i.modStack.unshift("mono")):!i.mono&&"bold"===i.mod()&&/\*/.test(o)?i.position===t.length-1||/[.,_` \t\n]/.test(t.charAt(i.position+1))?(i.emitBlock(),i.bold=!1,i.modStack.shift()):i.add(o):!i.mono&&"ital"===i.mod()&&/\_/.test(o)?i.position===t.length-1||/[.,*` \t\n]/.test(t.charAt(i.position+1))?(i.emitBlock(),i.ital=!1,i.modStack.shift()):i.add(o):i.mono&&"mono"===i.mod()&&/`/.test(o)?i.position===t.length-1||/[.,*_ \t\n]/.test(t.charAt(i.position+1))?(i.emitBlock(),i.mono=!1,i.modStack.shift()):i.add(o):(i.add(o),i.beginable=!1):(i.emitBlock(),i.ital=!0,i.modStack.unshift("ital")):(i.emitBlock(),i.bold=!0,i.modStack.unshift("bold")),i.position++}return i.emitBlock(),e}},{key:"splitHtmlBlocks",value:function(t){var e=[],i={bold:!1,ital:!1,mono:!1,spacing:!1,position:0,buffer:"",modStack:[]};for(i.mod=function(){return 0===this.modStack.length?"normal":this.modStack[0]},i.modName=function(){return 0===this.modStack.length?"normal":"mono"===this.modStack[0]?"mono":i.bold&&i.ital?"boldital":i.bold?"bold":i.ital?"ital":void 0},i.emitBlock=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(e.push({text:this.buffer,mod:this.modName()}),this.buffer="")},i.add=function(t){" "===t&&(i.spacing=!0),i.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=t&&(this.buffer+=t)};i.position<t.length;){var o=t.charAt(i.position);/[ \t]/.test(o)?i.mono?i.add(o):i.spacing=!0:/</.test(o)?i.mono||i.bold||!/<b>/.test(t.substr(i.position,3))?i.mono||i.ital||!/<i>/.test(t.substr(i.position,3))?!i.mono&&/<code>/.test(t.substr(i.position,6))?(i.emitBlock(),i.mono=!0,i.modStack.unshift("mono"),i.position+=5):!i.mono&&"bold"===i.mod()&&/<\/b>/.test(t.substr(i.position,4))?(i.emitBlock(),i.bold=!1,i.modStack.shift(),i.position+=3):!i.mono&&"ital"===i.mod()&&/<\/i>/.test(t.substr(i.position,4))?(i.emitBlock(),i.ital=!1,i.modStack.shift(),i.position+=3):"mono"===i.mod()&&/<\/code>/.test(t.substr(i.position,7))?(i.emitBlock(),i.mono=!1,i.modStack.shift(),i.position+=6):i.add(o):(i.emitBlock(),i.ital=!0,i.modStack.unshift("ital"),i.position+=2):(i.emitBlock(),i.bold=!0,i.modStack.unshift("bold"),i.position+=2):/&/.test(o)?/&lt;/.test(t.substr(i.position,4))?(i.add("<"),i.position+=3):/&amp;/.test(t.substr(i.position,5))?(i.add("&"),i.position+=4):i.add("&"):i.add(o),i.position++}return i.emitBlock(),e}},{key:"getFormattingValues",value:function(t,e,i,o){var n={color:"normal"===o?this.fontOptions.color:this.fontOptions[o].color,size:"normal"===o?this.fontOptions.size:this.fontOptions[o].size,face:"normal"===o?this.fontOptions.face:this.fontOptions[o].face,mod:"normal"===o?"":this.fontOptions[o].mod,vadjust:"normal"===o?this.fontOptions.vadjust:this.fontOptions[o].vadjust,strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};return"normal"===o?(e||i)&&(this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?n.mod="bold":"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(t,n,this.elementOptions.id,e,i)):(e||i)&&"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(t,n,this.elementOptions.id,e,i),t.font=(n.mod+" "+n.size+"px "+n.face).replace(/"/g,""),n.font=t.font,n.height=n.size,n}},{key:"differentState",value:function(t,e){return t!==this.fontOptions.selectedState&&e!==this.fontOptions.hoverState}},{key:"_processLabel",value:function(t,e,i){var o=0,n=0,s=[],r=0;if(s.add=function(t,e,i,o,n,s,r,a,h,d){this.length==t&&(this[t]={width:0,height:0,blocks:[]}),this[t].blocks.push({text:e,font:i,color:o,width:n,height:s,vadjust:r,mod:a,strokeWidth:h,strokeColor:d})},s.accumulate=function(t,e,i){this[t].width+=e,this[t].height=i>this[t].height?i:this[t].height},s.addAndAccumulate=function(t,e,i,o,n,s,r,a,h,d){this.add(t,e,i,o,n,s,r,a,h,d),this.accumulate(t,n,s)},void 0!==this.elementOptions.label){var a=String(this.elementOptions.label).split("\n"),h=a.length;if(this.elementOptions.font.multi)for(var d=0;d<h;d++){var l=this.splitBlocks(a[d],this.elementOptions.font.multi),u=0,c=0;if(l){if(0==l.length){var p=this.getFormattingValues(t,e,i,"normal");s.addAndAccumulate(r,"",p.font,p.color,0,p.size,p.vadjust,"normal",p.strokeWidth,p.strokeColor),n+=s[r].height,r++;continue}for(var f=0;f<l.length;f++)if(this.fontOptions.maxWdt>0)for(var m=this.getFormattingValues(t,e,i,l[f].mod),v=l[f].text.split(" "),g=!0,y="",b=void 0,_=void 0,w=0;w<v.length;){var x=g?"":" ";_=b,b=t.measureText(y+x+v[w]),u+b.width>this.fontOptions.maxWdt?(c=m.height>c?m.height:c,s.add(r,y,m.font,m.color,_.width,m.height,m.vadjust,l[f].mod,m.strokeWidth,m.strokeColor),s.accumulate(r,_.width,c),y="",g=!0,u=0,o=s[r].width>o?s[r].width:o,n+=s[r].height,r++):(y=y+x+v[w],w===v.length-1&&(c=m.height>c?m.height:c,u+=b.width,s.add(r,y,m.font,m.color,b.width,m.height,m.vadjust,l[f].mod,m.strokeWidth,m.strokeColor),s.accumulate(r,b.width,c),f===l.length-1&&(o=s[r].width>o?s[r].width:o,n+=s[r].height,r++)),w++,g=!1)}else{var k=this.getFormattingValues(t,e,i,l[f].mod),O=t.measureText(l[f].text);s.addAndAccumulate(r,l[f].text,k.font,k.color,O.width,k.height,k.vadjust,l[f].mod,k.strokeWidth,k.strokeColor),o=s[r].width>o?s[r].width:o,l.length-1===f&&(n+=s[r].height,r++)}}}else for(var D=0;D<h;D++){var S=this.getFormattingValues(t,e,i,"normal");if(this.fontOptions.maxWdt>0)for(var M=a[D].split(" "),C="",T=void 0,E=void 0,P=0;P<M.length;){var I=""===C?"":" ";E=T,T=t.measureText(C+I+M[P]),T.width>this.fontOptions.maxWdt?(s.addAndAccumulate(r,C,S.font,S.color,E.width,S.size,S.vadjust,"normal",S.strokeWidth,S.strokeColor),o=s[r].width>o?s[r].width:o,n+=s[r].height,C="",r++):(C=C+I+M[P],P===M.length-1&&(s.addAndAccumulate(r,C,S.font,S.color,T.width,S.size,S.vadjust,"normal",S.strokeWidth,S.strokeColor),o=s[r].width>o?s[r].width:o,n+=s[r].height,r++),P++)}else{var N=a[D],z=t.measureText(N);s.addAndAccumulate(r,N,S.font,S.color,z.width,S.size,S.vadjust,"normal",S.strokeWidth,S.strokeColor),o=s[r].width>o?s[r].width:o,n+=s[r].height,r++}}}this.fontOptions.minWdt>0&&o<this.fontOptions.minWdt&&(o=this.fontOptions.minWdt),this.size.labelHeight=n,this.fontOptions.minHgt>0&&n<this.fontOptions.minHgt&&(n=this.fontOptions.minHgt),this.lines=s,this.lineCount=s.length,this.size.width=o,this.size.height=n,this.selectedState=e,this.hoverState=i}}],[{key:"parseOptions",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof e.font){var o=e.font.split(" ");t.size=o[0].replace("px",""),t.face=o[1],t.color=o[2],t.vadjust=0}else"object"===(0,d.default)(e.font)&&f.fillIfDefined(t,e.font,i);t.size=Number(t.size),t.vadjust=Number(t.vadjust)}}]),t}();e.default=m},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var n=i(162),s=o(n),r=i(2),a=o(r);e.default=function(){function t(t,e){var i=[],o=!0,n=!1,s=void 0;try{for(var r,h=(0,a.default)(t);!(o=(r=h.next()).done)&&(i.push(r.value),!e||i.length!==e);o=!0);}catch(t){n=!0,s=t}finally{try{!o&&h.return&&h.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if((0,s.default)(Object(e)))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(t,e,i){t.exports={default:i(163),__esModule:!0}},function(t,e,i){i(4),i(50),t.exports=i(164)},function(t,e,i){var o=i(54),n=i(47)("iterator"),s=i(8);t.exports=i(17).isIterable=function(t){var e=Object(t);return void 0!==e[n]||"@@iterator"in e||s.hasOwnProperty(o(e))}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(175),m=o(f),v=function(t){function e(t,i,o){(0,a.default)(this,e);var n=(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o));return n._setMargins(o),n}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;(void 0===this.width||this.labelModule.differentState(e,i))&&(this.textSize=this.labelModule.getTextSize(t,e,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=this.width/2)}},{key:"draw",value:function(t,e,i,o,n,s){this.resize(t,o,n),this.left=e-this.width/2,this.top=i-this.height/2,t.strokeStyle=s.borderColor,t.lineWidth=s.borderWidth,t.lineWidth/=this.body.view.scale,t.lineWidth=Math.min(this.width,t.lineWidth),t.fillStyle=s.color,t.roundRect(this.left,this.top,this.width,this.height,s.borderRadius),this.enableShadow(t,s),t.fill(),this.disableShadow(t,s),t.save(),s.borderWidth>0&&(this.enableBorderDashes(t,s),t.stroke(),this.disableBorderDashes(t,s)),t.restore(),this.updateBoundingBox(e,i,t,o,n),this.labelModule.draw(t,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n)}},{key:"updateBoundingBox",value:function(t,e,i,o,n){this.resize(i,o,n),this.left=t-this.width/2,this.top=e-this.height/2;var s=this.options.shapeProperties.borderRadius;this.boundingBox.left=this.left-s,this.boundingBox.top=this.top-s,this.boundingBox.bottom=this.top+this.height+s,this.boundingBox.right=this.left+this.width+s}},{key:"distanceToBorder",value:function(t,e){this.resize(t);var i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(e)),Math.abs(this.height/2/Math.sin(e)))+i}}]),e}(m.default);e.default=v},function(t,e,i){t.exports={default:i(167),__esModule:!0}},function(t,e,i){i(168),t.exports=i(17).Object.getPrototypeOf},function(t,e,i){var o=i(49),n=i(48);i(61)("getPrototypeOf",function(){return function(t){return n(o(t))}})},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var n=i(62),s=o(n);e.default=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":(0,s.default)(e))&&"function"!=typeof e?t:e}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var n=i(171),s=o(n),r=i(55),a=o(r),h=i(62),d=o(h);e.default=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":(0,d.default)(e)));t.prototype=(0,a.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(s.default?(0,s.default)(t,e):t.__proto__=e)}},function(t,e,i){t.exports={default:i(172),__esModule:!0}},function(t,e,i){i(173),t.exports=i(17).Object.setPrototypeOf},function(t,e,i){var o=i(15);o(o.S,"Object",{setPrototypeOf:i(174).set})},function(t,e,i){var o=i(23),n=i(22),s=function(t,e){if(n(t),!o(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,o){try{o=i(18)(Function.call,i(78).f(Object.prototype,"__proto__").set,2),o(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,i){return s(t,i),e?t.__proto__=i:o(t,i),t}}({},!1):void 0),check:s}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(62),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=function(){function t(e,i,o){(0,a.default)(this,t),this.body=i,this.labelModule=o,this.setOptions(e),this.top=void 0,this.left=void 0,this.height=void 0,this.width=void 0,this.radius=void 0,this.margin=void 0,this.boundingBox={top:0,left:0,right:0,bottom:0}}return(0,d.default)(t,[{key:"setOptions",value:function(t){this.options=t}},{key:"_setMargins",value:function(t){this.margin={},this.options.margin&&("object"==(0,s.default)(this.options.margin)?(this.margin.top=this.options.margin.top,this.margin.right=this.options.margin.right,this.margin.bottom=this.options.margin.bottom,this.margin.left=this.options.margin.left):(this.margin.top=this.options.margin,this.margin.right=this.options.margin,this.margin.bottom=this.options.margin,this.margin.left=this.options.margin)),t.adjustSizes(this.margin)}},{key:"_distanceToBorder",value:function(t,e){var i=this.options.borderWidth;return this.resize(t),Math.min(Math.abs(this.width/2/Math.cos(e)),Math.abs(this.height/2/Math.sin(e)))+i}},{key:"enableShadow",value:function(t,e){e.shadow&&(t.shadowColor=e.shadowColor,t.shadowBlur=e.shadowSize,t.shadowOffsetX=e.shadowX,t.shadowOffsetY=e.shadowY)}},{key:"disableShadow",value:function(t,e){e.shadow&&(t.shadowColor="rgba(0,0,0,0)",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0)}},{key:"enableBorderDashes",value:function(t,e){if(e.borderDashes!==!1)if(void 0!==t.setLineDash){var i=e.borderDashes;i===!0&&(i=[5,15]),t.setLineDash(i)}else console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,e.borderDashes=!1}},{key:"disableBorderDashes",value:function(t,e){e.borderDashes!==!1&&(void 0!==t.setLineDash?t.setLineDash([0]):(console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,e.borderDashes=!1))}}]),t}();e.default=l},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(177),m=o(f),v=function(t){function e(t,i,o){(0,a.default)(this,e);var n=(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o));return n._setMargins(o),n}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;arguments.length>3&&void 0!==arguments[3]?arguments[3]:{size:this.options.size};if(void 0===this.width||this.labelModule.differentState(e,i)){this.textSize=this.labelModule.getTextSize(t,e,i);var o=Math.max(this.textSize.width+this.margin.right+this.margin.left,this.textSize.height+this.margin.top+this.margin.bottom);this.options.size=o/2,this.width=o,this.height=o,this.radius=this.width/2}}},{key:"draw",value:function(t,e,i,o,n,s){
+this.resize(t,o,n),this.left=e-this.width/2,this.top=i-this.height/2,this._drawRawCircle(t,e,i,o,n,s),this.boundingBox.top=i-s.size,this.boundingBox.left=e-s.size,this.boundingBox.right=e+s.size,this.boundingBox.bottom=i+s.size,this.updateBoundingBox(e,i),this.labelModule.draw(t,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n)}},{key:"updateBoundingBox",value:function(t,e){this.boundingBox.top=e-this.options.size,this.boundingBox.left=t-this.options.size,this.boundingBox.right=t+this.options.size,this.boundingBox.bottom=e+this.options.size}},{key:"distanceToBorder",value:function(t,e){return this.resize(t),.5*this.width}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(175),m=o(f),v=function(t){function e(t,i,o){(0,a.default)(this,e);var n=(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o));return n.labelOffset=0,n.imageLoaded=!1,n}return(0,p.default)(e,t),(0,d.default)(e,[{key:"setOptions",value:function(t,e){this.options=t,e&&(this.imageObj=e)}},{key:"_resizeImage",value:function(){var t=!1;if(this.imageObj.width&&this.imageObj.height?this.imageLoaded===!1&&(this.imageLoaded=!0,t=!0):this.imageLoaded=!1,!this.width||!this.height||t===!0){var e,i,o;this.imageObj.width&&this.imageObj.height&&(e=0,i=0),this.options.shapeProperties.useImageSize===!1?this.imageObj.width>this.imageObj.height?(o=this.imageObj.width/this.imageObj.height,e=2*this.options.size*o||this.imageObj.width,i=2*this.options.size||this.imageObj.height):(o=this.imageObj.width&&this.imageObj.height?this.imageObj.height/this.imageObj.width:1,e=2*this.options.size,i=2*this.options.size*o):(e=this.imageObj.width,i=this.imageObj.height),this.width=e,this.height=i,this.radius=.5*this.width}}},{key:"_drawRawCircle",value:function(t,e,i,o,n,s){var r=s.borderWidth/this.body.view.scale;t.lineWidth=Math.min(this.width,r),t.strokeStyle=s.borderColor,t.fillStyle=s.color,t.circle(e,i,s.size),this.enableShadow(t,s),t.fill(),this.disableShadow(t,s),t.save(),r>0&&(this.enableBorderDashes(t,s),t.stroke(),this.disableBorderDashes(t,s)),t.restore()}},{key:"_drawImageAtPosition",value:function(t,e){if(0!=this.imageObj.width){t.globalAlpha=1,this.enableShadow(t,e);var i=this.imageObj.width/this.width/this.body.view.scale;if(i>2&&this.options.shapeProperties.interpolation===!0){var o=this.imageObj.width,n=this.imageObj.height,s=document.createElement("canvas");s.width=o,s.height=o;var r=s.getContext("2d");i*=.5,o*=.5,n*=.5,r.drawImage(this.imageObj,0,0,o,n);for(var a=0,h=1;i>2&&h<4;)r.drawImage(s,a,0,o,n,a+o,0,o/2,n/2),a+=o,i*=.5,o*=.5,n*=.5,h+=1;t.drawImage(s,a,0,o,n,this.left,this.top,this.width,this.height)}else t.drawImage(this.imageObj,this.left,this.top,this.width,this.height);this.disableShadow(t,e)}}},{key:"_drawImageLabel",value:function(t,e,i,o,n){var s,r=0;if(void 0!==this.height){r=.5*this.height;var a=this.labelModule.getTextSize(t,o,n);a.lineCount>=1&&(r+=a.height/2)}s=i+r,this.options.label&&(this.labelOffset=r),this.labelModule.draw(t,e,s,o,n,"hanging")}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(177),m=o(f),v=function(t){function e(t,i,o,n){(0,a.default)(this,e);var r=(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o));return r.imageObj=n,r._swapToImageResizeWhenImageLoaded=!0,r}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height||this.labelModule.differentState(e,i)){var o=2*this.options.size;this.width=o,this.height=o,this._swapToImageResizeWhenImageLoaded=!0,this.radius=.5*this.width}else this._swapToImageResizeWhenImageLoaded&&(this.width=void 0,this.height=void 0,this._swapToImageResizeWhenImageLoaded=!1),this._resizeImage()}},{key:"draw",value:function(t,e,i,o,n,s){this.resize(),this.left=e-this.width/2,this.top=i-this.height/2;Math.min(.5*this.height,.5*this.width);this._drawRawCircle(t,e,i,o,n,s),t.save(),t.clip(),this._drawImageAtPosition(t,s),t.restore(),this._drawImageLabel(t,e,i,o,n),this.updateBoundingBox(e,i)}},{key:"updateBoundingBox",value:function(t,e){this.boundingBox.top=e-this.options.size,this.boundingBox.left=t-this.options.size,this.boundingBox.right=t+this.options.size,this.boundingBox.bottom=e+this.options.size,this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(t,e){return this.resize(t),.5*this.width}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(175),m=o(f),v=function(t){function e(t,i,o){(0,a.default)(this,e);var n=(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o));return n._setMargins(o),n}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t,e,i){if(void 0===this.width||this.labelModule.differentState(e,i)){this.textSize=this.labelModule.getTextSize(t,e,i);var o=this.textSize.width+this.margin.right+this.margin.left;this.width=o,this.height=o,this.radius=this.width/2}}},{key:"draw",value:function(t,e,i,o,n,s){this.resize(t,o,n),this.left=e-this.width/2,this.top=i-this.height/2;var r=s.borderWidth/this.body.view.scale;t.lineWidth=Math.min(this.width,r),t.strokeStyle=s.borderColor,t.fillStyle=s.color,t.database(e-this.width/2,i-this.height/2,this.width,this.height),this.enableShadow(t,s),t.fill(),this.disableShadow(t,s),t.save(),r>0&&(this.enableBorderDashes(t,s),t.stroke(),this.disableBorderDashes(t,s)),t.restore(),this.updateBoundingBox(e,i,t,o,n),this.labelModule.draw(t,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n)}},{key:"updateBoundingBox",value:function(t,e,i,o,n){this.resize(i,o,n),this.left=t-.5*this.width,this.top=e-.5*this.height,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(181),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.selected,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.hover;this._resizeShape(i,o,e)}},{key:"draw",value:function(t,e,i,o,n,s){this._drawShape(t,"diamond",4,e,i,o,n,s)}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(175),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"_resizeShape",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selected,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.hover,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{size:this.options.size};if(void 0===this.width||this.labelModule.differentState(t,e)){var o=2*i.size;this.width=o,this.height=o,this.radius=.5*this.width}}},{key:"_drawShape",value:function(t,e,i,o,n,s,r,a){this._resizeShape(s,r,a),this.left=o-this.width/2,this.top=n-this.height/2;var h=a.borderWidth/this.body.view.scale;if(t.lineWidth=Math.min(this.width,h),t.strokeStyle=a.borderColor,t.fillStyle=a.color,t[e](o,n,a.size),this.enableShadow(t,a),t.fill(),this.disableShadow(t,a),t.save(),h>0&&(this.enableBorderDashes(t,a),t.stroke(),this.disableBorderDashes(t,a)),t.restore(),void 0!==this.options.label){var d=n+.5*this.height+3;this.labelModule.draw(t,o,d,s,r,"hanging")}this.updateBoundingBox(o,n)}},{key:"updateBoundingBox",value:function(t,e){this.boundingBox.top=e-this.options.size,this.boundingBox.left=t-this.options.size,this.boundingBox.right=t+this.options.size,this.boundingBox.bottom=e+this.options.size,void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+3))}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(181),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.selected,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.hover;this._resizeShape(i,o,e)}},{key:"draw",value:function(t,e,i,o,n,s){this._drawShape(t,"circle",2,e,i,o,n,s)}},{key:"distanceToBorder",value:function(t,e){return this.resize(t),this.options.size}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(175),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(void 0===this.width||this.labelModule.differentState(e,i)){var o=this.labelModule.getTextSize(t,e,i);this.height=2*o.height,this.width=o.width+this.height,this.radius=.5*this.width}}},{key:"draw",value:function(t,e,i,o,n,s){this.resize(t,o,n),this.left=e-.5*this.width,this.top=i-.5*this.height;var r=s.borderWidth/this.body.view.scale;t.lineWidth=Math.min(this.width,r),t.strokeStyle=s.borderColor,t.fillStyle=s.color,t.ellipse(this.left,this.top,this.width,this.height),this.enableShadow(t,s),t.fill(),this.disableShadow(t,s),t.save(),r>0&&(this.enableBorderDashes(t,s),t.stroke(),this.disableBorderDashes(t,s)),t.restore(),this.updateBoundingBox(e,i,t,o,n),this.labelModule.draw(t,e,i,o,n)}},{key:"updateBoundingBox",value:function(t,e,i,o,n){this.resize(i,o,n),this.left=t-.5*this.width,this.top=e-.5*this.height,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"distanceToBorder",value:function(t,e){this.resize(t);var i=.5*this.width,o=.5*this.height,n=Math.sin(e)*i,s=Math.cos(e)*o;return i*o/Math.sqrt(n*n+s*s)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(175),m=o(f),v=function(t){function e(t,i,o){(0,a.default)(this,e);var n=(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o));return n._setMargins(o),n}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t,e,i){(void 0===this.width||this.labelModule.differentState(e,i))&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(t,e,i,o,n,s){if(this.resize(t,o,n),this.options.icon.size=this.options.icon.size||50,this.left=e-this.width/2,this.top=i-this.height/2,this._icon(t,e,i,o,n,s),void 0!==this.options.label){var r=5;this.labelModule.draw(t,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+r,o)}this.updateBoundingBox(e,i)}},{key:"updateBoundingBox",value:function(t,e){if(this.boundingBox.top=e-.5*this.options.icon.size,this.boundingBox.left=t-.5*this.options.icon.size,this.boundingBox.right=t+.5*this.options.icon.size,this.boundingBox.bottom=e+.5*this.options.icon.size,void 0!==this.options.label&&this.labelModule.size.width>0){var i=5;this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+i)}}},{key:"_icon",value:function(t,e,i,o,n,s){var r=Number(this.options.icon.size);void 0!==this.options.icon.code?(t.font=(o?"bold ":"")+r+"px "+this.options.icon.face,t.fillStyle=this.options.icon.color||"black",t.textAlign="center",t.textBaseline="middle",this.enableShadow(t,s),t.fillText(this.options.icon.code,e,i),this.disableShadow(t,s)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(177),m=o(f),v=function(t){function e(t,i,o,n){(0,a.default)(this,e);var r=(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o));return r.imageObj=n,r}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(){this._resizeImage()}},{key:"draw",value:function(t,e,i,o,n,s){if(this.resize(),this.left=e-this.width/2,this.top=i-this.height/2,this.options.shapeProperties.useBorderWithImage===!0){var r=this.options.borderWidth,a=this.options.borderWidthSelected||2*this.options.borderWidth,h=(o?a:r)/this.body.view.scale;t.lineWidth=Math.min(this.width,h),t.beginPath(),t.strokeStyle=o?this.options.color.highlight.border:n?this.options.color.hover.border:this.options.color.border,t.fillStyle=o?this.options.color.highlight.background:n?this.options.color.hover.background:this.options.color.background,t.rect(this.left-.5*t.lineWidth,this.top-.5*t.lineWidth,this.width+t.lineWidth,this.height+t.lineWidth),t.fill(),t.save(),h>0&&(this.enableBorderDashes(t),t.stroke(),this.disableBorderDashes(t)),t.restore(),t.closePath()}this._drawImageAtPosition(t,s),this._drawImageLabel(t,e,i,o,n),this.updateBoundingBox(e,i)}},{key:"updateBoundingBox",value:function(t,e){this.resize(),this.left=t-this.width/2,this.top=e-this.height/2,this.boundingBox.top=this.top,this.boundingBox.left=this.left,this.boundingBox.right=this.left+this.width,this.boundingBox.bottom=this.top+this.height,void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(181),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(){this._resizeShape()}},{key:"draw",value:function(t,e,i,o,n,s){this._drawShape(t,"square",2,e,i,o,n,s)}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(181),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t,e,i,o){this._resizeShape(i,o,e)}},{key:"draw",value:function(t,e,i,o,n,s){this._drawShape(t,"star",4,e,i,o,n,s)}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(175),m=o(f),v=function(t){function e(t,i,o){(0,a.default)(this,e);var n=(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o));return n._setMargins(o),n}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t,e,i){(void 0===this.width||this.labelModule.differentState(e,i))&&(this.textSize=this.labelModule.getTextSize(t,e,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(t,e,i,o,n,s){this.resize(t,o,n),this.left=e-this.width/2,this.top=i-this.height/2,this.enableShadow(t,s),this.labelModule.draw(t,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n),this.disableShadow(t,s),this.updateBoundingBox(e,i,t,o,n)}},{key:"updateBoundingBox",value:function(t,e,i,o,n){this.resize(i,o,n),this.left=t-this.width/2,this.top=e-this.height/2,this.boundingBox.top=this.top,this.boundingBox.left=this.left,this.boundingBox.right=this.left+this.width,this.boundingBox.bottom=this.top+this.height}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(181),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t){this._resizeShape()}},{key:"draw",value:function(t,e,i,o,n,s){this._drawShape(t,"triangle",3,e,i,o,n,s)}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(181),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"resize",value:function(t){this._resizeShape()}},{key:"draw",value:function(t,e,i,o,n,s){this._drawShape(t,"triangleDown",3,e,i,o,n,s)}},{key:"distanceToBorder",value:function(t,e){return this._distanceToBorder(t,e)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=i(192),d=o(h),l=i(160),u=o(l),c=i(1),p=i(91),f=i(93),m=function(){function t(e,i,o){var n=this;(0,s.default)(this,t),this.body=e,this.images=i,this.groups=o,this.body.functions.createEdge=this.create.bind(this),this.edgesListeners={add:function(t,e){n.add(e.items)},update:function(t,e){n.update(e.items)},remove:function(t,e){n.remove(e.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(t,e,i,o){if(e===t)return.5;var n=1/(e-t);return Math.max(0,(o-t)*n)}},selectionWidth:1.5,selfReferenceSize:20,shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},c.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,a.default)(t,[{key:"bindEventListeners",value:function(){var t=this;this.body.emitter.on("_forceDisableDynamicCurves",function(e){"dynamic"===e&&(e="continuous");var i=!1;for(var o in t.body.edges)if(t.body.edges.hasOwnProperty(o)){var n=t.body.edges[o],s=t.body.data.edges._data[o];if(void 0!==s){var r=s.smooth;void 0!==r&&r.enabled===!0&&"dynamic"===r.type&&(void 0===e?n.setOptions({smooth:!1}):n.setOptions({smooth:{type:e}}),i=!0)}}i===!0&&t.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){t.reconnectEdges()}),this.body.emitter.on("refreshEdges",this.refresh.bind(this)),this.body.emitter.on("refresh",this.refresh.bind(this)),this.body.emitter.on("destroy",function(){c.forEach(t.edgesListeners,function(e,i){t.body.data.edges&&t.body.data.edges.off(i,e)}),delete t.body.functions.createEdge,delete t.edgesListeners.add,delete t.edgesListeners.update,delete t.edgesListeners.remove,delete t.edgesListeners})}},{key:"setOptions",value:function(t){if(this.edgeOptions=t,void 0!==t){d.default.parseOptions(this.options,t);var e=!1;if(void 0!==t.smooth)for(var i in this.body.edges)this.body.edges.hasOwnProperty(i)&&(e=this.body.edges[i].updateEdgeType()||e);if(void 0!==t.font){u.default.parseOptions(this.options.font,t);for(var o in this.body.edges)this.body.edges.hasOwnProperty(o)&&this.body.edges[o].updateLabelModule()}void 0===t.hidden&&void 0===t.physics&&e!==!0||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this.body.data.edges;if(t instanceof p||t instanceof f)this.body.data.edges=t;else if(Array.isArray(t))this.body.data.edges=new p,this.body.data.edges.add(t);else{if(t)throw new TypeError("Array or DataSet expected");this.body.data.edges=new p}if(o&&c.forEach(this.edgesListeners,function(t,e){o.off(e,t)}),this.body.edges={},this.body.data.edges){c.forEach(this.edgesListeners,function(t,i){e.body.data.edges.on(i,t)});var n=this.body.data.edges.getIds();this.add(n,!0)}i===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.edges,o=this.body.data.edges,n=0;n<t.length;n++){var s=t[n],r=i[s];r&&r.disconnect();var a=o.get(s,{showInternalIds:!0});i[s]=this.create(a)}e===!1&&this.body.emitter.emit("_dataChanged")}},{key:"update",value:function(t){for(var e=this.body.edges,i=this.body.data.edges,o=!1,n=0;n<t.length;n++){var s=t[n],r=i.get(s),a=e[s];void 0!==a?(a.disconnect(),o=a.setOptions(r)||o,a.connect()):(this.body.edges[s]=this.create(r),o=!0)}o===!0?this.body.emitter.emit("_dataChanged"):this.body.emitter.emit("_dataUpdated")}},{key:"remove",value:function(t){for(var e=this.body.edges,i=0;i<t.length;i++){var o=t[i],n=e[o];void 0!==n&&(n.cleanup(),n.disconnect(),delete e[o])}this.body.emitter.emit("_dataChanged")}},{key:"refresh",value:function(){var t=this.body.edges;for(var e in t){var i=void 0;t.hasOwnProperty(e)&&(i=t[e]);var o=this.body.data.edges._data[e];void 0!==i&&void 0!==o&&i.setOptions(o)}}},{key:"create",value:function(t){return new d.default(t,this.body,this.options,this.defaultOptions,this.edgeOptions)}},{key:"reconnectEdges",value:function(){var t,e=this.body.nodes,i=this.body.edges;for(t in e)e.hasOwnProperty(t)&&(e[t].edges=[]);for(t in i)if(i.hasOwnProperty(t)){var o=i[t];o.from=null,o.to=null,o.connect()}}},{key:"getConnectedNodes",value:function(t){var e=[];if(void 0!==this.body.edges[t]){var i=this.body.edges[t];i.fromId&&e.push(i.fromId),i.toId&&e.push(i.toId)}return e}}]),t}();e.default=m},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(82),s=o(n),r=i(55),a=o(r),h=i(62),d=o(h),l=i(115),u=o(l),c=i(116),p=o(c),f=i(160),m=o(f),v=i(193),g=o(v),y=i(197),b=o(y),_=i(198),w=o(_),x=i(199),k=o(x),O=i(1),D=function(){function t(e,i,o,n,s){if((0,u.default)(this,t),void 0===i)throw"No body provided";this.options=O.bridgeObject(o),this.globalOptions=o,this.defaultOptions=n,this.edgeOptions=s,this.body=i,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new m.default(this.body,this.options,!0),this.setOptions(e)}return(0,p.default)(t,[{key:"setOptions",value:function(e){if(e){t.parseOptions(this.options,e,!0,this.globalOptions),void 0!==e.id&&(this.id=e.id),void 0!==e.from&&(this.fromId=e.from),void 0!==e.to&&(this.toId=e.to),void 0!==e.title&&(this.title=e.title),void 0!==e.value&&(e.value=parseFloat(e.value)),this.choosify(e),this.updateLabelModule(e),this.labelModule.propagateFonts(this.edgeOptions,e,this.defaultOptions);var i=this.updateEdgeType();return this._setInteractionWidths(),this.connect(),void 0===e.hidden&&void 0===e.physics||(i=!0),i}}},{key:"choosify",value:function(t){this.chooser=!0;var e=[t,this.options,this.defaultOptions],i=O.topMost(e,"chosen");if("boolean"==typeof i)this.chooser=i;else if("object"===("undefined"==typeof i?"undefined":(0,d.default)(i))){var o=O.topMost(e,["chosen","edge"]);"boolean"!=typeof o&&"function"!=typeof o||(this.chooser=o)}}},{key:"getFormattingValues",value:function(){var t=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,e=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,i=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,o=this.options.color.inherit,n={toArrow:t,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,middleArrow:i,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,fromArrow:e,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,arrowStrikethrough:this.options.arrowStrikethrough,color:o?void 0:this.options.color.color,inheritsColor:o,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){var s=this.options.selectionWidth;"function"==typeof s?n.width=s(n.width):"number"==typeof s&&(n.width+=s),n.width=Math.max(n.width,.3/this.body.view.scale),n.color=this.options.color.highlight,n.shadow=this.options.shadow.enabled}else if(this.hover){var r=this.options.hoverWidth;"function"==typeof r?n.width=r(n.width):"number"==typeof r&&(n.width+=r),n.width=Math.max(n.width,.3/this.body.view.scale),n.color=this.options.color.hover,n.shadow=this.options.shadow.enabled}}else"function"==typeof this.chooser&&(this.chooser(n,this.options.id,this.selected,this.hover),void 0!==n.color&&(n.inheritsColor=!1),n.shadow===!1&&(n.shadowColor===this.options.shadow.color&&n.shadowSize===this.options.shadow.size&&n.shadowX===this.options.shadow.x&&n.shadowY===this.options.shadow.y||(n.shadow=!0)));else n.shadow=this.options.shadow.enabled,n.width=Math.max(n.width,.3/this.body.view.scale);return n}},{key:"updateLabelModule",value:function(t){this.labelModule.setOptions(this.options,!0),void 0!==this.labelModule.baseSize&&(this.baseFontSize=this.labelModule.baseSize),this.labelModule.constrain(this.edgeOptions,t,this.defaultOptions),this.labelModule.choosify(this.edgeOptions,t,this.defaultOptions)}},{key:"updateEdgeType",value:function(){var t=this.options.smooth,e=!1,i=!0;return void 0!==this.edgeType&&((this.edgeType instanceof b.default&&t.enabled===!0&&"dynamic"===t.type||this.edgeType instanceof g.default&&t.enabled===!0&&"cubicBezier"===t.type||this.edgeType instanceof w.default&&t.enabled===!0&&"dynamic"!==t.type&&"cubicBezier"!==t.type||this.edgeType instanceof k.default&&t.type.enabled===!1)&&(i=!1),i===!0&&(e=this.cleanup())),i===!0?t.enabled===!0?"dynamic"===t.type?(e=!0,this.edgeType=new b.default(this.options,this.body,this.labelModule)):"cubicBezier"===t.type?this.edgeType=new g.default(this.options,this.body,this.labelModule):this.edgeType=new w.default(this.options,this.body,this.labelModule):this.edgeType=new k.default(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),e}},{key:"connect",value:function(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=void 0!==this.from&&void 0!==this.to,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}},{key:"disconnect",value:function(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}},{key:"getTitle",value:function(){return this.title}},{key:"isSelected",value:function(){return this.selected}},{key:"getValue",value:function(){return this.options.value}},{key:"setValueRange",value:function(t,e,i){if(void 0!==this.options.value){var o=this.options.scaling.customScalingFunction(t,e,i,this.options.value),n=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){var s=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+o*s}this.options.width=this.options.scaling.min+o*n}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}},{key:"_setInteractionWidths",value:function(){"function"==typeof this.options.hoverWidth?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,
+"function"==typeof this.options.selectionWidth?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}},{key:"draw",value:function(t){var e=this.getFormattingValues();if(!e.hidden){var i=this.edgeType.getViaNode(),o={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,e.fromArrow&&(o.from=this.edgeType.getArrowData(t,"from",i,this.selected,this.hover,e),e.arrowStrikethrough===!1&&(this.edgeType.fromPoint=o.from.core)),e.toArrow&&(o.to=this.edgeType.getArrowData(t,"to",i,this.selected,this.hover,e),e.arrowStrikethrough===!1&&(this.edgeType.toPoint=o.to.core)),e.middleArrow&&(o.middle=this.edgeType.getArrowData(t,"middle",i,this.selected,this.hover,e)),this.edgeType.drawLine(t,e,this.selected,this.hover,i),this.drawArrows(t,o,e),this.drawLabel(t,i)}}},{key:"drawArrows",value:function(t,e,i){i.fromArrow&&this.edgeType.drawArrowHead(t,i,this.selected,this.hover,e.from),i.middleArrow&&this.edgeType.drawArrowHead(t,i,this.selected,this.hover,e.middle),i.toArrow&&this.edgeType.drawArrowHead(t,i,this.selected,this.hover,e.to)}},{key:"drawLabel",value:function(t,e){if(void 0!==this.options.label){var i=this.from,o=this.to,n=this.from.selected||this.to.selected||this.selected;if(i.id!=o.id){this.labelModule.pointToSelf=!1;var s=this.edgeType.getPoint(.5,e);t.save(),"horizontal"!==this.options.font.align&&(this.labelModule.calculateLabelSize(t,n,this.hover,s.x,s.y),t.translate(s.x,this.labelModule.size.yLine),this._rotateForLabelAlignment(t)),this.labelModule.draw(t,s.x,s.y,n,this.hover),t.restore()}else{this.labelModule.pointToSelf=!0;var r,a,h=this.options.selfReferenceSize;i.shape.width>i.shape.height?(r=i.x+.5*i.shape.width,a=i.y-h):(r=i.x+h,a=i.y-.5*i.shape.height),s=this._pointOnCircle(r,a,h,.125),this.labelModule.draw(t,s.x,s.y,n,this.hover)}}}},{key:"isOverlappingWith",value:function(t){if(this.connected){var e=10,i=this.from.x,o=this.from.y,n=this.to.x,s=this.to.y,r=t.left,a=t.top,h=this.edgeType.getDistanceToEdge(i,o,n,s,r,a);return h<e}return!1}},{key:"_rotateForLabelAlignment",value:function(t){var e=this.from.y-this.to.y,i=this.from.x-this.to.x,o=Math.atan2(e,i);(o<-1&&i<0||o>0&&i<0)&&(o+=Math.PI),t.rotate(o)}},{key:"_pointOnCircle",value:function(t,e,i,o){var n=2*o*Math.PI;return{x:t+i*Math.cos(n),y:e-i*Math.sin(n)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}}],[{key:"parseOptions",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=["arrowStrikethrough","id","from","hidden","hoverWidth","label","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","to","title","value","width"];if(O.selectiveDeepExtend(n,t,e,i),O.mergeOptions(t,e,"smooth",i,o),O.mergeOptions(t,e,"shadow",i,o),void 0!==e.dashes&&null!==e.dashes?t.dashes=e.dashes:i===!0&&null===e.dashes&&(t.dashes=(0,a.default)(o.dashes)),void 0!==e.scaling&&null!==e.scaling?(void 0!==e.scaling.min&&(t.scaling.min=e.scaling.min),void 0!==e.scaling.max&&(t.scaling.max=e.scaling.max),O.mergeOptions(t.scaling,e.scaling,"label",i,o.scaling)):i===!0&&null===e.scaling&&(t.scaling=(0,a.default)(o.scaling)),void 0!==e.arrows&&null!==e.arrows)if("string"==typeof e.arrows){var r=e.arrows.toLowerCase();t.arrows.to.enabled=r.indexOf("to")!=-1,t.arrows.middle.enabled=r.indexOf("middle")!=-1,t.arrows.from.enabled=r.indexOf("from")!=-1}else{if("object"!==(0,d.default)(e.arrows))throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+(0,s.default)(e.arrows));O.mergeOptions(t.arrows,e.arrows,"to",i,o.arrows),O.mergeOptions(t.arrows,e.arrows,"middle",i,o.arrows),O.mergeOptions(t.arrows,e.arrows,"from",i,o.arrows)}else i===!0&&null===e.arrows&&(t.arrows=(0,a.default)(o.arrows));if(void 0!==e.color&&null!==e.color)if(t.color=O.deepExtend({},t.color,!0),O.isString(e.color))t.color.color=e.color,t.color.highlight=e.color,t.color.hover=e.color,t.color.inherit=!1;else{var h=!1;void 0!==e.color.color&&(t.color.color=e.color.color,h=!0),void 0!==e.color.highlight&&(t.color.highlight=e.color.highlight,h=!0),void 0!==e.color.hover&&(t.color.hover=e.color.hover,h=!0),void 0!==e.color.inherit&&(t.color.inherit=e.color.inherit),void 0!==e.color.opacity&&(t.color.opacity=Math.min(1,Math.max(0,e.color.opacity))),void 0===e.color.inherit&&h===!0&&(t.color.inherit=!1)}else i===!0&&null===e.color&&(t.color=O.bridgeObject(o.color));void 0!==e.font&&null!==e.font?m.default.parseOptions(t.font,e):i===!0&&null===e.font&&(t.font=O.bridgeObject(o.font))}}]),t}();e.default=D},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(161),s=o(n),r=i(166),a=o(r),h=i(115),d=o(h),l=i(116),u=o(l),c=i(169),p=o(c),f=i(170),m=o(f),v=i(194),g=o(v),y=function(t){function e(t,i,o){return(0,d.default)(this,e),(0,p.default)(this,(e.__proto__||(0,a.default)(e)).call(this,t,i,o))}return(0,m.default)(e,t),(0,u.default)(e,[{key:"_line",value:function(t,e,i){var o=i[0],n=i[1];t.beginPath(),t.moveTo(this.fromPoint.x,this.fromPoint.y),void 0===i||void 0===o.x?t.lineTo(this.toPoint.x,this.toPoint.y):t.bezierCurveTo(o.x,o.y,n.x,n.y,this.toPoint.x,this.toPoint.y),this.enableShadow(t,e),t.stroke(),this.disableShadow(t,e)}},{key:"_getViaCoordinates",value:function(){var t=this.from.x-this.to.x,e=this.from.y-this.to.y,i=void 0,o=void 0,n=void 0,s=void 0,r=this.options.smooth.roundness;return(Math.abs(t)>Math.abs(e)||this.options.smooth.forceDirection===!0||"horizontal"===this.options.smooth.forceDirection)&&"vertical"!==this.options.smooth.forceDirection?(o=this.from.y,s=this.to.y,i=this.from.x-r*t,n=this.to.x+r*t):(o=this.from.y-r*e,s=this.to.y+r*e,i=this.from.x,n=this.to.x),[{x:i,y:o},{x:n,y:s}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(t,e){return this._findBorderPositionBezier(t,e)}},{key:"_getDistanceToEdge",value:function(t,e,i,o,n,r){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates(),h=(0,s.default)(a,2),d=h[0],l=h[1];return this._getDistanceToBezierEdge(t,e,i,o,n,r,d,l)}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),i=(0,s.default)(e,2),o=i[0],n=i[1],r=t,a=[];a[0]=Math.pow(1-r,3),a[1]=3*r*Math.pow(1-r,2),a[2]=3*Math.pow(r,2)*(1-r),a[3]=Math.pow(r,3);var h=a[0]*this.fromPoint.x+a[1]*o.x+a[2]*n.x+a[3]*this.toPoint.x,d=a[0]*this.fromPoint.y+a[1]*o.y+a[2]*n.y+a[3]*this.toPoint.y;return{x:h,y:d}}}]),e}(g.default);e.default=y},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(195),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"_getDistanceToBezierEdge",value:function(t,e,i,o,n,s,r,a){var h=1e9,d=void 0,l=void 0,u=void 0,c=void 0,p=void 0,f=t,m=e,v=[0,0,0,0];for(l=1;l<10;l++)u=.1*l,v[0]=Math.pow(1-u,3),v[1]=3*u*Math.pow(1-u,2),v[2]=3*Math.pow(u,2)*(1-u),v[3]=Math.pow(u,3),c=v[0]*t+v[1]*r.x+v[2]*a.x+v[3]*i,p=v[0]*e+v[1]*r.y+v[2]*a.y+v[3]*o,l>0&&(d=this._getDistanceToLine(f,m,c,p,n,s),h=d<h?d:h),f=c,m=p;return h}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(196),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"_findBorderPositionBezier",value:function(t,e){var i,o,n,s,r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._getViaCoordinates(),h=10,d=0,l=0,u=1,c=.2,p=this.to,f=!1;for(t.id===this.from.id&&(p=this.from,f=!0);l<=u&&d<h;){var m=.5*(l+u);if(i=this.getPoint(m,a),o=Math.atan2(p.y-i.y,p.x-i.x),n=p.distanceToBorder(e,o),s=Math.sqrt(Math.pow(i.x-p.x,2)+Math.pow(i.y-p.y,2)),r=n-s,Math.abs(r)<c)break;r<0?f===!1?l=m:u=m:f===!1?u=m:l=m,d++}return i.t=m,i}},{key:"_getDistanceToBezierEdge",value:function(t,e,i,o,n,s,r){var a=1e9,h=void 0,d=void 0,l=void 0,u=void 0,c=void 0,p=t,f=e;for(d=1;d<10;d++)l=.1*d,u=Math.pow(1-l,2)*t+2*l*(1-l)*r.x+Math.pow(l,2)*i,c=Math.pow(1-l,2)*e+2*l*(1-l)*r.y+Math.pow(l,2)*o,d>0&&(h=this._getDistanceToLine(p,f,u,c,n,s),a=h<a?h:a),p=u,f=c;return a}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(161),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(1),u=function(){function t(e,i,o){(0,a.default)(this,t),this.body=i,this.labelModule=o,this.options={},this.setOptions(e),this.colorDirty=!0,this.color={},this.selectionWidth=2,this.hoverWidth=1.5,this.fromPoint=this.from,this.toPoint=this.to}return(0,d.default)(t,[{key:"connect",value:function(){this.from=this.body.nodes[this.options.from],this.to=this.body.nodes[this.options.to]}},{key:"cleanup",value:function(){return!1}},{key:"setOptions",value:function(t){this.options=t,this.from=this.body.nodes[this.options.from],this.to=this.body.nodes[this.options.to],this.id=this.options.id}},{key:"drawLine",value:function(t,e,i,o,n){t.strokeStyle=this.getColor(t,e,i,o),t.lineWidth=e.width,e.dashes!==!1?this._drawDashedLine(t,e,n):this._drawLine(t,e,n)}},{key:"_drawLine",value:function(t,e,i,o,n){if(this.from!=this.to)this._line(t,e,i,o,n);else{var r=this._getCircleData(t,e),a=(0,s.default)(r,3),h=a[0],d=a[1],l=a[2];this._circle(t,e,h,d,l)}}},{key:"_drawDashedLine",value:function(t,e,i,o,n){t.lineCap="round";var r=[5,5];if(Array.isArray(e.dashes)===!0&&(r=e.dashes),void 0!==t.setLineDash){if(t.save(),t.setLineDash(r),t.lineDashOffset=0,this.from!=this.to)this._line(t,e,i);else{var a=this._getCircleData(t,e),h=(0,s.default)(a,3),d=h[0],l=h[1],u=h[2];this._circle(t,e,d,l,u)}t.setLineDash([0]),t.lineDashOffset=0,t.restore()}else{if(this.from!=this.to)t.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y,r);else{var c=this._getCircleData(t,e),p=(0,s.default)(c,3),f=p[0],m=p[1],v=p[2];this._circle(t,e,f,m,v)}this.enableShadow(t,e),t.stroke(),this.disableShadow(t,e)}}},{key:"findBorderPosition",value:function(t,e,i){return this.from!=this.to?this._findBorderPosition(t,e,i):this._findBorderPositionCircle(t,e,i)}},{key:"findBorderPositions",value:function(t){var e={},i={};if(this.from!=this.to)e=this._findBorderPosition(this.from,t),i=this._findBorderPosition(this.to,t);else{var o=this._getCircleData(t),n=(0,s.default)(o,3),r=n[0],a=n[1];n[2];e=this._findBorderPositionCircle(this.from,t,{x:r,y:a,low:.25,high:.6,direction:-1}),i=this._findBorderPositionCircle(this.from,t,{x:r,y:a,low:.6,high:.8,direction:1})}return{from:e,to:i}}},{key:"_getCircleData",value:function(t){var e=void 0,i=void 0,o=this.from,n=this.options.selfReferenceSize;return void 0!==t&&void 0===o.shape.width&&o.shape.resize(t),o.shape.width>o.shape.height?(e=o.x+.5*o.shape.width,i=o.y-n):(e=o.x+n,i=o.y-.5*o.shape.height),[e,i,n]}},{key:"_pointOnCircle",value:function(t,e,i,o){var n=2*o*Math.PI;return{x:t+i*Math.cos(n),y:e-i*Math.sin(n)}}},{key:"_findBorderPositionCircle",value:function(t,e,i){for(var o=i.x,n=i.y,s=i.low,r=i.high,a=i.direction,h=10,d=0,l=this.options.selfReferenceSize,u=void 0,c=void 0,p=void 0,f=void 0,m=void 0,v=.05,g=.5*(s+r);s<=r&&d<h&&(g=.5*(s+r),u=this._pointOnCircle(o,n,l,g),c=Math.atan2(t.y-u.y,t.x-u.x),p=t.distanceToBorder(e,c),f=Math.sqrt(Math.pow(u.x-t.x,2)+Math.pow(u.y-t.y,2)),m=p-f,!(Math.abs(m)<v));)m>0?a>0?s=g:r=g:a>0?r=g:s=g,d++;return u.t=g,u}},{key:"getLineWidth",value:function(t,e){return t===!0?Math.max(this.selectionWidth,.3/this.body.view.scale):e===!0?Math.max(this.hoverWidth,.3/this.body.view.scale):Math.max(this.options.width,.3/this.body.view.scale)}},{key:"getColor",value:function(t,e,i,o){if(e.inheritsColor!==!1){if("both"===e.inheritsColor&&this.from.id!==this.to.id){var n=t.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y),s=void 0,r=void 0;return s=this.from.options.color.highlight.border,r=this.to.options.color.highlight.border,this.from.selected===!1&&this.to.selected===!1?(s=l.overrideOpacity(this.from.options.color.border,e.opacity),r=l.overrideOpacity(this.to.options.color.border,e.opacity)):this.from.selected===!0&&this.to.selected===!1?r=this.to.options.color.border:this.from.selected===!1&&this.to.selected===!0&&(s=this.from.options.color.border),n.addColorStop(0,s),n.addColorStop(1,r),n}return"to"===e.inheritsColor?l.overrideOpacity(this.to.options.color.border,e.opacity):l.overrideOpacity(this.from.options.color.border,e.opacity)}return l.overrideOpacity(e.color,e.opacity)}},{key:"_circle",value:function(t,e,i,o,n){this.enableShadow(t,e),t.beginPath(),t.arc(i,o,n,0,2*Math.PI,!1),t.stroke(),this.disableShadow(t,e)}},{key:"getDistanceToEdge",value:function(t,e,i,o,n,r,a,h){var d=0;if(this.from!=this.to)d=this._getDistanceToEdge(t,e,i,o,n,r,a);else{var l=this._getCircleData(void 0,h),u=(0,s.default)(l,3),c=u[0],p=u[1],f=u[2],m=c-n,v=p-r;d=Math.abs(Math.sqrt(m*m+v*v)-f)}return this.labelModule.size.left<n&&this.labelModule.size.left+this.labelModule.size.width>n&&this.labelModule.size.top<r&&this.labelModule.size.top+this.labelModule.size.height>r?0:d}},{key:"_getDistanceToLine",value:function(t,e,i,o,n,s){var r=i-t,a=o-e,h=r*r+a*a,d=((n-t)*r+(s-e)*a)/h;d>1?d=1:d<0&&(d=0);var l=t+d*r,u=e+d*a,c=l-n,p=u-s;return Math.sqrt(c*c+p*p)}},{key:"getArrowData",value:function(t,e,i,o,n,r){var a=void 0,h=void 0,d=void 0,l=void 0,u=void 0,c=void 0,p=void 0,f=r.width;if("from"===e?(d=this.from,l=this.to,u=.1,c=r.fromArrowScale,p=r.fromArrowType):"to"===e?(d=this.to,l=this.from,u=-.1,c=r.toArrowScale,p=r.toArrowType):(d=this.to,l=this.from,c=r.middleArrowScale,p=r.middleArrowType),d!=l)if("middle"!==e)if(this.options.smooth.enabled===!0){h=this.findBorderPosition(d,t,{via:i});var m=this.getPoint(Math.max(0,Math.min(1,h.t+u)),i);a=Math.atan2(h.y-m.y,h.x-m.x)}else a=Math.atan2(d.y-l.y,d.x-l.x),h=this.findBorderPosition(d,t);else a=Math.atan2(d.y-l.y,d.x-l.x),h=this.getPoint(.5,i);else{var v=this._getCircleData(t),g=(0,s.default)(v,3),y=g[0],b=g[1],_=g[2];"from"===e?(h=this.findBorderPosition(this.from,t,{x:y,y:b,low:.25,high:.6,direction:-1}),a=h.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI):"to"===e?(h=this.findBorderPosition(this.from,t,{x:y,y:b,low:.6,high:1,direction:1}),a=h.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI):(h=this._pointOnCircle(y,b,_,.175),a=3.9269908169872414)}var w=15*c+3*f,x=h.x-.9*w*Math.cos(a),k=h.y-.9*w*Math.sin(a),O={x:x,y:k};return{point:h,core:O,angle:a,length:w,type:p}}},{key:"drawArrowHead",value:function(t,e,i,o,n){t.strokeStyle=this.getColor(t,e,i,o),t.fillStyle=t.strokeStyle,t.lineWidth=e.width,n.type&&"circle"===n.type.toLowerCase()?t.circleEndpoint(n.point.x,n.point.y,n.angle,n.length):t.arrowEndpoint(n.point.x,n.point.y,n.angle,n.length),this.enableShadow(t,e),t.fill(),this.disableShadow(t,e)}},{key:"enableShadow",value:function(t,e){e.shadow===!0&&(t.shadowColor=e.shadowColor,t.shadowBlur=e.shadowSize,t.shadowOffsetX=e.shadowX,t.shadowOffsetY=e.shadowY)}},{key:"disableShadow",value:function(t,e){e.shadow===!0&&(t.shadowColor="rgba(0,0,0,0)",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0)}}]),t}();e.default=u},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(161),s=o(n),r=i(166),a=o(r),h=i(115),d=o(h),l=i(116),u=o(l),c=i(169),p=o(c),f=i(170),m=o(f),v=i(195),g=o(v),y=function(t){function e(t,i,o){(0,d.default)(this,e);var n=(0,p.default)(this,(e.__proto__||(0,a.default)(e)).call(this,t,i,o));return n._boundFunction=function(){n.positionBezierNode()},n.body.emitter.on("_repositionBezierNodes",n._boundFunction),n}return(0,m.default)(e,t),(0,u.default)(e,[{key:"setOptions",value:function(t){var e=!1;this.options.physics!==t.physics&&(e=!0),this.options=t,this.id=this.options.id,this.from=this.body.nodes[this.options.from],this.to=this.body.nodes[this.options.to],this.setupSupportNode(),this.connect(),e===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this.body.nodes[this.options.from],this.to=this.body.nodes[this.options.to],void 0===this.from||void 0===this.to||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this.body.emitter.off("_repositionBezierNodes",this._boundFunction),void 0!==this.via&&(delete this.body.nodes[this.via.id],this.via=void 0,!0)}},{key:"setupSupportNode",value:function(){if(void 0===this.via){var t="edgeId:"+this.id,e=this.body.functions.createNode({id:t,shape:"circle",physics:!0,hidden:!0});this.body.nodes[t]=e,this.via=e,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){void 0!==this.via&&void 0!==this.from&&void 0!==this.to?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):void 0!==this.via&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(t,e,i){t.beginPath(),t.moveTo(this.fromPoint.x,this.fromPoint.y),void 0===i.x?t.lineTo(this.toPoint.x,this.toPoint.y):t.quadraticCurveTo(i.x,i.y,this.toPoint.x,this.toPoint.y),this.enableShadow(t,e),t.stroke(),this.disableShadow(t,e)}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.via,i=t,o=void 0,n=void 0;if(this.from===this.to){var r=this._getCircleData(this.from),a=(0,s.default)(r,3),h=a[0],d=a[1],l=a[2],u=2*Math.PI*(1-i);o=h+l*Math.sin(u),n=d+l-l*(1-Math.cos(u))}else o=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*e.x+Math.pow(i,2)*this.toPoint.x,n=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*e.y+Math.pow(i,2)*this.toPoint.y;return{x:o,y:n}}},{key:"_findBorderPosition",value:function(t,e){return this._findBorderPositionBezier(t,e,this.via)}},{key:"_getDistanceToEdge",value:function(t,e,i,o,n,s){return this._getDistanceToBezierEdge(t,e,i,o,n,s,this.via)}}]),e}(g.default);e.default=y},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(195),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"_line",value:function(t,e,i){t.beginPath(),t.moveTo(this.fromPoint.x,this.fromPoint.y),void 0===i.x?t.lineTo(this.toPoint.x,this.toPoint.y):t.quadraticCurveTo(i.x,i.y,this.toPoint.x,this.toPoint.y),this.enableShadow(t,e),t.stroke(),this.disableShadow(t,e)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var t=void 0,e=void 0,i=this.options.smooth.roundness,o=this.options.smooth.type,n=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if("discrete"===o||"diagonalCross"===o)Math.abs(this.from.x-this.to.x)<=Math.abs(this.from.y-this.to.y)?(this.from.y>=this.to.y?this.from.x<=this.to.x?(t=this.from.x+i*s,e=this.from.y-i*s):this.from.x>this.to.x&&(t=this.from.x-i*s,e=this.from.y-i*s):this.from.y<this.to.y&&(this.from.x<=this.to.x?(t=this.from.x+i*s,e=this.from.y+i*s):this.from.x>this.to.x&&(t=this.from.x-i*s,e=this.from.y+i*s)),"discrete"===o&&(t=n<i*s?this.from.x:t)):Math.abs(this.from.x-this.to.x)>Math.abs(this.from.y-this.to.y)&&(this.from.y>=this.to.y?this.from.x<=this.to.x?(t=this.from.x+i*n,e=this.from.y-i*n):this.from.x>this.to.x&&(t=this.from.x-i*n,e=this.from.y-i*n):this.from.y<this.to.y&&(this.from.x<=this.to.x?(t=this.from.x+i*n,e=this.from.y+i*n):this.from.x>this.to.x&&(t=this.from.x-i*n,e=this.from.y+i*n)),"discrete"===o&&(e=s<i*n?this.from.y:e));else if("straightCross"===o)Math.abs(this.from.x-this.to.x)<=Math.abs(this.from.y-this.to.y)?(t=this.from.x,e=this.from.y<this.to.y?this.to.y-(1-i)*s:this.to.y+(1-i)*s):Math.abs(this.from.x-this.to.x)>Math.abs(this.from.y-this.to.y)&&(t=this.from.x<this.to.x?this.to.x-(1-i)*n:this.to.x+(1-i)*n,e=this.from.y);else if("horizontal"===o)t=this.from.x<this.to.x?this.to.x-(1-i)*n:this.to.x+(1-i)*n,e=this.from.y;else if("vertical"===o)t=this.from.x,e=this.from.y<this.to.y?this.to.y-(1-i)*s:this.to.y+(1-i)*s;else if("curvedCW"===o){n=this.to.x-this.from.x,s=this.from.y-this.to.y;var r=Math.sqrt(n*n+s*s),a=Math.PI,h=Math.atan2(s,n),d=(h+(.5*i+.5)*a)%(2*a);t=this.from.x+(.5*i+.5)*r*Math.sin(d),e=this.from.y+(.5*i+.5)*r*Math.cos(d)}else if("curvedCCW"===o){n=this.to.x-this.from.x,s=this.from.y-this.to.y;var l=Math.sqrt(n*n+s*s),u=Math.PI,c=Math.atan2(s,n),p=(c+(.5*-i+.5)*u)%(2*u);t=this.from.x+(.5*i+.5)*l*Math.sin(p),e=this.from.y+(.5*i+.5)*l*Math.cos(p)}else Math.abs(this.from.x-this.to.x)<=Math.abs(this.from.y-this.to.y)?this.from.y>=this.to.y?this.from.x<=this.to.x?(t=this.from.x+i*s,e=this.from.y-i*s,t=this.to.x<t?this.to.x:t):this.from.x>this.to.x&&(t=this.from.x-i*s,e=this.from.y-i*s,t=this.to.x>t?this.to.x:t):this.from.y<this.to.y&&(this.from.x<=this.to.x?(t=this.from.x+i*s,e=this.from.y+i*s,t=this.to.x<t?this.to.x:t):this.from.x>this.to.x&&(t=this.from.x-i*s,e=this.from.y+i*s,t=this.to.x>t?this.to.x:t)):Math.abs(this.from.x-this.to.x)>Math.abs(this.from.y-this.to.y)&&(this.from.y>=this.to.y?this.from.x<=this.to.x?(t=this.from.x+i*n,e=this.from.y-i*n,e=this.to.y>e?this.to.y:e):this.from.x>this.to.x&&(t=this.from.x-i*n,e=this.from.y-i*n,e=this.to.y>e?this.to.y:e):this.from.y<this.to.y&&(this.from.x<=this.to.x?(t=this.from.x+i*n,e=this.from.y+i*n,e=this.to.y<e?this.to.y:e):this.from.x>this.to.x&&(t=this.from.x-i*n,e=this.from.y+i*n,e=this.to.y<e?this.to.y:e)));return{x:t,y:e}}},{key:"_findBorderPosition",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._findBorderPositionBezier(t,e,i.via)}},{key:"_getDistanceToEdge",value:function(t,e,i,o,n,s){var r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(t,e,i,o,n,s,r)}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),i=t,o=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*e.x+Math.pow(i,2)*this.toPoint.x,n=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*e.y+Math.pow(i,2)*this.toPoint.y;return{x:o,y:n}}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(196),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"_line",value:function(t,e){t.beginPath(),t.moveTo(this.fromPoint.x,this.fromPoint.y),t.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(t,e),t.stroke(),this.disableShadow(t,e)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(t){return{x:(1-t)*this.fromPoint.x+t*this.toPoint.x,y:(1-t)*this.fromPoint.y+t*this.toPoint.y}}},{key:"_findBorderPosition",value:function(t,e){var i=this.to,o=this.from;t.id===this.from.id&&(i=this.from,o=this.to);var n=Math.atan2(i.y-o.y,i.x-o.x),s=i.x-o.x,r=i.y-o.y,a=Math.sqrt(s*s+r*r),h=t.distanceToBorder(e,n),d=(a-h)/a,l={};return l.x=(1-d)*o.x+d*i.x,l.y=(1-d)*o.y+d*i.y,l}},{key:"_getDistanceToEdge",value:function(t,e,i,o,n,s){return this._getDistanceToLine(t,e,i,o,n,s)}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(58),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(201),u=o(l),c=i(202),p=o(c),f=i(203),m=o(f),v=i(204),g=o(v),y=i(205),b=o(y),_=i(206),w=o(_),x=i(207),k=o(x),O=i(208),D=o(O),S=i(1),M=function(){function t(e){(0,a.default)(this,t),this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0},S.extend(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return(0,d.default)(t,[{key:"bindEventListeners",value:function(){var t=this;this.body.emitter.on("initPhysics",function(){t.initPhysics()}),this.body.emitter.on("_layoutFailed",function(){t.layoutFailed=!0}),this.body.emitter.on("resetPhysics",function(){t.stopSimulation(),t.ready=!1}),this.body.emitter.on("disablePhysics",function(){t.physicsEnabled=!1,t.stopSimulation()}),this.body.emitter.on("restorePhysics",function(){t.setOptions(t.options),t.ready===!0&&t.startSimulation()}),this.body.emitter.on("startSimulation",function(){t.ready===!0&&t.startSimulation()}),this.body.emitter.on("stopSimulation",function(){t.stopSimulation()}),this.body.emitter.on("destroy",function(){t.stopSimulation(!1),t.body.emitter.off()}),this.body.emitter.on("_dataChanged",function(){t.updatePhysicsData()})}},{key:"setOptions",value:function(t){void 0!==t&&(t===!1?(this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation()):(this.physicsEnabled=!0,S.selectiveNotDeepExtend(["stabilization"],this.options,t),S.mergeOptions(this.options,t,"stabilization"),void 0===t.enabled&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation()),this.timestep=this.options.timestep)),this.init()}},{key:"init",value:function(){var t;"forceAtlas2Based"===this.options.solver?(t=this.options.forceAtlas2Based,this.nodesSolver=new k.default(this.body,this.physicsBody,t),this.edgesSolver=new g.default(this.body,this.physicsBody,t),this.gravitySolver=new D.default(this.body,this.physicsBody,t)):"repulsion"===this.options.solver?(t=this.options.repulsion,this.nodesSolver=new p.default(this.body,this.physicsBody,t),this.edgesSolver=new g.default(this.body,this.physicsBody,t),this.gravitySolver=new w.default(this.body,this.physicsBody,t)):"hierarchicalRepulsion"===this.options.solver?(t=this.options.hierarchicalRepulsion,this.nodesSolver=new m.default(this.body,this.physicsBody,t),this.edgesSolver=new b.default(this.body,this.physicsBody,t),this.gravitySolver=new w.default(this.body,this.physicsBody,t)):(t=this.options.barnesHut,this.nodesSolver=new u.default(this.body,this.physicsBody,t),this.edgesSolver=new g.default(this.body,this.physicsBody,t),this.gravitySolver=new w.default(this.body,this.physicsBody,t)),this.modelOptions=t}},{key:"initPhysics",value:function(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){this.physicsEnabled===!0&&this.options.enabled===!0?(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),void 0===this.viewFunction&&(this.viewFunction=this.simulationStep.bind(this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))):this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.stabilized=!0,t===!0&&this._emitStabilized(),void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,t===!0&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var t=Date.now();this.physicsTick();var e=Date.now()-t;(e<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&setTimeout(function(){t.body.emitter.emit("stabilized",{iterations:e}),t.startedStabilization=!1,t.stabilizationIterations=0},0)}},{key:"physicsTick",value:function(){if(this.startedStabilization===!1&&(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0),this.stabilized===!1){if(this.adaptiveTimestep===!0&&this.adaptiveTimestepEnabled===!0){var t=1.2;this.adaptiveCounter%this.adaptiveInterval===0?(this.timestep=2*this.timestep,this.calculateForces(),this.moveNodes(),this.revert(),this.timestep=.5*this.timestep,this.calculateForces(),this.moveNodes(),this.calculateForces(),this.moveNodes(),this._evaluateStepQuality()===!0?this.timestep=t*this.timestep:this.timestep/t<this.options.timestep?this.timestep=this.options.timestep:(this.adaptiveCounter=-1,this.timestep=Math.max(this.options.timestep,this.timestep/t))):(this.calculateForces(),this.moveNodes()),this.adaptiveCounter+=1}else this.timestep=this.options.timestep,this.calculateForces(),this.moveNodes();this.stabilized===!0&&this.revert(),this.stabilizationIterations++}}},{key:"updatePhysicsData",value:function(){this.physicsBody.forces={},this.physicsBody.physicsNodeIndices=[],this.physicsBody.physicsEdgeIndices=[];var t=this.body.nodes,e=this.body.edges;for(var i in t)t.hasOwnProperty(i)&&t[i].options.physics===!0&&this.physicsBody.physicsNodeIndices.push(t[i].id);for(var o in e)e.hasOwnProperty(o)&&e[o].options.physics===!0&&this.physicsBody.physicsEdgeIndices.push(e[o].id);for(var n=0;n<this.physicsBody.physicsNodeIndices.length;n++){var s=this.physicsBody.physicsNodeIndices[n];this.physicsBody.forces[s]={x:0,y:0},void 0===this.physicsBody.velocities[s]&&(this.physicsBody.velocities[s]={x:0,y:0})}for(var r in this.physicsBody.velocities)void 0===t[r]&&delete this.physicsBody.velocities[r]}},{key:"revert",value:function(){var t=(0,s.default)(this.previousStates),e=this.body.nodes,i=this.physicsBody.velocities;this.referenceState={};for(var o=0;o<t.length;o++){var n=t[o];void 0!==e[n]?e[n].options.physics===!0&&(this.referenceState[n]={positions:{x:e[n].x,y:e[n].y}},i[n].x=this.previousStates[n].vx,i[n].y=this.previousStates[n].vy,e[n].x=this.previousStates[n].x,e[n].y=this.previousStates[n].y):delete this.previousStates[n]}}},{key:"_evaluateStepQuality",value:function(){var t=void 0,e=void 0,i=void 0,o=this.body.nodes,n=this.referenceState,s=.3;for(var r in this.referenceState)if(this.referenceState.hasOwnProperty(r)&&void 0!==o[r]&&(t=o[r].x-n[r].positions.x,e=o[r].y-n[r].positions.y,i=Math.sqrt(Math.pow(t,2)+Math.pow(e,2)),i>s))return!1;return!0}},{key:"moveNodes",
+value:function(){for(var t=this.physicsBody.physicsNodeIndices,e=this.options.maxVelocity?this.options.maxVelocity:1e9,i=0,o=0,n=5,s=0;s<t.length;s++){var r=t[s],a=this._performStep(r,e);i=Math.max(i,a),o+=a}this.adaptiveTimestepEnabled=o/t.length<n,this.stabilized=i<this.options.minVelocity}},{key:"_performStep",value:function(t,e){var i=this.body.nodes[t],o=this.timestep,n=this.physicsBody.forces,s=this.physicsBody.velocities;if(this.previousStates[t]={x:i.x,y:i.y,vx:s[t].x,vy:s[t].y},i.options.fixed.x===!1){var r=this.modelOptions.damping*s[t].x,a=(n[t].x-r)/i.options.mass;s[t].x+=a*o,s[t].x=Math.abs(s[t].x)>e?s[t].x>0?e:-e:s[t].x,i.x+=s[t].x*o}else n[t].x=0,s[t].x=0;if(i.options.fixed.y===!1){var h=this.modelOptions.damping*s[t].y,d=(n[t].y-h)/i.options.mass;s[t].y+=d*o,s[t].y=Math.abs(s[t].y)>e?s[t].y>0?e:-e:s[t].y,i.y+=s[t].y*o}else n[t].y=0,s[t].y=0;var l=Math.sqrt(Math.pow(s[t].x,2)+Math.pow(s[t].y,2));return l}},{key:"calculateForces",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve()}},{key:"_freezeNodes",value:function(){var t=this.body.nodes;for(var e in t)t.hasOwnProperty(e)&&t[e].x&&t[e].y&&(this.freezeCache[e]={x:t[e].options.fixed.x,y:t[e].options.fixed.y},t[e].options.fixed.x=!0,t[e].options.fixed.y=!0)}},{key:"_restoreFrozenNodes",value:function(){var t=this.body.nodes;for(var e in t)t.hasOwnProperty(e)&&void 0!==this.freezeCache[e]&&(t[e].options.fixed.x=this.freezeCache[e].x,t[e].options.fixed.y=this.freezeCache[e].y);this.freezeCache={}}},{key:"stabilize",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.stabilization.iterations;return"number"!=typeof e&&(console.log("The stabilize method needs a numeric amount of iterations. Switching to default: ",this.options.stabilization.iterations),e=this.options.stabilization.iterations),0===this.physicsBody.physicsNodeIndices.length?void(this.ready=!0):(this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=e,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,void setTimeout(function(){return t._stabilizationBatch()},0))}},{key:"_stabilizationBatch",value:function(){this.startedStabilization===!1&&(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0);for(var t=0;this.stabilized===!1&&t<this.options.stabilization.updateInterval&&this.stabilizationIterations<this.targetIterations;)this.physicsTick(),t++;this.stabilized===!1&&this.stabilizationIterations<this.targetIterations?(this.body.emitter.emit("stabilizationProgress",{iterations:this.stabilizationIterations,total:this.targetIterations}),setTimeout(this._stabilizationBatch.bind(this),0)):this._finalizeStabilization()}},{key:"_finalizeStabilization",value:function(){this.body.emitter.emit("_allowRedraw"),this.options.stabilization.fit===!0&&this.body.emitter.emit("fit"),this.options.stabilization.onlyDynamicEdges===!0&&this._restoreFrozenNodes(),this.body.emitter.emit("stabilizationIterationsDone"),this.body.emitter.emit("_requestRedraw"),this.stabilized===!0?this._emitStabilized():this.startSimulation(),this.ready=!0}},{key:"_drawForces",value:function(t){for(var e=0;e<this.physicsBody.physicsNodeIndices.length;e++){var i=this.body.nodes[this.physicsBody.physicsNodeIndices[e]],o=this.physicsBody.forces[this.physicsBody.physicsNodeIndices[e]],n=20,s=.03,r=Math.sqrt(Math.pow(o.x,2)+Math.pow(o.x,2)),a=Math.min(Math.max(5,r),15),h=3*a,d=S.HSVToHex((180-180*Math.min(1,Math.max(0,s*r)))/360,1,1);t.lineWidth=a,t.strokeStyle=d,t.beginPath(),t.moveTo(i.x,i.y),t.lineTo(i.x+n*o.x,i.y+n*o.y),t.stroke();var l=Math.atan2(o.y,o.x);t.fillStyle=d,t.arrowEndpoint(i.x+n*o.x+Math.cos(l)*h,i.y+n*o.y+Math.sin(l)*h,l,h),t.fill()}}}]),t}();e.default=M},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(e,i,o){(0,s.default)(this,t),this.body=e,this.physicsBody=i,this.barnesHutTree,this.setOptions(o),this.randomSeed=5}return(0,a.default)(t,[{key:"setOptions",value:function(t){this.options=t,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}},{key:"seededRandom",value:function(){var t=1e4*Math.sin(this.randomSeed++);return t-Math.floor(t)}},{key:"solve",value:function(){if(0!==this.options.gravitationalConstant&&this.physicsBody.physicsNodeIndices.length>0){var t=void 0,e=this.body.nodes,i=this.physicsBody.physicsNodeIndices,o=i.length,n=this._formBarnesHutTree(e,i);this.barnesHutTree=n;for(var s=0;s<o;s++)t=e[i[s]],t.options.mass>0&&(this._getForceContribution(n.root.children.NW,t),this._getForceContribution(n.root.children.NE,t),this._getForceContribution(n.root.children.SW,t),this._getForceContribution(n.root.children.SE,t))}}},{key:"_getForceContribution",value:function(t,e){if(t.childrenCount>0){var i=void 0,o=void 0,n=void 0;i=t.centerOfMass.x-e.x,o=t.centerOfMass.y-e.y,n=Math.sqrt(i*i+o*o),n*t.calcSize>this.thetaInversed?this._calculateForces(n,i,o,e,t):4===t.childrenCount?(this._getForceContribution(t.children.NW,e),this._getForceContribution(t.children.NE,e),this._getForceContribution(t.children.SW,e),this._getForceContribution(t.children.SE,e)):t.children.data.id!=e.id&&this._calculateForces(n,i,o,e,t)}}},{key:"_calculateForces",value:function(t,e,i,o,n){0===t&&(t=.1,e=t),this.overlapAvoidanceFactor<1&&o.shape.radius&&(t=Math.max(.1+this.overlapAvoidanceFactor*o.shape.radius,t-o.shape.radius));var s=this.options.gravitationalConstant*n.mass*o.options.mass/Math.pow(t,3),r=e*s,a=i*s;this.physicsBody.forces[o.id].x+=r,this.physicsBody.forces[o.id].y+=a}},{key:"_formBarnesHutTree",value:function(t,e){for(var i=void 0,o=e.length,n=t[e[0]].x,s=t[e[0]].y,r=t[e[0]].x,a=t[e[0]].y,h=1;h<o;h++){var d=t[e[h]].x,l=t[e[h]].y;t[e[h]].options.mass>0&&(d<n&&(n=d),d>r&&(r=d),l<s&&(s=l),l>a&&(a=l))}var u=Math.abs(r-n)-Math.abs(a-s);u>0?(s-=.5*u,a+=.5*u):(n+=.5*u,r-=.5*u);var c=1e-5,p=Math.max(c,Math.abs(r-n)),f=.5*p,m=.5*(n+r),v=.5*(s+a),g={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:m-f,maxX:m+f,minY:v-f,maxY:v+f},size:p,calcSize:1/p,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(g.root);for(var y=0;y<o;y++)i=t[e[y]],i.options.mass>0&&this._placeInTree(g.root,i);return g}},{key:"_updateBranchMass",value:function(t,e){var i=t.mass+e.options.mass,o=1/i;t.centerOfMass.x=t.centerOfMass.x*t.mass+e.x*e.options.mass,t.centerOfMass.x*=o,t.centerOfMass.y=t.centerOfMass.y*t.mass+e.y*e.options.mass,t.centerOfMass.y*=o,t.mass=i;var n=Math.max(Math.max(e.height,e.radius),e.width);t.maxWidth=t.maxWidth<n?n:t.maxWidth}},{key:"_placeInTree",value:function(t,e,i){1==i&&void 0!==i||this._updateBranchMass(t,e),t.children.NW.range.maxX>e.x?t.children.NW.range.maxY>e.y?this._placeInRegion(t,e,"NW"):this._placeInRegion(t,e,"SW"):t.children.NW.range.maxY>e.y?this._placeInRegion(t,e,"NE"):this._placeInRegion(t,e,"SE")}},{key:"_placeInRegion",value:function(t,e,i){switch(t.children[i].childrenCount){case 0:t.children[i].children.data=e,t.children[i].childrenCount=1,this._updateBranchMass(t.children[i],e);break;case 1:t.children[i].children.data.x===e.x&&t.children[i].children.data.y===e.y?(e.x+=this.seededRandom(),e.y+=this.seededRandom()):(this._splitBranch(t.children[i]),this._placeInTree(t.children[i],e));break;case 4:this._placeInTree(t.children[i],e)}}},{key:"_splitBranch",value:function(t){var e=null;1===t.childrenCount&&(e=t.children.data,t.mass=0,t.centerOfMass.x=0,t.centerOfMass.y=0),t.childrenCount=4,t.children.data=null,this._insertRegion(t,"NW"),this._insertRegion(t,"NE"),this._insertRegion(t,"SW"),this._insertRegion(t,"SE"),null!=e&&this._placeInTree(t,e)}},{key:"_insertRegion",value:function(t,e){var i=void 0,o=void 0,n=void 0,s=void 0,r=.5*t.size;switch(e){case"NW":i=t.range.minX,o=t.range.minX+r,n=t.range.minY,s=t.range.minY+r;break;case"NE":i=t.range.minX+r,o=t.range.maxX,n=t.range.minY,s=t.range.minY+r;break;case"SW":i=t.range.minX,o=t.range.minX+r,n=t.range.minY+r,s=t.range.maxY;break;case"SE":i=t.range.minX+r,o=t.range.maxX,n=t.range.minY+r,s=t.range.maxY}t.children[e]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:o,minY:n,maxY:s},size:.5*t.size,calcSize:2*t.calcSize,children:{data:null},maxWidth:0,level:t.level+1,childrenCount:0}}},{key:"_debug",value:function(t,e){void 0!==this.barnesHutTree&&(t.lineWidth=1,this._drawBranch(this.barnesHutTree.root,t,e))}},{key:"_drawBranch",value:function(t,e,i){void 0===i&&(i="#FF0000"),4===t.childrenCount&&(this._drawBranch(t.children.NW,e),this._drawBranch(t.children.NE,e),this._drawBranch(t.children.SE,e),this._drawBranch(t.children.SW,e)),e.strokeStyle=i,e.beginPath(),e.moveTo(t.range.minX,t.range.minY),e.lineTo(t.range.maxX,t.range.minY),e.stroke(),e.beginPath(),e.moveTo(t.range.maxX,t.range.minY),e.lineTo(t.range.maxX,t.range.maxY),e.stroke(),e.beginPath(),e.moveTo(t.range.maxX,t.range.maxY),e.lineTo(t.range.minX,t.range.maxY),e.stroke(),e.beginPath(),e.moveTo(t.range.minX,t.range.maxY),e.lineTo(t.range.minX,t.range.minY),e.stroke()}}]),t}();e.default=h},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(e,i,o){(0,s.default)(this,t),this.body=e,this.physicsBody=i,this.setOptions(o)}return(0,a.default)(t,[{key:"setOptions",value:function(t){this.options=t}},{key:"solve",value:function(){for(var t,e,i,o,n,s,r,a,h=this.body.nodes,d=this.physicsBody.physicsNodeIndices,l=this.physicsBody.forces,u=this.options.nodeDistance,c=-2/3/u,p=4/3,f=0;f<d.length-1;f++){r=h[d[f]];for(var m=f+1;m<d.length;m++)a=h[d[m]],t=a.x-r.x,e=a.y-r.y,i=Math.sqrt(t*t+e*e),0===i&&(i=.1*Math.random(),t=i),i<2*u&&(s=i<.5*u?1:c*i+p,s/=i,o=t*s,n=e*s,l[r.id].x-=o,l[r.id].y-=n,l[a.id].x+=o,l[a.id].y+=n)}}}]),t}();e.default=h},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(e,i,o){(0,s.default)(this,t),this.body=e,this.physicsBody=i,this.setOptions(o)}return(0,a.default)(t,[{key:"setOptions",value:function(t){this.options=t}},{key:"solve",value:function(){var t,e,i,o,n,s,r,a,h,d,l=this.body.nodes,u=this.physicsBody.physicsNodeIndices,c=this.physicsBody.forces,p=this.options.nodeDistance;for(h=0;h<u.length-1;h++)for(r=l[u[h]],d=h+1;d<u.length;d++)if(a=l[u[d]],r.level===a.level){t=a.x-r.x,e=a.y-r.y,i=Math.sqrt(t*t+e*e);var f=.05;s=i<p?-Math.pow(f*i,2)+Math.pow(f*p,2):0,0===i?i=.01:s/=i,o=t*s,n=e*s,c[r.id].x-=o,c[r.id].y-=n,c[a.id].x+=o,c[a.id].y+=n}}}]),t}();e.default=h},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(e,i,o){(0,s.default)(this,t),this.body=e,this.physicsBody=i,this.setOptions(o)}return(0,a.default)(t,[{key:"setOptions",value:function(t){this.options=t}},{key:"solve",value:function(){for(var t=void 0,e=void 0,i=this.physicsBody.physicsEdgeIndices,o=this.body.edges,n=void 0,s=void 0,r=void 0,a=0;a<i.length;a++)e=o[i[a]],e.connected===!0&&e.toId!==e.fromId&&void 0!==this.body.nodes[e.toId]&&void 0!==this.body.nodes[e.fromId]&&(void 0!==e.edgeType.via?(t=void 0===e.options.length?this.options.springLength:e.options.length,n=e.to,s=e.edgeType.via,r=e.from,this._calculateSpringForce(n,s,.5*t),this._calculateSpringForce(s,r,.5*t)):(t=void 0===e.options.length?1.5*this.options.springLength:e.options.length,this._calculateSpringForce(e.from,e.to,t)))}},{key:"_calculateSpringForce",value:function(t,e,i){var o=t.x-e.x,n=t.y-e.y,s=Math.max(Math.sqrt(o*o+n*n),.01),r=this.options.springConstant*(i-s)/s,a=o*r,h=n*r;void 0!==this.physicsBody.forces[t.id]&&(this.physicsBody.forces[t.id].x+=a,this.physicsBody.forces[t.id].y+=h),void 0!==this.physicsBody.forces[e.id]&&(this.physicsBody.forces[e.id].x-=a,this.physicsBody.forces[e.id].y-=h)}}]),t}();e.default=h},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(e,i,o){(0,s.default)(this,t),this.body=e,this.physicsBody=i,this.setOptions(o)}return(0,a.default)(t,[{key:"setOptions",value:function(t){this.options=t}},{key:"solve",value:function(){for(var t,e,i,o,n,s,r,a,h=this.body.edges,d=.5,l=this.physicsBody.physicsEdgeIndices,u=this.physicsBody.physicsNodeIndices,c=this.physicsBody.forces,p=0;p<u.length;p++){var f=u[p];c[f].springFx=0,c[f].springFy=0}for(var m=0;m<l.length;m++)e=h[l[m]],e.connected===!0&&(t=void 0===e.options.length?this.options.springLength:e.options.length,i=e.from.x-e.to.x,o=e.from.y-e.to.y,a=Math.sqrt(i*i+o*o),a=0===a?.01:a,r=this.options.springConstant*(t-a)/a,n=i*r,s=o*r,e.to.level!=e.from.level?(void 0!==c[e.toId]&&(c[e.toId].springFx-=n,c[e.toId].springFy-=s),void 0!==c[e.fromId]&&(c[e.fromId].springFx+=n,c[e.fromId].springFy+=s)):(void 0!==c[e.toId]&&(c[e.toId].x-=d*n,c[e.toId].y-=d*s),void 0!==c[e.fromId]&&(c[e.fromId].x+=d*n,c[e.fromId].y+=d*s)));for(var v,g,r=1,y=0;y<u.length;y++){var b=u[y];v=Math.min(r,Math.max(-r,c[b].springFx)),g=Math.min(r,Math.max(-r,c[b].springFy)),c[b].x+=v,c[b].y+=g}for(var _=0,w=0,x=0;x<u.length;x++){var k=u[x];_+=c[k].x,w+=c[k].y}for(var O=_/u.length,D=w/u.length,S=0;S<u.length;S++){var M=u[S];c[M].x-=O,c[M].y-=D}}}]),t}();e.default=h},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(e,i,o){(0,s.default)(this,t),this.body=e,this.physicsBody=i,this.setOptions(o)}return(0,a.default)(t,[{key:"setOptions",value:function(t){this.options=t}},{key:"solve",value:function(){for(var t=void 0,e=void 0,i=void 0,o=void 0,n=this.body.nodes,s=this.physicsBody.physicsNodeIndices,r=this.physicsBody.forces,a=0;a<s.length;a++){var h=s[a];o=n[h],t=-o.x,e=-o.y,i=Math.sqrt(t*t+e*e),this._calculateForces(i,t,e,r,o)}}},{key:"_calculateForces",value:function(t,e,i,o,n){var s=0===t?0:this.options.centralGravity/t;o[n.id].x=e*s,o[n.id].y=i*s}}]),t}();e.default=h},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(201),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"_calculateForces",value:function(t,e,i,o,n){0===t&&(t=.1*Math.random(),e=t),this.overlapAvoidanceFactor<1&&o.shape.radius&&(t=Math.max(.1+this.overlapAvoidanceFactor*o.shape.radius,t-o.shape.radius));var s=o.edges.length+1,r=this.options.gravitationalConstant*n.mass*o.options.mass*s/Math.pow(t,2),a=e*r,h=i*r;this.physicsBody.forces[o.id].x+=a,this.physicsBody.forces[o.id].y+=h}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(169),u=o(l),c=i(170),p=o(c),f=i(206),m=o(f),v=function(t){function e(t,i,o){return(0,a.default)(this,e),(0,u.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o))}return(0,p.default)(e,t),(0,d.default)(e,[{key:"_calculateForces",value:function(t,e,i,o,n){if(t>0){var s=n.edges.length+1,r=this.options.centralGravity*s*n.options.mass;o[n.id].x=e*r,o[n.id].y=i*r}}}]),e}(m.default);e.default=v},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(58),s=o(n),r=i(62),a=o(r),h=i(115),d=o(h),l=i(116),u=o(l),c=i(210),p=o(c),f=i(211),m=o(f),v=i(1),g=function(){function t(e){var i=this;(0,d.default)(this,t),this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},v.extend(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){i.clusteredNodes={},i.clusteredEdges={}})}return(0,u.default)(t,[{key:"clusterByHubsize",value:function(t,e){void 0===t?t=this._getHubSize():"object"===("undefined"==typeof t?"undefined":(0,a.default)(t))&&(e=this._checkOptions(t),t=this._getHubSize());for(var i=[],o=0;o<this.body.nodeIndices.length;o++){var n=this.body.nodes[this.body.nodeIndices[o]];n.edges.length>=t&&i.push(n.id)}for(var s=0;s<i.length;s++)this.clusterByConnection(i[s],e,!0);this.body.emitter.emit("_dataChanged")}},{key:"cluster",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===t.joinCondition)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);for(var i={},o={},n=0;n<this.body.nodeIndices.length;n++){var s=this.body.nodeIndices[n],r=this.body.nodes[s],a=p.default.cloneOptions(r);if(t.joinCondition(a)===!0){i[s]=this.body.nodes[s];for(var h=0;h<r.edges.length;h++){var d=r.edges[h];void 0===this.clusteredEdges[d.id]&&(o[d.id]=d)}}}this._cluster(i,o,t,e)}},{key:"clusterByEdgeCount",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=this._checkOptions(e);for(var o=[],n={},r=void 0,a=void 0,h=void 0,d=void 0,l=void 0,u=0;u<this.body.nodeIndices.length;u++){var c={},f={};if(d=this.body.nodeIndices[u],void 0===n[d]){l=0,h=this.body.nodes[d],a=[];for(var m=0;m<h.edges.length;m++)r=h.edges[m],void 0===this.clusteredEdges[r.id]&&(r.toId!==r.fromId&&l++,a.push(r));if(l===t){for(var v=!0,g=0;g<a.length;g++){r=a[g];var y=this._getConnectedId(r,d);if(void 0===e.joinCondition)f[r.id]=r,c[d]=this.body.nodes[d],c[y]=this.body.nodes[y],n[d]=!0;else{var b=p.default.cloneOptions(this.body.nodes[d]);if(e.joinCondition(b)!==!0){v=!1;break}f[r.id]=r,c[d]=this.body.nodes[d],n[d]=!0}}(0,s.default)(c).length>0&&(0,s.default)(f).length>0&&v===!0&&o.push({nodes:c,edges:f})}}}for(var _=0;_<o.length;_++)this._cluster(o[_].nodes,o[_].edges,e,!1);i===!0&&this.body.emitter.emit("_dataChanged")}},{key:"clusterOutliers",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(1,t,e)}},{key:"clusterBridges",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(2,t,e)}},{key:"clusterByConnection",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===t)throw new Error("No nodeId supplied to clusterByConnection!");if(void 0===this.body.nodes[t])throw new Error("The nodeId given to clusterByConnection does not exist!");var o=this.body.nodes[t];e=this._checkOptions(e,o),void 0===e.clusterNodeProperties.x&&(e.clusterNodeProperties.x=o.x),void 0===e.clusterNodeProperties.y&&(e.clusterNodeProperties.y=o.y),void 0===e.clusterNodeProperties.fixed&&(e.clusterNodeProperties.fixed={},e.clusterNodeProperties.fixed.x=o.options.fixed.x,e.clusterNodeProperties.fixed.y=o.options.fixed.y);var n={},r={},a=o.id,h=p.default.cloneOptions(o);n[a]=o;for(var d=0;d<o.edges.length;d++){var l=o.edges[d];if(void 0===this.clusteredEdges[l.id]){var u=this._getConnectedId(l,a);if(void 0===this.clusteredNodes[u])if(u!==a)if(void 0===e.joinCondition)r[l.id]=l,n[u]=this.body.nodes[u];else{var c=p.default.cloneOptions(this.body.nodes[u]);e.joinCondition(h,c)===!0&&(r[l.id]=l,n[u]=this.body.nodes[u])}else r[l.id]=l}}var f=(0,s.default)(n).map(function(t){return n[t].id});for(m in n)for(var m=n[m],v=0;v<m.edges.length;v++){var g=m.edges[v];f.indexOf(this._getConnectedId(g,m.id))>-1&&(r[g.id]=g)}this._cluster(n,r,e,i)}},{key:"_createClusterEdges",value:function(t,e,i,o){for(var n=void 0,r=void 0,a=void 0,h=void 0,d=void 0,l=void 0,u=(0,s.default)(t),c=[],f=0;f<u.length;f++){r=u[f],a=t[r];for(var m=0;m<a.edges.length;m++)n=a.edges[m],void 0===this.clusteredEdges[n.id]&&(n.toId==n.fromId?e[n.id]=n:n.toId==r?(h=i.id,d=n.fromId,l=d):(h=n.toId,d=i.id,l=h),void 0===t[l]&&c.push({edge:n,fromId:d,toId:h}))}for(var g=0;g<c.length;g++){var y=c[g].edge,b=p.default.cloneOptions(y,"edge");v.deepExtend(b,o),b.from=c[g].fromId,b.to=c[g].toId,b.id="clusterEdge:"+v.randomUUID();var _=this.body.functions.createEdge(b);_.clusteringEdgeReplacingId=y.id,this.body.edges[y.id].edgeReplacedById=_.id,this.body.edges[_.id]=_,_.connect(),this._backupEdgeOptions(y),y.setOptions({physics:!1,hidden:!0})}}},{key:"_checkOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0===t.clusterEdgeProperties&&(t.clusterEdgeProperties={}),void 0===t.clusterNodeProperties&&(t.clusterNodeProperties={}),t}},{key:"_cluster",value:function(t,e,i){var o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(0!=(0,s.default)(t).length&&(1!=(0,s.default)(t).length||1==i.clusterNodeProperties.allowSingleNodeCluster)){for(var n in t)if(t.hasOwnProperty(n)&&void 0!==this.clusteredNodes[n])return;var r=v.deepExtend({},i.clusterNodeProperties);if(void 0!==i.processProperties){var a=[];for(var h in t)if(t.hasOwnProperty(h)){var d=p.default.cloneOptions(t[h]);a.push(d)}var l=[];for(var u in e)if(e.hasOwnProperty(u)&&"clusterEdge:"!==u.substr(0,12)){var c=p.default.cloneOptions(e[u],"edge");l.push(c)}if(r=i.processProperties(r,a,l),!r)throw new Error("The processProperties function does not return properties!")}void 0===r.id&&(r.id="cluster:"+v.randomUUID());var f=r.id;void 0===r.label&&(r.label="cluster");var g=void 0;void 0===r.x&&(g=this._getClusterPosition(t),r.x=g.x),void 0===r.y&&(void 0===g&&(g=this._getClusterPosition(t)),r.y=g.y),r.id=f;var y=this.body.functions.createNode(r,m.default);y.isCluster=!0,y.containedNodes=t,y.containedEdges=e,y.clusterEdgeProperties=i.clusterEdgeProperties,this.body.nodes[r.id]=y,this._createClusterEdges(t,e,r,i.clusterEdgeProperties);for(var b in e)if(e.hasOwnProperty(b)&&void 0!==this.body.edges[b]){var _=this.body.edges[b];this._backupEdgeOptions(_),_.setOptions({physics:!1,hidden:!0})}for(var w in t)t.hasOwnProperty(w)&&(this.clusteredNodes[w]={clusterId:r.id,node:this.body.nodes[w]},this.body.nodes[w].setOptions({hidden:!0,physics:!1}));r.id=void 0,o===!0&&this.body.emitter.emit("_dataChanged")}}},{key:"_backupEdgeOptions",value:function(t){void 0===this.clusteredEdges[t.id]&&(this.clusteredEdges[t.id]={physics:t.options.physics,hidden:t.options.hidden})}},{key:"_restoreEdge",value:function(t){var e=this.clusteredEdges[t.id];void 0!==e&&(t.setOptions({physics:e.physics,hidden:e.hidden}),delete this.clusteredEdges[t.id])}},{key:"isCluster",value:function(t){return void 0!==this.body.nodes[t]?this.body.nodes[t].isCluster===!0:(console.log("Node does not exist."),!1)}},{key:"_getClusterPosition",value:function(t){for(var e=(0,s.default)(t),i=t[e[0]].x,o=t[e[0]].x,n=t[e[0]].y,r=t[e[0]].y,a=void 0,h=1;h<e.length;h++)a=t[e[h]],i=a.x<i?a.x:i,o=a.x>o?a.x:o,n=a.y<n?a.y:n,r=a.y>r?a.y:r;return{x:.5*(i+o),y:.5*(n+r)}}},{key:"openCluster",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===t)throw new Error("No clusterNodeId supplied to openCluster.");if(void 0===this.body.nodes[t])throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(void 0===this.body.nodes[t].containedNodes)return void console.log("The node:"+t+" is not a cluster.");var o=this.body.nodes[t],n=o.containedNodes,s=o.containedEdges;if(void 0!==e&&void 0!==e.releaseFunction&&"function"==typeof e.releaseFunction){var r={},a={x:o.x,y:o.y};for(var h in n)if(n.hasOwnProperty(h)){var d=this.body.nodes[h];r[h]={x:d.x,y:d.y}}var l=e.releaseFunction(a,r);for(var u in n)if(n.hasOwnProperty(u)){var c=this.body.nodes[u];void 0!==l[u]&&(c.x=void 0===l[u].x?o.x:l[u].x,c.y=void 0===l[u].y?o.y:l[u].y)}}else for(var f in n)if(n.hasOwnProperty(f)){var m=this.body.nodes[f];m=n[f],m.options.fixed.x===!1&&(m.x=o.x),m.options.fixed.y===!1&&(m.y=o.y)}for(var g in n)if(n.hasOwnProperty(g)){var y=this.body.nodes[g];y.vx=o.vx,y.vy=o.vy,y.setOptions({hidden:!1,physics:!0}),delete this.clusteredNodes[g]}for(var b=[],_=0;_<o.edges.length;_++)b.push(o.edges[_]);for(var w=0;w<b.length;w++){var x=b[w],k=this._getConnectedId(x,t);if(void 0!==this.clusteredNodes[k]){var O=this.body.nodes[this.clusteredNodes[k].clusterId],D=this.body.edges[x.clusteringEdgeReplacingId];if(void 0!==D){O.containedEdges[D.id]=D,delete s[D.id];var S=D.fromId,M=D.toId;D.toId==k?M=this.clusteredNodes[k].clusterId:S=this.clusteredNodes[k].clusterId;var C=p.default.cloneOptions(D,"edge");v.deepExtend(C,O.clusterEdgeProperties);var T="clusterEdge:"+v.randomUUID();v.deepExtend(C,{from:S,to:M,hidden:!1,physics:!0,id:T});var E=this.body.functions.createEdge(C);E.clusteringEdgeReplacingId=D.id,this.body.edges[T]=E,this.body.edges[T].connect()}}else{var P=this.body.edges[x.clusteringEdgeReplacingId];void 0!==P&&this._restoreEdge(P)}x.cleanup(),x.disconnect(),delete this.body.edges[x.id]}for(var I in s)s.hasOwnProperty(I)&&this._restoreEdge(s[I]);delete this.body.nodes[t],i===!0&&this.body.emitter.emit("_dataChanged")}},{key:"getNodesInCluster",value:function(t){var e=[];if(this.isCluster(t)===!0){var i=this.body.nodes[t].containedNodes;for(var o in i)i.hasOwnProperty(o)&&e.push(this.body.nodes[o].id)}return e}},{key:"findNode",value:function(t){for(var e=[],i=100,o=0;void 0!==this.clusteredNodes[t]&&o<i;)e.push(this.body.nodes[t].id),t=this.clusteredNodes[t].clusterId,o++;return e.push(this.body.nodes[t].id),e.reverse(),e}},{key:"updateClusteredNode",value:function(t,e){if(void 0===t)throw new Error("No clusteredNodeId supplied to updateClusteredNode.");if(void 0===e)throw new Error("No newOptions supplied to updateClusteredNode.");if(void 0===this.body.nodes[t])throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist.");this.body.nodes[t].setOptions(e),this.body.emitter.emit("_dataChanged")}},{key:"updateEdge",value:function(t,e){if(void 0===t)throw new Error("No startEdgeId supplied to updateEdge.");if(void 0===e)throw new Error("No newOptions supplied to updateEdge.");if(void 0===this.body.edges[t])throw new Error("The startEdgeId supplied to updateEdge does not exist.");for(var i=this.getClusteredEdges(t),o=0;o<i.length;o++){var n=this.body.edges[i[o]];n.setOptions(e)}this.body.emitter.emit("_dataChanged")}},{key:"getClusteredEdges",value:function(t){for(var e=[],i=100,o=0;void 0!==t&&void 0!==this.body.edges[t]&&o<i;)e.push(this.body.edges[t].id),t=this.body.edges[t].edgeReplacedById,o++;return e.reverse(),e}},{key:"getBaseEdge",value:function(t){for(var e=t,i=100,o=0;void 0!==t&&void 0!==this.body.edges[t]&&o<i;)t=this.body.edges[t].clusteringEdgeReplacingId,o++,void 0!==t&&(e=t);return e}},{key:"_getConnectedId",value:function(t,e){return t.toId!=e?t.toId:t.fromId!=e?t.fromId:t.fromId}},{key:"_getHubSize",value:function(){for(var t=0,e=0,i=0,o=0,n=0;n<this.body.nodeIndices.length;n++){var s=this.body.nodes[this.body.nodeIndices[n]];s.edges.length>o&&(o=s.edges.length),t+=s.edges.length,e+=Math.pow(s.edges.length,2),i+=1}t/=i,e/=i;var r=e-Math.pow(t,2),a=Math.sqrt(r),h=Math.floor(t+2*a);return h>o&&(h=o),h}}]),t}();e.default=g},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=i(1),d=function(){function t(){(0,s.default)(this,t)}return(0,a.default)(t,null,[{key:"getRange",value:function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=1e9,n=-1e9,s=1e9,r=-1e9;if(i.length>0)for(var a=0;a<i.length;a++)e=t[i[a]],s>e.shape.boundingBox.left&&(s=e.shape.boundingBox.left),r<e.shape.boundingBox.right&&(r=e.shape.boundingBox.right),o>e.shape.boundingBox.top&&(o=e.shape.boundingBox.top),n<e.shape.boundingBox.bottom&&(n=e.shape.boundingBox.bottom);return 1e9===s&&r===-1e9&&1e9===o&&n===-1e9&&(o=0,n=0,s=0,r=0),{minX:s,maxX:r,minY:o,maxY:n}}},{key:"getRangeCore",value:function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=1e9,n=-1e9,s=1e9,r=-1e9;if(i.length>0)for(var a=0;a<i.length;a++)e=t[i[a]],s>e.x&&(s=e.x),r<e.x&&(r=e.x),o>e.y&&(o=e.y),n<e.y&&(n=e.y);return 1e9===s&&r===-1e9&&1e9===o&&n===-1e9&&(o=0,n=0,s=0,r=0),{minX:s,maxX:r,minY:o,maxY:n}}},{key:"findCenter",value:function(t){return{x:.5*(t.maxX+t.minX),y:.5*(t.maxY+t.minY)}}},{key:"cloneOptions",value:function(t,e){var i={};return void 0===e||"node"===e?(h.deepExtend(i,t.options,!0),i.x=t.x,i.y=t.y,i.amountOfConnections=t.edges.length):h.deepExtend(i,t.options,!0),i}}]),t}();e.default=d},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(166),s=o(n),r=i(115),a=o(r),h=i(169),d=o(h),l=i(170),u=o(l),c=i(159),p=o(c),f=function(t){function e(t,i,o,n,r){(0,a.default)(this,e);var h=(0,d.default)(this,(e.__proto__||(0,s.default)(e)).call(this,t,i,o,n,r));return h.isCluster=!0,h.containedNodes={},h.containedEdges={},h}return(0,u.default)(e,t),e}(p.default);e.default=f},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r);"undefined"!=typeof window&&(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame);var h=i(1),d=function(){function t(e,i){(0,s.default)(this,t),this.body=e,this.canvas=i,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.pixelRatio=void 0,this.allowRedraw=!0,this.dragging=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideNodesOnDrag:!1},h.extend(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return(0,a.default)(t,[{key:"bindEventListeners",value:function(){var t=this;this.body.emitter.on("dragStart",function(){t.dragging=!0}),this.body.emitter.on("dragEnd",function(){t.dragging=!1}),this.body.emitter.on("_resizeNodes",function(){t._resizeNodes()}),this.body.emitter.on("_redraw",function(){t.renderingActive===!1&&t._redraw()}),this.body.emitter.on("_blockRedraw",function(){t.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){t.allowRedraw=!0,t.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",this._requestRedraw.bind(this)),this.body.emitter.on("_startRendering",function(){t.renderRequests+=1,t.renderingActive=!0,t._startRendering()}),this.body.emitter.on("_stopRendering",function(){t.renderRequests-=1,t.renderingActive=t.renderRequests>0,t.renderTimer=void 0}),this.body.emitter.on("destroy",function(){t.renderRequests=0,t.allowRedraw=!1,t.renderingActive=!1,t.requiresTimeout===!0?clearTimeout(t.renderTimer):cancelAnimationFrame(t.renderTimer),t.body.emitter.off()})}},{key:"setOptions",value:function(t){if(void 0!==t){var e=["hideEdgesOnDrag","hideNodesOnDrag"];h.selectiveDeepExtend(e,this.options,t)}}},{key:"_startRendering",value:function(){this.renderingActive===!0&&void 0===this.renderTimer&&(this.requiresTimeout===!0?this.renderTimer=window.setTimeout(this._renderStep.bind(this),this.simulationInterval):this.renderTimer=window.requestAnimationFrame(this._renderStep.bind(this)))}},{key:"_renderStep",value:function(){this.renderingActive===!0&&(this.renderTimer=void 0,this.requiresTimeout===!0&&this._startRendering(),this._redraw(),this.requiresTimeout===!1&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var t=this;this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,this.requiresTimeout===!0?window.setTimeout(function(){t._redraw(!1)},0):window.requestAnimationFrame(function(){t._redraw(!1)}))}},{key:"_redraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];
+if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;var e=this.canvas.frame.canvas.getContext("2d");0!==this.canvas.frame.canvas.width&&0!==this.canvas.frame.canvas.height||this.canvas.setSize(),this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var i=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(e.clearRect(0,0,i,o),0===this.canvas.frame.clientWidth)return;e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale),e.beginPath(),this.body.emitter.emit("beforeDrawing",e),e.closePath(),t===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&this._drawEdges(e),(this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1)&&this._drawNodes(e,t),e.beginPath(),this.body.emitter.emit("afterDrawing",e),e.closePath(),e.restore(),t===!0&&e.clearRect(0,0,i,o)}}},{key:"_resizeNodes",value:function(){var t=this.canvas.frame.canvas.getContext("2d");void 0===this.pixelRatio&&(this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)),t.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0),t.save(),t.translate(this.body.view.translation.x,this.body.view.translation.y),t.scale(this.body.view.scale,this.body.view.scale);var e=this.body.nodes,i=void 0;for(var o in e)e.hasOwnProperty(o)&&(i=e[o],i.resize(t),i.updateBoundingBox(t,i.selected));t.restore()}},{key:"_drawNodes",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.nodes,o=this.body.nodeIndices,n=void 0,s=[],r=20,a=this.canvas.DOMtoCanvas({x:-r,y:-r}),h=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+r,y:this.canvas.frame.canvas.clientHeight+r}),d={top:a.y,left:a.x,bottom:h.y,right:h.x},l=0;l<o.length;l++)n=i[o[l]],n.isSelected()?s.push(o[l]):e===!0?n.draw(t):n.isBoundingBoxOverlappingWith(d)===!0?n.draw(t):n.updateBoundingBox(t,n.selected);for(var u=0;u<s.length;u++)n=i[s[u]],n.draw(t)}},{key:"_drawEdges",value:function(t){for(var e=this.body.edges,i=this.body.edgeIndices,o=void 0,n=0;n<i.length;n++)o=e[i[n]],o.connected===!0&&o.draw(t)}},{key:"_determineBrowserMethod",value:function(){if("undefined"!=typeof window){var t=navigator.userAgent.toLowerCase();this.requiresTimeout=!1,t.indexOf("msie 9.0")!=-1?this.requiresTimeout=!0:t.indexOf("safari")!=-1&&t.indexOf("chrome")<=-1&&(this.requiresTimeout=!0)}else this.requiresTimeout=!0}}]),t}();e.default=d},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=i(108),d=i(121),l=i(1),u=function(){function t(e){(0,s.default)(this,t),this.body=e,this.pixelRatio=1,this.resizeTimer=void 0,this.resizeFunction=this._onResize.bind(this),this.cameraState={},this.initialized=!1,this.canvasViewCenter={},this.options={},this.defaultOptions={autoResize:!0,height:"100%",width:"100%"},l.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,a.default)(t,[{key:"bindEventListeners",value:function(){var t=this;this.body.emitter.once("resize",function(e){0!==e.width&&(t.body.view.translation.x=.5*e.width),0!==e.height&&(t.body.view.translation.y=.5*e.height)}),this.body.emitter.on("setSize",this.setSize.bind(this)),this.body.emitter.on("destroy",function(){t.hammerFrame.destroy(),t.hammer.destroy(),t._cleanUp()})}},{key:"setOptions",value:function(t){var e=this;if(void 0!==t){var i=["width","height","autoResize"];l.selectiveDeepExtend(i,this.options,t)}this.options.autoResize===!0&&(this._cleanUp(),this.resizeTimer=setInterval(function(){var t=e.setSize();t===!0&&e.body.emitter.emit("_requestRedraw")},1e3),this.resizeFunction=this._onResize.bind(this),l.addEventListener(window,"resize",this.resizeFunction))}},{key:"_cleanUp",value:function(){void 0!==this.resizeTimer&&clearInterval(this.resizeTimer),l.removeEventListener(window,"resize",this.resizeFunction),this.resizeFunction=void 0}},{key:"_onResize",value:function(){this.setSize(),this.body.emitter.emit("_redraw")}},{key:"_getCameraState",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/t,this.cameraState.previousHeight=this.frame.canvas.height/t,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/t,y:.5*this.frame.canvas.height/t}))}},{key:"_setCameraState",value:function(){if(void 0!==this.cameraState.scale&&0!==this.frame.canvas.clientWidth&&0!==this.frame.canvas.clientHeight&&0!==this.pixelRatio&&this.cameraState.previousWidth>0){var t=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,e=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,i=this.cameraState.scale;1!=t&&1!=e?i=.5*this.cameraState.scale*(t+e):1!=t?i=this.cameraState.scale*t:1!=e&&(i=this.cameraState.scale*e),this.body.view.scale=i;var o=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),n={x:o.x-this.cameraState.position.x,y:o.y-this.cameraState.position.y};this.body.view.translation.x+=n.x*this.body.view.scale,this.body.view.translation.y+=n.y*this.body.view.scale}}},{key:"_prepareValue",value:function(t){if("number"==typeof t)return t+"px";if("string"==typeof t){if(t.indexOf("%")!==-1||t.indexOf("px")!==-1)return t;if(t.indexOf("%")===-1)return t+"px"}throw new Error("Could not use the value supplied for width or height:"+t)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=900,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext){var t=this.frame.canvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),this.frame.canvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var t=this;void 0!==this.hammer&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new h(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:h.DIRECTION_ALL}),d.onTouch(this.hammer,function(e){t.body.eventListeners.onTouch(e)}),this.hammer.on("tap",function(e){t.body.eventListeners.onTap(e)}),this.hammer.on("doubletap",function(e){t.body.eventListeners.onDoubleTap(e)}),this.hammer.on("press",function(e){t.body.eventListeners.onHold(e)}),this.hammer.on("panstart",function(e){t.body.eventListeners.onDragStart(e)}),this.hammer.on("panmove",function(e){t.body.eventListeners.onDrag(e)}),this.hammer.on("panend",function(e){t.body.eventListeners.onDragEnd(e)}),this.hammer.on("pinch",function(e){t.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener("mousewheel",function(e){t.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener("DOMMouseScroll",function(e){t.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener("mousemove",function(e){t.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener("contextmenu",function(e){t.body.eventListeners.onContext(e)}),this.hammerFrame=new h(this.frame),d.onRelease(this.hammerFrame,function(e){t.body.eventListeners.onRelease(e)})}},{key:"setSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.width,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.height;t=this._prepareValue(t),e=this._prepareValue(e);var i=!1,o=this.frame.canvas.width,n=this.frame.canvas.height,s=this.frame.canvas.getContext("2d"),r=this.pixelRatio;return this.pixelRatio=(window.devicePixelRatio||1)/(s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1),t!=this.options.width||e!=this.options.height||this.frame.style.width!=t||this.frame.style.height!=e?(this._getCameraState(r),this.frame.style.width=t,this.frame.style.height=e,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=t,this.options.height=e,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0):(this.frame.canvas.width==Math.round(this.frame.canvas.clientWidth*this.pixelRatio)&&this.frame.canvas.height==Math.round(this.frame.canvas.clientHeight*this.pixelRatio)||this._getCameraState(r),this.frame.canvas.width!=Math.round(this.frame.canvas.clientWidth*this.pixelRatio)&&(this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),i=!0),this.frame.canvas.height!=Math.round(this.frame.canvas.clientHeight*this.pixelRatio)&&(this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),i=!0)),i===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(o/this.pixelRatio),oldHeight:Math.round(n/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}},{key:"_XconvertDOMtoCanvas",value:function(t){return(t-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(t){return t*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(t){return(t-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(t){return t*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(t){return{x:this._XconvertCanvasToDOM(t.x),y:this._YconvertCanvasToDOM(t.y)}}},{key:"DOMtoCanvas",value:function(t){return{x:this._XconvertDOMtoCanvas(t.x),y:this._YconvertDOMtoCanvas(t.y)}}}]),t}();e.default=u},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=i(210),d=o(h),l=i(1),u=function(){function t(e,i){var o=this;(0,s.default)(this,t),this.body=e,this.canvas=i,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",this.fit.bind(this)),this.body.emitter.on("animationFinished",function(){o.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",this.releaseNode.bind(this))}return(0,a.default)(t,[{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=t}},{key:"fit",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{nodes:[]},e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=void 0,o=void 0;if(void 0!==t.nodes&&0!==t.nodes.length||(t.nodes=this.body.nodeIndices),e===!0){var n=0;for(var s in this.body.nodes)if(this.body.nodes.hasOwnProperty(s)){var r=this.body.nodes[s];r.predefinedPosition===!0&&(n+=1)}if(n>.5*this.body.nodeIndices.length)return void this.fit(t,!1);i=d.default.getRange(this.body.nodes,t.nodes);var a=this.body.nodeIndices.length;o=12.662/(a+7.4147)+.0964822;var h=Math.min(this.canvas.frame.canvas.clientWidth/600,this.canvas.frame.canvas.clientHeight/600);o*=h}else{this.body.emitter.emit("_resizeNodes"),i=d.default.getRange(this.body.nodes,t.nodes);var l=1.1*Math.abs(i.maxX-i.minX),u=1.1*Math.abs(i.maxY-i.minY),c=this.canvas.frame.canvas.clientWidth/l,p=this.canvas.frame.canvas.clientHeight/u;o=c<=p?c:p}o>1?o=1:0===o&&(o=1);var f=d.default.findCenter(i),m={position:f,scale:o,animation:t.animation};this.moveTo(m)}},{key:"focus",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==this.body.nodes[t]){var i={x:this.body.nodes[t].x,y:this.body.nodes[t].y};e.position=i,e.lockedOnNode=t,this.moveTo(e)}else console.log("Node: "+t+" cannot be found.")}},{key:"moveTo",value:function(t){return void 0===t?void(t={}):(void 0===t.offset&&(t.offset={x:0,y:0}),void 0===t.offset.x&&(t.offset.x=0),void 0===t.offset.y&&(t.offset.y=0),void 0===t.scale&&(t.scale=this.body.view.scale),void 0===t.position&&(t.position=this.getViewPosition()),void 0===t.animation&&(t.animation={duration:0}),t.animation===!1&&(t.animation={duration:0}),t.animation===!0&&(t.animation={}),void 0===t.animation.duration&&(t.animation.duration=1e3),void 0===t.animation.easingFunction&&(t.animation.easingFunction="easeInOutQuad"),void this.animateView(t))}},{key:"animateView",value:function(t){if(void 0!==t){this.animationEasingFunction=t.animation.easingFunction,this.releaseNode(),t.locked===!0&&(this.lockedOnNodeId=t.lockedOnNode,this.lockedOnNodeOffset=t.offset),0!=this.easingTime&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=t.scale,this.body.view.scale=this.targetScale;var e=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:e.x-t.position.x,y:e.y-t.position.y};this.targetTranslation={x:this.sourceTranslation.x+i.x*this.targetScale+t.offset.x,y:this.sourceTranslation.y+i.y*this.targetScale+t.offset.y},0===t.animation.duration?void 0!=this.lockedOnNodeId?(this.viewFunction=this._lockedRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction)):(this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw")):(this.animationSpeed=1/(60*t.animation.duration*.001)||1/60,this.animationEasingFunction=t.animation.easingFunction,this.viewFunction=this._transitionRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))}}},{key:"_lockedRedraw",value:function(){var t={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},e=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:e.x-t.x,y:e.y-t.y},o=this.body.view.translation,n={x:o.x+i.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:o.y+i.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=n}},{key:"releaseNode",value:function(){void 0!==this.lockedOnNodeId&&void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.easingTime+=this.animationSpeed,this.easingTime=t===!0?1:this.easingTime;var e=l.easingFunctions[this.animationEasingFunction](this.easingTime);this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*e,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*e,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*e},this.easingTime>=1&&(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,void 0!=this.lockedOnNodeId&&(this.viewFunction=this._lockedRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction)),this.body.emitter.emit("animationFinished"))}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),t}();e.default=u},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=i(216),d=o(h),l=i(128),u=o(l),c=i(1),p=function(){function t(e,i,o){(0,s.default)(this,t),this.body=e,this.canvas=i,this.selectionHandler=o,this.navigationHandler=new d.default(e,i),this.body.eventListeners.onTap=this.onTap.bind(this),this.body.eventListeners.onTouch=this.onTouch.bind(this),this.body.eventListeners.onDoubleTap=this.onDoubleTap.bind(this),this.body.eventListeners.onHold=this.onHold.bind(this),this.body.eventListeners.onDragStart=this.onDragStart.bind(this),this.body.eventListeners.onDrag=this.onDrag.bind(this),this.body.eventListeners.onDragEnd=this.onDragEnd.bind(this),this.body.eventListeners.onMouseWheel=this.onMouseWheel.bind(this),this.body.eventListeners.onPinch=this.onPinch.bind(this),this.body.eventListeners.onMouseMove=this.onMouseMove.bind(this),this.body.eventListeners.onRelease=this.onRelease.bind(this),this.body.eventListeners.onContext=this.onContext.bind(this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=this.getPointer.bind(this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0},c.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,a.default)(t,[{key:"bindEventListeners",value:function(){var t=this;this.body.emitter.on("destroy",function(){clearTimeout(t.popupTimer),delete t.body.functions.getPointer})}},{key:"setOptions",value:function(t){if(void 0!==t){var e=["hideEdgesOnDrag","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"];c.selectiveNotDeepExtend(e,this.options,t),c.mergeOptions(this.options,t,"keyboard"),t.tooltip&&(c.extend(this.options.tooltip,t.tooltip),t.tooltip.color&&(this.options.tooltip.color=c.parseColor(t.tooltip.color)))}this.navigationHandler.setOptions(this.options)}},{key:"getPointer",value:function(t){return{x:t.x-c.getAbsoluteLeft(this.canvas.frame.canvas),y:t.y-c.getAbsoluteTop(this.canvas.frame.canvas)}}},{key:"onTouch",value:function(t){(new Date).valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(t.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=(new Date).valueOf())}},{key:"onTap",value:function(t){var e=this.getPointer(t.center),i=this.selectionHandler.options.multiselect&&(t.changedPointers[0].ctrlKey||t.changedPointers[0].metaKey);this.checkSelectionChanges(e,t,i),this.selectionHandler._generateClickEvent("click",t,e)}},{key:"onDoubleTap",value:function(t){var e=this.getPointer(t.center);this.selectionHandler._generateClickEvent("doubleClick",t,e)}},{key:"onHold",value:function(t){var e=this.getPointer(t.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(e,t,i),this.selectionHandler._generateClickEvent("click",t,e),this.selectionHandler._generateClickEvent("hold",t,e)}},{key:"onRelease",value:function(t){if((new Date).valueOf()-this.touchTime>10){var e=this.getPointer(t.center);this.selectionHandler._generateClickEvent("release",t,e),this.touchTime=(new Date).valueOf()}}},{key:"onContext",value:function(t){var e=this.getPointer({x:t.clientX,y:t.clientY});this.selectionHandler._generateClickEvent("oncontext",t,e)}},{key:"checkSelectionChanges",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this.selectionHandler._getSelectedEdgeCount(),n=this.selectionHandler._getSelectedNodeCount(),s=this.selectionHandler.getSelection(),r=void 0;r=i===!0?this.selectionHandler.selectAdditionalOnPoint(t):this.selectionHandler.selectOnPoint(t);var a=this.selectionHandler._getSelectedEdgeCount(),h=this.selectionHandler._getSelectedNodeCount(),d=this.selectionHandler.getSelection(),l=this._determineIfDifferent(s,d),u=l.nodesChanged,c=l.edgesChanged,p=!1;h-n>0?(this.selectionHandler._generateClickEvent("selectNode",e,t),r=!0,p=!0):u===!0&&h>0?(this.selectionHandler._generateClickEvent("deselectNode",e,t,s),this.selectionHandler._generateClickEvent("selectNode",e,t),p=!0,r=!0):h-n<0&&(this.selectionHandler._generateClickEvent("deselectNode",e,t,s),r=!0),a-o>0&&p===!1?(this.selectionHandler._generateClickEvent("selectEdge",e,t),r=!0):a>0&&c===!0?(this.selectionHandler._generateClickEvent("deselectEdge",e,t,s),this.selectionHandler._generateClickEvent("selectEdge",e,t),r=!0):a-o<0&&(this.selectionHandler._generateClickEvent("deselectEdge",e,t,s),r=!0),r===!0&&this.selectionHandler._generateClickEvent("select",e,t)}},{key:"_determineIfDifferent",value:function(t,e){for(var i=!1,o=!1,n=0;n<t.nodes.length;n++)e.nodes.indexOf(t.nodes[n])===-1&&(i=!0);for(var s=0;s<e.nodes.length;s++)t.nodes.indexOf(t.nodes[s])===-1&&(i=!0);for(var r=0;r<t.edges.length;r++)e.edges.indexOf(t.edges[r])===-1&&(o=!0);for(var a=0;a<e.edges.length;a++)t.edges.indexOf(t.edges[a])===-1&&(o=!0);return{nodesChanged:i,edgesChanged:o}}},{key:"onDragStart",value:function(t){void 0===this.drag.pointer&&this.onTouch(t);var e=this.selectionHandler.getNodeAt(this.drag.pointer);if(this.drag.dragging=!0,this.drag.selection=[],this.drag.translation=c.extend({},this.body.view.translation),this.drag.nodeId=void 0,void 0!==e&&this.options.dragNodes===!0){this.drag.nodeId=e.id,e.isSelected()===!1&&(this.selectionHandler.unselectAll(),this.selectionHandler.selectObject(e)),this.selectionHandler._generateClickEvent("dragStart",t,this.drag.pointer);var i=this.selectionHandler.selectionObj.nodes;for(var o in i)if(i.hasOwnProperty(o)){var n=i[o],s={id:n.id,node:n,x:n.x,y:n.y,xFixed:n.options.fixed.x,yFixed:n.options.fixed.y};n.options.fixed.x=!0,n.options.fixed.y=!0,this.drag.selection.push(s)}}else this.selectionHandler._generateClickEvent("dragStart",t,this.drag.pointer,void 0,!0)}},{key:"onDrag",value:function(t){var e=this;if(this.drag.pinched!==!0){this.body.emitter.emit("unlockNode");var i=this.getPointer(t.center),o=this.drag.selection;if(o&&o.length&&this.options.dragNodes===!0)!function(){e.selectionHandler._generateClickEvent("dragging",t,i);var n=i.x-e.drag.pointer.x,s=i.y-e.drag.pointer.y;o.forEach(function(t){var i=t.node;t.xFixed===!1&&(i.x=e.canvas._XconvertDOMtoCanvas(e.canvas._XconvertCanvasToDOM(t.x)+n)),t.yFixed===!1&&(i.y=e.canvas._YconvertDOMtoCanvas(e.canvas._YconvertCanvasToDOM(t.y)+s))}),e.body.emitter.emit("startSimulation")}();else if(this.options.dragView===!0){if(this.selectionHandler._generateClickEvent("dragging",t,i,void 0,!0),void 0===this.drag.pointer)return void this.onDragStart(t);var n=i.x-this.drag.pointer.x,s=i.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+n,y:this.drag.translation.y+s},this.body.emitter.emit("_redraw")}}}},{key:"onDragEnd",value:function(t){this.drag.dragging=!1;var e=this.drag.selection;e&&e.length?(e.forEach(function(t){t.node.options.fixed.x=t.xFixed,t.node.options.fixed.y=t.yFixed}),this.selectionHandler._generateClickEvent("dragEnd",t,this.getPointer(t.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler._generateClickEvent("dragEnd",t,this.getPointer(t.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}},{key:"onPinch",value:function(t){var e=this.getPointer(t.center);this.drag.pinched=!0,void 0===this.pinch.scale&&(this.pinch.scale=1);var i=this.pinch.scale*t.scale;this.zoom(i,e)}},{key:"zoom",value:function(t,e){if(this.options.zoomView===!0){var i=this.body.view.scale;t<1e-5&&(t=1e-5),t>10&&(t=10);var o=void 0;void 0!==this.drag&&this.drag.dragging===!0&&(o=this.canvas.DOMtoCanvas(this.drag.pointer));var n=this.body.view.translation,s=t/i,r=(1-s)*e.x+n.x*s,a=(1-s)*e.y+n.y*s;if(this.body.view.scale=t,this.body.view.translation={x:r,y:a},void 0!=o){var h=this.canvas.canvasToDOM(o);this.drag.pointer.x=h.x,this.drag.pointer.y=h.y}this.body.emitter.emit("_requestRedraw"),i<t?this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:e}):this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:e})}}},{key:"onMouseWheel",value:function(t){if(this.options.zoomView===!0){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),0!==e){var i=this.body.view.scale,o=e/10;e<0&&(o/=1-o),i*=1+o;var n=this.getPointer({x:t.clientX,y:t.clientY});this.zoom(i,n)}t.preventDefault()}}},{key:"onMouseMove",value:function(t){var e=this,i=this.getPointer({x:t.clientX,y:t.clientY}),o=!1;if(void 0!==this.popup&&(this.popup.hidden===!1&&this._checkHidePopup(i),this.popup.hidden===!1&&(o=!0,this.popup.setPosition(i.x+3,i.y-5),this.popup.show())),this.options.keyboard.bindToWindow===!1&&this.options.keyboard.enabled===!0&&this.canvas.frame.focus(),o===!1&&(void 0!==this.popupTimer&&(clearInterval(this.popupTimer),this.popupTimer=void 0),this.drag.dragging||(this.popupTimer=setTimeout(function(){return e._checkShowPopup(i)},this.options.tooltipDelay))),this.options.hover===!0){var n=this.selectionHandler.getNodeAt(i);void 0===n&&(n=this.selectionHandler.getEdgeAt(i)),this.selectionHandler.hoverObject(n)}}},{key:"_checkShowPopup",value:function(t){var e=this.canvas._XconvertDOMtoCanvas(t.x),i=this.canvas._YconvertDOMtoCanvas(t.y),o={left:e,top:i,right:e,bottom:i},n=void 0===this.popupObj?void 0:this.popupObj.id,s=!1,r="node";if(void 0===this.popupObj){for(var a=this.body.nodeIndices,h=this.body.nodes,d=void 0,l=[],c=0;c<a.length;c++)d=h[a[c]],d.isOverlappingWith(o)===!0&&void 0!==d.getTitle()&&l.push(a[c]);l.length>0&&(this.popupObj=h[l[l.length-1]],s=!0)}if(void 0===this.popupObj&&s===!1){for(var p=this.body.edgeIndices,f=this.body.edges,m=void 0,v=[],g=0;g<p.length;g++)m=f[p[g]],m.isOverlappingWith(o)===!0&&m.connected===!0&&void 0!==m.getTitle()&&v.push(p[g]);v.length>0&&(this.popupObj=f[v[v.length-1]],r="edge")}void 0!==this.popupObj?this.popupObj.id!==n&&(void 0===this.popup&&(this.popup=new u.default(this.canvas.frame)),this.popup.popupTargetType=r,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(t.x+3,t.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):void 0!==this.popup&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(t){var e=this.selectionHandler._pointerToPositionObject(t),i=!1;if("node"===this.popup.popupTargetType){if(void 0!==this.body.nodes[this.popup.popupTargetId]&&(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(e),i===!0)){var o=this.selectionHandler.getNodeAt(t);i=void 0!==o&&o.id===this.popup.popupTargetId}}else void 0===this.selectionHandler.getNodeAt(t)&&void 0!==this.body.edges[this.popup.popupTargetId]&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(e));i===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),t}();e.default=p},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=(i(1),i(108)),d=i(121),l=i(111),u=function(){function t(e,i){var o=this;(0,s.default)(this,t),this.body=e,this.canvas=i,this.iconsCreated=!1,this.navigationHammers=[],this.boundFunctions={},this.touchTime=0,this.activated=!1,this.body.emitter.on("activate",function(){o.activated=!0,o.configureKeyboardBindings()}),this.body.emitter.on("deactivate",function(){o.activated=!1,o.configureKeyboardBindings()}),this.body.emitter.on("destroy",function(){void 0!==o.keycharm&&o.keycharm.destroy()}),this.options={}}return(0,a.default)(t,[{key:"setOptions",value:function(t){void 0!==t&&(this.options=t,this.create())}},{key:"create",value:function(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}},{key:"cleanNavigation",value:function(){if(0!=this.navigationHammers.length){for(var t=0;t<this.navigationHammers.length;t++)this.navigationHammers[t].destroy();this.navigationHammers=[]}this.navigationDOM&&this.navigationDOM.wrapper&&this.navigationDOM.wrapper.parentNode&&this.navigationDOM.wrapper.parentNode.removeChild(this.navigationDOM.wrapper),this.iconsCreated=!1}},{key:"loadNavigationElements",value:function(){var t=this;this.cleanNavigation(),this.navigationDOM={};var e=["up","down","left","right","zoomIn","zoomOut","zoomExtends"],i=["_moveUp","_moveDown","_moveLeft","_moveRight","_zoomIn","_zoomOut","_fit"];this.navigationDOM.wrapper=document.createElement("div"),this.navigationDOM.wrapper.className="vis-navigation",this.canvas.frame.appendChild(this.navigationDOM.wrapper);for(var o=0;o<e.length;o++){this.navigationDOM[e[o]]=document.createElement("div"),this.navigationDOM[e[o]].className="vis-button vis-"+e[o],this.navigationDOM.wrapper.appendChild(this.navigationDOM[e[o]]);var n=new h(this.navigationDOM[e[o]]);"_fit"===i[o]?d.onTouch(n,this._fit.bind(this)):d.onTouch(n,this.bindToRedraw.bind(this,i[o])),this.navigationHammers.push(n)}var s=new h(this.canvas.frame);d.onRelease(s,function(){t._stopMovement()}),this.navigationHammers.push(s),this.iconsCreated=!0}},{key:"bindToRedraw",value:function(t){void 0===this.boundFunctions[t]&&(this.boundFunctions[t]=this[t].bind(this),this.body.emitter.on("initRedraw",this.boundFunctions[t]),this.body.emitter.emit("_startRendering"))}},{key:"unbindFromRedraw",value:function(t){void 0!==this.boundFunctions[t]&&(this.body.emitter.off("initRedraw",this.boundFunctions[t]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[t])}},{key:"_fit",value:function(){(new Date).valueOf()-this.touchTime>700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=(new Date).valueOf())}},{key:"_stopMovement",value:function(){for(var t in this.boundFunctions)this.boundFunctions.hasOwnProperty(t)&&(this.body.emitter.off("initRedraw",this.boundFunctions[t]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var t=this.body.view.scale,e=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=e/t,n=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,s=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=e,this.body.view.translation={x:n,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:pointer})}},{key:"_zoomOut",value:function(){var t=this.body.view.scale,e=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=e/t,n=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,s=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=e,this.body.view.translation={x:n,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:pointer})}},{key:"configureKeyboardBindings",value:function(){
+var t=this;void 0!==this.keycharm&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=l({container:window,preventDefault:!0}):this.keycharm=l({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0&&(this.keycharm.bind("up",function(){t.bindToRedraw("_moveUp")},"keydown"),this.keycharm.bind("down",function(){t.bindToRedraw("_moveDown")},"keydown"),this.keycharm.bind("left",function(){t.bindToRedraw("_moveLeft")},"keydown"),this.keycharm.bind("right",function(){t.bindToRedraw("_moveRight")},"keydown"),this.keycharm.bind("=",function(){t.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("num+",function(){t.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("num-",function(){t.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("-",function(){t.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("[",function(){t.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("]",function(){t.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("pageup",function(){t.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("pagedown",function(){t.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("up",function(){t.unbindFromRedraw("_moveUp")},"keyup"),this.keycharm.bind("down",function(){t.unbindFromRedraw("_moveDown")},"keyup"),this.keycharm.bind("left",function(){t.unbindFromRedraw("_moveLeft")},"keyup"),this.keycharm.bind("right",function(){t.unbindFromRedraw("_moveRight")},"keyup"),this.keycharm.bind("=",function(){t.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("num+",function(){t.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("num-",function(){t.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("-",function(){t.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("[",function(){t.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("]",function(){t.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("pageup",function(){t.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("pagedown",function(){t.unbindFromRedraw("_zoomOut")},"keyup")))}}]),t}();e.default=u},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=i(159),d=o(h),l=i(192),u=o(l),c=i(1),p=function(){function t(e,i){var o=this;(0,s.default)(this,t),this.body=e,this.canvas=i,this.selectionObj={nodes:[],edges:[]},this.hoverObj={nodes:{},edges:{}},this.options={},this.defaultOptions={multiselect:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0},c.extend(this.options,this.defaultOptions),this.body.emitter.on("_dataChanged",function(){o.updateSelection()})}return(0,a.default)(t,[{key:"setOptions",value:function(t){if(void 0!==t){var e=["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"];c.selectiveDeepExtend(e,this.options,t)}}},{key:"selectOnPoint",value:function(t){var e=!1;if(this.options.selectable===!0){var i=this.getNodeAt(t)||this.getEdgeAt(t);this.unselectAll(),void 0!==i&&(e=this.selectObject(i)),this.body.emitter.emit("_requestRedraw")}return e}},{key:"selectAdditionalOnPoint",value:function(t){var e=!1;if(this.options.selectable===!0){var i=this.getNodeAt(t)||this.getEdgeAt(t);void 0!==i&&(e=!0,i.isSelected()===!0?this.deselectObject(i):this.selectObject(i),this.body.emitter.emit("_requestRedraw"))}return e}},{key:"_generateClickEvent",value:function(t,e,i,o){var n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=void 0;s=n===!0?{nodes:[],edges:[]}:this.getSelection(),s.pointer={DOM:{x:i.x,y:i.y},canvas:this.canvas.DOMtoCanvas(i)},s.event=e,void 0!==o&&(s.previousSelection=o),this.body.emitter.emit(t,s)}},{key:"selectObject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.selectConnectedEdges;return void 0!==t&&(t instanceof d.default&&e===!0&&this._selectConnectedEdges(t),t.select(),this._addToSelection(t),!0)}},{key:"deselectObject",value:function(t){t.isSelected()===!0&&(t.selected=!1,this._removeFromSelection(t))}},{key:"_getAllNodesOverlappingWith",value:function(t){for(var e=[],i=this.body.nodes,o=0;o<this.body.nodeIndices.length;o++){var n=this.body.nodeIndices[o];i[n].isOverlappingWith(t)&&e.push(n)}return e}},{key:"_pointerToPositionObject",value:function(t){var e=this.canvas.DOMtoCanvas(t);return{left:e.x-1,top:e.y+1,right:e.x+1,bottom:e.y-1}}},{key:"getNodeAt",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._pointerToPositionObject(t),o=this._getAllNodesOverlappingWith(i);return o.length>0?e===!0?this.body.nodes[o[o.length-1]]:o[o.length-1]:void 0}},{key:"_getEdgesOverlappingWith",value:function(t,e){for(var i=this.body.edges,o=0;o<this.body.edgeIndices.length;o++){var n=this.body.edgeIndices[o];i[n].isOverlappingWith(t)&&e.push(n)}}},{key:"_getAllEdgesOverlappingWith",value:function(t){var e=[];return this._getEdgesOverlappingWith(t,e),e}},{key:"getEdgeAt",value:function(t){for(var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.canvas.DOMtoCanvas(t),o=10,n=null,s=this.body.edges,r=0;r<this.body.edgeIndices.length;r++){var a=this.body.edgeIndices[r],h=s[a];if(h.connected){var d=h.from.x,l=h.from.y,u=h.to.x,c=h.to.y,p=h.edgeType.getDistanceToEdge(d,l,u,c,i.x,i.y);p<o&&(n=a,o=p)}}return n?e===!0?this.body.edges[n]:n:void 0}},{key:"_addToSelection",value:function(t){t instanceof d.default?this.selectionObj.nodes[t.id]=t:this.selectionObj.edges[t.id]=t}},{key:"_addToHover",value:function(t){t instanceof d.default?this.hoverObj.nodes[t.id]=t:this.hoverObj.edges[t.id]=t}},{key:"_removeFromSelection",value:function(t){t instanceof d.default?(delete this.selectionObj.nodes[t.id],this._unselectConnectedEdges(t)):delete this.selectionObj.edges[t.id]}},{key:"unselectAll",value:function(){for(var t in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(t)&&this.selectionObj.nodes[t].unselect();for(var e in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(e)&&this.selectionObj.edges[e].unselect();this.selectionObj={nodes:{},edges:{}}}},{key:"_getSelectedNodeCount",value:function(){var t=0;for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(t+=1);return t}},{key:"_getSelectedNode",value:function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t))return this.selectionObj.nodes[t]}},{key:"_getSelectedEdge",value:function(){for(var t in this.selectionObj.edges)if(this.selectionObj.edges.hasOwnProperty(t))return this.selectionObj.edges[t]}},{key:"_getSelectedEdgeCount",value:function(){var t=0;for(var e in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(e)&&(t+=1);return t}},{key:"_getSelectedObjectCount",value:function(){var t=0;for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(t+=1);for(var i in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(i)&&(t+=1);return t}},{key:"_selectionIsEmpty",value:function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t))return!1;for(var e in this.selectionObj.edges)if(this.selectionObj.edges.hasOwnProperty(e))return!1;return!0}},{key:"_clusterInSelection",value:function(){for(var t in this.selectionObj.nodes)if(this.selectionObj.nodes.hasOwnProperty(t)&&this.selectionObj.nodes[t].clusterSize>1)return!0;return!1}},{key:"_selectConnectedEdges",value:function(t){for(var e=0;e<t.edges.length;e++){var i=t.edges[e];i.select(),this._addToSelection(i)}}},{key:"_hoverConnectedEdges",value:function(t){for(var e=0;e<t.edges.length;e++){var i=t.edges[e];i.hover=!0,this._addToHover(i)}}},{key:"_unselectConnectedEdges",value:function(t){for(var e=0;e<t.edges.length;e++){var i=t.edges[e];i.unselect(),this._removeFromSelection(i)}}},{key:"blurObject",value:function(t){t.hover===!0&&(t.hover=!1,t instanceof d.default?this.body.emitter.emit("blurNode",{node:t.id}):this.body.emitter.emit("blurEdge",{edge:t.id}))}},{key:"hoverObject",value:function(t){var e=!1;for(var i in this.hoverObj.nodes)this.hoverObj.nodes.hasOwnProperty(i)&&(void 0===t||t instanceof d.default&&t.id!=i||t instanceof u.default)&&(this.blurObject(this.hoverObj.nodes[i]),delete this.hoverObj.nodes[i],e=!0);for(var o in this.hoverObj.edges)this.hoverObj.edges.hasOwnProperty(o)&&(e===!0?(this.hoverObj.edges[o].hover=!1,delete this.hoverObj.edges[o]):(void 0===t||t instanceof u.default&&t.id!=o||t instanceof d.default&&!t.hover)&&(this.blurObject(this.hoverObj.edges[o]),delete this.hoverObj.edges[o],e=!0));void 0!==t&&(t.hover===!1&&(t.hover=!0,this._addToHover(t),e=!0,t instanceof d.default?this.body.emitter.emit("hoverNode",{node:t.id}):this.body.emitter.emit("hoverEdge",{edge:t.id})),t instanceof d.default&&this.options.hoverConnectedEdges===!0&&this._hoverConnectedEdges(t)),e===!0&&this.body.emitter.emit("_requestRedraw")}},{key:"getSelection",value:function(){var t=this.getSelectedNodes(),e=this.getSelectedEdges();return{nodes:t,edges:e}}},{key:"getSelectedNodes",value:function(){var t=[];if(this.options.selectable===!0)for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&t.push(this.selectionObj.nodes[e].id);return t}},{key:"getSelectedEdges",value:function(){var t=[];if(this.options.selectable===!0)for(var e in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(e)&&t.push(this.selectionObj.edges[e].id);return t}},{key:"setSelection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=void 0,o=void 0;if(!t||!t.nodes&&!t.edges)throw"Selection must be an object with nodes and/or edges properties";if((e.unselectAll||void 0===e.unselectAll)&&this.unselectAll(),t.nodes)for(i=0;i<t.nodes.length;i++){o=t.nodes[i];var n=this.body.nodes[o];if(!n)throw new RangeError('Node with id "'+o+'" not found');this.selectObject(n,e.highlightEdges)}if(t.edges)for(i=0;i<t.edges.length;i++){o=t.edges[i];var s=this.body.edges[o];if(!s)throw new RangeError('Edge with id "'+o+'" not found');this.selectObject(s)}this.body.emitter.emit("_requestRedraw")}},{key:"selectNodes",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!t||void 0===t.length)throw"Selection must be an array with ids";this.setSelection({nodes:t},{highlightEdges:e})}},{key:"selectEdges",value:function(t){if(!t||void 0===t.length)throw"Selection must be an array with ids";this.setSelection({edges:t})}},{key:"updateSelection",value:function(){for(var t in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(t)&&(this.body.nodes.hasOwnProperty(t)||delete this.selectionObj.nodes[t]);for(var e in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(e)&&(this.body.edges.hasOwnProperty(e)||delete this.selectionObj.edges[e])}}]),t}();e.default=p},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(58),s=o(n),r=i(161),a=o(r),h=i(62),d=o(h),l=i(115),u=o(l),c=i(116),p=o(c),f=i(210),m=o(f),v=i(1),g=function(){function t(e){(0,u.default)(this,t),this.body=e,this.initialRandomSeed=Math.round(1e6*Math.random()),this.randomSeed=this.initialRandomSeed,this.setPhysics=!1,this.options={},this.optionsBackup={physics:{}},this.defaultOptions={randomSeed:void 0,improvedLayout:!0,hierarchical:{enabled:!1,levelSeparation:150,nodeSpacing:100,treeSpacing:200,blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:"UD",sortMethod:"hubsize"}},v.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,p.default)(t,[{key:"bindEventListeners",value:function(){var t=this;this.body.emitter.on("_dataChanged",function(){t.setupHierarchicalLayout()}),this.body.emitter.on("_dataLoaded",function(){t.layoutNetwork()}),this.body.emitter.on("_resetHierarchicalLayout",function(){t.setupHierarchicalLayout()})}},{key:"setOptions",value:function(t,e){if(void 0!==t){var i=this.options.hierarchical.enabled;if(v.selectiveDeepExtend(["randomSeed","improvedLayout"],this.options,t),v.mergeOptions(this.options,t,"hierarchical"),void 0!==t.randomSeed&&(this.initialRandomSeed=t.randomSeed),this.options.hierarchical.enabled===!0)return i===!0&&this.body.emitter.emit("refresh",!0),"RL"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction?this.options.hierarchical.levelSeparation>0&&(this.options.hierarchical.levelSeparation*=-1):this.options.hierarchical.levelSeparation<0&&(this.options.hierarchical.levelSeparation*=-1),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(e);if(i===!0)return this.body.emitter.emit("refresh"),v.deepExtend(e,this.optionsBackup)}return e}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(t){if(this.options.hierarchical.enabled===!0){void 0===t.physics||t.physics===!0?(t.physics={enabled:void 0===this.optionsBackup.physics.enabled||this.optionsBackup.physics.enabled,solver:"hierarchicalRepulsion"},this.optionsBackup.physics.enabled=void 0===this.optionsBackup.physics.enabled||this.optionsBackup.physics.enabled,this.optionsBackup.physics.solver=this.optionsBackup.physics.solver||"barnesHut"):"object"===(0,d.default)(t.physics)?(this.optionsBackup.physics.enabled=void 0===t.physics.enabled||t.physics.enabled,this.optionsBackup.physics.solver=t.physics.solver||"barnesHut",t.physics.solver="hierarchicalRepulsion"):t.physics!==!1&&(this.optionsBackup.physics.solver="barnesHut",t.physics={solver:"hierarchicalRepulsion"});var e="horizontal";"RL"!==this.options.hierarchical.direction&&"LR"!==this.options.hierarchical.direction||(e="vertical"),void 0===t.edges?(this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},t.edges={smooth:!1}):void 0===t.edges.smooth?(this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},t.edges.smooth=!1):"boolean"==typeof t.edges.smooth?(this.optionsBackup.edges={smooth:t.edges.smooth},t.edges.smooth={enabled:t.edges.smooth,type:e}):(void 0!==t.edges.smooth.type&&"dynamic"!==t.edges.smooth.type&&(e=t.edges.smooth.type),this.optionsBackup.edges={smooth:void 0===t.edges.smooth.enabled||t.edges.smooth.enabled,type:void 0===t.edges.smooth.type?"dynamic":t.edges.smooth.type,roundness:void 0===t.edges.smooth.roundness?.5:t.edges.smooth.roundness,forceDirection:void 0!==t.edges.smooth.forceDirection&&t.edges.smooth.forceDirection},t.edges.smooth={enabled:void 0===t.edges.smooth.enabled||t.edges.smooth.enabled,type:e,roundness:void 0===t.edges.smooth.roundness?.5:t.edges.smooth.roundness,forceDirection:void 0!==t.edges.smooth.forceDirection&&t.edges.smooth.forceDirection}),this.body.emitter.emit("_forceDisableDynamicCurves",e)}return t}},{key:"seededRandom",value:function(){var t=1e4*Math.sin(this.randomSeed++);return t-Math.floor(t)}},{key:"positionInitially",value:function(t){if(this.options.hierarchical.enabled!==!0){this.randomSeed=this.initialRandomSeed;for(var e=0;e<t.length;e++){var i=t[e],o=1*t.length+10,n=2*Math.PI*this.seededRandom();void 0===i.x&&(i.x=o*Math.cos(n)),void 0===i.y&&(i.y=o*Math.sin(n))}}}},{key:"layoutNetwork",value:function(){if(this.options.hierarchical.enabled!==!0&&this.options.improvedLayout===!0){for(var t=0,e=0;e<this.body.nodeIndices.length;e++){var i=this.body.nodes[this.body.nodeIndices[e]];i.predefinedPosition===!0&&(t+=1)}if(t<.5*this.body.nodeIndices.length){var o=10,n=0,s=100;if(this.body.nodeIndices.length>s){for(var r=this.body.nodeIndices.length;this.body.nodeIndices.length>s;){n+=1;var a=this.body.nodeIndices.length;n%3===0?this.body.modules.clustering.clusterBridges():this.body.modules.clustering.clusterOutliers();var h=this.body.nodeIndices.length;if(a==h&&n%3!==0||n>o)return this._declusterAll(),this.body.emitter.emit("_layoutFailed"),void console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.")}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*r)})}this.body.modules.kamadaKawai.solve(this.body.nodeIndices,this.body.edgeIndices,!0),this._shiftToCenter();for(var d=70,l=0;l<this.body.nodeIndices.length;l++)this.body.nodes[this.body.nodeIndices[l]].predefinedPosition===!1&&(this.body.nodes[this.body.nodeIndices[l]].x+=(.5-this.seededRandom())*d,this.body.nodes[this.body.nodeIndices[l]].y+=(.5-this.seededRandom())*d);this._declusterAll(),this.body.emitter.emit("_repositionBezierNodes")}}}},{key:"_shiftToCenter",value:function(){for(var t=m.default.getRangeCore(this.body.nodes,this.body.nodeIndices),e=m.default.findCenter(t),i=0;i<this.body.nodeIndices.length;i++)this.body.nodes[this.body.nodeIndices[i]].x-=e.x,this.body.nodes[this.body.nodeIndices[i]].y-=e.y}},{key:"_declusterAll",value:function(){for(var t=!0;t===!0;){t=!1;for(var e=0;e<this.body.nodeIndices.length;e++)this.body.nodes[this.body.nodeIndices[e]].isCluster===!0&&(t=!0,this.body.modules.clustering.openCluster(this.body.nodeIndices[e],{},!1));t===!0&&this.body.emitter.emit("_dataChanged")}}},{key:"getSeed",value:function(){return this.initialRandomSeed}},{key:"setupHierarchicalLayout",value:function(){if(this.options.hierarchical.enabled===!0&&this.body.nodeIndices.length>0){var t=void 0,e=void 0,i=!1,o=!0,n=!1;this.hierarchicalLevels={},this.lastNodeOnLevel={},this.hierarchicalChildrenReference={},this.hierarchicalParentReference={},this.hierarchicalTrees={},this.treeIndex=-1,this.distributionOrdering={},this.distributionIndex={},this.distributionOrderingPresence={};for(e in this.body.nodes)this.body.nodes.hasOwnProperty(e)&&(t=this.body.nodes[e],void 0===t.options.x&&void 0===t.options.y&&(o=!1),void 0!==t.options.level?(i=!0,this.hierarchicalLevels[e]=t.options.level):n=!0);if(n===!0&&i===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");n===!0&&("hubsize"===this.options.hierarchical.sortMethod?this._determineLevelsByHubsize():"directed"===this.options.hierarchical.sortMethod?this._determineLevelsDirected():"custom"===this.options.hierarchical.sortMethod&&this._determineLevelsCustomCallback());for(var s in this.body.nodes)this.body.nodes.hasOwnProperty(s)&&void 0===this.hierarchicalLevels[s]&&(this.hierarchicalLevels[s]=0);var r=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(r),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var t=this,e=!1,i={},o=function(){for(var e=h(),i=0;i<e.length-1;i++){var o=e[i].max-e[i+1].min;n(i+1,o+t.options.hierarchical.treeSpacing)}},n=function(e,i){for(var o in t.hierarchicalTrees)if(t.hierarchicalTrees.hasOwnProperty(o)&&t.hierarchicalTrees[o]===e){var n=t.body.nodes[o],s=t._getPositionForHierarchy(n);t._setPositionForHierarchy(n,s+i,void 0,!0)}},r=function(e){var i=1e9,o=-1e9;for(var n in t.hierarchicalTrees)if(t.hierarchicalTrees.hasOwnProperty(n)&&t.hierarchicalTrees[n]===e){var s=t._getPositionForHierarchy(t.body.nodes[n]);i=Math.min(s,i),o=Math.max(s,o)}return{min:i,max:o}},h=function(){for(var e=[],i=0;i<=t.treeIndex;i++)e.push(r(i));return e},d=function e(i,o){if(o[i.id]=!0,t.hierarchicalChildrenReference[i.id]){var n=t.hierarchicalChildrenReference[i.id];if(n.length>0)for(var s=0;s<n.length;s++)e(t.body.nodes[n[s]],o)}},l=function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e9,o=1e9,n=1e9,s=1e9,r=-1e9;for(var h in e)if(e.hasOwnProperty(h)){var d=t.body.nodes[h],l=t.hierarchicalLevels[d.id],u=t._getPositionForHierarchy(d),c=t._getSpaceAroundNode(d,e),p=(0,a.default)(c,2),f=p[0],m=p[1];o=Math.min(f,o),n=Math.min(m,n),l<=i&&(s=Math.min(u,s),r=Math.max(u,r))}return[s,r,o,n]},u=function e(i){var o=t.hierarchicalLevels[i];if(t.hierarchicalChildrenReference[i]){var n=t.hierarchicalChildrenReference[i];if(n.length>0)for(var s=0;s<n.length;s++)o=Math.max(o,e(n[s]))}return o},c=function(t,e){var i=u(t.id),o=u(e.id);return Math.min(i,o)},p=function(e,i){var o=t.hierarchicalParentReference[e.id],n=t.hierarchicalParentReference[i.id];if(void 0===o||void 0===n)return!1;for(var s=0;s<o.length;s++)for(var r=0;r<n.length;r++)if(o[s]==n[r])return!0;return!1},f=function(e,i,o){for(var n=0;n<i.length;n++){var s=i[n],r=t.distributionOrdering[s];if(r.length>1)for(var a=0;a<r.length-1;a++)p(r[a],r[a+1])===!0&&t.hierarchicalTrees[r[a].id]===t.hierarchicalTrees[r[a+1].id]&&e(r[a],r[a+1],o)}},m=function(i,o){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=t._getPositionForHierarchy(i),r=t._getPositionForHierarchy(o),h=Math.abs(r-s);if(h>t.options.hierarchical.nodeSpacing){var u={};u[i.id]=!0;var p={};p[o.id]=!0,d(i,u),d(o,p);var f=c(i,o),m=l(u,f),v=(0,a.default)(m,4),g=(v[0],v[1]),y=(v[2],v[3],l(p,f)),b=(0,a.default)(y,4),_=b[0],w=(b[1],b[2]),x=(b[3],Math.abs(g-_));if(x>t.options.hierarchical.nodeSpacing){var k=g-_+t.options.hierarchical.nodeSpacing;k<-w+t.options.hierarchical.nodeSpacing&&(k=-w+t.options.hierarchical.nodeSpacing),k<0&&(t._shiftBlock(o.id,k),e=!0,n===!0&&t._centerParent(o))}}},v=function(o,n){for(var s=n.id,r=n.edges,h=t.hierarchicalLevels[n.id],u=t.options.hierarchical.levelSeparation*t.options.hierarchical.levelSeparation,c={},p=[],f=0;f<r.length;f++){var m=r[f];if(m.toId!=m.fromId){var v=m.toId==s?m.from:m.to;c[r[f].id]=v,t.hierarchicalLevels[v.id]<h&&p.push(m)}}var g=function(e,i){for(var o=0,n=0;n<i.length;n++)if(void 0!==c[i[n].id]){var s=t._getPositionForHierarchy(c[i[n].id])-e;o+=s/Math.sqrt(s*s+u)}return o},y=function(e,i){for(var o=0,n=0;n<i.length;n++)if(void 0!==c[i[n].id]){var s=t._getPositionForHierarchy(c[i[n].id])-e;o-=u*Math.pow(s*s+u,-1.5)}return o},b=function(e,i){for(var o=t._getPositionForHierarchy(n),s={},r=0;r<e;r++){var a=g(o,i),h=y(o,i),d=40,l=Math.max(-d,Math.min(d,Math.round(a/h)));if(o-=l,void 0!==s[o])break;s[o]=r}return o},_=function(o){var s=t._getPositionForHierarchy(n);if(void 0===i[n.id]){var r={};r[n.id]=!0,d(n,r),i[n.id]=r}var h=l(i[n.id]),u=(0,a.default)(h,4),c=(u[0],u[1],u[2]),p=u[3],f=o-s,m=0;f>0?m=Math.min(f,p-t.options.hierarchical.nodeSpacing):f<0&&(m=-Math.min(-f,c-t.options.hierarchical.nodeSpacing)),0!=m&&(t._shiftBlock(n.id,m),e=!0)},w=function(i){var o=t._getPositionForHierarchy(n),s=t._getSpaceAroundNode(n),r=(0,a.default)(s,2),h=r[0],d=r[1],l=i-o,u=o;l>0?u=Math.min(o+(d-t.options.hierarchical.nodeSpacing),i):l<0&&(u=Math.max(o-(h-t.options.hierarchical.nodeSpacing),i)),u!==o&&(t._setPositionForHierarchy(n,u,void 0,!0),e=!0)},x=b(o,p);_(x),x=b(o,r),w(x)},g=function(i){var o=(0,s.default)(t.distributionOrdering);o=o.reverse();for(var n=0;n<i;n++){e=!1;for(var r=0;r<o.length;r++)for(var a=o[r],h=t.distributionOrdering[a],d=0;d<h.length;d++)v(1e3,h[d]);if(e!==!0)break}},y=function(i){var o=(0,s.default)(t.distributionOrdering);o=o.reverse();for(var n=0;n<i&&(e=!1,f(m,o,!0),e===!0);n++);},b=function(){for(var e in t.body.nodes)t.body.nodes.hasOwnProperty(e)&&t._centerParent(t.body.nodes[e])},_=function(){var e=(0,s.default)(t.distributionOrdering);e=e.reverse();for(var i=0;i<e.length;i++)for(var o=e[i],n=t.distributionOrdering[o],r=0;r<n.length;r++)t._centerParent(n[r])};this.options.hierarchical.blockShifting===!0&&(y(5),b()),this.options.hierarchical.edgeMinimization===!0&&g(20),this.options.hierarchical.parentCentralization===!0&&_(),o()}},{key:"_getSpaceAroundNode",value:function(t,e){var i=!0;void 0===e&&(i=!1);var o=this.hierarchicalLevels[t.id];if(void 0!==o){var n=this.distributionIndex[t.id],s=this._getPositionForHierarchy(t),r=1e9,a=1e9;if(0!==n){var h=this.distributionOrdering[o][n-1];if(i===!0&&void 0===e[h.id]||i===!1){var d=this._getPositionForHierarchy(h);r=s-d}}if(n!=this.distributionOrdering[o].length-1){var l=this.distributionOrdering[o][n+1];if(i===!0&&void 0===e[l.id]||i===!1){var u=this._getPositionForHierarchy(l);a=Math.min(a,u-s)}}return[r,a]}return[0,0]}},{key:"_centerParent",value:function(t){if(this.hierarchicalParentReference[t.id])for(var e=this.hierarchicalParentReference[t.id],i=0;i<e.length;i++){var o=e[i],n=this.body.nodes[o];if(this.hierarchicalChildrenReference[o]){var s=1e9,r=-1e9,h=this.hierarchicalChildrenReference[o];if(h.length>0)for(var d=0;d<h.length;d++){var l=this.body.nodes[h[d]];s=Math.min(s,this._getPositionForHierarchy(l)),r=Math.max(r,this._getPositionForHierarchy(l))}var u=this._getPositionForHierarchy(n),c=this._getSpaceAroundNode(n),p=(0,a.default)(c,2),f=p[0],m=p[1],v=.5*(s+r),g=u-v;(g<0&&Math.abs(g)<m-this.options.hierarchical.nodeSpacing||g>0&&Math.abs(g)<f-this.options.hierarchical.nodeSpacing)&&this._setPositionForHierarchy(n,v,void 0,!0)}}}},{key:"_placeNodesByHierarchy",value:function(t){this.positionedNodes={};for(var e in t)if(t.hasOwnProperty(e)){var i=(0,s.default)(t[e]);i=this._indexArrayToNodes(i),this._sortNodeArray(i);for(var o=0,n=0;n<i.length;n++){var r=i[n];if(void 0===this.positionedNodes[r.id]){var a=this.options.hierarchical.nodeSpacing*o;o>0&&(a=this._getPositionForHierarchy(i[n-1])+this.options.hierarchical.nodeSpacing),this._setPositionForHierarchy(r,a,e),this._validataPositionAndContinue(r,e,a),o++}}}}},{key:"_placeBranchNodes",value:function(t,e){if(void 0!==this.hierarchicalChildrenReference[t]){for(var i=[],o=0;o<this.hierarchicalChildrenReference[t].length;o++)i.push(this.body.nodes[this.hierarchicalChildrenReference[t][o]]);this._sortNodeArray(i);for(var n=0;n<i.length;n++){var s=i[n],r=this.hierarchicalLevels[s.id];if(!(r>e&&void 0===this.positionedNodes[s.id]))return;var a=void 0;a=0===n?this._getPositionForHierarchy(this.body.nodes[t]):this._getPositionForHierarchy(i[n-1])+this.options.hierarchical.nodeSpacing,this._setPositionForHierarchy(s,a,r),this._validataPositionAndContinue(s,r,a)}for(var h=1e9,d=-1e9,l=0;l<i.length;l++){var u=i[l].id;h=Math.min(h,this._getPositionForHierarchy(this.body.nodes[u])),d=Math.max(d,this._getPositionForHierarchy(this.body.nodes[u]))}this._setPositionForHierarchy(this.body.nodes[t],.5*(h+d),e)}}},{key:"_validataPositionAndContinue",value:function(t,e,i){if(void 0!==this.lastNodeOnLevel[e]){var o=this._getPositionForHierarchy(this.body.nodes[this.lastNodeOnLevel[e]]);if(i-o<this.options.hierarchical.nodeSpacing){var n=o+this.options.hierarchical.nodeSpacing-i,s=this._findCommonParent(this.lastNodeOnLevel[e],t.id);this._shiftBlock(s.withChild,n)}}this.lastNodeOnLevel[e]=t.id,this.positionedNodes[t.id]=!0,this._placeBranchNodes(t.id,e)}},{key:"_indexArrayToNodes",value:function(t){for(var e=[],i=0;i<t.length;i++)e.push(this.body.nodes[t[i]]);return e}},{key:"_getDistribution",value:function(){var t={},e=void 0,i=void 0;for(e in this.body.nodes)if(this.body.nodes.hasOwnProperty(e)){i=this.body.nodes[e];var o=void 0===this.hierarchicalLevels[e]?0:this.hierarchicalLevels[e];"UD"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction?(i.y=this.options.hierarchical.levelSeparation*o,i.options.fixed.y=!0):(i.x=this.options.hierarchical.levelSeparation*o,i.options.fixed.x=!0),void 0===t[o]&&(t[o]={}),t[o][e]=i}return t}},{key:"_getHubSize",value:function(){var t=0;for(var e in this.body.nodes)if(this.body.nodes.hasOwnProperty(e)){var i=this.body.nodes[e];void 0===this.hierarchicalLevels[e]&&(t=i.edges.length<t?t:i.edges.length)}return t}},{key:"_determineLevelsByHubsize",value:function(){for(var t=this,e=1,i=function(e,i){void 0===t.hierarchicalLevels[i.id]&&(void 0===t.hierarchicalLevels[e.id]&&(t.hierarchicalLevels[e.id]=0),t.hierarchicalLevels[i.id]=t.hierarchicalLevels[e.id]+1)};e>0&&(e=this._getHubSize(),0!==e);)for(var o in this.body.nodes)if(this.body.nodes.hasOwnProperty(o)){var n=this.body.nodes[o];n.edges.length===e&&this._crawlNetwork(i,o)}}},{key:"_determineLevelsCustomCallback",value:function(){var t=this,e=1e5,i=function(t,e,i){},o=function(o,n,s){var r=t.hierarchicalLevels[o.id];void 0===r&&(t.hierarchicalLevels[o.id]=e);var a=i(m.default.cloneOptions(o,"node"),m.default.cloneOptions(n,"node"),m.default.cloneOptions(s,"edge"));t.hierarchicalLevels[n.id]=t.hierarchicalLevels[o.id]+a};this._crawlNetwork(o),this._setMinLevelToZero()}},{key:"_determineLevelsDirected",value:function(){var t=this,e=1e4,i=function(i,o,n){var s=t.hierarchicalLevels[i.id];void 0===s&&(t.hierarchicalLevels[i.id]=e),n.toId==o.id?t.hierarchicalLevels[o.id]=t.hierarchicalLevels[i.id]+1:t.hierarchicalLevels[o.id]=t.hierarchicalLevels[i.id]-1};this._crawlNetwork(i),this._setMinLevelToZero()}},{key:"_setMinLevelToZero",value:function(){var t=1e9;for(var e in this.body.nodes)this.body.nodes.hasOwnProperty(e)&&void 0!==this.hierarchicalLevels[e]&&(t=Math.min(this.hierarchicalLevels[e],t));for(var i in this.body.nodes)this.body.nodes.hasOwnProperty(i)&&void 0!==this.hierarchicalLevels[i]&&(this.hierarchicalLevels[i]-=t)}},{key:"_generateMap",value:function(){var t=this,e=function(e,i){if(t.hierarchicalLevels[i.id]>t.hierarchicalLevels[e.id]){var o=e.id,n=i.id;void 0===t.hierarchicalChildrenReference[o]&&(t.hierarchicalChildrenReference[o]=[]),t.hierarchicalChildrenReference[o].push(n),void 0===t.hierarchicalParentReference[n]&&(t.hierarchicalParentReference[n]=[]),t.hierarchicalParentReference[n].push(o)}};this._crawlNetwork(e)}},{key:"_crawlNetwork",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},i=arguments[1],o={},n=0,s=function i(n,s){if(void 0===o[n.id]){void 0===t.hierarchicalTrees[n.id]&&(t.hierarchicalTrees[n.id]=s,t.treeIndex=Math.max(s,t.treeIndex)),o[n.id]=!0;for(var r=void 0,a=0;a<n.edges.length;a++)n.edges[a].connected===!0&&(r=n.edges[a].toId===n.id?n.edges[a].from:n.edges[a].to,n.id!==r.id&&(e(n,r,n.edges[a]),i(r,s)))}};if(void 0===i)for(var r=0;r<this.body.nodeIndices.length;r++){var a=this.body.nodes[this.body.nodeIndices[r]];void 0===o[a.id]&&(s(a,n),n+=1)}else{var h=this.body.nodes[i];if(void 0===h)return void console.error("Node not found:",i);s(h)}}},{key:"_shiftBlock",value:function(t,e){if("UD"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction?this.body.nodes[t].x+=e:this.body.nodes[t].y+=e,void 0!==this.hierarchicalChildrenReference[t])for(var i=0;i<this.hierarchicalChildrenReference[t].length;i++)this._shiftBlock(this.hierarchicalChildrenReference[t][i],e)}},{key:"_findCommonParent",value:function(t,e){var i=this,o={},n=function t(e,o){if(void 0!==i.hierarchicalParentReference[o])for(var n=0;n<i.hierarchicalParentReference[o].length;n++){var s=i.hierarchicalParentReference[o][n];e[s]=!0,t(e,s)}},s=function t(e,o){if(void 0!==i.hierarchicalParentReference[o])for(var n=0;n<i.hierarchicalParentReference[o].length;n++){var s=i.hierarchicalParentReference[o][n];if(void 0!==e[s])return{foundParent:s,withChild:o};var r=t(e,s);if(null!==r.foundParent)return r}return{foundParent:null,withChild:o}};return n(o,t),s(o,e)}},{key:"_setPositionForHierarchy",value:function(t,e,i){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];o!==!0&&(void 0===this.distributionOrdering[i]&&(this.distributionOrdering[i]=[],this.distributionOrderingPresence[i]={}),void 0===this.distributionOrderingPresence[i][t.id]&&(this.distributionOrdering[i].push(t),this.distributionIndex[t.id]=this.distributionOrdering[i].length-1),this.distributionOrderingPresence[i][t.id]=!0),"UD"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction?t.x=e:t.y=e}},{key:"_getPositionForHierarchy",value:function(t){return"UD"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction?t.x:t.y}},{key:"_sortNodeArray",value:function(t){t.length>1&&("UD"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction?t.sort(function(t,e){return t.x-e.x}):t.sort(function(t,e){return t.y-e.y}))}}]),t}();e.default=g},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(58),s=o(n),r=i(82),a=o(r),h=i(62),d=o(h),l=i(115),u=o(l),c=i(116),p=o(c),f=i(1),m=i(108),v=i(121),g=function(){function t(e,i,o){var n=this;(0,u.default)(this,t),this.body=e,this.canvas=i,this.selectionHandler=o,this.editMode=!1,this.manipulationDiv=void 0,
+this.editModeDiv=void 0,this.closeDiv=void 0,this.manipulationHammers=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:"dot",size:6,color:{background:"#ff0000",border:"#3c3c3c",highlight:{background:"#07f968",border:"#3c3c3c"}},borderWidth:2,borderWidthSelected:2}},f.extend(this.options,this.defaultOptions),this.body.emitter.on("destroy",function(){n._clean()}),this.body.emitter.on("_dataChanged",this._restore.bind(this)),this.body.emitter.on("_resetData",this._restore.bind(this))}return(0,p.default)(t,[{key:"_restore",value:function(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}},{key:"setOptions",value:function(t,e,i){void 0!==e&&(void 0!==e.locale?this.options.locale=e.locale:this.options.locale=i.locale,void 0!==e.locales?this.options.locales=e.locales:this.options.locales=i.locales),void 0!==t&&("boolean"==typeof t?this.options.enabled=t:(this.options.enabled=!0,f.deepExtend(this.options,t)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}},{key:"toggleEditMode",value:function(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}},{key:"enableEditMode",value:function(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}},{key:"disableEditMode",value:function(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}},{key:"showManipulatorToolbar",value:function(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";var t=this.selectionHandler._getSelectedNodeCount(),e=this.selectionHandler._getSelectedEdgeCount(),i=t+e,o=this.options.locales[this.options.locale],n=!1;this.options.addNode!==!1&&(this._createAddNodeButton(o),n=!0),this.options.addEdge!==!1&&(n===!0?this._createSeperator(1):n=!0,this._createAddEdgeButton(o)),1===t&&"function"==typeof this.options.editNode?(n===!0?this._createSeperator(2):n=!0,this._createEditNodeButton(o)):1===e&&0===t&&this.options.editEdge!==!1&&(n===!0?this._createSeperator(3):n=!0,this._createEditEdgeButton(o)),0!==i&&(t>0&&this.options.deleteNode!==!1?(n===!0&&this._createSeperator(4),this._createDeleteButton(o)):0===t&&this.options.deleteEdge!==!1&&(n===!0&&this._createSeperator(4),this._createDeleteButton(o))),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this)),this._temporaryBindEvent("select",this.showManipulatorToolbar.bind(this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(t),this._createSeperator(),this._createDescription(t.addDescription||this.options.locales.en.addDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this._temporaryBindEvent("click",this._performAddNode.bind(this))}},{key:"editNode",value:function(){var t=this;this.editMode!==!0&&this.enableEditMode(),this._clean();var e=this.selectionHandler._getSelectedNode();if(void 0!==e){if(this.inMode="editNode","function"!=typeof this.options.editNode)throw new Error("No function has been configured to handle the editing of nodes.");if(e.isCluster!==!0){var i=f.deepExtend({},e.options,!1);if(i.x=e.x,i.y=e.y,2!==this.options.editNode.length)throw new Error("The function for edit does not support two arguments (data, callback)");this.options.editNode(i,function(e){null!==e&&void 0!==e&&"editNode"===t.inMode&&t.body.data.nodes.getDataSet().update(e),t.showManipulatorToolbar()})}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError)}else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var t=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(t),this._createSeperator(),this._createDescription(t.edgeDescription||this.options.locales.en.edgeDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this._temporaryBindUI("onTouch",this._handleConnect.bind(this)),this._temporaryBindUI("onDragEnd",this._finishConnect.bind(this)),this._temporaryBindUI("onDrag",this._dragControlNode.bind(this)),this._temporaryBindUI("onRelease",this._finishConnect.bind(this)),this._temporaryBindUI("onDragStart",function(){}),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){var t=this;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge","object"===(0,d.default)(this.options.editEdge)&&"function"==typeof this.options.editEdge.editWithoutDrag&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdges()[0],void 0!==this.edgeBeingEditedId)){var e=this.body.edges[this.edgeBeingEditedId];return void this._performEditEdge(e.from,e.to)}if(this.guiEnabled===!0){var i=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(i),this._createSeperator(),this._createDescription(i.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this.edgeBeingEditedId=this.selectionHandler.getSelectedEdges()[0],void 0!==this.edgeBeingEditedId?!function(){var e=t.body.edges[t.edgeBeingEditedId],i=t._getNewTargetNode(e.from.x,e.from.y),o=t._getNewTargetNode(e.to.x,e.to.y);t.temporaryIds.nodes.push(i.id),t.temporaryIds.nodes.push(o.id),t.body.nodes[i.id]=i,t.body.nodeIndices.push(i.id),t.body.nodes[o.id]=o,t.body.nodeIndices.push(o.id),t._temporaryBindUI("onTouch",t._controlNodeTouch.bind(t)),t._temporaryBindUI("onTap",function(){}),t._temporaryBindUI("onHold",function(){}),t._temporaryBindUI("onDragStart",t._controlNodeDragStart.bind(t)),t._temporaryBindUI("onDrag",t._controlNodeDrag.bind(t)),t._temporaryBindUI("onDragEnd",t._controlNodeDragEnd.bind(t)),t._temporaryBindUI("onMouseMove",function(){}),t._temporaryBindEvent("beforeDrawing",function(t){var n=e.edgeType.findBorderPositions(t);i.selected===!1&&(i.x=n.from.x,i.y=n.from.y),o.selected===!1&&(o.x=n.to.x,o.y=n.to.y)}),t.body.emitter.emit("_redraw")}():this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var t=this;this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";var e=this.selectionHandler.getSelectedNodes(),i=this.selectionHandler.getSelectedEdges(),o=void 0;if(e.length>0){for(var n=0;n<e.length;n++)if(this.body.nodes[e[n]].isCluster===!0)return void alert(this.options.locales[this.options.locale].deleteClusterError||this.options.locales.en.deleteClusterError);"function"==typeof this.options.deleteNode&&(o=this.options.deleteNode)}else i.length>0&&"function"==typeof this.options.deleteEdge&&(o=this.options.deleteEdge);if("function"==typeof o){var s={nodes:e,edges:i};if(2!==o.length)throw new Error("The function for delete does not support two arguments (data, callback)");o(s,function(e){null!==e&&void 0!==e&&"delete"===t.inMode?(t.body.data.edges.getDataSet().remove(e.edges),t.body.data.nodes.getDataSet().remove(e.nodes),t.body.emitter.emit("startSimulation"),t.showManipulatorToolbar()):(t.body.emitter.emit("startSimulation"),t.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().remove(i),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){void 0===this.manipulationDiv&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),void 0===this.editModeDiv&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),void 0===this.closeDiv&&(this.closeDiv=document.createElement("div"),this.closeDiv.className="vis-close",this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}},{key:"_getNewTargetNode",value:function(t,e){var i=f.deepExtend({},this.options.controlNodeStyle);i.id="targetNode"+f.randomUUID(),i.hidden=!1,i.physics=!1,i.x=t,i.y=e;var o=this.body.functions.createNode(i);return o.shape.boundingBox={left:t,right:t,top:e,bottom:e},o}},{key:"_createEditButton",value:function(){this._clean(),this.manipulationDOM={},f.recursiveDOMDelete(this.editModeDiv);var t=this.options.locales[this.options.locale],e=this._createButton("editMode","vis-button vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(e),this._bindHammerToDiv(e,this.toggleEditMode.bind(this))}},{key:"_clean",value:function(){this.inMode=!1,this.guiEnabled===!0&&(f.recursiveDOMDelete(this.editModeDiv),f.recursiveDOMDelete(this.manipulationDiv),this._cleanManipulatorHammers()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanManipulatorHammers",value:function(){if(0!=this.manipulationHammers.length){for(var t=0;t<this.manipulationHammers.length;t++)this.manipulationHammers[t].destroy();this.manipulationHammers=[]}}},{key:"_removeManipulationDOM",value:function(){this._clean(),f.recursiveDOMDelete(this.manipulationDiv),f.recursiveDOMDelete(this.editModeDiv),f.recursiveDOMDelete(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}},{key:"_createSeperator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+t]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+t].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+t])}},{key:"_createAddNodeButton",value:function(t){var e=this._createButton("addNode","vis-button vis-add",t.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(e),this._bindHammerToDiv(e,this.addNodeMode.bind(this))}},{key:"_createAddEdgeButton",value:function(t){var e=this._createButton("addEdge","vis-button vis-connect",t.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(e),this._bindHammerToDiv(e,this.addEdgeMode.bind(this))}},{key:"_createEditNodeButton",value:function(t){var e=this._createButton("editNode","vis-button vis-edit",t.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(e),this._bindHammerToDiv(e,this.editNode.bind(this))}},{key:"_createEditEdgeButton",value:function(t){var e=this._createButton("editEdge","vis-button vis-edit",t.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(e),this._bindHammerToDiv(e,this.editEdgeMode.bind(this))}},{key:"_createDeleteButton",value:function(t){if(this.options.rtl)var e="vis-button vis-delete-rtl";else var e="vis-button vis-delete";var i=this._createButton("delete",e,t.del||this.options.locales.en.del);this.manipulationDiv.appendChild(i),this._bindHammerToDiv(i,this.deleteSelected.bind(this))}},{key:"_createBackButton",value:function(t){var e=this._createButton("back","vis-button vis-back",t.back||this.options.locales.en.back);this.manipulationDiv.appendChild(e),this._bindHammerToDiv(e,this.showManipulatorToolbar.bind(this))}},{key:"_createButton",value:function(t,e,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"vis-label";return this.manipulationDOM[t+"Div"]=document.createElement("div"),this.manipulationDOM[t+"Div"].className=e,this.manipulationDOM[t+"Label"]=document.createElement("div"),this.manipulationDOM[t+"Label"].className=o,this.manipulationDOM[t+"Label"].innerHTML=i,this.manipulationDOM[t+"Div"].appendChild(this.manipulationDOM[t+"Label"]),this.manipulationDOM[t+"Div"]}},{key:"_createDescription",value:function(t){this.manipulationDiv.appendChild(this._createButton("description","vis-button vis-none",t))}},{key:"_temporaryBindEvent",value:function(t,e){this.temporaryEventFunctions.push({event:t,boundFunction:e}),this.body.emitter.on(t,e)}},{key:"_temporaryBindUI",value:function(t,e){if(void 0===this.body.eventListeners[t])throw new Error("This UI function does not exist. Typo? You tried: "+t+" possible are: "+(0,a.default)((0,s.default)(this.body.eventListeners)));this.temporaryUIFunctions[t]=this.body.eventListeners[t],this.body.eventListeners[t]=e}},{key:"_unbindTemporaryUIs",value:function(){for(var t in this.temporaryUIFunctions)this.temporaryUIFunctions.hasOwnProperty(t)&&(this.body.eventListeners[t]=this.temporaryUIFunctions[t],delete this.temporaryUIFunctions[t]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var t=0;t<this.temporaryEventFunctions.length;t++){var e=this.temporaryEventFunctions[t].event,i=this.temporaryEventFunctions[t].boundFunction;this.body.emitter.off(e,i)}this.temporaryEventFunctions=[]}},{key:"_bindHammerToDiv",value:function(t,e){var i=new m(t,{});v.onTouch(i,e),this.manipulationHammers.push(i)}},{key:"_cleanupTemporaryNodesAndEdges",value:function(){for(var t=0;t<this.temporaryIds.edges.length;t++){this.body.edges[this.temporaryIds.edges[t]].disconnect(),delete this.body.edges[this.temporaryIds.edges[t]];var e=this.body.edgeIndices.indexOf(this.temporaryIds.edges[t]);e!==-1&&this.body.edgeIndices.splice(e,1)}for(var i=0;i<this.temporaryIds.nodes.length;i++){delete this.body.nodes[this.temporaryIds.nodes[i]];var o=this.body.nodeIndices.indexOf(this.temporaryIds.nodes[i]);o!==-1&&this.body.nodeIndices.splice(o,1)}this.temporaryIds={nodes:[],edges:[]}}},{key:"_controlNodeTouch",value:function(t){this.selectionHandler.unselectAll(),this.lastTouch=this.body.functions.getPointer(t.center),this.lastTouch.translation=f.extend({},this.body.view.translation)}},{key:"_controlNodeDragStart",value:function(t){var e=this.lastTouch,i=this.selectionHandler._pointerToPositionObject(e),o=this.body.nodes[this.temporaryIds.nodes[0]],n=this.body.nodes[this.temporaryIds.nodes[1]],s=this.body.edges[this.edgeBeingEditedId];this.selectedControlNode=void 0;var r=o.isOverlappingWith(i),a=n.isOverlappingWith(i);r===!0?(this.selectedControlNode=o,s.edgeType.from=o):a===!0&&(this.selectedControlNode=n,s.edgeType.to=n),void 0!==this.selectedControlNode&&this.selectionHandler.selectObject(this.selectedControlNode),this.body.emitter.emit("_redraw")}},{key:"_controlNodeDrag",value:function(t){this.body.emitter.emit("disablePhysics");var e=this.body.functions.getPointer(t.center),i=this.canvas.DOMtoCanvas(e);if(void 0!==this.selectedControlNode)this.selectedControlNode.x=i.x,this.selectedControlNode.y=i.y;else{var o=e.x-this.lastTouch.x,n=e.y-this.lastTouch.y;this.body.view.translation={x:this.lastTouch.translation.x+o,y:this.lastTouch.translation.y+n}}this.body.emitter.emit("_redraw")}},{key:"_controlNodeDragEnd",value:function(t){var e=this.body.functions.getPointer(t.center),i=this.selectionHandler._pointerToPositionObject(e),o=this.body.edges[this.edgeBeingEditedId];if(void 0!==this.selectedControlNode){this.selectionHandler.unselectAll();for(var n=this.selectionHandler._getAllNodesOverlappingWith(i),s=void 0,r=n.length-1;r>=0;r--)if(n[r]!==this.selectedControlNode.id){s=this.body.nodes[n[r]];break}if(void 0!==s&&void 0!==this.selectedControlNode)if(s.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===a.id?this._performEditEdge(s.id,o.to.id):this._performEditEdge(o.from.id,s.id)}else o.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(t){if((new Date).valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(t.center),this.lastTouch.translation=f.extend({},this.body.view.translation);var e=this.lastTouch,i=this.selectionHandler.getNodeAt(e);if(void 0!==i)if(i.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var o=this._getNewTargetNode(i.x,i.y);this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id);var n=this.body.functions.createEdge({id:"connectionEdge"+f.randomUUID(),from:i.id,to:o.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[n.id]=n,this.body.edgeIndices.push(n.id),this.temporaryIds.nodes.push(o.id),this.temporaryIds.edges.push(n.id)}this.touchTime=(new Date).valueOf()}}},{key:"_dragControlNode",value:function(t){var e=this.body.functions.getPointer(t.center);if(void 0!==this.temporaryIds.nodes[0]){var i=this.body.nodes[this.temporaryIds.nodes[0]];i.x=this.canvas._XconvertDOMtoCanvas(e.x),i.y=this.canvas._YconvertDOMtoCanvas(e.y),this.body.emitter.emit("_redraw")}else{var o=e.x-this.lastTouch.x,n=e.y-this.lastTouch.y;this.body.view.translation={x:this.lastTouch.translation.x+o,y:this.lastTouch.translation.y+n}}}},{key:"_finishConnect",value:function(t){var e=this.body.functions.getPointer(t.center),i=this.selectionHandler._pointerToPositionObject(e),o=void 0;void 0!==this.temporaryIds.edges[0]&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var n=this.selectionHandler._getAllNodesOverlappingWith(i),s=void 0,r=n.length-1;r>=0;r--)if(this.temporaryIds.nodes.indexOf(n[r])===-1){s=this.body.nodes[n[r]];break}this._cleanupTemporaryNodesAndEdges(),void 0!==s&&(s.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):void 0!==this.body.nodes[o]&&void 0!==this.body.nodes[s.id]&&this._performAddEdge(o,s.id)),this.body.emitter.emit("_redraw")}},{key:"_performAddNode",value:function(t){var e=this,i={id:f.randomUUID(),x:t.pointer.canvas.x,y:t.pointer.canvas.y,label:"new"};if("function"==typeof this.options.addNode){if(2!==this.options.addNode.length)throw new Error("The function for add does not support two arguments (data,callback)");this.options.addNode(i,function(t){null!==t&&void 0!==t&&"addNode"===e.inMode&&(e.body.data.nodes.getDataSet().add(t),e.showManipulatorToolbar())})}else this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(t,e){var i=this,o={from:t,to:e};if("function"==typeof this.options.addEdge){if(2!==this.options.addEdge.length)throw new Error("The function for connect does not support two arguments (data,callback)");this.options.addEdge(o,function(t){null!==t&&void 0!==t&&"addEdge"===i.inMode&&(i.body.data.edges.getDataSet().add(t),i.selectionHandler.unselectAll(),i.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().add(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(t,e){var i=this,o={id:this.edgeBeingEditedId,from:t,to:e,label:this.body.data.edges._data[this.edgeBeingEditedId].label},n=this.options.editEdge;if("object"===("undefined"==typeof n?"undefined":(0,d.default)(n))&&(n=n.editWithoutDrag),"function"==typeof n){if(2!==n.length)throw new Error("The function for edit does not support two arguments (data, callback)");n(o,function(t){null===t||void 0===t||"editEdge"!==i.inMode?(i.body.edges[o.id].updateEdgeType(),i.body.emitter.emit("_redraw"),i.showManipulatorToolbar()):(i.body.data.edges.getDataSet().update(t),i.selectionHandler.unselectAll(),i.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().update(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),t}();e.default=g},function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var i="string",o="boolean",n="number",s="array",r="object",a="dom",h="any",d={configure:{enabled:{boolean:o},filter:{boolean:o,string:i,array:s,function:"function"},container:{dom:a},showButton:{boolean:o},__type__:{object:r,boolean:o,string:i,array:s,function:"function"}},edges:{arrows:{to:{enabled:{boolean:o},scaleFactor:{number:n},type:{string:["arrow","circle"]},__type__:{object:r,boolean:o}},middle:{enabled:{boolean:o},scaleFactor:{number:n},type:{string:["arrow","circle"]},__type__:{object:r,boolean:o}},from:{enabled:{boolean:o},scaleFactor:{number:n},type:{string:["arrow","circle"]},__type__:{object:r,boolean:o}},__type__:{string:["from","to","middle"],object:r}},arrowStrikethrough:{boolean:o},chosen:{label:{boolean:o,function:"function"},edge:{boolean:o,function:"function"},__type__:{object:r,boolean:o}},color:{color:{string:i},highlight:{string:i},hover:{string:i},inherit:{string:["from","to","both"],boolean:o},opacity:{number:n},__type__:{object:r,string:i}},dashes:{boolean:o,array:s},font:{color:{string:i},size:{number:n},face:{string:i},background:{string:i},strokeWidth:{number:n},strokeColor:{string:i},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:n},multi:{boolean:o,string:i},bold:{color:{string:i},size:{number:n},face:{string:i},mod:{string:i},vadjust:{number:n},__type__:{object:r,string:i}},boldital:{color:{string:i},size:{number:n},face:{string:i},mod:{string:i},vadjust:{number:n},__type__:{object:r,string:i}},ital:{color:{string:i},size:{number:n},face:{string:i},mod:{string:i},vadjust:{number:n},__type__:{object:r,string:i}},mono:{color:{string:i},size:{number:n},face:{string:i},mod:{string:i},vadjust:{number:n},__type__:{object:r,string:i}},__type__:{object:r,string:i}},hidden:{boolean:o},hoverWidth:{function:"function",number:n},label:{string:i,undefined:"undefined"},labelHighlightBold:{boolean:o},length:{number:n,undefined:"undefined"},physics:{boolean:o},scaling:{min:{number:n},max:{number:n},label:{enabled:{boolean:o},min:{number:n},max:{number:n},maxVisible:{number:n},drawThreshold:{number:n},__type__:{object:r,boolean:o}},customScalingFunction:{function:"function"},__type__:{object:r}},selectionWidth:{function:"function",number:n},selfReferenceSize:{number:n},shadow:{enabled:{boolean:o},color:{string:i},size:{number:n},x:{number:n},y:{number:n},__type__:{object:r,boolean:o}},smooth:{enabled:{boolean:o},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:n},forceDirection:{string:["horizontal","vertical","none"],boolean:o},__type__:{object:r,boolean:o}},title:{string:i,undefined:"undefined"},width:{number:n},widthConstraint:{maximum:{number:n},__type__:{object:r,boolean:o,number:n}},value:{number:n,undefined:"undefined"},__type__:{object:r}},groups:{useDefaultGroups:{boolean:o},__any__:"get from nodes, will be overwritten below",__type__:{object:r}},interaction:{dragNodes:{boolean:o},dragView:{boolean:o},hideEdgesOnDrag:{boolean:o},hideNodesOnDrag:{boolean:o},hover:{boolean:o},keyboard:{enabled:{boolean:o},speed:{x:{number:n},y:{number:n},zoom:{number:n},__type__:{object:r}},bindToWindow:{boolean:o},__type__:{object:r,boolean:o}},multiselect:{boolean:o},navigationButtons:{boolean:o},selectable:{boolean:o},selectConnectedEdges:{boolean:o},hoverConnectedEdges:{boolean:o},tooltipDelay:{number:n},zoomView:{boolean:o},__type__:{object:r}},layout:{randomSeed:{undefined:"undefined",number:n},improvedLayout:{boolean:o},hierarchical:{enabled:{boolean:o},levelSeparation:{number:n},nodeSpacing:{number:n},treeSpacing:{number:n},blockShifting:{boolean:o},edgeMinimization:{boolean:o},parentCentralization:{boolean:o},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},__type__:{object:r,boolean:o}},__type__:{object:r}},manipulation:{enabled:{boolean:o},initiallyActive:{boolean:o},addNode:{boolean:o,function:"function"},addEdge:{boolean:o,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:r,boolean:o,function:"function"}},deleteNode:{boolean:o,function:"function"},deleteEdge:{boolean:o,function:"function"},controlNodeStyle:"get from nodes, will be overwritten below",__type__:{object:r,boolean:o}},nodes:{borderWidth:{number:n},borderWidthSelected:{number:n,undefined:"undefined"},brokenImage:{string:i,undefined:"undefined"},chosen:{label:{boolean:o,function:"function"},node:{boolean:o,function:"function"},__type__:{object:r,boolean:o}},color:{border:{string:i},background:{string:i},highlight:{border:{string:i},background:{string:i},__type__:{object:r,string:i}},hover:{border:{string:i},background:{string:i},__type__:{object:r,string:i}},__type__:{object:r,string:i}},fixed:{x:{boolean:o},y:{boolean:o},__type__:{object:r,boolean:o}},font:{align:{string:i},color:{string:i},size:{number:n},face:{string:i},background:{string:i},strokeWidth:{number:n},strokeColor:{string:i},vadjust:{number:n},multi:{boolean:o,string:i},bold:{color:{string:i},size:{number:n},face:{string:i},mod:{string:i},vadjust:{number:n},__type__:{object:r,string:i}},boldital:{color:{string:i},size:{number:n},face:{string:i},mod:{string:i},vadjust:{number:n},__type__:{object:r,string:i}},ital:{color:{string:i},size:{number:n},face:{string:i},mod:{string:i},vadjust:{number:n},__type__:{object:r,string:i}},mono:{color:{string:i},size:{number:n},face:{string:i},mod:{string:i},vadjust:{number:n},__type__:{object:r,string:i}},__type__:{object:r,string:i}},group:{string:i,number:n,undefined:"undefined"},heightConstraint:{minimum:{number:n},valign:{string:i},__type__:{object:r,boolean:o,number:n}},hidden:{boolean:o},icon:{face:{string:i},code:{string:i},size:{number:n},color:{string:i},__type__:{object:r}},id:{string:i,number:n},image:{string:i,undefined:"undefined"},label:{string:i,undefined:"undefined"},labelHighlightBold:{boolean:o},level:{number:n,undefined:"undefined"},margin:{top:{number:n},right:{number:n},bottom:{number:n},left:{number:n},__type__:{object:r,number:n}},mass:{number:n},physics:{boolean:o},scaling:{min:{number:n},max:{number:n},label:{enabled:{boolean:o},min:{number:n},max:{number:n},maxVisible:{number:n},drawThreshold:{number:n},__type__:{object:r,boolean:o}},customScalingFunction:{function:"function"},__type__:{object:r}},shadow:{enabled:{boolean:o},color:{string:i},size:{number:n},x:{number:n},y:{number:n},__type__:{object:r,boolean:o}},shape:{string:["ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon"]},shapeProperties:{borderDashes:{boolean:o,array:s},borderRadius:{number:n},interpolation:{boolean:o},useImageSize:{boolean:o},useBorderWithImage:{boolean:o},__type__:{object:r}},size:{number:n},title:{string:i,undefined:"undefined"},value:{number:n,undefined:"undefined"},widthConstraint:{minimum:{number:n},maximum:{number:n},__type__:{object:r,boolean:o,number:n}},x:{number:n},y:{number:n},__type__:{object:r}},physics:{enabled:{boolean:o},barnesHut:{gravitationalConstant:{number:n},centralGravity:{number:n},springLength:{number:n},springConstant:{number:n},damping:{number:n},avoidOverlap:{number:n},__type__:{object:r}},forceAtlas2Based:{gravitationalConstant:{number:n},centralGravity:{number:n},springLength:{number:n},springConstant:{number:n},damping:{number:n},avoidOverlap:{number:n},__type__:{object:r}},repulsion:{centralGravity:{number:n},springLength:{number:n},springConstant:{number:n},nodeDistance:{number:n},damping:{number:n},__type__:{object:r}},hierarchicalRepulsion:{centralGravity:{number:n},springLength:{number:n},springConstant:{number:n},nodeDistance:{number:n},damping:{number:n},__type__:{object:r}},maxVelocity:{number:n},minVelocity:{number:n},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:o},iterations:{number:n},updateInterval:{number:n},onlyDynamicEdges:{boolean:o},fit:{boolean:o},__type__:{object:r,boolean:o}},timestep:{number:n},adaptiveTimestep:{boolean:o},__type__:{object:r,boolean:o}},autoResize:{boolean:o},clickToUse:{boolean:o},locale:{string:i},locales:{__any__:{any:h},__type__:{object:r}},height:{string:i},width:{string:i},__type__:{object:r}};d.groups.__any__=d.nodes,d.manipulation.controlNodeStyle=d.nodes;var l={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],
+springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01]}};e.allOptions=d,e.configureOptions=l},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(161),s=o(n),r=i(115),a=o(r),h=i(116),d=o(h),l=i(222),u=o(l),c=function(){function t(e,i,o){(0,a.default)(this,t),this.body=e,this.springLength=i,this.springConstant=o,this.distanceSolver=new u.default}return(0,d.default)(t,[{key:"setOptions",value:function(t){t&&(t.springLength&&(this.springLength=t.springLength),t.springConstant&&(this.springConstant=t.springConstant))}},{key:"solve",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this.distanceSolver.getDistances(this.body,t,e);this._createL_matrix(o),this._createK_matrix(o);for(var n=.01,r=1,a=0,h=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),d=5,l=1e9,u=0,c=0,p=0,f=0,m=0;l>n&&a<h;){a+=1;var v=this._getHighestEnergyNode(i),g=(0,s.default)(v,4);for(u=g[0],l=g[1],c=g[2],p=g[3],f=l,m=0;f>r&&m<d;){m+=1,this._moveNode(u,c,p);var y=this._getEnergy(u),b=(0,s.default)(y,3);f=b[0],c=b[1],p=b[2]}}}},{key:"_getHighestEnergyNode",value:function(t){for(var e=this.body.nodeIndices,i=this.body.nodes,o=0,n=e[0],r=0,a=0,h=0;h<e.length;h++){var d=e[h];if(i[d].predefinedPosition===!1||i[d].isCluster===!0&&t===!0||i[d].options.fixed.x===!0||i[d].options.fixed.y===!0){var l=this._getEnergy(d),u=(0,s.default)(l,3),c=u[0],p=u[1],f=u[2];o<c&&(o=c,n=d,r=p,a=f)}}return[n,o,r,a]}},{key:"_getEnergy",value:function(t){for(var e=this.body.nodeIndices,i=this.body.nodes,o=i[t].x,n=i[t].y,s=0,r=0,a=0;a<e.length;a++){var h=e[a];if(h!==t){var d=i[h].x,l=i[h].y,u=1/Math.sqrt(Math.pow(o-d,2)+Math.pow(n-l,2));s+=this.K_matrix[t][h]*(o-d-this.L_matrix[t][h]*(o-d)*u),r+=this.K_matrix[t][h]*(n-l-this.L_matrix[t][h]*(n-l)*u)}}var c=Math.sqrt(Math.pow(s,2)+Math.pow(r,2));return[c,s,r]}},{key:"_moveNode",value:function(t,e,i){for(var o=this.body.nodeIndices,n=this.body.nodes,s=0,r=0,a=0,h=n[t].x,d=n[t].y,l=0;l<o.length;l++){var u=o[l];if(u!==t){var c=n[u].x,p=n[u].y,f=1/Math.pow(Math.pow(h-c,2)+Math.pow(d-p,2),1.5);s+=this.K_matrix[t][u]*(1-this.L_matrix[t][u]*Math.pow(d-p,2)*f),r+=this.K_matrix[t][u]*(this.L_matrix[t][u]*(h-c)*(d-p)*f),a+=this.K_matrix[t][u]*(1-this.L_matrix[t][u]*Math.pow(h-c,2)*f)}}var m=s,v=r,g=e,y=a,b=i,_=(g/m+b/v)/(v/m-y/v),w=-(v*_+g)/m;n[t].x+=w,n[t].y+=_}},{key:"_createL_matrix",value:function(t){var e=this.body.nodeIndices,i=this.springLength;this.L_matrix=[];for(var o=0;o<e.length;o++){this.L_matrix[e[o]]={};for(var n=0;n<e.length;n++)this.L_matrix[e[o]][e[n]]=i*t[e[o]][e[n]]}}},{key:"_createK_matrix",value:function(t){var e=this.body.nodeIndices,i=this.springConstant;this.K_matrix=[];for(var o=0;o<e.length;o++){this.K_matrix[e[o]]={};for(var n=0;n<e.length;n++)this.K_matrix[e[o]][e[n]]=i*Math.pow(t[e[o]][e[n]],-2)}}}]),t}();e.default=c},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(116),a=o(r),h=function(){function t(){(0,s.default)(this,t)}return(0,a.default)(t,[{key:"getDistances",value:function(t,e,i){for(var o={},n=t.edges,s=0;s<e.length;s++){o[e[s]]={},o[e[s]]={};for(var r=0;r<e.length;r++)o[e[s]][e[r]]=s==r?0:1e9,o[e[s]][e[r]]=s==r?0:1e9}for(var a=0;a<i.length;a++){var h=n[i[a]];h.connected===!0&&void 0!==o[h.fromId]&&void 0!==o[h.toId]&&(o[h.fromId][h.toId]=1,o[h.toId][h.fromId]=1)}for(var d=e.length,l=0;l<d;l++)for(var u=0;u<d-1;u++)for(var c=u+1;c<d;c++)o[e[u]][e[c]]=Math.min(o[e[u]][e[c]],o[e[u]][e[l]]+o[e[l]][e[c]]),o[e[c]][e[u]]=o[e[u]][e[c]];return o}}]),t}();e.default=h},function(t,e){"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.circle=function(t,e,i){this.beginPath(),this.arc(t,e,i,0,2*Math.PI,!1),this.closePath()},CanvasRenderingContext2D.prototype.square=function(t,e,i){this.beginPath(),this.rect(t-i,e-i,2*i,2*i),this.closePath()},CanvasRenderingContext2D.prototype.triangle=function(t,e,i){this.beginPath(),i*=1.15,e+=.275*i;var o=2*i,n=o/2,s=Math.sqrt(3)/6*o,r=Math.sqrt(o*o-n*n);this.moveTo(t,e-(r-s)),this.lineTo(t+n,e+s),this.lineTo(t-n,e+s),this.lineTo(t,e-(r-s)),this.closePath()},CanvasRenderingContext2D.prototype.triangleDown=function(t,e,i){this.beginPath(),i*=1.15,e-=.275*i;var o=2*i,n=o/2,s=Math.sqrt(3)/6*o,r=Math.sqrt(o*o-n*n);this.moveTo(t,e+(r-s)),this.lineTo(t+n,e-s),this.lineTo(t-n,e-s),this.lineTo(t,e+(r-s)),this.closePath()},CanvasRenderingContext2D.prototype.star=function(t,e,i){this.beginPath(),i*=.82,e+=.1*i;for(var o=0;o<10;o++){var n=o%2===0?1.3*i:.5*i;this.lineTo(t+n*Math.sin(2*o*Math.PI/10),e-n*Math.cos(2*o*Math.PI/10))}this.closePath()},CanvasRenderingContext2D.prototype.diamond=function(t,e,i){this.beginPath(),this.lineTo(t,e+i),this.lineTo(t+i,e),this.lineTo(t,e-i),this.lineTo(t-i,e),this.closePath()},CanvasRenderingContext2D.prototype.roundRect=function(t,e,i,o,n){var s=Math.PI/180;i-2*n<0&&(n=i/2),o-2*n<0&&(n=o/2),this.beginPath(),this.moveTo(t+n,e),this.lineTo(t+i-n,e),this.arc(t+i-n,e+n,n,270*s,360*s,!1),this.lineTo(t+i,e+o-n),this.arc(t+i-n,e+o-n,n,0,90*s,!1),this.lineTo(t+n,e+o),this.arc(t+n,e+o-n,n,90*s,180*s,!1),this.lineTo(t,e+n),this.arc(t+n,e+n,n,180*s,270*s,!1),this.closePath()},CanvasRenderingContext2D.prototype.ellipse=function(t,e,i,o){var n=.5522848,s=i/2*n,r=o/2*n,a=t+i,h=e+o,d=t+i/2,l=e+o/2;this.beginPath(),this.moveTo(t,l),this.bezierCurveTo(t,l-r,d-s,e,d,e),this.bezierCurveTo(d+s,e,a,l-r,a,l),this.bezierCurveTo(a,l+r,d+s,h,d,h),this.bezierCurveTo(d-s,h,t,l+r,t,l),this.closePath()},CanvasRenderingContext2D.prototype.database=function(t,e,i,o){var n=1/3,s=i,r=o*n,a=.5522848,h=s/2*a,d=r/2*a,l=t+s,u=e+r,c=t+s/2,p=e+r/2,f=e+(o-r/2),m=e+o;this.beginPath(),this.moveTo(l,p),this.bezierCurveTo(l,p+d,c+h,u,c,u),this.bezierCurveTo(c-h,u,t,p+d,t,p),this.bezierCurveTo(t,p-d,c-h,e,c,e),this.bezierCurveTo(c+h,e,l,p-d,l,p),this.lineTo(l,f),this.bezierCurveTo(l,f+d,c+h,m,c,m),this.bezierCurveTo(c-h,m,t,f+d,t,f),this.lineTo(t,p)},CanvasRenderingContext2D.prototype.arrowEndpoint=function(t,e,i,o){var n=t-o*Math.cos(i),s=e-o*Math.sin(i),r=t-.9*o*Math.cos(i),a=e-.9*o*Math.sin(i),h=n+o/3*Math.cos(i+.5*Math.PI),d=s+o/3*Math.sin(i+.5*Math.PI),l=n+o/3*Math.cos(i-.5*Math.PI),u=s+o/3*Math.sin(i-.5*Math.PI);this.beginPath(),this.moveTo(t,e),this.lineTo(h,d),this.lineTo(r,a),this.lineTo(l,u),this.closePath()},CanvasRenderingContext2D.prototype.circleEndpoint=function(t,e,i,o){var n=.4*o,s=t-n*Math.cos(i),r=e-n*Math.sin(i);this.circle(s,r,n)},CanvasRenderingContext2D.prototype.dashedLine=function(t,e,i,o,n){this.beginPath(),this.moveTo(t,e);for(var s=n.length,r=i-t,a=o-e,h=a/r,d=Math.sqrt(r*r+a*a),l=0,u=!0,c=0,p=n[0];d>=.1;)p=n[l++%s],p>d&&(p=d),c=Math.sqrt(p*p/(1+h*h)),c=r<0?-c:c,t+=c,e+=h*c,u===!0?this.lineTo(t,e):this.moveTo(t,e),d-=p,u=!u})},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t){return R=t,m()}function s(){L=0,A=R.charAt(0)}function r(){L++,A=R.charAt(L)}function a(){return R.charAt(L+1)}function h(t){return H.test(t)}function d(t,e){if(t||(t={}),e)for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function l(t,e,i){for(var o=e.split("."),n=t;o.length;){var s=o.shift();o.length?(n[s]||(n[s]={}),n=n[s]):n[s]=i}}function u(t,e){for(var i,o,n=null,s=[t],r=t;r.parent;)s.push(r.parent),r=r.parent;if(r.nodes)for(i=0,o=r.nodes.length;i<o;i++)if(e.id===r.nodes[i].id){n=r.nodes[i];break}for(n||(n={id:e.id},t.node&&(n.attr=d(n.attr,t.node))),i=s.length-1;i>=0;i--){var a=s[i];a.nodes||(a.nodes=[]),a.nodes.indexOf(n)===-1&&a.nodes.push(n)}e.attr&&(n.attr=d(n.attr,e.attr))}function c(t,e){if(t.edges||(t.edges=[]),t.edges.push(e),t.edge){var i=d({},t.edge);e.attr=d(i,e.attr)}}function p(t,e,i,o,n){var s={from:e,to:i,type:o};return t.edge&&(s.attr=d({},t.edge)),s.attr=d(s.attr||{},n),s}function f(){for(F=N.NULL,B="";" "===A||"\t"===A||"\n"===A||"\r"===A;)r();do{var t=!1;if("#"===A){for(var e=L-1;" "===R.charAt(e)||"\t"===R.charAt(e);)e--;if("\n"===R.charAt(e)||""===R.charAt(e)){for(;""!=A&&"\n"!=A;)r();t=!0}}if("/"===A&&"/"===a()){for(;""!=A&&"\n"!=A;)r();t=!0}if("/"===A&&"*"===a()){for(;""!=A;){if("*"===A&&"/"===a()){r(),r();break}r()}t=!0}for(;" "===A||"\t"===A||"\n"===A||"\r"===A;)r()}while(t);if(""===A)return void(F=N.DELIMITER);var i=A+a();if(z[i])return F=N.DELIMITER,B=i,r(),void r();if(z[A])return F=N.DELIMITER,B=A,void r();if(h(A)||"-"===A){for(B+=A,r();h(A);)B+=A,r();return"false"===B?B=!1:"true"===B?B=!0:isNaN(Number(B))||(B=Number(B)),void(F=N.IDENTIFIER)}if('"'===A){for(r();""!=A&&('"'!=A||'"'===A&&'"'===a());)B+=A,'"'===A&&r(),r();if('"'!=A)throw k('End of string " expected');return r(),void(F=N.IDENTIFIER)}for(F=N.UNKNOWN;""!=A;)B+=A,r();throw new SyntaxError('Syntax error in part "'+O(B,30)+'"')}function m(){var t={};if(s(),f(),"strict"===B&&(t.strict=!0,f()),"graph"!==B&&"digraph"!==B||(t.type=B,f()),F===N.IDENTIFIER&&(t.id=B,f()),"{"!=B)throw k("Angle bracket { expected");if(f(),v(t),"}"!=B)throw k("Angle bracket } expected");if(f(),""!==B)throw k("End of file expected");return f(),delete t.node,delete t.edge,delete t.graph,t}function v(t){for(;""!==B&&"}"!=B;)g(t),";"===B&&f()}function g(t){var e=y(t);if(e)return void w(t,e);var i=b(t);if(!i){if(F!=N.IDENTIFIER)throw k("Identifier expected");var o=B;if(f(),"="===B){if(f(),F!=N.IDENTIFIER)throw k("Identifier expected");t[o]=B,f()}else _(t,o)}}function y(t){var e=null;if("subgraph"===B&&(e={},e.type="subgraph",f(),F===N.IDENTIFIER&&(e.id=B,f())),"{"===B){if(f(),e||(e={}),e.parent=t,e.node=t.node,e.edge=t.edge,e.graph=t.graph,v(e),"}"!=B)throw k("Angle bracket } expected");f(),delete e.node,delete e.edge,delete e.graph,delete e.parent,t.subgraphs||(t.subgraphs=[]),t.subgraphs.push(e)}return e}function b(t){return"node"===B?(f(),t.node=x(),"node"):"edge"===B?(f(),t.edge=x(),"edge"):"graph"===B?(f(),t.graph=x(),"graph"):null}function _(t,e){var i={id:e},o=x();o&&(i.attr=o),u(t,i),w(t,e)}function w(t,e){for(;"->"===B||"--"===B;){var i,o=B;f();var n=y(t);if(n)i=n;else{if(F!=N.IDENTIFIER)throw k("Identifier or subgraph expected");i=B,u(t,{id:i}),f()}var s=x(),r=p(t,e,i,o,s);c(t,r),e=i}}function x(){for(var t=null;"["===B;){for(f(),t={};""!==B&&"]"!=B;){if(F!=N.IDENTIFIER)throw k("Attribute name expected");var e=B;if(f(),"="!=B)throw k("Equal sign = expected");if(f(),F!=N.IDENTIFIER)throw k("Attribute value expected");var i=B;l(t,e,i),f(),","==B&&f()}if("]"!=B)throw k("Bracket ] expected");f()}return t}function k(t){return new SyntaxError(t+', got "'+O(B,30)+'" (char '+L+")")}function O(t,e){return t.length<=e?t:t.substr(0,27)+"..."}function D(t,e,i){Array.isArray(t)?t.forEach(function(t){Array.isArray(e)?e.forEach(function(e){i(t,e)}):i(t,e)}):Array.isArray(e)?e.forEach(function(e){i(t,e)}):i(t,e)}function S(t,e,i){for(var o=e.split("."),n=o.pop(),s=t,r=0;r<o.length;r++){var a=o[r];a in s||(s[a]={}),s=s[a]}return s[n]=i,t}function M(t,e){var i={};for(var o in t)if(t.hasOwnProperty(o)){var n=e[o];Array.isArray(n)?n.forEach(function(e){S(i,e,t[o])}):"string"==typeof n?S(i,n,t[o]):S(i,o,t[o])}return i}function C(t){var e=n(t),i={nodes:[],edges:[],options:{}};if(e.nodes&&e.nodes.forEach(function(t){var e={id:t.id,label:String(t.label||t.id)};d(e,M(t.attr,P)),e.image&&(e.shape="image"),i.nodes.push(e)}),e.edges){var o=function(t){var e={from:t.from,to:t.to};return d(e,M(t.attr,I)),e.arrows="->"===t.type?"to":void 0,e};e.edges.forEach(function(t){var e,n;e=t.from instanceof Object?t.from.nodes:{id:t.from},n=t.to instanceof Object?t.to.nodes:{id:t.to},t.from instanceof Object&&t.from.edges&&t.from.edges.forEach(function(t){var e=o(t);i.edges.push(e)}),D(e,n,function(e,n){var s=p(i,e.id,n.id,t.type,t.attr),r=o(s);i.edges.push(r)}),t.to instanceof Object&&t.to.edges&&t.to.edges.forEach(function(t){var e=o(t);i.edges.push(e)})})}return e.attr&&(i.options=e.attr),i}var T=i(55),E=o(T),P={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},I=(0,E.default)(P);I.color="color.color";var N={NULL:0,DELIMITER:1,IDENTIFIER:2,UNKNOWN:3},z={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},R="",L=0,A="",B="",F=N.NULL,H=/[a-zA-Z_0-9.:#]/;e.parseDOT=n,e.DOTToGraph=C},function(t,e){function i(t,e){var i=[],o=[],n={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};void 0!==e&&(void 0!==e.fixed&&(n.nodes.fixed=e.fixed),void 0!==e.parseColor&&(n.nodes.parseColor=e.parseColor),void 0!==e.inheritColor&&(n.edges.inheritColor=e.inheritColor));for(var s=t.edges,r=t.nodes,a=0;a<s.length;a++){var h={},d=s[a];h.id=d.id,h.from=d.source,h.to=d.target,h.attributes=d.attributes,h.label=d.label,h.title=void 0!==d.attributes?d.attributes.title:void 0,"Directed"===d.type&&(h.arrows="to"),d.color&&n.inheritColor===!1&&(h.color=d.color),i.push(h)}for(var a=0;a<r.length;a++){var l={},u=r[a];l.id=u.id,l.attributes=u.attributes,l.title=u.title,l.x=u.x,l.y=u.y,l.label=u.label,l.title=void 0!==u.attributes?u.attributes.title:void 0,n.nodes.parseColor===!0?l.color=u.color:l.color=void 0!==u.color?{background:u.color,border:u.color,highlight:{background:u.color,border:u.color},hover:{background:u.color,border:u.color}}:void 0,l.size=u.size,l.fixed=n.nodes.fixed&&void 0!==u.x&&void 0!==u.y,o.push(l)}return{nodes:o,edges:i}}e.parseGephi=i},function(t,e){e.en={edit:"Edit",del:"Delete selected",back:"Back",addNode:"Add Node",addEdge:"Add Edge",editNode:"Edit Node",editEdge:"Edit Edge",addDescription:"Click in an empty space to place a new node.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",createEdgeError:"Cannot link edges to a cluster.",deleteClusterError:"Clusters cannot be deleted.",editClusterError:"Clusters cannot be edited."},e.en_EN=e.en,e.en_US=e.en,e.de={edit:"Editieren",del:"Lösche Auswahl",back:"Zurück",addNode:"Knoten hinzufügen",addEdge:"Kante hinzufügen",editNode:"Knoten editieren",editEdge:"Kante editieren",addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",deleteClusterError:"Cluster können nicht gelöscht werden.",editClusterError:"Cluster können nicht editiert werden."},e.de_DE=e.de,e.es={edit:"Editar",del:"Eliminar selección",back:"Átras",addNode:"Añadir nodo",addEdge:"Añadir arista",editNode:"Editar nodo",editEdge:"Editar arista",addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",createEdgeError:"No se puede conectar una arista a un grupo.",deleteClusterError:"No es posible eliminar grupos.",editClusterError:"No es posible editar grupos."},e.es_ES=e.es,e.it={edit:"Modifica",del:"Cancella la selezione",back:"Indietro",addNode:"Aggiungi un nodo",addEdge:"Aggiungi un vertice",editNode:"Modifica il nodo",editEdge:"Modifica il vertice",addDescription:"Clicca per aggiungere un nuovo nodo",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",createEdgeError:"Non si possono collegare vertici ad un cluster",deleteClusterError:"I cluster non possono essere cancellati",editClusterError:"I clusters non possono essere modificati."},e.it_IT=e.it,e.nl={edit:"Wijzigen",del:"Selectie verwijderen",back:"Terug",addNode:"Node toevoegen",addEdge:"Link toevoegen",editNode:"Node wijzigen",editEdge:"Link wijzigen",addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",createEdgeError:"Kan geen link maken naar een cluster.",deleteClusterError:"Clusters kunnen niet worden verwijderd.",editClusterError:"Clusters kunnen niet worden aangepast."},e.nl_NL=e.nl,e.nl_BE=e.nl,e["pt-br"]={edit:"Editar",del:"Remover selecionado",back:"Voltar",addNode:"Adicionar nó",addEdge:"Adicionar aresta",editNode:"Editar nó",editEdge:"Editar aresta",addDescription:"Clique em um espaço em branco para adicionar um novo nó",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",createEdgeError:"Não foi possível linkar arestas a um cluster.",deleteClusterError:"Clusters não puderam ser removidos.",editClusterError:"Clusters não puderam ser editados."},e["pt-BR"]=e["pt-br"],e.pt_BR=e["pt-br"],e.pt_br=e["pt-br"],e.ru={edit:"Редактировать",del:"Удалить выбранное",back:"Назад",addNode:"Добавить узел",addEdge:"Добавить ребро",editNode:"Редактировать узел",editEdge:"Редактировать ребро",addDescription:"Кликните в свободное место, чтобы добавить новый узел.",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",createEdgeError:"Невозможно соединить ребра в кластер.",deleteClusterError:"Кластеры не могут быть удалены",editClusterError:"Кластеры недоступны для редактирования."},e.ru_RU=e.ru}])});
+//# sourceMappingURL=vis.map
diff --git a/www/js/main.js b/www/js/main.js
new file mode 100644
index 00000000..3ea41815
--- /dev/null
+++ b/www/js/main.js
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var Main = Class.extend({
+
+ /**
+ * @brief Class constructor
+ */
+ init: function()
+ {
+ this._server = new ServerEventsDispatcher(URL);
+ this._server.bind('insert', 'local.connection', this.on_connect.bind(this));
+ this._network = new Network('network');
+ },
+
+ on_connect: function()
+ {
+ $('#cnxled').removeClass('led-red').addClass('led-green');
+ },
+
+});
+
+$(function() {
+ main = new Main();
+});
diff --git a/www/js/network.js b/www/js/network.js
new file mode 100644
index 00000000..ec9b81a7
--- /dev/null
+++ b/www/js/network.js
@@ -0,0 +1,356 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var LENGTH_MAIN = 350, // unused
+ LENGTH_SERVER = 150, // unused
+ LENGTH_SUB = 50, // unused
+ WIDTH_SCALE = 2,
+ EDGE_WIDTH_MIN = 2,
+ EDGE_WIDTH_MID = 15
+ EDGE_WIDTH_MAX = 35,
+ BW_MID = 50,
+ EDGE_RATE_MAX = 250000, // kbps
+ COORDINATE_SCALE = 50,
+ CACHE_RADIUS = 120,
+ GREEN = 'green',
+ MAX_COLOR_VALUE = 16777215
+ MAX_BW_VALUE = 1200
+ RED = '#C5000B',
+ BLUE = '#0B00C5',
+ ORANGE = 'orange',
+ GRAY = 'gray',
+ BLACK = '#2B1B17',
+ CYAN = 'cyan',
+ COLOR_RED = '#fa5858',
+ COLOR_RED_SHADED = '#F8E0E0',
+ COLOR_BLUE = '#0080ff',
+ COLOR_BLUE_SHADED = '#CEE3F6',
+ COLOR_GREEN = '#04B404',
+ COLOR_GREEN_SHADED = '#E0F8E0';
+
+var DIR = 'img/';
+
+/* Network color scales */
+
+var color_scale_lin = d3.scaleLinear().domain([0, 10, 20, 30, 40, 50]).range(['gray', 'green', 'blue', 'purple', 'black', 'yellow']);
+var color_scale_log = d3.scaleLog().domain([50, 200, 1000]).range(['yellow', 'orange', 'red']);
+
+DEFAULT_VIS_OPTIONS = {
+ nodes: {
+ size: 70, // unused
+ font:{color:'black'},
+ scaling:{
+ label: {
+ min:0,
+ max: 35 // unused// This defines the label size of the node
+ }
+ }
+ },
+ edges: {
+ color: GRAY,
+ smooth: false
+ },
+ physics:{
+ barnesHut:{gravitationalConstant:-30000},
+ stabilization: {iterations:2500}
+ },
+ groups: {
+ 'switch': {
+ shape: 'triangle',
+ color: '#FF9900' // orange
+ },
+ desktop: {
+ shape: 'dot',
+ color: "#2B7CE9" // blue
+ },
+ mobile: {
+ shape: 'dot',
+ color: "#5A1E5C" // purple
+ },
+ server: {
+ shape: 'square',
+ color: "#C5000B" // red
+ },
+ internet: {
+ shape: 'square',
+ color: "#109618" // green
+ }
+ }
+}
+
+var Network = Class.extend({
+
+ /**
+ * @brief Class constructor
+ */
+ init: function(id)
+ {
+
+ this._id = id;
+ this._server = new ServerEventsDispatcher(URL);
+
+ this._server.bind('insert', 'local.connection', this.on_connect.bind(this));
+ this._server.bind("insert", "node", this.on_insert_node.bind(this));
+ this._server.bind("insert", "channel", this.on_insert_channel.bind(this));
+ this._server.bind("update", "node", this.on_update_node.bind(this));
+ this._server.bind("update", "channel", this.on_update_channel.bind(this));
+
+ this._map_interface_node = new Object();
+ this._map_id_type = new Object();
+
+ var body = document.body,
+ html = document.documentElement;
+
+ var HEIGTH = Math.max( body.scrollHeight, body.offsetHeight,
+ html.clientHeight, html.scrollHeight, html.offsetHeight );
+ var WIDTH = Math.max( body.scrollWidth, body.offsetWidth,
+ html.clientWidth, html.scrollWidth, html.offsetWidth );
+
+ this._nodes = new vis.DataSet({});
+ this._edges = new vis.DataSet({});
+ this._edgesInfo = [];
+
+ this._map_id_name = new Object();
+ this._map_name_id = new Object();
+
+ this._pending_edges = Array();
+ this._pending_nodes = Array();
+
+ var container = document.getElementById(id);
+ var data = {
+ nodes: this._nodes,
+ edges: this._edges
+ };
+
+ vis.Network.prototype.setScale = function (scale) {
+ var options = {
+ nodes: []
+ };
+ var animationOptions = {
+ scale: scale,
+ animation: options.animation
+ };
+ this.view.moveTo(animationOptions);
+ };
+
+ this._network = new vis.Network(container, data, DEFAULT_VIS_OPTIONS);
+ window.onresize = this.do_fit.bind(this);
+
+ this.intervalID = setInterval(
+ (function(self) { //Self-executing func which takes 'this' as self
+ return function() { //Return a function in the context of 'self'
+ self._tick();
+ }
+ })(this),
+ 500);
+ },
+
+ _tick: function()
+ {
+ this._edges.update(this._pending_edges);
+ this._pending_edges.length = 0;
+
+ this._nodes.update(this._pending_nodes);
+ this._pending_nodes.length = 0;
+ },
+
+ do_fit: function()
+ {
+ this._network.fit();
+ },
+
+ on_connect: function()
+ {
+ // Request nodes with interfaces, and later, links
+ var node_query = new Query('select', 'node');
+ this._server.send(node_query.to_dict());
+ },
+
+ on_insert_node: function(query)
+ {
+ data = query.params
+ // Update mac->node map
+ if (data.interfaces) {
+ for (var i=0; i<data.interfaces.length; i++) {
+ this._map_interface_node[data.interfaces[i]] = data.id;
+ }
+ }
+
+ // RIGHT PLOTS
+ this._map_id_name[data.id] = data.name;
+ this._map_name_id[data.name] = data.id;
+
+ font = new Object();
+ font.size = 40;
+ font.color = 'black';
+ //font.background = 'black';
+ font.strokeColor = 'white';
+ font.strokeWidth = 2;
+ font.align = 'top';
+ //font.vadjust = -10;
+
+ // Update node
+ var node = new Object();
+ node.id = data.id;
+ node.font = font;
+
+ node.font.color = '#000000';
+
+ node.shape = 'image'
+
+ node.x = data.x * COORDINATE_SCALE;
+ node.y = data.y * COORDINATE_SCALE;
+ node.size = 0.75 * COORDINATE_SCALE;
+
+ node.image = DIR + data.category + '.png';
+
+ node.physics = false;
+ node.has_producer = false; // FIB entry
+ if (data.groups.length > 0) {
+ this._nodes.add(node);
+ }
+ if (query.last) {
+ this.do_fit();
+ var link_query = new Query('select', 'channel');
+ this._server.send(link_query.to_dict());
+ }
+ },
+
+ on_update_node: function(query)
+ {
+ var data = query.params;
+ var node = new Object();
+
+ var filter_dict = {};
+ query.filter.forEach(function(filter) {
+ [key, op, value] = filter;
+ if (op == '==') {
+ filter_dict[key] = value;
+ }
+ });
+
+ if (filter_dict.id === undefined) {
+ if (filter_dict.name === undefined) {
+ console.log("Wrong update query");
+ return;
+ }
+ node.id = this._map_name_id[filter_dict.name];
+ } else {
+ node.id = filter_dict.id;
+ }
+ node.image = DIR + data.category + '.png';
+
+ this._pending_nodes.push(node);
+ },
+
+ on_insert_channel: function(query)
+ {
+ data = query.params;
+
+ font = new Object();
+ font.size = 35;
+ font.color = 'black';
+ //font.background = 'black';
+ font.strokeColor = 'white';
+ font.strokeWidth = 2;
+ font.align = 'top';
+ font.vadjust = -20;
+
+ if ((data.type.indexOf('wiredchannel') !== -1) || (data.type.indexOf('link') !== -1) || (data.type.indexOf('phylink') !== -1) || (data.type.indexOf('memiflink') !== -1)) {
+ var edgeu = new Object();
+ edgeu.id = data.id;
+ edgeu.width = EDGE_WIDTH_MIN;
+ edgeu.color = GRAY
+ edgeu.fontColor = RED;
+ edgeu.font = font;
+
+ if ((data.type.indexOf('link') !== -1) || (data.type.indexOf('memiflink') !== -1)) {
+ edgeu.from = data.src_node;
+ edgeu.to = data.dst_node;
+ } else {
+ edgeu.from = this._map_interface_node[data.src];
+ edgeu.to = this._map_interface_node[data.dst];
+
+ }
+
+ //this._edges.update(edgeu);
+ this._pending_edges.push(edgeu);
+ this._edgesInfo[edgeu.id] = data.capacity;
+
+ } else if (data.type.indexOf('emulatedchannel') !== -1) {
+ if (data.stations !== undefined) {
+ data.stations.forEach(function(station) {
+ var edgeu = new Object();
+ station_name = this._map_id_name[station];
+ edgeu.id = 'tap-' + station_name + '-' + data.name;
+ edgeu.width = EDGE_WIDTH_MIN;
+ edgeu.color = GRAY;
+ edgeu.fontColor = RED;
+
+ edgeu.from = station;
+ edgeu.to = data.ap;
+ edgeu.dashes = [10,10];
+ edgeu.font = font;
+ this._pending_edges.push(edgeu);
+
+ this._edgesInfo[edgeu.id] = data.capacity;
+ }.bind(this));
+ }
+ }
+ },
+
+ on_update_channel: function(query)
+ {
+ data = query.params;
+ if (data.bw_upstream === undefined)
+ return;
+
+ var id = query.filter[0][2];
+ var bw = parseFloat(Math.round((parseFloat(data.bw_upstream) + parseFloat(data.bw_downstream)) / 1024 / 1024 * 8 * 10) /10).toFixed(1);
+
+ var edgeu = new Object();
+ edgeu.id = id;
+ if (bw < BW_MID) {
+ // 0 MIN
+ // x ??
+ // BW_MID EDGE_WIDTH_MID
+ edgeu.color = color_scale_lin(bw);
+ edgeu.width = (EDGE_WIDTH_MID * bw) / BW_MID;
+ } else {
+ // BW_MID 0 -> 0 + EDGE_WIDTH_MID
+ // log() = 0 -> 0 + EDGE_WIDTH_MID
+ // = x -> ??
+ // log() = 4 -> EDGE_WIDTH_MAX - EDGE_WIDTH_MID + EDGE_WIDTH_MID
+ edgeu.color = color_scale_log(bw);
+ edgeu.width = EDGE_WIDTH_MID + Math.log10(bw - BW_MID) * (EDGE_WIDTH_MAX - EDGE_WIDTH_MID) / 4
+ }
+
+ if (bw != 0.0) {
+ if (bw > 1000)
+ edgeu.label = Math.round(bw/10)/100 + " Gbps";
+ else
+ edgeu.label = bw + " Mbps";
+ } else {
+ edgeu.label = "";
+ }
+
+
+ this._pending_edges.push(edgeu);
+
+ },
+
+});
diff --git a/www/js/query.js b/www/js/query.js
new file mode 100644
index 00000000..021a1bd0
--- /dev/null
+++ b/www/js/query.js
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var Query = Class.extend({
+ /**
+ * @brief Query class
+ * @param action (string) :
+ * @param object_name (string) :
+ * @param filter (list[tuple(key, op, value)]) :
+ * @param params (dict[field_name, value]) :
+ * @param field_names (list[string])
+ * @return : a Query instance
+ */
+ init: function(action, object_name, filter = null, params = null, field_names = null, last = false)
+ {
+ this._action = action;
+ this._object_name = object_name;
+ this._filter = filter;
+ this._params = params;
+ this._field_names = field_names;
+ this._last = last;
+ },
+
+ /**
+ * @brief : dict representation of a Query
+ * @return : a dict representing the Query
+ */
+ to_dict: function()
+ {
+ query_dict = {
+ 'action': this._action,
+ 'object_name': this._object_name,
+ 'filter': this._filter,
+ 'params': this._params,
+ 'fields': this._fields,
+ 'last': this._last
+ };
+ return query_dict;
+ }
+
+});
diff --git a/www/js/server-event-dispatcher.js b/www/js/server-event-dispatcher.js
new file mode 100644
index 00000000..5526444b
--- /dev/null
+++ b/www/js/server-event-dispatcher.js
@@ -0,0 +1,66 @@
+/* Inspired from https://gist.github.com/ismasan/299789 (MIT licensed) */
+$(function() {
+ ServerEventsDispatcher = function(url){
+ var callbacks = {};
+ var is_open = false;
+ var timeout = null;
+ var timeoutInterval = 2; /* s */
+ var self = this;
+ var ws = null;
+
+ this.open = function(){
+ ws = new WebSocket(url);
+ ws.binaryType = "arraybuffer";
+
+ // dispatch to the right handlers
+ ws.onmessage = function(evt){
+ var json = JSON.parse(evt.data)
+ //console.log("EVENT", json);
+ dispatch(json);
+ };
+
+ ws.onclose = function(){
+ is_open = false;
+ dispatch({action: 'delete', object_name: 'local.connection'})
+
+ timeout = setTimeout(function() { self.open(); }, self.timeoutInterval);
+ }
+
+ ws.onopen = function() {
+ if (timeout)
+ clearTimeout(timeout);
+ is_open = true;
+ dispatch({action: 'insert', object_name: 'local.connection'})
+ }
+ };
+
+ this.open();
+
+ this.bind = function(action, object_name, callback){
+ var key = action + object_name;
+ callbacks[key] = callbacks[key] || [];
+ callbacks[key].push(callback);
+ return this;// chainable
+ };
+
+ // XXX bad
+ this.send = function(query){
+ var payload = JSON.stringify(query);
+ ws.send( payload ); // <= send JSON data to socket server
+ return this;
+ };
+
+
+ var dispatch = function(query) {
+ var key = query.action + query.object_name;
+ var chain = callbacks[key];
+ if(typeof chain === 'undefined') {
+ return; // no callbacks for this event
+ }
+ for(var i = 0; i < chain.length; i++){
+ chain[i](query)
+ }
+ }
+
+ };
+});