@tradingaction/tooltip 2.0.13
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/LICENSE +24 -0
- package/README.md +5 -0
- package/lib/BollingerBandTooltip.d.ts +40 -0
- package/lib/BollingerBandTooltip.js +48 -0
- package/lib/BollingerBandTooltip.js.map +1 -0
- package/lib/GroupTooltip.d.ts +41 -0
- package/lib/GroupTooltip.js +80 -0
- package/lib/GroupTooltip.js.map +1 -0
- package/lib/HoverTooltip.d.ts +57 -0
- package/lib/HoverTooltip.js +174 -0
- package/lib/HoverTooltip.js.map +1 -0
- package/lib/MACDTooltip.d.ts +46 -0
- package/lib/MACDTooltip.js +58 -0
- package/lib/MACDTooltip.js.map +1 -0
- package/lib/MovingAverageTooltip.d.ts +65 -0
- package/lib/MovingAverageTooltip.js +71 -0
- package/lib/MovingAverageTooltip.js.map +1 -0
- package/lib/OHLCTooltip.d.ts +65 -0
- package/lib/OHLCTooltip.js +78 -0
- package/lib/OHLCTooltip.js.map +1 -0
- package/lib/RSITooltip.d.ts +32 -0
- package/lib/RSITooltip.js +36 -0
- package/lib/RSITooltip.js.map +1 -0
- package/lib/SingleTooltip.d.ts +29 -0
- package/lib/SingleTooltip.js +82 -0
- package/lib/SingleTooltip.js.map +1 -0
- package/lib/SingleValueTooltip.d.ts +46 -0
- package/lib/SingleValueTooltip.js +65 -0
- package/lib/SingleValueTooltip.js.map +1 -0
- package/lib/StochasticTooltip.d.ts +43 -0
- package/lib/StochasticTooltip.js +44 -0
- package/lib/StochasticTooltip.js.map +1 -0
- package/lib/ToolTipTSpanLabel.d.ts +8 -0
- package/lib/ToolTipTSpanLabel.js +23 -0
- package/lib/ToolTipTSpanLabel.js.map +1 -0
- package/lib/ToolTipText.d.ts +9 -0
- package/lib/ToolTipText.js +24 -0
- package/lib/ToolTipText.js.map +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -0
- package/package.json +51 -0
- package/src/BollingerBandTooltip.tsx +99 -0
- package/src/GroupTooltip.tsx +152 -0
- package/src/HoverTooltip.tsx +270 -0
- package/src/MACDTooltip.tsx +116 -0
- package/src/MovingAverageTooltip.tsx +167 -0
- package/src/OHLCTooltip.tsx +150 -0
- package/src/RSITooltip.tsx +80 -0
- package/src/SingleTooltip.tsx +122 -0
- package/src/SingleValueTooltip.tsx +131 -0
- package/src/StochasticTooltip.tsx +97 -0
- package/src/ToolTipTSpanLabel.tsx +14 -0
- package/src/ToolTipText.tsx +15 -0
- package/src/index.ts +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
https://github.com/reactivemarkets/react-financial-charts
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2015-2018 Ragu Ramaswamy
|
|
5
|
+
Copyright (c) 2016 Julien Renaux
|
|
6
|
+
Copyright (c) 2019 Reactive Markets
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface BollingerBandTooltipProps {
|
|
3
|
+
readonly className?: string;
|
|
4
|
+
readonly displayFormat: (value: number) => string;
|
|
5
|
+
readonly displayInit?: string;
|
|
6
|
+
readonly displayValuesFor?: (props: BollingerBandTooltipProps, moreProps: any) => any;
|
|
7
|
+
readonly fontFamily?: string;
|
|
8
|
+
readonly fontSize?: number;
|
|
9
|
+
readonly fontWeight?: number;
|
|
10
|
+
readonly labelFill?: string;
|
|
11
|
+
readonly labelFontWeight?: number;
|
|
12
|
+
readonly onClick?: (event: React.MouseEvent) => void;
|
|
13
|
+
readonly options: {
|
|
14
|
+
movingAverageType: string;
|
|
15
|
+
multiplier: number;
|
|
16
|
+
sourcePath: string;
|
|
17
|
+
windowSize: number;
|
|
18
|
+
};
|
|
19
|
+
readonly origin?: [number, number] | ((width: number, height: number) => [number, number]);
|
|
20
|
+
readonly textFill?: string;
|
|
21
|
+
readonly yAccessor?: (data: any) => {
|
|
22
|
+
bottom: number;
|
|
23
|
+
middle: number;
|
|
24
|
+
top: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare class BollingerBandTooltip extends React.Component<BollingerBandTooltipProps> {
|
|
28
|
+
static defaultProps: {
|
|
29
|
+
className: string;
|
|
30
|
+
displayFormat: (n: number | {
|
|
31
|
+
valueOf(): number;
|
|
32
|
+
}) => string;
|
|
33
|
+
displayValuesFor: (_: any, props: any) => any;
|
|
34
|
+
displayInit: string;
|
|
35
|
+
origin: number[];
|
|
36
|
+
yAccessor: (data: any) => any;
|
|
37
|
+
};
|
|
38
|
+
render(): JSX.Element;
|
|
39
|
+
private readonly renderSVG;
|
|
40
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { functor, GenericChartComponent, last } from "@tradingaction/core";
|
|
2
|
+
import { format } from "d3-format";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ToolTipText } from "./ToolTipText";
|
|
5
|
+
import { ToolTipTSpanLabel } from "./ToolTipTSpanLabel";
|
|
6
|
+
export class BollingerBandTooltip extends React.Component {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.renderSVG = (moreProps) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const { onClick, displayFormat, yAccessor = BollingerBandTooltip.defaultProps.yAccessor, options, origin: originProp, textFill, labelFill, labelFontWeight, className, displayValuesFor = BollingerBandTooltip.defaultProps.displayValuesFor, displayInit, fontFamily, fontSize, fontWeight, } = this.props;
|
|
12
|
+
const { chartConfig: { width, height }, fullData, } = moreProps;
|
|
13
|
+
const currentItem = (_a = displayValuesFor(this.props, moreProps)) !== null && _a !== void 0 ? _a : last(fullData);
|
|
14
|
+
let top = displayInit;
|
|
15
|
+
let middle = displayInit;
|
|
16
|
+
let bottom = displayInit;
|
|
17
|
+
if (currentItem !== undefined) {
|
|
18
|
+
const item = yAccessor(currentItem);
|
|
19
|
+
if (item !== undefined) {
|
|
20
|
+
top = displayFormat(item.top);
|
|
21
|
+
middle = displayFormat(item.middle);
|
|
22
|
+
bottom = displayFormat(item.bottom);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const origin = functor(originProp);
|
|
26
|
+
const [x, y] = origin(width, height);
|
|
27
|
+
const { sourcePath, windowSize, multiplier, movingAverageType } = options;
|
|
28
|
+
const tooltipLabel = `BB(${sourcePath}, ${windowSize}, ${multiplier}, ${movingAverageType}): `;
|
|
29
|
+
const tooltipValue = `${top}, ${middle}, ${bottom}`;
|
|
30
|
+
return (React.createElement("g", { transform: `translate(${x}, ${y})`, className: className, onClick: onClick },
|
|
31
|
+
React.createElement(ToolTipText, { x: 0, y: 0, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight },
|
|
32
|
+
React.createElement(ToolTipTSpanLabel, { fill: labelFill, fontWeight: labelFontWeight }, tooltipLabel),
|
|
33
|
+
React.createElement("tspan", { fill: textFill }, tooltipValue))));
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
return React.createElement(GenericChartComponent, { clip: false, svgDraw: this.renderSVG, drawOn: ["mousemove"] });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
BollingerBandTooltip.defaultProps = {
|
|
41
|
+
className: "react-financial-charts-tooltip react-financial-charts-bollingerband-tooltip",
|
|
42
|
+
displayFormat: format(".2f"),
|
|
43
|
+
displayValuesFor: (_, props) => props.currentItem,
|
|
44
|
+
displayInit: "n/a",
|
|
45
|
+
origin: [8, 8],
|
|
46
|
+
yAccessor: (data) => data.bb,
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=BollingerBandTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BollingerBandTooltip.js","sourceRoot":"","sources":["../src/BollingerBandTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAwBxD,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAAoC;IAApF;;QAcqB,cAAS,GAAG,CAAC,SAAc,EAAE,EAAE;;YAC5C,MAAM,EACF,OAAO,EACP,aAAa,EACb,SAAS,GAAG,oBAAoB,CAAC,YAAY,CAAC,SAAS,EACvD,OAAO,EACP,MAAM,EAAE,UAAU,EAClB,QAA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H,2BAAG,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO;gBACzE,oBAAC,WAAW,IAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU;oBACvF,oBAAC,iBAAiB,IAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,IAC1D,YAAY,CACG;oBACpB,+BAAO,IAAI,EAAE,QAAQ,IAAG,YAAY,CAAS,CACnC,CACd,CACP,CAAC;QACN,CAAC,CAAC;IACN,CAAC;IA5DU,MAAM;QACT,OAAO,oBAAC,qBAAqB,IAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,GAAI,CAAC;IAClG,CAAC;;AAXa,iCAAY,GAAG;IACzB,SAAS,EAAE,6EAA6E;IACxF,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC;IAC5B,gBAAgB,EAAE,CAAC,CAAM,EAAE,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW;IAC3D,WAAW,EAAE,KAAK;IAClB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,SAAS,EAAE,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;CACpC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { layouts } from "./SingleTooltip";
|
|
3
|
+
export interface GroupTooltipProps {
|
|
4
|
+
readonly className?: string;
|
|
5
|
+
readonly fontFamily?: string;
|
|
6
|
+
readonly fontSize?: number;
|
|
7
|
+
readonly fontWeight?: number;
|
|
8
|
+
readonly displayFormat: (value: number) => string;
|
|
9
|
+
readonly displayInit?: string;
|
|
10
|
+
readonly displayValuesFor: (props: GroupTooltipProps, moreProps: any) => any;
|
|
11
|
+
readonly layout: layouts;
|
|
12
|
+
readonly onClick?: (event: React.MouseEvent, details: any) => void;
|
|
13
|
+
readonly options: {
|
|
14
|
+
labelFill?: string;
|
|
15
|
+
yLabel: string;
|
|
16
|
+
yAccessor: (data: any) => number;
|
|
17
|
+
valueFill?: string;
|
|
18
|
+
withShape?: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
readonly origin: [number, number];
|
|
21
|
+
readonly position?: "topRight" | "bottomLeft" | "bottomRight";
|
|
22
|
+
readonly verticalSize?: number;
|
|
23
|
+
readonly width?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare class GroupTooltip extends React.Component<GroupTooltipProps> {
|
|
26
|
+
static defaultProps: {
|
|
27
|
+
className: string;
|
|
28
|
+
layout: string;
|
|
29
|
+
displayFormat: (n: number | {
|
|
30
|
+
valueOf(): number;
|
|
31
|
+
}) => string;
|
|
32
|
+
displayInit: string;
|
|
33
|
+
displayValuesFor: (_: any, props: any) => any;
|
|
34
|
+
origin: number[];
|
|
35
|
+
width: number;
|
|
36
|
+
verticalSize: number;
|
|
37
|
+
};
|
|
38
|
+
render(): JSX.Element;
|
|
39
|
+
private readonly getPosition;
|
|
40
|
+
private readonly renderSVG;
|
|
41
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { GenericChartComponent, last } from "@tradingaction/core";
|
|
2
|
+
import { format } from "d3-format";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { SingleTooltip } from "./SingleTooltip";
|
|
5
|
+
import { ToolTipText } from "./ToolTipText";
|
|
6
|
+
export class GroupTooltip extends React.Component {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.getPosition = (moreProps) => {
|
|
10
|
+
const { position } = this.props;
|
|
11
|
+
const { height, width } = moreProps.chartConfig;
|
|
12
|
+
const dx = 20;
|
|
13
|
+
const dy = 40;
|
|
14
|
+
let textAnchor;
|
|
15
|
+
let xyPos = null;
|
|
16
|
+
if (position !== undefined) {
|
|
17
|
+
switch (position) {
|
|
18
|
+
case "topRight":
|
|
19
|
+
xyPos = [width - dx, null];
|
|
20
|
+
textAnchor = "end";
|
|
21
|
+
break;
|
|
22
|
+
case "bottomLeft":
|
|
23
|
+
xyPos = [null, height - dy];
|
|
24
|
+
break;
|
|
25
|
+
case "bottomRight":
|
|
26
|
+
xyPos = [width - dx, height - dy];
|
|
27
|
+
textAnchor = "end";
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
xyPos = [null, null];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
xyPos = [null, null];
|
|
35
|
+
}
|
|
36
|
+
return { xyPos, textAnchor };
|
|
37
|
+
};
|
|
38
|
+
this.renderSVG = (moreProps) => {
|
|
39
|
+
var _a;
|
|
40
|
+
const { chartId, fullData } = moreProps;
|
|
41
|
+
const { className, displayInit = GroupTooltip.defaultProps.displayInit, displayValuesFor, onClick, width = 60, verticalSize = 13, fontFamily, fontSize, fontWeight, layout, origin, displayFormat, options, } = this.props;
|
|
42
|
+
const currentItem = (_a = displayValuesFor(this.props, moreProps)) !== null && _a !== void 0 ? _a : last(fullData);
|
|
43
|
+
const { xyPos, textAnchor } = this.getPosition(moreProps);
|
|
44
|
+
const xPos = xyPos != null && xyPos[0] != null ? xyPos[0] : origin[0];
|
|
45
|
+
const yPos = xyPos != null && xyPos[1] != null ? xyPos[1] : origin[1];
|
|
46
|
+
const singleTooltip = options.map((each, idx) => {
|
|
47
|
+
const yValue = currentItem && each.yAccessor(currentItem);
|
|
48
|
+
const yDisplayValue = yValue ? displayFormat(yValue) : displayInit;
|
|
49
|
+
const orig = () => {
|
|
50
|
+
if (layout === "horizontal" || layout === "horizontalRows") {
|
|
51
|
+
return [width * idx, 0];
|
|
52
|
+
}
|
|
53
|
+
if (layout === "vertical") {
|
|
54
|
+
return [0, verticalSize * idx];
|
|
55
|
+
}
|
|
56
|
+
if (layout === "verticalRows") {
|
|
57
|
+
return [0, verticalSize * 2.3 * idx];
|
|
58
|
+
}
|
|
59
|
+
return [0, 0];
|
|
60
|
+
};
|
|
61
|
+
return (React.createElement(SingleTooltip, { key: idx, layout: layout, origin: orig(), yLabel: each.yLabel, yValue: yDisplayValue, options: each, forChart: chartId, onClick: onClick, fontFamily: fontFamily, fontSize: fontSize, labelFill: each.labelFill, valueFill: each.valueFill, withShape: each.withShape }));
|
|
62
|
+
});
|
|
63
|
+
return (React.createElement("g", { transform: `translate(${xPos}, ${yPos})`, className: className, textAnchor: textAnchor }, layout === "horizontalInline" ? (React.createElement(ToolTipText, { x: 0, y: 0, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight }, singleTooltip)) : (singleTooltip)));
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
return React.createElement(GenericChartComponent, { clip: false, svgDraw: this.renderSVG, drawOn: ["mousemove"] });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
GroupTooltip.defaultProps = {
|
|
71
|
+
className: "react-financial-charts-tooltip react-financial-charts-group-tooltip",
|
|
72
|
+
layout: "horizontal",
|
|
73
|
+
displayFormat: format(".2f"),
|
|
74
|
+
displayInit: "",
|
|
75
|
+
displayValuesFor: (_, props) => props.currentItem,
|
|
76
|
+
origin: [0, 0],
|
|
77
|
+
width: 60,
|
|
78
|
+
verticalSize: 13,
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=GroupTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupTooltip.js","sourceRoot":"","sources":["../src/GroupTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAW,aAAa,EAAE,MAAM,iBAAiB,C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CAAC,GAAI,CAAC;IAClG,CAAC;;AAba,yBAAY,GAAG;IACzB,SAAS,EAAE,qEAAqE;IAChF,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC;IAC5B,WAAW,EAAE,EAAE;IACf,gBAAgB,EAAE,CAAC,CAAM,EAAE,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW;IAC3D,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,KAAK,EAAE,EAAE;IACT,YAAY,EAAE,EAAE;CACnB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface HoverTooltipProps {
|
|
3
|
+
readonly background?: {
|
|
4
|
+
fillStyle?: string;
|
|
5
|
+
height?: number;
|
|
6
|
+
strokeStyle?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
};
|
|
9
|
+
readonly backgroundShapeCanvas: (props: HoverTooltipProps, { width, height }: {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}, ctx: CanvasRenderingContext2D) => void;
|
|
13
|
+
readonly chartId?: number | string;
|
|
14
|
+
readonly fontFamily?: string;
|
|
15
|
+
readonly fontFill?: string;
|
|
16
|
+
readonly fontSize?: number;
|
|
17
|
+
readonly origin?: (props: HoverTooltipProps, moreProps: any, bgSize: {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}, pointWidth: number) => [number, number];
|
|
21
|
+
readonly tooltip: {
|
|
22
|
+
content: (data: any) => {
|
|
23
|
+
x: string;
|
|
24
|
+
y: {
|
|
25
|
+
label: string;
|
|
26
|
+
value?: string;
|
|
27
|
+
stroke?: string;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly toolTipFillStyle?: string;
|
|
32
|
+
readonly toolTipStrokeStyle?: string;
|
|
33
|
+
readonly tooltipCanvas: (props: HoverTooltipProps, content: any, ctx: CanvasRenderingContext2D) => void;
|
|
34
|
+
readonly yAccessor: (data: any) => number;
|
|
35
|
+
}
|
|
36
|
+
export declare class HoverTooltip extends React.Component<HoverTooltipProps> {
|
|
37
|
+
static defaultProps: {
|
|
38
|
+
background: {
|
|
39
|
+
fillStyle: string;
|
|
40
|
+
};
|
|
41
|
+
toolTipFillStyle: string;
|
|
42
|
+
toolTipStrokeStyle: string;
|
|
43
|
+
tooltipCanvas: (props: HoverTooltipProps, content: any, ctx: CanvasRenderingContext2D) => void;
|
|
44
|
+
origin: (props: HoverTooltipProps, moreProps: any, bgSize: any, pointWidth: any) => any[];
|
|
45
|
+
backgroundShapeCanvas: (props: HoverTooltipProps, { width, height }: {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
}, ctx: CanvasRenderingContext2D) => void;
|
|
49
|
+
fontFill: string;
|
|
50
|
+
fontFamily: string;
|
|
51
|
+
fontSize: number;
|
|
52
|
+
};
|
|
53
|
+
static contextType: React.Context<import("@tradingaction/core/lib/ChartCanvas").ChartCanvasContextType<number | Date>>;
|
|
54
|
+
render(): JSX.Element;
|
|
55
|
+
private readonly drawOnCanvas;
|
|
56
|
+
private readonly helper;
|
|
57
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { max, sum } from "d3-array";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ChartCanvasContext, first, GenericComponent, isDefined, last } from "@tradingaction/core";
|
|
4
|
+
const PADDING = 4;
|
|
5
|
+
const X = 8;
|
|
6
|
+
const Y = 8;
|
|
7
|
+
const roundRect = (ctx, x, y, width, height, radius) => {
|
|
8
|
+
ctx.beginPath();
|
|
9
|
+
ctx.moveTo(x + radius, y);
|
|
10
|
+
ctx.lineTo(x + width - radius, y);
|
|
11
|
+
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
|
|
12
|
+
ctx.lineTo(x + width, y + height - radius);
|
|
13
|
+
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
|
|
14
|
+
ctx.lineTo(x + radius, y + height);
|
|
15
|
+
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
|
|
16
|
+
ctx.lineTo(x, y + radius);
|
|
17
|
+
ctx.quadraticCurveTo(x, y, x + radius, y);
|
|
18
|
+
ctx.closePath();
|
|
19
|
+
};
|
|
20
|
+
const defaultBackgroundShapeCanvas = (props, { width, height }, ctx) => {
|
|
21
|
+
const { toolTipFillStyle, toolTipStrokeStyle } = props;
|
|
22
|
+
ctx.beginPath();
|
|
23
|
+
roundRect(ctx, 0, 0, width, height, 4);
|
|
24
|
+
if (toolTipFillStyle !== undefined) {
|
|
25
|
+
ctx.fillStyle = toolTipFillStyle;
|
|
26
|
+
ctx.shadowColor = "#898";
|
|
27
|
+
ctx.shadowBlur = 4;
|
|
28
|
+
ctx.fill();
|
|
29
|
+
ctx.shadowBlur = 0;
|
|
30
|
+
}
|
|
31
|
+
if (toolTipStrokeStyle !== undefined) {
|
|
32
|
+
ctx.strokeStyle = toolTipStrokeStyle;
|
|
33
|
+
ctx.stroke();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const defaultTooltipCanvas = (props, content, ctx) => {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const { fontSize = 14, fontFamily, fontFill } = props;
|
|
39
|
+
const startY = Y + fontSize * 0.9;
|
|
40
|
+
ctx.font = `bold ${fontSize}px ${fontFamily}`;
|
|
41
|
+
if (fontFill !== undefined) {
|
|
42
|
+
ctx.fillStyle = fontFill;
|
|
43
|
+
}
|
|
44
|
+
ctx.textAlign = "left";
|
|
45
|
+
ctx.fillText(content.x, X, startY);
|
|
46
|
+
const maxLabel = (_a = max(content.y, (y) => ctx.measureText(y.label).width)) !== null && _a !== void 0 ? _a : 0;
|
|
47
|
+
for (let i = 0; i < content.y.length; i++) {
|
|
48
|
+
const y = content.y[i];
|
|
49
|
+
const textY = (i + 1) * PADDING + startY + fontSize * (i + 1);
|
|
50
|
+
ctx.font = `${fontSize}px ${fontFamily}`;
|
|
51
|
+
ctx.fillStyle = (_b = y.stroke) !== null && _b !== void 0 ? _b : fontFill;
|
|
52
|
+
ctx.fillText(y.label, X, textY);
|
|
53
|
+
if (fontFill !== undefined) {
|
|
54
|
+
ctx.fillStyle = fontFill;
|
|
55
|
+
}
|
|
56
|
+
ctx.fillText(y.value, X * 2 + maxLabel, textY);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const drawOnCanvas = (ctx, props, context, pointer, height) => {
|
|
60
|
+
const { margin, ratio } = context;
|
|
61
|
+
const { backgroundShapeCanvas, tooltipCanvas, background } = props;
|
|
62
|
+
const originX = 0.5 * ratio + margin.left;
|
|
63
|
+
const originY = 0.5 * ratio + margin.top;
|
|
64
|
+
ctx.save();
|
|
65
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
66
|
+
ctx.scale(ratio, ratio);
|
|
67
|
+
ctx.translate(originX, originY);
|
|
68
|
+
const { x, y, content, centerX, pointWidth, bgSize } = pointer;
|
|
69
|
+
if ((background === null || background === void 0 ? void 0 : background.fillStyle) !== undefined) {
|
|
70
|
+
ctx.fillStyle = background.fillStyle;
|
|
71
|
+
}
|
|
72
|
+
ctx.beginPath();
|
|
73
|
+
ctx.rect(centerX - pointWidth / 2, 0, pointWidth, height);
|
|
74
|
+
ctx.fill();
|
|
75
|
+
ctx.translate(x, y);
|
|
76
|
+
backgroundShapeCanvas(props, bgSize, ctx);
|
|
77
|
+
tooltipCanvas(props, content, ctx);
|
|
78
|
+
ctx.restore();
|
|
79
|
+
};
|
|
80
|
+
const calculateTooltipSize = (props, content, ctx) => {
|
|
81
|
+
const { fontFamily, fontSize = 12, fontFill } = props;
|
|
82
|
+
ctx.font = `bold ${fontSize}px ${fontFamily}`;
|
|
83
|
+
if (fontFill !== undefined) {
|
|
84
|
+
ctx.fillStyle = fontFill;
|
|
85
|
+
}
|
|
86
|
+
ctx.textAlign = "left";
|
|
87
|
+
const measureText = (str) => ({
|
|
88
|
+
width: ctx.measureText(str).width,
|
|
89
|
+
height: fontSize + PADDING,
|
|
90
|
+
});
|
|
91
|
+
const { width, height } = content.y
|
|
92
|
+
.map(({ label, value }) => measureText(`${label} ${value}`))
|
|
93
|
+
// Sum all y and x sizes (begin with x label size)
|
|
94
|
+
.reduce((res, size) => sumSizes(res, size), measureText(String(content.x)));
|
|
95
|
+
return {
|
|
96
|
+
width: width + 2 * X,
|
|
97
|
+
height: height + 2 * Y,
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
const sumSizes = (...sizes) => {
|
|
101
|
+
return {
|
|
102
|
+
width: Math.max(...sizes.map((size) => size.width)),
|
|
103
|
+
height: sum(sizes, (d) => d.height),
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
const normalizeX = (x, bgSize, pointWidth, width) => {
|
|
107
|
+
return x < width / 2 ? x + pointWidth / 2 + PADDING : x - bgSize.width - pointWidth / 2 - PADDING;
|
|
108
|
+
};
|
|
109
|
+
const normalizeY = (y, bgSize) => {
|
|
110
|
+
return y - bgSize.height <= 0 ? y + PADDING : y - bgSize.height - PADDING;
|
|
111
|
+
};
|
|
112
|
+
const defaultOrigin = (props, moreProps, bgSize, pointWidth) => {
|
|
113
|
+
const { chartId, yAccessor } = props;
|
|
114
|
+
const { mouseXY, xAccessor, currentItem, xScale, chartConfig, width } = moreProps;
|
|
115
|
+
let y = last(mouseXY);
|
|
116
|
+
const xValue = xAccessor(currentItem);
|
|
117
|
+
let x = Math.round(xScale(xValue));
|
|
118
|
+
if (isDefined(chartId) && isDefined(yAccessor) && isDefined(chartConfig) && isDefined(chartConfig.findIndex)) {
|
|
119
|
+
const yValue = yAccessor(currentItem);
|
|
120
|
+
const chartIndex = chartConfig.findIndex((c) => c.id === chartId);
|
|
121
|
+
y = Math.round(chartConfig[chartIndex].yScale(yValue));
|
|
122
|
+
}
|
|
123
|
+
x = normalizeX(x, bgSize, pointWidth, width);
|
|
124
|
+
y = normalizeY(y, bgSize);
|
|
125
|
+
return [x, y];
|
|
126
|
+
};
|
|
127
|
+
export class HoverTooltip extends React.Component {
|
|
128
|
+
constructor() {
|
|
129
|
+
super(...arguments);
|
|
130
|
+
this.drawOnCanvas = (ctx, moreProps) => {
|
|
131
|
+
const pointer = this.helper(ctx, moreProps);
|
|
132
|
+
if (pointer === undefined) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const { height } = moreProps;
|
|
136
|
+
drawOnCanvas(ctx, this.props, this.context, pointer, height);
|
|
137
|
+
};
|
|
138
|
+
this.helper = (ctx, moreProps) => {
|
|
139
|
+
const { show, xScale, currentItem, plotData, xAccessor, displayXAccessor } = moreProps;
|
|
140
|
+
const { origin = HoverTooltip.defaultProps.origin, tooltip } = this.props;
|
|
141
|
+
if (!show || currentItem === undefined) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const xValue = xAccessor(currentItem);
|
|
145
|
+
if (xValue === undefined) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const content = tooltip.content({ currentItem, xAccessor: displayXAccessor });
|
|
149
|
+
const centerX = xScale(xValue);
|
|
150
|
+
const pointWidth = Math.abs(xScale(xAccessor(last(plotData))) - xScale(xAccessor(first(plotData)))) / (plotData.length - 1);
|
|
151
|
+
const bgSize = calculateTooltipSize(this.props, content, ctx);
|
|
152
|
+
const [x, y] = origin(this.props, moreProps, bgSize, pointWidth);
|
|
153
|
+
return { x, y, content, centerX, pointWidth, bgSize };
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
render() {
|
|
157
|
+
return React.createElement(GenericComponent, { canvasDraw: this.drawOnCanvas, drawOn: ["mousemove", "pan"] });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
HoverTooltip.defaultProps = {
|
|
161
|
+
background: {
|
|
162
|
+
fillStyle: "rgba(33, 148, 243, 0.1)",
|
|
163
|
+
},
|
|
164
|
+
toolTipFillStyle: "rgba(250, 250, 250, 1)",
|
|
165
|
+
toolTipStrokeStyle: "rgba(33, 148, 243)",
|
|
166
|
+
tooltipCanvas: defaultTooltipCanvas,
|
|
167
|
+
origin: defaultOrigin,
|
|
168
|
+
backgroundShapeCanvas: defaultBackgroundShapeCanvas,
|
|
169
|
+
fontFill: "#000000",
|
|
170
|
+
fontFamily: "-apple-system, system-ui, Roboto, 'Helvetica Neue', Ubuntu, sans-serif",
|
|
171
|
+
fontSize: 14,
|
|
172
|
+
};
|
|
173
|
+
HoverTooltip.contextType = ChartCanvasContext;
|
|
174
|
+
//# sourceMappingURL=HoverTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverTooltip.js","sourceRoot":"","sources":["../src/HoverTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEnG,MAAM,OAAO,GAAG,CAAC,CAAC;AAClB,MAAM,CAAC,GAAG,CAAC,CAAC;AACZ,MAAM,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,SAAS,GAAG,CACd,GAA6B,EAC7B,CAAS,EACT,CAAS,EACT,KAAa,EACb,MAAc,EACd,MAAc,EAChB,EAAE;IACA,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1B,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IAClC,GAAG,CAAC,gBAAgB,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;IAC1D,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,EAA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,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAC1D,CAAC,CAAC;IACN,CAAC;IAxCU,MAAM;QACT,OAAO,oBAAC,gBAAgB,IAAC,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,GAAI,CAAC;IAC7F,CAAC;;AAlBa,yBAAY,GAAG;IACzB,UAAU,EAAE;QACR,SAAS,EAAE,yBAAyB;KACvC;IACD,gBAAgB,EAAE,wBAAwB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,aAAa,EAAE,oBAAoB;IACnC,MAAM,EAAE,aAAa;IACrB,qBAAqB,EAAE,4BAA4B;IACnD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,wEAAwE;IACpF,QAAQ,EAAE,EAAE;CACf,CAAC;AAEY,wBAAW,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface MACDTooltipProps {
|
|
3
|
+
readonly origin: number[] | ((width: number, height: number) => [number, number]);
|
|
4
|
+
readonly className?: string;
|
|
5
|
+
readonly fontFamily?: string;
|
|
6
|
+
readonly fontSize?: number;
|
|
7
|
+
readonly fontWeight?: number;
|
|
8
|
+
readonly labelFill?: string;
|
|
9
|
+
readonly labelFontWeight?: number;
|
|
10
|
+
readonly onClick?: (event: React.MouseEvent) => void;
|
|
11
|
+
readonly options: {
|
|
12
|
+
slow: number;
|
|
13
|
+
fast: number;
|
|
14
|
+
signal: number;
|
|
15
|
+
};
|
|
16
|
+
readonly appearance: {
|
|
17
|
+
strokeStyle: {
|
|
18
|
+
macd: string;
|
|
19
|
+
signal: string;
|
|
20
|
+
};
|
|
21
|
+
fillStyle: {
|
|
22
|
+
divergence: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
readonly displayFormat: (value: number) => string;
|
|
26
|
+
readonly displayInit?: string;
|
|
27
|
+
readonly displayValuesFor: (props: MACDTooltipProps, moreProps: any) => any | undefined;
|
|
28
|
+
readonly yAccessor: (data: any) => {
|
|
29
|
+
macd: number;
|
|
30
|
+
signal: number;
|
|
31
|
+
divergence: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare class MACDTooltip extends React.Component<MACDTooltipProps> {
|
|
35
|
+
static defaultProps: {
|
|
36
|
+
className: string;
|
|
37
|
+
displayFormat: (n: number | {
|
|
38
|
+
valueOf(): number;
|
|
39
|
+
}) => string;
|
|
40
|
+
displayInit: string;
|
|
41
|
+
displayValuesFor: (_: any, props: any) => any;
|
|
42
|
+
origin: number[];
|
|
43
|
+
};
|
|
44
|
+
render(): JSX.Element;
|
|
45
|
+
private readonly renderSVG;
|
|
46
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { functor, GenericChartComponent, last } from "@tradingaction/core";
|
|
2
|
+
import { format } from "d3-format";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ToolTipText } from "./ToolTipText";
|
|
5
|
+
import { ToolTipTSpanLabel } from "./ToolTipTSpanLabel";
|
|
6
|
+
export class MACDTooltip extends React.Component {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.renderSVG = (moreProps) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const { onClick, displayInit, fontFamily, fontSize, fontWeight, displayValuesFor, displayFormat, className, yAccessor, options, origin: originProp, appearance, labelFill, labelFontWeight, } = this.props;
|
|
12
|
+
const { chartConfig: { width, height }, fullData, } = moreProps;
|
|
13
|
+
const currentItem = (_a = displayValuesFor(this.props, moreProps)) !== null && _a !== void 0 ? _a : last(fullData);
|
|
14
|
+
const macdValue = currentItem && yAccessor(currentItem);
|
|
15
|
+
const macd = ((macdValue === null || macdValue === void 0 ? void 0 : macdValue.macd) && displayFormat(macdValue.macd)) || displayInit;
|
|
16
|
+
const signal = ((macdValue === null || macdValue === void 0 ? void 0 : macdValue.signal) && displayFormat(macdValue.signal)) || displayInit;
|
|
17
|
+
const divergence = ((macdValue === null || macdValue === void 0 ? void 0 : macdValue.divergence) && displayFormat(macdValue.divergence)) || displayInit;
|
|
18
|
+
const origin = functor(originProp);
|
|
19
|
+
const [x, y] = origin(width, height);
|
|
20
|
+
return (React.createElement("g", { className: className, transform: `translate(${x}, ${y})`, onClick: onClick },
|
|
21
|
+
React.createElement(ToolTipText, { x: 0, y: 0, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight },
|
|
22
|
+
React.createElement(ToolTipTSpanLabel, { fill: labelFill, fontWeight: labelFontWeight }, "MACD ("),
|
|
23
|
+
React.createElement("tspan", { fill: appearance.strokeStyle.macd }, options.slow),
|
|
24
|
+
React.createElement(ToolTipTSpanLabel, { fill: labelFill, fontWeight: labelFontWeight },
|
|
25
|
+
",",
|
|
26
|
+
" "),
|
|
27
|
+
React.createElement("tspan", { fill: appearance.strokeStyle.macd }, options.fast),
|
|
28
|
+
React.createElement(ToolTipTSpanLabel, { fill: labelFill, fontWeight: labelFontWeight },
|
|
29
|
+
"):",
|
|
30
|
+
" "),
|
|
31
|
+
React.createElement("tspan", { fill: appearance.strokeStyle.macd }, macd),
|
|
32
|
+
React.createElement(ToolTipTSpanLabel, { fill: labelFill, fontWeight: labelFontWeight },
|
|
33
|
+
" ",
|
|
34
|
+
"Signal ("),
|
|
35
|
+
React.createElement("tspan", { fill: appearance.strokeStyle.signal }, options.signal),
|
|
36
|
+
React.createElement(ToolTipTSpanLabel, { fill: labelFill, fontWeight: labelFontWeight },
|
|
37
|
+
"):",
|
|
38
|
+
" "),
|
|
39
|
+
React.createElement("tspan", { fill: appearance.strokeStyle.signal }, signal),
|
|
40
|
+
React.createElement(ToolTipTSpanLabel, { fill: labelFill, fontWeight: labelFontWeight },
|
|
41
|
+
" ",
|
|
42
|
+
"Divergence:",
|
|
43
|
+
" "),
|
|
44
|
+
React.createElement("tspan", { fill: appearance.fillStyle.divergence }, divergence))));
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
return React.createElement(GenericChartComponent, { clip: false, svgDraw: this.renderSVG, drawOn: ["mousemove"] });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
MACDTooltip.defaultProps = {
|
|
52
|
+
className: "react-financial-charts-tooltip",
|
|
53
|
+
displayFormat: format(".2f"),
|
|
54
|
+
displayInit: "n/a",
|
|
55
|
+
displayValuesFor: (_, props) => props.currentItem,
|
|
56
|
+
origin: [0, 0],
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=MACDTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MACDTooltip.js","sourceRoot":"","sources":["../src/MACDTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA+BxD,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA2B;IAAlE;;QAaqB,cAAS,GAAG,CAAC,SAAc,EAAE,EAAE;;YAC5C,MAAM,EACF,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EACP,MAAM,EAAE,UAAU,EAClB,UAAU,EACV,SAAS,EACT,eAAe,GAClB,GAAG,IAAI,CAAC,KAAK,CAAC;YAEf,MAAM,EACF,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAC9B,QAAQ,GACX,GAAG,SAAS,CAAC;YAEd,MAAM,WAAW,GAAG,MAAA,g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