@apia/charts 1.0.4 → 2.0.1

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.
Files changed (81) hide show
  1. package/dist/charts/ChartContext.js +6 -0
  2. package/dist/charts/ChartContext.js.map +1 -0
  3. package/dist/charts/ChartRenderer.d.ts +17 -0
  4. package/dist/charts/ChartRenderer.d.ts.map +1 -0
  5. package/dist/charts/ChartRenderer.js +175 -0
  6. package/dist/charts/ChartRenderer.js.map +1 -0
  7. package/dist/charts/horizontalBars/Bar.js +226 -0
  8. package/dist/charts/horizontalBars/Bar.js.map +1 -0
  9. package/dist/charts/horizontalBars/HorizontalBars.js +374 -0
  10. package/dist/charts/horizontalBars/HorizontalBars.js.map +1 -0
  11. package/dist/charts/linear/LineChart.js +528 -0
  12. package/dist/charts/linear/LineChart.js.map +1 -0
  13. package/dist/charts/linear/Node.js +56 -0
  14. package/dist/charts/linear/Node.js.map +1 -0
  15. package/dist/charts/pie/Pie.js +184 -0
  16. package/dist/charts/pie/Pie.js.map +1 -0
  17. package/dist/charts/pie/Slice.js +96 -0
  18. package/dist/charts/pie/Slice.js.map +1 -0
  19. package/dist/charts/pie/usePieAnimation.js +123 -0
  20. package/dist/charts/pie/usePieAnimation.js.map +1 -0
  21. package/dist/charts/types.d.ts +188 -0
  22. package/dist/charts/types.d.ts.map +1 -0
  23. package/dist/charts/util/ChartSelector.js +36 -0
  24. package/dist/charts/util/ChartSelector.js.map +1 -0
  25. package/dist/charts/util/ColoredLegendItem.js +46 -0
  26. package/dist/charts/util/ColoredLegendItem.js.map +1 -0
  27. package/dist/charts/util/EmptyGrid.d.ts +8 -0
  28. package/dist/charts/util/EmptyGrid.d.ts.map +1 -0
  29. package/dist/charts/util/EmptyGrid.js +51 -0
  30. package/dist/charts/util/EmptyGrid.js.map +1 -0
  31. package/dist/charts/util/LegendContainer.js +53 -0
  32. package/dist/charts/util/LegendContainer.js.map +1 -0
  33. package/dist/charts/util/NumberedLegendItem.js +45 -0
  34. package/dist/charts/util/NumberedLegendItem.js.map +1 -0
  35. package/dist/charts/util/getBarColor.js +29 -0
  36. package/dist/charts/util/getBarColor.js.map +1 -0
  37. package/dist/charts/util/parseMargin.js +11 -0
  38. package/dist/charts/util/parseMargin.js.map +1 -0
  39. package/dist/charts/util/useChartStyles.js +35 -0
  40. package/dist/charts/util/useChartStyles.js.map +1 -0
  41. package/dist/charts/verticalBars/Bar.js +239 -0
  42. package/dist/charts/verticalBars/Bar.js.map +1 -0
  43. package/dist/charts/verticalBars/VerticalBars.js +394 -0
  44. package/dist/charts/verticalBars/VerticalBars.js.map +1 -0
  45. package/dist/charts/waterfallBars/WaterfallBar.js +84 -0
  46. package/dist/charts/waterfallBars/WaterfallBar.js.map +1 -0
  47. package/dist/charts/waterfallBars/WaterfallBars.js +289 -0
  48. package/dist/charts/waterfallBars/WaterfallBars.js.map +1 -0
  49. package/dist/index.d.ts +6 -250
  50. package/dist/index.js +4 -4263
  51. package/dist/index.js.map +1 -1
  52. package/dist/widgets/WidgetContainer.d.ts +10 -0
  53. package/dist/widgets/WidgetContainer.d.ts.map +1 -0
  54. package/dist/widgets/WidgetContainer.js +68 -0
  55. package/dist/widgets/WidgetContainer.js.map +1 -0
  56. package/dist/widgets/counter/Counter.js +108 -0
  57. package/dist/widgets/counter/Counter.js.map +1 -0
  58. package/dist/widgets/custom/useCustomWidget.js +64 -0
  59. package/dist/widgets/custom/useCustomWidget.js.map +1 -0
  60. package/dist/widgets/custom/util.js +9 -0
  61. package/dist/widgets/custom/util.js.map +1 -0
  62. package/dist/widgets/oxford/Oxford.js +241 -0
  63. package/dist/widgets/oxford/Oxford.js.map +1 -0
  64. package/dist/widgets/ring/Ring.js +123 -0
  65. package/dist/widgets/ring/Ring.js.map +1 -0
  66. package/dist/widgets/scale/Scale.js +145 -0
  67. package/dist/widgets/scale/Scale.js.map +1 -0
  68. package/dist/widgets/speedMeter/SpeedMeter.js +187 -0
  69. package/dist/widgets/speedMeter/SpeedMeter.js.map +1 -0
  70. package/dist/widgets/tLight/TLight.js +134 -0
  71. package/dist/widgets/tLight/TLight.js.map +1 -0
  72. package/dist/widgets/thermometer/Thermometer.js +144 -0
  73. package/dist/widgets/thermometer/Thermometer.js.map +1 -0
  74. package/dist/widgets/thermometer/util.js +31 -0
  75. package/dist/widgets/thermometer/util.js.map +1 -0
  76. package/dist/widgets/types.d.ts +41 -0
  77. package/dist/widgets/types.d.ts.map +1 -0
  78. package/package.json +30 -43
  79. package/LICENSE.md +0 -21
  80. package/README.md +0 -1
  81. package/cleanDist.json +0 -3
