forked from jondot/graphene
-
Notifications
You must be signed in to change notification settings - Fork 1
/
graphene.min.js
11 lines (11 loc) · 110 KB
/
graphene.min.js
1
2
3
4
5
6
7
8
9
10
11
// Underscore.js 1.2.4
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
function Gauge(a,b){this.placeholderName=a;var c=this;this.configure=function(a){this.config=a,this.config.size=this.config.size*.9,this.config.raduis=this.config.size*.97/2,this.config.cx=this.config.size/2,this.config.cy=this.config.size/2,this.config.min=a.min||0,this.config.max=a.max||100,this.config.range=this.config.max-this.config.min,this.config.majorTicks=a.majorTicks||5,this.config.minorTicks=a.minorTicks||2,this.config.greenColor=a.greenColor||"#109618",this.config.yellowColor=a.yellowColor||"#FF9900",this.config.redColor=a.redColor||"#DC3912"},this.render=function(){this.body=d3.select("#"+this.placeholderName).append("svg:svg").attr("class","gauge").attr("width",this.config.size).attr("height",this.config.size),this.body.append("svg:circle").attr("class","outer").attr("cx",this.config.cx).attr("cy",this.config.cy).attr("r",this.config.raduis),this.body.append("svg:circle").attr("class","inner").attr("cx",this.config.cx).attr("cy",this.config.cy).attr("r",.9*this.config.raduis);for(var a in this.config.greenZones)this.drawBand(this.config.greenZones[a].from,this.config.greenZones[a].to,c.config.greenColor);for(var a in this.config.yellowZones)this.drawBand(this.config.yellowZones[a].from,this.config.yellowZones[a].to,c.config.yellowColor);for(var a in this.config.redZones)this.drawBand(this.config.redZones[a].from,this.config.redZones[a].to,c.config.redColor);if(undefined!=this.config.label){var b=Math.round(this.config.size/9);this.body.append("svg:text").attr("class","label").attr("x",this.config.cx).attr("y",this.config.cy/2+b/2).attr("dy",b/2).attr("text-anchor","middle").text(this.config.label).style("font-size",b+"px")}var b=Math.round(this.config.size/16),d=this.config.range/(this.config.majorTicks-1);for(var e=this.config.min;e<=this.config.max;e+=d){var f=d/this.config.minorTicks;for(var g=e+f;g<Math.min(e+d,this.config.max);g+=f){var h=this.valueToPoint(g,.75),i=this.valueToPoint(g,.85);this.body.append("svg:line").attr("class","small-tick").attr("x1",h.x).attr("y1",h.y).attr("x2",i.x).attr("y2",i.y)}var h=this.valueToPoint(e,.7),i=this.valueToPoint(e,.85);this.body.append("svg:line").attr("class","big-tick").attr("x1",h.x).attr("y1",h.y).attr("x2",i.x).attr("y2",i.y);if(e==this.config.min||e==this.config.max){var j=this.valueToPoint(e,.63);this.body.append("svg:text").attr("class","limit").attr("x",j.x).attr("y",j.y).attr("dy",b/3).attr("text-anchor",e==this.config.min?"start":"end").text(e).style("font-size",b+"px")}}var k=this.body.append("svg:g").attr("class","pointerContainer");this.drawPointer(0),k.append("svg:circle").attr("class","pointer-circle").attr("cx",this.config.cx).attr("cy",this.config.cy).attr("r",.12*this.config.raduis)},this.redraw=function(a){this.drawPointer(a)},this.drawBand=function(a,b,d){if(0>=b-a)return;this.body.append("svg:path").style("fill",d).attr("class","band").attr("d",d3.svg.arc().startAngle(this.valueToRadians(a)).endAngle(this.valueToRadians(b)).innerRadius(.8*this.config.raduis).outerRadius(.85*this.config.raduis)).attr("transform",function(){return"translate("+c.config.cx+", "+c.config.cy+") rotate(270)"})},this.drawPointer=function(a){var b=this.config.range/13,c=this.valueToPoint(a,.85),d=this.valueToPoint(a-b,.12),e=this.valueToPoint(a+b,.12),f=a-this.config.range*(1/.75)/2,g=this.valueToPoint(f,.28),h=this.valueToPoint(f-b,.12),i=this.valueToPoint(f+b,.12),j=[c,d,i,g,h,e,c],k=d3.svg.line().x(function(a){return a.x}).y(function(a){return a.y}).interpolate("basis"),l=this.body.select(".pointerContainer"),m=l.selectAll("path").data([j]);m.enter().append("svg:path").attr("class","pointer").attr("d",k),m.transition().attr("d",k);var n=Math.round(this.config.size/10);l.selectAll("text").data([a]).text(Math.round(a)).enter().append("svg:text").attr("class","value").attr("x",this.config.cx).attr("y",this.config.size-this.config.cy/4-n).attr("dy",n/2).attr("text-anchor","middle").text(Math.round(a)).style("font-size",n+"px")},this.valueToDegrees=function(a){return a/this.config.range*270-45},this.valueToRadians=function(a){return this.valueToDegrees(a)*Math.PI/180},this.valueToPoint=function(a,b){var c={x:this.config.cx-this.config.raduis*b*Math.cos(this.valueToRadians(a)),y:this.config.cy-this.config.raduis*b*Math.sin(this.valueToRadians(a))};return c},this.configure(b)}((function(){function A(a,b,c){if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual&&w.isFunction(a.isEqual))return a.isEqual(b);if(b.isEqual&&w.isFunction(b.isEqual))return b.isEqual(a);var d=i.call(a);if(d!=i.call(b))return!1;switch(d){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if(typeof a!="object"||typeof b!="object")return!1;var e=c.length;while(e--)if(c[e]==a)return!0;c.push(a);var f=0,g=!0;if(d=="[object Array]"){f=a.length,g=f==b.length;if(g)while(f--)if(!(g=f in a==f in b&&A(a[f],b[f],c)))break}else{if("constructor"in a!="constructor"in b||a.constructor!=b.constructor)return!1;for(var h in a)if(j.call(a,h)){f++;if(!(g=j.call(b,h)&&A(a[h],b[h],c)))break}if(g){for(h in b)if(j.call(b,h)&&!(f--))break;g=!f}}return c.pop(),g}var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.slice,h=d.unshift,i=e.toString,j=e.hasOwnProperty,k=d.forEach,l=d.map,m=d.reduce,n=d.reduceRight,o=d.filter,p=d.every,q=d.some,r=d.indexOf,s=d.lastIndexOf,t=Array.isArray,u=Object.keys,v=f.bind,w=function(a){return new D(a)};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=w),exports._=w):typeof define=="function"&&define.amd?define("underscore",function(){return w}):a._=w,w.VERSION="1.2.4";var x=w.each=w.forEach=function(a,b,d){if(a==null)return;if(k&&a.forEach===k)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;e<f;e++)if(e in a&&b.call(d,a[e],e,a)===c)return}else for(var g in a)if(j.call(a,g)&&b.call(d,a[g],g,a)===c)return};w.map=function(a,b,c){var d=[];return a==null?d:l&&a.map===l?a.map(b,c):(x(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),a.length===+a.length&&(d.length=a.length),d)},w.reduce=w.foldl=w.inject=function(a,b,c,d){var e=arguments.length>2;a==null&&(a=[]);if(m&&a.reduce===m)return d&&(b=w.bind(b,d)),e?a.reduce(b,c):a.reduce(b);x(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},w.reduceRight=w.foldr=function(a,b,c,d){var e=arguments.length>2;a==null&&(a=[]);if(n&&a.reduceRight===n)return d&&(b=w.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=w.toArray(a).reverse();return d&&!e&&(b=w.bind(b,d)),e?w.reduce(f,b,c,d):w.reduce(f,b)},w.find=w.detect=function(a,b,c){var d;return y(a,function(a,e,f){if(b.call(c,a,e,f))return d=a,!0}),d},w.filter=w.select=function(a,b,c){var d=[];return a==null?d:o&&a.filter===o?a.filter(b,c):(x(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},w.reject=function(a,b,c){var d=[];return a==null?d:(x(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)}),d)},w.every=w.all=function(a,b,d){var e=!0;return a==null?e:p&&a.every===p?a.every(b,d):(x(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c}),e)};var y=w.some=w.any=function(a,b,d){b||(b=w.identity);var e=!1;return a==null?e:q&&a.some===q?a.some(b,d):(x(a,function(a,f,g){if(e||(e=b.call(d,a,f,g)))return c}),!!e)};w.include=w.contains=function(a,b){var c=!1;return a==null?c:r&&a.indexOf===r?a.indexOf(b)!=-1:(c=y(a,function(a){return a===b}),c)},w.invoke=function(a,b){var c=g.call(arguments,2);return w.map(a,function(a){return(w.isFunction(b)?b||a:a[b]).apply(a,c)})},w.pluck=function(a,b){return w.map(a,function(a){return a[b]})},w.max=function(a,b,c){if(!b&&w.isArray(a))return Math.max.apply(Math,a);if(!b&&w.isEmpty(a))return-Infinity;var d={computed:-Infinity};return x(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},w.min=function(a,b,c){if(!b&&w.isArray(a))return Math.min.apply(Math,a);if(!b&&w.isEmpty(a))return Infinity;var d={computed:Infinity};return x(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})}),d.value},w.shuffle=function(a){var b=[],c;return x(a,function(a,d,e){d==0?b[0]=a:(c=Math.floor(Math.random()*(d+1)),b[d]=b[c],b[c]=a)}),b},w.sortBy=function(a,b,c){return w.pluck(w.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},w.groupBy=function(a,b){var c={},d=w.isFunction(b)?b:function(a){return a[b]};return x(a,function(a,b){var e=d(a,b);(c[e]||(c[e]=[])).push(a)}),c},w.sortedIndex=function(a,b,c){c||(c=w.identity);var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},w.toArray=function(a){return a?a.toArray?a.toArray():w.isArray(a)?g.call(a):w.isArguments(a)?g.call(a):w.values(a):[]},w.size=function(a){return w.toArray(a).length},w.first=w.head=function(a,b,c){return b!=null&&!c?g.call(a,0,b):a[0]},w.initial=function(a,b,c){return g.call(a,0,a.length-(b==null||c?1:b))},w.last=function(a,b,c){return b!=null&&!c?g.call(a,Math.max(a.length-b,0)):a[a.length-1]},w.rest=w.tail=function(a,b,c){return g.call(a,b==null||c?1:b)},w.compact=function(a){return w.filter(a,function(a){return!!a})},w.flatten=function(a,b){return w.reduce(a,function(a,c){return w.isArray(c)?a.concat(b?c:w.flatten(c)):(a[a.length]=c,a)},[])},w.without=function(a){return w.difference(a,g.call(arguments,1))},w.uniq=w.unique=function(a,b,c){var d=c?w.map(a,c):a,e=[];return w.reduce(d,function(c,d,f){if(0==f||(b===!0?w.last(c)!=d:!w.include(c,d)))c[c.length]=d,e[e.length]=a[f];return c},[]),e},w.union=function(){return w.uniq(w.flatten(arguments,!0))},w.intersection=w.intersect=function(a){var b=g.call(arguments,1);return w.filter(w.uniq(a),function(a){return w.every(b,function(b){return w.indexOf(b,a)>=0})})},w.difference=function(a){var b=w.flatten(g.call(arguments,1));return w.filter(a,function(a){return!w.include(b,a)})},w.zip=function(){var a=g.call(arguments),b=w.max(w.pluck(a,"length")),c=new Array(b);for(var d=0;d<b;d++)c[d]=w.pluck(a,""+d);return c},w.indexOf=function(a,b,c){if(a==null)return-1;var d,e;if(c)return d=w.sortedIndex(a,b),a[d]===b?d:-1;if(r&&a.indexOf===r)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===b)return d;return-1},w.lastIndexOf=function(a,b){if(a==null)return-1;if(s&&a.lastIndexOf===s)return a.lastIndexOf(b);var c=a.length;while(c--)if(c in a&&a[c]===b)return c;return-1},w.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);while(e<d)f[e++]=a,a+=c;return f};var z=function(){};w.bind=function(b,c){var d,e;if(b.bind===v&&v)return v.apply(b,g.call(arguments,1));if(!w.isFunction(b))throw new TypeError;return e=g.call(arguments,2),d=function(){if(this instanceof d){z.prototype=b.prototype;var a=new z,f=b.apply(a,e.concat(g.call(arguments)));return Object(f)===f?f:a}return b.apply(c,e.concat(g.call(arguments)))}},w.bindAll=function(a){var b=g.call(arguments,1);return b.length==0&&(b=w.functions(a)),x(b,function(b){a[b]=w.bind(a[b],a)}),a},w.memoize=function(a,b){var c={};return b||(b=w.identity),function(){var d=b.apply(this,arguments);return j.call(c,d)?c[d]:c[d]=a.apply(this,arguments)}},w.delay=function(a,b){var c=g.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},w.defer=function(a){return w.delay.apply(w,[a,1].concat(g.call(arguments,1)))},w.throttle=function(a,b){var c,d,e,f,g,h=w.debounce(function(){g=f=!1},b);return function(){c=this,d=arguments;var i=function(){e=null,g&&a.apply(c,d),h()};e||(e=setTimeout(i,b)),f?g=!0:a.apply(c,d),h(),f=!0}},w.debounce=function(a,b){var c;return function(){var d=this,e=arguments,f=function(){c=null,a.apply(d,e)};clearTimeout(c),c=setTimeout(f,b)}},w.once=function(a){var b=!1,c;return function(){return b?c:(b=!0,c=a.apply(this,arguments))}},w.wrap=function(a,b){return function(){var c=[a].concat(g.call(arguments,0));return b.apply(this,c)}},w.compose=function(){var a=arguments;return function(){var b=arguments;for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},w.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}},w.keys=u||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)j.call(a,c)&&(b[b.length]=c);return b},w.values=function(a){return w.map(a,w.identity)},w.functions=w.methods=function(a){var b=[];for(var c in a)w.isFunction(a[c])&&b.push(c);return b.sort()},w.extend=function(a){return x(g.call(arguments,1),function(b){for(var c in b)b[c]!==void 0&&(a[c]=b[c])}),a},w.defaults=function(a){return x(g.call(arguments,1),function(b){for(var c in b)a[c]==null&&(a[c]=b[c])}),a},w.clone=function(a){return w.isObject(a)?w.isArray(a)?a.slice():w.extend({},a):a},w.tap=function(a,b){return b(a),a},w.isEqual=function(a,b){return A(a,b,[])},w.isEmpty=function(a){if(w.isArray(a)||w.isString(a))return a.length===0;for(var b in a)if(j.call(a,b))return!1;return!0},w.isElement=function(a){return!!a&&a.nodeType==1},w.isArray=t||function(a){return i.call(a)=="[object Array]"},w.isObject=function(a){return a===Object(a)},w.isArguments=function(a){return i.call(a)=="[object Arguments]"},w.isArguments(arguments)||(w.isArguments=function(a){return!!a&&!!j.call(a,"callee")}),w.isFunction=function(a){return i.call(a)=="[object Function]"},w.isString=function(a){return i.call(a)=="[object String]"},w.isNumber=function(a){return i.call(a)=="[object Number]"},w.isNaN=function(a){return a!==a},w.isBoolean=function(a){return a===!0||a===!1||i.call(a)=="[object Boolean]"},w.isDate=function(a){return i.call(a)=="[object Date]"},w.isRegExp=function(a){return i.call(a)=="[object RegExp]"},w.isNull=function(a){return a===null},w.isUndefined=function(a){return a===void 0},w.noConflict=function(){return a._=b,this},w.identity=function(a){return a},w.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},w.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")},w.mixin=function(a){x(w.functions(a),function(b){F(b,w[b]=a[b])})};var B=0;w.uniqueId=function(a){var b=B++;return a?a+b:b},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var C=/.^/;w.template=function(a,b){var c=w.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.escape||C,function(a,b){return"',_.escape("+b.replace(/\\'/g,"'")+"),'"}).replace(c.interpolate||C,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||C,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ").replace(/\\\\/g,"\\")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return b?e(b,w):function(a){return e.call(this,a,w)}},w.chain=function(a){return w(a).chain()};var D=function(a){this._wrapped=a};w.prototype=D.prototype;var E=function(a,b){return b?w(a).chain():a},F=function(a,b){D.prototype[a]=function(){var a=g.call(arguments);return h.call(a,this._wrapped),E(b.apply(w,a),this._chain)}};w.mixin(w),x(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];D.prototype[a]=function(){var c=this._wrapped;b.apply(c,arguments);var d=c.length;return(a=="shift"||a=="splice")&&d===0&&delete c[0],E(c,this._chain)}}),x(["concat","join","slice"],function(a){var b=d[a];D.prototype[a]=function(){return E(b.apply(this._wrapped,arguments),this._chain)}}),D.prototype.chain=function(){return this._chain=!0,this},D.prototype.value=function(){return this._wrapped}})).call(this),function(){var a=this,b=a.Backbone,c;typeof exports!="undefined"?c=exports:c=a.Backbone={},c.VERSION="0.5.3";var d=a._;!d&&typeof require!="undefined"&&(d=require("underscore")._);var e=a.jQuery||a.Zepto;c.noConflict=function(){return a.Backbone=b,this},c.emulateHTTP=!1,c.emulateJSON=!1,c.Events={bind:function(a,b,c){var d=this._callbacks||(this._callbacks={}),e=d[a]||(d[a]=[]);return e.push([b,c]),this},unbind:function(a,b){var c;if(!a)this._callbacks={};else if(c=this._callbacks)if(!b)c[a]=[];else{var d=c[a];if(!d)return this;for(var e=0,f=d.length;e<f;e++)if(d[e]&&b===d[e][0]){d[e]=null;break}}return this},trigger:function(a){var b,c,d,e,f,g=2;if(!(c=this._callbacks))return this;while(g--){d=g?a:"all";if(b=c[d])for(var h=0,i=b.length;h<i;h++)(e=b[h])?(f=g?Array.prototype.slice.call(arguments,1):arguments,e[0].apply(e[1]||this,f)):(b.splice(h,1),h--,i--)}return this}},c.Model=function(a,b){var c;a||(a={});if(c=this.defaults)d.isFunction(c)&&(c=c.call(this)),a=d.extend({},c,a);this.attributes={},this._escapedAttributes={},this.cid=d.uniqueId("c"),this.set(a,{silent:!0}),this._changed=!1,this._previousAttributes=d.clone(this.attributes),b&&b.collection&&(this.collection=b.collection),this.initialize(a,b)},d.extend(c.Model.prototype,c.Events,{_previousAttributes:null,_changed:!1,idAttribute:"id",initialize:function(){},toJSON:function(){return d.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;var c=this.attributes[a];return this._escapedAttributes[a]=w(c==null?"":""+c)},has:function(a){return this.attributes[a]!=null},set:function(a,b){b||(b={});if(!a)return this;a.attributes&&(a=a.attributes);var c=this.attributes,e=this._escapedAttributes;if(!b.silent&&this.validate&&!this._performValidation(a,b))return!1;this.idAttribute in a&&(this.id=a[this.idAttribute]);var f=this._changing;this._changing=!0;for(var g in a){var h=a[g];d.isEqual(c[g],h)||(c[g]=h,delete e[g],this._changed=!0,b.silent||this.trigger("change:"+g,this,h,b))}return!f&&!b.silent&&this._changed&&this.change(b),this._changing=!1,this},unset:function(a,b){if(a in this.attributes){b||(b={});var c=this.attributes[a],d={};return d[a]=void 0,!b.silent&&this.validate&&!this._performValidation(d,b)?!1:(delete this.attributes[a],delete this._escapedAttributes[a],a==this.idAttribute&&delete this.id,this._changed=!0,b.silent||(this.trigger("change:"+a,this,void 0,b),this.change(b)),this)}return this},clear:function(a){a||(a={});var b,c=this.attributes,d={};for(b in c)d[b]=void 0;if(!a.silent&&this.validate&&!this._performValidation(d,a))return!1;this.attributes={},this._escapedAttributes={},this._changed=!0;if(!a.silent){for(b in c)this.trigger("change:"+b,this,void 0,a);this.change(a)}return this},fetch:function(a){a||(a={});var b=this,d=a.success;return a.success=function(c,e,f){if(!b.set(b.parse(c,f),a))return!1;d&&d(b,c)},a.error=v(a.error,b,a),(this.sync||c.sync).call(this,"read",this,a)},save:function(a,b){b||(b={});if(a&&!this.set(a,b))return!1;var d=this,e=b.success;b.success=function(a,c,f){if(!d.set(d.parse(a,f),b))return!1;e&&e(d,a,f)},b.error=v(b.error,d,b);var f=this.isNew()?"create":"update";return(this.sync||c.sync).call(this,f,this,b)},destroy:function(a){a||(a={});if(this.isNew())return this.trigger("destroy",this,this.collection,a);var b=this,d=a.success;return a.success=function(c){b.trigger("destroy",b,b.collection,a),d&&d(b,c)},a.error=v(a.error,b,a),(this.sync||c.sync).call(this,"delete",this,a)},url:function(){var a=t(this.collection)||this.urlRoot||u();return this.isNew()?a:a+(a.charAt(a.length-1)=="/"?"":"/")+encodeURIComponent(this.id)},parse:function(a,b){return a},clone:function(){return new this.constructor(this)},isNew:function(){return this.id==null},change:function(a){this.trigger("change",this,a),this._previousAttributes=d.clone(this.attributes),this._changed=!1},hasChanged:function(a){return a?this._previousAttributes[a]!=this.attributes[a]:this._changed},changedAttributes:function(a){a||(a=this.attributes);var b=this._previousAttributes,c=!1;for(var e in a)d.isEqual(b[e],a[e])||(c=c||{},c[e]=a[e]);return c},previous:function(a){return!a||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return d.clone(this._previousAttributes)},_performValidation:function(a,b){var c=this.validate(a);return c?(b.error?b.error(this,c,b):this.trigger("error",this,c,b),!1):!0}}),c.Collection=function(a,b){b||(b={}),b.comparator&&(this.comparator=b.comparator),d.bindAll(this,"_onModelEvent","_removeReference"),this._reset(),a&&this.reset(a,{silent:!0}),this.initialize.apply(this,arguments)},d.extend(c.Collection.prototype,c.Events,{model:c.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){if(d.isArray(a))for(var c=0,e=a.length;c<e;c++)this._add(a[c],b);else this._add(a,b);return this},remove:function(a,b){if(d.isArray(a))for(var c=0,e=a.length;c<e;c++)this._remove(a[c],b);else this._remove(a,b);return this},get:function(a){return a==null?null:this._byId[a.id!=null?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},sort:function(a){a||(a={});if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return this.models=this.sortBy(this.comparator),a.silent||this.trigger("reset",this,a),this},pluck:function(a){return d.map(this.models,function(b){return b.get(a)})},reset:function(a,b){return a||(a=[]),b||(b={}),this.each(this._removeReference),this._reset(),this.add(a,{silent:!0}),b.silent||this.trigger("reset",this,b),this},fetch:function(a){a||(a={});var b=this,d=a.success;return a.success=function(c,e,f){b[a.add?"add":"reset"](b.parse(c,f),a),d&&d(b,c)},a.error=v(a.error,b,a),(this.sync||c.sync).call(this,"read",this,a)},create:function(a,b){var c=this;b||(b={}),a=this._prepareModel(a,b);if(!a)return!1;var d=b.success;return b.success=function(a,e,f){c.add(a,b),d&&d(a,e,f)},a.save(null,b),a},parse:function(a,b){return a},chain:function(){return d(this.models).chain()},_reset:function(a){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(a,b){if(a instanceof c.Model)a.collection||(a.collection=this);else{var d=a;a=new this.model(d,{collection:this}),a.validate&&!a._performValidation(d,b)&&(a=!1)}return a},_add:function(a,b){b||(b={}),a=this._prepareModel(a,b);if(!a)return!1;var c=this.getByCid(a);if(c)throw new Error(["Can't add the same model to a set twice",c.id]);this._byId[a.id]=a,this._byCid[a.cid]=a;var d=b.at!=null?b.at:this.comparator?this.sortedIndex(a,this.comparator):this.length;return this.models.splice(d,0,a),a.bind("all",this._onModelEvent),this.length++,b.silent||a.trigger("add",a,this,b),a},_remove:function(a,b){return b||(b={}),a=this.getByCid(a)||this.get(a),a?(delete this._byId[a.id],delete this._byCid[a.cid],this.models.splice(this.indexOf(a),1),this.length--,b.silent||a.trigger("remove",a,this,b),this._removeReference(a),a):null},_removeReference:function(a){this==a.collection&&delete a.collection,a.unbind("all",this._onModelEvent)},_onModelEvent:function(a,b,c,d){if((a=="add"||a=="remove")&&c!=this)return;a=="destroy"&&this._remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],this._byId[b.id]=b),this.trigger.apply(this,arguments)}});var f=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","rest","last","without","indexOf","lastIndexOf","isEmpty","groupBy"];d.each(f,function(a){c.Collection.prototype[a]=function(){return d[a].apply(d,[this.models].concat(d.toArray(arguments)))}}),c.Router=function(a){a||(a={}),a.routes&&(this.routes=a.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};var g=/:([\w\d]+)/g,h=/\*([\w\d]+)/g,i=/[-[\]{}()+?.,\\^$|#\s]/g;d.extend(c.Router.prototype,c.Events,{initialize:function(){},route:function(a,b,e){c.history||(c.history=new c.History),d.isRegExp(a)||(a=this._routeToRegExp(a)),c.history.route(a,d.bind(function(c){var d=this._extractParameters(a,c);e.apply(this,d),this.trigger.apply(this,["route:"+b].concat(d))},this))},navigate:function(a,b){c.history.navigate(a,b)},_bindRoutes:function(){if(!this.routes)return;var a=[];for(var b in this.routes)a.unshift([b,this.routes[b]]);for(var c=0,d=a.length;c<d;c++)this.route(a[c][0],a[c][1],this[a[c][1]])},_routeToRegExp:function(a){return a=a.replace(i,"\\$&").replace(g,"([^/]*)").replace(h,"(.*?)"),new RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}}),c.History=function(){this.handlers=[],d.bindAll(this,"checkUrl")};var j=/^#*/,k=/msie [\w.]+/,l=!1;d.extend(c.History.prototype,{interval:50,getFragment:function(a,b){if(a==null)if(this._hasPushState||b){a=window.location.pathname;var c=window.location.search;c&&(a+=c),a.indexOf(this.options.root)==0&&(a=a.substr(this.options.root.length))}else a=window.location.hash;return decodeURIComponent(a.replace(j,""))},start:function(a){if(l)throw new Error("Backbone.history has already been started");this.options=d.extend({},{root:"/"},this.options,a),this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&window.history&&window.history.pushState);var b=this.getFragment(),c=document.documentMode,f=k.exec(navigator.userAgent.toLowerCase())&&(!c||c<=7);f&&(this.iframe=e('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(b)),this._hasPushState?e(window).bind("popstate",this.checkUrl):"onhashchange"in window&&!f?e(window).bind("hashchange",this.checkUrl):setInterval(this.checkUrl,this.interval),this.fragment=b,l=!0;var g=window.location,h=g.pathname==this.options.root;if(this._wantsPushState&&!this._hasPushState&&!h)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&h&&g.hash&&(this.fragment=g.hash.replace(j,""),window.history.replaceState({},document.title,g.protocol+"//"+g.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(a){var b=this.getFragment();b==this.fragment&&this.iframe&&(b=this.getFragment(this.iframe.location.hash));if(b==this.fragment||b==decodeURIComponent(this.fragment))return!1;this.iframe&&this.navigate(b),this.loadUrl()||this.loadUrl(window.location.hash)},loadUrl:function(a){var b=this.fragment=this.getFragment(a),c=d.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0});return c},navigate:function(a,b){var c=(a||"").replace(j,"");if(this.fragment==c||this.fragment==decodeURIComponent(c))return;if(this._hasPushState){var d=window.location;c.indexOf(this.options.root)!=0&&(c=this.options.root+c),this.fragment=c,window.history.pushState({},document.title,d.protocol+"//"+d.host+c)}else window.location.hash=this.fragment=c,this.iframe&&c!=this.getFragment(this.iframe.location.hash)&&(this.iframe.document.open().close(),this.iframe.location.hash=c);b&&this.loadUrl(a)}}),c.View=function(a){this.cid=d.uniqueId("view"),this._configure(a||{}),this._ensureElement(),this.delegateEvents(),this.initialize.apply(this,arguments)};var m=function(a){return e(a,this.el)},n=/^(\S+)\s*(.*)$/,o=["model","collection","el","id","attributes","className","tagName"];d.extend(c.View.prototype,c.Events,{tagName:"div",$:m,initialize:function(){},render:function(){return this},remove:function(){return e(this.el).remove(),this},make:function(a,b,c){var d=document.createElement(a);return b&&e(d).attr(b),c&&e(d).html(c),d},delegateEvents:function(a){if(!a&&!(a=this.events))return;d.isFunction(a)&&(a=a.call(this)),e(this.el).unbind(".delegateEvents"+this.cid);for(var b in a){var c=this[a[b]];if(!c)throw new Error('Event "'+a[b]+'" does not exist');var f=b.match(n),g=f[1],h=f[2];c=d.bind(c,this),g+=".delegateEvents"+this.cid,h===""?e(this.el).bind(g,c):e(this.el).delegate(h,g,c)}},_configure:function(a){this.options&&(a=d.extend({},this.options,a));for(var b=0,c=o.length;b<c;b++){var e=o[b];a[e]&&(this[e]=a[e])}this.options=a},_ensureElement:function(){if(!this.el){var a=this.attributes||{};this.id&&(a.id=this.id),this.className&&(a["class"]=this.className),this.el=this.make(this.tagName,a)}else d.isString(this.el)&&(this.el=e(this.el).get(0))}});var p=function(a,b){var c=s(this,a,b);return c.extend=this.extend,c};c.Model.extend=c.Collection.extend=c.Router.extend=c.View.extend=p;var q={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};c.sync=function(a,b,f){var g=q[a],h=d.extend({type:g,dataType:"json"},f);return h.url||(h.url=t(b)||u()),!h.data&&b&&(a=="create"||a=="update")&&(h.contentType="application/json",h.data=JSON.stringify(b.toJSON())),c.emulateJSON&&(h.contentType="application/x-www-form-urlencoded",h.data=h.data?{model:h.data}:{}),c.emulateHTTP&&(g==="PUT"||g==="DELETE")&&(c.emulateJSON&&(h.data._method=g),h.type="POST",h.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",g)}),h.type!=="GET"&&!c.emulateJSON&&(h.processData=!1),e.ajax(h)};var r=function(){},s=function(a,b,c){var e;return b&&b.hasOwnProperty("constructor")?e=b.constructor:e=function(){return a.apply(this,arguments)},d.extend(e,a),r.prototype=a.prototype,e.prototype=new r,b&&d.extend(e.prototype,b),c&&d.extend(e,c),e.prototype.constructor=e,e.__super__=a.prototype,e},t=function(a){return!a||!a.url?null:d.isFunction(a.url)?a.url():a.url},u=function(){throw new Error('A "url" property or function must be specified')},v=function(a,b,c){return function(d){a?a(b,d,c):b.trigger("error",b,d,c)}},w=function(a){return a.replace(/&(?!\w+;|#\d+;|#x[\da-f]+;)/gi,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}}.call(this),function(){function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function f(a){return Array.prototype.slice.call(a)}function i(){return this}function j(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function k(a){return a!=null&&!isNaN(a)}function l(a){return a.length}function m(a){return a==null}function n(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function q(){}function r(){function c(){var b=a,c=-1,d=b.length,e;while(++c<d)(e=b[c].on)&&e.apply(this,arguments)}var a=[],b={};return c.on=function(d,e){var f,g;if(arguments.length<2)return(f=b[d])&&f.on;if(f=b[d])f.on=null,a=a.slice(0,g=a.indexOf(f)).concat(a.slice(g+1)),delete b[d];return e&&a.push(b[d]={on:e}),c},c}function u(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function v(a){return a+""}function w(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function y(a,b){return{scale:Math.pow(10,(8-b)*3),symbol:a}}function D(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function E(a){return function(b){return 1-a(1-b)}}function F(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function G(a){return a}function H(a){return function(b){return Math.pow(b,a)}}function I(a){return 1-Math.cos(a*Math.PI/2)}function J(a){return Math.pow(2,10*(a-1))}function K(a){return 1-Math.sqrt(1-a*a)}function L(a,b){var c;return arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function M(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function N(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function O(){d3.event.stopPropagation(),d3.event.preventDefault()}function Q(a){return a=="transform"?d3.interpolateTransform:d3.interpolate}function R(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function S(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function T(a,b,c){return new U(a,b,c)}function U(a,b,c){this.r=a,this.g=b,this.b=c}function V(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function W(a,b,c){var d=0
,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(Y(h[0]),Y(h[1]),Y(h[2]))}}return(i=Z[a])?b(i.r,i.g,i.b):(a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16)),b(d,e,f))}function X(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;return f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0,_(g,h,i)}function Y(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function _(a,b,c){return new ba(a,b,c)}function ba(a,b,c){this.h=a,this.s=b,this.l=c}function bb(a,b,c){function f(a){return a>360?a-=360:a<0&&(a+=360),a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}function g(a){return Math.round(f(a)*255)}var d,e;return a%=360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e,T(g(a+120),g(a),g(a-120))}function bc(a){return h(a,bi),a}function bj(a){return function(){return bd(a,this)}}function bk(a){return function(){return be(a,this)}}function bm(a,b){function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=n(e+" "+a),d?b.baseVal=e:this.className=e)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=n(e.replace(c," ")),d?b.baseVal=e:this.className=e}function h(){(b.apply(this,arguments)?f:g).call(this)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;return c.lastIndex=0,c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function bn(a){return{__data__:a}}function bo(a){return function(){return bh(this,a)}}function bp(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function br(a){return h(a,bs),a}function bt(a,b,c){h(a,bx);var d={},e=d3.dispatch("start","end"),f=bA;return a.id=b,a.time=c,a.tween=function(b,c){return arguments.length<2?d[b]:(c==null?delete d[b]:d[b]=c,a)},a.ease=function(b){return arguments.length?(f=typeof b=="function"?b:d3.ease.apply(d3,arguments),a):f},a.each=function(b,c){return arguments.length<2?bB.call(a,b):(e.on(b,c),a)},d3.timer(function(g){return a.each(function(h,i,j){function p(a){if(o.active>b)return r();o.active=b;for(var f in d)(f=d[f].call(l,h,i))&&k.push(f);return e.start.call(l,h,i),q(a)||d3.timer(q,0,c),1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1)return r(),bz=b,e.end.call(l,h,i),bz=0,1}function r(){return--o.count||delete l.__transition__,1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,c)}),1},0,c),a}function bv(a,b,c){return c!=""&&bu}function bw(a,b){function d(a,d,e){var f=b.call(this,a,d);return f==null?e!=""&&bu:e!=f&&c(e,f)}function e(a,d,e){return e!=b&&c(e,b)}var c=Q(a);return typeof b=="function"?d:b==null?bv:(b+="",e)}function bB(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bF(){var a,b=Date.now(),c=bC;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bG()-b;d>24?(isFinite(d)&&(clearTimeout(bE),bE=setTimeout(bF,d)),bD=0):(bD=1,bH(bF))}function bG(){var a=null,b=bC,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bC=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bI(a){var b=[a.a,a.b],c=[a.c,a.d],d=bK(b),e=bJ(b,c),f=bK(bL(c,b,-e))||0;b[0]*c[1]<c[0]*b[1]&&(b[0]*=-1,b[1]*=-1,d*=-1,e*=-1),this.rotate=(d?Math.atan2(b[1],b[0]):Math.atan2(-c[0],c[1]))*bM,this.translate=[a.e,a.f],this.scale=[d,f],this.skew=f?Math.atan2(e,f)*bM:0}function bJ(a,b){return a[0]*b[0]+a[1]*b[1]}function bK(a){var b=Math.sqrt(bJ(a,a));return b&&(a[0]/=b,a[1]/=b),b}function bL(a,b,c){return a[0]+=c*b[0],a[1]+=c*b[1],a}function bN(){}function bO(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bP(a){return a.rangeExtent?a.rangeExtent():bO(a.range())}function bQ(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g);if(g=f-e)b=b(g),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bR(){return Math}function bS(a,b,c,d){function g(){var g=a.length==2?bY:bZ,i=d?S:R;return e=g(a,b,i,c),f=g(b,a,i,d3.interpolate),h}function h(a){return e(a)}var e,f;return h.invert=function(a){return f(a)},h.domain=function(b){return arguments.length?(a=b.map(Number),g()):a},h.range=function(a){return arguments.length?(b=a,g()):b},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){return arguments.length?(d=a,g()):d},h.interpolate=function(a){return arguments.length?(c=a,g()):c},h.ticks=function(b){return bW(a,b)},h.tickFormat=function(b){return bX(a,b)},h.nice=function(){return bQ(a,bU),g()},h.copy=function(){return bS(a,b,c,d)},g()}function bT(a,b){return d3.rebind(a,b,"range","rangeRound","interpolate","clamp")}function bU(a){return a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1),{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bV(a,b){var c=bO(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;return f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e,c}function bW(a,b){return d3.range.apply(d3,bV(a,b))}function bX(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bV(a,b)[2])/Math.LN10+.01))+"f")}function bY(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bZ(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function b$(a,b){function d(c){return a(b(c))}var c=b.pow;return d.invert=function(b){return c(a.invert(b))},d.domain=function(e){return arguments.length?(b=e[0]<0?cb:ca,c=b.pow,a.domain(e.map(b)),d):a.domain().map(c)},d.nice=function(){return a.domain(bQ(a.domain(),bR)),d},d.ticks=function(){var d=bO(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===cb){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=b_);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===cb?(h=-1e-12,Math.floor):(h=1e-12,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return b$(a.copy(),b)},bT(d,a)}function ca(a){return Math.log(a<0?0:a)/Math.LN10}function cb(a){return-Math.log(a>0?0:-a)/Math.LN10}function cc(a,b){function e(b){return a(c(b))}var c=cd(b),d=cd(1/b);return e.invert=function(b){return d(a.invert(b))},e.domain=function(b){return arguments.length?(a.domain(b.map(c)),e):a.domain().map(d)},e.ticks=function(a){return bW(e.domain(),a)},e.tickFormat=function(a){return bX(e.domain(),a)},e.nice=function(){return e.domain(bQ(e.domain(),bU))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();return c=cd(b=a),d=cd(1/b),e.domain(f)},e.copy=function(){return cc(a.copy(),b)},bT(e,a)}function cd(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function ce(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}function g(b,c){return d3.range(a.length).map(function(a){return b+c*a})}var c,d,e;return f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){return arguments.length?(d=a,e=0,b={t:"range",x:a},f):d},f.rangePoints=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length-1+h);return d=g(a.length<2?(i+j)/2:i+k*h/2,k),e=0,b={t:"rangePoints",x:c,p:h},f},f.rangeBands=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=(j-i)/(a.length+h);return d=g(i+k*h,k),e=k*(1-h),b={t:"rangeBands",x:c,p:h},f},f.rangeRoundBands=function(c,h){arguments.length<2&&(h=0);var i=c[0],j=c[1],k=Math.floor((j-i)/(a.length+h));return d=g(i+Math.round((j-i-(a.length-h)*k)/2),k),e=Math.round(k*(1-h)),b={t:"rangeRoundBands",x:c,p:h},f},f.rangeBand=function(){return e},f.rangeExtent=function(){return b.t==="range"?bO(b.x):b.x},f.copy=function(){return ce(a,b)},f.domain(a)}function cj(a,b){function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}var c;return e.domain=function(b){return arguments.length?(a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d()):a},e.range=function(a){return arguments.length?(b=a,d()):b},e.quantiles=function(){return c},e.copy=function(){return cj(a,b)},d()}function ck(a,b,c){function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}function g(){return d=c.length/(b-a),e=c.length-1,f}var d,e;return f.domain=function(c){return arguments.length?(a=+c[0],b=+c[c.length-1],g()):[a,b]},f.range=function(a){return arguments.length?(c=a,g()):c},f.copy=function(){return ck(a,b,c)},g()}function cn(a){return a.innerRadius}function co(a){return a.outerRadius}function cp(a){return a.startAngle}function cq(a){return a.endAngle}function cr(a){function g(d){return d.length<1?null:"M"+e(a(cs(this,d,b,c)),f)}var b=ct,c=cu,d="linear",e=cv[d],f=.7;return g.x=function(a){return arguments.length?(b=a,g):b},g.y=function(a){return arguments.length?(c=a,g):c},g.interpolate=function(a){return arguments.length?(e=cv[d=a],g):d},g.tension=function(a){return arguments.length?(f=a,g):f},g}function cs(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function ct(a){return a[0]}function cu(a){return a[1]}function cw(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function cx(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cy(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function cz(a,b){return a.length<4?cw(a):a[1]+cC(a.slice(1,a.length-1),cD(a,b))}function cA(a,b){return a.length<3?cw(a):a[0]+cC((a.push(a[0]),a),cD([a[a.length-2]].concat(a,[a[1]]),b))}function cB(a,b,c){return a.length<3?cw(a):a[0]+cC(a,cD(a,b))}function cC(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cw(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cD(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cE(a){if(a.length<3)return cw(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];cM(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cM(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cM(i,g,h);return i.join("")}function cF(a){if(a.length<4)return cw(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cI(cL,f)+","+cI(cL,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cM(b,f,g);return b.join("")}function cG(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cI(cL,g),",",cI(cL,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cM(b,g,h);return b.join("")}function cH(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cE(a)}function cI(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cM(a,b,c){a.push("C",cI(cJ,b),",",cI(cJ,c),",",cI(cK,b),",",cI(cK,c),",",cI(cL,b),",",cI(cL,c))}function cN(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cO(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cN(e,f);while(++b<c)d[b]=g+(g=cN(e=f,f=a[b+1]));return d[b]=g,d}function cP(a){var b=[],c,d,e,f,g=cO(a),h=-1,i=a.length-1;while(++h<i)c=cN(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cQ(a){return a.length<3?cw(a):a[0]+cC(a,cP(a))}function cR(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+cl,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cS(a){function j(f){if(f.length<1)return null;var j=cs(this,f,b,d),k=cs(this,f,b===c?cT(j):c,d===e?cU(j):e);return"M"+g(a(k),i)+"L"+h(a(j.reverse()),i)+"Z"}var b=ct,c=ct,d=0,e=cu,f,g,h,i=.7;return j.x=function(a){return arguments.length?(b=c=a,j):c},j.x0=function(a){return arguments.length?(b=a,j):b},j.x1=function(a){return arguments.length?(c=a,j):c},j.y=function(a){return arguments.length?(d=e=a,j):e},j.y0=function(a){return arguments.length?(d=a,j):d},j.y1=function(a){return arguments.length?(e=a,j):e},j.interpolate=function(a){return arguments.length?(g=cv[f=a],h=g.reverse||g,j):f},j.tension=function(a){return arguments.length?(i=a,j):i},j.interpolate("linear")}function cT(a){return function(b,c){return a[c][0]}}function cU(a){return function(b,c){return a[c][1]}}function cV(a){return a.source}function cW(a){return a.target}function cX(a){return a.radius}function cY(a){return a.startAngle}function cZ(a){return a.endAngle}function c$(a){return[a.x,a.y]}function c_(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+cl;return[c*Math.cos(d),c*Math.sin(d)]}}function db(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(da<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();da=!e.f&&!e.e,d.remove()}return da?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse()),[c.x,c.y]}function dc(){return 64}function dd(){return"circle"}function dh(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function di(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function dj(a,b,c){e=[];if(c&&b.length>1){var d=bO(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function dv(a,b){a.select(".extent").attr("x",b[0][0]),a.selectAll(".n,.s,.w,.nw,.sw").attr("x",b[0][0]-2),a.selectAll(".e,.ne,.se").attr("x",b[1][0]-3),a.selectAll(".extent,.n,.s").attr("width",b[1][0]-b[0][0])}function dw(a,b){a.select(".extent").attr("y",b[0][1]),a.selectAll(".n,.e,.w,.nw,.ne").attr("y",b[0][1]-3),a.selectAll(".s,.se,.sw").attr("y",b[1][1]-4),a.selectAll(".extent,.e,.w").attr("height",b[1][1]-b[0][1])}function dx(){d3.event.keyCode==32&&dm&&!dr&&(dt=null,du[0]-=dq[1][0],du[1]-=dq[1][1],dr=2,O())}function dy(){d3.event.keyCode==32&&dr==2&&(du[0]+=dq[1][0],du[1]+=dq[1][1],dr=0,O())}function dz(){if(du){var a=d3.svg.mouse(dm),b=d3.select(dm);dr||(d3.event.altKey?(dt||(dt=[(dq[0][0]+dq[1][0])/2,(dq[0][1]+dq[1][1])/2]),du[0]=dq[+(a[0]<dt[0])][0],du[1]=dq[+(a[1]<dt[1])][1]):dt=null),dn&&(dA(a,dn,0),dv(b,dq)),dp&&(dA(a,dp,1),dw(b,dq)),dl("brush")}}function dA(a,b,c){var d=bP(b),e=d[0],f=d[1],g=du[c],h=dq[1][c]-dq[0][c],i,j;dr&&(e-=g,f-=h+g),i=Math.max(e,Math.min(f,a[c])),dr?j=(i+=g)+h:(dt&&(g=Math.max(e,Math.min(f,2*dt[c]-i))),g<i?(j=i,i=g):j=g),dq[0][c]=i,dq[1][c]=j}function dB(){du&&(dz(),d3.select(dm).selectAll(".resize").style("pointer-events",dk.empty()?"none":"all"),dl("brushend"),dk=dl=dm=dn=dp=dq=dr=ds=dt=du=null,O())}function dK(a){var b=dL(),c=d3.event,d=d3.event={type:a};b&&(d.x=b[0]+dH[0],d.y=b[1]+dH[1],d.dx=b[0]-dI[0],d.dy=b[1]-dI[1],dJ|=d.dx|d.dy,dI=b);try{dD[a].apply(dF,dG)}finally{d3.event=c}c.stopPropagation(),c.preventDefault()}function dL(){var a=dF.parentNode,b=d3.event.changedTouches;return a&&(b?d3.svg.touches(a,b)[0]:d3.svg.mouse(a))}function dM(){if(!dF)return;var a=dF.parentNode;if(!a)return dN();dK("drag"),O()}function dN(){if(!dF)return;dK("dragend"),dJ&&(O(),dJ=d3.event.target===dE),dD=dE=dF=dG=dH=dI=null}function dO(){dJ&&(O(),dJ=0)}function d_(a){return[a[0]-dU[0],a[1]-dU[1],dU[2]]}function ea(){dP||(dP=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{dP.scrollTop=1e3,dP.dispatchEvent(a),b=1e3-dP.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function eb(){var a=d3.svg.touches(dY),b=-1,c=a.length,d;while(++b<c)dS[(d=a[b]).identifier]=d_(d);return a}function ec(){var a=d3.svg.touches(dY);switch(a.length){case 1:var b=a[0];eg(dU[2],b,dS[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=dS[c.identifier],g=dS[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];eg(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function ed(){dR=null,dQ&&(d$=1,eg(dU[2],d3.svg.mouse(dY),dQ))}function ee(){dQ&&(d$&&(O(),d$=dX===d3.event.target),dU=dV=dW=dX=dY=dZ=dQ=null)}function ef(){d$&&(O(),d$=0)}function eg(a,b,c){function l(a,b,c){a.domain(a.range().map(function(f){return a.invert((f-c)*d/e+b)}))}a=ei(a,2);var d=Math.pow(2,dU[2]),e=Math.pow(2,a),f=Math.pow(2,(dU[2]=a)-c[2]),g=dU[0],h=dU[1],i=dU[0]=ei(b[0]-c[0]*f,0,e),j=dU[1]=ei(b[1]-c[1]*f,1,e),k=d3.event;d3.event={scale:e,translate:[i,j],transform:function(a,b){a&&l(a,g,i),b&&l(b,h,j)}};try{dW.apply(dY,dZ)}finally{d3.event=k}k.preventDefault()}function ei(a,b,c){var d=dV[b],e=d[0],f=d[1];return arguments.length===3?Math.max(f*(f===Infinity?-Infinity:1/c-1),Math.min(e===-Infinity?Infinity:e,a/c))*c:Math.max(e,Math.min(f,a))}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.7.2"};var d=f;try{d(document.documentElement.childNodes)[0].nodeType}catch(g){d=e}var h=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){var c=1,d=arguments.length,e;while(++c<d)a[e=arguments[c]]=j(a,b,b[e]);return a},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(arguments.length===1)while(++f<c)k(d=a[f])&&(e+=(d-e)/++g);else while(++f<c)k(d=b.call(a,a[f],f))&&(e+=(d-e)/++g);return g?e:undefined},d3.median=function(a,b){return arguments.length>1&&(a=a.map(b)),a=a.filter(k),a.length?d3.quantile(a.sort(d3.ascending),.5):undefined},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.extent=function(a,b){var c=-1,d=a.length,e,f,g;if(arguments.length===1){while(++c<d&&((e=g=a[c])==null||e!=e))e=g=undefined;while(++c<d)(f=a[c])!=null&&(e>f&&(e=f),g<f&&(g=f))}else{while(++c<d&&((e=g=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&(e>f&&(e=f),g<f&&(g=f))}return[e,g]},d3.random={normal:function(a,b){return arguments.length<2&&(b=1),arguments.length<1&&(a=0),function(){var c,d,e;do c=Math.random()*2-1,d=Math.random()*2-1,e=c*c+d*d;while(!e||e>1);return a+b*c*Math.sqrt(-2*Math.log(e)/e)}}},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.transpose=function(a){return d3.zip.apply(d3,a)},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,l),c=new Array(b);++a<b;)for(var d=-1,e,f=c[a]=new Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});return f&&e.sort(function(a,b){return f(a.key,b.key)}),e}var a={},b=[],c=[],d,e;return a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){return b.push(c),a},a.sortKeys=function(d){return c[b.length-1]=d,a},a.sortValues=function(b){return d=b,a},a.rollup=function(b){return e=b,a},a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=m);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(o,"\\$&")};var o=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?(c=b,b=null):b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),b&&d.setRequestHeader("Accept",b),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)};var p={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/"};d3.ns={prefix:p,qualify:function(a){var b=a.indexOf(":");return b<0?a in p?{space:p[a],local:a}:a:{space:p[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(){var a=new q,b=-1,c=arguments.length;while(++b<c)a[arguments[b]]=r();return a},q.prototype.on=function(a,b){var c=a.indexOf("."),d="";return c>0&&(d=a.substring(c+1),a=a.substring(0,c)),arguments.length<2?this[a].on(d):(this[a].on(d,b),this)},d3.format=function(a){var b=s.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=1,k="",l=!1;h&&(h=+h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=100,k="%",i="f";break;case"p":j=100,k="%",i="r";break;case"d":l=!0,h=0;break;case"s":j=-1,i="r"}return i=="r"&&!h&&(i="g"),i=t[i]||v,function(a){if(l&&a%1)return"";var b=a<0&&(a=-a)?"−":d;if(j<0){var m=d3.formatPrefix(a,h);a*=m.scale,k=m.symbol}else a*=j;a=i(a,h);if(e){var n=a.length+b.length;n<f&&(a=(new Array(f-n+1)).join(c)+a),g&&(a=w(a)),a=b+a}else{g&&(a=w(a)),a=b+a;var n=a.length;n<f&&(a=(new Array(f-n+1)).join(c)+a)}return a+k}};var s=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,t={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return d3.round(a,b=u(a,b)).toFixed(Math.max(0,Math.min(20,b)))}},x=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(y);d3.formatPrefix=function(a,b){var c=0;return a&&(a<0&&(a*=-1),b&&(a=d3.round(a,u(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,Math.floor((c<=0?c+1:c-1)/3)*3))),x[8+c/3]};var z=H(2),A=H(3),B={linear:function(){return G},poly:H,quad:function(){return z},cubic:function(){return A},sin:function(){return I},exp:function(){return J},circle:function(){return K},elastic:L,back:M,bounce:function(){return N}},C={"in":function(a){return a},out:E,"in-out":F,"out-in":function(a){return F(E(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return D(C[d](B[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){return b-=a,function(c){return a+b*c}},d3.interpolateRound=function(a,b){return b-=a,function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;P.lastIndex=0;for(d=0;c=P.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=P.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=P.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateTransform=function(a,b){return d3.interpolateString(d3.transform(a)+"",d3.transform(b)+"")},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"#"+V(Math.round(c+f*a))+V(Math.round(d+g*a))+V(Math.round(e+h*a))}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return bb(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=Q(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var P=/[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return(typeof a=="string"||typeof b=="string")&&d3.interpolateString(a+"",b+"")},function(a,b){return(typeof b=="string"?b in Z||/^(#|rgb\(|hsl\()/.test(b):b instanceof U||b instanceof ba)&&d3.interpolateRgb(a,b)},function(a,b){return!isNaN(a=+a)&&!isNaN(b=+b)&&d3.interpolateNumber(a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?a instanceof U?T(a.r,a.g,a.b):W(""+a,T,bb):T(~~a,~~b,~~c)},U.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;return!b&&!c&&!d?T(e,e,e):(b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e),T(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a))))},U.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),T(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))},U.prototype.hsl=function(){return X(this.r,this.g,this.b)},U.prototype.toString=function(){return"#"+V(this.r)+V(this.g)+V(this.b)};var Z={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var $ in Z)Z[$]=W(Z[$],T,bb);d3.hsl=function(a,b,c){return arguments.length===1?
a instanceof ba?_(a.h,a.s,a.l):W(""+a,X,_):_(+a,+b,+c)},ba.prototype.brighter=function(a){return a=Math.pow(.7,arguments.length?a:1),_(this.h,this.s,this.l/a)},ba.prototype.darker=function(a){return a=Math.pow(.7,arguments.length?a:1),_(this.h,this.s,a*this.l)},ba.prototype.rgb=function(){return bb(this.h,this.s,this.l)},ba.prototype.toString=function(){return this.rgb().toString()};var bd=function(a,b){return b.querySelector(a)},be=function(a,b){return b.querySelectorAll(a)},bf=document.documentElement,bg=bf.matchesSelector||bf.webkitMatchesSelector||bf.mozMatchesSelector||bf.msMatchesSelector||bf.oMatchesSelector,bh=function(a,b){return bg.call(a,b)};typeof Sizzle=="function"&&(bd=function(a,b){return Sizzle(a,b)[0]},be=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))},bh=Sizzle.matchesSelector);var bi=[];d3.selection=function(){return bq},d3.selection.prototype=bi,bi.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=bj(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return bc(b)},bi.selectAll=function(a){var b=[],c,e;typeof a!="function"&&(a=bk(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i])b.push(c=d(a.call(e,e.__data__,i))),c.parentNode=e;return bc(b)},bi.attr=function(a,b){function d(){this.removeAttribute(a)}function e(){this.removeAttributeNS(a.space,a.local)}function f(){this.setAttribute(a,b)}function g(){this.setAttributeNS(a.space,a.local,b)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},bi.classed=function(a,b){var c=a.split(bl),d=c.length,e=-1;if(arguments.length>1){while(++e<d)bm.call(this,c[e],b);return this}while(++e<d)if(!bm.call(this,c[e]))return!1;return!0};var bl=/\s+/g;bi.style=function(a,b,c){function d(){this.style.removeProperty(a)}function e(){this.style.setProperty(a,b,c)}function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}return arguments.length<3&&(c=""),arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},bi.property=function(a,b){function c(){delete this[a]}function d(){this[a]=b}function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},bi.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){var b=a.apply(this,arguments);this.textContent=b==null?"":b}:a==null?function(){this.textContent=""}:function(){this.textContent=a})},bi.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){var b=a.apply(this,arguments);this.innerHTML=b==null?"":b}:a==null?function(){this.innerHTML=""}:function(){this.innerHTML=a})},bi.append=function(a){function b(){return this.appendChild(document.createElementNS(this.namespaceURI,a))}function c(){return this.appendChild(document.createElementNS(a.space,a.local))}return a=d3.ns.qualify(a),this.select(a.local?c:b)},bi.insert=function(a,b){function c(){return this.insertBefore(document.createElementNS(this.namespaceURI,a),bd(b,this))}function d(){return this.insertBefore(document.createElementNS(a.space,a.local),bd(b,this))}return a=d3.ns.qualify(a),this.select(a.local?d:c)},bi.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},bi.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bn(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bn(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bn(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=bc(d);return j.enter=function(){return br(c)},j.exit=function(){return bc(e)},j},bi.filter=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bo(a));for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return bc(b)},bi.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},bi.order=function(){for(var a=-1,b=this.length;++a<b;)for(var c=this[a],d=c.length-1,e=c[d],f;--d>=0;)if(f=c[d])e&&e!==f.nextSibling&&e.parentNode.insertBefore(f,e),e=f;return this},bi.sort=function(a){a=bp.apply(this,arguments);for(var b=-1,c=this.length;++b<c;)this[b].sort(a);return this.order()},bi.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");return e>0&&(a=a.substring(0,e)),arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},bi.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},bi.call=function(a){return a.apply(this,(arguments[0]=this,arguments)),this},bi.empty=function(){return!this.node()},bi.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},bi.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bt(a,bz||++by,Date.now())};var bq=bc([[document]]);bq[0].parentNode=bf,d3.select=function(a){return typeof a=="string"?bq.select(a):bc([[a]])},d3.selectAll=function(a){return typeof a=="string"?bq.selectAll(a):bc([d(a)])};var bs=[];bs.append=bi.append,bs.insert=bi.insert,bs.empty=bi.empty,bs.node=bi.node,bs.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return bc(b)};var bu={},bx=[],by=0,bz=0,bA=d3.ease("cubic-in-out");bx.call=bi.call,d3.transition=function(){return bq.transition()},d3.transition.prototype=bx,bx.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bj(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bt(b,this.id,this.time).ease(this.ease())},bx.selectAll=function(a){var b=[],c,d,e;typeof a!="function"&&(a=bk(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i]){d=a.call(e.node,e.node.__data__,i),b.push(c=[]);for(var k=-1,l=d.length;++k<l;)c.push({node:d[k],delay:e.delay,duration:e.duration})}return bt(b,this.id,this.time).ease(this.ease())},bx.attr=function(a,b){return this.attrTween(a,bw(a,b))},bx.attrTween=function(a,b){function d(a,d){var e=b.call(this,a,d,this.getAttribute(c));return e===bu?(this.removeAttribute(c),null):e&&function(a){this.setAttribute(c,e(a))}}function e(a,d){var e=b.call(this,a,d,this.getAttributeNS(c.space,c.local));return e===bu?(this.removeAttributeNS(c.space,c.local),null):e&&function(a){this.setAttributeNS(c.space,c.local,e(a))}}var c=d3.ns.qualify(a);return this.tween("attr."+a,c.local?e:d)},bx.style=function(a,b,c){return arguments.length<3&&(c=""),this.styleTween(a,bw(a,b),c)},bx.styleTween=function(a,b,c){return arguments.length<3&&(c=""),this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f===bu?(this.style.removeProperty(a),null):f&&function(b){this.style.setProperty(a,f(b),c)}})},bx.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bx.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bx.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bx.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bx.transition=function(){return this.select(i)};var bC=null,bD,bE;d3.timer=function(a,b,c){var d=!1,e,f=bC;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bC={callback:a,then:c,delay:b,next:bC}),bD||(bE=clearTimeout(bE),bD=1,bH(bF))},d3.timer.flush=function(){var a,b=Date.now(),c=bC;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bG()};var bH=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.transform=function(a){var b=document.createElementNS(d3.ns.prefix.svg,"g"),c={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(a){b.setAttribute("transform",a);var d=b.transform.baseVal.consolidate();return new bI(d?d.matrix:c)})(a)},bI.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bM=180/Math.PI;d3.scale={},d3.scale.linear=function(){return bS([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return b$(d3.scale.linear(),ca)};var b_=d3.format(".0e");ca.pow=function(a){return Math.pow(10,a)},cb.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return cc(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return ce([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(cf)},d3.scale.category20=function(){return d3.scale.ordinal().range(cg)},d3.scale.category20b=function(){return d3.scale.ordinal().range(ch)},d3.scale.category20c=function(){return d3.scale.ordinal().range(ci)};var cf=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cg=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],ch=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],ci=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return cj([],[])},d3.scale.quantize=function(){return ck(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+cl,h=d.apply(this,arguments)+cl,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=cm?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=cn,b=co,c=cp,d=cq;return e.innerRadius=function(b){return arguments.length?(a=d3.functor(b),e):a},e.outerRadius=function(a){return arguments.length?(b=d3.functor(a),e):b},e.startAngle=function(a){return arguments.length?(c=d3.functor(a),e):c},e.endAngle=function(a){return arguments.length?(d=d3.functor(a),e):d},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cl;return[Math.cos(f)*e,Math.sin(f)*e]},e};var cl=-Math.PI/2,cm=2*Math.PI-1e-6;d3.svg.line=function(){return cr(Object)};var cv={linear:cw,"step-before":cx,"step-after":cy,basis:cE,"basis-open":cF,"basis-closed":cG,bundle:cH,cardinal:cB,"cardinal-open":cz,"cardinal-closed":cA,monotone:cQ},cJ=[0,2/3,1/3,0],cK=[0,1/3,2/3,0],cL=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=cr(cR);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},cx.reverse=cy,cy.reverse=cx,d3.svg.area=function(){return cS(Object)},d3.svg.area.radial=function(){var a=cS(cR);return a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1,a},d3.svg.chord=function(){function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1,e.a1-e.a0)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1,f.a1-f.a0)+j(f.r,f.p1,e.r,e.p0))+"Z"}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cl,k=e.call(a,h,g)+cl;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function i(a,b,c){return"A"+a+","+a+" 0 "+ +(c>Math.PI)+",1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=cV,b=cW,c=cX,d=cp,e=cq;return f.radius=function(a){return arguments.length?(c=d3.functor(a),f):c},f.source=function(b){return arguments.length?(a=d3.functor(b),f):a},f.target=function(a){return arguments.length?(b=d3.functor(a),f):b},f.startAngle=function(a){return arguments.length?(d=d3.functor(a),f):d},f.endAngle=function(a){return arguments.length?(e=d3.functor(a),f):e},f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];return i=i.map(c),"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cV,b=cW,c=c$;return d.source=function(b){return arguments.length?(a=d3.functor(b),d):a},d.target=function(a){return arguments.length?(b=d3.functor(a),d):b},d.projection=function(a){return arguments.length?(c=a,d):c},d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=c$,c=a.projection;return a.projection=function(a){return arguments.length?c(c_(b=a)):b},a},d3.svg.mouse=function(a){return db(a,d3.event)};var da=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a,b){return arguments.length<2&&(b=d3.event.touches),b?d(b).map(function(b){var c=db(a,b);return c.identifier=b.identifier,c}):[]},d3.svg.symbol=function(){function c(c,d){return(de[a.call(this,c,d)]||de.circle)(b.call(this,c,d))}var a=dd,b=dc;return c.type=function(b){return arguments.length?(a=d3.functor(b),c):a},c.size=function(a){return arguments.length?(b=d3.functor(a),c):b},c};var de={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*dg)),c=b*dg;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/df),c=b*df/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/df),c=b*df/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(de);var df=Math.sqrt(3),dg=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){var n=d3.select(this),o=j.delay?function(a){var b=bz;try{return bz=j.id,a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease())}finally{bz=b}}:Object,p=a.ticks?a.ticks.apply(a,g):a.domain(),q=h==null?a.tickFormat?a.tickFormat.apply(a,g):String:h,r=dj(a,p,i),s=n.selectAll(".minor").data(r,String),t=s.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),u=o(s.exit()).style("opacity",1e-6).remove(),v=o(s).style("opacity",1),w=n.selectAll("g").data(p,String),x=w.enter().insert("g","path").style("opacity",1e-6),y=o(w.exit()).style("opacity",1e-6).remove(),z=o(w).style("opacity",1),A,B=bP(a),C=n.selectAll(".domain").data([0]),D=C.enter().append("path").attr("class","domain"),E=o(C),F=a.copy(),G=this.__chart__||F;this.__chart__=F,x.append("line").attr("class","tick"),x.append("text"),z.select("text").text(q);switch(b){case"bottom":A=dh,t.attr("y2",d),v.attr("x2",0).attr("y2",d),x.select("line").attr("y2",c),x.select("text").attr("y",Math.max(c,0)+f),z.select("line").attr("x2",0).attr("y2",c),z.select("text").attr("x",0).attr("y",Math.max(c,0)+f).attr("dy",".71em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+e+"V0H"+B[1]+"V"+e);break;case"top":A=dh,t.attr("y2",-d),v.attr("x2",0).attr("y2",-d),x.select("line").attr("y2",-c),x.select("text").attr("y",-(Math.max(c,0)+f)),z.select("line").attr("x2",0).attr("y2",-c),z.select("text").attr("x",0).attr("y",-(Math.max(c,0)+f)).attr("dy","0em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+ -e+"V0H"+B[1]+"V"+ -e);break;case"left":A=di,t.attr("x2",-d),v.attr("x2",-d).attr("y2",0),x.select("line").attr("x2",-c),x.select("text").attr("x",-(Math.max(c,0)+f)),z.select("line").attr("x2",-c).attr("y2",0),z.select("text").attr("x",-(Math.max(c,0)+f)).attr("y",0).attr("dy",".32em").attr("text-anchor","end"),E.attr("d","M"+ -e+","+B[0]+"H0V"+B[1]+"H"+ -e);break;case"right":A=di,t.attr("x2",d),v.attr("x2",d).attr("y2",0),x.select("line").attr("x2",c),x.select("text").attr("x",Math.max(c,0)+f),z.select("line").attr("x2",c).attr("y2",0),z.select("text").attr("x",Math.max(c,0)+f).attr("y",0).attr("dy",".32em").attr("text-anchor","start"),E.attr("d","M"+e+","+B[0]+"H0V"+B[1]+"H"+e)}if(a.ticks)x.call(A,G),z.call(A,F),y.call(A,F),t.call(A,G),v.call(A,F),u.call(A,F);else{var H=F.rangeBand()/2,I=function(a){return F(a)+H};x.call(A,I),z.call(A,I)}})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;return j.scale=function(b){return arguments.length?(a=b,j):a},j.orient=function(a){return arguments.length?(b=a,j):b},j.ticks=function(){return arguments.length?(g=arguments,j):g},j.tickFormat=function(a){return arguments.length?(h=a,j):h},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;return c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c,j},j.tickPadding=function(a){return arguments.length?(f=+a,j):f},j.tickSubdivide=function(a){return arguments.length?(i=+a,j):i},j},d3.svg.brush=function(){function e(a){var g=b&&c?["n","e","s","w","nw","ne","se","sw"]:b?["e","w"]:c?["n","s"]:[];a.each(function(){var a=d3.select(this).on("mousedown.brush",f),h=a.selectAll(".background").data([,]),i=a.selectAll(".extent").data([,]),j=a.selectAll(".resize").data(g,String),k;h.enter().append("rect").attr("class","background").style("visibility","hidden").style("pointer-events","all").style("cursor","crosshair"),i.enter().append("rect").attr("class","extent").style("cursor","move"),j.enter().append("rect").attr("class",function(a){return"resize "+a}).attr("width",6).attr("height",6).style("visibility","hidden").style("pointer-events",e.empty()?"none":"all").style("cursor",function(a){return dC[a]}),j.exit().remove(),b&&(k=bP(b),h.attr("x",k[0]).attr("width",k[1]-k[0]),dv(a,d)),c&&(k=bP(c),h.attr("y",k[0]).attr("height",k[1]-k[0]),dw(a,d))})}function f(){var a=d3.select(d3.event.target);dk=e,dm=this,dq=d,du=d3.svg.mouse(dm),(dr=a.classed("extent"))?(du[0]=d[0][0]-du[0],du[1]=d[0][1]-du[1]):a.classed("resize")?(ds=d3.event.target.__data__,du[0]=d[+/w$/.test(ds)][0],du[1]=d[+/^n/.test(ds)][1]):d3.event.altKey&&(dt=du.slice()),dn=!/^(n|s)$/.test(ds)&&b,dp=!/^(e|w)$/.test(ds)&&c,dl=g(this,arguments),dl("brushstart"),dz(),O()}function g(b,c){return function(d){var f=d3.event;try{d3.event={type:d,target:e},a[d].apply(b,c)}finally{d3.event=f}}}var a=d3.dispatch("brushstart","brush","brushend"),b,c,d=[[0,0],[0,0]];return e.x=function(a){return arguments.length?(b=a,e):b},e.y=function(a){return arguments.length?(c=a,e):c},e.extent=function(a){var f,g,h,i,j;return arguments.length?(b&&(f=a[0],g=a[1],c&&(f=f[0],g=g[0]),b.invert&&(f=b(f),g=b(g)),g<f&&(j=f,f=g,g=j),d[0][0]=f,d[1][0]=g),c&&(h=a[0],i=a[1],b&&(h=h[1],i=i[1]),c.invert&&(h=c(h),i=c(i)),i<h&&(j=h,h=i,i=j),d[0][1]=h,d[1][1]=i),e):(b&&(f=d[0][0],g=d[1][0],b.invert&&(f=b.invert(f),g=b.invert(g)),g<f&&(j=f,f=g,g=j)),c&&(h=d[0][1],i=d[1][1],c.invert&&(h=c.invert(h),i=c.invert(i)),i<h&&(j=h,h=i,i=j)),b&&c?[[f,h],[g,i]]:b?[f,g]:c&&[h,i])},e.clear=function(){return d[0][0]=d[0][1]=d[1][0]=d[1][1]=0,e},e.empty=function(){return b&&d[0][0]===d[1][0]||c&&d[0][1]===d[1][1]},d3.select(window).on("mousemove.brush",dz).on("mouseup.brush",dB).on("keydown.brush",dx).on("keyup.brush",dy),d3.rebind(e,a,"on")};var dk,dl,dm,dn,dp,dq,dr,ds,dt,du,dC={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};d3.behavior={},d3.behavior.drag=function(){function c(){this.on("mousedown.drag",e).on("touchstart.drag",e),d3.select(window).on("mousemove.drag",dM).on("touchmove.drag",dM).on("mouseup.drag",dN,!0).on("touchend.drag",dN,!0).on("click.drag",dO,!0)}function d(){dD=a,dE=d3.event.target,dF=this,dG=arguments,dI=dL(),b?(dH=b.apply(dF,dG),dH=[dH.x-dI[0],dH.y-dI[1]]):dH=[0,0],dJ=0}function e(){d.apply(this,arguments),dK("dragstart")}var a=d3.dispatch("drag","dragstart","dragend"),b=null;return c.origin=function(a){return arguments.length?(b=a,c):b},d3.rebind(c,a,"on")};var dD,dE,dF,dG,dH,dI,dJ;d3.behavior.zoom=function(){function d(){this.on("mousedown.zoom",f).on("mousewheel.zoom",g).on("DOMMouseScroll.zoom",g).on("dblclick.zoom",h).on("touchstart.zoom",i),d3.select(window).on("mousemove.zoom",ed).on("mouseup.zoom",ee).on("touchmove.zoom",ec).on("touchend.zoom",eb).on("click.zoom",ef,!0)}function e(){dU=a,dV=c,dW=b.zoom,dX=d3.event.target,dY=this,dZ=arguments}function f(){e.apply(this,arguments),dQ=d_(d3.svg.mouse(dY)),d$=0,d3.event.preventDefault(),window.focus()}function g(){e.apply(this,arguments),dR||(dR=d_(d3.svg.mouse(dY))),eg(ea()+a[2],d3.svg.mouse(dY),dR)}function h(){e.apply(this,arguments);var b=d3.svg.mouse(dY);eg(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,d_(b))}function i(){e.apply(this,arguments);var b=eb(),c,d=Date.now();b.length===1&&d-dT<300&&eg(1+Math.floor(a[2]),c=b[0],dS[c.identifier]),dT=d}var a=[0,0,0],b=d3.dispatch("zoom"),c=eh;return d.extent=function(a){return arguments.length?(c=a==null?eh:a,d):c},d3.rebind(d,b,"on")};var dP,dQ,dR,dS={},dT=0,dU,dV,dW,dX,dY,dZ,d$,eh=[[-Infinity,Infinity],[-Infinity,Infinity],[-Infinity,Infinity]]}(),function(){function b(a,b,c,d){var e,f,g=0,i=b.length,j=c.length;while(g<i){if(d>=j)return-1;e=b.charCodeAt(g++);if(e==37){f=h[b.charAt(g++)];if(!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function i(a,b,c){return b.substring(c,c+=3).toLowerCase()in j?c:-1}function k(a,b,c){l.lastIndex=0;var d=l.exec(b.substring(c,c+10));return d?c+=d[0].length:-1}function n(a,b,c){var d=o[b.substring(c,c+=3).toLowerCase()];return d==null?-1:(a.setMonth(d),c)}function p(a,b,c){q.lastIndex=0;var d=q.exec(b.substring(c,c+12));return d?(a.setMonth(r[d[0].toLowerCase()]),c+=d[0].length):-1}function t(a,c,d){return b(a,g.c.toString(),c,d)}function u(a,c,d){return b(a,g.x.toString(),c,d)}function v(a,c,d){return b(a,g.X.toString(),c,d)}function w(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+4));return d?(a.setFullYear(d[0]),c+=d[0].length):-1}function x(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setFullYear(y()+ +d[0]),c+=d[0].length):-1}function y(){return~~((new Date).getFullYear()/1e3)*1e3}function z(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setMonth(d[0]-1),c+=d[0].length):-1}function A(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setDate(+d[0]),c+=d[0].length):-1}function B(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setHours(+d[0]),c+=d[0].length):-1}function C(a,b,c){return a.hour12=!0,B(a,b,c)}function D(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setMinutes(+d[0]),c+=d[0].length):-1}function E(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setSeconds(+d[0]),c+=d[0].length):-1}function F(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+3));return d?(a.setMilliseconds(+d[0]),c+=d[0].length):-1}function H(a,b,c){var d=I[b.substring(c,c+=2).toLowerCase()];return d==null?-1:(a.hour12pm=d,c)}function J(b){return new a(b.getFullYear(),0,1)}function K(a,b){return~~((b-a)/864e5-(b.getTimezoneOffset()-a.getTimezoneOffset())/1440)}function L(a){return d(1+K(J(a),a))}function M(a){var b=J(a);return c(~~((K(b,a)+b.getDay())/7))}function N(a){var b=J(a);return c(~~((K(b,a)+(b.getDay()+6)%7)/7))}function O(a){var b=a.getTimezoneOffset(),d=b>0?"-":"+",e=~~(Math.abs(b)/60),f=Math.abs(b)%60;return d+c(e)+c(f)}function P(){this._=new Date(Date.UTC.apply(this,arguments))}function R(a){return a.toISOString()}function S(a,b,c){return function(d,e,f){var g=a(d),h=[];g<d&&b(g);if(f>1)while(g<e){var i=new Date(+g);c(i)%f||h.push(i),b(g)}else while(g<e)h.push(new Date(+g)),b(g);return h}}function T(a){a.setTime(a.getTime()+6e4)}function U(a){a.setTime(a.getTime()+36e5)}function V(a,b,c){function d(b){return a(b)}return d.invert=function(b){return X(a.invert(b))},d.domain=function(b){return arguments.length?(a.domain(b),d):a.domain().map(X)},d.ticks=function(a,c){var e=W(d.domain());if(typeof a!="function"){var f=e[1]-e[0],g=f/a,h=d3.bisect(Z,g,1,Z.length-1);Math.log(g/Z[h-1])<Math.log(Z[h]/g)&&--h,a=b[h],c=a[1],a=a[0]}return a(e[0],e[1],c)},d.tickFormat=function(){return c},d.copy=function(){return V(a.copy(),b,c)},d3.rebind(d,a,"range","rangeRound","interpolate","clamp")}function W(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function X(a){return new Date(a)}function Y(a){return function(b){var c=a.length-1,d=a[c];while(!d[1](b))d=a[--c];return d[0](b)}}d3.time={};var a=Date;d3.time.format=function(c){function e(a){var b=[],e=-1,f=0,h,i;while(++e<d)c.charCodeAt(e)==37&&(b.push(c.substring(f,e),(i=g[h=c.charAt(++e)])?i(a):h),f=e+1);return b.push(c.substring(f,e)),b.join("")}var d=c.length;return e.parse=function(d){var e=new a(1900,0,1),f=b(e,c,d,0);if(f!=d.length)return null;if(e.hour12){var g=e.getHours()%12;e.setHours(e.hour12pm?g+12:g)}return delete e.hour12,delete e.hour12pm,e},e.toString=function(){return c},e};var c=d3.format("02d"),d=d3.format("03d"),e=d3.format("04d"),f=d3.format("2d"),g={a:function(a){return m[a.getDay()].substring(0,3)},A:function(a){return m[a.getDay()]},b:function(a){return s[a.getMonth()].substring(0,3)},B:function(a){return s[a.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(a){return c(a.getDate())},e:function(a){return f(a.getDate())},H:function(a){return c(a.getHours())},I:function(a){return c(a.getHours()%12||12)},j:L,L:function(a){return d(a.getMilliseconds())},m:function(a){return c(a.getMonth()+1)},M:function(a){return c(a.getMinutes())},p:function(a){return a.getHours()>=12?"PM":"AM"},S:function(a){return c(a.getSeconds())},U:M,w:function(a){return a.getDay()},W:N,x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(a){return c(a.getFullYear()%100)},Y:function(a){return e(a.getFullYear()%1e4)},Z:O,"%":function(a){return"%"}},h={a:i,A:k,b:n,B:p,c:t,d:A,e:A,H:B,I:C,L:F,m:z,M:D,p:H,S:E,x:u,X:v,y:x,Y:w},j={sun:3,mon:3,tue:3,wed:3,thu:3,fri:3,sat:3},l=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig,m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],o={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},q=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig,r={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},s=["January","February","March","April","May","June","July","August","September","October","November","December"],G=/\s*\d+/,I={am:0,pm:1};d3.time.format.utc=function(b){function d(b){try{a=P;var d=new a;return d._=b,c(d)}finally{a=Date}}var c=d3.time.format(b);return d.parse=function(b){try{a=P;var d=c.parse(b);return d&&d._}finally{a=Date}},d.toString=c.toString,d},P.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()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.getTime()},setDate:function(a){this._.setUTCDate(a)},setDay:function(a){this._.setUTCDay(a)},setFullYear:function(a){this._.setUTCFullYear(a)},setHours:function(a){this._.setUTCHours(a)},setMilliseconds:function(a){this._.setUTCMilliseconds(a)},setMinutes:function(a){this._.setUTCMinutes(a)},setMonth:function(a){this._.setUTCMonth(a)},setSeconds:function(a){this._.setUTCSeconds(a)}};var Q=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?R:Q,R.parse=function(a){return new Date(a)},R.toString=Q.toString,d3.time.second=function(a){return new Date(~~(a/1e3)*1e3)},d3.time.second.utc=d3.time.second,d3.time.seconds=S(d3.time.second,function(a){a.setTime(a.getTime()+1e3)},function(a){return a.getSeconds()}),d3.time.seconds.utc=d3.time.seconds,d3.time.minute=function(a){return new Date(~~(a/6e4)*6e4)},d3.time.minute.utc=d3.time.minute,d3.time.minutes=S(d3.time.minute,T,function(a){return a.getMinutes()}),d3.time.minutes.utc=S(d3.time.minute,T,function(a){return a.getUTCMinutes()}),d3.time.hour=function(a){var b=a.getTimezoneOffset()/60;return new Date((~~(a/36e5-b)+b)*36e5)},d3.time.hour.utc=function(a){return new Date(~~(a/36e5)*36e5)},d3.time.hours=S(d3.time.hour,U,function(a){return a.getHours()}),d3.time.hours.utc=S(d3.time.hour.utc,U,function(a){return a.getUTCHours()}),d3.time.day=function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())},d3.time.day.utc=function(a){return new Date(~~(a/864e5)*864e5)},d3.time.days=S(d3.time.day,function(a){a.setDate(a.getDate()+1)},function(a){return a.getDate()-1}),d3.time.days.utc=S(d3.time.day.utc,function(a){a.setUTCDate(a.getUTCDate()+1)},function(a){return a.getUTCDate()-1}),d3.time.week=function(a){return(a=d3.time.day(a)).setDate(a.getDate()-a.getDay()),a},d3.time.week.utc=function(a){return(a=d3.time.day.utc(a)).setUTCDate(a.getUTCDate()-a.getUTCDay()),a},d3.time.weeks=S(d3.time.week,function(a){a.setDate(a.getDate()+7)},function(a){return~~((a-new Date(a.getFullYear(),0,1))/6048e5)}),d3.time.weeks.utc=S(d3.time.week.utc,function(a){a.setUTCDate(a.getUTCDate()+7)},function(a){return~~((a-Date.UTC(a.getUTCFullYear(),0,1))/6048e5)}),d3.time.month=function(a){return new Date(a.getFullYear(),a.getMonth(),1)},d3.time.month.utc=function(a){return new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1))},d3.time.months=S(d3.time.month,function(a){a.setMonth(a.getMonth()+1)},function(a){return a.getMonth()}),d3.time.months.utc=S(d3.time.month.utc,function(a){a.setUTCMonth(a.getUTCMonth()+1)},function(a){return a.getUTCMonth()}),d3.time.year=function(a){return new Date(a.getFullYear(),0,1)},d3.time.year.utc=function(a){return new Date(Date.UTC(a.getUTCFullYear(),0,1))},d3.time.years=S(d3.time.year,function(a){a.setFullYear(a.getFullYear()+1)},function(a){return a.getFullYear()}),d3.time.years.utc=S(d3.time.year.utc,function(a){a.setUTCFullYear(a.getUTCFullYear()+1)},function(a){return a.getUTCFullYear()});var Z=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5
,108e5,216e5,432e5,864e5,1728e5,6048e5,1728e6,7776e6,31536e6],$=[[d3.time.seconds,1],[d3.time.seconds,5],[d3.time.seconds,15],[d3.time.seconds,30],[d3.time.minutes,1],[d3.time.minutes,5],[d3.time.minutes,15],[d3.time.minutes,30],[d3.time.hours,1],[d3.time.hours,3],[d3.time.hours,6],[d3.time.hours,12],[d3.time.days,1],[d3.time.days,2],[d3.time.weeks,1],[d3.time.months,1],[d3.time.months,3],[d3.time.years,1]],_=[[d3.time.format("%Y"),function(a){return!0}],[d3.time.format("%B"),function(a){return a.getMonth()}],[d3.time.format("%b %d"),function(a){return a.getDate()!=1}],[d3.time.format("%a %d"),function(a){return a.getDay()&&a.getDate()!=1}],[d3.time.format("%I %p"),function(a){return a.getHours()}],[d3.time.format("%I:%M"),function(a){return a.getMinutes()}],[d3.time.format(":%S"),function(a){return a.getSeconds()||a.getMilliseconds()}]],ba=Y(_);d3.time.scale=function(){return V(d3.scale.linear(),$,ba)};var bb=[[d3.time.seconds.utc,1],[d3.time.seconds.utc,5],[d3.time.seconds.utc,15],[d3.time.seconds.utc,30],[d3.time.minutes.utc,1],[d3.time.minutes.utc,5],[d3.time.minutes.utc,15],[d3.time.minutes.utc,30],[d3.time.hours.utc,1],[d3.time.hours.utc,3],[d3.time.hours.utc,6],[d3.time.hours.utc,12],[d3.time.days.utc,1],[d3.time.days.utc,2],[d3.time.weeks.utc,1],[d3.time.months.utc,1],[d3.time.months.utc,3],[d3.time.years.utc,1]],bc=[[d3.time.format.utc("%Y"),function(a){return!0}],[d3.time.format.utc("%B"),function(a){return a.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(a){return a.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(a){return a.getUTCDay()&&a.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(a){return a.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(a){return a.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(a){return a.getUTCSeconds()||a.getUTCMilliseconds()}]],bd=Y(bc);d3.time.scale.utc=function(){return V(d3.scale.linear(),bb,bd)}}(),function(){var Graphene,__bind=function(a,b){return function(){return a.apply(b,arguments)}},__hasProp=Object.prototype.hasOwnProperty,__extends=function(a,b){function d(){this.constructor=a}for(var c in b)__hasProp.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};Graphene=function(){function Graphene(){this.build=__bind(this.build,this)}return Graphene.prototype.demo=function(){return this.is_demo=!0},Graphene.prototype.build=function(json){var _this=this;return _.each(_.keys(json),function(k){var klass,model_opts,ts;return console.log("building ["+k+"]"),_this.is_demo?klass=Graphene.DemoTimeSeries:klass=Graphene.TimeSeries,model_opts={source:json[k].source},delete json[k].source,json[k].refresh_interval&&(model_opts.refresh_interval=json[k].refresh_interval,delete json[k].refresh_interval),ts=new klass(model_opts),_.each(json[k],function(opts,view){return klass=eval("Graphene."+view+"View"),console.log(_.extend({model:ts},opts)),new klass(_.extend({model:ts},opts))}),ts.start(),console.log(ts)})},Graphene.prototype.discover=function(a,b,c,d){return $.get(""+a+"/dashboard/load/"+b,function(b){var e,f;return f=0,e={},_.each(b.state.graphs,function(b){var d;return d=b[2],e["Graph "+f]={source:""+a+d+"&format=json",TimeSeries:{parent:c(f,a)}},f++}),d(e)})},Graphene}(),this.Graphene=Graphene,Graphene.GraphiteModel=function(a){function b(){this.process_data=__bind(this.process_data,this),this.refresh=__bind(this.refresh,this),this.stop=__bind(this.stop,this),this.start=__bind(this.start,this),b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.defaults={source:"",data:null,ymin:0,ymax:0,refresh_interval:1e4},b.prototype.debug=function(){return console.log(""+this.get("refresh_interval"))},b.prototype.start=function(){return this.refresh(),console.log("Starting to poll at "+this.get("refresh_interval")),this.t_index=setInterval(this.refresh,this.get("refresh_interval"))},b.prototype.stop=function(){return clearInterval(this.t_index)},b.prototype.refresh=function(){var a,b,c=this;return b=this.get("source"),-1===b.indexOf("&jsonp=?")&&(b+="&jsonp=?"),a={url:b,dataType:"json",jsonp:"jsonp",success:function(a){return console.log("got data."),c.process_data(a)}},$.ajax(a)},b.prototype.process_data=function(){return null},b}(Backbone.Model),Graphene.DemoTimeSeries=function(a){function b(){this.add_points=__bind(this.add_points,this),this.refresh=__bind(this.refresh,this),this.stop=__bind(this.stop,this),this.start=__bind(this.start,this),b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.defaults={range:[0,1e3],num_points:100,num_new_points:1,num_series:2,refresh_interval:3e3},b.prototype.debug=function(){return console.log(""+this.get("refresh_interval"))},b.prototype.start=function(){var a=this;return console.log("Starting to poll at "+this.get("refresh_interval")),this.data=[],_.each(_.range(this.get("num_series")),function(b){return a.data.push({label:"Series "+b,ymin:0,ymax:0,points:[]})}),this.point_interval=this.get("refresh_interval")/this.get("num_new_points"),_.each(this.data,function(b){return a.add_points(new Date,a.get("range"),a.get("num_points"),a.point_interval,b)}),this.set({data:this.data}),this.t_index=setInterval(this.refresh,this.get("refresh_interval"))},b.prototype.stop=function(){return clearInterval(this.t_index)},b.prototype.refresh=function(){var a,b,c,d=this;return this.data=_.map(this.data,function(a){return a=_.clone(a),a.points=_.map(a.points,function(a){return[a[0],a[1]]}),a}),a=this.data[0].points.pop(),this.data[0].points.push(a),c=a[1],b=this.get("num_new_points"),_.each(this.data,function(a){return d.add_points(c,d.get("range"),b,d.point_interval,a)}),this.set({data:this.data})},b.prototype.add_points=function(a,b,c,d,e){var f=this;return _.each(_.range(c),function(c){var g;g=[b[0]+Math.random()*(b[1]-b[0]),new Date(a.getTime()+(c+1)*d)],e.points.push(g);if(e.points.length>f.get("num_points"))return e.points.shift()}),e.ymin=d3.min(e.points,function(a){return a[0]}),e.ymax=d3.max(e.points,function(a){return a[0]})},b}(Backbone.Model),Graphene.TimeSeries=function(a){function b(){this.process_data=__bind(this.process_data,this),b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.process_data=function(a){var b;return b=_.map(a,function(a){var b,c;return c=d3.min(a.datapoints,function(a){return a[0]}),c===void 0?null:(b=d3.max(a.datapoints,function(a){return a[0]}),b===void 0?null:(_.each(a.datapoints,function(a){return a[1]=new Date(a[1]*1e3)}),{points:_.reject(a.datapoints,function(a){return a[0]===null}),ymin:c,ymax:b,label:a.target}))}),b=_.reject(b,function(a){return a===null}),this.set({data:b})},b}(Graphene.GraphiteModel),Graphene.GaugeGadgetView=function(a){function b(){this.render=__bind(this.render,this),this.by_type=__bind(this.by_type,this),b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.model=Graphene.TimeSeries,b.prototype.className="gauge-gadget-view",b.prototype.tagName="div",b.prototype.initialize=function(){var a;return this.title=this.options.title,this.type=this.options.type,this.parent=this.options.parent||"#parent",this.value_format=this.options.value_format||".3s",this.value_format=d3.format(this.value_format),this.null_value=0,this.from=this.options.from||0,this.to=this.options.to||100,this.vis=d3.select(this.parent).append("div").attr("class","ggview").attr("id",this.title+"GaugeContainer"),a={size:this.options.size||120,label:this.title,minorTicks:5,min:this.from,max:this.to},a.redZones=[],a.redZones.push({from:this.options.red_from||.9*this.to,to:this.options.red_to||this.to}),a.yellowZones=[],a.yellowZones.push({from:this.options.yellow_from||.75*this.to,to:this.options.yellow_to||.9*this.to}),this.gauge=new Gauge(""+this.title+"GaugeContainer",a),this.gauge.render(),this.model.bind("change",this.render),console.log("GG view ")},b.prototype.by_type=function(a){switch(this.type){case"min":return a.ymin;case"max":return a.ymax;default:return a.points[0][0]}},b.prototype.render=function(){var a,b;return console.log("rendering."),a=this.model.get("data"),b=a&&a.length>0?a[0]:{ymax:this.null_value,ymin:this.null_value,points:[[this.null_value,0]]},this.gauge.redraw(this.by_type(b))},b}(Backbone.View),Graphene.GaugeLabelView=function(a){function b(){this.render=__bind(this.render,this),this.by_type=__bind(this.by_type,this),b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.model=Graphene.TimeSeries,b.prototype.className="gauge-label-view",b.prototype.tagName="div",b.prototype.initialize=function(){return this.unit=this.options.unit,this.title=this.options.title,this.type=this.options.type,this.parent=this.options.parent||"#parent",this.value_format=this.options.value_format||".3s",this.value_format=d3.format(this.value_format),this.null_value=0,this.vis=d3.select(this.parent).append("div").attr("class","glview"),this.title&&this.vis.append("div").attr("class","label").text(this.title),this.model.bind("change",this.render),console.log("GL view ")},b.prototype.by_type=function(a){switch(this.type){case"min":return a.ymin;case"max":return a.ymax;default:return a.points[0][0]}},b.prototype.render=function(){var a,b,c,d,e,f=this;a=this.model.get("data"),console.log(a),b=a&&a.length>0?a[0]:{ymax:this.null_value,ymin:this.null_value,points:[[this.null_value,0]]},e=this.vis,d=e.selectAll("div.metric").data([b],function(a){return f.by_type(a)}),d.exit().remove(),c=d.enter().insert("div",":first-child").attr("class","metric"+(this.type?" "+this.type:"")),c.append("span").attr("class","value").text(function(a){return f.value_format(f.by_type(a))});if(this.unit)return c.append("span").attr("class","unit").text(this.unit)},b}(Backbone.View),Graphene.TimeSeriesView=function(a){function b(){this.render=__bind(this.render,this),b.__super__.constructor.apply(this,arguments)}return __extends(b,a),b.prototype.model=Graphene.TimeSeries,b.prototype.tagName="div",b.prototype.initialize=function(){return this.line_height=this.options.line_height||16,this.animate_ms=this.options.animate_ms||500,this.num_labels=this.options.labels||3,this.sort_labels=this.options.labels_sort||"desc",this.display_verticals=this.options.display_verticals||!1,this.width=this.options.width||400,this.height=this.options.height||100,this.padding=this.options.padding||[this.line_height*2,32,this.line_height*(3+this.num_labels),32],this.title=this.options.title,this.label_formatter=this.options.label_formatter||function(a){return a},this.firstrun=!0,this.parent=this.options.parent||"#parent",this.null_value=0,this.vis=d3.select(this.parent).append("svg").attr("class","tsview").attr("width",this.width+(this.padding[1]+this.padding[3])).attr("height",this.height+(this.padding[0]+this.padding[2])).append("g").attr("transform","translate("+this.padding[3]+","+this.padding[0]+")"),this.value_format=this.options.value_format||".3s",this.value_format=d3.format(this.value_format),this.model.bind("change",this.render),console.log("TS view: "+this.width+"x"+this.height+" padding:"+this.padding+" animate: "+this.animate_ms+" labels: "+this.num_labels)},b.prototype.render=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=this;return console.log("rendering."),b=this.model.get("data"),b=b&&b.length>0?b:[{ymax:this.null_value,ymin:this.null_value,points:[[this.null_value,0],[this.null_value,0]]}],c=_.max(b,function(a){return a.ymax}),d=_.min(b,function(a){return a.ymin}),m=d3.time.scale().domain([b[0].points[0][1],b[0].points[b[0].points.length-1][1]]).range([0,this.width]),p=d3.scale.linear().domain([d.ymin,c.ymax]).range([this.height,0]).nice(),o=this.display_verticals?-this.height:0,n=d3.svg.axis().scale(m).ticks(4).tickSize(o).tickSubdivide(!0),q=d3.svg.axis().scale(p).ticks(4).tickSize(-this.width).orient("left").tickFormat(d3.format("s")),l=this.vis,f=d3.svg.line().x(function(a){return m(a[1])}).y(function(a){return p(a[0])}),a=d3.svg.area().x(function(a){return m(a[1])}).y0(this.height-1).y1(function(a){return p(a[0])}),i=this.sort_labels==="desc"?-1:1,b=_.sortBy(b,function(a){return i*a.ymax}),j=_.map(b,function(a){return a.points}),this.firstrun&&(this.firstrun=!1,l.append("svg:g").attr("class","x axis").attr("transform","translate(0,"+this.height+")").transition().duration(this.animate_ms).call(n),l.append("svg:g").attr("class","y axis").call(q),l.selectAll("path.line").data(j).enter().append("path").attr("d",f).attr("class",function(a,b){return"line "+("h-col-"+(b+1))}),l.selectAll("path.area").data(j).enter().append("path").attr("d",a).attr("class",function(a,b){return"area "+("h-col-"+(b+1))}),this.title&&(k=l.append("svg:text").attr("class","title").attr("transform","translate(0, -"+this.line_height+")").text(this.title)),this.legend=l.append("svg:g").attr("transform","translate(0, "+(this.height+this.line_height*2)+")").attr("class","legend")),e=this.legend.selectAll("g.l").data(_.first(b,this.num_labels),function(a){return Math.random()}),e.exit().remove(),g=e.enter().append("svg:g").attr("transform",function(a,b){return"translate(0, "+b*r.line_height+")"}).attr("class","l"),g.append("svg:rect").attr("width",5).attr("height",5).attr("class",function(a,b){return"ts-color "+("h-col-"+(b+1))}),h=g.append("svg:text").attr("dx",10).attr("dy",6).attr("class","ts-text").text(function(a){return r.label_formatter(a.label)}),h.append("svg:tspan").attr("class","min-tag").attr("dx",10).text(function(a){return r.value_format(a.ymin)+"min"}),h.append("svg:tspan").attr("class","max-tag").attr("dx",2).text(function(a){return r.value_format(a.ymax)+"max"}),l.transition().ease("linear").duration(this.animate_ms).select(".x.axis").call(n),l.select(".y.axis").call(q),l.selectAll("path.area").data(j).attr("transform",function(a){return"translate("+m(a[1][1])+")"}).attr("d",a).transition().ease("linear").duration(this.animate_ms).attr("transform",function(a){return"translate("+m(a[0][1])+")"}),l.selectAll("path.line").data(j).attr("transform",function(a){return"translate("+m(a[1][1])+")"}).attr("d",f).transition().ease("linear").duration(this.animate_ms).attr("transform",function(a){return"translate("+m(a[0][1])+")"})},b}(Backbone.View)}.call(this);