├── README.md
├── Vagrantfile
├── app.py
├── requirements.txt
├── static
├── css
│ └── custom.css
├── geojson
│ └── us-states.json
├── js
│ └── graphs.js
└── lib
│ ├── css
│ ├── bootstrap.min.css
│ ├── dc.css
│ └── keen-dashboards.css
│ └── js
│ ├── bootstrap.min.js
│ ├── crossfilter.js
│ ├── d3.js
│ ├── dc.js
│ ├── jquery.min.js
│ ├── keen.min.js
│ └── queue.js
└── templates
└── index.html
/README.md:
--------------------------------------------------------------------------------
1 | # DonorsChoose_Visualization
2 | * Source Code for my blog post: [Interactive Data Visualization with D3.js, DC.js, Python, and MongoDB](http://adilmoujahid.com/posts/2015/01/interactive-data-visualization-d3-dc-python-mongodb/)
3 |
4 | #Visit my Blog : http://adilmoujahid.com
5 |
6 | ## Getting started
7 |
8 | The dependencies for the project can be installed using
9 |
10 | $ pip install -r requirements.txt
11 |
12 | You can use ``Vagrant`` to start a machine with a MongoDB instance running
13 |
14 | $ vagrant up
15 |
16 | To initialize the database you need to download the data
17 |
18 | $ wget https://s3.amazonaws.com/open_data/csv/opendata_projects.zip && unzip opendata_projects.zip
19 |
20 | and import it
21 |
22 | $ mongoimport -d donorschoose -c projects --type csv --file /vagrant/opendata_projects.csv -headerline
23 |
--------------------------------------------------------------------------------
/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5 | VAGRANTFILE_API_VERSION = "2"
6 |
7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8 | # All Vagrant configuration is done here. The most common configuration
9 | # options are documented and commented below. For a complete reference,
10 | # please see the online documentation at vagrantup.com.
11 |
12 | # Every Vagrant virtual environment requires a box to build off of.
13 | config.vm.box = "puphpet/debian75-x64"
14 |
15 | # Disable automatic box update checking. If you disable this, then
16 | # boxes will only be checked for updates when the user runs
17 | # `vagrant box outdated`. This is not recommended.
18 | # config.vm.box_check_update = false
19 |
20 | # config.vm.network "public_network", ip: "192.168.2.17"
21 | # Create a forwarded port mapping which allows access to a specific port
22 | # within the machine from a port on the host machine. In the example below,
23 | # accessing "localhost:8080" will access port 80 on the guest machine.
24 | config.vm.network "forwarded_port", guest: 27017, host: 27017
25 |
26 | # install MongoDB (bind to all the interface, SECURITY ISSUES HERE!!!!)
27 | config.vm.provision "shell", inline: "apt-get update && apt-get install -y mongodb && sed -i 's/bind_ip = 127.0.0.1/bind_ip = 0.0.0.0/' /etc/mongodb.conf && service mongodb restart"
28 | end
29 |
--------------------------------------------------------------------------------
/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 | from flask import render_template
3 | from pymongo import MongoClient
4 | import json
5 | from bson import json_util
6 | from bson.json_util import dumps
7 |
8 | app = Flask(__name__)
9 |
10 | MONGODB_HOST = 'localhost'
11 | MONGODB_PORT = 27017
12 | DBS_NAME = 'donorschoose'
13 | COLLECTION_NAME = 'projects'
14 | FIELDS = {'school_state': True, 'resource_type': True, 'poverty_level': True, 'date_posted': True, 'total_donations': True, '_id': False}
15 |
16 |
17 | @app.route("/")
18 | def index():
19 | return render_template("index.html")
20 |
21 |
22 | @app.route("/donorschoose/projects")
23 | def donorschoose_projects():
24 | connection = MongoClient(MONGODB_HOST, MONGODB_PORT)
25 | collection = connection[DBS_NAME][COLLECTION_NAME]
26 | projects = collection.find(projection=FIELDS, limit=100000)
27 | #projects = collection.find(projection=FIELDS)
28 | json_projects = []
29 | for project in projects:
30 | json_projects.append(project)
31 | json_projects = json.dumps(json_projects, default=json_util.default)
32 | connection.close()
33 | return json_projects
34 |
35 | if __name__ == "__main__":
36 | app.run(host='0.0.0.0',port=5000,debug=True)
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | Flask==0.10.1
2 | Jinja2==2.7.3
3 | MarkupSafe==0.23
4 | Werkzeug==0.10
5 | itsdangerous==0.24
6 | pymongo==2.8
7 |
--------------------------------------------------------------------------------
/static/css/custom.css:
--------------------------------------------------------------------------------
1 | #number-projects-nd {
2 | font-size: 60px;
3 | }
4 |
5 | #total-donations-nd {
6 | font-size: 60px;
7 | }
8 |
9 | .dc-chart g.row text {
10 | fill: black;
11 | font-size: 12px;
12 | }
--------------------------------------------------------------------------------
/static/js/graphs.js:
--------------------------------------------------------------------------------
1 | queue()
2 | .defer(d3.json, "/donorschoose/projects")
3 | .defer(d3.json, "static/geojson/us-states.json")
4 | .await(makeGraphs);
5 |
6 | function makeGraphs(error, projectsJson, statesJson) {
7 |
8 | //Clean projectsJson data
9 | var donorschooseProjects = projectsJson;
10 | var dateFormat = d3.time.format("%Y-%m-%d");
11 | donorschooseProjects.forEach(function(d) {
12 | d["date_posted"] = dateFormat.parse(d["date_posted"]);
13 | d["date_posted"].setDate(1);
14 | d["total_donations"] = +d["total_donations"];
15 | });
16 |
17 | //Create a Crossfilter instance
18 | var ndx = crossfilter(donorschooseProjects);
19 |
20 | //Define Dimensions
21 | var dateDim = ndx.dimension(function(d) { return d["date_posted"]; });
22 | var resourceTypeDim = ndx.dimension(function(d) { return d["resource_type"]; });
23 | var povertyLevelDim = ndx.dimension(function(d) { return d["poverty_level"]; });
24 | var stateDim = ndx.dimension(function(d) { return d["school_state"]; });
25 | var totalDonationsDim = ndx.dimension(function(d) { return d["total_donations"]; });
26 |
27 |
28 | //Calculate metrics
29 | var numProjectsByDate = dateDim.group();
30 | var numProjectsByResourceType = resourceTypeDim.group();
31 | var numProjectsByPovertyLevel = povertyLevelDim.group();
32 | var totalDonationsByState = stateDim.group().reduceSum(function(d) {
33 | return d["total_donations"];
34 | });
35 |
36 | var all = ndx.groupAll();
37 | var totalDonations = ndx.groupAll().reduceSum(function(d) {return d["total_donations"];});
38 |
39 | var max_state = totalDonationsByState.top(1)[0].value;
40 |
41 | //Define values (to be used in charts)
42 | var minDate = dateDim.bottom(1)[0]["date_posted"];
43 | var maxDate = dateDim.top(1)[0]["date_posted"];
44 |
45 | //Charts
46 | var timeChart = dc.barChart("#time-chart");
47 | var resourceTypeChart = dc.rowChart("#resource-type-row-chart");
48 | var povertyLevelChart = dc.rowChart("#poverty-level-row-chart");
49 | var usChart = dc.geoChoroplethChart("#us-chart");
50 | var numberProjectsND = dc.numberDisplay("#number-projects-nd");
51 | var totalDonationsND = dc.numberDisplay("#total-donations-nd");
52 |
53 | numberProjectsND
54 | .formatNumber(d3.format("d"))
55 | .valueAccessor(function(d){return d; })
56 | .group(all);
57 |
58 | totalDonationsND
59 | .formatNumber(d3.format("d"))
60 | .valueAccessor(function(d){return d; })
61 | .group(totalDonations)
62 | .formatNumber(d3.format(".3s"));
63 |
64 | timeChart
65 | .width(600)
66 | .height(160)
67 | .margins({top: 10, right: 50, bottom: 30, left: 50})
68 | .dimension(dateDim)
69 | .group(numProjectsByDate)
70 | .transitionDuration(500)
71 | .x(d3.time.scale().domain([minDate, maxDate]))
72 | .elasticY(true)
73 | .xAxisLabel("Year")
74 | .yAxis().ticks(4);
75 |
76 | resourceTypeChart
77 | .width(300)
78 | .height(250)
79 | .dimension(resourceTypeDim)
80 | .group(numProjectsByResourceType)
81 | .xAxis().ticks(4);
82 |
83 | povertyLevelChart
84 | .width(300)
85 | .height(250)
86 | .dimension(povertyLevelDim)
87 | .group(numProjectsByPovertyLevel)
88 | .xAxis().ticks(4);
89 |
90 |
91 | usChart.width(1000)
92 | .height(330)
93 | .dimension(stateDim)
94 | .group(totalDonationsByState)
95 | .colors(["#E2F2FF", "#C4E4FF", "#9ED2FF", "#81C5FF", "#6BBAFF", "#51AEFF", "#36A2FF", "#1E96FF", "#0089FF", "#0061B5"])
96 | .colorDomain([0, max_state])
97 | .overlayGeoJson(statesJson["features"], "state", function (d) {
98 | return d.properties.name;
99 | })
100 | .projection(d3.geo.albersUsa()
101 | .scale(600)
102 | .translate([340, 150]))
103 | .title(function (p) {
104 | return "State: " + p["key"]
105 | + "\n"
106 | + "Total Donations: " + Math.round(p["value"]) + " $";
107 | })
108 |
109 | dc.renderAll();
110 |
111 | };
--------------------------------------------------------------------------------
/static/lib/css/dc.css:
--------------------------------------------------------------------------------
1 | div.dc-chart {
2 | float: left;
3 | }
4 |
5 | .dc-chart rect.bar {
6 | stroke: none;
7 | cursor: pointer;
8 | }
9 |
10 | .dc-chart rect.bar:hover {
11 | fill-opacity: .5;
12 | }
13 |
14 | .dc-chart rect.stack1 {
15 | stroke: none;
16 | fill: red;
17 | }
18 |
19 | .dc-chart rect.stack2 {
20 | stroke: none;
21 | fill: green;
22 | }
23 |
24 | .dc-chart rect.deselected {
25 | stroke: none;
26 | fill: #ccc;
27 | }
28 |
29 | .dc-chart .pie-slice {
30 | fill: white;
31 | font-size: 12px;
32 | cursor: pointer;
33 | }
34 |
35 | .dc-chart .pie-slice :hover {
36 | fill-opacity: .8;
37 | }
38 |
39 | .dc-chart .selected path {
40 | stroke-width: 3;
41 | stroke: #ccc;
42 | fill-opacity: 1;
43 | }
44 |
45 | .dc-chart .deselected path {
46 | stroke: none;
47 | fill-opacity: .5;
48 | fill: #ccc;
49 | }
50 |
51 | .dc-chart .axis path, .axis line {
52 | fill: none;
53 | stroke: #000;
54 | shape-rendering: crispEdges;
55 | }
56 |
57 | .dc-chart .axis text {
58 | font: 10px sans-serif;
59 | }
60 |
61 | .dc-chart .grid-line {
62 | fill: none;
63 | stroke: #ccc;
64 | opacity: .5;
65 | shape-rendering: crispEdges;
66 | }
67 |
68 | .dc-chart .grid-line line {
69 | fill: none;
70 | stroke: #ccc;
71 | opacity: .5;
72 | shape-rendering: crispEdges;
73 | }
74 |
75 | .dc-chart .brush rect.background {
76 | z-index: -999;
77 | }
78 |
79 | .dc-chart .brush rect.extent {
80 | fill: steelblue;
81 | fill-opacity: .125;
82 | }
83 |
84 | .dc-chart .brush .resize path {
85 | fill: #eee;
86 | stroke: #666;
87 | }
88 |
89 | .dc-chart path.line {
90 | fill: none;
91 | stroke-width: 1.5px;
92 | }
93 |
94 | .dc-chart circle.dot {
95 | stroke: none;
96 | }
97 |
98 | .dc-chart g.dc-tooltip path {
99 | fill: none;
100 | stroke: grey;
101 | stroke-opacity: .8;
102 | }
103 |
104 | .dc-chart path.area {
105 | fill-opacity: .3;
106 | stroke: none;
107 | }
108 |
109 | .dc-chart .node {
110 | font-size: 0.7em;
111 | cursor: pointer;
112 | }
113 |
114 | .dc-chart .node :hover {
115 | fill-opacity: .8;
116 | }
117 |
118 | .dc-chart .selected circle {
119 | stroke-width: 3;
120 | stroke: #ccc;
121 | fill-opacity: 1;
122 | }
123 |
124 | .dc-chart .deselected circle {
125 | stroke: none;
126 | fill-opacity: .5;
127 | fill: #ccc;
128 | }
129 |
130 | .dc-chart .bubble {
131 | stroke: none;
132 | fill-opacity: 0.6;
133 | }
134 |
135 | .dc-data-count {
136 | float: right;
137 | margin-top: 15px;
138 | margin-right: 15px;
139 | }
140 |
141 | .dc-data-count .filter-count {
142 | color: #3182bd;
143 | font-weight: bold;
144 | }
145 |
146 | .dc-data-count .total-count {
147 | color: #3182bd;
148 | font-weight: bold;
149 | }
150 |
151 | .dc-data-table {
152 | }
153 |
154 | .dc-chart g.state {
155 | cursor: pointer;
156 | }
157 |
158 | .dc-chart g.state :hover {
159 | fill-opacity: .8;
160 | }
161 |
162 | .dc-chart g.state path {
163 | stroke: white;
164 | }
165 |
166 | .dc-chart g.selected path {
167 | }
168 |
169 | .dc-chart g.deselected path {
170 | fill: grey;
171 | }
172 |
173 | .dc-chart g.selected text {
174 | }
175 |
176 | .dc-chart g.deselected text {
177 | display: none;
178 | }
179 |
180 | .dc-chart g.county path {
181 | stroke: white;
182 | fill: none;
183 | }
184 |
185 | .dc-chart g.debug rect {
186 | fill: blue;
187 | fill-opacity: .2;
188 | }
189 |
190 | .dc-chart g.row rect {
191 | fill-opacity: 0.8;
192 | cursor: pointer;
193 | }
194 |
195 | .dc-chart g.row rect:hover {
196 | fill-opacity: 0.6;
197 | }
198 |
199 | .dc-chart g.row text {
200 | fill: white;
201 | font-size: 12px;
202 | cursor: pointer;
203 | }
204 |
205 | .dc-legend {
206 | font-size: 11px;
207 | }
208 |
209 | .dc-legend-item {
210 | cursor: pointer;
211 | }
212 |
213 | .dc-chart g.axis text {
214 | /* Makes it so the user can't accidentally click and select text that is meant as a label only */
215 | -webkit-user-select: none; /* Chrome/Safari */
216 | -moz-user-select: none; /* Firefox */
217 | -ms-user-select: none; /* IE10 */
218 | -o-user-select: none;
219 | user-select: none;
220 | pointer-events: none;
221 | }
222 |
223 | .dc-chart path.highlight {
224 | stroke-width: 3;
225 | fill-opacity: 1;
226 | stroke-opacity: 1;
227 | }
228 |
229 | .dc-chart .highlight {
230 | fill-opacity: 1;
231 | stroke-opacity: 1;
232 | }
233 |
234 | .dc-chart .fadeout {
235 | fill-opacity: 0.2;
236 | stroke-opacity: 0.2;
237 | }
238 |
239 | .dc-chart path.dc-symbol {
240 | fill-opacity: 0.5;
241 | stroke-opacity: 0.5;
242 | }
243 |
244 | .dc-hard .number-display {
245 | float: none;
246 | }
247 |
--------------------------------------------------------------------------------
/static/lib/css/keen-dashboards.css:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Full-page application style
4 | */
5 |
6 | body.application {
7 | background: #f2f2f2;
8 | padding: 60px 20px 0;
9 | }
10 | body.application > .container-fluid {
11 | padding-left: 0px;
12 | padding-right: 0px;
13 | }
14 | body.application div[class^="col-"] {
15 | padding-left: 5px;
16 | padding-right: 5px;
17 | }
18 | body.application div[class^="col-"] div[class^="col-"] {
19 | padding-left: 15px;
20 | padding-right: 15px;
21 | }
22 |
23 | body.application hr {
24 | border-color: #d7d7d7;
25 | margin: 10px 0;
26 | }
27 |
28 |
29 |
30 | .navbar-inverse {
31 | background-color: #3d4a57;
32 | border-color: #333;
33 | }
34 | .navbar-inverse .navbar-nav > li > a,
35 | .navbar a.navbar-brand {
36 | color: #fbfbfb;
37 | text-decoration: none;
38 | }
39 |
40 | .chart-wrapper {
41 | background: #fff;
42 | border: 1px solid #e2e2e2;
43 | border-radius: 3px;
44 | margin-bottom: 10px;
45 | }
46 | .chart-wrapper .chart-title {
47 | border-bottom: 1px solid #d7d7d7;
48 | color: #666;
49 | font-size: 14px;
50 | font-weight: 200;
51 | padding: 7px 10px 4px;
52 | }
53 |
54 | .chart-wrapper .chart-stage {
55 | /*min-height: 240px;*/
56 | overflow: hidden;
57 | padding: 5px 10px;
58 | position: relative;
59 | }
60 |
61 | .chart-wrapper .chart-notes {
62 | background: #fbfbfb;
63 | border-top: 1px solid #e2e2e2;
64 | color: #808080;
65 | font-size: 12px;
66 | padding: 8px 10px 5px;
67 | }
68 |
--------------------------------------------------------------------------------
/static/lib/js/bootstrap.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.2.0 (http://getbootstrap.com)
3 | * Copyright 2011-2014 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('
').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-kg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
--------------------------------------------------------------------------------
/static/lib/js/crossfilter.js:
--------------------------------------------------------------------------------
1 | (function(exports){
2 | crossfilter.version = "1.3.5";
3 | function crossfilter_identity(d) {
4 | return d;
5 | }
6 | crossfilter.permute = permute;
7 |
8 | function permute(array, index) {
9 | for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) {
10 | copy[i] = array[index[i]];
11 | }
12 | return copy;
13 | }
14 | var bisect = crossfilter.bisect = bisect_by(crossfilter_identity);
15 |
16 | bisect.by = bisect_by;
17 |
18 | function bisect_by(f) {
19 |
20 | // Locate the insertion point for x in a to maintain sorted order. The
21 | // arguments lo and hi may be used to specify a subset of the array which
22 | // should be considered; by default the entire array is used. If x is already
23 | // present in a, the insertion point will be before (to the left of) any
24 | // existing entries. The return value is suitable for use as the first
25 | // argument to `array.splice` assuming that a is already sorted.
26 | //
27 | // The returned insertion point i partitions the array a into two halves so
28 | // that all v < x for v in a[lo:i] for the left side and all v >= x for v in
29 | // a[i:hi] for the right side.
30 | function bisectLeft(a, x, lo, hi) {
31 | while (lo < hi) {
32 | var mid = lo + hi >>> 1;
33 | if (f(a[mid]) < x) lo = mid + 1;
34 | else hi = mid;
35 | }
36 | return lo;
37 | }
38 |
39 | // Similar to bisectLeft, but returns an insertion point which comes after (to
40 | // the right of) any existing entries of x in a.
41 | //
42 | // The returned insertion point i partitions the array into two halves so that
43 | // all v <= x for v in a[lo:i] for the left side and all v > x for v in
44 | // a[i:hi] for the right side.
45 | function bisectRight(a, x, lo, hi) {
46 | while (lo < hi) {
47 | var mid = lo + hi >>> 1;
48 | if (x < f(a[mid])) hi = mid;
49 | else lo = mid + 1;
50 | }
51 | return lo;
52 | }
53 |
54 | bisectRight.right = bisectRight;
55 | bisectRight.left = bisectLeft;
56 | return bisectRight;
57 | }
58 | var heap = crossfilter.heap = heap_by(crossfilter_identity);
59 |
60 | heap.by = heap_by;
61 |
62 | function heap_by(f) {
63 |
64 | // Builds a binary heap within the specified array a[lo:hi]. The heap has the
65 | // property such that the parent a[lo+i] is always less than or equal to its
66 | // two children: a[lo+2*i+1] and a[lo+2*i+2].
67 | function heap(a, lo, hi) {
68 | var n = hi - lo,
69 | i = (n >>> 1) + 1;
70 | while (--i > 0) sift(a, i, n, lo);
71 | return a;
72 | }
73 |
74 | // Sorts the specified array a[lo:hi] in descending order, assuming it is
75 | // already a heap.
76 | function sort(a, lo, hi) {
77 | var n = hi - lo,
78 | t;
79 | while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);
80 | return a;
81 | }
82 |
83 | // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous
84 | // slice of array a[lo:lo+n]. This method can also be used to update the heap
85 | // incrementally, without incurring the full cost of reconstructing the heap.
86 | function sift(a, i, n, lo) {
87 | var d = a[--lo + i],
88 | x = f(d),
89 | child;
90 | while ((child = i << 1) <= n) {
91 | if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;
92 | if (x <= f(a[lo + child])) break;
93 | a[lo + i] = a[lo + child];
94 | i = child;
95 | }
96 | a[lo + i] = d;
97 | }
98 |
99 | heap.sort = sort;
100 | return heap;
101 | }
102 | var heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity);
103 |
104 | heapselect.by = heapselect_by;
105 |
106 | function heapselect_by(f) {
107 | var heap = heap_by(f);
108 |
109 | // Returns a new array containing the top k elements in the array a[lo:hi].
110 | // The returned array is not sorted, but maintains the heap property. If k is
111 | // greater than hi - lo, then fewer than k elements will be returned. The
112 | // order of elements in a is unchanged by this operation.
113 | function heapselect(a, lo, hi, k) {
114 | var queue = new Array(k = Math.min(hi - lo, k)),
115 | min,
116 | i,
117 | x,
118 | d;
119 |
120 | for (i = 0; i < k; ++i) queue[i] = a[lo++];
121 | heap(queue, 0, k);
122 |
123 | if (lo < hi) {
124 | min = f(queue[0]);
125 | do {
126 | if (x = f(d = a[lo]) > min) {
127 | queue[0] = d;
128 | min = f(heap(queue, 0, k)[0]);
129 | }
130 | } while (++lo < hi);
131 | }
132 |
133 | return queue;
134 | }
135 |
136 | return heapselect;
137 | }
138 | var insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity);
139 |
140 | insertionsort.by = insertionsort_by;
141 |
142 | function insertionsort_by(f) {
143 |
144 | function insertionsort(a, lo, hi) {
145 | for (var i = lo + 1; i < hi; ++i) {
146 | for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) {
147 | a[j] = a[j - 1];
148 | }
149 | a[j] = t;
150 | }
151 | return a;
152 | }
153 |
154 | return insertionsort;
155 | }
156 | // Algorithm designed by Vladimir Yaroslavskiy.
157 | // Implementation based on the Dart project; see lib/dart/LICENSE for details.
158 |
159 | var quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity);
160 |
161 | quicksort.by = quicksort_by;
162 |
163 | function quicksort_by(f) {
164 | var insertionsort = insertionsort_by(f);
165 |
166 | function sort(a, lo, hi) {
167 | return (hi - lo < quicksort_sizeThreshold
168 | ? insertionsort
169 | : quicksort)(a, lo, hi);
170 | }
171 |
172 | function quicksort(a, lo, hi) {
173 | // Compute the two pivots by looking at 5 elements.
174 | var sixth = (hi - lo) / 6 | 0,
175 | i1 = lo + sixth,
176 | i5 = hi - 1 - sixth,
177 | i3 = lo + hi - 1 >> 1, // The midpoint.
178 | i2 = i3 - sixth,
179 | i4 = i3 + sixth;
180 |
181 | var e1 = a[i1], x1 = f(e1),
182 | e2 = a[i2], x2 = f(e2),
183 | e3 = a[i3], x3 = f(e3),
184 | e4 = a[i4], x4 = f(e4),
185 | e5 = a[i5], x5 = f(e5);
186 |
187 | var t;
188 |
189 | // Sort the selected 5 elements using a sorting network.
190 | if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t;
191 | if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
192 | if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t;
193 | if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
194 | if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t;
195 | if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t;
196 | if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t;
197 | if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
198 | if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
199 |
200 | var pivot1 = e2, pivotValue1 = x2,
201 | pivot2 = e4, pivotValue2 = x4;
202 |
203 | // e2 and e4 have been saved in the pivot variables. They will be written
204 | // back, once the partitioning is finished.
205 | a[i1] = e1;
206 | a[i2] = a[lo];
207 | a[i3] = e3;
208 | a[i4] = a[hi - 1];
209 | a[i5] = e5;
210 |
211 | var less = lo + 1, // First element in the middle partition.
212 | great = hi - 2; // Last element in the middle partition.
213 |
214 | // Note that for value comparison, <, <=, >= and > coerce to a primitive via
215 | // Object.prototype.valueOf; == and === do not, so in order to be consistent
216 | // with natural order (such as for Date objects), we must do two compares.
217 | var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2;
218 | if (pivotsEqual) {
219 |
220 | // Degenerated case where the partitioning becomes a dutch national flag
221 | // problem.
222 | //
223 | // [ | < pivot | == pivot | unpartitioned | > pivot | ]
224 | // ^ ^ ^ ^ ^
225 | // left less k great right
226 | //
227 | // a[left] and a[right] are undefined and are filled after the
228 | // partitioning.
229 | //
230 | // Invariants:
231 | // 1) for x in ]left, less[ : x < pivot.
232 | // 2) for x in [less, k[ : x == pivot.
233 | // 3) for x in ]great, right[ : x > pivot.
234 | for (var k = less; k <= great; ++k) {
235 | var ek = a[k], xk = f(ek);
236 | if (xk < pivotValue1) {
237 | if (k !== less) {
238 | a[k] = a[less];
239 | a[less] = ek;
240 | }
241 | ++less;
242 | } else if (xk > pivotValue1) {
243 |
244 | // Find the first element <= pivot in the range [k - 1, great] and
245 | // put [:ek:] there. We know that such an element must exist:
246 | // When k == less, then el3 (which is equal to pivot) lies in the
247 | // interval. Otherwise a[k - 1] == pivot and the search stops at k-1.
248 | // Note that in the latter case invariant 2 will be violated for a
249 | // short amount of time. The invariant will be restored when the
250 | // pivots are put into their final positions.
251 | while (true) {
252 | var greatValue = f(a[great]);
253 | if (greatValue > pivotValue1) {
254 | great--;
255 | // This is the only location in the while-loop where a new
256 | // iteration is started.
257 | continue;
258 | } else if (greatValue < pivotValue1) {
259 | // Triple exchange.
260 | a[k] = a[less];
261 | a[less++] = a[great];
262 | a[great--] = ek;
263 | break;
264 | } else {
265 | a[k] = a[great];
266 | a[great--] = ek;
267 | // Note: if great < k then we will exit the outer loop and fix
268 | // invariant 2 (which we just violated).
269 | break;
270 | }
271 | }
272 | }
273 | }
274 | } else {
275 |
276 | // We partition the list into three parts:
277 | // 1. < pivot1
278 | // 2. >= pivot1 && <= pivot2
279 | // 3. > pivot2
280 | //
281 | // During the loop we have:
282 | // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ]
283 | // ^ ^ ^ ^ ^
284 | // left less k great right
285 | //
286 | // a[left] and a[right] are undefined and are filled after the
287 | // partitioning.
288 | //
289 | // Invariants:
290 | // 1. for x in ]left, less[ : x < pivot1
291 | // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2
292 | // 3. for x in ]great, right[ : x > pivot2
293 | for (var k = less; k <= great; k++) {
294 | var ek = a[k], xk = f(ek);
295 | if (xk < pivotValue1) {
296 | if (k !== less) {
297 | a[k] = a[less];
298 | a[less] = ek;
299 | }
300 | ++less;
301 | } else {
302 | if (xk > pivotValue2) {
303 | while (true) {
304 | var greatValue = f(a[great]);
305 | if (greatValue > pivotValue2) {
306 | great--;
307 | if (great < k) break;
308 | // This is the only location inside the loop where a new
309 | // iteration is started.
310 | continue;
311 | } else {
312 | // a[great] <= pivot2.
313 | if (greatValue < pivotValue1) {
314 | // Triple exchange.
315 | a[k] = a[less];
316 | a[less++] = a[great];
317 | a[great--] = ek;
318 | } else {
319 | // a[great] >= pivot1.
320 | a[k] = a[great];
321 | a[great--] = ek;
322 | }
323 | break;
324 | }
325 | }
326 | }
327 | }
328 | }
329 | }
330 |
331 | // Move pivots into their final positions.
332 | // We shrunk the list from both sides (a[left] and a[right] have
333 | // meaningless values in them) and now we move elements from the first
334 | // and third partition into these locations so that we can store the
335 | // pivots.
336 | a[lo] = a[less - 1];
337 | a[less - 1] = pivot1;
338 | a[hi - 1] = a[great + 1];
339 | a[great + 1] = pivot2;
340 |
341 | // The list is now partitioned into three partitions:
342 | // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ]
343 | // ^ ^ ^ ^
344 | // left less great right
345 |
346 | // Recursive descent. (Don't include the pivot values.)
347 | sort(a, lo, less - 1);
348 | sort(a, great + 2, hi);
349 |
350 | if (pivotsEqual) {
351 | // All elements in the second partition are equal to the pivot. No
352 | // need to sort them.
353 | return a;
354 | }
355 |
356 | // In theory it should be enough to call _doSort recursively on the second
357 | // partition.
358 | // The Android source however removes the pivot elements from the recursive
359 | // call if the second partition is too large (more than 2/3 of the list).
360 | if (less < i1 && great > i5) {
361 | var lessValue, greatValue;
362 | while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less;
363 | while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great;
364 |
365 | // Copy paste of the previous 3-way partitioning with adaptions.
366 | //
367 | // We partition the list into three parts:
368 | // 1. == pivot1
369 | // 2. > pivot1 && < pivot2
370 | // 3. == pivot2
371 | //
372 | // During the loop we have:
373 | // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ]
374 | // ^ ^ ^
375 | // less k great
376 | //
377 | // Invariants:
378 | // 1. for x in [ *, less[ : x == pivot1
379 | // 2. for x in [less, k[ : pivot1 < x && x < pivot2
380 | // 3. for x in ]great, * ] : x == pivot2
381 | for (var k = less; k <= great; k++) {
382 | var ek = a[k], xk = f(ek);
383 | if (xk <= pivotValue1 && xk >= pivotValue1) {
384 | if (k !== less) {
385 | a[k] = a[less];
386 | a[less] = ek;
387 | }
388 | less++;
389 | } else {
390 | if (xk <= pivotValue2 && xk >= pivotValue2) {
391 | while (true) {
392 | var greatValue = f(a[great]);
393 | if (greatValue <= pivotValue2 && greatValue >= pivotValue2) {
394 | great--;
395 | if (great < k) break;
396 | // This is the only location inside the loop where a new
397 | // iteration is started.
398 | continue;
399 | } else {
400 | // a[great] < pivot2.
401 | if (greatValue < pivotValue1) {
402 | // Triple exchange.
403 | a[k] = a[less];
404 | a[less++] = a[great];
405 | a[great--] = ek;
406 | } else {
407 | // a[great] == pivot1.
408 | a[k] = a[great];
409 | a[great--] = ek;
410 | }
411 | break;
412 | }
413 | }
414 | }
415 | }
416 | }
417 | }
418 |
419 | // The second partition has now been cleared of pivot elements and looks
420 | // as follows:
421 | // [ * | > pivot1 && < pivot2 | * ]
422 | // ^ ^
423 | // less great
424 | // Sort the second partition using recursive descent.
425 |
426 | // The second partition looks as follows:
427 | // [ * | >= pivot1 && <= pivot2 | * ]
428 | // ^ ^
429 | // less great
430 | // Simply sort it by recursive descent.
431 |
432 | return sort(a, less, great + 1);
433 | }
434 |
435 | return sort;
436 | }
437 |
438 | var quicksort_sizeThreshold = 32;
439 | var crossfilter_array8 = crossfilter_arrayUntyped,
440 | crossfilter_array16 = crossfilter_arrayUntyped,
441 | crossfilter_array32 = crossfilter_arrayUntyped,
442 | crossfilter_arrayLengthen = crossfilter_identity,
443 | crossfilter_arrayWiden = crossfilter_identity;
444 |
445 | if (typeof Uint8Array !== "undefined") {
446 | crossfilter_array8 = function(n) { return new Uint8Array(n); };
447 | crossfilter_array16 = function(n) { return new Uint16Array(n); };
448 | crossfilter_array32 = function(n) { return new Uint32Array(n); };
449 |
450 | crossfilter_arrayLengthen = function(array, length) {
451 | if (array.length >= length) return array;
452 | var copy = new array.constructor(length);
453 | copy.set(array);
454 | return copy;
455 | };
456 |
457 | crossfilter_arrayWiden = function(array, width) {
458 | var copy;
459 | switch (width) {
460 | case 16: copy = crossfilter_array16(array.length); break;
461 | case 32: copy = crossfilter_array32(array.length); break;
462 | default: throw new Error("invalid array width!");
463 | }
464 | copy.set(array);
465 | return copy;
466 | };
467 | }
468 |
469 | function crossfilter_arrayUntyped(n) {
470 | return new Array(n);
471 | }
472 | function crossfilter_filterExact(bisect, value) {
473 | return function(values) {
474 | var n = values.length;
475 | return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];
476 | };
477 | }
478 |
479 | function crossfilter_filterRange(bisect, range) {
480 | var min = range[0],
481 | max = range[1];
482 | return function(values) {
483 | var n = values.length;
484 | return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];
485 | };
486 | }
487 |
488 | function crossfilter_filterAll(values) {
489 | return [0, values.length];
490 | }
491 | function crossfilter_null() {
492 | return null;
493 | }
494 | function crossfilter_zero() {
495 | return 0;
496 | }
497 | function crossfilter_reduceIncrement(p) {
498 | return p + 1;
499 | }
500 |
501 | function crossfilter_reduceDecrement(p) {
502 | return p - 1;
503 | }
504 |
505 | function crossfilter_reduceAdd(f) {
506 | return function(p, v) {
507 | return p + +f(v);
508 | };
509 | }
510 |
511 | function crossfilter_reduceSubtract(f) {
512 | return function(p, v) {
513 | return p - f(v);
514 | };
515 | }
516 | exports.crossfilter = crossfilter;
517 |
518 | function crossfilter() {
519 | var crossfilter = {
520 | add: add,
521 | remove: removeData,
522 | dimension: dimension,
523 | groupAll: groupAll,
524 | size: size
525 | };
526 |
527 | var data = [], // the records
528 | n = 0, // the number of records; data.length
529 | m = 0, // a bit mask representing which dimensions are in use
530 | M = 8, // number of dimensions that can fit in `filters`
531 | filters = crossfilter_array8(0), // M bits per record; 1 is filtered out
532 | filterListeners = [], // when the filters change
533 | dataListeners = [], // when data is added
534 | removeDataListeners = []; // when data is removed
535 |
536 | // Adds the specified new records to this crossfilter.
537 | function add(newData) {
538 | var n0 = n,
539 | n1 = newData.length;
540 |
541 | // If there's actually new data to add…
542 | // Merge the new data into the existing data.
543 | // Lengthen the filter bitset to handle the new records.
544 | // Notify listeners (dimensions and groups) that new data is available.
545 | if (n1) {
546 | data = data.concat(newData);
547 | filters = crossfilter_arrayLengthen(filters, n += n1);
548 | dataListeners.forEach(function(l) { l(newData, n0, n1); });
549 | }
550 |
551 | return crossfilter;
552 | }
553 |
554 | // Removes all records that match the current filters.
555 | function removeData() {
556 | var newIndex = crossfilter_index(n, n),
557 | removed = [];
558 | for (var i = 0, j = 0; i < n; ++i) {
559 | if (filters[i]) newIndex[i] = j++;
560 | else removed.push(i);
561 | }
562 |
563 | // Remove all matching records from groups.
564 | filterListeners.forEach(function(l) { l(0, [], removed); });
565 |
566 | // Update indexes.
567 | removeDataListeners.forEach(function(l) { l(newIndex); });
568 |
569 | // Remove old filters and data by overwriting.
570 | for (var i = 0, j = 0, k; i < n; ++i) {
571 | if (k = filters[i]) {
572 | if (i !== j) filters[j] = k, data[j] = data[i];
573 | ++j;
574 | }
575 | }
576 | data.length = j;
577 | while (n > j) filters[--n] = 0;
578 | }
579 |
580 | // Adds a new dimension with the specified value accessor function.
581 | function dimension(value) {
582 | var dimension = {
583 | filter: filter,
584 | filterExact: filterExact,
585 | filterRange: filterRange,
586 | filterFunction: filterFunction,
587 | filterAll: filterAll,
588 | top: top,
589 | bottom: bottom,
590 | group: group,
591 | groupAll: groupAll,
592 | dispose: dispose,
593 | remove: dispose // for backwards-compatibility
594 | };
595 |
596 | var one = ~m & -~m, // lowest unset bit as mask, e.g., 00001000
597 | zero = ~one, // inverted one, e.g., 11110111
598 | values, // sorted, cached array
599 | index, // value rank ↦ object id
600 | newValues, // temporary array storing newly-added values
601 | newIndex, // temporary array storing newly-added index
602 | sort = quicksort_by(function(i) { return newValues[i]; }),
603 | refilter = crossfilter_filterAll, // for recomputing filter
604 | refilterFunction, // the custom filter function in use
605 | indexListeners = [], // when data is added
606 | dimensionGroups = [],
607 | lo0 = 0,
608 | hi0 = 0;
609 |
610 | // Updating a dimension is a two-stage process. First, we must update the
611 | // associated filters for the newly-added records. Once all dimensions have
612 | // updated their filters, the groups are notified to update.
613 | dataListeners.unshift(preAdd);
614 | dataListeners.push(postAdd);
615 |
616 | removeDataListeners.push(removeData);
617 |
618 | // Incorporate any existing data into this dimension, and make sure that the
619 | // filter bitset is wide enough to handle the new dimension.
620 | m |= one;
621 | if (M >= 32 ? !one : m & (1 << M) - 1) {
622 | filters = crossfilter_arrayWiden(filters, M <<= 1);
623 | }
624 | preAdd(data, 0, n);
625 | postAdd(data, 0, n);
626 |
627 | // Incorporates the specified new records into this dimension.
628 | // This function is responsible for updating filters, values, and index.
629 | function preAdd(newData, n0, n1) {
630 |
631 | // Permute new values into natural order using a sorted index.
632 | newValues = newData.map(value);
633 | newIndex = sort(crossfilter_range(n1), 0, n1);
634 | newValues = permute(newValues, newIndex);
635 |
636 | // Bisect newValues to determine which new records are selected.
637 | var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;
638 | if (refilterFunction) {
639 | for (i = 0; i < n1; ++i) {
640 | if (!refilterFunction(newValues[i], i)) filters[newIndex[i] + n0] |= one;
641 | }
642 | } else {
643 | for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;
644 | for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;
645 | }
646 |
647 | // If this dimension previously had no data, then we don't need to do the
648 | // more expensive merge operation; use the new values and index as-is.
649 | if (!n0) {
650 | values = newValues;
651 | index = newIndex;
652 | lo0 = lo1;
653 | hi0 = hi1;
654 | return;
655 | }
656 |
657 | var oldValues = values,
658 | oldIndex = index,
659 | i0 = 0,
660 | i1 = 0;
661 |
662 | // Otherwise, create new arrays into which to merge new and old.
663 | values = new Array(n);
664 | index = crossfilter_index(n, n);
665 |
666 | // Merge the old and new sorted values, and old and new index.
667 | for (i = 0; i0 < n0 && i1 < n1; ++i) {
668 | if (oldValues[i0] < newValues[i1]) {
669 | values[i] = oldValues[i0];
670 | index[i] = oldIndex[i0++];
671 | } else {
672 | values[i] = newValues[i1];
673 | index[i] = newIndex[i1++] + n0;
674 | }
675 | }
676 |
677 | // Add any remaining old values.
678 | for (; i0 < n0; ++i0, ++i) {
679 | values[i] = oldValues[i0];
680 | index[i] = oldIndex[i0];
681 | }
682 |
683 | // Add any remaining new values.
684 | for (; i1 < n1; ++i1, ++i) {
685 | values[i] = newValues[i1];
686 | index[i] = newIndex[i1] + n0;
687 | }
688 |
689 | // Bisect again to recompute lo0 and hi0.
690 | bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];
691 | }
692 |
693 | // When all filters have updated, notify index listeners of the new values.
694 | function postAdd(newData, n0, n1) {
695 | indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });
696 | newValues = newIndex = null;
697 | }
698 |
699 | function removeData(reIndex) {
700 | for (var i = 0, j = 0, k; i < n; ++i) {
701 | if (filters[k = index[i]]) {
702 | if (i !== j) values[j] = values[i];
703 | index[j] = reIndex[k];
704 | ++j;
705 | }
706 | }
707 | values.length = j;
708 | while (j < n) index[j++] = 0;
709 |
710 | // Bisect again to recompute lo0 and hi0.
711 | var bounds = refilter(values);
712 | lo0 = bounds[0], hi0 = bounds[1];
713 | }
714 |
715 | // Updates the selected values based on the specified bounds [lo, hi].
716 | // This implementation is used by all the public filter methods.
717 | function filterIndexBounds(bounds) {
718 | var lo1 = bounds[0],
719 | hi1 = bounds[1];
720 |
721 | if (refilterFunction) {
722 | refilterFunction = null;
723 | filterIndexFunction(function(d, i) { return lo1 <= i && i < hi1; });
724 | lo0 = lo1;
725 | hi0 = hi1;
726 | return dimension;
727 | }
728 |
729 | var i,
730 | j,
731 | k,
732 | added = [],
733 | removed = [];
734 |
735 | // Fast incremental update based on previous lo index.
736 | if (lo1 < lo0) {
737 | for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
738 | filters[k = index[i]] ^= one;
739 | added.push(k);
740 | }
741 | } else if (lo1 > lo0) {
742 | for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
743 | filters[k = index[i]] ^= one;
744 | removed.push(k);
745 | }
746 | }
747 |
748 | // Fast incremental update based on previous hi index.
749 | if (hi1 > hi0) {
750 | for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
751 | filters[k = index[i]] ^= one;
752 | added.push(k);
753 | }
754 | } else if (hi1 < hi0) {
755 | for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
756 | filters[k = index[i]] ^= one;
757 | removed.push(k);
758 | }
759 | }
760 |
761 | lo0 = lo1;
762 | hi0 = hi1;
763 | filterListeners.forEach(function(l) { l(one, added, removed); });
764 | return dimension;
765 | }
766 |
767 | // Filters this dimension using the specified range, value, or null.
768 | // If the range is null, this is equivalent to filterAll.
769 | // If the range is an array, this is equivalent to filterRange.
770 | // Otherwise, this is equivalent to filterExact.
771 | function filter(range) {
772 | return range == null
773 | ? filterAll() : Array.isArray(range)
774 | ? filterRange(range) : typeof range === "function"
775 | ? filterFunction(range)
776 | : filterExact(range);
777 | }
778 |
779 | // Filters this dimension to select the exact value.
780 | function filterExact(value) {
781 | return filterIndexBounds((refilter = crossfilter_filterExact(bisect, value))(values));
782 | }
783 |
784 | // Filters this dimension to select the specified range [lo, hi].
785 | // The lower bound is inclusive, and the upper bound is exclusive.
786 | function filterRange(range) {
787 | return filterIndexBounds((refilter = crossfilter_filterRange(bisect, range))(values));
788 | }
789 |
790 | // Clears any filters on this dimension.
791 | function filterAll() {
792 | return filterIndexBounds((refilter = crossfilter_filterAll)(values));
793 | }
794 |
795 | // Filters this dimension using an arbitrary function.
796 | function filterFunction(f) {
797 | refilter = crossfilter_filterAll;
798 |
799 | filterIndexFunction(refilterFunction = f);
800 |
801 | lo0 = 0;
802 | hi0 = n;
803 |
804 | return dimension;
805 | }
806 |
807 | function filterIndexFunction(f) {
808 | var i,
809 | k,
810 | x,
811 | added = [],
812 | removed = [];
813 |
814 | for (i = 0; i < n; ++i) {
815 | if (!(filters[k = index[i]] & one) ^ (x = f(values[i], i))) {
816 | if (x) filters[k] &= zero, added.push(k);
817 | else filters[k] |= one, removed.push(k);
818 | }
819 | }
820 | filterListeners.forEach(function(l) { l(one, added, removed); });
821 | }
822 |
823 | // Returns the top K selected records based on this dimension's order.
824 | // Note: observes this dimension's filter, unlike group and groupAll.
825 | function top(k) {
826 | var array = [],
827 | i = hi0,
828 | j;
829 |
830 | while (--i >= lo0 && k > 0) {
831 | if (!filters[j = index[i]]) {
832 | array.push(data[j]);
833 | --k;
834 | }
835 | }
836 |
837 | return array;
838 | }
839 |
840 | // Returns the bottom K selected records based on this dimension's order.
841 | // Note: observes this dimension's filter, unlike group and groupAll.
842 | function bottom(k) {
843 | var array = [],
844 | i = lo0,
845 | j;
846 |
847 | while (i < hi0 && k > 0) {
848 | if (!filters[j = index[i]]) {
849 | array.push(data[j]);
850 | --k;
851 | }
852 | i++;
853 | }
854 |
855 | return array;
856 | }
857 |
858 | // Adds a new group to this dimension, using the specified key function.
859 | function group(key) {
860 | var group = {
861 | top: top,
862 | all: all,
863 | reduce: reduce,
864 | reduceCount: reduceCount,
865 | reduceSum: reduceSum,
866 | order: order,
867 | orderNatural: orderNatural,
868 | size: size,
869 | dispose: dispose,
870 | remove: dispose // for backwards-compatibility
871 | };
872 |
873 | // Ensure that this group will be removed when the dimension is removed.
874 | dimensionGroups.push(group);
875 |
876 | var groups, // array of {key, value}
877 | groupIndex, // object id ↦ group id
878 | groupWidth = 8,
879 | groupCapacity = crossfilter_capacity(groupWidth),
880 | k = 0, // cardinality
881 | select,
882 | heap,
883 | reduceAdd,
884 | reduceRemove,
885 | reduceInitial,
886 | update = crossfilter_null,
887 | reset = crossfilter_null,
888 | resetNeeded = true;
889 |
890 | if (arguments.length < 1) key = crossfilter_identity;
891 |
892 | // The group listens to the crossfilter for when any dimension changes, so
893 | // that it can update the associated reduce values. It must also listen to
894 | // the parent dimension for when data is added, and compute new keys.
895 | filterListeners.push(update);
896 | indexListeners.push(add);
897 | removeDataListeners.push(removeData);
898 |
899 | // Incorporate any existing data into the grouping.
900 | add(values, index, 0, n);
901 |
902 | // Incorporates the specified new values into this group.
903 | // This function is responsible for updating groups and groupIndex.
904 | function add(newValues, newIndex, n0, n1) {
905 | var oldGroups = groups,
906 | reIndex = crossfilter_index(k, groupCapacity),
907 | add = reduceAdd,
908 | initial = reduceInitial,
909 | k0 = k, // old cardinality
910 | i0 = 0, // index of old group
911 | i1 = 0, // index of new record
912 | j, // object id
913 | g0, // old group
914 | x0, // old key
915 | x1, // new key
916 | g, // group to add
917 | x; // key of group to add
918 |
919 | // If a reset is needed, we don't need to update the reduce values.
920 | if (resetNeeded) add = initial = crossfilter_null;
921 |
922 | // Reset the new groups (k is a lower bound).
923 | // Also, make sure that groupIndex exists and is long enough.
924 | groups = new Array(k), k = 0;
925 | groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);
926 |
927 | // Get the first old key (x0 of g0), if it exists.
928 | if (k0) x0 = (g0 = oldGroups[0]).key;
929 |
930 | // Find the first new key (x1), skipping NaN keys.
931 | while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;
932 |
933 | // While new keys remain…
934 | while (i1 < n1) {
935 |
936 | // Determine the lesser of the two current keys; new and old.
937 | // If there are no old keys remaining, then always add the new key.
938 | if (g0 && x0 <= x1) {
939 | g = g0, x = x0;
940 |
941 | // Record the new index of the old group.
942 | reIndex[i0] = k;
943 |
944 | // Retrieve the next old key.
945 | if (g0 = oldGroups[++i0]) x0 = g0.key;
946 | } else {
947 | g = {key: x1, value: initial()}, x = x1;
948 | }
949 |
950 | // Add the lesser group.
951 | groups[k] = g;
952 |
953 | // Add any selected records belonging to the added group, while
954 | // advancing the new key and populating the associated group index.
955 | while (!(x1 > x)) {
956 | groupIndex[j = newIndex[i1] + n0] = k;
957 | if (!(filters[j] & zero)) g.value = add(g.value, data[j]);
958 | if (++i1 >= n1) break;
959 | x1 = key(newValues[i1]);
960 | }
961 |
962 | groupIncrement();
963 | }
964 |
965 | // Add any remaining old groups that were greater than all new keys.
966 | // No incremental reduce is needed; these groups have no new records.
967 | // Also record the new index of the old group.
968 | while (i0 < k0) {
969 | groups[reIndex[i0] = k] = oldGroups[i0++];
970 | groupIncrement();
971 | }
972 |
973 | // If we added any new groups before any old groups,
974 | // update the group index of all the old records.
975 | if (k > i0) for (i0 = 0; i0 < n0; ++i0) {
976 | groupIndex[i0] = reIndex[groupIndex[i0]];
977 | }
978 |
979 | // Modify the update and reset behavior based on the cardinality.
980 | // If the cardinality is less than or equal to one, then the groupIndex
981 | // is not needed. If the cardinality is zero, then there are no records
982 | // and therefore no groups to update or reset. Note that we also must
983 | // change the registered listener to point to the new method.
984 | j = filterListeners.indexOf(update);
985 | if (k > 1) {
986 | update = updateMany;
987 | reset = resetMany;
988 | } else {
989 | if (k === 1) {
990 | update = updateOne;
991 | reset = resetOne;
992 | } else {
993 | update = crossfilter_null;
994 | reset = crossfilter_null;
995 | }
996 | groupIndex = null;
997 | }
998 | filterListeners[j] = update;
999 |
1000 | // Count the number of added groups,
1001 | // and widen the group index as needed.
1002 | function groupIncrement() {
1003 | if (++k === groupCapacity) {
1004 | reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);
1005 | groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);
1006 | groupCapacity = crossfilter_capacity(groupWidth);
1007 | }
1008 | }
1009 | }
1010 |
1011 | function removeData() {
1012 | if (k > 1) {
1013 | var oldK = k,
1014 | oldGroups = groups,
1015 | seenGroups = crossfilter_index(oldK, oldK);
1016 |
1017 | // Filter out non-matches by copying matching group index entries to
1018 | // the beginning of the array.
1019 | for (var i = 0, j = 0; i < n; ++i) {
1020 | if (filters[i]) {
1021 | seenGroups[groupIndex[j] = groupIndex[i]] = 1;
1022 | ++j;
1023 | }
1024 | }
1025 |
1026 | // Reassemble groups including only those groups that were referred
1027 | // to by matching group index entries. Note the new group index in
1028 | // seenGroups.
1029 | groups = [], k = 0;
1030 | for (i = 0; i < oldK; ++i) {
1031 | if (seenGroups[i]) {
1032 | seenGroups[i] = k++;
1033 | groups.push(oldGroups[i]);
1034 | }
1035 | }
1036 |
1037 | if (k > 1) {
1038 | // Reindex the group index using seenGroups to find the new index.
1039 | for (var i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];
1040 | } else {
1041 | groupIndex = null;
1042 | }
1043 | filterListeners[filterListeners.indexOf(update)] = k > 1
1044 | ? (reset = resetMany, update = updateMany)
1045 | : k === 1 ? (reset = resetOne, update = updateOne)
1046 | : reset = update = crossfilter_null;
1047 | } else if (k === 1) {
1048 | for (var i = 0; i < n; ++i) if (filters[i]) return;
1049 | groups = [], k = 0;
1050 | filterListeners[filterListeners.indexOf(update)] =
1051 | update = reset = crossfilter_null;
1052 | }
1053 | }
1054 |
1055 | // Reduces the specified selected or deselected records.
1056 | // This function is only used when the cardinality is greater than 1.
1057 | function updateMany(filterOne, added, removed) {
1058 | if (filterOne === one || resetNeeded) return;
1059 |
1060 | var i,
1061 | k,
1062 | n,
1063 | g;
1064 |
1065 | // Add the added values.
1066 | for (i = 0, n = added.length; i < n; ++i) {
1067 | if (!(filters[k = added[i]] & zero)) {
1068 | g = groups[groupIndex[k]];
1069 | g.value = reduceAdd(g.value, data[k]);
1070 | }
1071 | }
1072 |
1073 | // Remove the removed values.
1074 | for (i = 0, n = removed.length; i < n; ++i) {
1075 | if ((filters[k = removed[i]] & zero) === filterOne) {
1076 | g = groups[groupIndex[k]];
1077 | g.value = reduceRemove(g.value, data[k]);
1078 | }
1079 | }
1080 | }
1081 |
1082 | // Reduces the specified selected or deselected records.
1083 | // This function is only used when the cardinality is 1.
1084 | function updateOne(filterOne, added, removed) {
1085 | if (filterOne === one || resetNeeded) return;
1086 |
1087 | var i,
1088 | k,
1089 | n,
1090 | g = groups[0];
1091 |
1092 | // Add the added values.
1093 | for (i = 0, n = added.length; i < n; ++i) {
1094 | if (!(filters[k = added[i]] & zero)) {
1095 | g.value = reduceAdd(g.value, data[k]);
1096 | }
1097 | }
1098 |
1099 | // Remove the removed values.
1100 | for (i = 0, n = removed.length; i < n; ++i) {
1101 | if ((filters[k = removed[i]] & zero) === filterOne) {
1102 | g.value = reduceRemove(g.value, data[k]);
1103 | }
1104 | }
1105 | }
1106 |
1107 | // Recomputes the group reduce values from scratch.
1108 | // This function is only used when the cardinality is greater than 1.
1109 | function resetMany() {
1110 | var i,
1111 | g;
1112 |
1113 | // Reset all group values.
1114 | for (i = 0; i < k; ++i) {
1115 | groups[i].value = reduceInitial();
1116 | }
1117 |
1118 | // Add any selected records.
1119 | for (i = 0; i < n; ++i) {
1120 | if (!(filters[i] & zero)) {
1121 | g = groups[groupIndex[i]];
1122 | g.value = reduceAdd(g.value, data[i]);
1123 | }
1124 | }
1125 | }
1126 |
1127 | // Recomputes the group reduce values from scratch.
1128 | // This function is only used when the cardinality is 1.
1129 | function resetOne() {
1130 | var i,
1131 | g = groups[0];
1132 |
1133 | // Reset the singleton group values.
1134 | g.value = reduceInitial();
1135 |
1136 | // Add any selected records.
1137 | for (i = 0; i < n; ++i) {
1138 | if (!(filters[i] & zero)) {
1139 | g.value = reduceAdd(g.value, data[i]);
1140 | }
1141 | }
1142 | }
1143 |
1144 | // Returns the array of group values, in the dimension's natural order.
1145 | function all() {
1146 | if (resetNeeded) reset(), resetNeeded = false;
1147 | return groups;
1148 | }
1149 |
1150 | // Returns a new array containing the top K group values, in reduce order.
1151 | function top(k) {
1152 | var top = select(all(), 0, groups.length, k);
1153 | return heap.sort(top, 0, top.length);
1154 | }
1155 |
1156 | // Sets the reduce behavior for this group to use the specified functions.
1157 | // This method lazily recomputes the reduce values, waiting until needed.
1158 | function reduce(add, remove, initial) {
1159 | reduceAdd = add;
1160 | reduceRemove = remove;
1161 | reduceInitial = initial;
1162 | resetNeeded = true;
1163 | return group;
1164 | }
1165 |
1166 | // A convenience method for reducing by count.
1167 | function reduceCount() {
1168 | return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
1169 | }
1170 |
1171 | // A convenience method for reducing by sum(value).
1172 | function reduceSum(value) {
1173 | return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
1174 | }
1175 |
1176 | // Sets the reduce order, using the specified accessor.
1177 | function order(value) {
1178 | select = heapselect_by(valueOf);
1179 | heap = heap_by(valueOf);
1180 | function valueOf(d) { return value(d.value); }
1181 | return group;
1182 | }
1183 |
1184 | // A convenience method for natural ordering by reduce value.
1185 | function orderNatural() {
1186 | return order(crossfilter_identity);
1187 | }
1188 |
1189 | // Returns the cardinality of this group, irrespective of any filters.
1190 | function size() {
1191 | return k;
1192 | }
1193 |
1194 | // Removes this group and associated event listeners.
1195 | function dispose() {
1196 | var i = filterListeners.indexOf(update);
1197 | if (i >= 0) filterListeners.splice(i, 1);
1198 | i = indexListeners.indexOf(add);
1199 | if (i >= 0) indexListeners.splice(i, 1);
1200 | i = removeDataListeners.indexOf(removeData);
1201 | if (i >= 0) removeDataListeners.splice(i, 1);
1202 | return group;
1203 | }
1204 |
1205 | return reduceCount().orderNatural();
1206 | }
1207 |
1208 | // A convenience function for generating a singleton group.
1209 | function groupAll() {
1210 | var g = group(crossfilter_null), all = g.all;
1211 | delete g.all;
1212 | delete g.top;
1213 | delete g.order;
1214 | delete g.orderNatural;
1215 | delete g.size;
1216 | g.value = function() { return all()[0].value; };
1217 | return g;
1218 | }
1219 |
1220 | // Removes this dimension and associated groups and event listeners.
1221 | function dispose() {
1222 | dimensionGroups.forEach(function(group) { group.dispose(); });
1223 | var i = dataListeners.indexOf(preAdd);
1224 | if (i >= 0) dataListeners.splice(i, 1);
1225 | i = dataListeners.indexOf(postAdd);
1226 | if (i >= 0) dataListeners.splice(i, 1);
1227 | i = removeDataListeners.indexOf(removeData);
1228 | if (i >= 0) removeDataListeners.splice(i, 1);
1229 | for (i = 0; i < n; ++i) filters[i] &= zero;
1230 | m &= zero;
1231 | return dimension;
1232 | }
1233 |
1234 | return dimension;
1235 | }
1236 |
1237 | // A convenience method for groupAll on a dummy dimension.
1238 | // This implementation can be optimized since it always has cardinality 1.
1239 | function groupAll() {
1240 | var group = {
1241 | reduce: reduce,
1242 | reduceCount: reduceCount,
1243 | reduceSum: reduceSum,
1244 | value: value,
1245 | dispose: dispose,
1246 | remove: dispose // for backwards-compatibility
1247 | };
1248 |
1249 | var reduceValue,
1250 | reduceAdd,
1251 | reduceRemove,
1252 | reduceInitial,
1253 | resetNeeded = true;
1254 |
1255 | // The group listens to the crossfilter for when any dimension changes, so
1256 | // that it can update the reduce value. It must also listen to the parent
1257 | // dimension for when data is added.
1258 | filterListeners.push(update);
1259 | dataListeners.push(add);
1260 |
1261 | // For consistency; actually a no-op since resetNeeded is true.
1262 | add(data, 0, n);
1263 |
1264 | // Incorporates the specified new values into this group.
1265 | function add(newData, n0) {
1266 | var i;
1267 |
1268 | if (resetNeeded) return;
1269 |
1270 | // Add the added values.
1271 | for (i = n0; i < n; ++i) {
1272 | if (!filters[i]) {
1273 | reduceValue = reduceAdd(reduceValue, data[i]);
1274 | }
1275 | }
1276 | }
1277 |
1278 | // Reduces the specified selected or deselected records.
1279 | function update(filterOne, added, removed) {
1280 | var i,
1281 | k,
1282 | n;
1283 |
1284 | if (resetNeeded) return;
1285 |
1286 | // Add the added values.
1287 | for (i = 0, n = added.length; i < n; ++i) {
1288 | if (!filters[k = added[i]]) {
1289 | reduceValue = reduceAdd(reduceValue, data[k]);
1290 | }
1291 | }
1292 |
1293 | // Remove the removed values.
1294 | for (i = 0, n = removed.length; i < n; ++i) {
1295 | if (filters[k = removed[i]] === filterOne) {
1296 | reduceValue = reduceRemove(reduceValue, data[k]);
1297 | }
1298 | }
1299 | }
1300 |
1301 | // Recomputes the group reduce value from scratch.
1302 | function reset() {
1303 | var i;
1304 |
1305 | reduceValue = reduceInitial();
1306 |
1307 | for (i = 0; i < n; ++i) {
1308 | if (!filters[i]) {
1309 | reduceValue = reduceAdd(reduceValue, data[i]);
1310 | }
1311 | }
1312 | }
1313 |
1314 | // Sets the reduce behavior for this group to use the specified functions.
1315 | // This method lazily recomputes the reduce value, waiting until needed.
1316 | function reduce(add, remove, initial) {
1317 | reduceAdd = add;
1318 | reduceRemove = remove;
1319 | reduceInitial = initial;
1320 | resetNeeded = true;
1321 | return group;
1322 | }
1323 |
1324 | // A convenience method for reducing by count.
1325 | function reduceCount() {
1326 | return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
1327 | }
1328 |
1329 | // A convenience method for reducing by sum(value).
1330 | function reduceSum(value) {
1331 | return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
1332 | }
1333 |
1334 | // Returns the computed reduce value.
1335 | function value() {
1336 | if (resetNeeded) reset(), resetNeeded = false;
1337 | return reduceValue;
1338 | }
1339 |
1340 | // Removes this group and associated event listeners.
1341 | function dispose() {
1342 | var i = filterListeners.indexOf(update);
1343 | if (i >= 0) filterListeners.splice(i);
1344 | i = dataListeners.indexOf(add);
1345 | if (i >= 0) dataListeners.splice(i);
1346 | return group;
1347 | }
1348 |
1349 | return reduceCount();
1350 | }
1351 |
1352 | // Returns the number of records in this crossfilter, irrespective of any filters.
1353 | function size() {
1354 | return n;
1355 | }
1356 |
1357 | return arguments.length
1358 | ? add(arguments[0])
1359 | : crossfilter;
1360 | }
1361 |
1362 | // Returns an array of size n, big enough to store ids up to m.
1363 | function crossfilter_index(n, m) {
1364 | return (m < 0x101
1365 | ? crossfilter_array8 : m < 0x10001
1366 | ? crossfilter_array16
1367 | : crossfilter_array32)(n);
1368 | }
1369 |
1370 | // Constructs a new array of size n, with sequential values from 0 to n - 1.
1371 | function crossfilter_range(n) {
1372 | var range = crossfilter_index(n, n);
1373 | for (var i = -1; ++i < n;) range[i] = i;
1374 | return range;
1375 | }
1376 |
1377 | function crossfilter_capacity(w) {
1378 | return w === 8
1379 | ? 0x100 : w === 16
1380 | ? 0x10000
1381 | : 0x100000000;
1382 | }
1383 | })(this);
1384 |
--------------------------------------------------------------------------------
/static/lib/js/jquery.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
2 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){
3 | return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*\s*$/g,ia={option:[1,""],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1>$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1>$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("")).appendTo(b.documentElement),b=qa[0].contentDocument,b.write(),b.close(),c=sa(a,b),qa.detach()),ra[a]=c),c}var ua=/^margin/,va=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wa=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)};function xa(a,b,c){var d,e,f,g,h=a.style;return c=c||wa(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),va.test(g)&&ua.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function ya(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var za=/^(none|table(?!-c[ea]).+)/,Aa=new RegExp("^("+Q+")(.*)$","i"),Ba=new RegExp("^([+-])=("+Q+")","i"),Ca={position:"absolute",visibility:"hidden",display:"block"},Da={letterSpacing:"0",fontWeight:"400"},Ea=["Webkit","O","Moz","ms"];function Fa(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Ea.length;while(e--)if(b=Ea[e]+c,b in a)return b;return d}function Ga(a,b,c){var d=Aa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Ha(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ia(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wa(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xa(a,b,f),(0>e||null==e)&&(e=a.style[b]),va.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Ha(a,b,c||(g?"border":"content"),d,f)+"px"}function Ja(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",ta(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xa(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fa(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Ba.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fa(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xa(a,b,d)),"normal"===e&&b in Da&&(e=Da[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?za.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Ca,function(){return Ia(a,b,d)}):Ia(a,b,d):void 0},set:function(a,c,d){var e=d&&wa(a);return Ga(a,c,d?Ha(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=ya(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ua.test(a)||(n.cssHooks[a+b].set=Ga)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wa(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Ja(this,!0)},hide:function(){return Ja(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Ka(a,b,c,d,e){return new Ka.prototype.init(a,b,c,d,e)}n.Tween=Ka,Ka.prototype={constructor:Ka,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ka.propHooks[this.prop];return a&&a.get?a.get(this):Ka.propHooks._default.get(this)},run:function(a){var b,c=Ka.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ka.propHooks._default.set(this),this}},Ka.prototype.init.prototype=Ka.prototype,Ka.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Ka.propHooks.scrollTop=Ka.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Ka.prototype.init,n.fx.step={};var La,Ma,Na=/^(?:toggle|show|hide)$/,Oa=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pa=/queueHooks$/,Qa=[Va],Ra={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Oa.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Oa.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sa(){return setTimeout(function(){La=void 0}),La=n.now()}function Ta(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ua(a,b,c){for(var d,e=(Ra[b]||[]).concat(Ra["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Va(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||ta(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Na.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?ta(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ua(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wa(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xa(a,b,c){var d,e,f=0,g=Qa.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=La||Sa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:La||Sa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wa(k,j.opts.specialEasing);g>f;f++)if(d=Qa[f].call(j,a,k,j.opts))return d;return n.map(k,Ua,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xa,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Ra[c]=Ra[c]||[],Ra[c].unshift(b)},prefilter:function(a,b){b?Qa.unshift(a):Qa.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xa(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pa.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Ta(b,!0),a,d,e)}}),n.each({slideDown:Ta("show"),slideUp:Ta("hide"),slideToggle:Ta("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(La=n.now();b1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Za:Ya)),
4 | void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Za={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$a[b]||n.find.attr;$a[b]=function(a,b,d){var e,f;return d||(f=$a[b],$a[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$a[b]=f),e}});var _a=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_a.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ab=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ab," ").indexOf(b)>=0)return!0;return!1}});var bb=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cb=n.now(),db=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var eb=/#.*$/,fb=/([?&])_=[^&]*/,gb=/^(.*?):[ \t]*([^\r\n]*)$/gm,hb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ib=/^(?:GET|HEAD)$/,jb=/^\/\//,kb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lb={},mb={},nb="*/".concat("*"),ob=a.location.href,pb=kb.exec(ob.toLowerCase())||[];function qb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function rb(a,b,c,d){var e={},f=a===mb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function sb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function tb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function ub(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ob,type:"GET",isLocal:hb.test(pb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?sb(sb(a,n.ajaxSettings),b):sb(n.ajaxSettings,a)},ajaxPrefilter:qb(lb),ajaxTransport:qb(mb),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=gb.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||ob)+"").replace(eb,"").replace(jb,pb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kb.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pb[1]&&h[2]===pb[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pb[3]||("http:"===pb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rb(lb,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ib.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(db.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=fb.test(d)?d.replace(fb,"$1_="+cb++):d+(db.test(d)?"&":"?")+"_="+cb++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+nb+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=rb(mb,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=tb(k,v,f)),u=ub(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vb=/%20/g,wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&").replace(vb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bb=0,Cb={},Db={0:200,1223:204},Eb=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cb)Cb[a]()}),k.cors=!!Eb&&"withCredentials"in Eb,k.ajax=Eb=!!Eb,n.ajaxTransport(function(a){var b;return k.cors||Eb&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Cb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Db[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Cb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |