(function(e){"use strict";function r(e){return e||e===0}function i(e){return typeof e==="undefined"}function s(e){return typeof e!=="undefined"}function o(e,t){function d(e,t){e.attr("transform",function(e){return"translate("+Math.ceil(t(e)+l)+", 0)"})}function v(e,t){e.attr("transform",function(e){return"translate(0,"+Math.ceil(t(e))+")"})}function m(e){var t=e[0],n=e[e.length-1];return t0&&r[0]>0){r.unshift(r[0]-(r[1]-r[0]))}return r}function y(){var e=n.copy(),r;if(t){r=n.domain();e.domain([r[0],r[1]-1])}return e}function b(e){var n=t&&e=0;return"url("+(n?"":document.URL.split("#")[0])+"#"+t+")"}function li(e){return Math.ceil(e)+.5}function ci(e,t){var r,i,s;if(t&&t.axisX){r=t.axisX}else{r=If.select("."+n.axisX);if(e){r=r.transition()}}if(t&&t.axisY){i=t.axisY}else{i=If.select("."+n.axisY);if(e){i=i.transition()}}if(t&&t.axisY2){s=t.axisY2}else{s=If.select("."+n.axisY2);if(e){s=s.transition()}}If.attr("transform",ri.main);r.attr("transform",ri.x);i.attr("transform",ri.y);s.attr("transform",ri.y2);If.select("."+n.chartArcs).attr("transform",ri.arc)}function hi(e,t){var r;if(t&&t.axisSubX){r=t.axisSubX}else{r=qf.select("."+n.axisX);if(e){r=r.transition()}}qf.attr("transform",ri.context);r.attr("transform",ri.subx)}function pi(e){(e?Rf.transition():Rf).attr("transform",ri.legend)}function di(e,t){ci(e,t);if(ot){hi(e,t)}pi(e)}function yi(){var e=Qi(),t=Ki(),n=ii?0:e,r=ka(a.data.targets),i=gt||r?0:Ai("x"),s=ot&&!r?ut+i:0;xr=Si();Tr=xi();if(gt){mr={top:Ai("y2")+Ti(),right:r?0:ki(),bottom:Ai("y")+n+Ni(),left:s+(r?0:Ci())};gr={top:mr.top,right:NaN,bottom:20+n,left:vi}}else{mr={top:4+Ti(),right:r?0:ki(),bottom:i+s+n+Ni(),left:r?0:Ci()};gr={top:Tr-s-n,right:NaN,bottom:i+n,left:mr.left}}yr={top:ii?0:Tr-e,right:NaN,bottom:0,left:ii?xr-t:0};br=xr-mr.left-mr.right;Er=Tr-mr.top-mr.bottom;if(br<0){br=0}if(Er<0){Er=0}wr=gt?mr.left-vi-mi:br;Sr=gt?Er:Tr-gr.top-gr.bottom;if(wr<0){wr=0}if(Sr<0){Sr=0}Lr=br-(ii?t+10:0);Ar=Er-(ii?0:10);wi();if(ii&&r){yr.left=Lr/2+Cr*1.1}}function bi(){If.select("line."+n.xgridFocus).attr("x1",gt?0:-10).attr("x2",gt?br:-10).attr("y1",gt?-10:mr.top).attr("y2",gt?-10:Er)}function wi(){Cr=Math.min(Lr,Ar)/2;Nr=Cr*.95;var e=Dn?(Nr-Dn)/Nr:.6;kr=Ca(a.data.targets)||Na(a.data.targets)?Nr*e:0}function Ei(){var e=gt?n.axisX:n.axisY,t=If.select("."+e).node(),r=t?t.getBoundingClientRect():{right:0},i=zf.node().getBoundingClientRect(),s=ka(a.data.targets),o=r.right-i.left-(s?0:Ci());return o>0?o:0}function Si(){return p?p:Mi()}function xi(){var e=d?d:_i();return e>0?e:320}function Ti(){return g?g:0}function Ni(){return y?y:0}function Ci(){if(v){return v}else if(gt){return!yt?1:Math.max(sf(Li("x")),40)}else{return!Bt||Rt?1:sf(Li("y"))}}function ki(){var e=10,t=ii?Ki()+20:0;if(m){return m}else if(gt){return e+t}else{return(!Xt||Qt?e:sf(Li("y2")))+t}}function Li(e){var t=ys(e);return t.isInner?20+js(e):40+js(e)}function Ai(e){if(e==="x"&&!yt){return 0}if(e==="x"&&Dt){return Dt}if(e==="y"&&!Bt){return ct&&!ii?10:1}if(e==="y2"&&!Xt){return gi}return(ys(e).isInner?30:40)+(e==="y2"?-10:0)}function Oi(e){var t=zf.node(),n;while(t&&t.tagName!=="BODY"){n=t.getBoundingClientRect()[e];if(n){break}t=t.parentNode}return n}function Mi(){return Oi("width")}function _i(){var e=zf.style("height");return e.indexOf("px")>0?+e.replace("px",""):0}function Di(e){return e?-(1+30):-(mr.left-1)}function Pi(e){return e?-20:-4}function Hi(){return Di(!gt)}function Bi(){return Pi(!gt)}function ji(){return Di(gt)}function Fi(){return Pi(gt)}function Ii(e){return e?br+2+30+30:mr.left+20}function qi(e){return e?(Dt?Dt:0)+80:Er+8}function Ri(){return Ii(!gt)}function Ui(){return qi(!gt)}function zi(){return Ii(gt)}function Wi(){return qi(gt)}function Xi(){var e=Ho(a.data.targets),t,n,r,i,s,o;if(!e){return 0}t=e.values[0],n=e.values[e.values.length-1];r=Ur(n.x)-Ur(t.x);if(r===0){return gt?Er:br}i=Po();s=Sa(a.data.targets)?(i-(nr?.25:1))/i:1;o=i>1?r*s/(i-1):r;return o<1?1:o}function Vi(e){si=e}function $i(e){oi=e}function Ji(e){ui=e}function Ki(){return ct?ii?oi*(si+1):xr:0}function Qi(){return ct?ii?Tr:ui*(si+1):0}function Gi(){var e,t,n=!Ur;Pr=gt?1:0;Hr=gt?Er:br;Br=gt?0:Er;jr=gt?br:1;Fr=Pr;Ir=Hr;qr=gt?0:Sr;Rr=gt?wr:1;Ur=es(Pr,Hr,n?undefined:Ur.domain(),function(){return Jr.tickOffset()});zr=ts(Br,jr,n?undefined:zr.domain());Wr=ts(Br,jr,n?undefined:Wr.domain());Xr=es(Pr,Hr,Wf,function(e){return e%1?0:Gr.tickOffset()});Vr=ts(qr,Rr,n?undefined:Vr.domain());$r=ts(qr,Rr,n?undefined:$r.domain());e=us();t=Lt?Lt:n?undefined:Jr.tickValues();Jr=is(Ur,Zr,e,t);Gr=is(Xr,ni,e,t);Kr=ss(zr,ei,Ut,Wt);Qr=ss(Wr,ti,Gt,Zt);if(!n){Hf.scale(Xr);if(b){Bf.scale(Ur)}}Yi()}function Yi(){Or=qs();Mr=Rs();_r=Rs(.98)}function Zi(e,t,n){return(n?u.time.scale():u.scale.linear()).range([e,t])}function es(e,t,n,r){var i=Zi(e,t,tr),s=n?i.domain(n):i,o;if(nr){r=r||function(){return 0};i=function(e,t){var n=s(e)+r(e);return t?n:Math.ceil(n)}}else{i=function(e,t){var n=s(e);return t?n:Math.ceil(n)}}for(o in s){i[o]=s[o]}i.orgDomain=function(){var e=s.domain();if(Wf&&Wf[0]===e[0]&&Wf[1]=0,isOuter:r.indexOf("outer")>=0,isLeft:r.indexOf("left")>=0,isCenter:r.indexOf("center")>=0,isRight:r.indexOf("right")>=0,isTop:r.indexOf("top")>=0,isMiddle:r.indexOf("middle")>=0,isBottom:r.indexOf("bottom")>=0}}function vs(){return ds("x",gt?"inner-top":"inner-right")}function ms(){return ds("y",gt?"inner-right":"inner-top")}function gs(){return ds("y2",gt?"inner-right":"inner-top")}function ys(e){return e==="y2"?gs():e==="y"?ms():vs()}function bs(){return fs("x")}function ws(){return fs("y")}function Es(){return fs("y2")}function Ss(e,t){if(e){return t.isLeft?0:t.isCenter?br/2:br}else{return t.isBottom?-Er:t.isMiddle?-Er/2:0}}function xs(e,t){if(e){return t.isLeft?"0.5em":t.isRight?"-0.5em":"0"}else{return t.isTop?"-0.5em":t.isBottom?"0.5em":"0"}}function Ts(e,t){if(e){return t.isLeft?"start":t.isCenter?"middle":"end"}else{return t.isBottom?"start":t.isMiddle?"middle":"end"}}function Ns(){return Ss(!gt,vs())}function Cs(){return Ss(gt,ms())}function ks(){return Ss(gt,gs())}function Ls(){return xs(!gt,vs())}function As(){return xs(gt,ms())}function Os(){return xs(gt,gs())}function Ms(){var e=vs();if(gt){return e.isInner?"1.2em":-25-js("x")}else{return e.isInner?"-0.5em":Dt?Dt-10:"3em"}}function _s(){var e=ms();if(gt){return e.isInner?"-0.5em":"3em"}else{return e.isInner?"1.2em":-20-js("y")}}function Ds(){var e=gs();if(gt){return e.isInner?"1.2em":"-2.2em"}else{return e.isInner?"-0.5em":30+js("y2")}}function Ps(){return Ts(!gt,vs())}function Hs(){return Ts(gt,ms())}function Bs(){return Ts(gt,gs())}function js(e){var t=0,r=e==="x"?n.axisX:e==="y"?n.axisY:n.axisY2;u.selectAll("."+r+" .tick text").each(function(){var e=this.getBoundingClientRect();if(ts?s:e.value)}return t?e:null}function qs(){var e=u.svg.arc().outerRadius(Nr).innerRadius(kr),t=function(t,n){var r;if(n){return e(t)}r=Is(t);return r?e(r):"M 0 0"};t.centroid=e.centroid;return t}function Rs(e){var t=u.svg.arc().outerRadius(Cr*(e?e:1)).innerRadius(kr);return function(e){var n=Is(e);return n?t(n):"M 0 0"}}function Us(e,t){return ja(e.data)?Or(e,t):"M 0 0"}function zs(e){var t=Is(e),n,r,i,s,o,u="";if(t){n=Or.centroid(t);r=n[0];i=n[1];s=Math.sqrt(r*r+i*i);o=(36/Nr>.375?1.175-36/Nr:.8)*Nr/s;u=Mn=="arc"?"translate(1,1)":"translate("+r*o+","+i*o+")"}return u}function Ws(e){var t=Mn=="arc"?Math.PI:Math.PI*2;return e?(e.endAngle-e.startAngle)/t:null}function Xs(e){return To({id:e.data.id,value:e.value,ratio:Ws(e)})}function Vs(e){var t,n,r,i;if(!Ks()){return""}t=Is(e);n=t?t.value:null;r=Ws(t);i=Qs();return i?i(n,r):Iu(n,r)}function $s(e,t){var r=jf.selectAll("."+n.chartArc+Nu(e)),i=jf.selectAll("."+n.arc).filter(function(t){return t.data.id!==e});if(Xa(e)){r.selectAll("path").transition().duration(50).attr("d",Mr).transition().duration(100).attr("d",_r).each(function(e){if(Ba(e.data)){}})}if(!t){i.style("opacity",.3)}}function Js(e){var t=jf.selectAll("."+n.chartArc+Nu(e));t.selectAll("path.c3-arc").transition().duration(50).attr("d",Or);jf.selectAll("."+n.arc).style("opacity",ft?ft:1)}function Ks(){if(Na(a.data.targets)){return true}return Ca(a.data.targets)?Pn:gn}function Qs(){if(Na(a.data.targets)){return Nn}return Ca(a.data.targets)?Hn:yn}function Gs(){return Ca(a.data.targets)?jn:""}function Ys(){if(Na(a.data.targets)){return typeof Ln==="function"?Ln:function(){}}var e=Ca(a.data.targets)?Fn:wn;return typeof e==="function"?e:function(){}}function Zs(){if(Na(a.data.targets)){return typeof An==="function"?An:function(){}}var e=Ca(a.data.targets)?In:En;return typeof e==="function"?e:function(){}}function eo(){if(Na(a.data.targets)){return typeof On==="function"?On:function(){}}var e=Ca(a.data.targets)?qn:Sn;return typeof e==="function"?e:function(){}}function to(e){var t=jo(e),n=Ko(e),r,i,s,o,a,f;if(P.length>0){f=Go(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e<0?e:0})}for(i=1;i0)){n[s][t]+=+e}})}}}return u.min(Object.keys(n).map(function(e){return u.min(n[e])}))}function no(e){var t=jo(e),n=Ko(e),r,i,s,o,a,f;if(P.length>0){f=Yo(e);for(r=0;r=0});if(o.length===0){continue}s=o[0];if(f&&n[s]){n[s].forEach(function(e,t){n[s][t]=e>0?e:0})}for(i=1;i1?n/(i-1)/2:.5}else if(en){s=n*.001}else{s=n*.01}if(typeof _t==="object"&&Za(_t)){o=r(_t.left)?_t.left:s;u=r(_t.right)?_t.right:s}else if(typeof _t==="number"){o=u=_t}else{o=u=s}return{left:o,right:u}}function uo(e){var t=[io(e),so(e)],n=t[0],r=t[1],i=oo(e),s=0,o=0;if(n-r===0&&!nr){n=tr?new Date(n.getTime()*.5):-.5;r=tr?new Date(r.getTime()*1.5):.5}if(n||n===0){s=tr?new Date(n.getTime()-i.left):n-i.left}if(r||r===0){o=tr?new Date(r.getTime()+i.right):r+i.right}return[s,o]}function ao(e){return e[1]-e[0]}function fo(e){for(var t=0;t=0){a.data.xs[t]=e.map(function(e){return e[i]}).filter(r).map(function(e,n){return ko(e,t,n)})}else if(L){s=Object.keys(a.data.xs);a.data.xs[t]=s.length>0?a.data.xs[s[0]]:undefined}else if(Za(A)){a.data.xs[t]=wo(i,a.data.targets)}}else{a.data.xs[t]=e.map(function(e,t){return t})}});t.forEach(function(e){if(!a.data.xs[e]){throw new Error('x is not defined for id = "'+e+'".')}});i=t.map(function(t,n){var r=M(t);return{id:r,id_org:t,values:e.map(function(e,i){var s=bo(t),o=e[s],u=ko(o,t,i);if(rr&&nr&&n===0&&o){if(i===0){Et=[]}Et.push(o)}if(typeof e[t]==="undefined"||a.data.xs[t].length<=i){u=undefined}return{x:u,value:e[t]!==null&&!isNaN(e[t])?+e[t]:null,id:r}}).filter(function(e){return typeof e.x!=="undefined"})}});i.forEach(function(e){var t;e.values=e.values.sort(function(e,t){var n=e.x||e.x===0?e.x:Infinity,r=t.x||t.x===0?t.x:Infinity;return n-r});t=0;e.values.forEach(function(e){e.index=t++})});if(B){wa(jo(i).filter(function(e){return!(e in j)}),B)}i.forEach(function(e){lo(e.id_org,e)});return i}function Mo(e){return{id:e.id,id_org:e.id_org,values:e.values.map(function(e){return{x:e.x,value:e.value,id:e.id}})}}function _o(e){return e>0&&a.data.targets[0].values[e-1]?a.data.targets[0].values[e-1].x:undefined}function Do(e){return e1){e.forEach(function(e){if(e.values.length>n){r=e;n=e.values.length}})}else{r=t?e[0]:null}return r}function Bo(e){var t=Ho(e),n,r;if(!t){return[0,0]}n=t.values[0],r=t.values[t.values.length-1];return[n.x,r.x]}function jo(e){return e.map(function(e){return e.id})}function Fo(e){return e?typeof e==="string"?[e]:e:jo(a.data.targets)}function Io(e,t){var n=jo(e),r;for(r=0;r2){o=r-2;i=e[0];s=e[e.length-1];u=(s-i)/(o+1);n=[i];for(a=0;a0})}function Zo(e){return e=0;n--){if(r!==e[n].x){break}i.push(e[n])}for(n=t;n0?s=o:i=o;if(s-i===1||i===0&&s===0){f=[];if(e[i].x||e[i].x===0){f=f.concat(Xu(e,i))}if(e[s].x||e[s].x===0){f=f.concat(Xu(e,s))}return Ju(f,t)}return Vu(e,t,i,s)}function $u(e,t){var n;n=e.map(function(e){return Vu(e.values,t)});return Ju(n,t)}function Ju(e,t){var n,r;e.forEach(function(e){var i=tf(e,t);if(il){o-=u-l}if(f+i>xi()){f-=i+30}}Uf.style("top",f+"px").style("left",o+"px")}function ta(){Uf.style("display","none")}function na(e){var t=e.filter(function(e){return e&&r(e.value)});if(!Un){return}if(xa(a.data.targets)||ka(a.data.targets)){return}var i=If.selectAll("line."+n.xgridFocus);i.style("visibility","visible").data([t[0]]).attr(gt?"y1":"x1",Ru).attr(gt?"y2":"x2",Ru);tl(i,"grid")}function ra(){If.select("line."+n.xgridFocus).style("visibility","hidden")}function ia(e,t){var r=[],i,s,o,u,a=If.select("."+n.axisX).selectAll(".tick").size();if(e==="year"){i=uo();s=i[0].getFullYear();o=i[1].getFullYear();for(u=s;u<=o;u++){r.push(new Date(u+"-01-01 00:00:00"))}}else{r=t.ticks(10)}return r.slice(0,a)}function sa(e){return e.x||e.x===0?Ur(e.x):null}function oa(e,t){var n=ma(),r=Df(n);if(P.length>0){var i=r(e,t);return i[0][1]}return ns(e.id)(e.value)}function ua(){var e={},t=0,n,r;Uo(a.data.targets.filter(_a)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ca(e,t){return typeof vn==="number"?vn:t?e.tickOffset()*2*mn/t:0}function ha(){var e={},t=0,n,r;Uo(a.data.targets.filter(Ma)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function ma(){var e={},t=0,n,r;Uo(a.data.targets.filter(La)).forEach(function(s){for(n=0;n0){a+=o(t.values[s].value)-u}});return a}}function wa(e,t){Fo(e).forEach(function(e){Vf[e]=t===j[e];j[e]=t});if(!e){B=t}}function Ea(e,t){var n=false;e.forEach(function(e){if(j[e.id]===t){n=true}if(!(e.id in j)&&t==="line"){n=true}});return n}function Sa(e){return Ea(e,"bar")}function xa(e){return Ea(e,"scatter")}function Ta(e){return B==="pie"||Ea(e,"pie")}function Na(e){return Ea(e,"gauge")}function Ca(e){return B==="donut"||Ea(e,"donut")}function ka(e){return Ta(e)||Ca(e)||Na(e)}function La(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="line"||j[t]==="spline"||j[t]==="area"||j[t]==="area-spline"}function Aa(e){var t=typeof e==="string"?e:e.id;return!(t in j)||j[t]==="step"||j[t]==="area-step"}function Oa(e){var t=typeof e==="string"?e:e.id;return j[t]==="spline"||j[t]==="area-spline"}function Ma(e){var t=typeof e==="string"?e:e.id;return j[t]==="area"}function _a(e){var t=typeof e==="string"?e:e.id;return j[t]==="bar"}function Da(e){var t=typeof e==="string"?e:e.id;return j[t]==="scatter"}function Pa(e){var t=typeof e==="string"?e:e.id;return j[t]==="pie"}function Ha(e){var t=typeof e==="string"?e:e.id;return j[t]==="gauge"}function Ba(e){var t=typeof e==="string"?e:e.id;return j[t]==="donut"}function ja(e){return Pa(e)||Ba(e)||Ha(e)}function Fa(e){return La(e)?[e]:[]}function Ia(e){return Aa(e)?[e]:[]}function qa(e){return ja(e.data)?[e]:[]}function Ra(e){return _a(e)?e.values:[]}function Ua(e){return La(e)||Da(e)?e.values:[]}function za(e){return La(e)||Aa(e)?[e]:[]}function Wa(e){return _a(e)||La(e)?e.values:[]}function Xa(e){return Ba(e)&&Bn||Pa(e)&&bn}function Va(e,t,n){var r=[];return function(i){var s=i.id||i,o;if(e[s]instanceof Function){o=e[s](i)}else if(e[s]){o=e[s]}else{if(r.indexOf(s)<0){r.push(s)}o=t[r.indexOf(s)%t.length]}return n instanceof Function?n(o,i):o}}function $a(e,t){var n=e,r=t;return function(e){for(var t=1;t0}function ef(e,t){var n=false;Object.keys(e).forEach(function(r){if(e[r]===t){n=true}});return n}function tf(e,t){var n=os(e.id)==="y"?zr:Wr,r=gt?1:0,i=gt?0:1;return Math.pow(Ur(e.x)-t[r],2)+Math.pow(n(e.value)-t[i],2)}function nf(e,t){var n=0;e.each(function(){++n}).each("end",function(){if(!--n){t.apply(this,arguments)}})}function rf(e,t,n){return s(e[t])?e[t]:n}function sf(e){return Math.ceil(e/10)*10}function of(e,t){var n;u.select("body").selectAll(".dummy").data([e]).enter().append("text").classed(t?t:"",true).text(e).each(function(){n=this.getBoundingClientRect()}).remove();return n}function uf(e,t,r){Y(t,e.node());If.select("."+n.selectedCircles+Tu(t.id)).selectAll("."+n.selectedCircle+"-"+r).data([t]).enter().append("circle").attr("class",function(){return eu(n.selectedCircle,r)}).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa).attr("stroke",function(){return lr(t)}).attr("r",yf(t)*1.4).transition().duration(100).attr("r",yf)}function af(e,t,r){Z(t,e.node());If.select("."+n.selectedCircles+Tu(t.id)).selectAll("."+n.selectedCircle+"-"+r).transition().duration(100).attr("r",0).remove()}function ff(e,t,n,r){e?uf(t,n,r):af(t,n,r)}function lf(e,t){Y(t,e.node());e.transition().duration(100).style("fill",function(){return u.rgb(lr(t)).brighter(.75)})}function cf(e,t){Z(t,e.node());e.transition().duration(100).style("fill",function(){return lr(t)})}function hf(e,t,n,r){e?lf(t,n,r):cf(t,n,r)}function pf(e,t,n,r){hf(e,t,n.data,r)}function df(e){return e.nodeName==="circle"?ff:u.select(e).classed(n.bar)?hf:pf}function vf(e){return e.filter(function(e){return r(e.value)})}function mf(e){return an?typeof fn==="function"?fn(e):fn:0}function gf(e){return cn?hn?hn:mf(e)*1.75:mf(e)}function yf(e){return pn?pn:mf(e)*4}function bf(e,t){return(t?If.selectAll("."+n.circles+Tu(t)):If).selectAll("."+n.circle+(r(e)?"-"+e:""))}function wf(e,t){bf(e,t).classed(n.EXPANDED,true).attr("r",gf)}function Ef(e){bf(e).filter(function(){return u.select(this).classed(n.EXPANDED)}).classed(n.EXPANDED,false).attr("r",mf)}function Sf(e){return If.selectAll("."+n.bar+(r(e)?"-"+e:""))}function xf(e){Sf(e).classed(n.EXPANDED,true)}function Tf(e){Sf(e).classed(n.EXPANDED,false)}function Nf(e,t){var n,r=Mf(e,t),i=t?rs:ns;if(gt){n=u.svg.area().x0(function(e,t){return i(e.id)(0)}).x1(function(e,t){return i(e.id)(e.value)}).y(Ru)}else{n=u.svg.area().x(Ru).y0(function(e,t){if(P.length>0){var n=r(e,t);return n[0][1]}return i(e.id)(0)}).y1(function(e,t){if(P.length>0){var n=r(e,t);return n[1][1]}return i(e.id)(e.value)})}return function(e,t){var r=vf(e.values),i,s;if(Ea([e],"area")||Ea([e],"area-spline")){Oa(e)?n.interpolate("cardinal"):n.interpolate("linear");return n(r)}else if(Ea([e],"area-step")){Aa(e)?n.interpolate("step-after"):n.interpolate("linear");return n(r)}else{i=Ur(r[0].x);s=ns(e.id)(r[0].value);return gt?"M "+s+" "+i:"M "+i+" "+s}}}function Cf(e,t){var n=Df(e,t),r=t?rs:ns,i=t?Wu:Ru,s=function(e,t){if(P.length>0){var i=n(e,t);return i[0][1]}return r(e.id)(e.value)},o=u.svg.line().x(gt?s:i).y(gt?i:s);if(!dn){o=o.defined(function(e){return e.value!=null})}return function(e){var n=dn?vf(e.values):e.values,i=t?i:Xr,s=r(e.id),u=0,a=0;if(La(e)){if(q[e.id]){return Pf(n,i,s,q[e.id])}else{o.interpolate(Oa(e)?"cardinal":"linear");return o(n)}}else if(Aa(e)){o.interpolate("step-after");return o(n)}else{if(n[0]){u=i(n[0].x);a=s(n[0].value)}return gt?"M "+a+" "+u:"M "+u+" "+a}}}function kf(e,t){var n=_f(e,t);return function(e,t){var r=n(e,t);var i=gt?1:0;var s=gt?0:1;var o="M "+r[0][i]+","+r[0][s]+" "+"L"+r[1][i]+","+r[1][s]+" "+"L"+r[2][i]+","+r[2][s]+" "+"L"+r[3][i]+","+r[3][s]+" "+"z";return o}}function Lf(e,t){var n=_f(e,false),r=t?Af:Of;return function(e,t){return r(n(e,t),e,this)}}function Af(e,t){var n;if(gt){n=_a(t)?4:6;return e[2][1]+n*(t.value<0?-1:1)}else{return e[0][0]+(e[2][0]-e[0][0])/2}}function Of(e,t,n){var r=n.getBoundingClientRect();if(gt){return(e[0][0]+e[2][0]+r.height*.6)/2}else{return e[2][1]+(t.value<0?r.height:_a(t)?-3:-6)}}function Mf(e,t){var n=e.__max__+1,r=pa(n,e,!!t),i=da(!!t),s=va(e,!!t),o=t?rs:ns;return function(e,t){var n=o(e.id)(0),u=s(e,t)||n,a=r(e),f=i(e);if(gt){if(e.value>0&&fu){f=u}}return[[a,u],[a,f-(n-u)]]}}function _f(e,t){var n=e.__max__+1,r=ca(Jr,n),i=aa(r,n,e,!!t),s=fa(!!t),o=la(e,!!t),u=t?rs:ns;return function(e,t){var n=u(e.id)(0),a=o(e,t)||n,f=i(e),l=s(e);if(gt){if(00&&fu){f=u}}return[[a,f-(n-u)]]}}function Pf(e,t,n,r){var o=-1,u,a;var f="M",l;var c,h,p,d,v,m,g;var y,b;var w=[];if(s(r)){for(u=0;u=0){u.select(this).style("display",t%mt?"none":"block")}})}else{jf.selectAll("."+n.axisX+" .tick text").style("display","block")}}if(!gt&&At){ps(Yr.x,t.axisX,At)}G=Nf(_,false);Z=kf(D);tt=Cf(P,false);it=Lf(D,true);st=Lf(D,false);Vr.domain(zr.domain());$r.domain(Wr.domain());Uf.style("display","none");bi();If.select("line."+n.xgridFocus).style("visibility","hidden");if(tn){o=ia(nn,Ur);B=nr?Jr.tickOffset():0;s=gt?{x1:0,x2:br,y1:function(e){return Ur(e)-B},y2:function(e){return Ur(e)-B}}:{x1:function(e){return Ur(e)+B},x2:function(e){return Ur(e)+B},y1:mr.top,y2:Er};i=If.select("."+n.xgrids).selectAll("."+n.xgrid).data(o);i.enter().append("line").attr("class",n.xgrid);i.attr(s).style("opacity",function(){return+u.select(this).attr(gt?"y1":"x1")===(gt?Er:0)?0:1});i.exit().remove()}if(Za(rn)){f=If.select("."+n.xgridLines).selectAll("."+n.xgridLine).data(rn);l=f.enter().append("g").attr("class",function(e){return n.xgridLine+(e.class?e.class:"")});l.append("line").style("opacity",0);l.append("text").attr("text-anchor","end").attr("transform",gt?"":"rotate(-90)").attr("dx",gt?0:-mr.top).attr("dy",-5).style("opacity",0);f.select("line").transition().duration(ut).attr("x1",gt?0:Uu).attr("x2",gt?br:Uu).attr("y1",gt?Uu:mr.top).attr("y2",gt?Uu:Er).style("opacity",1);f.select("text").transition().duration(ut).attr("x",gt?br:0).attr("y",Uu).text(function(e){return e.text}).style("opacity",1);f.exit().transition().duration(ut).style("opacity",0).remove()}if(I&&sn){c=If.select("."+n.ygrids).selectAll("."+n.ygrid).data(zr.ticks(un));c.enter().append("line").attr("class",n.ygrid);c.attr("x1",gt?zr:0).attr("x2",gt?zr:br).attr("y1",gt?0:zr).attr("y2",gt?Er:zr);c.exit().remove();tl(c,"grid")}if(I&&Za(on)){h=If.select("."+n.ygridLines).selectAll("."+n.ygridLine).data(on);p=h.enter().append("g").attr("class",function(e){return n.ygridLine+(e.class?e.class:"")});p.append("line").style("opacity",0);p.append("text").attr("text-anchor","end").attr("transform",gt?"rotate(-90)":"").attr("dx",gt?0:-mr.top).attr("dy",-5).style("opacity",0);h.select("line").transition().duration(ut).attr("x1",gt?zu:0).attr("x2",gt?zu:br).attr("y1",gt?0:zu).attr("y2",gt?Er:zu).style("opacity",1);h.select("text").transition().duration(ut).attr("x",gt?0:br).attr("y",zu).text(function(e){return e.text}).style("opacity",1);h.exit().transition().duration(ut).style("opacity",0).remove()}E=If.select("."+n.regions).selectAll("."+n.region).data(Rn);E.enter().append("g").attr("class",vu).append("rect").style("fill-opacity",0);E.selectAll("rect").transition().duration(ut).attr("x",ho).attr("y",po).attr("width",vo).attr("height",mo).style("fill-opacity",function(e){return r(e.opacity)?e.opacity:.1});E.exit().transition().duration(ut).style("opacity",0).remove();y=If.selectAll("."+n.bars).selectAll("."+n.bar).data(Ra);y.enter().append("path").attr("class",fu).style("stroke",function(e){return lr(e.id)}).style("stroke-width",2).style("opacity",0).style("fill",function(e){return lr(e.id)}).style("fill-opacity",function(){if(ft){return ft}return Au});y.style("opacity",Au).transition().duration(ut).attr("d",Z).style("fill",lr).style("opacity",1);y.exit().transition().duration(at).style("opacity",0).remove();d=If.selectAll("."+n.lines).selectAll("."+n.line).data(Fa);d.enter().append("path").attr("class",su).style("stroke",lr);d.style("opacity",Au).transition().duration(ut).attr("d",tt).style("stroke",lr).style("opacity",1);d.exit().transition().duration(at).style("opacity",0).remove();v=If.selectAll("."+n.steps).selectAll("."+n.step).data(Ia);v.enter().append("path").attr("class",gu).style("stroke",lr);v.style("opacity",Au).transition().duration(ut).attr("d",tt).style("stroke",lr).style("opacity",1);v.exit().transition().duration(at).style("opacity",0).remove();m=If.selectAll("."+n.areas).selectAll("."+n.area).data(za);m.enter().append("path").attr("class",pu).style("fill",lr).style("opacity",function(){Xf=+u.select(this).style("opacity");return 0});m.style("opacity",0).transition().duration(ut).attr("d",G).style("fill",lr).style("opacity",Xf);m.exit().transition().duration(at).style("opacity",0).remove();if(an){g=If.selectAll("."+n.circles).selectAll("."+n.circle).data(Ua);g.enter().append("circle").attr("class",uu).attr("r",mf).style("fill",lr);g.style("opacity",Au).transition().duration(ut).style("opacity",Mu).style("fill",lr).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa);g.exit().remove()}if(Du()){x=If.selectAll("."+n.texts).selectAll("."+n.text).data(Wa);x.enter().append("text").attr("class",tu).attr("text-anchor",function(e){return gt?e.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",lr).style("fill-opacity",0);x.text(function(e){return qu(e.id)(e.value,e.id)}).style("fill-opacity",Ou).transition().duration(ut).attr("x",it).attr("y",st).style("fill",lr).style("fill-opacity",_u);x.exit().transition().duration(at).style("fill-opacity",0).remove()}w=If.selectAll("."+n.arcs).selectAll("."+n.arc).data(qa);if(Mn==="arc"){w.enter().append("path").attr("class","").style("opacity",1).style("fill",xn).style("cursor","pointer").attr("transform","scale(1,1)").attr("d",function(e){e.value=Cn;e.startAngle=-1*(Math.PI/2);e.endAngle=Math.PI/2;return Us(e,true)});w.exit().transition().duration(at).style("opacity",0).remove()}w.enter().append("path").attr("class",cu).style("fill",function(e){return lr(e.data)}).style("cursor",function(e){return $(e)?"pointer":null}).style("opacity",0).each(function(e){this._current=e}).on("mouseover",function(e,t){var n,r,i;if(ar){return}n=Is(e);r=Xs(n);i=Zs();$s(n.data.id);vl(n.data.id,true);i(r,t)}).on("mousemove",function(e){var t=Is(e),n=Xs(t),r=[n];ea(r,u.mouse(this))}).on("mouseout",function(e,t){var n,r,i;if(ar){return}n=Is(e);r=Xs(n);i=eo();Js(n.data.id);ml();ta();i(r,t)}).on("click",function(e,t){var n=Is(e),r=Xs(n),i=Ys();Gf(this,e,t);i(r,t)});w.attr("transform",W?"scale(0)":"").style("opacity",function(e){return e===this._current?0:1}).each(function(){ar=true}).transition().duration(ut).attrTween("d",function(e){var t=Is(e),n;if(!t){return function(){return"M 0 0"}}if(isNaN(this._current.endAngle))this._current.endAngle=this._current.startAngle;n=u.interpolate(this._current,t);this._current=n(0);return function(e){return Us(n(e),true)}}).attr("transform",W?"scale(1)":"").style("fill",function(e){return Mn==="arc"&<?cr(e.data.values[0].value):lr(e.data.id)}).style("opacity",ft?ft:1).call(nf,function(){ar=false});w.exit().transition().duration(at).style("opacity",0).remove();If.selectAll("."+n.chartArc).select("text").style("opacity",0).text(Vs).attr("transform",zs).transition().duration(ut).style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});if(Mn==="arc"){If.selectAll("."+n.chartArc).select("text.units").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?_n:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});If.selectAll("."+n.chartArc).select("text.min").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?kn:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0});If.selectAll("."+n.chartArc).select("text.max").attr("transform",zs).style("opacity",0).transition().duration(ut).text(Tn?Cn:"").style("opacity",function(e){return qo(e.data.id)&&ja(e.data)?1:0})}If.select("."+n.chartArcsTitle).style("opacity",Ca(a.data.targets)||Na(a.data.targets)?1:0);if(ot){if(u.event&&u.event.type==="zoom"){Hf.extent(Ur.orgDomain()).update()}if(q){if(!gt&&At){ps(Yr.subx,t.axisSubX,At)}if(!Hf.empty()){Hf.extent(Ur.orgDomain()).update()}Y=Nf(_,true);et=kf(D,true);rt=Cf(P,true);L=qf.selectAll("."+n.bars).selectAll("."+n.bar).data(Ra);L.enter().append("path").attr("class",fu).style("stroke","none").style("fill",lr);L.style("opacity",Au).transition().duration(ut).attr("d",et).style("opacity",1);L.exit().transition().duration(ut).style("opacity",0).remove();T=qf.selectAll("."+n.lines).selectAll("."+n.line).data(Fa);T.enter().append("path").attr("class",su).style("stroke",lr);T.style("opacity",Au).transition().duration(ut).attr("d",rt).style("opacity",1);T.exit().transition().duration(ut).style("opacity",0).remove();N=qf.selectAll("."+n.steps).selectAll("."+n.step).data(Ia);N.enter().append("path").attr("class",su).style("stroke",lr);N.style("opacity",Au).transition().duration(ut).attr("d",rt).style("opacity",1);N.exit().transition().duration(ut).style("opacity",0).remove();C=qf.selectAll("."+n.areas).selectAll("."+n.area).data(Aa?Ia:Fa);C.enter().append("path").attr("class",pu).style("fill",lr).style("opacity",function(){Xf=+u.select(this).style("opacity");return 0});C.style("opacity",0).transition().duration(ut).attr("d",Y).style("fill",lr).style("opacity",Xf);C.exit().transition().duration(at).style("opacity",0).remove()}}If.selectAll("."+n.selectedCircles).filter(function(e){return _a(e)}).selectAll("circle").remove();If.selectAll("."+n.selectedCircle).transition().duration(ut).attr("cx",gt?oa:sa).attr("cy",gt?sa:oa);if(S){O=If.select("."+n.eventRects);if(Za(A)&&!xo(A)){if(!O.classed(n.eventRectsMultiple)){O.classed(n.eventRectsMultiple,true).classed(n.eventRectsSingle,false).selectAll("."+n.eventRect).remove()}M=If.select("."+n.eventRects).selectAll("."+n.eventRect).data([0]);Qf(M.enter());M.attr("x",0).attr("y",0).attr("width",br).attr("height",Er)}else{if(!O.classed(n.eventRectsSingle)){O.classed(n.eventRectsMultiple,false).classed(n.eventRectsSingle,true).selectAll("."+n.eventRect).remove()}if((rr||tr)&&!nr){F=function(e,t){var n=_o(t),r=Do(t),i=a.data.xs[e.id][t];var s=Ur(r?r:i);var o=Ur(n?n:i);return(s-o)/2};j=function(e,t){var n=_o(t),r=a.data.xs[e.id][t];return(Ur(r)+Ur(n?n:r))/2}}else{F=Xi();j=function(e){return Ur(e.x)-F/2}}H=Ho(a.data.targets);If.select("."+n.eventRects).datum(H?H.values:[]);M=If.select("."+n.eventRects).selectAll("."+n.eventRect).data(function(e){return e});Kf(M.enter());M.attr("class",mu).attr("x",gt?0:j).attr("y",gt?j:0).attr("width",gt?br:F).attr("height",gt?F:Er);M.exit().remove()}}jo(a.data.targets).forEach(function(e){Vf[e]=true})}function rl(){nl({withTransition:false,withY:false,withSubchart:false,withUpdateXDomain:true})}function il(){if(Uo(a.data.targets).length===0){return}if(u.event.sourceEvent.type==="mousemove"&&Bf.altDomain){Ur.domain(Bf.altDomain);Bf.scale(Ur).updateScaleExtent();return}if(nr&&Ur.orgDomain()[0]===Wf[0]){Ur.domain([Wf[0]-1e-10,Ur.orgDomain()[1]])}nl({withTransition:false,withY:false,withSubchart:false});if(u.event.sourceEvent.type==="mousemove"){or=true}}function sl(){function t(){e.forEach(function(e){e()})}var e=[];t.add=function(t){e.push(t)};return t}function ol(){jf.attr("width",xr).attr("height",Tr);jf.select("#"+Kn).select("rect").attr("width",br).attr("height",Er);jf.select("#"+Qn).select("rect").attr("x",Hi).attr("y",Bi).attr("width",Ri).attr("height",Ui);jf.select("#"+Gn).select("rect").attr("x",ji).attr("y",Fi).attr("width",zi).attr("height",Wi);jf.select("."+n.zoomRect).attr("width",br).attr("height",Er);zf.style("max-height",Tr+"px")}function ul(e){return{axisX:e?Yr.x.transition().duration(e):Yr.x,axisY:e?Yr.y.transition().duration(e):Yr.y,axisY2:e?Yr.y2.transition().duration(e):Yr.y2,axisSubX:e?Yr.subx.transition().duration(e):Yr.subx}}function al(e){var t;e=e||{};e.withTransition=rf(e,"withTransition",true);e.withTransform=rf(e,"withTransform",false);e.withLegend=rf(e,"withLegend",false);e.withUpdateXDomain=true;e.withUpdateOrgXDomain=true;e.withTransitionForExit=false;if(!(e.withLegend&&ct)){t=ul(e.withTransitionForAxis?k:0);yi();Gi();ol();di(e.withTransition,t)}nl(e,t)}function fl(e){var t,r,i,s,o,u,a,f;var l,c,h,p;a=If.select("."+n.chartTexts).selectAll("."+n.chartText).data(e).attr("class",wu);f=a.enter().append("g").attr("class",wu).style("opacity",0).style("pointer-events","none");f.append("g").attr("class",nu);s=If.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Su);i=s.enter().append("g").attr("class",Su).style("opacity",0).style("pointer-events","none");i.append("g").attr("class",lu).style("cursor",function(e){return $(e)?"pointer":null});r=If.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",Eu);t=r.enter().append("g").attr("class",Eu).style("opacity",0).style("pointer-events","none");t.append("g").attr("class",ou);t.append("g").attr("class",yu);t.append("g").attr("class",du);t.append("g").attr("class",function(e){return eu(n.selectedCircles,e.id)});t.append("g").attr("class",au).style("cursor",function(e){return $(e)?"pointer":null});e.forEach(function(e){If.selectAll("."+n.selectedCircles+Tu(e.id)).selectAll("."+n.selectedCircle).each(function(t){t.value=e.values[t.index].value})});u=If.select("."+n.chartArcs).selectAll("."+n.chartArc).data(Dr(e)).attr("class",xu);o=u.enter().append("g").attr("class",xu);o.append("g").attr("class",hu);o.append("text").attr("dy",Mn==="arc"?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("font-size",br/10+"px");if(Mn==="arc"){o.select("text").style("fill","#000");o.append("text").attr("dy",".75em").attr("class","units").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#000").style("font-size",br/15+"px");o.append("text").attr("dx",-1*(kr+(Nr-kr)/2)+"px").attr("dy","1em").attr("class","min").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",br/20+"px");o.append("text").attr("dx",kr+(Nr-kr)/2+"px").attr("dy","1em").attr("class","max").style("opacity",0).style("text-anchor","middle").style("pointer-events","none").style("fill","#777").style("font-size",br/20+"px")}if(ot){p=qf.select("."+n.chartBars).selectAll("."+n.chartBar).data(e).attr("class",Su);h=p.enter().append("g").style("opacity",0).attr("class",Su);h.append("g").attr("class",lu);c=qf.select("."+n.chartLines).selectAll("."+n.chartLine).data(e).attr("class",Eu);l=c.enter().append("g").style("opacity",0).attr("class",Eu);l.append("g").attr("class",ou);l.append("g").attr("class",yu);l.append("g").attr("class",du)}jf.selectAll("."+n.target).filter(function(e){return qo(e.id)}).transition().duration(k).style("opacity",1)}function ll(e,t){if(t.filter){e=e.filter(t.filter)}if(t.type||t.types){e.forEach(function(e){t.types?wa(e.id,t.types[e.id]):wa(e.id,t.type)})}a.data.targets.forEach(function(t){for(var n=0;n=v){v=o}if(!m||u>=m){m=u}c=ii?m:v;if(mt){Object.keys(E).forEach(function(e){E[e]=v});Object.keys(S).forEach(function(e){S[e]=m});l=(f-c*e.length)/2;if(l"+(f||f===0?""+f+"":"")}c=e[a].name;l=o(e[a].value,e[a].ratio,e[a].id,e[a].index);h=Mn==="arc"&<?cr(e[a].value):i(e[a].id);u+="";u+=""+c+"";u+=""+l+"";u+=""}return u+""}),Vn=c(["tooltip","init","show"],false),$n=c(["tooltip","init","x"],0),Jn=c(["tooltip","init","position"],{top:"0px",left:"50px"});var Kn="c3-"+ +(new Date)+"-clip",Qn=Kn+"-xaxis",Gn=Kn+"-yaxis",Yn=fi(Kn),Zn=fi(Qn),er=fi(Gn);var tr=bt==="timeseries",nr=bt==="categorized",rr=!tr&&(L||Za(A));var ir=null,sr=false,or=false,ur=false,ar=false;var fr=u.scale.category10().range(),lr=Va(U,Za(at)?at:fr,R),cr=$a(at,lt);var hr=wt?u.time.format:u.time.format.utc,pr=hr.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%-m/%-d",function(e){return e.getDay()&&e.getDate()!==1}],["%-m/%-d",function(e){return e.getDate()!==1}],["%-m/%-d",function(e){return e.getMonth()}],["%Y/%-m/%-d",function(){return true}]]);var dr=[],vr=[];var mr,gr,yr,br,wr,Er,Sr,xr,Tr;var Nr,Cr,kr,Lr,Ar,Or,Mr,_r,Dr;var Pr,Hr,Br,jr,Fr,Ir,qr,Rr;var Ur,zr,Wr,Xr,Vr,$r,Jr,Kr,Qr,Gr;var Yr={};var Zr=gt?"left":"bottom",ei=gt?Rt?"top":"bottom":Rt?"right":"left",ti=gt?Qt?"bottom":"top":Qt?"left":"right",ni=gt?"left":"bottom";var ri={main:function(){return"translate("+li(mr.left)+","+li(mr.top)+")"},context:function(){return"translate("+li(gr.left)+","+li(gr.top)+")"},legend:function(){return"translate("+yr.left+","+yr.top+")"},x:function(){return"translate(0,"+(gt?0:Er)+")"},y:function(){return"translate(0,"+(gt?Er:0)+")"},y2:function(){return"translate("+(gt?0:br)+","+(gt?1:0)+")"},subx:function(){return"translate(0,"+(gt?0:Sr)+")"},arc:function(){return"translate("+Lr/2+","+Ar/2+")"}};var ii=ht==="right";var si=0,oi=0,ui=0,ai=.15;var vi=30,mi=gt&&!yt?0:30,gi=5;Dr=u.layout.pie().value(function(e){return e.values.reduce(function(e,t){return e+t.value},0)});var Hf,Bf=function(){};Hf=u.svg.brush().on("brush",rl);Hf.update=function(){if(qf){qf.select("."+n.brush).call(this)}return this};Hf.scale=function(e){return gt?this.y(e):this.x(e)};if(b){Bf=u.behavior.zoom().on("zoomstart",function(){Bf.altDomain=u.event.sourceEvent.altKey?Ur.orgDomain():null}).on("zoom",b?il:null);Bf.scale=function(e){return gt?this.y(e):this.x(e)};Bf.orgScaleExtent=function(){var e=w?w:[1,10];return[e[0],Math.max(Po()/e[1],e[1])]};Bf.updateScaleExtent=function(){var e=ao(Ur.orgDomain())/ao(Wf),t=this.orgScaleExtent();this.scaleExtent([t[0]*e,t[1]*e]);return this}}var jf,Ff,If,qf,Rf,Uf,zf;var Wf;var Xf,Vf={};a.focus=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",1)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);a.revert();a.defocus();s(r.classed(n.focused,true));s(i);if(ka(a.data.targets)){$s(e,true)}vl(e,true)};a.defocus=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",.3)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);a.revert();s(r.classed(n.focused,false));s(i);if(ka(a.data.targets)){Js(e)}vl(e,false)};a.revert=function(e){function s(e){Uo(e).transition().duration(100).style("opacity",1)}var t=jf.selectAll(Nu(e)),r=t.filter(wl),i=t.filter(El);s(r.classed(n.focused,false));s(i);if(ka(a.data.targets)){Js(e)}ml()};a.show=function(e,t){e=Fo(e);t=t||{};Vo(e);jf.selectAll(Cu(e)).transition().style("opacity",1);if(t.withLegend){gl(e)}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.hide=function(e,t){e=Fo(e);t=t||{};Xo(e);jf.selectAll(Cu(e)).transition().style("opacity",0);if(t.withLegend){yl(e)}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true})};a.toggle=function(e){qo(e)?a.hide(e):a.show(e)};a.unzoom=function(){Hf.clear().update();nl({withUpdateXDomain:true})};a.load=function(e){if(e.xs){So(e.xs)}if("classes"in e){Object.keys(e.classes).forEach(function(t){D[t]=e.classes[t]})}if("categories"in e&&nr){Et=e.categories;Jr.categories(Et)}if("cacheIds"in e&&fo(e.cacheIds)){ll(co(e.cacheIds),e.done);return}if("unload"in e){hl(Fo(typeof e.unload==="boolean"&&e.unload?null:e.unload),function(){cl(e)})}else{cl(e)}};a.unload=function(e,t){hl(Fo(e),function(){nl({withUpdateOrgXDomain:true,withUpdateXDomain:true,withLegend:true});if(typeof t==="function"){t()}})};a.selected=function(e){return u.merge(If.selectAll("."+n.shapes+Tu(e)).selectAll("."+n.shape).filter(function(){return u.select(this).classed(n.SELECTED)}).map(function(e){return e.map(function(e){var t=e.__data__;return t.data?t.data:t})}))};a.select=function(e,t,r){if(!X){return}If.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(i,o){var a=u.select(this),f=i.data?i.data.id:i.id,l=df(this),c=V||!e||e.indexOf(f)>=0,h=!t||t.indexOf(o)>=0,p=a.classed(n.SELECTED);if(a.classed(n.line)||a.classed(n.area)){return}if(c&&h){if($(i)&&!p){l(true,a.classed(n.SELECTED,true),i,o)}}else if(s(r)&&r){if(p){l(false,a.classed(n.SELECTED,false),i,o)}}})};a.unselect=function(e,t){if(!X){return}If.selectAll("."+n.shapes).selectAll("."+n.shape).each(function(r,i){var s=u.select(this),o=r.data?r.data.id:r.id,a=df(this),f=V||!e||e.indexOf(o)>=0,l=!t||t.indexOf(i)>=0,c=s.classed(n.SELECTED);if(s.classed(n.line)||s.classed(n.area)){return}if(f&&l){if($(r)){if(c){a(false,s.classed(n.SELECTED,false),r,i)}}}})};a.toLine=function(e){xl(e,"line")};a.toSpline=function(e){xl(e,"spline")};a.toBar=function(e){xl(e,"bar")};a.toScatter=function(e){xl(e,"scatter")};a.toArea=function(e){xl(e,"area")};a.toAreaSpline=function(e){xl(e,"area-spline")};a.toPie=function(e){xl(e,"pie",{withTransform:true})};a.toDonut=function(e){xl(e,"donut",{withTransform:true})};a.groups=function(e){if(i(e)){return P}P=e;nl();return P};a.xgrids=function(e){if(!e){return rn}rn=e;nl();return rn};a.xgrids.add=function(e){if(!e){return}return a.xgrids(rn.concat(e))};a.xgrids.remove=function(e){var t=Sl(e);return a.xgrids(rn.filter(t))};a.ygrids=function(e){if(!e){return on}on=e;nl();return on};a.ygrids.add=function(e){if(!e){return}return a.ygrids(on.concat(e))};a.ygrids.remove=function(e){var t=Sl(e);return a.ygrids(on.filter(t))};a.regions=function(e){if(!e){return Rn}Rn=e;nl();return Rn};a.regions.add=function(e){if(!e){return Rn}Rn=Rn.concat(e);nl();return Rn};a.regions.remove=function(e){var t,r,i;e=e||{};t=rf(e,"duration",k);r=rf(e,"classes",[n.region]);i=If.select("."+n.regions).selectAll(r.map(function(e){return"."+e}));(t?i.transition().duration(t):i).style("opacity",0).remove();Rn=Rn.filter(function(e){var t=false;if(!e.class){return true}e.class.split(" ").forEach(function(e){if(r.indexOf(e)>=0){t=true}});return!t});return Rn};a.data.get=function(e){var t=a.data.getAsTarget(e);return s(t)?t.values.map(function(e){return e.value}):undefined};a.data.getAsTarget=function(e){var t=a.data.targets.filter(function(t){return t.id===e});return t.length>0?t[0]:undefined};a.data.names=function(e){if(!arguments.length){return _}Object.keys(e).forEach(function(t){_[t]=e[t]});nl({withLegend:true});return _};a.data.colors=function(e){if(!arguments.length){return U}Object.keys(e).forEach(function(t){U[t]=e[t]});nl({withLegend:true});return U};a.x=function(e){if(arguments.length){No(a.data.targets,e);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.xs=function(e){if(arguments.length){Co(a.data.targets,e);nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}return a.data.xs};a.axis.labels=function(e){if(arguments.length){Object.keys(e).forEach(function(t){ls(t,e[t])});Fs()}};a.axis.max=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Ot=+e.x}if(r(e.y)){jt=+e.y}if(r(e.y2)){Vt=+e.y2}}else{jt=Vt=+e}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.min=function(e){if(arguments.length){if(typeof e==="object"){if(r(e.x)){Mt=+e.x}if(r(e.y)){Ft=+e.y}if(r(e.y2)){$t=+e.y2}}else{Ft=$t=+e}nl({withUpdateOrgXDomain:true,withUpdateXDomain:true})}};a.axis.range=function(e){if(arguments.length){if(typeof e.max!=="undefined"){a.axis.max(e.max)}if(typeof e.min!=="undefined"){a.axis.min(e.min)}}};a.legend.show=function(e){gl(Fo(e));nl({withLegend:true})};a.legend.hide=function(e){yl(Fo(e));nl({withLegend:true})};a.resize=function(e){p=e?e.width:null;d=e?e.height:null;a.flush();a.flush()};a.flush=function(){al({withLegend:true,withTransition:false,withTransitionForTransform:false})};a.destroy=function(){a.data.targets=undefined;a.data.xs={};zf.classed("c3",false).html("");e.onresize=null};if("url"in t.data){u.xhr(t.data.url,function(e,t){var n=u.csv.parseRows(t.response),r;if(n.length===1){r=[{}];n[0].forEach(function(e){r[0][e]=null})}else{r=u.csv.parse(t.response)}Jf(r)})}else if("rows"in t.data){Jf(Lo(t.data.rows))}else if("columns"in t.data){Jf(Ao(t.data.columns))}else{throw Error("url or rows or columns is required.")}return a};if(typeof define==="function"&&define.amd){define("c3",["d3"],t)}else if("undefined"!==typeof exports&&"undefined"!==typeof module){module.exports=t}else{e.c3=t}})(window)