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