!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){f.call(this,a),this.displays=[]}b.exports=d;var e=a("./utility.js"),f=a("./StreamTransform.js"),g=a("./display/Display.js");d.prototype=Object.create(f.prototype),d.prototype.constructor=d,d.prototype.load=function(a,b){function c(a,c){if(a)throw a;d.update([].concat(c),b)}var d=this,e=b||{};return"csv"==e.format?d3.csv(a,c):"tsv"==e.format?d3.tsv(a,c):"xml"==e.format?d3.xml(a,c):d3.json(a,c),this},d.prototype.display=function(a,b){var c=new g(a,b,this.array());return this.displays.push(c),c},d.prototype.update=function(a,b){var c=b||{};if(a&&(c.append?this.data=this.data.concat(a):c.prepend?this.data=a.concat(this.data):this.data=a),this.displays.length>0)for(var d=this.array(),e=0;e<this.displays.length;e++)this.displays[e].update(d);return this},d.prototype.contains=function(a){return e.isIn(a,this.data)},d.prototype.containedIn=function(a){return e.containedIn(this.data,a)},d.prototype.remove=function(a){return e.removeFrom(a,this.data),this.update(),this},d.prototype.empty=function(a){return this.data=[],this.update(),this},d.prototype.add=function(a){return this.update(a,{append:!0})}},{"./StreamTransform.js":3,"./display/Display.js":5,"./utility.js":15}],2:[function(a,b,c){function d(a){this.data=void 0!==a?[].concat(a):[],this.transformations=[]}b.exports=d;var e=a("./utility.js");d.prototype.addTransformation=function(a){return this.transformations.push(a),this.update(),this},d.prototype.reset=function(){return this.transformations=[],this.update(),this},d.prototype.array=function(){return this.data&&this.transformations?e.reduce(this.transformations,function(a,b){return b(a)},this.data):this.data},d.prototype.update=function(){}},{"./utility.js":15}],3:[function(a,b,c){function d(a){g.call(this,a)}function e(a){return"function"==typeof a.array?a.array():a}b.exports=d;var f=a("./utility.js"),g=a("./StreamBase.js");d.prototype=Object.create(g.prototype),d.prototype.constructor=d,d.prototype.consoleLog=function(){return this.addTransformation(function(a){return f.consoleLog(a),a})},d.prototype.map=function(a){return this.addTransformation(function(b){return f.map(b,a)})},d.prototype.filter=function(a){return this.addTransformation(function(b){return f.filter(b,a)})},d.prototype.navigate=function(a){return this.addTransformation(function(b){return f.navigate(b[0],a)})},d.prototype.cross=function(a){return this.addTransformation(function(b){return f.cross(b,e(a))})},d.prototype.repeat=function(a){return this.addTransformation(function(b){return f.repeat(b,e(a))})},d.prototype.group=function(a){return this.addTransformation(function(b){return f.group(b,e(a))})},d.prototype.cumulate=function(a){return this.addTransformation(function(b){return f.cumulate(b,e(a))})},d.prototype.mapAsStreams=function(a){return this.addTransformation(function(b){return f.map(b,function(b,c){var e=a(new d(b),c);return"function"==typeof e.array?e.array():e})})},d.prototype.keys=function(){return this.addTransformation(function(a){return a.length>0?f.keys(a[0]):[]})}},{"./StreamBase.js":2,"./utility.js":15}],4:[function(a,b,c){b.exports={height:200,marginTop:10,marginLeft:40,marginRight:30,marginBottom:30,lineDotRange:[3,10],barMargin:.2,bandPadding:.2,combine:!0,transitionDuration:500}},{}],5:[function(a,b,c){function d(a,b,c){e.call(this,a,b,c);var d=this;f(function(){d.update()})}b.exports=d;var e=a("./DisplayFrame.js"),f=a("./resize.js"),g=a("./lines.js"),h=a("./bars.js"),i=a("./tables.js");d.prototype=Object.create(e.prototype),d.prototype.constructor=d,d.prototype.scatterPlot=function(a){return this.addChart(g.scatterPlot,a)},d.prototype.lineChart=function(a){return this.addChart(g.lineChart,a)},d.prototype.barChart=function(a){return this.addChart(h.barChart,a)},d.prototype.barChartDownwards=function(a){return this.addChart(h.barChartDownwards,a)},d.prototype.stackedBarChart=function(a){return this.addChart(h.stackedBarChart,a)},d.prototype.groupedBarChart=function(a){return this.addChart(h.groupedBarChart,a)},d.prototype.table=function(a){return this.addFrame(i.table,a)}},{"./DisplayFrame.js":7,"./bars.js":9,"./lines.js":10,"./resize.js":11,"./tables.js":12}],6:[function(a,b,c){function d(a,b,c){p.call(this,c),this.config=m.assign(o,b),this.display=e(a,this.config),this.size={width:0,height:0,inWidth:0,inHeight:0},this.select=new q(this.config),this.axisCache={},this.charts=[],this.frames=[]}function e(a,b){return jQuery&&a instanceof jQuery&&(a=a[0]),a=d3.select(a),display=a.append("div"),display.classed(n.a(j,b["class"]),!0),display}function f(a,b){var c=b.width||a.node().offsetWidth,d=b.height||a.node().offsetHeight;return{width:c,height:d,inWidth:c-b.marginLeft-b.marginRight,inHeight:d-b.marginTop-b.marginBottom}}function g(a,b,c,d,e,f){var g=[k,d.combine?1:f].join("-"),h=a.select(n.s(g));h.empty()&&(h=a.append("svg").attr("class",n.a(k,g)),b.register(h)),h.attr("width",c.width).attr("height",c.height);var i=[l,f,e].join("-"),j=h.select(n.s(i));return j.empty()&&(j=h.append("g").attr("class",n.a(l,i)).attr("transform",n.translateMargins(d))),j}function h(a,b,c,d){var e=[k,b.combine?1:d].join("-"),f=a.select(n.s(e));if(f.empty())return!1;if(!b.combine)return f.remove(),!0;var g=[l,d,c].join("-"),h=f.select(n.s(g));return h.empty()?!1:(h.remove(),!0)}b.exports=d;var j="d3stream-display",k="d3stream-svg",l="d3stream-plot",m=a("../utility.js"),n=a("./utility.js"),o=a("../config.js"),p=a("../StreamTransform.js"),q=a("./Select.js");d.prototype=Object.create(p.prototype),d.prototype.constructor=d,d.prototype.update=function(a){void 0!==a&&(this.data=a),this.size=f(this.display,this.config),this.select.clear(),this.axisCache={};var b=this.array();for(b.length>0&&!Array.isArray(b[0])&&(b=[b]),i=0;i<this.charts.length;i++){for(var c=0;c<b.length;c++){var d=g(this.display,this.select,this.size,this.config,i,c),e=this.charts[i];e[0](this,d,b,c,e[1])}for(;h(this.display,this.config,i,c);)c+=1}for(i=0;i<this.frames.length;i++){var j=this.frames[i];j[0](this,b,j[1])}this.config.update&&this.config.update(this,b)},d.prototype.addChart=function(a,b){return this.charts.push([a,m.assign(this.config,b)]),this.update(),this},d.prototype.addFrame=function(a,b){return this.frames.push([a,m.assign(this.config,b)]),this.update(),this},d.prototype.axis=function(a,b){function c(a,b){return void 0!==b?this.scale(a[this.variable]):this.scale(a[this.variable])+this.scale.bandwidth()/2}function d(a,b){return b?this.scale(a[this.variable])-b:this.scale(a[this.variable])}if(this.axisCache[b])return this.axisCache[b];var e=this.domain(a,b),f={variable:e.variable||b,domain:e.domain,scale:e.band?d3.scaleBand().domain(e.domain).padding(this.config.bandPadding):d3.scaleLinear().domain(e.domain).nice(),pick:e.band?c:d};return this.axisCache[b]=f,f},d.prototype.domain=function(a,b){return{domain:[0,1]}}},{"../StreamTransform.js":3,"../config.js":4,"../utility.js":15,"./Select.js":8,"./utility.js":13}],7:[function(a,b,c){function d(a,b,c){n.call(this,a,b,c),this.domainFunction={}}function e(a,b){return{domain:d3.extent(d3.merge(a),l.pick(b))}}function f(a,b,c){var d=a.axis(b,c.variable).scale;a.display.selectAll("svg").each(function(){var b=d3.select(this),e=b.select(m.s(i));e.empty()&&(e=b.append("g").attr("class",i)),e.attr("transform",m.translateMargins(c,0,a.size.inHeight)).call(d3.axisBottom(d))})}function g(a,b,c){var d=a.axis(b,c.variable).scale;a.display.selectAll("svg").each(function(){var a=d3.select(this),b=a.select(m.s(j));b.empty()&&(b=a.append("g").attr("class",j)),b.attr("transform",m.translateMargins(c)).call(d3.axisLeft(d))})}function h(a,b,c){if(0!=b.length){var d=a.display.select(m.s(k));d.empty()?d=a.display.append("div").attr("class",k):d.selectAll("span").remove();for(var e=0;e<c.labels.length;e++)d.append("span").attr("class","label-dot d3stream-group-"+e),d.append("span").html(c.labels[e])}}b.exports=d;var i="d3stream-axis-x",j="d3stream-axis-y",k="d3stream-labels",l=a("../utility.js"),m=a("./utility.js"),n=a("./DisplayBase.js");d.prototype=Object.create(n.prototype),d.prototype.constructor=d,d.prototype.domain=function(a,b){return this.domainFunction[b]?this.domainFunction[b](a,b):e(a,b)},d.prototype.setDomain=function(a,b){for(var c=0;c<a.length;c++)this.domainFunction[a[c]]=b;return this},d.prototype.domainManual=function(a,b){return this.setDomain(a,function(a,c){return{domain:b}})},d.prototype.domainPad=function(a,b){return Array.isArray(b)||(b=[b,b]),this.setDomain(a,function(a,c){var d=e(a,c).domain;return{domain:[d[0]-b[0],d[1]+b[1]]}})},d.prototype.domainIQR=function(a){return this.setDomain(a,function(a,b){var c=l.map(d3.merge(a),l.pick(b)).sort(),d=c[Math.floor(.25*c.length)],e=c[Math.floor(.75*c.length)],f=e-d;return{domain:[Math.max(d-1.5*f,c[0]),Math.min(e+1.5*f,c[c.length-1])]}})},d.prototype.domainBands=function(a,b,c){return this.setDomain(a,function(a,d){var e=c||null;return e?"function"==typeof c.array&&(e=c.array()):e=l.unique(l.map(d3.merge(a),l.pick(b))),{band:!0,variable:b,domain:e}})},d.prototype.addAxis=function(a,b){return a&&this.addFrame(f,{variable:a}),b&&this.addFrame(g,{variable:b}),this},d.prototype.labels=function(a){return this.addFrame(h,{labels:a})}},{"../utility.js":15,"./DisplayBase.js":6,"./utility.js":13}],8:[function(a,b,c){function d(a){this.config=a,this.svgs=d3.select(),this.selected=[],this.data={}}b.exports=d;var e=a("../utility.js"),f=a("./utility.js"),g="d3stream-focus",h="d3stream-selection",i="d3stream-focus-selection";d.prototype.register=function(a){this.svgs=this.svgs.merge(a)},d.prototype.clear=function(){this.svgs.selectAll(f.s(h)).classed(h,!1),e.empty(this.selected)},d.prototype.isSelected=function(a){return e.isIn(a,this.selected)},d.prototype.select=function(a){this.selected.push(a)},d.prototype.deselect=function(a){e.removeFrom(a,this.selected)},d.prototype.event=function(a,b,c,d){this.config.selectPlot?k[a](this,b,c):j[a](this,b,c),this.config.select&&this.config.select[a]&&this.config.select[a](this,c)};var j={over:function(a,b,c){b.classed(h)?b.classed(i,!0):b.classed(g,!0)},out:function(a,b,c){b.classed(f.a(g,i),!1)},click:function(a,b,c){a.isSelected(c)?(a.deselect(c),b.classed(f.a(h,i),!1).classed(g,!0)):(a.select(c),b.classed(f.a(h,i),!0).classed(g,!1))}},k={over:function(a,b,c){var d=d3.select(b.node().parentNode);d.classed(h)?d.classed(i,!0).raise():d.classed(g,!0).raise()},out:function(a,b,c){var d=d3.select(b.node().parentNode);d.classed(f.a(g,i),!1)},click:function(a,b,c){var d=d3.select(b.node().parentNode);a.isSelected(c.payload)?(a.deselect(c.payload),d.classed(f.a(h,i),!1).classed(g,!0)):(a.select(c.payload),d.classed(f.a(h,i),!0).classed(g,!1))}}},{"../utility.js":15,"./utility.js":13}],9:[function(a,b,c){function d(a,b,c,d,e){var f={x:a.axis(b,e.horizontalVariable||"x"),y:a.axis(b,e.verticalVariable||"y")};return f.x.scale.rangeRound([0,c]),f.y.domain=[Math.min(0,f.y.domain[0]),Math.max(0,f.y.domain[1])],f.y.scale.domain(f.y.domain).rangeRound([d,0]),f}function e(a,b,c,d){if(b.bandwidth)return[b.bandwidth(),0];var e=(1-d.barMargin)*a/c;return[e,e/2]}function f(a,b,c,f,g){var h=a.size.inWidth,i=a.size.inHeight,j=d(a,c,h,i,g),l=c[f],m=e(h,j.x.scale,l.length,g),n=k.transition(g),o=b.selectAll(k.s(C_BAR)).data(l);o.enter().append("rect").attr("class",C_BAR).attr("x",function(a){return j.x.pick(a,m[1])}).attr("y",j.y.scale(0)).attr("width",m[0]).attr("height",0).on("mouseover",k.event(a.select,"over")).on("mouseout",k.event(a.select,"out")).on("click",k.event(a.select,"click")).merge(o).transition(n).attr("x",function(a){return j.x.pick(a,m[1])}).attr("y",function(a){return j.y.pick(a)}).attr("width",m[0]).attr("height",function(a){return i-j.y.pick(a)}),o.exit().remove()}function g(a,b,c,f,g){var h=a.size.inWidth,i=a.size.inHeight,j=d(a,c,h,i,g),l=c[f],m=e(h,j.x.scale,l.length,g),n=k.transition(g);j.y.scale.rangeRound([0,i]);var o=b.selectAll(k.s(C_BAR)).data(l);o.enter().append("rect").attr("class",C_BAR).attr("x",function(a){return j.x.pick(a,m[1])}).attr("y",0).attr("width",m[0]).attr("height",0).on("mouseover",k.event(a.select,"over")).on("mouseout",k.event(a.select,"out")).on("click",k.event(a.select,"click")).merge(o).transition(n).attr("x",function(a){return j.x.pick(a,m[1])}).attr("y",function(a){return 0}).attr("width",m[0]).attr("height",function(a){return j.y.pick(a)}),o.exit().remove()}function h(a,b,c,f,g){var h=a.size.inWidth,i=a.size.inHeight,l=d(a,c,h,i,g),m=c[f],n=e(h,l.x.scale,m.length,g),o=k.transition(g);m=j.reduce(g.reverseStack?m.reverse():m,function(a,b){var c=a.length>0?a[a.length-1].sy[1]:0;return b.sy=[c,c+Math.abs(b[l.y.variable])],a.push(b),a},[]),l.y.domain=[0,d3.max(m,function(a){return a.sy[1]})],l.y.scale.domain(l.y.domain);var p=g.groupVariable||"group",q=b.selectAll(k.s(C_BAR)).data(m);q.enter().append("rect").attr("class",function(a){return k.a(C_BAR,[C_GROUP,a[p]].join("-"))}).attr("x",function(a){return l.x.pick(a,n[1])}).attr("y",l.y.scale(0)).attr("width",n[0]).attr("height",0).on("mouseover",k.event(a.select,"over")).on("mouseout",k.event(a.select,"out")).on("click",k.event(a.select,"click")).merge(q).transition(o).attr("x",function(a){return l.x.pick(a,n[1])}).attr("y",function(a){return l.y.scale(a.sy[1])}).attr("width",n[0]).attr("height",function(a){return l.y.scale(a.sy[0])-l.y.scale(a.sy[1])}),q.exit().remove()}function i(a,b,c,f,g){var h=a.size.inWidth,i=a.size.inHeight,l=d(a,c,h,i,g),m=c[f],n=e(h,l.x.scale,m.length,g),o=k.transition(g),p=g.groupVariable||"group",q=d3.scaleBand().domain(j.map(m,j.pick(p))).rangeRound([0,n[0]]),r=q.bandwidth(),s=b.selectAll(k.s(C_BAR)).data(m);s.enter().append("rect").attr("class",function(a){return k.a(C_BAR,[C_GROUP,a[p]].join("-"))}).attr("x",function(a){return l.x.pick(a,n[1])+q(a[p])}).attr("y",l.y.scale(0)).attr("width",r).attr("height",0).on("mouseover",k.event(a.select,"over")).on("mouseout",k.event(a.select,"out")).on("click",k.event(a.select,"click")).merge(s).transition(o).attr("x",function(a){return l.x.pick(a,n[1])+q(a[p])}).attr("y",function(a){return l.y.pick(a)}).attr("width",r).attr("height",function(a){return i-l.y.pick(a)}),s.exit().remove()}var j=a("../utility.js"),k=a("./utility.js");C_BAR="d3stream-bar",C_GROUP="d3stream-group",b.exports={barChart:f,barChartDownwards:g,stackedBarChart:h,groupedBarChart:i}},{"../utility.js":15,"./utility.js":13}],10:[function(a,b,c){function d(a,b,c,d,e){var f={x:a.axis(b,e.horizontalVariable||"x"),y:a.axis(b,e.verticalVariable||"y"),z:a.axis(b,e.scaleVariable||"z")};return f.x.scale.rangeRound([0,c]),f.y.scale.rangeRound([d,0]),f.z.scale.rangeRound(e.lineDotRange),f}function e(a,b,c,e,f){var i=a.size.inWidth,j=a.size.inHeight,k=d(a,c,i,j,f),l=c[e],m=h.transition(f);l=h.cutToDomain(l,k.z.variable,k.z.domain),g(b,l,m,k,a.select)}function f(a,b,c,e,f){var i=a.size.inWidth,j=a.size.inHeight,k=d(a,c,i,j,f),l=c[e],m=h.transition(f);l=h.cutToDomain(l,k.z.variable,k.z.domain);var n=b.select(h.s(C_LINE));if(n.empty()){var o=d3.line().x(function(a){return k.x.pick(a)}).y(k.y.scale(0));f.curveLine&&o.curve(d3.curveNatural),n=b.append("path").attr("class",C_LINE).attr("d",o(l))}var p=d3.line().x(function(a){return k.x.pick(a)}).y(function(a){return k.y.pick(a)});f.curveLine&&p.curve(d3.curveNatural),n.transition(m).attr("d",p(l)),g(b,l,m,k,a.select)}function g(a,b,c,d,e){var f=a.selectAll(h.s(C_DOT)).data(b);f.enter().append("circle").attr("class",C_DOT).attr("cx",function(a){return d.x.pick(a)}).attr("cy",d.y.scale(0)).attr("r",d.z.scale(0)).on("mouseover",h.event(e,"over")).on("mouseout",h.event(e,"out")).on("click",h.event(e,"click")).merge(f).transition(c).attr("cx",function(a){return d.x.pick(a)}).attr("cy",function(a){return d.y.pick(a)}).attr("r",function(a){return d.z.pick(a)}),f.exit().remove()}var h=a("./utility.js");C_LINE="d3stream-line",C_DOT="d3stream-dot",b.exports={scatterPlot:e,lineChart:f}},{"./utility.js":13}],11:[function(a,b,c){b.exports=function(a){function b(){d||(d=setTimeout(c,500))}function c(){d=null,a()}var d;$(window).on("resize",b)}},{}],12:[function(a,b,c){function d(a,b,c){b=b[0],a.display.selectAll("table").remove();for(var d=a.display.append("table").attr("class",C_TABLE),f=e.keys(b[0]),g=d.append("tr"),h=0;h<f.length;h++)g.append("th").text(f[h]);for(var i=0;i<b.length;i++){var j=b[i];for(g=d.append("tr"),h=0;h<f.length;h++)g.append("td").text(j[f[h]])}}var e=a("../utility.js");C_TABLE="d3stream-table",b.exports={table:d}},{"../utility.js":15}],13:[function(a,b,c){function d(a,b){return"translate("+a+","+b+")"}var e=a("../utility.js");b.exports={translate:d,translateMargins:function(a,b,c){return d(a.marginLeft+(b||0),a.marginTop+(c||0))},s:function(a){return".".concat(String(a))},a:function(){return e.filter(arguments,e.isNonEmpty).join(" ")},transition:function(a){return d3.transition().duration(a.transitionDuration)},event:function(a,b){return function(c,d){a.event(b,d3.select(this),c,d)}},cutToDomain:function(a,b,c){function d(a){var c={};return c[b]=a,c}var f=c[0],g=c[1];return e.map(a,function(a){var c=a[b];return c>g?e.assign(a,d(g)):f>c?e.assign(a,d(f)):e.assign(a)})}}},{"../utility.js":15}],14:[function(a,b,c){window.d3Stream=a("./Stream.js")},{"./Stream.js":1}],15:[function(a,b,c){function d(a,b){if("function"==typeof a.map)return a.map(b);for(var c=[],d=0;d<a.length;d++)c.push(b(a[d],d,a));return c}function e(a,b){if("function"==typeof a.filter)return a.filter(b);for(var c=[],d=0;d<a.length;d++)b(a[d],d,a)&&c.push(a[d]);return c}function f(a,b,c){if("function"==typeof a.reduce)return a.reduce(b,c);for(var d=c,e=0;e<a.length;e++)d=b(d,a[e],e,a);return d}function g(a,b){return b.indexOf(a)>=0}function h(a,b){return b.splice(b.indexOf(a),1)}function i(a,b){for(var c=0;c<a.length;c++)if(!g(a[c],b))return!1;return!0}function j(a){if("function"==typeof Object.keys)return Object.keys(a);var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}function k(a){if("function"==typeof Object.values)return Object.values(a);var b=[];for(var c in j(a))b.push(a[c]);return b}function l(){return f(arguments,function(a,b){for(var c in b)a[c]=b[c];return a},{})}b.exports={map:d,filter:e,reduce:f,isIn:g,containedIn:i,removeFrom:h,keys:j,values:k,assign:l,consoleLog:function(a){console.log(a)},toNumber:function(a){return parseFloat(a)},isNotNaN:function(a){return!isNaN(a)},isNonEmpty:function(a){return a&&(void 0===a.trim||""!==a.trim())},empty:function(a){a.splice(0,a.length)},pick:function(a){return function(b){return b[a]}},splitEach:function(a,b){return f(a,function(a,c){return a.concat(c.split(b))},[])},countEach:function(a){return f(a,function(a,b){return a[b]=(a[b]||0)+1,a},{})},navigate:function(a,b){return[].concat(f(b.split("."),function(a,b){return a[b]},a))},repeat:function(a,b){return d(b,function(b){return[a,b]})},cross:function(a,b){return d(a,function(a){return d(b,function(b){return[a,b]})})},unique:function(a){return f(a,function(a,b){return g(b,a)||a.push(b),a},[])},group:function(a,b){var c=f(b,function(a){return a.push([]),a},[]);return f(a,function(a,c){for(var d=0;d<b.length;d++)if(b[d](c))return a[d].push(c),a;return a},c)},cumulate:function(a,b){var c=[].concat(b);return f(a,function(a,b){if(a.length>0)for(var d=0;d<c.length;d++){var e=c[d];b[e]=a[a.length-1][e]+(b[e]||0)}return a.push(b),a},[])}}},{}]},{},[14]);