Last active
August 29, 2015 13:56
-
-
Save milroc/8981451 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Blur.js | |
* Copyright Jacob Kelley | |
* MIT License | |
*/ | |
(function ($) { | |
$.fn.blurjs = function (options) { | |
var canvas = document.createElement('canvas'); | |
var isCached = false; | |
var selector = ($(this).selector).replace(/[^a-zA-Z0-9]/g, ""); | |
if(!canvas.getContext) { | |
return; | |
} | |
options = $.extend({ | |
source: 'body', | |
radius: 5, | |
overlay: '', | |
offset: { | |
x: 0, | |
y: 0 | |
}, | |
optClass: '', | |
cache: false, | |
cacheKeyPrefix: 'blurjs-', | |
draggable: false, | |
debug: false | |
}, options); | |
// Stackblur, courtesy of Mario Klingemann: http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html | |
var mul_table = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259]; | |
var shg_table = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]; | |
function stackBlurCanvasRGB(a, b, c, d, f, g) { | |
if(isNaN(g) || g < 1) return; | |
g |= 0; | |
var h = a.getContext("2d"); | |
var j; | |
try { | |
try { | |
j = h.getImageData(b, c, d, f) | |
} catch(e) { | |
try { | |
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); | |
j = h.getImageData(b, c, d, f) | |
} catch(e) { | |
alert("Cannot access local image"); | |
throw new Error("unable to access local image data: " + e); | |
} | |
} | |
} catch(e) { | |
alert("Cannot access image"); | |
throw new Error("unable to access image data: " + e); | |
} | |
var k = j.data; | |
var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, r_out_sum, g_out_sum, b_out_sum, r_in_sum, g_in_sum, b_in_sum, pr, pg, pb, rbs; | |
var l = g + g + 1; | |
var m = d << 2; | |
var n = d - 1; | |
var o = f - 1; | |
var q = g + 1; | |
var r = q * (q + 1) / 2; | |
var s = new BlurStack(); | |
var t = s; | |
for(i = 1; i < l; i++) { | |
t = t.next = new BlurStack(); | |
if(i == q) var u = t | |
} | |
t.next = s; | |
var v = null; | |
var w = null; | |
yw = yi = 0; | |
var z = mul_table[g]; | |
var A = shg_table[g]; | |
for(y = 0; y < f; y++) { | |
r_in_sum = g_in_sum = b_in_sum = r_sum = g_sum = b_sum = 0; | |
r_out_sum = q * (pr = k[yi]); | |
g_out_sum = q * (pg = k[yi + 1]); | |
b_out_sum = q * (pb = k[yi + 2]); | |
r_sum += r * pr; | |
g_sum += r * pg; | |
b_sum += r * pb; | |
t = s; | |
for(i = 0; i < q; i++) { | |
t.r = pr; | |
t.g = pg; | |
t.b = pb; | |
t = t.next | |
} | |
for(i = 1; i < q; i++) { | |
p = yi + ((n < i ? n : i) << 2); | |
r_sum += (t.r = (pr = k[p])) * (rbs = q - i); | |
g_sum += (t.g = (pg = k[p + 1])) * rbs; | |
b_sum += (t.b = (pb = k[p + 2])) * rbs; | |
r_in_sum += pr; | |
g_in_sum += pg; | |
b_in_sum += pb; | |
t = t.next | |
} | |
v = s; | |
w = u; | |
for(x = 0; x < d; x++) { | |
k[yi] = (r_sum * z) >> A; | |
k[yi + 1] = (g_sum * z) >> A; | |
k[yi + 2] = (b_sum * z) >> A; | |
r_sum -= r_out_sum; | |
g_sum -= g_out_sum; | |
b_sum -= b_out_sum; | |
r_out_sum -= v.r; | |
g_out_sum -= v.g; | |
b_out_sum -= v.b; | |
p = (yw + ((p = x + g + 1) < n ? p : n)) << 2; | |
r_in_sum += (v.r = k[p]); | |
g_in_sum += (v.g = k[p + 1]); | |
b_in_sum += (v.b = k[p + 2]); | |
r_sum += r_in_sum; | |
g_sum += g_in_sum; | |
b_sum += b_in_sum; | |
v = v.next; | |
r_out_sum += (pr = w.r); | |
g_out_sum += (pg = w.g); | |
b_out_sum += (pb = w.b); | |
r_in_sum -= pr; | |
g_in_sum -= pg; | |
b_in_sum -= pb; | |
w = w.next; | |
yi += 4 | |
} | |
yw += d | |
} | |
for(x = 0; x < d; x++) { | |
g_in_sum = b_in_sum = r_in_sum = g_sum = b_sum = r_sum = 0; | |
yi = x << 2; | |
r_out_sum = q * (pr = k[yi]); | |
g_out_sum = q * (pg = k[yi + 1]); | |
b_out_sum = q * (pb = k[yi + 2]); | |
r_sum += r * pr; | |
g_sum += r * pg; | |
b_sum += r * pb; | |
t = s; | |
for(i = 0; i < q; i++) { | |
t.r = pr; | |
t.g = pg; | |
t.b = pb; | |
t = t.next | |
} | |
yp = d; | |
for(i = 1; i <= g; i++) { | |
yi = (yp + x) << 2; | |
r_sum += (t.r = (pr = k[yi])) * (rbs = q - i); | |
g_sum += (t.g = (pg = k[yi + 1])) * rbs; | |
b_sum += (t.b = (pb = k[yi + 2])) * rbs; | |
r_in_sum += pr; | |
g_in_sum += pg; | |
b_in_sum += pb; | |
t = t.next; | |
if(i < o) { | |
yp += d | |
} | |
} | |
yi = x; | |
v = s; | |
w = u; | |
for(y = 0; y < f; y++) { | |
p = yi << 2; | |
k[p] = (r_sum * z) >> A; | |
k[p + 1] = (g_sum * z) >> A; | |
k[p + 2] = (b_sum * z) >> A; | |
r_sum -= r_out_sum; | |
g_sum -= g_out_sum; | |
b_sum -= b_out_sum; | |
r_out_sum -= v.r; | |
g_out_sum -= v.g; | |
b_out_sum -= v.b; | |
p = (x + (((p = y + q) < o ? p : o) * d)) << 2; | |
r_sum += (r_in_sum += (v.r = k[p])); | |
g_sum += (g_in_sum += (v.g = k[p + 1])); | |
b_sum += (b_in_sum += (v.b = k[p + 2])); | |
v = v.next; | |
r_out_sum += (pr = w.r); | |
g_out_sum += (pg = w.g); | |
b_out_sum += (pb = w.b); | |
r_in_sum -= pr; | |
g_in_sum -= pg; | |
b_in_sum -= pb; | |
w = w.next; | |
yi += d | |
} | |
} | |
h.putImageData(j, b, c) | |
} | |
function BlurStack() { | |
this.r = 0; | |
this.g = 0; | |
this.b = 0; | |
this.a = 0; | |
this.next = null | |
} | |
return this.each(function () { | |
var $glue = $(this); | |
var $source = $(options.source); | |
var formattedSource = ($source.css('backgroundImage')).replace(/"/g, "").replace(/url\(|\)$/ig, ""); | |
ctx = canvas.getContext('2d'); | |
tempImg = new Image(); | |
tempImg.onload = function () { | |
if(!isCached) { | |
canvas.style.display = "none"; | |
canvas.width = tempImg.width; | |
canvas.height = tempImg.height; | |
ctx.drawImage(tempImg, 0, 0); | |
stackBlurCanvasRGB(canvas, 0, 0, canvas.width, canvas.height, options.radius); | |
if(options.overlay != false) { | |
ctx.beginPath(); | |
ctx.rect(0, 0, tempImg.width, tempImg.width); | |
ctx.fillStyle = options.overlay; | |
ctx.fill(); | |
} | |
var blurredData = canvas.toDataURL(); | |
if(options.cache) { | |
try { | |
if(options.debug) { | |
console.log('Cache Set'); | |
} | |
localStorage.setItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-data-image', blurredData); | |
} catch(e) { | |
console.log(e); | |
} | |
} | |
} else { | |
var blurredData = tempImg.src; | |
} | |
var attachment = $source.css('backgroundAttachment'); | |
var position = (attachment == 'fixed') ? '' : '-' + (($glue.offset().left) - ($source.offset().left) - (options.offset.x)) + 'px -' + (($glue.offset().top) - ($source.offset().top) - (options.offset.y)) + 'px'; | |
$glue.css({ | |
'background-image': 'url("' + blurredData + '")', | |
'background-repeat': $source.css('backgroundRepeat'), | |
'background-position': position, | |
'background-attachment': attachment | |
}); | |
if(options.optClass != false) { | |
$glue.addClass(options.optClass); | |
} | |
if(options.draggable) { | |
$glue.css({ | |
'background-attachment': 'fixed', | |
'background-position': '0 0' | |
}); | |
$glue.draggable(); | |
} | |
}; | |
Storage.prototype.cacheChecksum = function (opts) { | |
var newData = ''; | |
for(var key in opts) { | |
var obj = opts[key]; | |
if(obj.toString() == '[object Object]') { | |
newData += ((obj.x).toString() + (obj.y).toString() + ",").replace(/[^a-zA-Z0-9]/g, ""); | |
} else { | |
newData += (obj + ",").replace(/[^a-zA-Z0-9]/g, ""); | |
} | |
} | |
var originalData = this.getItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-options-cache'); | |
if(originalData != newData) { | |
this.removeItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-options-cache'); | |
this.setItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-options-cache', newData); | |
if(options.debug) { | |
console.log('Settings Changed, Cache Emptied'); | |
} | |
} | |
}; | |
var cachedData = null; | |
if(options.cache) { | |
localStorage.cacheChecksum(options); | |
cachedData = localStorage.getItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-data-image'); | |
} | |
if(cachedData != null) { | |
if(options.debug) { | |
console.log('Cache Used'); | |
} | |
isCached = true; | |
tempImg.src = (cachedData); | |
} else { | |
if(options.debug) { | |
console.log('Source Used'); | |
} | |
tempImg.src = formattedSource; | |
} | |
}); | |
}; | |
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Bootstrap v3.0.0 | |
* | |
* Copyright 2013 Twitter, Inc | |
* Licensed under the Apache License v2.0 | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Designed and built with all the love in the world @twitter by @mdo and @fat. | |
*/ | |
/*! normalize.css v2.1.0 | MIT License | git.io/normalize */ | |
article, | |
aside, | |
details, | |
figcaption, | |
figure, | |
footer, | |
header, | |
hgroup, | |
main, | |
nav, | |
section, | |
summary { | |
display: block; | |
} | |
audio, | |
canvas, | |
video { | |
display: inline-block; | |
} | |
audio:not([controls]) { | |
display: none; | |
height: 0; | |
} | |
[hidden] { | |
display: none; | |
} | |
html { | |
font-family: sans-serif; | |
-webkit-text-size-adjust: 100%; | |
-ms-text-size-adjust: 100%; | |
} | |
body { | |
margin: 0; | |
} | |
a:focus { | |
outline: thin dotted; | |
} | |
a:active, | |
a:hover { | |
outline: 0; | |
} | |
h1 { | |
font-size: 2em; | |
margin: 0.67em 0; | |
} | |
abbr[title] { | |
border-bottom: 1px dotted; | |
} | |
b, | |
strong { | |
font-weight: bold; | |
} | |
dfn { | |
font-style: italic; | |
} | |
hr { | |
-moz-box-sizing: content-box; | |
box-sizing: content-box; | |
height: 0; | |
} | |
mark { | |
background: #ff0; | |
color: #000; | |
} | |
code, | |
kbd, | |
pre, | |
samp { | |
font-family: monospace, serif; | |
font-size: 1em; | |
} | |
pre { | |
white-space: pre-wrap; | |
} | |
q { | |
quotes: "\201C" "\201D" "\2018" "\2019"; | |
} | |
small { | |
font-size: 80%; | |
} | |
sub, | |
sup { | |
font-size: 75%; | |
line-height: 0; | |
position: relative; | |
vertical-align: baseline; | |
} | |
sup { | |
top: -0.5em; | |
} | |
sub { | |
bottom: -0.25em; | |
} | |
img { | |
border: 0; | |
} | |
svg:not(:root) { | |
overflow: hidden; | |
} | |
figure { | |
margin: 0; | |
} | |
fieldset { | |
border: 1px solid #c0c0c0; | |
margin: 0 2px; | |
padding: 0.35em 0.625em 0.75em; | |
} | |
legend { | |
border: 0; | |
padding: 0; | |
} | |
button, | |
input, | |
select, | |
textarea { | |
font-family: inherit; | |
font-size: 100%; | |
margin: 0; | |
} | |
button, | |
input { | |
line-height: normal; | |
} | |
button, | |
select { | |
text-transform: none; | |
} | |
button, | |
html input[type="button"], | |
input[type="reset"], | |
input[type="submit"] { | |
-webkit-appearance: button; | |
cursor: pointer; | |
} | |
button[disabled], | |
html input[disabled] { | |
cursor: default; | |
} | |
input[type="checkbox"], | |
input[type="radio"] { | |
box-sizing: border-box; | |
padding: 0; | |
} | |
input[type="search"] { | |
-webkit-appearance: textfield; | |
-moz-box-sizing: content-box; | |
-webkit-box-sizing: content-box; | |
box-sizing: content-box; | |
} | |
input[type="search"]::-webkit-search-cancel-button, | |
input[type="search"]::-webkit-search-decoration { | |
-webkit-appearance: none; | |
} | |
button::-moz-focus-inner, | |
input::-moz-focus-inner { | |
border: 0; | |
padding: 0; | |
} | |
textarea { | |
overflow: auto; | |
vertical-align: top; | |
} | |
table { | |
border-collapse: collapse; | |
border-spacing: 0; | |
} | |
*, | |
*:before, | |
*:after { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
html { | |
font-size: 62.5%; | |
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); | |
} | |
body { | |
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.428571429; | |
color: #333333; | |
background-color: #ffffff; | |
} | |
input, | |
button, | |
select, | |
textarea { | |
font-family: inherit; | |
font-size: inherit; | |
line-height: inherit; | |
} | |
button, | |
input, | |
select[multiple], | |
textarea { | |
background-image: none; | |
} | |
a { | |
color: #428bca; | |
text-decoration: none; | |
} | |
a:hover, | |
a:focus { | |
color: #2a6496; | |
text-decoration: underline; | |
} | |
a:focus { | |
outline: thin dotted #333; | |
outline: 5px auto -webkit-focus-ring-color; | |
outline-offset: -2px; | |
} | |
img { | |
vertical-align: middle; | |
} | |
.img-responsive { | |
display: block; | |
max-width: 100%; | |
height: auto; | |
} | |
.img-rounded { | |
border-radius: 6px; | |
} | |
.img-thumbnail { | |
padding: 4px; | |
line-height: 1.428571429; | |
background-color: #ffffff; | |
border: 1px solid #dddddd; | |
border-radius: 4px; | |
-webkit-transition: all 0.2s ease-in-out; | |
transition: all 0.2s ease-in-out; | |
display: inline-block; | |
max-width: 100%; | |
height: auto; | |
} | |
.img-circle { | |
border-radius: 50%; | |
} | |
hr { | |
margin-top: 20px; | |
margin-bottom: 20px; | |
border: 0; | |
border-top: 1px solid #eeeeee; | |
} | |
.sr-only { | |
position: absolute; | |
width: 1px; | |
height: 1px; | |
margin: -1px; | |
padding: 0; | |
overflow: hidden; | |
clip: rect(0 0 0 0); | |
border: 0; | |
} | |
.nav { | |
margin-bottom: 0; | |
padding-left: 0; | |
list-style: none; | |
} | |
.nav:before, | |
.nav:after { | |
content: " "; | |
/* 1 */ | |
display: table; | |
/* 2 */ | |
} | |
.nav:after { | |
clear: both; | |
} | |
.nav > li { | |
position: relative; | |
display: block; | |
} | |
.nav > li > a { | |
position: relative; | |
display: block; | |
padding: 10px 15px; | |
} | |
.nav > li > a:hover, | |
.nav > li > a:focus { | |
text-decoration: none; | |
background-color: #eeeeee; | |
} | |
.nav > li.disabled > a { | |
color: #999999; | |
} | |
.nav > li.disabled > a:hover, | |
.nav > li.disabled > a:focus { | |
color: #999999; | |
text-decoration: none; | |
background-color: transparent; | |
cursor: not-allowed; | |
} | |
.nav .open > a, | |
.nav .open > a:hover, | |
.nav .open > a:focus { | |
background-color: #eeeeee; | |
border-color: #428bca; | |
} | |
.nav .nav-divider { | |
height: 1px; | |
margin: 9px 0; | |
overflow: hidden; | |
background-color: #e5e5e5; | |
} | |
.nav > li > a > img { | |
max-width: none; | |
} | |
.nav-tabs { | |
border-bottom: 1px solid #dddddd; | |
} | |
.nav-tabs > li { | |
float: left; | |
margin-bottom: -1px; | |
} | |
.nav-tabs > li > a { | |
margin-right: 2px; | |
line-height: 1.428571429; | |
border: 1px solid transparent; | |
border-radius: 4px 4px 0 0; | |
} | |
.nav-tabs > li > a:hover { | |
border-color: #eeeeee #eeeeee #dddddd; | |
} | |
.nav-tabs > li.active > a, | |
.nav-tabs > li.active > a:hover, | |
.nav-tabs > li.active > a:focus { | |
color: #555555; | |
background-color: #ffffff; | |
border: 1px solid #dddddd; | |
border-bottom-color: transparent; | |
cursor: default; | |
} | |
.nav-tabs.nav-justified { | |
width: 100%; | |
border-bottom: 0; | |
} | |
.nav-tabs.nav-justified > li { | |
float: none; | |
} | |
.nav-tabs.nav-justified > li > a { | |
text-align: center; | |
} | |
@media (min-width: 768px) { | |
.nav-tabs.nav-justified > li { | |
display: table-cell; | |
width: 1%; | |
} | |
} | |
.nav-tabs.nav-justified > li > a { | |
border-bottom: 1px solid #dddddd; | |
margin-right: 0; | |
} | |
.nav-tabs.nav-justified > .active > a { | |
border-bottom-color: #ffffff; | |
} | |
.nav-pills > li { | |
float: left; | |
} | |
.nav-pills > li > a { | |
border-radius: 5px; | |
} | |
.nav-pills > li + li { | |
margin-left: 2px; | |
} | |
.nav-pills > li.active > a, | |
.nav-pills > li.active > a:hover, | |
.nav-pills > li.active > a:focus { | |
color: #ffffff; | |
background-color: #428bca; | |
} | |
.nav-stacked > li { | |
float: none; | |
} | |
.nav-stacked > li + li { | |
margin-top: 2px; | |
margin-left: 0; | |
} | |
.nav-justified { | |
width: 100%; | |
} | |
.nav-justified > li { | |
float: none; | |
} | |
.nav-justified > li > a { | |
text-align: center; | |
} | |
@media (min-width: 768px) { | |
.nav-justified > li { | |
display: table-cell; | |
width: 1%; | |
} | |
} | |
.nav-tabs-justified { | |
border-bottom: 0; | |
} | |
.nav-tabs-justified > li > a { | |
border-bottom: 1px solid #dddddd; | |
margin-right: 0; | |
} | |
.nav-tabs-justified > .active > a { | |
border-bottom-color: #ffffff; | |
} | |
.tabbable:before, | |
.tabbable:after { | |
content: " "; | |
/* 1 */ | |
display: table; | |
/* 2 */ | |
} | |
.tabbable:after { | |
clear: both; | |
} | |
.tab-content > .tab-pane, | |
.pill-content > .pill-pane { | |
display: none; | |
} | |
.tab-content > .active, | |
.pill-content > .active { | |
display: block; | |
} | |
.nav .caret { | |
border-top-color: #428bca; | |
border-bottom-color: #428bca; | |
} | |
.nav a:hover .caret { | |
border-top-color: #2a6496; | |
border-bottom-color: #2a6496; | |
} | |
.nav-tabs .dropdown-menu { | |
margin-top: -1px; | |
border-top-right-radius: 0; | |
border-top-left-radius: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var charts = {}; | |
charts.bar = function() { | |
// basic data | |
var margin = {top: 20, bottom: 20, left: 0, right: 0}, | |
width = 400, | |
height = 400, | |
// accessors | |
xValue = function(d) { return d.x; }, | |
yValue = function(d) { return d.y; }, | |
// chart underpinnings | |
brush = d3.svg.brush(), | |
xAxis = d3.svg.axis().orient('bottom'), | |
yAxis = d3.svg.axis().orient('left'), | |
x = d3.scale.ordinal(), | |
y = d3.scale.linear(), | |
// chart enhancements | |
elastic = { | |
margin: true, | |
x: true, | |
y: true | |
}, | |
convertData = true, | |
duration = 500, | |
formatNumber = d3.format(',d'); | |
function render(selection) { | |
selection.each(function(data) { | |
// setup the basics | |
if (elastic.margin) margin.left = formatNumber(d3.max(data, function(d) { return d.y; })).length * 15; | |
var w = width - margin.left - margin.right, | |
h = height - margin.top - margin.bottom; | |
// if needed convert the data | |
if (convertData) { | |
data = data.map(function(d, i) { | |
return { | |
x: xValue.call(data, d, i), | |
y: yValue.call(data, d, i) | |
}; | |
}); | |
} | |
// set scales | |
if (elastic.x) x.domain(data.map(function(d) { return d.x; })); | |
if (elastic.y) y.domain([0, d3.max(data, function(d) { return d.y; })]); | |
x.rangeRoundBands([0, w], .1); | |
y.range([h, 0]); | |
// reset axes and brush | |
xAxis.scale(x); | |
yAxis.scale(y); | |
brush.x(x) | |
.on('brushstart.chart', brushstart) | |
.on('brush.chart', brushmove) | |
.on('brushend.chart', brushend); | |
brush.clear(); | |
var svg = selection.selectAll('svg').data([data]), | |
chartEnter = svg.enter().append('svg') | |
.append('g') | |
.attr('width', w) | |
.attr('height', h) | |
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') | |
.classed('chart', true), | |
chart = svg.select('.chart'); | |
chartEnter.append('g') | |
.classed('x axis', true) | |
.attr('transform', 'translate(' + 0 + ',' + h + ')'); | |
chartEnter.append('g') | |
.classed('y axis', true) | |
chartEnter.append('g').classed('barGroup', true); | |
chart.selectAll('.brush').remove(); | |
chart.selectAll('.selected').classed('selected', false); | |
chart.append('g') | |
.classed('brush', true) | |
.call(brush) | |
.selectAll('rect') | |
.attr('height', h); | |
bars = chart.select('.barGroup').selectAll('.bar').data(data); | |
bars.enter() | |
.append('rect') | |
.classed('bar', true) | |
.attr('x', w) // start here for object constancy | |
.attr('width', x.rangeBand()) | |
.attr('y', function(d, i) { return y(d.y); }) | |
.attr('height', function(d, i) { return h - y(d.y); }); | |
bars.transition() | |
.duration(duration) | |
.style('opacity', 1) | |
.attr('width', x.rangeBand()) | |
.attr('x', function(d, i) { return x(d.x); }) | |
.attr('y', function(d, i) { return y(d.y); }) | |
.attr('height', function(d, i) { return h - y(d.y); }); | |
bars.exit() | |
.transition() | |
.duration(duration) | |
.style('opacity', 0) | |
.remove(); | |
chart.select('.x.axis') | |
.transition() | |
.duration(duration) | |
.call(xAxis); | |
chart.select('.y.axis') | |
.transition() | |
.duration(duration) | |
.call(yAxis); | |
function brushstart() { | |
chart.classed("selecting", true); | |
} | |
function brushmove() { | |
var extent = d3.event.target.extent(); | |
selection.selectAll('.bar').classed("selected", function(d) { return extent[0] <= x(d.x) && x(d.x) + x.rangeBand() <= extent[1]; }); | |
} | |
function brushend() { | |
chart.classed("selecting", !d3.event.target.empty()); | |
} | |
}); | |
} | |
// basic data | |
render.margin = function(_) { | |
if (!arguments.length) return margin; | |
margin = _; | |
return render; | |
}; | |
render.width = function(_) { | |
if (!arguments.length) return width; | |
width = _; | |
return render; | |
}; | |
render.height = function(_) { | |
if (!arguments.length) return height; | |
height = _; | |
return render; | |
}; | |
// accessors | |
render.xValue = function(_) { | |
if (!arguments.length) return xValue; | |
xValue = _; | |
return render; | |
}; | |
render.yValue = function(_) { | |
if (!arguments.length) return yValue; | |
yValue = _; | |
return render; | |
}; | |
// chart underpinnings | |
render.brush = function(_) { | |
if (!arguments.length) return brush; | |
brush = _; | |
return render; | |
}; | |
render.xAxis = function(_) { | |
if (!arguments.length) return xAxis; | |
xAxis = _; | |
return render; | |
}; | |
render.yAxis = function(_) { | |
if (!arguments.length) return yAxis; | |
yAxis = _; | |
return render; | |
}; | |
render.x = function(_) { | |
if (!arguments.length) return x; | |
x = _; | |
return render; | |
}; | |
render.y = function(_) { | |
if (!arguments.length) return y; | |
y = _; | |
return render; | |
}; | |
// chart enhancements | |
render.elastic = function(_) { | |
if (!arguments.length) return elastic; | |
elastic = _; | |
return render; | |
}; | |
render.convertData = function(_) { | |
if (!arguments.length) return convertData; | |
convertData = _; | |
return render; | |
}; | |
render.duration = function(_) { | |
if (!arguments.length) return duration; | |
duration = _; | |
return render; | |
}; | |
render.formatNumber = function(_) { | |
if (!arguments.length) return formatNumber; | |
formatNumber = _; | |
return render; | |
}; | |
return d3.rebind(render, brush, 'on'); | |
}; | |
charts.graph = function() { | |
// overall size info | |
var width = 800, | |
height = 600, | |
margin = {top: 0, bottom: 0, left: 0, right: 0}, | |
// scales | |
colors = d3.scale.category20c(), | |
r = d3.scale.sqrt(), | |
x = d3.scale.ordinal(), | |
y = d3.scale.ordinal(), | |
// accessors | |
// top level | |
nodesValue = function(d) { return d.nodes; }, | |
linksValue = function(d) { return d.links; }, | |
// nodes | |
rValue = function(d) { return d.radius; }, | |
xConstraintValue = function(d) { return d.xConstraint; }, | |
yConstraintValue = function(d) { return d.yConstraint; }, | |
colorValue = function(d) { return d.color; }, | |
nameValue = function(d) { return d.name; }, | |
typeValue = function(d) { return d.type; }, | |
// links | |
sourceValue = function(d) { return d.source; }, | |
targetValue = function(d) { return d.target; }, | |
distanceValue = function(d) { return d.value; }, | |
linkTypeValue = function(d) { return d.type; } | |
// chart underpinnings | |
force = d3.layout.force(), | |
// chart enhancements | |
outline = 0, // outline of nodes | |
padding = { | |
collision: 5, | |
y: .5, | |
x: .5, | |
}, // padding between collisions | |
constraints = { | |
x: false, | |
y: false, | |
collisions: false, | |
bounding: false, | |
}, | |
elastic = { | |
x: false, | |
y: false | |
}, | |
// data = {}, | |
duration = 500; | |
function render(selection) { | |
selection.each(function(data) { | |
var w = width - margin.left - margin.right, | |
h = height - margin.top - margin.bottom; | |
var domain; | |
if (elastic.x) { | |
domain = d3.set(force.nodes().map(function(d, i) { return d.xConst; })).values(); | |
x.domain(domain); | |
} | |
x.rangeRoundBands([0, w], padding.x); | |
if (elastic.y) { | |
domain = d3.set(force.nodes().map(function(d, i) { return d.yConst; })).values(); | |
y.domain(domain); | |
} | |
y.rangeRoundBands([0, h], padding.y); | |
force | |
.size([w, h]); | |
force.start(); | |
var svg = d3.select(this).selectAll('svg').data([data]), | |
svgEnter = svg.enter().append('svg'); | |
svgEnter.append('g') | |
.classed('nodes', true); | |
svgEnter.append('g') | |
.classed('links', true); | |
svgEnter.append('defs'); | |
svg.attr('width', w) | |
.attr('height', h); | |
// change this to allow for marker position relative to size | |
svg.select('defs').selectAll("marker") | |
.data(d3.set(force.links().map(function(d, i) { return d.type; })).values()) | |
.enter() | |
.append("svg:marker") | |
.attr("id", function(d) { return d; }) | |
.attr("viewBox", "0 -5 10 10") | |
.attr("refX", 5) | |
.attr("refY", 0) | |
.attr("markerWidth", 4) | |
.attr("markerHeight", 4) | |
.attr("orient", "auto") | |
.append("svg:path") | |
.attr("d", "M0,-5L10,0L0,5"); | |
var link = d3.select('.links').selectAll('.link'), | |
links = link.data(force.links()); | |
links.enter() | |
.append("path") | |
.attr('class', function(d) { return 'link ' + d.type; }) | |
.attr("marker-end", function(d) { return "url(#" + d.type + ")"; }); | |
var node = d3.select('.nodes').selectAll('.node'), | |
nodes = node.data(force.nodes()), | |
nodesEnter = nodes.enter() | |
// .transition() | |
// .duration(duration) | |
.append('g') | |
.attr('class', function(d) { return 'node ' + d.type; }) | |
nodesEnter.append('circle') | |
.attr('r', function(d) { return r(d.r); }) | |
.style('fill', function(d) { return colors(d.color) || 'steelblue'; }) | |
.style('stroke', function(d) { return d3.rgb(colors(d.color)).darker(outline) || 'orange'; }); | |
nodesEnter.append("text") | |
.attr("dx", function(d) { return r(d.r); }) | |
.attr("dy", ".35em") | |
.text(function(d) { return d.name }); | |
nodes.call(force.drag); | |
nodes.exit() | |
.transition() | |
.duration(duration) | |
.attr('r', 0) | |
.style('opacity', 0) | |
.remove(); | |
force.on("tick", function(e) { | |
links.attr("d", function(d) { | |
var currLink = linkPosition(d), | |
dx = currLink.target.x - currLink.source.x, | |
dy = currLink.target.y - currLink.source.y, | |
dr = Math.sqrt(dx * dx + dy * dy); | |
return "M" + currLink.source.x + "," + currLink.source.y + | |
"A" + dr + "," + dr + | |
" 0 0,1 " + currLink.target.x + "," + currLink.target.y; | |
}); | |
var q, | |
k = e.alpha * .1, | |
i = -1, | |
currentNode = force.nodes()[i], | |
n = force.nodes().length; | |
if (constraints.collisions) q = d3.geom.quadtree(force.nodes()); | |
while (++i < n) { | |
currentNode = force.nodes()[i]; | |
// x & y constraints | |
if (constraints.y) { | |
if (currentNode.yConst === 'Frontend') console.log(y(currentNode.yConst)) | |
currentNode.y += (y(currentNode.yConst) - currentNode.y)*k; | |
} | |
if (constraints.x) currentNode.x += (x(currentNode.xConst) - currentNode.x) * k; | |
// collision detection | |
if (constraints.collisions) q.visit(collide(currentNode)); | |
} | |
// bounding box | |
if (constraints.bounding) { | |
nodes.attr("transform", function(d) { | |
d.x = Math.max(d.r, Math.min(w - d.r, d.x)); | |
d.y = Math.max(d.r, Math.min(h - d.r, d.y)); | |
return "translate(" + d.x + "," + d.y + ")"; | |
}); | |
} else { | |
nodes.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); | |
} | |
}); | |
function linkPosition(d) { | |
var tRadius = r(d.target.r), | |
sRadius = r(d.source.r), | |
a = Math.abs(d.target.x - d.source.x), | |
b = Math.abs(d.target.y - d.source.y), | |
c = Math.sqrt(a * a + b * b), | |
tθ = Math.acos((a * a - (b * b + c * c))/(2*b*c)), | |
sθ = Math.asin(Math.sin(tθ)*(b/a)), | |
sdx = sRadius*Math.sin(tθ)/Math.sin(90), | |
sdy = sRadius*Math.sin(sθ)/Math.sin(90), | |
tdx = tRadius*Math.sin(sθ)/Math.sin(90), | |
tdy = tRadius*Math.sin(tθ)/Math.sin(90); | |
if (isNaN(sθ)) console.log('t:', tθ, 's:', Math.sin(tθ)*(b/a).toFixed(2)); | |
return { | |
source: { | |
x: (d.target.x > d.source.x)?(d.source.x + sdx):(d.source.x - sdx), | |
y: (d.target.y > d.source.y)?(d.source.y + sdy):(d.source.y - sdy) | |
}, | |
target: { | |
x: (d.source.x > d.target.x)?(d.target.x + sdx):(d.target.x - sdx), | |
y: (d.source.y > d.target.y)?(d.target.y + sdy):(d.target.y - sdy) | |
} | |
}; | |
} | |
function collide(node) { | |
var radius = r(node.r) + padding.collision, | |
nx1 = node.x - radius, | |
nx2 = node.x + radius, | |
ny1 = node.y - radius, | |
ny2 = node.y + radius; | |
return function(quad, x1, y1, x2, y2) { | |
if (quad.point && (quad.point !== node)) { | |
var x = node.x - quad.point.x, | |
y = node.y - quad.point.y, | |
l = Math.sqrt(x * x + y * y), | |
radius = r(node.r) + r(quad.point.r) + padding.collision; | |
if (l < radius) { | |
l = (l - radius) / l * .5; | |
node.x -= x *= l; | |
node.y -= y *= l; | |
quad.point.x += x; | |
quad.point.y += y; | |
} | |
} | |
return x1 > nx2 | |
|| x2 < nx1 | |
|| y1 > ny2 | |
|| y2 < ny1; | |
} | |
} | |
}); | |
} | |
// sizing info | |
render.width = function(_) { | |
if (!arguments.length) return width; | |
width = _; | |
return render; | |
}; | |
render.height = function(_) { | |
if (!arguments.length) return height; | |
height = _; | |
return render; | |
}; | |
render.margin = function(_) { | |
if (!arguments.length) return margin; | |
margin = _; | |
return render; | |
} | |
// scales | |
render.colors = function(_) { | |
if (!arguments.length) return colors; | |
colors = _; | |
return render; | |
}; | |
render.r = function(_) { | |
if (!arguments.length) return r; | |
r = _; | |
return render; | |
}; | |
render.x = function(_) { | |
if (!arguments.length) return x; | |
x = _; | |
return render; | |
}; | |
render.y = function(_) { | |
if (!arguments.length) return y; | |
y = _; | |
return render; | |
}; | |
// accessors | |
render.colorValue = function(_) { | |
if (!arguments.length) return colorValue; | |
colorValue = d3.functor(_); | |
return render; | |
}; | |
render.rValue = function(_) { | |
if (!arguments.length) return rValue; | |
rValue = d3.functor(_); | |
return render; | |
}; | |
render.xConstraintValue = function(_) { | |
if (!arguments.length) return xConstraintValue; | |
xConstraintValue = d3.functor(_); | |
return render; | |
}; | |
render.yConstraintValue = function(_) { | |
if (!arguments.length) return yConstraintValue; | |
yConstraintValue = d3.functor(_); | |
return render; | |
}; | |
render.nameValue = function(_) { | |
if (!arguments.length) return nameValue; | |
nameValue = d3.functor(_); | |
return render; | |
}; | |
render.typeValue = function(_) { | |
if (!arguments.length) return typeValue; | |
typeValue = d3.functor(_); | |
return render; | |
}; | |
render.nodesValue = function(_) { | |
if (!arguments.length) return nodesValue; | |
nodesValue = d3.functor(_); | |
return render; | |
}; | |
render.linksValue = function(_) { | |
if (!arguments.length) return linksValue; | |
linksValue = d3.functor(_); | |
return render; | |
}; | |
render.sourceValue = function(_) { | |
if (!arguments.length) return sourceValue; | |
sourceValue = d3.functor(_); | |
return render; | |
}; | |
render.targetValue = function(_) { | |
if (!arguments.length) return targetValue; | |
targetValue = d3.functor(_); | |
return render; | |
}; | |
render.distanceValue = function(_) { | |
if (!arguments.length) return distanceValue; | |
distanceValue = d3.functor(_); | |
return render; | |
}; | |
//chart underpinnings | |
render.force = function(_) { | |
if (!arguments.length) return force; | |
force = _; | |
return render; | |
}; | |
render.data = function(data) { | |
var tData = {}, | |
nData = nodesValue(data), | |
lData = linksValue(data); | |
tData.nodes = nData.map(function(d, i) { | |
return { | |
r: r(rValue.call(nData, d, i)), //? | |
xConst: xConstraintValue.call(nData, d, i), | |
yConst: yConstraintValue.call(nData, d, i), | |
color: colorValue.call(nData, d, i), | |
name: nameValue.call(nData, d, i), | |
type: typeValue.call(nData, d, i), | |
}; | |
}); | |
tData.links = lData.map(function(d, i) { | |
return { | |
source: sourceValue.call(lData, d, i), | |
target: targetValue.call(lData, d, i), | |
value: distanceValue.call(lData, d, i), | |
type: linkTypeValue.call(lData, d, i), | |
}; | |
}); | |
data = tData; | |
force | |
.nodes(data.nodes) | |
.links(data.links) | |
}; | |
render.push = function(type, d) { | |
if (type === 'node') { | |
force.nodes().push({ | |
r: r(rValue(d)), //? | |
xConst: xConstraintValue(d), | |
yConst: yConstraintValue(d), | |
color: colorValue(d), | |
name: nameValue(d), | |
type: typeValue(d), | |
}); | |
} else if (type === 'link') { | |
force.links().push({ | |
source: sourceValue(d), | |
target: targetValue(d), | |
value: distanceValue(d), | |
type: linkTypeValue(d), | |
}); | |
} | |
} | |
// chart enhancements | |
render.outline = function(_) { | |
if (!arguments.length) return outline; | |
outline = _; | |
return render; | |
}; | |
render.duration = function(_) { | |
if (!arguments.length) return duration; | |
duration = _; | |
return render; | |
}; | |
render.constraints = function(_) { | |
if (!arguments.length) return constraints; | |
constraints = _; | |
return render; | |
}; | |
render.padding = function(_) { | |
if (!arguments.length) return padding; | |
padding = _; | |
return render; | |
}; | |
return render; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(r){function n(r){return r}function t(r,n){for(var t=0,e=n.length,u=Array(e);e>t;++t)u[t]=r[n[t]];return u}function e(r){function n(n,t,e,u){for(;u>e;){var f=e+u>>>1;r(n[f])<t?e=f+1:u=f}return e}function t(n,t,e,u){for(;u>e;){var f=e+u>>>1;t<r(n[f])?u=f:e=f+1}return e}return t.right=t,t.left=n,t}function u(r){function n(r,n,t){for(var u=t-n,f=(u>>>1)+1;--f>0;)e(r,f,u,n);return r}function t(r,n,t){for(var u,f=t-n;--f>0;)u=r[n],r[n]=r[n+f],r[n+f]=u,e(r,1,f,n);return r}function e(n,t,e,u){for(var f,o=n[--u+t],i=r(o);(f=t<<1)<=e&&(e>f&&r(n[u+f])>r(n[u+f+1])&&f++,!(i<=r(n[u+f])));)n[u+t]=n[u+f],t=f;n[u+t]=o}return n.sort=t,n}function f(r){function n(n,e,u,f){var o,i,a,c,l=Array(f=Math.min(u-e,f));for(i=0;f>i;++i)l[i]=n[e++];if(t(l,0,f),u>e){o=r(l[0]);do(a=r(c=n[e])>o)&&(l[0]=c,o=r(t(l,0,f)[0]));while(++e<u)}return l}var t=u(r);return n}function o(r){function n(n,t,e){for(var u=t+1;e>u;++u){for(var f=u,o=n[u],i=r(o);f>t&&r(n[f-1])>i;--f)n[f]=n[f-1];n[f]=o}return n}return n}function i(r){function n(r,n,u){return(U>u-n?e:t)(r,n,u)}function t(t,e,u){var f,o=0|(u-e)/6,i=e+o,a=u-1-o,c=e+u-1>>1,l=c-o,v=c+o,s=t[i],h=r(s),p=t[l],d=r(p),g=t[c],y=r(g),m=t[v],b=r(m),x=t[a],A=r(x);h>d&&(f=s,s=p,p=f,f=h,h=d,d=f),b>A&&(f=m,m=x,x=f,f=b,b=A,A=f),h>y&&(f=s,s=g,g=f,f=h,h=y,y=f),d>y&&(f=p,p=g,g=f,f=d,d=y,y=f),h>b&&(f=s,s=m,m=f,f=h,h=b,b=f),y>b&&(f=g,g=m,m=f,f=y,y=b,b=f),d>A&&(f=p,p=x,x=f,f=d,d=A,A=f),d>y&&(f=p,p=g,g=f,f=d,d=y,y=f),b>A&&(f=m,m=x,x=f,f=b,b=A,A=f);var k=p,O=d,E=m,w=b;t[i]=s,t[l]=t[e],t[c]=g,t[v]=t[u-1],t[a]=x;var M=e+1,U=u-2,z=w>=O&&O>=w;if(z)for(var N=M;U>=N;++N){var C=t[N],S=r(C);if(O>S)N!==M&&(t[N]=t[M],t[M]=C),++M;else if(S>O)for(;;){var q=r(t[U]);{if(!(q>O)){if(O>q){t[N]=t[M],t[M++]=t[U],t[U--]=C;break}t[N]=t[U],t[U--]=C;break}U--}}}else for(var N=M;U>=N;N++){var C=t[N],S=r(C);if(O>S)N!==M&&(t[N]=t[M],t[M]=C),++M;else if(S>w)for(;;){var q=r(t[U]);{if(!(q>w)){O>q?(t[N]=t[M],t[M++]=t[U],t[U--]=C):(t[N]=t[U],t[U--]=C);break}if(U--,N>U)break}}}if(t[e]=t[M-1],t[M-1]=k,t[u-1]=t[U+1],t[U+1]=E,n(t,e,M-1),n(t,U+2,u),z)return t;if(i>M&&U>a){for(var F,q;(F=r(t[M]))<=O&&F>=O;)++M;for(;(q=r(t[U]))<=w&&q>=w;)--U;for(var N=M;U>=N;N++){var C=t[N],S=r(C);if(O>=S&&S>=O)N!==M&&(t[N]=t[M],t[M]=C),M++;else if(w>=S&&S>=w)for(;;){var q=r(t[U]);{if(!(w>=q&&q>=w)){O>q?(t[N]=t[M],t[M++]=t[U],t[U--]=C):(t[N]=t[U],t[U--]=C);break}if(U--,N>U)break}}}}return n(t,M,U+1)}var e=o(r);return n}function a(r){return Array(r)}function c(r,n){return function(t){var e=t.length;return[r.left(t,n,0,e),r.right(t,n,0,e)]}}function l(r,n){var t=n[0],e=n[1];return function(n){var u=n.length;return[r.left(n,t,0,u),r.left(n,e,0,u)]}}function v(r){return[0,r.length]}function s(){return null}function h(){return 0}function p(r){return r+1}function d(r){return r-1}function g(r){return function(n,t){return n+ +r(t)}}function y(r){return function(n,t){return n-r(t)}}function m(){function r(r){var n=w,t=r.length;return t&&(E=E.concat(r),N=S(N,w+=t),F.forEach(function(e){e(r,n,t)})),O}function e(){for(var r=b(w,w),n=[],t=0,e=0;w>t;++t)N[t]?r[t]=e++:n.push(t);C.forEach(function(r){r(0,[],n)}),R.forEach(function(n){n(r)});for(var u,t=0,e=0;w>t;++t)(u=N[t])&&(t!==e&&(N[e]=u,E[e]=E[t]),++e);for(E.length=e;w>e;)N[--w]=0}function o(r){function e(n,e,u){T=n.map(r),V=$(x(u),0,u),T=t(T,V);var f,o=_(T),i=o[0],a=o[1];if(W)for(f=0;u>f;++f)W(T[f],f)||(N[V[f]+e]|=Y);else{for(f=0;i>f;++f)N[V[f]+e]|=Y;for(f=a;u>f;++f)N[V[f]+e]|=Y}if(!e)return P=T,Q=V,tn=i,en=a,void 0;var c=P,l=Q,v=0,s=0;for(P=Array(w),Q=b(w,w),f=0;e>v&&u>s;++f)c[v]<T[s]?(P[f]=c[v],Q[f]=l[v++]):(P[f]=T[s],Q[f]=V[s++]+e);for(;e>v;++v,++f)P[f]=c[v],Q[f]=l[v];for(;u>s;++s,++f)P[f]=T[s],Q[f]=V[s]+e;o=_(P),tn=o[0],en=o[1]}function o(r,n,t){rn.forEach(function(r){r(T,V,n,t)}),T=V=null}function a(r){for(var n,t=0,e=0;w>t;++t)N[n=Q[t]]&&(t!==e&&(P[e]=P[t]),Q[e]=r[n],++e);for(P.length=e;w>e;)Q[e++]=0;var u=_(P);tn=u[0],en=u[1]}function m(r){var n=r[0],t=r[1];if(W)return W=null,G(function(r,e){return e>=n&&t>e}),tn=n,en=t,X;var e,u,f,o=[],i=[];if(tn>n)for(e=n,u=Math.min(tn,t);u>e;++e)N[f=Q[e]]^=Y,o.push(f);else if(n>tn)for(e=tn,u=Math.min(n,en);u>e;++e)N[f=Q[e]]^=Y,i.push(f);if(t>en)for(e=Math.max(n,en),u=t;u>e;++e)N[f=Q[e]]^=Y,o.push(f);else if(en>t)for(e=Math.max(tn,t),u=en;u>e;++e)N[f=Q[e]]^=Y,i.push(f);return tn=n,en=t,C.forEach(function(r){r(Y,o,i)}),X}function O(r){return null==r?B():Array.isArray(r)?j(r):"function"==typeof r?D(r):z(r)}function z(r){return m((_=c(k,r))(P))}function j(r){return m((_=l(k,r))(P))}function B(){return m((_=v)(P))}function D(r){return _=v,G(W=r),tn=0,en=w,X}function G(r){var n,t,e,u=[],f=[];for(n=0;w>n;++n)!(N[t=Q[n]]&Y)^(e=r(P[n],n))&&(e?(N[t]&=Z,u.push(t)):(N[t]|=Y,f.push(t)));C.forEach(function(r){r(Y,u,f)})}function H(r){for(var n,t=[],e=en;--e>=tn&&r>0;)N[n=Q[e]]||(t.push(E[n]),--r);return t}function I(r){for(var n,t=[],e=tn;en>e&&r>0;)N[n=Q[e]]||(t.push(E[n]),--r),e++;return t}function J(r){function t(n,t,e,u){function f(){++T===L&&(m=q(m,K<<=1),B=q(B,K),L=A(K))}var l,v,h,p,d,g,y=j,m=b(T,L),x=H,k=J,O=T,M=0,U=0;for(X&&(x=k=s),j=Array(T),T=0,B=O>1?S(B,w):b(w,L),O&&(h=(v=y[0]).key);u>U&&!((p=r(n[U]))>=p);)++U;for(;u>U;){for(v&&p>=h?(d=v,g=h,m[M]=T,(v=y[++M])&&(h=v.key)):(d={key:p,value:k()},g=p),j[T]=d;!(p>g||(B[l=t[U]+e]=T,N[l]&Z||(d.value=x(d.value,E[l])),++U>=u));)p=r(n[U]);f()}for(;O>M;)j[m[M]=T]=y[M++],f();if(T>M)for(M=0;e>M;++M)B[M]=m[B[M]];l=C.indexOf(V),T>1?(V=o,W=a):(1===T?(V=i,W=c):(V=s,W=s),B=null),C[l]=V}function e(){if(T>1){for(var r=T,n=j,t=b(r,r),e=0,u=0;w>e;++e)N[e]&&(t[B[u]=B[e]]=1,++u);for(j=[],T=0,e=0;r>e;++e)t[e]&&(t[e]=T++,j.push(n[e]));if(T>1)for(var e=0;u>e;++e)B[e]=t[B[e]];else B=null;C[C.indexOf(V)]=T>1?(W=a,V=o):1===T?(W=c,V=i):W=V=s}else if(1===T){for(var e=0;w>e;++e)if(N[e])return;j=[],T=0,C[C.indexOf(V)]=V=W=s}}function o(r,n,t){if(r!==Y&&!X){var e,u,f,o;for(e=0,f=n.length;f>e;++e)N[u=n[e]]&Z||(o=j[B[u]],o.value=H(o.value,E[u]));for(e=0,f=t.length;f>e;++e)(N[u=t[e]]&Z)===r&&(o=j[B[u]],o.value=I(o.value,E[u]))}}function i(r,n,t){if(r!==Y&&!X){var e,u,f,o=j[0];for(e=0,f=n.length;f>e;++e)N[u=n[e]]&Z||(o.value=H(o.value,E[u]));for(e=0,f=t.length;f>e;++e)(N[u=t[e]]&Z)===r&&(o.value=I(o.value,E[u]))}}function a(){var r,n;for(r=0;T>r;++r)j[r].value=J();for(r=0;w>r;++r)N[r]&Z||(n=j[B[r]],n.value=H(n.value,E[r]))}function c(){var r,n=j[0];for(n.value=J(),r=0;w>r;++r)N[r]&Z||(n.value=H(n.value,E[r]))}function l(){return X&&(W(),X=!1),j}function v(r){var n=D(l(),0,j.length,r);return G.sort(n,0,n.length)}function m(r,n,t){return H=r,I=n,J=t,X=!0,F}function x(){return m(p,d,h)}function k(r){return m(g(r),y(r),h)}function O(r){function n(n){return r(n.value)}return D=f(n),G=u(n),F}function M(){return O(n)}function U(){return T}function z(){var r=C.indexOf(V);return r>=0&&C.splice(r,1),r=rn.indexOf(t),r>=0&&rn.splice(r,1),r=R.indexOf(e),r>=0&&R.splice(r,1),F}var F={top:v,all:l,reduce:m,reduceCount:x,reduceSum:k,order:O,orderNatural:M,size:U,dispose:z,remove:z};nn.push(F);var j,B,D,G,H,I,J,K=8,L=A(K),T=0,V=s,W=s,X=!0;return arguments.length<1&&(r=n),C.push(V),rn.push(t),R.push(e),t(P,Q,0,w),x().orderNatural()}function K(){var r=J(s),n=r.all;return delete r.all,delete r.top,delete r.order,delete r.orderNatural,delete r.size,r.value=function(){return n()[0].value},r}function L(){nn.forEach(function(r){r.dispose()});var r=F.indexOf(e);for(r>=0&&F.splice(r,1),r=F.indexOf(o),r>=0&&F.splice(r,1),r=R.indexOf(a),r>=0&&R.splice(r,1),r=0;w>r;++r)N[r]&=Z;return M&=Z,X}var P,Q,T,V,W,X={filter:O,filterExact:z,filterRange:j,filterFunction:D,filterAll:B,top:H,bottom:I,group:J,groupAll:K,dispose:L,remove:L},Y=~M&-~M,Z=~Y,$=i(function(r){return T[r]}),_=v,rn=[],nn=[],tn=0,en=0;return F.unshift(e),F.push(o),R.push(a),M|=Y,(U>=32?!Y:M&(1<<U)-1)&&(N=q(N,U<<=1)),e(E,0,w),o(E,0,w),X}function a(){function r(r,n){var t;if(!m)for(t=n;w>t;++t)N[t]||(a=c(a,E[t]))}function n(r,n,t){var e,u,f;if(!m){for(e=0,f=n.length;f>e;++e)N[u=n[e]]||(a=c(a,E[u]));for(e=0,f=t.length;f>e;++e)N[u=t[e]]===r&&(a=l(a,E[u]))}}function t(){var r;for(a=v(),r=0;w>r;++r)N[r]||(a=c(a,E[r]))}function e(r,n,t){return c=r,l=n,v=t,m=!0,s}function u(){return e(p,d,h)}function f(r){return e(g(r),y(r),h)}function o(){return m&&(t(),m=!1),a}function i(){var t=C.indexOf(n);return t>=0&&C.splice(t),t=F.indexOf(r),t>=0&&F.splice(t),s}var a,c,l,v,s={reduce:e,reduceCount:u,reduceSum:f,value:o,dispose:i,remove:i},m=!0;return C.push(n),F.push(r),r(E,0,w),u()}function m(){return w}var O={add:r,remove:e,dimension:o,groupAll:a,size:m},E=[],w=0,M=0,U=8,N=z(0),C=[],F=[],R=[];return arguments.length?r(arguments[0]):O}function b(r,n){return(257>n?z:65537>n?N:C)(r)}function x(r){for(var n=b(r,r),t=-1;++t<r;)n[t]=t;return n}function A(r){return 8===r?256:16===r?65536:4294967296}m.version="1.3.5",m.permute=t;var k=m.bisect=e(n);k.by=e;var O=m.heap=u(n);O.by=u;var E=m.heapselect=f(n);E.by=f;var w=m.insertionsort=o(n);w.by=o;var M=m.quicksort=i(n);M.by=i;var U=32,z=a,N=a,C=a,S=n,q=n;"undefined"!=typeof Uint8Array&&(z=function(r){return new Uint8Array(r)},N=function(r){return new Uint16Array(r)},C=function(r){return new Uint32Array(r)},S=function(r,n){if(r.length>=n)return r;var t=new r.constructor(n);return t.set(r),t},q=function(r,n){var t;switch(n){case 16:t=N(r.length);break;case 32:t=C(r.length);break;default:throw Error("invalid array width!")}return t.set(r),t}),r.crossfilter=m}(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(){d3.hexbin=function(){function u(n){var r={};return n.forEach(function(n,t){var a=s.call(u,n,t)/o,e=Math.round(a),c=h.call(u,n,t)/i-(1&e?.5:0),f=Math.round(c),l=a-e;if(3*Math.abs(l)>1){var v=c-f,g=f+(f>c?-1:1)/2,m=e+(e>a?-1:1),M=c-g,d=a-m;v*v+l*l>M*M+d*d&&(f=g+(1&e?1:-1)/2,e=m)}var j=f+"-"+e,p=r[j];p?p.push(n):(p=r[j]=[n],p.i=f,p.j=e,p.x=(f+(1&e?.5:0))*i,p.y=e*o)}),d3.values(r)}function a(r){var t=0,u=0;return n.map(function(n){var a=Math.sin(n)*r,e=-Math.cos(n)*r,i=a-t,o=e-u;return t=a,u=e,[i,o]})}var e,i,o,c=1,f=1,h=r,s=t;return u.x=function(n){return arguments.length?(h=n,u):h},u.y=function(n){return arguments.length?(s=n,u):s},u.hexagon=function(n){return arguments.length<1&&(n=e),"m"+a(n).join("l")+"z"},u.centers=function(){for(var n=[],r=0,t=!1,u=0;f+e>r;r+=o,t=!t,++u)for(var a=t?i/2:0,h=0;c+i/2>a;a+=i,++h){var s=[a,r];s.i=h,s.j=u,n.push(s)}return n},u.mesh=function(){var n=a(e).slice(0,4).join("l");return u.centers().map(function(r){return"M"+r+"m"+n}).join("")},u.size=function(n){return arguments.length?(c=+n[0],f=+n[1],u):[c,f]},u.radius=function(n){return arguments.length?(e=+n,i=2*e*Math.sin(Math.PI/3),o=1.5*e,u):e},u.radius(1)};var n=d3.range(0,2*Math.PI,Math.PI/3),r=function(n){return n[0]},t=function(n){return n[1]}}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function u(){}function i(n){return aa+n in this}function o(n){return n=aa+n,n in this&&delete this[n]}function a(){var n=[];return this.forEach(function(t){n.push(t)}),n}function c(){var n=0;for(var t in this)t.charCodeAt(0)===ca&&++n;return n}function s(){for(var n in this)if(n.charCodeAt(0)===ca)return!1;return!0}function l(){}function f(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function h(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=sa.length;r>e;++e){var u=sa[e]+t;if(u in n)return u}}function g(){}function p(){}function v(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new u;return t.on=function(t,u){var i,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,i=e.indexOf(o)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function d(){Xo.event.preventDefault()}function m(){for(var n,t=Xo.event;n=t.sourceEvent;)t=n;return t}function y(n){for(var t=new p,e=0,r=arguments.length;++e<r;)t[arguments[e]]=v(t);return t.of=function(e,r){return function(u){try{var i=u.sourceEvent=Xo.event;u.target=n,Xo.event=u,t[u.type].apply(e,r)}finally{Xo.event=i}}},t}function x(n){return fa(n,da),n}function M(n){return"function"==typeof n?n:function(){return ha(n,this)}}function _(n){return"function"==typeof n?n:function(){return ga(n,this)}}function b(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function u(){this.setAttribute(n,t)}function i(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=Xo.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?i:u}function w(n){return n.trim().replace(/\s+/g," ")}function S(n){return new RegExp("(?:^|\\s+)"+Xo.requote(n)+"(?:\\s+|$)","g")}function k(n){return n.trim().split(/^|\s+/)}function E(n,t){function e(){for(var e=-1;++e<u;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<u;)n[e](this,r)}n=k(n).map(A);var u=n.length;return"function"==typeof t?r:e}function A(n){var t=S(n);return function(e,r){if(u=e.classList)return r?u.add(n):u.remove(n);var u=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(u)||e.setAttribute("class",w(u+" "+n))):e.setAttribute("class",w(u.replace(t," ")))}}function C(n,t,e){function r(){this.style.removeProperty(n)}function u(){this.style.setProperty(n,t,e)}function i(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?i:u}function N(n,t){function e(){delete this[n]}function r(){this[n]=t}function u(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?u:r}function L(n){return"function"==typeof n?n:(n=Xo.ns.qualify(n)).local?function(){return this.ownerDocument.createElementNS(n.space,n.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,n)}}function z(n){return{__data__:n}}function q(n){return function(){return va(this,n)}}function T(n){return arguments.length||(n=Xo.ascending),function(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}}function R(n,t){for(var e=0,r=n.length;r>e;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function D(n){return fa(n,ya),n}function P(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t<c;);return o}}function U(){var n=this.__transition__;n&&++n.active}function j(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function u(){var u=c(t,Bo(arguments));r.call(this),this.addEventListener(n,this[o]=u,u.$=e),u._=t}function i(){var t,e=new RegExp("^__on([^.]+)"+Xo.requote(n)+"$");for(var r in this)if(t=r.match(e)){var u=this[r];this.removeEventListener(t[1],u,u.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),c=H;a>0&&(n=n.substring(0,a));var s=Ma.get(n);return s&&(n=s,c=F),a?t?u:r:t?g:i}function H(n,t){return function(e){var r=Xo.event;Xo.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{Xo.event=r}}}function F(n,t){var e=H(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function O(){var n=".dragsuppress-"+ ++ba,t="click"+n,e=Xo.select(Go).on("touchmove"+n,d).on("dragstart"+n,d).on("selectstart"+n,d);if(_a){var r=Jo.style,u=r[_a];r[_a]="none"}return function(i){function o(){e.on(t,null)}e.on(n,null),_a&&(r[_a]=u),i&&(e.on(t,function(){d(),o()},!0),setTimeout(o,0))}}function Y(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>wa&&(Go.scrollX||Go.scrollY)){e=Xo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();wa=!(u.f||u.e),e.remove()}return wa?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}function I(n){return n>0?1:0>n?-1:0}function Z(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function V(n){return n>1?0:-1>n?Sa:Math.acos(n)}function X(n){return n>1?Ea:-1>n?-Ea:Math.asin(n)}function $(n){return((n=Math.exp(n))-1/n)/2}function B(n){return((n=Math.exp(n))+1/n)/2}function W(n){return((n=Math.exp(2*n))-1)/(n+1)}function J(n){return(n=Math.sin(n/2))*n}function G(){}function K(n,t,e){return new Q(n,t,e)}function Q(n,t,e){this.h=n,this.s=t,this.l=e}function nt(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,gt(u(n+120),u(n),u(n-120))}function tt(n,t,e){return new et(n,t,e)}function et(n,t,e){this.h=n,this.c=t,this.l=e}function rt(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),ut(e,Math.cos(n*=Na)*t,Math.sin(n)*t)}function ut(n,t,e){return new it(n,t,e)}function it(n,t,e){this.l=n,this.a=t,this.b=e}function ot(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=ct(u)*Fa,r=ct(r)*Oa,i=ct(i)*Ya,gt(lt(3.2404542*u-1.5371385*r-.4985314*i),lt(-.969266*u+1.8760108*r+.041556*i),lt(.0556434*u-.2040259*r+1.0572252*i))}function at(n,t,e){return n>0?tt(Math.atan2(e,t)*La,Math.sqrt(t*t+e*e),n):tt(0/0,0/0,n)}function ct(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function st(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function lt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function ft(n){return gt(n>>16,255&n>>8,255&n)}function ht(n){return ft(n)+""}function gt(n,t,e){return new pt(n,t,e)}function pt(n,t,e){this.r=n,this.g=t,this.b=e}function vt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function dt(n,t,e){var r,u,i,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(Mt(u[0]),Mt(u[1]),Mt(u[2]))}return(i=Va.get(n))?t(i.r,i.g,i.b):(null!=n&&"#"===n.charAt(0)&&(4===n.length?(o=n.charAt(1),o+=o,a=n.charAt(2),a+=a,c=n.charAt(3),c+=c):7===n.length&&(o=n.substring(1,3),a=n.substring(3,5),c=n.substring(5,7)),o=parseInt(o,16),a=parseInt(a,16),c=parseInt(c,16)),t(o,a,c))}function mt(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),K(r,u,c)}function yt(n,t,e){n=xt(n),t=xt(t),e=xt(e);var r=st((.4124564*n+.3575761*t+.1804375*e)/Fa),u=st((.2126729*n+.7151522*t+.072175*e)/Oa),i=st((.0193339*n+.119192*t+.9503041*e)/Ya);return ut(116*u-16,500*(r-u),200*(u-i))}function xt(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Mt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function _t(n){return"function"==typeof n?n:function(){return n}}function bt(n){return n}function wt(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),St(t,e,n,r)}}function St(n,t,e,r){function u(){var n,t=c.status;if(!t&&c.responseText||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return o.error.call(i,r),void 0}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=Xo.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,s=null;return!Go.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=Xo.event;Xo.event=n;try{o.progress.call(i,c)}finally{Xo.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(s=n,i):s},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(Bo(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var l in a)c.setRequestHeader(l,a[l]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=s&&(c.responseType=s),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},Xo.rebind(i,o,"on"),null==r?i:i.get(kt(r))}function kt(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function Et(){var n=At(),t=Ct()-n;t>24?(isFinite(t)&&(clearTimeout(Wa),Wa=setTimeout(Et,t)),Ba=0):(Ba=1,Ga(Et))}function At(){var n=Date.now();for(Ja=Xa;Ja;)n>=Ja.t&&(Ja.f=Ja.c(n-Ja.t)),Ja=Ja.n;return n}function Ct(){for(var n,t=Xa,e=1/0;t;)t.f?t=n?n.n=t.n:Xa=t.n:(t.t<e&&(e=t.t),t=(n=t).n);return $a=n,e}function Nt(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Lt(n,t){var e=Math.pow(10,3*oa(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function zt(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r?function(n){for(var t=n.length,u=[],i=0,o=r[0];t>0&&o>0;)u.push(n.substring(t-=o,t+o)),o=r[i=(i+1)%r.length];return u.reverse().join(e)}:bt;return function(n){var e=Qa.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"",c=e[4]||"",s=e[5],l=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1;switch(h&&(h=+h.substring(1)),(s||"0"===r&&"="===o)&&(s=r="0",o="=",f&&(l-=Math.floor((l-1)/4))),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=nc.get(g)||qt;var y=s&&f;return function(n){if(m&&n%1)return"";var e=0>n||0===n&&0>1/n?(n=-n,"-"):a;if(0>p){var u=Xo.formatPrefix(n,h);n=u.scale(n),d=u.symbol}else n*=p;n=g(n,h);var c=n.lastIndexOf("."),x=0>c?n:n.substring(0,c),M=0>c?"":t+n.substring(c+1);!s&&f&&(x=i(x));var _=v.length+x.length+M.length+(y?0:e.length),b=l>_?new Array(_=l-_+1).join(r):"";return y&&(x=i(b+x)),e+=v,n=x+M,("<"===o?e+n+b:">"===o?b+e+n:"^"===o?b.substring(0,_>>=1)+e+n+b.substring(_):e+(y?n:b+n))+d}}}function qt(n){return n+""}function Tt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Rt(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new ec(e-1)),1),e}function i(n,e){return t(n=new ec(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{ec=Tt;var r=new Tt;return r._=n,o(r,t,e)}finally{ec=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Dt(n);return c.floor=c,c.round=Dt(r),c.ceil=Dt(u),c.offset=Dt(i),c.range=a,n}function Dt(n){return function(t,e){try{ec=Tt;var r=new Tt;return r._=t,n(r,e)._}finally{ec=Date}}}function Pt(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++a<r;)37===n.charCodeAt(a)&&(o.push(n.substring(c,a)),null!=(u=uc[e=n.charAt(++a)])&&(e=n.charAt(++a)),(i=C[e])&&(e=i(t,null==u?"e"===e?" ":"0":u)),o.push(e),c=a+1);return o.push(n.substring(c,a)),o.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},u=e(r,n,t,0);if(u!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var i=null!=r.Z&&ec!==Tt,o=new(i?Tt:ec);return"j"in r?o.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+Math.floor(r.Z/100),r.M+r.Z%100,r.S,r.L),i?o._:o},t.toString=function(){return n},t}function e(n,t,e,r){for(var u,i,o,a=0,c=t.length,s=e.length;c>a;){if(r>=s)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=N[o in uc?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){b.lastIndex=0;var r=b.exec(t.substring(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){M.lastIndex=0;var r=M.exec(t.substring(e));return r?(n.w=_.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.substring(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.substring(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,C.c.toString(),t,r)}function c(n,t,r){return e(n,C.x.toString(),t,r)}function s(n,t,r){return e(n,C.X.toString(),t,r)}function l(n,t,e){var r=x.get(t.substring(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{ec=Tt;var t=new ec;return t._=n,r(t)}finally{ec=Date}}var r=t(n);return e.parse=function(n){try{ec=Tt;var t=r.parse(n);return t&&t._}finally{ec=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ee;var x=Xo.map(),M=jt(v),_=Ht(v),b=jt(d),w=Ht(d),S=jt(m),k=Ht(m),E=jt(y),A=Ht(y);p.forEach(function(n,t){x.set(n.toLowerCase(),t)});var C={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return Ut(n.getDate(),t,2)},e:function(n,t){return Ut(n.getDate(),t,2)},H:function(n,t){return Ut(n.getHours(),t,2)},I:function(n,t){return Ut(n.getHours()%12||12,t,2)},j:function(n,t){return Ut(1+tc.dayOfYear(n),t,3)},L:function(n,t){return Ut(n.getMilliseconds(),t,3)},m:function(n,t){return Ut(n.getMonth()+1,t,2)},M:function(n,t){return Ut(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return Ut(n.getSeconds(),t,2)},U:function(n,t){return Ut(tc.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Ut(tc.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return Ut(n.getFullYear()%100,t,2)},Y:function(n,t){return Ut(n.getFullYear()%1e4,t,4)},Z:ne,"%":function(){return"%"}},N={a:r,A:u,b:i,B:o,c:a,d:Bt,e:Bt,H:Jt,I:Jt,j:Wt,L:Qt,m:$t,M:Gt,p:l,S:Kt,U:Ot,w:Ft,W:Yt,x:c,X:s,y:Zt,Y:It,Z:Vt,"%":te};return t}function Ut(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function jt(n){return new RegExp("^(?:"+n.map(Xo.requote).join("|")+")","i")}function Ht(n){for(var t=new u,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Ft(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Ot(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e));return r?(n.U=+r[0],e+r[0].length):-1}function Yt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e));return r?(n.W=+r[0],e+r[0].length):-1}function It(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Zt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.y=Xt(+r[0]),e+r[0].length):-1}function Vt(n,t,e){return/^[+-]\d{4}$/.test(t=t.substring(e,e+5))?(n.Z=+t,e+5):-1}function Xt(n){return n+(n>68?1900:2e3)}function $t(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Bt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function Wt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function Jt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function Gt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function Kt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function Qt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function ne(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=~~(oa(t)/60),u=oa(t)%60;return e+Ut(r,"0",2)+Ut(u,"0",2)}function te(n,t,e){oc.lastIndex=0;var r=oc.exec(t.substring(e,e+1));return r?e+r[0].length:-1}function ee(n){for(var t=n.length,e=-1;++e<t;)n[e][0]=this(n[e][0]);return function(t){for(var e=0,r=n[e];!r[1](t);)r=n[++e];return r[0](t)}}function re(){}function ue(n,t,e){var r=e.s=n+t,u=r-n,i=r-u;e.t=n-i+(t-u)}function ie(n,t){n&&lc.hasOwnProperty(n.type)&&lc[n.type](n,t)}function oe(n,t,e){var r,u=-1,i=n.length-e;for(t.lineStart();++u<i;)r=n[u],t.point(r[0],r[1],r[2]);t.lineEnd()}function ae(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)oe(n[e],t,1);t.polygonEnd()}function ce(){function n(n,t){n*=Na,t=t*Na/2+Sa/4;var e=n-r,o=Math.cos(t),a=Math.sin(t),c=i*a,s=u*o+c*Math.cos(e),l=c*Math.sin(e);hc.add(Math.atan2(l,s)),r=n,u=o,i=a}var t,e,r,u,i;gc.point=function(o,a){gc.point=n,r=(t=o)*Na,u=Math.cos(a=(e=a)*Na/2+Sa/4),i=Math.sin(a)},gc.lineEnd=function(){n(t,e)}}function se(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function le(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function fe(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function he(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function ge(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function pe(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function ve(n){return[Math.atan2(n[1],n[0]),X(n[2])]}function de(n,t){return oa(n[0]-t[0])<Aa&&oa(n[1]-t[1])<Aa}function me(n,t){n*=Na;var e=Math.cos(t*=Na);ye(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function ye(n,t,e){++pc,dc+=(n-dc)/pc,mc+=(t-mc)/pc,yc+=(e-yc)/pc}function xe(){function n(n,u){n*=Na;var i=Math.cos(u*=Na),o=i*Math.cos(n),a=i*Math.sin(n),c=Math.sin(u),s=Math.atan2(Math.sqrt((s=e*c-r*a)*s+(s=r*o-t*c)*s+(s=t*a-e*o)*s),t*o+e*a+r*c);vc+=s,xc+=s*(t+(t=o)),Mc+=s*(e+(e=a)),_c+=s*(r+(r=c)),ye(t,e,r)}var t,e,r;kc.point=function(u,i){u*=Na;var o=Math.cos(i*=Na);t=o*Math.cos(u),e=o*Math.sin(u),r=Math.sin(i),kc.point=n,ye(t,e,r)}}function Me(){kc.point=me}function _e(){function n(n,t){n*=Na;var e=Math.cos(t*=Na),o=e*Math.cos(n),a=e*Math.sin(n),c=Math.sin(t),s=u*c-i*a,l=i*o-r*c,f=r*a-u*o,h=Math.sqrt(s*s+l*l+f*f),g=r*o+u*a+i*c,p=h&&-V(g)/h,v=Math.atan2(h,g);bc+=p*s,wc+=p*l,Sc+=p*f,vc+=v,xc+=v*(r+(r=o)),Mc+=v*(u+(u=a)),_c+=v*(i+(i=c)),ye(r,u,i)}var t,e,r,u,i;kc.point=function(o,a){t=o,e=a,kc.point=n,o*=Na;var c=Math.cos(a*=Na);r=c*Math.cos(o),u=c*Math.sin(o),i=Math.sin(a),ye(r,u,i)},kc.lineEnd=function(){n(t,e),kc.lineEnd=Me,kc.point=me}}function be(){return!0}function we(n,t,e,r,u){var i=[],o=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(de(e,r)){u.lineStart();for(var a=0;t>a;++a)u.point((e=n[a])[0],e[1]);return u.lineEnd(),void 0}var c=new ke(e,n,null,!0),s=new ke(e,null,c,!1);c.o=s,i.push(c),o.push(s),c=new ke(r,n,null,!1),s=new ke(r,null,c,!0),c.o=s,i.push(c),o.push(s)}}),o.sort(t),Se(i),Se(o),i.length){for(var a=0,c=e,s=o.length;s>a;++a)o[a].e=c=!c;for(var l,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;l=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,s=l.length;s>a;++a)u.point((f=l[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){l=g.p.z;for(var a=l.length-1;a>=0;--a)u.point((f=l[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,l=g.z,p=!p}while(!g.v);u.lineEnd()}}}function Se(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r<t;)u.n=e=n[r],e.p=u,u=e;u.n=e=n[0],e.p=u}}function ke(n,t,e,r){this.x=n,this.z=t,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Ee(n,t,e,r){return function(u,i){function o(t,e){var r=u(t,e);n(t=r[0],e=r[1])&&i.point(t,e)}function a(n,t){var e=u(n,t);d.point(e[0],e[1])}function c(){y.point=a,d.lineStart()}function s(){y.point=o,d.lineEnd()}function l(n,t){v.push([n,t]);var e=u(n,t);M.point(e[0],e[1])}function f(){M.lineStart(),v=[]}function h(){l(v[0][0],v[0][1]),M.lineEnd();var n,t=M.clean(),e=x.buffer(),r=e.length;if(v.pop(),p.push(v),v=null,r){if(1&t){n=e[0];var u,r=n.length-1,o=-1;for(i.lineStart();++o<r;)i.point((u=n[o])[0],u[1]);return i.lineEnd(),void 0}r>1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Ae))}}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:s,polygonStart:function(){y.point=l,y.lineStart=f,y.lineEnd=h,g=[],p=[],i.polygonStart()},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=s,g=Xo.merge(g);var n=Le(m,p);g.length?we(g,Ne,n,e,i):n&&(i.lineStart(),e(null,null,1,i),i.lineEnd()),i.polygonEnd(),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},x=Ce(),M=t(x);return y}}function Ae(n){return n.length>1}function Ce(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:g,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ne(n,t){return((n=n.x)[0]<0?n[1]-Ea-Aa:Ea-n[1])-((t=t.x)[0]<0?t[1]-Ea-Aa:Ea-t[1])}function Le(n,t){var e=n[0],r=n[1],u=[Math.sin(e),-Math.cos(e),0],i=0,o=0;hc.reset();for(var a=0,c=t.length;c>a;++a){var s=t[a],l=s.length;if(l)for(var f=s[0],h=f[0],g=f[1]/2+Sa/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===l&&(d=0),n=s[d];var m=n[0],y=n[1]/2+Sa/4,x=Math.sin(y),M=Math.cos(y),_=m-h,b=oa(_)>Sa,w=p*x;if(hc.add(Math.atan2(w*Math.sin(_),v*M+w*Math.cos(_))),i+=b?_+(_>=0?ka:-ka):_,b^h>=e^m>=e){var S=fe(se(f),se(n));pe(S);var k=fe(u,S);pe(k);var E=(b^_>=0?-1:1)*X(k[2]);(r>E||r===E&&(S[0]||S[1]))&&(o+=b^_>=0?1:-1)}if(!d++)break;h=m,p=x,v=M,f=n}}return(-Aa>i||Aa>i&&0>hc)^1&o}function ze(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?Sa:-Sa,c=oa(i-e);oa(c-Sa)<Aa?(n.point(e,r=(r+o)/2>0?Ea:-Ea),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=Sa&&(oa(e-u)<Aa&&(e-=u*Aa),oa(i-a)<Aa&&(i-=a*Aa),r=qe(e,r,i,o),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=i,r=o),u=a},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function qe(n,t,e,r){var u,i,o=Math.sin(n-e);return oa(o)>Aa?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function Te(n,t,e,r){var u;if(null==n)u=e*Ea,r.point(-Sa,u),r.point(0,u),r.point(Sa,u),r.point(Sa,0),r.point(Sa,-u),r.point(0,-u),r.point(-Sa,-u),r.point(-Sa,0),r.point(-Sa,u);else if(oa(n[0]-t[0])>Aa){var i=n[0]<t[0]?Sa:-Sa;u=e*i/2,r.point(-i,u),r.point(0,u),r.point(i,u)}else r.point(t[0],t[1])}function Re(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,c,s,l;return{lineStart:function(){s=c=!1,l=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?Sa:-Sa),h):0;if(!e&&(s=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(de(e,g)||de(p,g))&&(p[0]+=Aa,p[1]+=Aa,v=t(p[0],p[1]))),v!==c)l=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(l=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&de(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return l|(s&&c)<<1}}}function r(n,t,e){var r=se(n),u=se(t),o=[1,0,0],a=fe(r,u),c=le(a,a),s=a[0],l=c-s*s;if(!l)return!e&&n;var f=i*c/l,h=-i*s/l,g=fe(o,a),p=ge(o,f),v=ge(a,h);he(p,v);var d=g,m=le(p,d),y=le(d,d),x=m*m-y*(le(p,p)-1);if(!(0>x)){var M=Math.sqrt(x),_=ge(d,(-m-M)/y);if(he(_,p),_=ve(_),!e)return _;var b,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(b=w,w=S,S=b);var A=S-w,C=oa(A-Sa)<Aa,N=C||Aa>A;if(!C&&k>E&&(b=k,k=E,E=b),N?C?k+E>0^_[1]<(oa(_[0]-w)<Aa?k:E):k<=_[1]&&_[1]<=E:A>Sa^(w<=_[0]&&_[0]<=S)){var L=ge(d,(-m+M)/y);return he(L,p),[_,ve(L)]}}}function u(t,e){var r=o?n:Sa-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=oa(i)>Aa,c=cr(n,6*Na);return Ee(t,e,c,o?[0,-n]:[-Sa,n-Sa])}function De(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,s=o.y,l=a.x,f=a.y,h=0,g=1,p=l-c,v=f-s;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-s,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-s,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:s+h*v}),1>g&&(u.b={x:c+g*p,y:s+g*v}),u}}}}}}function Pe(n,t,e,r){function u(r,u){return oa(r[0]-n)<Aa?u>0?0:3:oa(r[0]-e)<Aa?u>0?2:1:oa(r[1]-t)<Aa?u>0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,s=a[0];c>o;++o)i=a[o],s[1]<=r?i[1]>r&&Z(s,i,n)>0&&++t:i[1]<=r&&Z(s,i,n)<0&&--t,s=i;return 0!==t}function s(i,a,c,s){var l=0,f=0;if(null==i||(l=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do s.point(0===l||3===l?n:e,l>1?r:t);while((l=(l+c+4)%4)!==f)}else s.point(a[0],a[1])}function l(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){l(n,t)&&a.point(n,t)}function h(){N.point=p,d&&d.push(m=[]),S=!0,w=!1,_=b=0/0}function g(){v&&(p(y,x),M&&w&&A.rejoin(),v.push(A.buffer())),N.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Ac,Math.min(Ac,n)),t=Math.max(-Ac,Math.min(Ac,t));var e=l(n,t);if(d&&m.push([n,t]),S)y=n,x=t,M=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:_,y:b},b:{x:n,y:t}};C(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}_=n,b=t,w=e}var v,d,m,y,x,M,_,b,w,S,k,E=a,A=Ce(),C=De(n,t,e,r),N={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=Xo.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),u&&we(v,i,t,s,a),a.polygonEnd()),v=d=m=null}};return N}}function Ue(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function je(n){var t=0,e=Sa/3,r=nr(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*Sa/180,e=n[1]*Sa/180):[180*(t/Sa),180*(e/Sa)]},u}function He(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,X((i-(n*n+e*e)*u*u)/(2*u))]},e}function Fe(){function n(n,t){Nc+=u*n-r*t,r=n,u=t}var t,e,r,u;Rc.point=function(i,o){Rc.point=n,t=r=i,e=u=o},Rc.lineEnd=function(){n(t,e)}}function Oe(n,t){Lc>n&&(Lc=n),n>qc&&(qc=n),zc>t&&(zc=t),t>Tc&&(Tc=t)}function Ye(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=Ie(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=Ie(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Ie(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Ze(n,t){dc+=n,mc+=t,++yc}function Ve(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);xc+=o*(t+n)/2,Mc+=o*(e+r)/2,_c+=o,Ze(t=n,e=r)}var t,e;Pc.point=function(r,u){Pc.point=n,Ze(t=r,e=u)}}function Xe(){Pc.point=Ze}function $e(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);xc+=o*(r+n)/2,Mc+=o*(u+t)/2,_c+=o,o=u*n-r*t,bc+=o*(r+n),wc+=o*(u+t),Sc+=3*o,Ze(r=n,u=t)}var t,e,r,u;Pc.point=function(i,o){Pc.point=n,Ze(t=r=i,e=u=o)},Pc.lineEnd=function(){n(t,e)}}function Be(n){function t(t,e){n.moveTo(t,e),n.arc(t,e,o,0,ka)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:g};return a}function We(n){function t(n){return(a?r:e)(n)}function e(t){return Ke(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){x=0/0,S.point=i,t.lineStart()}function i(e,r){var i=se([e,r]),o=n(e,r);u(x,M,y,_,b,w,x=o[0],M=o[1],y=e,_=i[0],b=i[1],w=i[2],a,t),t.point(x,M)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=s,S.lineEnd=l}function s(n,t){i(f=n,h=t),g=x,p=M,v=_,d=b,m=w,S.point=i}function l(){u(x,M,y,_,b,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,x,M,_,b,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,s,l,f,h,g,p,v,d,m){var y=l-t,x=f-e,M=y*y+x*x;if(M>4*i&&d--){var _=a+g,b=c+p,w=s+v,S=Math.sqrt(_*_+b*b+w*w),k=Math.asin(w/=S),E=oa(oa(w)-1)<Aa||oa(r-h)<Aa?(r+h)/2:Math.atan2(b,_),A=n(E,k),C=A[0],N=A[1],L=C-t,z=N-e,q=x*L-y*z;(q*q/M>i||oa((y*L+x*z)/M-.5)>.3||o>a*g+c*p+s*v)&&(u(t,e,r,a,c,s,C,N,E,_/=S,b/=S,w,d,m),m.point(C,N),u(C,N,E,_,b,w,l,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Na),a=16;return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function Je(n){var t=We(function(t,e){return n([t*La,e*La])});return function(n){return tr(t(n))}}function Ge(n){this.stream=n}function Ke(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function Qe(n){return nr(function(){return n})()}function nr(n){function t(n){return n=a(n[0]*Na,n[1]*Na),[n[0]*h+c,s-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(s-n[1])/h),n&&[n[0]*La,n[1]*La]}function r(){a=Ue(o=ur(m,y,x),i);var n=i(v,d);return c=g-n[0]*h,s=p+n[1]*h,u()}function u(){return l&&(l.valid=!1,l=null),t}var i,o,a,c,s,l,f=We(function(n,t){return n=i(n,t),[n[0]*h+c,s-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,y=0,x=0,M=Ec,_=bt,b=null,w=null;return t.stream=function(n){return l&&(l.valid=!1),l=tr(M(o,f(_(n)))),l.valid=!0,l},t.clipAngle=function(n){return arguments.length?(M=null==n?(b=n,Ec):Re((b=+n)*Na),u()):b | |
},t.clipExtent=function(n){return arguments.length?(w=n,_=n?Pe(n[0][0],n[0][1],n[1][0],n[1][1]):bt,u()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Na,d=n[1]%360*Na,r()):[v*La,d*La]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Na,y=n[1]%360*Na,x=n.length>2?n[2]%360*Na:0,r()):[m*La,y*La,x*La]},Xo.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function tr(n){return Ke(n,function(t,e){n.point(t*Na,e*Na)})}function er(n,t){return[n,t]}function rr(n,t){return[n>Sa?n-ka:-Sa>n?n+ka:n,t]}function ur(n,t,e){return n?t||e?Ue(or(n),ar(t,e)):or(n):t||e?ar(t,e):rr}function ir(n){return function(t,e){return t+=n,[t>Sa?t-ka:-Sa>t?t+ka:t,e]}}function or(n){var t=ir(n);return t.invert=ir(-n),t}function ar(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,s=Math.sin(t),l=s*r+a*u;return[Math.atan2(c*i-l*o,a*r-s*u),X(l*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,s=Math.sin(t),l=s*i-c*o;return[Math.atan2(c*i+s*o,a*r+l*u),X(l*r-a*u)]},e}function cr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=sr(e,u),i=sr(e,i),(o>0?i>u:u>i)&&(u+=o*ka)):(u=n+o*ka,i=n-.5*c);for(var s,l=u;o>0?l>i:i>l;l-=c)a.point((s=ve([e,-r*Math.cos(l),-r*Math.sin(l)]))[0],s[1])}}function sr(n,t){var e=se(t);e[0]-=n,pe(e);var r=V(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Aa)%(2*Math.PI)}function lr(n,t,e){var r=Xo.range(n,t-Aa,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function fr(n,t,e){var r=Xo.range(n,t-Aa,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function hr(n){return n.source}function gr(n){return n.target}function pr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),s=u*Math.sin(n),l=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(J(r-t)+u*o*J(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*l,u=e*s+t*f,o=e*i+t*a;return[Math.atan2(u,r)*La,Math.atan2(o,Math.sqrt(r*r+u*u))*La]}:function(){return[n*La,t*La]};return p.distance=h,p}function vr(){function n(n,u){var i=Math.sin(u*=Na),o=Math.cos(u),a=oa((n*=Na)-t),c=Math.cos(a);Uc+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;jc.point=function(u,i){t=u*Na,e=Math.sin(i*=Na),r=Math.cos(i),jc.point=n},jc.lineEnd=function(){jc.point=jc.lineEnd=g}}function dr(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function mr(n,t){function e(n,t){var e=oa(oa(t)-Ea)<Aa?0:o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(Sa/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=I(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-Ea]},e):xr}function yr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return oa(u)<Aa?er:(e.invert=function(n,t){var e=i-t;return[Math.atan2(n,e)/u,i-I(u)*Math.sqrt(n*n+e*e)]},e)}function xr(n,t){return[n,Math.log(Math.tan(Sa/4+t/2))]}function Mr(n){var t,e=Qe(n),r=e.scale,u=e.translate,i=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=u.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=i.apply(e,arguments);if(o===e){if(t=null==n){var a=Sa*r(),c=u();i([[c[0]-a,c[1]-a],[c[0]+a,c[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function _r(n,t){return[Math.log(Math.tan(Sa/4+t/2)),-n]}function br(n){return n[0]}function wr(n){return n[1]}function Sr(n){for(var t=n.length,e=[0,1],r=2,u=2;t>u;u++){for(;r>1&&Z(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function kr(n,t){return n[0]-t[0]||n[1]-t[1]}function Er(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Ar(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],s=e[1],l=t[1]-c,f=r[1]-s,h=(a*(c-s)-f*(u-i))/(f*o-a*l);return[u+h*o,c+h*l]}function Cr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Nr(){Jr(this),this.edge=this.site=this.circle=null}function Lr(n){var t=Jc.pop()||new Nr;return t.site=n,t}function zr(n){Or(n),$c.remove(n),Jc.push(n),Jr(n)}function qr(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];zr(n);for(var c=i;c.circle&&oa(e-c.circle.x)<Aa&&oa(r-c.circle.cy)<Aa;)i=c.P,a.unshift(c),zr(c),c=i;a.unshift(c),Or(c);for(var s=o;s.circle&&oa(e-s.circle.x)<Aa&&oa(r-s.circle.cy)<Aa;)o=s.N,a.push(s),zr(s),s=o;a.push(s),Or(s);var l,f=a.length;for(l=1;f>l;++l)s=a[l],c=a[l-1],$r(s.edge,c.site,s.site,u);c=a[0],s=a[f-1],s.edge=Vr(c.site,s.site,null,u),Fr(c),Fr(s)}function Tr(n){for(var t,e,r,u,i=n.x,o=n.y,a=$c._;a;)if(r=Rr(a,o)-i,r>Aa)a=a.L;else{if(u=i-Dr(a,o),!(u>Aa)){r>-Aa?(t=a.P,e=a):u>-Aa?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Lr(n);if($c.insert(t,c),t||e){if(t===e)return Or(t),e=Lr(t.site),$c.insert(c,e),c.edge=e.edge=Vr(t.site,c.site),Fr(t),Fr(e),void 0;if(!e)return c.edge=Vr(t.site,c.site),void 0;Or(t),Or(e);var s=t.site,l=s.x,f=s.y,h=n.x-l,g=n.y-f,p=e.site,v=p.x-l,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,x=v*v+d*d,M={x:(d*y-g*x)/m+l,y:(h*x-v*y)/m+f};$r(e.edge,s,p,M),c.edge=Vr(s,n,null,M),e.edge=Vr(n,p,null,M),Fr(t),Fr(e)}}function Rr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,s=c-t;if(!s)return a;var l=a-r,f=1/i-1/s,h=l/s;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*s)-c+s/2+u-i/2)))/f+r:(r+a)/2}function Dr(n,t){var e=n.N;if(e)return Rr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Pr(n){this.site=n,this.edges=[]}function Ur(n){for(var t,e,r,u,i,o,a,c,s,l,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=Xc,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)l=a[o].end(),r=l.x,u=l.y,s=a[++o%c].start(),t=s.x,e=s.y,(oa(r-t)>Aa||oa(u-e)>Aa)&&(a.splice(o,0,new Br(Xr(i.site,l,oa(r-f)<Aa&&p-u>Aa?{x:f,y:oa(t-f)<Aa?e:p}:oa(u-p)<Aa&&h-r>Aa?{x:oa(e-p)<Aa?t:h,y:p}:oa(r-h)<Aa&&u-g>Aa?{x:h,y:oa(t-h)<Aa?e:g}:oa(u-g)<Aa&&r-f>Aa?{x:oa(e-g)<Aa?t:f,y:g}:null),i.site,null)),++c)}function jr(n,t){return t.angle-n.angle}function Hr(){Jr(this),this.x=this.y=this.arc=this.site=this.cy=null}function Fr(n){var t=n.P,e=n.N;if(t&&e){var r=t.site,u=n.site,i=e.site;if(r!==i){var o=u.x,a=u.y,c=r.x-o,s=r.y-a,l=i.x-o,f=i.y-a,h=2*(c*f-s*l);if(!(h>=-Ca)){var g=c*c+s*s,p=l*l+f*f,v=(f*g-s*p)/h,d=(c*p-l*g)/h,f=d+a,m=Gc.pop()||new Hr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,x=Wc._;x;)if(m.y<x.y||m.y===x.y&&m.x<=x.x){if(!x.L){y=x.P;break}x=x.L}else{if(!x.R){y=x;break}x=x.R}Wc.insert(y,m),y||(Bc=m)}}}}function Or(n){var t=n.circle;t&&(t.P||(Bc=t.N),Wc.remove(t),Gc.push(t),Jr(t),n.circle=null)}function Yr(n){for(var t,e=Vc,r=De(n[0][0],n[0][1],n[1][0],n[1][1]),u=e.length;u--;)t=e[u],(!Ir(t,n)||!r(t)||oa(t.a.x-t.b.x)<Aa&&oa(t.a.y-t.b.y)<Aa)&&(t.a=t.b=null,e.splice(u,1))}function Ir(n,t){var e=n.b;if(e)return!0;var r,u,i=n.a,o=t[0][0],a=t[1][0],c=t[0][1],s=t[1][1],l=n.l,f=n.r,h=l.x,g=l.y,p=f.x,v=f.y,d=(h+p)/2,m=(g+v)/2;if(v===g){if(o>d||d>=a)return;if(h>p){if(i){if(i.y>=s)return}else i={x:d,y:c};e={x:d,y:s}}else{if(i){if(i.y<c)return}else i={x:d,y:s};e={x:d,y:c}}}else if(r=(h-p)/(v-g),u=m-r*d,-1>r||r>1)if(h>p){if(i){if(i.y>=s)return}else i={x:(c-u)/r,y:c};e={x:(s-u)/r,y:s}}else{if(i){if(i.y<c)return}else i={x:(s-u)/r,y:s};e={x:(c-u)/r,y:c}}else if(v>g){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.x<o)return}else i={x:a,y:r*a+u};e={x:o,y:r*o+u}}return n.a=i,n.b=e,!0}function Zr(n,t){this.l=n,this.r=t,this.a=this.b=null}function Vr(n,t,e,r){var u=new Zr(n,t);return Vc.push(u),e&&$r(u,n,t,e),r&&$r(u,t,n,r),Xc[n.i].edges.push(new Br(u,n,t)),Xc[t.i].edges.push(new Br(u,t,n)),u}function Xr(n,t,e){var r=new Zr(n,null);return r.a=t,r.b=e,Vc.push(r),r}function $r(n,t,e,r){n.a||n.b?n.l===e?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=e)}function Br(n,t,e){var r=n.a,u=n.b;this.edge=n,this.site=t,this.angle=e?Math.atan2(e.y-t.y,e.x-t.x):n.l===t?Math.atan2(u.x-r.x,r.y-u.y):Math.atan2(r.x-u.x,u.y-r.y)}function Wr(){this._=null}function Jr(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function Gr(n,t){var e=t,r=t.R,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function Kr(n,t){var e=t,r=t.L,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function Qr(n){for(;n.L;)n=n.L;return n}function nu(n,t){var e,r,u,i=n.sort(tu).pop();for(Vc=[],Xc=new Array(n.length),$c=new Wr,Wc=new Wr;;)if(u=Bc,i&&(!u||i.y<u.y||i.y===u.y&&i.x<u.x))(i.x!==e||i.y!==r)&&(Xc[i.i]=new Pr(i),Tr(i),e=i.x,r=i.y),i=n.pop();else{if(!u)break;qr(u.arc)}t&&(Yr(t),Ur(t));var o={cells:Xc,edges:Vc};return $c=Wc=Vc=Xc=null,o}function tu(n,t){return t.y-n.y||t.x-n.x}function eu(n,t,e){return(n.x-e.x)*(t.y-n.y)-(n.x-t.x)*(e.y-n.y)}function ru(n){return n.x}function uu(n){return n.y}function iu(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function ou(n,t,e,r,u,i){if(!n(t,e,r,u,i)){var o=.5*(e+u),a=.5*(r+i),c=t.nodes;c[0]&&ou(n,c[0],e,r,o,a),c[1]&&ou(n,c[1],o,r,u,a),c[2]&&ou(n,c[2],e,a,o,i),c[3]&&ou(n,c[3],o,a,u,i)}}function au(n,t){n=Xo.rgb(n),t=Xo.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,o=t.g-r,a=t.b-u;return function(n){return"#"+vt(Math.round(e+i*n))+vt(Math.round(r+o*n))+vt(Math.round(u+a*n))}}function cu(n,t){var e,r={},u={};for(e in n)e in t?r[e]=fu(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function su(n,t){return t-=n=+n,function(e){return n+t*e}}function lu(n,t){var e,r,u,i,o,a=0,c=0,s=[],l=[];for(n+="",t+="",Qc.lastIndex=0,r=0;e=Qc.exec(t);++r)e.index&&s.push(t.substring(a,c=e.index)),l.push({i:s.length,x:e[0]}),s.push(null),a=Qc.lastIndex;for(a<t.length&&s.push(t.substring(a)),r=0,i=l.length;(e=Qc.exec(n))&&i>r;++r)if(o=l[r],o.x==e[0]){if(o.i)if(null==s[o.i+1])for(s[o.i-1]+=o.x,s.splice(o.i,1),u=r+1;i>u;++u)l[u].i--;else for(s[o.i-1]+=o.x+s[o.i+1],s.splice(o.i,2),u=r+1;i>u;++u)l[u].i-=2;else if(null==s[o.i+1])s[o.i]=o.x;else for(s[o.i]=o.x+s[o.i+1],s.splice(o.i+1,1),u=r+1;i>u;++u)l[u].i--;l.splice(r,1),i--,r--}else o.x=su(parseFloat(e[0]),parseFloat(o.x));for(;i>r;)o=l.pop(),null==s[o.i+1]?s[o.i]=o.x:(s[o.i]=o.x+s[o.i+1],s.splice(o.i+1,1)),i--;return 1===s.length?null==s[0]?(o=l[0].x,function(n){return o(n)+""}):function(){return t}:function(n){for(r=0;i>r;++r)s[(o=l[r]).i]=o.x(n);return s.join("")}}function fu(n,t){for(var e,r=Xo.interpolators.length;--r>=0&&!(e=Xo.interpolators[r](n,t)););return e}function hu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(fu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function gu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function pu(n){return function(t){return 1-n(1-t)}}function vu(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function du(n){return n*n}function mu(n){return n*n*n}function yu(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function xu(n){return function(t){return Math.pow(t,n)}}function Mu(n){return 1-Math.cos(n*Ea)}function _u(n){return Math.pow(2,10*(n-1))}function bu(n){return 1-Math.sqrt(1-n*n)}function wu(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/ka*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*ka/t)}}function Su(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function ku(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Eu(n,t){n=Xo.hcl(n),t=Xo.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return rt(e+i*n,r+o*n,u+a*n)+""}}function Au(n,t){n=Xo.hsl(n),t=Xo.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return nt(e+i*n,r+o*n,u+a*n)+""}}function Cu(n,t){n=Xo.lab(n),t=Xo.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ot(e+i*n,r+o*n,u+a*n)+""}}function Nu(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Lu(n){var t=[n.a,n.b],e=[n.c,n.d],r=qu(t),u=zu(t,e),i=qu(Tu(e,t,-u))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,u*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*La,this.translate=[n.e,n.f],this.scale=[r,i],this.skew=i?Math.atan2(u,i)*La:0}function zu(n,t){return n[0]*t[0]+n[1]*t[1]}function qu(n){var t=Math.sqrt(zu(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Tu(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Ru(n,t){var e,r=[],u=[],i=Xo.transform(n),o=Xo.transform(t),a=i.translate,c=o.translate,s=i.rotate,l=o.rotate,f=i.skew,h=o.skew,g=i.scale,p=o.scale;return a[0]!=c[0]||a[1]!=c[1]?(r.push("translate(",null,",",null,")"),u.push({i:1,x:su(a[0],c[0])},{i:3,x:su(a[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),s!=l?(s-l>180?l+=360:l-s>180&&(s+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:su(s,l)})):l&&r.push(r.pop()+"rotate("+l+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:su(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:su(g[0],p[0])},{i:e-2,x:su(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i<e;)r[(t=u[i]).i]=t.x(n);return r.join("")}}function Du(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return(e-n)*t}}function Pu(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return Math.max(0,Math.min(1,(e-n)*t))}}function Uu(n){for(var t=n.source,e=n.target,r=Hu(t,e),u=[t];t!==r;)t=t.parent,u.push(t);for(var i=u.length;e!==r;)u.splice(i,0,e),e=e.parent;return u}function ju(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Hu(n,t){if(n===t)return n;for(var e=ju(n),r=ju(t),u=e.pop(),i=r.pop(),o=null;u===i;)o=u,u=e.pop(),i=r.pop();return o}function Fu(n){n.fixed|=2}function Ou(n){n.fixed&=-7}function Yu(n){n.fixed|=4,n.px=n.x,n.py=n.y}function Iu(n){n.fixed&=-5}function Zu(n,t,e){var r=0,u=0;if(n.charge=0,!n.leaf)for(var i,o=n.nodes,a=o.length,c=-1;++c<a;)i=o[c],null!=i&&(Zu(i,t,e),n.charge+=i.charge,r+=i.charge*i.cx,u+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var s=t*e[n.point.index];n.charge+=n.pointCharge=s,r+=s*n.point.x,u+=s*n.point.y}n.cx=r/n.charge,n.cy=u/n.charge}function Vu(n,t){return Xo.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=Wu,n}function Xu(n){return n.children}function $u(n){return n.value}function Bu(n,t){return t.value-n.value}function Wu(n){return Xo.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function Ju(n){return n.x}function Gu(n){return n.y}function Ku(n,t,e){n.y0=t,n.y=e}function Qu(n){return Xo.range(n.length)}function ni(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function ti(n){for(var t,e=1,r=0,u=n[0][1],i=n.length;i>e;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function ei(n){return n.reduce(ri,0)}function ri(n,t){return n+t[1]}function ui(n,t){return ii(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ii(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function oi(n){return[Xo.min(n),Xo.max(n)]}function ai(n,t){return n.parent==t.parent?1:2}function ci(n){var t=n.children;return t&&t.length?t[0]:n._tree.thread}function si(n){var t,e=n.children;return e&&(t=e.length)?e[t-1]:n._tree.thread}function li(n,t){var e=n.children;if(e&&(u=e.length))for(var r,u,i=-1;++i<u;)t(r=li(e[i],t),n)>0&&(n=r);return n}function fi(n,t){return n.x-t.x}function hi(n,t){return t.x-n.x}function gi(n,t){return n.depth-t.depth}function pi(n,t){function e(n,r){var u=n.children;if(u&&(o=u.length))for(var i,o,a=null,c=-1;++c<o;)i=u[c],e(i,a),a=i;t(n,r)}e(n,null)}function vi(n){for(var t,e=0,r=0,u=n.children,i=u.length;--i>=0;)t=u[i]._tree,t.prelim+=e,t.mod+=e,e+=t.shift+(r+=t.change)}function di(n,t,e){n=n._tree,t=t._tree;var r=e/(t.number-n.number);n.change+=r,t.change-=r,t.shift+=e,t.prelim+=e,t.mod+=e}function mi(n,t,e){return n._tree.ancestor.parent==t.parent?n._tree.ancestor:e}function yi(n,t){return n.value-t.value}function xi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Mi(n,t){n._pack_next=t,t._pack_prev=n}function _i(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function bi(n){function t(n){l=Math.min(n.x-n.r,l),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(s=e.length)){var e,r,u,i,o,a,c,s,l=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(wi),r=e[0],r.x=-r.r,r.y=0,t(r),s>1&&(u=e[1],u.x=u.r,u.y=0,t(u),s>2))for(i=e[2],Ei(r,u,i),t(i),xi(r,i),r._pack_prev=i,xi(i,u),u=r._pack_next,o=3;s>o;o++){Ei(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(_i(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!_i(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.r<r.r?Mi(r,u=a):Mi(r=c,u),o--):(xi(r,i),u=i,t(i))}var m=(l+f)/2,y=(h+g)/2,x=0;for(o=0;s>o;o++)i=e[o],i.x-=m,i.y-=y,x=Math.max(x,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=x,e.forEach(Si)}}function wi(n){n._pack_next=n._pack_prev=n}function Si(n){delete n._pack_next,delete n._pack_prev}function ki(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i<o;)ki(u[i],t,e,r)}function Ei(n,t,e){var r=n.r+e.r,u=t.x-n.x,i=t.y-n.y;if(r&&(u||i)){var o=t.r+e.r,a=u*u+i*i;o*=o,r*=r;var c=.5+(r-o)/(2*a),s=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+c*u+s*i,e.y=n.y+c*i-s*u}else e.x=n.x+r,e.y=n.y}function Ai(n){return 1+Xo.max(n,function(n){return n.y})}function Ci(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Ni(n){var t=n.children;return t&&t.length?Ni(t[0]):n}function Li(n){var t,e=n.children;return e&&(t=e.length)?Li(e[t-1]):n}function zi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function qi(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Ti(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Ri(n){return n.rangeExtent?n.rangeExtent():Ti(n.range())}function Di(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Pi(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Ui(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:ls}function ji(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<=a;)u.push(e(n[o-1],n[o])),i.push(r(t[o-1],t[o]));return function(t){var e=Xo.bisect(n,t,1,a)-1;return i[e](u[e](t))}}function Hi(n,t,e,r){function u(){var u=Math.min(n.length,t.length)>2?ji:Di,c=r?Pu:Du;return o=u(n,t,c,e),a=u(t,n,c,fu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Nu)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return Ii(n,t)},i.tickFormat=function(t,e){return Zi(n,t,e)},i.nice=function(t){return Oi(n,t),u()},i.copy=function(){return Hi(n,t,e,r)},u()}function Fi(n,t){return Xo.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Oi(n,t){return Pi(n,Ui(Yi(n,t)[2]))}function Yi(n,t){null==t&&(t=10);var e=Ti(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Ii(n,t){return Xo.range.apply(Xo,Yi(n,t))}function Zi(n,t,e){var r=Yi(n,t);return Xo.format(e?e.replace(Qa,function(n,t,e,u,i,o,a,c,s,l){return[t,e,u,i,o,a,c,s||"."+Xi(l,r),l].join("")}):",."+Vi(r[2])+"f")}function Vi(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Xi(n,t){var e=Vi(t[2]);return n in fs?Math.abs(e-Vi(Math.max(Math.abs(t[0]),Math.abs(t[1]))))+ +("e"!==n):e-2*("%"===n)}function $i(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Pi(r.map(u),e?Math:gs);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=Ti(r),o=[],a=n[0],c=n[1],s=Math.floor(u(a)),l=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(l-s)){if(e){for(;l>s;s++)for(var h=1;f>h;h++)o.push(i(s)*h);o.push(i(s))}else for(o.push(i(s));s++<l;)for(var h=f-1;h>0;h--)o.push(i(s)*h);for(s=0;o[s]<a;s++);for(l=o.length;o[l-1]>c;l--);o=o.slice(s,l)}return o},o.tickFormat=function(n,t){if(!arguments.length)return hs;arguments.length<2?t=hs:"function"!=typeof t&&(t=Xo.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return $i(n.copy(),t,e,r)},Fi(o,n)}function Bi(n,t,e){function r(t){return n(u(t))}var u=Wi(t),i=Wi(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return Ii(e,n)},r.tickFormat=function(n,t){return Zi(e,n,t)},r.nice=function(n){return r.domain(Oi(e,n))},r.exponent=function(o){return arguments.length?(u=Wi(t=o),i=Wi(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Bi(n.copy(),t,e)},Fi(r,n)}function Wi(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function Ji(n,t){function e(e){return o[((i.get(e)||"range"===t.t&&i.set(e,n.push(e)))-1)%o.length]}function r(t,e){return Xo.range(n.length).map(function(n){return t+e*n})}var i,o,a;return e.domain=function(r){if(!arguments.length)return n;n=[],i=new u;for(var o,a=-1,c=r.length;++a<c;)i.has(o=r[a])||i.set(o,n.push(o));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(o=n,a=0,t={t:"range",a:arguments},e):o},e.rangePoints=function(u,i){arguments.length<2&&(i=0);var c=u[0],s=u[1],l=(s-c)/(Math.max(1,n.length-1)+i);return o=r(n.length<2?(c+s)/2:c+l*i/2,l),a=0,t={t:"rangePoints",a:arguments},e},e.rangeBands=function(u,i,c){arguments.length<2&&(i=0),arguments.length<3&&(c=i);var s=u[1]<u[0],l=u[s-0],f=u[1-s],h=(f-l)/(n.length-i+2*c);return o=r(l+h*c,h),s&&o.reverse(),a=h*(1-i),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(u,i,c){arguments.length<2&&(i=0),arguments.length<3&&(c=i);var s=u[1]<u[0],l=u[s-0],f=u[1-s],h=Math.floor((f-l)/(n.length-i+2*c)),g=f-l-(n.length-i)*h;return o=r(l+Math.round(g/2),h),s&&o.reverse(),a=Math.round(h*(1-i)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return a},e.rangeExtent=function(){return Ti(t.a[0])},e.copy=function(){return Ji(n,t)},e.domain(n)}function Gi(n,t){function e(){var e=0,i=t.length;for(u=[];++e<i;)u[e-1]=Xo.quantile(n,e/i);return r}function r(n){return isNaN(n=+n)?void 0:t[Xo.bisect(u,n)]}var u;return r.domain=function(t){return arguments.length?(n=t.filter(function(n){return!isNaN(n)}).sort(Xo.ascending),e()):n},r.range=function(n){return arguments.length?(t=n,e()):t},r.quantiles=function(){return u},r.invertExtent=function(e){return e=t.indexOf(e),0>e?[0/0,0/0]:[e>0?u[e-1]:n[0],e<u.length?u[e]:n[n.length-1]]},r.copy=function(){return Gi(n,t)},e()}function Ki(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(i*(t-n))))]}function u(){return i=e.length/(t-n),o=e.length-1,r}var i,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],u()):[n,t]},r.range=function(n){return arguments.length?(e=n,u()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return Ki(n,t,e)},u()}function Qi(n,t){function e(e){return e>=e?t[Xo.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return Qi(n,t)},e}function no(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Ii(n,t)},t.tickFormat=function(t,e){return Zi(n,t,e)},t.copy=function(){return no(n)},t}function to(n){return n.innerRadius}function eo(n){return n.outerRadius}function ro(n){return n.startAngle}function uo(n){return n.endAngle}function io(n){function t(t){function o(){s.push("M",i(n(l),a))}for(var c,s=[],l=[],f=-1,h=t.length,g=_t(e),p=_t(r);++f<h;)u.call(this,c=t[f],f)?l.push([+g.call(this,c,f),+p.call(this,c,f)]):l.length&&(o(),l=[]);return l.length&&o(),s.length?s.join(""):null}var e=br,r=wr,u=be,i=oo,o=i.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(u=n,t):u},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?i=n:(i=Ms.get(n)||oo).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function oo(n){return n.join("L")}function ao(n){return oo(n)+"Z"}function co(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&u.push("H",r[0]),u.join("")}function so(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("V",(r=n[t])[1],"H",r[0]);return u.join("")}function lo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r=n[t])[0],"V",r[1]);return u.join("")}function fo(n,t){return n.length<4?oo(n):n[1]+po(n.slice(1,n.length-1),vo(n,t))}function ho(n,t){return n.length<3?oo(n):n[0]+po((n.push(n[0]),n),vo([n[n.length-2]].concat(n,[n[1]]),t))}function go(n,t){return n.length<3?oo(n):n[0]+po(n,vo(n,t))}function po(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return oo(n);var e=n.length!=t.length,r="",u=n[0],i=n[1],o=t[0],a=o,c=1;if(e&&(r+="Q"+(i[0]-2*o[0]/3)+","+(i[1]-2*o[1]/3)+","+i[0]+","+i[1],u=n[1],c=2),t.length>1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var s=2;s<t.length;s++,c++)i=n[c],a=t[s],r+="S"+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1]}if(e){var l=n[c];r+="Q"+(i[0]+2*a[0]/3)+","+(i[1]+2*a[1]/3)+","+l[0]+","+l[1]}return r}function vo(n,t){for(var e,r=[],u=(1-t)/2,i=n[0],o=n[1],a=1,c=n.length;++a<c;)e=i,i=o,o=n[a],r.push([u*(o[0]-e[0]),u*(o[1]-e[1])]);return r}function mo(n){if(n.length<3)return oo(n);var t=1,e=n.length,r=n[0],u=r[0],i=r[1],o=[u,u,u,(r=n[1])[0]],a=[i,i,i,r[1]],c=[u,",",i,"L",_o(ws,o),",",_o(ws,a)];for(n.push(n[e-1]);++t<=e;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),bo(c,o,a);return n.pop(),c.push("L",r),c.join("")}function yo(n){if(n.length<4)return oo(n);for(var t,e=[],r=-1,u=n.length,i=[0],o=[0];++r<3;)t=n[r],i.push(t[0]),o.push(t[1]);for(e.push(_o(ws,i)+","+_o(ws,o)),--r;++r<u;)t=n[r],i.shift(),i.push(t[0]),o.shift(),o.push(t[1]),bo(e,i,o);return e.join("")}function xo(n){for(var t,e,r=-1,u=n.length,i=u+4,o=[],a=[];++r<4;)e=n[r%u],o.push(e[0]),a.push(e[1]);for(t=[_o(ws,o),",",_o(ws,a)],--r;++r<i;)e=n[r%u],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),bo(t,o,a);return t.join("")}function Mo(n,t){var e=n.length-1;if(e)for(var r,u,i=n[0][0],o=n[0][1],a=n[e][0]-i,c=n[e][1]-o,s=-1;++s<=e;)r=n[s],u=s/e,r[0]=t*r[0]+(1-t)*(i+u*a),r[1]=t*r[1]+(1-t)*(o+u*c);return mo(n)}function _o(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function bo(n,t,e){n.push("C",_o(_s,t),",",_o(_s,e),",",_o(bs,t),",",_o(bs,e),",",_o(ws,t),",",_o(ws,e))}function wo(n,t){return(t[1]-n[1])/(t[0]-n[0])}function So(n){for(var t=0,e=n.length-1,r=[],u=n[0],i=n[1],o=r[0]=wo(u,i);++t<e;)r[t]=(o+(o=wo(u=i,i=n[t+1])))/2;return r[t]=o,r}function ko(n){for(var t,e,r,u,i=[],o=So(n),a=-1,c=n.length-1;++a<c;)t=wo(n[a],n[a+1]),oa(t)<Aa?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,u=e*e+r*r,u>9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function Eo(n){return n.length<3?oo(n):n[0]+po(n,ko(n))}function Ao(n){for(var t,e,r,u=-1,i=n.length;++u<i;)t=n[u],e=t[0],r=t[1]+ys,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function Co(n){function t(t){function c(){v.push("M",a(n(m),f),l,s(n(d.reverse()),f),"Z")}for(var h,g,p,v=[],d=[],m=[],y=-1,x=t.length,M=_t(e),_=_t(u),b=e===r?function(){return g}:_t(r),w=u===i?function(){return p}:_t(i);++y<x;)o.call(this,h=t[y],y)?(d.push([g=+M.call(this,h,y),p=+_.call(this,h,y)]),m.push([+b.call(this,h,y),+w.call(this,h,y)])):d.length&&(c(),d=[],m=[]);return d.length&&c(),v.length?v.join(""):null}var e=br,r=br,u=0,i=wr,o=be,a=oo,c=a.key,s=a,l="L",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(u=i=n,t):i},t.y0=function(n){return arguments.length?(u=n,t):u},t.y1=function(n){return arguments.length?(i=n,t):i},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?a=n:(a=Ms.get(n)||oo).key,s=a.reverse||a,l=a.closed?"M":"L",t):c},t.tension=function(n){return arguments.length?(f=n,t):f},t}function No(n){return n.radius}function Lo(n){return[n.x,n.y]}function zo(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]+ys;return[e*Math.cos(r),e*Math.sin(r)]}}function qo(){return 64}function To(){return"circle"}function Ro(n){var t=Math.sqrt(n/Sa);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Do(n,t){return fa(n,Ns),n.id=t,n}function Po(n,t,e,r){var u=n.id;return R(n,"function"==typeof e?function(n,i,o){n.__transition__[u].tween.set(t,r(e.call(n,n.__data__,i,o)))}:(e=r(e),function(n){n.__transition__[u].tween.set(t,e)}))}function Uo(n){return null==n&&(n=""),function(){this.textContent=n}}function jo(n,t,e,r){var i=n.__transition__||(n.__transition__={active:0,count:0}),o=i[e];if(!o){var a=r.time;o=i[e]={tween:new u,time:a,ease:r.ease,delay:r.delay,duration:r.duration},++i.count,Xo.timer(function(r){function u(r){return i.active>e?s():(i.active=e,o.event&&o.event.start.call(n,l,t),o.tween.forEach(function(e,r){(r=r.call(n,l,t))&&v.push(r)}),Xo.timer(function(){return p.c=c(r||1)?be:c,1},0,a),void 0)}function c(r){if(i.active!==e)return s();for(var u=r/g,a=f(u),c=v.length;c>0;)v[--c].call(n,a);return u>=1?(o.event&&o.event.end.call(n,l,t),s()):void 0}function s(){return--i.count?delete i[e]:delete n.__transition__,1}var l=n.__data__,f=o.ease,h=o.delay,g=o.duration,p=Ja,v=[];return p.t=h+a,r>=h?u(r-h):(p.c=u,void 0)},0,a)}}function Ho(n,t){n.attr("transform",function(n){return"translate("+t(n)+",0)"})}function Fo(n,t){n.attr("transform",function(n){return"translate(0,"+t(n)+")"})}function Oo(n){return n.toISOString()}function Yo(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=Xo.bisect(js,u);return i==js.length?[t.year,Yi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/js[i-1]<js[i]/u?i-1:i]:[Os,Yi(n,e)[2]] | |
}return r.invert=function(t){return Io(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(Io)},r.nice=function(n,t){function e(e){return!isNaN(e)&&!n.range(e,Io(+e+1),t).length}var i=r.domain(),o=Ti(i),a=null==n?u(o,10):"number"==typeof n&&u(o,n);return a&&(n=a[0],t=a[1]),r.domain(Pi(i,t>1?{floor:function(t){for(;e(t=n.floor(t));)t=Io(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Io(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Ti(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Io(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Yo(n.copy(),t,e)},Fi(r,n)}function Io(n){return new Date(n)}function Zo(n){return JSON.parse(n.responseText)}function Vo(n){var t=Wo.createRange();return t.selectNode(Wo.body),t.createContextualFragment(n.responseText)}var Xo={version:"3.4.1"};Date.now||(Date.now=function(){return+new Date});var $o=[].slice,Bo=function(n){return $o.call(n)},Wo=document,Jo=Wo.documentElement,Go=window;try{Bo(Jo.childNodes)[0].nodeType}catch(Ko){Bo=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}try{Wo.createElement("div").style.setProperty("opacity",0,"")}catch(Qo){var na=Go.Element.prototype,ta=na.setAttribute,ea=na.setAttributeNS,ra=Go.CSSStyleDeclaration.prototype,ua=ra.setProperty;na.setAttribute=function(n,t){ta.call(this,n,t+"")},na.setAttributeNS=function(n,t,e){ea.call(this,n,t,e+"")},ra.setProperty=function(n,t,e){ua.call(this,n,t+"",e)}}Xo.ascending=function(n,t){return t>n?-1:n>t?1:n>=t?0:0/0},Xo.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},Xo.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i&&!(null!=(e=n[u])&&e>=e);)e=void 0;for(;++u<i;)null!=(r=n[u])&&e>r&&(e=r)}else{for(;++u<i&&!(null!=(e=t.call(n,n[u],u))&&e>=e);)e=void 0;for(;++u<i;)null!=(r=t.call(n,n[u],u))&&e>r&&(e=r)}return e},Xo.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i&&!(null!=(e=n[u])&&e>=e);)e=void 0;for(;++u<i;)null!=(r=n[u])&&r>e&&(e=r)}else{for(;++u<i&&!(null!=(e=t.call(n,n[u],u))&&e>=e);)e=void 0;for(;++u<i;)null!=(r=t.call(n,n[u],u))&&r>e&&(e=r)}return e},Xo.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i<o&&!(null!=(e=u=n[i])&&e>=e);)e=u=void 0;for(;++i<o;)null!=(r=n[i])&&(e>r&&(e=r),r>u&&(u=r))}else{for(;++i<o&&!(null!=(e=u=t.call(n,n[i],i))&&e>=e);)e=void 0;for(;++i<o;)null!=(r=t.call(n,n[i],i))&&(e>r&&(e=r),r>u&&(u=r))}return[e,u]},Xo.sum=function(n,t){var e,r=0,u=n.length,i=-1;if(1===arguments.length)for(;++i<u;)isNaN(e=+n[i])||(r+=e);else for(;++i<u;)isNaN(e=+t.call(n,n[i],i))||(r+=e);return r},Xo.mean=function(t,e){var r,u=t.length,i=0,o=-1,a=0;if(1===arguments.length)for(;++o<u;)n(r=t[o])&&(i+=(r-i)/++a);else for(;++o<u;)n(r=e.call(t,t[o],o))&&(i+=(r-i)/++a);return a?i:void 0},Xo.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),u=+n[r-1],i=e-r;return i?u+i*(n[r]-u):u},Xo.median=function(t,e){return arguments.length>1&&(t=t.map(e)),t=t.filter(n),t.length?Xo.quantile(t.sort(Xo.ascending),.5):void 0},Xo.bisector=function(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n.call(t,t[i],i)<e?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;e<n.call(t,t[i],i)?u=i:r=i+1}return r}}};var ia=Xo.bisector(function(n){return n});Xo.bisectLeft=ia.left,Xo.bisect=Xo.bisectRight=ia.right,Xo.shuffle=function(n){for(var t,e,r=n.length;r;)e=0|Math.random()*r--,t=n[r],n[r]=n[e],n[e]=t;return n},Xo.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},Xo.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},Xo.zip=function(){if(!(u=arguments.length))return[];for(var n=-1,e=Xo.min(arguments,t),r=new Array(e);++n<e;)for(var u,i=-1,o=r[n]=new Array(u);++i<u;)o[i]=arguments[i][n];return r},Xo.transpose=function(n){return Xo.zip.apply(Xo,n)},Xo.keys=function(n){var t=[];for(var e in n)t.push(e);return t},Xo.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},Xo.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},Xo.merge=function(n){for(var t,e,r,u=n.length,i=-1,o=0;++i<u;)o+=n[i].length;for(e=new Array(o);--u>=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var oa=Math.abs;Xo.range=function(n,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/r)throw new Error("infinite range");var u,i=[],o=e(oa(r)),a=-1;if(n*=o,t*=o,r*=o,0>r)for(;(u=n+r*++a)>t;)i.push(u/o);else for(;(u=n+r*++a)<t;)i.push(u/o);return i},Xo.map=function(n){var t=new u;if(n instanceof u)n.forEach(function(n,e){t.set(n,e)});else for(var e in n)t.set(e,n[e]);return t},r(u,{has:i,get:function(n){return this[aa+n]},set:function(n,t){return this[aa+n]=t},remove:o,keys:a,values:function(){var n=[];return this.forEach(function(t,e){n.push(e)}),n},entries:function(){var n=[];return this.forEach(function(t,e){n.push({key:t,value:e})}),n},size:c,empty:s,forEach:function(n){for(var t in this)t.charCodeAt(0)===ca&&n.call(this,t.substring(1),this[t])}});var aa="\x00",ca=aa.charCodeAt(0);Xo.nest=function(){function n(t,a,c){if(c>=o.length)return r?r.call(i,a):e?a.sort(e):a;for(var s,l,f,h,g=-1,p=a.length,v=o[c++],d=new u;++g<p;)(h=d.get(s=v(l=a[g])))?h.push(l):d.set(s,[l]);return t?(l=t(),f=function(e,r){l.set(e,n(t,r,c))}):(l={},f=function(e,r){l[e]=n(t,r,c)}),d.forEach(f),l}function t(n,e){if(e>=o.length)return n;var r=[],u=a[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,i={},o=[],a=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(Xo.map,e,0),0)},i.key=function(n){return o.push(n),i},i.sortKeys=function(n){return a[o.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},Xo.set=function(n){var t=new l;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},r(l,{has:i,add:function(n){return this[aa+n]=!0,n},remove:function(n){return n=aa+n,n in this&&delete this[n]},values:a,size:c,empty:s,forEach:function(n){for(var t in this)t.charCodeAt(0)===ca&&n.call(this,t.substring(1))}}),Xo.behavior={},Xo.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r<u;)n[e=arguments[r]]=f(n,t,t[e]);return n};var sa=["webkit","ms","moz","Moz","o","O"];Xo.dispatch=function(){for(var n=new p,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=v(n);return n},p.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.substring(e+1),n=n.substring(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},Xo.event=null,Xo.requote=function(n){return n.replace(la,"\\$&")};var la=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,fa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},ha=function(n,t){return t.querySelector(n)},ga=function(n,t){return t.querySelectorAll(n)},pa=Jo[h(Jo,"matchesSelector")],va=function(n,t){return pa.call(n,t)};"function"==typeof Sizzle&&(ha=function(n,t){return Sizzle(n,t)[0]||null},ga=function(n,t){return Sizzle.uniqueSort(Sizzle(n,t))},va=Sizzle.matchesSelector),Xo.selection=function(){return xa};var da=Xo.selection.prototype=[];da.select=function(n){var t,e,r,u,i=[];n=M(n);for(var o=-1,a=this.length;++o<a;){i.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var c=-1,s=r.length;++c<s;)(u=r[c])?(t.push(e=n.call(u,u.__data__,c,o)),e&&"__data__"in u&&(e.__data__=u.__data__)):t.push(null)}return x(i)},da.selectAll=function(n){var t,e,r=[];n=_(n);for(var u=-1,i=this.length;++u<i;)for(var o=this[u],a=-1,c=o.length;++a<c;)(e=o[a])&&(r.push(t=Bo(n.call(e,e.__data__,a,u))),t.parentNode=e);return x(r)};var ma={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};Xo.ns={prefix:ma,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.substring(0,t),n=n.substring(t+1)),ma.hasOwnProperty(e)?{space:ma[e],local:n}:n}},da.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=Xo.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(b(t,n[t]));return this}return this.each(b(n,t))},da.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=k(n)).length,u=-1;if(t=e.classList){for(;++u<r;)if(!t.contains(n[u]))return!1}else for(t=e.getAttribute("class");++u<r;)if(!S(n[u]).test(t))return!1;return!0}for(t in n)this.each(E(t,n[t]));return this}return this.each(E(n,t))},da.style=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(C(e,n[e],t));return this}if(2>r)return Go.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(C(n,t,e))},da.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(N(t,n[t]));return this}return this.each(N(n,t))},da.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},da.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},da.append=function(n){return n=L(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},da.insert=function(n,t){return n=L(n),t=M(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},da.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},da.data=function(n,t){function e(n,e){var r,i,o,a=n.length,f=e.length,h=Math.min(a,f),g=new Array(f),p=new Array(f),v=new Array(a);if(t){var d,m=new u,y=new u,x=[];for(r=-1;++r<a;)d=t.call(i=n[r],i.__data__,r),m.has(d)?v[r]=i:m.set(d,i),x.push(d);for(r=-1;++r<f;)d=t.call(e,o=e[r],r),(i=m.get(d))?(g[r]=i,i.__data__=o):y.has(d)||(p[r]=z(o)),y.set(d,o),m.remove(d);for(r=-1;++r<a;)m.has(x[r])&&(v[r]=n[r])}else{for(r=-1;++r<h;)i=n[r],o=e[r],i?(i.__data__=o,g[r]=i):p[r]=z(o);for(;f>r;++r)p[r]=z(e[r]);for(;a>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,c.push(p),s.push(g),l.push(v)}var r,i,o=-1,a=this.length;if(!arguments.length){for(n=new Array(a=(r=this[0]).length);++o<a;)(i=r[o])&&(n[o]=i.__data__);return n}var c=D([]),s=x([]),l=x([]);if("function"==typeof n)for(;++o<a;)e(r=this[o],n.call(r,r.parentNode.__data__,o));else for(;++o<a;)e(r=this[o],n);return s.enter=function(){return c},s.exit=function(){return l},s},da.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},da.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=q(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return x(u)},da.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],u=r.length-1,i=r[u];--u>=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},da.sort=function(n){n=T.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},da.each=function(n){return R(this,function(t,e,r){n.call(t,t.__data__,e,r)})},da.call=function(n){var t=Bo(arguments);return n.apply(t[0]=this,t),this},da.empty=function(){return!this.node()},da.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},da.size=function(){var n=0;return this.each(function(){++n}),n};var ya=[];Xo.selection.enter=D,Xo.selection.enter.prototype=ya,ya.append=da.append,ya.empty=da.empty,ya.node=da.node,ya.call=da.call,ya.size=da.size,ya.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++a<c;){r=(u=this[a]).update,o.push(t=[]),t.parentNode=u.parentNode;for(var s=-1,l=u.length;++s<l;)(i=u[s])?(t.push(r[s]=e=n.call(u.parentNode,i.__data__,s,a)),e.__data__=i.__data__):t.push(null)}return x(o)},ya.insert=function(n,t){return arguments.length<2&&(t=P(this)),da.insert.call(this,n,t)},da.transition=function(){for(var n,t,e=ks||++Ls,r=[],u=Es||{time:Date.now(),ease:yu,delay:0,duration:250},i=-1,o=this.length;++i<o;){r.push(n=[]);for(var a=this[i],c=-1,s=a.length;++c<s;)(t=a[c])&&jo(t,c,e,u),n.push(t)}return Do(r,e)},da.interrupt=function(){return this.each(U)},Xo.select=function(n){var t=["string"==typeof n?ha(n,Wo):n];return t.parentNode=Jo,x([t])},Xo.selectAll=function(n){var t=Bo("string"==typeof n?ga(n,Wo):n);return t.parentNode=Jo,x([t])};var xa=Xo.select(Jo);da.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(j(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(j(n,t,e))};var Ma=Xo.map({mouseenter:"mouseover",mouseleave:"mouseout"});Ma.forEach(function(n){"on"+n in Wo&&Ma.remove(n)});var _a="onselectstart"in Wo?null:h(Jo.style,"userSelect"),ba=0;Xo.mouse=function(n){return Y(n,m())};var wa=/WebKit/.test(Go.navigator.userAgent)?-1:0;Xo.touches=function(n,t){return arguments.length<2&&(t=m().touches),t?Bo(t).map(function(t){var e=Y(n,t);return e.identifier=t.identifier,e}):[]},Xo.behavior.drag=function(){function n(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function t(){return Xo.event.changedTouches[0].identifier}function e(n,t){return Xo.touches(n).filter(function(n){return n.identifier===t})[0]}function r(n,t,e,r){return function(){function o(){var n=t(l,g),e=n[0]-v[0],r=n[1]-v[1];d|=e|r,v=n,f({type:"drag",x:n[0]+c[0],y:n[1]+c[1],dx:e,dy:r})}function a(){m.on(e+"."+p,null).on(r+"."+p,null),y(d&&Xo.event.target===h),f({type:"dragend"})}var c,s=this,l=s.parentNode,f=u.of(s,arguments),h=Xo.event.target,g=n(),p=null==g?"drag":"drag-"+g,v=t(l,g),d=0,m=Xo.select(Go).on(e+"."+p,o).on(r+"."+p,a),y=O();i?(c=i.apply(s,arguments),c=[c.x-v[0],c.y-v[1]]):c=[0,0],f({type:"dragstart"})}}var u=y(n,"drag","dragstart","dragend"),i=null,o=r(g,Xo.mouse,"mousemove","mouseup"),a=r(t,e,"touchmove","touchend");return n.origin=function(t){return arguments.length?(i=t,n):i},Xo.rebind(n,u,"on")};var Sa=Math.PI,ka=2*Sa,Ea=Sa/2,Aa=1e-6,Ca=Aa*Aa,Na=Sa/180,La=180/Sa,za=Math.SQRT2,qa=2,Ta=4;Xo.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=B(v),o=i/(qa*h)*(e*W(za*t+v)-$(v));return[r+o*s,u+o*l,i*e/B(za*t+v)]}return[r+n*s,u+n*l,i*Math.exp(za*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],s=o-r,l=a-u,f=s*s+l*l,h=Math.sqrt(f),g=(c*c-i*i+Ta*f)/(2*i*qa*h),p=(c*c-i*i-Ta*f)/(2*c*qa*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/za;return e.duration=1e3*y,e},Xo.behavior.zoom=function(){function n(n){n.on(A,s).on(Pa+".zoom",f).on(C,h).on("dblclick.zoom",g).on(L,l)}function t(n){return[(n[0]-S.x)/S.k,(n[1]-S.y)/S.k]}function e(n){return[n[0]*S.k+S.x,n[1]*S.k+S.y]}function r(n){S.k=Math.max(E[0],Math.min(E[1],n))}function u(n,t){t=e(t),S.x+=n[0]-t[0],S.y+=n[1]-t[1]}function i(){_&&_.domain(M.range().map(function(n){return(n-S.x)/S.k}).map(M.invert)),w&&w.domain(b.range().map(function(n){return(n-S.y)/S.k}).map(b.invert))}function o(n){n({type:"zoomstart"})}function a(n){i(),n({type:"zoom",scale:S.k,translate:[S.x,S.y]})}function c(n){n({type:"zoomend"})}function s(){function n(){l=1,u(Xo.mouse(r),g),a(i)}function e(){f.on(C,Go===r?h:null).on(N,null),p(l&&Xo.event.target===s),c(i)}var r=this,i=z.of(r,arguments),s=Xo.event.target,l=0,f=Xo.select(Go).on(C,n).on(N,e),g=t(Xo.mouse(r)),p=O();U.call(r),o(i)}function l(){function n(){var n=Xo.touches(g);return h=S.k,n.forEach(function(n){n.identifier in v&&(v[n.identifier]=t(n))}),n}function e(){for(var t=Xo.event.changedTouches,e=0,i=t.length;i>e;++e)v[t[e].identifier]=null;var o=n(),c=Date.now();if(1===o.length){if(500>c-x){var s=o[0],l=v[s.identifier];r(2*S.k),u(s,l),d(),a(p)}x=c}else if(o.length>1){var s=o[0],f=o[1],h=s[0]-f[0],g=s[1]-f[1];m=h*h+g*g}}function i(){for(var n,t,e,i,o=Xo.touches(g),c=0,s=o.length;s>c;++c,i=null)if(e=o[c],i=v[e.identifier]){if(t)break;n=e,t=i}if(i){var l=(l=e[0]-n[0])*l+(l=e[1]-n[1])*l,f=m&&Math.sqrt(l/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+i[0])/2,(t[1]+i[1])/2],r(f*h)}x=null,u(n,t),a(p)}function f(){if(Xo.event.touches.length){for(var t=Xo.event.changedTouches,e=0,r=t.length;r>e;++e)delete v[t[e].identifier];for(var u in v)return void n()}b.on(M,null).on(_,null),w.on(A,s).on(L,l),k(),c(p)}var h,g=this,p=z.of(g,arguments),v={},m=0,y=Xo.event.changedTouches[0].identifier,M="touchmove.zoom-"+y,_="touchend.zoom-"+y,b=Xo.select(Go).on(M,i).on(_,f),w=Xo.select(g).on(A,null).on(L,e),k=O();U.call(g),e(),o(p)}function f(){var n=z.of(this,arguments);m?clearTimeout(m):(U.call(this),o(n)),m=setTimeout(function(){m=null,c(n)},50),d();var e=v||Xo.mouse(this);p||(p=t(e)),r(Math.pow(2,.002*Ra())*S.k),u(e,p),a(n)}function h(){p=null}function g(){var n=z.of(this,arguments),e=Xo.mouse(this),i=t(e),s=Math.log(S.k)/Math.LN2;o(n),r(Math.pow(2,Xo.event.shiftKey?Math.ceil(s)-1:Math.floor(s)+1)),u(e,i),a(n),c(n)}var p,v,m,x,M,_,b,w,S={x:0,y:0,k:1},k=[960,500],E=Da,A="mousedown.zoom",C="mousemove.zoom",N="mouseup.zoom",L="touchstart.zoom",z=y(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=z.of(this,arguments),t=S;ks?Xo.select(this).transition().each("start.zoom",function(){S=this.__chart__||{x:0,y:0,k:1},o(n)}).tween("zoom:zoom",function(){var e=k[0],r=k[1],u=e/2,i=r/2,o=Xo.interpolateZoom([(u-S.x)/S.k,(i-S.y)/S.k,e/S.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),c=e/r[2];this.__chart__=S={x:u-r[0]*c,y:i-r[1]*c,k:c},a(n)}}).each("end.zoom",function(){c(n)}):(this.__chart__=S,o(n),a(n),c(n))})},n.translate=function(t){return arguments.length?(S={x:+t[0],y:+t[1],k:S.k},i(),n):[S.x,S.y]},n.scale=function(t){return arguments.length?(S={x:S.x,y:S.y,k:+t},i(),n):S.k},n.scaleExtent=function(t){return arguments.length?(E=null==t?Da:[+t[0],+t[1]],n):E},n.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],n):v},n.size=function(t){return arguments.length?(k=t&&[+t[0],+t[1]],n):k},n.x=function(t){return arguments.length?(_=t,M=t.copy(),S={x:0,y:0,k:1},n):_},n.y=function(t){return arguments.length?(w=t,b=t.copy(),S={x:0,y:0,k:1},n):w},Xo.rebind(n,z,"on")};var Ra,Da=[0,1/0],Pa="onwheel"in Wo?(Ra=function(){return-Xo.event.deltaY*(Xo.event.deltaMode?120:1)},"wheel"):"onmousewheel"in Wo?(Ra=function(){return Xo.event.wheelDelta},"mousewheel"):(Ra=function(){return-Xo.event.detail},"MozMousePixelScroll");G.prototype.toString=function(){return this.rgb()+""},Xo.hsl=function(n,t,e){return 1===arguments.length?n instanceof Q?K(n.h,n.s,n.l):dt(""+n,mt,K):K(+n,+t,+e)};var Ua=Q.prototype=new G;Ua.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),K(this.h,this.s,this.l/n)},Ua.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),K(this.h,this.s,n*this.l)},Ua.rgb=function(){return nt(this.h,this.s,this.l)},Xo.hcl=function(n,t,e){return 1===arguments.length?n instanceof et?tt(n.h,n.c,n.l):n instanceof it?at(n.l,n.a,n.b):at((n=yt((n=Xo.rgb(n)).r,n.g,n.b)).l,n.a,n.b):tt(+n,+t,+e)};var ja=et.prototype=new G;ja.brighter=function(n){return tt(this.h,this.c,Math.min(100,this.l+Ha*(arguments.length?n:1)))},ja.darker=function(n){return tt(this.h,this.c,Math.max(0,this.l-Ha*(arguments.length?n:1)))},ja.rgb=function(){return rt(this.h,this.c,this.l).rgb()},Xo.lab=function(n,t,e){return 1===arguments.length?n instanceof it?ut(n.l,n.a,n.b):n instanceof et?rt(n.l,n.c,n.h):yt((n=Xo.rgb(n)).r,n.g,n.b):ut(+n,+t,+e)};var Ha=18,Fa=.95047,Oa=1,Ya=1.08883,Ia=it.prototype=new G;Ia.brighter=function(n){return ut(Math.min(100,this.l+Ha*(arguments.length?n:1)),this.a,this.b)},Ia.darker=function(n){return ut(Math.max(0,this.l-Ha*(arguments.length?n:1)),this.a,this.b)},Ia.rgb=function(){return ot(this.l,this.a,this.b)},Xo.rgb=function(n,t,e){return 1===arguments.length?n instanceof pt?gt(n.r,n.g,n.b):dt(""+n,gt,nt):gt(~~n,~~t,~~e)};var Za=pt.prototype=new G;Za.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),gt(Math.min(255,~~(t/n)),Math.min(255,~~(e/n)),Math.min(255,~~(r/n)))):gt(u,u,u)},Za.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),gt(~~(n*this.r),~~(n*this.g),~~(n*this.b))},Za.hsl=function(){return mt(this.r,this.g,this.b)},Za.toString=function(){return"#"+vt(this.r)+vt(this.g)+vt(this.b)};var Va=Xo.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Va.forEach(function(n,t){Va.set(n,ft(t))}),Xo.functor=_t,Xo.xhr=wt(bt),Xo.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=St(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(l>=s)return o;if(u)return u=!1,i;var t=l;if(34===n.charCodeAt(t)){for(var e=t;e++<s;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}l=e+2;var r=n.charCodeAt(e+1);return 13===r?(u=!0,10===n.charCodeAt(e+2)&&++l):10===r&&(u=!0),n.substring(t+1,e).replace(/""/g,'"')}for(;s>l;){var r=n.charCodeAt(l++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(l)&&(++l,++a);else if(r!==c)continue;return n.substring(t,l-a)}return n.substring(t)}for(var r,u,i={},o={},a=[],s=n.length,l=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();(!t||(h=t(h,f++)))&&a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new l,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},Xo.csv=Xo.dsv(",","text/csv"),Xo.tsv=Xo.dsv(" ","text/tab-separated-values");var Xa,$a,Ba,Wa,Ja,Ga=Go[h(Go,"requestAnimationFrame")]||function(n){setTimeout(n,17)};Xo.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};$a?$a.n=i:Xa=i,$a=i,Ba||(Wa=clearTimeout(Wa),Ba=1,Ga(Et))},Xo.timer.flush=function(){At(),Ct()},Xo.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var Ka=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Lt);Xo.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=Xo.round(n,Nt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((0>=e?e+1:e-1)/3)))),Ka[8+e/3]};var Qa=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,nc=Xo.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=Xo.round(n,Nt(n,t))).toFixed(Math.max(0,Math.min(20,Nt(n*(1+1e-15),t))))}}),tc=Xo.time={},ec=Date;Tt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){rc.setUTCDate.apply(this._,arguments)},setDay:function(){rc.setUTCDay.apply(this._,arguments)},setFullYear:function(){rc.setUTCFullYear.apply(this._,arguments)},setHours:function(){rc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){rc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){rc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){rc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){rc.setUTCSeconds.apply(this._,arguments)},setTime:function(){rc.setTime.apply(this._,arguments)}};var rc=Date.prototype;tc.year=Rt(function(n){return n=tc.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),tc.years=tc.year.range,tc.years.utc=tc.year.utc.range,tc.day=Rt(function(n){var t=new ec(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),tc.days=tc.day.range,tc.days.utc=tc.day.utc.range,tc.dayOfYear=function(n){var t=tc.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=tc[n]=Rt(function(n){return(n=tc.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=tc.year(n).getDay();return Math.floor((tc.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});tc[n+"s"]=e.range,tc[n+"s"].utc=e.utc.range,tc[n+"OfYear"]=function(n){var e=tc.year(n).getDay();return Math.floor((tc.dayOfYear(n)+(e+t)%7)/7)}}),tc.week=tc.sunday,tc.weeks=tc.sunday.range,tc.weeks.utc=tc.sunday.utc.range,tc.weekOfYear=tc.sundayOfYear;var uc={"-":"",_:" ",0:"0"},ic=/^\s*\d+/,oc=/^%/;Xo.locale=function(n){return{numberFormat:zt(n),timeFormat:Pt(n)}};var ac=Xo.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Xo.format=ac.numberFormat,Xo.geo={},re.prototype={s:0,t:0,add:function(n){ue(n,this.t,cc),ue(cc.s,this.s,this),this.s?this.t+=cc.t:this.s=cc.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var cc=new re;Xo.geo.stream=function(n,t){n&&sc.hasOwnProperty(n.type)?sc[n.type](n,t):ie(n,t)};var sc={Feature:function(n,t){ie(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++r<u;)ie(e[r].geometry,t)}},lc={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)n=e[r],t.point(n[0],n[1],n[2])},LineString:function(n,t){oe(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)oe(e[r],t,0)},Polygon:function(n,t){ae(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)ae(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,u=e.length;++r<u;)ie(e[r],t)}};Xo.geo.area=function(n){return fc=0,Xo.geo.stream(n,gc),fc};var fc,hc=new re,gc={sphere:function(){fc+=4*Sa},point:g,lineStart:g,lineEnd:g,polygonStart:function(){hc.reset(),gc.lineStart=ce},polygonEnd:function(){var n=2*hc;fc+=0>n?4*Sa+n:n,gc.lineStart=gc.lineEnd=gc.point=g}};Xo.geo.bounds=function(){function n(n,t){x.push(M=[l=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=se([t*Na,e*Na]);if(m){var u=fe(m,r),i=[u[1],-u[0],0],o=fe(i,u);pe(o),o=ve(o);var c=t-p,s=c>0?1:-1,v=o[0]*La*s,d=oa(c)>180;if(d^(v>s*p&&s*t>v)){var y=o[1]*La;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>s*p&&s*t>v)){var y=-o[1]*La;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(l,t)>a(l,h)&&(h=t):a(t,h)>a(l,h)&&(l=t):h>=l?(l>t&&(l=t),t>h&&(h=t)):t>p?a(l,t)>a(l,h)&&(h=t):a(t,h)>a(l,h)&&(l=t)}else n(t,e);m=r,p=t}function e(){_.point=t}function r(){M[0]=l,M[1]=h,_.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=oa(r)>180?r+(r>0?360:-360):r}else v=n,d=e;gc.point(n,e),t(n,e)}function i(){gc.lineStart()}function o(){u(v,d),gc.lineEnd(),oa(y)>Aa&&(l=-(h=180)),M[0]=l,M[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function s(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var l,f,h,g,p,v,d,m,y,x,M,_={point:n,lineStart:e,lineEnd:r,polygonStart:function(){_.point=u,_.lineStart=i,_.lineEnd=o,y=0,gc.polygonStart()},polygonEnd:function(){gc.polygonEnd(),_.point=n,_.lineStart=e,_.lineEnd=r,0>hc?(l=-(h=180),f=-(g=90)):y>Aa?g=90:-Aa>y&&(f=-90),M[0]=l,M[1]=h | |
}};return function(n){g=h=-(l=f=1/0),x=[],Xo.geo.stream(n,_);var t=x.length;if(t){x.sort(c);for(var e,r=1,u=x[0],i=[u];t>r;++r)e=x[r],s(e[0],u)||s(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,l=e[0],h=u[1])}return x=M=null,1/0===l||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[l,f],[h,g]]}}(),Xo.geo.centroid=function(n){pc=vc=dc=mc=yc=xc=Mc=_c=bc=wc=Sc=0,Xo.geo.stream(n,kc);var t=bc,e=wc,r=Sc,u=t*t+e*e+r*r;return Ca>u&&(t=xc,e=Mc,r=_c,Aa>vc&&(t=dc,e=mc,r=yc),u=t*t+e*e+r*r,Ca>u)?[0/0,0/0]:[Math.atan2(e,t)*La,X(r/Math.sqrt(u))*La]};var pc,vc,dc,mc,yc,xc,Mc,_c,bc,wc,Sc,kc={sphere:g,point:me,lineStart:xe,lineEnd:Me,polygonStart:function(){kc.lineStart=_e},polygonEnd:function(){kc.lineStart=xe}},Ec=Ee(be,ze,Te,[-Sa,-Sa/2]),Ac=1e9;Xo.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Pe(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(Xo.geo.conicEqualArea=function(){return je(He)}).raw=He,Xo.geo.albers=function(){return Xo.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Xo.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=Xo.geo.albers(),o=Xo.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=Xo.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var s=i.scale(),l=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[l-.455*s,f-.238*s],[l+.455*s,f+.238*s]]).stream(c).point,r=o.translate([l-.307*s,f+.201*s]).clipExtent([[l-.425*s+Aa,f+.12*s+Aa],[l-.214*s-Aa,f+.234*s-Aa]]).stream(c).point,u=a.translate([l-.205*s,f+.212*s]).clipExtent([[l-.214*s+Aa,f+.166*s+Aa],[l-.115*s-Aa,f+.234*s-Aa]]).stream(c).point,n},n.scale(1070)};var Cc,Nc,Lc,zc,qc,Tc,Rc={point:g,lineStart:g,lineEnd:g,polygonStart:function(){Nc=0,Rc.lineStart=Fe},polygonEnd:function(){Rc.lineStart=Rc.lineEnd=Rc.point=g,Cc+=oa(Nc/2)}},Dc={point:Oe,lineStart:g,lineEnd:g,polygonStart:g,polygonEnd:g},Pc={point:Ze,lineStart:Ve,lineEnd:Xe,polygonStart:function(){Pc.lineStart=$e},polygonEnd:function(){Pc.point=Ze,Pc.lineStart=Ve,Pc.lineEnd=Xe}};Xo.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),Xo.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return Cc=0,Xo.geo.stream(n,u(Rc)),Cc},n.centroid=function(n){return dc=mc=yc=xc=Mc=_c=bc=wc=Sc=0,Xo.geo.stream(n,u(Pc)),Sc?[bc/Sc,wc/Sc]:_c?[xc/_c,Mc/_c]:yc?[dc/yc,mc/yc]:[0/0,0/0]},n.bounds=function(n){return qc=Tc=-(Lc=zc=1/0),Xo.geo.stream(n,u(Dc)),[[Lc,zc],[qc,Tc]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||Je(n):bt,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new Ye:new Be(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(Xo.geo.albersUsa()).context(null)},Xo.geo.transform=function(n){return{stream:function(t){var e=new Ge(t);for(var r in n)e[r]=n[r];return e}}},Ge.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},Xo.geo.projection=Qe,Xo.geo.projectionMutator=nr,(Xo.geo.equirectangular=function(){return Qe(er)}).raw=er.invert=er,Xo.geo.rotation=function(n){function t(t){return t=n(t[0]*Na,t[1]*Na),t[0]*=La,t[1]*=La,t}return n=ur(n[0]%360*Na,n[1]*Na,n.length>2?n[2]*Na:0),t.invert=function(t){return t=n.invert(t[0]*Na,t[1]*Na),t[0]*=La,t[1]*=La,t},t},rr.invert=er,Xo.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=ur(-n[0]*Na,-n[1]*Na,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=La,n[1]*=La}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=cr((t=+r)*Na,u*Na),n):t},n.precision=function(r){return arguments.length?(e=cr(t*Na,(u=+r)*Na),n):u},n.angle(90)},Xo.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Na,u=n[1]*Na,i=t[1]*Na,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),s=Math.cos(u),l=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=s*l-c*f*a)*e),c*l+s*f*a)},Xo.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return Xo.range(Math.ceil(i/d)*d,u,d).map(h).concat(Xo.range(Math.ceil(s/m)*m,c,m).map(g)).concat(Xo.range(Math.ceil(r/p)*p,e,p).filter(function(n){return oa(n%d)>Aa}).map(l)).concat(Xo.range(Math.ceil(a/v)*v,o,v).filter(function(n){return oa(n%m)>Aa}).map(f))}var e,r,u,i,o,a,c,s,l,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(s).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],s=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),s>c&&(t=s,s=c,c=t),n.precision(y)):[[i,s],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,l=lr(a,o,90),f=fr(r,e,y),h=lr(s,c,90),g=fr(i,u,y),n):y},n.majorExtent([[-180,-90+Aa],[180,90-Aa]]).minorExtent([[-180,-80-Aa],[180,80+Aa]])},Xo.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=hr,u=gr;return n.distance=function(){return Xo.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},Xo.geo.interpolate=function(n,t){return pr(n[0]*Na,n[1]*Na,t[0]*Na,t[1]*Na)},Xo.geo.length=function(n){return Uc=0,Xo.geo.stream(n,jc),Uc};var Uc,jc={sphere:g,point:g,lineStart:vr,lineEnd:g,polygonStart:g,polygonEnd:g},Hc=dr(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(Xo.geo.azimuthalEqualArea=function(){return Qe(Hc)}).raw=Hc;var Fc=dr(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},bt);(Xo.geo.azimuthalEquidistant=function(){return Qe(Fc)}).raw=Fc,(Xo.geo.conicConformal=function(){return je(mr)}).raw=mr,(Xo.geo.conicEquidistant=function(){return je(yr)}).raw=yr;var Oc=dr(function(n){return 1/n},Math.atan);(Xo.geo.gnomonic=function(){return Qe(Oc)}).raw=Oc,xr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Ea]},(Xo.geo.mercator=function(){return Mr(xr)}).raw=xr;var Yc=dr(function(){return 1},Math.asin);(Xo.geo.orthographic=function(){return Qe(Yc)}).raw=Yc;var Ic=dr(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(Xo.geo.stereographic=function(){return Qe(Ic)}).raw=Ic,_r.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Ea]},(Xo.geo.transverseMercator=function(){var n=Mr(_r),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[-n[1],n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},n.rotate([0,0])}).raw=_r,Xo.geom={},Xo.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=_t(e),i=_t(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(kr),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var s=Sr(a),l=Sr(c),f=l[0]===s[0],h=l[l.length-1]===s[s.length-1],g=[];for(t=s.length-1;t>=0;--t)g.push(n[a[s[t]][2]]);for(t=+f;t<l.length-h;++t)g.push(n[a[l[t]][2]]);return g}var e=br,r=wr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},Xo.geom.polygon=function(n){return fa(n,Zc),n};var Zc=Xo.geom.polygon.prototype=[];Zc.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],u=0;++t<e;)n=r,r=this[t],u+=n[1]*r[0]-n[0]*r[1];return.5*u},Zc.centroid=function(n){var t,e,r=-1,u=this.length,i=0,o=0,a=this[u-1];for(arguments.length||(n=-1/(6*this.area()));++r<u;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],i+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[i*n,o*n]},Zc.clip=function(n){for(var t,e,r,u,i,o,a=Cr(n),c=-1,s=this.length-Cr(this),l=this[s-1];++c<s;){for(t=n.slice(),n.length=0,u=this[c],i=t[(r=t.length-a)-1],e=-1;++e<r;)o=t[e],Er(o,l,u)?(Er(i,l,u)||n.push(Ar(i,o,l,u)),n.push(o)):Er(i,l,u)&&n.push(Ar(i,o,l,u)),i=o;a&&n.push(n[0]),l=u}return n};var Vc,Xc,$c,Bc,Wc,Jc=[],Gc=[];Pr.prototype.prepare=function(){for(var n,t=this.edges,e=t.length;e--;)n=t[e].edge,n.b&&n.a||t.splice(e,1);return t.sort(jr),t.length},Br.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},Wr.prototype={insert:function(n,t){var e,r,u;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=Qr(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)r=e.U,e===r.L?(u=r.R,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.R&&(Gr(this,e),n=e,e=n.U),e.C=!1,r.C=!0,Kr(this,r))):(u=r.L,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.L&&(Kr(this,e),n=e,e=n.U),e.C=!1,r.C=!0,Gr(this,r))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t,e,r,u=n.U,i=n.L,o=n.R;if(e=i?o?Qr(o):i:o,u?u.L===n?u.L=e:u.R=e:this._=e,i&&o?(r=e.C,e.C=n.C,e.L=i,i.U=e,e!==o?(u=e.U,e.U=n.U,n=e.R,u.L=n,e.R=o,o.U=e):(e.U=u,u=e,n=e.R)):(r=n.C,n=e),n&&(n.U=u),!r){if(n&&n.C)return n.C=!1,void 0;do{if(n===this._)break;if(n===u.L){if(t=u.R,t.C&&(t.C=!1,u.C=!0,Gr(this,u),t=u.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,Kr(this,t),t=u.R),t.C=u.C,u.C=t.R.C=!1,Gr(this,u),n=this._;break}}else if(t=u.L,t.C&&(t.C=!1,u.C=!0,Kr(this,u),t=u.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,Gr(this,t),t=u.L),t.C=u.C,u.C=t.L.C=!1,Kr(this,u),n=this._;break}t.C=!0,n=u,u=u.U}while(!n.C);n&&(n.C=!1)}}},Xo.geom.voronoi=function(n){function t(n){var t=new Array(n.length),r=a[0][0],u=a[0][1],i=a[1][0],o=a[1][1];return nu(e(n),a).cells.forEach(function(e,a){var c=e.edges,s=e.site,l=t[a]=c.length?c.map(function(n){var t=n.start();return[t.x,t.y]}):s.x>=r&&s.x<=i&&s.y>=u&&s.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];l.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Aa)*Aa,y:Math.round(o(n,t)/Aa)*Aa,i:t}})}var r=br,u=wr,i=r,o=u,a=Kc;return n?t(n):(t.links=function(n){return nu(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return nu(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(jr),c=-1,s=a.length,l=a[s-1].edge,f=l.l===o?l.r:l.l;++c<s;)u=l,i=f,l=a[c].edge,f=l.l===o?l.r:l.l,r<i.i&&r<f.i&&eu(o,i,f)<0&&t.push([n[r],n[i.i],n[f.i]])}),t},t.x=function(n){return arguments.length?(i=_t(r=n),t):r},t.y=function(n){return arguments.length?(o=_t(u=n),t):u},t.clipExtent=function(n){return arguments.length?(a=null==n?Kc:n,t):a===Kc?null:a},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):a===Kc?null:a&&a[1]},t)};var Kc=[[-1e6,-1e6],[1e6,1e6]];Xo.geom.delaunay=function(n){return Xo.geom.voronoi().triangles(n)},Xo.geom.quadtree=function(n,t,e,r,u){function i(n){function i(n,t,e,r,u,i,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,l=n.y;if(null!=c)if(oa(c-e)+oa(l-r)<.01)s(n,t,e,r,u,i,o,a);else{var f=n.point;n.x=n.y=n.point=null,s(n,f,c,l,u,i,o,a),s(n,t,e,r,u,i,o,a)}else n.x=e,n.y=r,n.point=t}else s(n,t,e,r,u,i,o,a)}function s(n,t,e,r,u,o,a,c){var s=.5*(u+a),l=.5*(o+c),f=e>=s,h=r>=l,g=(h<<1)+f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=iu()),f?u=s:a=s,h?o=l:c=l,i(n,t,e,r,u,o,a,c)}var l,f,h,g,p,v,d,m,y,x=_t(a),M=_t(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)l=n[g],l.x<v&&(v=l.x),l.y<d&&(d=l.y),l.x>m&&(m=l.x),l.y>y&&(y=l.y),f.push(l.x),h.push(l.y);else for(g=0;p>g;++g){var _=+x(l=n[g],g),b=+M(l,g);v>_&&(v=_),d>b&&(d=b),_>m&&(m=_),b>y&&(y=b),f.push(_),h.push(b)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=iu();if(k.add=function(n){i(k,n,+x(n,++g),+M(n,g),v,d,m,y)},k.visit=function(n){ou(n,k,v,d,m,y)},g=-1,null==t){for(;++g<p;)i(k,n[g],f[g],h[g],v,d,m,y);--g}else n.forEach(k.add);return f=h=n=l=null,k}var o,a=br,c=wr;return(o=arguments.length)?(a=ru,c=uu,3===o&&(u=e,r=t,e=t=0),i(n)):(i.x=function(n){return arguments.length?(a=n,i):a},i.y=function(n){return arguments.length?(c=n,i):c},i.extent=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],u=+n[1][1]),i):null==t?null:[[t,e],[r,u]]},i.size=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=e=0,r=+n[0],u=+n[1]),i):null==t?null:[r-t,u-e]},i)},Xo.interpolateRgb=au,Xo.interpolateObject=cu,Xo.interpolateNumber=su,Xo.interpolateString=lu;var Qc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;Xo.interpolate=fu,Xo.interpolators=[function(n,t){var e=typeof t;return("string"===e?Va.has(t)||/^(#|rgb\(|hsl\()/.test(t)?au:lu:t instanceof G?au:"object"===e?Array.isArray(t)?hu:cu:su)(n,t)}],Xo.interpolateArray=hu;var ns=function(){return bt},ts=Xo.map({linear:ns,poly:xu,quad:function(){return du},cubic:function(){return mu},sin:function(){return Mu},exp:function(){return _u},circle:function(){return bu},elastic:wu,back:Su,bounce:function(){return ku}}),es=Xo.map({"in":bt,out:pu,"in-out":vu,"out-in":function(n){return vu(pu(n))}});Xo.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.substring(0,t):n,r=t>=0?n.substring(t+1):"in";return e=ts.get(e)||ns,r=es.get(r)||bt,gu(r(e.apply(null,$o.call(arguments,1))))},Xo.interpolateHcl=Eu,Xo.interpolateHsl=Au,Xo.interpolateLab=Cu,Xo.interpolateRound=Nu,Xo.transform=function(n){var t=Wo.createElementNS(Xo.ns.prefix.svg,"g");return(Xo.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Lu(e?e.matrix:rs)})(n)},Lu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var rs={a:1,b:0,c:0,d:1,e:0,f:0};Xo.interpolateTransform=Ru,Xo.layout={},Xo.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Uu(n[e]));return t}},Xo.layout.chord=function(){function n(){var n,s,f,h,g,p={},v=[],d=Xo.range(i),m=[];for(e=[],r=[],n=0,h=-1;++h<i;){for(s=0,g=-1;++g<i;)s+=u[h][g];v.push(s),m.push(Xo.range(i)),n+=s}for(o&&d.sort(function(n,t){return o(v[n],v[t])}),a&&m.forEach(function(n,t){n.sort(function(n,e){return a(u[t][n],u[t][e])})}),n=(ka-l*i)/n,s=0,h=-1;++h<i;){for(f=s,g=-1;++g<i;){var y=d[h],x=m[y][g],M=u[y][x],_=s,b=s+=M*n;p[y+"-"+x]={index:y,subindex:x,startAngle:_,endAngle:b,value:M}}r[y]={index:y,startAngle:f,endAngle:s,value:(s-f)/n},s+=l}for(h=-1;++h<i;)for(g=h-1;++g<i;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,u,i,o,a,c,s={},l=0;return s.matrix=function(n){return arguments.length?(i=(u=n)&&u.length,e=r=null,s):u},s.padding=function(n){return arguments.length?(l=n,e=r=null,s):l},s.sortGroups=function(n){return arguments.length?(o=n,e=r=null,s):o},s.sortSubgroups=function(n){return arguments.length?(a=n,e=null,s):a},s.sortChords=function(n){return arguments.length?(c=n,e&&t(),s):c},s.chords=function(){return e||n(),e},s.groups=function(){return r||n(),r},s},Xo.layout.force=function(){function n(n){return function(t,e,r,u){if(t.point!==n){var i=t.cx-n.x,o=t.cy-n.y,a=u-e,c=i*i+o*o;if(c>a*a/d){if(p>c){var s=t.charge/c;n.px-=i*s,n.py-=o*s}return!0}if(t.point&&c&&p>c){var s=t.pointCharge/c;n.px-=i*s,n.py-=o*s}}return!t.charge}}function t(n){n.px=Xo.event.x,n.py=Xo.event.y,a.resume()}var e,r,u,i,o,a={},c=Xo.dispatch("start","tick","end"),s=[1,1],l=.9,f=us,h=is,g=-30,p=os,v=.1,d=.64,m=[],y=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,x,M,_=m.length,b=y.length;for(e=0;b>e;++e)a=y[e],f=a.source,h=a.target,x=h.x-f.x,M=h.y-f.y,(p=x*x+M*M)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,x*=p,M*=p,h.x-=x*(d=f.weight/(h.weight+f.weight)),h.y-=M*d,f.x+=x*(d=1-d),f.y+=M*d);if((d=r*v)&&(x=s[0]/2,M=s[1]/2,e=-1,d))for(;++e<_;)a=m[e],a.x+=(x-a.x)*d,a.y+=(M-a.y)*d;if(g)for(Zu(t=Xo.geom.quadtree(m),r,o),e=-1;++e<_;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;++e<_;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*l,a.y-=(a.py-(a.py=a.y))*l);c.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(y=n,a):y},a.size=function(n){return arguments.length?(s=n,a):s},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(l=+n,a):l},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.chargeDistance=function(n){return arguments.length?(p=n*n,a):Math.sqrt(p)},a.gravity=function(n){return arguments.length?(v=+n,a):v},a.theta=function(n){return arguments.length?(d=n*n,a):Math.sqrt(d)},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),Xo.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;s>a;++a){var u=y[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,s=o.length;++a<s;)if(!isNaN(i=o[a][n]))return i;return Math.random()*r}var t,e,r,c=m.length,l=y.length,p=s[0],v=s[1];for(t=0;c>t;++t)(r=m[t]).index=t,r.weight=0;for(t=0;l>t;++t)r=y[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;l>t;++t)u[t]=+f.call(this,y[t],t);else for(t=0;l>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;l>t;++t)i[t]=+h.call(this,y[t],t);else for(t=0;l>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=Xo.behavior.drag().origin(bt).on("dragstart.force",Fu).on("drag.force",t).on("dragend.force",Ou)),arguments.length?(this.on("mouseover.force",Yu).on("mouseout.force",Iu).call(e),void 0):e},Xo.rebind(a,c,"on")};var us=20,is=1,os=1/0;Xo.layout.hierarchy=function(){function n(t,o,a){var c=u.call(e,t,o);if(t.depth=o,a.push(t),c&&(s=c.length)){for(var s,l,f=-1,h=t.children=new Array(s),g=0,p=o+1;++f<s;)l=h[f]=n(c[f],p,a),l.parent=t,g+=l.value;r&&h.sort(r),i&&(t.value=g)}else delete t.children,i&&(t.value=+i.call(e,t,o)||0);return t}function t(n,r){var u=n.children,o=0;if(u&&(a=u.length))for(var a,c=-1,s=r+1;++c<a;)o+=t(u[c],s);else i&&(o=+i.call(e,n,r)||0);return i&&(n.value=o),o}function e(t){var e=[];return n(t,0,e),e}var r=Bu,u=Xu,i=$u;return e.sort=function(n){return arguments.length?(r=n,e):r},e.children=function(n){return arguments.length?(u=n,e):u},e.value=function(n){return arguments.length?(i=n,e):i},e.revalue=function(n){return t(n,0),n},e},Xo.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,s=-1;for(r=t.value?r/t.value:0;++s<o;)n(a=i[s],e,c=a.value*r,u),e+=c}}function t(n){var e=n.children,r=0;if(e&&(u=e.length))for(var u,i=-1;++i<u;)r=Math.max(r,t(e[i]));return 1+r}function e(e,i){var o=r.call(this,e,i);return n(o[0],0,u[0],u[1]/t(o[0])),o}var r=Xo.layout.hierarchy(),u=[1,1];return e.size=function(n){return arguments.length?(u=n,e):u},Vu(e,r)},Xo.layout.pie=function(){function n(i){var o=i.map(function(e,r){return+t.call(n,e,r)}),a=+("function"==typeof r?r.apply(this,arguments):r),c=(("function"==typeof u?u.apply(this,arguments):u)-a)/Xo.sum(o),s=Xo.range(i.length);null!=e&&s.sort(e===as?function(n,t){return o[t]-o[n]}:function(n,t){return e(i[n],i[t])});var l=[];return s.forEach(function(n){var t;l[n]={data:i[n],value:t=o[n],startAngle:a,endAngle:a+=t*c}}),l}var t=Number,e=as,r=0,u=ka;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n};var as={};Xo.layout.stack=function(){function n(a,c){var s=a.map(function(e,r){return t.call(n,e,r)}),l=s.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,l,c);s=Xo.permute(s,f),l=Xo.permute(l,f);var h,g,p,v=r.call(n,l,c),d=s.length,m=s[0].length;for(g=0;m>g;++g)for(u.call(n,s[0][g],p=v[g],l[0][g][1]),h=1;d>h;++h)u.call(n,s[h][g],p+=l[h-1][g][1],l[h][g][1]);return a}var t=bt,e=Qu,r=ni,u=Ku,i=Ju,o=Gu;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:cs.get(t)||Qu,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:ss.get(t)||ni,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var cs=Xo.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(ti),i=n.map(ei),o=Xo.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,s=[],l=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],s.push(e)):(c+=i[e],l.push(e));return l.reverse().concat(s)},reverse:function(n){return Xo.range(n.length).reverse()},"default":Qu}),ss=Xo.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,s,l=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=s=0,e=1;h>e;++e){for(t=0,u=0;l>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];l>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,s>c&&(s=c)}for(e=0;h>e;++e)g[e]-=s;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:ni});Xo.layout.histogram=function(){function n(n,i){for(var o,a,c=[],s=n.map(e,this),l=r.call(this,s,i),f=u.call(this,l,s,i),i=-1,h=s.length,g=f.length-1,p=t?1:1/h;++i<g;)o=c[i]=[],o.dx=f[i+1]-(o.x=f[i]),o.y=0;if(g>0)for(i=-1;++i<h;)a=s[i],a>=l[0]&&a<=l[1]&&(o=c[Xo.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=oi,u=ui;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=_t(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return ii(n,t)}:_t(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},Xo.layout.tree=function(){function n(n,i){function o(n,t){var r=n.children,u=n._tree;if(r&&(i=r.length)){for(var i,a,s,l=r[0],f=l,h=-1;++h<i;)s=r[h],o(s,a),f=c(s,a,f),a=s;vi(n);var g=.5*(l._tree.prelim+s._tree.prelim);t?(u.prelim=t._tree.prelim+e(n,t),u.mod=u.prelim-g):u.prelim=g}else t&&(u.prelim=t._tree.prelim+e(n,t))}function a(n,t){n.x=n._tree.prelim+t;var e=n.children;if(e&&(r=e.length)){var r,u=-1;for(t+=n._tree.mod;++u<r;)a(e[u],t)}}function c(n,t,r){if(t){for(var u,i=n,o=n,a=t,c=n.parent.children[0],s=i._tree.mod,l=o._tree.mod,f=a._tree.mod,h=c._tree.mod;a=si(a),i=ci(i),a&&i;)c=ci(c),o=si(o),o._tree.ancestor=n,u=a._tree.prelim+f-i._tree.prelim-s+e(a,i),u>0&&(di(mi(a,n,r),n,u),s+=u,l+=u),f+=a._tree.mod,s+=i._tree.mod,h+=c._tree.mod,l+=o._tree.mod;a&&!si(o)&&(o._tree.thread=a,o._tree.mod+=f-l),i&&!ci(c)&&(c._tree.thread=i,c._tree.mod+=s-h,r=n)}return r}var s=t.call(this,n,i),l=s[0];pi(l,function(n,t){n._tree={ancestor:n,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),o(l),a(l,-l._tree.prelim);var f=li(l,hi),h=li(l,fi),g=li(l,gi),p=f.x-e(f,h)/2,v=h.x+e(h,f)/2,d=g.depth||1;return pi(l,u?function(n){n.x*=r[0],n.y=n.depth*r[1],delete n._tree}:function(n){n.x=(n.x-p)/(v-p)*r[0],n.y=n.depth/d*r[1],delete n._tree}),s}var t=Xo.layout.hierarchy().sort(null).value(null),e=ai,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Vu(n,t)},Xo.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],s=u[1],l=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,pi(a,function(n){n.r=+l(n.value)}),pi(a,bi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/s))/2;pi(a,function(n){n.r+=f}),pi(a,bi),pi(a,function(n){n.r-=f})}return ki(a,c/2,s/2,t?1:1/Math.max(2*a.r/c,2*a.r/s)),o}var t,e=Xo.layout.hierarchy().sort(yi),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Vu(n,e)},Xo.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],s=0;pi(c,function(n){var t=n.children;t&&t.length?(n.x=Ci(t),n.y=Ai(t)):(n.x=o?s+=e(n,o):0,n.y=0,o=n)});var l=Ni(c),f=Li(c),h=l.x-e(l,f)/2,g=f.x+e(f,l)/2;return pi(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=Xo.layout.hierarchy().sort(null).value(null),e=ai,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Vu(n,t)},Xo.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++u<i;)r=(e=n[u]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,s=f(e),l=[],h=i.slice(),p=1/0,v="slice"===g?s.dx:"dice"===g?s.dy:"slice-dice"===g?1&e.depth?s.dy:s.dx:Math.min(s.dx,s.dy);for(n(h,s.dx*s.dy/e.value),l.area=0;(c=h.length)>0;)l.push(o=h[c-1]),l.area+=o.area,"squarify"!==g||(a=r(l,v))<=p?(h.pop(),p=a):(l.area-=l.pop().area,u(l,v,s,!1),v=Math.min(s.dx,s.dy),l.length=l.area=0,p=1/0);l.length&&(u(l,v,s,!0),l.length=l.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++o<a;)(e=n[o].area)&&(i>e&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,s=e.y,l=t?c(n.area/t):0;if(t==e.dx){for((r||l>e.dy)&&(l=e.dy);++i<o;)u=n[i],u.x=a,u.y=s,u.dy=l,a+=u.dx=Math.min(e.x+e.dx-a,l?c(u.area/l):0);u.z=!0,u.dx+=e.x+e.dx-a,e.y+=l,e.dy-=l}else{for((r||l>e.dx)&&(l=e.dx);++i<o;)u=n[i],u.x=a,u.y=s,u.dx=l,s+=u.dy=Math.min(e.y+e.dy-s,l?c(u.area/l):0);u.z=!1,u.dy+=e.y+e.dy-s,e.x+=l,e.dx-=l}}function i(r){var u=o||a(r),i=u[0];return i.x=0,i.y=0,i.dx=s[0],i.dy=s[1],o&&a.revalue(i),n([i],i.dx*i.dy/i.value),(o?e:t)(i),h&&(o=u),u}var o,a=Xo.layout.hierarchy(),c=Math.round,s=[1,1],l=null,f=zi,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return i.size=function(n){return arguments.length?(s=n,i):s},i.padding=function(n){function t(t){var e=n.call(i,t,t.depth);return null==e?zi(t):qi(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return qi(t,n)}if(!arguments.length)return l;var r;return f=null==(l=n)?zi:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,i},i.round=function(n){return arguments.length?(c=n?Math.round:Number,i):c!=Number},i.sticky=function(n){return arguments.length?(h=n,o=null,i):h},i.ratio=function(n){return arguments.length?(p=n,i):p},i.mode=function(n){return arguments.length?(g=n+"",i):g},Vu(i,a)},Xo.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var n=Xo.random.normal.apply(Xo,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=Xo.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},Xo.scale={};var ls={floor:bt,ceil:bt};Xo.scale.linear=function(){return Hi([0,1],[0,1],fu,!1)};var fs={s:1,g:1,p:1,r:1,e:1};Xo.scale.log=function(){return $i(Xo.scale.linear().domain([0,1]),10,!0,[1,10])};var hs=Xo.format(".0e"),gs={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};Xo.scale.pow=function(){return Bi(Xo.scale.linear(),1,[0,1])},Xo.scale.sqrt=function(){return Xo.scale.pow().exponent(.5)},Xo.scale.ordinal=function(){return Ji([],{t:"range",a:[[]]})},Xo.scale.category10=function(){return Xo.scale.ordinal().range(ps)},Xo.scale.category20=function(){return Xo.scale.ordinal().range(vs)},Xo.scale.category20b=function(){return Xo.scale.ordinal().range(ds)},Xo.scale.category20c=function(){return Xo.scale.ordinal().range(ms)};var ps=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ht),vs=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ht),ds=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ht),ms=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ht);Xo.scale.quantile=function(){return Gi([],[]) | |
},Xo.scale.quantize=function(){return Ki(0,1,[0,1])},Xo.scale.threshold=function(){return Qi([.5],[0,1])},Xo.scale.identity=function(){return no([0,1])},Xo.svg={},Xo.svg.arc=function(){function n(){var n=t.apply(this,arguments),i=e.apply(this,arguments),o=r.apply(this,arguments)+ys,a=u.apply(this,arguments)+ys,c=(o>a&&(c=o,o=a,a=c),a-o),s=Sa>c?"0":"1",l=Math.cos(o),f=Math.sin(o),h=Math.cos(a),g=Math.sin(a);return c>=xs?n?"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"M0,"+n+"A"+n+","+n+" 0 1,0 0,"+-n+"A"+n+","+n+" 0 1,0 0,"+n+"Z":"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"Z":n?"M"+i*l+","+i*f+"A"+i+","+i+" 0 "+s+",1 "+i*h+","+i*g+"L"+n*h+","+n*g+"A"+n+","+n+" 0 "+s+",0 "+n*l+","+n*f+"Z":"M"+i*l+","+i*f+"A"+i+","+i+" 0 "+s+",1 "+i*h+","+i*g+"L0,0"+"Z"}var t=to,e=eo,r=ro,u=uo;return n.innerRadius=function(e){return arguments.length?(t=_t(e),n):t},n.outerRadius=function(t){return arguments.length?(e=_t(t),n):e},n.startAngle=function(t){return arguments.length?(r=_t(t),n):r},n.endAngle=function(t){return arguments.length?(u=_t(t),n):u},n.centroid=function(){var n=(t.apply(this,arguments)+e.apply(this,arguments))/2,i=(r.apply(this,arguments)+u.apply(this,arguments))/2+ys;return[Math.cos(i)*n,Math.sin(i)*n]},n};var ys=-Ea,xs=ka-Aa;Xo.svg.line=function(){return io(bt)};var Ms=Xo.map({linear:oo,"linear-closed":ao,step:co,"step-before":so,"step-after":lo,basis:mo,"basis-open":yo,"basis-closed":xo,bundle:Mo,cardinal:go,"cardinal-open":fo,"cardinal-closed":ho,monotone:Eo});Ms.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var _s=[0,2/3,1/3,0],bs=[0,1/3,2/3,0],ws=[0,1/6,2/3,1/6];Xo.svg.line.radial=function(){var n=io(Ao);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},so.reverse=lo,lo.reverse=so,Xo.svg.area=function(){return Co(bt)},Xo.svg.area.radial=function(){var n=Co(Ao);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},Xo.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),s=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,s)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,s.r,s.p0)+r(s.r,s.p1,s.a1-s.a0)+u(s.r,s.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)+ys,l=s.call(n,u,r)+ys;return{r:i,a0:o,a1:l,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(l),i*Math.sin(l)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Sa)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=hr,o=gr,a=No,c=ro,s=uo;return n.radius=function(t){return arguments.length?(a=_t(t),n):a},n.source=function(t){return arguments.length?(i=_t(t),n):i},n.target=function(t){return arguments.length?(o=_t(t),n):o},n.startAngle=function(t){return arguments.length?(c=_t(t),n):c},n.endAngle=function(t){return arguments.length?(s=_t(t),n):s},n},Xo.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=hr,e=gr,r=Lo;return n.source=function(e){return arguments.length?(t=_t(e),n):t},n.target=function(t){return arguments.length?(e=_t(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},Xo.svg.diagonal.radial=function(){var n=Xo.svg.diagonal(),t=Lo,e=n.projection;return n.projection=function(n){return arguments.length?e(zo(t=n)):t},n},Xo.svg.symbol=function(){function n(n,r){return(Ss.get(t.call(this,n,r))||Ro)(e.call(this,n,r))}var t=To,e=qo;return n.type=function(e){return arguments.length?(t=_t(e),n):t},n.size=function(t){return arguments.length?(e=_t(t),n):e},n};var Ss=Xo.map({circle:Ro,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Cs)),e=t*Cs;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/As),e=t*As/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/As),e=t*As/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});Xo.svg.symbolTypes=Ss.keys();var ks,Es,As=Math.sqrt(3),Cs=Math.tan(30*Na),Ns=[],Ls=0;Ns.call=da.call,Ns.empty=da.empty,Ns.node=da.node,Ns.size=da.size,Xo.transition=function(n){return arguments.length?ks?n.transition():n:xa.transition()},Xo.transition.prototype=Ns,Ns.select=function(n){var t,e,r,u=this.id,i=[];n=M(n);for(var o=-1,a=this.length;++o<a;){i.push(t=[]);for(var c=this[o],s=-1,l=c.length;++s<l;)(r=c[s])&&(e=n.call(r,r.__data__,s,o))?("__data__"in r&&(e.__data__=r.__data__),jo(e,s,u,r.__transition__[u]),t.push(e)):t.push(null)}return Do(i,u)},Ns.selectAll=function(n){var t,e,r,u,i,o=this.id,a=[];n=_(n);for(var c=-1,s=this.length;++c<s;)for(var l=this[c],f=-1,h=l.length;++f<h;)if(r=l[f]){i=r.__transition__[o],e=n.call(r,r.__data__,f,c),a.push(t=[]);for(var g=-1,p=e.length;++g<p;)(u=e[g])&&jo(u,g,o,i),t.push(u)}return Do(a,o)},Ns.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=q(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return Do(u,this.id)},Ns.tween=function(n,t){var e=this.id;return arguments.length<2?this.node().__transition__[e].tween.get(n):R(this,null==t?function(t){t.__transition__[e].tween.remove(n)}:function(r){r.__transition__[e].tween.set(n,t)})},Ns.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Ru:fu,a=Xo.ns.qualify(n);return Po(this,"attr."+n,t,a.local?i:u)},Ns.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=Xo.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Ns.style=function(n,t,e){function r(){this.style.removeProperty(n)}function u(t){return null==t?r:(t+="",function(){var r,u=Go.getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(r=fu(u,t),function(t){this.style.setProperty(n,r(t),e)})})}var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Po(this,"style."+n,t,u)},Ns.styleTween=function(n,t,e){function r(r,u){var i=t.call(this,r,u,Go.getComputedStyle(this,null).getPropertyValue(n));return i&&function(t){this.style.setProperty(n,i(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Ns.text=function(n){return Po(this,"text",n,Uo)},Ns.remove=function(){return this.each("end.transition",function(){var n;this.__transition__.count<2&&(n=this.parentNode)&&n.removeChild(this)})},Ns.ease=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:("function"!=typeof n&&(n=Xo.ease.apply(Xo,arguments)),R(this,function(e){e.__transition__[t].ease=n}))},Ns.delay=function(n){var t=this.id;return R(this,"function"==typeof n?function(e,r,u){e.__transition__[t].delay=+n.call(e,e.__data__,r,u)}:(n=+n,function(e){e.__transition__[t].delay=n}))},Ns.duration=function(n){var t=this.id;return R(this,"function"==typeof n?function(e,r,u){e.__transition__[t].duration=Math.max(1,n.call(e,e.__data__,r,u))}:(n=Math.max(1,n),function(e){e.__transition__[t].duration=n}))},Ns.each=function(n,t){var e=this.id;if(arguments.length<2){var r=Es,u=ks;ks=e,R(this,function(t,r,u){Es=t.__transition__[e],n.call(t,t.__data__,r,u)}),Es=r,ks=u}else R(this,function(r){var u=r.__transition__[e];(u.event||(u.event=Xo.dispatch("start","end"))).on(n,t)});return this},Ns.transition=function(){for(var n,t,e,r,u=this.id,i=++Ls,o=[],a=0,c=this.length;c>a;a++){o.push(n=[]);for(var t=this[a],s=0,l=t.length;l>s;s++)(e=t[s])&&(r=Object.create(e.__transition__[u]),r.delay+=r.duration,jo(e,s,i,r)),n.push(e)}return Do(o,i)},Xo.svg.axis=function(){function n(n){n.each(function(){var n,s=Xo.select(this),l=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):bt:t,p=s.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Aa),d=Xo.transition(p.exit()).style("opacity",Aa).remove(),m=Xo.transition(p).style("opacity",1),y=Ri(f),x=s.selectAll(".domain").data([0]),M=(x.enter().append("path").attr("class","domain"),Xo.transition(x));v.append("line"),v.append("text");var _=v.select("line"),b=m.select("line"),w=p.select("text").text(g),S=v.select("text"),k=m.select("text");switch(r){case"bottom":n=Ho,_.attr("y2",u),S.attr("y",Math.max(u,0)+o),b.attr("x2",0).attr("y2",u),k.attr("x",0).attr("y",Math.max(u,0)+o),w.attr("dy",".71em").style("text-anchor","middle"),M.attr("d","M"+y[0]+","+i+"V0H"+y[1]+"V"+i);break;case"top":n=Ho,_.attr("y2",-u),S.attr("y",-(Math.max(u,0)+o)),b.attr("x2",0).attr("y2",-u),k.attr("x",0).attr("y",-(Math.max(u,0)+o)),w.attr("dy","0em").style("text-anchor","middle"),M.attr("d","M"+y[0]+","+-i+"V0H"+y[1]+"V"+-i);break;case"left":n=Fo,_.attr("x2",-u),S.attr("x",-(Math.max(u,0)+o)),b.attr("x2",-u).attr("y2",0),k.attr("x",-(Math.max(u,0)+o)).attr("y",0),w.attr("dy",".32em").style("text-anchor","end"),M.attr("d","M"+-i+","+y[0]+"H0V"+y[1]+"H"+-i);break;case"right":n=Fo,_.attr("x2",u),S.attr("x",Math.max(u,0)+o),b.attr("x2",u).attr("y2",0),k.attr("x",Math.max(u,0)+o).attr("y",0),w.attr("dy",".32em").style("text-anchor","start"),M.attr("d","M"+i+","+y[0]+"H0V"+y[1]+"H"+i)}if(f.rangeBand){var E=f,A=E.rangeBand()/2;l=f=function(n){return E(n)+A}}else l.rangeBand?l=f:d.call(n,f);v.call(n,l),m.call(n,f)})}var t,e=Xo.scale.linear(),r=zs,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in qs?t+"":zs,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var zs="bottom",qs={top:1,right:1,bottom:1,left:1};Xo.svg.brush=function(){function n(i){i.each(function(){var i=Xo.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=i.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=i.selectAll(".resize").data(p,bt);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Ts[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var l,f=Xo.transition(i),h=Xo.transition(o);c&&(l=Ri(c),h.attr("x",l[0]).attr("width",l[1]-l[0]),e(f)),s&&(l=Ri(s),h.attr("y",l[0]).attr("height",l[1]-l[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+l[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",l[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",l[1]-l[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function u(){function u(){32==Xo.event.keyCode&&(C||(x=null,L[0]-=l[1],L[1]-=f[1],C=2),d())}function p(){32==Xo.event.keyCode&&2==C&&(L[0]+=l[1],L[1]+=f[1],C=0,d())}function v(){var n=Xo.mouse(_),u=!1;M&&(n[0]+=M[0],n[1]+=M[1]),C||(Xo.event.altKey?(x||(x=[(l[0]+l[1])/2,(f[0]+f[1])/2]),L[0]=l[+(n[0]<x[0])],L[1]=f[+(n[1]<x[1])]):x=null),E&&m(n,c,0)&&(e(S),u=!0),A&&m(n,s,1)&&(r(S),u=!0),u&&(t(S),w({type:"brush",mode:C?"move":"resize"}))}function m(n,t,e){var r,u,a=Ri(t),c=a[0],s=a[1],p=L[e],v=e?f:l,d=v[1]-v[0];return C&&(c-=p,s-=d+p),r=(e?g:h)?Math.max(c,Math.min(s,n[e])):n[e],C?u=(r+=p)+d:(x&&(p=Math.max(c,Math.min(s,2*x[e]-r))),r>p?(u=r,r=p):u=p),v[0]!=r||v[1]!=u?(e?o=null:i=null,v[0]=r,v[1]=u,!0):void 0}function y(){v(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),Xo.select("body").style("cursor",null),z.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),N(),w({type:"brushend"})}var x,M,_=this,b=Xo.select(Xo.event.target),w=a.of(_,arguments),S=Xo.select(_),k=b.datum(),E=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&s,C=b.classed("extent"),N=O(),L=Xo.mouse(_),z=Xo.select(Go).on("keydown.brush",u).on("keyup.brush",p);if(Xo.event.changedTouches?z.on("touchmove.brush",v).on("touchend.brush",y):z.on("mousemove.brush",v).on("mouseup.brush",y),S.interrupt().selectAll("*").interrupt(),C)L[0]=l[0]-L[0],L[1]=f[0]-L[1];else if(k){var q=+/w$/.test(k),T=+/^n/.test(k);M=[l[1-q]-L[0],f[1-T]-L[1]],L[0]=l[q],L[1]=f[T]}else Xo.event.altKey&&(x=L.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),Xo.select("body").style("cursor",b.style("cursor")),w({type:"brushstart"}),v()}var i,o,a=y(n,"brushstart","brush","brushend"),c=null,s=null,l=[0,0],f=[0,0],h=!0,g=!0,p=Rs[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:l,y:f,i:i,j:o},e=this.__chart__||t;this.__chart__=t,ks?Xo.select(this).transition().each("start.brush",function(){i=e.i,o=e.j,l=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=hu(l,t.x),r=hu(f,t.y);return i=o=null,function(u){l=t.x=e(u),f=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,p=Rs[!c<<1|!s],n):c},n.y=function(t){return arguments.length?(s=t,p=Rs[!c<<1|!s],n):s},n.clamp=function(t){return arguments.length?(c&&s?(h=!!t[0],g=!!t[1]):c?h=!!t:s&&(g=!!t),n):c&&s?[h,g]:c?h:s?g:null},n.extent=function(t){var e,r,u,a,h;return arguments.length?(c&&(e=t[0],r=t[1],s&&(e=e[0],r=r[0]),i=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),(e!=l[0]||r!=l[1])&&(l=[e,r])),s&&(u=t[0],a=t[1],c&&(u=u[1],a=a[1]),o=[u,a],s.invert&&(u=s(u),a=s(a)),u>a&&(h=u,u=a,a=h),(u!=f[0]||a!=f[1])&&(f=[u,a])),n):(c&&(i?(e=i[0],r=i[1]):(e=l[0],r=l[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),s&&(o?(u=o[0],a=o[1]):(u=f[0],a=f[1],s.invert&&(u=s.invert(u),a=s.invert(a)),u>a&&(h=u,u=a,a=h))),c&&s?[[e,u],[r,a]]:c?[e,r]:s&&[u,a])},n.clear=function(){return n.empty()||(l=[0,0],f=[0,0],i=o=null),n},n.empty=function(){return!!c&&l[0]==l[1]||!!s&&f[0]==f[1]},Xo.rebind(n,a,"on")};var Ts={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Rs=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ds=tc.format=ac.timeFormat,Ps=Ds.utc,Us=Ps("%Y-%m-%dT%H:%M:%S.%LZ");Ds.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Oo:Us,Oo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Oo.toString=Us.toString,tc.second=Rt(function(n){return new ec(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),tc.seconds=tc.second.range,tc.seconds.utc=tc.second.utc.range,tc.minute=Rt(function(n){return new ec(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),tc.minutes=tc.minute.range,tc.minutes.utc=tc.minute.utc.range,tc.hour=Rt(function(n){var t=n.getTimezoneOffset()/60;return new ec(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),tc.hours=tc.hour.range,tc.hours.utc=tc.hour.utc.range,tc.month=Rt(function(n){return n=tc.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),tc.months=tc.month.range,tc.months.utc=tc.month.utc.range;var js=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Hs=[[tc.second,1],[tc.second,5],[tc.second,15],[tc.second,30],[tc.minute,1],[tc.minute,5],[tc.minute,15],[tc.minute,30],[tc.hour,1],[tc.hour,3],[tc.hour,6],[tc.hour,12],[tc.day,1],[tc.day,2],[tc.week,1],[tc.month,1],[tc.month,3],[tc.year,1]],Fs=Ds.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",be]]),Os={range:function(n,t,e){return Xo.range(+n,+t,e).map(Io)},floor:bt,ceil:bt};Hs.year=tc.year,tc.scale=function(){return Yo(Xo.scale.linear(),Hs,Fs)};var Ys=Hs.map(function(n){return[n[0].utc,n[1]]}),Is=Ps.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",be]]);Ys.year=tc.year.utc,tc.scale.utc=function(){return Yo(Xo.scale.linear(),Ys,Is)},Xo.text=wt(function(n){return n.responseText}),Xo.json=function(n,t){return St(n,"application/json",Zo,t)},Xo.html=function(n,t){return St(n,"text/html",Vo,t)},Xo.xml=wt(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(Xo):"object"==typeof module&&module.exports?module.exports=Xo:this.d3=Xo}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head><meta charset="utf-8"> | |
<meta name="viewport" content="width=1040"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> | |
<meta name="keywords" content="d3,d3.js,visualization,dom,javascript"> | |
<meta itemprop="description" name="description" content="D3 is a JavaScript library for visualizing data with HTML, SVG and CSS."> | |
<link rel="image_src" href="http://d3js.org/preview.png"> | |
<meta property="og:type" content="article"> | |
<meta property="og:title" content="D3.js - Data-Driven Documents"> | |
<meta property="og:description" content="D3 is a JavaScript library for visualizing data with HTML, SVG and CSS."> | |
<meta property="og:url" content="http://d3js.org/"> | |
<meta property="og:image" content="http://d3js.org/preview.png"> | |
<meta name="twitter:card" value="summary_large_image"> | |
<meta name="twitter:site" value="@mbostock"> | |
<meta name="twitter:creator" content="@mbostock"> | |
<meta name="twitter:title" content="D3.js - Data-Driven Documents"> | |
<meta name="twitter:description" content="D3 is a JavaScript library for visualizing data with HTML, SVG and CSS."> | |
<meta name="twitter:url" content="http://d3js.org/"> | |
<meta name="twitter:image" content="http://d3js.org/preview.png"> | |
<meta name="twitter:image:width" content="560"> | |
<meta name="twitter:image:height" content="295"> | |
<meta name="author" content="Mike Bostock"> | |
<link rel="canonical" href="http://d3js.org/"> | |
<title>D3.js - Data-Driven Documents</title> | |
<style> | |
#examples { | |
background: #ddd; | |
height: 2000px; | |
margin-bottom: 2em; | |
overflow: hidden; | |
padding: 0; | |
position: relative; | |
border-top: solid 1px #fff; | |
border-bottom: solid 1px #fff; | |
} | |
#examples:after, | |
#examples:before { | |
content: ""; | |
display: block; | |
width: 100%; | |
position: absolute; | |
background: red; | |
height: 16px; | |
z-index: 2; | |
} | |
#examples:before { | |
bottom: -16px; | |
box-shadow: 0px -8px 16px rgba(0,0,0,.3); | |
} | |
#examples:after { | |
top: -16px; | |
box-shadow: 0px 8px 16px rgba(0,0,0,.3); | |
} | |
#examples-deep { | |
-webkit-transform-style: preserve-3d; | |
-moz-transform-style: preserve-3d; | |
transform-style: preserve-3d; | |
-webkit-backface-visibility: hidden; | |
-moz-backface-visibility: hidden; | |
backface-visibility: hidden; | |
} | |
#examples svg, | |
#examples canvas { | |
position: absolute; | |
} | |
.example-mesh { | |
fill: none; | |
stroke: #fff; | |
stroke-width: 2px; | |
} | |
.example-anchor path { | |
fill: none; | |
pointer-events: all; | |
} | |
.example-anchor path:hover { | |
stroke: #000; | |
stroke-width: 2px; | |
} | |
</style> | |
<div id="examples"> | |
<div id="examples-deep" ></div> | |
</div> | |
<script src="d3.v3.min.js"></script> | |
<script src="d3.hexbin.min.js"></script> | |
<script> | |
/* https://github.com/davidbau/seedrandom Copyright 2013 David Bau. */ | |
(function(a,b,c,d,e,f){function k(a){var b,c=a.length,e=this,f=0,g=e.i=e.j=0,h=e.S=[];for(c||(a=[c++]);d>f;)h[f]=f++;for(f=0;d>f;f++)h[f]=h[g=j&g+a[f%c]+(b=h[f])],h[g]=b;(e.g=function(a){for(var b,c=0,f=e.i,g=e.j,h=e.S;a--;)b=h[f=j&f+1],c=c*d+h[j&(h[f]=h[g=j&g+b])+(h[g]=b)];return e.i=f,e.j=g,c})(d)}function l(a,b){var e,c=[],d=(typeof a)[0];if(b&&"o"==d)for(e in a)try{c.push(l(a[e],b-1))}catch(f){}return c.length?c:"s"==d?a:a+"\0"}function m(a,b){for(var d,c=a+"",e=0;c.length>e;)b[j&e]=j&(d^=19*b[j&e])+c.charCodeAt(e++);return o(b)}function n(c){try{return a.crypto.getRandomValues(c=new Uint8Array(d)),o(c)}catch(e){return[+new Date,a,a.navigator.plugins,a.screen,o(b)]}}function o(a){return String.fromCharCode.apply(0,a)}var g=c.pow(d,e),h=c.pow(2,f),i=2*h,j=d-1;c.seedrandom=function(a,f){var j=[],p=m(l(f?[a,o(b)]:0 in arguments?a:n(),3),j),q=new k(j);return m(o(q.S),b),c.random=function(){for(var a=q.g(e),b=g,c=0;h>a;)a=(a+c)*d,b*=d,c=q.g(1);for(;a>=i;)a/=2,b/=2,c>>>=1;return(a+c)/b},p},m(c.random(),b)})(this,[],Math,256,6,52); | |
var data = [ | |
{title: "Reingold–Tilford Tree (Radial)", url: "http://bl.ocks.org/mbostock/4063550"}, | |
{title: "Factorisation Diagrams", url: "http://www.jasondavies.com/factorisation-diagrams/"}, | |
{title: "Phylogenetic Tree of Life", url: "http://www.jasondavies.com/tree-of-life/"}, | |
{title: "Geographic Clipping", url: "http://www.jasondavies.com/maps/clip/"}, | |
{title: "Les Misérables Co-occurrence Matrix", url: "http://bost.ocks.org/mike/miserables/"}, | |
{title: "L*a*b* and HCL color spaces", url: "http://bl.ocks.org/mbostock/3014589"}, | |
{title: "Treemap", url: "http://bl.ocks.org/mbostock/4063582"}, | |
{title: "Map Projection Transitions", url: "http://www.jasondavies.com/maps/transition/"}, | |
{title: "Across U.S. Companies, Tax Rates Vary Greatly", url: "http://www.nytimes.com/interactive/2013/05/25/sunday-review/corporate-taxes.html"}, | |
{title: "Rotating Voronoi", url: "http://bl.ocks.org/mbostock/4636377"}, | |
{title: "Zoomable Geography", url: "http://bl.ocks.org/mbostock/2374239"}, | |
{title: "Fisheye Distortion", url: "http://bost.ocks.org/mike/fisheye/"}, | |
{title: "Geodesic Rainbow", url: "http://bl.ocks.org/mbostock/3057239"}, | |
{title: "Hierarchical Bar Chart", url: "http://bl.ocks.org/mbostock/1283663"}, | |
{title: "Exoplanets", url: "http://bl.ocks.org/mbostock/3007180"}, | |
{title: "Crossfilter", url: "http://square.github.io/crossfilter/"}, | |
{title: "Alaska’s villages on the frontline of climate change", url: "http://www.guardian.co.uk/environment/interactive/2013/may/14/alaska-villages-frontline-global-warming"}, | |
{title: "The federal health-care exchange’s abysmal success rate", url: "http://www.washingtonpost.com/wp-srv/special/politics/state-vs-federal-exchanges/"}, | |
{title: "Counties Blue and Red, Moving Right and Left", url: "http://www.nytimes.com/interactive/2012/11/11/sunday-review/counties-moving.html"}, | |
{title: "At the National Conventions, the Words They Used", url: "http://www.nytimes.com/interactive/2012/09/06/us/politics/convention-word-counts.html"}, | |
{title: "Reprojected Raster Tiles", url: "http://www.jasondavies.com/maps/raster/"}, | |
{title: "Hive Plots", url: "http://bost.ocks.org/mike/hive/"}, | |
{title: "Donut Transitions", url: "http://bl.ocks.org/mbostock/4341417"}, | |
{title: "Non-Contiguous Cartogram", url: "http://bl.ocks.org/mbostock/4055908"}, | |
{title: "Spermatozoa", url: "http://bl.ocks.org/mbostock/1136236"}, | |
{title: "Zoomable Circle Packing", url: "http://bl.ocks.org/mbostock/7607535"}, | |
{title: "Transform Transitions", url: "http://bl.ocks.org/mbostock/1345853"}, | |
{title: "Scatterplot Matrix", url: "http://bl.ocks.org/mbostock/3213173"}, | |
{title: "Janet L. Yellen, on the Economy’s Twists and Turns", url: "http://www.nytimes.com/interactive/2013/10/09/us/yellen-fed-chart.html"}, | |
{title: "Front Row to Fashion Week", url: "http://www.nytimes.com/newsgraphics/2013/09/13/fashion-week-editors-picks/"}, | |
{title: "Interrupted Sinu-Mollweide", url: "http://bl.ocks.org/mbostock/4481520"}, | |
{title: "Streamgraph", url: "http://bl.ocks.org/mbostock/4060954"}, | |
{title: "Force-Directed Graph", url: "http://bl.ocks.org/mbostock/4062045"}, | |
{title: "Zoomable Icicle", url: "http://bl.ocks.org/mbostock/1005873"}, | |
{title: "Collision Detection", url: "http://bl.ocks.org/mbostock/3231298"}, | |
{title: "Waterman Butterfly", url: "http://bl.ocks.org/mbostock/4458497"}, | |
{title: "Airocean World", url: "http://www.jasondavies.com/maps/airocean/"}, | |
{title: "Countries by Area", url: "http://www.jasondavies.com/maps/countries-by-area/"}, | |
{title: "Bilevel Partition", url: "http://bl.ocks.org/mbostock/5944371"}, | |
{title: "Map Zooming", url: "http://bl.ocks.org/mbostock/6242308"}, | |
{title: "Fisher–Yates Shuffle", url: "http://bost.ocks.org/mike/shuffle/"}, | |
{title: "Sphere Spirals", url: "http://www.jasondavies.com/maps/sphere-spirals/"}, | |
{title: "World Tour", url: "http://bl.ocks.org/mbostock/4183330"}, | |
{title: "Zoomable Treemaps", url: "http://bost.ocks.org/mike/treemap/"}, | |
{title: "Clipped Map Tiles", url: "http://bl.ocks.org/mbostock/4150951"}, | |
{title: "Cubism.js", url: "http://square.github.io/cubism/"}, | |
{title: "Voronoi Labels", url: "http://bl.ocks.org/mbostock/6909318"}, | |
{title: "Bivariate Hexbin Map", url: "http://bl.ocks.org/mbostock/4330486"}, | |
{title: "OMG Particles!", url: "http://bl.ocks.org/mbostock/1062544"}, | |
{title: "Calendar View", url: "http://bl.ocks.org/mbostock/4063318"}, | |
{title: "The Wealth & Health of Nations", url: "http://bost.ocks.org/mike/nations/"}, | |
{title: "Collapsible Tree", url: "http://bl.ocks.org/mbostock/4339083"}, | |
{title: "Hexagonal Binning", url: "http://bl.ocks.org/mbostock/4248145"}, | |
{title: "Over the Decades, How States Have Shifted", url: "http://www.nytimes.com/interactive/2012/10/15/us/politics/swing-history.html"}, | |
{title: "China Still Dominates, but Some Manufacturers Look Elsewhere", url: "http://www.nytimes.com/interactive/2013/04/08/business/global/asia-map.html"}, | |
{title: "Strikeouts on the Rise", url: "http://www.nytimes.com/interactive/2013/03/29/sports/baseball/Strikeouts-Are-Still-Soaring.html?ref=baseball"}, | |
{title: "Epicyclic Gearing", url: "http://bl.ocks.org/mbostock/1353700"}, | |
{title: "Voronoi Tessellation", url: "http://bl.ocks.org/mbostock/4060366"}, | |
{title: "The state of our union is … dumber", url: "http://www.guardian.co.uk/world/interactive/2013/feb/12/state-of-the-union-reading-level"}, | |
{title: "Chord Diagram", url: "http://bl.ocks.org/mbostock/1046712"}, | |
{title: "Floating Landmasses", url: "http://bl.ocks.org/mbostock/6738360"}, | |
{title: "How the Tax Burden Has Changed", url: "http://www.nytimes.com/interactive/2012/11/30/us/tax-burden.html"}, | |
{title: "Prime Number Patterns", url: "http://www.jasondavies.com/primos/"}, | |
{title: "Koalas to the Max", url: "http://www.koalastothemax.com/"}, | |
{title: "Constellations of Directors and Their Stars", url: "http://www.nytimes.com/newsgraphics/2013/09/07/director-star-chart/"}, | |
{title: "Drought and Deluge in the Lower 48", url: "http://www.nytimes.com/interactive/2012/08/11/sunday-review/drought-history.html"}, | |
{title: "Animated Bézier Curves", url: "http://www.jasondavies.com/animated-bezier/"}, | |
{title: "Histogram", url: "http://bl.ocks.org/mbostock/3048450"}, | |
{title: "Stacked-to-Grouped Bars", url: "http://bl.ocks.org/mbostock/3943967"}, | |
{title: "Force-Directed States of America", url: "http://bl.ocks.org/mbostock/1073373"}, | |
{title: "Faux-3D Arcs", url: "http://bl.ocks.org/dwtkns/4973620"}, | |
{title: "512 Paths to the White House", url: "http://www.nytimes.com/interactive/2012/11/02/us/politics/paths-to-the-white-house.html"}, | |
{title: "Polar Clock", url: "http://bl.ocks.org/mbostock/1096355"}, | |
{title: "Population Pyramid", url: "http://bl.ocks.org/mbostock/4062085"}, | |
{title: "The America’s Cup Finale: Oracle’s Path to Victory", url: "http://www.nytimes.com/interactive/2013/09/25/sports/americas-cup-course.html"}, | |
{title: "Rainbow Worm", url: "http://bl.ocks.org/mbostock/4165404"}, | |
{title: "Four Ways to Slice Obama’s 2013 Budget Proposal", url: "http://www.nytimes.com/interactive/2012/02/13/us/politics/2013-budget-proposal-graphic.html"}, | |
{title: "Quadtree", url: "http://bl.ocks.org/mbostock/4343214"}, | |
{title: "Bubble Chart", url: "http://bl.ocks.org/mbostock/4063269"}, | |
{title: "Women as Academic Authors, 1665-2010", url: "http://chronicle.com/article/Woman-as-Academic-Authors/135192/"}, | |
{title: "Choropleth", url: "http://bl.ocks.org/mbostock/4060606"}, | |
{title: "Gilbert’s Two-World Perspective", url: "http://www.jasondavies.com/maps/gilbert/"}, | |
{title: "For Eli Manning, 150 Games and Counting", url: "http://www.nytimes.com/newsgraphics/2013/09/28/eli-manning-milestone/"}, | |
{title: "Word Tree", url: "http://www.jasondavies.com/wordtree/"}, | |
{title: "Mobile Patent Suits", url: "http://bl.ocks.org/mbostock/1153292"}, | |
{title: "Mitchell’s Best-Candidate", url: "http://bl.ocks.org/mbostock/1893974"}, | |
{title: "Sankey Diagrams", url: "http://bost.ocks.org/mike/sankey/"}, | |
{title: "van Wijk Smooth Zooming", url: "http://bl.ocks.org/mbostock/3828981"}, | |
{title: "Bryce Harper: A swing of beauty", url: "http://www.washingtonpost.com/wp-srv/special/sports/bryce-harper-swing-of-beauty/"}, | |
{title: "Dissecting a Trailer: The Parts of the Film That Make the Cut", url: "http://www.nytimes.com/interactive/2013/02/19/movies/awardsseason/oscar-trailers.html"}, | |
{title: "Violence and guns in best-selling video games", url: "http://www.guardian.co.uk/world/interactive/2013/apr/30/violence-guns-best-selling-video-games"}, | |
{title: "Hierarchical Edge Bundling", url: "http://bl.ocks.org/mbostock/1044242"}, | |
{title: "Geographic Bounding Boxes", url: "http://www.jasondavies.com/maps/bounds/"}, | |
{title: "Live Results: Massachusetts Senate Special Election", url: "http://elections.huffingtonpost.com/2013/massachusetts-senate-results"}, | |
{title: "Zoomable Map Tiles", url: "http://bl.ocks.org/mbostock/4132797"}, | |
{title: "D3 Show Reel", url: "http://bl.ocks.org/mbostock/1256572"}, | |
{title: "Building Hamiltonian Graphs from LCF Notation", url: "http://christophermanning.org/projects/building-cubic-hamiltonian-graphs-from-lcf-notation/"}, | |
{title: "Sequences sunburst", url: "http://bl.ocks.org/kerryrodden/7090426"}, | |
{title: "Azimuth and Distance from London", url: "http://www.jasondavies.com/maps/azimuth-distance/"}, | |
{title: "Parallel Sets", url: "http://www.jasondavies.com/parallel-sets/"} | |
]; | |
data.forEach(function(d, i) { | |
d.i = i % 10; | |
d.j = i / 10 | 0; | |
}); | |
Math.seedrandom(+d3.time.hour(new Date)); | |
d3.shuffle(data); | |
var height = 2000, | |
imageWidth = 132, | |
imageHeight = 152, | |
radius = 75, | |
depth = 4; | |
var currentFocus = [innerWidth / 2, height / 2], | |
desiredFocus, | |
idle = true; | |
var style = document.body.style, | |
transform = ("webkitTransform" in style ? "-webkit-" | |
: "MozTransform" in style ? "-moz-" | |
: "msTransform" in style ? "-ms-" | |
: "OTransform" in style ? "-o-" | |
: "") + "transform"; | |
var hexbin = d3.hexbin() | |
.radius(radius); | |
if (!("ontouchstart" in document)) d3.select("#examples") | |
.on("mousemove", mousemoved); | |
var deep = d3.select("#examples-deep"); | |
var canvas = deep.append("canvas") | |
.attr("height", height); | |
var context = canvas.node().getContext("2d"); | |
var svg = deep.append("svg") | |
.attr("height", height); | |
var mesh = svg.append("path") | |
.attr("class", "example-mesh"); | |
var anchor = svg.append("g") | |
.attr("class", "example-anchor") | |
.selectAll("a"); | |
var graphic = deep.selectAll("svg,canvas"); | |
var image = new Image; | |
image.src = "http://d3js.org/ex.jpg?3f2d00ffdba6ced9c50f02ed42f12f6156368bd2"; | |
image.onload = resized; | |
d3.select(window) | |
.on("resize", resized) | |
.each(resized); | |
function drawImage(d) { | |
context.save(); | |
context.beginPath(); | |
context.moveTo(0, -radius); | |
for (var i = 1; i < 6; ++i) { | |
var angle = i * Math.PI / 3, | |
x = Math.sin(angle) * radius, | |
y = -Math.cos(angle) * radius; | |
context.lineTo(x, y); | |
} | |
context.clip(); | |
context.drawImage(image, | |
imageWidth * d.i, imageHeight * d.j, | |
imageWidth, imageHeight, | |
-imageWidth / 2, -imageHeight / 2, | |
imageWidth, imageHeight); | |
context.restore(); | |
} | |
function resized() { | |
var deepWidth = innerWidth * (depth + 1) / depth, | |
deepHeight = height * (depth + 1) / depth, | |
centers = hexbin.size([deepWidth, deepHeight]).centers(); | |
desiredFocus = [innerWidth / 2, height / 2]; | |
moved(); | |
graphic | |
.style("left", Math.round((innerWidth - deepWidth) / 2) + "px") | |
.style("top", Math.round((height - deepHeight) / 2) + "px") | |
.attr("width", deepWidth) | |
.attr("height", deepHeight); | |
centers.forEach(function(center, i) { | |
center.j = Math.round(center[1] / (radius * 1.5)); | |
center.i = Math.round((center[0] - (center.j & 1) * radius * Math.sin(Math.PI / 3)) / (radius * 2 * Math.sin(Math.PI / 3))); | |
context.save(); | |
context.translate(Math.round(center[0]), Math.round(center[1])); | |
drawImage(center.example = data[(center.i % 10) + ((center.j + (center.i / 10 & 1) * 5) % 10) * 10]); | |
context.restore(); | |
}); | |
mesh.attr("d", hexbin.mesh); | |
anchor = anchor.data(centers, function(d) { return d.i + "," + d.j; }); | |
anchor.exit().remove(); | |
anchor.enter().append("a") | |
.attr("xlink:href", function(d) { return d.example.url; }) | |
.attr("xlink:title", function(d) { return d.example.title; }) | |
.append("path") | |
.attr("d", hexbin.hexagon()); | |
anchor | |
.attr("transform", function(d) { return "translate(" + d + ")"; }); | |
} | |
function mousemoved() { | |
var m = d3.mouse(this); | |
desiredFocus = [ | |
Math.round((m[0] - innerWidth / 2) / depth) * depth + innerWidth / 2, | |
Math.round((m[1] - height / 2) / depth) * depth + height / 2 | |
]; | |
moved(); | |
} | |
function moved() { | |
if (idle) d3.timer(function() { | |
if (idle = Math.abs(desiredFocus[0] - currentFocus[0]) < .5 && Math.abs(desiredFocus[1] - currentFocus[1]) < .5) currentFocus = desiredFocus; | |
else currentFocus[0] += (desiredFocus[0] - currentFocus[0]) * .14, currentFocus[1] += (desiredFocus[1] - currentFocus[1]) * .14; | |
deep.style(transform, "translate(" + (innerWidth / 2 - currentFocus[0]) / depth + "px," + (height / 2 - currentFocus[1]) / depth + "px)"); | |
return idle; | |
}); | |
} | |
</script> | |
<script> | |
d3.select("#download").attr("href", "https://github.com/mbostock/d3/releases/download/v" + d3.version + "/d3.v3.zip"); | |
d3.select("#version").text(" (" + d3.version + ")"); | |
</script> | |
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div.dc-chart { | |
float: left; | |
} | |
.dc-chart rect.bar { | |
stroke: none; | |
cursor: pointer; | |
} | |
.dc-chart rect.bar:hover { | |
fill-opacity: .5; | |
} | |
.dc-chart rect.stack1 { | |
stroke: none; | |
fill: red; | |
} | |
.dc-chart rect.stack2 { | |
stroke: none; | |
fill: green; | |
} | |
.dc-chart rect.deselected { | |
stroke: none; | |
fill: #ccc; | |
} | |
.dc-chart .pie-slice { | |
fill: white; | |
font-size: 12px; | |
cursor: pointer; | |
} | |
.dc-chart .pie-slice :hover { | |
fill-opacity: .8; | |
} | |
.dc-chart .selected path { | |
stroke-width: 3; | |
stroke: #ccc; | |
fill-opacity: 1; | |
} | |
.dc-chart .deselected path { | |
stroke: none; | |
fill-opacity: .5; | |
fill: #ccc; | |
} | |
.dc-chart .axis path, .axis line { | |
fill: none; | |
stroke: #000; | |
shape-rendering: crispEdges; | |
} | |
.dc-chart .axis text { | |
font: 10px sans-serif; | |
} | |
.dc-chart .grid-line { | |
fill: none; | |
stroke: #ccc; | |
opacity: .5; | |
shape-rendering: crispEdges; | |
} | |
.dc-chart .grid-line line { | |
fill: none; | |
stroke: #ccc; | |
opacity: .5; | |
shape-rendering: crispEdges; | |
} | |
.dc-chart .brush rect.background { | |
z-index: -999; | |
} | |
.dc-chart .brush rect.extent { | |
fill: steelblue; | |
fill-opacity: .125; | |
} | |
.dc-chart .brush .resize path { | |
fill: #eee; | |
stroke: #666; | |
} | |
.dc-chart path.line { | |
fill: none; | |
stroke-width: 1.5px; | |
} | |
.dc-chart circle.dot { | |
stroke: none; | |
} | |
.dc-chart g.dc-tooltip path { | |
fill: none; | |
stroke: grey; | |
stroke-opacity: .8; | |
} | |
.dc-chart path.area { | |
fill-opacity: .3; | |
stroke: none; | |
} | |
.dc-chart .node { | |
font-size: 0.7em; | |
cursor: pointer; | |
} | |
.dc-chart .node :hover { | |
fill-opacity: .8; | |
} | |
.dc-chart .selected circle { | |
stroke-width: 3; | |
stroke: #ccc; | |
fill-opacity: 1; | |
} | |
.dc-chart .deselected circle { | |
stroke: none; | |
fill-opacity: .5; | |
fill: #ccc; | |
} | |
.dc-chart .bubble { | |
stroke: none; | |
fill-opacity: 0.6; | |
} | |
.dc-data-count { | |
float: right; | |
margin-top: 15px; | |
margin-right: 15px; | |
} | |
.dc-data-count .filter-count { | |
color: #3182bd; | |
font-weight: bold; | |
} | |
.dc-data-count .total-count { | |
color: #3182bd; | |
font-weight: bold; | |
} | |
.dc-data-table { | |
} | |
.dc-chart g.state { | |
cursor: pointer; | |
} | |
.dc-chart g.state :hover { | |
fill-opacity: .8; | |
} | |
.dc-chart g.state path { | |
stroke: white; | |
} | |
.dc-chart g.selected path { | |
} | |
.dc-chart g.deselected path { | |
fill: grey; | |
} | |
.dc-chart g.selected text { | |
} | |
.dc-chart g.deselected text { | |
display: none; | |
} | |
.dc-chart g.county path { | |
stroke: white; | |
fill: none; | |
} | |
.dc-chart g.debug rect { | |
fill: blue; | |
fill-opacity: .2; | |
} | |
.dc-chart g.row rect { | |
fill-opacity: 0.8; | |
cursor: pointer; | |
} | |
.dc-chart g.row rect:hover { | |
fill-opacity: 0.6; | |
} | |
.dc-chart g.row text { | |
fill: white; | |
font-size: 12px; | |
cursor: pointer; | |
} | |
.dc-legend { | |
font-size: 11px; | |
} | |
.dc-legend-item { | |
cursor: pointer; | |
} | |
.dc-chart g.axis text { | |
/* Makes it so the user can't accidentally click and select text that is meant as a label only */ | |
-webkit-user-select: none; /* Chrome/Safari */ | |
-moz-user-select: none; /* Firefox */ | |
-ms-user-select: none; /* IE10 */ | |
-o-user-select: none; | |
user-select: none; | |
pointer-events: none; | |
} | |
.dc-chart path.highlight { | |
stroke-width: 3; | |
fill-opacity: 1; | |
stroke-opacity: 1; | |
} | |
.dc-chart .highlight { | |
fill-opacity: 1; | |
stroke-opacity: 1; | |
} | |
.dc-chart .fadeout { | |
fill-opacity: 0.2; | |
stroke-opacity: 0.2; | |
} | |
.dc-chart path.dc-mbolmbol { | |
fill-opacity: 0.5; | |
stroke-opacity: 0.5; | |
} | |
.dc-hard .number-display { | |
float: none; | |
} | |
.dc-chart .box { | |
font: 10px sans-serif; | |
} | |
.dc-chart .box line, | |
.dc-chart .box rect, | |
.dc-chart .box circle { | |
fill: #fff; | |
stroke: #000; | |
stroke-width: 1.5px; | |
} | |
.dc-chart .box .center { | |
stroke-dasharray: 3,3; | |
} | |
.dc-chart .box .outlier { | |
fill: none; | |
stroke: #ccc; | |
} | |
.dc-chart .symbol{ | |
stroke: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dc=function(){"use strict";var a={version:"1.7.0-dev",constants:{CHART_CLASS:"dc-chart",DEBUG_GROUP_CLASS:"debug",STACK_CLASS:"stack",DESELECTED_CLASS:"deselected",SELECTED_CLASS:"selected",NODE_INDEX_NAME:"__index__",GROUP_INDEX_NAME:"__group_index__",DEFAULT_CHART_GROUP:"__default_chart_group__",EVENT_DELAY:40,NEGLIGIBLE_NUMBER:1e-10},_renderlet:null};a.chartRegistry=function(){function b(b){return b||(b=a.constants.DEFAULT_CHART_GROUP),c[b]||(c[b]=[]),b}var c={};return{has:function(a){for(var b in c)if(c[b].indexOf(a)>=0)return!0;return!1},register:function(a,d){d=b(d),c[d].push(a)},clear:function(a){a?delete c[a]:c={}},list:function(a){return a=b(a),c[a]}}}(),a.registerChart=function(b,c){a.chartRegistry.register(b,c)},a.hasChart=function(b){return a.chartRegistry.has(b)},a.deregisterAllCharts=function(b){a.chartRegistry.clear(b)},a.filterAll=function(b){for(var c=a.chartRegistry.list(b),d=0;d<c.length;++d)c[d].filterAll()},a.renderAll=function(b){for(var c=a.chartRegistry.list(b),d=0;d<c.length;++d)c[d].render();null!==a._renderlet&&a._renderlet(b)},a.redrawAll=function(b){for(var c=a.chartRegistry.list(b),d=0;d<c.length;++d)c[d].redraw();null!==a._renderlet&&a._renderlet(b)},a.transition=function(a,b,c){if(0>=b||void 0===b)return a;var d=a.transition().duration(b);return"function"==typeof c&&c(d),d},a.units={},a.units.integers=function(a,b){return Math.abs(b-a)},a.units.ordinal=function(a,b,c){return c},a.units.fp={},a.units.fp.precision=function(b){var c=function(b,d){var e=Math.abs((d-b)/c.resolution);return a.utils.isNegligible(e-Math.floor(e))?Math.floor(e):Math.ceil(e)};return c.resolution=b,c},a.round={},a.round.floor=function(a){return Math.floor(a)},a.round.ceil=function(a){return Math.ceil(a)},a.round.round=function(a){return Math.round(a)},a.override=function(a,b,c){var d=a[b];a["_"+b]=d,a[b]=c},a.renderlet=function(b){return arguments.length?(a._renderlet=b,a):a._renderlet},a.instanceOfChart=function(a){return a instanceof Object&&a.__dc_flag__&&!0},a.errors={},a.errors.Exception=function(a){var b=a||"Unexpected internal error";this.message=b,this.toString=function(){return b}},a.errors.InvalidStateException=function(){a.errors.Exception.apply(this,arguments)},a.dateFormat=d3.time.format("%m/%d/%Y"),a.printers={},a.printers.filters=function(b){for(var c="",d=0;d<b.length;++d)d>0&&(c+=", "),c+=a.printers.filter(b[d]);return c},a.printers.filter=function(b){var c="";return b&&(b instanceof Array?b.length>=2?c="["+a.utils.printSingleValue(b[0])+" -> "+a.utils.printSingleValue(b[1])+"]":b.length>=1&&(c=a.utils.printSingleValue(b[0])):c=a.utils.printSingleValue(b)),c},a.pluck=function(a,b){return function(c,d){return b?b.call(this,c[a],d):c[a]}},a.utils={},a.utils.printSingleValue=function(b){var c=""+b;return b instanceof Date?c=a.dateFormat(b):"string"==typeof b?c=b:a.utils.isFloat(b)?c=a.utils.printSingleValue.fformat(b):a.utils.isInteger(b)&&(c=Math.round(b)),c},a.utils.printSingleValue.fformat=d3.format(".2f"),a.utils.add=function(a,b){if("string"==typeof b&&(b=b.replace("%","")),a instanceof Date){"string"==typeof b&&(b=+b);var c=new Date;return c.setTime(a.getTime()),c.setDate(a.getDate()+b),c}if("string"==typeof b){var d=+b/100;return a>0?a*(1+d):a*(1-d)}return a+b},a.utils.subtract=function(a,b){if("string"==typeof b&&(b=b.replace("%","")),a instanceof Date){"string"==typeof b&&(b=+b);var c=new Date;return c.setTime(a.getTime()),c.setDate(a.getDate()-b),c}if("string"==typeof b){var d=+b/100;return 0>a?a*(1+d):a*(1-d)}return a-b},a.utils.GroupStack=function(){function a(a){d[a]||(d[a]=[])}var b,c,d=[[]],e=[];this.setDataPoint=function(b,c,e){a(b),d[b][c]=e},this.getDataPoint=function(b,c){a(b);var e=d[b][c];return void 0===e&&(e=0),e},this.addGroup=function(a,c){return c||(c=b),e.push([a,c]),e.length-1},this.addNamedGroup=function(a,b,c){var d=this.addGroup(a,c);return e[d].name=b,b},this.getGroupByIndex=function(a){return e[a][0]},this.getAccessorByIndex=function(a){return e[a][1]},this.size=function(){return e.length},this.clear=function(){d=[],e=[]},this.setDefaultAccessor=function(a){b=a},this.getDataLayers=function(){return d},this.clearDataLayers=function(){d=[[]]},this.showGroups=function(a,b){b&&(c=!1),this.toggleGroups(a,!1)},this.hideGroups=function(a,b){b&&(c=!0),this.toggleGroups(a,!0)},this.toggleGroups=function(a,b){for(var c=0;c<e.length;++c)e[c].name===a&&(e[c].hidden=b)},this.toLayers=function(){for(var a=[],b=0;b<d.length;++b)if(!(0===b&&c||b>0&&e[b-1].hidden)){for(var f={index:b,points:[]},g=d[b],h=0;h<g.length;++h)f.points.push(g[h]);a.push(f)}return a}},a.utils.isNumber=function(a){return a===+a},a.utils.isFloat=function(a){return a===+a&&a!==(0|a)},a.utils.isInteger=function(a){return a===+a&&a===(0|a)},a.utils.isNegligible=function(b){return void 0===b||b<a.constants.NEGLIGIBLE_NUMBER&&b>-a.constants.NEGLIGIBLE_NUMBER};var b=0;return a.utils.uniqueId=function(){return++b},a.utils.groupMax=function(b,c){var d=d3.max(b.all(),c);return a.utils.isNegligible(d)&&(d=0),d},a.utils.groupMin=function(b,c){var d=d3.min(b.all(),c);return a.utils.isNegligible(d)&&(d=0),d},a.utils.nameToId=function(a){return a.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")},a.utils.appendOrSelect=function(a,b){var c=a.select(b);return c.empty()&&(c=a.append(b)),c},a.utils.createLegendable=function(a,b,c,d){var e={name:a._getGroupName(b,c),data:b};return d&&(e.color=d),e},a.utils.safeNumber=function(b){return a.utils.isNumber(+b)?+b:0},a.events={current:null},a.events.trigger=function(b,c){return c?(a.events.current=b,setTimeout(function(){b==a.events.current&&b()},c),void 0):(b(),void 0)},a.cumulative={},a.cumulative.Base=function(){this._keyIndex=[],this._map={},this.sanitizeKey=function(a){return a+=""},this.clear=function(){this._keyIndex=[],this._map={}},this.size=function(){return this._keyIndex.length},this.getValueByKey=function(a){a=this.sanitizeKey(a);var b=this._map[a];return b},this.setValueByKey=function(a,b){return a=this.sanitizeKey(a),this._map[a]=b,b},this.indexOfKey=function(a){return a=this.sanitizeKey(a),this._keyIndex.indexOf(a)},this.addToIndex=function(a){a=this.sanitizeKey(a),this._keyIndex.push(a)},this.getKeyByIndex=function(a){return this._keyIndex[a]}},a.cumulative.Sum=function(){a.cumulative.Base.apply(this,arguments),this.add=function(a,b){b||(b=0),void 0===this.getValueByKey(a)?(this.addToIndex(a),this.setValueByKey(a,b)):this.setValueByKey(a,this.getValueByKey(a)+b)},this.minus=function(a,b){this.setValueByKey(a,this.getValueByKey(a)-b)},this.cumulativeSum=function(a){var b=this.indexOfKey(a);if(0>b)return 0;for(var c=0,d=0;b>=d;++d){var e=this.getKeyByIndex(d);c+=this.getValueByKey(e)}return c}},a.cumulative.Sum.prototype=new a.cumulative.Base,a.cumulative.CountUnique=function(){function b(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c}a.cumulative.Base.apply(this,arguments),this.add=function(a,b){void 0===this.getValueByKey(a)&&(this.setValueByKey(a,{}),this.addToIndex(a)),void 0!==b&&(void 0===this.getValueByKey(a)[b]&&(this.getValueByKey(a)[b]=0),this.getValueByKey(a)[b]+=1)},this.minus=function(a,b){this.getValueByKey(a)[b]-=1,this.getValueByKey(a)[b]<=0&&delete this.getValueByKey(a)[b]},this.count=function(a){return b(this.getValueByKey(a))},this.cumulativeCount=function(a){var b=this.indexOfKey(a);if(0>b)return 0;for(var c=0,d=0;b>=d;++d){var e=this.getKeyByIndex(d);c+=this.count(e)}return c}},a.cumulative.CountUnique.prototype=new a.cumulative.Base,a.baseChart=function(b){function c(a,b,c){var d=a.anchor(),e="__names__";c&&c!=a.valueAccessor()||(c="default"),b[e]||(b[e]={}),b[e][d]||(b[e][d]={a:[],n:[]});var f=b[e][d].a.indexOf(c);return-1==f&&(f=b[e][d].a.length,b[e][d].a[f]=c,b[e][d].n[f]={name:""}),b[e][d].n[f]}function d(){return o=b.root().append("svg").attr("width",b.width()).attr("height",b.height())}function e(c){if(!b[c]||!b[c]())throw new a.errors.InvalidStateException("Mandatory attribute chart."+c+" is missing on chart[#"+b.anchorName()+"]")}function f(a){I.splice(I.indexOf(a),1),i(),b._invokeFilteredListener(a)}function g(a){I.push(a),i(),b._invokeFilteredListener(a)}function h(){I=[],i(),b._invokeFilteredListener(null)}function i(){if(b.dimension()&&b.dimension().filter){var a=J(b.dimension(),I);I=a?a:I}}function j(){for(var a=0;a<D.length;++a)D[a](b)}b.__dc_flag__=a.utils.uniqueId();var k,l,m,n,o,p,q=function(a){return a&&a.getBoundingClientRect&&a.getBoundingClientRect().width||200},r=q,s=function(a){return a&&a.getBoundingClientRect&&a.getBoundingClientRect().height||200},t=s,u=a.pluck("key"),v=a.pluck("value"),w=a.pluck("key"),x=a.pluck("key"),y=!1,z=function(a){return b.keyAccessor()(a)+": "+b.valueAccessor()(a)},A=!1,B=750,C=a.printers.filters,D=[],E=["dimension","group"],F=a.constants.DEFAULT_CHART_GROUP,G=function(){},H={preRender:G,postRender:G,preRedraw:G,postRedraw:G,filtered:G,zoomed:G},I=[],J=function(a,b){return a.filter(null),0===b.length?a.filter(null):1===b.length?a.filter(b[0]):a.filterFunction(function(a){return b.indexOf(a)>=0}),b},K=function(a){return a.all()};return b.width=function(a){return arguments.length?(r=d3.functor(a||q),b):r(n.node())},b.height=function(a){return arguments.length?(t=d3.functor(a||s),b):t(n.node())},b.dimension=function(a){return arguments.length?(k=a,b.expireCache(),b):k},b.data=function(a){return arguments.length?(K=d3.functor(a),b.expireCache(),b):K.call(b,l)},b.group=function(a,c){return arguments.length?(l=a,b.expireCache(),"string"==typeof c&&b._setGroupName(l,c),b):l},b._getGroupName=function(a,d){return c(b,a,d).name},b._setGroupName=function(a,d,e){c(b,a,e).name=d},b.ordering=function(a){return arguments.length?(w=a,b.expireCache(),b):w},b.computeOrderedGroups=function(a){var c=a.slice(0);if(c.length<2)return c;var d=crossfilter.quicksort.by(b.ordering());return d(c,0,c.length)},b.filterAll=function(){return b.filter(null)},b.dataSet=function(){return void 0!==k&&void 0!==l},b.select=function(a){return n.select(a)},b.selectAll=function(a){return n?n.selectAll(a):null},b.anchor=function(c,d){return arguments.length?(a.instanceOfChart(c)?(m=c.anchor(),n=c.root()):(m=c,n=d3.select(m),n.classed(a.constants.CHART_CLASS,!0),a.registerChart(b,d)),F=d,b):m},b.anchorName=function(){var a=b.anchor();return a&&a.id?a.id:a&&a.replace?a.replace("#",""):""+b.chartID()},b.root=function(a){return arguments.length?(n=a,b):n},b.svg=function(a){return arguments.length?(o=a,b):o},b.resetSvg=function(){return b.select("svg").remove(),d()},b.filterPrinter=function(a){return arguments.length?(C=a,b):C},b.turnOnControls=function(){return n&&(b.selectAll(".reset").style("display",null),b.selectAll(".filter").text(C(b.filters())).style("display",null)),b},b.turnOffControls=function(){return n&&(b.selectAll(".reset").style("display","none"),b.selectAll(".filter").style("display","none").text(b.filter())),b},b.transitionDuration=function(a){return arguments.length?(B=a,b):B},b._mandatoryAttributes=function(a){return arguments.length?(E=a,b):E},b.render=function(){H.preRender(b),E&&E.forEach(e);var a=b.doRender();return p&&p.render(),b.activateRenderlets("postRender"),a},b.activateRenderlets=function(a){b.transitionDuration()>0&&o?o.transition().duration(b.transitionDuration()).each("end",function(){j(),a&&H[a](b)}):(j(),a&&H[a](b))},b.redraw=function(){H.preRedraw(b);var a=b.doRedraw();return b.activateRenderlets("postRedraw"),a},b._invokeFilteredListener=function(a){void 0!==a&&H.filtered(b,a)},b._invokeZoomedListener=function(){H.zoomed(b)},b.hasFilter=function(a){return arguments.length?I.indexOf(a)>=0:I.length>0},b.filter=function(a){return arguments.length?(a instanceof Array&&a[0]instanceof Array?(a[0].forEach(function(a){b.hasFilter(a)?I.splice(I.indexOf(a),1):I.push(a)}),i(),b._invokeFilteredListener(a)):null===a?h():b.hasFilter(a)?f(a):g(a),null!==n&&b.hasFilter()?b.turnOnControls():b.turnOffControls(),b):I.length>0?I[0]:null},b.filters=function(){return I},b.highlightSelected=function(b){d3.select(b).classed(a.constants.SELECTED_CLASS,!0),d3.select(b).classed(a.constants.DESELECTED_CLASS,!1)},b.fadeDeselected=function(b){d3.select(b).classed(a.constants.SELECTED_CLASS,!1),d3.select(b).classed(a.constants.DESELECTED_CLASS,!0)},b.resetHighlight=function(b){d3.select(b).classed(a.constants.SELECTED_CLASS,!1),d3.select(b).classed(a.constants.DESELECTED_CLASS,!1)},b.onClick=function(c){var d=b.keyAccessor()(c);a.events.trigger(function(){b.filter(d),a.redrawAll(b.chartGroup())})},b.filterHandler=function(a){return arguments.length?(J=a,b):J},b.doRender=function(){return b},b.doRedraw=function(){return b},b.legendables=function(){return[]},b.legendHighlight=function(){},b.legendReset=function(){},b.keyAccessor=function(a){return arguments.length?(u=a,b):u},b.valueAccessor=function(a){return arguments.length?(v=a,b):v},b.label=function(a){return arguments.length?(x=a,y=!0,b):x},b.renderLabel=function(a){return arguments.length?(y=a,b):y},b.title=function(a){return arguments.length?(z=a,A=!0,b):z},b.renderTitle=function(a){return arguments.length?(A=a,b):A},b.renderlet=function(a){return D.push(a),b},b.chartGroup=function(a){return arguments.length?(F=a,b):F},b.expireCache=function(){return b},b.legend=function(a){return arguments.length?(p=a,p.parent(b),b):p},b.on=function(a,c){return H[a]=c,b},b.chartID=function(){return b.__dc_flag__},b},a.marginable=function(a){var b={top:10,right:50,bottom:30,left:30};return a.margins=function(c){return arguments.length?(b=c,a):b},a.effectiveWidth=function(){return a.width()-a.margins().left-a.margins().right},a.effectiveHeight=function(){return a.height()-a.margins().top-a.margins().bottom},a},a.coordinateGridChart=function(b){function c(a){if(b.elasticX()&&!b.isOrdinal())v.domain([b.xAxisMin(),b.xAxisMax()]);else if(b.isOrdinal()&&0===v.domain().length){var c=b.computeOrderedGroups(b.data());v.domain(c.map(b.keyAccessor()))}b.isOrdinal()?b.prepareOrdinalXAxis():v.range([0,b.xAxisLength()]),E=E.scale(b.x()).orient("bottom"),d(a)}function d(c){var d=c.selectAll("g."+o);if(Q){d.empty()&&(d=c.insert("g",":first-child").attr("class",m+" "+o).attr("transform","translate("+b.yAxisX()+","+b.margins().top+")"));var e=E.tickValues()?E.tickValues():v.ticks(E.ticks()[0]),f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",function(a){return v(a)}).attr("y1",b.xAxisY()-b.margins().top).attr("x2",function(a){return v(a)}).attr("y2",0).attr("opacity",0);a.transition(g,b.transitionDuration()).attr("opacity",1),a.transition(f,b.transitionDuration()).attr("x1",function(a){return v(a)}).attr("y1",b.xAxisY()-b.margins().top).attr("x2",function(a){return v(a)}).attr("y2",0),f.exit().remove()}else d.selectAll("line").remove()}function e(a){(void 0===y||b.elasticY())&&(y=d3.scale.linear(),y.domain([b.yAxisMin(),b.yAxisMax()]).rangeRound([b.yAxisHeight(),0])),y.range([b.yAxisHeight(),0]),J=J.scale(y).orient("left"),f(a)}function f(c){var d=c.selectAll("g."+n);if(P){var e=J.tickValues()?J.tickValues():y.ticks(J.ticks()[0]);d.empty()&&(d=c.insert("g",":first-child").attr("class",m+" "+n).attr("transform","translate("+b.yAxisX()+","+b.margins().top+")"));var f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",1).attr("y1",function(a){return y(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return y(a)}).attr("opacity",0);a.transition(g,b.transitionDuration()).attr("opacity",1),a.transition(f,b.transitionDuration()).attr("x1",1).attr("y1",function(a){return y(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return y(a)}),f.exit().remove()}else d.selectAll("line").remove()}function g(){return b.xAxisY()-b.margins().top}function h(){return b.anchorName()+"-clip"}function i(){var c=a.utils.appendOrSelect(s,"defs"),d=a.utils.appendOrSelect(c,"clipPath").attr("id",h()),e=2*V;a.utils.appendOrSelect(d,"rect").attr("width",b.xAxisLength()+e).attr("height",b.yAxisHeight()+e)}function j(){U&&b.root().call(d3.behavior.zoom().x(b.x()).scaleExtent(S).on("zoom",function(){b.focus(b.x().domain()),b._invokeZoomedListener(),k()}))}function k(){if(C){var c=b.x().domain();if(T){var d=C.xOriginalDomain(),e=[c[0]<d[0]?c[0]:d[0],c[1]>d[1]?c[1]:d[1]];C.focus(e)}else C.focus(c);C.filter(null),C.filter(c),a.events.trigger(function(){a.redrawAll(b.chartGroup())})}}function l(a){return a instanceof Array&&a.length>1}var m="grid-line",n="horizontal",o="vertical",p="y-axis-label",q="x-axis-label",r=12;b=a.colorChart(a.marginable(a.baseChart(b))),b.colors(d3.scale.category10()),b._mandatoryAttributes().push("x");var s,t,u,v,w,x,y,z,A,B,C,D,E=d3.svg.axis(),F=a.units.integers,G=0,H=!1,I=0,J=d3.svg.axis(),K=0,L=!1,M=0,N=d3.svg.brush(),O=!0,P=!1,Q=!1,R=!1,S=[-10,100],T=!0,U=!1,V=0;return b.rescale=function(){B=void 0,b.xUnitCount()},b.rangeChart=function(a){return arguments.length?(C=a,C.focusChart(b),b):C},b.zoomScale=function(a){return arguments.length?(S=a,b):S},b.zoomOutRestrict=function(a){return arguments.length?(T=a,b):T},b._generateG=function(a){return s=void 0===a?b.svg():a,t=s.append("g"),u=t.append("g").attr("class","chart-body").attr("transform","translate("+b.margins().left+", "+b.margins().top+")").attr("clip-path","url(#"+h()+")"),t},b.g=function(a){return arguments.length?(t=a,b):t},b.mouseZoomable=function(a){return arguments.length?(U=a,b):U},b.chartBodyG=function(a){return arguments.length?(u=a,b):u},b.x=function(a){return arguments.length?(v=a,w=v.domain(),b):v},b.xOriginalDomain=function(){return w},b.xUnits=function(a){return arguments.length?(F=a,b):F},b.xAxis=function(a){return arguments.length?(E=a,b):E},b.elasticX=function(a){return arguments.length?(H=a,b):H},b.xAxisPadding=function(a){return arguments.length?(G=a,b):G},b.xUnitCount=function(){if(void 0===B){var a=b.xUnits()(b.x().domain()[0],b.x().domain()[1],b.x().domain());B=a instanceof Array?a.length:a}return B},b.isOrdinal=function(){return b.xUnits()===a.units.ordinal},b.prepareOrdinalXAxis=function(a){a||(a=b.xUnitCount());for(var c=[],d=b.xAxisLength()/(a+1),e=d/2,f=0;a>f;f++)c[f]=e,e+=d;v.range(c)},b.renderXAxis=function(c){var d=c.selectAll("g.x");d.empty()&&(d=c.append("g").attr("class","axis x").attr("transform","translate("+b.margins().left+","+b.xAxisY()+")"));var e=c.selectAll("text."+q);e.empty()&&b.xAxisLabel()&&(e=c.append("text").attr("transform","translate("+b.xAxisLength()/2+","+(b.height()-I)+")").attr("class",q).attr("text-anchor","middle").text(b.xAxisLabel())),b.xAxisLabel()&&e.text()!=b.xAxisLabel()&&axisYLab.text(b.xAxisLabel()),a.transition(d,b.transitionDuration()).call(E)},b.xAxisY=function(){return b.height()-b.margins().bottom},b.xAxisLength=function(){return b.effectiveWidth()},b.xAxisLabel=function(a,c){return arguments.length?(x=a,b.margins().bottom-=I,I=void 0===c?r:c,b.margins().bottom+=I,b):x},b.renderYAxis=function(c){var d=c.selectAll("g.y");d.empty()&&(d=c.append("g").attr("class","axis y").attr("transform","translate("+b.yAxisX()+","+b.margins().top+")"));var e=c.selectAll("text."+p);e.empty()&&b.yAxisLabel()&&(e=c.append("text").attr("transform","translate("+M+","+b.yAxisHeight()/2+"),rotate(-90)").attr("class",p).attr("text-anchor","middle").text(b.yAxisLabel())),b.yAxisLabel()&&e.text()!=b.yAxisLabel()&&e.text(b.yAxisLabel()),a.transition(d,b.transitionDuration()).call(J)},b.yAxisX=function(){return b.margins().left},b.yAxisLabel=function(a,c){return arguments.length?(z=a,b.margins().left-=M,M=void 0===c?r:c,b.margins().left+=M,b):z},b.y=function(a){return arguments.length?(y=a,b):y},b.yAxis=function(a){return arguments.length?(J=a,b):J},b.elasticY=function(a){return arguments.length?(L=a,b):L},b.renderHorizontalGridLines=function(a){return arguments.length?(P=a,b):P},b.renderVerticalGridLines=function(a){return arguments.length?(Q=a,b):Q},b.xAxisMin=function(){var c=d3.min(b.data(),function(a){return b.keyAccessor()(a)});return a.utils.subtract(c,G)},b.xAxisMax=function(){var c=d3.max(b.data(),function(a){return b.keyAccessor()(a)});return a.utils.add(c,G)},b.yAxisMin=function(){var c=d3.min(b.data(),function(a){return b.valueAccessor()(a)});return c=a.utils.subtract(c,K)},b.yAxisMax=function(){var c=d3.max(b.data(),function(a){return b.valueAccessor()(a)});return c=a.utils.add(c,K)},b.yAxisPadding=function(a){return arguments.length?(K=a,b):K},b.yAxisHeight=function(){return b.effectiveHeight()},b.round=function(a){return arguments.length?(A=a,b):A},a.override(b,"filter",function(a){return arguments.length?(b._filter(a),a?b.brush().extent(a):b.brush().clear(),b):b._filter()}),b.brush=function(a){return arguments.length?(N=a,b):N},b.renderBrush=function(a){if(b.isOrdinal()&&(O=!1),O){N.on("brush",b._brushing);var c=a.append("g").attr("class","brush").attr("transform","translate("+b.margins().left+","+b.margins().top+")").call(N.x(b.x()));c.selectAll("rect").attr("height",g()),c.selectAll(".resize").append("path").attr("d",b.resizeHandlePath),b.hasFilter()&&b.redrawBrush(a)}},b.extendBrush=function(){var a=N.extent();return b.round()&&(a[0]=a.map(b.round())[0],a[1]=a.map(b.round())[1],t.select(".brush").call(N.extent(a))),a},b.brushIsEmpty=function(a){return N.empty()||!a||a[1]<=a[0]},b.brushHasNoLength=function(a){return a[0]instanceof Date&&a[1]instanceof Date?a[0].getTime()==a[1].getTime():a[0]==a[1]},b._brushing=function(){var c=b.extendBrush();b.redrawBrush(t),b.brushHasNoLength(c)||(b.brushIsEmpty(c)?a.events.trigger(function(){b.filter(null),a.redrawAll(b.chartGroup())}):a.events.trigger(function(){b.filter(null),b.filter([c[0],c[1]]),a.redrawAll(b.chartGroup())},a.constants.EVENT_DELAY))},b.redrawBrush=function(a){if(O){b.filter()&&b.brush().empty()&&b.brush().extent(b.filter());var c=a.select("g.brush");c.call(b.brush().x(b.x())),c.selectAll("rect").attr("height",g())}b.fadeDeselectedArea()},b.fadeDeselectedArea=function(){},b.resizeHandlePath=function(a){var b=+("e"==a),c=b?1:-1,d=g()/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"Z"+"M"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)},b.clipPadding=function(a){return arguments.length?(V=a,b):V},b._preprocessData=function(){},b.doRender=function(){return b.resetSvg(),b._generateG(),i(),b._preprocessData(),c(b.g()),e(b.g()),b.plotData(),b.renderXAxis(b.g()),b.renderYAxis(b.g()),b.renderBrush(b.g()),j(),b},b.doRedraw=function(){return b._preprocessData(),c(b.g()),e(b.g()),b.plotData(),b.elasticY()&&b.renderYAxis(b.g()),(b.elasticX()||R)&&b.renderXAxis(b.g()),b.redrawBrush(b.g()),b},b.subRender=function(){return b.plotData(),b},b.brushOn=function(a){return arguments.length?(O=a,b):O},b.focus=function(a){R=!0,l(a)?b.x().domain(a):b.x().domain(b.xOriginalDomain()),b.rescale(),b.redraw(),l(a)||(R=!1)},b.refocused=function(){return R},b.focusChart=function(c){return arguments.length?(D=c,b.on("filtered",function(b){a.events.trigger(function(){D.focus(b.filter()),D.filter(b.filter()),a.redrawAll(b.chartGroup())})}),b):D},b},a.colorChart=function(a){var b=d3.scale.category20c(),c=function(b){return a.keyAccessor()(b)},d=function(c){return b(c,a)};return a.colors=function(c){return arguments.length?(b=c instanceof Array?d3.scale.quantize().range(c):c,a):b},a.ordinalColors=function(b){return a.colors(d3.scale.ordinal().range(b))},a.linearColors=function(b){return a.colors(d3.scale.linear().range(b).interpolate(d3.interpolateHcl))},a.colorAccessor=function(b){return arguments.length?(c=b,a):c},a.colorDomain=function(c){return arguments.length?(b.domain(c),a):b.domain()},a.calculateColorDomain=function(){var c=[d3.min(a.data(),a.colorAccessor()),d3.max(a.data(),a.colorAccessor())];b.domain(c)},a.getColor=function(a,b){return d(c(a,b))},a.colorCalculator=function(b){return arguments.length?(d=b,a):d},a},a.stackableChart=function(b){function c(){var a=[];if(b.x()){var c,d=b.x().domain();if(b.isOrdinal()){var e=d3.set(d);c=function(a){return e.has(a.x)}}else c=function(a){return a.x>=d[0]&&a.x<=d[d.length-1]};b.stackLayers().forEach(function(b){b.points.forEach(function(b){c(b)&&a.push(b)})})}else b.stackLayers().forEach(function(b){a=a.concat(b.points)});return a}function d(a,c){a.all().forEach(function(a,d){var e=b.getKeyAccessorByIndex(c)(a),f=b.getValueAccessorByIndex(c)(a);i.setDataPoint(c,d,{data:a,x:e,y:f,layer:c})})}var e,f,g,h,i=new a.utils.GroupStack,j=d3.layout.stack().offset("zero").order("default").values(function(a){return a.points});return b.stack=function(a,c,d){return arguments.length||i.clear(),i.setDefaultAccessor(b.valueAccessor()),"string"==typeof c?(b._setGroupName(a,c,d),i.addNamedGroup(a,c,d)):(d=c,i.addGroup(a,d)),b.expireCache(),b},b.hideStack=function(a){i.hideGroups(a,b._getGroupName(b.group())==a)},b.showStack=function(a){i.showGroups(a,b._getGroupName(b.group())==a)},b.expireCache=function(){return e=null,f=null,g=null,h=null,b},b.allGroups=function(){if(null===e){e=[],e.push(b.group());for(var a=0;a<i.size();++a)e.push(i.getGroupByIndex(a))}return e},b.allValueAccessors=function(){if(null===f){f=[],f.push(b.valueAccessor());for(var a=0;a<i.size();++a)f.push(i.getAccessorByIndex(a))}return f},b.getValueAccessorByIndex=function(a){return b.allValueAccessors()[a]},b.yAxisMin=function(){var d,e=c();return d=d3.min(e,function(a){return a.y+a.y0<a.y0?a.y+a.y0:a.y0}),d=a.utils.subtract(d,b.yAxisPadding())},b.yAxisMax=function(){var d,e=c();return d=d3.max(e,function(a){return a.y+a.y0}),d=a.utils.add(d,b.yAxisPadding())},b.allKeyAccessors=function(){if(null===g){g=[],g.push(b.keyAccessor());for(var a=0;a<i.size();++a)g.push(b.keyAccessor())}return g},b.getKeyAccessorByIndex=function(a){return b.allKeyAccessors()[a]},b.xAxisMin=function(){var c=b.allGroups().reduce(function(c,d,e){var f=a.utils.groupMin(d,b.getKeyAccessorByIndex(e));return null===c||c>f?f:c},null);return a.utils.subtract(c,b.xAxisPadding())},b.xAxisMax=function(){var c=b.allGroups().reduce(function(c,d,e){var f=a.utils.groupMax(d,b.getKeyAccessorByIndex(e));return null===c||f>c?f:c},null);return a.utils.add(c,b.xAxisPadding())},b.calculateDataPointMatrixForAll=function(){i.clearDataLayers(),b.allGroups().forEach(d)},b.getChartStack=function(){return i},a.override(b,"valueAccessor",function(a){return arguments.length?(b.expireCache(),b._valueAccessor(a)):b._valueAccessor()}),a.override(b,"keyAccessor",function(a){return arguments.length?(b.expireCache(),b._keyAccessor(a)):b._keyAccessor()}),b.stackLayout=function(a){return arguments.length?(j=a,b):j},b.stackLayers=function(a){return arguments.length?(h=a,void 0):(null===h&&(b.calculateDataPointMatrixForAll(),h=b.stackLayout()(i.toLayers())),h)},b._layerColorAccessor=function(a){return void 0===a.layer?a.index:a.layer},b.colorAccessor(b._layerColorAccessor),b.legendables=function(){return b.allGroups().map(function(c,d){return a.utils.createLegendable(b,c,b.getValueAccessorByIndex(d),b.colorCalculator()(d))})},b},a.abstractBubbleChart=function(b){var c=.3,d=10;b.BUBBLE_NODE_CLASS="node",b.BUBBLE_CLASS="bubble",b.MIN_RADIUS=10,b=a.colorChart(b),b.renderLabel(!0),b.renderTitle(!1),b.data(function(a){return a.top(1/0)});var e=d3.scale.linear().domain([0,100]),f=function(a){return a.r};b.r=function(a){return arguments.length?(e=a,b):e},b.radiusValueAccessor=function(a){return arguments.length?(f=a,b):f},b.rMin=function(){var a=d3.min(b.data(),function(a){return b.radiusValueAccessor()(a)});return a},b.rMax=function(){var a=d3.max(b.data(),function(a){return b.radiusValueAccessor()(a)});return a},b.bubbleR=function(a){var c=b.radiusValueAccessor()(a),d=b.r()(c);return(isNaN(d)||0>=c)&&(d=0),d};var g=function(a){return b.label()(a)},h=function(a){return b.bubbleR(a)>d?1:0};b.doRenderLabel=function(c){if(b.renderLabel()){var d=c.select("text");d.empty()&&(d=c.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",b.onClick)),d.attr("opacity",0).text(g),a.transition(d,b.transitionDuration()).attr("opacity",h)}},b.doUpdateLabels=function(c){if(b.renderLabel()){var d=c.selectAll("text").text(g);a.transition(d,b.transitionDuration()).attr("opacity",h)}};var i=function(a){return b.title()(a)};return b.doRenderTitles=function(a){if(b.renderTitle()){var c=a.select("title");c.empty()&&a.append("title").text(i)}},b.doUpdateTitles=function(a){b.renderTitle()&&a.selectAll("title").text(i)},b.minRadiusWithLabel=function(a){return arguments.length?(d=a,b):d},b.maxBubbleRelativeSize=function(a){return arguments.length?(c=a,b):c},b.fadeDeselectedArea=function(){b.hasFilter()?b.selectAll("g."+b.BUBBLE_NODE_CLASS).each(function(a){b.isSelectedNode(a)?b.highlightSelected(this):b.fadeDeselected(this)}):b.selectAll("g."+b.BUBBLE_NODE_CLASS).each(function(){b.resetHighlight(this)})},b.isSelectedNode=function(a){return b.hasFilter(a.key)},b.onClick=function(c){var d=c.key;a.events.trigger(function(){b.filter(d),a.redrawAll(b.chartGroup())})},b},a.pieChart=function(b,c){function d(){z=z?z:d3.min([F.width(),F.height()])/2;var a=p(),b=r(),c=b(F.data());if(A){var d=A.selectAll("g."+C).data(c);e(d,a,c),j(c,a),n(d),o()}}function e(a,b,c){var d=f(a);g(d,b),h(d),i(c,b)}function f(a){var b=a.enter().append("g").attr("class",function(a,b){return C+" _"+b});return b}function g(a,b){var c=a.append("path").attr("fill",w).on("click",x).attr("d",function(a,c){return y(a,c,b)});c.transition().duration(F.transitionDuration()).attrTween("d",u)}function h(a){F.renderTitle()&&a.append("title").text(function(a){return F.title()(a)})}function i(b,c){if(F.renderLabel()){var d=A.selectAll("text."+C).data(b);d.exit().remove();var e=d.enter().append("text").attr("class",function(a,b){return C+" _"+b}).on("click",x);a.transition(e,F.transitionDuration()).attr("transform",function(a){a.innerRadius=F.innerRadius(),a.outerRadius=F.radius();var b=c.centroid(a);return isNaN(b[0])||isNaN(b[1])?"translate(0,0)":"translate("+b+")"}).attr("text-anchor","middle").text(function(a){var b=a.data;return t(b)||s(a)?"":F.label()(a.data)})}}function j(a,b){k(a,b),l(a,b),m(a)}function k(b,c){var d=A.selectAll("g."+C).data(b).select("path").attr("d",function(a,b){return y(a,b,c)});a.transition(d,F.transitionDuration(),function(a){a.attrTween("d",u)}).attr("fill",w)}function l(b,c){if(F.renderLabel()){var d=A.selectAll("text."+C).data(b);a.transition(d,F.transitionDuration()).attr("transform",function(a){a.innerRadius=D,a.outerRadius=z;var b=c.centroid(a);return isNaN(b[0])||isNaN(b[1])?"translate(0,0)":"translate("+b+")"}).attr("text-anchor","middle").text(function(a){var b=a.data;return t(b)||s(a)?"":F.label()(a.data)})}}function m(a){F.renderTitle()&&A.selectAll("g."+C).data(a).select("title").text(function(a){return F.title()(a.data)})}function n(a){a.exit().remove()}function o(){F.hasFilter()?F.selectAll("g."+C).each(function(a){q(a)?F.highlightSelected(this):F.fadeDeselected(this)}):F.selectAll("g."+C).each(function(){F.resetHighlight(this)})}function p(){return d3.svg.arc().outerRadius(z).innerRadius(D)}function q(a){return F.hasFilter(F.cappedKeyAccessor(a.data))}function r(){return d3.layout.pie().sort(null).value(F.cappedValueAccessor)}function s(a){var b=a.endAngle-a.startAngle;return isNaN(b)||E>b}function t(a){return 0===F.cappedValueAccessor(a)}function u(a){a.innerRadius=D;var b=this._current;v(b)&&(b={startAngle:0,endAngle:0});var c=d3.interpolate(b,a);return this._current=c(0),function(a){return y(c(a),0,p())}}function v(a){return!a||isNaN(a.startAngle)||isNaN(a.endAngle)}function w(a,b){return F.getColor(a.data,b)}function x(a,b){F.onClick(a.data,b)}function y(a,b,c){var d=c(a,b);return d.indexOf("NaN")>=0&&(d="M0,0"),d}var z,A,B=.5,C="pie-slice",D=0,E=B,F=a.capped(a.colorChart(a.baseChart({})));return F.colorAccessor(F.cappedKeyAccessor),F.title(function(a){return F.cappedKeyAccessor(a)+": "+F.cappedValueAccessor(a)}),F.slicesCap=F.cap,F.label(F.cappedKeyAccessor),F.renderLabel(!0),F.transitionDuration(350),F.doRender=function(){return F.resetSvg(),A=F.svg().append("g").attr("transform","translate("+F.cx()+","+F.cy()+")"),d(),F},F.innerRadius=function(a){return arguments.length?(D=a,F):D},F.radius=function(a){return arguments.length?(z=a,F):z},F.cx=function(){return F.width()/2},F.cy=function(){return F.height()/2},F.doRedraw=function(){return d(),F | |
},F.minAngleForLabel=function(a){return arguments.length?(E=a,F):E},F.anchor(b,c)},a.barChart=function(b,c){function d(b){return a.utils.safeNumber(Math.abs(m.y()(b.y+b.y0)-m.y()(b.y0)))}function e(b,c){var e=b.selectAll("rect.bar").data(c.points,a.pluck("data",m.keyAccessor()));e.enter().append("rect").attr("class","bar").attr("fill",m.getColor),m.renderTitle()&&e.append("title").text(a.pluck("data",m.title())),m.isOrdinal()&&e.on("click",h),a.transition(e,m.transitionDuration()).attr("x",function(b){var c=m.x()(b.x);return(o||m.isOrdinal())&&(c-=j/2),a.utils.safeNumber(c)}).attr("y",function(b){var c=m.y()(b.y+b.y0);return b.y<0&&(c-=d(b)),a.utils.safeNumber(c)}).attr("width",j).attr("height",function(a){return d(a)}).select("title").text(a.pluck("data",m.title())),a.transition(e.exit(),m.transitionDuration()).attr("height",0).remove()}function f(){if(void 0===j){var a=m.isOrdinal()?g()+1:g(),b=Math.floor((m.xAxisLength()-(a-1)*n)/a);(1/0==b||isNaN(b)||k>b)&&(b=k),j=b}}function g(){return void 0===i&&(i=m.xUnitCount()),i}function h(a){m.onClick(a.data)}var i,j,k=1,l=2,m=a.stackableChart(a.coordinateGridChart({})),n=l,o=!1;return a.override(m,"rescale",function(){m._rescale(),i=void 0,j=void 0,g()}),m.plotData=function(){var a=m.chartBodyG().selectAll("g.stack").data(m.stackLayers());f(),a.enter().append("g").attr("class",function(a,b){return"stack _"+b}),a.each(function(a){var b=d3.select(this);e(b,a)}),m.stackLayers(null)},m.fadeDeselectedArea=function(){var b=m.chartBodyG().selectAll("rect.bar"),c=m.brush().extent();if(m.isOrdinal())m.hasFilter()?(b.classed(a.constants.SELECTED_CLASS,function(a){return m.hasFilter(m.keyAccessor()(a.data))}),b.classed(a.constants.DESELECTED_CLASS,function(a){return!m.hasFilter(m.keyAccessor()(a.data))})):(b.classed(a.constants.SELECTED_CLASS,!1),b.classed(a.constants.DESELECTED_CLASS,!1));else if(m.brushIsEmpty(c))b.classed(a.constants.DESELECTED_CLASS,!1);else{var d=c[0],e=c[1];b.classed(a.constants.DESELECTED_CLASS,function(a){var b=m.keyAccessor()(a.data);return d>b||b>=e})}},m.centerBar=function(a){return arguments.length?(o=a,m):o},m.gap=function(a){return arguments.length?(n=a,m):n},m.extendBrush=function(){var a=m.brush().extent();return m.round()&&!o&&(a[0]=a.map(m.round())[0],a[1]=a.map(m.round())[1],m.chartBodyG().select(".brush").call(m.brush().extent(a))),a},m.legendHighlight=function(a){m.select(".chart-body").selectAll("rect.bar").filter(function(){return d3.select(this).attr("fill")==a.color}).classed("highlight",!0),m.select(".chart-body").selectAll("rect.bar").filter(function(){return d3.select(this).attr("fill")!=a.color}).classed("fadeout",!0)},m.legendReset=function(a){m.selectAll(".chart-body").selectAll("rect.bar").filter(function(){return d3.select(this).attr("fill")==a.color}).classed("highlight",!1),m.selectAll(".chart-body").selectAll("rect.bar").filter(function(){return d3.select(this).attr("fill")!=a.color}).classed("fadeout",!1)},a.override(m,"xAxisMax",function(){var a=this._xAxisMax();if("resolution"in m.xUnits()){var b=m.xUnits().resolution;a+=b}return a}),m.anchor(b,c)},a.lineChart=function(b,c){function d(b,c){var d=d3.svg.line().x(function(a){return s.x()(a.x)}).y(function(a){return s.y()(a.y+a.y0)}).interpolate(v).tension(w);m&&d.defined(m),b.append("path").attr("class","line").attr("stroke",s.getColor).attr("fill",s.getColor),a.transition(c.select("path.line"),s.transitionDuration()).attr("d",function(a){return f(d(a.points))})}function e(b,c){if(t){var d=d3.svg.area().x(function(a){return s.x()(a.x)}).y(function(a){return s.y()(a.y+a.y0)}).y0(function(a){return s.y()(a.y0)}).interpolate(v).tension(w);m&&d.defined(m),b.append("path").attr("class","area").attr("fill",s.getColor).attr("d",function(a){return f(d(a.points))}),a.transition(c.select("path.area"),s.transitionDuration()).attr("d",function(a){return f(d(a.points))})}}function f(a){return!a||a.indexOf("NaN")>=0?"M0,0":a}function g(b,c){if(!s.brushOn()){var d=o+"-list",e=b.select("g."+d);e.empty()&&(e=b.append("g").attr("class",d)),c.each(function(b,c){var d=d3.select(this),f=d.datum().points;m&&(f=f.filter(m));var g=e.select("g."+o+"._"+c);g.empty()&&(g=e.append("g").attr("class",o+" _"+c)),h(g);var n=g.selectAll("circle."+p).data(f);n.enter().append("circle").attr("class",p).attr("r",u).attr("fill",function(){return s.colorCalculator()(c)}).style("fill-opacity",1e-6).style("stroke-opacity",1e-6).on("mousemove",function(){var a=d3.select(this);i(a),j(a,g)}).on("mouseout",function(){var a=d3.select(this);k(a),l(g)}).append("title").text(a.pluck("data",s.title())),n.attr("cx",function(b){return a.utils.safeNumber(s.x()(b.x))}).attr("cy",function(b){return a.utils.safeNumber(s.y()(b.y+b.y0))}).select("title").text(a.pluck("data",s.title())),n.exit().remove()})}}function h(a){var b=a.select("path."+q).empty()?a.append("path").attr("class",q):a.select("path."+q);b.style("display","none").attr("stroke-dasharray","5,5");var c=a.select("path."+r).empty()?a.append("path").attr("class",r):a.select("path."+r);c.style("display","none").attr("stroke-dasharray","5,5")}function i(a){return a.style("fill-opacity",.8),a.style("stroke-opacity",.8),a}function j(a,b){var c=a.attr("cx"),d=a.attr("cy");b.select("path."+q).style("display","").attr("d","M0 "+d+"L"+c+" "+d),b.select("path."+r).style("display","").attr("d","M"+c+" "+s.yAxisHeight()+"L"+c+" "+d)}function k(a){a.style("fill-opacity",1e-6).style("stroke-opacity",1e-6)}function l(a){a.select("path."+q).style("display","none"),a.select("path."+r).style("display","none")}var m,n=5,o="dc-tooltip",p="dot",q="yRef",r="xRef",s=a.stackableChart(a.coordinateGridChart({})),t=!1,u=n,v="linear",w=.7;return s.transitionDuration(500),s.plotData=function(){var a=s.chartBodyG(),b=a.selectAll("g.stack-list");b.empty()&&(b=a.append("g").attr("class","stack-list"));var c=b.selectAll("g.stack").data(s.stackLayers()),f=c.enter().append("g").attr("class",function(a,b){return"stack _"+b});d(f,c),e(f,c),g(a,c),s.stackLayers(null)},s.interpolate=function(a){return arguments.length?(v=a,s):v},s.tension=function(a){return arguments.length?(w=a,s):w},s.defined=function(a){return arguments.length?(m=a,s):m},s.renderArea=function(a){return arguments.length?(t=a,s):t},s.dotRadius=function(a){return arguments.length?(u=a,s):u},s.legendHighlight=function(a){s.selectAll(".chart-body").selectAll("path").filter(function(){return d3.select(this).attr("fill")==a.color}).classed("highlight",!0),s.selectAll(".chart-body").selectAll("path").filter(function(){return d3.select(this).attr("fill")!=a.color}).classed("fadeout",!0)},s.legendReset=function(a){s.selectAll(".chart-body").selectAll("path").filter(function(){return d3.select(this).attr("fill")==a.color}).classed("highlight",!1),s.selectAll(".chart-body").selectAll("path").filter(function(){return d3.select(this).attr("fill")!=a.color}).classed("fadeout",!1)},s.anchor(b,c)},a.dataCount=function(b,c){var d=d3.format(",d"),e=a.baseChart({});return e.doRender=function(){return e.selectAll(".total-count").text(d(e.dimension().size())),e.selectAll(".filter-count").text(d(e.group().value())),e},e.doRedraw=function(){return e.doRender()},e.anchor(b,c)},a.dataTable=function(b,c){function d(){var a=l.root().selectAll("tbody").data(e(),function(a){return l.keyAccessor()(a)}),b=a.enter().append("tbody");return b.append("tr").attr("class",k).append("td").attr("class",h).attr("colspan",n.length).html(function(a){return l.keyAccessor()(a)}),a.exit().remove(),b}function e(){g||(g=crossfilter.quicksort.by(o));var a=l.dimension().top(m);return d3.nest().key(l.group()).sortKeys(p).sortValues(p).entries(g(a,0,a.length))}function f(a){var b=a.order().selectAll("tr."+i).data(function(a){return a.values}),c=b.enter().append("tr").attr("class",i);return n.forEach(function(a,b){c.append("td").attr("class",j+" _"+b).html(a)}),b.exit().remove(),b}var g,h="dc-table-label",i="dc-table-row",j="dc-table-column",k="dc-table-group",l=a.baseChart({}),m=25,n=[],o=function(a){return a},p=d3.ascending;return l.doRender=function(){return l.selectAll("tbody").remove(),f(d()),l},l.doRedraw=function(){return l.doRender()},l.size=function(a){return arguments.length?(m=a,l):m},l.columns=function(a){return arguments.length?(n=a,l):n},l.sortBy=function(a){return arguments.length?(o=a,l):o},l.order=function(a){return arguments.length?(p=a,l):p},l.anchor(b,c)},a.bubbleChart=function(b,c){function d(b){var c=b.enter().append("g");c.attr("class",i.BUBBLE_NODE_CLASS).attr("transform",k).append("circle").attr("class",function(a,b){return i.BUBBLE_CLASS+" _"+b}).on("click",i.onClick).attr("fill",i.getColor).attr("r",0),a.transition(b,i.transitionDuration()).attr("r",function(a){return i.bubbleR(a)}).attr("opacity",function(a){return i.bubbleR(a)>0?1:0}),i.doRenderLabel(c),i.doRenderTitles(c)}function e(b){a.transition(b,i.transitionDuration()).attr("transform",k).selectAll("circle."+i.BUBBLE_CLASS).attr("fill",i.getColor).attr("r",function(a){return i.bubbleR(a)}).attr("opacity",function(a){return i.bubbleR(a)>0?1:0}),i.doUpdateLabels(b),i.doUpdateTitles(b)}function f(a){a.exit().remove()}function g(a){var b=i.x()(i.keyAccessor()(a));return isNaN(b)&&(b=0),b}function h(a){var b=i.y()(i.valueAccessor()(a));return isNaN(b)&&(b=0),b}var i=a.abstractBubbleChart(a.coordinateGridChart({})),j=!1;i.transitionDuration(750);var k=function(a){return"translate("+g(a)+","+h(a)+")"};return i.elasticRadius=function(a){return arguments.length?(j=a,i):j},i.plotData=function(){j&&i.r().domain([i.rMin(),i.rMax()]),i.r().range([i.MIN_RADIUS,i.xAxisLength()*i.maxBubbleRelativeSize()]);var a=i.chartBodyG().selectAll("g."+i.BUBBLE_NODE_CLASS).data(i.data(),i.keyAccessor());d(a),e(a),f(a),i.fadeDeselectedArea()},i.renderBrush=function(){},i.redrawBrush=function(){i.fadeDeselectedArea()},i.anchor(b,c)},a.compositeChart=function(b,c){function d(a,b){a._generateG(j.g()),a.g().attr("class",i+" _"+b)}function e(){for(var a=[],b=0;b<k.length;++b)a.push(k[b].yAxisMin());return a}function f(){for(var a=[],b=0;b<k.length;++b)a.push(k[b].yAxisMax());return a}function g(){for(var a=[],b=0;b<k.length;++b)a.push(k[b].xAxisMin());return a}function h(){for(var a=[],b=0;b<k.length;++b)a.push(k[b].xAxisMax());return a}var i="sub",j=a.coordinateGridChart({}),k=[],l=!1;return j._mandatoryAttributes([]),j.transitionDuration(500),a.override(j,"_generateG",function(){for(var a=this.__generateG(),b=0;b<k.length;++b){var c=k[b];d(c,b),c.dimension()||c.dimension(j.dimension()),c.group()||c.group(j.group()),c.chartGroup(j.chartGroup()),c.svg(j.svg()),c.xUnits(j.xUnits()),c.transitionDuration(j.transitionDuration()),c.brushOn(j.brushOn())}return a}),j.plotData=function(){for(var a=0;a<k.length;++a){var b=k[a];b.g()||d(b,a),l&&b.colors(j.colors()),b.x(j.x()),b.y(j.y()),b.xAxis(j.xAxis()),b.yAxis(j.yAxis()),b.plotData(),b.activateRenderlets()}},j.fadeDeselectedArea=function(){for(var a=0;a<k.length;++a){var b=k[a];b.brush(j.brush()),b.fadeDeselectedArea()}},j.compose=function(a){return k=a,k.forEach(function(a,b){a.height(j.height()),a.width(j.width()),a.margins(j.margins()),a.title(j.title()),l&&a.colorAccessor()===a._layerColorAccessor&&a.colorCalculator(function(){return a.colors()(b)})}),j},j.children=function(){return k},j.shareColors=function(a){return arguments.length?(l=a,j):l},j.yAxisMin=function(){return d3.min(e())},j.yAxisMax=function(){return a.utils.add(d3.max(f()),j.yAxisPadding())},j.xAxisMin=function(){return a.utils.subtract(d3.min(g()),j.xAxisPadding())},j.xAxisMax=function(){return a.utils.add(d3.max(h()),j.xAxisPadding())},j.legendables=function(){var b=[];return k.forEach(function(c,d){l&&c.colors(j.colors());var e=c.legendables();e.length?b.push.apply(b,e):b.push(a.utils.createLegendable(c,c.group(),c.valueAccessor(),c.colorCalculator()(d)))}),b},j.legendHighlight=function(a){for(var b=0;b<k.length;++b){var c=k[b];c.legendHighlight(a)}},j.legendReset=function(a){for(var b=0;b<k.length;++b){var c=k[b];c.legendReset(a)}},j.anchor(b,c)},a.seriesChart=function(b,c){function d(a,b){return d3.ascending(h.keyAccessor()(a),h.keyAccessor()(b))}function e(a){i[a].g()&&i[a].g().remove(),delete i[a]}function f(){Object.keys(i).map(e),i={}}var g,h=a.compositeChart(b,c),i={},j=a.lineChart,k=d3.ascending,l=d;return h._mandatoryAttributes().push("seriesAccessor","chart"),h.shareColors(!0),h._preprocessData=function(){var a,b=[],d=d3.nest().key(g);k&&d.sortKeys(k),l&&d.sortValues(l);var f=d.entries(h.data()),m=f.map(function(d,e){var f=i[d.key]||j.call(h,h,c,d.key,e);return i[d.key]||(a=!0),i[d.key]=f,b.push(d.key),f.dimension(h.dimension()).group({all:d3.functor(d.values)},d.key).keyAccessor(h.keyAccessor()).valueAccessor(h.valueAccessor()).colorCalculator(function(){return f.colors()(d.key)})});Object.keys(i).filter(function(a){return-1===b.indexOf(a)}).forEach(function(b){e(b),a=!0}),h._compose(m),a&&h.legend()&&h.legend().render()},h.chart=function(a){return arguments.length?(j=a,f(),h):j},h.seriesAccessor=function(a){return arguments.length?(g=a,f(),h):g},h.seriesSort=function(a){return arguments.length?(k=a,f(),h):k},h.valueSort=function(a){return arguments.length?(l=a,f(),h):l},h._compose=h.compose,delete h.compose,h},a.geoChoroplethChart=function(b,c){function d(a){var b=e();if(f(a)){var c=g(a);m(c,a,b),n(c,a,b)}}function e(){for(var a={},b=o.data(),c=0;c<b.length;++c)a[o.keyAccessor()(b[c])]=o.valueAccessor()(b[c]);return a}function f(a){return l(a).keyAccessor}function g(b){var c=o.svg().selectAll(h(b)).classed("selected",function(a){return i(b,a)}).classed("deselected",function(a){return j(b,a)}).attr("class",function(c){var d=l(b).name,e=a.utils.nameToId(l(b).keyAccessor(c)),f=d+" "+e;return i(b,c)&&(f+=" selected"),j(b,c)&&(f+=" deselected"),f});return c}function h(a){return"g.layer"+a+" g."+l(a).name}function i(a,b){return o.hasFilter()&&o.hasFilter(k(a,b))}function j(a,b){return o.hasFilter()&&!o.hasFilter(k(a,b))}function k(a,b){return l(a).keyAccessor(b)}function l(a){return r[a]}function m(b,c,d){var e=b.select("path").attr("fill",function(){var a=d3.select(this).attr("fill");return a?a:"none"}).on("click",function(a){return o.onClick(a,c)});a.transition(e,o.transitionDuration()).attr("fill",function(a,b){return o.getColor(d[l(c).keyAccessor(a)],b)})}function n(a,b,c){o.renderTitle()&&a.selectAll("title").text(function(a){var d=k(b,a),e=c[d];return o.title()({key:d,value:e})})}var o=a.colorChart(a.baseChart({}));o.colorAccessor(function(a){return a||0});var p,q=d3.geo.path(),r=[];return o.doRender=function(){o.resetSvg();for(var a=0;a<r.length;++a){var b=o.svg().append("g").attr("class","layer"+a),c=b.selectAll("g."+l(a).name).data(l(a).data).enter().append("g").attr("class",l(a).name);c.append("path").attr("fill","white").attr("d",q),c.append("title"),d(a)}p=!1},o.onClick=function(b,c){var d=l(c).keyAccessor(b);a.events.trigger(function(){o.filter(d),a.redrawAll(o.chartGroup())})},o.doRedraw=function(){for(var a=0;a<r.length;++a)d(a),p&&o.svg().selectAll("g."+l(a).name+" path").attr("d",q);p=!1},o.overlayGeoJson=function(a,b,c){for(var d=0;d<r.length;++d)if(r[d].name==b)return r[d].data=a,r[d].keyAccessor=c,o;return r.push({name:b,data:a,keyAccessor:c}),o},o.projection=function(a){return q.projection(a),p=!0,o},o.geoJsons=function(){return r},o.removeGeoJson=function(a){for(var b=[],c=0;c<r.length;++c){var d=r[c];d.name!=a&&b.push(d)}return r=b,o},o.anchor(b,c)},a.bubbleOverlay=function(b,c){function d(){return i=m.select("g."+j),i.empty()&&(i=m.svg().append("g").attr("class",j)),i}function e(){var b=f();n.forEach(function(c){var d=g(c,b),e=d.select("circle."+l);e.empty()&&(e=d.append("circle").attr("class",l).attr("r",0).attr("fill",m.getColor).on("click",m.onClick)),a.transition(e,m.transitionDuration()).attr("r",function(a){return m.bubbleR(a)}),m.doRenderLabel(d),m.doRenderTitles(d)})}function f(){var a={};return m.data().forEach(function(b){a[m.keyAccessor()(b)]=b}),a}function g(b,c){var d=k+" "+a.utils.nameToId(b.name),e=i.select("g."+a.utils.nameToId(b.name));return e.empty()&&(e=i.append("g").attr("class",d).attr("transform","translate("+b.x+","+b.y+")")),e.datum(c[b.name]),e}function h(){var b=f();n.forEach(function(c){var d=g(c,b),e=d.select("circle."+l);a.transition(e,m.transitionDuration()).attr("r",function(a){return m.bubbleR(a)}).attr("fill",m.getColor),m.doUpdateLabels(d),m.doUpdateTitles(d)})}var i,j="bubble-overlay",k="node",l="bubble",m=a.abstractBubbleChart(a.baseChart({})),n=[];return m.transitionDuration(750),m.radiusValueAccessor(function(a){return a.value}),m.point=function(a,b,c){return n.push({name:a,x:b,y:c}),m},m.doRender=function(){return i=d(),m.r().range([m.MIN_RADIUS,m.width()*m.maxBubbleRelativeSize()]),e(),m.fadeDeselectedArea(),m},m.doRedraw=function(){return h(),m.fadeDeselectedArea(),m},m.debug=function(b){if(b){var c=m.select("g."+a.constants.DEBUG_GROUP_CLASS);c.empty()&&(c=m.svg().append("g").attr("class",a.constants.DEBUG_GROUP_CLASS));var d=c.append("text").attr("x",10).attr("y",20);c.append("rect").attr("width",m.width()).attr("height",m.height()).on("mousemove",function(){var a=d3.mouse(c.node()),b=a[0]+", "+a[1];d.text(b)})}else m.selectAll(".debug").remove();return m},m.anchor(b,c),m},a.rowChart=function(b,c){function d(){if(!r||s){var a=d3.extent(t,y.cappedValueAccessor);a[0]>0&&(a[0]=0),r=d3.scale.linear().domain(a).range([0,y.effectiveWidth()])}z.scale(r)}function e(){var b=q.select("g.axis");d(),b.empty()&&(b=q.append("g").attr("class","axis").attr("transform","translate(0, "+y.effectiveHeight()+")")),a.transition(b,y.transitionDuration()).call(z)}function f(){q.selectAll("g.tick").select("line.grid-line").remove(),q.selectAll("g.tick").append("line").attr("class","grid-line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",function(){return-y.effectiveHeight()})}function g(){t=y.data(),e(),f();var a=q.selectAll("g."+x).data(t);h(a),i(a),j(a)}function h(a){var b=a.enter().append("g").attr("class",function(a,b){return x+" _"+b});b.append("rect").attr("width",0),l(b),m(a)}function i(a){a.exit().remove()}function j(b){var c=t.length,d=(y.effectiveHeight()-(c+1)*w)/c,e=b.attr("transform",function(a,b){return"translate(0,"+((b+1)*w+b*d)+")"}).select("rect").attr("height",d).attr("fill",y.getColor).on("click",n).classed("deselected",function(a){return y.hasFilter()?!p(a):!1}).classed("selected",function(a){return y.hasFilter()?p(a):!1});a.transition(e,y.transitionDuration()).attr("width",function(a){var b=r(0)==-1/0?r(1):r(0);return Math.abs(b-r(y.valueAccessor()(a)))}).attr("transform",o),k(b),m(b)}function k(a){y.renderTitle()&&(a.selectAll("title").remove(),a.append("title").text(y.title()))}function l(a){y.renderLabel()&&a.append("text").on("click",n)}function m(b){if(y.renderLabel()){var c=b.select("text").attr("x",u).attr("y",v).on("click",n).attr("class",function(a,b){return x+" _"+b}).text(function(a){return y.label()(a)});a.transition(c,y.transitionDuration()).attr("transform",o)}}function n(a){y.onClick(a)}function o(a){var b=r(y.cappedValueAccessor(a)),c=r(0),d=b>c?c:b;return"translate("+d+",0)"}function p(a){return y.hasFilter(y.cappedKeyAccessor(a))}var q,r,s,t,u=10,v=15,w=5,x="row",y=a.capped(a.marginable(a.colorChart(a.baseChart({})))),z=d3.svg.axis().orient("bottom");return y.rowsCap=y.cap,y.doRender=function(){return y.resetSvg(),q=y.svg().append("g").attr("transform","translate("+y.margins().left+","+y.margins().top+")"),g(),y},y.title(function(a){return y.cappedKeyAccessor(a)+": "+y.cappedValueAccessor(a)}),y.label(y.cappedKeyAccessor),y.x=function(a){return arguments.length?(r=a,y):r},y.doRedraw=function(){return g(),y},y.xAxis=function(){return z},y.gap=function(a){return arguments.length?(w=a,y):w},y.elasticX=function(a){return arguments.length?(s=a,y):s},y.labelOffsetX=function(a){return arguments.length?(u=a,y):u},y.labelOffsetY=function(a){return arguments.length?(v=a,y):v},y.anchor(b,c)},a.legend=function(){function a(){return i+h}var b,c,d=2,e={},f=0,g=0,h=12,i=5;return e.parent=function(a){return arguments.length?(b=a,e):b},e.render=function(){b.svg().select("g.dc-legend").remove(),c=b.svg().append("g").attr("class","dc-legend").attr("transform","translate("+f+","+g+")");var e=c.selectAll("g.dc-legend-item").data(b.legendables()).enter().append("g").attr("class","dc-legend-item").attr("transform",function(b,c){return"translate(0,"+c*a()+")"}).on("mouseover",function(a){b.legendHighlight(a)}).on("mouseout",function(a){b.legendReset(a)});e.append("rect").attr("width",h).attr("height",h).attr("fill",function(a){return a.color}),e.append("text").text(function(a){return a.name}).attr("x",h+d).attr("y",function(){return h/2+(this.clientHeight?this.clientHeight:13)/2-2})},e.x=function(a){return arguments.length?(f=a,e):f},e.y=function(a){return arguments.length?(g=a,e):g},e.gap=function(a){return arguments.length?(i=a,e):i},e.itemHeight=function(a){return arguments.length?(h=a,e):h},e},a.capped=function(b){var c=1/0,d="Others",e=function(a){var c=d3.sum(a,b.valueAccessor()),e=b.group().all(),f=d3.sum(e,b.valueAccessor()),g=a.map(b.keyAccessor()),h=e.map(b.keyAccessor()),i=d3.set(g),j=h.filter(function(a){return!i.has(a)});f>c&&a.push({others:j,key:d,value:f-c})};return b.cappedKeyAccessor=function(a,c){return a.others?a.key:b.keyAccessor()(a,c)},b.cappedValueAccessor=function(a,c){return a.others?a.value:b.valueAccessor()(a,c)},b.data(function(a){if(1/0==c)return b.computeOrderedGroups(a.all());var d=a.top(c);return d=b.computeOrderedGroups(d),e&&e(d),d}),b.cap=function(a){return arguments.length?(c=a,b):c},b.othersLabel=function(a){return arguments.length?(d=a,b):d},b.othersGrouper=function(a){return arguments.length?(e=a,b):e},a.override(b,"onClick",function(a){a.others&&b.filter([a.others]),b._onClick(a)}),b},a.scatterPlot=function(b,c){var d=a.coordinateGridChart({}),e=function(a){return"translate("+d.x()(d.keyAccessor()(a))+","+d.y()(d.valueAccessor()(a))+")"},f=3;return d.transitionDuration(0),d.plotData=function(){var b=d.chartBodyG().selectAll("circle.symbol").data(d.data());b.enter().append("circle").attr("class","symbol").attr("fill",d.getColor(0)).attr("transform",e),a.transition(b,d.transitionDuration()).attr("transform",e).attr("r",f),a.transition(b.filter(function(a){return 0===d.valueAccessor()(a)}),d.transitionDuration()).attr("r",0).remove(),a.transition(b.exit(),d.transitionDuration()).attr("r",0).remove()},d.symbolSize=function(a){return arguments.length?(f=a,d):f},d.anchor(b,c)},a.numberDisplay=function(b,c){var d="number-display",e=d3.format(".2s"),f=a.baseChart({});return f._mandatoryAttributes(["group"]),f.value=function(){return f.data()},f.data(function(a){var b=a.value&&a.value()||a.top(1)[0];return f.valueAccessor()(b)}),f.transitionDuration(250),f.doRender=function(){var a=f.value(),b=f.selectAll("."+d);return b.empty()&&(b=b.data([0]).enter().append("span").attr("class",d)),b.transition().duration(f.transitionDuration()).ease("quad-out-in").tween("text",function(){var b=d3.interpolateNumber(this.lastValue||0,a);return this.lastValue=a,function(a){this.textContent=f.formatNumber()(b(a))}}),f},f.doRedraw=function(){return f.doRender()},f.formatNumber=function(a){return arguments.length?(e=a,f):e},f.anchor(b,c)},a.heatMap=function(b,c){function d(a,b,c){return!b||c[b-1]!=a}var e,f,g,h=a.colorChart(a.marginable(a.baseChart({})));return h._mandatoryAttributes(["group"]),h.title(h.colorAccessor()),h.boxOnClick=function(){},h.xAxisOnClick=function(){},h.yAxisOnClick=function(){},h.rows=function(a){if(arguments.length)return g=a,h;if(g)return g;var b=h.data().map(h.valueAccessor());return b.sort(d3.ascending),d3.scale.ordinal().domain(b.filter(d))},h.cols=function(a){if(arguments.length)return f=a,h;if(f)return f;var b=h.data().map(h.keyAccessor());return b.sort(d3.ascending),d3.scale.ordinal().domain(b.filter(d))},h.doRender=function(){return h.resetSvg(),e=h.svg().append("g").attr("class","heatmap").attr("transform","translate("+h.margins().left+","+h.margins().top+")"),h.doRedraw()},h.doRedraw=function(){var b=h.rows(),c=h.cols(),d=b.domain().length,f=c.domain().length,g=Math.floor(h.effectiveWidth()/f),i=Math.floor(h.effectiveHeight()/d);c.rangeRoundBands([0,h.effectiveWidth()]),b.rangeRoundBands([h.effectiveHeight(),0]);var j=e.selectAll("g.box-group").data(h.data(),function(a,b){return h.keyAccessor()(a,b)+"\x00"+h.valueAccessor()(a,b)}),k=j.enter().append("g").attr("class","box-group");k.append("rect").attr("fill","white").on("click",h.boxOnClick),k.append("title").text(function(a){return h.title()(a)}),a.transition(j.select("rect"),h.transitionDuration()).attr("class","heat-box").attr("x",function(a,b){return c(h.keyAccessor()(a,b))}).attr("y",function(a,c){return b(h.valueAccessor()(a,c))}).attr("rx",.15*g).attr("ry",.15*i).attr("fill",h.getColor).attr("width",g).attr("height",i),j.exit().remove();var l=e.selectAll("g.cols");l.empty()&&(l=e.append("g").attr("class","cols axis")),l.selectAll("text").data(c.domain()).enter().append("text").attr("x",function(a){return c(a)+g/2}).style("text-anchor","middle").attr("y",h.effectiveHeight()).attr("dy",12).on("click",h.xAxisOnClick).text(function(a){return a});var m=e.selectAll("g.rows");m.empty()&&(m=e.append("g").attr("class","rows axis")),m.selectAll("text").data(b.domain()).enter().append("text").attr("y",function(a){return b(a)+i/2}).attr("dy",6).style("text-anchor","end").attr("x",0).attr("dx",-2).on("click",h.yAxisOnClick).text(function(a){return a})},h.anchor(b,c)},function(){function a(a){return[0,a.length-1]}function b(a){return[d3.quantile(a,.25),d3.quantile(a,.5),d3.quantile(a,.75)]}d3.box=function(){function c(a){a.each(function(a,b){a=a.map(h).sort(d3.ascending);var c=d3.select(this),l=a.length,m=a[0],n=a[l-1],o=a.quartiles=j(a),p=i&&i.call(this,a,b),q=p&&p.map(function(b){return a[b]}),r=p?d3.range(0,p[0]).concat(d3.range(p[1]+1,l)):d3.range(l),s=d3.scale.linear().domain(g&&g.call(this,a,b)||[m,n]).range([e,0]),t=this.__chart__||d3.scale.linear().domain([0,1/0]).range(s.range());this.__chart__=s;var u=c.selectAll("line.center").data(q?[q]:[]);u.enter().insert("line","rect").attr("class","center").attr("x1",d/2).attr("y1",function(a){return t(a[0])}).attr("x2",d/2).attr("y2",function(a){return t(a[1])}).style("opacity",1e-6).transition().duration(f).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.transition().duration(f).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.exit().transition().duration(f).style("opacity",1e-6).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}).remove();var v=c.selectAll("rect.box").data([o]);v.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(a){return t(a[2])}).attr("width",d).attr("height",function(a){return t(a[0])-t(a[2])}).transition().duration(f).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])}),v.transition().duration(f).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])});var w=c.selectAll("line.median").data([o[1]]);w.enter().append("line").attr("class","median").attr("x1",0).attr("y1",t).attr("x2",d).attr("y2",t).transition().duration(f).attr("y1",s).attr("y2",s),w.transition().duration(f).attr("y1",s).attr("y2",s);var x=c.selectAll("line.whisker").data(q||[]);x.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",t).attr("x2",d).attr("y2",t).style("opacity",1e-6).transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1),x.transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1),x.exit().transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1e-6).remove();var y=c.selectAll("circle.outlier").data(r,Number);y.enter().insert("circle","text").attr("class","outlier").attr("r",5).attr("cx",d/2).attr("cy",function(b){return t(a[b])}).style("opacity",1e-6).transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.exit().transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1e-6).remove();var z=k||s.tickFormat(8),A=c.selectAll("text.box").data(o);A.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(a,b){return 1&b?6:-6}).attr("x",function(a,b){return 1&b?d:0}).attr("y",t).attr("text-anchor",function(a,b){return 1&b?"start":"end"}).text(z).transition().duration(f).attr("y",s),A.transition().duration(f).text(z).attr("y",s);var B=c.selectAll("text.whisker").data(q||[]);B.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",d).attr("y",t).text(z).style("opacity",1e-6).transition().duration(f).attr("y",s).style("opacity",1),B.transition().duration(f).text(z).attr("y",s).style("opacity",1),B.exit().transition().duration(f).attr("y",s).style("opacity",1e-6).remove()}),d3.timer.flush()}var d=1,e=1,f=0,g=null,h=Number,i=a,j=b,k=null;return c.width=function(a){return arguments.length?(d=a,c):d},c.height=function(a){return arguments.length?(e=a,c):e},c.tickFormat=function(a){return arguments.length?(k=a,c):k},c.duration=function(a){return arguments.length?(f=a,c):f},c.domain=function(a){return arguments.length?(g=null==a?a:d3.functor(a),c):g},c.value=function(a){return arguments.length?(h=a,c):h},c.whiskers=function(a){return arguments.length?(i=a,c):i},c.quartiles=function(a){return arguments.length?(j=a,c):j},c}}(),a.boxPlot=function(b,c){function d(){return g.group().all().map(function(a){return a.map=function(){return g.valueAccessor()(a)},a})}function e(a){return function(b){for(var c=b.quartiles[0],d=b.quartiles[2],e=(d-c)*a,f=-1,g=b.length;b[++f]<c-e;);for(;b[--g]>d+e;);return[f,g]}}var f,g=a.coordinateGridChart({}),h=1.5,i=e,j=i(h),k=d3.box();return g.yAxisPadding(12),g.plotData=function(){f=.2*g.effectiveWidth()/(g.xUnitCount()+1),k.whiskers(j).width(f).height(g.effectiveHeight()).domain(g.y().domain());var a=Array.prototype.slice.call(g.x().domain(),0);g.chartBodyG().selectAll("g.box").data(d()).enter().append("g").attr("class","box").attr("transform",function(a,b){return"translate("+(g.x()(b)-f/2)+",0)"}).call(k),g.x().domain(a)},g.yAxisMin=function(){var b=d3.min(g.group().all(),function(a){return d3.min(g.valueAccessor()(a))});return b=a.utils.subtract(b,g.yAxisPadding())},g.yAxisMax=function(){var b=d3.max(g.group().all(),function(a){return d3.max(g.valueAccessor()(a))});return b=a.utils.add(b,g.yAxisPadding())},g.anchor(b,c)},a}(); | |
//# sourceMappingURL=dc.min.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Font Awesome 3.0.2 | |
* the iconic font designed for use with Twitter Bootstrap | |
* ------------------------------------------------------- | |
* The full suite of pictographic icons, examples, and documentation | |
* can be found at: http://fortawesome.github.com/Font-Awesome/ | |
* | |
* License | |
* ------------------------------------------------------- | |
* - The Font Awesome font is licensed under the SIL Open Font License - http://scripts.sil.org/OFL | |
* - Font Awesome CSS, LESS, and SASS files are licensed under the MIT License - | |
* http://opensource.org/licenses/mit-license.html | |
* - The Font Awesome pictograms are licensed under the CC BY 3.0 License - http://creativecommons.org/licenses/by/3.0/ | |
* - Attribution is no longer required in Font Awesome 3.0, but much appreciated: | |
* "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome" | |
* Contact | |
* ------------------------------------------------------- | |
* Email: dave@davegandy.com | |
* Twitter: http://twitter.com/fortaweso_me | |
* Work: Lead Product Designer @ http://kyruus.com | |
*/ | |
[class^="icon-"],[class*=" icon-"]{font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;display:inline;width:auto;height:auto;line-height:normal;vertical-align:baseline;background-image:none;background-position:0 0;background-repeat:repeat;margin-top:0}.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"]{background-image:none}[class^="icon-"]:before,[class*=" icon-"]:before{text-decoration:inherit;display:inline-block;speak:none}a [class^="icon-"],a [class*=" icon-"]{display:inline-block}.icon-large:before{vertical-align:-10%;font-size:1.3333333333333333em}.btn [class^="icon-"],.nav [class^="icon-"],.btn [class*=" icon-"],.nav [class*=" icon-"]{display:inline}.btn [class^="icon-"].icon-large,.nav [class^="icon-"].icon-large,.btn [class*=" icon-"].icon-large,.nav [class*=" icon-"].icon-large{line-height:.9em}.btn [class^="icon-"].icon-spin,.nav [class^="icon-"].icon-spin,.btn [class*=" icon-"].icon-spin,.nav [class*=" icon-"].icon-spin{display:inline-block}.nav-tabs [class^="icon-"],.nav-pills [class^="icon-"],.nav-tabs [class*=" icon-"],.nav-pills [class*=" icon-"],.nav-tabs [class^="icon-"].icon-large,.nav-pills [class^="icon-"].icon-large,.nav-tabs [class*=" icon-"].icon-large,.nav-pills [class*=" icon-"].icon-large{line-height:.9em}li [class^="icon-"],.nav li [class^="icon-"],li [class*=" icon-"],.nav li [class*=" icon-"]{display:inline-block;width:1.25em;text-align:center}li [class^="icon-"].icon-large,.nav li [class^="icon-"].icon-large,li [class*=" icon-"].icon-large,.nav li [class*=" icon-"].icon-large{width:1.5625em}ul.icons{list-style-type:none;text-indent:-0.75em}ul.icons li [class^="icon-"],ul.icons li [class*=" icon-"]{width:.75em}.icon-muted{color:#eee}.icon-border{border:solid 1px #eee;padding:.2em .25em .15em;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.icon-2x{font-size:2em}.icon-2x.icon-border{border-width:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.icon-3x{font-size:3em}.icon-3x.icon-border{border-width:3px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.icon-4x{font-size:4em}.icon-4x.icon-border{border-width:4px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.pull-right{float:right}.pull-left{float:left}[class^="icon-"].pull-left,[class*=" icon-"].pull-left{margin-right:.3em}[class^="icon-"].pull-right,[class*=" icon-"].pull-right{margin-left:.3em}.btn [class^="icon-"].pull-left.icon-2x,.btn [class*=" icon-"].pull-left.icon-2x,.btn [class^="icon-"].pull-right.icon-2x,.btn [class*=" icon-"].pull-right.icon-2x{margin-top:.18em}.btn [class^="icon-"].icon-spin.icon-large,.btn [class*=" icon-"].icon-spin.icon-large{line-height:.8em}.btn.btn-small [class^="icon-"].pull-left.icon-2x,.btn.btn-small [class*=" icon-"].pull-left.icon-2x,.btn.btn-small [class^="icon-"].pull-right.icon-2x,.btn.btn-small [class*=" icon-"].pull-right.icon-2x{margin-top:.25em}.btn.btn-large [class^="icon-"],.btn.btn-large [class*=" icon-"]{margin-top:0}.btn.btn-large [class^="icon-"].pull-left.icon-2x,.btn.btn-large [class*=" icon-"].pull-left.icon-2x,.btn.btn-large [class^="icon-"].pull-right.icon-2x,.btn.btn-large [class*=" icon-"].pull-right.icon-2x{margin-top:.05em}.btn.btn-large [class^="icon-"].pull-left.icon-2x,.btn.btn-large [class*=" icon-"].pull-left.icon-2x{margin-right:.2em}.btn.btn-large [class^="icon-"].pull-right.icon-2x,.btn.btn-large [class*=" icon-"].pull-right.icon-2x{margin-left:.2em}.icon-spin{display:inline-block;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}@-moz-document url-prefix(){.icon-spin{height:.9em}.btn .icon-spin{height:auto}.icon-spin.icon-large{height:1.25em}.btn .icon-spin.icon-large{height:.75em}}.icon-glass:before{content:"\f000"}.icon-music:before{content:"\f001"}.icon-search:before{content:"\f002"}.icon-envelope:before{content:"\f003"}.icon-heart:before{content:"\f004"}.icon-star:before{content:"\f005"}.icon-star-empty:before{content:"\f006"}.icon-user:before{content:"\f007"}.icon-film:before{content:"\f008"}.icon-th-large:before{content:"\f009"}.icon-th:before{content:"\f00a"}.icon-th-list:before{content:"\f00b"}.icon-ok:before{content:"\f00c"}.icon-remove:before{content:"\f00d"}.icon-zoom-in:before{content:"\f00e"}.icon-zoom-out:before{content:"\f010"}.icon-off:before{content:"\f011"}.icon-signal:before{content:"\f012"}.icon-cog:before{content:"\f013"}.icon-trash:before{content:"\f014"}.icon-home:before{content:"\f015"}.icon-file:before{content:"\f016"}.icon-time:before{content:"\f017"}.icon-road:before{content:"\f018"}.icon-download-alt:before{content:"\f019"}.icon-download:before{content:"\f01a"}.icon-upload:before{content:"\f01b"}.icon-inbox:before{content:"\f01c"}.icon-play-circle:before{content:"\f01d"}.icon-repeat:before{content:"\f01e"}.icon-refresh:before{content:"\f021"}.icon-list-alt:before{content:"\f022"}.icon-lock:before{content:"\f023"}.icon-flag:before{content:"\f024"}.icon-headphones:before{content:"\f025"}.icon-volume-off:before{content:"\f026"}.icon-volume-down:before{content:"\f027"}.icon-volume-up:before{content:"\f028"}.icon-qrcode:before{content:"\f029"}.icon-barcode:before{content:"\f02a"}.icon-tag:before{content:"\f02b"}.icon-tags:before{content:"\f02c"}.icon-book:before{content:"\f02d"}.icon-bookmark:before{content:"\f02e"}.icon-print:before{content:"\f02f"}.icon-camera:before{content:"\f030"}.icon-font:before{content:"\f031"}.icon-bold:before{content:"\f032"}.icon-italic:before{content:"\f033"}.icon-text-height:before{content:"\f034"}.icon-text-width:before{content:"\f035"}.icon-align-left:before{content:"\f036"}.icon-align-center:before{content:"\f037"}.icon-align-right:before{content:"\f038"}.icon-align-justify:before{content:"\f039"}.icon-list:before{content:"\f03a"}.icon-indent-left:before{content:"\f03b"}.icon-indent-right:before{content:"\f03c"}.icon-facetime-video:before{content:"\f03d"}.icon-picture:before{content:"\f03e"}.icon-pencil:before{content:"\f040"}.icon-map-marker:before{content:"\f041"}.icon-adjust:before{content:"\f042"}.icon-tint:before{content:"\f043"}.icon-edit:before{content:"\f044"}.icon-share:before{content:"\f045"}.icon-check:before{content:"\f046"}.icon-move:before{content:"\f047"}.icon-step-backward:before{content:"\f048"}.icon-fast-backward:before{content:"\f049"}.icon-backward:before{content:"\f04a"}.icon-play:before{content:"\f04b"}.icon-pause:before{content:"\f04c"}.icon-stop:before{content:"\f04d"}.icon-forward:before{content:"\f04e"}.icon-fast-forward:before{content:"\f050"}.icon-step-forward:before{content:"\f051"}.icon-eject:before{content:"\f052"}.icon-chevron-left:before{content:"\f053"}.icon-chevron-right:before{content:"\f054"}.icon-plus-sign:before{content:"\f055"}.icon-minus-sign:before{content:"\f056"}.icon-remove-sign:before{content:"\f057"}.icon-ok-sign:before{content:"\f058"}.icon-question-sign:before{content:"\f059"}.icon-info-sign:before{content:"\f05a"}.icon-screenshot:before{content:"\f05b"}.icon-remove-circle:before{content:"\f05c"}.icon-ok-circle:before{content:"\f05d"}.icon-ban-circle:before{content:"\f05e"}.icon-arrow-left:before{content:"\f060"}.icon-arrow-right:before{content:"\f061"}.icon-arrow-up:before{content:"\f062"}.icon-arrow-down:before{content:"\f063"}.icon-share-alt:before{content:"\f064"}.icon-resize-full:before{content:"\f065"}.icon-resize-small:before{content:"\f066"}.icon-plus:before{content:"\f067"}.icon-minus:before{content:"\f068"}.icon-asterisk:before{content:"\f069"}.icon-exclamation-sign:before{content:"\f06a"}.icon-gift:before{content:"\f06b"}.icon-leaf:before{content:"\f06c"}.icon-fire:before{content:"\f06d"}.icon-eye-open:before{content:"\f06e"}.icon-eye-close:before{content:"\f070"}.icon-warning-sign:before{content:"\f071"}.icon-plane:before{content:"\f072"}.icon-calendar:before{content:"\f073"}.icon-random:before{content:"\f074"}.icon-comment:before{content:"\f075"}.icon-magnet:before{content:"\f076"}.icon-chevron-up:before{content:"\f077"}.icon-chevron-down:before{content:"\f078"}.icon-retweet:before{content:"\f079"}.icon-shopping-cart:before{content:"\f07a"}.icon-folder-close:before{content:"\f07b"}.icon-folder-open:before{content:"\f07c"}.icon-resize-vertical:before{content:"\f07d"}.icon-resize-horizontal:before{content:"\f07e"}.icon-bar-chart:before{content:"\f080"}.icon-twitter-sign:before{content:"\f081"}.icon-facebook-sign:before{content:"\f082"}.icon-camera-retro:before{content:"\f083"}.icon-key:before{content:"\f084"}.icon-cogs:before{content:"\f085"}.icon-comments:before{content:"\f086"}.icon-thumbs-up:before{content:"\f087"}.icon-thumbs-down:before{content:"\f088"}.icon-star-half:before{content:"\f089"}.icon-heart-empty:before{content:"\f08a"}.icon-signout:before{content:"\f08b"}.icon-linkedin-sign:before{content:"\f08c"}.icon-pushpin:before{content:"\f08d"}.icon-external-link:before{content:"\f08e"}.icon-signin:before{content:"\f090"}.icon-trophy:before{content:"\f091"}.icon-github-sign:before{content:"\f092"}.icon-upload-alt:before{content:"\f093"}.icon-lemon:before{content:"\f094"}.icon-phone:before{content:"\f095"}.icon-check-empty:before{content:"\f096"}.icon-bookmark-empty:before{content:"\f097"}.icon-phone-sign:before{content:"\f098"}.icon-twitter:before{content:"\f099"}.icon-facebook:before{content:"\f09a"}.icon-github:before{content:"\f09b"}.icon-unlock:before{content:"\f09c"}.icon-credit-card:before{content:"\f09d"}.icon-rss:before{content:"\f09e"}.icon-hdd:before{content:"\f0a0"}.icon-bullhorn:before{content:"\f0a1"}.icon-bell:before{content:"\f0a2"}.icon-certificate:before{content:"\f0a3"}.icon-hand-right:before{content:"\f0a4"}.icon-hand-left:before{content:"\f0a5"}.icon-hand-up:before{content:"\f0a6"}.icon-hand-down:before{content:"\f0a7"}.icon-circle-arrow-left:before{content:"\f0a8"}.icon-circle-arrow-right:before{content:"\f0a9"}.icon-circle-arrow-up:before{content:"\f0aa"}.icon-circle-arrow-down:before{content:"\f0ab"}.icon-globe:before{content:"\f0ac"}.icon-wrench:before{content:"\f0ad"}.icon-tasks:before{content:"\f0ae"}.icon-filter:before{content:"\f0b0"}.icon-briefcase:before{content:"\f0b1"}.icon-fullscreen:before{content:"\f0b2"}.icon-group:before{content:"\f0c0"}.icon-link:before{content:"\f0c1"}.icon-cloud:before{content:"\f0c2"}.icon-beaker:before{content:"\f0c3"}.icon-cut:before{content:"\f0c4"}.icon-copy:before{content:"\f0c5"}.icon-paper-clip:before{content:"\f0c6"}.icon-save:before{content:"\f0c7"}.icon-sign-blank:before{content:"\f0c8"}.icon-reorder:before{content:"\f0c9"}.icon-list-ul:before{content:"\f0ca"}.icon-list-ol:before{content:"\f0cb"}.icon-strikethrough:before{content:"\f0cc"}.icon-underline:before{content:"\f0cd"}.icon-table:before{content:"\f0ce"}.icon-magic:before{content:"\f0d0"}.icon-truck:before{content:"\f0d1"}.icon-pinterest:before{content:"\f0d2"}.icon-pinterest-sign:before{content:"\f0d3"}.icon-google-plus-sign:before{content:"\f0d4"}.icon-google-plus:before{content:"\f0d5"}.icon-money:before{content:"\f0d6"}.icon-caret-down:before{content:"\f0d7"}.icon-caret-up:before{content:"\f0d8"}.icon-caret-left:before{content:"\f0d9"}.icon-caret-right:before{content:"\f0da"}.icon-columns:before{content:"\f0db"}.icon-sort:before{content:"\f0dc"}.icon-sort-down:before{content:"\f0dd"}.icon-sort-up:before{content:"\f0de"}.icon-envelope-alt:before{content:"\f0e0"}.icon-linkedin:before{content:"\f0e1"}.icon-undo:before{content:"\f0e2"}.icon-legal:before{content:"\f0e3"}.icon-dashboard:before{content:"\f0e4"}.icon-comment-alt:before{content:"\f0e5"}.icon-comments-alt:before{content:"\f0e6"}.icon-bolt:before{content:"\f0e7"}.icon-sitemap:before{content:"\f0e8"}.icon-umbrella:before{content:"\f0e9"}.icon-paste:before{content:"\f0ea"}.icon-lightbulb:before{content:"\f0eb"}.icon-exchange:before{content:"\f0ec"}.icon-cloud-download:before{content:"\f0ed"}.icon-cloud-upload:before{content:"\f0ee"}.icon-user-md:before{content:"\f0f0"}.icon-stethoscope:before{content:"\f0f1"}.icon-suitcase:before{content:"\f0f2"}.icon-bell-alt:before{content:"\f0f3"}.icon-coffee:before{content:"\f0f4"}.icon-food:before{content:"\f0f5"}.icon-file-alt:before{content:"\f0f6"}.icon-building:before{content:"\f0f7"}.icon-hospital:before{content:"\f0f8"}.icon-ambulance:before{content:"\f0f9"}.icon-medkit:before{content:"\f0fa"}.icon-fighter-jet:before{content:"\f0fb"}.icon-beer:before{content:"\f0fc"}.icon-h-sign:before{content:"\f0fd"}.icon-plus-sign-alt:before{content:"\f0fe"}.icon-double-angle-left:before{content:"\f100"}.icon-double-angle-right:before{content:"\f101"}.icon-double-angle-up:before{content:"\f102"}.icon-double-angle-down:before{content:"\f103"}.icon-angle-left:before{content:"\f104"}.icon-angle-right:before{content:"\f105"}.icon-angle-up:before{content:"\f106"}.icon-angle-down:before{content:"\f107"}.icon-desktop:before{content:"\f108"}.icon-laptop:before{content:"\f109"}.icon-tablet:before{content:"\f10a"}.icon-mobile-phone:before{content:"\f10b"}.icon-circle-blank:before{content:"\f10c"}.icon-quote-left:before{content:"\f10d"}.icon-quote-right:before{content:"\f10e"}.icon-spinner:before{content:"\f110"}.icon-circle:before{content:"\f111"}.icon-reply:before{content:"\f112"}.icon-github-alt:before{content:"\f113"}.icon-folder-close-alt:before{content:"\f114"}.icon-folder-open-alt:before{content:"\f115"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hljs=new function(){function m(p){return p.replace(/&/gm,"&").replace(/</gm,"<")}function f(r,q,p){return RegExp(q,"m"+(r.cI?"i":"")+(p?"g":""))}function b(r){for(var p=0;p<r.childNodes.length;p++){var q=r.childNodes[p];if(q.nodeName=="CODE"){return q}if(!(q.nodeType==3&&q.nodeValue.match(/\s+/))){break}}}function h(t,s){var p="";for(var r=0;r<t.childNodes.length;r++){if(t.childNodes[r].nodeType==3){var q=t.childNodes[r].nodeValue;if(s){q=q.replace(/\n/g,"")}p+=q}else{if(t.childNodes[r].nodeName=="BR"){p+="\n"}else{p+=h(t.childNodes[r])}}}if(/MSIE [678]/.test(navigator.userAgent)){p=p.replace(/\r/g,"\n")}return p}function a(s){var r=s.className.split(/\s+/);r=r.concat(s.parentNode.className.split(/\s+/));for(var q=0;q<r.length;q++){var p=r[q].replace(/^language-/,"");if(e[p]||p=="no-highlight"){return p}}}function c(q){var p=[];(function(s,t){for(var r=0;r<s.childNodes.length;r++){if(s.childNodes[r].nodeType==3){t+=s.childNodes[r].nodeValue.length}else{if(s.childNodes[r].nodeName=="BR"){t+=1}else{if(s.childNodes[r].nodeType==1){p.push({event:"start",offset:t,node:s.childNodes[r]});t=arguments.callee(s.childNodes[r],t);p.push({event:"stop",offset:t,node:s.childNodes[r]})}}}}return t})(q,0);return p}function k(y,w,x){var q=0;var z="";var s=[];function u(){if(y.length&&w.length){if(y[0].offset!=w[0].offset){return(y[0].offset<w[0].offset)?y:w}else{return w[0].event=="start"?y:w}}else{return y.length?y:w}}function t(D){var A="<"+D.nodeName.toLowerCase();for(var B=0;B<D.attributes.length;B++){var C=D.attributes[B];A+=" "+C.nodeName.toLowerCase();if(C.value!==undefined&&C.value!==false&&C.value!==null){A+='="'+m(C.value)+'"'}}return A+">"}while(y.length||w.length){var v=u().splice(0,1)[0];z+=m(x.substr(q,v.offset-q));q=v.offset;if(v.event=="start"){z+=t(v.node);s.push(v.node)}else{if(v.event=="stop"){var p,r=s.length;do{r--;p=s[r];z+=("</"+p.nodeName.toLowerCase()+">")}while(p!=v.node);s.splice(r,1);while(r<s.length){z+=t(s[r]);r++}}}}return z+m(x.substr(q))}function j(){function q(w,x,u){if(w.compiled){return}var t;if(!u){w.bR=f(x,w.b?w.b:"\\B|\\b");if(!w.e&&!w.eW){w.e="\\B|\\b"}if(w.e){w.eR=f(x,w.e)}}if(w.i){w.iR=f(x,w.i)}if(w.r===undefined){w.r=1}if(w.k){w.lR=f(x,w.l||hljs.IR,true);for(var v in w.k){if(!w.k.hasOwnProperty(v)){continue}if(w.k[v] instanceof Object){t=w.k[v]}else{t=w.k;v="keyword"}for(var r in t){if(!t.hasOwnProperty(r)){continue}w.k[r]=[v,t[r]]}}}if(!w.c){w.c=[]}w.compiled=true;for(var s=0;s<w.c.length;s++){if(w.c[s]=="self"){w.c[s]=w}q(w.c[s],x,false)}if(w.starts){q(w.starts,x,false)}}for(var p in e){if(!e.hasOwnProperty(p)){continue}q(e[p].dM,e[p],true)}}function d(B,C){if(!j.called){j();j.called=true}function q(r,M){for(var L=0;L<M.c.length;L++){if(M.c[L].bR.test(r)){return M.c[L]}}}function v(L,r){if(D[L].e&&D[L].eR.test(r)){return 1}if(D[L].eW){var M=v(L-1,r);return M?M+1:0}return 0}function w(r,L){return L.i&&L.iR.test(r)}function K(N,O){var M=[];for(var L=0;L<N.c.length;L++){M.push(N.c[L].b)}var r=D.length-1;do{if(D[r].e){M.push(D[r].e)}r--}while(D[r+1].eW);if(N.i){M.push(N.i)}return f(O,"("+M.join("|")+")",true)}function p(M,L){var N=D[D.length-1];if(!N.t){N.t=K(N,E)}N.t.lastIndex=L;var r=N.t.exec(M);if(r){return[M.substr(L,r.index-L),r[0],false]}else{return[M.substr(L),"",true]}}function z(N,r){var L=E.cI?r[0].toLowerCase():r[0];var M=N.k[L];if(M&&M instanceof Array){return M}return false}function F(L,P){L=m(L);if(!P.k){return L}var r="";var O=0;P.lR.lastIndex=0;var M=P.lR.exec(L);while(M){r+=L.substr(O,M.index-O);var N=z(P,M);if(N){x+=N[1];r+='<span class="'+N[0]+'">'+M[0]+"</span>"}else{r+=M[0]}O=P.lR.lastIndex;M=P.lR.exec(L)}return r+L.substr(O,L.length-O)}function J(L,M){if(M.sL&&e[M.sL]){var r=d(M.sL,L);x+=r.keyword_count;return r.value}else{return F(L,M)}}function I(M,r){var L=M.cN?'<span class="'+M.cN+'">':"";if(M.rB){y+=L;M.buffer=""}else{if(M.eB){y+=m(r)+L;M.buffer=""}else{y+=L;M.buffer=r}}D.push(M);A+=M.r}function G(N,M,Q){var R=D[D.length-1];if(Q){y+=J(R.buffer+N,R);return false}var P=q(M,R);if(P){y+=J(R.buffer+N,R);I(P,M);return P.rB}var L=v(D.length-1,M);if(L){var O=R.cN?"</span>":"";if(R.rE){y+=J(R.buffer+N,R)+O}else{if(R.eE){y+=J(R.buffer+N,R)+O+m(M)}else{y+=J(R.buffer+N+M,R)+O}}while(L>1){O=D[D.length-2].cN?"</span>":"";y+=O;L--;D.length--}var r=D[D.length-1];D.length--;D[D.length-1].buffer="";if(r.starts){I(r.starts,"")}return R.rE}if(w(M,R)){throw"Illegal"}}var E=e[B];var D=[E.dM];var A=0;var x=0;var y="";try{var s,u=0;E.dM.buffer="";do{s=p(C,u);var t=G(s[0],s[1],s[2]);u+=s[0].length;if(!t){u+=s[1].length}}while(!s[2]);if(D.length>1){throw"Illegal"}return{r:A,keyword_count:x,value:y}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:m(C)}}else{throw H}}}function g(t){var p={keyword_count:0,r:0,value:m(t)};var r=p;for(var q in e){if(!e.hasOwnProperty(q)){continue}var s=d(q,t);s.language=q;if(s.keyword_count+s.r>r.keyword_count+r.r){r=s}if(s.keyword_count+s.r>p.keyword_count+p.r){r=p;p=s}}if(r.language){p.second_best=r}return p}function i(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"<br>")}return r}function n(t,w,r){var x=h(t,r);var v=a(t);var y,s;if(v=="no-highlight"){return}if(v){y=d(v,x)}else{y=g(x);v=y.language}var q=c(t);if(q.length){s=document.createElement("pre");s.innerHTML=y.value;y.value=k(q,c(s),x)}y.value=i(y.value,w,r);var u=t.className;if(!u.match("(\\s|^)(language-)?"+v+"(\\s|$)")){u=u?(u+" "+v):v}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){s=t.parentNode;var p=document.createElement("div");p.innerHTML="<pre><code>"+y.value+"</code></pre>";t=p.firstChild.firstChild;p.firstChild.cN=s.cN;s.parentNode.replaceChild(p.firstChild,s)}else{t.innerHTML=y.value}t.className=u;t.result={language:v,kw:y.keyword_count,re:y.r};if(y.second_best){t.second_best={language:y.second_best.language,kw:y.second_best.keyword_count,re:y.second_best.r}}}function o(){if(o.called){return}o.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p<r.length;p++){var q=b(r[p]);if(q){n(q,hljs.tabReplace)}}}function l(){if(window.addEventListener){window.addEventListener("DOMContentLoaded",o,false);window.addEventListener("load",o,false)}else{if(window.attachEvent){window.attachEvent("onload",o)}else{window.onload=o}}}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=n;this.initHighlighting=o;this.initHighlightingOnLoad=l;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="\\b(0[xX][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(r,s){var p={};for(var q in r){p[q]=r[q]}if(s){for(var q in s){p[q]=s[q]}}return p}}();hljs.LANGUAGES.bash=function(){var e={"true":1,"false":1};var b={cN:"variable",b:"\\$([a-zA-Z0-9_]+)\\b"};var a={cN:"variable",b:"\\$\\{(([^}])|(\\\\}))+\\}",c:[hljs.CNM]};var f={cN:"string",b:'"',e:'"',i:"\\n",c:[hljs.BE,b,a],r:0};var c={cN:"string",b:"'",e:"'",r:0};var d={cN:"test_condition",b:"",e:"",c:[f,c,b,a,hljs.CNM],k:{literal:e},r:0};return{dM:{k:{keyword:{"if":1,then:1,"else":1,fi:1,"for":1,"break":1,"continue":1,"while":1,"in":1,"do":1,done:1,echo:1,exit:1,"return":1,set:1,declare:1},literal:e},c:[{cN:"shebang",b:"(#!\\/bin\\/bash)|(#!\\/bin\\/sh)",r:10},b,a,hljs.HCM,hljs.CNM,f,c,hljs.inherit(d,{b:"\\[ ",e:" \\]",r:0}),hljs.inherit(d,{b:"\\[\\[ ",e:" \\]\\]"})]}}}();hljs.LANGUAGES.ini={cI:true,dM:{i:"[^\\s]",c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9_\\[\\]]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:{on:1,off:1,"true":1,"false":1,yes:1,no:1},c:[hljs.QSM,hljs.NM]}]}]}};hljs.LANGUAGES.python=function(){var a=[{cN:"string",b:"(u|b)?r?'''",e:"'''",r:10},{cN:"string",b:'(u|b)?r?"""',e:'"""',r:10},{cN:"string",b:"(u|r|ur)'",e:"'",c:[hljs.BE],r:10},{cN:"string",b:'(u|r|ur)"',e:'"',c:[hljs.BE],r:10},{cN:"string",b:"(b|br)'",e:"'",c:[hljs.BE]},{cN:"string",b:'(b|br)"',e:'"',c:[hljs.BE]}].concat([hljs.ASM,hljs.QSM]);var c={cN:"title",b:hljs.UIR};var b={cN:"params",b:"\\(",e:"\\)",c:a.concat([hljs.CNM])};return{dM:{k:{keyword:{and:1,elif:1,is:1,global:1,as:1,"in":1,"if":1,from:1,raise:1,"for":1,except:1,"finally":1,print:1,"import":1,pass:1,"return":1,exec:1,"else":1,"break":1,not:1,"with":1,"class":1,assert:1,yield:1,"try":1,"while":1,"continue":1,del:1,or:1,def:1,lambda:1,nonlocal:10},built_in:{None:1,True:1,False:1,Ellipsis:1,NotImplemented:1}},i:"(</|->|\\?)",c:a.concat([hljs.HCM,{cN:"function",b:"\\bdef ",e:":",i:"$",k:{def:1},c:[c,b],r:10},{cN:"class",b:"\\bclass ",e:":",i:"[${]",k:{"class":1},c:[c,b],r:10},hljs.CNM,{cN:"decorator",b:"@",e:"$"}])}}}();hljs.LANGUAGES.java={dM:{k:{"false":1,"synchronized":1,"int":1,"abstract":1,"float":1,"private":1,"char":1,"interface":1,"boolean":1,"static":1,"null":1,"if":1,"const":1,"for":1,"true":1,"while":1,"long":1,"throw":1,strictfp:1,"finally":1,"protected":1,"extends":1,"import":1,"native":1,"final":1,"implements":1,"return":1,"void":1,"enum":1,"else":1,"break":1,"transient":1,"new":1,"catch":1,"instanceof":1,"byte":1,"super":1,"class":1,"volatile":1,"case":1,assert:1,"short":1,"package":1,"default":1,"double":1,"public":1,"try":1,"this":1,"switch":1,"continue":1,"throws":1},c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},hljs.CLCM,hljs.CBLCLM,hljs.ASM,hljs.QSM,{cN:"class",b:"(class |interface )",e:"{",k:{"class":1,"interface":1},i:":",c:[{b:"(implements|extends)",k:{"extends":1,"implements":1},r:10},{cN:"title",b:hljs.UIR}]},hljs.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}};hljs.LANGUAGES.cs={dM:{k:{"abstract":1,as:1,base:1,bool:1,"break":1,"byte":1,"case":1,"catch":1,"char":1,checked:1,"class":1,"const":1,"continue":1,decimal:1,"default":1,delegate:1,"do":1,"double":1,"else":1,"enum":1,event:1,explicit:1,extern:1,"false":1,"finally":1,fixed:1,"float":1,"for":1,foreach:1,"goto":1,"if":1,implicit:1,"in":1,"int":1,"interface":1,internal:1,is:1,lock:1,"long":1,namespace:1,"new":1,"null":1,object:1,operator:1,out:1,override:1,params:1,"private":1,"protected":1,"public":1,readonly:1,ref:1,"return":1,sbyte:1,sealed:1,"short":1,sizeof:1,stackalloc:1,"static":1,string:1,struct:1,"switch":1,"this":1,"throw":1,"true":1,"try":1,"typeof":1,uint:1,ulong:1,unchecked:1,unsafe:1,ushort:1,using:1,virtual:1,"volatile":1,"void":1,"while":1,ascending:1,descending:1,from:1,get:1,group:1,into:1,join:1,let:1,orderby:1,partial:1,select:1,set:1,value:1,"var":1,where:1,yield:1},c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},hljs.CLCM,hljs.CBLCLM,{cN:"preprocessor",b:"#",e:"$",k:{"if":1,"else":1,elif:1,endif:1,define:1,undef:1,warning:1,error:1,line:1,region:1,endregion:1,pragma:1,checksum:1}},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},hljs.ASM,hljs.QSM,hljs.CNM]}};hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},a]}]}}}();hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:{"font-face":1,page:1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",c:[{b:"\\\\/"}]}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.cpp=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1,restrict:1,_Bool:1,complex:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};return{dM:{k:a,i:"</",c:[hljs.CLCM,hljs.CBLCLM,hljs.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},hljs.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:a,r:10,c:["self"]}]}}}();hljs.LANGUAGES.perl=function(){var d={getpwent:1,getservent:1,quotemeta:1,msgrcv:1,scalar:1,kill:1,dbmclose:1,undef:1,lc:1,ma:1,syswrite:1,tr:1,send:1,umask:1,sysopen:1,shmwrite:1,vec:1,qx:1,utime:1,local:1,oct:1,semctl:1,localtime:1,readpipe:1,"do":1,"return":1,format:1,read:1,sprintf:1,dbmopen:1,pop:1,getpgrp:1,not:1,getpwnam:1,rewinddir:1,qq:1,fileno:1,qw:1,endprotoent:1,wait:1,sethostent:1,bless:1,s:1,opendir:1,"continue":1,each:1,sleep:1,endgrent:1,shutdown:1,dump:1,chomp:1,connect:1,getsockname:1,die:1,socketpair:1,close:1,flock:1,exists:1,index:1,shmget:1,sub:1,"for":1,endpwent:1,redo:1,lstat:1,msgctl:1,setpgrp:1,abs:1,exit:1,select:1,print:1,ref:1,gethostbyaddr:1,unshift:1,fcntl:1,syscall:1,"goto":1,getnetbyaddr:1,join:1,gmtime:1,symlink:1,semget:1,splice:1,x:1,getpeername:1,recv:1,log:1,setsockopt:1,cos:1,last:1,reverse:1,gethostbyname:1,getgrnam:1,study:1,formline:1,endhostent:1,times:1,chop:1,length:1,gethostent:1,getnetent:1,pack:1,getprotoent:1,getservbyname:1,rand:1,mkdir:1,pos:1,chmod:1,y:1,substr:1,endnetent:1,printf:1,next:1,open:1,msgsnd:1,readdir:1,use:1,unlink:1,getsockopt:1,getpriority:1,rindex:1,wantarray:1,hex:1,system:1,getservbyport:1,endservent:1,"int":1,chr:1,untie:1,rmdir:1,prototype:1,tell:1,listen:1,fork:1,shmread:1,ucfirst:1,setprotoent:1,"else":1,sysseek:1,link:1,getgrgid:1,shmctl:1,waitpid:1,unpack:1,getnetbyname:1,reset:1,chdir:1,grep:1,split:1,require:1,caller:1,lcfirst:1,until:1,warn:1,"while":1,values:1,shift:1,telldir:1,getpwuid:1,my:1,getprotobynumber:1,"delete":1,and:1,sort:1,uc:1,defined:1,srand:1,accept:1,"package":1,seekdir:1,getprotobyname:1,semop:1,our:1,rename:1,seek:1,"if":1,q:1,chroot:1,sysread:1,setpwent:1,no:1,crypt:1,getc:1,chown:1,sqrt:1,write:1,setnetent:1,setpriority:1,foreach:1,tie:1,sin:1,msgget:1,map:1,stat:1,getlogin:1,unless:1,elsif:1,truncate:1,exec:1,keys:1,glob:1,tied:1,closedir:1,ioctl:1,socket:1,readlink:1,"eval":1,xor:1,readline:1,binmode:1,setservent:1,eof:1,ord:1,bind:1,alarm:1,pipe:1,atan2:1,getgrent:1,exp:1,time:1,push:1,setgrent:1,gt:1,lt:1,or:1,ne:1,m:1};var f={cN:"subst",b:"[$@]\\{",e:"\\}",k:d,r:10};var c={cN:"variable",b:"\\$\\d"};var b={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var h=[hljs.BE,f,c,b];var g={b:"->",c:[{b:hljs.IR},{b:"{",e:"}"}]};var e={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var a=[c,b,hljs.HCM,e,g,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:h,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:h,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:h,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:h,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:h,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:h,r:5},{cN:"string",b:"'",e:"'",c:[hljs.BE],r:0},{cN:"string",b:'"',e:'"',c:h,r:0},{cN:"string",b:"`",e:"`",c:[hljs.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"("+hljs.RSR+"|split|return|print|reverse|grep)\\s*",k:{split:1,"return":1,print:1,reverse:1,grep:1},r:0,c:[hljs.HCM,e,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[hljs.BE],r:0}]},{cN:"sub",b:"\\bsub\\b",e:"(\\s*\\(.*?\\))?[;{]",k:{sub:1},r:5},{cN:"operator",b:"-\\w\\b",r:0},{cN:"pod",b:"\\=\\w",e:"\\=cut"}];f.c=a;g.c[1].c=a;return{dM:{k:d,c:a}}}();hljs.LANGUAGES.ruby=function(){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var f={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:f};var i=[hljs.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i,r:10},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i,r:10},{cN:"string",b:"%[qw]?{",e:"}",c:i,r:10},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10}];var h={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:a,k:f,c:[{cN:"title",b:j,l:a,k:f},{cN:"params",b:"\\(",e:"\\)",l:a,k:f}].concat(k)};var g={cN:"identifier",b:a,l:a,k:f,r:0};var e=k.concat(b.concat([{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([g]),r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},g,{b:"("+hljs.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}]),r:0}]));d.c=e;h.c[1].c=e;return{dM:{l:a,k:f,c:e}}}();hljs.LANGUAGES.sql={cI:true,dM:{i:"[^\\s]",c:[{cN:"operator",b:"(begin|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b",e:";|$",k:{keyword:{all:1,partial:1,global:1,month:1,current_timestamp:1,using:1,go:1,revoke:1,smallint:1,indicator:1,"end-exec":1,disconnect:1,zone:1,"with":1,character:1,assertion:1,to:1,add:1,current_user:1,usage:1,input:1,local:1,alter:1,match:1,collate:1,real:1,then:1,rollback:1,get:1,read:1,timestamp:1,session_user:1,not:1,integer:1,bit:1,unique:1,day:1,minute:1,desc:1,insert:1,execute:1,like:1,ilike:2,level:1,decimal:1,drop:1,"continue":1,isolation:1,found:1,where:1,constraints:1,domain:1,right:1,national:1,some:1,module:1,transaction:1,relative:1,second:1,connect:1,escape:1,close:1,system_user:1,"for":1,deferred:1,section:1,cast:1,current:1,sqlstate:1,allocate:1,intersect:1,deallocate:1,numeric:1,"public":1,preserve:1,full:1,"goto":1,initially:1,asc:1,no:1,key:1,output:1,collation:1,group:1,by:1,union:1,session:1,both:1,last:1,language:1,constraint:1,column:1,of:1,space:1,foreign:1,deferrable:1,prior:1,connection:1,unknown:1,action:1,commit:1,view:1,or:1,first:1,into:1,"float":1,year:1,primary:1,cascaded:1,except:1,restrict:1,set:1,references:1,names:1,table:1,outer:1,open:1,select:1,size:1,are:1,rows:1,from:1,prepare:1,distinct:1,leading:1,create:1,only:1,next:1,inner:1,authorization:1,schema:1,corresponding:1,option:1,declare:1,precision:1,immediate:1,"else":1,timezone_minute:1,external:1,varying:1,translation:1,"true":1,"case":1,exception:1,join:1,hour:1,"default":1,"double":1,scroll:1,value:1,cursor:1,descriptor:1,values:1,dec:1,fetch:1,procedure:1,"delete":1,and:1,"false":1,"int":1,is:1,describe:1,"char":1,as:1,at:1,"in":1,varchar:1,"null":1,trailing:1,any:1,absolute:1,current_time:1,end:1,grant:1,privileges:1,when:1,cross:1,check:1,write:1,current_date:1,pad:1,begin:1,temporary:1,exec:1,time:1,update:1,catalog:1,user:1,sql:1,date:1,on:1,identity:1,timezone_hour:1,natural:1,whenever:1,interval:1,work:1,order:1,cascade:1,diagnostics:1,nchar:1,having:1,left:1,call:1,"do":1,handler:1,load:1,replace:1,truncate:1,start:1,lock:1,show:1,pragma:1},aggregate:{count:1,sum:1,min:1,max:1,avg:1}},c:[{cN:"string",b:"'",e:"'",c:[hljs.BE,{b:"''"}],r:0},{cN:"string",b:'"',e:'"',c:[hljs.BE,{b:'""'}],r:0},{cN:"string",b:"`",e:"`",c:[hljs.BE]},hljs.CNM,{b:"\\n"}]},hljs.CBLCLM,{cN:"comment",b:"--",e:"$"}]}};hljs.LANGUAGES.php={cI:true,dM:{k:{and:1,include_once:1,list:1,"abstract":1,global:1,"private":1,echo:1,"interface":1,as:1,"static":1,endswitch:1,array:1,"null":1,"if":1,endwhile:1,or:1,"const":1,"for":1,endforeach:1,self:1,"var":1,"while":1,isset:1,"public":1,"protected":1,exit:1,foreach:1,"throw":1,elseif:1,"extends":1,include:1,__FILE__:1,empty:1,require_once:1,"function":1,"do":1,xor:1,"return":1,"implements":1,parent:1,clone:1,use:1,__CLASS__:1,__LINE__:1,"else":1,"break":1,print:1,"eval":1,"new":1,"catch":1,__METHOD__:1,"class":1,"case":1,exception:1,php_user_filter:1,"default":1,die:1,require:1,__FUNCTION__:1,enddeclare:1,"final":1,"try":1,"this":1,"switch":1,"continue":1,endfor:1,endif:1,declare:1,unset:1,"true":1,"false":1,namespace:1,trait:1,"goto":1,"instanceof":1,__DIR__:1,__NAMESPACE__:1,__halt_compiler:1},c:[hljs.CLCM,hljs.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",eB:true,b:"__halt_compiler[^;]+;",e:"[\\n\\r]$"},hljs.CNM,hljs.BNM,hljs.inherit(hljs.ASM,{i:null}),hljs.inherit(hljs.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[hljs.BE]},{cN:"string",b:"b'",e:"'",c:[hljs.BE]},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[hljs.BE]},{cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"}]}};hljs.LANGUAGES.diff={cI:true,dM:{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<html> | |
<head> | |
<style> | |
@import url(sunburst.css); | |
@import url(stack.css); | |
@import url(font-awesome.min.css); | |
@import url(style.css); | |
</style> | |
<script src="highlight.min.js"></script> | |
<script src="d3.v3.min.js"></script> | |
<script src="jq.js"></script> | |
<script src="charts.js"></script> | |
<script src="blur.js"></script> | |
</head> | |
<body> | |
<div id="slides"> | |
<!-- <svg> | |
<filter id="blur"> | |
<feGaussianBlur stdDeviation="2"/> | |
</filter> | |
</svg> --> | |
<section style="padding:0px;"> | |
<div style="position:relative;height:100%"> | |
<div id="examples" style="filter: url('#blur');-webkit-filter: blur(20px);"> | |
<div id="examples-deep"></div> | |
</div> | |
<div id="clicker" class="blurry" style="position:absolute;top:20px;left:20px;font-weight:500;"> | |
<p class="blah big blue" style="background-color:rgba(255,255,255,.2);border-radius:7px;padding:15px;display:inline-block">Pushing The Community Forward</p> | |
<p class="blah blue medium" style="background-color:rgba(255,255,255,.2);border-radius:7px;padding:15px;display:inline-block;margin-bottom:0px">Data Visualization Group in the Bay Area</p> | |
<p class="blah blue medium" style="background-color:rgba(255,255,255,.2);border-radius:7px;padding:15px;display:inline-block">d3.bayarea()</p> | |
</div> | |
</div> | |
</section> | |
<!-- TALKS --> | |
<section> | |
<p class="big blue">Combining Narrative, Model, and Information Visualization</p> | |
<p class="grey medium">Elijah Meeks</p> | |
<p class="mediumish"><i class="icon-twitter twitter"></i> @Elijah_Meeks </p> | |
</section> | |
<section> | |
<p class="big blue">Whatever Happened to “Augmenting Human Intellect”?</p> | |
<p class="grey medium">Scott Murray</p> | |
<p class="mediumish"><i class="icon-twitter twitter"></i> @alignedleft </p> | |
</section> | |
<!-- SPONSORS --> | |
<section style="background:white"> | |
<img src="stripe.svg"> | |
</section> | |
<section style="background:hsla(208, 51%, 50%, 1)"> | |
<img src="bluenose.svg" style="margin-top:200px" width="100%"> | |
</section> | |
<!-- CONFERENCE ANNOUNCEMENT --> | |
<section style="padding:0px;"> | |
<iframe src="http://visfest.com/d3unconf/"></iframe> | |
</section> | |
</div> | |
<script src="stack.v0.min.js"></script> | |
<script src="d3.v3.min.js"></script> | |
<script src="d3.hexbin.min.js"></script> | |
<script> | |
/* https://github.com/davidbau/seedrandom Copyright 2013 David Bau. */ | |
(function(a,b,c,d,e,f){function k(a){var b,c=a.length,e=this,f=0,g=e.i=e.j=0,h=e.S=[];for(c||(a=[c++]);d>f;)h[f]=f++;for(f=0;d>f;f++)h[f]=h[g=j&g+a[f%c]+(b=h[f])],h[g]=b;(e.g=function(a){for(var b,c=0,f=e.i,g=e.j,h=e.S;a--;)b=h[f=j&f+1],c=c*d+h[j&(h[f]=h[g=j&g+b])+(h[g]=b)];return e.i=f,e.j=g,c})(d)}function l(a,b){var e,c=[],d=(typeof a)[0];if(b&&"o"==d)for(e in a)try{c.push(l(a[e],b-1))}catch(f){}return c.length?c:"s"==d?a:a+"\0"}function m(a,b){for(var d,c=a+"",e=0;c.length>e;)b[j&e]=j&(d^=19*b[j&e])+c.charCodeAt(e++);return o(b)}function n(c){try{return a.crypto.getRandomValues(c=new Uint8Array(d)),o(c)}catch(e){return[+new Date,a,a.navigator.plugins,a.screen,o(b)]}}function o(a){return String.fromCharCode.apply(0,a)}var g=c.pow(d,e),h=c.pow(2,f),i=2*h,j=d-1;c.seedrandom=function(a,f){var j=[],p=m(l(f?[a,o(b)]:0 in arguments?a:n(),3),j),q=new k(j);return m(o(q.S),b),c.random=function(){for(var a=q.g(e),b=g,c=0;h>a;)a=(a+c)*d,b*=d,c=q.g(1);for(;a>=i;)a/=2,b/=2,c>>>=1;return(a+c)/b},p},m(c.random(),b)})(this,[],Math,256,6,52); | |
var data = [ | |
{title: "Reingold–Tilford Tree (Radial)", url: "http://bl.ocks.org/mbostock/4063550"}, | |
{title: "Factorisation Diagrams", url: "http://www.jasondavies.com/factorisation-diagrams/"}, | |
{title: "Phylogenetic Tree of Life", url: "http://www.jasondavies.com/tree-of-life/"}, | |
{title: "Geographic Clipping", url: "http://www.jasondavies.com/maps/clip/"}, | |
{title: "Les Misérables Co-occurrence Matrix", url: "http://bost.ocks.org/mike/miserables/"}, | |
{title: "L*a*b* and HCL color spaces", url: "http://bl.ocks.org/mbostock/3014589"}, | |
{title: "Treemap", url: "http://bl.ocks.org/mbostock/4063582"}, | |
{title: "Map Projection Transitions", url: "http://www.jasondavies.com/maps/transition/"}, | |
{title: "Across U.S. Companies, Tax Rates Vary Greatly", url: "http://www.nytimes.com/interactive/2013/05/25/sunday-review/corporate-taxes.html"}, | |
{title: "Rotating Voronoi", url: "http://bl.ocks.org/mbostock/4636377"}, | |
{title: "Zoomable Geography", url: "http://bl.ocks.org/mbostock/2374239"}, | |
{title: "Fisheye Distortion", url: "http://bost.ocks.org/mike/fisheye/"}, | |
{title: "Geodesic Rainbow", url: "http://bl.ocks.org/mbostock/3057239"}, | |
{title: "Hierarchical Bar Chart", url: "http://bl.ocks.org/mbostock/1283663"}, | |
{title: "Exoplanets", url: "http://bl.ocks.org/mbostock/3007180"}, | |
{title: "Crossfilter", url: "http://square.github.io/crossfilter/"}, | |
{title: "Alaska’s villages on the frontline of climate change", url: "http://www.guardian.co.uk/environment/interactive/2013/may/14/alaska-villages-frontline-global-warming"}, | |
{title: "The federal health-care exchange’s abysmal success rate", url: "http://www.washingtonpost.com/wp-srv/special/politics/state-vs-federal-exchanges/"}, | |
{title: "Counties Blue and Red, Moving Right and Left", url: "http://www.nytimes.com/interactive/2012/11/11/sunday-review/counties-moving.html"}, | |
{title: "At the National Conventions, the Words They Used", url: "http://www.nytimes.com/interactive/2012/09/06/us/politics/convention-word-counts.html"}, | |
{title: "Reprojected Raster Tiles", url: "http://www.jasondavies.com/maps/raster/"}, | |
{title: "Hive Plots", url: "http://bost.ocks.org/mike/hive/"}, | |
{title: "Donut Transitions", url: "http://bl.ocks.org/mbostock/4341417"}, | |
{title: "Non-Contiguous Cartogram", url: "http://bl.ocks.org/mbostock/4055908"}, | |
{title: "Spermatozoa", url: "http://bl.ocks.org/mbostock/1136236"}, | |
{title: "Zoomable Circle Packing", url: "http://bl.ocks.org/mbostock/7607535"}, | |
{title: "Transform Transitions", url: "http://bl.ocks.org/mbostock/1345853"}, | |
{title: "Scatterplot Matrix", url: "http://bl.ocks.org/mbostock/3213173"}, | |
{title: "Janet L. Yellen, on the Economy’s Twists and Turns", url: "http://www.nytimes.com/interactive/2013/10/09/us/yellen-fed-chart.html"}, | |
{title: "Front Row to Fashion Week", url: "http://www.nytimes.com/newsgraphics/2013/09/13/fashion-week-editors-picks/"}, | |
{title: "Interrupted Sinu-Mollweide", url: "http://bl.ocks.org/mbostock/4481520"}, | |
{title: "Streamgraph", url: "http://bl.ocks.org/mbostock/4060954"}, | |
{title: "Force-Directed Graph", url: "http://bl.ocks.org/mbostock/4062045"}, | |
{title: "Zoomable Icicle", url: "http://bl.ocks.org/mbostock/1005873"}, | |
{title: "Collision Detection", url: "http://bl.ocks.org/mbostock/3231298"}, | |
{title: "Waterman Butterfly", url: "http://bl.ocks.org/mbostock/4458497"}, | |
{title: "Airocean World", url: "http://www.jasondavies.com/maps/airocean/"}, | |
{title: "Countries by Area", url: "http://www.jasondavies.com/maps/countries-by-area/"}, | |
{title: "Bilevel Partition", url: "http://bl.ocks.org/mbostock/5944371"}, | |
{title: "Map Zooming", url: "http://bl.ocks.org/mbostock/6242308"}, | |
{title: "Fisher–Yates Shuffle", url: "http://bost.ocks.org/mike/shuffle/"}, | |
{title: "Sphere Spirals", url: "http://www.jasondavies.com/maps/sphere-spirals/"}, | |
{title: "World Tour", url: "http://bl.ocks.org/mbostock/4183330"}, | |
{title: "Zoomable Treemaps", url: "http://bost.ocks.org/mike/treemap/"}, | |
{title: "Clipped Map Tiles", url: "http://bl.ocks.org/mbostock/4150951"}, | |
{title: "Cubism.js", url: "http://square.github.io/cubism/"}, | |
{title: "Voronoi Labels", url: "http://bl.ocks.org/mbostock/6909318"}, | |
{title: "Bivariate Hexbin Map", url: "http://bl.ocks.org/mbostock/4330486"}, | |
{title: "OMG Particles!", url: "http://bl.ocks.org/mbostock/1062544"}, | |
{title: "Calendar View", url: "http://bl.ocks.org/mbostock/4063318"}, | |
{title: "The Wealth & Health of Nations", url: "http://bost.ocks.org/mike/nations/"}, | |
{title: "Collapsible Tree", url: "http://bl.ocks.org/mbostock/4339083"}, | |
{title: "Hexagonal Binning", url: "http://bl.ocks.org/mbostock/4248145"}, | |
{title: "Over the Decades, How States Have Shifted", url: "http://www.nytimes.com/interactive/2012/10/15/us/politics/swing-history.html"}, | |
{title: "China Still Dominates, but Some Manufacturers Look Elsewhere", url: "http://www.nytimes.com/interactive/2013/04/08/business/global/asia-map.html"}, | |
{title: "Strikeouts on the Rise", url: "http://www.nytimes.com/interactive/2013/03/29/sports/baseball/Strikeouts-Are-Still-Soaring.html?ref=baseball"}, | |
{title: "Epicyclic Gearing", url: "http://bl.ocks.org/mbostock/1353700"}, | |
{title: "Voronoi Tessellation", url: "http://bl.ocks.org/mbostock/4060366"}, | |
{title: "The state of our union is … dumber", url: "http://www.guardian.co.uk/world/interactive/2013/feb/12/state-of-the-union-reading-level"}, | |
{title: "Chord Diagram", url: "http://bl.ocks.org/mbostock/1046712"}, | |
{title: "Floating Landmasses", url: "http://bl.ocks.org/mbostock/6738360"}, | |
{title: "How the Tax Burden Has Changed", url: "http://www.nytimes.com/interactive/2012/11/30/us/tax-burden.html"}, | |
{title: "Prime Number Patterns", url: "http://www.jasondavies.com/primos/"}, | |
{title: "Koalas to the Max", url: "http://www.koalastothemax.com/"}, | |
{title: "Constellations of Directors and Their Stars", url: "http://www.nytimes.com/newsgraphics/2013/09/07/director-star-chart/"}, | |
{title: "Drought and Deluge in the Lower 48", url: "http://www.nytimes.com/interactive/2012/08/11/sunday-review/drought-history.html"}, | |
{title: "Animated Bézier Curves", url: "http://www.jasondavies.com/animated-bezier/"}, | |
{title: "Histogram", url: "http://bl.ocks.org/mbostock/3048450"}, | |
{title: "Stacked-to-Grouped Bars", url: "http://bl.ocks.org/mbostock/3943967"}, | |
{title: "Force-Directed States of America", url: "http://bl.ocks.org/mbostock/1073373"}, | |
{title: "Faux-3D Arcs", url: "http://bl.ocks.org/dwtkns/4973620"}, | |
{title: "512 Paths to the White House", url: "http://www.nytimes.com/interactive/2012/11/02/us/politics/paths-to-the-white-house.html"}, | |
{title: "Polar Clock", url: "http://bl.ocks.org/mbostock/1096355"}, | |
{title: "Population Pyramid", url: "http://bl.ocks.org/mbostock/4062085"}, | |
{title: "The America’s Cup Finale: Oracle’s Path to Victory", url: "http://www.nytimes.com/interactive/2013/09/25/sports/americas-cup-course.html"}, | |
{title: "Rainbow Worm", url: "http://bl.ocks.org/mbostock/4165404"}, | |
{title: "Four Ways to Slice Obama’s 2013 Budget Proposal", url: "http://www.nytimes.com/interactive/2012/02/13/us/politics/2013-budget-proposal-graphic.html"}, | |
{title: "Quadtree", url: "http://bl.ocks.org/mbostock/4343214"}, | |
{title: "Bubble Chart", url: "http://bl.ocks.org/mbostock/4063269"}, | |
{title: "Women as Academic Authors, 1665-2010", url: "http://chronicle.com/article/Woman-as-Academic-Authors/135192/"}, | |
{title: "Choropleth", url: "http://bl.ocks.org/mbostock/4060606"}, | |
{title: "Gilbert’s Two-World Perspective", url: "http://www.jasondavies.com/maps/gilbert/"}, | |
{title: "For Eli Manning, 150 Games and Counting", url: "http://www.nytimes.com/newsgraphics/2013/09/28/eli-manning-milestone/"}, | |
{title: "Word Tree", url: "http://www.jasondavies.com/wordtree/"}, | |
{title: "Mobile Patent Suits", url: "http://bl.ocks.org/mbostock/1153292"}, | |
{title: "Mitchell’s Best-Candidate", url: "http://bl.ocks.org/mbostock/1893974"}, | |
{title: "Sankey Diagrams", url: "http://bost.ocks.org/mike/sankey/"}, | |
{title: "van Wijk Smooth Zooming", url: "http://bl.ocks.org/mbostock/3828981"}, | |
{title: "Bryce Harper: A swing of beauty", url: "http://www.washingtonpost.com/wp-srv/special/sports/bryce-harper-swing-of-beauty/"}, | |
{title: "Dissecting a Trailer: The Parts of the Film That Make the Cut", url: "http://www.nytimes.com/interactive/2013/02/19/movies/awardsseason/oscar-trailers.html"}, | |
{title: "Violence and guns in best-selling video games", url: "http://www.guardian.co.uk/world/interactive/2013/apr/30/violence-guns-best-selling-video-games"}, | |
{title: "Hierarchical Edge Bundling", url: "http://bl.ocks.org/mbostock/1044242"}, | |
{title: "Geographic Bounding Boxes", url: "http://www.jasondavies.com/maps/bounds/"}, | |
{title: "Live Results: Massachusetts Senate Special Election", url: "http://elections.huffingtonpost.com/2013/massachusetts-senate-results"}, | |
{title: "Zoomable Map Tiles", url: "http://bl.ocks.org/mbostock/4132797"}, | |
{title: "D3 Show Reel", url: "http://bl.ocks.org/mbostock/1256572"}, | |
{title: "Building Hamiltonian Graphs from LCF Notation", url: "http://christophermanning.org/projects/building-cubic-hamiltonian-graphs-from-lcf-notation/"}, | |
{title: "Sequences sunburst", url: "http://bl.ocks.org/kerryrodden/7090426"}, | |
{title: "Azimuth and Distance from London", url: "http://www.jasondavies.com/maps/azimuth-distance/"}, | |
{title: "Parallel Sets", url: "http://www.jasondavies.com/parallel-sets/"} | |
]; | |
data.forEach(function(d, i) { | |
d.i = i % 10; | |
d.j = i / 10 | 0; | |
}); | |
Math.seedrandom(+d3.time.hour(new Date)); | |
d3.shuffle(data); | |
var height = 2000, | |
imageWidth = 132, | |
imageHeight = 152, | |
radius = 75, | |
depth = 4; | |
var currentFocus = [innerWidth / 2, height / 2], | |
desiredFocus, | |
idle = true; | |
var style = document.body.style, | |
transform = ("webkitTransform" in style ? "-webkit-" | |
: "MozTransform" in style ? "-moz-" | |
: "msTransform" in style ? "-ms-" | |
: "OTransform" in style ? "-o-" | |
: "") + "transform"; | |
var hexbin = d3.hexbin() | |
.radius(radius); | |
if (!("ontouchstart" in document)) d3.select("#examples") | |
.on("mousemove", mousemoved); | |
var deep = d3.select("#examples-deep"); | |
var canvas = deep.append("canvas") | |
.attr("height", height); | |
var context = canvas.node().getContext("2d"); | |
var svg = deep.append("svg") | |
.attr("height", height); | |
var mesh = svg.append("path") | |
.attr("class", "example-mesh"); | |
var anchor = svg.append("g") | |
.attr("class", "example-anchor") | |
.selectAll("a"); | |
var graphic = deep.selectAll("svg,canvas"); | |
var image = new Image; | |
image.src = "http://d3js.org/ex.jpg?3f2d00ffdba6ced9c50f02ed42f12f6156368bd2"; | |
image.onload = resized; | |
d3.select(window) | |
.on("resize", resized) | |
.each(resized); | |
function drawImage(d) { | |
context.save(); | |
context.beginPath(); | |
context.moveTo(0, -radius); | |
for (var i = 1; i < 6; ++i) { | |
var angle = i * Math.PI / 3, | |
x = Math.sin(angle) * radius, | |
y = -Math.cos(angle) * radius; | |
context.lineTo(x, y); | |
} | |
context.clip(); | |
context.drawImage(image, | |
imageWidth * d.i, imageHeight * d.j, | |
imageWidth, imageHeight, | |
-imageWidth / 2, -imageHeight / 2, | |
imageWidth, imageHeight); | |
context.restore(); | |
} | |
function resized() { | |
var deepWidth = innerWidth * (depth + 1) / depth, | |
deepHeight = height * (depth + 1) / depth, | |
centers = hexbin.size([deepWidth, deepHeight]).centers(); | |
desiredFocus = [innerWidth / 2, height / 2]; | |
moved(); | |
graphic | |
.style("left", Math.round((innerWidth - deepWidth) / 2) + "px") | |
.style("top", Math.round((height - deepHeight) / 2) + "px") | |
.attr("width", deepWidth) | |
.attr("height", deepHeight); | |
centers.forEach(function(center, i) { | |
center.j = Math.round(center[1] / (radius * 1.5)); | |
center.i = Math.round((center[0] - (center.j & 1) * radius * Math.sin(Math.PI / 3)) / (radius * 2 * Math.sin(Math.PI / 3))); | |
context.save(); | |
context.translate(Math.round(center[0]), Math.round(center[1])); | |
drawImage(center.example = data[(center.i % 10) + ((center.j + (center.i / 10 & 1) * 5) % 10) * 10]); | |
context.restore(); | |
}); | |
mesh.attr("d", hexbin.mesh); | |
anchor = anchor.data(centers, function(d) { return d.i + "," + d.j; }); | |
anchor.exit().remove(); | |
anchor.enter().append("a") | |
.attr("xlink:href", function(d) { return d.example.url; }) | |
.attr("xlink:title", function(d) { return d.example.title; }) | |
.append("path") | |
.attr("d", hexbin.hexagon()); | |
anchor | |
.attr("transform", function(d) { return "translate(" + d + ")"; }); | |
} | |
function mousemoved() { | |
var m = d3.mouse(this); | |
desiredFocus = [ | |
Math.round((m[0] - innerWidth / 2) / depth) * depth + innerWidth / 2, | |
Math.round((m[1] - height / 2) / depth) * depth + height / 2 | |
]; | |
moved(); | |
} | |
function moved() { | |
if (idle) d3.timer(function() { | |
if (idle = Math.abs(desiredFocus[0] - currentFocus[0]) < .5 && Math.abs(desiredFocus[1] - currentFocus[1]) < .5) currentFocus = desiredFocus; | |
else currentFocus[0] += (desiredFocus[0] - currentFocus[0]) * .14, currentFocus[1] += (desiredFocus[1] - currentFocus[1]) * .14; | |
deep.style(transform, "translate(" + (innerWidth / 2 - currentFocus[0]) / depth + "px," + (height / 2 - currentFocus[1]) / depth + "px)"); | |
return idle; | |
}); | |
} | |
var blah = false; | |
d3.select("#clicker").on('click', function() { | |
console.log('clicking'); | |
if (!blah) { | |
blah = true; | |
d3.select("#examples").transition().duration(1000).style('-webkit-filter', 'blur(0px)'); | |
d3.selectAll(".blah").transition().duration(1000).style('background', 'rgba(255,255,255,1)'); | |
} else { | |
blah = false; | |
d3.select("#examples").transition().duration(1000).style('-webkit-filter', 'blur(20px)'); | |
d3.selectAll(".blah").transition().duration(1000).style('background', 'rgba(255,255,255,.2)'); | |
} | |
}); | |
function styleTween(transition, name, value) { | |
transition.styleTween(name, function() { | |
return d3.interpolate(this.style[name], value); | |
}); | |
} | |
</script> | |
</body> | |
</html> |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* jQuery JavaScript Library v1.11.0 | |
* http://jquery.com/ | |
* | |
* Includes Sizzle.js | |
* http://sizzlejs.com/ | |
* | |
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors | |
* Released under the MIT license | |
* http://jquery.org/license | |
* | |
* Date: 2014-01-23T21:02Z | |
*/ | |
(function( global, factory ) { | |
if ( typeof module === "object" && typeof module.exports === "object" ) { | |
// For CommonJS and CommonJS-like environments where a proper window is present, | |
// execute the factory and get jQuery | |
// For environments that do not inherently posses a window with a document | |
// (such as Node.js), expose a jQuery-making factory as module.exports | |
// This accentuates the need for the creation of a real window | |
// e.g. var jQuery = require("jquery")(window); | |
// See ticket #14549 for more info | |
module.exports = global.document ? | |
factory( global, true ) : | |
function( w ) { | |
if ( !w.document ) { | |
throw new Error( "jQuery requires a window with a document" ); | |
} | |
return factory( w ); | |
}; | |
} else { | |
factory( global ); | |
} | |
// Pass this if window is not defined yet | |
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { | |
// Can't do this because several apps including ASP.NET trace | |
// the stack via arguments.caller.callee and Firefox dies if | |
// you try to trace through "use strict" call chains. (#13335) | |
// Support: Firefox 18+ | |
// | |
var deletedIds = []; | |
var slice = deletedIds.slice; | |
var concat = deletedIds.concat; | |
var push = deletedIds.push; | |
var indexOf = deletedIds.indexOf; | |
var class2type = {}; | |
var toString = class2type.toString; | |
var hasOwn = class2type.hasOwnProperty; | |
var trim = "".trim; | |
var support = {}; | |
var | |
version = "1.11.0", | |
// Define a local copy of jQuery | |
jQuery = function( selector, context ) { | |
// The jQuery object is actually just the init constructor 'enhanced' | |
// Need init if jQuery is called (just allow error to be thrown if not included) | |
return new jQuery.fn.init( selector, context ); | |
}, | |
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) | |
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | |
// Matches dashed string for camelizing | |
rmsPrefix = /^-ms-/, | |
rdashAlpha = /-([\da-z])/gi, | |
// Used by jQuery.camelCase as callback to replace() | |
fcamelCase = function( all, letter ) { | |
return letter.toUpperCase(); | |
}; | |
jQuery.fn = jQuery.prototype = { | |
// The current version of jQuery being used | |
jquery: version, | |
constructor: jQuery, | |
// Start with an empty selector | |
selector: "", | |
// The default length of a jQuery object is 0 | |
length: 0, | |
toArray: function() { | |
return slice.call( this ); | |
}, | |
// Get the Nth element in the matched element set OR | |
// Get the whole matched element set as a clean array | |
get: function( num ) { | |
return num != null ? | |
// Return a 'clean' array | |
( num < 0 ? this[ num + this.length ] : this[ num ] ) : | |
// Return just the object | |
slice.call( this ); | |
}, | |
// Take an array of elements and push it onto the stack | |
// (returning the new matched element set) | |
pushStack: function( elems ) { | |
// Build a new jQuery matched element set | |
var ret = jQuery.merge( this.constructor(), elems ); | |
// Add the old object onto the stack (as a reference) | |
ret.prevObject = this; | |
ret.context = this.context; | |
// Return the newly-formed element set | |
return ret; | |
}, | |
// Execute a callback for every element in the matched set. | |
// (You can seed the arguments with an array of args, but this is | |
// only used internally.) | |
each: function( callback, args ) { | |
return jQuery.each( this, callback, args ); | |
}, | |
map: function( callback ) { | |
return this.pushStack( jQuery.map(this, function( elem, i ) { | |
return callback.call( elem, i, elem ); | |
})); | |
}, | |
slice: function() { | |
return this.pushStack( slice.apply( this, arguments ) ); | |
}, | |
first: function() { | |
return this.eq( 0 ); | |
}, | |
last: function() { | |
return this.eq( -1 ); | |
}, | |
eq: function( i ) { | |
var len = this.length, | |
j = +i + ( i < 0 ? len : 0 ); | |
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); | |
}, | |
end: function() { | |
return this.prevObject || this.constructor(null); | |
}, | |
// For internal use only. | |
// Behaves like an Array's method, not like a jQuery method. | |
push: push, | |
sort: deletedIds.sort, | |
splice: deletedIds.splice | |
}; | |
jQuery.extend = jQuery.fn.extend = function() { | |
var src, copyIsArray, copy, name, options, clone, | |
target = arguments[0] || {}, | |
i = 1, | |
length = arguments.length, | |
deep = false; | |
// Handle a deep copy situation | |
if ( typeof target === "boolean" ) { | |
deep = target; | |
// skip the boolean and the target | |
target = arguments[ i ] || {}; | |
i++; | |
} | |
// Handle case when target is a string or something (possible in deep copy) | |
if ( typeof target !== "object" && !jQuery.isFunction(target) ) { | |
target = {}; | |
} | |
// extend jQuery itself if only one argument is passed | |
if ( i === length ) { | |
target = this; | |
i--; | |
} | |
for ( ; i < length; i++ ) { | |
// Only deal with non-null/undefined values | |
if ( (options = arguments[ i ]) != null ) { | |
// Extend the base object | |
for ( name in options ) { | |
src = target[ name ]; | |
copy = options[ name ]; | |
// Prevent never-ending loop | |
if ( target === copy ) { | |
continue; | |
} | |
// Recurse if we're merging plain objects or arrays | |
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { | |
if ( copyIsArray ) { | |
copyIsArray = false; | |
clone = src && jQuery.isArray(src) ? src : []; | |
} else { | |
clone = src && jQuery.isPlainObject(src) ? src : {}; | |
} | |
// Never move original objects, clone them | |
target[ name ] = jQuery.extend( deep, clone, copy ); | |
// Don't bring in undefined values | |
} else if ( copy !== undefined ) { | |
target[ name ] = copy; | |
} | |
} | |
} | |
} | |
// Return the modified object | |
return target; | |
}; | |
jQuery.extend({ | |
// Unique for each copy of jQuery on the page | |
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), | |
// Assume jQuery is ready without the ready module | |
isReady: true, | |
error: function( msg ) { | |
throw new Error( msg ); | |
}, | |
noop: function() {}, | |
// See test/unit/core.js for details concerning isFunction. | |
// Since version 1.3, DOM methods and functions like alert | |
// aren't supported. They return false on IE (#2968). | |
isFunction: function( obj ) { | |
return jQuery.type(obj) === "function"; | |
}, | |
isArray: Array.isArray || function( obj ) { | |
return jQuery.type(obj) === "array"; | |
}, | |
isWindow: function( obj ) { | |
/* jshint eqeqeq: false */ | |
return obj != null && obj == obj.window; | |
}, | |
isNumeric: function( obj ) { | |
// parseFloat NaNs numeric-cast false positives (null|true|false|"") | |
// ...but misinterprets leading-number strings, particularly hex literals ("0x...") | |
// subtraction forces infinities to NaN | |
return obj - parseFloat( obj ) >= 0; | |
}, | |
isEmptyObject: function( obj ) { | |
var name; | |
for ( name in obj ) { | |
return false; | |
} | |
return true; | |
}, | |
isPlainObject: function( obj ) { | |
var key; | |
// Must be an Object. | |
// Because of IE, we also have to check the presence of the constructor property. | |
// Make sure that DOM nodes and window objects don't pass through, as well | |
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { | |
return false; | |
} | |
try { | |
// Not own constructor property must be Object | |
if ( obj.constructor && | |
!hasOwn.call(obj, "constructor") && | |
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { | |
return false; | |
} | |
} catch ( e ) { | |
// IE8,9 Will throw exceptions on certain host objects #9897 | |
return false; | |
} | |
// Support: IE<9 | |
// Handle iteration over inherited properties before own properties. | |
if ( support.ownLast ) { | |
for ( key in obj ) { | |
return hasOwn.call( obj, key ); | |
} | |
} | |
// Own properties are enumerated firstly, so to speed up, | |
// if last one is own, then all properties are own. | |
for ( key in obj ) {} | |
return key === undefined || hasOwn.call( obj, key ); | |
}, | |
type: function( obj ) { | |
if ( obj == null ) { | |
return obj + ""; | |
} | |
return typeof obj === "object" || typeof obj === "function" ? | |
class2type[ toString.call(obj) ] || "object" : | |
typeof obj; | |
}, | |
// Evaluates a script in a global context | |
// Workarounds based on findings by Jim Driscoll | |
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context | |
globalEval: function( data ) { | |
if ( data && jQuery.trim( data ) ) { | |
// We use execScript on Internet Explorer | |
// We use an anonymous function so that context is window | |
// rather than jQuery in Firefox | |
( window.execScript || function( data ) { | |
window[ "eval" ].call( window, data ); | |
} )( data ); | |
} | |
}, | |
// Convert dashed to camelCase; used by the css and data modules | |
// Microsoft forgot to hump their vendor prefix (#9572) | |
camelCase: function( string ) { | |
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); | |
}, | |
nodeName: function( elem, name ) { | |
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); | |
}, | |
// args is for internal usage only | |
each: function( obj, callback, args ) { | |
var value, | |
i = 0, | |
length = obj.length, | |
isArray = isArraylike( obj ); | |
if ( args ) { | |
if ( isArray ) { | |
for ( ; i < length; i++ ) { | |
value = callback.apply( obj[ i ], args ); | |
if ( value === false ) { | |
break; | |
} | |
} | |
} else { | |
for ( i in obj ) { | |
value = callback.apply( obj[ i ], args ); | |
if ( value === false ) { | |
break; | |
} | |
} | |
} | |
// A special, fast, case for the most common use of each | |
} else { | |
if ( isArray ) { | |
for ( ; i < length; i++ ) { | |
value = callback.call( obj[ i ], i, obj[ i ] ); | |
if ( value === false ) { | |
break; | |
} | |
} | |
} else { | |
for ( i in obj ) { | |
value = callback.call( obj[ i ], i, obj[ i ] ); | |
if ( value === false ) { | |
break; | |
} | |
} | |
} | |
} | |
return obj; | |
}, | |
// Use native String.trim function wherever possible | |
trim: trim && !trim.call("\uFEFF\xA0") ? | |
function( text ) { | |
return text == null ? | |
"" : | |
trim.call( text ); | |
} : | |
// Otherwise use our own trimming functionality | |
function( text ) { | |
return text == null ? | |
"" : | |
( text + "" ).replace( rtrim, "" ); | |
}, | |
// results is for internal usage only | |
makeArray: function( arr, results ) { | |
var ret = results || []; | |
if ( arr != null ) { | |
if ( isArraylike( Object(arr) ) ) { | |
jQuery.merge( ret, | |
typeof arr === "string" ? | |
[ arr ] : arr | |
); | |
} else { | |
push.call( ret, arr ); | |
} | |
} | |
return ret; | |
}, | |
inArray: function( elem, arr, i ) { | |
var len; | |
if ( arr ) { | |
if ( indexOf ) { | |
return indexOf.call( arr, elem, i ); | |
} | |
len = arr.length; | |
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; | |
for ( ; i < len; i++ ) { | |
// Skip accessing in sparse arrays | |
if ( i in arr && arr[ i ] === elem ) { | |
return i; | |
} | |
} | |
} | |
return -1; | |
}, | |
merge: function( first, second ) { | |
var len = +second.length, | |
j = 0, | |
i = first.length; | |
while ( j < len ) { | |
first[ i++ ] = second[ j++ ]; | |
} | |
// Support: IE<9 | |
// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) | |
if ( len !== len ) { | |
while ( second[j] !== undefined ) { | |
first[ i++ ] = second[ j++ ]; | |
} | |
} | |
first.length = i; | |
return first; | |
}, | |
grep: function( elems, callback, invert ) { | |
var callbackInverse, | |
matches = [], | |
i = 0, | |
length = elems.length, | |
callbackExpect = !invert; | |
// Go through the array, only saving the items | |
// that pass the validator function | |
for ( ; i < length; i++ ) { | |
callbackInverse = !callback( elems[ i ], i ); | |
if ( callbackInverse !== callbackExpect ) { | |
matches.push( elems[ i ] ); | |
} | |
} | |
return matches; | |
}, | |
// arg is for internal usage only | |
map: function( elems, callback, arg ) { | |
var value, | |
i = 0, | |
length = elems.length, | |
isArray = isArraylike( elems ), | |
ret = []; | |
// Go through the array, translating each of the items to their new values | |
if ( isArray ) { | |
for ( ; i < length; i++ ) { | |
value = callback( elems[ i ], i, arg ); | |
if ( value != null ) { | |
ret.push( value ); | |
} | |
} | |
// Go through every key on the object, | |
} else { | |
for ( i in elems ) { | |
value = callback( elems[ i ], i, arg ); | |
if ( value != null ) { | |
ret.push( value ); | |
} | |
} | |
} | |
// Flatten any nested arrays | |
return concat.apply( [], ret ); | |
}, | |
// A global GUID counter for objects | |
guid: 1, | |
// Bind a function to a context, optionally partially applying any | |
// arguments. | |
proxy: function( fn, context ) { | |
var args, proxy, tmp; | |
if ( typeof context === "string" ) { | |
tmp = fn[ context ]; | |
context = fn; | |
fn = tmp; | |
} | |
// Quick check to determine if target is callable, in the spec | |
// this throws a TypeError, but we will just return undefined. | |
if ( !jQuery.isFunction( fn ) ) { | |
return undefined; | |
} | |
// Simulated bind | |
args = slice.call( arguments, 2 ); | |
proxy = function() { | |
return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); | |
}; | |
// Set the guid of unique handler to the same of original handler, so it can be removed | |
proxy.guid = fn.guid = fn.guid || jQuery.guid++; | |
return proxy; | |
}, | |
now: function() { | |
return +( new Date() ); | |
}, | |
// jQuery.support is not used in Core but other projects attach their | |
// properties to it so it needs to exist. | |
support: support | |
}); | |
// Populate the class2type map | |
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { | |
class2type[ "[object " + name + "]" ] = name.toLowerCase(); | |
}); | |
function isArraylike( obj ) { | |
var length = obj.length, | |
type = jQuery.type( obj ); | |
if ( type === "function" || jQuery.isWindow( obj ) ) { | |
return false; | |
} | |
if ( obj.nodeType === 1 && length ) { | |
return true; | |
} | |
return type === "array" || length === 0 || | |
typeof length === "number" && length > 0 && ( length - 1 ) in obj; | |
} | |
var Sizzle = | |
/*! | |
* Sizzle CSS Selector Engine v1.10.16 | |
* http://sizzlejs.com/ | |
* | |
* Copyright 2013 jQuery Foundation, Inc. and other contributors | |
* Released under the MIT license | |
* http://jquery.org/license | |
* | |
* Date: 2014-01-13 | |
*/ | |
(function( window ) { | |
var i, | |
support, | |
Expr, | |
getText, | |
isXML, | |
compile, | |
outermostContext, | |
sortInput, | |
hasDuplicate, | |
// Local document vars | |
setDocument, | |
document, | |
docElem, | |
documentIsHTML, | |
rbuggyQSA, | |
rbuggyMatches, | |
matches, | |
contains, | |
// Instance-specific data | |
expando = "sizzle" + -(new Date()), | |
preferredDoc = window.document, | |
dirruns = 0, | |
done = 0, | |
classCache = createCache(), | |
tokenCache = createCache(), | |
compilerCache = createCache(), | |
sortOrder = function( a, b ) { | |
if ( a === b ) { | |
hasDuplicate = true; | |
} | |
return 0; | |
}, | |
// General-purpose constants | |
strundefined = typeof undefined, | |
MAX_NEGATIVE = 1 << 31, | |
// Instance methods | |
hasOwn = ({}).hasOwnProperty, | |
arr = [], | |
pop = arr.pop, | |
push_native = arr.push, | |
push = arr.push, | |
slice = arr.slice, | |
// Use a stripped-down indexOf if we can't use a native one | |
indexOf = arr.indexOf || function( elem ) { | |
var i = 0, | |
len = this.length; | |
for ( ; i < len; i++ ) { | |
if ( this[i] === elem ) { | |
return i; | |
} | |
} | |
return -1; | |
}, | |
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", | |
// Regular expressions | |
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace | |
whitespace = "[\\x20\\t\\r\\n\\f]", | |
// http://www.w3.org/TR/css3-syntax/#characters | |
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", | |
// Loosely modeled on CSS identifier characters | |
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors | |
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier | |
identifier = characterEncoding.replace( "w", "w#" ), | |
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors | |
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + | |
"*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", | |
// Prefer arguments quoted, | |
// then not containing pseudos/brackets, | |
// then attribute selectors/non-parenthetical expressions, | |
// then anything else | |
// These preferences are here to reduce the number of selectors | |
// needing tokenize in the PSEUDO preFilter | |
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", | |
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter | |
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), | |
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), | |
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), | |
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), | |
rpseudo = new RegExp( pseudos ), | |
ridentifier = new RegExp( "^" + identifier + "$" ), | |
matchExpr = { | |
"ID": new RegExp( "^#(" + characterEncoding + ")" ), | |
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), | |
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), | |
"ATTR": new RegExp( "^" + attributes ), | |
"PSEUDO": new RegExp( "^" + pseudos ), | |
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + | |
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + | |
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ), | |
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ), | |
// For use in libraries implementing .is() | |
// We use this for POS matching in `select` | |
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + | |
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) | |
}, | |
rinputs = /^(?:input|select|textarea|button)$/i, | |
rheader = /^h\d$/i, | |
rnative = /^[^{]+\{\s*\[native \w/, | |
// Easily-parseable/retrievable ID or TAG or CLASS selectors | |
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | |
rsibling = /[+~]/, | |
rescape = /'|\\/g, | |
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters | |
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), | |
funescape = function( _, escaped, escapedWhitespace ) { | |
var high = "0x" + escaped - 0x10000; | |
// NaN means non-codepoint | |
// Support: Firefox | |
// Workaround erroneous numeric interpretation of +"0x" | |
return high !== high || escapedWhitespace ? | |
escaped : | |
high < 0 ? | |
// BMP codepoint | |
String.fromCharCode( high + 0x10000 ) : | |
// Supplemental Plane codepoint (surrogate pair) | |
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); | |
}; | |
// Optimize for push.apply( _, NodeList ) | |
try { | |
push.apply( | |
(arr = slice.call( preferredDoc.childNodes )), | |
preferredDoc.childNodes | |
); | |
// Support: Android<4.0 | |
// Detect silently failing push.apply | |
arr[ preferredDoc.childNodes.length ].nodeType; | |
} catch ( e ) { | |
push = { apply: arr.length ? | |
// Leverage slice if possible | |
function( target, els ) { | |
push_native.apply( target, slice.call(els) ); | |
} : | |
// Support: IE<9 | |
// Otherwise append directly | |
function( target, els ) { | |
var j = target.length, | |
i = 0; | |
// Can't trust NodeList.length | |
while ( (target[j++] = els[i++]) ) {} | |
target.length = j - 1; | |
} | |
}; | |
} | |
function Sizzle( selector, context, results, seed ) { | |
var match, elem, m, nodeType, | |
// QSA vars | |
i, groups, old, nid, newContext, newSelector; | |
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { | |
setDocument( context ); | |
} | |
context = context || document; | |
results = results || []; | |
if ( !selector || typeof selector !== "string" ) { | |
return results; | |
} | |
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { | |
return []; | |
} | |
if ( documentIsHTML && !seed ) { | |
// Shortcuts | |
if ( (match = rquickExpr.exec( selector )) ) { | |
// Speed-up: Sizzle("#ID") | |
if ( (m = match[1]) ) { | |
if ( nodeType === 9 ) { | |
elem = context.getElementById( m ); | |
// Check parentNode to catch when Blackberry 4.6 returns | |
// nodes that are no longer in the document (jQuery #6963) | |
if ( elem && elem.parentNode ) { | |
// Handle the case where IE, Opera, and Webkit return items | |
// by name instead of ID | |
if ( elem.id === m ) { | |
results.push( elem ); | |
return results; | |
} | |
} else { | |
return results; | |
} | |
} else { | |
// Context is not a document | |
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && | |
contains( context, elem ) && elem.id === m ) { | |
results.push( elem ); | |
return results; | |
} | |
} | |
// Speed-up: Sizzle("TAG") | |
} else if ( match[2] ) { | |
push.apply( results, context.getElementsByTagName( selector ) ); | |
return results; | |
// Speed-up: Sizzle(".CLASS") | |
} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { | |
push.apply( results, context.getElementsByClassName( m ) ); | |
return results; | |
} | |
} | |
// QSA path | |
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { | |
nid = old = expando; | |
newContext = context; | |
newSelector = nodeType === 9 && selector; | |
// qSA works strangely on Element-rooted queries | |
// We can work around this by specifying an extra ID on the root | |
// and working up from there (Thanks to Andrew Dupont for the technique) | |
// IE 8 doesn't work on object elements | |
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { | |
groups = tokenize( selector ); | |
if ( (old = context.getAttribute("id")) ) { | |
nid = old.replace( rescape, "\\$&" ); | |
} else { | |
context.setAttribute( "id", nid ); | |
} | |
nid = "[id='" + nid + "'] "; | |
i = groups.length; | |
while ( i-- ) { | |
groups[i] = nid + toSelector( groups[i] ); | |
} | |
newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; | |
newSelector = groups.join(","); | |
} | |
if ( newSelector ) { | |
try { | |
push.apply( results, | |
newContext.querySelectorAll( newSelector ) | |
); | |
return results; | |
} catch(qsaError) { | |
} finally { | |
if ( !old ) { | |
context.removeAttribute("id"); | |
} | |
} | |
} | |
} | |
} | |
// All others | |
return select( selector.replace( rtrim, "$1" ), context, results, seed ); | |
} | |
/** | |
* Create key-value caches of limited size | |
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with | |
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) | |
* deleting the oldest entry | |
*/ | |
function createCache() { | |
var keys = []; | |
function cache( key, value ) { | |
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157) | |
if ( keys.push( key + " " ) > Expr.cacheLength ) { | |
// Only keep the most recent entries | |
delete cache[ keys.shift() ]; | |
} | |
return (cache[ key + " " ] = value); | |
} | |
return cache; | |
} | |
/** | |
* Mark a function for special use by Sizzle | |
* @param {Function} fn The function to mark | |
*/ | |
function markFunction( fn ) { | |
fn[ expando ] = true; | |
return fn; | |
} | |
/** | |
* Support testing using an element | |
* @param {Function} fn Passed the created div and expects a boolean result | |
*/ | |
function assert( fn ) { | |
var div = document.createElement("div"); | |
try { | |
return !!fn( div ); | |
} catch (e) { | |
return false; | |
} finally { | |
// Remove from its parent by default | |
if ( div.parentNode ) { | |
div.parentNode.removeChild( div ); | |
} | |
// release memory in IE | |
div = null; | |
} | |
} | |
/** | |
* Adds the same handler for all of the specified attrs | |
* @param {String} attrs Pipe-separated list of attributes | |
* @param {Function} handler The method that will be applied | |
*/ | |
function addHandle( attrs, handler ) { | |
var arr = attrs.split("|"), | |
i = attrs.length; | |
while ( i-- ) { | |
Expr.attrHandle[ arr[i] ] = handler; | |
} | |
} | |
/** | |
* Checks document order of two siblings | |
* @param {Element} a | |
* @param {Element} b | |
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b | |
*/ | |
function siblingCheck( a, b ) { | |
var cur = b && a, | |
diff = cur && a.nodeType === 1 && b.nodeType === 1 && | |
( ~b.sourceIndex || MAX_NEGATIVE ) - | |
( ~a.sourceIndex || MAX_NEGATIVE ); | |
// Use IE sourceIndex if available on both nodes | |
if ( diff ) { | |
return diff; | |
} | |
// Check if b follows a | |
if ( cur ) { | |
while ( (cur = cur.nextSibling) ) { | |
if ( cur === b ) { | |
return -1; | |
} | |
} | |
} | |
return a ? 1 : -1; | |
} | |
/** | |
* Returns a function to use in pseudos for input types | |
* @param {String} type | |
*/ | |
function createInputPseudo( type ) { | |
return function( elem ) { | |
var name = elem.nodeName.toLowerCase(); | |
return name === "input" && elem.type === type; | |
}; | |
} | |
/** | |
* Returns a function to use in pseudos for buttons | |
* @param {String} type | |
*/ | |
function createButtonPseudo( type ) { | |
return function( elem ) { | |
var name = elem.nodeName.toLowerCase(); | |
return (name === "input" || name === "button") && elem.type === type; | |
}; | |
} | |
/** | |
* Returns a function to use in pseudos for positionals | |
* @param {Function} fn | |
*/ | |
function createPositionalPseudo( fn ) { | |
return markFunction(function( argument ) { | |
argument = +argument; | |
return markFunction(function( seed, matches ) { | |
var j, | |
matchIndexes = fn( [], seed.length, argument ), | |
i = matchIndexes.length; | |
// Match elements found at the specified indexes | |
while ( i-- ) { | |
if ( seed[ (j = matchIndexes[i]) ] ) { | |
seed[j] = !(matches[j] = seed[j]); | |
} | |
} | |
}); | |
}); | |
} | |
/** | |
* Checks a node for validity as a Sizzle context | |
* @param {Element|Object=} context | |
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value | |
*/ | |
function testContext( context ) { | |
return context && typeof context.getElementsByTagName !== strundefined && context; | |
} | |
// Expose support vars for convenience | |
support = Sizzle.support = {}; | |
/** | |
* Detects XML nodes | |
* @param {Element|Object} elem An element or a document | |
* @returns {Boolean} True iff elem is a non-HTML XML node | |
*/ | |
isXML = Sizzle.isXML = function( elem ) { | |
// documentElement is verified for cases where it doesn't yet exist | |
// (such as loading iframes in IE - #4833) | |
var documentElement = elem && (elem.ownerDocument || elem).documentElement; | |
return documentElement ? documentElement.nodeName !== "HTML" : false; | |
}; | |
/** | |
* Sets document-related variables once based on the current document | |
* @param {Element|Object} [doc] An element or document object to use to set the document | |
* @returns {Object} Returns the current document | |
*/ | |
setDocument = Sizzle.setDocument = function( node ) { | |
var hasCompare, | |
doc = node ? node.ownerDocument || node : preferredDoc, | |
parent = doc.defaultView; | |
// If no document and documentElement is available, return | |
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { | |
return document; | |
} | |
// Set our document | |
document = doc; | |
docElem = doc.documentElement; | |
// Support tests | |
documentIsHTML = !isXML( doc ); | |
// Support: IE>8 | |
// If iframe document is assigned to "document" variable and if iframe has been reloaded, | |
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 | |
// IE6-8 do not support the defaultView property so parent will be undefined | |
if ( parent && parent !== parent.top ) { | |
// IE11 does not have attachEvent, so all must suffer | |
if ( parent.addEventListener ) { | |
parent.addEventListener( "unload", function() { | |
setDocument(); | |
}, false ); | |
} else if ( parent.attachEvent ) { | |
parent.attachEvent( "onunload", function() { | |
setDocument(); | |
}); | |
} | |
} | |
/* Attributes | |
---------------------------------------------------------------------- */ | |
// Support: IE<8 | |
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) | |
support.attributes = assert(function( div ) { | |
div.className = "i"; | |
return !div.getAttribute("className"); | |
}); | |
/* getElement(s)By* | |
---------------------------------------------------------------------- */ | |
// Check if getElementsByTagName("*") returns only elements | |
support.getElementsByTagName = assert(function( div ) { | |
div.appendChild( doc.createComment("") ); | |
return !div.getElementsByTagName("*").length; | |
}); | |
// Check if getElementsByClassName can be trusted | |
support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { | |
div.innerHTML = "<div class='a'></div><div class='a i'></div>"; | |
// Support: Safari<4 | |
// Catch class over-caching | |
div.firstChild.className = "i"; | |
// Support: Opera<10 | |
// Catch gEBCN failure to find non-leading classes | |
return div.getElementsByClassName("i").length === 2; | |
}); | |
// Support: IE<10 | |
// Check if getElementById returns elements by name | |
// The broken getElementById methods don't pick up programatically-set names, | |
// so use a roundabout getElementsByName test | |
support.getById = assert(function( div ) { | |
docElem.appendChild( div ).id = expando; | |
return !doc.getElementsByName || !doc.getElementsByName( expando ).length; | |
}); | |
// ID find and filter | |
if ( support.getById ) { | |
Expr.find["ID"] = function( id, context ) { | |
if ( typeof context.getElementById !== strundefined && documentIsHTML ) { | |
var m = context.getElementById( id ); | |
// Check parentNode to catch when Blackberry 4.6 returns | |
// nodes that are no longer in the document #6963 | |
return m && m.parentNode ? [m] : []; | |
} | |
}; | |
Expr.filter["ID"] = function( id ) { | |
var attrId = id.replace( runescape, funescape ); | |
return function( elem ) { | |
return elem.getAttribute("id") === attrId; | |
}; | |
}; | |
} else { | |
// Support: IE6/7 | |
// getElementById is not reliable as a find shortcut | |
delete Expr.find["ID"]; | |
Expr.filter["ID"] = function( id ) { | |
var attrId = id.replace( runescape, funescape ); | |
return function( elem ) { | |
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); | |
return node && node.value === attrId; | |
}; | |
}; | |
} | |
// Tag | |
Expr.find["TAG"] = support.getElementsByTagName ? | |
function( tag, context ) { | |
if ( typeof context.getElementsByTagName !== strundefined ) { | |
return context.getElementsByTagName( tag ); | |
} | |
} : | |
function( tag, context ) { | |
var elem, | |
tmp = [], | |
i = 0, | |
results = context.getElementsByTagName( tag ); | |
// Filter out possible comments | |
if ( tag === "*" ) { | |
while ( (elem = results[i++]) ) { | |
if ( elem.nodeType === 1 ) { | |
tmp.push( elem ); | |
} | |
} | |
return tmp; | |
} | |
return results; | |
}; | |
// Class | |
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { | |
if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { | |
return context.getElementsByClassName( className ); | |
} | |
}; | |
/* QSA/matchesSelector | |
---------------------------------------------------------------------- */ | |
// QSA and matchesSelector support | |
// matchesSelector(:active) reports false when true (IE9/Opera 11.5) | |
rbuggyMatches = []; | |
// qSa(:focus) reports false when true (Chrome 21) | |
// We allow this because of a bug in IE8/9 that throws an error | |
// whenever `document.activeElement` is accessed on an iframe | |
// So, we allow :focus to pass through QSA all the time to avoid the IE error | |
// See http://bugs.jquery.com/ticket/13378 | |
rbuggyQSA = []; | |
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { | |
// Build QSA regex | |
// Regex strategy adopted from Diego Perini | |
assert(function( div ) { | |
// Select is set to empty string on purpose | |
// This is to test IE's treatment of not explicitly | |
// setting a boolean content attribute, | |
// since its presence should be enough | |
// http://bugs.jquery.com/ticket/12359 | |
div.innerHTML = "<select t=''><option selected=''></option></select>"; | |
// Support: IE8, Opera 10-12 | |
// Nothing should be selected when empty strings follow ^= or $= or *= | |
if ( div.querySelectorAll("[t^='']").length ) { | |
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); | |
} | |
// Support: IE8 | |
// Boolean attributes and "value" are not treated correctly | |
if ( !div.querySelectorAll("[selected]").length ) { | |
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); | |
} | |
// Webkit/Opera - :checked should return selected option elements | |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | |
// IE8 throws error here and will not see later tests | |
if ( !div.querySelectorAll(":checked").length ) { | |
rbuggyQSA.push(":checked"); | |
} | |
}); | |
assert(function( div ) { | |
// Support: Windows 8 Native Apps | |
// The type and name attributes are restricted during .innerHTML assignment | |
var input = doc.createElement("input"); | |
input.setAttribute( "type", "hidden" ); | |
div.appendChild( input ).setAttribute( "name", "D" ); | |
// Support: IE8 | |
// Enforce case-sensitivity of name attribute | |
if ( div.querySelectorAll("[name=d]").length ) { | |
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); | |
} | |
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) | |
// IE8 throws error here and will not see later tests | |
if ( !div.querySelectorAll(":enabled").length ) { | |
rbuggyQSA.push( ":enabled", ":disabled" ); | |
} | |
// Opera 10-11 does not throw on post-comma invalid pseudos | |
div.querySelectorAll("*,:x"); | |
rbuggyQSA.push(",.*:"); | |
}); | |
} | |
if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || | |
docElem.mozMatchesSelector || | |
docElem.oMatchesSelector || | |
docElem.msMatchesSelector) )) ) { | |
assert(function( div ) { | |
// Check to see if it's possible to do matchesSelector | |
// on a disconnected node (IE 9) | |
support.disconnectedMatch = matches.call( div, "div" ); | |
// This should fail with an exception | |
// Gecko does not error, returns false instead | |
matches.call( div, "[s!='']:x" ); | |
rbuggyMatches.push( "!=", pseudos ); | |
}); | |
} | |
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); | |
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); | |
/* Contains | |
---------------------------------------------------------------------- */ | |
hasCompare = rnative.test( docElem.compareDocumentPosition ); | |
// Element contains another | |
// Purposefully does not implement inclusive descendent | |
// As in, an element does not contain itself | |
contains = hasCompare || rnative.test( docElem.contains ) ? | |
function( a, b ) { | |
var adown = a.nodeType === 9 ? a.documentElement : a, | |
bup = b && b.parentNode; | |
return a === bup || !!( bup && bup.nodeType === 1 && ( | |
adown.contains ? | |
adown.contains( bup ) : | |
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 | |
)); | |
} : | |
function( a, b ) { | |
if ( b ) { | |
while ( (b = b.parentNode) ) { | |
if ( b === a ) { | |
return true; | |
} | |
} | |
} | |
return false; | |
}; | |
/* Sorting | |
---------------------------------------------------------------------- */ | |
// Document order sorting | |
sortOrder = hasCompare ? | |
function( a, b ) { | |
// Flag for duplicate removal | |
if ( a === b ) { | |
hasDuplicate = true; | |
return 0; | |
} | |
// Sort on method existence if only one input has compareDocumentPosition | |
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; | |
if ( compare ) { | |
return compare; | |
} | |
// Calculate position if both inputs belong to the same document | |
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? | |
a.compareDocumentPosition( b ) : | |
// Otherwise we know they are disconnected | |
1; | |
// Disconnected nodes | |
if ( compare & 1 || | |
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { | |
// Choose the first element that is related to our preferred document | |
if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { | |
return -1; | |
} | |
if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { | |
return 1; | |
} | |
// Maintain original order | |
return sortInput ? | |
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : | |
0; | |
} | |
return compare & 4 ? -1 : 1; | |
} : | |
function( a, b ) { | |
// Exit early if the nodes are identical | |
if ( a === b ) { | |
hasDuplicate = true; | |
return 0; | |
} | |
var cur, | |
i = 0, | |
aup = a.parentNode, | |
bup = b.parentNode, | |
ap = [ a ], | |
bp = [ b ]; | |
// Parentless nodes are either documents or disconnected | |
if ( !aup || !bup ) { | |
return a === doc ? -1 : | |
b === doc ? 1 : | |
aup ? -1 : | |
bup ? 1 : | |
sortInput ? | |
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : | |
0; | |
// If the nodes are siblings, we can do a quick check | |
} else if ( aup === bup ) { | |
return siblingCheck( a, b ); | |
} | |
// Otherwise we need full lists of their ancestors for comparison | |
cur = a; | |
while ( (cur = cur.parentNode) ) { | |
ap.unshift( cur ); | |
} | |
cur = b; | |
while ( (cur = cur.parentNode) ) { | |
bp.unshift( cur ); | |
} | |
// Walk down the tree looking for a discrepancy | |
while ( ap[i] === bp[i] ) { | |
i++; | |
} | |
return i ? | |
// Do a sibling check if the nodes have a common ancestor | |
siblingCheck( ap[i], bp[i] ) : | |
// Otherwise nodes in our document sort first | |
ap[i] === preferredDoc ? -1 : | |
bp[i] === preferredDoc ? 1 : | |
0; | |
}; | |
return doc; | |
}; | |
Sizzle.matches = function( expr, elements ) { | |
return Sizzle( expr, null, null, elements ); | |
}; | |
Sizzle.matchesSelector = function( elem, expr ) { | |
// Set document vars if needed | |
if ( ( elem.ownerDocument || elem ) !== document ) { | |
setDocument( elem ); | |
} | |
// Make sure that attribute selectors are quoted | |
expr = expr.replace( rattributeQuotes, "='$1']" ); | |
if ( support.matchesSelector && documentIsHTML && | |
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && | |
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { | |
try { | |
var ret = matches.call( elem, expr ); | |
// IE 9's matchesSelector returns false on disconnected nodes | |
if ( ret || support.disconnectedMatch || | |
// As well, disconnected nodes are said to be in a document | |
// fragment in IE 9 | |
elem.document && elem.document.nodeType !== 11 ) { | |
return ret; | |
} | |
} catch(e) {} | |
} | |
return Sizzle( expr, document, null, [elem] ).length > 0; | |
}; | |
Sizzle.contains = function( context, elem ) { | |
// Set document vars if needed | |
if ( ( context.ownerDocument || context ) !== document ) { | |
setDocument( context ); | |
} | |
return contains( context, elem ); | |
}; | |
Sizzle.attr = function( elem, name ) { | |
// Set document vars if needed | |
if ( ( elem.ownerDocument || elem ) !== document ) { | |
setDocument( elem ); | |
} | |
var fn = Expr.attrHandle[ name.toLowerCase() ], | |
// Don't get fooled by Object.prototype properties (jQuery #13807) | |
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? | |
fn( elem, name, !documentIsHTML ) : | |
undefined; | |
return val !== undefined ? | |
val : | |
support.attributes || !documentIsHTML ? | |
elem.getAttribute( name ) : | |
(val = elem.getAttributeNode(name)) && val.specified ? | |
val.value : | |
null; | |
}; | |
Sizzle.error = function( msg ) { | |
throw new Error( "Syntax error, unrecognized expression: " + msg ); | |
}; | |
/** | |
* Document sorting and removing duplicates | |
* @param {ArrayLike} results | |
*/ | |
Sizzle.uniqueSort = function( results ) { | |
var elem, | |
duplicates = [], | |
j = 0, | |
i = 0; | |
// Unless we *know* we can detect duplicates, assume their presence | |
hasDuplicate = !support.detectDuplicates; | |
sortInput = !support.sortStable && results.slice( 0 ); | |
results.sort( sortOrder ); | |
if ( hasDuplicate ) { | |
while ( (elem = results[i++]) ) { | |
if ( elem === results[ i ] ) { | |
j = duplicates.push( i ); | |
} | |
} | |
while ( j-- ) { | |
results.splice( duplicates[ j ], 1 ); | |
} | |
} | |
// Clear input after sorting to release objects | |
// See https://github.com/jquery/sizzle/pull/225 | |
sortInput = null; | |
return results; | |
}; | |
/** | |
* Utility function for retrieving the text value of an array of DOM nodes | |
* @param {Array|Element} elem | |
*/ | |
getText = Sizzle.getText = function( elem ) { | |
var node, | |
ret = "", | |
i = 0, | |
nodeType = elem.nodeType; | |
if ( !nodeType ) { | |
// If no nodeType, this is expected to be an array | |
while ( (node = elem[i++]) ) { | |
// Do not traverse comment nodes | |
ret += getText( node ); | |
} | |
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { | |
// Use textContent for elements | |
// innerText usage removed for consistency of new lines (jQuery #11153) | |
if ( typeof elem.textContent === "string" ) { | |
return elem.textContent; | |
} else { | |
// Traverse its children | |
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | |
ret += getText( elem ); | |
} | |
} | |
} else if ( nodeType === 3 || nodeType === 4 ) { | |
return elem.nodeValue; | |
} | |
// Do not include comment or processing instruction nodes | |
return ret; | |
}; | |
Expr = Sizzle.selectors = { | |
// Can be adjusted by the user | |
cacheLength: 50, | |
createPseudo: markFunction, | |
match: matchExpr, | |
attrHandle: {}, | |
find: {}, | |
relative: { | |
">": { dir: "parentNode", first: true }, | |
" ": { dir: "parentNode" }, | |
"+": { dir: "previousSibling", first: true }, | |
"~": { dir: "previousSibling" } | |
}, | |
preFilter: { | |
"ATTR": function( match ) { | |
match[1] = match[1].replace( runescape, funescape ); | |
// Move the given value to match[3] whether quoted or unquoted | |
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); | |
if ( match[2] === "~=" ) { | |
match[3] = " " + match[3] + " "; | |
} | |
return match.slice( 0, 4 ); | |
}, | |
"CHILD": function( match ) { | |
/* matches from matchExpr["CHILD"] | |
1 type (only|nth|...) | |
2 what (child|of-type) | |
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) | |
4 xn-component of xn+y argument ([+-]?\d*n|) | |
5 sign of xn-component | |
6 x of xn-component | |
7 sign of y-component | |
8 y of y-component | |
*/ | |
match[1] = match[1].toLowerCase(); | |
if ( match[1].slice( 0, 3 ) === "nth" ) { | |
// nth-* requires argument | |
if ( !match[3] ) { | |
Sizzle.error( match[0] ); | |
} | |
// numeric x and y parameters for Expr.filter.CHILD | |
// remember that false/true cast respectively to 0/1 | |
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); | |
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); | |
// other types prohibit arguments | |
} else if ( match[3] ) { | |
Sizzle.error( match[0] ); | |
} | |
return match; | |
}, | |
"PSEUDO": function( match ) { | |
var excess, | |
unquoted = !match[5] && match[2]; | |
if ( matchExpr["CHILD"].test( match[0] ) ) { | |
return null; | |
} | |
// Accept quoted arguments as-is | |
if ( match[3] && match[4] !== undefined ) { | |
match[2] = match[4]; | |
// Strip excess characters from unquoted arguments | |
} else if ( unquoted && rpseudo.test( unquoted ) && | |
// Get excess from tokenize (recursively) | |
(excess = tokenize( unquoted, true )) && | |
// advance to the next closing parenthesis | |
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { | |
// excess is a negative index | |
match[0] = match[0].slice( 0, excess ); | |
match[2] = unquoted.slice( 0, excess ); | |
} | |
// Return only captures needed by the pseudo filter method (type and argument) | |
return match.slice( 0, 3 ); | |
} | |
}, | |
filter: { | |
"TAG": function( nodeNameSelector ) { | |
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); | |
return nodeNameSelector === "*" ? | |
function() { return true; } : | |
function( elem ) { | |
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; | |
}; | |
}, | |
"CLASS": function( className ) { | |
var pattern = classCache[ className + " " ]; | |
return pattern || | |
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && | |
classCache( className, function( elem ) { | |
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); | |
}); | |
}, | |
"ATTR": function( name, operator, check ) { | |
return function( elem ) { | |
var result = Sizzle.attr( elem, name ); | |
if ( result == null ) { | |
return operator === "!="; | |
} | |
if ( !operator ) { | |
return true; | |
} | |
result += ""; | |
return operator === "=" ? result === check : | |
operator === "!=" ? result !== check : | |
operator === "^=" ? check && result.indexOf( check ) === 0 : | |
operator === "*=" ? check && result.indexOf( check ) > -1 : | |
operator === "$=" ? check && result.slice( -check.length ) === check : | |
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : | |
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : | |
false; | |
}; | |
}, | |
"CHILD": function( type, what, argument, first, last ) { | |
var simple = type.slice( 0, 3 ) !== "nth", | |
forward = type.slice( -4 ) !== "last", | |
ofType = what === "of-type"; | |
return first === 1 && last === 0 ? | |
// Shortcut for :nth-*(n) | |
function( elem ) { | |
return !!elem.parentNode; | |
} : | |
function( elem, context, xml ) { | |
var cache, outerCache, node, diff, nodeIndex, start, | |
dir = simple !== forward ? "nextSibling" : "previousSibling", | |
parent = elem.parentNode, | |
name = ofType && elem.nodeName.toLowerCase(), | |
useCache = !xml && !ofType; | |
if ( parent ) { | |
// :(first|last|only)-(child|of-type) | |
if ( simple ) { | |
while ( dir ) { | |
node = elem; | |
while ( (node = node[ dir ]) ) { | |
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { | |
return false; | |
} | |
} | |
// Reverse direction for :only-* (if we haven't yet done so) | |
start = dir = type === "only" && !start && "nextSibling"; | |
} | |
return true; | |
} | |
start = [ forward ? parent.firstChild : parent.lastChild ]; | |
// non-xml :nth-child(...) stores cache data on `parent` | |
if ( forward && useCache ) { | |
// Seek `elem` from a previously-cached index | |
outerCache = parent[ expando ] || (parent[ expando ] = {}); | |
cache = outerCache[ type ] || []; | |
nodeIndex = cache[0] === dirruns && cache[1]; | |
diff = cache[0] === dirruns && cache[2]; | |
node = nodeIndex && parent.childNodes[ nodeIndex ]; | |
while ( (node = ++nodeIndex && node && node[ dir ] || | |
// Fallback to seeking `elem` from the start | |
(diff = nodeIndex = 0) || start.pop()) ) { | |
// When found, cache indexes on `parent` and break | |
if ( node.nodeType === 1 && ++diff && node === elem ) { | |
outerCache[ type ] = [ dirruns, nodeIndex, diff ]; | |
break; | |
} | |
} | |
// Use previously-cached element index if available | |
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { | |
diff = cache[1]; | |
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) | |
} else { | |
// Use the same loop as above to seek `elem` from the start | |
while ( (node = ++nodeIndex && node && node[ dir ] || | |
(diff = nodeIndex = 0) || start.pop()) ) { | |
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { | |
// Cache the index of each encountered element | |
if ( useCache ) { | |
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; | |
} | |
if ( node === elem ) { | |
break; | |
} | |
} | |
} | |
} | |
// Incorporate the offset, then check against cycle size | |
diff -= last; | |
return diff === first || ( diff % first === 0 && diff / first >= 0 ); | |
} | |
}; | |
}, | |
"PSEUDO": function( pseudo, argument ) { | |
// pseudo-class names are case-insensitive | |
// http://www.w3.org/TR/selectors/#pseudo-classes | |
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters | |
// Remember that setFilters inherits from pseudos | |
var args, | |
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || | |
Sizzle.error( "unsupported pseudo: " + pseudo ); | |
// The user may use createPseudo to indicate that | |
// arguments are needed to create the filter function | |
// just as Sizzle does | |
if ( fn[ expando ] ) { | |
return fn( argument ); | |
} | |
// But maintain support for old signatures | |
if ( fn.length > 1 ) { | |
args = [ pseudo, pseudo, "", argument ]; | |
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? | |
markFunction(function( seed, matches ) { | |
var idx, | |
matched = fn( seed, argument ), | |
i = matched.length; | |
while ( i-- ) { | |
idx = indexOf.call( seed, matched[i] ); | |
seed[ idx ] = !( matches[ idx ] = matched[i] ); | |
} | |
}) : | |
function( elem ) { | |
return fn( elem, 0, args ); | |
}; | |
} | |
return fn; | |
} | |
}, | |
pseudos: { | |
// Potentially complex pseudos | |
"not": markFunction(function( selector ) { | |
// Trim the selector passed to compile | |
// to avoid treating leading and trailing | |
// spaces as combinators | |
var input = [], | |
results = [], | |
matcher = compile( selector.replace( rtrim, "$1" ) ); | |
return matcher[ expando ] ? | |
markFunction(function( seed, matches, context, xml ) { | |
var elem, | |
unmatched = matcher( seed, null, xml, [] ), | |
i = seed.length; | |
// Match elements unmatched by `matcher` | |
while ( i-- ) { | |
if ( (elem = unmatched[i]) ) { | |
seed[i] = !(matches[i] = elem); | |
} | |
} | |
}) : | |
function( elem, context, xml ) { | |
input[0] = elem; | |
matcher( input, null, xml, results ); | |
return !results.pop(); | |
}; | |
}), | |
"has": markFunction(function( selector ) { | |
return function( elem ) { | |
return Sizzle( selector, elem ).length > 0; | |
}; | |
}), | |
"contains": markFunction(function( text ) { | |
return function( elem ) { | |
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; | |
}; | |
}), | |
// "Whether an element is represented by a :lang() selector | |
// is based solely on the element's language value | |
// being equal to the identifier C, | |
// or beginning with the identifier C immediately followed by "-". | |
// The matching of C against the element's language value is performed case-insensitively. | |
// The identifier C does not have to be a valid language name." | |
// http://www.w3.org/TR/selectors/#lang-pseudo | |
"lang": markFunction( function( lang ) { | |
// lang value must be a valid identifier | |
if ( !ridentifier.test(lang || "") ) { | |
Sizzle.error( "unsupported lang: " + lang ); | |
} | |
lang = lang.replace( runescape, funescape ).toLowerCase(); | |
return function( elem ) { | |
var elemLang; | |
do { | |
if ( (elemLang = documentIsHTML ? | |
elem.lang : | |
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { | |
elemLang = elemLang.toLowerCase(); | |
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; | |
} | |
} while ( (elem = elem.parentNode) && elem.nodeType === 1 ); | |
return false; | |
}; | |
}), | |
// Miscellaneous | |
"target": function( elem ) { | |
var hash = window.location && window.location.hash; | |
return hash && hash.slice( 1 ) === elem.id; | |
}, | |
"root": function( elem ) { | |
return elem === docElem; | |
}, | |
"focus": function( elem ) { | |
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); | |
}, | |
// Boolean properties | |
"enabled": function( elem ) { | |
return elem.disabled === false; | |
}, | |
"disabled": function( elem ) { | |
return elem.disabled === true; | |
}, | |
"checked": function( elem ) { | |
// In CSS3, :checked should return both checked and selected elements | |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | |
var nodeName = elem.nodeName.toLowerCase(); | |
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); | |
}, | |
"selected": function( elem ) { | |
// Accessing this property makes selected-by-default | |
// options in Safari work properly | |
if ( elem.parentNode ) { | |
elem.parentNode.selectedIndex; | |
} | |
return elem.selected === true; | |
}, | |
// Contents | |
"empty": function( elem ) { | |
// http://www.w3.org/TR/selectors/#empty-pseudo | |
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), | |
// but not by others (comment: 8; processing instruction: 7; etc.) | |
// nodeType < 6 works because attributes (2) do not appear as children | |
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | |
if ( elem.nodeType < 6 ) { | |
return false; | |
} | |
} | |
return true; | |
}, | |
"parent": function( elem ) { | |
return !Expr.pseudos["empty"]( elem ); | |
}, | |
// Element/input types | |
"header": function( elem ) { | |
return rheader.test( elem.nodeName ); | |
}, | |
"input": function( elem ) { | |
return rinputs.test( elem.nodeName ); | |
}, | |
"button": function( elem ) { | |
var name = elem.nodeName.toLowerCase(); | |
return name === "input" && elem.type === "button" || name === "button"; | |
}, | |
"text": function( elem ) { | |
var attr; | |
return elem.nodeName.toLowerCase() === "input" && | |
elem.type === "text" && | |
// Support: IE<8 | |
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text" | |
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); | |
}, | |
// Position-in-collection | |
"first": createPositionalPseudo(function() { | |
return [ 0 ]; | |
}), | |
"last": createPositionalPseudo(function( matchIndexes, length ) { | |
return [ length - 1 ]; | |
}), | |
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) { | |
return [ argument < 0 ? argument + length : argument ]; | |
}), | |
"even": createPositionalPseudo(function( matchIndexes, length ) { | |
var i = 0; | |
for ( ; i < length; i += 2 ) { | |
matchIndexes.push( i ); | |
} | |
return matchIndexes; | |
}), | |
"odd": createPositionalPseudo(function( matchIndexes, length ) { | |
var i = 1; | |
for ( ; i < length; i += 2 ) { | |
matchIndexes.push( i ); | |
} | |
return matchIndexes; | |
}), | |
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) { | |
var i = argument < 0 ? argument + length : argument; | |
for ( ; --i >= 0; ) { | |
matchIndexes.push( i ); | |
} | |
return matchIndexes; | |
}), | |
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) { | |
var i = argument < 0 ? argument + length : argument; | |
for ( ; ++i < length; ) { | |
matchIndexes.push( i ); | |
} | |
return matchIndexes; | |
}) | |
} | |
}; | |
Expr.pseudos["nth"] = Expr.pseudos["eq"]; | |
// Add button/input type pseudos | |
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { | |
Expr.pseudos[ i ] = createInputPseudo( i ); | |
} | |
for ( i in { submit: true, reset: true } ) { | |
Expr.pseudos[ i ] = createButtonPseudo( i ); | |
} | |
// Easy API for creating new setFilters | |
function setFilters() {} | |
setFilters.prototype = Expr.filters = Expr.pseudos; | |
Expr.setFilters = new setFilters(); | |
function tokenize( selector, parseOnly ) { | |
var matched, match, tokens, type, | |
soFar, groups, preFilters, | |
cached = tokenCache[ selector + " " ]; | |
if ( cached ) { | |
return parseOnly ? 0 : cached.slice( 0 ); | |
} | |
soFar = selector; | |
groups = []; | |
preFilters = Expr.preFilter; | |
while ( soFar ) { | |
// Comma and first run | |
if ( !matched || (match = rcomma.exec( soFar )) ) { | |
if ( match ) { | |
// Don't consume trailing commas as valid | |
soFar = soFar.slice( match[0].length ) || soFar; | |
} | |
groups.push( (tokens = []) ); | |
} | |
matched = false; | |
// Combinators | |
if ( (match = rcombinators.exec( soFar )) ) { | |
matched = match.shift(); | |
tokens.push({ | |
value: matched, | |
// Cast descendant combinators to space | |
type: match[0].replace( rtrim, " " ) | |
}); | |
soFar = soFar.slice( matched.length ); | |
} | |
// Filters | |
for ( type in Expr.filter ) { | |
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || | |
(match = preFilters[ type ]( match ))) ) { | |
matched = match.shift(); | |
tokens.push({ | |
value: matched, | |
type: type, | |
matches: match | |
}); | |
soFar = soFar.slice( matched.length ); | |
} | |
} | |
if ( !matched ) { | |
break; | |
} | |
} | |
// Return the length of the invalid excess | |
// if we're just parsing | |
// Otherwise, throw an error or return tokens | |
return parseOnly ? | |
soFar.length : | |
soFar ? | |
Sizzle.error( selector ) : | |
// Cache the tokens | |
tokenCache( selector, groups ).slice( 0 ); | |
} | |
function toSelector( tokens ) { | |
var i = 0, | |
len = tokens.length, | |
selector = ""; | |
for ( ; i < len; i++ ) { | |
selector += tokens[i].value; | |
} | |
return selector; | |
} | |
function addCombinator( matcher, combinator, base ) { | |
var dir = combinator.dir, | |
checkNonElements = base && dir === "parentNode", | |
doneName = done++; | |
return combinator.first ? | |
// Check against closest ancestor/preceding element | |
function( elem, context, xml ) { | |
while ( (elem = elem[ dir ]) ) { | |
if ( elem.nodeType === 1 || checkNonElements ) { | |
return matcher( elem, context, xml ); | |
} | |
} | |
} : | |
// Check against all ancestor/preceding elements | |
function( elem, context, xml ) { | |
var oldCache, outerCache, | |
newCache = [ dirruns, doneName ]; | |
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching | |
if ( xml ) { | |
while ( (elem = elem[ dir ]) ) { | |
if ( elem.nodeType === 1 || checkNonElements ) { | |
if ( matcher( elem, context, xml ) ) { | |
return true; | |
} | |
} | |
} | |
} else { | |
while ( (elem = elem[ dir ]) ) { | |
if ( elem.nodeType === 1 || checkNonElements ) { | |
outerCache = elem[ expando ] || (elem[ expando ] = {}); | |
if ( (oldCache = outerCache[ dir ]) && | |
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { | |
// Assign to newCache so results back-propagate to previous elements | |
return (newCache[ 2 ] = oldCache[ 2 ]); | |
} else { | |
// Reuse newcache so results back-propagate to previous elements | |
outerCache[ dir ] = newCache; | |
// A match means we're done; a fail means we have to keep checking | |
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { | |
return true; | |
} | |
} | |
} | |
} | |
} | |
}; | |
} | |
function elementMatcher( matchers ) { | |
return matchers.length > 1 ? | |
function( elem, context, xml ) { | |
var i = matchers.length; | |
while ( i-- ) { | |
if ( !matchers[i]( elem, context, xml ) ) { | |
return false; | |
} | |
} | |
return true; | |
} : | |
matchers[0]; | |
} | |
function condense( unmatched, map, filter, context, xml ) { | |
var elem, | |
newUnmatched = [], | |
i = 0, | |
len = unmatched.length, | |
mapped = map != null; | |
for ( ; i < len; i++ ) { | |
if ( (elem = unmatched[i]) ) { | |
if ( !filter || filter( elem, context, xml ) ) { | |
newUnmatched.push( elem ); | |
if ( mapped ) { | |
map.push( i ); | |
} | |
} | |
} | |
} | |
return newUnmatched; | |
} | |
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { | |
if ( postFilter && !postFilter[ expando ] ) { | |
postFilter = setMatcher( postFilter ); | |
} | |
if ( postFinder && !postFinder[ expando ] ) { | |
postFinder = setMatcher( postFinder, postSelector ); | |
} | |
return markFunction(function( seed, results, context, xml ) { | |
var temp, i, elem, | |
preMap = [], | |
postMap = [], | |
preexisting = results.length, | |
// Get initial elements from seed or context | |
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), | |
// Prefilter to get matcher input, preserving a map for seed-results synchronization | |
matcherIn = preFilter && ( seed || !selector ) ? | |
condense( elems, preMap, preFilter, context, xml ) : | |
elems, | |
matcherOut = matcher ? | |
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, | |
postFinder || ( seed ? preFilter : preexisting || postFilter ) ? | |
// ...intermediate processing is necessary | |
[] : | |
// ...otherwise use results directly | |
results : | |
matcherIn; | |
// Find primary matches | |
if ( matcher ) { | |
matcher( matcherIn, matcherOut, context, xml ); | |
} | |
// Apply postFilter | |
if ( postFilter ) { | |
temp = condense( matcherOut, postMap ); | |
postFilter( temp, [], context, xml ); | |
// Un-match failing elements by moving them back to matcherIn | |
i = temp.length; | |
while ( i-- ) { | |
if ( (elem = temp[i]) ) { | |
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); | |
} | |
} | |
} | |
if ( seed ) { | |
if ( postFinder || preFilter ) { | |
if ( postFinder ) { | |
// Get the final matcherOut by condensing this intermediate into postFinder contexts | |
temp = []; | |
i = matcherOut.length; | |
while ( i-- ) { | |
if ( (elem = matcherOut[i]) ) { | |
// Restore matcherIn since elem is not yet a final match | |
temp.push( (matcherIn[i] = elem) ); | |
} | |
} | |
postFinder( null, (matcherOut = []), temp, xml ); | |
} | |
// Move matched elements from seed to results to keep them synchronized | |
i = matcherOut.length; | |
while ( i-- ) { | |
if ( (elem = matcherOut[i]) && | |
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { | |
seed[temp] = !(results[temp] = elem); | |
} | |
} | |
} | |
// Add elements to results, through postFinder if defined | |
} else { | |
matcherOut = condense( | |
matcherOut === results ? | |
matcherOut.splice( preexisting, matcherOut.length ) : | |
matcherOut | |
); | |
if ( postFinder ) { | |
postFinder( null, results, matcherOut, xml ); | |
} else { | |
push.apply( results, matcherOut ); | |
} | |
} | |
}); | |
} | |
function matcherFromTokens( tokens ) { | |
var checkContext, matcher, j, | |
len = tokens.length, | |
leadingRelative = Expr.relative[ tokens[0].type ], | |
implicitRelative = leadingRelative || Expr.relative[" "], | |
i = leadingRelative ? 1 : 0, | |
// The foundational matcher ensures that elements are reachable from top-level context(s) | |
matchContext = addCombinator( function( elem ) { | |
return elem === checkContext; | |
}, implicitRelative, true ), | |
matchAnyContext = addCombinator( function( elem ) { | |
return indexOf.call( checkContext, elem ) > -1; | |
}, implicitRelative, true ), | |
matchers = [ function( elem, context, xml ) { | |
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( | |
(checkContext = context).nodeType ? | |
matchContext( elem, context, xml ) : | |
matchAnyContext( elem, context, xml ) ); | |
} ]; | |
for ( ; i < len; i++ ) { | |
if ( (matcher = Expr.relative[ tokens[i].type ]) ) { | |
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; | |
} else { | |
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); | |
// Return special upon seeing a positional matcher | |
if ( matcher[ expando ] ) { | |
// Find the next relative operator (if any) for proper handling | |
j = ++i; | |
for ( ; j < len; j++ ) { | |
if ( Expr.relative[ tokens[j].type ] ) { | |
break; | |
} | |
} | |
return setMatcher( | |
i > 1 && elementMatcher( matchers ), | |
i > 1 && toSelector( | |
// If the preceding token was a descendant combinator, insert an implicit any-element `*` | |
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) | |
).replace( rtrim, "$1" ), | |
matcher, | |
i < j && matcherFromTokens( tokens.slice( i, j ) ), | |
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), | |
j < len && toSelector( tokens ) | |
); | |
} | |
matchers.push( matcher ); | |
} | |
} | |
return elementMatcher( matchers ); | |
} | |
function matcherFromGroupMatchers( elementMatchers, setMatchers ) { | |
var bySet = setMatchers.length > 0, | |
byElement = elementMatchers.length > 0, | |
superMatcher = function( seed, context, xml, results, outermost ) { | |
var elem, j, matcher, | |
matchedCount = 0, | |
i = "0", | |
unmatched = seed && [], | |
setMatched = [], | |
contextBackup = outermostContext, | |
// We must always have either seed elements or outermost context | |
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), | |
// Use integer dirruns iff this is the outermost matcher | |
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), | |
len = elems.length; | |
if ( outermost ) { | |
outermostContext = context !== document && context; | |
} | |
// Add elements passing elementMatchers directly to results | |
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below | |
// Support: IE<9, Safari | |
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id | |
for ( ; i !== len && (elem = elems[i]) != null; i++ ) { | |
if ( byElement && elem ) { | |
j = 0; | |
while ( (matcher = elementMatchers[j++]) ) { | |
if ( matcher( elem, context, xml ) ) { | |
results.push( elem ); | |
break; | |
} | |
} | |
if ( outermost ) { | |
dirruns = dirrunsUnique; | |
} | |
} | |
// Track unmatched elements for set filters | |
if ( bySet ) { | |
// They will have gone through all possible matchers | |
if ( (elem = !matcher && elem) ) { | |
matchedCount--; | |
} | |
// Lengthen the array for every element, matched or not | |
if ( seed ) { | |
unmatched.push( elem ); | |
} | |
} | |
} | |
// Apply set filters to unmatched elements | |
matchedCount += i; | |
if ( bySet && i !== matchedCount ) { | |
j = 0; | |
while ( (matcher = setMatchers[j++]) ) { | |
matcher( unmatched, setMatched, context, xml ); | |
} | |
if ( seed ) { | |
// Reintegrate element matches to eliminate the need for sorting | |
if ( matchedCount > 0 ) { | |
while ( i-- ) { | |
if ( !(unmatched[i] || setMatched[i]) ) { | |
setMatched[i] = pop.call( results ); | |
} | |
} | |
} | |
// Discard index placeholder values to get only actual matches | |
setMatched = condense( setMatched ); | |
} | |
// Add matches to results | |
push.apply( results, setMatched ); | |
// Seedless set matches succeeding multiple successful matchers stipulate sorting | |
if ( outermost && !seed && setMatched.length > 0 && | |
( matchedCount + setMatchers.length ) > 1 ) { | |
Sizzle.uniqueSort( results ); | |
} | |
} | |
// Override manipulation of globals by nested matchers | |
if ( outermost ) { | |
dirruns = dirrunsUnique; | |
outermostContext = contextBackup; | |
} | |
return unmatched; | |
}; | |
return bySet ? | |
markFunction( superMatcher ) : | |
superMatcher; | |
} | |
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { | |
var i, | |
setMatchers = [], | |
elementMatchers = [], | |
cached = compilerCache[ selector + " " ]; | |
if ( !cached ) { | |
// Generate a function of recursive functions that can be used to check each element | |
if ( !group ) { | |
group = tokenize( selector ); | |
} | |
i = group.length; | |
while ( i-- ) { | |
cached = matcherFromTokens( group[i] ); | |
if ( cached[ expando ] ) { | |
setMatchers.push( cached ); | |
} else { | |
elementMatchers.push( cached ); | |
} | |
} | |
// Cache the compiled function | |
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); | |
} | |
return cached; | |
}; | |
function multipleContexts( selector, contexts, results ) { | |
var i = 0, | |
len = contexts.length; | |
for ( ; i < len; i++ ) { | |
Sizzle( selector, contexts[i], results ); | |
} | |
return results; | |
} | |
function select( selector, context, results, seed ) { | |
var i, tokens, token, type, find, | |
match = tokenize( selector ); | |
if ( !seed ) { | |
// Try to minimize operations if there is only one group | |
if ( match.length === 1 ) { | |
// Take a shortcut and set the context if the root selector is an ID | |
tokens = match[0] = match[0].slice( 0 ); | |
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && | |
support.getById && context.nodeType === 9 && documentIsHTML && | |
Expr.relative[ tokens[1].type ] ) { | |
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; | |
if ( !context ) { | |
return results; | |
} | |
selector = selector.slice( tokens.shift().value.length ); | |
} | |
// Fetch a seed set for right-to-left matching | |
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; | |
while ( i-- ) { | |
token = tokens[i]; | |
// Abort if we hit a combinator | |
if ( Expr.relative[ (type = token.type) ] ) { | |
break; | |
} | |
if ( (find = Expr.find[ type ]) ) { | |
// Search, expanding context for leading sibling combinators | |
if ( (seed = find( | |
token.matches[0].replace( runescape, funescape ), | |
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context | |
)) ) { | |
// If seed is empty or no tokens remain, we can return early | |
tokens.splice( i, 1 ); | |
selector = seed.length && toSelector( tokens ); | |
if ( !selector ) { | |
push.apply( results, seed ); | |
return results; | |
} | |
break; | |
} | |
} | |
} | |
} | |
} | |
// Compile and execute a filtering function | |
// Provide `match` to avoid retokenization if we modified the selector above | |
compile( selector, match )( | |
seed, | |
context, | |
!documentIsHTML, | |
results, | |
rsibling.test( selector ) && testContext( context.parentNode ) || context | |
); | |
return results; | |
} | |
// One-time assignments | |
// Sort stability | |
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; | |
// Support: Chrome<14 | |
// Always assume duplicates if they aren't passed to the comparison function | |
support.detectDuplicates = !!hasDuplicate; | |
// Initialize against the default document | |
setDocument(); | |
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) | |
// Detached nodes confoundingly follow *each other* | |
support.sortDetached = assert(function( div1 ) { | |
// Should return 1, but returns 4 (following) | |
return div1.compareDocumentPosition( document.createElement("div") ) & 1; | |
}); | |
// Support: IE<8 | |
// Prevent attribute/property "interpolation" | |
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx | |
if ( !assert(function( div ) { | |
div.innerHTML = "<a href='#'></a>"; | |
return div.firstChild.getAttribute("href") === "#" ; | |
}) ) { | |
addHandle( "type|href|height|width", function( elem, name, isXML ) { | |
if ( !isXML ) { | |
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); | |
} | |
}); | |
} | |
// Support: IE<9 | |
// Use defaultValue in place of getAttribute("value") | |
if ( !support.attributes || !assert(function( div ) { | |
div.innerHTML = "<input/>"; | |
div.firstChild.setAttribute( "value", "" ); | |
return div.firstChild.getAttribute( "value" ) === ""; | |
}) ) { | |
addHandle( "value", function( elem, name, isXML ) { | |
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { | |
return elem.defaultValue; | |
} | |
}); | |
} | |
// Support: IE<9 | |
// Use getAttributeNode to fetch booleans when getAttribute lies | |
if ( !assert(function( div ) { | |
return div.getAttribute("disabled") == null; | |
}) ) { | |
addHandle( booleans, function( elem, name, isXML ) { | |
var val; | |
if ( !isXML ) { | |
return elem[ name ] === true ? name.toLowerCase() : | |
(val = elem.getAttributeNode( name )) && val.specified ? | |
val.value : | |
null; | |
} | |
}); | |
} | |
return Sizzle; | |
})( window ); | |
jQuery.find = Sizzle; | |
jQuery.expr = Sizzle.selectors; | |
jQuery.expr[":"] = jQuery.expr.pseudos; | |
jQuery.unique = Sizzle.uniqueSort; | |
jQuery.text = Sizzle.getText; | |
jQuery.isXMLDoc = Sizzle.isXML; | |
jQuery.contains = Sizzle.contains; | |
var rneedsContext = jQuery.expr.match.needsContext; | |
var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); | |
var risSimple = /^.[^:#\[\.,]*$/; | |
// Implement the identical functionality for filter and not | |
function winnow( elements, qualifier, not ) { | |
if ( jQuery.isFunction( qualifier ) ) { | |
return jQuery.grep( elements, function( elem, i ) { | |
/* jshint -W018 */ | |
return !!qualifier.call( elem, i, elem ) !== not; | |
}); | |
} | |
if ( qualifier.nodeType ) { | |
return jQuery.grep( elements, function( elem ) { | |
return ( elem === qualifier ) !== not; | |
}); | |
} | |
if ( typeof qualifier === "string" ) { | |
if ( risSimple.test( qualifier ) ) { | |
return jQuery.filter( qualifier, elements, not ); | |
} | |
qualifier = jQuery.filter( qualifier, elements ); | |
} | |
return jQuery.grep( elements, function( elem ) { | |
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; | |
}); | |
} | |
jQuery.filter = function( expr, elems, not ) { | |
var elem = elems[ 0 ]; | |
if ( not ) { | |
expr = ":not(" + expr + ")"; | |
} | |
return elems.length === 1 && elem.nodeType === 1 ? | |
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : | |
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { | |
return elem.nodeType === 1; | |
})); | |
}; | |
jQuery.fn.extend({ | |
find: function( selector ) { | |
var i, | |
ret = [], | |
self = this, | |
len = self.length; | |
if ( typeof selector !== "string" ) { | |
return this.pushStack( jQuery( selector ).filter(function() { | |
for ( i = 0; i < len; i++ ) { | |
if ( jQuery.contains( self[ i ], this ) ) { | |
return true; | |
} | |
} | |
}) ); | |
} | |
for ( i = 0; i < len; i++ ) { | |
jQuery.find( selector, self[ i ], ret ); | |
} | |
// Needed because $( selector, context ) becomes $( context ).find( selector ) | |
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); | |
ret.selector = this.selector ? this.selector + " " + selector : selector; | |
return ret; | |
}, | |
filter: function( selector ) { | |
return this.pushStack( winnow(this, selector || [], false) ); | |
}, | |
not: function( selector ) { | |
return this.pushStack( winnow(this, selector || [], true) ); | |
}, | |
is: function( selector ) { | |
return !!winnow( | |
this, | |
// If this is a positional/relative selector, check membership in the returned set | |
// so $("p:first").is("p:last") won't return true for a doc with two "p". | |
typeof selector === "string" && rneedsContext.test( selector ) ? | |
jQuery( selector ) : | |
selector || [], | |
false | |
).length; | |
} | |
}); | |
// Initialize a jQuery object | |
// A central reference to the root jQuery(document) | |
var rootjQuery, | |
// Use the correct document accordingly with window argument (sandbox) | |
document = window.document, | |
// A simple way to check for HTML strings | |
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) | |
// Strict HTML recognition (#11290: must start with <) | |
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, | |
init = jQuery.fn.init = function( selector, context ) { | |
var match, elem; | |
// HANDLE: $(""), $(null), $(undefined), $(false) | |
if ( !selector ) { | |
return this; | |
} | |
// Handle HTML strings | |
if ( typeof selector === "string" ) { | |
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { | |
// Assume that strings that start and end with <> are HTML and skip the regex check | |
match = [ null, selector, null ]; | |
} else { | |
match = rquickExpr.exec( selector ); | |
} | |
// Match html or make sure no context is specified for #id | |
if ( match && (match[1] || !context) ) { | |
// HANDLE: $(html) -> $(array) | |
if ( match[1] ) { | |
context = context instanceof jQuery ? context[0] : context; | |
// scripts is true for back-compat | |
// Intentionally let the error be thrown if parseHTML is not present | |
jQuery.merge( this, jQuery.parseHTML( | |
match[1], | |
context && context.nodeType ? context.ownerDocument || context : document, | |
true | |
) ); | |
// HANDLE: $(html, props) | |
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { | |
for ( match in context ) { | |
// Properties of context are called as methods if possible | |
if ( jQuery.isFunction( this[ match ] ) ) { | |
this[ match ]( context[ match ] ); | |
// ...and otherwise set as attributes | |
} else { | |
this.attr( match, context[ match ] ); | |
} | |
} | |
} | |
return this; | |
// HANDLE: $(#id) | |
} else { | |
elem = document.getElementById( match[2] ); | |
// Check parentNode to catch when Blackberry 4.6 returns | |
// nodes that are no longer in the document #6963 | |
if ( elem && elem.parentNode ) { | |
// Handle the case where IE and Opera return items | |
// by name instead of ID | |
if ( elem.id !== match[2] ) { | |
return rootjQuery.find( selector ); | |
} | |
// Otherwise, we inject the element directly into the jQuery object | |
this.length = 1; | |
this[0] = elem; | |
} | |
this.context = document; | |
this.selector = selector; | |
return this; | |
} | |
// HANDLE: $(expr, $(...)) | |
} else if ( !context || context.jquery ) { | |
return ( context || rootjQuery ).find( selector ); | |
// HANDLE: $(expr, context) | |
// (which is just equivalent to: $(context).find(expr) | |
} else { | |
return this.constructor( context ).find( selector ); | |
} | |
// HANDLE: $(DOMElement) | |
} else if ( selector.nodeType ) { | |
this.context = this[0] = selector; | |
this.length = 1; | |
return this; | |
// HANDLE: $(function) | |
// Shortcut for document ready | |
} else if ( jQuery.isFunction( selector ) ) { | |
return typeof rootjQuery.ready !== "undefined" ? | |
rootjQuery.ready( selector ) : | |
// Execute immediately if ready is not present | |
selector( jQuery ); | |
} | |
if ( selector.selector !== undefined ) { | |
this.selector = selector.selector; | |
this.context = selector.context; | |
} | |
return jQuery.makeArray( selector, this ); | |
}; | |
// Give the init function the jQuery prototype for later instantiation | |
init.prototype = jQuery.fn; | |
// Initialize central reference | |
rootjQuery = jQuery( document ); | |
var rparentsprev = /^(?:parents|prev(?:Until|All))/, | |
// methods guaranteed to produce a unique set when starting from a unique set | |
guaranteedUnique = { | |
children: true, | |
contents: true, | |
next: true, | |
prev: true | |
}; | |
jQuery.extend({ | |
dir: function( elem, dir, until ) { | |
var matched = [], | |
cur = elem[ dir ]; | |
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { | |
if ( cur.nodeType === 1 ) { | |
matched.push( cur ); | |
} | |
cur = cur[dir]; | |
} | |
return matched; | |
}, | |
sibling: function( n, elem ) { | |
var r = []; | |
for ( ; n; n = n.nextSibling ) { | |
if ( n.nodeType === 1 && n !== elem ) { | |
r.push( n ); | |
} | |
} | |
return r; | |
} | |
}); | |
jQuery.fn.extend({ | |
has: function( target ) { | |
var i, | |
targets = jQuery( target, this ), | |
len = targets.length; | |
return this.filter(function() { | |
for ( i = 0; i < len; i++ ) { | |
if ( jQuery.contains( this, targets[i] ) ) { | |
return true; | |
} | |
} | |
}); | |
}, | |
closest: function( selectors, context ) { | |
var cur, | |
i = 0, | |
l = this.length, | |
matched = [], | |
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? | |
jQuery( selectors, context || this.context ) : | |
0; | |
for ( ; i < l; i++ ) { | |
for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { | |
// Always skip document fragments | |
if ( cur.nodeType < 11 && (pos ? | |
pos.index(cur) > -1 : | |
// Don't pass non-elements to Sizzle | |
cur.nodeType === 1 && | |
jQuery.find.matchesSelector(cur, selectors)) ) { | |
matched.push( cur ); | |
break; | |
} | |
} | |
} | |
return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); | |
}, | |
// Determine the position of an element within | |
// the matched set of elements | |
index: function( elem ) { | |
// No argument, return index in parent | |
if ( !elem ) { | |
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; | |
} | |
// index in selector | |
if ( typeof elem === "string" ) { | |
return jQuery.inArray( this[0], jQuery( elem ) ); | |
} | |
// Locate the position of the desired element | |
return jQuery.inArray( | |
// If it receives a jQuery object, the first element is used | |
elem.jquery ? elem[0] : elem, this ); | |
}, | |
add: function( selector, context ) { | |
return this.pushStack( | |
jQuery.unique( | |
jQuery.merge( this.get(), jQuery( selector, context ) ) | |
) | |
); | |
}, | |
addBack: function( selector ) { | |
return this.add( selector == null ? | |
this.prevObject : this.prevObject.filter(selector) | |
); | |
} | |
}); | |
function sibling( cur, dir ) { | |
do { | |
cur = cur[ dir ]; | |
} while ( cur && cur.nodeType !== 1 ); | |
return cur; | |
} | |
jQuery.each({ | |
parent: function( elem ) { | |
var parent = elem.parentNode; | |
return parent && parent.nodeType !== 11 ? parent : null; | |
}, | |
parents: function( elem ) { | |
return jQuery.dir( elem, "parentNode" ); | |
}, | |
parentsUntil: function( elem, i, until ) { | |
return jQuery.dir( elem, "parentNode", until ); | |
}, | |
next: function( elem ) { | |
return sibling( elem, "nextSibling" ); | |
}, | |
prev: function( elem ) { | |
return sibling( elem, "previousSibling" ); | |
}, | |
nextAll: function( elem ) { | |
return jQuery.dir( elem, "nextSibling" ); | |
}, | |
prevAll: function( elem ) { | |
return jQuery.dir( elem, "previousSibling" ); | |
}, | |
nextUntil: function( elem, i, until ) { | |
return jQuery.dir( elem, "nextSibling", until ); | |
}, | |
prevUntil: function( elem, i, until ) { | |
return jQuery.dir( elem, "previousSibling", until ); | |
}, | |
siblings: function( elem ) { | |
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); | |
}, | |
children: function( elem ) { | |
return jQuery.sibling( elem.firstChild ); | |
}, | |
contents: function( elem ) { | |
return jQuery.nodeName( elem, "iframe" ) ? | |
elem.contentDocument || elem.contentWindow.document : | |
jQuery.merge( [], elem.childNodes ); | |
} | |
}, function( name, fn ) { | |
jQuery.fn[ name ] = function( until, selector ) { | |
var ret = jQuery.map( this, fn, until ); | |
if ( name.slice( -5 ) !== "Until" ) { | |
selector = until; | |
} | |
if ( selector && typeof selector === "string" ) { | |
ret = jQuery.filter( selector, ret ); | |
} | |
if ( this.length > 1 ) { | |
// Remove duplicates | |
if ( !guaranteedUnique[ name ] ) { | |
ret = jQuery.unique( ret ); | |
} | |
// Reverse order for parents* and prev-derivatives | |
if ( rparentsprev.test( name ) ) { | |
ret = ret.reverse(); | |
} | |
} | |
return this.pushStack( ret ); | |
}; | |
}); | |
var rnotwhite = (/\S+/g); | |
// String to Object options format cache | |
var optionsCache = {}; | |
// Convert String-formatted options into Object-formatted ones and store in cache | |
function createOptions( options ) { | |
var object = optionsCache[ options ] = {}; | |
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { | |
object[ flag ] = true; | |
}); | |
return object; | |
} | |
/* | |
* Create a callback list using the following parameters: | |
* | |
* options: an optional list of space-separated options that will change how | |
* the callback list behaves or a more traditional option object | |
* | |
* By default a callback list will act like an event callback list and can be | |
* "fired" multiple times. | |
* | |
* Possible options: | |
* | |
* once: will ensure the callback list can only be fired once (like a Deferred) | |
* | |
* memory: will keep track of previous values and will call any callback added | |
* after the list has been fired right away with the latest "memorized" | |
* values (like a Deferred) | |
* | |
* unique: will ensure a callback can only be added once (no duplicate in the list) | |
* | |
* stopOnFalse: interrupt callings when a callback returns false | |
* | |
*/ | |
jQuery.Callbacks = function( options ) { | |
// Convert options from String-formatted to Object-formatted if needed | |
// (we check in cache first) | |
options = typeof options === "string" ? | |
( optionsCache[ options ] || createOptions( options ) ) : | |
jQuery.extend( {}, options ); | |
var // Flag to know if list is currently firing | |
firing, | |
// Last fire value (for non-forgettable lists) | |
memory, | |
// Flag to know if list was already fired | |
fired, | |
// End of the loop when firing | |
firingLength, | |
// Index of currently firing callback (modified by remove if needed) | |
firingIndex, | |
// First callback to fire (used internally by add and fireWith) | |
firingStart, | |
// Actual callback list | |
list = [], | |
// Stack of fire calls for repeatable lists | |
stack = !options.once && [], | |
// Fire callbacks | |
fire = function( data ) { | |
memory = options.memory && data; | |
fired = true; | |
firingIndex = firingStart || 0; | |
firingStart = 0; | |
firingLength = list.length; | |
firing = true; | |
for ( ; list && firingIndex < firingLength; firingIndex++ ) { | |
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { | |
memory = false; // To prevent further calls using add | |
break; | |
} | |
} | |
firing = false; | |
if ( list ) { | |
if ( stack ) { | |
if ( stack.length ) { | |
fire( stack.shift() ); | |
} | |
} else if ( memory ) { | |
list = []; | |
} else { | |
self.disable(); | |
} | |
} | |
}, | |
// Actual Callbacks object | |
self = { | |
// Add a callback or a collection of callbacks to the list | |
add: function() { | |
if ( list ) { | |
// First, we save the current length | |
var start = list.length; | |
(function add( args ) { | |
jQuery.each( args, function( _, arg ) { | |
var type = jQuery.type( arg ); | |
if ( type === "function" ) { | |
if ( !options.unique || !self.has( arg ) ) { | |
list.push( arg ); | |
} | |
} else if ( arg && arg.length && type !== "string" ) { | |
// Inspect recursively | |
add( arg ); | |
} | |
}); | |
})( arguments ); | |
// Do we need to add the callbacks to the | |
// current firing batch? | |
if ( firing ) { | |
firingLength = list.length; | |
// With memory, if we're not firing then | |
// we should call right away | |
} else if ( memory ) { | |
firingStart = start; | |
fire( memory ); | |
} | |
} | |
return this; | |
}, | |
// Remove a callback from the list | |
remove: function() { | |
if ( list ) { | |
jQuery.each( arguments, function( _, arg ) { | |
var index; | |
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { | |
list.splice( index, 1 ); | |
// Handle firing indexes | |
if ( firing ) { | |
if ( index <= firingLength ) { | |
firingLength--; | |
} | |
if ( index <= firingIndex ) { | |
firingIndex--; | |
} | |
} | |
} | |
}); | |
} | |
return this; | |
}, | |
// Check if a given callback is in the list. | |
// If no argument is given, return whether or not list has callbacks attached. | |
has: function( fn ) { | |
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); | |
}, | |
// Remove all callbacks from the list | |
empty: function() { | |
list = []; | |
firingLength = 0; | |
return this; | |
}, | |
// Have the list do nothing anymore | |
disable: function() { | |
list = stack = memory = undefined; | |
return this; | |
}, | |
// Is it disabled? | |
disabled: function() { | |
return !list; | |
}, | |
// Lock the list in its current state | |
lock: function() { | |
stack = undefined; | |
if ( !memory ) { | |
self.disable(); | |
} | |
return this; | |
}, | |
// Is it locked? | |
locked: function() { | |
return !stack; | |
}, | |
// Call all callbacks with the given context and arguments | |
fireWith: function( context, args ) { | |
if ( list && ( !fired || stack ) ) { | |
args = args || []; | |
args = [ context, args.slice ? args.slice() : args ]; | |
if ( firing ) { | |
stack.push( args ); | |
} else { | |
fire( args ); | |
} | |
} | |
return this; | |
}, | |
// Call all the callbacks with the given arguments | |
fire: function() { | |
self.fireWith( this, arguments ); | |
return this; | |
}, | |
// To know if the callbacks have already been called at least once | |
fired: function() { | |
return !!fired; | |
} | |
}; | |
return self; | |
}; | |
jQuery.extend({ | |
Deferred: function( func ) { | |
var tuples = [ | |
// action, add listener, listener list, final state | |
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], | |
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], | |
[ "notify", "progress", jQuery.Callbacks("memory") ] | |
], | |
state = "pending", | |
promise = { | |
state: function() { | |
return state; | |
}, | |
always: function() { | |
deferred.done( arguments ).fail( arguments ); | |
return this; | |
}, | |
then: function( /* fnDone, fnFail, fnProgress */ ) { | |
var fns = arguments; | |
return jQuery.Deferred(function( newDefer ) { | |
jQuery.each( tuples, function( i, tuple ) { | |
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; | |
// deferred[ done | fail | progress ] for forwarding actions to newDefer | |
deferred[ tuple[1] ](function() { | |
var returned = fn && fn.apply( this, arguments ); | |
if ( returned && jQuery.isFunction( returned.promise ) ) { | |
returned.promise() | |
.done( newDefer.resolve ) | |
.fail( newDefer.reject ) | |
.progress( newDefer.notify ); | |
} else { | |
newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); | |
} | |
}); | |
}); | |
fns = null; | |
}).promise(); | |
}, | |
// Get a promise for this deferred | |
// If obj is provided, the promise aspect is added to the object | |
promise: function( obj ) { | |
return obj != null ? jQuery.extend( obj, promise ) : promise; | |
} | |
}, | |
deferred = {}; | |
// Keep pipe for back-compat | |
promise.pipe = promise.then; | |
// Add list-specific methods | |
jQuery.each( tuples, function( i, tuple ) { | |
var list = tuple[ 2 ], | |
stateString = tuple[ 3 ]; | |
// promise[ done | fail | progress ] = list.add | |
promise[ tuple[1] ] = list.add; | |
// Handle state | |
if ( stateString ) { | |
list.add(function() { | |
// state = [ resolved | rejected ] | |
state = stateString; | |
// [ reject_list | resolve_list ].disable; progress_list.lock | |
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); | |
} | |
// deferred[ resolve | reject | notify ] | |
deferred[ tuple[0] ] = function() { | |
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); | |
return this; | |
}; | |
deferred[ tuple[0] + "With" ] = list.fireWith; | |
}); | |
// Make the deferred a promise | |
promise.promise( deferred ); | |
// Call given func if any | |
if ( func ) { | |
func.call( deferred, deferred ); | |
} | |
// All done! | |
return deferred; | |
}, | |
// Deferred helper | |
when: function( subordinate /* , ..., subordinateN */ ) { | |
var i = 0, | |
resolveValues = slice.call( arguments ), | |
length = resolveValues.length, | |
// the count of uncompleted subordinates | |
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, | |
// the master Deferred. If resolveValues consist of only a single Deferred, just use that. | |
deferred = remaining === 1 ? subordinate : jQuery.Deferred(), | |
// Update function for both resolve and progress values | |
updateFunc = function( i, contexts, values ) { | |
return function( value ) { | |
contexts[ i ] = this; | |
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; | |
if ( values === progressValues ) { | |
deferred.notifyWith( contexts, values ); | |
} else if ( !(--remaining) ) { | |
deferred.resolveWith( contexts, values ); | |
} | |
}; | |
}, | |
progressValues, progressContexts, resolveContexts; | |
// add listeners to Deferred subordinates; treat others as resolved | |
if ( length > 1 ) { | |
progressValues = new Array( length ); | |
progressContexts = new Array( length ); | |
resolveContexts = new Array( length ); | |
for ( ; i < length; i++ ) { | |
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { | |
resolveValues[ i ].promise() | |
.done( updateFunc( i, resolveContexts, resolveValues ) ) | |
.fail( deferred.reject ) | |
.progress( updateFunc( i, progressContexts, progressValues ) ); | |
} else { | |
--remaining; | |
} | |
} | |
} | |
// if we're not waiting on anything, resolve the master | |
if ( !remaining ) { | |
deferred.resolveWith( resolveContexts, resolveValues ); | |
} | |
return deferred.promise(); | |
} | |
}); | |
// The deferred used on DOM ready | |
var readyList; | |
jQuery.fn.ready = function( fn ) { | |
// Add the callback | |
jQuery.ready.promise().done( fn ); | |
return this; | |
}; | |
jQuery.extend({ | |
// Is the DOM ready to be used? Set to true once it occurs. | |
isReady: false, | |
// A counter to track how many items to wait for before | |
// the ready event fires. See #6781 | |
readyWait: 1, | |
// Hold (or release) the ready event | |
holdReady: function( hold ) { | |
if ( hold ) { | |
jQuery.readyWait++; | |
} else { | |
jQuery.ready( true ); | |
} | |
}, | |
// Handle when the DOM is ready | |
ready: function( wait ) { | |
// Abort if there are pending holds or we're already ready | |
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { | |
return; | |
} | |
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). | |
if ( !document.body ) { | |
return setTimeout( jQuery.ready ); | |
} | |
// Remember that the DOM is ready | |
jQuery.isReady = true; | |
// If a normal DOM Ready event fired, decrement, and wait if need be | |
if ( wait !== true && --jQuery.readyWait > 0 ) { | |
return; | |
} | |
// If there are functions bound, to execute | |
readyList.resolveWith( document, [ jQuery ] ); | |
// Trigger any bound ready events | |
if ( jQuery.fn.trigger ) { | |
jQuery( document ).trigger("ready").off("ready"); | |
} | |
} | |
}); | |
/** | |
* Clean-up method for dom ready events | |
*/ | |
function detach() { | |
if ( document.addEventListener ) { | |
document.removeEventListener( "DOMContentLoaded", completed, false ); | |
window.removeEventListener( "load", completed, false ); | |
} else { | |
document.detachEvent( "onreadystatechange", completed ); | |
window.detachEvent( "onload", completed ); | |
} | |
} | |
/** | |
* The ready event handler and self cleanup method | |
*/ | |
function completed() { | |
// readyState === "complete" is good enough for us to call the dom ready in oldIE | |
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { | |
detach(); | |
jQuery.ready(); | |
} | |
} | |
jQuery.ready.promise = function( obj ) { | |
if ( !readyList ) { | |
readyList = jQuery.Deferred(); | |
// Catch cases where $(document).ready() is called after the browser event has already occurred. | |
// we once tried to use readyState "interactive" here, but it caused issues like the one | |
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 | |
if ( document.readyState === "complete" ) { | |
// Handle it asynchronously to allow scripts the opportunity to delay ready | |
setTimeout( jQuery.ready ); | |
// Standards-based browsers support DOMContentLoaded | |
} else if ( document.addEventListener ) { | |
// Use the handy event callback | |
document.addEventListener( "DOMContentLoaded", completed, false ); | |
// A fallback to window.onload, that will always work | |
window.addEventListener( "load", completed, false ); | |
// If IE event model is used | |
} else { | |
// Ensure firing before onload, maybe late but safe also for iframes | |
document.attachEvent( "onreadystatechange", completed ); | |
// A fallback to window.onload, that will always work | |
window.attachEvent( "onload", completed ); | |
// If IE and not a frame | |
// continually check to see if the document is ready | |
var top = false; | |
try { | |
top = window.frameElement == null && document.documentElement; | |
} catch(e) {} | |
if ( top && top.doScroll ) { | |
(function doScrollCheck() { | |
if ( !jQuery.isReady ) { | |
try { | |
// Use the trick by Diego Perini | |
// http://javascript.nwbox.com/IEContentLoaded/ | |
top.doScroll("left"); | |
} catch(e) { | |
return setTimeout( doScrollCheck, 50 ); | |
} | |
// detach all dom ready events | |
detach(); | |
// and execute any waiting functions | |
jQuery.ready(); | |
} | |
})(); | |
} | |
} | |
} | |
return readyList.promise( obj ); | |
}; | |
var strundefined = typeof undefined; | |
// Support: IE<9 | |
// Iteration over object's inherited properties before its own | |
var i; | |
for ( i in jQuery( support ) ) { | |
break; | |
} | |
support.ownLast = i !== "0"; | |
// Note: most support tests are defined in their respective modules. | |
// false until the test is run | |
support.inlineBlockNeedsLayout = false; | |
jQuery(function() { | |
// We need to execute this one support test ASAP because we need to know | |
// if body.style.zoom needs to be set. | |
var container, div, | |
body = document.getElementsByTagName("body")[0]; | |
if ( !body ) { | |
// Return for frameset docs that don't have a body | |
return; | |
} | |
// Setup | |
container = document.createElement( "div" ); | |
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; | |
div = document.createElement( "div" ); | |
body.appendChild( container ).appendChild( div ); | |
if ( typeof div.style.zoom !== strundefined ) { | |
// Support: IE<8 | |
// Check if natively block-level elements act like inline-block | |
// elements when setting their display to 'inline' and giving | |
// them layout | |
div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1"; | |
if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) { | |
// Prevent IE 6 from affecting layout for positioned elements #11048 | |
// Prevent IE from shrinking the body in IE 7 mode #12869 | |
// Support: IE<8 | |
body.style.zoom = 1; | |
} | |
} | |
body.removeChild( container ); | |
// Null elements to avoid leaks in IE | |
container = div = null; | |
}); | |
(function() { | |
var div = document.createElement( "div" ); | |
// Execute the test only if not already executed in another module. | |
if (support.deleteExpando == null) { | |
// Support: IE<9 | |
support.deleteExpando = true; | |
try { | |
delete div.test; | |
} catch( e ) { | |
support.deleteExpando = false; | |
} | |
} | |
// Null elements to avoid leaks in IE. | |
div = null; | |
})(); | |
/** | |
* Determines whether an object can have data | |
*/ | |
jQuery.acceptData = function( elem ) { | |
var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], | |
nodeType = +elem.nodeType || 1; | |
// Do not set data on non-element DOM nodes because it will not be cleared (#8335). | |
return nodeType !== 1 && nodeType !== 9 ? | |
false : | |
// Nodes accept data unless otherwise specified; rejection can be conditional | |
!noData || noData !== true && elem.getAttribute("classid") === noData; | |
}; | |
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, | |
rmultiDash = /([A-Z])/g; | |
function dataAttr( elem, key, data ) { | |
// If nothing was found internally, try to fetch any | |
// data from the HTML5 data-* attribute | |
if ( data === undefined && elem.nodeType === 1 ) { | |
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); | |
data = elem.getAttribute( name ); | |
if ( typeof data === "string" ) { | |
try { | |
data = data === "true" ? true : | |
data === "false" ? false : | |
data === "null" ? null : | |
// Only convert to a number if it doesn't change the string | |
+data + "" === data ? +data : | |
rbrace.test( data ) ? jQuery.parseJSON( data ) : | |
data; | |
} catch( e ) {} | |
// Make sure we set the data so it isn't changed later | |
jQuery.data( elem, key, data ); | |
} else { | |
data = undefined; | |
} | |
} | |
return data; | |
} | |
// checks a cache object for emptiness | |
function isEmptyDataObject( obj ) { | |
var name; | |
for ( name in obj ) { | |
// if the public data object is empty, the private is still empty | |
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { | |
continue; | |
} | |
if ( name !== "toJSON" ) { | |
return false; | |
} | |
} | |
return true; | |
} | |
function internalData( elem, name, data, pvt /* Internal Use Only */ ) { | |
if ( !jQuery.acceptData( elem ) ) { | |
return; | |
} | |
var ret, thisCache, | |
internalKey = jQuery.expando, | |
// We have to handle DOM nodes and JS objects differently because IE6-7 | |
// can't GC object references properly across the DOM-JS boundary | |
isNode = elem.nodeType, | |
// Only DOM nodes need the global jQuery cache; JS object data is | |
// attached directly to the object so GC can occur automatically | |
cache = isNode ? jQuery.cache : elem, | |
// Only defining an ID for JS objects if its cache already exists allows | |
// the code to shortcut on the same path as a DOM node with no cache | |
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; | |
// Avoid doing any more work than we need to when trying to get data on an | |
// object that has no data at all | |
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { | |
return; | |
} | |
if ( !id ) { | |
// Only DOM nodes need a new unique ID for each element since their data | |
// ends up in the global cache | |
if ( isNode ) { | |
id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; | |
} else { | |
id = internalKey; | |
} | |
} | |
if ( !cache[ id ] ) { | |
// Avoid exposing jQuery metadata on plain JS objects when the object | |
// is serialized using JSON.stringify | |
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; | |
} | |
// An object can be passed to jQuery.data instead of a key/value pair; this gets | |
// shallow copied over onto the existing cache | |
if ( typeof name === "object" || typeof name === "function" ) { | |
if ( pvt ) { | |
cache[ id ] = jQuery.extend( cache[ id ], name ); | |
} else { | |
cache[ id ].data = jQuery.extend( cache[ id ].data, name ); | |
} | |
} | |
thisCache = cache[ id ]; | |
// jQuery data() is stored in a separate object inside the object's internal data | |
// cache in order to avoid key collisions between internal data and user-defined | |
// data. | |
if ( !pvt ) { | |
if ( !thisCache.data ) { | |
thisCache.data = {}; | |
} | |
thisCache = thisCache.data; | |
} | |
if ( data !== undefined ) { | |
thisCache[ jQuery.camelCase( name ) ] = data; | |
} | |
// Check for both converted-to-camel and non-converted data property names | |
// If a data property was specified | |
if ( typeof name === "string" ) { | |
// First Try to find as-is property data | |
ret = thisCache[ name ]; | |
// Test for null|undefined property data | |
if ( ret == null ) { | |
// Try to find the camelCased property | |
ret = thisCache[ jQuery.camelCase( name ) ]; | |
} | |
} else { | |
ret = thisCache; | |
} | |
return ret; | |
} | |
function internalRemoveData( elem, name, pvt ) { | |
if ( !jQuery.acceptData( elem ) ) { | |
return; | |
} | |
var thisCache, i, | |
isNode = elem.nodeType, | |
// See jQuery.data for more information | |
cache = isNode ? jQuery.cache : elem, | |
id = isNode ? elem[ jQuery.expando ] : jQuery.expando; | |
// If there is already no cache entry for this object, there is no | |
// purpose in continuing | |
if ( !cache[ id ] ) { | |
return; | |
} | |
if ( name ) { | |
thisCache = pvt ? cache[ id ] : cache[ id ].data; | |
if ( thisCache ) { | |
// Support array or space separated string names for data keys | |
if ( !jQuery.isArray( name ) ) { | |
// try the string as a key before any manipulation | |
if ( name in thisCache ) { | |
name = [ name ]; | |
} else { | |
// split the camel cased version by spaces unless a key with the spaces exists | |
name = jQuery.camelCase( name ); | |
if ( name in thisCache ) { | |
name = [ name ]; | |
} else { | |
name = name.split(" "); | |
} | |
} | |
} else { | |
// If "name" is an array of keys... | |
// When data is initially created, via ("key", "val") signature, | |
// keys will be converted to camelCase. | |
// Since there is no way to tell _how_ a key was added, remove | |
// both plain key and camelCase key. #12786 | |
// This will only penalize the array argument path. | |
name = name.concat( jQuery.map( name, jQuery.camelCase ) ); | |
} | |
i = name.length; | |
while ( i-- ) { | |
delete thisCache[ name[i] ]; | |
} | |
// If there is no data left in the cache, we want to continue | |
// and let the cache object itself get destroyed | |
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { | |
return; | |
} | |
} | |
} | |
// See jQuery.data for more information | |
if ( !pvt ) { | |
delete cache[ id ].data; | |
// Don't destroy the parent cache unless the internal data object | |
// had been the only thing left in it | |
if ( !isEmptyDataObject( cache[ id ] ) ) { | |
return; | |
} | |
} | |
// Destroy the cache | |
if ( isNode ) { | |
jQuery.cleanData( [ elem ], true ); | |
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) | |
/* jshint eqeqeq: false */ | |
} else if ( support.deleteExpando || cache != cache.window ) { | |
/* jshint eqeqeq: true */ | |
delete cache[ id ]; | |
// When all else fails, null | |
} else { | |
cache[ id ] = null; | |
} | |
} | |
jQuery.extend({ | |
cache: {}, | |
// The following elements (space-suffixed to avoid Object.prototype collisions) | |
// throw uncatchable exceptions if you attempt to set expando properties | |
noData: { | |
"applet ": true, | |
"embed ": true, | |
// ...but Flash objects (which have this classid) *can* handle expandos | |
"object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" | |
}, | |
hasData: function( elem ) { | |
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; | |
return !!elem && !isEmptyDataObject( elem ); | |
}, | |
data: function( elem, name, data ) { | |
return internalData( elem, name, data ); | |
}, | |
removeData: function( elem, name ) { | |
return internalRemoveData( elem, name ); | |
}, | |
// For internal use only. | |
_data: function( elem, name, data ) { | |
return internalData( elem, name, data, true ); | |
}, | |
_removeData: function( elem, name ) { | |
return internalRemoveData( elem, name, true ); | |
} | |
}); | |
jQuery.fn.extend({ | |
data: function( key, value ) { | |
var i, name, data, | |
elem = this[0], | |
attrs = elem && elem.attributes; | |
// Special expections of .data basically thwart jQuery.access, | |
// so implement the relevant behavior ourselves | |
// Gets all values | |
if ( key === undefined ) { | |
if ( this.length ) { | |
data = jQuery.data( elem ); | |
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { | |
i = attrs.length; | |
while ( i-- ) { | |
name = attrs[i].name; | |
if ( name.indexOf("data-") === 0 ) { | |
name = jQuery.camelCase( name.slice(5) ); | |
dataAttr( elem, name, data[ name ] ); | |
} | |
} | |
jQuery._data( elem, "parsedAttrs", true ); | |
} | |
} | |
return data; | |
} | |
// Sets multiple values | |
if ( typeof key === "object" ) { | |
return this.each(function() { | |
jQuery.data( this, key ); | |
}); | |
} | |
return arguments.length > 1 ? | |
// Sets one value | |
this.each(function() { | |
jQuery.data( this, key, value ); | |
}) : | |
// Gets one value | |
// Try to fetch any internally stored data first | |
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; | |
}, | |
removeData: function( key ) { | |
return this.each(function() { | |
jQuery.removeData( this, key ); | |
}); | |
} | |
}); | |
jQuery.extend({ | |
queue: function( elem, type, data ) { | |
var queue; | |
if ( elem ) { | |
type = ( type || "fx" ) + "queue"; | |
queue = jQuery._data( elem, type ); | |
// Speed up dequeue by getting out quickly if this is just a lookup | |
if ( data ) { | |
if ( !queue || jQuery.isArray(data) ) { | |
queue = jQuery._data( elem, type, jQuery.makeArray(data) ); | |
} else { | |
queue.push( data ); | |
} | |
} | |
return queue || []; | |
} | |
}, | |
dequeue: function( elem, type ) { | |
type = type || "fx"; | |
var queue = jQuery.queue( elem, type ), | |
startLength = queue.length, | |
fn = queue.shift(), | |
hooks = jQuery._queueHooks( elem, type ), | |
next = function() { | |
jQuery.dequeue( elem, type ); | |
}; | |
// If the fx queue is dequeued, always remove the progress sentinel | |
if ( fn === "inprogress" ) { | |
fn = queue.shift(); | |
startLength--; | |
} | |
if ( fn ) { | |
// Add a progress sentinel to prevent the fx queue from being | |
// automatically dequeued | |
if ( type === "fx" ) { | |
queue.unshift( "inprogress" ); | |
} | |
// clear up the last queue stop function | |
delete hooks.stop; | |
fn.call( elem, next, hooks ); | |
} | |
if ( !startLength && hooks ) { | |
hooks.empty.fire(); | |
} | |
}, | |
// not intended for public consumption - generates a queueHooks object, or returns the current one | |
_queueHooks: function( elem, type ) { | |
var key = type + "queueHooks"; | |
return jQuery._data( elem, key ) || jQuery._data( elem, key, { | |
empty: jQuery.Callbacks("once memory").add(function() { | |
jQuery._removeData( elem, type + "queue" ); | |
jQuery._removeData( elem, key ); | |
}) | |
}); | |
} | |
}); | |
jQuery.fn.extend({ | |
queue: function( type, data ) { | |
var setter = 2; | |
if ( typeof type !== "string" ) { | |
data = type; | |
type = "fx"; | |
setter--; | |
} | |
if ( arguments.length < setter ) { | |
return jQuery.queue( this[0], type ); | |
} | |
return data === undefined ? | |
this : | |
this.each(function() { | |
var queue = jQuery.queue( this, type, data ); | |
// ensure a hooks for this queue | |
jQuery._queueHooks( this, type ); | |
if ( type === "fx" && queue[0] !== "inprogress" ) { | |
jQuery.dequeue( this, type ); | |
} | |
}); | |
}, | |
dequeue: function( type ) { | |
return this.each(function() { | |
jQuery.dequeue( this, type ); | |
}); | |
}, | |
clearQueue: function( type ) { | |
return this.queue( type || "fx", [] ); | |
}, | |
// Get a promise resolved when queues of a certain type | |
// are emptied (fx is the type by default) | |
promise: function( type, obj ) { | |
var tmp, | |
count = 1, | |
defer = jQuery.Deferred(), | |
elements = this, | |
i = this.length, | |
resolve = function() { | |
if ( !( --count ) ) { | |
defer.resolveWith( elements, [ elements ] ); | |
} | |
}; | |
if ( typeof type !== "string" ) { | |
obj = type; | |
type = undefined; | |
} | |
type = type || "fx"; | |
while ( i-- ) { | |
tmp = jQuery._data( elements[ i ], type + "queueHooks" ); | |
if ( tmp && tmp.empty ) { | |
count++; | |
tmp.empty.add( resolve ); | |
} | |
} | |
resolve(); | |
return defer.promise( obj ); | |
} | |
}); | |
var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; | |
var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; | |
var isHidden = function( elem, el ) { | |
// isHidden might be called from jQuery#filter function; | |
// in that case, element will be second argument | |
elem = el || elem; | |
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); | |
}; | |
// Multifunctional method to get and set values of a collection | |
// The value/s can optionally be executed if it's a function | |
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { | |
var i = 0, | |
length = elems.length, | |
bulk = key == null; | |
// Sets many values | |
if ( jQuery.type( key ) === "object" ) { | |
chainable = true; | |
for ( i in key ) { | |
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); | |
} | |
// Sets one value | |
} else if ( value !== undefined ) { | |
chainable = true; | |
if ( !jQuery.isFunction( value ) ) { | |
raw = true; | |
} | |
if ( bulk ) { | |
// Bulk operations run against the entire set | |
if ( raw ) { | |
fn.call( elems, value ); | |
fn = null; | |
// ...except when executing function values | |
} else { | |
bulk = fn; | |
fn = function( elem, key, value ) { | |
return bulk.call( jQuery( elem ), value ); | |
}; | |
} | |
} | |
if ( fn ) { | |
for ( ; i < length; i++ ) { | |
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); | |
} | |
} | |
} | |
return chainable ? | |
elems : | |
// Gets | |
bulk ? | |
fn.call( elems ) : | |
length ? fn( elems[0], key ) : emptyGet; | |
}; | |
var rcheckableType = (/^(?:checkbox|radio)$/i); | |
(function() { | |
var fragment = document.createDocumentFragment(), | |
div = document.createElement("div"), | |
input = document.createElement("input"); | |
// Setup | |
div.setAttribute( "className", "t" ); | |
div.innerHTML = " <link/><table></table><a href='/a'>a</a>"; | |
// IE strips leading whitespace when .innerHTML is used | |
support.leadingWhitespace = div.firstChild.nodeType === 3; | |
// Make sure that tbody elements aren't automatically inserted | |
// IE will insert them into empty tables | |
support.tbody = !div.getElementsByTagName( "tbody" ).length; | |
// Make sure that link elements get serialized correctly by innerHTML | |
// This requires a wrapper element in IE | |
support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; | |
// Makes sure cloning an html5 element does not cause problems | |
// Where outerHTML is undefined, this still works | |
support.html5Clone = | |
document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; | |
// Check if a disconnected checkbox will retain its checked | |
// value of true after appended to the DOM (IE6/7) | |
input.type = "checkbox"; | |
input.checked = true; | |
fragment.appendChild( input ); | |
support.appendChecked = input.checked; | |
// Make sure textarea (and checkbox) defaultValue is properly cloned | |
// Support: IE6-IE11+ | |
div.innerHTML = "<textarea>x</textarea>"; | |
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; | |
// #11217 - WebKit loses check when the name is after the checked attribute | |
fragment.appendChild( div ); | |
div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; | |
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 | |
// old WebKit doesn't clone checked state correctly in fragments | |
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; | |
// Support: IE<9 | |
// Opera does not clone events (and typeof div.attachEvent === undefined). | |
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click() | |
support.noCloneEvent = true; | |
if ( div.attachEvent ) { | |
div.attachEvent( "onclick", function() { | |
support.noCloneEvent = false; | |
}); | |
div.cloneNode( true ).click(); | |
} | |
// Execute the test only if not already executed in another module. | |
if (support.deleteExpando == null) { | |
// Support: IE<9 | |
support.deleteExpando = true; | |
try { | |
delete div.test; | |
} catch( e ) { | |
support.deleteExpando = false; | |
} | |
} | |
// Null elements to avoid leaks in IE. | |
fragment = div = input = null; | |
})(); | |
(function() { | |
var i, eventName, | |
div = document.createElement( "div" ); | |
// Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) | |
for ( i in { submit: true, change: true, focusin: true }) { | |
eventName = "on" + i; | |
if ( !(support[ i + "Bubbles" ] = eventName in window) ) { | |
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) | |
div.setAttribute( eventName, "t" ); | |
support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; | |
} | |
} | |
// Null elements to avoid leaks in IE. | |
div = null; | |
})(); | |
var rformElems = /^(?:input|select|textarea)$/i, | |
rkeyEvent = /^key/, | |
rmouseEvent = /^(?:mouse|contextmenu)|click/, | |
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, | |
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; | |
function returnTrue() { | |
return true; | |
} | |
function returnFalse() { | |
return false; | |
} | |
function safeActiveElement() { | |
try { | |
return document.activeElement; | |
} catch ( err ) { } | |
} | |
/* | |
* Helper functions for managing events -- not part of the public interface. | |
* Props to Dean Edwards' addEvent library for many of the ideas. | |
*/ | |
jQuery.event = { | |
global: {}, | |
add: function( elem, types, handler, data, selector ) { | |
var tmp, events, t, handleObjIn, | |
special, eventHandle, handleObj, | |
handlers, type, namespaces, origType, | |
elemData = jQuery._data( elem ); | |
// Don't attach events to noData or text/comment nodes (but allow plain objects) | |
if ( !elemData ) { | |
return; | |
} | |
// Caller can pass in an object of custom data in lieu of the handler | |
if ( handler.handler ) { | |
handleObjIn = handler; | |
handler = handleObjIn.handler; | |
selector = handleObjIn.selector; | |
} | |
// Make sure that the handler has a unique ID, used to find/remove it later | |
if ( !handler.guid ) { | |
handler.guid = jQuery.guid++; | |
} | |
// Init the element's event structure and main handler, if this is the first | |
if ( !(events = elemData.events) ) { | |
events = elemData.events = {}; | |
} | |
if ( !(eventHandle = elemData.handle) ) { | |
eventHandle = elemData.handle = function( e ) { | |
// Discard the second event of a jQuery.event.trigger() and | |
// when an event is called after a page has unloaded | |
return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? | |
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : | |
undefined; | |
}; | |
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events | |
eventHandle.elem = elem; | |
} | |
// Handle multiple events separated by a space | |
types = ( types || "" ).match( rnotwhite ) || [ "" ]; | |
t = types.length; | |
while ( t-- ) { | |
tmp = rtypenamespace.exec( types[t] ) || []; | |
type = origType = tmp[1]; | |
namespaces = ( tmp[2] || "" ).split( "." ).sort(); | |
// There *must* be a type, no attaching namespace-only handlers | |
if ( !type ) { | |
continue; | |
} | |
// If event changes its type, use the special event handlers for the changed type | |
special = jQuery.event.special[ type ] || {}; | |
// If selector defined, determine special event api type, otherwise given type | |
type = ( selector ? special.delegateType : special.bindType ) || type; | |
// Update special based on newly reset type | |
special = jQuery.event.special[ type ] || {}; | |
// handleObj is passed to all event handlers | |
handleObj = jQuery.extend({ | |
type: type, | |
origType: origType, | |
data: data, | |
handler: handler, | |
guid: handler.guid, | |
selector: selector, | |
needsContext: selector && jQuery.expr.match.needsContext.test( selector ), | |
namespace: namespaces.join(".") | |
}, handleObjIn ); | |
// Init the event handler queue if we're the first | |
if ( !(handlers = events[ type ]) ) { | |
handlers = events[ type ] = []; | |
handlers.delegateCount = 0; | |
// Only use addEventListener/attachEvent if the special events handler returns false | |
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { | |
// Bind the global event handler to the element | |
if ( elem.addEventListener ) { | |
elem.addEventListener( type, eventHandle, false ); | |
} else if ( elem.attachEvent ) { | |
elem.attachEvent( "on" + type, eventHandle ); | |
} | |
} | |
} | |
if ( special.add ) { | |
special.add.call( elem, handleObj ); | |
if ( !handleObj.handler.guid ) { | |
handleObj.handler.guid = handler.guid; | |
} | |
} | |
// Add to the element's handler list, delegates in front | |
if ( selector ) { | |
handlers.splice( handlers.delegateCount++, 0, handleObj ); | |
} else { | |
handlers.push( handleObj ); | |
} | |
// Keep track of which events have ever been used, for event optimization | |
jQuery.event.global[ type ] = true; | |
} | |
// Nullify elem to prevent memory leaks in IE | |
elem = null; | |
}, | |
// Detach an event or set of events from an element | |
remove: function( elem, types, handler, selector, mappedTypes ) { | |
var j, handleObj, tmp, | |
origCount, t, events, | |
special, handlers, type, | |
namespaces, origType, | |
elemData = jQuery.hasData( elem ) && jQuery._data( elem ); | |
if ( !elemData || !(events = elemData.events) ) { | |
return; | |
} | |
// Once for each type.namespace in types; type may be omitted | |
types = ( types || "" ).match( rnotwhite ) || [ "" ]; | |
t = types.length; | |
while ( t-- ) { | |
tmp = rtypenamespace.exec( types[t] ) || []; | |
type = origType = tmp[1]; | |
namespaces = ( tmp[2] || "" ).split( "." ).sort(); | |
// Unbind all events (on this namespace, if provided) for the element | |
if ( !type ) { | |
for ( type in events ) { | |
jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); | |
} | |
continue; | |
} | |
special = jQuery.event.special[ type ] || {}; | |
type = ( selector ? special.delegateType : special.bindType ) || type; | |
handlers = events[ type ] || []; | |
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); | |
// Remove matching events | |
origCount = j = handlers.length; | |
while ( j-- ) { | |
handleObj = handlers[ j ]; | |
if ( ( mappedTypes || origType === handleObj.origType ) && | |
( !handler || handler.guid === handleObj.guid ) && | |
( !tmp || tmp.test( handleObj.namespace ) ) && | |
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { | |
handlers.splice( j, 1 ); | |
if ( handleObj.selector ) { | |
handlers.delegateCount--; | |
} | |
if ( special.remove ) { | |
special.remove.call( elem, handleObj ); | |
} | |
} | |
} | |
// Remove generic event handler if we removed something and no more handlers exist | |
// (avoids potential for endless recursion during removal of special event handlers) | |
if ( origCount && !handlers.length ) { | |
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { | |
jQuery.removeEvent( elem, type, elemData.handle ); | |
} | |
delete events[ type ]; | |
} | |
} | |
// Remove the expando if it's no longer used | |
if ( jQuery.isEmptyObject( events ) ) { | |
delete elemData.handle; | |
// removeData also checks for emptiness and clears the expando if empty | |
// so use it instead of delete | |
jQuery._removeData( elem, "events" ); | |
} | |
}, | |
trigger: function( event, data, elem, onlyHandlers ) { | |
var handle, ontype, cur, | |
bubbleType, special, tmp, i, | |
eventPath = [ elem || document ], | |
type = hasOwn.call( event, "type" ) ? event.type : event, | |
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; | |
cur = tmp = elem = elem || document; | |
// Don't do events on text and comment nodes | |
if ( elem.nodeType === 3 || elem.nodeType === 8 ) { | |
return; | |
} | |
// focus/blur morphs to focusin/out; ensure we're not firing them right now | |
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { | |
return; | |
} | |
if ( type.indexOf(".") >= 0 ) { | |
// Namespaced trigger; create a regexp to match event type in handle() | |
namespaces = type.split("."); | |
type = namespaces.shift(); | |
namespaces.sort(); | |
} | |
ontype = type.indexOf(":") < 0 && "on" + type; | |
// Caller can pass in a jQuery.Event object, Object, or just an event type string | |
event = event[ jQuery.expando ] ? | |
event : | |
new jQuery.Event( type, typeof event === "object" && event ); | |
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) | |
event.isTrigger = onlyHandlers ? 2 : 3; | |
event.namespace = namespaces.join("."); | |
event.namespace_re = event.namespace ? | |
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : | |
null; | |
// Clean up the event in case it is being reused | |
event.result = undefined; | |
if ( !event.target ) { | |
event.target = elem; | |
} | |
// Clone any incoming data and prepend the event, creating the handler arg list | |
data = data == null ? | |
[ event ] : | |
jQuery.makeArray( data, [ event ] ); | |
// Allow special events to draw outside the lines | |
special = jQuery.event.special[ type ] || {}; | |
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { | |
return; | |
} | |
// Determine event propagation path in advance, per W3C events spec (#9951) | |
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724) | |
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { | |
bubbleType = special.delegateType || type; | |
if ( !rfocusMorph.test( bubbleType + type ) ) { | |
cur = cur.parentNode; | |
} | |
for ( ; cur; cur = cur.parentNode ) { | |
eventPath.push( cur ); | |
tmp = cur; | |
} | |
// Only add window if we got to document (e.g., not plain obj or detached DOM) | |
if ( tmp === (elem.ownerDocument || document) ) { | |
eventPath.push( tmp.defaultView || tmp.parentWindow || window ); | |
} | |
} | |
// Fire handlers on the event path | |
i = 0; | |
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { | |
event.type = i > 1 ? | |
bubbleType : | |
special.bindType || type; | |
// jQuery handler | |
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); | |
if ( handle ) { | |
handle.apply( cur, data ); | |
} | |
// Native handler | |
handle = ontype && cur[ ontype ]; | |
if ( handle && handle.apply && jQuery.acceptData( cur ) ) { | |
event.result = handle.apply( cur, data ); | |
if ( event.result === false ) { | |
event.preventDefault(); | |
} | |
} | |
} | |
event.type = type; | |
// If nobody prevented the default action, do it now | |
if ( !onlyHandlers && !event.isDefaultPrevented() ) { | |
if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && | |
jQuery.acceptData( elem ) ) { | |
// Call a native DOM method on the target with the same name name as the event. | |
// Can't use an .isFunction() check here because IE6/7 fails that test. | |
// Don't do default actions on window, that's where global variables be (#6170) | |
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { | |
// Don't re-trigger an onFOO event when we call its FOO() method | |
tmp = elem[ ontype ]; | |
if ( tmp ) { | |
elem[ ontype ] = null; | |
} | |
// Prevent re-triggering of the same event, since we already bubbled it above | |
jQuery.event.triggered = type; | |
try { | |
elem[ type ](); | |
} catch ( e ) { | |
// IE<9 dies on focus/blur to hidden element (#1486,#12518) | |
// only reproducible on winXP IE8 native, not IE9 in IE8 mode | |
} | |
jQuery.event.triggered = undefined; | |
if ( tmp ) { | |
elem[ ontype ] = tmp; | |
} | |
} | |
} | |
} | |
return event.result; | |
}, | |
dispatch: function( event ) { | |
// Make a writable jQuery.Event from the native event object | |
event = jQuery.event.fix( event ); | |
var i, ret, handleObj, matched, j, | |
handlerQueue = [], | |
args = slice.call( arguments ), | |
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], | |
special = jQuery.event.special[ event.type ] || {}; | |
// Use the fix-ed jQuery.Event rather than the (read-only) native event | |
args[0] = event; | |
event.delegateTarget = this; | |
// Call the preDispatch hook for the mapped type, and let it bail if desired | |
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { | |
return; | |
} | |
// Determine handlers | |
handlerQueue = jQuery.event.handlers.call( this, event, handlers ); | |
// Run delegates first; they may want to stop propagation beneath us | |
i = 0; | |
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { | |
event.currentTarget = matched.elem; | |
j = 0; | |
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { | |
// Triggered event must either 1) have no namespace, or | |
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). | |
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { | |
event.handleObj = handleObj; | |
event.data = handleObj.data; | |
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) | |
.apply( matched.elem, args ); | |
if ( ret !== undefined ) { | |
if ( (event.result = ret) === false ) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
} | |
} | |
} | |
} | |
} | |
// Call the postDispatch hook for the mapped type | |
if ( special.postDispatch ) { | |
special.postDispatch.call( this, event ); | |
} | |
return event.result; | |
}, | |
handlers: function( event, handlers ) { | |
var sel, handleObj, matches, i, | |
handlerQueue = [], | |
delegateCount = handlers.delegateCount, | |
cur = event.target; | |
// Find delegate handlers | |
// Black-hole SVG <use> instance trees (#13180) | |
// Avoid non-left-click bubbling in Firefox (#3861) | |
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { | |
/* jshint eqeqeq: false */ | |
for ( ; cur != this; cur = cur.parentNode || this ) { | |
/* jshint eqeqeq: true */ | |
// Don't check non-elements (#13208) | |
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) | |
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { | |
matches = []; | |
for ( i = 0; i < delegateCount; i++ ) { | |
handleObj = handlers[ i ]; | |
// Don't conflict with Object.prototype properties (#13203) | |
sel = handleObj.selector + " "; | |
if ( matches[ sel ] === undefined ) { | |
matches[ sel ] = handleObj.needsContext ? | |
jQuery( sel, this ).index( cur ) >= 0 : | |
jQuery.find( sel, this, null, [ cur ] ).length; | |
} | |
if ( matches[ sel ] ) { | |
matches.push( handleObj ); | |
} | |
} | |
if ( matches.length ) { | |
handlerQueue.push({ elem: cur, handlers: matches }); | |
} | |
} | |
} | |
} | |
// Add the remaining (directly-bound) handlers | |
if ( delegateCount < handlers.length ) { | |
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); | |
} | |
return handlerQueue; | |
}, | |
fix: function( event ) { | |
if ( event[ jQuery.expando ] ) { | |
return event; | |
} | |
// Create a writable copy of the event object and normalize some properties | |
var i, prop, copy, | |
type = event.type, | |
originalEvent = event, | |
fixHook = this.fixHooks[ type ]; | |
if ( !fixHook ) { | |
this.fixHooks[ type ] = fixHook = | |
rmouseEvent.test( type ) ? this.mouseHooks : | |
rkeyEvent.test( type ) ? this.keyHooks : | |
{}; | |
} | |
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; | |
event = new jQuery.Event( originalEvent ); | |
i = copy.length; | |
while ( i-- ) { | |
prop = copy[ i ]; | |
event[ prop ] = originalEvent[ prop ]; | |
} | |
// Support: IE<9 | |
// Fix target property (#1925) | |
if ( !event.target ) { | |
event.target = originalEvent.srcElement || document; | |
} | |
// Support: Chrome 23+, Safari? | |
// Target should not be a text node (#504, #13143) | |
if ( event.target.nodeType === 3 ) { | |
event.target = event.target.parentNode; | |
} | |
// Support: IE<9 | |
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328) | |
event.metaKey = !!event.metaKey; | |
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; | |
}, | |
// Includes some event props shared by KeyEvent and MouseEvent | |
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), | |
fixHooks: {}, | |
keyHooks: { | |
props: "char charCode key keyCode".split(" "), | |
filter: function( event, original ) { | |
// Add which for key events | |
if ( event.which == null ) { | |
event.which = original.charCode != null ? original.charCode : original.keyCode; | |
} | |
return event; | |
} | |
}, | |
mouseHooks: { | |
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), | |
filter: function( event, original ) { | |
var body, eventDoc, doc, | |
button = original.button, | |
fromElement = original.fromElement; | |
// Calculate pageX/Y if missing and clientX/Y available | |
if ( event.pageX == null && original.clientX != null ) { | |
eventDoc = event.target.ownerDocument || document; | |
doc = eventDoc.documentElement; | |
body = eventDoc.body; | |
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); | |
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); | |
} | |
// Add relatedTarget, if necessary | |
if ( !event.relatedTarget && fromElement ) { | |
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; | |
} | |
// Add which for click: 1 === left; 2 === middle; 3 === right | |
// Note: button is not normalized, so don't use it | |
if ( !event.which && button !== undefined ) { | |
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); | |
} | |
return event; | |
} | |
}, | |
special: { | |
load: { | |
// Prevent triggered image.load events from bubbling to window.load | |
noBubble: true | |
}, | |
focus: { | |
// Fire native event if possible so blur/focus sequence is correct | |
trigger: function() { | |
if ( this !== safeActiveElement() && this.focus ) { | |
try { | |
this.focus(); | |
return false; | |
} catch ( e ) { | |
// Support: IE<9 | |
// If we error on focus to hidden element (#1486, #12518), | |
// let .trigger() run the handlers | |
} | |
} | |
}, | |
delegateType: "focusin" | |
}, | |
blur: { | |
trigger: function() { | |
if ( this === safeActiveElement() && this.blur ) { | |
this.blur(); | |
return false; | |
} | |
}, | |
delegateType: "focusout" | |
}, | |
click: { | |
// For checkbox, fire native event so checked state will be right | |
trigger: function() { | |
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { | |
this.click(); | |
return false; | |
} | |
}, | |
// For cross-browser consistency, don't fire native .click() on links | |
_default: function( event ) { | |
return jQuery.nodeName( event.target, "a" ); | |
} | |
}, | |
beforeunload: { | |
postDispatch: function( event ) { | |
// Even when returnValue equals to undefined Firefox will still show alert | |
if ( event.result !== undefined ) { | |
event.originalEvent.returnValue = event.result; | |
} | |
} | |
} | |
}, | |
simulate: function( type, elem, event, bubble ) { | |
// Piggyback on a donor event to simulate a different one. | |
// Fake originalEvent to avoid donor's stopPropagation, but if the | |
// simulated event prevents default then we do the same on the donor. | |
var e = jQuery.extend( | |
new jQuery.Event(), | |
event, | |
{ | |
type: type, | |
isSimulated: true, | |
originalEvent: {} | |
} | |
); | |
if ( bubble ) { | |
jQuery.event.trigger( e, null, elem ); | |
} else { | |
jQuery.event.dispatch.call( elem, e ); | |
} | |
if ( e.isDefaultPrevented() ) { | |
event.preventDefault(); | |
} | |
} | |
}; | |
jQuery.removeEvent = document.removeEventListener ? | |
function( elem, type, handle ) { | |
if ( elem.removeEventListener ) { | |
elem.removeEventListener( type, handle, false ); | |
} | |
} : | |
function( elem, type, handle ) { | |
var name = "on" + type; | |
if ( elem.detachEvent ) { | |
// #8545, #7054, preventing memory leaks for custom events in IE6-8 | |
// detachEvent needed property on element, by name of that event, to properly expose it to GC | |
if ( typeof elem[ name ] === strundefined ) { | |
elem[ name ] = null; | |
} | |
elem.detachEvent( name, handle ); | |
} | |
}; | |
jQuery.Event = function( src, props ) { | |
// Allow instantiation without the 'new' keyword | |
if ( !(this instanceof jQuery.Event) ) { | |
return new jQuery.Event( src, props ); | |
} | |
// Event object | |
if ( src && src.type ) { | |
this.originalEvent = src; | |
this.type = src.type; | |
// Events bubbling up the document may have been marked as prevented | |
// by a handler lower down the tree; reflect the correct value. | |
this.isDefaultPrevented = src.defaultPrevented || | |
src.defaultPrevented === undefined && ( | |
// Support: IE < 9 | |
src.returnValue === false || | |
// Support: Android < 4.0 | |
src.getPreventDefault && src.getPreventDefault() ) ? | |
returnTrue : | |
returnFalse; | |
// Event type | |
} else { | |
this.type = src; | |
} | |
// Put explicitly provided properties onto the event object | |
if ( props ) { | |
jQuery.extend( this, props ); | |
} | |
// Create a timestamp if incoming event doesn't have one | |
this.timeStamp = src && src.timeStamp || jQuery.now(); | |
// Mark it as fixed | |
this[ jQuery.expando ] = true; | |
}; | |
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding | |
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html | |
jQuery.Event.prototype = { | |
isDefaultPrevented: returnFalse, | |
isPropagationStopped: returnFalse, | |
isImmediatePropagationStopped: returnFalse, | |
preventDefault: function() { | |
var e = this.originalEvent; | |
this.isDefaultPrevented = returnTrue; | |
if ( !e ) { | |
return; | |
} | |
// If preventDefault exists, run it on the original event | |
if ( e.preventDefault ) { | |
e.preventDefault(); | |
// Support: IE | |
// Otherwise set the returnValue property of the original event to false | |
} else { | |
e.returnValue = false; | |
} | |
}, | |
stopPropagation: function() { | |
var e = this.originalEvent; | |
this.isPropagationStopped = returnTrue; | |
if ( !e ) { | |
return; | |
} | |
// If stopPropagation exists, run it on the original event | |
if ( e.stopPropagation ) { | |
e.stopPropagation(); | |
} | |
// Support: IE | |
// Set the cancelBubble property of the original event to true | |
e.cancelBubble = true; | |
}, | |
stopImmediatePropagation: function() { | |
this.isImmediatePropagationStopped = returnTrue; | |
this.stopPropagation(); | |
} | |
}; | |
// Create mouseenter/leave events using mouseover/out and event-time checks | |
jQuery.each({ | |
mouseenter: "mouseover", | |
mouseleave: "mouseout" | |
}, function( orig, fix ) { | |
jQuery.event.special[ orig ] = { | |
delegateType: fix, | |
bindType: fix, | |
handle: function( event ) { | |
var ret, | |
target = this, | |
related = event.relatedTarget, | |
handleObj = event.handleObj; | |
// For mousenter/leave call the handler if related is outside the target. | |
// NB: No relatedTarget if the mouse left/entered the browser window | |
if ( !related || (related !== target && !jQuery.contains( target, related )) ) { | |
event.type = handleObj.origType; | |
ret = handleObj.handler.apply( this, arguments ); | |
event.type = fix; | |
} | |
return ret; | |
} | |
}; | |
}); | |
// IE submit delegation | |
if ( !support.submitBubbles ) { | |
jQuery.event.special.submit = { | |
setup: function() { | |
// Only need this for delegated form submit events | |
if ( jQuery.nodeName( this, "form" ) ) { | |
return false; | |
} | |
// Lazy-add a submit handler when a descendant form may potentially be submitted | |
jQuery.event.add( this, "click._submit keypress._submit", function( e ) { | |
// Node name check avoids a VML-related crash in IE (#9807) | |
var elem = e.target, | |
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; | |
if ( form && !jQuery._data( form, "submitBubbles" ) ) { | |
jQuery.event.add( form, "submit._submit", function( event ) { | |
event._submit_bubble = true; | |
}); | |
jQuery._data( form, "submitBubbles", true ); | |
} | |
}); | |
// return undefined since we don't need an event listener | |
}, | |
postDispatch: function( event ) { | |
// If form was submitted by the user, bubble the event up the tree | |
if ( event._submit_bubble ) { | |
delete event._submit_bubble; | |
if ( this.parentNode && !event.isTrigger ) { | |
jQuery.event.simulate( "submit", this.parentNode, event, true ); | |
} | |
} | |
}, | |
teardown: function() { | |
// Only need this for delegated form submit events | |
if ( jQuery.nodeName( this, "form" ) ) { | |
return false; | |
} | |
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above | |
jQuery.event.remove( this, "._submit" ); | |
} | |
}; | |
} | |
// IE change delegation and checkbox/radio fix | |
if ( !support.changeBubbles ) { | |
jQuery.event.special.change = { | |
setup: function() { | |
if ( rformElems.test( this.nodeName ) ) { | |
// IE doesn't fire change on a check/radio until blur; trigger it on click | |
// after a propertychange. Eat the blur-change in special.change.handle. | |
// This still fires onchange a second time for check/radio after blur. | |
if ( this.type === "checkbox" || this.type === "radio" ) { | |
jQuery.event.add( this, "propertychange._change", function( event ) { | |
if ( event.originalEvent.propertyName === "checked" ) { | |
this._just_changed = true; | |
} | |
}); | |
jQuery.event.add( this, "click._change", function( event ) { | |
if ( this._just_changed && !event.isTrigger ) { | |
this._just_changed = false; | |
} | |
// Allow triggered, simulated change events (#11500) | |
jQuery.event.simulate( "change", this, event, true ); | |
}); | |
} | |
return false; | |
} | |
// Delegated event; lazy-add a change handler on descendant inputs | |
jQuery.event.add( this, "beforeactivate._change", function( e ) { | |
var elem = e.target; | |
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { | |
jQuery.event.add( elem, "change._change", function( event ) { | |
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { | |
jQuery.event.simulate( "change", this.parentNode, event, true ); | |
} | |
}); | |
jQuery._data( elem, "changeBubbles", true ); | |
} | |
}); | |
}, | |
handle: function( event ) { | |
var elem = event.target; | |
// Swallow native change events from checkbox/radio, we already triggered them above | |
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { | |
return event.handleObj.handler.apply( this, arguments ); | |
} | |
}, | |
teardown: function() { | |
jQuery.event.remove( this, "._change" ); | |
return !rformElems.test( this.nodeName ); | |
} | |
}; | |
} | |
// Create "bubbling" focus and blur events | |
if ( !support.focusinBubbles ) { | |
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { | |
// Attach a single capturing handler on the document while someone wants focusin/focusout | |
var handler = function( event ) { | |
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); | |
}; | |
jQuery.event.special[ fix ] = { | |
setup: function() { | |
var doc = this.ownerDocument || this, | |
attaches = jQuery._data( doc, fix ); | |
if ( !attaches ) { | |
doc.addEventListener( orig, handler, true ); | |
} | |
jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); | |
}, | |
teardown: function() { | |
var doc = this.ownerDocument || this, | |
attaches = jQuery._data( doc, fix ) - 1; | |
if ( !attaches ) { | |
doc.removeEventListener( orig, handler, true ); | |
jQuery._removeData( doc, fix ); | |
} else { | |
jQuery._data( doc, fix, attaches ); | |
} | |
} | |
}; | |
}); | |
} | |
jQuery.fn.extend({ | |
on: function( types, selector, data, fn, /*INTERNAL*/ one ) { | |
var type, origFn; | |
// Types can be a map of types/handlers | |
if ( typeof types === "object" ) { | |
// ( types-Object, selector, data ) | |
if ( typeof selector !== "string" ) { | |
// ( types-Object, data ) | |
data = data || selector; | |
selector = undefined; | |
} | |
for ( type in types ) { | |
this.on( type, selector, data, types[ type ], one ); | |
} | |
return this; | |
} | |
if ( data == null && fn == null ) { | |
// ( types, fn ) | |
fn = selector; | |
data = selector = undefined; | |
} else if ( fn == null ) { | |
if ( typeof selector === "string" ) { | |
// ( types, selector, fn ) | |
fn = data; | |
data = undefined; | |
} else { | |
// ( types, data, fn ) | |
fn = data; | |
data = selector; | |
selector = undefined; | |
} | |
} | |
if ( fn === false ) { | |
fn = returnFalse; | |
} else if ( !fn ) { | |
return this; | |
} | |
if ( one === 1 ) { | |
origFn = fn; | |
fn = function( event ) { | |
// Can use an empty set, since event contains the info | |
jQuery().off( event ); | |
return origFn.apply( this, arguments ); | |
}; | |
// Use same guid so caller can remove using origFn | |
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); | |
} | |
return this.each( function() { | |
jQuery.event.add( this, types, fn, data, selector ); | |
}); | |
}, | |
one: function( types, selector, data, fn ) { | |
return this.on( types, selector, data, fn, 1 ); | |
}, | |
off: function( types, selector, fn ) { | |
var handleObj, type; | |
if ( types && types.preventDefault && types.handleObj ) { | |
// ( event ) dispatched jQuery.Event | |
handleObj = types.handleObj; | |
jQuery( types.delegateTarget ).off( | |
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, | |
handleObj.selector, | |
handleObj.handler | |
); | |
return this; | |
} | |
if ( typeof types === "object" ) { | |
// ( types-object [, selector] ) | |
for ( type in types ) { | |
this.off( type, selector, types[ type ] ); | |
} | |
return this; | |
} | |
if ( selector === false || typeof selector === "function" ) { | |
// ( types [, fn] ) | |
fn = selector; | |
selector = undefined; | |
} | |
if ( fn === false ) { | |
fn = returnFalse; | |
} | |
return this.each(function() { | |
jQuery.event.remove( this, types, fn, selector ); | |
}); | |
}, | |
trigger: function( type, data ) { | |
return this.each(function() { | |
jQuery.event.trigger( type, data, this ); | |
}); | |
}, | |
triggerHandler: function( type, data ) { | |
var elem = this[0]; | |
if ( elem ) { | |
return jQuery.event.trigger( type, data, elem, true ); | |
} | |
} | |
}); | |
function createSafeFragment( document ) { | |
var list = nodeNames.split( "|" ), | |
safeFrag = document.createDocumentFragment(); | |
if ( safeFrag.createElement ) { | |
while ( list.length ) { | |
safeFrag.createElement( | |
list.pop() | |
); | |
} | |
} | |
return safeFrag; | |
} | |
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + | |
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", | |
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, | |
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), | |
rleadingWhitespace = /^\s+/, | |
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, | |
rtagName = /<([\w:]+)/, | |
rtbody = /<tbody/i, | |
rhtml = /<|&#?\w+;/, | |
rnoInnerhtml = /<(?:script|style|link)/i, | |
// checked="checked" or checked | |
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, | |
rscriptType = /^$|\/(?:java|ecma)script/i, | |
rscriptTypeMasked = /^true\/(.*)/, | |
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, | |
// We have to close these tags to support XHTML (#13200) | |
wrapMap = { | |
option: [ 1, "<select multiple='multiple'>", "</select>" ], | |
legend: [ 1, "<fieldset>", "</fieldset>" ], | |
area: [ 1, "<map>", "</map>" ], | |
param: [ 1, "<object>", "</object>" ], | |
thead: [ 1, "<table>", "</table>" ], | |
tr: [ 2, "<table><tbody>", "</tbody></table>" ], | |
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], | |
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], | |
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, | |
// unless wrapped in a div with non-breaking characters in front of it. | |
_default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] | |
}, | |
safeFragment = createSafeFragment( document ), | |
fragmentDiv = safeFragment.appendChild( document.createElement("div") ); | |
wrapMap.optgroup = wrapMap.option; | |
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; | |
wrapMap.th = wrapMap.td; | |
function getAll( context, tag ) { |
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment