From 6fcfb7c04d32e1c8b26a312295bf7ac3ec2d2ad7 Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Fri, 13 Jul 2018 19:06:45 +0200
Subject: Fixed many permissions and began admin interface
---
public/bower_components/jvectormap/.bower.json | 14 +
public/bower_components/jvectormap/.gitignore | 2 +
public/bower_components/jvectormap/LICENSE-AGPL | 661 ++
.../bower_components/jvectormap/LICENSE-COMMERCIAL | 16 +
public/bower_components/jvectormap/README.md | 3 +
public/bower_components/jvectormap/build.sh | 61 +
.../jvectormap/converter/converter.py | 299 +
.../jvectormap/converter/processor.py | 573 ++
.../jvectormap/converter/simplifier.py | 205 +
.../jvectormap/jquery-jvectormap.css | 135 +
.../jvectormap/jquery-jvectormap.js | 44 +
.../jvectormap/jvectormap.jquery.json | 34 +
.../jvectormap/lib/jquery-mousewheel.js | 201 +
.../jvectormap/src/abstract-canvas-element.js | 93 +
.../jvectormap/src/abstract-element.js | 73 +
.../jvectormap/src/abstract-shape-element.js | 62 +
.../bower_components/jvectormap/src/color-scale.js | 44 +
.../bower_components/jvectormap/src/data-series.js | 158 +
.../bower_components/jvectormap/src/jvectormap.js | 185 +
public/bower_components/jvectormap/src/legend.js | 83 +
.../bower_components/jvectormap/src/map-object.js | 73 +
public/bower_components/jvectormap/src/map.js | 1186 +++
public/bower_components/jvectormap/src/marker.js | 76 +
public/bower_components/jvectormap/src/multimap.js | 139 +
.../jvectormap/src/numeric-scale.js | 185 +
.../jvectormap/src/ordinal-scale.js | 21 +
public/bower_components/jvectormap/src/proj.js | 181 +
public/bower_components/jvectormap/src/region.js | 45 +
.../jvectormap/src/simple-scale.js | 7 +
.../jvectormap/src/svg-canvas-element.js | 26 +
.../jvectormap/src/svg-circle-element.js | 5 +
.../bower_components/jvectormap/src/svg-element.js | 48 +
.../jvectormap/src/svg-group-element.js | 9 +
.../jvectormap/src/svg-image-element.js | 36 +
.../jvectormap/src/svg-path-element.js | 6 +
.../jvectormap/src/svg-shape-element.js | 49 +
.../jvectormap/src/svg-text-element.js | 13 +
.../jvectormap/src/vector-canvas.js | 18 +
.../jvectormap/src/vml-canvas-element.js | 45 +
.../jvectormap/src/vml-circle-element.js | 26 +
.../bower_components/jvectormap/src/vml-element.js | 107 +
.../jvectormap/src/vml-group-element.js | 13 +
.../jvectormap/src/vml-image-element.js | 47 +
.../jvectormap/src/vml-path-element.js | 98 +
.../jvectormap/src/vml-shape-element.js | 49 +
.../jvectormap/tests/assets/bg-red-green.png | Bin 0 -> 173 bytes
.../jvectormap/tests/assets/bg-yellow-blue.png | Bin 0 -> 173 bytes
.../jvectormap/tests/assets/icon-bank.png | Bin 0 -> 418 bytes
.../jvectormap/tests/assets/icon-factory.png | Bin 0 -> 491 bytes
.../jvectormap/tests/assets/jquery-1.8.2.js | 9440 ++++++++++++++++++++
.../assets/jquery-jvectormap-data-us-lcc-en.js | 1 +
.../tests/assets/jquery-jvectormap-map.js | 1 +
.../tests/assets/jquery-jvectormap-us-aea-en.js | 1 +
.../tests/assets/jquery-jvectormap-us-lcc-en.js | 1 +
.../tests/assets/jquery-jvectormap-us-merc-en.js | 1 +
.../tests/assets/jquery-jvectormap-us-mill-en.js | 1 +
.../assets/jquery-jvectormap-world-mill-en.js | 1 +
.../us/jquery-jvectormap-data-us-ak-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-al-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ar-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-az-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ca-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-co-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ct-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-dc-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-de-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-fl-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ga-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-hi-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ia-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-id-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-il-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-in-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ks-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ky-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-la-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ma-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-md-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-me-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-mi-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-mn-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-mo-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ms-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-mt-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-nc-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-nd-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ne-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-nh-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-nj-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-nm-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-nv-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ny-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-oh-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ok-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-or-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-pa-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ri-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-sc-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-sd-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-tn-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-tx-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-ut-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-va-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-vt-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-wa-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-wi-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-wv-lcc-en.js | 1 +
.../us/jquery-jvectormap-data-us-wy-lcc-en.js | 1 +
.../bower_components/jvectormap/tests/basic.html | 276 +
.../bower_components/jvectormap/tests/build.html | 20 +
.../bower_components/jvectormap/tests/custom.html | 59 +
.../jvectormap/tests/drill-down.html | 68 +
.../bower_components/jvectormap/tests/hidden.html | 64 +
.../bower_components/jvectormap/tests/markers.html | 307 +
.../bower_components/jvectormap/tests/memory.html | 68 +
.../jvectormap/tests/processor/continents.json | 58 +
.../jvectormap/tests/processor/continents_wb.json | 39 +
.../tests/processor/france_regions_2016.json | 74 +
.../jvectormap/tests/processor/russia.json | 121 +
.../jvectormap/tests/processor/russia_fd.json | 135 +
.../jvectormap/tests/processor/tz.json | 568 ++
.../jvectormap/tests/reverse-projection.html | 90 +
public/bower_components/jvectormap/tests/us.json | 33 +
.../bower_components/jvectormap/tests/world.json | 10 +
124 files changed, 16942 insertions(+)
create mode 100644 public/bower_components/jvectormap/.bower.json
create mode 100644 public/bower_components/jvectormap/.gitignore
create mode 100644 public/bower_components/jvectormap/LICENSE-AGPL
create mode 100644 public/bower_components/jvectormap/LICENSE-COMMERCIAL
create mode 100644 public/bower_components/jvectormap/README.md
create mode 100755 public/bower_components/jvectormap/build.sh
create mode 100644 public/bower_components/jvectormap/converter/converter.py
create mode 100644 public/bower_components/jvectormap/converter/processor.py
create mode 100644 public/bower_components/jvectormap/converter/simplifier.py
create mode 100644 public/bower_components/jvectormap/jquery-jvectormap.css
create mode 100644 public/bower_components/jvectormap/jquery-jvectormap.js
create mode 100644 public/bower_components/jvectormap/jvectormap.jquery.json
create mode 100644 public/bower_components/jvectormap/lib/jquery-mousewheel.js
create mode 100644 public/bower_components/jvectormap/src/abstract-canvas-element.js
create mode 100644 public/bower_components/jvectormap/src/abstract-element.js
create mode 100644 public/bower_components/jvectormap/src/abstract-shape-element.js
create mode 100644 public/bower_components/jvectormap/src/color-scale.js
create mode 100644 public/bower_components/jvectormap/src/data-series.js
create mode 100644 public/bower_components/jvectormap/src/jvectormap.js
create mode 100644 public/bower_components/jvectormap/src/legend.js
create mode 100644 public/bower_components/jvectormap/src/map-object.js
create mode 100644 public/bower_components/jvectormap/src/map.js
create mode 100644 public/bower_components/jvectormap/src/marker.js
create mode 100644 public/bower_components/jvectormap/src/multimap.js
create mode 100644 public/bower_components/jvectormap/src/numeric-scale.js
create mode 100644 public/bower_components/jvectormap/src/ordinal-scale.js
create mode 100644 public/bower_components/jvectormap/src/proj.js
create mode 100644 public/bower_components/jvectormap/src/region.js
create mode 100644 public/bower_components/jvectormap/src/simple-scale.js
create mode 100644 public/bower_components/jvectormap/src/svg-canvas-element.js
create mode 100644 public/bower_components/jvectormap/src/svg-circle-element.js
create mode 100644 public/bower_components/jvectormap/src/svg-element.js
create mode 100644 public/bower_components/jvectormap/src/svg-group-element.js
create mode 100644 public/bower_components/jvectormap/src/svg-image-element.js
create mode 100644 public/bower_components/jvectormap/src/svg-path-element.js
create mode 100644 public/bower_components/jvectormap/src/svg-shape-element.js
create mode 100644 public/bower_components/jvectormap/src/svg-text-element.js
create mode 100644 public/bower_components/jvectormap/src/vector-canvas.js
create mode 100644 public/bower_components/jvectormap/src/vml-canvas-element.js
create mode 100644 public/bower_components/jvectormap/src/vml-circle-element.js
create mode 100644 public/bower_components/jvectormap/src/vml-element.js
create mode 100644 public/bower_components/jvectormap/src/vml-group-element.js
create mode 100644 public/bower_components/jvectormap/src/vml-image-element.js
create mode 100644 public/bower_components/jvectormap/src/vml-path-element.js
create mode 100644 public/bower_components/jvectormap/src/vml-shape-element.js
create mode 100644 public/bower_components/jvectormap/tests/assets/bg-red-green.png
create mode 100644 public/bower_components/jvectormap/tests/assets/bg-yellow-blue.png
create mode 100644 public/bower_components/jvectormap/tests/assets/icon-bank.png
create mode 100644 public/bower_components/jvectormap/tests/assets/icon-factory.png
create mode 100644 public/bower_components/jvectormap/tests/assets/jquery-1.8.2.js
create mode 100644 public/bower_components/jvectormap/tests/assets/jquery-jvectormap-data-us-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/jquery-jvectormap-map.js
create mode 100644 public/bower_components/jvectormap/tests/assets/jquery-jvectormap-us-aea-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/jquery-jvectormap-us-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/jquery-jvectormap-us-merc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/jquery-jvectormap-us-mill-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/jquery-jvectormap-world-mill-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ak-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-al-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ar-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-az-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ca-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-co-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ct-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-dc-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-de-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-fl-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ga-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-hi-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ia-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-id-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-il-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-in-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ks-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ky-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-la-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ma-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-md-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-me-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-mi-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-mn-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-mo-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ms-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-mt-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-nc-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-nd-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ne-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-nh-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-nj-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-nm-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-nv-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ny-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-oh-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ok-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-or-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-pa-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ri-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-sc-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-sd-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-tn-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-tx-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-ut-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-va-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-vt-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-wa-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-wi-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-wv-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/assets/us/jquery-jvectormap-data-us-wy-lcc-en.js
create mode 100644 public/bower_components/jvectormap/tests/basic.html
create mode 100644 public/bower_components/jvectormap/tests/build.html
create mode 100644 public/bower_components/jvectormap/tests/custom.html
create mode 100644 public/bower_components/jvectormap/tests/drill-down.html
create mode 100644 public/bower_components/jvectormap/tests/hidden.html
create mode 100644 public/bower_components/jvectormap/tests/markers.html
create mode 100644 public/bower_components/jvectormap/tests/memory.html
create mode 100644 public/bower_components/jvectormap/tests/processor/continents.json
create mode 100644 public/bower_components/jvectormap/tests/processor/continents_wb.json
create mode 100644 public/bower_components/jvectormap/tests/processor/france_regions_2016.json
create mode 100644 public/bower_components/jvectormap/tests/processor/russia.json
create mode 100644 public/bower_components/jvectormap/tests/processor/russia_fd.json
create mode 100644 public/bower_components/jvectormap/tests/processor/tz.json
create mode 100644 public/bower_components/jvectormap/tests/reverse-projection.html
create mode 100644 public/bower_components/jvectormap/tests/us.json
create mode 100644 public/bower_components/jvectormap/tests/world.json
(limited to 'public/bower_components/jvectormap')
diff --git a/public/bower_components/jvectormap/.bower.json b/public/bower_components/jvectormap/.bower.json
new file mode 100644
index 0000000..555a53c
--- /dev/null
+++ b/public/bower_components/jvectormap/.bower.json
@@ -0,0 +1,14 @@
+{
+ "name": "jvectormap",
+ "homepage": "https://github.com/bjornd/jvectormap",
+ "version": "2.0.4",
+ "_release": "2.0.4",
+ "_resolution": {
+ "type": "version",
+ "tag": "2.0.4",
+ "commit": "9cf8b5933c2b014f431101b618af30e8c476223f"
+ },
+ "_source": "https://github.com/bjornd/jvectormap.git",
+ "_target": "^2.0.4",
+ "_originalSource": "jvectormap"
+}
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/.gitignore b/public/bower_components/jvectormap/.gitignore
new file mode 100644
index 0000000..ec9b83a
--- /dev/null
+++ b/public/bower_components/jvectormap/.gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+jquery.jvectormap.min.js
diff --git a/public/bower_components/jvectormap/LICENSE-AGPL b/public/bower_components/jvectormap/LICENSE-AGPL
new file mode 100644
index 0000000..2def0e8
--- /dev/null
+++ b/public/bower_components/jvectormap/LICENSE-AGPL
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/LICENSE-COMMERCIAL b/public/bower_components/jvectormap/LICENSE-COMMERCIAL
new file mode 100644
index 0000000..e6ac398
--- /dev/null
+++ b/public/bower_components/jvectormap/LICENSE-COMMERCIAL
@@ -0,0 +1,16 @@
+Commercial license:
+- License does not expire.
+- Can be used on 1 site, unlimited servers
+- Source-code or binary products cannot be resold or distributed
+- Commercial use allowed
+- Can modify source-code but cannot distribute modifications (derivative works)
+Full licensing terms are avaialble at http://www.binpress.com/license/read/id/3085/app/2122
+
+
+Developer license:
+- License does not expire.
+- Can be distributed in unlimited projects
+- Can be distributed and / or packaged as a code or binary product (sublicensed)
+- Commercial use allowed
+- Can modify source-code but cannot distribute modifications (derivative works)
+Full licensing terms are avaialble at http://www.binpress.com/license/read/id/3086/app/2122
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/README.md b/public/bower_components/jvectormap/README.md
new file mode 100644
index 0000000..2272d87
--- /dev/null
+++ b/public/bower_components/jvectormap/README.md
@@ -0,0 +1,3 @@
+jVectorMap is a vector-based, cross-browser and cross-platform component for interactive geography-related data visualization on the web. It provides numerious features like smooth zooming and panning, fully-customizable styling, markers, labels and tooltips.
+
+You can find maps, documentation, examples and more at [the official site](http://jvectormap.com/)
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/build.sh b/public/bower_components/jvectormap/build.sh
new file mode 100755
index 0000000..c8ea5ed
--- /dev/null
+++ b/public/bower_components/jvectormap/build.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+files=( \
+ jquery-jvectormap.js \
+ lib/jquery-mousewheel.js \
+ src/jvectormap.js \
+ src/abstract-element.js \
+ src/abstract-canvas-element.js \
+ src/abstract-shape-element.js \
+ src/svg-element.js \
+ src/svg-group-element.js \
+ src/svg-canvas-element.js \
+ src/svg-shape-element.js \
+ src/svg-path-element.js \
+ src/svg-circle-element.js \
+ src/svg-image-element.js \
+ src/svg-text-element.js \
+ src/vml-element.js \
+ src/vml-group-element.js \
+ src/vml-canvas-element.js \
+ src/vml-shape-element.js \
+ src/vml-path-element.js \
+ src/vml-circle-element.js \
+ src/vector-canvas.js \
+ src/simple-scale.js \
+ src/ordinal-scale.js \
+ src/numeric-scale.js \
+ src/color-scale.js \
+ src/legend.js \
+ src/data-series.js \
+ src/proj.js \
+ src/map-object.js \
+ src/region.js \
+ src/marker.js \
+ src/map.js \
+ src/multimap.js \
+)
+
+baseDir=`dirname $0`
+
+counter=0
+while [ $counter -lt ${#files[@]} ]; do
+ files[$counter]="$baseDir/${files[$counter]}"
+ let counter=counter+1
+done
+
+if [ -z "$1" ]
+ then
+ minified=jquery.jvectormap.min.js
+ else
+ minified=$1
+fi
+
+if [ -a $minified ]
+ then
+ rm $minified
+fi
+
+cat ${files[*]} >> $minified
+
+uglifyjs $minified -o $minified -c
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/converter/converter.py b/public/bower_components/jvectormap/converter/converter.py
new file mode 100644
index 0000000..93be1de
--- /dev/null
+++ b/public/bower_components/jvectormap/converter/converter.py
@@ -0,0 +1,299 @@
+#
+# jVectorMap version 2.0.4
+#
+# Copyright 2011-2013, Kirill Lebedev
+#
+
+import sys
+import shapely.geometry
+import shapely.wkb
+import shapely.affinity
+from osgeo import ogr
+from osgeo import osr
+import json
+import codecs
+import copy
+
+class Map:
+ def __init__(self, name, language):
+ self.paths = {}
+ self.name = name
+ self.language = language
+ self.width = 0
+ self.height = 0
+ self.bbox = []
+
+ def addPath(self, path, code, name):
+ self.paths[code] = {"path": path, "name": name}
+
+ def getJSCode(self):
+ map = {"paths": self.paths, "width": self.width, "height": self.height, "insets": self.insets, "projection": self.projection}
+ return "jQuery.fn.vectorMap('addMap', '"+self.name+"_"+self.projection['type']+"_"+self.language+"',"+json.dumps(map)+');'
+
+
+class Converter:
+ def __init__(self, config):
+ args = {
+ 'buffer_distance': -0.4,
+ 'simplify_tolerance': 0.2,
+ 'longitude0': 0,
+ 'projection': 'mill',
+ 'name': 'world',
+ 'width': 900,
+ 'language': 'en',
+ 'precision': 2,
+ 'insets': []
+ }
+ args.update(config)
+
+ self.map = Map(args['name'], args.get('language'))
+
+ if args.get('sources'):
+ self.sources = args['sources']
+ else:
+ self.sources = [{
+ 'input_file': args.get('input_file'),
+ 'where': args.get('where'),
+ 'name_field': args.get('name_field'),
+ 'code_field': args.get('code_field'),
+ 'input_file_encoding': args.get('input_file_encoding')
+ }]
+
+ default_source = {
+ 'where': '',
+ 'name_field': 0,
+ 'code_field': 1,
+ 'input_file_encoding': 'iso-8859-1'
+ }
+
+ for index in range(len(self.sources)):
+ for key in default_source:
+ if self.sources[index].get(key) is None:
+ self.sources[index][key] = default_source[key]
+
+ self.features = {}
+ self.width = args.get('width')
+ self.minimal_area = args.get('minimal_area')
+ self.longitude0 = float(args.get('longitude0'))
+ self.projection = args.get('projection')
+ self.precision = args.get('precision')
+ self.buffer_distance = args.get('buffer_distance')
+ self.simplify_tolerance = args.get('simplify_tolerance')
+ self.for_each = args.get('for_each')
+ self.emulate_longitude0 = args.get('emulate_longitude0')
+ if args.get('emulate_longitude0') is None and (self.projection == 'merc' or self.projection =='mill') and self.longitude0 != 0:
+ self.emulate_longitude0 = True
+
+ if args.get('viewport'):
+ self.viewport = map(lambda s: float(s), args.get('viewport').split(' '))
+ else:
+ self.viewport = False
+
+ # spatial reference to convert to
+ self.spatialRef = osr.SpatialReference()
+ projString = '+proj='+str(self.projection)+' +a=6381372 +b=6381372 +lat_0=0'
+ if not self.emulate_longitude0:
+ projString += ' +lon_0='+str(self.longitude0)
+ self.spatialRef.ImportFromProj4(projString)
+
+ # handle map insets
+ if args.get('insets'):
+ self.insets = args.get('insets')
+ else:
+ self.insets = []
+
+ def loadData(self):
+ for sourceConfig in self.sources:
+ self.loadDataSource( sourceConfig )
+
+ def loadDataSource(self, sourceConfig):
+ source = ogr.Open( sourceConfig['input_file'] )
+ layer = source.GetLayer(0)
+ layer.SetAttributeFilter( sourceConfig['where'].encode('ascii') )
+ self.viewportRect = False
+
+ transformation = osr.CoordinateTransformation( layer.GetSpatialRef(), self.spatialRef )
+ if self.viewport:
+ layer.SetSpatialFilterRect( *self.viewport )
+ point1 = transformation.TransformPoint(self.viewport[0], self.viewport[1])
+ point2 = transformation.TransformPoint(self.viewport[2], self.viewport[3])
+ self.viewportRect = shapely.geometry.box(point1[0], point1[1], point2[0], point2[1])
+
+ layer.ResetReading()
+
+ codes = {}
+
+ if self.emulate_longitude0:
+ meridian = -180 + self.longitude0
+ p1 = transformation.TransformPoint(-180, 89)
+ p2 = transformation.TransformPoint(meridian, -89)
+ left = shapely.geometry.box(p1[0], p1[1], p2[0], p2[1])
+ p3 = transformation.TransformPoint(meridian, 89)
+ p4 = transformation.TransformPoint(180, -89)
+ right = shapely.geometry.box(p3[0], p3[1], p4[0], p4[1])
+
+ # load features
+ nextCode = 0
+ for feature in layer:
+ geometry = feature.GetGeometryRef()
+ geometryType = geometry.GetGeometryType()
+
+ if geometryType == ogr.wkbPolygon or geometryType == ogr.wkbMultiPolygon:
+ geometry.TransformTo( self.spatialRef )
+ shapelyGeometry = shapely.wkb.loads( geometry.ExportToWkb() )
+ if not shapelyGeometry.is_valid:
+ shapelyGeometry = shapelyGeometry.buffer(0, 1)
+
+ if self.emulate_longitude0:
+ leftPart = shapely.affinity.translate(shapelyGeometry.intersection(left), p4[0] - p3[0])
+ rightPart = shapely.affinity.translate(shapelyGeometry.intersection(right), p1[0] - p2[0])
+ shapelyGeometry = leftPart.buffer(0.1, 1).union(rightPart.buffer(0.1, 1)).buffer(-0.1, 1)
+
+ if not shapelyGeometry.is_valid:
+ shapelyGeometry = shapelyGeometry.buffer(0, 1)
+ shapelyGeometry = self.applyFilters(shapelyGeometry)
+ if shapelyGeometry:
+ name = feature.GetFieldAsString(str(sourceConfig.get('name_field'))).decode(sourceConfig.get('input_file_encoding'))
+ code = feature.GetFieldAsString(str(sourceConfig.get('code_field'))).decode(sourceConfig.get('input_file_encoding'))
+ if code in codes:
+ code = '_' + str(nextCode)
+ nextCode += 1
+ codes[code] = name
+ self.features[code] = {"geometry": shapelyGeometry, "name": name, "code": code}
+ else:
+ raise Exception, "Wrong geometry type: "+geometryType
+
+
+ def convert(self, outputFile):
+ print 'Generating '+outputFile
+
+ self.loadData()
+
+ codes = self.features.keys()
+ main_codes = copy.copy(codes)
+ self.map.insets = []
+ envelope = []
+ for inset in self.insets:
+ insetBbox = self.renderMapInset(inset['codes'], inset['left'], inset['top'], inset['width'])
+ insetHeight = (insetBbox[3] - insetBbox[1]) * (inset['width'] / (insetBbox[2] - insetBbox[0]))
+ self.map.insets.append({
+ "bbox": [{"x": insetBbox[0], "y": -insetBbox[3]}, {"x": insetBbox[2], "y": -insetBbox[1]}],
+ "left": inset['left'],
+ "top": inset['top'],
+ "width": inset['width'],
+ "height": insetHeight
+ })
+ envelope.append(
+ shapely.geometry.box(
+ inset['left'], inset['top'], inset['left'] + inset['width'], inset['top'] + insetHeight
+ )
+ )
+ for code in inset['codes']:
+ main_codes.remove(code)
+
+ insetBbox = self.renderMapInset(main_codes, 0, 0, self.width)
+ insetHeight = (insetBbox[3] - insetBbox[1]) * (self.width / (insetBbox[2] - insetBbox[0]))
+
+ envelope.append( shapely.geometry.box( 0, 0, self.width, insetHeight ) )
+ mapBbox = shapely.geometry.MultiPolygon( envelope ).bounds
+
+ self.map.width = mapBbox[2] - mapBbox[0]
+ self.map.height = mapBbox[3] - mapBbox[1]
+ self.map.insets.append({
+ "bbox": [{"x": insetBbox[0], "y": -insetBbox[3]}, {"x": insetBbox[2], "y": -insetBbox[1]}],
+ "left": 0,
+ "top": 0,
+ "width": self.width,
+ "height": insetHeight
+ })
+ self.map.projection = {"type": self.projection, "centralMeridian": float(self.longitude0)}
+
+ open(outputFile, 'w').write( self.map.getJSCode() )
+
+ if self.for_each is not None:
+ for code in codes:
+ childConfig = copy.deepcopy(self.for_each)
+ for param in ('input_file', 'output_file', 'where', 'name'):
+ childConfig[param] = childConfig[param].replace('{{code}}', code.lower())
+ converter = Converter(childConfig)
+ converter.convert(childConfig['output_file'])
+
+ def renderMapInset(self, codes, left, top, width):
+ envelope = []
+ for code in codes:
+ envelope.append( self.features[code]['geometry'].envelope )
+
+ bbox = shapely.geometry.MultiPolygon( envelope ).bounds
+
+ scale = (bbox[2]-bbox[0]) / width
+
+ # generate SVG paths
+ for code in codes:
+ feature = self.features[code]
+ geometry = feature['geometry']
+ if self.buffer_distance:
+ geometry = geometry.buffer(self.buffer_distance*scale, 1)
+ if geometry.is_empty:
+ continue
+ if self.simplify_tolerance:
+ geometry = geometry.simplify(self.simplify_tolerance*scale, preserve_topology=True)
+ if isinstance(geometry, shapely.geometry.multipolygon.MultiPolygon):
+ polygons = geometry.geoms
+ else:
+ polygons = [geometry]
+ path = ''
+ for polygon in polygons:
+ rings = []
+ rings.append(polygon.exterior)
+ rings.extend(polygon.interiors)
+ for ring in rings:
+ for pointIndex in range( len(ring.coords) ):
+ point = ring.coords[pointIndex]
+ if pointIndex == 0:
+ path += 'M'+str( round( (point[0]-bbox[0]) / scale + left, self.precision) )
+ path += ','+str( round( (bbox[3] - point[1]) / scale + top, self.precision) )
+ else:
+ path += 'l' + str( round(point[0]/scale - ring.coords[pointIndex-1][0]/scale, self.precision) )
+ path += ',' + str( round(ring.coords[pointIndex-1][1]/scale - point[1]/scale, self.precision) )
+ path += 'Z'
+ self.map.addPath(path, feature['code'], feature['name'])
+ return bbox
+
+
+ def applyFilters(self, geometry):
+ if self.viewportRect:
+ geometry = self.filterByViewport(geometry)
+ if not geometry:
+ return False
+ if self.minimal_area:
+ geometry = self.filterByMinimalArea(geometry)
+ if not geometry:
+ return False
+ return geometry
+
+
+ def filterByViewport(self, geometry):
+ try:
+ return geometry.intersection(self.viewportRect)
+ except shapely.geos.TopologicalError:
+ return False
+
+
+ def filterByMinimalArea(self, geometry):
+ if isinstance(geometry, shapely.geometry.multipolygon.MultiPolygon):
+ polygons = geometry.geoms
+ else:
+ polygons = [geometry]
+ polygons = filter(lambda p: p.area > self.minimal_area, polygons)
+ return shapely.geometry.multipolygon.MultiPolygon(polygons)
+
+
+args = {}
+if len(sys.argv) > 1:
+ paramsJson = open(sys.argv[1], 'r').read()
+else:
+ paramsJson = sys.stdin.read()
+paramsJson = json.loads(paramsJson)
+
+converter = Converter(paramsJson)
+converter.convert(paramsJson['output_file'])
diff --git a/public/bower_components/jvectormap/converter/processor.py b/public/bower_components/jvectormap/converter/processor.py
new file mode 100644
index 0000000..a583798
--- /dev/null
+++ b/public/bower_components/jvectormap/converter/processor.py
@@ -0,0 +1,573 @@
+import sys
+import json
+import csv
+import shapely.wkb
+import shapely.geometry
+import shapely.ops
+import codecs
+import os
+import inspect
+import copy
+from osgeo import ogr
+from osgeo import osr
+from booleano.parser import Grammar, EvaluableParseManager, SymbolTable, Bind
+from booleano.operations import Variable
+
+
+class Map:
+ def __init__(self, name, language):
+ self.paths = {}
+ self.name = name
+ self.language = language
+ self.width = 0
+ self.height = 0
+ self.bbox = []
+
+ def addPath(self, path, code, name):
+ self.paths[code] = {"path": path, "name": name}
+
+ def getJSCode(self):
+ map = {"paths": self.paths, "width": self.width, "height": self.height, "insets": self.insets, "projection": self.projection}
+ return "jQuery.fn.vectorMap('addMap', '"+self.name+"_"+self.projection['type']+"',"+json.dumps(map)+');'
+
+
+class Converter:
+ def __init__(self, config):
+ args = {
+ 'buffer_distance': -0.4,
+ 'simplify_tolerance': 0.2,
+ 'longitude0': 0,
+ 'projection': 'mill',
+ 'name': 'world',
+ 'width': 900,
+ 'left': 0,
+ 'top': 0,
+ 'language': 'en',
+ 'precision': 2,
+ 'insets': []
+ }
+ args.update(config)
+
+ self.config = args
+
+ self.map = Map(args['name'], args.get('language'))
+
+ if args.get('sources'):
+ self.sources = args['sources']
+ else:
+ self.sources = [{
+ 'input_file': args.get('input_file'),
+ 'where': args.get('where'),
+ 'name_field': args.get('name_field'),
+ 'code_field': args.get('code_field'),
+ 'input_file_encoding': args.get('input_file_encoding')
+ }]
+
+ default_source = {
+ 'where': '',
+ 'name_field': 0,
+ 'code_field': 1,
+ 'input_file_encoding': 'iso-8859-1'
+ }
+
+ for index in range(len(self.sources)):
+ for key in default_source:
+ if self.sources[index].get(key) is None:
+ self.sources[index][key] = default_source[key]
+
+ self.features = {}
+ self.width = args.get('width')
+ self.left = args.get('left')
+ self.top = args.get('top')
+ self.minimal_area = args.get('minimal_area')
+ self.longitude0 = float(args.get('longitude0'))
+ self.projection = args.get('projection')
+ self.precision = args.get('precision')
+ self.buffer_distance = args.get('buffer_distance')
+ self.simplify_tolerance = args.get('simplify_tolerance')
+ self.for_each = args.get('for_each')
+ self.emulate_longitude0 = args.get('emulate_longitude0')
+ if args.get('emulate_longitude0') is None and (self.projection == 'merc' or self.projection =='mill') and self.longitude0 != 0:
+ self.emulate_longitude0 = True
+
+ if args.get('viewport'):
+ self.viewport = map(lambda s: float(s), args.get('viewport').split(' '))
+ else:
+ self.viewport = False
+
+ # spatial reference to convert to
+ self.spatialRef = osr.SpatialReference()
+ projString = '+proj='+str(self.projection)+' +a=6381372 +b=6381372 +lat_0=0'
+ if not self.emulate_longitude0:
+ projString += ' +lon_0='+str(self.longitude0)
+ self.spatialRef.ImportFromProj4(projString)
+
+ # handle map insets
+ if args.get('insets'):
+ self.insets = args.get('insets')
+ else:
+ self.insets = []
+
+
+ def convert(self, data_source, output_file):
+ codes = map(lambda g: g.properties[self.config['code_field']], data_source.geometries)
+ main_codes = copy.copy(codes)
+ self.map.insets = []
+ envelope = []
+ for inset in self.insets:
+ insetBbox = self.renderMapInset(data_source, inset['codes'], inset['left'], inset['top'], inset['width'])
+ insetHeight = (insetBbox[3] - insetBbox[1]) * (inset['width'] / (insetBbox[2] - insetBbox[0]))
+ self.map.insets.append({
+ "bbox": [{"x": insetBbox[0], "y": -insetBbox[3]}, {"x": insetBbox[2], "y": -insetBbox[1]}],
+ "left": inset['left'],
+ "top": inset['top'],
+ "width": inset['width'],
+ "height": insetHeight
+ })
+ envelope.append(
+ shapely.geometry.box(
+ inset['left'], inset['top'], inset['left'] + inset['width'], inset['top'] + insetHeight
+ )
+ )
+ for code in inset['codes']:
+ main_codes.remove(code)
+
+ insetBbox = self.renderMapInset(data_source, main_codes, self.left, self.top, self.width)
+ insetHeight = (insetBbox[3] - insetBbox[1]) * (self.width / (insetBbox[2] - insetBbox[0]))
+ envelope.append( shapely.geometry.box( self.left, self.top, self.left + self.width, self.top + insetHeight ) )
+ mapBbox = shapely.geometry.MultiPolygon( envelope ).bounds
+
+ self.map.width = mapBbox[2] + mapBbox[0]
+ self.map.height = mapBbox[3] + mapBbox[1]
+ self.map.insets.append({
+ "bbox": [{"x": insetBbox[0], "y": -insetBbox[3]}, {"x": insetBbox[2], "y": -insetBbox[1]}],
+ "left": self.left,
+ "top": self.top,
+ "width": self.width,
+ "height": insetHeight
+ })
+ self.map.projection = {"type": self.projection, "centralMeridian": float(self.longitude0)}
+
+ open(output_file, 'w').write( self.map.getJSCode() )
+
+ if self.for_each is not None:
+ for code in codes:
+ childConfig = copy.deepcopy(self.for_each)
+ for param in ('input_file', 'output_file', 'where', 'name'):
+ childConfig[param] = childConfig[param].replace('{{code}}', code.lower())
+ converter = Converter(childConfig)
+ converter.convert(childConfig['output_file'])
+
+ def renderMapInset(self, data_source, codes, left, top, width):
+ envelope = []
+ geometries = filter(lambda g: g.properties[self.config['code_field']] in codes, data_source.geometries)
+ for geometry in geometries:
+ envelope.append( geometry.geom.envelope )
+
+ bbox = shapely.geometry.MultiPolygon( envelope ).bounds
+
+ scale = (bbox[2]-bbox[0]) / width
+
+ # generate SVG paths
+ for geometry in geometries:
+ geom = geometry.geom
+ if self.buffer_distance:
+ geom = geom.buffer(self.buffer_distance*scale, 1)
+ if geom.is_empty:
+ continue
+ if self.simplify_tolerance:
+ geom = geom.simplify(self.simplify_tolerance*scale, preserve_topology=True)
+ if isinstance(geom, shapely.geometry.multipolygon.MultiPolygon):
+ polygons = geom.geoms
+ else:
+ polygons = [geom]
+ path = ''
+ for polygon in polygons:
+ rings = []
+ rings.append(polygon.exterior)
+ rings.extend(polygon.interiors)
+ for ring in rings:
+ for pointIndex in range( len(ring.coords) ):
+ point = ring.coords[pointIndex]
+ if pointIndex == 0:
+ path += 'M'+str( round( (point[0]-bbox[0]) / scale + left, self.precision) )
+ path += ','+str( round( (bbox[3] - point[1]) / scale + top, self.precision) )
+ else:
+ path += 'l' + str( round(point[0]/scale - ring.coords[pointIndex-1][0]/scale, self.precision) )
+ path += ',' + str( round(ring.coords[pointIndex-1][1]/scale - point[1]/scale, self.precision) )
+ path += 'Z'
+ self.map.addPath(path, geometry.properties[self.config['code_field']], geometry.properties[self.config['name_field']])
+ return bbox
+
+
+class Geometry:
+ def __init__(self, geometry, properties):
+ self.geom = geometry
+ self.properties = properties
+
+
+class GeometryProperty(Variable):
+ operations = set(["equality", "membership"])
+
+ def __init__(self, name):
+ self.name = name
+
+ def equals(self, value, context):
+ return context[self.name] == value
+
+ def belongs_to(self, value, context):
+ return value in context[self.name]
+
+ def is_subset(self, value, context):
+ return set(value).issubset(set(context[self.name]))
+
+ def to_python(self, value):
+ return unicode(value[self.name])
+
+
+class DataSource:
+ def __init__(self, config):
+ default_config = {
+ "projection": "merc",
+ "longitude0": 0
+ }
+ default_config.update(config)
+ self.config = default_config
+
+ self.spatialRef = osr.SpatialReference()
+ projString = '+proj='+str(self.config['projection'])+' +a=6381372 +b=6381372 +lat_0=0'
+ #if 'emulate_longitude0' in self.config and not self.config['emulate_longitude0']:
+ projString += ' +lon_0='+str(self.config['longitude0'])
+ self.spatialRef.ImportFromProj4(projString)
+
+ def load_data(self):
+ self.source = ogr.Open( self.config['file_name'], update = 0 )
+ self.layer = self.source.GetLayer(0)
+ if 'filter' in self.config and self.config['filter'] is not None:
+ self.layer.SetAttributeFilter( self.config['filter'].encode('ascii') )
+ self.layer_dfn = self.layer.GetLayerDefn()
+
+ self.fields = []
+ field_count = self.layer_dfn.GetFieldCount()
+ for field_index in range(field_count):
+ field = self.layer_dfn.GetFieldDefn( field_index )
+ self.fields.append({
+ 'name': field.GetName(),
+ 'type': field.GetType(),
+ 'width': field.GetWidth(),
+ 'precision': field.GetPrecision()
+ })
+
+ self.geometries = []
+
+ for feature in self.layer:
+ geometry = feature.GetGeometryRef()
+ geometry.TransformTo( self.spatialRef )
+ geometry = shapely.wkb.loads( geometry.ExportToWkb() )
+ if not geometry.is_valid:
+ geometry = geometry.buffer(0)
+ properties = {}
+ for field in self.fields:
+ properties[field['name']] = feature.GetFieldAsString(field['name']).decode('utf-8')
+ self.geometries.append( Geometry(geometry, properties) )
+
+ self.layer.ResetReading()
+
+ self.create_grammar()
+
+ def create_grammar(self):
+ root_table = SymbolTable("root",
+ map( lambda f: Bind(f['name'], GeometryProperty(f['name'])), self.fields )
+ )
+
+ tokens = {
+ 'not': 'not',
+ 'eq': '==',
+ 'ne': '!=',
+ 'belongs_to': 'in',
+ 'is_subset': 'are included in',
+ 'or': "or",
+ 'and': 'and'
+ }
+ grammar = Grammar(**tokens)
+ self.parse_manager = EvaluableParseManager(root_table, grammar)
+
+ def output(self, output):
+ if output.get('format') == 'jvectormap':
+ self.output_jvm(output)
+ else:
+ self.output_ogr(output)
+
+ def output_ogr(self, output):
+ driver = ogr.GetDriverByName( 'ESRI Shapefile' )
+ if os.path.exists( output['file_name'] ):
+ driver.DeleteDataSource( output['file_name'] )
+ source = driver.CreateDataSource( output['file_name'] )
+ layer = source.CreateLayer( self.layer_dfn.GetName(),
+ geom_type = self.layer_dfn.GetGeomType(),
+ srs = self.layer.GetSpatialRef() )
+
+ for field in self.fields:
+ fd = ogr.FieldDefn( str(field['name']), field['type'] )
+ fd.SetWidth( field['width'] )
+ if 'precision' in field:
+ fd.SetPrecision( field['precision'] )
+ layer.CreateField( fd )
+
+ for geometry in self.geometries:
+ if geometry.geom is not None:
+ feature = ogr.Feature( feature_def = layer.GetLayerDefn() )
+ for index, field in enumerate(self.fields):
+ if field['name'] in geometry.properties:
+ feature.SetField( index, geometry.properties[field['name']].encode('utf-8') )
+ else:
+ feature.SetField( index, '' )
+ feature.SetGeometryDirectly(
+ ogr.CreateGeometryFromWkb(
+ shapely.wkb.dumps(
+ geometry.geom
+ )
+ )
+ )
+ layer.CreateFeature( feature )
+ feature.Destroy()
+
+ source.Destroy()
+
+ def output_jvm(self, output):
+ params = copy.deepcopy(output['params'])
+ params.update({
+ "projection": self.config["projection"],
+ "longitude0": self.config["longitude0"]
+ })
+ converter = Converter(params)
+ converter.convert(self, output['file_name'])
+
+class PolygonSimplifier:
+ def __init__(self, geometries):
+ self.format = '%.8f %.8f'
+ self.tolerance = 0.05
+ self.geometries = geometries
+
+ connections = {}
+ counter = 0
+ for geom in geometries:
+ counter += 1
+ polygons = []
+
+ if isinstance(geom, shapely.geometry.Polygon):
+ polygons.append(geom)
+ else:
+ for polygon in geom:
+ polygons.append(polygon)
+
+ for polygon in polygons:
+ if polygon.area > 0:
+ lines = []
+ lines.append(polygon.exterior)
+ for line in polygon.interiors:
+ lines.append(line)
+
+ for line in lines:
+ for i in range(len(line.coords)-1):
+ indexFrom = i
+ indexTo = i+1
+ pointFrom = self.format % line.coords[indexFrom]
+ pointTo = self.format % line.coords[indexTo]
+ if pointFrom == pointTo:
+ continue
+ if not (pointFrom in connections):
+ connections[pointFrom] = {}
+ connections[pointFrom][pointTo] = 1
+ if not (pointTo in connections):
+ connections[pointTo] = {}
+ connections[pointTo][pointFrom] = 1
+ self.connections = connections
+ self.simplifiedLines = {}
+ self.pivotPoints = {}
+
+ def simplifyRing(self, ring):
+ coords = list(ring.coords)[0:-1]
+ simpleCoords = []
+
+ isPivot = False
+ pointIndex = 0
+ while not isPivot and pointIndex < len(coords):
+ pointStr = self.format % coords[pointIndex]
+ pointIndex += 1
+ isPivot = ((len(self.connections[pointStr]) > 2) or (pointStr in self.pivotPoints))
+ pointIndex = pointIndex - 1
+
+ if not isPivot:
+ simpleRing = shapely.geometry.LineString(coords).simplify(self.tolerance)
+ if len(simpleRing.coords) <= 2:
+ return None
+ else:
+ self.pivotPoints[self.format % coords[0]] = True
+ self.pivotPoints[self.format % coords[-1]] = True
+ simpleLineKey = self.format % coords[0]+':'+self.format % coords[1]+':'+self.format % coords[-1]
+ self.simplifiedLines[simpleLineKey] = simpleRing.coords
+ return simpleRing
+ else:
+ points = coords[pointIndex:len(coords)]
+ points.extend(coords[0:pointIndex+1])
+ iFrom = 0
+ for i in range(1, len(points)):
+ pointStr = self.format % points[i]
+ if ((len(self.connections[pointStr]) > 2) or (pointStr in self.pivotPoints)):
+ line = points[iFrom:i+1]
+ lineKey = self.format % line[-1]+':'+self.format % line[-2]+':'+self.format % line[0]
+ if lineKey in self.simplifiedLines:
+ simpleLine = self.simplifiedLines[lineKey]
+ simpleLine = list(reversed(simpleLine))
+ else:
+ simpleLine = shapely.geometry.LineString(line).simplify(self.tolerance).coords
+ lineKey = self.format % line[0]+':'+self.format % line[1]+':'+self.format % line[-1]
+ self.simplifiedLines[lineKey] = simpleLine
+ simpleCoords.extend( simpleLine[0:-1] )
+ iFrom = i
+ if len(simpleCoords) <= 2:
+ return None
+ else:
+ return shapely.geometry.LineString(simpleCoords)
+
+ def simplifyPolygon(self, polygon):
+ simpleExtRing = self.simplifyRing(polygon.exterior)
+ if simpleExtRing is None:
+ return None
+ simpleIntRings = []
+ for ring in polygon.interiors:
+ simpleIntRing = self.simplifyRing(ring)
+ if simpleIntRing is not None:
+ simpleIntRings.append(simpleIntRing)
+ return shapely.geometry.Polygon(simpleExtRing, simpleIntRings)
+
+ def simplify(self):
+ results = []
+ for geom in self.geometries:
+ polygons = []
+ simplePolygons = []
+
+ if isinstance(geom, shapely.geometry.Polygon):
+ polygons.append(geom)
+ else:
+ for polygon in geom:
+ polygons.append(polygon)
+
+ for polygon in polygons:
+ simplePolygon = self.simplifyPolygon(polygon)
+ if not (simplePolygon is None or simplePolygon._geom is None):
+ simplePolygons.append(simplePolygon)
+
+ if len(simplePolygons) > 0:
+ results.append(shapely.geometry.MultiPolygon(simplePolygons))
+ else:
+ results.append(None)
+ return results
+
+
+class Processor:
+ def __init__(self, config):
+ self.config = config
+
+ def process(self):
+ self.data_sources = {}
+ for action in self.config:
+ getattr(self, action['name'])( action, self.data_sources.get(".") )
+
+ def read_data(self, config, data_source):
+ self.data_sources["."] = DataSource( config )
+ self.data_sources["."].load_data()
+
+ def write_data(self, config, data_source):
+ data_source.output( config )
+
+ def union(self, config, data_source):
+ groups = {}
+ geometries = []
+ for geometry in data_source.geometries:
+ if geometry.properties[config['by']] in groups:
+ groups[geometry.properties[config['by']]]['geoms'].append(geometry.geom)
+ else:
+ groups[geometry.properties[config['by']]] = {
+ 'geoms': [geometry.geom],
+ 'properties': geometry.properties
+ }
+ for key in groups:
+ geometries.append( Geometry(shapely.ops.cascaded_union( groups[key]['geoms'] ), groups[key]['properties']) )
+ data_source.geometries = geometries
+
+ def merge(self, config, data_source):
+ new_geometries = []
+ for rule in config['rules']:
+ expression = data_source.parse_manager.parse( rule['where'] )
+ geometries = filter(lambda g: expression(g.properties), data_source.geometries)
+ geometries = map(lambda g: g.geom, geometries)
+ new_geometries.append( Geometry(shapely.ops.cascaded_union( geometries ), rule['fields']) )
+ data_source.fields = config['fields']
+ data_source.geometries = new_geometries
+
+ def join_data(self, config, data_source):
+ field_names = [f['name'] for f in config['fields']]
+ if 'data' in config:
+ data_col = config['data']
+ else:
+ data_file = open(config['file_name'], 'rb')
+ data_col = csv.reader(data_file, delimiter='\t', quotechar='"')
+ data = {}
+ for row in data_col:
+ row_dict = dict(zip(field_names, row))
+ data[row_dict.pop(config['on'])] = row_dict
+ for geometry in data_source.geometries:
+ if geometry.properties[config['on']] in data:
+ geometry.properties.update( data[geometry.properties[config['on']]] )
+ field_names = map(lambda f: f['name'], data_source.fields)
+ data_source.fields = data_source.fields + filter(lambda f: f['name'] not in field_names, config['fields'])
+
+ def remove(self, config, data_source):
+ expression = data_source.parse_manager.parse( config['where'] )
+ data_source.geometries = filter(lambda g: not expression(g.properties), data_source.geometries)
+
+ def remove_fields(self, config, data_source):
+ data_source.fields = filter(lambda f: f.name not in config['fields'], data_source.fields)
+
+ def remove_other_fields(self, config, data_source):
+ data_source.fields = filter(lambda f: f['name'] in config['fields'], data_source.fields)
+
+ def buffer(self, config, data_source):
+ for geometry in data_source.geometries:
+ geometry.geom = geometry.geom.buffer(config['distance'], config['resolution'])
+
+ def simplify_adjancent_polygons(self, config, data_source):
+ simple_geometries = PolygonSimplifier( map( lambda g: g.geom, data_source.geometries ) ).simplify()
+ for i in range(len(data_source.geometries)):
+ data_source.geometries[i].geom = simple_geometries[i]
+
+ def intersect_rect(self, config, data_source):
+ transform = osr.CoordinateTransformation( data_source.layer.GetSpatialRef(), data_source.spatialRef )
+ point1 = transform.TransformPoint(config['rect'][0], config['rect'][1])
+ point2 = transform.TransformPoint(config['rect'][2], config['rect'][3])
+ rect = shapely.geometry.box(point1[0], point1[1], point2[0], point2[1])
+ for geometry in data_source.geometries:
+ geometry.geom = geometry.geom.intersection(rect)
+
+ def remove_small_polygons(self, config, data_source):
+ for geometry in data_source.geometries:
+ if isinstance(geometry.geom, shapely.geometry.multipolygon.MultiPolygon):
+ polygons = geometry.geom.geoms
+ else:
+ polygons = [geometry.geom]
+ polygons = filter(lambda p: p.area > config['minimal_area'], polygons)
+ if len(polygons) > 0:
+ geometry.geom = shapely.geometry.multipolygon.MultiPolygon(polygons)
+
+
+args = {}
+if len(sys.argv) > 1:
+ paramsJson = open(sys.argv[1], 'r').read()
+else:
+ paramsJson = sys.stdin.read()
+paramsJson = json.loads(paramsJson)
+
+processor = Processor(paramsJson)
+processor.process()
diff --git a/public/bower_components/jvectormap/converter/simplifier.py b/public/bower_components/jvectormap/converter/simplifier.py
new file mode 100644
index 0000000..18ad9da
--- /dev/null
+++ b/public/bower_components/jvectormap/converter/simplifier.py
@@ -0,0 +1,205 @@
+import argparse
+import sys
+import os
+from osgeo import ogr
+from osgeo import osr
+import anyjson
+import shapely.geometry
+import shapely.ops
+import codecs
+import time
+
+
+format = '%.8f %.8f'
+tolerance = 0.01
+infile = '/Users/kirilllebedev/Maps/50m-admin-0-countries/ne_50m_admin_0_countries.shp'
+outfile = 'map.shp'
+
+# Open the datasource to operate on.
+in_ds = ogr.Open( infile, update = 0 )
+in_layer = in_ds.GetLayer( 0 )
+in_defn = in_layer.GetLayerDefn()
+
+
+# Create output file with similar information.
+shp_driver = ogr.GetDriverByName( 'ESRI Shapefile' )
+if os.path.exists('map.shp'):
+ shp_driver.DeleteDataSource( outfile )
+shp_ds = shp_driver.CreateDataSource( outfile )
+shp_layer = shp_ds.CreateLayer( in_defn.GetName(),
+ geom_type = in_defn.GetGeomType(),
+ srs = in_layer.GetSpatialRef() )
+
+in_field_count = in_defn.GetFieldCount()
+for fld_index in range(in_field_count):
+ src_fd = in_defn.GetFieldDefn( fld_index )
+ fd = ogr.FieldDefn( src_fd.GetName(), src_fd.GetType() )
+ fd.SetWidth( src_fd.GetWidth() )
+ fd.SetPrecision( src_fd.GetPrecision() )
+ shp_layer.CreateField( fd )
+
+
+# Load geometries
+geometries = []
+for feature in in_layer:
+ geometry = feature.GetGeometryRef()
+ geometryType = geometry.GetGeometryType()
+
+ if geometryType == ogr.wkbPolygon or geometryType == ogr.wkbMultiPolygon:
+ shapelyGeometry = shapely.wkb.loads( geometry.ExportToWkb() )
+ #if not shapelyGeometry.is_valid:
+ #buffer to fix selfcrosses
+ #shapelyGeometry = shapelyGeometry.buffer(0)
+ if shapelyGeometry:
+ geometries.append(shapelyGeometry)
+in_layer.ResetReading()
+
+start = int(round(time.time() * 1000))
+# Simplification
+points = []
+connections = {}
+counter = 0
+for geom in geometries:
+ counter += 1
+ polygons = []
+
+ if isinstance(geom, shapely.geometry.Polygon):
+ polygons.append(geom)
+ else:
+ for polygon in geom:
+ polygons.append(polygon)
+
+ for polygon in polygons:
+ if polygon.area > 0:
+ lines = []
+ lines.append(polygon.exterior)
+ for line in polygon.interiors:
+ lines.append(line)
+
+ for line in lines:
+ for i in range(len(line.coords)-1):
+ indexFrom = i
+ indexTo = i+1
+ pointFrom = format % line.coords[indexFrom]
+ pointTo = format % line.coords[indexTo]
+ if pointFrom == pointTo:
+ continue
+ if not (pointFrom in connections):
+ connections[pointFrom] = {}
+ connections[pointFrom][pointTo] = 1
+ if not (pointTo in connections):
+ connections[pointTo] = {}
+ connections[pointTo][pointFrom] = 1
+print int(round(time.time() * 1000)) - start
+
+simplifiedLines = {}
+pivotPoints = {}
+def simplifyRing(ring):
+ coords = list(ring.coords)[0:-1]
+ simpleCoords = []
+
+ isPivot = False
+ pointIndex = 0
+ while not isPivot and pointIndex < len(coords):
+ pointStr = format % coords[pointIndex]
+ pointIndex += 1
+ isPivot = ((len(connections[pointStr]) > 2) or (pointStr in pivotPoints))
+ pointIndex = pointIndex - 1
+
+ if not isPivot:
+ simpleRing = shapely.geometry.LineString(coords).simplify(tolerance)
+ if len(simpleRing.coords) <= 2:
+ return None
+ else:
+ pivotPoints[format % coords[0]] = True
+ pivotPoints[format % coords[-1]] = True
+ simpleLineKey = format % coords[0]+':'+format % coords[1]+':'+format % coords[-1]
+ simplifiedLines[simpleLineKey] = simpleRing.coords
+ return simpleRing
+ else:
+ points = coords[pointIndex:len(coords)]
+ points.extend(coords[0:pointIndex+1])
+ iFrom = 0
+ for i in range(1, len(points)):
+ pointStr = format % points[i]
+ if ((len(connections[pointStr]) > 2) or (pointStr in pivotPoints)):
+ line = points[iFrom:i+1]
+ lineKey = format % line[-1]+':'+format % line[-2]+':'+format % line[0]
+ if lineKey in simplifiedLines:
+ simpleLine = simplifiedLines[lineKey]
+ simpleLine = list(reversed(simpleLine))
+ else:
+ simpleLine = shapely.geometry.LineString(line).simplify(tolerance).coords
+ lineKey = format % line[0]+':'+format % line[1]+':'+format % line[-1]
+ simplifiedLines[lineKey] = simpleLine
+ simpleCoords.extend( simpleLine[0:-1] )
+ iFrom = i
+ if len(simpleCoords) <= 2:
+ return None
+ else:
+ return shapely.geometry.LineString(simpleCoords)
+
+
+def simplifyPolygon(polygon):
+ simpleExtRing = simplifyRing(polygon.exterior)
+ if simpleExtRing is None:
+ return None
+ simpleIntRings = []
+ for ring in polygon.interiors:
+ simpleIntRing = simplifyRing(ring)
+ if simpleIntRing is not None:
+ simpleIntRings.append(simpleIntRing)
+ return shapely.geometry.Polygon(simpleExtRing, simpleIntRings)
+
+
+results = []
+for geom in geometries:
+ polygons = []
+ simplePolygons = []
+
+ if isinstance(geom, shapely.geometry.Polygon):
+ polygons.append(geom)
+ else:
+ for polygon in geom:
+ polygons.append(polygon)
+
+ for polygon in polygons:
+ simplePolygon = simplifyPolygon(polygon)
+ if not (simplePolygon is None or simplePolygon._geom is None):
+ simplePolygons.append(simplePolygon)
+
+ if len(simplePolygons) > 0:
+ results.append(shapely.geometry.MultiPolygon(simplePolygons))
+ else:
+ results.append(None)
+
+
+# Process all features in input layer.
+in_feat = in_layer.GetNextFeature()
+counter = 0
+while in_feat is not None:
+ if results[counter] is not None:
+ out_feat = ogr.Feature( feature_def = shp_layer.GetLayerDefn() )
+ out_feat.SetFrom( in_feat )
+ out_feat.SetGeometryDirectly(
+ ogr.CreateGeometryFromWkb(
+ shapely.wkb.dumps(
+ results[counter]
+ )
+ )
+ )
+ shp_layer.CreateFeature( out_feat )
+ out_feat.Destroy()
+ else:
+ print 'geometry is too small: '+in_feat.GetField(16)
+
+ in_feat.Destroy()
+ in_feat = in_layer.GetNextFeature()
+ counter += 1
+
+
+# Cleanup
+shp_ds.Destroy()
+in_ds.Destroy()
+
+print int(round(time.time() * 1000)) - start
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/jquery-jvectormap.css b/public/bower_components/jvectormap/jquery-jvectormap.css
new file mode 100644
index 0000000..1cac4ac
--- /dev/null
+++ b/public/bower_components/jvectormap/jquery-jvectormap.css
@@ -0,0 +1,135 @@
+svg {
+ touch-action: none;
+}
+
+.jvectormap-container {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ overflow: hidden;
+ touch-action: none;
+}
+
+.jvectormap-tip {
+ position: absolute;
+ display: none;
+ border: solid 1px #CDCDCD;
+ border-radius: 3px;
+ background: #292929;
+ color: white;
+ font-family: sans-serif, Verdana;
+ font-size: smaller;
+ padding: 3px;
+}
+
+.jvectormap-zoomin, .jvectormap-zoomout, .jvectormap-goback {
+ position: absolute;
+ left: 10px;
+ border-radius: 3px;
+ background: #292929;
+ padding: 3px;
+ color: white;
+ cursor: pointer;
+ line-height: 10px;
+ text-align: center;
+ box-sizing: content-box;
+}
+
+.jvectormap-zoomin, .jvectormap-zoomout {
+ width: 10px;
+ height: 10px;
+}
+
+.jvectormap-zoomin {
+ top: 10px;
+}
+
+.jvectormap-zoomout {
+ top: 30px;
+}
+
+.jvectormap-goback {
+ bottom: 10px;
+ z-index: 1000;
+ padding: 6px;
+}
+
+.jvectormap-spinner {
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ background: center no-repeat url(data:image/gif;base64,R0lGODlhIAAgAPMAAP///wAAAMbGxoSEhLa2tpqamjY2NlZWVtjY2OTk5Ly8vB4eHgQEBAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNaGmLHT0VnOgSYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ/V/nmOM82XiHRLYKhKP1oZmADdEAAAh+QQJCgAAACwAAAAAIAAgAAAE6hDISWlZpOrNp1lGNRSdRpDUolIGw5RUYhhHukqFu8DsrEyqnWThGvAmhVlteBvojpTDDBUEIFwMFBRAmBkSgOrBFZogCASwBDEY/CZSg7GSE0gSCjQBMVG023xWBhklAnoEdhQEfyNqMIcKjhRsjEdnezB+A4k8gTwJhFuiW4dokXiloUepBAp5qaKpp6+Ho7aWW54wl7obvEe0kRuoplCGepwSx2jJvqHEmGt6whJpGpfJCHmOoNHKaHx61WiSR92E4lbFoq+B6QDtuetcaBPnW6+O7wDHpIiK9SaVK5GgV543tzjgGcghAgAh+QQJCgAAACwAAAAAIAAgAAAE7hDISSkxpOrN5zFHNWRdhSiVoVLHspRUMoyUakyEe8PTPCATW9A14E0UvuAKMNAZKYUZCiBMuBakSQKG8G2FzUWox2AUtAQFcBKlVQoLgQReZhQlCIJesQXI5B0CBnUMOxMCenoCfTCEWBsJColTMANldx15BGs8B5wlCZ9Po6OJkwmRpnqkqnuSrayqfKmqpLajoiW5HJq7FL1Gr2mMMcKUMIiJgIemy7xZtJsTmsM4xHiKv5KMCXqfyUCJEonXPN2rAOIAmsfB3uPoAK++G+w48edZPK+M6hLJpQg484enXIdQFSS1u6UhksENEQAAIfkECQoAAAAsAAAAACAAIAAABOcQyEmpGKLqzWcZRVUQnZYg1aBSh2GUVEIQ2aQOE+G+cD4ntpWkZQj1JIiZIogDFFyHI0UxQwFugMSOFIPJftfVAEoZLBbcLEFhlQiqGp1Vd140AUklUN3eCA51C1EWMzMCezCBBmkxVIVHBWd3HHl9JQOIJSdSnJ0TDKChCwUJjoWMPaGqDKannasMo6WnM562R5YluZRwur0wpgqZE7NKUm+FNRPIhjBJxKZteWuIBMN4zRMIVIhffcgojwCF117i4nlLnY5ztRLsnOk+aV+oJY7V7m76PdkS4trKcdg0Zc0tTcKkRAAAIfkECQoAAAAsAAAAACAAIAAABO4QyEkpKqjqzScpRaVkXZWQEximw1BSCUEIlDohrft6cpKCk5xid5MNJTaAIkekKGQkWyKHkvhKsR7ARmitkAYDYRIbUQRQjWBwJRzChi9CRlBcY1UN4g0/VNB0AlcvcAYHRyZPdEQFYV8ccwR5HWxEJ02YmRMLnJ1xCYp0Y5idpQuhopmmC2KgojKasUQDk5BNAwwMOh2RtRq5uQuPZKGIJQIGwAwGf6I0JXMpC8C7kXWDBINFMxS4DKMAWVWAGYsAdNqW5uaRxkSKJOZKaU3tPOBZ4DuK2LATgJhkPJMgTwKCdFjyPHEnKxFCDhEAACH5BAkKAAAALAAAAAAgACAAAATzEMhJaVKp6s2nIkolIJ2WkBShpkVRWqqQrhLSEu9MZJKK9y1ZrqYK9WiClmvoUaF8gIQSNeF1Er4MNFn4SRSDARWroAIETg1iVwuHjYB1kYc1mwruwXKC9gmsJXliGxc+XiUCby9ydh1sOSdMkpMTBpaXBzsfhoc5l58Gm5yToAaZhaOUqjkDgCWNHAULCwOLaTmzswadEqggQwgHuQsHIoZCHQMMQgQGubVEcxOPFAcMDAYUA85eWARmfSRQCdcMe0zeP1AAygwLlJtPNAAL19DARdPzBOWSm1brJBi45soRAWQAAkrQIykShQ9wVhHCwCQCACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiRMDjI0Fd30/iI2UA5GSS5UDj2l6NoqgOgN4gksEBgYFf0FDqKgHnyZ9OX8HrgYHdHpcHQULXAS2qKpENRg7eAMLC7kTBaixUYFkKAzWAAnLC7FLVxLWDBLKCwaKTULgEwbLA4hJtOkSBNqITT3xEgfLpBtzE/jiuL04RGEBgwWhShRgQExHBAAh+QQJCgAAACwAAAAAIAAgAAAE7xDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfZiCqGk5dTESJeaOAlClzsJsqwiJwiqnFrb2nS9kmIcgEsjQydLiIlHehhpejaIjzh9eomSjZR+ipslWIRLAgMDOR2DOqKogTB9pCUJBagDBXR6XB0EBkIIsaRsGGMMAxoDBgYHTKJiUYEGDAzHC9EACcUGkIgFzgwZ0QsSBcXHiQvOwgDdEwfFs0sDzt4S6BK4xYjkDOzn0unFeBzOBijIm1Dgmg5YFQwsCMjp1oJ8LyIAACH5BAkKAAAALAAAAAAgACAAAATwEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GGl6NoiPOH16iZKNlH6KmyWFOggHhEEvAwwMA0N9GBsEC6amhnVcEwavDAazGwIDaH1ipaYLBUTCGgQDA8NdHz0FpqgTBwsLqAbWAAnIA4FWKdMLGdYGEgraigbT0OITBcg5QwPT4xLrROZL6AuQAPUS7bxLpoWidY0JtxLHKhwwMJBTHgPKdEQAACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GAULDJCRiXo1CpGXDJOUjY+Yip9DhToJA4RBLwMLCwVDfRgbBAaqqoZ1XBMHswsHtxtFaH1iqaoGNgAIxRpbFAgfPQSqpbgGBqUD1wBXeCYp1AYZ19JJOYgH1KwA4UBvQwXUBxPqVD9L3sbp2BNk2xvvFPJd+MFCN6HAAIKgNggY0KtEBAAh+QQJCgAAACwAAAAAIAAgAAAE6BDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfYIDMaAFdTESJeaEDAIMxYFqrOUaNW4E4ObYcCXaiBVEgULe0NJaxxtYksjh2NLkZISgDgJhHthkpU4mW6blRiYmZOlh4JWkDqILwUGBnE6TYEbCgevr0N1gH4At7gHiRpFaLNrrq8HNgAJA70AWxQIH1+vsYMDAzZQPC9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d+jYUqfAhhykOFwJWiAAAIfkECQoAAAAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg+ygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0+bm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h+Kr0SJ8MFihpNbx+4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX+BP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA==);
+}
+
+.jvectormap-legend-title {
+ font-weight: bold;
+ font-size: 14px;
+ text-align: center;
+}
+
+.jvectormap-legend-cnt {
+ position: absolute;
+}
+
+.jvectormap-legend-cnt-h {
+ bottom: 0;
+ right: 0;
+}
+
+.jvectormap-legend-cnt-v {
+ top: 0;
+ right: 0;
+}
+
+.jvectormap-legend {
+ background: black;
+ color: white;
+ border-radius: 3px;
+}
+
+.jvectormap-legend-cnt-h .jvectormap-legend {
+ float: left;
+ margin: 0 10px 10px 0;
+ padding: 3px 3px 1px 3px;
+}
+
+.jvectormap-legend-cnt-h .jvectormap-legend .jvectormap-legend-tick {
+ float: left;
+}
+
+.jvectormap-legend-cnt-v .jvectormap-legend {
+ margin: 10px 10px 0 0;
+ padding: 3px;
+}
+
+.jvectormap-legend-cnt-h .jvectormap-legend-tick {
+ width: 40px;
+}
+
+.jvectormap-legend-cnt-h .jvectormap-legend-tick-sample {
+ height: 15px;
+}
+
+.jvectormap-legend-cnt-v .jvectormap-legend-tick-sample {
+ height: 20px;
+ width: 20px;
+ display: inline-block;
+ vertical-align: middle;
+}
+
+.jvectormap-legend-tick-text {
+ font-size: 12px;
+}
+
+.jvectormap-legend-cnt-h .jvectormap-legend-tick-text {
+ text-align: center;
+}
+
+.jvectormap-legend-cnt-v .jvectormap-legend-tick-text {
+ display: inline-block;
+ vertical-align: middle;
+ line-height: 20px;
+ padding-left: 3px;
+}
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/jquery-jvectormap.js b/public/bower_components/jvectormap/jquery-jvectormap.js
new file mode 100644
index 0000000..16e12f1
--- /dev/null
+++ b/public/bower_components/jvectormap/jquery-jvectormap.js
@@ -0,0 +1,44 @@
+/**
+ * jVectorMap version 2.0.4
+ *
+ * Copyright 2011-2014, Kirill Lebedev
+ *
+ */
+
+(function( $ ){
+ var apiParams = {
+ set: {
+ colors: 1,
+ values: 1,
+ backgroundColor: 1,
+ scaleColors: 1,
+ normalizeFunction: 1,
+ focus: 1
+ },
+ get: {
+ selectedRegions: 1,
+ selectedMarkers: 1,
+ mapObject: 1,
+ regionName: 1
+ }
+ };
+
+ $.fn.vectorMap = function(options) {
+ var map,
+ methodName,
+ map = this.children('.jvectormap-container').data('mapObject');
+
+ if (options === 'addMap') {
+ jvm.Map.maps[arguments[1]] = arguments[2];
+ } else if ((options === 'set' || options === 'get') && apiParams[options][arguments[1]]) {
+ methodName = arguments[1].charAt(0).toUpperCase()+arguments[1].substr(1);
+ return map[options+methodName].apply(map, Array.prototype.slice.call(arguments, 2));
+ } else {
+ options = options || {};
+ options.container = this;
+ map = new jvm.Map(options);
+ }
+
+ return this;
+ };
+})( jQuery );
diff --git a/public/bower_components/jvectormap/jvectormap.jquery.json b/public/bower_components/jvectormap/jvectormap.jquery.json
new file mode 100644
index 0000000..5a68f0a
--- /dev/null
+++ b/public/bower_components/jvectormap/jvectormap.jquery.json
@@ -0,0 +1,34 @@
+{
+ "name": "jvectormap",
+ "title": "jVectorMap",
+ "description": "jQuery plugin for embedding vector maps with reach API and methods for data visualization to the web-pages.",
+ "keywords": [
+ "map",
+ "vector",
+ "world",
+ "usa",
+ "choropleth"
+ ],
+ "version": "2.0.4",
+ "author": {
+ "name": "Kirill Lebedev",
+ "email" : "echo.bjornd@gmail.com"
+ },
+ "licenses": [
+ {
+ "type": "AGPL",
+ "url": "http://www.gnu.org/copyleft/gpl.html"
+ },
+ {
+ "type": "Commercial",
+ "url": "http://www.binpress.com/license/read/id/3085/app/2122"
+ }
+ ],
+ "bugs": "https://github.com/bjornd/jvectormap/issues",
+ "homepage": "http://jvectormap.com",
+ "docs": "http://jvectormap.com/documentation/",
+ "download": "http://jvectormap.com/download/",
+ "dependencies": {
+ "jquery": ">=1.5"
+ }
+}
diff --git a/public/bower_components/jvectormap/lib/jquery-mousewheel.js b/public/bower_components/jvectormap/lib/jquery-mousewheel.js
new file mode 100644
index 0000000..a515e7e
--- /dev/null
+++ b/public/bower_components/jvectormap/lib/jquery-mousewheel.js
@@ -0,0 +1,201 @@
+/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
+ * Licensed under the MIT License (LICENSE.txt).
+ *
+ * Version: 3.1.9
+ *
+ * Requires: jQuery 1.2.2+
+ */
+
+(function (factory) {
+ if ( typeof define === 'function' && define.amd ) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS style for Browserify
+ module.exports = factory;
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function ($) {
+
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
+ slice = Array.prototype.slice,
+ nullLowestDeltaTimeout, lowestDelta;
+
+ if ( $.event.fixHooks ) {
+ for ( var i = toFix.length; i; ) {
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
+ }
+ }
+
+ var special = $.event.special.mousewheel = {
+ version: '3.1.9',
+
+ setup: function() {
+ if ( this.addEventListener ) {
+ for ( var i = toBind.length; i; ) {
+ this.addEventListener( toBind[--i], handler, false );
+ }
+ } else {
+ this.onmousewheel = handler;
+ }
+ // Store the line height and page height for this particular element
+ $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
+ $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
+ },
+
+ teardown: function() {
+ if ( this.removeEventListener ) {
+ for ( var i = toBind.length; i; ) {
+ this.removeEventListener( toBind[--i], handler, false );
+ }
+ } else {
+ this.onmousewheel = null;
+ }
+ },
+
+ getLineHeight: function(elem) {
+ return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
+ },
+
+ getPageHeight: function(elem) {
+ return $(elem).height();
+ },
+
+ settings: {
+ adjustOldDeltas: true
+ }
+ };
+
+ $.fn.extend({
+ mousewheel: function(fn) {
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
+ },
+
+ unmousewheel: function(fn) {
+ return this.unbind('mousewheel', fn);
+ }
+ });
+
+
+ function handler(event) {
+ var orgEvent = event || window.event,
+ args = slice.call(arguments, 1),
+ delta = 0,
+ deltaX = 0,
+ deltaY = 0,
+ absDelta = 0;
+ event = $.event.fix(orgEvent);
+ event.type = 'mousewheel';
+
+ // Old school scrollwheel delta
+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
+
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
+ deltaX = deltaY * -1;
+ deltaY = 0;
+ }
+
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
+ delta = deltaY === 0 ? deltaX : deltaY;
+
+ // New school wheel delta (wheel event)
+ if ( 'deltaY' in orgEvent ) {
+ deltaY = orgEvent.deltaY * -1;
+ delta = deltaY;
+ }
+ if ( 'deltaX' in orgEvent ) {
+ deltaX = orgEvent.deltaX;
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
+ }
+
+ // No change actually happened, no reason to go any further
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
+
+ // Need to convert lines and pages to pixels if we aren't already in pixels
+ // There are three delta modes:
+ // * deltaMode 0 is by pixels, nothing to do
+ // * deltaMode 1 is by lines
+ // * deltaMode 2 is by pages
+ if ( orgEvent.deltaMode === 1 ) {
+ var lineHeight = $.data(this, 'mousewheel-line-height');
+ delta *= lineHeight;
+ deltaY *= lineHeight;
+ deltaX *= lineHeight;
+ } else if ( orgEvent.deltaMode === 2 ) {
+ var pageHeight = $.data(this, 'mousewheel-page-height');
+ delta *= pageHeight;
+ deltaY *= pageHeight;
+ deltaX *= pageHeight;
+ }
+
+ // Store lowest absolute delta to normalize the delta values
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
+
+ if ( !lowestDelta || absDelta < lowestDelta ) {
+ lowestDelta = absDelta;
+
+ // Adjust older deltas if necessary
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
+ lowestDelta /= 40;
+ }
+ }
+
+ // Adjust older deltas if necessary
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
+ // Divide all the things by 40!
+ delta /= 40;
+ deltaX /= 40;
+ deltaY /= 40;
+ }
+
+ // Get a whole, normalized value for the deltas
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
+
+ // Add information to the event object
+ event.deltaX = deltaX;
+ event.deltaY = deltaY;
+ event.deltaFactor = lowestDelta;
+ // Go ahead and set deltaMode to 0 since we converted to pixels
+ // Although this is a little odd since we overwrite the deltaX/Y
+ // properties with normalized deltas.
+ event.deltaMode = 0;
+
+ // Add event and delta to the front of the arguments
+ args.unshift(event, delta, deltaX, deltaY);
+
+ // Clearout lowestDelta after sometime to better
+ // handle multiple device types that give different
+ // a different lowestDelta
+ // Ex: trackpad = 3 and mouse wheel = 120
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
+
+ return ($.event.dispatch || $.event.handle).apply(this, args);
+ }
+
+ function nullLowestDelta() {
+ lowestDelta = null;
+ }
+
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
+ // If this is an older event and the delta is divisable by 120,
+ // then we are assuming that the browser is treating this as an
+ // older mouse wheel event and that we should divide the deltas
+ // by 40 to try and get a more usable deltaFactor.
+ // Side note, this actually impacts the reported scroll distance
+ // in older browsers and can cause scrolling to be slower than native.
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
+ return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
+ }
+
+}));
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/abstract-canvas-element.js b/public/bower_components/jvectormap/src/abstract-canvas-element.js
new file mode 100644
index 0000000..de8d30d
--- /dev/null
+++ b/public/bower_components/jvectormap/src/abstract-canvas-element.js
@@ -0,0 +1,93 @@
+/**
+ * Implements abstract vector canvas.
+ * @constructor
+ * @param {HTMLElement} container Container to put element to.
+ * @param {Number} width Width of canvas.
+ * @param {Number} height Height of canvas.
+ */
+jvm.AbstractCanvasElement = function(container, width, height){
+ this.container = container;
+ this.setSize(width, height);
+ this.rootElement = new jvm[this.classPrefix+'GroupElement']();
+ this.node.appendChild( this.rootElement.node );
+ this.container.appendChild(this.node);
+}
+
+/**
+ * Add element to the certain group inside of the canvas.
+ * @param {HTMLElement} element Element to add to canvas.
+ * @param {HTMLElement} group Group to add element into or into root group if not provided.
+ */
+jvm.AbstractCanvasElement.prototype.add = function(element, group){
+ group = group || this.rootElement;
+ group.add(element);
+ element.canvas = this;
+}
+
+/**
+ * Create path and add it to the canvas.
+ * @param {Object} config Parameters of path to create.
+ * @param {Object} style Styles of the path to create.
+ * @param {HTMLElement} group Group to add path into.
+ */
+jvm.AbstractCanvasElement.prototype.addPath = function(config, style, group){
+ var el = new jvm[this.classPrefix+'PathElement'](config, style);
+
+ this.add(el, group);
+ return el;
+};
+
+/**
+ * Create circle and add it to the canvas.
+ * @param {Object} config Parameters of path to create.
+ * @param {Object} style Styles of the path to create.
+ * @param {HTMLElement} group Group to add circle into.
+ */
+jvm.AbstractCanvasElement.prototype.addCircle = function(config, style, group){
+ var el = new jvm[this.classPrefix+'CircleElement'](config, style);
+
+ this.add(el, group);
+ return el;
+};
+
+/**
+ * Create circle and add it to the canvas.
+ * @param {Object} config Parameters of path to create.
+ * @param {Object} style Styles of the path to create.
+ * @param {HTMLElement} group Group to add circle into.
+ */
+jvm.AbstractCanvasElement.prototype.addImage = function(config, style, group){
+ var el = new jvm[this.classPrefix+'ImageElement'](config, style);
+
+ this.add(el, group);
+ return el;
+};
+
+/**
+ * Create text and add it to the canvas.
+ * @param {Object} config Parameters of path to create.
+ * @param {Object} style Styles of the path to create.
+ * @param {HTMLElement} group Group to add circle into.
+ */
+jvm.AbstractCanvasElement.prototype.addText = function(config, style, group){
+ var el = new jvm[this.classPrefix+'TextElement'](config, style);
+
+ this.add(el, group);
+ return el;
+};
+
+/**
+ * Add group to the another group inside of the canvas.
+ * @param {HTMLElement} group Group to add circle into or root group if not provided.
+ */
+jvm.AbstractCanvasElement.prototype.addGroup = function(parentGroup){
+ var el = new jvm[this.classPrefix+'GroupElement']();
+
+ if (parentGroup) {
+ parentGroup.node.appendChild(el.node);
+ } else {
+ this.node.appendChild(el.node);
+ }
+ el.canvas = this;
+ return el;
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/abstract-element.js b/public/bower_components/jvectormap/src/abstract-element.js
new file mode 100644
index 0000000..e393491
--- /dev/null
+++ b/public/bower_components/jvectormap/src/abstract-element.js
@@ -0,0 +1,73 @@
+/**
+ * Basic wrapper for DOM element.
+ * @constructor
+ * @param {String} name Tag name of the element
+ * @param {Object} config Set of parameters to initialize element with
+ */
+jvm.AbstractElement = function(name, config){
+ /**
+ * Underlying DOM element
+ * @type {DOMElement}
+ * @private
+ */
+ this.node = this.createElement(name);
+
+ /**
+ * Name of underlying element
+ * @type {String}
+ * @private
+ */
+ this.name = name;
+
+ /**
+ * Internal store of attributes
+ * @type {Object}
+ * @private
+ */
+ this.properties = {};
+
+ if (config) {
+ this.set(config);
+ }
+};
+
+/**
+ * Set attribute of the underlying DOM element.
+ * @param {String} name Name of attribute
+ * @param {Number|String} config Set of parameters to initialize element with
+ */
+jvm.AbstractElement.prototype.set = function(property, value){
+ var key;
+
+ if (typeof property === 'object') {
+ for (key in property) {
+ this.properties[key] = property[key];
+ this.applyAttr(key, property[key]);
+ }
+ } else {
+ this.properties[property] = value;
+ this.applyAttr(property, value);
+ }
+};
+
+/**
+ * Returns value of attribute.
+ * @param {String} name Name of attribute
+ */
+jvm.AbstractElement.prototype.get = function(property){
+ return this.properties[property];
+};
+
+/**
+ * Applies attribute value to the underlying DOM element.
+ * @param {String} name Name of attribute
+ * @param {Number|String} config Value of attribute to apply
+ * @private
+ */
+jvm.AbstractElement.prototype.applyAttr = function(property, value){
+ this.node.setAttribute(property, value);
+};
+
+jvm.AbstractElement.prototype.remove = function(){
+ jvm.$(this.node).remove();
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/abstract-shape-element.js b/public/bower_components/jvectormap/src/abstract-shape-element.js
new file mode 100644
index 0000000..9a2419a
--- /dev/null
+++ b/public/bower_components/jvectormap/src/abstract-shape-element.js
@@ -0,0 +1,62 @@
+/**
+ * Abstract shape element. Shape element represents some visual vector or raster object.
+ * @constructor
+ * @param {String} name Tag name of the element.
+ * @param {Object} config Set of parameters to initialize element with.
+ * @param {Object} style Object with styles to set on element initialization.
+ */
+jvm.AbstractShapeElement = function(name, config, style){
+ this.style = style || {};
+ this.style.current = this.style.current || {};
+ this.isHovered = false;
+ this.isSelected = false;
+ this.updateStyle();
+};
+
+/**
+ * Set element's style.
+ * @param {Object|String} property Could be string to set only one property or object to set several style properties at once.
+ * @param {String} value Value to set in case only one property should be set.
+ */
+jvm.AbstractShapeElement.prototype.setStyle = function(property, value){
+ var styles = {};
+
+ if (typeof property === 'object') {
+ styles = property;
+ } else {
+ styles[property] = value;
+ }
+ jvm.$.extend(this.style.current, styles);
+ this.updateStyle();
+};
+
+
+jvm.AbstractShapeElement.prototype.updateStyle = function(){
+ var attrs = {};
+
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.initial);
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.current);
+ if (this.isHovered) {
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.hover);
+ }
+ if (this.isSelected) {
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.selected);
+ if (this.isHovered) {
+ jvm.AbstractShapeElement.mergeStyles(attrs, this.style.selectedHover);
+ }
+ }
+ this.set(attrs);
+};
+
+jvm.AbstractShapeElement.mergeStyles = function(styles, newStyles){
+ var key;
+
+ newStyles = newStyles || {};
+ for (key in newStyles) {
+ if (newStyles[key] === null) {
+ delete styles[key];
+ } else {
+ styles[key] = newStyles[key];
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/color-scale.js b/public/bower_components/jvectormap/src/color-scale.js
new file mode 100644
index 0000000..899a09b
--- /dev/null
+++ b/public/bower_components/jvectormap/src/color-scale.js
@@ -0,0 +1,44 @@
+jvm.ColorScale = function(colors, normalizeFunction, minValue, maxValue) {
+ jvm.ColorScale.parentClass.apply(this, arguments);
+}
+
+jvm.inherits(jvm.ColorScale, jvm.NumericScale);
+
+jvm.ColorScale.prototype.setScale = function(scale) {
+ var i;
+
+ for (i = 0; i < scale.length; i++) {
+ this.scale[i] = jvm.ColorScale.rgbToArray(scale[i]);
+ }
+};
+
+jvm.ColorScale.prototype.getValue = function(value) {
+ return jvm.ColorScale.numToRgb(jvm.ColorScale.parentClass.prototype.getValue.call(this, value));
+};
+
+jvm.ColorScale.arrayToRgb = function(ar) {
+ var rgb = '#',
+ d,
+ i;
+
+ for (i = 0; i < ar.length; i++) {
+ d = ar[i].toString(16);
+ rgb += d.length == 1 ? '0'+d : d;
+ }
+ return rgb;
+};
+
+jvm.ColorScale.numToRgb = function(num) {
+ num = num.toString(16);
+
+ while (num.length < 6) {
+ num = '0' + num;
+ }
+
+ return '#'+num;
+};
+
+jvm.ColorScale.rgbToArray = function(rgb) {
+ rgb = rgb.substr(1);
+ return [parseInt(rgb.substr(0, 2), 16), parseInt(rgb.substr(2, 2), 16), parseInt(rgb.substr(4, 2), 16)];
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/data-series.js b/public/bower_components/jvectormap/src/data-series.js
new file mode 100644
index 0000000..2cb0be0
--- /dev/null
+++ b/public/bower_components/jvectormap/src/data-series.js
@@ -0,0 +1,158 @@
+/**
+ * Creates data series.
+ * @constructor
+ * @param {Object} params Parameters to initialize series with.
+ * @param {Array} params.values The data set to visualize.
+ * @param {String} params.attribute Numberic or color attribute to use for data visualization. This could be: fill, stroke, fill-opacity, stroke-opacity for markers and regions and r (radius) for markers only.
+ * @param {Array} params.scale Values used to map a dimension of data to a visual representation. The first value sets visualization for minimum value from the data set and the last value sets visualization for the maximum value. There also could be intermidiate values. Default value is ['#C8EEFF', '#0071A4']
+ * @param {Function|String} params.normalizeFunction The function used to map input values to the provided scale. This parameter could be provided as function or one of the strings: 'linear' or 'polynomial', while 'linear' is used by default. The function provided takes value from the data set as an input and returns corresponding value from the scale.
+ * @param {Number} params.min Minimum value of the data set. Could be calculated automatically if not provided.
+ * @param {Number} params.min Maximum value of the data set. Could be calculated automatically if not provided.
+ */
+jvm.DataSeries = function(params, elements, map) {
+ var scaleConstructor;
+
+ params = params || {};
+ params.attribute = params.attribute || 'fill';
+
+ this.elements = elements;
+ this.params = params;
+ this.map = map;
+
+ if (params.attributes) {
+ this.setAttributes(params.attributes);
+ }
+
+ if (jvm.$.isArray(params.scale)) {
+ scaleConstructor = (params.attribute === 'fill' || params.attribute === 'stroke') ? jvm.ColorScale : jvm.NumericScale;
+ this.scale = new scaleConstructor(params.scale, params.normalizeFunction, params.min, params.max);
+ } else if (params.scale) {
+ this.scale = new jvm.OrdinalScale(params.scale);
+ } else {
+ this.scale = new jvm.SimpleScale(params.scale);
+ }
+
+ this.values = params.values || {};
+ this.setValues(this.values);
+
+ if (this.params.legend) {
+ this.legend = new jvm.Legend($.extend({
+ map: this.map,
+ series: this
+ }, this.params.legend))
+ }
+};
+
+jvm.DataSeries.prototype = {
+ setAttributes: function(key, attr){
+ var attrs = key,
+ code;
+
+ if (typeof key == 'string') {
+ if (this.elements[key]) {
+ this.elements[key].setStyle(this.params.attribute, attr);
+ }
+ } else {
+ for (code in attrs) {
+ if (this.elements[code]) {
+ this.elements[code].element.setStyle(this.params.attribute, attrs[code]);
+ }
+ }
+ }
+ },
+
+ /**
+ * Set values for the data set.
+ * @param {Object} values Object which maps codes of regions or markers to values.
+ */
+ setValues: function(values) {
+ var max = -Number.MAX_VALUE,
+ min = Number.MAX_VALUE,
+ val,
+ cc,
+ attrs = {};
+
+ if (!(this.scale instanceof jvm.OrdinalScale) && !(this.scale instanceof jvm.SimpleScale)) {
+ // we have a color scale as an array
+ if (typeof this.params.min === 'undefined' || typeof this.params.max === 'undefined') {
+ // min and/or max are not defined, so calculate them
+ for (cc in values) {
+ val = parseFloat(values[cc]);
+ if (val > max) max = val;
+ if (val < min) min = val;
+ }
+ }
+
+ if (typeof this.params.min === 'undefined') {
+ this.scale.setMin(min);
+ this.params.min = min;
+ } else {
+ this.scale.setMin(this.params.min);
+ }
+
+ if (typeof this.params.max === 'undefined') {
+ this.scale.setMax(max);
+ this.params.max = max;
+ } else {
+ this.scale.setMax(this.params.max);
+ }
+
+ for (cc in values) {
+ if (cc != 'indexOf') {
+ val = parseFloat(values[cc]);
+ if (!isNaN(val)) {
+ attrs[cc] = this.scale.getValue(val);
+ } else {
+ attrs[cc] = this.elements[cc].element.style.initial[this.params.attribute];
+ }
+ }
+ }
+ } else {
+ for (cc in values) {
+ if (values[cc]) {
+ attrs[cc] = this.scale.getValue(values[cc]);
+ } else {
+ attrs[cc] = this.elements[cc].element.style.initial[this.params.attribute];
+ }
+ }
+ }
+
+ this.setAttributes(attrs);
+ jvm.$.extend(this.values, values);
+ },
+
+ clear: function(){
+ var key,
+ attrs = {};
+
+ for (key in this.values) {
+ if (this.elements[key]) {
+ attrs[key] = this.elements[key].element.shape.style.initial[this.params.attribute];
+ }
+ }
+ this.setAttributes(attrs);
+ this.values = {};
+ },
+
+ /**
+ * Set scale of the data series.
+ * @param {Array} scale Values representing scale.
+ */
+ setScale: function(scale) {
+ this.scale.setScale(scale);
+ if (this.values) {
+ this.setValues(this.values);
+ }
+ },
+
+ /**
+ * Set normalize function of the data series.
+ * @param {Function|String} normilizeFunction.
+ */
+ setNormalizeFunction: function(f) {
+ this.scale.setNormalizeFunction(f);
+ if (this.values) {
+ this.setValues(this.values);
+ }
+ }
+};
diff --git a/public/bower_components/jvectormap/src/jvectormap.js b/public/bower_components/jvectormap/src/jvectormap.js
new file mode 100644
index 0000000..b44897c
--- /dev/null
+++ b/public/bower_components/jvectormap/src/jvectormap.js
@@ -0,0 +1,185 @@
+/**
+ * @namespace jvm Holds core methods and classes used by jVectorMap.
+ */
+var jvm = {
+
+ /**
+ * Inherits child's prototype from the parent's one.
+ * @param {Function} child
+ * @param {Function} parent
+ */
+ inherits: function(child, parent) {
+ function temp() {}
+ temp.prototype = parent.prototype;
+ child.prototype = new temp();
+ child.prototype.constructor = child;
+ child.parentClass = parent;
+ },
+
+ /**
+ * Mixes in methods from the source constructor to the target one.
+ * @param {Function} target
+ * @param {Function} source
+ */
+ mixin: function(target, source){
+ var prop;
+
+ for (prop in source.prototype) {
+ if (source.prototype.hasOwnProperty(prop)) {
+ target.prototype[prop] = source.prototype[prop];
+ }
+ }
+ },
+
+ min: function(values){
+ var min = Number.MAX_VALUE,
+ i;
+
+ if (values instanceof Array) {
+ for (i = 0; i < values.length; i++) {
+ if (values[i] < min) {
+ min = values[i];
+ }
+ }
+ } else {
+ for (i in values) {
+ if (values[i] < min) {
+ min = values[i];
+ }
+ }
+ }
+ return min;
+ },
+
+ max: function(values){
+ var max = Number.MIN_VALUE,
+ i;
+
+ if (values instanceof Array) {
+ for (i = 0; i < values.length; i++) {
+ if (values[i] > max) {
+ max = values[i];
+ }
+ }
+ } else {
+ for (i in values) {
+ if (values[i] > max) {
+ max = values[i];
+ }
+ }
+ }
+ return max;
+ },
+
+ keys: function(object){
+ var keys = [],
+ key;
+
+ for (key in object) {
+ keys.push(key);
+ }
+ return keys;
+ },
+
+ values: function(object){
+ var values = [],
+ key,
+ i;
+
+ for (i = 0; i < arguments.length; i++) {
+ object = arguments[i];
+ for (key in object) {
+ values.push(object[key]);
+ }
+ }
+ return values;
+ },
+
+ whenImageLoaded: function(url){
+ var deferred = new jvm.$.Deferred(),
+ img = jvm.$('');
+
+ img.error(function(){
+ deferred.reject();
+ }).load(function(){
+ deferred.resolve(img);
+ });
+ img.attr('src', url);
+
+ return deferred;
+ },
+
+ isImageUrl: function(s){
+ return /\.\w{3,4}$/.test(s);
+ }
+};
+
+jvm.$ = jQuery;
+
+/**
+ * indexOf polyfill for IE < 9
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
+ */
+if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function (searchElement, fromIndex) {
+
+ var k;
+
+ // 1. Let O be the result of calling ToObject passing
+ // the this value as the argument.
+ if (this == null) {
+ throw new TypeError('"this" is null or not defined');
+ }
+
+ var O = Object(this);
+
+ // 2. Let lenValue be the result of calling the Get
+ // internal method of O with the argument "length".
+ // 3. Let len be ToUint32(lenValue).
+ var len = O.length >>> 0;
+
+ // 4. If len is 0, return -1.
+ if (len === 0) {
+ return -1;
+ }
+
+ // 5. If argument fromIndex was passed let n be
+ // ToInteger(fromIndex); else let n be 0.
+ var n = +fromIndex || 0;
+
+ if (Math.abs(n) === Infinity) {
+ n = 0;
+ }
+
+ // 6. If n >= len, return -1.
+ if (n >= len) {
+ return -1;
+ }
+
+ // 7. If n >= 0, then Let k be n.
+ // 8. Else, n<0, Let k be len - abs(n).
+ // If k is less than 0, then let k be 0.
+ k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
+
+ // 9. Repeat, while k < len
+ while (k < len) {
+ // a. Let Pk be ToString(k).
+ // This is implicit for LHS operands of the in operator
+ // b. Let kPresent be the result of calling the
+ // HasProperty internal method of O with argument Pk.
+ // This step can be combined with c
+ // c. If kPresent is true, then
+ // i. Let elementK be the result of calling the Get
+ // internal method of O with the argument ToString(k).
+ // ii. Let same be the result of applying the
+ // Strict Equality Comparison Algorithm to
+ // searchElement and elementK.
+ // iii. If same is true, return k.
+ if (k in O && O[k] === searchElement) {
+ return k;
+ }
+ k++;
+ }
+ return -1;
+ };
+}
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/legend.js b/public/bower_components/jvectormap/src/legend.js
new file mode 100644
index 0000000..fdc3177
--- /dev/null
+++ b/public/bower_components/jvectormap/src/legend.js
@@ -0,0 +1,83 @@
+/**
+ * Represents map legend.
+ * @constructor
+ * @param {Object} params Configuration parameters.
+ * @param {String} params.cssClass Additional CSS class to apply to legend element.
+ * @param {Boolean} params.vertical If true legend will be rendered as vertical.
+ * @param {String} params.title Legend title.
+ * @param {Function} params.labelRender Method to convert series values to legend labels.
+ */
+jvm.Legend = function(params) {
+ this.params = params || {};
+ this.map = this.params.map;
+ this.series = this.params.series;
+ this.body = jvm.$('');
+ this.body.addClass('jvectormap-legend');
+ if (this.params.cssClass) {
+ this.body.addClass(this.params.cssClass);
+ }
+
+ if (params.vertical) {
+ this.map.legendCntVertical.append( this.body );
+ } else {
+ this.map.legendCntHorizontal.append( this.body );
+ }
+
+ this.render();
+}
+
+jvm.Legend.prototype.render = function(){
+ var ticks = this.series.scale.getTicks(),
+ i,
+ inner = jvm.$('').addClass('jvectormap-legend-inner'),
+ tick,
+ sample,
+ label;
+
+ this.body.html('');
+ if (this.params.title) {
+ this.body.append(
+ jvm.$('').addClass('jvectormap-legend-title').html(this.params.title)
+ );
+ }
+ this.body.append(inner);
+
+ for (i = 0; i < ticks.length; i++) {
+ tick = jvm.$('').addClass('jvectormap-legend-tick');
+ sample = jvm.$('').addClass('jvectormap-legend-tick-sample');
+
+ switch (this.series.params.attribute) {
+ case 'fill':
+ if (jvm.isImageUrl(ticks[i].value)) {
+ sample.css('background', 'url('+ticks[i].value+')');
+ } else {
+ sample.css('background', ticks[i].value);
+ }
+ break;
+ case 'stroke':
+ sample.css('background', ticks[i].value);
+ break;
+ case 'image':
+ sample.css('background', 'url('+ticks[i].value+') no-repeat center center');
+ break;
+ case 'r':
+ jvm.$('').css({
+ 'border-radius': ticks[i].value,
+ border: this.map.params.markerStyle.initial['stroke-width']+'px '+
+ this.map.params.markerStyle.initial['stroke']+' solid',
+ width: ticks[i].value * 2 + 'px',
+ height: ticks[i].value * 2 + 'px',
+ background: this.map.params.markerStyle.initial['fill']
+ }).appendTo(sample);
+ break;
+ }
+ tick.append( sample );
+ label = ticks[i].label;
+ if (this.params.labelRender) {
+ label = this.params.labelRender(label);
+ }
+ tick.append( jvm.$('
'+label+'
').addClass('jvectormap-legend-tick-text') );
+ inner.append(tick);
+ }
+ inner.append( jvm.$('').css('clear', 'both') );
+}
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/map-object.js b/public/bower_components/jvectormap/src/map-object.js
new file mode 100644
index 0000000..acf364f
--- /dev/null
+++ b/public/bower_components/jvectormap/src/map-object.js
@@ -0,0 +1,73 @@
+jvm.MapObject = function(config){};
+
+jvm.MapObject.prototype.getLabelText = function(key){
+ var text;
+
+ if (this.config.label) {
+ if (typeof this.config.label.render === 'function') {
+ text = this.config.label.render(key);
+ } else {
+ text = key;
+ }
+ } else {
+ text = null;
+ }
+ return text;
+}
+
+jvm.MapObject.prototype.getLabelOffsets = function(key){
+ var offsets;
+
+ if (this.config.label) {
+ if (typeof this.config.label.offsets === 'function') {
+ offsets = this.config.label.offsets(key);
+ } else if (typeof this.config.label.offsets === 'object') {
+ offsets = this.config.label.offsets[key];
+ }
+ }
+ return offsets || [0, 0];
+}
+
+/**
+ * Set hovered state to the element. Hovered state means mouse cursor is over element. Styles will be updates respectively.
+ * @param {Boolean} isHovered true to make element hovered, false otherwise.
+ */
+jvm.MapObject.prototype.setHovered = function(isHovered){
+ if (this.isHovered !== isHovered) {
+ this.isHovered = isHovered;
+ this.shape.isHovered = isHovered;
+ this.shape.updateStyle();
+ if (this.label) {
+ this.label.isHovered = isHovered;
+ this.label.updateStyle();
+ }
+ }
+};
+
+/**
+ * Set selected state to the element. Styles will be updates respectively.
+ * @param {Boolean} isSelected true to make element selected, false otherwise.
+ */
+jvm.MapObject.prototype.setSelected = function(isSelected){
+ if (this.isSelected !== isSelected) {
+ this.isSelected = isSelected;
+ this.shape.isSelected = isSelected;
+ this.shape.updateStyle();
+ if (this.label) {
+ this.label.isSelected = isSelected;
+ this.label.updateStyle();
+ }
+ jvm.$(this.shape).trigger('selected', [isSelected]);
+ }
+};
+
+jvm.MapObject.prototype.setStyle = function(){
+ this.shape.setStyle.apply(this.shape, arguments);
+};
+
+jvm.MapObject.prototype.remove = function(){
+ this.shape.remove();
+ if (this.label) {
+ this.label.remove();
+ }
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/map.js b/public/bower_components/jvectormap/src/map.js
new file mode 100644
index 0000000..a9f26eb
--- /dev/null
+++ b/public/bower_components/jvectormap/src/map.js
@@ -0,0 +1,1186 @@
+/**
+ * Creates map, draws paths, binds events.
+ * @constructor
+ * @param {Object} params Parameters to initialize map with.
+ * @param {String} params.map Name of the map in the format territory_proj_lang where territory is a unique code or name of the territory which the map represents (ISO 3166 standard is used where possible), proj is a name of projection used to generate representation of the map on the plane (projections are named according to the conventions of proj4 utility) and lang is a code of the language, used for the names of regions.
+ * @param {String} params.backgroundColor Background color of the map in CSS format.
+ * @param {Boolean} params.zoomOnScroll When set to true map could be zoomed using mouse scroll. Default value is true.
+ * @param {Boolean} params.zoomOnScrollSpeed Mouse scroll speed. Number from 1 to 10. Default value is 3.
+ * @param {Boolean} params.panOnDrag When set to true, the map pans when being dragged. Default value is true.
+ * @param {Number} params.zoomMax Indicates the maximum zoom ratio which could be reached zooming the map. Default value is 8.
+ * @param {Number} params.zoomMin Indicates the minimum zoom ratio which could be reached zooming the map. Default value is 1.
+ * @param {Number} params.zoomStep Indicates the multiplier used to zoom map with +/- buttons. Default value is 1.6.
+ * @param {Boolean} params.zoomAnimate Indicates whether or not to animate changing of map zoom with zoom buttons.
+ * @param {Boolean} params.regionsSelectable When set to true regions of the map could be selected. Default value is false.
+ * @param {Boolean} params.regionsSelectableOne Allow only one region to be selected at the moment. Default value is false.
+ * @param {Boolean} params.markersSelectable When set to true markers on the map could be selected. Default value is false.
+ * @param {Boolean} params.markersSelectableOne Allow only one marker to be selected at the moment. Default value is false.
+ * @param {Object} params.regionStyle Set the styles for the map's regions. Each region or marker has four states: initial (default state), hover (when the mouse cursor is over the region or marker), selected (when region or marker is selected), selectedHover (when the mouse cursor is over the region or marker and it's selected simultaneously). Styles could be set for each of this states. Default value for that parameter is:
+
+* @param {Object} params.regionLabelStyle Set the styles for the regions' labels. Each region or marker has four states: initial (default state), hover (when the mouse cursor is over the region or marker), selected (when region or marker is selected), selectedHover (when the mouse cursor is over the region or marker and it's selected simultaneously). Styles could be set for each of this states. Default value for that parameter is:
+
+ * @param {Object} params.markerStyle Set the styles for the map's markers. Any parameter suitable for regionStyle could be used as well as numeric parameter r to set the marker's radius. Default value for that parameter is:
+
+ * @param {Object|Array} params.markers Set of markers to add to the map during initialization. In case of array is provided, codes of markers will be set as string representations of array indexes. Each marker is represented by latLng (array of two numeric values), name (string which will be show on marker's tip) and any marker styles.
+ * @param {Object} params.series Object with two keys: markers and regions. Each of which is an array of series configs to be applied to the respective map elements. See DataSeries description for a list of parameters available.
+ * @param {Object|String} params.focusOn This parameter sets the initial position and scale of the map viewport. See setFocus docuemntation for possible parameters.
+ * @param {Object} params.labels Defines parameters for rendering static labels. Object could contain two keys: regions and markers. Each key value defines configuration object with the following possible options:
+
+
render {Function} - defines method for converting region code or marker index to actual label value.
+
offsets {Object|Function} - provides method or object which could be used to define label offset by region code or marker index.
+
+Plase note: static labels feature is not supported in Internet Explorer 8 and below.
+ * @param {Array|Object|String} params.selectedRegions Set initially selected regions.
+ * @param {Array|Object|String} params.selectedMarkers Set initially selected markers.
+ * @param {Function} params.onRegionTipShow (Event e, Object tip, String code) Will be called right before the region tip is going to be shown.
+ * @param {Function} params.onRegionOver (Event e, String code) Will be called on region mouse over event.
+ * @param {Function} params.onRegionOut (Event e, String code) Will be called on region mouse out event.
+ * @param {Function} params.onRegionClick (Event e, String code) Will be called on region click event.
+ * @param {Function} params.onRegionSelected (Event e, String code, Boolean isSelected, Array selectedRegions) Will be called when region is (de)selected. isSelected parameter of the callback indicates whether region is selected or not. selectedRegions contains codes of all currently selected regions.
+ * @param {Function} params.onMarkerTipShow (Event e, Object tip, String code) Will be called right before the marker tip is going to be shown.
+ * @param {Function} params.onMarkerOver (Event e, String code) Will be called on marker mouse over event.
+ * @param {Function} params.onMarkerOut (Event e, String code) Will be called on marker mouse out event.
+ * @param {Function} params.onMarkerClick (Event e, String code) Will be called on marker click event.
+ * @param {Function} params.onMarkerSelected (Event e, String code, Boolean isSelected, Array selectedMarkers) Will be called when marker is (de)selected. isSelected parameter of the callback indicates whether marker is selected or not. selectedMarkers contains codes of all currently selected markers.
+ * @param {Function} params.onViewportChange (Event e, Number scale) Triggered when the map's viewport is changed (map was panned or zoomed).
+ */
+jvm.Map = function(params) {
+ var map = this,
+ e;
+
+ this.params = jvm.$.extend(true, {}, jvm.Map.defaultParams, params);
+
+ if (!jvm.Map.maps[this.params.map]) {
+ throw new Error('Attempt to use map which was not loaded: '+this.params.map);
+ }
+
+ this.mapData = jvm.Map.maps[this.params.map];
+ this.markers = {};
+ this.regions = {};
+ this.regionsColors = {};
+ this.regionsData = {};
+
+ this.container = jvm.$('
').addClass('jvectormap-container');
+ if (this.params.container) {
+ this.params.container.append( this.container );
+ }
+ this.container.data('mapObject', this);
+
+ this.defaultWidth = this.mapData.width;
+ this.defaultHeight = this.mapData.height;
+
+ this.setBackgroundColor(this.params.backgroundColor);
+
+ this.onResize = function(){
+ map.updateSize();
+ }
+ jvm.$(window).resize(this.onResize);
+
+ for (e in jvm.Map.apiEvents) {
+ if (this.params[e]) {
+ this.container.bind(jvm.Map.apiEvents[e]+'.jvectormap', this.params[e]);
+ }
+ }
+
+ this.canvas = new jvm.VectorCanvas(this.container[0], this.width, this.height);
+
+ if (this.params.bindTouchEvents) {
+ if (('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch)) {
+ this.bindContainerTouchEvents();
+ } else if (window.MSGesture) {
+ this.bindContainerPointerEvents();
+ }
+ }
+ this.bindContainerEvents();
+ this.bindElementEvents();
+ this.createTip();
+ if (this.params.zoomButtons) {
+ this.bindZoomButtons();
+ }
+
+ this.createRegions();
+ this.createMarkers(this.params.markers || {});
+
+ this.updateSize();
+
+ if (this.params.focusOn) {
+ if (typeof this.params.focusOn === 'string') {
+ this.params.focusOn = {region: this.params.focusOn};
+ } else if (jvm.$.isArray(this.params.focusOn)) {
+ this.params.focusOn = {regions: this.params.focusOn};
+ }
+ this.setFocus(this.params.focusOn);
+ }
+
+ if (this.params.selectedRegions) {
+ this.setSelectedRegions(this.params.selectedRegions);
+ }
+ if (this.params.selectedMarkers) {
+ this.setSelectedMarkers(this.params.selectedMarkers);
+ }
+
+ this.legendCntHorizontal = jvm.$('').addClass('jvectormap-legend-cnt jvectormap-legend-cnt-h');
+ this.legendCntVertical = jvm.$('').addClass('jvectormap-legend-cnt jvectormap-legend-cnt-v');
+ this.container.append(this.legendCntHorizontal);
+ this.container.append(this.legendCntVertical);
+
+ if (this.params.series) {
+ this.createSeries();
+ }
+};
+
+jvm.Map.prototype = {
+ transX: 0,
+ transY: 0,
+ scale: 1,
+ baseTransX: 0,
+ baseTransY: 0,
+ baseScale: 1,
+
+ width: 0,
+ height: 0,
+
+ /**
+ * Set background color of the map.
+ * @param {String} backgroundColor Background color in CSS format.
+ */
+ setBackgroundColor: function(backgroundColor) {
+ this.container.css('background-color', backgroundColor);
+ },
+
+ resize: function() {
+ var curBaseScale = this.baseScale;
+ if (this.width / this.height > this.defaultWidth / this.defaultHeight) {
+ this.baseScale = this.height / this.defaultHeight;
+ this.baseTransX = Math.abs(this.width - this.defaultWidth * this.baseScale) / (2 * this.baseScale);
+ } else {
+ this.baseScale = this.width / this.defaultWidth;
+ this.baseTransY = Math.abs(this.height - this.defaultHeight * this.baseScale) / (2 * this.baseScale);
+ }
+ this.scale *= this.baseScale / curBaseScale;
+ this.transX *= this.baseScale / curBaseScale;
+ this.transY *= this.baseScale / curBaseScale;
+ },
+
+ /**
+ * Synchronize the size of the map with the size of the container. Suitable in situations where the size of the container is changed programmatically or container is shown after it became visible.
+ */
+ updateSize: function(){
+ this.width = this.container.width();
+ this.height = this.container.height();
+ this.resize();
+ this.canvas.setSize(this.width, this.height);
+ this.applyTransform();
+ },
+
+ /**
+ * Reset all the series and show the map with the initial zoom.
+ */
+ reset: function() {
+ var key,
+ i;
+
+ for (key in this.series) {
+ for (i = 0; i < this.series[key].length; i++) {
+ this.series[key][i].clear();
+ }
+ }
+ this.scale = this.baseScale;
+ this.transX = this.baseTransX;
+ this.transY = this.baseTransY;
+ this.applyTransform();
+ },
+
+ applyTransform: function() {
+ var maxTransX,
+ maxTransY,
+ minTransX,
+ minTransY;
+
+ if (this.defaultWidth * this.scale <= this.width) {
+ maxTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
+ minTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
+ } else {
+ maxTransX = 0;
+ minTransX = (this.width - this.defaultWidth * this.scale) / this.scale;
+ }
+
+ if (this.defaultHeight * this.scale <= this.height) {
+ maxTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
+ minTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
+ } else {
+ maxTransY = 0;
+ minTransY = (this.height - this.defaultHeight * this.scale) / this.scale;
+ }
+
+ if (this.transY > maxTransY) {
+ this.transY = maxTransY;
+ } else if (this.transY < minTransY) {
+ this.transY = minTransY;
+ }
+ if (this.transX > maxTransX) {
+ this.transX = maxTransX;
+ } else if (this.transX < minTransX) {
+ this.transX = minTransX;
+ }
+
+ this.canvas.applyTransformParams(this.scale, this.transX, this.transY);
+
+ if (this.markers) {
+ this.repositionMarkers();
+ }
+
+ this.repositionLabels();
+
+ this.container.trigger('viewportChange', [this.scale/this.baseScale, this.transX, this.transY]);
+ },
+
+ bindContainerEvents: function(){
+ var mouseDown = false,
+ oldPageX,
+ oldPageY,
+ map = this;
+
+ if (this.params.panOnDrag) {
+ this.container.mousemove(function(e){
+ if (mouseDown) {
+ map.transX -= (oldPageX - e.pageX) / map.scale;
+ map.transY -= (oldPageY - e.pageY) / map.scale;
+
+ map.applyTransform();
+
+ oldPageX = e.pageX;
+ oldPageY = e.pageY;
+ }
+ return false;
+ }).mousedown(function(e){
+ mouseDown = true;
+ oldPageX = e.pageX;
+ oldPageY = e.pageY;
+ return false;
+ });
+
+ this.onContainerMouseUp = function(){
+ mouseDown = false;
+ };
+ jvm.$('body').mouseup(this.onContainerMouseUp);
+ }
+
+ if (this.params.zoomOnScroll) {
+ this.container.mousewheel(function(event, delta, deltaX, deltaY) {
+ var offset = jvm.$(map.container).offset(),
+ centerX = event.pageX - offset.left,
+ centerY = event.pageY - offset.top,
+ zoomStep = Math.pow(1 + map.params.zoomOnScrollSpeed / 1000, event.deltaFactor * event.deltaY);
+
+ map.tip.hide();
+
+ map.setScale(map.scale * zoomStep, centerX, centerY);
+ event.preventDefault();
+ });
+ }
+ },
+
+ bindContainerTouchEvents: function(){
+ var touchStartScale,
+ touchStartDistance,
+ map = this,
+ touchX,
+ touchY,
+ centerTouchX,
+ centerTouchY,
+ lastTouchesLength,
+ handleTouchEvent = function(e){
+ var touches = e.originalEvent.touches,
+ offset,
+ scale,
+ transXOld,
+ transYOld;
+
+ if (e.type == 'touchstart') {
+ lastTouchesLength = 0;
+ }
+
+ if (touches.length == 1) {
+ if (lastTouchesLength == 1) {
+ transXOld = map.transX;
+ transYOld = map.transY;
+ map.transX -= (touchX - touches[0].pageX) / map.scale;
+ map.transY -= (touchY - touches[0].pageY) / map.scale;
+ map.applyTransform();
+ map.tip.hide();
+ if (transXOld != map.transX || transYOld != map.transY) {
+ e.preventDefault();
+ }
+ }
+ touchX = touches[0].pageX;
+ touchY = touches[0].pageY;
+ } else if (touches.length == 2) {
+ if (lastTouchesLength == 2) {
+ scale = Math.sqrt(
+ Math.pow(touches[0].pageX - touches[1].pageX, 2) +
+ Math.pow(touches[0].pageY - touches[1].pageY, 2)
+ ) / touchStartDistance;
+ map.setScale(
+ touchStartScale * scale,
+ centerTouchX,
+ centerTouchY
+ )
+ map.tip.hide();
+ e.preventDefault();
+ } else {
+ offset = jvm.$(map.container).offset();
+ if (touches[0].pageX > touches[1].pageX) {
+ centerTouchX = touches[1].pageX + (touches[0].pageX - touches[1].pageX) / 2;
+ } else {
+ centerTouchX = touches[0].pageX + (touches[1].pageX - touches[0].pageX) / 2;
+ }
+ if (touches[0].pageY > touches[1].pageY) {
+ centerTouchY = touches[1].pageY + (touches[0].pageY - touches[1].pageY) / 2;
+ } else {
+ centerTouchY = touches[0].pageY + (touches[1].pageY - touches[0].pageY) / 2;
+ }
+ centerTouchX -= offset.left;
+ centerTouchY -= offset.top;
+ touchStartScale = map.scale;
+ touchStartDistance = Math.sqrt(
+ Math.pow(touches[0].pageX - touches[1].pageX, 2) +
+ Math.pow(touches[0].pageY - touches[1].pageY, 2)
+ );
+ }
+ }
+
+ lastTouchesLength = touches.length;
+ };
+
+ jvm.$(this.container).bind('touchstart', handleTouchEvent);
+ jvm.$(this.container).bind('touchmove', handleTouchEvent);
+ },
+
+ bindContainerPointerEvents: function(){
+ var map = this,
+ gesture = new MSGesture(),
+ element = this.container[0],
+ handlePointerDownEvent = function(e){
+ gesture.addPointer(e.pointerId);
+ },
+ handleGestureEvent = function(e){
+ var offset,
+ scale,
+ transXOld,
+ transYOld;
+
+ if (e.translationX != 0 || e.translationY != 0) {
+ transXOld = map.transX;
+ transYOld = map.transY;
+ map.transX += e.translationX / map.scale;
+ map.transY += e.translationY / map.scale;
+ map.applyTransform();
+ map.tip.hide();
+ if (transXOld != map.transX || transYOld != map.transY) {
+ e.preventDefault();
+ }
+ }
+ if (e.scale != 1) {
+ map.setScale(
+ map.scale * e.scale,
+ e.offsetX,
+ e.offsetY
+ )
+ map.tip.hide();
+ e.preventDefault();
+ }
+ };
+
+ gesture.target = element;
+ element.addEventListener("MSGestureChange", handleGestureEvent, false);
+ element.addEventListener("pointerdown", handlePointerDownEvent, false);
+ },
+
+ bindElementEvents: function(){
+ var map = this,
+ pageX,
+ pageY,
+ mouseMoved;
+
+ this.container.mousemove(function(e){
+ if (Math.abs(pageX - e.pageX) + Math.abs(pageY - e.pageY) > 2) {
+ mouseMoved = true;
+ }
+ });
+
+ /* Can not use common class selectors here because of the bug in jQuery
+ SVG handling, use with caution. */
+ this.container.delegate("[class~='jvectormap-element']", 'mouseover mouseout', function(e){
+ var baseVal = jvm.$(this).attr('class').baseVal || jvm.$(this).attr('class'),
+ type = baseVal.indexOf('jvectormap-region') === -1 ? 'marker' : 'region',
+ code = type == 'region' ? jvm.$(this).attr('data-code') : jvm.$(this).attr('data-index'),
+ element = type == 'region' ? map.regions[code].element : map.markers[code].element,
+ tipText = type == 'region' ? map.mapData.paths[code].name : (map.markers[code].config.name || ''),
+ tipShowEvent = jvm.$.Event(type+'TipShow.jvectormap'),
+ overEvent = jvm.$.Event(type+'Over.jvectormap');
+
+ if (e.type == 'mouseover') {
+ map.container.trigger(overEvent, [code]);
+ if (!overEvent.isDefaultPrevented()) {
+ element.setHovered(true);
+ }
+
+ map.tip.text(tipText);
+ map.container.trigger(tipShowEvent, [map.tip, code]);
+ if (!tipShowEvent.isDefaultPrevented()) {
+ map.tip.show();
+ map.tipWidth = map.tip.width();
+ map.tipHeight = map.tip.height();
+ }
+ } else {
+ element.setHovered(false);
+ map.tip.hide();
+ map.container.trigger(type+'Out.jvectormap', [code]);
+ }
+ });
+
+ /* Can not use common class selectors here because of the bug in jQuery
+ SVG handling, use with caution. */
+ this.container.delegate("[class~='jvectormap-element']", 'mousedown', function(e){
+ pageX = e.pageX;
+ pageY = e.pageY;
+ mouseMoved = false;
+ });
+
+ /* Can not use common class selectors here because of the bug in jQuery
+ SVG handling, use with caution. */
+ this.container.delegate("[class~='jvectormap-element']", 'mouseup', function(){
+ var baseVal = jvm.$(this).attr('class').baseVal ? jvm.$(this).attr('class').baseVal : jvm.$(this).attr('class'),
+ type = baseVal.indexOf('jvectormap-region') === -1 ? 'marker' : 'region',
+ code = type == 'region' ? jvm.$(this).attr('data-code') : jvm.$(this).attr('data-index'),
+ clickEvent = jvm.$.Event(type+'Click.jvectormap'),
+ element = type == 'region' ? map.regions[code].element : map.markers[code].element;
+
+ if (!mouseMoved) {
+ map.container.trigger(clickEvent, [code]);
+ if ((type === 'region' && map.params.regionsSelectable) || (type === 'marker' && map.params.markersSelectable)) {
+ if (!clickEvent.isDefaultPrevented()) {
+ if (map.params[type+'sSelectableOne']) {
+ map.clearSelected(type+'s');
+ }
+ element.setSelected(!element.isSelected);
+ }
+ }
+ }
+ });
+ },
+
+ bindZoomButtons: function() {
+ var map = this;
+
+ jvm.$('').addClass('jvectormap-zoomin').text('+').appendTo(this.container);
+ jvm.$('').addClass('jvectormap-zoomout').html('−').appendTo(this.container);
+
+ this.container.find('.jvectormap-zoomin').click(function(){
+ map.setScale(map.scale * map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
+ });
+ this.container.find('.jvectormap-zoomout').click(function(){
+ map.setScale(map.scale / map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
+ });
+ },
+
+ createTip: function(){
+ var map = this;
+
+ this.tip = jvm.$('').addClass('jvectormap-tip').appendTo(jvm.$('body'));
+
+ this.container.mousemove(function(e){
+ var left = e.pageX-15-map.tipWidth,
+ top = e.pageY-15-map.tipHeight;
+
+ if (left < 5) {
+ left = e.pageX + 15;
+ }
+ if (top < 5) {
+ top = e.pageY + 15;
+ }
+
+ map.tip.css({
+ left: left,
+ top: top
+ });
+ });
+ },
+
+ setScale: function(scale, anchorX, anchorY, isCentered, animate) {
+ var viewportChangeEvent = jvm.$.Event('zoom.jvectormap'),
+ interval,
+ that = this,
+ i = 0,
+ count = Math.abs(Math.round((scale - this.scale) * 60 / Math.max(scale, this.scale))),
+ scaleStart,
+ scaleDiff,
+ transXStart,
+ transXDiff,
+ transYStart,
+ transYDiff,
+ transX,
+ transY,
+ deferred = new jvm.$.Deferred();
+
+ if (scale > this.params.zoomMax * this.baseScale) {
+ scale = this.params.zoomMax * this.baseScale;
+ } else if (scale < this.params.zoomMin * this.baseScale) {
+ scale = this.params.zoomMin * this.baseScale;
+ }
+
+ if (typeof anchorX != 'undefined' && typeof anchorY != 'undefined') {
+ zoomStep = scale / this.scale;
+ if (isCentered) {
+ transX = anchorX + this.defaultWidth * (this.width / (this.defaultWidth * scale)) / 2;
+ transY = anchorY + this.defaultHeight * (this.height / (this.defaultHeight * scale)) / 2;
+ } else {
+ transX = this.transX - (zoomStep - 1) / scale * anchorX;
+ transY = this.transY - (zoomStep - 1) / scale * anchorY;
+ }
+ }
+
+ if (animate && count > 0) {
+ scaleStart = this.scale;
+ scaleDiff = (scale - scaleStart) / count;
+ transXStart = this.transX * this.scale;
+ transYStart = this.transY * this.scale;
+ transXDiff = (transX * scale - transXStart) / count;
+ transYDiff = (transY * scale - transYStart) / count;
+ interval = setInterval(function(){
+ i += 1;
+ that.scale = scaleStart + scaleDiff * i;
+ that.transX = (transXStart + transXDiff * i) / that.scale;
+ that.transY = (transYStart + transYDiff * i) / that.scale;
+ that.applyTransform();
+ if (i == count) {
+ clearInterval(interval);
+ that.container.trigger(viewportChangeEvent, [scale/that.baseScale]);
+ deferred.resolve();
+ }
+ }, 10);
+ } else {
+ this.transX = transX;
+ this.transY = transY;
+ this.scale = scale;
+ this.applyTransform();
+ this.container.trigger(viewportChangeEvent, [scale/this.baseScale]);
+ deferred.resolve();
+ }
+
+ return deferred;
+ },
+
+ /**
+ * Set the map's viewport to the specific point and set zoom of the map to the specific level. Point and zoom level could be defined in two ways: using the code of some region to focus on or a central point and zoom level as numbers.
+ * @param This method takes a configuration object as the single argument. The options passed to it are the following:
+ * @param {Array} params.regions Array of region codes to zoom to.
+ * @param {String} params.region Region code to zoom to.
+ * @param {Number} params.scale Map scale to set.
+ * @param {Number} params.lat Latitude to set viewport to.
+ * @param {Number} params.lng Longitude to set viewport to.
+ * @param {Number} params.x Number from 0 to 1 specifying the horizontal coordinate of the central point of the viewport.
+ * @param {Number} params.y Number from 0 to 1 specifying the vertical coordinate of the central point of the viewport.
+ * @param {Boolean} params.animate Indicates whether or not to animate the scale change and transition.
+ */
+ setFocus: function(config){
+ var bbox,
+ itemBbox,
+ newBbox,
+ codes,
+ i,
+ point;
+
+ config = config || {};
+
+ if (config.region) {
+ codes = [config.region];
+ } else if (config.regions) {
+ codes = config.regions;
+ }
+
+ if (codes) {
+ for (i = 0; i < codes.length; i++) {
+ if (this.regions[codes[i]]) {
+ itemBbox = this.regions[codes[i]].element.shape.getBBox();
+ if (itemBbox) {
+ if (typeof bbox == 'undefined') {
+ bbox = itemBbox;
+ } else {
+ newBbox = {
+ x: Math.min(bbox.x, itemBbox.x),
+ y: Math.min(bbox.y, itemBbox.y),
+ width: Math.max(bbox.x + bbox.width, itemBbox.x + itemBbox.width) - Math.min(bbox.x, itemBbox.x),
+ height: Math.max(bbox.y + bbox.height, itemBbox.y + itemBbox.height) - Math.min(bbox.y, itemBbox.y)
+ }
+ bbox = newBbox;
+ }
+ }
+ }
+ }
+ return this.setScale(
+ Math.min(this.width / bbox.width, this.height / bbox.height),
+ - (bbox.x + bbox.width / 2),
+ - (bbox.y + bbox.height / 2),
+ true,
+ config.animate
+ );
+ } else {
+ if (config.lat && config.lng) {
+ point = this.latLngToPoint(config.lat, config.lng);
+ config.x = this.transX - point.x / this.scale;
+ config.y = this.transY - point.y / this.scale;
+ } else if (config.x && config.y) {
+ config.x *= -this.defaultWidth;
+ config.y *= -this.defaultHeight;
+ }
+ return this.setScale(config.scale * this.baseScale, config.x, config.y, true, config.animate);
+ }
+ },
+
+ getSelected: function(type){
+ var key,
+ selected = [];
+
+ for (key in this[type]) {
+ if (this[type][key].element.isSelected) {
+ selected.push(key);
+ }
+ }
+ return selected;
+ },
+
+ /**
+ * Return the codes of currently selected regions.
+ * @returns {Array}
+ */
+ getSelectedRegions: function(){
+ return this.getSelected('regions');
+ },
+
+ /**
+ * Return the codes of currently selected markers.
+ * @returns {Array}
+ */
+ getSelectedMarkers: function(){
+ return this.getSelected('markers');
+ },
+
+ setSelected: function(type, keys){
+ var i;
+
+ if (typeof keys != 'object') {
+ keys = [keys];
+ }
+
+ if (jvm.$.isArray(keys)) {
+ for (i = 0; i < keys.length; i++) {
+ this[type][keys[i]].element.setSelected(true);
+ }
+ } else {
+ for (i in keys) {
+ this[type][i].element.setSelected(!!keys[i]);
+ }
+ }
+ },
+
+ /**
+ * Set or remove selected state for the regions.
+ * @param {String|Array|Object} keys If String or Array the region(s) with the corresponding code(s) will be selected. If Object was provided its keys are codes of regions, state of which should be changed. Selected state will be set if value is true, removed otherwise.
+ */
+ setSelectedRegions: function(keys){
+ this.setSelected('regions', keys);
+ },
+
+ /**
+ * Set or remove selected state for the markers.
+ * @param {String|Array|Object} keys If String or Array the marker(s) with the corresponding code(s) will be selected. If Object was provided its keys are codes of markers, state of which should be changed. Selected state will be set if value is true, removed otherwise.
+ */
+ setSelectedMarkers: function(keys){
+ this.setSelected('markers', keys);
+ },
+
+ clearSelected: function(type){
+ var select = {},
+ selected = this.getSelected(type),
+ i;
+
+ for (i = 0; i < selected.length; i++) {
+ select[selected[i]] = false;
+ };
+
+ this.setSelected(type, select);
+ },
+
+ /**
+ * Remove the selected state from all the currently selected regions.
+ */
+ clearSelectedRegions: function(){
+ this.clearSelected('regions');
+ },
+
+ /**
+ * Remove the selected state from all the currently selected markers.
+ */
+ clearSelectedMarkers: function(){
+ this.clearSelected('markers');
+ },
+
+ /**
+ * Return the instance of Map. Useful when instantiated as a jQuery plug-in.
+ * @returns {Map}
+ */
+ getMapObject: function(){
+ return this;
+ },
+
+ /**
+ * Return the name of the region by region code.
+ * @returns {String}
+ */
+ getRegionName: function(code){
+ return this.mapData.paths[code].name;
+ },
+
+ createRegions: function(){
+ var key,
+ region,
+ map = this;
+
+ this.regionLabelsGroup = this.regionLabelsGroup || this.canvas.addGroup();
+
+ for (key in this.mapData.paths) {
+ region = new jvm.Region({
+ map: this,
+ path: this.mapData.paths[key].path,
+ code: key,
+ style: jvm.$.extend(true, {}, this.params.regionStyle),
+ labelStyle: jvm.$.extend(true, {}, this.params.regionLabelStyle),
+ canvas: this.canvas,
+ labelsGroup: this.regionLabelsGroup,
+ label: this.canvas.mode != 'vml' ? (this.params.labels && this.params.labels.regions) : null
+ });
+
+ jvm.$(region.shape).bind('selected', function(e, isSelected){
+ map.container.trigger('regionSelected.jvectormap', [jvm.$(this.node).attr('data-code'), isSelected, map.getSelectedRegions()]);
+ });
+ this.regions[key] = {
+ element: region,
+ config: this.mapData.paths[key]
+ };
+ }
+ },
+
+ createMarkers: function(markers) {
+ var i,
+ marker,
+ point,
+ markerConfig,
+ markersArray,
+ map = this;
+
+ this.markersGroup = this.markersGroup || this.canvas.addGroup();
+ this.markerLabelsGroup = this.markerLabelsGroup || this.canvas.addGroup();
+
+ if (jvm.$.isArray(markers)) {
+ markersArray = markers.slice();
+ markers = {};
+ for (i = 0; i < markersArray.length; i++) {
+ markers[i] = markersArray[i];
+ }
+ }
+
+ for (i in markers) {
+ markerConfig = markers[i] instanceof Array ? {latLng: markers[i]} : markers[i];
+ point = this.getMarkerPosition( markerConfig );
+
+ if (point !== false) {
+ marker = new jvm.Marker({
+ map: this,
+ style: jvm.$.extend(true, {}, this.params.markerStyle, {initial: markerConfig.style || {}}),
+ labelStyle: jvm.$.extend(true, {}, this.params.markerLabelStyle),
+ index: i,
+ cx: point.x,
+ cy: point.y,
+ group: this.markersGroup,
+ canvas: this.canvas,
+ labelsGroup: this.markerLabelsGroup,
+ label: this.canvas.mode != 'vml' ? (this.params.labels && this.params.labels.markers) : null
+ });
+
+ jvm.$(marker.shape).bind('selected', function(e, isSelected){
+ map.container.trigger('markerSelected.jvectormap', [jvm.$(this.node).attr('data-index'), isSelected, map.getSelectedMarkers()]);
+ });
+ if (this.markers[i]) {
+ this.removeMarkers([i]);
+ }
+ this.markers[i] = {element: marker, config: markerConfig};
+ }
+ }
+ },
+
+ repositionMarkers: function() {
+ var i,
+ point;
+
+ for (i in this.markers) {
+ point = this.getMarkerPosition( this.markers[i].config );
+ if (point !== false) {
+ this.markers[i].element.setStyle({cx: point.x, cy: point.y});
+ }
+ }
+ },
+
+ repositionLabels: function() {
+ var key;
+
+ for (key in this.regions) {
+ this.regions[key].element.updateLabelPosition();
+ }
+
+ for (key in this.markers) {
+ this.markers[key].element.updateLabelPosition();
+ }
+ },
+
+ getMarkerPosition: function(markerConfig) {
+ if (jvm.Map.maps[this.params.map].projection) {
+ return this.latLngToPoint.apply(this, markerConfig.latLng || [0, 0]);
+ } else {
+ return {
+ x: markerConfig.coords[0]*this.scale + this.transX*this.scale,
+ y: markerConfig.coords[1]*this.scale + this.transY*this.scale
+ };
+ }
+ },
+
+ /**
+ * Add one marker to the map.
+ * @param {String} key Marker unique code.
+ * @param {Object} marker Marker configuration parameters.
+ * @param {Array} seriesData Values to add to the data series.
+ */
+ addMarker: function(key, marker, seriesData){
+ var markers = {},
+ data = [],
+ values,
+ i,
+ seriesData = seriesData || [];
+
+ markers[key] = marker;
+
+ for (i = 0; i < seriesData.length; i++) {
+ values = {};
+ if (typeof seriesData[i] !== 'undefined') {
+ values[key] = seriesData[i];
+ }
+ data.push(values);
+ }
+ this.addMarkers(markers, data);
+ },
+
+ /**
+ * Add set of marker to the map.
+ * @param {Object|Array} markers Markers to add to the map. In case of array is provided, codes of markers will be set as string representations of array indexes.
+ * @param {Array} seriesData Values to add to the data series.
+ */
+ addMarkers: function(markers, seriesData){
+ var i;
+
+ seriesData = seriesData || [];
+
+ this.createMarkers(markers);
+ for (i = 0; i < seriesData.length; i++) {
+ this.series.markers[i].setValues(seriesData[i] || {});
+ };
+ },
+
+ /**
+ * Remove some markers from the map.
+ * @param {Array} markers Array of marker codes to be removed.
+ */
+ removeMarkers: function(markers){
+ var i;
+
+ for (i = 0; i < markers.length; i++) {
+ this.markers[ markers[i] ].element.remove();
+ delete this.markers[ markers[i] ];
+ };
+ },
+
+ /**
+ * Remove all markers from the map.
+ */
+ removeAllMarkers: function(){
+ var i,
+ markers = [];
+
+ for (i in this.markers) {
+ markers.push(i);
+ }
+ this.removeMarkers(markers)
+ },
+
+ /**
+ * Converts coordinates expressed as latitude and longitude to the coordinates in pixels on the map.
+ * @param {Number} lat Latitide of point in degrees.
+ * @param {Number} lng Longitude of point in degrees.
+ */
+ latLngToPoint: function(lat, lng) {
+ var point,
+ proj = jvm.Map.maps[this.params.map].projection,
+ centralMeridian = proj.centralMeridian,
+ inset,
+ bbox;
+
+ if (lng < (-180 + centralMeridian)) {
+ lng += 360;
+ }
+
+ point = jvm.Proj[proj.type](lat, lng, centralMeridian);
+
+ inset = this.getInsetForPoint(point.x, point.y);
+ if (inset) {
+ bbox = inset.bbox;
+
+ point.x = (point.x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale;
+ point.y = (point.y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale;
+
+ return {
+ x: point.x + this.transX*this.scale + inset.left*this.scale,
+ y: point.y + this.transY*this.scale + inset.top*this.scale
+ };
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ * Converts cartesian coordinates into coordinates expressed as latitude and longitude.
+ * @param {Number} x X-axis of point on map in pixels.
+ * @param {Number} y Y-axis of point on map in pixels.
+ */
+ pointToLatLng: function(x, y) {
+ var proj = jvm.Map.maps[this.params.map].projection,
+ centralMeridian = proj.centralMeridian,
+ insets = jvm.Map.maps[this.params.map].insets,
+ i,
+ inset,
+ bbox,
+ nx,
+ ny;
+
+ for (i = 0; i < insets.length; i++) {
+ inset = insets[i];
+ bbox = inset.bbox;
+
+ nx = x - (this.transX*this.scale + inset.left*this.scale);
+ ny = y - (this.transY*this.scale + inset.top*this.scale);
+
+ nx = (nx / (inset.width * this.scale)) * (bbox[1].x - bbox[0].x) + bbox[0].x;
+ ny = (ny / (inset.height * this.scale)) * (bbox[1].y - bbox[0].y) + bbox[0].y;
+
+ if (nx > bbox[0].x && nx < bbox[1].x && ny > bbox[0].y && ny < bbox[1].y) {
+ return jvm.Proj[proj.type + '_inv'](nx, -ny, centralMeridian);
+ }
+ }
+
+ return false;
+ },
+
+ getInsetForPoint: function(x, y){
+ var insets = jvm.Map.maps[this.params.map].insets,
+ i,
+ bbox;
+
+ for (i = 0; i < insets.length; i++) {
+ bbox = insets[i].bbox;
+ if (x > bbox[0].x && x < bbox[1].x && y > bbox[0].y && y < bbox[1].y) {
+ return insets[i];
+ }
+ }
+ },
+
+ createSeries: function(){
+ var i,
+ key;
+
+ this.series = {
+ markers: [],
+ regions: []
+ };
+
+ for (key in this.params.series) {
+ for (i = 0; i < this.params.series[key].length; i++) {
+ this.series[key][i] = new jvm.DataSeries(
+ this.params.series[key][i],
+ this[key],
+ this
+ );
+ }
+ }
+ },
+
+ /**
+ * Gracefully remove the map and and all its accessories, unbind event handlers.
+ */
+ remove: function(){
+ this.tip.remove();
+ this.container.remove();
+ jvm.$(window).unbind('resize', this.onResize);
+ jvm.$('body').unbind('mouseup', this.onContainerMouseUp);
+ }
+};
+
+jvm.Map.maps = {};
+jvm.Map.defaultParams = {
+ map: 'world_mill_en',
+ backgroundColor: '#505050',
+ zoomButtons: true,
+ zoomOnScroll: true,
+ zoomOnScrollSpeed: 3,
+ panOnDrag: true,
+ zoomMax: 8,
+ zoomMin: 1,
+ zoomStep: 1.6,
+ zoomAnimate: true,
+ regionsSelectable: false,
+ markersSelectable: false,
+ bindTouchEvents: true,
+ regionStyle: {
+ initial: {
+ fill: 'white',
+ "fill-opacity": 1,
+ stroke: 'none',
+ "stroke-width": 0,
+ "stroke-opacity": 1
+ },
+ hover: {
+ "fill-opacity": 0.8,
+ cursor: 'pointer'
+ },
+ selected: {
+ fill: 'yellow'
+ },
+ selectedHover: {
+ }
+ },
+ regionLabelStyle: {
+ initial: {
+ 'font-family': 'Verdana',
+ 'font-size': '12',
+ 'font-weight': 'bold',
+ cursor: 'default',
+ fill: 'black'
+ },
+ hover: {
+ cursor: 'pointer'
+ }
+ },
+ markerStyle: {
+ initial: {
+ fill: 'grey',
+ stroke: '#505050',
+ "fill-opacity": 1,
+ "stroke-width": 1,
+ "stroke-opacity": 1,
+ r: 5
+ },
+ hover: {
+ stroke: 'black',
+ "stroke-width": 2,
+ cursor: 'pointer'
+ },
+ selected: {
+ fill: 'blue'
+ },
+ selectedHover: {
+ }
+ },
+ markerLabelStyle: {
+ initial: {
+ 'font-family': 'Verdana',
+ 'font-size': '12',
+ 'font-weight': 'bold',
+ cursor: 'default',
+ fill: 'black'
+ },
+ hover: {
+ cursor: 'pointer'
+ }
+ }
+};
+jvm.Map.apiEvents = {
+ onRegionTipShow: 'regionTipShow',
+ onRegionOver: 'regionOver',
+ onRegionOut: 'regionOut',
+ onRegionClick: 'regionClick',
+ onRegionSelected: 'regionSelected',
+ onMarkerTipShow: 'markerTipShow',
+ onMarkerOver: 'markerOver',
+ onMarkerOut: 'markerOut',
+ onMarkerClick: 'markerClick',
+ onMarkerSelected: 'markerSelected',
+ onViewportChange: 'viewportChange'
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/marker.js b/public/bower_components/jvectormap/src/marker.js
new file mode 100644
index 0000000..8277500
--- /dev/null
+++ b/public/bower_components/jvectormap/src/marker.js
@@ -0,0 +1,76 @@
+jvm.Marker = function(config){
+ var text,
+ offsets;
+
+ this.config = config;
+ this.map = this.config.map;
+
+ this.isImage = !!this.config.style.initial.image;
+ this.createShape();
+
+ text = this.getLabelText(config.index);
+ if (this.config.label && text) {
+ this.offsets = this.getLabelOffsets(config.index);
+ this.labelX = config.cx / this.map.scale - this.map.transX;
+ this.labelY = config.cy / this.map.scale - this.map.transY;
+ this.label = config.canvas.addText({
+ text: text,
+ 'data-index': config.index,
+ dy: "0.6ex",
+ x: this.labelX,
+ y: this.labelY
+ }, config.labelStyle, config.labelsGroup);
+
+ this.label.addClass('jvectormap-marker jvectormap-element');
+ }
+};
+
+jvm.inherits(jvm.Marker, jvm.MapObject);
+
+jvm.Marker.prototype.createShape = function(){
+ var that = this;
+
+ if (this.shape) {
+ this.shape.remove();
+ }
+ this.shape = this.config.canvas[this.isImage ? 'addImage' : 'addCircle']({
+ "data-index": this.config.index,
+ cx: this.config.cx,
+ cy: this.config.cy
+ }, this.config.style, this.config.group);
+
+ this.shape.addClass('jvectormap-marker jvectormap-element');
+
+ if (this.isImage) {
+ jvm.$(this.shape.node).on('imageloaded', function(){
+ that.updateLabelPosition();
+ });
+ }
+};
+
+jvm.Marker.prototype.updateLabelPosition = function(){
+ if (this.label) {
+ this.label.set({
+ x: this.labelX * this.map.scale + this.offsets[0] +
+ this.map.transX * this.map.scale + 5 + (this.isImage ? (this.shape.width || 0) / 2 : this.shape.properties.r),
+ y: this.labelY * this.map.scale + this.map.transY * this.map.scale + this.offsets[1]
+ });
+ }
+};
+
+jvm.Marker.prototype.setStyle = function(property, value){
+ var isImage;
+
+ jvm.Marker.parentClass.prototype.setStyle.apply(this, arguments);
+
+ if (property === 'r') {
+ this.updateLabelPosition();
+ }
+
+ isImage = !!this.shape.get('image');
+ if (isImage != this.isImage) {
+ this.isImage = isImage;
+ this.config.style = jvm.$.extend(true, {}, this.shape.style);
+ this.createShape();
+ }
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/multimap.js b/public/bower_components/jvectormap/src/multimap.js
new file mode 100644
index 0000000..fb91201
--- /dev/null
+++ b/public/bower_components/jvectormap/src/multimap.js
@@ -0,0 +1,139 @@
+/**
+ * Creates map with drill-down functionality.
+ * @constructor
+ * @param {Object} params Parameters to initialize map with.
+ * @param {Number} params.maxLevel Maximum number of levels user can go through
+ * @param {Object} params.main Config of the main map. See jvm.Map for more information.
+ * @param {Function} params.mapNameByCode Function go generate map name by region code. Default value is:
+
+ */
+jvm.MultiMap = function(params) {
+ var that = this;
+
+ this.maps = {};
+ this.params = jvm.$.extend(true, {}, jvm.MultiMap.defaultParams, params);
+ this.params.maxLevel = this.params.maxLevel || Number.MAX_VALUE;
+ this.params.main = this.params.main || {};
+ this.params.main.multiMapLevel = 0;
+ this.history = [ this.addMap(this.params.main.map, this.params.main) ];
+ this.defaultProjection = this.history[0].mapData.projection.type;
+ this.mapsLoaded = {};
+
+ this.params.container.css({position: 'relative'});
+ this.backButton = jvm.$('').addClass('jvectormap-goback').text('Back').appendTo(this.params.container);
+ this.backButton.hide();
+ this.backButton.click(function(){
+ that.goBack();
+ });
+
+ this.spinner = jvm.$('').addClass('jvectormap-spinner').appendTo(this.params.container);
+ this.spinner.hide();
+};
+
+jvm.MultiMap.prototype = {
+ addMap: function(name, config){
+ var cnt = jvm.$('').css({
+ width: '100%',
+ height: '100%'
+ });
+
+ this.params.container.append(cnt);
+
+ this.maps[name] = new jvm.Map(jvm.$.extend(config, {container: cnt}));
+ if (this.params.maxLevel > config.multiMapLevel) {
+ this.maps[name].container.on('regionClick.jvectormap', {scope: this}, function(e, code){
+ var multimap = e.data.scope,
+ mapName = multimap.params.mapNameByCode(code, multimap);
+
+ if (!multimap.drillDownPromise || multimap.drillDownPromise.state() !== 'pending') {
+ multimap.drillDown(mapName, code);
+ }
+ });
+ }
+
+
+ return this.maps[name];
+ },
+
+ downloadMap: function(code){
+ var that = this,
+ deferred = jvm.$.Deferred();
+
+ if (!this.mapsLoaded[code]) {
+ jvm.$.get(this.params.mapUrlByCode(code, this)).then(function(){
+ that.mapsLoaded[code] = true;
+ deferred.resolve();
+ }, function(){
+ deferred.reject();
+ });
+ } else {
+ deferred.resolve();
+ }
+ return deferred;
+ },
+
+ drillDown: function(name, code){
+ var currentMap = this.history[this.history.length - 1],
+ that = this,
+ focusPromise = currentMap.setFocus({region: code, animate: true}),
+ downloadPromise = this.downloadMap(code);
+
+ focusPromise.then(function(){
+ if (downloadPromise.state() === 'pending') {
+ that.spinner.show();
+ }
+ });
+ downloadPromise.always(function(){
+ that.spinner.hide();
+ });
+ this.drillDownPromise = jvm.$.when(downloadPromise, focusPromise);
+ this.drillDownPromise.then(function(){
+ currentMap.params.container.hide();
+ if (!that.maps[name]) {
+ that.addMap(name, {map: name, multiMapLevel: currentMap.params.multiMapLevel + 1});
+ } else {
+ that.maps[name].params.container.show();
+ }
+ that.history.push( that.maps[name] );
+ that.backButton.show();
+ });
+ },
+
+ goBack: function(){
+ var currentMap = this.history.pop(),
+ prevMap = this.history[this.history.length - 1],
+ that = this;
+
+ currentMap.setFocus({scale: 1, x: 0.5, y: 0.5, animate: true}).then(function(){
+ currentMap.params.container.hide();
+ prevMap.params.container.show();
+ prevMap.updateSize();
+ if (that.history.length === 1) {
+ that.backButton.hide();
+ }
+ prevMap.setFocus({scale: 1, x: 0.5, y: 0.5, animate: true});
+ });
+ }
+};
+
+jvm.MultiMap.defaultParams = {
+ mapNameByCode: function(code, multiMap){
+ return code.toLowerCase()+'_'+multiMap.defaultProjection+'_en';
+ },
+ mapUrlByCode: function(code, multiMap){
+ return 'jquery-jvectormap-data-'+code.toLowerCase()+'-'+multiMap.defaultProjection+'-en.js';
+ }
+}
diff --git a/public/bower_components/jvectormap/src/numeric-scale.js b/public/bower_components/jvectormap/src/numeric-scale.js
new file mode 100644
index 0000000..510151a
--- /dev/null
+++ b/public/bower_components/jvectormap/src/numeric-scale.js
@@ -0,0 +1,185 @@
+jvm.NumericScale = function(scale, normalizeFunction, minValue, maxValue) {
+ this.scale = [];
+
+ normalizeFunction = normalizeFunction || 'linear';
+
+ if (scale) this.setScale(scale);
+ if (normalizeFunction) this.setNormalizeFunction(normalizeFunction);
+ if (typeof minValue !== 'undefined' ) this.setMin(minValue);
+ if (typeof maxValue !== 'undefined' ) this.setMax(maxValue);
+};
+
+jvm.NumericScale.prototype = {
+ setMin: function(min) {
+ this.clearMinValue = min;
+ if (typeof this.normalize === 'function') {
+ this.minValue = this.normalize(min);
+ } else {
+ this.minValue = min;
+ }
+ },
+
+ setMax: function(max) {
+ this.clearMaxValue = max;
+ if (typeof this.normalize === 'function') {
+ this.maxValue = this.normalize(max);
+ } else {
+ this.maxValue = max;
+ }
+ },
+
+ setScale: function(scale) {
+ var i;
+
+ this.scale = [];
+ for (i = 0; i < scale.length; i++) {
+ this.scale[i] = [scale[i]];
+ }
+ },
+
+ setNormalizeFunction: function(f) {
+ if (f === 'polynomial') {
+ this.normalize = function(value) {
+ return Math.pow(value, 0.2);
+ }
+ } else if (f === 'linear') {
+ delete this.normalize;
+ } else {
+ this.normalize = f;
+ }
+ this.setMin(this.clearMinValue);
+ this.setMax(this.clearMaxValue);
+ },
+
+ getValue: function(value) {
+ var lengthes = [],
+ fullLength = 0,
+ l,
+ i = 0,
+ c;
+
+ if (typeof this.normalize === 'function') {
+ value = this.normalize(value);
+ }
+ for (i = 0; i < this.scale.length-1; i++) {
+ l = this.vectorLength(this.vectorSubtract(this.scale[i+1], this.scale[i]));
+ lengthes.push(l);
+ fullLength += l;
+ }
+
+ c = (this.maxValue - this.minValue) / fullLength;
+ for (i=0; i= 0) {
+ value -= lengthes[i];
+ i++;
+ }
+
+ if (i == this.scale.length - 1) {
+ value = this.vectorToNum(this.scale[i])
+ } else {
+ value = (
+ this.vectorToNum(
+ this.vectorAdd(this.scale[i],
+ this.vectorMult(
+ this.vectorSubtract(this.scale[i+1], this.scale[i]),
+ (value) / (lengthes[i])
+ )
+ )
+ )
+ );
+ }
+
+ return value;
+ },
+
+ vectorToNum: function(vector) {
+ var num = 0,
+ i;
+
+ for (i = 0; i < vector.length; i++) {
+ num += Math.round(vector[i])*Math.pow(256, vector.length-i-1);
+ }
+ return num;
+ },
+
+ vectorSubtract: function(vector1, vector2) {
+ var vector = [],
+ i;
+
+ for (i = 0; i < vector1.length; i++) {
+ vector[i] = vector1[i] - vector2[i];
+ }
+ return vector;
+ },
+
+ vectorAdd: function(vector1, vector2) {
+ var vector = [],
+ i;
+
+ for (i = 0; i < vector1.length; i++) {
+ vector[i] = vector1[i] + vector2[i];
+ }
+ return vector;
+ },
+
+ vectorMult: function(vector, num) {
+ var result = [],
+ i;
+
+ for (i = 0; i < vector.length; i++) {
+ result[i] = vector[i] * num;
+ }
+ return result;
+ },
+
+ vectorLength: function(vector) {
+ var result = 0,
+ i;
+ for (i = 0; i < vector.length; i++) {
+ result += vector[i] * vector[i];
+ }
+ return Math.sqrt(result);
+ },
+
+ /* Derived from d3 implementation https://github.com/mbostock/d3/blob/master/src/scale/linear.js#L94 */
+ getTicks: function(){
+ var m = 5,
+ extent = [this.clearMinValue, this.clearMaxValue],
+ span = extent[1] - extent[0],
+ step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
+ err = m / span * step,
+ ticks = [],
+ tick,
+ v;
+
+ if (err <= .15) step *= 10;
+ else if (err <= .35) step *= 5;
+ else if (err <= .75) step *= 2;
+
+ extent[0] = Math.floor(extent[0] / step) * step;
+ extent[1] = Math.ceil(extent[1] / step) * step;
+
+ tick = extent[0];
+ while (tick <= extent[1]) {
+ if (tick == extent[0]) {
+ v = this.clearMinValue;
+ } else if (tick == extent[1]) {
+ v = this.clearMaxValue;
+ } else {
+ v = tick;
+ }
+ ticks.push({
+ label: tick,
+ value: this.getValue(v)
+ });
+ tick += step;
+ }
+
+ return ticks;
+ }
+};
diff --git a/public/bower_components/jvectormap/src/ordinal-scale.js b/public/bower_components/jvectormap/src/ordinal-scale.js
new file mode 100644
index 0000000..0b12043
--- /dev/null
+++ b/public/bower_components/jvectormap/src/ordinal-scale.js
@@ -0,0 +1,21 @@
+jvm.OrdinalScale = function(scale){
+ this.scale = scale;
+};
+
+jvm.OrdinalScale.prototype.getValue = function(value){
+ return this.scale[value];
+};
+
+jvm.OrdinalScale.prototype.getTicks = function(){
+ var ticks = [],
+ key;
+
+ for (key in this.scale) {
+ ticks.push({
+ label: key,
+ value: this.scale[key]
+ });
+ }
+
+ return ticks;
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/proj.js b/public/bower_components/jvectormap/src/proj.js
new file mode 100644
index 0000000..f9c3913
--- /dev/null
+++ b/public/bower_components/jvectormap/src/proj.js
@@ -0,0 +1,181 @@
+/**
+ * Contains methods for transforming point on sphere to
+ * Cartesian coordinates using various projections.
+ * @class
+ */
+jvm.Proj = {
+ degRad: 180 / Math.PI,
+ radDeg: Math.PI / 180,
+ radius: 6381372,
+
+ sgn: function(n){
+ if (n > 0) {
+ return 1;
+ } else if (n < 0) {
+ return -1;
+ } else {
+ return n;
+ }
+ },
+
+ /**
+ * Converts point on sphere to the Cartesian coordinates using Miller projection
+ * @param {Number} lat Latitude in degrees
+ * @param {Number} lng Longitude in degrees
+ * @param {Number} c Central meridian in degrees
+ */
+ mill: function(lat, lng, c){
+ return {
+ x: this.radius * (lng - c) * this.radDeg,
+ y: - this.radius * Math.log(Math.tan((45 + 0.4 * lat) * this.radDeg)) / 0.8
+ };
+ },
+
+ /**
+ * Inverse function of mill()
+ * Converts Cartesian coordinates to point on sphere using Miller projection
+ * @param {Number} x X of point in Cartesian system as integer
+ * @param {Number} y Y of point in Cartesian system as integer
+ * @param {Number} c Central meridian in degrees
+ */
+ mill_inv: function(x, y, c){
+ return {
+ lat: (2.5 * Math.atan(Math.exp(0.8 * y / this.radius)) - 5 * Math.PI / 8) * this.degRad,
+ lng: (c * this.radDeg + x / this.radius) * this.degRad
+ };
+ },
+
+ /**
+ * Converts point on sphere to the Cartesian coordinates using Mercator projection
+ * @param {Number} lat Latitude in degrees
+ * @param {Number} lng Longitude in degrees
+ * @param {Number} c Central meridian in degrees
+ */
+ merc: function(lat, lng, c){
+ return {
+ x: this.radius * (lng - c) * this.radDeg,
+ y: - this.radius * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))
+ };
+ },
+
+ /**
+ * Inverse function of merc()
+ * Converts Cartesian coordinates to point on sphere using Mercator projection
+ * @param {Number} x X of point in Cartesian system as integer
+ * @param {Number} y Y of point in Cartesian system as integer
+ * @param {Number} c Central meridian in degrees
+ */
+ merc_inv: function(x, y, c){
+ return {
+ lat: (2 * Math.atan(Math.exp(y / this.radius)) - Math.PI / 2) * this.degRad,
+ lng: (c * this.radDeg + x / this.radius) * this.degRad
+ };
+ },
+
+ /**
+ * Converts point on sphere to the Cartesian coordinates using Albers Equal-Area Conic
+ * projection
+ * @see Albers Equal-Area Conic projection
+ * @param {Number} lat Latitude in degrees
+ * @param {Number} lng Longitude in degrees
+ * @param {Number} c Central meridian in degrees
+ */
+ aea: function(lat, lng, c){
+ var fi0 = 0,
+ lambda0 = c * this.radDeg,
+ fi1 = 29.5 * this.radDeg,
+ fi2 = 45.5 * this.radDeg,
+ fi = lat * this.radDeg,
+ lambda = lng * this.radDeg,
+ n = (Math.sin(fi1)+Math.sin(fi2)) / 2,
+ C = Math.cos(fi1)*Math.cos(fi1)+2*n*Math.sin(fi1),
+ theta = n*(lambda-lambda0),
+ ro = Math.sqrt(C-2*n*Math.sin(fi))/n,
+ ro0 = Math.sqrt(C-2*n*Math.sin(fi0))/n;
+
+ return {
+ x: ro * Math.sin(theta) * this.radius,
+ y: - (ro0 - ro * Math.cos(theta)) * this.radius
+ };
+ },
+
+ /**
+ * Converts Cartesian coordinates to the point on sphere using Albers Equal-Area Conic
+ * projection
+ * @see Albers Equal-Area Conic projection
+ * @param {Number} x X of point in Cartesian system as integer
+ * @param {Number} y Y of point in Cartesian system as integer
+ * @param {Number} c Central meridian in degrees
+ */
+ aea_inv: function(xCoord, yCoord, c){
+ var x = xCoord / this.radius,
+ y = yCoord / this.radius,
+ fi0 = 0,
+ lambda0 = c * this.radDeg,
+ fi1 = 29.5 * this.radDeg,
+ fi2 = 45.5 * this.radDeg,
+ n = (Math.sin(fi1)+Math.sin(fi2)) / 2,
+ C = Math.cos(fi1)*Math.cos(fi1)+2*n*Math.sin(fi1),
+ ro0 = Math.sqrt(C-2*n*Math.sin(fi0))/n,
+ ro = Math.sqrt(x*x+(ro0-y)*(ro0-y)),
+ theta = Math.atan( x / (ro0 - y) );
+
+ return {
+ lat: (Math.asin((C - ro * ro * n * n) / (2 * n))) * this.degRad,
+ lng: (lambda0 + theta / n) * this.degRad
+ };
+ },
+
+ /**
+ * Converts point on sphere to the Cartesian coordinates using Lambert conformal
+ * conic projection
+ * @see Lambert Conformal Conic Projection
+ * @param {Number} lat Latitude in degrees
+ * @param {Number} lng Longitude in degrees
+ * @param {Number} c Central meridian in degrees
+ */
+ lcc: function(lat, lng, c){
+ var fi0 = 0,
+ lambda0 = c * this.radDeg,
+ lambda = lng * this.radDeg,
+ fi1 = 33 * this.radDeg,
+ fi2 = 45 * this.radDeg,
+ fi = lat * this.radDeg,
+ n = Math.log( Math.cos(fi1) * (1 / Math.cos(fi2)) ) / Math.log( Math.tan( Math.PI / 4 + fi2 / 2) * (1 / Math.tan( Math.PI / 4 + fi1 / 2) ) ),
+ F = ( Math.cos(fi1) * Math.pow( Math.tan( Math.PI / 4 + fi1 / 2 ), n ) ) / n,
+ ro = F * Math.pow( 1 / Math.tan( Math.PI / 4 + fi / 2 ), n ),
+ ro0 = F * Math.pow( 1 / Math.tan( Math.PI / 4 + fi0 / 2 ), n );
+
+ return {
+ x: ro * Math.sin( n * (lambda - lambda0) ) * this.radius,
+ y: - (ro0 - ro * Math.cos( n * (lambda - lambda0) ) ) * this.radius
+ };
+ },
+
+ /**
+ * Converts Cartesian coordinates to the point on sphere using Lambert conformal conic
+ * projection
+ * @see Lambert Conformal Conic Projection
+ * @param {Number} x X of point in Cartesian system as integer
+ * @param {Number} y Y of point in Cartesian system as integer
+ * @param {Number} c Central meridian in degrees
+ */
+ lcc_inv: function(xCoord, yCoord, c){
+ var x = xCoord / this.radius,
+ y = yCoord / this.radius,
+ fi0 = 0,
+ lambda0 = c * this.radDeg,
+ fi1 = 33 * this.radDeg,
+ fi2 = 45 * this.radDeg,
+ n = Math.log( Math.cos(fi1) * (1 / Math.cos(fi2)) ) / Math.log( Math.tan( Math.PI / 4 + fi2 / 2) * (1 / Math.tan( Math.PI / 4 + fi1 / 2) ) ),
+ F = ( Math.cos(fi1) * Math.pow( Math.tan( Math.PI / 4 + fi1 / 2 ), n ) ) / n,
+ ro0 = F * Math.pow( 1 / Math.tan( Math.PI / 4 + fi0 / 2 ), n ),
+ ro = this.sgn(n) * Math.sqrt(x*x+(ro0-y)*(ro0-y)),
+ theta = Math.atan( x / (ro0 - y) );
+
+ return {
+ lat: (2 * Math.atan(Math.pow(F/ro, 1/n)) - Math.PI / 2) * this.degRad,
+ lng: (lambda0 + theta / n) * this.degRad
+ };
+ }
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/region.js b/public/bower_components/jvectormap/src/region.js
new file mode 100644
index 0000000..9ed9855
--- /dev/null
+++ b/public/bower_components/jvectormap/src/region.js
@@ -0,0 +1,45 @@
+jvm.Region = function(config){
+ var bbox,
+ text,
+ offsets,
+ labelDx,
+ labelDy;
+
+ this.config = config;
+ this.map = this.config.map;
+
+ this.shape = config.canvas.addPath({
+ d: config.path,
+ 'data-code': config.code
+ }, config.style, config.canvas.rootElement);
+ this.shape.addClass('jvectormap-region jvectormap-element');
+
+ bbox = this.shape.getBBox();
+
+ text = this.getLabelText(config.code);
+ if (this.config.label && text) {
+ offsets = this.getLabelOffsets(config.code);
+ this.labelX = bbox.x + bbox.width / 2 + offsets[0];
+ this.labelY = bbox.y + bbox.height / 2 + offsets[1];
+ this.label = config.canvas.addText({
+ text: text,
+ 'text-anchor': 'middle',
+ 'alignment-baseline': 'central',
+ x: this.labelX,
+ y: this.labelY,
+ 'data-code': config.code
+ }, config.labelStyle, config.labelsGroup);
+ this.label.addClass('jvectormap-region jvectormap-element');
+ }
+};
+
+jvm.inherits(jvm.Region, jvm.MapObject);
+
+jvm.Region.prototype.updateLabelPosition = function(){
+ if (this.label) {
+ this.label.set({
+ x: this.labelX * this.map.scale + this.map.transX * this.map.scale,
+ y: this.labelY * this.map.scale + this.map.transY * this.map.scale
+ });
+ }
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/simple-scale.js b/public/bower_components/jvectormap/src/simple-scale.js
new file mode 100644
index 0000000..d06cbcd
--- /dev/null
+++ b/public/bower_components/jvectormap/src/simple-scale.js
@@ -0,0 +1,7 @@
+jvm.SimpleScale = function(scale){
+ this.scale = scale;
+};
+
+jvm.SimpleScale.prototype.getValue = function(value){
+ return value;
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/svg-canvas-element.js b/public/bower_components/jvectormap/src/svg-canvas-element.js
new file mode 100644
index 0000000..21cfcc9
--- /dev/null
+++ b/public/bower_components/jvectormap/src/svg-canvas-element.js
@@ -0,0 +1,26 @@
+jvm.SVGCanvasElement = function(container, width, height){
+ this.classPrefix = 'SVG';
+ jvm.SVGCanvasElement.parentClass.call(this, 'svg');
+
+ this.defsElement = new jvm.SVGElement('defs');
+ this.node.appendChild( this.defsElement.node );
+
+ jvm.AbstractCanvasElement.apply(this, arguments);
+}
+
+jvm.inherits(jvm.SVGCanvasElement, jvm.SVGElement);
+jvm.mixin(jvm.SVGCanvasElement, jvm.AbstractCanvasElement);
+
+jvm.SVGCanvasElement.prototype.setSize = function(width, height){
+ this.width = width;
+ this.height = height;
+ this.node.setAttribute('width', width);
+ this.node.setAttribute('height', height);
+};
+
+jvm.SVGCanvasElement.prototype.applyTransformParams = function(scale, transX, transY) {
+ this.scale = scale;
+ this.transX = transX;
+ this.transY = transY;
+ this.rootElement.node.setAttribute('transform', 'scale('+scale+') translate('+transX+', '+transY+')');
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/svg-circle-element.js b/public/bower_components/jvectormap/src/svg-circle-element.js
new file mode 100644
index 0000000..5c4e0c7
--- /dev/null
+++ b/public/bower_components/jvectormap/src/svg-circle-element.js
@@ -0,0 +1,5 @@
+jvm.SVGCircleElement = function(config, style){
+ jvm.SVGCircleElement.parentClass.call(this, 'circle', config, style);
+};
+
+jvm.inherits(jvm.SVGCircleElement, jvm.SVGShapeElement);
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/svg-element.js b/public/bower_components/jvectormap/src/svg-element.js
new file mode 100644
index 0000000..00b2d90
--- /dev/null
+++ b/public/bower_components/jvectormap/src/svg-element.js
@@ -0,0 +1,48 @@
+/**
+ * Wrapper for SVG element.
+ * @constructor
+ * @extends jvm.AbstractElement
+ * @param {String} name Tag name of the element
+ * @param {Object} config Set of parameters to initialize element with
+ */
+
+jvm.SVGElement = function(name, config){
+ jvm.SVGElement.parentClass.apply(this, arguments);
+}
+
+jvm.inherits(jvm.SVGElement, jvm.AbstractElement);
+
+jvm.SVGElement.svgns = "http://www.w3.org/2000/svg";
+
+/**
+ * Creates DOM element.
+ * @param {String} tagName Name of element
+ * @private
+ * @returns DOMElement
+ */
+jvm.SVGElement.prototype.createElement = function( tagName ){
+ return document.createElementNS( jvm.SVGElement.svgns, tagName );
+};
+
+/**
+ * Adds CSS class for underlying DOM element.
+ * @param {String} className Name of CSS class name
+ */
+jvm.SVGElement.prototype.addClass = function( className ){
+ this.node.setAttribute('class', className);
+};
+
+/**
+ * Returns constructor for element by name prefixed with 'VML'.
+ * @param {String} ctr Name of basic constructor to return
+ * proper implementation for.
+ * @returns Function
+ * @private
+ */
+jvm.SVGElement.prototype.getElementCtr = function( ctr ){
+ return jvm['SVG'+ctr];
+};
+
+jvm.SVGElement.prototype.getBBox = function(){
+ return this.node.getBBox();
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/svg-group-element.js b/public/bower_components/jvectormap/src/svg-group-element.js
new file mode 100644
index 0000000..86e1fab
--- /dev/null
+++ b/public/bower_components/jvectormap/src/svg-group-element.js
@@ -0,0 +1,9 @@
+jvm.SVGGroupElement = function(){
+ jvm.SVGGroupElement.parentClass.call(this, 'g');
+}
+
+jvm.inherits(jvm.SVGGroupElement, jvm.SVGElement);
+
+jvm.SVGGroupElement.prototype.add = function(element){
+ this.node.appendChild( element.node );
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/svg-image-element.js b/public/bower_components/jvectormap/src/svg-image-element.js
new file mode 100644
index 0000000..a89f482
--- /dev/null
+++ b/public/bower_components/jvectormap/src/svg-image-element.js
@@ -0,0 +1,36 @@
+jvm.SVGImageElement = function(config, style){
+ jvm.SVGImageElement.parentClass.call(this, 'image', config, style);
+};
+
+jvm.inherits(jvm.SVGImageElement, jvm.SVGShapeElement);
+
+jvm.SVGImageElement.prototype.applyAttr = function(attr, value){
+ var that = this;
+
+ if (attr == 'image') {
+ jvm.whenImageLoaded(value).then(function(img){
+ that.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', value);
+ that.width = img[0].width;
+ that.height = img[0].height;
+ that.applyAttr('width', that.width);
+ that.applyAttr('height', that.height);
+
+ that.applyAttr('x', that.cx - that.width / 2);
+ that.applyAttr('y', that.cy - that.height / 2);
+
+ jvm.$(that.node).trigger('imageloaded', [img]);
+ });
+ } else if(attr == 'cx') {
+ this.cx = value;
+ if (this.width) {
+ this.applyAttr('x', value - this.width / 2);
+ }
+ } else if(attr == 'cy') {
+ this.cy = value;
+ if (this.height) {
+ this.applyAttr('y', value - this.height / 2);
+ }
+ } else {
+ jvm.SVGImageElement.parentClass.prototype.applyAttr.apply(this, arguments);
+ }
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/svg-path-element.js b/public/bower_components/jvectormap/src/svg-path-element.js
new file mode 100644
index 0000000..71472f7
--- /dev/null
+++ b/public/bower_components/jvectormap/src/svg-path-element.js
@@ -0,0 +1,6 @@
+jvm.SVGPathElement = function(config, style){
+ jvm.SVGPathElement.parentClass.call(this, 'path', config, style);
+ this.node.setAttribute('fill-rule', 'evenodd');
+}
+
+jvm.inherits(jvm.SVGPathElement, jvm.SVGShapeElement);
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/svg-shape-element.js b/public/bower_components/jvectormap/src/svg-shape-element.js
new file mode 100644
index 0000000..74a90d1
--- /dev/null
+++ b/public/bower_components/jvectormap/src/svg-shape-element.js
@@ -0,0 +1,49 @@
+jvm.SVGShapeElement = function(name, config, style){
+ jvm.SVGShapeElement.parentClass.call(this, name, config);
+ jvm.AbstractShapeElement.apply(this, arguments);
+};
+
+jvm.inherits(jvm.SVGShapeElement, jvm.SVGElement);
+jvm.mixin(jvm.SVGShapeElement, jvm.AbstractShapeElement);
+
+jvm.SVGShapeElement.prototype.applyAttr = function(attr, value){
+ var patternEl,
+ imageEl,
+ that = this;
+
+ if (attr === 'fill' && jvm.isImageUrl(value)) {
+ if (!jvm.SVGShapeElement.images[value]) {
+ jvm.whenImageLoaded(value).then(function(img){
+ imageEl = new jvm.SVGElement('image');
+ imageEl.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', value);
+ imageEl.applyAttr('x', '0');
+ imageEl.applyAttr('y', '0');
+ imageEl.applyAttr('width', img[0].width);
+ imageEl.applyAttr('height', img[0].height);
+
+ patternEl = new jvm.SVGElement('pattern');
+ patternEl.applyAttr('id', 'image'+jvm.SVGShapeElement.imageCounter);
+ patternEl.applyAttr('x', 0);
+ patternEl.applyAttr('y', 0);
+ patternEl.applyAttr('width', img[0].width / 2);
+ patternEl.applyAttr('height', img[0].height / 2);
+ patternEl.applyAttr('viewBox', '0 0 '+img[0].width+' '+img[0].height);
+ patternEl.applyAttr('patternUnits', 'userSpaceOnUse');
+ patternEl.node.appendChild( imageEl.node );
+
+ that.canvas.defsElement.node.appendChild( patternEl.node );
+
+ jvm.SVGShapeElement.images[value] = jvm.SVGShapeElement.imageCounter++;
+
+ that.applyAttr('fill', 'url(#image'+jvm.SVGShapeElement.images[value]+')');
+ });
+ } else {
+ this.applyAttr('fill', 'url(#image'+jvm.SVGShapeElement.images[value]+')');
+ }
+ } else {
+ jvm.SVGShapeElement.parentClass.prototype.applyAttr.apply(this, arguments);
+ }
+};
+
+jvm.SVGShapeElement.imageCounter = 1;
+jvm.SVGShapeElement.images = {};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/svg-text-element.js b/public/bower_components/jvectormap/src/svg-text-element.js
new file mode 100644
index 0000000..3eafdc3
--- /dev/null
+++ b/public/bower_components/jvectormap/src/svg-text-element.js
@@ -0,0 +1,13 @@
+jvm.SVGTextElement = function(config, style){
+ jvm.SVGTextElement.parentClass.call(this, 'text', config, style);
+}
+
+jvm.inherits(jvm.SVGTextElement, jvm.SVGShapeElement);
+
+jvm.SVGTextElement.prototype.applyAttr = function(attr, value){
+ if (attr === 'text') {
+ this.node.textContent = value;
+ } else {
+ jvm.SVGTextElement.parentClass.prototype.applyAttr.apply(this, arguments);
+ }
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/vector-canvas.js b/public/bower_components/jvectormap/src/vector-canvas.js
new file mode 100644
index 0000000..02bb391
--- /dev/null
+++ b/public/bower_components/jvectormap/src/vector-canvas.js
@@ -0,0 +1,18 @@
+/**
+ * Class for vector images manipulations.
+ * @constructor
+ * @param {DOMElement} container to place canvas to
+ * @param {Number} width
+ * @param {Number} height
+ */
+jvm.VectorCanvas = function(container, width, height) {
+ this.mode = window.SVGAngle ? 'svg' : 'vml';
+
+ if (this.mode == 'svg') {
+ this.impl = new jvm.SVGCanvasElement(container, width, height);
+ } else {
+ this.impl = new jvm.VMLCanvasElement(container, width, height);
+ }
+ this.impl.mode = this.mode;
+ return this.impl;
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/vml-canvas-element.js b/public/bower_components/jvectormap/src/vml-canvas-element.js
new file mode 100644
index 0000000..79e203a
--- /dev/null
+++ b/public/bower_components/jvectormap/src/vml-canvas-element.js
@@ -0,0 +1,45 @@
+jvm.VMLCanvasElement = function(container, width, height){
+ this.classPrefix = 'VML';
+ jvm.VMLCanvasElement.parentClass.call(this, 'group');
+ jvm.AbstractCanvasElement.apply(this, arguments);
+ this.node.style.position = 'absolute';
+};
+
+jvm.inherits(jvm.VMLCanvasElement, jvm.VMLElement);
+jvm.mixin(jvm.VMLCanvasElement, jvm.AbstractCanvasElement);
+
+jvm.VMLCanvasElement.prototype.setSize = function(width, height){
+ var paths,
+ groups,
+ i,
+ l;
+
+ this.width = width;
+ this.height = height;
+ this.node.style.width = width + "px";
+ this.node.style.height = height + "px";
+ this.node.coordsize = width+' '+height;
+ this.node.coordorigin = "0 0";
+ if (this.rootElement) {
+ paths = this.rootElement.node.getElementsByTagName('shape');
+ for(i = 0, l = paths.length; i < l; i++) {
+ paths[i].coordsize = width+' '+height;
+ paths[i].style.width = width+'px';
+ paths[i].style.height = height+'px';
+ }
+ groups = this.node.getElementsByTagName('group');
+ for(i = 0, l = groups.length; i < l; i++) {
+ groups[i].coordsize = width+' '+height;
+ groups[i].style.width = width+'px';
+ groups[i].style.height = height+'px';
+ }
+ }
+};
+
+jvm.VMLCanvasElement.prototype.applyTransformParams = function(scale, transX, transY) {
+ this.scale = scale;
+ this.transX = transX;
+ this.transY = transY;
+ this.rootElement.node.coordorigin = (this.width-transX-this.width/100)+','+(this.height-transY-this.height/100);
+ this.rootElement.node.coordsize = this.width/scale+','+this.height/scale;
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/vml-circle-element.js b/public/bower_components/jvectormap/src/vml-circle-element.js
new file mode 100644
index 0000000..faa9344
--- /dev/null
+++ b/public/bower_components/jvectormap/src/vml-circle-element.js
@@ -0,0 +1,26 @@
+jvm.VMLCircleElement = function(config, style){
+ jvm.VMLCircleElement.parentClass.call(this, 'oval', config, style);
+};
+
+jvm.inherits(jvm.VMLCircleElement, jvm.VMLShapeElement);
+
+jvm.VMLCircleElement.prototype.applyAttr = function(attr, value){
+ switch (attr) {
+ case 'r':
+ this.node.style.width = value*2+'px';
+ this.node.style.height = value*2+'px';
+ this.applyAttr('cx', this.get('cx') || 0);
+ this.applyAttr('cy', this.get('cy') || 0);
+ break;
+ case 'cx':
+ if (!value) return;
+ this.node.style.left = value - (this.get('r') || 0) + 'px';
+ break;
+ case 'cy':
+ if (!value) return;
+ this.node.style.top = value - (this.get('r') || 0) + 'px';
+ break;
+ default:
+ jvm.VMLCircleElement.parentClass.prototype.applyAttr.call(this, attr, value);
+ }
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/vml-element.js b/public/bower_components/jvectormap/src/vml-element.js
new file mode 100644
index 0000000..dc5d870
--- /dev/null
+++ b/public/bower_components/jvectormap/src/vml-element.js
@@ -0,0 +1,107 @@
+/**
+ * Wrapper for VML element.
+ * @constructor
+ * @extends jvm.AbstractElement
+ * @param {String} name Tag name of the element
+ * @param {Object} config Set of parameters to initialize element with
+ */
+
+jvm.VMLElement = function(name, config){
+ if (!jvm.VMLElement.VMLInitialized) {
+ jvm.VMLElement.initializeVML();
+ }
+
+ jvm.VMLElement.parentClass.apply(this, arguments);
+};
+
+jvm.inherits(jvm.VMLElement, jvm.AbstractElement);
+
+/**
+ * Shows if VML was already initialized for the current document or not.
+ * @static
+ * @private
+ * @type {Boolean}
+ */
+jvm.VMLElement.VMLInitialized = false;
+
+/**
+ * Initializes VML handling before creating the first element
+ * (adds CSS class and creates namespace). Adds one of two forms
+ * of createElement method depending of support by browser.
+ * @static
+ * @private
+ */
+
+ // The following method of VML handling is borrowed from the
+ // Raphael library by Dmitry Baranovsky.
+
+jvm.VMLElement.initializeVML = function(){
+ try {
+ if (!document.namespaces.rvml) {
+ document.namespaces.add("rvml","urn:schemas-microsoft-com:vml");
+ }
+ /**
+ * Creates DOM element.
+ * @param {String} tagName Name of element
+ * @private
+ * @returns DOMElement
+ */
+ jvm.VMLElement.prototype.createElement = function (tagName) {
+ return document.createElement('');
+ };
+ } catch (e) {
+ /**
+ * @private
+ */
+ jvm.VMLElement.prototype.createElement = function (tagName) {
+ return document.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
+ };
+ }
+ document.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
+ jvm.VMLElement.VMLInitialized = true;
+};
+
+/**
+ * Returns constructor for element by name prefixed with 'VML'.
+ * @param {String} ctr Name of basic constructor to return
+ * proper implementation for.
+ * @returns Function
+ * @private
+ */
+jvm.VMLElement.prototype.getElementCtr = function( ctr ){
+ return jvm['VML'+ctr];
+};
+
+/**
+ * Adds CSS class for underlying DOM element.
+ * @param {String} className Name of CSS class name
+ */
+jvm.VMLElement.prototype.addClass = function( className ){
+ jvm.$(this.node).addClass(className);
+};
+
+/**
+ * Applies attribute value to the underlying DOM element.
+ * @param {String} name Name of attribute
+ * @param {Number|String} config Value of attribute to apply
+ * @private
+ */
+jvm.VMLElement.prototype.applyAttr = function( attr, value ){
+ this.node[attr] = value;
+};
+
+/**
+ * Returns boundary box for the element.
+ * @returns {Object} Boundary box with numeric fields: x, y, width, height
+ * @override
+ */
+jvm.VMLElement.prototype.getBBox = function(){
+ var node = jvm.$(this.node);
+
+ return {
+ x: node.position().left / this.canvas.scale,
+ y: node.position().top / this.canvas.scale,
+ width: node.width() / this.canvas.scale,
+ height: node.height() / this.canvas.scale
+ };
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/vml-group-element.js b/public/bower_components/jvectormap/src/vml-group-element.js
new file mode 100644
index 0000000..a73be83
--- /dev/null
+++ b/public/bower_components/jvectormap/src/vml-group-element.js
@@ -0,0 +1,13 @@
+jvm.VMLGroupElement = function(){
+ jvm.VMLGroupElement.parentClass.call(this, 'group');
+
+ this.node.style.left = '0px';
+ this.node.style.top = '0px';
+ this.node.coordorigin = "0 0";
+};
+
+jvm.inherits(jvm.VMLGroupElement, jvm.VMLElement);
+
+jvm.VMLGroupElement.prototype.add = function(element){
+ this.node.appendChild( element.node );
+};
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/vml-image-element.js b/public/bower_components/jvectormap/src/vml-image-element.js
new file mode 100644
index 0000000..8fb7ca9
--- /dev/null
+++ b/public/bower_components/jvectormap/src/vml-image-element.js
@@ -0,0 +1,47 @@
+jvm.VMLImageElement = function(config, style){
+ jvm.VMLImageElement.parentClass.call(this, 'image', config, style);
+};
+
+jvm.inherits(jvm.VMLImageElement, jvm.VMLShapeElement);
+
+jvm.VMLImageElement.prototype.applyAttr = function(attr, value){
+ var patternEl,
+ imageEl,
+ that = this;
+
+ if (attr == 'image') {
+ jvm.whenImageLoaded(value).then(function(img){
+ that.node.setAttribute('src', value);
+ that.width = img[0].width;
+ that.height = img[0].height;
+ that.applyAttr('width', that.width);
+ that.applyAttr('height', that.height);
+
+ jvm.VMLImageElement.images[value] = jvm.VMLImageElement.imageCounter++;
+
+ that.applyAttr('x', that.cx - that.width / 2);
+ that.applyAttr('y', that.cy - that.height / 2);
+
+ jvm.$(that.node).trigger('imageloaded', [img]);
+ });
+ } else if(attr == 'cx') {
+ this.cx = value;
+ if (this.width) {
+ this.applyAttr('x', value - this.width / 2);
+ }
+ } else if(attr == 'cy') {
+ this.cy = value;
+ if (this.height) {
+ this.applyAttr('y', value - this.height / 2);
+ }
+ } else if(attr == 'width' || attr == 'height') {
+ this.node.style[attr] = value + 'px';
+ } else if (attr == 'x' || attr == 'y') {
+ this.node.style[attr == 'x' ? 'left' : 'top'] = value + 'px';
+ } else {
+ jvm.VMLImageElement.parentClass.prototype.applyAttr.apply(this, arguments);
+ }
+};
+
+jvm.VMLImageElement.imageCounter = 1;
+jvm.VMLImageElement.images = {}
\ No newline at end of file
diff --git a/public/bower_components/jvectormap/src/vml-path-element.js b/public/bower_components/jvectormap/src/vml-path-element.js
new file mode 100644
index 0000000..6bd9911
--- /dev/null
+++ b/public/bower_components/jvectormap/src/vml-path-element.js
@@ -0,0 +1,98 @@
+jvm.VMLPathElement = function(config, style){
+ var scale = new jvm.VMLElement('skew');
+
+ jvm.VMLPathElement.parentClass.call(this, 'shape', config, style);
+
+ this.node.coordorigin = "0 0";
+
+ scale.node.on = true;
+ scale.node.matrix = '0.01,0,0,0.01,0,0';
+ scale.node.offset = '0,0';
+
+ this.node.appendChild(scale.node);
+};
+
+jvm.inherits(jvm.VMLPathElement, jvm.VMLShapeElement);
+
+jvm.VMLPathElement.prototype.applyAttr = function(attr, value){
+ if (attr === 'd') {
+ this.node.path = jvm.VMLPathElement.pathSvgToVml(value);
+ } else {
+ jvm.VMLShapeElement.prototype.applyAttr.call(this, attr, value);
+ }
+};
+
+jvm.VMLPathElement.pathSvgToVml = function(path) {
+ var cx = 0, cy = 0, ctrlx, ctrly;
+
+ path = path.replace(/(-?\d+)e(-?\d+)/g, '0');
+ return path.replace(/([MmLlHhVvCcSs])\s*((?:-?\d*(?:\.\d+)?\s*,?\s*)+)/g, function(segment, letter, coords, index){
+ coords = coords.replace(/(\d)-/g, '$1,-')
+ .replace(/^\s+/g, '')
+ .replace(/\s+$/g, '')
+ .replace(/\s+/g, ',').split(',');
+ if (!coords[0]) coords.shift();
+ for (var i=0, l=coords.length; i to avoid XSS via location.hash (#9521)
+ rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
+
+ // Matches dashed string for camelizing
+ rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return ( letter + "" ).toUpperCase();
+ },
+
+ // The ready event handler and self cleanup method
+ DOMContentLoaded = function() {
+ if ( document.addEventListener ) {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ } else if ( document.readyState === "complete" ) {
+ // we're here because readyState === "complete" in oldIE
+ // which is good enough for us to call the dom ready!
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
+ }
+ },
+
+ // [[Class]] -> type pairs
+ class2type = {};
+
+jQuery.fn = jQuery.prototype = {
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), $(undefined), $(false)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = rquickExpr.exec( selector );
+ }
+
+ // Match html or make sure no context is specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+ doc = ( context && context.nodeType ? context.ownerDocument || context : document );
+
+ // scripts is true for back-compat
+ selector = jQuery.parseHTML( match[1], doc, true );
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ this.attr.call( selector, context, true );
+ }
+
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $(#id)
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.8.2",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return core_slice.call( this );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" ) {
+ ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
+ } else if ( name ) {
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Add the callback
+ jQuery.ready.promise().done( fn );
+
+ return this;
+ },
+
+ eq: function( i ) {
+ i = +i;
+ return i === -1 ?
+ this.slice( i ) :
+ this.slice( i, i + 1 );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ slice: function() {
+ return this.pushStack( core_slice.apply( this, arguments ),
+ "slice", core_slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: core_push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+
+ // Abort if there are pending holds or we're already ready
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+ return;
+ }
+
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger("ready").off("ready");
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ isWindow: function( obj ) {
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ return obj == null ?
+ String( obj ) :
+ class2type[ core_toString.call(obj) ] || "object";
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !core_hasOwn.call(obj, "constructor") &&
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || core_hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ var name;
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ // data: string of html
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
+ // scripts (optional): If true, will include scripts passed in the html string
+ parseHTML: function( data, context, scripts ) {
+ var parsed;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ if ( typeof context === "boolean" ) {
+ scripts = context;
+ context = 0;
+ }
+ context = context || document;
+
+ // Single tag
+ if ( (parsed = rsingleTag.exec( data )) ) {
+ return [ context.createElement( parsed[1] ) ];
+ }
+
+ parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
+ return jQuery.merge( [],
+ (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
+ },
+
+ parseJSON: function( data ) {
+ if ( !data || typeof data !== "string") {
+ return null;
+ }
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return ( new Function( "return " + data ) )();
+
+ }
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && core_rnotwhite.test( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+ },
+
+ // args is for internal usage only
+ each: function( obj, callback, args ) {
+ var name,
+ i = 0,
+ length = obj.length,
+ isObj = length === undefined || jQuery.isFunction( obj );
+
+ if ( args ) {
+ if ( isObj ) {
+ for ( name in obj ) {
+ if ( callback.apply( obj[ name ], args ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.apply( obj[ i++ ], args ) === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isObj ) {
+ for ( name in obj ) {
+ if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+ function( text ) {
+ return text == null ?
+ "" :
+ core_trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var type,
+ ret = results || [];
+
+ if ( arr != null ) {
+ // The window, strings (and functions) also have 'length'
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
+ type = jQuery.type( arr );
+
+ if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
+ core_push.call( ret, arr );
+ } else {
+ jQuery.merge( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ var len;
+
+ if ( arr ) {
+ if ( core_indexOf ) {
+ return core_indexOf.call( arr, elem, i );
+ }
+
+ len = arr.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in arr && arr[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var l = second.length,
+ i = first.length,
+ j = 0;
+
+ if ( typeof l === "number" ) {
+ for ( ; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var retVal,
+ ret = [],
+ i = 0,
+ length = elems.length;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value, key,
+ ret = [],
+ i = 0,
+ length = elems.length,
+ // jquery objects are treated as arrays
+ isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( key in elems ) {
+ value = callback( elems[ key ], key, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return ret.concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ var tmp, args, proxy;
+
+ if ( typeof context === "string" ) {
+ tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ args = core_slice.call( arguments, 2 );
+ proxy = function() {
+ return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Multifunctional method to get and set values of a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
+ var exec,
+ bulk = key == null,
+ i = 0,
+ length = elems.length;
+
+ // Sets many values
+ if ( key && typeof key === "object" ) {
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
+ }
+ chainable = 1;
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ // Optionally, function values get executed if exec is true
+ exec = pass === undefined && jQuery.isFunction( value );
+
+ if ( bulk ) {
+ // Bulk operations only iterate when executing function values
+ if ( exec ) {
+ exec = fn;
+ fn = function( elem, key, value ) {
+ return exec.call( jQuery( elem ), value );
+ };
+
+ // Otherwise they run against the entire set
+ } else {
+ fn.call( elems, value );
+ fn = null;
+ }
+ }
+
+ if ( fn ) {
+ for (; i < length; i++ ) {
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+ }
+ }
+
+ chainable = 1;
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ }
+});
+
+jQuery.ready.promise = function( obj ) {
+ if ( !readyList ) {
+
+ readyList = jQuery.Deferred();
+
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ setTimeout( jQuery.ready, 1 );
+
+ // Standards-based browsers support DOMContentLoaded
+ } else if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else {
+ // Ensure firing before onload, maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var top = false;
+
+ try {
+ top = window.frameElement == null && document.documentElement;
+ } catch(e) {}
+
+ if ( top && top.doScroll ) {
+ (function doScrollCheck() {
+ if ( !jQuery.isReady ) {
+
+ try {
+ // Use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ top.doScroll("left");
+ } catch(e) {
+ return setTimeout( doScrollCheck, 50 );
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+ }
+ })();
+ }
+ }
+ }
+ return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+ var object = optionsCache[ options ] = {};
+ jQuery.each( options.split( core_rspace ), function( _, flag ) {
+ object[ flag ] = true;
+ });
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * options: an optional list of space-separated options that will change how
+ * the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+ // Convert options from String-formatted to Object-formatted if needed
+ // (we check in cache first)
+ options = typeof options === "string" ?
+ ( optionsCache[ options ] || createOptions( options ) ) :
+ jQuery.extend( {}, options );
+
+ var // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // Flag to know if list is currently firing
+ firing,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = !options.once && [],
+ // Fire callbacks
+ fire = function( data ) {
+ memory = options.memory && data;
+ fired = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ firing = true;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+ memory = false; // To prevent further calls using add
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( stack ) {
+ if ( stack.length ) {
+ fire( stack.shift() );
+ }
+ } else if ( memory ) {
+ list = [];
+ } else {
+ self.disable();
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ // First, we save the current length
+ var start = list.length;
+ (function add( args ) {
+ jQuery.each( args, function( _, arg ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) {
+ list.push( arg );
+ } else if ( arg && arg.length && type !== "string" ) {
+ // Inspect recursively
+ add( arg );
+ }
+ });
+ })( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away
+ } else if ( memory ) {
+ firingStart = start;
+ fire( memory );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ jQuery.each( arguments, function( _, arg ) {
+ var index;
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ list.splice( index, 1 );
+ // Handle firing indexes
+ if ( firing ) {
+ if ( index <= firingLength ) {
+ firingLength--;
+ }
+ if ( index <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ });
+ }
+ return this;
+ },
+ // Control if a given callback is in the list
+ has: function( fn ) {
+ return jQuery.inArray( fn, list ) > -1;
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ args = args || [];
+ args = [ context, args.slice ? args.slice() : args ];
+ if ( list && ( !fired || stack ) ) {
+ if ( firing ) {
+ stack.push( args );
+ } else {
+ fire( args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var tuples = [
+ // action, add listener, listener list, final state
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
+ ],
+ state = "pending",
+ promise = {
+ state: function() {
+ return state;
+ },
+ always: function() {
+ deferred.done( arguments ).fail( arguments );
+ return this;
+ },
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
+ var fns = arguments;
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( tuples, function( i, tuple ) {
+ var action = tuple[ 0 ],
+ fn = fns[ i ];
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
+ deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
+ function() {
+ var returned = fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise()
+ .done( newDefer.resolve )
+ .fail( newDefer.reject )
+ .progress( newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
+ }
+ } :
+ newDefer[ action ]
+ );
+ });
+ fns = null;
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
+ }
+ },
+ deferred = {};
+
+ // Keep pipe for back-compat
+ promise.pipe = promise.then;
+
+ // Add list-specific methods
+ jQuery.each( tuples, function( i, tuple ) {
+ var list = tuple[ 2 ],
+ stateString = tuple[ 3 ];
+
+ // promise[ done | fail | progress ] = list.add
+ promise[ tuple[1] ] = list.add;
+
+ // Handle state
+ if ( stateString ) {
+ list.add(function() {
+ // state = [ resolved | rejected ]
+ state = stateString;
+
+ // [ reject_list | resolve_list ].disable; progress_list.lock
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+ }
+
+ // deferred[ resolve | reject | notify ] = list.fire
+ deferred[ tuple[0] ] = list.fire;
+ deferred[ tuple[0] + "With" ] = list.fireWith;
+ });
+
+ // Make the deferred a promise
+ promise.promise( deferred );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( subordinate /* , ..., subordinateN */ ) {
+ var i = 0,
+ resolveValues = core_slice.call( arguments ),
+ length = resolveValues.length,
+
+ // the count of uncompleted subordinates
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+ // Update function for both resolve and progress values
+ updateFunc = function( i, contexts, values ) {
+ return function( value ) {
+ contexts[ i ] = this;
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+ if( values === progressValues ) {
+ deferred.notifyWith( contexts, values );
+ } else if ( !( --remaining ) ) {
+ deferred.resolveWith( contexts, values );
+ }
+ };
+ },
+
+ progressValues, progressContexts, resolveContexts;
+
+ // add listeners to Deferred subordinates; treat others as resolved
+ if ( length > 1 ) {
+ progressValues = new Array( length );
+ progressContexts = new Array( length );
+ resolveContexts = new Array( length );
+ for ( ; i < length; i++ ) {
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+ resolveValues[ i ].promise()
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
+ .fail( deferred.reject )
+ .progress( updateFunc( i, progressContexts, progressValues ) );
+ } else {
+ --remaining;
+ }
+ }
+ }
+
+ // if we're not waiting on anything, resolve the master
+ if ( !remaining ) {
+ deferred.resolveWith( resolveContexts, resolveValues );
+ }
+
+ return deferred.promise();
+ }
+});
+jQuery.support = (function() {
+
+ var support,
+ all,
+ a,
+ select,
+ opt,
+ input,
+ fragment,
+ eventName,
+ i,
+ isSupported,
+ clickFn,
+ div = document.createElement("div");
+
+ // Preliminary tests
+ div.setAttribute( "className", "t" );
+ div.innerHTML = "
a";
+
+ all = div.getElementsByTagName("*");
+ a = div.getElementsByTagName("a")[ 0 ];
+ a.style.cssText = "top:1px;float:left;opacity:.5";
+
+ // Can't get basic test support
+ if ( !all || !all.length ) {
+ return {};
+ }
+
+ // First batch of supports tests
+ select = document.createElement("select");
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName("input")[ 0 ];
+
+ support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: ( div.firstChild.nodeType === 3 ),
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: ( a.getAttribute("href") === "/a" ),
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.5/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Make sure that if no value is specified for a checkbox
+ // that it defaults to "on".
+ // (WebKit defaults to "" instead)
+ checkOn: ( input.value === "on" ),
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // Tests for enctype support on a form(#6743)
+ enctype: !!document.createElement("form").enctype,
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>",
+
+ // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
+ boxModel: ( document.compatMode === "CSS1Compat" ),
+
+ // Will be defined later
+ submitBubbles: true,
+ changeBubbles: true,
+ focusinBubbles: false,
+ deleteExpando: true,
+ noCloneEvent: true,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableMarginRight: true,
+ boxSizingReliable: true,
+ pixelPosition: false
+ };
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Test to see if it's possible to delete an expando from an element
+ // Fails in Internet Explorer
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
+ div.attachEvent( "onclick", clickFn = function() {
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ support.noCloneEvent = false;
+ });
+ div.cloneNode( true ).fireEvent("onclick");
+ div.detachEvent( "onclick", clickFn );
+ }
+
+ // Check if a radio maintains its value
+ // after being appended to the DOM
+ input = document.createElement("input");
+ input.value = "t";
+ input.setAttribute( "type", "radio" );
+ support.radioValue = input.value === "t";
+
+ input.setAttribute( "checked", "checked" );
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "name", "t" );
+
+ div.appendChild( input );
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( div.lastChild );
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ fragment.removeChild( input );
+ fragment.appendChild( div );
+
+ // Technique from Juriy Zaytsev
+ // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
+ // We only care about the case where non-standard event systems
+ // are used, namely in IE. Short-circuiting here helps us to
+ // avoid an eval call (in setAttribute) which can cause CSP
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
+ if ( div.attachEvent ) {
+ for ( i in {
+ submit: true,
+ change: true,
+ focusin: true
+ }) {
+ eventName = "on" + i;
+ isSupported = ( eventName in div );
+ if ( !isSupported ) {
+ div.setAttribute( eventName, "return;" );
+ isSupported = ( typeof div[ eventName ] === "function" );
+ }
+ support[ i + "Bubbles" ] = isSupported;
+ }
+ }
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, div, tds, marginDiv,
+ divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ container = document.createElement("div");
+ container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
+ body.insertBefore( container, body.firstChild );
+
+ // Construct the test element
+ div = document.createElement("div");
+ container.appendChild( div );
+
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ // (only IE 8 fails this test)
+ div.innerHTML = "
t
";
+ tds = div.getElementsByTagName("td");
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Check if empty table cells still have offsetWidth/Height
+ // (IE <= 8 fail this test)
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check box-sizing and margin behavior
+ div.innerHTML = "";
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+ support.boxSizing = ( div.offsetWidth === 4 );
+ support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
+
+ // NOTE: To any future maintainer, we've window.getComputedStyle
+ // because jsdom on node.js will break without it.
+ if ( window.getComputedStyle ) {
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. For more
+ // info see bug #3333
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ marginDiv = document.createElement("div");
+ marginDiv.style.cssText = div.style.cssText = divReset;
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+ div.appendChild( marginDiv );
+ support.reliableMarginRight =
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+ }
+
+ if ( typeof div.style.zoom !== "undefined" ) {
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ // (IE < 8 does this)
+ div.innerHTML = "";
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Check if elements with layout shrink-wrap their children
+ // (IE 6 does this)
+ div.style.display = "block";
+ div.style.overflow = "visible";
+ div.innerHTML = "";
+ div.firstChild.style.width = "5px";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+ container.style.zoom = 1;
+ }
+
+ // Null elements to avoid leaks in IE
+ body.removeChild( container );
+ container = div = tds = marginDiv = null;
+ });
+
+ // Null elements to avoid leaks in IE
+ fragment.removeChild( div );
+ all = a = select = opt = input = fragment = div = null;
+
+ return support;
+})();
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+jQuery.extend({
+ cache: {},
+
+ deletedIds: [],
+
+ // Remove at next major release (1.9/2.0)
+ uuid: 0,
+
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data, pvt /* Internal Use Only */ ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ cache[ id ] = {};
+
+ // Avoids exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+ },
+
+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, i, l,
+
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split(" ");
+ }
+ }
+ }
+
+ for ( i = 0, l = name.length; i < l; i++ ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
+ return;
+ }
+ }
+
+ // Destroy the cache
+ if ( isNode ) {
+ jQuery.cleanData( [ elem ], true );
+
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+ delete cache[ id ];
+
+ // When all else fails, null
+ } else {
+ cache[ id ] = null;
+ }
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return jQuery.data( elem, name, data, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ // nodes accept data unless otherwise specified; rejection can be conditional
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var parts, part, attr, name, l,
+ elem = this[0],
+ i = 0,
+ data = null;
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attr = elem.attributes;
+ for ( l = attr.length; i < l; i++ ) {
+ name = attr[i].name;
+
+ if ( !name.indexOf( "data-" ) ) {
+ name = jQuery.camelCase( name.substring(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ parts = key.split( ".", 2 );
+ parts[1] = parts[1] ? "." + parts[1] : "";
+ part = parts[1] + "!";
+
+ return jQuery.access( this, function( value ) {
+
+ if ( value === undefined ) {
+ data = this.triggerHandler( "getData" + part, [ parts[0] ] );
+
+ // Try to fetch any internally stored data first
+ if ( data === undefined && elem ) {
+ data = jQuery.data( elem, key );
+ data = dataAttr( elem, key, data );
+ }
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ }
+
+ parts[1] = value;
+ this.each(function() {
+ var self = jQuery( this );
+
+ self.triggerHandler( "setData" + part, parts );
+ jQuery.data( this, key, value );
+ self.triggerHandler( "changeData" + part, parts );
+ });
+ }, null, value, arguments.length > 1, null, false );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === data ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ var name;
+ for ( name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray(data) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ jQuery.removeData( elem, type + "queue", true );
+ jQuery.removeData( elem, key, true );
+ })
+ });
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while( i-- ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var nodeHook, boolHook, fixSpecified,
+ rclass = /[\t\r\n]/g,
+ rreturn = /\r/g,
+ rtype = /^(?:button|input)$/i,
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
+ rclickable = /^a(?:rea|)$/i,
+ rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classNames, i, l, elem,
+ setClass, c, cl;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call(this, j, this.className) );
+ });
+ }
+
+ if ( value && typeof value === "string" ) {
+ classNames = value.split( core_rspace );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.nodeType === 1 ) {
+ if ( !elem.className && classNames.length === 1 ) {
+ elem.className = value;
+
+ } else {
+ setClass = " " + elem.className + " ";
+
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
+ setClass += classNames[ c ] + " ";
+ }
+ }
+ elem.className = jQuery.trim( setClass );
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var removes, className, elem, c, cl, i, l;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call(this, j, this.className) );
+ });
+ }
+ if ( (value && typeof value === "string") || value === undefined ) {
+ removes = ( value || "" ).split( core_rspace );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
+ if ( elem.nodeType === 1 && elem.className ) {
+
+ className = (" " + elem.className + " ").replace( rclass, " " );
+
+ // loop over each item in the removal list
+ for ( c = 0, cl = removes.length; c < cl; c++ ) {
+ // Remove until there is nothing to remove,
+ while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
+ className = className.replace( " " + removes[ c ] + " " , " " );
+ }
+ }
+ elem.className = value ? jQuery.trim( className ) : "";
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.split( core_rspace );
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // toggle whole className
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var hooks, ret, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var val,
+ self = jQuery(this);
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, self.val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, i, max, option,
+ index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type === "select-one";
+
+ // Nothing was selected
+ if ( index < 0 ) {
+ return null;
+ }
+
+ // Loop through all the selected options
+ i = one ? index : 0;
+ max = one ? index + 1 : options.length;
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // Don't return options that are disabled or in a disabled optgroup
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
+ if ( one && !values.length && options.length ) {
+ return jQuery( options[ index ] ).val();
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var values = jQuery.makeArray( value );
+
+ jQuery(elem).find("option").each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
+ attrFn: {},
+
+ attr: function( elem, name, value, pass ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
+ return jQuery( elem )[ name ]( value );
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === "undefined" ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( notxml ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+ return;
+
+ } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+
+ ret = elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret === null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var propName, attrNames, name, isBool,
+ i = 0;
+
+ if ( value && elem.nodeType === 1 ) {
+
+ attrNames = value.split( core_rspace );
+
+ for ( ; i < attrNames.length; i++ ) {
+ name = attrNames[ i ];
+
+ if ( name ) {
+ propName = jQuery.propFix[ name ] || name;
+ isBool = rboolean.test( name );
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ // Do not do this for boolean attributes (see #10870)
+ if ( !isBool ) {
+ jQuery.attr( elem, name, "" );
+ }
+ elem.removeAttribute( getSetAttribute ? name : propName );
+
+ // Set corresponding property to false for boolean attributes
+ if ( isBool && propName in elem ) {
+ elem[ propName ] = false;
+ }
+ }
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
+ jQuery.error( "type property can't be changed" );
+ } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to it's default in case type is set after value
+ // This is for element creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ },
+ // Use the value property for back compat
+ // Use the nodeHook for button elements in IE6/7 (#1954)
+ value: {
+ get: function( elem, name ) {
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+ return nodeHook.get( elem, name );
+ }
+ return name in elem ?
+ elem.value :
+ null;
+ },
+ set: function( elem, value, name ) {
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+ return nodeHook.set( elem, value, name );
+ }
+ // Does not return so that setAttribute is also used
+ elem.value = value;
+ }
+ }
+ },
+
+ propFix: {
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return ( elem[ name ] = value );
+ }
+
+ } else {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ return elem[ name ];
+ }
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabindex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ }
+ }
+});
+
+// Hook for boolean attributes
+boolHook = {
+ get: function( elem, name ) {
+ // Align boolean attributes with corresponding properties
+ // Fall back to attribute presence where some booleans are not supported
+ var attrNode,
+ property = jQuery.prop( elem, name );
+ return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
+ name.toLowerCase() :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ var propName;
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else {
+ // value is true since we know at this point it's type boolean and not false
+ // Set boolean attributes to the same name and set the DOM property
+ propName = jQuery.propFix[ name ] || name;
+ if ( propName in elem ) {
+ // Only set the IDL specifically if it already exists on the element
+ elem[ propName ] = true;
+ }
+
+ elem.setAttribute( name, name.toLowerCase() );
+ }
+ return name;
+ }
+};
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ fixSpecified = {
+ name: true,
+ id: true,
+ coords: true
+ };
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret;
+ ret = elem.getAttributeNode( name );
+ return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
+ ret.value :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ ret = document.createAttribute( name );
+ elem.setAttributeNode( ret );
+ }
+ return ( ret.value = value + "" );
+ }
+ };
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ });
+ });
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ get: nodeHook.get,
+ set: function( elem, value, name ) {
+ if ( value === "" ) {
+ value = "false";
+ }
+ nodeHook.set( elem, value, name );
+ }
+ };
+}
+
+
+// Some attributes require a special call on IE
+if ( !jQuery.support.hrefNormalized ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret = elem.getAttribute( name, 2 );
+ return ret === null ? undefined : ret;
+ }
+ });
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Normalize to lowercase since IE uppercases css property names
+ return elem.style.cssText.toLowerCase() || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = value + "" );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ });
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+ jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ get: function( elem ) {
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+ };
+ });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ });
+});
+var rformElems = /^(?:textarea|input|select)$/i,
+ rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
+ rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ hoverHack = function( events ) {
+ return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
+ };
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ add: function( elem, types, handler, data, selector ) {
+
+ var elemData, eventHandle, events,
+ t, tns, type, namespaces, handleObj,
+ handleObjIn, handlers, special;
+
+ // Don't attach events to noData or text/comment nodes (allow plain objects tho)
+ if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ events = elemData.events;
+ if ( !events ) {
+ elemData.events = events = {};
+ }
+ eventHandle = elemData.handle;
+ if ( !eventHandle ) {
+ elemData.handle = eventHandle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = jQuery.trim( hoverHack(types) ).split( " " );
+ for ( t = 0; t < types.length; t++ ) {
+
+ tns = rtypenamespace.exec( types[t] ) || [];
+ type = tns[1];
+ namespaces = ( tns[2] || "" ).split( "." ).sort();
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: tns[1],
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ handlers = events[ type ];
+ if ( !handlers ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+
+ var t, tns, type, origType, namespaces, origCount,
+ j, events, special, eventType, handleObj,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
+ for ( t = 0; t < types.length; t++ ) {
+ tns = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tns[1];
+ namespaces = tns[2];
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector? special.delegateType : special.bindType ) || type;
+ eventType = events[ type ] || [];
+ origCount = eventType.length;
+ namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
+
+ // Remove matching events
+ for ( j = 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ eventType.splice( j--, 1 );
+
+ if ( handleObj.selector ) {
+ eventType.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( eventType.length === 0 && origCount !== eventType.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery.removeData( elem, "events", true );
+ }
+ },
+
+ // Events that are safe to short-circuit if no handlers are attached.
+ // Native DOM events should not be added, they may have inline handlers.
+ customEvent: {
+ "getData": true,
+ "setData": true,
+ "changeData": true
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ // Don't do events on text and comment nodes
+ if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
+ return;
+ }
+
+ // Event object or event type
+ var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
+ type = event.type || event,
+ namespaces = [];
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf( "!" ) >= 0 ) {
+ // Exclusive events trigger only for the exact event (no namespaces)
+ type = type.slice(0, -1);
+ exclusive = true;
+ }
+
+ if ( type.indexOf( "." ) >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+
+ if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
+ // No jQuery handlers for this event type, and it can't have inline handlers
+ return;
+ }
+
+ // Caller can pass in an Event, Object, or just an event type string
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[ jQuery.expando ] ? event :
+ // Object literal
+ new jQuery.Event( type, event ) :
+ // Just the event type (string)
+ new jQuery.Event( type );
+
+ event.type = type;
+ event.isTrigger = true;
+ event.exclusive = exclusive;
+ event.namespace = namespaces.join( "." );
+ event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
+ ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
+
+ // Handle a global trigger
+ if ( !elem ) {
+
+ // TODO: Stop taunting the data cache; remove global events and always attach to document
+ cache = jQuery.cache;
+ for ( i in cache ) {
+ if ( cache[ i ].events && cache[ i ].events[ type ] ) {
+ jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
+ }
+ }
+ return;
+ }
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data != null ? jQuery.makeArray( data ) : [];
+ data.unshift( event );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ eventPath = [[ elem, special.bindType || type ]];
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
+ for ( old = elem; cur; cur = cur.parentNode ) {
+ eventPath.push([ cur, bubbleType ]);
+ old = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( old === (elem.ownerDocument || document) ) {
+ eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
+ }
+ }
+
+ // Fire handlers on the event path
+ for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
+
+ cur = eventPath[i][0];
+ event.type = eventPath[i][1];
+
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+ // Note that this is a bare JS function and not a jQuery handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ // IE<9 dies on focus/blur to hidden element (#1486)
+ if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ old = elem[ ontype ];
+
+ if ( old ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ elem[ type ]();
+ jQuery.event.triggered = undefined;
+
+ if ( old ) {
+ elem[ ontype ] = old;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event || window.event );
+
+ var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
+ handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
+ delegateCount = handlers.delegateCount,
+ args = core_slice.call( arguments ),
+ run_all = !event.exclusive && !event.namespace,
+ special = jQuery.event.special[ event.type ] || {},
+ handlerQueue = [];
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers that should run if there are delegated events
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && !(event.button && event.type === "click") ) {
+
+ for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
+
+ // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
+ if ( cur.disabled !== true || event.type !== "click" ) {
+ selMatch = {};
+ matches = [];
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+ sel = handleObj.selector;
+
+ if ( selMatch[ sel ] === undefined ) {
+ selMatch[ sel ] = handleObj.needsContext ?
+ jQuery( sel, this ).index( cur ) >= 0 :
+ jQuery.find( sel, this, null, [ cur ] ).length;
+ }
+ if ( selMatch[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, matches: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( handlers.length > delegateCount ) {
+ handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
+ }
+
+ // Run delegates first; they may want to stop propagation beneath us
+ for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
+ matched = handlerQueue[ i ];
+ event.currentTarget = matched.elem;
+
+ for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
+ handleObj = matched.matches[ j ];
+
+ // Triggered event must either 1) be non-exclusive and have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.data = handleObj.data;
+ event.handleObj = handleObj;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
+ props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var eventDoc, doc, body,
+ button = original.button,
+ fromElement = original.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && fromElement ) {
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop,
+ originalEvent = event,
+ fixHook = jQuery.event.fixHooks[ event.type ] || {},
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = jQuery.Event( originalEvent );
+
+ for ( i = copy.length; i; ) {
+ prop = copy[ --i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Target should not be a text node (#504, Safari)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
+ event.metaKey = !!event.metaKey;
+
+ return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ special: {
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+
+ focus: {
+ delegateType: "focusin"
+ },
+ blur: {
+ delegateType: "focusout"
+ },
+
+ beforeunload: {
+ setup: function( data, namespaces, eventHandle ) {
+ // We only want to do this special case on windows
+ if ( jQuery.isWindow( this ) ) {
+ this.onbeforeunload = eventHandle;
+ }
+ },
+
+ teardown: function( namespaces, eventHandle ) {
+ if ( this.onbeforeunload === eventHandle ) {
+ this.onbeforeunload = null;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ { type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+// Some plugins are using, but it's undocumented/deprecated and will be removed.
+// The 1.7 special event interface should provide all the hooks needed now.
+jQuery.event.handle = jQuery.event.dispatch;
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ var name = "on" + type;
+
+ if ( elem.detachEvent ) {
+
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8 –
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
+ if ( typeof elem[ name ] === "undefined" ) {
+ elem[ name ] = null;
+ }
+
+ elem.detachEvent( name, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+function returnFalse() {
+ return false;
+}
+function returnTrue() {
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+
+ // if preventDefault exists run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // otherwise set the returnValue property of the original event to false (IE)
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+ // if stopPropagation exists run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var ret,
+ target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj,
+ selector = handleObj.selector;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+ // Node name check avoids a VML-related crash in IE (#9807)
+ var elem = e.target,
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+ if ( form && !jQuery._data( form, "_submit_attached" ) ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ jQuery._data( form, "_submit_attached", true );
+ }
+ });
+ // return undefined since we don't need an event listener
+ },
+
+ postDispatch: function( event ) {
+ // If form was submitted by the user, bubble the event up the tree
+ if ( event._submit_bubble ) {
+ delete event._submit_bubble;
+ if ( this.parentNode && !event.isTrigger ) {
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
+ }
+ }
+ },
+
+ teardown: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+ jQuery.event.remove( this, "._submit" );
+ }
+ };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+ jQuery.event.special.change = {
+
+ setup: function() {
+
+ if ( rformElems.test( this.nodeName ) ) {
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
+ // after a propertychange. Eat the blur-change in special.change.handle.
+ // This still fires onchange a second time for check/radio after blur.
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ jQuery.event.add( this, "propertychange._change", function( event ) {
+ if ( event.originalEvent.propertyName === "checked" ) {
+ this._just_changed = true;
+ }
+ });
+ jQuery.event.add( this, "click._change", function( event ) {
+ if ( this._just_changed && !event.isTrigger ) {
+ this._just_changed = false;
+ }
+ // Allow triggered, simulated change events (#11500)
+ jQuery.event.simulate( "change", this, event, true );
+ });
+ }
+ return false;
+ }
+ // Delegated event; lazy-add a change handler on descendant inputs
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
+ var elem = e.target;
+
+ if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ jQuery._data( elem, "_change_attached", true );
+ }
+ });
+ },
+
+ handle: function( event ) {
+ var elem = event.target;
+
+ // Swallow native change events from checkbox/radio, we already triggered them above
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ return event.handleObj.handler.apply( this, arguments );
+ }
+ },
+
+ teardown: function() {
+ jQuery.event.remove( this, "._change" );
+
+ return !rformElems.test( this.nodeName );
+ }
+ };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0,
+ handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var origFn, type;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) { // && selector != null
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ var handleObj, type;
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ live: function( types, data, fn ) {
+ jQuery( this.context ).on( types, this.selector, data, fn );
+ return this;
+ },
+ die: function( types, fn ) {
+ jQuery( this.context ).off( types, this.selector || "**", fn );
+ return this;
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ if ( this[0] ) {
+ return jQuery.event.trigger( type, data, this[0], true );
+ }
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments,
+ guid = fn.guid || jQuery.guid++,
+ i = 0,
+ toggler = function( event ) {
+ // Figure out which function to execute
+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+ jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ lastToggle ].apply( this, arguments ) || false;
+ };
+
+ // link all the functions, so any of them can unbind this click handler
+ toggler.guid = guid;
+ while ( i < args.length ) {
+ args[ i++ ].guid = guid;
+ }
+
+ return this.click( toggler );
+ },
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ }
+});
+
+jQuery.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( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ if ( fn == null ) {
+ fn = data;
+ data = null;
+ }
+
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+
+ if ( rkeyEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
+ }
+
+ if ( rmouseEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
+ }
+});
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://sizzlejs.com/
+ */
+(function( window, undefined ) {
+
+var cachedruns,
+ assertGetIdNotName,
+ Expr,
+ getText,
+ isXML,
+ contains,
+ compile,
+ sortOrder,
+ hasDuplicate,
+ outermostContext,
+
+ baseHasDuplicate = true,
+ strundefined = "undefined",
+
+ expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
+
+ Token = String,
+ document = window.document,
+ docElem = document.documentElement,
+ dirruns = 0,
+ done = 0,
+ pop = [].pop,
+ push = [].push,
+ slice = [].slice,
+ // Use a stripped-down indexOf if a native one is unavailable
+ indexOf = [].indexOf || function( elem ) {
+ var i = 0,
+ len = this.length;
+ for ( ; i < len; i++ ) {
+ if ( this[i] === elem ) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+ // Augment a function for special use by Sizzle
+ markFunction = function( fn, value ) {
+ fn[ expando ] = value == null || value;
+ return fn;
+ },
+
+ createCache = function() {
+ var cache = {},
+ keys = [];
+
+ return markFunction(function( key, value ) {
+ // Only keep the most recent entries
+ if ( keys.push( key ) > Expr.cacheLength ) {
+ delete cache[ keys.shift() ];
+ }
+
+ return (cache[ key ] = value);
+ }, cache );
+ },
+
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+
+ // Regex
+
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+ whitespace = "[\\x20\\t\\r\\n\\f]",
+ // http://www.w3.org/TR/css3-syntax/#characters
+ characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
+
+ // Loosely modeled on CSS identifier characters
+ // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+ identifier = characterEncoding.replace( "w", "w#" ),
+
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
+ operators = "([*^$|!~]?=)",
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+ "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
+
+ // Prefer arguments not in parens/brackets,
+ // then attribute selectors and non-pseudos (denoted by :),
+ // then anything else
+ // These preferences are here to reduce the number of selectors
+ // needing tokenize in the PSEUDO preFilter
+ pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
+
+ // For matchExpr.POS and matchExpr.needsContext
+ pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
+ "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",
+
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+ rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
+ rpseudo = new RegExp( pseudos ),
+
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
+ rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
+
+ rnot = /^:not/,
+ rsibling = /[\x20\t\r\n\f]*[+~]/,
+ rendsWithNot = /:not\($/,
+
+ rheader = /h\d/i,
+ rinputs = /input|select|textarea|button/i,
+
+ rbackslash = /\\(?!\\)/g,
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+ "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+ "ATTR": new RegExp( "^" + attributes ),
+ "PSEUDO": new RegExp( "^" + pseudos ),
+ "POS": new RegExp( pos, "i" ),
+ "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ // For use in libraries implementing .is()
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
+ },
+
+ // Support
+
+ // Used for testing something on an element
+ assert = function( fn ) {
+ var div = document.createElement("div");
+
+ try {
+ return fn( div );
+ } catch (e) {
+ return false;
+ } finally {
+ // release memory in IE
+ div = null;
+ }
+ },
+
+ // Check if getElementsByTagName("*") returns only elements
+ assertTagNameNoComments = assert(function( div ) {
+ div.appendChild( document.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ }),
+
+ // Check if getAttribute returns normalized href attributes
+ assertHrefNotNormalized = assert(function( div ) {
+ div.innerHTML = "";
+ return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
+ div.firstChild.getAttribute("href") === "#";
+ }),
+
+ // Check if attributes should be retrieved by attribute nodes
+ assertAttributes = assert(function( div ) {
+ div.innerHTML = "";
+ var type = typeof div.lastChild.getAttribute("multiple");
+ // IE8 returns a string for some attributes even when not present
+ return type !== "boolean" && type !== "string";
+ }),
+
+ // Check if getElementsByClassName can be trusted
+ assertUsableClassName = assert(function( div ) {
+ // Opera can't find a second classname (in 9.6)
+ div.innerHTML = "";
+ if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
+ return false;
+ }
+
+ // Safari 3.2 caches class attributes and doesn't catch changes
+ div.lastChild.className = "e";
+ return div.getElementsByClassName("e").length === 2;
+ }),
+
+ // Check if getElementById returns elements by name
+ // Check if getElementsByName privileges form controls or returns elements by ID
+ assertUsableName = assert(function( div ) {
+ // Inject content
+ div.id = expando + 0;
+ div.innerHTML = "";
+ docElem.insertBefore( div, docElem.firstChild );
+
+ // Test
+ var pass = document.getElementsByName &&
+ // buggy browsers will return fewer than the correct 2
+ document.getElementsByName( expando ).length === 2 +
+ // buggy browsers will return more than the correct 0
+ document.getElementsByName( expando + 0 ).length;
+ assertGetIdNotName = !document.getElementById( expando );
+
+ // Cleanup
+ docElem.removeChild( div );
+
+ return pass;
+ });
+
+// If slice is not available, provide a backup
+try {
+ slice.call( docElem.childNodes, 0 )[0].nodeType;
+} catch ( e ) {
+ slice = function( i ) {
+ var elem,
+ results = [];
+ for ( ; (elem = this[i]); i++ ) {
+ results.push( elem );
+ }
+ return results;
+ };
+}
+
+function Sizzle( selector, context, results, seed ) {
+ results = results || [];
+ context = context || document;
+ var match, elem, xml, m,
+ nodeType = context.nodeType;
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ if ( nodeType !== 1 && nodeType !== 9 ) {
+ return [];
+ }
+
+ xml = isXML( context );
+
+ if ( !xml && !seed ) {
+ if ( (match = rquickExpr.exec( selector )) ) {
+ // Speed-up: Sizzle("#ID")
+ if ( (m = match[1]) ) {
+ if ( nodeType === 9 ) {
+ elem = context.getElementById( m );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE, Opera, and Webkit return items
+ // by name instead of ID
+ if ( elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ } else {
+ return results;
+ }
+ } else {
+ // Context is not a document
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ contains( context, elem ) && elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ }
+
+ // Speed-up: Sizzle("TAG")
+ } else if ( match[2] ) {
+ push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
+ push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
+ return results;
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );
+}
+
+Sizzle.matches = function( expr, elements ) {
+ return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+ return Sizzle( expr, null, null, [ elem ] ).length > 0;
+};
+
+// Returns a function to use in pseudos for input types
+function createInputPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for buttons
+function createButtonPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for positionals
+function createPositionalPseudo( fn ) {
+ return markFunction(function( argument ) {
+ argument = +argument;
+ return markFunction(function( seed, matches ) {
+ var j,
+ matchIndexes = fn( [], seed.length, argument ),
+ i = matchIndexes.length;
+
+ // Match elements found at the specified indexes
+ while ( i-- ) {
+ if ( seed[ (j = matchIndexes[i]) ] ) {
+ seed[j] = !(matches[j] = seed[j]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( nodeType ) {
+ if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (see #11153)
+ if ( typeof elem.textContent === "string" ) {
+ return elem.textContent;
+ } else {
+ // Traverse its children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ // Do not include comment or processing instruction nodes
+ } else {
+
+ // If no nodeType, this is expected to be an array
+ for ( ; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ ret += getText( node );
+ }
+ }
+ return ret;
+};
+
+isXML = Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+// Element contains another
+contains = Sizzle.contains = docElem.contains ?
+ function( a, b ) {
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
+ } :
+ docElem.compareDocumentPosition ?
+ function( a, b ) {
+ return b && !!( a.compareDocumentPosition( b ) & 16 );
+ } :
+ function( a, b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+Sizzle.attr = function( elem, name ) {
+ var val,
+ xml = isXML( elem );
+
+ if ( !xml ) {
+ name = name.toLowerCase();
+ }
+ if ( (val = Expr.attrHandle[ name ]) ) {
+ return val( elem );
+ }
+ if ( xml || assertAttributes ) {
+ return elem.getAttribute( name );
+ }
+ val = elem.getAttributeNode( name );
+ return val ?
+ typeof elem[ name ] === "boolean" ?
+ elem[ name ] ? name : null :
+ val.specified ? val.value : null :
+ null;
+};
+
+Expr = Sizzle.selectors = {
+
+ // Can be adjusted by the user
+ cacheLength: 50,
+
+ createPseudo: markFunction,
+
+ match: matchExpr,
+
+ // IE6/7 return a modified href
+ attrHandle: assertHrefNotNormalized ?
+ {} :
+ {
+ "href": function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ },
+ "type": function( elem ) {
+ return elem.getAttribute("type");
+ }
+ },
+
+ find: {
+ "ID": assertGetIdNotName ?
+ function( id, context, xml ) {
+ if ( typeof context.getElementById !== strundefined && !xml ) {
+ var m = context.getElementById( id );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ } :
+ function( id, context, xml ) {
+ if ( typeof context.getElementById !== strundefined && !xml ) {
+ var m = context.getElementById( id );
+
+ return m ?
+ m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
+ [m] :
+ undefined :
+ [];
+ }
+ },
+
+ "TAG": assertTagNameNoComments ?
+ function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== strundefined ) {
+ return context.getElementsByTagName( tag );
+ }
+ } :
+ function( tag, context ) {
+ var results = context.getElementsByTagName( tag );
+
+ // Filter out possible comments
+ if ( tag === "*" ) {
+ var elem,
+ tmp = [],
+ i = 0;
+
+ for ( ; (elem = results[i]); i++ ) {
+ if ( elem.nodeType === 1 ) {
+ tmp.push( elem );
+ }
+ }
+
+ return tmp;
+ }
+ return results;
+ },
+
+ "NAME": assertUsableName && function( tag, context ) {
+ if ( typeof context.getElementsByName !== strundefined ) {
+ return context.getElementsByName( name );
+ }
+ },
+
+ "CLASS": assertUsableClassName && function( className, context, xml ) {
+ if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
+ return context.getElementsByClassName( className );
+ }
+ }
+ },
+
+ relative: {
+ ">": { dir: "parentNode", first: true },
+ " ": { dir: "parentNode" },
+ "+": { dir: "previousSibling", first: true },
+ "~": { dir: "previousSibling" }
+ },
+
+ preFilter: {
+ "ATTR": function( match ) {
+ match[1] = match[1].replace( rbackslash, "" );
+
+ // Move the given value to match[3] whether quoted or unquoted
+ match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
+
+ if ( match[2] === "~=" ) {
+ match[3] = " " + match[3] + " ";
+ }
+
+ return match.slice( 0, 4 );
+ },
+
+ "CHILD": function( match ) {
+ /* matches from matchExpr["CHILD"]
+ 1 type (only|nth|...)
+ 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+ 3 xn-component of xn+y argument ([+-]?\d*n|)
+ 4 sign of xn-component
+ 5 x of xn-component
+ 6 sign of y-component
+ 7 y of y-component
+ */
+ match[1] = match[1].toLowerCase();
+
+ if ( match[1] === "nth" ) {
+ // nth-child requires argument
+ if ( !match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // numeric x and y parameters for Expr.filter.CHILD
+ // remember that false/true cast respectively to 0/1
+ match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
+ match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
+
+ // other types prohibit arguments
+ } else if ( match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ return match;
+ },
+
+ "PSEUDO": function( match ) {
+ var unquoted, excess;
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
+ return null;
+ }
+
+ if ( match[3] ) {
+ match[2] = match[3];
+ } else if ( (unquoted = match[4]) ) {
+ // Only check arguments that contain a pseudo
+ if ( rpseudo.test(unquoted) &&
+ // Get excess from tokenize (recursively)
+ (excess = tokenize( unquoted, true )) &&
+ // advance to the next closing parenthesis
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+ // excess is a negative index
+ unquoted = unquoted.slice( 0, excess );
+ match[0] = match[0].slice( 0, excess );
+ }
+ match[2] = unquoted;
+ }
+
+ // Return only captures needed by the pseudo filter method (type and argument)
+ return match.slice( 0, 3 );
+ }
+ },
+
+ filter: {
+ "ID": assertGetIdNotName ?
+ function( id ) {
+ id = id.replace( rbackslash, "" );
+ return function( elem ) {
+ return elem.getAttribute("id") === id;
+ };
+ } :
+ function( id ) {
+ id = id.replace( rbackslash, "" );
+ return function( elem ) {
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ return node && node.value === id;
+ };
+ },
+
+ "TAG": function( nodeName ) {
+ if ( nodeName === "*" ) {
+ return function() { return true; };
+ }
+ nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
+
+ return function( elem ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
+ },
+
+ "CLASS": function( className ) {
+ var pattern = classCache[ expando ][ className ];
+ if ( !pattern ) {
+ pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") );
+ }
+ return function( elem ) {
+ return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
+ };
+ },
+
+ "ATTR": function( name, operator, check ) {
+ return function( elem, context ) {
+ var result = Sizzle.attr( elem, name );
+
+ if ( result == null ) {
+ return operator === "!=";
+ }
+ if ( !operator ) {
+ return true;
+ }
+
+ result += "";
+
+ return operator === "=" ? result === check :
+ operator === "!=" ? result !== check :
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
+ operator === "$=" ? check && result.substr( result.length - check.length ) === check :
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+ operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
+ false;
+ };
+ },
+
+ "CHILD": function( type, argument, first, last ) {
+
+ if ( type === "nth" ) {
+ return function( elem ) {
+ var node, diff,
+ parent = elem.parentNode;
+
+ if ( first === 1 && last === 0 ) {
+ return true;
+ }
+
+ if ( parent ) {
+ diff = 0;
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ diff++;
+ if ( elem === node ) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Incorporate the offset (or cast to NaN), then check against cycle size
+ diff -= last;
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
+ };
+ }
+
+ return function( elem ) {
+ var node = elem;
+
+ switch ( type ) {
+ case "only":
+ case "first":
+ while ( (node = node.previousSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ if ( type === "first" ) {
+ return true;
+ }
+
+ node = elem;
+
+ /* falls through */
+ case "last":
+ while ( (node = node.nextSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ };
+ },
+
+ "PSEUDO": function( pseudo, argument ) {
+ // pseudo-class names are case-insensitive
+ // http://www.w3.org/TR/selectors/#pseudo-classes
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+ // Remember that setFilters inherits from pseudos
+ var args,
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+ Sizzle.error( "unsupported pseudo: " + pseudo );
+
+ // The user may use createPseudo to indicate that
+ // arguments are needed to create the filter function
+ // just as Sizzle does
+ if ( fn[ expando ] ) {
+ return fn( argument );
+ }
+
+ // But maintain support for old signatures
+ if ( fn.length > 1 ) {
+ args = [ pseudo, pseudo, "", argument ];
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+ markFunction(function( seed, matches ) {
+ var idx,
+ matched = fn( seed, argument ),
+ i = matched.length;
+ while ( i-- ) {
+ idx = indexOf.call( seed, matched[i] );
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
+ }
+ }) :
+ function( elem ) {
+ return fn( elem, 0, args );
+ };
+ }
+
+ return fn;
+ }
+ },
+
+ pseudos: {
+ "not": markFunction(function( selector ) {
+ // Trim the selector passed to compile
+ // to avoid treating leading and trailing
+ // spaces as combinators
+ var input = [],
+ results = [],
+ matcher = compile( selector.replace( rtrim, "$1" ) );
+
+ return matcher[ expando ] ?
+ markFunction(function( seed, matches, context, xml ) {
+ var elem,
+ unmatched = matcher( seed, null, xml, [] ),
+ i = seed.length;
+
+ // Match elements unmatched by `matcher`
+ while ( i-- ) {
+ if ( (elem = unmatched[i]) ) {
+ seed[i] = !(matches[i] = elem);
+ }
+ }
+ }) :
+ function( elem, context, xml ) {
+ input[0] = elem;
+ matcher( input, null, xml, results );
+ return !results.pop();
+ };
+ }),
+
+ "has": markFunction(function( selector ) {
+ return function( elem ) {
+ return Sizzle( selector, elem ).length > 0;
+ };
+ }),
+
+ "contains": markFunction(function( text ) {
+ return function( elem ) {
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+ };
+ }),
+
+ "enabled": function( elem ) {
+ return elem.disabled === false;
+ },
+
+ "disabled": function( elem ) {
+ return elem.disabled === true;
+ },
+
+ "checked": function( elem ) {
+ // In CSS3, :checked should return both checked and selected elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ var nodeName = elem.nodeName.toLowerCase();
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ },
+
+ "selected": function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ "parent": function( elem ) {
+ return !Expr.pseudos["empty"]( elem );
+ },
+
+ "empty": function( elem ) {
+ // http://www.w3.org/TR/selectors/#empty-pseudo
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
+ // not comment, processing instructions, or others
+ // Thanks to Diego Perini for the nodeName shortcut
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
+ var nodeType;
+ elem = elem.firstChild;
+ while ( elem ) {
+ if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
+ return false;
+ }
+ elem = elem.nextSibling;
+ }
+ return true;
+ },
+
+ "header": function( elem ) {
+ return rheader.test( elem.nodeName );
+ },
+
+ "text": function( elem ) {
+ var type, attr;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" &&
+ (type = elem.type) === "text" &&
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
+ },
+
+ // Input types
+ "radio": createInputPseudo("radio"),
+ "checkbox": createInputPseudo("checkbox"),
+ "file": createInputPseudo("file"),
+ "password": createInputPseudo("password"),
+ "image": createInputPseudo("image"),
+
+ "submit": createButtonPseudo("submit"),
+ "reset": createButtonPseudo("reset"),
+
+ "button": function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === "button" || name === "button";
+ },
+
+ "input": function( elem ) {
+ return rinputs.test( elem.nodeName );
+ },
+
+ "focus": function( elem ) {
+ var doc = elem.ownerDocument;
+ return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);
+ },
+
+ "active": function( elem ) {
+ return elem === elem.ownerDocument.activeElement;
+ },
+
+ // Positional types
+ "first": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ 0 ];
+ }),
+
+ "last": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ length - 1 ];
+ }),
+
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ argument < 0 ? argument + length : argument ];
+ }),
+
+ "even": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ for ( var i = 0; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "odd": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ for ( var i = 1; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ })
+ }
+};
+
+function siblingCheck( a, b, ret ) {
+ if ( a === b ) {
+ return ret;
+ }
+
+ var cur = a.nextSibling;
+
+ while ( cur ) {
+ if ( cur === b ) {
+ return -1;
+ }
+
+ cur = cur.nextSibling;
+ }
+
+ return 1;
+}
+
+sortOrder = docElem.compareDocumentPosition ?
+ function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
+ a.compareDocumentPosition :
+ a.compareDocumentPosition(b) & 4
+ ) ? -1 : 1;
+ } :
+ function( a, b ) {
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes
+ } else if ( a.sourceIndex && b.sourceIndex ) {
+ return a.sourceIndex - b.sourceIndex;
+ }
+
+ var al, bl,
+ ap = [],
+ bp = [],
+ aup = a.parentNode,
+ bup = b.parentNode,
+ cur = aup;
+
+ // If the nodes are siblings (or identical) we can do a quick check
+ if ( aup === bup ) {
+ return siblingCheck( a, b );
+
+ // If no parents were found then the nodes are disconnected
+ } else if ( !aup ) {
+ return -1;
+
+ } else if ( !bup ) {
+ return 1;
+ }
+
+ // Otherwise they're somewhere else in the tree so we need
+ // to build up a full list of the parentNodes for comparison
+ while ( cur ) {
+ ap.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ cur = bup;
+
+ while ( cur ) {
+ bp.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ al = ap.length;
+ bl = bp.length;
+
+ // Start walking down the tree looking for a discrepancy
+ for ( var i = 0; i < al && i < bl; i++ ) {
+ if ( ap[i] !== bp[i] ) {
+ return siblingCheck( ap[i], bp[i] );
+ }
+ }
+
+ // We ended someplace up the tree so do a sibling check
+ return i === al ?
+ siblingCheck( a, bp[i], -1 ) :
+ siblingCheck( ap[i], b, 1 );
+ };
+
+// Always assume the presence of duplicates if sort doesn't
+// pass them to our comparison function (as in Google Chrome).
+[0, 0].sort( sortOrder );
+baseHasDuplicate = !hasDuplicate;
+
+// Document sorting and removing duplicates
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ i = 1;
+
+ hasDuplicate = baseHasDuplicate;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( ; (elem = results[i]); i++ ) {
+ if ( elem === results[ i - 1 ] ) {
+ results.splice( i--, 1 );
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+function tokenize( selector, parseOnly ) {
+ var matched, match, tokens, type, soFar, groups, preFilters,
+ cached = tokenCache[ expando ][ selector ];
+
+ if ( cached ) {
+ return parseOnly ? 0 : cached.slice( 0 );
+ }
+
+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+
+ while ( soFar ) {
+
+ // Comma and first run
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( match ) {
+ soFar = soFar.slice( match[0].length );
+ }
+ groups.push( tokens = [] );
+ }
+
+ matched = false;
+
+ // Combinators
+ if ( (match = rcombinators.exec( soFar )) ) {
+ tokens.push( matched = new Token( match.shift() ) );
+ soFar = soFar.slice( matched.length );
+
+ // Cast descendant combinators to space
+ matched.type = match[0].replace( rtrim, " " );
+ }
+
+ // Filters
+ for ( type in Expr.filter ) {
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+ // The last two arguments here are (context, xml) for backCompat
+ (match = preFilters[ type ]( match, document, true ))) ) {
+
+ tokens.push( matched = new Token( match.shift() ) );
+ soFar = soFar.slice( matched.length );
+ matched.type = type;
+ matched.matches = match;
+ }
+ }
+
+ if ( !matched ) {
+ break;
+ }
+ }
+
+ // Return the length of the invalid excess
+ // if we're just parsing
+ // Otherwise, throw an error or return tokens
+ return parseOnly ?
+ soFar.length :
+ soFar ?
+ Sizzle.error( selector ) :
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+}
+
+function addCombinator( matcher, combinator, base ) {
+ var dir = combinator.dir,
+ checkNonElements = base && combinator.dir === "parentNode",
+ doneName = done++;
+
+ return combinator.first ?
+ // Check against closest ancestor/preceding element
+ function( elem, context, xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( checkNonElements || elem.nodeType === 1 ) {
+ return matcher( elem, context, xml );
+ }
+ }
+ } :
+
+ // Check against all ancestor/preceding elements
+ function( elem, context, xml ) {
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+ if ( !xml ) {
+ var cache,
+ dirkey = dirruns + " " + doneName + " ",
+ cachedkey = dirkey + cachedruns;
+ while ( (elem = elem[ dir ]) ) {
+ if ( checkNonElements || elem.nodeType === 1 ) {
+ if ( (cache = elem[ expando ]) === cachedkey ) {
+ return elem.sizset;
+ } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
+ if ( elem.sizset ) {
+ return elem;
+ }
+ } else {
+ elem[ expando ] = cachedkey;
+ if ( matcher( elem, context, xml ) ) {
+ elem.sizset = true;
+ return elem;
+ }
+ elem.sizset = false;
+ }
+ }
+ }
+ } else {
+ while ( (elem = elem[ dir ]) ) {
+ if ( checkNonElements || elem.nodeType === 1 ) {
+ if ( matcher( elem, context, xml ) ) {
+ return elem;
+ }
+ }
+ }
+ }
+ };
+}
+
+function elementMatcher( matchers ) {
+ return matchers.length > 1 ?
+ function( elem, context, xml ) {
+ var i = matchers.length;
+ while ( i-- ) {
+ if ( !matchers[i]( elem, context, xml ) ) {
+ return false;
+ }
+ }
+ return true;
+ } :
+ matchers[0];
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+ var elem,
+ newUnmatched = [],
+ i = 0,
+ len = unmatched.length,
+ mapped = map != null;
+
+ for ( ; i < len; i++ ) {
+ if ( (elem = unmatched[i]) ) {
+ if ( !filter || filter( elem, context, xml ) ) {
+ newUnmatched.push( elem );
+ if ( mapped ) {
+ map.push( i );
+ }
+ }
+ }
+ }
+
+ return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+ if ( postFilter && !postFilter[ expando ] ) {
+ postFilter = setMatcher( postFilter );
+ }
+ if ( postFinder && !postFinder[ expando ] ) {
+ postFinder = setMatcher( postFinder, postSelector );
+ }
+ return markFunction(function( seed, results, context, xml ) {
+ // Positional selectors apply to seed elements, so it is invalid to follow them with relative ones
+ if ( seed && postFinder ) {
+ return;
+ }
+
+ var i, elem, postFilterIn,
+ preMap = [],
+ postMap = [],
+ preexisting = results.length,
+
+ // Get initial elements from seed or context
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [], seed ),
+
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
+ matcherIn = preFilter && ( seed || !selector ) ?
+ condense( elems, preMap, preFilter, context, xml ) :
+ elems,
+
+ matcherOut = matcher ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+ // ...intermediate processing is necessary
+ [] :
+
+ // ...otherwise use results directly
+ results :
+ matcherIn;
+
+ // Find primary matches
+ if ( matcher ) {
+ matcher( matcherIn, matcherOut, context, xml );
+ }
+
+ // Apply postFilter
+ if ( postFilter ) {
+ postFilterIn = condense( matcherOut, postMap );
+ postFilter( postFilterIn, [], context, xml );
+
+ // Un-match failing elements by moving them back to matcherIn
+ i = postFilterIn.length;
+ while ( i-- ) {
+ if ( (elem = postFilterIn[i]) ) {
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ }
+ }
+ }
+
+ // Keep seed and results synchronized
+ if ( seed ) {
+ // Ignore postFinder because it can't coexist with seed
+ i = preFilter && matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) ) {
+ seed[ preMap[i] ] = !(results[ preMap[i] ] = elem);
+ }
+ }
+ } else {
+ matcherOut = condense(
+ matcherOut === results ?
+ matcherOut.splice( preexisting, matcherOut.length ) :
+ matcherOut
+ );
+ if ( postFinder ) {
+ postFinder( null, results, matcherOut, xml );
+ } else {
+ push.apply( results, matcherOut );
+ }
+ }
+ });
+}
+
+function matcherFromTokens( tokens ) {
+ var checkContext, matcher, j,
+ len = tokens.length,
+ leadingRelative = Expr.relative[ tokens[0].type ],
+ implicitRelative = leadingRelative || Expr.relative[" "],
+ i = leadingRelative ? 1 : 0,
+
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
+ matchContext = addCombinator( function( elem ) {
+ return elem === checkContext;
+ }, implicitRelative, true ),
+ matchAnyContext = addCombinator( function( elem ) {
+ return indexOf.call( checkContext, elem ) > -1;
+ }, implicitRelative, true ),
+ matchers = [ function( elem, context, xml ) {
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+ (checkContext = context).nodeType ?
+ matchContext( elem, context, xml ) :
+ matchAnyContext( elem, context, xml ) );
+ } ];
+
+ for ( ; i < len; i++ ) {
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+ matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
+ } else {
+ // The concatenated values are (context, xml) for backCompat
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+ // Return special upon seeing a positional matcher
+ if ( matcher[ expando ] ) {
+ // Find the next relative operator (if any) for proper handling
+ j = ++i;
+ for ( ; j < len; j++ ) {
+ if ( Expr.relative[ tokens[j].type ] ) {
+ break;
+ }
+ }
+ return setMatcher(
+ i > 1 && elementMatcher( matchers ),
+ i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
+ matcher,
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && tokens.join("")
+ );
+ }
+ matchers.push( matcher );
+ }
+ }
+
+ return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+ var bySet = setMatchers.length > 0,
+ byElement = elementMatchers.length > 0,
+ superMatcher = function( seed, context, xml, results, expandContext ) {
+ var elem, j, matcher,
+ setMatched = [],
+ matchedCount = 0,
+ i = "0",
+ unmatched = seed && [],
+ outermost = expandContext != null,
+ contextBackup = outermostContext,
+ // We must always have either seed elements or context
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+ // Nested matchers should use non-integer dirruns
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
+
+ if ( outermost ) {
+ outermostContext = context !== document && context;
+ cachedruns = superMatcher.el;
+ }
+
+ // Add elements passing elementMatchers directly to results
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ if ( byElement && elem ) {
+ for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
+ if ( matcher( elem, context, xml ) ) {
+ results.push( elem );
+ break;
+ }
+ }
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ cachedruns = ++superMatcher.el;
+ }
+ }
+
+ // Track unmatched elements for set filters
+ if ( bySet ) {
+ // They will have gone through all possible matchers
+ if ( (elem = !matcher && elem) ) {
+ matchedCount--;
+ }
+
+ // Lengthen the array for every element, matched or not
+ if ( seed ) {
+ unmatched.push( elem );
+ }
+ }
+ }
+
+ // Apply set filters to unmatched elements
+ matchedCount += i;
+ if ( bySet && i !== matchedCount ) {
+ for ( j = 0; (matcher = setMatchers[j]); j++ ) {
+ matcher( unmatched, setMatched, context, xml );
+ }
+
+ if ( seed ) {
+ // Reintegrate element matches to eliminate the need for sorting
+ if ( matchedCount > 0 ) {
+ while ( i-- ) {
+ if ( !(unmatched[i] || setMatched[i]) ) {
+ setMatched[i] = pop.call( results );
+ }
+ }
+ }
+
+ // Discard index placeholder values to get only actual matches
+ setMatched = condense( setMatched );
+ }
+
+ // Add matches to results
+ push.apply( results, setMatched );
+
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
+ if ( outermost && !seed && setMatched.length > 0 &&
+ ( matchedCount + setMatchers.length ) > 1 ) {
+
+ Sizzle.uniqueSort( results );
+ }
+ }
+
+ // Override manipulation of globals by nested matchers
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
+ }
+
+ return unmatched;
+ };
+
+ superMatcher.el = 0;
+ return bySet ?
+ markFunction( superMatcher ) :
+ superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
+ var i,
+ setMatchers = [],
+ elementMatchers = [],
+ cached = compilerCache[ expando ][ selector ];
+
+ if ( !cached ) {
+ // Generate a function of recursive functions that can be used to check each element
+ if ( !group ) {
+ group = tokenize( selector );
+ }
+ i = group.length;
+ while ( i-- ) {
+ cached = matcherFromTokens( group[i] );
+ if ( cached[ expando ] ) {
+ setMatchers.push( cached );
+ } else {
+ elementMatchers.push( cached );
+ }
+ }
+
+ // Cache the compiled function
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+ }
+ return cached;
+};
+
+function multipleContexts( selector, contexts, results, seed ) {
+ var i = 0,
+ len = contexts.length;
+ for ( ; i < len; i++ ) {
+ Sizzle( selector, contexts[i], results, seed );
+ }
+ return results;
+}
+
+function select( selector, context, results, seed, xml ) {
+ var i, tokens, token, type, find,
+ match = tokenize( selector ),
+ j = match.length;
+
+ if ( !seed ) {
+ // Try to minimize operations if there is only one group
+ if ( match.length === 1 ) {
+
+ // Take a shortcut and set the context if the root selector is an ID
+ tokens = match[0] = match[0].slice( 0 );
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ context.nodeType === 9 && !xml &&
+ Expr.relative[ tokens[1].type ] ) {
+
+ context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
+ if ( !context ) {
+ return results;
+ }
+
+ selector = selector.slice( tokens.shift().length );
+ }
+
+ // Fetch a seed set for right-to-left matching
+ for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
+ token = tokens[i];
+
+ // Abort if we hit a combinator
+ if ( Expr.relative[ (type = token.type) ] ) {
+ break;
+ }
+ if ( (find = Expr.find[ type ]) ) {
+ // Search, expanding context for leading sibling combinators
+ if ( (seed = find(
+ token.matches[0].replace( rbackslash, "" ),
+ rsibling.test( tokens[0].type ) && context.parentNode || context,
+ xml
+ )) ) {
+
+ // If seed is empty or no tokens remain, we can return early
+ tokens.splice( i, 1 );
+ selector = seed.length && tokens.join("");
+ if ( !selector ) {
+ push.apply( results, slice.call( seed, 0 ) );
+ return results;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Compile and execute a filtering function
+ // Provide `match` to avoid retokenization if we modified the selector above
+ compile( selector, match )(
+ seed,
+ context,
+ xml,
+ results,
+ rsibling.test( selector )
+ );
+ return results;
+}
+
+if ( document.querySelectorAll ) {
+ (function() {
+ var disconnectedMatch,
+ oldSelect = select,
+ rescape = /'|\\/g,
+ rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
+
+ // qSa(:focus) reports false when true (Chrome 21),
+ // A support test would require too much code (would include document ready)
+ rbuggyQSA = [":focus"],
+
+ // matchesSelector(:focus) reports false when true (Chrome 21),
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ // A support test would require too much code (would include document ready)
+ // just skip matchesSelector for :active
+ rbuggyMatches = [ ":active", ":focus" ],
+ matches = docElem.matchesSelector ||
+ docElem.mozMatchesSelector ||
+ docElem.webkitMatchesSelector ||
+ docElem.oMatchesSelector ||
+ docElem.msMatchesSelector;
+
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert(function( div ) {
+ // Select is set to empty string on purpose
+ // This is to test IE's treatment of not explictly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = "";
+
+ // IE8 - Some boolean attributes are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
+ }
+
+ // Webkit/Opera - :checked should return selected option elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ // IE8 throws error here (do not put tests after this one)
+ if ( !div.querySelectorAll(":checked").length ) {
+ rbuggyQSA.push(":checked");
+ }
+ });
+
+ assert(function( div ) {
+
+ // Opera 10-12/IE9 - ^= $= *= and empty values
+ // Should not select anything
+ div.innerHTML = "";
+ if ( div.querySelectorAll("[test^='']").length ) {
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
+ }
+
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+ // IE8 throws error here (do not put tests after this one)
+ div.innerHTML = "";
+ if ( !div.querySelectorAll(":enabled").length ) {
+ rbuggyQSA.push(":enabled", ":disabled");
+ }
+ });
+
+ // rbuggyQSA always contains :focus, so no need for a length check
+ rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
+
+ select = function( selector, context, results, seed, xml ) {
+ // Only use querySelectorAll when not filtering,
+ // when this is not xml,
+ // and when no QSA bugs apply
+ if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
+ var groups, i,
+ old = true,
+ nid = expando,
+ newContext = context,
+ newSelector = context.nodeType === 9 && selector;
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ groups = tokenize( selector );
+
+ if ( (old = context.getAttribute("id")) ) {
+ nid = old.replace( rescape, "\\$&" );
+ } else {
+ context.setAttribute( "id", nid );
+ }
+ nid = "[id='" + nid + "'] ";
+
+ i = groups.length;
+ while ( i-- ) {
+ groups[i] = nid + groups[i].join("");
+ }
+ newContext = rsibling.test( selector ) && context.parentNode || context;
+ newSelector = groups.join(",");
+ }
+
+ if ( newSelector ) {
+ try {
+ push.apply( results, slice.call( newContext.querySelectorAll(
+ newSelector
+ ), 0 ) );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+
+ return oldSelect( selector, context, results, seed, xml );
+ };
+
+ if ( matches ) {
+ assert(function( div ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9)
+ disconnectedMatch = matches.call( div, "div" );
+
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ try {
+ matches.call( div, "[test!='']:sizzle" );
+ rbuggyMatches.push( "!=", pseudos );
+ } catch ( e ) {}
+ });
+
+ // rbuggyMatches always contains :active and :focus, so no need for a length check
+ rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
+
+ Sizzle.matchesSelector = function( elem, expr ) {
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace( rattributeQuotes, "='$1']" );
+
+ // rbuggyMatches always contains :active, so no need for an existence check
+ if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) {
+ try {
+ var ret = matches.call( elem, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
+ return ret;
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle( expr, null, null, [ elem ] ).length > 0;
+ };
+ }
+ })();
+}
+
+// Deprecated
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Back-compat
+function setFilters() {}
+Expr.filters = setFilters.prototype = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})( window );
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ rneedsContext = jQuery.expr.match.needsContext,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var i, l, length, n, r, ret,
+ self = this;
+
+ if ( typeof selector !== "string" ) {
+ return jQuery( selector ).filter(function() {
+ for ( i = 0, l = self.length; i < l; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ });
+ }
+
+ ret = this.pushStack( "", "find", selector );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ length = ret.length;
+ jQuery.find( selector, this[i], ret );
+
+ if ( i > 0 ) {
+ // Make sure that the results are unique
+ for ( n = length; n < ret.length; n++ ) {
+ for ( r = 0; r < length; r++ ) {
+ if ( ret[r] === ret[n] ) {
+ ret.splice(n--, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ has: function( target ) {
+ var i,
+ targets = jQuery( target, this ),
+ len = targets.length;
+
+ return this.filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false), "not", selector);
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
+ },
+
+ is: function( selector ) {
+ return !!selector && (
+ typeof selector === "string" ?
+ // If this is a positional/relative selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ rneedsContext.test( selector ) ?
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
+ jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0 );
+ },
+
+ closest: function( selectors, context ) {
+ var cur,
+ i = 0,
+ l = this.length,
+ ret = [],
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( ; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+ }
+ cur = cur.parentNode;
+ }
+ }
+
+ ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
+
+ return this.pushStack( ret, "closest", selectors );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
+ all :
+ jQuery.unique( all ) );
+ },
+
+ addBack: function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter(selector)
+ );
+ }
+});
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+// A painfully simple check to see if an element is disconnected
+// from a document (should be improved, where feasible).
+function isDisconnected( node ) {
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;
+}
+
+function sibling( cur, dir ) {
+ do {
+ cur = cur[ dir ];
+ } while ( cur && cur.nodeType !== 1 );
+
+ return cur;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return sibling( elem, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return sibling( elem, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.merge( [], elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+ if ( this.length > 1 && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return ( elem === qualifier ) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem, i ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+ });
+}
+function createSafeFragment( document ) {
+ var list = nodeNames.split( "|" ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( list.length ) {
+ safeFrag.createElement(
+ list.pop()
+ );
+ }
+ }
+ return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+ rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+ rtagName = /<([\w:]+)/,
+ rtbody = /]", "i"),
+ rcheckableType = /^(?:checkbox|radio)$/,
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /\/(java|ecma)script/i,
+ rcleanScript = /^\s*\s*$/g,
+ wrapMap = {
+ option: [ 1, "" ],
+ legend: [ 1, "" ],
+ thead: [ 1, "
", "
" ],
+ tr: [ 2, "
", "
" ],
+ td: [ 3, "
", "
" ],
+ col: [ 2, "
", "
" ],
+ area: [ 1, "" ],
+ _default: [ 0, "", "" ]
+ },
+ safeFragment = createSafeFragment( document ),
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+// unless wrapped in a div with non-breaking characters in front of it.
+if ( !jQuery.support.htmlSerialize ) {
+ wrapMap._default = [ 1, "X
", "
" ];
+}
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return jQuery.access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ }, null, value, arguments.length );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function(i) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ if ( !isDisconnected( this[0] ) ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this );
+ });
+ }
+
+ if ( arguments.length ) {
+ var set = jQuery.clean( arguments );
+ return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
+ }
+ },
+
+ after: function() {
+ if ( !isDisconnected( this[0] ) ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ }
+
+ if ( arguments.length ) {
+ var set = jQuery.clean( arguments );
+ return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
+ }
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ jQuery.cleanData( [ elem ] );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map( function () {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return jQuery.access( this, function( value ) {
+ var elem = this[0] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined ) {
+ return elem.nodeType === 1 ?
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
+ undefined;
+ }
+
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1>$2>" );
+
+ try {
+ for (; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ elem = this[i] || {};
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName( "*" ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function( value ) {
+ if ( !isDisconnected( this[0] ) ) {
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function(i) {
+ var self = jQuery(this), old = self.html();
+ self.replaceWith( value.call( this, i, old ) );
+ });
+ }
+
+ if ( typeof value !== "string" ) {
+ value = jQuery( value ).detach();
+ }
+
+ return this.each(function() {
+ var next = this.nextSibling,
+ parent = this.parentNode;
+
+ jQuery( this ).remove();
+
+ if ( next ) {
+ jQuery(next).before( value );
+ } else {
+ jQuery(parent).append( value );
+ }
+ });
+ }
+
+ return this.length ?
+ this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
+ this;
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+
+ // Flatten any nested arrays
+ args = [].concat.apply( [], args );
+
+ var results, first, fragment, iNoClone,
+ i = 0,
+ value = args[0],
+ scripts = [],
+ l = this.length;
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
+ return this.each(function() {
+ jQuery(this).domManip( args, table, callback );
+ });
+ }
+
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ args[0] = value.call( this, i, table ? self.html() : undefined );
+ self.domManip( args, table, callback );
+ });
+ }
+
+ if ( this[0] ) {
+ results = jQuery.buildFragment( args, this, scripts );
+ fragment = results.fragment;
+ first = fragment.firstChild;
+
+ if ( fragment.childNodes.length === 1 ) {
+ fragment = first;
+ }
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+
+ // Use the original fragment for the last item instead of the first because it can end up
+ // being emptied incorrectly in certain situations (#8070).
+ // Fragments from the fragment cache must always be cloned and never used in place.
+ for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
+ callback.call(
+ table && jQuery.nodeName( this[i], "table" ) ?
+ findOrAppend( this[i], "tbody" ) :
+ this[i],
+ i === iNoClone ?
+ fragment :
+ jQuery.clone( fragment, true, true )
+ );
+ }
+ }
+
+ // Fix #11809: Avoid leaking memory
+ fragment = first = null;
+
+ if ( scripts.length ) {
+ jQuery.each( scripts, function( i, elem ) {
+ if ( elem.src ) {
+ if ( jQuery.ajax ) {
+ jQuery.ajax({
+ url: elem.src,
+ type: "GET",
+ dataType: "script",
+ async: false,
+ global: false,
+ "throws": true
+ });
+ } else {
+ jQuery.error("no ajax");
+ }
+ } else {
+ jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+ });
+ }
+ }
+
+ return this;
+ }
+});
+
+function findOrAppend( elem, tag ) {
+ return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
+}
+
+function cloneCopyEvent( src, dest ) {
+
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+ return;
+ }
+
+ var type, i, l,
+ oldData = jQuery._data( src ),
+ curData = jQuery._data( dest, oldData ),
+ events = oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+
+ // make the cloned public data object a copy from the original
+ if ( curData.data ) {
+ curData.data = jQuery.extend( {}, curData.data );
+ }
+}
+
+function cloneFixAttributes( src, dest ) {
+ var nodeName;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ // clearAttributes removes the attributes, which we don't want,
+ // but also removes the attachEvent events, which we *do* want
+ if ( dest.clearAttributes ) {
+ dest.clearAttributes();
+ }
+
+ // mergeAttributes, in contrast, only merges back on the
+ // original attributes, not the events
+ if ( dest.mergeAttributes ) {
+ dest.mergeAttributes( src );
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ if ( nodeName === "object" ) {
+ // IE6-10 improperly clones children of object elements using classid.
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
+ if ( dest.parentNode ) {
+ dest.outerHTML = src.outerHTML;
+ }
+
+ // This path appears unavoidable for IE9. When cloning an object
+ // element in IE9, the outerHTML strategy above is not sufficient.
+ // If the src has innerHTML and the destination does not,
+ // copy the src.innerHTML into the dest.innerHTML. #10324
+ if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
+ dest.innerHTML = src.innerHTML;
+ }
+
+ } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
+ // IE6-8 fails to persist the checked state of a cloned checkbox
+ // or radio button. Worse, IE6-7 fail to give the cloned element
+ // a checked appearance if the defaultChecked value isn't also set
+
+ dest.defaultChecked = dest.checked = src.checked;
+
+ // IE6-7 get confused and end up setting the value of a cloned
+ // checkbox/radio button to an empty string instead of "on"
+ if ( dest.value !== src.value ) {
+ dest.value = src.value;
+ }
+
+ // IE6-8 fails to return the selected option to the default selected
+ // state when cloning options
+ } else if ( nodeName === "option" ) {
+ dest.selected = src.defaultSelected;
+
+ // IE6-8 fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+
+ // IE blanks contents when cloning scripts
+ } else if ( nodeName === "script" && dest.text !== src.text ) {
+ dest.text = src.text;
+ }
+
+ // Event data gets referenced instead of copied if the expando
+ // gets copied too
+ dest.removeAttribute( jQuery.expando );
+}
+
+jQuery.buildFragment = function( args, context, scripts ) {
+ var fragment, cacheable, cachehit,
+ first = args[ 0 ];
+
+ // Set context from what may come in as undefined or a jQuery collection or a node
+ // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
+ // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
+ context = context || document;
+ context = !context.nodeType && context[0] || context;
+ context = context.ownerDocument || context;
+
+ // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
+ // Cloning options loses the selected state, so don't cache them
+ // IE 6 doesn't like it when you put