(function(Ma){function fb(){function u(c,j){c.attr("transform",function(c){return"translate("+(j(c)+S)+",0)"})}function c(c,j){c.attr("transform",function(c){return"translate(0,"+j(c)+")"})}function i(i){i.each(function(){for(var i=d3.select(this),x=j.domain(),l=[],H=Math.ceil(x[0]);Ha.length?a.length:10);d=g.append("g").attr("clip-path",Fa).attr("class","grid");ob&&d.append("g").attr("class","xgrids");Va&&(f=d.append("g").attr("class","xgrid-lines").selectAll(".xgrid-line").data(Va).enter().append("g").attr("class", "xgrid-line"),f.append("line").attr("class",function(a){return""+a["class"]}),f.append("text").attr("class",function(a){return""+a["class"]}).attr("text-anchor","end").attr("transform",e?"":"rotate(-90)").attr("dx",e?0:-m.top).attr("dy",-6).text(function(a){return a.text}));Xb&&d.append("g").attr("class","xgrid-focus").append("line").attr("class","xgrid-focus").attr("x1",e?0:-10).attr("x2",e?r:-10).attr("y1",e?-10:m.top).attr("y2",e?-10:t);pb&&d.append("g").attr("class","ygrids");Wa&&d.append("g").attr("class", "ygrid-lines").selectAll("ygrid-line").data(Wa).enter().append("line").attr("class",function(a){return"ygrid-line "+a["class"]});g.append("g").attr("clip-path",Fa).attr("class","regions");g.append("g").attr("clip-path",Fa).attr("class","chart");g.select(".chart").append("g").attr("class","event-rects").style("fill-opacity",0).selectAll(".event-rects").data(a).enter().append("rect").attr("class",function(a,b){return"event-rect event-rect-"+b}).style("cursor",function(){return U&&aa?"pointer":null}).on("mouseover", function(a,b){if(!Ga){var d=h.data.targets.map(function(a){return a.values[b]}),f,c;for(f=0;fq[f].indexOf(a.id)))for(c=0;c",d,c,e;for(d=0;d"+e+""+c+"";return b+""}),Eb=u.bindto.replace("#","")+"-clip",Fa="url(#"+Eb+")",ga="timeseries"===Cb,ya="categorized"===Cb,Ya=null,Ga=!1,ca=ta?40:0,Fb,cb=[[d3.time.format("%Y/%-m/%-d"),function(){return!0}],[d3.time.format("%-m/%-d"),function(a){return a.getMonth()}], [d3.time.format("%-m/%-d"),function(a){return 1!=a.getDate()}],[d3.time.format("%-m/%-d"),function(a){return a.getDay()&&1!=a.getDate()}],[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()}],[d3.time.format(".%L"),function(a){return a.getMilliseconds()}]];Fb=function(a){for(var b=cb.length-1,d=cb[b];!d[1](a);)d=cb[--b];return d[0](a)};var m={top:0,right:sb&&!e?50:1,bottom:20+ Ab+ca,left:40},Gb=Ia-Ab-ca,ec=Ia-ca,r=cc-m.left-m.right,t=Ia-m.top-m.bottom,sa=Ia-Gb-(20+ca),Sb=d3.time.format(dc).parse,fc=e?10:0,gc=e?t:r,Hb=e?0:t,Ib=e?r:1,n=(ga?d3.time.scale():d3.scale.linear()).range([fc,gc]),D=d3.scale.linear().range([Hb,Ib]),fa=d3.scale.linear().range([Hb,Ib]),F=(ga?d3.time.scale():d3.scale.linear()).range([0,r]),Qa=d3.scale.linear().range([sa,10]),Pa=d3.scale.linear().range([sa,10]),B=ya?fb():d3.svg.axis(),qa=d3.svg.axis(),$a=d3.svg.axis(),ia=ya?fb():d3.svg.axis();B.scale(n).orient(e? "left":"bottom");qa.scale(D).orient(e?"bottom":"left");$a.scale(fa).orient(e?"top":"right");ia.scale(F).orient("bottom");ga&&B.tickFormat(Fb);ya?(B.categories(Ja).tickCentered(Db),ia.categories(Ja).tickCentered(Db)):(B.tickOffset=function(){return 0},ia.tickOffset=function(){return 0});if(ya){var Ka=n,Jb=F,Kb=Object.keys(n),za,La,n=function(a){return Ka(a)+B.tickOffset()},F=function(a){return Jb(a)+ia.tickOffset()};for(La=0;La=h;h+=diffx2)k+="M"+ d(i(h))+" "+c(l(h))+" "+d(i(h+m))+" "+c(l(h+m))}}b=k}else b=db(a.values);return b}b=n(a.values[0].x);a=X(a.id)(a.values[0].value);return e?"M "+a+" "+b:"M "+b+" "+a};var vb,hc=d3.svg.line().x(function(a){return F(a.x)}).y(function(a){return z(a.id)(a.value)});vb=function(a){return Sa(a)?hc(a.values):"M "+F(a.values[0].x)+" "+z(a.id)(a.values[0].value)};var wb=function(a){return"start"in a?n(a.start):0},xb=function(a){var b="start"in a?n(a.start):0,a=("end"in a?n(a.end):r)-b;return 0>a?0:a},N,eb=[], Lb=null!==Bb?Bb:"#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" ");N=function(a){if(a in zb)return zb[a];0<=eb.indexOf(a)||eb.push(a);return Lb[eb.indexOf(a)%Lb.length]};var da=d3.select(u.bindto).append("svg").attr("width",r+m.left+m.right).attr("height",t+m.top+m.bottom);da.append("defs");da.select("defs").append("clipPath").attr("id",Eb).append("rect").attr("y",m.top).attr("width",r).attr("height",t-m.top);da.select("defs").append("clipPath").attr("id", "xaxis-clip").append("rect").attr("x",-1).attr("y",-1).attr("width",r+2).attr("height",40);da.select("defs").append("clipPath").attr("id","yaxis-clip").append("rect").attr("x",-39).attr("y",m.top-1).attr("width",40).attr("height",t-m.top+2);var g=da.append("g").attr("transform","translate("+m.left+","+m.top+")"),O=null;ra&&(O=da.append("g").attr("transform","translate(40,"+Gb+")"));var wa=null;ta&&(wa=da.append("g").attr("transform","translate(40,"+ec+")"));var Ha=d3.select(u.bindto).style("position", "relative").append("div").style("position","absolute").style("width","30%").style("z-index","10").style("visibility","hidden"),ha=d3.svg.brush().x(F).on("brush",function(){P({withTransition:!1,withY:!1,withSubchart:!1})}),Da=null,Ra=null;h.focus=function(a){h.defocus();d3.selectAll(xa(a)).filter(function(a){return x(a.id)}).classed("focused",!0).transition().duration(100).style("opacity",1)};h.defocus=function(a){d3.selectAll(xa(a)).filter(function(a){return x(a.id)}).classed("focused",!1).transition().duration(100).style("opacity", 0.3)};h.revert=function(a){d3.selectAll(xa(a)).filter(function(a){return x(a.id)}).classed("focused",!1).transition().duration(100).style("opacity",1)};h.show=function(a){d3.selectAll(xa(a)).transition().style("opacity",1)};h.hide=function(a){d3.selectAll(xa(a)).transition().style("opacity",0)};h.load=function(a){p(a.done)&&(a.done=function(){});var b;if(b="cacheIds"in a)a:{b=a.cacheIds;for(var d=0;db.classes.indexOf(a)})});return G};h.data.get=function(a){a=h.data.getAsTarget(a);return j(a)?a.values.map(function(a){return a.value}):void 0};h.data.getAsTarget=function(a){var b=Aa(function(b){return b.id== a});return 0