!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,l);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=n.copy();return b.isCategory&&(a=n.domain(),c.domain([a[0],a[1]-1])),c}function h(a){return k?k(a):a}function i(i){i.each(function(){function i(a){var b=n(a)+s;return B[0]=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"}function k(a){return Math.ceil(a)+.5}function l(a,b){var c,d,e;b&&b.axisX?c=b.axisX:(c=Ak.select("."+g.axisX),a&&(c=c.transition())),b&&b.axisY?d=b.axisY:(d=Ak.select("."+g.axisY),a&&(d=d.transition())),b&&b.axisY2?e=b.axisY2:(e=Ak.select("."+g.axisY2),a&&(e=e.transition())),(a?Ak.transition():Ak).attr("transform",jk.main),c.attr("transform",jk.x),d.attr("transform",jk.y),e.attr("transform",jk.y2),Ak.select("."+g.chartArcs).attr("transform",jk.arc)}function m(a,b){var c;b&&b.axisSubX?c=b.axisSubX:(c=Bk.select("."+g.axisX),a&&(c=c.transition())),Bk.attr("transform",jk.context),c.attr("transform",jk.subx)}function n(a){(a?Ck.transition():Ck).attr("transform",jk.legend)}function o(a,b){l(a,b),Qh&&m(a,b),n(a)}function p(){var a=V(),b=U(),c=kk||lk?0:a,d=ve(lg.data.targets),e=di||d?0:A("x"),f=Qh&&!d?Rh+e:0;Lg=t(),Mg=u(),di?(Eg={top:A("y2")+v(),right:d?0:y(),bottom:A("y")+c+w(),left:f+(d?0:x())},Fg={top:Eg.top,right:0/0,bottom:20+c,left:tk}):(Eg={top:4+v(),right:d?0:y(),bottom:e+f+c+w(),left:d?0:x()},Fg={top:Mg-f-c,right:0/0,bottom:e+c,left:Eg.left});var g={top:mk?v()+Zh+5.5:Mg-a-w()-Zh,left:nk?x()+Yh+.5:Lg-b-y()-Yh+.5};Gg={top:kk?0:lk?g.top:Mg-a,right:0/0,bottom:0,left:kk?Lg-b:lk?g.left:0},Hg=Lg-Eg.left-Eg.right,Jg=Mg-Eg.top-Eg.bottom,0>Hg&&(Hg=0),0>Jg&&(Jg=0),Ig=di?Eg.left-tk-uk:Hg,Kg=di?Jg:Mg-Fg.top-Fg.bottom,0>Ig&&(Ig=0),0>Kg&&(Kg=0),Qg=Hg-(kk?b+10:0),Rg=Jg-(kk?0:10),r(),kk&&d&&(Gg.left=Qg/2+1.1*Og)}function q(){Ak.select("line."+g.xgridFocus).attr("x1",di?0:-10).attr("x2",di?Hg:-10).attr("y1",di?-10:0).attr("y2",di?-10:Jg)}function r(){var a,b=sj||wj;Og=Math.min(Qg,Rg)/2,Ng=.95*Og,a=b?(Ng-b)/Ng:.6,Pg=ue(lg.data.targets)||te(lg.data.targets)?Ng*a:0}function s(){var a=di?g.axisX:g.axisY,b=Ak.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ek.node().getBoundingClientRect(),e=ve(lg.data.targets),f=c.right-d.left-(e?0:x());return f>0?f:0}function t(){return og?og:C()}function u(){var a=pg?pg:D();return a>0?a:320}function v(){return b(sg)?sg:0}function w(){return b(tg)?tg:0}function x(){return b(qg)?qg:di?ei?Math.max(Ze(z("x")),40):1:!xi||Ci?1:Ze(z("y"))}function y(){var a=10,c=kk?U()+20:0;return b(rg)?rg+1:di?a+c:(!Hi||Mi?a:Ze(z("y2")))+c}function z(a){var b=pb(a);return b.isInner?20+Ib(a):40+Ib(a)}function A(a){return"x"!==a||ei?"x"===a&&ui?ui:"y"!==a||xi?"y2"!==a||Hi?(pb(a).isInner?30:40)+("y2"===a?-10:0):vk:!Vh||kk||lk?1:10:0}function B(a){for(var b,c=Ek.node();c&&"BODY"!==c.tagName&&!(b=c.getBoundingClientRect()[a]);)c=c.parentNode;return b}function C(){return B("width")}function D(){var a=Ek.style("height");return a.indexOf("px")>0?+a.replace("px",""):0}function E(a){return a?-31:-(Eg.left-1)}function F(a){return a?-20:-4}function G(){return E(!di)}function H(){return F(!di)}function I(){return E(di)}function J(){return F(di)}function K(a){return a?Hg+2+30+30:Eg.left+20}function L(a){return a?(ui?ui:0)+80:Jg+8}function M(){return K(!di)}function N(){return L(!di)}function O(){return K(di)}function P(){return L(di)}function Q(){var a,b,c,d,e,f,g=Nc(lg.data.targets);return g?(a=g.values[0],b=g.values[g.values.length-1],c=ch(b.x)-ch(a.x),0===c?di?Jg:Hg:(d=Mc(),e=qe(lg.data.targets)?(d-(Rj?.25:1))/d:1,f=d>1?c*e/(d-1):c,1>f?1:f)):0}function R(a){ok=a}function S(a){pk=a}function T(a){qk=a}function U(){return Vh?kk||lk?pk*(ok+1):Lg:0}function V(){var a=0;return Vh&&(a=kk?Mg:lk?$h?Math.max(20,qk)*($h+1):Jg:Math.max(20,qk)*(ok+1)),a}function W(){var a,b,c=!ch;Wg=di?1:0,Xg=di?Jg:Hg,Yg=di?0:Jg,Zg=di?Hg:1,$g=Wg,_g=Xg,ah=di?0:Kg,bh=di?Ig:1,ch=Z(Wg,Xg,c?void 0:ch.orgDomain(),function(){return ih.tickOffset()}),dh=$(Yg,Zg,c?void 0:dh.domain()),eh=$(Yg,Zg,c?void 0:eh.domain()),fh=Z(Wg,Xg,Fk,function(a){return a%1?0:lh.tickOffset()}),gh=$(ah,bh,c?void 0:gh.domain()),hh=$(ah,bh,c?void 0:hh.domain()),a=eb(),b=oi?oi:c?void 0:ih.tickValues(),ih=bb(ch,fk,a,b),lh=bb(fh,ik,a,b),jh=cb(dh,gk,Di,Gi,Ei),kh=cb(eh,hk,Ni,Qi,Oi),c||(wk.scale(fh),ug&&xk.scale(ch)),X()}function X(){Sg=Mb(),Tg=Nb(),Ug=Nb(.98)}function Y(a,b,c){return(c?kg.time.scale():kg.scale.linear()).range([a,b])}function Z(a,b,c,d){var e,f=Y(a,b,Qj),g=c?f.domain(c):f;Rj?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){return g.domain()},Rj&&(f.domain=function(a){return arguments.length?(g.domain(a),f):(a=this.orgDomain(),[a[0],a[1]+1])}),f}function $(a,b,c){var d=Y(a,b);return c&&d.domain(c),d}function _(a){return"y2"===db(a)?eh:dh}function ab(a){return"y2"===db(a)?hh:gh}function bb(a,b,c,d){var f={isCategory:Rj,withOuterTick:qi},g=e(kg,f).scale(a).orient(b);return g.tickFormat(c).tickValues(d),Rj?(g.tickCentered(ii),Se(ki)&&(ki=!1)):g.tickOffset=function(){var a=Oc(lg.data.targets),b=ch(a[1])-ch(a[0]),c=b?b:di?Jg:Hg;return c/Mc()/2},g}function cb(a,b,c,d,f){var g={withOuterTick:f};return e(kg,g).scale(a).orient(b).tickFormat(c).ticks(d)}function db(a){return a in uh?uh[a]:"y"}function eb(){var a=Qj?bk:Rj?dd:function(a){return 0>a?a.toFixed(0):a};return ji&&("function"==typeof ji?a=ji:Qj&&(a=function(a){return a?ak(ji)(a):""})),a}function fb(a){var b;return"y"===a?b=Bi:"y2"===a?b=Li:"x"===a&&(b=wi),b}function gb(a){var b=fb(a);return"string"==typeof b?b:b?b.text:null}function hb(a,b){var c=fb(a);"string"==typeof c?"y"===a?Bi=b:"y2"===a?Li=b:"x"===a&&(wi=b):c&&(c.text=b)}function ib(a){return 10*Math.sin(Math.PI*(a/180))}function jb(a){return 11.5-2.5*(a/15)}function kb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",jb(c)).attr("x",ib(c)).attr("transform","rotate("+c+")")}function lb(a,b){var c=fb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function mb(){return lb("x",di?"inner-top":"inner-right")}function nb(){return lb("y",di?"inner-right":"inner-top")}function ob(){return lb("y2",di?"inner-right":"inner-top")}function pb(a){return"y2"===a?ob():"y"===a?nb():mb()}function qb(){return gb("x")}function rb(){return gb("y")}function sb(){return gb("y2")}function tb(a,b){return a?b.isLeft?0:b.isCenter?Hg/2:Hg:b.isBottom?-Jg:b.isMiddle?-Jg/2:0}function ub(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function vb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function wb(){return tb(!di,mb())}function xb(){return tb(di,nb())}function yb(){return tb(di,ob())}function zb(){return ub(!di,mb())}function Ab(){return ub(di,nb())}function Bb(){return ub(di,ob())}function Cb(){var a=mb();return di?a.isInner?"1.2em":-25-Ib("x"):a.isInner?"-0.5em":ui?ui-10:"3em"}function Db(){var a=nb();return di?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Ib("y")}function Eb(){var a=ob();return di?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Ib("y2")}function Fb(){return vb(!di,mb())}function Gb(){return vb(di,nb())}function Hb(){return vb(di,ob())}function Ib(a){var b,c,d,e=0;return yk&&(b=Uc(lg.data.targets),"y"===a?(c=dh.copy().domain(ac(b,"y")),d=cb(c,gk,Di,Gi,Ei)):"y2"===a?(c=eh.copy().domain(ac(b,"y2")),d=cb(c,hk,Ni,Qi,Oi)):(c=ch.copy().domain(ec(b)),d=bb(c,fk,eb(),oi?oi:ih.tickValues())),Ak.append("g").call(d).each(function(){kg.select(this).selectAll("text").each(function(){var a=this.getBoundingClientRect();e=e?sk:e}function Jb(a){var b=Ak.select("."+g.axisX+" ."+g.axisXLabel),c=Ak.select("."+g.axisY+" ."+g.axisYLabel),d=Ak.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",wb).attr("dx",zb).attr("dy",Cb).text(qb),(a?c.transition():c).attr("x",xb).attr("dx",Ab).attr("dy",Db).attr("dy",Db).text(rb),(a?d.transition():d).attr("x",yb).attr("dx",Bb).attr("dy",Eb).text(sb)}function Kb(a,b){return a.startAngle-b.startAngle}function Lb(a){var b=!1,c=0;if(Vg(Uc(lg.data.targets)).sort(Kb).forEach(function(d){b||d.data.id!==a.data.id||(b=!0,a=d,a.index=c),c++}),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),De(a.data)){var d=pj,e=qj,f=Math.abs(d)+e,g=Math.PI/f;a.startAngle=-1*(Math.PI/2)+g*Math.abs(d),a.endAngle=a.startAngle+g*(a.value>e?e:a.value)}return b?a:null}function Mb(){var a=kg.svg.arc().outerRadius(Ng).innerRadius(Pg),b=function(b,c){var d;return c?a(b):(d=Lb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Nb(a){var b=kg.svg.arc().outerRadius(Og*(a?a:1)).innerRadius(Pg);return function(a){var c=Lb(a);return c?b(c):"M 0 0"}}function Ob(a,b,c){return c||Fe(a.data)?Sg(a,b):"M 0 0"}function Pb(a){var b,c,d,e,f,g=Lb(a),h="";return g&&!te(lg.data.targets)&&(b=Sg.centroid(g),c=isNaN(b[0])?0:b[0],d=isNaN(b[1])?0:b[1],e=Math.sqrt(c*c+d*d),f=Ng&&e?(36/Ng>.375?1.175-36/Ng:.8)*Ng/e:0,h="translate("+c*f+","+d*f+")"),h}function Qb(a){var b=te(lg.data.targets)?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/b:null}function Rb(a){return yc({id:a.data.id,value:a.value,ratio:Qb(a),index:a.index})}function Sb(a){var b,c,d,e;return Vb()?(b=Lb(a),c=b?b.value:null,d=Qb(b),te(lg.data.targets)||Wb(d)?(e=Xb(),e?e(c,d):Od(c,d)):""):""}function Tb(a,b){var c=yk.selectAll("."+g.chartArc+Bd(a)),d=yk.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});Le(a)&&c.selectAll("path").transition().duration(50).attr("d",Tg).transition().duration(100).attr("d",Ug).each(function(a){Ee(a.data)}),b||d.style("opacity",.3)}function Ub(a){var b=yk.selectAll("."+g.chartArc+Bd(a));b.selectAll("path."+g.arc).transition().duration(50).attr("d",Sg),yk.selectAll("."+g.arc).style("opacity",1)}function Vb(){var a=!0;return ue(lg.data.targets)?a=tj:se(lg.data.targets)&&(a=hj),a}function Wb(a){var b=ue(lg.data.targets)?vj:jj;return a>=b}function Xb(){var a=ij;return te(lg.data.targets)?a=nj:ue(lg.data.targets)&&(a=uj),a}function Yb(){return ue(lg.data.targets)?zj:""}function Zb(a,c,d,e){var f="ratio"===a.unit?e:1;return b(a[c])?a[c]*f:d}function $b(a){var b,c,d,e,f,g,h=Pc(a),i=_c(a);if(th.length>0)for(g=bd(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return kg.min(Object.keys(i).map(function(a){return kg.min(i[a])}))}function _b(a){var b,c,d,e,f,g,h=Pc(a),i=_c(a);if(th.length>0)for(g=cd(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return kg.max(Object.keys(i).map(function(a){return kg.max(i[a])}))}function ac(a,c){var d,e,f,g,h,i,j,k,l,m,n=a.filter(function(a){return db(a.id)===c}),o="y2"===c?Ji:zi,p="y2"===c?Ii:yi,q=b(o)?o:$b(n),r=b(p)?p:_b(n),s="y2"===c?Ki:Ai,t=qe(n)&&fj||pe(n)&&gj,u=Id()&&di,v=Id()&&!di;return 0===n.length?"y2"===c?eh.domain():dh.domain():(isNaN(q)&&(q=0),isNaN(r)&&(r=q),q===r&&(0>q?r=0:q=0),l=q>=0&&r>=0,m=0>=q&&0>=r,t&&(l&&(q=0),m&&(r=0)),d=Math.abs(r-q),e=f=g=.1*d,s&&(h=Math.max(Math.abs(q),Math.abs(r)),r=h-s,q=s-h),u?(i=Jd(q,r,c,"width"),j=gc(dh.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))):v&&(i=Jd(q,r,c,"height"),f+=i[1],g+=i[0]),"y"===c&&Fi&&(f=Zb(Fi,"top",e,d),g=Zb(Fi,"bottom",e,d)),"y2"===c&&Pi&&(f=Zb(Pi,"top",e,d),g=Zb(Pi,"bottom",e,d)),t&&(l&&(g=q),m&&(f=-r)),[q-g,r+f])}function bc(a){return si?Qj?Oe(si):si:kg.min(a,function(a){return kg.min(a.values,function(a){return a.x})})}function cc(a){return ri?Qj?Oe(ri):ri:kg.max(a,function(a){return kg.max(a.values,function(a){return a.x})})}function dc(a){var c,d,e,f,g=Oc(a),h=g[1]-g[0];return Rj?d=0:qe(a)?(c=Mc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof ti&&Te(ti)?(e=b(ti.left)?ti.left:d,f=b(ti.right)?ti.right:d):e=f="number"==typeof ti?ti:d,{left:e,right:f}}function ec(a){var b=[bc(a),cc(a)],c=b[0],d=b[1],e=dc(a),f=0,g=0;return c-d!==0||Rj||(c=Qj?new Date(.5*c.getTime()):-.5,d=Qj?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Qj?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Qj?new Date(d.getTime()+e.right):d+e.right),[f,g]}function fc(a,b,c,d){return c&&(ch.domain(d?d:kg.extent(ec(a))),Fk=ch.domain(),ug&&xk.scale(ch).updateScaleExtent(),fh.domain(ch.domain()),wk.scale(fh)),b&&(ch.domain(d?d:wk.empty()?Fk:wk.extent()),ug&&xk.scale(ch).updateScaleExtent()),ch.domain()}function gc(a){return a[1]-a[0]}function hc(a){for(var b=0;bb?0:b-c}function nc(a){var b,c=lc(a),d="y"===a.axis?dh:eh;return b="y"===a.axis||"y2"===a.axis?di?Jg:"start"in a?d(a.start):Jg:di&&"end"in a?ch(Qj?Oe(a.end):a.end):Jg,c>b?0:b-c}function oc(a){return!a.axis||"x"===a.axis}function pc(a){return mh&&a===mh||Te(nh)&&Ue(nh,a)}function qc(a){return!pc(a)}function rc(a){return mh?mh:Te(nh)?nh[a]:null}function sc(a,b){var c,d=b&&Te(b)?Pc(b):[];return d.forEach(function(b){rc(b)===a&&(c=lg.data.xs[b])}),c}function tc(a,c){return a in lg.data.xs&&lg.data.xs[a]&&b(lg.data.xs[a][c])?lg.data.xs[a][c]:c}function uc(){var a=Object.keys(lg.data.xs);return a.length?lg.data.xs[a[0]]:null}function vc(a){var b=uc();return b&&a=0?lg.data.xs[d]=(c&&lg.data.xs[d]?lg.data.xs[d]:[]).concat(a.map(function(a){return a[e]}).filter(b).map(function(a,b){return Cc(a,d,b)})):mh?lg.data.xs[d]=uc():Te(nh)&&(lg.data.xs[d]=sc(e,lg.data.targets)):lg.data.xs[d]=a.map(function(a,b){return b})}),e.forEach(function(a){if(!lg.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),d=e.map(function(b,c){var d=qh(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=rc(b),g=a[f],h=Cc(g,b,e);return Sj()&&Rj&&0===c&&g&&(0===e&&(hi=[]),hi.push(g)),("undefined"==typeof a[b]||lg.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),d.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++}),lg.data.xs[a.id].sort(function(a,b){return a-b})}),vh&&ne(Pc(d).filter(function(a){return!(a in wh)}),vh),d.forEach(function(a){ic(a.id_org,a)}),d}function Jc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function Kc(a){var b=zc(lg.data.targets[0].values,a-1);return b?b.x:null}function Lc(a){var b=zc(lg.data.targets[0].values,a+1);return b?b.x:null}function Mc(){return kg.max(lg.data.targets,function(a){return a.values.length})}function Nc(a){var b,c=a.length,d=0;return c>1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Oc(a){var b,c,d=Nc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Pc(a){return a.map(function(a){return a.id})}function Qc(a){return a?"string"==typeof a?[a]:a:Pc(lg.data.targets)}function Rc(a,b){var c,d=Pc(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Qj?new Date(i):i);j.push(e)}return Qj||(j=j.sort(function(a,b){return a-b})),j}function Xc(a){ck=ck.concat(a)}function Yc(a){ck=ck.filter(function(b){return a.indexOf(b)<0})}function Zc(a){dk=dk.concat(a)}function $c(a){dk=dk.filter(function(b){return a.indexOf(b)<0})}function _c(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function ad(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function cd(a){return ad(a,function(a){return a>0})}function dd(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ud(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ud(a,g))),Xd(e,b)):Vd(a,b,f,g)}function Wd(a,b){var c;return c=a.map(function(a){return Vd(a.values,b)}),Xd(c,b)}function Xd(a,b){var c,d;return a.forEach(function(a){var e=Ve(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Yd(a,b){return kg.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Zd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function $d(){return yh&&"desc"===yh.toLowerCase()}function _d(){return yh&&"asc"===yh.toLowerCase()}function ae(a){var b=_d(),c=$d();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof yh&&a.sort(yh),a}function be(a,c){var d,e,f,g,h,i,j,k=ve(lg.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Bj&&(Dk.html(Gj(a,eb(),Kd(k),Zj)).style("display","block"),d=Dk.property("offsetWidth"),e=Dk.property("offsetHeight"),k?(g=Hg/2+c[0],i=Jg/2+c[1]+20):(di?(f=s(),g=f+c[0]+100,h=g+d,j=t()-y(),i=ch(l[0].x)+20):(f=s(),g=f+x()+ch(l[0].x)+20,h=g+d,j=f+t()-y(),i=c[1]+15),h>j&&(g-=h-j),i+e>u()&&i>e+30&&(i-=e+30)),Dk.style("top",i+"px").style("left",g+"px"))}function ce(){Dk.style("display","none")}function de(a){var c=a.filter(function(a){return a&&b(a.value)});if(Bj&&!re(lg.data.targets)&&!ve(lg.data.targets)){var d=Ak.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(di?"y1":"x1",Qd).attr(di?"y2":"x2",Qd),Of(d,"grid")}}function ee(){Ak.select("line."+g.xgridFocus).style("visibility","hidden")}function fe(a,b){var c,d,e,f,h=[],i=Ak.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=ec(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10),h.length>i&&(h=h.filter(function(a){return(""+a).indexOf(".")<0}));return h}function ge(a){var b,d,e={},f=0;return Uc(lg.data.targets.filter(a)).forEach(function(a){for(b=0;b=0&&(i+=g(c.values[f].value)-h)}),i}}function ke(a){return a.x||0===a.x?ch(a.x):null}function le(a,b){var c=ge(we),d=Cf(c);return th.length>0?d(a,b)[0][1]:_(a.id)(a.value)}function me(a,b){var c="number"==typeof cj?cj:b?2*a.tickOffset()*dj/b:0;return dj&&c>ej?ej:c}function ne(a,b){Qc(a).forEach(function(a){Hk[a]=b===wh[a],wh[a]=b}),a||(vh=b)}function oe(a,b){var c=!1;return a.forEach(function(a){wh[a.id]===b&&(c=!0),a.id in wh||"line"!==b||(c=!0)}),c}function pe(a){return oe(a,"area")||oe(a,"area-spline")||oe(a,"area-step")}function qe(a){return oe(a,"bar")}function re(a){return oe(a,"scatter")}function se(a){return"pie"===vh||oe(a,"pie")}function te(a){return oe(a,"gauge")}function ue(a){return"donut"===vh||oe(a,"donut")}function ve(a){return se(a)||ue(a)||te(a)}function we(a){var b="string"==typeof a?a:a.id;return!wh[b]||["line","spline","area","area-spline","step","area-step"].indexOf(wh[b])>=0}function xe(a){var b="string"==typeof a?a:a.id;return["step","area-step"].indexOf(wh[b])>=0}function ye(a){var b="string"==typeof a?a:a.id;return["spline","area-spline"].indexOf(wh[b])>=0}function ze(a){var b="string"==typeof a?a:a.id;return["area","area-spline","area-step"].indexOf(wh[b])>=0}function Ae(a){var b="string"==typeof a?a:a.id;return"bar"===wh[b]}function Be(a){var b="string"==typeof a?a:a.id;return"scatter"===wh[b]}function Ce(a){var b="string"==typeof a?a:a.id;return"pie"===wh[b]}function De(a){var b="string"==typeof a?a:a.id;return"gauge"===wh[b]}function Ee(a){var b="string"==typeof a?a:a.id;return"donut"===wh[b]}function Fe(a){return Ce(a)||Ee(a)||De(a)}function Ge(a){return we(a)?[a]:[]}function He(a){return Fe(a.data)?[a]:[]}function Ie(a){return Ae(a)?a.values:[]}function Je(a){return we(a)||Be(a)?a.values:[]}function Ke(a){return Ae(a)||we(a)?a.values:[]}function Le(a){return Ee(a)&&yj||De(a)&&oj||Ce(a)&&lj}function Me(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length],a[g]=f),c instanceof Function?c(f,e):f}}function Ne(a,b){var c="value"===b.unit,d=b.values&&b.values.length?b.values:[],e=b.max||100;return function(b){var f,g,h=a[a.length-1];for(f=0;f0}function Ue(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ve(a,b){var c="y"===db(a.id)?dh:eh,d=di?1:0,e=di?0:1;return Math.pow(ch(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function We(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Xe(){var a=[],b=function(b,c){var d=setInterval(function(){var b=0;a.forEach(function(a){if(a.empty())return void(b+=1);try{a.transition()}catch(c){b+=1}}),b===a.length&&(clearInterval(d),c&&c())},10)};return b.add=function(b){a.push(b)},b}function Ye(a,b,c){return d(a[b])?a[b]:c}function Ze(a){return 10*Math.ceil(a/10)}function $e(a,b){var c;return kg.select("body").selectAll(".dummy").data([a]).enter().append("text").classed(b?b:"",!0).text(a).each(function(){c=this.getBoundingClientRect()}).remove(),c}function _e(a){return ye(a)?"cardinal":xe(a)?"step-after":"linear"}function af(){return kg.selectAll([])}function bf(a,b,c){Lh.call(lg,b,a.node()),Ak.select("."+g.selectedCircles+Ad(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return ed(g.selectedCircle,c)}).attr("cx",di?le:ke).attr("cy",di?ke:le).attr("stroke",function(){return Zj(b)}).attr("r",1.4*nf(b)).transition().duration(100).attr("r",nf)}function cf(a,b,c){Mh.call(lg,b,a.node()),Ak.select("."+g.selectedCircles+Ad(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function df(a,b,c,d){a?bf(b,c,d):cf(b,c,d)}function ef(a,b){Lh.call(lg,b,a.node()),a.transition().duration(100).style("fill",function(){return kg.rgb(Zj(b)).brighter(.75)})}function ff(a,b){Mh.call(lg,b,a.node()),a.transition().duration(100).style("fill",function(){return Zj(b)})}function gf(a,b,c,d){a?ef(b,c,d):ff(b,c,d)}function hf(a,b,c,d){gf(a,b,c.data,d)}function jf(a){return"circle"===a.nodeName?df:kg.select(a).classed(g.bar)?gf:hf}function kf(a){return a.filter(function(a){return b(a.value)})}function lf(a){return Yi&&!xe(a)?"function"==typeof Zi?Zi(a):Zi:0}function mf(a){return $i?_i?_i:1.75*lf(a):lf(a)}function nf(a){return aj?aj:4*lf(a)}function of(a,c){return(c?Ak.selectAll("."+g.circles+Ad(c)):Ak).selectAll("."+g.circle+(b(a)?"-"+a:""))}function pf(a,b){of(a,b).classed(g.EXPANDED,!0).attr("r",mf)}function qf(a){of(a).filter(function(){return kg.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",lf)}function rf(a){return Ak.selectAll("."+g.bar+(b(a)?"-"+a:""))}function sf(a){rf(a).classed(g.EXPANDED,!0)}function tf(a){rf(a).classed(g.EXPANDED,!1)}function uf(a,b){var c=kg.svg.area(),d=Af(a,b),e=b?ab:_,f=function(a,b){return th.length>0?d(a,b)[0][1]:e(a.id)(0)},g=function(a,b){return th.length>0?d(a,b)[1][1]:e(a.id)(a.value)};return c=di?c.x0(f).x1(g).y(Qd):c.x(Qd).y0(f).y1(g),bj||(c=c.defined(function(a){return null!==a.value})),function(a){var b,d=bj?kf(a.values):a.values,e=0,f=0;return ze(a)?b=c.interpolate(_e(a))(d):(d[0]&&(e=ch(d[0].x),f=_(a.id)(d[0].value)),b=di?"M "+f+" "+e:"M "+e+" "+f),b?b:"M 0 0"}}function vf(a,b){var c=kg.svg.line(),d=Cf(a,b),e=b?ab:_,f=b?Td:Qd,g=function(a,b){return th.length>0?d(a,b)[0][1]:e(a.id)(a.value)};return c=di?c.x(g).y(f):c.x(f).y(g),bj||(c=c.defined(function(a){return null!=a.value})),function(a){var d,f=bj?kf(a.values):a.values,g=b?g:fh,h=e(a.id),i=0,j=0;return we(a)?d=zh[a.id]?Df(f,g,h,zh[a.id]):c.interpolate(_e(a))(f):(f[0]&&(i=g(f[0].x),j=h(f[0].value)),d=di?"M "+j+" "+i:"M "+i+" "+j),d?d:"M 0 0"}}function wf(a,b){var c=Bf(a,b);return function(a,b){var d=c(a,b),e=di?1:0,f=di?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function xf(a,b){var c=Bf(a,!1),d=b?yf:zf;return function(a,b){return d(c(a,b),a,this)}}function yf(a,b,c){var d,e,f=c.getBoundingClientRect();return di?(e=Ae(b)?4:6,d=a[2][1]+e*(b.value<0?-1:1)):d=a[0][0]+(a[2][0]-a[0][0])/2,d>Hg?Hg-f.width:d}function zf(a,b,c){var d,e=c.getBoundingClientRect();return d=di?(a[0][0]+a[2][0]+.6*e.height)/2:a[2][1]+(b.value<0?e.height:Ae(b)?-3:-6),dj||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function Bf(a,b){var c=a.__max__+1,d=me(ih,c),e=he(d,c,a,!!b),f=ie(!!b),g=je(Ae,a,!!b),h=b?ab:_;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return di&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Cf(a,b){var c=a.__max__+1,d=he(0,c,a,!!b),e=ie(!!b),f=je(we,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return di&&(0j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function Df(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function Ef(){var a=ug?xk:function(){};Ak.select("."+g.zoomRect).call(a),Ak.selectAll("."+g.eventRect).call(a)}function Ff(){di?(ek.x.call(ih),ek.subx.call(lh)):(ek.y.call(jh),ek.y2.call(kh)),p(),W(),Tf(),o(!1)}function Gf(b){var c=new MutationObserver(function(d){d.forEach(function(d){if("childList"===d.type&&d.previousSibling){c.disconnect();var e=a.setInterval(function(){b.node().parentNode&&(a.clearInterval(e),Ff(),Pf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),b.transition().style("opacity",1))},10)}})});c.observe(b.node(),{attributes:!0,childList:!0,characterData:!0})}function Hf(b){var c,d,e,f,h=!0;if(Ek=kg.select(ng),Ek.empty()&&(Ek=kg.select(document.createElement("div")).style("opacity",0),Gf(Ek),h=!1),Ek.html("").classed("c3",!0),lg.data.xs={},lg.data.targets=Ic(b),Dh&&(lg.data.targets=lg.data.targets.filter(Dh)),Ch&&Xc(Ch===!0?Pc(lg.data.targets):Ch),te(lg.data.targets)&&(Vh=!1),p(),W(),ch.domain(kg.extent(ec(lg.data.targets))),dh.domain(ac(lg.data.targets,"y")),eh.domain(ac(lg.data.targets,"y2")),fh.domain(ch.domain()),gh.domain(dh.domain()),hh.domain(eh.domain()),Fk=ch.domain(),wk.scale(fh),ug&&xk.scale(ch),yk=Ek.append("svg").style("overflow","hidden").on("mouseenter",function(){return zg.call(lg)}).on("mouseleave",function(){return Ag.call(lg)}),zk=yk.append("defs"),zk.append("clipPath").attr("id",Kj).append("rect"),zk.append("clipPath").attr("id",Lj).append("rect"),zk.append("clipPath").attr("id",Mj).append("rect"),Tf(),Ak=yk.append("g").attr("transform",jk.main),Bk=yk.append("g").attr("transform",jk.context),Ck=yk.append("g").attr("transform",jk.legend),Qh||Bk.style("visibility","hidden"),Vh||(Ck.style("visibility","hidden"),dk=Pc(lg.data.targets)),Dk=Ek.style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),eg(Pc(lg.data.targets),{withTransform:!1,withTransitionForTransform:!1,withTransition:!1}),Ak.append("text").attr("class",g.text+" "+g.empty).attr("text-anchor","middle").attr("dominant-baseline","middle"),Ak.append("g").attr("clip-path",Nj).attr("class",g.regions),e=Ak.append("g").attr("clip-path",Nj).attr("class",g.grid),Ri&&e.append("g").attr("class",g.xgrids),Ui&&e.append("g").attr("class",g.ygrids),e.append("g").attr("class",g.xgridLines),e.append("g").attr("class",g.ygridLines),Xi&&e.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),Ak.append("g").attr("clip-path",Nj).attr("class",g.chart),d=Ak.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0),Ak.select("."+g.chart).append("g").attr("class",g.chartBars),Ak.select("."+g.chart).append("g").attr("class",g.chartLines),c=Ak.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",jk.arc),c.append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Yb()),te(lg.data.targets)&&(c.append("path").attr("class",g.chartArcsBackground).attr("d",function(){var a={data:[{value:qj}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return Ob(a,!0,!0)}),c.append("text").attr("dy",".75em").attr("class",g.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none").text(mj?rj:""),c.append("text").attr("dx",-1*(Pg+(Ng-Pg)/2)+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none").text(mj?pj:""),c.append("text").attr("dx",Pg+(Ng-Pg)/2+"px").attr("dy","1.2em").attr("class",g.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none").text(mj?qj:"")),Ak.select("."+g.chart).append("g").attr("class",g.chartTexts),Ak.insert("rect",wg?null:"g."+g.regions).attr("class",g.zoomRect).attr("width",Hg).attr("height",Jg).style("opacity",0).on("dblclick.zoom",null),vi&&wk.extent("function"!=typeof vi?vi:vi(ec())),ek.x=Ak.append("g").attr("class",g.axis+" "+g.axisX).attr("clip-path",Oj).attr("transform",jk.x).style("visibility",ei?"visible":"hidden"),ek.x.append("text").attr("class",g.axisXLabel).attr("transform",di?"rotate(-90)":"").style("text-anchor",Fb),ek.y=Ak.append("g").attr("class",g.axis+" "+g.axisY).attr("clip-path",Pj).attr("transform",jk.y).style("visibility",xi?"visible":"hidden"),ek.y.append("text").attr("class",g.axisYLabel).attr("transform",di?"":"rotate(-90)").style("text-anchor",Gb),ek.y2=Ak.append("g").attr("class",g.axis+" "+g.axisY2).attr("transform",jk.y2).style("visibility",Hi?"visible":"hidden"),ek.y2.append("text").attr("class",g.axisY2Label).attr("transform",di?"":"rotate(-90)").style("text-anchor",Hb),Bk.append("g").attr("clip-path",Nj).attr("class",g.chart),Bk.select("."+g.chart).append("g").attr("class",g.chartBars),Bk.select("."+g.chart).append("g").attr("class",g.chartLines),Bk.append("g").attr("clip-path",Nj).attr("class",g.brush).call(wk).selectAll("rect").attr(di?"width":"height",di?Ig:Kg),ek.subx=Bk.append("g").attr("class",g.axisX).attr("transform",jk.subx).attr("clip-path",di?"":Oj),Wf(lg.data.targets),h&&(Ff(),Pf({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1})),Hj){if(Qj&&"string"==typeof Ij){for(Ij=Oe(Ij),f=0;ff&&h>c&&d>i&&j>d;else{if(!n.classed(g.bar))return;m=Zd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=gf,q=!(c>h||f>c+e||d>j||i>d+k)}q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function Mf(a){ve(lg.data.targets)||Eh&&(Tj=a,Ak.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Uj=!0,Nh.call(lg))}function Nf(){ve(lg.data.targets)||Eh&&(Ak.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),Ak.selectAll("."+g.shape).classed(g.INCLUDED,!1),Uj=!1,Oh.call(lg))}function Of(a,b){"grid"===b&&a.each(function(){var a=kg.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function Pf(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,T,U,V,W,X,Y,Z,$,_,ab,bb=ge(ze),cb=ge(Ae),eb=ge(we),fb=ve(lg.data.targets),gb=Uc(lg.data.targets);if(d=h=p=u=af(),a=a||{},E=Ye(a,"withY",!0),F=Ye(a,"withSubchart",!0),G=Ye(a,"withTransition",!0),J=Ye(a,"withTransform",!1),K=Ye(a,"withUpdateXDomain",!1),L=Ye(a,"withUpdateOrgXDomain",!1),M=Ye(a,"withLegend",!1),H=Ye(a,"withTransitionForExit",G),I=Ye(a,"withTransitionForAxis",G),W=G?Dg:0,X=H?W:0,Y=I?W:0,c=c||Uf(Y),M&&Vh&&eg(Pc(lg.data.targets),a,c),Rj&&0===gb.length&&ch.domain([0,ek.x.selectAll(".tick").size()]),gb.length?(fc(gb,K,L),oi||!ni&&!mi||($=Wc(Vc(gb),mi),ih.tickValues($),lh.tickValues($))):(ih.tickValues([]),lh.tickValues([])),dh.domain(ac(gb,"y")),eh.domain(ac(gb,"y2")),ek.x.style("opacity",fb?0:1),ek.y.style("opacity",fb?0:1),ek.y2.style("opacity",fb?0:1),ek.subx.style("opacity",fb?0:1),c.axisX.call(ih),c.axisY.call(jh),c.axisY2.call(kh),c.axisSubX.call(lh),Jb(G),K&&gb.length)if(ki&&$){for(_=1;_<$.length;_++)if($.length/_=0&&kg.select(this).style("display",b%ab?"none":"block")})}else yk.selectAll("."+g.axisX+" .tick text").style("display","block");!di&&pi&&kb(ek.x,c.axisX,pi),N=uf(bb,!1),P=wf(cb),S=vf(eb,!1),U=xf(cb,!0),V=xf(cb,!1),gh.domain(dh.domain()),hh.domain(eh.domain()),Dk.style("display","none"),q(),Ak.select("text."+g.text+"."+g.empty).attr("x",Hg/2).attr("y",Jg/2).text(Ph).transition().style("opacity",gb.length?0:1),Ak.select("line."+g.xgridFocus).style("visibility","hidden"),Ri&&(e=di?{x1:0,x2:Hg,y1:function(a){return ch(a)-B},y2:function(a){return ch(a)-B}}:{x1:function(a){return ch(a)+B},x2:function(a){return ch(a)+B},y1:0,y2:Jg},(m=function(a){f=fe(Si,ch),B=Rj?ih.tickOffset():0,d=Ak.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),a||d.attr(e).style("opacity",function(){return+kg.select(this).attr(di?"y1":"x1")===(di?Jg:0)?0:1}),d.exit().remove()})()),h=Ak.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(Ti),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?" "+a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",di?"":"rotate(-90)").attr("dx",di?0:-Eg.top).attr("dy",-5).style("opacity",0),h.exit().transition().duration(W).style("opacity",0).remove(),E&&Ui&&(j=Ak.select("."+g.ygrids).selectAll("."+g.ygrid).data(dh.ticks(Wi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",di?dh:0).attr("x2",di?dh:Hg).attr("y1",di?0:dh).attr("y2",di?Jg:dh),j.exit().remove(),Of(j,"grid")),E&&(k=Ak.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(Vi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?" "+a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",di?"rotate(-90)":"").attr("dx",di?0:-Eg.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(W).attr("x1",di?Sd:0).attr("x2",di?Sd:Hg).attr("y1",di?0:Sd).attr("y2",di?Jg:Sd).style("opacity",1),k.select("text").transition().duration(W).attr("x",di?0:Hg).attr("y",Sd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(W).style("opacity",0).remove()),t=Ak.select("."+g.regions).selectAll("."+g.region).data(Aj),t.enter().append("g").attr("class",td).append("rect").style("fill-opacity",0),t.exit().transition().duration(W).style("opacity",0).remove(),r=Ak.selectAll("."+g.bars).selectAll("."+g.bar).data(Ie),r.enter().append("path").attr("class",nd).style("stroke",function(a){return Zj(a.id)}).style("fill",function(a){return Zj(a.id)}),r.style("opacity",Fd),r.exit().transition().duration(X).style("opacity",0).remove(),n=Ak.selectAll("."+g.lines).selectAll("."+g.line).data(Ge),n.enter().append("path").attr("class",jd).style("stroke",Zj),n.style("opacity",Fd).attr("transform",null),n.exit().transition().duration(X).style("opacity",0).remove(),o=Ak.selectAll("."+g.areas).selectAll("."+g.area).data(Ge),o.enter().append("path").attr("class",rd).style("fill",Zj).style("opacity",function(){return Gk=+kg.select(this).style("opacity"),0}),o.style("opacity",Gk),o.exit().transition().duration(X).style("opacity",0).remove(),Yi&&(p=Ak.selectAll("."+g.circles).selectAll("."+g.circle).data(Je),p.enter().append("circle").attr("class",ld).attr("r",lf).style("fill",Zj),p.style("opacity",Fd),p.exit().remove()),Id()&&(u=Ak.selectAll("."+g.texts).selectAll("."+g.text).data(Ke),u.enter().append("text").attr("class",fd).attr("text-anchor",function(a){return di?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",Zj).style("fill-opacity",0),u.text(function(a){return Pd(db(a.id))(a.value,a.id)}),u.exit().transition().duration(X).style("fill-opacity",0).remove()),s=Ak.selectAll("."+g.arcs).selectAll("."+g.arc).data(He),s.enter().append("path").attr("class",pd).style("fill",function(a){return Zj(a.data)}).style("cursor",function(a){return Gh(a)?"pointer":null}).style("opacity",0).each(function(a){De(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}).on("mouseover",function(a){var b,c;Xj||(b=Lb(a),c=Rb(b),Tb(b.data.id),ag(b.data.id,!0),Jh.call(lg,c,this))}).on("mousemove",function(a){var b=Lb(a),c=Rb(b),d=[c];be(d,kg.mouse(this))}).on("mouseout",function(a){var b,c;Xj||(b=Lb(a),c=Rb(b),Ub(b.data.id),bg(),ce(),Kh.call(lg,c,this))}).on("click",function(a,b){var c=Lb(a),d=Rb(c);Kf(this,d,b)}),s.attr("transform",function(a){return!De(a.data)&&J?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).each(function(){Xj=!0}).transition().duration(W).attrTween("d",function(a){var b,c=Lb(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=kg.interpolate(this._current,c),this._current=b(0),function(a){return Ob(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",J?"scale(1)":"").style("fill",function(a){return $j?$j(a.data.values[0].value):Zj(a.data.id)}).style("opacity",1).call(We,function(){Xj=!1}),s.exit().transition().duration(X).style("opacity",0).remove(),Ak.selectAll("."+g.chartArc).select("text").style("opacity",0).attr("class",function(a){return De(a.data)?g.gaugeValue:""}).text(Sb).attr("transform",Pb).transition().duration(W).style("opacity",function(a){return Sc(a.data.id)&&Fe(a.data)?1:0}),Ak.select("."+g.chartArcsTitle).style("opacity",ue(lg.data.targets)||te(lg.data.targets)?1:0),Qh&&(kg.event&&"zoom"===kg.event.type&&wk.extent(ch.orgDomain()).update(),F&&(!di&&pi&&kb(ek.subx,c.axisSubX,pi),wk.empty()||wk.extent(ch.orgDomain()).update(),O=uf(bb,!0),R=wf(cb,!0),T=vf(eb,!0),x=Bk.selectAll("."+g.bars).selectAll("."+g.bar).data(Ie),x.enter().append("path").attr("class",nd).style("stroke","none").style("fill",Zj),x.style("opacity",Fd).transition().duration(W).attr("d",R).style("opacity",1),x.exit().transition().duration(W).style("opacity",0).remove(),v=Bk.selectAll("."+g.lines).selectAll("."+g.line).data(Ge),v.enter().append("path").attr("class",jd).style("stroke",Zj),v.style("opacity",Fd).transition().duration(W).attr("d",T).style("opacity",1),v.exit().transition().duration(W).style("opacity",0).remove(),w=Bk.selectAll("."+g.areas).selectAll("."+g.area).data(Ge),w.enter().append("path").attr("class",rd).style("fill",Zj).style("opacity",function(){return Gk=+kg.select(this).style("opacity"),0}),w.style("opacity",0).transition().duration(W).attr("d",O).style("fill",Zj).style("opacity",Gk),w.exit().transition().duration(X).style("opacity",0).remove())),Ak.selectAll("."+g.selectedCircles).filter(function(a){return Ae(a)}).selectAll("circle").remove(),yg&&(y=Ak.select("."+g.eventRects).style("cursor",ug?di?"ns-resize":"ew-resize":null),Te(nh)&&!xc(nh)?(y.classed(g.eventRectsMultiple)||y.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),z=Ak.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),Jf(z.enter()),z.attr("x",0).attr("y",0).attr("width",Hg).attr("height",Jg)):(y.classed(g.eventRectsSingle)||y.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),!Sj()&&!Qj||Rj?(D=Q(),C=function(a){return ch(a.x)-D/2}):(D=function(a){var b=Kc(a.index),c=Lc(a.index),d=lg.data.xs[a.id][a.index],e=(ch(c?c:d)-ch(b?b:d))/2;return 0>e?0:e},C=function(a){var b=Kc(a.index),c=lg.data.xs[a.id][a.index];return(ch(c)+ch(b?b:c))/2}),A=Nc(lg.data.targets),Ak.select("."+g.eventRects).datum(A?A.values:[]),z=Ak.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),If(z.enter()),z.attr("class",ud).attr("x",di?0:C).attr("y",di?C:0).attr("width",di?Hg:D).attr("height",di?D:Jg),z.exit().remove())),kg.transition().duration(W).each(function(){var c=[];c.push(r.transition().attr("d",P).style("fill",Zj).style("opacity",1)),c.push(n.transition().attr("d",S).style("stroke",Zj).style("opacity",1)),c.push(o.transition().attr("d",N).style("fill",Zj).style("opacity",Gk)),c.push(p.transition().style("opacity",Gd).style("fill",Zj).attr("cx",di?le:ke).attr("cy",di?ke:le)),c.push(Ak.selectAll("."+g.selectedCircle).transition().attr("cx",di?le:ke).attr("cy",di?ke:le)),c.push(u.transition().attr("x",U).attr("y",V).style("fill",Zj).style("fill-opacity",a.flow?0:Hd)),c.push(t.selectAll("rect").transition().attr("x",kc).attr("y",lc).attr("width",mc).attr("height",nc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1})),c.push(h.select("line").transition().attr("x1",di?0:Rd).attr("x2",di?Hg:Rd).attr("y1",di?Rd:Eg.top).attr("y2",di?Rd:Jg).style("opacity",1)),c.push(h.select("text").transition().attr("x",di?Hg:0).attr("y",Rd).text(function(a){return a.text}).style("opacity",1)),a.flow&&(Z=Xe(),c.forEach(function(a){Z.add(a)}))}).call(Z?Z:function(){},function(){var b,c,f,i=1,j=a.flow.index,k=a.flow.length,l=zc(lg.data.targets[0].values,j),q=zc(lg.data.targets[0].values,j+k),s=ch.domain(),v=a.flow.duration||W,w=a.flow.done||function(){},x=Xe();lg.data.targets.forEach(function(a){a.values.splice(0,k)}),f=fc(gb,!0,!0),m&&m(!0),a.flow.orgDataCount?b=1===a.flow.orgDataCount||l.x===q.x?ch(s[0])-ch(f[0]):Qj?ch(s[0])-ch(f[0]):ch(l.x)-ch(q.x):1!==lg.data.targets[0].values.length?b=ch(s[0])-ch(f[0]):Qj?(l=zc(lg.data.targets[0].values,0),q=zc(lg.data.targets[0].values,lg.data.targets[0].values.length-1),b=ch(l.x)-ch(q.x)):b=gc(f)/2,i=gc(s)/gc(f),c="translate("+b+",0) scale("+i+",1)",kg.transition().ease("linear").duration(v).each(function(){x.add(ek.x.transition().call(ih)),x.add(r.transition().attr("transform",c)),x.add(n.transition().attr("transform",c)),x.add(o.transition().attr("transform",c)),x.add(p.transition().attr("transform",c)),x.add(u.transition().attr("transform",c)),x.add(t.filter(oc).transition().attr("transform",c)),x.add(d.transition().attr("transform",c)),x.add(h.transition().attr("transform",c))}).call(x,function(){var a,b=[],c=[],f=[];if(k){for(a=0;k>a;a++)b.push("."+g.shape+"-"+(j+a)),c.push("."+g.text+"-"+(j+a)),f.push("."+g.eventRect+"-"+(j+a));yk.selectAll("."+g.shapes).selectAll(b).remove(),yk.selectAll("."+g.texts).selectAll(c).remove(),yk.selectAll("."+g.eventRects).selectAll(f).remove(),yk.select("."+g.xgrid).remove()}d.attr("transform",null).attr(e),h.attr("transform",null),h.select("line").attr("x1",di?0:Rd).attr("x2",di?Hg:Rd),h.select("text").attr("x",di?Hg:0).attr("y",Rd),r.attr("transform",null).attr("d",P),n.attr("transform",null).attr("d",S),o.attr("transform",null).attr("d",N),p.attr("transform",null).attr("cx",di?le:ke).attr("cy",di?ke:le),u.attr("transform",null).attr("x",U).attr("y",V).style("fill-opacity",Hd),t.attr("transform",null),t.select("rect").filter(oc).attr("x",kc).attr("width",mc),z.attr("x",di?0:C).attr("y",di?C:0).attr("width",di?Hg:D).attr("height",di?D:Jg),w()})}),Pc(lg.data.targets).forEach(function(a){Hk[a]=!0}),Ef()}function Qf(){Pf({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0}),Sh.call(lg,ch.orgDomain())}function Rf(){if(ug&&0!==Uc(lg.data.targets).length){if("mousemove"===kg.event.sourceEvent.type&&xk.altDomain)return ch.domain(xk.altDomain),void xk.scale(ch).updateScaleExtent();Rj&&ch.orgDomain()[0]===Fk[0]&&ch.domain([Fk[0]-1e-10,ch.orgDomain()[1]]),Pf({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===kg.event.sourceEvent.type&&(Vj=!0),xg.call(lg,ch.orgDomain())}}function Sf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Tf(){yk.attr("width",Lg).attr("height",Mg),yk.select("#"+Kj).select("rect").attr("width",Hg).attr("height",Jg),yk.select("#"+Lj).select("rect").attr("x",G).attr("y",H).attr("width",M).attr("height",N),yk.select("#"+Mj).select("rect").attr("x",I).attr("y",J).attr("width",O).attr("height",P),yk.select("."+g.zoomRect).attr("width",Hg).attr("height",Jg),Ek.style("max-height",Mg+"px")}function Uf(a){return{axisX:a?ek.x.transition().duration(a):ek.x,axisY:a?ek.y.transition().duration(a):ek.y,axisY2:a?ek.y2.transition().duration(a):ek.y2,axisSubX:a?ek.subx.transition().duration(a):ek.subx}}function Vf(a){var b;a=a||{},a.withTransition=Ye(a,"withTransition",!0),a.withTransform=Ye(a,"withTransform",!1),a.withLegend=Ye(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withTransitionForTransform=Ye(a,"withTransitionForTransform",a.withTransition),p(),a.withLegend&&Vh||(b=Uf(a.withTransitionForAxis?Dg:0),W(),Tf(),o(a.withTransitionForTransform,b)),Pf(a,b)}function Wf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=Ak.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",wd),j=i.enter().append("g").attr("class",wd).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",gd),e=Ak.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",yd),d=e.enter().append("g").attr("class",yd).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",od).style("cursor",function(a){return Gh(a)?"pointer":null}),c=Ak.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",xd),b=c.enter().append("g").attr("class",xd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",kd),b.append("g").attr("class",sd),b.append("g").attr("class",function(a){return ed(g.selectedCircles,a.id)}),b.append("g").attr("class",md).style("cursor",function(a){return Gh(a)?"pointer":null}),a.forEach(function(a){Ak.selectAll("."+g.selectedCircles+Ad(a.id)).selectAll("."+g.selectedCircle).each(function(b){b.value=a.values[b.index].value})}),h=Ak.select("."+g.chartArcs).selectAll("."+g.chartArc).data(Vg(a)).attr("class",zd),f=h.enter().append("g").attr("class",zd),f.append("g").attr("class",qd),f.append("text").attr("dy",te(lg.data.targets)?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),Qh&&(n=Bk.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",yd),m=n.enter().append("g").style("opacity",0).attr("class",yd),m.append("g").attr("class",od),l=Bk.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",xd),k=l.enter().append("g").style("opacity",0).attr("class",xd),k.append("g").attr("class",kd),k.append("g").attr("class",sd)),yk.selectAll("."+g.target).filter(function(a){return Sc(a.id)}).transition().duration(Dg).style("opacity",1)}function Xf(a,b){a&&(b.filter&&(a=a.filter(b.filter)),(b.type||b.types)&&a.forEach(function(a){b.types?ne(a.id,b.types[a.id]):ne(a.id,b.type)}),lg.data.targets.forEach(function(b){for(var c=0;cf&&(f=(m-l)/2,z=0,F++)),E[a]=F,D[F]=lk?10:f,A[a]=z,z+=l}var f,h,i=$e(b.textContent,g.legendItem),j=10*Math.ceil((i.width+v)/10),k=10*Math.ceil((i.height+u)/10),l=kk||lk?k:j,m=kk||lk?V():U();return d&&(z=0,F=0,w=0,x=0),Vh&&!Tc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=j,C[c]=k,(!w||j>=w)&&(w=j),(!x||k>=x)&&(x=k),h=kk||lk?x:w,void(ci?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(m-h*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=36,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Ck.selectAll("."+g.legendItemFocused).size();b=b||{},n=Ye(b,"withTransition",!0),q=Ye(b,"withTransitionForTransform",!0),kk?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):lk?(f=function(a){return w*E[a]+10},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Ck.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return ed(g.legendItem,a)}).style("visibility",function(a){return Tc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof _h?_h.call(lg,a):lg.toggle(a)}).on("mouseover",function(a){kg.select(this).classed(g.legendItemFocused,!0),Xj||lg.focus(a),"function"==typeof ai&&ai.call(lg,a)}).on("mouseout",function(a){kg.select(this).classed(g.legendItemFocused,!1),Xj||lg.revert(),"function"==typeof bi&&bi.call(lg,a)}),m.append("text").text(function(a){return d(rh[a])?rh[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",kk||lk?h:-200).attr("y",kk||lk?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",kk||lk?i:-200).attr("y",kk||lk?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",Zj).attr("x",kk||lk?h:-200).attr("y",kk||lk?-200:j).attr("width",10).attr("height",10),lk&&0!==w&&Ck.insert("g","."+g.legendItem).attr("class",g.legendBackground).append("rect").attr("height",V()-10).attr("width",w*(F+1)+10),r=Ck.selectAll("text").data(a).text(function(a){return d(rh[a])?rh[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Ck.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Ck.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Zj).attr("x",f).attr("y",j),Ck.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Sc(a)}).transition().style("opacity",function(a){var b=kg.select(this);return Sc(a)?!G||b.classed(g.legendItemFocused)?$f(b):_f(b):rk}),S(w),T(x),R(F),p(),W(),Tf(),o(q,c)}function fg(a){return Rc(lg.data.targets,a.id)}function gg(a){return"data"in a&&Rc(lg.data.targets,a.data.id)}function hg(a){return a?function(b){var c=!1;return[].concat(a).forEach(function(d){("value"in d&&b.value===a.value||"class"in d&&b.class===a.class)&&(c=!0)}),c}:function(){return!0}}function ig(a,b){var c=hg(a),d=function(a){return!c(a)},e=b?g.xgridLines:g.ygridLines,f=b?g.xgridLine:g.ygridLine;Ak.select("."+e).selectAll("."+f).filter(c).transition().duration(Dg).style("opacity",0).remove(),b?Ti=Ti.filter(d):Vi=Vi.filter(d)}function jg(a,b,c){var d=!ve(lg.data.targets),e=c||{withTransitionForAxis:d};e.withTransitionForTransform=!1,Xj=!1,ne(a,b),Vf(e)}var kg=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,lg={data:{},axis:{},legend:{}},mg={},ng=i(["bindto"],"#chart"),og=i(["size","width"]),pg=i(["size","height"]),qg=i(["padding","left"]),rg=i(["padding","right"]),sg=i(["padding","top"]),tg=i(["padding","bottom"]),ug=i(["zoom","enabled"],!1),vg=i(["zoom","extent"]),wg=i(["zoom","privileged"],!1),xg=i(["zoom","onzoom"],function(){}),yg=i(["interaction","enabled"],!0),zg=i(["onmouseover"],function(){}),Ag=i(["onmouseout"],function(){}),Bg=i(["onresize"],function(){}),Cg=i(["onresized"],function(){}),Dg=i(["transition","duration"],350);h("data","data is required in config");var Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g,_g,ah,bh,ch,dh,eh,fh,gh,hh,ih,jh,kh,lh,mh=i(["data","x"]),nh=i(["data","xs"],{}),oh=i(["data","x_format"],"%Y-%m-%d"),ph=i(["data","x_localtime"],!0),qh=i(["data","id_converter"],function(a){return a}),rh=i(["data","names"],{}),sh=i(["data","classes"],{}),th=i(["data","groups"],[]),uh=i(["data","axes"],{}),vh=i(["data","type"]),wh=i(["data","types"],{}),xh=i(["data","labels"],{}),yh=i(["data","order"],"desc"),zh=i(["data","regions"],{}),Ah=i(["data","color"]),Bh=i(["data","colors"],{}),Ch=i(["data","hide"],!1),Dh=i(["data","filter"]),Eh=i(["data","selection","enabled"],!1),Fh=i(["data","selection","grouped"],!1),Gh=i(["data","selection","isselectable"],function(){return!0}),Hh=i(["data","selection","multiple"],!0),Ih=i(["data","onclick"],function(){}),Jh=i(["data","onmouseover"],function(){}),Kh=i(["data","onmouseout"],function(){}),Lh=i(["data","onselected"],function(){}),Mh=i(["data","onunselected"],function(){}),Nh=i(["data","ondragstart"],function(){}),Oh=i(["data","ondragend"],function(){}),Ph=i(["data","empty","label","text"],""),Qh=i(["subchart","show"],!1),Rh=i(["subchart","size","height"],60),Sh=i(["subchart","onbrush"],function(){}),Th=i(["color","pattern"],[]),Uh=i(["color","threshold"],{}),Vh=i(["legend","show"],!0),Wh=i(["legend","position"],"bottom"),Xh=i(["legend","inset","anchor"],"top-left"),Yh=i(["legend","inset","x"],10),Zh=i(["legend","inset","y"],0),$h=i(["legend","inset","step"]),_h=i(["legend","item","onclick"]),ai=i(["legend","item","onmouseover"]),bi=i(["legend","item","onmouseout"]),ci=i(["legend","equally"],!1),di=i(["axis","rotated"],!1),ei=i(["axis","x","show"],!0),fi=i(["axis","x","type"],"indexed"),gi=i(["axis","x","localtime"],!0),hi=i(["axis","x","categories"],[]),ii=i(["axis","x","tick","centered"],!1),ji=i(["axis","x","tick","format"]),ki=i(["axis","x","tick","culling"],{}),li=i(["axis","x","tick","culling","max"],10),mi=i(["axis","x","tick","count"]),ni=i(["axis","x","tick","fit"],!0),oi=i(["axis","x","tick","values"],null),pi=i(["axis","x","tick","rotate"]),qi=i(["axis","x","tick","outer"],!0),ri=i(["axis","x","max"],null),si=i(["axis","x","min"],null),ti=i(["axis","x","padding"],{}),ui=i(["axis","x","height"]),vi=i(["axis","x","default"]),wi=i(["axis","x","label"],{}),xi=i(["axis","y","show"],!0),yi=i(["axis","y","max"]),zi=i(["axis","y","min"]),Ai=i(["axis","y","center"]),Bi=i(["axis","y","label"],{}),Ci=i(["axis","y","inner"],!1),Di=i(["axis","y","tick","format"]),Ei=i(["axis","y","tick","outer"],!0),Fi=i(["axis","y","padding"]),Gi=i(["axis","y","ticks"],10),Hi=i(["axis","y2","show"],!1),Ii=i(["axis","y2","max"]),Ji=i(["axis","y2","min"]),Ki=i(["axis","y2","center"]),Li=i(["axis","y2","label"],{}),Mi=i(["axis","y2","inner"],!1),Ni=i(["axis","y2","tick","format"]),Oi=i(["axis","y2","tick","outer"],!0),Pi=i(["axis","y2","padding"]),Qi=i(["axis","y2","ticks"],10),Ri=i(["grid","x","show"],!1),Si=i(["grid","x","type"],"tick"),Ti=i(["grid","x","lines"],[]),Ui=i(["grid","y","show"],!1),Vi=i(["grid","y","lines"],[]),Wi=i(["grid","y","ticks"],10),Xi=i(["grid","focus","show"],!0),Yi=i(["point","show"],!0),Zi=i(["point","r"],2.5),$i=i(["point","focus","expand","enabled"],!0),_i=i(["point","focus","expand","r"]),aj=i(["point","focus","select","r"]),bj=i(["line","connect_null"],!1),cj=i(["bar","width"]),dj=i(["bar","width","ratio"],.6),ej=i(["bar","width","max"]),fj=i(["bar","zerobased"],!0),gj=i(["area","zerobased"],!0),hj=i(["pie","label","show"],!0),ij=i(["pie","label","format"]),jj=i(["pie","label","threshold"],.05),kj=i(["pie","sort"],!0),lj=i(["pie","expand"],!0),mj=i(["gauge","label","show"],!0),nj=i(["gauge","label","format"]),oj=i(["gauge","expand"],!0),pj=i(["gauge","min"],0),qj=i(["gauge","max"],100),rj=i(["gauge","units"]),sj=i(["gauge","width"]),tj=i(["donut","label","show"],!0),uj=i(["donut","label","format"]),vj=i(["donut","label","threshold"],.05),wj=i(["donut","width"]),xj=i(["donut","sort"],!0),yj=i(["donut","expand"],!0),zj=i(["donut","title"],""),Aj=i(["regions"],[]),Bj=i(["tooltip","show"],!0),Cj=i(["tooltip","grouped"],!0),Dj=i(["tooltip","format","title"]),Ej=i(["tooltip","format","name"]),Fj=i(["tooltip","format","value"]),Gj=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k,l=Dj?Dj:b,m=Ej?Ej:function(a){return a},n=Fj?Fj:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=m(a[f].name),i=n(a[f].value,a[f].ratio,a[f].id,a[f].index),k=$j?$j(a[f].value):d(a[f].id),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Hj=i(["tooltip","init","show"],!1),Ij=i(["tooltip","init","x"],0),Jj=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Kj="c3-"+ +new Date+"-clip",Lj=Kj+"-xaxis",Mj=Kj+"-yaxis",Nj=j(Kj),Oj=j(Lj),Pj=j(Mj),Qj="timeseries"===fi,Rj=fi.indexOf("categor")>=0,Sj=function(){return!Qj&&(mh||Te(nh))},Tj=null,Uj=!1,Vj=!1,Wj=!1,Xj=!1,Yj=kg.scale.category10().range(),Zj=Me(Bh,Te(Th)?Th:Yj,Ah),$j=Te(Uh)?Ne(Th,Uh):null,_j=ph?kg.time.format:kg.time.format.utc,ak=gi?kg.time.format:kg.time.format.utc,bk=ak.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),ck=[],dk=[],ek={},fk=di?"left":"bottom",gk=di?Ci?"top":"bottom":Ci?"right":"left",hk=di?Mi?"bottom":"top":Mi?"left":"right",ik=di?"left":"bottom",jk={main:function(){return"translate("+k(Eg.left)+","+k(Eg.top)+")"},context:function(){return"translate("+k(Fg.left)+","+k(Fg.top)+")"},legend:function(){return"translate("+Gg.left+","+Gg.top+")"},x:function(){return"translate(0,"+(di?0:Jg)+")"},y:function(){return"translate(0,"+(di?Jg:0)+")"},y2:function(){return"translate("+(di?0:Hg)+","+(di?1:0)+")"},subx:function(){return"translate(0,"+(di?0:Kg)+")"},arc:function(){return"translate("+Qg/2+","+Rg/2+")"}},kk="right"===Wh,lk="inset"===Wh,mk="top-left"===Xh||"top-right"===Xh,nk="top-left"===Xh||"bottom-left"===Xh,ok=0,pk=0,qk=0,rk=.15,sk=0,tk=30,uk=di&&!ei?0:30,vk=5;Vg=kg.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)}),yh&&kj&&xj||Vg.sort(null);var wk,xk=function(){};wk=kg.svg.brush().on("brush",Qf),wk.update=function(){return Bk&&Bk.select("."+g.brush).call(this),this},wk.scale=function(a){return di?this.y(a):this.x(a)},xk=kg.behavior.zoom().on("zoomstart",function(){xk.altDomain=kg.event.sourceEvent.altKey?ch.orgDomain():null}).on("zoom",Rf),xk.scale=function(a){return di?this.y(a):this.x(a)},xk.orgScaleExtent=function(){var a=vg?vg:[1,10];return[a[0],Math.max(Mc()/a[1],a[1])]},xk.updateScaleExtent=function(){var a=gc(ch.orgDomain())/gc(Fk),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this};var yk,zk,Ak,Bk,Ck,Dk,Ek,Fk,Gk,Hk={};if(lg.focus=function(a){function b(a){Uc(a).transition().duration(100).style("opacity",1)}var c=yk.selectAll(Bd(a)),d=c.filter(fg),e=c.filter(gg);lg.revert(),lg.defocus(),b(d.classed(g.focused,!0)),b(e),ve(lg.data.targets)&&Tb(a,!0),ag(a,!0)},lg.defocus=function(a){function b(a){Uc(a).transition().duration(100).style("opacity",.3)}var c=yk.selectAll(Bd(a)),d=c.filter(fg),e=c.filter(gg);lg.revert(),b(d.classed(g.focused,!1)),b(e),ve(lg.data.targets)&&Ub(a),ag(a,!1)},lg.revert=function(a){function b(a){Uc(a).transition().duration(100).style("opacity",1)}var c=yk.selectAll(Bd(a)),d=c.filter(fg),e=c.filter(gg);b(d.classed(g.focused,!1)),b(e),ve(lg.data.targets)&&Ub(a),bg()},lg.show=function(a,b){a=Qc(a),b=b||{},Yc(a),yk.selectAll(Cd(a)).transition().style("opacity",1),b.withLegend&&cg(a),Pf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},lg.hide=function(a,b){a=Qc(a),b=b||{},Xc(a),yk.selectAll(Cd(a)).transition().style("opacity",0),b.withLegend&&dg(a),Pf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},lg.toggle=function(a){Sc(a)?lg.hide(a):lg.show(a)},lg.unzoom=function(){wk.clear().update(),Pf({withUpdateXDomain:!0})},lg.zoom=function(){},lg.zoom.enable=function(a){ug=a,Vf()},lg.load=function(a){return a.xs&&wc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){sh[b]=a.classes[b]}),"categories"in a&&Rj&&(hi=a.categories),"cacheIds"in a&&hc(a.cacheIds)?void Xf(jc(a.cacheIds),a.done):void("unload"in a?Zf(Qc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Yf(a)}):Yf(a))},lg.unload=function(a){a=a||{},Zf(Qc(a.ids),function(){Pf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof a.done&&a.done()})},lg.flow=function(a){var c,e,f,g,h,i,j,k,l=[],m=Mc(),n=0,o=0;if(a.json)e=Fc(a.json,a.keys);else if(a.rows)e=Gc(a.rows);else{if(!a.columns)return;e=Hc(a.columns)}c=Ic(e,!0),lg.data.targets.forEach(function(a){var b,d,e=!1;for(b=0;bd;d++)c[b].values[d].index=o+d,Qj||(c[b].values[d].x=o+d);a.values=a.values.concat(c[b].values),c.splice(b,1);break}e||l.push(a.id)}),lg.data.targets.forEach(function(a){var b,c;for(b=0;bc;c++)a.values.push({id:a.id,index:o+c,x:Qj?vc(o+c):o+c,value:null})}),lg.data.targets.length&&c.forEach(function(a){var b,c=[];for(b=lg.data.targets[0].values[0].index;o>b;b++)c.push({id:a.id,index:b,x:Qj?vc(b):b,value:null});a.values.forEach(function(a){a.index+=o,Qj||(a.x+=o)}),a.values=c.concat(a.values)}),lg.data.targets=lg.data.targets.concat(c),f=Mc(),h=lg.data.targets[0],i=h.values[0],d(a.to)?(n=0,k=Qj?Oe(a.to):a.to,h.values.forEach(function(a){a.x1?h.values[h.values.length-1].x-i.x:i.x-ec(lg.data.targets)[0]:1,g=[i.x-j,i.x],fc(null,!0,!0,g)),Wf(lg.data.targets),Pf({flow:{index:i.index,length:n,duration:b(a.duration)?a.duration:Dg,done:a.done,orgDataCount:m},withLegend:!0,withTransition:m>1})},lg.selected=function(a){return kg.merge(Ak.selectAll("."+g.shapes+Ad(a)).selectAll("."+g.shape).filter(function(){return kg.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},lg.select=function(a,b,c){Eh&&Ak.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=kg.select(this),i=e.data?e.data.id:e.id,j=jf(this),k=Fh||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);h.classed(g.line)||h.classed(g.area)||(k&&l?Gh(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},lg.unselect=function(a,b){Eh&&Ak.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=kg.select(this),f=c.data?c.data.id:c.id,h=jf(this),i=Fh||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);e.classed(g.line)||e.classed(g.area)||i&&j&&Gh(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},lg.transform=function(a,b){var c=["pie","donut"].indexOf(a)>=0?{withTransform:!0}:null;jg(b,a,c)},lg.groups=function(a){return c(a)?th:(th=a,Pf(),th)},lg.xgrids=function(a){return a?(Ti=a,Pf(),Ti):Ti},lg.xgrids.add=function(a){return a?lg.xgrids(Ti.concat(a)):void 0},lg.xgrids.remove=function(a){ig(a,!0)},lg.ygrids=function(a){return a?(Vi=a,Pf(),Vi):Vi},lg.ygrids.add=function(a){return a?lg.ygrids(Vi.concat(a)):void 0},lg.ygrids.remove=function(a){ig(a,!1)},lg.regions=function(a){return a?(Aj=a,Pf(),Aj):Aj},lg.regions.add=function(a){return a?(Aj=Aj.concat(a),Pf(),Aj):Aj},lg.regions.remove=function(a){var b,c,d;return a=a||{},b=Ye(a,"duration",Dg),c=Ye(a,"classes",[g.region]),d=Ak.select("."+g.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),Aj=Aj.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0})},lg.data.get=function(a){var b=lg.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},lg.data.getAsTarget=function(a){var b=lg.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},lg.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){rh[b]=a[b]}),Pf({withLegend:!0}),rh):rh},lg.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Bh[b]=a[b]}),Pf({withLegend:!0}),Bh):Bh},lg.category=function(a,b){return arguments.length>1&&(hi[a]=b,Pf()),hi[a]},lg.categories=function(a){return arguments.length?(hi=a,Pf(),hi):hi},lg.color=Zj,lg.x=function(a){return arguments.length&&(Ac(lg.data.targets,a),Pf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),lg.data.xs},lg.xs=function(a){return arguments.length&&(Bc(lg.data.targets,a),Pf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),lg.data.xs},lg.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){hb(b,a[b])}),Jb())},lg.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(ri=a.x),b(a.y)&&(yi=a.y),b(a.y2)&&(Ii=a.y2)):yi=Ii=a,Pf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},lg.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(si=a.x),b(a.y)&&(zi=a.y),b(a.y2)&&(Ji=a.y2)):zi=Ji=a,Pf({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},lg.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&lg.axis.max(a.max),"undefined"!=typeof a.min&&lg.axis.min(a.min))},lg.legend.show=function(a){cg(Qc(a)),Vf({withLegend:!0})},lg.legend.hide=function(a){dg(Qc(a)),Vf({withLegend:!0})},lg.resize=function(a){og=a?a.width:null,pg=a?a.height:null,lg.flush()},lg.flush=function(){Vf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},lg.destroy=function(){lg.data.targets=void 0,lg.data.xs={},Ek.classed("c3",!1).html(""),a.onresize=null},f.data.url)Dc(f.data.url,f.data.mimeType,f.data.keys,Hf);else if(f.data.json)Hf(Fc(f.data.json,f.data.keys));else if(f.data.rows)Hf(Gc(f.data.rows));else{if(!f.data.columns)throw Error("url or json or rows or columns is required.");Hf(Hc(f.data.columns))}return lg},"function"==typeof define&&define.amd?define("c3",["d3"],f):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=f:a.c3=f}(window);