@oliasoft-open-source/charts-library 4.7.0-beta-5 → 4.7.0-beta-7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
8
5
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
9
6
  import * as React from "react";
@@ -11,8 +8,8 @@ import React__default, { forwardRef, useRef, useEffect, createContext as createC
11
8
  import { produce } from "immer";
12
9
  import { round as round$2, displayNumber, isCloseTo, roundByMagnitude } from "@oliasoft-open-source/units";
13
10
  import cx from "classnames";
14
- import { Portal, Icon, Menu, Tooltip as Tooltip$2, Button, Text, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Flex } from "@oliasoft-open-source/react-ui-library";
15
- import { isEmpty, isArray as isArray$2, some, has, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, isNil, map as map$3, find, get as get$1 } from "lodash";
11
+ import { Portal, Icon, Menu, Tooltip as Tooltip$2, Button, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Flex, Text } from "@oliasoft-open-source/react-ui-library";
12
+ import { isEmpty, isArray as isArray$2, some, has, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, isNil, map as map$3, find, get as get$1, noop as noop$2 } from "lodash";
16
13
  /*!
17
14
  * @kurkle/color v0.3.2
18
15
  * https://github.com/kurkle/color#readme
@@ -575,14 +572,14 @@ let Color$1 = class Color {
575
572
  }
576
573
  };
577
574
  /*!
578
- * Chart.js v4.4.0
575
+ * Chart.js v4.4.6
579
576
  * https://www.chartjs.org
580
- * (c) 2023 Chart.js Contributors
577
+ * (c) 2024 Chart.js Contributors
581
578
  * Released under the MIT License
582
579
  */
583
580
  function noop$1() {
584
581
  }
585
- const uid$1 = (() => {
582
+ const uid$1 = /* @__PURE__ */ (() => {
586
583
  let id = 0;
587
584
  return () => id++;
588
585
  })();
@@ -622,11 +619,7 @@ function each$1(loopable, fn, thisArg, reverse) {
622
619
  let i2, len, keys;
623
620
  if (isArray$1(loopable)) {
624
621
  len = loopable.length;
625
- if (reverse) {
626
- for (i2 = len - 1; i2 >= 0; i2--) {
627
- fn.call(thisArg, loopable[i2], i2);
628
- }
629
- } else {
622
+ {
630
623
  for (i2 = 0; i2 < len; i2++) {
631
624
  fn.call(thisArg, loopable[i2], i2);
632
625
  }
@@ -1535,6 +1528,9 @@ function _alignPixel$1(chart2, pixel, width) {
1535
1528
  return Math.round((pixel - halfWidth) * devicePixelRatio2) / devicePixelRatio2 + halfWidth;
1536
1529
  }
1537
1530
  function clearCanvas$1(canvas2, ctx) {
1531
+ if (!ctx && !canvas2) {
1532
+ return;
1533
+ }
1538
1534
  ctx = ctx || canvas2.getContext("2d");
1539
1535
  ctx.save();
1540
1536
  ctx.resetTransform();
@@ -1852,7 +1848,6 @@ function toFont$1(options, fallback) {
1852
1848
  return font;
1853
1849
  }
1854
1850
  function resolve$2(inputs, context, index2, info) {
1855
- let cacheable = true;
1856
1851
  let i2, ilen, value;
1857
1852
  for (i2 = 0, ilen = inputs.length; i2 < ilen; ++i2) {
1858
1853
  value = inputs[i2];
@@ -1861,16 +1856,11 @@ function resolve$2(inputs, context, index2, info) {
1861
1856
  }
1862
1857
  if (context !== void 0 && typeof value === "function") {
1863
1858
  value = value(context);
1864
- cacheable = false;
1865
1859
  }
1866
1860
  if (index2 !== void 0 && isArray$1(value)) {
1867
1861
  value = value[index2 % value.length];
1868
- cacheable = false;
1869
1862
  }
1870
1863
  if (value !== void 0) {
1871
- if (info && !cacheable) {
1872
- info.cacheable = false;
1873
- }
1874
1864
  return value;
1875
1865
  }
1876
1866
  }
@@ -2038,7 +2028,7 @@ function _descriptors$1(proxy, defaults2 = {
2038
2028
  const readKey$1 = (prefix, name) => prefix ? prefix + _capitalize$1(name) : name;
2039
2029
  const needsSubResolver$1 = (prop, value) => isObject$2(value) && prop !== "adapters" && (Object.getPrototypeOf(value) === null || value.constructor === Object);
2040
2030
  function _cached$1(target, prop, resolve2) {
2041
- if (Object.prototype.hasOwnProperty.call(target, prop)) {
2031
+ if (Object.prototype.hasOwnProperty.call(target, prop) || prop === "constructor") {
2042
2032
  return target[prop];
2043
2033
  }
2044
2034
  const value = resolve2();
@@ -2419,7 +2409,7 @@ function getRelativePosition$2(event, chart2) {
2419
2409
  function getContainerSize$1(canvas2, width, height) {
2420
2410
  let maxWidth, maxHeight;
2421
2411
  if (width === void 0 || height === void 0) {
2422
- const container = _getParentNode$1(canvas2);
2412
+ const container = canvas2 && _getParentNode$1(canvas2);
2423
2413
  if (!container) {
2424
2414
  width = canvas2.clientWidth;
2425
2415
  height = canvas2.clientHeight;
@@ -2501,8 +2491,10 @@ const supportsEventListenerOptions$1 = function() {
2501
2491
  return false;
2502
2492
  }
2503
2493
  };
2504
- window.addEventListener("test", null, options);
2505
- window.removeEventListener("test", null, options);
2494
+ if (_isDomSupported$1()) {
2495
+ window.addEventListener("test", null, options);
2496
+ window.removeEventListener("test", null, options);
2497
+ }
2506
2498
  } catch (e2) {
2507
2499
  }
2508
2500
  return passiveSupported;
@@ -2891,9 +2883,9 @@ function styleChanged$1(style, prevStyle) {
2891
2883
  return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);
2892
2884
  }
2893
2885
  /*!
2894
- * Chart.js v4.4.0
2886
+ * Chart.js v4.4.6
2895
2887
  * https://www.chartjs.org
2896
- * (c) 2023 Chart.js Contributors
2888
+ * (c) 2024 Chart.js Contributors
2897
2889
  * Released under the MIT License
2898
2890
  */
2899
2891
  let Animator$1 = class Animator {
@@ -3323,9 +3315,11 @@ function applyStack$1(stack, value, dsIndex, options = {}) {
3323
3315
  if (value === null) {
3324
3316
  return;
3325
3317
  }
3318
+ let found = false;
3326
3319
  for (i2 = 0, ilen = keys.length; i2 < ilen; ++i2) {
3327
3320
  datasetIndex = +keys[i2];
3328
3321
  if (datasetIndex === dsIndex) {
3322
+ found = true;
3329
3323
  if (options.all) {
3330
3324
  continue;
3331
3325
  }
@@ -3336,17 +3330,23 @@ function applyStack$1(stack, value, dsIndex, options = {}) {
3336
3330
  value += otherValue;
3337
3331
  }
3338
3332
  }
3333
+ if (!found && !options.all) {
3334
+ return 0;
3335
+ }
3339
3336
  return value;
3340
3337
  }
3341
- function convertObjectDataToArray$1(data) {
3338
+ function convertObjectDataToArray$1(data, meta) {
3339
+ const { iScale, vScale } = meta;
3340
+ const iAxisKey = iScale.axis === "x" ? "x" : "y";
3341
+ const vAxisKey = vScale.axis === "x" ? "x" : "y";
3342
3342
  const keys = Object.keys(data);
3343
3343
  const adata = new Array(keys.length);
3344
3344
  let i2, ilen, key;
3345
3345
  for (i2 = 0, ilen = keys.length; i2 < ilen; ++i2) {
3346
3346
  key = keys[i2];
3347
3347
  adata[i2] = {
3348
- x: key,
3349
- y: data[key]
3348
+ [iAxisKey]: key,
3349
+ [vAxisKey]: data[key]
3350
3350
  };
3351
3351
  }
3352
3352
  return adata;
@@ -3535,7 +3535,8 @@ let DatasetController$1 = (_a = class {
3535
3535
  const data = dataset.data || (dataset.data = []);
3536
3536
  const _data = this._data;
3537
3537
  if (isObject$2(data)) {
3538
- this._data = convertObjectDataToArray$1(data);
3538
+ const meta = this._cachedMeta;
3539
+ this._data = convertObjectDataToArray$1(data, meta);
3539
3540
  } else if (_data !== data) {
3540
3541
  if (_data) {
3541
3542
  unlistenArrayEvents$1(_data, this);
@@ -3572,6 +3573,7 @@ let DatasetController$1 = (_a = class {
3572
3573
  this._resyncElements(resetNewElements);
3573
3574
  if (stackChanged || oldStacked !== meta._stacked) {
3574
3575
  updateStacks$1(this, meta._parsed);
3576
+ meta._stacked = isStacked$1(meta.vScale, meta);
3575
3577
  }
3576
3578
  }
3577
3579
  configure() {
@@ -4332,8 +4334,10 @@ let BarController$1 = (_b = class extends DatasetController$1 {
4332
4334
  const metasets = iScale.getMatchingVisibleMetas(this._type).filter((meta) => meta.controller.options.grouped);
4333
4335
  const stacked = iScale.options.stacked;
4334
4336
  const stacks = [];
4337
+ const currentParsed = this._cachedMeta.controller.getParsed(dataIndex);
4338
+ const iScaleValue = currentParsed && currentParsed[iScale.axis];
4335
4339
  const skipNull = (meta) => {
4336
- const parsed = meta.controller.getParsed(dataIndex);
4340
+ const parsed = meta._parsed.find((item) => item[iScale.axis] === iScaleValue);
4337
4341
  const val = parsed && parsed[meta.vScale.axis];
4338
4342
  if (isNullOrUndef$1(val) || isNaN(val)) {
4339
4343
  return true;
@@ -4472,7 +4476,7 @@ let BarController$1 = (_b = class extends DatasetController$1 {
4472
4476
  const ilen = rects.length;
4473
4477
  let i2 = 0;
4474
4478
  for (; i2 < ilen; ++i2) {
4475
- if (this.getParsed(i2)[vScale.axis] !== null) {
4479
+ if (this.getParsed(i2)[vScale.axis] !== null && !rects[i2].hidden) {
4476
4480
  rects[i2].draw(this._ctx);
4477
4481
  }
4478
4482
  }
@@ -5223,7 +5227,7 @@ function getAxisItems$1(chart2, position, axis, intersect, useFinalPosition) {
5223
5227
  const rangeMethod = axis === "x" ? "inXRange" : "inYRange";
5224
5228
  let intersectsItem = false;
5225
5229
  evaluateInteractionItems$1(chart2, axis, position, (element, datasetIndex, index2) => {
5226
- if (element[rangeMethod](position[axis], useFinalPosition)) {
5230
+ if (element[rangeMethod] && element[rangeMethod](position[axis], useFinalPosition)) {
5227
5231
  items.push({
5228
5232
  element,
5229
5233
  datasetIndex,
@@ -5721,10 +5725,14 @@ const eventListenerOptions$1 = supportsEventListenerOptions$1 ? {
5721
5725
  passive: true
5722
5726
  } : false;
5723
5727
  function addListener$1(node, type, listener) {
5724
- node.addEventListener(type, listener, eventListenerOptions$1);
5728
+ if (node) {
5729
+ node.addEventListener(type, listener, eventListenerOptions$1);
5730
+ }
5725
5731
  }
5726
5732
  function removeListener$1(chart2, type, listener) {
5727
- chart2.canvas.removeEventListener(type, listener, eventListenerOptions$1);
5733
+ if (chart2 && chart2.canvas) {
5734
+ chart2.canvas.removeEventListener(type, listener, eventListenerOptions$1);
5735
+ }
5728
5736
  }
5729
5737
  function fromNativeEvent$1(event, chart2) {
5730
5738
  const type = EVENT_TYPES$1[event.type] || event.type;
@@ -5917,7 +5925,7 @@ let DomPlatform$1 = class DomPlatform extends BasePlatform$1 {
5917
5925
  return getMaximumSize$1(canvas2, width, height, aspectRatio);
5918
5926
  }
5919
5927
  isAttached(canvas2) {
5920
- const container = _getParentNode$1(canvas2);
5928
+ const container = canvas2 && _getParentNode$1(canvas2);
5921
5929
  return !!(container && container.isConnected);
5922
5930
  }
5923
5931
  };
@@ -6982,6 +6990,13 @@ let Scale$1 = class Scale extends Element$2 {
6982
6990
  case "right":
6983
6991
  left2 -= width;
6984
6992
  break;
6993
+ case "inner":
6994
+ if (i2 === ilen - 1) {
6995
+ left2 -= width;
6996
+ } else if (i2 > 0) {
6997
+ left2 -= width / 2;
6998
+ }
6999
+ break;
6985
7000
  }
6986
7001
  backdrop = {
6987
7002
  left: left2,
@@ -7949,7 +7964,7 @@ function getResolver$1(resolverCache, scopes, prefixes) {
7949
7964
  }
7950
7965
  return cached;
7951
7966
  }
7952
- const hasFunction$1 = (value) => isObject$2(value) && Object.getOwnPropertyNames(value).reduce((acc, key) => acc || isFunction$1(value[key]), false);
7967
+ const hasFunction$1 = (value) => isObject$2(value) && Object.getOwnPropertyNames(value).some((key) => isFunction$1(value[key]));
7953
7968
  function needContext$1(proxy, names2) {
7954
7969
  const { isScriptable, isIndexable: isIndexable2 } = _descriptors$1(proxy);
7955
7970
  for (const prop of names2) {
@@ -7962,7 +7977,7 @@ function needContext$1(proxy, names2) {
7962
7977
  }
7963
7978
  return false;
7964
7979
  }
7965
- var version$3 = "4.4.0";
7980
+ var version$3 = "4.4.6";
7966
7981
  const KNOWN_POSITIONS$1 = [
7967
7982
  "top",
7968
7983
  "bottom",
@@ -8487,8 +8502,8 @@ let Chart$2 = (_h = class {
8487
8502
  let i2;
8488
8503
  if (this._resizeBeforeDraw) {
8489
8504
  const { width, height } = this._resizeBeforeDraw;
8490
- this._resize(width, height);
8491
8505
  this._resizeBeforeDraw = null;
8506
+ this._resize(width, height);
8492
8507
  }
8493
8508
  this.clear();
8494
8509
  if (this.width <= 0 || this.height <= 0) {
@@ -9068,7 +9083,8 @@ let ArcElement$1 = (_i = class extends Element$2 {
9068
9083
  ], useFinalPosition);
9069
9084
  const rAdjust = (this.options.spacing + this.options.borderWidth) / 2;
9070
9085
  const _circumference = valueOrDefault$1(circumference, endAngle - startAngle);
9071
- const betweenAngles = _circumference >= TAU$1 || _angleBetween$1(angle, startAngle, endAngle);
9086
+ const nonZeroBetween = _angleBetween$1(angle, startAngle, endAngle) && startAngle !== endAngle;
9087
+ const betweenAngles = _circumference >= TAU$1 || nonZeroBetween;
9072
9088
  const withinRadius = _isBetween$1(distance, innerRadius + rAdjust, outerRadius + rAdjust);
9073
9089
  return betweenAngles && withinRadius;
9074
9090
  }
@@ -10941,20 +10957,26 @@ const positioners$2 = {
10941
10957
  return false;
10942
10958
  }
10943
10959
  let i2, len;
10944
- let x2 = 0;
10960
+ let xSet = /* @__PURE__ */ new Set();
10945
10961
  let y2 = 0;
10946
10962
  let count = 0;
10947
10963
  for (i2 = 0, len = items.length; i2 < len; ++i2) {
10948
10964
  const el = items[i2].element;
10949
10965
  if (el && el.hasValue()) {
10950
10966
  const pos = el.tooltipPosition();
10951
- x2 += pos.x;
10967
+ xSet.add(pos.x);
10952
10968
  y2 += pos.y;
10953
10969
  ++count;
10954
10970
  }
10955
10971
  }
10972
+ if (count === 0 || xSet.size === 0) {
10973
+ return false;
10974
+ }
10975
+ const xAverage = [
10976
+ ...xSet
10977
+ ].reduce((a2, b2) => a2 + b2) / xSet.size;
10956
10978
  return {
10957
- x: x2 / count,
10979
+ x: xAverage,
10958
10980
  y: y2 / count
10959
10981
  };
10960
10982
  },
@@ -11769,7 +11791,7 @@ let Tooltip$1 = (_m = class extends Element$2 {
11769
11791
  return [];
11770
11792
  }
11771
11793
  if (!inChartArea) {
11772
- return lastActive;
11794
+ return lastActive.filter((i2) => this.chart.data.datasets[i2.datasetIndex] && this.chart.getDatasetMeta(i2.datasetIndex).controller.getParsed(i2.index) !== void 0);
11773
11795
  }
11774
11796
  const active = this.chart.getElementsAtEventForMode(e2, options.mode, options, replay);
11775
11797
  if (options.reverse) {
@@ -13015,8 +13037,7 @@ function ChartComponent(props, ref) {
13015
13037
  const canvasRef = useRef(null);
13016
13038
  const chartRef = useRef();
13017
13039
  const renderChart = () => {
13018
- if (!canvasRef.current)
13019
- return;
13040
+ if (!canvasRef.current) return;
13020
13041
  chartRef.current = new Chart$2(canvasRef.current, {
13021
13042
  type,
13022
13043
  data: cloneData(data, datasetIdKey),
@@ -13059,8 +13080,7 @@ function ChartComponent(props, ref) {
13059
13080
  data.datasets
13060
13081
  ]);
13061
13082
  useEffect(() => {
13062
- if (!chartRef.current)
13063
- return;
13083
+ if (!chartRef.current) return;
13064
13084
  if (redraw) {
13065
13085
  destroyChart();
13066
13086
  setTimeout(renderChart);
@@ -13075,8 +13095,7 @@ function ChartComponent(props, ref) {
13075
13095
  updateMode
13076
13096
  ]);
13077
13097
  useEffect(() => {
13078
- if (!chartRef.current)
13079
- return;
13098
+ if (!chartRef.current) return;
13080
13099
  destroyChart();
13081
13100
  setTimeout(renderChart);
13082
13101
  }, [
@@ -13269,17 +13288,15 @@ var hammer = { exports: {} };
13269
13288
  var values = [];
13270
13289
  var i2 = 0;
13271
13290
  while (i2 < src.length) {
13272
- var val = key ? src[i2][key] : src[i2];
13291
+ var val = src[i2][key];
13273
13292
  if (inArray(values, val) < 0) {
13274
13293
  results.push(src[i2]);
13275
13294
  }
13276
13295
  values[i2] = val;
13277
13296
  i2++;
13278
13297
  }
13279
- if (sort) {
13280
- if (!key) {
13281
- results = results.sort();
13282
- } else {
13298
+ {
13299
+ {
13283
13300
  results = results.sort(function sortUniqueArray(a2, b2) {
13284
13301
  return a2[key] > b2[key];
13285
13302
  });
@@ -13690,7 +13707,7 @@ var hammer = { exports: {} };
13690
13707
  var all = toArray2(ev.touches);
13691
13708
  var changed = toArray2(ev.changedTouches);
13692
13709
  if (type & (INPUT_END | INPUT_CANCEL)) {
13693
- all = uniqueArray(all.concat(changed), "identifier", true);
13710
+ all = uniqueArray(all.concat(changed), "identifier");
13694
13711
  }
13695
13712
  return [all, changed];
13696
13713
  }
@@ -13754,7 +13771,7 @@ var hammer = { exports: {} };
13754
13771
  }
13755
13772
  return [
13756
13773
  // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
13757
- uniqueArray(targetTouches.concat(changedTargetTouches), "identifier", true),
13774
+ uniqueArray(targetTouches.concat(changedTargetTouches), "identifier"),
13758
13775
  changedTargetTouches
13759
13776
  ];
13760
13777
  }
@@ -14894,11 +14911,7 @@ var hammer = { exports: {} };
14894
14911
  });
14895
14912
  var freeGlobal = typeof window2 !== "undefined" ? window2 : typeof self !== "undefined" ? self : {};
14896
14913
  freeGlobal.Hammer = Hammer2;
14897
- if (typeof undefined$1 === "function" && undefined$1.amd) {
14898
- undefined$1(function() {
14899
- return Hammer2;
14900
- });
14901
- } else if (module.exports) {
14914
+ if (module.exports) {
14902
14915
  module.exports = Hammer2;
14903
14916
  } else {
14904
14917
  window2[exportName] = Hammer2;
@@ -16814,57 +16827,57 @@ var plugin = {
16814
16827
  }
16815
16828
  };
16816
16829
  /*!
16817
- * chartjs-plugin-annotation v3.0.1
16830
+ * chartjs-plugin-annotation v3.1.0
16818
16831
  * https://www.chartjs.org/chartjs-plugin-annotation/index
16819
- * (c) 2023 chartjs-plugin-annotation Contributors
16832
+ * (c) 2024 chartjs-plugin-annotation Contributors
16820
16833
  * Released under the MIT License
16821
16834
  */
16822
16835
  const interaction = {
16823
16836
  modes: {
16824
16837
  /**
16825
16838
  * Point mode returns all elements that hit test based on the event position
16826
- * @param {Object} state - the state of the plugin
16839
+ * @param {AnnotationElement[]} visibleElements - annotation elements which are visible
16827
16840
  * @param {ChartEvent} event - the event we are find things at
16828
16841
  * @return {AnnotationElement[]} - elements that are found
16829
16842
  */
16830
- point(state, event) {
16831
- return filterElements(state, event, { intersect: true });
16843
+ point(visibleElements, event) {
16844
+ return filterElements(visibleElements, event, { intersect: true });
16832
16845
  },
16833
16846
  /**
16834
16847
  * Nearest mode returns the element closest to the event position
16835
- * @param {Object} state - the state of the plugin
16848
+ * @param {AnnotationElement[]} visibleElements - annotation elements which are visible
16836
16849
  * @param {ChartEvent} event - the event we are find things at
16837
16850
  * @param {Object} options - interaction options to use
16838
16851
  * @return {AnnotationElement[]} - elements that are found (only 1 element)
16839
16852
  */
16840
- nearest(state, event, options) {
16841
- return getNearestItem(state, event, options);
16853
+ nearest(visibleElements, event, options) {
16854
+ return getNearestItem(visibleElements, event, options);
16842
16855
  },
16843
16856
  /**
16844
16857
  * x mode returns the elements that hit-test at the current x coordinate
16845
- * @param {Object} state - the state of the plugin
16858
+ * @param {AnnotationElement[]} visibleElements - annotation elements which are visible
16846
16859
  * @param {ChartEvent} event - the event we are find things at
16847
16860
  * @param {Object} options - interaction options to use
16848
16861
  * @return {AnnotationElement[]} - elements that are found
16849
16862
  */
16850
- x(state, event, options) {
16851
- return filterElements(state, event, { intersect: options.intersect, axis: "x" });
16863
+ x(visibleElements, event, options) {
16864
+ return filterElements(visibleElements, event, { intersect: options.intersect, axis: "x" });
16852
16865
  },
16853
16866
  /**
16854
16867
  * y mode returns the elements that hit-test at the current y coordinate
16855
- * @param {Object} state - the state of the plugin
16868
+ * @param {AnnotationElement[]} visibleElements - annotation elements which are visible
16856
16869
  * @param {ChartEvent} event - the event we are find things at
16857
16870
  * @param {Object} options - interaction options to use
16858
16871
  * @return {AnnotationElement[]} - elements that are found
16859
16872
  */
16860
- y(state, event, options) {
16861
- return filterElements(state, event, { intersect: options.intersect, axis: "y" });
16873
+ y(visibleElements, event, options) {
16874
+ return filterElements(visibleElements, event, { intersect: options.intersect, axis: "y" });
16862
16875
  }
16863
16876
  }
16864
16877
  };
16865
- function getElements(state, event, options) {
16878
+ function getElements(visibleElements, event, options) {
16866
16879
  const mode = interaction.modes[options.mode] || interaction.modes.nearest;
16867
- return mode(state, event, options);
16880
+ return mode(visibleElements, event, options);
16868
16881
  }
16869
16882
  function inRangeByAxis(element, event, axis) {
16870
16883
  if (axis !== "x" && axis !== "y") {
@@ -16880,12 +16893,12 @@ function getPointByAxis(event, center, axis) {
16880
16893
  }
16881
16894
  return center;
16882
16895
  }
16883
- function filterElements(state, event, options) {
16884
- return state.visibleElements.filter((element) => options.intersect ? element.inRange(event.x, event.y) : inRangeByAxis(element, event, options.axis));
16896
+ function filterElements(visibleElements, event, options) {
16897
+ return visibleElements.filter((element) => options.intersect ? element.inRange(event.x, event.y) : inRangeByAxis(element, event, options.axis));
16885
16898
  }
16886
- function getNearestItem(state, event, options) {
16899
+ function getNearestItem(visibleElements, event, options) {
16887
16900
  let minDistance = Number.POSITIVE_INFINITY;
16888
- return filterElements(state, event, options).reduce((nearestItems, element) => {
16901
+ return filterElements(visibleElements, event, options).reduce((nearestItems, element) => {
16889
16902
  const center = element.getCenterPoint();
16890
16903
  const evenPoint = getPointByAxis(event, center, options.axis);
16891
16904
  const distance = distanceBetweenPoints$1(event, evenPoint);
@@ -16898,26 +16911,36 @@ function getNearestItem(state, event, options) {
16898
16911
  return nearestItems;
16899
16912
  }, []).sort((a2, b2) => a2._index - b2._index).slice(0, 1);
16900
16913
  }
16914
+ function rotated(point, center, angle) {
16915
+ const cos = Math.cos(angle);
16916
+ const sin = Math.sin(angle);
16917
+ const cx2 = center.x;
16918
+ const cy = center.y;
16919
+ return {
16920
+ x: cx2 + cos * (point.x - cx2) - sin * (point.y - cy),
16921
+ y: cy + sin * (point.x - cx2) + cos * (point.y - cy)
16922
+ };
16923
+ }
16901
16924
  const isOlderPart = (act, req) => req > act || act.length > req.length && act.slice(0, req.length) === req;
16902
16925
  const EPSILON$1 = 1e-3;
16903
16926
  const clamp = (x2, from2, to2) => Math.min(to2, Math.max(from2, x2));
16927
+ const inLimit = (limit, hitSize) => limit.value >= limit.start - hitSize && limit.value <= limit.end + hitSize;
16904
16928
  function clampAll(obj, from2, to2) {
16905
16929
  for (const key of Object.keys(obj)) {
16906
16930
  obj[key] = clamp(obj[key], from2, to2);
16907
16931
  }
16908
16932
  return obj;
16909
16933
  }
16910
- function inPointRange(point, center, radius, borderWidth) {
16934
+ function inPointRange(point, center, radius, hitSize) {
16911
16935
  if (!point || !center || radius <= 0) {
16912
16936
  return false;
16913
16937
  }
16914
- const hBorderWidth = borderWidth / 2;
16915
- return Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2) <= Math.pow(radius + hBorderWidth, 2);
16938
+ return Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2) <= Math.pow(radius + hitSize, 2);
16916
16939
  }
16917
- function inBoxRange(point, { x: x2, y: y2, x2: x22, y2: y22 }, axis, borderWidth) {
16918
- const hBorderWidth = borderWidth / 2;
16919
- const inRangeX = point.x >= x2 - hBorderWidth - EPSILON$1 && point.x <= x22 + hBorderWidth + EPSILON$1;
16920
- const inRangeY = point.y >= y2 - hBorderWidth - EPSILON$1 && point.y <= y22 + hBorderWidth + EPSILON$1;
16940
+ function inBoxRange(point, { x: x2, y: y2, x2: x22, y2: y22 }, axis, { borderWidth, hitTolerance }) {
16941
+ const hitSize = (borderWidth + hitTolerance) / 2;
16942
+ const inRangeX = point.x >= x2 - hitSize - EPSILON$1 && point.x <= x22 + hitSize + EPSILON$1;
16943
+ const inRangeY = point.y >= y2 - hitSize - EPSILON$1 && point.y <= y22 + hitSize + EPSILON$1;
16921
16944
  if (axis === "x") {
16922
16945
  return inRangeX;
16923
16946
  } else if (axis === "y") {
@@ -16925,6 +16948,10 @@ function inBoxRange(point, { x: x2, y: y2, x2: x22, y2: y22 }, axis, borderWidth
16925
16948
  }
16926
16949
  return inRangeX && inRangeY;
16927
16950
  }
16951
+ function inLabelRange(point, { rect, center }, axis, { rotation, borderWidth, hitTolerance }) {
16952
+ const rotPoint = rotated(point, center, toRadians$1(-rotation));
16953
+ return inBoxRange(rotPoint, rect, axis, { borderWidth, hitTolerance });
16954
+ }
16928
16955
  function getElementCenterPoint(element, useFinalPosition) {
16929
16956
  const { centerX, centerY } = element.getProps(["centerX", "centerY"], useFinalPosition);
16930
16957
  return { x: centerX, y: centerY };
@@ -16953,6 +16980,7 @@ const toPositivePercent = (s2) => clamp(toPercent(s2), 0, 1);
16953
16980
  const boxAppering = (x2, y2) => ({ x: x2, y: y2, x2, y2, width: 0, height: 0 });
16954
16981
  const defaultInitAnimation = {
16955
16982
  box: (properties) => boxAppering(properties.centerX, properties.centerY),
16983
+ doughnutLabel: (properties) => boxAppering(properties.centerX, properties.centerY),
16956
16984
  ellipse: (properties) => ({ centerX: properties.centerX, centerY: properties.centerX, radius: 0, width: 0, height: 0 }),
16957
16985
  label: (properties) => boxAppering(properties.centerX, properties.centerY),
16958
16986
  line: (properties) => boxAppering(properties.x, properties.y),
@@ -16989,6 +17017,24 @@ function calculateTextAlignment(size, options) {
16989
17017
  }
16990
17018
  return x2;
16991
17019
  }
17020
+ function measureLabelRectangle(point, labelSize, { borderWidth, position, xAdjust, yAdjust }, padding) {
17021
+ const hasPadding = isObject$2(padding);
17022
+ const width = labelSize.width + (hasPadding ? padding.width : 0) + borderWidth;
17023
+ const height = labelSize.height + (hasPadding ? padding.height : 0) + borderWidth;
17024
+ const positionObj = toPosition(position);
17025
+ const x2 = calculateLabelPosition$1(point.x, width, xAdjust, positionObj.x);
17026
+ const y2 = calculateLabelPosition$1(point.y, height, yAdjust, positionObj.y);
17027
+ return {
17028
+ x: x2,
17029
+ y: y2,
17030
+ x2: x2 + width,
17031
+ y2: y2 + height,
17032
+ width,
17033
+ height,
17034
+ centerX: x2 + width / 2,
17035
+ centerY: y2 + height / 2
17036
+ };
17037
+ }
16992
17038
  function toPosition(value, defaultValue = "center") {
16993
17039
  if (isObject$2(value)) {
16994
17040
  return {
@@ -17002,9 +17048,26 @@ function toPosition(value, defaultValue = "center") {
17002
17048
  y: value
17003
17049
  };
17004
17050
  }
17051
+ const shouldFit = (options, fitRatio) => options && options.autoFit && fitRatio < 1;
17052
+ function toFonts(options, fitRatio) {
17053
+ const optFont = options.font;
17054
+ const fonts = isArray$1(optFont) ? optFont : [optFont];
17055
+ if (shouldFit(options, fitRatio)) {
17056
+ return fonts.map(function(f2) {
17057
+ const font = toFont$1(f2);
17058
+ font.size = Math.floor(f2.size * fitRatio);
17059
+ font.lineHeight = f2.lineHeight;
17060
+ return toFont$1(font);
17061
+ });
17062
+ }
17063
+ return fonts.map((f2) => toFont$1(f2));
17064
+ }
17005
17065
  function isBoundToPoint(options) {
17006
17066
  return options && (defined$1(options.xValue) || defined$1(options.yValue));
17007
17067
  }
17068
+ function calculateLabelPosition$1(start, size, adjust = 0, position) {
17069
+ return start - getRelativePosition$1(size, position) + adjust;
17070
+ }
17008
17071
  function initAnimationProperties(chart2, properties, options) {
17009
17072
  const initAnim = options.init;
17010
17073
  if (!initAnim) {
@@ -17059,10 +17122,10 @@ function translate(ctx, { x: x2, y: y2 }, rotation) {
17059
17122
  }
17060
17123
  function setBorderStyle(ctx, options) {
17061
17124
  if (options && options.borderWidth) {
17062
- ctx.lineCap = options.borderCapStyle;
17125
+ ctx.lineCap = options.borderCapStyle || "butt";
17063
17126
  ctx.setLineDash(options.borderDash);
17064
17127
  ctx.lineDashOffset = options.borderDashOffset;
17065
- ctx.lineJoin = options.borderJoinStyle;
17128
+ ctx.lineJoin = options.borderJoinStyle || "miter";
17066
17129
  ctx.lineWidth = options.borderWidth;
17067
17130
  ctx.strokeStyle = options.borderColor;
17068
17131
  return true;
@@ -17077,13 +17140,13 @@ function setShadowStyle(ctx, options) {
17077
17140
  function measureLabelSize$1(ctx, options) {
17078
17141
  const content = options.content;
17079
17142
  if (isImageOrCanvas(content)) {
17080
- return {
17143
+ const size = {
17081
17144
  width: getSize(content.width, options.width),
17082
17145
  height: getSize(content.height, options.height)
17083
17146
  };
17147
+ return size;
17084
17148
  }
17085
- const optFont = options.font;
17086
- const fonts = isArray$1(optFont) ? optFont.map((f2) => toFont$1(f2)) : [toFont$1(optFont)];
17149
+ const fonts = toFonts(options);
17087
17150
  const strokeWidth = options.textStrokeWidth;
17088
17151
  const lines = isArray$1(content) ? content : [content];
17089
17152
  const mapKey = lines.join() + fontsKey(fonts) + strokeWidth + (ctx._measureText ? "-spriting" : "");
@@ -17114,7 +17177,7 @@ function drawBox(ctx, rect, options) {
17114
17177
  }
17115
17178
  ctx.restore();
17116
17179
  }
17117
- function drawLabel(ctx, rect, options) {
17180
+ function drawLabel(ctx, rect, options, fitRatio) {
17118
17181
  const content = options.content;
17119
17182
  if (isImageOrCanvas(content)) {
17120
17183
  ctx.save();
@@ -17124,8 +17187,7 @@ function drawLabel(ctx, rect, options) {
17124
17187
  return;
17125
17188
  }
17126
17189
  const labels = isArray$1(content) ? content : [content];
17127
- const optFont = options.font;
17128
- const fonts = isArray$1(optFont) ? optFont.map((f2) => toFont$1(f2)) : [toFont$1(optFont)];
17190
+ const fonts = toFonts(options, fitRatio);
17129
17191
  const optColor = options.color;
17130
17192
  const colors2 = isArray$1(optColor) ? optColor : [optColor];
17131
17193
  const x2 = calculateTextAlignment(rect, options);
@@ -17292,6 +17354,118 @@ function getOpacity(value, elementValue) {
17292
17354
  const opacity = isNumber$1(value) ? value : elementValue;
17293
17355
  return isNumber$1(opacity) ? clamp(opacity, 0, 1) : 1;
17294
17356
  }
17357
+ const positions$1 = ["left", "bottom", "top", "right"];
17358
+ function drawCallout(ctx, element) {
17359
+ const { pointX, pointY, options } = element;
17360
+ const callout = options.callout;
17361
+ const calloutPosition = callout && callout.display && resolveCalloutPosition(element, callout);
17362
+ if (!calloutPosition || isPointInRange(element, callout, calloutPosition)) {
17363
+ return;
17364
+ }
17365
+ ctx.save();
17366
+ ctx.beginPath();
17367
+ const stroke = setBorderStyle(ctx, callout);
17368
+ if (!stroke) {
17369
+ return ctx.restore();
17370
+ }
17371
+ const { separatorStart, separatorEnd } = getCalloutSeparatorCoord(element, calloutPosition);
17372
+ const { sideStart, sideEnd } = getCalloutSideCoord(element, calloutPosition, separatorStart);
17373
+ if (callout.margin > 0 || options.borderWidth === 0) {
17374
+ ctx.moveTo(separatorStart.x, separatorStart.y);
17375
+ ctx.lineTo(separatorEnd.x, separatorEnd.y);
17376
+ }
17377
+ ctx.moveTo(sideStart.x, sideStart.y);
17378
+ ctx.lineTo(sideEnd.x, sideEnd.y);
17379
+ const rotatedPoint = rotated({ x: pointX, y: pointY }, element.getCenterPoint(), toRadians$1(-element.rotation));
17380
+ ctx.lineTo(rotatedPoint.x, rotatedPoint.y);
17381
+ ctx.stroke();
17382
+ ctx.restore();
17383
+ }
17384
+ function getCalloutSeparatorCoord(element, position) {
17385
+ const { x: x2, y: y2, x2: x22, y2: y22 } = element;
17386
+ const adjust = getCalloutSeparatorAdjust(element, position);
17387
+ let separatorStart, separatorEnd;
17388
+ if (position === "left" || position === "right") {
17389
+ separatorStart = { x: x2 + adjust, y: y2 };
17390
+ separatorEnd = { x: separatorStart.x, y: y22 };
17391
+ } else {
17392
+ separatorStart = { x: x2, y: y2 + adjust };
17393
+ separatorEnd = { x: x22, y: separatorStart.y };
17394
+ }
17395
+ return { separatorStart, separatorEnd };
17396
+ }
17397
+ function getCalloutSeparatorAdjust(element, position) {
17398
+ const { width, height, options } = element;
17399
+ const adjust = options.callout.margin + options.borderWidth / 2;
17400
+ if (position === "right") {
17401
+ return width + adjust;
17402
+ } else if (position === "bottom") {
17403
+ return height + adjust;
17404
+ }
17405
+ return -adjust;
17406
+ }
17407
+ function getCalloutSideCoord(element, position, separatorStart) {
17408
+ const { y: y2, width, height, options } = element;
17409
+ const start = options.callout.start;
17410
+ const side = getCalloutSideAdjust(position, options.callout);
17411
+ let sideStart, sideEnd;
17412
+ if (position === "left" || position === "right") {
17413
+ sideStart = { x: separatorStart.x, y: y2 + getSize(height, start) };
17414
+ sideEnd = { x: sideStart.x + side, y: sideStart.y };
17415
+ } else {
17416
+ sideStart = { x: separatorStart.x + getSize(width, start), y: separatorStart.y };
17417
+ sideEnd = { x: sideStart.x, y: sideStart.y + side };
17418
+ }
17419
+ return { sideStart, sideEnd };
17420
+ }
17421
+ function getCalloutSideAdjust(position, options) {
17422
+ const side = options.side;
17423
+ if (position === "left" || position === "top") {
17424
+ return -side;
17425
+ }
17426
+ return side;
17427
+ }
17428
+ function resolveCalloutPosition(element, options) {
17429
+ const position = options.position;
17430
+ if (positions$1.includes(position)) {
17431
+ return position;
17432
+ }
17433
+ return resolveCalloutAutoPosition(element, options);
17434
+ }
17435
+ function resolveCalloutAutoPosition(element, options) {
17436
+ const { x: x2, y: y2, x2: x22, y2: y22, width, height, pointX, pointY, centerX, centerY, rotation } = element;
17437
+ const center = { x: centerX, y: centerY };
17438
+ const start = options.start;
17439
+ const xAdjust = getSize(width, start);
17440
+ const yAdjust = getSize(height, start);
17441
+ const xPoints = [x2, x2 + xAdjust, x2 + xAdjust, x22];
17442
+ const yPoints = [y2 + yAdjust, y22, y2, y22];
17443
+ const result = [];
17444
+ for (let index2 = 0; index2 < 4; index2++) {
17445
+ const rotatedPoint = rotated({ x: xPoints[index2], y: yPoints[index2] }, center, toRadians$1(rotation));
17446
+ result.push({
17447
+ position: positions$1[index2],
17448
+ distance: distanceBetweenPoints$1(rotatedPoint, { x: pointX, y: pointY })
17449
+ });
17450
+ }
17451
+ return result.sort((a2, b2) => a2.distance - b2.distance)[0].position;
17452
+ }
17453
+ function isPointInRange(element, callout, position) {
17454
+ const { pointX, pointY } = element;
17455
+ const margin = callout.margin;
17456
+ let x2 = pointX;
17457
+ let y2 = pointY;
17458
+ if (position === "left") {
17459
+ x2 += margin;
17460
+ } else if (position === "right") {
17461
+ x2 -= margin;
17462
+ } else if (position === "top") {
17463
+ y2 += margin;
17464
+ } else if (position === "bottom") {
17465
+ y2 -= margin;
17466
+ }
17467
+ return element.inRange(x2, y2);
17468
+ }
17295
17469
  const limitedLineScale = {
17296
17470
  xScaleID: { min: "xMin", max: "xMax", start: "left", end: "right", startProp: "x", endProp: "x2" },
17297
17471
  yScaleID: { min: "yMin", max: "yMax", start: "bottom", end: "top", startProp: "y", endProp: "y2" }
@@ -17456,7 +17630,7 @@ function resolveLimitedLineProperties(scales, area, options) {
17456
17630
  }
17457
17631
  function calculateX({ properties, options }, labelSize, position, padding) {
17458
17632
  const { x: start, x2: end, width: size } = properties;
17459
- return calculatePosition$1({ start, end, size, borderWidth: options.borderWidth }, {
17633
+ return calculatePosition({ start, end, size, borderWidth: options.borderWidth }, {
17460
17634
  position: position.x,
17461
17635
  padding: { start: padding.left, end: padding.right },
17462
17636
  adjust: options.label.xAdjust,
@@ -17465,14 +17639,14 @@ function calculateX({ properties, options }, labelSize, position, padding) {
17465
17639
  }
17466
17640
  function calculateY({ properties, options }, labelSize, position, padding) {
17467
17641
  const { y: start, y2: end, height: size } = properties;
17468
- return calculatePosition$1({ start, end, size, borderWidth: options.borderWidth }, {
17642
+ return calculatePosition({ start, end, size, borderWidth: options.borderWidth }, {
17469
17643
  position: position.y,
17470
17644
  padding: { start: padding.top, end: padding.bottom },
17471
17645
  adjust: options.label.yAdjust,
17472
17646
  size: labelSize.height
17473
17647
  });
17474
17648
  }
17475
- function calculatePosition$1(boxOpts, labelOpts) {
17649
+ function calculatePosition(boxOpts, labelOpts) {
17476
17650
  const { start, end, borderWidth } = boxOpts;
17477
17651
  const { position, padding: { start: padStart, end: padEnd }, adjust } = labelOpts;
17478
17652
  const availableSize = end - borderWidth - start - padStart - padEnd - labelOpts.size;
@@ -17501,22 +17675,11 @@ function resolveLabelElementProperties$1(chart2, properties, options) {
17501
17675
  rotation: label.rotation
17502
17676
  };
17503
17677
  }
17504
- function rotated(point, center, angle) {
17505
- const cos = Math.cos(angle);
17506
- const sin = Math.sin(angle);
17507
- const cx2 = center.x;
17508
- const cy = center.y;
17509
- return {
17510
- x: cx2 + cos * (point.x - cx2) - sin * (point.y - cy),
17511
- y: cy + sin * (point.x - cx2) + cos * (point.y - cy)
17512
- };
17513
- }
17514
17678
  const moveHooks = ["enter", "leave"];
17515
17679
  const eventHooks = moveHooks.concat("click");
17516
17680
  function updateListeners(chart2, state, options) {
17517
17681
  state.listened = loadHooks(options, eventHooks, state.listeners);
17518
17682
  state.moveListened = false;
17519
- state._getElements = getElements;
17520
17683
  moveHooks.forEach((hook) => {
17521
17684
  if (isFunction$1(options[hook])) {
17522
17685
  state.moveListened = true;
@@ -17555,7 +17718,7 @@ function handleMoveEvents(state, event, options) {
17555
17718
  }
17556
17719
  let elements;
17557
17720
  if (event.type === "mousemove") {
17558
- elements = getElements(state, event, options.interaction);
17721
+ elements = getElements(state.visibleElements, event, options.interaction);
17559
17722
  } else {
17560
17723
  elements = [];
17561
17724
  }
@@ -17576,7 +17739,7 @@ function dispatchMoveEvents({ state, event }, hook, elements, checkElements) {
17576
17739
  }
17577
17740
  function handleClickEvents(state, event, options) {
17578
17741
  const listeners = state.listeners;
17579
- const elements = getElements(state, event, options.interaction);
17742
+ const elements = getElements(state.visibleElements, event, options.interaction);
17580
17743
  let changed;
17581
17744
  for (const element of elements) {
17582
17745
  changed = dispatchEvent(element.options.click || listeners.click, element, event) || changed;
@@ -17681,7 +17844,7 @@ function updateLimits$1(annotation2, scale, props, limits) {
17681
17844
  class BoxAnnotation extends Element$2 {
17682
17845
  inRange(mouseX, mouseY, axis, useFinalPosition) {
17683
17846
  const { x: x2, y: y2 } = rotated({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), toRadians$1(-this.options.rotation));
17684
- return inBoxRange({ x: x2, y: y2 }, this.getProps(["x", "y", "x2", "y2"], useFinalPosition), axis, this.options.borderWidth);
17847
+ return inBoxRange({ x: x2, y: y2 }, this.getProps(["x", "y", "x2", "y2"], useFinalPosition), axis, this.options);
17685
17848
  }
17686
17849
  getCenterPoint(useFinalPosition) {
17687
17850
  return getElementCenterPoint(this, useFinalPosition);
@@ -17712,6 +17875,7 @@ BoxAnnotation.defaults = {
17712
17875
  borderWidth: 1,
17713
17876
  display: true,
17714
17877
  init: void 0,
17878
+ hitTolerance: 0,
17715
17879
  label: {
17716
17880
  backgroundColor: "transparent",
17717
17881
  borderWidth: 0,
@@ -17730,6 +17894,7 @@ BoxAnnotation.defaults = {
17730
17894
  weight: "bold"
17731
17895
  },
17732
17896
  height: void 0,
17897
+ hitTolerance: void 0,
17733
17898
  opacity: void 0,
17734
17899
  padding: 6,
17735
17900
  position: "center",
@@ -17763,11 +17928,188 @@ BoxAnnotation.descriptors = {
17763
17928
  _fallback: true
17764
17929
  }
17765
17930
  };
17766
- const positions$1 = ["left", "bottom", "top", "right"];
17931
+ class DoughnutLabelAnnotation extends Element$2 {
17932
+ inRange(mouseX, mouseY, axis, useFinalPosition) {
17933
+ return inLabelRange(
17934
+ { x: mouseX, y: mouseY },
17935
+ { rect: this.getProps(["x", "y", "x2", "y2"], useFinalPosition), center: this.getCenterPoint(useFinalPosition) },
17936
+ axis,
17937
+ { rotation: this.rotation, borderWidth: 0, hitTolerance: this.options.hitTolerance }
17938
+ );
17939
+ }
17940
+ getCenterPoint(useFinalPosition) {
17941
+ return getElementCenterPoint(this, useFinalPosition);
17942
+ }
17943
+ draw(ctx) {
17944
+ const options = this.options;
17945
+ if (!options.display || !options.content) {
17946
+ return;
17947
+ }
17948
+ drawBackground(ctx, this);
17949
+ ctx.save();
17950
+ translate(ctx, this.getCenterPoint(), this.rotation);
17951
+ drawLabel(ctx, this, options, this._fitRatio);
17952
+ ctx.restore();
17953
+ }
17954
+ resolveElementProperties(chart2, options) {
17955
+ const meta = getDatasetMeta(chart2, options);
17956
+ if (!meta) {
17957
+ return {};
17958
+ }
17959
+ const { controllerMeta, point, radius } = getControllerMeta(chart2, options, meta);
17960
+ let labelSize = measureLabelSize$1(chart2.ctx, options);
17961
+ const _fitRatio = getFitRatio(labelSize, radius);
17962
+ if (shouldFit(options, _fitRatio)) {
17963
+ labelSize = { width: labelSize.width * _fitRatio, height: labelSize.height * _fitRatio };
17964
+ }
17965
+ const { position, xAdjust, yAdjust } = options;
17966
+ const boxSize = measureLabelRectangle(point, labelSize, { borderWidth: 0, position, xAdjust, yAdjust });
17967
+ return {
17968
+ initProperties: initAnimationProperties(chart2, boxSize, options),
17969
+ ...boxSize,
17970
+ ...controllerMeta,
17971
+ rotation: options.rotation,
17972
+ _fitRatio
17973
+ };
17974
+ }
17975
+ }
17976
+ DoughnutLabelAnnotation.id = "doughnutLabelAnnotation";
17977
+ DoughnutLabelAnnotation.defaults = {
17978
+ autoFit: true,
17979
+ autoHide: true,
17980
+ backgroundColor: "transparent",
17981
+ backgroundShadowColor: "transparent",
17982
+ borderColor: "transparent",
17983
+ borderDash: [],
17984
+ borderDashOffset: 0,
17985
+ borderJoinStyle: "miter",
17986
+ borderShadowColor: "transparent",
17987
+ borderWidth: 0,
17988
+ color: "black",
17989
+ content: null,
17990
+ display: true,
17991
+ font: {
17992
+ family: void 0,
17993
+ lineHeight: void 0,
17994
+ size: void 0,
17995
+ style: void 0,
17996
+ weight: void 0
17997
+ },
17998
+ height: void 0,
17999
+ hitTolerance: 0,
18000
+ init: void 0,
18001
+ opacity: void 0,
18002
+ position: "center",
18003
+ rotation: 0,
18004
+ shadowBlur: 0,
18005
+ shadowOffsetX: 0,
18006
+ shadowOffsetY: 0,
18007
+ spacing: 1,
18008
+ textAlign: "center",
18009
+ textStrokeColor: void 0,
18010
+ textStrokeWidth: 0,
18011
+ width: void 0,
18012
+ xAdjust: 0,
18013
+ yAdjust: 0
18014
+ };
18015
+ DoughnutLabelAnnotation.defaultRoutes = {};
18016
+ function getDatasetMeta(chart2, options) {
18017
+ return chart2.getSortedVisibleDatasetMetas().reduce(function(result, value) {
18018
+ const controller = value.controller;
18019
+ if (controller instanceof DoughnutController$1 && isControllerVisible(chart2, options, value.data) && (!result || controller.innerRadius < result.controller.innerRadius) && controller.options.circumference >= 90) {
18020
+ return value;
18021
+ }
18022
+ return result;
18023
+ }, void 0);
18024
+ }
18025
+ function isControllerVisible(chart2, options, elements) {
18026
+ if (!options.autoHide) {
18027
+ return true;
18028
+ }
18029
+ for (let i2 = 0; i2 < elements.length; i2++) {
18030
+ if (!elements[i2].hidden && chart2.getDataVisibility(i2)) {
18031
+ return true;
18032
+ }
18033
+ }
18034
+ }
18035
+ function getControllerMeta({ chartArea }, options, meta) {
18036
+ const { left: left2, top: top2, right: right2, bottom: bottom2 } = chartArea;
18037
+ const { innerRadius, offsetX, offsetY } = meta.controller;
18038
+ const x2 = (left2 + right2) / 2 + offsetX;
18039
+ const y2 = (top2 + bottom2) / 2 + offsetY;
18040
+ const square = {
18041
+ left: Math.max(x2 - innerRadius, left2),
18042
+ right: Math.min(x2 + innerRadius, right2),
18043
+ top: Math.max(y2 - innerRadius, top2),
18044
+ bottom: Math.min(y2 + innerRadius, bottom2)
18045
+ };
18046
+ const point = {
18047
+ x: (square.left + square.right) / 2,
18048
+ y: (square.top + square.bottom) / 2
18049
+ };
18050
+ const space = options.spacing + options.borderWidth / 2;
18051
+ const _radius = innerRadius - space;
18052
+ const _counterclockwise = point.y > y2;
18053
+ const side = _counterclockwise ? top2 + space : bottom2 - space;
18054
+ const angles = getAngles(side, x2, y2, _radius);
18055
+ const controllerMeta = {
18056
+ _centerX: x2,
18057
+ _centerY: y2,
18058
+ _radius,
18059
+ _counterclockwise,
18060
+ ...angles
18061
+ };
18062
+ return {
18063
+ controllerMeta,
18064
+ point,
18065
+ radius: Math.min(innerRadius, Math.min(square.right - square.left, square.bottom - square.top) / 2)
18066
+ };
18067
+ }
18068
+ function getFitRatio({ width, height }, radius) {
18069
+ const hypo = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
18070
+ return radius * 2 / hypo;
18071
+ }
18072
+ function getAngles(y2, centerX, centerY, radius) {
18073
+ const yk2 = Math.pow(centerY - y2, 2);
18074
+ const r2 = Math.pow(radius, 2);
18075
+ const b2 = centerX * -2;
18076
+ const c2 = Math.pow(centerX, 2) + yk2 - r2;
18077
+ const delta = Math.pow(b2, 2) - 4 * c2;
18078
+ if (delta <= 0) {
18079
+ return {
18080
+ _startAngle: 0,
18081
+ _endAngle: TAU$1
18082
+ };
18083
+ }
18084
+ const start = (-b2 - Math.sqrt(delta)) / 2;
18085
+ const end = (-b2 + Math.sqrt(delta)) / 2;
18086
+ return {
18087
+ _startAngle: getAngleFromPoint$1({ x: centerX, y: centerY }, { x: start, y: y2 }).angle,
18088
+ _endAngle: getAngleFromPoint$1({ x: centerX, y: centerY }, { x: end, y: y2 }).angle
18089
+ };
18090
+ }
18091
+ function drawBackground(ctx, element) {
18092
+ const { _centerX, _centerY, _radius, _startAngle, _endAngle, _counterclockwise, options } = element;
18093
+ ctx.save();
18094
+ const stroke = setBorderStyle(ctx, options);
18095
+ ctx.fillStyle = options.backgroundColor;
18096
+ ctx.beginPath();
18097
+ ctx.arc(_centerX, _centerY, _radius, _startAngle, _endAngle, _counterclockwise);
18098
+ ctx.closePath();
18099
+ ctx.fill();
18100
+ if (stroke) {
18101
+ ctx.stroke();
18102
+ }
18103
+ ctx.restore();
18104
+ }
17767
18105
  class LabelAnnotation extends Element$2 {
17768
18106
  inRange(mouseX, mouseY, axis, useFinalPosition) {
17769
- const { x: x2, y: y2 } = rotated({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), toRadians$1(-this.rotation));
17770
- return inBoxRange({ x: x2, y: y2 }, this.getProps(["x", "y", "x2", "y2"], useFinalPosition), axis, this.options.borderWidth);
18107
+ return inLabelRange(
18108
+ { x: mouseX, y: mouseY },
18109
+ { rect: this.getProps(["x", "y", "x2", "y2"], useFinalPosition), center: this.getCenterPoint(useFinalPosition) },
18110
+ axis,
18111
+ { rotation: this.rotation, borderWidth: this.options.borderWidth, hitTolerance: this.options.hitTolerance }
18112
+ );
17771
18113
  }
17772
18114
  getCenterPoint(useFinalPosition) {
17773
18115
  return getElementCenterPoint(this, useFinalPosition);
@@ -17795,7 +18137,7 @@ class LabelAnnotation extends Element$2 {
17795
18137
  }
17796
18138
  const padding = toPadding$1(options.padding);
17797
18139
  const labelSize = measureLabelSize$1(chart2.ctx, options);
17798
- const boxSize = measureRect(point, labelSize, options, padding);
18140
+ const boxSize = measureLabelRectangle(point, labelSize, options, padding);
17799
18141
  return {
17800
18142
  initProperties: initAnimationProperties(chart2, boxSize, options),
17801
18143
  pointX: point.x,
@@ -17841,6 +18183,7 @@ LabelAnnotation.defaults = {
17841
18183
  weight: void 0
17842
18184
  },
17843
18185
  height: void 0,
18186
+ hitTolerance: 0,
17844
18187
  init: void 0,
17845
18188
  opacity: void 0,
17846
18189
  padding: 6,
@@ -17868,121 +18211,6 @@ LabelAnnotation.defaults = {
17868
18211
  LabelAnnotation.defaultRoutes = {
17869
18212
  borderColor: "color"
17870
18213
  };
17871
- function measureRect(point, size, options, padding) {
17872
- const width = size.width + padding.width + options.borderWidth;
17873
- const height = size.height + padding.height + options.borderWidth;
17874
- const position = toPosition(options.position, "center");
17875
- const x2 = calculatePosition(point.x, width, options.xAdjust, position.x);
17876
- const y2 = calculatePosition(point.y, height, options.yAdjust, position.y);
17877
- return {
17878
- x: x2,
17879
- y: y2,
17880
- x2: x2 + width,
17881
- y2: y2 + height,
17882
- width,
17883
- height,
17884
- centerX: x2 + width / 2,
17885
- centerY: y2 + height / 2
17886
- };
17887
- }
17888
- function calculatePosition(start, size, adjust = 0, position) {
17889
- return start - getRelativePosition$1(size, position) + adjust;
17890
- }
17891
- function drawCallout(ctx, element) {
17892
- const { pointX, pointY, options } = element;
17893
- const callout = options.callout;
17894
- const calloutPosition = callout && callout.display && resolveCalloutPosition(element, callout);
17895
- if (!calloutPosition || isPointInRange(element, callout, calloutPosition)) {
17896
- return;
17897
- }
17898
- ctx.save();
17899
- ctx.beginPath();
17900
- const stroke = setBorderStyle(ctx, callout);
17901
- if (!stroke) {
17902
- return ctx.restore();
17903
- }
17904
- const { separatorStart, separatorEnd } = getCalloutSeparatorCoord(element, calloutPosition);
17905
- const { sideStart, sideEnd } = getCalloutSideCoord(element, calloutPosition, separatorStart);
17906
- if (callout.margin > 0 || options.borderWidth === 0) {
17907
- ctx.moveTo(separatorStart.x, separatorStart.y);
17908
- ctx.lineTo(separatorEnd.x, separatorEnd.y);
17909
- }
17910
- ctx.moveTo(sideStart.x, sideStart.y);
17911
- ctx.lineTo(sideEnd.x, sideEnd.y);
17912
- const rotatedPoint = rotated({ x: pointX, y: pointY }, element.getCenterPoint(), toRadians$1(-element.rotation));
17913
- ctx.lineTo(rotatedPoint.x, rotatedPoint.y);
17914
- ctx.stroke();
17915
- ctx.restore();
17916
- }
17917
- function getCalloutSeparatorCoord(element, position) {
17918
- const { x: x2, y: y2, x2: x22, y2: y22 } = element;
17919
- const adjust = getCalloutSeparatorAdjust(element, position);
17920
- let separatorStart, separatorEnd;
17921
- if (position === "left" || position === "right") {
17922
- separatorStart = { x: x2 + adjust, y: y2 };
17923
- separatorEnd = { x: separatorStart.x, y: y22 };
17924
- } else {
17925
- separatorStart = { x: x2, y: y2 + adjust };
17926
- separatorEnd = { x: x22, y: separatorStart.y };
17927
- }
17928
- return { separatorStart, separatorEnd };
17929
- }
17930
- function getCalloutSeparatorAdjust(element, position) {
17931
- const { width, height, options } = element;
17932
- const adjust = options.callout.margin + options.borderWidth / 2;
17933
- if (position === "right") {
17934
- return width + adjust;
17935
- } else if (position === "bottom") {
17936
- return height + adjust;
17937
- }
17938
- return -adjust;
17939
- }
17940
- function getCalloutSideCoord(element, position, separatorStart) {
17941
- const { y: y2, width, height, options } = element;
17942
- const start = options.callout.start;
17943
- const side = getCalloutSideAdjust(position, options.callout);
17944
- let sideStart, sideEnd;
17945
- if (position === "left" || position === "right") {
17946
- sideStart = { x: separatorStart.x, y: y2 + getSize(height, start) };
17947
- sideEnd = { x: sideStart.x + side, y: sideStart.y };
17948
- } else {
17949
- sideStart = { x: separatorStart.x + getSize(width, start), y: separatorStart.y };
17950
- sideEnd = { x: sideStart.x, y: sideStart.y + side };
17951
- }
17952
- return { sideStart, sideEnd };
17953
- }
17954
- function getCalloutSideAdjust(position, options) {
17955
- const side = options.side;
17956
- if (position === "left" || position === "top") {
17957
- return -side;
17958
- }
17959
- return side;
17960
- }
17961
- function resolveCalloutPosition(element, options) {
17962
- const position = options.position;
17963
- if (positions$1.includes(position)) {
17964
- return position;
17965
- }
17966
- return resolveCalloutAutoPosition(element, options);
17967
- }
17968
- function resolveCalloutAutoPosition(element, options) {
17969
- const { x: x2, y: y2, x2: x22, y2: y22, width, height, pointX, pointY, centerX, centerY, rotation } = element;
17970
- const center = { x: centerX, y: centerY };
17971
- const start = options.start;
17972
- const xAdjust = getSize(width, start);
17973
- const yAdjust = getSize(height, start);
17974
- const xPoints = [x2, x2 + xAdjust, x2 + xAdjust, x22];
17975
- const yPoints = [y2 + yAdjust, y22, y2, y22];
17976
- const result = [];
17977
- for (let index2 = 0; index2 < 4; index2++) {
17978
- const rotatedPoint = rotated({ x: xPoints[index2], y: yPoints[index2] }, center, toRadians$1(rotation));
17979
- result.push({
17980
- position: positions$1[index2],
17981
- distance: distanceBetweenPoints$1(rotatedPoint, { x: pointX, y: pointY })
17982
- });
17983
- }
17984
- return result.sort((a2, b2) => a2.distance - b2.distance)[0].position;
17985
- }
17986
18214
  function getLabelSize({ x: x2, y: y2, width, height, options }) {
17987
18215
  const hBorderWidth = options.borderWidth / 2;
17988
18216
  const padding = toPadding$1(options.padding);
@@ -17993,22 +18221,6 @@ function getLabelSize({ x: x2, y: y2, width, height, options }) {
17993
18221
  height: height - padding.top - padding.bottom - options.borderWidth
17994
18222
  };
17995
18223
  }
17996
- function isPointInRange(element, callout, position) {
17997
- const { pointX, pointY } = element;
17998
- const margin = callout.margin;
17999
- let x2 = pointX;
18000
- let y2 = pointY;
18001
- if (position === "left") {
18002
- x2 += margin;
18003
- } else if (position === "right") {
18004
- x2 -= margin;
18005
- } else if (position === "top") {
18006
- y2 += margin;
18007
- } else if (position === "bottom") {
18008
- y2 -= margin;
18009
- }
18010
- return element.inRange(x2, y2);
18011
- }
18012
18224
  const pointInLine = (p1, p2, t) => ({ x: p1.x + t * (p2.x - p1.x), y: p1.y + t * (p2.y - p1.y) });
18013
18225
  const interpolateX = (y2, p1, p2) => pointInLine(p1, p2, Math.abs((y2 - p1.y) / (p2.y - p1.y))).x;
18014
18226
  const interpolateY = (x2, p1, p2) => pointInLine(p1, p2, Math.abs((x2 - p1.x) / (p2.x - p1.x))).y;
@@ -18020,12 +18232,13 @@ const coordAngleInCurve = (start, cp, end, t) => 2 * (1 - t) * (cp - start) + 2
18020
18232
  const angleInCurve = (start, cp, end, t) => -Math.atan2(coordAngleInCurve(start.x, cp.x, end.x, t), coordAngleInCurve(start.y, cp.y, end.y, t)) + 0.5 * PI$1;
18021
18233
  class LineAnnotation extends Element$2 {
18022
18234
  inRange(mouseX, mouseY, axis, useFinalPosition) {
18023
- const hBorderWidth = this.options.borderWidth / 2;
18235
+ const hitSize = (this.options.borderWidth + this.options.hitTolerance) / 2;
18024
18236
  if (axis !== "x" && axis !== "y") {
18025
18237
  const point = { mouseX, mouseY };
18026
18238
  const { path, ctx } = this;
18027
18239
  if (path) {
18028
18240
  setBorderStyle(ctx, this.options);
18241
+ ctx.lineWidth += this.options.hitTolerance;
18029
18242
  const { chart: chart2 } = this.$context;
18030
18243
  const mx = mouseX * chart2.currentDevicePixelRatio;
18031
18244
  const my = mouseY * chart2.currentDevicePixelRatio;
@@ -18033,10 +18246,10 @@ class LineAnnotation extends Element$2 {
18033
18246
  ctx.restore();
18034
18247
  return result;
18035
18248
  }
18036
- const epsilon = sqr(hBorderWidth);
18249
+ const epsilon = sqr(hitSize);
18037
18250
  return intersects(this, point, epsilon, useFinalPosition) || isOnLabel(this, point, useFinalPosition);
18038
18251
  }
18039
- return inAxisRange(this, { mouseX, mouseY }, axis, { hBorderWidth, useFinalPosition });
18252
+ return inAxisRange(this, { mouseX, mouseY }, axis, { hitSize, useFinalPosition });
18040
18253
  }
18041
18254
  getCenterPoint(useFinalPosition) {
18042
18255
  return getElementCenterPoint(this, useFinalPosition);
@@ -18131,6 +18344,7 @@ LineAnnotation.defaults = {
18131
18344
  display: true,
18132
18345
  endValue: void 0,
18133
18346
  init: void 0,
18347
+ hitTolerance: 0,
18134
18348
  label: {
18135
18349
  backgroundColor: "rgba(0,0,0,0.8)",
18136
18350
  backgroundShadowColor: "transparent",
@@ -18155,6 +18369,7 @@ LineAnnotation.defaults = {
18155
18369
  weight: "bold"
18156
18370
  },
18157
18371
  height: void 0,
18372
+ hitTolerance: void 0,
18158
18373
  opacity: void 0,
18159
18374
  padding: 6,
18160
18375
  position: "center",
@@ -18197,9 +18412,9 @@ LineAnnotation.descriptors = {
18197
18412
  LineAnnotation.defaultRoutes = {
18198
18413
  borderColor: "color"
18199
18414
  };
18200
- function inAxisRange(element, { mouseX, mouseY }, axis, { hBorderWidth, useFinalPosition }) {
18415
+ function inAxisRange(element, { mouseX, mouseY }, axis, { hitSize, useFinalPosition }) {
18201
18416
  const limit = rangeLimit(mouseX, mouseY, element.getProps(["x", "y", "x2", "y2"], useFinalPosition), axis);
18202
- return limit.value >= limit.start - hBorderWidth && limit.value <= limit.end + hBorderWidth || isOnLabel(element, { mouseX, mouseY }, useFinalPosition, axis);
18417
+ return inLimit(limit, hitSize) || isOnLabel(element, { mouseX, mouseY }, useFinalPosition, axis);
18203
18418
  }
18204
18419
  function isLineInArea({ x: x2, y: y2, x2: x22, y2: y22 }, { top: top2, right: right2, bottom: bottom2, left: left2 }) {
18205
18420
  return !(x2 < left2 && x22 < left2 || x2 > right2 && x22 > right2 || y2 < top2 && y22 < top2 || y2 > bottom2 && y22 > bottom2);
@@ -18432,15 +18647,14 @@ function drawCurve(ctx, element, cp, length) {
18432
18647
  class EllipseAnnotation extends Element$2 {
18433
18648
  inRange(mouseX, mouseY, axis, useFinalPosition) {
18434
18649
  const rotation = this.options.rotation;
18435
- const borderWidth = this.options.borderWidth;
18650
+ const hitSize = (this.options.borderWidth + this.options.hitTolerance) / 2;
18436
18651
  if (axis !== "x" && axis !== "y") {
18437
- return pointInEllipse({ x: mouseX, y: mouseY }, this.getProps(["width", "height", "centerX", "centerY"], useFinalPosition), rotation, borderWidth);
18652
+ return pointInEllipse({ x: mouseX, y: mouseY }, this.getProps(["width", "height", "centerX", "centerY"], useFinalPosition), rotation, hitSize);
18438
18653
  }
18439
18654
  const { x: x2, y: y2, x2: x22, y2: y22 } = this.getProps(["x", "y", "x2", "y2"], useFinalPosition);
18440
- const hBorderWidth = borderWidth / 2;
18441
18655
  const limit = axis === "y" ? { start: y2, end: y22 } : { start: x2, end: x22 };
18442
18656
  const rotatedPoint = rotated({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), toRadians$1(-rotation));
18443
- return rotatedPoint[axis] >= limit.start - hBorderWidth - EPSILON$1 && rotatedPoint[axis] <= limit.end + hBorderWidth + EPSILON$1;
18657
+ return rotatedPoint[axis] >= limit.start - hitSize - EPSILON$1 && rotatedPoint[axis] <= limit.end + hitSize + EPSILON$1;
18444
18658
  }
18445
18659
  getCenterPoint(useFinalPosition) {
18446
18660
  return getElementCenterPoint(this, useFinalPosition);
@@ -18477,6 +18691,7 @@ EllipseAnnotation.defaults = {
18477
18691
  borderShadowColor: "transparent",
18478
18692
  borderWidth: 1,
18479
18693
  display: true,
18694
+ hitTolerance: 0,
18480
18695
  init: void 0,
18481
18696
  label: Object.assign({}, BoxAnnotation.defaults.label),
18482
18697
  rotation: 0,
@@ -18500,7 +18715,7 @@ EllipseAnnotation.descriptors = {
18500
18715
  _fallback: true
18501
18716
  }
18502
18717
  };
18503
- function pointInEllipse(p2, ellipse, rotation, borderWidth) {
18718
+ function pointInEllipse(p2, ellipse, rotation, hitSize) {
18504
18719
  const { width, height, centerX, centerY } = ellipse;
18505
18720
  const xRadius = width / 2;
18506
18721
  const yRadius = height / 2;
@@ -18508,23 +18723,21 @@ function pointInEllipse(p2, ellipse, rotation, borderWidth) {
18508
18723
  return false;
18509
18724
  }
18510
18725
  const angle = toRadians$1(rotation || 0);
18511
- const hBorderWidth = borderWidth / 2 || 0;
18512
18726
  const cosAngle = Math.cos(angle);
18513
18727
  const sinAngle = Math.sin(angle);
18514
18728
  const a2 = Math.pow(cosAngle * (p2.x - centerX) + sinAngle * (p2.y - centerY), 2);
18515
18729
  const b2 = Math.pow(sinAngle * (p2.x - centerX) - cosAngle * (p2.y - centerY), 2);
18516
- return a2 / Math.pow(xRadius + hBorderWidth, 2) + b2 / Math.pow(yRadius + hBorderWidth, 2) <= 1.0001;
18730
+ return a2 / Math.pow(xRadius + hitSize, 2) + b2 / Math.pow(yRadius + hitSize, 2) <= 1.0001;
18517
18731
  }
18518
18732
  class PointAnnotation extends Element$2 {
18519
18733
  inRange(mouseX, mouseY, axis, useFinalPosition) {
18520
18734
  const { x: x2, y: y2, x2: x22, y2: y22, width } = this.getProps(["x", "y", "x2", "y2", "width"], useFinalPosition);
18521
- const borderWidth = this.options.borderWidth;
18735
+ const hitSize = (this.options.borderWidth + this.options.hitTolerance) / 2;
18522
18736
  if (axis !== "x" && axis !== "y") {
18523
- return inPointRange({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), width / 2, borderWidth);
18737
+ return inPointRange({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), width / 2, hitSize);
18524
18738
  }
18525
- const hBorderWidth = borderWidth / 2;
18526
18739
  const limit = axis === "y" ? { start: y2, end: y22, value: mouseY } : { start: x2, end: x22, value: mouseX };
18527
- return limit.value >= limit.start - hBorderWidth && limit.value <= limit.end + hBorderWidth;
18740
+ return inLimit(limit, hitSize);
18528
18741
  }
18529
18742
  getCenterPoint(useFinalPosition) {
18530
18743
  return getElementCenterPoint(this, useFinalPosition);
@@ -18562,6 +18775,7 @@ PointAnnotation.defaults = {
18562
18775
  borderShadowColor: "transparent",
18563
18776
  borderWidth: 1,
18564
18777
  display: true,
18778
+ hitTolerance: 0,
18565
18779
  init: void 0,
18566
18780
  pointStyle: "circle",
18567
18781
  radius: 10,
@@ -18649,6 +18863,7 @@ PolygonAnnotation.defaults = {
18649
18863
  borderShadowColor: "transparent",
18650
18864
  borderWidth: 1,
18651
18865
  display: true,
18866
+ hitTolerance: 0,
18652
18867
  init: void 0,
18653
18868
  point: {
18654
18869
  radius: 0
@@ -18675,8 +18890,8 @@ PolygonAnnotation.defaultRoutes = {
18675
18890
  borderColor: "color",
18676
18891
  backgroundColor: "color"
18677
18892
  };
18678
- function buildPointElement({ centerX, centerY }, { radius, borderWidth }, rad) {
18679
- const halfBorder = borderWidth / 2;
18893
+ function buildPointElement({ centerX, centerY }, { radius, borderWidth, hitTolerance }, rad) {
18894
+ const hitSize = (borderWidth + hitTolerance) / 2;
18680
18895
  const sin = Math.sin(rad);
18681
18896
  const cos = Math.cos(rad);
18682
18897
  const point = { x: centerX + sin * radius, y: centerY - cos * radius };
@@ -18688,8 +18903,8 @@ function buildPointElement({ centerX, centerY }, { radius, borderWidth }, rad) {
18688
18903
  y: point.y,
18689
18904
  centerX: point.x,
18690
18905
  centerY: point.y,
18691
- bX: centerX + sin * (radius + halfBorder),
18692
- bY: centerY - cos * (radius + halfBorder)
18906
+ bX: centerX + sin * (radius + hitSize),
18907
+ bY: centerY - cos * (radius + hitSize)
18693
18908
  }
18694
18909
  };
18695
18910
  }
@@ -18707,6 +18922,7 @@ function pointIsInPolygon(points, x2, y2, useFinalPosition) {
18707
18922
  }
18708
18923
  const annotationTypes = {
18709
18924
  box: BoxAnnotation,
18925
+ doughnutLabel: DoughnutLabelAnnotation,
18710
18926
  ellipse: EllipseAnnotation,
18711
18927
  label: LabelAnnotation,
18712
18928
  line: LineAnnotation,
@@ -18738,7 +18954,7 @@ function updateElements(chart2, state, options, mode) {
18738
18954
  for (let i2 = 0; i2 < annotations.length; i2++) {
18739
18955
  const annotationOptions = annotations[i2];
18740
18956
  const element = getOrCreateElement(elements, i2, annotationOptions.type);
18741
- const resolver = annotationOptions.setContext(getContext(chart2, element, annotationOptions));
18957
+ const resolver = annotationOptions.setContext(getContext(chart2, element, elements, annotationOptions));
18742
18958
  const properties = element.resolveElementProperties(chart2, resolver);
18743
18959
  properties.skip = toSkip(properties);
18744
18960
  if ("elements" in properties) {
@@ -18812,9 +19028,12 @@ function resolveObj(resolver, defs) {
18812
19028
  }
18813
19029
  return result;
18814
19030
  }
18815
- function getContext(chart2, element, annotation2) {
19031
+ function getContext(chart2, element, elements, annotation2) {
18816
19032
  return element.$context || (element.$context = Object.assign(Object.create(chart2.getContext()), {
18817
19033
  element,
19034
+ get elements() {
19035
+ return elements.filter((el) => el && el.options);
19036
+ },
18818
19037
  id: annotation2.id,
18819
19038
  type: "annotation"
18820
19039
  }));
@@ -18830,8 +19049,9 @@ function resyncElements(elements, annotations) {
18830
19049
  }
18831
19050
  return elements;
18832
19051
  }
18833
- var version$1 = "3.0.1";
19052
+ var version$1 = "3.1.0";
18834
19053
  const chartStates = /* @__PURE__ */ new Map();
19054
+ const isNotDoughnutLabel = (annotation2) => annotation2.type !== "doughnutLabel";
18835
19055
  const hooks = eventHooks.concat(elementHooks);
18836
19056
  var annotation = {
18837
19057
  id: "annotation",
@@ -18873,11 +19093,11 @@ var annotation = {
18873
19093
  } else if (isArray$1(annotationOptions)) {
18874
19094
  annotations.push(...annotationOptions);
18875
19095
  }
18876
- verifyScaleOptions(annotations, chart2.scales);
19096
+ verifyScaleOptions(annotations.filter(isNotDoughnutLabel), chart2.scales);
18877
19097
  },
18878
19098
  afterDataLimits(chart2, args) {
18879
19099
  const state = chartStates.get(chart2);
18880
- adjustScaleRange(chart2, args.scale, state.annotations.filter((a2) => a2.display && a2.adjustScaleRange));
19100
+ adjustScaleRange(chart2, args.scale, state.annotations.filter(isNotDoughnutLabel).filter((a2) => a2.display && a2.adjustScaleRange));
18881
19101
  },
18882
19102
  afterUpdate(chart2, args, options) {
18883
19103
  const state = chartStates.get(chart2);
@@ -18892,6 +19112,9 @@ var annotation = {
18892
19112
  afterDatasetsDraw(chart2, _args, options) {
18893
19113
  draw$1(chart2, "afterDatasetsDraw", options.clip);
18894
19114
  },
19115
+ beforeDatasetDraw(chart2, _args, options) {
19116
+ draw$1(chart2, _args.index, options.clip);
19117
+ },
18895
19118
  beforeDraw(chart2, _args, options) {
18896
19119
  draw$1(chart2, "beforeDraw", options.clip);
18897
19120
  },
@@ -18907,14 +19130,23 @@ var annotation = {
18907
19130
  afterDestroy(chart2) {
18908
19131
  chartStates.delete(chart2);
18909
19132
  },
18910
- _getState(chart2) {
18911
- return chartStates.get(chart2);
19133
+ getAnnotations(chart2) {
19134
+ const state = chartStates.get(chart2);
19135
+ return state ? state.elements : [];
19136
+ },
19137
+ // only for testing
19138
+ _getAnnotationElementsAtEventForMode(visibleElements, event, options) {
19139
+ return getElements(visibleElements, event, options);
18912
19140
  },
18913
19141
  defaults: {
18914
19142
  animations: {
18915
19143
  numbers: {
18916
19144
  properties: ["x", "y", "x2", "y2", "width", "height", "centerX", "centerY", "pointX", "pointY", "radius"],
18917
19145
  type: "number"
19146
+ },
19147
+ colors: {
19148
+ properties: ["backgroundColor", "borderColor"],
19149
+ type: "color"
18918
19150
  }
18919
19151
  },
18920
19152
  clip: true,
@@ -19009,8 +19241,7 @@ var ActionTypes = {
19009
19241
  }
19010
19242
  };
19011
19243
  function isPlainObject(obj) {
19012
- if (typeof obj !== "object" || obj === null)
19013
- return false;
19244
+ if (typeof obj !== "object" || obj === null) return false;
19014
19245
  var proto = obj;
19015
19246
  while (Object.getPrototypeOf(proto) !== null) {
19016
19247
  proto = Object.getPrototypeOf(proto);
@@ -19018,10 +19249,8 @@ function isPlainObject(obj) {
19018
19249
  return Object.getPrototypeOf(obj) === proto;
19019
19250
  }
19020
19251
  function miniKindOf(val) {
19021
- if (val === void 0)
19022
- return "undefined";
19023
- if (val === null)
19024
- return "null";
19252
+ if (val === void 0) return "undefined";
19253
+ if (val === null) return "null";
19025
19254
  var type = typeof val;
19026
19255
  switch (type) {
19027
19256
  case "boolean":
@@ -19032,12 +19261,9 @@ function miniKindOf(val) {
19032
19261
  return type;
19033
19262
  }
19034
19263
  }
19035
- if (Array.isArray(val))
19036
- return "array";
19037
- if (isDate(val))
19038
- return "date";
19039
- if (isError(val))
19040
- return "error";
19264
+ if (Array.isArray(val)) return "array";
19265
+ if (isDate(val)) return "date";
19266
+ if (isError(val)) return "error";
19041
19267
  var constructorName = ctorName(val);
19042
19268
  switch (constructorName) {
19043
19269
  case "Symbol":
@@ -19057,8 +19283,7 @@ function isError(val) {
19057
19283
  return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
19058
19284
  }
19059
19285
  function isDate(val) {
19060
- if (val instanceof Date)
19061
- return true;
19286
+ if (val instanceof Date) return true;
19062
19287
  return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
19063
19288
  }
19064
19289
  function kindOf(val) {
@@ -20352,33 +20577,28 @@ function makeStoreInstance(debugMode) {
20352
20577
  }));
20353
20578
  }
20354
20579
  function _objectWithoutProperties(source, excluded) {
20355
- if (source == null)
20356
- return {};
20580
+ if (source == null) return {};
20357
20581
  var target = _objectWithoutPropertiesLoose(source, excluded);
20358
20582
  var key, i2;
20359
20583
  if (Object.getOwnPropertySymbols) {
20360
20584
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
20361
20585
  for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
20362
20586
  key = sourceSymbolKeys[i2];
20363
- if (excluded.indexOf(key) >= 0)
20364
- continue;
20365
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
20366
- continue;
20587
+ if (excluded.indexOf(key) >= 0) continue;
20588
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
20367
20589
  target[key] = source[key];
20368
20590
  }
20369
20591
  }
20370
20592
  return target;
20371
20593
  }
20372
20594
  function _objectWithoutPropertiesLoose(source, excluded) {
20373
- if (source == null)
20374
- return {};
20595
+ if (source == null) return {};
20375
20596
  var target = {};
20376
20597
  var sourceKeys = Object.keys(source);
20377
20598
  var key, i2;
20378
20599
  for (i2 = 0; i2 < sourceKeys.length; i2++) {
20379
20600
  key = sourceKeys[i2];
20380
- if (excluded.indexOf(key) >= 0)
20381
- continue;
20601
+ if (excluded.indexOf(key) >= 0) continue;
20382
20602
  target[key] = source[key];
20383
20603
  }
20384
20604
  return target;
@@ -20437,45 +20657,35 @@ function getGlobalContext() {
20437
20657
  return typeof global !== "undefined" ? global : window;
20438
20658
  }
20439
20659
  var fastDeepEqual = function equal(a2, b2) {
20440
- if (a2 === b2)
20441
- return true;
20660
+ if (a2 === b2) return true;
20442
20661
  if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
20443
- if (a2.constructor !== b2.constructor)
20444
- return false;
20662
+ if (a2.constructor !== b2.constructor) return false;
20445
20663
  var length, i2, keys;
20446
20664
  if (Array.isArray(a2)) {
20447
20665
  length = a2.length;
20448
- if (length != b2.length)
20449
- return false;
20666
+ if (length != b2.length) return false;
20450
20667
  for (i2 = length; i2-- !== 0; )
20451
- if (!equal(a2[i2], b2[i2]))
20452
- return false;
20668
+ if (!equal(a2[i2], b2[i2])) return false;
20453
20669
  return true;
20454
20670
  }
20455
- if (a2.constructor === RegExp)
20456
- return a2.source === b2.source && a2.flags === b2.flags;
20457
- if (a2.valueOf !== Object.prototype.valueOf)
20458
- return a2.valueOf() === b2.valueOf();
20459
- if (a2.toString !== Object.prototype.toString)
20460
- return a2.toString() === b2.toString();
20671
+ if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
20672
+ if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
20673
+ if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
20461
20674
  keys = Object.keys(a2);
20462
20675
  length = keys.length;
20463
- if (length !== Object.keys(b2).length)
20464
- return false;
20676
+ if (length !== Object.keys(b2).length) return false;
20465
20677
  for (i2 = length; i2-- !== 0; )
20466
- if (!Object.prototype.hasOwnProperty.call(b2, keys[i2]))
20467
- return false;
20678
+ if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
20468
20679
  for (i2 = length; i2-- !== 0; ) {
20469
20680
  var key = keys[i2];
20470
- if (!equal(a2[key], b2[key]))
20471
- return false;
20681
+ if (!equal(a2[key], b2[key])) return false;
20472
20682
  }
20473
20683
  return true;
20474
20684
  }
20475
20685
  return a2 !== a2 && b2 !== b2;
20476
20686
  };
20477
20687
  const isEqual = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqual);
20478
- const useIsomorphicLayoutEffect$2 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
20688
+ const useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
20479
20689
  function useCollector(monitor, collect, onUpdate) {
20480
20690
  const [collected, setCollected] = useState(
20481
20691
  () => collect(monitor)
@@ -20493,7 +20703,7 @@ function useCollector(monitor, collect, onUpdate) {
20493
20703
  monitor,
20494
20704
  onUpdate
20495
20705
  ]);
20496
- useIsomorphicLayoutEffect$2(updateCollected);
20706
+ useIsomorphicLayoutEffect$1(updateCollected);
20497
20707
  return [
20498
20708
  collected,
20499
20709
  updateCollected
@@ -20501,7 +20711,7 @@ function useCollector(monitor, collect, onUpdate) {
20501
20711
  }
20502
20712
  function useMonitorOutput(monitor, collect, onCollect) {
20503
20713
  const [collected, updateCollected] = useCollector(monitor, collect, onCollect);
20504
- useIsomorphicLayoutEffect$2(function subscribeToMonitorStateChange() {
20714
+ useIsomorphicLayoutEffect$1(function subscribeToMonitorStateChange() {
20505
20715
  const handlerId = monitor.getHandlerId();
20506
20716
  if (handlerId == null) {
20507
20717
  return;
@@ -20526,9 +20736,9 @@ function useCollectedProps(collector, monitor, connector) {
20526
20736
  }
20527
20737
  function useOptionalFactory(arg, deps) {
20528
20738
  const memoDeps = [
20529
- ...deps || []
20739
+ ...[]
20530
20740
  ];
20531
- if (deps == null && typeof arg !== "function") {
20741
+ if (typeof arg !== "function") {
20532
20742
  memoDeps.push(arg);
20533
20743
  }
20534
20744
  return useMemo(() => {
@@ -20718,7 +20928,7 @@ function registerSource(type, source, manager) {
20718
20928
  ];
20719
20929
  }
20720
20930
  function shallowEqual(objA, objB, compare, compareContext) {
20721
- let compareResult = compare ? compare.call(compareContext, objA, objB) : void 0;
20931
+ let compareResult = void 0;
20722
20932
  if (compareResult !== void 0) {
20723
20933
  return !!compareResult;
20724
20934
  }
@@ -20741,7 +20951,7 @@ function shallowEqual(objA, objB, compare, compareContext) {
20741
20951
  }
20742
20952
  const valueA = objA[key];
20743
20953
  const valueB = objB[key];
20744
- compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
20954
+ compareResult = void 0;
20745
20955
  if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
20746
20956
  return false;
20747
20957
  }
@@ -21051,7 +21261,7 @@ function useDragSourceConnector(dragSourceOptions, dragPreviewOptions) {
21051
21261
  manager
21052
21262
  ]
21053
21263
  );
21054
- useIsomorphicLayoutEffect$2(() => {
21264
+ useIsomorphicLayoutEffect$1(() => {
21055
21265
  connector.dragSourceOptions = dragSourceOptions || null;
21056
21266
  connector.reconnect();
21057
21267
  return () => connector.disconnectDragSource();
@@ -21059,7 +21269,7 @@ function useDragSourceConnector(dragSourceOptions, dragPreviewOptions) {
21059
21269
  connector,
21060
21270
  dragSourceOptions
21061
21271
  ]);
21062
- useIsomorphicLayoutEffect$2(() => {
21272
+ useIsomorphicLayoutEffect$1(() => {
21063
21273
  connector.dragPreviewOptions = dragPreviewOptions || null;
21064
21274
  connector.reconnect();
21065
21275
  return () => connector.disconnectDragPreview();
@@ -21153,7 +21363,7 @@ function useRegisteredDragSource(spec, monitor, connector) {
21153
21363
  const manager = useDragDropManager();
21154
21364
  const handler = useDragSource(spec, monitor, connector);
21155
21365
  const itemType = useDragType(spec);
21156
- useIsomorphicLayoutEffect$2(function registerDragSource() {
21366
+ useIsomorphicLayoutEffect$1(function registerDragSource() {
21157
21367
  if (itemType != null) {
21158
21368
  const [handlerId, unregister] = registerSource(itemType, handler, manager);
21159
21369
  monitor.receiveHandlerId(handlerId);
@@ -21170,7 +21380,7 @@ function useRegisteredDragSource(spec, monitor, connector) {
21170
21380
  ]);
21171
21381
  }
21172
21382
  function useDrag(specArg, deps) {
21173
- const spec = useOptionalFactory(specArg, deps);
21383
+ const spec = useOptionalFactory(specArg);
21174
21384
  invariant(!spec.begin, `useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);
21175
21385
  const monitor = useDragSourceMonitor();
21176
21386
  const connector = useDragSourceConnector(spec.options, spec.previewOptions);
@@ -21197,7 +21407,7 @@ function useDropTargetConnector(options) {
21197
21407
  manager
21198
21408
  ]
21199
21409
  );
21200
- useIsomorphicLayoutEffect$2(() => {
21410
+ useIsomorphicLayoutEffect$1(() => {
21201
21411
  connector.dropTargetOptions = options || null;
21202
21412
  connector.reconnect();
21203
21413
  return () => connector.disconnectDropTarget();
@@ -21270,7 +21480,7 @@ function useRegisteredDropTarget(spec, monitor, connector) {
21270
21480
  const manager = useDragDropManager();
21271
21481
  const dropTarget = useDropTarget(spec, monitor);
21272
21482
  const accept = useAccept(spec);
21273
- useIsomorphicLayoutEffect$2(function registerDropTarget() {
21483
+ useIsomorphicLayoutEffect$1(function registerDropTarget() {
21274
21484
  const [handlerId, unregister] = registerTarget(accept, dropTarget, manager);
21275
21485
  monitor.receiveHandlerId(handlerId);
21276
21486
  connector.receiveHandlerId(handlerId);
@@ -21286,7 +21496,7 @@ function useRegisteredDropTarget(spec, monitor, connector) {
21286
21496
  ]);
21287
21497
  }
21288
21498
  function useDrop(specArg, deps) {
21289
- const spec = useOptionalFactory(specArg, deps);
21499
+ const spec = useOptionalFactory(specArg);
21290
21500
  const monitor = useDropTargetMonitor();
21291
21501
  const connector = useDropTargetConnector(spec.options);
21292
21502
  useRegisteredDropTarget(spec, monitor, connector);
@@ -22367,6 +22577,9 @@ var AnnotationType$1 = /* @__PURE__ */ ((AnnotationType2) => {
22367
22577
  })(AnnotationType$1 || {});
22368
22578
  var PointStyle = /* @__PURE__ */ ((PointStyle2) => {
22369
22579
  PointStyle2["Circle"] = "circle";
22580
+ PointStyle2["Square"] = "rect";
22581
+ PointStyle2["Diamond"] = "rectRot";
22582
+ PointStyle2["Triangle"] = "triangle";
22370
22583
  return PointStyle2;
22371
22584
  })(PointStyle || {});
22372
22585
  var ChartHoverMode = /* @__PURE__ */ ((ChartHoverMode2) => {
@@ -22397,8 +22610,7 @@ const MINOR_TICKS_PER_MAJOR = 10;
22397
22610
  const getLargestMajorTickWidth = (majorTickPositions) => {
22398
22611
  return majorTickPositions.reduce(
22399
22612
  (acc, curr, index2) => {
22400
- if (index2 === 0)
22401
- return acc;
22613
+ if (index2 === 0) return acc;
22402
22614
  const gap = Math.abs(curr - majorTickPositions[index2 - 1]);
22403
22615
  return Math.max(gap, acc);
22404
22616
  },
@@ -22434,10 +22646,8 @@ const drawMinorTicksForScale = (scale) => {
22434
22646
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
22435
22647
  const { chart: chart2, ctx } = scale;
22436
22648
  const config2 = chart2.config;
22437
- if (!((_d2 = (_c2 = (_b2 = (_a2 = config2 == null ? void 0 : config2.options) == null ? void 0 : _a2.scales) == null ? void 0 : _b2[scale.id]) == null ? void 0 : _c2.grid) == null ? void 0 : _d2.drawOnChartArea))
22438
- return;
22439
- if (config2.options.indexAxis === scale.axis)
22440
- return;
22649
+ if (!((_d2 = (_c2 = (_b2 = (_a2 = config2 == null ? void 0 : config2.options) == null ? void 0 : _a2.scales) == null ? void 0 : _b2[scale.id]) == null ? void 0 : _c2.grid) == null ? void 0 : _d2.drawOnChartArea)) return;
22650
+ if (config2.options.indexAxis === scale.axis) return;
22441
22651
  const isHorizontal = scale.axis === "x";
22442
22652
  const majorTickPositions = scale.ticks.map((_2, index2) => scale.getPixelForTick(index2)).sort((a2, b2) => a2 - b2);
22443
22653
  const minorTickPositions = getMinorTickPositions(majorTickPositions, scale);
@@ -22678,13 +22888,11 @@ const generateKey = (values) => {
22678
22888
  };
22679
22889
  const isPrimitiveValue = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null;
22680
22890
  const isRangeValid = (r2) => {
22681
- if (!r2)
22682
- return false;
22891
+ if (!r2) return false;
22683
22892
  return Object.values(r2).some((value) => !isNilOrEmpty(value));
22684
22893
  };
22685
22894
  const getChartStateFromStorage = (persistenceId) => {
22686
- if (!persistenceId)
22687
- return null;
22895
+ if (!persistenceId) return null;
22688
22896
  const chartStateKey = `line-chart-state-${persistenceId}`;
22689
22897
  const chartStateObjectJSON = localStorage.getItem(chartStateKey);
22690
22898
  if (chartStateObjectJSON) {
@@ -22714,8 +22922,7 @@ const removeExpiredChartStates = (maxAgeInHours = 72) => {
22714
22922
  }
22715
22923
  };
22716
22924
  const storeChartStateInStorage = (state, persistenceId) => {
22717
- if (!persistenceId)
22718
- return;
22925
+ if (!persistenceId) return;
22719
22926
  const currentTime = (/* @__PURE__ */ new Date()).getTime();
22720
22927
  const chartStateKey = `line-chart-state-${persistenceId}`;
22721
22928
  const chartStateObject = {
@@ -22808,7 +23015,6 @@ var noop = function() {
22808
23015
  };
22809
23016
  var isBrowser = typeof window !== "undefined";
22810
23017
  var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
22811
- const useIsomorphicLayoutEffect$1 = useIsomorphicLayoutEffect;
22812
23018
  var defaultState = {
22813
23019
  x: 0,
22814
23020
  y: 0,
@@ -22830,7 +23036,7 @@ function useMeasure() {
22830
23036
  }
22831
23037
  });
22832
23038
  }, []);
22833
- useIsomorphicLayoutEffect$1(function() {
23039
+ useIsomorphicLayoutEffect(function() {
22834
23040
  if (!element)
22835
23041
  return;
22836
23042
  observer.observe(element);
@@ -22860,10 +23066,8 @@ function getLineOptions({
22860
23066
  icon: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgLineAndPoint, {}) }),
22861
23067
  selected: pointsEnabled && lineEnabled,
22862
23068
  onClick: () => {
22863
- if (!pointsEnabled)
22864
- onTogglePoints();
22865
- if (!lineEnabled)
22866
- onToggleLine();
23069
+ if (!pointsEnabled) onTogglePoints();
23070
+ if (!lineEnabled) onToggleLine();
22867
23071
  }
22868
23072
  },
22869
23073
  {
@@ -22872,10 +23076,8 @@ function getLineOptions({
22872
23076
  icon: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgLineOnly, {}) }),
22873
23077
  selected: !pointsEnabled && lineEnabled,
22874
23078
  onClick: () => {
22875
- if (pointsEnabled)
22876
- onTogglePoints();
22877
- if (!lineEnabled)
22878
- onToggleLine();
23079
+ if (pointsEnabled) onTogglePoints();
23080
+ if (!lineEnabled) onToggleLine();
22879
23081
  }
22880
23082
  },
22881
23083
  {
@@ -22884,28 +23086,13 @@ function getLineOptions({
22884
23086
  icon: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgPointOnly, {}) }),
22885
23087
  selected: pointsEnabled && !lineEnabled,
22886
23088
  onClick: () => {
22887
- if (!pointsEnabled)
22888
- onTogglePoints();
22889
- if (lineEnabled)
22890
- onToggleLine();
23089
+ if (!pointsEnabled) onTogglePoints();
23090
+ if (lineEnabled) onToggleLine();
22891
23091
  }
22892
23092
  }
22893
23093
  ];
22894
23094
  }
22895
- const LineOptions = ({
22896
- lineEnabled,
22897
- onToggleLine,
22898
- onTogglePoints,
22899
- pointsEnabled,
22900
- translations
22901
- }) => {
22902
- const options = getLineOptions({
22903
- lineEnabled,
22904
- onToggleLine,
22905
- onTogglePoints,
22906
- pointsEnabled,
22907
- translations
22908
- });
23095
+ const LineOptions = ({ options }) => {
22909
23096
  const [menuOpen, setMenuOpen] = useState(false);
22910
23097
  const selectedOption = options.find((option) => option.selected);
22911
23098
  return /* @__PURE__ */ jsx(
@@ -22947,28 +23134,22 @@ var DefaultContext = {
22947
23134
  attr: void 0
22948
23135
  };
22949
23136
  var IconContext = React__default.createContext && React__default.createContext(DefaultContext);
22950
- var __assign = globalThis && globalThis.__assign || function() {
23137
+ var __assign = function() {
22951
23138
  __assign = Object.assign || function(t) {
22952
23139
  for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
22953
23140
  s2 = arguments[i2];
22954
- for (var p2 in s2)
22955
- if (Object.prototype.hasOwnProperty.call(s2, p2))
22956
- t[p2] = s2[p2];
23141
+ for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t[p2] = s2[p2];
22957
23142
  }
22958
23143
  return t;
22959
23144
  };
22960
23145
  return __assign.apply(this, arguments);
22961
23146
  };
22962
- var __rest = globalThis && globalThis.__rest || function(s2, e2) {
23147
+ var __rest = function(s2, e2) {
22963
23148
  var t = {};
22964
- for (var p2 in s2)
22965
- if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
22966
- t[p2] = s2[p2];
22967
- if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
22968
- for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
22969
- if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
22970
- t[p2[i2]] = s2[p2[i2]];
22971
- }
23149
+ for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t[p2] = s2[p2];
23150
+ if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
23151
+ if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2])) t[p2[i2]] = s2[p2[i2]];
23152
+ }
22972
23153
  return t;
22973
23154
  };
22974
23155
  function Tree2Element(tree) {
@@ -22990,10 +23171,8 @@ function IconBase(props) {
22990
23171
  var attr = props.attr, size = props.size, title = props.title, svgProps = __rest(props, ["attr", "size", "title"]);
22991
23172
  var computedSize = size || conf.size || "1em";
22992
23173
  var className;
22993
- if (conf.className)
22994
- className = conf.className;
22995
- if (props.className)
22996
- className = (className ? className + " " : "") + props.className;
23174
+ if (conf.className) className = conf.className;
23175
+ if (props.className) className = (className ? className + " " : "") + props.className;
22997
23176
  return React__default.createElement("svg", __assign({
22998
23177
  stroke: "currentColor",
22999
23178
  fill: "currentColor",
@@ -23062,25 +23241,23 @@ function getDragOptions({
23062
23241
  }) {
23063
23242
  return [
23064
23243
  {
23065
- buttonLabel: dragToZoom,
23066
23244
  label: dragToZoom,
23245
+ description: doubleClickToReset,
23067
23246
  icon: /* @__PURE__ */ jsx(TbZoomIn, {}),
23068
23247
  selected: zoomEnabled,
23069
23248
  type: "Option",
23070
23249
  onClick: () => {
23071
- if (!zoomEnabled)
23072
- onToggleZoom();
23250
+ if (!zoomEnabled) onToggleZoom();
23073
23251
  }
23074
23252
  },
23075
23253
  {
23076
- buttonLabel: dragToPan,
23077
23254
  label: dragToPan,
23255
+ description: doubleClickToReset,
23078
23256
  icon: /* @__PURE__ */ jsx(TbArrowsMove, {}),
23079
23257
  selected: panEnabled,
23080
23258
  type: "Option",
23081
23259
  onClick: () => {
23082
- if (!panEnabled)
23083
- onTogglePan();
23260
+ if (!panEnabled) onTogglePan();
23084
23261
  }
23085
23262
  },
23086
23263
  ...isDragDataAllowed ? [
@@ -23090,8 +23267,7 @@ function getDragOptions({
23090
23267
  selected: enableDragPoints,
23091
23268
  type: "Option",
23092
23269
  onClick: () => {
23093
- if (!enableDragPoints)
23094
- onToggleDragPoints();
23270
+ if (!enableDragPoints) onToggleDragPoints();
23095
23271
  }
23096
23272
  }
23097
23273
  ] : [],
@@ -23102,8 +23278,7 @@ function getDragOptions({
23102
23278
  selected: enableDragAnnotation,
23103
23279
  type: "Option",
23104
23280
  onClick: () => {
23105
- if (!enableDragAnnotation)
23106
- onToggleDragAnnotation();
23281
+ if (!enableDragAnnotation) onToggleDragAnnotation();
23107
23282
  }
23108
23283
  }
23109
23284
  ] : [],
@@ -23113,59 +23288,10 @@ function getDragOptions({
23113
23288
  selected: !zoomEnabled && !panEnabled && !enableDragPoints && !enableDragAnnotation,
23114
23289
  type: "Option",
23115
23290
  onClick: onDisableDragOptions
23116
- },
23117
- {
23118
- label: /* @__PURE__ */ jsx(Text, { small: true, muted: true, children: doubleClickToReset }),
23119
- type: "Option",
23120
- disabled: true
23121
23291
  }
23122
23292
  ];
23123
23293
  }
23124
- const DragOptions = ({
23125
- onTogglePan,
23126
- onToggleZoom,
23127
- panEnabled,
23128
- zoomEnabled,
23129
- enableDragPoints,
23130
- enableDragAnnotation,
23131
- isDragDataAllowed,
23132
- isDragAnnotationAllowed,
23133
- onToggleDragAnnotation,
23134
- onToggleDragPoints,
23135
- onDisableDragOptions,
23136
- translations: {
23137
- dragToZoom,
23138
- doubleClickToReset,
23139
- dragToPan,
23140
- dragToMovePoints,
23141
- dragDisabled,
23142
- dragToMoveAnnotation
23143
- }
23144
- }) => {
23145
- const options = useMemo(
23146
- () => getDragOptions({
23147
- onTogglePan,
23148
- onToggleZoom,
23149
- panEnabled,
23150
- zoomEnabled,
23151
- enableDragPoints,
23152
- enableDragAnnotation,
23153
- isDragDataAllowed,
23154
- isDragAnnotationAllowed,
23155
- onToggleDragAnnotation,
23156
- onToggleDragPoints,
23157
- onDisableDragOptions,
23158
- translations: {
23159
- dragToZoom,
23160
- doubleClickToReset,
23161
- dragToPan,
23162
- dragToMovePoints,
23163
- dragDisabled,
23164
- dragToMoveAnnotation
23165
- }
23166
- }),
23167
- [zoomEnabled, panEnabled, enableDragPoints, isDragDataAllowed]
23168
- );
23294
+ const DragOptions = ({ options }) => {
23169
23295
  const selectedOption = options.find((option) => option.selected);
23170
23296
  return /* @__PURE__ */ jsx(
23171
23297
  Menu,
@@ -23179,7 +23305,7 @@ const DragOptions = ({
23179
23305
  colored: "muted",
23180
23306
  basic: true,
23181
23307
  small: true,
23182
- label: (selectedOption == null ? void 0 : selectedOption.buttonLabel) || (selectedOption == null ? void 0 : selectedOption.label),
23308
+ label: selectedOption == null ? void 0 : selectedOption.label,
23183
23309
  icon: selectedOption == null ? void 0 : selectedOption.icon
23184
23310
  }
23185
23311
  )
@@ -23187,8 +23313,8 @@ const DragOptions = ({
23187
23313
  }
23188
23314
  );
23189
23315
  };
23190
- const controls = "_controls_1961q_1";
23191
- const buttons = "_buttons_1961q_7";
23316
+ const controls = "_controls_1edjs_1";
23317
+ const buttons = "_buttons_1edjs_6";
23192
23318
  const styles$4 = {
23193
23319
  controls,
23194
23320
  buttons
@@ -23234,7 +23360,7 @@ function resolveUrl(url, baseUrl) {
23234
23360
  a2.href = url;
23235
23361
  return a2.href;
23236
23362
  }
23237
- const uuid = (() => {
23363
+ const uuid = /* @__PURE__ */ (() => {
23238
23364
  let counter = 0;
23239
23365
  const random = () => (
23240
23366
  // eslint-disable-next-line no-bitwise
@@ -23653,10 +23779,8 @@ async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl)
23653
23779
  const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
23654
23780
  const contentType = getMimeType(resourceURL);
23655
23781
  let dataURL;
23656
- if (getContentFromUrl) {
23657
- const content = await getContentFromUrl(resolvedURL);
23658
- dataURL = makeDataUrl(content, contentType);
23659
- } else {
23782
+ if (getContentFromUrl) ;
23783
+ else {
23660
23784
  dataURL = await resourceToDataURL(resolvedURL, contentType, options);
23661
23785
  }
23662
23786
  return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
@@ -23954,8 +24078,7 @@ var dist = { exports: {} };
23954
24078
  return function(e3) {
23955
24079
  var t = {};
23956
24080
  function n2(o2) {
23957
- if (t[o2])
23958
- return t[o2].exports;
24081
+ if (t[o2]) return t[o2].exports;
23959
24082
  var r2 = t[o2] = { i: o2, l: false, exports: {} };
23960
24083
  return e3[o2].call(r2.exports, r2, r2.exports, n2), r2.l = true, r2.exports;
23961
24084
  }
@@ -23964,16 +24087,12 @@ var dist = { exports: {} };
23964
24087
  }, n2.r = function(e4) {
23965
24088
  "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e4, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e4, "__esModule", { value: true });
23966
24089
  }, n2.t = function(e4, t2) {
23967
- if (1 & t2 && (e4 = n2(e4)), 8 & t2)
23968
- return e4;
23969
- if (4 & t2 && "object" == typeof e4 && e4 && e4.__esModule)
23970
- return e4;
24090
+ if (1 & t2 && (e4 = n2(e4)), 8 & t2) return e4;
24091
+ if (4 & t2 && "object" == typeof e4 && e4 && e4.__esModule) return e4;
23971
24092
  var o2 = /* @__PURE__ */ Object.create(null);
23972
- if (n2.r(o2), Object.defineProperty(o2, "default", { enumerable: true, value: e4 }), 2 & t2 && "string" != typeof e4)
23973
- for (var r2 in e4)
23974
- n2.d(o2, r2, (function(t3) {
23975
- return e4[t3];
23976
- }).bind(null, r2));
24093
+ if (n2.r(o2), Object.defineProperty(o2, "default", { enumerable: true, value: e4 }), 2 & t2 && "string" != typeof e4) for (var r2 in e4) n2.d(o2, r2, (function(t3) {
24094
+ return e4[t3];
24095
+ }).bind(null, r2));
23977
24096
  return o2;
23978
24097
  }, n2.n = function(e4) {
23979
24098
  var t2 = e4 && e4.__esModule ? function() {
@@ -24027,12 +24146,10 @@ var dist = { exports: {} };
24027
24146
  r3(s2);
24028
24147
  }, 0));
24029
24148
  } : "msSaveOrOpenBlob" in navigator ? function(e4, n4, a4) {
24030
- if (n4 = n4 || e4.name || "download", "string" != typeof e4)
24031
- navigator.msSaveOrOpenBlob(function(e5, t3) {
24032
- return void 0 === t3 ? t3 = { autoBom: false } : "object" != typeof t3 && (console.warn("Deprecated: Expected third argument to be a object"), t3 = { autoBom: !t3 }), t3.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e5.type) ? new Blob(["\uFEFF", e5], { type: e5.type }) : e5;
24033
- }(e4, a4), n4);
24034
- else if (o3(e4))
24035
- t2(e4, n4, a4);
24149
+ if (n4 = n4 || e4.name || "download", "string" != typeof e4) navigator.msSaveOrOpenBlob(function(e5, t3) {
24150
+ return void 0 === t3 ? t3 = { autoBom: false } : "object" != typeof t3 && (console.warn("Deprecated: Expected third argument to be a object"), t3 = { autoBom: !t3 }), t3.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e5.type) ? new Blob(["\uFEFF", e5], { type: e5.type }) : e5;
24151
+ }(e4, a4), n4);
24152
+ else if (o3(e4)) t2(e4, n4, a4);
24036
24153
  else {
24037
24154
  var i3 = document.createElement("a");
24038
24155
  i3.href = e4, i3.target = "_blank", setTimeout(function() {
@@ -24040,8 +24157,7 @@ var dist = { exports: {} };
24040
24157
  });
24041
24158
  }
24042
24159
  } : function(e4, n4, o4, r4) {
24043
- if ((r4 = r4 || open("", "_blank")) && (r4.document.title = r4.document.body.innerText = "downloading..."), "string" == typeof e4)
24044
- return t2(e4, n4, o4);
24160
+ if ((r4 = r4 || open("", "_blank")) && (r4.document.title = r4.document.body.innerText = "downloading..."), "string" == typeof e4) return t2(e4, n4, o4);
24045
24161
  var c3 = "application/octet-stream" === e4.type, s2 = /constructor/i.test(a3.HTMLElement) || a3.safari, u2 = /CriOS\/[\d]+/.test(navigator.userAgent);
24046
24162
  if ((u2 || c3 && s2 || i2) && "undefined" != typeof FileReader) {
24047
24163
  var l2 = new FileReader();
@@ -24065,8 +24181,7 @@ var dist = { exports: {} };
24065
24181
  return function(e4, t2, n3) {
24066
24182
  t2 = t2 || "", n3 = n3 || 512;
24067
24183
  for (var o3 = atob(e4), r3 = [], a3 = 0; a3 < o3.length; a3 += n3) {
24068
- for (var i2 = o3.slice(a3, a3 + n3), c2 = new Array(i2.length), s2 = 0; s2 < i2.length; s2++)
24069
- c2[s2] = i2.charCodeAt(s2);
24184
+ for (var i2 = o3.slice(a3, a3 + n3), c2 = new Array(i2.length), s2 = 0; s2 < i2.length; s2++) c2[s2] = i2.charCodeAt(s2);
24070
24185
  var u2 = new Uint8Array(c2);
24071
24186
  r3.push(u2);
24072
24187
  }
@@ -24086,8 +24201,7 @@ var dist = { exports: {} };
24086
24201
  return (u2 = Object.assign || function(e4) {
24087
24202
  for (var t2 = 1; t2 < arguments.length; t2++) {
24088
24203
  var n3 = arguments[t2];
24089
- for (var o3 in n3)
24090
- Object.prototype.hasOwnProperty.call(n3, o3) && (e4[o3] = n3[o3]);
24204
+ for (var o3 in n3) Object.prototype.hasOwnProperty.call(n3, o3) && (e4[o3] = n3[o3]);
24091
24205
  }
24092
24206
  return e4;
24093
24207
  }).apply(this, arguments);
@@ -24110,8 +24224,7 @@ var dist = { exports: {} };
24110
24224
  var t2;
24111
24225
  if ("string" == typeof e4 && (t2 = Object.keys(f2).find(function(t3) {
24112
24226
  return 0 === e4.indexOf(f2[t3]);
24113
- })), t2)
24114
- return t2;
24227
+ })), t2) return t2;
24115
24228
  throw new Error("props.base64 on <Base64Downloader/> has invalid or undefined extension. expected ".concat(Object.keys(l2).join(", ")));
24116
24229
  }
24117
24230
  d2.defaultProps = { className: "", style: {}, downloadName: p2, Tag: "button", extraAttributes: {} }, d2.propTypes = { base64: i2.a.string.isRequired, children: i2.a.oneOfType([i2.a.node, i2.a.string]).isRequired, downloadName: i2.a.string, onDownloadSuccess: i2.a.func, onDownloadError: i2.a.func, Tag: i2.a.string, className: i2.a.string, style: i2.a.object, extraAttributes: i2.a.object }, t.default = d2;
@@ -24139,7 +24252,7 @@ var dist = { exports: {} };
24139
24252
  e3.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
24140
24253
  }, function(e3, t) {
24141
24254
  var n2;
24142
- n2 = function() {
24255
+ n2 = /* @__PURE__ */ function() {
24143
24256
  return this;
24144
24257
  }();
24145
24258
  try {
@@ -24156,8 +24269,7 @@ const downloadPgn = (chartRef, state) => {
24156
24269
  var _a2;
24157
24270
  const chart2 = chartRef.current;
24158
24271
  const canvasElement = (_a2 = chart2 == null ? void 0 : chart2.canvas) == null ? void 0 : _a2.parentElement;
24159
- if (!canvasElement)
24160
- return;
24272
+ if (!canvasElement) return;
24161
24273
  const { ctx } = chart2;
24162
24274
  ctx.save();
24163
24275
  ctx.globalCompositeOperation = "destination-over";
@@ -24323,8 +24435,7 @@ const initializeFormState = ({
24323
24435
  const isEmptyString = (value) => value === "";
24324
24436
  const createErrorMessages = (value, compareTo, type) => {
24325
24437
  const errors = [];
24326
- if (isEmptyString(value))
24327
- errors.push("mustHaveAValue");
24438
+ if (isEmptyString(value)) errors.push("mustHaveAValue");
24328
24439
  if (type === "min" && !isLessThanMax(value, compareTo)) {
24329
24440
  errors.push("mustBeLessThanMax");
24330
24441
  } else if (type === "max" && !isGreaterThanMin(value, compareTo)) {
@@ -24643,6 +24754,39 @@ const Controls = ({
24643
24754
  });
24644
24755
  const [measureRef, { width }] = useMeasure$1();
24645
24756
  const isNarrow = width < 200;
24757
+ const lineOptions = useMemo(
24758
+ () => getLineOptions({
24759
+ lineEnabled,
24760
+ onToggleLine,
24761
+ onTogglePoints,
24762
+ pointsEnabled,
24763
+ translations
24764
+ }),
24765
+ [lineEnabled, pointsEnabled]
24766
+ );
24767
+ const dragOptions = useMemo(
24768
+ () => getDragOptions({
24769
+ onTogglePan,
24770
+ onToggleZoom,
24771
+ panEnabled,
24772
+ zoomEnabled,
24773
+ enableDragPoints,
24774
+ enableDragAnnotation,
24775
+ isDragDataAllowed: dragData == null ? void 0 : dragData.enableDragData,
24776
+ isDragAnnotationAllowed: annotations == null ? void 0 : annotations.enableDragAnnotation,
24777
+ onToggleDragAnnotation,
24778
+ onToggleDragPoints,
24779
+ onDisableDragOptions,
24780
+ translations
24781
+ }),
24782
+ [
24783
+ zoomEnabled,
24784
+ panEnabled,
24785
+ enableDragPoints,
24786
+ dragData == null ? void 0 : dragData.enableDragData,
24787
+ annotations == null ? void 0 : annotations.enableDragAnnotation
24788
+ ]
24789
+ );
24646
24790
  return /* @__PURE__ */ jsxs(Fragment, { children: [
24647
24791
  /* @__PURE__ */ jsxs("div", { className: styles$4.controls, children: [
24648
24792
  !!options.title && /* @__PURE__ */ jsx(Text, { bold: true, children: options.title }),
@@ -24672,36 +24816,11 @@ const Controls = ({
24672
24816
  menu: {
24673
24817
  placement: "bottom-end",
24674
24818
  sections: [
24675
- ...getLineOptions({
24676
- lineEnabled,
24677
- onToggleLine,
24678
- onTogglePoints,
24679
- pointsEnabled,
24680
- translations
24681
- }).map((option) => ({
24682
- ...option,
24683
- type: "Option"
24684
- })),
24819
+ ...lineOptions,
24685
24820
  {
24686
24821
  type: "Divider"
24687
24822
  },
24688
- ...getDragOptions({
24689
- onTogglePan,
24690
- onToggleZoom,
24691
- panEnabled,
24692
- zoomEnabled,
24693
- enableDragPoints,
24694
- enableDragAnnotation,
24695
- isDragDataAllowed: dragData == null ? void 0 : dragData.enableDragData,
24696
- isDragAnnotationAllowed: annotations == null ? void 0 : annotations.enableDragAnnotation,
24697
- onToggleDragAnnotation,
24698
- onToggleDragPoints,
24699
- onDisableDragOptions,
24700
- translations
24701
- }).map((option) => ({
24702
- ...option,
24703
- type: "Option"
24704
- })),
24823
+ ...dragOptions,
24705
24824
  {
24706
24825
  type: "Divider"
24707
24826
  },
@@ -24717,16 +24836,7 @@ const Controls = ({
24717
24836
  }
24718
24837
  }
24719
24838
  ) : /* @__PURE__ */ jsxs(Fragment, { children: [
24720
- /* @__PURE__ */ jsx(
24721
- LineOptions,
24722
- {
24723
- lineEnabled,
24724
- pointsEnabled,
24725
- onToggleLine,
24726
- onTogglePoints,
24727
- translations
24728
- }
24729
- ),
24839
+ /* @__PURE__ */ jsx(LineOptions, { options: lineOptions }),
24730
24840
  /* @__PURE__ */ jsx(
24731
24841
  Tooltip$2,
24732
24842
  {
@@ -24746,23 +24856,7 @@ const Controls = ({
24746
24856
  )
24747
24857
  }
24748
24858
  ),
24749
- /* @__PURE__ */ jsx(
24750
- DragOptions,
24751
- {
24752
- panEnabled,
24753
- zoomEnabled,
24754
- onTogglePan,
24755
- onToggleZoom,
24756
- enableDragPoints,
24757
- enableDragAnnotation,
24758
- isDragDataAllowed: dragData == null ? void 0 : dragData.enableDragData,
24759
- isDragAnnotationAllowed: annotations == null ? void 0 : annotations.enableDragAnnotation,
24760
- onToggleDragAnnotation,
24761
- onToggleDragPoints,
24762
- onDisableDragOptions,
24763
- translations
24764
- }
24765
- )
24859
+ /* @__PURE__ */ jsx(DragOptions, { options: dragOptions })
24766
24860
  ] })
24767
24861
  ] }),
24768
24862
  table2 ? /* @__PURE__ */ jsx(
@@ -24949,8 +25043,7 @@ const INIT_KEYS = {
24949
25043
  const LOWER_BOUND = 1e-4;
24950
25044
  const UPPER_BOUND = 1e7;
24951
25045
  const checkCustomOption = (data, customOptions) => {
24952
- if (isEmpty(data) || isEmpty(customOptions))
24953
- return false;
25046
+ if (isEmpty(data) || isEmpty(customOptions)) return false;
24954
25047
  const checkOption = (dataset) => {
24955
25048
  if (typeof customOptions === "string") {
24956
25049
  return dataset && has(dataset, customOptions);
@@ -25275,8 +25368,7 @@ const getAnnotationsData = (data) => {
25275
25368
  };
25276
25369
  const getAxesDataFromMetasets = (chartRef, scalesKeys, annotationsData) => {
25277
25370
  var _a2;
25278
- if (!chartRef || !scalesKeys)
25279
- return {};
25371
+ if (!chartRef || !scalesKeys) return {};
25280
25372
  const metasets = ((_a2 = chartRef == null ? void 0 : chartRef.current) == null ? void 0 : _a2.getSortedVisibleDatasetMetas()) ?? [];
25281
25373
  const annotData = getAnnotationsData(annotationsData);
25282
25374
  return metasets && (scalesKeys == null ? void 0 : scalesKeys.reduce((acc, key) => {
@@ -25620,7 +25712,8 @@ const generateAnnotations = (annotationsData) => {
25620
25712
  const borderColor = {
25621
25713
  [AnnotationType.LINE]: color2,
25622
25714
  [AnnotationType.POINT]: color2,
25623
- [AnnotationType.BOX]: color2
25715
+ [AnnotationType.BOX]: color2,
25716
+ [AnnotationType.ELLIPSE]: TRANSPARENT
25624
25717
  }[type] || TRANSPARENT;
25625
25718
  const borderWidth = type === AnnotationType.LINE ? BORDER_WIDTH.INITIAL : 0;
25626
25719
  const borderDash = type === AnnotationType.LINE ? ANNOTATION_DASH : void 0;
@@ -25705,7 +25798,9 @@ const generateAnnotations = (annotationsData) => {
25705
25798
  leave,
25706
25799
  onDragStart,
25707
25800
  onDrag,
25708
- onDragEnd
25801
+ onDragEnd,
25802
+ pointStyle: (ann == null ? void 0 : ann.pointStyle) ?? PointStyle.Circle,
25803
+ resizable: (ann == null ? void 0 : ann.resizable) ?? false
25709
25804
  };
25710
25805
  });
25711
25806
  };
@@ -25998,8 +26093,7 @@ const getAxesRangesFromChart = (chartRef, axes) => {
25998
26093
  });
25999
26094
  };
26000
26095
  const getAxisRangeByType = (chartRef, axesType, annotationsData) => {
26001
- if (!chartRef || !chartRef.current)
26002
- return null;
26096
+ if (!chartRef || !chartRef.current) return null;
26003
26097
  const metasets = chartRef.current.getSortedVisibleDatasetMetas();
26004
26098
  const annotDataByType = getAnnotationsData(annotationsData)[axesType] ?? [];
26005
26099
  let allData = [];
@@ -26008,8 +26102,7 @@ const getAxisRangeByType = (chartRef, axesType, annotationsData) => {
26008
26102
  allData = allData.concat(data);
26009
26103
  });
26010
26104
  allData = allData.concat(annotDataByType);
26011
- if (allData.length === 0)
26012
- return null;
26105
+ if (allData.length === 0) return null;
26013
26106
  const min = Math.min(...allData);
26014
26107
  const max = Math.max(...allData);
26015
26108
  return { min, max };
@@ -26244,8 +26337,7 @@ const chartAreaTextPlugin = {
26244
26337
  maxWidth: initialMaxWidth,
26245
26338
  position
26246
26339
  } = options;
26247
- if (!showLabel || !text)
26248
- return;
26340
+ if (!showLabel || !text) return;
26249
26341
  const { ctx, chartArea } = chart2;
26250
26342
  const maxWidth = calculateMaxWidth(initialMaxWidth, chartArea.width);
26251
26343
  const [x2, y2] = getPositionCoordinates(position, chart2, xOffset, yOffset);
@@ -26324,11 +26416,77 @@ const calculateAnnotationMetricsInValuesInPixels = (annotation2, scales) => {
26324
26416
  height
26325
26417
  };
26326
26418
  };
26419
+ const isWithinChartArea = ({
26420
+ x: x2,
26421
+ y: y2,
26422
+ chartArea,
26423
+ scales,
26424
+ metrics,
26425
+ resizable = false,
26426
+ dragRange,
26427
+ annotationType
26428
+ }) => {
26429
+ if (resizable && !dragRange) {
26430
+ return true;
26431
+ }
26432
+ if (dragRange) {
26433
+ const withinRangeX = x2 !== void 0 && dragRange.x ? x2 >= dragRange.x[0] && x2 <= dragRange.x[1] : true;
26434
+ const withinRangeY = y2 !== void 0 && dragRange.y ? y2 >= dragRange.y[0] && y2 <= dragRange.y[1] : true;
26435
+ return withinRangeX && withinRangeY;
26436
+ }
26437
+ const minX = scales.x.getValueForPixel(chartArea.left) ?? Number.NEGATIVE_INFINITY;
26438
+ const maxX = scales.x.getValueForPixel(chartArea.right) ?? Number.POSITIVE_INFINITY;
26439
+ const minY = scales.y.getValueForPixel(chartArea.bottom) ?? Number.NEGATIVE_INFINITY;
26440
+ const maxY = scales.y.getValueForPixel(chartArea.top) ?? Number.POSITIVE_INFINITY;
26441
+ if (annotationType === AnnotationType.POINT) {
26442
+ const withinX = x2 !== void 0 ? x2 >= minX && x2 <= maxX : true;
26443
+ const withinY = y2 !== void 0 ? y2 >= minY && y2 <= maxY : true;
26444
+ return withinX && withinY;
26445
+ }
26446
+ if (annotationType === AnnotationType.BOX && metrics.width !== void 0 && metrics.height !== void 0) {
26447
+ const boxXMin = x2 !== void 0 ? x2 - metrics.width / 2 : void 0;
26448
+ const boxXMax = x2 !== void 0 ? x2 + metrics.width / 2 : void 0;
26449
+ const boxYMin = y2 !== void 0 ? y2 - metrics.height / 2 : void 0;
26450
+ const boxYMax = y2 !== void 0 ? y2 + metrics.height / 2 : void 0;
26451
+ const withinBoxX = boxXMin !== void 0 && boxXMax !== void 0 ? boxXMin >= minX && boxXMax <= maxX : true;
26452
+ const withinBoxY = boxYMin !== void 0 && boxYMax !== void 0 ? boxYMin >= minY && boxYMax <= maxY : true;
26453
+ return withinBoxX && withinBoxY;
26454
+ }
26455
+ return true;
26456
+ };
26457
+ const updateAnnotationPositionWithinBounds = (axis, newPosition, activeAnnotation, chart2, scales, metrics) => {
26458
+ const { resizable, dragRange = null } = activeAnnotation ?? {};
26459
+ const checkArea = isWithinChartArea({
26460
+ [axis]: newPosition,
26461
+ chartArea: chart2.chartArea,
26462
+ scales,
26463
+ resizable,
26464
+ dragRange,
26465
+ metrics: metrics || {},
26466
+ annotationType: activeAnnotation.type
26467
+ });
26468
+ if (!checkArea) return;
26469
+ if (activeAnnotation.type === AnnotationType.POINT) {
26470
+ if (axis === "x") {
26471
+ activeAnnotation.xValue = newPosition;
26472
+ } else if (axis === "y") {
26473
+ activeAnnotation.yValue = newPosition;
26474
+ }
26475
+ } else if (activeAnnotation.type === AnnotationType.BOX && metrics) {
26476
+ if (axis === "x" && metrics.width) {
26477
+ activeAnnotation.xMin = newPosition - metrics.width / 2;
26478
+ activeAnnotation.xMax = newPosition + metrics.width / 2;
26479
+ }
26480
+ if (axis === "y" && metrics.height) {
26481
+ activeAnnotation.yMin = newPosition - metrics.height / 2;
26482
+ activeAnnotation.yMax = newPosition + metrics.height / 2;
26483
+ }
26484
+ }
26485
+ };
26327
26486
  const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDraggingState, hoveredAnnotationId) => {
26328
26487
  const { x: x2, y: y2 } = getMousePositionInCoordinates(event, canvas2, scales);
26329
26488
  const annotation2 = hoveredAnnotationId ? annotations == null ? void 0 : annotations[hoveredAnnotationId] : null;
26330
- if (!annotation2)
26331
- return;
26489
+ if (!annotation2) return;
26332
26490
  const metrics = calculateAnnotationMetricsInValues(annotation2);
26333
26491
  if (annotation2 && annotation2.enableDrag && !isNil(metrics.centerY) && !isNil(metrics.centerX)) {
26334
26492
  canvas2.style.cursor = CursorStyle.Move;
@@ -26349,24 +26507,24 @@ const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAn
26349
26507
  let newCenterX = x2 - dragStartX;
26350
26508
  let newCenterY = y2 - dragStartY;
26351
26509
  if (dragAxis !== DragAxis.Y) {
26352
- if ((activeAnnotation == null ? void 0 : activeAnnotation.type) === AnnotationType.POINT) {
26353
- activeAnnotation.xValue = newCenterX;
26354
- } else if ((activeAnnotation == null ? void 0 : activeAnnotation.type) === AnnotationType.BOX) {
26355
- if (!isNil(metrics == null ? void 0 : metrics.width)) {
26356
- activeAnnotation.xMin = newCenterX - metrics.width / 2;
26357
- activeAnnotation.xMax = newCenterX + metrics.width / 2;
26358
- }
26359
- }
26510
+ updateAnnotationPositionWithinBounds(
26511
+ DragAxis.X,
26512
+ newCenterX,
26513
+ activeAnnotation,
26514
+ chart2,
26515
+ scales,
26516
+ metrics
26517
+ );
26360
26518
  }
26361
26519
  if (dragAxis !== DragAxis.X) {
26362
- if ((activeAnnotation == null ? void 0 : activeAnnotation.type) === AnnotationType.POINT) {
26363
- activeAnnotation.yValue = newCenterY;
26364
- } else if ((activeAnnotation == null ? void 0 : activeAnnotation.type) === AnnotationType.BOX) {
26365
- if (!isNil(metrics == null ? void 0 : metrics.height)) {
26366
- activeAnnotation.yMin = newCenterY - metrics.height / 2;
26367
- activeAnnotation.yMax = newCenterY + metrics.height / 2;
26368
- }
26369
- }
26520
+ updateAnnotationPositionWithinBounds(
26521
+ DragAxis.Y,
26522
+ newCenterY,
26523
+ activeAnnotation,
26524
+ chart2,
26525
+ scales,
26526
+ metrics
26527
+ );
26370
26528
  }
26371
26529
  chart2.update();
26372
26530
  if (activeAnnotation == null ? void 0 : activeAnnotation.onDrag) {
@@ -26447,8 +26605,7 @@ const annotationDraggerPlugin = {
26447
26605
  beforeDraw(chart2) {
26448
26606
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
26449
26607
  let annotations = ((_b2 = (_a2 = chart2.options.plugins) == null ? void 0 : _a2.annotation) == null ? void 0 : _b2.annotations) ?? {};
26450
- if (!annotations)
26451
- return;
26608
+ if (!annotations) return;
26452
26609
  annotationLabel(
26453
26610
  chart2.ctx,
26454
26611
  annotations,
@@ -26483,8 +26640,7 @@ const annotationDraggerPlugin = {
26483
26640
  };
26484
26641
  const typedScales = { x: scales.x, y: scales.y };
26485
26642
  let annotations = ((_d2 = (_c2 = chart2.options.plugins) == null ? void 0 : _c2.annotation) == null ? void 0 : _d2.annotations) ?? {};
26486
- if (!chart2 && !annotations)
26487
- return;
26643
+ if (!chart2 && !annotations) return;
26488
26644
  let isDragging2 = false;
26489
26645
  let dragStartX, dragStartY;
26490
26646
  let activeAnnotation = null;
@@ -26651,9 +26807,10 @@ const SvgTriangle = (props) => /* @__PURE__ */ React.createElement("svg", { heig
26651
26807
  const LEGEND_SYMBOL_SIZE$1 = 16;
26652
26808
  const LineItem = ({ dataset }) => {
26653
26809
  var _a2;
26654
- const { borderColor, borderDash, borderWidth } = dataset;
26655
- const offset = borderDash.length ? (LEGEND_SYMBOL_SIZE$1 - borderDash[0]) / 2 % (borderDash[0] + borderDash[1]) * -1 : 0;
26656
- const borderDashString = ((_a2 = dataset.borderDash) == null ? void 0 : _a2.join(" ")) || "";
26810
+ const { borderColor, borderDash, borderWidth } = dataset ?? {};
26811
+ const [dash0, dash1] = borderDash ?? [];
26812
+ const offset = dash0 && dash1 ? (LEGEND_SYMBOL_SIZE$1 - dash0) / 2 % (dash0 + dash1) * -1 : 0;
26813
+ const borderDashString = ((_a2 = dataset == null ? void 0 : dataset.borderDash) == null ? void 0 : _a2.join(" ")) || "";
26657
26814
  return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemLine, children: /* @__PURE__ */ jsx(
26658
26815
  "svg",
26659
26816
  {
@@ -26678,9 +26835,8 @@ const LineItem = ({ dataset }) => {
26678
26835
  ) });
26679
26836
  };
26680
26837
  const PointItem = ({ dataset }) => {
26681
- const { pointBackgroundColor, pointRadius, pointStyle = "" } = dataset;
26682
- if (!pointRadius)
26683
- return null;
26838
+ const { pointBackgroundColor, pointRadius, pointStyle = "" } = dataset ?? {};
26839
+ if (!pointRadius) return null;
26684
26840
  const size = pointRadius * 2;
26685
26841
  const icons = {
26686
26842
  circle: /* @__PURE__ */ jsx(SvgCircle, {}),
@@ -26691,19 +26847,19 @@ const PointItem = ({ dataset }) => {
26691
26847
  return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(
26692
26848
  Icon,
26693
26849
  {
26694
- icon: icons[pointStyle] ?? /* @__PURE__ */ jsx(SvgCircle, {}),
26850
+ icon: (icons == null ? void 0 : icons[pointStyle]) ?? /* @__PURE__ */ jsx(SvgCircle, {}),
26695
26851
  size,
26696
26852
  color: pointBackgroundColor
26697
26853
  }
26698
26854
  ) });
26699
26855
  };
26700
26856
  const BoxItem = ({ dataset }) => {
26701
- const { backgroundColor } = dataset;
26857
+ const { backgroundColor } = dataset ?? {};
26702
26858
  const style = { backgroundColor };
26703
26859
  return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemBox, style });
26704
26860
  };
26705
26861
  const LegendItemLine = ({ dataset }) => {
26706
- const { annotationType, showLine } = dataset;
26862
+ const { annotationType, showLine } = dataset ?? {};
26707
26863
  switch (annotationType) {
26708
26864
  case AnnotationType$1.Box:
26709
26865
  case AnnotationType$1.Ellipse:
@@ -26723,15 +26879,15 @@ const renderLegendItemSymbol = (dataset, chartType, index2) => {
26723
26879
  case ChartType.LINE:
26724
26880
  return /* @__PURE__ */ jsx(LegendItemLine, { dataset });
26725
26881
  case ChartType.BAR: {
26726
- const { backgroundColor } = dataset;
26727
- const color2 = backgroundColor instanceof Array ? backgroundColor[index2] : backgroundColor;
26882
+ const { backgroundColor } = dataset ?? {};
26883
+ const color2 = backgroundColor instanceof Array ? backgroundColor == null ? void 0 : backgroundColor[index2] : backgroundColor;
26728
26884
  return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemBox, children: /* @__PURE__ */ jsx(TbSquareFilled, { color: color2 }) });
26729
26885
  }
26730
26886
  case ChartType.PIE:
26731
26887
  return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgCircle, {}) }) });
26732
26888
  case ChartType.SCATTER: {
26733
- const { backgroundColor, borderColor } = dataset;
26734
- const color2 = backgroundColor instanceof Array ? backgroundColor[index2] : backgroundColor;
26889
+ const { backgroundColor, borderColor } = dataset ?? {};
26890
+ const color2 = backgroundColor instanceof Array ? backgroundColor == null ? void 0 : backgroundColor[index2] : backgroundColor;
26735
26891
  return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(TbCircleFilled, { color: color2 ?? borderColor }) });
26736
26892
  }
26737
26893
  default:
@@ -26748,7 +26904,7 @@ const LegendItem = ({
26748
26904
  return /* @__PURE__ */ jsxs(
26749
26905
  "div",
26750
26906
  {
26751
- className: cx(styles$3.legendItem, hidden && styles$3.isHidden),
26907
+ className: cx(styles$3 == null ? void 0 : styles$3.legendItem, hidden && (styles$3 == null ? void 0 : styles$3.isHidden)),
26752
26908
  onClick: handleClick,
26753
26909
  children: [
26754
26910
  /* @__PURE__ */ jsx(
@@ -26759,7 +26915,7 @@ const LegendItem = ({
26759
26915
  children: renderLegendItemSymbol(dataset, chartType, index2)
26760
26916
  }
26761
26917
  ),
26762
- /* @__PURE__ */ jsx("span", { className: styles$3.legendItemText, children: dataset.label })
26918
+ /* @__PURE__ */ jsx("span", { className: styles$3.legendItemText, children: dataset == null ? void 0 : dataset.label })
26763
26919
  ]
26764
26920
  }
26765
26921
  );
@@ -26801,9 +26957,8 @@ const getGeneratedLabels = (chart2) => {
26801
26957
  const useGeneratedLabels = (chartRef, generatedDatasets) => {
26802
26958
  const [items, setItems] = useState([]);
26803
26959
  useEffect(() => {
26804
- const chart2 = chartRef.current;
26805
- if (!chart2)
26806
- return;
26960
+ const chart2 = chartRef == null ? void 0 : chartRef.current;
26961
+ if (!chart2) return;
26807
26962
  const newItems = getGeneratedLabels(chart2);
26808
26963
  setItems(newItems);
26809
26964
  }, [generatedDatasets, chartRef]);
@@ -26814,10 +26969,10 @@ const createLegendStyle = (legendPosition, chart2) => {
26814
26969
  const { height = 0, width = 0, chartArea } = chart2 ?? {};
26815
26970
  const { top: top2 = 0, left: left2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = chartArea ?? {};
26816
26971
  return {
26817
- left: legendPosition.includes("left") ? left2 : void 0,
26818
- right: legendPosition.includes("right") ? width - right2 : void 0,
26819
- top: legendPosition.includes("top") ? top2 : void 0,
26820
- bottom: legendPosition.includes("bottom") ? height - bottom2 : void 0,
26972
+ left: (legendPosition == null ? void 0 : legendPosition.includes("left")) ? left2 : void 0,
26973
+ right: (legendPosition == null ? void 0 : legendPosition.includes("right")) ? width - right2 : void 0,
26974
+ top: (legendPosition == null ? void 0 : legendPosition.includes("top")) ? top2 : void 0,
26975
+ bottom: (legendPosition == null ? void 0 : legendPosition.includes("bottom")) ? height - bottom2 : void 0,
26821
26976
  maxHeight: 0.5 * (bottom2 - top2 - LEGEND_MARGIN * 2),
26822
26977
  maxWidth: 0.9 * (right2 - left2 - LEGEND_MARGIN * 2),
26823
26978
  margin: LEGEND_MARGIN
@@ -26828,27 +26983,28 @@ const LegendItems = ({
26828
26983
  datasets,
26829
26984
  legendClick,
26830
26985
  chartType
26831
- }) => /* @__PURE__ */ jsx("div", { className: styles$3.legendItems, children: items.map((item, index2) => {
26832
- if (datasets[item.datasetIndex].hideLegend) {
26986
+ }) => /* @__PURE__ */ jsx("div", { className: styles$3.legendItems, children: items == null ? void 0 : items.map((item, index2) => {
26987
+ var _a2;
26988
+ if ((_a2 = datasets == null ? void 0 : datasets[item == null ? void 0 : item.datasetIndex]) == null ? void 0 : _a2.hideLegend) {
26833
26989
  return null;
26834
26990
  }
26835
26991
  return /* @__PURE__ */ jsx(
26836
26992
  LegendItem,
26837
26993
  {
26838
26994
  index: index2,
26839
- hidden: item.hidden,
26840
- dataset: datasets[item.datasetIndex],
26995
+ hidden: item == null ? void 0 : item.hidden,
26996
+ dataset: datasets == null ? void 0 : datasets[item == null ? void 0 : item.datasetIndex],
26841
26997
  handleClick: (_2) => legendClick(_2, item),
26842
26998
  chartType
26843
26999
  },
26844
- `${item.datasetIndex}-hidden-${item.hidden}`
27000
+ `${item == null ? void 0 : item.datasetIndex}-hidden-${item == null ? void 0 : item.hidden}`
26845
27001
  );
26846
27002
  }) });
26847
27003
  const LegendPanel = forwardRef(
26848
27004
  ({ legendPosition, chartRef, isDragging: isDragging2, legendConfig }, ref) => {
26849
27005
  var _a2;
26850
27006
  const chart2 = chartRef == null ? void 0 : chartRef.current;
26851
- const { options, generatedDatasets, chartType } = legendConfig;
27007
+ const { options, generatedDatasets, chartType } = legendConfig ?? {};
26852
27008
  const datasets = (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets;
26853
27009
  const { legend: legend2, legendClick } = useLegendState({
26854
27010
  chartRef,
@@ -26892,13 +27048,17 @@ const LegendPanel = forwardRef(
26892
27048
  }
26893
27049
  );
26894
27050
  const LegendDropZone = (legendDropZoneProps) => {
26895
- const { position, onDrop, placeholderSize } = legendDropZoneProps;
27051
+ const {
27052
+ position = "",
27053
+ onDrop = noop$2,
27054
+ placeholderSize = {}
27055
+ } = legendDropZoneProps ?? {};
26896
27056
  const [{ isOver, canDrop }, dropRef] = useDrop(() => ({
26897
27057
  accept: "legend",
26898
27058
  drop: onDrop,
26899
27059
  collect: (monitor) => ({
26900
- isOver: monitor.isOver(),
26901
- canDrop: monitor.canDrop()
27060
+ isOver: monitor == null ? void 0 : monitor.isOver(),
27061
+ canDrop: monitor == null ? void 0 : monitor.canDrop()
26902
27062
  })
26903
27063
  }));
26904
27064
  const isActive2 = isOver && canDrop;
@@ -26909,10 +27069,10 @@ const LegendDropZone = (legendDropZoneProps) => {
26909
27069
  className: cx(
26910
27070
  styles$3.dropzone,
26911
27071
  isActive2 && styles$3.isActive,
26912
- position.includes("left") && styles$3.left,
26913
- position.includes("right") && styles$3.right,
26914
- position.includes("top") && styles$3.top,
26915
- position.includes("bottom") && styles$3.bottom
27072
+ (position == null ? void 0 : position.includes("left")) && styles$3.left,
27073
+ (position == null ? void 0 : position.includes("right")) && styles$3.right,
27074
+ (position == null ? void 0 : position.includes("top")) && styles$3.top,
27075
+ (position == null ? void 0 : position.includes("bottom")) && styles$3.bottom
26916
27076
  ),
26917
27077
  children: /* @__PURE__ */ jsx(
26918
27078
  "div",
@@ -26945,7 +27105,7 @@ const LegendDropZones = (legendDropZonesProps) => {
26945
27105
  zIndex: isDragging2 ? 0 : -1
26946
27106
  // Position dropzones behind chart when not needed
26947
27107
  },
26948
- children: positions2.map((position) => /* @__PURE__ */ jsx(
27108
+ children: positions2 == null ? void 0 : positions2.map((position) => /* @__PURE__ */ jsx(
26949
27109
  LegendDropZone,
26950
27110
  {
26951
27111
  position,
@@ -26959,24 +27119,32 @@ const LegendDropZones = (legendDropZonesProps) => {
26959
27119
  };
26960
27120
  const Legend2 = ({ chartRef, legendConfig }) => {
26961
27121
  const chart2 = chartRef == null ? void 0 : chartRef.current;
26962
- const { chartArea } = chart2 ?? {};
27122
+ const [chartArea, setChartArea] = useState(
27123
+ chart2 == null ? void 0 : chart2.chartArea
27124
+ );
26963
27125
  const {
26964
27126
  options: { legend: legend2 }
26965
27127
  } = legendConfig ?? {};
26966
- const [measureRef] = useMeasure$1();
27128
+ const [measureRef, measureRect] = useMeasure$1();
26967
27129
  const resizeRef = measureRef;
26968
27130
  const panelRef = useRef(null);
26969
27131
  const [legendPosition, setLegendPosition] = useState(
26970
27132
  (legend2 == null ? void 0 : legend2.position) || Position.BottomLeft
26971
27133
  );
26972
- const panelRect = panelRef.current ? panelRef.current.getBoundingClientRect() : null;
27134
+ const panelRect = (panelRef == null ? void 0 : panelRef.current) ? panelRef.current.getBoundingClientRect() : null;
26973
27135
  const panelSize = { width: panelRect == null ? void 0 : panelRect.width, height: panelRect == null ? void 0 : panelRect.height };
26974
- const [{ isDragging: isDragging2 }, dragRef] = useDrag(() => ({
27136
+ const [{ isDragging: isDragging2 = false }, dragRef = noop$2] = useDrag(() => ({
26975
27137
  type: "legend",
26976
27138
  collect: (monitor) => ({
26977
27139
  isDragging: monitor.isDragging()
26978
27140
  })
26979
27141
  }));
27142
+ useEffect(() => {
27143
+ const timeout = setTimeout(() => {
27144
+ setChartArea(chart2 == null ? void 0 : chart2.chartArea);
27145
+ }, 20);
27146
+ return () => clearTimeout(timeout);
27147
+ }, [measureRect]);
26980
27148
  return /* @__PURE__ */ jsxs(Fragment, { children: [
26981
27149
  /* @__PURE__ */ jsx("div", { ref: resizeRef, className: styles$3.resizeContainer }),
26982
27150
  /* @__PURE__ */ jsx(
@@ -26999,7 +27167,8 @@ const Legend2 = ({ chartRef, legendConfig }) => {
26999
27167
  setLegendPosition: (position) => setLegendPosition(position),
27000
27168
  isDragging: isDragging2,
27001
27169
  placeholderSize: panelSize
27002
- }
27170
+ },
27171
+ measureRect.width
27003
27172
  )
27004
27173
  ] });
27005
27174
  };
@@ -27319,8 +27488,7 @@ const usePieChartConfig = (chart2) => {
27319
27488
  return "";
27320
27489
  const dataElement = context.dataset.data[context.dataIndex];
27321
27490
  const label = (dataElement == null ? void 0 : dataElement.label) || (typeof dataElement === "number" ? dataElement : Array.isArray(dataElement) ? dataElement.reduce((acc, curr, i2) => {
27322
- if (i2 === 0)
27323
- return `${acc} ${curr}`;
27491
+ if (i2 === 0) return `${acc} ${curr}`;
27324
27492
  return `${acc}, ${curr}`;
27325
27493
  }, "") : "");
27326
27494
  const dataLabel = typeof dataElement === "number" ? Number.isInteger(label) ? label : label.toFixed(2) : label;
@@ -27341,8 +27509,7 @@ const usePieChartConfig = (chart2) => {
27341
27509
  usePointStyle: true,
27342
27510
  filter: (item) => {
27343
27511
  var _a2;
27344
- if (!options.legend.useDataset)
27345
- return true;
27512
+ if (!options.legend.useDataset) return true;
27346
27513
  return !((_a2 = data.datasets[item.index]) == null ? void 0 : _a2.hideLegend);
27347
27514
  }
27348
27515
  },
@@ -27481,7 +27648,7 @@ const PieChartWithLegend = (props) => {
27481
27648
  * (c) 2022 Chart.js Contributors
27482
27649
  * Released under the MIT License
27483
27650
  */
27484
- const uid = function() {
27651
+ const uid = /* @__PURE__ */ function() {
27485
27652
  let id = 0;
27486
27653
  return function() {
27487
27654
  return id++;
@@ -27521,11 +27688,7 @@ function each(loopable, fn, thisArg, reverse) {
27521
27688
  let i2, len, keys;
27522
27689
  if (isArray(loopable)) {
27523
27690
  len = loopable.length;
27524
- if (reverse) {
27525
- for (i2 = len - 1; i2 >= 0; i2--) {
27526
- fn.call(thisArg, loopable[i2], i2);
27527
- }
27528
- } else {
27691
+ {
27529
27692
  for (i2 = 0; i2 < len; i2++) {
27530
27693
  fn.call(thisArg, loopable[i2], i2);
27531
27694
  }
@@ -28782,7 +28945,7 @@ function clearCanvas(canvas2, ctx) {
28782
28945
  ctx.restore();
28783
28946
  }
28784
28947
  function drawPoint(ctx, options, x2, y2) {
28785
- drawPointLegend(ctx, options, x2, y2, null);
28948
+ drawPointLegend(ctx, options, x2, y2);
28786
28949
  }
28787
28950
  function drawPointLegend(ctx, options, x2, y2, w2) {
28788
28951
  let type, xOffset, yOffset, size, cornerRadius, width;
@@ -28807,9 +28970,7 @@ function drawPointLegend(ctx, options, x2, y2, w2) {
28807
28970
  ctx.beginPath();
28808
28971
  switch (style) {
28809
28972
  default:
28810
- if (w2) {
28811
- ctx.ellipse(x2, y2, w2 / 2, radius, 0, 0, TAU);
28812
- } else {
28973
+ {
28813
28974
  ctx.arc(x2, y2, radius, 0, TAU);
28814
28975
  }
28815
28976
  ctx.closePath();
@@ -28836,7 +28997,7 @@ function drawPointLegend(ctx, options, x2, y2, w2) {
28836
28997
  case "rect":
28837
28998
  if (!rotation) {
28838
28999
  size = Math.SQRT1_2 * radius;
28839
- width = w2 ? w2 / 2 : size;
29000
+ width = size;
28840
29001
  ctx.rect(x2 - width, y2 - size, 2 * width, 2 * size);
28841
29002
  break;
28842
29003
  }
@@ -28876,7 +29037,7 @@ function drawPointLegend(ctx, options, x2, y2, w2) {
28876
29037
  ctx.lineTo(x2 - yOffset, y2 + xOffset);
28877
29038
  break;
28878
29039
  case "line":
28879
- xOffset = w2 ? w2 / 2 : Math.cos(rad) * radius;
29040
+ xOffset = Math.cos(rad) * radius;
28880
29041
  yOffset = Math.sin(rad) * radius;
28881
29042
  ctx.moveTo(x2 - xOffset, y2 - yOffset);
28882
29043
  ctx.lineTo(x2 + xOffset, y2 + yOffset);
@@ -29064,25 +29225,13 @@ function toFont(options, fallback) {
29064
29225
  return font;
29065
29226
  }
29066
29227
  function resolve(inputs, context, index2, info) {
29067
- let cacheable = true;
29068
29228
  let i2, ilen, value;
29069
29229
  for (i2 = 0, ilen = inputs.length; i2 < ilen; ++i2) {
29070
29230
  value = inputs[i2];
29071
29231
  if (value === void 0) {
29072
29232
  continue;
29073
29233
  }
29074
- if (context !== void 0 && typeof value === "function") {
29075
- value = value(context);
29076
- cacheable = false;
29077
- }
29078
- if (index2 !== void 0 && isArray(value)) {
29079
- value = value[index2 % value.length];
29080
- cacheable = false;
29081
- }
29082
29234
  if (value !== void 0) {
29083
- if (info && !cacheable) {
29084
- info.cacheable = false;
29085
- }
29086
29235
  return value;
29087
29236
  }
29088
29237
  }
@@ -39081,8 +39230,7 @@ var n = { value: () => {
39081
39230
  } };
39082
39231
  function e() {
39083
39232
  for (var t, n2 = 0, e2 = arguments.length, i2 = {}; n2 < e2; ++n2) {
39084
- if (!(t = arguments[n2] + "") || t in i2 || /[\s.]/.test(t))
39085
- throw new Error("illegal type: " + t);
39233
+ if (!(t = arguments[n2] + "") || t in i2 || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
39086
39234
  i2[t] = [];
39087
39235
  }
39088
39236
  return new r(i2);
@@ -39093,58 +39241,40 @@ function r(t) {
39093
39241
  function i(t, n2) {
39094
39242
  return t.trim().split(/^|\s+/).map(function(t2) {
39095
39243
  var e2 = "", r2 = t2.indexOf(".");
39096
- if (r2 >= 0 && (e2 = t2.slice(r2 + 1), t2 = t2.slice(0, r2)), t2 && !n2.hasOwnProperty(t2))
39097
- throw new Error("unknown type: " + t2);
39244
+ if (r2 >= 0 && (e2 = t2.slice(r2 + 1), t2 = t2.slice(0, r2)), t2 && !n2.hasOwnProperty(t2)) throw new Error("unknown type: " + t2);
39098
39245
  return { type: t2, name: e2 };
39099
39246
  });
39100
39247
  }
39101
39248
  function o(t, n2) {
39102
- for (var e2, r2 = 0, i2 = t.length; r2 < i2; ++r2)
39103
- if ((e2 = t[r2]).name === n2)
39104
- return e2.value;
39249
+ for (var e2, r2 = 0, i2 = t.length; r2 < i2; ++r2) if ((e2 = t[r2]).name === n2) return e2.value;
39105
39250
  }
39106
39251
  function a(t, e2, r2) {
39107
- for (var i2 = 0, o2 = t.length; i2 < o2; ++i2)
39108
- if (t[i2].name === e2) {
39109
- t[i2] = n, t = t.slice(0, i2).concat(t.slice(i2 + 1));
39110
- break;
39111
- }
39252
+ for (var i2 = 0, o2 = t.length; i2 < o2; ++i2) if (t[i2].name === e2) {
39253
+ t[i2] = n, t = t.slice(0, i2).concat(t.slice(i2 + 1));
39254
+ break;
39255
+ }
39112
39256
  return null != r2 && t.push({ name: e2, value: r2 }), t;
39113
39257
  }
39114
39258
  r.prototype = e.prototype = { constructor: r, on: function(t, n2) {
39115
39259
  var e2, r2 = this._, u2 = i(t + "", r2), s2 = -1, c2 = u2.length;
39116
39260
  if (!(arguments.length < 2)) {
39117
- if (null != n2 && "function" != typeof n2)
39118
- throw new Error("invalid callback: " + n2);
39119
- for (; ++s2 < c2; )
39120
- if (e2 = (t = u2[s2]).type)
39121
- r2[e2] = a(r2[e2], t.name, n2);
39122
- else if (null == n2)
39123
- for (e2 in r2)
39124
- r2[e2] = a(r2[e2], t.name, null);
39261
+ if (null != n2 && "function" != typeof n2) throw new Error("invalid callback: " + n2);
39262
+ for (; ++s2 < c2; ) if (e2 = (t = u2[s2]).type) r2[e2] = a(r2[e2], t.name, n2);
39263
+ else if (null == n2) for (e2 in r2) r2[e2] = a(r2[e2], t.name, null);
39125
39264
  return this;
39126
39265
  }
39127
- for (; ++s2 < c2; )
39128
- if ((e2 = (t = u2[s2]).type) && (e2 = o(r2[e2], t.name)))
39129
- return e2;
39266
+ for (; ++s2 < c2; ) if ((e2 = (t = u2[s2]).type) && (e2 = o(r2[e2], t.name))) return e2;
39130
39267
  }, copy: function() {
39131
39268
  var t = {}, n2 = this._;
39132
- for (var e2 in n2)
39133
- t[e2] = n2[e2].slice();
39269
+ for (var e2 in n2) t[e2] = n2[e2].slice();
39134
39270
  return new r(t);
39135
39271
  }, call: function(t, n2) {
39136
- if ((e2 = arguments.length - 2) > 0)
39137
- for (var e2, r2, i2 = new Array(e2), o2 = 0; o2 < e2; ++o2)
39138
- i2[o2] = arguments[o2 + 2];
39139
- if (!this._.hasOwnProperty(t))
39140
- throw new Error("unknown type: " + t);
39141
- for (o2 = 0, e2 = (r2 = this._[t]).length; o2 < e2; ++o2)
39142
- r2[o2].value.apply(n2, i2);
39272
+ if ((e2 = arguments.length - 2) > 0) for (var e2, r2, i2 = new Array(e2), o2 = 0; o2 < e2; ++o2) i2[o2] = arguments[o2 + 2];
39273
+ if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
39274
+ for (o2 = 0, e2 = (r2 = this._[t]).length; o2 < e2; ++o2) r2[o2].value.apply(n2, i2);
39143
39275
  }, apply: function(t, n2, e2) {
39144
- if (!this._.hasOwnProperty(t))
39145
- throw new Error("unknown type: " + t);
39146
- for (var r2 = this._[t], i2 = 0, o2 = r2.length; i2 < o2; ++i2)
39147
- r2[i2].value.apply(n2, e2);
39276
+ if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
39277
+ for (var r2 = this._[t], i2 = 0, o2 = r2.length; i2 < o2; ++i2) r2[i2].value.apply(n2, e2);
39148
39278
  } };
39149
39279
  var u = "http://www.w3.org/1999/xhtml", s = { svg: "http://www.w3.org/2000/svg", xhtml: u, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" };
39150
39280
  function c(t) {
@@ -39204,19 +39334,14 @@ function E(t) {
39204
39334
  };
39205
39335
  }
39206
39336
  function D(t, n2, e2, r2, i2, o2) {
39207
- for (var a2, u2 = 0, s2 = n2.length, c2 = o2.length; u2 < c2; ++u2)
39208
- (a2 = n2[u2]) ? (a2.__data__ = o2[u2], r2[u2] = a2) : e2[u2] = new A(t, o2[u2]);
39209
- for (; u2 < s2; ++u2)
39210
- (a2 = n2[u2]) && (i2[u2] = a2);
39337
+ for (var a2, u2 = 0, s2 = n2.length, c2 = o2.length; u2 < c2; ++u2) (a2 = n2[u2]) ? (a2.__data__ = o2[u2], r2[u2] = a2) : e2[u2] = new A(t, o2[u2]);
39338
+ for (; u2 < s2; ++u2) (a2 = n2[u2]) && (i2[u2] = a2);
39211
39339
  }
39212
39340
  function S(t, n2, e2, r2, i2, o2, a2) {
39213
39341
  var u2, s2, c2, l2 = /* @__PURE__ */ new Map(), f2 = n2.length, h3 = o2.length, p2 = new Array(f2);
39214
- for (u2 = 0; u2 < f2; ++u2)
39215
- (s2 = n2[u2]) && (p2[u2] = c2 = a2.call(s2, s2.__data__, u2, n2) + "", l2.has(c2) ? i2[u2] = s2 : l2.set(c2, s2));
39216
- for (u2 = 0; u2 < h3; ++u2)
39217
- c2 = a2.call(t, o2[u2], u2, o2) + "", (s2 = l2.get(c2)) ? (r2[u2] = s2, s2.__data__ = o2[u2], l2.delete(c2)) : e2[u2] = new A(t, o2[u2]);
39218
- for (u2 = 0; u2 < f2; ++u2)
39219
- (s2 = n2[u2]) && l2.get(p2[u2]) === s2 && (i2[u2] = s2);
39342
+ for (u2 = 0; u2 < f2; ++u2) (s2 = n2[u2]) && (p2[u2] = c2 = a2.call(s2, s2.__data__, u2, n2) + "", l2.has(c2) ? i2[u2] = s2 : l2.set(c2, s2));
39343
+ for (u2 = 0; u2 < h3; ++u2) c2 = a2.call(t, o2[u2], u2, o2) + "", (s2 = l2.get(c2)) ? (r2[u2] = s2, s2.__data__ = o2[u2], l2.delete(c2)) : e2[u2] = new A(t, o2[u2]);
39344
+ for (u2 = 0; u2 < f2; ++u2) (s2 = n2[u2]) && l2.get(p2[u2]) === s2 && (i2[u2] = s2);
39220
39345
  }
39221
39346
  function C(t) {
39222
39347
  return t.__data__;
@@ -39307,12 +39432,10 @@ function H(t) {
39307
39432
  this._node = t, this._names = F(t.getAttribute("class") || "");
39308
39433
  }
39309
39434
  function G(t, n2) {
39310
- for (var e2 = z(t), r2 = -1, i2 = n2.length; ++r2 < i2; )
39311
- e2.add(n2[r2]);
39435
+ for (var e2 = z(t), r2 = -1, i2 = n2.length; ++r2 < i2; ) e2.add(n2[r2]);
39312
39436
  }
39313
39437
  function K(t, n2) {
39314
- for (var e2 = z(t), r2 = -1, i2 = n2.length; ++r2 < i2; )
39315
- e2.remove(n2[r2]);
39438
+ for (var e2 = z(t), r2 = -1, i2 = n2.length; ++r2 < i2; ) e2.remove(n2[r2]);
39316
39439
  }
39317
39440
  function J(t) {
39318
39441
  return function() {
@@ -39388,23 +39511,20 @@ function ft(t) {
39388
39511
  return function() {
39389
39512
  var n2 = this.__on;
39390
39513
  if (n2) {
39391
- for (var e2, r2 = 0, i2 = -1, o2 = n2.length; r2 < o2; ++r2)
39392
- e2 = n2[r2], t.type && e2.type !== t.type || e2.name !== t.name ? n2[++i2] = e2 : this.removeEventListener(e2.type, e2.listener, e2.options);
39514
+ for (var e2, r2 = 0, i2 = -1, o2 = n2.length; r2 < o2; ++r2) e2 = n2[r2], t.type && e2.type !== t.type || e2.name !== t.name ? n2[++i2] = e2 : this.removeEventListener(e2.type, e2.listener, e2.options);
39393
39515
  ++i2 ? n2.length = i2 : delete this.__on;
39394
39516
  }
39395
39517
  };
39396
39518
  }
39397
39519
  function ht(t, n2, e2) {
39398
39520
  return function() {
39399
- var r2, i2 = this.__on, o2 = function(t2) {
39521
+ var r2, i2 = this.__on, o2 = /* @__PURE__ */ function(t2) {
39400
39522
  return function(n3) {
39401
39523
  t2.call(this, n3, this.__data__);
39402
39524
  };
39403
39525
  }(n2);
39404
39526
  if (i2) {
39405
- for (var a2 = 0, u2 = i2.length; a2 < u2; ++a2)
39406
- if ((r2 = i2[a2]).type === t.type && r2.name === t.name)
39407
- return this.removeEventListener(r2.type, r2.listener, r2.options), this.addEventListener(r2.type, r2.listener = o2, r2.options = e2), void (r2.value = n2);
39527
+ for (var a2 = 0, u2 = i2.length; a2 < u2; ++a2) if ((r2 = i2[a2]).type === t.type && r2.name === t.name) return this.removeEventListener(r2.type, r2.listener, r2.options), this.addEventListener(r2.type, r2.listener = o2, r2.options = e2), void (r2.value = n2);
39408
39528
  }
39409
39529
  this.addEventListener(t.type, o2, e2), r2 = { type: t.type, name: t.name, value: n2, listener: o2, options: e2 }, i2 ? i2.push(r2) : this.__on = [r2];
39410
39530
  };
@@ -39449,8 +39569,7 @@ function mt(t) {
39449
39569
  function _t(t, n2) {
39450
39570
  if (t = function(t2) {
39451
39571
  let n3;
39452
- for (; n3 = t2.sourceEvent; )
39453
- t2 = n3;
39572
+ for (; n3 = t2.sourceEvent; ) t2 = n3;
39454
39573
  return t2;
39455
39574
  }(t), void 0 === n2 && (n2 = t.currentTarget), n2) {
39456
39575
  var e2 = n2.ownerSVGElement || n2;
@@ -39467,12 +39586,10 @@ function _t(t, n2) {
39467
39586
  }
39468
39587
  yt.prototype = { constructor: yt, select: function(t) {
39469
39588
  "function" != typeof t && (t = d(t));
39470
- for (var n2 = this._groups, e2 = n2.length, r2 = new Array(e2), i2 = 0; i2 < e2; ++i2)
39471
- for (var o2, a2, u2 = n2[i2], s2 = u2.length, c2 = r2[i2] = new Array(s2), l2 = 0; l2 < s2; ++l2)
39472
- (o2 = u2[l2]) && (a2 = t.call(o2, o2.__data__, l2, u2)) && ("__data__" in o2 && (a2.__data__ = o2.__data__), c2[l2] = a2);
39589
+ for (var n2 = this._groups, e2 = n2.length, r2 = new Array(e2), i2 = 0; i2 < e2; ++i2) for (var o2, a2, u2 = n2[i2], s2 = u2.length, c2 = r2[i2] = new Array(s2), l2 = 0; l2 < s2; ++l2) (o2 = u2[l2]) && (a2 = t.call(o2, o2.__data__, l2, u2)) && ("__data__" in o2 && (a2.__data__ = o2.__data__), c2[l2] = a2);
39473
39590
  return new yt(r2, this._parents);
39474
39591
  }, selectAll: function(t) {
39475
- t = "function" == typeof t ? function(t2) {
39592
+ t = "function" == typeof t ? /* @__PURE__ */ function(t2) {
39476
39593
  return function() {
39477
39594
  return g(t2.apply(this, arguments));
39478
39595
  };
@@ -39481,46 +39598,39 @@ yt.prototype = { constructor: yt, select: function(t) {
39481
39598
  return this.querySelectorAll(t2);
39482
39599
  };
39483
39600
  }(t);
39484
- for (var n2 = this._groups, e2 = n2.length, r2 = [], i2 = [], o2 = 0; o2 < e2; ++o2)
39485
- for (var a2, u2 = n2[o2], s2 = u2.length, c2 = 0; c2 < s2; ++c2)
39486
- (a2 = u2[c2]) && (r2.push(t.call(a2, a2.__data__, c2, u2)), i2.push(a2));
39601
+ for (var n2 = this._groups, e2 = n2.length, r2 = [], i2 = [], o2 = 0; o2 < e2; ++o2) for (var a2, u2 = n2[o2], s2 = u2.length, c2 = 0; c2 < s2; ++c2) (a2 = u2[c2]) && (r2.push(t.call(a2, a2.__data__, c2, u2)), i2.push(a2));
39487
39602
  return new yt(r2, i2);
39488
39603
  }, selectChild: function(t) {
39489
- return this.select(null == t ? _ : function(t2) {
39604
+ return this.select(null == t ? _ : /* @__PURE__ */ function(t2) {
39490
39605
  return function() {
39491
39606
  return m.call(this.children, t2);
39492
39607
  };
39493
39608
  }("function" == typeof t ? t : y(t)));
39494
39609
  }, selectChildren: function(t) {
39495
- return this.selectAll(null == t ? x : function(t2) {
39610
+ return this.selectAll(null == t ? x : /* @__PURE__ */ function(t2) {
39496
39611
  return function() {
39497
39612
  return w.call(this.children, t2);
39498
39613
  };
39499
39614
  }("function" == typeof t ? t : y(t)));
39500
39615
  }, filter: function(t) {
39501
- "function" != typeof t && (t = function(t2) {
39616
+ "function" != typeof t && (t = /* @__PURE__ */ function(t2) {
39502
39617
  return function() {
39503
39618
  return this.matches(t2);
39504
39619
  };
39505
39620
  }(t));
39506
- for (var n2 = this._groups, e2 = n2.length, r2 = new Array(e2), i2 = 0; i2 < e2; ++i2)
39507
- for (var o2, a2 = n2[i2], u2 = a2.length, s2 = r2[i2] = [], c2 = 0; c2 < u2; ++c2)
39508
- (o2 = a2[c2]) && t.call(o2, o2.__data__, c2, a2) && s2.push(o2);
39621
+ for (var n2 = this._groups, e2 = n2.length, r2 = new Array(e2), i2 = 0; i2 < e2; ++i2) for (var o2, a2 = n2[i2], u2 = a2.length, s2 = r2[i2] = [], c2 = 0; c2 < u2; ++c2) (o2 = a2[c2]) && t.call(o2, o2.__data__, c2, a2) && s2.push(o2);
39509
39622
  return new yt(r2, this._parents);
39510
39623
  }, data: function(t, n2) {
39511
- if (!arguments.length)
39512
- return Array.from(this, C);
39624
+ if (!arguments.length) return Array.from(this, C);
39513
39625
  var e2 = n2 ? S : D, r2 = this._parents, i2 = this._groups;
39514
39626
  "function" != typeof t && (t = E(t));
39515
39627
  for (var o2 = i2.length, a2 = new Array(o2), u2 = new Array(o2), s2 = new Array(o2), c2 = 0; c2 < o2; ++c2) {
39516
39628
  var l2 = r2[c2], f2 = i2[c2], h3 = f2.length, p2 = M(t.call(l2, l2 && l2.__data__, c2, r2)), d2 = p2.length, g2 = u2[c2] = new Array(d2), v2 = a2[c2] = new Array(d2), y2 = s2[c2] = new Array(h3);
39517
39629
  e2(l2, f2, g2, v2, y2, p2, n2);
39518
- for (var m2, _2, w2 = 0, x2 = 0; w2 < d2; ++w2)
39519
- if (m2 = g2[w2]) {
39520
- for (w2 >= x2 && (x2 = w2 + 1); !(_2 = v2[x2]) && ++x2 < d2; )
39521
- ;
39522
- m2._next = _2 || null;
39523
- }
39630
+ for (var m2, _2, w2 = 0, x2 = 0; w2 < d2; ++w2) if (m2 = g2[w2]) {
39631
+ for (w2 >= x2 && (x2 = w2 + 1); !(_2 = v2[x2]) && ++x2 < d2; ) ;
39632
+ m2._next = _2 || null;
39633
+ }
39524
39634
  }
39525
39635
  return (a2 = new yt(a2, r2))._enter = u2, a2._exit = s2, a2;
39526
39636
  }, enter: function() {
@@ -39531,18 +39641,13 @@ yt.prototype = { constructor: yt, select: function(t) {
39531
39641
  var r2 = this.enter(), i2 = this, o2 = this.exit();
39532
39642
  return "function" == typeof t ? (r2 = t(r2)) && (r2 = r2.selection()) : r2 = r2.append(t + ""), null != n2 && (i2 = n2(i2)) && (i2 = i2.selection()), null == e2 ? o2.remove() : e2(o2), r2 && i2 ? r2.merge(i2).order() : i2;
39533
39643
  }, merge: function(t) {
39534
- for (var n2 = t.selection ? t.selection() : t, e2 = this._groups, r2 = n2._groups, i2 = e2.length, o2 = r2.length, a2 = Math.min(i2, o2), u2 = new Array(i2), s2 = 0; s2 < a2; ++s2)
39535
- for (var c2, l2 = e2[s2], f2 = r2[s2], h3 = l2.length, p2 = u2[s2] = new Array(h3), d2 = 0; d2 < h3; ++d2)
39536
- (c2 = l2[d2] || f2[d2]) && (p2[d2] = c2);
39537
- for (; s2 < i2; ++s2)
39538
- u2[s2] = e2[s2];
39644
+ for (var n2 = t.selection ? t.selection() : t, e2 = this._groups, r2 = n2._groups, i2 = e2.length, o2 = r2.length, a2 = Math.min(i2, o2), u2 = new Array(i2), s2 = 0; s2 < a2; ++s2) for (var c2, l2 = e2[s2], f2 = r2[s2], h3 = l2.length, p2 = u2[s2] = new Array(h3), d2 = 0; d2 < h3; ++d2) (c2 = l2[d2] || f2[d2]) && (p2[d2] = c2);
39645
+ for (; s2 < i2; ++s2) u2[s2] = e2[s2];
39539
39646
  return new yt(u2, this._parents);
39540
39647
  }, selection: function() {
39541
39648
  return this;
39542
39649
  }, order: function() {
39543
- for (var t = this._groups, n2 = -1, e2 = t.length; ++n2 < e2; )
39544
- for (var r2, i2 = t[n2], o2 = i2.length - 1, a2 = i2[o2]; --o2 >= 0; )
39545
- (r2 = i2[o2]) && (a2 && 4 ^ r2.compareDocumentPosition(a2) && a2.parentNode.insertBefore(r2, a2), a2 = r2);
39650
+ for (var t = this._groups, n2 = -1, e2 = t.length; ++n2 < e2; ) for (var r2, i2 = t[n2], o2 = i2.length - 1, a2 = i2[o2]; --o2 >= 0; ) (r2 = i2[o2]) && (a2 && 4 ^ r2.compareDocumentPosition(a2) && a2.parentNode.insertBefore(r2, a2), a2 = r2);
39546
39651
  return this;
39547
39652
  }, sort: function(t) {
39548
39653
  function n2(n3, e3) {
@@ -39550,8 +39655,7 @@ yt.prototype = { constructor: yt, select: function(t) {
39550
39655
  }
39551
39656
  t || (t = N);
39552
39657
  for (var e2 = this._groups, r2 = e2.length, i2 = new Array(r2), o2 = 0; o2 < r2; ++o2) {
39553
- for (var a2, u2 = e2[o2], s2 = u2.length, c2 = i2[o2] = new Array(s2), l2 = 0; l2 < s2; ++l2)
39554
- (a2 = u2[l2]) && (c2[l2] = a2);
39658
+ for (var a2, u2 = e2[o2], s2 = u2.length, c2 = i2[o2] = new Array(s2), l2 = 0; l2 < s2; ++l2) (a2 = u2[l2]) && (c2[l2] = a2);
39555
39659
  c2.sort(n2);
39556
39660
  }
39557
39661
  return new yt(i2, this._parents).order();
@@ -39561,24 +39665,19 @@ yt.prototype = { constructor: yt, select: function(t) {
39561
39665
  }, nodes: function() {
39562
39666
  return Array.from(this);
39563
39667
  }, node: function() {
39564
- for (var t = this._groups, n2 = 0, e2 = t.length; n2 < e2; ++n2)
39565
- for (var r2 = t[n2], i2 = 0, o2 = r2.length; i2 < o2; ++i2) {
39566
- var a2 = r2[i2];
39567
- if (a2)
39568
- return a2;
39569
- }
39668
+ for (var t = this._groups, n2 = 0, e2 = t.length; n2 < e2; ++n2) for (var r2 = t[n2], i2 = 0, o2 = r2.length; i2 < o2; ++i2) {
39669
+ var a2 = r2[i2];
39670
+ if (a2) return a2;
39671
+ }
39570
39672
  return null;
39571
39673
  }, size: function() {
39572
39674
  let t = 0;
39573
- for (const n2 of this)
39574
- ++t;
39675
+ for (const n2 of this) ++t;
39575
39676
  return t;
39576
39677
  }, empty: function() {
39577
39678
  return !this.node();
39578
39679
  }, each: function(t) {
39579
- for (var n2 = this._groups, e2 = 0, r2 = n2.length; e2 < r2; ++e2)
39580
- for (var i2, o2 = n2[e2], a2 = 0, u2 = o2.length; a2 < u2; ++a2)
39581
- (i2 = o2[a2]) && t.call(i2, i2.__data__, a2, o2);
39680
+ for (var n2 = this._groups, e2 = 0, r2 = n2.length; e2 < r2; ++e2) for (var i2, o2 = n2[e2], a2 = 0, u2 = o2.length; a2 < u2; ++a2) (i2 = o2[a2]) && t.call(i2, i2.__data__, a2, o2);
39582
39681
  return this;
39583
39682
  }, attr: function(t, n2) {
39584
39683
  var e2 = c(t);
@@ -39594,9 +39693,7 @@ yt.prototype = { constructor: yt, select: function(t) {
39594
39693
  }, classed: function(t, n2) {
39595
39694
  var e2 = F(t + "");
39596
39695
  if (arguments.length < 2) {
39597
- for (var r2 = z(this.node()), i2 = -1, o2 = e2.length; ++i2 < o2; )
39598
- if (!r2.contains(e2[i2]))
39599
- return false;
39696
+ for (var r2 = z(this.node()), i2 = -1, o2 = e2.length; ++i2 < o2; ) if (!r2.contains(e2[i2])) return false;
39600
39697
  return true;
39601
39698
  }
39602
39699
  return this.each(("function" == typeof n2 ? W : n2 ? J : Q)(e2, n2));
@@ -39627,23 +39724,17 @@ yt.prototype = { constructor: yt, select: function(t) {
39627
39724
  }, on: function(t, n2, e2) {
39628
39725
  var r2, i2, o2 = lt(t + ""), a2 = o2.length;
39629
39726
  if (!(arguments.length < 2)) {
39630
- for (u2 = n2 ? ht : ft, r2 = 0; r2 < a2; ++r2)
39631
- this.each(u2(o2[r2], n2, e2));
39727
+ for (u2 = n2 ? ht : ft, r2 = 0; r2 < a2; ++r2) this.each(u2(o2[r2], n2, e2));
39632
39728
  return this;
39633
39729
  }
39634
39730
  var u2 = this.node().__on;
39635
39731
  if (u2) {
39636
- for (var s2, c2 = 0, l2 = u2.length; c2 < l2; ++c2)
39637
- for (r2 = 0, s2 = u2[c2]; r2 < a2; ++r2)
39638
- if ((i2 = o2[r2]).type === s2.type && i2.name === s2.name)
39639
- return s2.value;
39732
+ for (var s2, c2 = 0, l2 = u2.length; c2 < l2; ++c2) for (r2 = 0, s2 = u2[c2]; r2 < a2; ++r2) if ((i2 = o2[r2]).type === s2.type && i2.name === s2.name) return s2.value;
39640
39733
  }
39641
39734
  }, dispatch: function(t, n2) {
39642
39735
  return this.each(("function" == typeof n2 ? gt : dt)(t, n2));
39643
39736
  }, [Symbol.iterator]: function* () {
39644
- for (var t = this._groups, n2 = 0, e2 = t.length; n2 < e2; ++n2)
39645
- for (var r2, i2 = t[n2], o2 = 0, a2 = i2.length; o2 < a2; ++o2)
39646
- (r2 = i2[o2]) && (yield r2);
39737
+ for (var t = this._groups, n2 = 0, e2 = t.length; n2 < e2; ++n2) for (var r2, i2 = t[n2], o2 = 0, a2 = i2.length; o2 < a2; ++o2) (r2 = i2[o2]) && (yield r2);
39647
39738
  } };
39648
39739
  const wt = { passive: false }, xt = { capture: true, passive: false };
39649
39740
  function bt(t) {
@@ -39700,38 +39791,34 @@ function Pt() {
39700
39791
  function y2(t2, n3) {
39701
39792
  if (o2.call(this, t2, n3)) {
39702
39793
  var e2, r3, i3 = t2.changedTouches, u3 = a2.call(this, t2, n3), s3 = i3.length;
39703
- for (e2 = 0; e2 < s3; ++e2)
39704
- (r3 = w2(this, u3, t2, n3, i3[e2].identifier, i3[e2])) && (bt(t2), r3("start", t2, i3[e2]));
39794
+ for (e2 = 0; e2 < s3; ++e2) (r3 = w2(this, u3, t2, n3, i3[e2].identifier, i3[e2])) && (bt(t2), r3("start", t2, i3[e2]));
39705
39795
  }
39706
39796
  }
39707
39797
  function m2(t2) {
39708
39798
  var n3, e2, r3 = t2.changedTouches, i3 = r3.length;
39709
- for (n3 = 0; n3 < i3; ++n3)
39710
- (e2 = c2[r3[n3].identifier]) && (At(t2), e2("drag", t2, r3[n3]));
39799
+ for (n3 = 0; n3 < i3; ++n3) (e2 = c2[r3[n3].identifier]) && (At(t2), e2("drag", t2, r3[n3]));
39711
39800
  }
39712
39801
  function _2(t2) {
39713
39802
  var n3, e2, r3 = t2.changedTouches, o3 = r3.length;
39714
39803
  for (i2 && clearTimeout(i2), i2 = setTimeout(function() {
39715
39804
  i2 = null;
39716
- }, 500), n3 = 0; n3 < o3; ++n3)
39717
- (e2 = c2[r3[n3].identifier]) && (bt(t2), e2("end", t2, r3[n3]));
39805
+ }, 500), n3 = 0; n3 < o3; ++n3) (e2 = c2[r3[n3].identifier]) && (bt(t2), e2("end", t2, r3[n3]));
39718
39806
  }
39719
39807
  function w2(t2, n3, e2, r3, i3, o3) {
39720
39808
  var a3, s3, h4, d3 = l2.copy(), g3 = _t(o3 || e2, n3);
39721
- if (null != (h4 = u2.call(t2, new Dt("beforestart", { sourceEvent: e2, target: p2, identifier: i3, active: f2, x: g3[0], y: g3[1], dx: 0, dy: 0, dispatch: d3 }), r3)))
39722
- return a3 = h4.x - g3[0] || 0, s3 = h4.y - g3[1] || 0, function e3(o4, u3, l3) {
39723
- var v3, y3 = g3;
39724
- switch (o4) {
39725
- case "start":
39726
- c2[i3] = e3, v3 = f2++;
39727
- break;
39728
- case "end":
39729
- delete c2[i3], --f2;
39730
- case "drag":
39731
- g3 = _t(l3 || u3, n3), v3 = f2;
39732
- }
39733
- d3.call(o4, t2, new Dt(o4, { sourceEvent: u3, subject: h4, target: p2, identifier: i3, active: v3, x: g3[0] + a3, y: g3[1] + s3, dx: g3[0] - y3[0], dy: g3[1] - y3[1], dispatch: d3 }), r3);
39734
- };
39809
+ if (null != (h4 = u2.call(t2, new Dt("beforestart", { sourceEvent: e2, target: p2, identifier: i3, active: f2, x: g3[0], y: g3[1], dx: 0, dy: 0, dispatch: d3 }), r3))) return a3 = h4.x - g3[0] || 0, s3 = h4.y - g3[1] || 0, function e3(o4, u3, l3) {
39810
+ var v3, y3 = g3;
39811
+ switch (o4) {
39812
+ case "start":
39813
+ c2[i3] = e3, v3 = f2++;
39814
+ break;
39815
+ case "end":
39816
+ delete c2[i3], --f2;
39817
+ case "drag":
39818
+ g3 = _t(l3 || u3, n3), v3 = f2;
39819
+ }
39820
+ d3.call(o4, t2, new Dt(o4, { sourceEvent: u3, subject: h4, target: p2, identifier: i3, active: v3, x: g3[0] + a3, y: g3[1] + s3, dx: g3[0] - y3[0], dy: g3[1] - y3[1], dispatch: d3 }), r3);
39821
+ };
39735
39822
  }
39736
39823
  return p2.filter = function(t2) {
39737
39824
  return arguments.length ? (o2 = "function" == typeof t2 ? t2 : Et(!!t2), p2) : o2;
@@ -39771,17 +39858,15 @@ const zt = (t, n2, e2, r2) => {
39771
39858
  if (Bt) {
39772
39859
  Xt = Bt.datasetIndex, jt = Bt.index, qt = true;
39773
39860
  let i2 = n2.data.datasets[Xt].data[jt];
39774
- if ("radar" === Rt || "polarArea" === Rt)
39775
- i2 = function(t2, n3) {
39776
- let e3, r3, i3;
39777
- t2.touches ? (e3 = t2.touches[0].clientX - n3.canvas.getBoundingClientRect().left, r3 = t2.touches[0].clientY - n3.canvas.getBoundingClientRect().top) : (e3 = t2.clientX - n3.canvas.getBoundingClientRect().left, r3 = t2.clientY - n3.canvas.getBoundingClientRect().top);
39778
- let o2 = n3.scales[It], a2 = Math.sqrt(Math.pow(e3 - o2.xCenter, 2) + Math.pow(r3 - o2.yCenter, 2)), u2 = o2.drawingArea / (o2.max - o2.min);
39779
- return i3 = o2.options.ticks.reverse ? o2.max - a2 / u2 : o2.min + a2 / u2, i3 = Ut(i3, n3.config.options.plugins.dragData.round), i3 = i3 > n3.scales[It].max ? n3.scales[It].max : i3, i3 = i3 < n3.scales[It].min ? n3.scales[It].min : i3, i3;
39780
- }(t, n2);
39861
+ if ("radar" === Rt || "polarArea" === Rt) i2 = function(t2, n3) {
39862
+ let e3, r3, i3;
39863
+ t2.touches ? (e3 = t2.touches[0].clientX - n3.canvas.getBoundingClientRect().left, r3 = t2.touches[0].clientY - n3.canvas.getBoundingClientRect().top) : (e3 = t2.clientX - n3.canvas.getBoundingClientRect().left, r3 = t2.clientY - n3.canvas.getBoundingClientRect().top);
39864
+ let o2 = n3.scales[It], a2 = Math.sqrt(Math.pow(e3 - o2.xCenter, 2) + Math.pow(r3 - o2.yCenter, 2)), u2 = o2.drawingArea / (o2.max - o2.min);
39865
+ return i3 = o2.options.ticks.reverse ? o2.max - a2 / u2 : o2.min + a2 / u2, i3 = Ut(i3, n3.config.options.plugins.dragData.round), i3 = i3 > n3.scales[It].max ? n3.scales[It].max : i3, i3 = i3 < n3.scales[It].min ? n3.scales[It].min : i3, i3;
39866
+ }(t, n2);
39781
39867
  else if (Lt) {
39782
39868
  i2 = Ut(Ft(t, n2, Xt, jt) - Vt, e2.round);
39783
- } else
39784
- i2 = Ft(t, n2, Xt, jt);
39869
+ } else i2 = Ft(t, n2, Xt, jt);
39785
39870
  (!r2 || "function" == typeof r2 && false !== r2(t, Xt, jt, i2)) && (n2.data.datasets[Xt].data[jt] = i2, n2.update("none"));
39786
39871
  }
39787
39872
  };
@@ -39800,8 +39885,7 @@ const Ht = { id: "dragdata", afterInit: function(t) {
39800
39885
  }(() => n3.config.options.plugins.tooltip.animation);
39801
39886
  const o2 = n3.data.datasets[r2], a2 = n3.getDatasetMeta(r2);
39802
39887
  let u2 = o2.data[i2];
39803
- if (kt = a2.xAxisID, Tt = a2.yAxisID, It = a2.rAxisID, false === o2.dragData || n3.config.options.scales[kt] && false === n3.config.options.scales[kt].dragData || n3.config.options.scales[Tt] && false === n3.config.options.scales[Tt].dragData || n3.config.options.scales[It] && false === n3.config.options.scales[It].rAxisID || false === o2.data[Bt.index].dragData)
39804
- return void (Bt = null);
39888
+ if (kt = a2.xAxisID, Tt = a2.yAxisID, It = a2.rAxisID, false === o2.dragData || n3.config.options.scales[kt] && false === n3.config.options.scales[kt].dragData || n3.config.options.scales[Tt] && false === n3.config.options.scales[Tt].dragData || n3.config.options.scales[It] && false === n3.config.options.scales[It].rAxisID || false === o2.data[Bt.index].dragData) return void (Bt = null);
39805
39889
  if ("bar" === Rt) {
39806
39890
  Lt = n3.config.options.scales[kt].stacked;
39807
39891
  const e4 = n3.data.datasets[0].data[0];
@@ -39816,8 +39900,7 @@ const Ht = { id: "dragdata", afterInit: function(t) {
39816
39900
  const r2 = Bt.datasetIndex, i2 = Bt.index;
39817
39901
  let o2 = function(t3, n4, e4) {
39818
39902
  const r3 = t3.config.options.plugins.dragData;
39819
- if (!r3.magnet)
39820
- return t3.data.datasets[n4].data[e4];
39903
+ if (!r3.magnet) return t3.data.datasets[n4].data[e4];
39821
39904
  {
39822
39905
  const i3 = r3.magnet;
39823
39906
  if (i3.to && "function" == typeof i3.to) {
@@ -39831,8 +39914,7 @@ const Ht = { id: "dragdata", afterInit: function(t) {
39831
39914
  })(e2.sourceEvent, t, n2.onDragEnd)));
39832
39915
  }
39833
39916
  }, beforeEvent: function(t) {
39834
- if (qt)
39835
- return t.tooltip && t.tooltip.update(), false;
39917
+ if (qt) return t.tooltip && t.tooltip.update(), false;
39836
39918
  } };
39837
39919
  Chart.register(Ht);
39838
39920
  const useBarChartConfig = (chartRef, chart2) => {
@@ -40055,8 +40137,7 @@ const getBarChartToolTips = (options) => {
40055
40137
  const x2 = Array.isArray((_a3 = options.axes) == null ? void 0 : _a3.x) ? options.axes.x : [];
40056
40138
  const y2 = Array.isArray((_b2 = options.axes) == null ? void 0 : _b2.y) ? options.axes.y : [];
40057
40139
  const getAxisIndex = (axisID) => {
40058
- if (!axisID)
40059
- return 0;
40140
+ if (!axisID) return 0;
40060
40141
  const match = axisID.match(/\d+$/);
40061
40142
  return match ? parseInt(match[0], 10) - 1 : 0;
40062
40143
  };
@@ -40687,8 +40768,7 @@ const gradientBackgroundPlugin = {
40687
40768
  gradientColors,
40688
40769
  direction = GradientDirection.BottomLeftToTopRight
40689
40770
  } = gradientOptions ?? {};
40690
- if (!display || !gradientColors || gradientColors.length === 0)
40691
- return;
40771
+ if (!display || !gradientColors || gradientColors.length === 0) return;
40692
40772
  const [x0, y0, x1, y1] = getGradientCoordinates(direction, chartArea);
40693
40773
  const gradient = ctx.createLinearGradient(x0, y0, x1, y1);
40694
40774
  gradientColors.forEach(({ offset, color: color2 }) => {
@@ -40784,9 +40864,13 @@ const ScatterChartWithLegend = (props) => {
40784
40864
  return /* @__PURE__ */ jsx(LegendProvider, { options, children: /* @__PURE__ */ jsx(ScatterChart, { ...props }) });
40785
40865
  };
40786
40866
  export {
40867
+ AlignOptions,
40868
+ AnnotationType$1 as AnnotationType,
40787
40869
  BarChartWithLegend as BarChart,
40788
40870
  LineChartWithLegend as LineChart,
40789
40871
  PieChartWithLegend as PieChart,
40872
+ PointStyle,
40873
+ Position,
40790
40874
  ScatterChartWithLegend as ScatterChart,
40791
40875
  initializeLineChart
40792
40876
  };
@@ -40796,7 +40880,7 @@ export {
40796
40880
  try {
40797
40881
  if (typeof document != "undefined") {
40798
40882
  var elementStyle = document.createElement("style");
40799
- elementStyle.appendChild(document.createTextNode("html[data-theme='dark'] ._chart_e3qdd_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_e3qdd_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_e3qdd_1._fixedHeight_e3qdd_20 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_e3qdd_1._stretchHeight_e3qdd_26 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_e3qdd_1._squareAspectRatio_e3qdd_32 {\n aspect-ratio: 1;\n min-height: 0;\n min-width: 0;\n}\n._chart_e3qdd_1:focus {\n outline: none;\n}\n._chart_e3qdd_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_e3qdd_43 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_e3qdd_43 ._zoomReset_e3qdd_51 {\n margin-left: 10px;\n}\n._zoomForm_e3qdd_43 ._help_e3qdd_54 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_e3qdd_58 {\n width: auto;\n height: auto;\n}\n._table_e3qdd_62 {\n overflow: auto;\n}\n._controls_1961q_1 {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--padding-xs);\n}\n._buttons_1961q_7 {\n display: flex;\n flex-grow: 1;\n align-items: flex-start;\n justify-content: flex-end;\n margin-left: auto;\n gap: var(--padding-xxs);\n}\n._legend_wpro0_1 {\n position: absolute;\n opacity: 0.9;\n display: flex;\n flex-direction: column;\n z-index: 1;\n}\n._legend_wpro0_1._isDragging_wpro0_8 {\n opacity: 0;\n}\n._legendItems_wpro0_11 {\n background-color: var(--color-background-raised);\n border: 1px solid var(--color-border);\n padding: 4px 8px;\n border-radius: 2px;\n overflow-y: auto;\n max-height: 100%;\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._legendItems_wpro0_11::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-button {\n display: none;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n pointer-events: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n display: none;\n}\n._legendToggle_wpro0_50 {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50,\n._legend_wpro0_1:hover ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: block;\n}\n._legend_wpro0_1:active ._legendToggle_wpro0_50._legendToggle_wpro0_50:not(:hover) {\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n position: static;\n transform: none;\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: none;\n}\n._legendItem_wpro0_11 {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n user-select: none;\n cursor: pointer;\n font-size: 12px;\n line-height: 16px;\n}\n._legendItemSymbol_wpro0_80 {\n display: flex;\n align-items: center;\n height: 16px;\n position: relative;\n flex-shrink: 0;\n}\nhtml[data-theme='dark'] ._legendItemSymbol_wpro0_80._legendItemSymbol_wpro0_80 {\n filter: invert(1) hue-rotate(180deg);\n}\n._legendItemBox_wpro0_90 {\n width: 100%;\n height: 12px;\n display: block;\n}\n._legendItemLine_wpro0_95 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 0;\n width: 100%;\n transform: translateY(-50%);\n}\n._legendItemPoint_wpro0_103 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n._isHidden_wpro0_47 ._legendItemText_wpro0_110._legendItemText_wpro0_110 {\n text-decoration: line-through;\n}\n._scrollbars_wpro0_113 {\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-button {\n display: none;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._dropzoneContainer_wpro0_140 {\n position: absolute;\n}\n._dropzone_wpro0_140 {\n position: absolute;\n width: 50%;\n height: 50%;\n display: flex;\n}\n._dropzone_wpro0_140._left_wpro0_149 {\n left: 0;\n justify-content: flex-start;\n}\n._dropzone_wpro0_140._right_wpro0_153 {\n right: 0;\n justify-content: flex-end;\n}\n._dropzone_wpro0_140._top_wpro0_157 {\n top: 0;\n align-items: flex-start;\n}\n._dropzone_wpro0_140._bottom_wpro0_161 {\n bottom: 0;\n align-items: flex-end;\n}\n._dropzonePlaceholder_wpro0_165 {\n position: absolute;\n background-color: rgba(0, 0, 0, 0.05);\n display: none;\n}\n[data-theme='dark'] ._dropzonePlaceholder_wpro0_165 {\n background-color: rgba(255, 255, 255, 0.05);\n}\n._isActive_wpro0_173 ._dropzonePlaceholder_wpro0_165._dropzonePlaceholder_wpro0_165 {\n display: block;\n}\n._resizeContainer_wpro0_176 {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\nhtml[data-theme='dark'] ._chart_1jdnu_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1jdnu_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1jdnu_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1jdnu_1._fixedHeight_1jdnu_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1jdnu_1._stretchHeight_1jdnu_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1jdnu_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1jdnu_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1jdnu_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1jdnu_32 ._zoomReset_1jdnu_40 {\n margin-left: 10px;\n}\n._zoomForm_1jdnu_32 ._help_1jdnu_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1jdnu_47 {\n width: 'auto';\n height: 'auto';\n}\nhtml[data-theme='dark'] ._chart_x1sru_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_x1sru_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n}\n._chart_x1sru_1 ._canvas_x1sru_10 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_x1sru_1 ._canvas_x1sru_10 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_x1sru_1._fixedHeight_x1sru_19 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_x1sru_1._stretchHeight_x1sru_25 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_x1sru_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_x1sru_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_x1sru_38 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_x1sru_38 ._zoomReset_x1sru_46 {\n margin-left: 10px;\n}\n._zoomForm_x1sru_38 ._help_x1sru_49 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_x1sru_53 {\n width: auto;\n height: auto;\n}\n._actions_x1sru_57 {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n}\nhtml[data-theme='dark'] ._chart_1jdnu_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1jdnu_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1jdnu_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1jdnu_1._fixedHeight_1jdnu_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1jdnu_1._stretchHeight_1jdnu_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1jdnu_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1jdnu_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1jdnu_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1jdnu_32 ._zoomReset_1jdnu_40 {\n margin-left: 10px;\n}\n._zoomForm_1jdnu_32 ._help_1jdnu_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1jdnu_47 {\n width: 'auto';\n height: 'auto';\n}"));
40883
+ elementStyle.appendChild(document.createTextNode("html[data-theme='dark'] ._chart_e3qdd_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_e3qdd_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_e3qdd_1._fixedHeight_e3qdd_20 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_e3qdd_1._stretchHeight_e3qdd_26 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_e3qdd_1._squareAspectRatio_e3qdd_32 {\n aspect-ratio: 1;\n min-height: 0;\n min-width: 0;\n}\n._chart_e3qdd_1:focus {\n outline: none;\n}\n._chart_e3qdd_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_e3qdd_43 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_e3qdd_43 ._zoomReset_e3qdd_51 {\n margin-left: 10px;\n}\n._zoomForm_e3qdd_43 ._help_e3qdd_54 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_e3qdd_58 {\n width: auto;\n height: auto;\n}\n._table_e3qdd_62 {\n overflow: auto;\n}\n._controls_1edjs_1 {\n display: flex;\n align-items: center;\n gap: var(--padding-xs);\n}\n._buttons_1edjs_6 {\n display: flex;\n flex-grow: 1;\n align-items: flex-start;\n justify-content: flex-end;\n margin-left: auto;\n gap: var(--padding-xxs);\n}\n._legend_wpro0_1 {\n position: absolute;\n opacity: 0.9;\n display: flex;\n flex-direction: column;\n z-index: 1;\n}\n._legend_wpro0_1._isDragging_wpro0_8 {\n opacity: 0;\n}\n._legendItems_wpro0_11 {\n background-color: var(--color-background-raised);\n border: 1px solid var(--color-border);\n padding: 4px 8px;\n border-radius: 2px;\n overflow-y: auto;\n max-height: 100%;\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._legendItems_wpro0_11::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-button {\n display: none;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n pointer-events: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n display: none;\n}\n._legendToggle_wpro0_50 {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50,\n._legend_wpro0_1:hover ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: block;\n}\n._legend_wpro0_1:active ._legendToggle_wpro0_50._legendToggle_wpro0_50:not(:hover) {\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n position: static;\n transform: none;\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: none;\n}\n._legendItem_wpro0_11 {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n user-select: none;\n cursor: pointer;\n font-size: 12px;\n line-height: 16px;\n}\n._legendItemSymbol_wpro0_80 {\n display: flex;\n align-items: center;\n height: 16px;\n position: relative;\n flex-shrink: 0;\n}\nhtml[data-theme='dark'] ._legendItemSymbol_wpro0_80._legendItemSymbol_wpro0_80 {\n filter: invert(1) hue-rotate(180deg);\n}\n._legendItemBox_wpro0_90 {\n width: 100%;\n height: 12px;\n display: block;\n}\n._legendItemLine_wpro0_95 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 0;\n width: 100%;\n transform: translateY(-50%);\n}\n._legendItemPoint_wpro0_103 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n._isHidden_wpro0_47 ._legendItemText_wpro0_110._legendItemText_wpro0_110 {\n text-decoration: line-through;\n}\n._scrollbars_wpro0_113 {\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-button {\n display: none;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._dropzoneContainer_wpro0_140 {\n position: absolute;\n}\n._dropzone_wpro0_140 {\n position: absolute;\n width: 50%;\n height: 50%;\n display: flex;\n}\n._dropzone_wpro0_140._left_wpro0_149 {\n left: 0;\n justify-content: flex-start;\n}\n._dropzone_wpro0_140._right_wpro0_153 {\n right: 0;\n justify-content: flex-end;\n}\n._dropzone_wpro0_140._top_wpro0_157 {\n top: 0;\n align-items: flex-start;\n}\n._dropzone_wpro0_140._bottom_wpro0_161 {\n bottom: 0;\n align-items: flex-end;\n}\n._dropzonePlaceholder_wpro0_165 {\n position: absolute;\n background-color: rgba(0, 0, 0, 0.05);\n display: none;\n}\n[data-theme='dark'] ._dropzonePlaceholder_wpro0_165 {\n background-color: rgba(255, 255, 255, 0.05);\n}\n._isActive_wpro0_173 ._dropzonePlaceholder_wpro0_165._dropzonePlaceholder_wpro0_165 {\n display: block;\n}\n._resizeContainer_wpro0_176 {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\nhtml[data-theme='dark'] ._chart_1jdnu_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1jdnu_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1jdnu_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1jdnu_1._fixedHeight_1jdnu_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1jdnu_1._stretchHeight_1jdnu_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1jdnu_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1jdnu_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1jdnu_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1jdnu_32 ._zoomReset_1jdnu_40 {\n margin-left: 10px;\n}\n._zoomForm_1jdnu_32 ._help_1jdnu_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1jdnu_47 {\n width: 'auto';\n height: 'auto';\n}\nhtml[data-theme='dark'] ._chart_x1sru_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_x1sru_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n}\n._chart_x1sru_1 ._canvas_x1sru_10 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_x1sru_1 ._canvas_x1sru_10 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_x1sru_1._fixedHeight_x1sru_19 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_x1sru_1._stretchHeight_x1sru_25 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_x1sru_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_x1sru_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_x1sru_38 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_x1sru_38 ._zoomReset_x1sru_46 {\n margin-left: 10px;\n}\n._zoomForm_x1sru_38 ._help_x1sru_49 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_x1sru_53 {\n width: auto;\n height: auto;\n}\n._actions_x1sru_57 {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n}\nhtml[data-theme='dark'] ._chart_1jdnu_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1jdnu_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1jdnu_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1jdnu_1._fixedHeight_1jdnu_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1jdnu_1._stretchHeight_1jdnu_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1jdnu_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1jdnu_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1jdnu_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1jdnu_32 ._zoomReset_1jdnu_40 {\n margin-left: 10px;\n}\n._zoomForm_1jdnu_32 ._help_1jdnu_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1jdnu_47 {\n width: 'auto';\n height: 'auto';\n}"));
40800
40884
  document.head.appendChild(elementStyle);
40801
40885
  }
40802
40886
  } catch (e) {