@kodiak-finance/orderly-chart 2.8.16-rc.1 → 2.8.16-rc.3
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.d.mts +89 -1
- package/dist/index.d.ts +89 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -40,6 +40,94 @@ type PnlAreaChartProps$1 = {
|
|
|
40
40
|
};
|
|
41
41
|
declare const PnlAreaChart: React.FC<PnlAreaChartProps$1>;
|
|
42
42
|
|
|
43
|
+
type CombinedPnLChartDataItem = {
|
|
44
|
+
date: string;
|
|
45
|
+
pnl: number;
|
|
46
|
+
};
|
|
47
|
+
type CombinedPnLChartProps = {
|
|
48
|
+
data: ReadonlyArray<CombinedPnLChartDataItem> | CombinedPnLChartDataItem[];
|
|
49
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
50
|
+
colors?: {
|
|
51
|
+
profit: string;
|
|
52
|
+
loss: string;
|
|
53
|
+
};
|
|
54
|
+
isMobile?: boolean;
|
|
55
|
+
invisible?: boolean;
|
|
56
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
57
|
+
className?: string;
|
|
58
|
+
};
|
|
59
|
+
declare const CombinedPnLChart: React.FC<CombinedPnLChartProps>;
|
|
60
|
+
|
|
61
|
+
type CombinedVolumeChartDataItem = {
|
|
62
|
+
date: string;
|
|
63
|
+
volume: number;
|
|
64
|
+
};
|
|
65
|
+
type CombinedVolumeChartProps = {
|
|
66
|
+
data: ReadonlyArray<CombinedVolumeChartDataItem> | CombinedVolumeChartDataItem[];
|
|
67
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
68
|
+
colors?: {
|
|
69
|
+
fill: string;
|
|
70
|
+
};
|
|
71
|
+
isMobile?: boolean;
|
|
72
|
+
invisible?: boolean;
|
|
73
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
74
|
+
className?: string;
|
|
75
|
+
};
|
|
76
|
+
declare const CombinedVolumeChart: React.FC<CombinedVolumeChartProps>;
|
|
77
|
+
|
|
78
|
+
type CombinedFeesChartDataItem = {
|
|
79
|
+
date: string;
|
|
80
|
+
fees: number;
|
|
81
|
+
};
|
|
82
|
+
type CombinedFeesChartProps = {
|
|
83
|
+
data: ReadonlyArray<CombinedFeesChartDataItem> | CombinedFeesChartDataItem[];
|
|
84
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
85
|
+
colors?: {
|
|
86
|
+
fill: string;
|
|
87
|
+
};
|
|
88
|
+
isMobile?: boolean;
|
|
89
|
+
invisible?: boolean;
|
|
90
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
91
|
+
className?: string;
|
|
92
|
+
};
|
|
93
|
+
declare const CombinedFeesChart: React.FC<CombinedFeesChartProps>;
|
|
94
|
+
|
|
95
|
+
type CombinedPriceChartDataItem = {
|
|
96
|
+
date: string;
|
|
97
|
+
open: number;
|
|
98
|
+
high: number;
|
|
99
|
+
low: number;
|
|
100
|
+
close: number;
|
|
101
|
+
};
|
|
102
|
+
type CombinedPriceChartProps = {
|
|
103
|
+
data: ReadonlyArray<CombinedPriceChartDataItem> | CombinedPriceChartDataItem[];
|
|
104
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
105
|
+
isMobile?: boolean;
|
|
106
|
+
invisible?: boolean;
|
|
107
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
108
|
+
className?: string;
|
|
109
|
+
};
|
|
110
|
+
declare const CombinedPriceChart: React.FC<CombinedPriceChartProps>;
|
|
111
|
+
|
|
112
|
+
type ChartEmptyStateProps = {
|
|
113
|
+
title?: string;
|
|
114
|
+
description?: string;
|
|
115
|
+
height?: string;
|
|
116
|
+
className?: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Reusable empty state component for charts when no data is available.
|
|
120
|
+
* Displays an icon, title, and optional description in a centered layout.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* <ChartEmptyState
|
|
124
|
+
* title="No Trading Activity"
|
|
125
|
+
* description="No trades were recorded for the selected period"
|
|
126
|
+
* height="300px"
|
|
127
|
+
* />
|
|
128
|
+
*/
|
|
129
|
+
declare const ChartEmptyState: React.FC<ChartEmptyStateProps>;
|
|
130
|
+
|
|
43
131
|
type AssetChartDataItem$1 = {
|
|
44
132
|
date: string;
|
|
45
133
|
account_value: number;
|
|
@@ -91,4 +179,4 @@ declare const VolBarChart: React.FC<VolChartProps>;
|
|
|
91
179
|
|
|
92
180
|
declare const chartPlugin: PluginCreator;
|
|
93
181
|
|
|
94
|
-
export { AssetAreaChart, type AssetChartDataItem$1 as AssetChartDataItem, AssetLineChart, PnLBarChart, PnlAreaChart, type PnlAreaChartProps, PnlLineChart, type PnlLineChartProps, VolBarChart, type VolChartDataItem, chartPlugin };
|
|
182
|
+
export { AssetAreaChart, type AssetChartDataItem$1 as AssetChartDataItem, AssetLineChart, ChartEmptyState, type ChartEmptyStateProps, CombinedFeesChart, type CombinedFeesChartDataItem, type CombinedFeesChartProps, CombinedPnLChart, type CombinedPnLChartDataItem, type CombinedPnLChartProps, CombinedPriceChart, type CombinedPriceChartDataItem, type CombinedPriceChartProps, CombinedVolumeChart, type CombinedVolumeChartDataItem, type CombinedVolumeChartProps, PnLBarChart, PnlAreaChart, type PnlAreaChartProps, PnlLineChart, type PnlLineChartProps, VolBarChart, type VolChartDataItem, chartPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,94 @@ type PnlAreaChartProps$1 = {
|
|
|
40
40
|
};
|
|
41
41
|
declare const PnlAreaChart: React.FC<PnlAreaChartProps$1>;
|
|
42
42
|
|
|
43
|
+
type CombinedPnLChartDataItem = {
|
|
44
|
+
date: string;
|
|
45
|
+
pnl: number;
|
|
46
|
+
};
|
|
47
|
+
type CombinedPnLChartProps = {
|
|
48
|
+
data: ReadonlyArray<CombinedPnLChartDataItem> | CombinedPnLChartDataItem[];
|
|
49
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
50
|
+
colors?: {
|
|
51
|
+
profit: string;
|
|
52
|
+
loss: string;
|
|
53
|
+
};
|
|
54
|
+
isMobile?: boolean;
|
|
55
|
+
invisible?: boolean;
|
|
56
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
57
|
+
className?: string;
|
|
58
|
+
};
|
|
59
|
+
declare const CombinedPnLChart: React.FC<CombinedPnLChartProps>;
|
|
60
|
+
|
|
61
|
+
type CombinedVolumeChartDataItem = {
|
|
62
|
+
date: string;
|
|
63
|
+
volume: number;
|
|
64
|
+
};
|
|
65
|
+
type CombinedVolumeChartProps = {
|
|
66
|
+
data: ReadonlyArray<CombinedVolumeChartDataItem> | CombinedVolumeChartDataItem[];
|
|
67
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
68
|
+
colors?: {
|
|
69
|
+
fill: string;
|
|
70
|
+
};
|
|
71
|
+
isMobile?: boolean;
|
|
72
|
+
invisible?: boolean;
|
|
73
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
74
|
+
className?: string;
|
|
75
|
+
};
|
|
76
|
+
declare const CombinedVolumeChart: React.FC<CombinedVolumeChartProps>;
|
|
77
|
+
|
|
78
|
+
type CombinedFeesChartDataItem = {
|
|
79
|
+
date: string;
|
|
80
|
+
fees: number;
|
|
81
|
+
};
|
|
82
|
+
type CombinedFeesChartProps = {
|
|
83
|
+
data: ReadonlyArray<CombinedFeesChartDataItem> | CombinedFeesChartDataItem[];
|
|
84
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
85
|
+
colors?: {
|
|
86
|
+
fill: string;
|
|
87
|
+
};
|
|
88
|
+
isMobile?: boolean;
|
|
89
|
+
invisible?: boolean;
|
|
90
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
91
|
+
className?: string;
|
|
92
|
+
};
|
|
93
|
+
declare const CombinedFeesChart: React.FC<CombinedFeesChartProps>;
|
|
94
|
+
|
|
95
|
+
type CombinedPriceChartDataItem = {
|
|
96
|
+
date: string;
|
|
97
|
+
open: number;
|
|
98
|
+
high: number;
|
|
99
|
+
low: number;
|
|
100
|
+
close: number;
|
|
101
|
+
};
|
|
102
|
+
type CombinedPriceChartProps = {
|
|
103
|
+
data: ReadonlyArray<CombinedPriceChartDataItem> | CombinedPriceChartDataItem[];
|
|
104
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
105
|
+
isMobile?: boolean;
|
|
106
|
+
invisible?: boolean;
|
|
107
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
108
|
+
className?: string;
|
|
109
|
+
};
|
|
110
|
+
declare const CombinedPriceChart: React.FC<CombinedPriceChartProps>;
|
|
111
|
+
|
|
112
|
+
type ChartEmptyStateProps = {
|
|
113
|
+
title?: string;
|
|
114
|
+
description?: string;
|
|
115
|
+
height?: string;
|
|
116
|
+
className?: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Reusable empty state component for charts when no data is available.
|
|
120
|
+
* Displays an icon, title, and optional description in a centered layout.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* <ChartEmptyState
|
|
124
|
+
* title="No Trading Activity"
|
|
125
|
+
* description="No trades were recorded for the selected period"
|
|
126
|
+
* height="300px"
|
|
127
|
+
* />
|
|
128
|
+
*/
|
|
129
|
+
declare const ChartEmptyState: React.FC<ChartEmptyStateProps>;
|
|
130
|
+
|
|
43
131
|
type AssetChartDataItem$1 = {
|
|
44
132
|
date: string;
|
|
45
133
|
account_value: number;
|
|
@@ -91,4 +179,4 @@ declare const VolBarChart: React.FC<VolChartProps>;
|
|
|
91
179
|
|
|
92
180
|
declare const chartPlugin: PluginCreator;
|
|
93
181
|
|
|
94
|
-
export { AssetAreaChart, type AssetChartDataItem$1 as AssetChartDataItem, AssetLineChart, PnLBarChart, PnlAreaChart, type PnlAreaChartProps, PnlLineChart, type PnlLineChartProps, VolBarChart, type VolChartDataItem, chartPlugin };
|
|
182
|
+
export { AssetAreaChart, type AssetChartDataItem$1 as AssetChartDataItem, AssetLineChart, ChartEmptyState, type ChartEmptyStateProps, CombinedFeesChart, type CombinedFeesChartDataItem, type CombinedFeesChartProps, CombinedPnLChart, type CombinedPnLChartDataItem, type CombinedPnLChartProps, CombinedPriceChart, type CombinedPriceChartDataItem, type CombinedPriceChartProps, CombinedVolumeChart, type CombinedVolumeChartDataItem, type CombinedVolumeChartProps, PnLBarChart, PnlAreaChart, type PnlAreaChartProps, PnlLineChart, type PnlLineChartProps, VolBarChart, type VolChartDataItem, chartPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var react=require('react'),recharts=require('recharts'),orderlyI18n=require('@kodiak-finance/orderly-i18n'),orderlyUi=require('@kodiak-finance/orderly-ui'),orderlyUtils=require('@kodiak-finance/orderly-utils'),jsxRuntime=require('react/jsx-runtime');var E=Object.create;var A=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var F=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var U=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of H(r))!Q.call(t,a)&&a!==e&&A(t,a,{get:()=>r[a],enumerable:!(o=Y(r,a))||o.enumerable});return t};var J=(t,r,e)=>(e=t!=null?E(q(t)):{},U(!t||!t.__esModule?A(e,"default",{value:t,enumerable:true}):e,t));var z=F(k=>{Object.defineProperty(k,"__esModule",{value:true});Object.defineProperty(k,"default",{enumerable:true,get:function(){return Xe}});function V(t,r){return {handler:t,config:r}}V.withOptions=function(t,r=()=>({})){let e=function(o){return {__options:o,handler:t(o),config:r(o)}};return e.__isOptionsFunction=true,e.__pluginFunction=t,e.__configFunction=r,e};var Xe=V;});var N=F(P=>{Object.defineProperty(P,"__esModule",{value:true});Object.defineProperty(P,"default",{enumerable:true,get:function(){return Ye}});var We=Ee(z());function Ee(t){return t&&t.__esModule?t:{default:t}}var Ye=We.default;});var $=F((ho,M)=>{var R=N();M.exports=(R.__esModule?R:{default:R}).default;});var d=t=>{let r=Math.abs(t),e=r===0?0:r<=10?2:r<=100?1:0,o=orderlyUtils.numberToHumanStyle(r,e);return t<0?`-${o}`:o};var p=t=>{let{label:r,value:e,prefix:o,unit:a="USDC",coloring:i=false,dp:n,rm:g}=t;return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",className:t.titleClassName,children:[o,jsxRuntime.jsx(orderlyUi.Text.numeral,{unit:a,as:"div",size:"sm",coloring:i,showIdentifier:i,unitClassName:"oui-text-base-contrast-54 oui-ml-1",weight:"semibold",rm:g,dp:n,children:e})]}),jsxRuntime.jsx(orderlyUi.Text,{size:"2xs",intensity:54,weight:"semibold",children:r})]})};var S=()=>{let t=document.documentElement,r=getComputedStyle(t);return {primary:y(r.getPropertyValue("--oui-color-primary")),primaryLight:y(r.getPropertyValue("--oui-color-primary-light")),secondary:y(r.getPropertyValue("--oui-color-secondary")),success:y(r.getPropertyValue("--oui-color-success")),warning:y(r.getPropertyValue("--oui-color-warning")),danger:y(r.getPropertyValue("--oui-color-danger")),info:y(r.getPropertyValue("--oui-color-info")),loss:y(r.getPropertyValue("--oui-color-trading-loss")),profit:y(r.getPropertyValue("--oui-color-trading-profit"))}},y=t=>`rgb(${t.split(" ").join(",")})`;var m=t=>react.useMemo(()=>{let e=S();return {profit:t?.profit||e.profit,loss:t?.loss||e.loss,primary:e.primary,primaryLight:e.primaryLight}},[t]);var ft=t=>{let{fill:r,x:e,y:o,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?o:o+i,width:a,height:n,stroke:"none",fill:r})},dt=t=>{let{x:r,y:e,stroke:o,payload:a,index:i,width:n,containerWidth:g}=t,{t:X}=orderlyI18n.useTranslation(),W=i===0?48:g>0?g-10:n+a.offset;return jsxRuntime.jsx("g",{transform:`translate(${W},${e-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:i===0?"start":"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:i===0?a.value:X("chart.now")})})},yt=t=>{let{width:r,height:e,stroke:o,fill:a}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},ht=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(p,{label:o===a.current?i("chart.now"):o,value:e[0].value,coloring:true}):null},Ct=t=>{let{invisible:r,data:e,responsiveContainerProps:o}=t,a=m(t.colors),i=react.useRef(0);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:orderlyUi.cn(r&&"chart-invisible"),onResize:n=>{i.current=n;},...o,children:jsxRuntime.jsxs(recharts.BarChart,{data:e,margin:{left:-10,top:10,right:10,bottom:30},children:[!r&&jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(yt,{}),content:jsxRuntime.jsx(ht,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),!r&&jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(ft,{}),children:e.map((n,g)=>jsxRuntime.jsx(recharts.Cell,{fill:n.pnl>0?a.profit:a.loss},`cell-${g}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickFormatter:n=>d(n),tickLine:false,axisLine:false,dataKey:"pnl"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:e.length-2,height:1,tick:jsxRuntime.jsx(dt,{containerWidth:i.current}),stroke:"#FFFFFF",strokeOpacity:.04})]})})};var h=t=>{let{x:r,y:e,stroke:o,payload:a,index:i}=t,{t:n}=orderlyI18n.useTranslation();return jsxRuntime.jsx("g",{transform:`translate(${r},${e-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:i===0?a.value:n("chart.now")})})};var wt=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(p,{label:o===a.current?i("chart.now"):o,value:e[0].value,coloring:true}):null},_t=t=>{let r=[];return t?.reduce((e,o)=>(e+=o.pnl,r.push({...o,pnl:e,_pnl:o.pnl}),e),0),r},Bt=t=>{let{responsiveContainerProps:r}=t,e=m(t.colors),{isMobile:o}=orderlyUi.useScreen(),a=react.useMemo(()=>_t(t.data),[t.data]),i=jsxRuntime.jsxs(recharts.LineChart,{data:a,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(h,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:d}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(wt,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:o?1.5:2,dot:false,isAnimationActive:false})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...r,children:i})};var Ht=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(p,{label:o===a.current?i("chart.now"):o,value:e[0].value,coloring:true}):null},qt=t=>{let r=[];return t?.reduce((e,o)=>(e+=o.pnl,r.push({...o,pnl:e,_pnl:o.pnl}),e),0),r},Qt=t=>{let{responsiveContainerProps:r}=t,e=m(t.colors),{isMobile:o}=orderlyUi.useScreen(),a=react.useId(),i=react.useMemo(()=>qt(t.data),[t.data]),n=jsxRuntime.jsxs(recharts.AreaChart,{data:i,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(h,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:d}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Ht,{})}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#608CFF",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#608CFF",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:o?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${a})`})]})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...r,children:n})};var se=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(p,{label:o===a.current?i("chart.now"):o,value:e[0].value}):null},le=t=>{let{responsiveContainerProps:r}=t,e=m(t.colors),o=react.useId(),{isMobile:a}=orderlyUi.useScreen(),i=a?jsxRuntime.jsxs(recharts.AreaChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(h,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:n=>d(n)}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${o})`})]})]}):jsxRuntime.jsxs(recharts.LineChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(h,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:d}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(se,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...r,children:i})};var be=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(p,{label:o===a.current?i("chart.now"):o,value:e[0].value}):null},xe=t=>{let{responsiveContainerProps:r}=t,e=m(t.colors),o=react.useId(),{isMobile:a}=orderlyUi.useScreen(),i=jsxRuntime.jsxs(recharts.AreaChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(h,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:d}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(be,{})}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${o})`})]})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...r,children:i})};var Ke=t=>{let{fill:r,x:e,y:o,width:a,height:i,opacity:n}=t,g=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?o:o+i,width:a,height:g,stroke:"none",fill:r,opacity:n})},Ve=t=>{let{width:r,height:e,payload:o,stroke:a,fill:i}=t;return o?.[0]?.value===0?null:jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},ze=t=>{let{active:r,payload:e,label:o,tooltip:a}=t;return e?.[0]?.value===0?null:r&&e&&e.length?jsxRuntime.jsx(p,{label:o,value:e[0].value,titleClassName:"oui-gap-4",rm:a?.rm,dp:a?.dp}):null},Ne=t=>{let r=m(t.colors?.fill?{profit:t.colors?.fill,loss:t.colors?.fill}:void 0),e=t.data?.reduce((i,n)=>i+n.volume,0)===0,o=t.data?.reduce((i,n)=>i>n.volume?i:n.volume,0),a=o<=10?2:o<=100?1:0;return jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn(t.className),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{children:jsxRuntime.jsxs(recharts.BarChart,{data:t.data,margin:{left:-0,top:6,right:0,bottom:20},children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Ve,{}),content:jsxRuntime.jsx(ze,{tooltip:t.tooltip})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.08,repeatCount:6}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"#000"}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(Ke,{}),minPointSize:1,children:t.data.map((i,n)=>jsxRuntime.jsx(recharts.Cell,{fill:i.volume>0?r.profit:r.loss,opacity:i.opacity},`cell-${n}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,dataKey:"volume",tickFormatter:(i,n)=>e?`${n*100}`:Me(i,a),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"rgb(229, 231, 235)",strokeOpacity:.2})]})})})};function Me(t,r=0){let e=["","K","M","B","T"],o=0;for(;t>=1e3&&o<e.length-1;)t/=1e3,o++;return `${$e(t,r)}${e[o]}`}function $e(t,r){let e=t.toString(),o=e.indexOf(".");if(o===-1||r===0)return e.split(".")[0];let a=o+r+1;return e.slice(0,a)}var G=J($()),He=()=>(0, G.default)(function({addComponents:t,addBase:r}){t({".xAxis":{".recharts-cartesian-axis-tick:first-child text":{"text-anchor":"start"},".recharts-cartesian-axis-tick:last-child text":{"text-anchor":"end"}}},{respectPrefix:false});});Object.defineProperty(exports,"Area",{enumerable:true,get:function(){return recharts.Area}});Object.defineProperty(exports,"AreaChart",{enumerable:true,get:function(){return recharts.AreaChart}});Object.defineProperty(exports,"Bar",{enumerable:true,get:function(){return recharts.Bar}});Object.defineProperty(exports,"BarChart",{enumerable:true,get:function(){return recharts.BarChart}});Object.defineProperty(exports,"Cell",{enumerable:true,get:function(){return recharts.Cell}});Object.defineProperty(exports,"Line",{enumerable:true,get:function(){return recharts.Line}});Object.defineProperty(exports,"LineChart",{enumerable:true,get:function(){return recharts.LineChart}});exports.AssetAreaChart=xe;exports.AssetLineChart=le;exports.PnLBarChart=Ct;exports.PnlAreaChart=Qt;exports.PnlLineChart=Bt;exports.VolBarChart=Ne;exports.chartPlugin=He;//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';var react=require('react'),recharts=require('recharts'),orderlyI18n=require('@kodiak-finance/orderly-i18n'),orderlyUi=require('@kodiak-finance/orderly-ui'),orderlyUtils=require('@kodiak-finance/orderly-utils'),jsxRuntime=require('react/jsx-runtime');var Ft=Object.create;var q=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var $=(t,o)=>()=>(o||t((o={exports:{}}).exports,o),o.exports);var Mt=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of Pt(o))!At.call(t,a)&&a!==e&&q(t,a,{get:()=>o[a],enumerable:!(r=kt(o,a))||r.enumerable});return t};var Tt=(t,o,e)=>(e=t!=null?Ft(Rt(t)):{},Mt(!t||!t.__esModule?q(e,"default",{value:t,enumerable:true}):e,t));var Ct=$(U=>{Object.defineProperty(U,"__esModule",{value:true});Object.defineProperty(U,"default",{enumerable:true,get:function(){return qr}});function yt(t,o){return {handler:t,config:o}}yt.withOptions=function(t,o=()=>({})){let e=function(r){return {__options:r,handler:t(r),config:o(r)}};return e.__isOptionsFunction=true,e.__pluginFunction=t,e.__configFunction=o,e};var qr=yt;});var bt=$(Y=>{Object.defineProperty(Y,"__esModule",{value:true});Object.defineProperty(Y,"default",{enumerable:true,get:function(){return Zr}});var Qr=Jr(Ct());function Jr(t){return t&&t.__esModule?t:{default:t}}var Zr=Qr.default;});var gt=$((un,xt)=>{var H=bt();xt.exports=(H.__esModule?H:{default:H}).default;});var P=t=>{let o=Math.abs(t),e=o===0?0:o<=10?2:o<=100?1:0,r=orderlyUtils.numberToHumanStyle(o,e);return t<0?`-${r}`:r};var v=t=>{let{label:o,value:e,prefix:r,unit:a="USDC",coloring:i=false,dp:n,rm:l}=t;return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",className:t.titleClassName,children:[r,jsxRuntime.jsx(orderlyUi.Text.numeral,{unit:a,as:"div",size:"sm",coloring:i,showIdentifier:i,unitClassName:"oui-text-base-contrast-54 oui-ml-1",weight:"semibold",rm:l,dp:n,children:e})]}),jsxRuntime.jsx(orderlyUi.Text,{size:"2xs",intensity:54,weight:"semibold",children:o})]})};var j=()=>{let t=document.documentElement,o=getComputedStyle(t);return {primary:T(o.getPropertyValue("--oui-color-primary")),primaryLight:T(o.getPropertyValue("--oui-color-primary-light")),secondary:T(o.getPropertyValue("--oui-color-secondary")),success:T(o.getPropertyValue("--oui-color-success")),warning:T(o.getPropertyValue("--oui-color-warning")),danger:T(o.getPropertyValue("--oui-color-danger")),info:T(o.getPropertyValue("--oui-color-info")),loss:T(o.getPropertyValue("--oui-color-trading-loss")),profit:T(o.getPropertyValue("--oui-color-trading-profit"))}},T=t=>`rgb(${t.split(" ").join(",")})`;var u=t=>react.useMemo(()=>{let e=j();return {profit:t?.profit||e.profit,loss:t?.loss||e.loss,primary:e.primary,primaryLight:e.primaryLight}},[t]);var Xt=t=>{let{fill:o,x:e,y:r,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?r:r+i,width:a,height:n,stroke:"none",fill:o})},Wt=t=>{let{x:o,y:e,stroke:r,payload:a,index:i,width:n,containerWidth:l}=t,{t:s}=orderlyI18n.useTranslation(),h=i===0?48:l>0?l-10:n+a.offset;return jsxRuntime.jsx("g",{transform:`translate(${h},${e-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:i===0?"start":"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:i===0?a.value:s("chart.now")})})},Ut=t=>{let{width:o,height:e,stroke:r,fill:a}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Yt=t=>{let{active:o,payload:e,label:r}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(v,{label:r===a.current?i("chart.now"):r,value:e[0].value,coloring:true}):null},Ht=t=>{let{invisible:o,data:e,responsiveContainerProps:r}=t,a=u(t.colors),i=react.useRef(0);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:orderlyUi.cn(o&&"chart-invisible"),onResize:n=>{i.current=n;},...r,children:jsxRuntime.jsxs(recharts.BarChart,{data:e,margin:{left:-10,top:10,right:10,bottom:30},children:[!o&&jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Ut,{}),content:jsxRuntime.jsx(Yt,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),!o&&jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(Xt,{}),children:e.map((n,l)=>jsxRuntime.jsx(recharts.Cell,{fill:n.pnl>0?a.profit:a.loss},`cell-${l}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickFormatter:n=>P(n),tickLine:false,axisLine:false,dataKey:"pnl"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:e.length-2,height:1,tick:jsxRuntime.jsx(Wt,{containerWidth:i.current}),stroke:"#FFFFFF",strokeOpacity:.04})]})})};var D=t=>{let{x:o,y:e,stroke:r,payload:a,index:i}=t,{t:n}=orderlyI18n.useTranslation();return jsxRuntime.jsx("g",{transform:`translate(${o},${e-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:i===0?a.value:n("chart.now")})})};var le=t=>{let{active:o,payload:e,label:r}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(v,{label:r===a.current?i("chart.now"):r,value:e[0].value,coloring:true}):null},ce=t=>{let o=[];return t?.reduce((e,r)=>(e+=r.pnl,o.push({...r,pnl:e,_pnl:r.pnl}),e),0),o},me=t=>{let{responsiveContainerProps:o}=t,e=u(t.colors),{isMobile:r}=orderlyUi.useScreen(),a=react.useMemo(()=>ce(t.data),[t.data]),i=jsxRuntime.jsxs(recharts.LineChart,{data:a,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(D,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:P}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(le,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:r?1.5:2,dot:false,isAnimationActive:false})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...o,children:i})};var Pe=t=>{let{active:o,payload:e,label:r}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(v,{label:r===a.current?i("chart.now"):r,value:e[0].value,coloring:true}):null},Re=t=>{let o=[];return t?.reduce((e,r)=>(e+=r.pnl,o.push({...r,pnl:e,_pnl:r.pnl}),e),0),o},Ae=t=>{let{responsiveContainerProps:o}=t,e=u(t.colors),{isMobile:r}=orderlyUi.useScreen(),a=react.useId(),i=react.useMemo(()=>Re(t.data),[t.data]),n=jsxRuntime.jsxs(recharts.AreaChart,{data:i,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(D,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:P}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Pe,{})}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#608CFF",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#608CFF",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:r?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${a})`})]})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...o,children:n})};var w=({title:t="No Data Available",description:o="No data to display for the selected period",height:e="300px",className:r})=>jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-flex oui-items-center oui-justify-center oui-bg-base-8",r),style:{height:e},children:jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",itemAlign:"center",gap:3,className:"oui-text-center",children:[jsxRuntime.jsx(orderlyUi.BarChartIcon,{}),jsxRuntime.jsx(orderlyUi.Text,{as:"div",size:"sm",weight:"semibold",className:"oui-text-base-contrast-100",children:t}),jsxRuntime.jsx(orderlyUi.Text,{as:"div",size:"xs",className:"oui-text-base-contrast-54",children:o})]})});var Ue=t=>{let{fill:o,x:e,y:r,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?r:r+i,width:a,height:n,stroke:"none",fill:o})},Ye=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},He=t=>{try{return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return t}},at=t=>`${t>=0?"+":""}${t.toFixed(2)}`,it=(t,o)=>t===0?"inherit":t>0?o.profit:o.loss,qe=t=>{let{active:o,payload:e,label:r}=t,a=u();if(o&&e&&e.length>=1){let n=e.find(p=>p.dataKey==="pnl")?.value??0,s=e.find(p=>p.dataKey==="cumulativePnL")?.value??0,h=He(r),R=it(n,a);it(s,a);return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsxs("div",{className:"oui-text-xs oui-font-semibold",children:[h,":"," ",jsxRuntime.jsxs("span",{style:{color:R},children:[at(n)," USDC"]})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Cumulative:"}),jsxRuntime.jsxs("span",{className:"oui-font-semibold",children:[at(s)," USDC"]})]})]})}return null},Qe=(t,o,e=false)=>{if(t<=12&&!e)return 0;let r;t>500||t>200?r=6:t>100?r=7:t>50?r=8:r=12,e&&(r=Math.ceil(r/2));let a=Math.ceil(t/r);if(o==="15m")return a>=96?Math.ceil(a/56)*56:a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/16)*16:Math.max(8,Math.ceil(a/4)*4);if(o==="1h")return a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/12)*12:Math.max(4,Math.ceil(a/4)*4);if(o==="1d"){if(a>=14)return Math.ceil(a/14)*14;if(a>=3)return Math.ceil(a/7)*7}return a},Je=t=>{let o=0;return t.map(e=>(o+=e.pnl,{...e,cumulativePnL:o}))},Ze=t=>{let{data:o,aggregationWindow:e="1d",isMobile:r=false,invisible:a,responsiveContainerProps:i,className:n}=t,l=u(t.colors),s=react.useMemo(()=>Je(o),[o]),h=react.useMemo(()=>Qe(s.length,e,r),[s.length,e,r]),R=react.useMemo(()=>{if(s.length===0)return [0,1];let m=s.map(N=>N.pnl),p=s.map(N=>N.cumulativePnL),A=Math.min(...m,...p,0),M=Math.max(...m,...p,0),g=Math.max(Math.abs(A),Math.abs(M)),V=g===0?1:g*1.15;return [-V,V]},[s]);return a||s.length===0?jsxRuntime.jsx(w,{title:"No P&L Data",description:"No profit and loss data available for the selected period",height:"300px",className:n}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:0,top:10,right:10,bottom:20},children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"cumulativeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:"#608CFF",stopOpacity:.4}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:"#608CFF",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Ye,{}),content:jsxRuntime.jsx(qe,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(255,255,255,0.3)",strokeWidth:2,strokeDasharray:"4 4"}),jsxRuntime.jsx(recharts.YAxis,{domain:R,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:m=>je(m),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:h,minTickGap:50,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(Ue,{}),minPointSize:1,isAnimationActive:false,children:s.map((m,p)=>jsxRuntime.jsx(recharts.Cell,{fill:m.pnl===0?"rgba(255,255,255,0.2)":m.pnl>0?l.profit:l.loss},`cell-${p}`))}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"cumulativePnL",fill:"url(#cumulativeGradient)",stroke:"none",isAnimationActive:false}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"cumulativePnL",stroke:l.primary,strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};function je(t){let o=["","K","M","B","T"],e=0,r=Math.abs(t);for(;r>=1e3&&e<o.length-1;)r/=1e3,e++;let a=t<0?"-":"",i=r<=10?1:0,n=r.toFixed(i);return `${a}${n}${o[e]}`}var po=t=>{let{fill:o,x:e,y:r,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?r:r+i,width:a,height:n,stroke:"none",fill:o})},uo=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},fo=t=>{try{return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return t}},st=t=>`${t>=0?"+":""}${t}`,ho=t=>{let{active:o,payload:e,label:r}=t;if(o&&e&&e.length>=1){let i=e.find(h=>h.dataKey==="volume")?.value??0,l=e.find(h=>h.dataKey==="cumulativeVolume")?.value??0,s=fo(r);return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsxs("div",{className:"oui-text-xs oui-font-semibold",children:[s,": ",st(i)," USDC"]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Cumulative:"}),jsxRuntime.jsxs("span",{className:"oui-font-semibold",children:[st(l)," USDC"]})]})]})}return null},yo=(t,o,e=false)=>{if(t<=12&&!e)return 0;let r;t>500||t>200?r=6:t>100?r=7:t>50?r=8:r=12,e&&(r=Math.ceil(r/2));let a=Math.ceil(t/r);if(o==="15m")return a>=96?Math.ceil(a/56)*56:a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/16)*16:Math.max(8,Math.ceil(a/4)*4);if(o==="1h")return a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/12)*12:Math.max(4,Math.ceil(a/4)*4);if(o==="1d"){if(a>=14)return Math.ceil(a/14)*14;if(a>=3)return Math.ceil(a/7)*7}return a},Co=t=>{let o=0;return t.map(e=>(o+=e.volume,{...e,cumulativeVolume:o}))},bo=t=>{let{data:o,aggregationWindow:e="1d",isMobile:r=false,invisible:a,responsiveContainerProps:i,className:n}=t,l=u(t.colors?{profit:t.colors.fill,loss:t.colors.fill}:void 0),s=react.useMemo(()=>Co(o),[o]),h=react.useMemo(()=>yo(s.length,e,r),[s.length,e,r]),R=react.useMemo(()=>{if(s.length===0)return [0,1];let m=s.map(g=>g.volume),p=Math.max(...m,0),A=p,M=A===0?1:A*.1;return [0,Math.ceil((p+M)*100)/100]},[s]);return a||s.length===0?jsxRuntime.jsx(w,{title:"No Volume Data",description:"No trading volume data available for the selected period",height:"300px",className:n}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:0,top:10,right:10,bottom:20},children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(uo,{}),content:jsxRuntime.jsx(ho,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:R,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:m=>xo(m),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:h,minTickGap:50,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(po,{}),minPointSize:1,isAnimationActive:false,children:s.map((m,p)=>jsxRuntime.jsx(recharts.Cell,{fill:l.profit,opacity:.8},`cell-${p}`))})]})})})};function xo(t){let o=["","K","M","B","T"],e=0,r=Math.abs(t);for(;r>=1e3&&e<o.length-1;)r/=1e3,e++;let a=t<0?"-":"",i=r<=10?1:0,n=r.toFixed(i);return `${a}${n}${o[e]}`}var Oo=t=>{let{fill:o,x:e,y:r,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?r:r+i,width:a,height:n,stroke:"none",fill:o})},So=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Io=t=>{try{return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return t}},ct=t=>`${t>=0?"+":""}${t.toFixed(2)}`,Vo=t=>{let{active:o,payload:e,label:r}=t;if(o&&e&&e.length>=1){let i=e.find(h=>h.dataKey==="fees")?.value??0,l=e.find(h=>h.dataKey==="cumulativeFees")?.value??0,s=Io(r);return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsxs("div",{className:"oui-text-xs oui-font-semibold",children:[s,": ",ct(i)," USDC"]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Cumulative:"}),jsxRuntime.jsxs("span",{className:"oui-font-semibold",children:[ct(l)," USDC"]})]})]})}return null},Bo=(t,o,e=false)=>{if(t<=12&&!e)return 0;let r;t>500||t>200?r=6:t>100?r=7:t>50?r=8:r=12,e&&(r=Math.ceil(r/2));let a=Math.ceil(t/r);if(o==="15m")return a>=96?Math.ceil(a/56)*56:a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/16)*16:Math.max(8,Math.ceil(a/4)*4);if(o==="1h")return a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/12)*12:Math.max(4,Math.ceil(a/4)*4);if(o==="1d"){if(a>=14)return Math.ceil(a/14)*14;if(a>=3)return Math.ceil(a/7)*7}return a},Ko=t=>{let o=0;return t.map(e=>(o+=e.fees,{...e,cumulativeFees:o}))},zo=t=>{let{data:o,aggregationWindow:e="1d",isMobile:r=false,invisible:a,responsiveContainerProps:i,className:n}=t,l=u(t.colors?{profit:t.colors.fill,loss:t.colors.fill}:void 0),s=react.useMemo(()=>Ko(o),[o]),h=react.useMemo(()=>Bo(s.length,e,r),[s.length,e,r]),R=react.useMemo(()=>{if(s.length===0)return [0,1];let m=s.map(N=>N.fees),p=s.map(N=>N.cumulativeFees),A=Math.min(...m,...p,0),M=Math.max(...m,...p,0),g=M-A,V=g===0?1:g*.1;return [Math.floor((A-V)*100)/100,Math.ceil((M+V)*100)/100]},[s]);return a||s.length===0?jsxRuntime.jsx(w,{title:"No Fees Data",description:"No fees data available for the selected period",height:"300px",className:n}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:0,top:10,right:10,bottom:20},children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"feesGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:"#00B49E",stopOpacity:.4}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:"#00B49E",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(So,{}),content:jsxRuntime.jsx(Vo,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:R,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:m=>$o(m),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:h,minTickGap:50,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"fees",shape:jsxRuntime.jsx(Oo,{}),minPointSize:1,isAnimationActive:false,children:s.map((m,p)=>jsxRuntime.jsx(recharts.Cell,{fill:l.profit,opacity:.8},`cell-${p}`))}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"cumulativeFees",fill:"url(#feesGradient)",stroke:"none",isAnimationActive:false}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"cumulativeFees",stroke:l.primary,strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};function $o(t){let o=["","K","M","B","T"],e=0,r=Math.abs(t);for(;r>=1e3&&e<o.length-1;)r/=1e3,e++;let a=t<0?"-":"",i=r<=10?1:0,n=r.toFixed(i);return `${a}${n}${o[e]}`}var Zo=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},jo=t=>{let{active:o,payload:e}=t;if(o&&e&&e.length>=1){let r=e[0].payload;return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Open:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.open.toFixed(2)})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"High:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.high.toFixed(2)})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Low:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.low.toFixed(2)})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Close:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.close.toFixed(2)})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2 oui-mt-1 oui-pt-2 oui-border-t oui-border-base-contrast-16",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Time:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.date})]})]})}return null},tr=(t,o,e=false)=>{if(t<=12&&!e)return 0;let r;t>500||t>200?r=6:t>100?r=7:t>50?r=8:r=12,e&&(r=Math.ceil(r/2));let a=Math.ceil(t/r);if(o==="15m")return a>=96?Math.ceil(a/56)*56:a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/16)*16:Math.max(8,Math.ceil(a/4)*4);if(o==="1h")return a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/12)*12:Math.max(4,Math.ceil(a/4)*4);if(o==="1d"){if(a>=14)return Math.ceil(a/14)*14;if(a>=3)return Math.ceil(a/7)*7}return a};function er(t){return t.toFixed(2)}var or=t=>{let {data:o,aggregationWindow:e="1d",isMobile:r=false,invisible:a,responsiveContainerProps:i,className:n}=t;u();let s=react.useMemo(()=>tr(o.length,e,r),[o.length,e,r]),h=react.useMemo(()=>{if(o.length===0)return [0,1];let R=o.flatMap(g=>[g.open,g.high,g.low,g.close]),m=Math.min(...R),p=Math.max(...R),A=p-m,M=A===0?1:A*.15;return [m-M,p+M]},[o]);return a||o.length===0?jsxRuntime.jsx(w,{title:"No Price Data",description:"No price data available for the selected period",height:"300px",className:n}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:o,margin:{left:20,top:10,right:10,bottom:20},children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Zo,{}),content:jsxRuntime.jsx(jo,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:h,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:er,width:50}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:s,minTickGap:50,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"high",isAnimationActive:false,fill:"rgba(0, 180, 158, 0.1)",stroke:"none"}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"close",stroke:"#00B49E",strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};var fr=t=>{let{active:o,payload:e,label:r}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(v,{label:r===a.current?i("chart.now"):r,value:e[0].value}):null},dr=t=>{let{responsiveContainerProps:o}=t,e=u(t.colors),r=react.useId(),{isMobile:a}=orderlyUi.useScreen(),i=a?jsxRuntime.jsxs(recharts.AreaChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(D,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:n=>P(n)}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${r})`})]})]}):jsxRuntime.jsxs(recharts.LineChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(D,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:P}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(fr,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...o,children:i})};var Mr=t=>{let{active:o,payload:e,label:r}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(v,{label:r===a.current?i("chart.now"):r,value:e[0].value}):null},Tr=t=>{let{responsiveContainerProps:o}=t,e=u(t.colors),r=react.useId(),{isMobile:a}=orderlyUi.useScreen(),i=jsxRuntime.jsxs(recharts.AreaChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(D,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:P}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Mr,{})}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${r})`})]})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...o,children:i})};var Gr=t=>{let{fill:o,x:e,y:r,width:a,height:i,opacity:n}=t,l=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?r:r+i,width:a,height:l,stroke:"none",fill:o,opacity:n})},Er=t=>{let{width:o,height:e,payload:r,stroke:a,fill:i}=t;return r?.[0]?.value===0?null:jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Xr=t=>{let{active:o,payload:e,label:r,tooltip:a}=t;return e?.[0]?.value===0?null:o&&e&&e.length?jsxRuntime.jsx(v,{label:r,value:e[0].value,titleClassName:"oui-gap-4",rm:a?.rm,dp:a?.dp}):null},Wr=t=>{let o=u(t.colors?.fill?{profit:t.colors?.fill,loss:t.colors?.fill}:void 0),e=t.data?.reduce((i,n)=>i+n.volume,0)===0,r=t.data?.reduce((i,n)=>i>n.volume?i:n.volume,0),a=r<=10?2:r<=100?1:0;return jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn(t.className),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{children:jsxRuntime.jsxs(recharts.BarChart,{data:t.data,margin:{left:-0,top:6,right:0,bottom:20},children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Er,{}),content:jsxRuntime.jsx(Xr,{tooltip:t.tooltip})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.08,repeatCount:6}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"#000"}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(Gr,{}),minPointSize:1,children:t.data.map((i,n)=>jsxRuntime.jsx(recharts.Cell,{fill:i.volume>0?o.profit:o.loss,opacity:i.opacity},`cell-${n}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,dataKey:"volume",tickFormatter:(i,n)=>e?`${n*100}`:Ur(i,a),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"rgb(229, 231, 235)",strokeOpacity:.2})]})})})};function Ur(t,o=0){let e=["","K","M","B","T"],r=0;for(;t>=1e3&&r<e.length-1;)t/=1e3,r++;return `${Yr(t,o)}${e[r]}`}function Yr(t,o){let e=t.toString(),r=e.indexOf(".");if(r===-1||o===0)return e.split(".")[0];let a=r+o+1;return e.slice(0,a)}var vt=Tt(gt()),jr=()=>(0, vt.default)(function({addComponents:t,addBase:o}){t({".xAxis":{".recharts-cartesian-axis-tick:first-child text":{"text-anchor":"start"},".recharts-cartesian-axis-tick:last-child text":{"text-anchor":"end"}}},{respectPrefix:false});});Object.defineProperty(exports,"Area",{enumerable:true,get:function(){return recharts.Area}});Object.defineProperty(exports,"AreaChart",{enumerable:true,get:function(){return recharts.AreaChart}});Object.defineProperty(exports,"Bar",{enumerable:true,get:function(){return recharts.Bar}});Object.defineProperty(exports,"BarChart",{enumerable:true,get:function(){return recharts.BarChart}});Object.defineProperty(exports,"Cell",{enumerable:true,get:function(){return recharts.Cell}});Object.defineProperty(exports,"Line",{enumerable:true,get:function(){return recharts.Line}});Object.defineProperty(exports,"LineChart",{enumerable:true,get:function(){return recharts.LineChart}});exports.AssetAreaChart=Tr;exports.AssetLineChart=dr;exports.ChartEmptyState=w;exports.CombinedFeesChart=zo;exports.CombinedPnLChart=Ze;exports.CombinedPriceChart=or;exports.CombinedVolumeChart=bo;exports.PnLBarChart=Ht;exports.PnlAreaChart=Ae;exports.PnlLineChart=me;exports.VolBarChart=Wr;exports.chartPlugin=jr;//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|