This repository has been archived by the owner on May 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbillboard.min.js
11 lines (11 loc) · 207 KB
/
billboard.min.js
1
2
3
4
5
6
7
8
9
10
11
/*!
* Copyright (c) 2017 ~ present NAVER Corp.
* billboard.js project is licensed under the MIT license
*
* billboard.js, JavaScript chart library
* https://naver.github.io/billboard.js/
*
* @version 2.0.2
*/
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("d3-time-format"),require("d3-selection"),require("d3-brush"),require("d3-dsv"),require("d3-drag"),require("d3-scale"),require("d3-transition"),require("d3-shape"),require("d3-axis"),require("d3-ease"),require("d3-interpolate"),require("d3-zoom"),require("d3-color"));else if("function"==typeof define&&define.amd)define(["d3-time-format","d3-selection","d3-brush","d3-dsv","d3-drag","d3-scale","d3-transition","d3-shape","d3-axis","d3-ease","d3-interpolate","d3-zoom","d3-color"],e);else{var i="object"==typeof exports?e(require("d3-time-format"),require("d3-selection"),require("d3-brush"),require("d3-dsv"),require("d3-drag"),require("d3-scale"),require("d3-transition"),require("d3-shape"),require("d3-axis"),require("d3-ease"),require("d3-interpolate"),require("d3-zoom"),require("d3-color")):e(t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(this,(function(t,e,i,n,a,r,s,o,c,l,u,d,h){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)i.d(n,a,function(e){return t[e]}.bind(null,a));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){i(1),t.exports=i(15)},function(t,e,i){},function(e,i){e.exports=t},function(t,i){t.exports=e},function(t,e){t.exports=i},function(t,e){t.exports=n},function(t,e){t.exports=a},function(t,e){t.exports=r},function(t,e){t.exports=s},function(t,e){t.exports=o},function(t,e){t.exports=c},function(t,e){t.exports=l},function(t,e){t.exports=u},function(t,e){t.exports=d},function(t,e){t.exports=h},function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return Wi})),i.d(e,"bb",(function(){return Wi}));var n={};i.r(n),i.d(n,"area",(function(){return vi})),i.d(n,"areaLineRange",(function(){return _i})),i.d(n,"areaSpline",(function(){return mi})),i.d(n,"areaSplineRange",(function(){return yi})),i.d(n,"areaStep",(function(){return bi})),i.d(n,"bar",(function(){return Ci})),i.d(n,"bubble",(function(){return Ei})),i.d(n,"donut",(function(){return Si})),i.d(n,"gauge",(function(){return Oi})),i.d(n,"line",(function(){return Ti})),i.d(n,"pie",(function(){return Li})),i.d(n,"radar",(function(){return ki})),i.d(n,"scatter",(function(){return Ri})),i.d(n,"spline",(function(){return Ai})),i.d(n,"step",(function(){return wi}));var a={};function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i.r(a),i.d(a,"selection",(function(){return Yi})),i.d(a,"subchart",(function(){return Gi})),i.d(a,"zoom",(function(){return Vi}));var s,o=i(2),c=i(3),l={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcs:"bb-arcs",area:"bb-area",areas:"bb-areas",axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",bar:"bb-bar",bars:"bb-bars",brush:"bb-brush",button:"bb-button",buttonZoomReset:"bb-zoom-reset",chart:"bb-chart",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsTitle:"bb-chart-arcs-title",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",chartCircles:"bb-chart-circles",chartLine:"bb-chart-line",chartLines:"bb-chart-lines",chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars",chartText:"bb-chart-text",chartTexts:"bb-chart-texts",circle:"bb-circle",circles:"bb-circles",colorPattern:"bb-color-pattern",colorScale:"bb-colorscale",defocused:"bb-defocused",dragarea:"bb-dragarea",empty:"bb-empty",eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single",focused:"bb-focused",gaugeValue:"bb-gauge-value",grid:"bb-grid",gridLines:"bb-grid-lines",legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemFocused:"bb-legend-item-focused",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile",level:"bb-level",levels:"bb-levels",line:"bb-line",lines:"bb-lines",main:"bb-main",region:"bb-region",regions:"bb-regions",selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",shape:"bb-shape",shapes:"bb-shapes",stanfordElements:"bb-stanford-elements",stanfordLine:"bb-stanford-line",stanfordLines:"bb-stanford-lines",stanfordRegion:"bb-stanford-region",stanfordRegions:"bb-stanford-regions",subchart:"bb-subchart",target:"bb-target",text:"bb-text",texts:"bb-texts",title:"bb-title",tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name",xgrid:"bb-xgrid",xgridFocus:"bb-xgrid-focus",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridFocus:"bb-ygrid-focus",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids",zoomBrush:"bb-zoom-brush",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_",TextOverlapping:"text-overlapping"},u={element:function(){return{chart:null,main:null,svg:null,axis:{x:null,y:null,y2:null,subX:null},defs:null,tooltip:null,legend:null,title:null,subchart:{main:null,bar:null,line:null,area:null},arcs:null,bar:null,line:null,area:null,circle:null,radar:null,text:null,grid:{main:null,x:null,y:null},gridLines:{main:null,x:null,y:null},region:{main:null,list:null},eventRect:null}},state:function(){return{width:0,width2:0,height:0,height2:0,margin:{top:0,bottom:0,left:0,right:0},margin2:{top:0,bottom:0,left:0,right:0},margin3:{top:0,bottom:0,left:0,right:0},arcWidth:0,arcHeight:0,xAxisHeight:0,hasAxis:!1,hasRadar:!1,current:{width:0,height:0,dataMax:0,maxTickWidths:{x:{size:0,ticks:[],clipPath:0,domain:""},y:{size:0,domain:""},y2:{size:0,domain:""}},types:[]},isLegendRight:!1,isLegendInset:!1,isLegendTop:!1,isLegendLeft:!1,legendStep:0,legendItemWidth:0,legendItemHeight:0,legendHasRendered:!1,axis:{x:{padding:{left:0,right:0},tickCount:0}},rotatedPadding:{left:30,right:0,top:5},withoutFadeIn:{},inputType:"",datetimeId:"",clip:{id:"",idXAxis:"",idYAxis:"",idXAxisTickTexts:"",idGrid:"",idSubchart:"",path:"",pathXAxis:"",pathYAxis:"",pathXAxisTickTexts:"",pathGrid:""},dragStart:null,dragging:!1,flowing:!1,cancelClick:!1,mouseover:!1,rendered:!1,transiting:!1,resizing:!1,toggling:!1,hasNegativeValue:!1,hasPositiveValue:!0,orgAreaOpacity:"0.2",hiddenTargetIds:[],hiddenLegendIds:[],focusedTargetIds:[],defocusedTargetIds:[],radius:0,innerRadius:0,innerRadiusRatio:0,gaugeArcWidth:0,radiusExpanded:0,xgridAttr:{x1:null,x2:null,y1:null,y2:null}}}},d=function(){function t(){var t=this;Object.keys(u).forEach((function(e){t[e]=new u[e]}))}return t.prototype.getStore=function(t){return this[t]},t}(),h={bindto:"#chart",background:{},clipPath:!0,svg_classname:void 0,size_width:void 0,size_height:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,resize_auto:!0,onover:void 0,onout:void 0,onresize:void 0,onresized:void 0,onbeforeinit:void 0,oninit:void 0,onafterinit:void 0,onrendered:void 0,transition_duration:350,plugins:[],render:{},regions:[]},g={data_idConverter:function(t){return t},data_names:{},data_classes:{},data_type:void 0,data_types:{},data_order:"desc",data_groups:[],data_color:void 0,data_colors:{},data_labels:{},data_labels_colors:void 0,data_labels_position:{},data_hide:!1,data_filter:void 0,data_onclick:function(){},data_onover:function(){},data_onout:function(){},data_onmin:void 0,data_onmax:void 0,data_url:void 0,data_headers:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:"csv",data_keys:void 0,data_empty_label_text:""},f={color_pattern:[],color_tiles:void 0,color_threshold:{},color_onover:void 0},p={interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{}},x={legend_show:!0,legend_hide:!1,legend_contents_bindto:void 0,legend_contents_template:void 0,legend_position:"bottom",legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_equally:!1,legend_padding:0,legend_item_tile_width:10,legend_item_tile_height:10,legend_usePoint:!1},v={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},_={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:{top:"0px",left:"50px"},tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:function(){},tooltip_onhide:function(){},tooltip_onshown:function(){},tooltip_onhidden:function(){},tooltip_order:null},m=i(4),y=(s=function(t){return void 0!==t&&t})(self)||s(window)||s(global)||s(globalThis)||Function("return this")(),b=y&&y.document;function T(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function A(t){for(var e,i=1;i<arguments.length;i++)e=null==arguments[i]?{}:arguments[i],i%2?T(Object(e),!0).forEach((function(i){r(t,i,e[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):T(Object(e)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}));return t}var w=function(t){return t||0===t},S=function(t){return"function"==typeof t},O=function(t){return"string"==typeof t},L=function(t){return"number"==typeof t},k=function(t){return void 0===t},C=function(t){return void 0!==t},E=function(t){return"boolean"==typeof t},R=function(t){return 10*Math.ceil(t/10)},D=function(t){return Math.ceil(t)+.5},I=function(t){return t[1]-t[0]},X=function(t){return"object"==typeof t},z=function(t){return k(t)||null===t||O(t)&&0===t.length||X(t)&&!(t instanceof Date)&&0===Object.keys(t).length||L(t)&&isNaN(t)},P=function(t){return!z(t)},M=function(t){return Array.isArray(t)},F=function(t){return t&&!t.nodeType&&X(t)&&!M(t)};function B(t,e,i){return C(t[e])?t[e]:i}function $(t){for(var e=S(t),i=arguments.length,n=Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];return e&&t.call.apply(t,n),e}function j(t,e){var i=0;t.each((function(){return++i})).on("end",(function(){for(var t=arguments.length,n=Array(t),a=0;a<t;a++)n[a]=arguments[a];--i||e.apply.apply(e,[this].concat(n))}))}function N(t){return O(t)?t.replace(/</g,"<").replace(/>/g,">"):t}function Y(t,e,i,n){if(void 0===i&&(i=[-1,1]),void 0===n&&(n=!1),t&&O(e))if(-1===e.indexOf("\n"))t.text(e);else{var a=[t.text(),e].map((function(t){return t.replace(/[\s\n]/g,"")}));if(a[0]!==a[1]){var r=e.split("\n"),s=n?r.length-1:1;t.html(""),r.forEach((function(e,n){t.append("tspan").attr("x",0).attr("dy",(0===n?i[0]*s:i[1])+"em").text(e)}))}}}function G(t){var e=t.getBBox(),i=e.x,n=e.y,a=e.width,r=e.height;return[{x:i,y:n+r},{x:i,y:n},{x:i+a,y:n},{x:i+a,y:n+r}]}function V(t){var e,i=t.$el,n=c.event,a=i.subchart.main||i.main;return n&&"brush"===n.type?e=n.selection:a&&(e=a.select("."+l.brush).node())&&(e=Object(m.brushSelection)(e)),e}var H=function(t){return t.rect||(t.rect=t.getBoundingClientRect())};function W(t){void 0===t&&(t=!0);var e=Math.random();return t?e+"":e}function U(t){var e=V(t);return!e||e[0]===e[1]}function Z(t,e){for(var i in void 0===t&&(t={}),M(e)&&e.forEach((function(e){return Z(t,e)})),e)/^\d+$/.test(i)||i in t||(t[i]=e[i]);return t}var q=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},K=function(t){return[].slice.call(t)};var J=function(t){var e=t?t.transform:null,i=e&&e.baseVal;return i&&i.numberOfItems?i.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}};function Q(t){var e=t[0]instanceof Date,i=(e?t.map(Number):t).filter((function(t,e,i){return i.indexOf(t)===e}));return e?i.map((function(t){return new Date(t)})):i}function tt(t){return t&&t.length?t.reduce((function(t,e){return t.concat(e)})):[]}function et(t){for(var e=arguments.length,i=Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];if(!i.length||1===i.length&&!i[0])return t;var a=i.shift();return F(t)&&F(a)&&Object.keys(a).forEach((function(e){var i=a[e];F(i)?(!t[e]&&(t[e]={}),t[e]=et(t[e],i)):t[e]=M(i)?i.concat():i})),et.apply(void 0,[t].concat(i))}function it(t,e){var i;return void 0===e&&(e=!0),t[0]instanceof Date?i=e?function(t,e){return t-e}:function(t,e){return e-t}:e&&!t.every(isNaN)?i=function(t,e){return t-e}:!e&&(i=function(t,e){return(t>e?-1:t<e&&1)||t===e&&0}),t.concat().sort(i)}function nt(t,e){var i=e.filter((function(t){return P(t)}));return i.length?L(i[0])?i=Math[t].apply(Math,i):i[0]instanceof Date&&(i=it(i,"min"===t)[0]):i=void 0,i}var at=function(t,e,i){void 0===i&&(i=1);for(var n=[],a=0|Math.max(0,Math.ceil((e-t)/i)),r=t;r<a;r++)n.push(t+r*i);return n},rt={mouse:function(){try{return new MouseEvent("t"),function(t,e,i){void 0===i&&(i={bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0}),t.dispatchEvent(new MouseEvent(e,i))}}catch(t){return function(t,e,i){void 0===i&&(i={bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});var n=b.createEvent("MouseEvent");n.initMouseEvent(e,i.bubbles,i.cancelable,y,0,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),t.dispatchEvent(n)}}}(),touch:function(t,e,i){var n=new Touch(et({identifier:Date.now(),target:t,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},i));t.dispatchEvent(new TouchEvent(e,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[n],targetTouches:[],changedTouches:[n]}))}};function st(t,e){var i=t;for(var n in e)i=i.replace(new RegExp("{="+n+"}","g"),e[n]);return i}function ot(t){var e;if(t instanceof Date)e=t;else if(O(t)){var i=this.config;e=this.format.dataTime(i.data_xFormat)(t)}else L(t)&&!isNaN(t)&&(e=new Date(+t));return(!e||isNaN(+e))&&console&&console.error&&console.error("Failed to parse x '"+t+"' to Date object"),e}function ct(){return!b.hidden}function lt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function ut(t){for(var e,i=1;i<arguments.length;i++)e=null==arguments[i]?{}:arguments[i],i%2?lt(Object(e),!0).forEach((function(i){r(t,i,e[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):lt(Object(e)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}));return t}var dt=function(){function t(){return function(){for(var t=function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(e){if(F(e)&&e.constructor){var i=new e.constructor;for(var n in e)i[n]=t(e[n]);return i}return e})),e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];return i.map((function(e){return t(e)})).reduce((function(t,e){return A(A({},t),e)}))}(h,g,f,p,x,v,_,t.data)}return t.setOptions=function(t){this.data=t.reduce((function(t,e){return ut(ut({},t),e)}),this.data)},t}();r(dt,"data",{});var ht="$baseLength",gt="__colorPattern__",ft="$dataMinMax",pt="$dataTotalSum",xt="$totalPerIndex",vt="legendItemTextBox",_t="$radarPoints",mt="setOverOut",yt="callOverOutForTouch",bt="textRect",Tt=function(){function t(){r(this,"cache",{})}var e=t.prototype;return e.add=function(t,e,i){return void 0===i&&(i=!1),this.cache[t]=i?this.cloneTarget(e):e,this.cache[t]},e.remove=function(t){var e=this;K(t).forEach((function(t){return delete e.cache[t]}))},e.get=function(t,e){if(void 0===e&&(e=!1),e){for(var i,n=[],a=0;i=t[a];a++)i in this.cache&&n.push(this.cloneTarget(this.cache[i]));return n}var r=this.cache[t];return w(r)?r:null},e.reset=function(t){for(var e in this.cache)(t||/^\$/.test(e))&&(this.cache[e]=null)},e.cloneTarget=function(t){return{id:t.id,id_org:t.id_org,values:t.values.map((function(t){return{x:t.x,value:t.value,id:t.id}}))}},t}(),At=y.setTimeout,wt=y.clearTimeout;function St(){var t=[],e=function(e,i){var n;!function e(){for(var a,r=0,s=0;a=t[s];s++)if(!0===a||a.empty&&a.empty())r++;else try{a.transition()}catch(t){r++}n&&wt(n),r===t.length?i&&i():n=At(e,50)}()};return e.add=function(e){M(e)?t=t.concat(e):t.push(e)},e}var Ot=i(5),Lt={convertData:function(t,e){var i;if(t.bindto?(i={},["url","mimeType","headers","keys","json","keys","rows","columns"].forEach((function(e){var n="data_"+e;n in t&&(i[e]=t[n])}))):i=t,i.url&&e)this.convertUrlToData(i.url,i.mimeType,i.headers,i.keys,e);else if(i.json)i=this.convertJsonToData(i.json,i.keys);else if(i.rows)i=this.convertRowsToData(i.rows);else if(i.columns)i=this.convertColumnsToData(i.columns);else if(t.bindto)throw Error("url or json or rows or columns is required.");return M(i)&&i},convertUrlToData:function(t,e,i,n,a){var r=this;void 0===e&&(e="csv");var s=new XMLHttpRequest;s.open("GET",t),i&&Object.keys(i).forEach((function(t){s.setRequestHeader(t,i[t])})),s.onreadystatechange=function(){if(4===s.readyState){if(200!==s.status)throw new Error(t+": Something went wrong loading!");var i=s.responseText;i&&a.call(r,r["convert"+q(e)+"ToData"]("json"===e?JSON.parse(i):i,n))}},s.send()},convertCsvTsvToData:function(t,e){var i,n=t.rows(e);return 1===n.length?(i=[{}],n[0].forEach((function(t){i[0][t]=null}))):i=t.parse(e),i},convertCsvToData:function(t){return this.convertCsvTsvToData({rows:Ot.csvParseRows,parse:Ot.csvParse},t)},convertTsvToData:function(t){return this.convertCsvTsvToData({rows:Ot.tsvParseRows,parse:Ot.tsvParse},t)},convertJsonToData:function(t,e){var i,n,a=this,r=this.config,s=[];if(M(t)){var o=e||r.data_keys;o.x?(i=o.value.concat(o.x),r.data_x=o.x):i=o.value,s.push(i),t.forEach((function(t){var e=i.map((function(e){var i=a.findValueInJson(t,e);return k(i)&&(i=null),i}));s.push(e)})),n=this.convertRowsToData(s)}else Object.keys(t).forEach((function(e){var i=t[e].concat();i.unshift(e),s.push(i)})),n=this.convertColumnsToData(s);return n},findValueInJson:function(t,e){if(void 0!==t[e])return t[e];var i=e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),n=t;return i.some((function(t){return!(n=n&&t in n?n[t]:void 0)})),n},convertRowsToData:function(t){var e=t[0],i=[];return t.forEach((function(t,n){if(n>0){var a={};t.forEach((function(t,i){if(k(t))throw new Error("Source data is missing a component at ("+n+", "+i+")!");a[e[i]]=t})),i.push(a)}})),i},convertColumnsToData:function(t){var e=[];return t.forEach((function(t,i){var n=t[0];t.forEach((function(t,a){if(a>0){if(k(e[a-1])&&(e[a-1]={}),k(t))throw new Error("Source data is missing a component at ("+i+", "+a+")!");e[a-1][n]=t}}))})),e},convertDataToTargets:function(t,e){var i=this,n=this,a=n.axis,r=n.config,s=n.state,o=!1,c=!1,l=!1;a&&(o=a.isCategorized(),c=a.isTimeSeries(),l=a.isCustomX());var u,d=Object.keys(t[0]||{}),h=d.length?d.filter(n.isNotX,n):[],g=d.length?d.filter(n.isX,n):[];h.forEach((function(a){var s=i.getXKey(a);l||c?g.indexOf(s)>=0?u=(e&&n.data.xs[a]||[]).concat(t.map((function(t){return t[s]})).filter(w).map((function(t,e){return n.generateTargetX(t,a,e)}))):r.data_x?u=i.getOtherTargetXs():P(r.data_xs)&&(u=n.getXValuesOfXKey(s,n.data.targets)):u=t.map((function(t,e){return e})),u&&(i.data.xs[a]=u)})),h.forEach((function(t){if(!i.data.xs[t])throw new Error('x is not defined for id = "'+t+'".')}));var f=h.map((function(e,i){var a=r.data_idConverter.bind(n.api)(e),c=n.getXKey(e),u=l&&o,d=u&&t.map((function(t){return t.x})).every((function(t){return r.axis_x_categories.indexOf(t)>-1}));return{id:a,id_org:e,values:t.map((function(t,o){var l,h=t[c],g=t[e];return g=null===g||isNaN(g)||F(g)?M(g)||F(g)?g:null:+g,!u&&!s.hasRadar||0!==i||k(h)?l=n.generateTargetX(h,e,o):(!d&&0===i&&0===o&&(r.axis_x_categories=[]),-1===(l=r.axis_x_categories.indexOf(h))&&(l=r.axis_x_categories.length,r.axis_x_categories.push(h))),(k(g)||n.data.xs[e].length<=o)&&(l=void 0),{x:l,value:g,id:a}})).filter((function(t){return C(t.x)}))}}));return f.forEach((function(t){r.data_xSort&&(t.values=t.values.sort((function(t,e){return(t.x||0===t.x?t.x:1/0)-(e.x||0===e.x?e.x:1/0)}))),t.values.forEach((function(t,e){return t.index=e})),n.data.xs[t.id].sort((function(t,e){return t-e}))})),s.hasNegativeValue=n.hasNegativeValueInTargets(f),s.hasPositiveValue=n.hasPositiveValueInTargets(f),r.data_type&&n.setTargetType(n.mapToIds(f).filter((function(t){return!(t in r.data_types)})),r.data_type),f.forEach((function(t){return n.cache.add(t.id_org,t,!0)})),f}},kt={isX:function(t){var e,i,n,a=this.config,r=a.data_x&&t===a.data_x,s=P(a.data_xs)&&(e=a.data_xs,i=t,n=!1,Object.keys(e).forEach((function(t){return e[t]===i&&(n=!0)})),n);return r||s},isNotX:function(t){return!this.isX(t)},isStackNormalized:function(){var t=this.config;return!(!t.data_stack_normalize||!t.data_groups.length)},isGrouped:function(t){var e=this.config.data_groups;return t?e.some((function(e){return e.indexOf(t)>=0&&e.length>1})):e.length>0},getXKey:function(t){var e=this.config;return e.data_x?e.data_x:P(e.data_xs)?e.data_xs[t]:null},getXValuesOfXKey:function(t,e){var i,n=this;return(e&&P(e)?n.mapToIds(e):[]).forEach((function(e){n.getXKey(e)===t&&(i=n.data.xs[e])})),i},getIndexByX:function(t,e){return e?e.indexOf(O(t)?t:+t):(this.filterByX(this.data.targets,t)[0]||{index:null}).index},getXValue:function(t,e){return t in this.data.xs&&this.data.xs[t]&&w(this.data.xs[t][e])?this.data.xs[t][e]:e},getOtherTargetXs:function(){var t=Object.keys(this.data.xs);return t.length?this.data.xs[t[0]]:null},getOtherTargetX:function(t){var e=this.getOtherTargetXs();return e&&t<e.length?e[t]:null},addXs:function(t){var e=this.config;Object.keys(t).forEach((function(i){e.data_xs[i]=t[i]}))},isMultipleX:function(){return P(this.config.data_xs)||!this.config.data_xSort||this.hasType("bubble")||this.hasType("scatter")},addName:function(t){var e,i=this.config;return t&&(e=i.data_names[t.id],t.name=void 0===e?t.id:e),t},getAllValuesOnIndex:function(t,e){void 0===e&&(e=!1);var i=this,n=i.filterTargetsToShow(i.data.targets).map((function(e){return i.addName(i.getValueOnIndex(e.values,t))}));return e&&(n=n.filter((function(t){return w(t.value)}))),n},getValueOnIndex:function(t,e){var i=t.filter((function(t){return t.index===e}));return i.length?i[0]:null},updateTargetX:function(t,e){var i=this;t.forEach((function(t){t.values.forEach((function(n,a){n.x=i.generateTargetX(e[a],t.id,a)})),i.data.xs[t.id]=e}))},updateTargetXs:function(t,e){var i=this;t.forEach((function(t){e[t.id]&&i.updateTargetX([t],e[t.id])}))},generateTargetX:function(t,e,i){var n=this.axis,a=n&&n.isCategorized()?i:t||i;if(n&&n.isTimeSeries()){var r=ot.bind(this);a=r(t||this.getXValue(e,i))}else n&&n.isCustomX()&&!n.isCategorized()&&(a=w(t)?+t:this.getXValue(e,i));return a},updateXs:function(t){t.length&&(this.axis.xs=t.map((function(t){return t.x})))},getPrevX:function(t){var e=this.axis.xs[t-1];return C(e)?e:null},getNextX:function(t){var e=this.axis.xs[t+1];return C(e)?e:null},getBaseValue:function(t){var e=this,i=e.state.hasAxis,n=t.value;return n&&i&&(e.isAreaRangeType(t)?n=e.getAreaRangeData(t,"mid"):e.isBubbleZType(t)&&(n=e.getBubbleZData(n,"y"))),n},getMinMaxValue:function(t){var e,i,n=this.getBaseValue.bind(this);return(t||this.data.targets.map((function(t){return t.values}))).forEach((function(t,a){var r=t.map(n).filter(L);e=Math.min.apply(Math,[a?e:1/0].concat(r)),i=Math.max.apply(Math,[a?i:-1/0].concat(r))})),{min:e,max:i}},getMinMaxData:function(){var t=this,e=ft,i=t.cache.get(e);if(!i){var n=t.data.targets.map((function(t){return t.values})),a=t.getMinMaxValue(n),r=[],s=[];n.forEach((function(e){var i=t.getFilteredDataByValue(e,a.min),n=t.getFilteredDataByValue(e,a.max);i.length&&(r=r.concat(i)),n.length&&(s=s.concat(n))})),t.cache.add(e,i={min:r,max:s})}return i},getTotalPerIndex:function(){var t=xt,e=this.cache.get(t);return this.isStackNormalized()&&!e&&(e=[],this.data.targets.forEach((function(t){t.values.forEach((function(t,i){e[i]||(e[i]=0),e[i]+=L(t.value)?t.value:0}))}))),e},getTotalDataSum:function(t){var e=pt,i=this.cache.get(e);if(!L(i)){var n=tt(this.data.targets.map((function(t){return t.values}))).map((function(t){return t.value})).reduce((function(t,e){return t+e}));this.cache.add(e,i=n)}return t&&(i-=this.getHiddenTotalDataSum()),i},getHiddenTotalDataSum:function(){var t=this.api,e=this.state.hiddenTargetIds,i=0;return e.length&&(i=t.data.values.bind(t)(e).reduce((function(t,e){return t+e}))),i},getFilteredDataByValue:function(t,e){var i=this;return t.filter((function(t){return i.getBaseValue(t)===e}))},getMaxDataCount:function(){return Math.max.apply(Math,this.data.targets.map((function(t){return t.values.length})))},getMaxDataCountTarget:function(){var t=this.filterTargetsToShow()||[],e=t.length;return e>1?t=it(Q(t=t.map((function(t){return t.values})).reduce((function(t,e){return t.concat(e)})).map((function(t){return t.x})))).map((function(t,e){return{x:t,index:e}})):e&&(t=t[0].values),t},mapToIds:function(t){return t.map((function(t){return t.id}))},mapToTargetIds:function(t){return t?M(t)?t.concat():[t]:this.mapToIds(this.data.targets)},hasTarget:function(t,e){for(var i,n=this.mapToIds(t),a=0;i=n[a];a++)if(i===e)return!0;return!1},isTargetToShow:function(t){return this.state.hiddenTargetIds.indexOf(t)<0},isLegendToShow:function(t){return this.state.hiddenLegendIds.indexOf(t)<0},filterTargetsToShow:function(t){var e=this;return(t||e.data.targets).filter((function(t){return e.isTargetToShow(t.id)}))},mapTargetsToUniqueXs:function(t){var e=this.axis,i=[];return t&&t.length&&(i=Q(tt(t.map((function(t){return t.values.map((function(t){return+t.x}))})))),i=e&&e.isTimeSeries()?i.map((function(t){return new Date(+t)})):i.map((function(t){return+t}))),it(i)},addHiddenTargetIds:function(t){this.state.hiddenTargetIds=this.state.hiddenTargetIds.concat(t)},removeHiddenTargetIds:function(t){this.state.hiddenTargetIds=this.state.hiddenTargetIds.filter((function(e){return t.indexOf(e)<0}))},addHiddenLegendIds:function(t){this.state.hiddenLegendIds=this.state.hiddenLegendIds.concat(t)},removeHiddenLegendIds:function(t){this.state.hiddenLegendIds=this.state.hiddenLegendIds.filter((function(e){return t.indexOf(e)<0}))},getValuesAsIdKeyed:function(t){var e=this,i=e.state.hasAxis,n={},a=e.isMultipleX(),r=a?e.mapTargetsToUniqueXs(t).map((function(t){return O(t)?t:+t})):null;return t.forEach((function(t){var s=[];t.values.forEach((function(t){var n=t.value;M(n)?s.push.apply(s,n):F(n)&&"high"in n?s.push.apply(s,Object.values(n)):e.isBubbleZType(t)?s.push(i&&e.getBubbleZData(n,"y")):a?s[e.getIndexByX(t.x,r)]=n:s.push(n)})),n[t.id]=s})),n},checkValueInTargets:function(t,e){for(var i,n=Object.keys(t),a=0;a<n.length;a++){i=t[n[a]].values;for(var r=0;r<i.length;r++)if(e(i[r].value))return!0}return!1},hasMultiTargets:function(){return this.filterTargetsToShow().length>1},hasNegativeValueInTargets:function(t){return this.checkValueInTargets(t,(function(t){return t<0}))},hasPositiveValueInTargets:function(t){return this.checkValueInTargets(t,(function(t){return t>0}))},_checkOrder:function(t){var e=this.config.data_order;return O(e)&&e.toLowerCase()===t},isOrderDesc:function(){return this._checkOrder("desc")},isOrderAsc:function(){return this._checkOrder("asc")},orderTargets:function(t){var e=this.config,i=[].concat(t),n=this.isOrderAsc(),a=this.isOrderDesc();return n||a?i.sort((function(t,e){var i=function(t,e){return t+Math.abs(e.value)},a=t.values.reduce(i,0),r=e.values.reduce(i,0);return n?r-a:a-r})):S(e.data_order)&&i.sort(e.data_order.bind(this.api)),i},filterByX:function(t,e){return tt(t.map((function(t){return t.values}))).filter((function(t){return t.x-e==0}))},filterRemoveNull:function(t){var e=this;return t.filter((function(t){return w(e.getBaseValue(t))}))},filterByXDomain:function(t,e){return t.map((function(t){return{id:t.id,id_org:t.id_org,values:t.values.filter((function(t){return e[0]<=t.x&&t.x<=e[1]}))}}))},hasDataLabel:function(){var t=this.config.data_labels;return E(t)&&t||X(t)&&P(t)},getDataLabelLength:function(t,e,i){var n=this,a=[0,0];return n.$el.chart.select("svg").selectAll(".dummy").data([t,e]).enter().append("text").text((function(t){return n.dataLabelFormat(t.id)(t)})).each((function(t,e){a[e]=1.3*this.getBoundingClientRect()[i]})).remove(),a},isNoneArc:function(t){return this.hasTarget(this.data.targets,t.id)},isArc:function(t){return"data"in t&&this.hasTarget(this.data.targets,t.data.id)},findSameXOfValues:function(t,e){var i,n=t[e].x,a=[];for(i=e-1;i>=0&&n===t[i].x;i--)a.push(t[i]);for(i=e;i<t.length&&n===t[i].x;i++)a.push(t[i]);return a},findClosestFromTargets:function(t,e){var i=this,n=t.map((function(t){return i.findClosest(t.values,e)}));return i.findClosest(n,e)},findClosest:function(t,e){var i,n=this,a=n.config,r=n.$el.main,s=t.filter((function(t){return t&&w(t.value)})),o=a.point_sensitivity;return s.filter((function(t){return n.isBarType(t.id)})).forEach((function(t){var e=r.select("."+l.bars+n.getTargetSelectorSuffix(t.id)+" ."+l.bar+"-"+t.index).node();!i&&n.isWithinBar(e)&&(i=t)})),s.filter((function(t){return!n.isBarType(t.id)})).forEach((function(t){var a=n.dist(t,e);a<o&&(o=a,i=t)})),i},dist:function(t,e){var i=this.config.axis_rotated,n=this.scale,a=i?1:0,r=i?0:1,s=this.circleY(t,t.index),o=(n.zoom||n.x)(t.x);return Math.sqrt(Math.pow(o-e[a],2)+Math.pow(s-e[r],2))},convertValuesToStep:function(t){var e=this.axis,i=this.config,n=i.axis_rotated,a=i.line_step_type,r=!!e&&e.isCategorized(),s=M(t)?t.concat():[t];if(!n&&!r)return t;var o=s[0].id,c=s[0].x-1,l=s[0].value;return r&&s.unshift({x:c,value:l,id:o}),"step-after"===a&&s.unshift({x:c-1,value:l,id:o}),l=s[c=s.length-1].value,r&&s.push({x:c,value:l,id:o}),"step-before"===a&&s.push({x:c+1,value:l,id:o}),s},convertValuesToRange:function(t){var e=M(t)?t.concat():[t],i=[];return e.forEach((function(t){var e=t.x,n=t.id;i.push({x:e,id:n,value:t.value[0]}),i.push({x:e,id:n,value:t.value[2]})})),i},updateDataAttributes:function(t,e){var i=this.config["data_"+t];return k(e)||(Object.keys(e).forEach((function(t){i[t]=e[t]})),this.redraw({withLegend:!0})),i},getAreaRangeData:function(t,e){var i=t.value;if(M(i)){var n=["high","mid","low"].indexOf(e);return-1===n?null:i[n]}return i[e]},getRatio:function(t,e,i){var n=this,a=n.config,r=n.state,s=n.api,o=0;if(e&&s.data.shown().length)if(o=e.ratio||e.value,"arc"===t)o=n.pie.padAngle()()?e.value/n.getTotalDataSum(!0):(e.endAngle-e.startAngle)/(Math.PI*(n.hasType("gauge")&&!a.gauge_fullCircle?1:2));else if("index"===t){var c=s.data.values.bind(s),l=this.getTotalPerIndex();if(r.hiddenTargetIds.length){var u=c(r.hiddenTargetIds,!1);u.length&&(u=u.reduce((function(t,e){return t.map((function(t,i){return(L(t)?t:0)+e[i]}))})),l=l.map((function(t,e){return t-u[e]})))}e.ratio=L(e.value)&&l&&l[e.index]>0?e.value/l[e.index]:0,o=e.ratio}else if("radar"===t)o=parseFloat(Math.max(e.value,0)+"")/r.current.dataMax*a.radar_size_ratio;else if("bar"===t){var d=n.getYScaleById.bind(n)(e.id).domain().reduce((function(t,e){return e-t}));o=Math.abs(e.value)/d}return i&&o?100*o:o},updateDataIndexByX:function(t){var e=t.reduce((function(t,e,i){return t[+e.x]=i,t}),{});this.data.targets.forEach((function(t){t.values.forEach((function(t,i){var n=e[+t.x];void 0===n&&(n=i),t.index=n}))}))},isBubbleZType:function(t){return this.isBubbleType(t)&&(F(t.value)&&("z"in t.value||"y"in t.value)||M(t.value)&&2===t.value.length)}},Ct={load:function(t,e){var i=this,n=t;n&&(e.filter&&(n=n.filter(e.filter)),(e.type||e.types)&&n.forEach((function(t){var n=e.types&&e.types[t.id]||e.type;i.setTargetType(t.id,n)})),i.data.targets.forEach((function(t){for(var e=0;e<n.length;e++)if(t.id===n[e].id){t.values=n[e].values,n.splice(e,1);break}})),i.data.targets=i.data.targets.concat(n)),i.updateTargets(i.data.targets),i.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),i.updateTypesElements(),e.done&&e.done.call(i.api)},loadFromArgs:function(t){var e=this;if(e.config){e.cache.reset();var i=t.data||e.convertData(t,(function(i){return e.load(e.convertDataToTargets(i),t)}));i&&e.load(e.convertDataToTargets(i),t)}},unload:function(t,e){var i=this,n=i.state,a=i.$el,r=e,s=t;return i.cache.reset(),r||(r=function(){}),(s=s.filter((function(t){return i.hasTarget(i.data.targets,t)})))&&0!==s.length?(a.svg.selectAll(s.map((function(t){return i.selectorTarget(t)}))).transition().style("opacity","0").remove().call(j,r),s.forEach((function(t){n.withoutFadeIn[t]=!1,a.legend&&a.legend.selectAll("."+l.legendItem+i.getTargetSelectorSuffix(t)).remove(),i.data.targets=i.data.targets.filter((function(e){return e.id!==t}))})),void i.updateTypesElements()):void r()}},Et={drag:function(t){var e=this,i=e.config,n=e.state,a=e.$el.main,r=i.data_selection_grouped,s=i.interaction_enabled&&i.data_selection_isselectable;if(!e.hasArcType()&&i.data_selection_enabled&&(!i.zoom_enabled||e.zoom.altDomain)&&i.data_selection_multiple){var o=n.dragStart,u=o[0],d=o[1],h=t[0],g=t[1],f=Math.min(u,h),p=Math.max(u,h),x=r?n.margin.top:Math.min(d,g),v=r?n.height:Math.max(d,g);a.select("."+l.dragarea).attr("x",f).attr("y",x).attr("width",p-f).attr("height",v-x),a.selectAll("."+l.shapes).selectAll("."+l.shape).filter((function(t){return s&&s.bind(e.api)(t)})).each((function(t,i){var n,a=Object(c.select)(this),r=a.classed(l.SELECTED),s=a.classed(l.INCLUDED),o=!1;if(a.classed(l.circle)){var u=1*+a.attr("cx"),d=1*+a.attr("cy");n=e.togglePoint,o=f<u&&u<p&&x<d&&d<v}else{if(!a.classed(l.bar))return;var h=function(t){var e=t.getBoundingClientRect(),i=e.width,n=e.height,a=G(t);return{x:a[0].x,y:Math.min(a[0].y,a[1].y),width:i,height:n}}(this),g=h.x,_=(d=h.y,h.width),m=h.height;n=e.togglePath,o=!(p<g||g+_<f||v<d||d+m<x)}o^s&&(a.classed(l.INCLUDED,!s),a.classed(l.SELECTED,!r),n.call(e,!r,a,t,i))}))}},dragstart:function(t){var e=this,i=e.config,n=e.state,a=e.$el.main;e.hasArcType()||!i.data_selection_enabled||(n.dragStart=t,a.select("."+l.chart).append("rect").attr("class",l.dragarea).style("opacity","0.1"),e.setDragStatus(!0))},dragend:function(){var t=this.config,e=this.$el.main;this.hasArcType()||!t.data_selection_enabled||(e.select("."+l.dragarea).transition().duration(100).style("opacity","0").remove(),e.selectAll("."+l.shape).classed(l.INCLUDED,!1),this.setDragStatus(!1))},setDragStatus:function(t){this.state.dragging=t}},Rt=i(6),Dt={selectRectForSingle:function(t,e,i){var n=this,a=n.config,r=n.$el.main,s=a.data_selection_enabled,o=a.data_selection_grouped,u=a.data_selection_isselectable,d=a.tooltip_grouped,h=n.getAllValuesOnIndex(i);d&&(n.showTooltip(h,t),n.showGridFocus&&n.showGridFocus(h),!s||o)||r.selectAll("."+l.shape+"-"+i).each((function(){Object(c.select)(this).classed(l.EXPANDED,!0),s&&e.style("cursor",o?"pointer":null),d||(n.hideGridFocus&&n.hideGridFocus(),n.hideTooltip(),!o&&n.expandCirclesBars(i))})).filter((function(t){return n.isWithinShape(this,t)})).call((function(a){var r=a.data();s&&(o||u&&u.bind(n.api)(r))&&e.style("cursor","pointer"),d||(n.showTooltip(r,t),n.showGridFocus&&n.showGridFocus(r),n.unexpandCircles(),a.each((function(t){return n.expandCirclesBars(i,t.id)})))}))},expandCirclesBars:function(t,e,i){var n=this.config,a=this.$el,r=a.bar;a.circle&&n.point_focus_expand_enabled&&this.expandCircles(t,e,i),r&&this.expandBars(t,e,i)},setOverOut:function(t,e){var i=this,n=i.config,a=i.state.hasRadar,r=i.$el.main,s=F(e);if(s||-1!==e){var o=n[t?"data_onover":"data_onout"].bind(i.api);if(n.color_onover&&i.setOverColor(t,e,s),s)o(e,r.select("."+l.arc+i.getTargetSelectorSuffix(e.id)).node());else if(n.tooltip_grouped)t&&(n.point_focus_only&&a?i.showCircleFocus(i.getAllValuesOnIndex(e,!0)):i.expandCirclesBars(e,null,!0)),i.isMultipleX()||r.selectAll("."+l.shape+"-"+e).each((function(t){o(t,this)}));else{var u=i.cache.get(mt)||[],d=r.selectAll("."+l.shape+"-"+e).filter((function(t){return i.isWithinShape(this,t)}));d.each((function(t){var e=this;(0===u.length||u.every((function(t){return t!==e})))&&(o(t,this),u.push(this))})),u.length>0&&d.empty()&&(o=n.data_onout.bind(i.api),u.forEach((function(t){return o(Object(c.select)(t).datum(),t)})),u=[]),i.cache.add(mt,u)}}},callOverOutForTouch:function(t){var e=this.cache.get(yt);(F(t)&&e?t.id!==e.id:t!==e)&&((e||L(e))&&this.setOverOut(!1,e),(t||L(t))&&this.setOverOut(!0,t),this.cache.add(yt,t))},getDraggableSelection:function(){var t=this,e=t.config;return e.interaction_enabled&&e.data_selection_draggable&&t.drag?Object(Rt.drag)().on("drag",(function(){t.drag(Object(c.mouse)(this))})).on("start",(function(){t.dragstart(Object(c.mouse)(this))})).on("end",(function(){t.dragend()})):function(){}},dispatchEvent:function(t,e,i){var n=this.state.hasRadar,a=this.$el,r=a.main,s=a.radar,o=this.isMultipleX(),c=n?"."+l.axis+"-"+e+" text":"."+(o?l.eventRect:l.eventRect+"-"+e),u=(n?s.axes:r).select(c).node(),d=u.getBoundingClientRect(),h=d.width,g=d.left,f=d.top,p=g+(i?i[0]:0)+(o||this.config.axis_rotated?0:h/2),x=f+(i?i[1]:0);rt[/^(mouse|click)/.test(t)?"mouse":"touch"](u,t,{screenX:p,screenY:x,clientX:p,clientY:x})}},It={generateClass:function(t,e){return" "+t+" "+(t+this.getTargetSelectorSuffix(e))},classText:function(t){return this.generateClass(l.text,t.index)},classTexts:function(t){return this.generateClass(l.texts,t.id)},classShape:function(t){return this.generateClass(l.shape,t.index)},classShapes:function(t){return this.generateClass(l.shapes,t.id)},generateExtraLineClass:function(){var t=this.config.line_classes||[],e=[];return function(i){var n=i.id||i.data&&i.data.id||i;return e.indexOf(n)<0&&e.push(n),t[e.indexOf(n)%t.length]}},classLine:function(t){return this.classShape(t)+this.generateClass(l.line,t.id)},classLines:function(t){return this.classShapes(t)+this.generateClass(l.lines,t.id)},classCircle:function(t){return this.classShape(t)+this.generateClass(l.circle,t.index)},classCircles:function(t){return this.classShapes(t)+this.generateClass(l.circles,t.id)},classBar:function(t){return this.classShape(t)+this.generateClass(l.bar,t.index)},classBars:function(t){return this.classShapes(t)+this.generateClass(l.bars,t.id)},classArc:function(t){return this.classShape(t.data)+this.generateClass(l.arc,t.data.id)},classArcs:function(t){return this.classShapes(t.data)+this.generateClass(l.arcs,t.data.id)},classArea:function(t){return this.classShape(t)+this.generateClass(l.area,t.id)},classAreas:function(t){return this.classShapes(t)+this.generateClass(l.areas,t.id)},classRegion:function(t,e){return this.generateClass(l.region,e)+" "+("class"in t?t.class:"")},classEvent:function(t){return this.generateClass(l.eventRect,t.index)},classTarget:function(t){var e=this.config.data_classes[t],i="";return e&&(i=" "+l.target+"-"+e),this.generateClass(l.target,t)+i},classFocus:function(t){return this.classFocused(t)+this.classDefocused(t)},classFocused:function(t){return" "+(this.state.focusedTargetIds.indexOf(t.id)>=0?l.focused:"")},classDefocused:function(t){return" "+(this.state.defocusedTargetIds.indexOf(t.id)>=0?l.defocused:"")},classChartText:function(t){return l.chartText+this.classTarget(t.id)},classChartLine:function(t){return l.chartLine+this.classTarget(t.id)},classChartBar:function(t){return l.chartBar+this.classTarget(t.id)},classChartArc:function(t){return l.chartArc+this.classTarget(t.data.id)},classChartRadar:function(t){return l.chartRadar+this.classTarget(t.id)},getTargetSelectorSuffix:function(t){return t||0===t?("-"+t).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g,"-"):""},selectorTarget:function(t,e){var i=e||"",n=this.getTargetSelectorSuffix(t);return i+"."+(l.target+n)+", "+i+"."+(l.circles+n)},selectorTargets:function(t,e){var i=this,n=t||[];return n.length?n.map((function(t){return i.selectorTarget(t,e)})):null},selectorLegend:function(t){return"."+(l.legendItem+this.getTargetSelectorSuffix(t))},selectorLegends:function(t){var e=this;return t&&t.length?t.map((function(t){return e.selectorLegend(t)})):null}},Xt=i(7),zt=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Pt={getColorFromCss:function(){var t=gt,e=b.body,i=e[t];if(!i){var n=b.createElement("span");n.className=l.colorPattern,n.style.display="none",e.appendChild(n);var a=y.getComputedStyle(n).backgroundImage;n.parentNode.removeChild(n),a.indexOf(";")>-1&&(i=a.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map((function(t){return t.trim().replace(/[\"'\s]/g,"")})).filter(Boolean),e[t]=i)}return i},generateColor:function(){var t=this,e=t.config,i=e.data_colors,n=e.data_color,a=[],r=P(e.color_pattern)?e.color_pattern:Object(Xt.scaleOrdinal)(t.getColorFromCss()||zt).range(),s=r;if(S(e.color_tiles)){var o=e.color_tiles.bind(t.api)(),l=r.map((function(e,i){var n=e.replace(/[#\(\)\s,]/g,""),a=t.state.datetimeId+"-pattern-"+n+"-"+i;return function(t,e,i){var n=Object(c.select)(t.cloneNode(!0));return n.attr("id",i).insert("rect",":first-child").attr("width",n.attr("width")).attr("height",n.attr("height")).style("fill",e),{id:i,node:n.node()}}(o[i%o.length],e,a)}));r=l.map((function(t){return"url(#"+t.id+")"})),t.patterns=l}return function(o){var c,l=o.id||o.data&&o.data.id||o,u=t.isTypeOf(l,["line","spline","step"])||!e.data_types[l];return S(i[l])?c=i[l].bind(t.api)(o):i[l]?c=i[l]:(a.indexOf(l)<0&&a.push(l),c=u?s[a.indexOf(l)%s.length]:r[a.indexOf(l)%r.length],i[l]=c),S(n)?n.bind(t.api)(c,o):c}},generateLevelColor:function(){var t=this.config,e=t.color_pattern,i=t.color_threshold,n="value"===i.unit,a=i.max||100,r=i.values&&i.values.length?i.values:[];return P(i)?function(t){for(var i=n?t:100*t/a,s=e[e.length-1],o=0,c=r.length;o<c;o++)if(i<=r[o]){s=e[o];break}return s}:null},setOverColor:function(t,e){var i=this,n=i.config,a=i.$el.main,r=n.color_onover,s=t?r:i.color;F(s)?s=function(t){var e=t.id;return e in r?r[e]:i.color(e)}:O(s)?s=function(){return r}:S(r)&&(s=s.bind(i.api)),F(e)?a.selectAll("."+l.arc+i.getTargetSelectorSuffix(e.id)).style("fill",s(e)):a.selectAll("."+l.shape+"-"+e).style("fill",s)}},Mt={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",BAR:"bar",BUBBLE:"bubble",DONUT:"donut",GAUGE:"gauge",LINE:"line",PIE:"pie",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step"},Ft={Area:[Mt.AREA,Mt.AREA_SPLINE,Mt.AREA_SPLINE_RANGE,Mt.AREA_LINE_RANGE,Mt.AREA_STEP],AreaRange:[Mt.AREA_SPLINE_RANGE,Mt.AREA_LINE_RANGE],Arc:[Mt.PIE,Mt.DONUT,Mt.GAUGE,Mt.RADAR],Line:[Mt.LINE,Mt.SPLINE,Mt.AREA,Mt.AREA_SPLINE,Mt.AREA_SPLINE_RANGE,Mt.AREA_LINE_RANGE,Mt.STEP,Mt.AREA_STEP],Step:[Mt.STEP,Mt.AREA_STEP],Spline:[Mt.SPLINE,Mt.AREA_SPLINE,Mt.AREA_SPLINE_RANGE]},Bt={getYDomainMinMax:function(t,e){var i=this,n=i.axis,a=i.config,r="min"===e,s=a.data_groups,o=i.mapToIds(t),c=i.getValuesAsIdKeyed(t);return s.length>0&&function(){for(var e,a=i["has"+(r?"Negative":"Positive")+"ValueInTargets"](t),l=function(t,i){if(0===(i=i.filter((function(t){return o.indexOf(t)>=0}))).length)return e=i,"continue";var s=i[0],l=n.getId(s);a&&c[s]&&(c[s]=c[s].map((function(t){return(r?t<0:t>0)?t:0})));for(var u,d=function(t,e){if(!c[e])return"continue";var i=n.getId(e);c[e].forEach((function(t,e){var n=+t;i!==l||a&&(r?n>0:n<0)||(c[s][e]+=n)}))},h=1;u=i[h];h++)d(0,u);e=i},u=0;e=s[u];u++)l(0,e)}(),nt(e,Object.keys(c).map((function(t){return nt(e,c[t])})))},getYDomainMin:function(t){return this.getYDomainMinMax(t,"min")},getYDomainMax:function(t){return this.getYDomainMinMax(t,"max")},isHiddenTargetWithYDomain:function(t){var e=this;return e.state.hiddenTargetIds.some((function(i){return e.axis.getId(i)===t}))},getYDomain:function(t,e,i){var n=this,a=n.axis,r=n.config,s=n.scale,o="axis_"+e;if(n.isStackNormalized())return[0,100];var c=s&&s[e]&&"log"===s[e].type,l=t.filter((function(t){return a.getId(t.id)===e})),u=i?n.filterByXDomain(l,i):l;if(0===u.length)return n.isHiddenTargetWithYDomain(e)?s[e].domain():"y2"===e?s.y.domain():n.getYDomain(t,"y2",i);var d=r[o+"_min"],h=r[o+"_max"],g=n.getYDomainMin(u),f=n.getYDomainMax(u),p=r[o+"_center"],x=[Mt.BAR,Mt.BUBBLE,Mt.SCATTER].concat(Ft.Line).some((function(t){var e=t.indexOf("area")>-1?"area":t;return n.hasType(t,u)&&r[e+"_zerobased"]})),v=r[o+"_inverted"],_=n.hasDataLabel()&&r.axis_rotated,m=n.hasDataLabel()&&!r.axis_rotated;g=w(d)?d:w(h)?g<h?g:h-10:g,f=w(h)?h:w(d)?d<f?f:d+10:f,isNaN(g)&&(g=0),isNaN(f)&&(f=g),g===f&&(g<0?f=0:g=0);var y=g>=0&&f>=0,b=g<=0&&f<=0;(w(d)&&y||w(h)&&b)&&(x=!1),x&&(y&&(g=0),b&&(f=0));var T=Math.abs(f-g),A={top:.1*T,bottom:.1*T};if(C(p)){var S=Math.max(Math.abs(g),Math.abs(f));f=p+S,g=p-S}if(_){var O=I(s.y.range()),L=n.getDataLabelLength(g,f,"width").map((function(t){return t/O}));["bottom","top"].forEach((function(t,e){A[t]+=T*(L[e]/(1-L[0]-L[1]))}))}else if(m){var k=n.getDataLabelLength(g,f,"height");["bottom","top"].forEach((function(t,e){A[t]+=a.convertPixelsToAxisPadding(k[e],T)}))}var E=r[o+"_padding"];P(E)&&["bottom","top"].forEach((function(t){A[t]=a.getPadding(E,t,A[t],T)})),x&&(y&&(A.bottom=g),b&&(A.top=-f));var R=c?[g,f].map((function(t){return t<=0?1:t})):[g-A.bottom,f+A.top];return v?R.reverse():R},getXDomainMinMax:function(t,e){var i=this.config["axis_x_"+e],n=nt(e,t.map((function(t){return nt(e,t.values.map((function(t){return t.x})))}))),a=F(i)?i.value:i;return a=C(a)&&this.axis.isTimeSeries()?ot(a):a,F(i)&&i.fit&&("min"===e&&a<n||"max"===e&&a>n)&&(a=void 0),C(a)?a:n},getXDomainMin:function(t){return this.getXDomainMinMax(t,"min")},getXDomainMax:function(t){return this.getXDomainMinMax(t,"max")},getXDomainPadding:function(t){var e,i,n=this.axis,a=this.config,r=t[1]-t[0],s=a.axis_x_padding;n.isCategorized()?i=0:this.hasType("bar")?i=(e=this.getMaxDataCount())>1?r/(e-1)/2:.5:i=.01*r;var o=i,c=i;return F(s)&&P(s)?(o=w(s.left)?s.left:i,c=w(s.right)?s.right:i):L(a.axis_x_padding)&&(o=s,c=s),{left:o,right:c}},getXDomain:function(t){var e=this,i="log"===e.scale.x.type,n=[e.getXDomainMin(t),e.getXDomainMax(t)],a=0,r=0;if(i)a=n[0],r=n[1];else{var s=e.axis.isCategorized(),o=e.axis.isTimeSeries(),c=e.getXDomainPadding(n),l=n[0],u=n[1];l-u!=0||s||(o?(l=new Date(.5*l.getTime()),u=new Date(1.5*u.getTime())):(l=0===l?1:.5*l,u=0===u?-1:1.5*u)),(l||0===l)&&(a=o?new Date(l.getTime()-c.left):l-c.left),(u||0===u)&&(r=o?new Date(u.getTime()+c.right):u+c.right)}return[a,r]},updateXDomain:function(t,e,i,n,a){var r=this,s=r.config,o=r.org,c=r.scale,l=c.x,u=c.subX,d=s.zoom_enabled;if(i&&(l.domain(a||it(r.getXDomain(t))),o.xDomain=l.domain(),d&&r.zoom.updateScaleExtent(),u.domain(l.domain()),r.brush&&r.brush.scale(u)),e){var h=a||!r.brush||U(r)?o.xDomain:V(r).map(u.invert);l.domain(h),d&&r.zoom.updateScaleExtent()}return n&&l.domain(r.trimXDomain(l.orgDomain())),l.domain()},trimXDomain:function(t){var e=this.getZoomDomain(),i=e[0],n=e[1];return t[0]<=i&&(t[1]=+t[1]+(i-t[0]),t[0]=i),n<=t[1]&&(t[0]=+t[0]-(t[1]-n),t[1]=n),t},getZoomDomain:function(){var t=this.config,e=this.org.xDomain,i=e[0],n=e[1];return C(t.zoom_x_min)&&(i=nt("min",[i,t.zoom_x_min])),C(t.zoom_x_max)&&(n=nt("max",[n,t.zoom_x_max])),[i,n]}};function $t(t,e,i){var n=t.config,a="axis_"+e+"_tick_format";return(n[a]?n[a]:t.defaultValueFormat)(i)}var jt={getYFormat:function(t){var e=this,i=e.yFormat,n=e.y2Format;return t&&!e.hasType("gauge")&&(i=e.defaultArcValueFormat,n=e.defaultArcValueFormat),function(t,a,r){return(e.axis&&"y2"===e.axis.getId(r)?n:i).call(e,t,a)}},yFormat:function(t){return $t(this,"y",t)},y2Format:function(t){return $t(this,"y2",t)},defaultValueFormat:function(t){return w(t)?+t:""},defaultArcValueFormat:function(t,e){return(100*e).toFixed(1)+"%"},dataLabelFormat:function(t){var e=this.config.data_labels,i=function(t){return w(t)?+t:""},n=i;return S(e.format)?n=e.format:X(e.format)&&(n=e.format[t]?!0===e.format[t]?i:e.format[t]:function(){return""}),n.bind(this.api)}},Nt={initLegend:function(){var t=this,e=t.config,i=t.$el;t.legendItemTextBox={},t.state.legendHasRendered=!1,e.legend_show?(!e.legend_contents_bindto&&(i.legend=t.$el.svg.append("g").classed(l.legend,!0).attr("transform",t.getTranslate("legend"))),t.updateLegend()):t.state.hiddenLegendIds=t.mapToIds(t.data.targets)},updateLegend:function(t,e,i){var n=this,a=n.config,r=n.state,s=n.scale,o=n.$el,c=e||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=B(c,"withTransition",!0),c.withTransitionForTransform=B(c,"withTransitionForTransform",!0),a.legend_contents_bindto&&a.legend_contents_template?n.updateLegendTemplate():n.updateLegendElement(t||n.mapToIds(n.data.targets),c,i),o.legend.selectAll("."+l.legendItem).classed(l.legendItemHidden,(function(t){return!n.isTargetToShow(t)})),n.updateScales(!1,!s.zoom),n.updateSvgSize(),n.transformAll(c.withTransitionForTransform,i),r.legendHasRendered=!0},updateLegendTemplate:function(){var t=this,e=t.config,i=t.$el,n=Object(c.select)(e.legend_contents_bindto),a=e.legend_contents_template;if(!n.empty()){var r=t.mapToIds(t.data.targets),s=[],o="";r.forEach((function(e){var i=S(a)?a.bind(t.api)(e,t.color(e),t.api.data(e)[0].values):st(a,{COLOR:t.color(e),TITLE:e});i&&(s.push(e),o+=i)}));var l=n.html(o).selectAll((function(){return this.childNodes})).data(s);t.setLegendItem(l),i.legend=n}},updateSizeForLegend:function(t){var e=this,i=e.config,n=e.state,a=n.isLegendTop,r=n.isLegendLeft,s=n.isLegendRight,o=n.isLegendInset,c=n.current,l=t.width,u=t.height,d={top:a?e.getCurrentPaddingTop()+i.legend_inset_y+5.5:c.height-u-e.getCurrentPaddingBottom()-i.legend_inset_y,left:r?e.getCurrentPaddingLeft()+i.legend_inset_x+.5:c.width-l-e.getCurrentPaddingRight()-i.legend_inset_x+.5};e.state.margin3={top:s?0:o?d.top:c.height-u,right:NaN,bottom:0,left:s?c.width-l:o?d.left:0}},transformLegend:function(t){var e=this.$el.legend;(t?e.transition():e).attr("transform",this.getTranslate("legend"))},updateLegendStep:function(t){this.state.legendStep=t},updateLegendItemWidth:function(t){this.state.legendItemWidth=t},updateLegendItemHeight:function(t){this.state.legendItemHeight=t},updateLegendItemColor:function(t,e){this.$el.legend.select("."+l.legendItem+"-"+t+" line").style("stroke",e)},getLegendWidth:function(){var t=this.state,e=t.current.width,i=t.isLegendRight,n=t.isLegendInset,a=t.legendItemWidth,r=t.legendStep;return this.config.legend_show?i||n?a*(r+1):e:0},getLegendHeight:function(){var t=this.state,e=t.current,i=t.isLegendRight,n=t.legendItemHeight,a=t.legendStep;return this.config.legend_show?i?e.height:Math.max(20,n)*(a+1):0},opacityForLegend:function(t){return t.classed(l.legendItemHidden)?null:"1"},opacityForUnfocusedLegend:function(t){return t.classed(l.legendItemHidden)?null:"0.3"},toggleFocusLegend:function(t,e){var i=this,n=i.$el.legend,a=i.mapToTargetIds(t);n&&n.selectAll("."+l.legendItem).filter((function(t){return a.indexOf(t)>=0})).classed(l.legendItemFocused,e).transition().duration(100).style("opacity",(function(){return(e?i.opacityForLegend:i.opacityForUnfocusedLegend).call(i,Object(c.select)(this))}))},revertLegend:function(){var t=this,e=t.$el.legend;e&&e.selectAll("."+l.legendItem).classed(l.legendItemFocused,!1).transition().duration(100).style("opacity",(function(){return t.opacityForLegend(Object(c.select)(this))}))},showLegend:function(t){var e=this,i=e.config,n=e.$el;i.legend_show||(i.legend_show=!0,n.legend?n.legend.style("visibility","visible"):e.initLegend(),!e.state.legendHasRendered&&e.updateLegend()),e.removeHiddenLegendIds(t),n.legend.selectAll(e.selectorLegends(t)).style("visibility","visible").transition().style("opacity",(function(){return e.opacityForLegend(Object(c.select)(this))}))},hideLegend:function(t){var e=this.config,i=this.$el.legend;e.legend_show&&z(t)&&(e.legend_show=!1,i.style("visibility","hidden")),this.addHiddenLegendIds(t),i.selectAll(this.selectorLegends(t)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox:function(t,e){var i,n=this.cache,a=vt;return t&&(!(i=n.get(a)||{})[t]&&(i[t]=this.getTextRect(e,l.legendItem),n.add(a,i)),i=i[t]),i},setLegendItem:function(t){var e=this,i=e.api,n=e.config,a=e.state,r="touch"===a.inputType,s=e.hasType("gauge");t.attr("class",(function(t){var i=Object(c.select)(this);return(!i.empty()&&i.attr("class")||"")+e.generateClass(l.legendItem,t)})).style("visibility",(function(t){return e.isLegendToShow(t)?"visible":"hidden"})),n.interaction_enabled&&(t.style("cursor","pointer").on("click",(function(t){$(n.legend_item_onclick,i,t)||(c.event.altKey?(i.hide(),i.show(t)):(i.toggle(t),!r&&e.isTargetToShow(t)?i.focus(t):i.revert())),r&&e.hideTooltip()})),!r&&t.on("mouseout",(function(t){$(n.legend_item_onout,i,t)||(Object(c.select)(this).classed(l.legendItemFocused,!1),s&&e.undoMarkOverlapped(e,"."+l.gaugeValue),e.api.revert())})).on("mouseover",(function(t){$(n.legend_item_onover,i,t)||(Object(c.select)(this).classed(l.legendItemFocused,!0),s&&e.markOverlapped(t,e,"."+l.gaugeValue),!a.transiting&&e.isTargetToShow(t)&&i.focus(t))})))},updateLegendElement:function(t,e){var i,n,a,r=this,s=r.config,o=r.state,u=r.$el.legend,d=s.legend_item_tile_width+5,h=0,g=0,f=0,p={},x={},v={},_=[0],m={},y=0,T=o.isLegendRight||o.isLegendInset,A=t.filter((function(t){return!C(s.data_names[t])||null!==s.data_names[t]})),w=e.withTransition,S=function(t,e,i){var n,a=i===A.length-1,c=r.getLegendItemTextBox(e,t),l=c.width+d+(a&&!T?0:10)+s.legend_padding,u=c.height+4,b=T?u:l,w=T?r.getLegendHeight():r.getLegendWidth(),S=function(t,e){e||(n=(w-f-b)/2)<10&&(n=(w-b)/2,f=0,y++),m[t]=y,_[y]=o.isLegendInset?10:n,p[t]=f,f+=b};if(0===i&&(f=0,y=0,h=0,g=0),s.legend_show&&!r.isLegendToShow(e))return x[e]=0,v[e]=0,m[e]=0,void(p[e]=0);x[e]=l,v[e]=u,(!h||l>=h)&&(h=l),(!g||u>=g)&&(g=u);var O=T?g:h;s.legend_equally?(Object.keys(x).forEach((function(t){return x[t]=h})),Object.keys(v).forEach((function(t){return v[t]=g})),(n=(w-O*A.length)/2)<10?(f=0,y=0,A.forEach((function(t){return S(t)}))):S(e,!0)):S(e)};o.isLegendInset&&(y=s.legend_inset_step?s.legend_inset_step:A.length,r.updateLegendStep(y)),o.isLegendRight?(i=function(t){return h*m[t]},n=function(t){return _[m[t]]+p[t]}):o.isLegendInset?(i=function(t){return h*m[t]+10},n=function(t){return _[m[t]]+p[t]}):(i=function(t){return _[m[t]]+p[t]},n=function(t){return g*m[t]});var O=function(t,e){return i(t,e)+4+s.legend_item_tile_width},L=function(t,e){return i(t,e)},k=function(t,e){return i(t,e)-2},E=function(t,e){return i(t,e)-2+s.legend_item_tile_width},R=function(t,e){return n(t,e)+9},D=function(t,e){return n(t,e)-5},I=function(t,e){return n(t,e)+4},X=u.selectAll("."+l.legendItem).data(A).enter().append("g");r.setLegendItem(X),X.append("text").text((function(t){return C(s.data_names[t])?s.data_names[t]:t})).each((function(t,e){S(this,t,e)})).style("pointer-events","none").attr("x",T?O:-200).attr("y",T?-200:R),X.append("rect").attr("class",l.legendItemEvent).style("fill-opacity","0").attr("x",T?L:-200).attr("y",T?-200:D);var z=s.legend_usePoint;if(z){var M=[];X.append((function(t){var e=P(s.point_pattern)?s.point_pattern:[s.point_type];-1===M.indexOf(t)&&M.push(t);var i=e[M.indexOf(t)%e.length];return"rectangle"===i&&(i="rect"),b.createElementNS(c.namespaces.svg,r.hasValidPointType(i)?i:"use")})).attr("class",l.legendItemPoint).style("fill",(function(t){return r.color(t)})).style("pointer-events","none").attr("href",(function(t,e,i){return"use"===i[e].nodeName.toLowerCase()?"#"+o.datetimeId+"-point-"+t:void 0}))}else X.append("line").attr("class",l.legendItemTile).style("stroke",r.color).style("pointer-events","none").attr("x1",T?k:-200).attr("y1",T?-200:I).attr("x2",T?E:-200).attr("y2",T?-200:I).attr("stroke-width",s.legend_item_tile_height);a=u.select("."+l.legendBackground+" rect"),o.isLegendInset&&h>0&&0===a.size()&&(a=u.insert("g","."+l.legendItem).attr("class",l.legendBackground).append("rect"));var F=u.selectAll("text").data(A).text((function(t){return C(s.data_names[t])?s.data_names[t]:t})).each((function(t,e){S(this,t,e)}));(w?F.transition():F).attr("x",O).attr("y",R);var B=u.selectAll("rect."+l.legendItemEvent).data(A);if((w?B.transition():B).attr("width",(function(t){return x[t]})).attr("height",(function(t){return v[t]})).attr("x",L).attr("y",D),z){var $=u.selectAll("."+l.legendItemPoint).data(A);(w?$.transition():$).each((function(){var t,e,i,n=this.nodeName.toLowerCase(),a=s.point_r,r="x",o="y",l=2,u=2.5;if("circle"===n){var d=.2*a;r="cx",o="cy",t=a+d,l=2*a,u=-d}else if("rect"===n){var h=2.5*a;e=h,i=h,u=3}Object(c.select)(this).attr(r,(function(t){return k(t)+l})).attr(o,(function(t){return I(t)-u})).attr("r",t).attr("width",e).attr("height",i)}))}else{var j=u.selectAll("line."+l.legendItemTile).data(A);(w?j.transition():j).style("stroke",r.levelColor?function(t){return r.levelColor(r.cache.get(t).values[0].value)}:r.color).attr("x1",k).attr("y1",I).attr("x2",E).attr("y2",I)}a&&(w?a.transition():a).attr("height",r.getLegendHeight()-12).attr("width",h*(y+1)+10),r.updateLegendItemWidth(h),r.updateLegendItemHeight(g),r.updateLegendStep(y)}},Yt=i(8),Gt={redraw:function(t,e){void 0===t&&(t={});var i=this,n=i.config,a=i.state,r=i.$el,s=r.main,o=i.filterTargetsToShow(i.data.targets),c=t.initializing,u=t.flow,d=i.getWithOption(t),h=d.Transition?n.transition_duration:0,g=d.TransitionForExit?h:0,f=d.TransitionForAxis?h:0,p=e||i.axis&&i.axis.generateTransitions(f);i.updateSizes(c),d.Legend&&n.legend_show?i.updateLegend(i.mapToIds(i.data.targets),t,p):d.Dimension&&i.updateDimension(!0),(!i.hasArcType()||a.hasRadar)&&i.updateCircleY&&i.updateCircleY(),a.hasAxis?(i.axis.redrawAxis(o,d,p,u,c),n.data_empty_label_text&&s.select("text."+l.text+"."+l.empty).attr("x",a.width/2).attr("y",a.height/2).text(n.data_empty_label_text).style("display",o.length?"none":null),i.hasGrid()&&i.updateGrid(h),n.regions.length&&i.updateRegion(h),i.hasType("bar")&&i.updateBar(g),i.hasTypeOf("Line")&&i.updateLine(g),i.hasTypeOf("Area")&&i.updateArea(g),r.text&&s.selectAll("."+l.selectedCircles).filter(i.isBarType.bind(i)).selectAll("circle").remove(),n.interaction_enabled&&!u&&d.EventRect&&(i.redrawEventRect(),i.bindZoomEvent&&i.bindZoomEvent())):(r.arcs&&i.redrawArc(h,g,d.Transform),r.radar&&i.redrawRadar(g)),!a.resizing&&(i.hasPointType()||a.hasRadar)&&i.updateCircle(),i.hasDataLabel()&&!i.hasArcType(null,["radar"])&&i.updateText(g),i.redrawTitle&&i.redrawTitle(),c&&i.updateTypesElements(),i.generateRedrawList(o,u,h,d.Subchart),i.callPluginHook("$redraw",t,h)},generateRedrawList:function(t,e,i,n){var a=this,r=a.config,s=a.state,o=a.getDrawShape();s.hasAxis&&r.subchart_show&&a.redrawSubchart(n,i,o);var c=e&&a.generateFlow({targets:t,flow:e,duration:e.duration,shape:o,xv:a.xv.bind(a)}),l=(i||c)&&ct(),u=a.getRedrawList(o,e,c,l),d=e||r.onrendered?function(){c&&c(),$(r.onrendered,a.api)}:null;if(d)if(l&&u.length){var h=St();Object(Yt.transition)().duration(i).each((function(){u.reduce((function(t,e){return t.concat(e)}),[]).forEach((function(t){return h.add(t)}))})).call(h,d)}else s.transiting||d();a.mapToIds(a.data.targets).forEach((function(t){s.withoutFadeIn[t]=!0}))},getRedrawList:function(t,e,i,n){var a=this,r=a.config,s=a.state,o=s.hasAxis,c=s.hasRadar,l=a.$el.grid,u=t.pos,d=u.cx,h=u.cy,g=u.xForText,f=u.yForText,p=[];if(o){var x=t.type,v=x.area,_=x.bar,m=x.line;(r.grid_x_lines.length||r.grid_y_lines.length)&&p.push(a.redrawGrid(n)),r.regions.length&&p.push(a.redrawRegion(n)),a.hasTypeOf("Line")&&p.push(a.redrawLine(m,n)),a.hasTypeOf("Area")&&p.push(a.redrawArea(v,n)),a.hasType("bar")&&p.push(a.redrawBar(_,n)),!e&&l.main&&p.push(a.updateGridFocus())}return(!a.hasArcType()||c)&&P(r.data_labels)&&!1!==r.data_labels&&p.push(a.redrawText(g,f,e,n)),(a.hasPointType()||c)&&!r.point_focus_only&&a.redrawCircle&&p.push(a.redrawCircle(d,h,n,i)),p},updateAndRedraw:function(t){void 0===t&&(t={});var e,i=this,n=i.config,a=i.state;t.withTransition=B(t,"withTransition",!0),t.withTransform=B(t,"withTransform",!1),t.withLegend=B(t,"withLegend",!1),t.withUpdateXDomain=!0,t.withUpdateOrgXDomain=!0,t.withTransitionForExit=!1,t.withTransitionForTransform=B(t,"withTransitionForTransform",t.withTransition),t.withLegend&&n.legend_show||(a.hasAxis&&(e=i.axis.generateTransitions(t.withTransitionForAxis?n.transition_duration:0)),i.updateScales(),i.updateSvgSize(),i.transformAll(t.withTransitionForTransform,e)),i.redraw(t,e)},redrawWithoutRescale:function(){this.redraw({withY:!1,withSubchart:!1,withEventRect:!1,withTransitionForAxis:!1})}};function Vt(t,e,i){void 0===t&&(t="linear"),void 0===e&&(e=0),void 0===i&&(i=1);var n={linear:Xt.scaleLinear,log:Xt.scaleLog,time:Xt.scaleTime}[t]();return n.type=t,"log"===t&&n.clamp(!0),n.range([e,i])}var Ht={getXScale:function(t,e,i,n){var a=this.scale.zoom||Vt(this.axis.getAxisType("x"),t,e);return this.getCustomizedScale(i?a.domain(i):a,n)},getYScale:function(t,e,i){var n=Vt(this.axis.getAxisType("y"),t,e);return i&&n.domain(i),n},getYScaleById:function(t,e){void 0===e&&(e=!1);var i="y2"===this.axis.getId(t),n=e?i?"subY2":"subY":i?"y2":"y";return this.scale[n]},getCustomizedScale:function(t,e){var i=this,n=e||function(){return i.axis.x.tickOffset()},a=function(e,i){var a=t(e)+n();return i?a:Math.ceil(a)};for(var r in t)a[r]=t[r];return a.orgDomain=function(){return t.domain()},a.orgScale=function(){return t},i.axis.isCategorized()&&(a.domain=function(e){var i=e;return arguments.length?(t.domain(i),a):[(i=this.orgDomain())[0],i[1]+1]}),a},updateScales:function(t,e){void 0===e&&(e=!0);var i=this,n=i.axis,a=i.config,r=i.format,s=i.org,o=i.scale,c=i.state,l=c.width,u=c.height,d=c.width2,h=c.height2;if(c.hasAxis){var g=a.axis_rotated,f={x:g?1:0,y:g?0:u,subX:g?1:0,subY:g?0:h},p={x:g?u:l,y:g?l:1,subX:g?u:l,subY:g?d:1},x=e&&o.x&&o.x.orgDomain(),v=e&&s.xDomain;o.x=i.getXScale(f.x,p.x,x,(function(){return n.x.tickOffset()})),o.subX=i.getXScale(f.x,p.x,v,(function(t){return t%1?0:n.subX.tickOffset()})),r.xAxisTick=n.getXAxisTickFormat(),n.setAxis("x",o.x,a.axis_x_tick_outer,t),a.subchart_show&&n.setAxis("subX",o.subX,a.axis_x_tick_outer,t),o.y=i.getYScale(f.y,p.y,o.y?o.y.domain():a.axis_y_default),o.subY=i.getYScale(f.subY,p.subY,o.subY?o.subY.domain():a.axis_y_default),n.setAxis("y",o.y,a.axis_y_tick_outer,t),a.axis_y2_show&&(o.y2=i.getYScale(f.y,p.y,o.y2?o.y2.domain():a.axis_y2_default),o.subY2=i.getYScale(f.subY,p.subY,o.subY2?o.subY2.domain():a.axis_y2_default),n.setAxis("y2",o.y2,a.axis_y2_tick_outer,t))}else i.updateArc&&i.updateArc()},xx:function(t){var e=this.config,i=this.scale,n=i.x,a=i.zoom,r=e.zoom_enabled&&a?a:n;return t?r(w(t.x)?t.x:t):null},xv:function(t){var e=this,i=e.axis,n=e.config,a=e.scale.x,r=e.getBaseValue(t);return i.isTimeSeries()?r=ot.call(e,r):i.isCategorized()&&O(r)&&(r=n.axis_x_categories.indexOf(r)),Math.ceil(a(r))},yv:function(t){var e=this.scale,i=e.y,n=e.y2,a=t.axis&&"y2"===t.axis?n:i;return Math.ceil(a(this.getBaseValue(t)))},subxx:function(t){return t?this.scale.subX(t.x):null}},Wt=i(9),Ut={getDrawShape:function(){var t=this,e=t.config.axis_rotated,i=t.state.hasRadar,n={type:{},indices:{},pos:{}};if(t.hasTypeOf("Line")||t.hasType("bubble")||t.hasType("scatter")){var a=t.getShapeIndices(t.isLineType);if(n.indices.line=a,n.type.line=t.generateDrawLine?t.generateDrawLine(a,!1):void 0,t.hasTypeOf("Area")){var r=t.getShapeIndices(t.isAreaType);n.indices.area=r,n.type.area=t.generateDrawArea?t.generateDrawArea(r,!1):void 0}}if(t.hasType("bar")){var s=t.getShapeIndices(t.isBarType);n.indices.bar=s,n.type.bar=t.generateDrawBar?t.generateDrawBar(s):void 0}if(!t.hasArcType()||i){var o=i?t.radarCircleX:e?t.circleY:t.circleX,c=i?t.radarCircleY:e?t.circleX:t.circleY;n.pos={xForText:t.generateXYForText(n.indices,!0),yForText:t.generateXYForText(n.indices,!1),cx:(o||function(){}).bind(t),cy:(c||function(){}).bind(t)}}return n},getShapeIndices:function(t){var e=this.config,i=e.data_xs,n=P(i),a={},r=n?{}:0;return n&&Q(Object.keys(i).map((function(t){return i[t]}))).forEach((function(t){r[t]=0,a[t]={}})),this.filterTargetsToShow(this.data.targets.filter(t,this)).forEach((function(t){for(var n,s=(t.id in i?i[t.id]:""),o=s?a[s]:a,c=0;n=e.data_groups[c];c++)if(!(n.indexOf(t.id)<0))for(var l,u=0;l=n[u];u++)if(l in o){o[t.id]=o[l];break}k(o[t.id])&&(o[t.id]=s?r[s]++:r++,o.__max__=(s?r[s]:r)-1)})),a},getIndices:function(t,e){var i=this.config.data_xs;return P(i)?t[i[e]]:t},getIndicesMax:function(t){return P(this.config.data_xs)?Object.keys(t).map((function(e){return t[e].__max__||0})).reduce((function(t,e){return t+e})):t.__max__},getShapeX:function(t,e,i){var n=this,a=n.config,r=n.scale,s=i?r.subX:r.zoom||r.x,o=a.bar_padding,c=function(t,e){return t+e},l=X(t)&&t.total.length?t.total.reduce(c)/2:0;return function(i){var a=n.getIndices(e,i.id),r=i.id in a?a[i.id]:0,u=(a.__max__||0)+1,d=0;if(P(i.x)){var h=s(i.x);d=l?h-(t[i.id]||t.width)+t.total.slice(0,r+1).reduce(c)-l:h-(L(t)?t:t.width)*(u/2-r)}return t&&d&&u>1&&o&&(r&&(d+=o*r),u>2?d-=(u-1)*o/2:2===u&&(d-=o/2)),d}},getShapeY:function(t){var e=this,i=e.isStackNormalized();return function(n){var a=i?e.getRatio("index",n,!0):e.isBubbleZType(n)?e.getBubbleZData(n.value,"y"):n.value;return e.getYScaleById(n.id,t)(a)}},getShapeYMin:function(t){var e=this.scale[this.axis.getId(t)].domain()[0];return!this.isGrouped(t)&&e>0?e:0},getShapeOffsetData:function(t){var e=this,i=e.orderTargets(e.filterTargetsToShow(e.data.targets.filter(t,e))),n=e.isStackNormalized(),a=i.map((function(t){var i=t.values,a={};e.isStepType(t)&&(i=e.convertValuesToStep(i));var r=i.reduce((function(t,i){var r=+i.x;return t[r]=i,a[r]=n?e.getRatio("index",i,!0):i.value,t}),{});return{id:t.id,rowValues:i,rowValueMapByXValue:r,values:a}}));return{indexMapByTargetId:i.reduce((function(t,e,i){return t[e.id]=i,t}),{}),shapeOffsetTargets:a}},getShapeOffset:function(t,e,i){var n=this,a=n.getShapeOffsetData(t),r=a.shapeOffsetTargets,s=a.indexMapByTargetId;return function(t,a){var o=n.getIndices(e,t.id),c=n.getYScaleById(t.id,i),l=c(n.getShapeYMin(t.id)),u=+t.x,d=l;return r.filter((function(e){return e.id!==t.id})).forEach((function(e){if(o[e.id]===o[t.id]&&s[e.id]<s[t.id]){var i=e.rowValues[a];i&&+i.x===u||(i=e.rowValueMapByXValue[u]),i&&i.value*t.value>=0&&(d+=c(e.values[u])-l)}})),d}},isWithinShape:function(t,e){var i,n=this,a=Object(c.select)(t);return n.isTargetToShow(e.id)?n.hasValidPointType(t.nodeName)?i=n.isStepType(e)?n.isWithinStep(t,n.getYScaleById(e.id)(e.value)):n.isWithinCircle(t,n.isBubbleType(e)?1.5*n.pointSelectR(e):0):"path"===t.nodeName&&(i=!a.classed(l.bar)||n.isWithinBar(t)):i=!1,i},getInterpolate:function(t){var e=this.getInterpolateType(t);return{basis:Wt.curveBasis,"basis-closed":Wt.curveBasisClosed,"basis-open":Wt.curveBasisOpen,bundle:Wt.curveBundle,cardinal:Wt.curveCardinal,"cardinal-closed":Wt.curveCardinalClosed,"cardinal-open":Wt.curveCardinalOpen,"catmull-rom":Wt.curveCatmullRom,"catmull-rom-closed":Wt.curveCatmullRomClosed,"catmull-rom-open":Wt.curveCatmullRomOpen,"monotone-x":Wt.curveMonotoneX,"monotone-y":Wt.curveMonotoneY,natural:Wt.curveNatural,"linear-closed":Wt.curveLinearClosed,linear:Wt.curveLinear,step:Wt.curveStep,"step-after":Wt.curveStepAfter,"step-before":Wt.curveStepBefore}[e]},getInterpolateType:function(t){var e=this.config,i=e.spline_interpolation_type,n=this.isInterpolationType(i)?i:"cardinal";return this.isSplineType(t)?n:this.isStepType(t)?e.line_step_type:"linear"}},Zt={setContainerSize:function(){var t=this.state;t.current.width=this.getCurrentWidth(),t.current.height=this.getCurrentHeight()},getCurrentWidth:function(){return this.config.size_width||this.getParentWidth()},getCurrentHeight:function(){var t=this.config,e=t.size_height||this.getParentHeight();return e>0?e:320/(this.hasType("gauge")&&!t.gauge_fullCircle?2:1)},getCurrentPaddingTop:function(){var t=this,e=t.config,i=t.state.hasAxis,n=t.$el,a=i?e.axis_y2_axes.length:0,r=w(e.padding_top)?e.padding_top:0;return n.title&&n.title.node()&&(r+=t.getTitlePadding()),a&&e.axis_rotated&&(r+=t.getHorizontalAxisHeight("y2")*a),r},getCurrentPaddingBottom:function(){var t=this.config,e=this.state.hasAxis,i=t.axis_rotated?"y":"x",n=e?t["axis_"+i+"_axes"].length:0;return(w(t.padding_bottom)?t.padding_bottom:0)+(n?this.getHorizontalAxisHeight(i)*n:0)},getCurrentPaddingLeft:function(t){var e=this.config,i=this.state.hasAxis,n=e.axis_rotated,a=n?"x":"y",r=i?e["axis_"+a+"_axes"].length:0,s=i?this.getAxisWidthByAxisId(a,t):0;return(w(e.padding_left)?e.padding_left:i&&n?e.axis_x_show?Math.max(R(s),40):1:!i||e.axis_y_show&&!e.axis_y_inner?R(s):this.axis.getAxisLabelPosition("y").isOuter?30:1)+s*r},getCurrentPaddingRight:function(t){void 0===t&&(t=!1);var e=this,i=e.config,n=e.state.hasAxis,a=e.state.isLegendRight?e.getLegendWidth()+20:0,r=n?i.axis_y2_axes.length:0,s=n?e.getAxisWidthByAxisId("y2"):0,o=t?0:e.axis.getXAxisTickTextY2Overflow(10);return(w(i.padding_right)?i.padding_right+1:e.axis&&i.axis_rotated?10+a:!e.axis||i.axis_y2_show&&!i.axis_y2_inner?Math.max(R(s)+a,o):Math.max(2+a+(e.axis.getAxisLabelPosition("y2").isOuter?20:0),o))+s*r},getParentRectValue:function(t){for(var e,i="offset"+q(t),n=this.$el.chart.node();!e&&n&&"BODY"!==n.tagName;){try{e=n.getBoundingClientRect()[t]}catch(t){i in n&&(e=n[i])}n=n.parentNode}if("width"===t){var a=b.body.offsetWidth;e>a&&(e=a)}return e},getParentWidth:function(){return this.getParentRectValue("width")},getParentHeight:function(){var t=this.$el.chart.style("height");return t.indexOf("px")>0?parseInt(t,10):0},getSvgLeft:function(t){var e=this.config,i=this.$el,n=e.axis_rotated||!e.axis_rotated&&!e.axis_y_inner,a=e.axis_rotated?l.axisX:l.axisY,r=i.main.select("."+a).node(),s=r&&n?r.getBoundingClientRect():{right:0},o=i.chart.node().getBoundingClientRect(),c=this.hasArcType(),u=s.right-o.left-(c?0:this.getCurrentPaddingLeft(t));return u>0?u:0},updateDimension:function(t){var e=this,i=e.config,n=e.state.hasAxis,a=e.$el;n&&!t&&(e.axis.x&&i.axis_rotated?(e.axis.x.create(a.axis.x),e.axis.subX&&e.axis.subX.create(a.axis.subX)):(e.axis.y&&e.axis.y.create(a.axis.y),e.axis.y2&&e.axis.y2.create(a.axis.y2))),e.updateScales(t),e.updateSvgSize(),e.transformAll(!1)},updateSvgSize:function(){var t=this,e=t.state,i=e.clip,n=e.current,a=e.hasAxis,r=e.width,s=e.height,o=t.$el.svg;if(o.attr("width",n.width).attr("height",n.height),a){var c=o.select("."+l.brush+" .overlay"),u={width:0,height:0};c.size()&&(u.width=+c.attr("width"),u.height=+c.attr("height")),o.selectAll(["#"+i.id,"#"+i.idGrid]).select("rect").attr("width",r).attr("height",s),o.select("#"+i.idXAxis).select("rect").call(t.setXAxisClipPath.bind(t)),o.select("#"+i.idYAxis).select("rect").call(t.setYAxisClipPath.bind(t)),i.idSubchart&&o.select("#"+i.idSubchart).select("rect").attr("width",r).attr("height",u.height)}},updateSizes:function(t){var e=this,i=e.config,n=e.state,a=e.$el.legend,r=i.axis_rotated,s=e.hasArcType();t||e.setContainerSize();var o={width:a?e.getLegendWidth():0,height:a?e.getLegendHeight():0},c=n.isLegendRight||n.isLegendInset?0:o.height,l=r||s?0:e.getHorizontalAxisHeight("x"),u=i.subchart_axis_x_show&&i.subchart_axis_x_tick_text_show?l:30,d=i.subchart_show&&!s?i.subchart_size_height+u:0;n.margin=!s&&r?{top:e.getHorizontalAxisHeight("y2")+e.getCurrentPaddingTop(),right:s?0:e.getCurrentPaddingRight(),bottom:e.getHorizontalAxisHeight("y")+c+e.getCurrentPaddingBottom(),left:d+(s?0:e.getCurrentPaddingLeft())}:{top:4+e.getCurrentPaddingTop(),right:s?0:e.getCurrentPaddingRight(),bottom:l+d+c+e.getCurrentPaddingBottom(),left:s?0:e.getCurrentPaddingLeft()},n.margin2=r?{top:n.margin.top,right:NaN,bottom:20+c,left:e.state.rotatedPadding.left}:{top:n.current.height-d-c,right:NaN,bottom:u+c,left:n.margin.left},n.margin3={top:0,right:NaN,bottom:0,left:0},e.updateSizeForLegend&&e.updateSizeForLegend(o),n.width=n.current.width-n.margin.left-n.margin.right,n.height=n.current.height-n.margin.top-n.margin.bottom,n.width<0&&(n.width=0),n.height<0&&(n.height=0),n.width2=r?n.margin.left-n.rotatedPadding.left-n.rotatedPadding.right:n.width,n.height2=r?n.height:n.current.height-n.margin2.top-n.margin2.bottom,n.width2<0&&(n.width2=0),n.height2<0&&(n.height2=0);var h=e.hasType("gauge"),g=i.legend_show&&n.isLegendRight;n.arcWidth=n.width-(g?o.width+10:0),n.arcHeight=n.height-(g&&!h?0:10),h&&!i.gauge_fullCircle&&(n.arcHeight+=n.height-e.getPaddingBottomForGauge()),e.updateRadius&&e.updateRadius(),n.isLegendRight&&s&&(n.margin3.left=n.arcWidth/2+1.1*n.radiusExpanded),!s&&i.axis_x_show&&i.axis_x_tick_autorotate&&e.updateXAxisTickClip()}},qt={opacityForText:function(t){return this.isBarType(t)&&!this.meetsLabelThreshold(Math.abs(this.getRatio("bar",t)),"bar")?"0":this.hasDataLabel?"1":"0"},initText:function(){this.$el.main.select("."+l.chart).append("g").attr("class",l.chartTexts)},updateTargetsForText:function(t){var e=this,i=e.classChartText.bind(e),n=e.classTexts.bind(e),a=e.classFocus.bind(e);e.$el.main.select("."+l.chartTexts).selectAll("."+l.chartText).data(t).attr("class",(function(t){return i(t)+a(t)})).enter().append("g").style("opacity","0").attr("class",i).style("pointer-events","none").append("g").attr("class",n)},updateText:function(t){var e=this,i=e.config,n=e.$el,a=e.labelishData.bind(e),r=e.classText.bind(e);n.text=n.main.selectAll("."+l.texts).selectAll("."+l.text).data((function(t){return e.isRadarType(t)?t.values:a(t)})),n.text.exit().transition().duration(t).style("fill-opacity","0").remove(),n.text=n.text.enter().append("text").merge(e.$el.text).attr("class",r).attr("text-anchor",(function(t){return i.axis_rotated?t.value<0?"end":"start":"middle"})).style("fill",e.updateTextColor.bind(e)).style("fill-opacity","0").text((function(t,i,n){var a=e.isBubbleZType(t)?e.getBubbleZData(t.value,"z"):t.value;return e.dataLabelFormat(t.id)(a,t.id,i,n)}))},updateTextColor:function(t){var e,i=this.config.data_labels_colors;if(O(i))e=i;else if(F(i)){e=i[(t.data||t).id]}return e||(this.isArcType(t)&&!this.isRadarType(t)?null:this.color(t))},redrawText:function(t,e,i,n){var a=this,r=W(),s=i?0:a.opacityForText.bind(a);return a.$el.text.each((function(i,o){var l=this,u=Object(c.select)(this);(n&&u.attr("x")?u.transition(r):u).attr("x",t.bind(this)(i,o)).attr("y",(function(t){return e.bind(l)(t,o)})).style("fill",a.updateTextColor.bind(a)).style("fill-opacity",s)})),!0},getTextRect:function(t,e){var i=t.node?t.node():t;/text/i.test(i.tagName)||(i=i.querySelector("text"));var n=i.textContent,a=bt+"-"+n.replace(/\W/g,"_"),r=this.cache.get(a);return r||(this.$el.svg.append("text").style("visibility","hidden").style("font",Object(c.select)(i).style("font")).classed(e,!0).text(n).call((function(t){r=H(t.node())})).remove(),this.cache.add(a,r)),r},generateXYForText:function(t,e){var i=this,n=Object.keys(t),a={},r=e?i.getXForText:i.getYForText;return i.hasType("radar")&&n.push("radar"),n.forEach((function(e){a[e]=i["generateGet"+q(e)+"Points"](t[e],!1)})),function(t,e){var n=(i.isAreaType(t)?"area":i.isBarType(t)&&"bar")||i.isRadarType(t)&&"radar"||"line";return r.call(i,a[n](t,e),t,this)}},getCenteredTextPos:function(t,e,i){var n=this.config,a=n.axis_rotated;if(n.data_labels.centered&&this.isBarType(t)){var r=H(i),s=t.value>=0;if(a){var o=(s?e[1][1]-e[0][1]:e[0][1]-e[1][1])/2+r.width/2;return s?-o-3:o+2}var c=(s?e[0][1]-e[1][1]:e[1][1]-e[0][1])/2+r.height/2;return s?c:-c-2}return 0},getTextPos:function(t,e){var i=this.config.data_labels_position;return(t in i?i[t]:i)[e]||0},getXForText:function(t,e,i){var n,a,r=this,s=r.config,o=r.state,c=s.axis_rotated;if(c?(a=r.isBarType(e)?4:6,n=t[2][1]+a*(e.value<0?-1:1)):n=r.hasType("bar")?(t[2][0]+t[0][0])/2:t[0][0],null===e.value)if(n>o.width){var l=H(i).width;n=o.width-l}else n<0&&(n=4);return c&&(n+=r.getCenteredTextPos(e,t,i)),n+r.getTextPos(e.id,"x")},getYForText:function(t,e,i){var n,a=this,r=a.config,s=a.state,o=r.axis_rotated,c=r.point_r,l=H(i),u=3;if(o)n=(t[0][0]+t[2][0]+.6*l.height)/2;else if(n=t[2][1],L(c)&&c>5&&(a.isLineType(e)||a.isScatterType(e))&&(u+=r.point_r/2.3),e.value<0||0===e.value&&!s.hasPositiveValue&&s.hasNegativeValue)n+=l.height+(a.isBarType(e)?-u:u);else{var d=2*-u;a.isBarType(e)?d=-u:a.isBubbleType(e)&&(d=u),n+=d}if(null===e.value&&!o){var h=l.height;n<h?n=h:n>s.height&&(n=s.height-4)}return o||(n+=a.getCenteredTextPos(e,t,i)),n+a.getTextPos(e.id,"y")},markOverlapped:function(t,e,i){var n=e.$el.arcs.selectAll(i),a=n.filter((function(e){return e.data.id!==t})),r=n.filter((function(e){return e.data.id===t})),s=J(r.node()),o=function(t,e){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2))};r.node()&&a.each((function(){var t=J(this),e=Object(c.select)(this),i=o(s.e,s.f)>o(t.e,t.f)?r:e,n=Math.ceil(Math.abs(s.e-t.e))<Math.ceil(i.node().getComputedTextLength()),a=Math.ceil(Math.abs(s.f-t.f))<parseInt(r.style("font-size"),10);e.classed(l.TextOverlapping,n&&a)}))},undoMarkOverlapped:function(t,e){t.$el.arcs.selectAll(e).each((function(){Object(c.selectAll)([this,this.previousSibling]).classed(l.TextOverlapping,!1)}))},meetsLabelThreshold:function(t,e){void 0===t&&(t=0);return t>=(this.config[e+"_label_threshold"]||0)}};function Kt(t,e){void 0===t&&(t="left");var i=L(e);return t.indexOf("center")>-1?i?e/2:"middle":t.indexOf("right")>-1?i?e:"end":i?0:"start"}var Jt={initTitle:function(){var t=this.config,e=this.$el;t.title_text&&(e.title=e.svg.append("g"),Y(e.title.append("text").style("text-anchor",Kt(t.title_position)).attr("class",l.title),t.title_text,[.3,1.5]))},redrawTitle:function(){var t=this,e=t.config,i=t.state.current,n=t.$el.title;if(n){var a=t.yForTitle.call(t);/g/i.test(n.node().tagName)?n.attr("transform","translate("+Kt(e.title_position,i.width)+", "+a+")"):n.attr("x",t.xForTitle.call(t)).attr("y",a)}},xForTitle:function(){var t,e=this.config,i=this.state.current,n=e.title_position||"left",a=this.getTextRect(this.$el.title,l.title).width;return/(right|center)/.test(n)?(t=i.width-a,n.indexOf("right")>=0?t=i.width-a-e.title_padding.right:n.indexOf("center")>=0&&(t=(i.width-a)/2)):t=e.title_padding.left||0,t},yForTitle:function(){return(this.config.title_padding.top||0)+this.getTextRect(this.$el.title,l.title).height},getTitlePadding:function(){return this.yForTitle()+(this.config.title_padding.bottom||0)}},Qt={initTooltip:function(){var t=this,e=t.config,i=t.$el,n=e.tooltip_contents.bindto;if(i.tooltip=Object(c.select)(n),i.tooltip.empty()&&(i.tooltip=i.chart.style("position","relative").append("div").attr("class",l.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),e.tooltip_init_show){if(t.axis.isTimeSeries()&&O(e.tooltip_init_x)){var a,r,s=t.data.targets[0];for(e.tooltip_init_x=ot.call(t,e.tooltip_init_x),a=0;(r=s.values[a])&&r.x-e.tooltip_init_x!=0;a++);e.tooltip_init_x=a}i.tooltip.html(t.getTooltipHTML(t.data.targets.map((function(i){return t.addName(i.values[e.tooltip_init_x])})),t.axis.getXAxisTickFormat(),t.getYFormat(t.hasArcType(null,["radar"])),t.color)),n||i.tooltip.style("top",e.tooltip_init_position.top).style("left",e.tooltip_init_position.left).style("display","block")}t.bindTooltipResizePos()},getTooltipHTML:function(){var t=this,e=t.api,i=t.config;return S(i.tooltip_contents)?i.tooltip_contents.bind(e).apply(void 0,arguments):t.getTooltipContent.apply(t,arguments)},getTooltipContent:function(t,e,i,n){var a=this,r=a.api,s=a.config,o=["title","name","value"].map((function(t){var e=s["tooltip_format_"+t];return S(e)?e.bind(r):e})),c=o[0],u=o[1],d=o[2];c=c||e,u=u||function(t){return t},d=d||(a.isStackNormalized()?function(t,e){return(100*e).toFixed(2)+"%"}:i);var h=s.tooltip_order,g=function(t){return a.axis&&a.isBubbleZType(t)?a.getBubbleZData(t.value,"z"):a.getBaseValue(t)},f=a.levelColor?function(t){return a.levelColor(t.value)}:function(t){return n(t)},p=s.tooltip_contents,x=p.template,v=a.mapToTargetIds();if(null===h&&s.data_groups.length){var _=a.orderTargets(a.data.targets).map((function(t){return t.id})).reverse();t.sort((function(t,e){var i=t?t.value:null,n=e?e.value:null;return i>0&&n>0&&(i=t.id?_.indexOf(t.id):null,n=e.id?_.indexOf(e.id):null),i-n}))}else/^(asc|desc)$/.test(h)?t.sort((function(t,e){var i=t?g(t):null,n=e?g(e):null;return"asc"===h?i-n:n-i})):S(h)&&t.sort(h.bind(r));var m,y,b,T,A,O=a.getTooltipContentTemplate(x),L=t.length;for(A=0;A<L;A++)if((y=t[A])&&(g(y)||0===g(y))){if(k(m)){var C=N(c?c(y.x):y.x);m=st(O[0],{CLASS_TOOLTIP:l.tooltip,TITLE:w(C)?x?C:'<tr><th colspan="2">'+C+"</th></tr>":""})}if(b=[y.ratio,y.id,y.index,t],T=N(d.apply(void 0,[g(y)].concat(b))),a.isAreaRangeType(y)){var E=["high","low"].map((function(t){return N(d.apply(void 0,[a.getAreaRangeData(y,t)].concat(b)))})),R=E[0],D=E[1];T="<b>Mid:</b> "+T+" <b>High:</b> "+R+" <b>Low:</b> "+D}if(void 0!==T)if("continue"===function(){if(null===y.name)return"continue";var t=N(u.apply(void 0,[y.name].concat(b))),e=f(y),i={CLASS_TOOLTIP_NAME:l.tooltipName+a.getTargetSelectorSuffix(y.id),COLOR:x||!a.patterns?e:'<svg><rect style="fill:'+e+'" width="10" height="10"></rect></svg>',NAME:t,VALUE:T};if(x&&F(p.text)){var n=v.indexOf(y.id);Object.keys(p.text).forEach((function(t){i[t]=p.text[t][n]}))}m+=st(O[1],i)}())continue}return m+"</table>"},getTooltipContentTemplate:function(t){return(t||'<table class="{=CLASS_TOOLTIP}"><tbody>\n\t\t\t\t{=TITLE}\n\t\t\t\t{{<tr class="{=CLASS_TOOLTIP_NAME}">\n\t\t\t\t\t<td class="name">'+(this.patterns?"{=COLOR}":'<span style="background-color:{=COLOR}"></span>')+'{=NAME}</td>\n\t\t\t\t\t<td class="value">{=VALUE}</td>\n\t\t\t\t</tr>}}\n\t\t\t</tbody></table>').replace(/(\r?\n|\t)/g,"").split(/{{(.*)}}/)},tooltipPosition:function(t,e,i,n){var a=this,r=a.config,s=a.scale,o=a.state,l=o.width,u=o.height,d=o.current,h=o.isLegendRight,g=o.inputType,f=a.hasType("gauge")&&!r.gauge_fullCircle,p=a.getSvgLeft(!0),x=Object(c.mouse)(n),v=x[0],_=x[1],m=p+d.width-a.getCurrentPaddingRight(!0),y=a.getCurrentPaddingLeft(!0);if(_+=20,a.hasArcType()){"touch"===g||a.hasType("radar")||(_+=f?u:u/2,v+=(l-(h?a.getLegendWidth():0))/2)}else{var b=s.x(t[0].x);r.axis_rotated?(_=b+20,v+=p+100,m-=p):(_-=5,v=p+y+20+(a.zoomScale?v:b))}v+e+15>m&&(v-=e+y),_+i>d.height&&(_-=f?3*i:i+30);var T={top:_,left:v};return Object.keys(T).forEach((function(t){T[t]<0&&(T[t]=0)})),T},showTooltip:function(t,e){var i=this,n=i.config,a=i.state,r=i.$el.tooltip,s=n.tooltip_contents.bindto,o=i.hasArcType(null,["radar"]),c=t.filter((function(t){return t&&w(i.getBaseValue(t))}));if(0!==c.length&&n.tooltip_show){var l=r.datum(),u=l||{},d=u.width,h=void 0===d?0:d,g=u.height,f=void 0===g?0:g,p=JSON.stringify(t);if(!l||l.current!==p){var x=t.concat().sort()[0].index;$(n.tooltip_onshow,i.api,t),r.html(i.getTooltipHTML(t,i.axis?i.axis.getXAxisTickFormat():i.categoryName.bind(i),i.getYFormat(o),i.color)).style("display",null).style("visibility",null).datum(l={index:x,current:p,width:h=r.property("offsetWidth"),height:f=r.property("offsetHeight")}),$(n.tooltip_onshown,i.api,t),i._handleLinkedCharts(!0,x)}if(!s){var v=(n.tooltip_position||i.tooltipPosition).call(this,c,h,f,e);["top","left"].forEach((function(t){var e=v[t];r.style(t,e+"px"),"left"!==t||l.xPosInPercent||(l.xPosInPercent=e/a.current.width*100)}))}}},bindTooltipResizePos:function(){var t=this.resizeFunction,e=this.state,i=this.$el.tooltip;t.add((function(){if("block"===i.style("display")){var t=e.current,n=i.datum(),a=n.width,r=n.xPosInPercent,s=t.width/100*r,o=t.width-(s+a);o<0&&(s+=o),i.style("left",s+"px")}}))},hideTooltip:function(t){var e=this.api,i=this.config,n=this.$el.tooltip;if("none"!==n.style("display")&&(!i.tooltip_doNotHide||t)){var a=JSON.parse(n.datum().current);$(i.tooltip_onhide,e,a),n.style("display","none").style("visibility","hidden").datum(null),$(i.tooltip_onhidden,e,a)}},_handleLinkedCharts:function(t,e){var i=this,n=i.charts,a=i.config;if(a.tooltip_linked&&n.length>1){var r=a.tooltip_linked_name;n.forEach((function(n){if(n!==i.api){var a=n.internal,s=a.config,o=a.$el,c=s.tooltip_linked,l=s.tooltip_linked_name,u=b.body.contains(o.chart.node());if(c&&r===l&&u){var d=n.internal.$el.tooltip.data()[0],h=e!==(d&&d.index);try{t&&h?n.tooltip.show({index:e}):!t&&n.tooltip.hide()}catch(t){}}}}))}}},te={getTranslate:function(t,e){void 0===e&&(e=0);var i,n,a=this.config,r=this.state,s=a.axis_rotated,o=0;if(e&&/^(x|y2?)$/.test(t)&&(o=this.getAxisSize(t)*e),"main"===t)i=D(r.margin.left),n=D(r.margin.top);else if("context"===t)i=D(r.margin2.left),n=D(r.margin2.top);else if("legend"===t)i=r.margin3.left,n=r.margin3.top;else if("x"===t)i=s?-o:0,n=s?0:r.height+o;else if("y"===t)i=s?0:-o,n=s?r.height+o:0;else if("y2"===t)i=s?0:r.width+o,n=s?1-o:0;else if("subX"===t)i=0,n=s?0:r.height2;else if("arc"===t)i=r.arcWidth/2,n=r.arcHeight/2;else if("radar"===t){var c=this.getRadarSize()[0];i=r.width/2-c,n=D(r.margin.top)}return"translate("+i+", "+n+")"},transformMain:function(t,e){var i,n,a,r=this,s=r.$el.main;e&&e.axisX?i=e.axisX:(i=s.select("."+l.axisX),t&&(i=i.transition())),e&&e.axisY?n=e.axisY:(n=s.select("."+l.axisY),t&&(n=n.transition())),e&&e.axisY2?a=e.axisY2:(a=s.select("."+l.axisY2),t&&(a=a.transition())),(t?s.transition():s).attr("transform",r.getTranslate("main")),i.attr("transform",r.getTranslate("x")),n.attr("transform",r.getTranslate("y")),a.attr("transform",r.getTranslate("y2")),s.select("."+l.chartArcs).attr("transform",r.getTranslate("arc"))},transformAll:function(t,e){var i=this,n=i.config,a=i.state.hasAxis,r=i.$el;i.transformMain(t,e),a&&n.subchart_show&&i.transformContext(t,e),r.legend&&i.transformLegend(t)}},ee={setTargetType:function(t,e){var i=this.config,n=this.state.withoutFadeIn;this.mapToTargetIds(t).forEach((function(t){n[t]=e===i.data_types[t],i.data_types[t]=e})),t||(i.data_type=e)},updateTypesElements:function(){var t=this,e=t.state.current;Object.keys(Mt).forEach((function(i){var n=Mt[i],a=t.hasType(n,null,!0),r=e.types.indexOf(n);-1===r&&a?e.types.push(n):r>-1&&!a&&e.types.splice(r,1)})),t.setChartElements()},hasType:function(t,e,i){void 0===i&&(i=!1);var n=this.config,a=this.state.current,r=n.data_types,s=e||this.data.targets,o=!1;return!i&&a.types.length&&a.types.indexOf(t)>-1?o=!0:s&&s.length?s.forEach((function(e){var i=r[e.id];i!==t&&(i||"line"!==t)||(o=!0)})):Object.keys(r).length?Object.keys(r).forEach((function(e){r[e]===t&&(o=!0)})):o=n.data_type===t,o},hasTypeOf:function(t,e,i){var n=this;return void 0===i&&(i=[]),!Ft[t].filter((function(t){return-1===i.indexOf(t)})).every((function(t){return!n.hasType(t,e)}))},isTypeOf:function(t,e){var i=O(t)?t:t.id,n=this.config.data_types[i]||this.config.data_type;return M(e)?e.indexOf(n)>=0:n===e},hasPointType:function(){return this.hasTypeOf("Line")||this.hasType("bubble")||this.hasType("scatter")},hasArcType:function(t,e){return this.hasTypeOf("Arc",t,e)},hasMultiArcGauge:function(){return this.hasType("gauge")&&"multi"===this.config.gauge_type},isLineType:function(t){var e=O(t)?t:t.id;return!this.config.data_types[e]||this.isTypeOf(e,Ft.Line)},isStepType:function(t){return this.isTypeOf(t,Ft.Step)},isSplineType:function(t){return this.isTypeOf(t,Ft.Spline)},isAreaType:function(t){return this.isTypeOf(t,Ft.Area)},isAreaRangeType:function(t){return this.isTypeOf(t,Ft.AreaRange)},isBarType:function(t){return this.isTypeOf(t,"bar")},isBubbleType:function(t){return this.isTypeOf(t,"bubble")},isScatterType:function(t){return this.isTypeOf(t,"scatter")},isPieType:function(t){return this.isTypeOf(t,"pie")},isGaugeType:function(t){return this.isTypeOf(t,"gauge")},isDonutType:function(t){return this.isTypeOf(t,"donut")},isRadarType:function(t){return this.isTypeOf(t,"radar")},isArcType:function(t){return this.isPieType(t)||this.isDonutType(t)||this.isGaugeType(t)||this.isRadarType(t)},isCirclePoint:function(t){var e=this.config,i=e.point_pattern;return!(!t||"circle"!==t.tagName)||"circle"===e.point_type&&(!i||M(i)&&0===i.length)},lineData:function(t){return this.isLineType(t)?[t]:[]},arcData:function(t){return this.isArcType(t.data)?[t]:[]},barData:function(t){return this.isBarType(t)?t.values:[]},labelishData:function(t){return this.isBarType(t)||this.isLineType(t)||this.isScatterType(t)||this.isBubbleType(t)||this.isRadarType(t)?t.values:[]},barLineBubbleData:function(t){return this.isBarType(t)||this.isLineType(t)||this.isBubbleType(t)?t.values:[]},isInterpolationType:function(t){return["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"].indexOf(t)>=0}},ie=function(){function t(t){r(this,"api",void 0),r(this,"config",void 0),r(this,"cache",void 0),r(this,"$el",void 0),r(this,"state",void 0),r(this,"charts",void 0),r(this,"data",{xs:{},targets:[]}),r(this,"axis",void 0),r(this,"scale",{x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null}),r(this,"org",{xScale:null,xDomain:null}),r(this,"color",void 0),r(this,"patterns",void 0),r(this,"levelColor",void 0),r(this,"point",void 0),r(this,"brush",void 0),r(this,"format",{extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null});var e=this;e.api=t,e.config=new dt,e.cache=new Tt;var i=new d;e.$el=i.getStore("element"),e.state=i.getStore("state")}var e=t.prototype;return e.beforeInit=function(){this.callPluginHook("$beforeInit"),$(this.config.onbeforeinit,this.api)},e.afterInit=function(){this.callPluginHook("$afterInit"),$(this.config.onafterinit,this.api)},e.init=function(){var t=this,e=t.config,i=t.state,n=t.$el;i.hasAxis=!t.hasArcType(),i.hasRadar=!i.hasAxis&&t.hasType("radar"),t.initParams();var a={element:e.bindto,classname:"bb"};F(e.bindto)&&(a.element=e.bindto.element||"#chart",a.classname=e.bindto.classname||a.classname),n.chart=S(a.element.node)?e.bindto.element:Object(c.select)(a.element||[]),n.chart.empty()&&(n.chart=Object(c.select)(b.body.appendChild(b.createElement("div")))),n.chart.html("").classed(a.classname,!0),t.initToRender()},e.initToRender=function(t){var e=this,i=e.config,n=e.state,a=e.$el.chart,r=function(){return"none"===a.style("display")||"hidden"===a.style("visibility")},s=i.render.lazy||r(),o=y.MutationObserver;if(s&&o&&!1!==i.render.observe&&!t&&new o((function(t,i){r()||(i.disconnect(),!n.rendered&&e.initToRender(!0))})).observe(a.node(),{attributes:!0,attributeFilter:["class","style"]}),!s||t){var c=e.convertData(i,e.initWithData);c&&e.initWithData(c),e.afterInit()}},e.initParams=function(){var t=this,e=t,i=e.config,n=e.format,a=e.state,r=i.axis_rotated;if(a.datetimeId="bb-"+ +new Date,t.color=t.generateColor(),t.levelColor=t.generateLevelColor(),t.hasPointType()&&(t.point=t.generatePoint()),a.hasAxis){t.initClip(),n.extraLineClasses=t.generateExtraLineClass(),n.dataTime=i.data_xLocaltime?o.timeParse:o.utcParse,n.axisTime=i.axis_x_localtime?o.timeFormat:o.utcFormat;var s=t.config.zoom_enabled&&"drag"===t.config.zoom_type;n.defaultAxisTime=function(e){var i=t.scale,a=i.x,r=i.zoom,o=s?r:r&&a.orgDomain().toString()!==r.domain().toString(),c=(e.getMilliseconds()?".%L":e.getSeconds()&&".:%S")||e.getMinutes()&&"%I:%M"||e.getHours()&&"%I %p"||1!==e.getDate()&&"%b %d"||o&&1===e.getDate()&&"%b'%y"||e.getMonth()&&"%-m/%-d"||"%Y";return n.axisTime(c)(e)}}a.isLegendRight="right"===i.legend_position,a.isLegendInset="inset"===i.legend_position,a.isLegendTop="top-left"===i.legend_inset_anchor||"top-right"===i.legend_inset_anchor,a.isLegendLeft="top-left"===i.legend_inset_anchor||"bottom-left"===i.legend_inset_anchor,a.rotatedPaddingRight=r&&!i.axis_x_show?0:30,a.inputType=function(t,e){var i=!1;if(/Mobi/.test(y.navigator.userAgent)&&e){var n=y.navigator&&"maxTouchPoints"in y.navigator&&y.navigator.maxTouchPoints>0,a="ontouchmove"in y||y.DocumentTouch&&b instanceof y.DocumentTouch;i=n||a}return(!(!t||i)&&"onmouseover"in y?"mouse":i&&"touch")||null}(i.interaction_inputType_mouse,i.interaction_inputType_touch)},e.initWithData=function(t){var e=this,i=e.config,n=e.scale,a=e.state,r=e.$el,s=e.org,o=a.hasAxis,c=i.interaction_enabled;o&&(e.axis=e.getAxisInstance(),i.zoom_enabled&&e.initZoom()),e.data.xs={},e.data.targets=e.convertDataToTargets(t),i.data_filter&&(e.data.targets=e.data.targets.filter(i.data_filter.bind(e.api))),i.data_hide&&e.addHiddenTargetIds(!0===i.data_hide?e.mapToIds(e.data.targets):i.data_hide),i.legend_hide&&e.addHiddenLegendIds(!0===i.legend_hide?e.mapToIds(e.data.targets):i.legend_hide),e.updateSizes(),e.updateScales(!0);var u=n.x,d=n.y,h=n.y2,g=n.subX,f=n.subY,p=n.subY2;if(u&&(u.domain(it(e.getXDomain(e.data.targets))),g.domain(u.domain()),s.xDomain=u.domain()),d&&(d.domain(e.getYDomain(e.data.targets,"y")),f.domain(d.domain())),h&&(h.domain(e.getYDomain(e.data.targets,"y2")),p&&p.domain(h.domain())),r.svg=r.chart.append("svg").style("overflow","hidden").style("display","block"),c&&a.inputType){var x="touch"===a.inputType;r.svg.on(x?"touchstart":"mouseenter",(function(){return $(i.onover,e.api)})).on(x?"touchend":"mouseleave",(function(){return $(i.onout,e.api)}))}i.svg_classname&&r.svg.attr("class",i.svg_classname);var v=S(i.color_tiles)&&e.patterns;(o||v)&&(r.defs=r.svg.append("defs"),o&&["id","idXAxis","idYAxis","idGrid"].forEach((function(t){e.appendClip(r.defs,a.clip[t])})),v&&e.patterns.forEach((function(t){return r.defs.append((function(){return t.node}))}))),e.updateSvgSize(),e.bindResize();var _=r.svg.append("g").classed(l.main,!0).attr("transform",e.getTranslate("main"));if(r.main=_,i.subchart_show&&e.initSubchart(),i.tooltip_show&&e.initTooltip(),i.title_text&&e.initTitle(),i.legend_show&&e.initLegend(),i.data_empty_label_text&&_.append("text").attr("class",l.text+" "+l.empty).attr("text-anchor","middle").attr("dominant-baseline","middle"),o&&(i.regions.length&&e.initRegion(),!i.clipPath&&e.axis.init()),_.append("g").attr("class",l.chart).attr("clip-path",a.clip.path),e.callPluginHook("$init"),o&&(c&&e.initEventRect&&e.initEventRect(),e.initGrid(),i.clipPath&&e.axis&&e.axis.init()),e.initChartElements(),e.updateTargets(e.data.targets),e.updateDimension(),$(i.oninit,e.api),e.setBackground(),e.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),i.data_onmin||i.data_onmax){var m=e.getMinMaxData();$(i.data_onmin,e.api,m.min),$(i.data_onmax,e.api,m.max)}a.rendered=!0},e.initChartElements=function(){var t=this,e=t.state,i=e.hasAxis,n=e.hasRadar,a=[];i?(t.hasType("bar")&&a.push("Bar"),t.hasType("bubble")&&a.push("Bubble"),t.hasTypeOf("Line")&&a.push("Line")):(!n&&a.push("Arc","Pie"),t.hasType("gauge")?a.push("Gauge"):n&&a.push("Radar")),a.forEach((function(e){t["init"+e]()})),P(t.config.data_labels)&&!t.hasArcType(null,["radar"])&&t.initText()},e.setChartElements=function(){var t=this.$el,e=t.chart,i=t.svg,n=t.defs,a=t.main,r=t.tooltip,s=t.legend,o=t.title,c=t.grid,l=t.arcs,u=t.circle,d=t.bar,h=t.line,g=t.area,f=t.text;this.api.$={chart:e,svg:i,defs:n,main:a,tooltip:r,legend:s,title:o,grid:c,arc:l,circles:u,bar:{bars:d},line:{lines:h,areas:g},text:{texts:f}}},e.setBackground=function(){var t=this.config.background,e=this.state,i=this.$el.svg;if(P(t)){var n=i.select("g").insert(t.imgUrl?"image":"rect",":first-child");t.imgUrl?n.attr("href",t.imgUrl):t.color&&n.style("fill",t.color).attr("clip-path",e.clip.path),n.attr("class",t.class||null).attr("width","100%").attr("height","100%")}},e.updateTargets=function(t){var e=this,i=e.state,n=i.hasAxis,a=i.hasRadar;e.updateTargetsForText(t),n?(e.hasType("bar")&&e.updateTargetsForBar(t),e.hasTypeOf("Line")&&e.updateTargetsForLine(t),e.updateTargetsForSubchart&&e.updateTargetsForSubchart(t)):e.hasArcType(t)&&(a?e.updateTargetsForRadar(t):e.updateTargetsForArc(t)),(e.hasType("bubble")||e.hasType("scatter"))&&e.updateTargetForCircle&&e.updateTargetForCircle(),e.showTargets()},e.showTargets=function(){var t=this,e=t.config;t.$el.svg.selectAll("."+l.target).filter((function(e){return t.isTargetToShow(e.id)})).transition().duration(e.transition_duration).style("opacity","1")},e.getWithOption=function(t){var e={Y:!0,Subchart:!0,Transition:!0,EventRect:!0,Dimension:!0,TrimXDomain:!0,Transform:!1,UpdateXDomain:!1,UpdateOrgXDomain:!1,Legend:!1,UpdateXAxis:"UpdateXDomain",TransitionForExit:"Transition",TransitionForAxis:"Transition"};return Object.keys(e).forEach((function(i){var n=e[i];O(n)&&(n=e[n]),e[i]=B(t,"with"+i,n)})),e},e.initialOpacity=function(t){var e=this.state.withoutFadeIn;return null!==this.getBaseValue(t)&&e[t.id]?"1":"0"},e.bindResize=function(){var t,e,i,n=this,a=n.config,r=n.state,s=(e=[],(i=function(){i.clear(),t=At((function(){e.forEach((function(t){return t()}))}),200)}).clear=function(){t&&(wt(t),t=null)},i.add=function(t){return e.push(t)},i.remove=function(t){return e.splice(e.indexOf(t),1)},i),o=[];o.push((function(){return $(a.onresize,n,n.api)})),a.resize_auto&&o.push((function(){r.resizing=!0,n.api.flush(!1)})),o.push((function(){$(a.onresized,n,n.api),r.resizing=!1})),o.forEach((function(t){return s.add(t)})),n.resizeFunction=s,y.addEventListener("resize",n.resizeFunction=s)},e.callPluginHook=function(t){for(var e=this,i=arguments.length,n=Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];this.config.plugins.forEach((function(i){"$beforeInit"===t&&(i.$$=e,e.api.plugins.push(i)),i[t].apply(i,n)}))},t}();function ne(t){var e,i,n,a=this.config,r=function(){var t=i.shift();return t&&e&&X(e)&&t in e?(e=e[t],r()):t?void 0:e};Object.keys(a).forEach((function(s){e=t,i=s.split("_"),n=r(),C(n)&&(a[s]=n)}))}Z(ie.prototype,[Lt,kt,Ct,{categoryName:function(t){var e=this.config.axis_x_categories;return e&&t<e.length?e[t]:t}},It,Pt,Bt,Et,Dt,jt,Nt,Gt,Ht,Ut,Zt,qt,Jt,Qt,te,ee]);var ae={resize:function(t){var e=this.internal,i=e.config;e.state.rendered&&(i.size_width=t?t.width:null,i.size_height=t?t.height:null,this.flush(!1,!0),e.resizeFunction())},flush:function(t){var e=this.internal,i=e.state;i.rendered?(i.resizing?e.brush&&e.brush.updateResize():e.axis&&e.axis.setOrient(),e.scale.zoom=null,t?e.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0}):e.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})):e.initToRender(!0)},destroy:function(){var t=this,e=this.internal,i=e.$el,n=i.chart,a=i.svg;return P(e)&&(e.callPluginHook("$willDestroy"),e.charts.splice(e.charts.indexOf(this),1),a.select("*").interrupt(),e.resizeFunction.clear(),y.removeEventListener("resize",e.resizeFunction),n.classed("bb",!1).html(""),Object.keys(this).forEach((function(i){"internal"===i&&Object.keys(e).forEach((function(t){e[t]=null})),t[i]=null,delete t[i]}))),null},config:function(t,e,i){var n,a=this.internal.config,r=t&&t.replace(/\./g,"_");return r in a&&(C(e)?(a[r]=e,n=e,i&&this.flush()):n=a[r]),n}};function re(t){var e=this.internal.data.targets;if(!k(t)){var i=M(t)?t:[t];return e.filter((function(t){return i.some((function(e){return e===t.id}))}))}return e}Z(re,{shown:function(t){return this.internal.filterTargetsToShow(this.data(t))},values:function(t,e){void 0===e&&(e=!0);var i=null;if(t){var n=this.data(t);n&&M(n)&&(i=[],n.forEach((function(t){var n=t.values.map((function(t){return t.value}));e?i=i.concat(n):i.push(n)})))}return i},names:function(t){var e=this.internal;return e.cache.remove(vt),e.updateDataAttributes("names",t)},colors:function(t){return this.internal.updateDataAttributes("colors",t)},axes:function(t){return this.internal.updateDataAttributes("axes",t)},min:function(){return this.internal.getMinMaxData().min},max:function(){return this.internal.getMinMaxData().max}});function se(t,e){var i,n,a=new XMLSerializer,r=t.cloneNode(!0),s=(i=K(b.styleSheets),n=[],i.forEach((function(t){try{t.cssRules&&t.cssRules.length&&(n=n.concat(K(t.cssRules)))}catch(e){console.error("Error while reading rules from "+t.href+": "+e.toString())}})),n).filter((function(t){return t.cssText})).map((function(t){return t.cssText}));r.setAttribute("xmlns",c.namespaces.xhtml);var o=a.serializeToString(r),l=b.createElement("style");l.appendChild(b.createTextNode(s.join("\n")));var u=a.serializeToString(l),d=('<svg xmlns="'+c.namespaces.svg+'" width="'+e.width+'" height="'+e.height+'">\n\t\t\t<foreignObject width="100%" height="100%">\n\t\t\t\t'+u+"\n\t\t\t\t"+o.replace(/(url\()[^#]+/g,"$1")+"\n\t\t\t</foreignObject></svg>").replace("/\n/g","%0A");return"data:image/svg+xml;base64,"+btoa(encodeURIComponent(d).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(+("0x"+e))})))}function oe(t,e,i){var n=this.internal,a=n.mapToTargetIds(e);n.state.toggling=!0,n[(t?"remove":"add")+"HiddenTargetIds"](a);var r=n.$el.svg.selectAll(n.selectorTargets(a)),s=t?"1":"0";r.transition().style("opacity",s,"important").call(j,(function(){r.style("opacity",null).style("opacity",s)})),i.withLegend&&n[(t?"show":"hide")+"Legend"](a),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.state.toggling=!1}var ce=function t(e){r(this,"plugins",[]),r(this,"internal",void 0);var i=new ie(this);this.internal=i,function t(e,i,n){Object.keys(e).forEach((function(a){var r=S(e[a]),s=i!==n,o=Object.keys(e[a]).length>0;r&&(!s&&o||s)?i[a]=e[a].bind(n):!r&&(i[a]={}),o&&t(e[a],i[a],n)}))}(t.prototype,this,this),ne.call(i,e),i.beforeInit(),i.init()};function le(t,e,i){var n=t.config,a="axis_y_"+e,r="axis_y2_"+e;C(i)&&(X(i)?(w(i.x)&&(n["axis_x_"+e]=i.x),w(i.y)&&(n[a]=i.y),w(i.y2)&&(n[r]=i.y2)):(n[a]=i,n[r]=i),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function ue(t,e){var i=t.config;return{x:i["axis_x_"+e],y:i["axis_y_"+e],y2:i["axis_y2_"+e]}}Z(ce.prototype,[ae,{color:function(t){return this.internal.color(t)}},{data:re},{export:function(t,e){var i=this,n=this.internal,a=n.state,r=n.$el.chart,s=a.current,o=s.width,c=s.height,l=se(r.node(),{width:o,height:c});if(e&&S(e)){var u=new Image;u.crossOrigin="Anonymous",u.onload=function(){var n=b.createElement("canvas"),a=n.getContext("2d");n.width=o,n.height=c,a.drawImage(u,0,0),e.bind(i)(n.toDataURL(t))},u.src=l}return l}},{focus:function(t){var e=this.internal,i=e.state,n=e.mapToTargetIds(t),a=e.$el.svg.selectAll(e.selectorTargets(n.filter(e.isTargetToShow,e)));this.revert(),this.defocus(),a.classed(l.focused,!0).classed(l.defocused,!1),e.hasArcType()&&!i.hasRadar&&(e.expandArc(n),e.hasType("gauge")&&e.markOverlapped(t,e,"."+l.gaugeValue)),e.toggleFocusLegend(n,!0),i.focusedTargetIds=n,i.defocusedTargetIds=i.defocusedTargetIds.filter((function(t){return n.indexOf(t)<0}))},defocus:function(t){var e=this.internal,i=e.state,n=e.mapToTargetIds(t);e.$el.svg.selectAll(e.selectorTargets(n.filter(e.isTargetToShow,e))).classed(l.focused,!1).classed(l.defocused,!0),e.hasArcType()&&(e.unexpandArc(n),e.hasType("gauge")&&e.undoMarkOverlapped(e,"."+l.gaugeValue)),e.toggleFocusLegend(n,!1),i.focusedTargetIds=i.focusedTargetIds.filter((function(t){return n.indexOf(t)<0})),i.defocusedTargetIds=n},revert:function(t){var e=this.internal,i=e.config,n=e.state,a=e.$el,r=e.mapToTargetIds(t);a.svg.selectAll(e.selectorTargets(r)).classed(l.focused,!1).classed(l.defocused,!1),e.hasArcType()&&e.unexpandArc(r),i.legend_show&&(e.showLegend(r.filter(e.isLegendToShow.bind(e))),a.legend.selectAll(e.selectorLegends(r)).filter((function(){return Object(c.select)(this).classed(l.legendItemFocused)})).classed(l.legendItemFocused,!1)),n.focusedTargetIds=[],n.defocusedTargetIds=[]}},{legend:{show:function(t){var e=this.internal;e.showLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})},hide:function(t){var e=this.internal;e.hideLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})}}},{load:function(t){var e=this.internal,i=e.config;t.xs&&e.addXs(t.xs),"names"in t&&this.data.names(t.names),"classes"in t&&Object.keys(t.classes).forEach((function(e){i.data_classes[e]=t.classes[e]})),"categories"in t&&e.axis.isCategorized()&&(i.axis_x_categories=t.categories),"axes"in t&&Object.keys(t.axes).forEach((function(e){i.data_axes[e]=t.axes[e]})),"colors"in t&&Object.keys(t.colors).forEach((function(e){i.data_colors[e]=t.colors[e]})),"unload"in t&&!1!==t.unload?e.unload(e.mapToTargetIds(!0===t.unload?null:t.unload),(function(){return e.loadFromArgs(t)})):e.loadFromArgs(t)},unload:function(t){var e=this,i=this.internal,n=t||{};M(n)?n={ids:n}:O(n)&&(n={ids:[n]});var a=i.mapToTargetIds(n.ids);i.unload(a,(function(){i.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),i.cache.remove(a),n.done&&n.done.call(e)}))}},{show:function(t,e){void 0===e&&(e={}),oe.call(this,!0,t,e)},hide:function(t,e){void 0===e&&(e={}),oe.call(this,!1,t,e)},toggle:function(t,e){var i=this;void 0===e&&(e={});var n=this.internal,a={show:[],hide:[]};n.mapToTargetIds(t).forEach((function(t){return a[n.isTargetToShow(t)?"hide":"show"].push(t)})),a.show.length&&this.show(a.show,e),a.hide.length&&setTimeout((function(){return i.hide(a.hide,e)}),0)}},{tooltip:{show:function(t){var e,i,n=this.internal,a=n.config,r=n.state.inputType;if(t.mouse&&(i=t.mouse),t.data){var s=t.data,o=n.getYScaleById(s.id)(s.value);n.isMultipleX()?i=[n.scale.x(s.x),o]:(!a.tooltip_grouped&&(i=[0,o]),e=w(s.index)?s.index:n.getIndexByX(s.x))}else C(t.x)?e=n.getIndexByX(t.x):C(t.index)&&(e=t.index);("mouse"===r?["mouseover","mousemove"]:["touchstart"]).forEach((function(t){n.dispatchEvent(t,e,i)}))},hide:function(){var t=this.internal;"touch"===t.inputType&&t.callOverOutForTouch(),t.hideTooltip(!0),t.hideGridFocus(),t.unexpandCircles(),t.unexpandBars()}}}]);var de={axis:{labels:function(t){var e=this.internal;arguments.length&&(Object.keys(t).forEach((function(i){e.axis.setLabelText(i,t[i])})),e.axis.updateLabels())},min:function(t){var e=this.internal;return w(t)?le(e,"min",t):ue(e,"min")},max:function(t){var e=this.internal;return arguments.length?le(e,"max",t):ue(e,"max")},range:function(t){var e=this.axis;if(!arguments.length)return{max:e.max(),min:e.min()};C(t.max)&&e.max(t.max),C(t.min)&&e.min(t.min)}}};function he(t){var e=this.internal,i=e.config;return t?(i.grid_x_lines=t,e.redrawWithoutRescale(),i.grid_x_lines):i.grid_x_lines}Z(he,{add:function(t){return this.xgrids(this.internal.config.grid_x_lines.concat(t||[]))},remove:function(t){this.internal.removeGridLines(t,!0)}});var ge={xgrids:he};function fe(t){var e=this.internal,i=e.config;return t?(i.grid_y_lines=t,e.redrawWithoutRescale(),i.grid_y_lines):i.grid_y_lines}Z(fe,{add:function(t){return this.ygrids(this.internal.config.grid_y_lines.concat(t||[]))},remove:function(t){this.internal.removeGridLines(t,!1)}});var pe={ygrids:fe},xe={groups:function(t){var e=this.internal,i=e.config;return k(t)||(i.data_groups=t,e.redraw()),i.data_groups}};function ve(t){var e=this.internal,i=e.config;return t?(i.regions=t,e.redrawWithoutRescale(),t):i.regions}Z(ve,{add:function(t){var e=this.internal,i=e.config;return t?(i.regions=i.regions.concat(t),e.redrawWithoutRescale(),i.regions):i.regions},remove:function(t){var e=this.internal,i=e.config,n=t||{},a=B(n,"duration",i.transition_duration),r=B(n,"classes",[l.region]),s=e.$el.main.select("."+l.regions).selectAll(r.map((function(t){return"."+t})));return(a?s.transition().duration(a):s).style("opacity","0").remove(),s=i.regions,Object.keys(n).length?(s=s.filter((function(t){var e=!1;return!t.class||(t.class.split(" ").forEach((function(t){r.indexOf(t)>=0&&(e=!0)})),!e)})),i.regions=s):i.regions=[],s}});var _e={regions:ve},me={x:function(t){var e=this.internal,i=e.axis,n=e.data,a=i.isCustomX()&&i.isCategorized();return M(t)&&(a?this.categories(t):(e.updateTargetX(n.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),a?this.categories():n.xs},xs:function(t){var e=this.internal;return F(t)&&(e.updateTargetXs(e.data.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),e.data.xs}},ye={flow:function(t){var e,i,n,a,r=this.internal,s=0,o=0;if((t.json||t.rows||t.columns)&&(e=r.convertData(t)),e&&ct()){var c=[],l=r.getMaxDataCount(),u=r.convertDataToTargets(e,!0),d=r.axis.isTimeSeries();r.data.targets.forEach((function(t){for(var e=!1,i=0;i<u.length;i++)if(t.id===u[i].id){e=!0,t.values[t.values.length-1]&&(o=t.values[t.values.length-1].index+1),s=u[i].values.length;for(var n=0;n<s;n++)u[i].values[n].index=o+n,d||(u[i].values[n].x=o+n);t.values=t.values.concat(u[i].values),u.splice(i,1);break}e||c.push(t.id)})),r.data.targets.forEach((function(t){for(var e=0;e<c.length;e++)if(t.id===c[e]){o=t.values[t.values.length-1].index+1;for(var i=0;i<s;i++)t.values.push({id:t.id,index:o+i,x:d?r.getOtherTargetX(o+i):o+i,value:null})}})),r.data.targets.length&&u.forEach((function(t){for(var e=[],i=r.data.targets[0].values[0].index;i<o;i++)e.push({id:t.id,index:i,x:d?r.getOtherTargetX(i):i,value:null});t.values.forEach((function(t){t.index+=o,d||(t.x+=o)})),t.values=e.concat(t.values)})),r.data.targets=r.data.targets.concat(u);var h=r.data.targets[0],g=h.values[0];C(t.to)?(s=0,a=d?ot.call(r,t.to):t.to,h.values.forEach((function(t){t.x<a&&s++}))):C(t.length)&&(s=t.length),l?1===l&&d&&(n=(h.values[h.values.length-1].x-g.x)/2,i=[new Date(+g.x-n),new Date(+g.x+n)]):(n=d?h.values.length>1?h.values[h.values.length-1].x-g.x:g.x-r.getXDomain(r.data.targets)[0]:1,i=[g.x-n,g.x]),i&&r.updateXDomain(null,!0,!0,!1,i),r.updateTargets(r.data.targets),r.redraw({flow:{index:g.index,length:s,duration:w(t.duration)?t.duration:r.config.transition_duration,done:t.done,orgDataCount:l},withLegend:!0,withTransition:l>1,withTrimXDomain:!1,withUpdateXAxis:!0})}}},be=i(10),Te=function(){function t(t){r(this,"owner",void 0),r(this,"config",void 0),r(this,"scale",void 0);var e=Vt(),i=t.config,n=t.params;this.owner=t,this.config=i,this.scale=e,(i.noTransition||!n.config.transition_duration)&&(i.withoutTransition=!0),i.range=this.scaleExtent((n.orgXScale||e).range())}t.getSizeFor1Char=function(t){var e={w:5.5,h:11.5};return t.empty()||t.select("text").text("0").call((function(t){try{var i=t.node().getBBox(),n=i.width,a=i.height;n&&a&&(e.w=n,e.h=a)}catch(t){}finally{t.text("")}})),this.getSizeFor1Char=function(){return e},e};var e=t.prototype;return e.getTickTransformSetter=function(t){var e=this.config,i="x"===t?function(t){return"translate("+(t+e.tickOffset)+",0)"}:function(t){return"translate(0,"+t+")"};return function(t,e){t.attr("transform",(function(t){return i(Math.ceil(e(t)))}))}},e.scaleExtent=function(t){var e=t[0],i=t[t.length-1];return e<i?[e,i]:[i,e]},e.generateTicks=function(t,e){var i=this.owner.params.tickStepSize,n=t.domain(),a=n[0],r=n[1],s=[];if(e&&i)for(var o=a;o<=r;)s.push(o),o+=i;else if(t.ticks){if(s=t.ticks.apply(t,this.config.tickArguments||[]),"log"===t.type){for(var c=t.ticks(),l=[c[0],c[c.length-1]],u=l[0],d=l[1],h=r.toFixed().length;s.length>15;h--)s=t.ticks(h);s[0]!==u&&s.unshift(u),s[s.length-1]!==d&&s.push(d)}s=s.map((function(t){return O(t)&&L(t)&&!isNaN(t)&&Math.round(10*t)/10||t}))}else{for(var g=Math.ceil(a);g<r;g++)s.push(g);s.length>0&&s[0]>0&&s.unshift(s[0]-(s[1]-s[0]))}return s},e.copyScale=function(){var t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t},e.textFormatted=function(t){var e=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+(t+"").replace(/0+\d$/,""):t,n=e?e(i):i;return C(n)?n:""},e.transitionise=function(t){var e=this.config;return e.withoutTransition?t.interrupt():t.transition(e.transition)},t}(),Ae=function(){function t(t){void 0===t&&(t={}),r(this,"helper",void 0),r(this,"config",void 0),r(this,"params",void 0),r(this,"g",void 0);var e={innerTickSize:6,outerTickSize:t.outerTick?6:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:9,tickOffset:0,tickPadding:3,tickValues:null,transition:null,noTransition:t.noTransition};e.tickLength=Math.max(e.innerTickSize,0)+e.tickPadding,this.config=e,this.params=t,this.helper=new Te(this)}var e=t.prototype;return e.create=function(t){var e=this,i=this.config,n=this.helper,a=this.params,r=n.scale,s=i.orient,o=this.splitTickText.bind(this),l=/^(left|right)$/.test(s),u=/^(top|bottom)$/.test(s),d=n.getTickTransformSetter(u?"x":"y"),h=d===n.axisX?"y":"x",g=/^(top|left)$/.test(s)?-1:1,f=a.tickTextRotate;this.config.range=r.rangeExtent?r.rangeExtent():n.scaleExtent((a.orgXScale||r).range());var p,x=i,v=x.innerTickSize,_=x.tickLength,m=x.range,y=a.id,b=y&&/^(x|y|y2)$/.test(y)?a.config["axis_"+y+"_tick_text_position"]:{x:0,y:0},T="subX"===y?"subchart_axis_x":"axis_"+y,A=a.config[T+"_show"],w=!!A&&a.config[T+"_tick_show"],S=!!A&&a.config[T+"_tick_text_show"];t.each((function(){var t=Object(c.select)(this),x=this.__chart__||r,y=n.copyScale();p=t,this.__chart__=y,i.tickOffset=a.isCategory?Math.ceil((y(1)-y(0))/2):0;var T=t.selectAll(".domain").data([0]);if(T.enter().append("path").attr("class","domain").merge(n.transitionise(T)).attr("d",(function(){var t=i.outerTickSize*g;return u?"M"+m[0]+","+t+"V0H"+m[1]+"V"+t:"M"+t+","+m[0]+"H0V"+m[1]+"H"+t})),w||S){var A=i.tickValues||n.generateTicks(y,l),O=t.selectAll(".tick").data(A,y),k=O.enter().insert("g",".domain").attr("class","tick").style("opacity","1"),C=O.exit().remove();O=k.merge(O),w&&k.append("line"),S&&k.append("text");var E=Te.getSizeFor1Char(O),R=[],D=O.select("text").selectAll("tspan").data((function(t,e){var i=a.tickMultiline?o(t,y,A,l,E.w):M(n.textFormatted(t))?n.textFormatted(t).concat():[n.textFormatted(t)];return R[e]=i.length,i.map((function(t){return{index:e,splitted:t}}))}));D.exit().remove(),(D=D.enter().append("tspan").merge(D).text((function(t){return t.splitted}))).attr("x",u?0:_*g).attr("dx",function(){var t=0;return/(top|bottom)/.test(s)&&f&&(t=8*Math.sin(Math.PI*(f/180))*("top"===s?-1:1)),t+(b.x||0)}()).attr("dy",(function(t,e){var i=0;return"top"!==s&&(i=E.h,0===e&&(i=l?-((R[t.index]-1)*(E.h/2)-3):0===b.y?".71em":0)),L(i)&&b.y?i+b.y:i||".71em"}));var I=O.select("line"),X=O.select("text");if(k.select("line").attr(h+"2",v*g),k.select("text").attr(h,_*g),e.setTickLineTextPosition(I,X),a.tickTitle){var z=X.select("title");(z.empty()?X.append("title"):z).text((function(t){return a.tickTitle[t]}))}if(y.bandwidth){var P=y,F=P.bandwidth()/2;y=x=function(t){return P(t)+F}}else x.bandwidth?x=y:d(C,y);d(k,x),d(n.transitionise(O).style("opacity","1"),y)}})),this.g=p},e.getTickXY=function(){var t=this.config,e={x:0,y:0};return this.params.isCategory&&(e.x=t.tickCentered?0:t.tickOffset,e.y=t.tickCentered?t.tickOffset:0),e},e.getTickSize=function(t){var e=this.helper.scale,i=this.config,n=i,a=n.innerTickSize,r=n.range,s=e(t)+(i.tickCentered?0:i.tickOffset);return r[0]<s&&s<r[1]?a:0},e.setTickLineTextPosition=function(t,e){var i=this.getTickXY(),n=this.config,a=n.innerTickSize,r=n.orient,s=n.tickLength,o=n.tickOffset,c=this.params.tickTextRotate,l=function(t){var e=["start","end"];return"top"===r&&e.reverse(),t?t>0?e[0]:e[1]:"middle"},u=function(t){return t?"rotate("+t+")":null},d=function(t){return t?11.5-2.5*(t/("bottom"===r?15:23))*(t>0?1:-1):s};"bottom"===r?(t.attr("x1",i.x).attr("x2",i.x).attr("y2",this.getTickSize.bind(this)),e.attr("x",0).attr("y",d(c)).style("text-anchor",l(c)).attr("transform",u(c))):"top"===r?(t.attr("x2",0).attr("y2",-a),e.attr("x",0).attr("y",2*-d(c)).style("text-anchor",l(c)).attr("transform",u(c))):"left"===r?(t.attr("x2",-a).attr("y1",i.y).attr("y2",i.y),e.attr("x",-s).attr("y",o).style("text-anchor","end")):"right"===r&&(t.attr("x2",a).attr("y2",0),e.attr("x",s).attr("y",0).style("text-anchor","start"))},e.splitTickText=function(t,e,i,n,a){var r=this.params,s=this.helper.textFormatted(t),o=O(s)&&s.indexOf("\n")>-1?s.split("\n"):[];if(o.length)return o;if(M(s))return s;var c=r.tickWidth;return(!c||c<=0)&&(c=n?95:r.isCategory?Math.ceil(e(i[1])-e(i[0]))-12:110),function t(e,i){for(var n,r,s,o=1;o<i.length;o++)if(" "===i.charAt(o)&&(r=o),n=i.substr(0,o+1),s=a*n.length,c<s)return t(e.concat(i.substr(0,r||o)),i.slice(r?r+1:o));return e.concat(i)}(o,s+"")},e.scale=function(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale},e.orient=function(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?t+"":"bottom",this):this.config.orient},e.tickFormat=function(t){var e=this.config;return arguments.length?(e.tickFormat=t,this):e.tickFormat},e.tickCentered=function(t){var e=this.config;return arguments.length?(e.tickCentered=t,this):e.tickCentered},e.tickOffset=function(){return this.config.tickOffset},e.tickInterval=function(t){var e;this.params.isCategory?e=2*this.config.tickOffset:e=(this.g.select("path.domain").node().getTotalLength()-2*this.config.outerTickSize)/(t||this.g.selectAll("line").size());return e===1/0?0:e},e.ticks=function(){for(var t=this.config,e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];return i.length?(t.tickArguments=K(i),this):t.tickArguments},e.tickCulling=function(t){var e=this.config;return arguments.length?(e.tickCulling=t,this):e.tickCulling},e.tickValues=function(t){var e=this,i=this.config;if(S(t))i.tickValues=function(){return t(e.helper.scale.domain())};else{if(!arguments.length)return i.tickValues;i.tickValues=t}return this},e.setTransition=function(t){return this.config.transition=t,this},t}(),we={getAxisInstance:function(){return this.axis||new Se(this)}},Se=function(){function t(t){r(this,"owner",void 0),r(this,"x",void 0),r(this,"subX",void 0),r(this,"y",void 0),r(this,"y2",void 0),r(this,"axesList",{}),r(this,"tick",{x:null,y:null,y2:null}),r(this,"xs",[]),r(this,"orient",{x:"bottom",y:"left",y2:"right",subX:"bottom"}),this.owner=t,this.setOrient()}var e=t.prototype;return e.getAxisClassName=function(t){return l.axis+" "+l["axis"+q(t)]},e.isHorizontal=function(t,e){var i=t.config.axis_rotated;return e?i:!i},e.isCategorized=function(){var t=this.owner,e=t.config,i=t.state;return e.axis_x_type.indexOf("category")>=0||i.hasRadar},e.isCustomX=function(){var t=this.owner.config;return!this.isTimeSeries()&&(t.data_x||P(t.data_xs))},e.isTimeSeries=function(t){return void 0===t&&(t="x"),"timeseries"===this.owner.config["axis_"+t+"_type"]},e.isLog=function(t){return void 0===t&&(t="x"),"log"===this.owner.config["axis_"+t+"_type"]},e.isTimeSeriesY=function(){return this.isTimeSeries("y")},e.getAxisType=function(t){void 0===t&&(t="x");var e="linear";return this.isTimeSeries(t)?e="time":this.isLog(t)&&(e="log"),e},e.init=function(){var t=this,e=this.owner,i=e.config,n=e.$el,a=n.main,r=n.axis,s=e.state.clip,o=i.axis_rotated,c=["x","y"];i.axis_y2_show&&c.push("y2"),c.forEach((function(n){var c=t.getAxisClassName(n),u=l["axis"+n.toUpperCase()+"Label"];r[n]=a.append("g").attr("class",c).attr("clip-path",(function(){var t=null;return"x"===n?t=s.pathXAxis:"y"===n&&(t=s.pathYAxis),t})).attr("transform",e.getTranslate(n)).style("visibility",i["axis_"+n+"_show"]?"visible":"hidden"),r[n].append("text").attr("class",u).attr("transform",["rotate(-90)",null]["x"===n?+!o:+o]).style("text-anchor",(function(){return t.textAnchorForAxisLabel(n)})),t.generateAxes(n)}))},e.setOrient=function(){var t=this.owner.config,e=t.axis_rotated,i=t.axis_y_inner,n=t.axis_y2_inner;this.orient={x:e?"left":"bottom",y:e?i?"top":"bottom":i?"right":"left",y2:e?n?"bottom":"top":n?"left":"right",subX:e?"left":"bottom"}},e.generateAxes=function(t){var e,i=this.owner,n=i.config,a=[],r=n["axis_"+t+"_axes"],s=n.axis_rotated;"x"===t?e=s?be.axisLeft:be.axisBottom:"y"===t?e=s?be.axisBottom:be.axisLeft:"y2"===t&&(e=s?be.axisTop:be.axisRight),r.length&&r.forEach((function(n){var r=n.tick||{},s=i.scale[t].copy();n.domain&&s.domain(n.domain),a.push(e(s).ticks(r.count).tickFormat(S(r.format)?r.format.bind(i.api):function(t){return t}).tickValues(r.values).tickSizeOuter(!1===r.outer?0:6))})),this.axesList[t]=a},e.updateAxes=function(){var t=this,e=this.owner,i=e.config,n=e.$el.main;Object.keys(this.axesList).forEach((function(a){var r=i["axis_"+a+"_axes"],s=e.scale[a].copy(),o=s.range();t.axesList[a].forEach((function(c,l){var u=c.scale().range();o.every((function(t,e){return t===u[e]}))||c.scale().range(o);var d=t.getAxisClassName(a)+"-"+(l+1),h=n.select("."+d.replace(/\s/,"."));h.empty()?h=n.append("g").attr("class",d).style("visibility",i["axis_"+a+"_show"]?"visible":"hidden").call(c):(r[l].domain&&s.domain(r[l].domain),t.x.helper.transitionise(h).call(c.scale(s))),h.attr("transform",e.getTranslate(a,l+1))}))}))},e.setAxis=function(t){"subX"!==t&&(this.tick[t]=this.getTickValues(t));for(var e=arguments.length,i=Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];this[t]=this.getAxis.apply(this,[t].concat(i))},e.getAxis=function(t,e,i,n,a){var r,s=this.owner,o=s.config,c=/^(x|subX)$/.test(t),l=c?"x":t,u=c&&this.isCategorized(),d=this.orient[t],h=a?0:s.getAxisTickRotate(l);if(c)r=s.format.xAxisTick;else{var g=o["axis_"+t+"_tick_format"];S(g)&&(r=g.bind(s.api))}var f=this.tick[l],p=et({outerTick:i,noTransition:n,config:o,id:t,tickTextRotate:h},c&&{isCategory:u,tickMultiline:o.axis_x_tick_multiline,tickWidth:o.axis_x_tick_width,tickTitle:u&&o.axis_x_tick_tooltip&&s.api.categories(),orgXScale:s.scale.x});c||(p.tickStepSize=o["axis_"+l+"_tick_stepSize"]);var x=new Ae(p).scale(c&&s.scale.zoom||e).orient(d);if(c&&this.isTimeSeries()&&f&&!S(f)){var v=ot.bind(s);f=f.map((function(t){return v(t)}))}else!c&&this.isTimeSeriesY()&&(x.ticks(o.axis_y_tick_time_value),f=null);f&&x.tickValues(f),x.tickFormat(r||!c&&s.isStackNormalized()&&function(t){return t+"%"}),u&&(x.tickCentered(o.axis_x_tick_centered),z(o.axis_x_tick_culling)&&(o.axis_x_tick_culling=!1));var _=o["axis_"+l+"_tick_count"];return _&&x.ticks(_),x},e.updateXAxisTickValues=function(t,e){var i,n=this.owner,a=n.config,r=a.axis_x_tick_fit,s=a.axis_x_tick_count;return(r||s&&r)&&(i=n.mapTargetsToUniqueXs(t),this.isCategorized()&&s>i.length&&(s=i.length),i=this.generateTickValues(i,s,this.isTimeSeries())),e?e.tickValues(i):this.x&&(this.x.tickValues(i),this.subX&&this.subX.tickValues(i)),i},e.getId=function(t){var e=this.owner,i=e.config,n=e.scale,a=i.data_axes[t];return a&&n[a]||(a="y"),a},e.getXAxisTickFormat=function(){var t,e=this.owner,i=e.config,n=e.format,a=i.axis_x_tick_format,r=this.isTimeSeries(),s=this.isCategorized();return a?S(a)?t=a.bind(e.api):r&&(t=function(t){return t?n.axisTime(a)(t):""}):t=r?n.defaultAxisTime:s?e.categoryName:function(t){return t<0?t.toFixed(0):t},S(t)?function(i){return t.apply(e,s?[i,e.categoryName(i)]:[i])}:t},e.getTickValues=function(t){var e=this.owner,i=e.config["axis_"+t+"_tick_values"],n=e[t+"Axis"];return(S(i)?i.call(e.api):i)||(n?n.tickValues():void 0)},e.getLabelOptionByAxisId=function(t){return this.owner.config["axis_"+t+"_label"]},e.getLabelText=function(t){var e=this.getLabelOptionByAxisId(t);return O(e)?e:e?e.text:null},e.setLabelText=function(t,e){var i=this.owner.config,n=this.getLabelOptionByAxisId(t);O(n)?i["axis_"+t+"_label"]=e:n&&(n.text=e)},e.getLabelPosition=function(t,e){var i=this.owner.config.axis_rotated,n=this.getLabelOptionByAxisId(t),a=X(n)&&n.position?n.position:e[+!i],r=function(t){return!!~a.indexOf(t)};return{isInner:r("inner"),isOuter:r("outer"),isLeft:r("left"),isCenter:r("center"),isRight:r("right"),isTop:r("top"),isMiddle:r("middle"),isBottom:r("bottom")}},e.getAxisLabelPosition=function(t){return this.getLabelPosition(t,"x"===t?["inner-top","inner-right"]:["inner-right","inner-top"])},e.getLabelPositionById=function(t){return this.getAxisLabelPosition(t)},e.xForAxisLabel=function(t){var e=this.owner,i=e.state,n=i.width,a=i.height,r=this.getAxisLabelPosition(t),s=r.isMiddle?-a/2:0;return this.isHorizontal(e,"x"!==t)?s=r.isLeft?0:r.isCenter?n/2:n:r.isBottom&&(s=-a),s},e.dxForAxisLabel=function(t){var e=this.owner,i=this.getAxisLabelPosition(t),n=i.isBottom?"0.5em":"0";return this.isHorizontal(e,"x"!==t)?n=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(n="-0.5em"),n},e.textAnchorForAxisLabel=function(t){var e=this.owner,i=this.getAxisLabelPosition(t),n=i.isMiddle?"middle":"end";return this.isHorizontal(e,"x"!==t)?n=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(n="start"),n},e.dyForAxisLabel=function(t){var e,i=this.owner,n=i.config,a=n.axis_rotated,r=this.getAxisLabelPosition(t).isInner,s=n["axis_"+t+"_tick_rotate"]?i.getHorizontalAxisHeight(t):0,o=this.getMaxTickWidth(t);if("x"===t){var c=n.axis_x_height;e=a?r?"1.2em":-25-o:r?"-0.5em":c?c-10:s?s-10:"3em"}else e={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],e=a?r?e[0]:s?s*("y2"===t?-1:1)-e[1]:e[2]:r?e[3]:(e[4]+(n["axis_"+t+"_inner"]?0:o+e[4]))*("y"===t?-1:1);return e},e.getMaxTickWidth=function(t,e){var i=this.owner,n=i.config,a=i.state.current,r=i.$el,s=r.svg,o=r.chart,c=a.maxTickWidths[t],l=0;if(e||!n["axis_"+t+"_show"]||0===i.filterTargetsToShow().length)return c.size;if(s){var u=/^y2?$/.test(t),d=i.filterTargetsToShow(i.data.targets),h=i.scale[t].copy().domain(i["get"+(u?"Y":"X")+"Domain"](d,t)),g=h.domain();if(g[0]===g[1]&&g.every((function(t){return t>0}))||M(c.domain)&&c.domain[0]===c.domain[1])return c.size;c.domain=g;var f=this.getAxis(t,h,!1,!1,!0),p=n["axis_"+t+"_tick_count"];!n["axis_"+t+"_tick_values"]&&p&&f.tickValues(this.generateTickValues(g,p,u?this.isTimeSeriesY():this.isTimeSeries())),u||this.updateXAxisTickValues(d,f);var x=o.append("svg").style("visibility","hidden").style("position","fixed").style("top","0px").style("left","0px");f.create(x),x.selectAll("text").each((function(e,i){var n=this.getBoundingClientRect().width;l=Math.max(l,n),"x"===t&&(c.ticks[i]=n)})),x.remove()}return l>0&&(c.size=l),c.size},e.getXAxisTickTextY2Overflow=function(t){var e=this.owner,i=e.axis,n=e.config,a=e.state,r=e.getAxisTickRotate("x");if((i.isCategorized()||i.isTimeSeries())&&n.axis_x_tick_fit&&!n.axis_x_tick_culling&&!n.axis_x_tick_multiline&&r>0&&r<90){var s=a.current.width-e.getCurrentPaddingLeft(),o=this.getXAxisTickMaxOverflow(r,s-t),c=Math.max(0,o)+t;return Math.min(c,s/2)}return 0},e.getXAxisTickMaxOverflow=function(t,e){for(var i=this.owner,n=i.axis,a=i.config,r=i.state,s=n.isTimeSeries(),o=r.current.maxTickWidths.x.ticks,c=o.length,l=r.axis.x.padding,u=l.left,d=l.right,h=0,g=c-(s&&a.axis_x_tick_fit?.5:0),f=0;f<c;f++){var p=f+1,x=Math.cos(Math.PI*t/180)*o[f],v=p-(s?1:.5)+u;if(!(v<=0)){var _=(e-x)/v;h=Math.max(h,x-_/2-((g-p)*_+d*_))}}var m=0;if(!s){var y=Vt(i.axis.getAxisType("x"),0,e-h).domain([-1*u,i.getXDomainMax(i.data.targets)+1+d]);m=Math.ceil((y(1)-y(0))/2)}return h+m},e.getXAxisPadding=function(t){var e=this.owner,i=e.config.axis_x_padding;if(z(i)?i={left:0,right:0}:(i.left=i.left||0,i.right=i.right||0),e.axis.isTimeSeries()){var n=+e.getXDomainMin(e.data.targets),a=+e.getXDomainMax(e.data.targets)-n,r=a+i.left+i.right,s=a/t/r;i={left:i.left/r/s||0,right:i.right/r/s||0}}return i},e.updateLabels=function(t){var e=this,i=this.owner.$el.main,n={x:i.select("."+l.axisX+" ."+l.axisXLabel),y:i.select("."+l.axisY+" ."+l.axisYLabel),y2:i.select("."+l.axisY2+" ."+l.axisY2Label)};Object.keys(n).filter((function(t){return!n[t].empty()})).forEach((function(i){var a=n[i];(t?a.transition():a).attr("x",(function(){return e.xForAxisLabel(i)})).attr("dx",(function(){return e.dxForAxisLabel(i)})).attr("dy",(function(){return e.dyForAxisLabel(i)})).text((function(){return e.getLabelText(i)}))}))},e.getPadding=function(t,e,i,n){var a=L(t)?t:t[e];return w(a)?this.convertPixelsToAxisPadding(a,n):i},e.convertPixelsToAxisPadding=function(t,e){var i=this.owner,n=i.config,a=i.state,r=a.width,s=a.height;return e*(t/(n.axis_rotated?r:s))},e.generateTickValues=function(t,e,i){var n=t;if(e){var a=S(e)?e():e;if(1===a)n=[t[0]];else if(2===a)n=[t[0],t[t.length-1]];else if(a>2){var r,s=this.isCategorized(),o=a-2,c=t[0],l=t[t.length-1];n=[c];for(var u=0;u<o;u++)r=+c+(l-c)/(o+1)*(u+1),n.push(i?new Date(r):s?Math.round(r):r);n.push(l)}}return i||(n=n.sort((function(t,e){return t-e}))),n},e.generateTransitions=function(t){var e=this.owner.$el.axis,i=["x","y","y2","subX"].map((function(i){var n=e[i];return n&&t&&(n=n.transition().duration(t)),n}));return{axisX:i[0],axisY:i[1],axisY2:i[2],axisSubX:i[3]}},e.redraw=function(t,e,i){var n=this,a=this.owner,r=a.config,s=a.$el,o=e?"0":"1";["x","y","y2","subX"].forEach((function(e){var a=n[e],c=s.axis[e];a&&c&&(!i&&(a.config.withoutTransition=!r.transition_duration),c.style("opacity",o),a.create(t["axis"+q(e)]))})),this.updateAxes()},e.redrawAxis=function(t,e,i,n,a){var r,s=this,o=this.owner,c=o.config,l=o.scale,u=o.$el,d=!!l.zoom;!d&&this.isCategorized()&&0===t.length&&l.x.domain([0,u.axis.x.selectAll(".tick").size()]),l.x&&t.length?(!d&&o.updateXDomain(t,e.UpdateXDomain,e.UpdateOrgXDomain,e.TrimXDomain),!c.axis_x_tick_values&&this.updateXAxisTickValues(t)):this.x&&(this.x.tickValues([]),this.subX&&this.subX.tickValues([])),c.zoom_rescale&&!n&&(r=l.x.orgDomain()),["y","y2"].forEach((function(e){var i=l[e];if(i){var n=c["axis_"+e+"_tick_values"],a=c["axis_"+e+"_tick_count"];if(i.domain(o.getYDomain(t,e,r)),!n&&a){var u=o.axis[e],d=i.domain();u.tickValues(s.generateTickValues(d,d.every((function(t){return 0===t}))?1:a,s.isTimeSeriesY()))}}})),this.redraw(i,o.hasArcType(),a),this.updateLabels(e.Transition),(e.UpdateXDomain||e.UpdateXAxis||e.Y)&&t.length&&this.setCulling(),e.Y&&(l.subY&&l.subY.domain(o.getYDomain(t,"y")),l.subY2&&l.subY2.domain(o.getYDomain(t,"y2")))},e.setCulling=function(){var t=this.owner,e=t.config,i=t.state,n=i.clip,a=i.current,r=t.$el;["subX","x","y","y2"].forEach((function(t){var i=r.axis[t],s="subX"===t?"x":t,o=e["axis_"+s+"_tick_culling"];if(i&&o){var c,u=i.selectAll(".tick text"),d=it(u.data()),h=d.length,g=e["axis_"+s+"_tick_culling_max"];if(h){for(var f=1;f<h;f++)if(h/f<g){c=f;break}u.each((function(t){this.style.display=d.indexOf(t)%c?"none":"block"}))}else u.style("display","block");if("x"===t){var p=a.maxTickWidths.x.clipPath?n.pathXAxisTickTexts:null;r.svg.selectAll("."+l.axisX+" .tick text").attr("clip-path",p)}}}))},t}(),Oe={initEventRect:function(){this.$el.main.select("."+l.chart).append("g").attr("class",l.eventRects).style("fill-opacity","0")},redrawEventRect:function(){var t,e=this,i=e.config,n=e.$el,a=e.isMultipleX(),r=e.$el.main.select("."+l.eventRects).style("cursor",i.zoom_enabled&&"drag"!==i.zoom_type?i.axis_rotated?"ns-resize":"ew-resize":null).classed(l.eventRectsMultiple,a).classed(l.eventRectsSingle,!a);if(r.selectAll("."+l.eventRect).remove(),n.eventRect=r.selectAll("."+l.eventRect),a)t=n.eventRect.data([0]),t=e.generateEventRectsForMultipleXs(t.enter()).merge(t);else{var s=e.getMaxDataCountTarget();e.updateDataIndexByX(s),e.updateXs(s),e.updatePointClass&&e.updatePointClass(!0),r.datum(s),n.eventRect=r.selectAll("."+l.eventRect),(t=n.eventRect.data((function(t){return t}))).exit().remove(),t=e.generateEventRectsForSingleX(t.enter()).merge(t)}n.eventRect=t,e.updateEventRect(t),"touch"!==e.state.inputType||n.svg.on("touchstart.eventRect")||e.hasArcType()||e.bindTouchOnEventRect(a)},bindTouchOnEventRect:function(t){var e,i=this,n=i.config,a=i.state,r=i.$el.svg,s=function(){var t=c.event.changedTouches[0];return Object(c.select)(b.elementFromPoint(t.clientX,t.clientY))},o=function(e){if(t)i.selectRectForMultipleXs(e);else{var n=s(),a=function(t){var e=t&&t.attr("class")&&1*t.attr("class").replace(new RegExp("("+l.eventRect+"-?|s)","g"),"");return(isNaN(e)||null===e)&&(e=-1),e}(n);i.callOverOutForTouch(a),-1===a?i.unselectRect():i.selectRectForSingle(e,n,a)}},u=n.interaction_inputType_touch.preventDefault,d=E(u)&&u||!1,h=!isNaN(u)&&u||null;r.on("touchstart.eventRect touchmove.eventRect",(function(){var t=s(),r=c.event;if(!t.empty()&&t.classed(l.eventRect)){if(a.dragging||a.flowing||i.hasArcType()||r.touches.length>1)return;(function(t){var i=t.type,a=t.changedTouches[0]["client"+(n.axis_rotated?"Y":"X")];"touchstart"===i?d?t.preventDefault():null!==h&&(e=a):"touchmove"===i&&(d||!0===e||null!==h&&Math.abs(e-a)>=h)&&(e=!0,t.preventDefault())})(r),o(this)}else i.unselectRect(),i.callOverOutForTouch()}),!0).on("touchend.eventRect",(function(){var t=s();!t.empty()&&t.classed(l.eventRect)&&(i.hasArcType()||!i.toggleShape||a.cancelClick)&&a.cancelClick&&(a.cancelClick=!1)}),!0)},updateEventRect:function(t){var e,i,n,a,r=this,s=r.config,o=r.scale,c=r.state,l=o.zoom||o.x,u=t||r.$el.eventRect.data(),d=s.axis_rotated;if(r.isMultipleX())e=0,i=0,n=c.width,a=c.height;else{var h,g;if(r.axis.isCategorized())h=r.getEventRectWidth(),g=function(t){return l(t.x)-h/2};else{var f=function(t){var e=t.index;return{prev:r.getPrevX(e),next:r.getNextX(e)}};h=function(t){var e=f(t);return null===e.prev&&null===e.next?d?c.height:c.width:(null===e.prev&&(e.prev=l.domain()[0]),null===e.next&&(e.next=l.domain()[1]),Math.max(0,(l(e.next)-l(e.prev))/2))},g=function(t){var e=f(t),i=t.x;return null===e.prev&&null===e.next?0:(null===e.prev&&(e.prev=l.domain()[0]),(l(i)+l(e.prev))/2)}}e=d?0:g,i=d?g:0,n=d?c.width:h,a=d?h:c.height}u.attr("class",r.classEvent.bind(r)).attr("x",e).attr("y",i).attr("width",n).attr("height",a)},selectRectForMultipleXs:function(t){var e=this,i=e.config,n=e.state,a=e.filterTargetsToShow(e.data.targets);if(!n.dragging&&!e.hasArcType(a)){var r=Object(c.mouse)(t),s=e.findClosestFromTargets(a,r);if(n.mouseover&&(!s||s.id!==n.mouseover.id)&&(i.data_onout.call(e.api,n.mouseover),n.mouseover=void 0),!s)return void e.unselectRect();var o=(e.isBubbleType(s)||e.isScatterType(s)||!i.tooltip_grouped?[s]:e.filterByX(a,s.x)).map((function(t){return e.addName(t)}));e.showTooltip(o,t),e.expandCirclesBars(s.index,s.id,!0),e.showGridFocus(o),(e.isBarType(s.id)||e.dist(s,r)<i.point_sensitivity)&&(e.$el.svg.select("."+l.eventRect).style("cursor","pointer"),!n.mouseover&&(i.data_onover.call(e.api,s),n.mouseover=s))}},unselectRect:function(){var t=this,e=t.config,i=t.$el,n=i.bar,a=i.circle,r=i.tooltip;t.$el.svg.select("."+l.eventRect).style("cursor",null),t.hideGridFocus(),r&&(t.hideTooltip(),t._handleLinkedCharts(!1)),a&&!e.point_focus_only&&t.unexpandCircles(),n&&t.unexpandBars()},generateEventRectsForSingleX:function(t){var e=this,i=e.config,n=e.state,a=t.append("rect").attr("class",e.classEvent.bind(e)).style("cursor",i.data_selection_enabled&&i.data_selection_grouped?"pointer":null).on("click",(function(t){e.clickHandlerForSingleX.bind(this)(t,e)})).call(e.getDraggableSelection());return"mouse"===n.inputType&&a.on("mouseover",(function(t){n.dragging||n.flowing||e.hasArcType()||i.tooltip_grouped&&e.setOverOut(!0,t.index)})).on("mousemove",(function(t){if(!(n.dragging||n.flowing||e.hasArcType())){var a=t.index,r=e.$el.svg.select("."+l.eventRect+"-"+a);e.isStepType(t)&&"step-after"===i.line_step_type&&Object(c.mouse)(this)[0]<e.scale.x(e.getXValue(t.id,a))&&(a-=1),-1===a?e.unselectRect():e.selectRectForSingle(this,r,a),i.tooltip_grouped||e.setOverOut(-1!==a,t.index)}})).on("mouseout",(function(t){!i||e.hasArcType()||(e.unselectRect(),e.setOverOut(!1,t.index))})),a},clickHandlerForSingleX:function(t,e){var i=e,n=i.config,a=i.state,r=i.$el.main;if(i.hasArcType()||!i.toggleShape||a.cancelClick)a.cancelClick&&(a.cancelClick=!1);else{var s=t.index;r.selectAll("."+l.shape+"-"+s).each((function(t){(n.data_selection_grouped||i.isWithinShape(this,t))&&(i.toggleShape(this,t,s),n.data_onclick.bind(i.api)(t,this))}))}},generateEventRectsForMultipleXs:function(t){var e=this,i=e.state,n=i.width,a=i.height,r=i.inputType,s=t.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",a).attr("class",l.eventRect).on("click",(function(){e.clickHandlerForMultipleXS.bind(this)(e)})).call(e.getDraggableSelection());return"mouse"===r&&s.on("mouseover mousemove",(function(){e.selectRectForMultipleXs(this)})).on("mouseout",(function(){!e.config||e.hasArcType()||e.unselectRect()})),s},clickHandlerForMultipleXS:function(t){var e=t,i=e.config,n=e.filterTargetsToShow(e.data.targets);if(!e.hasArcType(n)){var a=Object(c.mouse)(this),r=e.findClosestFromTargets(n,a);!r||(e.isBarType(r.id)||e.dist(r,a)<i.point_sensitivity)&&e.$el.main.selectAll("."+l.shapes+e.getTargetSelectorSuffix(r.id)).selectAll("."+l.shape+"-"+r.index).each((function(){(i.data_selection_grouped||e.isWithinShape(this,r))&&(e.toggleShape(this,r,r.index),i.data_onclick.bind(e.api)(r,this))}))}}},Le=i(11),ke={generateFlow:function(t){var e=this,i=e.data,n=e.state,a=e.$el;return function(){var r=t.flow.length;n.flowing=!0,i.targets.forEach((function(t){t.values.splice(0,r)})),e.updateXGrid&&e.updateXGrid(!0);var s={};["axis.x","grid.x","gridLines.x","region.list","text","bar","line","area","circle"].forEach((function(t){var e=t.split("."),i=a[e[0]];i&&e.length>1&&(i=i[e[1]]),i&&i.size()&&(s[t]=i)})),e.hideGridFocus(),e.setFlowList(s,t)}},setFlowList:function(t,e){var i=this,n=e.flow,a=e.targets,r=n,s=r.duration,o=void 0===s?e.duration:s,c=r.index,l=r.length,u=r.orgDataCount,d=i.getFlowTransform(a,u,c,l),h=St(),g=Object(Yt.transition)().ease(Le.easeLinear).duration(o);h.add(Object.keys(t).map((function(e){var n=t[e];return n="axis.x"===e?n.transition(g).call((function(t){return i.axis.x.setTransition(g).create(t)})):"region.list"===e?n.filter(i.isRegionOnX).transition(g).attr("transform",d):n.transition(g).attr("transform",d)}))),g.call(h,(function(){i.cleanUpFlow(t,e)}))},cleanUpFlow:function(t,e){var i=this,n=i.config,a=i.state,r=i.$el.svg,s=n.axis_rotated,o=e.flow,c=e.shape,u=e.xv,d=c.pos,h=d.cx,g=d.cy,f=d.xForText,p=d.yForText,x=o,v=x.done,_=void 0===v?function(){}:v,m=x.length;m&&(["circle","text","shape","eventRect"].forEach((function(t){for(var e=[],i=0;i<m;i++)e.push("."+l[t]+"-"+i);r.selectAll("."+l[t+"s"]).selectAll(e).remove()})),r.select("."+l.xgrid).remove()),Object.keys(t).forEach((function(e){var r=t[e];if("axis.x"!==e&&r.attr("transform",null),"grid.x"===e)r.attr(a.xgridAttr);else if("gridLines.x"===e)r.attr("x1",s?0:u).attr("x2",s?a.width:u);else if("gridLines.x"===e)r.select("line").attr("x1",s?0:u).attr("x2",s?a.width:u),r.select("text").attr("x",s?a.width:0).attr("y",u);else if(/^(area|bar|line)$/.test(e))r.attr("d",c.type[e]);else if("text"===e)r.attr("x",f).attr("y",p).style("fill-opacity",i.opacityForText.bind(i));else if("circle"!==e)"region.list"===e&&r.select("rect").filter(i.isRegionOnX).attr("x",i.regionX.bind(i)).attr("width",i.regionWidth.bind(i));else if(i.isCirclePoint())r.attr("cx",h).attr("cy",g);else{r.attr("x",(function(t){return h(t)-n.point_r})).attr("y",(function(t){return g(t)-n.point_r})).attr("cx",h).attr("cy",g)}})),n.interaction_enabled&&i.redrawEventRect(),_.call(i.api),a.flowing=!1},getFlowTransform:function(t,e,i,n){var a,r=this,s=r.data,o=r.scale.x,c=s.targets[0].values,l=r.getValueOnIndex(c,i),u=r.getValueOnIndex(c,i+n),d=o.domain(),h=r.updateXDomain(t,!0,!0);return e?a=1===e||(l&&l.x)===(u&&u.x)||r.axis.isTimeSeries()?o(d[0])-o(h[0]):o(l.x)-o(u.x):1===c.length?r.axis.isTimeSeries()?(l=r.getValueOnIndex(c,0),u=r.getValueOnIndex(c,c.length-1),a=o(l.x)-o(u.x)):a=I(h)/2:a=o(d[0])-o(h[0]),"translate("+a+",0) scale("+I(d)/I(h)+",1)"}},Ce={initClip:function(){var t=this,e=t.state.clip;e.id=t.state.datetimeId+"-clip",e.idXAxis=e.id+"-xaxis",e.idYAxis=e.id+"-yaxis",e.idGrid=e.id+"-grid",e.path=t.getClipPath(e.id),e.pathXAxis=t.getClipPath(e.idXAxis),e.pathYAxis=t.getClipPath(e.idYAxis),e.pathGrid=t.getClipPath(e.idGrid)},getClipPath:function(t){var e=this.config;return!e.clipPath&&/-clip$/.test(t)||!e.axis_x_clipPath&&/-clip-xaxis$/.test(t)||!e.axis_y_clipPath&&/-clip-yaxis$/.test(t)?null:"url("+(!!y.navigator&&y.navigator.appVersion.toLowerCase().indexOf("msie 9.")>=0?"":b.URL.split("#")[0])+"#"+t+")"},appendClip:function(t,e){e&&t.append("clipPath").attr("id",e).append("rect")},setXAxisClipPath:function(t){var e=this.config,i=this.state,n=i.margin,a=i.width,r=i.height,s=e.axis_rotated,o=Math.max(30,n.left)-(s?0:20),c=s?-(1+o):-(o-1),l=-Math.max(15,n.top),u=s?n.left+20:a+10+o,d=(s?n.top+r+10:n.bottom)+20;t.attr("x",c).attr("y",l).attr("width",u).attr("height",d)},setYAxisClipPath:function(t){var e=this.config,i=this.state,n=i.margin,a=i.width,r=i.height,s=e.axis_rotated,o=Math.max(30,n.left)-(s?20:0),c=e.axis_y_inner,l=c?-1:s?-(1+o):-(o-1),u=-(s?-20:n.top),d=(s?a+15+o:n.left+20)+(c?20:0),h=(s?n.bottom:n.top+r)+10;t.attr("x",l).attr("y",u).attr("width",d).attr("height",h)},updateXAxisTickClip:function(){var t=this,e=t.config,i=t.state,n=i.clip,a=i.xAxisHeight,r=t.$el.defs,s=t.getHorizontalAxisHeight("x");if(r&&!n.idXAxisTickTexts){var o=n.id+"-xaxisticktexts";t.appendClip(r,o),n.pathXAxisTickTexts=t.getClipPath(n.idXAxisTickTexts),n.idXAxisTickTexts=o}!e.axis_x_tick_multiline&&t.getAxisTickRotate("x")&&s!==a&&(t.setXAxisTickClipWidth(),t.setXAxisTickTextClipPathWidth()),t.state.xAxisHeight=s},setXAxisTickClipWidth:function(){var t=this.config,e=this.state.current.maxTickWidths,i=this.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){var n=Math.sin(Math.PI/180*Math.abs(i));e.x.clipPath=(this.getHorizontalAxisHeight("x")-20)/n}else e.x.clipPath=null},setXAxisTickTextClipPathWidth:function(){var t=this.state,e=t.clip,i=t.current,n=this.$el.svg;n&&n.select("#"+e.idXAxisTickTexts+" rect").attr("width",i.maxTickWidths.x.clipPath).attr("height",30)}},Ee=function(t){return w(t.position)||"end"},Re=function(t){return"start"===t.position?4:"middle"===t.position?0:-4};function De(t,e,i){return function(n){var a=t?0:e;return"start"===n.position?a=t?-i:0:"middle"===n.position&&(a=(t?-i:e)/2),a}}function Ie(t,e){"grid"===e&&t.each((function(){var t=Object(c.select)(this);["x1","x2","y1","y2"].forEach((function(e){return t.attr(e,Math.ceil(+t.attr(e)))}))}))}var Xe={hasGrid:function(){var t=this.config;return["x","y"].some((function(e){return t["grid_"+e+"_show"]||t["grid_"+e+"_lines"].length}))},initGrid:function(){this.hasGrid()&&this.initGridLines(),this.config.interaction_enabled&&this.initFocusGrid()},initGridLines:function(){var t=this.config,e=this.state.clip,i=this.$el;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g","."+l.chart+(t.grid_lines_front?" + *":"")).attr("clip-path",e.pathGrid).attr("class",l.grid+" "+l.gridLines),i.gridLines.main.append("g").attr("class",l.xgridLines),i.gridLines.main.append("g").attr("class",l.ygridLines),i.gridLines.x=Object(c.selectAll)([]))},updateXGrid:function(t){var e=this,i=e.config,n=e.scale,a=e.state,r=e.$el,s=r.main,o=r.grid,u=i.axis_rotated,d=e.generateGridData(i.grid_x_type,n.x),h=e.axis.isCategorized()?e.axis.x.tickOffset():0,g=function(t){return(n.zoom||n.x)(t)+h*(u?-1:1)};a.xgridAttr=u?{x1:0,x2:a.width,y1:g,y2:g}:{x1:g,x2:g,y1:0,y2:a.height},o.x=s.select("."+l.xgrids).selectAll("."+l.xgrid).data(d),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",l.xgrid).merge(o.x),t||o.x.each((function(){var t=Object(c.select)(this);Object.keys(a.xgridAttr).forEach((function(e){t.attr(e,a.xgridAttr[e]).style("opacity",(function(){return t.attr(u?"y1":"x1")===(u?a.height:0)?"0":"1"}))}))}))},updateYGrid:function(){var t=this,e=t.config,i=t.state,n=t.$el,a=n.grid,r=n.main,s=e.axis_rotated,o=t.axis.y.tickValues()||t.scale.y.ticks(e.grid_y_ticks),c=function(e){return Math.ceil(t.scale.y(e))};a.y=r.select("."+l.ygrids).selectAll("."+l.ygrid).data(o),a.y.exit().remove(),a.y=a.y.enter().append("line").attr("class",l.ygrid).merge(a.y),a.y.attr("x1",s?c:0).attr("x2",s?c:i.width).attr("y1",s?0:c).attr("y2",s?i.height:c),Ie(a.y,"grid")},updateGrid:function(t){var e=this,i=e.$el,n=i.grid;i.gridLines.main||e.initGridLines(),n.main.style("visibility",e.hasArcType()?"hidden":"visible"),e.hideGridFocus(),e.updateXGridLines(t),e.updateYGridLines(t)},updateXGridLines:function(t){var e=this.config,i=this.$el,n=i.gridLines,a=i.main,r=e.axis_rotated;e.grid_x_show&&this.updateXGrid();var s=a.select("."+l.xgridLines).selectAll("."+l.xgridLine).data(e.grid_x_lines);s.exit().transition().duration(t).style("opacity","0").remove();var o=s.enter().append("g");o.append("line").style("opacity","0"),o.append("text").attr("transform",r?"":"rotate(-90)").attr("dy",-5).style("opacity","0"),(s=o.merge(s)).attr("class",(function(t){return(l.xgridLine+" "+(t.class||"")).trim()})).select("text").attr("text-anchor",Ee).attr("dx",Re).transition().duration(t).text((function(t){return t.text})).transition().style("opacity","1"),n.x=s},updateYGridLines:function(t){var e=this,i=e.config,n=e.state,a=n.width,r=n.height,s=e.$el,o=i.axis_rotated;i.grid_y_show&&e.updateYGrid();var c=s.main.select("."+l.ygridLines).selectAll("."+l.ygridLine).data(i.grid_y_lines);c.exit().transition().duration(t).style("opacity","0").remove();var u=c.enter().append("g");u.append("line").style("opacity","0"),u.append("text").attr("transform",o?"rotate(-90)":"").style("opacity","0"),c=u.merge(c);var d=e.yv.bind(e);c.attr("class",(function(t){return(l.ygridLine+" "+(t.class||"")).trim()})).select("line").transition().duration(t).attr("x1",o?d:0).attr("x2",o?d:a).attr("y1",o?0:d).attr("y2",o?r:d).transition().style("opacity","1"),c.select("text").attr("text-anchor",Ee).attr("dx",Re).transition().duration(t).attr("dy",-5).attr("x",De(o,a,r)).attr("y",d).text((function(t){return t.text})).transition().style("opacity","1"),s.gridLines.y=c},redrawGrid:function(t){var e=this,i=e.config.axis_rotated,n=e.state,a=n.width,r=n.height,s=e.$el.gridLines,o=e.xv.bind(e),c=s.x.select("line"),l=s.x.select("text");return c=(t?c.transition():c).attr("x1",i?0:o).attr("x2",i?a:o).attr("y1",i?o:0).attr("y2",i?o:r),l=(t?l.transition():l).attr("x",De(!i,a,r)).attr("y",o).text((function(t){return t.text})),[(t?c.transition():c).style("opacity","1"),(t?l.transition():l).style("opacity","1")]},initFocusGrid:function(){var t=this.config,e=this.state.clip,i=this.$el,n=t.grid_front,a="."+l[n&&i.gridLines.main?"gridLines":"chart"]+(n?" + *":""),r=i.main.insert("g",a).attr("clip-path",e.pathGrid).attr("class",l.grid);i.grid.main=r,t.grid_x_show&&r.append("g").attr("class",l.xgrids),t.grid_y_show&&r.append("g").attr("class",l.ygrids),t.grid_focus_show&&(r.append("g").attr("class",l.xgridFocus).append("line").attr("class",l.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&r.append("g").attr("class",l.ygridFocus).append("line").attr("class",l.ygridFocus))},showGridFocus:function(t){var e=this,i=e.config,n=e.state,a=n.width,r=n.height,s=i.axis_rotated,o=e.$el.main.selectAll("line."+l.xgridFocus+", line."+l.ygridFocus),u=(t||[o.datum()]).filter((function(t){return t&&w(e.getBaseValue(t))}));if(i.tooltip_show&&0!==u.length&&!e.hasType("bubble")&&!e.hasArcType()){var d=i.grid_focus_edge&&!i.tooltip_grouped,h=e.xx.bind(e);o.style("visibility","visible").data(u.concat(u)).each((function(t){var i,n=Object(c.select)(this),o={x:h(t),y:e.getYScaleById(t.id)(t.value)};if(n.classed(l.xgridFocus))i=s?[null,o.x,d?o.y:a,o.x]:[o.x,d?o.y:null,o.x,r];else{var u="y2"===e.axis.getId(t.id);i=s?[o.y,d&&!u?o.x:null,o.y,d&&u?o.x:r]:[d&&u?o.x:null,o.y,d&&!u?o.x:a,o.y]}["x1","y1","x2","y2"].forEach((function(t,e){return n.attr(t,i[e])}))})),Ie(o,"grid"),e.showCircleFocus&&e.showCircleFocus(t)}},hideGridFocus:function(){var t=this.state.inputType,e=this.$el.main;"mouse"===t&&(e.selectAll("line."+l.xgridFocus+", line."+l.ygridFocus).style("visibility","hidden"),this.hideCircleFocus&&this.hideCircleFocus())},updateGridFocus:function(){var t=this,e=t.state,i=e.inputType,n=e.width,a=e.height,r=e.resizing,s=t.$el.grid.main.select("line."+l.xgridFocus);if("touch"===i)s.empty()?r&&t.showCircleFocus():t.showGridFocus();else{var o=t.config.axis_rotated;s.attr("x1",o?0:-10).attr("x2",o?n:-10).attr("y1",o?-10:0).attr("y2",o?-10:a)}return!0},generateGridData:function(t,e){var i=this.$el.main.select("."+l.axisX).selectAll(".tick").size(),n=[];if("year"===t)for(var a=this.getXDomain(),r=a[0].getFullYear(),s=a[1].getFullYear(),o=r;o<=s;o++)n.push(new Date(o+"-01-01 00:00:00"));else(n=e.ticks(10)).length>i&&(n=n.filter((function(t){return(t+"").indexOf(".")<0})));return n},getGridFilterToRemove:function(t){return t?function(e){var i=!1;return(M(t)?t.concat():[t]).forEach((function(t){("value"in t&&e.value===t.value||"class"in t&&e.class===t.class)&&(i=!0)})),i}:function(){return!0}},removeGridLines:function(t,e){var i=this.config,n=this.getGridFilterToRemove(t),a=e?l.xgridLines:l.ygridLines,r=e?l.xgridLine:l.ygridLine;this.$el.main.select("."+a).selectAll("."+r).filter(n).transition().duration(i.transition_duration).style("opacity","0").remove();var s="grid_"+(e?"x":"y")+"_lines";i[s]=i[s].filter((function(t){return!n(t)}))}},ze={initRegion:function(){var t=this.$el;t.region.main=t.main.append("g").attr("clip-path",this.state.clip.path).attr("class",l.regions)},updateRegion:function(t){var e=this,i=e.config,n=e.$el;n.region.main||e.initRegion(),n.region.main.style("visibility",e.hasArcType()?"hidden":"visible");var a=n.main.select("."+l.regions).selectAll("."+l.region).data(i.regions);a.exit().transition().duration(t).style("opacity","0").remove(),(a=a.enter().append("g").merge(a).attr("class",e.classRegion.bind(e))).append("rect").style("fill-opacity","0"),n.region.list=a},redrawRegion:function(t){var e=this,i=e.$el.region.list.select("rect");return i=(t?i.transition():i).attr("x",e.regionX.bind(e)).attr("y",e.regionY.bind(e)).attr("width",e.regionWidth.bind(e)).attr("height",e.regionHeight.bind(e)),[(t?i.transition():i).style("fill-opacity",(function(t){return w(t.opacity)?t.opacity:"0.1"})).on("end",(function(){Object(c.select)(this.parentNode).selectAll("rect:not([x])").remove()}))]},getRegionXY:function(t,e){var i=this.config,n=this.scale,a=i.axis_rotated,r="x"===t,s="start",o=0;return"y"===e.axis||"y2"===e.axis?(!r&&(s="end"),(r?a:!a)&&s in e&&(o=(0,n[e.axis])(e[s]))):(r?!a:a)&&s in e&&(o=(n.zoom||n.x)(this.axis.isTimeSeries()?ot.call(this,e[s]):e[s])),o},regionX:function(t){return this.getRegionXY("x",t)},regionY:function(t){return this.getRegionXY("y",t)},getRegionSize:function(t,e){var i=this,n=i.config,a=i.scale,r=i.state,s=n.axis_rotated,o="width"===t,c=i[o?"regionX":"regionY"](e),l="end",u=r[t];return"y"===e.axis||"y2"===e.axis?(!o&&(l="start"),(o?s:!s)&&l in e&&(u=(0,a[e.axis])(e[l]))):(o?!s:s)&&l in e&&(u=(a.zoom||a.x)(i.axis.isTimeSeries()?ot.call(i,e[l]):e[l])),u<c?0:u-c},regionWidth:function(t){return this.getRegionSize("width",t)},regionHeight:function(t){return this.getRegionSize("height",t)},isRegionOnX:function(t){return!t.axis||"x"===t.axis}},Pe={getAxisSize:function(t){var e=this.config.axis_rotated;return e&&"x"===t||!e&&/y2?/.test(t)?this.getAxisWidthByAxisId(t,!0):this.getHorizontalAxisHeight(t)},getAxisWidthByAxisId:function(t,e){if(this.axis){var i=this.axis&&this.axis.getLabelPositionById(t);return this.axis.getMaxTickWidth(t,e)+(i.isInner?20:40)}return 40},getHorizontalAxisHeight:function(t){var e=this,i=e.config,n=e.state,a=n.current,r=n.rotatedPadding,s=n.isLegendRight,o=n.isLegendInset,c=i.axis_rotated,l=30;if("x"===t&&!i.axis_x_show)return 8;if("x"===t&&i.axis_x_height)return i.axis_x_height;if("y"===t&&!i.axis_y_show)return!i.legend_show||s||o?1:10;if("y2"===t&&!i.axis_y2_show)return r.top;var u=e.getAxisTickRotate(t);return("x"===t&&!c||/y2?/.test(t)&&c)&&u&&(l=30+e.axis.getMaxTickWidth(t)*Math.cos(Math.PI*(90-u)/180),!i.axis_x_tick_multiline&&a.height&&l>a.height/2&&(l=a.height/2)),l+(e.axis.getLabelPositionById(t).isInner?0:10)+("y2"!==t||c?0:-10)},getEventRectWidth:function(){return Math.max(0,this.axis.x.tickInterval())},getAxisTickRotate:function(t){var e=this,i=e.axis,n=e.config,a=e.state,r=e.$el,s=n["axis_"+t+"_tick_rotate"];if("x"===t){var o=i.isCategorized(),c=i.isTimeSeries(),l=o||c,u=0;n.axis_x_tick_fit&&l&&((u=a.current.maxTickWidths.x.ticks.length+(c?-1:1))!==a.axis.x.tickCount&&(a.axis.x.padding=e.axis.getXAxisPadding(u)),a.axis.x.tickCount=u),r.svg&&n.axis_x_tick_fit&&!n.axis_x_tick_multiline&&!n.axis_x_tick_culling&&n.axis_x_tick_autorotate&&l&&(s=e.needToRotateXAxisTickTexts()?n.axis_x_tick_rotate:0)}return s},needToRotateXAxisTickTexts:function(){var t=this.state,e=t.axis,i=t.current.width-this.getCurrentPaddingLeft(!1)-this.getCurrentPaddingRight(!0),n=e.x.tickCount+e.x.padding.left+e.x.padding.right;return this.axis.getMaxTickWidth("x")>(i/n||0)}},Me={data_x:void 0,data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1},Fe={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:void 0,axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},Be={axis_y2_show:!1,axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]};function $e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function je(t){for(var e,i=1;i<arguments.length;i++)e=null==arguments[i]?{}:arguments[i],i%2?$e(Object(e),!0).forEach((function(i){r(t,i,e[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):$e(Object(e)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}));return t}var Ne=je(je(je({axis_rotated:!1},{axis_x_clipPath:!0,axis_x_show:!0,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_count:void 0,axis_x_tick_show:!0,axis_x_tick_text_show:!0,axis_x_tick_text_position:{x:0,y:0},axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_autorotate:!1,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_tick_tooltip:!1,axis_x_max:void 0,axis_x_min:void 0,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_x_axes:[]}),Fe),Be),Ye=[de,{category:function(t,e){var i=this.internal,n=i.config;return arguments.length>1&&(n.axis_x_categories[t]=e,i.redraw()),n.axis_x_categories[t]},categories:function(t){var e=this.internal,i=e.config;return arguments.length?(i.axis_x_categories=t,e.redraw(),i.axis_x_categories):i.axis_x_categories}},ge,pe,ye,xe,_e,me],Ge=[we,Ce,Oe,ke,Xe,ze,Pe],Ve=[Me,Ne,{grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:10,grid_focus_edge:!1,grid_focus_show:!0,grid_focus_y:!1,grid_front:!1,grid_lines_front:!0}],He=i(12),We={initPie:function(){var t=this,e=t.config,i=e.data_type,n=e.pie_padding,a=e[i+"_startingAngle"]||0,r=(t.hasType("pie")&&n?.01*n:e[i+"_padAngle"])||0,s=t.isOrderAsc()||t.isOrderDesc()?function(e,i){return t.isOrderAsc()?e-i:i-e}:null;t.pie=Object(Wt.pie)().startAngle(a).endAngle(a+2*Math.PI).padAngle(r).sortValues(s).value((function(t){return t.values.reduce((function(t,e){return t+e.value}),0)}))},updateRadius:function(){var t=this,e=t.config,i=t.state,n=e.pie_innerRadius,a=e.pie_padding,r=e.gauge_width||e.donut_width,s=t.filterTargetsToShow(t.data.targets).length*e.gauge_arcs_minWidth;i.radiusExpanded=Math.min(i.arcWidth,i.arcHeight)/2*(t.hasMultiArcGauge()?.85:1),i.radius=.95*i.radiusExpanded,i.innerRadiusRatio=r?(i.radius-r)/i.radius:.6,i.gaugeArcWidth=r||(s<=i.radius-i.innerRadius?i.radius-i.innerRadius:s<=i.radius?s:i.radius);var o=n||(a?a*(i.innerRadiusRatio+.1):0);i.innerRadius=t.hasType("donut")||t.hasType("gauge")?i.radius*i.innerRadiusRatio:o},getInnerRadius:function(t){var e=this.state.innerRadius;return!L(e)&&t&&(e=e[t.data.id]||0),e},updateArc:function(){this.svgArc=this.getSvgArc(),this.svgArcExpanded=this.getSvgArcExpanded()},updateAngle:function(t){var e=this,i=e.config,n=e.state,a=e.pie,r=t,s=!1;if(!i)return null;var o=Math.PI*(i.gauge_fullCircle?2:1),c=i.gauge_startingAngle;if(r.data&&e.isGaugeType(r.data)&&!e.hasMultiArcGauge()){var l=e.getTotalDataSum(n.rendered);l>i.gauge_max&&(i.gauge_max=l);var u=o*(l/(i.gauge_max-i.gauge_min));a=a.startAngle(c).endAngle(u+c)}if(a(e.filterTargetsToShow()).forEach((function(t,e){s||t.data.id!==r.data.id||(s=!0,(r=t).index=e)})),isNaN(r.startAngle)&&(r.startAngle=0),isNaN(r.endAngle)&&(r.endAngle=r.startAngle),r.data&&e.hasMultiArcGauge()){var d=e.getMinMaxData().max[0].value;d>i.gauge_max&&(i.gauge_max=d);var h=i.gauge_min,g=i.gauge_max,f=r.value<h?0:r.value<g?r.value-h:g-h;r.startAngle=c,r.endAngle=c+o/(g-h)*f}return s?r:null},getSvgArc:function(){var t=this,e=t.state,i=t.getInnerRadius(),n=e.gaugeArcWidth/t.filterTargetsToShow(t.data.targets).length,a=t.hasMultiArcGauge(),r=Object(Wt.arc)().outerRadius((function(t){return a?e.radius-n*t.index:e.radius})).innerRadius((function(t){return a?e.radius-n*(t.index+1):L(i)?i:0})),s=function(e,n){var a="M 0 0";if(e.value||e.data){L(i)||(r=r.innerRadius(t.getInnerRadius(e)));var s=!n&&t.updateAngle(e);n?a=r(e):s&&(a=r(s))}return a};return s.centroid=r.centroid,s},getSvgArcExpanded:function(t){var e=this,i=e.state,n=t||1,a=i.gaugeArcWidth/e.filterTargetsToShow(e.data.targets).length,r=e.hasMultiArcGauge(),s=Math.min(i.radiusExpanded*n-i.radius,.8*a-100*(1-n)),o=Object(Wt.arc)().outerRadius((function(t){return r?i.radius-a*t.index+s:i.radiusExpanded*n})).innerRadius((function(t){return r?i.radius-a*(t.index+1):i.innerRadius}));return function(t){var i=e.updateAngle(t);return i?(r?o:o.innerRadius(e.getInnerRadius(t)))(i):"M 0 0"}},getArc:function(t,e,i){return i||this.isArcType(t.data)?this.svgArc(t,e):"M 0 0"},transformForArcLabel:function(t){var e=this,i=e.config,n=e.state,a=n.radius,r=n.radiusExpanded,s=e.updateAngle(t),o="";if(s)if(e.hasMultiArcGauge()){var c=Math.sin(s.endAngle-Math.PI/2);o="translate("+(u=Math.cos(s.endAngle-Math.PI/2)*(r+25))+","+(d=c*(r+15-Math.abs(10*c))+3)+")"}else if(!e.hasType("gauge")||e.data.targets.length>1){var l=this.svgArc.centroid(s),u=isNaN(l[0])?0:l[0],d=isNaN(l[1])?0:l[1],h=Math.sqrt(u*u+d*d),g=e.hasType("donut")&&i.donut_label_ratio||e.hasType("pie")&&i.pie_label_ratio;o="translate("+u*(g=g?S(g)?g.bind(e.api)(t,a,h):g:a&&(h?(36/a>.375?1.175-36/a:.8)*a/h:0))+","+d*g+")"}return o},convertToArcData:function(t){return this.addName({id:t.data.id,value:t.value,ratio:this.getRatio("arc",t),index:t.index})},textForArcLabel:function(t){var e=this,i=e.hasType("gauge");e.shouldShowArcLabel()&&t.style("fill",e.updateTextColor.bind(e)).each((function(t){var n=Object(c.select)(this),a=e.updateAngle(t),r=e.getRatio("arc",a);if(e.meetsLabelThreshold(r,(e.hasType("donut")?"donut":e.hasType("gauge")&&"gauge")||e.hasType("pie")&&"pie")){var s=(a||t).value;Y(n,(e.getArcLabelFormat()||e.defaultArcValueFormat)(s,r,t.data.id).toString(),[-1,1],i)}else n.text("")}))},expandArc:function(t){var e=this,i=e.state.transiting,n=e.$el;if(i)var a=setInterval((function(){i||(clearInterval(a),n.legend.selectAll("."+l.legendItemFocused).size()>0&&e.expandArc(t))}),10);else{var r=e.mapToTargetIds(t);n.svg.selectAll(e.selectorTargets(r,"."+l.chartArc)).each((function(t){if(e.shouldExpand(t.data.id)){var i=e.getExpandConfig(t.data.id,"duration"),n=e.getSvgArcExpanded(e.getExpandConfig(t.data.id,"rate"));Object(c.select)(this).selectAll("path").transition().duration(i).attr("d",e.svgArcExpanded).transition().duration(2*i).attr("d",n)}}))}},unexpandArc:function(t){var e=this,i=e.state.transiting,n=e.$el.svg;if(!i){var a=e.mapToTargetIds(t);n.selectAll(e.selectorTargets(a,"."+l.chartArc)).selectAll("path").transition().duration((function(t){return e.getExpandConfig(t.data.id,"duration")})).attr("d",e.svgArc),n.selectAll(""+l.arc).style("opacity","1")}},getExpandConfig:function(t,e){var i,n=this.config;return this.isDonutType(t)?i="donut":this.isGaugeType(t)?i="gauge":this.isPieType(t)&&(i="pie"),i?n[i+"_expand_"+e]:{duration:50,rate:.98}[e]},shouldExpand:function(t){var e=this.config;return this.isDonutType(t)&&e.donut_expand||this.isGaugeType(t)&&e.gauge_expand||this.isPieType(t)&&e.pie_expand},shouldShowArcLabel:function(){var t=this,e=t.config;return["pie","donut","gauge"].some((function(i){return t.hasType(i)&&e[i+"_label_show"]}))},getArcLabelFormat:function(){var t=this.config,e=t.pie_label_format;return this.hasType("gauge")?e=t.gauge_label_format:this.hasType("donut")&&(e=t.donut_label_format),S(e)?e.bind(this.api):e},getArcTitle:function(){var t=this.hasType("donut")?"donut":this.hasType("gauge")&&"gauge";return t?this.config[t+"_title"]:""},updateTargetsForArc:function(t){var e=this,i=e.$el,n=e.hasType("gauge"),a=e.classChartArc.bind(e),r=e.classArcs.bind(e),s=e.classFocus.bind(e),o=i.main.select("."+l.chartArcs),c=o.selectAll("."+l.chartArc).data(e.pie(t)).attr("class",(function(t){return a(t)+s(t.data)})),u=c.enter().append("g").attr("class",a);u.append("g").attr("class",r).merge(c),u.append("text").attr("dy",n&&!e.hasMultiTargets()?"-.1em":".35em").style("opacity","0").style("text-anchor","middle").style("pointer-events","none"),i.text=o.selectAll("."+l.target+" text")},initArc:function(){var t=this.$el;t.arcs=t.main.select("."+l.chart).append("g").attr("class",l.chartArcs).attr("transform",this.getTranslate("arc")),this.setArcTitle()},setArcTitle:function(){var t=this.getArcTitle(),e=this.hasType("gauge");if(t){var i=this.$el.arcs.append("text").attr("class",l[e?"chartArcsGaugeTitle":"chartArcsTitle"]).style("text-anchor","middle");e&&i.attr("dy","-0.3em").style("font-size","27px"),Y(i,t,e?void 0:[-.6,1.35],!0)}},redrawArc:function(t,e,i){var n=this,a=n.config,r=n.state,s=n.$el.main,o=a.interaction_enabled,u=o&&a.data_selection_isselectable,d=s.selectAll("."+l.arcs).selectAll("."+l.arc).data(n.arcData.bind(n));d.exit().transition().duration(e).style("opacity","0").remove(),d=d.enter().append("path").attr("class",n.classArc.bind(n)).style("fill",(function(t){return n.color(t.data)})).style("cursor",(function(t){return u&&u.bind(n.api)(t)?"pointer":null})).style("opacity","0").each((function(t){n.isGaugeType(t.data)&&(t.startAngle=a.gauge_startingAngle,t.endAngle=a.gauge_startingAngle),this._current=t})).merge(d),n.hasMultiArcGauge()&&n.redrawMultiArcGauge(),d.attr("transform",(function(t){return!n.isGaugeType(t.data)&&i?"scale(0)":""})).style("opacity",(function(t){return t===this._current?"0":"1"})).each((function(){r.transiting=!0})).transition().duration(t).attrTween("d",(function(t){var e=n.updateAngle(t);if(!e)return function(){return"M 0 0"};isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);var i=Object(He.interpolate)(this._current,e);return this._current=i(0),function(e){var a=i(e);return a.data=t.data,n.getArc(a,!0)}})).attr("transform",i?"scale(1)":"").style("fill",(function(t){var e;return n.levelColor?(e=n.levelColor(t.data.values[0].value),a.data_colors[t.data.id]=e):e=n.color(t.data.id),e})).style("opacity","1").call(j,(function(){if(n.levelColor){var t=Object(c.select)(this),e=t.datum();n.updateLegendItemColor(e.data.id,t.style("fill"))}r.transiting=!1,$(a.onrendered,n.api)})),o&&n.bindArcEvent(d),n.redrawArcText(t)},bindArcEvent:function(t){function e(t,e,i){n.expandArc(i),n.api.focus(i),n.toggleFocusLegend(i,!0),n.showTooltip([e],t)}function i(t){var e=t&&t.id||void 0;n.unexpandArc(e),n.api.revert(),n.revertLegend(),n.hideTooltip()}var n=this,a=n.config,r=n.state,s="touch"===r.inputType,o="mouse"===r.inputType;if(t.on("click",(function(t,e){var i,r=n.updateAngle(t);r&&(i=n.convertToArcData(r),n.toggleShape&&n.toggleShape(this,i,e),a.data_onclick.bind(n.api)(i,this))})),o&&t.on("mouseover",(function(t){if(!r.transiting){var i=n.updateAngle(t),a=i?n.convertToArcData(i):null;e(this,a,a&&a.id||void 0),n.setOverOut(!0,a)}})).on("mouseout",(function(t){if(!r.transiting){var e=n.updateAngle(t),a=e?n.convertToArcData(e):null;i(),n.setOverOut(!1,a)}})).on("mousemove",(function(t){var e=n.updateAngle(t),i=e?n.convertToArcData(e):null;n.showTooltip([i],this)})),s&&n.hasArcType()&&!n.radars){var l=function(){if(!r.transiting){var t=(l=c.event.changedTouches[0],Object(c.select)(b.elementFromPoint(l.clientX,l.clientY))).datum(),a=t&&t.data&&t.data.id?n.updateAngle(t):null,s=a?n.convertToArcData(a):null,o=s&&s.id||void 0;n.callOverOutForTouch(s),k(o)?i():e(this,s,o)}var l};n.$el.svg.on("touchstart",l).on("touchmove",l)}},redrawArcText:function(t){var e,i=this,n=i.config,a=i.state,r=i.$el,s=r.main,o=r.arcs,c=i.hasType("gauge"),u=i.hasMultiArcGauge();if(c&&1===i.data.targets.length&&n.gauge_title||(e=s.selectAll("."+l.chartArc).select("text").style("opacity","0").attr("class",(function(t){return i.isGaugeType(t.data)?l.gaugeValue:null})).call(i.textForArcLabel.bind(i)).attr("transform",i.transformForArcLabel.bind(i)).style("font-size",(function(t){return i.isGaugeType(t.data)&&1===i.data.targets.length&&!u?Math.round(a.radius/5)+"px":null})).transition().duration(t).style("opacity",(function(t){return i.isTargetToShow(t.data.id)&&i.isArcType(t.data)?"1":"0"})),u&&e.attr("dy","-.1em")),s.select("."+l.chartArcsTitle).style("opacity",i.hasType("donut")||c?"1":"0"),c){var d=n.gauge_fullCircle,h=-1*Math.PI/2,g=(d?-4:-1)*h;d&&e&&e.attr("dy",""+Math.round(a.radius/14));var f=i.$el.arcs.select((u?"g":"")+"."+l.chartArcsBackground);if(u){var p=0;(f=f.selectAll("path."+l.chartArcsBackground).data(i.data.targets)).enter().append("path").attr("class",(function(t,e){return l.chartArcsBackground+" "+l.chartArcsBackground+"-"+e})).merge(f).attr("d",(function(t){if(a.hiddenTargetIds.indexOf(t.id)>=0)return"M 0 0";var e={data:[{value:n.gauge_max}],startAngle:h,endAngle:g,index:p++};return i.getArc(e,!0,!0)})),f.exit().remove()}else f.attr("d",(function(){var t={data:[{value:n.gauge_max}],startAngle:h,endAngle:g};return i.getArc(t,!0,!0)}));o.select("."+l.chartArcsGaugeUnit).attr("dy",".75em").text(n.gauge_label_show?n.gauge_units:""),n.gauge_label_show&&(o.select("."+l.chartArcsGaugeMin).attr("dx",-1*(a.innerRadius+(a.radius-a.innerRadius)/(d?1:2))+"px").attr("dy","1.2em").text(i.textForGaugeMinMax(n.gauge_min,!1)),!d&&o.select("."+l.chartArcsGaugeMax).attr("dx",a.innerRadius+(a.radius-a.innerRadius)/2+"px").attr("dy","1.2em").text(i.textForGaugeMinMax(n.gauge_max,!0)))}}},Ue={initArea:function(t){t.insert("g","."+l.circles).attr("class",this.classAreas.bind(this))},updateAreaGradient:function(){var t=this,e=t.config,i=t.state.datetimeId,n=t.$el.defs;t.data.targets.forEach((function(a){var r=i+"-areaGradient"+t.getTargetSelectorSuffix(a.id);if(t.isAreaType(a)&&n.select("#"+r).empty()){var s=t.color(a),o=e.area_linearGradient,c=o.x,l=void 0===c?[0,0]:c,u=o.y,d=void 0===u?[0,1]:u,h=o.stops,g=void 0===h?[[0,s,1],[1,s,0]]:h,f=n.append("linearGradient").attr("id",""+r).attr("x1",l[0]).attr("x2",l[1]).attr("y1",d[0]).attr("y2",d[1]);g.forEach((function(e){var i=S(e[1])?e[1].bind(t.api)(a.id):e[1];f.append("stop").attr("offset",e[0]).attr("stop-color",i||s).attr("stop-opacity",e[2])}))}}))},updateAreaColor:function(t){return this.config.area_linearGradient?"url(#"+this.state.datetimeId+"-areaGradient"+this.getTargetSelectorSuffix(t.id)+")":this.color(t)},updateArea:function(t){var e=this,i=e.config,n=e.state,a=e.$el;i.area_linearGradient&&e.updateAreaGradient(),a.area=a.main.selectAll("."+l.areas).selectAll("."+l.area).data(e.lineData.bind(e)),a.area.exit().transition().duration(t).style("opacity","0").remove(),a.area=a.area.enter().append("path").attr("class",e.classArea.bind(e)).style("fill",e.updateAreaColor.bind(e)).style("opacity",(function(){return n.orgAreaOpacity=Object(c.select)(this).style("opacity"),"0"})).merge(a.area),a.area.style("opacity",n.orgAreaOpacity)},redrawArea:function(t,e){var i=this,n=i.state.orgAreaOpacity;return[(e?i.$el.area.transition(W()):i.$el.area).attr("d",t).style("fill",i.updateAreaColor.bind(i)).style("opacity",(function(t){return(i.isAreaRangeType(t)?n/1.75:n)+""}))]},generateDrawArea:function(t,e){var i=this,n=i.config,a=n.line_connectNull,r=n.axis_rotated,s=i.generateGetAreaPoints(t,e),o=i.getYScaleById.bind(i),c=function(t){return(e?i.subxx:i.xx).call(i,t)},l=function(t,n){return i.isGrouped(t.id)?s(t,n)[0][1]:o(t.id,e)(i.isAreaRangeType(t)?i.getAreaRangeData(t,"high"):i.getShapeYMin(t.id))},u=function(t,n){return i.isGrouped(t.id)?s(t,n)[1][1]:o(t.id,e)(i.isAreaRangeType(t)?i.getAreaRangeData(t,"low"):t.value)};return function(t){var e,s=a?i.filterRemoveNull(t.values):t.values,o=0,d=0;if(i.isAreaType(t)){var h=Object(Wt.area)();h=r?h.y(c).x0(l).x1(u):h.x(c).y0(n.area_above?0:l).y1(u),a||(h=h.defined((function(t){return null!==i.getBaseValue(t)}))),i.isStepType(t)&&(s=i.convertValuesToStep(s)),e=h.curve(i.getCurve(t))(s)}else s[0]&&(o=i.scale.x(s[0].x),d=i.getYScaleById(t.id)(s[0].value)),e=r?"M "+d+" "+o:"M "+o+" "+d;return e||"M 0 0"}},generateGetAreaPoints:function(t,e){var i=this,n=i.config,a=i.getShapeX(0,t,e),r=i.getShapeY(!!e),s=i.getShapeOffset(i.isAreaType,t,e),o=i.getYScaleById.bind(i);return function(t,c){var l=o.call(i,t.id,e)(i.getShapeYMin(t.id)),u=s(t,c)||l,d=a(t),h=r(t);return n.axis_rotated&&(t.value>0&&h<l||t.value<0&&l<h)&&(h=l),[[d,u],[d,h-(l-u)],[d,h-(l-u)],[d,u]]}}},Ze={initBar:function(){var t=this.$el;t.bar=t.main.select("."+l.chart).insert("g",":first-child").attr("class",l.chartBars)},updateTargetsForBar:function(t){var e=this,i=e.config,n=e.$el,a=e.classChartBar.bind(e),r=e.classBars.bind(e),s=e.classFocus.bind(e),o=i.interaction_enabled&&i.data_selection_isselectable;n.bar||e.initBar(),e.$el.main.select("."+l.chartBars).selectAll("."+l.chartBar).data(t).attr("class",(function(t){return a(t)+s(t)})).enter().append("g").attr("class",a).style("opacity","0").style("pointer-events","none").append("g").attr("class",r).style("cursor",(function(t){return o&&o.bind(e.api)(t)?"pointer":null}))},updateBar:function(t){var e=this,i=e.$el,n=e.barData.bind(e),a=e.classBar.bind(e),r=e.initialOpacity.bind(e);i.bar=i.main.selectAll("."+l.bars).selectAll("."+l.bar).data(n),i.bar.exit().transition().duration(t).style("opacity","0").remove(),i.bar=i.bar.enter().append("path").attr("class",a).style("fill",e.color).merge(i.bar).style("opacity",r)},redrawBar:function(t,e){var i=this.$el.bar;return[(e?i.transition(W()):i).attr("d",t).style("fill",this.color).style("opacity","1")]},getBarW:function(t,e){var i=this,n=i.config,a=i.scale,r=i.getMaxDataCount(),s=n.data_groups.length,o=a.zoom&&!i.axis.isCategorized()?a.subX.domain().map((function(t){return a.zoom(t)})).reduce((function(t,e){return Math.abs(t)+e}))/r:t.tickInterval(r),c=function(t){var i=t?n.bar_width[t]:n.bar_width,a=t?i.ratio:n.bar_width_ratio,r=t?i.max:n.bar_width_max,s=L(i)?i:e?o*a/e:0;return r&&s>r?r:s},l=c();return!s&&X(n.bar_width)&&(l={width:l,total:[]},i.filterTargetsToShow(i.data.targets).forEach((function(t){n.bar_width[t.id]&&(l[t.id]=c(t.id),l.total.push(l[t.id]||l.width))}))),l},getBars:function(t,e){var i=this.$el.main,n=w(t)?"-"+t:"";return(e?i.selectAll("."+l.bars+this.getTargetSelectorSuffix(e)):i).selectAll("."+l.bar+n)},expandBars:function(t,e,i){i&&this.unexpandBars(),this.getBars(t,e).classed(l.EXPANDED,!0)},unexpandBars:function(t){this.getBars(t).classed(l.EXPANDED,!1)},generateDrawBar:function(t,e){var i=this.config,n=this.generateGetBarPoints(t,e),a=i.axis_rotated,r=i.data_groups.length,s=i.bar_radius,o=i.bar_radius_ratio,c=L(s)&&s>0?function(){return s}:L(o)?function(t){return t*o}:null;return function(t,e){var i=n(t,e),s=+a,o=+!s,l=t.value<0,u=["",""],d=0;if(c&&!r){var h=a?o:s,g=i[2][h]-i[0][h],f="a"+(d=c(g))+","+d+" "+(l?"1 0 0":"0 0 1")+" ";u[+!a]=""+f+d+","+d,u[+a]=""+f+[-d,d][a?"sort":"reverse"](),l&&u.reverse()}var p=a?"H"+(i[1][s]-d)+" "+u[0]+"V"+(i[2][o]-d)+" "+u[1]+"H"+i[3][s]:"V"+(i[1][o]+(l?-d:d))+" "+u[0]+"H"+(i[2][s]-d)+" "+u[1]+"V"+i[3][o];return"M"+i[0][s]+","+i[0][o]+p+"z"}},generateGetBarPoints:function(t,e){var i=this,n=i.config,a=e?i.axis.subX:i.axis.x,r=i.getIndicesMax(t)+1,s=i.getBarW(a,r),o=i.getShapeX(s,t,!!e),c=i.getShapeY(!!e),l=i.getShapeOffset(i.isBarType,t,!!e),u=i.getYScaleById.bind(i);return function(t,a){var r=u.call(i,t.id,e)(i.getShapeYMin(t.id)),d=l(t,a)||r,h=L(s)?s:s[t.id]||s.width,g=o(t),f=c(t);return n.axis_rotated&&(t.value>0&&f<r||t.value<0&&r<f)&&(f=r),[[g,d],[g,f-=r-d],[g+h,f],[g+h,d]]}},isWithinBar:function(t){var e=Object(c.mouse)(t),i=G(t),n=i[0],a=i[1],r=Math.min(n.x,a.x),s=Math.min(n.y,a.y),o=this.config.bar_sensitivity,l=t.getBBox(),u=l.width,d=l.height;return r-o<e[0]&&e[0]<r+u+o&&s-o<e[1]&&e[1]<s+d+o}},qe={initGauge:function(){var t=this.config,e=this.$el.arcs,i=function(t){e.append("text").attr("class",t).style("text-anchor","middle").style("pointer-events","none")};this.hasType("gauge")&&(e.append(this.hasMultiArcGauge()?"g":"path").attr("class",l.chartArcsBackground),t.gauge_units&&i(l.chartArcsGaugeUnit),t.gauge_label_show&&(i(l.chartArcsGaugeMin),!t.gauge_fullCircle&&i(l.chartArcsGaugeMax)))},redrawMultiArcGauge:function(){var t=this,e=t.config,i=t.state,n=t.$el,a=t.state.hiddenTargetIds,r=n.main.selectAll("."+l.arcs).selectAll("."+l.arcLabelLine).data(t.arcData.bind(t));r.enter().append("rect").attr("class",(function(t){return l.arcLabelLine+" "+l.target+" "+l.target+"-"+t.data.id})).merge(r).style("fill",(function(e){return t.levelColor?t.levelColor(e.data.values[0].value):t.color(e.data)})).style("display",e.gauge_label_show?"":"none").each((function(e){var n=0,r=0,s=0,o="";if(a.indexOf(e.data.id)<0){var l=t.updateAngle(e),u=i.gaugeArcWidth/t.filterTargetsToShow(t.data.targets).length*(l.index+1),d=l.endAngle-Math.PI/2,h=i.radius-u,g=d-(0===h?0:1/h);n=i.radiusExpanded-i.radius+u,r=Math.cos(g)*h,s=Math.sin(g)*h,o="rotate("+180*d/Math.PI+", "+r+", "+s+")"}Object(c.select)(this).attr("x",r).attr("y",s).attr("width",n).attr("height",2).attr("transform",o).style("stroke-dasharray","0, "+(n+2)+", 0")}))},textForGaugeMinMax:function(t,e){var i=this.config.gauge_label_extents;return S(i)?i.bind(this.api)(t,e):t},getGaugeLabelHeight:function(){var t=this.config;return this.config.gauge_label_show&&!t.gauge_fullCircle?20:0},getPaddingBottomForGauge:function(){return this.getGaugeLabelHeight()*(this.config.gauge_label_show?2:2.5)}},Ke={initBubble:function(){var t=this.config;this.hasType("bubble")&&(t.point_show=!0,t.point_type="circle",t.point_sensitivity=25)},getBaseLength:function(){var t=this.state,e=t.width,i=t.height,n=ht,a=this.cache.get(n);return a||this.cache.add(n,a=nt("min",[e,i])),a},getBubbleR:function(t){var e=this,i=e.config.bubble_maxR;S(i)?i=i.bind(e.api)(t):!L(i)&&(i=e.getBaseLength()/(2*e.getMaxDataCount())+12);var n=nt("max",e.getMinMaxData().max.map((function(t){return e.isBubbleZType(t)?e.getBubbleZData(t.value,"y"):F(t.value)?t.value.mid:t.value}))),a=i*i*Math.PI,r=(e.isBubbleZType(t)?e.getBubbleZData(t.value,"z"):t.value)*(a/n);return Math.sqrt(r/Math.PI)},getBubbleZData:function(t,e){return F(t)?t[e]:t["y"===e?0:1]}},Je={initLine:function(){var t=this.$el;t.line=t.main.select("."+l.chart).append("g").attr("class",l.chartLines)},updateTargetsForLine:function(t){var e=this,i=e.$el,n=i.area,a=i.line,r=i.main,s=e.classChartLine.bind(e),o=e.classLines.bind(e),c=e.classFocus.bind(e);a||e.initLine();var u=t.filter((function(t){return!(e.isScatterType(t)||e.isBubbleType(t))})),d=r.select("."+l.chartLines).selectAll("."+l.chartLine).data(u).attr("class",(function(t){return s(t)+c(t)})),h=d.enter().append("g").attr("class",s).style("opacity","0").style("pointer-events","none");h.append("g").attr("class",o),e.hasTypeOf("Area")&&!n&&e.initArea(h.empty()?d:h),e.updateTargetForCircle(u,h)},updateLine:function(t){var e=this,i=e.format.extraLineClasses,n=e.$el;n.line=n.main.selectAll("."+l.lines).selectAll("."+l.line).data(e.lineData.bind(e)),n.line.exit().transition().duration(t).style("opacity","0").remove(),n.line=n.line.enter().append("path").attr("class",(function(t){return e.classLine.bind(e)(t)+" "+(i(t)||"")})).style("stroke",e.color).merge(n.line).style("opacity",e.initialOpacity.bind(e)).style("shape-rendering",(function(t){return e.isStepType(t)?"crispEdges":""})).attr("transform",null)},redrawLine:function(t,e){var i=this.$el.line;return[(e?i.transition(W()):i).attr("d",t).style("stroke",this.color).style("opacity","1")]},getCurve:function(t){var e=this;return e.config.axis_rotated&&e.isStepType(t)?function(i){var n=e.getInterpolate(t)(i);return n.orgPoint=n.point,n.pointRotated=function(t,e){1===this._point&&(this._point=2);var i=this._y*(1-this._t)+e*this._t;this._context.lineTo(this._x,i),this._context.lineTo(t,i),this._x=t,this._y=e},n.point=function(t,e){0===this._point?this.orgPoint(t,e):this.pointRotated(t,e)},n}:e.getInterpolate(t)},generateDrawLine:function(t,e){var i=this,n=i.config,a=i.scale,r=n.line_connectNull,s=n.axis_rotated,o=i.generateGetLinePoints(t,e),c=i.getYScaleById.bind(i),l=function(t){return(e?i.subxx:i.xx).call(i,t)},u=function(t,n){return i.isGrouped(t.id)?o(t,n)[0][1]:c(t.id,e)(i.getBaseValue(t))},d=Object(Wt.line)();d=s?d.x(u).y(l):d.x(l).y(u),r||(d=d.defined((function(t){return null!==i.getBaseValue(t)})));var h=e?a.subX:a.x;return function(t){var a,o=c(t.id,e),l=r?i.filterRemoveNull(t.values):t.values,u=0,g=0;if(i.isLineType(t)){var f=n.data_regions[t.id];f?a=i.lineWithRegions(l,h,o,f):(i.isStepType(t)&&(l=i.convertValuesToStep(l)),a=d.curve(i.getCurve(t))(l))}else l[0]&&(u=h(l[0].x),g=o(l[0].value)),a=s?"M "+g+" "+u:"M "+u+" "+g;return a||"M 0 0"}},lineWithRegions:function(t,e,i,n){var a,r,s,o,c=this,l=c.config.axis_rotated,u=c.axis.isTimeSeries(),d=c.axis.isCategorized()?.5:0,h=[],g=function(t,e){for(var i,n=0;i=e[n];n++)if(i.start<t&&t<=i.end)return i.style;return!1};if(C(n))for(var f,p=function(t,e){return k(t)?e:u?ot.call(c,t):t},x=0;f=n[x];x++){var v=p(f.start,t[0].x),_=p(f.end,t[t.length-1].x),m=f.style||{dasharray:"2 2"};h[x]={start:v,end:_,style:m}}for(var y,b=l?function(t){return i(t.value)}:function(t){return e(t.x)},T=l?function(t){return e(t.x)}:function(t){return i(t.value)},A=function(t){return"M"+t[0][0]+","+t[0][1]+"L"+t[1][0]+","+t[1][1]},S=u?function(t,n,a,o){var c=t.x.getTime(),u=n.x-t.x,d=new Date(c+u*a),h=new Date(c+u*(a+o)),g=l?[[i(r(a)),e(d)],[i(r(a+s)),e(h)]]:[[e(d),i(r(a))],[e(h),i(r(a+s))]];return A(g)}:function(t,n,s,o){var c=l?[[i(r(s),!0),e(a(s))],[i(r(s+o),!0),e(a(s+o))]]:[[e(a(s),!0),i(r(s))],[e(a(s+o),!0),i(r(s+o))]];return A(c)},O={x:c.axis.getAxisType("x"),y:c.axis.getAxisType("y")},L="",E=0;y=t[E];E++){var R=t[E-1],D=R&&w(R.value);m=g(y.x,h);if(w(y.value))if(!k(h)&&m&&D){if(D){try{m=m.dasharray.split(" ")}catch(t){m="2 2".split(" ")}a=Vt(O.x,R.x+d,y.x+d),r=Vt(O.y,R.value,y.value);var I=e(y.x)-e(R.x),X=i(y.value)-i(R.value),z=Math.sqrt(Math.pow(I,2)+Math.pow(X,2));o=(s=m[0]/z)*m[1];for(var P=s;P<=1;P+=o)L+=S(R,y,P,s),P+o>=1&&(L+=S(R,y,1,0))}}else L+=(E&&D?"L":"M")+b(y)+","+T(y)}return L},isWithinStep:function(t,e){return Math.abs(e-Object(c.mouse)(t)[1])<30},shouldDrawPointsForLine:function(t){var e=this.config.line_point;return!0===e||M(e)&&-1!==e.indexOf(t.id)}},Qe=function(){return W()},ti={hasValidPointType:function(t){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(t||this.config.point_type)},hasValidPointDrawMethods:function(t){var e=t||this.config.point_type;return X(e)&&S(e.create)&&S(e.update)},initialOpacityForCircle:function(t){var e=this.state.withoutFadeIn;return null!==this.getBaseValue(t)&&e[t.id]?this.opacityForCircle(t):"0"},opacityForCircle:function(t){var e=this.config,i=e.point_show&&!e.point_focus_only?"1":"0";return w(this.getBaseValue(t))?this.isBubbleType(t)||this.isScatterType(t)?"0.5":i:"0"},initCircle:function(){var t=this,e=t.$el.main;t.point=t.generatePoint(),(t.hasType("bubble")||t.hasType("scatter"))&&e.select("."+l.chartCircles).empty()&&e.select("."+l.chart).append("g").attr("class",l.chartCircles)},updateTargetForCircle:function(t,e){var i=this,n=this,a=n.config,r=n.data,s=n.$el,o=a.interaction_enabled&&a.data_selection_enabled,c=o&&a.data_selection_isselectable,u=n.classCircles.bind(n);if(a.point_show){s.circle||n.initCircle();var d=t,h=e;if(!d){d=r.targets.filter((function(t){return i.isScatterType(t)||i.isBubbleType(t)}));var g=s.main.select("."+l.chartCircles).style("pointer-events","none").selectAll("."+l.circles).data(d).attr("class",u);g.exit().remove(),h=g.enter()}o&&h.append("g").attr("class",(function(t){return n.generateClass(l.selectedCircles,t.id)})),h.append("g").attr("class",u).style("cursor",(function(t){return c&&c(t)?"pointer":null})),o&&d.forEach((function(t){s.main.selectAll("."+l.selectedCircles+n.getTargetSelectorSuffix(t.id)).selectAll(""+l.selectedCircle).each((function(e){e.value=t.values[e.index].value}))}))}},updateCircle:function(){var t=this,e=t.config,i=t.state,n=t.$el,a=e.point_focus_only;if(e.point_show&&!i.toggling){var r=a&&n.circle?n.circle.data()[0].index:0,s=n.main.selectAll("."+l.circles).selectAll("."+l.circle).data((function(e){return t.isLineType(e)&&t.shouldDrawPointsForLine(e)||t.isBubbleType(e)||t.isRadarType(e)||t.isScatterType(e)?a?[e.values[r]]:e.values:[]}));s.exit().remove();var o=t.point("create",this,t.pointR.bind(t),t.color);s.enter().filter((function(t){return t})).append(o),n.circle=n.main.selectAll("."+l.circles+" ."+l.circle).style("stroke",t.color).style("opacity",t.initialOpacityForCircle.bind(t))}},redrawCircle:function(t,e,i,n){var a=this,r=a.state.rendered,s=a.$el,o=s.circle,c=s.main.selectAll("."+l.selectedCircle);if(!a.config.point_show)return[];var u=a.point("update",a,t,e,a.color,i,n,c),d=a.isCirclePoint()?"c":"",h=W(),g=a.opacityForCircle.bind(a),f=[];return o.each((function(t){var e=u.bind(this)(t);e=(i||!r?e.transition(h):e).style("opacity",g),f.push(e)})),[f,c.attr(d+"x",t).attr(d+"y",e)]},showCircleFocus:function(t){var e=this,i=e.config,n=e.state,a=n.hasRadar,r=n.resizing,s=n.toggling,o=n.transiting,l=e.$el.circle;if(!1===o&&i.point_focus_only&&l){var u=(a?e.radarCircleX:e.circleX).bind(e),d=(a?e.radarCircleY:e.circleY).bind(e),h=s||k(t),g=e.point("update",e,u,d,e.color,!r&&h);t&&(l=l.filter((function(e){var i=t.filter((function(t){return t.id===e.id}));return!!i.length&&Object(c.select)(this).datum(i[0])}))),l.attr("class",this.updatePointClass.bind(this)).style("opacity","1").each((function(t){var i=t.id,n=t.index,a=t.value,r="hidden";w(a)&&(g.bind(this)(t),e.expandCircles(n,i),r=""),this.style.visibility=r}))}},hideCircleFocus:function(){var t=this.config,e=this.$el.circle;t.point_focus_only&&e&&(this.unexpandCircles(),e.style("visibility","hidden"))},circleX:function(t){return this.xx(t)},updateCircleY:function(){var t=this,e=t.generateGetLinePoints(t.getShapeIndices(t.isLineType),!1);t.circleY=function(i,n){var a=i.id;return t.isGrouped(a)?e(i,n)[0][1]:t.getYScaleById(a)(t.getBaseValue(i))}},getCircles:function(t,e){var i=w(t)?"-"+t:"";return(e?this.$el.main.selectAll("."+l.circles+this.getTargetSelectorSuffix(e)):this.$el.main).selectAll("."+l.circle+i)},expandCircles:function(t,e,i){var n=this,a=n.pointExpandedR.bind(n);i&&n.unexpandCircles();var r=n.getCircles(t,e).classed(l.EXPANDED,!0),s=a(r)/n.config.point_r,o=1-s;n.isCirclePoint()?r.attr("r",a):r.each((function(){var t=Object(c.select)(this);if("circle"===this.tagName)t.attr("r",a);else{var e=this.getBBox(),i=e.width,n=e.height,r=o*(+t.attr("x")+i/2),l=o*(+t.attr("y")+n/2);t.attr("transform","translate("+r+" "+l+") scale("+s+")")}}))},unexpandCircles:function(t){var e=this,i=e.pointR.bind(e),n=e.getCircles(t).filter((function(){return Object(c.select)(this).classed(l.EXPANDED)})).classed(l.EXPANDED,!1);n.attr("r",i),e.isCirclePoint()||n.attr("transform","scale("+i(n)/e.config.point_r+")")},pointR:function(t){var e=this.config.point_r,i=e;return this.isBubbleType(t)?i=this.getBubbleR(t):S(e)&&(i=e.bind(this.api)(t)),i},pointExpandedR:function(t){var e=this.config,i=this.isBubbleType(t)?1.15:1.75;return e.point_focus_expand_enabled?e.point_focus_expand_r||this.pointR(t)*i:this.pointR(t)},pointSelectR:function(t){var e=this.config.point_select_r;return S(e)?e(t):e||4*this.pointR(t)},isWithinCircle:function(t,e){var i=Object(c.mouse)(t),n=Object(c.select)(t),a=this.isCirclePoint(t)?"c":"",r=+n.attr(a+"x"),s=+n.attr(a+"y");if(!r&&!s&&1===t.nodeType){var o=H(t);r=o.x,s=o.y}return Math.sqrt(Math.pow(r-i[0],2)+Math.pow(s-i[1],2))<(e||this.config.point_sensitivity)},insertPointInfoDefs:function(t,e){var i=function(t,e){for(var i,n=t.attributes,a=0;i=n[a];a++)i=i.name,e.setAttribute(i,t.getAttribute(i))},n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement,a=b.createElementNS(c.namespaces.svg,n.nodeName.toLowerCase());if(a.id=e,a.style.fill="inherit",a.style.stroke="inherit",i(n,a),n.childNodes&&n.childNodes.length){var r=Object(c.select)(a);"innerHTML"in a?r.html(n.innerHTML):K(n.childNodes).forEach((function(t){i(t,r.append(t.tagName).node())}))}this.$el.defs.node().appendChild(a)},pointFromDefs:function(t){return this.$el.defs.select("#"+t)},updatePointClass:function(t){var e=this,i=e.$el.circle,n=!1;return(F(t)||i)&&(n=!0===t?i.each((function(t){var i=e.classCircle.bind(e)(t);this.getAttribute("class").indexOf(l.EXPANDED)>-1&&(i+=" "+l.EXPANDED),this.setAttribute("class",i)})):e.classCircle(t)),n},generateGetLinePoints:function(t,e){var i=this,n=i.config,a=i.getShapeX(0,t,e),r=i.getShapeY(e),s=i.getShapeOffset(i.isLineType,t,e),o=i.getYScaleById.bind(i);return function(t,c){var l=o.call(i,t.id,e)(i.getShapeYMin(t.id)),u=s(t,c)||l,d=a(t),h=r(t);n.axis_rotated&&(t.value>0&&h<l||t.value<0&&l<h)&&(h=l);var g=[d,h-(l-u)];return[g,g,g,g]}},generatePoint:function(){var t=this,e=t.config,i=t.state.datetimeId,n=[],a=P(e.point_pattern)?e.point_pattern:[e.point_type];return function(e,r){for(var s=arguments.length,o=Array(s>2?s-2:0),l=2;l<s;l++)o[l-2]=arguments[l];return function(s){var l=s.id||s.data&&s.data.id||s,u=Object(c.select)(this);n.indexOf(l)<0&&n.push(l);var d=a[n.indexOf(l)%a.length];if(t.hasValidPointType(d))d=t[d];else if(!t.hasValidPointDrawMethods(d)){var h=i+"-point-"+l;if(t.pointFromDefs(h).size()<1&&t.insertPointInfoDefs(d,h),"create"===e)return t.custom.create.bind(r).apply(void 0,[u,h].concat(o));if("update"===e)return t.custom.update.bind(r).apply(void 0,[u].concat(o))}return d[e].bind(r).apply(void 0,[u].concat(o))}}},custom:{create:function(t,e,i,n){return t.append("use").attr("xlink:href","#"+e).attr("class",this.updatePointClass.bind(this)).style("fill",n).node()},update:function(t,e,i,n,a,r,s){var o=t.node().getBBox(),c=o.width,l=o.height,u=function(t){return e(t)-c/2},d=t;if(a){var h=Qe();r&&d.attr("x",u),d=d.transition(h),s&&s.transition(Qe())}return d.attr("x",u).attr("y",(function(t){return i(t)-l/2})).style("fill",n)}},circle:{create:function(t,e,i){return t.append("circle").attr("class",this.updatePointClass.bind(this)).attr("r",e).style("fill",i).node()},update:function(t,e,i,n,a,r,s){var o=t;if(this.hasType("bubble")&&o.attr("r",this.pointR.bind(this)),a){var c=Qe();r&&o.attr("cx",e),o.attr("cx")&&(o=o.transition(c)),s&&s.transition(Qe())}return o.attr("cx",e).attr("cy",i).style("fill",n)}},rectangle:{create:function(t,e,i){var n=function(t){return 2*e(t)};return t.append("rect").attr("class",this.updatePointClass.bind(this)).attr("width",n).attr("height",n).style("fill",i).node()},update:function(t,e,i,n,a,r,s){var o=this.config.point_r,c=function(t){return e(t)-o},l=t;if(a){var u=Qe();r&&l.attr("x",c),l=l.transition(u),s&&s.transition(Qe())}return l.attr("x",c).attr("y",(function(t){return i(t)-o})).style("fill",n)}}};var ei=_t,ii={initRadar:function(){var t=this,e=t.config,i=t.state.current,n=t.$el;t.hasType("radar")&&(n.radar=n.main.select("."+l.chart).append("g").attr("class",l.chartRadars),n.radar.levels=n.radar.append("g").attr("class",l.levels),n.radar.axes=n.radar.append("g").attr("class",l.axis),n.radar.shapes=n.radar.append("g").attr("class",l.shapes),i.dataMax=e.radar_axis_max||t.getMinMaxData().max[0].value)},getRadarSize:function(){var t=this.config,e=this.state,i=e.arcWidth,n=e.arcHeight,a=t.axis_x_categories.length<4?-20:10,r=(Math.min(i,n)-a)/2;return[r,r]},updateTargetsForRadar:function(t){var e=this.config;z(e.axis_x_categories)&&(e.axis_x_categories=at(0,nt("max",t.map((function(t){return t.values.length}))))),this.generateRadarPoints()},getRadarPosition:function(t,e,i,n){var a=this.config,r=this.getRadarSize(),s=r[0],o=r[1],c=a.axis_x_categories.length,l=a.radar_direction_clockwise,u=K(t).map((function(r){return function(t,e,i,n,a,r){var s=t&&n>0?i-n:n,o=2*Math.PI;return a*(1-r*("x"===e?Math.sin:Math.cos)(s*o/i))}(l,r,c,e,C(i)?i:"x"===t?s:o,L(n)?n:a.radar_size_ratio)}));return 1===u.length?u[0]:u},generateRadarPoints:function(){var t=this,e=t.data.targets,i=t.getRadarSize(),n=i[0],a=i[1],r=t.cache.get(ei)||{},s=r._size;s&&(s.width===n||s.height===a)||(e.forEach((function(e){r[e.id]=e.values.map((function(e,i){return t.getRadarPosition(["x","y"],i,void 0,t.getRatio("radar",e))}))})),r._size={width:n,height:a},t.cache.add(ei,r))},redrawRadar:function(t){var e=this,i=e.$el,n=i.radar,a=i.main,r=e.getTranslate("radar");r&&(n.attr("transform",r),a.select("."+l.chartTexts).attr("transform",r),e.generateRadarPoints(),e.updateRadarLevel(),e.updateRadarAxes(),e.updateRadarShape(t))},generateGetRadarPoints:function(){var t=this.cache.get(ei);return function(e,i){var n=t[e.id][i];return[n,n,n,n]}},updateRadarLevel:function(){var t=this,e=t.config,i=t.state,n=t.$el.radar,a=t.getRadarSize(),r=a[0],s=a[1],o=e.radar_level_depth,c=e.axis_x_categories.length,u=e.radar_level_text_show,d=n.levels,h=at(0,o),g=e.radar_size_ratio*Math.min(r,s),f=h.map((function(t){return g*((t+1)/o)})),p=(e.radar_level_text_format||function(){}).bind(t.api),x=h.map((function(e){var i=f[e];return at(0,c).map((function(e){return t.getRadarPosition(["x","y"],e,i,1).join(",")})).join(" ")})),v=d.selectAll("."+l.level).data(h);v.exit().remove();var _=v.enter().append("g").attr("class",(function(t,e){return l.level+" "+l.level+"-"+e}));_.append("polygon").style("visibility",e.radar_level_show?null:"hidden"),u&&(d.select("text").empty()&&d.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text((function(){return p(0)})),_.append("text").attr("dx","-.5em").style("text-anchor","end").text((function(t){return p(i.current.dataMax/h.length*(t+1))}))),_.merge(v).attr("transform",(function(t){return"translate("+(r-f[t])+", "+(s-f[t])+")"})).selectAll("polygon").attr("points",(function(t){return x[t]})),u&&d.selectAll("text").attr("x",(function(t){return k(t)?r:x[t].split(",")[0]})).attr("y",(function(t){return k(t)?s:0}))},updateRadarAxes:function(){var t=this,e=t.config,i=t.$el.radar,n=t.getRadarSize(),a=n[0],r=n[1],s=e.axis_x_categories,o=i.axes.selectAll("g").data(s);o.exit().remove();var u=o.enter().append("g").attr("class",(function(t,e){return l.axis+"-"+e}));if(e.radar_axis_line_show&&u.append("line"),e.radar_axis_text_show&&u.append("text"),o=u.merge(o),e.radar_axis_line_show&&o.select("line").attr("x1",a).attr("y1",r).attr("x2",(function(e,i){return t.getRadarPosition("x",i)})).attr("y2",(function(e,i){return t.getRadarPosition("y",i)})),e.radar_axis_text_show){var d=e.radar_axis_text_position,h=d.x,g=void 0===h?0:h,f=d.y,p=void 0===f?0:f;o.select("text").style("text-anchor","middle").attr("dy",".5em").call((function(t){t.each((function(t){Y(Object(c.select)(this),t+"",[-.6,1.2])}))})).datum((function(t,e){return{index:e}})).attr("transform",(function(e){k(this.width)&&(this.width=this.getBoundingClientRect().width/2);var i=t.getRadarPosition("x",e.index,void 0,1),n=Math.round(t.getRadarPosition("y",e.index,void 0,1));return i>a?i+=this.width+g:Math.round(i)<a&&(i-=this.width+g),n>r?(n/2===r&&"tspan"===this.firstChild.tagName&&this.firstChild.setAttribute("dy","0em"),n+=p):n<r&&(n-=p),"translate("+i+" "+n+")"}))}t.bindEvent()},bindEvent:function(){var t=this,e=t.config,i=t.state,n=i.inputType,a=i.transiting,r=t.$el,s=r.radar,o=r.svg,l=e.point_focus_only;if(e.interaction_enabled){var u="mouse"===n,d=function(){var t=c.event.target;/tspan/i.test(t.tagName)&&(t=t.parentNode);var e=Object(c.select)(t).datum();return e&&1===Object.keys(e).length?e.index:void 0},h=function(){var e=d(),i=k(e);(u||i)&&(t.hideTooltip(),l?t.hideCircleFocus():t.unexpandCircles(),u?t.setOverOut(!1,e):i&&t.callOverOutForTouch())};s.axes.selectAll("text").on(u?"mouseover ":"touchstart",(function(){if(!a){var e=d();t.selectRectForSingle(o.node(),null,e),u?t.setOverOut(!0,e):t.callOverOutForTouch(e)}})).on("mouseout",u?h:null),u||o.on("touchstart",h)}},updateRadarShape:function(t){var e=this,i=e.data.targets.filter((function(t){return e.isRadarType(t)})),n=e.cache.get(ei),a=e.$el.radar.shapes.selectAll("polygon").data(i),r=a.enter().append("g").attr("class",e.classChartRadar.bind(e));a.exit().transition().duration(t).remove(),r.append("polygon").merge(a).style("fill",e.color).style("stroke",e.color).attr("points",(function(t){return n[t.id].join(" ")})),e.updateTargetForCircle(i,r)},radarCircleX:function(t){return this.cache.get(ei)[t.id][t.index][0]},radarCircleY:function(t){return this.cache.get(ei)[t.id][t.index][1]}},ni={point_show:!0,point_r:2.5,point_sensitivity:10,point_focus_expand_enabled:!0,point_focus_expand_r:void 0,point_focus_only:!1,point_pattern:[],point_select_r:void 0,point_type:"circle"},ai={area_zerobased:!0,area_above:!1,area_linearGradient:!1},ri={bar_label_threshold:0,bar_padding:0,bar_radius:void 0,bar_radius_ratio:void 0,bar_sensitivity:2,bar_width:void 0,bar_width_ratio:.6,bar_width_max:void 0,bar_zerobased:!0},si={bubble_maxR:35,bubble_zerobased:!1},oi={line_connectNull:!1,line_step_type:"step",line_zerobased:!1,line_classes:void 0,line_point:!0},ci={scatter_zerobased:!1},li={spline_interpolation_type:"cardinal"},ui={donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,donut_label_ratio:void 0,donut_width:void 0,donut_title:"",donut_expand:{},donut_expand_rate:.98,donut_expand_duration:50,donut_padAngle:0,donut_startingAngle:0},di={gauge_fullCircle:!1,gauge_label_show:!0,gauge_label_format:void 0,gauge_label_extents:void 0,gauge_label_threshold:0,gauge_min:0,gauge_max:100,gauge_type:"single",gauge_startingAngle:-1*Math.PI/2,gauge_title:"",gauge_units:void 0,gauge_width:void 0,gauge_arcs_minWidth:5,gauge_expand:{},gauge_expand_rate:.98,gauge_expand_duration:50},hi={pie_label_show:!0,pie_label_format:void 0,pie_label_threshold:.05,pie_label_ratio:void 0,pie_expand:{},pie_expand_rate:.98,pie_expand_duration:50,pie_innerRadius:0,pie_padAngle:0,pie_padding:0,pie_startingAngle:0},gi={radar_axis_max:void 0,radar_axis_line_show:!0,radar_axis_text_show:!0,radar_axis_text_position:{},radar_level_depth:3,radar_level_show:!0,radar_level_text_format:function(t){return t%1==0?t:t.toFixed(2)},radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1};function fi(t,e){Z(ie.prototype,Ge.concat(t)),Z(ce.prototype,Ye),dt.setOptions(Ve.concat(e||[]))}function pi(t,e){fi([ti,Je].concat(t||[])),dt.setOptions([ni,oi].concat(e||[]))}function xi(t,e){Z(ie.prototype,[We].concat(t||[])),dt.setOptions(e)}var vi=function(){return pi(Ue,[ai]),(vi=function(){return Mt.AREA})()},_i=function(){return pi(Ue,[ai]),(_i=function(){return Mt.AREA_LINE_RANGE})()},mi=function(){return pi(Ue,[ai,li]),(mi=function(){return Mt.AREA_SPLINE})()},yi=function(){return pi(Ue,[ai,li]),(yi=function(){return Mt.AREA_SPLINE_RANGE})()},bi=function(){return pi(Ue,[ai]),(bi=function(){return Mt.AREA_STEP})()},Ti=function(){return pi(),(Ti=function(){return Mt.LINE})()},Ai=function(){return pi(void 0,[li]),(Ai=function(){return Mt.SPLINE})()},wi=function(){return pi(),(wi=function(){return Mt.STEP})()},Si=function(){return xi(void 0,[ui]),(Si=function(){return Mt.DONUT})()},Oi=function(){return xi([qe],[di]),(Oi=function(){return Mt.GAUGE})()},Li=function(){return xi(void 0,[hi]),(Li=function(){return Mt.PIE})()},ki=function(){return xi([ti,ii],[ni,gi]),(ki=function(){return Mt.RADAR})()},Ci=function(){return fi([Ze],ri),(Ci=function(){return Mt.BAR})()},Ei=function(){return fi([ti,Ke],[si,ni]),(Ei=function(){return Mt.BUBBLE})()},Ri=function(){return fi([ti],[ni,ci]),(Ri=function(){return Mt.SCATTER})()},Di={selected:function(t){var e=this.internal,i=[];return e.$el.main.selectAll("."+(l.shapes+e.getTargetSelectorSuffix(t))).selectAll("."+l.shape).filter((function(){return Object(c.select)(this).classed(l.SELECTED)})).each((function(t){return i.push(t)})),i},select:function(t,e,i){var n=this.internal,a=n.config,r=n.$el;a.data_selection_enabled&&r.main.selectAll("."+l.shapes).selectAll("."+l.shape).each((function(r,s){var o=Object(c.select)(this),u=r.data?r.data.id:r.id,d=n.getToggle(this,r).bind(n),h=a.data_selection_grouped||!t||t.indexOf(u)>=0,g=!e||e.indexOf(s)>=0,f=o.classed(l.SELECTED);o.classed(l.line)||o.classed(l.area)||(h&&g?a.data_selection_isselectable.bind(n.api)(r)&&!f&&d(!0,o.classed(l.SELECTED,!0),r,s):C(i)&&i&&f&&d(!1,o.classed(l.SELECTED,!1),r,s))}))},unselect:function(t,e){var i=this.internal,n=i.config,a=i.$el;n.data_selection_enabled&&a.main.selectAll("."+l.shapes).selectAll("."+l.shape).each((function(a,r){var s=Object(c.select)(this),o=a.data?a.data.id:a.id,u=i.getToggle(this,a).bind(i),d=n.data_selection_grouped||!t||t.indexOf(o)>=0,h=!e||e.indexOf(r)>=0,g=s.classed(l.SELECTED);s.classed(l.line)||s.classed(l.area)||d&&h&&n.data_selection_isselectable.bind(i.api)(a)&&g&&u(!1,s.classed(l.SELECTED,!1),a,r)}))}},Ii=i(13);var Xi=function(t){var e,i=this.internal,n=i.config,a=i.scale,r=t;if(n.zoom_enabled&&r&&function(t,e){var i=e[0],n=e[1];return t.every((function(t,e){return 0===e?t>=i:t<=n}))}(r,i.getZoomDomain())){if(i.axis.isTimeSeries()){var s=ot.bind(i);r=r.map((function(t){return s(t)}))}if(n.subchart_show){var o=a.zoom||a.x;i.brush.getSelection().call(i.brush.move,[o(r[0]),o(r[1])]),e=r}else a.x.domain(r),a.zoom=a.x,i.axis.x.scale(a.zoom),e=a.zoom.orgDomain();i.redraw({withTransition:!0,withY:n.zoom_rescale,withDimension:!1}),i.setZoomResetButton(),$(n.zoom_onzoom,i.api,e)}else e=a.zoom?a.zoom.domain():a.x.orgDomain();return e};Z(Xi,{enable:function(t){var e=this.internal,i=e.config;/^(drag|wheel)$/.test(t)&&(i.zoom_type=t),i.zoom_enabled=!!t,e.zoom?!1===t&&e.bindZoomEvent(!1):(e.initZoom(),e.bindZoomEvent()),e.updateAndRedraw()},max:function(t){var e=this.internal,i=e.config,n=e.org.xDomain;return(0===t||t)&&(i.zoom_x_max=nt("max",[n[1],t])),i.zoom_x_max},min:function(t){var e=this.internal,i=e.config,n=e.org.xDomain;return(0===t||t)&&(i.zoom_x_min=nt("min",[n[0],t])),i.zoom_x_min},range:function(t){var e=this.zoom;if(F(t)){var i=t.min,n=t.max;C(i)&&e.min(i),C(n)&&e.max(n)}return{min:e.min(),max:e.max()}}});var zi={zoom:Xi,unzoom:function(){var t=this.internal,e=t.config;if(t.scale.zoom){e.subchart_show?t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(Ii.zoomIdentity),t.updateZoom(!0),t.zoom.resetBtn&&t.zoom.resetBtn.style("display","none");var i=t.$el.main.select("."+l.eventRects);Object(Ii.zoomTransform)(i.node())!==Ii.zoomIdentity&&t.zoom.transform(i,Ii.zoomIdentity),t.redraw({withTransition:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withY:e.zoom_rescale})}}},Pi=i(14),Mi={selectPoint:function(t,e,i){var n=this,a=n.config,r=n.$el.main,s=a.axis_rotated,o=(s?n.circleY:n.circleX).bind(n),c=(s?n.circleX:n.circleY).bind(n),u=n.pointSelectR.bind(n);$(a.data_onselected,n.api,e,t.node()),r.select("."+l.selectedCircles+n.getTargetSelectorSuffix(e.id)).selectAll("."+l.selectedCircle+"-"+i).data([e]).enter().append("circle").attr("class",(function(){return n.generateClass(l.selectedCircle,i)})).attr("cx",o).attr("cy",c).attr("stroke",n.color).attr("r",(function(t){return 1.4*n.pointSelectR(t)})).transition().duration(100).attr("r",u)},unselectPoint:function(t,e,i){var n=this.config,a=this.$el;$(n.data_onunselected,this.api,e,t.node()),a.main.select("."+l.selectedCircles+this.getTargetSelectorSuffix(e.id)).selectAll("."+l.selectedCircle+"-"+i).transition().duration(100).attr("r",0).remove()},togglePoint:function(t,e,i,n){this[(t?"":"un")+"selectPoint"](e,i,n)},selectPath:function(t,e){var i=this,n=i.config;$(n.data_onselected,i.api,e,t.node()),n.interaction_brighten&&t.transition().duration(100).style("fill",(function(){return Object(Pi.rgb)(i.color(e)).brighter(.75)}))},unselectPath:function(t,e){var i=this,n=i.config;$(n.data_onunselected,i.api,e,t.node()),n.interaction_brighten&&t.transition().duration(100).style("fill",(function(){return i.color(e)}))},togglePath:function(t,e,i,n){this[(t?"":"un")+"selectPath"](e,i,n)},getToggle:function(t,e){return"path"===t.nodeName?this.togglePath:this.isStepType(e)?function(){}:this.togglePoint},toggleShape:function(t,e,i){var n,a=this,r=a.config,s=a.$el.main,o=Object(c.select)(t),u=o.classed(l.SELECTED),d=a.getToggle(t,e).bind(a);if(r.data_selection_enabled&&r.data_selection_isselectable.bind(a.api)(e)){if(!r.data_selection_multiple){var h="."+l.shapes;r.data_selection_grouped&&(h+=a.getTargetSelectorSuffix(e.id)),s.selectAll(h).selectAll("."+l.shape).each((function(t,e){var i=Object(c.select)(this);i.classed(l.SELECTED)&&(n=i,d(!1,i.classed(l.SELECTED,!1),t,e))}))}n&&n.node()===o.node()||(o.classed(l.SELECTED,!u),d(!u,o,e,i))}}},Fi={initBrush:function(){var t=this,e=t.config,i=t.scale,n=t.$el.subchart,a=e.axis_rotated;t.brush=a?Object(m.brushY)():Object(m.brushX)();var r,s,o=function(){t.redrawForBrush()};t.brush.on("start",(function(){"touch"===t.state.inputType&&t.hideTooltip(),o()})).on("brush",o).on("end",(function(){r=i.x.orgDomain()})),t.brush.updateResize=function(){var t=this;s&&clearTimeout(s),s=setTimeout((function(){var e=t.getSelection();r&&Object(m.brushSelection)(e.node())&&t.move(e,r.map(i.subX.orgScale()))}),0)},t.brush.update=function(){return 0===this.extent()()[1].filter((function(t){return isNaN(t)})).length&&n.main&&n.main.select("."+l.brush).call(this),this},t.brush.scale=function(i){var n,r,s=e.subchart_size_height||(n=t.$el.svg.select("."+l.brush+" .overlay"),r={width:0,height:0},n.size()&&(r.width=+n.attr("width"),r.height=+n.attr("height")),r[a?"width":"height"]),o=t.getExtent();!o&&i.range?o=[[0,0],[i.range()[1],s]]:M(o)&&(o=o.map((function(t,e){return[t,e>0?s:e]}))),a&&o[1].reverse(),this.extent(o),this.update()},t.brush.getSelection=function(){return n.main?n.main.select("."+l.brush):Object(c.select)([])}},initSubchart:function(){var t=this,e=t.config,i=t.state,n=i.clip,a=i.hasAxis,r=t.$el,s=r.defs,o=r.svg,c=r.subchart,u=r.axis;if(a){var d=e.subchart_show?"visible":"hidden",h=n.id+"-subchart",g=t.getClipPath(h);n.idSubchart=h,t.appendClip(s,h),t.initBrush(),c.main=o.append("g").classed(l.subchart,!0).attr("transform",t.getTranslate("context"));var f=c.main;f.style("visibility",d),f.append("g").attr("clip-path",g).attr("class",l.chart),t.hasType("bar")&&f.select("."+l.chart).append("g").attr("class",l.chartBars),f.select("."+l.chart).append("g").attr("class",l.chartLines),f.append("g").attr("clip-path",g).attr("class",l.brush).call(t.brush),u.subX=f.append("g").attr("class",l.axisX).attr("transform",t.getTranslate("subX")).attr("clip-path",e.axis_rotated?"":n.pathXAxis).style("visibility",e.subchart_axis_x_show?d:"hidden")}},updateTargetsForSubchart:function(t){var e=this,i=e.config,n=e.state,a=e.$el.subchart.main,r=e.classChartBar.bind(e),s=e.classBars.bind(e),o=e.classChartLine.bind(e),c=e.classLines.bind(e),u=e.classAreas.bind(e);if(i.subchart_show){var d=a.select("."+l.chartBars).selectAll("."+l.chartBar).data(t).attr("class",r);d.enter().append("g").style("opacity","0").attr("class",r).merge(d).append("g").attr("class",s);var h=a.select("."+l.chartLines).selectAll("."+l.chartLine).data(t).attr("class",o),g=h.enter().append("g").style("opacity","0").attr("class",o).merge(h);g.append("g").attr("class",c),e.hasTypeOf("Area")&&g.append("g").attr("class",u),a.selectAll("."+l.brush+" rect").attr(i.axis_rotated?"width":"height",i.axis_rotated?n.width2:n.height2)}},updateBarForSubchart:function(t){var e=this,i=e.$el.subchart;i.bar=i.main.selectAll("."+l.bars).selectAll("."+l.bar).data(e.barData.bind(e)),i.bar.exit().transition().duration(t).style("opacity","0").remove(),i.bar=i.bar.enter().append("path").attr("class",e.classBar.bind(e)).style("stroke","none").style("fill",e.color).merge(i.bar).style("opacity",e.initialOpacity.bind(e))},redrawBarForSubchart:function(t,e,i){var n=this.$el.subchart.bar;(e?n.transition(W()).duration(i):n).attr("d",t).style("opacity","1")},updateLineForSubchart:function(t){var e=this,i=e.$el.subchart;i.line=i.main.selectAll("."+l.lines).selectAll("."+l.line).data(e.lineData.bind(e)),i.line.exit().transition().duration(t).style("opacity","0").remove(),i.line=i.line.enter().append("path").attr("class",e.classLine.bind(e)).style("stroke",e.color).merge(i.line).style("opacity",e.initialOpacity.bind(e))},redrawLineForSubchart:function(t,e,i){var n=this.$el.subchart.line;(e?n.transition(W()).duration(i):n).attr("d",t).style("opacity","1")},updateAreaForSubchart:function(t){var e=this,i=e.$el.subchart;i.area=i.main.selectAll("."+l.areas).selectAll("."+l.area).data(e.lineData.bind(e)),i.area.exit().transition().duration(t).style("opacity","0").remove(),i.area=i.area.enter().append("path").attr("class",e.classArea.bind(e)).style("fill",e.color).style("opacity",(function(){return e.state.orgAreaOpacity=Object(c.select)(this).style("opacity"),"0"})).merge(i.area).style("opacity","0")},redrawAreaForSubchart:function(t,e,i){var n=this.$el.subchart.area;(e?n.transition(W()).duration(i):n).attr("d",t).style("fill",this.color).style("opacity",this.state.orgAreaOpacity)},redrawSubchart:function(t,e,i){var n=this,a=n.config;n.$el.subchart.main.style("visibility",a.subchart_show?"visible":"hidden"),a.subchart_show&&(c.event&&"zoom"===c.event.type&&n.brush.update(),t&&(!U(n)&&n.brush.update(),Object.keys(i.type).forEach((function(t){var a=q(t),r=n["generateDraw"+a](i.indices[t],!0);n["update"+a+"ForSubchart"](e),n["redraw"+a+"ForSubchart"](r,e,e)}))))},redrawForBrush:function(){var t=this.config,e=t.subchart_onbrush,i=t.zoom_rescale,n=this.scale;this.redraw({withTransition:!1,withY:i,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),e.bind(this.api)(n.x.orgDomain())},transformContext:function(t,e){var i,n=this.$el.subchart.main;e&&e.axisSubX?i=e.axisSubX:(i=n.select("."+l.axisX),t&&(i=i.transition())),n.attr("transform",this.getTranslate("context")),i.attr("transform",this.getTranslate("subX"))},getExtent:function(){var t=this,e=t.config,i=t.scale,n=e.axis_x_extent;if(n)if(S(n))n=n.bind(t.api)(t.getXDomain(t.data.targets),i.subX);else if(t.axis.isTimeSeries()&&n.every(isNaN)){var a=ot.bind(t);n=n.map((function(t){return i.subX(a(t))}))}return n}},Bi={initZoom:function(){this.scale.zoom=null,this.generateZoom(),this.initZoomBehaviour()},bindZoomEvent:function(t){void 0===t&&(t=!0);var e=this.config,i=this.$el.main,n=e.zoom_enabled,a=i.select("."+l.eventRects);n&&t?!e.subchart_show&&this.bindZoomOnEventRect(a,e.zoom_type):!1===t&&(this.api.unzoom(),a.on(".zoom",null).on(".drag",null))},generateZoom:function(){var t=this,e=t.config,i=t.org,n=t.scale,a=Object(Ii.zoom)().duration(0).on("start",t.onZoomStart.bind(t)).on("zoom",t.onZoom.bind(t)).on("end",t.onZoomEnd.bind(t));a.orgScaleExtent=function(){var i=e.zoom_extent||[1,10];return[i[0],Math.max(t.getMaxDataCount()/i[1],i[1])]},a.updateScaleExtent=function(){var e=I(t.scale.x.orgDomain())/I(t.getZoomDomain()),i=this.orgScaleExtent();return this.scaleExtent([i[0]*e,i[1]*e]),this},a.updateTransformScale=function(a){i.xScale&&i.xScale.range(n.x.range());var r=a[e.axis_rotated?"rescaleY":"rescaleX"](i.xScale||n.x),s=t.trimXDomain(r.domain()),o=e.zoom_rescale;r.domain(s,i.xDomain),n.zoom=t.getCustomizedScale(r),t.axis.x.scale(n.zoom),o&&(!i.xScale&&(i.xScale=n.x.copy()),n.x.domain(s))},t.zoom=a},onZoomStart:function(){var t=c.event.sourceEvent;t&&(this.zoom.startEvent=t,$(this.config.zoom_onzoomstart,this.api,t))},onZoom:function(){var t=this,e=t.config,i=t.scale,n=t.org,a=c.event,r=a.sourceEvent;if(e.zoom_enabled&&a.sourceEvent&&0!==t.filterTargetsToShow(t.data.targets).length&&(i.zoom||!(r.type.indexOf("touch")>-1)||1!==r.touches.length)){var s="mousemove"===r.type,o=r.wheelDelta<0,l=a.transform;!s&&o&&i.x.domain().every((function(t,e){return t!==n.xDomain[e]}))&&i.x.domain(n.xDomain),t.zoom.updateTransformScale(l),t.axis.isCategorized()&&i.x.orgDomain()[0]===n.xDomain[0]&&i.x.domain([n.xDomain[0]-1e-10,i.x.orgDomain()[1]]),t.redraw({withTransition:!1,withY:e.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t.state.cancelClick=s,$(e.zoom_onzoom,t.api,i.zoom.domain())}},onZoomEnd:function(){var t=this,e=t.config,i=t.scale,n=t.zoom.startEvent,a=c.event&&c.event.sourceEvent;n&&n.type.indexOf("touch")>-1&&(n=n.changedTouches[0],a=a.changedTouches[0]),!n||a&&n.clientX===a.clientX&&n.clientY===a.clientY||(t.redrawEventRect(),t.updateZoom(),$(e.zoom_onzoomend,t.api,i[i.zoom?"zoom":"subX"].domain()))},getZoomDomain:function(){var t=this.config,e=this.org.xDomain,i=e[0],n=e[1];return C(t.zoom_x_min)&&(i=nt("min",[i,t.zoom_x_min])),C(t.zoom_x_max)&&(n=nt("max",[n,t.zoom_x_max])),[i,n]},updateZoom:function(t){var e=this.scale,i=e.subX,n=e.x,a=e.zoom;if(a){var r=a.domain(),s=i.domain(),o=(r[0]<=s[0]||r[0]-.015<=s[0])&&(s[1]<=r[1]||s[1]<=r[1]-.015);(t||o)&&(this.axis.x.scale(i),n.domain(i.orgDomain()),this.scale.zoom=null)}},bindZoomOnEventRect:function(t,e){var i="drag"===e?this.zoomBehaviour:this.zoom;t.call(i).on("dblclick.zoom",null)},initZoomBehaviour:function(){var t,e=this,i=e.config,n=e.state,a=i.axis_rotated,r=0,s=0,o={axis:a?"y":"x",attr:a?"height":"width",index:a?1:0};e.zoomBehaviour=Object(Rt.drag)().clickDistance(4).on("start",(function(){e.setDragStatus(!0),t||(t=e.$el.main.append("rect").attr("clip-path",n.clip.path).attr("class",l.zoomBrush).attr("width",a?n.width:0).attr("height",a?0:n.height)),r=Object(c.mouse)(this)[o.index],s=r,t.attr(o.axis,r).attr(o.attr,0),e.onZoomStart()})).on("drag",(function(){s=Object(c.mouse)(this)[o.index],t.attr(o.axis,Math.min(r,s)).attr(o.attr,Math.abs(s-r))})).on("end",(function(){var i,n=e.scale.zoom||e.scale.x;if(e.setDragStatus(!1),t.attr(o.axis,0).attr(o.attr,0),r>s&&(r=(i=[s,r])[0],s=i[1]),r<0&&(s+=Math.abs(r),r=0),r!==s)e.api.zoom([r,s].map((function(t){return n.invert(t)}))),e.onZoomEnd();else if(e.isMultipleX())e.clickHandlerForMultipleXS.bind(this)(e);else{var a=c.event.sourceEvent||c.event,l="clientX"in a?[a.clientX,a.clientY]:[a.x,a.y],u=l[0],d=l[1],h=b.elementFromPoint(u,d);e.clickHandlerForSingleX.bind(h)(Object(c.select)(h).datum(),e)}}))},setZoomResetButton:function(){var t=this,e=t.config,i=e.zoom_resetButton;i&&"drag"===e.zoom_type&&(t.zoom.resetBtn?t.zoom.resetBtn.style("display",null):t.zoom.resetBtn=t.$el.chart.append("div").classed(l.button,!0).append("span").on("click",(function(){S(i.onclick)&&i.onclick.bind(t.api)(this),t.api.unzoom()})).classed(l.buttonZoomReset,!0).text(i.text||"Reset Zoom"))}},$i={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:function(){return!0},data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:function(){},data_onunselected:function(){}},ji={subchart_show:!1,subchart_size_height:60,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_text_show:!0,subchart_onbrush:function(){}},Ni={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_privileged:!1,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0},Yi=function(){return Z(ie.prototype,Mi),Z(ce.prototype,Di),dt.setOptions([$i]),(Yi=function(){return!0})()},Gi=function(){return Z(ie.prototype,Fi),dt.setOptions([ji]),(Gi=function(){return!0})()},Vi=function(){return Z(ie.prototype,Bi),Z(ce.prototype,zi),dt.setOptions([Ni]),(Vi=function(){return!0})()},Hi={},Wi={version:"2.0.2",generate:function(t){var e=et({},Hi,t),i=new ce(e);return i.internal.charts=this.instance,this.instance.push(i),i},defaults:function(t){return F(t)&&(Hi=t),Hi},instance:[],plugin:{}};Object.keys(n).forEach((function(t){return n[t]()})),Object.keys(a).forEach((function(t){return a[t]()}))}])}));
//# sourceMappingURL=billboard.min.js.map