From 8bfa02332cc1fb9938e9b9d7577a763a35c2dcb9 Mon Sep 17 00:00:00 2001 From: konstantin krivlenia Date: Mon, 22 Apr 2019 13:00:28 +0300 Subject: [PATCH] Updates --- dist/colorbrewer.css | 2 +- dist/plugins/annotations.css | 2 +- dist/plugins/annotations.dark.css | 2 +- dist/plugins/annotations.js | 2 +- dist/plugins/bar-as-span.js | 2 +- dist/plugins/box-whiskers.js | 2 +- dist/plugins/category-filter.css | 2 +- dist/plugins/category-filter.dark.css | 2 +- dist/plugins/category-filter.js | 2 +- dist/plugins/color-brewer.js | 2 +- dist/plugins/crosshair.css | 2 +- dist/plugins/crosshair.dark.css | 2 +- dist/plugins/crosshair.js | 2 +- dist/plugins/diff-tooltip.css | 2 +- dist/plugins/diff-tooltip.dark.css | 2 +- dist/plugins/diff-tooltip.js | 2 +- dist/plugins/export-to.css | 2 +- dist/plugins/export-to.dark.css | 2 +- dist/plugins/export-to.js | 2 +- dist/plugins/floating-axes.js | 2 +- dist/plugins/geomap-legend.js | 2 +- dist/plugins/geomap-tooltip.js | 2 +- dist/plugins/layers.js | 2 +- dist/plugins/legend.css | 2 +- dist/plugins/legend.dark.css | 2 +- dist/plugins/legend.js | 2 +- dist/plugins/parallel-brushing.js | 2 +- dist/plugins/parallel-tooltip.js | 2 +- dist/plugins/quick-filter.css | 2 +- dist/plugins/quick-filter.dark.css | 2 +- dist/plugins/quick-filter.js | 2 +- dist/plugins/settings.js | 2 +- dist/plugins/tooltip.css | 2 +- dist/plugins/tooltip.dark.css | 2 +- dist/plugins/tooltip.js | 2 +- dist/plugins/trendline.css | 2 +- dist/plugins/trendline.dark.css | 2 +- dist/plugins/trendline.js | 2 +- dist/taucharts.css | 2 +- dist/taucharts.dark.css | 2 +- dist/taucharts.dark.min.css | 2 +- dist/taucharts.js | 4 +- dist/taucharts.min.css | 2 +- dist/taucharts.min.js | 4 +- examples/playground.html | 27 --- examples/playground.js | 236 -------------------------- package.json | 8 +- 47 files changed, 50 insertions(+), 313 deletions(-) delete mode 100644 examples/playground.html delete mode 100644 examples/playground.js diff --git a/dist/colorbrewer.css b/dist/colorbrewer.css index d5fdf2040..f37872119 100644 --- a/dist/colorbrewer.css +++ b/dist/colorbrewer.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/annotations.css b/dist/plugins/annotations.css index be5ba78cb..2c85f284e 100644 --- a/dist/plugins/annotations.css +++ b/dist/plugins/annotations.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/annotations.dark.css b/dist/plugins/annotations.dark.css index be5ba78cb..2c85f284e 100644 --- a/dist/plugins/annotations.dark.css +++ b/dist/plugins/annotations.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/annotations.js b/dist/plugins/annotations.js index 23b2e8e0b..24866aa22 100644 --- a/dist/plugins/annotations.js +++ b/dist/plugins/annotations.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/bar-as-span.js b/dist/plugins/bar-as-span.js index 85c0e2ccd..8ee906d07 100644 --- a/dist/plugins/bar-as-span.js +++ b/dist/plugins/bar-as-span.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/box-whiskers.js b/dist/plugins/box-whiskers.js index ba464e501..12013e2b0 100644 --- a/dist/plugins/box-whiskers.js +++ b/dist/plugins/box-whiskers.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/category-filter.css b/dist/plugins/category-filter.css index 69bab8833..3c160e9dc 100644 --- a/dist/plugins/category-filter.css +++ b/dist/plugins/category-filter.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/category-filter.dark.css b/dist/plugins/category-filter.dark.css index 6d2309739..a9d365c69 100644 --- a/dist/plugins/category-filter.dark.css +++ b/dist/plugins/category-filter.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/category-filter.js b/dist/plugins/category-filter.js index dad1c946f..98ceaeeba 100644 --- a/dist/plugins/category-filter.js +++ b/dist/plugins/category-filter.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/color-brewer.js b/dist/plugins/color-brewer.js index f46c34cae..0dc456360 100644 --- a/dist/plugins/color-brewer.js +++ b/dist/plugins/color-brewer.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/crosshair.css b/dist/plugins/crosshair.css index 368c7e3d1..8c379be14 100644 --- a/dist/plugins/crosshair.css +++ b/dist/plugins/crosshair.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/crosshair.dark.css b/dist/plugins/crosshair.dark.css index b057a6492..6b5f8c58a 100644 --- a/dist/plugins/crosshair.dark.css +++ b/dist/plugins/crosshair.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/crosshair.js b/dist/plugins/crosshair.js index 0daac583e..1ca8dc111 100644 --- a/dist/plugins/crosshair.js +++ b/dist/plugins/crosshair.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/diff-tooltip.css b/dist/plugins/diff-tooltip.css index 177d4336c..8001d81fa 100644 --- a/dist/plugins/diff-tooltip.css +++ b/dist/plugins/diff-tooltip.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/diff-tooltip.dark.css b/dist/plugins/diff-tooltip.dark.css index 3ddfea6ab..816ee05d9 100644 --- a/dist/plugins/diff-tooltip.dark.css +++ b/dist/plugins/diff-tooltip.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/diff-tooltip.js b/dist/plugins/diff-tooltip.js index fd2ce0358..7bd7331fb 100644 --- a/dist/plugins/diff-tooltip.js +++ b/dist/plugins/diff-tooltip.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/export-to.css b/dist/plugins/export-to.css index 8c55cd187..a47cd41b8 100644 --- a/dist/plugins/export-to.css +++ b/dist/plugins/export-to.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/export-to.dark.css b/dist/plugins/export-to.dark.css index 8c55cd187..a47cd41b8 100644 --- a/dist/plugins/export-to.dark.css +++ b/dist/plugins/export-to.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/export-to.js b/dist/plugins/export-to.js index fe18c864f..e34293a33 100644 --- a/dist/plugins/export-to.js +++ b/dist/plugins/export-to.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/floating-axes.js b/dist/plugins/floating-axes.js index d661101b4..047bc65f4 100644 --- a/dist/plugins/floating-axes.js +++ b/dist/plugins/floating-axes.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/geomap-legend.js b/dist/plugins/geomap-legend.js index 4e58f9779..e19cb4cea 100644 --- a/dist/plugins/geomap-legend.js +++ b/dist/plugins/geomap-legend.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/geomap-tooltip.js b/dist/plugins/geomap-tooltip.js index 3585eb830..348033918 100644 --- a/dist/plugins/geomap-tooltip.js +++ b/dist/plugins/geomap-tooltip.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/layers.js b/dist/plugins/layers.js index b81fb5bbb..2cbd0aa53 100644 --- a/dist/plugins/layers.js +++ b/dist/plugins/layers.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/legend.css b/dist/plugins/legend.css index 612ce9466..addcf4a33 100644 --- a/dist/plugins/legend.css +++ b/dist/plugins/legend.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/legend.dark.css b/dist/plugins/legend.dark.css index e1992a925..d02fde163 100644 --- a/dist/plugins/legend.dark.css +++ b/dist/plugins/legend.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/legend.js b/dist/plugins/legend.js index 16cdf0dce..2ca176aab 100644 --- a/dist/plugins/legend.js +++ b/dist/plugins/legend.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/parallel-brushing.js b/dist/plugins/parallel-brushing.js index ccadaf9b6..c4dc63dad 100644 --- a/dist/plugins/parallel-brushing.js +++ b/dist/plugins/parallel-brushing.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/parallel-tooltip.js b/dist/plugins/parallel-tooltip.js index 69b19da1c..b352a1df0 100644 --- a/dist/plugins/parallel-tooltip.js +++ b/dist/plugins/parallel-tooltip.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/quick-filter.css b/dist/plugins/quick-filter.css index 12396f14e..385c514cc 100644 --- a/dist/plugins/quick-filter.css +++ b/dist/plugins/quick-filter.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/quick-filter.dark.css b/dist/plugins/quick-filter.dark.css index 12396f14e..385c514cc 100644 --- a/dist/plugins/quick-filter.dark.css +++ b/dist/plugins/quick-filter.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/quick-filter.js b/dist/plugins/quick-filter.js index cda7a3c67..099a2677e 100644 --- a/dist/plugins/quick-filter.js +++ b/dist/plugins/quick-filter.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/settings.js b/dist/plugins/settings.js index 28247fa40..8f15d637a 100644 --- a/dist/plugins/settings.js +++ b/dist/plugins/settings.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/tooltip.css b/dist/plugins/tooltip.css index 5784aa754..5ffce86c6 100644 --- a/dist/plugins/tooltip.css +++ b/dist/plugins/tooltip.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/tooltip.dark.css b/dist/plugins/tooltip.dark.css index 68a0483bf..08d8fda59 100644 --- a/dist/plugins/tooltip.dark.css +++ b/dist/plugins/tooltip.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/tooltip.js b/dist/plugins/tooltip.js index 485f2f997..3ea820cc1 100644 --- a/dist/plugins/tooltip.js +++ b/dist/plugins/tooltip.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/trendline.css b/dist/plugins/trendline.css index 1831e5d05..de0f87b61 100644 --- a/dist/plugins/trendline.css +++ b/dist/plugins/trendline.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/trendline.dark.css b/dist/plugins/trendline.dark.css index e3546b262..01e971b44 100644 --- a/dist/plugins/trendline.dark.css +++ b/dist/plugins/trendline.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/trendline.js b/dist/plugins/trendline.js index dabb42235..6f5430ea0 100644 --- a/dist/plugins/trendline.js +++ b/dist/plugins/trendline.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/taucharts.css b/dist/taucharts.css index 652d816d4..d3a5d459c 100644 --- a/dist/taucharts.css +++ b/dist/taucharts.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/taucharts.dark.css b/dist/taucharts.dark.css index 617484091..9c7e79d7e 100644 --- a/dist/taucharts.dark.css +++ b/dist/taucharts.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/taucharts.dark.min.css b/dist/taucharts.dark.min.css index 186de9d0b..f12064a12 100644 --- a/dist/taucharts.dark.min.css +++ b/dist/taucharts.dark.min.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/taucharts.js b/dist/taucharts.js index 52e31e86d..840df74c2 100644 --- a/dist/taucharts.js +++ b/dist/taucharts.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.7.1 (2019-03-14) + * taucharts@2.7.2 (2019-04-22) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3-selection"),require("d3-array"),require("d3-scale"),require("topojson-client"),require("d3-transition"),require("d3-format"),require("d3-time-format"),require("d3-brush"),require("d3-color"),require("d3-axis"),require("d3-geo"),require("d3-quadtree"),require("d3-shape"),require("d3-time")):"function"==typeof define&&define.amd?define(["d3-selection","d3-array","d3-scale","topojson-client","d3-transition","d3-format","d3-time-format","d3-brush","d3-color","d3-axis","d3-geo","d3-quadtree","d3-shape","d3-time"],e):"object"==typeof exports?exports.Taucharts=e(require("d3-selection"),require("d3-array"),require("d3-scale"),require("topojson-client"),require("d3-transition"),require("d3-format"),require("d3-time-format"),require("d3-brush"),require("d3-color"),require("d3-axis"),require("d3-geo"),require("d3-quadtree"),require("d3-shape"),require("d3-time")):t.Taucharts=e(t.d3,t.d3,t.d3,t.topojson,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(window,function(t,e,n,r,i,o,a,u,s,c,l,f,d,h){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=20)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"traverseJSON",function(){return mt}),n.d(r,"traverseSpec",function(){return yt}),n.d(r,"clone",function(){return Et}),n.d(r,"isDate",function(){return Tt}),n.d(r,"isObject",function(){return Ct}),n.d(r,"niceZeroBased",function(){return Nt}),n.d(r,"niceTimeDomain",function(){return Lt}),n.d(r,"generateHash",function(){return Ft}),n.d(r,"generateRatioFunction",function(){return zt}),n.d(r,"isSpecRectCoordsOnly",function(){return Rt}),n.d(r,"throttleLastEvent",function(){return Dt}),n.d(r,"splitEvenly",function(){return It}),n.d(r,"extRGBColor",function(){return Bt}),n.d(r,"extCSSClass",function(){return Wt}),n.d(r,"toRadian",function(){return Ht}),n.d(r,"normalizeAngle",function(){return Ut}),n.d(r,"range",function(){return Gt}),n.d(r,"hasXOverflow",function(){return qt}),n.d(r,"hasYOverflow",function(){return Xt}),n.d(r,"flatten",function(){return Yt}),n.d(r,"unique",function(){return Vt}),n.d(r,"groupBy",function(){return $t}),n.d(r,"union",function(){return Jt}),n.d(r,"intersection",function(){return Kt}),n.d(r,"defaults",function(){return Zt}),n.d(r,"omit",function(){return Qt}),n.d(r,"memoize",function(){return te}),n.d(r,"createMultiSorter",function(){return ee}),n.d(r,"pick",function(){return ne}),n.d(r,"escape",function(){return re}),n.d(r,"template",function(){return ie}),n.d(r,"escapeHtml",function(){return oe}),n.d(r,"xml",function(){return ce}),n.d(r,"take",function(){return le}),n.d(r,"isChartElement",function(){return de}),n.d(r,"isFacetUnit",function(){return he});var i={};n.r(i),n.d(i,"appendTo",function(){return me}),n.d(i,"getScrollbarSize",function(){return ye}),n.d(i,"setScrollPadding",function(){return ve}),n.d(i,"getStyle",function(){return be}),n.d(i,"getStyleAsNum",function(){return xe}),n.d(i,"getContainerSize",function(){return we}),n.d(i,"getAxisTickLabelSize",function(){return _e}),n.d(i,"getLabelSize",function(){return Se}),n.d(i,"getCharSize",function(){return Me}),n.d(i,"selectOrAppend",function(){return Oe}),n.d(i,"selectImmediate",function(){return Ae}),n.d(i,"selectAllImmediate",function(){return ke}),n.d(i,"sortChildren",function(){return Ee}),n.d(i,"classes",function(){return Te}),n.d(i,"dispatchMouseEvent",function(){return Ce});var o={};n.r(o),n.d(o,"translate",function(){return Ne}),n.d(o,"rotate",function(){return Le}),n.d(o,"getOrientation",function(){return je}),n.d(o,"parseTransformTranslate",function(){return Pe}),n.d(o,"isIntersect",function(){return Fe}),n.d(o,"getDeepTransformTranslate",function(){return ze}),n.d(o,"raiseElements",function(){return Re});var a=n(0),u=n(2),s=n(3),c={},l={};function f(t){var e=l[t];return e||(e=function(){for(var e,n,r=this,i=0,o=[];r=r.handler;){if("function"==typeof(n=r.callbacks[t])){if(!e)for(e=[this],i=0;i=0?t.positive:t.negative,u=a[i]||0,s=u+o;return a[i]=s,{nextStack:s,prevStack:u}}},o=i({positive:{},negative:{}}),a=i({positive:{},negative:{}}),u=function(e){return te(e,t.id)},s=Number.MAX_VALUE,c=Number.MIN_VALUE,l=function(t){return s=tc?t:c,r.value(t)},f=u(function(t){return l(o(t).nextStack)}),d=u(function(t){return l(a(t).prevStack)}),h=function(e){return t.group(e)+"/"+(e[r.dim]>=0?1:-1)},p=$t(e,h),g=Object.keys(p).sort(t.flip||!t.flip&&t.obsoleteVerticalStackOrder?function(e,n){return t.order(e)-t.order(n)}:function(e,n){return t.order(n)-t.order(e)}).reduce(function(t,e){return t.concat(p[e])},[]);return g.forEach(function(t){f(t),d(t)}),r.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxs)&&(e.min=s),e}),{group:h,data:function(){return g},yi:f,y0:d}}).reg("size_distribute_evenly",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a=t.data(),u=function(t,e){return t-e},s=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,c=a.map(function(e){return t.xi(e)}).sort(u),l=c[0],f=c.slice(1).map(function(t){var e=t-l;return l=t,e}).filter(function(t){return t>0}).sort(u).concat(Number.MAX_VALUE)[0],d=Math.min(f,s),h="number"==typeof n?n:i,p={minSize:h,maxSize:"number"==typeof r?r:Math.max(h,Math.min(o,d))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("adjustStaticSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a={minSize:"number"==typeof n?n:i,maxSize:"number"==typeof r?r:o};return t.scaleSize.fixup(function(t){var e={};return t.fixed||(e.fixed=!0,e.minSize=a.minSize,e.maxSize=a.maxSize),e}),{}}).reg("adjustSigmaSizeScale",function(t,e){var n,r,i,o,a=e.minLimit,u=e.maxLimit,s=e.defMin,c=e.defMax,l=function(t,e){return t-e},f=t.data().map(function(e){return t.xi(e)}).sort(l),d=f[0],h=f.slice(1).map(function(t){var e=t-d;return d=t,e}).filter(function(t){return t>0}).sort(l).concat(Number.MAX_VALUE)[0],p=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,g=Math.min(h,p),m="number"==typeof a?a:s,y="number"==typeof u?u:c,v={minSize:m,maxSize:Math.max(m,Math.min(y,(n=g,r=(m+y)/2,i=y,o=m,Math.round(r+(i-r)/(1+Math.exp(-(n-o)/.5))))))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>v.maxSize&&(e.maxSize=v.maxSize):(e.fixed=!0,e.minSize=v.minSize,e.maxSize=v.maxSize),e}),{}}).reg("avoidScalesOverflow",function(t,e){var n,r,i=e.sizeDirection,o=function(t,e){return!t||t.discrete||"logarithmic"===t.scaleType||i.indexOf(e)<0},a=o(t.scaleX,"x"),u=o(t.scaleY,"y");if(a&&u)return{};t.scaleSize.fixup(function(t){return n=t.minSize,r=t.maxSize,t});var s=t.data().reduce(function(e,i){var o,s,c=t.size(i),l=(c>=n?c:n+c*(r-n))/2;return a||(o=t.xi(i),e.left=Math.min(e.left,o-l),e.right=Math.max(e.right,o+l)),u||(s=t.yi(i),e.top=Math.min(e.top,s-l),e.bottom=Math.max(e.bottom,s+l)),e},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE}),c=function(e,n,r,i){var o=e.domain(),a=Math.abs(e.value(o[1])-e.value(o[0])),u=(o[1]-o[0])/a;if(0===a)return 1;var s=Math.max(0,-n),c=Math.max(0,r-a),l=t.flip?c:s,f=t.flip?s:c,d=Number(o[0])-(i?f:l)*u,h=Number(o[1])+(i?l:f)*u;return e.fixup(function(t){var e={};if(t.fixedBorders){var i=t.fixedBorders.slice(),o=i[0],a=i[1];(o>n||a=0?1:-1},d=function(e,n,r){var i=$t(n,function(t){return t[u]}),o=n[0];return e.reduce(function(e,n){return e.concat(i[n]||function(e,n,r){var i,o=[e,t.id(n),r].join(" ");return(i={})[u]=e,i[s]=1e-10*r,i[l]=n[l],i[c]=n[c],i[A]=!0,i[A+"id"]=o,i}(n,o,r))},[])},h=function(t,e){return t-e},p=function(){return Vt(a.reduce(function(t,e){return t.concat(e.map(function(t){return t[u]}))},[])).sort(h)},g=r?function(){var e=p(),n=Math.max.apply(Math,e.map(function(t){return Number(t)})),o=t.scaleX.domain(),a=x.generate(o[0],o[1],r,{utc:i}).filter(function(t){return t>=o[0]&&t<=o[1]}),u=0,s=[],c=x.get(r,{utc:i});return a.forEach(function(t){var r=Number(t);if(!(r>=n)){for(var i=u;i=0;n--)i=t[n+1],(r=t[n]).isCubicControl||i.isCubicControl||(t.splice(n+1,0,T(1/3,i,r),T(2/3,i,r)),t[n+1].isCubicControl=!0,t[n+2].isCubicControl=!0);var o=t.filter(function(t,e){return e%3==0}),a=e.filter(function(t,e){return e%3==0}),u=o.map(function(t){return t.id}),s=a.map(function(t){return t.id}),c=u.reduce(function(e,n){return e[n]=t.findIndex(function(t){return t.id===n}),e},{}),l=s.reduce(function(t,n){return t[n]=e.findIndex(function(t){return t.id===n}),t},{}),f=u.filter(function(t){return s.indexOf(t)>=0}),d=o.filter(function(t){return!t.positionIsBeingChanged}),h=a.filter(function(t){return!t.positionIsBeingChanged}),p=H(d,h),g=H(h,d),m=[];f.forEach(function(n,r){var i,o,a,u=c[n],s=l[n];if(0===r&&(u>0||s>0)&&m.push(L({polylineFrom:t.slice(0,u+1),polylineTo:e.slice(0,s+1),toOppositeScale:0===s?p:g,isCubic:!0})),r>0){var d=c[f[r-1]],h=l[f[r-1]];u-d>3||s-h>3?m.push(j({polylineFrom:t.slice(d,u+1),polylineTo:e.slice(h,s+1),isCubic:!0})):m.push((i={polylineFrom:t.slice(d,u+1),polylineTo:e.slice(h,s+1)},o=i.polylineFrom,a=i.polylineTo,function(t){return I(o.slice(1,3),a.slice(1,3),t)}))}m.push(P({pointFrom:t[u],pointTo:e[s]})),r===f.length-1&&(t.length-u-1>0||e.length-s-1>0)&&m.push(L({polylineFrom:t.slice(u),polylineTo:e.slice(s),toOppositeScale:e.length-s==1?p:g,isCubic:!0}))}),0===m.length&&(e.length>0&&0===f.length||t.length>0&&0===f.length)&&m.push(F({polylineFrom:t.slice(0),polylineTo:e.slice(0),isCubic:!0}));return function(t){var e=[];return m.forEach(function(n){var r=n(t);z(e,r)}),e}}:function(t,e){var n=(t=t.filter(function(t){return!t.isInterpolated})).map(function(t){return t.id}),r=e.map(function(t){return t.id}),i=n.filter(function(t){return r.indexOf(t)>=0}),o=t.filter(function(t){return!t.positionIsBeingChanged}),a=e.filter(function(t){return!t.positionIsBeingChanged}),u=H(o,a),s=H(a,o),c=[];i.forEach(function(o,a){var l=n.indexOf(o),f=r.indexOf(o);if(0===a&&(l>0||f>0)&&c.push(L({isCubic:!1,polylineFrom:t.slice(0,l+1),polylineTo:e.slice(0,f+1),toOppositeScale:0===f?u:s})),a>0){var d=n.indexOf(i[a-1]),h=r.indexOf(i[a-1]);(l-d>1||f-h>1)&&c.push(j({isCubic:!1,polylineFrom:t.slice(d,l+1),polylineTo:e.slice(h,f+1)}))}c.push(P({pointFrom:t[l],pointTo:e[f]})),a===i.length-1&&(t.length-l-1>0||e.length-f-1>0)&&c.push(L({isCubic:!1,polylineFrom:t.slice(l),polylineTo:e.slice(f),toOppositeScale:e.length-f==1?u:s}))}),0===c.length&&(e.length>0&&0===i.length||t.length>0&&0===i.length)&&c.push(F({isCubic:!1,polylineFrom:t.slice(0),polylineTo:e.slice(0)}));return function(t){var e=[];return c.forEach(function(n){var r=n(t);z(e,r)}),e}})(t,e)),r(i))}}function L(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=t.toOppositeScale,o=e.length>n.length?e:n,a=1===n.length,u=e[0].id!==n[0].id,s=Boolean(u!==a);return function(t){var e=(r?W:B)({t:t,polyline:o,decreasing:a,rightToLeft:s});a===s?e.shift():e.pop();var n=I(e.map(i),e,a?1-t:t);return n.forEach(function(t){return t.positionIsBeingChanged=!0}),n}}function j(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=e.length,o=n.length;if(o!==i){var a=o2){var i=function(t,e){for(var n,r,i=[e[0]],o=0;o0&&e0&&(t.positionIsBeingChanged=!0)}),e}}function z(t,e){return Array.prototype.push.apply(t,e)}function R(t,e,n){return void 0===e?t:"number"==typeof e?t+n*(e-t):e}function D(t,e,n){if(t===e)return e;var r={};return Object.keys(t).forEach(function(i){return r[i]=R(t[i],e[i],n)}),void 0!==e.id&&(r.id=e.id),r}function I(t,e,n){return t.map(function(t,r){return D(t,e[r],n)})}function B(t){var e=t.t,n=t.polyline,r=t.decreasing,i=t.rightToLeft,o=Boolean(r)!==Boolean(i),a=function(t,e){var n=0;if(t>0){for(var r,i,o,a,u=[0],s=0,c=1;c0){for(var i,o,a,u,s,c,l,f,d=[0],h=0,p=1;p0;o--)if((e=a[o][t])!==r)return n=u[o][t],void(d[t]=h(r,e,i,n));d[t]=function(t,e){return function(n){return n-t+e}}(r,i)}),function(t){var e=Object.assign({},t);return f.forEach(function(n){e[n]=d[n](t[n])}),e}}function U(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function G(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=C(t,n,r,i,o);return[a[1],a[2],a[4],a[5]].forEach(function(t){return t.isCubicControl=!0}),Object.keys(o).forEach(function(e){"x"!==e&&"y"!==e&&"id"!==e&&(a[3][e]=R(n[e],o[e],t))}),a}function q(t,e){if(t.length<2)return t.slice(0);if(2===t.length)return[t[0],{x:X(t[0].x,t[1].x,1/3),y:X(t[0].y,t[1].y,1/3)},{x:X(t[0].x,t[1].x,2/3),y:X(t[0].y,t[1].y,2/3)},t[1]];for(var n,r,i,o,a,u,s,c,l,f,d,h,p,g,m=new Array(3*(t.length-1)+1),y=m.length-1,v=0;v0&&(m[3*v-2]=T(1/3,t[v-1],t[v]),m[3*v-1]=T(2/3,t[v-1],t[v]));for(var b=m.slice(0),x=0;x<3;x++){for(m[1]={x:X(m[0].x,m[3].x,1/3),y:X(m[0].y,X(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:X(m[y].x,m[y-3].x,1/3),y:X(m[y].y,X(m[y-3].y,m[y-2].y,1.5),2/3)},e&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[y-1].y-m[y].y)*(m[y-3].y-m[y-2].y)<0&&(m[y-1]={x:m[y-1].x,y:m[y].y})),v=6;vn.y==s>i.y&&(p=X(p*(g=(i.y-r.y)/(s-r.y)),p,1/(1+Math.abs(g))),d=(i.y-r.y)/p),r.y>n.y==a0?[t,e].join(" "):e,s=n(i.text(u));if(su;if(l&&i){var f=Math.floor(u/c*s.length);t[t.length-1]=s.substr(0,f-4)+"...",p=!0}return l&&!i&&t.push(e),l||(t[t.length-1]=s),t},[""]).filter(function(t){return t.length>0});f=i?-1*(m.length-1)*Math.floor(.5*r):f,m.forEach(function(t,e){return a(s,t,1.1,l,f,d,e)}),h.remove()})};var nt=function(t,e,n){return e>0&&!document.hidden&&((t=t.transition(n).duration(e)).attr=rt),t.onTransitionEnd=function(t){return at(this,t),this},t},rt=function(t,e){var n,r,i=this,o=Z.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?r=t:arguments.length>1&&((n={})[t]=e,r=n);var a="__transitionAttrs__",u="__lastTransitions__",s=ot();this.each(function(){var t=this,e={};for(var n in r)"function"==typeof r[n]?e[n]=r[n].apply(this,arguments):e[n]=r[n];this[a]=Object.assign(this[a]||{},e),this[a][u]||Object.defineProperty(this[a],u,{value:{}}),Object.keys(e).forEach(function(e){return t[a][u][e]=s})});var c=function(){var t=this;this[a]&&(Object.keys(r).filter(function(e){return t[a][u][e]===s}).forEach(function(e){return delete t[a][e]}),0===Object.keys(this[a]).length&&delete this[a])};return this.on("interrupt."+s,function(){return i.each(c)}),this.on("end."+s,function(){return i.each(c)}),o},it=0,ot=function(){return++it},at=function(t,e){if(Z.transition.prototype.isPrototypeOf(t)&&!t.empty()){var n=function(){return e.call(null,t)};return t.on("interrupt.d3_on_transition_end",n),t.on("end.d3_on_transition_end",n),t}e.call(null,t)},ut=function(t,e,n,r){var i=r||function(t){return t},o=function(){i(this)};return function(r){var i=r;return e&&(i=i.call(lt(Zt(e,n)))),i=(i=nt(i,t)).call(lt(n)),t>0?i.on("end.d3_animationInterceptor",function(){return i.each(o)}):i.each(o),i}},st=function(t,e){var n=t.node();return t.selectAll(e).filter(function(){return this.parentNode===n})},ct=function(t,e,n,r,i){void 0===i&&(i="linear");var o="__pathPoints__";return function(t){var a=this;this[o]||(this[o]=n.map(function(){return[]}));var u=n.map(function(e,n){var u=Vt(t,r).map(e),s=($(i)||$("linear"))(u),c=a[o][n];return{pointsFrom:c,pointsTo:s,interpolate:N(c,s,J(i))}});return function(t){if(0===t){var n=u.map(function(t){return t.pointsFrom});return e.apply(void 0,n)}if(1===t){var r=u.map(function(t){return t.pointsTo});return a[o]=r,e.apply(void 0,r)}var i=u.map(function(e){return e.interpolate(t)});return a[o]=i,e.apply(void 0,i)}}},lt=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.attr(n,t[n])}),e}},ft=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.classed(n,t[n])}),e}},dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ht=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Zt(n.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),n.config.guide.size=n.config.guide.size||{};var r=n.config.stack,i=n.config.guide.enableColorToBarPosition,o=[e.flip&&O.get("flip"),r&&O.get("stack"),i&&O.get("positioningByColor")];return n.decorators=(n.config.transformRules||o).concat(e.transformModel||[]),n.adjusters=(n.config.adjustRules||[]).concat(e.adjustScales||[]),n}return dt(e,t),e.prototype.defineGrammarModel=function(t){var e=this,n=this.config;this.regScale("x",t("pos",n.x,[0,n.options.width])).regScale("y",t("pos",n.y,[n.options.height,0])).regScale("y",t("pos",n.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n.options.height]:[n.options.height,0]})).regScale("size",t("size",n.size,{})).regScale("color",t("color",n.color,{})).regScale("split",t("split",n.split,{})).regScale("label",t("label",n.label,{})).regScale("identity",t("identity",n.identity,{}));var r=this.getScale("x"),i=this.getScale("y"),o=this.getScale("size"),a=this.getScale("label"),u=this.getScale("color"),s=this.getScale("split"),c=this.getScale("identity"),l=i.domain(),f=i.discrete?l[0]:Math.max(0,Math.min.apply(Math,l)),d=i.value(f)+.5*i.stepSize(f),h=u.domain(),p={data:function(){return e.data()},flip:!1,scaleX:r,scaleY:i,scaleSize:o,scaleLabel:a,scaleColor:u,scaleSplit:s,scaleIdentity:c,color:function(t){return u.value(t[u.dim])},label:function(t){return a.value(t[a.dim])},group:function(t){return t[u.dim]+"(@taucharts@)"+t[s.dim]},order:function(t){var e=t.split("(@taucharts@)")[0],n=h.indexOf(e);return n<0?Number.MAX_VALUE:n},size:function(t){return o.value(t[o.dim])},id:function(t){return c.value(t[c.dim],t)},xi:function(t){return r.value(t[r.dim])},yi:function(t){return i.value(t[i.dim])},y0:function(){return d}};return p.data().forEach(function(t){return p.id(t)}),p},e.prototype.getGrammarRules=function(){return this.decorators.filter(function(t){return t})},e.prototype.getAdjustScalesRules=function(){return(this.adjusters||[]).filter(function(t){return t})},e.prototype.createScreenModel=function(t){var e=t.flip,n=function(t,e,n){return t?e:n};return{flip:e,id:t.id,x:n(e,t.yi,t.xi),y:n(e,t.xi,t.yi),x0:n(e,t.y0,t.xi),y0:n(e,t.xi,t.y0),size:t.size,group:t.group,order:t.order,label:t.label,color:function(e){return t.scaleColor.toColor(t.color(e))},class:function(e){return t.scaleColor.toClass(t.color(e))},model:t,toFibers:function(){var e=$t(t.data(),t.group);return Object.keys(e).sort(function(e,n){return t.order(e)-t.order(n)}).reduce(function(t,n){return t.concat([e[n]])},[])}}},e.prototype.drawFrames=function(){var t=this,e=this.config.options,n=function(e){return n=t.screenModel.size(e)/2,r=4,i=Math.pow(10,r),Math.round(i*n)/i;var n,r,i},r=ut,i=function(e,n,i){var o=t.config.guide.animationSpeed,u=e.selectAll("."+n).data(function(t){return[t]},t.screenModel.id);u.exit().call(r(o,null,{width:0},function(t){return a.select(t).remove()})),u.call(r(o,null,i)),u.enter().append("rect").style("stroke-width",0).call(r(o,{width:0},i))},o=this.config.flip,u=o?"y":"x",s=o?"x":"y",c=o?"x0":"y0",l=o?"height":"width",f=o?"width":"height",d=function(e){var r,o,a;i(e,"lvl-top",((r={})[l]=function(t){return n(t)},r[f]=1,r[u]=function(e){return t.screenModel[u](e)-n(e)/2},r[s]=function(e){return t.screenModel[s](e)},r.fill=function(e){return t.screenModel.color(e)},r.class=function(e){return"lvl-top "+t.screenModel.class(e)},r)),i(e,"lvl-btm",((o={})[l]=function(t){return n(t)},o[f]=1,o[u]=function(e){return t.screenModel[u](e)-n(e)/2},o[s]=function(e){return t.screenModel[c](e)},o.fill=function(e){return t.screenModel.color(e)},o.class=function(e){return"lvl-btm "+t.screenModel.class(e)},o)),i(e,"lvl-link",((a={})[l]=.5,a[f]=function(e){return Math.abs(t.screenModel[s](e)-t.screenModel[c](e))},a[u]=function(e){return t.screenModel[u](e)-.25},a[s]=function(e){return Math.min(t.screenModel[s](e),t.screenModel[c](e))},a.fill=function(e){return t.screenModel.color(e)},a.class=function(e){return"lvl-link "+t.screenModel.class(e)},a))},h=function(e){e.attr("class","frame-id-"+t.config.uid).call(function(e){var n=e.selectAll(".generic").data(function(t){return t},t.screenModel.id);n.exit().remove(),n.call(d),n.enter().append("g").attr("class","generic").call(d)})},p=$t(this.data(),t.screenModel.group),g=Object.keys(p).sort(function(e,n){return t.screenModel.order(e)-t.screenModel.order(n)}).reduce(function(t,e){return t.concat([p[e]])},[]),m=e.container.selectAll(".frame-id-"+t.config.uid).data(g);m.exit().remove(),m.call(h),m.enter().append("g").call(h)},e}(m),pt=function(){return(pt=Object.assign||function(t){for(var e,n=1,r=arguments.length;nthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,n),this.depth--,n}},r.DeepCopier=e,r.deepCopiers=t,r.register=function(n){n instanceof e||(n=new e(n)),t.unshift(n)},r.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?"object"==typeof(e=t.constructor.prototype)?JSON.parse(JSON.stringify(e)):e:{};var e},populate:function(t,e,n){for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}}),r.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,n){for(var r=0;r":">",'"':""","'":"'","`":"`"},_t={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},St=/\\|'|\r|\n|\u2028|\u2029/g,Mt="(?:"+Object.keys(wt).join("|")+")",Ot=RegExp(Mt),At=RegExp(Mt,"g"),kt={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function Et(t){return vt(t)}function Tt(t){return t instanceof Date&&!isNaN(Number(t))}function Ct(t){return null!=t&&"object"==typeof t}function Nt(t){var e=parseFloat(Math.min.apply(Math,t).toFixed(15)),n=parseFloat(Math.max.apply(Math,t).toFixed(15));e===n&&(n-=(n>=0?-1:1)*(n||1)/10);for(var r=[e=Math.min(0,e),n=Math.max(0,n)],i=r[1]-r[0],o=Math.pow(10,Math.floor(Math.log(i/10)/Math.LN10)),a=10/i*o,u=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],s=-1;a>u[++s][0];);o*=u[s][1],r[0]=Math.floor(r[0]/o)*o,r[1]=Math.ceil(r[1]/o)*o;var c=e-r[0],l=r[1]-n,f=o/2;if(e<0){var d=c>=f?-c:0;r[0]=r[0]-d}if(n>0){var h=l>=f?-l:0;r[1]=r[1]+h}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Lt(t,e,n){var r=(void 0===n?{utc:!1}:n).utc,i=gt.extent(t),o=i[0],a=i[1],u=+a-+o,s=r?gt.scaleUtc:gt.scaleTime;if(0===u){return o=new Date(o.getTime()-864e5),a=new Date(a.getTime()+864e5),s().domain([o,a]).nice(e).domain()}var c=s().domain([o,a]).nice(e);if(e)return c.domain();var l=s().domain([o,a]).nice(e).domain(),f=l[0],d=l[1],h=c.ticks(),p=h.length-1;return(+o-+f)/(+h[1]-+f)<.5&&(o=f),(+d-+a)/(+d-+h[p-1])<.5&&(a=d),[o,a]}var jt=0,Pt={};function Ft(t){var e=btoa(encodeURIComponent(t)).replace(/=/g,"_");return Pt.hasOwnProperty(e)||(Pt[e]="H"+ ++jt),Pt[e]}function zt(t,e,n){var r=0,i=null,o=te(function(t,e){return Vt(t.map(function(t){return e.reduce(function(e,n){return e.concat(Tt(r=t[n])?r.getTime():r);var r},[])}),function(t){return JSON.stringify(t)}).reduce(function(t,e){var n=e[0];return t[n]=t[n]||0,t[n]+=1,t},{})},function(t,e){var n=i===t?r:++r;return i=t,e.join("")+"-"+n});return function(r,i,a){var u=a.length,s=n.getSpec(),c=s.sources["/"].data,l=s.unit.units[0].guide||{};l.padding=l.padding||{l:0,r:0,t:0,b:0};var f=0;"x"===t?f=l.padding.l+l.padding.r:"y"===t&&(f=l.padding.t+l.padding.b);var d,h=(i-u*f)/(d=o(c,e),Object.keys(d).reduce(function(t,e){return t+d[e]},0));return(function(t,e){return o(c,t)[e]}(e,r)*h+f)/i}}function Rt(t){var e=!0;try{yt(t,function(t){if(0===t.type.indexOf("COORDS.")&&"COORDS.RECT"!==t.type)throw new Error("Not applicable")},function(t){return t})}catch(t){"Not applicable"===t.message&&(e=!1)}return e}function Dt(t,e,n,r){if(void 0===r&&(r=0),"requestAnimationFrame"===r){var i=!1;return function(){for(var r=[],o=0;o=r&&n.apply(this,i),t.e=a.e,t.ts=a.ts}}function It(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),o=e>=2?Gt(e-2).map(function(t){return n+i*(t+1)}):[];return[n].concat(o,[r])}function Bt(t){return bt(t)?t:""}function Wt(t){return bt(t)?"":t}function Ht(t){return t/180*Math.PI}function Ut(t){return Math.abs(t)>=360&&(t%=360),t<0&&(t=360+t),t}function Gt(t,e){1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r100}function Xt(t,e,n,r){return t+e*(-90===n?-1:1)-r>20}function Yt(t){return Array.isArray(t)?[].concat.apply([],t.map(function(t){return Yt(t)})):t}function Vt(t,e){for(var n={},r=[],i=t.length,o=e||function(t){return String(t)},a=0;a/g,">").replace(/"/g,""").replace(/'/g,"'")}var ae=" ",ue=32,se=["img","input","br","embed","link","meta","area","base","basefont","bgsound","col","command","frame","hr","image","isindex","keygen","menuitem","nextid","param","source","track","wbr","circle","ellipse","line","path","polygon","rect"].reduce(function(t,e){return t[e]=!0,t},{});function ce(t){var e=2,n=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(e=1,n={});var r=Yt(Array.prototype.slice.call(arguments,e)),i=1===r.length&&"<"!==r[0].trim()[0],o=se[t];if(o&&r.length>0)throw new Error('Tag "'+t+'" is void but content is assigned to it');var a="<"+t,u=Object.keys(n).map(function(t){return" "+t+'="'+n[t]+'"'}).join("");u.length>ue&&(u=Object.keys(n).map(function(t){return"\n"+ae+t+'="'+n[t]+'"'}).join(""));var s=i?r[0]:"\n"+r.map(function(t){return String(t).split("\n").map(function(t){return""+ae+t}).join("\n")}).join("\n")+"\n";return""+a+u+(o?"/>":">"+s+"")}function le(t){var e=t,n={then:function(t){return e=t(e),n},result:function(){return e}};return n}var fe=[ht];function de(t){return fe.some(function(e){return t instanceof e})}function he(t){return(t.units||[]).some(function(t){return t.hasOwnProperty("units")})}var pe=document.createElement("div"),ge=new WeakMap;function me(t,e){var n;return t instanceof Node?n=t:(pe.insertAdjacentHTML("afterbegin",t),n=pe.childNodes[0]),e.appendChild(n),n}function ye(t){if(ge.has(t))return ge.get(t);var e=t.style.overflow;t.style.overflow="scroll";var n={width:t.offsetWidth-t.clientWidth,height:t.offsetHeight-t.clientHeight};return t.style.overflow=e,ge.set(t,n),n}function ve(t,e){var n="horizontal"===(e=e||"both")||"both"===e,r="vertical"===e||"both"===e,i=ye(t),o=r?i.width+"px":"0",a=n?i.height+"px":"0";t.style.overflow="hidden",t.style.padding="0 "+o+" "+a+" 0";var u=t.scrollWidth>t.clientWidth,s=t.scrollHeight>t.clientHeight,c=r&&!s?i.width+"px":"0",l=n&&!u?i.height+"px":"0";return t.style.padding="0 "+c+" "+l+" 0",t.style.overflow="",t.style.overflowX=u?"scroll":"hidden",t.style.overflowY=s?"scroll":"hidden",i}function be(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function xe(t,e){return parseInt(be(t,e)||"0",10)}function we(t){var e=xe(t,"padding-left"),n=xe(t,"padding-right"),r=xe(t,"padding-bottom"),i=xe(t,"padding-top"),o=xe(t,"border-top-width")+xe(t,"border-left-width")+xe(t,"border-right-width")+xe(t,"border-bottom-width"),a=t.getBoundingClientRect();return{width:a.width-e-n-2*o,height:a.height-r-i-2*o}}function _e(t){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",e.style.width="100px",e.style.height="100px",e.style.border="1px solid green",e.style.top="0",document.body.appendChild(e),e.innerHTML='\n \n \n \n \n \n ';var n=e.querySelector(".x.axis .tick text");n.textContent=t;var r={width:0,height:0},i=n.getBoundingClientRect();r.width=i.right-i.left,r.height=i.bottom-i.top;var o=0!==t.length?r.width/t.length:0;return r.width=r.width+1.5*o,document.body.removeChild(e),r}function Se(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o="string"==typeof n?n:n+"px",a=t.map(function(t){for(var e=0,n=0;e<=t.length-1;e++){n+=Me(t.charAt(e),{fontSize:o,fontFamily:r,fontWeight:i}).width}return n}).sort(function(t,e){return e-t})[0],u=t.length,s=parseInt(o);return{width:a,height:s*u+.39*s*u}}var Me=te(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=document.createElement("div");o.style.position="absolute",o.style.visibility="hidden",o.style.border="0px",o.style.top="0",o.style.fontSize=n,o.style.fontFamily=r,o.style.fontWeight=i,document.body.appendChild(o),o.innerHTML=" "===t?" ":t;var a={width:0,height:0},u=o.getBoundingClientRect();return a.width=u.right-u.left,a.height=u.bottom-u.top,document.body.removeChild(o),a},function(t,e){return t+"_"+JSON.stringify(e)});function Oe(t,e){var n={".":function(t,e){return e.classed(t,!0)},"#":function(t,e){return e.attr("id",t)}},r=Object.keys(n).join("");if(e.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(e[0])>=0)throw new Error("Selector must have tag at the beginning.");var i,o=t instanceof Element,u=o?a.select(t):t,s=function(t){return o?t.node():t},c=u.selectAll(e).filter(function(){return this.parentNode===u.node()}).filter(function(t,e){return 0===e});if(!c.empty())return s(c);for(var l,f=-1,d=null,h=1,p=e.length;h<=p;h++)(h==p||r.indexOf(e[h])>=0)&&(l=e.substring(f+1,h),f<0?i=u.append(l):n[d].call(null,l,i),d=e[h],f=h);return s(i)}function Ae(t,e){return ke(t,e)[0]||null}function ke(t,e){for(var n=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=t.firstElementChild;Boolean(i);i=i.nextElementSibling)r.call(i,e)&&n.push(i);return n}function Ee(t,e){if(t.childElementCount>0){var n,r,i=Array.prototype.filter.call(t.childNodes,function(t){return t.nodeType===Node.ELEMENT_NODE}),o=i.slice().sort(e),a=i.reduce(function(t,e,n){return t.set(e,n),t},new Map),u=o.reduce(function(t,e,i){var u=a.get(e),s=i-u;return s!==r&&(n&&t.push(n),r=s,n={from:u,to:i,elements:[]}),n.elements.push(e),i===o.length-1&&t.push(n),t},[]),s=u.slice().sort(function(t,e){return t.from-e.from}),c=s.reduce(function(t,e,n){return t.set(e,n),t},new Map),l=function(t){for(var e,n,r,i=u.map(function(t,e){return{elements:t.elements,from:c.get(t),to:e}}).sort(ee(function(t,e){return t.elements.length-e.elements.length},t?function(t,e){return e.to-t.to}:function(t,e){return t.to-e.to})),o=0;on.to)for(e=o+1;e=n.to&&r.fromn.from&&r.from<=n.to&&r.from--}return i.filter(function(t){return t.from!==t.to})},f=l(!0),d=l(!1),h=f.length=0?"h":"v"}function Pe(t){var e={x:0,y:0},n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}return e}function Fe(t,e,n,r,i,o,a,u){var s,c,l,f,d,h;return h=((l=a-i)*(e-o)-(f=u-o)*(t-i))/(-l*(c=r-e)+(s=n-t)*f),(d=(-c*(t-i)+s*(e-o))/(-l*c+s*f))>=0&&d<=1&&h>=0&&h<=1}function ze(t){for(var e,n,r={x:0,y:0},i=t;i&&"SVG"!==i.nodeName.toUpperCase();)(n=i.getAttribute("transform"))&&(e=Pe(n),r.x+=e.x,r.y+=e.y),i=i.parentNode;return r}function Re(t,e,n){var r=t.selectAll(e).filter(n);if(!r.empty()){var i=a.select(r.node().parentNode).selectAll(e).filter(function(t){return!n(t)}).nodes(),o=i[i.length-1];if(o){var u=Array.prototype.indexOf.call(o.parentNode.childNodes,o),s=o.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>u||this.parentNode.insertBefore(this,s)})}}}var De=function(t){return Tt(t)?t.getTime():t},Ie={cross:function(t,e,n){var r=t(),i=Vt(r.map(function(t){return t[e]}),De),o=Vt(r.map(function(t){return t[n]}),De),a=0===i.length?[null]:i;return(0===o.length?[null]:o).reduce(function(t,r){return t.concat(a.map(function(t){var i={};return e&&(i[e]=De(t)),n&&(i[n]=De(r)),i}))},[])},cross_period:function(t,e,n,r,i,o){var a=t(),u=!!o&&o.utcTime,s=Vt(a.map(function(t){return t[e]}),De),c=Vt(a.map(function(t){return t[n]}),De),l=0===s.length?[null]:s,f=0===c.length?[null]:c;return r&&(l=x.generate(Math.min.apply(Math,s),Math.max.apply(Math,s),r,{utc:u})),i&&(f=x.generate(Math.min.apply(Math,c),Math.max.apply(Math,c),i,{utc:u})),f.reduce(function(t,r){return t.concat(l.map(function(t){var i={};return e&&(i[e]=De(t)),n&&(i[n]=De(r)),i}))},[])},groupBy:function(t,e){return Vt(t().map(function(t){return t[e]}),De).map(function(t){var n;return(n={})[e]=De(t),n})},none:function(){return[null]}},Be=function(){function t(t,e,n){var r=t.key,i=t.pipe,o=t.source,a=t.units;void 0===n&&(n={}),this.key=r,this.pipe=i||[],this.source=o,this.units=a,this._frame={key:r,source:o,pipe:this.pipe},this._data=e,this._pipeReducer=function(t,e){return n[e.type](t,e.args)}}return t.prototype.hash=function(){return Ft([this._frame.pipe,this._frame.key,this._frame.source].map(function(t){return JSON.stringify(t)}).join(""))},t.prototype.full=function(){return this._data},t.prototype.part=function(t){return void 0===t&&(t=function(t){return t}),this._frame.pipe.map(t).reduce(this._pipeReducer,this._data)},t}(),We=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),He=function(t){return Tt(t)?t.getTime():t},Ue=function(t){var e=this;Object.keys(t).forEach(function(n){return e[n]=t[n]})},Ge=function(t,e,n){return t.map(function(t){return"string"==typeof t?n.get(t):t}).filter(function(t){return t}).reduce(function(t,e){return n=t,void 0===(r=e(t,{}))&&(r={}),Object.assign(new Ue(n),r);var n,r},e)},qe=function(t){function e(e,n,r,i){var o=t.call(this)||this;return Zt(e.scales,{size_null:{type:"size",source:"?"},split_null:{type:"value",source:"?"},label_null:{type:"value",source:"?"},color_null:{type:"color",source:"?"},identity_null:{type:"identity",source:"?"},"size:default":{type:"size",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"},"label:default":{type:"value",source:"?"},"identity:default":{type:"identity",source:"?"}}),e.settings=e.settings||{},o.config=e,o.sources=e.sources,o.scales=e.scales,o.unitSet=r,o.grammarRules=i,o.scalesHub=n,o.transformations=Object.assign(e.transformations||{},{where:function(t,e){var n=Object.keys(e||{}).map(function(t){return function(n){return He(n[t])===e[t]}});return t.filter(function(t){return n.every(function(e){return e(t)})})}}),o}return We(e,t),e.traverseSpec=function(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null);var o=[],a=function(t,e,n,r,i){o.push(function(){e(t,r,i)}),t.frames&&t.frames.forEach(function(r){(r.units||[]).map(function(i){return a(i,e,n,t,r)})}),o.push(function(){return n(t,r,i)})};return a(t.unit,e,n,r,i),o},e.prototype.unfoldStructure=function(){return this.root=this._expandUnitsStructure(this.config.unit),this.config},e.prototype.getDrawScenarioQueue=function(t){var e=this,n=this.grammarRules,r=this._flattenDrawScenario(t,function(t,r,i){var o=!1===r.expression.inherit?null:i,a=e._createFrameScalesFactoryMethod(o),u=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),s=new Ue(u.defineGrammarModel(a)),c=Ge(u.getGrammarRules(),s,n);return Ge(u.getAdjustScalesRules(),c,n),u.node().screenModel=u.createScreenModel(c),u}),i=this._flattenDrawScenario(t,function(t,r,i){var o=!1===r.expression.inherit?null:i,a=e._createFrameScalesFactoryMethod(o),u=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),s=new Ue(u.defineGrammarModel(a)),c=Ge(u.getGrammarRules(),s,n);return u.node().screenModel=u.createScreenModel(c),u.parentUnit=t,u.addInteraction(),u});return r.concat(function(){Object.keys(e.scales).forEach(function(t){return e.scalesHub.createScaleInfo(e.scales[t]).commit()})}).concat(i)},e.prototype._flattenDrawScenario=function(t,n){var r={},i=[],o=[t],a=e.traverseSpec({unit:this.root},function(t,e,a){var u;t.uid=(u=Ft((e?e.uid+"/":"")+JSON.stringify(Object.keys(t).filter(function(e){return"string"==typeof t[e]}).reduce(function(e,n){return e[n]=t[n],e},{}))+"-"+JSON.stringify(a.pipe)),r.hasOwnProperty(u)?u+="-"+ ++r[u]:r[u]=0,u),t.guide=Et(t.guide);var s,c=n(o[0],t,a);i.push(c),0===t.type.indexOf("COORDS.")&&(s=c,o.unshift(s))},function(t){0===t.type.indexOf("COORDS.")&&o.shift()},null,this._datify({source:this.root.expression.source,pipe:[]}));return a.push(function(){return i}),a},e.prototype._expandUnitsStructure=function(t,e){var n=this;void 0===e&&(e=[]);var r=this;if(!1===t.expression.operator)t.frames=t.frames.map(function(t){return r._datify(t)});else{var i=this._parseExpression(t.expression,e,t.guide);t.transformation=t.transformation||[],t.frames=i.exec().map(function(n){var o=(i.inherit?e:[]).concat([{type:"where",args:n}]).concat(t.transformation);return r._datify({key:n,pipe:o,source:i.source,units:t.units?t.units.map(function(t){var e=Et(t);return e.guide=t.guide,e}):[]})})}return t.frames.forEach(function(t){return t.units.forEach(function(e){return n._expandUnitsStructure(e,t.pipe)})}),t},e.prototype._createFrameScalesFactoryMethod=function(t){var e=this;return function(n,r,i){var o=r||n+":default";return e.scalesHub.createScaleInfo(e.scales[o],t).create("function"==typeof i?i(e.scales[o]):i)}},e.prototype._datify=function(t){return new Be(t,this.sources[t.source].data,this.transformations)},e.prototype._parseExpression=function(t,e,n){var r=this,i=t.operator||"none",o=t.source,a=!1!==t.inherit,u=t.params,s={source:o,pipe:a?e:[]},c=function(){return r._datify(s).part()},l=Ie[i];if(!l)throw new Error(i+" operator is not supported");return{source:o,inherit:a,func:l,args:u,exec:function(){return l.apply(void 0,[c].concat(u||[],[n]))}}},e}(h),Xe="tau-chart__",Ye=n(10),Ve=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Ye.Tooltip.defaults.baseClass=Xe+"tooltip";var $e=["top","bottom"];var Je,Ke,Ze=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ve(e,t),e.prototype._pickPlace=function(t){if(!this.options.auto)return this.options.place;var e,n,r,i,o,a,u,s,c=0|this.options.winBound,l=(e=c,r=window,i=document.documentElement,o=(r.pageYOffset||i.scrollTop)-i.clientTop,a=(r.pageXOffset||i.scrollLeft)-i.clientTop,u=r.innerWidth||i.clientWidth,s=r.innerHeight||i.clientHeight,{top:(n={top:o,right:a+u,bottom:o+s,left:a,width:u,height:s}).top+e,right:n.right-e,bottom:n.bottom-e,left:n.left+e,width:n.width-2*e,height:n.height-2*e}),f=this.options.place.split("-"),d=this.spacing;if(-1!==$e.indexOf(f[0]))switch(t.top-this.height-d<=l.top?f[0]="bottom":t.bottom+this.height+d>=l.bottom&&(f[0]="top"),f[1]){case"left":t.right-this.width<=l.left&&(f[1]="right");break;case"right":t.left+this.width>=l.right&&(f[1]="left");break;default:t.left+t.width/2+this.width/2>=l.right?f[1]="left":t.right-t.width/2-this.width/2<=l.left&&(f[1]="right")}else switch(t.left-this.width-d<=l.left?f[0]="right":t.right+this.width+d>=l.right&&(f[0]="left"),f[1]){case"top":t.bottom-this.height<=l.top&&(f[1]="bottom");break;case"bottom":t.top+this.height>=l.bottom&&(f[1]="top");break;default:t.top+t.height/2+this.height/2>=l.bottom?f[1]="top":t.bottom-t.height/2-this.height/2<=l.top&&(f[1]="bottom")}return f.join("-")},e}(Ye.Tooltip),Qe=function(){function t(t,e){this.chart=e,this.handlers=new Map,this.plugins=t.map(this.initPlugin,this)}return t.prototype.initPlugin=function(t){var e=this;t.init&&t.init(this.chart);var n=[];this.handlers.set(t,n);var r=function(r,i){n.push(e.chart.on(r,i,t))};return t.destroy&&r("destroy",t.destroy.bind(t)),Object.keys(t).forEach(function(e){if(0===e.indexOf("on")){var n=e.substr(2).toLowerCase();r(n,t[e].bind(t))}}),t},t.prototype.destroyPlugin=function(t){var e=this;t.destroy&&t.destroy(),this.handlers.get(t).forEach(function(n){e.chart.removeHandler(n,t)})},t.prototype.destroy=function(){var t=this;this.plugins.forEach(function(e){return t.destroyPlugin(e)})},t}(),tn={},en={},nn={reg:function(t,e,n){return n?(en[t]=n,tn[t]=function(t,e){this.___tauchartsseed___=new e(this.init(t))},tn[t].prototype=Object.assign({init:function(t){return t},defineGrammarModel:function(t){return this.node().defineGrammarModel(t)},getGrammarRules:function(t){return this.node().getGrammarRules(t)},getAdjustScalesRules:function(t){return this.node().getAdjustScalesRules(t)},createScreenModel:function(t){return this.node().createScreenModel(t)},addInteraction:function(){this.node().addInteraction()},node:function(){return this.___tauchartsseed___},draw:function(){this.node().draw()}},e)):tn[t]=e,this},get:function(t){if(!tn.hasOwnProperty(t))throw new _("Unknown unit type: "+t,S.UNKNOWN_UNIT_TYPE);return tn[t]},create:function(t,e){var n,r=this.get(t);en[t]?n=new r(e,this.get(en[t])):n=new r(e);return n}},rn={},on={},an={reg:function(t,e,n){return void 0===n&&(n=function(t){return t}),rn[t]=e,on[t]=n,an},get:function(t){return rn[t]},instance:function(t){return void 0===t&&(t={}),{create:function(e,n,r){return new(an.get(e))(n,(0,on[e])(r,t))}}}},un=function(){function t(t,e,n){this.registry=t,this.sources=e,this.scales=n}return t.prototype.createScaleInfo=function(t,e){void 0===e&&(e=null);var n=t.dim,r=t.source,i=(this.sources[r].dims[n]||{}).type,o=this.sources[r].data,a=e||new Be({source:r},o);return t.dimType=i,this.registry.create(t.type,a,t)},t.prototype.createScaleInfoByName=function(t,e){return void 0===e&&(e=null),this.createScaleInfo(this.scales[t],e)},t}(),sn=function(t,e,n){var r=!0,i=null;try{t.reduce(function(t,r){var o=function(t,e){var n=r[e],i=Ct(n)?JSON.stringify(n):n;return t.push(i),t},a=e.reduce(o,[]).join("/"),u=n.reduce(o,[]).join("/");if(t.hasOwnProperty(a)){var s=t[a];if(s!==u)throw i={type:"RelationIsNotAFunction",keyX:e.join("/"),keyY:n.join("/"),valX:a,errY:[s,u]},new Error("RelationIsNotAFunction")}else t[a]=u;return t},{})}catch(t){if("RelationIsNotAFunction"!==t.message)throw t;r=!1}return{result:r,error:i}},cn=function(t,e){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||e.push(n),e},[]);return function(t){var r=!n.some(function(e){return!t.hasOwnProperty(e)||null===t[e]});return r||e(t),r}},ln=function(t){var e={category:"ordinal",order:"ordinal",measure:"linear"},n={};return Object.keys(t).forEach(function(r){var i=t[r],o=(i.type||"category").toLowerCase();n[r]=Object.assign({},i,{type:o,scale:i.scale||e[o],value:i.value})}),n},fn=function(t){var e={type:"category",scale:"ordinal"};return t.reduce(function(t,n){return Object.keys(n).forEach(function(r){var i=n.hasOwnProperty(r)?n[r]:null;if(t[r]=t[r]||{type:null,hasNull:!1},null===i)t[r].hasNull=!0;else{var o=function(t,e){var n=e;return Tt(t)?(n.type="measure",n.scale="time"):Ct(t)?(n.type="order",n.scale="ordinal"):Number.isFinite(t)&&(n.type="measure",n.scale="linear"),n}(i,Et(e)),a=o.type,u=o.scale,s=null!==t[r].type&&t[r].type!==a;t[r].type=s?e.type:a,t[r].scale=s?e.scale:u}}),t},{})},dn=function(t,e,n){var r=t,i=["period","time"].indexOf(n.scale)>=0?function(t){return new Date(t)}:function(t){return t},o=t.reduce(function(t,e,n){return t.set(e,n),t},new Map);if("measure"===n.type||"period"===n.scale)r=t.slice().sort(ee(function(t,n){return i(t[e])-i(n[e])},function(t,e){return o.get(t)-o.get(e)}));else if(n.order){var a=n.order.reduce(function(t,e,n){return t[e]=n,t},{}),u=n.order.length,s="(___"+e+"___)";r=t.map(function(t){var n=a[t[e]];return n=n>=0?n:u,t[s]=n,t}).sort(ee(function(t,e){return t[s]-e[s]},function(t,e){return o.get(t)-o.get(e)})).map(function(t){return delete t[s],t})}return r},hn=function(t,e){var n=document.createElement("div");return n.classList.add(Xe+t),e&&e.appendChild(n),n},pn=function(){var t=hn("layout"),e=hn("layout__header",t),n=hn("layout__container",t),r=hn("layout__sidebar",n),i=hn("layout__content",n),o=hn("layout__content__wrap",i),a=hn("layout__sidebar-right",n);return{layout:t,header:e,content:o,contentContainer:i,leftSidebar:r,rightSidebar:hn("layout__sidebar-right__wrap",a),rightSidebarContainer:a,footer:hn("layout__footer",t)}},gn=function(){function t(t){this.spec=t,this.dist={sources:{"?":{dims:{},data:[{}]},"/":{dims:{},data:[]}},scales:{x_null:{type:"ordinal",source:"?"},y_null:{type:"ordinal",source:"?"},size_null:{type:"size",source:"?"},color_null:{type:"color",source:"?"},split_null:{type:"value",source:"?"},"pos:default":{type:"ordinal",source:"?"},"size:default":{type:"size",source:"?"},"label:default":{type:"value",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"}},settings:t.settings}}return t.prototype.convert=function(){var t=this.spec,e=this.dist;return this.ruleAssignSourceDims(t,e),this.ruleAssignStructure(t,e),this.ruleAssignSourceData(t,e),this.ruleApplyDefaults(e),e},t.prototype.ruleApplyDefaults=function(t){var e=t.settings||{},n=function(t,e,r){e(t,r),(t.units||[]).map(function(r){return n(r,e,t)})};n(t.unit,function(t,n){if(t.namespace="chart",t.guide=Zt(t.guide||{},{animationSpeed:e.animationSpeed||0,utcTime:e.utcTime||!1}),n&&!t.hasOwnProperty("units")){t=Zt(t,{x:n.x,y:n.y});var r=Et(n.guide)||{};t.guide.x=Zt(t.guide.x||{},r.x),t.guide.y=Zt(t.guide.y||{},r.y),t.expression.inherit=n.expression.inherit}return!n||t.guide&&t.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(t.guide=Object.assign(t.guide||{},{obsoleteVerticalStackOrder:(n.guide||{}).obsoleteVerticalStackOrder})),t},null)},t.prototype.ruleAssignSourceData=function(t,e){var n=t.spec.dimensions||{},r=e.sources["/"].dims,i=function(t,e){var n=t[e];return Ct(n)&&!Tt(n)&&Object.keys(n).forEach(function(r){return t[e+"."+r]=n[r]}),t};e.sources["/"].data=t.data.map(function(t){var e=Object.keys(t).reduce(i,t);return Object.keys(r).reduce(function(t,e){return t.hasOwnProperty(e)||(t[e]=null),null!==t[e]&&n[e]&&["period","time"].indexOf(n[e].scale)>=0&&(t[e]=new Date(t[e])),t},e)})},t.prototype.ruleAssignSourceDims=function(t,e){var n=t.spec.dimensions;e.sources["/"].dims=Object.keys(n).reduce(function(t,e){return t[e]={type:n[e].type},t},{})},t.prototype.ruleAssignStructure=function(t,e){var n=this,r=function(t){var i=Et(Qt(t,"unit"));return n.ruleCreateScales(t,i,e.settings),i.expression=n.ruleInferExpression(t),t.unit&&(i.units=t.unit.map(r)),i},i=r(t.spec.unit);i.expression.inherit=!1,e.unit=i},t.prototype.ruleCreateScales=function(t,e,n){var r=this,i=t.guide||{};["identity","color","size","label","x","y","split"].forEach(function(o){t.hasOwnProperty(o)&&(e[o]=r.scalesPool(o,t[o],i[o]||{},n))})},t.prototype.ruleInferDim=function(t,e){var n=t,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(n))return n;e.hasOwnProperty("tickLabel")?n=t+"."+e.tickLabel:r[t].value&&(n=t+"."+r[t].value);var i=this.dist.sources["/"].dims;return i.hasOwnProperty(n)||(i[n]={type:i[t].type},delete i[t]),n},t.prototype.scalesPool=function(t,e,n,r){var i=t+"_"+e;if(this.dist.scales.hasOwnProperty(i))return i;var o=this.spec.spec.dimensions,a={};if("color"===t&&null!==e&&(a={type:"color",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("brewer")&&(a.brewer=n.brewer),o[e]&&o[e].hasOwnProperty("order")&&(a.order=o[e].order),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("nice")&&(a.nice=n.nice)),"size"===t&&null!==e&&(a={type:"size",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("func")&&(a.func=n.func),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("minSize")&&(a.minSize=n.minSize),n.hasOwnProperty("maxSize")&&(a.maxSize=n.maxSize)),"label"===t&&null!==e&&(a={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"split"===t&&null!==e&&(a={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"identity"===t&&null!==e&&(a={type:"identity",source:"/",dim:this.ruleInferDim(e,n)}),o.hasOwnProperty(e)&&("x"===t||"y"===t)){if(a={type:o[e].scale,source:"/",dim:this.ruleInferDim(e,n)},o[e].hasOwnProperty("order")&&(a.order=o[e].order),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("autoScale")?a.autoScale=n.autoScale:a.autoScale=!0,n.hasOwnProperty("nice")?a.nice=n.nice:a.nice=a.autoScale,n.hasOwnProperty("niceInterval")?a.niceInterval=n.niceInterval:a.niceInterval=null,n.hasOwnProperty("tickPeriod")&&(a.period=n.tickPeriod,a.type="period"),n.hasOwnProperty("tickPeriod")&&n.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(n.hasOwnProperty("timeInterval")){a.period=n.timeInterval,a.type="time";var u=x.get(a.period,{utc:r.utcTime});n.hasOwnProperty("min")&&(a.min=u.cast(new Date(n.min))),n.hasOwnProperty("max")&&(a.max=u.cast(new Date(n.max)))}a.fitToFrameByDims=n.fitToFrameByDims,a.ratio=n.ratio}return this.dist.scales[i]=a,i},t.prototype.getScaleConfig=function(t,e){var n=t+"_"+e;return this.dist.scales[n]},t.prototype.ruleInferExpression=function(t){var e={operator:"none",params:[]},n=t.guide||{},r=n.x||{},i=n.y||{},o=this.getScaleConfig("x",t.x),a=this.getScaleConfig("y",t.y);return 0===t.type.indexOf("ELEMENT.")?t.color&&(e={operator:"groupBy",params:[this.ruleInferDim(t.color,n.color||{})]}):"COORDS.RECT"===t.type&&1===t.unit.length&&"COORDS.RECT"===t.unit[0].type&&(e=o.period||a.period?{operator:"cross_period",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i),o.period,a.period]}:{operator:"cross",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i)]}),Object.assign({inherit:!0,source:"/"},e)},t}(),mn=n(6),yn=n(7),vn=function(){return(vn=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.computed?{value:n,computed:r}:t},{}).value;return n(e(o))},Ln=function(t,e){var n=t.dimType,r=t.scaleType,i=[n,r,"*"].join(":"),o=[n,r].join(":");return e[i]||e[o]||e[n]||null},jn=function(t,e,n){return t.hasOwnProperty(e+":"+n)?t[e+":"+n]:t[""+e]},Pn=function(t,e){return["day","week","month"].indexOf(t)>=0&&(t+="-short"+(e?"-utc":"")),t},Fn=function(t,e){var n=t.width,r=t.height,i=Math.abs(Ht(e));return{width:Math.max(Math.cos(i)*n,r),height:Math.max(Math.sin(i)*n,r)}},zn=function(t,e){void 0===e&&(e="x");var n=Ut(t),r="x"===e?[[0,45,"middle"],[45,135,"start"],[135,225,"middle"],[225,315,"end"],[315,360,"middle"]]:[[0,90,"end"],[90,135,"middle"],[135,225,"start"],[225,315,"middle"],[315,360,"end"]],i=r.findIndex(function(t){return n>=t[0]&&ne.xAxisTickLabelLimit&&(t.x.tickFormatWordWrap=!0,t.x.tickFormatWordWrapLines=e.xTickWordWrapLinesLimit,d=Rn(l,e.xAxisTickLabelLimit,e.xTickWordWrapLinesLimit)),f.width>e.yAxisTickLabelLimit&&(t.y.tickFormatWordWrap=!0,t.y.tickFormatWordWrapLines=e.yTickWordWrapLinesLimit,h=Rn(f,e.yAxisTickLabelLimit,e.yTickWordWrapLinesLimit)),o&&(t.y.tickFormatWordWrap=!1,t.y.tickFormatWordWrapLines=1,(h=Rn(f,2*e.yAxisTickLabelLimit,1)).width=20);var p=s?0:1,g=c?0:1,m=t.x.label,y=t.y.label,v=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,x=Fn(d,t.x.rotate),w=Fn(h,t.y.rotate);i?(m.padding=(-e.xAxisPadding-e.xFontLabelHeight)/2+e.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-e.yAxisPadding-e.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,v=0,b=0):(m.padding=An([p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight)]),m.paddingNoTicks=v*(e.distToXAxisLabel+e.xFontLabelHeight),y.padding=An([g*(e.yTickWidth+w.width),b*e.distToYAxisLabel]),y.paddingNoTicks=b*e.distToYAxisLabel),o&&(y.padding=0,y.paddingNoTicks=0);var _=e.xFontLabelDescenderLineHeight;return t.padding=Object.assign(t.padding,{b:t.x.hide?0:An([t.x.padding,p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight+_)]),l:t.y.hide?0:An([t.y.padding,o?0:g*(e.yTickWidth+w.width),b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.paddingNoTicks=Object.assign({},t.paddingNoTicks,{b:t.x.hide?0:An([t.x.padding,v*(e.distToXAxisLabel+e.xFontLabelHeight+_)]),l:t.y.hide?0:An([t.y.padding,b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.x=Object.assign(t.x,{density:x.width+2*jn(e,"xDensityPadding",n.dimType),tickFontHeight:l.height,$minimalDomain:a.length,$maxTickTextW:d.width,$maxTickTextH:d.height,tickFormatWordWrapLimit:e.xAxisTickLabelLimit}),t.y=Object.assign(t.y,{density:w.height+2*jn(e,"yDensityPadding",r.dimType),tickFontHeight:f.height,$minimalDomain:u.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:e.yAxisTickLabelLimit}),t}var In=function(t){var e=t.unit,n=t.meta,r=t.settings,i=t.allowXVertical,o=t.allowYVertical,a=t.inlineLabels,u=n.dimension(e.x),s=n.dimension(e.y),c=n.scaleMeta(e.x,e.guide.x),l=n.scaleMeta(e.y,e.guide.y),f=c.isEmpty,d=l.isEmpty;e.guide.x.tickFormat=Pn(e.guide.x.tickFormat||Ln(u,r.defaultFormats),r.utcTime),e.guide.y.tickFormat=Pn(e.guide.y.tickFormat||Ln(s,r.defaultFormats),r.utcTime);var h=!!i&&!("measure"===u.dimType),p=!!o&&!("measure"===s.dimType);if(e.guide.x.padding=f?0:r.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:r.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=zn(e.guide.x.rotate,"x"),e.guide.y.rotate=p?-90:0,e.guide.y.textAnchor=zn(e.guide.y.rotate,"y"),e.guide=Dn(e.guide,r,c,l,a,he(e)),a){var g=e.guide.x.label,m=e.guide.y.label;g.cssClass+=" inline",g.dock="right",g.textAnchor="end",m.cssClass+=" inline",m.dock="right",m.textAnchor="end"}return e},Bn={NONE:function(t,e,n){var r=Et(t);return Wn(Et(r.unit),r.unit,function(t,e){return e.guide.x.tickFontHeight=n.getAxisTickLabelSize("X").height,e.guide.y.tickFontHeight=n.getAxisTickLabelSize("Y").height,e.guide.x.tickFormatWordWrapLimit=n.xAxisTickLabelLimit,e.guide.y.tickFormatWordWrapLimit=n.yAxisTickLabelLimit,e}),r},"BUILD-LABELS":function(t,e){var n=Et(t),r=[],i=[],o=null,a=null;mt(n.unit,"units",Cn,function(t,n){if(t.isLeaf)return n;!o&&n.x&&(o=n),!a&&n.y&&(a=n),n.guide=n.guide||{},n.guide.x=n.guide.x||{label:{text:""}},n.guide.y=n.guide.y||{label:{text:""}},n.guide.x.label=Ct(n.guide.x.label)?n.guide.x.label:{text:n.guide.x.label&&n.guide.x.label.text?n.guide.x.label.text:""},n.guide.y.label=Ct(n.guide.y.label)?n.guide.y.label:{text:n.guide.y.label&&n.guide.y.label.text?n.guide.y.label.text:""},n.x&&(n.guide.x.label.text=n.guide.x.label.text||e.dimension(n.x).dimName),n.y&&(n.guide.y.label.text=n.guide.y.label.text||e.dimension(n.y).dimName);var u=n.guide.x.label.text;u&&(r.push(u),n.guide.x.tickFormatNullAlias=n.guide.x.hasOwnProperty("tickFormatNullAlias")?n.guide.x.tickFormatNullAlias:"No "+u,n.guide.x.label.text="",n.guide.x.label._original_text=u);var s=n.guide.y.label.text;return s&&(i.push(s),n.guide.y.tickFormatNullAlias=n.guide.y.hasOwnProperty("tickFormatNullAlias")?n.guide.y.tickFormatNullAlias:"No "+s,n.guide.y.label.text="",n.guide.y.label._original_text=s),n});return o&&(o.guide.x.label.text=o.guide.x.label.hide?"":r.join(" → ")),a&&(a.guide.y.label.text=a.guide.y.label.hide?"":i.join(" → ")),n},"BUILD-GUIDE":function(t,e,n){var r=Et(t);return Wn(Et(r.unit),r.unit,function(t,r){if(t.isLeaf)return r;var i=!t.isLeaf&&!t.isLeafParent,o=e.scaleMeta(r.x,r.guide.x),a=e.scaleMeta(r.y,r.guide.y),u=!i&&Boolean(o.dimType)&&"measure"!==o.dimType;return r.guide.x.rotate=r.guide.x.rotate||(u?-90:0),r.guide.x.textAnchor=zn(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||Ln(o,n.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||Ln(a,n.defaultFormats),r.guide.x.padding=i?0:n.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=i?0:n.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=Dn(r.guide,Zt({distToXAxisLabel:o.isEmpty?n.xTickWidth:n.distToXAxisLabel,distToYAxisLabel:a.isEmpty?n.yTickWidth:n.distToYAxisLabel},n),o,a,null,he(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:i?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!i||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:i?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!i&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:t.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":function(t,e,n){var r=Et(t);return Wn(Et(r.unit),r.unit,function(t,r){return t.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=t.isLeafParent?"xy":""),t.isLeafParent?In({unit:r,meta:e,settings:Zt({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!0,allowYVertical:!1,inlineLabels:!0}):(r.guide.x.cssClass+=" facet-axis compact",r.guide.x.avoidCollisions=!0,r.guide.y.cssClass+=" facet-axis compact",r.guide.y.avoidCollisions=!0,In({unit:r,meta:e,settings:Zt({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))}),r},AUTO:function(t,e,n){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(t,r){return Bn[r](t,e,n)},t)},COMPACT:function(t,e,n){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(t,r){return Bn[r](t,e,n)},t)}},Wn=function(t,e,n){var r,i=((r=e).options=r.options||{},r.guide=r.guide||{},r.guide.padding=Zt(r.guide.padding||{},{l:0,b:0,r:0,t:0}),r.guide.x=En(r.guide,"x"),r.guide.x=Tn(r.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),r.guide.y=En(r.guide,"y",{rotate:-90}),r.guide.y=Tn(r.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),r.guide.size=En(r.guide,"size"),r.guide.color=En(r.guide,"color"),r);i=n(Cn(i),i);var o=Qt(i=kn(i,t),"units");return(i.units||[]).forEach(function(t){return Wn(Et(t),(r=o,(e=t).guide=e.guide||{},e.guide.padding=e.guide.padding||{l:0,t:0,r:0,b:0},e.hasOwnProperty("units")||((e=Zt(e,r)).guide=Zt(e.guide,Et(r.guide)),e.guide.x=Zt(e.guide.x,Et(r.guide.x)),e.guide.y=Zt(e.guide.y,Et(r.guide.y))),e),n);var e,r}),i},Hn=function(t,e,n,r){var i={dimension:function(t){var e=n.scales[t],r=n.sources[e.source].dims[e.dim]||{};return{dimName:e.dim,dimType:r.type,scaleType:e.type}},scaleMeta:function(t){var e=r("pos",t).domain(),i=n.scales[t],o=n.sources[i.source].dims[i.dim]||{};return{dimName:i.dim,dimType:o.type,scaleType:i.type,values:e,isEmpty:null==o.type}}},o=(Bn[t]||Bn.NONE)({unit:Et(n.unit)},i,e);return n.unit=o.unit,n},Un=function(){function t(t){this.spec=t,this.isApplicable=Rt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.size,r=e.settings.specEngine.find(function(t){return n.width<=t.width||n.height<=t.height});return Hn(r.name,e.settings,e,function(e,n){return t.getScaleInfo(n||e+":default")})},t}(),Gn=function(){function t(){}return t.optimizeXAxisLabel=function(t,e){var n=e.xAxisTickLabelLimit,r=function(t){if(!t.guide.x.hide&&!t.guide.x.hideTicks&&0!==t.guide.x.rotate){t.guide.x.rotate=0,t.guide.x.textAnchor="middle";var e=0-Math.min(n,t.guide.x.$maxTickTextW)+t.guide.x.$maxTickTextH;i(t,e)}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})},i=function(e,n){t!==e&&"extract-axes"===e.guide.autoLayout?(t.guide.x.padding+=n,t.guide.padding.b+=n):(e.guide.x.label.padding+=e.guide.x.label.padding>0?n:0,e.guide.padding.b+=e.guide.padding.b>0?n:0)};r(t)},t.hideAxisTicks=function(t,e,n){var r=function(t){var e="x"===n?"b":"l",i=t.guide;if(!i[n].hide&&!i[n].hideTicks){he(t)&&"y"===n||(i[n].hideTicks=!0);var o=i[n].label.text&&!i[n].label.hide;i.padding[e]=i.paddingNoTicks?i.paddingNoTicks[e]:0,i[n].padding=i[n].paddingNoTicks||0,i[n].label.padding=o?i[n].label.paddingNoTicks:0}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})};r(t)},t.facetsLabelsAtTop=function(t,e){var n=function(t){var e=t.units||[];if(he(t)){var r=t.guide;r.y.facetAxis=!0,r.y.rotate=0,r.y.textAnchor="start",e.forEach(function(t){t.guide.padding.t=20})}e.filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return n(t)})};n(t)},t}(),qn=function(t){return t.$maxTickTextW},Xn=function(t){return 0==t.rotate?t.$maxTickTextW:t.$maxTickTextH},Yn=function(t){return t.density},Vn=function(t){var e=[],n=[],r=function(t){if("COORDS.RECT"===t.type&&t.units&&t.units[0]&&"COORDS.RECT"===t.units[0].type){var i=t.x.replace(/^x_/,""),o=t.y.replace(/^y_/,"");"null"!==i&&e.push(i),"null"!==o&&n.push(o),t.units.forEach(r)}};r(t.unit);var i={},o={},a=function(t){"COORDS.RECT"===t.type&&t.frames.forEach(function(t){t.key&&(Object.keys(t.key).forEach(function(r){e.indexOf(r)>=0&&(i.hasOwnProperty(r)||(i[r]=[]),i[r].indexOf(t.key[r])<0&&i[r].push(t.key[r])),n.indexOf(r)>=0&&(o.hasOwnProperty(r)||(o[r]=[]),o[r].indexOf(t.key[r])<0&&o[r].push(t.key[r]))}),t.units&&t.units.forEach(a))})};return a(t.unit),{xFacetCount:Object.keys(i).reduce(function(t,e){return t*i[e].length},1),yFacetCount:Object.keys(o).reduce(function(t,e){return t*o[e].length},1)}},$n={"entire-view":function(t,e,n,r){var i=n.unit.guide,o=Vn(n),a=o.xFacetCount,u=o.yFacetCount;u>0&&Gn.facetsLabelsAtTop(n.unit,n.settings);var s=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0,c=i.paddingNoTicks?i.padding.b-i.paddingNoTicks.b:0,l=i.paddingNoTicks&&t.height-ct.height||a*n.settings.minFacetWidth+s>t.width,f=i.paddingNoTicks&&t.width-st.height||a*n.settings.minFacetWidth+s>t.width;l&&Gn.hideAxisTicks(n.unit,n.settings,"x"),f&&Gn.hideAxisTicks(n.unit,n.settings,"y");var d=t.width;if(e("x",n.unit,qn)<=t.width)r(n.unit,n.settings);else{var h=e("x",n.unit,Xn);if(h>t.width){var p=Math.max(t.width,e("x",n.unit,Yn));d=Math.min(h,p)}}var g=Math.max(t.height,e("y",n.unit,Yn));return!l&&d>t.width&&Gn.hideAxisTicks(n.unit,n.settings,"x"),!f&&g>t.height&&Gn.hideAxisTicks(n.unit,n.settings,"y"),{newW:t.width,newH:t.height}},minimal:function(t,e,n){return{newW:e("x",n.unit,Yn),newH:e("y",n.unit,Yn)}},normal:function(t,e,n,r){Vn(n).yFacetCount>0&&Gn.facetsLabelsAtTop(n.unit,n.settings);var i=n.unit.guide;i.paddingNoTicks&&(t.width-i.padding.l+i.paddingNoTicks.lt.width){var u=Math.max(t.width,e("x",n.unit,Yn));o=Math.min(a,u)}}return{newW:o,newH:Math.max(t.height,e("y",n.unit,Yn))}},"fit-width":function(t,e,n,r){var i=n.unit.guide,o=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0;return(i.paddingNoTicks&&t.width-ot.width)&&Gn.hideAxisTicks(n.unit,n.settings,"y"),e("x",n.unit,qn)<=t.width&&r(n.unit,n.settings),{newW:t.width,newH:e("y",n.unit,Yn)}},"fit-height":function(t,e,n){var r=n.unit.guide,i=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&t.height-it.height)&&Gn.hideAxisTicks(n.unit,n.settings,"x"),{newW:e("x",n.unit,Yn),newH:t.height}}},Jn=function(){function t(t){this.spec=t,this.isApplicable=Rt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.fitModel;if(!n)return e;var r=e.scales,i=function(t,e){return t.discrete?e*t.domain().length:4*e},o=function(e,n,a,u){void 0===u&&(u=null);var s="x"===e?n.x:n.y,c="x"===e?n.y:n.x,l=n.guide,f=a("x"===e?l.x:l.y),d=n.units[0],h="x"===e?l.padding.l+l.padding.r:l.padding.b+l.padding.t;if("ELEMENT.INTERVAL"===d.type&&"y"===e===Boolean(d.flip)&&d.label&&!t.getScaleInfo(d.label,u).isEmpty()){var p,g=2*(l.label&&l.label.fontSize?l.label.fontSize:10),m=t.getScaleInfo(s,u);if(m.discrete&&(null==d.guide.enableColorToBarPosition?!d.stack:d.guide.enableColorToBarPosition)){var y=d.color;if(y){var v=t.getScaleInfo(y,u);if(v.discrete){v.domain();p=v}}}var b=n.frames.reduce(function(t,e){return t+function(t){var e=t.part(),n=Vt(e.map(function(t){return t[m.dim]})).length,r=1;if(p){var i=e.reduce(function(t,e){var n=e[m.dim],r=e[p.dim];return t[n]=t[n]||{},t[n][r]||(t[n][r]=!0),t},{}),o=Object.keys(i).map(function(t){return Object.keys(i[t]).length});r=Math.max.apply(Math,o)}return n*r*g}(e)},0),x=i(m,f);return h+Math.max(b,x)}if("COORDS.RECT"!==d.type){var w=t.getScaleInfo(s,u);return h+i(w,f)}var _,S,M=(_=n.frames,S=r[c].dim,_.reduce(function(t,e){var n=(e.key||{})[S];return t[n]=t[n]||[],t[n].push(e),t},{})),O=Object.keys(M).map(function(t){return M[t].map(function(t){return o(e,t.units[0],a,t)}).reduce(function(t,e){return t+e},0)});return h+Math.max.apply(Math,O)},a=e.settings.size,u=a.width,s=a.height,c=$n[n];if(c){var l=c(a,o,e,Gn.optimizeXAxisLabel);u=l.newW,s=l.newH}return e.settings.size=function(n,r,i){var o=e.settings.getScrollbarSize(t.getLayout().contentContainer),a=r.width>n.width&&r.width<=n.width*i?n.width:r.width,u=r.height>n.height&&r.height<=n.height*i?n.height:r.height,s=n.width-a,c=n.height-u>=0?0:o.width;return{height:u-(s>=0?0:o.height),width:a-c}}(a,{width:u,height:s},e.settings.avoidScrollAtRatio),e},t}(),Kn=function(){function t(t){this.spec=t,this.isApplicable=t.settings.autoRatio&&Rt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleApplyRatio(e,t)}catch(t){if("Not applicable"!==t.message)throw t}return e},t.prototype.ruleApplyRatio=function(t,e){var n=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},r=function(t,e,n,i){void 0===i&&(i=0),e(t,i)&&(t.units||[]).map(function(t){return r(t,e,n,i+1)}),n(t,i)},i=[],o=[];r(t.unit,function(t,e){if(e>1||!n(t))throw new Error("Not applicable");return i.push(t.x),o.push(t.y),1===(t.units||[]).map(function(t){if(!n(t)&&0!==t.type.indexOf("ELEMENT."))throw new Error("Not applicable");return t}).filter(n).length},function(){return 0});var a=function(e){return t.scales[e]},u=function(t){return"/"===t.source&&!t.ratio&&!t.fitToFrameByDims},s=function(t){return"ordinal"===t.type||"period"===t.type&&!t.period},c=i.map(a).filter(u),l=o.map(a).filter(u);if([c.length,l.length].some(function(t){return 2===t})){var f=function(t){return t.dim},d=function(t,e,n){t.fitToFrameByDims=n.slice(0,e).map(f)},h=function(t,n){2===n.filter(s).length&&(n.forEach(d),n[0].ratio=zt(t,n.map(f),e))};h("x",c),h("y",l)}},t}(),Zn=function(){function t(t){this.spec=t,this.isApplicable="EXTRACT"===t.settings.layoutEngine&&Rt(t.unit)}return t.prototype.transform=function(){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleExtractAxes(t)}catch(t){if("Not applicable"!==t.message)throw t;console.log("[TauCharts]: can't extract axes for the given chart specification")}return t},t.prototype.ruleExtractAxes=function(t){var e=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},n=function(t){return t?10:0},r={l:0,r:10,t:10,b:0},i={l:0,b:0},o=[],a=[];yt(t.unit,function(t,n){if(n>1||!e(t))throw new Error("Not applicable");t.guide=t.guide||{};var u=t.guide,s=u.padding||{l:0,r:0,t:0,b:0},c=u.paddingNoTicks||{l:0,b:0};return r.l+=s.l,r.r+=s.r,r.t+=s.t,r.b+=s.b,i.l+=c.l,i.b+=c.b,o.push(Object.assign({},r)),a.push(Object.assign({},i)),1===(t.units||[]).map(function(t){if(!e(t)&&0!==t.type.indexOf("ELEMENT."))throw new Error("Not applicable");return t}).filter(e).length},function(t){var e=o.pop(),u=a.pop(),s=t.guide||{};s.x=s.x||{},s.x.padding=s.x.padding||0,s.x.paddingNoTicks=s.x.paddingNoTicks||0,s.y=s.y||{},s.y.padding=s.y.padding||0,s.y.paddingNoTicks=s.y.paddingNoTicks||0,s.padding={l:n(t.y),r:n(1),t:n(1),b:n(t.x)},s.paddingNoTicks={l:0,b:0},s.autoLayout="extract-axes",s.x.padding+=r.b-e.b,s.y.padding+=r.l-e.l,s.x.paddingNoTicks+=i.b-u.b,s.y.paddingNoTicks+=i.l-u.l}),t.unit.guide.padding=r,t.unit.guide.paddingNoTicks=i},t}(),Qn=function(){function t(t){var e=void 0===t?{}:t,n=e.src,r=void 0===n?null:n,i=e.timeout,o=void 0===i?Number.MAX_SAFE_INTEGER:i,a=e.syncInterval,u=void 0===a?Number.MAX_SAFE_INTEGER:a,s=e.callbacks,c=void 0===s?{}:s,l=this;this.setTimeoutDuration(o),this.setSyncInterval(u),this.setCallbacks(c),this._running=!1,this._queue=[],this._result=r,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=function(){if(l._running&&l._requestedFrameId){var t=l._getCancelFrameFunction(),e=l._getRequestFrameFunction();t(l._requestedFrameId),l._requestedFrameId=e(l._requestedFrameCallback)}},this._tasksCount=0,this._finishedTasksCount=0}return t.prototype.setTimeoutDuration=function(e){t.checkType(e,"number","timeout"),this._timeout=e},t.prototype.setSyncInterval=function(e){t.checkType(e,"number","syncInterval"),this._syncInterval=e},t.prototype.setCallbacks=function(e){t.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)},t.prototype.addTask=function(t){return this._queue.push(t),this._tasksCount++,this},t.prototype.run=function(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,t.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()},t.prototype.isRunning=function(){return this._running},t.prototype._loopTasks=function(){for(var e,n,r,i,o=0,a=this._syncInterval/t.runnersInProgress;this._running&&!(r=this._asyncDuration>this._timeout)&&!(i=o>a)&&(e=this._queue.shift());){if(null===(n=this._runTask(e)))return;this._syncDuration+=n,this._asyncDuration+=n,o+=n}r&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!r&&i&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))},t.prototype._runTask=function(t){var e=performance.now();if(this._callbacks.error)try{this._result=t.call(null,this._result,this)}catch(t){return this.stop(),this._callbacks.error.call(null,t,this),null}else this._result=t.call(null,this._result,this);var n=performance.now()-e;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),n},t.prototype._requestFrame=function(){var t=this,e=performance.now(),n=function(){t._requestedFrameId=null;var n=performance.now();t._asyncDuration+=n-e,t._loopTasks()},r=this._getRequestFrameFunction();this._requestedFrameCallback=n,this._requestedFrameId=r(n)},t.prototype._getRequestFrameFunction=function(){var t=this;return document.hidden?function(e){return t._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})}:function(e){return t._requestedFrameType="animation",requestAnimationFrame(e)}},t.prototype._getCancelFrameFunction=function(){switch(this._requestedFrameType){case"animation":return function(t){return cancelAnimationFrame(t)};case"idle":return function(t){return window.cancelIdleCallback(t)}}},t.prototype.stop=function(){if(!this._running)throw new Error("Task Runner is already stopped");(this._running=!1,t.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId)&&(this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null)},t.checkType=function(t,e,n){if(typeof t!==e)throw new Error('Task Runner "'+n+'" property is not "'+e+'"')},t}();Qn.runnersInProgress=0;var tr=Qn,er=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nr=function(){return(nr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var l=c.findIndex(function(t){return t.closest.distance!==c[0].closest.distance||t.closest.secondaryDistance!==c[0].closest.secondaryDistance}),f=l<0?c:c.slice(0,l);if(1===f.length)o=f[0].closest.data,a=f[0].closest.node,u=f[0].unit;else{var d=f.reduce(function(t,e){return t+e.closest.x},0)/f.length,h=f.reduce(function(t,e){return t+e.closest.y},0)/f.length,p=Math.atan2(h-r,d-n)+Math.PI,g=Math.round((f.length-1)*p/2/Math.PI),m=f[g].closest;o=m.data,a=m.node,u=f[g].unit}}s.forEach(function(e){return e.unit.fire(i,{event:t,data:o,node:a,unit:u})})},e.prototype._initPointerEvents=function(){var t=this;this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);var e=rr.select(this._svg),n=this._liveSpec.settings.syncPointerEvents?function(t){return function(){return t(a.event)}}:function(e){return function(){var n=a.event;t._pointerAnimationFrameId&&"mousemove"!==n.type&&t._cancelPointerAnimationFrame(),t._pointerAnimationFrameId||(t._pointerAnimationFrameId=requestAnimationFrame(function(){t._pointerAnimationFrameId=null,e(n)}))}},r=function(e){return t._handlePointerEvent(e)};e.on("mousemove",n(r)),e.on("click",n(r)),e.on("mouseleave",n(function(e){"none"!==window.getComputedStyle(t._svg).pointerEvents&&t.select(function(){return!0}).forEach(function(t){return t.fire("data-hover",{event:e,data:null,node:null,unit:null})})}))},e.prototype._cancelPointerAnimationFrame=function(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null},e.prototype._setupTaskRunner=function(t){var e=this;return this._resetTaskRunner(),this._taskRunner=new tr({timeout:t.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:t.settings.asyncRendering?t.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:function(){e._completeRendering(),e._renderingPhase=null},timeout:function(t,n){e._displayTimeoutWarning({timeout:t,proceed:function(){e.disablePointerEvents(),n.setTimeoutDuration(Number.MAX_SAFE_INTEGER),n.run()},cancel:function(){e._cancelRendering()}}),e.enablePointerEvents(),e.fire("renderingtimeout",t)},progress:function(t){var n={spec:0,draw:1}[e._renderingPhase]/2+t/2;e._reportProgress(n)},error:t.settings.handleRenderingErrors?function(n){e._cancelRendering(),e._displayRenderingError(n),e.fire("renderingerror",n),t.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',"Error message: "+n.message].join(" "),"ERROR")}:null}}),this._taskRunner},e.prototype._resetTaskRunner=function(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)},e.prototype.renderTo=function(t,e){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(t,e);var n=this._createLiveSpec();if(!n)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(n),i=this._setupTaskRunner(n);this._scheduleDrawScenario(i,r),this._scheduleDrawing(i,r),i.run()},e.prototype._insertLayout=function(t,e){this._target=t,this._defaultSize=Object.assign({},e);var n=rr.select(t).node();if(null===n)throw new Error("Target element not found");this._layout.layout.parentNode!==n&&n.appendChild(this._layout.layout);var r=this._layout.content,i=ye(this._layout.contentContainer);this._layout.contentContainer.style.padding="0 "+i.width+"px "+i.height+"px 0",ve(this._layout.rightSidebarContainer,"vertical");var o=Object.assign({},e)||{};if(!o.width||!o.height){var a=r.parentElement,u=a.scrollLeft,s=a.scrollTop;r.style.display="none",o=Zt(o,we(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=u,r.parentElement.scrollTop=s,o.height||(o.height=we(this._layout.layout).height)}this.configGPL.settings.size=o},e.prototype._createLiveSpec=function(){var t=this;return this._liveSpec=Et(Qt(this.configGPL,"plugins")),this._liveSpec.sources=this.getDataSources(),this._liveSpec.settings=this.configGPL.settings,this._experimentalSetupAnimationSpeed(this._liveSpec),this.isEmptySources(this._liveSpec.sources)?null:(this._liveSpec=this.transformers.reduce(function(e,n){return new n(e).transform(t)},this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)},e.prototype._experimentalSetupAnimationSpeed=function(t){t.settings.initialAnimationSpeed=t.settings.initialAnimationSpeed||t.settings.animationSpeed;var e=t.settings.experimentalShouldAnimate(t)?t.settings.initialAnimationSpeed:0;t.settings.animationSpeed=e;var n=function(t){t.guide=t.guide||{},t.guide.animationSpeed=e,t.units&&t.units.forEach(n)};n(t.unit)},e.prototype._createGPL=function(t){var e=new qe(t,this.getScaleFactory(),nn,O),n=e.unfoldStructure();return this.onUnitsStructureExpanded(n),e},e.prototype._scheduleDrawScenario=function(t,e){var n=this,r=rr.select(this._layout.content),i=e.config.settings.size;t.addTask(function(){return n._renderingPhase="spec"}),e.getDrawScenarioQueue({allocateRect:function(){return{slot:function(t){return r.selectAll(".uid_"+t)},frameId:"root",left:0,top:0,width:i.width,containerWidth:i.width,height:i.height,containerHeight:i.height}}}).forEach(function(e){return t.addTask(e)})},e.prototype._scheduleDrawing=function(t,e){var n=this,r=e.config.settings.size;t.addTask(function(t){n._renderingPhase="draw",n._renderRoot({scenario:t,newSize:r}),n._cancelPointerAnimationFrame(),n._scheduleRenderScenario(t)})},e.prototype._resetProgressLayout=function(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()},e.prototype._renderRoot=function(t){var e=this,n=t.scenario,r=t.newSize,i=rr.select(this._layout.content),o=n[0].config.uid,a=ir(i,"svg").attr("width",Math.floor(r.width)).attr("height",Math.floor(r.height));a.attr("class")||a.attr("class",Xe+"svg"),this._svg=a.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var u=a.selectAll("g.frame-root").data([o],function(t){return t});u.enter().append("g").classed(Xe+"cell cell frame-root uid_"+o,!0).merge(u).call(function(t){t.classed("tau-active",!0),nt(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),u.exit().call(function(t){t.classed("tau-active",!1),nt(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})},e.prototype._scheduleRenderScenario=function(t){var e=this;t.forEach(function(t){e._taskRunner.addTask(function(){t.draw(),e.onUnitDraw(t.node()),e._renderedItems.push(t)})})},e.prototype._completeRendering=function(){ve(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=this._liveSpec.settings.size.height+"px",this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),ve(this._layout.rightSidebarContainer,"vertical")},e.prototype._cancelRendering=function(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()},e.prototype._createProgressBar=function(){var t=rr.select(this._layout.header),e=ir(t,"div."+Xe+"progress");e.select("div."+Xe+"progress__value").remove();var n=e.append("div").classed(Xe+"progress__value",!0).style("width",0);this._reportProgress=function(t){requestAnimationFrame(function(){e.classed(Xe+"progress_active",t<1),n.style("width",100*t+"%")})}},e.prototype._displayRenderingError=function(t){this._layout.layout.classList.add(Xe+"layout_rendering-error")},e.prototype._clearRenderingError=function(){this._layout.layout.classList.remove(Xe+"layout_rendering-error")},e.prototype.getScaleFactory=function(t){return void 0===t&&(t=null),new un(an.instance(this._liveSpec.settings),t||this._liveSpec.sources,this._liveSpec.scales)},e.prototype.getScaleInfo=function(t,e){return void 0===e&&(e=null),this.getScaleFactory().createScaleInfoByName(t,e)},e.prototype.getSourceFiltersIterator=function(t){var e=this,n=Yt(Object.keys(this._filtersStore.filters).map(function(t){return e._filtersStore.filters[t]})).filter(function(e){return!t(e)}).map(function(t){return t.predicate});return function(t){return n.reduce(function(e,n){return e&&n(t)},!0)}},e.prototype.getDataSources=function(t){var e=this;void 0===t&&(t={});var n=this._chartDataModel(this._originData);return Object.keys(n).filter(function(t){return"?"!==t}).reduce(function(r,i){var o=n[i],a=e.getSourceFiltersIterator(function(e){return function(n){return t.excludeFilter&&-1!==t.excludeFilter.indexOf(n.tag)||n.src!==e}}(i));return r[i]={dims:o.dims,data:o.data.filter(a)},r},{"?":n["?"]})},e.prototype.isEmptySources=function(t){return!Object.keys(t).filter(function(t){return"?"!==t}).filter(function(e){return t[e].data.length>0}).length},e.prototype.getChartModelData=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="/"),this.getDataSources(t)[e].data},e.prototype.getDataDims=function(t){return void 0===t&&(t="/"),this._originData[t].dims},e.prototype.getData=function(t){return void 0===t&&(t="/"),this._originData[t].data},e.prototype.setData=function(t,e){void 0===e&&(e="/"),this._originData[e].data=t,this.refresh()},e.prototype.getSVG=function(){return this._svg},e.prototype.addFilter=function(t){t.src=t.src||"/";var e=t.tag,n=this._filtersStore.filters[e]=this._filtersStore.filters[e]||[],r=this._filtersStore.tick++;return t.id=r,n.push(t),r},e.prototype.removeFilter=function(t){var e=this;return Object.keys(this._filtersStore.filters).map(function(n){e._filtersStore.filters[n]=e._filtersStore.filters[n].filter(function(e){return e.id!==t})}),this},e.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},e.prototype.resize=function(t){void 0===t&&(t={}),this.renderTo(this._target,t)},e.prototype.select=function(t){return this._nodes.filter(t)},e.prototype.traverseSpec=function(t,e){var n=function(t,e,r,i){e(t,r,i),t.frames?t.frames.forEach(function(r){(r.units||[]).map(function(i){return n(i,e,t,r)})}):(t.units||[]).map(function(r){return n(r,e,t,null)})};n(t.unit,e,null,null)},e.prototype.getSpec=function(){return this._liveSpec},e.prototype.getLayout=function(){return this._layout},e.prototype._displayTimeoutWarning=function(t){var e=this,n=t.proceed,r=t.cancel,i=t.timeout,o=Math.round(100/3/1.5),a=function(t){return Math.round(100/3/1.5*t)};this._layout.content.style.height="100%",this._layout.content.insertAdjacentHTML("beforeend",'\n
\n \n \n Rendering took more than '+Math.round(i)/1e3+'s\n Would you like to continue?\n \n \n Continue\n \n \n Cancel\n \n \n
\n '),this._layout.content.querySelector("."+Xe+"rendering-timeout-continue-btn").addEventListener("click",function(){e._clearTimeoutWarning(),n.call(e)}),this._layout.content.querySelector("."+Xe+"rendering-timeout-cancel-btn").addEventListener("click",function(){e._clearTimeoutWarning(),r.call(e)})},e.prototype._clearTimeoutWarning=function(){var t=or(this._layout.content,"."+Xe+"rendering-timeout-warning");t&&(this._layout.content.removeChild(t),this._layout.content.style.height="")},e}(h),ur={},sr={},cr=function(t){var e="Chart type "+t+" is not supported.";throw console.log(e),console.log("Use one of "+Object.keys(ur).join(", ")+"."),new _(e,S.NOT_SUPPORTED_TYPE_CHART)},lr={validate:function(t,e){return sr.hasOwnProperty(t)||cr(t),sr[t].reduce(function(t,n){return t.concat(n(e)||[])},[])},get:function(t){var e=ur[t];return"function"!=typeof e&&cr(t),e},add:function(t,e,n){return void 0===n&&(n=[]),ur[t]=e,sr[t]=n,lr},getAllRegisteredTypes:function(){return ur}},fr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dr=function(t){function e(n){var r=t.call(this,n)||this;return n.autoResize&&e.winAware.push(r),r}return fr(e,t),e.prototype.applyConfig=function(e){var n=lr.validate(e.type,e);if(n.length>0)throw new Error(n[0]);var r=lr.get(e.type);(e=Zt(e,{autoResize:!0})).settings=ar.setupSettings(e.settings),e.dimensions=ar.setupMetaInfo(e.dimensions,e.data),t.prototype.applyConfig.call(this,r(e))},e.prototype.destroy=function(){var n=e.winAware.indexOf(this);-1!==n&&e.winAware.splice(n,1),t.prototype.destroy.call(this)},e}(ar);function hr(t){return t}dr.winAware=[],dr.resizeOnWindowEvent=function(){var t;function e(){t=0;for(var e=0,n=dr.winAware.length;ex&&x>2&&b.length>2;)b=n.ticks(--x)}else b=n.domain();r.hideTicks&&(b=l?b.filter(function(t){return 0==t}):[]);var w=null==u?n.tickFormat?n.tickFormat(a):hr:u,_=Math.max(s,0)+c,S=n.range(),M=S[0]+.5,O=S[S.length-1]+.5,A=(n.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return t(n)+e}}:hr)(n);if(r.facetAxis){var k=A;A=function(t){return k(t)-n.stepSize(t)/2}}var E,T=o.selection?o:null,C=T?T.selection():o,N=function(t){for(var e=t.node();e&&"svg"!==e.tagName;)e=e.parentNode;return e}(C).getBoundingClientRect();function L(t){var n=Ut(r.rotate);if(t.attr("transform",Le(n)),Math.abs(n/90)%2>0){var i=n<180?1:-1,o=h?.5:-2,a=e===yr.top||e===yr.left?-1:1,u=o*(e===yr.top||e===yr.bottom?a<0?0:.71:.32);t.attr("x",9*i).attr("y",0).attr("dx",h?null:u+"em").attr("dy",u+"em")}}function j(t,e){void 0===e&&(e=0);var i=function(t){return Math.max(n.stepSize(t),r.tickFormatWordWrapLimit,e)};r.tickFormatWordWrap?et(t,i,r.tickFormatWordWrapLines,r.tickFontHeight,!h):tt(t,i)}function P(t){!function(t,e){var n=e?-10:20,r=e?0:1,i=e?1:-1,o=[];t.each(function(){var t=Z.select(this),e=t.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],n=i*parseFloat(e),a=t.select("text"),u=a.node().getBBox().width/2,s=n-u,c=n+u;o.push({c:n,s:s,e:c,l:0,textRef:a,tickRef:t})});var a,u=o.sort(function(t,e){return t.c-e.c});a=function(t,r,i){var o,a,u,s=t.e>r.s,c=i.s1&&(f=f.replace(/([\.]*$)/gi,"")+"...");var d=11*r.l,h=e?parseFloat(r.textRef.attr("y"))+d:0,p=e?0:d,g=e?d:0,m=function(t){var e=0;if(!t)return e;var n=t.indexOf("rotate(");if(n>=0){var r=t.indexOf(")",n+7),i=t.substring(n+7,r);e=parseFloat(i.trim())}return e}(r.textRef.attr("transform"));r.textRef.text(function(t,e){return 0===e?f:""}).attr("transform","translate("+p+","+g+") rotate("+m+")");var y={x1:0,x2:0,y1:h+(e?-1:5),y2:n};e||(y.transform="rotate(-90)"),Oe(r.tickRef,"line.label-ref").call(lt(y))}else r.tickRef.selectAll("line.label-ref").remove();return r},u.map(function(t,e,n){return a(n[e-1]||{e:-1/0,s:-1/0,l:0},t,n[e+1]||{e:1/0,s:1/0,l:0})})}(t,h)}C.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===yr.right?"start":e===yr.left?"end":"middle"),l||(E=r.hideTicks||r.hide?[]:[null],le(C.selectAll(".domain").data(E)).then(function(t){return T&&t.exit().transition(T).attr("opacity",0).remove(),t.merge(t.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000"))}).then(function(t){return T?t.transition(T):t}).then(function(t){t.attr("d",e===yr.left||e==yr.right?"M"+p*s+","+M+"H0.5V"+O+"H"+p*s:"M"+M+","+p*s+"V0.5H"+O+"V"+p*s)}));var F=le(C.selectAll(".tick").data(b,function(t){return String(n(t))}).order()).then(function(t){var e=t.exit(),n=t.enter().append("g").attr("class","tick");return{tickExit:e,tickEnter:n,tick:t.merge(n)}}).then(function(t){if(f){var e=n.ticks(),r=n.domain(),i=b.length-1,o=e.length>1&&r[0]*r[1]<0&&-r[0]>(e[1]-e[0])/2&&r[1]>(e[i]-e[i-1])/2;t.tick.classed("zero-tick",function(t){return 0==t&&o})}return t}).result();!function(t){le(t).then(function(t){var e=t.tickEnter,n=t.tickExit,r=t.tick;return T?(e.attr("opacity",pr).attr("transform",function(t){var e=A(t);return y(e)}),{tick:r.transition(T),tickExit:n.transition(T).attr("opacity",pr).attr("transform",function(t){var e=A(t);return isFinite(e)?y(e):this.getAttribute("transform")})}):{tick:r,tickExit:n}}).then(function(t){var e=t.tick;t.tickExit.remove(),e.attr("opacity",1).attr("transform",function(t){return y(A(t))})})}(F),r.facetAxis||function(t){var e=p*s,r=d?function(t){return v*n.stepSize(t)/2}:null;le(t).then(function(t){var n=t.tick,i=t.tickEnter,o=n.select("line"),a=i.append("line").attr("stroke","#000").attr(m+"2",e);return d&&a.attr(g+"1",r).attr(g+"2",r),o.merge(a)}).then(function(t){return T?t.transition(T):t}).then(function(t){t.attr(m+"2",e),d&&t.attr(g+"1",r).attr(g+"2",r)})}(F),d&&l&&d&&b&&b.length&&le(C.selectAll(".extra-tick-line").data([null])).then(function(t){return t.merge(t.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))}).then(function(t){return T?t.transition(T):t}).then(function(t){t.attr(g+"1",M).attr(g+"2",M).attr(m+"1",0).attr(m+"2",p*s)}),l||(function(i){var o=r.textAnchor,a=p*_,u=e===yr.top?"0em":e===yr.bottom?"0.71em":"0.32em";function s(e){if(r.facetAxis)return e.attr("dx",18-t.position[0]).attr("dy",16)}le(i).then(function(t){var e=t.tick,n=t.tickEnter,r=e.select("text"),i=n.append("text").attr("fill","#000").attr(m,a).attr("dy",u);return L(i),s(i),r.merge(i)}).then(function(t){if(t.text(w).attr("text-anchor",o),!1===h&&!0===r.facetAxis){var e=Pe(C.node().parentNode.getAttribute("transform"));j(t,N.width-Math.abs(e.x))}else j(t);return h&&"time"===n.scaleType&&function(t){if(!(b.length<2)){var e=0,n=-1,r=t.nodes();r.forEach(function(t,r){var i=t.textContent||"",o=i.length;o>e&&(e=o,n=r)});var i=A(b[1])-A(b[0]),o=!1;if(n>=0){var a=r[n].getBoundingClientRect();o=i-a.width<8}C.classed(Xe+"time-axis-overflow",o)}}(t),!h||"time"!==n.scaleType&&"linear"!==n.scaleType||function(t){if(0!==b.length){var e=b[0],n=b[b.length-1],r=C.append("line").attr("x1",A(e)).attr("x2",A(e)).attr("y1",0).attr("y2",1),i=C.append("line").attr("x1",A(n)).attr("x2",A(n)).attr("y1",0).attr("y2",1),o={left:r.node().getBoundingClientRect().left-N.left,right:N.right-i.node().getBoundingClientRect().right};r.remove(),i.remove();var a=function(t,e,n){var r=t.getBoundingClientRect(),i=e>0?"right":"left",a=(A(n),o[i]),u=Math.ceil(r.width/2-a+1);t.setAttribute("dx",String(u>0?-e*u:0))},u=t.filter(function(t){return t===e}).node(),s=t.filter(function(t){return t===n}).node();t.attr("dx",null),a(u,-1,e),a(s,1,n)}}(t),t}).then(function(t){return T?t.transition(T):t}).then(function(t){t.attr(m,a),L(t),s(t),d&&r.avoidCollisions&&!r.facetAxis&&(T?T.on("end.fixTickTextCollision",function(){return P(i.tick)}):P(i.tick))})}(F),i.hide||function(){var t=i,e=Oe(C,"text.label").attr("class",Te("label",t.cssClass)).attr("transform",Le(t.rotate)).attr("text-anchor",t.textAnchor);le(e).then(function(t){return T?t.transition(T):t}).then(function(e){var n=v*t.padding,r=Math.abs(O-M),i=h?r:0;e.attr("x",i).attr("y",n).attr("text-anchor","end")});for(var n=t.text.split(" → "),r=n.length-1;r>0;r--)n.splice(r,0," → ");e.selectAll("tspan").data(n).enter().append("tspan").attr("class",function(t,e){return e%2?"label-token-delimiter label-token-delimiter-"+e:"label-token label-token-"+e}).text(function(t){return t}).exit().remove()}())}}function br(t){return vr({scale:t.scale,scaleGuide:t.scaleGuide,ticksCount:t.ticksCount,tickSize:t.tickSize,gridOnly:!0,position:t.position})}var xr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),wr=Oe,_r=function(t){var e=t<=20?1:.75;return Math.max(2,Math.round(t*e))},Sr=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Zt(n.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),n.config.guide.x=n.config.guide.x||{},n.config.guide.x=Zt(n.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.x.label&&(n.config.guide.x.label={text:n.config.guide.x.label}),n.config.guide.x.label=Zt(n.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),n.config.guide.y=n.config.guide.y||{},n.config.guide.y=Zt(n.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.y.label&&(n.config.guide.y.label={text:n.config.guide.y.label}),n.config.guide.y.label=Zt(n.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var r=n.config,i=r.guide;if("extract-axes"===i.autoLayout){var o=r.options.containerHeight-(r.options.top+r.options.height);i.x.hide=i.x.hide||Math.floor(o)>0,i.y.hide=i.y.hide||Math.floor(r.options.left)>0}var a=n.config.options,u=n.config.guide.padding;return n.L=a.left+u.l,n.T=a.top+u.t,n.W=a.width-(u.l+u.r),n.H=a.height-(u.t+u.b),n}return xr(e,t),e.prototype.defineGrammarModel=function(t){var e=this.W,n=this.H;return this.xScale=t("pos",this.config.x,[0,e]),this.yScale=t("pos",this.config.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n]:[n,0]}),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:function(){return e/2},yi:function(){return n/2},sizeX:function(){return e},sizeY:function(){return n}}},e.prototype.getGrammarRules=function(){return[function(t){var e=t.scaleX,n=t.scaleY;return{xi:function(n){return n?e(n[e.dim]):t.xi(n)},yi:function(e){return e?n(e[n.dim]):t.yi(e)},sizeX:function(n){return n?e.stepSize(n[e.dim]):t.sizeX(n)},sizeY:function(e){return e?n.stepSize(e[n.dim]):t.sizeY(e)}}}]},e.prototype.createScreenModel=function(t){return t},e.prototype.allocateRect=function(t){var e=this,n=this.screenModel;return{slot:function(t){return e.config.options.container.selectAll(".uid_"+t)},left:n.xi(t)-n.sizeX(t)/2,top:n.yi(t)-n.sizeY(t)/2,width:n.sizeX(t),height:n.sizeY(t),containerWidth:this.W,containerHeight:this.H}},e.prototype.drawFrames=function(t){var e=Object.assign({},this.config),n=e.options,r=this.W,i=this.H;if(e.x=this.xScale,e.y=this.yScale,e.x.scaleObj=this.xScale,e.y.scaleObj=this.yScale,e.x.guide=e.guide.x,e.y.guide=e.guide.y,e.x.guide.label.size=r,e.y.guide.label.size=i,(n.container.attr("transform")?nt(n.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):n.container).attr("transform",Ne(this.L,this.T)),e.x.guide.hide)this._removeDimAxis(n.container,e.x);else{var o="top"===e.x.guide.scaleOrient?[0,0-e.guide.x.padding]:[0,i+e.guide.x.padding];this._drawDimAxis(n.container,e.x,o,r)}if(e.y.guide.hide)this._removeDimAxis(n.container,e.y);else{var a="right"===e.y.guide.scaleOrient?[r+e.guide.y.padding,0]:[0-e.guide.y.padding,0];this._drawDimAxis(n.container,e.y,a,i)}var u=t.reduce(function(t,e){return t.concat((e.units||[]).map(function(t){return t.uid}))},[]),s=this._drawGrid(n.container,e,r,i,n),c=st(s,".cell").data(u,function(t){return t});c.enter().append("g").attr("class",function(t){return Xe+"cell cell uid_"+t}).merge(c).classed("tau-active",!0),nt(c,this.config.guide.animationSpeed).attr("opacity",1),nt(c.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()},e.prototype._drawDimAxis=function(t,e,n,r){var i=On.get(e.guide.tickFormat,e.guide.tickFormatNullAlias),a=vr({scale:e.scaleObj,scaleGuide:e.guide,ticksCount:i?_r(r/e.guide.density):null,tickFormat:i||null,position:n}),u=this.config.guide.animationSpeed;wr(t,this._getAxisSelector(e)).classed("tau-active",!0).classed(e.guide.cssClass,!0).call(function(t){var e=nt(t,u,"axisTransition"),r=t.attr("transform");Ne.apply(o,n)!==r&&(r?e:t).attr("transform",Ne.apply(o,n)),e.call(a),e.attr("opacity",1)})},e.prototype._removeDimAxis=function(t,e){var n=st(t,this._getAxisSelector(e)).classed("tau-active",!1);nt(n,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()},e.prototype._getAxisSelector=function(t){return"g."+("h"===je(t.guide.scaleOrient)?"x":"y")+".axis"},e.prototype._drawGrid=function(t,e,n,r){var i=this;return wr(t,"g.grid").attr("transform",Ne(0,0)).call(function(t){var o=t,a=i.config.guide.animationSpeed,u=(e.guide.showGridLines||"").toLowerCase();if(u.length>0){var s=wr(o,"g.grid-lines");if(u.indexOf("x")>-1){var c=e.x,l=On.get(c.guide.tickFormat),f=br({scale:c.scaleObj,scaleGuide:c.guide,tickSize:r,ticksCount:l?_r(n/c.guide.density):null}),d=wr(s,"g.grid-lines-x");nt(d,a).call(f)}if(u.indexOf("y")>-1){var h=e.y,p=(l=On.get(h.guide.tickFormat),br({scale:h.scaleObj,scaleGuide:h.guide,tickSize:-n,ticksCount:l?_r(r/h.guide.density):null})),g=wr(s,"g.grid-lines-y");nt(g,a).call(p)}}})},e}(m),Mr=n(11),Or=n(8),Ar=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),kr=function(){return(kr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n})}else{var o=n[t].map(r[t].invert);e=[o[0],o[1]]}return{dim:r[t].dim,func:r[t].discrete?"inset":"between",args:e}});e.fire("brush",u)}};return t.selectAll(".brush").remove(),t.append("g").attr("class","brush").each(function(t){var e=r[t].range();i[t]=Er.brushY().extent([[0,e[0]],[16,e[1]]]).on("start",u).on("brush",c).on("end",s),Er.select(this).classed("brush-"+Ft(t),!0).call(i[t]),o=!1,i[t].move(Er.select(this),e),o=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),t},e.prototype._forceBrushing=function(t){void 0===t&&(t={});var e=this.columnsBrushes,n=this.columnsScalesMap;this.columnsSelections;Object.keys(t).filter(function(r){return e[r]&&n[r]&&t[r]}).forEach(function(r){var i=t[r],o=[];if(n[r].discrete){var a=i.map(n[r]).filter(function(t){return t>=0}),u=n[r].stepSize()/2;o=[Math.min.apply(Math,a)-u,Math.max.apply(Math,a)+u]}else o=[i[0],i[1]];var s=Ft(r);e[r](Er.select(".brush-"+s)),e[r].move(Er.select(".brush-"+s),o.map(n[r]))})},e}(m),Cr=n(12);var Nr=n(4),Lr=function(){var t,e=[],n=[],r=1,i=1,o={},a=!1,u=function(t){var r=e.length,i=0,o=e[t].x-n[t].x,a=n[t].y-e[t].y,u=Math.sqrt(o*o+a*a);u>0&&(i+=.2*u),a/=u,i+=(o/=u)>0&&a>0?0:o<0&&a>0?3:o<0&&a<0?6:9;for(var s,c,f,d,h=e[t].x,p=e[t].y-e[t].height+2,g=e[t].x+e[t].width,m=e[t].y+2,y=0;yr&&(e[c].x=l),e[c].x<0&&(e[c].x=l),e[c].y>i&&(e[c].y=f),e[c].y<0&&(e[c].y=f);var d=(a?t(c,e,n):u(c))-s;Math.random()r&&(e[c].x=l),e[c].x<0&&(e[c].x=l),e[c].y>i&&(e[c].y=f),e[c].y<0&&(e[c].y=f);var y=(a?t(c,e,n):u(c))-s;Math.random()1||c<0||c>1)},f=function(t,e,n){return t-e/n};return o.start=function(t){for(var n=e.length,r=1,i=0;i=200&&r.status<300){var t=r.responseText;try{n(null,JSON.parse(t))}catch(t){n(t,null)}}else n(new Error(r.status+": "+r.statusText),null)},r.onerror=function(t){n(t.error,null)},r.open("GET",e,!0),r.send(null)):this._drawMap(t,o.sourcemap)},e.prototype._calcLabels=function(t,e,n){var r=this.W,i=this.H,o={};return e.forEach(function(e){var a=(Nr.feature(t,t.objects[e]).features||[]).map(function(t){var i=t.properties||{},o=n.centroid(t),a=n.bounds(t),u=o[0],s=o[1],c=a[1][0]-a[0][0],l=i.name||"",f=i.abbr||l,d=c<5.5*l.length?f:l,h=c<13.75,p=h?r-u-16.5:0;return{id:e+"-"+t.id,sx:u,sy:s,x:u+p,y:s,width:5.5*d.length,height:10,name:d,r:p,isRef:h}}).filter(function(t){return!Number.isNaN(t.x)&&!Number.isNaN(t.y)}),u=a.map(function(t){return{x:t.sx,y:t.sy,r:t.r}});Lr().label(a).anchor(u).width(r).height(i).start(10),a.filter(function(t){return!t.isRef}).map(function(t){return t.x=t.sx,t.y=t.sy,t}).reduce(function(t,e){return t[e.id]=e,t},o);var s=a.filter(function(t){return t.isRef});s.length<6&&s.reduce(function(t,e){return t[e.id]=e,t},o)}),o},e.prototype._drawMap=function(t,e){var n,r,i=this,o=this,u=this.config.guide,s=this.config.options,c=this.config.options.container,l=this.latScale,f=this.lonScale,d=this.sizeScale,h=this.colorScale,p=this.codeScale,g=this.fillScale,m=this.W,y=this.H,v=zr.filter(function(t){return(e.objects||{}).hasOwnProperty(t)});if(0===v.length)throw new Error("Invalid map: should contain some contours");if(g.dim){if(!p.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===v.indexOf(p.georole))throw console.log('There is no contour for georole "'+p.georole+'"'),console.log("Available contours are: "+v.join(" | ")),new Error("Invalid [georole]");n=p.georole}else n=v[v.length-1];if(this.contourToFill=n,l.dim&&f.dim){var b=Fr.extent(l.domain()),x=Fr.extent(f.domain());r=[(x[1]+x[0])/2,(b[1]+b[0])/2]}var w=this._createProjection(e,v[0],r),_=Fr.geoPath().projection(w),S=c.selectAll(".map-container").data([""+m+y+r+v.join("-")],function(t){return t});S.exit().remove();var M=S.enter().append("g").call(function(t){var n=t;n.attr("class","map-container");var r={},i=v.reduceRight(function(t,e){return t.concat(e)},[]);if(u.showNames&&(r=o._calcLabels(e,i,_)),i.forEach(function(t,i){var o=function(e){return r[t+"-"+e.id]};n.selectAll(".map-contour-"+t).data(Nr.feature(e,e.objects[t]).features||[]).enter().append("g").call(function(e){var n=e;n.attr("class","map-contour-"+t+" map-contour-level map-contour-level-"+i).attr("fill","none"),n.append("title").text(function(t){return(t.properties||{}).name}),n.append("path").attr("d",_),n.append("text").attr("class","place-label-"+t).attr("transform",function(t){var e=o(t);return e?"translate("+[e.x,e.y]+")":""}).text(function(t){var e=o(t);return e?e.name:""}),n.append("line").attr("class","place-label-link-"+t).attr("stroke","gray").attr("stroke-width",.25).attr("x1",function(t){var e=o(t);return e&&e.isRef?e.sx:0}).attr("y1",function(t){var e=o(t);return e&&e.isRef?e.sy:0}).attr("x2",function(t){var e=o(t);return e&&e.isRef?e.x-.6*e.name.length*5.5:0}).attr("y2",function(t){var e=o(t);return e&&e.isRef?e.y-3.5:0})})}),e.objects.hasOwnProperty("places")){var a=Nr.feature(e,e.objects.places),s=a.features.map(function(t){var e=w(t.geometry.coordinates);return{x:e[0]+3.5,y:e[1]+3.5,width:5.5*t.properties.name.length,height:12,name:t.properties.name}}),c=a.features.map(function(t){var e=w(t.geometry.coordinates);return{x:e[0],y:e[1],r:2.5}});Lr().label(s).anchor(c).width(m).height(y).start(100),n.selectAll(".place").data(c).enter().append("circle").attr("class","place").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("r",function(t){return t.r+"px"}),n.selectAll(".place-label").data(s).enter().append("text").attr("class","place-label").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).text(function(t){return t.name})}}).merge(S);this.groupByCode=t.reduce(function(t,e){return e.part().reduce(function(t,e){return t[(e[p.dim]||"").toLowerCase()]=e,t},t)},{});var O=this._resolveFeature.bind(this);if(M.selectAll(".map-contour-"+n).data(Nr.feature(e,e.objects[n]).features).call(function(t){t.classed("map-contour",!0).attr("fill",function(t){var e=O(t);return null===e?u.defaultFill:g(e[g.dim])})}).on("mouseover",function(t){return i.fire("area-mouseover",{data:O(t),event:a.event})}).on("mouseout",function(t){return i.fire("area-mouseout",{data:O(t),event:a.event})}).on("click",function(t){return i.fire("area-click",{data:O(t),event:a.event})}),!l.dim||!f.dim)return[];var A=function(t){return t.attr("r",function(t){return d(t[d.dim])}).attr("transform",function(t){var e=t.data;return"translate("+w([e[f.dim],e[l.dim]])+")"}).attr("class",function(t){var e=t.data;return h(e[h.dim])}).attr("opacity",.5).on("mouseover",function(t){var e=t.data;return o.fire("point-mouseover",{data:e,event:a.event})}).on("mouseout",function(t){var e=t.data;return o.fire("point-mouseout",{data:e,event:a.event})}).on("click",function(t){var e=t.data;return o.fire("point-click",{data:e,event:a.event})})},k=M.selectAll(".frame").data(t.map(function(t){return{tags:t.key||{},hash:t.hash(),data:t.part()}}),function(t){return t.hash});return k.exit().remove(),k.enter().append("g").merge(k).call(function(t){t.attr("class",function(t){return"frame frame-"+t.hash}).call(function(t){var e=t.selectAll("circle").data(function(t){return t.data.map(function(t){return{data:t,uid:s.uid}})});e.exit().remove(),e.call(A),e.enter().append("circle").call(A)})}),[]},e.prototype._resolveFeature=function(t){var e,n=this.groupByCode,r=t.properties,i=["c1","c2","c3","abbr","name"].filter(function(t){return r.hasOwnProperty(t)&&r[t]&&n.hasOwnProperty(r[t].toLowerCase())});if(0===i.length)e=null;else if(i.length>0){var o=r[i[0]].toLowerCase();e=n[o]}return e},e.prototype._highlightArea=function(t){var e=this,n=this.config.options.container,r=this.contourToFill;n.selectAll(".map-contour-"+r).classed("map-contour-highlighted",function(n){return t(e._resolveFeature(n))})},e.prototype._highlightPoint=function(t){this.config.options.container.selectAll("circle").classed("map-point-highlighted",function(e){var n=e.data;return t(n)}).attr("opacity",function(e){var n=e.data;return t(n)?.5:.1})},e.prototype._createProjection=function(t,e,n){var r=this.W,i=this.H,o=this.config.guide,a=100,u=[r/2,i/2],s=n||t.center,c=o.projection||t.projection||"mercator",l=this._createD3Projection(c,s,a,u),f=Fr.geoPath().projection(l).bounds(Nr.feature(t,t.objects[e])),d=a*r/(f[1][0]-f[0][0]),h=a*i/(f[1][1]-f[0][1]);return a=d=0},qr=function(t,e){return!t.discrete&&e[t.dim]<0},Xr=function(t,e){return t.w(e)/2+Math.floor(t.model.size(e)/Ur(t,e))},Yr=function(t,e){return t.h(e)/2+Math.floor(t.model.size(e)/Ur(t,e))},Vr=function(t){return function(e){return{dx:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Gr(r,n))return e.dx(n);if("-"===t[2]&&!qr(r,n))return e.dx(n);var i=t[1],o=t[0]===t[0].toUpperCase()?1:0;return e.dx(n)+i*o*e.model.size(n)/2+i*Xr(e,n)}}}},$r=function(t){return function(e){return{dy:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Gr(r,n))return e.dy(n);if("-"===t[2]&&!qr(r,n))return e.dy(n);var i=t[1],o=t[0]===t[0].toUpperCase()?1:0;return e.dy(n)+i*o*e.model.size(n)/2+i*Yr(e,n)}}}};Wr.regRule("l",Vr(["l",-1,null])).regRule("L",Vr(["L",-1,null])).regRule("l+",Vr(["l",-1,"+"])).regRule("l-",Vr(["l",-1,"-"])).regRule("L+",Vr(["L",-1,"+"])).regRule("L-",Vr(["L",-1,"-"])).regRule("r",Vr(["r",1,null])).regRule("R",Vr(["R",1,null])).regRule("r+",Vr(["r",1,"+"])).regRule("r-",Vr(["r",1,"-"])).regRule("R+",Vr(["R",1,"+"])).regRule("R-",Vr(["R",1,"-"])).regRule("t",$r(["t",-1,null])).regRule("T",$r(["T",-1,null])).regRule("t+",$r(["t",-1,"+"])).regRule("t-",$r(["t",-1,"-"])).regRule("T+",$r(["T",-1,"+"])).regRule("T-",$r(["T",-1,"-"])).regRule("b",$r(["b",1,null])).regRule("B",$r(["B",1,null])).regRule("b+",$r(["b",1,"+"])).regRule("b-",$r(["b",1,"-"])).regRule("B+",$r(["B",1,"+"])).regRule("B-",$r(["B",1,"-"])).regRule("rotate-on-size-overflow",function(t,e){var n=e.data,r=e.lineBreakAvailable,i={};if(n.reduce(function(e,n){return e+(function(e){return t.model.size(e).5){var o=r?-.5:.5;i={angle:function(){return-90},w:function(e){return t.h(e)},h:function(e){return t.w(e)},dx:function(e){return t.h(e)*o-2},dy:function(){return 0}}}return i}).regRule("hide-by-label-height-vertical",function(t){return{hide:function(e){var n,r;return 0===t.angle(e)?(r=t.h(e),n=Math.abs(t.model.y0(e)-t.model.yi(e))):(r=t.w(e),n=t.model.size(e)),r>n||t.hide(e)}}}).regRule("cut-label-vertical",function(t){return{h:function(e){var n=t.h(e);if(Math.abs(t.angle(e))>0){var r=Math.abs(t.model.y0(e)-t.model.yi(e));return r0){var i=t.model.y0(e)=0?1:-1}(t,n)*e(t,n)};return t.model.flip?{dx:n}:{dy:n}}).regRule("inside-start-then-outside-end-horizontal",function(t,e){var n=[Wr.getRule("from-beginning"),Wr.getRule("towards"),Wr.getRule("cut-label-horizontal")].reduce(function(t,n){return Ir.compose(t,n(t,e))},t),r=[Wr.getRule("to-end"),Wr.getRule("towards"),Wr.getRule("cut-outer-label-horizontal")].reduce(function(t,n){return Ir.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("inside-start-then-outside-end-vertical",function(t,e){var n=[Wr.getRule("from-beginning"),Wr.getRule("towards"),Wr.getRule("cut-label-vertical")].reduce(function(t,n){return Ir.compose(t,n(t,e))},t),r=[Wr.getRule("to-end"),Wr.getRule("towards"),Wr.getRule("cut-outer-label-vertical")].reduce(function(t,n){return Ir.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("outside-then-inside-horizontal",function(t,e){var n=["r+","l-","cut-outer-label-horizontal"].map(Wr.getRule).reduce(function(t,n){return Ir.compose(t,n(t,e))},t),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(Wr.getRule).reduce(function(t,n){return Ir.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return r.label(t).length>n.label(t).length}(t)?r:n)[e](t)},t},{}))}).regRule("outside-then-inside-vertical",function(t,e){var n=["t+","b-","cut-outer-label-vertical"].map(Wr.getRule).reduce(function(t,n){return Ir.compose(t,n(t,e))},t),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(Wr.getRule).reduce(function(t,n){return Ir.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,i){return t[i]=function(t){return(function(t){var r=n.y(t,e)+n.dy(t,e);return r<=0||r>=e.maxHeight}(t)?r:n)[i](t,e)},t},{}))}).regRule("hide-by-label-height-horizontal",function(t){return{hide:function(e){return t.model.size(e)0)return r+a;var u=i+o/2-n;return u>0?r-u:r},dy:function(e){var n=t.dy(e),i=t.y(e)+n,o=t.h(e);if(0-(i-o/2)>0)return 0;var a=i+o/2-r;return a>0?n-a:n}}}).regRule("multiline-label-left-align",function(t){return{dy:function(e){var n=t.dy(e);return-90===t.angle(e)?n+t.h(e)/2:n}}}).regRule("multiline-label-vertical-center-align",function(t){return{dy:function(e){return t.dy(e)-t.h(e)/2}}}).regRule("multiline-hide-on-container-overflow",function(t,e){var n=e.maxWidth,r=e.maxHeight;return{hide:function(e){var i=t.angle(e),o=t.x(e)+t.dx(e),a=t.y(e)+t.dy(e);return!(!qt(o,t.w(e),i,n)&&!Xt(a,t.h(e),i,r))||t.hide(e)}}});var Jr=function(){function t(t){this.minError=Number.MAX_VALUE,this.items=t.items,this.revision=this.items.map(function(t){return{i:t.i,x:t.x,y:t.y}}),this.penalties=t.penalties,this.transactor=t.transactor,this.cooling_schedule=t.cooling_schedule||function(t,e,n){return t-e/n}}return t.prototype.energy=function(t){return this.penalties.reduce(function(e,n){return e+n(t)},0)},t.prototype.move=function(t){var e=Math.floor(Math.random()*this.items.length),n=this.transactor(this.items[e]),r=this.energy(e);this.items[e]=n.modify();var i=this.energy(e),o=i-r,a=o<0?1:Math.exp(-o/t);Math.random()>=a?this.items[e]=n.revert():i0&&d.length>0?this.autoPosition(l,d):l;var h=f.reduce(function(t,e){var n;return Object.assign(t,((n={})[e]=!0,n))},{});l.text=l.text=h["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(l.text,s):l.text,l.text=l.text=h["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(l.text,s):l.text,l.text=h["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(l.text,l.edges):l.text,l.text=h["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(l.text):l.text,l.text=h["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(l.text):l.text;var p=l.text,g=function(t){return function(e,n){return p[n][t]}},m=g("x"),y=g("y"),v=g("angle"),b=g("color"),x=g("label"),w=function(t){if(t.style("fill",b).style("font-size",e.guide.fontSize+"px").style("display",function(t,e){return p[e].hide?"none":null}).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",function(t,e){return"translate("+m(t,e)+","+y(t,e)+") rotate("+v(t,e)+")"}),i){t.each(function(t,e){var n=a.select(this),r=v(t,e);n.text(null),x(t,e).split(o).forEach(function(t,e){n.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(e+1)+"em").text(t)})})}else t.text(x)};r.hideEqualLabels&&p.filter(function(t){return!t.hide}).filter(function(t,e,n){return e0&&(t.hide=!0)}),t},t.prototype.hideOnLabelLabelOverlap=function(t){var e=this,n={min:0,max:1,norm:2},r={"min/min":function(t,e){return e.y-t.y},"max/max":function(t,e){return t.y-e.y},"min/max":function(){return-1},"min/norm":function(){return-1},"max/norm":function(){return-1},"norm/norm":function(t,e){return t.y-e.y}};return t.filter(function(t){return!t.hide}).sort(function(t,e){return n[t.extr]-n[e.extr]}).forEach(function(i){t.forEach(function(t){i.i!==t.i&&function(t,i){var o=e.getLabelRect(t),a=e.getLabelRect(i),u=Number(!t.hide&&!i.hide);if(u*Math.max(0,Math.min(a.x1,o.x1)-Math.max(o.x0,a.x0))*(u*Math.max(0,Math.min(a.y1,o.y1)-Math.max(o.y0,a.y0)))>0){var s=[t,i];s.sort(function(t,e){return n[t.extr]-n[e.extr]}),(r[s[0].extr+"/"+s[1].extr](s[0],s[1])<0?s[0]:s[1]).hide=!0}}(i,t)})}),t},t.prototype.getLabelRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.w/2-e,x1:t.x+t.w/2+e,y0:t.y-t.h/2-e,y1:t.y+t.h/2+e}},t.prototype.getPointRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.size/2-e,x1:t.x+t.size/2+e,y0:t.y-t.size/2-e,y1:t.y+t.size/2+e}},t.prototype.hideOnLabelAnchorOverlap=function(t){var e=this,n=function(t,n){var r=e.getLabelRect(t,2),i=e.getPointRect(n,2);return Math.max(0,Math.min(i.x1,r.x1)-Math.max(i.x0,r.x0))*Math.max(0,Math.min(i.y1,r.y1)-Math.max(i.y0,r.y0))>.001};return t.filter(function(t){return!t.hide}).forEach(function(e){for(var r=t.length,i=0;ir.right+s||ur.bottom+s)return null;var c=(i.find(a,u)||[]).map(function(t){var e=Math.sqrt(Math.pow(a-t.x,2)+Math.pow(u-t.y,2));if(e>s)return null;var n=ee.size)+" 1",n.left[0].x+","+n.left[0].y,"Z"].join(" "):di(t.size>e.size?t:e)}function pi(t,e,n,r){var i=function(t,e,n,r){var i=yi(t,r);if(0===i||i+t.size/2<=r.size/2||i+r.size/2<=t.size/2)return null;var o=function(i){var o=i?[r,n,e,t]:[t,e,n,r],a=bi.apply(void 0,[1/12*2].concat(o)),u=bi.apply(void 0,[.5].concat(a.slice(0,4))),s=u[3],c=u[6],l=wi(o[0],s),f=wi(s,c),d=[l.left[0],T(.5,l.left[1],f.left[0]),f.left[1]],h=[l.right[0],T(.5,l.right[1],f.right[0]),f.right[1]],p=xi.apply(void 0,d)[1],g=xi.apply(void 0,h)[1],m=T(4,l.left[0],p),y=T(4,l.right[0],g);return{left:i?[y,h[0]]:[d[0],m],right:i?[m,d[0]]:[h[0],y]}},a=o(!1),u=o(!0);return{left:a.left.concat(u.left),right:a.right.concat(u.right)}}(t,e,n,r);if(!i)return hi(t,r);var o=mi(gi(t,i.right[0]),gi(t,i.left[0])),a=mi(gi(r,i.right[1]),gi(r,i.left[1]));return["M"+i.left[0].x+","+i.left[0].y,"C"+i.left[1].x+","+i.left[1].y,i.left[2].x+","+i.left[2].y,i.left[3].x+","+i.left[3].y,"A"+r.size/2+","+r.size/2+" 0 "+Number(o>Math.PI)+" 1",i.right[3].x+","+i.right[3].y,"C"+i.right[2].x+","+i.right[2].y,i.right[1].x+","+i.right[1].y,i.right[0].x+","+i.right[0].y,"A"+t.size/2+","+t.size/2+" 0 "+Number(a>Math.PI)+" 1",i.left[0].x+","+i.left[0].y,"Z"].join(" ")}function gi(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function mi(t,e){return e1?[t]:[]},d);f.exit().remove(),f.call(u(n.animationSpeed,o.pathAttributesUpdateInit,o.pathAttributesUpdateDone,o.afterPathUpdate));f.enter().append(o.pathElement).call(u(n.animationSpeed,o.pathAttributesEnterInit,o.pathAttributesEnterDone,o.afterPathUpdate)).merge(f).call(function(t){e.guide.animationSpeed>0&&!document.hidden?(t.attr(o.pathTween.attr,function(t){return o.pathTween.fn.call(this,t)(0)}),nt(t,e.guide.animationSpeed,"pathTransition").attrTween(o.pathTween.attr,o.pathTween.fn)):t.attr(o.pathTween.attr,function(t){return o.pathTween.fn.call(this,t)(1)})});if(t.subscribe(l),"never"!==n.showAnchors){var h=function(t,e,n){var r=e.anchorShape,i=t.config.guide,o=t.screenModel,a=_i({},Si[r].getInitialAttrs(t,e),{opacity:"hover"===i.showAnchors?0:1,fill:function(t){return o.color(t)},class:"i-data-anchor"}),u=n.selectAll(".i-data-anchor").data(function(t){return t.filter(si)},o.id);return u.exit().remove(),u.call(ut(i.animationSpeed,null,a)),u.enter().append(Si[e.anchorShape].element).call(ut(i.animationSpeed,{r:0},a)).merge(u)}(t,o,r);t.subscribe(h)}},c=i.toFibers(),l=c.map(function(t){return t.filter(si)}),f=r.container.selectAll(".frame"),d=function(){var t=f.empty()?[]:f.data(),e=new Map;f.each(function(t){e.set(t,Number(this.getAttribute("data-id")))});var n=t.reduce(function(t,e){return t.set(e,e.map(i.id)),t},new Map),r=new Map,o=Math.max.apply(Math,[0].concat(Array.from(e.values())));return function(t){if(r.has(t))return r.get(t);var a,u=t.map(function(t){return i.id(t)}),s=(Array.from(n.entries()).find(function(t){var e=t[1];return u.some(function(t){return e.some(function(e){return e===t})})})||[null])[0];return a=s?e.get(s):++o,r.set(t,a),a}}();this._getDataSetId=d;var h=f.data(c,d);h.exit().remove(),h.call(s),h.enter().append("g").attr("data-id",d).call(s),h.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),t.subscribe(new ei(i.model,e.flip,e.guide.label,r).draw(l))},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=a.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n)}}).filter(function(t){return!isNaN(t.x)&&!isNaN(t.y)}),i=r.reduce(function(t,e){var n=e.x,r=e.y;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,t.top),t.bottom=Math.max(r,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Vt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),u=o.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=o.find(n?function(e){return t.y===e}:function(e){return t.x===e});u[e].push(t)});var s=function(t){if(1===t.length)return u[t[0]];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:s(t.slice(0,e)),greater:s(t.slice(e))}};return{bounds:i,tree:s(o)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,o=this.node().config.options.container,a=this.node().config.flip,u=ze(o.node()),s=this.node().config.guide.maxHighlightDistance;if(tr.right+u.x+s||er.bottom+u.y+s)return null;var c=a?e-u.y:t-u.x,l=function t(e){return Array.isArray(e)?e:t(c>e.middle?e.greater:e.lower)}(i).map(function(n){var r=n.x+u.x,i=n.y+u.y,o=Math.abs(a?e-i:t-r),s=Math.abs(a?t-r:e-i);return{node:n.node,data:n.data,distance:o,secondaryDistance:s,x:r,y:i}});return Mi(t,e,l)},highlight:function(t){var e,n,r=this.node().config.options.container,i="tau-chart__highlighted",o="tau-chart__dimmed",a=r.selectAll(".i-role-path"),u=a.data().filter(function(e){return e.filter(si).some(t)}),s=u.length>0;a.call(ft(((e={})[i]=function(t){return s&&u.indexOf(t)>=0},e[o]=function(t){return s&&u.indexOf(t)<0},e)));var c=((n={})[i]=function(e){return!0===t(e)},n[o]=function(e){return!1===t(e)},n);r.selectAll(".i-role-dot").call(ft(c)),r.selectAll(".i-role-label").call(ft(c)),this._sortElements(t)},highlightDataPoints:function(t){var e=this.node(),n=function(t,e,n){var r=e.anchorShape,i=t.screenModel,o="hover"===t.config.guide.showAnchors;return t.config.options.container.selectAll(".i-data-anchor").call(lt(Si[r].getHighlightAttrs(t,e,n))).attr("opacity",o?function(t){return n(t)?1:0}:function(){return 1}).attr("fill",function(t){return i.color(t)}).attr("class",function(t){return Te("i-data-anchor",i.class(t))}).classed(Xe+"highlighted",n)}(e,this.domElementModel,t),r=e.config.options.container,i=e.config.flip,o=n.filter(t),a=r.select(".cursor-line");if(o.empty())a.remove();else{a.empty()&&(a=r.append("line"));var u=e.screenModel.model,s=u.xi(o.data()[0]),c=u.xi(o.data()[0]),l=u.scaleY.domain(),f=u.scaleY(l[0]),d=u.scaleY(l[1]);a.attr("class","cursor-line").attr("x1",i?f:s).attr("y1",i?s:f).attr("x2",i?d:c).attr("y2",i?c:d)}this._sortElements(t)},_sortElements:function(t){var e=this.node().config.options.container,n=new Map,r=new Map,i=this._getDataSetId;e.selectAll(".i-role-path").each(function(e){n.set(this,i(e)),r.set(this,e.filter(si).some(t))});var o=ee(function(t,e){return r.get(t)-r.get(e)},function(t,e){return n.get(t)-n.get(e)}),a={line:0,g:1,text:2};Ee(e.node(),function(t,e){return"g"===t.tagName&&"g"===e.tagName?o(t,e):a[t.tagName]-a[e.tagName]})}},ki=[1,2,3,4,5],Ei=ki.map(function(t){return Xe+"line-opacity-"+t}),Ti=ki.map(function(t){return Xe+"line-width-"+t});function Ci(t){return Ei[t-1]||Ei[4]}function Ni(t,e){return t.length<2?"":String.prototype.concat.apply("",t.concat(e.slice().reverse()).map(function(t,e){return(0===e?"":" ")+t.x+","+t.y}))}function Li(t,e){if(t.length<2)return"";var n=function(t){var e=t.map(function(t,e){return""+((e-1)%3==0?"C":"")+t.x+","+t.y+" "});return String.prototype.concat.apply("",e)};return"M"+n(t)+"L"+n(e.slice().reverse())+"Z"}var ji=function(){return(ji=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&(n=Pi.rgb(n).darker(1)),n}};e.pathAttributesEnterInit=o,e.pathAttributesUpdateDone=o;var a="polyline"===J(n.interpolate);return e.pathElement=a?"polygon":"path",e.anchorShape="vertical-stick",e.pathTween={attr:a?"points":"d",fn:ct(0,a?Ni:Li,[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}},function(n){return{id:t.id(n),x:e.x0(n),y:e.y0(n)}}],t.id,n.interpolate)},e},_getBoundsInfo:function(t){if(0===t.length)return null;var e,n,r=this.node().screenModel,i=this.node().config.flip,o=t.map(function(t){var e=Pi.select(t).data()[0];return{node:t,data:e,x:r.x(e),y:r.y(e),y0:r.y0(e),group:r.group(e)}}),a=o.reduce(function(t,e){var n=e.x,r=e.y,i=e.y0;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,i,t.top),t.bottom=Math.max(r,i,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),u=Vt(o.map(i?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),s=u.reduce(function(t,e){return t[e]=[],t},{});if(o.forEach(function(t){var e=u.find(i?function(e){return t.y===e}:function(e){return t.x===e});s[e].push(t)}),e=Object.keys(o.reduce(function(t,e){return t[e.group]=!0,t},{})),n=e.reduce(function(t,e,n){return t[e]=n,t},{}),u.forEach(function(t){var r=s[t];if(r.sort(function(t,e){return n[t.group]-n[e.group]}),r.lengthr.right+u.x+s||er.bottom+u.y+s)return null;var c=a?e-u.y:t-u.x,l=function t(e){if(e.isLeaf)return e;var n=e.left.end;return t(c1&&(f=1);var d,h=(d=l.items.start.reduce(function(t,e){return t[e.group]={start:e,end:null,y:null,y0:null},t},{}),l.items.end.forEach(function(t){void 0!==d[t.group]?d[t.group].end=t:delete d[t.group]}),Object.keys(d).forEach(function(t){var e=d[t];e.end?(e.y=e.start.y+f*(e.end.y-e.start.y),e.y0=e.start.y0+f*(e.end.y0-e.start.y0)):delete d[t]}),Object.keys(d).map(function(t){return d[t]}).map(function(t){return{y:t.y,y0:t.y0,el:f<.5?t.start:t.end}}).filter(function(t){return null!=t.el.data})),p=e-u.y,g=h.filter(function(t){return p>=t.y&&p<=t.y0}),m=(g.length>0?g:h).map(function(t){return t.el}).map(function(n){var r=n.x+u.x,i=n.y+u.y,o=Math.abs(a?e-i:t-r),s=Math.abs(a?t-r:e-i);return{node:n.node,data:n.data,distance:o,secondaryDistance:s,x:r,y:i}});return Mi(t,e,m)}},zi={draw:Ai.draw,getClosestElement:Ai.getClosestElement,highlight:Ai.highlight,highlightDataPoints:Ai.highlightDataPoints,addInteraction:Ai.addInteraction,_getBoundsInfo:Ai._getBoundsInfo,_sortElements:Ai._sortElements,init:function(t){var e=Ai.init(t);return e.transformRules=[e.flip&&O.get("flip")],e.adjustRules=[function(t,n){var r=t.scaleSize.isEmptyScale(),i=Zt(e.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),o=Object.assign({},n,{defMin:i.defMinSize,defMax:i.defMaxSize,minLimit:i.minSize,maxLimit:i.maxSize});return O.get("adjustStaticSizeScale")(t,o)}],e},buildModel:function(t){var e=Ai.baseModel(t),n=this.node().config.guide,r=Ci(t.model.scaleColor.domain().length),i=Xe+"area area i-role-path "+r+" "+n.cssClass+" ";e.groupAttributes={class:function(t){return i+" "+e.class(t[0])+" frame"}};var o,a,u={fill:function(t){return e.color(t[0])},stroke:function(t){return e.color(t[0])}};return e.pathAttributesEnterInit=u,e.pathAttributesUpdateDone=u,e.pathElement="polygon",e.anchorShape="circle",e.pathTween={attr:"points",fn:ct(0,(o=function(t){return t.x},a=function(t){return t.y},function(t){return t.map(function(t){return[o(t),a(t)].join(",")}).join(" ")}),[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}}],t.id)},e}};function Ri(t){if(t.length<2)return"";for(var e="",n=0;n=160&&e<320?n=1:e>=320&&e<480?n=2:e>=480&&e<640?n=3:e>=640&&(n=4),Ti[n]):"",s=Ci(t.model.scaleColor.domain().length),c=a?"line":"area",l=""+Xe+c+" "+c+" i-role-path "+u+" "+s+" "+i.cssClass+" ",f=a?{stroke:function(t){return h.color(t[0])},class:"i-role-datum"}:{fill:function(t){return h.color(t[0])}},d="cubic"===J(i.interpolate)?a?Di:fi:a?Ri:li,h=Ai.baseModel(t),p=a?function(e){return{id:t.id(e),x:h.x(e),y:h.y(e)}}:function(e){return{id:t.id(e),x:h.x(e),y:h.y(e),size:h.size(e)}};return h.groupAttributes={class:function(t){return l+" "+h.class(t[0])+" frame"}},h.pathElement="path",h.anchorShape="circle",h.pathAttributesEnterInit=f,h.pathAttributesUpdateDone=f,h.pathTween={attr:"d",fn:ct(0,d,[p],t.id,i.interpolate)},h}},Bi=function(t){return a.select(t).data()[0]},Wi={init:function(t){var e=Object.assign({},t);e.guide=e.guide||{},e.guide=Zt(e.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=e.guide.enableColorToBarPosition?e.guide.enableColorToBarPosition:!e.stack}),e.guide.size=Zt(e.guide.size||{},{enableDistributeEvenly:!0}),e.guide.label=Zt(e.guide.label||{},{position:e.flip?e.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:e.stack?["rotate-on-size-overflow","t-","b+","hide-by-label-height-vertical","cut-label-vertical","auto:hide-on-label-label-overlap"]:["rotate-on-size-overflow","outside-then-inside-vertical","auto:hide-on-label-label-overlap"]});var n=e.guide.avoidScalesOverflow,r=e.guide.enableColorToBarPosition,i=e.guide.size.enableDistributeEvenly;return e.transformRules=[e.flip&&O.get("flip"),e.guide.obsoleteVerticalStackOrder&&O.get("obsoleteVerticalStackOrder"),e.stack&&O.get("stack"),r&&O.get("positioningByColor")].filter(function(t){return t}),e.adjustRules=[i&&function(t,n){var r=Zt(e.guide.size||{},{defMinSize:e.guide.prettify?3:0,defMaxSize:e.guide.prettify?40:Number.MAX_VALUE}),i=Object.assign({},n,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return O.get("size_distribute_evenly")(t,i)},n&&i&&function(t,e){var n=Object.assign({},e,{sizeDirection:"x"});return O.get("avoidScalesOverflow")(t,n)},e.stack&&O.get("adjustYScale")].filter(function(t){return t}),e},addInteraction:function(){var t=this,e=this.node();e.on("highlight",function(e,n){return t.highlight(n)}),e.on("data-hover",function(e,n){return t.highlight((r=n.data,i=null,function(t){return t===r||i}));var r,i})},draw:function(){var t,e,n=this.node(),r=n.config,i=r.options;i.container=i.slot(r.uid);var o=r.guide.prettify,u="i-role-element i-role-datum bar "+Xe+"bar",s=n.screenModel,c=this.buildModel(s,{prettify:o,minBarH:1,minBarW:1,baseCssClass:u}),l=ut,f=r.flip?"y":"x",d=r.flip?"x":"y",h=r.flip?"width":"height",p=r.flip?"height":"width",g=s.toFibers(),m=g.reduce(function(t,e){return t.concat(e)},[]),y=c.class,v=Qt(c,"class"),b=i.container.selectAll(".bar").data(m,s.id);b.exit().classed("tau-removing",!0).call(l(r.guide.animationSpeed,null,((t={})[f]=function(){var t=a.select(this);return t.attr(f)-0+(t.attr(p)-0)/2},t[d]=function(){return this.getAttribute("data-zero")},t[p]=0,t[h]=0,t),function(t){var e=a.select(t);e.classed("tau-removing")&&e.remove()})),b.call(l(r.guide.animationSpeed,null,v));var x=b.enter().append("rect").call(l(r.guide.animationSpeed,(e={},e[d]=s[d+"0"],e[h]=0,e),v)).merge(b).attr("class",y).attr("data-zero",s[d+"0"]);n.subscribe(new ei(s.model,s.model.flip,r.guide.label,i).draw(g));var w,_=(w=m.reduce(function(t,e,n){return t.set(e,n+1),t},new Map),function(t,e){return(w.get(Bi(t))||-1)-(w.get(Bi(e))||-1)});this._barsSorter=r.guide.sortByBarHeight?r.flip?function(t,e){var n=Bi(t),r=Bi(e),i=c.width(n),o=c.width(r);if(i===o){var a=c.y(n),u=c.y(r);return a===u?_(t,e):a-u}return o-i}:function(t,e){var n=Bi(t),r=Bi(e),i=c.height(n),o=c.height(r);if(i===o){var a=c.x(n),u=c.x(r);return a===u?_(t,e):a-u}return o-i}:_;var S={rect:0,text:1};this._typeSorter=function(t,e){return S[t.tagName]-S[e.tagName]},this._sortElements(this._typeSorter,this._barsSorter),n.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel:function(t,e){var n,r=e.prettify,i=e.minBarH,o=e.minBarW,a=e.baseCssClass,u=function(e){var n=t.size(e);return r&&(n=Math.max(o,n)),n},s=function(e){return e[t.model.scaleY.dim]};if(t.flip){var c=function(e){return Math.abs(t.x(e)-t.x0(e))};n={y:function(e){return t.y(e)-.5*u(e)},x:function(e){var n=Math.min(t.x0(e),t.x(e));if(r){var o=c(e),a=s(e),u=0;return 0===a&&(u=0),a>0&&(u=o),a<0&&(u=0-i),o0?n-i:n);return n},width:function(t){return u(t)},height:function(t){var e=l(t);return r&&(e=0===s(t)?e:Math.max(i,e)),e}}}return Object.assign(n,{class:function(e){return a+" "+t.class(e)},fill:function(e){return t.color(e)}})},_sortElements:function(){for(var t=[],e=0;eu}}),i=r.reduce(function(t,e){var n=e.box;return t.left=Math.min(n.left,t.left),t.right=Math.max(n.right,t.right),t.top=Math.min(n.top,t.top),t.bottom=Math.max(n.bottom,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Vt(r.map(n?function(t){return t.cy}:function(t){return t.cx})).sort(function(t,e){return t-e}),u=o.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=o.find(n?function(e){return t.cy===e}:function(e){return t.cx===e});u[e].push(t)});var s=function(t){if(1===t.length)return u[t];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:s(t.slice(0,e)),greater:s(t.slice(e))}};return{bounds:i,tree:s(o)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,o=this.node().config.options.container,a=this.node().config.flip,u=ze(o.node()),s=t-u.x,c=e-u.y,l=this.node().config.guide.maxHighlightDistance;if(sr.right+l||cr.bottom+l)return null;var f=a?c:s,d=a?s:c;return function t(e){return Array.isArray(e)?e:t(f>e.middle?e.greater:e.lower)}(i).map(function(t){var e,n,r=a?t.box.left:t.box.top,i=a?t.box.right:t.box.bottom,o=(n=i,(e=d)>=r&&e<=n);if(!o&&Math.abs(d-r)>l&&Math.abs(d-i)>l)return null;var u=Math.abs(d-(t.invert!==a?i:r));return Object.assign(t,{distToValue:u,cursorInside:o})}).filter(function(t){return t}).sort(function(t,e){return t.cursorInside!==e.cursorInside?e.cursorInside-t.cursorInside:Math.abs(t.distToValue)-Math.abs(e.distToValue)}).map(function(t){var e=t.cx,n=t.cy,r=Math.abs(a?c-n:s-e),i=Math.abs(a?s-e:c-n);return{node:t.node,data:t.data,distance:r,secondaryDistance:i,x:e,y:n}})[0]||null},highlight:function(t){var e,n=this.node().config.options.container,r=((e={})["tau-chart__highlighted"]=function(e){return!0===t(e)},e["tau-chart__dimmed"]=function(e){return!1===t(e)},e);n.selectAll(".bar").call(ft(r)),n.selectAll(".i-role-label").call(ft(r)),this._sortElements(function(e,n){return t(Bi(e))-t(Bi(n))},this._typeSorter,this._barsSorter)}},Hi=n(14),Ui=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gi=function(t){function e(e){var n=t.call(this,e)||this;return n.config=e,n.config.guide=Zt(n.config.guide||{},{}),n.on("highlight",function(t,e){return n.highlight(e)}),n}return Ui(e,t),e.prototype.defineGrammarModel=function(t){var e=this.config,n=e.options;this.color=t("color",e.color,{}),this.scalesMap=e.columns.reduce(function(e,r){return e[r]=t("pos",r,[0,n.height]),e},{});var r=n.width/(e.columns.length-1),i=e.columns.reduce(function(t,e,n){return t[e]=n*r,t},{});return this.xBase=function(t){return i[t]},this.regScale("columns",this.scalesMap).regScale("color",this.color),{}},e.prototype.drawFrames=function(t){var e=this.config,n=this.config.options,r=this.scalesMap,i=this.xBase,o=this.color,a=Hi.line(),u=function(t){t.attr("d",function(t){return a(e.columns.map(function(e){return[i(e),r[e](t[r[e].dim])]}))})},s=function(t){t.attr("stroke",function(t){return o.toColor(o(t[o.dim]))}),t.attr("class",function(t){return Xe+"__line line "+o.toClass(o(t[o.dim]))+" foreground"})},c=function(t){var e=t.selectAll(".background").data(function(t){return t.part()});e.exit().remove(),e.call(u),e.enter().append("path").attr("class","background line").call(u);var n=t.selectAll(".foreground").data(function(t){return t.part()});n.exit().remove(),n.call(function(t){u(t),s(t)}),n.enter().append("path").call(function(t){u(t),s(t)})},l=n.container.selectAll(".lines-frame").data(t,function(t){return t.hash()});l.exit().remove(),l.call(c),l.enter().append("g").attr("class","lines-frame").call(c),this.subscribe(n.container.selectAll(".lines-frame .foreground"))},e.prototype.highlight=function(t){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",function(e){return t(e)?"":"hidden"})},e}(m),qi=function(){function t(t,e){var n,r=this;if(this._fields={},Array.isArray(e.fitToFrameByDims)&&e.fitToFrameByDims.length){n=t.part(function(t){var n={};return"where"===t.type&&t.args?(n.type=t.type,n.args=e.fitToFrameByDims.reduce(function(e,n){return t.args.hasOwnProperty(n)&&(e[n]=t.args[n]),e},{})):n=t,n})}else n=t.full();var i=this.getVarSet(n,e);e.order&&(i=Jt(Kt(e.order,i),i)),this.vars=i;var o=i.map(function(t){return t});this.scaleConfig=e,this.scaleConfig.nice=this.scaleConfig.hasOwnProperty("nice")?this.scaleConfig.nice:this.scaleConfig.autoScale,this.addField("dim",this.scaleConfig.dim).addField("scaleDim",this.scaleConfig.dim).addField("scaleType",this.scaleConfig.type).addField("source",this.scaleConfig.source).addField("domain",function(){return r.vars}).addField("isInteger",o.every(Number.isInteger)).addField("originalSeries",function(){return o}).addField("isContains",function(t){return r.isInDomain(t)}).addField("isEmptyScale",function(){return r.isEmpty()}).addField("fixup",function(t){var e=r.scaleConfig;e.__fixup__=e.__fixup__||{},e.__fixup__=Object.assign(e.__fixup__,t(Object.assign({},e,e.__fixup__)))}).addField("commit",function(){r.scaleConfig=Object.assign(r.scaleConfig,r.scaleConfig.__fixup__),delete r.scaleConfig.__fixup__})}return t.prototype.isInDomain=function(t){return this.domain().indexOf(t)>=0},t.prototype.addField=function(t,e){return this._fields[t]=e,this[t]=e,this},t.prototype.getField=function(t){return this._fields[t]},t.prototype.isEmpty=function(){return!Boolean(this._fields.dim)},t.prototype.toBaseScale=function(t,e){var n=this;void 0===e&&(e=null);var r=Object.keys(this._fields).reduce(function(t,e){return t[e]=n._fields[e],t},t);return r.getHash=function(){return Ft([n.vars,e].map(function(t){return JSON.stringify}).join(""))},r.value=r,r},t.prototype.getVarSet=function(t,e){return Vt(e.hasOwnProperty("series")?e.series:t.map(function(t){return t[e.dim]}),"date"===e.dimType?function(t){return new Date(t).getTime()}:function(t){return t})},t}(),Xi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Yi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._references=n.references,r._refCounter=n.refCounter,r.addField("scaleType","identity"),r}return Xi(e,t),e.prototype.create=function(){var t=this._references,e=this._refCounter;return this.toBaseScale(function(n,r){if(null==n){var i=t.get(r);null==i&&(i=e(),t.set(r,i))}else i=n;return i})},e}(qi),Vi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i=function(){return($i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var h=Math.max.apply(Math,u.map(Math.abs));u=[-h,h]}r.vars=u}return r.addField("scaleType","color").addField("discrete",i).addField("brewer",o).addField("toColor",Bt).addField("toClass",Wt),r}return Vi(e,t),e.prototype.create=function(){var t=this.discrete,e=this.vars,n=this.getField("brewer"),r=t?this.createDiscreteScale(e,n):this.createContinuesScale(e,n);return this.toBaseScale(r)},e.prototype.createDiscreteScale=function(t,e){var n,r=function(t,e){var n=t.map(function(t){return String(t).toString()});return Ji.scaleOrdinal().range(e).domain(n)},i=function(t){return function(e){return t(String(e).toString())}};if(Array.isArray(e))n=i(r(t,e));else if("function"==typeof e)n=function(n){return e(n,i(r(t,Gt(20).map(function(t){return"color20-"+(1+t)}))))};else{if(!Ct(e))throw new Error("This brewer is not supported");n=function(t,e){var n=Object.keys(t),r=n.map(function(e){return t[e]}),i=Ji.scaleOrdinal().range(r).domain(n);return function(n){return t.hasOwnProperty(n)?i(String(n)):e(n)}}(e,function(){return"color-default"})}return n},e.prototype.createContinuesScale=function(t,e){if(!Array.isArray(e))throw new Error("This brewer is not supported");return Ji.scaleLinear().domain(It(t.map(function(t){return t-0}),e.length)).range(e)},e}(qi),Zi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qi={sqrt:function(t){return Math.sqrt(t)},linear:function(t){return t}},to=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=r.scaleConfig,o=u.extent(r.vars),a=Number.isFinite(i.min)?i.min:o[0],s=Number.isFinite(i.max)?i.max:o[1];return r.vars=[Math.min.apply(Math,[a,o[0]].filter(Number.isFinite)),Math.max.apply(Math,[s,o[1]].filter(Number.isFinite))],r.addField("scaleType","size"),r.addField("funcType",n.func||"sqrt"),r}return Zi(e,t),e.prototype.isInDomain=function(t){var e=this.domain().sort(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(){var t,e=this.scaleConfig,n=this.vars,r=Zt({},e,{func:"sqrt",minSize:0,maxSize:1}),i=r.func,o=r.minSize,a=r.maxSize,u=Qi[i],s=n.filter(function(t){return Number.isFinite(Number(t))});if(0===s.length)t=function(){return a};else{var c,l,f=Math.min.apply(Math,s),d=Math.max.apply(Math,s),h=u(Math.max(Math.abs(f),Math.abs(d),d-f));l=f<0?f:0,c=0===h?1:(a-o)/h,t=function(t){var e=null!==t?parseFloat(t):0;return Number.isFinite(e)?o+u(e-l)*c:a}}return this.toBaseScale(t)},e}(qi),eo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),no=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","ordinal").addField("discrete",!0),r}return eo(e,t),e.prototype.create=function(t){var e=this.scaleConfig,n=this.vars,r=s.scalePoint().domain(n).range(t).padding(.5),i=Math.max.apply(Math,t),o=function(t){return"function"==typeof e.ratio?e.ratio(t,i,n):"object"==typeof e.ratio?e.ratio[t]:1/n.length},a=function(t){return e.ratio?i-n.slice(n.indexOf(t)+1).reduce(function(t,e){return t+i*o(e)},i*o(t)*.5):r(t)};return Object.keys(r).forEach(function(t){return a[t]=r[t]}),a.stepSize=function(t){return o(t)*i},this.toBaseScale(a,t)},e}(qi),ro=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),io=function(){return(io=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0},e.prototype.create=function(t){var e=this.periodGenerator,n=this.vars,r=this.vars.map(function(t){return t.getTime()}),i=this.scaleConfig,o=oo.scalePoint().domain(n).range(t).padding(.5),a=oo.scalePoint().domain(r.map(String)).range(t).padding(.5),u=Math.max.apply(Math,t),s=function(t){var e=new Date(t).getTime();return"function"==typeof i.ratio?i.ratio(e,u,r):"object"==typeof i.ratio?i.ratio[e]:1/n.length},c=function(t){var n=new Date(t),o=(e?e.cast(n):n).getTime();return i.ratio?u-r.slice(r.indexOf(o)+1).reduce(function(t,e){return t+u*s(e)},u*s(t)*.5):a(String(o))};return Object.keys(o).forEach(function(t){return c[t]=o[t]}),c.stepSize=function(t){return s(t)*u},this.toBaseScale(c,t)},e}(qi),uo=n(15),so=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),co=function(){return(co=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=r},e.prototype.create=function(t){var e=this,n=this.vars,r=this.scaleConfig.utcTime,i=this.periodGenerator,o=(r?lo.scaleUtc:lo.scaleTime)().domain(n).range(t),a=function(t){var e=n[0],r=n[1];return t>r&&(t=r),t=i&&t<=o});return function(t,e,n){void 0===n&&(n=10);var r,i,o=Number(t[0]),a=Number(t[1]),u=Math.abs(a-o)/n,s=lo.bisector(function(t){return t.duration}).right(mo,u);if(s===mo.length)r=e?lo.utcYear:lo.timeYear,i=lo.tickStep(o/go.year.duration,a/go.year.duration,n);else if(s){var c=u/mo[s-1].duration,l=mo[s].duration/u,f=mo[cl&&(e=l),o(e)}}return Object.keys(o).forEach(function(t){return a[t]=o[t]}),a.stepSize=function(){return 0},this.toBaseScale(a,t)},e}(qi);function ho(t){return lo["time"+t[0].toUpperCase()+t.slice(1)]}var po,go={second:{duration:1e3,interval:lo.timeSecond,utc:lo.utcSecond},minute:{duration:6e4,interval:lo.timeMinute,utc:lo.utcMinute},hour:{duration:36e5,interval:lo.timeHour,utc:lo.utcHour},day:{duration:864e5,interval:lo.timeDay,utc:lo.utcDay},week:{duration:6048e5,interval:lo.timeWeek,utc:lo.utcWeek},month:{duration:2592e6,interval:lo.timeMonth,utc:lo.utcMonth},year:{duration:31536e6,interval:lo.timeYear,utc:lo.utcYear}},mo=[(po=function(t,e){return{time:t,step:e,duration:e*t.duration}})(go.second,1),po(go.second,5),po(go.second,15),po(go.second,30),po(go.minute,1),po(go.minute,5),po(go.minute,15),po(go.minute,30),po(go.hour,1),po(go.hour,3),po(go.hour,6),po(go.hour,12),po(go.day,1),po(go.day,2),po(go.week,1),po(go.month,1),po(go.month,3),po(go.year,1)];var yo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),vo=function(){return(vo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(t){var e=this.vars,n=this.extendScale(bo.scaleLinear());return n.domain(e).range(t).clamp(!0),this.toBaseScale(n,t)},e.prototype.extendScale=function(t){var e=this,n=t.copy,r=t.ticks;return Object.assign(t,{stepSize:function(){return 0},copy:function(){return e.extendScale(n.call(t))},ticks:this.getField("isInteger")?function(e){return r.call(t,e).filter(Number.isInteger)}:t.ticks}),t},e}(qi),wo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_o=function(){return(_o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0,n=t.map(function(t){return Math.abs(t)}),r=Math.max.apply(Math,n),i=Math.min.apply(Math,n).toExponential().split("e"),o=r.toExponential().split("e"),a=parseFloat(Math.floor(Number(i[0]))+"e"+i[1]),u=parseFloat(Math.ceil(Number(o[0]))+"e"+o[1]);return e?[a,u]:[-u,-a]}(o)),r.vars=o,r.addField("scaleType","logarithmic").addField("discrete",!1),r}return wo(e,t),e.prototype.isInDomain=function(t){var e=this.domain(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(t){var e=this.vars;Ao(e);var n=function t(e){var n=e.copy;e.ticks=function(t){for(var n=[],r=So.extent(e.domain()),i=Math.floor(Oo(r[0])),o=Math.ceil(Oo(r[1])),a=Math.ceil(10*(o-i)/(10*Math.ceil(t/10))),u=i;u<=o;u+=a)for(var s=1;s<=10;s++){var c=Math.pow(s,a)*Math.pow(10,u);(c=parseFloat(c.toExponential(0)))>=r[0]&&c<=r[1]&&n.push(c)}return n};e.copy=function(){var r=n.call(e);return t(r),r};return e}(So.scaleLog()).domain(e).range(t);return n.stepSize=function(){return 0},this.toBaseScale(n,t)},e}(qi);function Oo(t){return Math.log(t)/Math.LN10}function Ao(t){if(t[0]*t[1]<=0)throw new _("Logarithmic scale domain cannot cross zero.",S.INVALID_LOG_DOMAIN)}var ko,Eo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),To=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","value").addField("georole",n.georole),r}return Eo(e,t),e.prototype.create=function(){return this.toBaseScale(function(t){return t})},e}(qi),Co=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),No=function(){return(No=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(){var t=this.vars,e=this.getField("brewer");if(!Array.isArray(e))throw new Error("This brewer is not supported");var n=e.length,r=(t[1]-t[0])/n,i=Gt(n-1).map(function(t){return t+1}).reduce(function(e,n){return e.concat([t[0]+n*r])},[]),o=Lo.scaleThreshold().domain(i).range(e);return this.toBaseScale(o)},e}(qi),Po=function(t){return t||null},Fo=function(t,e){return void 0===e&&(e=null),Array.isArray(t)?0===t.length?[e]:t:[t]},zo=function(t,e){return{type:t,x:e.x,y:e.y,identity:e.identity,size:e.size,color:e.color,split:e.split,label:e.label,guide:{color:e.colorGuide,obsoleteVerticalStackOrder:e.obsoleteVerticalStackOrder,size:e.sizeGuide},flip:e.flip,stack:e.stack}},Ro={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},Do=((ko={})[Ro.SUCCESS]=function(t){return t},ko[Ro.FAIL]=function(t,e){throw new Error((e.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},ko[Ro.WARNING]=function(t,e,n){var r=e.axis,i=e.indexMeasureAxis[0],o=t[i],a=t.filter(function(t){return t!==o});a.push(o);var u=n[i][r]||{},s=n[n.length-1][r]||{};return n[n.length-1][r]=u,n[i][r]=s,a},ko);function Io(t,e,n){return e.reduce(function(e,r,i){var o=t[r];return o?e.status!=Ro.FAIL&&("measure"===o.type&&(e.countMeasureAxis++,e.indexMeasureAxis.push(i)),"measure"!==o.type&&1===e.countMeasureAxis?e.status=Ro.WARNING:e.countMeasureAxis>1&&(e.status=Ro.FAIL,e.messages.push('There is more than one measure dimension for "'+n+'" axis'))):(e.status=Ro.FAIL,r?e.messages.push('"'+r+'" dimension is undefined for "'+n+'" axis'):e.messages.push('"'+n+'" axis should be specified')),e},{status:Ro.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:n})}function Bo(t){for(var e=Fo(t.x),n=Fo(t.y),r=Math.max(e.length,n.length),i=Fo(t.guide||{},{}),o=r-i.length,a=0;a0;l--){var f=u.pop(),d=s.pop(),h=c.pop()||{};l===o?(a.x=f,a.y=d,a.unit.push(zo(t,{x:Po(f),y:Po(d),identity:e.identity,split:e.split,color:e.color,label:e.label,size:e.size,flip:e.flip,stack:e.stack,colorGuide:h.color,obsoleteVerticalStackOrder:h.obsoleteVerticalStackOrder,sizeGuide:h.size})),a.guide=Zt(h,{x:{label:f},y:{label:d}})):a={type:"COORDS.RECT",x:Po(f),y:Po(d),unit:[a],guide:Zt(h,{x:{label:f},y:{label:d}})}}return e.spec={dimensions:e.dimensions,unit:a},e}var Ho=function(t){var e,n,r,i=Bo(t);return n=((e=i).flip?e.y:e.x).indexOf(e.color)>=0,r=e.guide[e.guide.length-1],n&&!r.hasOwnProperty("enableColorToBarPosition")&&(r.enableColorToBarPosition=!1),Wo("ELEMENT.INTERVAL",i=e)},Uo=function(t){var e=Bo(t),n=e.data,r=e.settings.log,i=(0,{horizontal:function(t){return{prop:t.x[t.x.length-1],flip:!1}},vertical:function(t){return{prop:t.y[t.y.length-1],flip:!0}},auto:function(t){var e,i=t.x,o=t.y,a=i[i.length-1],u=i.slice(0,i.length-1),s=o[o.length-1],c=o.slice(0,o.length-1),l=t.color,f=u.concat(c).concat([l]).filter(function(t){return null!==t}),d=-1,h=[[[a].concat(f),s],[[s].concat(f),a]],p=null;return h.some(function(t,e){var i=t[0],o=t[1],a=sn(n,i,[o]);return a.result?d=e:r(["Attempt to find a functional relation between",t[0]+" and "+t[1]+" is failed.","There are several "+a.error.keyY+" values (e.g. "+a.error.errY.join(",")+")","for ("+a.error.keyX+" = "+a.error.valX+")."].join(" ")),a.result})?(e=h[d][0][0],p=0!==d):(r("All attempts are failed. Gonna transform AREA to general PATH."),e=null),{prop:e,flip:p}}}["boolean"!=typeof e.flip?"auto":e.flip?"vertical":"horizontal"])(e);return null!==i.prop&&(e.data=dn(n,i.prop,e.dimensions[i.prop]),e.flip=i.flip),Wo("ELEMENT.AREA",e)},Go=function(){function t(t){this.unitRef=t}return t.prototype.value=function(){return this.unitRef},t.prototype.clone=function(){return JSON.parse(JSON.stringify(this.unitRef))},t.prototype.traverse=function(t){var e=function(t,n,r){n(t,r),(t.units||[]).map(function(r){return e(r,n,t)})};return e(this.unitRef,t,null),this},t.prototype.reduce=function(t,e){var n=e;return this.traverse(function(e,r){return n=t(n,e,r)}),n},t.prototype.addFrame=function(t){return this.unitRef.frames=this.unitRef.frames||[],t.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),t.source=t.hasOwnProperty("source")?t.source:this.unitRef.expression.source,t.pipe=t.pipe||[],this.unitRef.frames.push(t),this},t.prototype.addTransformation=function(t,e){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:t,args:e}),this},t.prototype.isCoordinates=function(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")},t.prototype.isElementOf=function(t){if(this.isCoordinates())return!1;var e=(this.unitRef.type||"").split("/");return 1===e.length&&e.unshift("RECT"),e[0].toUpperCase()===t.toUpperCase()},t}(),qo=function(){function t(t){this.specRef=t}return t.prototype.value=function(){return this.specRef},t.prototype.unit=function(t){return t&&(this.specRef.unit=t),new Go(this.specRef.unit)},t.prototype.addTransformation=function(t,e){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[t]=e,this},t.prototype.getSettings=function(t){return this.specRef.settings[t]},t.prototype.setSettings=function(t,e){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[t]=e,this},t.prototype.getScale=function(t){return this.specRef.scales[t]},t.prototype.addScale=function(t,e){return this.specRef.scales[t]=e,this},t.prototype.regSource=function(t,e){return this.specRef.sources[t]=e,this},t.prototype.getSourceData=function(t){return(this.specRef.sources[t]||{data:[]}).data},t.prototype.getSourceDim=function(t,e){return(this.specRef.sources[t]||{dims:{}}).dims[e]||{}},t}(),Xo={},Yo=function(){function t(){}return t.unit=function(t){return new Go(t)},t.spec=function(t){return new qo(t)},t.cloneObject=function(t){return JSON.parse(JSON.stringify(t))},t.depthFirstSearch=function(e,n){if(n(e))return e;for(var r=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],i=0;i1))return"[columns] property must contain at least 2 dimensions"}]));var Zo="2.7.1";e.default={GPL:qe,Plot:ar,Chart:dr,api:Jo,version:"2.7.1"}},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=o},function(t,e){t.exports=a},function(t,e){t.exports=u},function(t,e){t.exports=s},function(t,e,n){var r,i,o;i=[],void 0===(o="function"==typeof(r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){return t.indexOf(e)},r=window,i=r.document,o=i.documentElement,a=["top","bottom"];function u(t,e){for(var n in e)t[n]=e[n];return t}function s(t){var e,n=r.pageYOffset||o.scrollTop,i=r.pageXOffset||o.scrollLeft,a={left:0,right:0,top:0,bottom:0,width:0,height:0};if((e=t)&&null!=e.setInterval)a.width=r.innerWidth||o.clientWidth,a.height=r.innerHeight||o.clientHeight;else{if(!o.contains(t)||null==t.getBoundingClientRect)return a;u(a,t.getBoundingClientRect()),a.width=a.right-a.left,a.height=a.bottom-a.top}return a.top=a.top+n-o.clientTop,a.left=a.left+i-o.clientLeft,a.right=a.left+a.width,a.bottom=a.top+a.height,a}var c=function(t,e){return r.getComputedStyle(t)[e]};function l(t){var e=String(c(t,l.propName)),n=e.match(/([0-9.]+)([ms]{1,2})/);return n&&(e=Number(n[1]),"s"===n[2]&&(e*=1e3)),0|e}l.propName=function(){for(var t=i.createElement("div"),e=["transitionDuration","webkitTransitionDuration"],n=0;n=e.bottom&&(i[0]="top"),i[1]){case"left":t.right-this.width<=e.left&&(i[1]="right");break;case"right":t.left+this.width>=e.right&&(i[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?i[1]="left":t.right-t.width/2-this.width/2<=e.left&&(i[1]="right")}else switch(t.left-this.width-o<=e.left?i[0]="right":t.right+this.width+o>=e.right&&(i[0]="left"),i[1]){case"top":t.bottom-this.height<=e.top&&(i[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(i[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?i[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(i[1]="bottom")}return i.join("-")},d.prototype.position=function(t,e){this.attachedTo&&(t=this.attachedTo),null==t&&this._p?(t=this._p[0],e=this._p[1]):this._p=arguments;var n,r,i="number"==typeof t?{left:0|t,right:0|t,top:0|e,bottom:0|e,width:0,height:0}:s(t),o=this.spacing,a=this._pickPlace(i);switch(a!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(a),this.curPlace=a),this.curPlace){case"top":n=i.top-this.height-o,r=i.left+i.width/2-this.width/2;break;case"top-left":n=i.top-this.height-o,r=i.right-this.width;break;case"top-right":n=i.top-this.height-o,r=i.left;break;case"bottom":n=i.bottom+o,r=i.left+i.width/2-this.width/2;break;case"bottom-left":n=i.bottom+o,r=i.right-this.width;break;case"bottom-right":n=i.bottom+o,r=i.left;break;case"left":n=i.top+i.height/2-this.height/2,r=i.left-this.width-o;break;case"left-top":n=i.bottom-this.height,r=i.left-this.width-o;break;case"left-bottom":n=i.top,r=i.left-this.width-o;break;case"right":n=i.top+i.height/2-this.height/2,r=i.right+o;break;case"right-top":n=i.bottom-this.height,r=i.right+o;break;case"right-bottom":n=i.top,r=i.right+o}return this.element.style.top=Math.round(n)+"px",this.element.style.left=Math.round(r)+"px",this},d.prototype.show=function(t,e){return t=this.attachedTo?this.attachedTo:t,clearTimeout(this.aIndex),null!=t&&this.position(t,e),this.hidden&&(this.hidden=0,i.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},d.prototype.getElement=function(){return this.element},d.prototype.hide=function(){if(!this.hidden){var t=this,e=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(e=l(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){t.aIndex=0,i.body.removeChild(t.element),t.hidden=1},e),this}},d.prototype.toggle=function(t,e){return this[this.hidden?"show":"hide"](t,e)},d.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||i.body.removeChild(this.element),this.element=this.options=null},d.prototype._aware=function(){-1===n(d.winAware,this)&&d.winAware.push(this)},d.prototype._unaware=function(){var t=n(d.winAware,this);-1!==t&&d.winAware.splice(t,1)},d.reposition=function(){var t,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,17)};function n(){t=0;for(var e=0,n=d.winAware.length;e0)-(t<0)||Number(t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],o=0;o>>0,i=arguments[1],o=0;o0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),a)},function(t){var e=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!o(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(n=arguments[2])}for(var i,a=u(e.length),s=o(this)?Object(new this(a)):new Array(a),c=0;c=0?t.positive:t.negative,u=a[i]||0,s=u+o;return a[i]=s,{nextStack:s,prevStack:u}}},o=i({positive:{},negative:{}}),a=i({positive:{},negative:{}}),u=function(e){return te(e,t.id)},s=Number.MAX_VALUE,c=Number.MIN_VALUE,l=function(t){return s=tc?t:c,r.value(t)},f=u(function(t){return l(o(t).nextStack)}),d=u(function(t){return l(a(t).prevStack)}),h=function(e){return t.group(e)+"/"+(e[r.dim]>=0?1:-1)},p=$t(e,h),g=Object.keys(p).sort(t.flip||!t.flip&&t.obsoleteVerticalStackOrder?function(e,n){return t.order(e)-t.order(n)}:function(e,n){return t.order(n)-t.order(e)}).reduce(function(t,e){return t.concat(p[e])},[]);return g.forEach(function(t){f(t),d(t)}),r.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxs)&&(e.min=s),e}),{group:h,data:function(){return g},yi:f,y0:d}}).reg("size_distribute_evenly",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a=t.data(),u=function(t,e){return t-e},s=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,c=a.map(function(e){return t.xi(e)}).sort(u),l=c[0],f=c.slice(1).map(function(t){var e=t-l;return l=t,e}).filter(function(t){return t>0}).sort(u).concat(Number.MAX_VALUE)[0],d=Math.min(f,s),h="number"==typeof n?n:i,p={minSize:h,maxSize:"number"==typeof r?r:Math.max(h,Math.min(o,d))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("adjustStaticSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a={minSize:"number"==typeof n?n:i,maxSize:"number"==typeof r?r:o};return t.scaleSize.fixup(function(t){var e={};return t.fixed||(e.fixed=!0,e.minSize=a.minSize,e.maxSize=a.maxSize),e}),{}}).reg("adjustSigmaSizeScale",function(t,e){var n,r,i,o,a=e.minLimit,u=e.maxLimit,s=e.defMin,c=e.defMax,l=function(t,e){return t-e},f=t.data().map(function(e){return t.xi(e)}).sort(l),d=f[0],h=f.slice(1).map(function(t){var e=t-d;return d=t,e}).filter(function(t){return t>0}).sort(l).concat(Number.MAX_VALUE)[0],p=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,g=Math.min(h,p),m="number"==typeof a?a:s,y="number"==typeof u?u:c,v={minSize:m,maxSize:Math.max(m,Math.min(y,(n=g,r=(m+y)/2,i=y,o=m,Math.round(r+(i-r)/(1+Math.exp(-(n-o)/.5))))))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>v.maxSize&&(e.maxSize=v.maxSize):(e.fixed=!0,e.minSize=v.minSize,e.maxSize=v.maxSize),e}),{}}).reg("avoidScalesOverflow",function(t,e){var n,r,i=e.sizeDirection,o=function(t,e){return!t||t.discrete||"logarithmic"===t.scaleType||i.indexOf(e)<0},a=o(t.scaleX,"x"),u=o(t.scaleY,"y");if(a&&u)return{};t.scaleSize.fixup(function(t){return n=t.minSize,r=t.maxSize,t});var s=t.data().reduce(function(e,i){var o,s,c=t.size(i),l=(c>=n?c:n+c*(r-n))/2;return a||(o=t.xi(i),e.left=Math.min(e.left,o-l),e.right=Math.max(e.right,o+l)),u||(s=t.yi(i),e.top=Math.min(e.top,s-l),e.bottom=Math.max(e.bottom,s+l)),e},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE}),c=function(e,n,r,i){var o=e.domain(),a=Math.abs(e.value(o[1])-e.value(o[0])),u=(o[1]-o[0])/a;if(0===a)return 1;var s=Math.max(0,-n),c=Math.max(0,r-a),l=t.flip?c:s,f=t.flip?s:c,d=Number(o[0])-(i?f:l)*u,h=Number(o[1])+(i?l:f)*u;return e.fixup(function(t){var e={};if(t.fixedBorders){var i=t.fixedBorders.slice(),o=i[0],a=i[1];(o>n||a=0?1:-1},d=function(e,n,r){var i,o=[e,t.id(n),r].join(" ");return(i={})[u]=e,i[s]=1e-10*r,i[l]=n[l],i[c]=n[c],i[A]=!0,i[A+"id"]=o,i},h=function(t,e,n){var r=$t(e,function(t){return t[u]}),i=e[0];return t.reduce(function(t,e){return t.push.apply(t,r[e]||[d(e,i,n)]),t},[])},p=function(t,e){return t-e},g=function(){return Vt(a.reduce(function(t,e){return t.concat(e.map(function(t){return t[u]}))},[])).sort(p)},m=r?function(){var e=g(),n=Math.max.apply(Math,e.map(function(t){return Number(t)})),o=t.scaleX.domain(),a=x.generate(o[0],o[1],r,{utc:i}).filter(function(t){return t>=o[0]&&t<=o[1]}),u=0,s=[],c=x.get(r,{utc:i});return a.forEach(function(t){var r=Number(t);if(!(r>=n)){for(var i=u;i=0;n--)i=t[n+1],(r=t[n]).isCubicControl||i.isCubicControl||(t.splice(n+1,0,T(1/3,i,r),T(2/3,i,r)),t[n+1].isCubicControl=!0,t[n+2].isCubicControl=!0);var o=t.filter(function(t,e){return e%3==0}),a=e.filter(function(t,e){return e%3==0}),u=o.map(function(t){return t.id}),s=a.map(function(t){return t.id}),c=u.reduce(function(e,n){return e[n]=t.findIndex(function(t){return t.id===n}),e},{}),l=s.reduce(function(t,n){return t[n]=e.findIndex(function(t){return t.id===n}),t},{}),f=u.filter(function(t){return s.indexOf(t)>=0}),d=o.filter(function(t){return!t.positionIsBeingChanged}),h=a.filter(function(t){return!t.positionIsBeingChanged}),p=H(d,h),g=H(h,d),m=[];f.forEach(function(n,r){var i,o,a,u=c[n],s=l[n];if(0===r&&(u>0||s>0)&&m.push(L({polylineFrom:t.slice(0,u+1),polylineTo:e.slice(0,s+1),toOppositeScale:0===s?p:g,isCubic:!0})),r>0){var d=c[f[r-1]],h=l[f[r-1]];u-d>3||s-h>3?m.push(j({polylineFrom:t.slice(d,u+1),polylineTo:e.slice(h,s+1),isCubic:!0})):m.push((i={polylineFrom:t.slice(d,u+1),polylineTo:e.slice(h,s+1)},o=i.polylineFrom,a=i.polylineTo,function(t){return I(o.slice(1,3),a.slice(1,3),t)}))}m.push(P({pointFrom:t[u],pointTo:e[s]})),r===f.length-1&&(t.length-u-1>0||e.length-s-1>0)&&m.push(L({polylineFrom:t.slice(u),polylineTo:e.slice(s),toOppositeScale:e.length-s==1?p:g,isCubic:!0}))}),0===m.length&&(e.length>0&&0===f.length||t.length>0&&0===f.length)&&m.push(F({polylineFrom:t.slice(0),polylineTo:e.slice(0),isCubic:!0}));return function(t){var e=[];return m.forEach(function(n){var r=n(t);z(e,r)}),e}}:function(t,e){var n=(t=t.filter(function(t){return!t.isInterpolated})).map(function(t){return t.id}),r=e.map(function(t){return t.id}),i=n.filter(function(t){return r.indexOf(t)>=0}),o=t.filter(function(t){return!t.positionIsBeingChanged}),a=e.filter(function(t){return!t.positionIsBeingChanged}),u=H(o,a),s=H(a,o),c=[];i.forEach(function(o,a){var l=n.indexOf(o),f=r.indexOf(o);if(0===a&&(l>0||f>0)&&c.push(L({isCubic:!1,polylineFrom:t.slice(0,l+1),polylineTo:e.slice(0,f+1),toOppositeScale:0===f?u:s})),a>0){var d=n.indexOf(i[a-1]),h=r.indexOf(i[a-1]);(l-d>1||f-h>1)&&c.push(j({isCubic:!1,polylineFrom:t.slice(d,l+1),polylineTo:e.slice(h,f+1)}))}c.push(P({pointFrom:t[l],pointTo:e[f]})),a===i.length-1&&(t.length-l-1>0||e.length-f-1>0)&&c.push(L({isCubic:!1,polylineFrom:t.slice(l),polylineTo:e.slice(f),toOppositeScale:e.length-f==1?u:s}))}),0===c.length&&(e.length>0&&0===i.length||t.length>0&&0===i.length)&&c.push(F({isCubic:!1,polylineFrom:t.slice(0),polylineTo:e.slice(0)}));return function(t){var e=[];return c.forEach(function(n){var r=n(t);z(e,r)}),e}})(t,e)),r(i))}}function L(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=t.toOppositeScale,o=e.length>n.length?e:n,a=1===n.length,u=e[0].id!==n[0].id,s=Boolean(u!==a);return function(t){var e=(r?W:B)({t:t,polyline:o,decreasing:a,rightToLeft:s});a===s?e.shift():e.pop();var n=I(e.map(i),e,a?1-t:t);return n.forEach(function(t){return t.positionIsBeingChanged=!0}),n}}function j(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=e.length,o=n.length;if(o!==i){var a=o2){var i=function(t,e){for(var n,r,i=[e[0]],o=0;o0&&e0&&(t.positionIsBeingChanged=!0)}),e}}function z(t,e){return Array.prototype.push.apply(t,e)}function R(t,e,n){return void 0===e?t:"number"==typeof e?t+n*(e-t):e}function D(t,e,n){if(t===e)return e;var r={};return Object.keys(t).forEach(function(i){return r[i]=R(t[i],e[i],n)}),void 0!==e.id&&(r.id=e.id),r}function I(t,e,n){return t.map(function(t,r){return D(t,e[r],n)})}function B(t){var e=t.t,n=t.polyline,r=t.decreasing,i=t.rightToLeft,o=Boolean(r)!==Boolean(i),a=function(t,e){var n=0;if(t>0){for(var r,i,o,a,u=[0],s=0,c=1;c0){for(var i,o,a,u,s,c,l,f,d=[0],h=0,p=1;p0;o--)if((e=a[o][t])!==r)return n=u[o][t],void(d[t]=h(r,e,i,n));d[t]=function(t,e){return function(n){return n-t+e}}(r,i)}),function(t){var e=Object.assign({},t);return f.forEach(function(n){e[n]=d[n](t[n])}),e}}function U(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function G(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=C(t,n,r,i,o);return[a[1],a[2],a[4],a[5]].forEach(function(t){return t.isCubicControl=!0}),Object.keys(o).forEach(function(e){"x"!==e&&"y"!==e&&"id"!==e&&(a[3][e]=R(n[e],o[e],t))}),a}function q(t,e){if(t.length<2)return t.slice(0);if(2===t.length)return[t[0],{x:X(t[0].x,t[1].x,1/3),y:X(t[0].y,t[1].y,1/3)},{x:X(t[0].x,t[1].x,2/3),y:X(t[0].y,t[1].y,2/3)},t[1]];for(var n,r,i,o,a,u,s,c,l,f,d,h,p,g,m=new Array(3*(t.length-1)+1),y=m.length-1,v=0;v0&&(m[3*v-2]=T(1/3,t[v-1],t[v]),m[3*v-1]=T(2/3,t[v-1],t[v]));for(var b=m.slice(0),x=0;x<3;x++){for(m[1]={x:X(m[0].x,m[3].x,1/3),y:X(m[0].y,X(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:X(m[y].x,m[y-3].x,1/3),y:X(m[y].y,X(m[y-3].y,m[y-2].y,1.5),2/3)},e&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[y-1].y-m[y].y)*(m[y-3].y-m[y-2].y)<0&&(m[y-1]={x:m[y-1].x,y:m[y].y})),v=6;vn.y==s>i.y&&(p=X(p*(g=(i.y-r.y)/(s-r.y)),p,1/(1+Math.abs(g))),d=(i.y-r.y)/p),r.y>n.y==a0?[t,e].join(" "):e,s=n(i.text(u));if(su;if(l&&i){var f=Math.floor(u/c*s.length);t[t.length-1]=s.substr(0,f-4)+"...",p=!0}return l&&!i&&t.push(e),l||(t[t.length-1]=s),t},[""]).filter(function(t){return t.length>0});f=i?-1*(m.length-1)*Math.floor(.5*r):f,m.forEach(function(t,e){return a(s,t,1.1,l,f,d,e)}),h.remove()})};var nt=function(t,e,n){return e>0&&!document.hidden&&((t=t.transition(n).duration(e)).attr=rt),t.onTransitionEnd=function(t){return at(this,t),this},t},rt=function(t,e){var n,r,i=this,o=Z.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?r=t:arguments.length>1&&((n={})[t]=e,r=n);var a="__transitionAttrs__",u="__lastTransitions__",s=ot();this.each(function(){var t=this,e={};for(var n in r)"function"==typeof r[n]?e[n]=r[n].apply(this,arguments):e[n]=r[n];this[a]=Object.assign(this[a]||{},e),this[a][u]||Object.defineProperty(this[a],u,{value:{}}),Object.keys(e).forEach(function(e){return t[a][u][e]=s})});var c=function(){var t=this;this[a]&&(Object.keys(r).filter(function(e){return t[a][u][e]===s}).forEach(function(e){return delete t[a][e]}),0===Object.keys(this[a]).length&&delete this[a])};return this.on("interrupt."+s,function(){return i.each(c)}),this.on("end."+s,function(){return i.each(c)}),o},it=0,ot=function(){return++it},at=function(t,e){if(Z.transition.prototype.isPrototypeOf(t)&&!t.empty()){var n=function(){return e.call(null,t)};return t.on("interrupt.d3_on_transition_end",n),t.on("end.d3_on_transition_end",n),t}e.call(null,t)},ut=function(t,e,n,r){var i=r||function(t){return t},o=function(){i(this)};return function(r){var i=r;return e&&(i=i.call(lt(Zt(e,n)))),i=(i=nt(i,t)).call(lt(n)),t>0?i.on("end.d3_animationInterceptor",function(){return i.each(o)}):i.each(o),i}},st=function(t,e){var n=t.node();return t.selectAll(e).filter(function(){return this.parentNode===n})},ct=function(t,e,n,r,i){void 0===i&&(i="linear");var o="__pathPoints__";return function(t){var a=this;this[o]||(this[o]=n.map(function(){return[]}));var u=n.map(function(e,n){var u=Vt(t,r).map(e),s=($(i)||$("linear"))(u),c=a[o][n];return{pointsFrom:c,pointsTo:s,interpolate:N(c,s,J(i))}});return function(t){if(0===t){var n=u.map(function(t){return t.pointsFrom});return e.apply(void 0,n)}if(1===t){var r=u.map(function(t){return t.pointsTo});return a[o]=r,e.apply(void 0,r)}var i=u.map(function(e){return e.interpolate(t)});return a[o]=i,e.apply(void 0,i)}}},lt=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.attr(n,t[n])}),e}},ft=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.classed(n,t[n])}),e}},dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ht=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Zt(n.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),n.config.guide.size=n.config.guide.size||{};var r=n.config.stack,i=n.config.guide.enableColorToBarPosition,o=[e.flip&&O.get("flip"),r&&O.get("stack"),i&&O.get("positioningByColor")];return n.decorators=(n.config.transformRules||o).concat(e.transformModel||[]),n.adjusters=(n.config.adjustRules||[]).concat(e.adjustScales||[]),n}return dt(e,t),e.prototype.defineGrammarModel=function(t){var e=this,n=this.config;this.regScale("x",t("pos",n.x,[0,n.options.width])).regScale("y",t("pos",n.y,[n.options.height,0])).regScale("y",t("pos",n.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n.options.height]:[n.options.height,0]})).regScale("size",t("size",n.size,{})).regScale("color",t("color",n.color,{})).regScale("split",t("split",n.split,{})).regScale("label",t("label",n.label,{})).regScale("identity",t("identity",n.identity,{}));var r=this.getScale("x"),i=this.getScale("y"),o=this.getScale("size"),a=this.getScale("label"),u=this.getScale("color"),s=this.getScale("split"),c=this.getScale("identity"),l=i.domain(),f=i.discrete?l[0]:Math.max(0,Math.min.apply(Math,l)),d=i.value(f)+.5*i.stepSize(f),h=u.domain(),p={data:function(){return e.data()},flip:!1,scaleX:r,scaleY:i,scaleSize:o,scaleLabel:a,scaleColor:u,scaleSplit:s,scaleIdentity:c,color:function(t){return u.value(t[u.dim])},label:function(t){return a.value(t[a.dim])},group:function(t){return t[u.dim]+"(@taucharts@)"+t[s.dim]},order:function(t){var e=t.split("(@taucharts@)")[0],n=h.indexOf(e);return n<0?Number.MAX_VALUE:n},size:function(t){return o.value(t[o.dim])},id:function(t){return c.value(t[c.dim],t)},xi:function(t){return r.value(t[r.dim])},yi:function(t){return i.value(t[i.dim])},y0:function(){return d}};return p.data().forEach(function(t){return p.id(t)}),p},e.prototype.getGrammarRules=function(){return this.decorators.filter(function(t){return t})},e.prototype.getAdjustScalesRules=function(){return(this.adjusters||[]).filter(function(t){return t})},e.prototype.createScreenModel=function(t){var e=t.flip,n=function(t,e,n){return t?e:n};return{flip:e,id:t.id,x:n(e,t.yi,t.xi),y:n(e,t.xi,t.yi),x0:n(e,t.y0,t.xi),y0:n(e,t.xi,t.y0),size:t.size,group:t.group,order:t.order,label:t.label,color:function(e){return t.scaleColor.toColor(t.color(e))},class:function(e){return t.scaleColor.toClass(t.color(e))},model:t,toFibers:function(){var e=$t(t.data(),t.group);return Object.keys(e).sort(function(e,n){return t.order(e)-t.order(n)}).reduce(function(t,n){return t.concat([e[n]])},[])}}},e.prototype.drawFrames=function(){var t=this,e=this.config.options,n=function(e){return n=t.screenModel.size(e)/2,r=4,i=Math.pow(10,r),Math.round(i*n)/i;var n,r,i},r=ut,i=function(e,n,i){var o=t.config.guide.animationSpeed,u=e.selectAll("."+n).data(function(t){return[t]},t.screenModel.id);u.exit().call(r(o,null,{width:0},function(t){return a.select(t).remove()})),u.call(r(o,null,i)),u.enter().append("rect").style("stroke-width",0).call(r(o,{width:0},i))},o=this.config.flip,u=o?"y":"x",s=o?"x":"y",c=o?"x0":"y0",l=o?"height":"width",f=o?"width":"height",d=function(e){var r,o,a;i(e,"lvl-top",((r={})[l]=function(t){return n(t)},r[f]=1,r[u]=function(e){return t.screenModel[u](e)-n(e)/2},r[s]=function(e){return t.screenModel[s](e)},r.fill=function(e){return t.screenModel.color(e)},r.class=function(e){return"lvl-top "+t.screenModel.class(e)},r)),i(e,"lvl-btm",((o={})[l]=function(t){return n(t)},o[f]=1,o[u]=function(e){return t.screenModel[u](e)-n(e)/2},o[s]=function(e){return t.screenModel[c](e)},o.fill=function(e){return t.screenModel.color(e)},o.class=function(e){return"lvl-btm "+t.screenModel.class(e)},o)),i(e,"lvl-link",((a={})[l]=.5,a[f]=function(e){return Math.abs(t.screenModel[s](e)-t.screenModel[c](e))},a[u]=function(e){return t.screenModel[u](e)-.25},a[s]=function(e){return Math.min(t.screenModel[s](e),t.screenModel[c](e))},a.fill=function(e){return t.screenModel.color(e)},a.class=function(e){return"lvl-link "+t.screenModel.class(e)},a))},h=function(e){e.attr("class","frame-id-"+t.config.uid).call(function(e){var n=e.selectAll(".generic").data(function(t){return t},t.screenModel.id);n.exit().remove(),n.call(d),n.enter().append("g").attr("class","generic").call(d)})},p=$t(this.data(),t.screenModel.group),g=Object.keys(p).sort(function(e,n){return t.screenModel.order(e)-t.screenModel.order(n)}).reduce(function(t,e){return t.concat([p[e]])},[]),m=e.container.selectAll(".frame-id-"+t.config.uid).data(g);m.exit().remove(),m.call(h),m.enter().append("g").call(h)},e}(m),pt=function(){return(pt=Object.assign||function(t){for(var e,n=1,r=arguments.length;nthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,n),this.depth--,n}},r.DeepCopier=e,r.deepCopiers=t,r.register=function(n){n instanceof e||(n=new e(n)),t.unshift(n)},r.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?"object"==typeof(e=t.constructor.prototype)?JSON.parse(JSON.stringify(e)):e:{};var e},populate:function(t,e,n){for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}}),r.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,n){for(var r=0;r":">",'"':""","'":"'","`":"`"},_t={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},St=/\\|'|\r|\n|\u2028|\u2029/g,Mt="(?:"+Object.keys(wt).join("|")+")",Ot=RegExp(Mt),At=RegExp(Mt,"g"),kt={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function Et(t){return vt(t)}function Tt(t){return t instanceof Date&&!isNaN(Number(t))}function Ct(t){return null!=t&&"object"==typeof t}function Nt(t){var e=parseFloat(Math.min.apply(Math,t).toFixed(15)),n=parseFloat(Math.max.apply(Math,t).toFixed(15));e===n&&(n-=(n>=0?-1:1)*(n||1)/10);for(var r=[e=Math.min(0,e),n=Math.max(0,n)],i=r[1]-r[0],o=Math.pow(10,Math.floor(Math.log(i/10)/Math.LN10)),a=10/i*o,u=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],s=-1;a>u[++s][0];);o*=u[s][1],r[0]=Math.floor(r[0]/o)*o,r[1]=Math.ceil(r[1]/o)*o;var c=e-r[0],l=r[1]-n,f=o/2;if(e<0){var d=c>=f?-c:0;r[0]=r[0]-d}if(n>0){var h=l>=f?-l:0;r[1]=r[1]+h}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Lt(t,e,n){var r=(void 0===n?{utc:!1}:n).utc,i=gt.extent(t),o=i[0],a=i[1],u=+a-+o,s=r?gt.scaleUtc:gt.scaleTime;if(0===u){return o=new Date(o.getTime()-864e5),a=new Date(a.getTime()+864e5),s().domain([o,a]).nice(e).domain()}var c=s().domain([o,a]).nice(e);if(e)return c.domain();var l=s().domain([o,a]).nice(e).domain(),f=l[0],d=l[1],h=c.ticks(),p=h.length-1;return(+o-+f)/(+h[1]-+f)<.5&&(o=f),(+d-+a)/(+d-+h[p-1])<.5&&(a=d),[o,a]}var jt=0,Pt={};function Ft(t){var e=btoa(encodeURIComponent(t)).replace(/=/g,"_");return Pt.hasOwnProperty(e)||(Pt[e]="H"+ ++jt),Pt[e]}function zt(t,e,n){var r=0,i=null,o=te(function(t,e){return Vt(t.map(function(t){return e.reduce(function(e,n){return e.concat(Tt(r=t[n])?r.getTime():r);var r},[])}),function(t){return JSON.stringify(t)}).reduce(function(t,e){var n=e[0];return t[n]=t[n]||0,t[n]+=1,t},{})},function(t,e){var n=i===t?r:++r;return i=t,e.join("")+"-"+n});return function(r,i,a){var u=a.length,s=n.getSpec(),c=s.sources["/"].data,l=s.unit.units[0].guide||{};l.padding=l.padding||{l:0,r:0,t:0,b:0};var f=0;"x"===t?f=l.padding.l+l.padding.r:"y"===t&&(f=l.padding.t+l.padding.b);var d,h=(i-u*f)/(d=o(c,e),Object.keys(d).reduce(function(t,e){return t+d[e]},0));return(function(t,e){return o(c,t)[e]}(e,r)*h+f)/i}}function Rt(t){var e=!0;try{yt(t,function(t){if(0===t.type.indexOf("COORDS.")&&"COORDS.RECT"!==t.type)throw new Error("Not applicable")},function(t){return t})}catch(t){"Not applicable"===t.message&&(e=!1)}return e}function Dt(t,e,n,r){if(void 0===r&&(r=0),"requestAnimationFrame"===r){var i=!1;return function(){for(var r=[],o=0;o=r&&n.apply(this,i),t.e=a.e,t.ts=a.ts}}function It(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),o=e>=2?Gt(e-2).map(function(t){return n+i*(t+1)}):[];return[n].concat(o,[r])}function Bt(t){return bt(t)?t:""}function Wt(t){return bt(t)?"":t}function Ht(t){return t/180*Math.PI}function Ut(t){return Math.abs(t)>=360&&(t%=360),t<0&&(t=360+t),t}function Gt(t,e){1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r100}function Xt(t,e,n,r){return t+e*(-90===n?-1:1)-r>20}function Yt(t){return Array.isArray(t)?[].concat.apply([],t.map(function(t){return Yt(t)})):t}function Vt(t,e){for(var n={},r=[],i=t.length,o=e||function(t){return String(t)},a=0;a/g,">").replace(/"/g,""").replace(/'/g,"'")}var ae=" ",ue=32,se=["img","input","br","embed","link","meta","area","base","basefont","bgsound","col","command","frame","hr","image","isindex","keygen","menuitem","nextid","param","source","track","wbr","circle","ellipse","line","path","polygon","rect"].reduce(function(t,e){return t[e]=!0,t},{});function ce(t){var e=2,n=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(e=1,n={});var r=Yt(Array.prototype.slice.call(arguments,e)),i=1===r.length&&"<"!==r[0].trim()[0],o=se[t];if(o&&r.length>0)throw new Error('Tag "'+t+'" is void but content is assigned to it');var a="<"+t,u=Object.keys(n).map(function(t){return" "+t+'="'+n[t]+'"'}).join("");u.length>ue&&(u=Object.keys(n).map(function(t){return"\n"+ae+t+'="'+n[t]+'"'}).join(""));var s=i?r[0]:"\n"+r.map(function(t){return String(t).split("\n").map(function(t){return""+ae+t}).join("\n")}).join("\n")+"\n";return""+a+u+(o?"/>":">"+s+"")}function le(t){var e=t,n={then:function(t){return e=t(e),n},result:function(){return e}};return n}var fe=[ht];function de(t){return fe.some(function(e){return t instanceof e})}function he(t){return(t.units||[]).some(function(t){return t.hasOwnProperty("units")})}var pe=document.createElement("div"),ge=new WeakMap;function me(t,e){var n;return t instanceof Node?n=t:(pe.insertAdjacentHTML("afterbegin",t),n=pe.childNodes[0]),e.appendChild(n),n}function ye(t){if(ge.has(t))return ge.get(t);var e=t.style.overflow;t.style.overflow="scroll";var n={width:t.offsetWidth-t.clientWidth,height:t.offsetHeight-t.clientHeight};return t.style.overflow=e,ge.set(t,n),n}function ve(t,e){var n="horizontal"===(e=e||"both")||"both"===e,r="vertical"===e||"both"===e,i=ye(t),o=r?i.width+"px":"0",a=n?i.height+"px":"0";t.style.overflow="hidden",t.style.padding="0 "+o+" "+a+" 0";var u=t.scrollWidth>t.clientWidth,s=t.scrollHeight>t.clientHeight,c=r&&!s?i.width+"px":"0",l=n&&!u?i.height+"px":"0";return t.style.padding="0 "+c+" "+l+" 0",t.style.overflow="",t.style.overflowX=u?"scroll":"hidden",t.style.overflowY=s?"scroll":"hidden",i}function be(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function xe(t,e){return parseInt(be(t,e)||"0",10)}function we(t){var e=xe(t,"padding-left"),n=xe(t,"padding-right"),r=xe(t,"padding-bottom"),i=xe(t,"padding-top"),o=xe(t,"border-top-width")+xe(t,"border-left-width")+xe(t,"border-right-width")+xe(t,"border-bottom-width"),a=t.getBoundingClientRect();return{width:a.width-e-n-2*o,height:a.height-r-i-2*o}}function _e(t){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",e.style.width="100px",e.style.height="100px",e.style.border="1px solid green",e.style.top="0",document.body.appendChild(e),e.innerHTML='\n \n \n \n \n \n ';var n=e.querySelector(".x.axis .tick text");n.textContent=t;var r={width:0,height:0},i=n.getBoundingClientRect();r.width=i.right-i.left,r.height=i.bottom-i.top;var o=0!==t.length?r.width/t.length:0;return r.width=r.width+1.5*o,document.body.removeChild(e),r}function Se(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o="string"==typeof n?n:n+"px",a=t.map(function(t){for(var e=0,n=0;e<=t.length-1;e++){n+=Me(t.charAt(e),{fontSize:o,fontFamily:r,fontWeight:i}).width}return n}).sort(function(t,e){return e-t})[0],u=t.length,s=parseInt(o);return{width:a,height:s*u+.39*s*u}}var Me=te(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=document.createElement("div");o.style.position="absolute",o.style.visibility="hidden",o.style.border="0px",o.style.top="0",o.style.fontSize=n,o.style.fontFamily=r,o.style.fontWeight=i,document.body.appendChild(o),o.innerHTML=" "===t?" ":t;var a={width:0,height:0},u=o.getBoundingClientRect();return a.width=u.right-u.left,a.height=u.bottom-u.top,document.body.removeChild(o),a},function(t,e){return t+"_"+JSON.stringify(e)});function Oe(t,e){var n={".":function(t,e){return e.classed(t,!0)},"#":function(t,e){return e.attr("id",t)}},r=Object.keys(n).join("");if(e.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(e[0])>=0)throw new Error("Selector must have tag at the beginning.");var i,o=t instanceof Element,u=o?a.select(t):t,s=function(t){return o?t.node():t},c=u.selectAll(e).filter(function(){return this.parentNode===u.node()}).filter(function(t,e){return 0===e});if(!c.empty())return s(c);for(var l,f=-1,d=null,h=1,p=e.length;h<=p;h++)(h==p||r.indexOf(e[h])>=0)&&(l=e.substring(f+1,h),f<0?i=u.append(l):n[d].call(null,l,i),d=e[h],f=h);return s(i)}function Ae(t,e){return ke(t,e)[0]||null}function ke(t,e){for(var n=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=t.firstElementChild;Boolean(i);i=i.nextElementSibling)r.call(i,e)&&n.push(i);return n}function Ee(t,e){if(t.childElementCount>0){var n,r,i=Array.prototype.filter.call(t.childNodes,function(t){return t.nodeType===Node.ELEMENT_NODE}),o=i.slice().sort(e),a=i.reduce(function(t,e,n){return t.set(e,n),t},new Map),u=o.reduce(function(t,e,i){var u=a.get(e),s=i-u;return s!==r&&(n&&t.push(n),r=s,n={from:u,to:i,elements:[]}),n.elements.push(e),i===o.length-1&&t.push(n),t},[]),s=u.slice().sort(function(t,e){return t.from-e.from}),c=s.reduce(function(t,e,n){return t.set(e,n),t},new Map),l=function(t){for(var e,n,r,i=u.map(function(t,e){return{elements:t.elements,from:c.get(t),to:e}}).sort(ee(function(t,e){return t.elements.length-e.elements.length},t?function(t,e){return e.to-t.to}:function(t,e){return t.to-e.to})),o=0;on.to)for(e=o+1;e=n.to&&r.fromn.from&&r.from<=n.to&&r.from--}return i.filter(function(t){return t.from!==t.to})},f=l(!0),d=l(!1),h=f.length=0?"h":"v"}function Pe(t){var e={x:0,y:0},n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}return e}function Fe(t,e,n,r,i,o,a,u){var s,c,l,f,d,h;return h=((l=a-i)*(e-o)-(f=u-o)*(t-i))/(-l*(c=r-e)+(s=n-t)*f),(d=(-c*(t-i)+s*(e-o))/(-l*c+s*f))>=0&&d<=1&&h>=0&&h<=1}function ze(t){for(var e,n,r={x:0,y:0},i=t;i&&"SVG"!==i.nodeName.toUpperCase();)(n=i.getAttribute("transform"))&&(e=Pe(n),r.x+=e.x,r.y+=e.y),i=i.parentNode;return r}function Re(t,e,n){var r=t.selectAll(e).filter(n);if(!r.empty()){var i=a.select(r.node().parentNode).selectAll(e).filter(function(t){return!n(t)}).nodes(),o=i[i.length-1];if(o){var u=Array.prototype.indexOf.call(o.parentNode.childNodes,o),s=o.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>u||this.parentNode.insertBefore(this,s)})}}}var De=function(t){return Tt(t)?t.getTime():t},Ie={cross:function(t,e,n){var r=t(),i=Vt(r.map(function(t){return t[e]}),De),o=Vt(r.map(function(t){return t[n]}),De),a=0===i.length?[null]:i;return(0===o.length?[null]:o).reduce(function(t,r){return t.concat(a.map(function(t){var i={};return e&&(i[e]=De(t)),n&&(i[n]=De(r)),i}))},[])},cross_period:function(t,e,n,r,i,o){var a=t(),u=!!o&&o.utcTime,s=Vt(a.map(function(t){return t[e]}),De),c=Vt(a.map(function(t){return t[n]}),De),l=0===s.length?[null]:s,f=0===c.length?[null]:c;return r&&(l=x.generate(Math.min.apply(Math,s),Math.max.apply(Math,s),r,{utc:u})),i&&(f=x.generate(Math.min.apply(Math,c),Math.max.apply(Math,c),i,{utc:u})),f.reduce(function(t,r){return t.concat(l.map(function(t){var i={};return e&&(i[e]=De(t)),n&&(i[n]=De(r)),i}))},[])},groupBy:function(t,e){return Vt(t().map(function(t){return t[e]}),De).map(function(t){var n;return(n={})[e]=De(t),n})},none:function(){return[null]}},Be=function(){function t(t,e,n){var r=t.key,i=t.pipe,o=t.source,a=t.units;void 0===n&&(n={}),this.key=r,this.pipe=i||[],this.source=o,this.units=a,this._frame={key:r,source:o,pipe:this.pipe},this._data=e,this._pipeReducer=function(t,e){return n[e.type](t,e.args)}}return t.prototype.hash=function(){return Ft([this._frame.pipe,this._frame.key,this._frame.source].map(function(t){return JSON.stringify(t)}).join(""))},t.prototype.full=function(){return this._data},t.prototype.part=function(t){return void 0===t&&(t=function(t){return t}),this._frame.pipe.map(t).reduce(this._pipeReducer,this._data)},t}(),We=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),He=function(t){return Tt(t)?t.getTime():t},Ue=function(t){var e=this;Object.keys(t).forEach(function(n){return e[n]=t[n]})},Ge=function(t,e,n){return t.map(function(t){return"string"==typeof t?n.get(t):t}).filter(function(t){return t}).reduce(function(t,e){return n=t,void 0===(r=e(t,{}))&&(r={}),Object.assign(new Ue(n),r);var n,r},e)},qe=function(t){function e(e,n,r,i){var o=t.call(this)||this;return Zt(e.scales,{size_null:{type:"size",source:"?"},split_null:{type:"value",source:"?"},label_null:{type:"value",source:"?"},color_null:{type:"color",source:"?"},identity_null:{type:"identity",source:"?"},"size:default":{type:"size",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"},"label:default":{type:"value",source:"?"},"identity:default":{type:"identity",source:"?"}}),e.settings=e.settings||{},o.config=e,o.sources=e.sources,o.scales=e.scales,o.unitSet=r,o.grammarRules=i,o.scalesHub=n,o.transformations=Object.assign(e.transformations||{},{where:function(t,e){var n=Object.keys(e||{}).map(function(t){return function(n){return He(n[t])===e[t]}});return t.filter(function(t){return n.every(function(e){return e(t)})})}}),o}return We(e,t),e.traverseSpec=function(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null);var o=[],a=function(t,e,n,r,i){o.push(function(){e(t,r,i)}),t.frames&&t.frames.forEach(function(r){(r.units||[]).map(function(i){return a(i,e,n,t,r)})}),o.push(function(){return n(t,r,i)})};return a(t.unit,e,n,r,i),o},e.prototype.unfoldStructure=function(){return this.root=this._expandUnitsStructure(this.config.unit),this.config},e.prototype.getDrawScenarioQueue=function(t){var e=this,n=this.grammarRules,r=this._flattenDrawScenario(t,function(t,r,i){var o=!1===r.expression.inherit?null:i,a=e._createFrameScalesFactoryMethod(o),u=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),s=new Ue(u.defineGrammarModel(a)),c=Ge(u.getGrammarRules(),s,n);return Ge(u.getAdjustScalesRules(),c,n),u.node().screenModel=u.createScreenModel(c),u}),i=this._flattenDrawScenario(t,function(t,r,i){var o=!1===r.expression.inherit?null:i,a=e._createFrameScalesFactoryMethod(o),u=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),s=new Ue(u.defineGrammarModel(a)),c=Ge(u.getGrammarRules(),s,n);return u.node().screenModel=u.createScreenModel(c),u.parentUnit=t,u.addInteraction(),u});return r.concat(function(){Object.keys(e.scales).forEach(function(t){return e.scalesHub.createScaleInfo(e.scales[t]).commit()})}).concat(i)},e.prototype._flattenDrawScenario=function(t,n){var r={},i=[],o=[t],a=e.traverseSpec({unit:this.root},function(t,e,a){var u;t.uid=(u=Ft((e?e.uid+"/":"")+JSON.stringify(Object.keys(t).filter(function(e){return"string"==typeof t[e]}).reduce(function(e,n){return e[n]=t[n],e},{}))+"-"+JSON.stringify(a.pipe)),r.hasOwnProperty(u)?u+="-"+ ++r[u]:r[u]=0,u),t.guide=Et(t.guide);var s,c=n(o[0],t,a);i.push(c),0===t.type.indexOf("COORDS.")&&(s=c,o.unshift(s))},function(t){0===t.type.indexOf("COORDS.")&&o.shift()},null,this._datify({source:this.root.expression.source,pipe:[]}));return a.push(function(){return i}),a},e.prototype._expandUnitsStructure=function(t,e){var n=this;void 0===e&&(e=[]);var r=this;if(!1===t.expression.operator)t.frames=t.frames.map(function(t){return r._datify(t)});else{var i=this._parseExpression(t.expression,e,t.guide);t.transformation=t.transformation||[],t.frames=i.exec().map(function(n){var o=(i.inherit?e:[]).concat([{type:"where",args:n}]).concat(t.transformation);return r._datify({key:n,pipe:o,source:i.source,units:t.units?t.units.map(function(t){var e=Et(t);return e.guide=t.guide,e}):[]})})}return t.frames.forEach(function(t){return t.units.forEach(function(e){return n._expandUnitsStructure(e,t.pipe)})}),t},e.prototype._createFrameScalesFactoryMethod=function(t){var e=this;return function(n,r,i){var o=r||n+":default";return e.scalesHub.createScaleInfo(e.scales[o],t).create("function"==typeof i?i(e.scales[o]):i)}},e.prototype._datify=function(t){return new Be(t,this.sources[t.source].data,this.transformations)},e.prototype._parseExpression=function(t,e,n){var r=this,i=t.operator||"none",o=t.source,a=!1!==t.inherit,u=t.params,s={source:o,pipe:a?e:[]},c=function(){return r._datify(s).part()},l=Ie[i];if(!l)throw new Error(i+" operator is not supported");return{source:o,inherit:a,func:l,args:u,exec:function(){return l.apply(void 0,[c].concat(u||[],[n]))}}},e}(h),Xe="tau-chart__",Ye=n(10),Ve=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Ye.Tooltip.defaults.baseClass=Xe+"tooltip";var $e=["top","bottom"];var Je,Ke,Ze=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ve(e,t),e.prototype._pickPlace=function(t){if(!this.options.auto)return this.options.place;var e,n,r,i,o,a,u,s,c=0|this.options.winBound,l=(e=c,r=window,i=document.documentElement,o=(r.pageYOffset||i.scrollTop)-i.clientTop,a=(r.pageXOffset||i.scrollLeft)-i.clientTop,u=r.innerWidth||i.clientWidth,s=r.innerHeight||i.clientHeight,{top:(n={top:o,right:a+u,bottom:o+s,left:a,width:u,height:s}).top+e,right:n.right-e,bottom:n.bottom-e,left:n.left+e,width:n.width-2*e,height:n.height-2*e}),f=this.options.place.split("-"),d=this.spacing;if(-1!==$e.indexOf(f[0]))switch(t.top-this.height-d<=l.top?f[0]="bottom":t.bottom+this.height+d>=l.bottom&&(f[0]="top"),f[1]){case"left":t.right-this.width<=l.left&&(f[1]="right");break;case"right":t.left+this.width>=l.right&&(f[1]="left");break;default:t.left+t.width/2+this.width/2>=l.right?f[1]="left":t.right-t.width/2-this.width/2<=l.left&&(f[1]="right")}else switch(t.left-this.width-d<=l.left?f[0]="right":t.right+this.width+d>=l.right&&(f[0]="left"),f[1]){case"top":t.bottom-this.height<=l.top&&(f[1]="bottom");break;case"bottom":t.top+this.height>=l.bottom&&(f[1]="top");break;default:t.top+t.height/2+this.height/2>=l.bottom?f[1]="top":t.bottom-t.height/2-this.height/2<=l.top&&(f[1]="bottom")}return f.join("-")},e}(Ye.Tooltip),Qe=function(){function t(t,e){this.chart=e,this.handlers=new Map,this.plugins=t.map(this.initPlugin,this)}return t.prototype.initPlugin=function(t){var e=this;t.init&&t.init(this.chart);var n=[];this.handlers.set(t,n);var r=function(r,i){n.push(e.chart.on(r,i,t))};return t.destroy&&r("destroy",t.destroy.bind(t)),Object.keys(t).forEach(function(e){if(0===e.indexOf("on")){var n=e.substr(2).toLowerCase();r(n,t[e].bind(t))}}),t},t.prototype.destroyPlugin=function(t){var e=this;t.destroy&&t.destroy(),this.handlers.get(t).forEach(function(n){e.chart.removeHandler(n,t)})},t.prototype.destroy=function(){var t=this;this.plugins.forEach(function(e){return t.destroyPlugin(e)})},t}(),tn={},en={},nn={reg:function(t,e,n){return n?(en[t]=n,tn[t]=function(t,e){this.___tauchartsseed___=new e(this.init(t))},tn[t].prototype=Object.assign({init:function(t){return t},defineGrammarModel:function(t){return this.node().defineGrammarModel(t)},getGrammarRules:function(t){return this.node().getGrammarRules(t)},getAdjustScalesRules:function(t){return this.node().getAdjustScalesRules(t)},createScreenModel:function(t){return this.node().createScreenModel(t)},addInteraction:function(){this.node().addInteraction()},node:function(){return this.___tauchartsseed___},draw:function(){this.node().draw()}},e)):tn[t]=e,this},get:function(t){if(!tn.hasOwnProperty(t))throw new _("Unknown unit type: "+t,S.UNKNOWN_UNIT_TYPE);return tn[t]},create:function(t,e){var n,r=this.get(t);en[t]?n=new r(e,this.get(en[t])):n=new r(e);return n}},rn={},on={},an={reg:function(t,e,n){return void 0===n&&(n=function(t){return t}),rn[t]=e,on[t]=n,an},get:function(t){return rn[t]},instance:function(t){return void 0===t&&(t={}),{create:function(e,n,r){return new(an.get(e))(n,(0,on[e])(r,t))}}}},un=function(){function t(t,e,n){this.registry=t,this.sources=e,this.scales=n}return t.prototype.createScaleInfo=function(t,e){void 0===e&&(e=null);var n=t.dim,r=t.source,i=(this.sources[r].dims[n]||{}).type,o=this.sources[r].data,a=e||new Be({source:r},o);return t.dimType=i,this.registry.create(t.type,a,t)},t.prototype.createScaleInfoByName=function(t,e){return void 0===e&&(e=null),this.createScaleInfo(this.scales[t],e)},t}(),sn=function(t,e,n){var r=!0,i=null;try{t.reduce(function(t,r){var o=function(t,e){var n=r[e],i=Ct(n)?JSON.stringify(n):n;return t.push(i),t},a=e.reduce(o,[]).join("/"),u=n.reduce(o,[]).join("/");if(t.hasOwnProperty(a)){var s=t[a];if(s!==u)throw i={type:"RelationIsNotAFunction",keyX:e.join("/"),keyY:n.join("/"),valX:a,errY:[s,u]},new Error("RelationIsNotAFunction")}else t[a]=u;return t},{})}catch(t){if("RelationIsNotAFunction"!==t.message)throw t;r=!1}return{result:r,error:i}},cn=function(t,e){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||e.push(n),e},[]);return function(t){var r=!n.some(function(e){return!t.hasOwnProperty(e)||null===t[e]});return r||e(t),r}},ln=function(t){var e={category:"ordinal",order:"ordinal",measure:"linear"},n={};return Object.keys(t).forEach(function(r){var i=t[r],o=(i.type||"category").toLowerCase();n[r]=Object.assign({},i,{type:o,scale:i.scale||e[o],value:i.value})}),n},fn=function(t){var e={type:"category",scale:"ordinal"};return t.reduce(function(t,n){return Object.keys(n).forEach(function(r){var i=n.hasOwnProperty(r)?n[r]:null;if(t[r]=t[r]||{type:null,hasNull:!1},null===i)t[r].hasNull=!0;else{var o=function(t,e){var n=e;return Tt(t)?(n.type="measure",n.scale="time"):Ct(t)?(n.type="order",n.scale="ordinal"):Number.isFinite(t)&&(n.type="measure",n.scale="linear"),n}(i,Et(e)),a=o.type,u=o.scale,s=null!==t[r].type&&t[r].type!==a;t[r].type=s?e.type:a,t[r].scale=s?e.scale:u}}),t},{})},dn=function(t,e,n){var r=t,i=["period","time"].indexOf(n.scale)>=0?function(t){return new Date(t)}:function(t){return t},o=t.reduce(function(t,e,n){return t.set(e,n),t},new Map);if("measure"===n.type||"period"===n.scale)r=t.slice().sort(ee(function(t,n){return i(t[e])-i(n[e])},function(t,e){return o.get(t)-o.get(e)}));else if(n.order){var a=n.order.reduce(function(t,e,n){return t[e]=n,t},{}),u=n.order.length,s="(___"+e+"___)";r=t.map(function(t){var n=a[t[e]];return n=n>=0?n:u,t[s]=n,t}).sort(ee(function(t,e){return t[s]-e[s]},function(t,e){return o.get(t)-o.get(e)})).map(function(t){return delete t[s],t})}return r},hn=function(t,e){var n=document.createElement("div");return n.classList.add(Xe+t),e&&e.appendChild(n),n},pn=function(){var t=hn("layout"),e=hn("layout__header",t),n=hn("layout__container",t),r=hn("layout__sidebar",n),i=hn("layout__content",n),o=hn("layout__content__wrap",i),a=hn("layout__sidebar-right",n);return{layout:t,header:e,content:o,contentContainer:i,leftSidebar:r,rightSidebar:hn("layout__sidebar-right__wrap",a),rightSidebarContainer:a,footer:hn("layout__footer",t)}},gn=function(){function t(t){this.spec=t,this.dist={sources:{"?":{dims:{},data:[{}]},"/":{dims:{},data:[]}},scales:{x_null:{type:"ordinal",source:"?"},y_null:{type:"ordinal",source:"?"},size_null:{type:"size",source:"?"},color_null:{type:"color",source:"?"},split_null:{type:"value",source:"?"},"pos:default":{type:"ordinal",source:"?"},"size:default":{type:"size",source:"?"},"label:default":{type:"value",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"}},settings:t.settings}}return t.prototype.convert=function(){var t=this.spec,e=this.dist;return this.ruleAssignSourceDims(t,e),this.ruleAssignStructure(t,e),this.ruleAssignSourceData(t,e),this.ruleApplyDefaults(e),e},t.prototype.ruleApplyDefaults=function(t){var e=t.settings||{},n=function(t,e,r){e(t,r),(t.units||[]).map(function(r){return n(r,e,t)})};n(t.unit,function(t,n){if(t.namespace="chart",t.guide=Zt(t.guide||{},{animationSpeed:e.animationSpeed||0,utcTime:e.utcTime||!1}),n&&!t.hasOwnProperty("units")){t=Zt(t,{x:n.x,y:n.y});var r=Et(n.guide)||{};t.guide.x=Zt(t.guide.x||{},r.x),t.guide.y=Zt(t.guide.y||{},r.y),t.expression.inherit=n.expression.inherit}return!n||t.guide&&t.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(t.guide=Object.assign(t.guide||{},{obsoleteVerticalStackOrder:(n.guide||{}).obsoleteVerticalStackOrder})),t},null)},t.prototype.ruleAssignSourceData=function(t,e){var n=t.spec.dimensions||{},r=e.sources["/"].dims,i=function(t,e){var n=t[e];return Ct(n)&&!Tt(n)&&Object.keys(n).forEach(function(r){return t[e+"."+r]=n[r]}),t};e.sources["/"].data=t.data.map(function(t){var e=Object.keys(t).reduce(i,t);return Object.keys(r).reduce(function(t,e){return t.hasOwnProperty(e)||(t[e]=null),null!==t[e]&&n[e]&&["period","time"].indexOf(n[e].scale)>=0&&(t[e]=new Date(t[e])),t},e)})},t.prototype.ruleAssignSourceDims=function(t,e){var n=t.spec.dimensions;e.sources["/"].dims=Object.keys(n).reduce(function(t,e){return t[e]={type:n[e].type},t},{})},t.prototype.ruleAssignStructure=function(t,e){var n=this,r=function(t){var i=Et(Qt(t,"unit"));return n.ruleCreateScales(t,i,e.settings),i.expression=n.ruleInferExpression(t),t.unit&&(i.units=t.unit.map(r)),i},i=r(t.spec.unit);i.expression.inherit=!1,e.unit=i},t.prototype.ruleCreateScales=function(t,e,n){var r=this,i=t.guide||{};["identity","color","size","label","x","y","split"].forEach(function(o){t.hasOwnProperty(o)&&(e[o]=r.scalesPool(o,t[o],i[o]||{},n))})},t.prototype.ruleInferDim=function(t,e){var n=t,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(n))return n;e.hasOwnProperty("tickLabel")?n=t+"."+e.tickLabel:r[t].value&&(n=t+"."+r[t].value);var i=this.dist.sources["/"].dims;return i.hasOwnProperty(n)||(i[n]={type:i[t].type},delete i[t]),n},t.prototype.scalesPool=function(t,e,n,r){var i=t+"_"+e;if(this.dist.scales.hasOwnProperty(i))return i;var o=this.spec.spec.dimensions,a={};if("color"===t&&null!==e&&(a={type:"color",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("brewer")&&(a.brewer=n.brewer),o[e]&&o[e].hasOwnProperty("order")&&(a.order=o[e].order),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("nice")&&(a.nice=n.nice)),"size"===t&&null!==e&&(a={type:"size",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("func")&&(a.func=n.func),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("minSize")&&(a.minSize=n.minSize),n.hasOwnProperty("maxSize")&&(a.maxSize=n.maxSize)),"label"===t&&null!==e&&(a={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"split"===t&&null!==e&&(a={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"identity"===t&&null!==e&&(a={type:"identity",source:"/",dim:this.ruleInferDim(e,n)}),o.hasOwnProperty(e)&&("x"===t||"y"===t)){if(a={type:o[e].scale,source:"/",dim:this.ruleInferDim(e,n)},o[e].hasOwnProperty("order")&&(a.order=o[e].order),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("autoScale")?a.autoScale=n.autoScale:a.autoScale=!0,n.hasOwnProperty("nice")?a.nice=n.nice:a.nice=a.autoScale,n.hasOwnProperty("niceInterval")?a.niceInterval=n.niceInterval:a.niceInterval=null,n.hasOwnProperty("tickPeriod")&&(a.period=n.tickPeriod,a.type="period"),n.hasOwnProperty("tickPeriod")&&n.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(n.hasOwnProperty("timeInterval")){a.period=n.timeInterval,a.type="time";var u=x.get(a.period,{utc:r.utcTime});n.hasOwnProperty("min")&&(a.min=u.cast(new Date(n.min))),n.hasOwnProperty("max")&&(a.max=u.cast(new Date(n.max)))}a.fitToFrameByDims=n.fitToFrameByDims,a.ratio=n.ratio}return this.dist.scales[i]=a,i},t.prototype.getScaleConfig=function(t,e){var n=t+"_"+e;return this.dist.scales[n]},t.prototype.ruleInferExpression=function(t){var e={operator:"none",params:[]},n=t.guide||{},r=n.x||{},i=n.y||{},o=this.getScaleConfig("x",t.x),a=this.getScaleConfig("y",t.y);return 0===t.type.indexOf("ELEMENT.")?t.color&&(e={operator:"groupBy",params:[this.ruleInferDim(t.color,n.color||{})]}):"COORDS.RECT"===t.type&&1===t.unit.length&&"COORDS.RECT"===t.unit[0].type&&(e=o.period||a.period?{operator:"cross_period",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i),o.period,a.period]}:{operator:"cross",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i)]}),Object.assign({inherit:!0,source:"/"},e)},t}(),mn=n(6),yn=n(7),vn=function(){return(vn=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.computed?{value:n,computed:r}:t},{}).value;return n(e(o))},Ln=function(t,e){var n=t.dimType,r=t.scaleType,i=[n,r,"*"].join(":"),o=[n,r].join(":");return e[i]||e[o]||e[n]||null},jn=function(t,e,n){return t.hasOwnProperty(e+":"+n)?t[e+":"+n]:t[""+e]},Pn=function(t,e){return["day","week","month"].indexOf(t)>=0&&(t+="-short"+(e?"-utc":"")),t},Fn=function(t,e){var n=t.width,r=t.height,i=Math.abs(Ht(e));return{width:Math.max(Math.cos(i)*n,r),height:Math.max(Math.sin(i)*n,r)}},zn=function(t,e){void 0===e&&(e="x");var n=Ut(t),r="x"===e?[[0,45,"middle"],[45,135,"start"],[135,225,"middle"],[225,315,"end"],[315,360,"middle"]]:[[0,90,"end"],[90,135,"middle"],[135,225,"start"],[225,315,"middle"],[315,360,"end"]],i=r.findIndex(function(t){return n>=t[0]&&ne.xAxisTickLabelLimit&&(t.x.tickFormatWordWrap=!0,t.x.tickFormatWordWrapLines=e.xTickWordWrapLinesLimit,d=Rn(l,e.xAxisTickLabelLimit,e.xTickWordWrapLinesLimit)),f.width>e.yAxisTickLabelLimit&&(t.y.tickFormatWordWrap=!0,t.y.tickFormatWordWrapLines=e.yTickWordWrapLinesLimit,h=Rn(f,e.yAxisTickLabelLimit,e.yTickWordWrapLinesLimit)),o&&(t.y.tickFormatWordWrap=!1,t.y.tickFormatWordWrapLines=1,(h=Rn(f,2*e.yAxisTickLabelLimit,1)).width=20);var p=s?0:1,g=c?0:1,m=t.x.label,y=t.y.label,v=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,x=Fn(d,t.x.rotate),w=Fn(h,t.y.rotate);i?(m.padding=(-e.xAxisPadding-e.xFontLabelHeight)/2+e.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-e.yAxisPadding-e.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,v=0,b=0):(m.padding=An([p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight)]),m.paddingNoTicks=v*(e.distToXAxisLabel+e.xFontLabelHeight),y.padding=An([g*(e.yTickWidth+w.width),b*e.distToYAxisLabel]),y.paddingNoTicks=b*e.distToYAxisLabel),o&&(y.padding=0,y.paddingNoTicks=0);var _=e.xFontLabelDescenderLineHeight;return t.padding=Object.assign(t.padding,{b:t.x.hide?0:An([t.x.padding,p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight+_)]),l:t.y.hide?0:An([t.y.padding,o?0:g*(e.yTickWidth+w.width),b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.paddingNoTicks=Object.assign({},t.paddingNoTicks,{b:t.x.hide?0:An([t.x.padding,v*(e.distToXAxisLabel+e.xFontLabelHeight+_)]),l:t.y.hide?0:An([t.y.padding,b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.x=Object.assign(t.x,{density:x.width+2*jn(e,"xDensityPadding",n.dimType),tickFontHeight:l.height,$minimalDomain:a.length,$maxTickTextW:d.width,$maxTickTextH:d.height,tickFormatWordWrapLimit:e.xAxisTickLabelLimit}),t.y=Object.assign(t.y,{density:w.height+2*jn(e,"yDensityPadding",r.dimType),tickFontHeight:f.height,$minimalDomain:u.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:e.yAxisTickLabelLimit}),t}var In=function(t){var e=t.unit,n=t.meta,r=t.settings,i=t.allowXVertical,o=t.allowYVertical,a=t.inlineLabels,u=n.dimension(e.x),s=n.dimension(e.y),c=n.scaleMeta(e.x,e.guide.x),l=n.scaleMeta(e.y,e.guide.y),f=c.isEmpty,d=l.isEmpty;e.guide.x.tickFormat=Pn(e.guide.x.tickFormat||Ln(u,r.defaultFormats),r.utcTime),e.guide.y.tickFormat=Pn(e.guide.y.tickFormat||Ln(s,r.defaultFormats),r.utcTime);var h=!!i&&!("measure"===u.dimType),p=!!o&&!("measure"===s.dimType);if(e.guide.x.padding=f?0:r.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:r.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=zn(e.guide.x.rotate,"x"),e.guide.y.rotate=p?-90:0,e.guide.y.textAnchor=zn(e.guide.y.rotate,"y"),e.guide=Dn(e.guide,r,c,l,a,he(e)),a){var g=e.guide.x.label,m=e.guide.y.label;g.cssClass+=" inline",g.dock="right",g.textAnchor="end",m.cssClass+=" inline",m.dock="right",m.textAnchor="end"}return e},Bn={NONE:function(t,e,n){var r=Et(t);return Wn(Et(r.unit),r.unit,function(t,e){return e.guide.x.tickFontHeight=n.getAxisTickLabelSize("X").height,e.guide.y.tickFontHeight=n.getAxisTickLabelSize("Y").height,e.guide.x.tickFormatWordWrapLimit=n.xAxisTickLabelLimit,e.guide.y.tickFormatWordWrapLimit=n.yAxisTickLabelLimit,e}),r},"BUILD-LABELS":function(t,e){var n=Et(t),r=[],i=[],o=null,a=null;mt(n.unit,"units",Cn,function(t,n){if(t.isLeaf)return n;!o&&n.x&&(o=n),!a&&n.y&&(a=n),n.guide=n.guide||{},n.guide.x=n.guide.x||{label:{text:""}},n.guide.y=n.guide.y||{label:{text:""}},n.guide.x.label=Ct(n.guide.x.label)?n.guide.x.label:{text:n.guide.x.label&&n.guide.x.label.text?n.guide.x.label.text:""},n.guide.y.label=Ct(n.guide.y.label)?n.guide.y.label:{text:n.guide.y.label&&n.guide.y.label.text?n.guide.y.label.text:""},n.x&&(n.guide.x.label.text=n.guide.x.label.text||e.dimension(n.x).dimName),n.y&&(n.guide.y.label.text=n.guide.y.label.text||e.dimension(n.y).dimName);var u=n.guide.x.label.text;u&&(r.push(u),n.guide.x.tickFormatNullAlias=n.guide.x.hasOwnProperty("tickFormatNullAlias")?n.guide.x.tickFormatNullAlias:"No "+u,n.guide.x.label.text="",n.guide.x.label._original_text=u);var s=n.guide.y.label.text;return s&&(i.push(s),n.guide.y.tickFormatNullAlias=n.guide.y.hasOwnProperty("tickFormatNullAlias")?n.guide.y.tickFormatNullAlias:"No "+s,n.guide.y.label.text="",n.guide.y.label._original_text=s),n});return o&&(o.guide.x.label.text=o.guide.x.label.hide?"":r.join(" → ")),a&&(a.guide.y.label.text=a.guide.y.label.hide?"":i.join(" → ")),n},"BUILD-GUIDE":function(t,e,n){var r=Et(t);return Wn(Et(r.unit),r.unit,function(t,r){if(t.isLeaf)return r;var i=!t.isLeaf&&!t.isLeafParent,o=e.scaleMeta(r.x,r.guide.x),a=e.scaleMeta(r.y,r.guide.y),u=!i&&Boolean(o.dimType)&&"measure"!==o.dimType;return r.guide.x.rotate=r.guide.x.rotate||(u?-90:0),r.guide.x.textAnchor=zn(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||Ln(o,n.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||Ln(a,n.defaultFormats),r.guide.x.padding=i?0:n.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=i?0:n.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=Dn(r.guide,Zt({distToXAxisLabel:o.isEmpty?n.xTickWidth:n.distToXAxisLabel,distToYAxisLabel:a.isEmpty?n.yTickWidth:n.distToYAxisLabel},n),o,a,null,he(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:i?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!i||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:i?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!i&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:t.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":function(t,e,n){var r=Et(t);return Wn(Et(r.unit),r.unit,function(t,r){return t.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=t.isLeafParent?"xy":""),t.isLeafParent?In({unit:r,meta:e,settings:Zt({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!0,allowYVertical:!1,inlineLabels:!0}):(r.guide.x.cssClass+=" facet-axis compact",r.guide.x.avoidCollisions=!0,r.guide.y.cssClass+=" facet-axis compact",r.guide.y.avoidCollisions=!0,In({unit:r,meta:e,settings:Zt({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))}),r},AUTO:function(t,e,n){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(t,r){return Bn[r](t,e,n)},t)},COMPACT:function(t,e,n){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(t,r){return Bn[r](t,e,n)},t)}},Wn=function(t,e,n){var r,i=((r=e).options=r.options||{},r.guide=r.guide||{},r.guide.padding=Zt(r.guide.padding||{},{l:0,b:0,r:0,t:0}),r.guide.x=En(r.guide,"x"),r.guide.x=Tn(r.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),r.guide.y=En(r.guide,"y",{rotate:-90}),r.guide.y=Tn(r.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),r.guide.size=En(r.guide,"size"),r.guide.color=En(r.guide,"color"),r);i=n(Cn(i),i);var o=Qt(i=kn(i,t),"units");return(i.units||[]).forEach(function(t){return Wn(Et(t),(r=o,(e=t).guide=e.guide||{},e.guide.padding=e.guide.padding||{l:0,t:0,r:0,b:0},e.hasOwnProperty("units")||((e=Zt(e,r)).guide=Zt(e.guide,Et(r.guide)),e.guide.x=Zt(e.guide.x,Et(r.guide.x)),e.guide.y=Zt(e.guide.y,Et(r.guide.y))),e),n);var e,r}),i},Hn=function(t,e,n,r){var i={dimension:function(t){var e=n.scales[t],r=n.sources[e.source].dims[e.dim]||{};return{dimName:e.dim,dimType:r.type,scaleType:e.type}},scaleMeta:function(t){var e=r("pos",t).domain(),i=n.scales[t],o=n.sources[i.source].dims[i.dim]||{};return{dimName:i.dim,dimType:o.type,scaleType:i.type,values:e,isEmpty:null==o.type}}},o=(Bn[t]||Bn.NONE)({unit:Et(n.unit)},i,e);return n.unit=o.unit,n},Un=function(){function t(t){this.spec=t,this.isApplicable=Rt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.size,r=e.settings.specEngine.find(function(t){return n.width<=t.width||n.height<=t.height});return Hn(r.name,e.settings,e,function(e,n){return t.getScaleInfo(n||e+":default")})},t}(),Gn=function(){function t(){}return t.optimizeXAxisLabel=function(t,e){var n=e.xAxisTickLabelLimit,r=function(t){if(!t.guide.x.hide&&!t.guide.x.hideTicks&&0!==t.guide.x.rotate){t.guide.x.rotate=0,t.guide.x.textAnchor="middle";var e=0-Math.min(n,t.guide.x.$maxTickTextW)+t.guide.x.$maxTickTextH;i(t,e)}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})},i=function(e,n){t!==e&&"extract-axes"===e.guide.autoLayout?(t.guide.x.padding+=n,t.guide.padding.b+=n):(e.guide.x.label.padding+=e.guide.x.label.padding>0?n:0,e.guide.padding.b+=e.guide.padding.b>0?n:0)};r(t)},t.hideAxisTicks=function(t,e,n){var r=function(t){var e="x"===n?"b":"l",i=t.guide;if(!i[n].hide&&!i[n].hideTicks){he(t)&&"y"===n||(i[n].hideTicks=!0);var o=i[n].label.text&&!i[n].label.hide;i.padding[e]=i.paddingNoTicks?i.paddingNoTicks[e]:0,i[n].padding=i[n].paddingNoTicks||0,i[n].label.padding=o?i[n].label.paddingNoTicks:0}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})};r(t)},t.facetsLabelsAtTop=function(t,e){var n=function(t){var e=t.units||[];if(he(t)){var r=t.guide;r.y.facetAxis=!0,r.y.rotate=0,r.y.textAnchor="start",e.forEach(function(t){t.guide.padding.t=20})}e.filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return n(t)})};n(t)},t}(),qn=function(t){return t.$maxTickTextW},Xn=function(t){return 0==t.rotate?t.$maxTickTextW:t.$maxTickTextH},Yn=function(t){return t.density},Vn=function(t){var e=[],n=[],r=function(t){if("COORDS.RECT"===t.type&&t.units&&t.units[0]&&"COORDS.RECT"===t.units[0].type){var i=t.x.replace(/^x_/,""),o=t.y.replace(/^y_/,"");"null"!==i&&e.push(i),"null"!==o&&n.push(o),t.units.forEach(r)}};r(t.unit);var i={},o={},a=function(t){"COORDS.RECT"===t.type&&t.frames.forEach(function(t){t.key&&(Object.keys(t.key).forEach(function(r){e.indexOf(r)>=0&&(i.hasOwnProperty(r)||(i[r]=[]),i[r].indexOf(t.key[r])<0&&i[r].push(t.key[r])),n.indexOf(r)>=0&&(o.hasOwnProperty(r)||(o[r]=[]),o[r].indexOf(t.key[r])<0&&o[r].push(t.key[r]))}),t.units&&t.units.forEach(a))})};return a(t.unit),{xFacetCount:Object.keys(i).reduce(function(t,e){return t*i[e].length},1),yFacetCount:Object.keys(o).reduce(function(t,e){return t*o[e].length},1)}},$n={"entire-view":function(t,e,n,r){var i=n.unit.guide,o=Vn(n),a=o.xFacetCount,u=o.yFacetCount;u>0&&Gn.facetsLabelsAtTop(n.unit,n.settings);var s=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0,c=i.paddingNoTicks?i.padding.b-i.paddingNoTicks.b:0,l=i.paddingNoTicks&&t.height-ct.height||a*n.settings.minFacetWidth+s>t.width,f=i.paddingNoTicks&&t.width-st.height||a*n.settings.minFacetWidth+s>t.width;l&&Gn.hideAxisTicks(n.unit,n.settings,"x"),f&&Gn.hideAxisTicks(n.unit,n.settings,"y");var d=t.width;if(e("x",n.unit,qn)<=t.width)r(n.unit,n.settings);else{var h=e("x",n.unit,Xn);if(h>t.width){var p=Math.max(t.width,e("x",n.unit,Yn));d=Math.min(h,p)}}var g=Math.max(t.height,e("y",n.unit,Yn));return!l&&d>t.width&&Gn.hideAxisTicks(n.unit,n.settings,"x"),!f&&g>t.height&&Gn.hideAxisTicks(n.unit,n.settings,"y"),{newW:t.width,newH:t.height}},minimal:function(t,e,n){return{newW:e("x",n.unit,Yn),newH:e("y",n.unit,Yn)}},normal:function(t,e,n,r){Vn(n).yFacetCount>0&&Gn.facetsLabelsAtTop(n.unit,n.settings);var i=n.unit.guide;i.paddingNoTicks&&(t.width-i.padding.l+i.paddingNoTicks.lt.width){var u=Math.max(t.width,e("x",n.unit,Yn));o=Math.min(a,u)}}return{newW:o,newH:Math.max(t.height,e("y",n.unit,Yn))}},"fit-width":function(t,e,n,r){var i=n.unit.guide,o=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0;return(i.paddingNoTicks&&t.width-ot.width)&&Gn.hideAxisTicks(n.unit,n.settings,"y"),e("x",n.unit,qn)<=t.width&&r(n.unit,n.settings),{newW:t.width,newH:e("y",n.unit,Yn)}},"fit-height":function(t,e,n){var r=n.unit.guide,i=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&t.height-it.height)&&Gn.hideAxisTicks(n.unit,n.settings,"x"),{newW:e("x",n.unit,Yn),newH:t.height}}},Jn=function(){function t(t){this.spec=t,this.isApplicable=Rt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.fitModel;if(!n)return e;var r=e.scales,i=function(t,e){return t.discrete?e*t.domain().length:4*e},o=function(e,n,a,u){void 0===u&&(u=null);var s="x"===e?n.x:n.y,c="x"===e?n.y:n.x,l=n.guide,f=a("x"===e?l.x:l.y),d=n.units[0],h="x"===e?l.padding.l+l.padding.r:l.padding.b+l.padding.t;if("ELEMENT.INTERVAL"===d.type&&"y"===e===Boolean(d.flip)&&d.label&&!t.getScaleInfo(d.label,u).isEmpty()){var p,g=2*(l.label&&l.label.fontSize?l.label.fontSize:10),m=t.getScaleInfo(s,u);if(m.discrete&&(null==d.guide.enableColorToBarPosition?!d.stack:d.guide.enableColorToBarPosition)){var y=d.color;if(y){var v=t.getScaleInfo(y,u);if(v.discrete){v.domain();p=v}}}var b=n.frames.reduce(function(t,e){return t+function(t){var e=t.part(),n=Vt(e.map(function(t){return t[m.dim]})).length,r=1;if(p){var i=e.reduce(function(t,e){var n=e[m.dim],r=e[p.dim];return t[n]=t[n]||{},t[n][r]||(t[n][r]=!0),t},{}),o=Object.keys(i).map(function(t){return Object.keys(i[t]).length});r=Math.max.apply(Math,o)}return n*r*g}(e)},0),x=i(m,f);return h+Math.max(b,x)}if("COORDS.RECT"!==d.type){var w=t.getScaleInfo(s,u);return h+i(w,f)}var _,S,M=(_=n.frames,S=r[c].dim,_.reduce(function(t,e){var n=(e.key||{})[S];return t[n]=t[n]||[],t[n].push(e),t},{})),O=Object.keys(M).map(function(t){return M[t].map(function(t){return o(e,t.units[0],a,t)}).reduce(function(t,e){return t+e},0)});return h+Math.max.apply(Math,O)},a=e.settings.size,u=a.width,s=a.height,c=$n[n];if(c){var l=c(a,o,e,Gn.optimizeXAxisLabel);u=l.newW,s=l.newH}return e.settings.size=function(n,r,i){var o=e.settings.getScrollbarSize(t.getLayout().contentContainer),a=r.width>n.width&&r.width<=n.width*i?n.width:r.width,u=r.height>n.height&&r.height<=n.height*i?n.height:r.height,s=n.width-a,c=n.height-u>=0?0:o.width;return{height:u-(s>=0?0:o.height),width:a-c}}(a,{width:u,height:s},e.settings.avoidScrollAtRatio),e},t}(),Kn=function(){function t(t){this.spec=t,this.isApplicable=t.settings.autoRatio&&Rt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleApplyRatio(e,t)}catch(t){if("Not applicable"!==t.message)throw t}return e},t.prototype.ruleApplyRatio=function(t,e){var n=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},r=function(t,e,n,i){void 0===i&&(i=0),e(t,i)&&(t.units||[]).map(function(t){return r(t,e,n,i+1)}),n(t,i)},i=[],o=[];r(t.unit,function(t,e){if(e>1||!n(t))throw new Error("Not applicable");return i.push(t.x),o.push(t.y),1===(t.units||[]).map(function(t){if(!n(t)&&0!==t.type.indexOf("ELEMENT."))throw new Error("Not applicable");return t}).filter(n).length},function(){return 0});var a=function(e){return t.scales[e]},u=function(t){return"/"===t.source&&!t.ratio&&!t.fitToFrameByDims},s=function(t){return"ordinal"===t.type||"period"===t.type&&!t.period},c=i.map(a).filter(u),l=o.map(a).filter(u);if([c.length,l.length].some(function(t){return 2===t})){var f=function(t){return t.dim},d=function(t,e,n){t.fitToFrameByDims=n.slice(0,e).map(f)},h=function(t,n){2===n.filter(s).length&&(n.forEach(d),n[0].ratio=zt(t,n.map(f),e))};h("x",c),h("y",l)}},t}(),Zn=function(){function t(t){this.spec=t,this.isApplicable="EXTRACT"===t.settings.layoutEngine&&Rt(t.unit)}return t.prototype.transform=function(){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleExtractAxes(t)}catch(t){if("Not applicable"!==t.message)throw t;console.log("[TauCharts]: can't extract axes for the given chart specification")}return t},t.prototype.ruleExtractAxes=function(t){var e=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},n=function(t){return t?10:0},r={l:0,r:10,t:10,b:0},i={l:0,b:0},o=[],a=[];yt(t.unit,function(t,n){if(n>1||!e(t))throw new Error("Not applicable");t.guide=t.guide||{};var u=t.guide,s=u.padding||{l:0,r:0,t:0,b:0},c=u.paddingNoTicks||{l:0,b:0};return r.l+=s.l,r.r+=s.r,r.t+=s.t,r.b+=s.b,i.l+=c.l,i.b+=c.b,o.push(Object.assign({},r)),a.push(Object.assign({},i)),1===(t.units||[]).map(function(t){if(!e(t)&&0!==t.type.indexOf("ELEMENT."))throw new Error("Not applicable");return t}).filter(e).length},function(t){var e=o.pop(),u=a.pop(),s=t.guide||{};s.x=s.x||{},s.x.padding=s.x.padding||0,s.x.paddingNoTicks=s.x.paddingNoTicks||0,s.y=s.y||{},s.y.padding=s.y.padding||0,s.y.paddingNoTicks=s.y.paddingNoTicks||0,s.padding={l:n(t.y),r:n(1),t:n(1),b:n(t.x)},s.paddingNoTicks={l:0,b:0},s.autoLayout="extract-axes",s.x.padding+=r.b-e.b,s.y.padding+=r.l-e.l,s.x.paddingNoTicks+=i.b-u.b,s.y.paddingNoTicks+=i.l-u.l}),t.unit.guide.padding=r,t.unit.guide.paddingNoTicks=i},t}(),Qn=function(){function t(t){var e=void 0===t?{}:t,n=e.src,r=void 0===n?null:n,i=e.timeout,o=void 0===i?Number.MAX_SAFE_INTEGER:i,a=e.syncInterval,u=void 0===a?Number.MAX_SAFE_INTEGER:a,s=e.callbacks,c=void 0===s?{}:s,l=this;this.setTimeoutDuration(o),this.setSyncInterval(u),this.setCallbacks(c),this._running=!1,this._queue=[],this._result=r,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=function(){if(l._running&&l._requestedFrameId){var t=l._getCancelFrameFunction(),e=l._getRequestFrameFunction();t(l._requestedFrameId),l._requestedFrameId=e(l._requestedFrameCallback)}},this._tasksCount=0,this._finishedTasksCount=0}return t.prototype.setTimeoutDuration=function(e){t.checkType(e,"number","timeout"),this._timeout=e},t.prototype.setSyncInterval=function(e){t.checkType(e,"number","syncInterval"),this._syncInterval=e},t.prototype.setCallbacks=function(e){t.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)},t.prototype.addTask=function(t){return this._queue.push(t),this._tasksCount++,this},t.prototype.run=function(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,t.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()},t.prototype.isRunning=function(){return this._running},t.prototype._loopTasks=function(){for(var e,n,r,i,o=0,a=this._syncInterval/t.runnersInProgress;this._running&&!(r=this._asyncDuration>this._timeout)&&!(i=o>a)&&(e=this._queue.shift());){if(null===(n=this._runTask(e)))return;this._syncDuration+=n,this._asyncDuration+=n,o+=n}r&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!r&&i&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))},t.prototype._runTask=function(t){var e=performance.now();if(this._callbacks.error)try{this._result=t.call(null,this._result,this)}catch(t){return this.stop(),this._callbacks.error.call(null,t,this),null}else this._result=t.call(null,this._result,this);var n=performance.now()-e;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),n},t.prototype._requestFrame=function(){var t=this,e=performance.now(),n=function(){t._requestedFrameId=null;var n=performance.now();t._asyncDuration+=n-e,t._loopTasks()},r=this._getRequestFrameFunction();this._requestedFrameCallback=n,this._requestedFrameId=r(n)},t.prototype._getRequestFrameFunction=function(){var t=this;return document.hidden?function(e){return t._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})}:function(e){return t._requestedFrameType="animation",requestAnimationFrame(e)}},t.prototype._getCancelFrameFunction=function(){switch(this._requestedFrameType){case"animation":return function(t){return cancelAnimationFrame(t)};case"idle":return function(t){return window.cancelIdleCallback(t)}}},t.prototype.stop=function(){if(!this._running)throw new Error("Task Runner is already stopped");(this._running=!1,t.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId)&&(this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null)},t.checkType=function(t,e,n){if(typeof t!==e)throw new Error('Task Runner "'+n+'" property is not "'+e+'"')},t}();Qn.runnersInProgress=0;var tr=Qn,er=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nr=function(){return(nr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var l=c.findIndex(function(t){return t.closest.distance!==c[0].closest.distance||t.closest.secondaryDistance!==c[0].closest.secondaryDistance}),f=l<0?c:c.slice(0,l);if(1===f.length)o=f[0].closest.data,a=f[0].closest.node,u=f[0].unit;else{var d=f.reduce(function(t,e){return t+e.closest.x},0)/f.length,h=f.reduce(function(t,e){return t+e.closest.y},0)/f.length,p=Math.atan2(h-r,d-n)+Math.PI,g=Math.round((f.length-1)*p/2/Math.PI),m=f[g].closest;o=m.data,a=m.node,u=f[g].unit}}s.forEach(function(e){return e.unit.fire(i,{event:t,data:o,node:a,unit:u})})},e.prototype._initPointerEvents=function(){var t=this;this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);var e=rr.select(this._svg),n=this._liveSpec.settings.syncPointerEvents?function(t){return function(){return t(a.event)}}:function(e){return function(){var n=a.event;t._pointerAnimationFrameId&&"mousemove"!==n.type&&t._cancelPointerAnimationFrame(),t._pointerAnimationFrameId||(t._pointerAnimationFrameId=requestAnimationFrame(function(){t._pointerAnimationFrameId=null,e(n)}))}},r=function(e){return t._handlePointerEvent(e)};e.on("mousemove",n(r)),e.on("click",n(r)),e.on("mouseleave",n(function(e){"none"!==window.getComputedStyle(t._svg).pointerEvents&&t.select(function(){return!0}).forEach(function(t){return t.fire("data-hover",{event:e,data:null,node:null,unit:null})})}))},e.prototype._cancelPointerAnimationFrame=function(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null},e.prototype._setupTaskRunner=function(t){var e=this;return this._resetTaskRunner(),this._taskRunner=new tr({timeout:t.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:t.settings.asyncRendering?t.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:function(){e._completeRendering(),e._renderingPhase=null},timeout:function(t,n){e._displayTimeoutWarning({timeout:t,proceed:function(){e.disablePointerEvents(),n.setTimeoutDuration(Number.MAX_SAFE_INTEGER),n.run()},cancel:function(){e._cancelRendering()}}),e.enablePointerEvents(),e.fire("renderingtimeout",t)},progress:function(t){var n={spec:0,draw:1}[e._renderingPhase]/2+t/2;e._reportProgress(n)},error:t.settings.handleRenderingErrors?function(n){e._cancelRendering(),e._displayRenderingError(n),e.fire("renderingerror",n),t.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',"Error message: "+n.message].join(" "),"ERROR")}:null}}),this._taskRunner},e.prototype._resetTaskRunner=function(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)},e.prototype.renderTo=function(t,e){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(t,e);var n=this._createLiveSpec();if(!n)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(n),i=this._setupTaskRunner(n);this._scheduleDrawScenario(i,r),this._scheduleDrawing(i,r),i.run()},e.prototype._insertLayout=function(t,e){this._target=t,this._defaultSize=Object.assign({},e);var n=rr.select(t).node();if(null===n)throw new Error("Target element not found");this._layout.layout.parentNode!==n&&n.appendChild(this._layout.layout);var r=this._layout.content,i=ye(this._layout.contentContainer);this._layout.contentContainer.style.padding="0 "+i.width+"px "+i.height+"px 0",ve(this._layout.rightSidebarContainer,"vertical");var o=Object.assign({},e)||{};if(!o.width||!o.height){var a=r.parentElement,u=a.scrollLeft,s=a.scrollTop;r.style.display="none",o=Zt(o,we(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=u,r.parentElement.scrollTop=s,o.height||(o.height=we(this._layout.layout).height)}this.configGPL.settings.size=o},e.prototype._createLiveSpec=function(){var t=this;return this._liveSpec=Et(Qt(this.configGPL,"plugins")),this._liveSpec.sources=this.getDataSources(),this._liveSpec.settings=this.configGPL.settings,this._experimentalSetupAnimationSpeed(this._liveSpec),this.isEmptySources(this._liveSpec.sources)?null:(this._liveSpec=this.transformers.reduce(function(e,n){return new n(e).transform(t)},this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)},e.prototype._experimentalSetupAnimationSpeed=function(t){t.settings.initialAnimationSpeed=t.settings.initialAnimationSpeed||t.settings.animationSpeed;var e=t.settings.experimentalShouldAnimate(t)?t.settings.initialAnimationSpeed:0;t.settings.animationSpeed=e;var n=function(t){t.guide=t.guide||{},t.guide.animationSpeed=e,t.units&&t.units.forEach(n)};n(t.unit)},e.prototype._createGPL=function(t){var e=new qe(t,this.getScaleFactory(),nn,O),n=e.unfoldStructure();return this.onUnitsStructureExpanded(n),e},e.prototype._scheduleDrawScenario=function(t,e){var n=this,r=rr.select(this._layout.content),i=e.config.settings.size;t.addTask(function(){return n._renderingPhase="spec"}),e.getDrawScenarioQueue({allocateRect:function(){return{slot:function(t){return r.selectAll(".uid_"+t)},frameId:"root",left:0,top:0,width:i.width,containerWidth:i.width,height:i.height,containerHeight:i.height}}}).forEach(function(e){return t.addTask(e)})},e.prototype._scheduleDrawing=function(t,e){var n=this,r=e.config.settings.size;t.addTask(function(t){n._renderingPhase="draw",n._renderRoot({scenario:t,newSize:r}),n._cancelPointerAnimationFrame(),n._scheduleRenderScenario(t)})},e.prototype._resetProgressLayout=function(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()},e.prototype._renderRoot=function(t){var e=this,n=t.scenario,r=t.newSize,i=rr.select(this._layout.content),o=n[0].config.uid,a=ir(i,"svg").attr("width",Math.floor(r.width)).attr("height",Math.floor(r.height));a.attr("class")||a.attr("class",Xe+"svg"),this._svg=a.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var u=a.selectAll("g.frame-root").data([o],function(t){return t});u.enter().append("g").classed(Xe+"cell cell frame-root uid_"+o,!0).merge(u).call(function(t){t.classed("tau-active",!0),nt(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),u.exit().call(function(t){t.classed("tau-active",!1),nt(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})},e.prototype._scheduleRenderScenario=function(t){var e=this;t.forEach(function(t){e._taskRunner.addTask(function(){t.draw(),e.onUnitDraw(t.node()),e._renderedItems.push(t)})})},e.prototype._completeRendering=function(){ve(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=this._liveSpec.settings.size.height+"px",this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),ve(this._layout.rightSidebarContainer,"vertical")},e.prototype._cancelRendering=function(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()},e.prototype._createProgressBar=function(){var t=rr.select(this._layout.header),e=ir(t,"div."+Xe+"progress");e.select("div."+Xe+"progress__value").remove();var n=e.append("div").classed(Xe+"progress__value",!0).style("width",0);this._reportProgress=function(t){requestAnimationFrame(function(){e.classed(Xe+"progress_active",t<1),n.style("width",100*t+"%")})}},e.prototype._displayRenderingError=function(t){this._layout.layout.classList.add(Xe+"layout_rendering-error")},e.prototype._clearRenderingError=function(){this._layout.layout.classList.remove(Xe+"layout_rendering-error")},e.prototype.getScaleFactory=function(t){return void 0===t&&(t=null),new un(an.instance(this._liveSpec.settings),t||this._liveSpec.sources,this._liveSpec.scales)},e.prototype.getScaleInfo=function(t,e){return void 0===e&&(e=null),this.getScaleFactory().createScaleInfoByName(t,e)},e.prototype.getSourceFiltersIterator=function(t){var e=this,n=Yt(Object.keys(this._filtersStore.filters).map(function(t){return e._filtersStore.filters[t]})).filter(function(e){return!t(e)}).map(function(t){return t.predicate});return function(t){return n.reduce(function(e,n){return e&&n(t)},!0)}},e.prototype.getDataSources=function(t){var e=this;void 0===t&&(t={});var n=this._chartDataModel(this._originData);return Object.keys(n).filter(function(t){return"?"!==t}).reduce(function(r,i){var o=n[i],a=e.getSourceFiltersIterator(function(e){return function(n){return t.excludeFilter&&-1!==t.excludeFilter.indexOf(n.tag)||n.src!==e}}(i));return r[i]={dims:o.dims,data:o.data.filter(a)},r},{"?":n["?"]})},e.prototype.isEmptySources=function(t){return!Object.keys(t).filter(function(t){return"?"!==t}).filter(function(e){return t[e].data.length>0}).length},e.prototype.getChartModelData=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="/"),this.getDataSources(t)[e].data},e.prototype.getDataDims=function(t){return void 0===t&&(t="/"),this._originData[t].dims},e.prototype.getData=function(t){return void 0===t&&(t="/"),this._originData[t].data},e.prototype.setData=function(t,e){void 0===e&&(e="/"),this._originData[e].data=t,this.refresh()},e.prototype.getSVG=function(){return this._svg},e.prototype.addFilter=function(t){t.src=t.src||"/";var e=t.tag,n=this._filtersStore.filters[e]=this._filtersStore.filters[e]||[],r=this._filtersStore.tick++;return t.id=r,n.push(t),r},e.prototype.removeFilter=function(t){var e=this;return Object.keys(this._filtersStore.filters).map(function(n){e._filtersStore.filters[n]=e._filtersStore.filters[n].filter(function(e){return e.id!==t})}),this},e.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},e.prototype.resize=function(t){void 0===t&&(t={}),this.renderTo(this._target,t)},e.prototype.select=function(t){return this._nodes.filter(t)},e.prototype.traverseSpec=function(t,e){var n=function(t,e,r,i){e(t,r,i),t.frames?t.frames.forEach(function(r){(r.units||[]).map(function(i){return n(i,e,t,r)})}):(t.units||[]).map(function(r){return n(r,e,t,null)})};n(t.unit,e,null,null)},e.prototype.getSpec=function(){return this._liveSpec},e.prototype.getLayout=function(){return this._layout},e.prototype._displayTimeoutWarning=function(t){var e=this,n=t.proceed,r=t.cancel,i=t.timeout,o=Math.round(100/3/1.5),a=function(t){return Math.round(100/3/1.5*t)};this._layout.content.style.height="100%",this._layout.content.insertAdjacentHTML("beforeend",'\n
\n \n \n Rendering took more than '+Math.round(i)/1e3+'s\n Would you like to continue?\n \n \n Continue\n \n \n Cancel\n \n \n
\n '),this._layout.content.querySelector("."+Xe+"rendering-timeout-continue-btn").addEventListener("click",function(){e._clearTimeoutWarning(),n.call(e)}),this._layout.content.querySelector("."+Xe+"rendering-timeout-cancel-btn").addEventListener("click",function(){e._clearTimeoutWarning(),r.call(e)})},e.prototype._clearTimeoutWarning=function(){var t=or(this._layout.content,"."+Xe+"rendering-timeout-warning");t&&(this._layout.content.removeChild(t),this._layout.content.style.height="")},e}(h),ur={},sr={},cr=function(t){var e="Chart type "+t+" is not supported.";throw console.log(e),console.log("Use one of "+Object.keys(ur).join(", ")+"."),new _(e,S.NOT_SUPPORTED_TYPE_CHART)},lr={validate:function(t,e){return sr.hasOwnProperty(t)||cr(t),sr[t].reduce(function(t,n){return t.concat(n(e)||[])},[])},get:function(t){var e=ur[t];return"function"!=typeof e&&cr(t),e},add:function(t,e,n){return void 0===n&&(n=[]),ur[t]=e,sr[t]=n,lr},getAllRegisteredTypes:function(){return ur}},fr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dr=function(t){function e(n){var r=t.call(this,n)||this;return n.autoResize&&e.winAware.push(r),r}return fr(e,t),e.prototype.applyConfig=function(e){var n=lr.validate(e.type,e);if(n.length>0)throw new Error(n[0]);var r=lr.get(e.type);(e=Zt(e,{autoResize:!0})).settings=ar.setupSettings(e.settings),e.dimensions=ar.setupMetaInfo(e.dimensions,e.data),t.prototype.applyConfig.call(this,r(e))},e.prototype.destroy=function(){var n=e.winAware.indexOf(this);-1!==n&&e.winAware.splice(n,1),t.prototype.destroy.call(this)},e}(ar);function hr(t){return t}dr.winAware=[],dr.resizeOnWindowEvent=function(){var t;function e(){t=0;for(var e=0,n=dr.winAware.length;ex&&x>2&&b.length>2;)b=n.ticks(--x)}else b=n.domain();r.hideTicks&&(b=l?b.filter(function(t){return 0==t}):[]);var w=null==u?n.tickFormat?n.tickFormat(a):hr:u,_=Math.max(s,0)+c,S=n.range(),M=S[0]+.5,O=S[S.length-1]+.5,A=(n.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return t(n)+e}}:hr)(n);if(r.facetAxis){var k=A;A=function(t){return k(t)-n.stepSize(t)/2}}var E,T=o.selection?o:null,C=T?T.selection():o,N=function(t){for(var e=t.node();e&&"svg"!==e.tagName;)e=e.parentNode;return e}(C).getBoundingClientRect();function L(t){var n=Ut(r.rotate);if(t.attr("transform",Le(n)),Math.abs(n/90)%2>0){var i=n<180?1:-1,o=h?.5:-2,a=e===yr.top||e===yr.left?-1:1,u=o*(e===yr.top||e===yr.bottom?a<0?0:.71:.32);t.attr("x",9*i).attr("y",0).attr("dx",h?null:u+"em").attr("dy",u+"em")}}function j(t,e){void 0===e&&(e=0);var i=function(t){return Math.max(n.stepSize(t),r.tickFormatWordWrapLimit,e)};r.tickFormatWordWrap?et(t,i,r.tickFormatWordWrapLines,r.tickFontHeight,!h):tt(t,i)}function P(t){!function(t,e){var n=e?-10:20,r=e?0:1,i=e?1:-1,o=[];t.each(function(){var t=Z.select(this),e=t.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],n=i*parseFloat(e),a=t.select("text"),u=a.node().getBBox().width/2,s=n-u,c=n+u;o.push({c:n,s:s,e:c,l:0,textRef:a,tickRef:t})});var a,u=o.sort(function(t,e){return t.c-e.c});a=function(t,r,i){var o,a,u,s=t.e>r.s,c=i.s1&&(f=f.replace(/([\.]*$)/gi,"")+"...");var d=11*r.l,h=e?parseFloat(r.textRef.attr("y"))+d:0,p=e?0:d,g=e?d:0,m=function(t){var e=0;if(!t)return e;var n=t.indexOf("rotate(");if(n>=0){var r=t.indexOf(")",n+7),i=t.substring(n+7,r);e=parseFloat(i.trim())}return e}(r.textRef.attr("transform"));r.textRef.text(function(t,e){return 0===e?f:""}).attr("transform","translate("+p+","+g+") rotate("+m+")");var y={x1:0,x2:0,y1:h+(e?-1:5),y2:n};e||(y.transform="rotate(-90)"),Oe(r.tickRef,"line.label-ref").call(lt(y))}else r.tickRef.selectAll("line.label-ref").remove();return r},u.map(function(t,e,n){return a(n[e-1]||{e:-1/0,s:-1/0,l:0},t,n[e+1]||{e:1/0,s:1/0,l:0})})}(t,h)}C.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===yr.right?"start":e===yr.left?"end":"middle"),l||(E=r.hideTicks||r.hide?[]:[null],le(C.selectAll(".domain").data(E)).then(function(t){return T&&t.exit().transition(T).attr("opacity",0).remove(),t.merge(t.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000"))}).then(function(t){return T?t.transition(T):t}).then(function(t){t.attr("d",e===yr.left||e==yr.right?"M"+p*s+","+M+"H0.5V"+O+"H"+p*s:"M"+M+","+p*s+"V0.5H"+O+"V"+p*s)}));var F=le(C.selectAll(".tick").data(b,function(t){return String(n(t))}).order()).then(function(t){var e=t.exit(),n=t.enter().append("g").attr("class","tick");return{tickExit:e,tickEnter:n,tick:t.merge(n)}}).then(function(t){if(f){var e=n.ticks(),r=n.domain(),i=b.length-1,o=e.length>1&&r[0]*r[1]<0&&-r[0]>(e[1]-e[0])/2&&r[1]>(e[i]-e[i-1])/2;t.tick.classed("zero-tick",function(t){return 0==t&&o})}return t}).result();!function(t){le(t).then(function(t){var e=t.tickEnter,n=t.tickExit,r=t.tick;return T?(e.attr("opacity",pr).attr("transform",function(t){var e=A(t);return y(e)}),{tick:r.transition(T),tickExit:n.transition(T).attr("opacity",pr).attr("transform",function(t){var e=A(t);return isFinite(e)?y(e):this.getAttribute("transform")})}):{tick:r,tickExit:n}}).then(function(t){var e=t.tick;t.tickExit.remove(),e.attr("opacity",1).attr("transform",function(t){return y(A(t))})})}(F),r.facetAxis||function(t){var e=p*s,r=d?function(t){return v*n.stepSize(t)/2}:null;le(t).then(function(t){var n=t.tick,i=t.tickEnter,o=n.select("line"),a=i.append("line").attr("stroke","#000").attr(m+"2",e);return d&&a.attr(g+"1",r).attr(g+"2",r),o.merge(a)}).then(function(t){return T?t.transition(T):t}).then(function(t){t.attr(m+"2",e),d&&t.attr(g+"1",r).attr(g+"2",r)})}(F),d&&l&&d&&b&&b.length&&le(C.selectAll(".extra-tick-line").data([null])).then(function(t){return t.merge(t.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))}).then(function(t){return T?t.transition(T):t}).then(function(t){t.attr(g+"1",M).attr(g+"2",M).attr(m+"1",0).attr(m+"2",p*s)}),l||(function(i){var o=r.textAnchor,a=p*_,u=e===yr.top?"0em":e===yr.bottom?"0.71em":"0.32em";function s(e){if(r.facetAxis)return e.attr("dx",18-t.position[0]).attr("dy",16)}le(i).then(function(t){var e=t.tick,n=t.tickEnter,r=e.select("text"),i=n.append("text").attr("fill","#000").attr(m,a).attr("dy",u);return L(i),s(i),r.merge(i)}).then(function(t){if(t.text(w).attr("text-anchor",o),!1===h&&!0===r.facetAxis){var e=Pe(C.node().parentNode.getAttribute("transform"));j(t,N.width-Math.abs(e.x))}else j(t);return h&&"time"===n.scaleType&&function(t){if(!(b.length<2)){var e=0,n=-1,r=t.nodes();r.forEach(function(t,r){var i=t.textContent||"",o=i.length;o>e&&(e=o,n=r)});var i=A(b[1])-A(b[0]),o=!1;if(n>=0){var a=r[n].getBoundingClientRect();o=i-a.width<8}C.classed(Xe+"time-axis-overflow",o)}}(t),!h||"time"!==n.scaleType&&"linear"!==n.scaleType||function(t){if(0!==b.length){var e=b[0],n=b[b.length-1],r=C.append("line").attr("x1",A(e)).attr("x2",A(e)).attr("y1",0).attr("y2",1),i=C.append("line").attr("x1",A(n)).attr("x2",A(n)).attr("y1",0).attr("y2",1),o={left:r.node().getBoundingClientRect().left-N.left,right:N.right-i.node().getBoundingClientRect().right};r.remove(),i.remove();var a=function(t,e,n){var r=t.getBoundingClientRect(),i=e>0?"right":"left",a=(A(n),o[i]),u=Math.ceil(r.width/2-a+1);t.setAttribute("dx",String(u>0?-e*u:0))},u=t.filter(function(t){return t===e}).node(),s=t.filter(function(t){return t===n}).node();t.attr("dx",null),a(u,-1,e),a(s,1,n)}}(t),t}).then(function(t){return T?t.transition(T):t}).then(function(t){t.attr(m,a),L(t),s(t),d&&r.avoidCollisions&&!r.facetAxis&&(T?T.on("end.fixTickTextCollision",function(){return P(i.tick)}):P(i.tick))})}(F),i.hide||function(){var t=i,e=Oe(C,"text.label").attr("class",Te("label",t.cssClass)).attr("transform",Le(t.rotate)).attr("text-anchor",t.textAnchor);le(e).then(function(t){return T?t.transition(T):t}).then(function(e){var n=v*t.padding,r=Math.abs(O-M),i=h?r:0;e.attr("x",i).attr("y",n).attr("text-anchor","end")});for(var n=t.text.split(" → "),r=n.length-1;r>0;r--)n.splice(r,0," → ");e.selectAll("tspan").data(n).enter().append("tspan").attr("class",function(t,e){return e%2?"label-token-delimiter label-token-delimiter-"+e:"label-token label-token-"+e}).text(function(t){return t}).exit().remove()}())}}function br(t){return vr({scale:t.scale,scaleGuide:t.scaleGuide,ticksCount:t.ticksCount,tickSize:t.tickSize,gridOnly:!0,position:t.position})}var xr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),wr=Oe,_r=function(t){var e=t<=20?1:.75;return Math.max(2,Math.round(t*e))},Sr=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Zt(n.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),n.config.guide.x=n.config.guide.x||{},n.config.guide.x=Zt(n.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.x.label&&(n.config.guide.x.label={text:n.config.guide.x.label}),n.config.guide.x.label=Zt(n.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),n.config.guide.y=n.config.guide.y||{},n.config.guide.y=Zt(n.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.y.label&&(n.config.guide.y.label={text:n.config.guide.y.label}),n.config.guide.y.label=Zt(n.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var r=n.config,i=r.guide;if("extract-axes"===i.autoLayout){var o=r.options.containerHeight-(r.options.top+r.options.height);i.x.hide=i.x.hide||Math.floor(o)>0,i.y.hide=i.y.hide||Math.floor(r.options.left)>0}var a=n.config.options,u=n.config.guide.padding;return n.L=a.left+u.l,n.T=a.top+u.t,n.W=a.width-(u.l+u.r),n.H=a.height-(u.t+u.b),n}return xr(e,t),e.prototype.defineGrammarModel=function(t){var e=this.W,n=this.H;return this.xScale=t("pos",this.config.x,[0,e]),this.yScale=t("pos",this.config.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n]:[n,0]}),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:function(){return e/2},yi:function(){return n/2},sizeX:function(){return e},sizeY:function(){return n}}},e.prototype.getGrammarRules=function(){return[function(t){var e=t.scaleX,n=t.scaleY;return{xi:function(n){return n?e(n[e.dim]):t.xi(n)},yi:function(e){return e?n(e[n.dim]):t.yi(e)},sizeX:function(n){return n?e.stepSize(n[e.dim]):t.sizeX(n)},sizeY:function(e){return e?n.stepSize(e[n.dim]):t.sizeY(e)}}}]},e.prototype.createScreenModel=function(t){return t},e.prototype.allocateRect=function(t){var e=this,n=this.screenModel;return{slot:function(t){return e.config.options.container.selectAll(".uid_"+t)},left:n.xi(t)-n.sizeX(t)/2,top:n.yi(t)-n.sizeY(t)/2,width:n.sizeX(t),height:n.sizeY(t),containerWidth:this.W,containerHeight:this.H}},e.prototype.drawFrames=function(t){var e=Object.assign({},this.config),n=e.options,r=this.W,i=this.H;if(e.x=this.xScale,e.y=this.yScale,e.x.scaleObj=this.xScale,e.y.scaleObj=this.yScale,e.x.guide=e.guide.x,e.y.guide=e.guide.y,e.x.guide.label.size=r,e.y.guide.label.size=i,(n.container.attr("transform")?nt(n.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):n.container).attr("transform",Ne(this.L,this.T)),e.x.guide.hide)this._removeDimAxis(n.container,e.x);else{var o="top"===e.x.guide.scaleOrient?[0,0-e.guide.x.padding]:[0,i+e.guide.x.padding];this._drawDimAxis(n.container,e.x,o,r)}if(e.y.guide.hide)this._removeDimAxis(n.container,e.y);else{var a="right"===e.y.guide.scaleOrient?[r+e.guide.y.padding,0]:[0-e.guide.y.padding,0];this._drawDimAxis(n.container,e.y,a,i)}var u=t.reduce(function(t,e){return t.concat((e.units||[]).map(function(t){return t.uid}))},[]),s=this._drawGrid(n.container,e,r,i,n),c=st(s,".cell").data(u,function(t){return t});c.enter().append("g").attr("class",function(t){return Xe+"cell cell uid_"+t}).merge(c).classed("tau-active",!0),nt(c,this.config.guide.animationSpeed).attr("opacity",1),nt(c.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()},e.prototype._drawDimAxis=function(t,e,n,r){var i=On.get(e.guide.tickFormat,e.guide.tickFormatNullAlias),a=vr({scale:e.scaleObj,scaleGuide:e.guide,ticksCount:i?_r(r/e.guide.density):null,tickFormat:i||null,position:n}),u=this.config.guide.animationSpeed;wr(t,this._getAxisSelector(e)).classed("tau-active",!0).classed(e.guide.cssClass,!0).call(function(t){var e=nt(t,u,"axisTransition"),r=t.attr("transform");Ne.apply(o,n)!==r&&(r?e:t).attr("transform",Ne.apply(o,n)),e.call(a),e.attr("opacity",1)})},e.prototype._removeDimAxis=function(t,e){var n=st(t,this._getAxisSelector(e)).classed("tau-active",!1);nt(n,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()},e.prototype._getAxisSelector=function(t){return"g."+("h"===je(t.guide.scaleOrient)?"x":"y")+".axis"},e.prototype._drawGrid=function(t,e,n,r){var i=this;return wr(t,"g.grid").attr("transform",Ne(0,0)).call(function(t){var o=t,a=i.config.guide.animationSpeed,u=(e.guide.showGridLines||"").toLowerCase();if(u.length>0){var s=wr(o,"g.grid-lines");if(u.indexOf("x")>-1){var c=e.x,l=On.get(c.guide.tickFormat),f=br({scale:c.scaleObj,scaleGuide:c.guide,tickSize:r,ticksCount:l?_r(n/c.guide.density):null}),d=wr(s,"g.grid-lines-x");nt(d,a).call(f)}if(u.indexOf("y")>-1){var h=e.y,p=(l=On.get(h.guide.tickFormat),br({scale:h.scaleObj,scaleGuide:h.guide,tickSize:-n,ticksCount:l?_r(r/h.guide.density):null})),g=wr(s,"g.grid-lines-y");nt(g,a).call(p)}}})},e}(m),Mr=n(11),Or=n(8),Ar=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),kr=function(){return(kr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n})}else{var o=n[t].map(r[t].invert);e=[o[0],o[1]]}return{dim:r[t].dim,func:r[t].discrete?"inset":"between",args:e}});e.fire("brush",u)}};return t.selectAll(".brush").remove(),t.append("g").attr("class","brush").each(function(t){var e=r[t].range();i[t]=Er.brushY().extent([[0,e[0]],[16,e[1]]]).on("start",u).on("brush",c).on("end",s),Er.select(this).classed("brush-"+Ft(t),!0).call(i[t]),o=!1,i[t].move(Er.select(this),e),o=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),t},e.prototype._forceBrushing=function(t){void 0===t&&(t={});var e=this.columnsBrushes,n=this.columnsScalesMap;this.columnsSelections;Object.keys(t).filter(function(r){return e[r]&&n[r]&&t[r]}).forEach(function(r){var i=t[r],o=[];if(n[r].discrete){var a=i.map(n[r]).filter(function(t){return t>=0}),u=n[r].stepSize()/2;o=[Math.min.apply(Math,a)-u,Math.max.apply(Math,a)+u]}else o=[i[0],i[1]];var s=Ft(r);e[r](Er.select(".brush-"+s)),e[r].move(Er.select(".brush-"+s),o.map(n[r]))})},e}(m),Cr=n(12);var Nr=n(4),Lr=function(){var t,e=[],n=[],r=1,i=1,o={},a=!1,u=function(t){var r=e.length,i=0,o=e[t].x-n[t].x,a=n[t].y-e[t].y,u=Math.sqrt(o*o+a*a);u>0&&(i+=.2*u),a/=u,i+=(o/=u)>0&&a>0?0:o<0&&a>0?3:o<0&&a<0?6:9;for(var s,c,f,d,h=e[t].x,p=e[t].y-e[t].height+2,g=e[t].x+e[t].width,m=e[t].y+2,y=0;yr&&(e[c].x=l),e[c].x<0&&(e[c].x=l),e[c].y>i&&(e[c].y=f),e[c].y<0&&(e[c].y=f);var d=(a?t(c,e,n):u(c))-s;Math.random()r&&(e[c].x=l),e[c].x<0&&(e[c].x=l),e[c].y>i&&(e[c].y=f),e[c].y<0&&(e[c].y=f);var y=(a?t(c,e,n):u(c))-s;Math.random()1||c<0||c>1)},f=function(t,e,n){return t-e/n};return o.start=function(t){for(var n=e.length,r=1,i=0;i=200&&r.status<300){var t=r.responseText;try{n(null,JSON.parse(t))}catch(t){n(t,null)}}else n(new Error(r.status+": "+r.statusText),null)},r.onerror=function(t){n(t.error,null)},r.open("GET",e,!0),r.send(null)):this._drawMap(t,o.sourcemap)},e.prototype._calcLabels=function(t,e,n){var r=this.W,i=this.H,o={};return e.forEach(function(e){var a=(Nr.feature(t,t.objects[e]).features||[]).map(function(t){var i=t.properties||{},o=n.centroid(t),a=n.bounds(t),u=o[0],s=o[1],c=a[1][0]-a[0][0],l=i.name||"",f=i.abbr||l,d=c<5.5*l.length?f:l,h=c<13.75,p=h?r-u-16.5:0;return{id:e+"-"+t.id,sx:u,sy:s,x:u+p,y:s,width:5.5*d.length,height:10,name:d,r:p,isRef:h}}).filter(function(t){return!Number.isNaN(t.x)&&!Number.isNaN(t.y)}),u=a.map(function(t){return{x:t.sx,y:t.sy,r:t.r}});Lr().label(a).anchor(u).width(r).height(i).start(10),a.filter(function(t){return!t.isRef}).map(function(t){return t.x=t.sx,t.y=t.sy,t}).reduce(function(t,e){return t[e.id]=e,t},o);var s=a.filter(function(t){return t.isRef});s.length<6&&s.reduce(function(t,e){return t[e.id]=e,t},o)}),o},e.prototype._drawMap=function(t,e){var n,r,i=this,o=this,u=this.config.guide,s=this.config.options,c=this.config.options.container,l=this.latScale,f=this.lonScale,d=this.sizeScale,h=this.colorScale,p=this.codeScale,g=this.fillScale,m=this.W,y=this.H,v=zr.filter(function(t){return(e.objects||{}).hasOwnProperty(t)});if(0===v.length)throw new Error("Invalid map: should contain some contours");if(g.dim){if(!p.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===v.indexOf(p.georole))throw console.log('There is no contour for georole "'+p.georole+'"'),console.log("Available contours are: "+v.join(" | ")),new Error("Invalid [georole]");n=p.georole}else n=v[v.length-1];if(this.contourToFill=n,l.dim&&f.dim){var b=Fr.extent(l.domain()),x=Fr.extent(f.domain());r=[(x[1]+x[0])/2,(b[1]+b[0])/2]}var w=this._createProjection(e,v[0],r),_=Fr.geoPath().projection(w),S=c.selectAll(".map-container").data([""+m+y+r+v.join("-")],function(t){return t});S.exit().remove();var M=S.enter().append("g").call(function(t){var n=t;n.attr("class","map-container");var r={},i=v.reduceRight(function(t,e){return t.concat(e)},[]);if(u.showNames&&(r=o._calcLabels(e,i,_)),i.forEach(function(t,i){var o=function(e){return r[t+"-"+e.id]};n.selectAll(".map-contour-"+t).data(Nr.feature(e,e.objects[t]).features||[]).enter().append("g").call(function(e){var n=e;n.attr("class","map-contour-"+t+" map-contour-level map-contour-level-"+i).attr("fill","none"),n.append("title").text(function(t){return(t.properties||{}).name}),n.append("path").attr("d",_),n.append("text").attr("class","place-label-"+t).attr("transform",function(t){var e=o(t);return e?"translate("+[e.x,e.y]+")":""}).text(function(t){var e=o(t);return e?e.name:""}),n.append("line").attr("class","place-label-link-"+t).attr("stroke","gray").attr("stroke-width",.25).attr("x1",function(t){var e=o(t);return e&&e.isRef?e.sx:0}).attr("y1",function(t){var e=o(t);return e&&e.isRef?e.sy:0}).attr("x2",function(t){var e=o(t);return e&&e.isRef?e.x-.6*e.name.length*5.5:0}).attr("y2",function(t){var e=o(t);return e&&e.isRef?e.y-3.5:0})})}),e.objects.hasOwnProperty("places")){var a=Nr.feature(e,e.objects.places),s=a.features.map(function(t){var e=w(t.geometry.coordinates);return{x:e[0]+3.5,y:e[1]+3.5,width:5.5*t.properties.name.length,height:12,name:t.properties.name}}),c=a.features.map(function(t){var e=w(t.geometry.coordinates);return{x:e[0],y:e[1],r:2.5}});Lr().label(s).anchor(c).width(m).height(y).start(100),n.selectAll(".place").data(c).enter().append("circle").attr("class","place").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("r",function(t){return t.r+"px"}),n.selectAll(".place-label").data(s).enter().append("text").attr("class","place-label").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).text(function(t){return t.name})}}).merge(S);this.groupByCode=t.reduce(function(t,e){return e.part().reduce(function(t,e){return t[(e[p.dim]||"").toLowerCase()]=e,t},t)},{});var O=this._resolveFeature.bind(this);if(M.selectAll(".map-contour-"+n).data(Nr.feature(e,e.objects[n]).features).call(function(t){t.classed("map-contour",!0).attr("fill",function(t){var e=O(t);return null===e?u.defaultFill:g(e[g.dim])})}).on("mouseover",function(t){return i.fire("area-mouseover",{data:O(t),event:a.event})}).on("mouseout",function(t){return i.fire("area-mouseout",{data:O(t),event:a.event})}).on("click",function(t){return i.fire("area-click",{data:O(t),event:a.event})}),!l.dim||!f.dim)return[];var A=function(t){return t.attr("r",function(t){return d(t[d.dim])}).attr("transform",function(t){var e=t.data;return"translate("+w([e[f.dim],e[l.dim]])+")"}).attr("class",function(t){var e=t.data;return h(e[h.dim])}).attr("opacity",.5).on("mouseover",function(t){var e=t.data;return o.fire("point-mouseover",{data:e,event:a.event})}).on("mouseout",function(t){var e=t.data;return o.fire("point-mouseout",{data:e,event:a.event})}).on("click",function(t){var e=t.data;return o.fire("point-click",{data:e,event:a.event})})},k=M.selectAll(".frame").data(t.map(function(t){return{tags:t.key||{},hash:t.hash(),data:t.part()}}),function(t){return t.hash});return k.exit().remove(),k.enter().append("g").merge(k).call(function(t){t.attr("class",function(t){return"frame frame-"+t.hash}).call(function(t){var e=t.selectAll("circle").data(function(t){return t.data.map(function(t){return{data:t,uid:s.uid}})});e.exit().remove(),e.call(A),e.enter().append("circle").call(A)})}),[]},e.prototype._resolveFeature=function(t){var e,n=this.groupByCode,r=t.properties,i=["c1","c2","c3","abbr","name"].filter(function(t){return r.hasOwnProperty(t)&&r[t]&&n.hasOwnProperty(r[t].toLowerCase())});if(0===i.length)e=null;else if(i.length>0){var o=r[i[0]].toLowerCase();e=n[o]}return e},e.prototype._highlightArea=function(t){var e=this,n=this.config.options.container,r=this.contourToFill;n.selectAll(".map-contour-"+r).classed("map-contour-highlighted",function(n){return t(e._resolveFeature(n))})},e.prototype._highlightPoint=function(t){this.config.options.container.selectAll("circle").classed("map-point-highlighted",function(e){var n=e.data;return t(n)}).attr("opacity",function(e){var n=e.data;return t(n)?.5:.1})},e.prototype._createProjection=function(t,e,n){var r=this.W,i=this.H,o=this.config.guide,a=100,u=[r/2,i/2],s=n||t.center,c=o.projection||t.projection||"mercator",l=this._createD3Projection(c,s,a,u),f=Fr.geoPath().projection(l).bounds(Nr.feature(t,t.objects[e])),d=a*r/(f[1][0]-f[0][0]),h=a*i/(f[1][1]-f[0][1]);return a=d=0},qr=function(t,e){return!t.discrete&&e[t.dim]<0},Xr=function(t,e){return t.w(e)/2+Math.floor(t.model.size(e)/Ur(t,e))},Yr=function(t,e){return t.h(e)/2+Math.floor(t.model.size(e)/Ur(t,e))},Vr=function(t){return function(e){return{dx:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Gr(r,n))return e.dx(n);if("-"===t[2]&&!qr(r,n))return e.dx(n);var i=t[1],o=t[0]===t[0].toUpperCase()?1:0;return e.dx(n)+i*o*e.model.size(n)/2+i*Xr(e,n)}}}},$r=function(t){return function(e){return{dy:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Gr(r,n))return e.dy(n);if("-"===t[2]&&!qr(r,n))return e.dy(n);var i=t[1],o=t[0]===t[0].toUpperCase()?1:0;return e.dy(n)+i*o*e.model.size(n)/2+i*Yr(e,n)}}}};Wr.regRule("l",Vr(["l",-1,null])).regRule("L",Vr(["L",-1,null])).regRule("l+",Vr(["l",-1,"+"])).regRule("l-",Vr(["l",-1,"-"])).regRule("L+",Vr(["L",-1,"+"])).regRule("L-",Vr(["L",-1,"-"])).regRule("r",Vr(["r",1,null])).regRule("R",Vr(["R",1,null])).regRule("r+",Vr(["r",1,"+"])).regRule("r-",Vr(["r",1,"-"])).regRule("R+",Vr(["R",1,"+"])).regRule("R-",Vr(["R",1,"-"])).regRule("t",$r(["t",-1,null])).regRule("T",$r(["T",-1,null])).regRule("t+",$r(["t",-1,"+"])).regRule("t-",$r(["t",-1,"-"])).regRule("T+",$r(["T",-1,"+"])).regRule("T-",$r(["T",-1,"-"])).regRule("b",$r(["b",1,null])).regRule("B",$r(["B",1,null])).regRule("b+",$r(["b",1,"+"])).regRule("b-",$r(["b",1,"-"])).regRule("B+",$r(["B",1,"+"])).regRule("B-",$r(["B",1,"-"])).regRule("rotate-on-size-overflow",function(t,e){var n=e.data,r=e.lineBreakAvailable,i={};if(n.reduce(function(e,n){return e+(function(e){return t.model.size(e).5){var o=r?-.5:.5;i={angle:function(){return-90},w:function(e){return t.h(e)},h:function(e){return t.w(e)},dx:function(e){return t.h(e)*o-2},dy:function(){return 0}}}return i}).regRule("hide-by-label-height-vertical",function(t){return{hide:function(e){var n,r;return 0===t.angle(e)?(r=t.h(e),n=Math.abs(t.model.y0(e)-t.model.yi(e))):(r=t.w(e),n=t.model.size(e)),r>n||t.hide(e)}}}).regRule("cut-label-vertical",function(t){return{h:function(e){var n=t.h(e);if(Math.abs(t.angle(e))>0){var r=Math.abs(t.model.y0(e)-t.model.yi(e));return r0){var i=t.model.y0(e)=0?1:-1}(t,n)*e(t,n)};return t.model.flip?{dx:n}:{dy:n}}).regRule("inside-start-then-outside-end-horizontal",function(t,e){var n=[Wr.getRule("from-beginning"),Wr.getRule("towards"),Wr.getRule("cut-label-horizontal")].reduce(function(t,n){return Ir.compose(t,n(t,e))},t),r=[Wr.getRule("to-end"),Wr.getRule("towards"),Wr.getRule("cut-outer-label-horizontal")].reduce(function(t,n){return Ir.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("inside-start-then-outside-end-vertical",function(t,e){var n=[Wr.getRule("from-beginning"),Wr.getRule("towards"),Wr.getRule("cut-label-vertical")].reduce(function(t,n){return Ir.compose(t,n(t,e))},t),r=[Wr.getRule("to-end"),Wr.getRule("towards"),Wr.getRule("cut-outer-label-vertical")].reduce(function(t,n){return Ir.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("outside-then-inside-horizontal",function(t,e){var n=["r+","l-","cut-outer-label-horizontal"].map(Wr.getRule).reduce(function(t,n){return Ir.compose(t,n(t,e))},t),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(Wr.getRule).reduce(function(t,n){return Ir.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return r.label(t).length>n.label(t).length}(t)?r:n)[e](t)},t},{}))}).regRule("outside-then-inside-vertical",function(t,e){var n=["t+","b-","cut-outer-label-vertical"].map(Wr.getRule).reduce(function(t,n){return Ir.compose(t,n(t,e))},t),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(Wr.getRule).reduce(function(t,n){return Ir.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,i){return t[i]=function(t){return(function(t){var r=n.y(t,e)+n.dy(t,e);return r<=0||r>=e.maxHeight}(t)?r:n)[i](t,e)},t},{}))}).regRule("hide-by-label-height-horizontal",function(t){return{hide:function(e){return t.model.size(e)0)return r+a;var u=i+o/2-n;return u>0?r-u:r},dy:function(e){var n=t.dy(e),i=t.y(e)+n,o=t.h(e);if(0-(i-o/2)>0)return 0;var a=i+o/2-r;return a>0?n-a:n}}}).regRule("multiline-label-left-align",function(t){return{dy:function(e){var n=t.dy(e);return-90===t.angle(e)?n+t.h(e)/2:n}}}).regRule("multiline-label-vertical-center-align",function(t){return{dy:function(e){return t.dy(e)-t.h(e)/2}}}).regRule("multiline-hide-on-container-overflow",function(t,e){var n=e.maxWidth,r=e.maxHeight;return{hide:function(e){var i=t.angle(e),o=t.x(e)+t.dx(e),a=t.y(e)+t.dy(e);return!(!qt(o,t.w(e),i,n)&&!Xt(a,t.h(e),i,r))||t.hide(e)}}});var Jr=function(){function t(t){this.minError=Number.MAX_VALUE,this.items=t.items,this.revision=this.items.map(function(t){return{i:t.i,x:t.x,y:t.y}}),this.penalties=t.penalties,this.transactor=t.transactor,this.cooling_schedule=t.cooling_schedule||function(t,e,n){return t-e/n}}return t.prototype.energy=function(t){return this.penalties.reduce(function(e,n){return e+n(t)},0)},t.prototype.move=function(t){var e=Math.floor(Math.random()*this.items.length),n=this.transactor(this.items[e]),r=this.energy(e);this.items[e]=n.modify();var i=this.energy(e),o=i-r,a=o<0?1:Math.exp(-o/t);Math.random()>=a?this.items[e]=n.revert():i0&&d.length>0?this.autoPosition(l,d):l;var h=f.reduce(function(t,e){var n;return Object.assign(t,((n={})[e]=!0,n))},{});l.text=l.text=h["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(l.text,s):l.text,l.text=l.text=h["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(l.text,s):l.text,l.text=h["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(l.text,l.edges):l.text,l.text=h["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(l.text):l.text,l.text=h["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(l.text):l.text;var p=l.text,g=function(t){return function(e,n){return p[n][t]}},m=g("x"),y=g("y"),v=g("angle"),b=g("color"),x=g("label"),w=function(t){if(t.style("fill",b).style("font-size",e.guide.fontSize+"px").style("display",function(t,e){return p[e].hide?"none":null}).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",function(t,e){return"translate("+m(t,e)+","+y(t,e)+") rotate("+v(t,e)+")"}),i){t.each(function(t,e){var n=a.select(this),r=v(t,e);n.text(null),x(t,e).split(o).forEach(function(t,e){n.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(e+1)+"em").text(t)})})}else t.text(x)};r.hideEqualLabels&&p.filter(function(t){return!t.hide}).filter(function(t,e,n){return e0&&(t.hide=!0)}),t},t.prototype.hideOnLabelLabelOverlap=function(t){var e=this,n={min:0,max:1,norm:2},r={"min/min":function(t,e){return e.y-t.y},"max/max":function(t,e){return t.y-e.y},"min/max":function(){return-1},"min/norm":function(){return-1},"max/norm":function(){return-1},"norm/norm":function(t,e){return t.y-e.y}};return t.filter(function(t){return!t.hide}).sort(function(t,e){return n[t.extr]-n[e.extr]}).forEach(function(i){t.forEach(function(t){i.i!==t.i&&function(t,i){var o=e.getLabelRect(t),a=e.getLabelRect(i),u=Number(!t.hide&&!i.hide);if(u*Math.max(0,Math.min(a.x1,o.x1)-Math.max(o.x0,a.x0))*(u*Math.max(0,Math.min(a.y1,o.y1)-Math.max(o.y0,a.y0)))>0){var s=[t,i];s.sort(function(t,e){return n[t.extr]-n[e.extr]}),(r[s[0].extr+"/"+s[1].extr](s[0],s[1])<0?s[0]:s[1]).hide=!0}}(i,t)})}),t},t.prototype.getLabelRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.w/2-e,x1:t.x+t.w/2+e,y0:t.y-t.h/2-e,y1:t.y+t.h/2+e}},t.prototype.getPointRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.size/2-e,x1:t.x+t.size/2+e,y0:t.y-t.size/2-e,y1:t.y+t.size/2+e}},t.prototype.hideOnLabelAnchorOverlap=function(t){var e=this,n=function(t,n){var r=e.getLabelRect(t,2),i=e.getPointRect(n,2);return Math.max(0,Math.min(i.x1,r.x1)-Math.max(i.x0,r.x0))*Math.max(0,Math.min(i.y1,r.y1)-Math.max(i.y0,r.y0))>.001};return t.filter(function(t){return!t.hide}).forEach(function(e){for(var r=t.length,i=0;ir.right+s||ur.bottom+s)return null;var c=(i.find(a,u)||[]).map(function(t){var e=Math.sqrt(Math.pow(a-t.x,2)+Math.pow(u-t.y,2));if(e>s)return null;var n=ee.size)+" 1",n.left[0].x+","+n.left[0].y,"Z"].join(" "):di(t.size>e.size?t:e)}function pi(t,e,n,r){var i=function(t,e,n,r){var i=yi(t,r);if(0===i||i+t.size/2<=r.size/2||i+r.size/2<=t.size/2)return null;var o=function(i){var o=i?[r,n,e,t]:[t,e,n,r],a=bi.apply(void 0,[1/12*2].concat(o)),u=bi.apply(void 0,[.5].concat(a.slice(0,4))),s=u[3],c=u[6],l=wi(o[0],s),f=wi(s,c),d=[l.left[0],T(.5,l.left[1],f.left[0]),f.left[1]],h=[l.right[0],T(.5,l.right[1],f.right[0]),f.right[1]],p=xi.apply(void 0,d)[1],g=xi.apply(void 0,h)[1],m=T(4,l.left[0],p),y=T(4,l.right[0],g);return{left:i?[y,h[0]]:[d[0],m],right:i?[m,d[0]]:[h[0],y]}},a=o(!1),u=o(!0);return{left:a.left.concat(u.left),right:a.right.concat(u.right)}}(t,e,n,r);if(!i)return hi(t,r);var o=mi(gi(t,i.right[0]),gi(t,i.left[0])),a=mi(gi(r,i.right[1]),gi(r,i.left[1]));return["M"+i.left[0].x+","+i.left[0].y,"C"+i.left[1].x+","+i.left[1].y,i.left[2].x+","+i.left[2].y,i.left[3].x+","+i.left[3].y,"A"+r.size/2+","+r.size/2+" 0 "+Number(o>Math.PI)+" 1",i.right[3].x+","+i.right[3].y,"C"+i.right[2].x+","+i.right[2].y,i.right[1].x+","+i.right[1].y,i.right[0].x+","+i.right[0].y,"A"+t.size/2+","+t.size/2+" 0 "+Number(a>Math.PI)+" 1",i.left[0].x+","+i.left[0].y,"Z"].join(" ")}function gi(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function mi(t,e){return e1?[t]:[]},d);f.exit().remove(),f.call(u(n.animationSpeed,o.pathAttributesUpdateInit,o.pathAttributesUpdateDone,o.afterPathUpdate));f.enter().append(o.pathElement).call(u(n.animationSpeed,o.pathAttributesEnterInit,o.pathAttributesEnterDone,o.afterPathUpdate)).merge(f).call(function(t){e.guide.animationSpeed>0&&!document.hidden?(t.attr(o.pathTween.attr,function(t){return o.pathTween.fn.call(this,t)(0)}),nt(t,e.guide.animationSpeed,"pathTransition").attrTween(o.pathTween.attr,o.pathTween.fn)):t.attr(o.pathTween.attr,function(t){return o.pathTween.fn.call(this,t)(1)})});if(t.subscribe(l),"never"!==n.showAnchors){var h=function(t,e,n){var r=e.anchorShape,i=t.config.guide,o=t.screenModel,a=_i({},Si[r].getInitialAttrs(t,e),{opacity:"hover"===i.showAnchors?0:1,fill:function(t){return o.color(t)},class:"i-data-anchor"}),u=n.selectAll(".i-data-anchor").data(function(t){return t.filter(si)},o.id);return u.exit().remove(),u.call(ut(i.animationSpeed,null,a)),u.enter().append(Si[e.anchorShape].element).call(ut(i.animationSpeed,{r:0},a)).merge(u)}(t,o,r);t.subscribe(h)}},c=i.toFibers(),l=c.map(function(t){return t.filter(si)}),f=r.container.selectAll(".frame"),d=function(){var t=f.empty()?[]:f.data(),e=new Map;f.each(function(t){e.set(t,Number(this.getAttribute("data-id")))});var n=t.reduce(function(t,e){return t.set(e,e.map(i.id)),t},new Map),r=new Map,o=Math.max.apply(Math,[0].concat(Array.from(e.values())));return function(t){if(r.has(t))return r.get(t);var a,u=t.map(function(t){return i.id(t)}),s=(Array.from(n.entries()).find(function(t){var e=t[1];return u.some(function(t){return e.some(function(e){return e===t})})})||[null])[0];return a=s?e.get(s):++o,r.set(t,a),a}}();this._getDataSetId=d;var h=f.data(c,d);h.exit().remove(),h.call(s),h.enter().append("g").attr("data-id",d).call(s),h.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),t.subscribe(new ei(i.model,e.flip,e.guide.label,r).draw(l))},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=a.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n)}}).filter(function(t){return!isNaN(t.x)&&!isNaN(t.y)}),i=r.reduce(function(t,e){var n=e.x,r=e.y;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,t.top),t.bottom=Math.max(r,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Vt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),u=o.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=o.find(n?function(e){return t.y===e}:function(e){return t.x===e});u[e].push(t)});var s=function(t){if(1===t.length)return u[t[0]];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:s(t.slice(0,e)),greater:s(t.slice(e))}};return{bounds:i,tree:s(o)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,o=this.node().config.options.container,a=this.node().config.flip,u=ze(o.node()),s=this.node().config.guide.maxHighlightDistance;if(tr.right+u.x+s||er.bottom+u.y+s)return null;var c=a?e-u.y:t-u.x,l=function t(e){return Array.isArray(e)?e:t(c>e.middle?e.greater:e.lower)}(i).map(function(n){var r=n.x+u.x,i=n.y+u.y,o=Math.abs(a?e-i:t-r),s=Math.abs(a?t-r:e-i);return{node:n.node,data:n.data,distance:o,secondaryDistance:s,x:r,y:i}});return Mi(t,e,l)},highlight:function(t){var e,n,r=this.node().config.options.container,i="tau-chart__highlighted",o="tau-chart__dimmed",a=r.selectAll(".i-role-path"),u=a.data().filter(function(e){return e.filter(si).some(t)}),s=u.length>0;a.call(ft(((e={})[i]=function(t){return s&&u.indexOf(t)>=0},e[o]=function(t){return s&&u.indexOf(t)<0},e)));var c=((n={})[i]=function(e){return!0===t(e)},n[o]=function(e){return!1===t(e)},n);r.selectAll(".i-role-dot").call(ft(c)),r.selectAll(".i-role-label").call(ft(c)),this._sortElements(t)},highlightDataPoints:function(t){var e=this.node(),n=function(t,e,n){var r=e.anchorShape,i=t.screenModel,o="hover"===t.config.guide.showAnchors;return t.config.options.container.selectAll(".i-data-anchor").call(lt(Si[r].getHighlightAttrs(t,e,n))).attr("opacity",o?function(t){return n(t)?1:0}:function(){return 1}).attr("fill",function(t){return i.color(t)}).attr("class",function(t){return Te("i-data-anchor",i.class(t))}).classed(Xe+"highlighted",n)}(e,this.domElementModel,t),r=e.config.options.container,i=e.config.flip,o=n.filter(t),a=r.select(".cursor-line");if(o.empty())a.remove();else{a.empty()&&(a=r.append("line"));var u=e.screenModel.model,s=u.xi(o.data()[0]),c=u.xi(o.data()[0]),l=u.scaleY.domain(),f=u.scaleY(l[0]),d=u.scaleY(l[1]);a.attr("class","cursor-line").attr("x1",i?f:s).attr("y1",i?s:f).attr("x2",i?d:c).attr("y2",i?c:d)}this._sortElements(t)},_sortElements:function(t){var e=this.node().config.options.container,n=new Map,r=new Map,i=this._getDataSetId;e.selectAll(".i-role-path").each(function(e){n.set(this,i(e)),r.set(this,e.filter(si).some(t))});var o=ee(function(t,e){return r.get(t)-r.get(e)},function(t,e){return n.get(t)-n.get(e)}),a={line:0,g:1,text:2};Ee(e.node(),function(t,e){return"g"===t.tagName&&"g"===e.tagName?o(t,e):a[t.tagName]-a[e.tagName]})}},ki=[1,2,3,4,5],Ei=ki.map(function(t){return Xe+"line-opacity-"+t}),Ti=ki.map(function(t){return Xe+"line-width-"+t});function Ci(t){return Ei[t-1]||Ei[4]}function Ni(t,e){return t.length<2?"":String.prototype.concat.apply("",t.concat(e.slice().reverse()).map(function(t,e){return(0===e?"":" ")+t.x+","+t.y}))}function Li(t,e){if(t.length<2)return"";var n=function(t){var e=t.map(function(t,e){return""+((e-1)%3==0?"C":"")+t.x+","+t.y+" "});return String.prototype.concat.apply("",e)};return"M"+n(t)+"L"+n(e.slice().reverse())+"Z"}var ji=function(){return(ji=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&(n=Pi.rgb(n).darker(1)),n}};e.pathAttributesEnterInit=o,e.pathAttributesUpdateDone=o;var a="polyline"===J(n.interpolate);return e.pathElement=a?"polygon":"path",e.anchorShape="vertical-stick",e.pathTween={attr:a?"points":"d",fn:ct(0,a?Ni:Li,[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}},function(n){return{id:t.id(n),x:e.x0(n),y:e.y0(n)}}],t.id,n.interpolate)},e},_getBoundsInfo:function(t){if(0===t.length)return null;var e,n,r=this.node().screenModel,i=this.node().config.flip,o=t.map(function(t){var e=Pi.select(t).data()[0];return{node:t,data:e,x:r.x(e),y:r.y(e),y0:r.y0(e),group:r.group(e)}}),a=o.reduce(function(t,e){var n=e.x,r=e.y,i=e.y0;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,i,t.top),t.bottom=Math.max(r,i,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),u=Vt(o.map(i?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),s=u.reduce(function(t,e){return t[e]=[],t},{});if(o.forEach(function(t){var e=u.find(i?function(e){return t.y===e}:function(e){return t.x===e});s[e].push(t)}),e=Object.keys(o.reduce(function(t,e){return t[e.group]=!0,t},{})),n=e.reduce(function(t,e,n){return t[e]=n,t},{}),u.forEach(function(t){var r=s[t];if(r.sort(function(t,e){return n[t.group]-n[e.group]}),r.lengthr.right+u.x+s||er.bottom+u.y+s)return null;var c=a?e-u.y:t-u.x,l=function t(e){if(e.isLeaf)return e;var n=e.left.end;return t(c1&&(f=1);var d,h=(d=l.items.start.reduce(function(t,e){return t[e.group]={start:e,end:null,y:null,y0:null},t},{}),l.items.end.forEach(function(t){void 0!==d[t.group]?d[t.group].end=t:delete d[t.group]}),Object.keys(d).forEach(function(t){var e=d[t];e.end?(e.y=e.start.y+f*(e.end.y-e.start.y),e.y0=e.start.y0+f*(e.end.y0-e.start.y0)):delete d[t]}),Object.keys(d).map(function(t){return d[t]}).map(function(t){return{y:t.y,y0:t.y0,el:f<.5?t.start:t.end}}).filter(function(t){return null!=t.el.data})),p=e-u.y,g=h.filter(function(t){return p>=t.y&&p<=t.y0}),m=(g.length>0?g:h).map(function(t){return t.el}).map(function(n){var r=n.x+u.x,i=n.y+u.y,o=Math.abs(a?e-i:t-r),s=Math.abs(a?t-r:e-i);return{node:n.node,data:n.data,distance:o,secondaryDistance:s,x:r,y:i}});return Mi(t,e,m)}},zi={draw:Ai.draw,getClosestElement:Ai.getClosestElement,highlight:Ai.highlight,highlightDataPoints:Ai.highlightDataPoints,addInteraction:Ai.addInteraction,_getBoundsInfo:Ai._getBoundsInfo,_sortElements:Ai._sortElements,init:function(t){var e=Ai.init(t);return e.transformRules=[e.flip&&O.get("flip")],e.adjustRules=[function(t,n){var r=t.scaleSize.isEmptyScale(),i=Zt(e.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),o=Object.assign({},n,{defMin:i.defMinSize,defMax:i.defMaxSize,minLimit:i.minSize,maxLimit:i.maxSize});return O.get("adjustStaticSizeScale")(t,o)}],e},buildModel:function(t){var e=Ai.baseModel(t),n=this.node().config.guide,r=Ci(t.model.scaleColor.domain().length),i=Xe+"area area i-role-path "+r+" "+n.cssClass+" ";e.groupAttributes={class:function(t){return i+" "+e.class(t[0])+" frame"}};var o,a,u={fill:function(t){return e.color(t[0])},stroke:function(t){return e.color(t[0])}};return e.pathAttributesEnterInit=u,e.pathAttributesUpdateDone=u,e.pathElement="polygon",e.anchorShape="circle",e.pathTween={attr:"points",fn:ct(0,(o=function(t){return t.x},a=function(t){return t.y},function(t){return t.map(function(t){return[o(t),a(t)].join(",")}).join(" ")}),[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}}],t.id)},e}};function Ri(t){if(t.length<2)return"";for(var e="",n=0;n=160&&e<320?n=1:e>=320&&e<480?n=2:e>=480&&e<640?n=3:e>=640&&(n=4),Ti[n]):"",s=Ci(t.model.scaleColor.domain().length),c=a?"line":"area",l=""+Xe+c+" "+c+" i-role-path "+u+" "+s+" "+i.cssClass+" ",f=a?{stroke:function(t){return h.color(t[0])},class:"i-role-datum"}:{fill:function(t){return h.color(t[0])}},d="cubic"===J(i.interpolate)?a?Di:fi:a?Ri:li,h=Ai.baseModel(t),p=a?function(e){return{id:t.id(e),x:h.x(e),y:h.y(e)}}:function(e){return{id:t.id(e),x:h.x(e),y:h.y(e),size:h.size(e)}};return h.groupAttributes={class:function(t){return l+" "+h.class(t[0])+" frame"}},h.pathElement="path",h.anchorShape="circle",h.pathAttributesEnterInit=f,h.pathAttributesUpdateDone=f,h.pathTween={attr:"d",fn:ct(0,d,[p],t.id,i.interpolate)},h}},Bi=function(t){return a.select(t).data()[0]},Wi={init:function(t){var e=Object.assign({},t);e.guide=e.guide||{},e.guide=Zt(e.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=e.guide.enableColorToBarPosition?e.guide.enableColorToBarPosition:!e.stack}),e.guide.size=Zt(e.guide.size||{},{enableDistributeEvenly:!0}),e.guide.label=Zt(e.guide.label||{},{position:e.flip?e.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:e.stack?["rotate-on-size-overflow","t-","b+","hide-by-label-height-vertical","cut-label-vertical","auto:hide-on-label-label-overlap"]:["rotate-on-size-overflow","outside-then-inside-vertical","auto:hide-on-label-label-overlap"]});var n=e.guide.avoidScalesOverflow,r=e.guide.enableColorToBarPosition,i=e.guide.size.enableDistributeEvenly;return e.transformRules=[e.flip&&O.get("flip"),e.guide.obsoleteVerticalStackOrder&&O.get("obsoleteVerticalStackOrder"),e.stack&&O.get("stack"),r&&O.get("positioningByColor")].filter(function(t){return t}),e.adjustRules=[i&&function(t,n){var r=Zt(e.guide.size||{},{defMinSize:e.guide.prettify?3:0,defMaxSize:e.guide.prettify?40:Number.MAX_VALUE}),i=Object.assign({},n,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return O.get("size_distribute_evenly")(t,i)},n&&i&&function(t,e){var n=Object.assign({},e,{sizeDirection:"x"});return O.get("avoidScalesOverflow")(t,n)},e.stack&&O.get("adjustYScale")].filter(function(t){return t}),e},addInteraction:function(){var t=this,e=this.node();e.on("highlight",function(e,n){return t.highlight(n)}),e.on("data-hover",function(e,n){return t.highlight((r=n.data,i=null,function(t){return t===r||i}));var r,i})},draw:function(){var t,e,n=this.node(),r=n.config,i=r.options;i.container=i.slot(r.uid);var o=r.guide.prettify,u="i-role-element i-role-datum bar "+Xe+"bar",s=n.screenModel,c=this.buildModel(s,{prettify:o,minBarH:1,minBarW:1,baseCssClass:u}),l=ut,f=r.flip?"y":"x",d=r.flip?"x":"y",h=r.flip?"width":"height",p=r.flip?"height":"width",g=s.toFibers(),m=g.reduce(function(t,e){return t.concat(e)},[]),y=c.class,v=Qt(c,"class"),b=i.container.selectAll(".bar").data(m,s.id);b.exit().classed("tau-removing",!0).call(l(r.guide.animationSpeed,null,((t={})[f]=function(){var t=a.select(this);return t.attr(f)-0+(t.attr(p)-0)/2},t[d]=function(){return this.getAttribute("data-zero")},t[p]=0,t[h]=0,t),function(t){var e=a.select(t);e.classed("tau-removing")&&e.remove()})),b.call(l(r.guide.animationSpeed,null,v));var x=b.enter().append("rect").call(l(r.guide.animationSpeed,(e={},e[d]=s[d+"0"],e[h]=0,e),v)).merge(b).attr("class",y).attr("data-zero",s[d+"0"]);n.subscribe(new ei(s.model,s.model.flip,r.guide.label,i).draw(g));var w,_=(w=m.reduce(function(t,e,n){return t.set(e,n+1),t},new Map),function(t,e){return(w.get(Bi(t))||-1)-(w.get(Bi(e))||-1)});this._barsSorter=r.guide.sortByBarHeight?r.flip?function(t,e){var n=Bi(t),r=Bi(e),i=c.width(n),o=c.width(r);if(i===o){var a=c.y(n),u=c.y(r);return a===u?_(t,e):a-u}return o-i}:function(t,e){var n=Bi(t),r=Bi(e),i=c.height(n),o=c.height(r);if(i===o){var a=c.x(n),u=c.x(r);return a===u?_(t,e):a-u}return o-i}:_;var S={rect:0,text:1};this._typeSorter=function(t,e){return S[t.tagName]-S[e.tagName]},this._sortElements(this._typeSorter,this._barsSorter),n.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel:function(t,e){var n,r=e.prettify,i=e.minBarH,o=e.minBarW,a=e.baseCssClass,u=function(e){var n=t.size(e);return r&&(n=Math.max(o,n)),n},s=function(e){return e[t.model.scaleY.dim]};if(t.flip){var c=function(e){return Math.abs(t.x(e)-t.x0(e))};n={y:function(e){return t.y(e)-.5*u(e)},x:function(e){var n=Math.min(t.x0(e),t.x(e));if(r){var o=c(e),a=s(e),u=0;return 0===a&&(u=0),a>0&&(u=o),a<0&&(u=0-i),o0?n-i:n);return n},width:function(t){return u(t)},height:function(t){var e=l(t);return r&&(e=0===s(t)?e:Math.max(i,e)),e}}}return Object.assign(n,{class:function(e){return a+" "+t.class(e)},fill:function(e){return t.color(e)}})},_sortElements:function(){for(var t=[],e=0;eu}}),i=r.reduce(function(t,e){var n=e.box;return t.left=Math.min(n.left,t.left),t.right=Math.max(n.right,t.right),t.top=Math.min(n.top,t.top),t.bottom=Math.max(n.bottom,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Vt(r.map(n?function(t){return t.cy}:function(t){return t.cx})).sort(function(t,e){return t-e}),u=o.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=o.find(n?function(e){return t.cy===e}:function(e){return t.cx===e});u[e].push(t)});var s=function(t){if(1===t.length)return u[t];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:s(t.slice(0,e)),greater:s(t.slice(e))}};return{bounds:i,tree:s(o)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,o=this.node().config.options.container,a=this.node().config.flip,u=ze(o.node()),s=t-u.x,c=e-u.y,l=this.node().config.guide.maxHighlightDistance;if(sr.right+l||cr.bottom+l)return null;var f=a?c:s,d=a?s:c;return function t(e){return Array.isArray(e)?e:t(f>e.middle?e.greater:e.lower)}(i).map(function(t){var e,n,r=a?t.box.left:t.box.top,i=a?t.box.right:t.box.bottom,o=(n=i,(e=d)>=r&&e<=n);if(!o&&Math.abs(d-r)>l&&Math.abs(d-i)>l)return null;var u=Math.abs(d-(t.invert!==a?i:r));return Object.assign(t,{distToValue:u,cursorInside:o})}).filter(function(t){return t}).sort(function(t,e){return t.cursorInside!==e.cursorInside?e.cursorInside-t.cursorInside:Math.abs(t.distToValue)-Math.abs(e.distToValue)}).map(function(t){var e=t.cx,n=t.cy,r=Math.abs(a?c-n:s-e),i=Math.abs(a?s-e:c-n);return{node:t.node,data:t.data,distance:r,secondaryDistance:i,x:e,y:n}})[0]||null},highlight:function(t){var e,n=this.node().config.options.container,r=((e={})["tau-chart__highlighted"]=function(e){return!0===t(e)},e["tau-chart__dimmed"]=function(e){return!1===t(e)},e);n.selectAll(".bar").call(ft(r)),n.selectAll(".i-role-label").call(ft(r)),this._sortElements(function(e,n){return t(Bi(e))-t(Bi(n))},this._typeSorter,this._barsSorter)}},Hi=n(14),Ui=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gi=function(t){function e(e){var n=t.call(this,e)||this;return n.config=e,n.config.guide=Zt(n.config.guide||{},{}),n.on("highlight",function(t,e){return n.highlight(e)}),n}return Ui(e,t),e.prototype.defineGrammarModel=function(t){var e=this.config,n=e.options;this.color=t("color",e.color,{}),this.scalesMap=e.columns.reduce(function(e,r){return e[r]=t("pos",r,[0,n.height]),e},{});var r=n.width/(e.columns.length-1),i=e.columns.reduce(function(t,e,n){return t[e]=n*r,t},{});return this.xBase=function(t){return i[t]},this.regScale("columns",this.scalesMap).regScale("color",this.color),{}},e.prototype.drawFrames=function(t){var e=this.config,n=this.config.options,r=this.scalesMap,i=this.xBase,o=this.color,a=Hi.line(),u=function(t){t.attr("d",function(t){return a(e.columns.map(function(e){return[i(e),r[e](t[r[e].dim])]}))})},s=function(t){t.attr("stroke",function(t){return o.toColor(o(t[o.dim]))}),t.attr("class",function(t){return Xe+"__line line "+o.toClass(o(t[o.dim]))+" foreground"})},c=function(t){var e=t.selectAll(".background").data(function(t){return t.part()});e.exit().remove(),e.call(u),e.enter().append("path").attr("class","background line").call(u);var n=t.selectAll(".foreground").data(function(t){return t.part()});n.exit().remove(),n.call(function(t){u(t),s(t)}),n.enter().append("path").call(function(t){u(t),s(t)})},l=n.container.selectAll(".lines-frame").data(t,function(t){return t.hash()});l.exit().remove(),l.call(c),l.enter().append("g").attr("class","lines-frame").call(c),this.subscribe(n.container.selectAll(".lines-frame .foreground"))},e.prototype.highlight=function(t){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",function(e){return t(e)?"":"hidden"})},e}(m),qi=function(){function t(t,e){var n,r=this;if(this._fields={},Array.isArray(e.fitToFrameByDims)&&e.fitToFrameByDims.length){n=t.part(function(t){var n={};return"where"===t.type&&t.args?(n.type=t.type,n.args=e.fitToFrameByDims.reduce(function(e,n){return t.args.hasOwnProperty(n)&&(e[n]=t.args[n]),e},{})):n=t,n})}else n=t.full();var i=this.getVarSet(n,e);e.order&&(i=Jt(Kt(e.order,i),i)),this.vars=i;var o=i.map(function(t){return t});this.scaleConfig=e,this.scaleConfig.nice=this.scaleConfig.hasOwnProperty("nice")?this.scaleConfig.nice:this.scaleConfig.autoScale,this.addField("dim",this.scaleConfig.dim).addField("scaleDim",this.scaleConfig.dim).addField("scaleType",this.scaleConfig.type).addField("source",this.scaleConfig.source).addField("domain",function(){return r.vars}).addField("isInteger",o.every(Number.isInteger)).addField("originalSeries",function(){return o}).addField("isContains",function(t){return r.isInDomain(t)}).addField("isEmptyScale",function(){return r.isEmpty()}).addField("fixup",function(t){var e=r.scaleConfig;e.__fixup__=e.__fixup__||{},e.__fixup__=Object.assign(e.__fixup__,t(Object.assign({},e,e.__fixup__)))}).addField("commit",function(){r.scaleConfig=Object.assign(r.scaleConfig,r.scaleConfig.__fixup__),delete r.scaleConfig.__fixup__})}return t.prototype.isInDomain=function(t){return this.domain().indexOf(t)>=0},t.prototype.addField=function(t,e){return this._fields[t]=e,this[t]=e,this},t.prototype.getField=function(t){return this._fields[t]},t.prototype.isEmpty=function(){return!Boolean(this._fields.dim)},t.prototype.toBaseScale=function(t,e){var n=this;void 0===e&&(e=null);var r=Object.keys(this._fields).reduce(function(t,e){return t[e]=n._fields[e],t},t);return r.getHash=function(){return Ft([n.vars,e].map(function(t){return JSON.stringify}).join(""))},r.value=r,r},t.prototype.getVarSet=function(t,e){return Vt(e.hasOwnProperty("series")?e.series:t.map(function(t){return t[e.dim]}),"date"===e.dimType?function(t){return new Date(t).getTime()}:function(t){return t})},t}(),Xi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Yi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._references=n.references,r._refCounter=n.refCounter,r.addField("scaleType","identity"),r}return Xi(e,t),e.prototype.create=function(){var t=this._references,e=this._refCounter;return this.toBaseScale(function(n,r){if(null==n){var i=t.get(r);null==i&&(i=e(),t.set(r,i))}else i=n;return i})},e}(qi),Vi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i=function(){return($i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var h=Math.max.apply(Math,u.map(Math.abs));u=[-h,h]}r.vars=u}return r.addField("scaleType","color").addField("discrete",i).addField("brewer",o).addField("toColor",Bt).addField("toClass",Wt),r}return Vi(e,t),e.prototype.create=function(){var t=this.discrete,e=this.vars,n=this.getField("brewer"),r=t?this.createDiscreteScale(e,n):this.createContinuesScale(e,n);return this.toBaseScale(r)},e.prototype.createDiscreteScale=function(t,e){var n,r=function(t,e){var n=t.map(function(t){return String(t).toString()});return Ji.scaleOrdinal().range(e).domain(n)},i=function(t){return function(e){return t(String(e).toString())}};if(Array.isArray(e))n=i(r(t,e));else if("function"==typeof e)n=function(n){return e(n,i(r(t,Gt(20).map(function(t){return"color20-"+(1+t)}))))};else{if(!Ct(e))throw new Error("This brewer is not supported");n=function(t,e){var n=Object.keys(t),r=n.map(function(e){return t[e]}),i=Ji.scaleOrdinal().range(r).domain(n);return function(n){return t.hasOwnProperty(n)?i(String(n)):e(n)}}(e,function(){return"color-default"})}return n},e.prototype.createContinuesScale=function(t,e){if(!Array.isArray(e))throw new Error("This brewer is not supported");return Ji.scaleLinear().domain(It(t.map(function(t){return t-0}),e.length)).range(e)},e}(qi),Zi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qi={sqrt:function(t){return Math.sqrt(t)},linear:function(t){return t}},to=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=r.scaleConfig,o=u.extent(r.vars),a=Number.isFinite(i.min)?i.min:o[0],s=Number.isFinite(i.max)?i.max:o[1];return r.vars=[Math.min.apply(Math,[a,o[0]].filter(Number.isFinite)),Math.max.apply(Math,[s,o[1]].filter(Number.isFinite))],r.addField("scaleType","size"),r.addField("funcType",n.func||"sqrt"),r}return Zi(e,t),e.prototype.isInDomain=function(t){var e=this.domain().sort(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(){var t,e=this.scaleConfig,n=this.vars,r=Zt({},e,{func:"sqrt",minSize:0,maxSize:1}),i=r.func,o=r.minSize,a=r.maxSize,u=Qi[i],s=n.filter(function(t){return Number.isFinite(Number(t))});if(0===s.length)t=function(){return a};else{var c,l,f=Math.min.apply(Math,s),d=Math.max.apply(Math,s),h=u(Math.max(Math.abs(f),Math.abs(d),d-f));l=f<0?f:0,c=0===h?1:(a-o)/h,t=function(t){var e=null!==t?parseFloat(t):0;return Number.isFinite(e)?o+u(e-l)*c:a}}return this.toBaseScale(t)},e}(qi),eo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),no=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","ordinal").addField("discrete",!0),r}return eo(e,t),e.prototype.create=function(t){var e=this.scaleConfig,n=this.vars,r=s.scalePoint().domain(n).range(t).padding(.5),i=Math.max.apply(Math,t),o=function(t){return"function"==typeof e.ratio?e.ratio(t,i,n):"object"==typeof e.ratio?e.ratio[t]:1/n.length},a=function(t){return e.ratio?i-n.slice(n.indexOf(t)+1).reduce(function(t,e){return t+i*o(e)},i*o(t)*.5):r(t)};return Object.keys(r).forEach(function(t){return a[t]=r[t]}),a.stepSize=function(t){return o(t)*i},this.toBaseScale(a,t)},e}(qi),ro=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),io=function(){return(io=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0},e.prototype.create=function(t){var e=this.periodGenerator,n=this.vars,r=this.vars.map(function(t){return t.getTime()}),i=this.scaleConfig,o=oo.scalePoint().domain(n).range(t).padding(.5),a=oo.scalePoint().domain(r.map(String)).range(t).padding(.5),u=Math.max.apply(Math,t),s=function(t){var e=new Date(t).getTime();return"function"==typeof i.ratio?i.ratio(e,u,r):"object"==typeof i.ratio?i.ratio[e]:1/n.length},c=function(t){var n=new Date(t),o=(e?e.cast(n):n).getTime();return i.ratio?u-r.slice(r.indexOf(o)+1).reduce(function(t,e){return t+u*s(e)},u*s(t)*.5):a(String(o))};return Object.keys(o).forEach(function(t){return c[t]=o[t]}),c.stepSize=function(t){return s(t)*u},this.toBaseScale(c,t)},e}(qi),uo=n(15),so=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),co=function(){return(co=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=r},e.prototype.create=function(t){var e=this,n=this.vars,r=this.scaleConfig.utcTime,i=this.periodGenerator,o=(r?lo.scaleUtc:lo.scaleTime)().domain(n).range(t),a=function(t){var e=n[0],r=n[1];return t>r&&(t=r),t=i&&t<=o});return function(t,e,n){void 0===n&&(n=10);var r,i,o=Number(t[0]),a=Number(t[1]),u=Math.abs(a-o)/n,s=lo.bisector(function(t){return t.duration}).right(mo,u);if(s===mo.length)r=e?lo.utcYear:lo.timeYear,i=lo.tickStep(o/go.year.duration,a/go.year.duration,n);else if(s){var c=u/mo[s-1].duration,l=mo[s].duration/u,f=mo[cl&&(e=l),o(e)}}return Object.keys(o).forEach(function(t){return a[t]=o[t]}),a.stepSize=function(){return 0},this.toBaseScale(a,t)},e}(qi);function ho(t){return lo["time"+t[0].toUpperCase()+t.slice(1)]}var po,go={second:{duration:1e3,interval:lo.timeSecond,utc:lo.utcSecond},minute:{duration:6e4,interval:lo.timeMinute,utc:lo.utcMinute},hour:{duration:36e5,interval:lo.timeHour,utc:lo.utcHour},day:{duration:864e5,interval:lo.timeDay,utc:lo.utcDay},week:{duration:6048e5,interval:lo.timeWeek,utc:lo.utcWeek},month:{duration:2592e6,interval:lo.timeMonth,utc:lo.utcMonth},year:{duration:31536e6,interval:lo.timeYear,utc:lo.utcYear}},mo=[(po=function(t,e){return{time:t,step:e,duration:e*t.duration}})(go.second,1),po(go.second,5),po(go.second,15),po(go.second,30),po(go.minute,1),po(go.minute,5),po(go.minute,15),po(go.minute,30),po(go.hour,1),po(go.hour,3),po(go.hour,6),po(go.hour,12),po(go.day,1),po(go.day,2),po(go.week,1),po(go.month,1),po(go.month,3),po(go.year,1)];var yo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),vo=function(){return(vo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(t){var e=this.vars,n=this.extendScale(bo.scaleLinear());return n.domain(e).range(t).clamp(!0),this.toBaseScale(n,t)},e.prototype.extendScale=function(t){var e=this,n=t.copy,r=t.ticks;return Object.assign(t,{stepSize:function(){return 0},copy:function(){return e.extendScale(n.call(t))},ticks:this.getField("isInteger")?function(e){return r.call(t,e).filter(Number.isInteger)}:t.ticks}),t},e}(qi),wo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_o=function(){return(_o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0,n=t.map(function(t){return Math.abs(t)}),r=Math.max.apply(Math,n),i=Math.min.apply(Math,n).toExponential().split("e"),o=r.toExponential().split("e"),a=parseFloat(Math.floor(Number(i[0]))+"e"+i[1]),u=parseFloat(Math.ceil(Number(o[0]))+"e"+o[1]);return e?[a,u]:[-u,-a]}(o)),r.vars=o,r.addField("scaleType","logarithmic").addField("discrete",!1),r}return wo(e,t),e.prototype.isInDomain=function(t){var e=this.domain(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(t){var e=this.vars;Ao(e);var n=function t(e){var n=e.copy;e.ticks=function(t){for(var n=[],r=So.extent(e.domain()),i=Math.floor(Oo(r[0])),o=Math.ceil(Oo(r[1])),a=Math.ceil(10*(o-i)/(10*Math.ceil(t/10))),u=i;u<=o;u+=a)for(var s=1;s<=10;s++){var c=Math.pow(s,a)*Math.pow(10,u);(c=parseFloat(c.toExponential(0)))>=r[0]&&c<=r[1]&&n.push(c)}return n};e.copy=function(){var r=n.call(e);return t(r),r};return e}(So.scaleLog()).domain(e).range(t);return n.stepSize=function(){return 0},this.toBaseScale(n,t)},e}(qi);function Oo(t){return Math.log(t)/Math.LN10}function Ao(t){if(t[0]*t[1]<=0)throw new _("Logarithmic scale domain cannot cross zero.",S.INVALID_LOG_DOMAIN)}var ko,Eo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),To=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","value").addField("georole",n.georole),r}return Eo(e,t),e.prototype.create=function(){return this.toBaseScale(function(t){return t})},e}(qi),Co=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),No=function(){return(No=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(){var t=this.vars,e=this.getField("brewer");if(!Array.isArray(e))throw new Error("This brewer is not supported");var n=e.length,r=(t[1]-t[0])/n,i=Gt(n-1).map(function(t){return t+1}).reduce(function(e,n){return e.concat([t[0]+n*r])},[]),o=Lo.scaleThreshold().domain(i).range(e);return this.toBaseScale(o)},e}(qi),Po=function(t){return t||null},Fo=function(t,e){return void 0===e&&(e=null),Array.isArray(t)?0===t.length?[e]:t:[t]},zo=function(t,e){return{type:t,x:e.x,y:e.y,identity:e.identity,size:e.size,color:e.color,split:e.split,label:e.label,guide:{color:e.colorGuide,obsoleteVerticalStackOrder:e.obsoleteVerticalStackOrder,size:e.sizeGuide},flip:e.flip,stack:e.stack}},Ro={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},Do=((ko={})[Ro.SUCCESS]=function(t){return t},ko[Ro.FAIL]=function(t,e){throw new Error((e.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},ko[Ro.WARNING]=function(t,e,n){var r=e.axis,i=e.indexMeasureAxis[0],o=t[i],a=t.filter(function(t){return t!==o});a.push(o);var u=n[i][r]||{},s=n[n.length-1][r]||{};return n[n.length-1][r]=u,n[i][r]=s,a},ko);function Io(t,e,n){return e.reduce(function(e,r,i){var o=t[r];return o?e.status!=Ro.FAIL&&("measure"===o.type&&(e.countMeasureAxis++,e.indexMeasureAxis.push(i)),"measure"!==o.type&&1===e.countMeasureAxis?e.status=Ro.WARNING:e.countMeasureAxis>1&&(e.status=Ro.FAIL,e.messages.push('There is more than one measure dimension for "'+n+'" axis'))):(e.status=Ro.FAIL,r?e.messages.push('"'+r+'" dimension is undefined for "'+n+'" axis'):e.messages.push('"'+n+'" axis should be specified')),e},{status:Ro.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:n})}function Bo(t){for(var e=Fo(t.x),n=Fo(t.y),r=Math.max(e.length,n.length),i=Fo(t.guide||{},{}),o=r-i.length,a=0;a0;l--){var f=u.pop(),d=s.pop(),h=c.pop()||{};l===o?(a.x=f,a.y=d,a.unit.push(zo(t,{x:Po(f),y:Po(d),identity:e.identity,split:e.split,color:e.color,label:e.label,size:e.size,flip:e.flip,stack:e.stack,colorGuide:h.color,obsoleteVerticalStackOrder:h.obsoleteVerticalStackOrder,sizeGuide:h.size})),a.guide=Zt(h,{x:{label:f},y:{label:d}})):a={type:"COORDS.RECT",x:Po(f),y:Po(d),unit:[a],guide:Zt(h,{x:{label:f},y:{label:d}})}}return e.spec={dimensions:e.dimensions,unit:a},e}var Ho=function(t){var e,n,r,i=Bo(t);return n=((e=i).flip?e.y:e.x).indexOf(e.color)>=0,r=e.guide[e.guide.length-1],n&&!r.hasOwnProperty("enableColorToBarPosition")&&(r.enableColorToBarPosition=!1),Wo("ELEMENT.INTERVAL",i=e)},Uo=function(t){var e=Bo(t),n=e.data,r=e.settings.log,i=(0,{horizontal:function(t){return{prop:t.x[t.x.length-1],flip:!1}},vertical:function(t){return{prop:t.y[t.y.length-1],flip:!0}},auto:function(t){var e,i=t.x,o=t.y,a=i[i.length-1],u=i.slice(0,i.length-1),s=o[o.length-1],c=o.slice(0,o.length-1),l=t.color,f=u.concat(c).concat([l]).filter(function(t){return null!==t}),d=-1,h=[[[a].concat(f),s],[[s].concat(f),a]],p=null;return h.some(function(t,e){var i=t[0],o=t[1],a=sn(n,i,[o]);return a.result?d=e:r(["Attempt to find a functional relation between",t[0]+" and "+t[1]+" is failed.","There are several "+a.error.keyY+" values (e.g. "+a.error.errY.join(",")+")","for ("+a.error.keyX+" = "+a.error.valX+")."].join(" ")),a.result})?(e=h[d][0][0],p=0!==d):(r("All attempts are failed. Gonna transform AREA to general PATH."),e=null),{prop:e,flip:p}}}["boolean"!=typeof e.flip?"auto":e.flip?"vertical":"horizontal"])(e);return null!==i.prop&&(e.data=dn(n,i.prop,e.dimensions[i.prop]),e.flip=i.flip),Wo("ELEMENT.AREA",e)},Go=function(){function t(t){this.unitRef=t}return t.prototype.value=function(){return this.unitRef},t.prototype.clone=function(){return JSON.parse(JSON.stringify(this.unitRef))},t.prototype.traverse=function(t){var e=function(t,n,r){n(t,r),(t.units||[]).map(function(r){return e(r,n,t)})};return e(this.unitRef,t,null),this},t.prototype.reduce=function(t,e){var n=e;return this.traverse(function(e,r){return n=t(n,e,r)}),n},t.prototype.addFrame=function(t){return this.unitRef.frames=this.unitRef.frames||[],t.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),t.source=t.hasOwnProperty("source")?t.source:this.unitRef.expression.source,t.pipe=t.pipe||[],this.unitRef.frames.push(t),this},t.prototype.addTransformation=function(t,e){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:t,args:e}),this},t.prototype.isCoordinates=function(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")},t.prototype.isElementOf=function(t){if(this.isCoordinates())return!1;var e=(this.unitRef.type||"").split("/");return 1===e.length&&e.unshift("RECT"),e[0].toUpperCase()===t.toUpperCase()},t}(),qo=function(){function t(t){this.specRef=t}return t.prototype.value=function(){return this.specRef},t.prototype.unit=function(t){return t&&(this.specRef.unit=t),new Go(this.specRef.unit)},t.prototype.addTransformation=function(t,e){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[t]=e,this},t.prototype.getSettings=function(t){return this.specRef.settings[t]},t.prototype.setSettings=function(t,e){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[t]=e,this},t.prototype.getScale=function(t){return this.specRef.scales[t]},t.prototype.addScale=function(t,e){return this.specRef.scales[t]=e,this},t.prototype.regSource=function(t,e){return this.specRef.sources[t]=e,this},t.prototype.getSourceData=function(t){return(this.specRef.sources[t]||{data:[]}).data},t.prototype.getSourceDim=function(t,e){return(this.specRef.sources[t]||{dims:{}}).dims[e]||{}},t}(),Xo={},Yo=function(){function t(){}return t.unit=function(t){return new Go(t)},t.spec=function(t){return new qo(t)},t.cloneObject=function(t){return JSON.parse(JSON.stringify(t))},t.depthFirstSearch=function(e,n){if(n(e))return e;for(var r=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],i=0;i1))return"[columns] property must contain at least 2 dimensions"}]));var Zo="2.7.2";e.default={GPL:qe,Plot:ar,Chart:dr,api:Jo,version:"2.7.2"}},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=o},function(t,e){t.exports=a},function(t,e){t.exports=u},function(t,e){t.exports=s},function(t,e,n){var r,i,o;i=[],void 0===(o="function"==typeof(r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){return t.indexOf(e)},r=window,i=r.document,o=i.documentElement,a=["top","bottom"];function u(t,e){for(var n in e)t[n]=e[n];return t}function s(t){var e,n=r.pageYOffset||o.scrollTop,i=r.pageXOffset||o.scrollLeft,a={left:0,right:0,top:0,bottom:0,width:0,height:0};if((e=t)&&null!=e.setInterval)a.width=r.innerWidth||o.clientWidth,a.height=r.innerHeight||o.clientHeight;else{if(!o.contains(t)||null==t.getBoundingClientRect)return a;u(a,t.getBoundingClientRect()),a.width=a.right-a.left,a.height=a.bottom-a.top}return a.top=a.top+n-o.clientTop,a.left=a.left+i-o.clientLeft,a.right=a.left+a.width,a.bottom=a.top+a.height,a}var c=function(t,e){return r.getComputedStyle(t)[e]};function l(t){var e=String(c(t,l.propName)),n=e.match(/([0-9.]+)([ms]{1,2})/);return n&&(e=Number(n[1]),"s"===n[2]&&(e*=1e3)),0|e}l.propName=function(){for(var t=i.createElement("div"),e=["transitionDuration","webkitTransitionDuration"],n=0;n=e.bottom&&(i[0]="top"),i[1]){case"left":t.right-this.width<=e.left&&(i[1]="right");break;case"right":t.left+this.width>=e.right&&(i[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?i[1]="left":t.right-t.width/2-this.width/2<=e.left&&(i[1]="right")}else switch(t.left-this.width-o<=e.left?i[0]="right":t.right+this.width+o>=e.right&&(i[0]="left"),i[1]){case"top":t.bottom-this.height<=e.top&&(i[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(i[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?i[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(i[1]="bottom")}return i.join("-")},d.prototype.position=function(t,e){this.attachedTo&&(t=this.attachedTo),null==t&&this._p?(t=this._p[0],e=this._p[1]):this._p=arguments;var n,r,i="number"==typeof t?{left:0|t,right:0|t,top:0|e,bottom:0|e,width:0,height:0}:s(t),o=this.spacing,a=this._pickPlace(i);switch(a!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(a),this.curPlace=a),this.curPlace){case"top":n=i.top-this.height-o,r=i.left+i.width/2-this.width/2;break;case"top-left":n=i.top-this.height-o,r=i.right-this.width;break;case"top-right":n=i.top-this.height-o,r=i.left;break;case"bottom":n=i.bottom+o,r=i.left+i.width/2-this.width/2;break;case"bottom-left":n=i.bottom+o,r=i.right-this.width;break;case"bottom-right":n=i.bottom+o,r=i.left;break;case"left":n=i.top+i.height/2-this.height/2,r=i.left-this.width-o;break;case"left-top":n=i.bottom-this.height,r=i.left-this.width-o;break;case"left-bottom":n=i.top,r=i.left-this.width-o;break;case"right":n=i.top+i.height/2-this.height/2,r=i.right+o;break;case"right-top":n=i.bottom-this.height,r=i.right+o;break;case"right-bottom":n=i.top,r=i.right+o}return this.element.style.top=Math.round(n)+"px",this.element.style.left=Math.round(r)+"px",this},d.prototype.show=function(t,e){return t=this.attachedTo?this.attachedTo:t,clearTimeout(this.aIndex),null!=t&&this.position(t,e),this.hidden&&(this.hidden=0,i.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},d.prototype.getElement=function(){return this.element},d.prototype.hide=function(){if(!this.hidden){var t=this,e=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(e=l(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){t.aIndex=0,i.body.removeChild(t.element),t.hidden=1},e),this}},d.prototype.toggle=function(t,e){return this[this.hidden?"show":"hide"](t,e)},d.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||i.body.removeChild(this.element),this.element=this.options=null},d.prototype._aware=function(){-1===n(d.winAware,this)&&d.winAware.push(this)},d.prototype._unaware=function(){var t=n(d.winAware,this);-1!==t&&d.winAware.splice(t,1)},d.reposition=function(){var t,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,17)};function n(){t=0;for(var e=0,n=d.winAware.length;e0)-(t<0)||Number(t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],o=0;o>>0,i=arguments[1],o=0;o0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),a)},function(t){var e=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!o(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(n=arguments[2])}for(var i,a=u(e.length),s=o(this)?Object(new this(a)):new Array(a),c=0;c=0?t.positive:t.negative,s=o[i]||0,u=s+a;return o[i]=u,{nextStack:u,prevStack:s}}},a=i({positive:{},negative:{}}),o=i({positive:{},negative:{}}),s=function(e){return te(e,t.id)},u=Number.MAX_VALUE,l=Number.MIN_VALUE,c=function(t){return u=tl?t:l,r.value(t)},f=s(function(t){return c(a(t).nextStack)}),d=s(function(t){return c(o(t).prevStack)}),h=function(e){return t.group(e)+"/"+(e[r.dim]>=0?1:-1)},p=$t(e,h),g=Object.keys(p).sort(t.flip||!t.flip&&t.obsoleteVerticalStackOrder?function(e,n){return t.order(e)-t.order(n)}:function(e,n){return t.order(n)-t.order(e)}).reduce(function(t,e){return t.concat(p[e])},[]);return g.forEach(function(t){f(t),d(t)}),r.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxu)&&(e.min=u),e}),{group:h,data:function(){return g},yi:f,y0:d}}).reg("size_distribute_evenly",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o=t.data(),s=function(t,e){return t-e},u=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,l=o.map(function(e){return t.xi(e)}).sort(s),c=l[0],f=l.slice(1).map(function(t){var e=t-c;return c=t,e}).filter(function(t){return t>0}).sort(s).concat(Number.MAX_VALUE)[0],d=Math.min(f,u),h="number"==typeof n?n:i,p={minSize:h,maxSize:"number"==typeof r?r:Math.max(h,Math.min(a,d))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("adjustStaticSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o={minSize:"number"==typeof n?n:i,maxSize:"number"==typeof r?r:a};return t.scaleSize.fixup(function(t){var e={};return t.fixed||(e.fixed=!0,e.minSize=o.minSize,e.maxSize=o.maxSize),e}),{}}).reg("adjustSigmaSizeScale",function(t,e){var n,r,i,a,o=e.minLimit,s=e.maxLimit,u=e.defMin,l=e.defMax,c=function(t,e){return t-e},f=t.data().map(function(e){return t.xi(e)}).sort(c),d=f[0],h=f.slice(1).map(function(t){var e=t-d;return d=t,e}).filter(function(t){return t>0}).sort(c).concat(Number.MAX_VALUE)[0],p=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,g=Math.min(h,p),m="number"==typeof o?o:u,y="number"==typeof s?s:l,v={minSize:m,maxSize:Math.max(m,Math.min(y,(n=g,r=(m+y)/2,i=y,a=m,Math.round(r+(i-r)/(1+Math.exp(-(n-a)/.5))))))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>v.maxSize&&(e.maxSize=v.maxSize):(e.fixed=!0,e.minSize=v.minSize,e.maxSize=v.maxSize),e}),{}}).reg("avoidScalesOverflow",function(t,e){var n,r,i=e.sizeDirection,a=function(t,e){return!t||t.discrete||"logarithmic"===t.scaleType||i.indexOf(e)<0},o=a(t.scaleX,"x"),s=a(t.scaleY,"y");if(o&&s)return{};t.scaleSize.fixup(function(t){return n=t.minSize,r=t.maxSize,t});var u=t.data().reduce(function(e,i){var a,u,l=t.size(i),c=(l>=n?l:n+l*(r-n))/2;return o||(a=t.xi(i),e.left=Math.min(e.left,a-c),e.right=Math.max(e.right,a+c)),s||(u=t.yi(i),e.top=Math.min(e.top,u-c),e.bottom=Math.max(e.bottom,u+c)),e},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE}),l=function(e,n,r,i){var a=e.domain(),o=Math.abs(e.value(a[1])-e.value(a[0])),s=(a[1]-a[0])/o;if(0===o)return 1;var u=Math.max(0,-n),l=Math.max(0,r-o),c=t.flip?l:u,f=t.flip?u:l,d=Number(a[0])-(i?f:c)*s,h=Number(a[1])+(i?c:f)*s;return e.fixup(function(t){var e={};if(t.fixedBorders){var i=t.fixedBorders.slice(),a=i[0],o=i[1];(a>n||o=0?1:-1},d=function(e,n,r){var i=$t(n,function(t){return t[s]}),a=n[0];return e.reduce(function(e,n){return e.concat(i[n]||function(e,n,r){var i,a=[e,t.id(n),r].join(" ");return(i={})[s]=e,i[u]=1e-10*r,i[c]=n[c],i[l]=n[l],i[T]=!0,i[T+"id"]=a,i}(n,a,r))},[])},h=function(t,e){return t-e},p=function(){return Yt(o.reduce(function(t,e){return t.concat(e.map(function(t){return t[s]}))},[])).sort(h)},g=r?function(){var e=p(),n=Math.max.apply(Math,e.map(function(t){return Number(t)})),a=t.scaleX.domain(),o=x.generate(a[0],a[1],r,{utc:i}).filter(function(t){return t>=a[0]&&t<=a[1]}),s=0,u=[],l=x.get(r,{utc:i});return o.forEach(function(t){var r=Number(t);if(!(r>=n)){for(var i=s;i=0;n--)i=t[n+1],(r=t[n]).isCubicControl||i.isCubicControl||(t.splice(n+1,0,A(1/3,i,r),A(2/3,i,r)),t[n+1].isCubicControl=!0,t[n+2].isCubicControl=!0);var a=t.filter(function(t,e){return e%3==0}),o=e.filter(function(t,e){return e%3==0}),s=a.map(function(t){return t.id}),u=o.map(function(t){return t.id}),l=s.reduce(function(e,n){return e[n]=t.findIndex(function(t){return t.id===n}),e},{}),c=u.reduce(function(t,n){return t[n]=e.findIndex(function(t){return t.id===n}),t},{}),f=s.filter(function(t){return u.indexOf(t)>=0}),d=a.filter(function(t){return!t.positionIsBeingChanged}),h=o.filter(function(t){return!t.positionIsBeingChanged}),p=H(d,h),g=H(h,d),m=[];f.forEach(function(n,r){var i,a,o,s=l[n],u=c[n];if(0===r&&(s>0||u>0)&&m.push(L({polylineFrom:t.slice(0,s+1),polylineTo:e.slice(0,u+1),toOppositeScale:0===u?p:g,isCubic:!0})),r>0){var d=l[f[r-1]],h=c[f[r-1]];s-d>3||u-h>3?m.push(N({polylineFrom:t.slice(d,s+1),polylineTo:e.slice(h,u+1),isCubic:!0})):m.push((i={polylineFrom:t.slice(d,s+1),polylineTo:e.slice(h,u+1)},a=i.polylineFrom,o=i.polylineTo,function(t){return z(a.slice(1,3),o.slice(1,3),t)}))}m.push(R({pointFrom:t[s],pointTo:e[u]})),r===f.length-1&&(t.length-s-1>0||e.length-u-1>0)&&m.push(L({polylineFrom:t.slice(s),polylineTo:e.slice(u),toOppositeScale:e.length-u==1?p:g,isCubic:!0}))}),0===m.length&&(e.length>0&&0===f.length||t.length>0&&0===f.length)&&m.push(F({polylineFrom:t.slice(0),polylineTo:e.slice(0),isCubic:!0}));return function(t){var e=[];return m.forEach(function(n){var r=n(t);D(e,r)}),e}}:function(t,e){var n=(t=t.filter(function(t){return!t.isInterpolated})).map(function(t){return t.id}),r=e.map(function(t){return t.id}),i=n.filter(function(t){return r.indexOf(t)>=0}),a=t.filter(function(t){return!t.positionIsBeingChanged}),o=e.filter(function(t){return!t.positionIsBeingChanged}),s=H(a,o),u=H(o,a),l=[];i.forEach(function(a,o){var c=n.indexOf(a),f=r.indexOf(a);if(0===o&&(c>0||f>0)&&l.push(L({isCubic:!1,polylineFrom:t.slice(0,c+1),polylineTo:e.slice(0,f+1),toOppositeScale:0===f?s:u})),o>0){var d=n.indexOf(i[o-1]),h=r.indexOf(i[o-1]);(c-d>1||f-h>1)&&l.push(N({isCubic:!1,polylineFrom:t.slice(d,c+1),polylineTo:e.slice(h,f+1)}))}l.push(R({pointFrom:t[c],pointTo:e[f]})),o===i.length-1&&(t.length-c-1>0||e.length-f-1>0)&&l.push(L({isCubic:!1,polylineFrom:t.slice(c),polylineTo:e.slice(f),toOppositeScale:e.length-f==1?s:u}))}),0===l.length&&(e.length>0&&0===i.length||t.length>0&&0===i.length)&&l.push(F({isCubic:!1,polylineFrom:t.slice(0),polylineTo:e.slice(0)}));return function(t){var e=[];return l.forEach(function(n){var r=n(t);D(e,r)}),e}})(t,e)),r(i))}}function L(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=t.toOppositeScale,a=e.length>n.length?e:n,o=1===n.length,s=e[0].id!==n[0].id,u=Boolean(s!==o);return function(t){var e=(r?V:B)({t:t,polyline:a,decreasing:o,rightToLeft:u});o===u?e.shift():e.pop();var n=z(e.map(i),e,o?1-t:t);return n.forEach(function(t){return t.positionIsBeingChanged=!0}),n}}function N(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=e.length,a=n.length;if(a!==i){var o=a2){var i=function(t,e){for(var n,r,i=[e[0]],a=0;a0&&e0&&(t.positionIsBeingChanged=!0)}),e}}function D(t,e){return Array.prototype.push.apply(t,e)}function j(t,e,n){return void 0===e?t:"number"==typeof e?t+n*(e-t):e}function I(t,e,n){if(t===e)return e;var r={};return Object.keys(t).forEach(function(i){return r[i]=j(t[i],e[i],n)}),void 0!==e.id&&(r.id=e.id),r}function z(t,e,n){return t.map(function(t,r){return I(t,e[r],n)})}function B(t){var e=t.t,n=t.polyline,r=t.decreasing,i=t.rightToLeft,a=Boolean(r)!==Boolean(i),o=function(t,e){var n=0;if(t>0){for(var r,i,a,o,s=[0],u=0,l=1;l0){for(var i,a,o,s,u,l,c,f,d=[0],h=0,p=1;p0;a--)if((e=o[a][t])!==r)return n=s[a][t],void(d[t]=h(r,e,i,n));d[t]=function(t,e){return function(n){return n-t+e}}(r,i)}),function(t){var e=Object.assign({},t);return f.forEach(function(n){e[n]=d[n](t[n])}),e}}function W(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function G(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=O(t,n,r,i,a);return[o[1],o[2],o[4],o[5]].forEach(function(t){return t.isCubicControl=!0}),Object.keys(a).forEach(function(e){"x"!==e&&"y"!==e&&"id"!==e&&(o[3][e]=j(n[e],a[e],t))}),o}function U(t,e){if(t.length<2)return t.slice(0);if(2===t.length)return[t[0],{x:X(t[0].x,t[1].x,1/3),y:X(t[0].y,t[1].y,1/3)},{x:X(t[0].x,t[1].x,2/3),y:X(t[0].y,t[1].y,2/3)},t[1]];for(var n,r,i,a,o,s,u,l,c,f,d,h,p,g,m=new Array(3*(t.length-1)+1),y=m.length-1,v=0;v0&&(m[3*v-2]=A(1/3,t[v-1],t[v]),m[3*v-1]=A(2/3,t[v-1],t[v]));for(var b=m.slice(0),x=0;x<3;x++){for(m[1]={x:X(m[0].x,m[3].x,1/3),y:X(m[0].y,X(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:X(m[y].x,m[y-3].x,1/3),y:X(m[y].y,X(m[y-3].y,m[y-2].y,1.5),2/3)},e&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[y-1].y-m[y].y)*(m[y-3].y-m[y-2].y)<0&&(m[y-1]={x:m[y-1].x,y:m[y].y})),v=6;vn.y==u>i.y&&(p=X(p*(g=(i.y-r.y)/(u-r.y)),p,1/(1+Math.abs(g))),d=(i.y-r.y)/p),r.y>n.y==o0?[t,e].join(" "):e,u=n(i.text(s));if(us;if(c&&i){var f=Math.floor(s/l*u.length);t[t.length-1]=u.substr(0,f-4)+"...",p=!0}return c&&!i&&t.push(e),c||(t[t.length-1]=u),t},[""]).filter(function(t){return t.length>0});f=i?-1*(m.length-1)*Math.floor(.5*r):f,m.forEach(function(t,e){return o(u,t,1.1,c,f,d,e)}),h.remove()})};var nt=function(t,e,n){return e>0&&!document.hidden&&((t=t.transition(n).duration(e)).attr=rt),t.onTransitionEnd=function(t){return ot(this,t),this},t},rt=function(t,e){var n,r,i=this,a=Q.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?r=t:arguments.length>1&&((n={})[t]=e,r=n);var o="__transitionAttrs__",s="__lastTransitions__",u=at();this.each(function(){var t=this,e={};for(var n in r)"function"==typeof r[n]?e[n]=r[n].apply(this,arguments):e[n]=r[n];this[o]=Object.assign(this[o]||{},e),this[o][s]||Object.defineProperty(this[o],s,{value:{}}),Object.keys(e).forEach(function(e){return t[o][s][e]=u})});var l=function(){var t=this;this[o]&&(Object.keys(r).filter(function(e){return t[o][s][e]===u}).forEach(function(e){return delete t[o][e]}),0===Object.keys(this[o]).length&&delete this[o])};return this.on("interrupt."+u,function(){return i.each(l)}),this.on("end."+u,function(){return i.each(l)}),a},it=0,at=function(){return++it},ot=function(t,e){if(Q.transition.prototype.isPrototypeOf(t)&&!t.empty()){var n=function(){return e.call(null,t)};return t.on("interrupt.d3_on_transition_end",n),t.on("end.d3_on_transition_end",n),t}e.call(null,t)},st=function(t,e,n,r){var i=r||function(t){return t},a=function(){i(this)};return function(r){var i=r;return e&&(i=i.call(ct(Qt(e,n)))),i=(i=nt(i,t)).call(ct(n)),t>0?i.on("end.d3_animationInterceptor",function(){return i.each(a)}):i.each(a),i}},ut=function(t,e){var n=t.node();return t.selectAll(e).filter(function(){return this.parentNode===n})},lt=function(t,e,n,r,i){void 0===i&&(i="linear");var a="__pathPoints__";return function(t){var o=this;this[a]||(this[a]=n.map(function(){return[]}));var s=n.map(function(e,n){var s=Yt(t,r).map(e),u=($(i)||$("linear"))(s),l=o[a][n];return{pointsFrom:l,pointsTo:u,interpolate:P(l,u,K(i))}});return function(t){if(0===t){var n=s.map(function(t){return t.pointsFrom});return e.apply(void 0,n)}if(1===t){var r=s.map(function(t){return t.pointsTo});return o[a]=r,e.apply(void 0,r)}var i=s.map(function(e){return e.interpolate(t)});return o[a]=i,e.apply(void 0,i)}}},ct=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.attr(n,t[n])}),e}},ft=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.classed(n,t[n])}),e}},dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ht=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Qt(n.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),n.config.guide.size=n.config.guide.size||{};var r=n.config.stack,i=n.config.guide.enableColorToBarPosition,a=[e.flip&&M.get("flip"),r&&M.get("stack"),i&&M.get("positioningByColor")];return n.decorators=(n.config.transformRules||a).concat(e.transformModel||[]),n.adjusters=(n.config.adjustRules||[]).concat(e.adjustScales||[]),n}return dt(e,t),e.prototype.defineGrammarModel=function(t){var e=this,n=this.config;this.regScale("x",t("pos",n.x,[0,n.options.width])).regScale("y",t("pos",n.y,[n.options.height,0])).regScale("y",t("pos",n.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n.options.height]:[n.options.height,0]})).regScale("size",t("size",n.size,{})).regScale("color",t("color",n.color,{})).regScale("split",t("split",n.split,{})).regScale("label",t("label",n.label,{})).regScale("identity",t("identity",n.identity,{}));var r=this.getScale("x"),i=this.getScale("y"),a=this.getScale("size"),o=this.getScale("label"),s=this.getScale("color"),u=this.getScale("split"),l=this.getScale("identity"),c=i.domain(),f=i.discrete?c[0]:Math.max(0,Math.min.apply(Math,c)),d=i.value(f)+.5*i.stepSize(f),h=s.domain(),p={data:function(){return e.data()},flip:!1,scaleX:r,scaleY:i,scaleSize:a,scaleLabel:o,scaleColor:s,scaleSplit:u,scaleIdentity:l,color:function(t){return s.value(t[s.dim])},label:function(t){return o.value(t[o.dim])},group:function(t){return t[s.dim]+"(@taucharts@)"+t[u.dim]},order:function(t){var e=t.split("(@taucharts@)")[0],n=h.indexOf(e);return n<0?Number.MAX_VALUE:n},size:function(t){return a.value(t[a.dim])},id:function(t){return l.value(t[l.dim],t)},xi:function(t){return r.value(t[r.dim])},yi:function(t){return i.value(t[i.dim])},y0:function(){return d}};return p.data().forEach(function(t){return p.id(t)}),p},e.prototype.getGrammarRules=function(){return this.decorators.filter(function(t){return t})},e.prototype.getAdjustScalesRules=function(){return(this.adjusters||[]).filter(function(t){return t})},e.prototype.createScreenModel=function(t){var e=t.flip,n=function(t,e,n){return t?e:n};return{flip:e,id:t.id,x:n(e,t.yi,t.xi),y:n(e,t.xi,t.yi),x0:n(e,t.y0,t.xi),y0:n(e,t.xi,t.y0),size:t.size,group:t.group,order:t.order,label:t.label,color:function(e){return t.scaleColor.toColor(t.color(e))},class:function(e){return t.scaleColor.toClass(t.color(e))},model:t,toFibers:function(){var e=$t(t.data(),t.group);return Object.keys(e).sort(function(e,n){return t.order(e)-t.order(n)}).reduce(function(t,n){return t.concat([e[n]])},[])}}},e.prototype.drawFrames=function(){var t=this,e=this.config.options,n=function(e){return n=t.screenModel.size(e)/2,r=4,i=Math.pow(10,r),Math.round(i*n)/i;var n,r,i},r=st,i=function(e,n,i){var a=t.config.guide.animationSpeed,s=e.selectAll("."+n).data(function(t){return[t]},t.screenModel.id);s.exit().call(r(a,null,{width:0},function(t){return o.select(t).remove()})),s.call(r(a,null,i)),s.enter().append("rect").style("stroke-width",0).call(r(a,{width:0},i))},a=this.config.flip,s=a?"y":"x",u=a?"x":"y",l=a?"x0":"y0",c=a?"height":"width",f=a?"width":"height",d=function(e){var r,a,o;i(e,"lvl-top",((r={})[c]=function(t){return n(t)},r[f]=1,r[s]=function(e){return t.screenModel[s](e)-n(e)/2},r[u]=function(e){return t.screenModel[u](e)},r.fill=function(e){return t.screenModel.color(e)},r.class=function(e){return"lvl-top "+t.screenModel.class(e)},r)),i(e,"lvl-btm",((a={})[c]=function(t){return n(t)},a[f]=1,a[s]=function(e){return t.screenModel[s](e)-n(e)/2},a[u]=function(e){return t.screenModel[l](e)},a.fill=function(e){return t.screenModel.color(e)},a.class=function(e){return"lvl-btm "+t.screenModel.class(e)},a)),i(e,"lvl-link",((o={})[c]=.5,o[f]=function(e){return Math.abs(t.screenModel[u](e)-t.screenModel[l](e))},o[s]=function(e){return t.screenModel[s](e)-.25},o[u]=function(e){return Math.min(t.screenModel[u](e),t.screenModel[l](e))},o.fill=function(e){return t.screenModel.color(e)},o.class=function(e){return"lvl-link "+t.screenModel.class(e)},o))},h=function(e){e.attr("class","frame-id-"+t.config.uid).call(function(e){var n=e.selectAll(".generic").data(function(t){return t},t.screenModel.id);n.exit().remove(),n.call(d),n.enter().append("g").attr("class","generic").call(d)})},p=$t(this.data(),t.screenModel.group),g=Object.keys(p).sort(function(e,n){return t.screenModel.order(e)-t.screenModel.order(n)}).reduce(function(t,e){return t.concat([p[e]])},[]),m=e.container.selectAll(".frame-id-"+t.config.uid).data(g);m.exit().remove(),m.call(h),m.enter().append("g").call(h)},e}(m),pt=function(){return(pt=Object.assign||function(t){for(var e,n=1,r=arguments.length;nthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,n),this.depth--,n}},r.DeepCopier=e,r.deepCopiers=t,r.register=function(n){n instanceof e||(n=new e(n)),t.unshift(n)},r.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?"object"==typeof(e=t.constructor.prototype)?JSON.parse(JSON.stringify(e)):e:{};var e},populate:function(t,e,n){for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}}),r.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,n){for(var r=0;r":">",'"':""","'":"'","`":"`"},wt={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Et=/\\|'|\r|\n|\u2028|\u2029/g,St="(?:"+Object.keys(_t).join("|")+")",Mt=RegExp(St),Tt=RegExp(St,"g"),Ct={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function kt(t){return vt(t)}function At(t){return t instanceof Date&&!isNaN(Number(t))}function Ot(t){return null!=t&&"object"==typeof t}function Pt(t){var e=parseFloat(Math.min.apply(Math,t).toFixed(15)),n=parseFloat(Math.max.apply(Math,t).toFixed(15));e===n&&(n-=(n>=0?-1:1)*(n||1)/10);for(var r=[e=Math.min(0,e),n=Math.max(0,n)],i=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(i/10)/Math.LN10)),o=10/i*a,s=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],u=-1;o>s[++u][0];);a*=s[u][1],r[0]=Math.floor(r[0]/a)*a,r[1]=Math.ceil(r[1]/a)*a;var l=e-r[0],c=r[1]-n,f=a/2;if(e<0){var d=l>=f?-l:0;r[0]=r[0]-d}if(n>0){var h=c>=f?-c:0;r[1]=r[1]+h}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Lt(t,e,n){var r=(void 0===n?{utc:!1}:n).utc,i=gt.extent(t),a=i[0],o=i[1],s=+o-+a,u=r?gt.scaleUtc:gt.scaleTime;if(0===s){return a=new Date(a.getTime()-864e5),o=new Date(o.getTime()+864e5),u().domain([a,o]).nice(e).domain()}var l=u().domain([a,o]).nice(e);if(e)return l.domain();var c=u().domain([a,o]).nice(e).domain(),f=c[0],d=c[1],h=l.ticks(),p=h.length-1;return(+a-+f)/(+h[1]-+f)<.5&&(a=f),(+d-+o)/(+d-+h[p-1])<.5&&(o=d),[a,o]}var Nt=0,Rt={};function Ft(t){var e=btoa(encodeURIComponent(t)).replace(/=/g,"_");return Rt.hasOwnProperty(e)||(Rt[e]="H"+ ++Nt),Rt[e]}function Dt(t,e,n){var r=0,i=null,a=te(function(t,e){return Yt(t.map(function(t){return e.reduce(function(e,n){return e.concat(At(r=t[n])?r.getTime():r);var r},[])}),function(t){return JSON.stringify(t)}).reduce(function(t,e){var n=e[0];return t[n]=t[n]||0,t[n]+=1,t},{})},function(t,e){var n=i===t?r:++r;return i=t,e.join("")+"-"+n});return function(r,i,o){var s=o.length,u=n.getSpec(),l=u.sources["/"].data,c=u.unit.units[0].guide||{};c.padding=c.padding||{l:0,r:0,t:0,b:0};var f=0;"x"===t?f=c.padding.l+c.padding.r:"y"===t&&(f=c.padding.t+c.padding.b);var d,h=(i-s*f)/(d=a(l,e),Object.keys(d).reduce(function(t,e){return t+d[e]},0));return(function(t,e){return a(l,t)[e]}(e,r)*h+f)/i}}function jt(t){var e=!0;try{yt(t,function(t){if(0===t.type.indexOf("COORDS.")&&"COORDS.RECT"!==t.type)throw new Error("Not applicable")},function(t){return t})}catch(t){"Not applicable"===t.message&&(e=!1)}return e}function It(t,e,n,r){if(void 0===r&&(r=0),"requestAnimationFrame"===r){var i=!1;return function(){for(var r=[],a=0;a=r&&n.apply(this,i),t.e=o.e,t.ts=o.ts}}function zt(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=e>=2?Gt(e-2).map(function(t){return n+i*(t+1)}):[];return[n].concat(a,[r])}function Bt(t){return bt(t)?t:""}function Vt(t){return bt(t)?"":t}function Ht(t){return t/180*Math.PI}function Wt(t){return Math.abs(t)>=360&&(t%=360),t<0&&(t=360+t),t}function Gt(t,e){1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r100}function Xt(t,e,n,r){return t+e*(-90===n?-1:1)-r>20}function qt(t){return Array.isArray(t)?[].concat.apply([],t.map(function(t){return qt(t)})):t}function Yt(t,e){for(var n={},r=[],i=t.length,a=e||function(t){return String(t)},o=0;o/g,">").replace(/"/g,""").replace(/'/g,"'")}var oe=" ",se=32,ue=["img","input","br","embed","link","meta","area","base","basefont","bgsound","col","command","frame","hr","image","isindex","keygen","menuitem","nextid","param","source","track","wbr","circle","ellipse","line","path","polygon","rect"].reduce(function(t,e){return t[e]=!0,t},{});function le(t){var e=2,n=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(e=1,n={});var r=qt(Array.prototype.slice.call(arguments,e)),i=1===r.length&&"<"!==r[0].trim()[0],a=ue[t];if(a&&r.length>0)throw new Error('Tag "'+t+'" is void but content is assigned to it');var o="<"+t,s=Object.keys(n).map(function(t){return" "+t+'="'+n[t]+'"'}).join("");s.length>se&&(s=Object.keys(n).map(function(t){return"\n"+oe+t+'="'+n[t]+'"'}).join(""));var u=i?r[0]:"\n"+r.map(function(t){return String(t).split("\n").map(function(t){return""+oe+t}).join("\n")}).join("\n")+"\n";return""+o+s+(a?"/>":">"+u+"")}function ce(t){var e=t,n={then:function(t){return e=t(e),n},result:function(){return e}};return n}var fe=[ht];function de(t){return fe.some(function(e){return t instanceof e})}function he(t){return(t.units||[]).some(function(t){return t.hasOwnProperty("units")})}var pe=document.createElement("div"),ge=new WeakMap;function me(t,e){var n;return t instanceof Node?n=t:(pe.insertAdjacentHTML("afterbegin",t),n=pe.childNodes[0]),e.appendChild(n),n}function ye(t){if(ge.has(t))return ge.get(t);var e=t.style.overflow;t.style.overflow="scroll";var n={width:t.offsetWidth-t.clientWidth,height:t.offsetHeight-t.clientHeight};return t.style.overflow=e,ge.set(t,n),n}function ve(t,e){var n="horizontal"===(e=e||"both")||"both"===e,r="vertical"===e||"both"===e,i=ye(t),a=r?i.width+"px":"0",o=n?i.height+"px":"0";t.style.overflow="hidden",t.style.padding="0 "+a+" "+o+" 0";var s=t.scrollWidth>t.clientWidth,u=t.scrollHeight>t.clientHeight,l=r&&!u?i.width+"px":"0",c=n&&!s?i.height+"px":"0";return t.style.padding="0 "+l+" "+c+" 0",t.style.overflow="",t.style.overflowX=s?"scroll":"hidden",t.style.overflowY=u?"scroll":"hidden",i}function be(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function xe(t,e){return parseInt(be(t,e)||"0",10)}function _e(t){var e=xe(t,"padding-left"),n=xe(t,"padding-right"),r=xe(t,"padding-bottom"),i=xe(t,"padding-top"),a=xe(t,"border-top-width")+xe(t,"border-left-width")+xe(t,"border-right-width")+xe(t,"border-bottom-width"),o=t.getBoundingClientRect();return{width:o.width-e-n-2*a,height:o.height-r-i-2*a}}function we(t){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",e.style.width="100px",e.style.height="100px",e.style.border="1px solid green",e.style.top="0",document.body.appendChild(e),e.innerHTML='\n \n \n \n \n \n ';var n=e.querySelector(".x.axis .tick text");n.textContent=t;var r={width:0,height:0},i=n.getBoundingClientRect();r.width=i.right-i.left,r.height=i.bottom-i.top;var a=0!==t.length?r.width/t.length:0;return r.width=r.width+1.5*a,document.body.removeChild(e),r}function Ee(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,a="string"==typeof n?n:n+"px",o=t.map(function(t){for(var e=0,n=0;e<=t.length-1;e++){n+=Se(t.charAt(e),{fontSize:a,fontFamily:r,fontWeight:i}).width}return n}).sort(function(t,e){return e-t})[0],s=t.length,u=parseInt(a);return{width:o,height:u*s+.39*u*s}}var Se=te(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,a=document.createElement("div");a.style.position="absolute",a.style.visibility="hidden",a.style.border="0px",a.style.top="0",a.style.fontSize=n,a.style.fontFamily=r,a.style.fontWeight=i,document.body.appendChild(a),a.innerHTML=" "===t?" ":t;var o={width:0,height:0},s=a.getBoundingClientRect();return o.width=s.right-s.left,o.height=s.bottom-s.top,document.body.removeChild(a),o},function(t,e){return t+"_"+JSON.stringify(e)});function Me(t,e){var n={".":function(t,e){return e.classed(t,!0)},"#":function(t,e){return e.attr("id",t)}},r=Object.keys(n).join("");if(e.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(e[0])>=0)throw new Error("Selector must have tag at the beginning.");var i,a=t instanceof Element,s=a?o.select(t):t,u=function(t){return a?t.node():t},l=s.selectAll(e).filter(function(){return this.parentNode===s.node()}).filter(function(t,e){return 0===e});if(!l.empty())return u(l);for(var c,f=-1,d=null,h=1,p=e.length;h<=p;h++)(h==p||r.indexOf(e[h])>=0)&&(c=e.substring(f+1,h),f<0?i=s.append(c):n[d].call(null,c,i),d=e[h],f=h);return u(i)}function Te(t,e){return Ce(t,e)[0]||null}function Ce(t,e){for(var n=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=t.firstElementChild;Boolean(i);i=i.nextElementSibling)r.call(i,e)&&n.push(i);return n}function ke(t,e){if(t.childElementCount>0){var n,r,i=Array.prototype.filter.call(t.childNodes,function(t){return t.nodeType===Node.ELEMENT_NODE}),a=i.slice().sort(e),o=i.reduce(function(t,e,n){return t.set(e,n),t},new Map),s=a.reduce(function(t,e,i){var s=o.get(e),u=i-s;return u!==r&&(n&&t.push(n),r=u,n={from:s,to:i,elements:[]}),n.elements.push(e),i===a.length-1&&t.push(n),t},[]),u=s.slice().sort(function(t,e){return t.from-e.from}),l=u.reduce(function(t,e,n){return t.set(e,n),t},new Map),c=function(t){for(var e,n,r,i=s.map(function(t,e){return{elements:t.elements,from:l.get(t),to:e}}).sort(ee(function(t,e){return t.elements.length-e.elements.length},t?function(t,e){return e.to-t.to}:function(t,e){return t.to-e.to})),a=0;an.to)for(e=a+1;e=n.to&&r.fromn.from&&r.from<=n.to&&r.from--}return i.filter(function(t){return t.from!==t.to})},f=c(!0),d=c(!1),h=f.length=0?"h":"v"}function Re(t){var e={x:0,y:0},n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}return e}function Fe(t,e,n,r,i,a,o,s){var u,l,c,f,d,h;return h=((c=o-i)*(e-a)-(f=s-a)*(t-i))/(-c*(l=r-e)+(u=n-t)*f),(d=(-l*(t-i)+u*(e-a))/(-c*l+u*f))>=0&&d<=1&&h>=0&&h<=1}function De(t){for(var e,n,r={x:0,y:0},i=t;i&&"SVG"!==i.nodeName.toUpperCase();)(n=i.getAttribute("transform"))&&(e=Re(n),r.x+=e.x,r.y+=e.y),i=i.parentNode;return r}function je(t,e,n){var r=t.selectAll(e).filter(n);if(!r.empty()){var i=o.select(r.node().parentNode).selectAll(e).filter(function(t){return!n(t)}).nodes(),a=i[i.length-1];if(a){var s=Array.prototype.indexOf.call(a.parentNode.childNodes,a),u=a.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>s||this.parentNode.insertBefore(this,u)})}}}var Ie=function(t){return At(t)?t.getTime():t},ze={cross:function(t,e,n){var r=t(),i=Yt(r.map(function(t){return t[e]}),Ie),a=Yt(r.map(function(t){return t[n]}),Ie),o=0===i.length?[null]:i;return(0===a.length?[null]:a).reduce(function(t,r){return t.concat(o.map(function(t){var i={};return e&&(i[e]=Ie(t)),n&&(i[n]=Ie(r)),i}))},[])},cross_period:function(t,e,n,r,i,a){var o=t(),s=!!a&&a.utcTime,u=Yt(o.map(function(t){return t[e]}),Ie),l=Yt(o.map(function(t){return t[n]}),Ie),c=0===u.length?[null]:u,f=0===l.length?[null]:l;return r&&(c=x.generate(Math.min.apply(Math,u),Math.max.apply(Math,u),r,{utc:s})),i&&(f=x.generate(Math.min.apply(Math,l),Math.max.apply(Math,l),i,{utc:s})),f.reduce(function(t,r){return t.concat(c.map(function(t){var i={};return e&&(i[e]=Ie(t)),n&&(i[n]=Ie(r)),i}))},[])},groupBy:function(t,e){return Yt(t().map(function(t){return t[e]}),Ie).map(function(t){var n;return(n={})[e]=Ie(t),n})},none:function(){return[null]}},Be=function(){function t(t,e,n){var r=t.key,i=t.pipe,a=t.source,o=t.units;void 0===n&&(n={}),this.key=r,this.pipe=i||[],this.source=a,this.units=o,this._frame={key:r,source:a,pipe:this.pipe},this._data=e,this._pipeReducer=function(t,e){return n[e.type](t,e.args)}}return t.prototype.hash=function(){return Ft([this._frame.pipe,this._frame.key,this._frame.source].map(function(t){return JSON.stringify(t)}).join(""))},t.prototype.full=function(){return this._data},t.prototype.part=function(t){return void 0===t&&(t=function(t){return t}),this._frame.pipe.map(t).reduce(this._pipeReducer,this._data)},t}(),Ve=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),He=function(t){return At(t)?t.getTime():t},We=function(t){var e=this;Object.keys(t).forEach(function(n){return e[n]=t[n]})},Ge=function(t,e,n){return t.map(function(t){return"string"==typeof t?n.get(t):t}).filter(function(t){return t}).reduce(function(t,e){return n=t,void 0===(r=e(t,{}))&&(r={}),Object.assign(new We(n),r);var n,r},e)},Ue=function(t){function e(e,n,r,i){var a=t.call(this)||this;return Qt(e.scales,{size_null:{type:"size",source:"?"},split_null:{type:"value",source:"?"},label_null:{type:"value",source:"?"},color_null:{type:"color",source:"?"},identity_null:{type:"identity",source:"?"},"size:default":{type:"size",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"},"label:default":{type:"value",source:"?"},"identity:default":{type:"identity",source:"?"}}),e.settings=e.settings||{},a.config=e,a.sources=e.sources,a.scales=e.scales,a.unitSet=r,a.grammarRules=i,a.scalesHub=n,a.transformations=Object.assign(e.transformations||{},{where:function(t,e){var n=Object.keys(e||{}).map(function(t){return function(n){return He(n[t])===e[t]}});return t.filter(function(t){return n.every(function(e){return e(t)})})}}),a}return Ve(e,t),e.traverseSpec=function(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null);var a=[],o=function(t,e,n,r,i){a.push(function(){e(t,r,i)}),t.frames&&t.frames.forEach(function(r){(r.units||[]).map(function(i){return o(i,e,n,t,r)})}),a.push(function(){return n(t,r,i)})};return o(t.unit,e,n,r,i),a},e.prototype.unfoldStructure=function(){return this.root=this._expandUnitsStructure(this.config.unit),this.config},e.prototype.getDrawScenarioQueue=function(t){var e=this,n=this.grammarRules,r=this._flattenDrawScenario(t,function(t,r,i){var a=!1===r.expression.inherit?null:i,o=e._createFrameScalesFactoryMethod(a),s=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),u=new We(s.defineGrammarModel(o)),l=Ge(s.getGrammarRules(),u,n);return Ge(s.getAdjustScalesRules(),l,n),s.node().screenModel=s.createScreenModel(l),s}),i=this._flattenDrawScenario(t,function(t,r,i){var a=!1===r.expression.inherit?null:i,o=e._createFrameScalesFactoryMethod(a),s=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),u=new We(s.defineGrammarModel(o)),l=Ge(s.getGrammarRules(),u,n);return s.node().screenModel=s.createScreenModel(l),s.parentUnit=t,s.addInteraction(),s});return r.concat(function(){Object.keys(e.scales).forEach(function(t){return e.scalesHub.createScaleInfo(e.scales[t]).commit()})}).concat(i)},e.prototype._flattenDrawScenario=function(t,n){var r={},i=[],a=[t],o=e.traverseSpec({unit:this.root},function(t,e,o){var s;t.uid=(s=Ft((e?e.uid+"/":"")+JSON.stringify(Object.keys(t).filter(function(e){return"string"==typeof t[e]}).reduce(function(e,n){return e[n]=t[n],e},{}))+"-"+JSON.stringify(o.pipe)),r.hasOwnProperty(s)?s+="-"+ ++r[s]:r[s]=0,s),t.guide=kt(t.guide);var u,l=n(a[0],t,o);i.push(l),0===t.type.indexOf("COORDS.")&&(u=l,a.unshift(u))},function(t){0===t.type.indexOf("COORDS.")&&a.shift()},null,this._datify({source:this.root.expression.source,pipe:[]}));return o.push(function(){return i}),o},e.prototype._expandUnitsStructure=function(t,e){var n=this;void 0===e&&(e=[]);var r=this;if(!1===t.expression.operator)t.frames=t.frames.map(function(t){return r._datify(t)});else{var i=this._parseExpression(t.expression,e,t.guide);t.transformation=t.transformation||[],t.frames=i.exec().map(function(n){var a=(i.inherit?e:[]).concat([{type:"where",args:n}]).concat(t.transformation);return r._datify({key:n,pipe:a,source:i.source,units:t.units?t.units.map(function(t){var e=kt(t);return e.guide=t.guide,e}):[]})})}return t.frames.forEach(function(t){return t.units.forEach(function(e){return n._expandUnitsStructure(e,t.pipe)})}),t},e.prototype._createFrameScalesFactoryMethod=function(t){var e=this;return function(n,r,i){var a=r||n+":default";return e.scalesHub.createScaleInfo(e.scales[a],t).create("function"==typeof i?i(e.scales[a]):i)}},e.prototype._datify=function(t){return new Be(t,this.sources[t.source].data,this.transformations)},e.prototype._parseExpression=function(t,e,n){var r=this,i=t.operator||"none",a=t.source,o=!1!==t.inherit,s=t.params,u={source:a,pipe:o?e:[]},l=function(){return r._datify(u).part()},c=ze[i];if(!c)throw new Error(i+" operator is not supported");return{source:a,inherit:o,func:c,args:s,exec:function(){return c.apply(void 0,[l].concat(s||[],[n]))}}},e}(h),Xe="tau-chart__",qe=n(10),Ye=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();qe.Tooltip.defaults.baseClass=Xe+"tooltip";var $e=["top","bottom"];var Ke,Je,Qe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ye(e,t),e.prototype._pickPlace=function(t){if(!this.options.auto)return this.options.place;var e,n,r,i,a,o,s,u,l=0|this.options.winBound,c=(e=l,r=window,i=document.documentElement,a=(r.pageYOffset||i.scrollTop)-i.clientTop,o=(r.pageXOffset||i.scrollLeft)-i.clientTop,s=r.innerWidth||i.clientWidth,u=r.innerHeight||i.clientHeight,{top:(n={top:a,right:o+s,bottom:a+u,left:o,width:s,height:u}).top+e,right:n.right-e,bottom:n.bottom-e,left:n.left+e,width:n.width-2*e,height:n.height-2*e}),f=this.options.place.split("-"),d=this.spacing;if(-1!==$e.indexOf(f[0]))switch(t.top-this.height-d<=c.top?f[0]="bottom":t.bottom+this.height+d>=c.bottom&&(f[0]="top"),f[1]){case"left":t.right-this.width<=c.left&&(f[1]="right");break;case"right":t.left+this.width>=c.right&&(f[1]="left");break;default:t.left+t.width/2+this.width/2>=c.right?f[1]="left":t.right-t.width/2-this.width/2<=c.left&&(f[1]="right")}else switch(t.left-this.width-d<=c.left?f[0]="right":t.right+this.width+d>=c.right&&(f[0]="left"),f[1]){case"top":t.bottom-this.height<=c.top&&(f[1]="bottom");break;case"bottom":t.top+this.height>=c.bottom&&(f[1]="top");break;default:t.top+t.height/2+this.height/2>=c.bottom?f[1]="top":t.bottom-t.height/2-this.height/2<=c.top&&(f[1]="bottom")}return f.join("-")},e}(qe.Tooltip),Ze=function(){function t(t,e){this.chart=e,this.handlers=new Map,this.plugins=t.map(this.initPlugin,this)}return t.prototype.initPlugin=function(t){var e=this;t.init&&t.init(this.chart);var n=[];this.handlers.set(t,n);var r=function(r,i){n.push(e.chart.on(r,i,t))};return t.destroy&&r("destroy",t.destroy.bind(t)),Object.keys(t).forEach(function(e){if(0===e.indexOf("on")){var n=e.substr(2).toLowerCase();r(n,t[e].bind(t))}}),t},t.prototype.destroyPlugin=function(t){var e=this;t.destroy&&t.destroy(),this.handlers.get(t).forEach(function(n){e.chart.removeHandler(n,t)})},t.prototype.destroy=function(){var t=this;this.plugins.forEach(function(e){return t.destroyPlugin(e)})},t}(),tn={},en={},nn={reg:function(t,e,n){return n?(en[t]=n,tn[t]=function(t,e){this.___tauchartsseed___=new e(this.init(t))},tn[t].prototype=Object.assign({init:function(t){return t},defineGrammarModel:function(t){return this.node().defineGrammarModel(t)},getGrammarRules:function(t){return this.node().getGrammarRules(t)},getAdjustScalesRules:function(t){return this.node().getAdjustScalesRules(t)},createScreenModel:function(t){return this.node().createScreenModel(t)},addInteraction:function(){this.node().addInteraction()},node:function(){return this.___tauchartsseed___},draw:function(){this.node().draw()}},e)):tn[t]=e,this},get:function(t){if(!tn.hasOwnProperty(t))throw new w("Unknown unit type: "+t,E.UNKNOWN_UNIT_TYPE);return tn[t]},create:function(t,e){var n,r=this.get(t);en[t]?n=new r(e,this.get(en[t])):n=new r(e);return n}},rn={},an={},on={reg:function(t,e,n){return void 0===n&&(n=function(t){return t}),rn[t]=e,an[t]=n,on},get:function(t){return rn[t]},instance:function(t){return void 0===t&&(t={}),{create:function(e,n,r){return new(on.get(e))(n,(0,an[e])(r,t))}}}},sn=function(){function t(t,e,n){this.registry=t,this.sources=e,this.scales=n}return t.prototype.createScaleInfo=function(t,e){void 0===e&&(e=null);var n=t.dim,r=t.source,i=(this.sources[r].dims[n]||{}).type,a=this.sources[r].data,o=e||new Be({source:r},a);return t.dimType=i,this.registry.create(t.type,o,t)},t.prototype.createScaleInfoByName=function(t,e){return void 0===e&&(e=null),this.createScaleInfo(this.scales[t],e)},t}(),un=function(t,e,n){var r=!0,i=null;try{t.reduce(function(t,r){var a=function(t,e){var n=r[e],i=Ot(n)?JSON.stringify(n):n;return t.push(i),t},o=e.reduce(a,[]).join("/"),s=n.reduce(a,[]).join("/");if(t.hasOwnProperty(o)){var u=t[o];if(u!==s)throw i={type:"RelationIsNotAFunction",keyX:e.join("/"),keyY:n.join("/"),valX:o,errY:[u,s]},new Error("RelationIsNotAFunction")}else t[o]=s;return t},{})}catch(t){if("RelationIsNotAFunction"!==t.message)throw t;r=!1}return{result:r,error:i}},ln=function(t,e){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||e.push(n),e},[]);return function(t){var r=!n.some(function(e){return!t.hasOwnProperty(e)||null===t[e]});return r||e(t),r}},cn=function(t){var e={category:"ordinal",order:"ordinal",measure:"linear"},n={};return Object.keys(t).forEach(function(r){var i=t[r],a=(i.type||"category").toLowerCase();n[r]=Object.assign({},i,{type:a,scale:i.scale||e[a],value:i.value})}),n},fn=function(t){var e={type:"category",scale:"ordinal"};return t.reduce(function(t,n){return Object.keys(n).forEach(function(r){var i=n.hasOwnProperty(r)?n[r]:null;if(t[r]=t[r]||{type:null,hasNull:!1},null===i)t[r].hasNull=!0;else{var a=function(t,e){var n=e;return At(t)?(n.type="measure",n.scale="time"):Ot(t)?(n.type="order",n.scale="ordinal"):Number.isFinite(t)&&(n.type="measure",n.scale="linear"),n}(i,kt(e)),o=a.type,s=a.scale,u=null!==t[r].type&&t[r].type!==o;t[r].type=u?e.type:o,t[r].scale=u?e.scale:s}}),t},{})},dn=function(t,e,n){var r=t,i=["period","time"].indexOf(n.scale)>=0?function(t){return new Date(t)}:function(t){return t},a=t.reduce(function(t,e,n){return t.set(e,n),t},new Map);if("measure"===n.type||"period"===n.scale)r=t.slice().sort(ee(function(t,n){return i(t[e])-i(n[e])},function(t,e){return a.get(t)-a.get(e)}));else if(n.order){var o=n.order.reduce(function(t,e,n){return t[e]=n,t},{}),s=n.order.length,u="(___"+e+"___)";r=t.map(function(t){var n=o[t[e]];return n=n>=0?n:s,t[u]=n,t}).sort(ee(function(t,e){return t[u]-e[u]},function(t,e){return a.get(t)-a.get(e)})).map(function(t){return delete t[u],t})}return r},hn=function(t,e){var n=document.createElement("div");return n.classList.add(Xe+t),e&&e.appendChild(n),n},pn=function(){var t=hn("layout"),e=hn("layout__header",t),n=hn("layout__container",t),r=hn("layout__sidebar",n),i=hn("layout__content",n),a=hn("layout__content__wrap",i),o=hn("layout__sidebar-right",n);return{layout:t,header:e,content:a,contentContainer:i,leftSidebar:r,rightSidebar:hn("layout__sidebar-right__wrap",o),rightSidebarContainer:o,footer:hn("layout__footer",t)}},gn=function(){function t(t){this.spec=t,this.dist={sources:{"?":{dims:{},data:[{}]},"/":{dims:{},data:[]}},scales:{x_null:{type:"ordinal",source:"?"},y_null:{type:"ordinal",source:"?"},size_null:{type:"size",source:"?"},color_null:{type:"color",source:"?"},split_null:{type:"value",source:"?"},"pos:default":{type:"ordinal",source:"?"},"size:default":{type:"size",source:"?"},"label:default":{type:"value",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"}},settings:t.settings}}return t.prototype.convert=function(){var t=this.spec,e=this.dist;return this.ruleAssignSourceDims(t,e),this.ruleAssignStructure(t,e),this.ruleAssignSourceData(t,e),this.ruleApplyDefaults(e),e},t.prototype.ruleApplyDefaults=function(t){var e=t.settings||{},n=function(t,e,r){e(t,r),(t.units||[]).map(function(r){return n(r,e,t)})};n(t.unit,function(t,n){if(t.namespace="chart",t.guide=Qt(t.guide||{},{animationSpeed:e.animationSpeed||0,utcTime:e.utcTime||!1}),n&&!t.hasOwnProperty("units")){t=Qt(t,{x:n.x,y:n.y});var r=kt(n.guide)||{};t.guide.x=Qt(t.guide.x||{},r.x),t.guide.y=Qt(t.guide.y||{},r.y),t.expression.inherit=n.expression.inherit}return!n||t.guide&&t.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(t.guide=Object.assign(t.guide||{},{obsoleteVerticalStackOrder:(n.guide||{}).obsoleteVerticalStackOrder})),t},null)},t.prototype.ruleAssignSourceData=function(t,e){var n=t.spec.dimensions||{},r=e.sources["/"].dims,i=function(t,e){var n=t[e];return Ot(n)&&!At(n)&&Object.keys(n).forEach(function(r){return t[e+"."+r]=n[r]}),t};e.sources["/"].data=t.data.map(function(t){var e=Object.keys(t).reduce(i,t);return Object.keys(r).reduce(function(t,e){return t.hasOwnProperty(e)||(t[e]=null),null!==t[e]&&n[e]&&["period","time"].indexOf(n[e].scale)>=0&&(t[e]=new Date(t[e])),t},e)})},t.prototype.ruleAssignSourceDims=function(t,e){var n=t.spec.dimensions;e.sources["/"].dims=Object.keys(n).reduce(function(t,e){return t[e]={type:n[e].type},t},{})},t.prototype.ruleAssignStructure=function(t,e){var n=this,r=function(t){var i=kt(Zt(t,"unit"));return n.ruleCreateScales(t,i,e.settings),i.expression=n.ruleInferExpression(t),t.unit&&(i.units=t.unit.map(r)),i},i=r(t.spec.unit);i.expression.inherit=!1,e.unit=i},t.prototype.ruleCreateScales=function(t,e,n){var r=this,i=t.guide||{};["identity","color","size","label","x","y","split"].forEach(function(a){t.hasOwnProperty(a)&&(e[a]=r.scalesPool(a,t[a],i[a]||{},n))})},t.prototype.ruleInferDim=function(t,e){var n=t,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(n))return n;e.hasOwnProperty("tickLabel")?n=t+"."+e.tickLabel:r[t].value&&(n=t+"."+r[t].value);var i=this.dist.sources["/"].dims;return i.hasOwnProperty(n)||(i[n]={type:i[t].type},delete i[t]),n},t.prototype.scalesPool=function(t,e,n,r){var i=t+"_"+e;if(this.dist.scales.hasOwnProperty(i))return i;var a=this.spec.spec.dimensions,o={};if("color"===t&&null!==e&&(o={type:"color",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("brewer")&&(o.brewer=n.brewer),a[e]&&a[e].hasOwnProperty("order")&&(o.order=a[e].order),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("nice")&&(o.nice=n.nice)),"size"===t&&null!==e&&(o={type:"size",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("func")&&(o.func=n.func),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("minSize")&&(o.minSize=n.minSize),n.hasOwnProperty("maxSize")&&(o.maxSize=n.maxSize)),"label"===t&&null!==e&&(o={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"split"===t&&null!==e&&(o={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"identity"===t&&null!==e&&(o={type:"identity",source:"/",dim:this.ruleInferDim(e,n)}),a.hasOwnProperty(e)&&("x"===t||"y"===t)){if(o={type:a[e].scale,source:"/",dim:this.ruleInferDim(e,n)},a[e].hasOwnProperty("order")&&(o.order=a[e].order),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("autoScale")?o.autoScale=n.autoScale:o.autoScale=!0,n.hasOwnProperty("nice")?o.nice=n.nice:o.nice=o.autoScale,n.hasOwnProperty("niceInterval")?o.niceInterval=n.niceInterval:o.niceInterval=null,n.hasOwnProperty("tickPeriod")&&(o.period=n.tickPeriod,o.type="period"),n.hasOwnProperty("tickPeriod")&&n.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(n.hasOwnProperty("timeInterval")){o.period=n.timeInterval,o.type="time";var s=x.get(o.period,{utc:r.utcTime});n.hasOwnProperty("min")&&(o.min=s.cast(new Date(n.min))),n.hasOwnProperty("max")&&(o.max=s.cast(new Date(n.max)))}o.fitToFrameByDims=n.fitToFrameByDims,o.ratio=n.ratio}return this.dist.scales[i]=o,i},t.prototype.getScaleConfig=function(t,e){var n=t+"_"+e;return this.dist.scales[n]},t.prototype.ruleInferExpression=function(t){var e={operator:"none",params:[]},n=t.guide||{},r=n.x||{},i=n.y||{},a=this.getScaleConfig("x",t.x),o=this.getScaleConfig("y",t.y);return 0===t.type.indexOf("ELEMENT.")?t.color&&(e={operator:"groupBy",params:[this.ruleInferDim(t.color,n.color||{})]}):"COORDS.RECT"===t.type&&1===t.unit.length&&"COORDS.RECT"===t.unit[0].type&&(e=a.period||o.period?{operator:"cross_period",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i),a.period,o.period]}:{operator:"cross",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i)]}),Object.assign({inherit:!0,source:"/"},e)},t}(),mn=n(6),yn=n(7),vn=function(){return(vn=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.computed?{value:n,computed:r}:t},{}).value;return n(e(a))},Ln=function(t,e){var n=t.dimType,r=t.scaleType,i=[n,r,"*"].join(":"),a=[n,r].join(":");return e[i]||e[a]||e[n]||null},Nn=function(t,e,n){return t.hasOwnProperty(e+":"+n)?t[e+":"+n]:t[""+e]},Rn=function(t,e){return["day","week","month"].indexOf(t)>=0&&(t+="-short"+(e?"-utc":"")),t},Fn=function(t,e){var n=t.width,r=t.height,i=Math.abs(Ht(e));return{width:Math.max(Math.cos(i)*n,r),height:Math.max(Math.sin(i)*n,r)}},Dn=function(t,e){void 0===e&&(e="x");var n=Wt(t),r="x"===e?[[0,45,"middle"],[45,135,"start"],[135,225,"middle"],[225,315,"end"],[315,360,"middle"]]:[[0,90,"end"],[90,135,"middle"],[135,225,"start"],[225,315,"middle"],[315,360,"end"]],i=r.findIndex(function(t){return n>=t[0]&&ne.xAxisTickLabelLimit&&(t.x.tickFormatWordWrap=!0,t.x.tickFormatWordWrapLines=e.xTickWordWrapLinesLimit,d=jn(c,e.xAxisTickLabelLimit,e.xTickWordWrapLinesLimit)),f.width>e.yAxisTickLabelLimit&&(t.y.tickFormatWordWrap=!0,t.y.tickFormatWordWrapLines=e.yTickWordWrapLinesLimit,h=jn(f,e.yAxisTickLabelLimit,e.yTickWordWrapLinesLimit)),a&&(t.y.tickFormatWordWrap=!1,t.y.tickFormatWordWrapLines=1,(h=jn(f,2*e.yAxisTickLabelLimit,1)).width=20);var p=u?0:1,g=l?0:1,m=t.x.label,y=t.y.label,v=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,x=Fn(d,t.x.rotate),_=Fn(h,t.y.rotate);i?(m.padding=(-e.xAxisPadding-e.xFontLabelHeight)/2+e.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-e.yAxisPadding-e.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,v=0,b=0):(m.padding=Tn([p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight)]),m.paddingNoTicks=v*(e.distToXAxisLabel+e.xFontLabelHeight),y.padding=Tn([g*(e.yTickWidth+_.width),b*e.distToYAxisLabel]),y.paddingNoTicks=b*e.distToYAxisLabel),a&&(y.padding=0,y.paddingNoTicks=0);var w=e.xFontLabelDescenderLineHeight;return t.padding=Object.assign(t.padding,{b:t.x.hide?0:Tn([t.x.padding,p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight+w)]),l:t.y.hide?0:Tn([t.y.padding,a?0:g*(e.yTickWidth+_.width),b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.paddingNoTicks=Object.assign({},t.paddingNoTicks,{b:t.x.hide?0:Tn([t.x.padding,v*(e.distToXAxisLabel+e.xFontLabelHeight+w)]),l:t.y.hide?0:Tn([t.y.padding,b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.x=Object.assign(t.x,{density:x.width+2*Nn(e,"xDensityPadding",n.dimType),tickFontHeight:c.height,$minimalDomain:o.length,$maxTickTextW:d.width,$maxTickTextH:d.height,tickFormatWordWrapLimit:e.xAxisTickLabelLimit}),t.y=Object.assign(t.y,{density:_.height+2*Nn(e,"yDensityPadding",r.dimType),tickFontHeight:f.height,$minimalDomain:s.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:e.yAxisTickLabelLimit}),t}var zn=function(t){var e=t.unit,n=t.meta,r=t.settings,i=t.allowXVertical,a=t.allowYVertical,o=t.inlineLabels,s=n.dimension(e.x),u=n.dimension(e.y),l=n.scaleMeta(e.x,e.guide.x),c=n.scaleMeta(e.y,e.guide.y),f=l.isEmpty,d=c.isEmpty;e.guide.x.tickFormat=Rn(e.guide.x.tickFormat||Ln(s,r.defaultFormats),r.utcTime),e.guide.y.tickFormat=Rn(e.guide.y.tickFormat||Ln(u,r.defaultFormats),r.utcTime);var h=!!i&&!("measure"===s.dimType),p=!!a&&!("measure"===u.dimType);if(e.guide.x.padding=f?0:r.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:r.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=Dn(e.guide.x.rotate,"x"),e.guide.y.rotate=p?-90:0,e.guide.y.textAnchor=Dn(e.guide.y.rotate,"y"),e.guide=In(e.guide,r,l,c,o,he(e)),o){var g=e.guide.x.label,m=e.guide.y.label;g.cssClass+=" inline",g.dock="right",g.textAnchor="end",m.cssClass+=" inline",m.dock="right",m.textAnchor="end"}return e},Bn={NONE:function(t,e,n){var r=kt(t);return Vn(kt(r.unit),r.unit,function(t,e){return e.guide.x.tickFontHeight=n.getAxisTickLabelSize("X").height,e.guide.y.tickFontHeight=n.getAxisTickLabelSize("Y").height,e.guide.x.tickFormatWordWrapLimit=n.xAxisTickLabelLimit,e.guide.y.tickFormatWordWrapLimit=n.yAxisTickLabelLimit,e}),r},"BUILD-LABELS":function(t,e){var n=kt(t),r=[],i=[],a=null,o=null;mt(n.unit,"units",On,function(t,n){if(t.isLeaf)return n;!a&&n.x&&(a=n),!o&&n.y&&(o=n),n.guide=n.guide||{},n.guide.x=n.guide.x||{label:{text:""}},n.guide.y=n.guide.y||{label:{text:""}},n.guide.x.label=Ot(n.guide.x.label)?n.guide.x.label:{text:n.guide.x.label&&n.guide.x.label.text?n.guide.x.label.text:""},n.guide.y.label=Ot(n.guide.y.label)?n.guide.y.label:{text:n.guide.y.label&&n.guide.y.label.text?n.guide.y.label.text:""},n.x&&(n.guide.x.label.text=n.guide.x.label.text||e.dimension(n.x).dimName),n.y&&(n.guide.y.label.text=n.guide.y.label.text||e.dimension(n.y).dimName);var s=n.guide.x.label.text;s&&(r.push(s),n.guide.x.tickFormatNullAlias=n.guide.x.hasOwnProperty("tickFormatNullAlias")?n.guide.x.tickFormatNullAlias:"No "+s,n.guide.x.label.text="",n.guide.x.label._original_text=s);var u=n.guide.y.label.text;return u&&(i.push(u),n.guide.y.tickFormatNullAlias=n.guide.y.hasOwnProperty("tickFormatNullAlias")?n.guide.y.tickFormatNullAlias:"No "+u,n.guide.y.label.text="",n.guide.y.label._original_text=u),n});return a&&(a.guide.x.label.text=a.guide.x.label.hide?"":r.join(" → ")),o&&(o.guide.y.label.text=o.guide.y.label.hide?"":i.join(" → ")),n},"BUILD-GUIDE":function(t,e,n){var r=kt(t);return Vn(kt(r.unit),r.unit,function(t,r){if(t.isLeaf)return r;var i=!t.isLeaf&&!t.isLeafParent,a=e.scaleMeta(r.x,r.guide.x),o=e.scaleMeta(r.y,r.guide.y),s=!i&&Boolean(a.dimType)&&"measure"!==a.dimType;return r.guide.x.rotate=r.guide.x.rotate||(s?-90:0),r.guide.x.textAnchor=Dn(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||Ln(a,n.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||Ln(o,n.defaultFormats),r.guide.x.padding=i?0:n.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=i?0:n.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=In(r.guide,Qt({distToXAxisLabel:a.isEmpty?n.xTickWidth:n.distToXAxisLabel,distToYAxisLabel:o.isEmpty?n.yTickWidth:n.distToYAxisLabel},n),a,o,null,he(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:i?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!i||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:i?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!i&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:t.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":function(t,e,n){var r=kt(t);return Vn(kt(r.unit),r.unit,function(t,r){return t.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=t.isLeafParent?"xy":""),t.isLeafParent?zn({unit:r,meta:e,settings:Qt({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!0,allowYVertical:!1,inlineLabels:!0}):(r.guide.x.cssClass+=" facet-axis compact",r.guide.x.avoidCollisions=!0,r.guide.y.cssClass+=" facet-axis compact",r.guide.y.avoidCollisions=!0,zn({unit:r,meta:e,settings:Qt({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))}),r},AUTO:function(t,e,n){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(t,r){return Bn[r](t,e,n)},t)},COMPACT:function(t,e,n){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(t,r){return Bn[r](t,e,n)},t)}},Vn=function(t,e,n){var r,i=((r=e).options=r.options||{},r.guide=r.guide||{},r.guide.padding=Qt(r.guide.padding||{},{l:0,b:0,r:0,t:0}),r.guide.x=kn(r.guide,"x"),r.guide.x=An(r.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),r.guide.y=kn(r.guide,"y",{rotate:-90}),r.guide.y=An(r.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),r.guide.size=kn(r.guide,"size"),r.guide.color=kn(r.guide,"color"),r);i=n(On(i),i);var a=Zt(i=Cn(i,t),"units");return(i.units||[]).forEach(function(t){return Vn(kt(t),(r=a,(e=t).guide=e.guide||{},e.guide.padding=e.guide.padding||{l:0,t:0,r:0,b:0},e.hasOwnProperty("units")||((e=Qt(e,r)).guide=Qt(e.guide,kt(r.guide)),e.guide.x=Qt(e.guide.x,kt(r.guide.x)),e.guide.y=Qt(e.guide.y,kt(r.guide.y))),e),n);var e,r}),i},Hn=function(t,e,n,r){var i={dimension:function(t){var e=n.scales[t],r=n.sources[e.source].dims[e.dim]||{};return{dimName:e.dim,dimType:r.type,scaleType:e.type}},scaleMeta:function(t){var e=r("pos",t).domain(),i=n.scales[t],a=n.sources[i.source].dims[i.dim]||{};return{dimName:i.dim,dimType:a.type,scaleType:i.type,values:e,isEmpty:null==a.type}}},a=(Bn[t]||Bn.NONE)({unit:kt(n.unit)},i,e);return n.unit=a.unit,n},Wn=function(){function t(t){this.spec=t,this.isApplicable=jt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.size,r=e.settings.specEngine.find(function(t){return n.width<=t.width||n.height<=t.height});return Hn(r.name,e.settings,e,function(e,n){return t.getScaleInfo(n||e+":default")})},t}(),Gn=function(){function t(){}return t.optimizeXAxisLabel=function(t,e){var n=e.xAxisTickLabelLimit,r=function(t){if(!t.guide.x.hide&&!t.guide.x.hideTicks&&0!==t.guide.x.rotate){t.guide.x.rotate=0,t.guide.x.textAnchor="middle";var e=0-Math.min(n,t.guide.x.$maxTickTextW)+t.guide.x.$maxTickTextH;i(t,e)}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})},i=function(e,n){t!==e&&"extract-axes"===e.guide.autoLayout?(t.guide.x.padding+=n,t.guide.padding.b+=n):(e.guide.x.label.padding+=e.guide.x.label.padding>0?n:0,e.guide.padding.b+=e.guide.padding.b>0?n:0)};r(t)},t.hideAxisTicks=function(t,e,n){var r=function(t){var e="x"===n?"b":"l",i=t.guide;if(!i[n].hide&&!i[n].hideTicks){he(t)&&"y"===n||(i[n].hideTicks=!0);var a=i[n].label.text&&!i[n].label.hide;i.padding[e]=i.paddingNoTicks?i.paddingNoTicks[e]:0,i[n].padding=i[n].paddingNoTicks||0,i[n].label.padding=a?i[n].label.paddingNoTicks:0}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})};r(t)},t.facetsLabelsAtTop=function(t,e){var n=function(t){var e=t.units||[];if(he(t)){var r=t.guide;r.y.facetAxis=!0,r.y.rotate=0,r.y.textAnchor="start",e.forEach(function(t){t.guide.padding.t=20})}e.filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return n(t)})};n(t)},t}(),Un=function(t){return t.$maxTickTextW},Xn=function(t){return 0==t.rotate?t.$maxTickTextW:t.$maxTickTextH},qn=function(t){return t.density},Yn=function(t){var e=[],n=[],r=function(t){if("COORDS.RECT"===t.type&&t.units&&t.units[0]&&"COORDS.RECT"===t.units[0].type){var i=t.x.replace(/^x_/,""),a=t.y.replace(/^y_/,"");"null"!==i&&e.push(i),"null"!==a&&n.push(a),t.units.forEach(r)}};r(t.unit);var i={},a={},o=function(t){"COORDS.RECT"===t.type&&t.frames.forEach(function(t){t.key&&(Object.keys(t.key).forEach(function(r){e.indexOf(r)>=0&&(i.hasOwnProperty(r)||(i[r]=[]),i[r].indexOf(t.key[r])<0&&i[r].push(t.key[r])),n.indexOf(r)>=0&&(a.hasOwnProperty(r)||(a[r]=[]),a[r].indexOf(t.key[r])<0&&a[r].push(t.key[r]))}),t.units&&t.units.forEach(o))})};return o(t.unit),{xFacetCount:Object.keys(i).reduce(function(t,e){return t*i[e].length},1),yFacetCount:Object.keys(a).reduce(function(t,e){return t*a[e].length},1)}},$n={"entire-view":function(t,e,n,r){var i=n.unit.guide,a=Yn(n),o=a.xFacetCount,s=a.yFacetCount;s>0&&Gn.facetsLabelsAtTop(n.unit,n.settings);var u=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0,l=i.paddingNoTicks?i.padding.b-i.paddingNoTicks.b:0,c=i.paddingNoTicks&&t.height-lt.height||o*n.settings.minFacetWidth+u>t.width,f=i.paddingNoTicks&&t.width-ut.height||o*n.settings.minFacetWidth+u>t.width;c&&Gn.hideAxisTicks(n.unit,n.settings,"x"),f&&Gn.hideAxisTicks(n.unit,n.settings,"y");var d=t.width;if(e("x",n.unit,Un)<=t.width)r(n.unit,n.settings);else{var h=e("x",n.unit,Xn);if(h>t.width){var p=Math.max(t.width,e("x",n.unit,qn));d=Math.min(h,p)}}var g=Math.max(t.height,e("y",n.unit,qn));return!c&&d>t.width&&Gn.hideAxisTicks(n.unit,n.settings,"x"),!f&&g>t.height&&Gn.hideAxisTicks(n.unit,n.settings,"y"),{newW:t.width,newH:t.height}},minimal:function(t,e,n){return{newW:e("x",n.unit,qn),newH:e("y",n.unit,qn)}},normal:function(t,e,n,r){Yn(n).yFacetCount>0&&Gn.facetsLabelsAtTop(n.unit,n.settings);var i=n.unit.guide;i.paddingNoTicks&&(t.width-i.padding.l+i.paddingNoTicks.lt.width){var s=Math.max(t.width,e("x",n.unit,qn));a=Math.min(o,s)}}return{newW:a,newH:Math.max(t.height,e("y",n.unit,qn))}},"fit-width":function(t,e,n,r){var i=n.unit.guide,a=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0;return(i.paddingNoTicks&&t.width-at.width)&&Gn.hideAxisTicks(n.unit,n.settings,"y"),e("x",n.unit,Un)<=t.width&&r(n.unit,n.settings),{newW:t.width,newH:e("y",n.unit,qn)}},"fit-height":function(t,e,n){var r=n.unit.guide,i=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&t.height-it.height)&&Gn.hideAxisTicks(n.unit,n.settings,"x"),{newW:e("x",n.unit,qn),newH:t.height}}},Kn=function(){function t(t){this.spec=t,this.isApplicable=jt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.fitModel;if(!n)return e;var r=e.scales,i=function(t,e){return t.discrete?e*t.domain().length:4*e},a=function(e,n,o,s){void 0===s&&(s=null);var u="x"===e?n.x:n.y,l="x"===e?n.y:n.x,c=n.guide,f=o("x"===e?c.x:c.y),d=n.units[0],h="x"===e?c.padding.l+c.padding.r:c.padding.b+c.padding.t;if("ELEMENT.INTERVAL"===d.type&&"y"===e===Boolean(d.flip)&&d.label&&!t.getScaleInfo(d.label,s).isEmpty()){var p,g=2*(c.label&&c.label.fontSize?c.label.fontSize:10),m=t.getScaleInfo(u,s);if(m.discrete&&(null==d.guide.enableColorToBarPosition?!d.stack:d.guide.enableColorToBarPosition)){var y=d.color;if(y){var v=t.getScaleInfo(y,s);if(v.discrete){v.domain();p=v}}}var b=n.frames.reduce(function(t,e){return t+function(t){var e=t.part(),n=Yt(e.map(function(t){return t[m.dim]})).length,r=1;if(p){var i=e.reduce(function(t,e){var n=e[m.dim],r=e[p.dim];return t[n]=t[n]||{},t[n][r]||(t[n][r]=!0),t},{}),a=Object.keys(i).map(function(t){return Object.keys(i[t]).length});r=Math.max.apply(Math,a)}return n*r*g}(e)},0),x=i(m,f);return h+Math.max(b,x)}if("COORDS.RECT"!==d.type){var _=t.getScaleInfo(u,s);return h+i(_,f)}var w,E,S=(w=n.frames,E=r[l].dim,w.reduce(function(t,e){var n=(e.key||{})[E];return t[n]=t[n]||[],t[n].push(e),t},{})),M=Object.keys(S).map(function(t){return S[t].map(function(t){return a(e,t.units[0],o,t)}).reduce(function(t,e){return t+e},0)});return h+Math.max.apply(Math,M)},o=e.settings.size,s=o.width,u=o.height,l=$n[n];if(l){var c=l(o,a,e,Gn.optimizeXAxisLabel);s=c.newW,u=c.newH}return e.settings.size=function(n,r,i){var a=e.settings.getScrollbarSize(t.getLayout().contentContainer),o=r.width>n.width&&r.width<=n.width*i?n.width:r.width,s=r.height>n.height&&r.height<=n.height*i?n.height:r.height,u=n.width-o,l=n.height-s>=0?0:a.width;return{height:s-(u>=0?0:a.height),width:o-l}}(o,{width:s,height:u},e.settings.avoidScrollAtRatio),e},t}(),Jn=function(){function t(t){this.spec=t,this.isApplicable=t.settings.autoRatio&&jt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleApplyRatio(e,t)}catch(t){if("Not applicable"!==t.message)throw t}return e},t.prototype.ruleApplyRatio=function(t,e){var n=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},r=function(t,e,n,i){void 0===i&&(i=0),e(t,i)&&(t.units||[]).map(function(t){return r(t,e,n,i+1)}),n(t,i)},i=[],a=[];r(t.unit,function(t,e){if(e>1||!n(t))throw new Error("Not applicable");return i.push(t.x),a.push(t.y),1===(t.units||[]).map(function(t){if(!n(t)&&0!==t.type.indexOf("ELEMENT."))throw new Error("Not applicable");return t}).filter(n).length},function(){return 0});var o=function(e){return t.scales[e]},s=function(t){return"/"===t.source&&!t.ratio&&!t.fitToFrameByDims},u=function(t){return"ordinal"===t.type||"period"===t.type&&!t.period},l=i.map(o).filter(s),c=a.map(o).filter(s);if([l.length,c.length].some(function(t){return 2===t})){var f=function(t){return t.dim},d=function(t,e,n){t.fitToFrameByDims=n.slice(0,e).map(f)},h=function(t,n){2===n.filter(u).length&&(n.forEach(d),n[0].ratio=Dt(t,n.map(f),e))};h("x",l),h("y",c)}},t}(),Qn=function(){function t(t){this.spec=t,this.isApplicable="EXTRACT"===t.settings.layoutEngine&&jt(t.unit)}return t.prototype.transform=function(){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleExtractAxes(t)}catch(t){if("Not applicable"!==t.message)throw t;console.log("[TauCharts]: can't extract axes for the given chart specification")}return t},t.prototype.ruleExtractAxes=function(t){var e=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},n=function(t){return t?10:0},r={l:0,r:10,t:10,b:0},i={l:0,b:0},a=[],o=[];yt(t.unit,function(t,n){if(n>1||!e(t))throw new Error("Not applicable");t.guide=t.guide||{};var s=t.guide,u=s.padding||{l:0,r:0,t:0,b:0},l=s.paddingNoTicks||{l:0,b:0};return r.l+=u.l,r.r+=u.r,r.t+=u.t,r.b+=u.b,i.l+=l.l,i.b+=l.b,a.push(Object.assign({},r)),o.push(Object.assign({},i)),1===(t.units||[]).map(function(t){if(!e(t)&&0!==t.type.indexOf("ELEMENT."))throw new Error("Not applicable");return t}).filter(e).length},function(t){var e=a.pop(),s=o.pop(),u=t.guide||{};u.x=u.x||{},u.x.padding=u.x.padding||0,u.x.paddingNoTicks=u.x.paddingNoTicks||0,u.y=u.y||{},u.y.padding=u.y.padding||0,u.y.paddingNoTicks=u.y.paddingNoTicks||0,u.padding={l:n(t.y),r:n(1),t:n(1),b:n(t.x)},u.paddingNoTicks={l:0,b:0},u.autoLayout="extract-axes",u.x.padding+=r.b-e.b,u.y.padding+=r.l-e.l,u.x.paddingNoTicks+=i.b-s.b,u.y.paddingNoTicks+=i.l-s.l}),t.unit.guide.padding=r,t.unit.guide.paddingNoTicks=i},t}(),Zn=function(){function t(t){var e=void 0===t?{}:t,n=e.src,r=void 0===n?null:n,i=e.timeout,a=void 0===i?Number.MAX_SAFE_INTEGER:i,o=e.syncInterval,s=void 0===o?Number.MAX_SAFE_INTEGER:o,u=e.callbacks,l=void 0===u?{}:u,c=this;this.setTimeoutDuration(a),this.setSyncInterval(s),this.setCallbacks(l),this._running=!1,this._queue=[],this._result=r,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=function(){if(c._running&&c._requestedFrameId){var t=c._getCancelFrameFunction(),e=c._getRequestFrameFunction();t(c._requestedFrameId),c._requestedFrameId=e(c._requestedFrameCallback)}},this._tasksCount=0,this._finishedTasksCount=0}return t.prototype.setTimeoutDuration=function(e){t.checkType(e,"number","timeout"),this._timeout=e},t.prototype.setSyncInterval=function(e){t.checkType(e,"number","syncInterval"),this._syncInterval=e},t.prototype.setCallbacks=function(e){t.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)},t.prototype.addTask=function(t){return this._queue.push(t),this._tasksCount++,this},t.prototype.run=function(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,t.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()},t.prototype.isRunning=function(){return this._running},t.prototype._loopTasks=function(){for(var e,n,r,i,a=0,o=this._syncInterval/t.runnersInProgress;this._running&&!(r=this._asyncDuration>this._timeout)&&!(i=a>o)&&(e=this._queue.shift());){if(null===(n=this._runTask(e)))return;this._syncDuration+=n,this._asyncDuration+=n,a+=n}r&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!r&&i&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))},t.prototype._runTask=function(t){var e=performance.now();if(this._callbacks.error)try{this._result=t.call(null,this._result,this)}catch(t){return this.stop(),this._callbacks.error.call(null,t,this),null}else this._result=t.call(null,this._result,this);var n=performance.now()-e;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),n},t.prototype._requestFrame=function(){var t=this,e=performance.now(),n=function(){t._requestedFrameId=null;var n=performance.now();t._asyncDuration+=n-e,t._loopTasks()},r=this._getRequestFrameFunction();this._requestedFrameCallback=n,this._requestedFrameId=r(n)},t.prototype._getRequestFrameFunction=function(){var t=this;return document.hidden?function(e){return t._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})}:function(e){return t._requestedFrameType="animation",requestAnimationFrame(e)}},t.prototype._getCancelFrameFunction=function(){switch(this._requestedFrameType){case"animation":return function(t){return cancelAnimationFrame(t)};case"idle":return function(t){return window.cancelIdleCallback(t)}}},t.prototype.stop=function(){if(!this._running)throw new Error("Task Runner is already stopped");(this._running=!1,t.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId)&&(this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null)},t.checkType=function(t,e,n){if(typeof t!==e)throw new Error('Task Runner "'+n+'" property is not "'+e+'"')},t}();Zn.runnersInProgress=0;var tr=Zn,er=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nr=function(){return(nr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var c=l.findIndex(function(t){return t.closest.distance!==l[0].closest.distance||t.closest.secondaryDistance!==l[0].closest.secondaryDistance}),f=c<0?l:l.slice(0,c);if(1===f.length)a=f[0].closest.data,o=f[0].closest.node,s=f[0].unit;else{var d=f.reduce(function(t,e){return t+e.closest.x},0)/f.length,h=f.reduce(function(t,e){return t+e.closest.y},0)/f.length,p=Math.atan2(h-r,d-n)+Math.PI,g=Math.round((f.length-1)*p/2/Math.PI),m=f[g].closest;a=m.data,o=m.node,s=f[g].unit}}u.forEach(function(e){return e.unit.fire(i,{event:t,data:a,node:o,unit:s})})},e.prototype._initPointerEvents=function(){var t=this;this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);var e=rr.select(this._svg),n=this._liveSpec.settings.syncPointerEvents?function(t){return function(){return t(o.event)}}:function(e){return function(){var n=o.event;t._pointerAnimationFrameId&&"mousemove"!==n.type&&t._cancelPointerAnimationFrame(),t._pointerAnimationFrameId||(t._pointerAnimationFrameId=requestAnimationFrame(function(){t._pointerAnimationFrameId=null,e(n)}))}},r=function(e){return t._handlePointerEvent(e)};e.on("mousemove",n(r)),e.on("click",n(r)),e.on("mouseleave",n(function(e){"none"!==window.getComputedStyle(t._svg).pointerEvents&&t.select(function(){return!0}).forEach(function(t){return t.fire("data-hover",{event:e,data:null,node:null,unit:null})})}))},e.prototype._cancelPointerAnimationFrame=function(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null},e.prototype._setupTaskRunner=function(t){var e=this;return this._resetTaskRunner(),this._taskRunner=new tr({timeout:t.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:t.settings.asyncRendering?t.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:function(){e._completeRendering(),e._renderingPhase=null},timeout:function(t,n){e._displayTimeoutWarning({timeout:t,proceed:function(){e.disablePointerEvents(),n.setTimeoutDuration(Number.MAX_SAFE_INTEGER),n.run()},cancel:function(){e._cancelRendering()}}),e.enablePointerEvents(),e.fire("renderingtimeout",t)},progress:function(t){var n={spec:0,draw:1}[e._renderingPhase]/2+t/2;e._reportProgress(n)},error:t.settings.handleRenderingErrors?function(n){e._cancelRendering(),e._displayRenderingError(n),e.fire("renderingerror",n),t.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',"Error message: "+n.message].join(" "),"ERROR")}:null}}),this._taskRunner},e.prototype._resetTaskRunner=function(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)},e.prototype.renderTo=function(t,e){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(t,e);var n=this._createLiveSpec();if(!n)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(n),i=this._setupTaskRunner(n);this._scheduleDrawScenario(i,r),this._scheduleDrawing(i,r),i.run()},e.prototype._insertLayout=function(t,e){this._target=t,this._defaultSize=Object.assign({},e);var n=rr.select(t).node();if(null===n)throw new Error("Target element not found");this._layout.layout.parentNode!==n&&n.appendChild(this._layout.layout);var r=this._layout.content,i=ye(this._layout.contentContainer);this._layout.contentContainer.style.padding="0 "+i.width+"px "+i.height+"px 0",ve(this._layout.rightSidebarContainer,"vertical");var a=Object.assign({},e)||{};if(!a.width||!a.height){var o=r.parentElement,s=o.scrollLeft,u=o.scrollTop;r.style.display="none",a=Qt(a,_e(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=s,r.parentElement.scrollTop=u,a.height||(a.height=_e(this._layout.layout).height)}this.configGPL.settings.size=a},e.prototype._createLiveSpec=function(){var t=this;return this._liveSpec=kt(Zt(this.configGPL,"plugins")),this._liveSpec.sources=this.getDataSources(),this._liveSpec.settings=this.configGPL.settings,this._experimentalSetupAnimationSpeed(this._liveSpec),this.isEmptySources(this._liveSpec.sources)?null:(this._liveSpec=this.transformers.reduce(function(e,n){return new n(e).transform(t)},this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)},e.prototype._experimentalSetupAnimationSpeed=function(t){t.settings.initialAnimationSpeed=t.settings.initialAnimationSpeed||t.settings.animationSpeed;var e=t.settings.experimentalShouldAnimate(t)?t.settings.initialAnimationSpeed:0;t.settings.animationSpeed=e;var n=function(t){t.guide=t.guide||{},t.guide.animationSpeed=e,t.units&&t.units.forEach(n)};n(t.unit)},e.prototype._createGPL=function(t){var e=new Ue(t,this.getScaleFactory(),nn,M),n=e.unfoldStructure();return this.onUnitsStructureExpanded(n),e},e.prototype._scheduleDrawScenario=function(t,e){var n=this,r=rr.select(this._layout.content),i=e.config.settings.size;t.addTask(function(){return n._renderingPhase="spec"}),e.getDrawScenarioQueue({allocateRect:function(){return{slot:function(t){return r.selectAll(".uid_"+t)},frameId:"root",left:0,top:0,width:i.width,containerWidth:i.width,height:i.height,containerHeight:i.height}}}).forEach(function(e){return t.addTask(e)})},e.prototype._scheduleDrawing=function(t,e){var n=this,r=e.config.settings.size;t.addTask(function(t){n._renderingPhase="draw",n._renderRoot({scenario:t,newSize:r}),n._cancelPointerAnimationFrame(),n._scheduleRenderScenario(t)})},e.prototype._resetProgressLayout=function(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()},e.prototype._renderRoot=function(t){var e=this,n=t.scenario,r=t.newSize,i=rr.select(this._layout.content),a=n[0].config.uid,o=ir(i,"svg").attr("width",Math.floor(r.width)).attr("height",Math.floor(r.height));o.attr("class")||o.attr("class",Xe+"svg"),this._svg=o.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var s=o.selectAll("g.frame-root").data([a],function(t){return t});s.enter().append("g").classed(Xe+"cell cell frame-root uid_"+a,!0).merge(s).call(function(t){t.classed("tau-active",!0),nt(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),s.exit().call(function(t){t.classed("tau-active",!1),nt(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})},e.prototype._scheduleRenderScenario=function(t){var e=this;t.forEach(function(t){e._taskRunner.addTask(function(){t.draw(),e.onUnitDraw(t.node()),e._renderedItems.push(t)})})},e.prototype._completeRendering=function(){ve(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=this._liveSpec.settings.size.height+"px",this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),ve(this._layout.rightSidebarContainer,"vertical")},e.prototype._cancelRendering=function(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()},e.prototype._createProgressBar=function(){var t=rr.select(this._layout.header),e=ir(t,"div."+Xe+"progress");e.select("div."+Xe+"progress__value").remove();var n=e.append("div").classed(Xe+"progress__value",!0).style("width",0);this._reportProgress=function(t){requestAnimationFrame(function(){e.classed(Xe+"progress_active",t<1),n.style("width",100*t+"%")})}},e.prototype._displayRenderingError=function(t){this._layout.layout.classList.add(Xe+"layout_rendering-error")},e.prototype._clearRenderingError=function(){this._layout.layout.classList.remove(Xe+"layout_rendering-error")},e.prototype.getScaleFactory=function(t){return void 0===t&&(t=null),new sn(on.instance(this._liveSpec.settings),t||this._liveSpec.sources,this._liveSpec.scales)},e.prototype.getScaleInfo=function(t,e){return void 0===e&&(e=null),this.getScaleFactory().createScaleInfoByName(t,e)},e.prototype.getSourceFiltersIterator=function(t){var e=this,n=qt(Object.keys(this._filtersStore.filters).map(function(t){return e._filtersStore.filters[t]})).filter(function(e){return!t(e)}).map(function(t){return t.predicate});return function(t){return n.reduce(function(e,n){return e&&n(t)},!0)}},e.prototype.getDataSources=function(t){var e=this;void 0===t&&(t={});var n=this._chartDataModel(this._originData);return Object.keys(n).filter(function(t){return"?"!==t}).reduce(function(r,i){var a=n[i],o=e.getSourceFiltersIterator(function(e){return function(n){return t.excludeFilter&&-1!==t.excludeFilter.indexOf(n.tag)||n.src!==e}}(i));return r[i]={dims:a.dims,data:a.data.filter(o)},r},{"?":n["?"]})},e.prototype.isEmptySources=function(t){return!Object.keys(t).filter(function(t){return"?"!==t}).filter(function(e){return t[e].data.length>0}).length},e.prototype.getChartModelData=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="/"),this.getDataSources(t)[e].data},e.prototype.getDataDims=function(t){return void 0===t&&(t="/"),this._originData[t].dims},e.prototype.getData=function(t){return void 0===t&&(t="/"),this._originData[t].data},e.prototype.setData=function(t,e){void 0===e&&(e="/"),this._originData[e].data=t,this.refresh()},e.prototype.getSVG=function(){return this._svg},e.prototype.addFilter=function(t){t.src=t.src||"/";var e=t.tag,n=this._filtersStore.filters[e]=this._filtersStore.filters[e]||[],r=this._filtersStore.tick++;return t.id=r,n.push(t),r},e.prototype.removeFilter=function(t){var e=this;return Object.keys(this._filtersStore.filters).map(function(n){e._filtersStore.filters[n]=e._filtersStore.filters[n].filter(function(e){return e.id!==t})}),this},e.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},e.prototype.resize=function(t){void 0===t&&(t={}),this.renderTo(this._target,t)},e.prototype.select=function(t){return this._nodes.filter(t)},e.prototype.traverseSpec=function(t,e){var n=function(t,e,r,i){e(t,r,i),t.frames?t.frames.forEach(function(r){(r.units||[]).map(function(i){return n(i,e,t,r)})}):(t.units||[]).map(function(r){return n(r,e,t,null)})};n(t.unit,e,null,null)},e.prototype.getSpec=function(){return this._liveSpec},e.prototype.getLayout=function(){return this._layout},e.prototype._displayTimeoutWarning=function(t){var e=this,n=t.proceed,r=t.cancel,i=t.timeout,a=Math.round(100/3/1.5),o=function(t){return Math.round(100/3/1.5*t)};this._layout.content.style.height="100%",this._layout.content.insertAdjacentHTML("beforeend",'\n
\n \n \n Rendering took more than '+Math.round(i)/1e3+'s\n Would you like to continue?\n \n \n Continue\n \n \n Cancel\n \n \n
\n '),this._layout.content.querySelector("."+Xe+"rendering-timeout-continue-btn").addEventListener("click",function(){e._clearTimeoutWarning(),n.call(e)}),this._layout.content.querySelector("."+Xe+"rendering-timeout-cancel-btn").addEventListener("click",function(){e._clearTimeoutWarning(),r.call(e)})},e.prototype._clearTimeoutWarning=function(){var t=ar(this._layout.content,"."+Xe+"rendering-timeout-warning");t&&(this._layout.content.removeChild(t),this._layout.content.style.height="")},e}(h),sr={},ur={},lr=function(t){var e="Chart type "+t+" is not supported.";throw console.log(e),console.log("Use one of "+Object.keys(sr).join(", ")+"."),new w(e,E.NOT_SUPPORTED_TYPE_CHART)},cr={validate:function(t,e){return ur.hasOwnProperty(t)||lr(t),ur[t].reduce(function(t,n){return t.concat(n(e)||[])},[])},get:function(t){var e=sr[t];return"function"!=typeof e&&lr(t),e},add:function(t,e,n){return void 0===n&&(n=[]),sr[t]=e,ur[t]=n,cr},getAllRegisteredTypes:function(){return sr}},fr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dr=function(t){function e(n){var r=t.call(this,n)||this;return n.autoResize&&e.winAware.push(r),r}return fr(e,t),e.prototype.applyConfig=function(e){var n=cr.validate(e.type,e);if(n.length>0)throw new Error(n[0]);var r=cr.get(e.type);(e=Qt(e,{autoResize:!0})).settings=or.setupSettings(e.settings),e.dimensions=or.setupMetaInfo(e.dimensions,e.data),t.prototype.applyConfig.call(this,r(e))},e.prototype.destroy=function(){var n=e.winAware.indexOf(this);-1!==n&&e.winAware.splice(n,1),t.prototype.destroy.call(this)},e}(or);function hr(t){return t}dr.winAware=[],dr.resizeOnWindowEvent=function(){var t;function e(){t=0;for(var e=0,n=dr.winAware.length;ex&&x>2&&b.length>2;)b=n.ticks(--x)}else b=n.domain();r.hideTicks&&(b=c?b.filter(function(t){return 0==t}):[]);var _=null==s?n.tickFormat?n.tickFormat(o):hr:s,w=Math.max(u,0)+l,E=n.range(),S=E[0]+.5,M=E[E.length-1]+.5,T=(n.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return t(n)+e}}:hr)(n);if(r.facetAxis){var C=T;T=function(t){return C(t)-n.stepSize(t)/2}}var k,A=a.selection?a:null,O=A?A.selection():a,P=function(t){for(var e=t.node();e&&"svg"!==e.tagName;)e=e.parentNode;return e}(O).getBoundingClientRect();function L(t){var n=Wt(r.rotate);if(t.attr("transform",Le(n)),Math.abs(n/90)%2>0){var i=n<180?1:-1,a=h?.5:-2,o=e===yr.top||e===yr.left?-1:1,s=a*(e===yr.top||e===yr.bottom?o<0?0:.71:.32);t.attr("x",9*i).attr("y",0).attr("dx",h?null:s+"em").attr("dy",s+"em")}}function N(t,e){void 0===e&&(e=0);var i=function(t){return Math.max(n.stepSize(t),r.tickFormatWordWrapLimit,e)};r.tickFormatWordWrap?et(t,i,r.tickFormatWordWrapLines,r.tickFontHeight,!h):tt(t,i)}function R(t){!function(t,e){var n=e?-10:20,r=e?0:1,i=e?1:-1,a=[];t.each(function(){var t=Q.select(this),e=t.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],n=i*parseFloat(e),o=t.select("text"),s=o.node().getBBox().width/2,u=n-s,l=n+s;a.push({c:n,s:u,e:l,l:0,textRef:o,tickRef:t})});var o,s=a.sort(function(t,e){return t.c-e.c});o=function(t,r,i){var a,o,s,u=t.e>r.s,l=i.s1&&(f=f.replace(/([\.]*$)/gi,"")+"...");var d=11*r.l,h=e?parseFloat(r.textRef.attr("y"))+d:0,p=e?0:d,g=e?d:0,m=function(t){var e=0;if(!t)return e;var n=t.indexOf("rotate(");if(n>=0){var r=t.indexOf(")",n+7),i=t.substring(n+7,r);e=parseFloat(i.trim())}return e}(r.textRef.attr("transform"));r.textRef.text(function(t,e){return 0===e?f:""}).attr("transform","translate("+p+","+g+") rotate("+m+")");var y={x1:0,x2:0,y1:h+(e?-1:5),y2:n};e||(y.transform="rotate(-90)"),Me(r.tickRef,"line.label-ref").call(ct(y))}else r.tickRef.selectAll("line.label-ref").remove();return r},s.map(function(t,e,n){return o(n[e-1]||{e:-1/0,s:-1/0,l:0},t,n[e+1]||{e:1/0,s:1/0,l:0})})}(t,h)}O.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===yr.right?"start":e===yr.left?"end":"middle"),c||(k=r.hideTicks||r.hide?[]:[null],ce(O.selectAll(".domain").data(k)).then(function(t){return A&&t.exit().transition(A).attr("opacity",0).remove(),t.merge(t.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000"))}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr("d",e===yr.left||e==yr.right?"M"+p*u+","+S+"H0.5V"+M+"H"+p*u:"M"+S+","+p*u+"V0.5H"+M+"V"+p*u)}));var F=ce(O.selectAll(".tick").data(b,function(t){return String(n(t))}).order()).then(function(t){var e=t.exit(),n=t.enter().append("g").attr("class","tick");return{tickExit:e,tickEnter:n,tick:t.merge(n)}}).then(function(t){if(f){var e=n.ticks(),r=n.domain(),i=b.length-1,a=e.length>1&&r[0]*r[1]<0&&-r[0]>(e[1]-e[0])/2&&r[1]>(e[i]-e[i-1])/2;t.tick.classed("zero-tick",function(t){return 0==t&&a})}return t}).result();!function(t){ce(t).then(function(t){var e=t.tickEnter,n=t.tickExit,r=t.tick;return A?(e.attr("opacity",pr).attr("transform",function(t){var e=T(t);return y(e)}),{tick:r.transition(A),tickExit:n.transition(A).attr("opacity",pr).attr("transform",function(t){var e=T(t);return isFinite(e)?y(e):this.getAttribute("transform")})}):{tick:r,tickExit:n}}).then(function(t){var e=t.tick;t.tickExit.remove(),e.attr("opacity",1).attr("transform",function(t){return y(T(t))})})}(F),r.facetAxis||function(t){var e=p*u,r=d?function(t){return v*n.stepSize(t)/2}:null;ce(t).then(function(t){var n=t.tick,i=t.tickEnter,a=n.select("line"),o=i.append("line").attr("stroke","#000").attr(m+"2",e);return d&&o.attr(g+"1",r).attr(g+"2",r),a.merge(o)}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(m+"2",e),d&&t.attr(g+"1",r).attr(g+"2",r)})}(F),d&&c&&d&&b&&b.length&&ce(O.selectAll(".extra-tick-line").data([null])).then(function(t){return t.merge(t.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(g+"1",S).attr(g+"2",S).attr(m+"1",0).attr(m+"2",p*u)}),c||(function(i){var a=r.textAnchor,o=p*w,s=e===yr.top?"0em":e===yr.bottom?"0.71em":"0.32em";function u(e){if(r.facetAxis)return e.attr("dx",18-t.position[0]).attr("dy",16)}ce(i).then(function(t){var e=t.tick,n=t.tickEnter,r=e.select("text"),i=n.append("text").attr("fill","#000").attr(m,o).attr("dy",s);return L(i),u(i),r.merge(i)}).then(function(t){if(t.text(_).attr("text-anchor",a),!1===h&&!0===r.facetAxis){var e=Re(O.node().parentNode.getAttribute("transform"));N(t,P.width-Math.abs(e.x))}else N(t);return h&&"time"===n.scaleType&&function(t){if(!(b.length<2)){var e=0,n=-1,r=t.nodes();r.forEach(function(t,r){var i=t.textContent||"",a=i.length;a>e&&(e=a,n=r)});var i=T(b[1])-T(b[0]),a=!1;if(n>=0){var o=r[n].getBoundingClientRect();a=i-o.width<8}O.classed(Xe+"time-axis-overflow",a)}}(t),!h||"time"!==n.scaleType&&"linear"!==n.scaleType||function(t){if(0!==b.length){var e=b[0],n=b[b.length-1],r=O.append("line").attr("x1",T(e)).attr("x2",T(e)).attr("y1",0).attr("y2",1),i=O.append("line").attr("x1",T(n)).attr("x2",T(n)).attr("y1",0).attr("y2",1),a={left:r.node().getBoundingClientRect().left-P.left,right:P.right-i.node().getBoundingClientRect().right};r.remove(),i.remove();var o=function(t,e,n){var r=t.getBoundingClientRect(),i=e>0?"right":"left",o=(T(n),a[i]),s=Math.ceil(r.width/2-o+1);t.setAttribute("dx",String(s>0?-e*s:0))},s=t.filter(function(t){return t===e}).node(),u=t.filter(function(t){return t===n}).node();t.attr("dx",null),o(s,-1,e),o(u,1,n)}}(t),t}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(m,o),L(t),u(t),d&&r.avoidCollisions&&!r.facetAxis&&(A?A.on("end.fixTickTextCollision",function(){return R(i.tick)}):R(i.tick))})}(F),i.hide||function(){var t=i,e=Me(O,"text.label").attr("class",Ae("label",t.cssClass)).attr("transform",Le(t.rotate)).attr("text-anchor",t.textAnchor);ce(e).then(function(t){return A?t.transition(A):t}).then(function(e){var n=v*t.padding,r=Math.abs(M-S),i=h?r:0;e.attr("x",i).attr("y",n).attr("text-anchor","end")});for(var n=t.text.split(" → "),r=n.length-1;r>0;r--)n.splice(r,0," → ");e.selectAll("tspan").data(n).enter().append("tspan").attr("class",function(t,e){return e%2?"label-token-delimiter label-token-delimiter-"+e:"label-token label-token-"+e}).text(function(t){return t}).exit().remove()}())}}function br(t){return vr({scale:t.scale,scaleGuide:t.scaleGuide,ticksCount:t.ticksCount,tickSize:t.tickSize,gridOnly:!0,position:t.position})}var xr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_r=Me,wr=function(t){var e=t<=20?1:.75;return Math.max(2,Math.round(t*e))},Er=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Qt(n.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),n.config.guide.x=n.config.guide.x||{},n.config.guide.x=Qt(n.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.x.label&&(n.config.guide.x.label={text:n.config.guide.x.label}),n.config.guide.x.label=Qt(n.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),n.config.guide.y=n.config.guide.y||{},n.config.guide.y=Qt(n.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.y.label&&(n.config.guide.y.label={text:n.config.guide.y.label}),n.config.guide.y.label=Qt(n.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var r=n.config,i=r.guide;if("extract-axes"===i.autoLayout){var a=r.options.containerHeight-(r.options.top+r.options.height);i.x.hide=i.x.hide||Math.floor(a)>0,i.y.hide=i.y.hide||Math.floor(r.options.left)>0}var o=n.config.options,s=n.config.guide.padding;return n.L=o.left+s.l,n.T=o.top+s.t,n.W=o.width-(s.l+s.r),n.H=o.height-(s.t+s.b),n}return xr(e,t),e.prototype.defineGrammarModel=function(t){var e=this.W,n=this.H;return this.xScale=t("pos",this.config.x,[0,e]),this.yScale=t("pos",this.config.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n]:[n,0]}),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:function(){return e/2},yi:function(){return n/2},sizeX:function(){return e},sizeY:function(){return n}}},e.prototype.getGrammarRules=function(){return[function(t){var e=t.scaleX,n=t.scaleY;return{xi:function(n){return n?e(n[e.dim]):t.xi(n)},yi:function(e){return e?n(e[n.dim]):t.yi(e)},sizeX:function(n){return n?e.stepSize(n[e.dim]):t.sizeX(n)},sizeY:function(e){return e?n.stepSize(e[n.dim]):t.sizeY(e)}}}]},e.prototype.createScreenModel=function(t){return t},e.prototype.allocateRect=function(t){var e=this,n=this.screenModel;return{slot:function(t){return e.config.options.container.selectAll(".uid_"+t)},left:n.xi(t)-n.sizeX(t)/2,top:n.yi(t)-n.sizeY(t)/2,width:n.sizeX(t),height:n.sizeY(t),containerWidth:this.W,containerHeight:this.H}},e.prototype.drawFrames=function(t){var e=Object.assign({},this.config),n=e.options,r=this.W,i=this.H;if(e.x=this.xScale,e.y=this.yScale,e.x.scaleObj=this.xScale,e.y.scaleObj=this.yScale,e.x.guide=e.guide.x,e.y.guide=e.guide.y,e.x.guide.label.size=r,e.y.guide.label.size=i,(n.container.attr("transform")?nt(n.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):n.container).attr("transform",Pe(this.L,this.T)),e.x.guide.hide)this._removeDimAxis(n.container,e.x);else{var a="top"===e.x.guide.scaleOrient?[0,0-e.guide.x.padding]:[0,i+e.guide.x.padding];this._drawDimAxis(n.container,e.x,a,r)}if(e.y.guide.hide)this._removeDimAxis(n.container,e.y);else{var o="right"===e.y.guide.scaleOrient?[r+e.guide.y.padding,0]:[0-e.guide.y.padding,0];this._drawDimAxis(n.container,e.y,o,i)}var s=t.reduce(function(t,e){return t.concat((e.units||[]).map(function(t){return t.uid}))},[]),u=this._drawGrid(n.container,e,r,i,n),l=ut(u,".cell").data(s,function(t){return t});l.enter().append("g").attr("class",function(t){return Xe+"cell cell uid_"+t}).merge(l).classed("tau-active",!0),nt(l,this.config.guide.animationSpeed).attr("opacity",1),nt(l.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()},e.prototype._drawDimAxis=function(t,e,n,r){var i=Mn.get(e.guide.tickFormat,e.guide.tickFormatNullAlias),o=vr({scale:e.scaleObj,scaleGuide:e.guide,ticksCount:i?wr(r/e.guide.density):null,tickFormat:i||null,position:n}),s=this.config.guide.animationSpeed;_r(t,this._getAxisSelector(e)).classed("tau-active",!0).classed(e.guide.cssClass,!0).call(function(t){var e=nt(t,s,"axisTransition"),r=t.attr("transform");Pe.apply(a,n)!==r&&(r?e:t).attr("transform",Pe.apply(a,n)),e.call(o),e.attr("opacity",1)})},e.prototype._removeDimAxis=function(t,e){var n=ut(t,this._getAxisSelector(e)).classed("tau-active",!1);nt(n,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()},e.prototype._getAxisSelector=function(t){return"g."+("h"===Ne(t.guide.scaleOrient)?"x":"y")+".axis"},e.prototype._drawGrid=function(t,e,n,r){var i=this;return _r(t,"g.grid").attr("transform",Pe(0,0)).call(function(t){var a=t,o=i.config.guide.animationSpeed,s=(e.guide.showGridLines||"").toLowerCase();if(s.length>0){var u=_r(a,"g.grid-lines");if(s.indexOf("x")>-1){var l=e.x,c=Mn.get(l.guide.tickFormat),f=br({scale:l.scaleObj,scaleGuide:l.guide,tickSize:r,ticksCount:c?wr(n/l.guide.density):null}),d=_r(u,"g.grid-lines-x");nt(d,o).call(f)}if(s.indexOf("y")>-1){var h=e.y,p=(c=Mn.get(h.guide.tickFormat),br({scale:h.scaleObj,scaleGuide:h.guide,tickSize:-n,ticksCount:c?wr(r/h.guide.density):null})),g=_r(u,"g.grid-lines-y");nt(g,o).call(p)}}})},e}(m),Sr=n(11),Mr=n(8),Tr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Cr=function(){return(Cr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n})}else{var a=n[t].map(r[t].invert);e=[a[0],a[1]]}return{dim:r[t].dim,func:r[t].discrete?"inset":"between",args:e}});e.fire("brush",s)}};return t.selectAll(".brush").remove(),t.append("g").attr("class","brush").each(function(t){var e=r[t].range();i[t]=kr.brushY().extent([[0,e[0]],[16,e[1]]]).on("start",s).on("brush",l).on("end",u),kr.select(this).classed("brush-"+Ft(t),!0).call(i[t]),a=!1,i[t].move(kr.select(this),e),a=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),t},e.prototype._forceBrushing=function(t){void 0===t&&(t={});var e=this.columnsBrushes,n=this.columnsScalesMap;this.columnsSelections;Object.keys(t).filter(function(r){return e[r]&&n[r]&&t[r]}).forEach(function(r){var i=t[r],a=[];if(n[r].discrete){var o=i.map(n[r]).filter(function(t){return t>=0}),s=n[r].stepSize()/2;a=[Math.min.apply(Math,o)-s,Math.max.apply(Math,o)+s]}else a=[i[0],i[1]];var u=Ft(r);e[r](kr.select(".brush-"+u)),e[r].move(kr.select(".brush-"+u),a.map(n[r]))})},e}(m),Or=n(12);var Pr=n(4),Lr=function(){var t,e=[],n=[],r=1,i=1,a={},o=!1,s=function(t){var r=e.length,i=0,a=e[t].x-n[t].x,o=n[t].y-e[t].y,s=Math.sqrt(a*a+o*o);s>0&&(i+=.2*s),o/=s,i+=(a/=s)>0&&o>0?0:a<0&&o>0?3:a<0&&o<0?6:9;for(var u,l,f,d,h=e[t].x,p=e[t].y-e[t].height+2,g=e[t].x+e[t].width,m=e[t].y+2,y=0;yr&&(e[l].x=c),e[l].x<0&&(e[l].x=c),e[l].y>i&&(e[l].y=f),e[l].y<0&&(e[l].y=f);var d=(o?t(l,e,n):s(l))-u;Math.random()r&&(e[l].x=c),e[l].x<0&&(e[l].x=c),e[l].y>i&&(e[l].y=f),e[l].y<0&&(e[l].y=f);var y=(o?t(l,e,n):s(l))-u;Math.random()1||l<0||l>1)},f=function(t,e,n){return t-e/n};return a.start=function(t){for(var n=e.length,r=1,i=0;i=200&&r.status<300){var t=r.responseText;try{n(null,JSON.parse(t))}catch(t){n(t,null)}}else n(new Error(r.status+": "+r.statusText),null)},r.onerror=function(t){n(t.error,null)},r.open("GET",e,!0),r.send(null)):this._drawMap(t,a.sourcemap)},e.prototype._calcLabels=function(t,e,n){var r=this.W,i=this.H,a={};return e.forEach(function(e){var o=(Pr.feature(t,t.objects[e]).features||[]).map(function(t){var i=t.properties||{},a=n.centroid(t),o=n.bounds(t),s=a[0],u=a[1],l=o[1][0]-o[0][0],c=i.name||"",f=i.abbr||c,d=l<5.5*c.length?f:c,h=l<13.75,p=h?r-s-16.5:0;return{id:e+"-"+t.id,sx:s,sy:u,x:s+p,y:u,width:5.5*d.length,height:10,name:d,r:p,isRef:h}}).filter(function(t){return!Number.isNaN(t.x)&&!Number.isNaN(t.y)}),s=o.map(function(t){return{x:t.sx,y:t.sy,r:t.r}});Lr().label(o).anchor(s).width(r).height(i).start(10),o.filter(function(t){return!t.isRef}).map(function(t){return t.x=t.sx,t.y=t.sy,t}).reduce(function(t,e){return t[e.id]=e,t},a);var u=o.filter(function(t){return t.isRef});u.length<6&&u.reduce(function(t,e){return t[e.id]=e,t},a)}),a},e.prototype._drawMap=function(t,e){var n,r,i=this,a=this,s=this.config.guide,u=this.config.options,l=this.config.options.container,c=this.latScale,f=this.lonScale,d=this.sizeScale,h=this.colorScale,p=this.codeScale,g=this.fillScale,m=this.W,y=this.H,v=Dr.filter(function(t){return(e.objects||{}).hasOwnProperty(t)});if(0===v.length)throw new Error("Invalid map: should contain some contours");if(g.dim){if(!p.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===v.indexOf(p.georole))throw console.log('There is no contour for georole "'+p.georole+'"'),console.log("Available contours are: "+v.join(" | ")),new Error("Invalid [georole]");n=p.georole}else n=v[v.length-1];if(this.contourToFill=n,c.dim&&f.dim){var b=Fr.extent(c.domain()),x=Fr.extent(f.domain());r=[(x[1]+x[0])/2,(b[1]+b[0])/2]}var _=this._createProjection(e,v[0],r),w=Fr.geoPath().projection(_),E=l.selectAll(".map-container").data([""+m+y+r+v.join("-")],function(t){return t});E.exit().remove();var S=E.enter().append("g").call(function(t){var n=t;n.attr("class","map-container");var r={},i=v.reduceRight(function(t,e){return t.concat(e)},[]);if(s.showNames&&(r=a._calcLabels(e,i,w)),i.forEach(function(t,i){var a=function(e){return r[t+"-"+e.id]};n.selectAll(".map-contour-"+t).data(Pr.feature(e,e.objects[t]).features||[]).enter().append("g").call(function(e){var n=e;n.attr("class","map-contour-"+t+" map-contour-level map-contour-level-"+i).attr("fill","none"),n.append("title").text(function(t){return(t.properties||{}).name}),n.append("path").attr("d",w),n.append("text").attr("class","place-label-"+t).attr("transform",function(t){var e=a(t);return e?"translate("+[e.x,e.y]+")":""}).text(function(t){var e=a(t);return e?e.name:""}),n.append("line").attr("class","place-label-link-"+t).attr("stroke","gray").attr("stroke-width",.25).attr("x1",function(t){var e=a(t);return e&&e.isRef?e.sx:0}).attr("y1",function(t){var e=a(t);return e&&e.isRef?e.sy:0}).attr("x2",function(t){var e=a(t);return e&&e.isRef?e.x-.6*e.name.length*5.5:0}).attr("y2",function(t){var e=a(t);return e&&e.isRef?e.y-3.5:0})})}),e.objects.hasOwnProperty("places")){var o=Pr.feature(e,e.objects.places),u=o.features.map(function(t){var e=_(t.geometry.coordinates);return{x:e[0]+3.5,y:e[1]+3.5,width:5.5*t.properties.name.length,height:12,name:t.properties.name}}),l=o.features.map(function(t){var e=_(t.geometry.coordinates);return{x:e[0],y:e[1],r:2.5}});Lr().label(u).anchor(l).width(m).height(y).start(100),n.selectAll(".place").data(l).enter().append("circle").attr("class","place").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("r",function(t){return t.r+"px"}),n.selectAll(".place-label").data(u).enter().append("text").attr("class","place-label").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).text(function(t){return t.name})}}).merge(E);this.groupByCode=t.reduce(function(t,e){return e.part().reduce(function(t,e){return t[(e[p.dim]||"").toLowerCase()]=e,t},t)},{});var M=this._resolveFeature.bind(this);if(S.selectAll(".map-contour-"+n).data(Pr.feature(e,e.objects[n]).features).call(function(t){t.classed("map-contour",!0).attr("fill",function(t){var e=M(t);return null===e?s.defaultFill:g(e[g.dim])})}).on("mouseover",function(t){return i.fire("area-mouseover",{data:M(t),event:o.event})}).on("mouseout",function(t){return i.fire("area-mouseout",{data:M(t),event:o.event})}).on("click",function(t){return i.fire("area-click",{data:M(t),event:o.event})}),!c.dim||!f.dim)return[];var T=function(t){return t.attr("r",function(t){return d(t[d.dim])}).attr("transform",function(t){var e=t.data;return"translate("+_([e[f.dim],e[c.dim]])+")"}).attr("class",function(t){var e=t.data;return h(e[h.dim])}).attr("opacity",.5).on("mouseover",function(t){var e=t.data;return a.fire("point-mouseover",{data:e,event:o.event})}).on("mouseout",function(t){var e=t.data;return a.fire("point-mouseout",{data:e,event:o.event})}).on("click",function(t){var e=t.data;return a.fire("point-click",{data:e,event:o.event})})},C=S.selectAll(".frame").data(t.map(function(t){return{tags:t.key||{},hash:t.hash(),data:t.part()}}),function(t){return t.hash});return C.exit().remove(),C.enter().append("g").merge(C).call(function(t){t.attr("class",function(t){return"frame frame-"+t.hash}).call(function(t){var e=t.selectAll("circle").data(function(t){return t.data.map(function(t){return{data:t,uid:u.uid}})});e.exit().remove(),e.call(T),e.enter().append("circle").call(T)})}),[]},e.prototype._resolveFeature=function(t){var e,n=this.groupByCode,r=t.properties,i=["c1","c2","c3","abbr","name"].filter(function(t){return r.hasOwnProperty(t)&&r[t]&&n.hasOwnProperty(r[t].toLowerCase())});if(0===i.length)e=null;else if(i.length>0){var a=r[i[0]].toLowerCase();e=n[a]}return e},e.prototype._highlightArea=function(t){var e=this,n=this.config.options.container,r=this.contourToFill;n.selectAll(".map-contour-"+r).classed("map-contour-highlighted",function(n){return t(e._resolveFeature(n))})},e.prototype._highlightPoint=function(t){this.config.options.container.selectAll("circle").classed("map-point-highlighted",function(e){var n=e.data;return t(n)}).attr("opacity",function(e){var n=e.data;return t(n)?.5:.1})},e.prototype._createProjection=function(t,e,n){var r=this.W,i=this.H,a=this.config.guide,o=100,s=[r/2,i/2],u=n||t.center,l=a.projection||t.projection||"mercator",c=this._createD3Projection(l,u,o,s),f=Fr.geoPath().projection(c).bounds(Pr.feature(t,t.objects[e])),d=o*r/(f[1][0]-f[0][0]),h=o*i/(f[1][1]-f[0][1]);return o=d=0},Ur=function(t,e){return!t.discrete&&e[t.dim]<0},Xr=function(t,e){return t.w(e)/2+Math.floor(t.model.size(e)/Wr(t,e))},qr=function(t,e){return t.h(e)/2+Math.floor(t.model.size(e)/Wr(t,e))},Yr=function(t){return function(e){return{dx:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Gr(r,n))return e.dx(n);if("-"===t[2]&&!Ur(r,n))return e.dx(n);var i=t[1],a=t[0]===t[0].toUpperCase()?1:0;return e.dx(n)+i*a*e.model.size(n)/2+i*Xr(e,n)}}}},$r=function(t){return function(e){return{dy:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Gr(r,n))return e.dy(n);if("-"===t[2]&&!Ur(r,n))return e.dy(n);var i=t[1],a=t[0]===t[0].toUpperCase()?1:0;return e.dy(n)+i*a*e.model.size(n)/2+i*qr(e,n)}}}};Vr.regRule("l",Yr(["l",-1,null])).regRule("L",Yr(["L",-1,null])).regRule("l+",Yr(["l",-1,"+"])).regRule("l-",Yr(["l",-1,"-"])).regRule("L+",Yr(["L",-1,"+"])).regRule("L-",Yr(["L",-1,"-"])).regRule("r",Yr(["r",1,null])).regRule("R",Yr(["R",1,null])).regRule("r+",Yr(["r",1,"+"])).regRule("r-",Yr(["r",1,"-"])).regRule("R+",Yr(["R",1,"+"])).regRule("R-",Yr(["R",1,"-"])).regRule("t",$r(["t",-1,null])).regRule("T",$r(["T",-1,null])).regRule("t+",$r(["t",-1,"+"])).regRule("t-",$r(["t",-1,"-"])).regRule("T+",$r(["T",-1,"+"])).regRule("T-",$r(["T",-1,"-"])).regRule("b",$r(["b",1,null])).regRule("B",$r(["B",1,null])).regRule("b+",$r(["b",1,"+"])).regRule("b-",$r(["b",1,"-"])).regRule("B+",$r(["B",1,"+"])).regRule("B-",$r(["B",1,"-"])).regRule("rotate-on-size-overflow",function(t,e){var n=e.data,r=e.lineBreakAvailable,i={};if(n.reduce(function(e,n){return e+(function(e){return t.model.size(e).5){var a=r?-.5:.5;i={angle:function(){return-90},w:function(e){return t.h(e)},h:function(e){return t.w(e)},dx:function(e){return t.h(e)*a-2},dy:function(){return 0}}}return i}).regRule("hide-by-label-height-vertical",function(t){return{hide:function(e){var n,r;return 0===t.angle(e)?(r=t.h(e),n=Math.abs(t.model.y0(e)-t.model.yi(e))):(r=t.w(e),n=t.model.size(e)),r>n||t.hide(e)}}}).regRule("cut-label-vertical",function(t){return{h:function(e){var n=t.h(e);if(Math.abs(t.angle(e))>0){var r=Math.abs(t.model.y0(e)-t.model.yi(e));return r0){var i=t.model.y0(e)=0?1:-1}(t,n)*e(t,n)};return t.model.flip?{dx:n}:{dy:n}}).regRule("inside-start-then-outside-end-horizontal",function(t,e){var n=[Vr.getRule("from-beginning"),Vr.getRule("towards"),Vr.getRule("cut-label-horizontal")].reduce(function(t,n){return zr.compose(t,n(t,e))},t),r=[Vr.getRule("to-end"),Vr.getRule("towards"),Vr.getRule("cut-outer-label-horizontal")].reduce(function(t,n){return zr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("inside-start-then-outside-end-vertical",function(t,e){var n=[Vr.getRule("from-beginning"),Vr.getRule("towards"),Vr.getRule("cut-label-vertical")].reduce(function(t,n){return zr.compose(t,n(t,e))},t),r=[Vr.getRule("to-end"),Vr.getRule("towards"),Vr.getRule("cut-outer-label-vertical")].reduce(function(t,n){return zr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("outside-then-inside-horizontal",function(t,e){var n=["r+","l-","cut-outer-label-horizontal"].map(Vr.getRule).reduce(function(t,n){return zr.compose(t,n(t,e))},t),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(Vr.getRule).reduce(function(t,n){return zr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return r.label(t).length>n.label(t).length}(t)?r:n)[e](t)},t},{}))}).regRule("outside-then-inside-vertical",function(t,e){var n=["t+","b-","cut-outer-label-vertical"].map(Vr.getRule).reduce(function(t,n){return zr.compose(t,n(t,e))},t),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(Vr.getRule).reduce(function(t,n){return zr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,i){return t[i]=function(t){return(function(t){var r=n.y(t,e)+n.dy(t,e);return r<=0||r>=e.maxHeight}(t)?r:n)[i](t,e)},t},{}))}).regRule("hide-by-label-height-horizontal",function(t){return{hide:function(e){return t.model.size(e)0)return r+o;var s=i+a/2-n;return s>0?r-s:r},dy:function(e){var n=t.dy(e),i=t.y(e)+n,a=t.h(e);if(0-(i-a/2)>0)return 0;var o=i+a/2-r;return o>0?n-o:n}}}).regRule("multiline-label-left-align",function(t){return{dy:function(e){var n=t.dy(e);return-90===t.angle(e)?n+t.h(e)/2:n}}}).regRule("multiline-label-vertical-center-align",function(t){return{dy:function(e){return t.dy(e)-t.h(e)/2}}}).regRule("multiline-hide-on-container-overflow",function(t,e){var n=e.maxWidth,r=e.maxHeight;return{hide:function(e){var i=t.angle(e),a=t.x(e)+t.dx(e),o=t.y(e)+t.dy(e);return!(!Ut(a,t.w(e),i,n)&&!Xt(o,t.h(e),i,r))||t.hide(e)}}});var Kr=function(){function t(t){this.minError=Number.MAX_VALUE,this.items=t.items,this.revision=this.items.map(function(t){return{i:t.i,x:t.x,y:t.y}}),this.penalties=t.penalties,this.transactor=t.transactor,this.cooling_schedule=t.cooling_schedule||function(t,e,n){return t-e/n}}return t.prototype.energy=function(t){return this.penalties.reduce(function(e,n){return e+n(t)},0)},t.prototype.move=function(t){var e=Math.floor(Math.random()*this.items.length),n=this.transactor(this.items[e]),r=this.energy(e);this.items[e]=n.modify();var i=this.energy(e),a=i-r,o=a<0?1:Math.exp(-a/t);Math.random()>=o?this.items[e]=n.revert():i0&&d.length>0?this.autoPosition(c,d):c;var h=f.reduce(function(t,e){var n;return Object.assign(t,((n={})[e]=!0,n))},{});c.text=c.text=h["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(c.text,u):c.text,c.text=c.text=h["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(c.text,u):c.text,c.text=h["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(c.text,c.edges):c.text,c.text=h["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(c.text):c.text,c.text=h["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(c.text):c.text;var p=c.text,g=function(t){return function(e,n){return p[n][t]}},m=g("x"),y=g("y"),v=g("angle"),b=g("color"),x=g("label"),_=function(t){if(t.style("fill",b).style("font-size",e.guide.fontSize+"px").style("display",function(t,e){return p[e].hide?"none":null}).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",function(t,e){return"translate("+m(t,e)+","+y(t,e)+") rotate("+v(t,e)+")"}),i){t.each(function(t,e){var n=o.select(this),r=v(t,e);n.text(null),x(t,e).split(a).forEach(function(t,e){n.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(e+1)+"em").text(t)})})}else t.text(x)};r.hideEqualLabels&&p.filter(function(t){return!t.hide}).filter(function(t,e,n){return e0&&(t.hide=!0)}),t},t.prototype.hideOnLabelLabelOverlap=function(t){var e=this,n={min:0,max:1,norm:2},r={"min/min":function(t,e){return e.y-t.y},"max/max":function(t,e){return t.y-e.y},"min/max":function(){return-1},"min/norm":function(){return-1},"max/norm":function(){return-1},"norm/norm":function(t,e){return t.y-e.y}};return t.filter(function(t){return!t.hide}).sort(function(t,e){return n[t.extr]-n[e.extr]}).forEach(function(i){t.forEach(function(t){i.i!==t.i&&function(t,i){var a=e.getLabelRect(t),o=e.getLabelRect(i),s=Number(!t.hide&&!i.hide);if(s*Math.max(0,Math.min(o.x1,a.x1)-Math.max(a.x0,o.x0))*(s*Math.max(0,Math.min(o.y1,a.y1)-Math.max(a.y0,o.y0)))>0){var u=[t,i];u.sort(function(t,e){return n[t.extr]-n[e.extr]}),(r[u[0].extr+"/"+u[1].extr](u[0],u[1])<0?u[0]:u[1]).hide=!0}}(i,t)})}),t},t.prototype.getLabelRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.w/2-e,x1:t.x+t.w/2+e,y0:t.y-t.h/2-e,y1:t.y+t.h/2+e}},t.prototype.getPointRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.size/2-e,x1:t.x+t.size/2+e,y0:t.y-t.size/2-e,y1:t.y+t.size/2+e}},t.prototype.hideOnLabelAnchorOverlap=function(t){var e=this,n=function(t,n){var r=e.getLabelRect(t,2),i=e.getPointRect(n,2);return Math.max(0,Math.min(i.x1,r.x1)-Math.max(i.x0,r.x0))*Math.max(0,Math.min(i.y1,r.y1)-Math.max(i.y0,r.y0))>.001};return t.filter(function(t){return!t.hide}).forEach(function(e){for(var r=t.length,i=0;ir.right+u||sr.bottom+u)return null;var l=(i.find(o,s)||[]).map(function(t){var e=Math.sqrt(Math.pow(o-t.x,2)+Math.pow(s-t.y,2));if(e>u)return null;var n=ee.size)+" 1",n.left[0].x+","+n.left[0].y,"Z"].join(" "):di(t.size>e.size?t:e)}function pi(t,e,n,r){var i=function(t,e,n,r){var i=yi(t,r);if(0===i||i+t.size/2<=r.size/2||i+r.size/2<=t.size/2)return null;var a=function(i){var a=i?[r,n,e,t]:[t,e,n,r],o=bi.apply(void 0,[1/12*2].concat(a)),s=bi.apply(void 0,[.5].concat(o.slice(0,4))),u=s[3],l=s[6],c=_i(a[0],u),f=_i(u,l),d=[c.left[0],A(.5,c.left[1],f.left[0]),f.left[1]],h=[c.right[0],A(.5,c.right[1],f.right[0]),f.right[1]],p=xi.apply(void 0,d)[1],g=xi.apply(void 0,h)[1],m=A(4,c.left[0],p),y=A(4,c.right[0],g);return{left:i?[y,h[0]]:[d[0],m],right:i?[m,d[0]]:[h[0],y]}},o=a(!1),s=a(!0);return{left:o.left.concat(s.left),right:o.right.concat(s.right)}}(t,e,n,r);if(!i)return hi(t,r);var a=mi(gi(t,i.right[0]),gi(t,i.left[0])),o=mi(gi(r,i.right[1]),gi(r,i.left[1]));return["M"+i.left[0].x+","+i.left[0].y,"C"+i.left[1].x+","+i.left[1].y,i.left[2].x+","+i.left[2].y,i.left[3].x+","+i.left[3].y,"A"+r.size/2+","+r.size/2+" 0 "+Number(a>Math.PI)+" 1",i.right[3].x+","+i.right[3].y,"C"+i.right[2].x+","+i.right[2].y,i.right[1].x+","+i.right[1].y,i.right[0].x+","+i.right[0].y,"A"+t.size/2+","+t.size/2+" 0 "+Number(o>Math.PI)+" 1",i.left[0].x+","+i.left[0].y,"Z"].join(" ")}function gi(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function mi(t,e){return e1?[t]:[]},d);f.exit().remove(),f.call(s(n.animationSpeed,a.pathAttributesUpdateInit,a.pathAttributesUpdateDone,a.afterPathUpdate));f.enter().append(a.pathElement).call(s(n.animationSpeed,a.pathAttributesEnterInit,a.pathAttributesEnterDone,a.afterPathUpdate)).merge(f).call(function(t){e.guide.animationSpeed>0&&!document.hidden?(t.attr(a.pathTween.attr,function(t){return a.pathTween.fn.call(this,t)(0)}),nt(t,e.guide.animationSpeed,"pathTransition").attrTween(a.pathTween.attr,a.pathTween.fn)):t.attr(a.pathTween.attr,function(t){return a.pathTween.fn.call(this,t)(1)})});if(t.subscribe(c),"never"!==n.showAnchors){var h=function(t,e,n){var r=e.anchorShape,i=t.config.guide,a=t.screenModel,o=wi({},Ei[r].getInitialAttrs(t,e),{opacity:"hover"===i.showAnchors?0:1,fill:function(t){return a.color(t)},class:"i-data-anchor"}),s=n.selectAll(".i-data-anchor").data(function(t){return t.filter(ui)},a.id);return s.exit().remove(),s.call(st(i.animationSpeed,null,o)),s.enter().append(Ei[e.anchorShape].element).call(st(i.animationSpeed,{r:0},o)).merge(s)}(t,a,r);t.subscribe(h)}},l=i.toFibers(),c=l.map(function(t){return t.filter(ui)}),f=r.container.selectAll(".frame"),d=function(){var t=f.empty()?[]:f.data(),e=new Map;f.each(function(t){e.set(t,Number(this.getAttribute("data-id")))});var n=t.reduce(function(t,e){return t.set(e,e.map(i.id)),t},new Map),r=new Map,a=Math.max.apply(Math,[0].concat(Array.from(e.values())));return function(t){if(r.has(t))return r.get(t);var o,s=t.map(function(t){return i.id(t)}),u=(Array.from(n.entries()).find(function(t){var e=t[1];return s.some(function(t){return e.some(function(e){return e===t})})})||[null])[0];return o=u?e.get(u):++a,r.set(t,o),o}}();this._getDataSetId=d;var h=f.data(l,d);h.exit().remove(),h.call(u),h.enter().append("g").attr("data-id",d).call(u),h.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),t.subscribe(new ei(i.model,e.flip,e.guide.label,r).draw(c))},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=o.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n)}}).filter(function(t){return!isNaN(t.x)&&!isNaN(t.y)}),i=r.reduce(function(t,e){var n=e.x,r=e.y;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,t.top),t.bottom=Math.max(r,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=Yt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),s=a.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=a.find(n?function(e){return t.y===e}:function(e){return t.x===e});s[e].push(t)});var u=function(t){if(1===t.length)return s[t[0]];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:u(t.slice(0,e)),greater:u(t.slice(e))}};return{bounds:i,tree:u(a)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,a=this.node().config.options.container,o=this.node().config.flip,s=De(a.node()),u=this.node().config.guide.maxHighlightDistance;if(tr.right+s.x+u||er.bottom+s.y+u)return null;var l=o?e-s.y:t-s.x,c=function t(e){return Array.isArray(e)?e:t(l>e.middle?e.greater:e.lower)}(i).map(function(n){var r=n.x+s.x,i=n.y+s.y,a=Math.abs(o?e-i:t-r),u=Math.abs(o?t-r:e-i);return{node:n.node,data:n.data,distance:a,secondaryDistance:u,x:r,y:i}});return Si(t,e,c)},highlight:function(t){var e,n,r=this.node().config.options.container,i="tau-chart__highlighted",a="tau-chart__dimmed",o=r.selectAll(".i-role-path"),s=o.data().filter(function(e){return e.filter(ui).some(t)}),u=s.length>0;o.call(ft(((e={})[i]=function(t){return u&&s.indexOf(t)>=0},e[a]=function(t){return u&&s.indexOf(t)<0},e)));var l=((n={})[i]=function(e){return!0===t(e)},n[a]=function(e){return!1===t(e)},n);r.selectAll(".i-role-dot").call(ft(l)),r.selectAll(".i-role-label").call(ft(l)),this._sortElements(t)},highlightDataPoints:function(t){var e=this.node(),n=function(t,e,n){var r=e.anchorShape,i=t.screenModel,a="hover"===t.config.guide.showAnchors;return t.config.options.container.selectAll(".i-data-anchor").call(ct(Ei[r].getHighlightAttrs(t,e,n))).attr("opacity",a?function(t){return n(t)?1:0}:function(){return 1}).attr("fill",function(t){return i.color(t)}).attr("class",function(t){return Ae("i-data-anchor",i.class(t))}).classed(Xe+"highlighted",n)}(e,this.domElementModel,t),r=e.config.options.container,i=e.config.flip,a=n.filter(t),o=r.select(".cursor-line");if(a.empty())o.remove();else{o.empty()&&(o=r.append("line"));var s=e.screenModel.model,u=s.xi(a.data()[0]),l=s.xi(a.data()[0]),c=s.scaleY.domain(),f=s.scaleY(c[0]),d=s.scaleY(c[1]);o.attr("class","cursor-line").attr("x1",i?f:u).attr("y1",i?u:f).attr("x2",i?d:l).attr("y2",i?l:d)}this._sortElements(t)},_sortElements:function(t){var e=this.node().config.options.container,n=new Map,r=new Map,i=this._getDataSetId;e.selectAll(".i-role-path").each(function(e){n.set(this,i(e)),r.set(this,e.filter(ui).some(t))});var a=ee(function(t,e){return r.get(t)-r.get(e)},function(t,e){return n.get(t)-n.get(e)}),o={line:0,g:1,text:2};ke(e.node(),function(t,e){return"g"===t.tagName&&"g"===e.tagName?a(t,e):o[t.tagName]-o[e.tagName]})}},Ci=[1,2,3,4,5],ki=Ci.map(function(t){return Xe+"line-opacity-"+t}),Ai=Ci.map(function(t){return Xe+"line-width-"+t});function Oi(t){return ki[t-1]||ki[4]}function Pi(t,e){return t.length<2?"":String.prototype.concat.apply("",t.concat(e.slice().reverse()).map(function(t,e){return(0===e?"":" ")+t.x+","+t.y}))}function Li(t,e){if(t.length<2)return"";var n=function(t){var e=t.map(function(t,e){return""+((e-1)%3==0?"C":"")+t.x+","+t.y+" "});return String.prototype.concat.apply("",e)};return"M"+n(t)+"L"+n(e.slice().reverse())+"Z"}var Ni=function(){return(Ni=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&(n=Ri.rgb(n).darker(1)),n}};e.pathAttributesEnterInit=a,e.pathAttributesUpdateDone=a;var o="polyline"===K(n.interpolate);return e.pathElement=o?"polygon":"path",e.anchorShape="vertical-stick",e.pathTween={attr:o?"points":"d",fn:lt(0,o?Pi:Li,[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}},function(n){return{id:t.id(n),x:e.x0(n),y:e.y0(n)}}],t.id,n.interpolate)},e},_getBoundsInfo:function(t){if(0===t.length)return null;var e,n,r=this.node().screenModel,i=this.node().config.flip,a=t.map(function(t){var e=Ri.select(t).data()[0];return{node:t,data:e,x:r.x(e),y:r.y(e),y0:r.y0(e),group:r.group(e)}}),o=a.reduce(function(t,e){var n=e.x,r=e.y,i=e.y0;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,i,t.top),t.bottom=Math.max(r,i,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),s=Yt(a.map(i?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),u=s.reduce(function(t,e){return t[e]=[],t},{});if(a.forEach(function(t){var e=s.find(i?function(e){return t.y===e}:function(e){return t.x===e});u[e].push(t)}),e=Object.keys(a.reduce(function(t,e){return t[e.group]=!0,t},{})),n=e.reduce(function(t,e,n){return t[e]=n,t},{}),s.forEach(function(t){var r=u[t];if(r.sort(function(t,e){return n[t.group]-n[e.group]}),r.lengthr.right+s.x+u||er.bottom+s.y+u)return null;var l=o?e-s.y:t-s.x,c=function t(e){if(e.isLeaf)return e;var n=e.left.end;return t(l1&&(f=1);var d,h=(d=c.items.start.reduce(function(t,e){return t[e.group]={start:e,end:null,y:null,y0:null},t},{}),c.items.end.forEach(function(t){void 0!==d[t.group]?d[t.group].end=t:delete d[t.group]}),Object.keys(d).forEach(function(t){var e=d[t];e.end?(e.y=e.start.y+f*(e.end.y-e.start.y),e.y0=e.start.y0+f*(e.end.y0-e.start.y0)):delete d[t]}),Object.keys(d).map(function(t){return d[t]}).map(function(t){return{y:t.y,y0:t.y0,el:f<.5?t.start:t.end}}).filter(function(t){return null!=t.el.data})),p=e-s.y,g=h.filter(function(t){return p>=t.y&&p<=t.y0}),m=(g.length>0?g:h).map(function(t){return t.el}).map(function(n){var r=n.x+s.x,i=n.y+s.y,a=Math.abs(o?e-i:t-r),u=Math.abs(o?t-r:e-i);return{node:n.node,data:n.data,distance:a,secondaryDistance:u,x:r,y:i}});return Si(t,e,m)}},Di={draw:Ti.draw,getClosestElement:Ti.getClosestElement,highlight:Ti.highlight,highlightDataPoints:Ti.highlightDataPoints,addInteraction:Ti.addInteraction,_getBoundsInfo:Ti._getBoundsInfo,_sortElements:Ti._sortElements,init:function(t){var e=Ti.init(t);return e.transformRules=[e.flip&&M.get("flip")],e.adjustRules=[function(t,n){var r=t.scaleSize.isEmptyScale(),i=Qt(e.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),a=Object.assign({},n,{defMin:i.defMinSize,defMax:i.defMaxSize,minLimit:i.minSize,maxLimit:i.maxSize});return M.get("adjustStaticSizeScale")(t,a)}],e},buildModel:function(t){var e=Ti.baseModel(t),n=this.node().config.guide,r=Oi(t.model.scaleColor.domain().length),i=Xe+"area area i-role-path "+r+" "+n.cssClass+" ";e.groupAttributes={class:function(t){return i+" "+e.class(t[0])+" frame"}};var a,o,s={fill:function(t){return e.color(t[0])},stroke:function(t){return e.color(t[0])}};return e.pathAttributesEnterInit=s,e.pathAttributesUpdateDone=s,e.pathElement="polygon",e.anchorShape="circle",e.pathTween={attr:"points",fn:lt(0,(a=function(t){return t.x},o=function(t){return t.y},function(t){return t.map(function(t){return[a(t),o(t)].join(",")}).join(" ")}),[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}}],t.id)},e}};function ji(t){if(t.length<2)return"";for(var e="",n=0;n=160&&e<320?n=1:e>=320&&e<480?n=2:e>=480&&e<640?n=3:e>=640&&(n=4),Ai[n]):"",u=Oi(t.model.scaleColor.domain().length),l=o?"line":"area",c=""+Xe+l+" "+l+" i-role-path "+s+" "+u+" "+i.cssClass+" ",f=o?{stroke:function(t){return h.color(t[0])},class:"i-role-datum"}:{fill:function(t){return h.color(t[0])}},d="cubic"===K(i.interpolate)?o?Ii:fi:o?ji:ci,h=Ti.baseModel(t),p=o?function(e){return{id:t.id(e),x:h.x(e),y:h.y(e)}}:function(e){return{id:t.id(e),x:h.x(e),y:h.y(e),size:h.size(e)}};return h.groupAttributes={class:function(t){return c+" "+h.class(t[0])+" frame"}},h.pathElement="path",h.anchorShape="circle",h.pathAttributesEnterInit=f,h.pathAttributesUpdateDone=f,h.pathTween={attr:"d",fn:lt(0,d,[p],t.id,i.interpolate)},h}},Bi=function(t){return o.select(t).data()[0]},Vi={init:function(t){var e=Object.assign({},t);e.guide=e.guide||{},e.guide=Qt(e.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=e.guide.enableColorToBarPosition?e.guide.enableColorToBarPosition:!e.stack}),e.guide.size=Qt(e.guide.size||{},{enableDistributeEvenly:!0}),e.guide.label=Qt(e.guide.label||{},{position:e.flip?e.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:e.stack?["rotate-on-size-overflow","t-","b+","hide-by-label-height-vertical","cut-label-vertical","auto:hide-on-label-label-overlap"]:["rotate-on-size-overflow","outside-then-inside-vertical","auto:hide-on-label-label-overlap"]});var n=e.guide.avoidScalesOverflow,r=e.guide.enableColorToBarPosition,i=e.guide.size.enableDistributeEvenly;return e.transformRules=[e.flip&&M.get("flip"),e.guide.obsoleteVerticalStackOrder&&M.get("obsoleteVerticalStackOrder"),e.stack&&M.get("stack"),r&&M.get("positioningByColor")].filter(function(t){return t}),e.adjustRules=[i&&function(t,n){var r=Qt(e.guide.size||{},{defMinSize:e.guide.prettify?3:0,defMaxSize:e.guide.prettify?40:Number.MAX_VALUE}),i=Object.assign({},n,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return M.get("size_distribute_evenly")(t,i)},n&&i&&function(t,e){var n=Object.assign({},e,{sizeDirection:"x"});return M.get("avoidScalesOverflow")(t,n)},e.stack&&M.get("adjustYScale")].filter(function(t){return t}),e},addInteraction:function(){var t=this,e=this.node();e.on("highlight",function(e,n){return t.highlight(n)}),e.on("data-hover",function(e,n){return t.highlight((r=n.data,i=null,function(t){return t===r||i}));var r,i})},draw:function(){var t,e,n=this.node(),r=n.config,i=r.options;i.container=i.slot(r.uid);var a=r.guide.prettify,s="i-role-element i-role-datum bar "+Xe+"bar",u=n.screenModel,l=this.buildModel(u,{prettify:a,minBarH:1,minBarW:1,baseCssClass:s}),c=st,f=r.flip?"y":"x",d=r.flip?"x":"y",h=r.flip?"width":"height",p=r.flip?"height":"width",g=u.toFibers(),m=g.reduce(function(t,e){return t.concat(e)},[]),y=l.class,v=Zt(l,"class"),b=i.container.selectAll(".bar").data(m,u.id);b.exit().classed("tau-removing",!0).call(c(r.guide.animationSpeed,null,((t={})[f]=function(){var t=o.select(this);return t.attr(f)-0+(t.attr(p)-0)/2},t[d]=function(){return this.getAttribute("data-zero")},t[p]=0,t[h]=0,t),function(t){var e=o.select(t);e.classed("tau-removing")&&e.remove()})),b.call(c(r.guide.animationSpeed,null,v));var x=b.enter().append("rect").call(c(r.guide.animationSpeed,(e={},e[d]=u[d+"0"],e[h]=0,e),v)).merge(b).attr("class",y).attr("data-zero",u[d+"0"]);n.subscribe(new ei(u.model,u.model.flip,r.guide.label,i).draw(g));var _,w=(_=m.reduce(function(t,e,n){return t.set(e,n+1),t},new Map),function(t,e){return(_.get(Bi(t))||-1)-(_.get(Bi(e))||-1)});this._barsSorter=r.guide.sortByBarHeight?r.flip?function(t,e){var n=Bi(t),r=Bi(e),i=l.width(n),a=l.width(r);if(i===a){var o=l.y(n),s=l.y(r);return o===s?w(t,e):o-s}return a-i}:function(t,e){var n=Bi(t),r=Bi(e),i=l.height(n),a=l.height(r);if(i===a){var o=l.x(n),s=l.x(r);return o===s?w(t,e):o-s}return a-i}:w;var E={rect:0,text:1};this._typeSorter=function(t,e){return E[t.tagName]-E[e.tagName]},this._sortElements(this._typeSorter,this._barsSorter),n.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel:function(t,e){var n,r=e.prettify,i=e.minBarH,a=e.minBarW,o=e.baseCssClass,s=function(e){var n=t.size(e);return r&&(n=Math.max(a,n)),n},u=function(e){return e[t.model.scaleY.dim]};if(t.flip){var l=function(e){return Math.abs(t.x(e)-t.x0(e))};n={y:function(e){return t.y(e)-.5*s(e)},x:function(e){var n=Math.min(t.x0(e),t.x(e));if(r){var a=l(e),o=u(e),s=0;return 0===o&&(s=0),o>0&&(s=a),o<0&&(s=0-i),a0?n-i:n);return n},width:function(t){return s(t)},height:function(t){var e=c(t);return r&&(e=0===u(t)?e:Math.max(i,e)),e}}}return Object.assign(n,{class:function(e){return o+" "+t.class(e)},fill:function(e){return t.color(e)}})},_sortElements:function(){for(var t=[],e=0;es}}),i=r.reduce(function(t,e){var n=e.box;return t.left=Math.min(n.left,t.left),t.right=Math.max(n.right,t.right),t.top=Math.min(n.top,t.top),t.bottom=Math.max(n.bottom,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=Yt(r.map(n?function(t){return t.cy}:function(t){return t.cx})).sort(function(t,e){return t-e}),s=a.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=a.find(n?function(e){return t.cy===e}:function(e){return t.cx===e});s[e].push(t)});var u=function(t){if(1===t.length)return s[t];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:u(t.slice(0,e)),greater:u(t.slice(e))}};return{bounds:i,tree:u(a)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,a=this.node().config.options.container,o=this.node().config.flip,s=De(a.node()),u=t-s.x,l=e-s.y,c=this.node().config.guide.maxHighlightDistance;if(ur.right+c||lr.bottom+c)return null;var f=o?l:u,d=o?u:l;return function t(e){return Array.isArray(e)?e:t(f>e.middle?e.greater:e.lower)}(i).map(function(t){var e,n,r=o?t.box.left:t.box.top,i=o?t.box.right:t.box.bottom,a=(n=i,(e=d)>=r&&e<=n);if(!a&&Math.abs(d-r)>c&&Math.abs(d-i)>c)return null;var s=Math.abs(d-(t.invert!==o?i:r));return Object.assign(t,{distToValue:s,cursorInside:a})}).filter(function(t){return t}).sort(function(t,e){return t.cursorInside!==e.cursorInside?e.cursorInside-t.cursorInside:Math.abs(t.distToValue)-Math.abs(e.distToValue)}).map(function(t){var e=t.cx,n=t.cy,r=Math.abs(o?l-n:u-e),i=Math.abs(o?u-e:l-n);return{node:t.node,data:t.data,distance:r,secondaryDistance:i,x:e,y:n}})[0]||null},highlight:function(t){var e,n=this.node().config.options.container,r=((e={})["tau-chart__highlighted"]=function(e){return!0===t(e)},e["tau-chart__dimmed"]=function(e){return!1===t(e)},e);n.selectAll(".bar").call(ft(r)),n.selectAll(".i-role-label").call(ft(r)),this._sortElements(function(e,n){return t(Bi(e))-t(Bi(n))},this._typeSorter,this._barsSorter)}},Hi=n(14),Wi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gi=function(t){function e(e){var n=t.call(this,e)||this;return n.config=e,n.config.guide=Qt(n.config.guide||{},{}),n.on("highlight",function(t,e){return n.highlight(e)}),n}return Wi(e,t),e.prototype.defineGrammarModel=function(t){var e=this.config,n=e.options;this.color=t("color",e.color,{}),this.scalesMap=e.columns.reduce(function(e,r){return e[r]=t("pos",r,[0,n.height]),e},{});var r=n.width/(e.columns.length-1),i=e.columns.reduce(function(t,e,n){return t[e]=n*r,t},{});return this.xBase=function(t){return i[t]},this.regScale("columns",this.scalesMap).regScale("color",this.color),{}},e.prototype.drawFrames=function(t){var e=this.config,n=this.config.options,r=this.scalesMap,i=this.xBase,a=this.color,o=Hi.line(),s=function(t){t.attr("d",function(t){return o(e.columns.map(function(e){return[i(e),r[e](t[r[e].dim])]}))})},u=function(t){t.attr("stroke",function(t){return a.toColor(a(t[a.dim]))}),t.attr("class",function(t){return Xe+"__line line "+a.toClass(a(t[a.dim]))+" foreground"})},l=function(t){var e=t.selectAll(".background").data(function(t){return t.part()});e.exit().remove(),e.call(s),e.enter().append("path").attr("class","background line").call(s);var n=t.selectAll(".foreground").data(function(t){return t.part()});n.exit().remove(),n.call(function(t){s(t),u(t)}),n.enter().append("path").call(function(t){s(t),u(t)})},c=n.container.selectAll(".lines-frame").data(t,function(t){return t.hash()});c.exit().remove(),c.call(l),c.enter().append("g").attr("class","lines-frame").call(l),this.subscribe(n.container.selectAll(".lines-frame .foreground"))},e.prototype.highlight=function(t){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",function(e){return t(e)?"":"hidden"})},e}(m),Ui=function(){function t(t,e){var n,r=this;if(this._fields={},Array.isArray(e.fitToFrameByDims)&&e.fitToFrameByDims.length){n=t.part(function(t){var n={};return"where"===t.type&&t.args?(n.type=t.type,n.args=e.fitToFrameByDims.reduce(function(e,n){return t.args.hasOwnProperty(n)&&(e[n]=t.args[n]),e},{})):n=t,n})}else n=t.full();var i=this.getVarSet(n,e);e.order&&(i=Kt(Jt(e.order,i),i)),this.vars=i;var a=i.map(function(t){return t});this.scaleConfig=e,this.scaleConfig.nice=this.scaleConfig.hasOwnProperty("nice")?this.scaleConfig.nice:this.scaleConfig.autoScale,this.addField("dim",this.scaleConfig.dim).addField("scaleDim",this.scaleConfig.dim).addField("scaleType",this.scaleConfig.type).addField("source",this.scaleConfig.source).addField("domain",function(){return r.vars}).addField("isInteger",a.every(Number.isInteger)).addField("originalSeries",function(){return a}).addField("isContains",function(t){return r.isInDomain(t)}).addField("isEmptyScale",function(){return r.isEmpty()}).addField("fixup",function(t){var e=r.scaleConfig;e.__fixup__=e.__fixup__||{},e.__fixup__=Object.assign(e.__fixup__,t(Object.assign({},e,e.__fixup__)))}).addField("commit",function(){r.scaleConfig=Object.assign(r.scaleConfig,r.scaleConfig.__fixup__),delete r.scaleConfig.__fixup__})}return t.prototype.isInDomain=function(t){return this.domain().indexOf(t)>=0},t.prototype.addField=function(t,e){return this._fields[t]=e,this[t]=e,this},t.prototype.getField=function(t){return this._fields[t]},t.prototype.isEmpty=function(){return!Boolean(this._fields.dim)},t.prototype.toBaseScale=function(t,e){var n=this;void 0===e&&(e=null);var r=Object.keys(this._fields).reduce(function(t,e){return t[e]=n._fields[e],t},t);return r.getHash=function(){return Ft([n.vars,e].map(function(t){return JSON.stringify}).join(""))},r.value=r,r},t.prototype.getVarSet=function(t,e){return Yt(e.hasOwnProperty("series")?e.series:t.map(function(t){return t[e.dim]}),"date"===e.dimType?function(t){return new Date(t).getTime()}:function(t){return t})},t}(),Xi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._references=n.references,r._refCounter=n.refCounter,r.addField("scaleType","identity"),r}return Xi(e,t),e.prototype.create=function(){var t=this._references,e=this._refCounter;return this.toBaseScale(function(n,r){if(null==n){var i=t.get(r);null==i&&(i=e(),t.set(r,i))}else i=n;return i})},e}(Ui),Yi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i=function(){return($i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var h=Math.max.apply(Math,s.map(Math.abs));s=[-h,h]}r.vars=s}return r.addField("scaleType","color").addField("discrete",i).addField("brewer",a).addField("toColor",Bt).addField("toClass",Vt),r}return Yi(e,t),e.prototype.create=function(){var t=this.discrete,e=this.vars,n=this.getField("brewer"),r=t?this.createDiscreteScale(e,n):this.createContinuesScale(e,n);return this.toBaseScale(r)},e.prototype.createDiscreteScale=function(t,e){var n,r=function(t,e){var n=t.map(function(t){return String(t).toString()});return Ki.scaleOrdinal().range(e).domain(n)},i=function(t){return function(e){return t(String(e).toString())}};if(Array.isArray(e))n=i(r(t,e));else if("function"==typeof e)n=function(n){return e(n,i(r(t,Gt(20).map(function(t){return"color20-"+(1+t)}))))};else{if(!Ot(e))throw new Error("This brewer is not supported");n=function(t,e){var n=Object.keys(t),r=n.map(function(e){return t[e]}),i=Ki.scaleOrdinal().range(r).domain(n);return function(n){return t.hasOwnProperty(n)?i(String(n)):e(n)}}(e,function(){return"color-default"})}return n},e.prototype.createContinuesScale=function(t,e){if(!Array.isArray(e))throw new Error("This brewer is not supported");return Ki.scaleLinear().domain(zt(t.map(function(t){return t-0}),e.length)).range(e)},e}(Ui),Qi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zi={sqrt:function(t){return Math.sqrt(t)},linear:function(t){return t}},ta=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=r.scaleConfig,a=s.extent(r.vars),o=Number.isFinite(i.min)?i.min:a[0],u=Number.isFinite(i.max)?i.max:a[1];return r.vars=[Math.min.apply(Math,[o,a[0]].filter(Number.isFinite)),Math.max.apply(Math,[u,a[1]].filter(Number.isFinite))],r.addField("scaleType","size"),r.addField("funcType",n.func||"sqrt"),r}return Qi(e,t),e.prototype.isInDomain=function(t){var e=this.domain().sort(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(){var t,e=this.scaleConfig,n=this.vars,r=Qt({},e,{func:"sqrt",minSize:0,maxSize:1}),i=r.func,a=r.minSize,o=r.maxSize,s=Zi[i],u=n.filter(function(t){return Number.isFinite(Number(t))});if(0===u.length)t=function(){return o};else{var l,c,f=Math.min.apply(Math,u),d=Math.max.apply(Math,u),h=s(Math.max(Math.abs(f),Math.abs(d),d-f));c=f<0?f:0,l=0===h?1:(o-a)/h,t=function(t){var e=null!==t?parseFloat(t):0;return Number.isFinite(e)?a+s(e-c)*l:o}}return this.toBaseScale(t)},e}(Ui),ea=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),na=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","ordinal").addField("discrete",!0),r}return ea(e,t),e.prototype.create=function(t){var e=this.scaleConfig,n=this.vars,r=u.scalePoint().domain(n).range(t).padding(.5),i=Math.max.apply(Math,t),a=function(t){return"function"==typeof e.ratio?e.ratio(t,i,n):"object"==typeof e.ratio?e.ratio[t]:1/n.length},o=function(t){return e.ratio?i-n.slice(n.indexOf(t)+1).reduce(function(t,e){return t+i*a(e)},i*a(t)*.5):r(t)};return Object.keys(r).forEach(function(t){return o[t]=r[t]}),o.stepSize=function(t){return a(t)*i},this.toBaseScale(o,t)},e}(Ui),ra=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ia=function(){return(ia=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0},e.prototype.create=function(t){var e=this.periodGenerator,n=this.vars,r=this.vars.map(function(t){return t.getTime()}),i=this.scaleConfig,a=aa.scalePoint().domain(n).range(t).padding(.5),o=aa.scalePoint().domain(r.map(String)).range(t).padding(.5),s=Math.max.apply(Math,t),u=function(t){var e=new Date(t).getTime();return"function"==typeof i.ratio?i.ratio(e,s,r):"object"==typeof i.ratio?i.ratio[e]:1/n.length},l=function(t){var n=new Date(t),a=(e?e.cast(n):n).getTime();return i.ratio?s-r.slice(r.indexOf(a)+1).reduce(function(t,e){return t+s*u(e)},s*u(t)*.5):o(String(a))};return Object.keys(a).forEach(function(t){return l[t]=a[t]}),l.stepSize=function(t){return u(t)*s},this.toBaseScale(l,t)},e}(Ui),sa=n(15),ua=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),la=function(){return(la=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=r},e.prototype.create=function(t){var e=this,n=this.vars,r=this.scaleConfig.utcTime,i=this.periodGenerator,a=(r?ca.scaleUtc:ca.scaleTime)().domain(n).range(t),o=function(t){var e=n[0],r=n[1];return t>r&&(t=r),t=i&&t<=a});return function(t,e,n){void 0===n&&(n=10);var r,i,a=Number(t[0]),o=Number(t[1]),s=Math.abs(o-a)/n,u=ca.bisector(function(t){return t.duration}).right(ga,s);if(u===ga.length)r=e?ca.utcYear:ca.timeYear,i=ca.tickStep(a/pa.year.duration,o/pa.year.duration,n);else if(u){var l=s/ga[u-1].duration,c=ga[u].duration/s,f=ga[lc&&(e=c),a(e)}}return Object.keys(a).forEach(function(t){return o[t]=a[t]}),o.stepSize=function(){return 0},this.toBaseScale(o,t)},e}(Ui);function da(t){return ca["time"+t[0].toUpperCase()+t.slice(1)]}var ha,pa={second:{duration:1e3,interval:ca.timeSecond,utc:ca.utcSecond},minute:{duration:6e4,interval:ca.timeMinute,utc:ca.utcMinute},hour:{duration:36e5,interval:ca.timeHour,utc:ca.utcHour},day:{duration:864e5,interval:ca.timeDay,utc:ca.utcDay},week:{duration:6048e5,interval:ca.timeWeek,utc:ca.utcWeek},month:{duration:2592e6,interval:ca.timeMonth,utc:ca.utcMonth},year:{duration:31536e6,interval:ca.timeYear,utc:ca.utcYear}},ga=[(ha=function(t,e){return{time:t,step:e,duration:e*t.duration}})(pa.second,1),ha(pa.second,5),ha(pa.second,15),ha(pa.second,30),ha(pa.minute,1),ha(pa.minute,5),ha(pa.minute,15),ha(pa.minute,30),ha(pa.hour,1),ha(pa.hour,3),ha(pa.hour,6),ha(pa.hour,12),ha(pa.day,1),ha(pa.day,2),ha(pa.week,1),ha(pa.month,1),ha(pa.month,3),ha(pa.year,1)];var ma=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ya=function(){return(ya=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(t){var e=this.vars,n=this.extendScale(va.scaleLinear());return n.domain(e).range(t).clamp(!0),this.toBaseScale(n,t)},e.prototype.extendScale=function(t){var e=this,n=t.copy,r=t.ticks;return Object.assign(t,{stepSize:function(){return 0},copy:function(){return e.extendScale(n.call(t))},ticks:this.getField("isInteger")?function(e){return r.call(t,e).filter(Number.isInteger)}:t.ticks}),t},e}(Ui),xa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_a=function(){return(_a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0,n=t.map(function(t){return Math.abs(t)}),r=Math.max.apply(Math,n),i=Math.min.apply(Math,n).toExponential().split("e"),a=r.toExponential().split("e"),o=parseFloat(Math.floor(Number(i[0]))+"e"+i[1]),s=parseFloat(Math.ceil(Number(a[0]))+"e"+a[1]);return e?[o,s]:[-s,-o]}(a)),r.vars=a,r.addField("scaleType","logarithmic").addField("discrete",!1),r}return xa(e,t),e.prototype.isInDomain=function(t){var e=this.domain(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(t){var e=this.vars;Ma(e);var n=function t(e){var n=e.copy;e.ticks=function(t){for(var n=[],r=wa.extent(e.domain()),i=Math.floor(Sa(r[0])),a=Math.ceil(Sa(r[1])),o=Math.ceil(10*(a-i)/(10*Math.ceil(t/10))),s=i;s<=a;s+=o)for(var u=1;u<=10;u++){var l=Math.pow(u,o)*Math.pow(10,s);(l=parseFloat(l.toExponential(0)))>=r[0]&&l<=r[1]&&n.push(l)}return n};e.copy=function(){var r=n.call(e);return t(r),r};return e}(wa.scaleLog()).domain(e).range(t);return n.stepSize=function(){return 0},this.toBaseScale(n,t)},e}(Ui);function Sa(t){return Math.log(t)/Math.LN10}function Ma(t){if(t[0]*t[1]<=0)throw new w("Logarithmic scale domain cannot cross zero.",E.INVALID_LOG_DOMAIN)}var Ta,Ca=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ka=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","value").addField("georole",n.georole),r}return Ca(e,t),e.prototype.create=function(){return this.toBaseScale(function(t){return t})},e}(Ui),Aa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Oa=function(){return(Oa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(){var t=this.vars,e=this.getField("brewer");if(!Array.isArray(e))throw new Error("This brewer is not supported");var n=e.length,r=(t[1]-t[0])/n,i=Gt(n-1).map(function(t){return t+1}).reduce(function(e,n){return e.concat([t[0]+n*r])},[]),a=Pa.scaleThreshold().domain(i).range(e);return this.toBaseScale(a)},e}(Ui),Na=function(t){return t||null},Ra=function(t,e){return void 0===e&&(e=null),Array.isArray(t)?0===t.length?[e]:t:[t]},Fa=function(t,e){return{type:t,x:e.x,y:e.y,identity:e.identity,size:e.size,color:e.color,split:e.split,label:e.label,guide:{color:e.colorGuide,obsoleteVerticalStackOrder:e.obsoleteVerticalStackOrder,size:e.sizeGuide},flip:e.flip,stack:e.stack}},Da={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},ja=((Ta={})[Da.SUCCESS]=function(t){return t},Ta[Da.FAIL]=function(t,e){throw new Error((e.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},Ta[Da.WARNING]=function(t,e,n){var r=e.axis,i=e.indexMeasureAxis[0],a=t[i],o=t.filter(function(t){return t!==a});o.push(a);var s=n[i][r]||{},u=n[n.length-1][r]||{};return n[n.length-1][r]=s,n[i][r]=u,o},Ta);function Ia(t,e,n){return e.reduce(function(e,r,i){var a=t[r];return a?e.status!=Da.FAIL&&("measure"===a.type&&(e.countMeasureAxis++,e.indexMeasureAxis.push(i)),"measure"!==a.type&&1===e.countMeasureAxis?e.status=Da.WARNING:e.countMeasureAxis>1&&(e.status=Da.FAIL,e.messages.push('There is more than one measure dimension for "'+n+'" axis'))):(e.status=Da.FAIL,r?e.messages.push('"'+r+'" dimension is undefined for "'+n+'" axis'):e.messages.push('"'+n+'" axis should be specified')),e},{status:Da.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:n})}function za(t){for(var e=Ra(t.x),n=Ra(t.y),r=Math.max(e.length,n.length),i=Ra(t.guide||{},{}),a=r-i.length,o=0;o0;c--){var f=s.pop(),d=u.pop(),h=l.pop()||{};c===a?(o.x=f,o.y=d,o.unit.push(Fa(t,{x:Na(f),y:Na(d),identity:e.identity,split:e.split,color:e.color,label:e.label,size:e.size,flip:e.flip,stack:e.stack,colorGuide:h.color,obsoleteVerticalStackOrder:h.obsoleteVerticalStackOrder,sizeGuide:h.size})),o.guide=Qt(h,{x:{label:f},y:{label:d}})):o={type:"COORDS.RECT",x:Na(f),y:Na(d),unit:[o],guide:Qt(h,{x:{label:f},y:{label:d}})}}return e.spec={dimensions:e.dimensions,unit:o},e}var Va=function(t){var e,n,r,i=za(t);return n=((e=i).flip?e.y:e.x).indexOf(e.color)>=0,r=e.guide[e.guide.length-1],n&&!r.hasOwnProperty("enableColorToBarPosition")&&(r.enableColorToBarPosition=!1),Ba("ELEMENT.INTERVAL",i=e)},Ha=function(t){var e=za(t),n=e.data,r=e.settings.log,i=(0,{horizontal:function(t){return{prop:t.x[t.x.length-1],flip:!1}},vertical:function(t){return{prop:t.y[t.y.length-1],flip:!0}},auto:function(t){var e,i=t.x,a=t.y,o=i[i.length-1],s=i.slice(0,i.length-1),u=a[a.length-1],l=a.slice(0,a.length-1),c=t.color,f=s.concat(l).concat([c]).filter(function(t){return null!==t}),d=-1,h=[[[o].concat(f),u],[[u].concat(f),o]],p=null;return h.some(function(t,e){var i=t[0],a=t[1],o=un(n,i,[a]);return o.result?d=e:r(["Attempt to find a functional relation between",t[0]+" and "+t[1]+" is failed.","There are several "+o.error.keyY+" values (e.g. "+o.error.errY.join(",")+")","for ("+o.error.keyX+" = "+o.error.valX+")."].join(" ")),o.result})?(e=h[d][0][0],p=0!==d):(r("All attempts are failed. Gonna transform AREA to general PATH."),e=null),{prop:e,flip:p}}}["boolean"!=typeof e.flip?"auto":e.flip?"vertical":"horizontal"])(e);return null!==i.prop&&(e.data=dn(n,i.prop,e.dimensions[i.prop]),e.flip=i.flip),Ba("ELEMENT.AREA",e)},Wa=function(){function t(t){this.unitRef=t}return t.prototype.value=function(){return this.unitRef},t.prototype.clone=function(){return JSON.parse(JSON.stringify(this.unitRef))},t.prototype.traverse=function(t){var e=function(t,n,r){n(t,r),(t.units||[]).map(function(r){return e(r,n,t)})};return e(this.unitRef,t,null),this},t.prototype.reduce=function(t,e){var n=e;return this.traverse(function(e,r){return n=t(n,e,r)}),n},t.prototype.addFrame=function(t){return this.unitRef.frames=this.unitRef.frames||[],t.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),t.source=t.hasOwnProperty("source")?t.source:this.unitRef.expression.source,t.pipe=t.pipe||[],this.unitRef.frames.push(t),this},t.prototype.addTransformation=function(t,e){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:t,args:e}),this},t.prototype.isCoordinates=function(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")},t.prototype.isElementOf=function(t){if(this.isCoordinates())return!1;var e=(this.unitRef.type||"").split("/");return 1===e.length&&e.unshift("RECT"),e[0].toUpperCase()===t.toUpperCase()},t}(),Ga=function(){function t(t){this.specRef=t}return t.prototype.value=function(){return this.specRef},t.prototype.unit=function(t){return t&&(this.specRef.unit=t),new Wa(this.specRef.unit)},t.prototype.addTransformation=function(t,e){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[t]=e,this},t.prototype.getSettings=function(t){return this.specRef.settings[t]},t.prototype.setSettings=function(t,e){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[t]=e,this},t.prototype.getScale=function(t){return this.specRef.scales[t]},t.prototype.addScale=function(t,e){return this.specRef.scales[t]=e,this},t.prototype.regSource=function(t,e){return this.specRef.sources[t]=e,this},t.prototype.getSourceData=function(t){return(this.specRef.sources[t]||{data:[]}).data},t.prototype.getSourceDim=function(t,e){return(this.specRef.sources[t]||{dims:{}}).dims[e]||{}},t}(),Ua={},Xa=function(){function t(){}return t.unit=function(t){return new Wa(t)},t.spec=function(t){return new Ga(t)},t.cloneObject=function(t){return JSON.parse(JSON.stringify(t))},t.depthFirstSearch=function(e,n){if(n(e))return e;for(var r=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],i=0;i1))return"[columns] property must contain at least 2 dimensions"}]));var Ja="2.7.1";e.default={GPL:Ue,Plot:or,Chart:dr,api:$a,version:"2.7.1"}},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=a},function(t,e){t.exports=o},function(t,e){t.exports=s},function(t,e){t.exports=u},function(t,e,n){var r,i,a;i=[],void 0===(a="function"==typeof(r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){return t.indexOf(e)},r=window,i=r.document,a=i.documentElement,o=["top","bottom"];function s(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e,n=r.pageYOffset||a.scrollTop,i=r.pageXOffset||a.scrollLeft,o={left:0,right:0,top:0,bottom:0,width:0,height:0};if((e=t)&&null!=e.setInterval)o.width=r.innerWidth||a.clientWidth,o.height=r.innerHeight||a.clientHeight;else{if(!a.contains(t)||null==t.getBoundingClientRect)return o;s(o,t.getBoundingClientRect()),o.width=o.right-o.left,o.height=o.bottom-o.top}return o.top=o.top+n-a.clientTop,o.left=o.left+i-a.clientLeft,o.right=o.left+o.width,o.bottom=o.top+o.height,o}var l=function(t,e){return r.getComputedStyle(t)[e]};function c(t){var e=String(l(t,c.propName)),n=e.match(/([0-9.]+)([ms]{1,2})/);return n&&(e=Number(n[1]),"s"===n[2]&&(e*=1e3)),0|e}c.propName=function(){for(var t=i.createElement("div"),e=["transitionDuration","webkitTransitionDuration"],n=0;n=e.bottom&&(i[0]="top"),i[1]){case"left":t.right-this.width<=e.left&&(i[1]="right");break;case"right":t.left+this.width>=e.right&&(i[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?i[1]="left":t.right-t.width/2-this.width/2<=e.left&&(i[1]="right")}else switch(t.left-this.width-a<=e.left?i[0]="right":t.right+this.width+a>=e.right&&(i[0]="left"),i[1]){case"top":t.bottom-this.height<=e.top&&(i[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(i[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?i[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(i[1]="bottom")}return i.join("-")},d.prototype.position=function(t,e){this.attachedTo&&(t=this.attachedTo),null==t&&this._p?(t=this._p[0],e=this._p[1]):this._p=arguments;var n,r,i="number"==typeof t?{left:0|t,right:0|t,top:0|e,bottom:0|e,width:0,height:0}:u(t),a=this.spacing,o=this._pickPlace(i);switch(o!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(o),this.curPlace=o),this.curPlace){case"top":n=i.top-this.height-a,r=i.left+i.width/2-this.width/2;break;case"top-left":n=i.top-this.height-a,r=i.right-this.width;break;case"top-right":n=i.top-this.height-a,r=i.left;break;case"bottom":n=i.bottom+a,r=i.left+i.width/2-this.width/2;break;case"bottom-left":n=i.bottom+a,r=i.right-this.width;break;case"bottom-right":n=i.bottom+a,r=i.left;break;case"left":n=i.top+i.height/2-this.height/2,r=i.left-this.width-a;break;case"left-top":n=i.bottom-this.height,r=i.left-this.width-a;break;case"left-bottom":n=i.top,r=i.left-this.width-a;break;case"right":n=i.top+i.height/2-this.height/2,r=i.right+a;break;case"right-top":n=i.bottom-this.height,r=i.right+a;break;case"right-bottom":n=i.top,r=i.right+a}return this.element.style.top=Math.round(n)+"px",this.element.style.left=Math.round(r)+"px",this},d.prototype.show=function(t,e){return t=this.attachedTo?this.attachedTo:t,clearTimeout(this.aIndex),null!=t&&this.position(t,e),this.hidden&&(this.hidden=0,i.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},d.prototype.getElement=function(){return this.element},d.prototype.hide=function(){if(!this.hidden){var t=this,e=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(e=c(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){t.aIndex=0,i.body.removeChild(t.element),t.hidden=1},e),this}},d.prototype.toggle=function(t,e){return this[this.hidden?"show":"hide"](t,e)},d.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||i.body.removeChild(this.element),this.element=this.options=null},d.prototype._aware=function(){-1===n(d.winAware,this)&&d.winAware.push(this)},d.prototype._unaware=function(){var t=n(d.winAware,this);-1!==t&&d.winAware.splice(t,1)},d.reposition=function(){var t,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,17)};function n(){t=0;for(var e=0,n=d.winAware.length;e0)-(t<0)||Number(t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],a=0;a>>0,i=arguments[1],a=0;a0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),o)},function(t){var e=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!a(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(n=arguments[2])}for(var i,o=s(e.length),u=a(this)?Object(new this(o)):new Array(o),l=0;l]*>/,"");var e=new ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}try{var a=n.xmldom?new r.DOMParser(n.xmldom):new r.DOMParser;return a.parseFromString(t,"image/svg+xml")}catch(e){return(a=n.xmldom?new r.DOMParser(n.xmldom):new r.DOMParser).parseFromString(t,"text/xml")}},o.Property=function(t,e){this.name=t,this.value=e},o.Property.prototype.getValue=function(){return this.value},o.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},o.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},o.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},o.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():t},o.Property.prototype.addOpacity=function(e){var n=this.value;if(null!=e.value&&""!=e.value&&"string"==typeof this.value){var r=new t(this.value);r.ok&&(n="rgba("+r.r+", "+r.g+", "+r.b+", "+e.numValue()+")")}return new o.Property(this.name,n)},o.Property.prototype.getDefinition=function(){var t=this.value.match(/#([^\)'"]+)/);return t&&(t=t[1]),t||(t=this.value),o.Definitions[t]},o.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},o.Property.prototype.getFillStyleDefinition=function(t,e){var n=this.getDefinition();if(null!=n&&n.createGradient)return n.createGradient(o.ctx,t,e);if(null!=n&&n.createPattern){if(n.getHrefAttribute().hasValue()){var r=n.attribute("patternTransform");n=n.getHrefAttribute().getDefinition(),r.hasValue()&&(n.attribute("patternTransform",!0).value=r.value)}return n.createPattern(o.ctx,t)}return null},o.Property.prototype.getDPI=function(t){return 96},o.Property.prototype.getREM=function(t){return o.rootEmSize},o.Property.prototype.getEM=function(t){return o.emSize},o.Property.prototype.getUnits=function(){var t=this.value+"";return t.replace(/[0-9\.\-]/g,"")},o.Property.prototype.isPixels=function(){if(!this.hasValue())return!1;var t=this.value+"";return!!t.match(/px$/)||!!t.match(/^[0-9]+$/)},o.Property.prototype.toPixels=function(t,e){if(!this.hasValue())return 0;var n=this.value+"";if(n.match(/rem$/))return this.numValue()*this.getREM(t);if(n.match(/em$/))return this.numValue()*this.getEM(t);if(n.match(/ex$/))return this.numValue()*this.getEM(t)/2;if(n.match(/px$/))return this.numValue();if(n.match(/pt$/))return this.numValue()*this.getDPI(t)*(1/72);if(n.match(/pc$/))return 15*this.numValue();if(n.match(/cm$/))return this.numValue()*this.getDPI(t)/2.54;if(n.match(/mm$/))return this.numValue()*this.getDPI(t)/25.4;if(n.match(/in$/))return this.numValue()*this.getDPI(t);if(n.match(/%$/))return this.numValue()*o.ViewPort.ComputeSize(t);var r=this.numValue();return e&&r<1?r*o.ViewPort.ComputeSize(t):r},o.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/s$/)?1e3*this.numValue():(t.match(/ms$/),this.numValue())},o.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/deg$/)?this.numValue()*(Math.PI/180):t.match(/grad$/)?this.numValue()*(Math.PI/200):t.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var s={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return o.Property.prototype.toTextBaseline=function(){return this.hasValue()?s[this.value]:null},o.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(t,e,n,r,i,a){var s=null!=a?this.Parse(a):this.CreateFont("","","","","",o.ctx.font);return{fontFamily:i=i||s.fontFamily,fontSize:r||s.fontSize,fontStyle:t||s.fontStyle,fontWeight:n||s.fontWeight,fontVariant:e||s.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var t=this;this.Parse=function(e){for(var n={},r=o.trim(o.compressSpaces(e||"")).split(" "),i={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},a="",s=0;sthis.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))},this.addX=function(t){this.addPoint(t,null)},this.addY=function(t){this.addPoint(null,t)},this.addBoundingBox=function(t){this.addPoint(t.x1,t.y1),this.addPoint(t.x2,t.y2)},this.addQuadraticCurve=function(t,e,n,r,i,a){var o=t+2/3*(n-t),s=e+2/3*(r-e),u=o+1/3*(i-t),l=s+1/3*(a-e);this.addBezierCurve(t,e,o,u,s,l,i,a)},this.addBezierCurve=function(t,e,n,r,i,a,o,s){var u=[t,e],l=[n,r],c=[i,a],f=[o,s];this.addPoint(u[0],u[1]),this.addPoint(f[0],f[1]);for(var d=0;d<=1;d++){var h=function(t){return Math.pow(1-t,3)*u[d]+3*Math.pow(1-t,2)*t*l[d]+3*(1-t)*Math.pow(t,2)*c[d]+Math.pow(t,3)*f[d]},p=6*u[d]-12*l[d]+6*c[d],g=-3*u[d]+9*l[d]-9*c[d]+3*f[d],m=3*l[d]-3*u[d];if(0!=g){var y=Math.pow(p,2)-4*m*g;if(!(y<0)){var v=(-p+Math.sqrt(y))/(2*g);0=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var t=new o.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(t)},this.getAsControlPoint=function(){var t=this.getPoint();return this.control=t},this.getAsCurrentPoint=function(){var t=this.getPoint();return this.current=t},this.getReflectedControlPoint=function(){return"c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase()?this.current:new o.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(t){return this.isRelativeCommand()&&(t.x+=this.current.x,t.y+=this.current.y),t},this.addMarker=function(t,e,n){null!=n&&0this.maxDuration){if("indefinite"==this.attribute("repeatCount").value||"indefinite"==this.attribute("repeatDur").value)this.duration=0;else if("freeze"!=this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"==this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+t;var e=!1;if(this.begin~\.\[:]+)/g,l=/(\.[^\s\+>~\.\[:]+)/g,c=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,f=/(:[\w-]+\([^\)]*\))/gi,d=/(:[^\s\+>~\.\[:]+)/g,h=/([^\s\+>~\.\[:]+)/g;function p(t){var e=[0,0,0],n=function(n,r){var i=t.match(n);null!=i&&(e[r]+=i.length,t=t.replace(n," "))};return t=(t=t.replace(/:not\(([^\)]*)\)/g," $1 ")).replace(/{[\s\S]*/gm," "),n(s,1),n(u,0),n(l,1),n(c,2),n(f,1),n(d,1),t=(t=t.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),n(h,2),e.join("")}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,n,r,i,a){var s={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:n,scaleWidth:r,scaleHeight:i};for(var u in a)a.hasOwnProperty(u)&&(s[u]=a[u]);o(this.canvas,t,s)}),n.exports=o}(n={exports:{}}),n.exports}(n(22),n(23))},function(t,e,n){(function(n){var r,i,a;i=[],void 0===(a="function"==typeof(r=function(){"use strict";function e(t,e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="blob",r.onload=function(){o(r.response,e,n)},r.onerror=function(){console.error("could not download file")},r.send()}function r(t){var e=new XMLHttpRequest;return e.open("HEAD",t,!1),e.send(),200<=e.status&&299>=e.status}function i(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(n){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n&&n.global===n?n:void 0,o=a.saveAs||("object"!=typeof window||window!==a?function(){}:"download"in HTMLAnchorElement.prototype?function(t,n,o){var s=a.URL||a.webkitURL,u=document.createElement("a");n=n||t.name||"download",u.download=n,u.rel="noopener","string"==typeof t?(u.href=t,u.origin===location.origin?i(u):r(u.href)?e(t,n,o):i(u,u.target="_blank")):(u.href=s.createObjectURL(t),setTimeout(function(){s.revokeObjectURL(u.href)},4e4),setTimeout(function(){i(u)},0))}:"msSaveOrOpenBlob"in navigator?function(t,n,a){if(n=n||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}(t,a),n);else if(r(t))e(t,n,a);else{var o=document.createElement("a");o.href=t,o.target="_blank",setTimeout(function(){i(o)})}}:function(t,n,r,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof t)return e(t,n,r);var o="application/octet-stream"===t.type,s=/constructor/i.test(a.HTMLElement)||a.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||o&&s)&&"object"==typeof FileReader){var l=new FileReader;l.onloadend=function(){var t=l.result;t=u?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=t:location=t,i=null},l.readAsDataURL(t)}else{var c=a.URL||a.webkitURL,f=c.createObjectURL(t);i?i.location=f:location.href=f,i=null,setTimeout(function(){c.revokeObjectURL(f)},4e4)}});a.saveAs=o.saveAs=o,t.exports=o})?r.apply(e,i):r)||(t.exports=a)}).call(this,n(24))},function(t,e,n){(t.exports=n(25)(!1)).push([t.i,"body > * {\n visibility: hidden;\n}\nbody {\n overflow: hidden;\n}\nbody * {\n visibility: hidden !important;\n}\n\n.tau-chart__print-block {\n position: absolute;\n top: 0;\n left: 0;\n visibility: visible !important;\n display: block !important;\n width: 100%;\n /*height: 100%;*/\n}\n",""])},,function(t,e,n){t.exports=n(26)},function(t,e){t.exports=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var n=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r3&&(this.alpha=s[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),n=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==n.length&&(n="0"+n),"#"+t+e+n},this.getHelpXML=function(){for(var t=new Array,r=0;r "+l.toRGB()+" -> "+l.toHex());u.appendChild(c),u.appendChild(f),s.appendChild(u)}catch(t){}return s}}},function(t,e){var n=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],r=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function i(t,e,n,r,i){if("string"==typeof t)t=document.getElementById(t);else if("undefined"!=typeof HTMLCanvasElement&&!t instanceof HTMLCanvasElement)return;var a,o=t.getContext("2d");try{try{a=o.getImageData(e,n,r,i)}catch(t){throw new Error("unable to access local image data: "+t)}}catch(t){throw new Error("unable to access image data: "+t)}return a}function a(t,e,n,r,a,s){if(!(isNaN(s)||s<1)){s|=0;var u=i(t,e,n,r,a);u=o(u,e,n,r,a,s),t.getContext("2d").putImageData(u,e,n)}}function o(t,e,i,a,o,s){var u,c,f,d,h,p,g,m,y,v,b,x,_,w,E,S,M,T,C,k,A,O,P,L,N=t.data,R=s+s+1,F=a-1,D=o-1,j=s+1,I=j*(j+1)/2,z=new l,B=z;for(f=1;f>U,0!=P?(P=255/P,N[p]=(m*G>>U)*P,N[p+1]=(y*G>>U)*P,N[p+2]=(v*G>>U)*P):N[p]=N[p+1]=N[p+2]=0,m-=x,y-=_,v-=w,b-=E,x-=H.r,_-=H.g,w-=H.b,E-=H.a,d=g+((d=u+s+1)>U,P>0?(P=255/P,N[d]=(m*G>>U)*P,N[d+1]=(y*G>>U)*P,N[d+2]=(v*G>>U)*P):N[d]=N[d+1]=N[d+2]=0,m-=x,y-=_,v-=w,b-=E,x-=H.r,_-=H.g,w-=H.b,E-=H.a,d=u+((d=c+j)>V,A[p+1]=y*B>>V,A[p+2]=v*B>>V,m-=b,y-=x,v-=_,b-=I.r,x-=I.g,_-=I.b,d=g+((d=u+s+1)>V,A[d+1]=y*B>>V,A[d+2]=v*B>>V,m-=b,y-=x,v-=_,b-=I.r,x-=I.g,_-=I.b,d=u+((d=c+N)=0:e.dim===t.dim});if(null===i.method)return n;var a={l:-.5,r:.5},o=i.method,s=i.scale;return n[o]=function(t){var n=a[t.__pos__]||0;if(s.discrete)return e[o](t)+s.stepSize(t[s.dim])*n;if(s.period){for(var i=r.default.api.tickPeriod.get(s.period,{utc:s.utcTime}),u=s.domain(),l=i.cast(u[0]);l=0?i[t].map(function(t){return new Date(t)}):i[t];a.series=o.unique(s.concat(u))}})})},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},_useSavedDataRefs:function(t,e){var n=this._dataRefs;return this._usedDataRefsKeys.add(e),e in n?(n[e].forEach(function(e,n){return Object.assign(e,t[n])}),n[e]):(n[e]=t,t)},_startWatchingDataRefs:function(){var t=this._dataRefs;this._initialDataRefsKeys=new Set(Object.keys(t)),this._usedDataRefsKeys=new Set},_clearUnusedDataRefs:function(){var t=this._dataRefs,e=this._initialDataRefsKeys,n=this._usedDataRefsKeys;Array.from(e).filter(function(t){return!n.has(t)}).forEach(function(e){return delete t[e]}),this._initialDataRefsKeys=null,this._usedDataRefsKeys=null},_getDataRowsFromItems:function(t){var e=function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})};return t.reduce(function(t,n){return Array.isArray(n.dim)?Array.isArray(n.val)&&n.val.every(Array.isArray)&&n.val.forEach(function(r){t.push(e(n.dim,r))}):Array.isArray(n.val)?n.val.forEach(function(r){t.push(e([n.dim],[r]))}):t.push(e([n.dim],[n.val])),t},[])},_getAnnotatedDimValues:function(t){var e=this._getDataRowsFromItems(t),n={};return e.forEach(function(t){Object.keys(t).forEach(function(e){n[e]=n[e]||[],n[e].push(t[e])})}),n}}}r.default.api.plugins.add("annotations",c);var f=r.default.api.utils;function d(t){var e=t.x0,n=t.y0,r=null==t.collapse||t.collapse,i=function(t){return{y0:function(n){return t.scaleY.value(n[e])}}},a=function(t){return{y0:function(e){return t.scaleY.value(e[n])}}},o=function(t){var r=t.data();if(0===r.length)return{};var i=t.scaleY,a=Number.MAX_VALUE,o=Number.MIN_VALUE,s=t.flip?e:n,u=i.dim;return r.forEach(function(t){var e=t[s],n=t[u],r=ee?n:e;a=ro?i:o}),i.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxa)&&(e.min=a),e}),{}},s={},u={},l=function(t){var i=t.data().slice(),a=t.scaleX,o=t.scaleY;if(0===i.length||!a.discrete)return{};var l=t.flip?e:n,c=o.dim;i.sort(f.createMultiSorter(function(t,e){return t[l]-e[l]},function(t,e){return t[c]-e[c]}));var d=a.dim,h=a.domain().reduce(function(t,e){return t[e]=[],t},{}),p=new Map;return i.forEach(r?function(t){var e=t[d],n=h[e],r=n.findIndex(function(e){return e[e.length-1][c]<=t[l]});r<0&&(r=n.length,n.push([])),n[r].push(t),p.set(t,r)}:function(t){var e=t[d],n=h[e],r=r=n.length;n.push([]),n[r].push(t),p.set(t,r)}),Object.keys(h).forEach(function(t){s[t]=h[t]}),a.fixup(function(t){var e={},n=a.domain().reduce(function(t,e){return t+s[e].length},0);return a.domain().forEach(function(t){u[t]=n}),e.ratio=function(t){return s[t].length/u[t]},e}),{xi:function(e){var n=e[d],r=a.stepSize(n);return t.xi(e)-r/2+r/s[n].length*(p.get(e)+.5)}}};return{onSpecReady:function(t,e){t.traverseSpec(e,function(t,e){"ELEMENT.INTERVAL"===t.type&&(t.transformModel=[t.flip?i:a,l],t.adjustScales=[o],t.guide.enableColorToBarPosition=!1,t.guide.label=t.guide.label||{},t.guide.label.position=t.guide.label.position||(t.flip?["inside-start-then-outside-end-horizontal","hide-by-label-height-horizontal"]:["inside-start-then-outside-end-vertical"]))})}}}r.default.api.plugins.add("bar-as-span",d);var h=n(0),p=r.default.api.utils,g="minimum",m="maximum",y={MIN:g,MAX:m,MEDIAN:"median",Q1:"Q1",Q3:"Q3"};function v(t,e){var n=t.length-1,r=e/100*n,i=Math.floor(r);if(0===i)return{pos:0,value:t[0]};if(i===n)return{pos:n,value:t[n]};var a=r-i;return a?{pos:r,value:t[i]+a*(t[i+1]-t[i])}:{pos:r,value:t[r]}}function b(t,e,n){for(var r=t.sort(function(t,e){return t-e}),i=v(r,25),a=v(r,50),o=v(r,75),s=o.value-i.value,u=i.value-1.5*s,l=o.value+1.5*s,c=r[0],f=r[r.length-1],d=0;d<=i.pos;d++){var h=r[d];if(h>u){c=h;break}}for(var p=r.length-1;p>=o.pos;p--){var g=r[p];if(go||t[r]\n
'+e+'
\n
\n '+C(n.map(function(t){return A(t)}))+"\n
\n\n"},A=function(t){var e=t.key,n=t.label,r=t.checked;return'\n
\n '+O()+'\n '+n+"\n
\n"},O=function(){return['','',""].join("")},P=function(t,e,n,r){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.matches(n)&&r(t,e),e=e.parentNode})},L=function(t,e){var n=function(t){return JSON.stringify(function(t){return null==t||""===t}(t)?null:t)},r=n(e);return function(e){var i=e[t],a=n(i);return r===a}},N=function(){function t(t){this.settings=_.defaults(t||{},{formatters:{},fields:null,skipColorDim:!0}),this._filters={},this.onRender=this._createRenderHandler()}return t.prototype.init=function(t){var e=this;this._chart=t;var n=function(e){var n=t.getSpec().scales;return Object.keys(n).map(function(t){return{name:t,config:n[t]}}).filter(e)},r=n(function(t){var e=t.config;t.name;return"ordinal"===e.type&&e.dim}),i=_.unique(r.map(function(t){return t.config.dim}));if(this.settings.fields&&(i=i.filter(function(t){return e.settings.fields.indexOf(t)>=0})),this.settings.skipColorDim){var a=n(function(t){var e=t.config;t.name;return"color"===e.type&&e.dim}).map(function(t){return t.config.dim});i=i.filter(function(t){return a.indexOf(t)<0})}r=r.filter(function(t){return i.indexOf(t.config.dim)>=0}),this._categoryScales=r,this._render()},t.prototype.destroy=function(){var t=this._filters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])});var n;(n=this._node)&&n.parentElement&&n.parentElement.removeChild(n)},t.prototype._createRenderHandler=function(){return function(){if(this._lastClickedScrollInfo){var t=this._lastClickedScrollInfo.key,e=this._node.querySelector('[data-key="'+t+'"]');if(e){var n=this._lastClickedScrollInfo.top,r=e.getBoundingClientRect().top,i=this._getScrollContainer(),a=i.getBoundingClientRect().top;i.scrollTop=i.scrollTop-n-a+r}this._lastClickedScrollInfo=null}}},t.prototype._getContent=function(t){return function(t){var e=t.categories;return'\n
\n '+C(e.map(function(t){return k(t)}))+"\n
\n"}({categories:t})},t.prototype._getCategoriesInfo=function(){var t=this;return this._categoryScales.map(function(e){var n=e.name;return t._chart.getScaleInfo(n)}).map(function(e){var n=e.dim,r=t._getFieldLabel(n),i=t._getFieldFormat(n),a=t._chart.getDataSources({excludeFilter:["category-filter"]}),o=_.unique(a[e.source].data.map(function(t){return t[n]})).map(function(e){var r=i(e),a=t._getFilterKey(n,e);return{label:r,checked:!t._filters[a],key:a,value:e}});return{dim:n,label:r,values:o}})},t.prototype._render=function(){this._clear(),this._formatters=w.getFieldFormatters(this._chart.getSpec(),this.settings.formatters);var t,e,n=this._getCategoriesInfo(),r=this._getContent(n),i=(t=r,(e=document.createElement("div")).innerHTML=t,e.firstElementChild);this._node=i,this._chart.insertToRightSidebar(i),this._subscribeToEvents(),this._filterKeys=n.reduce(function(t,e){var n=e.dim;return e.values.forEach(function(e){var r=e.key,i=e.value;t[r]={dim:n,value:i}}),t},{})},t.prototype._subscribeToEvents=function(){var t=this,e=this._node;P(e,"click","."+S,function(e,n){var r=n.getAttribute("data-key"),i=e.target.matches("."+T);t._toggleCategory(r,i?"toggle":"focus")}),P(e,"mouseover","."+S,function(e,n){var r=n.getAttribute("data-key");t._toggleHighlight(r,!0)}),P(e,"mouseout","."+S,function(e,n){var r=n.getAttribute("data-key");t._toggleHighlight(r,!1)})},t.prototype._isFilteredOut=function(t){return t in this._filters},t.prototype._toggleCategory=function(t,e){var n=this,r=Array.from(this._node.querySelectorAll("."+S)).reduce(function(t,e){return t[e.getAttribute("data-key")]=e,t},{}),i=Object.keys(this._filterKeys).map(function(t){var e=n._filterKeys[t],i=e.dim,a=e.value;return{node:r[t],key:t,dim:i,value:a,isChecked:!n._isFilteredOut(t)}}),a=i.reduce(function(t,e){return t[e.key]=e,t},{})[t],o=i.filter(function(t){return t.dim===a.dim}),s=function(t,e){e?t.classList.add(M):t.classList.remove(M)};switch(e){case"toggle":a.isChecked?(this._addFilter(t),s(a.node,!1)):(this._removeFilter(t),s(a.node,!0));break;case"focus":a.isChecked&&o.every(function(t){return t===a||!t.isChecked})?o.forEach(function(t){t.isChecked||(s(t.node,!0),n._removeFilter(t.key))}):(o.forEach(function(t){t!==a&&t.isChecked&&(s(t.node,!1),n._addFilter(t.key))}),a.isChecked||(s(a.node,!0),this._removeFilter(a.key)))}this._lastClickedScrollInfo={key:t,top:a.node.getBoundingClientRect().top-this._getScrollContainer().getBoundingClientRect().top},this._chart.refresh()},t.prototype._toggleHighlight=function(t,e){if(!this._isFilteredOut(t)){var n=this._filterKeys[t],r=n.dim,i=n.value,a=e?L(r,i):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){return t.fire("highlight",a)})}},t.prototype._clear=function(){var t=this._node;t&&t.parentElement&&t.parentElement.removeChild(t)},t.prototype._getScrollContainer=function(){return this._node.parentElement.parentElement},t.prototype._getFilterKey=function(t,e){return t+"__"+e},t.prototype._addFilter=function(t){var e=this._filterKeys[t],n=e.dim,r=e.value,i=L(n,r);this._filters[t]=this._chart.addFilter({tag:"category-filter",predicate:function(t){return!i(t)}})},t.prototype._removeFilter=function(t){var e=this._filters[t];delete this._filters[t],this._chart.removeFilter(e)},t.prototype._getFieldLabel=function(t){return this._formatters[t]?this._formatters[t].label:t},t.prototype._getFieldFormat=function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},t}();r.default.api.plugins.add("category-filter",function(t){return new N(t)});var R="http://www.w3.org/2000/svg",F=r.default.api.utils,D=r.default.api.svgUtils,j=r.default.api.pluginsSDK;function I(t){t=t||{};var e=document.createElementNS(R,"g"),n=h.select(e).attr("class","tau-crosshair__label");n.append("rect").attr("class","tau-crosshair__label__box"),n.append("text").attr("class","tau-crosshair__label__text-shadow"),n.append("text").attr("class","tau-crosshair__label__text");var r={options:function(e){return t=Object.assign(t,e),r},show:function(i){return t.container.appendChild(e),function(e){var r=e.x,i=e.y,a=e.text,o=e.color,s=e.colorCls;n.attr("class","tau-crosshair__label "+s);var u=t.halign,l=t.valign,c=t.hpad,f=t.vpad,d={left:"end",middle:"middle",right:"start"}[u],h={left:-c,middle:0,right:c}[u],p=n.select(".tau-crosshair__label__text").attr("fill",o),g=n.selectAll(".tau-crosshair__label__text, .tau-crosshair__label__text-shadow").attr("text-anchor",d).attr("x",r+h).attr("y",0).text(a),m=p.node().getBBox(),y={top:-f-m.height/2,middle:0,bottom:f+m.height/2}[l]-m.height/2-m.y;g.attr("y",i+y);var v=m.width+2*c,b=m.height+2*f,x={left:-v,middle:-v/2,right:0}[u],_={top:-b,middle:-b/2,bottom:0}[l];n.select(".tau-crosshair__label__box").attr("fill",o).attr("rx",t.boxCornerRadius).attr("ry",t.boxCornerRadius).attr("x",r+x).attr("y",i+_).attr("width",v).attr("height",b)}(i),function(){n.attr("transform","");var r=t.chart.getLayout().contentContainer.getBoundingClientRect(),i=t.chart.getSVG().getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(0,Math.max(r.left,i.left)-a.left)||Math.min(0,Math.min(r.right,i.right)-a.right),s=Math.max(0,Math.max(r.top,i.top)-a.top)||Math.min(0,Math.min(r.bottom,i.bottom)-a.bottom);n.attr("transform","translate("+o+","+s+")")}(),r},hide:function(){return e.parentNode&&e.parentNode.removeChild(e),r}};return r}function z(t){var e=F.defaults(t||{},{xAxis:!0,yAxis:!0,formatters:{},labelBoxHPadding:5,labelBoxVPadding:3,labelBoxCornerRadius:3,axisHPadding:22,axisVPadding:22});return{init:function(t){this._chart=t,this._formatters={},this._createNode()},_createNode:function(){var t=h.select(document.createElementNS(R,"g")).attr("class","tau-crosshair");this._labels={x:null,y:null};var n=function(n){var r=t.append("g").attr("class","tau-crosshair__group "+n);r.append("line").attr("class","tau-crosshair__line-shadow"),r.append("line").attr("class","tau-crosshair__line"),this._labels[n]=I({container:r.node(),chart:this._chart,halign:"x"===n?"middle":"left",valign:"x"===n?"bottom":"middle",boxCornerRadius:e.labelBoxCornerRadius,hpad:e.labelBoxHPadding,vpad:e.labelBoxVPadding})}.bind(this);e.xAxis&&n("x"),e.yAxis&&n("y"),this._element=t},_setValues:function(t,n,r){var i=function(t){var n=this._element.select(".tau-crosshair__group."+t.dir);n.select(".tau-crosshair__line").attr("class","tau-crosshair__line "+r.cls).attr("stroke",r.color),n.selectAll(".tau-crosshair__line, .tau-crosshair__line-shadow").attr("x1",t.startPt.x).attr("x2",t.valuePt.x).attr("y1",t.startPt.y).attr("y2",t.valuePt.y),("x"===t.dir&&e.xAxis||"y"===t.dir&&e.yAxis)&&this._labels[t.dir].options({halign:t.labelHAlign,valign:t.labelVAlign}).show({x:t.startPt.x,y:t.startPt.y,text:t.label,color:r.color,colorCls:r.cls})}.bind(this);i({dir:"x",startPt:{x:t.value,y:n.start+(t.minMode?0:e.axisVPadding)},valuePt:{x:t.value,y:n.value+n.crossPadding},label:t.label,labelHAlign:"middle",labelVAlign:"bottom"}),i({dir:"y",startPt:{x:t.start-(n.minMode?0:e.axisHPadding),y:n.value},valuePt:{x:t.value-t.crossPadding,y:n.value},label:n.label,labelHAlign:"left",labelVAlign:"middle"})},_showCrosshair:function(t,e,n){var r=this._chart.getSVG(),i=e.config.options.container.node(),a=D.getDeepTransformTranslate(i);this._element.attr("transform",D.translate(a.x,a.y)),r.appendChild(this._element.node());var o=e.getScale("x"),s=e.getScale("y"),u=e.getScale("color"),l=u(t.data[u.dim]),c=t.data[o.dim],f=t.data[s.dim],d=e.screenModel.x(t.data),h=e.screenModel.y(t.data);if(e.config.stack)if(e.config.flip){var p=e.data().filter(function(n){var r=n[s.dim];return n===t.data||(r===f||r-f==0)&&(e.screenModel.x(t.data)-e.screenModel.x(n))*n[o.dim]>0});d=(c<0?Math.min:Math.max).apply(null,p.map(function(t){return e.screenModel.x(t)},0)),c=p.reduce(function(t,e){return t+e[o.dim]},0)}else{var g=e.data().filter(function(n){var r=n[o.dim];return n===t.data||(r===c||r-c==0)&&(e.screenModel.y(n)-e.screenModel.y(t.data))*n[s.dim]>0});h=(f<0?Math.max:Math.min).apply(null,g.map(function(t){return e.screenModel.y(t)},0)),f=g.reduce(function(t,e){return t+e[s.dim]},0)}var m=t.node.getBBox(),y=["ELEMENT.AREA","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED"].indexOf(e.config.type)>=0?{x:m.width*(e.config.flip?c>0?1:0:.5),y:m.height*(e.config.flip?.5:f>0?1:0)}:{x:m.width/2,y:m.height/2};this._setValues({label:this._getFormat(o.dim)(c),start:0,value:d,crossPadding:y.x,minMode:n&&n.guide.x.hide},{label:this._getFormat(s.dim)(f),start:e.config.options.height,value:h,crossPadding:y.y,minMode:n&&n.guide.y.hide},{cls:u.toColor(l)?"":l,color:u.toColor(l)?l:""})},_hideCrosshair:function(){var t=this._element.node();t.parentNode&&t.parentNode.removeChild(t)},destroy:function(){this._hideCrosshair()},_subscribeToHover:function(){var t=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(function(e){return t.indexOf(e.config.type)>=0}).forEach(function(t){t.on("data-hover",function(t,e){if(e.data){if(t===e.unit){var n=j.getParentUnit(this._chart.getSpec(),t.config);this._showCrosshair(e,t,n)}}else this._hideCrosshair()}.bind(this))},this)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},onRender:function(){this._formatters=j.getFieldFormatters(this._chart.getSpec(),e.formatters),this._subscribeToHover()}}}r.default.api.plugins.add("crosshair",z);var B="tau-chart__tooltip";function V(t,e){return{render:function(t){return this.args=t,t=Object.assign({},t,{fields:this.filterFields(t.fields)}),this.rootTemplate(t)},rootTemplate:function(t){return['
',this.buttonsTemplate(),"
",'
',this.contentTemplate(t),"
"].join("\n")},contentTemplate:function(t){return this.fieldsTemplate(t)},filterFields:function(t){return t},getLabel:function(e){return t.getFieldLabel(e)},getFormatter:function(e){return t.getFieldFormat(e)},fieldsTemplate:function(t){var e=this,n=t.data;return t.fields.map(function(t){return e.itemTemplate({data:n,field:t})}).join("\n")},itemTemplate:function(t){var e=t.data,n=t.field,r=this.getLabel(n),i=this.getFormatter(n)(e[n]);return['
','
'+r+"
",'
'+i+"
","
"].join("\n")},buttonsTemplate:function(){return[this.buttonTemplate({cls:"i-role-exclude",text:"Exclude",icon:function(){return''}})].join("\n")},buttonTemplate:function(t){var e=t.icon,n=t.text,r=t.cls;return['
','
'," "+(e?e()+" ":"")+n,"
","
"].join("\n")},didMount:function(){var e=t.getDomNode().querySelector(".i-role-exclude");e&&e.addEventListener("click",function(){t.excludeHighlightedElement(),t.setState({highlight:null,isStuck:!1})})}}}var H=r.default.api.utils,W=r.default.api.domUtils,G=r.default.api.pluginsSDK,U="tau-chart__tooltip",X=function(){function t(t){this.settings=H.defaults(t||{},{align:"bottom-right",clickable:!0,clsClickable:U+"__clickable",clsStuck:"stuck",clsTarget:U+"-target",escapeHtml:!0,fields:null,formatters:{},getTemplate:null,spacing:24,winBound:12,onExclude:function(){}}),this.onRender=this._getRenderHandler()}return t.prototype.init=function(t){this._chart=t,this._tooltip=this._chart.addBalloon({spacing:this.settings.spacing,winBound:this.settings.winBound,auto:!0,effectClass:"fade"}),this._initDomEvents(),this.state={highlight:null,isStuck:!1},this.setState(this.state),this._template=this._getTemplate()},t.prototype._getTemplate=function(){var t=V(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t},t.prototype._renderTemplate=function(t,e){return this._template.render({data:t,fields:e})},t.prototype._initDomEvents=function(){var t=this;this._scrollHandler=function(){t.setState({highlight:null,isStuck:!1})},window.addEventListener("scroll",this._scrollHandler,!0),this.settings.clickable&&(this._outerClickHandler=function(e){var n=Array.from(document.querySelectorAll("."+t.settings.clsClickable)).concat(t.getDomNode()).map(function(t){return t.getBoundingClientRect()}),r=Math.min.apply(Math,n.map(function(t){return t.top})),i=Math.min.apply(Math,n.map(function(t){return t.left})),a=Math.max.apply(Math,n.map(function(t){return t.right})),o=Math.max.apply(Math,n.map(function(t){return t.bottom}));(e.clientXa||e.clientYo)&&t.setState({highlight:null,isStuck:!1})})},t.prototype.getDomNode=function(){return this._tooltip.getElement()},t.prototype.setState=function(t){var e=this,n=this.settings,r=this.state,i=this.state=Object.assign({},r,t);r.highlight=r.highlight||{data:null,cursor:null,unit:null},i.highlight=i.highlight||{data:null,cursor:null,unit:null},i.isStuck&&r.highlight.data&&(i.highlight=r.highlight),i.highlight.data!==r.highlight.data&&(i.highlight.data?(this._hideTooltip(),this._showTooltip(i.highlight.data,i.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(function(){e._setTargetSvgClass(!0)})):i.isStuck||!r.highlight.data||i.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!i.highlight.data||r.highlight.cursor&&i.highlight.cursor.x===r.highlight.cursor.x&&i.highlight.cursor.y===r.highlight.cursor.y||(this._tooltip.position(i.highlight.cursor.x,i.highlight.cursor.y),this._tooltip.updateSize());var a=this.getDomNode();this.settings.clickable&&i.isStuck!==r.isStuck&&(i.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),a.classList.add(n.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(i.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),a.classList.remove(n.clsStuck),requestAnimationFrame(function(){e._setTargetEventsEnabled(!0);var t=e._chart.getSVG();t&&W.dispatchMouseEvent(t,"mouseleave")})))},t.prototype._showTooltip=function(t,e){var n=this.settings,r=n.fields||"function"==typeof n.getFields&&n.getFields(this._chart)||Object.keys(t),i=this._renderTemplate(t,r);this._tooltip.content(i).position(e.x,e.y).place(n.align).show().updateSize(),this._template.didMount&&this._template.didMount()},t.prototype._hideTooltip=function(){window.removeEventListener("click",this._outerClickHandler,!0),this._template.willUnmount&&this._template.willUnmount(),this._tooltip.hide()},t.prototype.destroy=function(){window.removeEventListener("scroll",this._scrollHandler,!0),this._setTargetSvgClass(!1),this.setState({highlight:null,isStuck:!1}),this._tooltip.destroy()},t.prototype._subscribeToHover=function(){var t=this,e=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(function(t){return e.indexOf(t.config.type)>=0}).forEach(function(e){e.on("data-hover",function(e,n){var r=document.body.getBoundingClientRect();t.setState({highlight:n.data?{data:n.data,cursor:{x:n.event.clientX-r.left,y:n.event.clientY-r.top},unit:n.unit}:null})}),t.settings.clickable&&e.on("data-click",function(e,n){var r=document.body.getBoundingClientRect();t.setState(n.data?{highlight:{data:n.data,cursor:{x:n.event.clientX-r.left,y:n.event.clientY-r.top},unit:n.unit},isStuck:!0}:{highlight:null,isStuck:null})})})},t.prototype.getFieldFormat=function(t){var e=this._formatters[t]?this._formatters[t].format:function(t){return String(t)};return this.settings.escapeHtml?function(t){return H.escapeHtml(e(t))}:e},t.prototype.getFieldLabel=function(t){var e=this._formatters[t]?this._formatters[t].label:t;return this.settings.escapeHtml?H.escapeHtml(e):e},t.prototype._accentFocus=function(t){var e=function(e){return e===t};this._chart.select(function(){return!0}).forEach(function(t){t.fire("highlight",e)})},t.prototype._removeFocus=function(){var t=function(){return null};this._chart.select(function(){return!0}).forEach(function(e){e.fire("highlight",t),e.fire("highlight-data-points",t)})},t.prototype.excludeHighlightedElement=function(){var t=this.state.highlight.data;this._chart.addFilter({tag:"exclude",predicate:function(e){return e!==t}}),this.settings.onExclude(t),this._chart.refresh()},t.prototype._getRenderHandler=function(){return function(){this._formatters=G.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}},t.prototype._setTargetSvgClass=function(t){h.select(this._chart.getSVG()).classed(this.settings.clsTarget,t)},t.prototype._setTargetEventsEnabled=function(t){t?this._chart.enablePointerEvents():this._chart.disablePointerEvents()},t}(),q="diff-tooltip",Y=q+"__item",$=q+"__header";var K,J=r.default.api.utils,Q={draw:function(){var t=this.node().config;this._container=t.options.slot(t.uid)},addInteraction:function(){var t=this;this.node().on("interval-highlight",function(e,n){t._drawRange(n)})},_drawRange:function(t){var e=this.node(),n=e.config,r=e.screenModel.flip,i=this._container,a="interval-highlight",o=a+"__gradient",s=t?t[0]:null,u=t?t[1]:null,l=r?n.options.width:n.options.height;J.take(function(){var e=i.selectAll("."+a).data(t?[1]:[]);e.exit().remove();var n=e.enter().append("g").attr("class",a).attr("pointer-events","none");return{g:e,gEnter:n}}()).then(function(e){var c,f,d,p,g,m,y,v,b,x,_;!function(){for(var e=a+"__defs",s=a+"__gradient-start",u=a+"__gradient-end",l=i.node();"svg"!==(l=l.parentNode).tagName;);var c=e+"__"+n.uid,f=h.select(l).selectAll("#"+c).data(t?[1]:[]);f.exit().remove();var d=f.enter().append("defs").attr("class",e).attr("id",c).append("linearGradient").attr("id",o).attr("x1","0%").attr("y1",r?"100%":"0%").attr("x2",r?"0%":"100%").attr("y2","0%");d.append("stop").attr("class",s).attr("offset","0%"),d.append("stop").attr("class",u).attr("offset","100%")}(),f=(c=e).g,d=c.gEnter,p=a+"__range",g=f.select("."+p),m=d.append("rect").attr("class",p).attr("fill","url(#"+o+")"),v=(y=r?{x:0,y:u,width:l,height:s-u}:{x:s,y:0,width:u-s,height:l}).x,b=y.y,x=y.width,_=y.height,m.merge(g).attr("x",v).attr("y",b).attr("width",Math.abs(x)).attr("height",Math.abs(_)),function(t){var e=t.g,n=t.gEnter,i=a+"__range-start",o=e.select("."+i),u=n.append("line").attr("class",i),c=r?{x1:0,y1:s,x2:l,y2:s}:{x1:s,y1:0,x2:s,y2:l},f=c.x1,d=c.y1,h=c.x2,p=c.y2;u.merge(o).attr("x1",f).attr("y1",d).attr("x2",h).attr("y2",p)}(e),function(t){var e=t.g,n=t.gEnter,i=a+"__range-end",o=e.select("."+i),s=n.append("line").attr("class",i),c=r?{x1:0,y1:u,x2:l,y2:u}:{x1:u,y1:0,x2:u,y2:l},f=c.x1,d=c.y1,h=c.x2,p=c.y2;s.merge(o).attr("x1",f).attr("y1",d).attr("x2",h).attr("y2",p)}(e)})}},Z=(K=function(t,e){return(K=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}K(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),tt=r.default.api.utils,et=function(t){function e(e){var n=t.call(this,e)||this;return n.onSpecReady=n._getSpecReadyHandler(),n}return Z(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this._unitsGroupedData=new Map},e.prototype._getTemplate=function(){var t,e,n=(t=this,this.settings,e=V(t),Object.assign({},e,{hasColor:function(){return null!=this.args.colorField},contentTemplate:function(t){return[this.fieldsTemplate(t),this.tableTemplate(t)].join("\n")},filterFields:function(n){var r=t.state.highlight.unit.screenModel.model,i=r.scaleColor,a=r.scaleX,o=r.scaleY,s=n.filter(function(t){return t!==i.dim&&t!==a.dim&&t!==o.dim}),u=function(){return s.push(a.dim)};return this.shouldShowColorTable()?u():(u(),i.dim&&s.push(i.dim),s.push(o.dim)),e.filterFields.call(this,s)},itemTemplate:function(t){var e=t.data,n=t.field,r=this.getLabel(n),i=this.getFormatter(n)(e[n]),a=this.args.prev,o=(this.args.valueField,this.shouldShowDiff(n)),s=['',""+i,o?" "+this.fieldUpdownTemplate(this.getDiff({data:e,prev:a,field:n})):"",""].join("");return['
','
'+r+"
"," "+s,"
"].join("\n")},shouldShowDiff:function(t){return t===this.args.valueField},getDiff:function(t){var e=t.data,n=t.prev,r=t.field,i=this.getFormatter(r),a=(e?e[r]:0)-(n?n[r]:0);return{diff:i(a),sign:Math.sign(a)}},fieldUpdownTemplate:function(t){var e=t.diff,n=t.sign,r=q+"__field__updown";return['0?"positive":"negative")+'">',(n>0?"▲":n<0?"▼":"")+(0===n?"":e),""].join("")},shouldShowColorTable:function(){var t=this.args.groups;return this.hasColor()&&t.length>1},tableTemplate:function(t){return this.shouldShowColorTable()?['
',this.tableHeaderTemplate(t),this.tableBodyTemplate(t),"
"].join("\n"):""},tableHeaderTemplate:function(t){var e=t.colorField,n=t.valueField,r=this.getLabel(e),i=this.getLabel(n);return['
',' '+r+"",' '+i+"",' ▼▲',"
"].join("\n")},tableBodyTemplate:function(t){var e=this,n=t.data,r=t.groups,i=t.valueField,a=t.colorField,o=n,s=r.map(function(t){var e=t.data;return e?e[i]:0}),u=Math.min.apply(Math,s),l=Math.max.apply(Math,s);return['
','
',r.map(function(t){var n=t.data,r=t.prev;return e.tableRowTemplate({data:n,prev:r,highlighted:o,valueField:i,colorField:a,min:u,max:l})}).join("\n"),"
","
"].join("\n")},tableRowTemplate:function(t){var e=t.data,n=t.prev,r=t.highlighted,i=t.valueField,a=t.colorField,o=t.min,s=t.max,u=e?e[i]:0,l=this.getFormatter(a)((e||n)[a]),c=this.getFormatter(i)(u),f=e===r,d=this.getDiff({data:e,prev:n,field:i}),h=d.diff,p=d.sign,g=this.getColor(e||n),m=g.color,y=g.colorCls;return['
'," "+this.valueBarTemplate({min:o,max:s,v:u,color:m,colorCls:y}),' '+l+"",' '+c+""," "+this.updownTemplate({diff:h,sign:p}),"
"].join("\n")},valueBarTemplate:function(t){var e=t.min,n=t.max,r=t.v,i=t.color,a=t.colorCls;e=Math.min(e,0);var o=(n=Math.max(0,n))-e;return[""].join("\n")},getColor:function(e){var n=t.state.highlight.unit.screenModel;return{color:n.color(e),colorCls:n.class(e)}},updownTemplate:function(t){var e=t.diff,n=t.sign,r=Y+"__updown";return['0?"positive":"negative")+'">',(n>0?"▲":n<0?"▼":"")+(0===n?"":e),""].join("")},didMount:function(){e.didMount.call(this),this._scrollToHighlighted(),this._reserveSpaceForUpdown()},_scrollToHighlighted:function(){var e=t.getDomNode(),n=e.querySelector("."+q+"__body"),r=e.querySelector("."+q+"__body__content"),i=e.querySelector("."+Y+"_highlighted");if(n&&r&&i){var a=n.getBoundingClientRect(),o=r.getBoundingClientRect(),s=i.getBoundingClientRect(),u=0;if(s.bottom>a.bottom){var l=s.bottom-a.bottom+s.height,c=o.bottom-a.bottom;u=-Math.min(l,c),r.style.transform="translateY("+u+"px)"}o.top+ua.bottom&&n.classList.add(q+"__body_overflow-bottom")}},_reserveSpaceForUpdown:function(){var e=t.getDomNode(),n=e.querySelector("."+q+"__body"),r=e.querySelector("."+$);if(n&&r){var i="."+Y+"__updown:not(:empty)",a=Array.from(e.querySelectorAll(i)).map(function(t){return t.scrollWidth}),o=Math.max.apply(Math,a),s=Math.max(0,Math.ceil(o-15));n.style.paddingRight=s+"px",r.style.paddingRight=s+"px"}}}));return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(n,this,this.settings):n},e.prototype._renderTemplate=function(t,e){var n,r=this.state.highlight.unit,i=r.screenModel,a=i.model,o=a.scaleColor,s=(a.scaleX,a.scaleY),u=this._unitsGroupedData.get(r),l=this._getHighlightRange(t,r),c=l[0],f=l[1],d=function(t){var e=i.model.color(t);return isFinite(c)&&u[c][e]?u[c][e][0]:null},h=d(t),p=r.config.stack,g=!(!r.config.flip&&r.config.guide.obsoleteVerticalStackOrder&&r.config.stack),m=(n=o.domain().slice().reduce(function(t,e,n){return t[e]=n,t},{}),g?function(t,e){return n[t[o.dim]]-n[e[o.dim]]}:function(t,e){return n[e[o.dim]]-n[t[o.dim]]}),y=g?function(t,e){return s(t[s.dim])-s(e[s.dim])}:function(t,e){return s(e[s.dim])-s(t[s.dim])},v=function(t){return Object.keys(u[t]).reduce(function(e,n){return e.concat(u[t][n])},[]).sort(p?m:y)},b=v(f).map(function(t){i.model.color(t);return{data:t,prev:d(t)}});if(isFinite(c)){var x=v(c),_=b.reduce(function(t,e){return t[i.model.color(e.data)]=!0,t},{});x.forEach(function(t){var e=i.model.color(t);_[e]||b.push({data:null,prev:t})}),p&&b.sort(function(t,e){return m(t.data||t.prev,e.data||e.prev)})}return this._template.render({data:t,prev:h,fields:e,groups:b,valueField:s.dim,colorField:o.dim})},e.prototype._getRenderHandler=function(){var e=t.prototype._getRenderHandler.call(this);return function(){var t=this;e.call(this);var n=this._chart,r=n.select(function(t){return"chart"===t.config.namespace&&0===t.config.type.indexOf("ELEMENT.")&&"ELEMENT.INTERVAL_HIGHLIGHT"!==t.config.type}),i=n.select(function(t){return"ELEMENT.INTERVAL_HIGHLIGHT"===t.config.type}).reduce(function(t,e,n){return t[n]=e,t},{});r.forEach(function(e,n){var r=e.data();t._unitsGroupedData.set(e,t._getGroupedData(r,e)),e.on("data-hover",function(r,a){var o=i[n],s=a.unit&&a.unit===e?t._getHighlightRange(a.data,a.unit):null;o.fire("interval-highlight",s)})})}},e.prototype._getSpecReadyHandler=function(){return function(t,e){t.traverseSpec(e,function(t,e){if(0===t.type.indexOf("ELEMENT.")){var n=JSON.parse(JSON.stringify(t));n.type="ELEMENT.INTERVAL_HIGHLIGHT",n.namespace="highlight";var r=e.units.indexOf(t);e.units.splice(r,0,n)}})}},e.prototype._getGroupedData=function(t,e){var n=e.screenModel.model.scaleX,i=tt.groupBy(t,function(t){return n(t[n.dim]).toString()}),a=e.config.guide.x.tickPeriod||e.config.guide.x.timeInterval;if(a){var o=n.domain(),s=e.config.guide.utcTime;r.default.api.tickPeriod.generate(o[0],o[1],a,{utc:s}).filter(function(t){return t>=o[0]&&t<=o[1]}).forEach(function(t){var e=n(t);i[e]||(i[e]=[])})}return Object.keys(i).reduce(function(t,n){return t[n]=tt.groupBy(i[n],function(t){return e.screenModel.model.color(t)}),t},{})},e.prototype._getHighlightRange=function(t,e){var n=e.screenModel.flip,r=e.screenModel.model.scaleX,i=r(t[r.dim]),a=this._unitsGroupedData.get(e),o=Object.keys(a).map(Number).sort(n?function(t,e){return e-t}:function(t,e){return t-e}),s=o.indexOf(i);return 0===s?[i,i]:[o[s-1],i]},e}(X);function nt(t){return new et(t)}r.default.api.unitsRegistry.reg("ELEMENT.INTERVAL_HIGHLIGHT",Q,"ELEMENT.GENERIC.CARTESIAN"),r.default.api.plugins.add("diff-tooltip",nt);var rt=n(17),it=n.n(rt),at=n(18),ot=n(19),st=n.n(ot),ut="Taucharts Export Plug-in:",lt=r.default.api.utils,ct=r.default.api.pluginsSDK,ft=ct.tokens(),dt=function(t,e){return t.replace(new RegExp("^"+e+"+|"+e+"+$","g"),"")},ht=function(t){return(t=Math.round(t))%2?t+1:t},pt=function(t){return null===t||""===t||void 0===t};var gt,mt={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},yt=function(t,e){e=e||"all";var n=document.createElement("style");return n.setAttribute("media",e),n.innerHTML=t,n},vt=yt(st.a,"print"),bt=function(){vt&&vt.parentNode&&vt.parentNode.removeChild(vt),gt&>.parentNode&>.parentNode.removeChild(gt)};/PhantomJS/.test(navigator.userAgent)||("onafterprint"in window?window.addEventListener("afterprint",bt):window.matchMedia("screen").addListener(function(t){t.matches&&bt()}));var xt=function(t,e,n){var r="data:"+e+";charset=UTF-8,%ef%bb%bf"+encodeURIComponent(n),i=document.createElement("a");i.setAttribute("href",r),i.setAttribute("download",t),i.setAttribute("target","_new"),document.body.appendChild(i),i.click(),document.body.removeChild(i),i=null},_t=function(t){return[].slice.call(t.querySelectorAll("text.label")).forEach(function(t){t.innerHTML=[].slice.call(t.querySelectorAll("tspan")).reduce(function(t,e){var n=e.value||e.text||e.textContent||"";return t+(n=n.charAt(0).toUpperCase()+n.substr(1))},"")}),t},wt=function(t,e,n){n=null==n?"":String(n);var r=(t||{})[e]||{};return(lt.isObject(r.label)?r.label.text:r.label)||n};function Et(t){return{onRender:function(){this._info=ct.extractFieldsFormatInfo(this._chart.getSpec())},_normalizeExportFields:function(t,e){var n=this._info;return t.map(function(t){var e=t,r=n[t]||{};return"string"==typeof t&&(e={field:t,title:r.label||t}),"function"!=typeof e.value&&(e.value=function(t){var e=t[this.field];return r.isComplexField?(e||{})[r.tickLabel]:e}),e}).filter(function(t){return!e.find(function(e){return t.field===e})})},_handleError:function(t){r.default.api.globalSettings.log([ut,t],"error")},_createDataUrl:function(t,e){var n=this;(function(){for(var t=[],e=0;e=200&&n.status<300){var t=n.responseText;i[e]=t,a.splice(a.indexOf(n),1),0===a.length&&r(null,i)}else a.forEach(function(t){return t.abort()}),r(new Error(n.status+": "+n.statusText),null)},n.onerror=function(t){a.forEach(function(t){return t.abort()}),r(t.error,null)},n.open("GET",t,!0),n.send(null)})}).apply(void 0,this._cssPaths.concat([function(i,a){if(i)e(i,null);else try{var o=a.join(" ").replace(/&/g,""),s=yt(o),u=document.createElement("div");t.fire("beforeExportSVGNode");var l=t.getSVG().cloneNode(!0);t.fire("afterExportSVGNode"),u.appendChild(_t(l)),h.select(l).attr("version",1.1).attr("xmlns","http://www.w3.org/2000/svg"),l.insertBefore(s,l.firstChild),n._renderAdditionalInfo(l,t),n._addBackground(l,n._backgroundColor);var c=document.createElement("canvas");c.height=l.getAttribute("height"),c.width=l.getAttribute("width"),it()(c,l.parentNode.innerHTML,{renderCallback:function(t){var n=(new XMLSerializer).serializeToString(t);"=0}))?'"'+a+'"':a}return t.concat(i)},[]).join(e))},[o.map(function(t){return t.title}).join(e)]).join("\r\n"),u=(this._fileName||"export")+".csv";xt(u,"text/csv",s)},_renderFillLegend:function(e,n,r,i){var a=function(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=lt.range(e-2).map(function(t){return n+i*(t+1)});return[n].concat(a).concat(r)},o=this._unit.getScale("color"),s=wt(e.guide,"color",o.dim).toUpperCase(),u="text-transform:uppercase;font-weight:600;font-size:"+t.fontSize+"px",l=o.domain().sort(function(t,e){return t-e}),c=o.brewer.length,f=t.fontSize,d=a(l,c).reverse().map(function(t,e){return''}),h=a(l,3).reverse().map(function(t,e,n){return''+t+""}),p=[''," ",' ',d.join("")," "," ",' '+s+"",' ',' '," ",h.join("")," "," Sorry, your browser does not support inline SVG.",""].join(""),g=(new DOMParser).parseFromString(p,"application/xml").documentElement;return document.body.appendChild(g),n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+t.paddingTop+")").node().appendChild(g),{h:120,w:0}},_renderColorLegend:function(e,n,r,i){var a=this._unit.getScale("color"),o=wt(e.guide,"color",a.dim).toUpperCase(),s=this._getColorMap(r.getChartModelData({excludeFilter:["legend"]}),a,a.dim).values,u=n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+t.paddingTop+")");return u.append("text").text(o.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":t.fontSize+"px"}),u.selectAll("g").data(s).enter().append("g").call(function(e){e.attr("transform",function(t,e){return"translate(5,"+20*(e+1)+")"}),e.append("circle").attr("r",6).attr("fill",function(t){return a.toColor(t.color)}).attr("class",function(t){return a.toClass(t.color)}),e.append("text").attr("x",12).attr("y",5).text(function(t){return lt.escape(pt(t.label)?"No "+o:t.label)}).style({"font-size":t.fontSize+"px"})}),{h:20*s.length,w:0}},_renderSizeLegend:function(e,n,r,i,a){var o,s,u=this._unit.getScale("size"),l=wt(e.guide,"size",u.dim).toUpperCase(),c=r.getChartModelData().sort(function(t,e){return u(t[u.dim])-u(e[u.dim])}),f=c.length,d=c[0][u.dim],h=c[f-1][u.dim];if(h-d){var p=(s=h-d,Math.log(s)/Math.LN10),g=4-p<0?0:Math.round(4-p),m=Math.pow(10,g),y=(h-d)/5;o=lt.unique([d,d+y,d+2*y,d+3*y,h].map(function(t){return t===h||t===d?t:Math.round(t*m)/m}))}else o=[d];var v=o.map(function(t){var n=u(t),r=n/2;return{diameter:ht(n+2),radius:r,value:t,className:e.color?"color-definite":""}}.bind(this)).reverse(),b=Math.max.apply(null,v.map(function(t){return t.diameter})),x=t.fontSize,_=0,w=n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+(t.paddingTop+a.h+20)+")");w.append("text").text(l.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":x+"px"}),w.selectAll("g").data(v).enter().append("g").call(function(t){t.attr("transform",function(){var t="translate(5,"+(_+=b)+")";return _+=10,t}),t.append("circle").attr("r",function(t){return t.radius}).attr("class",function(t){return t.className}).style({opacity:.4}),t.append("g").attr("transform",function(){return"translate("+b+","+x/2+")"}).append("text").attr("x",0).attr("y",0).text(function(t){return t.value}).style({"font-size":x+"px"})})},_renderAdditionalInfo:function(t,e){var n=this._findUnit(e);if(n){var r={h:0,w:0};t=h.select(t);var i=parseInt(t.attr("width"),10);t.attr("height");t.attr("width",i+160);var a=e.getScaleInfo(n.color);if(a.dim&&!a.discrete){var o=this._renderFillLegend(n,t,e,i);r.h=o.h+20,r.w=o.w}if(a.dim&&a.discrete){var s=this._renderColorLegend(n,t,e,i);r.h=s.h+20,r.w=s.w}var u=e.getScaleInfo(n.size);u.dim&&!u.discrete&&this._renderSizeLegend(n,t,e,i,r)}},_addBackground:function(t,e){if(e&&"transparent"!==e){var n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("fill",e),n.setAttribute("x",0),n.setAttribute("y",0),n.setAttribute("width",t.getAttribute("width")),n.setAttribute("height",t.getAttribute("height")),t.insertBefore(n,t.firstChild)}},onUnitDraw:function(t,e){r.default.api.isChartElement(e)&&"chart"===e.config.namespace&&(this._unit=e)},_getColorMap:function(t,e,n){return lt.unique(t.map(function(t){var r=t[n];return{color:e(r),value:r,label:r}}),function(t){return t.value}).reduce(function(t,e){return t.brewer[e.value]=e.color,t.values.push(e),t},{brewer:{},values:[]})},_select:function(t,e){var n=this["_to"+(t=t||"").charAt(0).toUpperCase()+t.slice(1)];n&&n.call(this,e)},_handleMenu:function(t,e,n){t.addEventListener("click",function(t){if("a"===t.target.tagName.toLowerCase()){var r=t.target.getAttribute("data-value");this._select(r,e),n.hide()}}.bind(this)),t.addEventListener("mouseover",function(t){"a"===t.target.tagName.toLowerCase()&&t.target.focus()}.bind(this)),t.addEventListener("keydown",function(t){if(t.keyCode===mt.ESCAPE&&n.hide(),t.keyCode===mt.DOWN&&(t.target.parentNode.nextSibling?t.target.parentNode.nextSibling.childNodes[0].focus():t.target.parentNode.parentNode.firstChild.childNodes[0].focus()),t.keyCode===mt.UP&&(t.target.parentNode.previousSibling?t.target.parentNode.previousSibling.childNodes[0].focus():t.target.parentNode.parentNode.lastChild.childNodes[0].focus()),t.keyCode===mt.ENTER){var r=t.target.getAttribute("data-value");this._select(r,e)}t.preventDefault()}.bind(this));var r=null,i=function(){r=setTimeout(function(){n.hide()},100)},a=function(){clearTimeout(r)},o=function(){n.toggle(),n.hidden||t.querySelectorAll("a")[0].focus()};t.addEventListener("blur",i,!0),t.addEventListener("focus",a,!0),this._container.addEventListener("click",o),this._onDestroy(function(){t.removeEventListener("blur",i,!0),t.removeEventListener("focus",a,!0),this._container.removeEventListener("click",o),clearTimeout(r)})},init:function(e){t=t||{},t=lt.defaults(t,{backgroundColor:"white",visible:!0,fontSize:13,paddingTop:30}),this._chart=e,this._info={},this._cssPaths=t.cssPaths,this._fileName=t.fileName,this._backgroundColor=t.backgroundColor||"white",this._destroyListeners=[],this._csvSeparator=t.csvSeparator||",",this._exportFields=t.exportFields||[],this._appendFields=t.appendFields||[],this._excludeFields=t.excludeFields||[],this._cssPaths||(this._cssPaths=[],r.default.api.globalSettings.log('[export plugin]: the "cssPath" parameter should be specified for correct operation',"warn"));var n=t.visible?"":"display:none";this._container=e.insertToHeader('Export');var i=e.addBalloon({place:"bottom-left"});i.content(['"].join("")),i.attach(this._container);var a=i.getElement();a.setAttribute("tabindex","-1"),this._handleMenu(a,e,i);var o=e.on("export-to",function(t,e){var n=e.type,r=e.fileName;this._fileName=r||this._fileName,this._select(n,t)}.bind(this)),s=e.on("exportTo",function(t,e){r.default.api.globalSettings.log([ut,"`exportTo` event is deprecated, use `export-to` instead."],"warn"),this._select(e,t)}.bind(this));this._onDestroy(function(){i.destroy(),e.removeHandler(o),e.removeHandler(s)})},_onDestroy:function(t){this._destroyListeners.push(t)},destroy:function(){this._destroyListeners.forEach(function(t){t.call(this)},this);var t;(t=this._container)&&t.parentElement&&t.parentElement.removeChild(t)}}}r.default.api.plugins.add("export-to",Et);var St=function(){return(St=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&m.svgHeight>m.visibleHeight),s(o,t+m.visibleWidthm.visibleWidth),s(u,e+m.visibleHeightm.visibleHeight),s(c,t>0&&m.svgWidth>m.visibleWidth)})}(),T=_.node(),C=w.node(),k=E.node();l.onScroll(function(t){o.insertBefore(T,0===t?k.nextElementSibling:C)}),l.fireScroll(),this.floatingLayout={defs:y,xAxes:_,yAxes:w,shadows:M},s.selectAll(".floating-axes").on("mouseenter",function(){Tt.dispatchMouseEvent(o,"mouseleave")}).on("mousemove",function(){h.event.stopPropagation()}).on("click",function(){h.event.stopPropagation()})},removeFloatingLayout:function(){function t(t){t.selectAll(".axis").each(function(){this[Rt].appendChild(this),delete this[Rt],Array.prototype.forEach.call(this.querySelectorAll(".label"),function(t){t.setAttribute("transform",t[Ft]),delete t[Ft]})})}this.floatingLayout&&(this.floatingLayout.xAxes.call(t),this.floatingLayout.yAxes.call(t),this.scrollManager.destroy(),this.floatingLayout=null),Mt.select(this.chart.getSVG()).selectAll(".floating-axes").remove()},detectChartBackgroundColor:function(){var t,e=this.chart.getLayout().layout;do{if("none"!==(t=window.getComputedStyle(e)).backgroundImage)return null;if("transparent"!==t.backgroundColor&&"rgba(0, 0, 0, 0)"!==t.backgroundColor)return t.backgroundColor}while(e=e.parentElement);return null}}}function zt(t,e){return"translate("+t+","+e+")"}function Bt(t){var e={x:0,y:0,r:0};if(!t)return e;var n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}var a=t.indexOf("rotate(");if(a>=0){var o=t.indexOf(")",a+7),s=t.substring(a+7,o);e.r=parseFloat(s.trim())}return e}function Vt(t){var e=t[Nt]&&t[Nt].transform,n=Bt(t.getAttribute("transform"));return{translate0:n,translate:e?Bt(t[Nt].transform):n}}function Ht(t){var e={x:[],y:[]},n={x:0,y:0},r={x:null,y:null},i=t,a=[];this.onScroll=function(t){return a.push(t),this},this.handleVisibilityFor=function(t,n){return n.indexOf("x")>=0&&e.x.push(t),n.indexOf("y")>=0&&e.y.push(t),this};var o=function(){var t=i.scrollLeft,o=i.scrollTop;a.forEach(function(e){e.call(null,t,o)});var u=function(i){var a="x"===i?t:o;a!==n[i]&&(clearTimeout(r[i]),s(e[i],function(t){t.transition("floatingAxes_scrollVisibility"),t.attr("opacity",1e-6)}),r[i]=setTimeout(function(){s(e[i],function(t){r[i]=null,t.transition("floatingAxes_scrollVisibility").duration(256).attr("opacity",1)})},128)),n[i]=a};u("x"),u("y")};function s(t,e,n){t.forEach(function(t){e.call(n,t)})}i.addEventListener("scroll",o),this.fireScroll=function(){o.call(null,i.scrollLeft,i.scrollTop)},this.destroy=function(){i.removeEventListener("scroll",o)}}r.default.api.plugins.add("floating-axes",It);var Wt=r.default.api.utils;function Gt(t){Wt.defaults(t||{},{});var e=function(t,e,n,r){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains(n)&&r(t,e),e=e.parentNode})};return{init:function(t){this._chart=t,this._currentFilters={},this._legendColorByScaleId={};var n=this._chart.getSpec(),r=function(t){return function(e,r){var i=n.scales[r];return i.type===t&&i.dim&&e.push(r),e}};this._color=Object.keys(n.scales).reduce(r("color"),[]),this._fill=Object.keys(n.scales).reduce(r("fill"),[]);var i=this._color.length>0,a=this._fill.length>0;(i||a)&&(this._container=this._chart.insertToRightSidebar(this._containerTemplate),i&&(e(this._container,"click","tau-chart__legend__item-color",function(t,e){this._toggleLegendItem(e)}.bind(this)),e(this._container,"mouseover","tau-chart__legend__item-color",function(t,e){this._highlightToggle(e,!0)}.bind(this)),e(this._container,"mouseout","tau-chart__legend__item-color",function(t,e){this._highlightToggle(e,!1)}.bind(this))))},onSpecReady:function(){this._assignStaticBrewersOrEx()},onRender:function(){this._clearPanel(),this._drawColorLegend(),this._drawFillLegend()},_containerTemplate:'
',_template:Wt.template('
<%=name%>
<%=items%>
'),_itemTemplate:Wt.template(["
\">",'
','
',"
","<%=label%>","
"].join("")),_itemFillTemplate:Wt.template(['
\' class="tau-chart__legend__item tau-chart__legend__item-color" style="padding: 6px 0px 10px 40px;margin-left:10px;">','
',' ',' <%=label%>',"
","
"].join("")),_clearPanel:function(){this._container&&(this._container.innerHTML="")},_drawColorLegend:function(){var t=this;t._color.forEach(function(e){var n=t._chart.select(function(t){return t.config.color===e})[0];if(n){var r=n.getScale("color"),i=t._chart.getDataSources({excludeFilter:["legend"]}),a=Wt.unique(i[r.source].data.map(function(t){return t[r.dim]})).map(function(n){var i=Wt.escape(n),a=r.dim+i;return{scaleId:e,dim:r.dim,color:r(n),disabled:t._currentFilters.hasOwnProperty(a),label:n,value:i}});t._legendColorByScaleId[e]=a,t._container.insertAdjacentHTML("beforeend",t._template({items:a.map(function(e){return t._itemTemplate({scaleId:e.scaleId,dim:e.dim,color:e.color,classDisabled:e.disabled?"disabled":"",label:e.label,value:e.value})}).join(""),name:(((n.guide||{}).color||{}).label||{}).text||r.dim}))}})},_drawFillLegend:function(){var t=this;t._fill.forEach(function(e){var n=t._chart.select(function(t){return"COORDS.MAP"===t.config.type&&t.config.fill===e});if(n.length>0){var r=n[0].getScale("fill"),i=r.brewer,a=r.domain(),o=(a[1]-a[0])/i.length,s=Wt.range(i.length).map(function(e){var n=a[0]+e*o,s="";return 0===e&&(s=a[0]),e===i.length-1&&(s=a[1]),t._itemFillTemplate({color:r(n),label:s,value:Wt.escape(n)})});t._container.insertAdjacentHTML("beforeend",t._template({items:s.join(""),name:(((n[0].guide||{}).fill||{}).label||{}).text||r.dim}))}})},_toggleLegendItem:function(t){var e=t.getAttribute("data-scale-id"),n=t.getAttribute("data-dim"),r=t.getAttribute("data-value"),i=n+r,a=this._legendColorByScaleId[e].filter(function(t){return!t.disabled});if(1!==a.length||e!==a[0].scaleId||r!==a[0].value){var o=this._currentFilters;if(o.hasOwnProperty(i)){var s=o[i];delete o[i],t.classList.remove("disabled"),this._chart.removeFilter(s)}else t.classList.add("disabled"),o[i]=this._chart.addFilter({tag:"legend",predicate:function(t){return t[n]!=r}});this._chart.refresh()}},_highlightToggle:function(t,e){var n=t.getAttribute("data-scale-id"),r=t.getAttribute("data-dim"),i=t.getAttribute("data-value");this._chart.select(function(t){return t.config.color===n}).forEach(function(t){t.fire("highlight",function(t){return!e||t[r]==i})})},_generateColorMap:function(t){var e=Wt.range(20).map(function(t){return"color20-"+(1+t)});return t.reduce(function(t,n,r){return t[n]=e[r%20],t},{})},_assignStaticBrewersOrEx:function(){var t=this;t._color.forEach(function(e){var n=t._chart.getSpec().scales[e],r=t._chart.getDataSources({excludeFilter:["legend"]}),i=t._chart.getScaleFactory(r).createScaleInfoByName(e).domain();n.brewer||(n.brewer="measure"!==n.dimType?t._generateColorMap(i):["#e5f5e0","#a1d99b","#31a354"])})}}}r.default.api.plugins.add("geomap-legend",Gt);var Ut=r.default.api.utils;function Xt(t){Ut.defaults(t||{},{});var e=function(){return!1};return{init:function(t){this._currNode=null,this._currData=null,this._chart=t,this._tooltip=t.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains("i-role-exclude")&&(n._exclude(),n._tooltip.hide(),n._blurSelection()),e=e.parentNode},!1);var e,n=this;this._showTooltip=function(t){clearTimeout(e),n._currData=t.data;var r="No data";null!==t.data&&(r=Object.keys(t.data).map(function(e){return n.itemTemplate({label:e,value:t.data[e]})}).join(""));var i=n._tooltip.getElement().querySelectorAll(".i-role-content");i[0]&&(i[0].innerHTML=r);var a=n._tooltip.getElement().querySelectorAll(".i-role-exclude");if(a[0]){var o=t.data&&n._chart.getChartModelData().length>1;a[0].style.visibility=o?"visible":"hidden"}n._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this._hideTooltip=function(t){e=setTimeout(function(){n._tooltip.hide()},t?0:1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){n._hideTooltip(!0),n._blurSelection()},!1)},onRender:function(){var t=this;this._chart.select(function(t){return"COORDS.MAP"===t.config.type}).forEach(function(e){t._subscribeToPoints(e),t._subscribeToArea(e)})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:Ut.template(['
','
<%=label%>
','
<%=value%>
',"
"].join("")),_exclude:function(){var t;this._chart.addFilter({tag:"exclude",predicate:(t=this._currData,function(e){return JSON.stringify(e)!==JSON.stringify(t)})}),this._chart.refresh()},_blurSelection:function(){this._chart.select(function(t){return"COORDS.MAP"===t.config.type}).forEach(function(t){t.fire("highlight-area",e)}),this._currNode=null,this._currData=null},_subscribeToPoints:function(t){var e=this;t.on("point-mouseover",function(t,n){e._showTooltip(n)}),t.on("point-mouseout",function(t,n){e._hideTooltip()})},_subscribeToArea:function(t){var e=this;!t.getScale("code").dim||t.on("area-click",function(n,r){var i,a;e._currNode=n,r.data?e._currData===r.data?(e._hideTooltip(!0),e._blurSelection()):(t.fire("highlight-area",(i=r.data,a=JSON.stringify(i),function(t){return JSON.stringify(t)===a})),e._showTooltip(r)):(e._showTooltip(r),e._hideTooltip(!1),e._blurSelection())})}}}r.default.api.plugins.add("geomap-tooltip",Xt);var qt=n(2),Yt=r.default.api.utils,$t=r.default.api.pluginsSDK,Kt=$t.tokens();function Jt(t){var e=Yt.defaults(t||{},{title:"Layers",label:"Layer Type",showPanel:!0,showLayers:!0,mode:"merge",axisWidth:45,layers:[]});e.layers.forEach(function(t){t.guide=Yt.defaults(t.guide||{},{scaleOrient:"left",textAnchor:"end",hide:!1})});var n=function(t){return function(e){return Object.assign(e,t)}},r={line:n({type:"ELEMENT.LINE"}),area:n({type:"ELEMENT.AREA"}),dots:n({type:"ELEMENT.POINT"}),scatterplot:n({type:"ELEMENT.POINT"}),bar:n({type:"ELEMENT.INTERVAL"}),"stacked-bar":n({type:"ELEMENT.INTERVAL",stack:!0})};return{init:function(t){this._chart=t;var n=$t.spec(this._chart.getSpec()),r=this.checkIfApplicable(n);if(this._isApplicable=0===r.length,n.addTransformation("defined-only",function(t,e){var n=e.key;return t.filter(function(t){return null!==t[n]&&void 0!==t[n]})}),this._isApplicable){this.isFacet=this.checkIsFacet(n),this.primaryY=this.findPrimaryLayer(n);var i=this.getLayersText(),a=this.getLayersGroup(),o=e.label;this.fieldColorScale=o,n.setSettings("excludeNull",!1).setSettings("fitModel",null).addScale(o,{type:"color",source:"/",dim:o,brewer:e.brewer}).addTransformation("slice-layer",function(t,e){var n=e.key,r=e.group;return r?t.filter(function(t){var e=t[r],n=t[e];return e&&null!=n}):t.filter(function(t){return t[o]===i[n]&&null!==t[n]&&void 0!==t[n]})});var s=[this.primaryY].concat(e.layers).reduce(function(t,e){return t.concat(e.y)},[]);t.setupChartSourceModel(function(t){var e={};e[o]={type:"category"};var n={"/":{dims:e,data:[]}};return n["/"].dims=Object.assign(e,t["/"].dims),n["/"].data=t["/"].data.reduce(function(t,e){return t.concat(s.map(function(t){var n={};n[o]=i[t];var r=a[t];return r&&(n[r]=e[t],n.subLayer=r),Object.assign(n,e)}))},[]),Object.assign(n,Yt.omit(t,"/"))}),e.showPanel&&(this._container=t.insertToRightSidebar(this.containerTemplate),this._container.classList.add("applicable-true"),this.uiChangeEventsDispatcher=function(t){var n=t.target,r=n.classList;r.contains("i-role-show-layers")&&(e.showLayers=n.checked),r.contains("i-role-change-mode")&&(e.mode=n.value),this._chart.refresh()}.bind(this),this._container.addEventListener("change",this.uiChangeEventsDispatcher,!1))}else{n.getSettings("log")("[layers plugin]: is not applicable. "+r.join(" / "))}},getLayersText:function(){return[this.primaryY].concat(e.layers).reduce(function(t,e){return(Array.isArray(e.y)?e.y:[e.y]).reduce(function(t,n){return t[n]=this.extractLabelForKey(e,n),t}.bind(this),t)}.bind(this),{})},getLayersGroup:function(){return[this.primaryY].concat(e.layers).reduce(function(t,e){var n=null;return Array.isArray(e.y)&&(n=e.y.join(", ")),Yt.flatten([e.y]).reduce(function(t,e){return t[e]=n,t},t)}.bind(this),{})},checkIsFacet:function(t){return t.unit().reduce(function(t,e,n){return t||(n&&"COORDS.RECT"===n.type&&"COORDS.RECT"===e.type?t=!0:t)},!1)},checkIfApplicable:function(t){return t.unit().reduce(function(e,n,r){if(r&&"COORDS.RECT"!==r.type)return e.concat("Chart specification contains non-rectangular coordinates");if(r&&"COORDS.RECT"===r.type&&"COORDS.RECT"!==n.type){var i=t.getScale(n.y);if("measure"!==t.getSourceDim(i.source,i.dim).type)return e.concat("Y scale is not a measure")}return e},[])},isLeafElement:function(t,e){return e&&"COORDS.RECT"===e.type&&"COORDS.RECT"!==t.type},isFirstCoordNode:function(t,e){return!e&&t&&"COORDS.RECT"===t.type},isFinalCoordNode:function(t,e){return t&&"COORDS.RECT"===t.type&&t.units.every(function(t){return"COORDS.RECT"!==t.type})},buildLayersLayout:function(t){return t.regSource("$",{dims:{x:{type:"category"},y:{type:"category"}},data:[{x:1,y:1}]}).addScale("xLayoutScale",{type:"ordinal",source:"$",dim:"x"}).addScale("yLayoutScale",{type:"ordinal",source:"$",dim:"y"}).unit({type:"COORDS.RECT",x:"xLayoutScale",y:"yLayoutScale",expression:{source:"$",inherit:!1,operator:!1},guide:{showGridLines:"",x:{cssClass:"facet-axis"},y:{cssClass:"facet-axis"}}})},findPrimaryLayer:function(t){var e=this,n=t.unit().reduce(function(n,r){return n.concat(e.isFinalCoordNode(r)?{y:t.getScale(r.y).dim,isPrimary:!0,guide:r.guide.y,scaleName:r.y}:[])},[]);return $t.cloneObject(n[0])},createPrimaryUnitReducer:function(t,n,r,i){var a=this;return function(o,s,u){var l=function(t){return!0!==t.guide.hide};if(a.isFacet&&a.isFirstCoordNode(s,u)){s.guide.y.label=s.guide.y.label||{};var c=s.guide.y.label._original_text||s.guide.y.label.text;s.guide.y.label.text=[c,n.filter(l).map(a.extractLayerLabel.bind(a)).join(", ")].join(t.getSettings("facetLabelDelimiter")),"dock"===e.mode&&(s.guide.y.label.padding-=15,s.guide.y.padding+=15,s.guide.y.rotate=-90,s.guide.y.textAnchor="middle")}return a.isLeafElement(s,u)&&(u.units=u.units.filter(function(t){return t!==s})),a.isFinalCoordNode(s)&&(s.guide.y.label=s.guide.y.label||{},"dock"===e.mode&&(s.guide.padding.l=r,s.guide.padding.r=i,s.guide.y.hide=!0),"merge"===e.mode&&(s.guide.y.label.text=a.isFacet?"":n.filter(l).map(a.extractLayerLabel.bind(a)).join(", "))),o}},createSecondaryUnitReducer:function(t,n,i,a,o,s,u,l){var c=this,f=c.getScaleName(n.scaleName||n.y),d=n.guide.scaleOrient,h=Array.isArray(n.y),p=n.isPrimary;return function(g,m,y){if(c.isFacet&&c.isFirstCoordNode(m,y)&&(m.guide.y.label.text="",m.guide.x.hide=!0,m.guide.y.hide=!0),c.isLeafElement(m,y)){(n.type?r[n.type]:function(t){return t})(m),m.y=f;var v=t.getScale(m.size).dim;if(p&&v);else{var b="size_null"+l;t.addScale(b,{type:"size",source:"?",mid:1}),m.size=b}var x=t.getScale(m.color).dim;p&&x||(m.color=c.fieldColorScale,m.expression.operator="groupBy",m.expression.params=h?["subLayer"]:[c.fieldColorScale]);var _=h?{group:"subLayer"}:{key:n.y};$t.unit(m).addTransformation("slice-layer",_)}if(c.isFinalCoordNode(m)){if(m.y=f,m.guide.y=Object.assign(m.guide.y,n.guide||{}),m.guide.y.label=m.guide.y.label||{},m.guide.y.label.text=c.extractLayerLabel(n),m.guide.x.hide=!0,"dock"===e.mode){m.guide.showGridLines="",m.guide.padding.l=i,m.guide.padding.r=a,m.guide.y.label.textAnchor="end",m.guide.y.label.dock="right",m.guide.y.label.padding="right"===d?1:-10,m.guide.y.label.cssClass="label inline";var w="right"===d?u:s;m.guide.y.padding+=o*w}"merge"===e.mode&&(m.guide.showGridLines="",m.guide.y.hide=!0)}return g}},getScaleName:function(t){return Array.isArray(t)?t.join(", "):t},extractLabelForKey:function(t,e){var n=t.guide||{};n.label="string"==typeof n.label?{text:n.label}:n.label;var r=n.label||{},i=r.byKeys||{};return Array.isArray(t.y)?i[e]||e:r.text||r._original_text||t.y},extractLayerLabel:function(t){var e=this;return(Array.isArray(t.y)?t.y:[t.y]).map(function(n){return e.extractLabelForKey(t,n)}).join(", ")},onSpecReady:function(t,n){var r=this,i=$t.spec(n);if(e.showLayers&&r._isApplicable){i=e.layers.reduce(function(t,e){var n=r.getScaleName(e.y);return t.addScale(n,Object.assign({type:"linear",source:"/",dim:n,autoScale:!0},Yt.pick(e.guide||{},"min","max","autoScale","nice","niceInterval")))},i);var a,o=[this.primaryY].concat(e.layers).sort(function(t,e){return(t.guide.zIndex||0)-(e.guide.zIndex||0)}),s=i.unit(),u=e.axisWidth,l=function(t){return function(e){var n=e.guide.scaleOrient||"left";return!0!==e.guide.hide&&n===t}},c=l("left"),f=l("right"),d=o.filter(c).length*u,h=o.filter(f).length*u,p=r.buildLayersLayout(i).addFrame({key:{x:1,y:1},units:[(a=$t.unit(s.clone())).reduce(r.createPrimaryUnitReducer(i,o,d,h),a).value()]}),g=-1,m=-1;o.reduce(function(t,e,n){return g=c(e)?g+1:g,m=f(e)?m+1:m,t.addFrame({key:{x:1,y:1},units:[(a=$t.unit(s.clone())).reduce(r.createSecondaryUnitReducer(i,e,d,h,u,g,m,n),a).value()]})},p)}else i.unit().traverse(function(t,e){r.isLeafElement(t,e)&&$t.unit(t).addTransformation("defined-only",{key:i.getScale(t.y).dim})})},onUnitsStructureExpanded:function(){var t=this;if(t._isApplicable&&"merge"===e.mode){var n=$t.spec(t._chart.getSpec()),r=t.primaryY.scaleName,i=e.layers.map(function(e){return t.getScaleName(e.y)}).filter(function(t){return n.getScale(t)}).concat(r),a=i.reduce(function(e,n){var r=t._chart.getScaleInfo(n);return e[n]=r.domain().filter(function(t){return Number.isFinite(t)}),e},{}),o=qt.extent(Yt.flatten(Object.keys(a).map(function(t){return a[t]})));i.forEach(function(t){var e=n.getScale(t);e.min=o[0],e.max=o[1],e.nice=!1})}},containerTemplate:'
',template:Yt.template(['","
",'","
"].join("")),onRender:function(){this._isApplicable&&e.showPanel&&(this._container.innerHTML=this.template({title:e.title,mode:e.mode,showLayers:e.showLayers}))}}}r.default.api.plugins.add("layers",Jt);var Qt,Zt,te=n(6),ee=r.default.api.utils,ne=r.default.api.pluginsSDK,re=".tau-chart__legend__reset",ie=".tau-chart__legend__item-color",ae=".tau-chart__legend__guide--color__overlay",oe=4,se=13,ue=0,le=function(){return++ue},ce=r.default.api.utils.xml,fe=function(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=ee.range(e-2).map(function(t){return n+i*(t+1)});return[n].concat(a).concat(r)},de=function(t,e,n){if(t.length<3)return t.slice(0);if(e<3)return[t[0],t[t.length-1]];var r,i=t[0]<0?Math.abs(t[0]):0,a=function(t){return t},o="sqrt"===n?function(t){return Math.sqrt(t+i)}:a,s="sqrt"===n?function(t){return Math.pow(t,2)-i}:a,u=[(t=t.map(o))[0]],l=t[t.length-1]-t[0],c=.5*l/(e-1),f=ee.range(1,e-1).map(function(t){var n=l*t/(e-1);return{min:n-c,mid:n,max:n+c,diff:Number.MAX_VALUE,closest:null}}),d=0,h=function(){if(d!==f.length){var t=r;(r=f[d++]).min=Math.max(r.min,(t&&null!==t.closest?t.closest:u[0])+c)}};return h(),t.forEach(function(t){if(!(tr.max&&h();var e=Math.abs(t-r.mid);e0?Math.abs(e-t):n,a=pe(i),o=Math.abs(r-a);return Math.abs(r)>3&&o<=3?ye:function(t){var e=pe(n-t),r=Math.min((a<0?Math.abs(a):0)+(e0,s=this._fill.length>0,u=this._size.length>0;if(this._assignStaticBrewersOrEx(),a||s||u){switch(n.position){case"left":this._container=this._chart.insertToLeftSidebar(this._containerTemplate);break;case"right":this._container=this._chart.insertToRightSidebar(this._containerTemplate);break;case"top":this._container=this._chart.insertToHeader(this._containerTemplate);break;case"bottom":this._container=this._chart.insertToFooter(this._containerTemplate);break;default:this._container=this._chart.insertToRightSidebar(this._containerTemplate)}a&&(o(this._container,"click",re,function(t,n){e._toggleLegendItem(n,"reset")}),o(this._container,"click",ie,function(t,n){var r=t.ctrlKey||t.target.matches(ae)?"leave-others":"focus-single";e._toggleLegendItem(n,r)}),o(this._container,"mouseover",ie,function(t,n){e._highlightToggle(n,!0)}),o(this._container,"mouseout",ie,function(t,n){e._highlightToggle(n,!1)}))}},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])}),this._container&&this._container.parentElement&&(this._clearPanel(),this._container.parentElement.removeChild(this._container))},onSpecReady:function(t,e){this._formatters=ne.getFieldFormatters(e,n.formatters)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},onRender:function(){var t=this;if(e&&n.selectedCategories&&0!==n.selectedCategories.length){var r=this._getLegendColorByScales();return Object.keys(r).forEach(function(e){r[e].legendColorItems.forEach(function(e){var r=e.value,i=e.dim;if(-1===n.selectedCategories.indexOf(JSON.parse(r))){var o=i+r,s=a(i,r);t._currentFilters[o]=t._chart.addFilter({tag:"legend",predicate:function(t){return!s(t)}})}})}),e=!1,void this._chart.refresh()}this._clearPanel(),this._drawColorLegend(),this._drawFillLegend(),this._drawSizeLegend()},_containerTemplate:'
',_template:ee.template(['
',"<%=top%>",'
<%=name%>
',"<%=items%>","
"].join("")),_itemTemplate:ee.template(["
\">",'
','
','
',"
","
","
",' <%=label%>',"
"].join("")),_resetTemplate:ee.template(['
','
Reset
',"
"].join("")),_clearPanel:function(){this._container&&(clearTimeout(this._scrollTimeout),this._getScrollContainer().removeEventListener("scroll",this._scrollListener),this._container.innerHTML="")},_drawFillLegend:function(){var t=this;t._fill.forEach(function(e){var n,r,a,o=t._chart.select(function(t){return t.config.color===e})[0];if(o){var s=o.config.guide||{},u=o.getScale("color"),l=u.domain().sort(function(t,e){return t-e}),c=i(l),f=c?l.map(Number):l,d=ve(f[0],f[f.length-1]),h=function(){var e=t._chart.getSpec(),n=ne.extractFieldsFormatInfo(e)[u.dim].format;return n||(n=function(t){return new Date(t)}),function(t){return String(n(t))}}(),p=c?h:d,g=u.brewer.length,m=((s.color||{}).label||{}).text||u.dim,y=function(t){return t.length*se*.618},v=u.isInteger?(f[1]-f[0])%3==0?4:(f[1]-f[0])%2==0?3:2:3,b=fe(f,v),x=(c?b.map(function(t){return new Date(t)}):b).map(p);x[0]===x[x.length-1]&&(x=[x[0]]),t._container.insertAdjacentHTML("beforeend",t._template({name:ee.escape(m),top:null,items:'
'}));var _=t._container.lastElementChild.querySelector(".tau-chart__legend__gradient-wrapper"),w=_.getBoundingClientRect().width,E=!1;x.reduce(function(t,e){return t+y(e)},0)>w&&(x.length>1&&y(x[0])+y(x[x.length-1])>w?E=!0:x=[x[0],x[x.length-1]]);var S=E?(a=-.382*se/2,{width:w,height:120,barX:0,barY:0,barWidth:20,barHeight:120,textAnchor:"start",textX:ee.range(v).map(function(){return 25}),textY:1===x.length?60+.618*se:x.map(function(t,e){var n=(x.length-1-e)/(x.length-1);return se*(1-n)+120*n+a})}):(n=y(x[0])/2,r=y(x[x.length-1])/2,{width:w,height:28+se,barX:0,barY:0,barWidth:w,barHeight:20,textAnchor:"middle",textX:1===x.length?[w/2]:x.map(function(t,e){var i=e/(x.length-1);return n*(1-i)+(w-r)*i}),textY:ee.range(v).map(function(){return 28+se})}),M=fe(f,g).map(function(t,e){return ce("stop",{offset:e/(g-1)*100+"%",style:"stop-color:"+u(t)+';stop-opacity:1"'})}),T="legend-gradient-"+t.instanceId,C=ce.apply(void 0,["svg",{class:"tau-chart__legend__gradient",width:S.width,height:S.height},ce("defs",ce.apply(void 0,["linearGradient",{id:T,x1:"0%",y1:E?"100%":"0%",x2:E?"0%":"100%",y2:"0%"}].concat(M))),ce("rect",{class:"tau-chart__legend__gradient__bar",x:S.barX,y:S.barY,width:S.barWidth,height:S.barHeight,fill:"url(#"+T+")"})].concat(x.map(function(t,e){return ce("text",{x:S.textX[e],y:S.textY[e],"text-anchor":S.textAnchor},t)})));_.insertAdjacentHTML("beforeend",C)}})},_drawSizeLegend:function(){var t=this;t._size.forEach(function(e){var n=t._chart.select(function(t){return t.config.size===e})[0];if(n){var r=n.config.guide||{},i=n.getScale("size"),a=i.domain().sort(function(t,e){return t-e});if(!Array.isArray(a)||!a.every(isFinite))return;var o=((r.size||{}).label||{}).text||i.dim,s=a[0],u=a[a.length-1],l=[s];if(u-s){var c=he(u-s),f=Math.round(4-c),d=Math.pow(10,f),h=ee.unique(t._chart.getDataSources({excludeFilter:["legend"]})[i.source].data.map(function(t){return t[i.dim]}).filter(function(t){return t>=s&&t<=u})).sort(function(t,e){return t-e}),p=de(h,oe,i.funcType);l=ee.unique(p.map(function(t){return Math.round(t*d)/d}))}var g=ve(l[0],l[l.length-1]),m=function(t){return t.length*se*.618};l.reverse();var y=l.map(i),v=Math.max.apply(null,y),b=l.map(g);t._container.insertAdjacentHTML("beforeend",t._template({name:ee.escape(o),top:null,items:'
'}));var x=t._container.lastElementChild.querySelector(".tau-chart__legend__size-wrapper"),_=x.getBoundingClientRect().width,w=!1;(Math.max.apply(null,b.map(m))>_/4||1===b.length)&&(w=!0);var E=w?function(){for(var t=se,e=y[0]/2,n=y[y.length-1]/2,r=[e],i=1,a=void 0,o=void 0;i0&&(t._updateResetButtonPosition(),t._scrollTimeout=null,t._scrollListener=function(){var e=t._container.querySelector(re);e.style.display="none",t._scrollTimeout&&clearTimeout(t._scrollTimeout),t._scrollTimeout=setTimeout(function(){t._updateResetButtonPosition(),e.style.display="",t._scrollTimeout=null},250)},t._getScrollContainer().addEventListener("scroll",t._scrollListener))},_toggleLegendItem:function(t,e){var r=this,i=this._currentFilters,o=t?Array.prototype.filter.call(t.parentNode.childNodes,function(t){return t.matches(ie)}):null,s=function(t){var e=t.getAttribute("data-dim"),n=t.getAttribute("data-value");return{sid:t.getAttribute("data-scale-id"),dim:e,val:n,key:e+n}},u=function(t){return t in i},l=function(t,e){var n=s(t);if(u(n.key)===e)if(e){var o=i[n.key];delete i[n.key],t.classList.remove("disabled"),r._chart.removeFilter(o)}else{t.classList.add("disabled");var l=a(n.dim,n.val);i[n.key]=r._chart.addFilter({tag:"legend",predicate:function(t){return!l(t)}})}},c=function(e){return e===t},f=!!t&&u(s(t).key),d=function(t,e){t.querySelector(".tau-chart__legend__guide").style.backgroundColor=e?"":"transparent"};if("reset"===e)o.forEach(function(t){l(t,!0),d(t,!0)});else if("leave-others"===e)o.forEach(function(t){c(t)&&l(t,f)}),d(t,f);else if("focus-single"===e){var h=!f&&o.every(function(t){return c(t)||u(s(t).key)});o.forEach(function(t){var e=c(t)||h;l(t,e)}),f&&d(t,!0)}var p=o.filter(function(t){return!u(s(t).key)}).map(function(t){return JSON.parse(s(t).val)});n.onSelect({type:e,selectedCategories:p}),this._chart.refresh()},_highlightToggle:function(t,e){if(!t.matches(".disabled")){var n=t.getAttribute("data-dim"),r=t.getAttribute("data-value"),i=e?a(n,r):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){t.fire("highlight",i)})}},_getScrollContainer:function(){return this._container.parentNode.parentNode},_updateResetButtonPosition:function(){this._container.querySelector(re).style.top=this._getScrollContainer().scrollTop+"px"},_generateColorMap:function(t,e){var n=e.length;return t.reduce(function(t,r,i){return t[r]=e[i%n],t},{})},_assignStaticBrewersOrEx:function(){var t=this;t._color.forEach(function(e){var n=t._chart.getSpec().scales[e],r=t._chart.getDataSources({excludeFilter:["legend"]}),i=t._chart.getScaleFactory(r).createScaleInfoByName(e).domain();if(!n.brewer||Array.isArray(n.brewer)){var a=n.brewer||ee.range(20).map(function(t){return"color20-"+(1+t)});n.brewer=t._generateColorMap(i,a)}t._legendOrderState[e]=i.reduce(function(t,e,n){return t[e]=n,t},{})})}}}r.default.api.plugins.add("legend",be);var xe=r.default.api.utils;function _e(t){var e=xe.defaults(t||{},{verbose:!1,forceBrush:{}}),n={init:function(t){e.verbose&&(this.panel=t.insertToRightSidebar(this.template())),t.traverseSpec(t.getSpec(),function(t){t&&"COORDS.PARALLEL"===t.type&&(t.guide=t.guide||{},t.guide.enableBrushing=!0)}),n.forceBrush=e.forceBrush||{}},onRender:function(t){var r=t.getSpec().scales,i=Object.keys(r).reduce(function(t,e){var i=r[e].dim;return n.forceBrush[i]&&(t[e]=n.forceBrush[i]),t},{}),a=t.select(function(t){return"PARALLEL/ELEMENT.LINE"===t.config.type});a.forEach(function(t,r){t.parentUnit.on("brush",function(i,a){n.forceBrush={};var o=a.map(function(t){var e=t.dim,r=t.func,i=t.args;n.forceBrush[e]=i;var a=function(){return!0};return"between"===r&&(a=function(t){return t[e]>=i[0]&&i[1]>=t[e]}),"inset"===r&&(a=function(t){return i.indexOf(t[e])>=0}),a}),s=0;if(t.fire("highlight",function(t){var e=o.every(function(e){return e(t)});return s+=e?1:0,e}),e.verbose){var u=n.panel.getElementsByClassName("i-"+r);if(0===u.length){var l=document.createElement("div");l.className="i-"+r,n.panel.appendChild(l),u[0]=l}u[0].innerHTML=a.reduce(function(t,e){return t+"
"+e.dim+": ["+e.args.join(",")+"]
"},"
Matched: "+s+"
")}})}),a.forEach(function(t){t.parentUnit.fire("force-brush",i)})},template:xe.template('
')};return n}r.default.api.plugins.add("parallel-brushing",_e);var we=r.default.api.utils;function Ee(t){we.defaults(t||{},{});return{init:function(t){this._cursor=null,this._chart=t,this._tooltip=t.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains("i-role-exclude")&&n._exclude(),e=e.parentNode;n._tooltip.hide()},!1);var e,n=this;this.showTooltip=function(t){clearTimeout(e),n._cursor=t.data;var r=n._tooltip.getElement().querySelectorAll(".i-role-content");r[0]&&(r[0].innerHTML=Object.keys(t.data).map(function(e){return n.itemTemplate({label:e,value:t.data[e]})}).join("")),n._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this.hideTooltip=function(t){e=setTimeout(function(){n._tooltip.hide()},1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){n._tooltip.hide()},!1)},_exclude:function(){var t;this._chart.addFilter({tag:"exclude",predicate:(t=this._cursor,function(e){return JSON.stringify(e)!==JSON.stringify(t)})}),this._chart.refresh()},onRender:function(t){var e=this;t.select(function(t){return"PARALLEL/ELEMENT.LINE"===t.config.type}).forEach(function(t){t.on("mouseout",function(t,n){e.hideTooltip(n)}),t.on("mouseover",function(t,n){e.showTooltip(n)})})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:we.template(['
','
<%=label%>
','
<%=value%>
',"
"].join(""))}}r.default.api.plugins.add("parallel-tooltip",Ee);var Se=n(8),Me=n(3),Te=n(7),Ce=function(){return(Ce=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0?a:Object.keys(i.dims),this._fieldBounds=t.fieldBounds||{},this._applyImmediately=Boolean(t.applyImmediately);var o=n._chart.getChartModelData();this._filtersContainer=n._chart.insertToRightSidebar(n._filtersContainer),this._filtersContainer.style.maxHeight="0px",n._fields.filter(function(t){var e="measure"===i.dims[t].type;return e||r.settings.log("The ["+t+"] isn't measure so Quick Filter plugin skipped it"),e}).forEach(function(t){n._data[t]=o.map(function(e){return e[t]});var e=n._fieldBounds[t];n._bounds[t]=e?[e.min,e.max]:ke.extent(n._data[t]),n._filter[t]=n._bounds[t],n._filtersContainer.insertAdjacentHTML("beforeend",n._filterWrapper({name:t})),n._container[t]=n._filtersContainer.lastChild,n._drawFilter(t)})},onRender:function(){this._filtersContainer.style.maxHeight="none"},_filtersContainer:'
',_filterWrapper:Ae.template('
<%=name%>
'),_drawFilter:function(t){var e=this._data[t],n=this._bounds[t],r=this._filter[t],i=Ae.isDate(n[0])||Ae.isDate(n[1]),a=this,o=0,s=24,u=21,l=12,c=180-l-s,f=41-o-u-8,d=ke.scaleLinear().domain(n).range([0,c]),p=ke.brushX().extent([[0,0],[c,20]]).on("start",function(){a._layout.style["overflow-y"]="hidden"}).on("brush",this._applyImmediately?E:w).on("end",function(){a._layout.style["overflow-y"]="",E()}),g=ke.select(this._container[t]).append("svg").attr("width",c+l+s).attr("height",f+o+u+4).append("g").attr("transform","translate("+l+","+o+")"),m=(g.append("g").selectAll("rect").data(e).enter().append("rect").attr("transform",function(t){return"translate("+d(t)+","+(o+4)+")"}).attr("height",f).attr("width",1),g.append("g").attr("class","brush").call(p));m.append("g").attr("class","resize e").attr("cursor","ew-resize").attr("pointer-events","none"),m.append("g").attr("class","resize w").attr("cursor","ew-resize").attr("pointer-events","none"),m.selectAll(".resize").append("line").attr("transform","translate(0, 0)").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",f+8),m.selectAll(".resize").append("text").attr("x",0).attr("y",2*(f+4)),m.selectAll("rect").attr("height",f+8);var y=g.append("text").attr("x",c/2).attr("y",2*(f+4)).attr("class","date-label"),v=function(t){return Math.log(t)/Math.LN10}(a._filter[t][1]-a._filter[t][0]),b=Math.round(3-v),x=Math.pow(10,b);if(i){var _=function(t){var e=t.findIndex(function(t){var e=ke.timeFormat(t);return e(new Date(n[0]))!==e(new Date(n[1]))});return e=e<0?t.length:e,{comm:t.slice(0,e),diff:t.slice(e)}}(["’%y"," %b","%d","%H",":%M",":%S"]);_.comm.length<3?(_.diff.splice(-3),_.diff.reverse(),_.comm.reverse()):(_.comm.length<5&&_.diff.pop(),_.diff=_.comm.splice(3,_.comm.length-3).concat(_.diff),_.comm.reverse())}function w(){var e=h.event;if(e&&Array.isArray(e.selection)){var n=e.selection.map(d.invert);r=n,a._filter[t]=n}else r=a._filter[t];var o=i?new Date(r[0]).getTime():r[0],s=i?new Date(r[1]).getTime():r[1],u=Math.round(parseFloat(o)*x)/x,l=Math.round(parseFloat(s)*x)/x;m.select(".handle--w"),m.select(".handle--e");m.select(".resize.w").attr("transform","translate("+d(r[0])+",0)"),m.select(".resize.e").attr("transform","translate("+d(r[1])+",0)");var c=m.selectAll(".w text"),f=m.selectAll(".e text");if(i){var p=ke.timeFormat(_.comm.join("")),g=ke.timeFormat(_.diff.join(""));y.html(g(new Date(u))+" .. "+g(new Date(l))+' '+p(new Date(l))+"")}else c.text(u),f.text(l)}function E(){w(),a._applyFilter(t)}E(),p.move(m,r.map(d))},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])});var n;(n=this._filtersContainer)&&n.parentElement&&n.parentElement.removeChild(n)},_applyFilter:function(t){var e=this._currentFilters,n=function(t,e,n){return function(r){var i=r[t];return in}}(t,this._filter[t][0],this._filter[t][1]),r=e[t];delete e[t],this._chart.removeFilter(r),e[t]=this._chart.addFilter({tag:"quick-filter",predicate:function(t){return!n(t)}}),Oe<0?this._chart.refresh():(this._refreshRequestId&&clearTimeout(this._refreshRequestId),this._refreshRequestId=setTimeout(function(){this._refreshRequestId=null,this._chart.refresh()}.bind(this),Oe))}}}r.default.api.plugins.add("quick-filter",Pe);var Le=r.default.api.utils;function Ne(t){var e=Le.defaults(t||{},{show:!0,modes:["normal","entire-view","fit-width","fit-height","minimal"]});return{init:function(t){e.show&&(e.selectedMode=t.getSpec().settings.fitModel,t.insertToHeader(this.template({modes:e.modes.map(function(t){return""})})).addEventListener("change",function(n){var r=n.target;r.classList.contains("i-role-fit-model")&&(e.selectedMode=r.value,t.getSpec().settings.fitModel=e.selectedMode,t.refresh())},!1))},template:Le.template(['
',"
"," View Mode: ",' ","
","
"].join(""))}}r.default.api.plugins.add("settings",Ne);function Re(t){return new X(t)}r.default.api.plugins.add("tooltip",Re);var Fe,De=(Fe={linear:function(t){for(var e=[0,0,0,0,0],n=0,r=[];nMath.abs(t[n][a])&&(a=r);for(i=n;i=n;i--)t[i][r]-=t[i][n]*t[n][r]/t[n][n]}for(r=s-1;r>=0;r--){for(o=0,i=r+1;i=0;s--)m+=s>1?Math.round(100*h[s])/100+"x^"+s+" + ":1==s?Math.round(100*h[s])/100+"x + ":Math.round(100*h[s])/100;return{equation:h,points:i,string:m}},lastvalue:function(t){for(var e=[],n=null,r=0;r0&&ot[o]-t[s]?a:o;for(var c=Math.abs(1/(t[u]-l)),f=0,d=0,h=0,p=0,g=0,m=a;m<=o;){var y=t[m],v=e[m],b=r((m1&&(a||s)&&(d=[d[0],d[d.length-1]]),t.concat(d.length>1?d:[])},[])},t.traverseSpec(n,function(t,r){if(i.predicateIsApplicable(n,t,r)){var a=n.scales[t.x],o=n.scales[t.y],s=n.scales[t.color]||{},u=JSON.parse(JSON.stringify(t));u.type="ELEMENT.LINE",u.size="size_null",u.namespace="trendline",u.transformation=u.transformation||[],u.transformation.push({type:"regression",args:{type:e.type,x:a,y:o,g:s}});u.guide=je.defaults({},u.guide||{}),u.guide.interpolate="linear",u.guide.showAnchors="never",u.guide.cssClass="tau-chart__trendline",u.guide.widthCssClass="tau-chart__line-width-1",u.guide.x=u.guide.x||{},u.guide.x.fillGaps=!1,delete u.guide.label,delete u.label,r.units.push(u)}})}},containerTemplate:'
',template:je.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(t){if(this._container){this._container.innerHTML=this.template({title:"Trend line",error:this._error,showTrend:e.showTrend&&this._isApplicable?"checked":"",models:e.models.map(function(t){return""})});var n=function(t){return function(){h.select(this).classed({active:t,"tau-chart__line-width-1":!t,"tau-chart__line-width-3":t})}};h.select(t.getSVG()).selectAll(".tau-chart__trendline").on("mouseenter",n(!0)).on("mouseleave",n(!1))}}}}r.default.api.plugins.add("trendline",Ie);var ze={YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}},Be=function(t,e){return ze[t][e].map(function(n,r){return t+" q"+r+"-"+e})};r.default.api.colorBrewers.add("tauBrewer",Be);n.d(e,"GPL",function(){return Ve}),n.d(e,"Plot",function(){return He}),n.d(e,"Chart",function(){return We}),n.d(e,"api",function(){return Ge}),n.d(e,"version",function(){return Ue});var Ve=r.default.GPL,He=r.default.Plot,We=r.default.Chart,Ge=r.default.api,Ue=r.default.version}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3-selection"),require("d3-array"),require("d3-scale"),require("topojson-client"),require("d3-transition"),require("d3-format"),require("d3-time-format"),require("d3-brush"),require("d3-color"),require("d3-axis"),require("d3-geo"),require("d3-quadtree"),require("d3-shape"),require("d3-time")):"function"==typeof define&&define.amd?define(["d3-selection","d3-array","d3-scale","topojson-client","d3-transition","d3-format","d3-time-format","d3-brush","d3-color","d3-axis","d3-geo","d3-quadtree","d3-shape","d3-time"],e):"object"==typeof exports?exports.Taucharts=e(require("d3-selection"),require("d3-array"),require("d3-scale"),require("topojson-client"),require("d3-transition"),require("d3-format"),require("d3-time-format"),require("d3-brush"),require("d3-color"),require("d3-axis"),require("d3-geo"),require("d3-quadtree"),require("d3-shape"),require("d3-time")):t.Taucharts=e(t.d3,t.d3,t.d3,t.topojson,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(window,function(t,e,n,r,i,a,o,s,u,l,c,f,d,h){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=21)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"traverseJSON",function(){return mt}),n.d(r,"traverseSpec",function(){return yt}),n.d(r,"clone",function(){return kt}),n.d(r,"isDate",function(){return At}),n.d(r,"isObject",function(){return Ot}),n.d(r,"niceZeroBased",function(){return Pt}),n.d(r,"niceTimeDomain",function(){return Lt}),n.d(r,"generateHash",function(){return Ft}),n.d(r,"generateRatioFunction",function(){return Dt}),n.d(r,"isSpecRectCoordsOnly",function(){return jt}),n.d(r,"throttleLastEvent",function(){return It}),n.d(r,"splitEvenly",function(){return zt}),n.d(r,"extRGBColor",function(){return Bt}),n.d(r,"extCSSClass",function(){return Vt}),n.d(r,"toRadian",function(){return Ht}),n.d(r,"normalizeAngle",function(){return Wt}),n.d(r,"range",function(){return Gt}),n.d(r,"hasXOverflow",function(){return Ut}),n.d(r,"hasYOverflow",function(){return Xt}),n.d(r,"flatten",function(){return qt}),n.d(r,"unique",function(){return Yt}),n.d(r,"groupBy",function(){return $t}),n.d(r,"union",function(){return Kt}),n.d(r,"intersection",function(){return Jt}),n.d(r,"defaults",function(){return Qt}),n.d(r,"omit",function(){return Zt}),n.d(r,"memoize",function(){return te}),n.d(r,"createMultiSorter",function(){return ee}),n.d(r,"pick",function(){return ne}),n.d(r,"escape",function(){return re}),n.d(r,"template",function(){return ie}),n.d(r,"escapeHtml",function(){return ae}),n.d(r,"xml",function(){return le}),n.d(r,"take",function(){return ce}),n.d(r,"isChartElement",function(){return de}),n.d(r,"isFacetUnit",function(){return he});var i={};n.r(i),n.d(i,"appendTo",function(){return me}),n.d(i,"getScrollbarSize",function(){return ye}),n.d(i,"setScrollPadding",function(){return ve}),n.d(i,"getStyle",function(){return be}),n.d(i,"getStyleAsNum",function(){return xe}),n.d(i,"getContainerSize",function(){return _e}),n.d(i,"getAxisTickLabelSize",function(){return we}),n.d(i,"getLabelSize",function(){return Ee}),n.d(i,"getCharSize",function(){return Se}),n.d(i,"selectOrAppend",function(){return Me}),n.d(i,"selectImmediate",function(){return Te}),n.d(i,"selectAllImmediate",function(){return Ce}),n.d(i,"sortChildren",function(){return ke}),n.d(i,"classes",function(){return Ae}),n.d(i,"dispatchMouseEvent",function(){return Oe});var a={};n.r(a),n.d(a,"translate",function(){return Pe}),n.d(a,"rotate",function(){return Le}),n.d(a,"getOrientation",function(){return Ne}),n.d(a,"parseTransformTranslate",function(){return Re}),n.d(a,"isIntersect",function(){return Fe}),n.d(a,"getDeepTransformTranslate",function(){return De}),n.d(a,"raiseElements",function(){return je});var o=n(0),s=n(2),u=n(3),l={},c={};function f(t){var e=c[t];return e||(e=function(){for(var e,n,r=this,i=0,a=[];r=r.handler;){if("function"==typeof(n=r.callbacks[t])){if(!e)for(e=[this],i=0;i=0?t.positive:t.negative,s=o[i]||0,u=s+a;return o[i]=u,{nextStack:u,prevStack:s}}},a=i({positive:{},negative:{}}),o=i({positive:{},negative:{}}),s=function(e){return te(e,t.id)},u=Number.MAX_VALUE,l=Number.MIN_VALUE,c=function(t){return u=tl?t:l,r.value(t)},f=s(function(t){return c(a(t).nextStack)}),d=s(function(t){return c(o(t).prevStack)}),h=function(e){return t.group(e)+"/"+(e[r.dim]>=0?1:-1)},p=$t(e,h),g=Object.keys(p).sort(t.flip||!t.flip&&t.obsoleteVerticalStackOrder?function(e,n){return t.order(e)-t.order(n)}:function(e,n){return t.order(n)-t.order(e)}).reduce(function(t,e){return t.concat(p[e])},[]);return g.forEach(function(t){f(t),d(t)}),r.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxu)&&(e.min=u),e}),{group:h,data:function(){return g},yi:f,y0:d}}).reg("size_distribute_evenly",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o=t.data(),s=function(t,e){return t-e},u=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,l=o.map(function(e){return t.xi(e)}).sort(s),c=l[0],f=l.slice(1).map(function(t){var e=t-c;return c=t,e}).filter(function(t){return t>0}).sort(s).concat(Number.MAX_VALUE)[0],d=Math.min(f,u),h="number"==typeof n?n:i,p={minSize:h,maxSize:"number"==typeof r?r:Math.max(h,Math.min(a,d))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("adjustStaticSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o={minSize:"number"==typeof n?n:i,maxSize:"number"==typeof r?r:a};return t.scaleSize.fixup(function(t){var e={};return t.fixed||(e.fixed=!0,e.minSize=o.minSize,e.maxSize=o.maxSize),e}),{}}).reg("adjustSigmaSizeScale",function(t,e){var n,r,i,a,o=e.minLimit,s=e.maxLimit,u=e.defMin,l=e.defMax,c=function(t,e){return t-e},f=t.data().map(function(e){return t.xi(e)}).sort(c),d=f[0],h=f.slice(1).map(function(t){var e=t-d;return d=t,e}).filter(function(t){return t>0}).sort(c).concat(Number.MAX_VALUE)[0],p=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,g=Math.min(h,p),m="number"==typeof o?o:u,y="number"==typeof s?s:l,v={minSize:m,maxSize:Math.max(m,Math.min(y,(n=g,r=(m+y)/2,i=y,a=m,Math.round(r+(i-r)/(1+Math.exp(-(n-a)/.5))))))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>v.maxSize&&(e.maxSize=v.maxSize):(e.fixed=!0,e.minSize=v.minSize,e.maxSize=v.maxSize),e}),{}}).reg("avoidScalesOverflow",function(t,e){var n,r,i=e.sizeDirection,a=function(t,e){return!t||t.discrete||"logarithmic"===t.scaleType||i.indexOf(e)<0},o=a(t.scaleX,"x"),s=a(t.scaleY,"y");if(o&&s)return{};t.scaleSize.fixup(function(t){return n=t.minSize,r=t.maxSize,t});var u=t.data().reduce(function(e,i){var a,u,l=t.size(i),c=(l>=n?l:n+l*(r-n))/2;return o||(a=t.xi(i),e.left=Math.min(e.left,a-c),e.right=Math.max(e.right,a+c)),s||(u=t.yi(i),e.top=Math.min(e.top,u-c),e.bottom=Math.max(e.bottom,u+c)),e},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE}),l=function(e,n,r,i){var a=e.domain(),o=Math.abs(e.value(a[1])-e.value(a[0])),s=(a[1]-a[0])/o;if(0===o)return 1;var u=Math.max(0,-n),l=Math.max(0,r-o),c=t.flip?l:u,f=t.flip?u:l,d=Number(a[0])-(i?f:c)*s,h=Number(a[1])+(i?c:f)*s;return e.fixup(function(t){var e={};if(t.fixedBorders){var i=t.fixedBorders.slice(),a=i[0],o=i[1];(a>n||o=0?1:-1},d=function(e,n,r){var i,a=[e,t.id(n),r].join(" ");return(i={})[s]=e,i[u]=1e-10*r,i[c]=n[c],i[l]=n[l],i[T]=!0,i[T+"id"]=a,i},h=function(t,e,n){var r=$t(e,function(t){return t[s]}),i=e[0];return t.reduce(function(t,e){return t.push.apply(t,r[e]||[d(e,i,n)]),t},[])},p=function(t,e){return t-e},g=function(){return Yt(o.reduce(function(t,e){return t.concat(e.map(function(t){return t[s]}))},[])).sort(p)},m=r?function(){var e=g(),n=Math.max.apply(Math,e.map(function(t){return Number(t)})),a=t.scaleX.domain(),o=x.generate(a[0],a[1],r,{utc:i}).filter(function(t){return t>=a[0]&&t<=a[1]}),s=0,u=[],l=x.get(r,{utc:i});return o.forEach(function(t){var r=Number(t);if(!(r>=n)){for(var i=s;i=0;n--)i=t[n+1],(r=t[n]).isCubicControl||i.isCubicControl||(t.splice(n+1,0,A(1/3,i,r),A(2/3,i,r)),t[n+1].isCubicControl=!0,t[n+2].isCubicControl=!0);var a=t.filter(function(t,e){return e%3==0}),o=e.filter(function(t,e){return e%3==0}),s=a.map(function(t){return t.id}),u=o.map(function(t){return t.id}),l=s.reduce(function(e,n){return e[n]=t.findIndex(function(t){return t.id===n}),e},{}),c=u.reduce(function(t,n){return t[n]=e.findIndex(function(t){return t.id===n}),t},{}),f=s.filter(function(t){return u.indexOf(t)>=0}),d=a.filter(function(t){return!t.positionIsBeingChanged}),h=o.filter(function(t){return!t.positionIsBeingChanged}),p=H(d,h),g=H(h,d),m=[];f.forEach(function(n,r){var i,a,o,s=l[n],u=c[n];if(0===r&&(s>0||u>0)&&m.push(L({polylineFrom:t.slice(0,s+1),polylineTo:e.slice(0,u+1),toOppositeScale:0===u?p:g,isCubic:!0})),r>0){var d=l[f[r-1]],h=c[f[r-1]];s-d>3||u-h>3?m.push(N({polylineFrom:t.slice(d,s+1),polylineTo:e.slice(h,u+1),isCubic:!0})):m.push((i={polylineFrom:t.slice(d,s+1),polylineTo:e.slice(h,u+1)},a=i.polylineFrom,o=i.polylineTo,function(t){return z(a.slice(1,3),o.slice(1,3),t)}))}m.push(R({pointFrom:t[s],pointTo:e[u]})),r===f.length-1&&(t.length-s-1>0||e.length-u-1>0)&&m.push(L({polylineFrom:t.slice(s),polylineTo:e.slice(u),toOppositeScale:e.length-u==1?p:g,isCubic:!0}))}),0===m.length&&(e.length>0&&0===f.length||t.length>0&&0===f.length)&&m.push(F({polylineFrom:t.slice(0),polylineTo:e.slice(0),isCubic:!0}));return function(t){var e=[];return m.forEach(function(n){var r=n(t);D(e,r)}),e}}:function(t,e){var n=(t=t.filter(function(t){return!t.isInterpolated})).map(function(t){return t.id}),r=e.map(function(t){return t.id}),i=n.filter(function(t){return r.indexOf(t)>=0}),a=t.filter(function(t){return!t.positionIsBeingChanged}),o=e.filter(function(t){return!t.positionIsBeingChanged}),s=H(a,o),u=H(o,a),l=[];i.forEach(function(a,o){var c=n.indexOf(a),f=r.indexOf(a);if(0===o&&(c>0||f>0)&&l.push(L({isCubic:!1,polylineFrom:t.slice(0,c+1),polylineTo:e.slice(0,f+1),toOppositeScale:0===f?s:u})),o>0){var d=n.indexOf(i[o-1]),h=r.indexOf(i[o-1]);(c-d>1||f-h>1)&&l.push(N({isCubic:!1,polylineFrom:t.slice(d,c+1),polylineTo:e.slice(h,f+1)}))}l.push(R({pointFrom:t[c],pointTo:e[f]})),o===i.length-1&&(t.length-c-1>0||e.length-f-1>0)&&l.push(L({isCubic:!1,polylineFrom:t.slice(c),polylineTo:e.slice(f),toOppositeScale:e.length-f==1?s:u}))}),0===l.length&&(e.length>0&&0===i.length||t.length>0&&0===i.length)&&l.push(F({isCubic:!1,polylineFrom:t.slice(0),polylineTo:e.slice(0)}));return function(t){var e=[];return l.forEach(function(n){var r=n(t);D(e,r)}),e}})(t,e)),r(i))}}function L(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=t.toOppositeScale,a=e.length>n.length?e:n,o=1===n.length,s=e[0].id!==n[0].id,u=Boolean(s!==o);return function(t){var e=(r?V:B)({t:t,polyline:a,decreasing:o,rightToLeft:u});o===u?e.shift():e.pop();var n=z(e.map(i),e,o?1-t:t);return n.forEach(function(t){return t.positionIsBeingChanged=!0}),n}}function N(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=e.length,a=n.length;if(a!==i){var o=a2){var i=function(t,e){for(var n,r,i=[e[0]],a=0;a0&&e0&&(t.positionIsBeingChanged=!0)}),e}}function D(t,e){return Array.prototype.push.apply(t,e)}function j(t,e,n){return void 0===e?t:"number"==typeof e?t+n*(e-t):e}function I(t,e,n){if(t===e)return e;var r={};return Object.keys(t).forEach(function(i){return r[i]=j(t[i],e[i],n)}),void 0!==e.id&&(r.id=e.id),r}function z(t,e,n){return t.map(function(t,r){return I(t,e[r],n)})}function B(t){var e=t.t,n=t.polyline,r=t.decreasing,i=t.rightToLeft,a=Boolean(r)!==Boolean(i),o=function(t,e){var n=0;if(t>0){for(var r,i,a,o,s=[0],u=0,l=1;l0){for(var i,a,o,s,u,l,c,f,d=[0],h=0,p=1;p0;a--)if((e=o[a][t])!==r)return n=s[a][t],void(d[t]=h(r,e,i,n));d[t]=function(t,e){return function(n){return n-t+e}}(r,i)}),function(t){var e=Object.assign({},t);return f.forEach(function(n){e[n]=d[n](t[n])}),e}}function W(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function G(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=O(t,n,r,i,a);return[o[1],o[2],o[4],o[5]].forEach(function(t){return t.isCubicControl=!0}),Object.keys(a).forEach(function(e){"x"!==e&&"y"!==e&&"id"!==e&&(o[3][e]=j(n[e],a[e],t))}),o}function U(t,e){if(t.length<2)return t.slice(0);if(2===t.length)return[t[0],{x:X(t[0].x,t[1].x,1/3),y:X(t[0].y,t[1].y,1/3)},{x:X(t[0].x,t[1].x,2/3),y:X(t[0].y,t[1].y,2/3)},t[1]];for(var n,r,i,a,o,s,u,l,c,f,d,h,p,g,m=new Array(3*(t.length-1)+1),y=m.length-1,v=0;v0&&(m[3*v-2]=A(1/3,t[v-1],t[v]),m[3*v-1]=A(2/3,t[v-1],t[v]));for(var b=m.slice(0),x=0;x<3;x++){for(m[1]={x:X(m[0].x,m[3].x,1/3),y:X(m[0].y,X(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:X(m[y].x,m[y-3].x,1/3),y:X(m[y].y,X(m[y-3].y,m[y-2].y,1.5),2/3)},e&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[y-1].y-m[y].y)*(m[y-3].y-m[y-2].y)<0&&(m[y-1]={x:m[y-1].x,y:m[y].y})),v=6;vn.y==u>i.y&&(p=X(p*(g=(i.y-r.y)/(u-r.y)),p,1/(1+Math.abs(g))),d=(i.y-r.y)/p),r.y>n.y==o0?[t,e].join(" "):e,u=n(i.text(s));if(us;if(c&&i){var f=Math.floor(s/l*u.length);t[t.length-1]=u.substr(0,f-4)+"...",p=!0}return c&&!i&&t.push(e),c||(t[t.length-1]=u),t},[""]).filter(function(t){return t.length>0});f=i?-1*(m.length-1)*Math.floor(.5*r):f,m.forEach(function(t,e){return o(u,t,1.1,c,f,d,e)}),h.remove()})};var nt=function(t,e,n){return e>0&&!document.hidden&&((t=t.transition(n).duration(e)).attr=rt),t.onTransitionEnd=function(t){return ot(this,t),this},t},rt=function(t,e){var n,r,i=this,a=Q.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?r=t:arguments.length>1&&((n={})[t]=e,r=n);var o="__transitionAttrs__",s="__lastTransitions__",u=at();this.each(function(){var t=this,e={};for(var n in r)"function"==typeof r[n]?e[n]=r[n].apply(this,arguments):e[n]=r[n];this[o]=Object.assign(this[o]||{},e),this[o][s]||Object.defineProperty(this[o],s,{value:{}}),Object.keys(e).forEach(function(e){return t[o][s][e]=u})});var l=function(){var t=this;this[o]&&(Object.keys(r).filter(function(e){return t[o][s][e]===u}).forEach(function(e){return delete t[o][e]}),0===Object.keys(this[o]).length&&delete this[o])};return this.on("interrupt."+u,function(){return i.each(l)}),this.on("end."+u,function(){return i.each(l)}),a},it=0,at=function(){return++it},ot=function(t,e){if(Q.transition.prototype.isPrototypeOf(t)&&!t.empty()){var n=function(){return e.call(null,t)};return t.on("interrupt.d3_on_transition_end",n),t.on("end.d3_on_transition_end",n),t}e.call(null,t)},st=function(t,e,n,r){var i=r||function(t){return t},a=function(){i(this)};return function(r){var i=r;return e&&(i=i.call(ct(Qt(e,n)))),i=(i=nt(i,t)).call(ct(n)),t>0?i.on("end.d3_animationInterceptor",function(){return i.each(a)}):i.each(a),i}},ut=function(t,e){var n=t.node();return t.selectAll(e).filter(function(){return this.parentNode===n})},lt=function(t,e,n,r,i){void 0===i&&(i="linear");var a="__pathPoints__";return function(t){var o=this;this[a]||(this[a]=n.map(function(){return[]}));var s=n.map(function(e,n){var s=Yt(t,r).map(e),u=($(i)||$("linear"))(s),l=o[a][n];return{pointsFrom:l,pointsTo:u,interpolate:P(l,u,K(i))}});return function(t){if(0===t){var n=s.map(function(t){return t.pointsFrom});return e.apply(void 0,n)}if(1===t){var r=s.map(function(t){return t.pointsTo});return o[a]=r,e.apply(void 0,r)}var i=s.map(function(e){return e.interpolate(t)});return o[a]=i,e.apply(void 0,i)}}},ct=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.attr(n,t[n])}),e}},ft=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.classed(n,t[n])}),e}},dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ht=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Qt(n.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),n.config.guide.size=n.config.guide.size||{};var r=n.config.stack,i=n.config.guide.enableColorToBarPosition,a=[e.flip&&M.get("flip"),r&&M.get("stack"),i&&M.get("positioningByColor")];return n.decorators=(n.config.transformRules||a).concat(e.transformModel||[]),n.adjusters=(n.config.adjustRules||[]).concat(e.adjustScales||[]),n}return dt(e,t),e.prototype.defineGrammarModel=function(t){var e=this,n=this.config;this.regScale("x",t("pos",n.x,[0,n.options.width])).regScale("y",t("pos",n.y,[n.options.height,0])).regScale("y",t("pos",n.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n.options.height]:[n.options.height,0]})).regScale("size",t("size",n.size,{})).regScale("color",t("color",n.color,{})).regScale("split",t("split",n.split,{})).regScale("label",t("label",n.label,{})).regScale("identity",t("identity",n.identity,{}));var r=this.getScale("x"),i=this.getScale("y"),a=this.getScale("size"),o=this.getScale("label"),s=this.getScale("color"),u=this.getScale("split"),l=this.getScale("identity"),c=i.domain(),f=i.discrete?c[0]:Math.max(0,Math.min.apply(Math,c)),d=i.value(f)+.5*i.stepSize(f),h=s.domain(),p={data:function(){return e.data()},flip:!1,scaleX:r,scaleY:i,scaleSize:a,scaleLabel:o,scaleColor:s,scaleSplit:u,scaleIdentity:l,color:function(t){return s.value(t[s.dim])},label:function(t){return o.value(t[o.dim])},group:function(t){return t[s.dim]+"(@taucharts@)"+t[u.dim]},order:function(t){var e=t.split("(@taucharts@)")[0],n=h.indexOf(e);return n<0?Number.MAX_VALUE:n},size:function(t){return a.value(t[a.dim])},id:function(t){return l.value(t[l.dim],t)},xi:function(t){return r.value(t[r.dim])},yi:function(t){return i.value(t[i.dim])},y0:function(){return d}};return p.data().forEach(function(t){return p.id(t)}),p},e.prototype.getGrammarRules=function(){return this.decorators.filter(function(t){return t})},e.prototype.getAdjustScalesRules=function(){return(this.adjusters||[]).filter(function(t){return t})},e.prototype.createScreenModel=function(t){var e=t.flip,n=function(t,e,n){return t?e:n};return{flip:e,id:t.id,x:n(e,t.yi,t.xi),y:n(e,t.xi,t.yi),x0:n(e,t.y0,t.xi),y0:n(e,t.xi,t.y0),size:t.size,group:t.group,order:t.order,label:t.label,color:function(e){return t.scaleColor.toColor(t.color(e))},class:function(e){return t.scaleColor.toClass(t.color(e))},model:t,toFibers:function(){var e=$t(t.data(),t.group);return Object.keys(e).sort(function(e,n){return t.order(e)-t.order(n)}).reduce(function(t,n){return t.concat([e[n]])},[])}}},e.prototype.drawFrames=function(){var t=this,e=this.config.options,n=function(e){return n=t.screenModel.size(e)/2,r=4,i=Math.pow(10,r),Math.round(i*n)/i;var n,r,i},r=st,i=function(e,n,i){var a=t.config.guide.animationSpeed,s=e.selectAll("."+n).data(function(t){return[t]},t.screenModel.id);s.exit().call(r(a,null,{width:0},function(t){return o.select(t).remove()})),s.call(r(a,null,i)),s.enter().append("rect").style("stroke-width",0).call(r(a,{width:0},i))},a=this.config.flip,s=a?"y":"x",u=a?"x":"y",l=a?"x0":"y0",c=a?"height":"width",f=a?"width":"height",d=function(e){var r,a,o;i(e,"lvl-top",((r={})[c]=function(t){return n(t)},r[f]=1,r[s]=function(e){return t.screenModel[s](e)-n(e)/2},r[u]=function(e){return t.screenModel[u](e)},r.fill=function(e){return t.screenModel.color(e)},r.class=function(e){return"lvl-top "+t.screenModel.class(e)},r)),i(e,"lvl-btm",((a={})[c]=function(t){return n(t)},a[f]=1,a[s]=function(e){return t.screenModel[s](e)-n(e)/2},a[u]=function(e){return t.screenModel[l](e)},a.fill=function(e){return t.screenModel.color(e)},a.class=function(e){return"lvl-btm "+t.screenModel.class(e)},a)),i(e,"lvl-link",((o={})[c]=.5,o[f]=function(e){return Math.abs(t.screenModel[u](e)-t.screenModel[l](e))},o[s]=function(e){return t.screenModel[s](e)-.25},o[u]=function(e){return Math.min(t.screenModel[u](e),t.screenModel[l](e))},o.fill=function(e){return t.screenModel.color(e)},o.class=function(e){return"lvl-link "+t.screenModel.class(e)},o))},h=function(e){e.attr("class","frame-id-"+t.config.uid).call(function(e){var n=e.selectAll(".generic").data(function(t){return t},t.screenModel.id);n.exit().remove(),n.call(d),n.enter().append("g").attr("class","generic").call(d)})},p=$t(this.data(),t.screenModel.group),g=Object.keys(p).sort(function(e,n){return t.screenModel.order(e)-t.screenModel.order(n)}).reduce(function(t,e){return t.concat([p[e]])},[]),m=e.container.selectAll(".frame-id-"+t.config.uid).data(g);m.exit().remove(),m.call(h),m.enter().append("g").call(h)},e}(m),pt=function(){return(pt=Object.assign||function(t){for(var e,n=1,r=arguments.length;nthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,n),this.depth--,n}},r.DeepCopier=e,r.deepCopiers=t,r.register=function(n){n instanceof e||(n=new e(n)),t.unshift(n)},r.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?"object"==typeof(e=t.constructor.prototype)?JSON.parse(JSON.stringify(e)):e:{};var e},populate:function(t,e,n){for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}}),r.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,n){for(var r=0;r":">",'"':""","'":"'","`":"`"},wt={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Et=/\\|'|\r|\n|\u2028|\u2029/g,St="(?:"+Object.keys(_t).join("|")+")",Mt=RegExp(St),Tt=RegExp(St,"g"),Ct={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function kt(t){return vt(t)}function At(t){return t instanceof Date&&!isNaN(Number(t))}function Ot(t){return null!=t&&"object"==typeof t}function Pt(t){var e=parseFloat(Math.min.apply(Math,t).toFixed(15)),n=parseFloat(Math.max.apply(Math,t).toFixed(15));e===n&&(n-=(n>=0?-1:1)*(n||1)/10);for(var r=[e=Math.min(0,e),n=Math.max(0,n)],i=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(i/10)/Math.LN10)),o=10/i*a,s=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],u=-1;o>s[++u][0];);a*=s[u][1],r[0]=Math.floor(r[0]/a)*a,r[1]=Math.ceil(r[1]/a)*a;var l=e-r[0],c=r[1]-n,f=a/2;if(e<0){var d=l>=f?-l:0;r[0]=r[0]-d}if(n>0){var h=c>=f?-c:0;r[1]=r[1]+h}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Lt(t,e,n){var r=(void 0===n?{utc:!1}:n).utc,i=gt.extent(t),a=i[0],o=i[1],s=+o-+a,u=r?gt.scaleUtc:gt.scaleTime;if(0===s){return a=new Date(a.getTime()-864e5),o=new Date(o.getTime()+864e5),u().domain([a,o]).nice(e).domain()}var l=u().domain([a,o]).nice(e);if(e)return l.domain();var c=u().domain([a,o]).nice(e).domain(),f=c[0],d=c[1],h=l.ticks(),p=h.length-1;return(+a-+f)/(+h[1]-+f)<.5&&(a=f),(+d-+o)/(+d-+h[p-1])<.5&&(o=d),[a,o]}var Nt=0,Rt={};function Ft(t){var e=btoa(encodeURIComponent(t)).replace(/=/g,"_");return Rt.hasOwnProperty(e)||(Rt[e]="H"+ ++Nt),Rt[e]}function Dt(t,e,n){var r=0,i=null,a=te(function(t,e){return Yt(t.map(function(t){return e.reduce(function(e,n){return e.concat(At(r=t[n])?r.getTime():r);var r},[])}),function(t){return JSON.stringify(t)}).reduce(function(t,e){var n=e[0];return t[n]=t[n]||0,t[n]+=1,t},{})},function(t,e){var n=i===t?r:++r;return i=t,e.join("")+"-"+n});return function(r,i,o){var s=o.length,u=n.getSpec(),l=u.sources["/"].data,c=u.unit.units[0].guide||{};c.padding=c.padding||{l:0,r:0,t:0,b:0};var f=0;"x"===t?f=c.padding.l+c.padding.r:"y"===t&&(f=c.padding.t+c.padding.b);var d,h=(i-s*f)/(d=a(l,e),Object.keys(d).reduce(function(t,e){return t+d[e]},0));return(function(t,e){return a(l,t)[e]}(e,r)*h+f)/i}}function jt(t){var e=!0;try{yt(t,function(t){if(0===t.type.indexOf("COORDS.")&&"COORDS.RECT"!==t.type)throw new Error("Not applicable")},function(t){return t})}catch(t){"Not applicable"===t.message&&(e=!1)}return e}function It(t,e,n,r){if(void 0===r&&(r=0),"requestAnimationFrame"===r){var i=!1;return function(){for(var r=[],a=0;a=r&&n.apply(this,i),t.e=o.e,t.ts=o.ts}}function zt(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=e>=2?Gt(e-2).map(function(t){return n+i*(t+1)}):[];return[n].concat(a,[r])}function Bt(t){return bt(t)?t:""}function Vt(t){return bt(t)?"":t}function Ht(t){return t/180*Math.PI}function Wt(t){return Math.abs(t)>=360&&(t%=360),t<0&&(t=360+t),t}function Gt(t,e){1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r100}function Xt(t,e,n,r){return t+e*(-90===n?-1:1)-r>20}function qt(t){return Array.isArray(t)?[].concat.apply([],t.map(function(t){return qt(t)})):t}function Yt(t,e){for(var n={},r=[],i=t.length,a=e||function(t){return String(t)},o=0;o/g,">").replace(/"/g,""").replace(/'/g,"'")}var oe=" ",se=32,ue=["img","input","br","embed","link","meta","area","base","basefont","bgsound","col","command","frame","hr","image","isindex","keygen","menuitem","nextid","param","source","track","wbr","circle","ellipse","line","path","polygon","rect"].reduce(function(t,e){return t[e]=!0,t},{});function le(t){var e=2,n=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(e=1,n={});var r=qt(Array.prototype.slice.call(arguments,e)),i=1===r.length&&"<"!==r[0].trim()[0],a=ue[t];if(a&&r.length>0)throw new Error('Tag "'+t+'" is void but content is assigned to it');var o="<"+t,s=Object.keys(n).map(function(t){return" "+t+'="'+n[t]+'"'}).join("");s.length>se&&(s=Object.keys(n).map(function(t){return"\n"+oe+t+'="'+n[t]+'"'}).join(""));var u=i?r[0]:"\n"+r.map(function(t){return String(t).split("\n").map(function(t){return""+oe+t}).join("\n")}).join("\n")+"\n";return""+o+s+(a?"/>":">"+u+"")}function ce(t){var e=t,n={then:function(t){return e=t(e),n},result:function(){return e}};return n}var fe=[ht];function de(t){return fe.some(function(e){return t instanceof e})}function he(t){return(t.units||[]).some(function(t){return t.hasOwnProperty("units")})}var pe=document.createElement("div"),ge=new WeakMap;function me(t,e){var n;return t instanceof Node?n=t:(pe.insertAdjacentHTML("afterbegin",t),n=pe.childNodes[0]),e.appendChild(n),n}function ye(t){if(ge.has(t))return ge.get(t);var e=t.style.overflow;t.style.overflow="scroll";var n={width:t.offsetWidth-t.clientWidth,height:t.offsetHeight-t.clientHeight};return t.style.overflow=e,ge.set(t,n),n}function ve(t,e){var n="horizontal"===(e=e||"both")||"both"===e,r="vertical"===e||"both"===e,i=ye(t),a=r?i.width+"px":"0",o=n?i.height+"px":"0";t.style.overflow="hidden",t.style.padding="0 "+a+" "+o+" 0";var s=t.scrollWidth>t.clientWidth,u=t.scrollHeight>t.clientHeight,l=r&&!u?i.width+"px":"0",c=n&&!s?i.height+"px":"0";return t.style.padding="0 "+l+" "+c+" 0",t.style.overflow="",t.style.overflowX=s?"scroll":"hidden",t.style.overflowY=u?"scroll":"hidden",i}function be(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function xe(t,e){return parseInt(be(t,e)||"0",10)}function _e(t){var e=xe(t,"padding-left"),n=xe(t,"padding-right"),r=xe(t,"padding-bottom"),i=xe(t,"padding-top"),a=xe(t,"border-top-width")+xe(t,"border-left-width")+xe(t,"border-right-width")+xe(t,"border-bottom-width"),o=t.getBoundingClientRect();return{width:o.width-e-n-2*a,height:o.height-r-i-2*a}}function we(t){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",e.style.width="100px",e.style.height="100px",e.style.border="1px solid green",e.style.top="0",document.body.appendChild(e),e.innerHTML='\n \n \n \n \n \n ';var n=e.querySelector(".x.axis .tick text");n.textContent=t;var r={width:0,height:0},i=n.getBoundingClientRect();r.width=i.right-i.left,r.height=i.bottom-i.top;var a=0!==t.length?r.width/t.length:0;return r.width=r.width+1.5*a,document.body.removeChild(e),r}function Ee(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,a="string"==typeof n?n:n+"px",o=t.map(function(t){for(var e=0,n=0;e<=t.length-1;e++){n+=Se(t.charAt(e),{fontSize:a,fontFamily:r,fontWeight:i}).width}return n}).sort(function(t,e){return e-t})[0],s=t.length,u=parseInt(a);return{width:o,height:u*s+.39*u*s}}var Se=te(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,a=document.createElement("div");a.style.position="absolute",a.style.visibility="hidden",a.style.border="0px",a.style.top="0",a.style.fontSize=n,a.style.fontFamily=r,a.style.fontWeight=i,document.body.appendChild(a),a.innerHTML=" "===t?" ":t;var o={width:0,height:0},s=a.getBoundingClientRect();return o.width=s.right-s.left,o.height=s.bottom-s.top,document.body.removeChild(a),o},function(t,e){return t+"_"+JSON.stringify(e)});function Me(t,e){var n={".":function(t,e){return e.classed(t,!0)},"#":function(t,e){return e.attr("id",t)}},r=Object.keys(n).join("");if(e.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(e[0])>=0)throw new Error("Selector must have tag at the beginning.");var i,a=t instanceof Element,s=a?o.select(t):t,u=function(t){return a?t.node():t},l=s.selectAll(e).filter(function(){return this.parentNode===s.node()}).filter(function(t,e){return 0===e});if(!l.empty())return u(l);for(var c,f=-1,d=null,h=1,p=e.length;h<=p;h++)(h==p||r.indexOf(e[h])>=0)&&(c=e.substring(f+1,h),f<0?i=s.append(c):n[d].call(null,c,i),d=e[h],f=h);return u(i)}function Te(t,e){return Ce(t,e)[0]||null}function Ce(t,e){for(var n=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=t.firstElementChild;Boolean(i);i=i.nextElementSibling)r.call(i,e)&&n.push(i);return n}function ke(t,e){if(t.childElementCount>0){var n,r,i=Array.prototype.filter.call(t.childNodes,function(t){return t.nodeType===Node.ELEMENT_NODE}),a=i.slice().sort(e),o=i.reduce(function(t,e,n){return t.set(e,n),t},new Map),s=a.reduce(function(t,e,i){var s=o.get(e),u=i-s;return u!==r&&(n&&t.push(n),r=u,n={from:s,to:i,elements:[]}),n.elements.push(e),i===a.length-1&&t.push(n),t},[]),u=s.slice().sort(function(t,e){return t.from-e.from}),l=u.reduce(function(t,e,n){return t.set(e,n),t},new Map),c=function(t){for(var e,n,r,i=s.map(function(t,e){return{elements:t.elements,from:l.get(t),to:e}}).sort(ee(function(t,e){return t.elements.length-e.elements.length},t?function(t,e){return e.to-t.to}:function(t,e){return t.to-e.to})),a=0;an.to)for(e=a+1;e=n.to&&r.fromn.from&&r.from<=n.to&&r.from--}return i.filter(function(t){return t.from!==t.to})},f=c(!0),d=c(!1),h=f.length=0?"h":"v"}function Re(t){var e={x:0,y:0},n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}return e}function Fe(t,e,n,r,i,a,o,s){var u,l,c,f,d,h;return h=((c=o-i)*(e-a)-(f=s-a)*(t-i))/(-c*(l=r-e)+(u=n-t)*f),(d=(-l*(t-i)+u*(e-a))/(-c*l+u*f))>=0&&d<=1&&h>=0&&h<=1}function De(t){for(var e,n,r={x:0,y:0},i=t;i&&"SVG"!==i.nodeName.toUpperCase();)(n=i.getAttribute("transform"))&&(e=Re(n),r.x+=e.x,r.y+=e.y),i=i.parentNode;return r}function je(t,e,n){var r=t.selectAll(e).filter(n);if(!r.empty()){var i=o.select(r.node().parentNode).selectAll(e).filter(function(t){return!n(t)}).nodes(),a=i[i.length-1];if(a){var s=Array.prototype.indexOf.call(a.parentNode.childNodes,a),u=a.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>s||this.parentNode.insertBefore(this,u)})}}}var Ie=function(t){return At(t)?t.getTime():t},ze={cross:function(t,e,n){var r=t(),i=Yt(r.map(function(t){return t[e]}),Ie),a=Yt(r.map(function(t){return t[n]}),Ie),o=0===i.length?[null]:i;return(0===a.length?[null]:a).reduce(function(t,r){return t.concat(o.map(function(t){var i={};return e&&(i[e]=Ie(t)),n&&(i[n]=Ie(r)),i}))},[])},cross_period:function(t,e,n,r,i,a){var o=t(),s=!!a&&a.utcTime,u=Yt(o.map(function(t){return t[e]}),Ie),l=Yt(o.map(function(t){return t[n]}),Ie),c=0===u.length?[null]:u,f=0===l.length?[null]:l;return r&&(c=x.generate(Math.min.apply(Math,u),Math.max.apply(Math,u),r,{utc:s})),i&&(f=x.generate(Math.min.apply(Math,l),Math.max.apply(Math,l),i,{utc:s})),f.reduce(function(t,r){return t.concat(c.map(function(t){var i={};return e&&(i[e]=Ie(t)),n&&(i[n]=Ie(r)),i}))},[])},groupBy:function(t,e){return Yt(t().map(function(t){return t[e]}),Ie).map(function(t){var n;return(n={})[e]=Ie(t),n})},none:function(){return[null]}},Be=function(){function t(t,e,n){var r=t.key,i=t.pipe,a=t.source,o=t.units;void 0===n&&(n={}),this.key=r,this.pipe=i||[],this.source=a,this.units=o,this._frame={key:r,source:a,pipe:this.pipe},this._data=e,this._pipeReducer=function(t,e){return n[e.type](t,e.args)}}return t.prototype.hash=function(){return Ft([this._frame.pipe,this._frame.key,this._frame.source].map(function(t){return JSON.stringify(t)}).join(""))},t.prototype.full=function(){return this._data},t.prototype.part=function(t){return void 0===t&&(t=function(t){return t}),this._frame.pipe.map(t).reduce(this._pipeReducer,this._data)},t}(),Ve=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),He=function(t){return At(t)?t.getTime():t},We=function(t){var e=this;Object.keys(t).forEach(function(n){return e[n]=t[n]})},Ge=function(t,e,n){return t.map(function(t){return"string"==typeof t?n.get(t):t}).filter(function(t){return t}).reduce(function(t,e){return n=t,void 0===(r=e(t,{}))&&(r={}),Object.assign(new We(n),r);var n,r},e)},Ue=function(t){function e(e,n,r,i){var a=t.call(this)||this;return Qt(e.scales,{size_null:{type:"size",source:"?"},split_null:{type:"value",source:"?"},label_null:{type:"value",source:"?"},color_null:{type:"color",source:"?"},identity_null:{type:"identity",source:"?"},"size:default":{type:"size",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"},"label:default":{type:"value",source:"?"},"identity:default":{type:"identity",source:"?"}}),e.settings=e.settings||{},a.config=e,a.sources=e.sources,a.scales=e.scales,a.unitSet=r,a.grammarRules=i,a.scalesHub=n,a.transformations=Object.assign(e.transformations||{},{where:function(t,e){var n=Object.keys(e||{}).map(function(t){return function(n){return He(n[t])===e[t]}});return t.filter(function(t){return n.every(function(e){return e(t)})})}}),a}return Ve(e,t),e.traverseSpec=function(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null);var a=[],o=function(t,e,n,r,i){a.push(function(){e(t,r,i)}),t.frames&&t.frames.forEach(function(r){(r.units||[]).map(function(i){return o(i,e,n,t,r)})}),a.push(function(){return n(t,r,i)})};return o(t.unit,e,n,r,i),a},e.prototype.unfoldStructure=function(){return this.root=this._expandUnitsStructure(this.config.unit),this.config},e.prototype.getDrawScenarioQueue=function(t){var e=this,n=this.grammarRules,r=this._flattenDrawScenario(t,function(t,r,i){var a=!1===r.expression.inherit?null:i,o=e._createFrameScalesFactoryMethod(a),s=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),u=new We(s.defineGrammarModel(o)),l=Ge(s.getGrammarRules(),u,n);return Ge(s.getAdjustScalesRules(),l,n),s.node().screenModel=s.createScreenModel(l),s}),i=this._flattenDrawScenario(t,function(t,r,i){var a=!1===r.expression.inherit?null:i,o=e._createFrameScalesFactoryMethod(a),s=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),u=new We(s.defineGrammarModel(o)),l=Ge(s.getGrammarRules(),u,n);return s.node().screenModel=s.createScreenModel(l),s.parentUnit=t,s.addInteraction(),s});return r.concat(function(){Object.keys(e.scales).forEach(function(t){return e.scalesHub.createScaleInfo(e.scales[t]).commit()})}).concat(i)},e.prototype._flattenDrawScenario=function(t,n){var r={},i=[],a=[t],o=e.traverseSpec({unit:this.root},function(t,e,o){var s;t.uid=(s=Ft((e?e.uid+"/":"")+JSON.stringify(Object.keys(t).filter(function(e){return"string"==typeof t[e]}).reduce(function(e,n){return e[n]=t[n],e},{}))+"-"+JSON.stringify(o.pipe)),r.hasOwnProperty(s)?s+="-"+ ++r[s]:r[s]=0,s),t.guide=kt(t.guide);var u,l=n(a[0],t,o);i.push(l),0===t.type.indexOf("COORDS.")&&(u=l,a.unshift(u))},function(t){0===t.type.indexOf("COORDS.")&&a.shift()},null,this._datify({source:this.root.expression.source,pipe:[]}));return o.push(function(){return i}),o},e.prototype._expandUnitsStructure=function(t,e){var n=this;void 0===e&&(e=[]);var r=this;if(!1===t.expression.operator)t.frames=t.frames.map(function(t){return r._datify(t)});else{var i=this._parseExpression(t.expression,e,t.guide);t.transformation=t.transformation||[],t.frames=i.exec().map(function(n){var a=(i.inherit?e:[]).concat([{type:"where",args:n}]).concat(t.transformation);return r._datify({key:n,pipe:a,source:i.source,units:t.units?t.units.map(function(t){var e=kt(t);return e.guide=t.guide,e}):[]})})}return t.frames.forEach(function(t){return t.units.forEach(function(e){return n._expandUnitsStructure(e,t.pipe)})}),t},e.prototype._createFrameScalesFactoryMethod=function(t){var e=this;return function(n,r,i){var a=r||n+":default";return e.scalesHub.createScaleInfo(e.scales[a],t).create("function"==typeof i?i(e.scales[a]):i)}},e.prototype._datify=function(t){return new Be(t,this.sources[t.source].data,this.transformations)},e.prototype._parseExpression=function(t,e,n){var r=this,i=t.operator||"none",a=t.source,o=!1!==t.inherit,s=t.params,u={source:a,pipe:o?e:[]},l=function(){return r._datify(u).part()},c=ze[i];if(!c)throw new Error(i+" operator is not supported");return{source:a,inherit:o,func:c,args:s,exec:function(){return c.apply(void 0,[l].concat(s||[],[n]))}}},e}(h),Xe="tau-chart__",qe=n(10),Ye=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();qe.Tooltip.defaults.baseClass=Xe+"tooltip";var $e=["top","bottom"];var Ke,Je,Qe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ye(e,t),e.prototype._pickPlace=function(t){if(!this.options.auto)return this.options.place;var e,n,r,i,a,o,s,u,l=0|this.options.winBound,c=(e=l,r=window,i=document.documentElement,a=(r.pageYOffset||i.scrollTop)-i.clientTop,o=(r.pageXOffset||i.scrollLeft)-i.clientTop,s=r.innerWidth||i.clientWidth,u=r.innerHeight||i.clientHeight,{top:(n={top:a,right:o+s,bottom:a+u,left:o,width:s,height:u}).top+e,right:n.right-e,bottom:n.bottom-e,left:n.left+e,width:n.width-2*e,height:n.height-2*e}),f=this.options.place.split("-"),d=this.spacing;if(-1!==$e.indexOf(f[0]))switch(t.top-this.height-d<=c.top?f[0]="bottom":t.bottom+this.height+d>=c.bottom&&(f[0]="top"),f[1]){case"left":t.right-this.width<=c.left&&(f[1]="right");break;case"right":t.left+this.width>=c.right&&(f[1]="left");break;default:t.left+t.width/2+this.width/2>=c.right?f[1]="left":t.right-t.width/2-this.width/2<=c.left&&(f[1]="right")}else switch(t.left-this.width-d<=c.left?f[0]="right":t.right+this.width+d>=c.right&&(f[0]="left"),f[1]){case"top":t.bottom-this.height<=c.top&&(f[1]="bottom");break;case"bottom":t.top+this.height>=c.bottom&&(f[1]="top");break;default:t.top+t.height/2+this.height/2>=c.bottom?f[1]="top":t.bottom-t.height/2-this.height/2<=c.top&&(f[1]="bottom")}return f.join("-")},e}(qe.Tooltip),Ze=function(){function t(t,e){this.chart=e,this.handlers=new Map,this.plugins=t.map(this.initPlugin,this)}return t.prototype.initPlugin=function(t){var e=this;t.init&&t.init(this.chart);var n=[];this.handlers.set(t,n);var r=function(r,i){n.push(e.chart.on(r,i,t))};return t.destroy&&r("destroy",t.destroy.bind(t)),Object.keys(t).forEach(function(e){if(0===e.indexOf("on")){var n=e.substr(2).toLowerCase();r(n,t[e].bind(t))}}),t},t.prototype.destroyPlugin=function(t){var e=this;t.destroy&&t.destroy(),this.handlers.get(t).forEach(function(n){e.chart.removeHandler(n,t)})},t.prototype.destroy=function(){var t=this;this.plugins.forEach(function(e){return t.destroyPlugin(e)})},t}(),tn={},en={},nn={reg:function(t,e,n){return n?(en[t]=n,tn[t]=function(t,e){this.___tauchartsseed___=new e(this.init(t))},tn[t].prototype=Object.assign({init:function(t){return t},defineGrammarModel:function(t){return this.node().defineGrammarModel(t)},getGrammarRules:function(t){return this.node().getGrammarRules(t)},getAdjustScalesRules:function(t){return this.node().getAdjustScalesRules(t)},createScreenModel:function(t){return this.node().createScreenModel(t)},addInteraction:function(){this.node().addInteraction()},node:function(){return this.___tauchartsseed___},draw:function(){this.node().draw()}},e)):tn[t]=e,this},get:function(t){if(!tn.hasOwnProperty(t))throw new w("Unknown unit type: "+t,E.UNKNOWN_UNIT_TYPE);return tn[t]},create:function(t,e){var n,r=this.get(t);en[t]?n=new r(e,this.get(en[t])):n=new r(e);return n}},rn={},an={},on={reg:function(t,e,n){return void 0===n&&(n=function(t){return t}),rn[t]=e,an[t]=n,on},get:function(t){return rn[t]},instance:function(t){return void 0===t&&(t={}),{create:function(e,n,r){return new(on.get(e))(n,(0,an[e])(r,t))}}}},sn=function(){function t(t,e,n){this.registry=t,this.sources=e,this.scales=n}return t.prototype.createScaleInfo=function(t,e){void 0===e&&(e=null);var n=t.dim,r=t.source,i=(this.sources[r].dims[n]||{}).type,a=this.sources[r].data,o=e||new Be({source:r},a);return t.dimType=i,this.registry.create(t.type,o,t)},t.prototype.createScaleInfoByName=function(t,e){return void 0===e&&(e=null),this.createScaleInfo(this.scales[t],e)},t}(),un=function(t,e,n){var r=!0,i=null;try{t.reduce(function(t,r){var a=function(t,e){var n=r[e],i=Ot(n)?JSON.stringify(n):n;return t.push(i),t},o=e.reduce(a,[]).join("/"),s=n.reduce(a,[]).join("/");if(t.hasOwnProperty(o)){var u=t[o];if(u!==s)throw i={type:"RelationIsNotAFunction",keyX:e.join("/"),keyY:n.join("/"),valX:o,errY:[u,s]},new Error("RelationIsNotAFunction")}else t[o]=s;return t},{})}catch(t){if("RelationIsNotAFunction"!==t.message)throw t;r=!1}return{result:r,error:i}},ln=function(t,e){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||e.push(n),e},[]);return function(t){var r=!n.some(function(e){return!t.hasOwnProperty(e)||null===t[e]});return r||e(t),r}},cn=function(t){var e={category:"ordinal",order:"ordinal",measure:"linear"},n={};return Object.keys(t).forEach(function(r){var i=t[r],a=(i.type||"category").toLowerCase();n[r]=Object.assign({},i,{type:a,scale:i.scale||e[a],value:i.value})}),n},fn=function(t){var e={type:"category",scale:"ordinal"};return t.reduce(function(t,n){return Object.keys(n).forEach(function(r){var i=n.hasOwnProperty(r)?n[r]:null;if(t[r]=t[r]||{type:null,hasNull:!1},null===i)t[r].hasNull=!0;else{var a=function(t,e){var n=e;return At(t)?(n.type="measure",n.scale="time"):Ot(t)?(n.type="order",n.scale="ordinal"):Number.isFinite(t)&&(n.type="measure",n.scale="linear"),n}(i,kt(e)),o=a.type,s=a.scale,u=null!==t[r].type&&t[r].type!==o;t[r].type=u?e.type:o,t[r].scale=u?e.scale:s}}),t},{})},dn=function(t,e,n){var r=t,i=["period","time"].indexOf(n.scale)>=0?function(t){return new Date(t)}:function(t){return t},a=t.reduce(function(t,e,n){return t.set(e,n),t},new Map);if("measure"===n.type||"period"===n.scale)r=t.slice().sort(ee(function(t,n){return i(t[e])-i(n[e])},function(t,e){return a.get(t)-a.get(e)}));else if(n.order){var o=n.order.reduce(function(t,e,n){return t[e]=n,t},{}),s=n.order.length,u="(___"+e+"___)";r=t.map(function(t){var n=o[t[e]];return n=n>=0?n:s,t[u]=n,t}).sort(ee(function(t,e){return t[u]-e[u]},function(t,e){return a.get(t)-a.get(e)})).map(function(t){return delete t[u],t})}return r},hn=function(t,e){var n=document.createElement("div");return n.classList.add(Xe+t),e&&e.appendChild(n),n},pn=function(){var t=hn("layout"),e=hn("layout__header",t),n=hn("layout__container",t),r=hn("layout__sidebar",n),i=hn("layout__content",n),a=hn("layout__content__wrap",i),o=hn("layout__sidebar-right",n);return{layout:t,header:e,content:a,contentContainer:i,leftSidebar:r,rightSidebar:hn("layout__sidebar-right__wrap",o),rightSidebarContainer:o,footer:hn("layout__footer",t)}},gn=function(){function t(t){this.spec=t,this.dist={sources:{"?":{dims:{},data:[{}]},"/":{dims:{},data:[]}},scales:{x_null:{type:"ordinal",source:"?"},y_null:{type:"ordinal",source:"?"},size_null:{type:"size",source:"?"},color_null:{type:"color",source:"?"},split_null:{type:"value",source:"?"},"pos:default":{type:"ordinal",source:"?"},"size:default":{type:"size",source:"?"},"label:default":{type:"value",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"}},settings:t.settings}}return t.prototype.convert=function(){var t=this.spec,e=this.dist;return this.ruleAssignSourceDims(t,e),this.ruleAssignStructure(t,e),this.ruleAssignSourceData(t,e),this.ruleApplyDefaults(e),e},t.prototype.ruleApplyDefaults=function(t){var e=t.settings||{},n=function(t,e,r){e(t,r),(t.units||[]).map(function(r){return n(r,e,t)})};n(t.unit,function(t,n){if(t.namespace="chart",t.guide=Qt(t.guide||{},{animationSpeed:e.animationSpeed||0,utcTime:e.utcTime||!1}),n&&!t.hasOwnProperty("units")){t=Qt(t,{x:n.x,y:n.y});var r=kt(n.guide)||{};t.guide.x=Qt(t.guide.x||{},r.x),t.guide.y=Qt(t.guide.y||{},r.y),t.expression.inherit=n.expression.inherit}return!n||t.guide&&t.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(t.guide=Object.assign(t.guide||{},{obsoleteVerticalStackOrder:(n.guide||{}).obsoleteVerticalStackOrder})),t},null)},t.prototype.ruleAssignSourceData=function(t,e){var n=t.spec.dimensions||{},r=e.sources["/"].dims,i=function(t,e){var n=t[e];return Ot(n)&&!At(n)&&Object.keys(n).forEach(function(r){return t[e+"."+r]=n[r]}),t};e.sources["/"].data=t.data.map(function(t){var e=Object.keys(t).reduce(i,t);return Object.keys(r).reduce(function(t,e){return t.hasOwnProperty(e)||(t[e]=null),null!==t[e]&&n[e]&&["period","time"].indexOf(n[e].scale)>=0&&(t[e]=new Date(t[e])),t},e)})},t.prototype.ruleAssignSourceDims=function(t,e){var n=t.spec.dimensions;e.sources["/"].dims=Object.keys(n).reduce(function(t,e){return t[e]={type:n[e].type},t},{})},t.prototype.ruleAssignStructure=function(t,e){var n=this,r=function(t){var i=kt(Zt(t,"unit"));return n.ruleCreateScales(t,i,e.settings),i.expression=n.ruleInferExpression(t),t.unit&&(i.units=t.unit.map(r)),i},i=r(t.spec.unit);i.expression.inherit=!1,e.unit=i},t.prototype.ruleCreateScales=function(t,e,n){var r=this,i=t.guide||{};["identity","color","size","label","x","y","split"].forEach(function(a){t.hasOwnProperty(a)&&(e[a]=r.scalesPool(a,t[a],i[a]||{},n))})},t.prototype.ruleInferDim=function(t,e){var n=t,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(n))return n;e.hasOwnProperty("tickLabel")?n=t+"."+e.tickLabel:r[t].value&&(n=t+"."+r[t].value);var i=this.dist.sources["/"].dims;return i.hasOwnProperty(n)||(i[n]={type:i[t].type},delete i[t]),n},t.prototype.scalesPool=function(t,e,n,r){var i=t+"_"+e;if(this.dist.scales.hasOwnProperty(i))return i;var a=this.spec.spec.dimensions,o={};if("color"===t&&null!==e&&(o={type:"color",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("brewer")&&(o.brewer=n.brewer),a[e]&&a[e].hasOwnProperty("order")&&(o.order=a[e].order),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("nice")&&(o.nice=n.nice)),"size"===t&&null!==e&&(o={type:"size",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("func")&&(o.func=n.func),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("minSize")&&(o.minSize=n.minSize),n.hasOwnProperty("maxSize")&&(o.maxSize=n.maxSize)),"label"===t&&null!==e&&(o={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"split"===t&&null!==e&&(o={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"identity"===t&&null!==e&&(o={type:"identity",source:"/",dim:this.ruleInferDim(e,n)}),a.hasOwnProperty(e)&&("x"===t||"y"===t)){if(o={type:a[e].scale,source:"/",dim:this.ruleInferDim(e,n)},a[e].hasOwnProperty("order")&&(o.order=a[e].order),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("autoScale")?o.autoScale=n.autoScale:o.autoScale=!0,n.hasOwnProperty("nice")?o.nice=n.nice:o.nice=o.autoScale,n.hasOwnProperty("niceInterval")?o.niceInterval=n.niceInterval:o.niceInterval=null,n.hasOwnProperty("tickPeriod")&&(o.period=n.tickPeriod,o.type="period"),n.hasOwnProperty("tickPeriod")&&n.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(n.hasOwnProperty("timeInterval")){o.period=n.timeInterval,o.type="time";var s=x.get(o.period,{utc:r.utcTime});n.hasOwnProperty("min")&&(o.min=s.cast(new Date(n.min))),n.hasOwnProperty("max")&&(o.max=s.cast(new Date(n.max)))}o.fitToFrameByDims=n.fitToFrameByDims,o.ratio=n.ratio}return this.dist.scales[i]=o,i},t.prototype.getScaleConfig=function(t,e){var n=t+"_"+e;return this.dist.scales[n]},t.prototype.ruleInferExpression=function(t){var e={operator:"none",params:[]},n=t.guide||{},r=n.x||{},i=n.y||{},a=this.getScaleConfig("x",t.x),o=this.getScaleConfig("y",t.y);return 0===t.type.indexOf("ELEMENT.")?t.color&&(e={operator:"groupBy",params:[this.ruleInferDim(t.color,n.color||{})]}):"COORDS.RECT"===t.type&&1===t.unit.length&&"COORDS.RECT"===t.unit[0].type&&(e=a.period||o.period?{operator:"cross_period",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i),a.period,o.period]}:{operator:"cross",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i)]}),Object.assign({inherit:!0,source:"/"},e)},t}(),mn=n(6),yn=n(7),vn=function(){return(vn=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.computed?{value:n,computed:r}:t},{}).value;return n(e(a))},Ln=function(t,e){var n=t.dimType,r=t.scaleType,i=[n,r,"*"].join(":"),a=[n,r].join(":");return e[i]||e[a]||e[n]||null},Nn=function(t,e,n){return t.hasOwnProperty(e+":"+n)?t[e+":"+n]:t[""+e]},Rn=function(t,e){return["day","week","month"].indexOf(t)>=0&&(t+="-short"+(e?"-utc":"")),t},Fn=function(t,e){var n=t.width,r=t.height,i=Math.abs(Ht(e));return{width:Math.max(Math.cos(i)*n,r),height:Math.max(Math.sin(i)*n,r)}},Dn=function(t,e){void 0===e&&(e="x");var n=Wt(t),r="x"===e?[[0,45,"middle"],[45,135,"start"],[135,225,"middle"],[225,315,"end"],[315,360,"middle"]]:[[0,90,"end"],[90,135,"middle"],[135,225,"start"],[225,315,"middle"],[315,360,"end"]],i=r.findIndex(function(t){return n>=t[0]&&ne.xAxisTickLabelLimit&&(t.x.tickFormatWordWrap=!0,t.x.tickFormatWordWrapLines=e.xTickWordWrapLinesLimit,d=jn(c,e.xAxisTickLabelLimit,e.xTickWordWrapLinesLimit)),f.width>e.yAxisTickLabelLimit&&(t.y.tickFormatWordWrap=!0,t.y.tickFormatWordWrapLines=e.yTickWordWrapLinesLimit,h=jn(f,e.yAxisTickLabelLimit,e.yTickWordWrapLinesLimit)),a&&(t.y.tickFormatWordWrap=!1,t.y.tickFormatWordWrapLines=1,(h=jn(f,2*e.yAxisTickLabelLimit,1)).width=20);var p=u?0:1,g=l?0:1,m=t.x.label,y=t.y.label,v=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,x=Fn(d,t.x.rotate),_=Fn(h,t.y.rotate);i?(m.padding=(-e.xAxisPadding-e.xFontLabelHeight)/2+e.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-e.yAxisPadding-e.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,v=0,b=0):(m.padding=Tn([p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight)]),m.paddingNoTicks=v*(e.distToXAxisLabel+e.xFontLabelHeight),y.padding=Tn([g*(e.yTickWidth+_.width),b*e.distToYAxisLabel]),y.paddingNoTicks=b*e.distToYAxisLabel),a&&(y.padding=0,y.paddingNoTicks=0);var w=e.xFontLabelDescenderLineHeight;return t.padding=Object.assign(t.padding,{b:t.x.hide?0:Tn([t.x.padding,p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight+w)]),l:t.y.hide?0:Tn([t.y.padding,a?0:g*(e.yTickWidth+_.width),b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.paddingNoTicks=Object.assign({},t.paddingNoTicks,{b:t.x.hide?0:Tn([t.x.padding,v*(e.distToXAxisLabel+e.xFontLabelHeight+w)]),l:t.y.hide?0:Tn([t.y.padding,b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.x=Object.assign(t.x,{density:x.width+2*Nn(e,"xDensityPadding",n.dimType),tickFontHeight:c.height,$minimalDomain:o.length,$maxTickTextW:d.width,$maxTickTextH:d.height,tickFormatWordWrapLimit:e.xAxisTickLabelLimit}),t.y=Object.assign(t.y,{density:_.height+2*Nn(e,"yDensityPadding",r.dimType),tickFontHeight:f.height,$minimalDomain:s.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:e.yAxisTickLabelLimit}),t}var zn=function(t){var e=t.unit,n=t.meta,r=t.settings,i=t.allowXVertical,a=t.allowYVertical,o=t.inlineLabels,s=n.dimension(e.x),u=n.dimension(e.y),l=n.scaleMeta(e.x,e.guide.x),c=n.scaleMeta(e.y,e.guide.y),f=l.isEmpty,d=c.isEmpty;e.guide.x.tickFormat=Rn(e.guide.x.tickFormat||Ln(s,r.defaultFormats),r.utcTime),e.guide.y.tickFormat=Rn(e.guide.y.tickFormat||Ln(u,r.defaultFormats),r.utcTime);var h=!!i&&!("measure"===s.dimType),p=!!a&&!("measure"===u.dimType);if(e.guide.x.padding=f?0:r.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:r.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=Dn(e.guide.x.rotate,"x"),e.guide.y.rotate=p?-90:0,e.guide.y.textAnchor=Dn(e.guide.y.rotate,"y"),e.guide=In(e.guide,r,l,c,o,he(e)),o){var g=e.guide.x.label,m=e.guide.y.label;g.cssClass+=" inline",g.dock="right",g.textAnchor="end",m.cssClass+=" inline",m.dock="right",m.textAnchor="end"}return e},Bn={NONE:function(t,e,n){var r=kt(t);return Vn(kt(r.unit),r.unit,function(t,e){return e.guide.x.tickFontHeight=n.getAxisTickLabelSize("X").height,e.guide.y.tickFontHeight=n.getAxisTickLabelSize("Y").height,e.guide.x.tickFormatWordWrapLimit=n.xAxisTickLabelLimit,e.guide.y.tickFormatWordWrapLimit=n.yAxisTickLabelLimit,e}),r},"BUILD-LABELS":function(t,e){var n=kt(t),r=[],i=[],a=null,o=null;mt(n.unit,"units",On,function(t,n){if(t.isLeaf)return n;!a&&n.x&&(a=n),!o&&n.y&&(o=n),n.guide=n.guide||{},n.guide.x=n.guide.x||{label:{text:""}},n.guide.y=n.guide.y||{label:{text:""}},n.guide.x.label=Ot(n.guide.x.label)?n.guide.x.label:{text:n.guide.x.label&&n.guide.x.label.text?n.guide.x.label.text:""},n.guide.y.label=Ot(n.guide.y.label)?n.guide.y.label:{text:n.guide.y.label&&n.guide.y.label.text?n.guide.y.label.text:""},n.x&&(n.guide.x.label.text=n.guide.x.label.text||e.dimension(n.x).dimName),n.y&&(n.guide.y.label.text=n.guide.y.label.text||e.dimension(n.y).dimName);var s=n.guide.x.label.text;s&&(r.push(s),n.guide.x.tickFormatNullAlias=n.guide.x.hasOwnProperty("tickFormatNullAlias")?n.guide.x.tickFormatNullAlias:"No "+s,n.guide.x.label.text="",n.guide.x.label._original_text=s);var u=n.guide.y.label.text;return u&&(i.push(u),n.guide.y.tickFormatNullAlias=n.guide.y.hasOwnProperty("tickFormatNullAlias")?n.guide.y.tickFormatNullAlias:"No "+u,n.guide.y.label.text="",n.guide.y.label._original_text=u),n});return a&&(a.guide.x.label.text=a.guide.x.label.hide?"":r.join(" → ")),o&&(o.guide.y.label.text=o.guide.y.label.hide?"":i.join(" → ")),n},"BUILD-GUIDE":function(t,e,n){var r=kt(t);return Vn(kt(r.unit),r.unit,function(t,r){if(t.isLeaf)return r;var i=!t.isLeaf&&!t.isLeafParent,a=e.scaleMeta(r.x,r.guide.x),o=e.scaleMeta(r.y,r.guide.y),s=!i&&Boolean(a.dimType)&&"measure"!==a.dimType;return r.guide.x.rotate=r.guide.x.rotate||(s?-90:0),r.guide.x.textAnchor=Dn(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||Ln(a,n.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||Ln(o,n.defaultFormats),r.guide.x.padding=i?0:n.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=i?0:n.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=In(r.guide,Qt({distToXAxisLabel:a.isEmpty?n.xTickWidth:n.distToXAxisLabel,distToYAxisLabel:o.isEmpty?n.yTickWidth:n.distToYAxisLabel},n),a,o,null,he(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:i?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!i||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:i?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!i&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:t.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":function(t,e,n){var r=kt(t);return Vn(kt(r.unit),r.unit,function(t,r){return t.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=t.isLeafParent?"xy":""),t.isLeafParent?zn({unit:r,meta:e,settings:Qt({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!0,allowYVertical:!1,inlineLabels:!0}):(r.guide.x.cssClass+=" facet-axis compact",r.guide.x.avoidCollisions=!0,r.guide.y.cssClass+=" facet-axis compact",r.guide.y.avoidCollisions=!0,zn({unit:r,meta:e,settings:Qt({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))}),r},AUTO:function(t,e,n){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(t,r){return Bn[r](t,e,n)},t)},COMPACT:function(t,e,n){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(t,r){return Bn[r](t,e,n)},t)}},Vn=function(t,e,n){var r,i=((r=e).options=r.options||{},r.guide=r.guide||{},r.guide.padding=Qt(r.guide.padding||{},{l:0,b:0,r:0,t:0}),r.guide.x=kn(r.guide,"x"),r.guide.x=An(r.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),r.guide.y=kn(r.guide,"y",{rotate:-90}),r.guide.y=An(r.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),r.guide.size=kn(r.guide,"size"),r.guide.color=kn(r.guide,"color"),r);i=n(On(i),i);var a=Zt(i=Cn(i,t),"units");return(i.units||[]).forEach(function(t){return Vn(kt(t),(r=a,(e=t).guide=e.guide||{},e.guide.padding=e.guide.padding||{l:0,t:0,r:0,b:0},e.hasOwnProperty("units")||((e=Qt(e,r)).guide=Qt(e.guide,kt(r.guide)),e.guide.x=Qt(e.guide.x,kt(r.guide.x)),e.guide.y=Qt(e.guide.y,kt(r.guide.y))),e),n);var e,r}),i},Hn=function(t,e,n,r){var i={dimension:function(t){var e=n.scales[t],r=n.sources[e.source].dims[e.dim]||{};return{dimName:e.dim,dimType:r.type,scaleType:e.type}},scaleMeta:function(t){var e=r("pos",t).domain(),i=n.scales[t],a=n.sources[i.source].dims[i.dim]||{};return{dimName:i.dim,dimType:a.type,scaleType:i.type,values:e,isEmpty:null==a.type}}},a=(Bn[t]||Bn.NONE)({unit:kt(n.unit)},i,e);return n.unit=a.unit,n},Wn=function(){function t(t){this.spec=t,this.isApplicable=jt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.size,r=e.settings.specEngine.find(function(t){return n.width<=t.width||n.height<=t.height});return Hn(r.name,e.settings,e,function(e,n){return t.getScaleInfo(n||e+":default")})},t}(),Gn=function(){function t(){}return t.optimizeXAxisLabel=function(t,e){var n=e.xAxisTickLabelLimit,r=function(t){if(!t.guide.x.hide&&!t.guide.x.hideTicks&&0!==t.guide.x.rotate){t.guide.x.rotate=0,t.guide.x.textAnchor="middle";var e=0-Math.min(n,t.guide.x.$maxTickTextW)+t.guide.x.$maxTickTextH;i(t,e)}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})},i=function(e,n){t!==e&&"extract-axes"===e.guide.autoLayout?(t.guide.x.padding+=n,t.guide.padding.b+=n):(e.guide.x.label.padding+=e.guide.x.label.padding>0?n:0,e.guide.padding.b+=e.guide.padding.b>0?n:0)};r(t)},t.hideAxisTicks=function(t,e,n){var r=function(t){var e="x"===n?"b":"l",i=t.guide;if(!i[n].hide&&!i[n].hideTicks){he(t)&&"y"===n||(i[n].hideTicks=!0);var a=i[n].label.text&&!i[n].label.hide;i.padding[e]=i.paddingNoTicks?i.paddingNoTicks[e]:0,i[n].padding=i[n].paddingNoTicks||0,i[n].label.padding=a?i[n].label.paddingNoTicks:0}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})};r(t)},t.facetsLabelsAtTop=function(t,e){var n=function(t){var e=t.units||[];if(he(t)){var r=t.guide;r.y.facetAxis=!0,r.y.rotate=0,r.y.textAnchor="start",e.forEach(function(t){t.guide.padding.t=20})}e.filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return n(t)})};n(t)},t}(),Un=function(t){return t.$maxTickTextW},Xn=function(t){return 0==t.rotate?t.$maxTickTextW:t.$maxTickTextH},qn=function(t){return t.density},Yn=function(t){var e=[],n=[],r=function(t){if("COORDS.RECT"===t.type&&t.units&&t.units[0]&&"COORDS.RECT"===t.units[0].type){var i=t.x.replace(/^x_/,""),a=t.y.replace(/^y_/,"");"null"!==i&&e.push(i),"null"!==a&&n.push(a),t.units.forEach(r)}};r(t.unit);var i={},a={},o=function(t){"COORDS.RECT"===t.type&&t.frames.forEach(function(t){t.key&&(Object.keys(t.key).forEach(function(r){e.indexOf(r)>=0&&(i.hasOwnProperty(r)||(i[r]=[]),i[r].indexOf(t.key[r])<0&&i[r].push(t.key[r])),n.indexOf(r)>=0&&(a.hasOwnProperty(r)||(a[r]=[]),a[r].indexOf(t.key[r])<0&&a[r].push(t.key[r]))}),t.units&&t.units.forEach(o))})};return o(t.unit),{xFacetCount:Object.keys(i).reduce(function(t,e){return t*i[e].length},1),yFacetCount:Object.keys(a).reduce(function(t,e){return t*a[e].length},1)}},$n={"entire-view":function(t,e,n,r){var i=n.unit.guide,a=Yn(n),o=a.xFacetCount,s=a.yFacetCount;s>0&&Gn.facetsLabelsAtTop(n.unit,n.settings);var u=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0,l=i.paddingNoTicks?i.padding.b-i.paddingNoTicks.b:0,c=i.paddingNoTicks&&t.height-lt.height||o*n.settings.minFacetWidth+u>t.width,f=i.paddingNoTicks&&t.width-ut.height||o*n.settings.minFacetWidth+u>t.width;c&&Gn.hideAxisTicks(n.unit,n.settings,"x"),f&&Gn.hideAxisTicks(n.unit,n.settings,"y");var d=t.width;if(e("x",n.unit,Un)<=t.width)r(n.unit,n.settings);else{var h=e("x",n.unit,Xn);if(h>t.width){var p=Math.max(t.width,e("x",n.unit,qn));d=Math.min(h,p)}}var g=Math.max(t.height,e("y",n.unit,qn));return!c&&d>t.width&&Gn.hideAxisTicks(n.unit,n.settings,"x"),!f&&g>t.height&&Gn.hideAxisTicks(n.unit,n.settings,"y"),{newW:t.width,newH:t.height}},minimal:function(t,e,n){return{newW:e("x",n.unit,qn),newH:e("y",n.unit,qn)}},normal:function(t,e,n,r){Yn(n).yFacetCount>0&&Gn.facetsLabelsAtTop(n.unit,n.settings);var i=n.unit.guide;i.paddingNoTicks&&(t.width-i.padding.l+i.paddingNoTicks.lt.width){var s=Math.max(t.width,e("x",n.unit,qn));a=Math.min(o,s)}}return{newW:a,newH:Math.max(t.height,e("y",n.unit,qn))}},"fit-width":function(t,e,n,r){var i=n.unit.guide,a=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0;return(i.paddingNoTicks&&t.width-at.width)&&Gn.hideAxisTicks(n.unit,n.settings,"y"),e("x",n.unit,Un)<=t.width&&r(n.unit,n.settings),{newW:t.width,newH:e("y",n.unit,qn)}},"fit-height":function(t,e,n){var r=n.unit.guide,i=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&t.height-it.height)&&Gn.hideAxisTicks(n.unit,n.settings,"x"),{newW:e("x",n.unit,qn),newH:t.height}}},Kn=function(){function t(t){this.spec=t,this.isApplicable=jt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.fitModel;if(!n)return e;var r=e.scales,i=function(t,e){return t.discrete?e*t.domain().length:4*e},a=function(e,n,o,s){void 0===s&&(s=null);var u="x"===e?n.x:n.y,l="x"===e?n.y:n.x,c=n.guide,f=o("x"===e?c.x:c.y),d=n.units[0],h="x"===e?c.padding.l+c.padding.r:c.padding.b+c.padding.t;if("ELEMENT.INTERVAL"===d.type&&"y"===e===Boolean(d.flip)&&d.label&&!t.getScaleInfo(d.label,s).isEmpty()){var p,g=2*(c.label&&c.label.fontSize?c.label.fontSize:10),m=t.getScaleInfo(u,s);if(m.discrete&&(null==d.guide.enableColorToBarPosition?!d.stack:d.guide.enableColorToBarPosition)){var y=d.color;if(y){var v=t.getScaleInfo(y,s);if(v.discrete){v.domain();p=v}}}var b=n.frames.reduce(function(t,e){return t+function(t){var e=t.part(),n=Yt(e.map(function(t){return t[m.dim]})).length,r=1;if(p){var i=e.reduce(function(t,e){var n=e[m.dim],r=e[p.dim];return t[n]=t[n]||{},t[n][r]||(t[n][r]=!0),t},{}),a=Object.keys(i).map(function(t){return Object.keys(i[t]).length});r=Math.max.apply(Math,a)}return n*r*g}(e)},0),x=i(m,f);return h+Math.max(b,x)}if("COORDS.RECT"!==d.type){var _=t.getScaleInfo(u,s);return h+i(_,f)}var w,E,S=(w=n.frames,E=r[l].dim,w.reduce(function(t,e){var n=(e.key||{})[E];return t[n]=t[n]||[],t[n].push(e),t},{})),M=Object.keys(S).map(function(t){return S[t].map(function(t){return a(e,t.units[0],o,t)}).reduce(function(t,e){return t+e},0)});return h+Math.max.apply(Math,M)},o=e.settings.size,s=o.width,u=o.height,l=$n[n];if(l){var c=l(o,a,e,Gn.optimizeXAxisLabel);s=c.newW,u=c.newH}return e.settings.size=function(n,r,i){var a=e.settings.getScrollbarSize(t.getLayout().contentContainer),o=r.width>n.width&&r.width<=n.width*i?n.width:r.width,s=r.height>n.height&&r.height<=n.height*i?n.height:r.height,u=n.width-o,l=n.height-s>=0?0:a.width;return{height:s-(u>=0?0:a.height),width:o-l}}(o,{width:s,height:u},e.settings.avoidScrollAtRatio),e},t}(),Jn=function(){function t(t){this.spec=t,this.isApplicable=t.settings.autoRatio&&jt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleApplyRatio(e,t)}catch(t){if("Not applicable"!==t.message)throw t}return e},t.prototype.ruleApplyRatio=function(t,e){var n=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},r=function(t,e,n,i){void 0===i&&(i=0),e(t,i)&&(t.units||[]).map(function(t){return r(t,e,n,i+1)}),n(t,i)},i=[],a=[];r(t.unit,function(t,e){if(e>1||!n(t))throw new Error("Not applicable");return i.push(t.x),a.push(t.y),1===(t.units||[]).map(function(t){if(!n(t)&&0!==t.type.indexOf("ELEMENT."))throw new Error("Not applicable");return t}).filter(n).length},function(){return 0});var o=function(e){return t.scales[e]},s=function(t){return"/"===t.source&&!t.ratio&&!t.fitToFrameByDims},u=function(t){return"ordinal"===t.type||"period"===t.type&&!t.period},l=i.map(o).filter(s),c=a.map(o).filter(s);if([l.length,c.length].some(function(t){return 2===t})){var f=function(t){return t.dim},d=function(t,e,n){t.fitToFrameByDims=n.slice(0,e).map(f)},h=function(t,n){2===n.filter(u).length&&(n.forEach(d),n[0].ratio=Dt(t,n.map(f),e))};h("x",l),h("y",c)}},t}(),Qn=function(){function t(t){this.spec=t,this.isApplicable="EXTRACT"===t.settings.layoutEngine&&jt(t.unit)}return t.prototype.transform=function(){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleExtractAxes(t)}catch(t){if("Not applicable"!==t.message)throw t;console.log("[TauCharts]: can't extract axes for the given chart specification")}return t},t.prototype.ruleExtractAxes=function(t){var e=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},n=function(t){return t?10:0},r={l:0,r:10,t:10,b:0},i={l:0,b:0},a=[],o=[];yt(t.unit,function(t,n){if(n>1||!e(t))throw new Error("Not applicable");t.guide=t.guide||{};var s=t.guide,u=s.padding||{l:0,r:0,t:0,b:0},l=s.paddingNoTicks||{l:0,b:0};return r.l+=u.l,r.r+=u.r,r.t+=u.t,r.b+=u.b,i.l+=l.l,i.b+=l.b,a.push(Object.assign({},r)),o.push(Object.assign({},i)),1===(t.units||[]).map(function(t){if(!e(t)&&0!==t.type.indexOf("ELEMENT."))throw new Error("Not applicable");return t}).filter(e).length},function(t){var e=a.pop(),s=o.pop(),u=t.guide||{};u.x=u.x||{},u.x.padding=u.x.padding||0,u.x.paddingNoTicks=u.x.paddingNoTicks||0,u.y=u.y||{},u.y.padding=u.y.padding||0,u.y.paddingNoTicks=u.y.paddingNoTicks||0,u.padding={l:n(t.y),r:n(1),t:n(1),b:n(t.x)},u.paddingNoTicks={l:0,b:0},u.autoLayout="extract-axes",u.x.padding+=r.b-e.b,u.y.padding+=r.l-e.l,u.x.paddingNoTicks+=i.b-s.b,u.y.paddingNoTicks+=i.l-s.l}),t.unit.guide.padding=r,t.unit.guide.paddingNoTicks=i},t}(),Zn=function(){function t(t){var e=void 0===t?{}:t,n=e.src,r=void 0===n?null:n,i=e.timeout,a=void 0===i?Number.MAX_SAFE_INTEGER:i,o=e.syncInterval,s=void 0===o?Number.MAX_SAFE_INTEGER:o,u=e.callbacks,l=void 0===u?{}:u,c=this;this.setTimeoutDuration(a),this.setSyncInterval(s),this.setCallbacks(l),this._running=!1,this._queue=[],this._result=r,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=function(){if(c._running&&c._requestedFrameId){var t=c._getCancelFrameFunction(),e=c._getRequestFrameFunction();t(c._requestedFrameId),c._requestedFrameId=e(c._requestedFrameCallback)}},this._tasksCount=0,this._finishedTasksCount=0}return t.prototype.setTimeoutDuration=function(e){t.checkType(e,"number","timeout"),this._timeout=e},t.prototype.setSyncInterval=function(e){t.checkType(e,"number","syncInterval"),this._syncInterval=e},t.prototype.setCallbacks=function(e){t.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)},t.prototype.addTask=function(t){return this._queue.push(t),this._tasksCount++,this},t.prototype.run=function(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,t.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()},t.prototype.isRunning=function(){return this._running},t.prototype._loopTasks=function(){for(var e,n,r,i,a=0,o=this._syncInterval/t.runnersInProgress;this._running&&!(r=this._asyncDuration>this._timeout)&&!(i=a>o)&&(e=this._queue.shift());){if(null===(n=this._runTask(e)))return;this._syncDuration+=n,this._asyncDuration+=n,a+=n}r&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!r&&i&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))},t.prototype._runTask=function(t){var e=performance.now();if(this._callbacks.error)try{this._result=t.call(null,this._result,this)}catch(t){return this.stop(),this._callbacks.error.call(null,t,this),null}else this._result=t.call(null,this._result,this);var n=performance.now()-e;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),n},t.prototype._requestFrame=function(){var t=this,e=performance.now(),n=function(){t._requestedFrameId=null;var n=performance.now();t._asyncDuration+=n-e,t._loopTasks()},r=this._getRequestFrameFunction();this._requestedFrameCallback=n,this._requestedFrameId=r(n)},t.prototype._getRequestFrameFunction=function(){var t=this;return document.hidden?function(e){return t._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})}:function(e){return t._requestedFrameType="animation",requestAnimationFrame(e)}},t.prototype._getCancelFrameFunction=function(){switch(this._requestedFrameType){case"animation":return function(t){return cancelAnimationFrame(t)};case"idle":return function(t){return window.cancelIdleCallback(t)}}},t.prototype.stop=function(){if(!this._running)throw new Error("Task Runner is already stopped");(this._running=!1,t.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId)&&(this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null)},t.checkType=function(t,e,n){if(typeof t!==e)throw new Error('Task Runner "'+n+'" property is not "'+e+'"')},t}();Zn.runnersInProgress=0;var tr=Zn,er=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nr=function(){return(nr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var c=l.findIndex(function(t){return t.closest.distance!==l[0].closest.distance||t.closest.secondaryDistance!==l[0].closest.secondaryDistance}),f=c<0?l:l.slice(0,c);if(1===f.length)a=f[0].closest.data,o=f[0].closest.node,s=f[0].unit;else{var d=f.reduce(function(t,e){return t+e.closest.x},0)/f.length,h=f.reduce(function(t,e){return t+e.closest.y},0)/f.length,p=Math.atan2(h-r,d-n)+Math.PI,g=Math.round((f.length-1)*p/2/Math.PI),m=f[g].closest;a=m.data,o=m.node,s=f[g].unit}}u.forEach(function(e){return e.unit.fire(i,{event:t,data:a,node:o,unit:s})})},e.prototype._initPointerEvents=function(){var t=this;this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);var e=rr.select(this._svg),n=this._liveSpec.settings.syncPointerEvents?function(t){return function(){return t(o.event)}}:function(e){return function(){var n=o.event;t._pointerAnimationFrameId&&"mousemove"!==n.type&&t._cancelPointerAnimationFrame(),t._pointerAnimationFrameId||(t._pointerAnimationFrameId=requestAnimationFrame(function(){t._pointerAnimationFrameId=null,e(n)}))}},r=function(e){return t._handlePointerEvent(e)};e.on("mousemove",n(r)),e.on("click",n(r)),e.on("mouseleave",n(function(e){"none"!==window.getComputedStyle(t._svg).pointerEvents&&t.select(function(){return!0}).forEach(function(t){return t.fire("data-hover",{event:e,data:null,node:null,unit:null})})}))},e.prototype._cancelPointerAnimationFrame=function(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null},e.prototype._setupTaskRunner=function(t){var e=this;return this._resetTaskRunner(),this._taskRunner=new tr({timeout:t.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:t.settings.asyncRendering?t.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:function(){e._completeRendering(),e._renderingPhase=null},timeout:function(t,n){e._displayTimeoutWarning({timeout:t,proceed:function(){e.disablePointerEvents(),n.setTimeoutDuration(Number.MAX_SAFE_INTEGER),n.run()},cancel:function(){e._cancelRendering()}}),e.enablePointerEvents(),e.fire("renderingtimeout",t)},progress:function(t){var n={spec:0,draw:1}[e._renderingPhase]/2+t/2;e._reportProgress(n)},error:t.settings.handleRenderingErrors?function(n){e._cancelRendering(),e._displayRenderingError(n),e.fire("renderingerror",n),t.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',"Error message: "+n.message].join(" "),"ERROR")}:null}}),this._taskRunner},e.prototype._resetTaskRunner=function(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)},e.prototype.renderTo=function(t,e){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(t,e);var n=this._createLiveSpec();if(!n)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(n),i=this._setupTaskRunner(n);this._scheduleDrawScenario(i,r),this._scheduleDrawing(i,r),i.run()},e.prototype._insertLayout=function(t,e){this._target=t,this._defaultSize=Object.assign({},e);var n=rr.select(t).node();if(null===n)throw new Error("Target element not found");this._layout.layout.parentNode!==n&&n.appendChild(this._layout.layout);var r=this._layout.content,i=ye(this._layout.contentContainer);this._layout.contentContainer.style.padding="0 "+i.width+"px "+i.height+"px 0",ve(this._layout.rightSidebarContainer,"vertical");var a=Object.assign({},e)||{};if(!a.width||!a.height){var o=r.parentElement,s=o.scrollLeft,u=o.scrollTop;r.style.display="none",a=Qt(a,_e(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=s,r.parentElement.scrollTop=u,a.height||(a.height=_e(this._layout.layout).height)}this.configGPL.settings.size=a},e.prototype._createLiveSpec=function(){var t=this;return this._liveSpec=kt(Zt(this.configGPL,"plugins")),this._liveSpec.sources=this.getDataSources(),this._liveSpec.settings=this.configGPL.settings,this._experimentalSetupAnimationSpeed(this._liveSpec),this.isEmptySources(this._liveSpec.sources)?null:(this._liveSpec=this.transformers.reduce(function(e,n){return new n(e).transform(t)},this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)},e.prototype._experimentalSetupAnimationSpeed=function(t){t.settings.initialAnimationSpeed=t.settings.initialAnimationSpeed||t.settings.animationSpeed;var e=t.settings.experimentalShouldAnimate(t)?t.settings.initialAnimationSpeed:0;t.settings.animationSpeed=e;var n=function(t){t.guide=t.guide||{},t.guide.animationSpeed=e,t.units&&t.units.forEach(n)};n(t.unit)},e.prototype._createGPL=function(t){var e=new Ue(t,this.getScaleFactory(),nn,M),n=e.unfoldStructure();return this.onUnitsStructureExpanded(n),e},e.prototype._scheduleDrawScenario=function(t,e){var n=this,r=rr.select(this._layout.content),i=e.config.settings.size;t.addTask(function(){return n._renderingPhase="spec"}),e.getDrawScenarioQueue({allocateRect:function(){return{slot:function(t){return r.selectAll(".uid_"+t)},frameId:"root",left:0,top:0,width:i.width,containerWidth:i.width,height:i.height,containerHeight:i.height}}}).forEach(function(e){return t.addTask(e)})},e.prototype._scheduleDrawing=function(t,e){var n=this,r=e.config.settings.size;t.addTask(function(t){n._renderingPhase="draw",n._renderRoot({scenario:t,newSize:r}),n._cancelPointerAnimationFrame(),n._scheduleRenderScenario(t)})},e.prototype._resetProgressLayout=function(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()},e.prototype._renderRoot=function(t){var e=this,n=t.scenario,r=t.newSize,i=rr.select(this._layout.content),a=n[0].config.uid,o=ir(i,"svg").attr("width",Math.floor(r.width)).attr("height",Math.floor(r.height));o.attr("class")||o.attr("class",Xe+"svg"),this._svg=o.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var s=o.selectAll("g.frame-root").data([a],function(t){return t});s.enter().append("g").classed(Xe+"cell cell frame-root uid_"+a,!0).merge(s).call(function(t){t.classed("tau-active",!0),nt(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),s.exit().call(function(t){t.classed("tau-active",!1),nt(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})},e.prototype._scheduleRenderScenario=function(t){var e=this;t.forEach(function(t){e._taskRunner.addTask(function(){t.draw(),e.onUnitDraw(t.node()),e._renderedItems.push(t)})})},e.prototype._completeRendering=function(){ve(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=this._liveSpec.settings.size.height+"px",this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),ve(this._layout.rightSidebarContainer,"vertical")},e.prototype._cancelRendering=function(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()},e.prototype._createProgressBar=function(){var t=rr.select(this._layout.header),e=ir(t,"div."+Xe+"progress");e.select("div."+Xe+"progress__value").remove();var n=e.append("div").classed(Xe+"progress__value",!0).style("width",0);this._reportProgress=function(t){requestAnimationFrame(function(){e.classed(Xe+"progress_active",t<1),n.style("width",100*t+"%")})}},e.prototype._displayRenderingError=function(t){this._layout.layout.classList.add(Xe+"layout_rendering-error")},e.prototype._clearRenderingError=function(){this._layout.layout.classList.remove(Xe+"layout_rendering-error")},e.prototype.getScaleFactory=function(t){return void 0===t&&(t=null),new sn(on.instance(this._liveSpec.settings),t||this._liveSpec.sources,this._liveSpec.scales)},e.prototype.getScaleInfo=function(t,e){return void 0===e&&(e=null),this.getScaleFactory().createScaleInfoByName(t,e)},e.prototype.getSourceFiltersIterator=function(t){var e=this,n=qt(Object.keys(this._filtersStore.filters).map(function(t){return e._filtersStore.filters[t]})).filter(function(e){return!t(e)}).map(function(t){return t.predicate});return function(t){return n.reduce(function(e,n){return e&&n(t)},!0)}},e.prototype.getDataSources=function(t){var e=this;void 0===t&&(t={});var n=this._chartDataModel(this._originData);return Object.keys(n).filter(function(t){return"?"!==t}).reduce(function(r,i){var a=n[i],o=e.getSourceFiltersIterator(function(e){return function(n){return t.excludeFilter&&-1!==t.excludeFilter.indexOf(n.tag)||n.src!==e}}(i));return r[i]={dims:a.dims,data:a.data.filter(o)},r},{"?":n["?"]})},e.prototype.isEmptySources=function(t){return!Object.keys(t).filter(function(t){return"?"!==t}).filter(function(e){return t[e].data.length>0}).length},e.prototype.getChartModelData=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="/"),this.getDataSources(t)[e].data},e.prototype.getDataDims=function(t){return void 0===t&&(t="/"),this._originData[t].dims},e.prototype.getData=function(t){return void 0===t&&(t="/"),this._originData[t].data},e.prototype.setData=function(t,e){void 0===e&&(e="/"),this._originData[e].data=t,this.refresh()},e.prototype.getSVG=function(){return this._svg},e.prototype.addFilter=function(t){t.src=t.src||"/";var e=t.tag,n=this._filtersStore.filters[e]=this._filtersStore.filters[e]||[],r=this._filtersStore.tick++;return t.id=r,n.push(t),r},e.prototype.removeFilter=function(t){var e=this;return Object.keys(this._filtersStore.filters).map(function(n){e._filtersStore.filters[n]=e._filtersStore.filters[n].filter(function(e){return e.id!==t})}),this},e.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},e.prototype.resize=function(t){void 0===t&&(t={}),this.renderTo(this._target,t)},e.prototype.select=function(t){return this._nodes.filter(t)},e.prototype.traverseSpec=function(t,e){var n=function(t,e,r,i){e(t,r,i),t.frames?t.frames.forEach(function(r){(r.units||[]).map(function(i){return n(i,e,t,r)})}):(t.units||[]).map(function(r){return n(r,e,t,null)})};n(t.unit,e,null,null)},e.prototype.getSpec=function(){return this._liveSpec},e.prototype.getLayout=function(){return this._layout},e.prototype._displayTimeoutWarning=function(t){var e=this,n=t.proceed,r=t.cancel,i=t.timeout,a=Math.round(100/3/1.5),o=function(t){return Math.round(100/3/1.5*t)};this._layout.content.style.height="100%",this._layout.content.insertAdjacentHTML("beforeend",'\n
\n \n \n Rendering took more than '+Math.round(i)/1e3+'s\n Would you like to continue?\n \n \n Continue\n \n \n Cancel\n \n \n
\n '),this._layout.content.querySelector("."+Xe+"rendering-timeout-continue-btn").addEventListener("click",function(){e._clearTimeoutWarning(),n.call(e)}),this._layout.content.querySelector("."+Xe+"rendering-timeout-cancel-btn").addEventListener("click",function(){e._clearTimeoutWarning(),r.call(e)})},e.prototype._clearTimeoutWarning=function(){var t=ar(this._layout.content,"."+Xe+"rendering-timeout-warning");t&&(this._layout.content.removeChild(t),this._layout.content.style.height="")},e}(h),sr={},ur={},lr=function(t){var e="Chart type "+t+" is not supported.";throw console.log(e),console.log("Use one of "+Object.keys(sr).join(", ")+"."),new w(e,E.NOT_SUPPORTED_TYPE_CHART)},cr={validate:function(t,e){return ur.hasOwnProperty(t)||lr(t),ur[t].reduce(function(t,n){return t.concat(n(e)||[])},[])},get:function(t){var e=sr[t];return"function"!=typeof e&&lr(t),e},add:function(t,e,n){return void 0===n&&(n=[]),sr[t]=e,ur[t]=n,cr},getAllRegisteredTypes:function(){return sr}},fr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dr=function(t){function e(n){var r=t.call(this,n)||this;return n.autoResize&&e.winAware.push(r),r}return fr(e,t),e.prototype.applyConfig=function(e){var n=cr.validate(e.type,e);if(n.length>0)throw new Error(n[0]);var r=cr.get(e.type);(e=Qt(e,{autoResize:!0})).settings=or.setupSettings(e.settings),e.dimensions=or.setupMetaInfo(e.dimensions,e.data),t.prototype.applyConfig.call(this,r(e))},e.prototype.destroy=function(){var n=e.winAware.indexOf(this);-1!==n&&e.winAware.splice(n,1),t.prototype.destroy.call(this)},e}(or);function hr(t){return t}dr.winAware=[],dr.resizeOnWindowEvent=function(){var t;function e(){t=0;for(var e=0,n=dr.winAware.length;ex&&x>2&&b.length>2;)b=n.ticks(--x)}else b=n.domain();r.hideTicks&&(b=c?b.filter(function(t){return 0==t}):[]);var _=null==s?n.tickFormat?n.tickFormat(o):hr:s,w=Math.max(u,0)+l,E=n.range(),S=E[0]+.5,M=E[E.length-1]+.5,T=(n.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return t(n)+e}}:hr)(n);if(r.facetAxis){var C=T;T=function(t){return C(t)-n.stepSize(t)/2}}var k,A=a.selection?a:null,O=A?A.selection():a,P=function(t){for(var e=t.node();e&&"svg"!==e.tagName;)e=e.parentNode;return e}(O).getBoundingClientRect();function L(t){var n=Wt(r.rotate);if(t.attr("transform",Le(n)),Math.abs(n/90)%2>0){var i=n<180?1:-1,a=h?.5:-2,o=e===yr.top||e===yr.left?-1:1,s=a*(e===yr.top||e===yr.bottom?o<0?0:.71:.32);t.attr("x",9*i).attr("y",0).attr("dx",h?null:s+"em").attr("dy",s+"em")}}function N(t,e){void 0===e&&(e=0);var i=function(t){return Math.max(n.stepSize(t),r.tickFormatWordWrapLimit,e)};r.tickFormatWordWrap?et(t,i,r.tickFormatWordWrapLines,r.tickFontHeight,!h):tt(t,i)}function R(t){!function(t,e){var n=e?-10:20,r=e?0:1,i=e?1:-1,a=[];t.each(function(){var t=Q.select(this),e=t.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],n=i*parseFloat(e),o=t.select("text"),s=o.node().getBBox().width/2,u=n-s,l=n+s;a.push({c:n,s:u,e:l,l:0,textRef:o,tickRef:t})});var o,s=a.sort(function(t,e){return t.c-e.c});o=function(t,r,i){var a,o,s,u=t.e>r.s,l=i.s1&&(f=f.replace(/([\.]*$)/gi,"")+"...");var d=11*r.l,h=e?parseFloat(r.textRef.attr("y"))+d:0,p=e?0:d,g=e?d:0,m=function(t){var e=0;if(!t)return e;var n=t.indexOf("rotate(");if(n>=0){var r=t.indexOf(")",n+7),i=t.substring(n+7,r);e=parseFloat(i.trim())}return e}(r.textRef.attr("transform"));r.textRef.text(function(t,e){return 0===e?f:""}).attr("transform","translate("+p+","+g+") rotate("+m+")");var y={x1:0,x2:0,y1:h+(e?-1:5),y2:n};e||(y.transform="rotate(-90)"),Me(r.tickRef,"line.label-ref").call(ct(y))}else r.tickRef.selectAll("line.label-ref").remove();return r},s.map(function(t,e,n){return o(n[e-1]||{e:-1/0,s:-1/0,l:0},t,n[e+1]||{e:1/0,s:1/0,l:0})})}(t,h)}O.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===yr.right?"start":e===yr.left?"end":"middle"),c||(k=r.hideTicks||r.hide?[]:[null],ce(O.selectAll(".domain").data(k)).then(function(t){return A&&t.exit().transition(A).attr("opacity",0).remove(),t.merge(t.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000"))}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr("d",e===yr.left||e==yr.right?"M"+p*u+","+S+"H0.5V"+M+"H"+p*u:"M"+S+","+p*u+"V0.5H"+M+"V"+p*u)}));var F=ce(O.selectAll(".tick").data(b,function(t){return String(n(t))}).order()).then(function(t){var e=t.exit(),n=t.enter().append("g").attr("class","tick");return{tickExit:e,tickEnter:n,tick:t.merge(n)}}).then(function(t){if(f){var e=n.ticks(),r=n.domain(),i=b.length-1,a=e.length>1&&r[0]*r[1]<0&&-r[0]>(e[1]-e[0])/2&&r[1]>(e[i]-e[i-1])/2;t.tick.classed("zero-tick",function(t){return 0==t&&a})}return t}).result();!function(t){ce(t).then(function(t){var e=t.tickEnter,n=t.tickExit,r=t.tick;return A?(e.attr("opacity",pr).attr("transform",function(t){var e=T(t);return y(e)}),{tick:r.transition(A),tickExit:n.transition(A).attr("opacity",pr).attr("transform",function(t){var e=T(t);return isFinite(e)?y(e):this.getAttribute("transform")})}):{tick:r,tickExit:n}}).then(function(t){var e=t.tick;t.tickExit.remove(),e.attr("opacity",1).attr("transform",function(t){return y(T(t))})})}(F),r.facetAxis||function(t){var e=p*u,r=d?function(t){return v*n.stepSize(t)/2}:null;ce(t).then(function(t){var n=t.tick,i=t.tickEnter,a=n.select("line"),o=i.append("line").attr("stroke","#000").attr(m+"2",e);return d&&o.attr(g+"1",r).attr(g+"2",r),a.merge(o)}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(m+"2",e),d&&t.attr(g+"1",r).attr(g+"2",r)})}(F),d&&c&&d&&b&&b.length&&ce(O.selectAll(".extra-tick-line").data([null])).then(function(t){return t.merge(t.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(g+"1",S).attr(g+"2",S).attr(m+"1",0).attr(m+"2",p*u)}),c||(function(i){var a=r.textAnchor,o=p*w,s=e===yr.top?"0em":e===yr.bottom?"0.71em":"0.32em";function u(e){if(r.facetAxis)return e.attr("dx",18-t.position[0]).attr("dy",16)}ce(i).then(function(t){var e=t.tick,n=t.tickEnter,r=e.select("text"),i=n.append("text").attr("fill","#000").attr(m,o).attr("dy",s);return L(i),u(i),r.merge(i)}).then(function(t){if(t.text(_).attr("text-anchor",a),!1===h&&!0===r.facetAxis){var e=Re(O.node().parentNode.getAttribute("transform"));N(t,P.width-Math.abs(e.x))}else N(t);return h&&"time"===n.scaleType&&function(t){if(!(b.length<2)){var e=0,n=-1,r=t.nodes();r.forEach(function(t,r){var i=t.textContent||"",a=i.length;a>e&&(e=a,n=r)});var i=T(b[1])-T(b[0]),a=!1;if(n>=0){var o=r[n].getBoundingClientRect();a=i-o.width<8}O.classed(Xe+"time-axis-overflow",a)}}(t),!h||"time"!==n.scaleType&&"linear"!==n.scaleType||function(t){if(0!==b.length){var e=b[0],n=b[b.length-1],r=O.append("line").attr("x1",T(e)).attr("x2",T(e)).attr("y1",0).attr("y2",1),i=O.append("line").attr("x1",T(n)).attr("x2",T(n)).attr("y1",0).attr("y2",1),a={left:r.node().getBoundingClientRect().left-P.left,right:P.right-i.node().getBoundingClientRect().right};r.remove(),i.remove();var o=function(t,e,n){var r=t.getBoundingClientRect(),i=e>0?"right":"left",o=(T(n),a[i]),s=Math.ceil(r.width/2-o+1);t.setAttribute("dx",String(s>0?-e*s:0))},s=t.filter(function(t){return t===e}).node(),u=t.filter(function(t){return t===n}).node();t.attr("dx",null),o(s,-1,e),o(u,1,n)}}(t),t}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(m,o),L(t),u(t),d&&r.avoidCollisions&&!r.facetAxis&&(A?A.on("end.fixTickTextCollision",function(){return R(i.tick)}):R(i.tick))})}(F),i.hide||function(){var t=i,e=Me(O,"text.label").attr("class",Ae("label",t.cssClass)).attr("transform",Le(t.rotate)).attr("text-anchor",t.textAnchor);ce(e).then(function(t){return A?t.transition(A):t}).then(function(e){var n=v*t.padding,r=Math.abs(M-S),i=h?r:0;e.attr("x",i).attr("y",n).attr("text-anchor","end")});for(var n=t.text.split(" → "),r=n.length-1;r>0;r--)n.splice(r,0," → ");e.selectAll("tspan").data(n).enter().append("tspan").attr("class",function(t,e){return e%2?"label-token-delimiter label-token-delimiter-"+e:"label-token label-token-"+e}).text(function(t){return t}).exit().remove()}())}}function br(t){return vr({scale:t.scale,scaleGuide:t.scaleGuide,ticksCount:t.ticksCount,tickSize:t.tickSize,gridOnly:!0,position:t.position})}var xr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_r=Me,wr=function(t){var e=t<=20?1:.75;return Math.max(2,Math.round(t*e))},Er=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Qt(n.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),n.config.guide.x=n.config.guide.x||{},n.config.guide.x=Qt(n.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.x.label&&(n.config.guide.x.label={text:n.config.guide.x.label}),n.config.guide.x.label=Qt(n.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),n.config.guide.y=n.config.guide.y||{},n.config.guide.y=Qt(n.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.y.label&&(n.config.guide.y.label={text:n.config.guide.y.label}),n.config.guide.y.label=Qt(n.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var r=n.config,i=r.guide;if("extract-axes"===i.autoLayout){var a=r.options.containerHeight-(r.options.top+r.options.height);i.x.hide=i.x.hide||Math.floor(a)>0,i.y.hide=i.y.hide||Math.floor(r.options.left)>0}var o=n.config.options,s=n.config.guide.padding;return n.L=o.left+s.l,n.T=o.top+s.t,n.W=o.width-(s.l+s.r),n.H=o.height-(s.t+s.b),n}return xr(e,t),e.prototype.defineGrammarModel=function(t){var e=this.W,n=this.H;return this.xScale=t("pos",this.config.x,[0,e]),this.yScale=t("pos",this.config.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n]:[n,0]}),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:function(){return e/2},yi:function(){return n/2},sizeX:function(){return e},sizeY:function(){return n}}},e.prototype.getGrammarRules=function(){return[function(t){var e=t.scaleX,n=t.scaleY;return{xi:function(n){return n?e(n[e.dim]):t.xi(n)},yi:function(e){return e?n(e[n.dim]):t.yi(e)},sizeX:function(n){return n?e.stepSize(n[e.dim]):t.sizeX(n)},sizeY:function(e){return e?n.stepSize(e[n.dim]):t.sizeY(e)}}}]},e.prototype.createScreenModel=function(t){return t},e.prototype.allocateRect=function(t){var e=this,n=this.screenModel;return{slot:function(t){return e.config.options.container.selectAll(".uid_"+t)},left:n.xi(t)-n.sizeX(t)/2,top:n.yi(t)-n.sizeY(t)/2,width:n.sizeX(t),height:n.sizeY(t),containerWidth:this.W,containerHeight:this.H}},e.prototype.drawFrames=function(t){var e=Object.assign({},this.config),n=e.options,r=this.W,i=this.H;if(e.x=this.xScale,e.y=this.yScale,e.x.scaleObj=this.xScale,e.y.scaleObj=this.yScale,e.x.guide=e.guide.x,e.y.guide=e.guide.y,e.x.guide.label.size=r,e.y.guide.label.size=i,(n.container.attr("transform")?nt(n.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):n.container).attr("transform",Pe(this.L,this.T)),e.x.guide.hide)this._removeDimAxis(n.container,e.x);else{var a="top"===e.x.guide.scaleOrient?[0,0-e.guide.x.padding]:[0,i+e.guide.x.padding];this._drawDimAxis(n.container,e.x,a,r)}if(e.y.guide.hide)this._removeDimAxis(n.container,e.y);else{var o="right"===e.y.guide.scaleOrient?[r+e.guide.y.padding,0]:[0-e.guide.y.padding,0];this._drawDimAxis(n.container,e.y,o,i)}var s=t.reduce(function(t,e){return t.concat((e.units||[]).map(function(t){return t.uid}))},[]),u=this._drawGrid(n.container,e,r,i,n),l=ut(u,".cell").data(s,function(t){return t});l.enter().append("g").attr("class",function(t){return Xe+"cell cell uid_"+t}).merge(l).classed("tau-active",!0),nt(l,this.config.guide.animationSpeed).attr("opacity",1),nt(l.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()},e.prototype._drawDimAxis=function(t,e,n,r){var i=Mn.get(e.guide.tickFormat,e.guide.tickFormatNullAlias),o=vr({scale:e.scaleObj,scaleGuide:e.guide,ticksCount:i?wr(r/e.guide.density):null,tickFormat:i||null,position:n}),s=this.config.guide.animationSpeed;_r(t,this._getAxisSelector(e)).classed("tau-active",!0).classed(e.guide.cssClass,!0).call(function(t){var e=nt(t,s,"axisTransition"),r=t.attr("transform");Pe.apply(a,n)!==r&&(r?e:t).attr("transform",Pe.apply(a,n)),e.call(o),e.attr("opacity",1)})},e.prototype._removeDimAxis=function(t,e){var n=ut(t,this._getAxisSelector(e)).classed("tau-active",!1);nt(n,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()},e.prototype._getAxisSelector=function(t){return"g."+("h"===Ne(t.guide.scaleOrient)?"x":"y")+".axis"},e.prototype._drawGrid=function(t,e,n,r){var i=this;return _r(t,"g.grid").attr("transform",Pe(0,0)).call(function(t){var a=t,o=i.config.guide.animationSpeed,s=(e.guide.showGridLines||"").toLowerCase();if(s.length>0){var u=_r(a,"g.grid-lines");if(s.indexOf("x")>-1){var l=e.x,c=Mn.get(l.guide.tickFormat),f=br({scale:l.scaleObj,scaleGuide:l.guide,tickSize:r,ticksCount:c?wr(n/l.guide.density):null}),d=_r(u,"g.grid-lines-x");nt(d,o).call(f)}if(s.indexOf("y")>-1){var h=e.y,p=(c=Mn.get(h.guide.tickFormat),br({scale:h.scaleObj,scaleGuide:h.guide,tickSize:-n,ticksCount:c?wr(r/h.guide.density):null})),g=_r(u,"g.grid-lines-y");nt(g,o).call(p)}}})},e}(m),Sr=n(11),Mr=n(8),Tr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Cr=function(){return(Cr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n})}else{var a=n[t].map(r[t].invert);e=[a[0],a[1]]}return{dim:r[t].dim,func:r[t].discrete?"inset":"between",args:e}});e.fire("brush",s)}};return t.selectAll(".brush").remove(),t.append("g").attr("class","brush").each(function(t){var e=r[t].range();i[t]=kr.brushY().extent([[0,e[0]],[16,e[1]]]).on("start",s).on("brush",l).on("end",u),kr.select(this).classed("brush-"+Ft(t),!0).call(i[t]),a=!1,i[t].move(kr.select(this),e),a=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),t},e.prototype._forceBrushing=function(t){void 0===t&&(t={});var e=this.columnsBrushes,n=this.columnsScalesMap;this.columnsSelections;Object.keys(t).filter(function(r){return e[r]&&n[r]&&t[r]}).forEach(function(r){var i=t[r],a=[];if(n[r].discrete){var o=i.map(n[r]).filter(function(t){return t>=0}),s=n[r].stepSize()/2;a=[Math.min.apply(Math,o)-s,Math.max.apply(Math,o)+s]}else a=[i[0],i[1]];var u=Ft(r);e[r](kr.select(".brush-"+u)),e[r].move(kr.select(".brush-"+u),a.map(n[r]))})},e}(m),Or=n(12);var Pr=n(4),Lr=function(){var t,e=[],n=[],r=1,i=1,a={},o=!1,s=function(t){var r=e.length,i=0,a=e[t].x-n[t].x,o=n[t].y-e[t].y,s=Math.sqrt(a*a+o*o);s>0&&(i+=.2*s),o/=s,i+=(a/=s)>0&&o>0?0:a<0&&o>0?3:a<0&&o<0?6:9;for(var u,l,f,d,h=e[t].x,p=e[t].y-e[t].height+2,g=e[t].x+e[t].width,m=e[t].y+2,y=0;yr&&(e[l].x=c),e[l].x<0&&(e[l].x=c),e[l].y>i&&(e[l].y=f),e[l].y<0&&(e[l].y=f);var d=(o?t(l,e,n):s(l))-u;Math.random()r&&(e[l].x=c),e[l].x<0&&(e[l].x=c),e[l].y>i&&(e[l].y=f),e[l].y<0&&(e[l].y=f);var y=(o?t(l,e,n):s(l))-u;Math.random()1||l<0||l>1)},f=function(t,e,n){return t-e/n};return a.start=function(t){for(var n=e.length,r=1,i=0;i=200&&r.status<300){var t=r.responseText;try{n(null,JSON.parse(t))}catch(t){n(t,null)}}else n(new Error(r.status+": "+r.statusText),null)},r.onerror=function(t){n(t.error,null)},r.open("GET",e,!0),r.send(null)):this._drawMap(t,a.sourcemap)},e.prototype._calcLabels=function(t,e,n){var r=this.W,i=this.H,a={};return e.forEach(function(e){var o=(Pr.feature(t,t.objects[e]).features||[]).map(function(t){var i=t.properties||{},a=n.centroid(t),o=n.bounds(t),s=a[0],u=a[1],l=o[1][0]-o[0][0],c=i.name||"",f=i.abbr||c,d=l<5.5*c.length?f:c,h=l<13.75,p=h?r-s-16.5:0;return{id:e+"-"+t.id,sx:s,sy:u,x:s+p,y:u,width:5.5*d.length,height:10,name:d,r:p,isRef:h}}).filter(function(t){return!Number.isNaN(t.x)&&!Number.isNaN(t.y)}),s=o.map(function(t){return{x:t.sx,y:t.sy,r:t.r}});Lr().label(o).anchor(s).width(r).height(i).start(10),o.filter(function(t){return!t.isRef}).map(function(t){return t.x=t.sx,t.y=t.sy,t}).reduce(function(t,e){return t[e.id]=e,t},a);var u=o.filter(function(t){return t.isRef});u.length<6&&u.reduce(function(t,e){return t[e.id]=e,t},a)}),a},e.prototype._drawMap=function(t,e){var n,r,i=this,a=this,s=this.config.guide,u=this.config.options,l=this.config.options.container,c=this.latScale,f=this.lonScale,d=this.sizeScale,h=this.colorScale,p=this.codeScale,g=this.fillScale,m=this.W,y=this.H,v=Dr.filter(function(t){return(e.objects||{}).hasOwnProperty(t)});if(0===v.length)throw new Error("Invalid map: should contain some contours");if(g.dim){if(!p.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===v.indexOf(p.georole))throw console.log('There is no contour for georole "'+p.georole+'"'),console.log("Available contours are: "+v.join(" | ")),new Error("Invalid [georole]");n=p.georole}else n=v[v.length-1];if(this.contourToFill=n,c.dim&&f.dim){var b=Fr.extent(c.domain()),x=Fr.extent(f.domain());r=[(x[1]+x[0])/2,(b[1]+b[0])/2]}var _=this._createProjection(e,v[0],r),w=Fr.geoPath().projection(_),E=l.selectAll(".map-container").data([""+m+y+r+v.join("-")],function(t){return t});E.exit().remove();var S=E.enter().append("g").call(function(t){var n=t;n.attr("class","map-container");var r={},i=v.reduceRight(function(t,e){return t.concat(e)},[]);if(s.showNames&&(r=a._calcLabels(e,i,w)),i.forEach(function(t,i){var a=function(e){return r[t+"-"+e.id]};n.selectAll(".map-contour-"+t).data(Pr.feature(e,e.objects[t]).features||[]).enter().append("g").call(function(e){var n=e;n.attr("class","map-contour-"+t+" map-contour-level map-contour-level-"+i).attr("fill","none"),n.append("title").text(function(t){return(t.properties||{}).name}),n.append("path").attr("d",w),n.append("text").attr("class","place-label-"+t).attr("transform",function(t){var e=a(t);return e?"translate("+[e.x,e.y]+")":""}).text(function(t){var e=a(t);return e?e.name:""}),n.append("line").attr("class","place-label-link-"+t).attr("stroke","gray").attr("stroke-width",.25).attr("x1",function(t){var e=a(t);return e&&e.isRef?e.sx:0}).attr("y1",function(t){var e=a(t);return e&&e.isRef?e.sy:0}).attr("x2",function(t){var e=a(t);return e&&e.isRef?e.x-.6*e.name.length*5.5:0}).attr("y2",function(t){var e=a(t);return e&&e.isRef?e.y-3.5:0})})}),e.objects.hasOwnProperty("places")){var o=Pr.feature(e,e.objects.places),u=o.features.map(function(t){var e=_(t.geometry.coordinates);return{x:e[0]+3.5,y:e[1]+3.5,width:5.5*t.properties.name.length,height:12,name:t.properties.name}}),l=o.features.map(function(t){var e=_(t.geometry.coordinates);return{x:e[0],y:e[1],r:2.5}});Lr().label(u).anchor(l).width(m).height(y).start(100),n.selectAll(".place").data(l).enter().append("circle").attr("class","place").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("r",function(t){return t.r+"px"}),n.selectAll(".place-label").data(u).enter().append("text").attr("class","place-label").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).text(function(t){return t.name})}}).merge(E);this.groupByCode=t.reduce(function(t,e){return e.part().reduce(function(t,e){return t[(e[p.dim]||"").toLowerCase()]=e,t},t)},{});var M=this._resolveFeature.bind(this);if(S.selectAll(".map-contour-"+n).data(Pr.feature(e,e.objects[n]).features).call(function(t){t.classed("map-contour",!0).attr("fill",function(t){var e=M(t);return null===e?s.defaultFill:g(e[g.dim])})}).on("mouseover",function(t){return i.fire("area-mouseover",{data:M(t),event:o.event})}).on("mouseout",function(t){return i.fire("area-mouseout",{data:M(t),event:o.event})}).on("click",function(t){return i.fire("area-click",{data:M(t),event:o.event})}),!c.dim||!f.dim)return[];var T=function(t){return t.attr("r",function(t){return d(t[d.dim])}).attr("transform",function(t){var e=t.data;return"translate("+_([e[f.dim],e[c.dim]])+")"}).attr("class",function(t){var e=t.data;return h(e[h.dim])}).attr("opacity",.5).on("mouseover",function(t){var e=t.data;return a.fire("point-mouseover",{data:e,event:o.event})}).on("mouseout",function(t){var e=t.data;return a.fire("point-mouseout",{data:e,event:o.event})}).on("click",function(t){var e=t.data;return a.fire("point-click",{data:e,event:o.event})})},C=S.selectAll(".frame").data(t.map(function(t){return{tags:t.key||{},hash:t.hash(),data:t.part()}}),function(t){return t.hash});return C.exit().remove(),C.enter().append("g").merge(C).call(function(t){t.attr("class",function(t){return"frame frame-"+t.hash}).call(function(t){var e=t.selectAll("circle").data(function(t){return t.data.map(function(t){return{data:t,uid:u.uid}})});e.exit().remove(),e.call(T),e.enter().append("circle").call(T)})}),[]},e.prototype._resolveFeature=function(t){var e,n=this.groupByCode,r=t.properties,i=["c1","c2","c3","abbr","name"].filter(function(t){return r.hasOwnProperty(t)&&r[t]&&n.hasOwnProperty(r[t].toLowerCase())});if(0===i.length)e=null;else if(i.length>0){var a=r[i[0]].toLowerCase();e=n[a]}return e},e.prototype._highlightArea=function(t){var e=this,n=this.config.options.container,r=this.contourToFill;n.selectAll(".map-contour-"+r).classed("map-contour-highlighted",function(n){return t(e._resolveFeature(n))})},e.prototype._highlightPoint=function(t){this.config.options.container.selectAll("circle").classed("map-point-highlighted",function(e){var n=e.data;return t(n)}).attr("opacity",function(e){var n=e.data;return t(n)?.5:.1})},e.prototype._createProjection=function(t,e,n){var r=this.W,i=this.H,a=this.config.guide,o=100,s=[r/2,i/2],u=n||t.center,l=a.projection||t.projection||"mercator",c=this._createD3Projection(l,u,o,s),f=Fr.geoPath().projection(c).bounds(Pr.feature(t,t.objects[e])),d=o*r/(f[1][0]-f[0][0]),h=o*i/(f[1][1]-f[0][1]);return o=d=0},Ur=function(t,e){return!t.discrete&&e[t.dim]<0},Xr=function(t,e){return t.w(e)/2+Math.floor(t.model.size(e)/Wr(t,e))},qr=function(t,e){return t.h(e)/2+Math.floor(t.model.size(e)/Wr(t,e))},Yr=function(t){return function(e){return{dx:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Gr(r,n))return e.dx(n);if("-"===t[2]&&!Ur(r,n))return e.dx(n);var i=t[1],a=t[0]===t[0].toUpperCase()?1:0;return e.dx(n)+i*a*e.model.size(n)/2+i*Xr(e,n)}}}},$r=function(t){return function(e){return{dy:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Gr(r,n))return e.dy(n);if("-"===t[2]&&!Ur(r,n))return e.dy(n);var i=t[1],a=t[0]===t[0].toUpperCase()?1:0;return e.dy(n)+i*a*e.model.size(n)/2+i*qr(e,n)}}}};Vr.regRule("l",Yr(["l",-1,null])).regRule("L",Yr(["L",-1,null])).regRule("l+",Yr(["l",-1,"+"])).regRule("l-",Yr(["l",-1,"-"])).regRule("L+",Yr(["L",-1,"+"])).regRule("L-",Yr(["L",-1,"-"])).regRule("r",Yr(["r",1,null])).regRule("R",Yr(["R",1,null])).regRule("r+",Yr(["r",1,"+"])).regRule("r-",Yr(["r",1,"-"])).regRule("R+",Yr(["R",1,"+"])).regRule("R-",Yr(["R",1,"-"])).regRule("t",$r(["t",-1,null])).regRule("T",$r(["T",-1,null])).regRule("t+",$r(["t",-1,"+"])).regRule("t-",$r(["t",-1,"-"])).regRule("T+",$r(["T",-1,"+"])).regRule("T-",$r(["T",-1,"-"])).regRule("b",$r(["b",1,null])).regRule("B",$r(["B",1,null])).regRule("b+",$r(["b",1,"+"])).regRule("b-",$r(["b",1,"-"])).regRule("B+",$r(["B",1,"+"])).regRule("B-",$r(["B",1,"-"])).regRule("rotate-on-size-overflow",function(t,e){var n=e.data,r=e.lineBreakAvailable,i={};if(n.reduce(function(e,n){return e+(function(e){return t.model.size(e).5){var a=r?-.5:.5;i={angle:function(){return-90},w:function(e){return t.h(e)},h:function(e){return t.w(e)},dx:function(e){return t.h(e)*a-2},dy:function(){return 0}}}return i}).regRule("hide-by-label-height-vertical",function(t){return{hide:function(e){var n,r;return 0===t.angle(e)?(r=t.h(e),n=Math.abs(t.model.y0(e)-t.model.yi(e))):(r=t.w(e),n=t.model.size(e)),r>n||t.hide(e)}}}).regRule("cut-label-vertical",function(t){return{h:function(e){var n=t.h(e);if(Math.abs(t.angle(e))>0){var r=Math.abs(t.model.y0(e)-t.model.yi(e));return r0){var i=t.model.y0(e)=0?1:-1}(t,n)*e(t,n)};return t.model.flip?{dx:n}:{dy:n}}).regRule("inside-start-then-outside-end-horizontal",function(t,e){var n=[Vr.getRule("from-beginning"),Vr.getRule("towards"),Vr.getRule("cut-label-horizontal")].reduce(function(t,n){return zr.compose(t,n(t,e))},t),r=[Vr.getRule("to-end"),Vr.getRule("towards"),Vr.getRule("cut-outer-label-horizontal")].reduce(function(t,n){return zr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("inside-start-then-outside-end-vertical",function(t,e){var n=[Vr.getRule("from-beginning"),Vr.getRule("towards"),Vr.getRule("cut-label-vertical")].reduce(function(t,n){return zr.compose(t,n(t,e))},t),r=[Vr.getRule("to-end"),Vr.getRule("towards"),Vr.getRule("cut-outer-label-vertical")].reduce(function(t,n){return zr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("outside-then-inside-horizontal",function(t,e){var n=["r+","l-","cut-outer-label-horizontal"].map(Vr.getRule).reduce(function(t,n){return zr.compose(t,n(t,e))},t),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(Vr.getRule).reduce(function(t,n){return zr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return r.label(t).length>n.label(t).length}(t)?r:n)[e](t)},t},{}))}).regRule("outside-then-inside-vertical",function(t,e){var n=["t+","b-","cut-outer-label-vertical"].map(Vr.getRule).reduce(function(t,n){return zr.compose(t,n(t,e))},t),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(Vr.getRule).reduce(function(t,n){return zr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,i){return t[i]=function(t){return(function(t){var r=n.y(t,e)+n.dy(t,e);return r<=0||r>=e.maxHeight}(t)?r:n)[i](t,e)},t},{}))}).regRule("hide-by-label-height-horizontal",function(t){return{hide:function(e){return t.model.size(e)0)return r+o;var s=i+a/2-n;return s>0?r-s:r},dy:function(e){var n=t.dy(e),i=t.y(e)+n,a=t.h(e);if(0-(i-a/2)>0)return 0;var o=i+a/2-r;return o>0?n-o:n}}}).regRule("multiline-label-left-align",function(t){return{dy:function(e){var n=t.dy(e);return-90===t.angle(e)?n+t.h(e)/2:n}}}).regRule("multiline-label-vertical-center-align",function(t){return{dy:function(e){return t.dy(e)-t.h(e)/2}}}).regRule("multiline-hide-on-container-overflow",function(t,e){var n=e.maxWidth,r=e.maxHeight;return{hide:function(e){var i=t.angle(e),a=t.x(e)+t.dx(e),o=t.y(e)+t.dy(e);return!(!Ut(a,t.w(e),i,n)&&!Xt(o,t.h(e),i,r))||t.hide(e)}}});var Kr=function(){function t(t){this.minError=Number.MAX_VALUE,this.items=t.items,this.revision=this.items.map(function(t){return{i:t.i,x:t.x,y:t.y}}),this.penalties=t.penalties,this.transactor=t.transactor,this.cooling_schedule=t.cooling_schedule||function(t,e,n){return t-e/n}}return t.prototype.energy=function(t){return this.penalties.reduce(function(e,n){return e+n(t)},0)},t.prototype.move=function(t){var e=Math.floor(Math.random()*this.items.length),n=this.transactor(this.items[e]),r=this.energy(e);this.items[e]=n.modify();var i=this.energy(e),a=i-r,o=a<0?1:Math.exp(-a/t);Math.random()>=o?this.items[e]=n.revert():i0&&d.length>0?this.autoPosition(c,d):c;var h=f.reduce(function(t,e){var n;return Object.assign(t,((n={})[e]=!0,n))},{});c.text=c.text=h["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(c.text,u):c.text,c.text=c.text=h["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(c.text,u):c.text,c.text=h["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(c.text,c.edges):c.text,c.text=h["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(c.text):c.text,c.text=h["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(c.text):c.text;var p=c.text,g=function(t){return function(e,n){return p[n][t]}},m=g("x"),y=g("y"),v=g("angle"),b=g("color"),x=g("label"),_=function(t){if(t.style("fill",b).style("font-size",e.guide.fontSize+"px").style("display",function(t,e){return p[e].hide?"none":null}).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",function(t,e){return"translate("+m(t,e)+","+y(t,e)+") rotate("+v(t,e)+")"}),i){t.each(function(t,e){var n=o.select(this),r=v(t,e);n.text(null),x(t,e).split(a).forEach(function(t,e){n.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(e+1)+"em").text(t)})})}else t.text(x)};r.hideEqualLabels&&p.filter(function(t){return!t.hide}).filter(function(t,e,n){return e0&&(t.hide=!0)}),t},t.prototype.hideOnLabelLabelOverlap=function(t){var e=this,n={min:0,max:1,norm:2},r={"min/min":function(t,e){return e.y-t.y},"max/max":function(t,e){return t.y-e.y},"min/max":function(){return-1},"min/norm":function(){return-1},"max/norm":function(){return-1},"norm/norm":function(t,e){return t.y-e.y}};return t.filter(function(t){return!t.hide}).sort(function(t,e){return n[t.extr]-n[e.extr]}).forEach(function(i){t.forEach(function(t){i.i!==t.i&&function(t,i){var a=e.getLabelRect(t),o=e.getLabelRect(i),s=Number(!t.hide&&!i.hide);if(s*Math.max(0,Math.min(o.x1,a.x1)-Math.max(a.x0,o.x0))*(s*Math.max(0,Math.min(o.y1,a.y1)-Math.max(a.y0,o.y0)))>0){var u=[t,i];u.sort(function(t,e){return n[t.extr]-n[e.extr]}),(r[u[0].extr+"/"+u[1].extr](u[0],u[1])<0?u[0]:u[1]).hide=!0}}(i,t)})}),t},t.prototype.getLabelRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.w/2-e,x1:t.x+t.w/2+e,y0:t.y-t.h/2-e,y1:t.y+t.h/2+e}},t.prototype.getPointRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.size/2-e,x1:t.x+t.size/2+e,y0:t.y-t.size/2-e,y1:t.y+t.size/2+e}},t.prototype.hideOnLabelAnchorOverlap=function(t){var e=this,n=function(t,n){var r=e.getLabelRect(t,2),i=e.getPointRect(n,2);return Math.max(0,Math.min(i.x1,r.x1)-Math.max(i.x0,r.x0))*Math.max(0,Math.min(i.y1,r.y1)-Math.max(i.y0,r.y0))>.001};return t.filter(function(t){return!t.hide}).forEach(function(e){for(var r=t.length,i=0;ir.right+u||sr.bottom+u)return null;var l=(i.find(o,s)||[]).map(function(t){var e=Math.sqrt(Math.pow(o-t.x,2)+Math.pow(s-t.y,2));if(e>u)return null;var n=ee.size)+" 1",n.left[0].x+","+n.left[0].y,"Z"].join(" "):di(t.size>e.size?t:e)}function pi(t,e,n,r){var i=function(t,e,n,r){var i=yi(t,r);if(0===i||i+t.size/2<=r.size/2||i+r.size/2<=t.size/2)return null;var a=function(i){var a=i?[r,n,e,t]:[t,e,n,r],o=bi.apply(void 0,[1/12*2].concat(a)),s=bi.apply(void 0,[.5].concat(o.slice(0,4))),u=s[3],l=s[6],c=_i(a[0],u),f=_i(u,l),d=[c.left[0],A(.5,c.left[1],f.left[0]),f.left[1]],h=[c.right[0],A(.5,c.right[1],f.right[0]),f.right[1]],p=xi.apply(void 0,d)[1],g=xi.apply(void 0,h)[1],m=A(4,c.left[0],p),y=A(4,c.right[0],g);return{left:i?[y,h[0]]:[d[0],m],right:i?[m,d[0]]:[h[0],y]}},o=a(!1),s=a(!0);return{left:o.left.concat(s.left),right:o.right.concat(s.right)}}(t,e,n,r);if(!i)return hi(t,r);var a=mi(gi(t,i.right[0]),gi(t,i.left[0])),o=mi(gi(r,i.right[1]),gi(r,i.left[1]));return["M"+i.left[0].x+","+i.left[0].y,"C"+i.left[1].x+","+i.left[1].y,i.left[2].x+","+i.left[2].y,i.left[3].x+","+i.left[3].y,"A"+r.size/2+","+r.size/2+" 0 "+Number(a>Math.PI)+" 1",i.right[3].x+","+i.right[3].y,"C"+i.right[2].x+","+i.right[2].y,i.right[1].x+","+i.right[1].y,i.right[0].x+","+i.right[0].y,"A"+t.size/2+","+t.size/2+" 0 "+Number(o>Math.PI)+" 1",i.left[0].x+","+i.left[0].y,"Z"].join(" ")}function gi(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function mi(t,e){return e1?[t]:[]},d);f.exit().remove(),f.call(s(n.animationSpeed,a.pathAttributesUpdateInit,a.pathAttributesUpdateDone,a.afterPathUpdate));f.enter().append(a.pathElement).call(s(n.animationSpeed,a.pathAttributesEnterInit,a.pathAttributesEnterDone,a.afterPathUpdate)).merge(f).call(function(t){e.guide.animationSpeed>0&&!document.hidden?(t.attr(a.pathTween.attr,function(t){return a.pathTween.fn.call(this,t)(0)}),nt(t,e.guide.animationSpeed,"pathTransition").attrTween(a.pathTween.attr,a.pathTween.fn)):t.attr(a.pathTween.attr,function(t){return a.pathTween.fn.call(this,t)(1)})});if(t.subscribe(c),"never"!==n.showAnchors){var h=function(t,e,n){var r=e.anchorShape,i=t.config.guide,a=t.screenModel,o=wi({},Ei[r].getInitialAttrs(t,e),{opacity:"hover"===i.showAnchors?0:1,fill:function(t){return a.color(t)},class:"i-data-anchor"}),s=n.selectAll(".i-data-anchor").data(function(t){return t.filter(ui)},a.id);return s.exit().remove(),s.call(st(i.animationSpeed,null,o)),s.enter().append(Ei[e.anchorShape].element).call(st(i.animationSpeed,{r:0},o)).merge(s)}(t,a,r);t.subscribe(h)}},l=i.toFibers(),c=l.map(function(t){return t.filter(ui)}),f=r.container.selectAll(".frame"),d=function(){var t=f.empty()?[]:f.data(),e=new Map;f.each(function(t){e.set(t,Number(this.getAttribute("data-id")))});var n=t.reduce(function(t,e){return t.set(e,e.map(i.id)),t},new Map),r=new Map,a=Math.max.apply(Math,[0].concat(Array.from(e.values())));return function(t){if(r.has(t))return r.get(t);var o,s=t.map(function(t){return i.id(t)}),u=(Array.from(n.entries()).find(function(t){var e=t[1];return s.some(function(t){return e.some(function(e){return e===t})})})||[null])[0];return o=u?e.get(u):++a,r.set(t,o),o}}();this._getDataSetId=d;var h=f.data(l,d);h.exit().remove(),h.call(u),h.enter().append("g").attr("data-id",d).call(u),h.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),t.subscribe(new ei(i.model,e.flip,e.guide.label,r).draw(c))},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=o.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n)}}).filter(function(t){return!isNaN(t.x)&&!isNaN(t.y)}),i=r.reduce(function(t,e){var n=e.x,r=e.y;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,t.top),t.bottom=Math.max(r,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=Yt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),s=a.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=a.find(n?function(e){return t.y===e}:function(e){return t.x===e});s[e].push(t)});var u=function(t){if(1===t.length)return s[t[0]];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:u(t.slice(0,e)),greater:u(t.slice(e))}};return{bounds:i,tree:u(a)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,a=this.node().config.options.container,o=this.node().config.flip,s=De(a.node()),u=this.node().config.guide.maxHighlightDistance;if(tr.right+s.x+u||er.bottom+s.y+u)return null;var l=o?e-s.y:t-s.x,c=function t(e){return Array.isArray(e)?e:t(l>e.middle?e.greater:e.lower)}(i).map(function(n){var r=n.x+s.x,i=n.y+s.y,a=Math.abs(o?e-i:t-r),u=Math.abs(o?t-r:e-i);return{node:n.node,data:n.data,distance:a,secondaryDistance:u,x:r,y:i}});return Si(t,e,c)},highlight:function(t){var e,n,r=this.node().config.options.container,i="tau-chart__highlighted",a="tau-chart__dimmed",o=r.selectAll(".i-role-path"),s=o.data().filter(function(e){return e.filter(ui).some(t)}),u=s.length>0;o.call(ft(((e={})[i]=function(t){return u&&s.indexOf(t)>=0},e[a]=function(t){return u&&s.indexOf(t)<0},e)));var l=((n={})[i]=function(e){return!0===t(e)},n[a]=function(e){return!1===t(e)},n);r.selectAll(".i-role-dot").call(ft(l)),r.selectAll(".i-role-label").call(ft(l)),this._sortElements(t)},highlightDataPoints:function(t){var e=this.node(),n=function(t,e,n){var r=e.anchorShape,i=t.screenModel,a="hover"===t.config.guide.showAnchors;return t.config.options.container.selectAll(".i-data-anchor").call(ct(Ei[r].getHighlightAttrs(t,e,n))).attr("opacity",a?function(t){return n(t)?1:0}:function(){return 1}).attr("fill",function(t){return i.color(t)}).attr("class",function(t){return Ae("i-data-anchor",i.class(t))}).classed(Xe+"highlighted",n)}(e,this.domElementModel,t),r=e.config.options.container,i=e.config.flip,a=n.filter(t),o=r.select(".cursor-line");if(a.empty())o.remove();else{o.empty()&&(o=r.append("line"));var s=e.screenModel.model,u=s.xi(a.data()[0]),l=s.xi(a.data()[0]),c=s.scaleY.domain(),f=s.scaleY(c[0]),d=s.scaleY(c[1]);o.attr("class","cursor-line").attr("x1",i?f:u).attr("y1",i?u:f).attr("x2",i?d:l).attr("y2",i?l:d)}this._sortElements(t)},_sortElements:function(t){var e=this.node().config.options.container,n=new Map,r=new Map,i=this._getDataSetId;e.selectAll(".i-role-path").each(function(e){n.set(this,i(e)),r.set(this,e.filter(ui).some(t))});var a=ee(function(t,e){return r.get(t)-r.get(e)},function(t,e){return n.get(t)-n.get(e)}),o={line:0,g:1,text:2};ke(e.node(),function(t,e){return"g"===t.tagName&&"g"===e.tagName?a(t,e):o[t.tagName]-o[e.tagName]})}},Ci=[1,2,3,4,5],ki=Ci.map(function(t){return Xe+"line-opacity-"+t}),Ai=Ci.map(function(t){return Xe+"line-width-"+t});function Oi(t){return ki[t-1]||ki[4]}function Pi(t,e){return t.length<2?"":String.prototype.concat.apply("",t.concat(e.slice().reverse()).map(function(t,e){return(0===e?"":" ")+t.x+","+t.y}))}function Li(t,e){if(t.length<2)return"";var n=function(t){var e=t.map(function(t,e){return""+((e-1)%3==0?"C":"")+t.x+","+t.y+" "});return String.prototype.concat.apply("",e)};return"M"+n(t)+"L"+n(e.slice().reverse())+"Z"}var Ni=function(){return(Ni=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&(n=Ri.rgb(n).darker(1)),n}};e.pathAttributesEnterInit=a,e.pathAttributesUpdateDone=a;var o="polyline"===K(n.interpolate);return e.pathElement=o?"polygon":"path",e.anchorShape="vertical-stick",e.pathTween={attr:o?"points":"d",fn:lt(0,o?Pi:Li,[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}},function(n){return{id:t.id(n),x:e.x0(n),y:e.y0(n)}}],t.id,n.interpolate)},e},_getBoundsInfo:function(t){if(0===t.length)return null;var e,n,r=this.node().screenModel,i=this.node().config.flip,a=t.map(function(t){var e=Ri.select(t).data()[0];return{node:t,data:e,x:r.x(e),y:r.y(e),y0:r.y0(e),group:r.group(e)}}),o=a.reduce(function(t,e){var n=e.x,r=e.y,i=e.y0;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,i,t.top),t.bottom=Math.max(r,i,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),s=Yt(a.map(i?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),u=s.reduce(function(t,e){return t[e]=[],t},{});if(a.forEach(function(t){var e=s.find(i?function(e){return t.y===e}:function(e){return t.x===e});u[e].push(t)}),e=Object.keys(a.reduce(function(t,e){return t[e.group]=!0,t},{})),n=e.reduce(function(t,e,n){return t[e]=n,t},{}),s.forEach(function(t){var r=u[t];if(r.sort(function(t,e){return n[t.group]-n[e.group]}),r.lengthr.right+s.x+u||er.bottom+s.y+u)return null;var l=o?e-s.y:t-s.x,c=function t(e){if(e.isLeaf)return e;var n=e.left.end;return t(l1&&(f=1);var d,h=(d=c.items.start.reduce(function(t,e){return t[e.group]={start:e,end:null,y:null,y0:null},t},{}),c.items.end.forEach(function(t){void 0!==d[t.group]?d[t.group].end=t:delete d[t.group]}),Object.keys(d).forEach(function(t){var e=d[t];e.end?(e.y=e.start.y+f*(e.end.y-e.start.y),e.y0=e.start.y0+f*(e.end.y0-e.start.y0)):delete d[t]}),Object.keys(d).map(function(t){return d[t]}).map(function(t){return{y:t.y,y0:t.y0,el:f<.5?t.start:t.end}}).filter(function(t){return null!=t.el.data})),p=e-s.y,g=h.filter(function(t){return p>=t.y&&p<=t.y0}),m=(g.length>0?g:h).map(function(t){return t.el}).map(function(n){var r=n.x+s.x,i=n.y+s.y,a=Math.abs(o?e-i:t-r),u=Math.abs(o?t-r:e-i);return{node:n.node,data:n.data,distance:a,secondaryDistance:u,x:r,y:i}});return Si(t,e,m)}},Di={draw:Ti.draw,getClosestElement:Ti.getClosestElement,highlight:Ti.highlight,highlightDataPoints:Ti.highlightDataPoints,addInteraction:Ti.addInteraction,_getBoundsInfo:Ti._getBoundsInfo,_sortElements:Ti._sortElements,init:function(t){var e=Ti.init(t);return e.transformRules=[e.flip&&M.get("flip")],e.adjustRules=[function(t,n){var r=t.scaleSize.isEmptyScale(),i=Qt(e.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),a=Object.assign({},n,{defMin:i.defMinSize,defMax:i.defMaxSize,minLimit:i.minSize,maxLimit:i.maxSize});return M.get("adjustStaticSizeScale")(t,a)}],e},buildModel:function(t){var e=Ti.baseModel(t),n=this.node().config.guide,r=Oi(t.model.scaleColor.domain().length),i=Xe+"area area i-role-path "+r+" "+n.cssClass+" ";e.groupAttributes={class:function(t){return i+" "+e.class(t[0])+" frame"}};var a,o,s={fill:function(t){return e.color(t[0])},stroke:function(t){return e.color(t[0])}};return e.pathAttributesEnterInit=s,e.pathAttributesUpdateDone=s,e.pathElement="polygon",e.anchorShape="circle",e.pathTween={attr:"points",fn:lt(0,(a=function(t){return t.x},o=function(t){return t.y},function(t){return t.map(function(t){return[a(t),o(t)].join(",")}).join(" ")}),[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}}],t.id)},e}};function ji(t){if(t.length<2)return"";for(var e="",n=0;n=160&&e<320?n=1:e>=320&&e<480?n=2:e>=480&&e<640?n=3:e>=640&&(n=4),Ai[n]):"",u=Oi(t.model.scaleColor.domain().length),l=o?"line":"area",c=""+Xe+l+" "+l+" i-role-path "+s+" "+u+" "+i.cssClass+" ",f=o?{stroke:function(t){return h.color(t[0])},class:"i-role-datum"}:{fill:function(t){return h.color(t[0])}},d="cubic"===K(i.interpolate)?o?Ii:fi:o?ji:ci,h=Ti.baseModel(t),p=o?function(e){return{id:t.id(e),x:h.x(e),y:h.y(e)}}:function(e){return{id:t.id(e),x:h.x(e),y:h.y(e),size:h.size(e)}};return h.groupAttributes={class:function(t){return c+" "+h.class(t[0])+" frame"}},h.pathElement="path",h.anchorShape="circle",h.pathAttributesEnterInit=f,h.pathAttributesUpdateDone=f,h.pathTween={attr:"d",fn:lt(0,d,[p],t.id,i.interpolate)},h}},Bi=function(t){return o.select(t).data()[0]},Vi={init:function(t){var e=Object.assign({},t);e.guide=e.guide||{},e.guide=Qt(e.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=e.guide.enableColorToBarPosition?e.guide.enableColorToBarPosition:!e.stack}),e.guide.size=Qt(e.guide.size||{},{enableDistributeEvenly:!0}),e.guide.label=Qt(e.guide.label||{},{position:e.flip?e.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:e.stack?["rotate-on-size-overflow","t-","b+","hide-by-label-height-vertical","cut-label-vertical","auto:hide-on-label-label-overlap"]:["rotate-on-size-overflow","outside-then-inside-vertical","auto:hide-on-label-label-overlap"]});var n=e.guide.avoidScalesOverflow,r=e.guide.enableColorToBarPosition,i=e.guide.size.enableDistributeEvenly;return e.transformRules=[e.flip&&M.get("flip"),e.guide.obsoleteVerticalStackOrder&&M.get("obsoleteVerticalStackOrder"),e.stack&&M.get("stack"),r&&M.get("positioningByColor")].filter(function(t){return t}),e.adjustRules=[i&&function(t,n){var r=Qt(e.guide.size||{},{defMinSize:e.guide.prettify?3:0,defMaxSize:e.guide.prettify?40:Number.MAX_VALUE}),i=Object.assign({},n,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return M.get("size_distribute_evenly")(t,i)},n&&i&&function(t,e){var n=Object.assign({},e,{sizeDirection:"x"});return M.get("avoidScalesOverflow")(t,n)},e.stack&&M.get("adjustYScale")].filter(function(t){return t}),e},addInteraction:function(){var t=this,e=this.node();e.on("highlight",function(e,n){return t.highlight(n)}),e.on("data-hover",function(e,n){return t.highlight((r=n.data,i=null,function(t){return t===r||i}));var r,i})},draw:function(){var t,e,n=this.node(),r=n.config,i=r.options;i.container=i.slot(r.uid);var a=r.guide.prettify,s="i-role-element i-role-datum bar "+Xe+"bar",u=n.screenModel,l=this.buildModel(u,{prettify:a,minBarH:1,minBarW:1,baseCssClass:s}),c=st,f=r.flip?"y":"x",d=r.flip?"x":"y",h=r.flip?"width":"height",p=r.flip?"height":"width",g=u.toFibers(),m=g.reduce(function(t,e){return t.concat(e)},[]),y=l.class,v=Zt(l,"class"),b=i.container.selectAll(".bar").data(m,u.id);b.exit().classed("tau-removing",!0).call(c(r.guide.animationSpeed,null,((t={})[f]=function(){var t=o.select(this);return t.attr(f)-0+(t.attr(p)-0)/2},t[d]=function(){return this.getAttribute("data-zero")},t[p]=0,t[h]=0,t),function(t){var e=o.select(t);e.classed("tau-removing")&&e.remove()})),b.call(c(r.guide.animationSpeed,null,v));var x=b.enter().append("rect").call(c(r.guide.animationSpeed,(e={},e[d]=u[d+"0"],e[h]=0,e),v)).merge(b).attr("class",y).attr("data-zero",u[d+"0"]);n.subscribe(new ei(u.model,u.model.flip,r.guide.label,i).draw(g));var _,w=(_=m.reduce(function(t,e,n){return t.set(e,n+1),t},new Map),function(t,e){return(_.get(Bi(t))||-1)-(_.get(Bi(e))||-1)});this._barsSorter=r.guide.sortByBarHeight?r.flip?function(t,e){var n=Bi(t),r=Bi(e),i=l.width(n),a=l.width(r);if(i===a){var o=l.y(n),s=l.y(r);return o===s?w(t,e):o-s}return a-i}:function(t,e){var n=Bi(t),r=Bi(e),i=l.height(n),a=l.height(r);if(i===a){var o=l.x(n),s=l.x(r);return o===s?w(t,e):o-s}return a-i}:w;var E={rect:0,text:1};this._typeSorter=function(t,e){return E[t.tagName]-E[e.tagName]},this._sortElements(this._typeSorter,this._barsSorter),n.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel:function(t,e){var n,r=e.prettify,i=e.minBarH,a=e.minBarW,o=e.baseCssClass,s=function(e){var n=t.size(e);return r&&(n=Math.max(a,n)),n},u=function(e){return e[t.model.scaleY.dim]};if(t.flip){var l=function(e){return Math.abs(t.x(e)-t.x0(e))};n={y:function(e){return t.y(e)-.5*s(e)},x:function(e){var n=Math.min(t.x0(e),t.x(e));if(r){var a=l(e),o=u(e),s=0;return 0===o&&(s=0),o>0&&(s=a),o<0&&(s=0-i),a0?n-i:n);return n},width:function(t){return s(t)},height:function(t){var e=c(t);return r&&(e=0===u(t)?e:Math.max(i,e)),e}}}return Object.assign(n,{class:function(e){return o+" "+t.class(e)},fill:function(e){return t.color(e)}})},_sortElements:function(){for(var t=[],e=0;es}}),i=r.reduce(function(t,e){var n=e.box;return t.left=Math.min(n.left,t.left),t.right=Math.max(n.right,t.right),t.top=Math.min(n.top,t.top),t.bottom=Math.max(n.bottom,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=Yt(r.map(n?function(t){return t.cy}:function(t){return t.cx})).sort(function(t,e){return t-e}),s=a.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=a.find(n?function(e){return t.cy===e}:function(e){return t.cx===e});s[e].push(t)});var u=function(t){if(1===t.length)return s[t];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:u(t.slice(0,e)),greater:u(t.slice(e))}};return{bounds:i,tree:u(a)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,a=this.node().config.options.container,o=this.node().config.flip,s=De(a.node()),u=t-s.x,l=e-s.y,c=this.node().config.guide.maxHighlightDistance;if(ur.right+c||lr.bottom+c)return null;var f=o?l:u,d=o?u:l;return function t(e){return Array.isArray(e)?e:t(f>e.middle?e.greater:e.lower)}(i).map(function(t){var e,n,r=o?t.box.left:t.box.top,i=o?t.box.right:t.box.bottom,a=(n=i,(e=d)>=r&&e<=n);if(!a&&Math.abs(d-r)>c&&Math.abs(d-i)>c)return null;var s=Math.abs(d-(t.invert!==o?i:r));return Object.assign(t,{distToValue:s,cursorInside:a})}).filter(function(t){return t}).sort(function(t,e){return t.cursorInside!==e.cursorInside?e.cursorInside-t.cursorInside:Math.abs(t.distToValue)-Math.abs(e.distToValue)}).map(function(t){var e=t.cx,n=t.cy,r=Math.abs(o?l-n:u-e),i=Math.abs(o?u-e:l-n);return{node:t.node,data:t.data,distance:r,secondaryDistance:i,x:e,y:n}})[0]||null},highlight:function(t){var e,n=this.node().config.options.container,r=((e={})["tau-chart__highlighted"]=function(e){return!0===t(e)},e["tau-chart__dimmed"]=function(e){return!1===t(e)},e);n.selectAll(".bar").call(ft(r)),n.selectAll(".i-role-label").call(ft(r)),this._sortElements(function(e,n){return t(Bi(e))-t(Bi(n))},this._typeSorter,this._barsSorter)}},Hi=n(14),Wi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gi=function(t){function e(e){var n=t.call(this,e)||this;return n.config=e,n.config.guide=Qt(n.config.guide||{},{}),n.on("highlight",function(t,e){return n.highlight(e)}),n}return Wi(e,t),e.prototype.defineGrammarModel=function(t){var e=this.config,n=e.options;this.color=t("color",e.color,{}),this.scalesMap=e.columns.reduce(function(e,r){return e[r]=t("pos",r,[0,n.height]),e},{});var r=n.width/(e.columns.length-1),i=e.columns.reduce(function(t,e,n){return t[e]=n*r,t},{});return this.xBase=function(t){return i[t]},this.regScale("columns",this.scalesMap).regScale("color",this.color),{}},e.prototype.drawFrames=function(t){var e=this.config,n=this.config.options,r=this.scalesMap,i=this.xBase,a=this.color,o=Hi.line(),s=function(t){t.attr("d",function(t){return o(e.columns.map(function(e){return[i(e),r[e](t[r[e].dim])]}))})},u=function(t){t.attr("stroke",function(t){return a.toColor(a(t[a.dim]))}),t.attr("class",function(t){return Xe+"__line line "+a.toClass(a(t[a.dim]))+" foreground"})},l=function(t){var e=t.selectAll(".background").data(function(t){return t.part()});e.exit().remove(),e.call(s),e.enter().append("path").attr("class","background line").call(s);var n=t.selectAll(".foreground").data(function(t){return t.part()});n.exit().remove(),n.call(function(t){s(t),u(t)}),n.enter().append("path").call(function(t){s(t),u(t)})},c=n.container.selectAll(".lines-frame").data(t,function(t){return t.hash()});c.exit().remove(),c.call(l),c.enter().append("g").attr("class","lines-frame").call(l),this.subscribe(n.container.selectAll(".lines-frame .foreground"))},e.prototype.highlight=function(t){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",function(e){return t(e)?"":"hidden"})},e}(m),Ui=function(){function t(t,e){var n,r=this;if(this._fields={},Array.isArray(e.fitToFrameByDims)&&e.fitToFrameByDims.length){n=t.part(function(t){var n={};return"where"===t.type&&t.args?(n.type=t.type,n.args=e.fitToFrameByDims.reduce(function(e,n){return t.args.hasOwnProperty(n)&&(e[n]=t.args[n]),e},{})):n=t,n})}else n=t.full();var i=this.getVarSet(n,e);e.order&&(i=Kt(Jt(e.order,i),i)),this.vars=i;var a=i.map(function(t){return t});this.scaleConfig=e,this.scaleConfig.nice=this.scaleConfig.hasOwnProperty("nice")?this.scaleConfig.nice:this.scaleConfig.autoScale,this.addField("dim",this.scaleConfig.dim).addField("scaleDim",this.scaleConfig.dim).addField("scaleType",this.scaleConfig.type).addField("source",this.scaleConfig.source).addField("domain",function(){return r.vars}).addField("isInteger",a.every(Number.isInteger)).addField("originalSeries",function(){return a}).addField("isContains",function(t){return r.isInDomain(t)}).addField("isEmptyScale",function(){return r.isEmpty()}).addField("fixup",function(t){var e=r.scaleConfig;e.__fixup__=e.__fixup__||{},e.__fixup__=Object.assign(e.__fixup__,t(Object.assign({},e,e.__fixup__)))}).addField("commit",function(){r.scaleConfig=Object.assign(r.scaleConfig,r.scaleConfig.__fixup__),delete r.scaleConfig.__fixup__})}return t.prototype.isInDomain=function(t){return this.domain().indexOf(t)>=0},t.prototype.addField=function(t,e){return this._fields[t]=e,this[t]=e,this},t.prototype.getField=function(t){return this._fields[t]},t.prototype.isEmpty=function(){return!Boolean(this._fields.dim)},t.prototype.toBaseScale=function(t,e){var n=this;void 0===e&&(e=null);var r=Object.keys(this._fields).reduce(function(t,e){return t[e]=n._fields[e],t},t);return r.getHash=function(){return Ft([n.vars,e].map(function(t){return JSON.stringify}).join(""))},r.value=r,r},t.prototype.getVarSet=function(t,e){return Yt(e.hasOwnProperty("series")?e.series:t.map(function(t){return t[e.dim]}),"date"===e.dimType?function(t){return new Date(t).getTime()}:function(t){return t})},t}(),Xi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._references=n.references,r._refCounter=n.refCounter,r.addField("scaleType","identity"),r}return Xi(e,t),e.prototype.create=function(){var t=this._references,e=this._refCounter;return this.toBaseScale(function(n,r){if(null==n){var i=t.get(r);null==i&&(i=e(),t.set(r,i))}else i=n;return i})},e}(Ui),Yi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i=function(){return($i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var h=Math.max.apply(Math,s.map(Math.abs));s=[-h,h]}r.vars=s}return r.addField("scaleType","color").addField("discrete",i).addField("brewer",a).addField("toColor",Bt).addField("toClass",Vt),r}return Yi(e,t),e.prototype.create=function(){var t=this.discrete,e=this.vars,n=this.getField("brewer"),r=t?this.createDiscreteScale(e,n):this.createContinuesScale(e,n);return this.toBaseScale(r)},e.prototype.createDiscreteScale=function(t,e){var n,r=function(t,e){var n=t.map(function(t){return String(t).toString()});return Ki.scaleOrdinal().range(e).domain(n)},i=function(t){return function(e){return t(String(e).toString())}};if(Array.isArray(e))n=i(r(t,e));else if("function"==typeof e)n=function(n){return e(n,i(r(t,Gt(20).map(function(t){return"color20-"+(1+t)}))))};else{if(!Ot(e))throw new Error("This brewer is not supported");n=function(t,e){var n=Object.keys(t),r=n.map(function(e){return t[e]}),i=Ki.scaleOrdinal().range(r).domain(n);return function(n){return t.hasOwnProperty(n)?i(String(n)):e(n)}}(e,function(){return"color-default"})}return n},e.prototype.createContinuesScale=function(t,e){if(!Array.isArray(e))throw new Error("This brewer is not supported");return Ki.scaleLinear().domain(zt(t.map(function(t){return t-0}),e.length)).range(e)},e}(Ui),Qi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zi={sqrt:function(t){return Math.sqrt(t)},linear:function(t){return t}},ta=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=r.scaleConfig,a=s.extent(r.vars),o=Number.isFinite(i.min)?i.min:a[0],u=Number.isFinite(i.max)?i.max:a[1];return r.vars=[Math.min.apply(Math,[o,a[0]].filter(Number.isFinite)),Math.max.apply(Math,[u,a[1]].filter(Number.isFinite))],r.addField("scaleType","size"),r.addField("funcType",n.func||"sqrt"),r}return Qi(e,t),e.prototype.isInDomain=function(t){var e=this.domain().sort(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(){var t,e=this.scaleConfig,n=this.vars,r=Qt({},e,{func:"sqrt",minSize:0,maxSize:1}),i=r.func,a=r.minSize,o=r.maxSize,s=Zi[i],u=n.filter(function(t){return Number.isFinite(Number(t))});if(0===u.length)t=function(){return o};else{var l,c,f=Math.min.apply(Math,u),d=Math.max.apply(Math,u),h=s(Math.max(Math.abs(f),Math.abs(d),d-f));c=f<0?f:0,l=0===h?1:(o-a)/h,t=function(t){var e=null!==t?parseFloat(t):0;return Number.isFinite(e)?a+s(e-c)*l:o}}return this.toBaseScale(t)},e}(Ui),ea=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),na=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","ordinal").addField("discrete",!0),r}return ea(e,t),e.prototype.create=function(t){var e=this.scaleConfig,n=this.vars,r=u.scalePoint().domain(n).range(t).padding(.5),i=Math.max.apply(Math,t),a=function(t){return"function"==typeof e.ratio?e.ratio(t,i,n):"object"==typeof e.ratio?e.ratio[t]:1/n.length},o=function(t){return e.ratio?i-n.slice(n.indexOf(t)+1).reduce(function(t,e){return t+i*a(e)},i*a(t)*.5):r(t)};return Object.keys(r).forEach(function(t){return o[t]=r[t]}),o.stepSize=function(t){return a(t)*i},this.toBaseScale(o,t)},e}(Ui),ra=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ia=function(){return(ia=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0},e.prototype.create=function(t){var e=this.periodGenerator,n=this.vars,r=this.vars.map(function(t){return t.getTime()}),i=this.scaleConfig,a=aa.scalePoint().domain(n).range(t).padding(.5),o=aa.scalePoint().domain(r.map(String)).range(t).padding(.5),s=Math.max.apply(Math,t),u=function(t){var e=new Date(t).getTime();return"function"==typeof i.ratio?i.ratio(e,s,r):"object"==typeof i.ratio?i.ratio[e]:1/n.length},l=function(t){var n=new Date(t),a=(e?e.cast(n):n).getTime();return i.ratio?s-r.slice(r.indexOf(a)+1).reduce(function(t,e){return t+s*u(e)},s*u(t)*.5):o(String(a))};return Object.keys(a).forEach(function(t){return l[t]=a[t]}),l.stepSize=function(t){return u(t)*s},this.toBaseScale(l,t)},e}(Ui),sa=n(15),ua=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),la=function(){return(la=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=r},e.prototype.create=function(t){var e=this,n=this.vars,r=this.scaleConfig.utcTime,i=this.periodGenerator,a=(r?ca.scaleUtc:ca.scaleTime)().domain(n).range(t),o=function(t){var e=n[0],r=n[1];return t>r&&(t=r),t=i&&t<=a});return function(t,e,n){void 0===n&&(n=10);var r,i,a=Number(t[0]),o=Number(t[1]),s=Math.abs(o-a)/n,u=ca.bisector(function(t){return t.duration}).right(ga,s);if(u===ga.length)r=e?ca.utcYear:ca.timeYear,i=ca.tickStep(a/pa.year.duration,o/pa.year.duration,n);else if(u){var l=s/ga[u-1].duration,c=ga[u].duration/s,f=ga[lc&&(e=c),a(e)}}return Object.keys(a).forEach(function(t){return o[t]=a[t]}),o.stepSize=function(){return 0},this.toBaseScale(o,t)},e}(Ui);function da(t){return ca["time"+t[0].toUpperCase()+t.slice(1)]}var ha,pa={second:{duration:1e3,interval:ca.timeSecond,utc:ca.utcSecond},minute:{duration:6e4,interval:ca.timeMinute,utc:ca.utcMinute},hour:{duration:36e5,interval:ca.timeHour,utc:ca.utcHour},day:{duration:864e5,interval:ca.timeDay,utc:ca.utcDay},week:{duration:6048e5,interval:ca.timeWeek,utc:ca.utcWeek},month:{duration:2592e6,interval:ca.timeMonth,utc:ca.utcMonth},year:{duration:31536e6,interval:ca.timeYear,utc:ca.utcYear}},ga=[(ha=function(t,e){return{time:t,step:e,duration:e*t.duration}})(pa.second,1),ha(pa.second,5),ha(pa.second,15),ha(pa.second,30),ha(pa.minute,1),ha(pa.minute,5),ha(pa.minute,15),ha(pa.minute,30),ha(pa.hour,1),ha(pa.hour,3),ha(pa.hour,6),ha(pa.hour,12),ha(pa.day,1),ha(pa.day,2),ha(pa.week,1),ha(pa.month,1),ha(pa.month,3),ha(pa.year,1)];var ma=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ya=function(){return(ya=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(t){var e=this.vars,n=this.extendScale(va.scaleLinear());return n.domain(e).range(t).clamp(!0),this.toBaseScale(n,t)},e.prototype.extendScale=function(t){var e=this,n=t.copy,r=t.ticks;return Object.assign(t,{stepSize:function(){return 0},copy:function(){return e.extendScale(n.call(t))},ticks:this.getField("isInteger")?function(e){return r.call(t,e).filter(Number.isInteger)}:t.ticks}),t},e}(Ui),xa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_a=function(){return(_a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0,n=t.map(function(t){return Math.abs(t)}),r=Math.max.apply(Math,n),i=Math.min.apply(Math,n).toExponential().split("e"),a=r.toExponential().split("e"),o=parseFloat(Math.floor(Number(i[0]))+"e"+i[1]),s=parseFloat(Math.ceil(Number(a[0]))+"e"+a[1]);return e?[o,s]:[-s,-o]}(a)),r.vars=a,r.addField("scaleType","logarithmic").addField("discrete",!1),r}return xa(e,t),e.prototype.isInDomain=function(t){var e=this.domain(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(t){var e=this.vars;Ma(e);var n=function t(e){var n=e.copy;e.ticks=function(t){for(var n=[],r=wa.extent(e.domain()),i=Math.floor(Sa(r[0])),a=Math.ceil(Sa(r[1])),o=Math.ceil(10*(a-i)/(10*Math.ceil(t/10))),s=i;s<=a;s+=o)for(var u=1;u<=10;u++){var l=Math.pow(u,o)*Math.pow(10,s);(l=parseFloat(l.toExponential(0)))>=r[0]&&l<=r[1]&&n.push(l)}return n};e.copy=function(){var r=n.call(e);return t(r),r};return e}(wa.scaleLog()).domain(e).range(t);return n.stepSize=function(){return 0},this.toBaseScale(n,t)},e}(Ui);function Sa(t){return Math.log(t)/Math.LN10}function Ma(t){if(t[0]*t[1]<=0)throw new w("Logarithmic scale domain cannot cross zero.",E.INVALID_LOG_DOMAIN)}var Ta,Ca=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ka=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","value").addField("georole",n.georole),r}return Ca(e,t),e.prototype.create=function(){return this.toBaseScale(function(t){return t})},e}(Ui),Aa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Oa=function(){return(Oa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(){var t=this.vars,e=this.getField("brewer");if(!Array.isArray(e))throw new Error("This brewer is not supported");var n=e.length,r=(t[1]-t[0])/n,i=Gt(n-1).map(function(t){return t+1}).reduce(function(e,n){return e.concat([t[0]+n*r])},[]),a=Pa.scaleThreshold().domain(i).range(e);return this.toBaseScale(a)},e}(Ui),Na=function(t){return t||null},Ra=function(t,e){return void 0===e&&(e=null),Array.isArray(t)?0===t.length?[e]:t:[t]},Fa=function(t,e){return{type:t,x:e.x,y:e.y,identity:e.identity,size:e.size,color:e.color,split:e.split,label:e.label,guide:{color:e.colorGuide,obsoleteVerticalStackOrder:e.obsoleteVerticalStackOrder,size:e.sizeGuide},flip:e.flip,stack:e.stack}},Da={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},ja=((Ta={})[Da.SUCCESS]=function(t){return t},Ta[Da.FAIL]=function(t,e){throw new Error((e.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},Ta[Da.WARNING]=function(t,e,n){var r=e.axis,i=e.indexMeasureAxis[0],a=t[i],o=t.filter(function(t){return t!==a});o.push(a);var s=n[i][r]||{},u=n[n.length-1][r]||{};return n[n.length-1][r]=s,n[i][r]=u,o},Ta);function Ia(t,e,n){return e.reduce(function(e,r,i){var a=t[r];return a?e.status!=Da.FAIL&&("measure"===a.type&&(e.countMeasureAxis++,e.indexMeasureAxis.push(i)),"measure"!==a.type&&1===e.countMeasureAxis?e.status=Da.WARNING:e.countMeasureAxis>1&&(e.status=Da.FAIL,e.messages.push('There is more than one measure dimension for "'+n+'" axis'))):(e.status=Da.FAIL,r?e.messages.push('"'+r+'" dimension is undefined for "'+n+'" axis'):e.messages.push('"'+n+'" axis should be specified')),e},{status:Da.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:n})}function za(t){for(var e=Ra(t.x),n=Ra(t.y),r=Math.max(e.length,n.length),i=Ra(t.guide||{},{}),a=r-i.length,o=0;o0;c--){var f=s.pop(),d=u.pop(),h=l.pop()||{};c===a?(o.x=f,o.y=d,o.unit.push(Fa(t,{x:Na(f),y:Na(d),identity:e.identity,split:e.split,color:e.color,label:e.label,size:e.size,flip:e.flip,stack:e.stack,colorGuide:h.color,obsoleteVerticalStackOrder:h.obsoleteVerticalStackOrder,sizeGuide:h.size})),o.guide=Qt(h,{x:{label:f},y:{label:d}})):o={type:"COORDS.RECT",x:Na(f),y:Na(d),unit:[o],guide:Qt(h,{x:{label:f},y:{label:d}})}}return e.spec={dimensions:e.dimensions,unit:o},e}var Va=function(t){var e,n,r,i=za(t);return n=((e=i).flip?e.y:e.x).indexOf(e.color)>=0,r=e.guide[e.guide.length-1],n&&!r.hasOwnProperty("enableColorToBarPosition")&&(r.enableColorToBarPosition=!1),Ba("ELEMENT.INTERVAL",i=e)},Ha=function(t){var e=za(t),n=e.data,r=e.settings.log,i=(0,{horizontal:function(t){return{prop:t.x[t.x.length-1],flip:!1}},vertical:function(t){return{prop:t.y[t.y.length-1],flip:!0}},auto:function(t){var e,i=t.x,a=t.y,o=i[i.length-1],s=i.slice(0,i.length-1),u=a[a.length-1],l=a.slice(0,a.length-1),c=t.color,f=s.concat(l).concat([c]).filter(function(t){return null!==t}),d=-1,h=[[[o].concat(f),u],[[u].concat(f),o]],p=null;return h.some(function(t,e){var i=t[0],a=t[1],o=un(n,i,[a]);return o.result?d=e:r(["Attempt to find a functional relation between",t[0]+" and "+t[1]+" is failed.","There are several "+o.error.keyY+" values (e.g. "+o.error.errY.join(",")+")","for ("+o.error.keyX+" = "+o.error.valX+")."].join(" ")),o.result})?(e=h[d][0][0],p=0!==d):(r("All attempts are failed. Gonna transform AREA to general PATH."),e=null),{prop:e,flip:p}}}["boolean"!=typeof e.flip?"auto":e.flip?"vertical":"horizontal"])(e);return null!==i.prop&&(e.data=dn(n,i.prop,e.dimensions[i.prop]),e.flip=i.flip),Ba("ELEMENT.AREA",e)},Wa=function(){function t(t){this.unitRef=t}return t.prototype.value=function(){return this.unitRef},t.prototype.clone=function(){return JSON.parse(JSON.stringify(this.unitRef))},t.prototype.traverse=function(t){var e=function(t,n,r){n(t,r),(t.units||[]).map(function(r){return e(r,n,t)})};return e(this.unitRef,t,null),this},t.prototype.reduce=function(t,e){var n=e;return this.traverse(function(e,r){return n=t(n,e,r)}),n},t.prototype.addFrame=function(t){return this.unitRef.frames=this.unitRef.frames||[],t.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),t.source=t.hasOwnProperty("source")?t.source:this.unitRef.expression.source,t.pipe=t.pipe||[],this.unitRef.frames.push(t),this},t.prototype.addTransformation=function(t,e){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:t,args:e}),this},t.prototype.isCoordinates=function(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")},t.prototype.isElementOf=function(t){if(this.isCoordinates())return!1;var e=(this.unitRef.type||"").split("/");return 1===e.length&&e.unshift("RECT"),e[0].toUpperCase()===t.toUpperCase()},t}(),Ga=function(){function t(t){this.specRef=t}return t.prototype.value=function(){return this.specRef},t.prototype.unit=function(t){return t&&(this.specRef.unit=t),new Wa(this.specRef.unit)},t.prototype.addTransformation=function(t,e){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[t]=e,this},t.prototype.getSettings=function(t){return this.specRef.settings[t]},t.prototype.setSettings=function(t,e){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[t]=e,this},t.prototype.getScale=function(t){return this.specRef.scales[t]},t.prototype.addScale=function(t,e){return this.specRef.scales[t]=e,this},t.prototype.regSource=function(t,e){return this.specRef.sources[t]=e,this},t.prototype.getSourceData=function(t){return(this.specRef.sources[t]||{data:[]}).data},t.prototype.getSourceDim=function(t,e){return(this.specRef.sources[t]||{dims:{}}).dims[e]||{}},t}(),Ua={},Xa=function(){function t(){}return t.unit=function(t){return new Wa(t)},t.spec=function(t){return new Ga(t)},t.cloneObject=function(t){return JSON.parse(JSON.stringify(t))},t.depthFirstSearch=function(e,n){if(n(e))return e;for(var r=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],i=0;i1))return"[columns] property must contain at least 2 dimensions"}]));var Ja="2.7.2";e.default={GPL:Ue,Plot:or,Chart:dr,api:$a,version:"2.7.2"}},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=a},function(t,e){t.exports=o},function(t,e){t.exports=s},function(t,e){t.exports=u},function(t,e,n){var r,i,a;i=[],void 0===(a="function"==typeof(r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){return t.indexOf(e)},r=window,i=r.document,a=i.documentElement,o=["top","bottom"];function s(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e,n=r.pageYOffset||a.scrollTop,i=r.pageXOffset||a.scrollLeft,o={left:0,right:0,top:0,bottom:0,width:0,height:0};if((e=t)&&null!=e.setInterval)o.width=r.innerWidth||a.clientWidth,o.height=r.innerHeight||a.clientHeight;else{if(!a.contains(t)||null==t.getBoundingClientRect)return o;s(o,t.getBoundingClientRect()),o.width=o.right-o.left,o.height=o.bottom-o.top}return o.top=o.top+n-a.clientTop,o.left=o.left+i-a.clientLeft,o.right=o.left+o.width,o.bottom=o.top+o.height,o}var l=function(t,e){return r.getComputedStyle(t)[e]};function c(t){var e=String(l(t,c.propName)),n=e.match(/([0-9.]+)([ms]{1,2})/);return n&&(e=Number(n[1]),"s"===n[2]&&(e*=1e3)),0|e}c.propName=function(){for(var t=i.createElement("div"),e=["transitionDuration","webkitTransitionDuration"],n=0;n=e.bottom&&(i[0]="top"),i[1]){case"left":t.right-this.width<=e.left&&(i[1]="right");break;case"right":t.left+this.width>=e.right&&(i[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?i[1]="left":t.right-t.width/2-this.width/2<=e.left&&(i[1]="right")}else switch(t.left-this.width-a<=e.left?i[0]="right":t.right+this.width+a>=e.right&&(i[0]="left"),i[1]){case"top":t.bottom-this.height<=e.top&&(i[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(i[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?i[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(i[1]="bottom")}return i.join("-")},d.prototype.position=function(t,e){this.attachedTo&&(t=this.attachedTo),null==t&&this._p?(t=this._p[0],e=this._p[1]):this._p=arguments;var n,r,i="number"==typeof t?{left:0|t,right:0|t,top:0|e,bottom:0|e,width:0,height:0}:u(t),a=this.spacing,o=this._pickPlace(i);switch(o!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(o),this.curPlace=o),this.curPlace){case"top":n=i.top-this.height-a,r=i.left+i.width/2-this.width/2;break;case"top-left":n=i.top-this.height-a,r=i.right-this.width;break;case"top-right":n=i.top-this.height-a,r=i.left;break;case"bottom":n=i.bottom+a,r=i.left+i.width/2-this.width/2;break;case"bottom-left":n=i.bottom+a,r=i.right-this.width;break;case"bottom-right":n=i.bottom+a,r=i.left;break;case"left":n=i.top+i.height/2-this.height/2,r=i.left-this.width-a;break;case"left-top":n=i.bottom-this.height,r=i.left-this.width-a;break;case"left-bottom":n=i.top,r=i.left-this.width-a;break;case"right":n=i.top+i.height/2-this.height/2,r=i.right+a;break;case"right-top":n=i.bottom-this.height,r=i.right+a;break;case"right-bottom":n=i.top,r=i.right+a}return this.element.style.top=Math.round(n)+"px",this.element.style.left=Math.round(r)+"px",this},d.prototype.show=function(t,e){return t=this.attachedTo?this.attachedTo:t,clearTimeout(this.aIndex),null!=t&&this.position(t,e),this.hidden&&(this.hidden=0,i.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},d.prototype.getElement=function(){return this.element},d.prototype.hide=function(){if(!this.hidden){var t=this,e=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(e=c(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){t.aIndex=0,i.body.removeChild(t.element),t.hidden=1},e),this}},d.prototype.toggle=function(t,e){return this[this.hidden?"show":"hide"](t,e)},d.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||i.body.removeChild(this.element),this.element=this.options=null},d.prototype._aware=function(){-1===n(d.winAware,this)&&d.winAware.push(this)},d.prototype._unaware=function(){var t=n(d.winAware,this);-1!==t&&d.winAware.splice(t,1)},d.reposition=function(){var t,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,17)};function n(){t=0;for(var e=0,n=d.winAware.length;e0)-(t<0)||Number(t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],a=0;a>>0,i=arguments[1],a=0;a0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),o)},function(t){var e=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!a(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(n=arguments[2])}for(var i,o=s(e.length),u=a(this)?Object(new this(o)):new Array(o),l=0;l]*>/,"");var e=new ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}try{var a=n.xmldom?new r.DOMParser(n.xmldom):new r.DOMParser;return a.parseFromString(t,"image/svg+xml")}catch(e){return(a=n.xmldom?new r.DOMParser(n.xmldom):new r.DOMParser).parseFromString(t,"text/xml")}},o.Property=function(t,e){this.name=t,this.value=e},o.Property.prototype.getValue=function(){return this.value},o.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},o.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},o.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},o.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():t},o.Property.prototype.addOpacity=function(e){var n=this.value;if(null!=e.value&&""!=e.value&&"string"==typeof this.value){var r=new t(this.value);r.ok&&(n="rgba("+r.r+", "+r.g+", "+r.b+", "+e.numValue()+")")}return new o.Property(this.name,n)},o.Property.prototype.getDefinition=function(){var t=this.value.match(/#([^\)'"]+)/);return t&&(t=t[1]),t||(t=this.value),o.Definitions[t]},o.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},o.Property.prototype.getFillStyleDefinition=function(t,e){var n=this.getDefinition();if(null!=n&&n.createGradient)return n.createGradient(o.ctx,t,e);if(null!=n&&n.createPattern){if(n.getHrefAttribute().hasValue()){var r=n.attribute("patternTransform");n=n.getHrefAttribute().getDefinition(),r.hasValue()&&(n.attribute("patternTransform",!0).value=r.value)}return n.createPattern(o.ctx,t)}return null},o.Property.prototype.getDPI=function(t){return 96},o.Property.prototype.getREM=function(t){return o.rootEmSize},o.Property.prototype.getEM=function(t){return o.emSize},o.Property.prototype.getUnits=function(){var t=this.value+"";return t.replace(/[0-9\.\-]/g,"")},o.Property.prototype.isPixels=function(){if(!this.hasValue())return!1;var t=this.value+"";return!!t.match(/px$/)||!!t.match(/^[0-9]+$/)},o.Property.prototype.toPixels=function(t,e){if(!this.hasValue())return 0;var n=this.value+"";if(n.match(/rem$/))return this.numValue()*this.getREM(t);if(n.match(/em$/))return this.numValue()*this.getEM(t);if(n.match(/ex$/))return this.numValue()*this.getEM(t)/2;if(n.match(/px$/))return this.numValue();if(n.match(/pt$/))return this.numValue()*this.getDPI(t)*(1/72);if(n.match(/pc$/))return 15*this.numValue();if(n.match(/cm$/))return this.numValue()*this.getDPI(t)/2.54;if(n.match(/mm$/))return this.numValue()*this.getDPI(t)/25.4;if(n.match(/in$/))return this.numValue()*this.getDPI(t);if(n.match(/%$/))return this.numValue()*o.ViewPort.ComputeSize(t);var r=this.numValue();return e&&r<1?r*o.ViewPort.ComputeSize(t):r},o.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/s$/)?1e3*this.numValue():(t.match(/ms$/),this.numValue())},o.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/deg$/)?this.numValue()*(Math.PI/180):t.match(/grad$/)?this.numValue()*(Math.PI/200):t.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var s={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return o.Property.prototype.toTextBaseline=function(){return this.hasValue()?s[this.value]:null},o.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(t,e,n,r,i,a){var s=null!=a?this.Parse(a):this.CreateFont("","","","","",o.ctx.font);return{fontFamily:i=i||s.fontFamily,fontSize:r||s.fontSize,fontStyle:t||s.fontStyle,fontWeight:n||s.fontWeight,fontVariant:e||s.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var t=this;this.Parse=function(e){for(var n={},r=o.trim(o.compressSpaces(e||"")).split(" "),i={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},a="",s=0;sthis.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))},this.addX=function(t){this.addPoint(t,null)},this.addY=function(t){this.addPoint(null,t)},this.addBoundingBox=function(t){this.addPoint(t.x1,t.y1),this.addPoint(t.x2,t.y2)},this.addQuadraticCurve=function(t,e,n,r,i,a){var o=t+2/3*(n-t),s=e+2/3*(r-e),u=o+1/3*(i-t),l=s+1/3*(a-e);this.addBezierCurve(t,e,o,u,s,l,i,a)},this.addBezierCurve=function(t,e,n,r,i,a,o,s){var u=[t,e],l=[n,r],c=[i,a],f=[o,s];this.addPoint(u[0],u[1]),this.addPoint(f[0],f[1]);for(var d=0;d<=1;d++){var h=function(t){return Math.pow(1-t,3)*u[d]+3*Math.pow(1-t,2)*t*l[d]+3*(1-t)*Math.pow(t,2)*c[d]+Math.pow(t,3)*f[d]},p=6*u[d]-12*l[d]+6*c[d],g=-3*u[d]+9*l[d]-9*c[d]+3*f[d],m=3*l[d]-3*u[d];if(0!=g){var y=Math.pow(p,2)-4*m*g;if(!(y<0)){var v=(-p+Math.sqrt(y))/(2*g);0=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var t=new o.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(t)},this.getAsControlPoint=function(){var t=this.getPoint();return this.control=t},this.getAsCurrentPoint=function(){var t=this.getPoint();return this.current=t},this.getReflectedControlPoint=function(){return"c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase()?this.current:new o.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(t){return this.isRelativeCommand()&&(t.x+=this.current.x,t.y+=this.current.y),t},this.addMarker=function(t,e,n){null!=n&&0this.maxDuration){if("indefinite"==this.attribute("repeatCount").value||"indefinite"==this.attribute("repeatDur").value)this.duration=0;else if("freeze"!=this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"==this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+t;var e=!1;if(this.begin~\.\[:]+)/g,l=/(\.[^\s\+>~\.\[:]+)/g,c=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,f=/(:[\w-]+\([^\)]*\))/gi,d=/(:[^\s\+>~\.\[:]+)/g,h=/([^\s\+>~\.\[:]+)/g;function p(t){var e=[0,0,0],n=function(n,r){var i=t.match(n);null!=i&&(e[r]+=i.length,t=t.replace(n," "))};return t=(t=t.replace(/:not\(([^\)]*)\)/g," $1 ")).replace(/{[\s\S]*/gm," "),n(s,1),n(u,0),n(l,1),n(c,2),n(f,1),n(d,1),t=(t=t.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),n(h,2),e.join("")}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,n,r,i,a){var s={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:n,scaleWidth:r,scaleHeight:i};for(var u in a)a.hasOwnProperty(u)&&(s[u]=a[u]);o(this.canvas,t,s)}),n.exports=o}(n={exports:{}}),n.exports}(n(22),n(23))},function(t,e,n){(function(n){var r,i,a;i=[],void 0===(a="function"==typeof(r=function(){"use strict";function e(t,e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="blob",r.onload=function(){o(r.response,e,n)},r.onerror=function(){console.error("could not download file")},r.send()}function r(t){var e=new XMLHttpRequest;return e.open("HEAD",t,!1),e.send(),200<=e.status&&299>=e.status}function i(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(n){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n&&n.global===n?n:void 0,o=a.saveAs||("object"!=typeof window||window!==a?function(){}:"download"in HTMLAnchorElement.prototype?function(t,n,o){var s=a.URL||a.webkitURL,u=document.createElement("a");n=n||t.name||"download",u.download=n,u.rel="noopener","string"==typeof t?(u.href=t,u.origin===location.origin?i(u):r(u.href)?e(t,n,o):i(u,u.target="_blank")):(u.href=s.createObjectURL(t),setTimeout(function(){s.revokeObjectURL(u.href)},4e4),setTimeout(function(){i(u)},0))}:"msSaveOrOpenBlob"in navigator?function(t,n,a){if(n=n||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}(t,a),n);else if(r(t))e(t,n,a);else{var o=document.createElement("a");o.href=t,o.target="_blank",setTimeout(function(){i(o)})}}:function(t,n,r,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof t)return e(t,n,r);var o="application/octet-stream"===t.type,s=/constructor/i.test(a.HTMLElement)||a.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||o&&s)&&"object"==typeof FileReader){var l=new FileReader;l.onloadend=function(){var t=l.result;t=u?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=t:location=t,i=null},l.readAsDataURL(t)}else{var c=a.URL||a.webkitURL,f=c.createObjectURL(t);i?i.location=f:location.href=f,i=null,setTimeout(function(){c.revokeObjectURL(f)},4e4)}});a.saveAs=o.saveAs=o,t.exports=o})?r.apply(e,i):r)||(t.exports=a)}).call(this,n(24))},function(t,e,n){(t.exports=n(25)(!1)).push([t.i,"body > * {\n visibility: hidden;\n}\nbody {\n overflow: hidden;\n}\nbody * {\n visibility: hidden !important;\n}\n\n.tau-chart__print-block {\n position: absolute;\n top: 0;\n left: 0;\n visibility: visible !important;\n display: block !important;\n width: 100%;\n /*height: 100%;*/\n}\n",""])},,function(t,e,n){t.exports=n(26)},function(t,e){t.exports=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var n=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r3&&(this.alpha=s[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),n=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==n.length&&(n="0"+n),"#"+t+e+n},this.getHelpXML=function(){for(var t=new Array,r=0;r "+l.toRGB()+" -> "+l.toHex());u.appendChild(c),u.appendChild(f),s.appendChild(u)}catch(t){}return s}}},function(t,e){var n=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],r=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function i(t,e,n,r,i){if("string"==typeof t)t=document.getElementById(t);else if("undefined"!=typeof HTMLCanvasElement&&!t instanceof HTMLCanvasElement)return;var a,o=t.getContext("2d");try{try{a=o.getImageData(e,n,r,i)}catch(t){throw new Error("unable to access local image data: "+t)}}catch(t){throw new Error("unable to access image data: "+t)}return a}function a(t,e,n,r,a,s){if(!(isNaN(s)||s<1)){s|=0;var u=i(t,e,n,r,a);u=o(u,e,n,r,a,s),t.getContext("2d").putImageData(u,e,n)}}function o(t,e,i,a,o,s){var u,c,f,d,h,p,g,m,y,v,b,x,_,w,E,S,M,T,C,k,A,O,P,L,N=t.data,R=s+s+1,F=a-1,D=o-1,j=s+1,I=j*(j+1)/2,z=new l,B=z;for(f=1;f>U,0!=P?(P=255/P,N[p]=(m*G>>U)*P,N[p+1]=(y*G>>U)*P,N[p+2]=(v*G>>U)*P):N[p]=N[p+1]=N[p+2]=0,m-=x,y-=_,v-=w,b-=E,x-=H.r,_-=H.g,w-=H.b,E-=H.a,d=g+((d=u+s+1)>U,P>0?(P=255/P,N[d]=(m*G>>U)*P,N[d+1]=(y*G>>U)*P,N[d+2]=(v*G>>U)*P):N[d]=N[d+1]=N[d+2]=0,m-=x,y-=_,v-=w,b-=E,x-=H.r,_-=H.g,w-=H.b,E-=H.a,d=u+((d=c+j)>V,A[p+1]=y*B>>V,A[p+2]=v*B>>V,m-=b,y-=x,v-=_,b-=I.r,x-=I.g,_-=I.b,d=g+((d=u+s+1)>V,A[d+1]=y*B>>V,A[d+2]=v*B>>V,m-=b,y-=x,v-=_,b-=I.r,x-=I.g,_-=I.b,d=u+((d=c+N)=0:e.dim===t.dim});if(null===i.method)return n;var a={l:-.5,r:.5},o=i.method,s=i.scale;return n[o]=function(t){var n=a[t.__pos__]||0;if(s.discrete)return e[o](t)+s.stepSize(t[s.dim])*n;if(s.period){for(var i=r.default.api.tickPeriod.get(s.period,{utc:s.utcTime}),u=s.domain(),l=i.cast(u[0]);l=0?i[t].map(function(t){return new Date(t)}):i[t];a.series=o.unique(s.concat(u))}})})},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},_useSavedDataRefs:function(t,e){var n=this._dataRefs;return this._usedDataRefsKeys.add(e),e in n?(n[e].forEach(function(e,n){return Object.assign(e,t[n])}),n[e]):(n[e]=t,t)},_startWatchingDataRefs:function(){var t=this._dataRefs;this._initialDataRefsKeys=new Set(Object.keys(t)),this._usedDataRefsKeys=new Set},_clearUnusedDataRefs:function(){var t=this._dataRefs,e=this._initialDataRefsKeys,n=this._usedDataRefsKeys;Array.from(e).filter(function(t){return!n.has(t)}).forEach(function(e){return delete t[e]}),this._initialDataRefsKeys=null,this._usedDataRefsKeys=null},_getDataRowsFromItems:function(t){var e=function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})};return t.reduce(function(t,n){return Array.isArray(n.dim)?Array.isArray(n.val)&&n.val.every(Array.isArray)&&n.val.forEach(function(r){t.push(e(n.dim,r))}):Array.isArray(n.val)?n.val.forEach(function(r){t.push(e([n.dim],[r]))}):t.push(e([n.dim],[n.val])),t},[])},_getAnnotatedDimValues:function(t){var e=this._getDataRowsFromItems(t),n={};return e.forEach(function(t){Object.keys(t).forEach(function(e){n[e]=n[e]||[],n[e].push(t[e])})}),n}}}r.default.api.plugins.add("annotations",c);var f=r.default.api.utils;function d(t){var e=t.x0,n=t.y0,r=null==t.collapse||t.collapse,i=function(t){return{y0:function(n){return t.scaleY.value(n[e])}}},a=function(t){return{y0:function(e){return t.scaleY.value(e[n])}}},o=function(t){var r=t.data();if(0===r.length)return{};var i=t.scaleY,a=Number.MAX_VALUE,o=Number.MIN_VALUE,s=t.flip?e:n,u=i.dim;return r.forEach(function(t){var e=t[s],n=t[u],r=ee?n:e;a=ro?i:o}),i.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxa)&&(e.min=a),e}),{}},s={},u={},l=function(t){var i=t.data().slice(),a=t.scaleX,o=t.scaleY;if(0===i.length||!a.discrete)return{};var l=t.flip?e:n,c=o.dim;i.sort(f.createMultiSorter(function(t,e){return t[l]-e[l]},function(t,e){return t[c]-e[c]}));var d=a.dim,h=a.domain().reduce(function(t,e){return t[e]=[],t},{}),p=new Map;return i.forEach(r?function(t){var e=t[d],n=h[e],r=n.findIndex(function(e){return e[e.length-1][c]<=t[l]});r<0&&(r=n.length,n.push([])),n[r].push(t),p.set(t,r)}:function(t){var e=t[d],n=h[e],r=r=n.length;n.push([]),n[r].push(t),p.set(t,r)}),Object.keys(h).forEach(function(t){s[t]=h[t]}),a.fixup(function(t){var e={},n=a.domain().reduce(function(t,e){return t+s[e].length},0);return a.domain().forEach(function(t){u[t]=n}),e.ratio=function(t){return s[t].length/u[t]},e}),{xi:function(e){var n=e[d],r=a.stepSize(n);return t.xi(e)-r/2+r/s[n].length*(p.get(e)+.5)}}};return{onSpecReady:function(t,e){t.traverseSpec(e,function(t,e){"ELEMENT.INTERVAL"===t.type&&(t.transformModel=[t.flip?i:a,l],t.adjustScales=[o],t.guide.enableColorToBarPosition=!1,t.guide.label=t.guide.label||{},t.guide.label.position=t.guide.label.position||(t.flip?["inside-start-then-outside-end-horizontal","hide-by-label-height-horizontal"]:["inside-start-then-outside-end-vertical"]))})}}}r.default.api.plugins.add("bar-as-span",d);var h=n(0),p=r.default.api.utils,g="minimum",m="maximum",y={MIN:g,MAX:m,MEDIAN:"median",Q1:"Q1",Q3:"Q3"};function v(t,e){var n=t.length-1,r=e/100*n,i=Math.floor(r);if(0===i)return{pos:0,value:t[0]};if(i===n)return{pos:n,value:t[n]};var a=r-i;return a?{pos:r,value:t[i]+a*(t[i+1]-t[i])}:{pos:r,value:t[r]}}function b(t,e,n){for(var r=t.sort(function(t,e){return t-e}),i=v(r,25),a=v(r,50),o=v(r,75),s=o.value-i.value,u=i.value-1.5*s,l=o.value+1.5*s,c=r[0],f=r[r.length-1],d=0;d<=i.pos;d++){var h=r[d];if(h>u){c=h;break}}for(var p=r.length-1;p>=o.pos;p--){var g=r[p];if(go||t[r]\n
'+e+'
\n
\n '+C(n.map(function(t){return A(t)}))+"\n
\n\n"},A=function(t){var e=t.key,n=t.label,r=t.checked;return'\n
\n '+O()+'\n '+n+"\n
\n"},O=function(){return['','',""].join("")},P=function(t,e,n,r){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.matches(n)&&r(t,e),e=e.parentNode})},L=function(t,e){var n=function(t){return JSON.stringify(function(t){return null==t||""===t}(t)?null:t)},r=n(e);return function(e){var i=e[t],a=n(i);return r===a}},N=function(){function t(t){this.settings=_.defaults(t||{},{formatters:{},fields:null,skipColorDim:!0}),this._filters={},this.onRender=this._createRenderHandler()}return t.prototype.init=function(t){var e=this;this._chart=t;var n=function(e){var n=t.getSpec().scales;return Object.keys(n).map(function(t){return{name:t,config:n[t]}}).filter(e)},r=n(function(t){var e=t.config;t.name;return"ordinal"===e.type&&e.dim}),i=_.unique(r.map(function(t){return t.config.dim}));if(this.settings.fields&&(i=i.filter(function(t){return e.settings.fields.indexOf(t)>=0})),this.settings.skipColorDim){var a=n(function(t){var e=t.config;t.name;return"color"===e.type&&e.dim}).map(function(t){return t.config.dim});i=i.filter(function(t){return a.indexOf(t)<0})}r=r.filter(function(t){return i.indexOf(t.config.dim)>=0}),this._categoryScales=r,this._render()},t.prototype.destroy=function(){var t=this._filters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])});var n;(n=this._node)&&n.parentElement&&n.parentElement.removeChild(n)},t.prototype._createRenderHandler=function(){return function(){if(this._lastClickedScrollInfo){var t=this._lastClickedScrollInfo.key,e=this._node.querySelector('[data-key="'+t+'"]');if(e){var n=this._lastClickedScrollInfo.top,r=e.getBoundingClientRect().top,i=this._getScrollContainer(),a=i.getBoundingClientRect().top;i.scrollTop=i.scrollTop-n-a+r}this._lastClickedScrollInfo=null}}},t.prototype._getContent=function(t){return function(t){var e=t.categories;return'\n
\n '+C(e.map(function(t){return k(t)}))+"\n
\n"}({categories:t})},t.prototype._getCategoriesInfo=function(){var t=this;return this._categoryScales.map(function(e){var n=e.name;return t._chart.getScaleInfo(n)}).map(function(e){var n=e.dim,r=t._getFieldLabel(n),i=t._getFieldFormat(n),a=t._chart.getDataSources({excludeFilter:["category-filter"]}),o=_.unique(a[e.source].data.map(function(t){return t[n]})).map(function(e){var r=i(e),a=t._getFilterKey(n,e);return{label:r,checked:!t._filters[a],key:a,value:e}});return{dim:n,label:r,values:o}})},t.prototype._render=function(){this._clear(),this._formatters=w.getFieldFormatters(this._chart.getSpec(),this.settings.formatters);var t,e,n=this._getCategoriesInfo(),r=this._getContent(n),i=(t=r,(e=document.createElement("div")).innerHTML=t,e.firstElementChild);this._node=i,this._chart.insertToRightSidebar(i),this._subscribeToEvents(),this._filterKeys=n.reduce(function(t,e){var n=e.dim;return e.values.forEach(function(e){var r=e.key,i=e.value;t[r]={dim:n,value:i}}),t},{})},t.prototype._subscribeToEvents=function(){var t=this,e=this._node;P(e,"click","."+S,function(e,n){var r=n.getAttribute("data-key"),i=e.target.matches("."+T);t._toggleCategory(r,i?"toggle":"focus")}),P(e,"mouseover","."+S,function(e,n){var r=n.getAttribute("data-key");t._toggleHighlight(r,!0)}),P(e,"mouseout","."+S,function(e,n){var r=n.getAttribute("data-key");t._toggleHighlight(r,!1)})},t.prototype._isFilteredOut=function(t){return t in this._filters},t.prototype._toggleCategory=function(t,e){var n=this,r=Array.from(this._node.querySelectorAll("."+S)).reduce(function(t,e){return t[e.getAttribute("data-key")]=e,t},{}),i=Object.keys(this._filterKeys).map(function(t){var e=n._filterKeys[t],i=e.dim,a=e.value;return{node:r[t],key:t,dim:i,value:a,isChecked:!n._isFilteredOut(t)}}),a=i.reduce(function(t,e){return t[e.key]=e,t},{})[t],o=i.filter(function(t){return t.dim===a.dim}),s=function(t,e){e?t.classList.add(M):t.classList.remove(M)};switch(e){case"toggle":a.isChecked?(this._addFilter(t),s(a.node,!1)):(this._removeFilter(t),s(a.node,!0));break;case"focus":a.isChecked&&o.every(function(t){return t===a||!t.isChecked})?o.forEach(function(t){t.isChecked||(s(t.node,!0),n._removeFilter(t.key))}):(o.forEach(function(t){t!==a&&t.isChecked&&(s(t.node,!1),n._addFilter(t.key))}),a.isChecked||(s(a.node,!0),this._removeFilter(a.key)))}this._lastClickedScrollInfo={key:t,top:a.node.getBoundingClientRect().top-this._getScrollContainer().getBoundingClientRect().top},this._chart.refresh()},t.prototype._toggleHighlight=function(t,e){if(!this._isFilteredOut(t)){var n=this._filterKeys[t],r=n.dim,i=n.value,a=e?L(r,i):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){return t.fire("highlight",a)})}},t.prototype._clear=function(){var t=this._node;t&&t.parentElement&&t.parentElement.removeChild(t)},t.prototype._getScrollContainer=function(){return this._node.parentElement.parentElement},t.prototype._getFilterKey=function(t,e){return t+"__"+e},t.prototype._addFilter=function(t){var e=this._filterKeys[t],n=e.dim,r=e.value,i=L(n,r);this._filters[t]=this._chart.addFilter({tag:"category-filter",predicate:function(t){return!i(t)}})},t.prototype._removeFilter=function(t){var e=this._filters[t];delete this._filters[t],this._chart.removeFilter(e)},t.prototype._getFieldLabel=function(t){return this._formatters[t]?this._formatters[t].label:t},t.prototype._getFieldFormat=function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},t}();r.default.api.plugins.add("category-filter",function(t){return new N(t)});var R="http://www.w3.org/2000/svg",F=r.default.api.utils,D=r.default.api.svgUtils,j=r.default.api.pluginsSDK;function I(t){t=t||{};var e=document.createElementNS(R,"g"),n=h.select(e).attr("class","tau-crosshair__label");n.append("rect").attr("class","tau-crosshair__label__box"),n.append("text").attr("class","tau-crosshair__label__text-shadow"),n.append("text").attr("class","tau-crosshair__label__text");var r={options:function(e){return t=Object.assign(t,e),r},show:function(i){return t.container.appendChild(e),function(e){var r=e.x,i=e.y,a=e.text,o=e.color,s=e.colorCls;n.attr("class","tau-crosshair__label "+s);var u=t.halign,l=t.valign,c=t.hpad,f=t.vpad,d={left:"end",middle:"middle",right:"start"}[u],h={left:-c,middle:0,right:c}[u],p=n.select(".tau-crosshair__label__text").attr("fill",o),g=n.selectAll(".tau-crosshair__label__text, .tau-crosshair__label__text-shadow").attr("text-anchor",d).attr("x",r+h).attr("y",0).text(a),m=p.node().getBBox(),y={top:-f-m.height/2,middle:0,bottom:f+m.height/2}[l]-m.height/2-m.y;g.attr("y",i+y);var v=m.width+2*c,b=m.height+2*f,x={left:-v,middle:-v/2,right:0}[u],_={top:-b,middle:-b/2,bottom:0}[l];n.select(".tau-crosshair__label__box").attr("fill",o).attr("rx",t.boxCornerRadius).attr("ry",t.boxCornerRadius).attr("x",r+x).attr("y",i+_).attr("width",v).attr("height",b)}(i),function(){n.attr("transform","");var r=t.chart.getLayout().contentContainer.getBoundingClientRect(),i=t.chart.getSVG().getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(0,Math.max(r.left,i.left)-a.left)||Math.min(0,Math.min(r.right,i.right)-a.right),s=Math.max(0,Math.max(r.top,i.top)-a.top)||Math.min(0,Math.min(r.bottom,i.bottom)-a.bottom);n.attr("transform","translate("+o+","+s+")")}(),r},hide:function(){return e.parentNode&&e.parentNode.removeChild(e),r}};return r}function z(t){var e=F.defaults(t||{},{xAxis:!0,yAxis:!0,formatters:{},labelBoxHPadding:5,labelBoxVPadding:3,labelBoxCornerRadius:3,axisHPadding:22,axisVPadding:22});return{init:function(t){this._chart=t,this._formatters={},this._createNode()},_createNode:function(){var t=h.select(document.createElementNS(R,"g")).attr("class","tau-crosshair");this._labels={x:null,y:null};var n=function(n){var r=t.append("g").attr("class","tau-crosshair__group "+n);r.append("line").attr("class","tau-crosshair__line-shadow"),r.append("line").attr("class","tau-crosshair__line"),this._labels[n]=I({container:r.node(),chart:this._chart,halign:"x"===n?"middle":"left",valign:"x"===n?"bottom":"middle",boxCornerRadius:e.labelBoxCornerRadius,hpad:e.labelBoxHPadding,vpad:e.labelBoxVPadding})}.bind(this);e.xAxis&&n("x"),e.yAxis&&n("y"),this._element=t},_setValues:function(t,n,r){var i=function(t){var n=this._element.select(".tau-crosshair__group."+t.dir);n.select(".tau-crosshair__line").attr("class","tau-crosshair__line "+r.cls).attr("stroke",r.color),n.selectAll(".tau-crosshair__line, .tau-crosshair__line-shadow").attr("x1",t.startPt.x).attr("x2",t.valuePt.x).attr("y1",t.startPt.y).attr("y2",t.valuePt.y),("x"===t.dir&&e.xAxis||"y"===t.dir&&e.yAxis)&&this._labels[t.dir].options({halign:t.labelHAlign,valign:t.labelVAlign}).show({x:t.startPt.x,y:t.startPt.y,text:t.label,color:r.color,colorCls:r.cls})}.bind(this);i({dir:"x",startPt:{x:t.value,y:n.start+(t.minMode?0:e.axisVPadding)},valuePt:{x:t.value,y:n.value+n.crossPadding},label:t.label,labelHAlign:"middle",labelVAlign:"bottom"}),i({dir:"y",startPt:{x:t.start-(n.minMode?0:e.axisHPadding),y:n.value},valuePt:{x:t.value-t.crossPadding,y:n.value},label:n.label,labelHAlign:"left",labelVAlign:"middle"})},_showCrosshair:function(t,e,n){var r=this._chart.getSVG(),i=e.config.options.container.node(),a=D.getDeepTransformTranslate(i);this._element.attr("transform",D.translate(a.x,a.y)),r.appendChild(this._element.node());var o=e.getScale("x"),s=e.getScale("y"),u=e.getScale("color"),l=u(t.data[u.dim]),c=t.data[o.dim],f=t.data[s.dim],d=e.screenModel.x(t.data),h=e.screenModel.y(t.data);if(e.config.stack)if(e.config.flip){var p=e.data().filter(function(n){var r=n[s.dim];return n===t.data||(r===f||r-f==0)&&(e.screenModel.x(t.data)-e.screenModel.x(n))*n[o.dim]>0});d=(c<0?Math.min:Math.max).apply(null,p.map(function(t){return e.screenModel.x(t)},0)),c=p.reduce(function(t,e){return t+e[o.dim]},0)}else{var g=e.data().filter(function(n){var r=n[o.dim];return n===t.data||(r===c||r-c==0)&&(e.screenModel.y(n)-e.screenModel.y(t.data))*n[s.dim]>0});h=(f<0?Math.max:Math.min).apply(null,g.map(function(t){return e.screenModel.y(t)},0)),f=g.reduce(function(t,e){return t+e[s.dim]},0)}var m=t.node.getBBox(),y=["ELEMENT.AREA","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED"].indexOf(e.config.type)>=0?{x:m.width*(e.config.flip?c>0?1:0:.5),y:m.height*(e.config.flip?.5:f>0?1:0)}:{x:m.width/2,y:m.height/2};this._setValues({label:this._getFormat(o.dim)(c),start:0,value:d,crossPadding:y.x,minMode:n&&n.guide.x.hide},{label:this._getFormat(s.dim)(f),start:e.config.options.height,value:h,crossPadding:y.y,minMode:n&&n.guide.y.hide},{cls:u.toColor(l)?"":l,color:u.toColor(l)?l:""})},_hideCrosshair:function(){var t=this._element.node();t.parentNode&&t.parentNode.removeChild(t)},destroy:function(){this._hideCrosshair()},_subscribeToHover:function(){var t=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(function(e){return t.indexOf(e.config.type)>=0}).forEach(function(t){t.on("data-hover",function(t,e){if(e.data){if(t===e.unit){var n=j.getParentUnit(this._chart.getSpec(),t.config);this._showCrosshair(e,t,n)}}else this._hideCrosshair()}.bind(this))},this)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},onRender:function(){this._formatters=j.getFieldFormatters(this._chart.getSpec(),e.formatters),this._subscribeToHover()}}}r.default.api.plugins.add("crosshair",z);var B="tau-chart__tooltip";function V(t,e){return{render:function(t){return this.args=t,t=Object.assign({},t,{fields:this.filterFields(t.fields)}),this.rootTemplate(t)},rootTemplate:function(t){return['
',this.buttonsTemplate(),"
",'
',this.contentTemplate(t),"
"].join("\n")},contentTemplate:function(t){return this.fieldsTemplate(t)},filterFields:function(t){return t},getLabel:function(e){return t.getFieldLabel(e)},getFormatter:function(e){return t.getFieldFormat(e)},fieldsTemplate:function(t){var e=this,n=t.data;return t.fields.map(function(t){return e.itemTemplate({data:n,field:t})}).join("\n")},itemTemplate:function(t){var e=t.data,n=t.field,r=this.getLabel(n),i=this.getFormatter(n)(e[n]);return['
','
'+r+"
",'
'+i+"
","
"].join("\n")},buttonsTemplate:function(){return[this.buttonTemplate({cls:"i-role-exclude",text:"Exclude",icon:function(){return''}})].join("\n")},buttonTemplate:function(t){var e=t.icon,n=t.text,r=t.cls;return['
','
'," "+(e?e()+" ":"")+n,"
","
"].join("\n")},didMount:function(){var e=t.getDomNode().querySelector(".i-role-exclude");e&&e.addEventListener("click",function(){t.excludeHighlightedElement(),t.setState({highlight:null,isStuck:!1})})}}}var H=r.default.api.utils,W=r.default.api.domUtils,G=r.default.api.pluginsSDK,U="tau-chart__tooltip",X=function(){function t(t){this.settings=H.defaults(t||{},{align:"bottom-right",clickable:!0,clsClickable:U+"__clickable",clsStuck:"stuck",clsTarget:U+"-target",escapeHtml:!0,fields:null,formatters:{},getTemplate:null,spacing:24,winBound:12,onExclude:function(){}}),this.onRender=this._getRenderHandler()}return t.prototype.init=function(t){this._chart=t,this._tooltip=this._chart.addBalloon({spacing:this.settings.spacing,winBound:this.settings.winBound,auto:!0,effectClass:"fade"}),this._initDomEvents(),this.state={highlight:null,isStuck:!1},this.setState(this.state),this._template=this._getTemplate()},t.prototype._getTemplate=function(){var t=V(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t},t.prototype._renderTemplate=function(t,e){return this._template.render({data:t,fields:e})},t.prototype._initDomEvents=function(){var t=this;this._scrollHandler=function(){t.setState({highlight:null,isStuck:!1})},window.addEventListener("scroll",this._scrollHandler,!0),this.settings.clickable&&(this._outerClickHandler=function(e){var n=Array.from(document.querySelectorAll("."+t.settings.clsClickable)).concat(t.getDomNode()).map(function(t){return t.getBoundingClientRect()}),r=Math.min.apply(Math,n.map(function(t){return t.top})),i=Math.min.apply(Math,n.map(function(t){return t.left})),a=Math.max.apply(Math,n.map(function(t){return t.right})),o=Math.max.apply(Math,n.map(function(t){return t.bottom}));(e.clientXa||e.clientYo)&&t.setState({highlight:null,isStuck:!1})})},t.prototype.getDomNode=function(){return this._tooltip.getElement()},t.prototype.setState=function(t){var e=this,n=this.settings,r=this.state,i=this.state=Object.assign({},r,t);r.highlight=r.highlight||{data:null,cursor:null,unit:null},i.highlight=i.highlight||{data:null,cursor:null,unit:null},i.isStuck&&r.highlight.data&&(i.highlight=r.highlight),i.highlight.data!==r.highlight.data&&(i.highlight.data?(this._hideTooltip(),this._showTooltip(i.highlight.data,i.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(function(){e._setTargetSvgClass(!0)})):i.isStuck||!r.highlight.data||i.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!i.highlight.data||r.highlight.cursor&&i.highlight.cursor.x===r.highlight.cursor.x&&i.highlight.cursor.y===r.highlight.cursor.y||(this._tooltip.position(i.highlight.cursor.x,i.highlight.cursor.y),this._tooltip.updateSize());var a=this.getDomNode();this.settings.clickable&&i.isStuck!==r.isStuck&&(i.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),a.classList.add(n.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(i.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),a.classList.remove(n.clsStuck),requestAnimationFrame(function(){e._setTargetEventsEnabled(!0);var t=e._chart.getSVG();t&&W.dispatchMouseEvent(t,"mouseleave")})))},t.prototype._showTooltip=function(t,e){var n=this.settings,r=n.fields||"function"==typeof n.getFields&&n.getFields(this._chart)||Object.keys(t),i=this._renderTemplate(t,r);this._tooltip.content(i).position(e.x,e.y).place(n.align).show().updateSize(),this._template.didMount&&this._template.didMount()},t.prototype._hideTooltip=function(){window.removeEventListener("click",this._outerClickHandler,!0),this._template.willUnmount&&this._template.willUnmount(),this._tooltip.hide()},t.prototype.destroy=function(){window.removeEventListener("scroll",this._scrollHandler,!0),this._setTargetSvgClass(!1),this.setState({highlight:null,isStuck:!1}),this._tooltip.destroy()},t.prototype._subscribeToHover=function(){var t=this,e=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(function(t){return e.indexOf(t.config.type)>=0}).forEach(function(e){e.on("data-hover",function(e,n){var r=document.body.getBoundingClientRect();t.setState({highlight:n.data?{data:n.data,cursor:{x:n.event.clientX-r.left,y:n.event.clientY-r.top},unit:n.unit}:null})}),t.settings.clickable&&e.on("data-click",function(e,n){var r=document.body.getBoundingClientRect();t.setState(n.data?{highlight:{data:n.data,cursor:{x:n.event.clientX-r.left,y:n.event.clientY-r.top},unit:n.unit},isStuck:!0}:{highlight:null,isStuck:null})})})},t.prototype.getFieldFormat=function(t){var e=this._formatters[t]?this._formatters[t].format:function(t){return String(t)};return this.settings.escapeHtml?function(t){return H.escapeHtml(e(t))}:e},t.prototype.getFieldLabel=function(t){var e=this._formatters[t]?this._formatters[t].label:t;return this.settings.escapeHtml?H.escapeHtml(e):e},t.prototype._accentFocus=function(t){var e=function(e){return e===t};this._chart.select(function(){return!0}).forEach(function(t){t.fire("highlight",e)})},t.prototype._removeFocus=function(){var t=function(){return null};this._chart.select(function(){return!0}).forEach(function(e){e.fire("highlight",t),e.fire("highlight-data-points",t)})},t.prototype.excludeHighlightedElement=function(){var t=this.state.highlight.data;this._chart.addFilter({tag:"exclude",predicate:function(e){return e!==t}}),this.settings.onExclude(t),this._chart.refresh()},t.prototype._getRenderHandler=function(){return function(){this._formatters=G.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}},t.prototype._setTargetSvgClass=function(t){h.select(this._chart.getSVG()).classed(this.settings.clsTarget,t)},t.prototype._setTargetEventsEnabled=function(t){t?this._chart.enablePointerEvents():this._chart.disablePointerEvents()},t}(),q="diff-tooltip",Y=q+"__item",$=q+"__header";var K,J=r.default.api.utils,Q={draw:function(){var t=this.node().config;this._container=t.options.slot(t.uid)},addInteraction:function(){var t=this;this.node().on("interval-highlight",function(e,n){t._drawRange(n)})},_drawRange:function(t){var e=this.node(),n=e.config,r=e.screenModel.flip,i=this._container,a="interval-highlight",o=a+"__gradient",s=t?t[0]:null,u=t?t[1]:null,l=r?n.options.width:n.options.height;J.take(function(){var e=i.selectAll("."+a).data(t?[1]:[]);e.exit().remove();var n=e.enter().append("g").attr("class",a).attr("pointer-events","none");return{g:e,gEnter:n}}()).then(function(e){var c,f,d,p,g,m,y,v,b,x,_;!function(){for(var e=a+"__defs",s=a+"__gradient-start",u=a+"__gradient-end",l=i.node();"svg"!==(l=l.parentNode).tagName;);var c=e+"__"+n.uid,f=h.select(l).selectAll("#"+c).data(t?[1]:[]);f.exit().remove();var d=f.enter().append("defs").attr("class",e).attr("id",c).append("linearGradient").attr("id",o).attr("x1","0%").attr("y1",r?"100%":"0%").attr("x2",r?"0%":"100%").attr("y2","0%");d.append("stop").attr("class",s).attr("offset","0%"),d.append("stop").attr("class",u).attr("offset","100%")}(),f=(c=e).g,d=c.gEnter,p=a+"__range",g=f.select("."+p),m=d.append("rect").attr("class",p).attr("fill","url(#"+o+")"),v=(y=r?{x:0,y:u,width:l,height:s-u}:{x:s,y:0,width:u-s,height:l}).x,b=y.y,x=y.width,_=y.height,m.merge(g).attr("x",v).attr("y",b).attr("width",Math.abs(x)).attr("height",Math.abs(_)),function(t){var e=t.g,n=t.gEnter,i=a+"__range-start",o=e.select("."+i),u=n.append("line").attr("class",i),c=r?{x1:0,y1:s,x2:l,y2:s}:{x1:s,y1:0,x2:s,y2:l},f=c.x1,d=c.y1,h=c.x2,p=c.y2;u.merge(o).attr("x1",f).attr("y1",d).attr("x2",h).attr("y2",p)}(e),function(t){var e=t.g,n=t.gEnter,i=a+"__range-end",o=e.select("."+i),s=n.append("line").attr("class",i),c=r?{x1:0,y1:u,x2:l,y2:u}:{x1:u,y1:0,x2:u,y2:l},f=c.x1,d=c.y1,h=c.x2,p=c.y2;s.merge(o).attr("x1",f).attr("y1",d).attr("x2",h).attr("y2",p)}(e)})}},Z=(K=function(t,e){return(K=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}K(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),tt=r.default.api.utils,et=function(t){function e(e){var n=t.call(this,e)||this;return n.onSpecReady=n._getSpecReadyHandler(),n}return Z(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this._unitsGroupedData=new Map},e.prototype._getTemplate=function(){var t,e,n=(t=this,this.settings,e=V(t),Object.assign({},e,{hasColor:function(){return null!=this.args.colorField},contentTemplate:function(t){return[this.fieldsTemplate(t),this.tableTemplate(t)].join("\n")},filterFields:function(n){var r=t.state.highlight.unit.screenModel.model,i=r.scaleColor,a=r.scaleX,o=r.scaleY,s=n.filter(function(t){return t!==i.dim&&t!==a.dim&&t!==o.dim}),u=function(){return s.push(a.dim)};return this.shouldShowColorTable()?u():(u(),i.dim&&s.push(i.dim),s.push(o.dim)),e.filterFields.call(this,s)},itemTemplate:function(t){var e=t.data,n=t.field,r=this.getLabel(n),i=this.getFormatter(n)(e[n]),a=this.args.prev,o=(this.args.valueField,this.shouldShowDiff(n)),s=['',""+i,o?" "+this.fieldUpdownTemplate(this.getDiff({data:e,prev:a,field:n})):"",""].join("");return['
','
'+r+"
"," "+s,"
"].join("\n")},shouldShowDiff:function(t){return t===this.args.valueField},getDiff:function(t){var e=t.data,n=t.prev,r=t.field,i=this.getFormatter(r),a=(e?e[r]:0)-(n?n[r]:0);return{diff:i(a),sign:Math.sign(a)}},fieldUpdownTemplate:function(t){var e=t.diff,n=t.sign,r=q+"__field__updown";return['0?"positive":"negative")+'">',(n>0?"▲":n<0?"▼":"")+(0===n?"":e),""].join("")},shouldShowColorTable:function(){var t=this.args.groups;return this.hasColor()&&t.length>1},tableTemplate:function(t){return this.shouldShowColorTable()?['
',this.tableHeaderTemplate(t),this.tableBodyTemplate(t),"
"].join("\n"):""},tableHeaderTemplate:function(t){var e=t.colorField,n=t.valueField,r=this.getLabel(e),i=this.getLabel(n);return['
',' '+r+"",' '+i+"",' ▼▲',"
"].join("\n")},tableBodyTemplate:function(t){var e=this,n=t.data,r=t.groups,i=t.valueField,a=t.colorField,o=n,s=r.map(function(t){var e=t.data;return e?e[i]:0}),u=Math.min.apply(Math,s),l=Math.max.apply(Math,s);return['
','
',r.map(function(t){var n=t.data,r=t.prev;return e.tableRowTemplate({data:n,prev:r,highlighted:o,valueField:i,colorField:a,min:u,max:l})}).join("\n"),"
","
"].join("\n")},tableRowTemplate:function(t){var e=t.data,n=t.prev,r=t.highlighted,i=t.valueField,a=t.colorField,o=t.min,s=t.max,u=e?e[i]:0,l=this.getFormatter(a)((e||n)[a]),c=this.getFormatter(i)(u),f=e===r,d=this.getDiff({data:e,prev:n,field:i}),h=d.diff,p=d.sign,g=this.getColor(e||n),m=g.color,y=g.colorCls;return['
'," "+this.valueBarTemplate({min:o,max:s,v:u,color:m,colorCls:y}),' '+l+"",' '+c+""," "+this.updownTemplate({diff:h,sign:p}),"
"].join("\n")},valueBarTemplate:function(t){var e=t.min,n=t.max,r=t.v,i=t.color,a=t.colorCls;e=Math.min(e,0);var o=(n=Math.max(0,n))-e;return[""].join("\n")},getColor:function(e){var n=t.state.highlight.unit.screenModel;return{color:n.color(e),colorCls:n.class(e)}},updownTemplate:function(t){var e=t.diff,n=t.sign,r=Y+"__updown";return['0?"positive":"negative")+'">',(n>0?"▲":n<0?"▼":"")+(0===n?"":e),""].join("")},didMount:function(){e.didMount.call(this),this._scrollToHighlighted(),this._reserveSpaceForUpdown()},_scrollToHighlighted:function(){var e=t.getDomNode(),n=e.querySelector("."+q+"__body"),r=e.querySelector("."+q+"__body__content"),i=e.querySelector("."+Y+"_highlighted");if(n&&r&&i){var a=n.getBoundingClientRect(),o=r.getBoundingClientRect(),s=i.getBoundingClientRect(),u=0;if(s.bottom>a.bottom){var l=s.bottom-a.bottom+s.height,c=o.bottom-a.bottom;u=-Math.min(l,c),r.style.transform="translateY("+u+"px)"}o.top+ua.bottom&&n.classList.add(q+"__body_overflow-bottom")}},_reserveSpaceForUpdown:function(){var e=t.getDomNode(),n=e.querySelector("."+q+"__body"),r=e.querySelector("."+$);if(n&&r){var i="."+Y+"__updown:not(:empty)",a=Array.from(e.querySelectorAll(i)).map(function(t){return t.scrollWidth}),o=Math.max.apply(Math,a),s=Math.max(0,Math.ceil(o-15));n.style.paddingRight=s+"px",r.style.paddingRight=s+"px"}}}));return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(n,this,this.settings):n},e.prototype._renderTemplate=function(t,e){var n,r=this.state.highlight.unit,i=r.screenModel,a=i.model,o=a.scaleColor,s=(a.scaleX,a.scaleY),u=this._unitsGroupedData.get(r),l=this._getHighlightRange(t,r),c=l[0],f=l[1],d=function(t){var e=i.model.color(t);return isFinite(c)&&u[c][e]?u[c][e][0]:null},h=d(t),p=r.config.stack,g=!(!r.config.flip&&r.config.guide.obsoleteVerticalStackOrder&&r.config.stack),m=(n=o.domain().slice().reduce(function(t,e,n){return t[e]=n,t},{}),g?function(t,e){return n[t[o.dim]]-n[e[o.dim]]}:function(t,e){return n[e[o.dim]]-n[t[o.dim]]}),y=g?function(t,e){return s(t[s.dim])-s(e[s.dim])}:function(t,e){return s(e[s.dim])-s(t[s.dim])},v=function(t){return Object.keys(u[t]).reduce(function(e,n){return e.concat(u[t][n])},[]).sort(p?m:y)},b=v(f).map(function(t){i.model.color(t);return{data:t,prev:d(t)}});if(isFinite(c)){var x=v(c),_=b.reduce(function(t,e){return t[i.model.color(e.data)]=!0,t},{});x.forEach(function(t){var e=i.model.color(t);_[e]||b.push({data:null,prev:t})}),p&&b.sort(function(t,e){return m(t.data||t.prev,e.data||e.prev)})}return this._template.render({data:t,prev:h,fields:e,groups:b,valueField:s.dim,colorField:o.dim})},e.prototype._getRenderHandler=function(){var e=t.prototype._getRenderHandler.call(this);return function(){var t=this;e.call(this);var n=this._chart,r=n.select(function(t){return"chart"===t.config.namespace&&0===t.config.type.indexOf("ELEMENT.")&&"ELEMENT.INTERVAL_HIGHLIGHT"!==t.config.type}),i=n.select(function(t){return"ELEMENT.INTERVAL_HIGHLIGHT"===t.config.type}).reduce(function(t,e,n){return t[n]=e,t},{});r.forEach(function(e,n){var r=e.data();t._unitsGroupedData.set(e,t._getGroupedData(r,e)),e.on("data-hover",function(r,a){var o=i[n],s=a.unit&&a.unit===e?t._getHighlightRange(a.data,a.unit):null;o.fire("interval-highlight",s)})})}},e.prototype._getSpecReadyHandler=function(){return function(t,e){t.traverseSpec(e,function(t,e){if(0===t.type.indexOf("ELEMENT.")){var n=JSON.parse(JSON.stringify(t));n.type="ELEMENT.INTERVAL_HIGHLIGHT",n.namespace="highlight";var r=e.units.indexOf(t);e.units.splice(r,0,n)}})}},e.prototype._getGroupedData=function(t,e){var n=e.screenModel.model.scaleX,i=tt.groupBy(t,function(t){return n(t[n.dim]).toString()}),a=e.config.guide.x.tickPeriod||e.config.guide.x.timeInterval;if(a){var o=n.domain(),s=e.config.guide.utcTime;r.default.api.tickPeriod.generate(o[0],o[1],a,{utc:s}).filter(function(t){return t>=o[0]&&t<=o[1]}).forEach(function(t){var e=n(t);i[e]||(i[e]=[])})}return Object.keys(i).reduce(function(t,n){return t[n]=tt.groupBy(i[n],function(t){return e.screenModel.model.color(t)}),t},{})},e.prototype._getHighlightRange=function(t,e){var n=e.screenModel.flip,r=e.screenModel.model.scaleX,i=r(t[r.dim]),a=this._unitsGroupedData.get(e),o=Object.keys(a).map(Number).sort(n?function(t,e){return e-t}:function(t,e){return t-e}),s=o.indexOf(i);return 0===s?[i,i]:[o[s-1],i]},e}(X);function nt(t){return new et(t)}r.default.api.unitsRegistry.reg("ELEMENT.INTERVAL_HIGHLIGHT",Q,"ELEMENT.GENERIC.CARTESIAN"),r.default.api.plugins.add("diff-tooltip",nt);var rt=n(17),it=n.n(rt),at=n(18),ot=n(19),st=n.n(ot),ut="Taucharts Export Plug-in:",lt=r.default.api.utils,ct=r.default.api.pluginsSDK,ft=ct.tokens(),dt=function(t,e){return t.replace(new RegExp("^"+e+"+|"+e+"+$","g"),"")},ht=function(t){return(t=Math.round(t))%2?t+1:t},pt=function(t){return null===t||""===t||void 0===t};var gt,mt={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},yt=function(t,e){e=e||"all";var n=document.createElement("style");return n.setAttribute("media",e),n.innerHTML=t,n},vt=yt(st.a,"print"),bt=function(){vt&&vt.parentNode&&vt.parentNode.removeChild(vt),gt&>.parentNode&>.parentNode.removeChild(gt)};/PhantomJS/.test(navigator.userAgent)||("onafterprint"in window?window.addEventListener("afterprint",bt):window.matchMedia("screen").addListener(function(t){t.matches&&bt()}));var xt=function(t,e,n){var r="data:"+e+";charset=UTF-8,%ef%bb%bf"+encodeURIComponent(n),i=document.createElement("a");i.setAttribute("href",r),i.setAttribute("download",t),i.setAttribute("target","_new"),document.body.appendChild(i),i.click(),document.body.removeChild(i),i=null},_t=function(t){return[].slice.call(t.querySelectorAll("text.label")).forEach(function(t){t.innerHTML=[].slice.call(t.querySelectorAll("tspan")).reduce(function(t,e){var n=e.value||e.text||e.textContent||"";return t+(n=n.charAt(0).toUpperCase()+n.substr(1))},"")}),t},wt=function(t,e,n){n=null==n?"":String(n);var r=(t||{})[e]||{};return(lt.isObject(r.label)?r.label.text:r.label)||n};function Et(t){return{onRender:function(){this._info=ct.extractFieldsFormatInfo(this._chart.getSpec())},_normalizeExportFields:function(t,e){var n=this._info;return t.map(function(t){var e=t,r=n[t]||{};return"string"==typeof t&&(e={field:t,title:r.label||t}),"function"!=typeof e.value&&(e.value=function(t){var e=t[this.field];return r.isComplexField?(e||{})[r.tickLabel]:e}),e}).filter(function(t){return!e.find(function(e){return t.field===e})})},_handleError:function(t){r.default.api.globalSettings.log([ut,t],"error")},_createDataUrl:function(t,e){var n=this;(function(){for(var t=[],e=0;e=200&&n.status<300){var t=n.responseText;i[e]=t,a.splice(a.indexOf(n),1),0===a.length&&r(null,i)}else a.forEach(function(t){return t.abort()}),r(new Error(n.status+": "+n.statusText),null)},n.onerror=function(t){a.forEach(function(t){return t.abort()}),r(t.error,null)},n.open("GET",t,!0),n.send(null)})}).apply(void 0,this._cssPaths.concat([function(i,a){if(i)e(i,null);else try{var o=a.join(" ").replace(/&/g,""),s=yt(o),u=document.createElement("div");t.fire("beforeExportSVGNode");var l=t.getSVG().cloneNode(!0);t.fire("afterExportSVGNode"),u.appendChild(_t(l)),h.select(l).attr("version",1.1).attr("xmlns","http://www.w3.org/2000/svg"),l.insertBefore(s,l.firstChild),n._renderAdditionalInfo(l,t),n._addBackground(l,n._backgroundColor);var c=document.createElement("canvas");c.height=l.getAttribute("height"),c.width=l.getAttribute("width"),it()(c,l.parentNode.innerHTML,{renderCallback:function(t){var n=(new XMLSerializer).serializeToString(t);"=0}))?'"'+a+'"':a}return t.concat(i)},[]).join(e))},[o.map(function(t){return t.title}).join(e)]).join("\r\n"),u=(this._fileName||"export")+".csv";xt(u,"text/csv",s)},_renderFillLegend:function(e,n,r,i){var a=function(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=lt.range(e-2).map(function(t){return n+i*(t+1)});return[n].concat(a).concat(r)},o=this._unit.getScale("color"),s=wt(e.guide,"color",o.dim).toUpperCase(),u="text-transform:uppercase;font-weight:600;font-size:"+t.fontSize+"px",l=o.domain().sort(function(t,e){return t-e}),c=o.brewer.length,f=t.fontSize,d=a(l,c).reverse().map(function(t,e){return''}),h=a(l,3).reverse().map(function(t,e,n){return''+t+""}),p=[''," ",' ',d.join("")," "," ",' '+s+"",' ',' '," ",h.join("")," "," Sorry, your browser does not support inline SVG.",""].join(""),g=(new DOMParser).parseFromString(p,"application/xml").documentElement;return document.body.appendChild(g),n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+t.paddingTop+")").node().appendChild(g),{h:120,w:0}},_renderColorLegend:function(e,n,r,i){var a=this._unit.getScale("color"),o=wt(e.guide,"color",a.dim).toUpperCase(),s=this._getColorMap(r.getChartModelData({excludeFilter:["legend"]}),a,a.dim).values,u=n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+t.paddingTop+")");return u.append("text").text(o.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":t.fontSize+"px"}),u.selectAll("g").data(s).enter().append("g").call(function(e){e.attr("transform",function(t,e){return"translate(5,"+20*(e+1)+")"}),e.append("circle").attr("r",6).attr("fill",function(t){return a.toColor(t.color)}).attr("class",function(t){return a.toClass(t.color)}),e.append("text").attr("x",12).attr("y",5).text(function(t){return lt.escape(pt(t.label)?"No "+o:t.label)}).style({"font-size":t.fontSize+"px"})}),{h:20*s.length,w:0}},_renderSizeLegend:function(e,n,r,i,a){var o,s,u=this._unit.getScale("size"),l=wt(e.guide,"size",u.dim).toUpperCase(),c=r.getChartModelData().sort(function(t,e){return u(t[u.dim])-u(e[u.dim])}),f=c.length,d=c[0][u.dim],h=c[f-1][u.dim];if(h-d){var p=(s=h-d,Math.log(s)/Math.LN10),g=4-p<0?0:Math.round(4-p),m=Math.pow(10,g),y=(h-d)/5;o=lt.unique([d,d+y,d+2*y,d+3*y,h].map(function(t){return t===h||t===d?t:Math.round(t*m)/m}))}else o=[d];var v=o.map(function(t){var n=u(t),r=n/2;return{diameter:ht(n+2),radius:r,value:t,className:e.color?"color-definite":""}}.bind(this)).reverse(),b=Math.max.apply(null,v.map(function(t){return t.diameter})),x=t.fontSize,_=0,w=n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+(t.paddingTop+a.h+20)+")");w.append("text").text(l.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":x+"px"}),w.selectAll("g").data(v).enter().append("g").call(function(t){t.attr("transform",function(){var t="translate(5,"+(_+=b)+")";return _+=10,t}),t.append("circle").attr("r",function(t){return t.radius}).attr("class",function(t){return t.className}).style({opacity:.4}),t.append("g").attr("transform",function(){return"translate("+b+","+x/2+")"}).append("text").attr("x",0).attr("y",0).text(function(t){return t.value}).style({"font-size":x+"px"})})},_renderAdditionalInfo:function(t,e){var n=this._findUnit(e);if(n){var r={h:0,w:0};t=h.select(t);var i=parseInt(t.attr("width"),10);t.attr("height");t.attr("width",i+160);var a=e.getScaleInfo(n.color);if(a.dim&&!a.discrete){var o=this._renderFillLegend(n,t,e,i);r.h=o.h+20,r.w=o.w}if(a.dim&&a.discrete){var s=this._renderColorLegend(n,t,e,i);r.h=s.h+20,r.w=s.w}var u=e.getScaleInfo(n.size);u.dim&&!u.discrete&&this._renderSizeLegend(n,t,e,i,r)}},_addBackground:function(t,e){if(e&&"transparent"!==e){var n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("fill",e),n.setAttribute("x",0),n.setAttribute("y",0),n.setAttribute("width",t.getAttribute("width")),n.setAttribute("height",t.getAttribute("height")),t.insertBefore(n,t.firstChild)}},onUnitDraw:function(t,e){r.default.api.isChartElement(e)&&"chart"===e.config.namespace&&(this._unit=e)},_getColorMap:function(t,e,n){return lt.unique(t.map(function(t){var r=t[n];return{color:e(r),value:r,label:r}}),function(t){return t.value}).reduce(function(t,e){return t.brewer[e.value]=e.color,t.values.push(e),t},{brewer:{},values:[]})},_select:function(t,e){var n=this["_to"+(t=t||"").charAt(0).toUpperCase()+t.slice(1)];n&&n.call(this,e)},_handleMenu:function(t,e,n){t.addEventListener("click",function(t){if("a"===t.target.tagName.toLowerCase()){var r=t.target.getAttribute("data-value");this._select(r,e),n.hide()}}.bind(this)),t.addEventListener("mouseover",function(t){"a"===t.target.tagName.toLowerCase()&&t.target.focus()}.bind(this)),t.addEventListener("keydown",function(t){if(t.keyCode===mt.ESCAPE&&n.hide(),t.keyCode===mt.DOWN&&(t.target.parentNode.nextSibling?t.target.parentNode.nextSibling.childNodes[0].focus():t.target.parentNode.parentNode.firstChild.childNodes[0].focus()),t.keyCode===mt.UP&&(t.target.parentNode.previousSibling?t.target.parentNode.previousSibling.childNodes[0].focus():t.target.parentNode.parentNode.lastChild.childNodes[0].focus()),t.keyCode===mt.ENTER){var r=t.target.getAttribute("data-value");this._select(r,e)}t.preventDefault()}.bind(this));var r=null,i=function(){r=setTimeout(function(){n.hide()},100)},a=function(){clearTimeout(r)},o=function(){n.toggle(),n.hidden||t.querySelectorAll("a")[0].focus()};t.addEventListener("blur",i,!0),t.addEventListener("focus",a,!0),this._container.addEventListener("click",o),this._onDestroy(function(){t.removeEventListener("blur",i,!0),t.removeEventListener("focus",a,!0),this._container.removeEventListener("click",o),clearTimeout(r)})},init:function(e){t=t||{},t=lt.defaults(t,{backgroundColor:"white",visible:!0,fontSize:13,paddingTop:30}),this._chart=e,this._info={},this._cssPaths=t.cssPaths,this._fileName=t.fileName,this._backgroundColor=t.backgroundColor||"white",this._destroyListeners=[],this._csvSeparator=t.csvSeparator||",",this._exportFields=t.exportFields||[],this._appendFields=t.appendFields||[],this._excludeFields=t.excludeFields||[],this._cssPaths||(this._cssPaths=[],r.default.api.globalSettings.log('[export plugin]: the "cssPath" parameter should be specified for correct operation',"warn"));var n=t.visible?"":"display:none";this._container=e.insertToHeader('Export');var i=e.addBalloon({place:"bottom-left"});i.content(['"].join("")),i.attach(this._container);var a=i.getElement();a.setAttribute("tabindex","-1"),this._handleMenu(a,e,i);var o=e.on("export-to",function(t,e){var n=e.type,r=e.fileName;this._fileName=r||this._fileName,this._select(n,t)}.bind(this)),s=e.on("exportTo",function(t,e){r.default.api.globalSettings.log([ut,"`exportTo` event is deprecated, use `export-to` instead."],"warn"),this._select(e,t)}.bind(this));this._onDestroy(function(){i.destroy(),e.removeHandler(o),e.removeHandler(s)})},_onDestroy:function(t){this._destroyListeners.push(t)},destroy:function(){this._destroyListeners.forEach(function(t){t.call(this)},this);var t;(t=this._container)&&t.parentElement&&t.parentElement.removeChild(t)}}}r.default.api.plugins.add("export-to",Et);var St=function(){return(St=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&m.svgHeight>m.visibleHeight),s(o,t+m.visibleWidthm.visibleWidth),s(u,e+m.visibleHeightm.visibleHeight),s(c,t>0&&m.svgWidth>m.visibleWidth)})}(),T=_.node(),C=w.node(),k=E.node();l.onScroll(function(t){o.insertBefore(T,0===t?k.nextElementSibling:C)}),l.fireScroll(),this.floatingLayout={defs:y,xAxes:_,yAxes:w,shadows:M},s.selectAll(".floating-axes").on("mouseenter",function(){Tt.dispatchMouseEvent(o,"mouseleave")}).on("mousemove",function(){h.event.stopPropagation()}).on("click",function(){h.event.stopPropagation()})},removeFloatingLayout:function(){function t(t){t.selectAll(".axis").each(function(){this[Rt].appendChild(this),delete this[Rt],Array.prototype.forEach.call(this.querySelectorAll(".label"),function(t){t.setAttribute("transform",t[Ft]),delete t[Ft]})})}this.floatingLayout&&(this.floatingLayout.xAxes.call(t),this.floatingLayout.yAxes.call(t),this.scrollManager.destroy(),this.floatingLayout=null),Mt.select(this.chart.getSVG()).selectAll(".floating-axes").remove()},detectChartBackgroundColor:function(){var t,e=this.chart.getLayout().layout;do{if("none"!==(t=window.getComputedStyle(e)).backgroundImage)return null;if("transparent"!==t.backgroundColor&&"rgba(0, 0, 0, 0)"!==t.backgroundColor)return t.backgroundColor}while(e=e.parentElement);return null}}}function zt(t,e){return"translate("+t+","+e+")"}function Bt(t){var e={x:0,y:0,r:0};if(!t)return e;var n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}var a=t.indexOf("rotate(");if(a>=0){var o=t.indexOf(")",a+7),s=t.substring(a+7,o);e.r=parseFloat(s.trim())}return e}function Vt(t){var e=t[Nt]&&t[Nt].transform,n=Bt(t.getAttribute("transform"));return{translate0:n,translate:e?Bt(t[Nt].transform):n}}function Ht(t){var e={x:[],y:[]},n={x:0,y:0},r={x:null,y:null},i=t,a=[];this.onScroll=function(t){return a.push(t),this},this.handleVisibilityFor=function(t,n){return n.indexOf("x")>=0&&e.x.push(t),n.indexOf("y")>=0&&e.y.push(t),this};var o=function(){var t=i.scrollLeft,o=i.scrollTop;a.forEach(function(e){e.call(null,t,o)});var u=function(i){var a="x"===i?t:o;a!==n[i]&&(clearTimeout(r[i]),s(e[i],function(t){t.transition("floatingAxes_scrollVisibility"),t.attr("opacity",1e-6)}),r[i]=setTimeout(function(){s(e[i],function(t){r[i]=null,t.transition("floatingAxes_scrollVisibility").duration(256).attr("opacity",1)})},128)),n[i]=a};u("x"),u("y")};function s(t,e,n){t.forEach(function(t){e.call(n,t)})}i.addEventListener("scroll",o),this.fireScroll=function(){o.call(null,i.scrollLeft,i.scrollTop)},this.destroy=function(){i.removeEventListener("scroll",o)}}r.default.api.plugins.add("floating-axes",It);var Wt=r.default.api.utils;function Gt(t){Wt.defaults(t||{},{});var e=function(t,e,n,r){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains(n)&&r(t,e),e=e.parentNode})};return{init:function(t){this._chart=t,this._currentFilters={},this._legendColorByScaleId={};var n=this._chart.getSpec(),r=function(t){return function(e,r){var i=n.scales[r];return i.type===t&&i.dim&&e.push(r),e}};this._color=Object.keys(n.scales).reduce(r("color"),[]),this._fill=Object.keys(n.scales).reduce(r("fill"),[]);var i=this._color.length>0,a=this._fill.length>0;(i||a)&&(this._container=this._chart.insertToRightSidebar(this._containerTemplate),i&&(e(this._container,"click","tau-chart__legend__item-color",function(t,e){this._toggleLegendItem(e)}.bind(this)),e(this._container,"mouseover","tau-chart__legend__item-color",function(t,e){this._highlightToggle(e,!0)}.bind(this)),e(this._container,"mouseout","tau-chart__legend__item-color",function(t,e){this._highlightToggle(e,!1)}.bind(this))))},onSpecReady:function(){this._assignStaticBrewersOrEx()},onRender:function(){this._clearPanel(),this._drawColorLegend(),this._drawFillLegend()},_containerTemplate:'
',_template:Wt.template('
<%=name%>
<%=items%>
'),_itemTemplate:Wt.template(["
\">",'
','
',"
","<%=label%>","
"].join("")),_itemFillTemplate:Wt.template(['
\' class="tau-chart__legend__item tau-chart__legend__item-color" style="padding: 6px 0px 10px 40px;margin-left:10px;">','
',' ',' <%=label%>',"
","
"].join("")),_clearPanel:function(){this._container&&(this._container.innerHTML="")},_drawColorLegend:function(){var t=this;t._color.forEach(function(e){var n=t._chart.select(function(t){return t.config.color===e})[0];if(n){var r=n.getScale("color"),i=t._chart.getDataSources({excludeFilter:["legend"]}),a=Wt.unique(i[r.source].data.map(function(t){return t[r.dim]})).map(function(n){var i=Wt.escape(n),a=r.dim+i;return{scaleId:e,dim:r.dim,color:r(n),disabled:t._currentFilters.hasOwnProperty(a),label:n,value:i}});t._legendColorByScaleId[e]=a,t._container.insertAdjacentHTML("beforeend",t._template({items:a.map(function(e){return t._itemTemplate({scaleId:e.scaleId,dim:e.dim,color:e.color,classDisabled:e.disabled?"disabled":"",label:e.label,value:e.value})}).join(""),name:(((n.guide||{}).color||{}).label||{}).text||r.dim}))}})},_drawFillLegend:function(){var t=this;t._fill.forEach(function(e){var n=t._chart.select(function(t){return"COORDS.MAP"===t.config.type&&t.config.fill===e});if(n.length>0){var r=n[0].getScale("fill"),i=r.brewer,a=r.domain(),o=(a[1]-a[0])/i.length,s=Wt.range(i.length).map(function(e){var n=a[0]+e*o,s="";return 0===e&&(s=a[0]),e===i.length-1&&(s=a[1]),t._itemFillTemplate({color:r(n),label:s,value:Wt.escape(n)})});t._container.insertAdjacentHTML("beforeend",t._template({items:s.join(""),name:(((n[0].guide||{}).fill||{}).label||{}).text||r.dim}))}})},_toggleLegendItem:function(t){var e=t.getAttribute("data-scale-id"),n=t.getAttribute("data-dim"),r=t.getAttribute("data-value"),i=n+r,a=this._legendColorByScaleId[e].filter(function(t){return!t.disabled});if(1!==a.length||e!==a[0].scaleId||r!==a[0].value){var o=this._currentFilters;if(o.hasOwnProperty(i)){var s=o[i];delete o[i],t.classList.remove("disabled"),this._chart.removeFilter(s)}else t.classList.add("disabled"),o[i]=this._chart.addFilter({tag:"legend",predicate:function(t){return t[n]!=r}});this._chart.refresh()}},_highlightToggle:function(t,e){var n=t.getAttribute("data-scale-id"),r=t.getAttribute("data-dim"),i=t.getAttribute("data-value");this._chart.select(function(t){return t.config.color===n}).forEach(function(t){t.fire("highlight",function(t){return!e||t[r]==i})})},_generateColorMap:function(t){var e=Wt.range(20).map(function(t){return"color20-"+(1+t)});return t.reduce(function(t,n,r){return t[n]=e[r%20],t},{})},_assignStaticBrewersOrEx:function(){var t=this;t._color.forEach(function(e){var n=t._chart.getSpec().scales[e],r=t._chart.getDataSources({excludeFilter:["legend"]}),i=t._chart.getScaleFactory(r).createScaleInfoByName(e).domain();n.brewer||(n.brewer="measure"!==n.dimType?t._generateColorMap(i):["#e5f5e0","#a1d99b","#31a354"])})}}}r.default.api.plugins.add("geomap-legend",Gt);var Ut=r.default.api.utils;function Xt(t){Ut.defaults(t||{},{});var e=function(){return!1};return{init:function(t){this._currNode=null,this._currData=null,this._chart=t,this._tooltip=t.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains("i-role-exclude")&&(n._exclude(),n._tooltip.hide(),n._blurSelection()),e=e.parentNode},!1);var e,n=this;this._showTooltip=function(t){clearTimeout(e),n._currData=t.data;var r="No data";null!==t.data&&(r=Object.keys(t.data).map(function(e){return n.itemTemplate({label:e,value:t.data[e]})}).join(""));var i=n._tooltip.getElement().querySelectorAll(".i-role-content");i[0]&&(i[0].innerHTML=r);var a=n._tooltip.getElement().querySelectorAll(".i-role-exclude");if(a[0]){var o=t.data&&n._chart.getChartModelData().length>1;a[0].style.visibility=o?"visible":"hidden"}n._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this._hideTooltip=function(t){e=setTimeout(function(){n._tooltip.hide()},t?0:1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){n._hideTooltip(!0),n._blurSelection()},!1)},onRender:function(){var t=this;this._chart.select(function(t){return"COORDS.MAP"===t.config.type}).forEach(function(e){t._subscribeToPoints(e),t._subscribeToArea(e)})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:Ut.template(['
','
<%=label%>
','
<%=value%>
',"
"].join("")),_exclude:function(){var t;this._chart.addFilter({tag:"exclude",predicate:(t=this._currData,function(e){return JSON.stringify(e)!==JSON.stringify(t)})}),this._chart.refresh()},_blurSelection:function(){this._chart.select(function(t){return"COORDS.MAP"===t.config.type}).forEach(function(t){t.fire("highlight-area",e)}),this._currNode=null,this._currData=null},_subscribeToPoints:function(t){var e=this;t.on("point-mouseover",function(t,n){e._showTooltip(n)}),t.on("point-mouseout",function(t,n){e._hideTooltip()})},_subscribeToArea:function(t){var e=this;!t.getScale("code").dim||t.on("area-click",function(n,r){var i,a;e._currNode=n,r.data?e._currData===r.data?(e._hideTooltip(!0),e._blurSelection()):(t.fire("highlight-area",(i=r.data,a=JSON.stringify(i),function(t){return JSON.stringify(t)===a})),e._showTooltip(r)):(e._showTooltip(r),e._hideTooltip(!1),e._blurSelection())})}}}r.default.api.plugins.add("geomap-tooltip",Xt);var qt=n(2),Yt=r.default.api.utils,$t=r.default.api.pluginsSDK,Kt=$t.tokens();function Jt(t){var e=Yt.defaults(t||{},{title:"Layers",label:"Layer Type",showPanel:!0,showLayers:!0,mode:"merge",axisWidth:45,layers:[]});e.layers.forEach(function(t){t.guide=Yt.defaults(t.guide||{},{scaleOrient:"left",textAnchor:"end",hide:!1})});var n=function(t){return function(e){return Object.assign(e,t)}},r={line:n({type:"ELEMENT.LINE"}),area:n({type:"ELEMENT.AREA"}),dots:n({type:"ELEMENT.POINT"}),scatterplot:n({type:"ELEMENT.POINT"}),bar:n({type:"ELEMENT.INTERVAL"}),"stacked-bar":n({type:"ELEMENT.INTERVAL",stack:!0})};return{init:function(t){this._chart=t;var n=$t.spec(this._chart.getSpec()),r=this.checkIfApplicable(n);if(this._isApplicable=0===r.length,n.addTransformation("defined-only",function(t,e){var n=e.key;return t.filter(function(t){return null!==t[n]&&void 0!==t[n]})}),this._isApplicable){this.isFacet=this.checkIsFacet(n),this.primaryY=this.findPrimaryLayer(n);var i=this.getLayersText(),a=this.getLayersGroup(),o=e.label;this.fieldColorScale=o,n.setSettings("excludeNull",!1).setSettings("fitModel",null).addScale(o,{type:"color",source:"/",dim:o,brewer:e.brewer}).addTransformation("slice-layer",function(t,e){var n=e.key,r=e.group;return r?t.filter(function(t){var e=t[r],n=t[e];return e&&null!=n}):t.filter(function(t){return t[o]===i[n]&&null!==t[n]&&void 0!==t[n]})});var s=[this.primaryY].concat(e.layers).reduce(function(t,e){return t.concat(e.y)},[]);t.setupChartSourceModel(function(t){var e={};e[o]={type:"category"};var n={"/":{dims:e,data:[]}};return n["/"].dims=Object.assign(e,t["/"].dims),n["/"].data=t["/"].data.reduce(function(t,e){return t.concat(s.map(function(t){var n={};n[o]=i[t];var r=a[t];return r&&(n[r]=e[t],n.subLayer=r),Object.assign(n,e)}))},[]),Object.assign(n,Yt.omit(t,"/"))}),e.showPanel&&(this._container=t.insertToRightSidebar(this.containerTemplate),this._container.classList.add("applicable-true"),this.uiChangeEventsDispatcher=function(t){var n=t.target,r=n.classList;r.contains("i-role-show-layers")&&(e.showLayers=n.checked),r.contains("i-role-change-mode")&&(e.mode=n.value),this._chart.refresh()}.bind(this),this._container.addEventListener("change",this.uiChangeEventsDispatcher,!1))}else{n.getSettings("log")("[layers plugin]: is not applicable. "+r.join(" / "))}},getLayersText:function(){return[this.primaryY].concat(e.layers).reduce(function(t,e){return(Array.isArray(e.y)?e.y:[e.y]).reduce(function(t,n){return t[n]=this.extractLabelForKey(e,n),t}.bind(this),t)}.bind(this),{})},getLayersGroup:function(){return[this.primaryY].concat(e.layers).reduce(function(t,e){var n=null;return Array.isArray(e.y)&&(n=e.y.join(", ")),Yt.flatten([e.y]).reduce(function(t,e){return t[e]=n,t},t)}.bind(this),{})},checkIsFacet:function(t){return t.unit().reduce(function(t,e,n){return t||(n&&"COORDS.RECT"===n.type&&"COORDS.RECT"===e.type?t=!0:t)},!1)},checkIfApplicable:function(t){return t.unit().reduce(function(e,n,r){if(r&&"COORDS.RECT"!==r.type)return e.concat("Chart specification contains non-rectangular coordinates");if(r&&"COORDS.RECT"===r.type&&"COORDS.RECT"!==n.type){var i=t.getScale(n.y);if("measure"!==t.getSourceDim(i.source,i.dim).type)return e.concat("Y scale is not a measure")}return e},[])},isLeafElement:function(t,e){return e&&"COORDS.RECT"===e.type&&"COORDS.RECT"!==t.type},isFirstCoordNode:function(t,e){return!e&&t&&"COORDS.RECT"===t.type},isFinalCoordNode:function(t,e){return t&&"COORDS.RECT"===t.type&&t.units.every(function(t){return"COORDS.RECT"!==t.type})},buildLayersLayout:function(t){return t.regSource("$",{dims:{x:{type:"category"},y:{type:"category"}},data:[{x:1,y:1}]}).addScale("xLayoutScale",{type:"ordinal",source:"$",dim:"x"}).addScale("yLayoutScale",{type:"ordinal",source:"$",dim:"y"}).unit({type:"COORDS.RECT",x:"xLayoutScale",y:"yLayoutScale",expression:{source:"$",inherit:!1,operator:!1},guide:{showGridLines:"",x:{cssClass:"facet-axis"},y:{cssClass:"facet-axis"}}})},findPrimaryLayer:function(t){var e=this,n=t.unit().reduce(function(n,r){return n.concat(e.isFinalCoordNode(r)?{y:t.getScale(r.y).dim,isPrimary:!0,guide:r.guide.y,scaleName:r.y}:[])},[]);return $t.cloneObject(n[0])},createPrimaryUnitReducer:function(t,n,r,i){var a=this;return function(o,s,u){var l=function(t){return!0!==t.guide.hide};if(a.isFacet&&a.isFirstCoordNode(s,u)){s.guide.y.label=s.guide.y.label||{};var c=s.guide.y.label._original_text||s.guide.y.label.text;s.guide.y.label.text=[c,n.filter(l).map(a.extractLayerLabel.bind(a)).join(", ")].join(t.getSettings("facetLabelDelimiter")),"dock"===e.mode&&(s.guide.y.label.padding-=15,s.guide.y.padding+=15,s.guide.y.rotate=-90,s.guide.y.textAnchor="middle")}return a.isLeafElement(s,u)&&(u.units=u.units.filter(function(t){return t!==s})),a.isFinalCoordNode(s)&&(s.guide.y.label=s.guide.y.label||{},"dock"===e.mode&&(s.guide.padding.l=r,s.guide.padding.r=i,s.guide.y.hide=!0),"merge"===e.mode&&(s.guide.y.label.text=a.isFacet?"":n.filter(l).map(a.extractLayerLabel.bind(a)).join(", "))),o}},createSecondaryUnitReducer:function(t,n,i,a,o,s,u,l){var c=this,f=c.getScaleName(n.scaleName||n.y),d=n.guide.scaleOrient,h=Array.isArray(n.y),p=n.isPrimary;return function(g,m,y){if(c.isFacet&&c.isFirstCoordNode(m,y)&&(m.guide.y.label.text="",m.guide.x.hide=!0,m.guide.y.hide=!0),c.isLeafElement(m,y)){(n.type?r[n.type]:function(t){return t})(m),m.y=f;var v=t.getScale(m.size).dim;if(p&&v);else{var b="size_null"+l;t.addScale(b,{type:"size",source:"?",mid:1}),m.size=b}var x=t.getScale(m.color).dim;p&&x||(m.color=c.fieldColorScale,m.expression.operator="groupBy",m.expression.params=h?["subLayer"]:[c.fieldColorScale]);var _=h?{group:"subLayer"}:{key:n.y};$t.unit(m).addTransformation("slice-layer",_)}if(c.isFinalCoordNode(m)){if(m.y=f,m.guide.y=Object.assign(m.guide.y,n.guide||{}),m.guide.y.label=m.guide.y.label||{},m.guide.y.label.text=c.extractLayerLabel(n),m.guide.x.hide=!0,"dock"===e.mode){m.guide.showGridLines="",m.guide.padding.l=i,m.guide.padding.r=a,m.guide.y.label.textAnchor="end",m.guide.y.label.dock="right",m.guide.y.label.padding="right"===d?1:-10,m.guide.y.label.cssClass="label inline";var w="right"===d?u:s;m.guide.y.padding+=o*w}"merge"===e.mode&&(m.guide.showGridLines="",m.guide.y.hide=!0)}return g}},getScaleName:function(t){return Array.isArray(t)?t.join(", "):t},extractLabelForKey:function(t,e){var n=t.guide||{};n.label="string"==typeof n.label?{text:n.label}:n.label;var r=n.label||{},i=r.byKeys||{};return Array.isArray(t.y)?i[e]||e:r.text||r._original_text||t.y},extractLayerLabel:function(t){var e=this;return(Array.isArray(t.y)?t.y:[t.y]).map(function(n){return e.extractLabelForKey(t,n)}).join(", ")},onSpecReady:function(t,n){var r=this,i=$t.spec(n);if(e.showLayers&&r._isApplicable){i=e.layers.reduce(function(t,e){var n=r.getScaleName(e.y);return t.addScale(n,Object.assign({type:"linear",source:"/",dim:n,autoScale:!0},Yt.pick(e.guide||{},"min","max","autoScale","nice","niceInterval")))},i);var a,o=[this.primaryY].concat(e.layers).sort(function(t,e){return(t.guide.zIndex||0)-(e.guide.zIndex||0)}),s=i.unit(),u=e.axisWidth,l=function(t){return function(e){var n=e.guide.scaleOrient||"left";return!0!==e.guide.hide&&n===t}},c=l("left"),f=l("right"),d=o.filter(c).length*u,h=o.filter(f).length*u,p=r.buildLayersLayout(i).addFrame({key:{x:1,y:1},units:[(a=$t.unit(s.clone())).reduce(r.createPrimaryUnitReducer(i,o,d,h),a).value()]}),g=-1,m=-1;o.reduce(function(t,e,n){return g=c(e)?g+1:g,m=f(e)?m+1:m,t.addFrame({key:{x:1,y:1},units:[(a=$t.unit(s.clone())).reduce(r.createSecondaryUnitReducer(i,e,d,h,u,g,m,n),a).value()]})},p)}else i.unit().traverse(function(t,e){r.isLeafElement(t,e)&&$t.unit(t).addTransformation("defined-only",{key:i.getScale(t.y).dim})})},onUnitsStructureExpanded:function(){var t=this;if(t._isApplicable&&"merge"===e.mode){var n=$t.spec(t._chart.getSpec()),r=t.primaryY.scaleName,i=e.layers.map(function(e){return t.getScaleName(e.y)}).filter(function(t){return n.getScale(t)}).concat(r),a=i.reduce(function(e,n){var r=t._chart.getScaleInfo(n);return e[n]=r.domain().filter(function(t){return Number.isFinite(t)}),e},{}),o=qt.extent(Yt.flatten(Object.keys(a).map(function(t){return a[t]})));i.forEach(function(t){var e=n.getScale(t);e.min=o[0],e.max=o[1],e.nice=!1})}},containerTemplate:'
',template:Yt.template(['","
",'","
"].join("")),onRender:function(){this._isApplicable&&e.showPanel&&(this._container.innerHTML=this.template({title:e.title,mode:e.mode,showLayers:e.showLayers}))}}}r.default.api.plugins.add("layers",Jt);var Qt,Zt,te=n(6),ee=r.default.api.utils,ne=r.default.api.pluginsSDK,re=".tau-chart__legend__reset",ie=".tau-chart__legend__item-color",ae=".tau-chart__legend__guide--color__overlay",oe=4,se=13,ue=0,le=function(){return++ue},ce=r.default.api.utils.xml,fe=function(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=ee.range(e-2).map(function(t){return n+i*(t+1)});return[n].concat(a).concat(r)},de=function(t,e,n){if(t.length<3)return t.slice(0);if(e<3)return[t[0],t[t.length-1]];var r,i=t[0]<0?Math.abs(t[0]):0,a=function(t){return t},o="sqrt"===n?function(t){return Math.sqrt(t+i)}:a,s="sqrt"===n?function(t){return Math.pow(t,2)-i}:a,u=[(t=t.map(o))[0]],l=t[t.length-1]-t[0],c=.5*l/(e-1),f=ee.range(1,e-1).map(function(t){var n=l*t/(e-1);return{min:n-c,mid:n,max:n+c,diff:Number.MAX_VALUE,closest:null}}),d=0,h=function(){if(d!==f.length){var t=r;(r=f[d++]).min=Math.max(r.min,(t&&null!==t.closest?t.closest:u[0])+c)}};return h(),t.forEach(function(t){if(!(tr.max&&h();var e=Math.abs(t-r.mid);e0?Math.abs(e-t):n,a=pe(i),o=Math.abs(r-a);return Math.abs(r)>3&&o<=3?ye:function(t){var e=pe(n-t),r=Math.min((a<0?Math.abs(a):0)+(e0,s=this._fill.length>0,u=this._size.length>0;if(this._assignStaticBrewersOrEx(),a||s||u){switch(n.position){case"left":this._container=this._chart.insertToLeftSidebar(this._containerTemplate);break;case"right":this._container=this._chart.insertToRightSidebar(this._containerTemplate);break;case"top":this._container=this._chart.insertToHeader(this._containerTemplate);break;case"bottom":this._container=this._chart.insertToFooter(this._containerTemplate);break;default:this._container=this._chart.insertToRightSidebar(this._containerTemplate)}a&&(o(this._container,"click",re,function(t,n){e._toggleLegendItem(n,"reset")}),o(this._container,"click",ie,function(t,n){var r=t.ctrlKey||t.target.matches(ae)?"leave-others":"focus-single";e._toggleLegendItem(n,r)}),o(this._container,"mouseover",ie,function(t,n){e._highlightToggle(n,!0)}),o(this._container,"mouseout",ie,function(t,n){e._highlightToggle(n,!1)}))}},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])}),this._container&&this._container.parentElement&&(this._clearPanel(),this._container.parentElement.removeChild(this._container))},onSpecReady:function(t,e){this._formatters=ne.getFieldFormatters(e,n.formatters)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},onRender:function(){var t=this;if(e&&n.selectedCategories&&0!==n.selectedCategories.length){var r=this._getLegendColorByScales();return Object.keys(r).forEach(function(e){r[e].legendColorItems.forEach(function(e){var r=e.value,i=e.dim;if(-1===n.selectedCategories.indexOf(JSON.parse(r))){var o=i+r,s=a(i,r);t._currentFilters[o]=t._chart.addFilter({tag:"legend",predicate:function(t){return!s(t)}})}})}),e=!1,void this._chart.refresh()}this._clearPanel(),this._drawColorLegend(),this._drawFillLegend(),this._drawSizeLegend()},_containerTemplate:'
',_template:ee.template(['
',"<%=top%>",'
<%=name%>
',"<%=items%>","
"].join("")),_itemTemplate:ee.template(["
\">",'
','
','
',"
","
","
",' <%=label%>',"
"].join("")),_resetTemplate:ee.template(['
','
Reset
',"
"].join("")),_clearPanel:function(){this._container&&(clearTimeout(this._scrollTimeout),this._getScrollContainer().removeEventListener("scroll",this._scrollListener),this._container.innerHTML="")},_drawFillLegend:function(){var t=this;t._fill.forEach(function(e){var n,r,a,o=t._chart.select(function(t){return t.config.color===e})[0];if(o){var s=o.config.guide||{},u=o.getScale("color"),l=u.domain().sort(function(t,e){return t-e}),c=i(l),f=c?l.map(Number):l,d=ve(f[0],f[f.length-1]),h=function(){var e=t._chart.getSpec(),n=ne.extractFieldsFormatInfo(e)[u.dim].format;return n||(n=function(t){return new Date(t)}),function(t){return String(n(t))}}(),p=c?h:d,g=u.brewer.length,m=((s.color||{}).label||{}).text||u.dim,y=function(t){return t.length*se*.618},v=u.isInteger?(f[1]-f[0])%3==0?4:(f[1]-f[0])%2==0?3:2:3,b=fe(f,v),x=(c?b.map(function(t){return new Date(t)}):b).map(p);x[0]===x[x.length-1]&&(x=[x[0]]),t._container.insertAdjacentHTML("beforeend",t._template({name:ee.escape(m),top:null,items:'
'}));var _=t._container.lastElementChild.querySelector(".tau-chart__legend__gradient-wrapper"),w=_.getBoundingClientRect().width,E=!1;x.reduce(function(t,e){return t+y(e)},0)>w&&(x.length>1&&y(x[0])+y(x[x.length-1])>w?E=!0:x=[x[0],x[x.length-1]]);var S=E?(a=-.382*se/2,{width:w,height:120,barX:0,barY:0,barWidth:20,barHeight:120,textAnchor:"start",textX:ee.range(v).map(function(){return 25}),textY:1===x.length?60+.618*se:x.map(function(t,e){var n=(x.length-1-e)/(x.length-1);return se*(1-n)+120*n+a})}):(n=y(x[0])/2,r=y(x[x.length-1])/2,{width:w,height:28+se,barX:0,barY:0,barWidth:w,barHeight:20,textAnchor:"middle",textX:1===x.length?[w/2]:x.map(function(t,e){var i=e/(x.length-1);return n*(1-i)+(w-r)*i}),textY:ee.range(v).map(function(){return 28+se})}),M=fe(f,g).map(function(t,e){return ce("stop",{offset:e/(g-1)*100+"%",style:"stop-color:"+u(t)+';stop-opacity:1"'})}),T="legend-gradient-"+t.instanceId,C=ce.apply(void 0,["svg",{class:"tau-chart__legend__gradient",width:S.width,height:S.height},ce("defs",ce.apply(void 0,["linearGradient",{id:T,x1:"0%",y1:E?"100%":"0%",x2:E?"0%":"100%",y2:"0%"}].concat(M))),ce("rect",{class:"tau-chart__legend__gradient__bar",x:S.barX,y:S.barY,width:S.barWidth,height:S.barHeight,fill:"url(#"+T+")"})].concat(x.map(function(t,e){return ce("text",{x:S.textX[e],y:S.textY[e],"text-anchor":S.textAnchor},t)})));_.insertAdjacentHTML("beforeend",C)}})},_drawSizeLegend:function(){var t=this;t._size.forEach(function(e){var n=t._chart.select(function(t){return t.config.size===e})[0];if(n){var r=n.config.guide||{},i=n.getScale("size"),a=i.domain().sort(function(t,e){return t-e});if(!Array.isArray(a)||!a.every(isFinite))return;var o=((r.size||{}).label||{}).text||i.dim,s=a[0],u=a[a.length-1],l=[s];if(u-s){var c=he(u-s),f=Math.round(4-c),d=Math.pow(10,f),h=ee.unique(t._chart.getDataSources({excludeFilter:["legend"]})[i.source].data.map(function(t){return t[i.dim]}).filter(function(t){return t>=s&&t<=u})).sort(function(t,e){return t-e}),p=de(h,oe,i.funcType);l=ee.unique(p.map(function(t){return Math.round(t*d)/d}))}var g=ve(l[0],l[l.length-1]),m=function(t){return t.length*se*.618};l.reverse();var y=l.map(i),v=Math.max.apply(null,y),b=l.map(g);t._container.insertAdjacentHTML("beforeend",t._template({name:ee.escape(o),top:null,items:'
'}));var x=t._container.lastElementChild.querySelector(".tau-chart__legend__size-wrapper"),_=x.getBoundingClientRect().width,w=!1;(Math.max.apply(null,b.map(m))>_/4||1===b.length)&&(w=!0);var E=w?function(){for(var t=se,e=y[0]/2,n=y[y.length-1]/2,r=[e],i=1,a=void 0,o=void 0;i0&&(t._updateResetButtonPosition(),t._scrollTimeout=null,t._scrollListener=function(){var e=t._container.querySelector(re);e.style.display="none",t._scrollTimeout&&clearTimeout(t._scrollTimeout),t._scrollTimeout=setTimeout(function(){t._updateResetButtonPosition(),e.style.display="",t._scrollTimeout=null},250)},t._getScrollContainer().addEventListener("scroll",t._scrollListener))},_toggleLegendItem:function(t,e){var r=this,i=this._currentFilters,o=t?Array.prototype.filter.call(t.parentNode.childNodes,function(t){return t.matches(ie)}):null,s=function(t){var e=t.getAttribute("data-dim"),n=t.getAttribute("data-value");return{sid:t.getAttribute("data-scale-id"),dim:e,val:n,key:e+n}},u=function(t){return t in i},l=function(t,e){var n=s(t);if(u(n.key)===e)if(e){var o=i[n.key];delete i[n.key],t.classList.remove("disabled"),r._chart.removeFilter(o)}else{t.classList.add("disabled");var l=a(n.dim,n.val);i[n.key]=r._chart.addFilter({tag:"legend",predicate:function(t){return!l(t)}})}},c=function(e){return e===t},f=!!t&&u(s(t).key),d=function(t,e){t.querySelector(".tau-chart__legend__guide").style.backgroundColor=e?"":"transparent"};if("reset"===e)o.forEach(function(t){l(t,!0),d(t,!0)});else if("leave-others"===e)o.forEach(function(t){c(t)&&l(t,f)}),d(t,f);else if("focus-single"===e){var h=!f&&o.every(function(t){return c(t)||u(s(t).key)});o.forEach(function(t){var e=c(t)||h;l(t,e)}),f&&d(t,!0)}var p=o.filter(function(t){return!u(s(t).key)}).map(function(t){return JSON.parse(s(t).val)});n.onSelect({type:e,selectedCategories:p}),this._chart.refresh()},_highlightToggle:function(t,e){if(!t.matches(".disabled")){var n=t.getAttribute("data-dim"),r=t.getAttribute("data-value"),i=e?a(n,r):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){t.fire("highlight",i)})}},_getScrollContainer:function(){return this._container.parentNode.parentNode},_updateResetButtonPosition:function(){this._container.querySelector(re).style.top=this._getScrollContainer().scrollTop+"px"},_generateColorMap:function(t,e){var n=e.length;return t.reduce(function(t,r,i){return t[r]=e[i%n],t},{})},_assignStaticBrewersOrEx:function(){var t=this;t._color.forEach(function(e){var n=t._chart.getSpec().scales[e],r=t._chart.getDataSources({excludeFilter:["legend"]}),i=t._chart.getScaleFactory(r).createScaleInfoByName(e).domain();if(!n.brewer||Array.isArray(n.brewer)){var a=n.brewer||ee.range(20).map(function(t){return"color20-"+(1+t)});n.brewer=t._generateColorMap(i,a)}t._legendOrderState[e]=i.reduce(function(t,e,n){return t[e]=n,t},{})})}}}r.default.api.plugins.add("legend",be);var xe=r.default.api.utils;function _e(t){var e=xe.defaults(t||{},{verbose:!1,forceBrush:{}}),n={init:function(t){e.verbose&&(this.panel=t.insertToRightSidebar(this.template())),t.traverseSpec(t.getSpec(),function(t){t&&"COORDS.PARALLEL"===t.type&&(t.guide=t.guide||{},t.guide.enableBrushing=!0)}),n.forceBrush=e.forceBrush||{}},onRender:function(t){var r=t.getSpec().scales,i=Object.keys(r).reduce(function(t,e){var i=r[e].dim;return n.forceBrush[i]&&(t[e]=n.forceBrush[i]),t},{}),a=t.select(function(t){return"PARALLEL/ELEMENT.LINE"===t.config.type});a.forEach(function(t,r){t.parentUnit.on("brush",function(i,a){n.forceBrush={};var o=a.map(function(t){var e=t.dim,r=t.func,i=t.args;n.forceBrush[e]=i;var a=function(){return!0};return"between"===r&&(a=function(t){return t[e]>=i[0]&&i[1]>=t[e]}),"inset"===r&&(a=function(t){return i.indexOf(t[e])>=0}),a}),s=0;if(t.fire("highlight",function(t){var e=o.every(function(e){return e(t)});return s+=e?1:0,e}),e.verbose){var u=n.panel.getElementsByClassName("i-"+r);if(0===u.length){var l=document.createElement("div");l.className="i-"+r,n.panel.appendChild(l),u[0]=l}u[0].innerHTML=a.reduce(function(t,e){return t+"
"+e.dim+": ["+e.args.join(",")+"]
"},"
Matched: "+s+"
")}})}),a.forEach(function(t){t.parentUnit.fire("force-brush",i)})},template:xe.template('
')};return n}r.default.api.plugins.add("parallel-brushing",_e);var we=r.default.api.utils;function Ee(t){we.defaults(t||{},{});return{init:function(t){this._cursor=null,this._chart=t,this._tooltip=t.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains("i-role-exclude")&&n._exclude(),e=e.parentNode;n._tooltip.hide()},!1);var e,n=this;this.showTooltip=function(t){clearTimeout(e),n._cursor=t.data;var r=n._tooltip.getElement().querySelectorAll(".i-role-content");r[0]&&(r[0].innerHTML=Object.keys(t.data).map(function(e){return n.itemTemplate({label:e,value:t.data[e]})}).join("")),n._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this.hideTooltip=function(t){e=setTimeout(function(){n._tooltip.hide()},1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){n._tooltip.hide()},!1)},_exclude:function(){var t;this._chart.addFilter({tag:"exclude",predicate:(t=this._cursor,function(e){return JSON.stringify(e)!==JSON.stringify(t)})}),this._chart.refresh()},onRender:function(t){var e=this;t.select(function(t){return"PARALLEL/ELEMENT.LINE"===t.config.type}).forEach(function(t){t.on("mouseout",function(t,n){e.hideTooltip(n)}),t.on("mouseover",function(t,n){e.showTooltip(n)})})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:we.template(['
','
<%=label%>
','
<%=value%>
',"
"].join(""))}}r.default.api.plugins.add("parallel-tooltip",Ee);var Se=n(8),Me=n(3),Te=n(7),Ce=function(){return(Ce=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0?a:Object.keys(i.dims),this._fieldBounds=t.fieldBounds||{},this._applyImmediately=Boolean(t.applyImmediately);var o=n._chart.getChartModelData();this._filtersContainer=n._chart.insertToRightSidebar(n._filtersContainer),this._filtersContainer.style.maxHeight="0px",n._fields.filter(function(t){var e="measure"===i.dims[t].type;return e||r.settings.log("The ["+t+"] isn't measure so Quick Filter plugin skipped it"),e}).forEach(function(t){n._data[t]=o.map(function(e){return e[t]});var e=n._fieldBounds[t];n._bounds[t]=e?[e.min,e.max]:ke.extent(n._data[t]),n._filter[t]=n._bounds[t],n._filtersContainer.insertAdjacentHTML("beforeend",n._filterWrapper({name:t})),n._container[t]=n._filtersContainer.lastChild,n._drawFilter(t)})},onRender:function(){this._filtersContainer.style.maxHeight="none"},_filtersContainer:'
',_filterWrapper:Ae.template('
<%=name%>
'),_drawFilter:function(t){var e=this._data[t],n=this._bounds[t],r=this._filter[t],i=Ae.isDate(n[0])||Ae.isDate(n[1]),a=this,o=0,s=24,u=21,l=12,c=180-l-s,f=41-o-u-8,d=ke.scaleLinear().domain(n).range([0,c]),p=ke.brushX().extent([[0,0],[c,20]]).on("start",function(){a._layout.style["overflow-y"]="hidden"}).on("brush",this._applyImmediately?E:w).on("end",function(){a._layout.style["overflow-y"]="",E()}),g=ke.select(this._container[t]).append("svg").attr("width",c+l+s).attr("height",f+o+u+4).append("g").attr("transform","translate("+l+","+o+")"),m=(g.append("g").selectAll("rect").data(e).enter().append("rect").attr("transform",function(t){return"translate("+d(t)+","+(o+4)+")"}).attr("height",f).attr("width",1),g.append("g").attr("class","brush").call(p));m.append("g").attr("class","resize e").attr("cursor","ew-resize").attr("pointer-events","none"),m.append("g").attr("class","resize w").attr("cursor","ew-resize").attr("pointer-events","none"),m.selectAll(".resize").append("line").attr("transform","translate(0, 0)").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",f+8),m.selectAll(".resize").append("text").attr("x",0).attr("y",2*(f+4)),m.selectAll("rect").attr("height",f+8);var y=g.append("text").attr("x",c/2).attr("y",2*(f+4)).attr("class","date-label"),v=function(t){return Math.log(t)/Math.LN10}(a._filter[t][1]-a._filter[t][0]),b=Math.round(3-v),x=Math.pow(10,b);if(i){var _=function(t){var e=t.findIndex(function(t){var e=ke.timeFormat(t);return e(new Date(n[0]))!==e(new Date(n[1]))});return e=e<0?t.length:e,{comm:t.slice(0,e),diff:t.slice(e)}}(["’%y"," %b","%d","%H",":%M",":%S"]);_.comm.length<3?(_.diff.splice(-3),_.diff.reverse(),_.comm.reverse()):(_.comm.length<5&&_.diff.pop(),_.diff=_.comm.splice(3,_.comm.length-3).concat(_.diff),_.comm.reverse())}function w(){var e=h.event;if(e&&Array.isArray(e.selection)){var n=e.selection.map(d.invert);r=n,a._filter[t]=n}else r=a._filter[t];var o=i?new Date(r[0]).getTime():r[0],s=i?new Date(r[1]).getTime():r[1],u=Math.round(parseFloat(o)*x)/x,l=Math.round(parseFloat(s)*x)/x;m.select(".handle--w"),m.select(".handle--e");m.select(".resize.w").attr("transform","translate("+d(r[0])+",0)"),m.select(".resize.e").attr("transform","translate("+d(r[1])+",0)");var c=m.selectAll(".w text"),f=m.selectAll(".e text");if(i){var p=ke.timeFormat(_.comm.join("")),g=ke.timeFormat(_.diff.join(""));y.html(g(new Date(u))+" .. "+g(new Date(l))+' '+p(new Date(l))+"")}else c.text(u),f.text(l)}function E(){w(),a._applyFilter(t)}E(),p.move(m,r.map(d))},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])});var n;(n=this._filtersContainer)&&n.parentElement&&n.parentElement.removeChild(n)},_applyFilter:function(t){var e=this._currentFilters,n=function(t,e,n){return function(r){var i=r[t];return in}}(t,this._filter[t][0],this._filter[t][1]),r=e[t];delete e[t],this._chart.removeFilter(r),e[t]=this._chart.addFilter({tag:"quick-filter",predicate:function(t){return!n(t)}}),Oe<0?this._chart.refresh():(this._refreshRequestId&&clearTimeout(this._refreshRequestId),this._refreshRequestId=setTimeout(function(){this._refreshRequestId=null,this._chart.refresh()}.bind(this),Oe))}}}r.default.api.plugins.add("quick-filter",Pe);var Le=r.default.api.utils;function Ne(t){var e=Le.defaults(t||{},{show:!0,modes:["normal","entire-view","fit-width","fit-height","minimal"]});return{init:function(t){e.show&&(e.selectedMode=t.getSpec().settings.fitModel,t.insertToHeader(this.template({modes:e.modes.map(function(t){return""})})).addEventListener("change",function(n){var r=n.target;r.classList.contains("i-role-fit-model")&&(e.selectedMode=r.value,t.getSpec().settings.fitModel=e.selectedMode,t.refresh())},!1))},template:Le.template(['
',"
"," View Mode: ",' ","
","
"].join(""))}}r.default.api.plugins.add("settings",Ne);function Re(t){return new X(t)}r.default.api.plugins.add("tooltip",Re);var Fe,De=(Fe={linear:function(t){for(var e=[0,0,0,0,0],n=0,r=[];nMath.abs(t[n][a])&&(a=r);for(i=n;i=n;i--)t[i][r]-=t[i][n]*t[n][r]/t[n][n]}for(r=s-1;r>=0;r--){for(o=0,i=r+1;i=0;s--)m+=s>1?Math.round(100*h[s])/100+"x^"+s+" + ":1==s?Math.round(100*h[s])/100+"x + ":Math.round(100*h[s])/100;return{equation:h,points:i,string:m}},lastvalue:function(t){for(var e=[],n=null,r=0;r0&&ot[o]-t[s]?a:o;for(var c=Math.abs(1/(t[u]-l)),f=0,d=0,h=0,p=0,g=0,m=a;m<=o;){var y=t[m],v=e[m],b=r((m1&&(a||s)&&(d=[d[0],d[d.length-1]]),t.concat(d.length>1?d:[])},[])},t.traverseSpec(n,function(t,r){if(i.predicateIsApplicable(n,t,r)){var a=n.scales[t.x],o=n.scales[t.y],s=n.scales[t.color]||{},u=JSON.parse(JSON.stringify(t));u.type="ELEMENT.LINE",u.size="size_null",u.namespace="trendline",u.transformation=u.transformation||[],u.transformation.push({type:"regression",args:{type:e.type,x:a,y:o,g:s}});u.guide=je.defaults({},u.guide||{}),u.guide.interpolate="linear",u.guide.showAnchors="never",u.guide.cssClass="tau-chart__trendline",u.guide.widthCssClass="tau-chart__line-width-1",u.guide.x=u.guide.x||{},u.guide.x.fillGaps=!1,delete u.guide.label,delete u.label,r.units.push(u)}})}},containerTemplate:'
',template:je.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(t){if(this._container){this._container.innerHTML=this.template({title:"Trend line",error:this._error,showTrend:e.showTrend&&this._isApplicable?"checked":"",models:e.models.map(function(t){return""})});var n=function(t){return function(){h.select(this).classed({active:t,"tau-chart__line-width-1":!t,"tau-chart__line-width-3":t})}};h.select(t.getSVG()).selectAll(".tau-chart__trendline").on("mouseenter",n(!0)).on("mouseleave",n(!1))}}}}r.default.api.plugins.add("trendline",Ie);var ze={YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}},Be=function(t,e){return ze[t][e].map(function(n,r){return t+" q"+r+"-"+e})};r.default.api.colorBrewers.add("tauBrewer",Be);n.d(e,"GPL",function(){return Ve}),n.d(e,"Plot",function(){return He}),n.d(e,"Chart",function(){return We}),n.d(e,"api",function(){return Ge}),n.d(e,"version",function(){return Ue});var Ve=r.default.GPL,He=r.default.Plot,We=r.default.Chart,Ge=r.default.api,Ue=r.default.version}])}); \ No newline at end of file diff --git a/examples/playground.html b/examples/playground.html deleted file mode 100644 index 0819e6409..000000000 --- a/examples/playground.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Title - - - - -
- - - - - - - - - diff --git a/examples/playground.js b/examples/playground.js deleted file mode 100644 index dbc4a7aac..000000000 --- a/examples/playground.js +++ /dev/null @@ -1,236 +0,0 @@ - -var now = new Date(); - - -var chart = new Taucharts.Chart({ - type: 'scatterplot', - settings:{ - asyncRendering: false, - }, - x: 'x', - y: 'y', - color: 'color', - // autoResize: false, - - /*dimensions: { - x: { - type: `measure`, - scale: `time`, - }, - y: { - type: `measure`, - scale: `linear`, - } - },*/ - plugins: [Taucharts.api.plugins.get('quick-filter')()], - settings: { - $maxTickTextW: 1000, - $maxTickTextH: 1000, - }, - guide: { - 'x': { - "tickFormat": "%d-%b-%y", - "tickPeriod": 'day', - rotate: -90, - }, - 'y': { - "autoScale": false, - 'nice': false, - "min": 0, - "max": 100 - } - }, - data: Array.from({length: 25}) - .reduce(function (memo, el, i) { - let date = new Date(now - days(i)); - return memo.concat([{ - x: date, //new Intl.DateTimeFormat('ru', {year:"numeric", month:"short", day: "numeric"}).format(date), - y: Math.random() * 100, - color: i%2 ? 'red': 'blue' - }]); - }, []) -}); -function days(i) { - return i * 1000 * 60 * 60 * 24; -}; - -/* -chart.on('*', (el) => { - console.log(el); -}); -*/ - -chart.renderTo('#placeholder'); - - -/* -const data = [{ - "time": "2018-06-24T15:30:01.904Z", - "cpu": 23.145552105656076, - "server": "demo-server" -}, - { - "time": "2018-06-24T16:30:01.904Z", - "cpu": 10.424267786483867, - "server": "test-server" - }, - { - "time": "2018-06-24T17:30:01.904Z", - "cpu": 23.691769196406714, - "server": "demo-server" - }, - { - "time": "2018-06-24T18:30:01.904Z", - "cpu": 23.27492418595674, - "server": "demo-server" - }, - { - "time": "2018-06-24T19:30:01.904Z", - "cpu": 23.271353786153327, - "server": "test-server" - }, - { - "time": "2018-06-24T20:30:01.904Z", - "cpu": 22.92074439315705, - "server": "demo-server" - }, - { - "time": "2018-06-24T21:30:01.904Z", - "cpu": 23.11210282740022, - "server": "test-server" - }, - { - "time": "2018-06-24T22:30:01.904Z", - "cpu": 22.888896455121, - "server": "demo-server" - }, - { - "time": "2018-06-24T23:30:01.904Z", - "cpu": 23.140232897680306, - "server": "demo-server" - }, - { - "time": "2018-06-25T00:30:01.904Z", - "cpu": 23.62603346139287, - "server": "demo-server" - }, - { - "time": "2018-06-25T01:30:01.904Z", - "cpu": 23.86456082089055, - "server": "demo-server" - }, - { - "time": "2018-06-25T02:30:01.904Z", - "cpu": 24.346851236707575, - "server": "demo-server" - }, - { - "time": "2018-06-25T03:30:01.904Z", - "cpu": 24.84186676949878, - "server": "demo-server" - }, - { - "time": "2018-06-25T04:30:01.904Z", - "cpu": 25.22250944107475, - "server": "demo-server" - }, - { - "time": "2018-06-25T05:30:01.904Z", - "cpu": 25.010413029796464, - "server": "demo-server" - }, - { - "time": "2018-06-25T06:30:01.904Z", - "cpu": 24.77313142288108, - "server": "demo-server" - }, - { - "time": "2018-06-25T07:30:01.904Z", - "cpu": 24.3613050455872, - "server": "demo-server" - }, - { - "time": "2018-06-25T08:30:01.904Z", - "cpu": 24.818728688705292, - "server": "demo-server" - }, - { - "time": "2018-06-25T09:30:01.904Z", - "cpu": 24.39876445385598, - "server": "prod-server" - }, - { - "time": "2018-06-25T10:30:01.904Z", - "cpu": 24.502432116686045, - "server": "demo-server" - }, - { - "time": "2018-06-25T11:30:01.904Z", - "cpu": 24.738301904226823, - "server": "demo-server" - }, - { - "time": "2018-06-25T12:30:01.904Z", - "cpu": 24.309983634585944, - "server": "demo-server" - }, - { - "time": "2018-06-25T13:30:01.904Z", - "cpu": 24.484520729822147, - "server": "prod-server" - }, - { - "time": "2018-06-25T14:30:01.904Z", - "cpu": 24.205860467958054, - "server": "demo-server" - } -]; - - -const params = location.hash.match(/filter=(.+)/); -let selectedCategories = null; -if(params) { - selectedCategories = JSON.parse(decodeURIComponent(params[1])); -} -let config = { - type: 'line', - x: 'time', - y: 'cpu', - color: 'server', - dimensions: { - time: { - scale: 'time', - type: 'measure' - }, - cpu: { - type: 'measure' - }, - server: { - type: 'category' - } - }, - guide: { - x:{ - rotate: 90, - } - }, - plugins: [ - Taucharts.api.plugins.get('legend')({ - onSelect({type, selectedCategories}) { - if(type !== 'reset') { - location.hash = 'filter=' + JSON.stringify(selectedCategories); - } else { - location.hash = ''; - } - - }, - selectedCategories: selectedCategories - }), - ], - - data: data -}; -const chart = new Taucharts.Chart(config); - -chart.renderTo(document.body);*/ - diff --git a/package.json b/package.json index 4644d07cd..e8d7b7cde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "taucharts", - "version": "2.7.1", + "version": "2.7.2", "homepage": "https://github.com/TargetProcess/taucharts", "description": "Data-focused charting library based on D3", "author": { @@ -71,7 +71,7 @@ "gh-pages": "^2.0.1", "jquery": "3.3.1", "js-schema": "1.0.1", - "karma": "^4.0.0", + "karma": "^4.1.0", "karma-chrome-launcher": "2.2.0", "karma-coverage-istanbul-reporter": "^2.0.5", "karma-coveralls": "^2.1.0", @@ -81,7 +81,7 @@ "less": "^3.9.0", "less-loader": "4.1.0", "mini-css-extract-plugin": "^0.5.0", - "mocha": "^6.0.2", + "mocha": "^6.1.4", "style-loader": "^0.23.1", "tau-tooltip": "1.1.3", "ts-loader": "^5.3.3", @@ -89,7 +89,7 @@ "tslint-eslint-rules": "5.4.0", "typescript": "^3.3.3333", "webpack": "^4.29.5", - "webpack-bundle-analyzer": "^3.0.4", + "webpack-bundle-analyzer": "^3.3.2", "webpack-cli": "^3.2.3", "webpack-dev-server": "^3.2.1" },