telegram-crawler/data/web/tsf.telegram.org/js/billboard.min.js
2022-05-13 12:05:36 +02:00

13 lines
No EOL
306 KiB
JavaScript

/*!
* Copyright (c) 2017 ~ present NAVER Corp.
* billboard.js project is licensed under the MIT license
*
* billboard.js, JavaScript chart library
* http://naver.github.io/billboard.js/
*
* @version 1.7.1-snapshot
*
* All-in-one packaged file for ease use of 'billboard.js' with below dependency.
* - d3 ^5.9.1
*/
!function webpackUniversalModuleDefinition(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(window,function(){return function(n){var i={};function __webpack_require__(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,__webpack_require__),e.l=!0,e.exports}return __webpack_require__.m=n,__webpack_require__.c=i,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},__webpack_require__.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.t=function(e,t){if(1&t&&(e=__webpack_require__(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(__webpack_require__.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)__webpack_require__.d(n,i,function(t){return e[t]}.bind(null,i));return n},__webpack_require__.n=function(t){var e=t&&t.__esModule?function getDefault(){return t["default"]}:function getModuleExports(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=11)}([function(t,e){t.exports=function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,n){var i=n(2),a=n(3),r=n(4);t.exports=function _slicedToArray(t,e){return i(t)||a(t,e)||r()}},function(t,e){t.exports=function _arrayWithHoles(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function _iterableToArrayLimit(t,e){var n=[],i=!0,a=!1,r=undefined;try{for(var o,s=t[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);i=!0);}catch(c){a=!0,r=c}finally{try{i||null==s["return"]||s["return"]()}finally{if(a)throw r}}return n}},function(t,e){t.exports=function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e){function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}t.exports=function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}},function(t,e,n){var i=n(7),a=n(8),r=n(9);t.exports=function _toConsumableArray(t){return i(t)||a(t)||r()}},function(t,e){t.exports=function _arrayWithoutHoles(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}},function(t,e){t.exports=function _iterableToArray(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){function _typeof2(t){return(_typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof2(t){return typeof t}:function _typeof2(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return"function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?e.exports=_typeof=function _typeof(t){return _typeof2(t)}:e.exports=_typeof=function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":_typeof2(t)},_typeof(t)}e.exports=_typeof},function(t,e,n){"use strict";n.r(e);var i="http://www.w3.org/1999/xhtml",I={svg:"http://www.w3.org/2000/svg",xhtml:i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},a=function(t){var e=t+="",n=e.indexOf(":");return 0<=n&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),I.hasOwnProperty(e)?{space:I[e],local:t}:t};var r=function(t){var e=a(t);return(e.local?function creatorFixed(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function creatorInherit(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===i&&t.documentElement.namespaceURI===i?t.createElement(n):t.createElementNS(e,n)}})(e)};function none(){}var f=function(t){return null==t?none:function(){return this.querySelector(t)}};function selectorAll_empty(){return[]}var m=function(t){return null==t?selectorAll_empty:function(){return this.querySelectorAll(t)}},l=function(t){return function(){return this.matches(t)}},o=function(t){return new Array(t.length)};function EnterNode(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}EnterNode.prototype={constructor:EnterNode,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var b=function(t){return function(){return t}};function bindIndex(t,e,n,i,a,r){for(var o,s=0,c=e.length,u=r.length;s<u;++s)(o=e[s])?(o.__data__=r[s],i[s]=o):n[s]=new EnterNode(t,r[s]);for(;s<c;++s)(o=e[s])&&(a[s]=o)}function bindKey(t,e,n,i,a,r,o){var s,c,u,l={},h=e.length,d=r.length,f=new Array(h);for(s=0;s<h;++s)(c=e[s])&&(f[s]=u="$"+o.call(c,c.__data__,s,e),u in l?a[s]=c:l[u]=c);for(s=0;s<d;++s)(c=l[u="$"+o.call(t,r[s],s,r)])?((i[s]=c).__data__=r[s],l[u]=null):n[s]=new EnterNode(t,r[s]);for(s=0;s<h;++s)(c=e[s])&&l[f[s]]===c&&(a[s]=c)}function ascending(t,e){return t<e?-1:e<t?1:e<=t?0:NaN}var s=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function styleValue(t,e){return t.style.getPropertyValue(e)||s(t).getComputedStyle(t,null).getPropertyValue(e)}function classArray(t){return t.trim().split(/^|\s+/)}function classList(t){return t.classList||new ClassList(t)}function ClassList(t){this._node=t,this._names=classArray(t.getAttribute("class")||"")}function classedAdd(t,e){for(var n=classList(t),i=-1,a=e.length;++i<a;)n.add(e[i])}function classedRemove(t,e){for(var n=classList(t),i=-1,a=e.length;++i<a;)n.remove(e[i])}ClassList.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);0<=e&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return 0<=this._names.indexOf(t)}};function textRemove(){this.textContent=""}function htmlRemove(){this.innerHTML=""}function raise(){this.nextSibling&&this.parentNode.appendChild(this)}function lower(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function constantNull(){return null}function remove_remove(){var t=this.parentNode;t&&t.removeChild(this)}function selection_cloneShallow(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function selection_cloneDeep(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var d={},E=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(d={mouseenter:"mouseover",mouseleave:"mouseout"}));function filterContextListener(n,t,e){return n=contextListener(n,t,e),function(t){var e=t.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||n.call(this,t)}}function contextListener(n,i,a){return function(t){var e=E;E=t;try{n.call(this,this.__data__,i,a)}finally{E=e}}}function onRemove(r){return function(){var t=this.__on;if(t){for(var e,n=0,i=-1,a=t.length;n<a;++n)e=t[n],r.type&&e.type!==r.type||e.name!==r.name?t[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?t.length=i:delete this.__on}}}function onAdd(c,u,l){var h=d.hasOwnProperty(c.type)?filterContextListener:contextListener;return function(t,e,n){var i,a=this.__on,r=h(u,e,n);if(a)for(var o=0,s=a.length;o<s;++o)if((i=a[o]).type===c.type&&i.name===c.name)return this.removeEventListener(i.type,i.listener,i.capture),this.addEventListener(i.type,i.listener=r,i.capture=l),void(i.value=u);this.addEventListener(c.type,r,l),i={type:c.type,name:c.name,value:u,listener:r,capture:l},a?a.push(i):this.__on=[i]}}function customEvent(t,e,n,i){var a=E;t.sourceEvent=E,E=t;try{return e.apply(n,i)}finally{E=a}}function dispatch_dispatchEvent(t,e,n){var i=s(t),a=i.CustomEvent;"function"==typeof a?a=new a(e,n):(a=i.document.createEvent("Event"),n?(a.initEvent(e,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(e,!1,!1)),t.dispatchEvent(a)}var c=[null];function Selection(t,e){this._groups=t,this._parents=e}function selection_selection(){return new Selection([[document.documentElement]],c)}Selection.prototype=selection_selection.prototype={constructor:Selection,select:function(t){"function"!=typeof t&&(t=f(t));for(var e=this._groups,n=e.length,i=new Array(n),a=0;a<n;++a)for(var r,o,s=e[a],c=s.length,u=i[a]=new Array(c),l=0;l<c;++l)(r=s[l])&&(o=t.call(r,r.__data__,l,s))&&("__data__"in r&&(o.__data__=r.__data__),u[l]=o);return new Selection(i,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=m(t));for(var e=this._groups,n=e.length,i=[],a=[],r=0;r<n;++r)for(var o,s=e[r],c=s.length,u=0;u<c;++u)(o=s[u])&&(i.push(t.call(o,o.__data__,u,s)),a.push(o));return new Selection(i,a)},filter:function(t){"function"!=typeof t&&(t=l(t));for(var e=this._groups,n=e.length,i=new Array(n),a=0;a<n;++a)for(var r,o=e[a],s=o.length,c=i[a]=[],u=0;u<s;++u)(r=o[u])&&t.call(r,r.__data__,u,o)&&c.push(r);return new Selection(i,this._parents)},data:function(t,e){if(!t)return f=new Array(this.size()),u=-1,this.each(function(t){f[++u]=t}),f;var n=e?bindKey:bindIndex,i=this._parents,a=this._groups;"function"!=typeof t&&(t=b(t));for(var r=a.length,o=new Array(r),s=new Array(r),c=new Array(r),u=0;u<r;++u){var l=i[u],h=a[u],d=h.length,f=t.call(l,l&&l.__data__,u,i),g=f.length,p=s[u]=new Array(g),_=o[u]=new Array(g);n(l,h,p,_,c[u]=new Array(d),f,e);for(var m,x,y=0,v=0;y<g;++y)if(m=p[y]){for(v<=y&&(v=y+1);!(x=_[v])&&++v<g;);m._next=x||null}}return(o=new Selection(o,i))._enter=s,o._exit=c,o},enter:function(){return new Selection(this._enter||this._groups.map(o),this._parents)},exit:function(){return new Selection(this._exit||this._groups.map(o),this._parents)},join:function(t,e,n){var i=this.enter(),a=this,r=this.exit();return i="function"==typeof t?t(i):i.append(t+""),null!=e&&(a=e(a)),null==n?r.remove():n(r),i&&a?i.merge(a).order():a},merge:function(t){for(var e=this._groups,n=t._groups,i=e.length,a=n.length,r=Math.min(i,a),o=new Array(i),s=0;s<r;++s)for(var c,u=e[s],l=n[s],h=u.length,d=o[s]=new Array(h),f=0;f<h;++f)(c=u[f]||l[f])&&(d[f]=c);for(;s<i;++s)o[s]=e[s];return new Selection(o,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,a=t[e],r=a.length-1,o=a[r];0<=--r;)(i=a[r])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(n){function compareNode(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}n||(n=ascending);for(var t=this._groups,e=t.length,i=new Array(e),a=0;a<e;++a){for(var r,o=t[a],s=o.length,c=i[a]=new Array(s),u=0;u<s;++u)(r=o[u])&&(c[u]=r);c.sort(compareNode)}return new Selection(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],a=0,r=i.length;a<r;++a){var o=i[a];if(o)return o}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var a,r=e[n],o=0,s=r.length;o<s;++o)(a=r[o])&&t.call(a,a.__data__,o,r);return this},attr:function(t,e){var n=a(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?function attrRemoveNS(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function attrRemove(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?n.local?function attrFunctionNS(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}:function attrFunction(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}:n.local?function attrConstantNS(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function attrConstant(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return 1<arguments.length?this.each((null==e?function styleRemove(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function styleFunction(e,n,i){return function(){var t=n.apply(this,arguments);null==t?this.style.removeProperty(e):this.style.setProperty(e,t,i)}}:function styleConstant(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):styleValue(this.node(),t)},property:function(t,e){return 1<arguments.length?this.each((null==e?function propertyRemove(t){return function(){delete this[t]}}:"function"==typeof e?function propertyFunction(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}:function propertyConstant(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=classArray(t+"");if(arguments.length<2){for(var i=classList(this.node()),a=-1,r=n.length;++a<r;)if(!i.contains(n[a]))return!1;return!0}return this.each(("function"==typeof e?function classedFunction(t,e){return function(){(e.apply(this,arguments)?classedAdd:classedRemove)(this,t)}}:e?function classedTrue(t){return function(){classedAdd(this,t)}}:function classedFalse(t){return function(){classedRemove(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?textRemove:("function"==typeof t?function textFunction(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}:function textConstant(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?htmlRemove:("function"==typeof t?function htmlFunction(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}:function htmlConstant(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(raise)},lower:function(){return this.each(lower)},append:function(t){var e="function"==typeof t?t:r(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:r(t),i=null==e?constantNull:"function"==typeof e?e:f(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})},remove:function(){return this.each(remove_remove)},clone:function(t){return this.select(t?selection_cloneDeep:selection_cloneShallow)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,a,r=function parseTypenames(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return 0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),o=r.length;if(!(arguments.length<2)){for(s=e?onAdd:onRemove,null==n&&(n=!1),i=0;i<o;++i)this.each(s(r[i],e,n));return this}var s=this.node().__on;if(s)for(var c,u=0,l=s.length;u<l;++u)for(i=0,c=s[u];i<o;++i)if((a=r[i]).type===c.type&&a.name===c.name)return c.value},dispatch:function(t,e){return this.each(("function"==typeof e?function dispatchFunction(t,e){return function(){return dispatch_dispatchEvent(this,t,e.apply(this,arguments))}}:function dispatchConstant(t,e){return function(){return dispatch_dispatchEvent(this,t,e)}})(t,e))}};var u=selection_selection,O=function(t){return"string"==typeof t?new Selection([[document.querySelector(t)]],[document.documentElement]):new Selection([[t]],c)},h=0;function Local(){this._="@"+(++h).toString(36)}Local.prototype=function local(){return new Local}.prototype={constructor:Local,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var g=function(){for(var t,e=E;t=e.sourceEvent;)e=t;return e},p=function(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]},P=function(t){var e=g();return e.changedTouches&&(e=e.changedTouches[0]),p(t,e)},_=function(t){return"string"==typeof t?new Selection([document.querySelectorAll(t)],[document.documentElement]):new Selection([null==t?[]:t],c)},y=function(t,e,n){arguments.length<3&&(n=e,e=g().changedTouches);for(var i,a=0,r=e?e.length:0;a<r;++a)if((i=e[a]).identifier===n)return p(t,i);return null},v=new Date,T=new Date;function newInterval(r,o,n,i){function interval(t){return r(t=new Date(+t)),t}return(interval.floor=interval).ceil=function(t){return r(t=new Date(t-1)),o(t,1),r(t),t},interval.round=function(t){var e=interval(t),n=interval.ceil(t);return t-e<n-t?e:n},interval.offset=function(t,e){return o(t=new Date(+t),null==e?1:Math.floor(e)),t},interval.range=function(t,e,n){var i,a=[];if(t=interval.ceil(t),n=null==n?1:Math.floor(n),!(t<e&&0<n))return a;for(;a.push(i=new Date(+t)),o(t,n),r(t),i<t&&t<e;);return a},interval.filter=function(n){return newInterval(function(t){if(t<=t)for(;r(t),!n(t);)t.setTime(t-1)},function(t,e){if(t<=t)if(e<0)for(;++e<=0;)for(;o(t,-1),!n(t););else for(;0<=--e;)for(;o(t,1),!n(t););})},n&&(interval.count=function(t,e){return v.setTime(+t),T.setTime(+e),r(v),r(T),Math.floor(n(v,T))},interval.every=function(e){return e=Math.floor(e),isFinite(e)&&0<e?1<e?interval.filter(i?function(t){return i(t)%e==0}:function(t){return interval.count(0,t)%e==0}):interval:null}),interval}var w=newInterval(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});w.every=function(n){return n=Math.floor(n),isFinite(n)&&0<n?1<n?newInterval(function(t){t.setTime(Math.floor(t/n)*n)},function(t,e){t.setTime(+t+e*n)},function(t,e){return(e-t)/n}):w:null};var A=w,k=(w.range,newInterval(function(t){t.setTime(t-t.getMilliseconds())},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3},function(t){return t.getUTCSeconds()})),C=k,S=(k.range,newInterval(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},function(t,e){t.setTime(+t+6e4*e)},function(t,e){return(e-t)/6e4},function(t){return t.getMinutes()})),M=S,L=(S.range,newInterval(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getHours()})),D=L,F=(L.range,newInterval(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5},function(t){return t.getDate()-1})),R=F;F.range;function weekday(e){return newInterval(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5})}var z=weekday(0),X=weekday(1),Y=weekday(2),N=weekday(3),B=weekday(4),H=weekday(5),V=weekday(6),U=(z.range,X.range,Y.range,N.range,B.range,H.range,V.range,newInterval(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())},function(t){return t.getMonth()})),W=U,G=(U.range,newInterval(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()}));G.every=function(n){return isFinite(n=Math.floor(n))&&0<n?newInterval(function(t){t.setFullYear(Math.floor(t.getFullYear()/n)*n),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e*n)}):null};var j=G,q=(G.range,newInterval(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+6e4*e)},function(t,e){return(e-t)/6e4},function(t){return t.getUTCMinutes()})),Z=(q.range,newInterval(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getUTCHours()})),$=(Z.range,newInterval(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5},function(t){return t.getUTCDate()-1})),K=$;$.range;function utcWeekday(e){return newInterval(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/6048e5})}var J=utcWeekday(0),Q=utcWeekday(1),tt=utcWeekday(2),et=utcWeekday(3),nt=utcWeekday(4),it=utcWeekday(5),at=utcWeekday(6),rt=(J.range,Q.range,tt.range,et.range,nt.range,it.range,at.range,newInterval(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()})),ot=(rt.range,newInterval(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()}));ot.every=function(n){return isFinite(n=Math.floor(n))&&0<n?newInterval(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/n)*n),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e*n)}):null};var st=ot;ot.range;function localDate(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function utcDate(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function newYear(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}var ct,ut,lt,ht,dt,ft={"-":"",_:" ",0:"0"},gt=/^\s*\d+/,pt=/^%/,_t=/[\\^$*+?|[\]().{}]/g;function pad(t,e,n){var i=t<0?"-":"",a=(i?-t:t)+"",r=a.length;return i+(r<n?new Array(n-r+1).join(e)+a:a)}function requote(t){return t.replace(_t,"\\$&")}function formatRe(t){return new RegExp("^(?:"+t.map(requote).join("|")+")","i")}function formatLookup(t){for(var e={},n=-1,i=t.length;++n<i;)e[t[n].toLowerCase()]=n;return e}function parseWeekdayNumberSunday(t,e,n){var i=gt.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function parseWeekdayNumberMonday(t,e,n){var i=gt.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function parseWeekNumberSunday(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function parseWeekNumberISO(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function parseWeekNumberMonday(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function parseFullYear(t,e,n){var i=gt.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function parseYear(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(68<+i[0]?1900:2e3),n+i[0].length):-1}function parseZone(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function parseMonthNumber(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function parseDayOfMonth(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function parseDayOfYear(t,e,n){var i=gt.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function parseHour24(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function parseMinutes(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function parseSeconds(t,e,n){var i=gt.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function parseMilliseconds(t,e,n){var i=gt.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function parseMicroseconds(t,e,n){var i=gt.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function parseLiteralPercent(t,e,n){var i=pt.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function parseUnixTimestamp(t,e,n){var i=gt.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function parseUnixTimestampSeconds(t,e,n){var i=gt.exec(e.slice(n));return i?(t.Q=1e3*+i[0],n+i[0].length):-1}function formatDayOfMonth(t,e){return pad(t.getDate(),e,2)}function formatHour24(t,e){return pad(t.getHours(),e,2)}function formatHour12(t,e){return pad(t.getHours()%12||12,e,2)}function formatDayOfYear(t,e){return pad(1+R.count(j(t),t),e,3)}function formatMilliseconds(t,e){return pad(t.getMilliseconds(),e,3)}function formatMicroseconds(t,e){return formatMilliseconds(t,e)+"000"}function formatMonthNumber(t,e){return pad(t.getMonth()+1,e,2)}function formatMinutes(t,e){return pad(t.getMinutes(),e,2)}function formatSeconds(t,e){return pad(t.getSeconds(),e,2)}function formatWeekdayNumberMonday(t){var e=t.getDay();return 0===e?7:e}function formatWeekNumberSunday(t,e){return pad(z.count(j(t),t),e,2)}function formatWeekNumberISO(t,e){var n=t.getDay();return t=4<=n||0===n?B(t):B.ceil(t),pad(B.count(j(t),t)+(4===j(t).getDay()),e,2)}function formatWeekdayNumberSunday(t){return t.getDay()}function formatWeekNumberMonday(t,e){return pad(X.count(j(t),t),e,2)}function locale_formatYear(t,e){return pad(t.getFullYear()%100,e,2)}function formatFullYear(t,e){return pad(t.getFullYear()%1e4,e,4)}function formatZone(t){var e=t.getTimezoneOffset();return(0<e?"-":(e*=-1,"+"))+pad(e/60|0,"0",2)+pad(e%60,"0",2)}function formatUTCDayOfMonth(t,e){return pad(t.getUTCDate(),e,2)}function formatUTCHour24(t,e){return pad(t.getUTCHours(),e,2)}function formatUTCHour12(t,e){return pad(t.getUTCHours()%12||12,e,2)}function formatUTCDayOfYear(t,e){return pad(1+K.count(st(t),t),e,3)}function formatUTCMilliseconds(t,e){return pad(t.getUTCMilliseconds(),e,3)}function formatUTCMicroseconds(t,e){return formatUTCMilliseconds(t,e)+"000"}function formatUTCMonthNumber(t,e){return pad(t.getUTCMonth()+1,e,2)}function formatUTCMinutes(t,e){return pad(t.getUTCMinutes(),e,2)}function formatUTCSeconds(t,e){return pad(t.getUTCSeconds(),e,2)}function formatUTCWeekdayNumberMonday(t){var e=t.getUTCDay();return 0===e?7:e}function formatUTCWeekNumberSunday(t,e){return pad(J.count(st(t),t),e,2)}function formatUTCWeekNumberISO(t,e){var n=t.getUTCDay();return t=4<=n||0===n?nt(t):nt.ceil(t),pad(nt.count(st(t),t)+(4===st(t).getUTCDay()),e,2)}function formatUTCWeekdayNumberSunday(t){return t.getUTCDay()}function formatUTCWeekNumberMonday(t,e){return pad(Q.count(st(t),t),e,2)}function formatUTCYear(t,e){return pad(t.getUTCFullYear()%100,e,2)}function formatUTCFullYear(t,e){return pad(t.getUTCFullYear()%1e4,e,4)}function formatUTCZone(){return"+0000"}function formatLiteralPercent(){return"%"}function formatUnixTimestamp(t){return+t}function formatUnixTimestampSeconds(t){return Math.floor(+t/1e3)}!function defaultLocale(t){return ct=function formatLocale(t){var i=t.dateTime,a=t.date,r=t.time,e=t.periods,n=t.days,o=t.shortDays,s=t.months,c=t.shortMonths,u=formatRe(e),l=formatLookup(e),h=formatRe(n),d=formatLookup(n),f=formatRe(o),g=formatLookup(o),p=formatRe(s),_=formatLookup(s),m=formatRe(c),x=formatLookup(c),y={a:function formatShortWeekday(t){return o[t.getDay()]},A:function formatWeekday(t){return n[t.getDay()]},b:function formatShortMonth(t){return c[t.getMonth()]},B:function formatMonth(t){return s[t.getMonth()]},c:null,d:formatDayOfMonth,e:formatDayOfMonth,f:formatMicroseconds,H:formatHour24,I:formatHour12,j:formatDayOfYear,L:formatMilliseconds,m:formatMonthNumber,M:formatMinutes,p:function formatPeriod(t){return e[+(12<=t.getHours())]},Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatSeconds,u:formatWeekdayNumberMonday,U:formatWeekNumberSunday,V:formatWeekNumberISO,w:formatWeekdayNumberSunday,W:formatWeekNumberMonday,x:null,X:null,y:locale_formatYear,Y:formatFullYear,Z:formatZone,"%":formatLiteralPercent},v={a:function formatUTCShortWeekday(t){return o[t.getUTCDay()]},A:function formatUTCWeekday(t){return n[t.getUTCDay()]},b:function formatUTCShortMonth(t){return c[t.getUTCMonth()]},B:function formatUTCMonth(t){return s[t.getUTCMonth()]},c:null,d:formatUTCDayOfMonth,e:formatUTCDayOfMonth,f:formatUTCMicroseconds,H:formatUTCHour24,I:formatUTCHour12,j:formatUTCDayOfYear,L:formatUTCMilliseconds,m:formatUTCMonthNumber,M:formatUTCMinutes,p:function formatUTCPeriod(t){return e[+(12<=t.getUTCHours())]},Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatUTCSeconds,u:formatUTCWeekdayNumberMonday,U:formatUTCWeekNumberSunday,V:formatUTCWeekNumberISO,w:formatUTCWeekdayNumberSunday,W:formatUTCWeekNumberMonday,x:null,X:null,y:formatUTCYear,Y:formatUTCFullYear,Z:formatUTCZone,"%":formatLiteralPercent},b={a:function parseShortWeekday(t,e,n){var i=f.exec(e.slice(n));return i?(t.w=g[i[0].toLowerCase()],n+i[0].length):-1},A:function parseWeekday(t,e,n){var i=h.exec(e.slice(n));return i?(t.w=d[i[0].toLowerCase()],n+i[0].length):-1},b:function parseShortMonth(t,e,n){var i=m.exec(e.slice(n));return i?(t.m=x[i[0].toLowerCase()],n+i[0].length):-1},B:function parseMonth(t,e,n){var i=p.exec(e.slice(n));return i?(t.m=_[i[0].toLowerCase()],n+i[0].length):-1},c:function parseLocaleDateTime(t,e,n){return parseSpecifier(t,i,e,n)},d:parseDayOfMonth,e:parseDayOfMonth,f:parseMicroseconds,H:parseHour24,I:parseHour24,j:parseDayOfYear,L:parseMilliseconds,m:parseMonthNumber,M:parseMinutes,p:function parsePeriod(t,e,n){var i=u.exec(e.slice(n));return i?(t.p=l[i[0].toLowerCase()],n+i[0].length):-1},Q:parseUnixTimestamp,s:parseUnixTimestampSeconds,S:parseSeconds,u:parseWeekdayNumberMonday,U:parseWeekNumberSunday,V:parseWeekNumberISO,w:parseWeekdayNumberSunday,W:parseWeekNumberMonday,x:function parseLocaleDate(t,e,n){return parseSpecifier(t,a,e,n)},X:function parseLocaleTime(t,e,n){return parseSpecifier(t,r,e,n)},y:parseYear,Y:parseFullYear,Z:parseZone,"%":parseLiteralPercent};function newFormat(c,u){return function(t){var e,n,i,a=[],r=-1,o=0,s=c.length;for(t instanceof Date||(t=new Date(+t));++r<s;)37===c.charCodeAt(r)&&(a.push(c.slice(o,r)),null!=(n=ft[e=c.charAt(++r)])?e=c.charAt(++r):n="e"===e?" ":"0",(i=u[e])&&(e=i(t,n)),a.push(e),o=r+1);return a.push(c.slice(o,r)),a.join("")}}function newParse(a,r){return function(t){var e,n,i=newYear(1900);if(parseSpecifier(i,a,t+="",0)!=t.length)return null;if("Q"in i)return new Date(i.Q);if("p"in i&&(i.H=i.H%12+12*i.p),"V"in i){if(i.V<1||53<i.V)return null;"w"in i||(i.w=1),i.d="Z"in i?(e=4<(n=(e=utcDate(newYear(i.y))).getUTCDay())||0===n?Q.ceil(e):Q(e),e=K.offset(e,7*(i.V-1)),i.y=e.getUTCFullYear(),i.m=e.getUTCMonth(),e.getUTCDate()+(i.w+6)%7):(e=4<(n=(e=r(newYear(i.y))).getDay())||0===n?X.ceil(e):X(e),e=R.offset(e,7*(i.V-1)),i.y=e.getFullYear(),i.m=e.getMonth(),e.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),n="Z"in i?utcDate(newYear(i.y)).getUTCDay():r(newYear(i.y)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(n+5)%7:i.w+7*i.U-(n+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,utcDate(i)):r(i)}}function parseSpecifier(t,e,n,i){for(var a,r,o=0,s=e.length,c=n.length;o<s;){if(c<=i)return-1;if(37===(a=e.charCodeAt(o++))){if(a=e.charAt(o++),!(r=b[a in ft?e.charAt(o++):a])||(i=r(t,n,i))<0)return-1}else if(a!=n.charCodeAt(i++))return-1}return i}return y.x=newFormat(a,y),y.X=newFormat(r,y),y.c=newFormat(i,y),v.x=newFormat(a,v),v.X=newFormat(r,v),v.c=newFormat(i,v),{format:function(t){var e=newFormat(t+="",y);return e.toString=function(){return t},e},parse:function(t){var e=newParse(t+="",localDate);return e.toString=function(){return t},e},utcFormat:function(t){var e=newFormat(t+="",v);return e.toString=function(){return t},e},utcParse:function(t){var e=newParse(t,utcDate);return e.toString=function(){return t},e}}}(t),ut=ct.format,lt=ct.parse,ht=ct.utcFormat,dt=ct.utcParse,ct}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var mt="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString?function formatIsoNative(t){return t.toISOString()}:ht(mt);+new Date("2000-01-01T00:00:00.000Z")?function parseIsoNative(t){var e=new Date(t);return isNaN(e)?null:e}:dt(mt);var xt=function(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[1<i.length?i[0]+i.slice(2):i,+t.slice(n+1)]},yt=function(t){return(t=xt(Math.abs(t)))?t[1]:NaN},vt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(t){return new FormatSpecifier(t)}function FormatSpecifier(t){if(!(e=vt.exec(t)))throw new Error("invalid format: "+t);var e;this.fill=e[1]||" ",this.align=e[2]||">",this.sign=e[3]||"-",this.symbol=e[4]||"",this.zero=!!e[5],this.width=e[6]&&+e[6],this.comma=!!e[7],this.precision=e[8]&&+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||""}formatSpecifier.prototype=FormatSpecifier.prototype,FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var bt,Tt,wt,At,kt=function(t,e){var n=xt(t,e);if(!n)return t+"";var i=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+i:i.length>a+1?i.slice(0,a+1)+"."+i.slice(a+1):i+new Array(a-i.length+2).join("0")},Ct={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return kt(100*t,e)},r:kt,s:function(t,e){var n=xt(t,e);if(!n)return t+"";var i=n[0],a=n[1],r=a-(bt=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=i.length;return r===o?i:o<r?i+new Array(r-o+1).join("0"):0<r?i.slice(0,r)+"."+i.slice(r):"0."+new Array(1-r).join("0")+xt(t,Math.max(0,e+r-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},St=function(t){return t},Mt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Lt=function(t){var e,s,c,T=t.grouping&&t.thousands?(s=t.grouping,c=t.thousands,function(t,e){for(var n=t.length,i=[],a=0,r=s[0],o=0;0<n&&0<r&&(e<o+r+1&&(r=Math.max(1,e-o)),i.push(t.substring(n-=r,n+r)),!((o+=r+1)>e));)r=s[a=(a+1)%s.length];return i.reverse().join(c)}):St,n=t.currency,w=t.decimal,A=t.numerals?(e=t.numerals,function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}):St,i=t.percent||"%";function newFormat(t){var u=(t=formatSpecifier(t)).fill,l=t.align,h=t.sign,e=t.symbol,d=t.zero,f=t.width,g=t.comma,p=t.precision,_=t.trim,m=t.type;"n"===m?(g=!0,m="g"):Ct[m]||(null==p&&(p=12),_=!0,m="g"),(d||"0"===u&&"="===l)&&(d=!0,u="0",l="=");var x="$"===e?n[0]:"#"===e&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",y="$"===e?n[1]:/[%p]/.test(m)?i:"",v=Ct[m],b=/[defgprs%]/.test(m);function format(t){var e,n,i,a=x,r=y;if("c"===m)r=v(t)+r,t="";else{var o=(t=+t)<0;if(t=v(Math.abs(t),p),_&&(t=function(t){t:for(var e,n=t.length,i=1,a=-1;i<n;++i)switch(t[i]){case".":a=e=i;break;case"0":0===a&&(a=i),e=i;break;default:if(0<a){if(!+t[i])break t;a=0}}return 0<a?t.slice(0,a)+t.slice(e+1):t}(t)),o&&0==+t&&(o=!1),a=(o?"("===h?h:"-":"-"===h||"("===h?"":h)+a,r=("s"===m?Mt[8+bt/3]:"")+r+(o&&"("===h?")":""),b)for(e=-1,n=t.length;++e<n;)if((i=t.charCodeAt(e))<48||57<i){r=(46===i?w+t.slice(e+1):t.slice(e))+r,t=t.slice(0,e);break}}g&&!d&&(t=T(t,Infinity));var s=a.length+t.length+r.length,c=s<f?new Array(f-s+1).join(u):"";switch(g&&d&&(t=T(c+t,c.length?f-r.length:Infinity),c=""),l){case"<":t=a+t+r+c;break;case"=":t=a+c+t+r;break;case"^":t=c.slice(0,s=c.length>>1)+a+t+r+c.slice(s);break;default:t=c+a+t+r}return A(t)}return p=null==p?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),format.toString=function(){return t+""},format}return{format:newFormat,formatPrefix:function formatPrefix(t,e){var n=newFormat(((t=formatSpecifier(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(yt(e)/3))),a=Math.pow(10,-i),r=Mt[8+i/3];return function(t){return n(a*t)+r}}}};!function defaultLocale_defaultLocale(t){return Tt=Lt(t),wt=Tt.format,At=Tt.formatPrefix,Tt}({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var Dt=n(0),Ft=n.n(Dt),Rt=n(1),zt=n.n(Rt),Xt=n(5),It=n.n(Xt),Et={value:function(){}};function dispatch_dispatch(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i)throw new Error("illegal type: "+t);i[t]=[]}return new Dispatch(i)}function Dispatch(t){this._=t}function get(t,e){for(var n,i=0,a=t.length;i<a;++i)if((n=t[i]).name===e)return n.value}function set(t,e,n){for(var i=0,a=t.length;i<a;++i)if(t[i].name===e){t[i]=Et,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}Dispatch.prototype=dispatch_dispatch.prototype={constructor:Dispatch,on:function(t,e){var n,i=this._,a=function dispatch_parseTypenames(t,i){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!i.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}(t+"",i),r=-1,o=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++r<o;)if(n=(t=a[r]).type)i[n]=set(i[n],t.name,e);else if(null==e)for(n in i)i[n]=set(i[n],t.name,null);return this}for(;++r<o;)if((n=(t=a[r]).type)&&(n=get(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Dispatch(t)},call:function(t,e){if(0<(n=arguments.length-2))for(var n,i,a=new Array(n),r=0;r<n;++r)a[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=0,n=(i=this._[t]).length;r<n;++r)i[r].value.apply(e,a)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],a=0,r=i.length;a<r;++a)i[a].value.apply(e,n)}};var Ot,Pt,Yt=dispatch_dispatch,Nt=0,Bt=0,Ht=0,Vt=1e3,Ut=0,Wt=0,Gt=0,jt="object"==typeof performance&&performance.now?performance:Date,qt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function now(){return Wt||(qt(clearNow),Wt=jt.now()+Gt)}function clearNow(){Wt=0}function Timer(){this._call=this._time=this._next=null}function timer(t,e,n){var i=new Timer;return i.restart(t,e,n),i}function wake(){Wt=(Ut=jt.now())+Gt,Nt=Bt=0;try{!function timerFlush(){now(),++Nt;for(var t,e=Ot;e;)0<=(t=Wt-e._time)&&e._call.call(null,t),e=e._next;--Nt}()}finally{Nt=0,function nap(){var t,e,n=Ot,i=Infinity;for(;n;)n=n._call?(i>n._time&&(i=n._time),(t=n)._next):(e=n._next,n._next=null,t?t._next=e:Ot=e);Pt=t,sleep(i)}(),Wt=0}}function poke(){var t=jt.now(),e=t-Ut;Vt<e&&(Gt-=e,Ut=t)}function sleep(t){Nt||(Bt&&(Bt=clearTimeout(Bt)),24<t-Wt?(t<Infinity&&(Bt=setTimeout(wake,t-jt.now()-Gt)),Ht&&(Ht=clearInterval(Ht))):(Ht||(Ut=jt.now(),Ht=setInterval(poke,Vt)),Nt=1,qt(wake)))}Timer.prototype=timer.prototype={constructor:Timer,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?now():+n)+(null==e?0:+e),this._next||Pt===this||(Pt?Pt._next=this:Ot=this,Pt=this),this._call=t,this._time=n,sleep()},stop:function(){this._call&&(this._call=null,this._time=Infinity,sleep())}};var Zt=function(e,n,t){var i=new Timer;return n=null==n?0:+n,i.restart(function(t){i.stop(),e(t+n)},n,t),i},$t=Yt("start","end","cancel","interrupt"),Kt=[],Jt=0,Qt=3,te=function(t,e,n,i,a,r){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function schedule_create(r,o,s){var c,u=r.__transition;function start(t){var e,n,i,a;if(1!==s.state)return stop();for(e in u)if((a=u[e]).name===s.name){if(a.state===Qt)return Zt(start);4===a.state?(a.state=6,a.timer.stop(),a.on.call("interrupt",r,r.__data__,a.index,a.group),delete u[e]):+e<o&&(a.state=6,a.timer.stop(),a.on.call("cancel",r,r.__data__,a.index,a.group),delete u[e])}if(Zt(function(){s.state===Qt&&(s.state=4,s.timer.restart(tick,s.delay,s.time),tick(t))}),s.state=2,s.on.call("start",r,r.__data__,s.index,s.group),2===s.state){for(s.state=Qt,c=new Array(i=s.tween.length),e=0,n=-1;e<i;++e)(a=s.tween[e].value.call(r,r.__data__,s.index,s.group))&&(c[++n]=a);c.length=n+1}}function tick(t){for(var e=t<s.duration?s.ease.call(null,t/s.duration):(s.timer.restart(stop),s.state=5,1),n=-1,i=c.length;++n<i;)c[n].call(r,e);5===s.state&&(s.on.call("end",r,r.__data__,s.index,s.group),stop())}function stop(){for(var t in s.state=6,s.timer.stop(),delete u[o],u)return;delete r.__transition}(u[o]=s).timer=timer(function schedule(t){s.state=1,s.timer.restart(start,s.delay,s.time),s.delay<=t&&start(t-s.delay)},0,s.time)}(t,n,{name:e,index:i,group:a,on:$t,tween:Kt,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Jt})};function schedule_init(t,e){var n=schedule_get(t,e);if(n.state>Jt)throw new Error("too late; already scheduled");return n}function schedule_set(t,e){var n=schedule_get(t,e);if(n.state>Qt)throw new Error("too late; already running");return n}function schedule_get(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var ee=function(t,e){var n,i,a,r=t.__transition,o=!0;if(r){for(a in e=null==e?null:e+"",r)(n=r[a]).name===e?(i=2<n.state&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[a]):o=!1;o&&delete t.__transition}},ne=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function extend(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Color(){}var ie=1/.7,ae="\\s*([+-]?\\d+)\\s*",re="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",oe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",se=/^#([0-9a-f]{3})$/,ce=/^#([0-9a-f]{6})$/,ue=new RegExp("^rgb\\("+[ae,ae,ae]+"\\)$"),le=new RegExp("^rgb\\("+[oe,oe,oe]+"\\)$"),he=new RegExp("^rgba\\("+[ae,ae,ae,re]+"\\)$"),de=new RegExp("^rgba\\("+[oe,oe,oe,re]+"\\)$"),fe=new RegExp("^hsl\\("+[re,oe,oe]+"\\)$"),ge=new RegExp("^hsla\\("+[re,oe,oe,re]+"\\)$"),pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function color_color(t){var e;return t=(t+"").trim().toLowerCase(),(e=se.exec(t))?new Rgb((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=ce.exec(t))?rgbn(parseInt(e[1],16)):(e=ue.exec(t))?new Rgb(e[1],e[2],e[3],1):(e=le.exec(t))?new Rgb(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=he.exec(t))?rgba(e[1],e[2],e[3],e[4]):(e=de.exec(t))?rgba(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=fe.exec(t))?hsla(e[1],e[2]/100,e[3]/100,1):(e=ge.exec(t))?hsla(e[1],e[2]/100,e[3]/100,e[4]):pe.hasOwnProperty(t)?rgbn(pe[t]):"transparent"===t?new Rgb(NaN,NaN,NaN,0):null}function rgbn(t){return new Rgb(t>>16&255,t>>8&255,255&t,1)}function rgba(t,e,n,i){return i<=0&&(t=e=n=NaN),new Rgb(t,e,n,i)}function rgbConvert(t){return t instanceof Color||(t=color_color(t)),t?new Rgb((t=t.rgb()).r,t.g,t.b,t.opacity):new Rgb}function color_rgb(t,e,n,i){return 1===arguments.length?rgbConvert(t):new Rgb(t,e,n,null==i?1:i)}function Rgb(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function hex(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function hsla(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||1<=n?t=e=NaN:e<=0&&(t=NaN),new Hsl(t,e,n,i)}function hsl(t,e,n,i){return 1===arguments.length?function hslConvert(t){if(t instanceof Hsl)return new Hsl(t.h,t.s,t.l,t.opacity);if(t instanceof Color||(t=color_color(t)),!t)return new Hsl;if(t instanceof Hsl)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,a=Math.min(e,n,i),r=Math.max(e,n,i),o=NaN,s=r-a,c=(r+a)/2;return s?(o=e===r?(n-i)/s+6*(n<i):n===r?(i-e)/s+2:(e-n)/s+4,s/=c<.5?r+a:2-r-a,o*=60):s=0<c&&c<1?0:o,new Hsl(o,s,c,t.opacity)}(t):new Hsl(t,e,n,null==i?1:i)}function Hsl(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function hsl2rgb(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}ne(Color,color_color,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),ne(Rgb,color_rgb,extend(Color,{brighter:function(t){return t=null==t?ie:Math.pow(ie,t),new Rgb(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Rgb(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+hex(this.r)+hex(this.g)+hex(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),ne(Hsl,hsl,extend(Color,{brighter:function(t){return t=null==t?ie:Math.pow(ie,t),new Hsl(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Hsl(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,a=2*n-i;return new Rgb(hsl2rgb(240<=t?t-240:t+120,a,i),hsl2rgb(t,a,i),hsl2rgb(t<120?t+240:t-120,a,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var _e=Math.PI/180,me=180/Math.PI,xe=.96422,ye=1,ve=.82521,be=4/29,Te=6/29,we=3*Te*Te,Ae=Te*Te*Te;function labConvert(t){if(t instanceof Lab)return new Lab(t.l,t.a,t.b,t.opacity);if(t instanceof Hcl){if(isNaN(t.h))return new Lab(t.l,0,0,t.opacity);var e=t.h*_e;return new Lab(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof Rgb||(t=rgbConvert(t));var n,i,a=rgb2lrgb(t.r),r=rgb2lrgb(t.g),o=rgb2lrgb(t.b),s=xyz2lab((.2225045*a+.7168786*r+.0606169*o)/ye);return a===r&&r===o?n=i=s:(n=xyz2lab((.4360747*a+.3850649*r+.1430804*o)/xe),i=xyz2lab((.0139322*a+.0971045*r+.7141733*o)/ve)),new Lab(116*s-16,500*(n-s),200*(s-i),t.opacity)}function lab(t,e,n,i){return 1===arguments.length?labConvert(t):new Lab(t,e,n,null==i?1:i)}function Lab(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function xyz2lab(t){return Ae<t?Math.pow(t,1/3):t/we+be}function lab2xyz(t){return Te<t?t*t*t:we*(t-be)}function lrgb2rgb(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function rgb2lrgb(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function hclConvert(t){if(t instanceof Hcl)return new Hcl(t.h,t.c,t.l,t.opacity);if(t instanceof Lab||(t=labConvert(t)),0===t.a&&0===t.b)return new Hcl(NaN,0,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*me;return new Hcl(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function hcl(t,e,n,i){return 1===arguments.length?hclConvert(t):new Hcl(t,e,n,null==i?1:i)}function Hcl(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}ne(Lab,lab,extend(Color,{brighter:function(t){return new Lab(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Lab(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Rgb(lrgb2rgb(3.1338561*(e=xe*lab2xyz(e))-1.6168667*(t=ye*lab2xyz(t))-.4906146*(n=ve*lab2xyz(n))),lrgb2rgb(-.9787684*e+1.9161415*t+.033454*n),lrgb2rgb(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),ne(Hcl,hcl,extend(Color,{brighter:function(t){return new Hcl(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Hcl(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return labConvert(this).rgb()}}));var ke=1.78277,Ce=-.29227,Se=-.90649,Me=1.97294,Le=Me*Se,De=Me*ke,Fe=ke*Ce- -.14861*Se;function cubehelix_cubehelix(t,e,n,i){return 1===arguments.length?function cubehelixConvert(t){if(t instanceof Cubehelix)return new Cubehelix(t.h,t.s,t.l,t.opacity);t instanceof Rgb||(t=rgbConvert(t));var e=t.r/255,n=t.g/255,i=t.b/255,a=(Fe*i+Le*e-De*n)/(Fe+Le-De),r=i-a,o=(Me*(n-a)-Ce*r)/Se,s=Math.sqrt(o*o+r*r)/(Me*a*(1-a)),c=s?Math.atan2(o,r)*me-120:NaN;return new Cubehelix(c<0?c+360:c,s,a,t.opacity)}(t):new Cubehelix(t,e,n,null==i?1:i)}function Cubehelix(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function basis(t,e,n,i,a){var r=t*t,o=r*t;return((1-3*t+3*r-o)*e+(4-6*r+3*o)*n+(1+3*t+3*r-3*o)*i+o*a)/6}ne(Cubehelix,cubehelix_cubehelix,extend(Color,{brighter:function(t){return t=null==t?ie:Math.pow(ie,t),new Cubehelix(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Cubehelix(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*_e,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),i=Math.cos(t),a=Math.sin(t);return new Rgb(255*(e+n*(-.14861*i+ke*a)),255*(e+n*(Ce*i+Se*a)),255*(e+n*(Me*i)),this.opacity)}}));var Re=function(t){return function(){return t}};function linear(e,n){return function(t){return e+t*n}}function color_hue(t,e){var n=e-t;return n?linear(t,180<n||n<-180?n-360*Math.round(n/360):n):Re(isNaN(t)?e:t)}function gamma(n){return 1==(n=+n)?nogamma:function(t,e){return e-t?function exponential(e,n,i){return e=Math.pow(e,i),n=Math.pow(n,i)-e,i=1/i,function(t){return Math.pow(e+t*n,i)}}(t,e,n):Re(isNaN(t)?e:t)}}function nogamma(t,e){var n=e-t;return n?linear(t,n):Re(isNaN(t)?e:t)}var ze=function rgbGamma(t){var o=gamma(t);function rgb(e,t){var n=o((e=color_rgb(e)).r,(t=color_rgb(t)).r),i=o(e.g,t.g),a=o(e.b,t.b),r=nogamma(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=r(t),e+""}}return rgb.gamma=rgbGamma,rgb}(1);function rgbSpline(s){return function(t){var e,n,i=t.length,a=new Array(i),r=new Array(i),o=new Array(i);for(e=0;e<i;++e)n=color_rgb(t[e]),a[e]=n.r||0,r[e]=n.g||0,o[e]=n.b||0;return a=s(a),r=s(r),o=s(o),n.opacity=1,function(t){return n.r=a(t),n.g=r(t),n.b=o(t),n+""}}}rgbSpline(function(o){var s=o.length-1;return function(t){var e=t<=0?t=0:1<=t?s-(t=1):Math.floor(t*s),n=o[e],i=o[e+1],a=0<e?o[e-1]:2*n-i,r=e<s-1?o[e+2]:2*i-n;return basis((t-e/s)*s,a,n,i,r)}}),rgbSpline(function(o){var s=o.length;return function(t){var e=Math.floor(((t%=1)<0?++t:t)*s),n=o[(e+s-1)%s],i=o[e%s],a=o[(e+1)%s],r=o[(e+2)%s];return basis((t-e/s)*s,n,i,a,r)}});var Xe=function(e,n){return n-=e=+e,function(t){return e+n*t}},Ie=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ee=new RegExp(Ie.source,"g");var Oe,Pe,Ye,Ne,Be=function(t,i){var e,n,a,r=Ie.lastIndex=Ee.lastIndex=0,o=-1,s=[],c=[];for(t+="",i+="";(e=Ie.exec(t))&&(n=Ee.exec(i));)(a=n.index)>r&&(a=i.slice(r,a),s[o]?s[o]+=a:s[++o]=a),(e=e[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,c.push({i:o,x:Xe(e,n)})),r=Ee.lastIndex;return r<i.length&&(a=i.slice(r),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?function one(e){return function(t){return e(t)+""}}(c[0].x):function string_zero(t){return function(){return t}}(i):(i=c.length,function(t){for(var e,n=0;n<i;++n)s[(e=c[n]).i]=e.x(t);return s.join("")})},He=function(t,e){var n,i=typeof e;return null==e||"boolean"===i?Re(e):("number"===i?Xe:"string"===i?(n=color_color(e))?(e=n,ze):Be:e instanceof color_color?ze:e instanceof Date?function(e,n){var i=new Date;return n-=e=+e,function(t){return i.setTime(e+n*t),i}}:Array.isArray(e)?function(t,e){var n,i=e?e.length:0,a=t?Math.min(i,t.length):0,r=new Array(a),o=new Array(i);for(n=0;n<a;++n)r[n]=He(t[n],e[n]);for(;n<i;++n)o[n]=e[n];return function(t){for(n=0;n<a;++n)o[n]=r[n](t);return o}}:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?function(t,e){var n,i={},a={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?i[n]=He(t[n],e[n]):a[n]=e[n];return function(t){for(n in i)a[n]=i[n](t);return a}}:Xe)(t,e)},Ve=function(e,n){return n-=e=+e,function(t){return Math.round(e+n*t)}},Ue=180/Math.PI,We={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Ge=function(t,e,n,i,a,r){var o,s,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*i)&&(n-=t*c,i-=e*c),(s=Math.sqrt(n*n+i*i))&&(n/=s,i/=s,c/=s),t*i<e*n&&(t=-t,e=-e,c=-c,o=-o),{translateX:a,translateY:r,rotate:Math.atan2(e,t)*Ue,skewX:Math.atan(c)*Ue,scaleX:o,scaleY:s}};function interpolateTransform(n,s,c,o){function pop(t){return t.length?t.pop()+" ":""}return function(t,e){var a=[],r=[];return t=n(t),e=n(e),function translate(t,e,n,i,a,r){if(t!==n||e!==i){var o=a.push("translate(",null,s,null,c);r.push({i:o-4,x:Xe(t,n)},{i:o-2,x:Xe(e,i)})}else(n||i)&&a.push("translate("+n+s+i+c)}(t.translateX,t.translateY,e.translateX,e.translateY,a,r),function rotate(t,e,n,i){t!==e?(180<t-e?e+=360:180<e-t&&(t+=360),i.push({i:n.push(pop(n)+"rotate(",null,o)-2,x:Xe(t,e)})):e&&n.push(pop(n)+"rotate("+e+o)}(t.rotate,e.rotate,a,r),function skewX(t,e,n,i){t!==e?i.push({i:n.push(pop(n)+"skewX(",null,o)-2,x:Xe(t,e)}):e&&n.push(pop(n)+"skewX("+e+o)}(t.skewX,e.skewX,a,r),function scale(t,e,n,i,a,r){if(t!==n||e!==i){var o=a.push(pop(a)+"scale(",null,",",null,")");r.push({i:o-4,x:Xe(t,n)},{i:o-2,x:Xe(e,i)})}else 1===n&&1===i||a.push(pop(a)+"scale("+n+","+i+")")}(t.scaleX,t.scaleY,e.scaleX,e.scaleY,a,r),t=e=null,function(t){for(var e,n=-1,i=r.length;++n<i;)a[(e=r[n]).i]=e.x(t);return a.join("")}}}var je=interpolateTransform(function parseCss(t){return"none"===t?We:(Oe||(Oe=document.createElement("DIV"),Pe=document.documentElement,Ye=document.defaultView),Oe.style.transform=t,t=Ye.getComputedStyle(Pe.appendChild(Oe),null).getPropertyValue("transform"),Pe.removeChild(Oe),t=t.slice(7,-1).split(","),Ge(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),qe=interpolateTransform(function parseSvg(t){return null==t?We:(Ne||(Ne=document.createElementNS("http://www.w3.org/2000/svg","g")),Ne.setAttribute("transform",t),(t=Ne.transform.baseVal.consolidate())?(t=t.matrix,Ge(t.a,t.b,t.c,t.d,t.e,t.f)):We)},", ",")",")"),Ze=Math.SQRT2;function zoom_cosh(t){return((t=Math.exp(t))+1/t)/2}var $e=function(t,e){var n,a,r=t[0],o=t[1],s=t[2],i=e[0],c=e[1],u=e[2],l=i-r,h=c-o,d=l*l+h*h;if(d<1e-12)a=Math.log(u/s)/Ze,n=function(t){return[r+t*l,o+t*h,s*Math.exp(Ze*t*a)]};else{var f=Math.sqrt(d),g=(u*u-s*s+4*d)/(2*s*2*f),p=(u*u-s*s-4*d)/(2*u*2*f),_=Math.log(Math.sqrt(g*g+1)-g),m=Math.log(Math.sqrt(p*p+1)-p);a=(m-_)/Ze,n=function(t){var e=t*a,n=zoom_cosh(_),i=s/(2*f)*(n*function tanh(t){return((t=Math.exp(2*t))-1)/(t+1)}(Ze*e+_)-function zoom_sinh(t){return((t=Math.exp(t))-1/t)/2}(_));return[r+i*l,o+i*h,s*n/zoom_cosh(Ze*e+_)]}}return n.duration=1e3*a,n};function hsl_hsl(o){return function(e,t){var n=o((e=hsl(e)).h,(t=hsl(t)).h),i=nogamma(e.s,t.s),a=nogamma(e.l,t.l),r=nogamma(e.opacity,t.opacity);return function(t){return e.h=n(t),e.s=i(t),e.l=a(t),e.opacity=r(t),e+""}}}hsl_hsl(color_hue),hsl_hsl(nogamma);function hcl_hcl(o){return function(e,t){var n=o((e=hcl(e)).h,(t=hcl(t)).h),i=nogamma(e.c,t.c),a=nogamma(e.l,t.l),r=nogamma(e.opacity,t.opacity);return function(t){return e.h=n(t),e.c=i(t),e.l=a(t),e.opacity=r(t),e+""}}}hcl_hcl(color_hue),hcl_hcl(nogamma);function src_cubehelix_cubehelix(s){return function cubehelixGamma(o){function cubehelix(e,t){var n=s((e=cubehelix_cubehelix(e)).h,(t=cubehelix_cubehelix(t)).h),i=nogamma(e.s,t.s),a=nogamma(e.l,t.l),r=nogamma(e.opacity,t.opacity);return function(t){return e.h=n(t),e.s=i(t),e.l=a(Math.pow(t,o)),e.opacity=r(t),e+""}}return o=+o,cubehelix.gamma=cubehelixGamma,cubehelix}(1)}src_cubehelix_cubehelix(color_hue),src_cubehelix_cubehelix(nogamma);function tweenValue(t,e,n){var i=t._id;return t.each(function(){var t=schedule_set(this,i);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return schedule_get(t,i).value[e]}}var Ke=function(t,e){var n;return("number"==typeof e?Xe:e instanceof color_color?ze:(n=color_color(e))?(e=n,ze):Be)(t,e)};var Je=u.prototype.constructor;function style_styleRemove(t){return function(){this.style.removeProperty(t)}}var Qe=0;function Transition(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function src_transition_transition(t){return u().transition(t)}function newId(){return++Qe}var tn=u.prototype;Transition.prototype=src_transition_transition.prototype={constructor:Transition,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=f(t));for(var i=this._groups,a=i.length,r=new Array(a),o=0;o<a;++o)for(var s,c,u=i[o],l=u.length,h=r[o]=new Array(l),d=0;d<l;++d)(s=u[d])&&(c=t.call(s,s.__data__,d,u))&&("__data__"in s&&(c.__data__=s.__data__),h[d]=c,te(h[d],e,n,d,h,schedule_get(s,n)));return new Transition(r,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=m(t));for(var i=this._groups,a=i.length,r=[],o=[],s=0;s<a;++s)for(var c,u=i[s],l=u.length,h=0;h<l;++h)if(c=u[h]){for(var d,f=t.call(c,c.__data__,h,u),g=schedule_get(c,n),p=0,_=f.length;p<_;++p)(d=f[p])&&te(d,e,n,p,f,g);r.push(f),o.push(c)}return new Transition(r,o,e,n)},filter:function(t){"function"!=typeof t&&(t=l(t));for(var e=this._groups,n=e.length,i=new Array(n),a=0;a<n;++a)for(var r,o=e[a],s=o.length,c=i[a]=[],u=0;u<s;++u)(r=o[u])&&t.call(r,r.__data__,u,o)&&c.push(r);return new Transition(i,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,a=n.length,r=Math.min(i,a),o=new Array(i),s=0;s<r;++s)for(var c,u=e[s],l=n[s],h=u.length,d=o[s]=new Array(h),f=0;f<h;++f)(c=u[f]||l[f])&&(d[f]=c);for(;s<i;++s)o[s]=e[s];return new Transition(o,this._parents,this._name,this._id)},selection:function(){return new Je(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=newId(),i=this._groups,a=i.length,r=0;r<a;++r)for(var o,s=i[r],c=s.length,u=0;u<c;++u)if(o=s[u]){var l=schedule_get(o,e);te(o,t,n,u,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new Transition(i,this._parents,t,n)},call:tn.call,nodes:tn.nodes,node:tn.node,size:tn.size,empty:tn.empty,each:tn.each,on:function(t,e){var n=this._id;return arguments.length<2?schedule_get(this.node(),n).on.on(t):this.each(function onFunction(n,i,a){var r,o,s=function on_start(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return 0<=e&&(t=t.slice(0,e)),!t||"start"===t})}(i)?schedule_init:schedule_set;return function(){var t=s(this,n),e=t.on;e!==r&&(o=(r=e).copy()).on(i,a),t.on=o}}(n,t,e))},attr:function(t,e){var n=a(t),i="transform"===n?qe:Ke;return this.attrTween(t,"function"==typeof e?(n.local?function attr_attrFunctionNS(i,a,r){var o,s,c;return function(){var t,e,n=r(this);if(null!=n)return(t=this.getAttributeNS(i.space,i.local))===(e=n+"")?null:t===o&&e===s?c:(s=e,c=a(o=t,n));this.removeAttributeNS(i.space,i.local)}}:function attr_attrFunction(i,a,r){var o,s,c;return function(){var t,e,n=r(this);if(null!=n)return(t=this.getAttribute(i))===(e=n+"")?null:t===o&&e===s?c:(s=e,c=a(o=t,n));this.removeAttribute(i)}})(n,i,tweenValue(this,"attr."+t,e)):null==e?(n.local?function attr_attrRemoveNS(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function attr_attrRemove(t){return function(){this.removeAttribute(t)}})(n):(n.local?function attr_attrConstantNS(e,n,i){var a,r,o=i+"";return function(){var t=this.getAttributeNS(e.space,e.local);return t===o?null:t===a?r:r=n(a=t,i)}}:function attr_attrConstant(e,n,i){var a,r,o=i+"";return function(){var t=this.getAttribute(e);return t===o?null:t===a?r:r=n(a=t,i)}})(n,i,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var i=a(t);return this.tween(n,(i.local?function attrTweenNS(e,n){var i,a;function tween(){var t=n.apply(this,arguments);return t!==a&&(i=(a=t)&&function attrInterpolateNS(e,n){return function(t){this.setAttributeNS(e.space,e.local,n(t))}}(e,t)),i}return tween._value=n,tween}:function attrTween(e,n){var i,a;function tween(){var t=n.apply(this,arguments);return t!==a&&(i=(a=t)&&function attrInterpolate(e,n){return function(t){this.setAttribute(e,n(t))}}(e,t)),i}return tween._value=n,tween})(i,e))},style:function(t,e,n){var i="transform"==(t+="")?je:Ke;return null==e?this.styleTween(t,function styleNull(n,i){var a,r,o;return function(){var t=styleValue(this,n),e=(this.style.removeProperty(n),styleValue(this,n));return t===e?null:t===a&&e===r?o:o=i(a=t,r=e)}}(t,i)).on("end.style."+t,style_styleRemove(t)):"function"==typeof e?this.styleTween(t,function style_styleFunction(i,a,r){var o,s,c;return function(){var t=styleValue(this,i),e=r(this),n=e+"";return null==e&&(this.style.removeProperty(i),n=e=styleValue(this,i)),t===n?null:t===o&&n===s?c:(s=n,c=a(o=t,e))}}(t,i,tweenValue(this,"style."+t,e))).each(function styleMaybeRemove(i,a){var r,o,s,c,u="style."+a,l="end."+u;return function(){var t=schedule_set(this,i),e=t.on,n=null==t.value[u]?c||(c=style_styleRemove(a)):undefined;e===r&&s===n||(o=(r=e).copy()).on(l,s=n),t.on=o}}(this._id,t)):this.styleTween(t,function style_styleConstant(e,n,i){var a,r,o=i+"";return function(){var t=styleValue(this,e);return t===o?null:t===a?r:r=n(a=t,i)}}(t,i,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!=typeof e)throw new Error;return this.tween(i,function styleTween(e,n,i){var a,r;function tween(){var t=n.apply(this,arguments);return t!==r&&(a=(r=t)&&function styleInterpolate(e,n,i){return function(t){this.style.setProperty(e,n(t),i)}}(e,t,i)),a}return tween._value=n,tween}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function text_textFunction(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(tweenValue(this,"text",t)):function text_textConstant(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",function removeFunction(n){return function(){var t=this.parentNode;for(var e in this.__transition)if(+e!==n)return;t&&t.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i,a=schedule_get(this.node(),n).tween,r=0,o=a.length;r<o;++r)if((i=a[r]).name===t)return i.value;return null}return this.each((null==e?function tweenRemove(a,r){var o,s;return function(){var t=schedule_set(this,a),e=t.tween;if(e!==o)for(var n=0,i=(s=o=e).length;n<i;++n)if(s[n].name===r){(s=s.slice()).splice(n,1);break}t.tween=s}}:function tweenFunction(r,o,s){var c,u;if("function"!=typeof s)throw new Error;return function(){var t=schedule_set(this,r),e=t.tween;if(e!==c){u=(c=e).slice();for(var n={name:o,value:s},i=0,a=u.length;i<a;++i)if(u[i].name===o){u[i]=n;break}i===a&&u.push(n)}t.tween=u}})(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function delayFunction(t,e){return function(){schedule_init(this,t).delay=+e.apply(this,arguments)}}:function delayConstant(t,e){return e=+e,function(){schedule_init(this,t).delay=e}})(e,t)):schedule_get(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function durationFunction(t,e){return function(){schedule_set(this,t).duration=+e.apply(this,arguments)}}:function durationConstant(t,e){return e=+e,function(){schedule_set(this,t).duration=e}})(e,t)):schedule_get(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function easeConstant(t,e){if("function"!=typeof e)throw new Error;return function(){schedule_set(this,t).ease=e}}(e,t)):schedule_get(this.node(),e).ease},end:function(){var a,r,o=this,s=o._id,c=o.size();return new Promise(function(t,e){var n={value:e},i={value:function(){0==--c&&t()}};o.each(function(){var t=schedule_set(this,s),e=t.on;e!==a&&((r=(a=e).copy())._.cancel.push(n),r._.interrupt.push(n),r._.end.push(i)),t.on=r})})}};(function custom(e){function polyIn(t){return Math.pow(t,e)}return e=+e,polyIn.exponent=custom,polyIn})(3),function custom(e){function polyOut(t){return 1-Math.pow(1-t,e)}return e=+e,polyOut.exponent=custom,polyOut}(3),function custom(e){function polyInOut(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,polyInOut.exponent=custom,polyInOut}(3),Math.PI;var en=1.70158,nn=(function custom(e){function backIn(t){return t*t*((e+1)*t-e)}return e=+e,backIn.overshoot=custom,backIn}(en),function custom(e){function backOut(t){return--t*t*((e+1)*t+e)+1}return e=+e,backOut.overshoot=custom,backOut}(en),function custom(e){function backInOut(t){return((t*=2)<1?t*t*((e+1)*t-e):(t-=2)*t*((e+1)*t+e)+2)/2}return e=+e,backInOut.overshoot=custom,backInOut}(en),2*Math.PI),an=(function custom(e,n){var i=Math.asin(1/(e=Math.max(1,e)))*(n/=nn);function elasticIn(t){return e*Math.pow(2,10*--t)*Math.sin((i-t)/n)}return elasticIn.amplitude=function(t){return custom(t,n*nn)},elasticIn.period=function(t){return custom(e,t)},elasticIn}(1,.3),function custom(e,n){var i=Math.asin(1/(e=Math.max(1,e)))*(n/=nn);function elasticOut(t){return 1-e*Math.pow(2,-10*(t=+t))*Math.sin((t+i)/n)}return elasticOut.amplitude=function(t){return custom(t,n*nn)},elasticOut.period=function(t){return custom(e,t)},elasticOut}(1,.3),function custom(e,n){var i=Math.asin(1/(e=Math.max(1,e)))*(n/=nn);function elasticInOut(t){return((t=2*t-1)<0?e*Math.pow(2,10*t)*Math.sin((i-t)/n):2-e*Math.pow(2,-10*t)*Math.sin((i+t)/n))/2}return elasticInOut.amplitude=function(t){return custom(t,n*nn)},elasticInOut.period=function(t){return custom(e,t)},elasticInOut}(1,.3),{time:null,delay:0,duration:250,ease:function cubicInOut(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}});function transition_inherit(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))return an.time=now(),an;return n}u.prototype.interrupt=function(t){return this.each(function(){ee(this,t)})},u.prototype.transition=function(t){var e,n;t=t instanceof Transition?(e=t._id,t._name):(e=newId(),(n=an).time=now(),null==t?null:t+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var o,s=i[r],c=s.length,u=0;u<c;++u)(o=s[u])&&te(o,t,e,u,s,n||transition_inherit(o,e));return new Transition(i,this._parents,t,e)};var rn=Array.prototype.slice,on=function(t){return t},sn=1,cn=2,un=3,ln=4,hn=1e-6;function translateX(t){return"translate("+(t+.5)+",0)"}function translateY(t){return"translate(0,"+(t+.5)+")"}function entering(){return!this.__axis}function axis_axis(p,_){var m=[],x=null,y=null,v=6,b=6,T=3,w=p===sn||p===ln?-1:1,A=p===ln||p===cn?"x":"y",k=p===sn||p===un?translateX:translateY;function axis(t){var e=null==x?_.ticks?_.ticks.apply(_,m):_.domain():x,n=null==y?_.tickFormat?_.tickFormat.apply(_,m):on:y,i=Math.max(v,0)+T,a=_.range(),r=+a[0]+.5,o=+a[a.length-1]+.5,s=(_.bandwidth?function axis_center(e){var n=Math.max(0,e.bandwidth()-1)/2;return e.round()&&(n=Math.round(n)),function(t){return+e(t)+n}}:function axis_number(e){return function(t){return+e(t)}})(_.copy()),c=t.selection?t.selection():t,u=c.selectAll(".domain").data([null]),l=c.selectAll(".tick").data(e,_).order(),h=l.exit(),d=l.enter().append("g").attr("class","tick"),f=l.select("line"),g=l.select("text");u=u.merge(u.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),l=l.merge(d),f=f.merge(d.append("line").attr("stroke","currentColor").attr(A+"2",w*v)),g=g.merge(d.append("text").attr("fill","currentColor").attr(A,w*i).attr("dy",p===sn?"0em":p===un?"0.71em":"0.32em")),t!==c&&(u=u.transition(t),l=l.transition(t),f=f.transition(t),g=g.transition(t),h=h.transition(t).attr("opacity",hn).attr("transform",function(t){return isFinite(t=s(t))?k(t):this.getAttribute("transform")}),d.attr("opacity",hn).attr("transform",function(t){var e=this.parentNode.__axis;return k(e&&isFinite(e=e(t))?e:s(t))})),h.remove(),u.attr("d",p===ln||p==cn?b?"M"+w*b+","+r+"H0.5V"+o+"H"+w*b:"M0.5,"+r+"V"+o:b?"M"+r+","+w*b+"V0.5H"+o+"V"+w*b:"M"+r+",0.5H"+o),l.attr("opacity",1).attr("transform",function(t){return k(s(t))}),f.attr(A+"2",w*v),g.attr(A,w*i).text(n),c.filter(entering).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",p===cn?"start":p===ln?"end":"middle"),c.each(function(){this.__axis=s})}return axis.scale=function(t){return arguments.length?(_=t,axis):_},axis.ticks=function(){return m=rn.call(arguments),axis},axis.tickArguments=function(t){return arguments.length?(m=null==t?[]:rn.call(t),axis):m.slice()},axis.tickValues=function(t){return arguments.length?(x=null==t?null:rn.call(t),axis):x&&x.slice()},axis.tickFormat=function(t){return arguments.length?(y=t,axis):y},axis.tickSize=function(t){return arguments.length?(v=b=+t,axis):v},axis.tickSizeInner=function(t){return arguments.length?(v=+t,axis):v},axis.tickSizeOuter=function(t){return arguments.length?(b=+t,axis):b},axis.tickPadding=function(t){return arguments.length?(T=+t,axis):T},axis}function axisTop(t){return axis_axis(sn,t)}function axisRight(t){return axis_axis(cn,t)}function axisBottom(t){return axis_axis(un,t)}function axisLeft(t){return axis_axis(ln,t)}var dn={arc:"bb-arc",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",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",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",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",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",region:"bb-region",regions:"bb-regions",selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",shape:"bb-shape",shapes:"bb-shapes",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",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids",zoomBrush:"bb-zoom-brush",zoomRect:"bb-zoom-rect",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"},fn=n(6),gn=n.n(fn),pn=n(10),_n=n.n(pn);function nopropagation(){E.stopImmediatePropagation()}var mn=function(){E.preventDefault(),E.stopImmediatePropagation()},xn=function(t){var e=t.document.documentElement,n=O(t).on("dragstart.drag",mn,!0);"onselectstart"in e?n.on("selectstart.drag",mn,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")};function yesdrag(t,e){var n=t.document.documentElement,i=O(t).on("dragstart.drag",null);e&&(i.on("click.drag",mn,!0),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var yn=function(t){return function(){return t}};function DragEvent(t,e,n,i,a,r,o,s,c,u){this.target=t,this.type=e,this.subject=n,this.identifier=i,this.active=a,this.x=r,this.y=o,this.dx=s,this.dy=c,this._=u}function defaultFilter(){return!E.button}function defaultContainer(){return this.parentNode}function defaultSubject(t){return null==t?{x:E.x,y:E.y}:t}function defaultTouchable(){return"ontouchstart"in this}DragEvent.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var vn=function(){var n,i,a,r,o=defaultFilter,s=defaultContainer,e=defaultSubject,c=defaultTouchable,f={},g=Yt("start","drag","end"),p=0,u=0;function drag(t){t.on("mousedown.drag",mousedowned).filter(c).on("touchstart.drag",touchstarted).on("touchmove.drag",touchmoved).on("touchend.drag touchcancel.drag",touchended).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function mousedowned(){if(!r&&o.apply(this,arguments)){var t=beforestart("mouse",s.apply(this,arguments),P,this,arguments);t&&(O(E.view).on("mousemove.drag",mousemoved,!0).on("mouseup.drag",mouseupped,!0),xn(E.view),nopropagation(),a=!1,n=E.clientX,i=E.clientY,t("start"))}}function mousemoved(){if(mn(),!a){var t=E.clientX-n,e=E.clientY-i;a=u<t*t+e*e}f.mouse("drag")}function mouseupped(){O(E.view).on("mousemove.drag mouseup.drag",null),yesdrag(E.view,a),mn(),f.mouse("end")}function touchstarted(){if(o.apply(this,arguments)){var t,e,n=E.changedTouches,i=s.apply(this,arguments),a=n.length;for(t=0;t<a;++t)(e=beforestart(n[t].identifier,i,y,this,arguments))&&(nopropagation(),e("start"))}}function touchmoved(){var t,e,n=E.changedTouches,i=n.length;for(t=0;t<i;++t)(e=f[n[t].identifier])&&(mn(),e("drag"))}function touchended(){var t,e,n=E.changedTouches,i=n.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<i;++t)(e=f[n[t].identifier])&&(nopropagation(),e("end"))}function beforestart(i,a,r,o,s){var c,u,l,h=r(a,i),d=g.copy();if(customEvent(new DragEvent(drag,"beforestart",c,i,p,h[0],h[1],0,0,d),function(){return null!=(E.subject=c=e.apply(o,s))&&(u=c.x-h[0]||0,l=c.y-h[1]||0,!0)}))return function gesture(t){var e,n=h;switch(t){case"start":f[i]=gesture,e=p++;break;case"end":delete f[i],--p;case"drag":h=r(a,i),e=p}customEvent(new DragEvent(drag,t,c,i,e,h[0]+u,h[1]+l,h[0]-n[0],h[1]-n[1],d),d.apply,d,[t,o,s])}}return drag.filter=function(t){return arguments.length?(o="function"==typeof t?t:yn(!!t),drag):o},drag.container=function(t){return arguments.length?(s="function"==typeof t?t:yn(t),drag):s},drag.subject=function(t){return arguments.length?(e="function"==typeof t?t:yn(t),drag):e},drag.touchable=function(t){return arguments.length?(c="function"==typeof t?t:yn(!!t),drag):c},drag.on=function(){var t=g.on.apply(g,arguments);return t===g?drag:t},drag.clickDistance=function(t){return arguments.length?(u=(t=+t)*t,drag):Math.sqrt(u)},drag},bn=function(t){return function(){return t}},Tn=function(t,e,n){this.target=t,this.type=e,this.selection=n};function noevent_nopropagation(){E.stopImmediatePropagation()}var wn=function(){E.preventDefault(),E.stopImmediatePropagation()},An={name:"drag"},kn={name:"space"},Cn={name:"handle"},Sn={name:"center"},Mn={name:"x",handles:["e","w"].map(brush_type),input:function(t,e){return t&&[[t[0],e[0][1]],[t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Ln={name:"y",handles:["n","s"].map(brush_type),input:function(t,e){return t&&[[e[0][0],t[0]],[e[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Dn=(["n","e","s","w","nw","ne","se","sw"].map(brush_type),{overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"}),Fn={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Rn={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},zn={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Xn={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function brush_type(t){return{type:t}}function brush_defaultFilter(){return!E.button}function defaultExtent(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function brush_local(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function brush_empty(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function brush_brush(R){var z,e=defaultExtent,X=brush_defaultFilter,n=Yt(brush,"start","brush","end"),i=6;function brush(t){var e=t.property("__brush",initialize).selectAll(".overlay").data([brush_type("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Dn.overlay).merge(e).each(function(){var t=brush_local(this).extent;O(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),t.selectAll(".selection").data([brush_type("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Dn.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var n=t.selectAll(".handle").data(R.handles,function(t){return t.type});n.exit().remove(),n.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return Dn[t.type]}),t.each(redraw).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",started)}function redraw(){var t=O(this),e=brush_local(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?e[1][0]-i/2:e[0][0]-i/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-i/2:e[0][1]-i/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+i:i}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+i:i})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function emitter(t,e){return t.__brush.emitter||new Emitter(t,e)}function Emitter(t,e){this.that=t,this.args=e,this.state=t.__brush,this.active=0}function started(){if(E.touches){if(E.changedTouches.length<E.touches.length)return wn()}else if(z)return;if(X.apply(this,arguments)){var e,n,i,a,r,o,s,c,u,l,h,d,f,g=this,p=E.target.__data__.type,_="selection"===(E.metaKey?p="overlay":p)?An:E.altKey?Sn:Cn,m=R===Ln?null:zn[p],x=R===Mn?null:Xn[p],y=brush_local(g),t=y.extent,v=y.selection,b=t[0][0],T=t[0][1],w=t[1][0],A=t[1][1],k=m&&x&&E.shiftKey,C=P(g),S=C,M=emitter(g,arguments).beforestart();"overlay"===p?y.selection=v=[[e=R===Ln?b:C[0],i=R===Mn?T:C[1]],[r=R===Ln?w:e,s=R===Mn?A:i]]:(e=v[0][0],i=v[0][1],r=v[1][0],s=v[1][1]),n=e,a=i,o=r,c=s;var L=O(g).attr("pointer-events","none"),D=L.selectAll(".overlay").attr("cursor",Dn[p]);if(E.touches)L.on("touchmove.brush",moved,!0).on("touchend.brush touchcancel.brush",ended,!0);else{var F=O(E.view).on("keydown.brush",function keydowned(){switch(E.keyCode){case 16:k=m&&x;break;case 18:_===Cn&&(m&&(r=o-u*m,e=n+u*m),x&&(s=c-l*x,i=a+l*x),_=Sn,move());break;case 32:_!==Cn&&_!==Sn||(m<0?r=o-u:0<m&&(e=n-u),x<0?s=c-l:0<x&&(i=a-l),_=kn,D.attr("cursor",Dn.selection),move());break;default:return}wn()},!0).on("keyup.brush",function keyupped(){switch(E.keyCode){case 16:k&&(d=f=k=!1,move());break;case 18:_===Sn&&(m<0?r=o:0<m&&(e=n),x<0?s=c:0<x&&(i=a),_=Cn,move());break;case 32:_===kn&&(_=E.altKey?(m&&(r=o-u*m,e=n+u*m),x&&(s=c-l*x,i=a+l*x),Sn):(m<0?r=o:0<m&&(e=n),x<0?s=c:0<x&&(i=a),Cn),D.attr("cursor",Dn[p]),move());break;default:return}wn()},!0).on("mousemove.brush",moved,!0).on("mouseup.brush",ended,!0);xn(E.view)}noevent_nopropagation(),ee(g),redraw.call(g),M.start()}function moved(){var t=P(g);!k||d||f||(Math.abs(t[0]-S[0])>Math.abs(t[1]-S[1])?f=!0:d=!0),S=t,h=!0,wn(),move()}function move(){var t;switch(u=S[0]-C[0],l=S[1]-C[1],_){case kn:case An:m&&(u=Math.max(b-e,Math.min(w-r,u)),n=e+u,o=r+u),x&&(l=Math.max(T-i,Math.min(A-s,l)),a=i+l,c=s+l);break;case Cn:m<0?(u=Math.max(b-e,Math.min(w-e,u)),n=e+u,o=r):0<m&&(u=Math.max(b-r,Math.min(w-r,u)),n=e,o=r+u),x<0?(l=Math.max(T-i,Math.min(A-i,l)),a=i+l,c=s):0<x&&(l=Math.max(T-s,Math.min(A-s,l)),a=i,c=s+l);break;case Sn:m&&(n=Math.max(b,Math.min(w,e-u*m)),o=Math.max(b,Math.min(w,r+u*m))),x&&(a=Math.max(T,Math.min(A,i-l*x)),c=Math.max(T,Math.min(A,s+l*x)))}o<n&&(m*=-1,t=e,e=r,r=t,t=n,n=o,o=t,p in Fn&&D.attr("cursor",Dn[p=Fn[p]])),c<a&&(x*=-1,t=i,i=s,s=t,t=a,a=c,c=t,p in Rn&&D.attr("cursor",Dn[p=Rn[p]])),y.selection&&(v=y.selection),d&&(n=v[0][0],o=v[1][0]),f&&(a=v[0][1],c=v[1][1]),v[0][0]===n&&v[0][1]===a&&v[1][0]===o&&v[1][1]===c||(y.selection=[[n,a],[o,c]],redraw.call(g),M.brush())}function ended(){if(noevent_nopropagation(),E.touches){if(E.touches.length)return;z&&clearTimeout(z),z=setTimeout(function(){z=null},500),L.on("touchmove.brush touchend.brush touchcancel.brush",null)}else yesdrag(E.view,h),F.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);L.attr("pointer-events","all"),D.attr("cursor",Dn.overlay),y.selection&&(v=y.selection),brush_empty(v)&&(y.selection=null,redraw.call(g)),M.end()}}function initialize(){var t=this.__brush||{selection:null};return t.extent=e.apply(this,arguments),t.dim=R,t}return brush.move=function(t,o){t.selection?t.on("start.brush",function(){emitter(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){emitter(this,arguments).end()}).tween("brush",function(){var e=this,n=e.__brush,i=emitter(e,arguments),t=n.selection,a=R.input("function"==typeof o?o.apply(this,arguments):o,n.extent),r=He(t,a);function tween(t){n.selection=1===t&&brush_empty(a)?null:r(t),redraw.call(e),i.brush()}return t&&a?tween:tween(1)}):t.each(function(){var t=this,e=arguments,n=t.__brush,i=R.input("function"==typeof o?o.apply(t,e):o,n.extent),a=emitter(t,e).beforestart();ee(t),n.selection=null==i||brush_empty(i)?null:i,redraw.call(t),a.start().brush().end()})},Emitter.prototype={beforestart:function(){return 1==++this.active&&((this.state.emitter=this).starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(t){customEvent(new Tn(brush,t,R.output(this.state.selection)),n.apply,n,[t,this.that,this.args])}},brush.extent=function(t){return arguments.length?(e="function"==typeof t?t:bn([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),brush):e},brush.filter=function(t){return arguments.length?(X="function"==typeof t?t:bn(!!t),brush):X},brush.handleSize=function(t){return arguments.length?(i=+t,brush):i},brush.on=function(){var t=n.on.apply(n,arguments);return t===n?brush:t},brush}var In=function(t){return t||0===t},En=function(t){return"function"==typeof t},On=function(t){return"string"==typeof t},Pn=function(t){return"number"==typeof t},Yn=function(t){return void 0===t},Nn=function(t){return void 0!==t},Bn=function(t){return"boolean"==typeof t},Hn=function(t){return 10*Math.ceil(t/10)},Vn=function(t){return Math.ceil(t)+.5},Un=function(t){return t[1]-t[0]},Wn=function(t){return"object"===_n()(t)},Gn=function(t){return Yn(t)||null===t||On(t)&&0===t.length||Wn(t)&&!(t instanceof Date)&&0===Object.keys(t).length||Pn(t)&&isNaN(t)},jn=function(t){return!Gn(t)},qn=function(t){return t&&t.constructor===Array},Zn=function(t){return t&&!t.nodeType&&Wn(t)&&!qn(t)},$n=function(t,e,n){return Nn(t[e])?t[e]:n},Kn=function(t){for(var e=En(t),n=arguments.length,i=Array(1<n?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return e&&t.call.apply(t,i),e},Jn=function(t){return On(t)?t.replace(/</g,"&lt;").replace(/>/g,"&gt;"):t},Qn=function(t){var e=t.getBBox(),n=e.x,i=e.y,a=e.width,r=e.height;return[{x:n,y:i+r},{x:n,y:i},{x:n+a,y:i},{x:n+a,y:i+r}]},ti=function(t){var e=null,n=E,i=t.context||t.main;return n&&"BrushEvent"===n.constructor.name?e=n.selection:i&&(e=i.select(".".concat(dn.brush)).node())&&(e=function brushSelection(t){var e=t.__brush;return e?e.dim.output(e.selection):null}(e)),e},ei=function(){var t=!(0<arguments.length&&arguments[0]!==undefined)||arguments[0];return Math.random()+(t?"":0)},ni=function(t){var e=ti(t);return!e||e[0]===e[1]},ii=function(){var t=0<arguments.length&&arguments[0]!==undefined?arguments[0]:{},e=1<arguments.length?arguments[1]:undefined;for(var n in e)t[n]=e[n];return t},ai=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},ri=function(t){return[].slice.call(t)},oi=function(t){return t&&t.length?t.reduce(function(t,e){return t.concat(e)}):[]},si=function(t){var e,n=!(1<arguments.length&&arguments[1]!==undefined)||arguments[1];return t[0]instanceof Date?e=n?function(t,e){return t-e}:function(t,e){return e-t}:!n&&(e=function(t,e){return(e<t?-1:t<e&&1)||t===e&&0}),t.concat().sort(e)},ci=function(t,e){var n=e.filter(function(t){return jn(t)});return n.length?Pn(n[0])?n=Math[t].apply(Math,gn()(n)):n[0]instanceof Date&&(n=si(n,"min"===t)[0]):n=undefined,n},ui=function(t,e){for(var n=[],i=t;i<e;i++)n.push(i);return n},li={mouse:function(){try{return new MouseEvent("t"),function(t,e){var n=2<arguments.length&&arguments[2]!==undefined?arguments[2]:{bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0};t.dispatchEvent(new MouseEvent(e,n))}}catch(t){return function(t,e){var n=2<arguments.length&&arguments[2]!==undefined?arguments[2]:{bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0},i=document.createEvent("MouseEvent");i.initMouseEvent(e,n.bubbles,n.cancelable,window,0,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),t.dispatchEvent(i)}}}(),touch:function touch(t,e,n){var i=new Touch(Object.assign({identifier:Date.now(),target:t,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));t.dispatchEvent(new TouchEvent(e,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[i],targetTouches:[],changedTouches:[i]}))}},hi=function(t,e){return t<e?-1:e<t?1:e<=t?0:NaN},di=function(r){return 1===r.length&&(r=function ascendingComparator(n){return function(t,e){return hi(n(t),e)}}(r)),{left:function(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n<i;){var a=n+i>>>1;r(t[a],e)<0?n=a+1:i=a}return n},right:function(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n<i;){var a=n+i>>>1;0<r(t[a],e)?i=a:n=a+1}return n}}};var fi=di(hi),gi=fi.right,pi=(fi.left,gi);var _i=Array.prototype,mi=(_i.slice,_i.map,Math.sqrt(50)),xi=Math.sqrt(10),yi=Math.sqrt(2),vi=function(t,e,n){var i,a,r,o,s=-1;if(n=+n,(t=+t)===(e=+e)&&0<n)return[t];if((i=e<t)&&(a=t,t=e,e=a),0===(o=tickIncrement(t,e,n))||!isFinite(o))return[];if(0<o)for(t=Math.ceil(t/o),e=Math.floor(e/o),r=new Array(a=Math.ceil(e-t+1));++s<a;)r[s]=(t+s)*o;else for(t=Math.floor(t*o),e=Math.ceil(e*o),r=new Array(a=Math.ceil(t-e+1));++s<a;)r[s]=(t-s)/o;return i&&r.reverse(),r};function tickIncrement(t,e,n){var i=(e-t)/Math.max(0,n),a=Math.floor(Math.log(i)/Math.LN10),r=i/Math.pow(10,a);return 0<=a?(mi<=r?10:xi<=r?5:yi<=r?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(mi<=r?10:xi<=r?5:yi<=r?2:1)}function tickStep(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),a=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),r=i/a;return mi<=r?a*=10:xi<=r?a*=5:yi<=r&&(a*=2),e<t?-a:a}function initRange(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}var bi="$";function Map(){}function map_map(t,e){var n=new Map;if(t instanceof Map)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var i,a=-1,r=t.length;if(null==e)for(;++a<r;)n.set(a,t[a]);else for(;++a<r;)n.set(e(i=t[a],a,t),i)}else if(t)for(var o in t)n.set(o,t[o]);return n}Map.prototype=map_map.prototype={constructor:Map,has:function(t){return bi+t in this},get:function(t){return this[bi+t]},set:function(t,e){return this[bi+t]=e,this},remove:function(t){var e=bi+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===bi&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===bi&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===bi&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===bi&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===bi&&++t;return t},empty:function(){for(var t in this)if(t[0]===bi)return!1;return!0},each:function(t){for(var e in this)e[0]===bi&&t(this[e],e.slice(1),this)}};var Ti=map_map;function Set(){}var wi=Ti.prototype;Set.prototype={constructor:Set,has:wi.has,add:function(t){return this[bi+(t+="")]=t,this},remove:wi.remove,clear:wi.clear,values:wi.keys,size:wi.size,empty:wi.empty,each:wi.each};var Ai=Array.prototype,ki=Ai.map,Ci=Ai.slice,Si={name:"implicit"};function ordinal(){var r=Ti(),o=[],i=[],a=Si;function scale(t){var e=t+"",n=r.get(e);if(!n){if(a!==Si)return a;r.set(e,n=o.push(t))}return i[(n-1)%i.length]}return scale.domain=function(t){if(!arguments.length)return o.slice();o=[],r=Ti();for(var e,n,i=-1,a=t.length;++i<a;)r.has(n=(e=t[i])+"")||r.set(n,o.push(e));return scale},scale.range=function(t){return arguments.length?(i=Ci.call(t),scale):i.slice()},scale.unknown=function(t){return arguments.length?(a=t,scale):a},scale.copy=function(){return ordinal(o,i).unknown(a)},initRange.apply(scale,arguments),scale}var Mi=function(t){return function(){return t}},Li=function(t){return+t},Di=[0,1];function continuous_identity(t){return t}function normalize(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:Mi(isNaN(n)?NaN:.5)}function clamper(t){var e,n=t[0],i=t[t.length-1];return i<n&&(e=n,n=i,i=e),function(t){return Math.max(n,Math.min(i,t))}}function bimap(t,e,n){var i=t[0],a=t[1],r=e[0],o=e[1];return r=a<i?(i=normalize(a,i),n(o,r)):(i=normalize(i,a),n(r,o)),function(t){return r(i(t))}}function polymap(n,t,e){var i=Math.min(n.length,t.length)-1,a=new Array(i),r=new Array(i),o=-1;for(n[i]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<i;)a[o]=normalize(n[o],n[o+1]),r[o]=e(t[o],t[o+1]);return function(t){var e=pi(n,t,1,i)-1;return r[e](a[e](t))}}function copy(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function transformer(){var n,i,e,a,r,o,s=Di,c=Di,u=He,l=continuous_identity;function rescale(){return a=2<Math.min(s.length,c.length)?polymap:bimap,r=o=null,scale}function scale(t){return isNaN(t=+t)?e:(r||(r=a(s.map(n),c,u)))(n(l(t)))}return scale.invert=function(t){return l(i((o||(o=a(c,s.map(n),Xe)))(t)))},scale.domain=function(t){return arguments.length?(s=ki.call(t,Li),l===continuous_identity||(l=clamper(s)),rescale()):s.slice()},scale.range=function(t){return arguments.length?(c=Ci.call(t),rescale()):c.slice()},scale.rangeRound=function(t){return c=Ci.call(t),u=Ve,rescale()},scale.clamp=function(t){return arguments.length?(l=t?clamper(s):continuous_identity,scale):l!==continuous_identity},scale.interpolate=function(t){return arguments.length?(u=t,rescale()):u},scale.unknown=function(t){return arguments.length?(e=t,scale):e},function(t,e){return n=t,i=e,rescale()}}function continuous(t,e){return transformer()(t,e)}var Fi=function(t,e,n,i){var a,r,o,s,c,u,l=tickStep(t,e,n);switch((i=formatSpecifier(null==i?",f":i)).type){case"s":var h=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN((c=l,u=h,a=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(yt(u)/3)))-yt(Math.abs(c)))))||(i.precision=a),At(i,h);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN((o=l,s=Math.max(Math.abs(t),Math.abs(e)),o=Math.abs(o),s=Math.abs(s)-o,a=Math.max(0,yt(s)-yt(o))+1))||(i.precision=a-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN((r=l,a=Math.max(0,-yt(Math.abs(r)))))||(i.precision=a-2*("%"===i.type))}return wt(i)};function linearish(s){var c=s.domain;return s.ticks=function(t){var e=c();return vi(e[0],e[e.length-1],null==t?10:t)},s.tickFormat=function(t,e){var n=c();return Fi(n[0],n[n.length-1],null==t?10:t,e)},s.nice=function(t){null==t&&(t=10);var e,n=c(),i=0,a=n.length-1,r=n[i],o=n[a];return o<r&&(e=r,r=o,o=e,e=i,i=a,a=e),0<(e=tickIncrement(r,o,t))?e=tickIncrement(r=Math.floor(r/e)*e,o=Math.ceil(o/e)*e,t):e<0&&(e=tickIncrement(r=Math.ceil(r*e)/e,o=Math.floor(o*e)/e,t)),0<e?(n[i]=Math.floor(r/e)*e,n[a]=Math.ceil(o/e)*e,c(n)):e<0&&(n[i]=Math.ceil(r*e)/e,n[a]=Math.floor(o*e)/e,c(n)),s},s}function src_linear_linear(){var t=continuous(continuous_identity,continuous_identity);return t.copy=function(){return copy(t,src_linear_linear())},initRange.apply(t,arguments),linearish(t)}var Ri=function(t,e){var n,i=0,a=(t=t.slice()).length-1,r=t[i],o=t[a];return o<r&&(n=i,i=a,a=n,n=r,r=o,o=n),t[i]=e.floor(r),t[a]=e.ceil(o),t};var zi=1e3,Xi=60*zi,Ii=60*Xi,Ei=24*Ii,Oi=7*Ei,Pi=30*Ei,Yi=365*Ei;function time_date(t){return new Date(t)}function time_number(t){return t instanceof Date?+t:+new Date(+t)}function calendar(o,e,n,i,a,r,s,c,u){var l=continuous(continuous_identity,continuous_identity),h=l.invert,d=l.domain,f=u(".%L"),g=u(":%S"),p=u("%I:%M"),_=u("%I %p"),m=u("%a %d"),x=u("%b %d"),y=u("%B"),v=u("%Y"),b=[[s,1,zi],[s,5,5*zi],[s,15,15*zi],[s,30,30*zi],[r,1,Xi],[r,5,5*Xi],[r,15,15*Xi],[r,30,30*Xi],[a,1,Ii],[a,3,3*Ii],[a,6,6*Ii],[a,12,12*Ii],[i,1,Ei],[i,2,2*Ei],[n,1,Oi],[e,1,Pi],[e,3,3*Pi],[o,1,Yi]];function tickFormat(t){return(s(t)<t?f:r(t)<t?g:a(t)<t?p:i(t)<t?_:e(t)<t?n(t)<t?m:x:o(t)<t?y:v)(t)}function tickInterval(t,e,n,i){if(null==t&&(t=10),"number"==typeof t){var a=Math.abs(n-e)/t,r=di(function(t){return t[2]}).right(b,a);t=r===b.length?(i=tickStep(e/Yi,n/Yi,t),o):r?(i=(r=b[a/b[r-1][2]<b[r][2]/a?r-1:r])[1],r[0]):(i=Math.max(tickStep(e,n,t),1),c)}return null==i?t:t.every(i)}return l.invert=function(t){return new Date(h(t))},l.domain=function(t){return arguments.length?d(ki.call(t,time_number)):d().map(time_date)},l.ticks=function(t,e){var n,i=d(),a=i[0],r=i[i.length-1],o=r<a;return o&&(n=a,a=r,r=n),n=(n=tickInterval(t,a,r,e))?n.range(a,r+1):[],o?n.reverse():n},l.tickFormat=function(t,e){return null==e?tickFormat:u(e)},l.nice=function(t,e){var n=d();return(t=tickInterval(t,n[0],n[n.length-1],e))?d(Ri(n,t)):l},l.copy=function(){return copy(l,calendar(o,e,n,i,a,r,s,c,u))},l}var Ni=function(){function AxisRendererHelper(t,e){Ft()(this,AxisRendererHelper);var n=src_linear_linear();this.config=t,this.scale=n,e.config.transition_duration||(t.noTransition=!0),t.range=n.rangeExtent?n.rangeExtent():this.scaleExtent((e.orgXScale||n).range())}return It()(AxisRendererHelper,[{key:"axisX",value:function axisX(t,e){var n=this.config.tickOffset;t.attr("transform",function(t){return"translate(".concat(Math.ceil(e(t)+n),", 0)")})}},{key:"axisY",value:function axisY(t,e){t.attr("transform",function(t){return"translate(0,".concat(Math.ceil(e(t)),")")})}},{key:"scaleExtent",value:function scaleExtent(t){var e=t[0],n=t[t.length-1];return e<n?[e,n]:[n,e]}},{key:"generateTicks",value:function generateTicks(t){var e=[];if(t.ticks)return t.ticks.apply(t,gn()(this.config.tickArguments||[])).map(function(t){return On(t)&&Pn(t)&&!isNaN(t)&&Math.round(10*t)/10||t});for(var n=t.domain(),i=Math.ceil(n[0]);i<n[1];i++)e.push(i);return 0<e.length&&0<e[0]&&e.unshift(e[0]-(e[1]-e[0])),e}},{key:"copyScale",value:function copyScale(){var t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t}},{key:"textFormatted",value:function textFormatted(t){var e=this.config.tickFormat,n=/\d+\.\d+0{5,}\d$/.test(t)?+(t+"").replace(/0+\d$/,""):t,i=e?e(n):n;return Nn(i)?i:""}},{key:"transitionise",value:function transitionise(t){var e=this.config;return e.noTransition?t.interrupt():t.transition(e.transition)}}],[{key:"getSizeFor1Char",value:function getSizeFor1Char(t){var r={w:5.5,h:11.5};return t.empty()||t.select("text").text("0").call(function(t){try{var e=t.node().getBBox(),n=e.width,i=e.height;n&&i&&(r.w=n,r.h=i),t.text("")}catch(a){}}),this.getSizeFor1Char=function(){return r},r}}]),AxisRendererHelper}(),Bi=function(){function AxisRenderer(){var t=0<arguments.length&&arguments[0]!==undefined?arguments[0]:{};Ft()(this,AxisRenderer);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.helper=new Ni(e,t),this.config=e,this.params=t}return It()(AxisRenderer,[{key:"create",value:function create(t){var _=this,m=this.config,x=this.params,y=this.helper,v=y.scale,b=m.orient,T=this.splitTickText.bind(this),w=/^(left|right)$/.test(b),A=/^(top|bottom)$/.test(b),k=y[A?"axisX":"axisY"],C=k===y.axisX?"y":"x",S=/^(top|left)$/.test(b)?-1:1,M=x.tickTextRotate;this.config.range=v.rangeExtent?v.rangeExtent():y.scaleExtent((x.orgXScale||v).range());var e=m,L=e.innerTickSize,D=e.tickLength,F=e.range,n=x.name,R=n&&/^(x|y|y2)$/.test(n)?x.config["axis_".concat(n,"_tick_text_position")]:{x:0,y:0},i="subX"===n?"subchart_axis_x":"axis_".concat(n),a=x.config["".concat(i,"_show")],z=!!a&&x.config["".concat(i,"_tick_show")],X=!!a&&x.config["".concat(i,"_tick_text_show")],I=null;t.each(function(){var t=O(this),e=this.__chart__||v,i=y.copyScale();I=t,this.__chart__=i,m.tickOffset=x.isCategory?Math.ceil((i(1)-i(0))/2):0;var n,a=t.selectAll(".domain").data([0]);if(a.enter().append("path").attr("class","domain").merge(y.transitionise(a)).attr("d",function(){var t=m.outerTickSize*S;return A?"M".concat(F[0],",").concat(t,"V0H").concat(F[1],"V").concat(t):"M".concat(t,",").concat(F[0],"H0V").concat(F[1],"H").concat(t)}),z||X){var r=m.tickValues||y.generateTicks(i),o=t.selectAll(".tick").data(r,i),s=o.enter().insert("g",".domain").attr("class","tick").style("opacity","1"),c=o.exit().remove();o=s.merge(o),z&&s.append("line"),X&&s.append("text");var u=Ni.getSizeFor1Char(o),l=[],h=o.select("text").selectAll("tspan").data(function(t,e){var n=x.tickMultiline?T(t,i,r,w,u.w):qn(y.textFormatted(t))?y.textFormatted(t).concat():[y.textFormatted(t)];return l[e]=n.length,n.map(function(t){return{index:e,splitted:t}})});h.exit().remove(),(h=h.enter().append("tspan").merge(h).text(function(t){return t.splitted})).attr("x",A?0:D*S).attr("dx",(n=0,"bottom"===b&&M&&(n=8*Math.sin(Math.PI*(M/180))),n+(R.x||0))).attr("dy",function(t,e){var n=0;return"top"!==b&&(n=u.h,0===e&&(n=w?-((l[t.index]-1)*(u.h/2)-3):0===R.y?".71em":0)),Pn(n)&&R.y?n+R.y:n||".71em"});var d=o.select("line"),f=o.select("text");if(s.select("line").attr("".concat(C,"2"),L*S),s.select("text").attr("".concat(C),D*S),_.setTickLineTextPosition(d,f),x.tickTitle&&f.append&&f.append("title").each(function(t){O(this).text(x.tickTitle[t])}),i.bandwidth){var g=i,p=g.bandwidth()/2;i=e=function(t){return g(t)+p}}else e.bandwidth?e=i:k.call(y,c,i);k.call(y,s,e),k.call(y,y.transitionise(o).style("opacity",1),i)}}),this.g=I}},{key:"getTickXY",value:function getTickXY(){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}},{key:"getTickSize",value:function getTickSize(t){var e=this.helper.scale,n=this.config,i=n.innerTickSize,a=n.range,r=e(t)+(n.tickCentered?0:n.tickOffset);return a[0]<r&&r<a[1]?i:0}},{key:"setTickLineTextPosition",value:function setTickLineTextPosition(t,e){var n=this.getTickXY(),i=this.config,a=i.innerTickSize,r=i.orient,o=i.tickLength,s=i.tickOffset,c=this.params.tickTextRotate;"bottom"===r?(t.attr("x1",n.x).attr("x2",n.x).attr("y2",this.getTickSize.bind(this)),e.attr("x",0).attr("y",function yForText(t){return t?11.5-t/15*2.5*(0<t?1:-1):o}(c)).style("text-anchor",function textAnchorForText(t){return t?0<t?"start":"end":"middle"}(c)).attr("transform",function textTransform(t){return t?"rotate(".concat(t,")"):null}(c))):"top"===r?(t.attr("x2",0).attr("y2",-a),e.attr("x",0).attr("y",2*-o).style("text-anchor","middle")):"left"===r?(t.attr("x2",-a).attr("y1",n.y).attr("y2",n.y),e.attr("x",-o).attr("y",s).style("text-anchor","end")):"right"===r&&(t.attr("x2",a).attr("y2",0),e.attr("x",o).attr("y",0).style("text-anchor","start"))}},{key:"splitTickText",value:function splitTickText(t,e,n,i,o){var a=this.params,r=this.helper.textFormatted(t),s=On(r)&&-1<r.indexOf("\n")?r.split("\n"):[];if(s.length)return s;if(qn(r))return r;var c=a.tickWidth;return(!c||c<=0)&&(c=i?95:a.isCategory?Math.ceil(e(n[1])-e(n[0]))-12:110),function split(t,e){for(var n,i,a,r=1;r<e.length;r++)if(" "===e.charAt(r)&&(i=r),n=e.substr(0,r+1),a=o*n.length,c<a)return split(t.concat(e.substr(0,i||r)),e.slice(i?i+1:r));return t.concat(e)}(s,r+"")}},{key:"scale",value:function scale(t){return arguments.length?(this.helper.scale=t,this):this.helper.scale}},{key:"orient",value:function orient(t){return arguments.length?(this.config.orient=t in{top:1,right:1,bottom:1,left:1}?t+"":"bottom",this):this.config.orient}},{key:"tickFormat",value:function tickFormat(t){return arguments.length?(this.config.tickFormat=t,this):this.config.tickFormat}},{key:"tickCentered",value:function tickCentered(t){var e=this.config;return arguments.length?(e.tickCentered=t,this):e.tickCentered}},{key:"tickOffset",value:function tickOffset(){return this.config.tickOffset}},{key:"tickInterval",value:function tickInterval(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===Infinity?0:e}},{key:"ticks",value:function ticks(){for(var t=this.config,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return n.length?(t.tickArguments=ri(n),this):t.tickArguments}},{key:"tickCulling",value:function tickCulling(t){var e=this.config;return arguments.length?(e.tickCulling=t,this):e.tickCulling}},{key:"tickValues",value:function tickValues(t){var e=this,n=this.config;if(En(t))n.tickValues=function(){return t(e.helper.scale.domain())};else{if(!arguments.length)return n.tickValues;n.tickValues=t}return this}},{key:"setTransition",value:function setTransition(t){return this.config.transition=t,this}}]),AxisRenderer}(),Hi=function(t,e){var n=t.config.axis_rotated;return e?n:!n},Vi=function(t){return"".concat(dn.axis," ").concat(dn["axis".concat(ai(t))])},Ui=function(){function Axis(t){Ft()(this,Axis),this.owner=t}return It()(Axis,[{key:"init",value:function init(){var i=this,a=this.owner,r=a.config,o=r.axis_rotated,s=a.main,t=["x","y"];r.axis_y2_show&&t.push("y2"),a.axesList={},t.forEach(function(e){var t=Vi(e),n=dn["axis".concat(ai(e),"Label")];a.axes[e]=s.append("g").attr("class",t).attr("clip-path",function(){var t=null;return"x"===e?t=a.clipPathForXAxis:"y"===e&&r.axis_y_inner&&(t=a.clipPathForYAxis),t}).attr("transform",a.getTranslate(e)).style("visibility",r["axis_".concat(e,"_show")]?"visible":"hidden"),a.axes[e].append("text").attr("class",n).attr("transform",["rotate(-90)",null]["x"===e?+!o:+o]).style("text-anchor",i.textAnchorForXAxisLabel.bind(i)),i.generateAxes(e)})}},{key:"generateAxes",value:function generateAxes(n){var i,a=this.owner,t=a.config,r=[],e=t["axis_".concat(n,"_axes")],o=t.axis_rotated;"x"===n?i=o?axisLeft:axisBottom:"y"===n?i=o?axisBottom:axisLeft:"y2"===n&&(i=o?axisTop:axisRight),e.length&&e.forEach(function(t){var e=t.tick;r.push(i(a[n]).ticks(e.count).tickFormat(e.format||function(t){return t}).tickValues(e.values).tickSizeOuter(!1===e.outer?0:6))}),a.axesList[n]=r}},{key:"updateAxes",value:function updateAxes(){var r=this.owner,o=r.config;Object.keys(r.axesList).forEach(function(a){r.axesList[a].forEach(function(t,e){var n="".concat(Vi(a),"-").concat(e+1),i=r.main.select(".".concat(n.replace(/\s/,".")));i.empty()?i=r.main.append("g").attr("class",n).style("visibility",o["axis_".concat(a,"_show")]?"visible":"hidden").call(t):r.xAxis.helper.transitionise(i).call(t.scale(r[a])),i.attr("transform",r.getTranslate(a,e+1))})})}},{key:"getXAxis",value:function getXAxis(t,e,n,i,a){var r=this.owner,o=r.config,s=r.isCategorized(),c=r["".concat(t,"Orient")],u=r.xAxisTickFormat,l=r.xAxisTickValues,h={isCategory:s,outerTick:n,noTransition:i,config:o,name:t,tickMultiline:o.axis_x_tick_multiline,tickWidth:o.axis_x_tick_width,tickTextRotate:a?0:o.axis_x_tick_rotate,tickTitle:s&&o.axis_x_tick_tooltip&&r.api.categories(),orgXScale:r.x},d=new Bi(h).scale(r.zoomScale||e).orient(c),f=l;return r.isTimeSeries()&&l&&!En(l)&&(f=l.map(function(t){return r.parseDate(t)})),d.tickFormat(u).tickValues(f),s&&(d.tickCentered(o.axis_x_tick_centered),Gn(o.axis_x_tick_culling)&&(o.axis_x_tick_culling=!1)),d}},{key:"getYAxis",value:function getYAxis(t,e,n,i,a){var r=this.owner,o=r.config,s=r["".concat(t,"Orient")],c=o["axis_".concat(t,"_tick_format")],u=r["".concat(t,"AxisTickValues")],l={outerTick:n,noTransition:i,config:o,name:t,tickTextRotate:a?0:o.axis_y_tick_rotate},h=new Bi(l).scale(e).orient(s).tickFormat(c||r.isStackNormalized()&&function(t){return"".concat(t,"%")});return r.isTimeSeriesY()?h.ticks(o.axis_y_tick_time_value):h.tickValues(u),h}},{key:"updateXAxisTickValues",value:function updateXAxisTickValues(t,e){var n,i=this.owner,a=i.config,r=a.axis_x_tick_count;return(a.axis_x_tick_fit||r)&&(n=this.generateTickValues(i.mapTargetsToUniqueXs(t),r,i.isTimeSeries())),e?e.tickValues(n):i.xAxis&&(i.xAxis.tickValues(n),i.subXAxis.tickValues(n)),n}},{key:"getId",value:function getId(t){var e=this.owner.config;return t in e.data_axes?e.data_axes[t]:"y"}},{key:"getXAxisTickFormat",value:function getXAxisTickFormat(){var e,n=this.owner,i=n.config.axis_x_tick_format,t=n.isTimeSeries(),a=n.isCategorized();return i?En(i)?e=i:t&&(e=function(t){return t?n.axisTimeFormat(i)(t):""}):e=t?n.defaultAxisTimeFormat:a?n.categoryName:function(t){return t<0?t.toFixed(0):t},En(e)?function(t){return e.apply(n,a?[t,n.categoryName(t)]:[t])}:e}},{key:"getTickValues",value:function getTickValues(t){var e=this.owner,n=e.config["axis_".concat(t,"_tick_values")],i=e["".concat(t,"Axis")];return n||(i?i.tickValues():undefined)}},{key:"getXAxisTickValues",value:function getXAxisTickValues(){return this.getTickValues("x")}},{key:"getYAxisTickValues",value:function getYAxisTickValues(){return this.getTickValues("y")}},{key:"getY2AxisTickValues",value:function getY2AxisTickValues(){return this.getTickValues("y2")}},{key:"getLabelOptionByAxisId",value:function getLabelOptionByAxisId(t){return this.owner.config["axis_".concat(t,"_label")]}},{key:"getLabelText",value:function getLabelText(t){var e=this.getLabelOptionByAxisId(t);return On(e)?e:e?e.text:null}},{key:"setLabelText",value:function setLabelText(t,e){var n=this.owner.config,i=this.getLabelOptionByAxisId(t);On(i)?n["axis_".concat(t,"_label")]=e:i&&(i.text=e)}},{key:"getLabelPosition",value:function getLabelPosition(t,e){var n=this.owner.config.axis_rotated,i=this.getLabelOptionByAxisId(t),a=Wn(i)&&i.position?i.position:e[+!n],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")}}},{key:"getXAxisLabelPosition",value:function getXAxisLabelPosition(){return this.getLabelPosition("x",["inner-top","inner-right"])}},{key:"getYAxisLabelPosition",value:function getYAxisLabelPosition(){return this.getLabelPosition("y",["inner-right","inner-top"])}},{key:"getY2AxisLabelPosition",value:function getY2AxisLabelPosition(){return this.getLabelPosition("y2",["inner-right","inner-top"])}},{key:"getLabelPositionById",value:function getLabelPositionById(t){return this["get".concat(t.toUpperCase(),"AxisLabelPosition")]()}},{key:"textForXAxisLabel",value:function textForXAxisLabel(){return this.getLabelText("x")}},{key:"textForYAxisLabel",value:function textForYAxisLabel(){return this.getLabelText("y")}},{key:"textForY2AxisLabel",value:function textForY2AxisLabel(){return this.getLabelText("y2")}},{key:"xForAxisLabel",value:function xForAxisLabel(t){var e=!(1<arguments.length&&arguments[1]!==undefined)||arguments[1],n=this.owner,i=t.isMiddle?-n.height/2:0;return Hi(n,e)?i=t.isLeft?0:t.isCenter?n.width/2:n.width:t.isBottom&&(i=-n.height),i}},{key:"dxForAxisLabel",value:function dxForAxisLabel(t){var e=!(1<arguments.length&&arguments[1]!==undefined)||arguments[1],n=this.owner,i=t.isBottom?"0.5em":"0";return Hi(n,e)?i=t.isLeft?"0.5em":t.isRight?"-0.5em":"0":t.isTop&&(i="-0.5em"),i}},{key:"textAnchorForAxisLabel",value:function textAnchorForAxisLabel(t){var e=!(1<arguments.length&&arguments[1]!==undefined)||arguments[1],n=this.owner,i=t.isMiddle?"middle":"end";return Hi(n,e)?i=t.isLeft?"start":t.isCenter?"middle":"end":t.isBottom&&(i="start"),i}},{key:"xForXAxisLabel",value:function xForXAxisLabel(){return this.xForAxisLabel(this.getXAxisLabelPosition(),!1)}},{key:"xForYAxisLabel",value:function xForYAxisLabel(){return this.xForAxisLabel(this.getYAxisLabelPosition())}},{key:"xForY2AxisLabel",value:function xForY2AxisLabel(){return this.xForAxisLabel(this.getY2AxisLabelPosition())}},{key:"dxForXAxisLabel",value:function dxForXAxisLabel(){return this.dxForAxisLabel(this.getXAxisLabelPosition(),!1)}},{key:"dxForYAxisLabel",value:function dxForYAxisLabel(){return this.dxForAxisLabel(this.getYAxisLabelPosition())}},{key:"dxForY2AxisLabel",value:function dxForY2AxisLabel(){return this.dxForAxisLabel(this.getY2AxisLabelPosition())}},{key:"dyForXAxisLabel",value:function dyForXAxisLabel(){var t=this.owner.config,e=this.getXAxisLabelPosition().isInner,n=t.axis_x_height;return t.axis_rotated?e?"1.2em":-25-this.getMaxTickWidth("x"):e?"-0.5em":n?n-10:"3em"}},{key:"dyForYAxisLabel",value:function dyForYAxisLabel(){var t=this.owner,e=this.getYAxisLabelPosition().isInner;return t.config.axis_rotated?e?"-0.5em":"3em":e?"1.2em":-10-(t.config.axis_y_inner?0:this.getMaxTickWidth("y")+10)}},{key:"dyForY2AxisLabel",value:function dyForY2AxisLabel(){var t=this.owner,e=this.getY2AxisLabelPosition().isInner;return t.config.axis_rotated?e?"1.2em":"-2.2em":e?"-0.5em":15+(t.config.axis_y2_inner?0:this.getMaxTickWidth("y2")+15)}},{key:"textAnchorForXAxisLabel",value:function textAnchorForXAxisLabel(){return this.textAnchorForAxisLabel(this.getXAxisLabelPosition(),!1)}},{key:"textAnchorForYAxisLabel",value:function textAnchorForYAxisLabel(){return this.textAnchorForAxisLabel(this.getYAxisLabelPosition())}},{key:"textAnchorForY2AxisLabel",value:function textAnchorForY2AxisLabel(){return this.textAnchorForAxisLabel(this.getY2AxisLabelPosition())}},{key:"getMaxTickWidth",value:function getMaxTickWidth(t,e){var n=this.owner,i=n.config,a=n.currentMaxTickWidths[t],r=0;if(e||!i["axis_".concat(t,"_show")])return a.size;if(n.svg){var o=/^y2?$/.test(t),s=n.filterTargetsToShow(n.data.targets),c=o?"getY":"getX",u=n[t].copy().domain(n["".concat(c,"Domain")](s,t)),l=u.domain().toString();if(a.domain===l)return a.size;a.domain=l;var h=this["".concat(c,"Axis")](t,u,!1,!0,!0);o||this.updateXAxisTickValues(s,h);var d=n.selectChart.append("svg").style("visibility","hidden").style("position","fixed").style("top","0px").style("left","0px");h.create(d),d.selectAll("text").each(function(){r=Math.max(r,this.getBoundingClientRect().width)}),d.remove()}return 0<r&&(a.size=r),a.size}},{key:"updateLabels",value:function updateLabels(i){var a=this,t=this.owner,r={X:t.main.select(".".concat(dn.axisX," .").concat(dn.axisXLabel)),Y:t.main.select(".".concat(dn.axisY," .").concat(dn.axisYLabel)),Y2:t.main.select(".".concat(dn.axisY2," .").concat(dn.axisY2Label))};Object.keys(r).filter(function(t){return!r[t].empty()}).forEach(function(t){var e=r[t],n="".concat(t,"AxisLabel");(i?e.transition():e).attr("x",a["xFor".concat(n)].bind(a)).attr("dx",a["dxFor".concat(n)].bind(a)).attr("dy",a["dyFor".concat(n)].bind(a)).text(a["textFor".concat(n)].bind(a))})}},{key:"getPadding",value:function getPadding(t,e,n,i){var a=Pn(t)?t:t[e];return In(a)?"ratio"===t.unit?t[e]*i:this.convertPixelsToAxisPadding(a,i):n}},{key:"convertPixelsToAxisPadding",value:function convertPixelsToAxisPadding(t,e){var n=this.owner;return e*(t/(n.config.axis_rotated?n.width:n.height))}},{key:"generateTickValues",value:function generateTickValues(t,e,n){var i,a,r,o,s,c,u=t;if(e){var l=En(e)?e():e;if(1===l)u=[t[0]];else if(2===l)u=[t[0],t[t.length-1]];else if(2<l){for(r=l-2,i=t[0],o=((a=t[t.length-1])-i)/(r+1),u=[i],s=0;s<r;s++)c=+i+o*(s+1),u.push(n?new Date(c):c);u.push(a)}}return n||(u=u.sort(function(t,e){return t-e})),u}},{key:"generateTransitions",value:function generateTransitions(n){var i=this.owner.axes,t=["x","y","y2","subx"].map(function(t){var e=i[t];return e&&n&&(e=e.transition().duration(n)),e}),e=zt()(t,4);return{axisX:e[0],axisY:e[1],axisY2:e[2],axisSubX:e[3]}}},{key:"redraw",value:function redraw(n,t){var i=this.owner,a=t?"0":"1";["x","y","y2","subX"].forEach(function(t){var e=i["".concat(t,"Axis")];e&&(i.axes[t.toLowerCase()].style("opacity",a),e.create(n["axis".concat(ai(t))]))}),this.updateAxes()}}]),Axis}(),Wi=function(){function ChartInternal(t){Ft()(this,ChartInternal);var e=this;e.api=t,e.config=e.getOptions(),e.data={},e.cache={},e.axes={}}return It()(ChartInternal,[{key:"beforeInit",value:function beforeInit(){Kn(this.config.onbeforeinit,this)}},{key:"afterInit",value:function afterInit(){Kn(this.config.onafterinit,this)}},{key:"init",value:function init(){var t,e=this,n=e.config;if(e.initParams(),n.data_url)e.convertUrlToData(n.data_url,n.data_mimeType,n.data_headers,n.data_keys,e.initWithData);else if(n.data_json)t=e.convertJsonToData(n.data_json,n.data_keys);else if(n.data_rows)t=e.convertRowsToData(n.data_rows);else{if(!n.data_columns)throw Error("url or json or rows or columns is required.");t=e.convertColumnsToData(n.data_columns)}t&&e.initWithData(t)}},{key:"initParams",value:function initParams(){var n=this,t=n.config,e=t.axis_rotated;n.datetimeId="bb-".concat(+new Date),n.clipId="".concat(n.datetimeId,"-clip"),n.clipIdForXAxis="".concat(n.clipId,"-xaxis"),n.clipIdForYAxis="".concat(n.clipId,"-yaxis"),n.clipIdForGrid="".concat(n.clipId,"-grid"),n.clipPath=n.getClipPath(n.clipId),n.clipPathForXAxis=n.getClipPath(n.clipIdForXAxis),n.clipPathForYAxis=n.getClipPath(n.clipIdForYAxis),n.clipPathForGrid=n.getClipPath(n.clipIdForGrid),n.dragStart=null,n.dragging=!1,n.flowing=!1,n.cancelClick=!1,n.mouseover=!1,n.transiting=!1,n.color=n.generateColor(),n.levelColor=n.generateLevelColor(),n.point=n.generatePoint(),n.extraLineClasses=n.generateExtraLineClass(),n.dataTimeFormat=t.data_xLocaltime?lt:dt,n.axisTimeFormat=t.axis_x_localtime?ut:ht,n.defaultAxisTimeFormat=function(t){var e=(t.getMilliseconds()?".%L":t.getSeconds()&&".:%S")||t.getMinutes()&&"%I:%M"||t.getHours()&&"%I %p"||t.getDay()&&1!==t.getDate()&&"%-m/%-d"||1!==t.getDate()&&"%b %d"||t.getMonth()&&"%-m/%-d"||"%Y/%-m/%-d";return n.axisTimeFormat(e)(t)},n.hiddenTargetIds=[],n.hiddenLegendIds=[],n.focusedTargetIds=[],n.defocusedTargetIds=[],n.xOrient=e?"left":"bottom",n.yOrient=e?t.axis_y_inner?"top":"bottom":t.axis_y_inner?"right":"left",n.y2Orient=e?t.axis_y2_inner?"bottom":"top":t.axis_y2_inner?"left":"right",n.subXOrient=e?"left":"bottom",n.isLegendRight="right"===t.legend_position,n.isLegendInset="inset"===t.legend_position,n.isLegendTop="top-left"===t.legend_inset_anchor||"top-right"===t.legend_inset_anchor,n.isLegendLeft="top-left"===t.legend_inset_anchor||"bottom-left"===t.legend_inset_anchor,n.legendStep=0,n.legendItemWidth=0,n.legendItemHeight=0,n.currentMaxTickWidths={x:{size:0,domain:""},y:{size:0,domain:""},y2:{size:0,domain:""}},n.rotated_padding_left=30,n.rotated_padding_right=e&&!t.axis_x_show?0:30,n.rotated_padding_top=5,n.withoutFadeIn={},n.inputType=n.convertInputType(),n.axes.subx=_([])}},{key:"initWithData",value:function initWithData(t){var e=this,n=e.config;e.axis=new Ui(e),n.zoom_enabled&&(e.initZoom(),e.initZoomBehaviour());var i={element:n.bindto,classname:"bb"};if(Zn(n.bindto)&&(i.element=n.bindto.element||"#chart",i.classname=n.bindto.classname||i.classname),e.selectChart=En(i.element.node)?n.bindto.element:O(i.element||[]),e.selectChart.empty()&&(e.selectChart=O(document.body.appendChild(document.createElement("div")))),e.selectChart.html("").classed(i.classname,!0),e.data.xs={},e.data.targets=e.convertDataToTargets(t),n.data_filter&&(e.data.targets=e.data.targets.filter(n.data_filter)),n.data_hide&&e.addHiddenTargetIds(!0===n.data_hide?e.mapToIds(e.data.targets):n.data_hide),n.legend_hide&&e.addHiddenLegendIds(!0===n.legend_hide?e.mapToIds(e.data.targets):n.legend_hide),e.hasType("gauge")&&(n.legend_show=!1),e.updateSizes(),e.updateScales(),e.x&&(e.x.domain(si(e.getXDomain(e.data.targets))),e.subX.domain(e.x.domain()),e.orgXDomain=e.x.domain()),e.y&&(e.y.domain(e.getYDomain(e.data.targets,"y")),e.subY.domain(e.y.domain())),e.y2&&(e.y2.domain(e.getYDomain(e.data.targets,"y2")),e.subY2&&e.subY2.domain(e.y2.domain())),e.svg=e.selectChart.append("svg").style("overflow","hidden").style("display","block"),n.interaction_enabled&&e.inputType){var a="touch"===e.inputType;e.svg.on(a?"touchstart":"mouseenter",function(){return Kn(n.onover,e)}).on(a?"touchend":"mouseleave",function(){return Kn(n.onout,e)})}n.svg_classname&&e.svg.attr("class",n.svg_classname),e.defs=e.svg.append("defs"),e.clipChart=e.appendClip(e.defs,e.clipId),e.clipXAxis=e.appendClip(e.defs,e.clipIdForXAxis),e.clipYAxis=e.appendClip(e.defs,e.clipIdForYAxis),e.clipGrid=e.appendClip(e.defs,e.clipIdForGrid),En(n.color_tiles)&&e.patterns&&e.patterns.forEach(function(t){return e.defs.append(function(){return t.node})}),e.updateSvgSize();var r=e.svg.append("g").attr("transform",e.getTranslate("main"));if(e.main=r,n.subchart_show&&e.initSubchart(),e.initTooltip&&e.initTooltip(),e.initLegend&&e.initLegend(),e.initTitle&&e.initTitle(),n.data_empty_label_text&&r.append("text").attr("class","".concat(dn.text," ").concat(dn.empty)).attr("text-anchor","middle").attr("dominant-baseline","middle"),e.initRegion(),n.clipPath||e.axis.init(),r.append("g").attr("class",dn.chart).attr("clip-path",e.clipPath),e.initEventRect(),e.initChartElements(),e.initGrid(),r.insert("rect",n.zoom_privileged?null:"g.".concat(dn.regions)).attr("class",dn.zoomRect).attr("width",e.width).attr("height",e.height).style("opacity","0").on("dblclick.zoom",null),n.axis_x_extent&&e.brush.scale(e.getDefaultExtent()),n.clipPath&&e.axis.init(),e.updateTargets(e.data.targets),e.updateDimension(),n.oninit.call(e),e.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),n.data_onmin||n.data_onmax){var o=e.getMinMaxData();Kn(n.data_onmin,e,o.min),Kn(n.data_onmax,e,o.max)}e.bindResize(),e.api.element=e.selectChart.node()}},{key:"initChartElements",value:function initChartElements(){var e=this;["Bar","Line","Bubble","Arc","Gauge","Pie","Radar"].forEach(function(t){e["init".concat(t)]()}),jn(e.config.data_labels)&&e.initText()}},{key:"getChartElements",value:function getChartElements(){var t=this;return{chart:t.selectChart,svg:t.svg,defs:t.defs,main:t.main,tooltip:t.tooltip,legend:t.legend,title:t.title,grid:t.grid,arc:t.arcs,bar:{bars:t.mainBar},line:{lines:t.mainLine,areas:t.mainArea,circles:t.mainCircle},text:{texts:t.mainText}}}},{key:"smoothLines",value:function smoothLines(t,e){"grid"===e&&t.each(function(){var e=O(this),t=["x1","x2","y1","y2"].map(function(t){return Math.ceil(e.attr(t))}),n=zt()(t,4),i=n[0],a=n[1],r=n[2],o=n[3];e.attr({x1:i,x2:a,y1:r,y2:o})})}},{key:"updateSizes",value:function updateSizes(){var t=this,e=t.config,n=e.axis_rotated,i=t.hasArcType(),a={width:t.legend?t.getLegendWidth():0,height:t.legend?t.getLegendHeight():0},r=t.isLegendRight||t.isLegendInset?0:a.height,o=n||i?0:t.getHorizontalAxisHeight("x"),s=e.subchart_axis_x_show&&e.subchart_axis_x_tick_text_show?o:30,c=e.subchart_show&&!i?e.subchart_size_height+s:0;t.currentWidth=t.getCurrentWidth(),t.currentHeight=t.getCurrentHeight(),t.margin=n?{top:t.getHorizontalAxisHeight("y2")+t.getCurrentPaddingTop(),right:i?0:t.getCurrentPaddingRight(),bottom:t.getHorizontalAxisHeight("y")+r+t.getCurrentPaddingBottom(),left:c+(i?0:t.getCurrentPaddingLeft())}:{top:5+t.getCurrentPaddingTop(),right:i?0:t.getCurrentPaddingRight(),bottom:o+c+r+t.getCurrentPaddingBottom(),left:i?0:t.getCurrentPaddingLeft()},t.margin2=n?{top:t.margin.top,right:NaN,bottom:20+r,left:t.rotated_padding_left}:{top:t.currentHeight-c-r,right:NaN,bottom:s+r,left:t.margin.left},t.margin3={top:0,right:NaN,bottom:0,left:0},t.updateSizeForLegend&&t.updateSizeForLegend(a),t.width=t.currentWidth-t.margin.left-t.margin.right,t.height=t.currentHeight-t.margin.top-t.margin.bottom,t.width<0&&(t.width=0),t.height<0&&(t.height=0),t.width2=n?t.margin.left-t.rotated_padding_left-t.rotated_padding_right:t.width,t.height2=n?t.height:t.currentHeight-t.margin2.top-t.margin2.bottom,t.width2<0&&(t.width2=0),t.height2<0&&(t.height2=0),t.arcWidth=t.width-(t.isLegendRight?a.width+10:0),t.arcHeight=t.height-(t.isLegendRight?0:10),t.hasType("gauge")&&!e.gauge_fullCircle&&(t.arcHeight+=t.height-t.getGaugeLabelHeight()),t.updateRadius&&t.updateRadius(),t.isLegendRight&&i&&(t.margin3.left=t.arcWidth/2+1.1*t.radiusExpanded)}},{key:"updateTargets",value:function updateTargets(t){var e=this;e.updateTargetsForText(t),e.updateTargetsForBar(t),e.updateTargetsForLine(t),e.hasArcType(t)&&(e.hasType("radar")?e.updateTargetsForRadar(t):e.updateTargetsForArc(t)),e.updateTargetsForSubchart&&e.updateTargetsForSubchart(t),e.showTargets()}},{key:"showTargets",value:function showTargets(){var e=this;e.svg.selectAll(".".concat(dn.target)).filter(function(t){return e.isTargetToShow(t.id)}).transition().duration(e.config.transition_duration).style("opacity","1")}},{key:"getWithOption",value:function getWithOption(n){var i={Y:!0,Subchart:!0,Transition:!0,EventRect:!0,Dimension:!0,TrimXDomain:!0,Transform:!1,UpdateXDomain:!1,UpdateOrgXDomain:!1,Legend:!1,Moving:!1,UpdateXAxis:"UpdateXDomain",TransitionForExit:"Transition",TransitionForAxis:"Transition"};return Object.keys(i).forEach(function(t){var e=i[t];On(e)&&(e=i[e]),i[t]=$n(n,"with".concat(t),e)}),i}},{key:"redraw",value:function redraw(){var t=0<arguments.length&&arguments[0]!==undefined?arguments[0]:{},e=1<arguments.length?arguments[1]:undefined,n=this,i=n.main,a=n.config,r=n.filterTargetsToShow(n.data.targets),o=t.flow,s=n.getWithOption(t),c=s.Transition?a.transition_duration:0,u=s.TransitionForExit?c:0,l=s.TransitionForAxis?c:0,h=e||n.axis.generateTransitions(l);t.initializing&&n.brush&&n.brush.initZoom()&&(s.Y=n.config.zoom_rescale,s.Subchart=!0,s.Dimension=!0),t.initializing&&a.tooltip_init_show||"touch"!==n.inputType||n.hideTooltip(),s.Legend&&a.legend_show?n.updateLegend(n.mapToIds(n.data.targets),t,h):s.Dimension&&n.updateDimension(!0),n.redrawAxis(r,s,h,o),n.updateCircleY(),n.updateXgridFocus(),a.data_empty_label_text&&i.select("text.".concat(dn.text,".").concat(dn.empty)).attr("x",n.width/2).attr("y",n.height/2).text(a.data_empty_label_text).transition().style("opacity",r.length?0:1),n.updateGrid(c),n.updateRegion(c),n.updateBar(u),n.updateLine(u),n.updateArea(u),n.updateCircle(),n.hasDataLabel()&&n.updateText(u),n.redrawTitle&&n.redrawTitle(),n.arcs&&n.redrawArc(c,u,s.Transform),n.radars&&n.redrawRadar(c,u),n.mainText&&i.selectAll(".".concat(dn.selectedCircles)).filter(n.isBarType.bind(n)).selectAll("circle").remove(),a.interaction_enabled&&!o&&s.EventRect&&!s.Moving&&(n.redrawEventRect(),n.bindZoomEvent()),n.generateRedrawList(r,o,c,s.Subchart,s.Moving)}},{key:"redrawAxis",value:function redrawAxis(r,t,e,n){var i,a,o,s=this,c=s.config,u=s.hasArcType();if(s.isCategorized()&&0===r.length&&s.x.domain([0,s.axes.x.selectAll(".tick").size()]),s.x&&r.length?(s.updateXDomain(r,t.UpdateXDomain,t.UpdateOrgXDomain,t.TrimXDomain),!c.axis_x_tick_values&&(i=s.axis.updateXAxisTickValues(r))):s.xAxis&&(s.xAxis.tickValues([]),s.subXAxis.tickValues([])),c.zoom_rescale&&!n&&(o=s.x.orgDomain()),["y","y2"].forEach(function(t){var e=s[t];if(e){var n=c["axis_".concat(t,"_tick_values")],i=c["axis_".concat(t,"_tick_count")];if(e.domain(s.getYDomain(r,t,o)),!n&&i){var a=e.domain();s["".concat(t,"Axis")].tickValues(s.axis.generateTickValues(a,a.every(function(t){return 0===t})?1:i,s.isTimeSeriesY()))}}}),s.axis.redraw(e,u),s.axis.updateLabels(t.Transition),(t.UpdateXDomain||t.UpdateXAxis)&&r.length)if(c.axis_x_tick_culling&&i){for(var l=1;l<i.length;l++)if(i.length/l<c.axis_x_tick_culling_max){a=l;break}s.svg.selectAll(".".concat(dn.axisX," .tick text")).each(function(t){var e=i.indexOf(t);0<=e&&O(this).style("display",e%a?"none":"block")})}else s.svg.selectAll(".".concat(dn.axisX," .tick text")).style("display","block");t.Y&&(s.subY&&s.subY.domain(s.getYDomain(r,"y")),s.subY2&&s.subY2.domain(s.getYDomain(r,"y2")))}},{key:"generateRedrawList",value:function generateRedrawList(t,e,n,i,a){var r=this,o=r.config,s=r.getDrawShape();o.subchart_show&&r.redrawSubchart(i,n,s);var c=e&&r.generateFlow({targets:t,flow:e,duration:e.duration,shape:s,xv:r.xv.bind(r)}),u=(n||c)&&r.isTabVisible(),l=r.getRedrawList(s,e,c,u,a),h=e||o.onrendered?function(){c&&c(),Kn(o.onrendered,r)}:null;if(h)if(u){var d=r.generateWait();src_transition_transition().duration(n).each(function(){l.reduce(function(t,e){return t.concat(e)},[]).forEach(function(t){return d.add(t)})}).call(d,h)}else h();r.mapToIds(r.data.targets).forEach(function(t){r.withoutFadeIn[t]=!0})}},{key:"getDrawShape",value:function getDrawShape(){var t=this,e=t.config.axis_rotated,n=t.hasType("radar"),i={type:{},indices:{}};if(t.hasTypeOf("Line")||t.hasType("bubble")||t.hasType("scatter")){var a=t.getShapeIndices(t.isLineType);if(i.indices.line=a,i.type.line=t.generateDrawLine?t.generateDrawLine(a,!1):undefined,t.hasTypeOf("Area")){var r=t.getShapeIndices(t.isAreaType);i.indices.area=r,i.type.area=t.generateDrawArea?t.generateDrawArea(r,!1):undefined}}if(t.hasType("bar")){var o=t.getShapeIndices(t.isBarType);i.indices.bar=o,i.type.bar=t.generateDrawBar?t.generateDrawBar(o):undefined}return i.pos={xForText:t.generateXYForText(i.indices,!0),yForText:t.generateXYForText(i.indices,!1),cx:(n?t.radarCircleX:e?t.circleY:t.circleX).bind(t),cy:(n?t.radarCircleY:e?t.circleX:t.circleY).bind(t)},i}},{key:"getRedrawList",value:function getRedrawList(t,e,n,i,a){var r=this,o=r.config,s=r.hasArcType(),c=t.pos,u=c.cx,l=c.cy,h=c.xForText,d=c.yForText,f=[];if(!s){var g=t.type,p=g.area,_=g.bar,m=g.line;(o.grid_x_lines.length||o.grid_y_lines.length)&&f.push(r.redrawGrid(i)),o.regions.length&&f.push(r.redrawRegion(i)),r.hasTypeOf("Line")&&(f.push(r.redrawLine(m,i)),r.hasTypeOf("Area")&&f.push(r.redrawArea(p,i))),r.hasType("bar")&&f.push(r.redrawBar(_,i)),jn(o.data_labels)&&f.push(r.redrawText(h,d,e,i))}return a||s&&!r.hasType("radar")||f.push(r.redrawCircle(u,l,i,n)),f}},{key:"updateAndRedraw",value:function updateAndRedraw(){var t,e=0<arguments.length&&arguments[0]!==undefined?arguments[0]:{},n=this.config;e.withTransition=$n(e,"withTransition",!0),e.withTransform=$n(e,"withTransform",!1),e.withLegend=$n(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=$n(e,"withTransitionForTransform",e.withTransition),this.updateSizes(),e.withLegend&&n.legend_show||(t=this.axis.generateTransitions(e.withTransitionForAxis?n.transition_duration:0),this.updateScales(),this.updateSvgSize(),this.transformAll(e.withTransitionForTransform,t)),this.redraw(e,t)}},{key:"redrawWithoutRescale",value:function redrawWithoutRescale(){this.redraw({withY:!1,withSubchart:!1,withEventRect:!1,withTransitionForAxis:!1})}},{key:"isTimeSeries",value:function isTimeSeries(){return"timeseries"===this.config.axis_x_type}},{key:"isCategorized",value:function isCategorized(){return 0<=this.config.axis_x_type.indexOf("category")||this.hasType("radar")}},{key:"isCustomX",value:function isCustomX(){var t=this.config;return!this.isTimeSeries()&&(t.data_x||jn(t.data_xs))}},{key:"isTimeSeriesY",value:function isTimeSeriesY(){return"timeseries"===this.config.axis_y_type}},{key:"getTranslate",value:function getTranslate(t){var e,n,i=1<arguments.length&&arguments[1]!==undefined?arguments[1]:0,a=this,r=a.config.axis_rotated,o=0;if(i&&/^(x|y2?)$/.test(t)&&(o=a.getAxisSize(t)*i),"main"===t)e=Vn(a.margin.left),n=Vn(a.margin.top);else if("context"===t)e=Vn(a.margin2.left),n=Vn(a.margin2.top);else if("legend"===t)e=a.margin3.left,n=a.margin3.top;else if("x"===t)e=r?-o:0,n=r?0:a.height+o;else if("y"===t)e=r?0:-o,n=r?a.height+o:0;else if("y2"===t)e=r?0:a.width+o,n=r?1-o:0;else if("subx"===t)e=0,n=r?0:a.height2;else if("arc"===t)e=a.arcWidth/2,n=a.arcHeight/2;else if("radar"===t){var s=(a.arcWidth-a.arcHeight)/2;e=Math.max(s,0)+4,n=s<0?Math.abs(s):Vn(a.margin.top)}return"translate(".concat(e,", ").concat(n,")")}},{key:"initialOpacity",value:function initialOpacity(t){return null!==this.getBaseValue(t)&&this.withoutFadeIn[t.id]?"1":"0"}},{key:"initialOpacityForCircle",value:function initialOpacityForCircle(t){return null!==this.getBaseValue(t)&&this.withoutFadeIn[t.id]?this.opacityForCircle(t):"0"}},{key:"opacityForCircle",value:function opacityForCircle(t){var e=this.config.point_show?"1":"0";return In(this.getBaseValue(t))?this.isBubbleType(t)||this.isScatterType(t)?"0.5":e:"0"}},{key:"opacityForText",value:function opacityForText(){return this.hasDataLabel()?"1":"0"}},{key:"xx",value:function xx(t){var e=this.config.zoom_enabled&&this.zoomScale?this.zoomScale:this.x;return t?e(t.x):null}},{key:"xv",value:function xv(t){var e=this.getBaseValue(t);return this.isTimeSeries()?e=this.parseDate(e):this.isCategorized()&&On(e)&&(e=this.config.axis_x_categories.indexOf(e)),Math.ceil(this.x(e))}},{key:"yv",value:function yv(t){var e=t.axis&&"y2"===t.axis?this.y2:this.y;return Math.ceil(e(this.getBaseValue(t)))}},{key:"subxx",value:function subxx(t){return t?this.subX(t.x):null}},{key:"transformMain",value:function transformMain(t,e){var n,i,a,r=this;e&&e.axisX?n=e.axisX:(n=r.main.select(".".concat(dn.axisX)),t&&(n=n.transition())),e&&e.axisY?i=e.axisY:(i=r.main.select(".".concat(dn.axisY)),t&&(i=i.transition())),e&&e.axisY2?a=e.axisY2:(a=r.main.select(".".concat(dn.axisY2)),t&&(a=a.transition())),(t?r.main.transition():r.main).attr("transform",r.getTranslate("main")),n.attr("transform",r.getTranslate("x")),i.attr("transform",r.getTranslate("y")),a.attr("transform",r.getTranslate("y2")),r.main.select(".".concat(dn.chartArcs)).attr("transform",r.getTranslate("arc"))}},{key:"transformAll",value:function transformAll(t,e){this.transformMain(t,e),this.config.subchart_show&&this.transformContext(t,e),this.legend&&this.transformLegend(t)}},{key:"updateSvgSize",value:function updateSvgSize(){var t=this,e=t.config.axis_rotated,n=t.svg.select(".".concat(dn.brush," .overlay")),i={width:0,height:0};n.size()&&(i.width=+n.attr("width"),i.height=+n.attr("height")),t.svg.attr("width",t.currentWidth).attr("height",t.currentHeight),t.svg.selectAll(["#".concat(t.clipId),"#".concat(t.clipIdForGrid)]).select("rect").attr("width",t.width).attr("height",t.height),t.svg.select("#".concat(t.clipIdForXAxis)).select("rect").attr("x",t.getXAxisClipX.bind(t)).attr("y",t.getXAxisClipY.bind(t)).attr("width",t.getXAxisClipWidth.bind(t)).attr("height",t.getXAxisClipHeight.bind(t)),t.svg.select("#".concat(t.clipIdForYAxis)).select("rect").attr("x",t.getYAxisClipX.bind(t)).attr("y",t.getYAxisClipY.bind(t)).attr("width",t.getYAxisClipWidth.bind(t)).attr("height",t.getYAxisClipHeight.bind(t)),t.svg.select("#".concat(t.clipIdForSubchart)).select("rect").attr("width",t.width).attr("height",i.height),t.svg.select(".".concat(dn.zoomRect)).attr("width",t.width).attr("height",t.height),t.brush&&t.brush.scale(t.subX,i[e?"width":"height"])}},{key:"updateDimension",value:function updateDimension(t){var e=this;t||(e.xAxis&&e.config.axis_rotated?(e.xAxis.create(e.axes.x),e.subXAxis.create(e.axes.subx)):(e.yAxis&&e.yAxis.create(e.axes.y),e.y2Axis&&e.y2Axis.create(e.axes.y2))),e.updateSizes(),e.updateScales(t),e.updateSvgSize(),e.transformAll(!1)}},{key:"bindResize",value:function bindResize(){var t=this,e=t.config;t.resizeFunction=t.generateResize(),t.resizeFunction.add(e.onresize.bind(t)),e.resize_auto&&t.resizeFunction.add(function(){t.resizeTimeout&&(window.clearTimeout(t.resizeTimeout),t.resizeTimeout=null),t.resizeTimeout=window.setTimeout(t.api.flush,100)}),t.resizeFunction.add(e.onresized.bind(t)),window.addEventListener("resize",t.resizeFunction)}},{key:"generateResize",value:function generateResize(){function callResizeFunctions(){e.forEach(function(t){return t()})}var e=[];return callResizeFunctions.add=function(t){return e.push(t)},callResizeFunctions.remove=function(t){return e.splice(e.indexOf(t),1)},callResizeFunctions}},{key:"endall",value:function endall(t,i){var a=0;t.each(function(){return++a}).on("end",function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];--a||i.apply.apply(i,[this].concat(e))})}},{key:"generateWait",value:function generateWait(){var a=[],t=function(t,e){var i;!function loop(){var n=0;a.forEach(function(t){if(t.empty())n++;else try{t.transition()}catch(e){n++}}),i&&clearTimeout(i),n===a.length?e&&e():i=setTimeout(loop,50)}()};return t.add=function(t){qn(t)?a=a.concat(t):a.push(t)},t}},{key:"parseDate",value:function parseDate(t){var e;return t instanceof Date?e=t:On(t)?e=this.dataTimeFormat(this.config.data_xFormat)(t):Pn(t)&&!isNaN(t)&&(e=new Date(+t)),(!e||isNaN(+e))&&console&&console.error&&console.error("Failed to parse x '".concat(t,"' to Date object")),e}},{key:"isTabVisible",value:function isTabVisible(){return!document[["hidden","mozHidden","msHidden","webkitHidden"].filter(function(t){return t in document})[0]]}},{key:"convertInputType",value:function convertInputType(){var t=this.config,e=this.isMobile(),n=t.interaction_inputType_mouse&&!e&&"onmouseover"in window,i=!1;return t.interaction_inputType_touch&&(i="ontouchmove"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),(n?"mouse":i&&"touch")||null}}]),ChartInternal}(),Gi=function Chart(t){Ft()(this,Chart);var e=new Wi(this);(this.internal=e).loadConfig(t),e.beforeInit(t),e.init(),this.$=e.getChartElements(),e.afterInit(t),function bindThis(e,n,i){Object.keys(e).forEach(function(t){n[t]=e[t].bind(i),Object.keys(e[t]).length&&bindThis(e[t],n[t],i)})}(Chart.prototype,this,this)},ji=function Options(){return Ft()(this,Options),{bindto:"#chart",clipPath:!0,svg_classname:undefined,size_width:undefined,size_height:undefined,padding_left:undefined,padding_right:undefined,padding_top:undefined,padding_bottom:undefined,resize_auto:!0,zoom_enabled:undefined,zoom_extent:undefined,zoom_privileged:!1,zoom_rescale:!1,zoom_onzoom:undefined,zoom_onzoomstart:undefined,zoom_onzoomend:undefined,zoom_resetButton:!0,zoom_x_min:undefined,zoom_x_max:undefined,interaction_enabled:!0,interaction_brighten:!0,interaction_inputType_mouse:!0,interaction_inputType_touch:{},onover:function onover(){},onout:function onout(){},onresize:function onresize(){},onresized:function onresized(){},onbeforeinit:undefined,oninit:function oninit(){},onafterinit:undefined,onrendered:undefined,transition_duration:350,data_x:undefined,data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_idConverter:function data_idConverter(t){return t},data_names:{},data_classes:{},data_groups:[],data_axes:{},data_type:undefined,data_types:{},data_labels:{},data_labels_position:{},data_order:"desc",data_regions:{},data_color:undefined,data_colors:{},data_hide:!1,data_filter:undefined,data_stack_normalize:!1,data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:function data_selection_isselectable(){return!0},data_selection_multiple:!0,data_selection_draggable:!1,data_onclick:function data_onclick(){},data_onover:function data_onover(){},data_onout:function data_onout(){},data_onselected:function data_onselected(){},data_onunselected:function data_onunselected(){},data_onmin:undefined,data_onmax:undefined,data_url:undefined,data_headers:undefined,data_json:undefined,data_rows:undefined,data_columns:undefined,data_mimeType:undefined,data_keys:undefined,data_empty_label_text:"",subchart_show:!1,subchart_defzoom:!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 subchart_onbrush(){},color_pattern:[],color_tiles:undefined,color_threshold:{},color_onover:undefined,legend_show:!0,legend_hide:!1,legend_contents_bindto:undefined,legend_contents_template:undefined,legend_position:"bottom",legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:undefined,legend_item_onclick:undefined,legend_item_onover:undefined,legend_item_onout:undefined,legend_equally:!1,legend_padding:0,legend_item_tile_width:10,legend_item_tile_height:10,legend_usePoint:!1,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:undefined,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_count:undefined,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_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:undefined,axis_x_min:undefined,axis_x_padding:{},axis_x_height:undefined,axis_x_extent:undefined,axis_x_label:{},axis_x_axes:[],axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:undefined,axis_y_max:undefined,axis_y_min:undefined,axis_y_inverted:!1,axis_y_center:undefined,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:undefined,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:undefined,axis_y_tick_show:!0,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:undefined,axis_y_padding:{},axis_y_default:undefined,axis_y_axes:[],axis_y2_show:!1,axis_y2_max:undefined,axis_y2_min:undefined,axis_y2_inverted:!1,axis_y2_center:undefined,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:undefined,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_count:undefined,axis_y2_tick_show:!0,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:undefined,axis_y2_axes:[],grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:10,grid_focus_show:!0,grid_front:!1,grid_lines_front:!0,point_show:!0,point_r:2.5,point_sensitivity:10,point_focus_expand_enabled:!0,point_focus_expand_r:undefined,point_pattern:[],point_select_r:undefined,point_type:"circle",line_connectNull:!1,line_step_type:"step",line_classes:undefined,line_point:!0,bar_padding:0,bar_radius:undefined,bar_radius_ratio:undefined,bar_width:undefined,bar_width_ratio:.6,bar_width_max:undefined,bar_zerobased:!0,bubble_maxR:35,area_zerobased:!0,area_above:!1,pie_label_show:!0,pie_label_format:undefined,pie_label_threshold:.05,pie_label_ratio:undefined,pie_expand:{},pie_expand_duration:50,pie_innerRadius:0,pie_padAngle:0,pie_padding:0,gauge_fullCircle:!1,gauge_label_show:!0,gauge_label_format:undefined,gauge_min:0,gauge_max:100,gauge_startingAngle:-1*Math.PI/2,gauge_label_extents:undefined,gauge_units:undefined,gauge_width:undefined,gauge_expand:{},gauge_expand_duration:50,donut_label_show:!0,donut_label_format:undefined,donut_label_threshold:.05,donut_label_ratio:undefined,donut_width:undefined,donut_title:"",donut_expand:{},donut_expand_duration:50,donut_padAngle:0,spline_interpolation_type:"cardinal",radar_axis_max:undefined,radar_axis_line_show:!0,radar_axis_text_show:!0,radar_level_depth:3,radar_level_show:!0,radar_level_text_format:function radar_level_text_format(t){return t%1==0?t:t.toFixed(2)},radar_level_text_show:!0,radar_size_ratio:.87,radar_direction_clockwise:!1,regions:[],tooltip_show:!0,tooltip_grouped:!0,tooltip_format_title:undefined,tooltip_format_name:undefined,tooltip_format_value:undefined,tooltip_position:undefined,tooltip_contents:function tooltip_contents(t,e,n,i){return this.getTooltipContent?this.getTooltipContent(t,e,n,i):""},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_onshow(){},tooltip_onhide:function tooltip_onhide(){},tooltip_onshown:function tooltip_onshown(){},tooltip_onhidden:function tooltip_onhidden(){},tooltip_order:null,title_text:undefined,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"}};ii(Wi.prototype,{getOptions:function getOptions(){return new ji},loadConfig:function loadConfig(e){var n,i,a,r=this.config,o=function(){var t=i.shift();return t&&n&&Wn(n)&&t in n?(n=n[t],o()):t?undefined:n};Object.keys(r).forEach(function(t){n=e,i=t.split("_"),a=o(),Nn(a)&&(r[t]=a)})}}),ii(Wi.prototype,{getScale:function getScale(t,e,n){return(n?function(){return initRange.apply(calendar(j,W,z,R,D,M,C,A,ut).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}():src_linear_linear()).range([t,e])},getX:function getX(t,e,n,i){var a=this.zoomScale||this.getScale(t,e,this.isTimeSeries());return this.getCustomizedScale(n?a.domain(n):a,i)},getY:function getY(t,e,n){var i=this.getScale(t,e,this.isTimeSeriesY());return n&&i.domain(n),i},getCustomizedScale:function getCustomizedScale(i,t){var e=this,a=t||function(){return e.xAxis.tickOffset()},n=function(t,e){var n=i(t)+a();return e?n:Math.ceil(n)};for(var r in i)n[r]=i[r];return n.orgDomain=function(){return i.domain()},n.orgScale=function(){return i},e.isCategorized()&&(n.domain=function(t){var e=t;return arguments.length?(i.domain(e),n):[(e=this.orgDomain())[0],e[1]+1]}),n},getYScale:function getYScale(t){return"y2"===this.axis.getId(t)?this.y2:this.y},getSubYScale:function getSubYScale(t){return"y2"===this.axis.getId(t)?this.subY2:this.subY},updateScales:function updateScales(t){var e=this,n=e.config,i=n.axis_rotated;e.xMin=i?1:0,e.xMax=i?e.height:e.width,e.yMin=i?0:e.height,e.yMax=i?e.width:1,e.subXMin=e.xMin,e.subXMax=e.xMax,e.subYMin=i?0:e.height2,e.subYMax=i?e.width2:1,e.x=e.getX(e.xMin,e.xMax,e.x&&e.x.orgDomain(),function(){return e.xAxis.tickOffset()}),e.subX=e.getX(e.xMin,e.xMax,e.orgXDomain,function(t){return t%1?0:e.subXAxis.tickOffset()}),e.xAxisTickFormat=e.axis.getXAxisTickFormat(),e.xAxisTickValues=e.axis.getXAxisTickValues(),e.xAxis=e.axis.getXAxis("x",e.x,n.axis_x_tick_outer,t),e.subXAxis=e.axis.getXAxis("subX",e.subX,n.axis_x_tick_outer,t),e.y=e.getY(e.yMin,e.yMax,e.y?e.y.domain():n.axis_y_default),e.subY=e.getY(e.subYMin,e.subYMax,e.subY?e.subY.domain():n.axis_y_default),e.yAxisTickValues=e.axis.getYAxisTickValues(),e.yAxis=e.axis.getYAxis("y",e.y,n.axis_y_tick_outer,t),n.axis_y2_show&&(e.y2=e.getY(e.yMin,e.yMax,e.y2?e.y2.domain():n.axis_y2_default),e.subY2=e.getY(e.subYMin,e.subYMax,e.subY2?e.subY2.domain():n.axis_y2_default),e.y2AxisTickValues=e.axis.getY2AxisTickValues(),e.y2Axis=e.axis.getYAxis("y2",e.y2,n.axis_y2_tick_outer,t)),e.updateArc&&e.updateArc()}}),ii(Wi.prototype,{getYDomainMinMax:function getYDomainMinMax(n,e){var u=this,t=u.config,l="min"===e,i=t.data_groups,h=u.mapToIds(n),d=u.getValuesAsIdKeyed(n);return 0<i.length&&function(){for(var s,c=u["has".concat(l?"Negative":"Positive","ValueInTargets")](n),t=function(t,e){if(0===(e=e.filter(function(t){return 0<=h.indexOf(t)})).length)return s=e,"continue";var a=e[0],r=u.axis.getId(a);c&&d[a]&&(d[a]=d[a].map(function(t){return(l?t<0:0<t)?t:0}));for(var n,i=function(t,e){if(!d[e])return"continue";var i=u.axis.getId(e);d[e].forEach(function(t,e){var n=+t;i!==r||c&&(l?0<n:n<0)||(d[a][e]+=n)})},o=1;n=e[o];o++)i(0,n);s=e},e=0;s=i[e];e++)t(0,s)}(),ci(e,Object.keys(d).map(function(t){return ci(e,d[t])}))},getYDomainMin:function getYDomainMin(t){return this.getYDomainMinMax(t,"min")},getYDomainMax:function getYDomainMax(t){return this.getYDomainMinMax(t,"max")},getYDomain:function getYDomain(t,e,n){var i=this,a=i.config;if(i.isStackNormalized())return[0,100];var r,o=t.filter(function(t){return i.axis.getId(t.id)===e}),s=n?i.filterByXDomain(o,n):o,c="y2"===e?a.axis_y2_min:a.axis_y_min,u="y2"===e?a.axis_y2_max:a.axis_y_max,l=i.getYDomainMin(s),h=i.getYDomainMax(s),d="y2"===e?a.axis_y2_center:a.axis_y_center,f=i.hasType("bar",s)&&a.bar_zerobased||i.hasType("area",s)&&a.area_zerobased,g="y2"===e?a.axis_y2_inverted:a.axis_y_inverted,p=i.hasDataLabel()&&a.axis_rotated,_=i.hasDataLabel()&&!a.axis_rotated;if(l=In(c)?c:In(u)?l<u?l:u-10:l,h=In(u)?u:In(c)?c<h?h:c+10:h,0===s.length)return"y2"===e?i.y2.domain():i.y.domain();isNaN(l)&&(l=0),isNaN(h)&&(h=l),l===h&&(l<0?h=0:l=0);var m=0<=l&&0<=h,x=l<=0&&h<=0;(In(c)&&m||In(u)&&x)&&(f=!1),f&&(m&&(l=0),x&&(h=0));var y=Math.abs(h-l),v=.1*y,b=.1*y;if(Nn(d)){var T=Math.max(Math.abs(l),Math.abs(h));h=d+T,l=d-T}if(p){r=i.getDataLabelLength(l,h,"width");var w=Un(i.y.range()),A=[r[0]/w,r[1]/w];v+=y*(A[1]/(1-A[0]-A[1])),b+=y*(A[0]/(1-A[0]-A[1]))}else _&&(r=i.getDataLabelLength(l,h,"height"),v+=i.axis.convertPixelsToAxisPadding(r[1],y),b+=i.axis.convertPixelsToAxisPadding(r[0],y));"y"===e&&jn(a.axis_y_padding)&&(v=i.axis.getPadding(a.axis_y_padding,"top",v,y),b=i.axis.getPadding(a.axis_y_padding,"bottom",b,y)),"y2"===e&&jn(a.axis_y2_padding)&&(v=i.axis.getPadding(a.axis_y2_padding,"top",v,y),b=i.axis.getPadding(a.axis_y2_padding,"bottom",b,y)),f&&(m&&(b=l),x&&(v=-h)),m&&l<b&&(b=l);var k=[l-b,h+v];return g?k.reverse():k},getXDomainMinMax:function getXDomainMinMax(t,e){var n=this.config["axis_x_".concat(e)];return Nn(n)?this.isTimeSeries()?this.parseDate(n):n:ci(e,t.map(function(t){return ci(e,t.values.map(function(t){return t.x}))}))},getXDomainMin:function getXDomainMin(t){return this.getXDomainMinMax(t,"min")},getXDomainMax:function getXDomainMax(t){return this.getXDomainMinMax(t,"max")},getXDomainPadding:function getXDomainPadding(t){var e,n,i=this.config,a=t[1]-t[0],r=i.axis_x_padding,o=n=this.isCategorized()?0:this.hasType("bar")?1<(e=this.getMaxDataCount())?a/(e-1)/2:.5:.01*a,s=n;return Zn(r)&&jn(r)?(o=In(r.left)?r.left:n,s=In(r.right)?r.right:n):Pn(i.axis_x_padding)&&(s=o=r),{left:o,right:s}},getXDomain:function getXDomain(t){var e=[this.getXDomainMin(t),this.getXDomainMax(t)],n=e[0],i=e[1],a=this.getXDomainPadding(e),r=0,o=0;return n-i!=0||this.isCategorized()||(i=this.isTimeSeries()?(n=new Date(.5*n.getTime()),new Date(1.5*i.getTime())):(n=0===n?1:.5*n,0===i?-1:1.5*i)),(n||0===n)&&(r=this.isTimeSeries()?new Date(n.getTime()-a.left):n-a.left),(i||0===i)&&(o=this.isTimeSeries()?new Date(i.getTime()+a.right):i+a.right),[r,o]},updateXDomain:function updateXDomain(t,e,n,i,a){var r=this,o=r.config.zoom_enabled;if(n&&(r.x.domain(a||si(r.getXDomain(t))),r.orgXDomain=r.x.domain(),o&&r.zoom.updateScaleExtent(),r.subX.domain(r.x.domain()),r.brush&&r.brush.scale(r.subX)),e){var s=a||!r.brush||ni(r)?r.orgXDomain:ti(r).map(r.subX.invert);r.x.domain(s),o&&r.zoom.updateScaleExtent()}return i&&r.x.domain(r.trimXDomain(r.x.orgDomain())),r.x.domain()},trimXDomain:function trimXDomain(t){var e=this.getZoomDomain(),n=e[0],i=e[1];return t[0]<=n&&(t[1]=+t[1]+(n-t[0]),t[0]=n),i<=t[1]&&(t[0]=+t[0]-(t[1]-i),t[1]=i),t}}),ii(Wi.prototype,{isX:function isX(t){var e,n,i,a=this.config,r=a.data_x&&t===a.data_x,o=jn(a.data_xs)&&(e=a.data_xs,n=t,i=!1,Object.keys(e).forEach(function(t){return e[t]===n&&(i=!0)}),i);return r||o},isNotX:function isNotX(t){return!this.isX(t)},isStackNormalized:function isStackNormalized(){var t=this.config;return t.data_stack_normalize&&t.data_groups.length},isGrouped:function isGrouped(e){return this.config.data_groups.map(function(t){return 0<=t.indexOf(e)})[0]},getXKey:function getXKey(t){var e=this.config;return e.data_x?e.data_x:jn(e.data_xs)?e.data_xs[t]:null},getXValuesOfXKey:function getXValuesOfXKey(e,t){var n,i=this;return(t&&jn(t)?i.mapToIds(t):[]).forEach(function(t){i.getXKey(t)===e&&(n=i.data.xs[t])}),n},getIndexByX:function getIndexByX(t,e){return e?e.indexOf(On(t)?t:+t):(this.filterByX(this.data.targets,t)[0]||{index:null}).index},getXValue:function getXValue(t,e){return t in this.data.xs&&this.data.xs[t]&&In(this.data.xs[t][e])?this.data.xs[t][e]:e},getOtherTargetXs:function getOtherTargetXs(){var t=Object.keys(this.data.xs);return t.length?this.data.xs[t[0]]:null},getOtherTargetX:function getOtherTargetX(t){var e=this.getOtherTargetXs();return e&&t<e.length?e[t]:null},addXs:function addXs(e){var n=this;Object.keys(e).forEach(function(t){n.config.data_xs[t]=e[t]})},hasMultipleX:function hasMultipleX(e){return 1<Object.keys(e).map(function(t){return e[t]}).length},isMultipleX:function isMultipleX(){return jn(this.config.data_xs)||!this.config.data_xSort||this.hasType("bubble")||this.hasType("scatter")},addName:function addName(t){var e;return t&&(e=this.config.data_names[t.id],t.name=e===undefined?t.id:e),t},getAllValuesOnIndex:function getAllValuesOnIndex(e){var n=this;return n.filterTargetsToShow(n.data.targets).map(function(t){return n.addName(n.getValueOnIndex(t.values,e))})},getValueOnIndex:function getValueOnIndex(t,e){var n=t.filter(function(t){return t.index===e});return n.length?n[0]:null},updateTargetX:function updateTargetX(t,i){var a=this;t.forEach(function(n){n.values.forEach(function(t,e){t.x=a.generateTargetX(i[e],n.id,e)}),a.data.xs[n.id]=i})},updateTargetXs:function updateTargetXs(t,e){var n=this;t.forEach(function(t){e[t.id]&&n.updateTargetX([t],e[t.id])})},generateTargetX:function generateTargetX(t,e,n){var i=this.isCategorized()?n:t||n;return this.isTimeSeries()?i=t?this.parseDate(t):this.parseDate(this.getXValue(e,n)):this.isCustomX()&&!this.isCategorized()&&(i=In(t)?+t:this.getXValue(e,n)),i},cloneTarget:function cloneTarget(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}})}},updateXs:function updateXs(){var e=this;e.data.targets.length&&(e.xs=[],e.getMaxDataCountTarget(e.data.targets).values.forEach(function(t){e.xs[t.index]=t.x}))},getPrevX:function getPrevX(t){var e=this.xs[t-1];return Nn(e)?e:null},getNextX:function getNextX(t){var e=this.xs[t+1];return Nn(e)?e:null},getBaseValue:function getBaseValue(t){var e=t.value;return e&&this.isAreaRangeType(t)&&(e=this.getAreaRangeData(t,"mid")),e},getMinMaxValue:function getMinMaxValue(t){var i,a,r=this.getBaseValue.bind(this);return(t||this.data.targets.map(function(t){return t.values})).forEach(function(t,e){var n=t.map(r).filter(Pn);i=Math.min.apply(Math,[e?i:Infinity].concat(gn()(n))),a=Math.max.apply(Math,[e?a:-Infinity].concat(gn()(n)))}),{min:i,max:a}},getMinMaxData:function getMinMaxData(){var i=this,t="$minMaxData",e=i.getCache(t);if(!e){var n=i.data.targets.map(function(t){return t.values}),a=i.getMinMaxValue(n),r=[],o=[];n.forEach(function(t){var e=i.getFilteredDataByValue(t,a.min),n=i.getFilteredDataByValue(t,a.max);e.length&&(r=r.concat(e)),n.length&&(o=o.concat(n))}),i.addCache(t,e={min:r,max:o})}return e},getTotalPerIndex:function getTotalPerIndex(){var n=this.getCache("$totalPerIndex");if(this.isStackNormalized()&&!n&&(n=[],this.data.targets.forEach(function(t){t.values.forEach(function(t,e){n[e]||(n[e]=0),n[e]+=Pn(t.value)?t.value:0})})),this.addCache("$totalPerIndex",n.slice()),this.hiddenTargetIds.length){var i=this.api.data.values.call(this.api,this.hiddenTargetIds,!1);i.length&&(i=i.reduce(function(t,n){return t.map(function(t,e){return(Pn(t)?t:0)+n[e]})}),n=n.map(function(t,e){return t-i[e]}))}return n},getTotalDataSum:function getTotalDataSum(){var t="$totalDataSum",e=this.getCache(t);if(!e){var n=oi(this.data.targets.map(function(t){return t.values})).map(function(t){return t.value}).reduce(function(t,e){return t+e});this.addCache(t,e=n)}return e},getFilteredDataByValue:function getFilteredDataByValue(t,e){var n=this;return t.filter(function(t){return n.getBaseValue(t)===e})},getMaxDataCount:function getMaxDataCount(){return Math.max.apply(Math,gn()(this.data.targets.map(function(t){return t.values.length})))},getMaxDataCountTarget:function getMaxDataCountTarget(t){var e,n=t.length,i=0;return 1<n?t.forEach(function(t){t.values.length>i&&(i=(e=t).values.length)}):e=n?t[0]:null,e},mapToIds:function mapToIds(t){return t.map(function(t){return t.id})},mapToTargetIds:function mapToTargetIds(t){return t?qn(t)?t.concat():[t]:this.mapToIds(this.data.targets)},hasTarget:function hasTarget(t,e){for(var n,i=this.mapToIds(t),a=0;n=i[a];a++)if(n===e)return!0;return!1},isTargetToShow:function isTargetToShow(t){return this.hiddenTargetIds.indexOf(t)<0},isLegendToShow:function isLegendToShow(t){return this.hiddenLegendIds.indexOf(t)<0},filterTargetsToShow:function filterTargetsToShow(t){var e=this;return t.filter(function(t){return e.isTargetToShow(t.id)})},mapTargetsToUniqueXs:function mapTargetsToUniqueXs(t){var e=[],n=this.x.domain();return t&&t.length&&(e=oi(t.map(function(t){return t.values.map(function(t){return+t.x})})).filter(function(t,e,n){return n.indexOf(t)===e}),e=this.isTimeSeries()?e.map(function(t){return new Date(+t)}):e.map(function(t){return+t})),e=e.filter(function(t){return t>=n[0]&&t<=n[1]}),si(e)},addHiddenTargetIds:function addHiddenTargetIds(t){this.hiddenTargetIds=this.hiddenTargetIds.concat(t)},removeHiddenTargetIds:function removeHiddenTargetIds(e){this.hiddenTargetIds=this.hiddenTargetIds.filter(function(t){return e.indexOf(t)<0})},addHiddenLegendIds:function addHiddenLegendIds(t){this.hiddenLegendIds=this.hiddenLegendIds.concat(t)},removeHiddenLegendIds:function removeHiddenLegendIds(e){this.hiddenLegendIds=this.hiddenLegendIds.filter(function(t){return e.indexOf(t)<0})},getValuesAsIdKeyed:function getValuesAsIdKeyed(t){var i=this,e={},a=i.isMultipleX(),r=a?i.mapTargetsToUniqueXs(t).map(function(t){return On(t)?t:+t}):null;return t.forEach(function(t){var n=[];t.values.forEach(function(t){var e=t.value;qn(e)?n.push.apply(n,gn()(e)):Zn(e)&&"high"in e?n.push.apply(n,gn()(Object.values(e))):a?n[i.getIndexByX(t.x,r)]=e:n.push(e)}),e[t.id]=n}),e},checkValueInTargets:function checkValueInTargets(t,e){for(var n,i=Object.keys(t),a=0;a<i.length;a++){n=t[i[a]].values;for(var r=0;r<n.length;r++)if(e(n[r].value))return!0}return!1},hasNegativeValueInTargets:function hasNegativeValueInTargets(t){return this.checkValueInTargets(t,function(t){return t<0})},hasPositiveValueInTargets:function hasPositiveValueInTargets(t){return this.checkValueInTargets(t,function(t){return 0<t})},_checkOrder:function _checkOrder(t){var e=this.config;return On(e.data_order)&&e.data_order.toLowerCase()===t},isOrderDesc:function isOrderDesc(){return this._checkOrder("desc")},isOrderAsc:function isOrderAsc(){return this._checkOrder("asc")},orderTargets:function orderTargets(t){var e=this.config,n=gn()(t),r=this.isOrderAsc(),i=this.isOrderDesc();return r||i?n.sort(function(t,e){var n=function(t,e){return t+Math.abs(e.value)},i=t.values.reduce(n,0),a=e.values.reduce(n,0);return r?a-i:i-a}):En(e.data_order)&&n.sort(e.data_order),n},filterByX:function filterByX(t,e){return oi(t.map(function(t){return t.values})).filter(function(t){return t.x-e==0})},filterRemoveNull:function filterRemoveNull(t){var e=this;return t.filter(function(t){return In(e.getBaseValue(t))})},filterByXDomain:function filterByXDomain(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 hasDataLabel(){var t=this.config.data_labels;return Bn(t)&&t||Wn(t)&&jn(t)},getDataLabelLength:function getDataLabelLength(t,e,n){var i=this,a=[0,0];return i.selectChart.select("svg").selectAll(".dummy").data([t,e]).enter().append("text").text(function(t){return i.dataLabelFormat(t.id)(t)}).each(function(t,e){a[e]=1.3*this.getBoundingClientRect()[n]}).remove(),a},isNoneArc:function isNoneArc(t){return this.hasTarget(this.data.targets,t.id)},isArc:function isArc(t){return"data"in t&&this.hasTarget(this.data.targets,t.data.id)},findSameXOfValues:function findSameXOfValues(t,e){var n,i=t[e].x,a=[];for(n=e-1;0<=n&&i===t[n].x;n--)a.push(t[n]);for(n=e;n<t.length&&i===t[n].x;n++)a.push(t[n]);return a},findClosestFromTargets:function findClosestFromTargets(t,e){var n=this,i=t.map(function(t){return n.findClosest(t.values,e)});return n.findClosest(i,e)},findClosest:function findClosest(t,n){var i,a=this,r=a.config.point_sensitivity;return t.filter(function(t){return t&&a.isBarType(t.id)}).forEach(function(t){var e=a.main.select(".".concat(dn.bars).concat(a.getTargetSelectorSuffix(t.id)," .").concat(dn.bar,"-").concat(t.index)).node();!i&&a.isWithinBar(e)&&(i=t)}),t.filter(function(t){return t&&!a.isBarType(t.id)}).forEach(function(t){var e=a.dist(t,n);e<r&&(r=e,i=t)}),i},dist:function dist(t,e){var n=this.config.axis_rotated,i=n?1:0,a=n?0:1,r=this.circleY(t,t.index),o=this.x(t.x);return Math.sqrt(Math.pow(o-e[i],2)+Math.pow(r-e[a],2))},convertValuesToStep:function convertValuesToStep(t){var e=this.config,n=e.axis_rotated,i=e.line_step_type,a=this.isCategorized(),r=qn(t)?t.concat():[t];if(!n&&!a)return t;var o=r[0].id,s=r[0].x-1,c=r[0].value;return a&&r.unshift({x:s,value:c,id:o}),"step-after"===i&&r.unshift({x:s-1,value:c,id:o}),c=r[(s=r.length)-1].value,a&&r.push({x:s,value:c,id:o}),"step-before"===i&&r.push({x:s+1,value:c,id:o}),r},convertValuesToRange:function convertValuesToRange(t){var e=qn(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 updateDataAttributes(t,e){var n=this.config["data_".concat(t)];return Yn(e)||(Object.keys(e).forEach(function(t){n[t]=e[t]}),this.redraw({withLegend:!0})),n},getAreaRangeData:function getAreaRangeData(t,e){var n=t.value;if(qn(n)){var i=["high","mid","low"].indexOf(e);return-1===i?null:n[i]}return n[e]},getRatio:function getRatio(t,e,n,i){var a=this.config,r=this.api,o=0;if(e&&(i||r.data.shown.call(r).length))if(o=e.ratio||e.value,"arc"===t){var s=r.data.values.bind(r);if(this.pie.padAngle()()){var c=this.getTotalDataSum();this.hiddenTargetIds.length&&(c-=s(this.hiddenTargetIds).reduce(function(t,e){return t+e})),o=e.value/c}else o=(e.endAngle-e.startAngle)/(Math.PI*(this.hasType("gauge")&&!a.gauge_fullCircle?1:2))}else if("index"===t){if(0===e.value)return e.ratio=0,e.ratio;var u=i===undefined?this.getTotalPerIndex():i;e.ratio=Pn(e.value)&&u&&0<u[e.index]?e.value/u[e.index]:0,o=e.ratio}else"radar"===t&&(o=parseFloat(Math.max(e.value,0))/this.maxValue*a.radar_size_ratio);return n&&o?100*o:o}});var qi={},Zi={};function objectConverter(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}function inferColumns(t){var n=Object.create(null),i=[];return t.forEach(function(t){for(var e in t)e in n||i.push(n[e]=e)}),i}function dsv_pad(t,e){var n=t+"",i=n.length;return i<e?new Array(e-i+1).join(0)+n:n}function formatDate(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),i=t.getUTCSeconds(),a=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function dsv_formatYear(t){return t<0?"-"+dsv_pad(-t,6):9999<t?"+"+dsv_pad(t,6):dsv_pad(t,4)}(t.getUTCFullYear())+"-"+dsv_pad(t.getUTCMonth()+1,2)+"-"+dsv_pad(t.getUTCDate(),2)+(a?"T"+dsv_pad(e,2)+":"+dsv_pad(n,2)+":"+dsv_pad(i,2)+"."+dsv_pad(a,3)+"Z":i?"T"+dsv_pad(e,2)+":"+dsv_pad(n,2)+":"+dsv_pad(i,2)+"Z":n||e?"T"+dsv_pad(e,2)+":"+dsv_pad(n,2)+"Z":"")}var $i=function(i){var e=new RegExp('["'+i+"\n\r]"),l=i.charCodeAt(0);function parseRows(i,t){var e,n=[],a=i.length,r=0,o=0,s=a<=0,c=!1;function token(){if(s)return Zi;if(c)return c=!1,qi;var t,e,n=r;if(34===i.charCodeAt(n)){for(;r++<a&&34!==i.charCodeAt(r)||34===i.charCodeAt(++r););return(t=r)>=a?s=!0:10===(e=i.charCodeAt(r++))?c=!0:13===e&&(c=!0,10===i.charCodeAt(r)&&++r),i.slice(n+1,t-1).replace(/""/g,'"')}for(;r<a;){if(10===(e=i.charCodeAt(t=r++)))c=!0;else if(13===e)c=!0,10===i.charCodeAt(r)&&++r;else if(e!==l)continue;return i.slice(n,t)}return s=!0,i.slice(n,a)}for(10===i.charCodeAt(a-1)&&--a,13===i.charCodeAt(a-1)&&--a;(e=token())!==Zi;){for(var u=[];e!==qi&&e!==Zi;)u.push(e),e=token();t&&null==(u=t(u,o++))||n.push(u)}return n}function preformatBody(t,n){return t.map(function(e){return n.map(function(t){return formatValue(e[t])}).join(i)})}function formatRow(t){return t.map(formatValue).join(i)}function formatValue(t){return null==t?"":t instanceof Date?formatDate(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function parse(t,n){var i,a,e=parseRows(t,function(t,e){if(i)return i(t,e-1);a=t,i=n?function customConverter(n,i){var a=objectConverter(n);return function(t,e){return i(a(t),e,n)}}(t,n):objectConverter(t)});return e.columns=a||[],e},parseRows:parseRows,format:function format(t,e){return null==e&&(e=inferColumns(t)),[e.map(formatValue).join(i)].concat(preformatBody(t,e)).join("\n")},formatBody:function formatBody(t,e){return null==e&&(e=inferColumns(t)),preformatBody(t,e).join("\n")},formatRows:function formatRows(t){return t.map(formatRow).join("\n")}}},Ki=$i(","),Ji=Ki.parse,Qi=Ki.parseRows,ta=(Ki.format,Ki.formatBody,Ki.formatRows,$i("\t")),ea=ta.parse,na=ta.parseRows;ta.format,ta.formatBody,ta.formatRows;ii(Wi.prototype,{convertUrlToData:function convertUrlToData(e){var n=this,i=1<arguments.length&&arguments[1]!==undefined?arguments[1]:"csv",a=2<arguments.length?arguments[2]:undefined,r=3<arguments.length?arguments[3]:undefined,o=4<arguments.length?arguments[4]:undefined,s=new XMLHttpRequest;a&&Object.keys(a).forEach(function(t){s.setRequestHeader(t,a[t])}),s.open("GET",e),s.onreadystatechange=function(){if(4===s.readyState){if(200!==s.status)throw new Error("".concat(e,": Something went wrong loading!"));var t=s.responseText;t&&o.call(n,n["convert".concat(ai(i),"ToData")]("json"===i?JSON.parse(t):t,r))}},s.send()},_convertCsvTsvToData:function _convertCsvTsvToData(t,e){var n,i=t.rows(e);return 1===i.length?(n=[{}],i[0].forEach(function(t){n[0][t]=null})):n=t.parse(e),n},convertCsvToData:function convertCsvToData(t){return this._convertCsvTsvToData({rows:Qi,parse:Ji},t)},convertTsvToData:function convertTsvToData(t){return this._convertCsvTsvToData({rows:na,parse:ea},t)},convertJsonToData:function convertJsonToData(n,t){var e,i,a=this,r=this.config,o=[];if(qn(n)){var s=t||r.data_keys;s.x?(e=s.value.concat(s.x),r.data_x=s.x):e=s.value,o.push(e),n.forEach(function(n){var t=e.map(function(t){var e=a.findValueInJson(n,t);return Yn(e)&&(e=null),e});o.push(t)}),i=this.convertRowsToData(o)}else Object.keys(n).forEach(function(t){var e=n[t].concat();e.unshift(t),o.push(e)}),i=this.convertColumnsToData(o);return i},findValueInJson:function findValueInJson(t,e){if(t[e]!==undefined)return t[e];var n=e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),i=t;return n.some(function(t){return!(i=i&&t in i?i[t]:undefined)}),i},convertRowsToData:function convertRowsToData(t){for(var e=t[0],n=[],i=1,a=t.length;i<a;i++){for(var r={},o=0,s=t[i].length;o<s;o++){if(Yn(t[i][o]))throw new Error("Source data is missing a component at (".concat(i,", ").concat(o,")!"));r[e[o]]=t[i][o]}n.push(r)}return n},convertColumnsToData:function convertColumnsToData(t){for(var e=[],n=0,i=t.length;n<i;n++)for(var a=t[n][0],r=1,o=t[n].length;r<o;r++){if(Yn(e[r-1])&&(e[r-1]={}),Yn(t[n][r]))throw new Error("Source data is missing a component at (".concat(n,", ").concat(r,")!"));e[r-1][a]=t[n][r]}return e},convertDataToTargets:function convertDataToTargets(t,i){var a,r=this,h=this,d=h.config,e=Object.keys(t[0]||{}),n=e.length?e.filter(h.isNotX,h):[],o=e.length?e.filter(h.isX,h):[];n.forEach(function(n){var e=r.getXKey(n);r.isCustomX()||r.isTimeSeries()?0<=o.indexOf(e)?a=(i&&h.data.xs[n]||[]).concat(t.map(function(t){return t[e]}).filter(In).map(function(t,e){return h.generateTargetX(t,n,e)})):d.data_x?a=r.getOtherTargetXs():jn(d.data_xs)&&(a=h.getXValuesOfXKey(e,h.data.targets)):a=t.map(function(t,e){return e}),a&&(r.data.xs[n]=a)}),n.forEach(function(t){if(!a)throw new Error('x is not defined for id = "'.concat(t,'".'))});var s=n.map(function(r,o){var s=d.data_idConverter(r),c=h.getXKey(r),u=h.isCustomX()&&h.isCategorized(),l=u&&t.map(function(t){return t.x}).every(function(t){return-1<d.axis_x_categories.indexOf(t)});return{id:s,id_org:r,values:t.map(function(t,e){var n,i=t[c],a=t[r];return a=null===a||isNaN(a)?qn(a)||Zn(a)&&a.high?a:null:+t[r],u&&0===o&&!Yn(i)?(!l&&0===o&&0===e&&(d.axis_x_categories=[]),-1===(n=d.axis_x_categories.indexOf(i))&&(n=d.axis_x_categories.length,d.axis_x_categories.push(i))):n=h.generateTargetX(i,r,e),(Yn(t[r])||h.data.xs[r].length<=e)&&(n=undefined),{x:n,value:a,id:s}}).filter(function(t){return Nn(t.x)})}});return s.forEach(function(t){d.data_xSort&&(t.values=t.values.sort(function(t,e){return(t.x||0===t.x?t.x:Infinity)-(e.x||0===e.x?e.x:Infinity)})),t.values.forEach(function(t,e){var n=h.data.targets?h.getIndexByX(t.x):null;t.index=null===n?e:n}),h.data.xs[t.id].sort(function(t,e){return t-e})}),h.hasNegativeValue=h.hasNegativeValueInTargets(s),h.hasPositiveValue=h.hasPositiveValueInTargets(s),d.data_type&&h.setTargetType(h.mapToIds(s).filter(function(t){return!(t in d.data_types)}),d.data_type),s.forEach(function(t){return h.addCache(t.id_org,t,!0)}),s}}),ii(Wi.prototype,{categoryName:function categoryName(t){var e=this.config;return t<e.axis_x_categories.length?e.axis_x_categories[t]:t}}),ii(Wi.prototype,{initEventRect:function initEventRect(){this.main.select(".".concat(dn.chart)).append("g").attr("class",dn.eventRects).style("fill-opacity","0")},redrawEventRect:function redrawEventRect(){var t,e=this,n=e.config,i=n.zoom_enabled,a=e.isMultipleX(),r=e.main.select(".".concat(dn.eventRects)).style("cursor",!i||!0!==i&&"wheel"!==i.type?null:n.axis_rotate?"ns-resize":"ew-resize").classed(dn.eventRectsMultiple,a).classed(dn.eventRectsSingle,!a);if(r.selectAll(".".concat(dn.eventRect)).remove(),e.eventRect=r.selectAll(".".concat(dn.eventRect)),a)t=e.eventRect.data([0]),t=e.generateEventRectsForMultipleXs(t.enter()).merge(t);else{var o=e.getMaxDataCountTarget(e.data.targets);r.datum(o?o.values:[]),e.eventRect=r.selectAll(".".concat(dn.eventRect)),(t=e.eventRect.data(function(t){return t})).exit().remove(),t=e.generateEventRectsForSingleX(t.enter()).merge(t)}e.updateEventRect(t),"touch"!==e.inputType||e.svg.on("touchstart.eventRect")||e.hasArcType()||e.bindTouchOnEventRect(a)},bindTouchOnEventRect:function bindTouchOnEventRect(r){var a,o=this,s=o.config,c=function(){var t=E.changedTouches[0];return O(document.elementFromPoint(t.clientX,t.clientY))},u=function(t){if(r)o.selectRectForMultipleXs(t);else{var e=c(),n=(a=(i=e)&&i.attr("class")&&1*i.attr("class").replace(new RegExp("(".concat(dn.eventRect,"-?|s)"),"g"),""),(isNaN(a)||null===a)&&(a=-1),a);o.callOverOutForTouch(n),-1===n?o.unselectRect():o.selectRectForSingle(t,e,n)}var i,a},t=s.interaction_inputType_touch.preventDefault,l=Bn(t)&&t||!1,h=!isNaN(t)&&t||null;o.svg.on("touchstart.eventRect touchmove.eventRect",function(){var t,e,n,i=c();if(!i.empty()&&i.classed(dn.eventRect)){if(o.dragging||o.flowing||o.hasArcType())return;e=(t=E).type,n=t.changedTouches[0]["client".concat(s.axis_rotated?"Y":"X")],"touchstart"===e?l?t.preventDefault():null!==h&&(a=n):"touchmove"===e&&(l||!0===a||null!==h&&Math.abs(a-n)>=h)&&(a=!0,t.preventDefault()),u(this)}else o.unselectRect(),o.callOverOutForTouch()}).on("touchend.eventRect",function(){var t=c();!t.empty()&&t.classed(dn.eventRect)&&(o.hasArcType()||!o.toggleShape||o.cancelClick)&&o.cancelClick&&(o.cancelClick=!1)})},updateEventRect:function updateEventRect(t){var e,n,i,a,r=this,o=r.config,s=r.zoomScale||r.x,c=t||r.eventRect.data(),u=o.axis_rotated;if(r.isMultipleX())n=e=0,i=r.width,a=r.height;else{var l,h;if(r.isCategorized())l=r.getEventRectWidth(),h=function(t){return s(t.x)-l/2};else{r.updateXs();var d=function(t){var e=t.index;return{prev:r.getPrevX(e),next:r.getNextX(e)}};l=function(t){var e=d(t);return null===e.prev&&null===e.next?u?r.height:r.width:(null===e.prev&&(e.prev=s.domain()[0]),null===e.next&&(e.next=s.domain()[1]),Math.max(0,(s(e.next)-s(e.prev))/2))},h=function(t){var e=d(t),n=r.data.xs[t.id][t.index];return null===e.prev&&null===e.next?0:(null===e.prev&&(e.prev=s.domain()[0]),(s(n)+s(e.prev))/2)}}e=u?0:h,n=u?h:0,i=u?r.width:l,a=u?l:r.height}c.attr("class",r.classEvent.bind(r)).attr("x",e).attr("y",n).attr("width",i).attr("height",a)},selectRectForSingle:function selectRectForSingle(n,i,a){var r=this,o=r.config,s=o.data_selection_enabled,c=o.data_selection_grouped,u=o.tooltip_grouped,t=r.getAllValuesOnIndex(a);u&&(r.showTooltip(t,n),r.showXGridFocus(t),!s||c)||r.main.selectAll(".".concat(dn.shape,"-").concat(a)).each(function(){O(this).classed(dn.EXPANDED,!0),s&&i.style("cursor",c?"pointer":null),u||(r.hideXGridFocus(),r.hideTooltip(),!c&&r.expandCirclesBars(a))}).filter(function(t){return r.isWithinShape(this,t)}).call(function(t){var e=t.data();s&&(c||o.data_selection_isselectable(e))&&i.style("cursor","pointer"),u||(r.showTooltip(e,n),r.showXGridFocus(e),r.unexpandCircles(),t.each(function(t){return r.expandCirclesBars(a,t.id)}))})},expandCirclesBars:function expandCirclesBars(t,e,n){this.config.point_focus_expand_enabled&&this.expandCircles(t,e,n),this.expandBars(t,e,n)},selectRectForMultipleXs:function selectRectForMultipleXs(t){var e=this,n=e.config,i=e.filterTargetsToShow(e.data.targets);if(!e.dragging&&!e.hasArcType(i)){var a=P(t),r=e.findClosestFromTargets(i,a);if(e.mouseover&&(!r||r.id!==e.mouseover.id)&&(n.data_onout.call(e.api,e.mouseover),e.mouseover=undefined),!r)return void e.unselectRect();var o=(e.isBubbleType(r)||e.isScatterType(r)||!n.tooltip_grouped?[r]:e.filterByX(i,r.x)).map(function(t){return e.addName(t)});e.showTooltip(o,t),e.expandCirclesBars(r.index,r.id,!0),e.showXGridFocus(o),(e.isBarType(r.id)||e.dist(r,a)<n.point_sensitivity)&&(e.svg.select(".".concat(dn.eventRect)).style("cursor","pointer"),!e.mouseover&&(n.data_onover.call(e.api,r),e.mouseover=r))}},unselectRect:function unselectRect(){this.svg.select(".".concat(dn.eventRect)).style("cursor",null),this.hideXGridFocus(),this.hideTooltip(),this._handleLinkedCharts(!1),this.unexpandCircles(),this.unexpandBars()},setOverOut:function setOverOut(t,e){var n=this.config,i=Zn(e);if(i||-1!==e){var a=n[t?"data_onover":"data_onout"].bind(this.api);n.color_onover&&this.setOverColor(t,e,i),i?a(e):(t&&this.expandCirclesBars(e,null,!0),!this.isMultipleX()&&this.main.selectAll(".".concat(dn.shape,"-").concat(e)).each(a))}},callOverOutForTouch:function callOverOutForTouch(t){var e=this.callOverOutForTouch,n=e.last;(Zn(t)&&n?t.id!==n.id:t!==n)&&((n||Pn(n))&&this.setOverOut(!1,n),(t||Pn(t))&&this.setOverOut(!0,t),e.last=t)},getDraggableSelection:function getDraggableSelection(){var t=this,e=t.config;return e.interaction_enabled&&e.data_selection_draggable&&t.drag?vn().on("drag",function(){t.drag(P(this))}).on("start",function(){t.dragstart(P(this))}).on("end",function(){t.dragend()}):function(){}},generateEventRectsForSingleX:function generateEventRectsForSingleX(t){var i=this,e=i.config,n=t.append("rect").attr("class",i.classEvent.bind(i)).style("cursor",e.data_selection_enabled&&e.data_selection_grouped?"pointer":null).on("click",function(t){i.clickHandlerForSingleX.bind(this)(t,i)}).call(i.getDraggableSelection());return"mouse"===i.inputType&&n.on("mouseover",function(t){i.dragging||i.flowing||i.hasArcType()||i.setOverOut(!0,t.index)}).on("mousemove",function(t){if(!(i.dragging||i.flowing||i.hasArcType())){var e=t.index,n=i.svg.select(".".concat(dn.eventRect,"-").concat(e));i.isStepType(t)&&"step-after"===i.config.line_step_type&&P(this)[0]<i.x(i.getXValue(t.id,e))&&(e-=1),-1===e?i.unselectRect():i.selectRectForSingle(this,n,e)}}).on("mouseout",function(t){!i.config||i.hasArcType()||(i.unselectRect(),i.setOverOut(!1,t.index))}),n},clickHandlerForSingleX:function clickHandlerForSingleX(t,e){var n=e,i=n.config;if(n.hasArcType()||!n.toggleShape||n.cancelClick)n.cancelClick&&(n.cancelClick=!1);else{var a=t.index;n.main.selectAll(".".concat(dn.shape,"-").concat(a)).each(function(t){(i.data_selection_grouped||n.isWithinShape(this,t))&&(n.toggleShape(this,t,a),i.data_onclick.call(n.api,t,this))})}},generateEventRectsForMultipleXs:function generateEventRectsForMultipleXs(t){var e=this,n=t.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("class",dn.eventRect).on("click",function(){e.clickHandlerForMultipleXS.bind(this)(e)}).call(e.getDraggableSelection());return"mouse"===e.inputType&&n.on("mouseover mousemove",function(){e.selectRectForMultipleXs(this)}).on("mouseout",function(){!e.config||e.hasArcType()||e.unselectRect()}),n},clickHandlerForMultipleXS:function clickHandlerForMultipleXS(t){var e=t,n=e.config,i=e.filterTargetsToShow(e.data.targets);if(!e.hasArcType(i)){var a=P(this),r=e.findClosestFromTargets(i,a);!r||(e.isBarType(r.id)||e.dist(r,a)<n.point_sensitivity)&&e.main.selectAll(".".concat(dn.shapes).concat(e.getTargetSelectorSuffix(r.id))).selectAll(".".concat(dn.shape,"-").concat(r.index)).each(function(){(n.data_selection_grouped||e.isWithinShape(this,r))&&(e.toggleShape(this,r,r.index),n.data_onclick.call(e.api,r,this))})}},dispatchEvent:function dispatchEvent(t,e,n){var i=this.isMultipleX(),a=".".concat(i?dn.eventRect:"".concat(dn.eventRect,"-").concat(e)),r=this.main.select(a).node(),o=r.getBoundingClientRect(),s=o.width,c=o.left,u=o.top,l=c+(n?n[0]:0)+(i?0:s/2),h=u+(n?n[1]:0);li[/^(mouse|click)/.test(t)?"mouse":"touch"](r,t,{screenX:l,screenY:h,clientX:l,clientY:h})}}),ii(Wi.prototype,{getCurrentWidth:function getCurrentWidth(){return this.config.size_width||this.getParentWidth()},getCurrentHeight:function getCurrentHeight(){var t=this.config,e=t.size_height||this.getParentHeight();return 0<e?e:320/(this.hasType("gauge")&&!t.gauge_fullCircle?2:1)},getAxisSize:function getAxisSize(t){var e=this.config.axis_rotated;return e&&"x"===t||!e&&/y2?/.test(t)?this.getAxisWidthByAxisId(t,!0):this.getHorizontalAxisHeight(t)},getCurrentPaddingTop:function getCurrentPaddingTop(){var t=this.config,e=t.axis_y2_axes.length,n=In(t.padding_top)?t.padding_top:0;return this.title&&this.title.node()&&(n+=this.getTitlePadding()),e&&t.axis_rotated&&(n+=this.getHorizontalAxisHeight("y2")*e),n},getCurrentPaddingBottom:function getCurrentPaddingBottom(){var t=this.config,e=t.axis_rotated?"y":"x",n=t["axis_".concat(e,"_axes")].length;return(In(t.padding_bottom)?t.padding_bottom:0)+(n?this.getHorizontalAxisHeight(e)*n:0)},getCurrentPaddingLeft:function getCurrentPaddingLeft(t){var e=this.config,n=e.axis_rotated,i=n?"x":"y",a=e["axis_".concat(i,"_axes")].length,r=this.getAxisWidthByAxisId(i,t);return(In(e.padding_left)?e.padding_left:n?e.axis_x_show?Math.max(Hn(r),40):1:!e.axis_y_show||e.axis_y_inner?this.axis.getYAxisLabelPosition().isOuter?30:1:Hn(r))+r*a},getCurrentPaddingRight:function getCurrentPaddingRight(){var t=this.config,e=this.isLegendRight?this.getLegendWidth()+20:0,n=t.axis_y2_axes.length,i=this.getAxisWidthByAxisId("y2");return(In(t.padding_right)?t.padding_right+1:t.axis_rotated?10+e:!t.axis_y2_show||t.axis_y2_inner?2+e+(this.axis.getY2AxisLabelPosition().isOuter?20:0):Hn(i)+e)+i*n},getParentRectValue:function getParentRectValue(t){for(var e,n="offset".concat(ai(t)),i=this.selectChart.node();!e&&i&&"BODY"!==i.tagName;){try{e=i.getBoundingClientRect()[t]}catch(r){n in i&&(e=i[n])}i=i.parentNode}if("width"===t){var a=document.body.offsetWidth;a<e&&(e=a)}return e},getParentWidth:function getParentWidth(){return this.getParentRectValue("width")},getParentHeight:function getParentHeight(){var t=this.selectChart.style("height");return 0<t.indexOf("px")?parseInt(t,10):0},getSvgLeft:function getSvgLeft(t){var e=this.config,n=e.axis_rotated||!e.axis_rotated&&!e.axis_y_inner,i=e.axis_rotated?dn.axisX:dn.axisY,a=this.main.select(".".concat(i)).node(),r=a&&n?a.getBoundingClientRect():{right:0},o=this.selectChart.node().getBoundingClientRect(),s=this.hasArcType(),c=r.right-o.left-(s?0:this.getCurrentPaddingLeft(t));return 0<c?c:0},getAxisWidthByAxisId:function getAxisWidthByAxisId(t,e){var n=this.axis.getLabelPositionById(t);return this.axis.getMaxTickWidth(t,e)+(n.isInner?20:40)},getHorizontalAxisHeight:function getHorizontalAxisHeight(t){var e=this.config,n=e.axis_rotated,i=30;return"x"!==t||e.axis_x_show?"x"===t&&e.axis_x_height?e.axis_x_height:"y"!==t||e.axis_y_show?"y2"!==t||e.axis_y2_show?(("x"===t&&!n&&e.axis_x_tick_rotate||"y"===t&&n&&e.axis_y_tick_rotate)&&(i=30+this.axis.getMaxTickWidth(t)*Math.cos(Math.PI*(90-e["axis_".concat(t,"_tick_rotate")])/180)),i+(this.axis.getLabelPositionById(t).isInner?0:10)+("y2"!==t||n?0:-10)):this.rotated_padding_top:!e.legend_show||this.isLegendRight||this.isLegendInset?1:10:8},getEventRectWidth:function getEventRectWidth(){return Math.max(0,this.xAxis.tickInterval())}});var ia=Math.PI,aa=2*ia,ra=1e-6,oa=aa-ra;function Path(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function path_path(){return new Path}Path.prototype=path_path.prototype={constructor:Path,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,a,r){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+a)+","+(this._y1=+r)},arcTo:function(t,e,n,i,a){t=+t,e=+e,n=+n,i=+i,a=+a;var r=this._x1,o=this._y1,s=n-t,c=i-e,u=r-t,l=o-e,h=u*u+l*l;if(a<0)throw new Error("negative radius: "+a);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(ra<h)if(Math.abs(l*s-c*u)>ra&&a){var d=n-r,f=i-o,g=s*s+c*c,p=d*d+f*f,_=Math.sqrt(g),m=Math.sqrt(h),x=a*Math.tan((ia-Math.acos((g+h-p)/(2*_*m)))/2),y=x/m,v=x/_;Math.abs(y-1)>ra&&(this._+="L"+(t+y*u)+","+(e+y*l)),this._+="A"+a+","+a+",0,0,"+ +(u*f<l*d)+","+(this._x1=t+v*s)+","+(this._y1=e+v*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,a,r){t=+t,e=+e;var o=(n=+n)*Math.cos(i),s=n*Math.sin(i),c=t+o,u=e+s,l=1^r,h=r?i-a:a-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+u:(Math.abs(this._x1-c)>ra||Math.abs(this._y1-u)>ra)&&(this._+="L"+c+","+u),n&&(h<0&&(h=h%aa+aa),oa<h?this._+="A"+n+","+n+",0,1,"+l+","+(t-o)+","+(e-s)+"A"+n+","+n+",0,1,"+l+","+(this._x1=c)+","+(this._y1=u):ra<h&&(this._+="A"+n+","+n+",0,"+ +(ia<=h)+","+l+","+(this._x1=t+n*Math.cos(a))+","+(this._y1=e+n*Math.sin(a))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var sa=path_path,ca=function(t){return function b(){return t}},ua=Math.abs,la=Math.atan2,ha=Math.cos,da=Math.max,fa=Math.min,ga=Math.sin,pa=Math.sqrt,_a=1e-12,ma=Math.PI,xa=ma/2,ya=2*ma;function asin(t){return 1<=t?xa:t<=-1?-xa:Math.asin(t)}function arcInnerRadius(t){return t.innerRadius}function arcOuterRadius(t){return t.outerRadius}function arcStartAngle(t){return t.startAngle}function arcEndAngle(t){return t.endAngle}function arcPadAngle(t){return t&&t.padAngle}function cornerTangents(t,e,n,i,a,r,o){var s=t-n,c=e-i,u=(o?r:-r)/pa(s*s+c*c),l=u*c,h=-u*s,d=t+l,f=e+h,g=n+l,p=i+h,_=(d+g)/2,m=(f+p)/2,x=g-d,y=p-f,v=x*x+y*y,b=a-r,T=d*p-g*f,w=(y<0?-1:1)*pa(da(0,b*b*v-T*T)),A=(T*y-x*w)/v,k=(-T*x-y*w)/v,C=(T*y+x*w)/v,S=(-T*x+y*w)/v,M=A-_,L=k-m,D=C-_,F=S-m;return D*D+F*F<M*M+L*L&&(A=C,k=S),{cx:A,cy:k,x01:-l,y01:-h,x11:A*(a/b-1),y11:k*(a/b-1)}}var va=function(){var P=arcInnerRadius,Y=arcOuterRadius,N=ca(0),B=null,H=arcStartAngle,V=arcEndAngle,U=arcPadAngle,W=null;function arc(){var t,e,n=+P.apply(this,arguments),i=+Y.apply(this,arguments),a=H.apply(this,arguments)-xa,r=V.apply(this,arguments)-xa,o=ua(r-a),s=a<r;if(W||(W=t=sa()),i<n&&(e=i,i=n,n=e),_a<i)if(ya-_a<o)W.moveTo(i*ha(a),i*ga(a)),W.arc(0,0,i,a,r,!s),_a<n&&(W.moveTo(n*ha(r),n*ga(r)),W.arc(0,0,n,r,a,s));else{var c,u,l=a,h=r,d=a,f=r,g=o,p=o,_=U.apply(this,arguments)/2,m=_a<_&&(B?+B.apply(this,arguments):pa(n*n+i*i)),x=fa(ua(i-n)/2,+N.apply(this,arguments)),y=x,v=x;if(_a<m){var b=asin(m/n*ga(_)),T=asin(m/i*ga(_));(g-=2*b)>_a?(d+=b*=s?1:-1,f-=b):(g=0,d=f=(a+r)/2),(p-=2*T)>_a?(l+=T*=s?1:-1,h-=T):(p=0,l=h=(a+r)/2)}var w=i*ha(l),A=i*ga(l),k=n*ha(f),C=n*ga(f);if(_a<x){var S,M=i*ha(h),L=i*ga(h),D=n*ha(d),F=n*ga(d);if(o<ma&&(S=function intersect(t,e,n,i,a,r,o,s){var c=n-t,u=i-e,l=o-a,h=s-r,d=h*c-l*u;if(!(d*d<_a))return[t+(d=(l*(e-r)-h*(t-a))/d)*c,e+d*u]}(w,A,D,F,M,L,k,C))){var R=w-S[0],z=A-S[1],X=M-S[0],I=L-S[1],E=1/ga(function acos(t){return 1<t?0:t<-1?ma:Math.acos(t)}((R*X+z*I)/(pa(R*R+z*z)*pa(X*X+I*I)))/2),O=pa(S[0]*S[0]+S[1]*S[1]);y=fa(x,(n-O)/(E-1)),v=fa(x,(i-O)/(E+1))}}_a<p?_a<v?(c=cornerTangents(D,F,w,A,i,v,s),u=cornerTangents(M,L,k,C,i,v,s),W.moveTo(c.cx+c.x01,c.cy+c.y01),v<x?W.arc(c.cx,c.cy,v,la(c.y01,c.x01),la(u.y01,u.x01),!s):(W.arc(c.cx,c.cy,v,la(c.y01,c.x01),la(c.y11,c.x11),!s),W.arc(0,0,i,la(c.cy+c.y11,c.cx+c.x11),la(u.cy+u.y11,u.cx+u.x11),!s),W.arc(u.cx,u.cy,v,la(u.y11,u.x11),la(u.y01,u.x01),!s))):(W.moveTo(w,A),W.arc(0,0,i,l,h,!s)):W.moveTo(w,A),_a<n&&_a<g?_a<y?(c=cornerTangents(k,C,M,L,n,-y,s),u=cornerTangents(w,A,D,F,n,-y,s),W.lineTo(c.cx+c.x01,c.cy+c.y01),y<x?W.arc(c.cx,c.cy,y,la(c.y01,c.x01),la(u.y01,u.x01),!s):(W.arc(c.cx,c.cy,y,la(c.y01,c.x01),la(c.y11,c.x11),!s),W.arc(0,0,n,la(c.cy+c.y11,c.cx+c.x11),la(u.cy+u.y11,u.cx+u.x11),s),W.arc(u.cx,u.cy,y,la(u.y11,u.x11),la(u.y01,u.x01),!s))):W.arc(0,0,n,f,d,s):W.lineTo(k,C)}else W.moveTo(0,0);if(W.closePath(),t)return W=null,t+""||null}return arc.centroid=function(){var t=(+P.apply(this,arguments)+ +Y.apply(this,arguments))/2,e=(+H.apply(this,arguments)+ +V.apply(this,arguments))/2-ma/2;return[ha(e)*t,ga(e)*t]},arc.innerRadius=function(t){return arguments.length?(P="function"==typeof t?t:ca(+t),arc):P},arc.outerRadius=function(t){return arguments.length?(Y="function"==typeof t?t:ca(+t),arc):Y},arc.cornerRadius=function(t){return arguments.length?(N="function"==typeof t?t:ca(+t),arc):N},arc.padRadius=function(t){return arguments.length?(B=null==t?null:"function"==typeof t?t:ca(+t),arc):B},arc.startAngle=function(t){return arguments.length?(H="function"==typeof t?t:ca(+t),arc):H},arc.endAngle=function(t){return arguments.length?(V="function"==typeof t?t:ca(+t),arc):V},arc.padAngle=function(t){return arguments.length?(U="function"==typeof t?t:ca(+t),arc):U},arc.context=function(t){return arguments.length?(W=null==t?null:t,arc):W},arc};function Linear(t){this._context=t}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var ba=function(t){return new Linear(t)};function point_x(t){return t[0]}function point_y(t){return t[1]}var Ta=function(){var o=point_x,s=point_y,c=ca(!0),u=null,l=ba,h=null;function line(t){var e,n,i,a=t.length,r=!1;for(null==u&&(h=l(i=sa())),e=0;e<=a;++e)!(e<a&&c(n=t[e],e,t))===r&&((r=!r)?h.lineStart():h.lineEnd()),r&&h.point(+o(n,e,t),+s(n,e,t));if(i)return h=null,i+""||null}return line.x=function(t){return arguments.length?(o="function"==typeof t?t:ca(+t),line):o},line.y=function(t){return arguments.length?(s="function"==typeof t?t:ca(+t),line):s},line.defined=function(t){return arguments.length?(c="function"==typeof t?t:ca(!!t),line):c},line.curve=function(t){return arguments.length?(l=t,null!=u&&(h=l(u)),line):l},line.context=function(t){return arguments.length?(null==t?u=h=null:h=l(u=t),line):u},line},wa=function(){var l=point_x,h=null,d=ca(0),f=point_y,g=ca(!0),p=null,_=ba,m=null;function area(t){var e,n,i,a,r,o=t.length,s=!1,c=new Array(o),u=new Array(o);for(null==p&&(m=_(r=sa())),e=0;e<=o;++e){if(!(e<o&&g(a=t[e],e,t))===s)if(s=!s)n=e,m.areaStart(),m.lineStart();else{for(m.lineEnd(),m.lineStart(),i=e-1;n<=i;--i)m.point(c[i],u[i]);m.lineEnd(),m.areaEnd()}s&&(c[e]=+l(a,e,t),u[e]=+d(a,e,t),m.point(h?+h(a,e,t):c[e],f?+f(a,e,t):u[e]))}if(r)return m=null,r+""||null}function arealine(){return Ta().defined(g).curve(_).context(p)}return area.x=function(t){return arguments.length?(l="function"==typeof t?t:ca(+t),h=null,area):l},area.x0=function(t){return arguments.length?(l="function"==typeof t?t:ca(+t),area):l},area.x1=function(t){return arguments.length?(h=null==t?null:"function"==typeof t?t:ca(+t),area):h},area.y=function(t){return arguments.length?(d="function"==typeof t?t:ca(+t),f=null,area):d},area.y0=function(t){return arguments.length?(d="function"==typeof t?t:ca(+t),area):d},area.y1=function(t){return arguments.length?(f=null==t?null:"function"==typeof t?t:ca(+t),area):f},area.lineX0=area.lineY0=function(){return arealine().x(l).y(d)},area.lineY1=function(){return arealine().x(l).y(f)},area.lineX1=function(){return arealine().x(h).y(d)},area.defined=function(t){return arguments.length?(g="function"==typeof t?t:ca(!!t),area):g},area.curve=function(t){return arguments.length?(_=t,null!=p&&(m=_(p)),area):_},area.context=function(t){return arguments.length?(null==t?p=m=null:m=_(p=t),area):p},area},Aa=function(t,e){return e<t?-1:t<e?1:t<=e?0:NaN},ka=function(t){return t};curveRadial(ba);function Radial(t){this._curve=t}function curveRadial(e){function radial(t){return new Radial(e(t))}return radial._curve=e,radial}Radial.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};Array.prototype.slice;Math.sqrt(1/3);var Ca=Math.sin(ma/10)/Math.sin(7*ma/10),Sa=(Math.sin(ya/10),Math.cos(ya/10),Math.sqrt(3),Math.sqrt(3),Math.sqrt(12),function(){});function basis_point(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Basis(t){this._context=t}Basis.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:basis_point(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:basis_point(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};var Ma=function(t){return new Basis(t)};function BasisClosed(t){this._context=t}BasisClosed.prototype={areaStart:Sa,areaEnd:Sa,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:basis_point(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};var La=function(t){return new BasisClosed(t)};function BasisOpen(t){this._context=t}BasisOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,i=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:basis_point(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};var Da=function(t){return new BasisOpen(t)};function Bundle(t,e){this._basis=new Basis(t),this._beta=e}Bundle.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(0<n)for(var i,a=t[0],r=e[0],o=t[n]-a,s=e[n]-r,c=-1;++c<=n;)i=c/n,this._basis.point(this._beta*t[c]+(1-this._beta)*(a+i*o),this._beta*e[c]+(1-this._beta)*(r+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Fa=function custom(e){function bundle(t){return 1===e?new Basis(t):new Bundle(t,e)}return bundle.beta=function(t){return custom(+t)},bundle}(.85);function cardinal_point(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Cardinal(t,e){this._context=t,this._k=(1-e)/6}Cardinal.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:cardinal_point(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:cardinal_point(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ra=function custom(e){function cardinal(t){return new Cardinal(t,e)}return cardinal.tension=function(t){return custom(+t)},cardinal}(0);function CardinalClosed(t,e){this._context=t,this._k=(1-e)/6}CardinalClosed.prototype={areaStart:Sa,areaEnd:Sa,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:cardinal_point(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var za=function custom(e){function cardinal(t){return new CardinalClosed(t,e)}return cardinal.tension=function(t){return custom(+t)},cardinal}(0);function CardinalOpen(t,e){this._context=t,this._k=(1-e)/6}CardinalOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:cardinal_point(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Xa=function custom(e){function cardinal(t){return new CardinalOpen(t,e)}return cardinal.tension=function(t){return custom(+t)},cardinal}(0);function catmullRom_point(t,e,n){var i=t._x1,a=t._y1,r=t._x2,o=t._y2;if(t._l01_a>_a){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,a=(a*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>_a){var u=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);r=(r*u+t._x1*t._l23_2a-e*t._l12_2a)/l,o=(o*u+t._y1*t._l23_2a-n*t._l12_2a)/l}t._context.bezierCurveTo(i,a,r,o,t._x2,t._y2)}function CatmullRom(t,e){this._context=t,this._alpha=e}CatmullRom.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:catmullRom_point(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ia=function custom(e){function catmullRom(t){return e?new CatmullRom(t,e):new Cardinal(t,0)}return catmullRom.alpha=function(t){return custom(+t)},catmullRom}(.5);function CatmullRomClosed(t,e){this._context=t,this._alpha=e}CatmullRomClosed.prototype={areaStart:Sa,areaEnd:Sa,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:catmullRom_point(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ea=function custom(e){function catmullRom(t){return e?new CatmullRomClosed(t,e):new CardinalClosed(t,0)}return catmullRom.alpha=function(t){return custom(+t)},catmullRom}(.5);function CatmullRomOpen(t,e){this._context=t,this._alpha=e}CatmullRomOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:catmullRom_point(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Oa=function custom(e){function catmullRom(t){return e?new CatmullRomOpen(t,e):new CardinalOpen(t,0)}return catmullRom.alpha=function(t){return custom(+t)},catmullRom}(.5);function LinearClosed(t){this._context=t}LinearClosed.prototype={areaStart:Sa,areaEnd:Sa,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};var Pa=function(t){return new LinearClosed(t)};function monotone_sign(t){return t<0?-1:1}function slope3(t,e,n){var i=t._x1-t._x0,a=e-t._x1,r=(t._y1-t._y0)/(i||a<0&&-0),o=(n-t._y1)/(a||i<0&&-0),s=(r*a+o*i)/(i+a);return(monotone_sign(r)+monotone_sign(o))*Math.min(Math.abs(r),Math.abs(o),.5*Math.abs(s))||0}function slope2(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function monotone_point(t,e,n){var i=t._x0,a=t._y0,r=t._x1,o=t._y1,s=(r-i)/3;t._context.bezierCurveTo(i+s,a+s*e,r-s,o-s*n,r,o)}function MonotoneX(t){this._context=t}function MonotoneY(t){this._context=new ReflectContext(t)}function ReflectContext(t){this._context=t}function monotoneX(t){return new MonotoneX(t)}function monotoneY(t){return new MonotoneY(t)}function Natural(t){this._context=t}function controlPoints(t){var e,n,i=t.length-1,a=new Array(i),r=new Array(i),o=new Array(i);for(r[a[0]=0]=2,o[0]=t[0]+2*t[1],e=1;e<i-1;++e)a[e]=1,r[e]=4,o[e]=4*t[e]+2*t[e+1];for(a[i-1]=2,r[i-1]=7,o[i-1]=8*t[i-1]+t[i],e=1;e<i;++e)n=a[e]/r[e-1],r[e]-=n,o[e]-=n*o[e-1];for(a[i-1]=o[i-1]/r[i-1],e=i-2;0<=e;--e)a[e]=(o[e]-a[e+1])/r[e];for(r[i-1]=(t[i]+a[i-1])/2,e=0;e<i-1;++e)r[e]=2*t[e+1]-a[e+1];return[a,r]}MonotoneX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:monotone_point(this,this._t0,slope2(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,monotone_point(this,slope2(this,n=slope3(this,t,e)),n);break;default:monotone_point(this,this._t0,n=slope3(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(MonotoneY.prototype=Object.create(MonotoneX.prototype)).point=function(t,e){MonotoneX.prototype.point.call(this,e,t)},ReflectContext.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,i,a,r){this._context.bezierCurveTo(e,t,i,n,r,a)}},Natural.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var i=controlPoints(t),a=controlPoints(e),r=0,o=1;o<n;++r,++o)this._context.bezierCurveTo(i[0][r],a[0][r],i[1][r],a[1][r],t[o],e[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Ya=function(t){return new Natural(t)};function Step(t,e){this._context=t,this._t=e}Step.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),0<=this._line&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var Na=function(t){return new Step(t,.5)};function stepBefore(t){return new Step(t,0)}function stepAfter(t){return new Step(t,1)}ii(Wi.prototype,{getShapeIndices:function getShapeIndices(t){var r=this.config,o={},s=0;return this.filterTargetsToShow(this.data.targets.filter(t,this)).forEach(function(t){for(var e,n=0;e=r.data_groups[n];n++)if(!(e.indexOf(t.id)<0))for(var i,a=0;i=e[a];a++)if(i in o){o[t.id]=o[i];break}Yn(o[t.id])&&(o[t.id]=s++)}),o.__max__=s-1,o},getShapeX:function getShapeX(a,r,o,t){var s=t?this.subX:this.zoomScale||this.x,c=this.config.bar_padding,u=function(t,e){return t+e},l=Wn(a)&&a.total.length?a.total.reduce(u)/2:0;return function(t){var e=t.id in o?o[t.id]:0,n=0;if(jn(t.x)){var i=s(t.x);n=l?i-(a[t.id]||a.width)+a.total.slice(0,e+1).reduce(u)-l:i-(Pn(a)?a:a.width)*(r/2-e)}return a&&n&&1<r&&c&&(e&&(n+=c*e),2<r?n-=(r-1)*c/2:2===r&&(n-=c/2)),n}},getShapeY:function getShapeY(e){var n=this,i=n.isStackNormalized();return function(t){return(e?n.getSubYScale(t.id):n.getYScale(t.id))(i?n.getRatio("index",t,!0):t.value)}},getShapeOffset:function getShapeOffset(t,h,e){var d=this,n=d.orderTargets(d.filterTargetsToShow(d.data.targets.filter(t,d))),f=n.map(function(t){return t.id}),g=d.isStackNormalized();return function(a,t){var r,o=e?d.getSubYScale(a.id):d.getYScale(a.id),s=o(0),c=s,u=t,l=+a.x;return g&&(r=d.getTotalPerIndex()),n.forEach(function(t){if(t.id!==a.id&&h[t.id]===h[a.id]){var e=t.values;if(f.indexOf(t.id)<f.indexOf(a.id)&&((Yn(e[u])||+e[u].x!==l)&&(u=-1,e.forEach(function(t,e){+t.x===l&&(u=e)})),u in e&&0<=e[u].value*a.value)){var n=e[u],i=g?d.getRatio("index",n,!0,r):n.value;c+=o(i)-s}}}),c}},isWithinShape:function isWithinShape(t,e){var n,i=O(t);return this.isTargetToShow(e.id)?this.hasValidPointType(t.nodeName)?n=this.isStepType(e)?this.isWithinStep(t,this.getYScale(e.id)(e.value)):this.isWithinCircle(t,1.5*this.pointSelectR(e)):"path"===t.nodeName&&(n=!i.classed(dn.bar)||this.isWithinBar(t)):n=!1,n},getInterpolate:function getInterpolate(t){var e=this.getInterpolateType(t);return{basis:Ma,"basis-closed":La,"basis-open":Da,bundle:Fa,cardinal:Ra,"cardinal-closed":za,"cardinal-open":Xa,"catmull-rom":Ia,"catmull-rom-closed":Ea,"catmull-rom-open":Oa,"monotone-x":monotoneX,"monotone-y":monotoneY,natural:Ya,"linear-closed":Pa,linear:ba,step:Na,"step-after":stepAfter,"step-before":stepBefore}[e]},getInterpolateType:function getInterpolateType(t){var e=this.config.spline_interpolation_type,n=this.isInterpolationType(e)?e:"cardinal";return this.isSplineType(t)?n:this.isStepType(t)?this.config.line_step_type:"linear"}}),ii(Wi.prototype,{initPie:function initPie(){var t=this.config,e=t.pie_padding,n=this.hasType("pie")&&e?.01*e:t["".concat(t.data_type,"_padAngle")]?t["".concat(t.data_type,"_padAngle")]:0;this.pie=function(){var g=ka,p=Aa,_=null,m=ca(0),x=ca(ya),y=ca(0);function pie(n){var t,e,i,a,r,o=n.length,s=0,c=new Array(o),u=new Array(o),l=+m.apply(this,arguments),h=Math.min(ya,Math.max(-ya,x.apply(this,arguments)-l)),d=Math.min(Math.abs(h)/o,y.apply(this,arguments)),f=d*(h<0?-1:1);for(t=0;t<o;++t)0<(r=u[c[t]=t]=+g(n[t],t,n))&&(s+=r);for(null!=p?c.sort(function(t,e){return p(u[t],u[e])}):null!=_&&c.sort(function(t,e){return _(n[t],n[e])}),t=0,i=s?(h-o*f)/s:0;t<o;++t,l=a)e=c[t],a=l+(0<(r=u[e])?r*i:0)+f,u[e]={data:n[e],index:t,value:r,startAngle:l,endAngle:a,padAngle:d};return u}return pie.value=function(t){return arguments.length?(g="function"==typeof t?t:ca(+t),pie):g},pie.sortValues=function(t){return arguments.length?(p=t,_=null,pie):p},pie.sort=function(t){return arguments.length?(_=t,p=null,pie):_},pie.startAngle=function(t){return arguments.length?(m="function"==typeof t?t:ca(+t),pie):m},pie.endAngle=function(t){return arguments.length?(x="function"==typeof t?t:ca(+t),pie):x},pie.padAngle=function(t){return arguments.length?(y="function"==typeof t?t:ca(+t),pie):y},pie}().padAngle(n).value(function(t){return t.values.reduce(function(t,e){return t+e.value},0)}),t.data_order||this.pie.sort(null)},updateRadius:function updateRadius(){var t=this,e=t.config,n=e.pie_innerRadius,i=e.pie_padding,a=e.gauge_width||e.donut_width;t.radiusExpanded=Math.min(t.arcWidth,t.arcHeight)/2,t.radius=.95*t.radiusExpanded,t.innerRadiusRatio=a?(t.radius-a)/t.radius:.6;var r=n||(i?i*(t.innerRadiusRatio+.1):0);t.innerRadius=t.hasType("donut")||t.hasType("gauge")?t.radius*t.innerRadiusRatio:r},updateArc:function updateArc(){this.svgArc=this.getSvgArc(),this.svgArcExpanded=this.getSvgArcExpanded(),this.svgArcExpandedSub=this.getSvgArcExpanded(.98)},updateAngle:function updateAngle(t){var e,n,i,a,r=this.config,o=t,s=!1,c=0;return r?(this.pie(this.filterTargetsToShow(this.data.targets)).forEach(function(t){s||t.data.id!==o.data.id||(s=!0,(o=t).index=c),c++}),isNaN(o.startAngle)&&(o.startAngle=0),isNaN(o.endAngle)&&(o.endAngle=o.startAngle),this.isGaugeType(o.data)&&(e=r.gauge_min,n=r.gauge_max,i=Math.PI*(r.gauge_fullCircle?2:1)/(n-e),a=o.value<e?0:o.value<n?o.value-e:n-e,o.startAngle=r.gauge_startingAngle,o.endAngle=o.startAngle+i*a),s?o:null):null},getSvgArc:function getSvgArc(){var a=this,r=va().outerRadius(a.radius).innerRadius(a.innerRadius),t=function(t,e){var n="M 0 0";if("value"in t?0<t.value:t.data){var i=!e&&a.updateAngle(t);e?n=r(t):i&&(n=r(i))}return n};return t.centroid=r.centroid,t},getSvgArcExpanded:function getSvgArcExpanded(t){var n=this,i=va().outerRadius(n.radiusExpanded*(t||1)).innerRadius(n.innerRadius);return function(t){var e=n.updateAngle(t);return e?i(e):"M 0 0"}},getArc:function getArc(t,e,n){return n||this.isArcType(t.data)?this.svgArc(t,e):"M 0 0"},transformForArcLabel:function transformForArcLabel(t){var e=this,n=e.config,i=e.updateAngle(t),a="";if(i&&!e.hasType("gauge")){var r=this.svgArc.centroid(i),o=isNaN(r[0])?0:r[0],s=isNaN(r[1])?0:r[1],c=Math.sqrt(o*o+s*s),u=e.hasType("donut")&&n.donut_label_ratio||e.hasType("pie")&&n.pie_label_ratio;u=u?En(u)?u(t,e.radius,c):u:e.radius&&(c?(.375<36/e.radius?1.175-36/e.radius:.8)*e.radius/c:0),a="translate(".concat(o*u,",").concat(s*u,")")}return a},convertToArcData:function convertToArcData(t){return this.addName({id:t.data.id,value:t.value,ratio:this.getRatio("arc",t),index:t.index})},textForArcLabel:function textForArcLabel(n){var t=n.node?n.datum():n;if(!this.shouldShowArcLabel())return"";var e=this.updateAngle(t),i=e?e.value:null,a=this.getRatio("arc",e),r=t.data.id;if(!this.hasType("gauge")&&!this.meetsArcLabelThreshold(a))return"";var o=(this.getArcLabelFormat()||this.defaultArcValueFormat)(i,a,r).toString();if(n.node)if(-1===o.indexOf("\n"))n.text(o);else{var s=o.split("\n"),c=s.length-1;s.forEach(function(t,e){n.append("tspan").attr("x",0).attr("dy","".concat(0===e?-c:1,"em")).text(t)})}return o},textForGaugeMinMax:function textForGaugeMinMax(t,e){var n=this.getGaugeLabelExtents();return n?n(t,e):t},expandArc:function expandArc(t){var n=this;if(n.transiting)var e=setInterval(function(){n.transiting||(clearInterval(e),0<n.legend.selectAll(".".concat(dn.legendItemFocused)).size()&&n.expandArc(t))},10);else{var i=n.mapToTargetIds(t);n.svg.selectAll(n.selectorTargets(i,".".concat(dn.chartArc))).each(function(t){if(n.shouldExpand(t.data.id)&&0!==t.value){var e=n.expandDuration(t.data.id);O(this).selectAll("path").transition().duration(e).attr("d",n.svgArcExpanded).transition().duration(2*e).attr("d",n.svgArcExpandedSub)}})}},unexpandArc:function unexpandArc(t){var e=this;if(!e.transiting){var n=e.mapToTargetIds(t);e.svg.selectAll(e.selectorTargets(n,".".concat(dn.chartArc))).selectAll("path").transition().duration(function(t){return e.expandDuration(t.data.id)}).attr("d",e.svgArc),e.svg.selectAll("".concat(dn.arc)).style("opacity","1")}},expandDuration:function expandDuration(t){var e,n=this.config;return this.isDonutType(t)?e="donut":this.isGaugeType(t)?e="gauge":this.isPieType(t)&&(e="pie"),e?n["".concat(e,"_expand_duration")]:50},shouldExpand:function shouldExpand(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 shouldShowArcLabel(){var t=this.config,e=!0;return this.hasType("donut")?e=t.donut_label_show:this.hasType("pie")&&(e=t.pie_label_show),e},meetsArcLabelThreshold:function meetsArcLabelThreshold(t){var e=this.config;return(this.hasType("donut")?e.donut_label_threshold:e.pie_label_threshold)<=t},getArcLabelFormat:function getArcLabelFormat(){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),e},getGaugeLabelExtents:function getGaugeLabelExtents(){return this.config.gauge_label_extents},getArcTitle:function getArcTitle(){return this.hasType("donut")?this.config.donut_title:""},updateTargetsForArc:function updateTargetsForArc(t){var e=this.main,n=this.classChartArc.bind(this),i=this.classArcs.bind(this),a=this.classFocus.bind(this),r=e.select(".".concat(dn.chartArcs)).selectAll(".".concat(dn.chartArc)).data(this.pie(t)).attr("class",function(t){return n(t)+a(t.data)}),o=r.enter().append("g").attr("class",n);o.append("g").attr("class",i).merge(r),o.append("text").attr("dy",this.hasType("gauge")?"-.1em":".35em").style("opacity","0").style("text-anchor","middle").style("pointer-events","none")},initArc:function initArc(){this.arcs=this.main.select(".".concat(dn.chart)).append("g").attr("class",dn.chartArcs).attr("transform",this.getTranslate("arc")),this.setArcTitle()},setArcTitle:function setArcTitle(){var t=this.getArcTitle();if(t){var e=t.split("\n"),n=this.arcs.append("text").attr("class",dn.chartArcsTitle).style("text-anchor","middle");if(1<e.length){var i=+n.style("font-size").replace("px",""),a=Math.floor(n.text(".").node().getBBox().height,n.text(""));e.forEach(function(t,e){return n.insert("tspan").text(t).attr("x",0).attr("dy",e?a:0)}),n.attr("y","-".concat(i*(e.length-2)||i/2))}else n.text(t)}},redrawArc:function redrawArc(t,e,n){var a=this,i=a.config,r=a.main,o=i.interaction_enabled,s=r.selectAll(".".concat(dn.arcs)).selectAll(".".concat(dn.arc)).data(a.arcData.bind(a));s.exit().transition().duration(e).style("opacity","0").remove(),(s=s.enter().append("path").attr("class",a.classArc.bind(a)).style("fill",function(t){return a.color(t.data)}).style("cursor",function(t){return o&&(i.data_selection_isselectable(t)?"pointer":null)}).style("opacity","0").each(function(t){a.isGaugeType(t.data)&&(t.startAngle=i.gauge_startingAngle,t.endAngle=i.gauge_startingAngle),this._current=t}).merge(s)).attr("transform",function(t){return!a.isGaugeType(t.data)&&n?"scale(0)":""}).style("opacity",function(t){return t===this._current?"0":"1"}).each(function(){a.transiting=!0}).transition().duration(t).attrTween("d",function(n){var t=a.updateAngle(n);if(!t)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=He(this._current,t);return this._current=i(0),function(t){var e=i(t);return e.data=n.data,a.getArc(e,!0)}}).attr("transform",n?"scale(1)":"").style("fill",function(t){return a.levelColor?a.levelColor(t.data.values[0].value):a.color(t.data.id)}).style("opacity","1").call(a.endall,function(){a.transiting=!1}),o&&a.bindArcEvent(s),a.redrawArcText(t)},bindArcEvent:function bindArcEvent(t){function selectArc(t,e,n){r.expandArc(n),r.api.focus(n),r.toggleFocusLegend(n,!0),r.showTooltip([e],t)}function unselectArc(t){var e=t&&t.id||undefined;r.unexpandArc(e),r.api.revert(),r.revertLegend(),r.hideTooltip()}var r=this,e="touch"===r.inputType,n="mouse"===r.inputType;if(t.on("click",function(t,e){var n,i=r.updateAngle(t);i&&(n=r.convertToArcData(i),r.toggleShape&&r.toggleShape(this,n,e),r.config.data_onclick.call(r.api,n,this))}),n&&t.on("mouseover",function(t){if(!r.transiting){var e=r.updateAngle(t),n=e?r.convertToArcData(e):null;selectArc(this,n,n&&n.id||undefined),r.setOverOut(!0,n)}}).on("mouseout",function(t){if(!r.transiting){var e=r.updateAngle(t),n=e?r.convertToArcData(e):null;unselectArc(),r.setOverOut(!1,n)}}).on("mousemove",function(t){var e=r.updateAngle(t),n=e?r.convertToArcData(e):null;r.showTooltip([n],this)}),e&&r.hasArcType()&&!r.radars){var i=function(){if(!r.transiting){var t=(a=E.changedTouches[0],O(document.elementFromPoint(a.clientX,a.clientY))).datum(),e=t&&t.data&&t.data.id?r.updateAngle(t):null,n=e?r.convertToArcData(e):null,i=n&&n.id||undefined;r.callOverOutForTouch(n),Yn(i)?unselectArc():selectArc(this,n,i)}var a};r.svg.on("touchstart",i).on("touchmove",i)}},redrawArcText:function redrawArcText(t){var e=this,n=e.config,i=e.main,a=i.selectAll(".".concat(dn.chartArc)).select("text").style("opacity","0").attr("class",function(t){return e.isGaugeType(t.data)?dn.gaugeValue:""});n.gauge_fullCircle&&a.attr("dy","".concat(Math.round(e.radius/14)));var r=!a.empty()&&a.classed(dn.gaugeValue)?"call":"text";if(a[r](e.textForArcLabel.bind(e)).attr("transform",e.transformForArcLabel.bind(e)).style("font-size",function(t){return e.isGaugeType(t.data)?"".concat(Math.round(e.radius/5),"px"):""}).transition().duration(t).style("opacity",function(t){return e.isTargetToShow(t.data.id)&&e.isArcType(t.data)?"1":"0"}),i.select(".".concat(dn.chartArcsTitle)).style("opacity",e.hasType("donut")||e.hasType("gauge")?"1":"0"),e.hasType("gauge")){var o=(n.gauge_fullCircle?-4:-1)*n.gauge_startingAngle;e.arcs.select(".".concat(dn.chartArcsBackground)).attr("d",function(){var t={data:[{value:n.gauge_max}],startAngle:n.gauge_startingAngle,endAngle:o};return e.getArc(t,!0,!0)}),e.arcs.select(".".concat(dn.chartArcsGaugeUnit)).attr("dy",".75em").text(n.gauge_label_show?n.gauge_units:""),n.gauge_label_show&&(e.arcs.select(".".concat(dn.chartArcsGaugeMin)).attr("dx","".concat(-1*(e.innerRadius+(e.radius-e.innerRadius)/(n.gauge_fullCircle?1:2)),"px")).attr("dy","1.2em").text(e.textForGaugeMinMax(n.gauge_min,!1)),!n.gauge_fullCircle&&e.arcs.select(".".concat(dn.chartArcsGaugeMax)).attr("dx","".concat(e.innerRadius+(e.radius-e.innerRadius)/2,"px")).attr("dy","1.2em").text(e.textForGaugeMinMax(n.gauge_max,!0)))}},initGauge:function initGauge(){var t=this.config,e=this.arcs;this.hasType("gauge")&&(e.append("path").attr("class",dn.chartArcsBackground),e.append("text").attr("class",dn.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none"),t.gauge_label_show&&(e.append("text").attr("class",dn.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none"),!t.gauge_fullCircle&&e.append("text").attr("class",dn.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none")))},getGaugeLabelHeight:function getGaugeLabelHeight(){return this.config.gauge_label_show?20:0}}),ii(Wi.prototype,{initBar:function initBar(){this.main.select(".".concat(dn.chart)).append("g").attr("class",dn.chartBars)},updateTargetsForBar:function updateTargetsForBar(t){var e=this.config,n=this.classChartBar.bind(this),i=this.classBars.bind(this),a=this.classFocus.bind(this);this.main.select(".".concat(dn.chartBars)).selectAll(".".concat(dn.chartBar)).data(t).attr("class",function(t){return n(t)+a(t)}).enter().append("g").attr("class",n).style("opacity","0").style("pointer-events","none").append("g").attr("class",i).style("cursor",function(t){return e.data_selection_isselectable(t)?"pointer":null})},updateBar:function updateBar(t){var e=this,n=e.barData.bind(e),i=e.classBar.bind(e),a=e.initialOpacity.bind(e);e.mainBar=e.main.selectAll(".".concat(dn.bars)).selectAll(".".concat(dn.bar)).data(n),e.mainBar.exit().transition().duration(t).style("opacity","0").remove(),e.mainBar=e.mainBar.enter().append("path").attr("class",i).style("stroke",e.color).style("fill",e.color).merge(e.mainBar).style("opacity",a)},redrawBar:function redrawBar(t,e){return[(e?this.mainBar.transition(ei()):this.mainBar).attr("d",t).style("fill",this.color).style("opacity","1")]},getBarW:function getBarW(t,r){var e,o=this.config,s=t.tickInterval(this.getMaxDataCount()),n=o.data_groups.length,i=function(t){var e=t?o.bar_width[t]:o.bar_width,n=t?e.ratio:o.bar_width_ratio,i=t?e.max:o.bar_width_max,a=Pn(e)?e:r?s*n/r:0;return i&&i<a?i:a};return e=i(),!n&&Wn(o.bar_width)&&(e={width:e,total:[]},this.filterTargetsToShow(this.data.targets).forEach(function(t){o.bar_width[t.id]&&(e[t.id]=i(t.id)),e.total.push(e[t.id]||e.width)})),e},getBars:function getBars(t,e){var n=In(t)?"-".concat(t):"";return(e?this.main.selectAll(".".concat(dn.bars).concat(this.getTargetSelectorSuffix(e))):this.main).selectAll(".".concat(dn.bar).concat(n))},expandBars:function expandBars(t,e,n){n&&this.unexpandBars(),this.getBars(t,e).classed(dn.EXPANDED,!0)},unexpandBars:function unexpandBars(t){this.getBars(t).classed(dn.EXPANDED,!1)},generateDrawBar:function generateDrawBar(t,e){var n=this.config,d=this.generateGetBarPoints(t,e),f=n.axis_rotated,g=n.data_groups.length,i=n.bar_radius,a=n.bar_radius_ratio,p=Pn(i)&&0<i?function(){return i}:Pn(a)?function(t){return t*a}:null;return function(t,e){var n=d(t,e),i=+f,a=+!i,r=t.value<0,o=["",""],s=0;if(p&&!g){var c=f?a:i,u=n[2][c]-n[0][c];s=p(u);var l="a".concat(s,",").concat(s," ").concat(r?"1 0 0":"0 0 1"," ");o[+!f]="".concat(l).concat(s,",").concat(s),o[+f]="".concat(l).concat([-s,s][f?"sort":"reverse"]()),r&&o.reverse()}var h=f?"H".concat(n[1][i]-s," ").concat(o[0],"V").concat(n[2][a]-s," ").concat(o[1],"H").concat(n[3][i]):"V".concat(n[1][a]+(r?-s:s)," ").concat(o[0],"H").concat(n[2][i]-s," ").concat(o[1],"V").concat(n[3][a]);return"M".concat(n[0][i],",").concat(n[0][a]).concat(h,"z")}},generateGetBarPoints:function generateGetBarPoints(t,e){var s=this,n=e?s.subXAxis:s.xAxis,i=t.__max__+1,c=s.getBarW(n,i),u=s.getShapeX(c,i,t,!!e),l=s.getShapeY(!!e),h=s.getShapeOffset(s.isBarType,t,!!e),d=e?s.getSubYScale:s.getYScale;return function(t,e){var n=d.call(s,t.id)(0),i=h(t,e)||n,a=Pn(c)?c:c[t.id]||c.width,r=u(t),o=l(t);return s.config.axis_rotated&&(0<t.value&&o<n||t.value<0&&n<o)&&(o=n),[[r,i],[r,o-=n-i],[r+a,o],[r+a,i]]}},isWithinBar:function isWithinBar(t){var e=P(t),n=Qn(t),i=zt()(n,2),a=i[0],r=i[1],o=Math.min(a.x,r.x),s=Math.min(a.y,r.y),c=t.getBBox(),u=c.width,l=c.height;return o-2<e[0]&&e[0]<o+u+2&&s-2<e[1]&&e[1]<s+l+2}}),ii(Wi.prototype,{initBubble:function initBubble(){var t=this.config;this.hasType("bubble")&&(t.point_show=!0,t.point_type="circle",t.point_sensitivity=25)},getBaseLength:function getBaseLength(){var t="$baseLength",e=this.getCache(t);return e||this.addCache(t,e=ci("min",[this.axes.x.select("path").node().getTotalLength(),this.axes.y.select("path").node().getTotalLength()])),e},getBubbleR:function getBubbleR(t){var e=this.config.bubble_maxR;En(e)?e=e(t):!Pn(e)&&(e=this.getBaseLength()/(2*this.getMaxDataCount())+12);var n=ci("max",this.getMinMaxData().max.map(function(t){return Zn(t.value)?t.value.mid:t.value})),i=e*e*Math.PI,a=t.value*(i/n);return Math.sqrt(a/Math.PI)}}),ii(Wi.prototype,{initLine:function initLine(){this.main.select(".".concat(dn.chart)).append("g").attr("class",dn.chartLines)},updateTargetsForLine:function updateTargetsForLine(t){var n=this,e=n.config,i=n.classChartLine.bind(n),a=n.classLines.bind(n),r=n.classAreas.bind(n),o=n.classCircles.bind(n),s=n.classFocus.bind(n),c=n.main.select(".".concat(dn.chartLines)).selectAll(".".concat(dn.chartLine)).data(t).attr("class",function(t){return i(t)+s(t)}).enter().append("g").attr("class",i).style("opacity","0").style("pointer-events","none");c.append("g").attr("class",a),c.append("g").attr("class",r),e.point_show&&(e.data_selection_enabled&&c.append("g").attr("class",function(t){return n.generateClass(dn.selectedCircles,t.id)}),c.append("g").attr("class",o).style("cursor",function(t){return e.data_selection_isselectable(t)?"pointer":null})),t.forEach(function(e){n.main.selectAll(".".concat(dn.selectedCircles).concat(n.getTargetSelectorSuffix(e.id))).selectAll("".concat(dn.selectedCircle)).each(function(t){t.value=e.values[t.index].value})})},updateLine:function updateLine(t){var e=this;e.mainLine=e.main.selectAll(".".concat(dn.lines)).selectAll(".".concat(dn.line)).data(e.lineData.bind(e)),e.mainLine.exit().transition().duration(t).style("opacity","0").remove(),e.mainLine=e.mainLine.enter().append("path").attr("class",function(t){return"".concat(e.classLine.bind(e)(t)," ").concat(e.extraLineClasses(t)||"")}).style("stroke",e.color).merge(e.mainLine).style("opacity",e.initialOpacity.bind(e)).style("shape-rendering",function(t){return e.isStepType(t)?"crispEdges":""}).attr("transform",null)},redrawLine:function redrawLine(t,e){return[(e?this.mainLine.transition(ei()):this.mainLine).attr("d",t).style("stroke",this.color).style("opacity","1")]},getCurve:function getCurve(n){var i=this;return i.config.axis_rotated&&i.isStepType(n)?function(t){var e=i.getInterpolate(n)(t);return e.orgPoint=e.point,e.pointRotated=function(t,e){1===this._point&&(this._point=2);var n=this._y*(1-this._t)+e*this._t;this._context.lineTo(this._x,n),this._context.lineTo(t,n),this._x=t,this._y=e},e.point=function(t,e){0===this._point?this.orgPoint(t,e):this.pointRotated(t,e)},e}:i.getInterpolate(n)},generateDrawLine:function generateDrawLine(t,e){var s=this,c=s.config,u=c.line_connectNull,l=c.axis_rotated,n=s.generateGetLinePoints(t,e),h=e?s.getSubYScale:s.getYScale,i=function(t){return(e?s.subxx:s.xx).call(s,t)},a=function(t,e){return s.isGrouped(t.id)?n(t,e)[0][1]:h.call(s,t.id)(s.getBaseValue(t))},d=Ta();d=l?d.x(a).y(i):d.x(i).y(a),u||(d=d.defined(function(t){return null!==s.getBaseValue(t)}));var f=e?s.subX:s.x;return function(t){var e,n=h.call(s,t.id),i=u?s.filterRemoveNull(t.values):t.values,a=0,r=0;if(s.isLineType(t)){var o=c.data_regions[t.id];e=o?s.lineWithRegions(i,f,n,o):(s.isStepType(t)&&(i=s.convertValuesToStep(i)),d.curve(s.getCurve(t))(i))}else i[0]&&(a=f(i[0].x),r=n(i[0].value)),e=l?"M ".concat(r," ").concat(a):"M ".concat(a," ").concat(r);return e||"M 0 0"}},generateGetLinePoints:function generateGetLinePoints(t,e){var s=this,c=s.config,n=t.__max__+1,i=!!e,u=s.getShapeX(0,n,t,i),l=s.getShapeY(i),h=s.getShapeOffset(s.isLineType,t,i),d=i?s.getSubYScale:s.getYScale;return function(t,e){var n=d.call(s,t.id)(0),i=h(t,e)||n,a=u(t),r=l(t);c.axis_rotated&&(0<t.value&&r<n||t.value<0&&n<r)&&(r=n);var o=[a,r-(n-i)];return[o,o,o,o]}},lineWithRegions:function lineWithRegions(t,u,l,e){var r,h,d,n,i=this,f=i.config.axis_rotated,a=i.isTimeSeries(),o=i.isCategorized()?.5:0,s=[],c=function(t,e){for(var n,i=0;n=e[i];i++)if(n.start<t&&t<=n.end)return n.style;return!1};if(Nn(e))for(var g,p=function(t,e){return Yn(t)?e:a?i.parseDate(t):t},_=0;g=e[_];_++){var m=p(g.start,t[0].x),x=p(g.end,t[t.length-1].x),y=g.style||{dasharray:"2 2"};s[_]={start:m,end:x,style:y}}for(var v,b=f?function(t){return l(t.value)}:function(t){return u(t.x)},T=f?function(t){return u(t.x)}:function(t){return l(t.value)},w=function(t){return"M".concat(t[0][0],",").concat(t[0][1],"L").concat(t[1][0],",").concat(t[1][1])},A=a?function(t,e,n,i){var a=t.x.getTime(),r=e.x-t.x,o=new Date(a+r*n),s=new Date(a+r*(n+i)),c=f?[[l(h(n)),u(o)],[l(h(n+d)),u(s)]]:[[u(o),l(h(n))],[u(s),l(h(n+d))]];return w(c)}:function(t,e,n,i){var a=f?[[l(h(n),!0),u(r(n))],[l(h(n+i),!0),u(r(n+i))]]:[[u(r(n),!0),l(h(n))],[u(r(n+i),!0),l(h(n+i))]];return w(a)},k="M",C=0;v=t[C];C++){var S=t[C-1];y=c(v.x,s);if(Yn(s)||!y)k+="".concat(C?"L":"").concat(b(v),",").concat(T(v));else{try{y=y.dasharray.split(" ")}catch(R){y="2 2".split(" ")}r=i.getScale(S.x+o,v.x+o,a),h=i.getScale(S.value,v.value);var M=u(v.x)-u(S.x),L=l(v.value)-l(S.value),D=Math.sqrt(Math.pow(M,2)+Math.pow(L,2));n=(d=y[0]/D)*y[1];for(var F=d;F<=1;F+=n)k+=A(S,v,F,d),1<=F+n&&(k+=A(S,v,1,0))}}return k},updateArea:function updateArea(t){var e=this;e.mainArea=e.main.selectAll(".".concat(dn.areas)).selectAll(".".concat(dn.area)).data(e.lineData.bind(e)),e.mainArea.exit().transition().duration(t).style("opacity","0").remove(),e.mainArea=e.mainArea.enter().append("path").attr("class",e.classArea.bind(e)).style("fill",e.color).style("opacity",function(){return e.orgAreaOpacity=O(this).style("opacity"),"0"}).merge(e.mainArea),e.mainArea.style("opacity",e.orgAreaOpacity)},redrawArea:function redrawArea(t,e){var n=this;return[(e?this.mainArea.transition(ei()):this.mainArea).attr("d",t).style("fill",this.color).style("opacity",function(t){return n.isAreaRangeType(t)?n.orgAreaOpacity/1.75:n.orgAreaOpacity})]},generateDrawArea:function generateDrawArea(t,e){var o=this,s=o.config,c=s.line_connectNull,u=s.axis_rotated,n=o.generateGetAreaPoints(t,e),i=e?o.getSubYScale:o.getYScale,l=function(t){return(e?o.subxx:o.xx).call(o,t)},h=function(t,e){return o.isGrouped(t.id)?n(t,e)[0][1]:i.call(o,t.id)(o.isAreaRangeType(t)?o.getAreaRangeData(t,"high"):o.getAreaBaseValue(t.id))},d=function(t,e){return o.isGrouped(t.id)?n(t,e)[1][1]:i.call(o,t.id)(o.isAreaRangeType(t)?o.getAreaRangeData(t,"low"):t.value)};return function(t){var e,n=c?o.filterRemoveNull(t.values):t.values,i=0,a=0;if(o.isAreaType(t)){var r=wa();r=u?r.y(l).x0(h).x1(d):r.x(l).y0(s.area_above?0:h).y1(d),c||(r=r.defined(function(t){return null!==o.getBaseValue(t)})),o.isStepType(t)&&(n=o.convertValuesToStep(n)),e=r.curve(o.getCurve(t))(n)}else n[0]&&(i=o.x(n[0].x),a=o.getYScale(t.id)(n[0].value)),e=u?"M ".concat(a," ").concat(i):"M ".concat(i," ").concat(a);return e||"M 0 0"}},getAreaBaseValue:function getAreaBaseValue(){return 0},generateGetAreaPoints:function generateGetAreaPoints(t,e){var o=this,s=o.config,n=t.__max__+1,c=o.getShapeX(0,n,t,!!e),u=o.getShapeY(!!e),l=o.getShapeOffset(o.isAreaType,t,!!e),h=e?o.getSubYScale:o.getYScale;return function(t,e){var n=h.call(o,t.id)(0),i=l(t,e)||n,a=c(t),r=u(t);return s.axis_rotated&&(0<t.value&&r<n||t.value<0&&n<r)&&(r=n),[[a,i],[a,r-(n-i)],[a,r-(n-i)],[a,i]]}},updateCircle:function updateCircle(){var e=this;e.config.point_show&&(e.mainCircle=e.main.selectAll(".".concat(dn.circles)).selectAll(".".concat(dn.circle)).data(function(t){return!e.isBarType(t)&&(!e.isLineType(t)||e.shouldDrawPointsForLine(t))&&e.labelishData(t)}),e.mainCircle.exit().remove(),e.mainCircle=e.mainCircle.enter().append(e.point("create",this,e.classCircle.bind(e),e.pointR.bind(e),e.color)).merge(e.mainCircle).style("stroke",e.color).style("opacity",e.initialOpacityForCircle.bind(e)))},redrawCircle:function redrawCircle(n,i,a,r){var o=this,s=o.main.selectAll(".".concat(dn.selectedCircle));if(!o.config.point_show)return[];var c=[];o.mainCircle.each(function(t){var e=o.point("update",o,n,i,o.opacityForCircle.bind(o),o.color,a,r,s).bind(this)(t);c.push(e)});var t=o.isCirclePoint()?"c":"";return[c,s.attr("".concat(t,"x"),n).attr("".concat(t,"y"),i)]},circleX:function circleX(t){var e=In(t.x);return this.config.zoom_enabled&&this.zoomScale?e?this.zoomScale(t.x):null:e?this.x(t.x):null},updateCircleY:function updateCircleY(){var i=this;i.circleY=function(t,e){var n=t.id;return i.isGrouped(n)?i.generateGetLinePoints(i.getShapeIndices(i.isLineType))(t,e)[0][1]:i.getYScale(n)(i.getBaseValue(t))}},getCircles:function getCircles(t,e){var n=In(t)?"-".concat(t):"";return(e?this.main.selectAll(".".concat(dn.circles).concat(this.getTargetSelectorSuffix(e))):this.main).selectAll(".".concat(dn.circle).concat(n))},expandCircles:function expandCircles(t,e,n){var o=this.pointExpandedR.bind(this);n&&this.unexpandCircles();var i=this.getCircles(t,e).classed(dn.EXPANDED,!0),s=o(i)/this.config.point_r,c=1-s;this.isCirclePoint()?i.attr("r",o):i.each(function(){var t=O(this);if("circle"===this.tagName)t.attr("r",o);else{var e=this.getBBox(),n=e.width,i=e.height,a=c*(+t.attr("x")+n/2),r=c*(+t.attr("y")+i/2);t.style("transform","translate(".concat(a,"px, ").concat(r,"px) scale(").concat(s,")"))}})},unexpandCircles:function unexpandCircles(t){var e=this.pointR.bind(this),n=this.getCircles(t).filter(function(){return O(this).classed(dn.EXPANDED)}).classed(dn.EXPANDED,!1);n.attr("r",e),this.isCirclePoint()||n.style("transform","scale(".concat(e(n)/this.config.point_r,")"))},pointR:function(t){var e=this.config.point_r,n=e;return this.isStepType(t)?n=0:this.isBubbleType(t)?n=this.getBubbleR(t):En(e)&&(n=e(t)),n},pointExpandedR:function pointExpandedR(t){var e=this.config,n=this.isBubbleType(t)?1.15:1.75;return e.point_focus_expand_enabled?e.point_focus_expand_r||this.pointR(t)*n:this.pointR(t)},pointSelectR:function pointSelectR(t){var e=this.config.point_select_r;return En(e)?e(t):e||4*this.pointR(t)},isWithinCircle:function isWithinCircle(t,e){var n=P(t),i=O(t),a=this.isCirclePoint()?"c":"",r=+i.attr("".concat(a,"x")),o=+i.attr("".concat(a,"y"));if(!r&&!o&&1===t.nodeType){var s=t.getBBox?t.getBBox():t.getBoundingClientRect();r=s.x,o=s.y}return Math.sqrt(Math.pow(r-n[0],2)+Math.pow(o-n[1],2))<e},isWithinStep:function isWithinStep(t,e){return Math.abs(e-P(t)[1])<30},shouldDrawPointsForLine:function shouldDrawPointsForLine(t){var e=this.config.line_point;return!0===e||qn(e)&&-1!==e.indexOf(t.id)}}),ii(Wi.prototype,{hasValidPointType:function hasValidPointType(t){return/^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(t||this.config.point_type)},hasValidPointDrawMethods:function hasValidPointDrawMethods(t){var e=t||this.config.point_type;return Wn(e)&&En(e.create)&&En(e.update)},insertPointInfoDefs:function insertPointInfoDefs(t,e){var n=function(t,e){for(var n,i=t.attributes,a=0;n=i[a];a++)n=n.name,e.setAttribute(n,t.getAttribute(n))},i=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement,a=document.createElementNS(I.svg,i.nodeName.toLowerCase());if(a.id=e,a.style.fill="inherit",a.style.stroke="inherit",n(i,a),i.childNodes&&i.childNodes.length){var r=O(a);"innerHTML"in a?r.html(i.innerHTML):ri(i.childNodes).forEach(function(t){n(t,r.append(t.tagName).node())})}this.defs.node().appendChild(a)},pointFromDefs:function pointFromDefs(t){return this.defs.select("#".concat(t))},generatePoint:function generatePoint(){var c=this,t=c.config,u=[],l=jn(t.point_pattern)?t.point_pattern:[t.point_type];return function(r,o){for(var t=arguments.length,s=Array(2<t?t-2:0),e=2;e<t;e++)s[e-2]=arguments[e];return function(t){var e,n=t.id||t.data&&t.data.id||t,i=O(this);if(u.indexOf(n)<0&&u.push(n),e=l[u.indexOf(n)%l.length],c.hasValidPointType(e))e=c[e];else if(!c.hasValidPointDrawMethods(e)){var a="".concat(c.datetimeId,"-point-").concat(n);if(c.pointFromDefs(a).size()<1&&c.insertPointInfoDefs(e,a),"create"===r)return c.custom.create.bind(o).apply(void 0,[i,a].concat(s));if("update"===r)return c.custom.update.bind(o).apply(void 0,[i].concat(s))}return e[r].bind(o).apply(void 0,[i].concat(s))}}},getTransitionName:function getTransitionName(){return ei()},custom:{create:function create(t,e,n,i,a){return t.append("use").attr("xlink:href","#".concat(e)).attr("class",n).style("fill",a).node()},update:function update(t,e,n,i,a,r,o,s){var c=t.node().getBBox(),u=c.width,l=c.height,h=function(t){return e(t)-u/2},d=function(t){return n(t)-l/2},f=t;if(r){var g=this.getTransitionName();o&&(f=t.attr("x",h)),f=t.transition(g).attr("x",h).attr("y",d).transition(g),s.transition(this.getTransitionName())}else f=t.attr("x",h).attr("y",d);return f.style("opacity",i).style("fill",a)}},circle:{create:function create(t,e,n,i){return t.append("circle").attr("class",e).attr("r",n).style("fill",i).node()},update:function update(t,e,n,i,a,r,o,s){var c=t;if(this.hasType("bubble")&&(c=c.attr("r",this.pointR.bind(this))),r){var u=this.getTransitionName();o&&(c=c.attr("cx",e)),c=t.attr("cx")?c.transition(u).attr("cx",e).attr("cy",n).transition(u):c.attr("cx",e).attr("cy",n),s.transition(this.getTransitionName())}else c=c.attr("cx",e).attr("cy",n);return c.style("opacity",i).style("fill",a)}},rectangle:{create:function create(t,e,n,i){var a=function(t){return 2*n(t)};return t.append("rect").attr("class",e).attr("width",a).attr("height",a).style("fill",i).node()},update:function update(t,e,n,i,a,r,o,s){var c=this.config.point_r,u=function(t){return e(t)-c},l=function(t){return n(t)-c},h=t;if(r){var d=this.getTransitionName();o&&(h=h.attr("x",u)),h=h.transition(d).attr("x",u).attr("y",l).transition(d),s.transition(this.getTransitionName())}else h=h.attr("x",u).attr("y",l);return h.style("opacity",i).style("fill",a)}}});var Ba="$radarPoints";ii(Wi.prototype,{initRadar:function initRadar(){var t=this,e=t.config;t.hasType("radar")&&(t.radars=t.main.select(".".concat(dn.chart)).append("g").attr("class",dn.chartRadars),t.radars.levels=t.radars.append("g").attr("class",dn.levels),t.radars.axes=t.radars.append("g").attr("class",dn.axis),t.radars.shapes=t.radars.append("g").attr("class",dn.shapes),t.maxValue=e.radar_axis_max||t.getMinMaxData().max[0].value)},getRadarSize:function getRadarSize(){var t=this.config.axis_x_categories.length<4?-20:10,e=(Math.min(this.arcWidth,this.arcHeight)-t)/2;return[e,e]},updateTargetsForRadar:function updateTargetsForRadar(t){var e=this.config;Gn(e.axis_x_categories)&&(e.axis_x_categories=ui(0,ci("max",t.map(function(t){return t.values.length})))),this.generateRadarPoints()},getRadarPosition:function getRadarPosition(e,n,i,a){var r=this.config,t=this.getRadarSize(),o=zt()(t,2),s=o[0],c=o[1],u=r.axis_x_categories.length,l=r.radar_direction_clockwise,h=ri(e).map(function(t){return function getPosition(t,e,n,i,a,r){var o=t&&0<i?n-i:i,s=2*Math.PI;return a*(1-r*("x"===e?Math.sin:Math.cos)(o*s/n))}(l,t,u,n,Nn(i)?i:"x"===e?s:c,Pn(a)?a:r.radar_size_ratio)});return 1===h.length?h[0]:h},generateRadarPoints:function generateRadarPoints(){var n=this,t=n.data.targets,e=n.getRadarSize(),i=zt()(e,2),a=i[0],r=i[1],o=n.getCache(Ba)||{},s=o._size;s&&(s.width===a||s.height===r)||(t.forEach(function(t){o[t.id]=t.values.map(function(t,e){return n.getRadarPosition(["x","y"],e,undefined,n.getRatio("radar",t))})}),o._size={width:a,height:r},n.addCache(Ba,o))},redrawRadar:function redrawRadar(t,e){var n=this.getTranslate("radar");n&&(this.radars.attr("transform",n),this.main.selectAll(".".concat(dn.circles)).attr("transform",n),this.main.select(".".concat(dn.chartTexts)).attr("transform",n),this.generateRadarPoints(),this.updateRadarLevel(),this.updateRadarAxes(),this.updateRadarShape(t,e))},generateGetRadarPoints:function generateGetRadarPoints(){var i=this.getCache(Ba);return function(t,e){var n=i[t.id][e];return[n,n,n,n]}},updateRadarLevel:function updateRadarLevel(){var n=this,t=n.config,e=n.getRadarSize(),i=zt()(e,2),a=i[0],r=i[1],o=t.radar_level_depth,s=t.axis_x_categories.length,c=t.radar_level_text_show,u=n.radars.levels,l=ui(0,o),h=t.radar_size_ratio*Math.min(a,r),d=l.map(function(t){return h*((t+1)/o)}),f=t.radar_level_text_format,g=l.map(function(t){var e=d[t];return ui(0,s).map(function(t){return n.getRadarPosition(["x","y"],t,e,1).join(",")}).join(" ")}),p=u.selectAll(".".concat(dn.level)).data(l);p.exit().remove();var _=p.enter().append("g").attr("class",function(t,e){return"".concat(dn.level," ").concat(dn.level,"-").concat(e)});_.append("polygon").style("visibility",t.radar_level_show?null:"hidden"),c&&(u.select("text").empty()&&u.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(function(){return f(0)}),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(function(t){return f(n.maxValue/l.length*(t+1))})),_.merge(p).attr("transform",function(t){return"translate(".concat(a-d[t],", ").concat(r-d[t],")")}).selectAll("polygon").attr("points",function(t){return g[t]}),c&&u.selectAll("text").attr("x",function(t){return Yn(t)?a:g[t].split(",")[0]}).attr("y",function(t){return Yn(t)?r:0})},updateRadarAxes:function updateRadarAxes(){var n=this,t=n.config,e=n.getRadarSize(),i=zt()(e,2),a=i[0],r=i[1],o=t.axis_x_categories,s=n.radars.axes.selectAll("g").data(o);s.exit().remove();var c=s.enter().append("g").attr("class",function(t,e){return"".concat(dn.axis,"-").concat(e)});t.radar_axis_line_show&&c.append("line"),t.radar_axis_text_show&&c.append("text"),s=c.merge(s),t.radar_axis_line_show&&s.select("line").attr("x1",a).attr("y1",r).attr("x2",function(t,e){return n.getRadarPosition("x",e)}).attr("y2",function(t,e){return n.getRadarPosition("y",e)}),t.radar_axis_text_show&&s.select("text").style("text-anchor","middle").attr("dy",".5em").text(function(t){return t}).datum(function(t,e){return{index:e}}).attr("x",function(t,e){return n.getRadarPosition("x",e,undefined,1)}).attr("y",function(t,e){return n.getRadarPosition("y",e,undefined,1)}),n.bindEvent()},bindEvent:function bindEvent(){var n=this,i=this;if(i.config.interaction_enabled){var a="mouse"===i.inputType,r=function(){var t=O(E.target).datum();return t&&1===Object.keys(t).length?t.index:undefined},t=function(){var t=r(),e=Yn(t);(a||e)&&(n.hideTooltip(),n.unexpandCircles(),a?i.setOverOut(!1,t):e&&i.callOverOutForTouch())};i.radars.select(".".concat(dn.axis)).on(a?"mouseover ":"touchstart",function(){if(!i.transiting){var t=r();i.selectRectForSingle(i.svg.node(),null,t),a?i.setOverOut(!0,t):i.callOverOutForTouch(t)}}).on("mouseout",a?t:null),a||i.svg.on("touchstart",t)}},updateRadarShape:function updateRadarShape(t,e){var n=this,i=n.data.targets,a=n.getCache(Ba),r=n.radars.shapes.selectAll("polygon").data(i),o=r.enter().append("g").attr("class",n.classChartRadar.bind(n));r.exit().transition().duration(e).remove(),o.append("polygon").merge(r).transition().duration(t).style("fill",function(t){return n.color(t)}).style("stroke",function(t){return n.color(t)}).attr("points",function(t){return a[t.id].join(" ")})},radarCircleX:function radarCircleX(t){return this.getCache(Ba)[t.id][t.index][0]},radarCircleY:function radarCircleY(t){return this.getCache(Ba)[t.id][t.index][1]}}),ii(Wi.prototype,{initText:function initText(){this.main.select(".".concat(dn.chart)).append("g").attr("class",dn.chartTexts),this.mainText=_([])},updateTargetsForText:function updateTargetsForText(t){var e=this.classChartText.bind(this),n=this.classTexts.bind(this),i=this.classFocus.bind(this);this.main.select(".".concat(dn.chartTexts)).selectAll(".".concat(dn.chartText)).data(t).attr("class",function(t){return e(t)+i(t)}).enter().append("g").attr("class",e).style("opacity","0").style("pointer-events","none").append("g").attr("class",n)},updateText:function updateText(t){var e=this,i=this,n=i.config,a=i.labelishData.bind(i),r=i.classText.bind(i);i.mainText=i.main.selectAll(".".concat(dn.texts)).selectAll(".".concat(dn.text)).data(function(t){return e.isRadarType(t)?t.values:a(t)}),i.mainText.exit().transition().duration(t).style("fill-opacity","0").remove(),i.mainText=i.mainText.enter().append("text").merge(i.mainText).attr("class",r).attr("text-anchor",function(t){return n.axis_rotated?t.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",function(t){return i.color(t)}).style("fill-opacity","0").text(function(t,e,n){return i.dataLabelFormat(t.id)(t.value,t.id,e,n)})},redrawText:function redrawText(e,n,t,i){var a=this,r=ei(),o=t?0:a.opacityForText.bind(a);return[this.mainText.each(function(){var t=O(this);(i&&t.attr("x")?t.transition(r):t).attr("x",e).attr("y",n).style("fill",a.color).style("fill-opacity",o)})]},getTextRect:function getTextRect(t,e){var n=t.node?t.node():t;/text/i.test(n.tagName)||(n=n.querySelector("text"));var i=n.textContent,a="$".concat(i.replace(/\W/g,"_")),r=this.getCache(a);return r||(this.svg.append("text").style("visibility","hidden").style("font",O(n).style("font")).classed(e,!0).text(i).call(function(t){r=t.node().getBoundingClientRect()}).remove(),this.addCache(a,r)),r},generateXYForText:function generateXYForText(e,t){var i=this,a={},r=t?i.getXForText:i.getYForText;return Object.keys(e).concat("radar").forEach(function(t){a[t]=i["generateGet".concat(ai(t),"Points")](e[t],!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)}},getXForText:function getXForText(t,e,n){var i,a,r=this.config;return i=r.axis_rotated?(a=this.isBarType(e)?4:6,t[2][1]+a*(e.value<0?-1:1)):this.hasType("bar")?(t[2][0]+t[0][0])/2:t[0][0],null===e.value&&(i>this.width?i=this.width-n.getBoundingClientRect().width:i<0&&(i=4)),i+(r.data_labels_position.x||0)},getYForText:function getYForText(t,e,n){var i,a=this,r=a.config,o=r.point_r,s=3;if(r.axis_rotated)i=(t[0][0]+t[2][0]+.6*n.getBoundingClientRect().height)/2;else if(i=t[2][1],Pn(o)&&5<o&&(a.isLineType(e)||a.isScatterType(e))&&(s+=r.point_r/2.3),e.value<0||0===e.value&&!a.hasPositiveValue)i+=n.getBoundingClientRect().height,a.isBarType(e)&&a.isSafari()?i-=s:!a.isBarType(e)&&a.isChrome()&&(i+=s);else{var c=2*-s;a.isBarType(e)?c=-s:a.isBubbleType(e)&&(c=s),i+=c}if(null===e.value&&!r.axis_rotated){var u=n.getBoundingClientRect().height;i<u?i=u:i>this.height&&(i=this.height-4)}return i+(r.data_labels_position.y||0)}});var Ha={Area:["area","area-spline","area-spline-range","area-line-range","area-step"],AreaRange:["area-spline-range","area-line-range"],Arc:["pie","donut","gauge","radar"],Line:["line","spline","area","area-spline","area-spline-range","area-line-range","step","area-step"],Step:["step","area-step"],Spline:["spline","area-spline","area-spline-range"]};ii(Wi.prototype,{setTargetType:function setTargetType(t,e){var n=this,i=n.config;n.mapToTargetIds(t).forEach(function(t){n.withoutFadeIn[t]=e===i.data_types[t],i.data_types[t]=e}),t||(i.data_type=e)},hasType:function hasType(n,t){var i=this.config.data_types,e=t||this.data.targets,a=!1;return e&&e.length?e.forEach(function(t){var e=i[t.id];(e&&0<=e.indexOf(n)||!e&&"line"===n)&&(a=!0)}):Object.keys(i).length?Object.keys(i).forEach(function(t){i[t]===n&&(a=!0)}):a=this.config.data_type===n,a},hasTypeOf:function hasTypeOf(t,e){var n=this,i=2<arguments.length&&arguments[2]!==undefined?arguments[2]:[];return!Ha[t].filter(function(t){return-1===i.indexOf(t)}).every(function(t){return!n.hasType(t,e)})},isTypeOf:function isTypeOf(t,e){var n=On(t)?t:t.id,i=this.config.data_types[n];return qn(e)?0<=e.indexOf(i):i===e},hasArcType:function hasArcType(t,e){return this.hasTypeOf("Arc",t,e)},isLineType:function isLineType(t){var e=On(t)?t:t.id;return!this.config.data_types[e]||this.isTypeOf(e,Ha.Line)},isStepType:function isStepType(t){return this.isTypeOf(t,Ha.Step)},isSplineType:function isSplineType(t){return this.isTypeOf(t,Ha.Spline)},isAreaType:function isAreaType(t){return this.isTypeOf(t,Ha.Area)},isAreaRangeType:function isAreaRangeType(t){return this.isTypeOf(t,Ha.AreaRange)},isBarType:function isBarType(t){return this.isTypeOf(t,"bar")},isBubbleType:function isBubbleType(t){return this.isTypeOf(t,"bubble")},isScatterType:function isScatterType(t){return this.isTypeOf(t,"scatter")},isPieType:function isPieType(t){return this.isTypeOf(t,"pie")},isGaugeType:function isGaugeType(t){return this.isTypeOf(t,"gauge")},isDonutType:function isDonutType(t){return this.isTypeOf(t,"donut")},isRadarType:function isRadarType(t){return this.isTypeOf(t,"radar")},isArcType:function isArcType(t){return this.isPieType(t)||this.isDonutType(t)||this.isGaugeType(t)||this.isRadarType(t)},isCirclePoint:function isCirclePoint(){var t=this.config,e=t.point_pattern;return"circle"===t.point_type&&(!e||qn(e)&&0===e.length)},lineData:function lineData(t){return this.isLineType(t)?[t]:[]},arcData:function arcData(t){return this.isArcType(t.data)?[t]:[]},barData:function barData(t){return this.isBarType(t)?t.values:[]},labelishData:function labelishData(t){return this.isBarType(t)||this.isLineType(t)||this.isScatterType(t)||this.isBubbleType(t)||this.isRadarType(t)?t.values:[]},barLineBubbleData:function barLineBubbleData(t){return this.isBarType(t)||this.isLineType(t)||this.isBubbleType(t)?t.values:[]},isInterpolationType:function isInterpolationType(t){return 0<=["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)}});var Va=function(t){return In(t.position)||"end"},Wa=function(t){return"start"===t.position?4:"middle"===t.position?0:-4},Ga=function(n,i,a){return function(t){var e=n?0:i;return"start"===t.position?e=n?-a:0:"middle"===t.position&&(e=(n?-a:i)/2),e}};ii(Wi.prototype,{initGrid:function initGrid(){this.xgrid=_([]),this.initGridLines(),this.initXYFocusGrid()},initGridLines:function initGridLines(){var t=this.config;(t.grid_x_lines.length||t.grid_y_lines.length)&&(this.gridLines=this.main.insert("g",".".concat(dn.chart).concat(t.grid_lines_front?" + *":"")).attr("clip-path",this.clipPathForGrid).attr("class","".concat(dn.grid," ").concat(dn.gridLines)),this.gridLines.append("g").attr("class",dn.xgridLines),this.gridLines.append("g").attr("class",dn.ygridLines),this.xgridLines=_([]))},updateXGrid:function updateXGrid(t){var n=this,e=n.config,i=e.axis_rotated,a=n.generateGridData(e.grid_x_type,n.x),r=n.isCategorized()?n.xAxis.tickOffset():0,o=function(t){return n.x(t)+(r*i?-1:1)};n.xgridAttr=i?{x1:0,x2:n.width,y1:o,y2:o}:{x1:o,x2:o,y1:0,y2:n.height},n.xgrid=n.main.select(".".concat(dn.xgrids)).selectAll(".".concat(dn.xgrid)).data(a),n.xgrid.exit().remove(),n.xgrid=n.xgrid.enter().append("line").attr("class",dn.xgrid).merge(n.xgrid),t||n.xgrid.each(function(){var e=O(this);Object.keys(n.xgridAttr).forEach(function(t){e.attr(t,n.xgridAttr[t]).style("opacity",function(){return e.attr(i?"y1":"x1")===(i?n.height:0)?"0":"1"})})})},updateYGrid:function updateYGrid(){var t=this,e=t.config,n=e.axis_rotated,i=t.yAxis.tickValues()||t.y.ticks(e.grid_y_ticks);t.ygrid=t.main.select(".".concat(dn.ygrids)).selectAll(".".concat(dn.ygrid)).data(i),t.ygrid.exit().remove(),t.ygrid=t.ygrid.enter().append("line").attr("class",dn.ygrid).merge(t.ygrid),t.ygrid.attr("x1",n?t.y:0).attr("x2",n?t.y:t.width).attr("y1",n?0:t.y).attr("y2",n?t.height:t.y),t.smoothLines(t.ygrid,"grid")},updateGrid:function updateGrid(t){this.gridLines||this.initGridLines(),this.grid.style("visibility",this.hasArcType()?"hidden":"visible"),this.main.select("line.".concat(dn.xgridFocus)).style("visibility","hidden"),this.updateXGridLines(t),this.updateYGridLines(t)},updateXGridLines:function updateXGridLines(t){var e=this.main,n=this.config,i=n.axis_rotated;n.grid_x_show&&this.updateXGrid(),this.xgridLines=e.select(".".concat(dn.xgridLines)).selectAll(".".concat(dn.xgridLine)).data(n.grid_x_lines),this.xgridLines.exit().transition().duration(t).style("opacity","0").remove();var a=this.xgridLines.enter().append("g");a.append("line").style("opacity","0"),a.append("text").attr("transform",i?"":"rotate(-90)").attr("dy",-5).style("opacity","0"),this.xgridLines=a.merge(this.xgridLines),this.xgridLines.attr("class",function(t){return"".concat(dn.xgridLine," ").concat(t["class"]||"").trim()}).select("text").attr("text-anchor",Va).attr("dx",Wa).transition().duration(t).text(function(t){return t.text}).transition().style("opacity","1")},updateYGridLines:function updateYGridLines(t){var e=this,n=e.main,i=e.config,a=i.axis_rotated;i.grid_y_show&&e.updateYGrid(),e.ygridLines=n.select(".".concat(dn.ygridLines)).selectAll(".".concat(dn.ygridLine)).data(i.grid_y_lines),e.ygridLines.exit().transition().duration(t).style("opacity","0").remove();var r=e.ygridLines.enter().append("g");r.append("line").style("opacity","0"),r.append("text").attr("transform",a?"rotate(-90)":"").style("opacity","0"),e.ygridLines=r.merge(e.ygridLines);var o=e.yv.bind(e);e.ygridLines.attr("class",function(t){return"".concat(dn.ygridLine," ").concat(t["class"]||"").trim()}).select("line").transition().duration(t).attr("x1",a?o:0).attr("x2",a?o:e.width).attr("y1",a?0:o).attr("y2",a?e.height:o).transition().style("opacity","1"),e.ygridLines.select("text").attr("text-anchor",Va).attr("dx",Wa).transition().duration(t).attr("dy",-5).attr("x",Ga(a,e.width,e.height)).attr("y",o).text(function(t){return t.text}).transition().style("opacity","1")},redrawGrid:function redrawGrid(t){var e=this.config.axis_rotated,n=this.xv.bind(this),i=this.xgridLines.select("line"),a=this.xgridLines.select("text");return i=(t?i.transition():i).attr("x1",e?0:n).attr("x2",e?this.width:n).attr("y1",e?n:0).attr("y2",e?n:this.height),a=(t?a.transition():a).attr("x",Ga(!e,this.width,this.height)).attr("y",n).text(function(t){return t.text}),[(t?i.transition():i).style("opacity","1"),(t?a.transition():a).style("opacity","1")]},initXYFocusGrid:function initXYFocusGrid(){var t=this.config,e=t.grid_front,n=".".concat(dn[e&&this.gridLines?"gridLines":"chart"]).concat(e?" + *":"");this.grid=this.main.insert("g",n).attr("clip-path",this.clipPathForGrid).attr("class",dn.grid),t.grid_x_show&&this.grid.append("g").attr("class",dn.xgrids),t.grid_y_show&&this.grid.append("g").attr("class",dn.ygrids),t.grid_focus_show&&this.grid.append("g").attr("class",dn.xgridFocus).append("line").attr("class",dn.xgridFocus)},showXGridFocus:function showXGridFocus(t){var e=this,n=e.config,i=n.axis_rotated,a=t.filter(function(t){return t&&In(e.getBaseValue(t))}),r=e.main.selectAll("line.".concat(dn.xgridFocus)),o=e.xx.bind(e);!n.tooltip_show||e.hasType("bubble")||e.hasType("scatter")||e.hasArcType()||(r.style("visibility","visible").data([a[0]]).attr(i?"y1":"x1",o).attr(i?"y2":"x2",o),e.smoothLines(r,"grid"))},hideXGridFocus:function hideXGridFocus(){this.main.select("line.".concat(dn.xgridFocus)).style("visibility","hidden")},updateXgridFocus:function updateXgridFocus(){var t=this.config.axis_rotated;this.main.select("line.".concat(dn.xgridFocus)).attr("x1",t?0:-10).attr("x2",t?this.width:-10).attr("y1",t?-10:0).attr("y2",t?-10:this.height)},generateGridData:function generateGridData(t,e){var n=this.main.select(".".concat(dn.axisX)).selectAll(".tick").size(),i=[];if("year"===t)for(var a=this.getXDomain(),r=a[0].getFullYear(),o=a[1].getFullYear(),s=r;s<=o;s++)i.push(new Date("".concat(s,"-01-01 00:00:00")));else(i=e.ticks(10)).length>n&&(i=i.filter(function(t){return(t+"").indexOf(".")<0}));return i},getGridFilterToRemove:function getGridFilterToRemove(t){return t?function(e){var n=!1;return(qn(t)?t.concat():[t]).forEach(function(t){("value"in t&&e.value===t.value||"class"in t&&e["class"]===t["class"])&&(n=!0)}),n}:function(){return!0}},removeGridLines:function removeGridLines(t,e){var n=this.config,i=this.getGridFilterToRemove(t),a=e?dn.xgridLines:dn.ygridLines,r=e?dn.xgridLine:dn.ygridLine;this.main.select(".".concat(a)).selectAll(".".concat(r)).filter(i).transition().duration(n.transition_duration).style("opacity","0").remove();var o="grid_".concat(e?"x":"y","_lines");n[o]=n[o].filter(function toShow(t){return!i(t)})}}),ii(Wi.prototype,{initTooltip:function initTooltip(){var e=this,n=e.config;if(e.tooltip=e.selectChart.style("position","relative").append("div").attr("class",dn.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none"),n.tooltip_init_show){if(e.isTimeSeries()&&On(n.tooltip_init_x)){var t,i,a=e.data.targets[0];for(n.tooltip_init_x=e.parseDate(n.tooltip_init_x),t=0;(i=a.values[t])&&i.x-n.tooltip_init_x!=0;t++);n.tooltip_init_x=t}e.tooltip.html(n.tooltip_contents.call(e,e.data.targets.map(function(t){return e.addName(t.values[n.tooltip_init_x])}),e.axis.getXAxisTickFormat(),e.getYFormat(e.hasArcType(null,["radar"])),e.color)),e.tooltip.style("top",n.tooltip_init_position.top).style("left",n.tooltip_init_position.left).style("display","block")}},getTooltipContent:function getTooltipContent(t,e,n,i){var a,r,o,s,c=this,u=c.config,l=u.tooltip_format_title||e,h=u.tooltip_format_name||function(t){return t},d=u.tooltip_format_value||(c.isStackNormalized()?function(t,e){return"".concat((100*e).toFixed(2),"%")}:n),f=u.tooltip_order,g=function(t){return c.getBaseValue(t)},p=c.levelColor?function(t){return c.levelColor(t.value)}:function(t){return i(t.id)};if(null===f&&u.data_groups.length){var _=c.orderTargets(c.data.targets).map(function(t){return t.id}).reverse();t.sort(function(t,e){var n=t?t.value:null,i=e?e.value:null;return 0<n&&0<i&&(n=t.id?_.indexOf(t.id):null,i=e.id?_.indexOf(e.id):null),n-i})}else/^(asc|desc)$/.test(f)?t.sort(function(t,e){var n=t?g(t):null,i=e?g(e):null;return"asc"===f?n-i:i-n}):En(f)&&t.sort(f);for(var m=0,x=t.length;m<x;m++)if((r=t[m])&&(g(r)||0===g(r))){if(!a){var y=Jn(l?l(r.x):r.x);a='<table class="'.concat(c.CLASS.tooltip,'">').concat(In(y)?'<tr><th colspan="2">'.concat(y,"</th></tr>"):"")}if(o=[r.ratio,r.id,r.index,t],s=Jn(d.apply(void 0,[g(r)].concat(gn()(o)))),c.isAreaRangeType(r)){var v=["high","low"].map(function(t){return Jn(d.apply(void 0,[c.getAreaRangeData(r,t)].concat(gn()(o))))}),b=zt()(v,2),T=b[0],w=b[1];s="<b>Mid:</b> ".concat(s," <b>High:</b> ").concat(T," <b>Low:</b> ").concat(w)}if(s!==undefined){if(null===r.name)continue;var A=Jn(h.apply(void 0,[r.name].concat(gn()(o)))),k=p(r);a+='<tr class="'.concat(c.CLASS.tooltipName).concat(c.getTargetSelectorSuffix(r.id),'"><td class="name">'),a+=c.patterns?'<svg><rect style="fill:'.concat(k,'" width="10" height="10"></rect></svg>'):'<span style="background-color:'.concat(k,'"></span>'),a+="".concat(A,'</td><td class="value">').concat(s,"</td></tr>")}}return"".concat(a,"</table>")},tooltipPosition:function tooltipPosition(t,e,n,i){var a=this,r=a.config,o=P(i),s=zt()(o,2),c=s[0],u=s[1],l=a.getSvgLeft(!0),h=l+a.currentWidth-a.getCurrentPaddingRight();if(u+=20,a.hasArcType()){"touch"===a.inputType||a.hasType("radar")||(u+=a.height/2,c+=(a.width-(a.isLegendRight?a.getLegendWidth():0))/2)}else{var d=a.x(t[0].x);r.axis_rotated?(u=d+20,c+=l+100,h-=l):(u-=5,c=l+a.getCurrentPaddingLeft(!0)+20+(a.zoomScale?c:d))}return h<c+e&&(c=c-e-50),u+n>a.currentHeight&&(u-=n+30),u<0&&(u=0),c<0&&(c=0),{top:u,left:c}},showTooltip:function showTooltip(t,e){var n=this,i=n.config,a=n.hasArcType(null,["radar"]),r=t.filter(function(t){return t&&In(n.getBaseValue(t))}),o=i.tooltip_position||n.tooltipPosition;if(0!==r.length&&i.tooltip_show){var s=n.tooltip.datum(),c=JSON.stringify(t),u=s&&s.width||0,l=s&&s.height||0;if(!s||s.current!==c){var h=t.concat().sort()[0].index,d=i.tooltip_contents.call(n,t,n.axis.getXAxisTickFormat(),n.getYFormat(a),n.color);Kn(i.tooltip_onshow,n),n.tooltip.html(d).style("display","block").datum({index:h,current:c,width:u=n.tooltip.property("offsetWidth"),height:l=n.tooltip.property("offsetHeight")}),Kn(i.tooltip_onshown,n),n._handleLinkedCharts(!0,h)}var f=o.call(this,r,u,l,e);n.tooltip.style("top","".concat(f.top,"px")).style("left","".concat(f.left,"px"))}},hideTooltip:function hideTooltip(){var t=this.config;Kn(t.tooltip_onhide,this),this.tooltip.style("display","none").datum(null),Kn(t.tooltip_onhidden,this)},_handleLinkedCharts:function _handleLinkedCharts(c,u){var l=this;if(l.config.tooltip_linked){var h=l.config.tooltip_linked_name;(l.api.internal.charts||[]).forEach(function(t){if(t!==l.api){var e=t.internal.config,n=e.tooltip_linked,i=e.tooltip_linked_name,a=document.body.contains(t.element);if(n&&h===i&&a){var r=t.internal.tooltip.data()[0],o=u!==(r&&r.index);try{c&&o?t.tooltip.show({index:u}):!c&&t.tooltip.hide()}catch(s){}}}})}}}),ii(Wi.prototype,{initLegend:function initLegend(){var t=this,e=t.config;t.legendItemTextBox={},t.legendHasRendered=!1,t.legend=t.svg.append("g"),e.legend_show?(t.legend.attr("transform",t.getTranslate("legend")),t.updateLegend()):(t.legend.style("visibility","hidden"),t.hiddenLegendIds=t.mapToIds(t.data.targets))},updateLegend:function updateLegend(t,e,n){var i=this,a=i.config,r=e||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};r.withTransition=$n(r,"withTransition",!0),r.withTransitionForTransform=$n(r,"withTransitionForTransform",!0),a.legend_contents_bindto&&a.legend_contents_template?i.updateLegendTemplate():i.updateLegendElement(t||i.mapToIds(i.data.targets),r,n),i.updateSizes(),i.updateScales(!r.withTransition),i.updateSvgSize(),i.transformAll(r.withTransitionForTransform,n),i.legendHasRendered=!0},updateLegendTemplate:function updateLegendTemplate(){var n=this,t=n.config,e=O(t.legend_contents_bindto),i=t.legend_contents_template;if(!e.empty()){var a=n.data.targets,r=[],o="";n.mapToIds(a).forEach(function(t){var e=En(i)?i.call(n,t,n.color(t),n.api.data(t)[0].values):i.replace(/{=COLOR}/g,n.color(t)).replace(/{=TITLE}/g,t);e&&(r.push(t),o+=e)});var s=e.html(o).selectAll(function(){return this.childNodes}).data(r);n.setLegendItem(s)}},updateSizeForLegend:function updateSizeForLegend(t){var e=this,n=e.config,i=t.width,a=t.height,r={top:e.isLegendTop?e.getCurrentPaddingTop()+n.legend_inset_y+5.5:e.currentHeight-a-e.getCurrentPaddingBottom()-n.legend_inset_y,left:e.isLegendLeft?e.getCurrentPaddingLeft()+n.legend_inset_x+.5:e.currentWidth-i-e.getCurrentPaddingRight()-n.legend_inset_x+.5};e.margin3={top:e.isLegendRight?0:e.isLegendInset?r.top:e.currentHeight-a,right:NaN,bottom:0,left:e.isLegendRight?e.currentWidth-i:e.isLegendInset?r.left:0}},transformLegend:function transformLegend(t){(t?this.legend.transition():this.legend).attr("transform",this.getTranslate("legend"))},updateLegendStep:function updateLegendStep(t){this.legendStep=t},updateLegendItemWidth:function updateLegendItemWidth(t){this.legendItemWidth=t},updateLegendItemHeight:function updateLegendItemHeight(t){this.legendItemHeight=t},getLegendWidth:function getLegendWidth(){return this.config.legend_show?this.isLegendRight||this.isLegendInset?this.legendItemWidth*(this.legendStep+1):this.currentWidth:0},getLegendHeight:function getLegendHeight(){return this.config.legend_show?this.isLegendRight?this.currentHeight:Math.max(20,this.legendItemHeight)*(this.legendStep+1):0},opacityForLegend:function opacityForLegend(t){return t.classed(dn.legendItemHidden)?null:"1"},opacityForUnfocusedLegend:function opacityForUnfocusedLegend(t){return t.classed(dn.legendItemHidden)?null:"0.3"},toggleFocusLegend:function toggleFocusLegend(t,e){var n=this,i=n.mapToTargetIds(t);n.legend.selectAll(".".concat(dn.legendItem)).filter(function(t){return 0<=i.indexOf(t)}).classed(dn.legendItemFocused,e).transition().duration(100).style("opacity",function(){return(e?n.opacityForLegend:n.opacityForUnfocusedLegend).call(n,O(this))})},revertLegend:function revertLegend(){var t=this;t.legend.selectAll(".".concat(dn.legendItem)).classed(dn.legendItemFocused,!1).transition().duration(100).style("opacity",function(){return t.opacityForLegend(O(this))})},showLegend:function showLegend(t){var e=this,n=e.config;n.legend_show||(n.legend_show=!0,e.legend.style("visibility","visible"),!e.legendHasRendered&&e.updateLegend()),e.removeHiddenLegendIds(t),e.legend.selectAll(e.selectorLegends(t)).style("visibility","visible").transition().style("opacity",function(){return e.opacityForLegend(O(this))})},hideLegend:function hideLegend(t){var e=this.config;e.legend_show&&Gn(t)&&(e.legend_show=!1,this.legend.style("visibility","hidden")),this.addHiddenLegendIds(t),this.legend.selectAll(this.selectorLegends(t)).style("opacity","0").style("visibility","hidden")},clearLegendItemTextBoxCache:function clearLegendItemTextBoxCache(){this.legendItemTextBox={}},setLegendItem:function setLegendItem(t){var n=this,e=n.config,i="touch"===n.inputType;t.attr("class",function(t){var e=O(this);return(!e.empty()&&e.attr("class")||"")+n.generateClass(dn.legendItem,t)}).style("visibility",function(t){return n.isLegendToShow(t)?"visible":"hidden"}).style("cursor","pointer").on("click",function(t){Kn(e.legend_item_onclick,n,t)||(E.altKey?(n.api.hide(),n.api.show(t)):(n.api.toggle(t),!i&&n.isTargetToShow(t)?n.api.focus(t):n.api.revert())),i&&n.hideTooltip()}),i||t.on("mouseout",function(t){Kn(e.legend_item_onout,n,t)||(O(this).classed(dn.legendItemFocused,!1),n.api.revert())}).on("mouseover",function(t){Kn(e.legend_item_onover,n,t)||(O(this).classed(dn.legendItemFocused,!0),!n.transiting&&n.isTargetToShow(t)&&n.api.focus(t))})},updateLegendElement:function updateLegendElement(t,e){var n,i,a,g=this,p=g.config,_=p.legend_item_tile_width+5,m=0,x=0,y=0,v={},b={},T={},w=[0],A={},k=0,C=g.isLegendRight||g.isLegendInset,S=t.filter(function(t){return!Nn(p.data_names[t])||null!==p.data_names[t]}),r=e.withTransition,o=function(t,e,n){var i,a,r,o=n===S.length-1,s=(a=t,r=e,g.legendItemTextBox[r]||(g.legendItemTextBox[r]=g.getTextRect(a,dn.legendItem)),g.legendItemTextBox[r]),c=s.width+_+(o&&!C?0:10)+p.legend_padding,u=s.height+4,l=C?u:c,h=C?g.getLegendHeight():g.getLegendWidth(),d=function(t,e){e||(i=(h-y-l)/2)<10&&(i=(h-l)/2,y=0,k++),A[t]=k,w[k]=g.isLegendInset?10:i,v[t]=y,y+=l};if(0===n&&(x=m=k=y=0),p.legend_show&&!g.isLegendToShow(e))return b[e]=0,T[e]=0,A[e]=0,void(v[e]=0);b[e]=c,T[e]=u,(!m||m<=c)&&(m=c),(!x||x<=u)&&(x=u);var f=C?x:m;p.legend_equally?(Object.keys(b).forEach(function(t){return b[t]=m}),Object.keys(T).forEach(function(t){return T[t]=x}),(i=(h-f*S.length)/2)<10?(k=y=0,S.forEach(function(t){return d(t)})):d(e,!0)):d(e)};g.isLegendInset&&(k=p.legend_inset_step?p.legend_inset_step:S.length,g.updateLegendStep(k)),i=g.isLegendRight?(n=function(t){return m*A[t]},function(t){return w[A[t]]+v[t]}):g.isLegendInset?(n=function(t){return m*A[t]+10},function(t){return w[A[t]]+v[t]}):(n=function(t){return w[A[t]]+v[t]},function(t){return x*A[t]});var s=function(t,e){return n(t,e)+4+p.legend_item_tile_width},c=function(t,e){return n(t,e)},h=function(t,e){return n(t,e)-2},u=function(t,e){return n(t,e)-2+p.legend_item_tile_width},l=function(t,e){return i(t,e)+9},d=function(t,e){return i(t,e)-5},f=function(t,e){return i(t,e)+4},M=g.legend.selectAll(".".concat(dn.legendItem)).data(S).enter().append("g");g.setLegendItem(M),M.append("text").text(function(t){return Nn(p.data_names[t])?p.data_names[t]:t}).each(function(t,e){o(this,t,e)}).style("pointer-events","none").attr("x",C?s:-200).attr("y",C?-200:l),M.append("rect").attr("class",dn.legendItemEvent).style("fill-opacity","0").attr("x",C?c:-200).attr("y",C?-200:d);var L=g.config.legend_usePoint;if(L){var D=[];M.append(function(t){var e=jn(p.point_pattern)?p.point_pattern:[p.point_type];-1===D.indexOf(t)&&D.push(t);var n=e[D.indexOf(t)%e.length];return"rectangle"===n&&(n="rect"),document.createElementNS(I.svg,g.hasValidPointType(n)?n:"use")}).attr("class",dn.legendItemPoint).style("fill",function(t){return g.color(t)}).style("pointer-events","none").attr("href",function(t,e,n){return"use"===n[e].nodeName.toLowerCase()?"#".concat(g.datetimeId,"-point-").concat(t):undefined})}else M.append("line").attr("class",dn.legendItemTile).style("stroke",g.color).style("pointer-events","none").attr("x1",C?h:-200).attr("y1",C?-200:f).attr("x2",C?u:-200).attr("y2",C?-200:f).attr("stroke-width",p.legend_item_tile_height);a=g.legend.select(".".concat(dn.legendBackground," rect")),g.isLegendInset&&0<m&&0===a.size()&&(a=g.legend.insert("g",".".concat(dn.legendItem)).attr("class",dn.legendBackground).append("rect"));var F=g.legend.selectAll("text").data(S).text(function(t){return Nn(p.data_names[t])?p.data_names[t]:t}).each(function(t,e){o(this,t,e)});(r?F.transition():F).attr("x",s).attr("y",l);var R=g.legend.selectAll("rect.".concat(dn.legendItemEvent)).data(S);if((r?R.transition():R).attr("width",function(t){return b[t]}).attr("height",function(t){return T[t]}).attr("x",c).attr("y",d),L){var z=g.legend.selectAll(".".concat(dn.legendItemPoint)).data(S);(r?z.transition():z).each(function(){var t,e,n,i=this.nodeName.toLowerCase(),a=g.config.point_r,r="x",o="y",s=2,c=2.5;if("circle"===i){var u=.2*a;r="cx",o="cy",t=a+u,s=2*a,c=-u}else if("rect"===i){var l=2.5*a;n=e=l,c=3}O(this).attr(r,function(t){return h(t)+s}).attr(o,function(t){return f(t)-c}).attr("r",t).attr("width",e).attr("height",n)})}else{var X=g.legend.selectAll("line.".concat(dn.legendItemTile)).data(S);(r?X.transition():X).style("stroke",g.color).attr("x1",h).attr("y1",f).attr("x2",u).attr("y2",f)}a&&(r?a.transition():a).attr("height",g.getLegendHeight()-12).attr("width",m*(k+1)+10),g.legend.selectAll(".".concat(dn.legendItem)).classed(dn.legendItemHidden,function(t){return!g.isTargetToShow(t)}),g.updateLegendItemWidth(m),g.updateLegendItemHeight(x),g.updateLegendStep(k)}});var ja=function(){var t=0<arguments.length&&arguments[0]!==undefined?arguments[0]:"left",e=1<arguments.length?arguments[1]:undefined,n=Pn(e);return-1<t.indexOf("center")?n?e/2:"middle":-1<t.indexOf("right")?n?e:"end":n?0:"start"};ii(Wi.prototype,{initTitle:function initTitle(){if(this.config.title_text){this.title=this.svg.append("g");var n=this.title.append("text").style("text-anchor",ja(this.config.title_position)).attr("class",this.CLASS.title);this.config.title_text.split("\n").forEach(function(t,e){n.append("tspan").attr("x",0).attr("dy","".concat(e?"1.5":".3","em")).text(t)})}},redrawTitle:function redrawTitle(){var t=this;if(t.title){var e=t.yForTitle.call(t);/g/i.test(t.title.node().tagName)?t.title.attr("transform","translate(".concat(ja(t.config.title_position,t.currentWidth),", ").concat(e,")")):t.title.attr("x",t.xForTitle.call(t)).attr("y",e)}},xForTitle:function xForTitle(){var t,e=this.config,n=e.title_position||"left";return/(right|center)/.test(n)?(t=this.currentWidth-this.getTextRect(this.title,this.CLASS.title).width,0<=n.indexOf("right")?t-=e.title_padding.right||0:0<=n.indexOf("center")&&(t/=2)):t=e.title_padding.left||0,t},yForTitle:function yForTitle(){return(this.config.title_padding.top||0)+this.getTextRect(this.title,this.CLASS.title).height},getTitlePadding:function getTitlePadding(){return this.yForTitle()+(this.config.title_padding.bottom||0)}}),ii(Wi.prototype,{getClipPath:function getClipPath(t){var e=this.config;if(!e.clipPath&&/-clip$/.test(t)||!e.axis_x_clipPath&&/-clip-xaxis$/.test(t)||!e.axis_y_clipPath&&/-clip-yaxis$/.test(t))return null;var n=0<=window.navigator.appVersion.toLowerCase().indexOf("msie 9.");return"url(".concat(n?"":document.URL.split("#")[0],"#").concat(t,")")},appendClip:function appendClip(t,e){return t.append("clipPath").attr("id",e).append("rect")},getAxisClipX:function getAxisClipX(t){var e=Math.max(30,this.margin.left);return t?-(1+e):-(e-1)},getAxisClipY:function getAxisClipY(t){return t?-20:-this.margin.top},getXAxisClipX:function getXAxisClipX(){return this.getAxisClipX(!this.config.axis_rotated)},getXAxisClipY:function getXAxisClipY(){return this.getAxisClipY(!this.config.axis_rotated)},getYAxisClipX:function getYAxisClipX(){return this.config.axis_y_inner?-1:this.getAxisClipX(this.config.axis_rotated)},getYAxisClipY:function getYAxisClipY(){return this.getAxisClipY(this.config.axis_rotated)},getAxisClipWidth:function getAxisClipWidth(t){var e=Math.max(30,this.margin.left),n=Math.max(30,this.margin.right);return t?this.width+2+e+n:this.margin.left+20},getAxisClipHeight:function getAxisClipHeight(t){return(t?this.margin.bottom:this.margin.top+this.height)+20},getXAxisClipWidth:function getXAxisClipWidth(){return this.getAxisClipWidth(!this.config.axis_rotated)},getXAxisClipHeight:function getXAxisClipHeight(){return this.getAxisClipHeight(!this.config.axis_rotated)},getYAxisClipWidth:function getYAxisClipWidth(){return this.getAxisClipWidth(this.config.axis_rotated)+(this.config.axis_y_inner?20:0)},getYAxisClipHeight:function getYAxisClipHeight(){return this.getAxisClipHeight(this.config.axis_rotated)}}),ii(Wi.prototype,{initRegion:function initRegion(){this.region=this.main.append("g").attr("clip-path",this.clipPath).attr("class",dn.regions)},updateRegion:function updateRegion(t){var e=this,n=e.config;e.region.style("visibility",e.hasArcType()?"hidden":"visible"),e.mainRegion=e.main.select(".".concat(dn.regions)).selectAll(".".concat(dn.region)).data(n.regions),e.mainRegion.exit().transition().duration(t).style("opacity","0").remove(),e.mainRegion=e.mainRegion.enter().append("g").merge(e.mainRegion).attr("class",e.classRegion.bind(e)),e.mainRegion.append("rect").style("fill-opacity","0")},redrawRegion:function redrawRegion(t){var e=this.mainRegion.select("rect");return e=(t?e.transition():e).attr("x",this.regionX.bind(this)).attr("y",this.regionY.bind(this)).attr("width",this.regionWidth.bind(this)).attr("height",this.regionHeight.bind(this)),[(t?e.transition():e).style("fill-opacity",function(t){return In(t.opacity)?t.opacity:"0.1"}).on("end",function(){O(this.parentNode).selectAll("rect:not([x])").remove()})]},getRegionXY:function getRegionXY(t,e){var n=this.config.axis_rotated,i="x"===t,a="start",r=0;return"y"===e.axis||"y2"===e.axis?(!i&&(a="end"),(i?n:!n)&&a in e&&(r=(0,this[e.axis])(e[a]))):(i?!n:n)&&a in e&&(r=(this.zoomScale||this.x)(this.isTimeSeries()?this.parseDate(e[a]):e[a])),r},regionX:function regionX(t){return this.getRegionXY("x",t)},regionY:function regionY(t){return this.getRegionXY("y",t)},getRegionSize:function getRegionSize(t,e){var n=this.config.axis_rotated,i="width"===t,a=this[i?"regionX":"regionY"](e),r="end",o=this[t];return"y"===e.axis||"y2"===e.axis?(!i&&(r="start"),(i?n:!n)&&r in e&&(o=(0,this[e.axis])(e[r]))):(i?!n:n)&&r in e&&(o=(this.zoomScale||this.x)(this.isTimeSeries()?this.parseDate(e[r]):e[r])),o<a?0:o-a},regionWidth:function regionWidth(t){return this.getRegionSize("width",t)},regionHeight:function regionHeight(t){return this.getRegionSize("height",t)},isRegionOnX:function isRegionOnX(t){return!t.axis||"x"===t.axis}}),ii(Wi.prototype,{drag:function drag(t){var x=this,e=x.config,n=x.main;if(!x.hasArcType()&&e.data_selection_enabled&&(!e.zoom_enabled||x.zoom.altDomain)&&e.data_selection_multiple){var i=zt()(x.dragStart,2),a=i[0],r=i[1],o=zt()(t,2),s=o[0],c=o[1],y=Math.min(a,s),v=Math.max(a,s),b=e.data_selection_grouped?x.margin.top:Math.min(r,c),T=e.data_selection_grouped?x.height:Math.max(r,c);n.select(".".concat(dn.dragarea)).attr("x",y).attr("y",b).attr("width",v-y).attr("height",T-b),n.selectAll(".".concat(dn.shapes)).selectAll(".".concat(dn.shape)).filter(function(t){return e.data_selection_isselectable(t)}).each(function(t,e){var n,i,a,r,o,s,c=O(this),u=c.classed(dn.SELECTED),l=c.classed(dn.INCLUDED),h=!1;if(c.classed(dn.circle)){var d=1*c.attr("cx"),f=1*c.attr("cy");n=x.togglePoint,h=y<d&&d<v&&b<f&&f<T}else{if(!c.classed(dn.bar))return;var g=(a=(i=this).getBoundingClientRect(),r=a.width,o=a.height,{x:(s=Qn(i))[0].x,y:Math.min(s[0].y,s[1].y),width:r,height:o}),p=g.x,_=(f=g.y,g.width),m=g.height;n=x.togglePath,h=!(v<p||p+_<y||T<f||f+m<b)}h^l&&(c.classed(dn.INCLUDED,!l),c.classed(dn.SELECTED,!u),n.call(x,!u,c,t,e))})}},dragstart:function dragstart(t){var e=this.config;this.hasArcType()||!e.data_selection_enabled||(this.dragStart=t,this.main.select(".".concat(dn.chart)).append("rect").attr("class",dn.dragarea).style("opacity","0.1"),this.setDragStatus(!0))},dragend:function dragend(){var t=this.config;this.hasArcType()||!t.data_selection_enabled||(this.main.select(".".concat(dn.dragarea)).transition().duration(100).style("opacity","0").remove(),this.main.selectAll(".".concat(dn.shape)).classed(dn.INCLUDED,!1),this.setDragStatus(!1))},setDragStatus:function setDragStatus(t){this.dragging=t}}),ii(Wi.prototype,{selectPoint:function selectPoint(t,e,n){var i=this,a=i.config,r=a.axis_rotated,o=(r?i.circleY:i.circleX).bind(i),s=(r?i.circleX:i.circleY).bind(i),c=i.pointSelectR.bind(i);Kn(a.data_onselected,i.api,e,t.node()),i.main.select(".".concat(dn.selectedCircles).concat(i.getTargetSelectorSuffix(e.id))).selectAll(".".concat(dn.selectedCircle,"-").concat(n)).data([e]).enter().append("circle").attr("class",function(){return i.generateClass(dn.selectedCircle,n)}).attr("cx",o).attr("cy",s).attr("stroke",i.color).attr("r",function(t){return 1.4*i.pointSelectR(t)}).transition().duration(100).attr("r",c)},unselectPoint:function unselectPoint(t,e,n){Kn(this.config.data_onunselected,this.api,e,t.node()),this.main.select(".".concat(dn.selectedCircles).concat(this.getTargetSelectorSuffix(e.id))).selectAll(".".concat(dn.selectedCircle,"-").concat(n)).transition().duration(100).attr("r",0).remove()},togglePoint:function togglePoint(t,e,n,i){this["".concat(t?"":"un","selectPoint")](e,n,i)},selectPath:function selectPath(t,e){var n=this,i=n.config;Kn(i.data_onselected,n,e,t.node()),i.interaction_brighten&&t.transition().duration(100).style("fill",function(){return color_rgb(n.color(e)).brighter(.75)})},unselectPath:function unselectPath(t,e){var n=this,i=n.config;Kn(i.data_onunselected,n,e,t.node()),i.interaction_brighten&&t.transition().duration(100).style("fill",function(){return n.color(e)})},togglePath:function togglePath(t,e,n,i){this["".concat(t?"":"un","selectPath")](e,n,i)},getToggle:function getToggle(t,e){return"path"===t.nodeName?this.togglePath:this.isStepType(e)?function(){}:this.togglePoint},toggleShape:function toggleShape(t,e,n){var i,a=this.config,r=O(t),o=r.classed(dn.SELECTED),s=this.getToggle(t,e).bind(this);if(a.data_selection_enabled&&a.data_selection_isselectable(e)){if(!a.data_selection_multiple){var c=".".concat(dn.shapes);a.data_selection_grouped&&(c+=this.getTargetSelectorSuffix(e.id)),this.main.selectAll(c).selectAll(".".concat(dn.shape)).each(function(t,e){var n=O(this);n.classed(dn.SELECTED)&&s(!1,(i=n).classed(dn.SELECTED,!1),t,e)})}i&&i.node()===r.node()||(r.classed(dn.SELECTED,!o),s(!o,r,e,n))}}}),ii(Wi.prototype,{initBrush:function initBrush(){var i=this,a=i.config,r=a.axis_rotated,o=!0;i.brush=r?function brushY(){return brush_brush(Ln)}():function brushX(){return brush_brush(Mn)}(),i.brush.handleSize(20);var t=function(t){o||i.redrawForBrush(t)};i.brush.on("start",function(){"touch"===i.inputType&&(i.hideTooltip(),i.unexpandCircles()),t(!1)}).on("brush",function(){t(!0)}).on("end",function(){t(!1)}),i.brush.update=function(){return 0===this.extent()()[1].filter(function(t){return isNaN(t)}).length&&i.context&&i.context.select(".".concat(dn.brush)).call(this),this},i.brush.scale=function(t,e){var n=[[0,0]];t.range?n.push([t.range()[1],e||a.subchart_size_height]):t.constructor===Array&&n.push(t),r&&n[1].reverse(),this.extent(a.axis_x_extent||n),this.update()},i.brush.getSelection=function(){return i.context?i.context.select(".".concat(dn.brush)):O([])},i.brush.initZoom=function(){var t=!1;if(o&&i.config.subchart_defzoom){var e=this.extent()(),n=i.config.subchart_defzoom(e);n&&n.length&&(i.brush.move.call(this,i.brush.getSelection(),n),i.brushHandlesUpdate(),t=!0)}return o=!1,t}},initSubchart:function initSubchart(){var n=this,t=n.config,e=t.subchart_show?"visible":"hidden",i="".concat(n.clipId,"-subchart"),a=n.getClipPath(i);n.clipIdForSubchart=i,n.appendClip(n.defs,i),n.initBrush(),n.context=n.svg.append("g").attr("transform",n.getTranslate("context"));var r=n.context;r.style("visibility",e),r.append("g").attr("clip-path",a).attr("class",dn.chart),n.hasType("bar")&&r.select(".".concat(dn.chart)).append("g").attr("class",dn.chartBars),r.select(".".concat(dn.chart)).append("g").attr("class",dn.chartLines),n.axes.subx=r.append("g").attr("class",dn.axisX).attr("transform",n.getTranslate("subx")).attr("clip-path",t.axis_rotated?"":n.clipPathForXAxis).style("visibility",t.subchart_axis_x_show?e:"hidden"),r.append("g").attr("class",dn.brush).call(n.brush);var o=r.select(".".concat(dn.brush)),s=r.select(".".concat("handle--w")),c=r.select(".".concat("handle--e")),u=t.subchart_size_height;n.brushHandleW=o.insert("line",":first-child").attr("class","bb-brush-handle bb-brush-handle--w").attr("stroke-linecap","round").attr("y1",0).attr("y2",u),n.brushHandleE=o.insert("line",":first-child").attr("class","bb-brush-handle bb-brush-handle--e").attr("stroke-linecap","round").attr("y1",0).attr("y2",u),n.brushHandlesUpdate=function(){var t=parseInt(s.attr("x"),10)+parseInt(s.attr("width")/2,10)+0,e=parseInt(c.attr("x"),10)+parseInt(c.attr("width")/2,10)-0;0<t||0<e?(e<t&&(t=e=(t+e)/2),n.brushHandleW.attr("x1",t).attr("x2",t).style("display",""),n.brushHandleE.attr("x1",e).attr("x2",e).style("display","")):(n.brushHandleW.style("display","none"),n.brushHandleE.style("display","none"))}},updateTargetsForSubchart:function updateTargetsForSubchart(t){var e=this,n=e.context,i=e.config,a=e.classChartBar.bind(e),r=e.classBars.bind(e),o=e.classChartLine.bind(e),s=e.classLines.bind(e),c=e.classAreas.bind(e);if(i.subchart_show){var u=n.select(".".concat(dn.chartBars)).selectAll(".".concat(dn.chartBar)).data(t).attr("class",a);u.enter().append("g").style("opacity","0").attr("class",a).merge(u).append("g").attr("class",r);var l=n.select(".".concat(dn.chartLines)).selectAll(".".concat(dn.chartLine)).data(t).attr("class",o),h=l.enter().append("g").style("opacity","0").attr("class",o).merge(l);h.append("g").attr("class",s),e.hasType("area")&&h.append("g").attr("class",c),n.selectAll(".".concat(dn.brush," rect")).attr(i.axis_rotated?"width":"height",i.axis_rotated?e.width2:e.height2)}},updateBarForSubchart:function updateBarForSubchart(t){var e=this;e.contextBar=e.context.selectAll(".".concat(dn.bars)).selectAll(".".concat(dn.bar)).data(e.barData.bind(e)),e.contextBar.exit().transition().duration(t).style("opacity","0").remove(),e.contextBar=e.contextBar.enter().append("path").attr("class",e.classBar.bind(e)).style("stroke","none").style("fill",e.color).merge(e.contextBar).style("opacity",e.initialOpacity.bind(e))},redrawBarForSubchart:function redrawBarForSubchart(t,e,n){(e?this.contextBar.transition(ei()).duration(n):this.contextBar).attr("d",t).style("opacity","1")},updateLineForSubchart:function updateLineForSubchart(t){var e=this;e.contextLine=e.context.selectAll(".".concat(dn.lines)).selectAll(".".concat(dn.line)).data(e.lineData.bind(e)),e.contextLine.exit().transition().duration(t).style("opacity","0").remove(),e.contextLine=e.contextLine.enter().append("path").attr("class",e.classLine.bind(e)).style("stroke",e.color).merge(e.contextLine).style("opacity",e.initialOpacity.bind(e))},redrawLineForSubchart:function redrawLineForSubchart(t,e,n){(e?this.contextLine.transition(ei()).duration(n):this.contextLine).attr("d",t).style("opacity","1")},updateAreaForSubchart:function updateAreaForSubchart(t){var e=this;e.contextArea=e.context.selectAll(".".concat(dn.areas)).selectAll(".".concat(dn.area)).data(e.lineData.bind(e)),e.contextArea.exit().transition().duration(t).style("opacity","0").remove(),e.contextArea=e.contextArea.enter().append("path").attr("class",e.classArea.bind(e)).style("fill",e.color).style("opacity",function(){return e.orgAreaOpacity=O(this).style("opacity"),"0"}).merge(e.contextArea).style("opacity","0")},redrawAreaForSubchart:function redrawAreaForSubchart(t,e,n){(e?this.contextArea.transition(ei()).duration(n):this.contextArea).attr("d",t).style("fill",this.color).style("opacity",this.orgAreaOpacity)},redrawSubchart:function redrawSubchart(t,i,a){var r=this,e=r.config;r.context.style("visibility",e.subchart_show?"visible":"hidden"),e.subchart_show&&(E&&"zoom"===E.type&&r.brush.update(),t&&(!ni(r)&&r.brush.update(),Object.keys(a.type).forEach(function(t){var e=ai(t),n=r["generateDraw".concat(e)](a.indices[t],!0);r["update".concat(e,"ForSubchart")](i),r["redraw".concat(e,"ForSubchart")](n,i,i)})),r.brushHandlesUpdate&&r.brushHandlesUpdate())},redrawForBrush:function redrawForBrush(t){var e=this.x;this.redraw({withTransition:!1,withY:this.config.zoom_rescale,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1,withMoving:t}),this.config.subchart_onbrush.call(this.api,e.orgDomain())},transformContext:function transformContext(t,e){var n;e&&e.axisSubX?n=e.axisSubX:(n=this.context.select(".".concat(dn.axisX)),t&&(n=n.transition())),this.context.attr("transform",this.getTranslate("context")),n.attr("transform",this.getTranslate("subx"))},getDefaultExtent:function getDefaultExtent(){var t=this.config,e=En(t.axis_x_extent)?t.axis_x_extent(this.getXDomain(this.data.targets)):t.axis_x_extent;return this.isTimeSeries()&&(e=[this.parseDate(e[0]),this.parseDate(e[1])]),e}});var qa=function(t){return function(){return t}};function ZoomEvent(t,e,n){this.target=t,this.type=e,this.transform=n}function Transform(t,e,n){this.k=t,this.x=e,this.y=n}Transform.prototype={constructor:Transform,scale:function(t){return 1===t?this:new Transform(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Transform(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Za=new Transform(1,0,0);function transform_transform(t){return t.__zoom||Za}function src_noevent_nopropagation(){E.stopImmediatePropagation()}transform_transform.prototype=Transform.prototype;var $a=function(){E.preventDefault(),E.stopImmediatePropagation()};function zoom_defaultFilter(){return!E.button}function zoom_defaultExtent(){var t,e,n=this;return e=n instanceof SVGElement?(t=(n=n.ownerSVGElement||n).width.baseVal.value,n.height.baseVal.value):(t=n.clientWidth,n.clientHeight),[[0,0],[t,e]]}function defaultTransform(){return this.__zoom||Za}function defaultWheelDelta(){return-E.deltaY*(E.deltaMode?120:1)/500}function zoom_defaultTouchable(){return"ontouchstart"in this}function defaultConstrain(t,e,n){var i=t.invertX(e[0][0])-n[0][0],a=t.invertX(e[1][0])-n[1][0],r=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i<a?(i+a)/2:Math.min(0,i)||Math.max(0,a),r<o?(r+o)/2:Math.min(0,r)||Math.max(0,o))}ii(Wi.prototype,{initZoom:function initZoom(){this.zoomScale=null,this.generateZoom()},bindZoomEvent:function bindZoomEvent(){var t=!(0<arguments.length&&arguments[0]!==undefined)||arguments[0],e=this.config.zoom_enabled;this.redrawEventRect();var n=this.main.select(".".concat(dn.eventRects));e&&t?this.bindZoomOnEventRect(n,e.type):!1===t&&(this.api.unzoom(),n.on(".zoom",null).on(".drag",null))},generateZoom:function generateZoom(){var a=this,r=a.config,t=function(){var f,r,s=zoom_defaultFilter,l=zoom_defaultExtent,g=defaultConstrain,a=defaultWheelDelta,e=zoom_defaultTouchable,o=[0,Infinity],p=[[-Infinity,-Infinity],[Infinity,Infinity]],c=250,h=$e,u=[],n=Yt("start","zoom","end"),d=500,_=150,m=0;function zoom(t){t.property("__zoom",defaultTransform).on("wheel.zoom",wheeled).on("mousedown.zoom",mousedowned).on("dblclick.zoom",dblclicked).filter(e).on("touchstart.zoom",touchstarted).on("touchmove.zoom",touchmoved).on("touchend.zoom touchcancel.zoom",touchended).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function scale(t,e){return(e=Math.max(o[0],Math.min(o[1],e)))===t.k?t:new Transform(e,t.x,t.y)}function translate(t,e,n){var i=e[0]-n[0]*t.k,a=e[1]-n[1]*t.k;return i===t.x&&a===t.y?t:new Transform(t.k,i,a)}function centroid(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function schedule(t,c,u){t.on("start.zoom",function(){gesture(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){gesture(this,arguments).end()}).tween("zoom",function(){var t=arguments,i=gesture(this,t),e=l.apply(this,t),a=u||centroid(e),r=Math.max(e[1][0]-e[0][0],e[1][1]-e[0][1]),n=this.__zoom,o="function"==typeof c?c.apply(this,t):c,s=h(n.invert(a).concat(r/n.k),o.invert(a).concat(r/o.k));return function(t){if(1===t)t=o;else{var e=s(t),n=r/e[2];t=new Transform(n,a[0]-e[0]*n,a[1]-e[1]*n)}i.zoom(null,t)}})}function gesture(t,e){for(var n,i=0,a=u.length;i<a;++i)if((n=u[i]).that===t)return n;return new Gesture(t,e)}function Gesture(t,e){this.that=t,this.args=e,this.index=-1,this.active=0,this.extent=l.apply(t,e)}function wheeled(){if(s.apply(this,arguments)){var t=gesture(this,arguments),e=this.__zoom,n=Math.max(o[0],Math.min(o[1],e.k*Math.pow(2,a.apply(this,arguments)))),i=P(this);if(t.wheel)t.mouse[0][0]===i[0]&&t.mouse[0][1]===i[1]||(t.mouse[1]=e.invert(t.mouse[0]=i)),clearTimeout(t.wheel);else{if(e.k===n)return;t.mouse=[i,e.invert(i)],ee(this),t.start()}$a(),t.wheel=setTimeout(function wheelidled(){t.wheel=null,t.end()},_),t.zoom("mouse",g(translate(scale(e,n),t.mouse[0],t.mouse[1]),t.extent,p))}}function mousedowned(){if(!r&&s.apply(this,arguments)){var n=gesture(this,arguments),t=O(E.view).on("mousemove.zoom",function mousemoved(){if($a(),!n.moved){var t=E.clientX-i,e=E.clientY-a;n.moved=m<t*t+e*e}n.zoom("mouse",g(translate(n.that.__zoom,n.mouse[0]=P(n.that),n.mouse[1]),n.extent,p))},!0).on("mouseup.zoom",function mouseupped(){t.on("mousemove.zoom mouseup.zoom",null),yesdrag(E.view,n.moved),$a(),n.end()},!0),e=P(this),i=E.clientX,a=E.clientY;xn(E.view),src_noevent_nopropagation(),n.mouse=[e,this.__zoom.invert(e)],ee(this),n.start()}}function dblclicked(){if(s.apply(this,arguments)){var t=this.__zoom,e=P(this),n=t.invert(e),i=t.k*(E.shiftKey?.5:2),a=g(translate(scale(t,i),e,n),l.apply(this,arguments),p);$a(),0<c?O(this).transition().duration(c).call(schedule,a,e):O(this).call(zoom.transform,a)}}function touchstarted(){if(s.apply(this,arguments)){var t,e,n,i,a=gesture(this,arguments),r=E.changedTouches,o=r.length;for(src_noevent_nopropagation(),e=0;e<o;++e)n=r[e],i=[i=y(this,r,n.identifier),this.__zoom.invert(i),n.identifier],a.touch0?a.touch1||(a.touch1=i):(a.touch0=i,t=!0);if(f&&(f=clearTimeout(f),!a.touch1))return a.end(),void((i=O(this).on("dblclick.zoom"))&&i.apply(this,arguments));t&&(f=setTimeout(function(){f=null},d),ee(this),a.start())}}function touchmoved(){var t,e,n,i,a=gesture(this,arguments),r=E.changedTouches,o=r.length;for($a(),f&&(f=clearTimeout(f)),t=0;t<o;++t)e=r[t],n=y(this,r,e.identifier),a.touch0&&a.touch0[2]===e.identifier?a.touch0[0]=n:a.touch1&&a.touch1[2]===e.identifier&&(a.touch1[0]=n);if(e=a.that.__zoom,a.touch1){var s=a.touch0[0],c=a.touch0[1],u=a.touch1[0],l=a.touch1[1],h=(h=u[0]-s[0])*h+(h=u[1]-s[1])*h,d=(d=l[0]-c[0])*d+(d=l[1]-c[1])*d;e=scale(e,Math.sqrt(h/d)),n=[(s[0]+u[0])/2,(s[1]+u[1])/2],i=[(c[0]+l[0])/2,(c[1]+l[1])/2]}else{if(!a.touch0)return;n=a.touch0[0],i=a.touch0[1]}a.zoom("touch",g(translate(e,n,i),a.extent,p))}function touchended(){var t,e,n=gesture(this,arguments),i=E.changedTouches,a=i.length;for(src_noevent_nopropagation(),r&&clearTimeout(r),r=setTimeout(function(){r=null},d),t=0;t<a;++t)e=i[t],n.touch0&&n.touch0[2]===e.identifier?delete n.touch0:n.touch1&&n.touch1[2]===e.identifier&&delete n.touch1;n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0?n.touch0[1]=this.__zoom.invert(n.touch0[0]):n.end()}return zoom.transform=function(t,e){var n=t.selection?t.selection():t;n.property("__zoom",defaultTransform),t!==n?schedule(t,e):n.interrupt().each(function(){gesture(this,arguments).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()})},zoom.scaleBy=function(t,e){zoom.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)})},zoom.scaleTo=function(t,r){zoom.transform(t,function(){var t=l.apply(this,arguments),e=this.__zoom,n=centroid(t),i=e.invert(n),a="function"==typeof r?r.apply(this,arguments):r;return g(translate(scale(e,a),n,i),t,p)})},zoom.translateBy=function(t,e,n){zoom.transform(t,function(){return g(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),l.apply(this,arguments),p)})},zoom.translateTo=function(t,i,a){zoom.transform(t,function(){var t=l.apply(this,arguments),e=this.__zoom,n=centroid(t);return g(Za.translate(n[0],n[1]).scale(e.k).translate("function"==typeof i?-i.apply(this,arguments):-i,"function"==typeof a?-a.apply(this,arguments):-a),t,p)})},Gesture.prototype={start:function(){return 1==++this.active&&(this.index=u.push(this)-1,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(u.splice(this.index,1),this.index=-1,this.emit("end")),this},emit:function(t){customEvent(new ZoomEvent(zoom,t,this.that.__zoom),n.apply,n,[t,this.that,this.args])}},zoom.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:qa(+t),zoom):a},zoom.filter=function(t){return arguments.length?(s="function"==typeof t?t:qa(!!t),zoom):s},zoom.touchable=function(t){return arguments.length?(e="function"==typeof t?t:qa(!!t),zoom):e},zoom.extent=function(t){return arguments.length?(l="function"==typeof t?t:qa([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),zoom):l},zoom.scaleExtent=function(t){return arguments.length?(o[0]=+t[0],o[1]=+t[1],zoom):[o[0],o[1]]},zoom.translateExtent=function(t){return arguments.length?(p[0][0]=+t[0][0],p[1][0]=+t[1][0],p[0][1]=+t[0][1],p[1][1]=+t[1][1],zoom):[[p[0][0],p[0][1]],[p[1][0],p[1][1]]]},zoom.constrain=function(t){return arguments.length?(g=t,zoom):g},zoom.duration=function(t){return arguments.length?(c=+t,zoom):c},zoom.interpolate=function(t){return arguments.length?(h=t,zoom):h},zoom.on=function(){var t=n.on.apply(n,arguments);return t===n?zoom:t},zoom.clickDistance=function(t){return arguments.length?(m=(t=+t)*t,zoom):Math.sqrt(m)},zoom}().duration(0).on("start",a.onZoomStart.bind(a)).on("zoom",a.onZoom.bind(a)).on("end",a.onZoomEnd.bind(a));t.orgScaleExtent=function(){var t=r.zoom_extent||[1,10];return[t[0],Math.max(a.getMaxDataCount()/t[1],t[1])]},t.updateScaleExtent=function(){var t=Un(a.x.orgDomain())/Un(a.getZoomDomain()),e=this.orgScaleExtent();return this.scaleExtent([e[0]*t,e[1]*t]),this},t.updateTransformScale=function(t){var e=t.rescaleX(a.x),n=a.trimXDomain(e.domain()),i=r.zoom_rescale;e.domain(n,a.orgXDomain),a.zoomScale=a.getCustomizedScale(e),a.xAxis.scale(a.zoomScale),i&&a.x.domain(a.zoomScale.orgDomain())},a.zoom=t},onZoomStart:function onZoomStart(){var t=E.sourceEvent;t&&(this.zoom.altDomain=t.altKey?this.x.orgDomain():null,this.zoom.startEvent=t,Kn(this.config.zoom_onzoomstart,this.api,t))},onZoom:function onZoom(){var t=this,e=t.config,n=E;if(e.zoom_enabled&&n.sourceEvent){var i="mousemove"===n.sourceEvent.type,a=n.transform;return t.zoom.updateTransformScale(a),0===t.filterTargetsToShow(t.data.targets).length?void 0:i&&t.zoom.altDomain?(t.x.domain(t.zoom.altDomain),void a.scale(t.zoomScale).updateScaleExtent()):(t.isCategorized()&&t.x.orgDomain()[0]===t.orgXDomain[0]&&t.x.domain([t.orgXDomain[0]-1e-10,t.x.orgDomain()[1]]),t.redraw({withTransition:!1,withY:e.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),t.cancelClick=i,void Kn(e.zoom_onzoom,t.api,t.zoomScale.domain()))}},onZoomEnd:function onZoomEnd(){var t=this.zoom.startEvent;!t||event&&t.clientX===event.clientX&&t.clientY===event.clientY||(this.redrawEventRect(),this.updateZoom(),Kn(this.config.zoom_onzoomend,this.api,this[this.zoomScale?"zoomScale":"subX"].domain()))},getZoomDomain:function getZoomDomain(){var t=this.config,e=zt()(this.orgXDomain,2),n=e[0],i=e[1];return Nn(t.zoom_x_min)&&(n=ci("min",[n,t.zoom_x_min])),Nn(t.zoom_x_max)&&(i=ci("max",[i,t.zoom_x_max])),[n,i]},updateZoom:function updateZoom(t){if(this.zoomScale){var e=this.zoomScale.domain(),n=this.subX.domain(),i=(e[0]<=n[0]||e[0]-.015<=n[0])&&(n[1]<=e[1]||n[1]<=e[1]-.015);(t||i)&&(this.xAxis.scale(this.subX),this.x.domain(this.subX.orgDomain()),this.zoomScale=null)}},bindZoomOnEventRect:function bindZoomOnEventRect(t,e){var n="drag"===e?this.zoomBehaviour:this.zoom;t.call(n).on("dblclick.zoom",null)},initZoomBehaviour:function initZoomBehaviour(){var c=this,t=c.config.axis_rotated,u=0,l=0,h=null;c.zoomBehaviour=vn().clickDistance(4).on("start",function(){c.setDragStatus(!0),h||(h=c.main.append("rect").attr("clip-path",c.clipPath).attr("class",dn.zoomBrush).attr("width",t?c.width:0).attr("height",t?0:c.height)),u=P(this)[0],l=u,h.attr("x",u).attr("width",0),c.onZoomStart()}).on("drag",function(){l=P(this)[0],h.attr("x",Math.min(u,l)).attr("width",Math.abs(l-u))}).on("end",function(){var t,e=c.zoomScale||c.x;if(c.setDragStatus(!1),h.attr("x",0).attr("width",0),l<u&&(u=(t=[l,u])[0],l=t[1]),u<0&&(l+=Math.abs(u),u=0),u!==l)c.api.zoom([u,l].map(function(t){return e.invert(t)})),c.onZoomEnd();else if(c.isMultipleX())c.clickHandlerForMultipleXS.bind(this)(c);else{var n=E.sourceEvent||E,i="clientX"in n?[n.clientX,n.clientY]:[n.x,n.y],a=zt()(i,2),r=a[0],o=a[1],s=document.elementFromPoint(r,o);c.clickHandlerForSingleX.bind(s)(O(s).datum(),c)}})},setZoomResetButton:function setZoomResetButton(){var t=this.config,e=t.zoom_resetButton;e&&"drag"===t.zoom_enabled.type&&(this.zoom.resetBtn?this.zoom.resetBtn.style("display",null):this.zoom.resetBtn=this.selectChart.append("div").classed(dn.button,!0).append("span").on("click",this.api.unzoom.bind(this)).classed(dn.buttonZoomReset,!0).text(e.text||"Reset Zoom"))}});var Ka=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];ii(Wi.prototype,{getColorFromCss:function getColorFromCss(){var t=document.body,e=t.__colorPattern__;if(!e){var n=document.createElement("span");n.className=dn.colorPattern,n.style.display="none",t.appendChild(n);var i=window.getComputedStyle(n).backgroundImage;n.parentNode.removeChild(n),-1<i.indexOf(";")&&(e=i.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(function(t){return t.trim().replace(/[\"'\s]/g,"")}).filter(Boolean),t.__colorPattern__=e)}return e},generateColor:function generateColor(){var c=this,t=c.config,a=t.data_colors,r=t.data_color,o=[],s=jn(t.color_pattern)?t.color_pattern:ordinal(c.getColorFromCss()||Ka).range(),u=s;if(En(t.color_tiles)){var l=t.color_tiles(),e=s.map(function(t,e){var n,i,a,r,o=t.replace(/[#\(\)\s,]/g,""),s="".concat(c.datetimeId,"-pattern-").concat(o,"-").concat(e);return n=l[e%l.length],i=t,a=s,(r=O(n.cloneNode(!0))).attr("id",a).insert("rect",":first-child").attr("width",r.attr("width")).attr("height",r.attr("height")).style("fill",i),{id:a,node:r.node()}});s=e.map(function(t){return"url(#".concat(t.id,")")}),c.patterns=e}return function(t){var e,n=t.id||t.data&&t.data.id||t,i=c.isTypeOf(n,["line","spline","step"])||!c.config.data_types[n];return En(a[n])?e=a[n](t):a[n]?e=a[n]:(o.indexOf(n)<0&&o.push(n),e=i?u[o.indexOf(n)%u.length]:s[o.indexOf(n)%s.length],a[n]=e),En(r)?r(e,t):e}},generateLevelColor:function generateLevelColor(){var t=this.config,i=t.color_pattern,e=t.color_threshold,a="value"===e.unit,r=e.max||100,o=e.values&&e.values.length?e.values:[];return jn(e)?function(t){for(var e=i[i.length-1],n=0;n<o.length;n++)if((a?t:100*t/r)<o[n]){e=i[n];break}return e}:null},setOverColor:function setOverColor(t,e){var n=this,i=n.config.color_onover,a=t?i:n.color;Zn(a)?a=function(t){var e=t.id;return e in i?i[e]:n.color(e)}:On(a)&&(a=function(){return i}),Zn(e)?n.main.selectAll(".".concat(dn.arc,"-").concat(e.id)).style("fill",a(e)):n.main.selectAll(".".concat(dn.shape,"-").concat(e)).each(function(t){var e=a(t);this.style.stroke=e,this.style.fill=e})}});var Ja=function(t,e,n){var i=t.config,a="axis_".concat(e,"_tick_format");return(i[a]?i[a]:t.defaultValueFormat)(n)};ii(Wi.prototype,{getYFormat:function getYFormat(t){var i=this,a=i.yFormat,r=i.y2Format;return t&&!i.hasType("gauge")&&(a=i.defaultArcValueFormat,r=i.defaultArcValueFormat),function(t,e,n){return("y2"===i.axis.getId(n)?r:a).call(i,t,e)}},yFormat:function yFormat(t){return Ja(this,"y",t)},y2Format:function y2Format(t){return Ja(this,"y2",t)},defaultValueFormat:function defaultValueFormat(t){return In(t)?+t:""},defaultArcValueFormat:function defaultArcValueFormat(t,e){return"".concat((100*e).toFixed(1),"%")},dataLabelFormat:function dataLabelFormat(t){var e=this.config.data_labels,n=function(t){return In(t)?+t:""},i=n;return En(e.format)?i=e.format:Wn(e.format)&&(i=e.format[t]?!0===e.format[t]?n:e.format[t]:function(){return""}),i}}),ii(Wi.prototype,{addCache:function addCache(t,e){var n=!!(2<arguments.length&&arguments[2]!==undefined)&&arguments[2];this.cache[t]=n?this.cloneTarget(e):e},removeCache:function removeCache(t){var e=this;ri(t).forEach(function(t){return delete e.cache[t]})},getCache:function getCache(t){if(!(1<arguments.length&&arguments[1]!==undefined&&arguments[1]))return this.cache[t]||null;for(var e,n=[],i=0;e=t[i];i++)e in this.cache&&n.push(this.cloneTarget(this.cache[e]));return n},resetCache:function resetCache(t){for(var e in this.cache)(t||/^\$/.test(e))&&(this.cache[e]=null)}}),ii(Wi.prototype,{CLASS:dn,generateClass:function generateClass(t,e){return" ".concat(t," ").concat(t+this.getTargetSelectorSuffix(e))},classText:function classText(t){return this.generateClass(dn.text,t.index)},classTexts:function classTexts(t){return this.generateClass(dn.texts,t.id)},classShape:function classShape(t){return this.generateClass(dn.shape,t.index)},classShapes:function classShapes(t){return this.generateClass(dn.shapes,t.id)},generateExtraLineClass:function generateExtraLineClass(){var n=this.config.line_classes||[],i=[];return function(t){var e=t.id||t.data&&t.data.id||t;return i.indexOf(e)<0&&i.push(e),n[i.indexOf(e)%n.length]}},classLine:function classLine(t){return this.classShape(t)+this.generateClass(dn.line,t.id)},classLines:function classLines(t){return this.classShapes(t)+this.generateClass(dn.lines,t.id)},classCircle:function classCircle(t){return this.classShape(t)+this.generateClass(dn.circle,t.index)},classCircles:function classCircles(t){return this.classShapes(t)+this.generateClass(dn.circles,t.id)},classBar:function classBar(t){return this.classShape(t)+this.generateClass(dn.bar,t.index)},classBars:function classBars(t){return this.classShapes(t)+this.generateClass(dn.bars,t.id)},classArc:function classArc(t){return this.classShape(t.data)+this.generateClass(dn.arc,t.data.id)},classArcs:function classArcs(t){return this.classShapes(t.data)+this.generateClass(dn.arcs,t.data.id)},classArea:function classArea(t){return this.classShape(t)+this.generateClass(dn.area,t.id)},classAreas:function classAreas(t){return this.classShapes(t)+this.generateClass(dn.areas,t.id)},classRegion:function classRegion(t,e){return"".concat(this.generateClass(dn.region,e)," ").concat("class"in t?t["class"]:"")},classEvent:function classEvent(t){return this.generateClass(dn.eventRect,t.index)},classTarget:function classTarget(t){var e=this.config.data_classes[t],n="";return e&&(n=" ".concat(dn.target,"-").concat(e)),this.generateClass(dn.target,t)+n},classFocus:function classFocus(t){return this.classFocused(t)+this.classDefocused(t)},classFocused:function classFocused(t){return" ".concat(0<=this.focusedTargetIds.indexOf(t.id)?dn.focused:"")},classDefocused:function classDefocused(t){return" ".concat(0<=this.defocusedTargetIds.indexOf(t.id)?dn.defocused:"")},classChartText:function classChartText(t){return dn.chartText+this.classTarget(t.id)},classChartLine:function classChartLine(t){return dn.chartLine+this.classTarget(t.id)},classChartBar:function classChartBar(t){return dn.chartBar+this.classTarget(t.id)},classChartArc:function classChartArc(t){return dn.chartArc+this.classTarget(t.data.id)},classChartRadar:function classChartRadar(t){return dn.chartRadar+this.classTarget(t.id)},getTargetSelectorSuffix:function getTargetSelectorSuffix(t){return t||0===t?"-".concat(t).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g,"-"):""},selectorTarget:function selectorTarget(t,e){return"".concat(e||"",".").concat(dn.target+this.getTargetSelectorSuffix(t))},selectorTargets:function selectorTargets(t,e){var n=this,i=t||[];return i.length?i.map(function(t){return n.selectorTarget(t,e)}):null},selectorLegend:function selectorLegend(t){return".".concat(dn.legendItem+this.getTargetSelectorSuffix(t))},selectorLegends:function selectorLegends(t){var e=this;return t&&t.length?t.map(function(t){return e.selectorLegend(t)}):null}}),ii(Gi.prototype,{focus:function focus(t){var e=this.internal,n=e.mapToTargetIds(t),i=e.svg.selectAll(e.selectorTargets(n.filter(e.isTargetToShow,e)));this.revert(),this.defocus(),i.classed(dn.focused,!0).classed(dn.defocused,!1),e.hasArcType()&&e.expandArc(n),e.toggleFocusLegend(n,!0),e.focusedTargetIds=n,e.defocusedTargetIds=e.defocusedTargetIds.filter(function(t){return n.indexOf(t)<0})},defocus:function defocus(t){var e=this.internal,n=e.mapToTargetIds(t);e.svg.selectAll(e.selectorTargets(n.filter(e.isTargetToShow,e))).classed(dn.focused,!1).classed(dn.defocused,!0),e.hasArcType()&&e.unexpandArc(n),e.toggleFocusLegend(n,!1),e.focusedTargetIds=e.focusedTargetIds.filter(function(t){return n.indexOf(t)<0}),e.defocusedTargetIds=n},revert:function revert(t){var e=this.internal,n=e.mapToTargetIds(t);e.svg.selectAll(e.selectorTargets(n)).classed(dn.focused,!1).classed(dn.defocused,!1),e.hasArcType()&&e.unexpandArc(n),e.config.legend_show&&(e.showLegend(n.filter(e.isLegendToShow.bind(e))),e.legend.selectAll(e.selectorLegends(n)).filter(function(){return O(this).classed(dn.legendItemFocused)}).classed(dn.legendItemFocused,!1)),e.focusedTargetIds=[],e.defocusedTargetIds=[]}}),ii(Gi.prototype,{_showHide:function _showHide(t,e,n){var i=this.internal,a=i.mapToTargetIds(e);i["".concat(t?"remove":"add","HiddenTargetIds")](a);var r=i.svg.selectAll(i.selectorTargets(a)),o=t?"1":"0";r.transition().style("opacity",o,"important").call(i.endall,function(){r.style("opacity",null).style("opacity",o)}),n.withLegend&&i["".concat(t?"show":"hide","Legend")](a),i.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},show:function show(t){var e=1<arguments.length&&arguments[1]!==undefined?arguments[1]:{};this._showHide(!0,t,e)},hide:function hide(t){var e=1<arguments.length&&arguments[1]!==undefined?arguments[1]:{};this._showHide(!1,t,e)},toggle:function toggle(t){var e=this,n=1<arguments.length&&arguments[1]!==undefined?arguments[1]:{},i=this.internal,a={show:[],hide:[]};i.mapToTargetIds(t).forEach(function(t){return a[i.isTargetToShow(t)?"hide":"show"].push(t)}),a.show.length&&this.show(a.show,n),a.hide.length&&setTimeout(function(){return e.hide(a.hide,n)},0)}});var Qa=function(t){var e,n=this.internal,i=t;if(n.config.zoom_enabled&&i){if(n.isTimeSeries()&&(i=i.map(function(t){return n.parseDate(t)})),n.config.subchart_show){var a=n.zoomScale||n.x;n.brush.getSelection().call(n.brush.move,[a(i[0]),a(i[1])]),e=i}else n.x.domain(i),n.zoomScale=n.x,n.xAxis.scale(n.zoomScale),e=n.zoomScale.orgDomain();n.redraw({withTransition:!0,withY:n.config.zoom_rescale,withDimension:!1}),n.setZoomResetButton(),Kn(n.config.zoom_onzoom,e)}else e=n.zoomScale?n.zoomScale.domain():n.x.orgDomain();return e};ii(Qa,{enable:function enable(){var t=0<arguments.length&&arguments[0]!==undefined?arguments[0]:"wheel",e=this.internal,n=e.config,i=t;t&&(i=On(t)&&/^(drag|wheel)$/.test(t)?{type:t}:t),n.zoom_enabled=i,e.zoom?!1===t&&e.bindZoomEvent(!1):(e.initZoom(),e.initZoomBehaviour(),e.bindZoomEvent()),e.updateAndRedraw()},max:function max(t){var e=this.internal,n=e.config;return(0===t||t)&&(n.zoom_x_max=ci("max",[e.orgXDomain[1],t])),n.zoom_x_max},min:function min(t){var e=this.internal,n=e.config;return(0===t||t)&&(n.zoom_x_min=ci("min",[e.orgXDomain[0],t])),n.zoom_x_min},range:function range(t){var e=this.zoom;if(Zn(t)){var n=t.min,i=t.max;Nn(n)&&e.min(n),Nn(i)&&e.max(i)}return{min:e.min(),max:e.max()}}}),ii(Gi.prototype,{zoom:Qa,unzoom:function unzoom(){var t=this.internal,e=t.config;if(t.zoomScale){e.subchart_show?t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(Za),t.updateZoom(!0),t.zoom.resetBtn&&t.zoom.resetBtn.style("display","none");var n=t.main.select(".".concat(dn.eventRects));transform_transform(n.node())!==Za&&t.zoom.transform(n,Za),t.redraw({withTransition:!0,withY:e.zoom_rescale})}}}),ii(Gi.prototype,{transform:function transform(t,e){var n=this.internal,i=0<=["pie","donut"].indexOf(t)?{withTransform:!0}:null;(function transformTo(t,e,n){var i=n||{withTransitionForAxis:!this.hasArcType()};i.withTransitionForTransform=!1,this.transiting=!1,this.setTargetType(t,e),this.updateTargets(this.data.targets),this.updateAndRedraw(i)}).bind(n)(e,t,i)}}),ii(Gi.prototype,{groups:function groups(t){var e=this.internal,n=e.config;return Yn(t)||(n.data_groups=t,e.redraw()),n.data_groups}});var tr=function(t){var e=this.internal,n=e.config;return t&&(n.grid_x_lines=t,e.redrawWithoutRescale()),n.grid_x_lines};ii(tr,{add:function add(t){return this.xgrids(this.internal.config.grid_x_lines.concat(t||[]))},remove:function remove(t){this.internal.removeGridLines(t,!0)}});var er=function(t){var e=this.internal,n=e.config;return t&&(n.grid_y_lines=t,e.redrawWithoutRescale()),n.grid_y_lines};ii(er,{add:function add(t){return this.ygrids(this.internal.config.grid_y_lines.concat(t||[]))},remove:function remove(t){this.internal.removeGridLines(t,!1)}}),ii(Gi.prototype,{xgrids:tr,ygrids:er});var nr=function(e){var t=this.internal.data.targets;return Yn(e)?t:t.filter(function(t){return 0<=e.indexOf(t.id)})};ii(nr,{shown:function shown(t){return this.internal.filterTargetsToShow(this.data(t))},values:function(t){var n=!(1<arguments.length&&arguments[1]!==undefined)||arguments[1],i=null;if(t){var e=this.data(t);e&&qn(e)&&(i=[],e.forEach(function(t){var e=t.values.map(function(t){return t.value});n?i=i.concat(e):i.push(e)}))}return i},names:function names(t){return this.internal.clearLegendItemTextBoxCache(),this.internal.updateDataAttributes("names",t)},colors:function colors(t){return this.internal.updateDataAttributes("colors",t)},axes:function axes(t){return this.internal.updateDataAttributes("axes",t)},min:function min(){return this.internal.getMinMaxData().min},max:function max(){return this.internal.getMinMaxData().max}}),ii(Gi.prototype,{data:nr}),ii(Gi.prototype,{category:function category(t,e){var n=this.internal,i=n.config;return 1<arguments.length&&(i.axis_x_categories[t]=e,n.redraw()),i.axis_x_categories[t]},categories:function categories(t){var e=this.internal,n=e.config;return arguments.length&&(n.axis_x_categories=t,e.redraw()),n.axis_x_categories}}),ii(Gi.prototype,{color:function color(t){return this.internal.color(t)}}),ii(Gi.prototype,{x:function x(t){var e=this.internal,n=e.isCustomX()&&e.isCategorized();return qn(t)&&(n?e.api.categories(t):(e.updateTargetX(e.data.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),n?e.api.categories():e.data.xs},xs:function xs(t){var e=this.internal;return Zn(t)&&(e.updateTargetXs(e.data.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),e.data.xs}});var ir=function(t,e,n){var i=t.config,a="axis_x_".concat(e),r="axis_y_".concat(e),o="axis_y2_".concat(e);return Nn(n)&&(Wn(n)?(In(n.x)&&(i[a]=n.x),In(n.y)&&(i[r]=n.y),In(n.y2)&&(i[o]=n.y2)):(i[r]=n,i[o]=n),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),undefined},ar=function(t,e){var n=t.config;return{x:n["axis_x_".concat(e)],y:n["axis_y_".concat(e)],y2:n["axis_y2_".concat(e)]}},rr=ii(function(){},{labels:function labels(e){var n=this.internal;arguments.length&&(Object.keys(e).forEach(function(t){n.axis.setLabelText(t,e[t])}),n.axis.updateLabels())},min:function min(t){var e=this.internal;return arguments.length?ir(e,"min",t):ar(e,"min")},max:function max(t){var e=this.internal;return arguments.length?ir(e,"max",t):ar(e,"max")},range:function range(t){var e=this.axis;return arguments.length?(Nn(t.max)&&e.max(t.max),Nn(t.min)&&e.min(t.min),undefined):{max:e.max(),min:e.min()}}});ii(Gi.prototype,{axis:rr});var or=ii(function(){},{show:function show(t){var e=this.internal;e.showLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})},hide:function hide(t){var e=this.internal;e.hideLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})}});ii(Gi.prototype,{legend:or});var sr=Nn(window)&&window.Math===Math?window:Nn(self)&&(self.Math===Math?self:Function("return this")());sr.document;ii(Gi.prototype,{resize:function resize(t){var e=this.internal.config;e.size_width=t?t.width:null,e.size_height=t?t.height:null,this.flush()},flush:function flush(t){var e=this.internal;e.zoomScale=null,t?e.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withLegend:!0,withMoving:!0}):e.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},destroy:function destroy(){var e=this,n=this.internal;return jn(n)&&(n.charts.splice(n.charts.indexOf(this),1),Nn(n.resizeTimeout)&&sr.clearTimeout(n.resizeTimeout),sr.removeEventListener("resize",n.resizeFunction),n.selectChart.classed("bb",!1).html(""),Object.keys(this).forEach(function(t){"internal"===t&&Object.keys(n).forEach(function(t){n[t]=null}),e[t]=null,delete e[t]})),null},config:function config(t,e,n){var i,a=this.internal,r=t&&t.replace(/\./g,"_");return r in a.config&&(Nn(e)?(i=a.config[r]=e,n&&this.flush(!0)):i=a.config[r]),i}});var cr=ii(function(){},{show:function show(){var e,n,t=0<arguments.length&&arguments[0]!==undefined?arguments[0]:{},i=this.internal;if(t.mouse&&(n=t.mouse),t.data){var a=i.getYScale(t.data.id)(t.data.value);i.isMultipleX()?n=[i.x(t.data.x),a]:(!i.config.tooltip_grouped&&(n=[0,a]),e=In(t.data.index)?t.data.index:i.getIndexByX(t.data.x))}else Nn(t.x)?e=i.getIndexByX(t.x):Nn(t.index)&&(e=t.index);("mouse"===i.inputType?["mouseover","mousemove"]:["touchstart"]).forEach(function(t){i.dispatchEvent(t,e,n)})},hide:function hide(){var t=this.internal;t.hideTooltip(),t.hideXGridFocus(),t.unexpandCircles(),t.unexpandBars()}});ii(Gi.prototype,{tooltip:cr});var ur=window.navigator.userAgent;ii(Wi.prototype,{isSafari:function isSafari(){return-1<ur.indexOf("Safari")&&!this.isChrome()},isChrome:function isChrome(){return-1<ur.indexOf("Chrome")},isMobile:function isMobile(){return-1<ur.indexOf("Mobi")}}),n.d(e,"bb",function(){return lr});var lr={version:"1.7.1-snapshot",generate:function generate(t){var e=new Gi(t);return e.internal.charts=this.instance,this.instance.push(e),e},instance:[],d3:{format:wt,timeFormat:ut,utcFormat:ht,select:O,mouse:P,getEvent:function(){return E}},chart:{fn:Gi.prototype,internal:{fn:Wi.prototype,axis:{fn:Ui.prototype}}}};e["default"]=lr}])});