!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}var e={version:"0.1.29"},f={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(a,b){var c,d,f,g=e;for(c=0;cxf&&(xf=0),0>zf&&(zf=0),vf={top:Gg?uf.top:Cf-Ag-(li?0:a),right:0/0,bottom:20+(li?0:a),left:Gg?pi:uf.left},yf=Gg?uf.left-pi-qi:xf,Af=Gg?zf:Cf-vf.top-vf.bottom,0>yf&&(yf=0),0>Af&&(Af=0),wf={top:li?0:Cf-a,right:0/0,bottom:0,left:li?Bf-b:0},p(),li&&Td(gf.data.targets)&&(wf.left=xf/2+Ef)}function o(){zi.select("line."+f.xgridFocus).attr("x1",Gg?0:-10).attr("x2",Gg?xf:-10).attr("y1",Gg?-10:uf.top).attr("y2",Gg?-10:zf)}function p(){Ef=zf/2,Df=.95*Ef,Ff=Sd(gf.data.targets)?.6*Df:0}function q(){var a=Gg?f.axisX:f.axisY,b=ff.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=ff.select(jf).node().getBoundingClientRect(),e=c.right-d.left-t();return e>0?e:0}function r(){return kf?kf:x()}function s(){var a=lf?lf:y();return a>0?a:320}function t(){return Td(gf.data.targets)?0:mf?mf:Gg||!Tg||Yg?1:v("y")}function u(){var a=1;return Td(gf.data.targets)?0:nf?nf:li?P()+(ah&&!Gg?v("y2"):a):ah?fh||Gg?a:v("y2"):a}function v(a){var b=gb(a);return b.isInner?20+zb(a):40+zb(a)}function w(a){return"y"!==a||Tg?"y2"!==a||ah?(gb(a).isInner?30:40)+("y2"===a?-10:0):ri:Cg&&!li?10:1}function x(){return+ff.select(jf).style("width").replace("px","")}function y(){return+ff.select(jf).style("height").replace("px","")}function z(a){return a?-5:-(uf.left-1)}function A(a){return a?-20:-1}function B(){return z(!Gg)}function C(){return A(!Gg)}function D(){return z(Gg)}function E(){return A(Gg)}function F(a){return a?xf+2+4:uf.left+20}function G(a){return a?80:zf+2}function H(){return F(!Gg)}function I(){return G(!Gg)}function J(){return F(Gg)}function K(){return G(Gg)}function L(){var a=Gg?zf:xf,b=vc(),c=Vb()*(Pd(gf.data.targets)?(b-(Xh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function M(a){mi=a}function N(a){ni=a}function O(a){oi=a}function P(){return Cg?li?ni*(mi+1):Bf:0}function Q(){return Cg?li?Cf:oi*(mi+1):0}function R(){var a,b=!Sf;Kf=Gg?1:0,Lf=Gg?zf:xf,Mf=Gg?0:zf,Nf=Gg?xf:1,Of=Kf,Pf=Lf,Qf=Gg?0:Af,Rf=Gg?yf:1,Sf=T(Kf,Lf,b?void 0:Sf.domain(),function(){return Yf.tickOffset()}),Tf=U(Mf,Nf),Uf=U(Mf,Nf),Vf=T(Kf,Lf,Ei,function(a){return a%1?0:_f.tickOffset()}),Wf=U(Qf,Rf),Xf=U(Qf,Rf),a=$(),Yf=X(Sf,gi,a),_f=X(Vf,ji,a),Zf=Y(Tf,hi,Zg,_g),$f=Y(Uf,ii,gh,ih),b||(si.scale(Vf),of&&wi.scale(Sf)),S()}function S(){Gf=Db(),Hf=Eb(),If=Eb(.98)}function T(a,b,e,f){var g=(Wh?ff.time.scale():ff.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),Xh){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function U(a,b){return ff.scale.linear().range([a,b])}function V(a){return"y2"===Z(a)?Uf:Tf}function W(a){return"y2"===Z(a)?Xf:Wf}function X(a,b,c){var d=(Xh?Bb():ff.svg.axis()).scale(a).orient(b);return d.tickFormat(c),Xh?d.tickCentered(Jg):d.tickOffset=function(){var a=Gg?zf:xf;return a*Vb()/vc()/2},Xh&&d.categories(Ig),d}function Y(a,b,c,d){return ff.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function Z(a){return a in gg?gg[a]:"y"}function $(){var a=Wh?di:Xh?Oc:function(a){return 0>a?a.toFixed(0):a};return Kg&&("function"==typeof Kg?a=Kg:Wh&&(a=function(a){return ff.time.format(Kg)(a)})),a}function _(a){var b;return"y"===a?b=Xg:"y2"===a?b=eh:"x"===a&&(b=Sg),b}function ab(a){var b=_(a);return"string"==typeof b?b:b?b.text:null}function bb(a,b){var c=_(a);"string"==typeof c?"y"===a?Xg=b:"y2"===a?eh=b:"x"===a&&(Sg=b):c&&(c.text=b)}function cb(a,b){var c=_(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 db(){return cb("x",Gg?"inner-top":"inner-right")}function eb(){return cb("y",Gg?"inner-right":"inner-top")}function fb(){return cb("y2",Gg?"inner-right":"inner-top")}function gb(a){return"y2"===a?fb():"y"===a?eb():db()}function hb(){return ab("x")}function ib(){return ab("y")}function jb(){return ab("y2")}function kb(a,b){return a?b.isLeft?0:b.isCenter?xf/2:xf:b.isBottom?-zf:b.isMiddle?-zf/2:0}function lb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function mb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function nb(){return kb(!Gg,db())}function ob(){return kb(Gg,eb())}function pb(){return kb(Gg,fb())}function qb(){return lb(!Gg,db())}function rb(){return lb(Gg,eb())}function sb(){return lb(Gg,fb())}function tb(){var a=db();return Gg?a.isInner?"1.2em":-30-zb("x"):a.isInner?"-0.5em":"3em"}function ub(){var a=eb();return Gg?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-zb("y")}function vb(){var a=fb();return Gg?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+zb("y2")}function wb(){return mb(!Gg,db())}function xb(){return mb(Gg,eb())}function yb(){return mb(Gg,fb())}function zb(a){var b=0,c="x"===a?f.axisX:"y"===a?f.axisY:f.axisY2;return ff.selectAll("."+c+" .tick text").each(function(){var a=this.getBBox();bb?20:b}function Ab(){zi.select("."+f.axisX+" ."+f.axisXLabel).attr("x",nb).text(hb),zi.select("."+f.axisY+" ."+f.axisYLabel).attr("x",ob).attr("dy",ub).text(ib),zi.select("."+f.axisY2+" ."+f.axisY2Label).attr("x",pb).attr("dy",vb).text(jb)}function Bb(){function a(a,b){a.attr("transform",function(a){return"translate("+(b(a)+p)+", 0)"})}function b(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function c(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function d(a){for(var b=[],c=Math.ceil(a[0]);c0&&b[0]>0&&b.unshift(b[0]-(b[1]-b[0])),b}function e(a,b){var c=a.length-1;return o>=c||b%Math.ceil(c/o)===0}function f(a){return a0)for(g=Mc(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 ff.min(Object.keys(i).map(function(a){return ff.min(i[a])}))}function Tb(a){var b,c,d,e,f,g,h=xc(a),i=Kc(a);if(fg.length>0)for(g=Nc(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 ff.max(Object.keys(i).map(function(a){return ff.max(i[a])}))}function Ub(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return Z(a.id)===c}),m="y2"===c?ch:Vg,n="y2"===c?bh:Ug,o=b(m)?m:Sb(l),p=b(n)?n:Tb(l),q="y2"===c?dh:Wg,r=kd()&⋙return 0===l.length?"y2"===c?Uf.domain():Tf.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=ld(o,p),j=$b(Tf.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]))),"y"===c&&$g&&(f=b($g.top)?$g.top:e,g=b($g.bottom)?$g.bottom:e),"y2"===c&&hh&&(f=b(hh.top)?hh.top:e,g=b(hh.bottom)?hh.bottom:e),Pd(l)&&!Mc(l)&&(g=o),[o-g,p+f])}function Vb(a){var b=$b(Ei),c=$b(Sf.domain());return a||0===c?1:b/c}function Wb(a){return Qg?Qg:ff.min(a,function(a){return ff.min(a.values,function(a){return a.x})})}function Xb(a){return Pg?Pg:ff.max(a,function(a){return ff.max(a.values,function(a){return a.x})})}function Yb(a,b){var c,d,e=b[0],f=b[1],g=Math.abs(e-f);return Xh?d=0:Pd(a)?(c=vc(),d=c>1?g/(c-1)/2:.5):d=.01*g,d}function Zb(a){var b=[Wb(a),Xb(a)],c=b[0],d=b[1],e=Yb(a,b),f=Wh?new Date(c.getTime()-e):c-e,g=Wh?new Date(d.getTime()+e):d+e;return[f,g]}function $b(a){return a[1]-a[0]}function _b(a){for(var b=0;bd?0:d}function ec(a){return ag&&a===ag||ie(bg)&&je(bg,a)}function fc(a){return!ec(a)}function gc(a){return ag?ag:ie(bg)?bg[a]:null}function hc(a,b){var c,d=b&&ie(b)?xc(b):[];return d.forEach(function(b){gc(b)===a&&(c=gf.data.xs[b])}),c}function ic(a,b){return a in gf.data.xs&&gf.data.xs[a]&&gf.data.xs[a][b]?gf.data.xs[a][b]:b}function jc(a){Object.keys(a).forEach(function(b){bg[b]=a[b]})}function kc(a){return 1===ff.set(Object.keys(a).map(function(b){return a[b]})).size()}function lc(a){var b;return a&&(b=eg[a.id],a.name=b?b:a.id),a}function mc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=oc(b[d],a.id,d)}),gf.data.xs[a.id]=b})}function nc(a,b){a.forEach(function(a){b[a.id]&&mc([a],b[a.id])})}function oc(a,b,c){var d;return d=Wh?a?a instanceof Date?a:de(a):de(ic(b,c)):Yh&&!Xh?a?+a:ic(b,c):c}function pc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?gf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):ag?(d=Object.keys(gf.data.xs),gf.data.xs[c]=d.length>0?gf.data.xs[d[0]]:void 0):ie(bg)&&(gf.data.xs[c]=hc(f,gf.data.targets)):gf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!gf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=dg(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=gc(b),g=a[f],h=oc(g,b,e);return Yh&&Xh&&0===c&&g&&(0===e&&(Ig=[]),Ig.push(g)),("undefined"==typeof a[b]||gf.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})}}),c.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++})}),hg&&Nd(xc(c).filter(function(a){return!(a in ig)}),hg),c.forEach(function(a){ac(a.id_org,a)}),c}function sc(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 tc(a){return a>0&&gf.data.targets[0].values[a-1]?gf.data.targets[0].values[a-1].x:void 0}function uc(a){return a1?gf.data.targets.forEach(function(b){b.values.length>c&&(a=b,c=b.values.length)}):a=b?gf.data.targets[0]:null,a}function xc(a){return a.map(function(a){return a.id})}function yc(a){return a?"string"==typeof a?[a]:a:xc(gf.data.targets)}function zc(a,b){var c,d=xc(a);for(c=0;c2){for(e=b-2,c=a[0],d=a[a.length-1],f=(d-c)/(e+1),i=[c],g=0;e>g;g++)h=+c+f*(g+1),i.push(Wh?new Date(h):h);i.push(d)}return i}function Gc(a){ei=ei.concat(a)}function Hc(a){ei=ei.filter(function(b){return a.indexOf(b)<0})}function Ic(a){fi=fi.concat(a)}function Jc(a){fi=fi.filter(function(b){return a.indexOf(b)<0})}function Kc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Lc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Nc(a){return Lc(a,function(a){return a>0})}function Oc(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&&(e=e.concat(td(a,f))),a[g].x&&(e=e.concat(td(a,g))),wd(e,b)):ud(a,b,f,g)}function vd(a,b){var c;return c=a.map(function(a){return ud(a.values,b)}),wd(c,b)}function wd(a,b){var c,d;return a.forEach(function(a){var e=ke(a,b);(c>e||!c)&&(c=e,d=a)}),d}function xd(a,b){return ff.merge(a.map(function(a){return a.values})).filter(function(a){return a.x===b})}function yd(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 zd(){return kg&&"desc"===kg.toLowerCase()}function Ad(){return kg&&"asc"===kg.toLowerCase()}function Bd(a){var b=Ad(),c=zd();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 kg&&a.sort(kg),a}function Cd(a,c){var d,e,f,g,h,i,j,k=Td(gf.data.targets),l=k?nd:md,m=a.filter(function(a){return a&&b(a.value)});Jh&&0!==m.length&&(Ci.html(Mh(a,$(),l,ci)).style("display","block"),d=Ci.property("offsetWidth"),e=Ci.property("offsetHeight"),k?(g=xf/2+c[0],i=zf/2+c[1]+20):(Gg?(f=q(),g=f+c[0]+100,h=g+d,j=r()-u(),i=Sf(m[0].x)+20):(f=q(),g=f+t()+Sf(m[0].x)+20,h=g+d,j=f+r()-u(),i=c[1]+15),h>j&&(g-=d+60),i+e>s()&&(i-=e+30)),Ci.style("top",i+"px").style("left",g+"px"))}function Dd(){Ci.style("display","none")}function Ed(a){var c=a.filter(function(a){return a&&b(a.value)});Jh&&(Qd(gf.data.targets)||Td(gf.data.targets)||zi.selectAll("line."+f.xgridFocus).style("visibility","visible").data([c[0]]).attr(Gg?"y1":"x1",pd).attr(Gg?"y2":"x2",pd))}function Fd(){zi.select("line."+f.xgridFocus).style("visibility","hidden")}function Gd(a){return a.x||0===a.x?Sf(a.x):null}function Hd(a){return V(a.id)(a.value)}function Id(){var a,b,d={},e=0;return Dc(Ac(Wd)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function Md(a,b){return vh?vh:b?2*a.tickOffset()*wh/b:0}function Nd(a,b){yc(a).forEach(function(a){Gi[a]=b===ig[a],ig[a]=b})}function Od(a,b){var c=!1;return a.forEach(function(a){ig[a.id]===b&&(c=!0),a.id in ig||"line"!==b||(c=!0)}),c}function Pd(a){return Od(a,"bar")}function Qd(a){return Od(a,"scatter")}function Rd(a){return Od(a,"pie")}function Sd(a){return Od(a,"donut")}function Td(a){return Rd(a)||Sd(a)}function Ud(a){var b="string"==typeof a?a:a.id;return!(b in ig)||"line"===ig[b]||"spline"===ig[b]||"area"===ig[b]||"area-spline"===ig[b]}function Vd(a){var b="string"==typeof a?a:a.id;return"spline"===ig[b]||"area-spline"===ig[b]}function Wd(a){var b="string"==typeof a?a:a.id;return"bar"===ig[b]}function Xd(a){var b="string"==typeof a?a:a.id;return"scatter"===ig[b]}function Yd(a){var b="string"==typeof a?a:a.id;return"pie"===ig[b]}function Zd(a){var b="string"==typeof a?a:a.id;return"donut"===ig[b]}function $d(a){return Yd(a)||Zd(a)}function _d(a){return Wd(a)?a.values:[]}function ae(a){return Ud(a)||Xd(a)?a.values:[]}function be(a){return Wd(a)||Ud(a)?a.values:[]}function ce(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):g in a?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function de(b){var c;if(!b)throw Error(b+" can not be parsed as d3.time with format "+cg+". Maybe 'x' of this data is not defined. See data.x or data.xs option.");try{c=cg?ff.time.format(cg).parse(b):new Date(b)}catch(d){c=void 0}return c||a.console.error("Failed to parse x '"+b+"' to Date with format "+cg),c}function ee(a,b){var c=ff.mouse(a),d=ff.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function je(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function ke(a,b){var c="y"===Z(a.id)?Tf:Uf,d=Gg?1:0,e=Gg?0:1;return Math.pow(Sf(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function le(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function me(a,b,c){vg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Pc(f.selectedCircle,c)}).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd).attr("stroke",function(){return ci(b)}).attr("r",1.4*uh).transition().duration(100).attr("r",uh)}function ne(a,b,c){wg(b,a.node()),zi.select("."+f.selectedCircles+bd(b.id)).selectAll("."+f.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function oe(a,b,c,d){a?me(b,c,d):ne(b,c,d)}function pe(a,b){vg(b,a.node()),a.transition().duration(100).style("fill",function(){return ff.rgb(ci(b)).darker(1)})}function qe(a,b){wg(b,a.node()),a.transition().duration(100).style("fill",function(){return ci(b)})}function re(a,b,c,d){a?pe(b,c,d):qe(b,c,d)}function se(a){return a.filter(function(a){return b(a.value)})}function te(a,c){return(c?zi.selectAll("."+f.circles+bd(c)):zi).selectAll("."+f.circle+(b(a)?"-"+a:""))}function ue(a,b){te(a,b).classed(f.EXPANDED,!0).attr("r",th)}function ve(a){te(a).filter(function(){return ff.select(this).classed(f.EXPANDED)}).classed(f.EXPANDED,!1).attr("r",qh)}function we(a){return zi.selectAll("."+f.bar+(b(a)?"-"+a:""))}function xe(a){we(a).classed(f.EXPANDED,!0)}function ye(a){we(a).classed(f.EXPANDED,!1)}function ze(a,b){var c=De(a,b);return function(a,b){var d=c(a,b),e=Gg?1:0,f=Gg?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 Ae(a,b){var c=De(a,!1),d=b?Be:Ce;return function(a,b){return d(c(a,b),a,this)}}function Be(a,b){var c;return Gg?(c=Wd(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function Ce(a,b,c){var d=c.getBBox();return Gg?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:Wd(b)?-3:-6)}function De(a,b){var c=a.__max__+1,d=Md(Yf,c),e=Jd(d,c,a,!!b),f=Kd(!!b),g=Ld(a,!!b),h=b?W:V;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Gg&&(a.value>0&&i>k||a.value<0&&k>i)&&(k=i),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function Ee(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=-1,s="M",t=[];if(d(f))for(g=0;g=h;h+=u)s+=i(a[g-1],a[g],h,o)}r=a[g].x}return s}function Fe(b){var c,d,e;if(Di=ff.select(jf),Di.empty())throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Di.html(""),Di.classed("c3",!0),gf.data.xs={},gf.data.targets=rc(b),n(),R(),Sf.domain(ff.extent(Zb(gf.data.targets))),Tf.domain(Ub(gf.data.targets,"y")),Uf.domain(Ub(gf.data.targets,"y2")),Vf.domain(Sf.domain()),Wf.domain(Tf.domain()),Xf.domain(Uf.domain()),Ei=Sf.domain(),si.scale(Vf),of&&wi.scale(Sf),xi=Di.append("svg").attr("width",xf+uf.left+uf.right).attr("height",zf+uf.top+uf.bottom).on("mouseenter",rf).on("mouseleave",sf),yi=xi.append("defs"),yi.append("clipPath").attr("id",Qh).append("rect").attr("width",xf).attr("height",zf),yi.append("clipPath").attr("id",Rh).append("rect").attr("x",B).attr("y",C).attr("width",H).attr("height",I),yi.append("clipPath").attr("id",Sh).append("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),zi=xi.append("g").attr("transform",ki.main),Ai=zg?xi.append("g").attr("transform",ki.context):null,Bi=xi.append("g").attr("transform",ki.legend),Cg||(Bi.style("visibility","hidden"),fi=xc(gf.data.targets)),Ci=ff.select(jf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),af(xc(gf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),zi.append("g").attr("class",f.axisX).attr("clip-path",Gg?"":Uh).attr("transform",ki.x).append("text").attr("class",f.axisXLabel).attr("transform",Gg?"rotate(-90)":"").attr("dx",qb).attr("dy",tb).style("text-anchor",wb),Tg&&zi.append("g").attr("class",f.axisY).attr("clip-path",Gg?Vh:"").attr("transform",ki.y).append("text").attr("class",f.axisYLabel).attr("transform",Gg?"":"rotate(-90)").attr("dx",rb).attr("dy",ub).style("text-anchor",xb),ah&&zi.append("g").attr("class",f.axisY2).attr("transform",ki.y2).append("text").attr("class",f.axisY2Label).attr("transform",Gg?"":"rotate(-90)").attr("dx",sb).style("text-anchor",yb),d=zi.append("g").attr("clip-path",Th).attr("class",f.grid),jh&&d.append("g").attr("class",f.xgrids),ie(lh)&&d.append("g").attr("class",f.xgridLines),rh&&d.append("g").attr("class",f.xgridFocus).append("line").attr("class",f.xgridFocus),mh&&d.append("g").attr("class",f.ygrids),ie(nh)&&d.append("g").attr("class",f.ygridLines),zi.append("g").attr("clip-path",Th).attr("class",f.regions),zi.append("g").attr("clip-path",Th).attr("class",f.chart),c=zi.select("."+f.chart).append("g").attr("class",f.eventRects).style("fill-opacity",0).style("cursor",of?Gg?"ns-resize":"ew-resize":null),zi.select("."+f.chart).append("g").attr("class",f.chartBars),zi.select("."+f.chart).append("g").attr("class",f.chartLines),zi.select("."+f.chart).append("g").attr("class",f.chartArcs).attr("transform",ki.arc).append("text").attr("class",f.chartArcsTitle).style("text-anchor","middle").text(Ob()),zi.select("."+f.chart).append("g").attr("class",f.chartTexts),of&&zi.insert("rect",qf?null:"g."+f.grid).attr("class",f.zoomRect).attr("width",xf).attr("height",zf).style("opacity",0).style("cursor",Gg?"ns-resize":"ew-resize").call(wi).on("dblclick.zoom",null),Rg&&si.extent("function"!=typeof Rg?Rg:Rg(Zb())),zg&&(Ai.append("g").attr("clip-path",Th).attr("class",f.chart),Ai.select("."+f.chart).append("g").attr("class",f.chartBars),Ai.select("."+f.chart).append("g").attr("class",f.chartLines),Ai.append("g").attr("clip-path",Th).attr("class",f.brush).call(si).selectAll("rect").attr(Gg?"width":"height",Gg?yf:Af),Ai.append("g").attr("class",f.axisX).attr("transform",ki.subx).attr("clip-path",Gg?"":Uh)),Se(gf.data.targets),Gg?zi.select("."+f.axisX).style("opacity",0).call(Yf):(zi.select("."+f.axisY).style("opacity",0).call(Zf),zi.select("."+f.axisY2).style("opacity",0).call($f)),Me({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Nh){if(Wh&&"string"==typeof Oh){for(Oh=de(Oh),e=0;e0){d=[];for(var g in eg)for(c=0;cg&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=yd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=re,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function Ke(a){Td(gf.data.targets)||og&&(Zh=a,zi.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),$h=!0,xg())}function Le(){Td(gf.data.targets)||og&&(zi.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),zi.selectAll("."+f.shape).classed(f.INCLUDED,!1),$h=!1,yg())}function Me(a){var c,e,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T=Id(),U=Td(gf.data.targets),V=Dc(gf.data.targets);if(0!==V.length){if(a=d(a)?a:{},y=d(a.withY)?a.withY:!0,z=d(a.withSubchart)?a.withSubchart:!0,A=d(a.withTransition)?a.withTransition:!0,E=d(a.withTransform)?a.withTransform:!1,F=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,G=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,H=d(a.withLegend)?a.withLegend:!1,B=d(a.withTransitionForExit)?a.withTransitionForExit:A,C=d(a.withTransitionForAxis)?a.withTransitionForAxis:A,D=d(a.withTransitionForHorizontalAxis)?a.withTransitionForHorizontalAxis:A,N=A?tf:0,O=B?N:0,P=C?N:0,H&&Cg&&af(xc(gf.data.targets),a),G&&(Sf.domain(ff.extent(Zb(V))),Ei=Sf.domain(),of&&wi.scale(Sf).updateScaleExtent(),Vf.domain(Sf.domain()),si.scale(Vf)),F&&(Sf.domain(si.empty()?Ei:si.extent()),of&&wi.scale(Sf).updateScaleExtent()),Tf.domain(Ub(V,"y")),Uf.domain(Ub(V,"y2")),Qd(V)||(Q=Fc(Ec(V)).sort(),Yf.tickValues(Q),_f.tickValues(Q)),c=zi.select("."+f.axisX).style("opacity",U?0:1),(Gg||D)&&(c=c.transition().duration(P)),c.call(Yf),e=zi.select("."+f.axisY).style("opacity",U?0:1),(!Gg||D)&&(e=e.transition().duration(P)),e.call(Zf),zi.select("."+f.axisY2).style("opacity",U?0:1).transition().duration(P).call($f),F&&Lg&&Q){for(R=1;R=Z;Z++)h.push(new Date(Z+"-01-01 00:00:00"))}else h=Sf.ticks(10);g=zi.select("."+f.xgrids).selectAll("."+f.xgrid).data(h),g.enter().append("line").attr("class",f.xgrid),g.attr("x1",Gg?0:function(a){return Sf(a)-Yf.tickOffset()}).attr("x2",Gg?xf:function(a){return Sf(a)-Yf.tickOffset()}).attr("y1",Gg?function(a){return Sf(a)-Yf.tickOffset()}:uf.top).attr("y2",Gg?function(a){return Sf(a)-Yf.tickOffset()}:zf).style("opacity",function(){return+ff.select(this).attr(Gg?"y1":"x1")===(Gg?zf:0)?0:1}),g.exit().remove()}ie(lh)&&(i=zi.select("."+f.xgridLines).selectAll("."+f.xgridLine).data(lh),j=i.enter().append("g").attr("class",function(a){return f.xgridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",Gg?"":"rotate(-90)").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(N).attr("x1",Gg?0:qd).attr("x2",Gg?xf:qd).attr("y1",Gg?qd:uf.top).attr("y2",Gg?qd:zf).style("opacity",1),i.select("text").transition().duration(N).attr("x",Gg?xf:0).attr("y",qd).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(N).style("opacity",0).remove()),y&&mh&&(k=zi.select("."+f.ygrids).selectAll("."+f.ygrid).data(Tf.ticks(oh)),k.enter().append("line").attr("class",f.ygrid),k.attr("x1",Gg?Tf:0).attr("x2",Gg?Tf:xf).attr("y1",Gg?0:Tf).attr("y2",Gg?zf:Tf),k.exit().remove()),y&&ie(nh)&&(l=zi.select("."+f.ygridLines).selectAll("."+f.ygridLine).data(nh),m=l.enter().append("g").attr("class",function(a){return f.ygridLine+(a.class?a.class:"")}),m.append("line").style("opacity",0),m.append("text").attr("text-anchor","end").attr("transform",Gg?"rotate(-90)":"").attr("dx",Gg?0:-uf.top).attr("dy",-5).style("opacity",0),l.select("line").transition().duration(N).attr("x1",Gg?rd:0).attr("x2",Gg?rd:xf).attr("y1",Gg?0:rd).attr("y2",Gg?zf:rd).style("opacity",1),l.select("text").transition().duration(N).attr("x",Gg?0:xf).attr("y",rd).text(function(a){return a.text}).style("opacity",1),l.exit().transition().duration(N).style("opacity",0).remove()),p=zi.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),p.enter().append("path").attr("d",I).style("stroke","none").style("opacity",0).style("fill",function(a){return ci(a)}).attr("class",Xc),p.style("opacity",gd).transition().duration(N).attr("d",I).style("opacity",1),p.exit().transition().duration(O).style("opacity",0).remove(),r=zi.selectAll("."+f.texts).selectAll("."+f.text).data(be),r.enter().append("text").attr("class",Qc).attr("text-anchor",function(a){return Gg?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill-opacity",0),r.text(function(a){return od(a.id)(a.value)}).style("fill-opacity",hd).transition().duration(N).attr("x",K).attr("y",M).style("fill-opacity",jd),r.exit().transition().duration(O).style("fill-opacity",0).remove(),zi.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",ti).style("opacity",1),zi.selectAll("."+f.area).style("opacity",0).transition().duration(N).attr("d",ui).style("opacity",Fi),n=zi.selectAll("."+f.circles).selectAll("."+f.circle).data(ae),n.enter().append("circle").attr("class",Vc).style("opacity",0).attr("r",qh),n.style("opacity",gd).transition().duration(N).style("opacity",id).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),n.exit().remove(),zi.selectAll("."+f.chartArc).select("."+f.arc).attr("transform",E?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).transition().duration(N).attrTween("d",function(a){var b,c=Cb(a);return c?(b=ff.interpolate(this._current,c),this._current=b(0),function(a){return Fb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",E?"scale(1)":"").style("opacity",1),zi.selectAll("."+f.chartArc).select("text").attr("transform",Gb).style("opacity",0).transition().duration(N).text(Jb).style("opacity",function(a){return Bc(a.data.id)&&$d(a.data)?1:0}),zi.select("."+f.chartArcsTitle).style("opacity",Sd(gf.data.targets)?1:0),zg&&(null!==ff.event&&"zoom"===ff.event.type&&si.extent(Sf.orgDomain()).update(),z&&(Ai.select("."+f.axisX).style("opacity",U?0:1).transition().duration(N).call(_f),si.empty()||si.extent(Sf.orgDomain()).update(),J=ze(T,!0),s=Ai.selectAll("."+f.bars).selectAll("."+f.bar).data(_d),s.enter().append("path").attr("d",J).style("stroke","none").style("fill",function(a){return ci(a)}).attr("class",Xc),s.style("opacity",gd).transition().duration(N).attr("d",J).style("opacity",1),s.exit().transition().duration(N).style("opacity",0).remove(),Ai.selectAll("."+f.line).style("opacity",gd).transition().duration(N).attr("d",vi).style("opacity",1))),zi.selectAll("."+f.selectedCircles).filter(function(a){return Wd(a)}).selectAll("circle").remove(),zi.selectAll("."+f.selectedCircle).transition().duration(N).attr("cx",Gg?Hd:Gd).attr("cy",Gg?Gd:Hd),t=zi.select("."+f.eventRects),ie(bg)&&!kc(bg)?(t.classed(f.eventRectsMultiple)||t.classed(f.eventRectsMultiple,!0).classed(f.eventRectsSingle,!1).selectAll("."+f.eventRect).remove(),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data([0]),He(u.enter()),u.attr("x",0).attr("y",0).attr("width",xf).attr("height",zf)):(t.classed(f.eventRectsSingle)||t.classed(f.eventRectsMultiple,!1).classed(f.eventRectsSingle,!0).selectAll("."+f.eventRect).remove(),Yh&&!Xh?(x=function(a,b){var c=tc(b),d=uc(b),e=gf.data.xs[a.id][b];return(Sf(d?d:e+50)-Sf(c?c:e-50))/2},w=function(a,b){var c=tc(b),d=gf.data.xs[a.id][b];return(Sf(d)+Sf(c?c:d-50))/2}):(x=L(),w=function(a){return Sf(a.x)-x/2}),v=wc(),zi.select("."+f.eventRects).datum(v?v.values:[]),u=zi.select("."+f.eventRects).selectAll("."+f.eventRect).data(function(a){return a}),Ge(u.enter()),u.attr("class",ad).attr("x",Gg?0:w).attr("y",Gg?w:0).attr("width",Gg?xf:x).attr("height",Gg?x:zf),u.exit().remove()),q=zi.select("."+f.regions).selectAll("rect."+f.region).data(Ih),q.enter().append("rect").style("fill-opacity",0),q.attr("class",_c).attr("x",Gg?0:cc).attr("y",Gg?cc:uf.top).attr("width",Gg?xf:dc).attr("height",Gg?dc:zf).transition().duration(N).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),q.exit().transition().duration(N).style("fill-opacity",0).remove(),xc(gf.data.targets).forEach(function(a){Gi[a]=!0})}}function Ne(){Me({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function Oe(){return"mousemove"===ff.event.sourceEvent.type&&wi.altDomain?(Sf.domain(wi.altDomain),void wi.scale(Sf).updateScaleExtent()):(Xh&&Sf.orgDomain()[0]===Ei[0]&&Sf.domain([Ei[0]-1e-10,Sf.orgDomain()[1]]),Me({withTransition:!1,withY:!1,withSubchart:!1}),void("mousemove"===ff.event.sourceEvent.type&&(_h=!0)))}function Pe(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function Qe(){xi.attr("width",Bf).attr("height",Cf),xi.select("#"+Qh).select("rect").attr("width",xf).attr("height",zf),xi.select("#"+Rh).select("rect").attr("width",H),xi.select("#"+Sh).select("rect").attr("width",J),xi.select("."+f.zoomRect).attr("width",xf).attr("height",zf)}function Re(a){a=a||{},a.withTransition=d(a.withTransition)?a.withTransition:!0,a.withTransform=d(a.withTransform)?a.withTransform:!1,a.withLegend=d(a.withLegend)?a.withLegend:!1,a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,n(),R(),Qe(),m(a.withTransition),Me(a)}function Se(a){var b,c,d,e,g,h,i,j,k,l,m,n;i=zi.select("."+f.chartTexts).selectAll("."+f.chartText).data(a),j=i.enter().append("g").attr("class",function(a){return f.chartText+Pc(f.target,a.id)}).style("pointer-events","none"),j.append("g").attr("class",Rc).style("fill",function(a){return ci(a)}),e=zi.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),d=e.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}).style("pointer-events","none"),d.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}).style("stroke","none").style("cursor",function(a){return qg(a)?"pointer":null}),c=zi.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),b=c.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}).style("pointer-events","none"),b.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)}),b.append("path").attr("class",$c).style("opacity",function(){return Fi=+ff.select(this).style("opacity"),0}).style("fill",function(a){return ci(a)}),b.append("g").attr("class",function(a){return Pc(f.selectedCircles,a.id)}),b.append("g").attr("class",Wc).style("fill",function(a){return ci(a)}).style("cursor",function(a){return qg(a)?"pointer":null}),a.forEach(function(a){zi.selectAll("."+f.selectedCircles+bd(a.id)).selectAll("."+f.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=zi.select("."+f.chartArcs).selectAll("."+f.chartArc).data(Jf(a)),g=h.enter().append("g").attr("class",function(a){return f.chartArc+Pc(f.target,a.data.id)}),g.append("path").attr("class",Zc).style("opacity",0).style("fill",function(a){return ci(a.data)}).style("cursor",function(a){return qg(a)?"pointer":null}).each(function(a){this._current=a}).on("mouseover",function(a,b){var c=Cb(a),d=Ib(c),e=Qb();Kb(c.data.id),Xe(c.data.id),e(d,b)}).on("mousemove",function(a){var b=Cb(a),c=[Ib(b)];Cd(c,ff.mouse(this))}).on("mouseout",function(a,b){var c=Cb(a),d=Ib(c),e=Rb();Lb(c.data.id),Ze(),Dd(),e(d,b)}).on("click",function(a,b){var c=Cb(a),d=Ib(c),e=Pb();e(d,b)}),g.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),zg&&(n=Ai.select("."+f.chartBars).selectAll("."+f.chartBar).data(a),m=n.enter().append("g").attr("class",function(a){return f.chartBar+Pc(f.target,a.id)}),m.append("g").attr("class",Yc).style("fill",function(a){return ci(a)}),l=Ai.select("."+f.chartLines).selectAll("."+f.chartLine).data(a),k=l.enter().append("g").attr("class",function(a){return f.chartLine+Pc(f.target,a.id)}),k.append("path").attr("class",Uc).style("opacity",0).style("stroke",function(a){return ci(a)})),xi.selectAll("."+f.target).filter(function(a){return Bc(a.id)}).transition().style("opacity",1)}function Te(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?Nd(a.id,b.types[a.id]):Nd(a.id,b.type)}),gf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,w=0,C++)),B[a]=C,A[C]=f,x[a]=w,w+=k}var f,g,h=b.getBBox(),i=10*Math.ceil((h.width+s)/10),j=10*Math.ceil((h.height+r)/10),k=li?j:i,l=li?Q():P();return d&&(w=0,C=0,t=0,u=0),Cg&&!Cc(c)?void(y[c]=z[c]=B[c]=x[c]=0):(y[c]=i,z[c]=j,(!t||i>=t)&&(t=i),(!u||j>=u)&&(u=j),g=li?u:t,void(Fg?(Object.keys(y).forEach(function(a){y[a]=t}),Object.keys(z).forEach(function(a){z[a]=u}),f=(l-g*a.length)/2,v>f?(w=0,C=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,g,h,i,j,k,l,o,p,q,r=4,s=26,t=0,u=0,v=10,w=0,x={},y={},z={},A=[0],B={},C=0;b=b||{},o=d(b.withTransition)?b.withTransition:!0,p=d(b.withTransitionForTransform)?b.withTransitionForTransform:!0,q=d(b.withTransformAll)?b.withTransformAll:!0,li?(e=function(a){return t*(.2+B[a])},i=function(a){return A[B[a]]+x[a]}):(e=function(a){return A[B[a]]+x[a]},i=function(a){return u*(.2+B[a])}),g=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},h=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=Bi.selectAll("."+f.legendItem).data(a).enter().append("g").attr("class",function(a){return Pc(f.legendItem,a)}).style("visibility",function(a){return Cc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof Eg?Eg(a):gf.toggle(a)}).on("mouseover",function(a){gf.focus(a)}).on("mouseout",function(){gf.revert()}),l.append("text").text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).style("pointer-events","none").attr("x",li?g:-200).attr("y",li?-200:j),l.append("rect").attr("class",f.legendItemEvent).style("fill-opacity",0).attr("x",li?h:-200).attr("y",li?-200:k).attr("width",function(a){return y[a]}).attr("height",function(a){return z[a]}),l.append("rect").attr("class",f.legendItemTile).style("pointer-events","none").style("fill",function(a){return ci(a)}).attr("x",li?g:-200).attr("y",li?-200:i).attr("width",10).attr("height",10),Bi.selectAll("text").data(a).text(function(a){return d(eg[a])?eg[a]:a}).each(function(a,b){c(this,a,0===b)}).transition().duration(o?250:0).attr("x",g).attr("y",j),Bi.selectAll("rect."+f.legendItemEvent).data(a).transition().duration(o?250:0).attr("x",h).attr("y",k),Bi.selectAll("rect."+f.legendItemTile).data(a).transition().duration(o?250:0).attr("x",e).attr("y",i),N(t),O(u),M(C),n(),R(),Qe(),q&&m(p)}function bf(a){return zc(gf.data.targets,a.id)}function cf(a){return"data"in a&&zc(gf.data.targets,a.data.id)}function df(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function ef(a,b,c){var d=!Td(gf.data.targets);Nd(a,b),Re(c?c:{withTransitionForAxis:d})}var ff=a.d3?a.d3:a.require?a.require("d3"):void 0,gf={data:{},axis:{},legend:{}},hf={},jf=h(["bindto"],"#chart"),kf=h(["size","width"]),lf=h(["size","height"]),mf=h(["padding","left"]),nf=h(["padding","right"]),of=h(["zoom","enabled"],!1),pf=h(["zoom","extent"]),qf=h(["zoom","privileged"],!1),rf=h(["onenter"],function(){}),sf=h(["onleave"],function(){}),tf=h(["transition","duration"],350);g("data","data is required in config");var uf,vf,wf,xf,yf,zf,Af,Bf,Cf,Df,Ef,Ff,Gf,Hf,If,Jf,Kf,Lf,Mf,Nf,Of,Pf,Qf,Rf,Sf,Tf,Uf,Vf,Wf,Xf,Yf,Zf,$f,_f,ag=h(["data","x"]),bg=h(["data","xs"],{}),cg=h(["data","x_format"]),dg=h(["data","id_converter"],function(a){return a}),eg=h(["data","names"],{}),fg=h(["data","groups"],[]),gg=h(["data","axes"],{}),hg=h(["data","type"]),ig=h(["data","types"],{}),jg=h(["data","labels"],{}),kg=h(["data","order"]),lg=h(["data","regions"],{}),mg=h(["data","color"]),ng=h(["data","colors"],{}),og=h(["data","selection","enabled"],!1),pg=h(["data","selection","grouped"],!1),qg=h(["data","selection","isselectable"],function(){return!0}),rg=h(["data","selection","multiple"],!0),sg=h(["data","onclick"],function(){}),tg=h(["data","onenter"],function(){}),ug=h(["data","onleave"],function(){}),vg=h(["data","onselected"],function(){}),wg=h(["data","onunselected"],function(){}),xg=h(["data","ondragstart"],function(){}),yg=h(["data","ondragend"],function(){}),zg=h(["subchart","show"],!1),Ag=zg?h(["subchart","size","height"],60):0,Bg=h(["color","pattern"],[]),Cg=h(["legend","show"],!0),Dg=h(["legend","position"],"bottom"),Eg=h(["legend","item","onclick"]),Fg=h(["legend","equally"],!1),Gg=h(["axis","rotated"],!1),Hg=h(["axis","x","type"],"indexed"),Ig=h(["axis","x","categories"],[]),Jg=h(["axis","x","tick","centered"],!1),Kg=h(["axis","x","tick","format"]),Lg=h(["axis","x","tick","culling"],{}),Mg=h(["axis","x","tick","culling","max"],"categorized"===Hg?1/0:10),Ng=h(["axis","x","tick","count"]),Og=h(["axis","x","tick","fit"],!1),Pg=h(["axis","x","max"]),Qg=h(["axis","x","min"]),Rg=h(["axis","x","default"]),Sg=h(["axis","x","label"],{}),Tg=h(["axis","y","show"],!0),Ug=h(["axis","y","max"]),Vg=h(["axis","y","min"]),Wg=h(["axis","y","center"]),Xg=h(["axis","y","label"],{}),Yg=h(["axis","y","inner"],!1),Zg=h(["axis","y","tick","format"]),$g=h(["axis","y","padding"],{}),_g=h(["axis","y","ticks"],10),ah=h(["axis","y2","show"],!1),bh=h(["axis","y2","max"]),ch=h(["axis","y2","min"]),dh=h(["axis","y2","center"]),eh=h(["axis","y2","label"],{}),fh=h(["axis","y2","inner"],!1),gh=h(["axis","y2","tick","format"]),hh=h(["axis","y2","padding"],{}),ih=h(["axis","y2","ticks"],10),jh=h(["grid","x","show"],!1),kh=h(["grid","x","type"],"tick"),lh=h(["grid","x","lines"],[]),mh=h(["grid","y","show"],!1),nh=h(["grid","y","lines"],[]),oh=h(["grid","y","ticks"],10),ph=h(["point","show"],!0),qh=ph?h(["point","r"],2.5):0,rh=h(["point","focus","line","enabled"],!0),sh=h(["point","focus","expand","enabled"],!0),th=h(["point","focus","expand","r"],sh?4:qh),uh=h(["point","focus","select","r"],8),vh=h(["bar","width"]),wh=h(["bar","width","ratio"],.6),xh=h(["pie","label","show"],!0),yh=h(["pie","label","format"]),zh=h(["pie","onclick"],function(){}),Ah=h(["pie","onmouseover"],function(){}),Bh=h(["pie","onmouseout"],function(){}),Ch=h(["donut","label","show"],!0),Dh=h(["donut","label","format"]),Eh=h(["donut","title"],""),Fh=h(["donut","onclick"],function(){}),Gh=h(["donut","onmouseover"],function(){}),Hh=h(["donut","onmouseout"],function(){}),Ih=h(["regions"],[]),Jh=h(["tooltip","show"],!0),Kh=h(["tooltip","format","title"]),Lh=h(["tooltip","format","value"]),Mh=h(["tooltip","contents"],function(a,b,c,d){var e,g,h,i,j,k=Kh?Kh:b,l=Lh?Lh:c;for(g=0;g"+(h||0===h?""+h+"":"")),j=a[g].name,i=l(a[g].value,a[g].ratio),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Nh=h(["tooltip","init","show"],!1),Oh=h(["tooltip","init","x"],0),Ph=h(["tooltip","init","position"],{top:"0px",left:"50px"}),Qh=("string"==typeof jf?jf.replace("#",""):jf.id)+"-clip",Rh=Qh+"-xaxis",Sh=Qh+"-yaxis",Th=i(Qh),Uh=i(Uh),Vh=i(Vh),Wh="timeseries"===Hg,Xh="categorized"===Hg,Yh=!Wh&&(ag||ie(bg)),Zh=null,$h=!1,_h=!1,ai=!1,bi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ci=ce(ng,ie(Bg)?Bg:bi,mg),di=function(){var a=[[ff.time.format("%Y/%-m/%-d"),function(){return!0}],[ff.time.format("%-m/%-d"),function(a){return a.getMonth()}],[ff.time.format("%-m/%-d"),function(a){return 1!==a.getDate()}],[ff.time.format("%-m/%-d"),function(a){return a.getDay()&&1!==a.getDate()}],[ff.time.format("%I %p"),function(a){return a.getHours()}],[ff.time.format("%I:%M"),function(a){return a.getMinutes()}],[ff.time.format(":%S"),function(a){return a.getSeconds()}],[ff.time.format(".%L"),function(a){return a.getMilliseconds()}]];return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}(),ei=[],fi=[],gi=Gg?"left":"bottom",hi=Gg?Yg?"top":"bottom":Yg?"right":"left",ii=Gg?fh?"bottom":"top":fh?"left":"right",ji=Gg?"left":"bottom",ki={main:function(){return"translate("+uf.left+","+uf.top+")"},context:function(){return"translate("+vf.left+","+vf.top+")"},legend:function(){return"translate("+wf.left+","+wf.top+")"},x:function(){return"translate(0,"+(Gg?0:zf)+")"},y:function(){return"translate(0,"+(Gg?zf:0)+")"},y2:function(){return"translate("+(Gg?0:xf)+","+(Gg?1:0)+")"},subx:function(){return"translate(0,"+(Gg?0:Af)+")"},arc:function(){return"translate("+xf/2+","+zf/2+")"}},li="right"===Dg,mi=0,ni=0,oi=0,pi=30,qi=30,ri=5;Jf=ff.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var si,ti=function(){var a=ff.svg.line().x(Gg?function(a){return V(a.id)(a.value)}:pd).y(Gg?pd:function(a){return V(a.id)(a.value)});return function(b){var c,d,e=se(b.values);return Ud(b)?(a.interpolate(Vd(b)?"cardinal":"linear"),lg[b.id]?Ee(e,Sf,V(b.id),lg[b.id]):a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),ui=function(){var a;return a=Gg?ff.svg.area().x0(function(a){return V(a.id)(0)}).x1(function(a){return V(a.id)(a.value)}).y(pd):ff.svg.area().x(pd).y0(function(a){return V(a.id)(0)}).y1(function(a){return V(a.id)(a.value)}),function(b){var c,d,e=se(b.values);return Od([b],"area")||Od([b],"area-spline")?(a.interpolate(Vd(b)?"cardinal":"linear"),a(e)):(c=Sf(e[0].x),d=V(b.id)(e[0].value),Gg?"M "+d+" "+c:"M "+c+" "+d)}}(),vi=function(){var a=ff.svg.line().x(Gg?function(a){return W(a.id)(a.value)}:sd).y(Gg?sd:function(a){return W(a.id)(a.value)});return function(b){var c=se(b.values);return Ud(b)?a(c):"M "+Vf(c[0].x)+" "+W(b.id)(c[0].value)}}(),wi=function(){};si=ff.svg.brush().on("brush",Ne),si.update=function(){return Ai&&Ai.select("."+f.brush).call(this),this},si.scale=function(a){return Gg?this.y(a):this.x(a)},of&&(wi=ff.behavior.zoom().on("zoomstart",function(){wi.altDomain=ff.event.sourceEvent.altKey?Sf.orgDomain():null}).on("zoom",of?Oe:null),wi.scale=function(a){return Gg?this.y(a):this.x(a)},wi.orgScaleExtent=function(){var a=pf?pf:[1,10];return[a[0],Math.max(vc()/a[1],a[1])]},wi.updateScaleExtent=function(){var a=$b(Sf.orgDomain())/$b(Ei),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var xi,yi,zi,Ai,Bi,Ci,Di,Ei,Fi,Gi={};if(gf.focus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),gf.defocus(),b(d.classed(f.focused,!0)),b(e),Td(gf.data.targets)&&Kb(a,!0),Xe(a)},gf.defocus=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",.3)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);gf.revert(),b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ye(a)},gf.revert=function(a){function b(a){Dc(a).transition().duration(100).style("opacity",1)}var c=xi.selectAll(cd(a)),d=c.filter(bf),e=c.filter(cf);b(d.classed(f.focused,!1)),b(e),Td(gf.data.targets)&&Lb(a),Ze()},gf.show=function(a,b){a=yc(a),b=b||{},Hc(a),xi.selectAll(dd(a)).transition().style("opacity",1),b.withLegend&&$e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.hide=function(a,b){a=yc(a),b=b||{},Gc(a),xi.selectAll(dd(a)).transition().style("opacity",0),b.withLegend&&_e(a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withTransitionForHorizontalAxis:!1})},gf.toggle=function(a){Bc(a)?gf.hide(a):gf.show(a)},gf.unzoom=function(){si.clear().update(),Me({withUpdateXDomain:!0})},gf.load=function(a){return a.xs&&jc(a.xs),"categories"in a&&Xh&&(Ig=a.categories,Yf.categories(Ig)),"cacheIds"in a&&_b(a.cacheIds)?void Te(bc(a.cacheIds),a.done):void("unload"in a?Ve(yc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){Ue(a)}):Ue(a))},gf.unload=function(a){Ve(yc(a),function(){Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})})},gf.selected=function(a){return ff.merge(zi.selectAll("."+f.shapes+bd(a)).selectAll("."+f.shape).filter(function(){return ff.select(this).classed(f.SELECTED)}).map(function(a){return a.map(function(a){return a.__data__})}))},gf.select=function(a,b,c){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(e,g){var h=ff.select(this),i="circle"===this.nodeName?me:pe,j="circle"===this.nodeName?ne:qe,k=pg||!a||a.indexOf(e.id)>=0,l=!b||b.indexOf(g)>=0,m=h.classed(f.SELECTED);k&&l?qg(e)&&!m&&i(h.classed(f.SELECTED,!0),e,g):d(c)&&c&&m&&j(h.classed(f.SELECTED,!1),e,g)})},gf.unselect=function(a,b){og&&zi.selectAll("."+f.shapes).selectAll("."+f.shape).each(function(c,d){var e=ff.select(this),g="circle"===this.nodeName?ne:qe,h=pg||!a||a.indexOf(c.id)>=0,i=!b||b.indexOf(d)>=0,j=e.classed(f.SELECTED);h&&i&&qg(c)&&j&&g(e.classed(f.SELECTED,!1),c,d)})},gf.toLine=function(a){ef(a,"line")},gf.toSpline=function(a){ef(a,"spline")},gf.toBar=function(a){ef(a,"bar")},gf.toScatter=function(a){ef(a,"scatter")},gf.toArea=function(a){ef(a,"area")},gf.toAreaSpline=function(a){ef(a,"area-spline")},gf.toPie=function(a){ef(a,"pie",{withTransform:!0})},gf.toDonut=function(a){ef(a,"donut",{withTransform:!0})},gf.groups=function(a){return c(a)?fg:(fg=a,Me(),fg)},gf.xgrids=function(a){return a?(lh=a,Me(),lh):lh},gf.xgrids.add=function(a){return a?gf.xgrids(lh.concat(a)):void 0},gf.xgrids.remove=function(a){var b=df(a);return gf.xgrids(lh.filter(b))},gf.ygrids=function(a){return a?(nh=a,Me(),nh):nh},gf.ygrids.add=function(a){return a?gf.ygrids(nh.concat(a)):void 0},gf.ygrids.remove=function(a){var b=df(a);return gf.ygrids(nh.filter(b))},gf.regions=function(a){return c(a)?Ih:(Ih=a,Me(),Ih)},gf.regions.add=function(a){return c(a)?Ih:(Ih=Ih.concat(a),Me(),Ih)},gf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;xi.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Ih=Ih.filter(function(b){return b.classes.indexOf(a)<0})}),Ih},gf.data.get=function(a){var b=gf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},gf.data.getAsTarget=function(a){var b=Ac(function(b){return b.id===a});return b.length>0?b[0]:void 0},gf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){eg[b]=a[b]}),af(xc(gf.data.targets),{withTransition:!0}),eg):eg},gf.x=function(a){return arguments.length&&(mc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs},gf.xs=function(a){return arguments.length&&(nc(gf.data.targets,a),Me({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),gf.data.xs },gf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){bb(b,a[b])}),Ab())},gf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Ug=+a.y),b(a.y2)&&(bh=+a.y2)):Ug=bh=+a,Me())},gf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.y)&&(Vg=+a.y),b(a.y2)&&(ch=+a.y2)):Vg=ch=+a,Me())},gf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&gf.axis.max(a.max),"undefined"!=typeof a.min&&gf.axis.min(a.min))},gf.legend.show=function(a){Cg||(Cg=!0,Bi.style("visibility","visible")),$e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.legend.hide=function(a){Cg&&he(a)&&(Cg=!1,Bi.style("visibility","hidden")),_e(yc(a)),Me({withTransitionForHorizontalAxis:!1})},gf.resize=function(a){kf=a?a.width:null,lf=a?a.height:null,Re({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},gf.destroy=function(){gf.data.targets=void 0,gf.data.xs={},Di.html(""),a.onresize=null},"url"in e.data)ff.csv(e.data.url,function(a,b){Fe(b)});else if("rows"in e.data)Fe(pc(e.data.rows));else{if(!("columns"in e.data))throw Error("url or rows or columns is required.");Fe(qc(e.data.columns))}return gf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],e):a.c3=e}(window);