@@ -0,0 +1,56 @@
1
+ import { jsxs, jsx } from '@apia/theme/jsx-runtime';
2
+ import { Fragment } from 'react';
3
+ import tinycolor from 'tinycolor2';
4
+
5
+ const Node = ({
6
+ currentCircle,
7
+ innerKey,
8
+ cx,
9
+ cy,
10
+ // coordinate,
11
+ color,
12
+ setCurrentCircle
13
+ }) => {
14
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
15
+ currentCircle.includes(innerKey) && /* @__PURE__ */ jsx(
16
+ "circle",
17
+ {
18
+ r: 6,
19
+ cx,
20
+ cy,
21
+ stroke: `#${tinycolor(color).saturate(25).toHex()}`,
22
+ fill: `#${tinycolor(color).saturate(25).toHex()}`
23
+ }
24
+ ),
25
+ /* @__PURE__ */ jsx(
26
+ "circle",
27
+ {
28
+ r: 3,
29
+ cx,
30
+ cy,
31
+ stroke: `#${tinycolor(color).darken(15).toHex()}`,
32
+ fill: `#${tinycolor(color).darken(15).toHex()}`
33
+ }
34
+ ),
35
+ /* @__PURE__ */ jsx(
36
+ "circle",
37
+ {
38
+ r: 6,
39
+ cx,
40
+ cy,
41
+ stroke: "transparent",
42
+ fill: "transparent",
43
+ onMouseEnter: () => {
44
+ setCurrentCircle([innerKey]);
45
+ },
46
+ onMouseLeave: () => {
47
+ setCurrentCircle([]);
48
+ },
49
+ style: { cursor: "pointer" }
50
+ }
51
+ )
52
+ ] }, innerKey);
53
+ };
54
+
55
+ export { Node };
56
+ //# sourceMappingURL=Node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Node.js","sources":["../../../src/charts/linear/Node.tsx"],"sourcesContent":["import { Fragment } from 'react';\nimport tinycolor from 'tinycolor2';\nimport { TApiaChartColumn, TApiaChartCoordinate } from '../types';\n\nexport const Node = ({\n currentCircle,\n innerKey,\n cx,\n cy,\n // coordinate,\n color,\n setCurrentCircle,\n}: // column,\n{\n currentCircle: string[];\n innerKey: string;\n cx: number;\n cy: number;\n coordinate: TApiaChartCoordinate;\n color: string;\n setCurrentCircle: (value: React.SetStateAction<string[]>) => void;\n column: TApiaChartColumn;\n}) => {\n return (\n <Fragment key={innerKey}>\n {currentCircle.includes(innerKey) && (\n <circle\n r={6}\n cx={cx}\n cy={cy}\n stroke={`#${tinycolor(color).saturate(25).toHex()}`}\n fill={`#${tinycolor(color).saturate(25).toHex()}`}\n />\n )}\n <circle\n r={3}\n cx={cx}\n cy={cy}\n stroke={`#${tinycolor(color).darken(15).toHex()}`}\n fill={`#${tinycolor(color).darken(15).toHex()}`}\n />\n <circle\n r={6}\n cx={cx}\n cy={cy}\n stroke=\"transparent\"\n fill=\"transparent\"\n onMouseEnter={() => {\n setCurrentCircle([innerKey]);\n }}\n onMouseLeave={() => {\n setCurrentCircle([]);\n }}\n style={{ cursor: 'pointer' }}\n />\n </Fragment>\n );\n};\n"],"names":[],"mappings":";;;;AAIO,MAAM,OAAO,CAAC;AAAA,EACnB,aAAA;AAAA,EACA,QAAA;AAAA,EACA,EAAA;AAAA,EACA,EAAA;AAAA;AAAA,EAEA,KAAA;AAAA,EACA,gBAAA;AACF,CAUM,KAAA;AACJ,EAAA,4BACG,QACE,EAAA,EAAA,QAAA,EAAA;AAAA,IAAc,aAAA,CAAA,QAAA,CAAS,QAAQ,CAC9B,oBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,CAAG,EAAA,CAAA;AAAA,QACH,EAAA;AAAA,QACA,EAAA;AAAA,QACA,MAAA,EAAQ,IAAI,SAAU,CAAA,KAAK,EAAE,QAAS,CAAA,EAAE,CAAE,CAAA,KAAA,EAAO,CAAA,CAAA;AAAA,QACjD,IAAA,EAAM,IAAI,SAAU,CAAA,KAAK,EAAE,QAAS,CAAA,EAAE,CAAE,CAAA,KAAA,EAAO,CAAA,CAAA;AAAA,OAAA;AAAA,KACjD;AAAA,oBAEF,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,CAAG,EAAA,CAAA;AAAA,QACH,EAAA;AAAA,QACA,EAAA;AAAA,QACA,MAAA,EAAQ,IAAI,SAAU,CAAA,KAAK,EAAE,MAAO,CAAA,EAAE,CAAE,CAAA,KAAA,EAAO,CAAA,CAAA;AAAA,QAC/C,IAAA,EAAM,IAAI,SAAU,CAAA,KAAK,EAAE,MAAO,CAAA,EAAE,CAAE,CAAA,KAAA,EAAO,CAAA,CAAA;AAAA,OAAA;AAAA,KAC/C;AAAA,oBACA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,CAAG,EAAA,CAAA;AAAA,QACH,EAAA;AAAA,QACA,EAAA;AAAA,QACA,MAAO,EAAA,aAAA;AAAA,QACP,IAAK,EAAA,aAAA;AAAA,QACL,cAAc,MAAM;AAClB,UAAiB,gBAAA,CAAA,CAAC,QAAQ,CAAC,CAAA,CAAA;AAAA,SAC7B;AAAA,QACA,cAAc,MAAM;AAClB,UAAA,gBAAA,CAAiB,EAAE,CAAA,CAAA;AAAA,SACrB;AAAA,QACA,KAAA,EAAO,EAAE,MAAA,EAAQ,SAAU,EAAA;AAAA,OAAA;AAAA,KAC7B;AAAA,GAAA,EAAA,EA9Ba,QA+Bf,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,184 @@
1
+ import { jsxs, Fragment, jsx } from '@apia/theme/jsx-runtime';
2
+ import { arrayOrArray, usePanAndZoom, getLabel } from '@apia/util';
3
+ import { Box, spacing, Heading } from '@apia/theme';
4
+ import { Group } from '@visx/group';
5
+ import { Pie } from '@visx/shape';
6
+ import { Slice } from './Slice.js';
7
+ import { useChartStyles } from '../util/useChartStyles.js';
8
+ import { useState, useMemo, useRef } from 'react';
9
+ import { LegendContainer } from '../util/LegendContainer.js';
10
+ import { getBarColor } from '../util/getBarColor.js';
11
+ import { usePieAnimation } from './usePieAnimation.js';
12
+ import uniqueId from 'lodash-es/uniqueId';
13
+ import ChartSelector from '../util/ChartSelector.js';
14
+
15
+ function adjustDimensions({
16
+ width,
17
+ height,
18
+ maxWidth
19
+ }) {
20
+ if (width <= maxWidth) {
21
+ return { width, height };
22
+ }
23
+ const ratio = width / height;
24
+ const newWidth = maxWidth;
25
+ const newHeight = Math.floor(newWidth / ratio);
26
+ return { width: newWidth, height: newHeight };
27
+ }
28
+ const PieChart = ({
29
+ chart,
30
+ className,
31
+ chartId,
32
+ allowZoom
33
+ }) => {
34
+ const [dataset, setDataset] = useState(
35
+ arrayOrArray(chart.dataSets?.data)
36
+ );
37
+ const [currentPie, setCurrentPie] = useState("0");
38
+ const piezas = useMemo(() => {
39
+ return dataset.filter((piece) => !!piece.sets).map((piece) => {
40
+ return {
41
+ ...piece,
42
+ coordinate: piece.sets
43
+ };
44
+ })[dataset[parseInt(currentPie)] ? parseInt(currentPie) : 0];
45
+ }, [currentPie, dataset]);
46
+ usePieAnimation({
47
+ incomingColumn: arrayOrArray(chart.dataSets?.data)[dataset[parseInt(currentPie)] ? parseInt(currentPie) : 0],
48
+ piezas,
49
+ setDataset
50
+ });
51
+ let innerWidth = chart.ratio.width > chart.ratio.height ? chart.ratio.width : chart.ratio.height;
52
+ let innerHeight = chart.ratio.width > chart.ratio.height ? chart.ratio.width : chart.ratio.height;
53
+ if (innerWidth > chart.ratio.maxWidth) {
54
+ const newValues = adjustDimensions({
55
+ height: innerHeight,
56
+ width: innerWidth,
57
+ maxWidth: chart.ratio.maxWidth
58
+ });
59
+ innerWidth = newValues.width;
60
+ innerHeight = newValues.height;
61
+ }
62
+ const centerY = useMemo(() => {
63
+ return innerHeight / 2.5;
64
+ }, [innerHeight]);
65
+ const centerX = useMemo(() => {
66
+ return innerWidth / 2.5;
67
+ }, [innerWidth]);
68
+ const top = centerY;
69
+ const left = centerX;
70
+ const getValue = (d) => Number(d.value) === 0 && arrayOrArray(piezas.coordinate).length === 1 ? 100 : d.value === void 0 ? 0 : Number(d.value);
71
+ const radius = Math.min(innerHeight, innerWidth) / 2.5;
72
+ const styles = useChartStyles(chart.colorSchema);
73
+ const colorsArray = styles ? styles.schema : ["#7ad6f4", "#45bdee", "#28a7ea", "#006cbb", "#034698", "#032f64"];
74
+ const names = arrayOrArray(
75
+ (dataset[parseInt(currentPie)] ?? dataset[0]).sets
76
+ ).map((coord) => {
77
+ return coord.key;
78
+ });
79
+ const colorReference = names.map((name, index) => {
80
+ return {
81
+ title: name,
82
+ color: getBarColor(arrayOrArray(colorsArray), index)
83
+ };
84
+ });
85
+ const { boxRef, elementRef } = usePanAndZoom(
86
+ void 0,
87
+ !allowZoom
88
+ );
89
+ const previousPaths = useRef([]);
90
+ const id = useMemo(() => `Pie${uniqueId()}`, []);
91
+ const charts = arrayOrArray(chart.dataSets?.data).filter((piece) => !!piece.sets).map((piece) => {
92
+ return {
93
+ ...piece,
94
+ coordinate: piece.sets
95
+ };
96
+ });
97
+ const chartNames = charts.map((piece) => {
98
+ return piece.name;
99
+ });
100
+ if (!piezas) {
101
+ return null;
102
+ }
103
+ console.log(arrayOrArray(piezas.coordinate));
104
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
105
+ /* @__PURE__ */ jsx(
106
+ Box,
107
+ {
108
+ ref: boxRef,
109
+ id,
110
+ className: `${className ? className : ""} ${chartId} chartBox chartContainer`,
111
+ sx: { textAlign: "center", pb: spacing(5) },
112
+ children: /* @__PURE__ */ jsx(
113
+ "svg",
114
+ {
115
+ ref: elementRef,
116
+ height: radius * 2,
117
+ width: radius * 2,
118
+ className: `_${chartId} chart__svg`,
119
+ children: /* @__PURE__ */ jsx(Group, { top: top ?? 0, left: left ?? 0, children: /* @__PURE__ */ jsx(
120
+ Pie,
121
+ {
122
+ data: arrayOrArray(piezas.coordinate),
123
+ pieValue: getValue,
124
+ pieSort: null,
125
+ outerRadius: radius,
126
+ children: (pie) => {
127
+ const paths = arrayOrArray(pie.arcs).map((arc) => {
128
+ return pie.path(arc);
129
+ });
130
+ const result = pie.arcs.map((arc) => {
131
+ const name = arc.data;
132
+ const arcPath = pie.path(arc);
133
+ return /* @__PURE__ */ jsx(
134
+ Slice,
135
+ {
136
+ arc,
137
+ chartId: id,
138
+ arcPath,
139
+ chart,
140
+ actualColor: colorReference.find((color) => {
141
+ return color.title === name.key;
142
+ })?.color.startsWith("#") ? colorReference.find((color) => {
143
+ return color.title === name.key;
144
+ })?.color ?? "" : `#${colorReference.find((color) => {
145
+ return color.title === name.key;
146
+ })?.color ?? ""}`
147
+ },
148
+ `${name.key}_${name.value}`
149
+ );
150
+ });
151
+ previousPaths.current = paths;
152
+ return result;
153
+ }
154
+ }
155
+ ) })
156
+ }
157
+ )
158
+ },
159
+ piezas.name
160
+ ),
161
+ /* @__PURE__ */ jsxs(Box, { className: "chartLegend__Wrapper", children: [
162
+ !chart.hideSelector && charts.length > 1 && /* @__PURE__ */ jsxs(Box, { className: "chart__combo__wrapper", children: [
163
+ /* @__PURE__ */ jsx(Heading, { as: "h6", children: getLabel("lblChartSel").text }),
164
+ /* @__PURE__ */ jsx(
165
+ ChartSelector,
166
+ {
167
+ chartId,
168
+ pieces: chartNames,
169
+ className: "chartSelectorCombo",
170
+ current: currentPie,
171
+ setCurrent: setCurrentPie
172
+ }
173
+ )
174
+ ] }),
175
+ chart.showLegend && colorReference.length > 1 && /* @__PURE__ */ jsxs(Box, { className: "chart__legend__wrapper", children: [
176
+ /* @__PURE__ */ jsx(Heading, { as: "h6", children: getLabel("mnuLeyends").text }),
177
+ /* @__PURE__ */ jsx(LegendContainer, { id: chartId, references: colorReference })
178
+ ] })
179
+ ] })
180
+ ] });
181
+ };
182
+
183
+ export { PieChart };
184
+ //# sourceMappingURL=Pie.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pie.js","sources":["../../../src/charts/pie/Pie.tsx"],"sourcesContent":["import {\n TApiaChartColumn,\n TApiaChartCoordinate,\n TChartRendererProps,\n} from '../types';\nimport { arrayOrArray, getLabel, usePanAndZoom } from '@apia/util';\nimport { Box, Heading } from '@apia/theme';\nimport { Group } from '@visx/group';\nimport { Pie } from '@visx/shape';\nimport { Slice } from './Slice';\nimport { useChartStyles } from '../util/useChartStyles';\nimport { useRef, useMemo, useState } from 'react';\nimport { LegendContainer, TChartReference } from '../util/LegendContainer';\nimport { getBarColor } from '../util/getBarColor';\nimport { spacing } from '@apia/theme';\nimport { usePieAnimation } from './usePieAnimation';\nimport uniqueId from 'lodash-es/uniqueId';\nimport ChartSelector from '../util/ChartSelector';\n\nfunction adjustDimensions({\n width,\n height,\n maxWidth,\n}: {\n width: number;\n height: number;\n maxWidth: number;\n}) {\n if (width <= maxWidth) {\n return { width, height };\n }\n\n const ratio = width / height;\n const newWidth = maxWidth;\n const newHeight = Math.floor(newWidth / ratio);\n\n return { width: newWidth, height: newHeight };\n}\n\nexport type TPieChartEvents = { highlight: { barName: string } };\n\nconst PieChart = ({\n chart,\n className,\n chartId,\n allowZoom,\n}: TChartRendererProps) => {\n const [dataset, setDataset] = useState<TApiaChartColumn[]>(\n arrayOrArray(chart.dataSets?.data),\n );\n const [currentPie, setCurrentPie] = useState('0');\n const piezas = useMemo(() => {\n return dataset\n .filter((piece) => !!piece.sets)\n .map((piece) => {\n return {\n ...piece,\n coordinate: piece.sets,\n };\n })[dataset[parseInt(currentPie)] ? parseInt(currentPie) : 0];\n }, [currentPie, dataset]);\n\n usePieAnimation({\n incomingColumn: arrayOrArray(chart.dataSets?.data)[\n dataset[parseInt(currentPie)] ? parseInt(currentPie) : 0\n ],\n piezas,\n setDataset,\n });\n\n let innerWidth =\n chart.ratio.width > chart.ratio.height\n ? chart.ratio.width\n : chart.ratio.height;\n let innerHeight =\n chart.ratio.width > chart.ratio.height\n ? chart.ratio.width\n : chart.ratio.height;\n if (innerWidth > chart.ratio.maxWidth) {\n const newValues = adjustDimensions({\n height: innerHeight,\n width: innerWidth,\n maxWidth: chart.ratio.maxWidth,\n });\n innerWidth = newValues.width;\n innerHeight = newValues.height;\n }\n\n const centerY = useMemo(() => {\n return innerHeight / 2.5;\n }, [innerHeight]);\n const centerX = useMemo(() => {\n return innerWidth / 2.5;\n }, [innerWidth]);\n const top = centerY;\n const left = centerX;\n\n const getValue = (d: TApiaChartCoordinate) =>\n Number(d.value) === 0 && arrayOrArray(piezas.coordinate).length === 1\n ? 100\n : d.value === undefined\n ? 0\n : Number(d.value);\n const radius = Math.min(innerHeight, innerWidth) / 2.5;\n\n const styles = useChartStyles(chart.colorSchema);\n\n const colorsArray = styles\n ? styles.schema\n : ['#7ad6f4', '#45bdee', '#28a7ea', '#006cbb', '#034698', '#032f64'];\n const names = arrayOrArray(\n (dataset[parseInt(currentPie)] ?? dataset[0]).sets,\n ).map((coord) => {\n return coord.key;\n });\n const colorReference: TChartReference = names.map((name, index) => {\n return {\n title: name,\n color: getBarColor(arrayOrArray(colorsArray), index),\n };\n });\n\n const { boxRef, elementRef } = usePanAndZoom<HTMLElement, SVGSVGElement>(\n undefined,\n !allowZoom ?? true,\n );\n const previousPaths = useRef<(string | null)[]>([]);\n const id = useMemo(() => `Pie${uniqueId()}`, []);\n const charts = arrayOrArray(chart.dataSets?.data)\n .filter((piece) => !!piece.sets)\n .map((piece) => {\n return {\n ...piece,\n coordinate: piece.sets,\n };\n });\n const chartNames = charts.map((piece) => {\n return piece.name;\n });\n if (!piezas) {\n return null;\n }\n\n console.log(arrayOrArray(piezas.coordinate));\n return (\n <>\n <Box\n ref={boxRef}\n id={id}\n key={piezas.name}\n className={`${\n className ? className : ''\n } ${chartId} chartBox chartContainer`}\n sx={{ textAlign: 'center', pb: spacing(5) }}\n >\n <svg\n ref={elementRef}\n height={radius * 2}\n width={radius * 2}\n className={`_${chartId} chart__svg`}\n >\n <Group top={top ?? 0} left={left ?? 0}>\n <Pie\n data={arrayOrArray(piezas.coordinate)}\n pieValue={getValue}\n pieSort={null}\n outerRadius={radius}\n >\n {(pie) => {\n const paths = arrayOrArray(pie.arcs).map((arc) => {\n return pie.path(arc);\n });\n\n const result = pie.arcs.map((arc) => {\n const name = arc.data;\n\n const arcPath = pie.path(arc);\n return (\n <Slice\n arc={arc}\n chartId={id}\n arcPath={arcPath}\n chart={chart}\n key={`${name.key}_${name.value}`}\n actualColor={\n colorReference\n .find((color) => {\n return color.title === name.key;\n })\n ?.color.startsWith('#')\n ? colorReference.find((color) => {\n return color.title === name.key;\n })?.color ?? ''\n : `#${\n colorReference.find((color) => {\n return color.title === name.key;\n })?.color ?? ''\n }`\n }\n />\n );\n });\n previousPaths.current = paths;\n\n return result;\n }}\n </Pie>\n </Group>\n </svg>\n </Box>\n <Box className=\"chartLegend__Wrapper\">\n {!chart.hideSelector && charts.length > 1 && (\n <Box className=\"chart__combo__wrapper\">\n {/* TODO LABEL */}\n <Heading as={'h6'}>{getLabel('lblChartSel').text}</Heading>\n <ChartSelector\n chartId={chartId}\n pieces={chartNames}\n className=\"chartSelectorCombo\"\n current={currentPie}\n setCurrent={setCurrentPie}\n />\n </Box>\n )}\n\n {chart.showLegend && colorReference.length > 1 && (\n <Box className=\"chart__legend__wrapper\">\n {/* TODO LABEL */}\n <Heading as={'h6'}>{getLabel('mnuLeyends').text}</Heading>\n <LegendContainer id={chartId} references={colorReference} />\n </Box>\n )}\n </Box>\n </>\n );\n};\n\nexport { PieChart };\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAmBA,SAAS,gBAAiB,CAAA;AAAA,EACxB,KAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AACF,CAIG,EAAA;AACD,EAAA,IAAI,SAAS,QAAU,EAAA;AACrB,IAAO,OAAA,EAAE,OAAO,MAAO,EAAA,CAAA;AAAA,GACzB;AAEA,EAAA,M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AAgB,EAAA,CAAA;AAAA,OAC5D,EAAA,CAAA;AAAA,KAEJ,EAAA,CAAA;AAAA,GACF,EAAA,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,96 @@
1
+ import { jsxs, Fragment, jsx } from '@apia/theme/jsx-runtime';
2
+ import { useState, useRef, useMemo } from 'react';
3
+ import tinycolor from 'tinycolor2';
4
+ import { localPoint } from '@visx/event';
5
+ import { useImperativeComponentContext, useImperativeComponentEvents } from '@apia/util';
6
+ import { legendContainerMethods } from '../util/LegendContainer.js';
7
+ import { chartMethods } from '../ChartRenderer.js';
8
+ import { ApiaUtil } from '@apia/components';
9
+
10
+ const Slice = ({
11
+ arc,
12
+ arcPath,
13
+ chart,
14
+ actualColor,
15
+ chartId: outerChartId
16
+ }) => {
17
+ const [isHighlighted, setIsHighlighted] = useState(false);
18
+ const [isAnyHighlighted, setIsAnyHighlighted] = useState(false);
19
+ const ref = useRef(null);
20
+ const name = arc.data;
21
+ const { id: chartId } = useImperativeComponentContext();
22
+ useImperativeComponentEvents({
23
+ highlight(barNameId) {
24
+ const barName = barNameId.split("_$_")[0];
25
+ setIsHighlighted(barName === arc.data.key);
26
+ setIsAnyHighlighted(barName !== arc.data.key && barName !== "");
27
+ if (barName === arc.data.key) {
28
+ ApiaUtil.instance.tooltips.open({
29
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
30
+ /* @__PURE__ */ jsx(
31
+ "div",
32
+ {
33
+ style: {
34
+ color: `#${tinycolor(actualColor).toHex()}`
35
+ },
36
+ children: /* @__PURE__ */ jsx("strong", { children: arc.data.key })
37
+ }
38
+ ),
39
+ chart.showValues && /* @__PURE__ */ jsx("div", { children: `${arc.value} ${arc.data.percentage !== "" && arc.data.percentage !== void 0 ? "- " + arc.data.percentage : ""}${arc.data.percentage !== "" && arc.data.percentage !== void 0 ? "%" : ""}` })
40
+ ] }),
41
+ attachToElement: () => {
42
+ return ref.current;
43
+ },
44
+ attachToElementAnchorPoint: "center",
45
+ closeOnClickOut: () => {
46
+ return window.innerWidth > 700;
47
+ },
48
+ closeOnMouseLeaveAttachedElement: (ev) => {
49
+ return !ev.relatedTarget.closest(".legendItem");
50
+ },
51
+ className: arc.data.key
52
+ });
53
+ }
54
+ }
55
+ });
56
+ return /* @__PURE__ */ jsx(
57
+ "path",
58
+ {
59
+ id: `arc-${name.key}-${name.value}-${outerChartId}`,
60
+ ref,
61
+ style: useMemo(
62
+ () => ({
63
+ "&:hover": {
64
+ fill: `#${tinycolor(actualColor).saturate(25).toHex()}`
65
+ },
66
+ transition: "fill 500ms, opacity 500ms"
67
+ }),
68
+ [actualColor]
69
+ ),
70
+ color: isAnyHighlighted ? `#${tinycolor(actualColor).desaturate(70).toHex()}` : actualColor,
71
+ fill: isAnyHighlighted ? `#${tinycolor(actualColor).desaturate(70).toHex()}` : actualColor,
72
+ opacity: isAnyHighlighted && !isHighlighted ? 0.15 : 1,
73
+ d: arcPath ?? "",
74
+ onMouseEnter: (ev) => {
75
+ legendContainerMethods.highlight(chartId, arc.data.key);
76
+ chartMethods(chartId, "highlight", `${name.key}_$_${outerChartId}`);
77
+ ev.target.classList?.add("over");
78
+ const point = {
79
+ x: localPoint(ev)?.x,
80
+ y: localPoint(ev)?.y
81
+ };
82
+ if (!point)
83
+ return;
84
+ },
85
+ onMouseLeave: (ev) => {
86
+ legendContainerMethods.highlight(chartId, "");
87
+ chartMethods(chartId, "highlight", "");
88
+ ev.target.classList?.remove("over");
89
+ }
90
+ },
91
+ `arc-${name.key}-${name.value}-${outerChartId}`
92
+ );
93
+ };
94
+
95
+ export { Slice };
96
+ //# sourceMappingURL=Slice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slice.js","sources":["../../../src/charts/pie/Slice.tsx"],"sourcesContent":["import { TApiaChartCoordinate, TChartRendererProps } from '../types';\nimport { useMemo, useState, useRef } from 'react';\nimport tinycolor from 'tinycolor2';\nimport { localPoint } from '@visx/event';\nimport { PieArcDatum } from '@visx/shape/lib/shapes/Pie';\nimport {\n useImperativeComponentContext,\n useImperativeComponentEvents,\n} from '@apia/util';\nimport { legendContainerMethods } from '../util/LegendContainer';\nimport { TChartEvents, chartMethods } from '../ChartRenderer';\nimport { ApiaUtil } from '@apia/components';\n// import uniqueId from 'lodash-es/uniqueId';\n\nexport const Slice = ({\n arc,\n arcPath,\n chart,\n actualColor,\n chartId: outerChartId,\n}: Pick<TChartRendererProps, 'chart'> &\n Pick<TChartRendererProps, 'chartId'> & {\n arc: PieArcDatum<TApiaChartCoordinate>;\n arcPath: string | null;\n actualColor: string;\n }) => {\n // const uId = uniqueId();\n const [isHighlighted, setIsHighlighted] = useState(false);\n const [isAnyHighlighted, setIsAnyHighlighted] = useState(false);\n const ref = useRef<SVGPathElement | null>(null);\n const name = arc.data;\n const { id: chartId } = useImperativeComponentContext();\n useImperativeComponentEvents<TChartEvents>({\n highlight(barNameId) {\n const barName = barNameId.split('_$_')[0];\n setIsHighlighted(barName === arc.data.key);\n setIsAnyHighlighted(barName !== arc.data.key && barName !== '');\n if (barName === arc.data.key) {\n ApiaUtil.instance.tooltips.open({\n children: (\n <>\n <div\n style={{\n color: `#${tinycolor(actualColor).toHex()}`,\n }}\n >\n <strong>{arc.data.key}</strong>\n </div>\n {chart.showValues && (\n <div>{`${arc.value} ${\n arc.data.percentage !== '' &&\n arc.data.percentage !== undefined\n ? '- ' + arc.data.percentage\n : ''\n }${\n arc.data.percentage !== '' &&\n arc.data.percentage !== undefined\n ? '%'\n : ''\n }`}</div>\n )}\n </>\n ),\n attachToElement: () => {\n return ref.current as unknown as HTMLElement;\n },\n attachToElementAnchorPoint: 'center',\n closeOnClickOut: () => {\n return window.innerWidth > 700;\n },\n closeOnMouseLeaveAttachedElement: (ev) => {\n return !(ev.relatedTarget as HTMLElement).closest('.legendItem');\n },\n className: arc.data.key,\n });\n }\n },\n });\n\n return (\n <path\n key={`arc-${name.key}-${name.value}-${outerChartId}`}\n id={`arc-${name.key}-${name.value}-${outerChartId}`}\n ref={ref}\n style={useMemo(\n () => ({\n '&:hover': {\n fill: `#${tinycolor(actualColor).saturate(25).toHex()}`,\n },\n transition: 'fill 500ms, opacity 500ms',\n }),\n [actualColor],\n )}\n color={\n isAnyHighlighted\n ? `#${tinycolor(actualColor).desaturate(70).toHex()}`\n : actualColor\n }\n fill={\n isAnyHighlighted\n ? `#${tinycolor(actualColor).desaturate(70).toHex()}`\n : actualColor\n }\n opacity={isAnyHighlighted && !isHighlighted ? 0.15 : 1}\n d={arcPath ?? ''}\n onMouseEnter={(ev) => {\n legendContainerMethods.highlight(chartId, arc.data.key);\n chartMethods(chartId, 'highlight', `${name.key}_$_${outerChartId}`);\n (ev.target as HTMLElement).classList?.add('over');\n const point = {\n x: localPoint(ev)?.x,\n y: localPoint(ev)?.y,\n };\n if (!point) return;\n }}\n onMouseLeave={(ev) => {\n legendContainerMethods.highlight(chartId, '');\n\n chartMethods(chartId, 'highlight', '');\n (ev.target as HTMLElement).classList?.remove('over');\n }}\n ></path>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAcO,MAAM,QAAQ,CAAC;AAAA,EACpB,GAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAS,EAAA,YAAA;AACX,CAKQ,KAAA;AAEN,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACxD,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAC9D,EAAM,MAAA,GAAA,GAAM,OAA8B,IAAI,CAAA,CAAA;AAC9C,EAAA,MAAM,OAAO,GAAI,CAAA,IAAA,CAAA;AACjB,EAAA,MAAM,EAAE,EAAA,EAAI,OAAQ,EAAA,GAAI,6BAA8B,EAAA,CAAA;AACtD,EAA2C,4BAAA,CAAA;AAAA,IACzC,UAAU,SAAW,EAAA;AACnB,MAAA,MAAM,OAAU,GAAA,SAAA,CAAU,KAAM,CA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,EAAO,KAAA;AACpB,QAAA,sBAAA,CAAuB,SAAU,CAAA,OAAA,EAAS,GAAI,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AACtD,QAAA,YAAA,CAAa,SAAS,WAAa,EAAA,CAAA,EAAG,KAAK,GAAG,CAAA,GAAA,EAAM,YAAY,CAAE,CAAA,CAAA,CAAA;AAClE,QAAC,EAAG,CAAA,MAAA,CAAuB,SAAW,EAAA,GAAA,CAAI,MAAM,CAAA,CAAA;AAChD,QAAA,MAAM,KAAQ,GAAA;AAAA,UACZ,CAAA,EAAG,UAAW,CAAA,EAAE,CAAG,EAAA,CAAA;AAAA,UACnB,CAAA,EAAG,UAAW,CAAA,EAAE,CAAG,EAAA,CAAA;AAAA,SACrB,CAAA;AACA,QAAA,IAAI,CAAC,KAAA;AAAO,UAAA,OAAA;AAAA,OACd;AAAA,MACA,YAAA,EAAc,CAAC,EAAO,KAAA;AACpB,QAAuB,sBAAA,CAAA,SAAA,CAAU,SAAS,EAAE,CAAA,CAAA;AAE5C,QAAa,YAAA,CAAA,OAAA,EAAS,aAAa,EAAE,CAAA,CAAA;AACrC,QAAC,EAAG,CAAA,MAAA,CAAuB,SAAW,EAAA,MAAA,CAAO,MAAM,CAAA,CAAA;AAAA,OACrD;AAAA,KAAA;AAAA,IAvCK,OAAO,IAAK,CAAA,GAAG,IAAI,IAAK,CAAA,KAAK,IAAI,YAAY,CAAA,CAAA;AAAA,GAwCnD,CAAA;AAEL;;;;"}
@@ -0,0 +1,123 @@
1
+ import { useRef } from 'react';
2
+ import { arrayOrArray, animate, addBoundary } from '@apia/util';
3
+
4
+ const usePieAnimation = ({
5
+ incomingColumn,
6
+ piezas,
7
+ setDataset
8
+ }) => {
9
+ const previousObjectRef = useRef(void 0);
10
+ const actualObjectRef = useRef(void 0);
11
+ const isAnimating = useRef(false);
12
+ if (previousObjectRef.current && piezas) {
13
+ const previousCoordinates = isAnimating.current && actualObjectRef.current ? arrayOrArray(actualObjectRef.current.coordinate) : arrayOrArray(previousObjectRef.current.coordinate);
14
+ const currentCoordinates = arrayOrArray(incomingColumn.sets);
15
+ const hasValueChanged = previousCoordinates.some((prevCoord, index) => {
16
+ const currentCoord = currentCoordinates[index];
17
+ return prevCoord.value !== currentCoord?.value || prevCoord.value === currentCoord?.value && prevCoord.key !== currentCoord.key;
18
+ });
19
+ if (hasValueChanged) {
20
+ isAnimating.current = true;
21
+ const difference = [];
22
+ for (let i = 0; i < Math.max(previousCoordinates.length, currentCoordinates.length); i++) {
23
+ const coord1 = previousCoordinates[i];
24
+ const coord2 = currentCoordinates[i];
25
+ if (coord1 && coord2) {
26
+ const newValue = Math.abs(
27
+ parseInt(coord1.value) - parseInt(coord2.value)
28
+ ).toString();
29
+ const newCoordinate = {
30
+ key: coord2.key,
31
+ color: coord2.color,
32
+ // Assuming color is the same for both coordinates
33
+ value: newValue,
34
+ percentage: coord2.percentage !== "" && coord2.percentage !== void 0 ? coord2.percentage : void 0
35
+ };
36
+ difference.push(newCoordinate);
37
+ } else if (!coord1 && coord2 && previousCoordinates.length > 0) {
38
+ const newValue = Math.abs(0 - parseInt(coord2.value)).toString();
39
+ const newCoordinate = {
40
+ key: coord2.key,
41
+ color: coord2.color,
42
+ // Assuming color is the same for both coordinates
43
+ value: newValue,
44
+ percentage: coord2.percentage !== "" && coord2.percentage !== void 0 ? coord2.percentage : void 0
45
+ };
46
+ difference.push(newCoordinate);
47
+ }
48
+ }
49
+ return animate(
50
+ 500,
51
+ (progress) => {
52
+ const step = {
53
+ color: piezas.color,
54
+ name: incomingColumn.name,
55
+ sets: difference.map((coord, i) => {
56
+ return {
57
+ key: coord.key,
58
+ color: coord.color,
59
+ percentage: coord.percentage,
60
+ value: addBoundary(
61
+ Number(currentCoordinates[i].value) > Number(
62
+ previousCoordinates[i] ? previousCoordinates[i].value : 0
63
+ ) ? Number(coord.value) * progress + Number(
64
+ previousCoordinates[i] ? previousCoordinates[i].value : 0
65
+ ) : Number(
66
+ previousCoordinates[i] ? previousCoordinates[i].value : 0
67
+ ) - Number(coord.value) * progress,
68
+ Math.min(
69
+ Number(
70
+ previousCoordinates[i] ? previousCoordinates[i].value : 0
71
+ ),
72
+ Number(currentCoordinates[i].value)
73
+ ),
74
+ Math.max(
75
+ Number(
76
+ previousCoordinates[i] ? previousCoordinates[i].value : 0
77
+ ),
78
+ Number(currentCoordinates[i].value)
79
+ )
80
+ ).toString()
81
+ };
82
+ })
83
+ };
84
+ actualObjectRef.current = {
85
+ color: step.color,
86
+ coordinate: step.sets,
87
+ name: step.name
88
+ };
89
+ setDataset((prev) => {
90
+ const newIndex = prev.findIndex((col) => {
91
+ return col.name === step.name;
92
+ });
93
+ const returnObj = [...prev];
94
+ if (newIndex >= 0) {
95
+ returnObj[newIndex] = step;
96
+ return returnObj;
97
+ } else {
98
+ return [step];
99
+ }
100
+ });
101
+ },
102
+ () => {
103
+ const newPrev = {
104
+ ...incomingColumn,
105
+ coordinate: incomingColumn.sets
106
+ };
107
+ previousObjectRef.current = newPrev;
108
+ isAnimating.current = false;
109
+ }
110
+ );
111
+ }
112
+ } else if (!previousObjectRef.current) {
113
+ const newPrev = {
114
+ ...incomingColumn,
115
+ coordinate: incomingColumn.sets
116
+ };
117
+ previousObjectRef.current = newPrev;
118
+ isAnimating.current = false;
119
+ }
120
+ };
121
+
122
+ export { usePieAnimation };
123
+ //# sourceMappingURL=usePieAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePieAnimation.js","sources":["../../../src/charts/pie/usePieAnimation.ts"],"sourcesContent":["import React, { useRef } from 'react';\nimport { TApiaChartColumn, TApiaChartCoordinate } from '../types';\nimport {\n addBoundary,\n animate,\n arrayOrArray,\n // useUpdateEffect,\n} from '@apia/util';\n\nexport const usePieAnimation = ({\n incomingColumn,\n piezas,\n setDataset,\n}: {\n incomingColumn: TApiaChartColumn;\n setDataset: React.Dispatch<React.SetStateAction<TApiaChartColumn[]>>;\n piezas: {\n coordinate: TApiaChartCoordinate | TApiaChartCoordinate[];\n color: string;\n sets: TApiaChartCoordinate | TApiaChartCoordinate[];\n name: string;\n };\n}) => {\n const previousObjectRef = useRef<\n | {\n coordinate: TApiaChartCoordinate | TApiaChartCoordinate[];\n color: string;\n name: string;\n }\n | undefined\n >(undefined);\n\n const actualObjectRef = useRef<\n | {\n coordinate: TApiaChartCoordinate | TApiaChartCoordinate[];\n color: string;\n name: string;\n }\n | undefined\n >(undefined);\n\n const isAnimating = useRef(false);\n\n if (previousObjectRef.current && piezas) {\n const previousCoordinates =\n isAnimating.current && actualObjectRef.current\n ? arrayOrArray(actualObjectRef.current.coordinate)\n : arrayOrArray(previousObjectRef.current.coordinate);\n\n const currentCoordinates = arrayOrArray(incomingColumn.sets);\n\n const hasValueChanged = previousCoordinates.some((prevCoord, index) => {\n const currentCoord = currentCoordinates[index];\n\n return (\n prevCoord.value !== currentCoord?.value ||\n (prevCoord.value === currentCoord?.value &&\n prevCoord.key !== currentCoord.key)\n );\n });\n\n if (hasValueChanged) {\n isAnimating.current = true;\n const difference: TApiaChartCoordinate[] = [];\n for (\n let i = 0;\n i < Math.max(previousCoordinates.length, currentCoordinates.length);\n i++\n ) {\n const coord1 = previousCoordinates[i];\n const coord2 = currentCoordinates[i];\n\n if (coord1 && coord2) {\n const newValue = Math.abs(\n parseInt(coord1.value) - parseInt(coord2.value),\n ).toString();\n const newCoordinate: TApiaChartCoordinate = {\n key: coord2.key,\n color: coord2.color, // Assuming color is the same for both coordinates\n value: newValue,\n percentage:\n coord2.percentage !== '' && coord2.percentage !== undefined\n ? coord2.percentage\n : undefined,\n };\n\n difference.push(newCoordinate);\n } else if (!coord1 && coord2 && previousCoordinates.length > 0) {\n const newValue = Math.abs(0 - parseInt(coord2.value)).toString();\n const newCoordinate: TApiaChartCoordinate = {\n key: coord2.key,\n color: coord2.color, // Assuming color is the same for both coordinates\n value: newValue,\n percentage:\n coord2.percentage !== '' && coord2.percentage !== undefined\n ? coord2.percentage\n : undefined,\n };\n\n difference.push(newCoordinate);\n }\n }\n\n return animate(\n 500,\n (progress) => {\n const step: TApiaChartColumn = {\n color: piezas.color,\n name: incomingColumn.name,\n sets: difference.map((coord, i) => {\n return {\n key: coord.key,\n color: coord.color,\n percentage: coord.percentage,\n value: addBoundary(\n Number(currentCoordinates[i].value) >\n Number(\n previousCoordinates[i] ? previousCoordinates[i].value : 0,\n )\n ? Number(coord.value) * progress +\n Number(\n previousCoordinates[i]\n ? previousCoordinates[i].value\n : 0,\n )\n : Number(\n previousCoordinates[i]\n ? previousCoordinates[i].value\n : 0,\n ) -\n Number(coord.value) * progress,\n Math.min(\n Number(\n previousCoordinates[i] ? previousCoordinates[i].value : 0,\n ),\n Number(currentCoordinates[i].value),\n ),\n Math.max(\n Number(\n previousCoordinates[i] ? previousCoordinates[i].value : 0,\n ),\n Number(currentCoordinates[i].value),\n ),\n ).toString(),\n };\n }),\n };\n actualObjectRef.current = {\n color: step.color,\n coordinate: step.sets,\n name: step.name,\n };\n setDataset((prev) => {\n const newIndex = prev.findIndex((col) => {\n return col.name === step.name;\n });\n const returnObj = [...prev];\n if (newIndex >= 0) {\n returnObj[newIndex] = step;\n return returnObj;\n } else {\n return [step];\n }\n });\n },\n () => {\n const newPrev = {\n ...incomingColumn,\n coordinate: incomingColumn.sets,\n };\n previousObjectRef.current = newPrev;\n isAnimating.current = false;\n },\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }\n } else if (!previousObjectRef.current) {\n const newPrev = {\n ...incomingColumn,\n coordinate: incomingColumn.sets,\n };\n previousObjectRef.current = newPrev;\n isAnimating.current = false;\n }\n};\n"],"names":[],"mappings":";;;AASO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,cAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AACF,CASM,KAAA;AACJ,EAAM,MAAA,iBAAA,GAAoB,OAOxB,KAAS,CAAA,CAAA,CAAA;AAEX,EAAM,MAAA,eAAA,GAAkB,OAOtB,KAAS,CAAA,CAAA,CAAA;AAEX,EAAM,MAAA,WAAA,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