candleview 1.0.6 → 1.0.8
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/README.md +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/{candleview.js → index.js} +1 -1
- package/dist/{candleview.mjs → index.mjs} +2 -10
- package/package.json +14 -6
|
@@ -147,7 +147,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
147
147
|
.subchart-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
148
148
|
background: ${r?.layout?.textColor||"#000000"}80;
|
|
149
149
|
}
|
|
150
|
-
`,J={position:"fixed",left:`${l.x}px`,top:`${l.y}px`,background:r?.toolbar?.background||"#fafafa",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"8px",padding:"0",width:"450px",maxWidth:"90vw",height:"500px",maxHeight:"80vh",zIndex:1e4,boxShadow:"0 8px 24px rgba(0,0,0,0.3)",cursor:u?"grabbing":"default",userSelect:u?"none":"auto",display:"flex",flexDirection:"column"},it={padding:"16px 16px 12px 16px",borderBottom:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,cursor:"grab",userSelect:"none",flexShrink:0},at={fontSize:"14px",fontWeight:"bold",color:r?.layout?.textColor||"#000000",margin:0},y={padding:"16px",flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},V={marginBottom:"16px",flex:1,overflowY:"auto",overflowX:"hidden",...G},Q={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px",padding:"8px",background:r?.toolbar?.background||"#fafafa",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px"},rt={fontSize:"12px",color:r?.layout?.textColor||"#000000",minWidth:"80px",fontWeight:"bold"},K={width:"80px",padding:"4px 8px",background:r?.toolbar?.background||"#fafafa",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",fontSize:"12px"},nt={width:"60px",padding:"4px 8px",background:r?.toolbar?.background||"#fafafa",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",fontSize:"12px"},et={display:"flex",alignItems:"center",gap:"4px",position:"relative"},ot={width:"24px",height:"24px",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",cursor:"pointer"},ut={position:"absolute",top:0,left:0,width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",opacity:0},gt={background:"transparent",border:"none",fontSize:"16px",cursor:"pointer",padding:"0",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",color:r?.chart?.downColor||"#ff4d4f"},mt={...gt,color:`${r?.toolbar?.border||"#d9d9d9"}`,cursor:"not-allowed"},vt={width:"100%",background:"transparent",color:r?.chart?.lineColor||"#2962FF",border:`2px dashed ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",padding:"8px 16px",fontSize:"12px",cursor:"pointer",marginBottom:"16px",flexShrink:0},xt={...vt,color:`${r?.toolbar?.border||"#d9d9d9"}`,cursor:"not-allowed",borderColor:`${r?.toolbar?.border||"#d9d9d9"}`},Kt={display:"flex",justifyContent:"flex-end",gap:"8px",flexShrink:0},Zt={background:"transparent",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},Jt={background:r?.toolbar?.button?.active||"#2962FF",color:r?.toolbar?.button?.activeTextColor||"#ffffff",border:"none",borderRadius:"4px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},Qt={fontSize:"10px",color:`${r?.layout?.textColor||"#000000"}80`,marginTop:"8px",textAlign:"center",flexShrink:0},te={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,background:"transparent"};if(!M||!o)return null;const I=Z(s);return Gt.createPortal(m.jsxs(O.Fragment,{children:[m.jsx("style",{children:L}),m.jsx("div",{style:te,onClick:tt,children:m.jsxs("div",{ref:f,style:J,onClick:B=>B.stopPropagation(),onMouseDown:X,onKeyDown:$,children:[m.jsx("div",{ref:k,style:it,onMouseDown:B=>{B.target===k.current&&B.preventDefault()},children:m.jsxs("div",{style:at,children:[P()," ",a.systemSettings?.setting||"设置"]})}),m.jsxs("div",{style:y,children:[m.jsx("div",{style:V,className:"subchart-scrollbar",children:o.map((B,N)=>m.jsxs("div",{style:Q,children:[m.jsx("div",{style:rt,children:B.paramName}),m.jsx("input",{type:"text",style:K,value:B.paramName,onChange:Y=>b(N,Y.target.value),onClick:Y=>Y.stopPropagation(),placeholder:a.modal?.parameterName||"参数名"}),m.jsx("input",{type:"number",style:K,value:B.paramValue,onChange:Y=>v(N,Number(Y.target.value)),onClick:Y=>Y.stopPropagation(),min:"1",max:"100",placeholder:a.modal?.parameterValue||"数值"}),m.jsxs("select",{style:nt,value:B.lineWidth,onChange:Y=>F(N,Number(Y.target.value)),onClick:Y=>Y.stopPropagation(),children:[m.jsx("option",{value:1,children:"1px"}),m.jsx("option",{value:2,children:"2px"}),m.jsx("option",{value:3,children:"3px"}),m.jsx("option",{value:4,children:"4px"}),m.jsx("option",{value:5,children:"5px"})]}),m.jsxs("div",{style:et,children:[m.jsx("div",{style:{...ot,backgroundColor:B.lineColor},onClick:Y=>{Y.currentTarget.nextSibling?.click()}}),m.jsx("input",{type:"color",style:ut,value:B.lineColor,onChange:Y=>D(N,Y.target.value),onClick:Y=>Y.stopPropagation()})]}),I.allowDelete&&m.jsx("button",{onClick:()=>S(N),style:o.length<=I.minParams?mt:gt,disabled:o.length<=I.minParams,type:"button",title:o.length<=I.minParams?`${a.modal?.keepAtLeastOne||"至少保留"}${I.minParams}${a.modal?.parameterName||"个参数"}`:a.modal?.deleteParameter||"删除",children:"×"})]},`${B.paramName}-${N}`))}),m.jsx("button",{onClick:_,style:o.length>=I.maxParams||!I.allowAdd?xt:vt,disabled:o.length>=I.maxParams||!I.allowAdd,type:"button",title:o.length>=I.maxParams?`${a.modal?.maximumParameters||"最多允许"}${I.maxParams}${a.modal?.parameterName||"个参数"}`:I.allowAdd?a.modal?.addParameter||"添加参数":a.modal?.keepAtLeastOne||"不允许添加参数",children:o.length>=I.maxParams?`${a.modal?.maximumParameters||"已达到最大参数数量"}(${I.maxParams}${a.modal?.parameterName||"个"})`:I.allowAdd?`+ ${a.modal?.addParameter||"添加参数"}`:a.modal?.keepAtLeastOne||"不允许添加参数"}),m.jsxs("div",{style:Kt,children:[m.jsx("button",{onClick:j,style:Zt,type:"button",children:a.systemSettings?.cancel||"取消"}),m.jsx("button",{onClick:H,style:Jt,type:"button",children:a.systemSettings?.confirm||"确定"})]}),m.jsxs("div",{style:Qt,children:[a.tooltips?.ctrlEnterToConfirm||"Ctrl+Enter: 确认",", ",a.tooltips?.escToCancel||"Esc: 取消",", ",a.modal?.dragToMove||"拖动标题栏移动"]})]})]})})]}),document.body)};class so{constructor(t){this.volumeSeries=null,this.refreshData=i=>{if(!this.volumeSeries)return;const r=i.props.chartData.map(n=>n.isVirtual?{time:n.time,value:n.volume,color:"rgba(0, 0, 0, 0)"}:{time:n.time,value:n.volume,color:n.close>=n.open?"rgba(38, 166, 154, 0.8)":"rgba(239, 83, 80, 0.8)"});r.length>0&&this.volumeSeries&&setTimeout(()=>{this.volumeSeries.setData(r)},0)},this.volumeSeries=t.props.chart.addSeries(q.HistogramSeries,{priceScaleId:"volume_bottom",color:"#26a69a"}),t.props.chart.priceScale("volume_bottom").applyOptions({scaleMargins:{top:.9,bottom:0}});const e=t.props.chartData.map(i=>i.isVirtual?{time:i.time,value:i.volume,color:"rgba(0, 0, 0, 0)"}:{time:i.time,value:i.volume,color:i.close>=i.open?"rgba(38, 166, 154, 0.8)":"rgba(239, 83, 80, 0.8)"});e.length>0&&this.volumeSeries&&setTimeout(()=>{this.volumeSeries.setData(e)},0)}}class ui{constructor(t,e){this.candleSeries=null,this.refreshData=r=>{if(!this.candleSeries)return;const n=this.transformToCandlestickData(r.props.chartData);n.length>0&&setTimeout(()=>{this.candleSeries.setData(n)},0)},this.updateStyle=r=>{this.candleSeries&&this.candleSeries.applyOptions(r)},this.destroy=r=>{this.candleSeries&&r.props.chart&&(r.props.chart.removeSeries(this.candleSeries),this.candleSeries=null)},this.candleSeries=t.props.chart.addSeries(q.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToCandlestickData(t.props.chartData);i.length>0&&this.candleSeries&&setTimeout(()=>{this.candleSeries.setData(i)},0)}transformToCandlestickData(t){return t.map(e=>e.isVirtual?{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close,color:"rgba(0, 0, 0, 0)"}:{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close})}getSeries(){return this.candleSeries}}class ao{constructor(t,e){this.barSeries=null,this.theme=null,this.refreshData=r=>{if(!this.barSeries)return;const n=this.transformToBarData(r.props.chartData);n.length>0&&setTimeout(()=>{this.barSeries.setData(n)},0)},this.updateStyle=r=>{this.barSeries&&this.barSeries.applyOptions(r)},this.destroy=r=>{this.barSeries&&r.props.chart&&(r.props.chart.removeSeries(this.barSeries),this.barSeries=null)},this.barSeries=t.props.chart.addSeries(q.BarSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",thinBars:!0,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBarData(t.props.chartData);i.length>0&&this.barSeries&&setTimeout(()=>{this.barSeries.setData(i)},0)}transformToBarData(t){return t.map(e=>{const i={time:e.time,open:Number(e.open),high:Number(e.high),low:Number(e.low),close:Number(e.close)};return e.isVirtual?{...i,color:"transparent",borderColor:"transparent"}:i})}getSeries(){return this.barSeries}}class no{constructor(t,e){this.lineSeries=null,this._lineWidht=2,this.refreshData=r=>{if(!this.lineSeries)return;const n=this.transformToLineData(r.props.chartData);n.length>0&&setTimeout(()=>{this.lineSeries.setData(n)},0)},this.updateStyle=r=>{this.lineSeries&&this.lineSeries.applyOptions(r)},this.destroy=r=>{this.lineSeries&&r.props.chart&&(r.props.chart.removeSeries(this.lineSeries),this.lineSeries=null)},this.lineSeries=t.props.chart.addSeries(q.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:this._lineWidht,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToLineData(t.props.chartData);i.length>0&&this.lineSeries&&setTimeout(()=>{this.lineSeries.setData(i)},0)}transformToLineData(t){return t.map(e=>({time:e.time,value:e.close}))}getSeries(){return this.lineSeries}}class oo{constructor(t,e){this.areaSeries=null,this.theme=null,this.refreshData=r=>{if(!this.areaSeries)return;const n=this.transformToAreaData(r.props.chartData);n.length>0&&setTimeout(()=>{this.areaSeries.setData(n)},0)},this.updateStyle=r=>{this.areaSeries&&this.areaSeries.applyOptions(r)},this.destroy=r=>{this.areaSeries&&r.props.chart&&(r.props.chart.removeSeries(this.areaSeries),this.areaSeries=null)},this.areaSeries=t.props.chart.addSeries(q.AreaSeries,{topColor:e.chart.areaTopColor||"rgba(33, 150, 243, 0.4)",bottomColor:e.chart.areaBottomColor||"rgba(33, 150, 243, 0)",lineColor:e.chart.areaLineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToAreaData(t.props.chartData);i.length>0&&this.areaSeries&&setTimeout(()=>{this.areaSeries.setData(i)},0)}transformToAreaData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent",lineColor:"transparent",topColor:"transparent",bottomColor:"transparent"}:i})}getSeries(){return this.areaSeries}}class lo{constructor(t,e){this.stepLineSeries=null,this.refreshData=r=>{if(!this.stepLineSeries)return;const n=this.transformToStepLineData(r.props.chartData);n.length>0&&setTimeout(()=>{this.stepLineSeries.setData(n)},0)},this.updateStyle=r=>{if(this.stepLineSeries){const n={...r,lineType:1};this.stepLineSeries.applyOptions(n)}},this.destroy=r=>{this.stepLineSeries&&r.props.chart&&(r.props.chart.removeSeries(this.stepLineSeries),this.stepLineSeries=null)},this.stepLineSeries=t.props.chart.addSeries(q.LineSeries,{color:e.chart.stepLineColor||"#9C27B0",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.stepLineSeries.applyOptions({lineType:1}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToStepLineData(t.props.chartData);i.length>0&&this.stepLineSeries&&setTimeout(()=>{this.stepLineSeries.setData(i)},0)}transformToStepLineData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent"}:i})}getSeries(){return this.stepLineSeries}}class ho{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.filter(o=>!o.isVirtual),s=n.length>0?n.reduce((o,h)=>o+h.close,0)/n.length:0;this.series.applyOptions({baseValue:{type:"price",price:s}});const a=r.props.chartData.map(o=>o.isVirtual?{time:o.time,value:o.close,topLineColor:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)"}:{time:o.time,value:o.close});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.BaselineSeries,{baseValue:{type:"price",price:0},topLineColor:e.chart.candleUpColor||"#26a69a",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:e.chart.candleDownColor||"#ef5350",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToBaselineData(t){const e=t.filter(r=>!r.isVirtual),i=e.length>0?e.reduce((r,n)=>r+n.close,0)/e.length:0;return this.series&&this.series.applyOptions({baseValue:{type:"price",price:i}}),t.map(r=>({time:r.time,value:r.close,...r.isVirtual&&{topLineColor:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class co{constructor(t,e){this.histogramSeries=null,this.theme=null,this.refreshData=r=>{if(!this.histogramSeries)return;const n=this.transformToHistogramData(r.props.chartData);n.length>0&&setTimeout(()=>{this.histogramSeries.setData(n)},0)},this.updateStyle=r=>{this.histogramSeries&&this.histogramSeries.applyOptions(r)},this.destroy=r=>{this.histogramSeries&&r.props.chart&&(r.props.chart.removeSeries(this.histogramSeries),this.histogramSeries=null)},this.histogramSeries=t.props.chart.addSeries(q.HistogramSeries,{color:e.chart.histogramColor||"#4CAF50",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHistogramData(t.props.chartData);i.length>0&&this.histogramSeries&&setTimeout(()=>{this.histogramSeries.setData(i)},0)}transformToHistogramData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent"}:{...i,color:e.close>=(e.open||0)?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor}})}getSeries(){return this.histogramSeries}}class uo{constructor(t,e){this.candleSeries=null,this.theme=null,this.refreshData=r=>{if(!this.candleSeries)return;const n=this.transformToHollowCandlestickData(r.props.chartData);n.length>0&&setTimeout(()=>{this.candleSeries.setData(n)},0)},this.updateStyle=r=>{this.candleSeries&&this.candleSeries.applyOptions(r)},this.destroy=r=>{this.candleSeries&&r.props.chart&&(r.props.chart.removeSeries(this.candleSeries),this.candleSeries=null)},this.candleSeries=t.props.chart.addSeries(q.CandlestickSeries,{upColor:"transparent",downColor:"transparent",borderUpColor:e.chart.candleUpColor||"#26a69a",borderDownColor:e.chart.candleDownColor||"#ef5350",wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHollowCandlestickData(t.props.chartData);i.length>0&&this.candleSeries&&setTimeout(()=>{this.candleSeries.setData(i)},0)}transformToHollowCandlestickData(t){return t.map(e=>{const i=e.close>e.open,r={time:e.time,open:e.open,high:e.high,low:e.low,close:e.close};return e.isVirtual?{...r,color:"transparent",borderColor:"transparent",wickColor:"transparent"}:{...r,borderColor:i?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor,wickColor:i?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor}})}getSeries(){return this.candleSeries}}class go{constructor(t,e){this.candleSeries=null,this.refreshData=r=>{if(!this.candleSeries)return;const n=this.transformToHeikinAshiData(r.props.chartData);n.length>0&&setTimeout(()=>{this.candleSeries.setData(n)},0)},this.updateStyle=r=>{this.candleSeries&&this.candleSeries.applyOptions(r)},this.destroy=r=>{this.candleSeries&&r.props.chart&&(r.props.chart.removeSeries(this.candleSeries),this.candleSeries=null)},this.candleSeries=t.props.chart.addSeries(q.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHeikinAshiData(t.props.chartData);i.length>0&&this.candleSeries&&setTimeout(()=>{this.candleSeries.setData(i)},0)}transformToHeikinAshiData(t){if(t.length===0)return[];const e=[];let i=null;for(let r=0;r<t.length;r++){const n=t[r];if(n.isVirtual){e.push({time:n.time,open:n.open,high:n.high,low:n.low,close:n.close,color:"rgba(0, 0, 0, 0)"});continue}let s,a,o,h;i===null?(s=(n.open+n.close)/2,h=(n.open+n.high+n.low+n.close)/4,a=n.high,o=n.low):(s=(i.open+i.close)/2,h=(n.open+n.high+n.low+n.close)/4,a=Math.max(n.high,s,h),o=Math.min(n.low,s,h));const l={time:n.time,open:s,high:a,low:o,close:h};e.push(l),i={open:s,close:h}}return e}getSeries(){return this.candleSeries}}class po{constructor(t,e){this.series=null,this.lineCount=3,this.globalChartData=[],this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.map(s=>s.isVirtual?{time:s.time,value:s.close,color:"rgba(0, 0, 0, 0)"}:{time:s.time,value:s.close});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.globalChartData=t.props.chartData;const i=this.generateLineBreakData(this.globalChartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}generateLineBreakData(t){if(t.length===0)return[];const e=[];let i=[];for(let r=0;r<t.length;r++){const n=t[r].close;if(e.length===0){e.push({time:t[r].time,value:n}),i.push(n);continue}(n>Math.max(...i)||n<Math.min(...i))&&(e.push({time:t[r].time,value:n}),i.push(n),i.length>this.lineCount&&i.shift())}return e}getSeries(){return this.series}setLineCount(t){this.lineCount=t}}class fo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.map(s=>s.isVirtual?{time:s.time,value:s.close,lineColor:"rgba(0, 0, 0, 0)",topColor:"rgba(0, 0, 0, 0)",bottomColor:"rgba(0, 0, 0, 0)"}:{time:s.time,value:s.close});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.AreaSeries,{topColor:e.chart.areaTopColor||"rgba(33, 150, 243, 0.4)",bottomColor:e.chart.areaBottomColor||"rgba(33, 150, 243, 0)",lineColor:e.chart.areaLineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToMountainData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToMountainData(t){return t.map(e=>({time:e.time,value:e.close,...e.isVirtual&&{lineColor:"rgba(0, 0, 0, 0)",topColor:"rgba(0, 0, 0, 0)",bottomColor:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class Mo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.map(s=>{if(s.isVirtual)return{time:s.time,open:s.open,high:s.high,low:s.low,close:s.close,color:"rgba(0, 0, 0, 0)",wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"};{const a=s.close>=s.open,o=a?s.close:s.open,h=a?s.open:s.close;return{time:s.time,open:h,high:s.high,low:s.low,close:o,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderVisible:!1}}});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHighLowData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHighLowData(t){return t.map(e=>{if(e.isVirtual)return{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close,color:"rgba(0, 0, 0, 0)",wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"};{const i=e.close>=e.open,r=i?e.close:e.open,n=i?e.open:e.close;return{time:e.time,open:n,high:e.high,low:e.low,close:r,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderVisible:!1}}})}getSeries(){return this.series}}class mo{constructor(t,e){this.series=null,this._chart=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this.channelWidthPercent=.3,this._timeScale=null,this._lineWidth=2,this.refreshData=r=>{if(!this.series)return;this._chartData=r.props.chartData||[];const n=this.transformToBaselineData(r.props.chartData);n.length>0&&this.series.setData(n),this.requestUpdate()},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(this._isAttached&&r.props.chartSeries&&r.props.chartSeries.series)try{r.props.chartSeries.series.detachPrimitive(this),this._isAttached=!1}catch{}this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this._chartData=t.props.chartData||[],this._chart=t.props.chart,this._timeScale=this._chart.timeScale(),this.series=t.props.chart.addSeries(q.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:this._lineWidth,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.attachChannelRenderer(t),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i),this.requestUpdate()},0)}attachChannelRenderer(t){t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0)}transformToBaselineData(t){return t.filter(i=>!i.isVirtual).map(i=>({time:i.time,value:i.close}))}attached(t){this._chart=t.chart,this.requestUpdate()}updateAllViews(){this.requestUpdate()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&this.drawChannel(e)}}),[{renderer:()=>this._renderer}]}drawChannel(t){if(!this.series||!this._timeScale)return;const e=this._timeScale.getVisibleRange();if(!e)return;const i=this._chartData.filter(o=>!o.isVirtual&&o.time>=e.from&&o.time<=e.to);if(i.length<2)return;const r=i.map(o=>o.close),n=5,s=[];for(let o=0;o<r.length;o++){const h=Math.max(0,o-n+1),l=o+1,g=r.slice(h,l);s.push(g.reduce((u,c)=>u+c,0)/g.length)}const a=(Math.max(...s)-Math.min(...s))*this.channelWidthPercent;this.drawChannelLines(t,i,a)}drawChannelLines(t,e,i){t.save(),t.beginPath(),t.strokeStyle="#26a69a",t.lineWidth=this._lineWidth,t.setLineDash([]);let r=!0;for(const s of e){const a=this._timeScale.timeToCoordinate(s.time),o=s.close+i,h=this.series.priceToCoordinate(o);a===null||h===null||(r?(t.moveTo(a,h),r=!1):t.lineTo(a,h))}t.stroke(),t.restore(),t.save(),t.beginPath(),t.strokeStyle="rgba(255, 0, 0, 0.8)",t.lineWidth=this._lineWidth,t.setLineDash([]);let n=!0;for(const s of e){const a=this._timeScale.timeToCoordinate(s.time),o=s.close-i,h=this.series.priceToCoordinate(o);a===null||h===null||(n?(t.moveTo(a,h),n=!1):t.lineTo(a,h))}t.stroke(),t.restore(),this.drawChannelFill(t,e,i)}drawChannelFill(t,e,i){if(!(e.length<2)){t.save(),t.beginPath();for(let r=0;r<e.length;r++){const n=e[r],s=this._timeScale.timeToCoordinate(n.time),a=n.close+i,o=this.series.priceToCoordinate(a);s===null||o===null||(r===0?t.moveTo(s,o):t.lineTo(s,o))}for(let r=e.length-1;r>=0;r--){const n=e[r],s=this._timeScale.timeToCoordinate(n.time),a=this.series.priceToCoordinate(n.close);s===null||a===null||t.lineTo(s,a)}t.closePath(),t.fillStyle="rgba(38, 166, 154, 0.3)",t.fill(),t.restore(),t.save(),t.beginPath();for(let r=0;r<e.length;r++){const n=e[r],s=this._timeScale.timeToCoordinate(n.time),a=this.series.priceToCoordinate(n.close);s===null||a===null||(r===0?t.moveTo(s,a):t.lineTo(s,a))}for(let r=e.length-1;r>=0;r--){const n=e[r],s=this._timeScale.timeToCoordinate(n.time),a=n.close-i,o=this.series.priceToCoordinate(a);s===null||o===null||t.lineTo(s,o)}t.closePath(),t.fillStyle="rgba(239, 83, 80, 0.3)",t.fill(),t.restore()}}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate()}catch{}}getSeries(){return this.series}setChannelWidth(t){this.channelWidthPercent=Math.max(.01,Math.min(1,t)),this.requestUpdate()}getChannelWidth(){return this.channelWidthPercent}}class ko{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.filter(o=>!o.isVirtual),s=n.length>0?n.reduce((o,h)=>o+h.close,0)/n.length:0;this.series.applyOptions({baseValue:{type:"price",price:s}});const a=r.props.chartData.map(o=>o.isVirtual?{time:o.time,value:o.close,topLineColor:"rgba(0, 0, 0, 0)",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)"}:{time:o.time,value:o.close});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.BaselineSeries,{baseValue:{type:"price",price:0},topLineColor:e.chart.candleUpColor||"#26a69a",topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",bottomLineColor:e.chart.candleDownColor||"#ef5350",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToBaselineData(t){const e=t.filter(r=>!r.isVirtual),i=e.length>0?e.reduce((r,n)=>r+n.close,0)/e.length:0;return this.series&&this.series.applyOptions({baseValue:{type:"price",price:i}}),t.map(r=>({time:r.time,value:r.close,...r.isVirtual&&{topLineColor:"rgba(0, 0, 0, 0)",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class Po{constructor(t,e){this.currentChart=null,this.currentType=null,this.chartLayer=t,this.theme=e}switchChartType(t){if(!(this.currentType===t&&this.currentChart))switch(this.destroyCurrentChart(),this.currentType=t,t){case W.Candle:this.currentChart=new ui(this.chartLayer,this.theme);break;case W.HollowCandle:this.currentChart=new uo(this.chartLayer,this.theme);break;case W.Bar:this.currentChart=new ao(this.chartLayer,this.theme);break;case W.Line:this.currentChart=new no(this.chartLayer,this.theme);break;case W.Area:this.currentChart=new oo(this.chartLayer,this.theme);break;case W.StepLine:this.currentChart=new lo(this.chartLayer,this.theme);break;case W.BaseLine:this.currentChart=new ho(this.chartLayer,this.theme);break;case W.Histogram:this.currentChart=new co(this.chartLayer,this.theme);break;case W.HeikinAshi:this.currentChart=new go(this.chartLayer,this.theme);break;case W.LineBreak:this.currentChart=new po(this.chartLayer,this.theme);break;case W.Mountain:this.currentChart=new fo(this.chartLayer,this.theme);break;case W.BaselineArea:this.currentChart=new ko(this.chartLayer,this.theme);break;case W.HighLow:this.currentChart=new Mo(this.chartLayer,this.theme);break;case W.HLCArea:this.currentChart=new mo(this.chartLayer,this.theme);break;default:console.warn(`Unknown chart type: ${t}`),this.currentChart=new ui(this.chartLayer,this.theme);break}}refreshData(){this.currentChart&&this.currentChart.refreshData(this.chartLayer)}updateStyle(t){this.currentChart&&this.currentChart.updateStyle(t)}getCurrentSeries(){return this.currentChart?this.currentChart.getSeries():null}getCurrentType(){return this.currentType}destroyCurrentChart(){this.currentChart&&(this.currentChart.destroy(this.chartLayer),this.currentChart=null)}destroy(){this.destroyCurrentChart(),this.currentType=null}}class _o{constructor(t,e,i,r){this._chart=null,this._series=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this._menu=null,this._heatMapRect={x:0,y:0,width:0,height:0},this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this.refreshData=n=>{this._chartData=n.props.chartData||[],this.requestUpdate()},this._closeCallBack=r,this.initializeHeatMap(t,e,i)}initializeHeatMap(t,e,i){this._chartData=t.props.chartData||[],this._i18n=e,this._theme=i,t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(t.props.chart))}bindContextMenu(t){const e=t.chartElement();e&&(this._contextMenuHandler=i=>{this.isInHeatMapArea(i.offsetX,i.offsetY)&&(i.preventDefault(),this.showContextMenu(i.clientX,i.clientY))},this._clickHandler=i=>{this._menu&&!this._menu.contains(i.target)&&this.hideContextMenu()},this._resizeHandler=()=>this.updateHeatMapRect(),e.addEventListener("contextmenu",this._contextMenuHandler),document.addEventListener("click",this._clickHandler),window.addEventListener("resize",this._resizeHandler))}isInHeatMapArea(t,e){return this.updateHeatMapRect(),t>=this._heatMapRect.x&&t<=this._heatMapRect.x+this._heatMapRect.width&&e>=this._heatMapRect.y&&e<=this._heatMapRect.y+this._heatMapRect.height}updateHeatMapRect(){if(!this._chart)return;const t=this._chart.chartElement();if(!t)return;const e=t.getBoundingClientRect(),i=e.width*.25,r=e.width-i;this._heatMapRect={x:r,y:0,width:i,height:e.height-29}}showContextMenu(t,e){this.hideContextMenu(),this._menu=document.createElement("div"),this._menu.style.position="fixed",this._menu.style.left=`${t}px`,this._menu.style.top=`${e}px`,this._menu.style.background=this._theme?.panel.backgroundColor||"#FFFFFF",this._menu.style.border=`1px solid ${this._theme?.panel.borderColor||"#E1E5E9"}`,this._menu.style.borderRadius="4px",this._menu.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",this._menu.style.zIndex="1000",this._menu.style.padding="4px 0",this._menu.style.minWidth="120px",this._menu.style.fontFamily="Arial, sans-serif",this._menu.style.fontSize="14px";const i=document.createElement("button");i.textContent=this._i18n?.close||"Close",i.style.background="none",i.style.border="none",i.style.padding="6px 12px",i.style.width="100%",i.style.textAlign="left",i.style.cursor="pointer",i.style.color=this._theme?.modal.textColor||"#2D323D",i.style.transition="background-color 0.2s",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=this._theme?.toolbar.button.hover||"#2D323D"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="transparent"}),i.addEventListener("click",()=>{this.destroy(),this.hideContextMenu()}),this._menu.appendChild(i),document.body.appendChild(this._menu)}hideContextMenu(){this._menu&&(document.body.removeChild(this._menu),this._menu=null)}attached(t){this._chart=t.chart,this._series=t.series,this.requestUpdate(),setTimeout(()=>this.updateHeatMapRect(),0)}updateAllViews(){this.requestUpdate(),this.updateHeatMapRect()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}updateI18n(t){this._i18n=t}updateTheme(t){this._theme=t}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&(this.drawHeatMap(e),this.updateHeatMapRect())}}),[{renderer:()=>this._renderer}]}drawHeatMap(t){const e=this._chartData;if(!e||e.length===0)return;const i=e.filter(d=>!d.isVirtual&&d.volume);if(i.length===0)return;const r=Math.min(...i.map(d=>d.low)),s=Math.max(...i.map(d=>d.high))-r;if(s<=0)return;const a=this._width*.25,o=this._width-a;t.clearRect(o,0,a,this._height);const h=Math.min(200,Math.floor(this._height/2)),l=new Array(h).fill(0);i.forEach(d=>{const p=Math.min(h-1,Math.max(0,Math.floor((d.high-r)/s*h))),f=Math.min(h-1,Math.max(0,Math.floor((d.low-r)/s*h))),k=Math.max(1,p-f+1),P=d.volume/k;for(let _=f;_<=p;_++)l[_]+=P});const g=Math.max(...l);if(g===0)return;const u=2,c=this._height/h;t.save();for(let d=0;d<h;d++){const p=l[d];if(p===0)continue;const f=p/g,P=Math.max(f,.01),_=Math.max(u,a*P),S=Math.pow(P,.5);let b,v,D;if(S<.5){const X=S*2;b=Math.floor(0),v=Math.floor(165*X),D=Math.floor(255*(1-X)+255*X)}else{const X=(S-.5)*2;b=Math.floor(255*X),v=Math.floor(255*(1-X)),D=Math.floor(255*(1-X))}const F=.4+S*.6,R=`rgba(${b}, ${v}, ${D}, ${F})`,H=o+(a-_),j=this._height-(d+1)*c;t.fillStyle=R,t.fillRect(H,j,_,c)}t.restore()}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate(),this._series&&this._series._internal__dataChanged&&this._series._internal__dataChanged()}catch{}}destroy(){const t=this._chart?.chartElement();if(t&&this._contextMenuHandler&&t.removeEventListener("contextmenu",this._contextMenuHandler),this._clickHandler&&document.removeEventListener("click",this._clickHandler),this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),this._series&&this._isAttached)try{this._series.detachPrimitive(this),this._isAttached=!1}catch{}this.hideContextMenu(),this._renderer=null,this._isAttached=!1,this._menu=null,this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this._closeCallBack?.()}reactivate(){if(this._chart&&this._series&&!this._isAttached)try{this._series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(this._chart),this.requestUpdate()}catch{}}}class So{constructor(t,e,i,r){this._chart=null,this._series=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this._cachedProfile=null,this._lastDataHash="",this._widthProportion=.35,this._menu=null,this._profileRect={x:0,y:0,width:0,height:0},this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this.refreshData=n=>{this._chartData=n.props.chartData||[],this._cachedProfile=null,this.requestUpdate()},this._closeCallBack=r,this._config={profileWidth:.15,timeSlotMinutes:30,valueAreaPercent:.7,tickSize:.01,showInitialBalance:!0,showValueArea:!0,maxPriceLevels:80,simplifyTPO:!0},this.initializeMarketProfile(t,e,i)}initializeMarketProfile(t,e,i){this._chartData=t.props.chartData||[],this._i18n=e,this._theme=i,t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(t.props.chart))}bindContextMenu(t){const e=t.chartElement();e&&(this._contextMenuHandler=i=>{this.isInProfileArea(i.offsetX,i.offsetY)&&(i.preventDefault(),this.showContextMenu(i.clientX,i.clientY))},this._clickHandler=i=>{this._menu&&!this._menu.contains(i.target)&&this.hideContextMenu()},this._resizeHandler=()=>this.updateProfileRect(),e.addEventListener("contextmenu",this._contextMenuHandler),document.addEventListener("click",this._clickHandler),window.addEventListener("resize",this._resizeHandler))}isInProfileArea(t,e){return this.updateProfileRect(),t>=this._profileRect.x&&t<=this._profileRect.x+this._profileRect.width&&e>=this._profileRect.y&&e<=this._profileRect.y+this._profileRect.height}updateProfileRect(){if(!this._chart)return;const t=this._chart.chartElement();if(!t)return;const e=t.getBoundingClientRect(),i=e.width*this._widthProportion,r=0;this._profileRect={x:r,y:0,width:i,height:e.height-29}}showContextMenu(t,e){this.hideContextMenu(),this._menu=document.createElement("div"),this._menu.style.position="fixed",this._menu.style.left=`${t}px`,this._menu.style.top=`${e}px`,this._menu.style.background=this._theme?.panel.backgroundColor||"#FFFFFF",this._menu.style.border=`1px solid ${this._theme?.panel.borderColor||"#E1E5E9"}`,this._menu.style.borderRadius="4px",this._menu.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",this._menu.style.zIndex="1000",this._menu.style.padding="4px 0",this._menu.style.minWidth="120px",this._menu.style.fontFamily="Arial, sans-serif",this._menu.style.fontSize="14px";const i=document.createElement("button");i.textContent=this._i18n?.close||"Close",i.style.background="none",i.style.border="none",i.style.padding="6px 12px",i.style.width="100%",i.style.textAlign="left",i.style.cursor="pointer",i.style.color=this._theme?.modal.textColor||"#2D323D",i.style.transition="background-color 0.2s",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=this._theme?.toolbar.button.hover||"#2D323D"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="transparent"}),i.addEventListener("click",()=>{this.destroy(),this.hideContextMenu()}),this._menu.appendChild(i),document.body.appendChild(this._menu)}hideContextMenu(){this._menu&&(document.body.removeChild(this._menu),this._menu=null)}attached(t){this._chart=t.chart,this._series=t.series,this.requestUpdate(),setTimeout(()=>this.updateProfileRect(),0)}updateAllViews(){this.requestUpdate(),this.updateProfileRect()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}updateI18n(t){this._i18n=t}updateTheme(t){this._theme=t}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&(this.drawMarketProfile(e),this.updateProfileRect())}}),[{renderer:()=>this._renderer}]}drawMarketProfile(t){const e=this._chartData;if(!e||e.length===0)return;const i=this.getDataHash(e);if((!this._cachedProfile||this._lastDataHash!==i)&&(this._cachedProfile=this.calculateProfile(e),this._lastDataHash=i),!this._cachedProfile)return;const r=this._width*this._widthProportion;t.clearRect(0,0,r,this._height),this.drawProfileBars(t,this._cachedProfile,r),this._config.showValueArea&&this.drawValueArea(t,this._cachedProfile,r)}getDataHash(t){return t.length===0?"empty":`${t.length}_${t[0].time}_${t[t.length-1].time}`}calculateProfile(t){if(t.length===0)return null;const e=t.filter(u=>!u.isVirtual);if(e.length===0)return null;const i=Math.min(...e.map(u=>u.low)),r=Math.max(...e.map(u=>u.high)),n=r-i;if(n<=0)return null;const s=Math.min(this._config.maxPriceLevels,Math.floor(this._height/3)),a=n/s,o=[];for(let u=0;u<=s;u++)o.push({price:i+u*a,count:0,volume:0});e.forEach(u=>{const c=this.findPriceLevel(o,u.high),d=this.findPriceLevel(o,u.low);for(let p=d;p<=c;p++)o[p].count++,o[p].volume+=u.volume||0});const h=Math.max(...o.map(u=>u.count)),l=o.find(u=>u.count===h),g=this.calculateSimpleValueArea(o,this._config.valueAreaPercent);return{levels:o,minPrice:i,maxPrice:r,priceRange:n,poc:l?l.price:i+n/2,valueAreaHigh:g.high,valueAreaLow:g.low,maxCount:h}}findPriceLevel(t,e){const i=t[0].price,r=t[t.length-1].price,n=r-i;return e<=i?0:e>=r?t.length-1:Math.min(t.length-1,Math.max(0,Math.floor((e-i)/n*t.length)))}calculateSimpleValueArea(t,e){const r=t.reduce((l,g)=>l+g.count,0)*e,n=Math.max(...t.map(l=>l.count)),s=t.findIndex(l=>l.count===n);let a=0,o=s,h=s;for(;a<r&&(o<t.length-1||h>0);){let l=o<t.length-1?t[o+1].count:0,g=h>0?t[h-1].count:0;if(l>=g&&o<t.length-1)o++,a+=t[o].count;else if(h>0)h--,a+=t[h].count;else break}return{high:t[o].price,low:t[h].price}}drawProfileBars(t,e,i){const{levels:r,minPrice:n,maxPrice:s,priceRange:a,maxCount:o}=e;if(a<=0)return;t.save();const h=i,l=this._height/r.length;r.forEach(g=>{if(g.count===0)return;const u=(g.price-n)/a,c=this._height-u*this._height,d=g.count/o,p=l,f=this.getProfileColor(d);t.fillStyle=f;const k=Math.max(2,h*d*.8);t.fillRect(0,c-p/2,k,p)}),t.restore()}drawValueArea(t,e,i){const{valueAreaHigh:r,valueAreaLow:n,minPrice:s,maxPrice:a,priceRange:o,poc:h}=e;if(o<=0)return;const l=(r-s)/o,g=(n-s)/o,u=(h-s)/o,c=this._height-l*this._height,d=this._height-g*this._height,p=this._height-u*this._height;t.save(),t.fillStyle="rgba(255, 215, 0, 0.1)",t.fillRect(0,c,i,d-c),t.strokeStyle="rgba(255, 215, 0, 0.6)",t.lineWidth=1,t.setLineDash([3,2]),t.beginPath(),t.moveTo(0,c),t.lineTo(i,c),t.stroke(),t.beginPath(),t.moveTo(0,d),t.lineTo(i,d),t.stroke(),t.strokeStyle="rgba(255, 0, 0, 0.8)",t.setLineDash([]),t.lineWidth=1,t.beginPath(),t.moveTo(0,p),t.lineTo(i,p),t.stroke(),t.restore()}getProfileColor(t){return t<.3?"rgba(100, 150, 255, 0.4)":t<.6?"rgba(50, 100, 200, 0.6)":"rgba(0, 50, 150, 0.8)"}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate(),this._series&&this._series._internal__dataChanged&&this._series._internal__dataChanged()}catch{}}destroy(){const t=this._chart?.chartElement();if(t&&this._contextMenuHandler&&t.removeEventListener("contextmenu",this._contextMenuHandler),this._clickHandler&&document.removeEventListener("click",this._clickHandler),this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),this._series&&this._isAttached)try{this._series.detachPrimitive(this),this._isAttached=!1}catch{}this.hideContextMenu(),this._renderer=null,this._isAttached=!1,this._menu=null,this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this._closeCallBack?.()}reactivate(){if(this._chart&&this._series&&!this._isAttached)try{this._series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(this._chart),this.requestUpdate()}catch{}}}class bo extends O.Component{constructor(t){super(t),this.canvasRef=O.createRef(),this.containerRef=O.createRef(),this.allDrawings=[],this.doubleClickTimeout=null,this.chartEventManager=null,this.originalChartOptions=null,this.currentMarkSettingsStyle=null,this.chartMarkManager=null,this.chartMarkTextEditManager=null,this.mainChartTechnicalIndicatorManager=null,this.staticMarkManager=null,this.volume=null,this.volumeHeatMap=null,this.marketProfile=null,this.mainChartManager=null,this.swtichMainChartType=()=>{this.mainChartManager?.switchChartType(this.props.currentMainChartType),this.mainChartManager?.refreshData(),this.updateStaticMark()},this.setCursorType=e=>{e&&this.setState({cursorType:e})},this.initializeMainChartIndicators=()=>{if(!this.mainChartTechnicalIndicatorManager)return;const{selectedMainChartIndicator:e}=this.props;e&&this.updateSelectedMainChartIndicators()},this.updateAllMainChartIndicatorData=()=>{const{selectedMainChartIndicators:e}=this.state;e.forEach(i=>{i.type!==null&&this.mainChartTechnicalIndicatorManager?.updateAllMainChartIndicatorData(this,i)})},this.updateMainChartIndicators=()=>{const{selectedMainChartIndicators:e}=this.state;e.forEach(i=>{i.type!==null&&(this.mainChartTechnicalIndicatorManager?.removeIndicator(this.props.chart,i.type),this.mainChartTechnicalIndicatorManager?.updateMainChartIndicator(this,i))})},this.updateSelectedMainChartIndicators=()=>{if(!this.mainChartTechnicalIndicatorManager||!this.props.chartData)return;const{selectedMainChartIndicator:e}=this.props;e&&(E.HEATMAP===e.type||E.MARKETPROFILE===e.type||this.setState(i=>{const r=i.selectedMainChartIndicators.some(o=>o.type===e.type);let n;r?n=i.selectedMainChartIndicators.map(o=>o.type===e.type?e:o):n=[...i.selectedMainChartIndicators,e];const s=n.map(o=>o.type).filter(o=>o!==null),a=Ct().map(o=>{if(o.type&&s.includes(o.type)){const h=n.find(l=>l.type===o.type);return{...o,visible:!0,params:h?.params||o.params}}return{...o,visible:!1}});return{selectedMainChartIndicators:n,selectedMainChartIndicatorTypes:s,modalConfirmChartInfoIndicators:a}},()=>{this.updateMainChartIndicators()}))},this.handleOpenIndicatorSettings=e=>{e.type&&this.setState({modalEditingChartInfoIndicator:e,isMainChartIndicatorsModalOpen:!0})},this.handleMainChartIndicatorsSettingConfirm=e=>{e.params&&(e.params=e.params.filter(i=>i.paramValue!==0));try{this.mainChartTechnicalIndicatorManager?.updateMainChartIndicator(this,e),this.setState(i=>({selectedMainChartIndicators:i.selectedMainChartIndicators.map(r=>r.type===e.type?e:r)})),this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null})}catch{this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null})}},this.handleRemoveIndicator=e=>{!e||!this.mainChartTechnicalIndicatorManager||!this.props.chart||(this.mainChartTechnicalIndicatorManager.removeIndicator(this.props.chart,e),this.setState(i=>({selectedMainChartIndicators:i.selectedMainChartIndicators.filter(r=>r.type!==e),selectedMainChartIndicatorTypes:i.selectedMainChartIndicatorTypes.filter(r=>r!==e)})),this.props.onMainChartIndicatorChange&&this.props.selectedMainChartIndicator?.type===e&&this.props.onMainChartIndicatorChange(null),this.props.onToolSelect&&this.props.selectedMainChartIndicator?.type===e&&this.props.onToolSelect(""))},this.setMockKLineMarkMode=()=>{this.chartMarkManager?.setMockKLineMarkMode(this)},this.initializeGraphManager=()=>{this.chartMarkManager?.initializeMarkManager(this)},this.initializeGraphManagerProps=()=>{this.chartMarkManager?.initializeMarkManagerProps(this)},this.destroyGraphManager=()=>{this.chartMarkManager?.destroyMarkManager()},this.showAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.showAllMarks()},this.hideAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.hideAllMarks()},this.clearAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.deleteAllMark()},this.setSchiffPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSchiffPitchforkMode(this)},this.setHeatMapMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHeatMapMode(this)},this.setTextEditMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTextEditMarkMode(this)},this.setBubbleBoxMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setBubbleBoxMarkMode(this)},this.setPinMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPinMarkMode(this)},this.setEmojiMarkMode=e=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEmojiMarkMode(this,e)},this.setSignpostMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSignpostMarkMode(this)},this.setPriceNoteMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceNoteMarkMode(this)},this.setFlagMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFlagMarkMode(this)},this.setPriceLabelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceLabelMode(this)},this.setShortPositionMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setShortPositionMarkMode(this)},this.setLongPositionMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLongPositionMarkMode(this)},this.setThickArrowLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setThickArrowLineMode(this)},this.setEraserMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEraserMode(this)},this.setMarkerPenMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setMarkerPenMode(this)},this.setBrushMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setBrushMode(this)},this.setPenMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPenMode(this)},this.setPencilMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPencilMode(this)},this.setTimePriceRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTimePriceRangeMarkMode(this)},this.setPriceRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceRangeMarkMode(this)},this.setTimeRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTimeRangeMarkMode(this)},this.setElliottTripleCombinationMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottTripleCombinationMode(this)},this.setElliottDoubleCombinationMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottDoubleCombinationMode(this)},this.setElliottTriangleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottTriangleMode(this)},this.setElliottCorrectiveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottCorrectiveMode(this)},this.setElliottImpulseMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottImpulseMode(this)},this.setTriangleABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTriangleABCDMode(this)},this.setABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setABCDMode(this)},this.setHeadAndShouldersMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHeadAndShouldersMode(this)},this.setXABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setXABCDMode(this)},this.setDoubleCurveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setDoubleCurveMode(this)},this.setCurveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setCurveMode(this)},this.setSectorMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSectorMode(this)},this.setFibonacciExtensionBaseTimeMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciExtensionBaseTimeMode(this)},this.setFibonacciExtensionBasePriceMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciExtensionBasePriceMode(this)},this.setFibonacciChannelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciChannelMode(this)},this.setFibonacciFanMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciFanMode(this)},this.setFibonacciWedgeMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciWedgeMode(this)},this.setFibonacciSpiralMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciSpiralMode(this)},this.setFibonacciCircleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciCircleMode(this)},this.setFibonacciArcMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciArcMode(this)},this.setFibonacciRetracementMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciRetracementMode(this)},this.setFibonacciTimeZoonMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciTimeZoonMode(this)},this.setGannRectangleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannRectangleMode(this)},this.setGannBoxMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannBoxMode(this)},this.setGannFanMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannFanMode(this)},this.setTriangleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTriangleMarkMode(this)},this.setEllipseMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEllipseMarkMode(this)},this.setCircleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setCircleMarkMode(this)},this.setRectangleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setRectangleMarkMode(this)},this.setEnhancedAndrewPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEnhancedAndrewPitchforkMode(this)},this.setAndrewPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setAndrewPitchforkMode(this)},this.setDisjointChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setDisjointChannelMarkMode(this)},this.setEquidistantChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEquidistantChannelMarkMode(this)},this.setLinearRegressionChannelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLinearRegressionChannelMode(this)},this.setLineSegmentMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLineSegmentMarkMode(this)},this.setHorizontalLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHorizontalLineMode(this)},this.setVerticalLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setVerticalLineMode(this)},this.setArrowLineMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setArrowLineMarkMode(this)},this.setParallelChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setParallelChannelMarkMode(this)},this.showGraphMarkToolBar=e=>{if(this.state.selectedGraphMark&&this.state.selectedGraphMark.id===e.id||this.state.selectedGraphMark)return;let i={x:20,y:20};if(e.points.length>0){const r=e.points[0];i={x:Math.max(10,r.x-150),y:Math.max(10,r.y-80)}}this.setState({selectedGraphMark:e,markToolBarPosition:i,showGraphMarkToolBar:!0})},this.closeGraphMarkToolBar=()=>{this.setState({showGraphMarkToolBar:!1})},this.showTableMarkToolBar=e=>{if(this.state.selectedTableMark&&this.state.selectedTableMark.id===e.id||this.state.selectedTableMark)return;let i={x:20,y:20};if(e.points.length>0){const r=e.points[0];i={x:Math.max(10,r.x-150),y:Math.max(10,r.y-80)}}this.setState({selectedTableMark:e,markToolBarPosition:i,showTableMarkToolBar:!0})},this.closeTableMarkToolBar=()=>{this.setState({showTableMarkToolBar:!1})},this.showTextEditMarkToolBar=(e,i)=>{if(this.state.selectedTextEditMark&&this.state.selectedTextEditMark.id===e.id||this.state.selectedTextEditMark)return;let r={x:20,y:20};if(e.points.length>0){const n=e.points[0];r={x:Math.max(10,n.x-150),y:Math.max(10,n.y-80)}}this.setState({selectedTextEditMark:e,markToolBarPosition:r,showTextMarkToolBar:!0,isShowGrapTool:i})},this.closeTextMarkToolBar=()=>{this.setState({showTextMarkToolBar:!1})},this.handleMouseDown=e=>{this.chartEventManager?.mouseDown(this,e)},this.handleMouseUp=e=>{this.chartEventManager?.mouseUp(this,e)},this.handleMouseMove=e=>{this.chartEventManager?.mouseMove(this,e)},this.handleViewportShiftLeft=()=>{this.props.chart&&this.props.viewportManager&&this.props.viewportManager.scrollChart("left")},this.handleViewportShiftRight=()=>{this.props.chart&&this.props.viewportManager&&this.props.viewportManager.scrollChart("right")},this.handleZoomIn=()=>{this.props.viewportManager&&this.props.viewportManager.zoomIn()},this.handleZoomOut=()=>{this.props.viewportManager&&this.props.viewportManager.zoomOut()},this.openIndicatorsModal=()=>{this.setState({isMainChartIndicatorsModalOpen:!0})},this.handleToggleIndicator=e=>{e&&(this.mainChartTechnicalIndicatorManager?.isVisible(e)?this.mainChartTechnicalIndicatorManager?.hideIndicator(e):this.mainChartTechnicalIndicatorManager?.showIndicator(e))},this.renderChartInfo=()=>{const{currentTheme:e,title:i}=this.props,{currentOHLC:r,mousePosition:n,showOHLC:s,maIndicatorValues:a,emaIndicatorValues:o,bollingerBandsValues:h,ichimokuValues:l,donchianChannelValues:g,envelopeValues:u,vwapValue:c,selectedMainChartIndicators:d}=this.state;return m.jsx(En,{currentTheme:e,title:i,currentOHLC:r,mousePosition:n,showOHLC:s,onToggleOHLC:this.toggleOHLCVisibility,onOpenIndicatorsModal:this.openIndicatorsModal,onOpenIndicatorSettings:this.handleOpenIndicatorSettings,onRemoveIndicator:this.handleRemoveIndicator,onToggleIndicator:this.handleToggleIndicator,visibleIndicatorTypes:this.state.selectedMainChartIndicatorTypes,indicators:d,maIndicatorValues:a,emaIndicatorValues:o,bollingerBandsValues:h,ichimokuValues:l,donchianChannelValues:g,envelopeValues:u,vwapValue:c,i18n:this.props.i18n})},this.handleIndicatorsClose=()=>{this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null,selectedMainChartIndicators:[]})},this.setImageMarkMode=()=>{this.chartMarkManager?.imageMarkManager&&this.setState({isImageUploadModalOpen:!0})},this.handleImageConfirm=e=>{if(this.setSelectedImageUrl(e),this.setState({isImageUploadModalOpen:!1}),this.chartMarkManager?.imageMarkManager){this.chartMarkManager?.imageMarkManager.setSelectedImageUrl(e);const i=this.chartMarkManager?.imageMarkManager.startImageMarkMode();this.setState({isImageMarkMode:i.isImageMarkMode,imageMarkStartPoint:i.imageMarkStartPoint,currentImageMark:i.currentImageMark,currentMarkMode:C.Image})}},this.handleImageUploadClose=()=>{this.setState({isImageUploadModalOpen:!1}),this.props.onCloseDrawing&&this.props.onCloseDrawing()},this.setSelectedImageUrl=e=>{this.chartMarkManager?.imageMarkManager&&this.chartMarkManager?.imageMarkManager.setSelectedImageUrl(e),this.setState({selectedImageUrl:e})},this.handleChangeTextMarkFontColor=e=>{this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({color:e})},this.handleChangeTextMarkStyle=e=>{let i=e.isBold,r=e.isItalic;this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({isBold:i,isItalic:r})},this.handleChangeTextMarkFontSize=e=>{this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({fontSize:e})},this.handleChangeTextMarkGraphColor=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphColor:e})},this.handleChangeTextMarkGraphLineStyle=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphLineStyle:e})},this.handleChangeTextMarkGraphLineWidth=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphLineWidth:e})},this.handleDeleteTextEditMark=()=>{if(!this.state.selectedTextEditMark)return;const e=this.state.selectedTextEditMark,i=e.markType;this.chartMarkManager?.deleteMark(i,e.properties.originalMark),this.setState({selectedTextEditMark:null,markToolBarPosition:{x:20,y:20}})},this.handleTextMarkEditorSave=(e,i,r,n,s)=>{if(this.setState({isTextMarkEditorOpen:!1}),!!this.state.selectedTextEditMark&&(i&&this.handleChangeTextMarkFontColor(i),r&&this.handleChangeTextMarkFontSize(r),n&&this.handleChangeTextMarkStyle({isBold:n}),s&&this.handleChangeTextMarkStyle({isItalic:s}),e))switch(this.state.selectedTextEditMark.markType){case C.TextEdit:this.state.selectedTextEditMark.mark.updateText(e);break;case C.BubbleBox:this.state.selectedTextEditMark.mark.updateText(e);break;case C.Pin:this.state.selectedTextEditMark.mark.updateText(e);break;case C.SignPost:this.state.selectedTextEditMark.mark.updateText(e);break}},this.handleTextMarkEditorCancel=()=>{this.setState({isTextMarkEditorOpen:!1}),this.state.selectedTextEditMark},this.handleDeleteGraphMark=()=>{if(!this.state.selectedGraphMark)return;const e=this.state.selectedGraphMark;e.properties?.originalMark&&this.chartMarkManager?.deleteMark(e.markType,e.properties.originalMark),this.closeGraphMarkToolBar()},this.handleChangeGraphMarkColor=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({color:e})},this.handleChangeGraphMarkStyle=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({lineStyle:e})},this.handleChangeGraphMarkWidth=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({lineWidth:e})},this.handleGraphToolbarDrag=e=>{this.setState({isGraphMarkToolbarDragging:!0,graphMarkToolbarDragStartPoint:e});const i=n=>{if(this.state.isGraphMarkToolbarDragging&&this.state.graphMarkToolbarDragStartPoint){const s=n.clientX-this.state.graphMarkToolbarDragStartPoint.x,a=n.clientY-this.state.graphMarkToolbarDragStartPoint.y;this.setState(o=>({markToolBarPosition:{x:Math.max(0,o.markToolBarPosition.x+s),y:Math.max(0,o.markToolBarPosition.y+a)},graphMarkToolbarDragStartPoint:{x:n.clientX,y:n.clientY}}))}},r=()=>{this.setState({isGraphMarkToolbarDragging:!1,graphMarkToolbarDragStartPoint:null}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",r)},this.handleKeyDown=e=>{this.chartEventManager?.handleKeyDown(this,e)},this.handleDocumentMouseUp=e=>{this.chartEventManager?.documentMouseUp(this,e)},this.handleDocumentMouseDown=e=>{this.chartEventManager?.documentMouseDown(this,e)},this.handleDocumentMouseMove=e=>{this.chartEventManager?.documentMouseMove(this,e)},this.handleDocumentMouseWheel=e=>{this.chartEventManager?.documentMouseWheel(this,e)},this.handleTextMarkToolBarDrag=e=>{this.setState({isTextMarkToolbar:!0,dragStartPoint:e});const i=n=>{if(this.state.isTextMarkToolbar&&this.state.dragStartPoint){const s=n.clientX-this.state.dragStartPoint.x,a=n.clientY-this.state.dragStartPoint.y;this.setState(o=>({markToolBarPosition:{x:Math.max(0,o.markToolBarPosition.x+s),y:Math.max(0,o.markToolBarPosition.y+a)},dragStartPoint:{x:n.clientX,y:n.clientY}}))}},r=()=>{this.setState({isTextMarkToolbar:!1,dragStartPoint:null}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",r)},this.getToolName=e=>"",this.toggleOHLCVisibility=()=>{this.setState(e=>({showOHLC:!e.showOHLC}))},this.renderMainChart=()=>m.jsx("canvas",{ref:this.canvasRef,style:{position:"absolute",top:0,left:0,width:"calc(100% - 60px)",height:"calc(100% - 60px)",pointerEvents:"none",zIndex:1}}),this.showSubChartSettingModal=(e=[],i)=>{this.setState({isSubChartIndicatorsSettingModalOpen:!0,subChartIndicatorsSettingModalParams:e,currentSubChartIndicatorType:i})},this.handleSubChartSettingClose=()=>{this.setState({isSubChartIndicatorsSettingModalOpen:!1,subChartIndicatorsSettingModalParams:[],currentSubChartIndicatorType:null})},this.handleSubChartSettingConfirm=e=>{this.state.currentSubChartIndicatorType&&this.chartPanesManager?.updateSettingsBySubChartIndicatorType(this.props.chartData,e,this.state.currentSubChartIndicatorType),this.handleSubChartSettingClose()},this.state={isDrawing:!1,drawingPoints:[],currentDrawing:null,drawingStartPoint:null,drawings:[],selectedTextEditMark:null,selectedTableMark:null,selectedGraphMark:null,markToolBarPosition:{x:20,y:20},isTextMarkToolbar:!1,dragStartPoint:null,history:[],historyIndex:-1,isDragging:!1,isResizing:!1,isRotating:!1,resizeHandle:null,isTextInputActive:!1,textInputPosition:null,textInputValue:"",textInputCursorVisible:!0,textInputCursorTimer:null,activePanel:null,editingTextId:null,isFirstTimeTextMode:!1,isEmojiInputActive:!1,emojiInputPosition:null,editingEmojiId:null,mousePosition:null,currentOHLC:null,showOHLC:!0,pendingEmojiMark:null,isTextMarkEditorOpen:!1,textMarkEditorPosition:{x:0,y:0},textMarkEditorInitialData:{text:"",color:"#000000",fontSize:14,isBold:!1,isItalic:!1},lineSegmentMarkStartPoint:null,arrowLineMarkStartPoint:null,parallelChannelMarkStartPoint:null,currentLineSegmentMark:null,currentArrowLineMark:null,currentParallelChannelMark:null,currentMarkMode:null,showGraphMarkToolBar:!1,showTableMarkToolBar:!1,showTextMarkToolBar:!1,isShowGrapTool:!1,isGraphMarkToolbarDragging:!1,graphMarkToolbarDragStartPoint:null,linearRegressionChannelStartPoint:null,currentLinearRegressionChannel:null,equidistantChannelMarkStartPoint:null,currentEquidistantChannelMark:null,disjointChannelMarkStartPoint:null,currentDisjointChannelMark:null,andrewPitchforkHandlePoint:null,andrewPitchforkBaseStartPoint:null,currentAndrewPitchfork:null,enhancedAndrewPitchforkHandlePoint:null,enhancedAndrewPitchforkBaseStartPoint:null,currentEnhancedAndrewPitchfork:null,rectangleMarkStartPoint:null,currentRectangleMark:null,circleMarkStartPoint:null,currentCircleMark:null,ellipseMarkStartPoint:null,currentEllipseMark:null,triangleMarkStartPoint:null,currentTriangleMark:null,gannFanStartPoint:null,currentGannFan:null,gannBoxStartPoint:null,currentGannBox:null,gannRectangleStartPoint:null,currentGannRectangle:null,fibonacciTimeZoonStartPoint:null,currentFibonacciTimeZoon:null,fibonacciRetracementStartPoint:null,currentFibonacciRetracement:null,fibonacciArcStartPoint:null,currentFibonacciArc:null,fibonacciCircleCenterPoint:null,currentFibonacciCircle:null,fibonacciSpiralCenterPoint:null,currentFibonacciSpiral:null,fibonacciWedgeCenterPoint:null,currentFibonacciWedge:null,fibonacciWedgeDrawingStep:0,fibonacciWedgePoints:[],fibonacciFanStartPoint:null,currentFibonacciFan:null,currentFibonacciChannel:null,isFibonacciChannelMode:!1,fibonacciChannelDrawingStep:0,fibonacciExtensionBasePricePoints:[],currentFibonacciExtensionBasePrice:null,fibonacciExtensionBaseTimePoints:[],currentFibonacciExtensionBaseTime:null,sectorPoints:[],currentSector:null,curveMarkStartPoint:null,currentCurveMark:null,doubleCurveMarkStartPoint:null,currentDoubleCurveMark:null,xabcdPoints:[],currentXABCDMark:null,headAndShouldersPoints:[],currentHeadAndShouldersMark:null,abcdPoints:[],currentABCDMark:null,triangleABCDPoints:[],currentTriangleABCDMark:null,elliottImpulsePoints:[],currentElliottImpulseMark:null,elliottCorrectivePoints:[],currentElliottCorrectiveMark:null,elliottTrianglePoints:[],currentElliottTriangleMark:null,elliottDoubleCombinationPoints:[],currentElliottDoubleCombinationMark:null,elliottTripleCombinationPoints:[],currentElliottTripleCombinationMark:null,timeRangeMarkStartPoint:null,currentTimeRangeMark:null,isTimeRangeMarkMode:!1,priceRangeMarkStartPoint:null,currentPriceRangeMark:null,isPriceRangeMarkMode:!1,timePriceRangeMarkStartPoint:null,currentTimePriceRangeMark:null,isTimePriceRangeMarkMode:!1,isPencilMode:!1,isPencilDrawing:!1,currentPencilMark:null,pencilPoints:[],isPenMode:!1,isPenDrawing:!1,currentPenMark:null,penPoints:[],isBrushMode:!1,isBrushDrawing:!1,currentBrushMark:null,brushPoints:[],isMarkerPenMode:!1,isMarkerPenDrawing:!1,currentMarkerPen:null,markerPenPoints:[],isEraserMode:!1,isErasing:!1,eraserHoveredMark:null,thickArrowLineMarkStartPoint:null,currentThickArrowLineMark:null,isImageMarkMode:!1,imageMarkStartPoint:null,currentImageMark:null,showImageModal:!1,selectedImageUrl:"",isImageUploadModalOpen:!1,isLongPositionMarkMode:!1,longPositionMarkStartPoint:null,currentLongPositionMark:null,longPositionDrawingPhase:"none",isLongPositionDragging:!1,dragTarget:null,dragPoint:null,adjustingMode:null,adjustStartData:null,isShortPositionMarkMode:!1,shortPositionMarkStartPoint:null,currentShortPositionMark:null,shortPositionDrawingPhase:"none",isShortPositionDragging:!1,shortPositionDragTarget:null,shortPositionDragPoint:null,shortPositionAdjustingMode:null,shortPositionAdjustStartData:null,isPriceLabelMarkMode:!1,priceLabelMarkPoint:null,currentPriceLabelMark:null,isPriceLabelDragging:!1,priceLabelDragTarget:null,isFlagMarkMode:!1,flagMarkPoint:null,currentFlagMark:null,isFlagDragging:!1,flagDragTarget:null,isPriceNoteMarkMode:!1,priceNoteMarkStartPoint:null,currentPriceNoteMark:null,isPriceNoteDragging:!1,priceNoteDragTarget:null,priceNoteDragPoint:null,isSignpostMarkMode:!1,signpostMarkPoint:null,currentSignpostMark:null,isSignpostDragging:!1,signpostDragTarget:null,isEmojiMarkMode:!1,emojiMarkStartPoint:null,currentEmojiMark:null,isEmojiDragging:!1,emojiDragTarget:null,emojiDragPoint:null,isPinMarkMode:!1,pinMarkPoint:null,currentPinMark:null,isPinDragging:!1,pinDragTarget:null,isBubbleBoxMarkMode:!1,bubbleBoxMarkPoints:null,currentBubbleBoxMark:null,isBubbleBoxDragging:!1,bubbleBoxDragTarget:null,bubbleBoxDragType:null,isTextEditMarkMode:!1,isTextEditDragging:!1,textEditDragTarget:null,isMainChartIndicatorsModalOpen:!1,selectedMainChartIndicators:[],selectedMainChartIndicatorTypes:[],modalEditingChartInfoIndicator:null,modalConfirmChartInfoIndicators:Ct(),maIndicatorValues:{},emaIndicatorValues:{},bollingerBandsValues:{},ichimokuValues:{},donchianChannelValues:{},envelopeValues:{},vwapValue:null,isSubChartIndicatorsSettingModalOpen:!1,subChartIndicatorsSettingModalParams:[],currentSubChartIndicatorType:null,isMockKLineMarkMode:!1,mockKLineMarkStartPoint:null,currentMockKLineMark:null,isMockKLineDragging:!1,mockKLineDragTarget:null,mockKLineDragPoint:null,isHeatMapMode:!1,heatMapStartPoint:null,currentHeatMap:null,isHeatMapDragging:!1,heatMapDragTarget:null,heatMapDragPoint:null,heatMapDrawingPhase:"none",heatMapAdjustingMode:null,isSchiffPitchforkMode:!1,schiffPitchforkHandlePoint:null,schiffPitchforkBaseStartPoint:null,currentSchiffPitchfork:null,isSchiffPitchforkDragging:!1,schiffPitchforkDragTarget:null,schiffPitchforkDragPoint:null,schiffPitchforkDrawingPhase:"none",schiffPitchforkAdjustingMode:null,cursorType:st.Crosshair},this.chartEventManager=new Ci,this.chartMarkManager=new Cn,this.chartMarkTextEditManager=new wn,this.mainChartTechnicalIndicatorManager=new Dn(this.props.currentTheme),this.initializeGraphManager(),this.staticMarkManager=new Bn,this.chartPanesManager=new io,this.mainChartManager=new Po(this,this.props.currentTheme)}componentDidMount(){this.setupCanvas(),this.setupAllDocumentEvents(),this.setupAllContainerEvents(),this.initializeMainChartIndicators(),this.chartMarkTextEditManager?.setupBubbleBoxMarkEvents(this),this.chartMarkTextEditManager?.setupSignPostMarkEvents(this),this.chartMarkTextEditManager?.setupPinMarkEvents(this),this.chartMarkTextEditManager?.setupTextEditMarkEvents(this),this.initStaticMark(),this.props.chart?this.chartEventManager?.registerCrosshairMoveEvent(this):setTimeout(()=>{this.props.chart&&this.chartEventManager?.registerCrosshairMoveEvent(this)},100),setTimeout(()=>{this.mainChartManager?.switchChartType(W.Candle),this.volume=new so(this),this.props.chart&&this.chartPanesManager?.setChartInstance(this.props.chart)},50)}componentDidUpdate(t){(t.chartSeries!==this.props.chartSeries||t.chart!==this.props.chart)&&this.initializeGraphManagerProps(),t.i18n!==this.props.i18n&&(this.volumeHeatMap?.updateI18n(this.props.i18n),this.marketProfile?.updateI18n(this.props.i18n)),t.currentTheme!==this.props.currentTheme&&(this.volumeHeatMap?.updateTheme(this.props.currentTheme),this.marketProfile?.updateTheme(this.props.currentTheme)),this.hasChartDataChanged(t.chartData,this.props.chartData)?(this.handleUpdateMainChartMaps(),this.updateAllMainChartIndicatorData(),this.chartPanesManager?.updateAllPaneData(this.props.chartData),this.volume?.refreshData(this),this.mainChartManager?.refreshData(),this.volumeHeatMap?.refreshData(this)):this.hasMainChartIndicatorChanged(t.selectedMainChartIndicator,this.props.selectedMainChartIndicator)&&(this.handleInitMainChartMaps(),this.updateSelectedMainChartIndicators(),this.chartPanesManager?.updateAllPaneData(this.props.chartData),this.volume?.refreshData(this),this.mainChartManager?.refreshData()),t.currentMainChartType!==this.props.currentMainChartType&&this.swtichMainChartType(),t.markData!==this.props.markData&&this.updateStaticMark(),t.currentTheme!==this.props.currentTheme&&this.chartPanesManager?.updateAllPaneTheme(this.props.currentTheme),t.selectedSubChartIndicators!==this.props.selectedSubChartIndicators&&(this.chartPanesManager?.removeAllPane(),setTimeout(()=>{this.props.selectedSubChartIndicators.forEach(e=>{this.chartPanesManager?.addSubChart(this,e,i=>{this.showSubChartSettingModal(this.chartPanesManager?.getParamsByIndicatorType(i),i)},i=>{this.chartPanesManager?.removePaneBySubChartIndicatorType(i),this.props.handleRemoveSubChartIndicator&&this.props.handleRemoveSubChartIndicator(i)})})},0))}componentWillUnmount(){this.cleanupAllDocumentEvents(),document.removeEventListener("keydown",this.handleKeyDown),this.doubleClickTimeout&&clearTimeout(this.doubleClickTimeout),this.cleanupAllContainerEvents(),this.destroyGraphManager(),this.chartMarkTextEditManager?.cleanupBubbleBoxMarkEvents(),this.chartMarkTextEditManager?.cleanupSignPostMarkEvents(),this.chartMarkTextEditManager?.cleanupPinMarkEvents(),this.chartMarkTextEditManager?.cleanupTextEditMarkEvents(),this.volumeHeatMap?.destroy(),this.marketProfile?.destroy(),this.mainChartManager?.destroy()}handleInitMainChartMaps(){this.props.selectedMainChartIndicator&&(this.props.selectedMainChartIndicator.type===E.HEATMAP&&(this.volumeHeatMap||(this.volumeHeatMap=new _o(this,this.props.i18n,this.props.currentTheme,()=>{this.volumeHeatMap=null}),this.volumeHeatMap?.refreshData(this))),this.props.selectedMainChartIndicator.type===E.MARKETPROFILE&&(this.marketProfile||(this.marketProfile=new So(this,this.props.i18n,this.props.currentTheme,()=>{this.marketProfile=null}),this.marketProfile?.refreshData(this))))}handleUpdateMainChartMaps(){this.props.selectedMainChartIndicator&&(this.volumeHeatMap&&this.volumeHeatMap?.refreshData(this),this.marketProfile&&this.marketProfile?.refreshData(this))}hasChartDataChanged(t,e){if(t===e)return!1;if(!t||!e||t.length!==e.length)return!0;const i=Math.min(t.length,e.length,5);for(let r=0;r<i;r++)if(t[r].time!==e[r].time)return!0;return!1}hasMainChartIndicatorChanged(t,e){return t===e?!1:!t||!e?!0:t.type!==e.type||t.nonce!==e.nonce||JSON.stringify(t.params)!==JSON.stringify(e.params)}initStaticMark(){setTimeout(()=>{this.props.markData&&this.staticMarkManager?.addMark(this.props.markData,{series:this.mainChartManager?.getCurrentSeries(),type:"mark"})},200)}updateStaticMark(){this.props.markData&&this.staticMarkManager?.addMark(this.props.markData,{series:this.mainChartManager?.getCurrentSeries(),type:"mark"})}setupAllContainerEvents(){if(!this.containerRef.current)return;const t=this.containerRef.current;t.addEventListener("mousedown",this.handleMouseDown),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseup",this.handleMouseUp)}cleanupAllContainerEvents(){if(!this.containerRef.current)return;const t=this.containerRef.current;t.removeEventListener("mousedown",this.handleMouseDown),t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseup",this.handleMouseUp)}setupAllDocumentEvents(){document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("mousemove",this.handleDocumentMouseMove),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("mouseup",this.handleDocumentMouseUp),document.addEventListener("wheel",this.handleDocumentMouseWheel)}cleanupAllDocumentEvents(){document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("mousemove",this.handleDocumentMouseMove),document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("mouseup",this.handleDocumentMouseUp),document.removeEventListener("wheel",this.handleDocumentMouseWheel)}serializeDrawings(){return JSON.stringify(this.allDrawings)}setupCanvas(){const t=this.canvasRef.current,e=this.containerRef.current;if(!t||!e)return;const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height}getDrawingLayerElementsPosition(){const t=[];return this.containerRef.current&&(this.containerRef.current.querySelectorAll(".drawing-text-element").forEach(r=>{const n=r.getAttribute("data-text-id");if(n){const s=r,a=s.getBoundingClientRect(),o=this.containerRef.current.getBoundingClientRect();t.push({id:n,type:"text",position:{x:a.left-o.left,y:a.top-o.top},element:s})}}),this.containerRef.current.querySelectorAll(".drawing-emoji-element").forEach(r=>{const n=r.getAttribute("data-emoji-id");if(n){const s=r,a=s.getBoundingClientRect(),o=this.containerRef.current.getBoundingClientRect();t.push({id:n,type:"emoji",position:{x:a.left-o.left,y:a.top-o.top},element:s})}})),t}setDrawingLayerElementsPosition(t){this.containerRef.current&&t.forEach(e=>{let i=null;if(e.type==="text"?i=this.containerRef.current.querySelector(`[data-text-id="${e.id}"]`):e.type==="emoji"&&(i=this.containerRef.current.querySelector(`[data-emoji-id="${e.id}"]`)),i){i.style.position="absolute",i.style.left=`${e.position.x}px`,i.style.top=`${e.position.y}px`;const r=this.allDrawings.findIndex(n=>n.id===e.id);r!==-1&&this.allDrawings[r].points.length>0&&(this.allDrawings[r].points[0]={...e.position})}})}moveDrawingLayerElements(t,e){if(!this.containerRef.current)return;this.containerRef.current.querySelectorAll(".drawing-text-element").forEach(n=>{const s=n,a=parseInt(s.style.left)||0,o=parseInt(s.style.top)||0;s.style.left=`${a+t}px`,s.style.top=`${o+e}px`}),this.containerRef.current.querySelectorAll(".drawing-emoji-element").forEach(n=>{const s=n,a=parseInt(s.style.left)||0,o=parseInt(s.style.top)||0;s.style.left=`${a+t}px`,s.style.top=`${o+e}px`}),this.allDrawings.forEach(n=>{(n.type==="text"||n.type==="emoji")&&n.points.length>0&&(n.points[0].x+=t,n.points[0].y+=e)})}getDrawingLayerElementsByType(t){const e=[];if(!this.containerRef.current)return e;const i=t==="text"?".drawing-text-element":".drawing-emoji-element",r=t==="text"?"data-text-id":"data-emoji-id";return this.containerRef.current.querySelectorAll(i).forEach(s=>{const a=s,o=a.getAttribute(r);if(o){const h=a.getBoundingClientRect(),l=this.containerRef.current.getBoundingClientRect();e.push({id:o,position:{x:h.left-l.left,y:h.top-l.top},element:a})}}),e}disableChartMovement(){this.props.chart&&(this.originalChartOptions=this.props.chart.options(),this.props.chart.applyOptions({handleScroll:!1,handleScale:!1}))}enableChartMovement(){this.props.chart.applyOptions({handleScroll:!0,handleScale:!0})}render(){const{activeTool:t,currentTheme:e,showInfoLayer:i=!0}=this.props,{isTextMarkToolbar:r,showGraphMarkToolBar:n,showTableMarkToolBar:s,markToolBarPosition:a,showTextMarkToolBar:o,selectedTextEditMark:h,selectedTableMark:l,selectedGraphMark:g,isMainChartIndicatorsModalOpen:u,isSubChartIndicatorsSettingModalOpen:c,subChartIndicatorsSettingModalParams:d,currentSubChartIndicatorType:p}=this.state;return m.jsx("div",{style:{width:"100%"},children:m.jsxs("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:5,pointerEvents:t?"auto":"none",opacity:1,display:"block"},children:[i&&m.jsx("div",{style:{position:"absolute",width:"100%",height:"100%"},children:this.renderChartInfo()}),m.jsx("div",{style:{position:"absolute",width:"100%",height:"100%"},children:this.renderMainChart()}),m.jsxs("div",{ref:this.containerRef,style:{position:"absolute",width:"100%",height:"100%",minHeight:"300px"},children:[this.state.isTextMarkEditorOpen&&m.jsx(aa,{isOpen:this.state.isTextMarkEditorOpen,position:this.state.textMarkEditorPosition,theme:this.props.currentTheme,initialText:this.state.textMarkEditorInitialData.text,initialColor:this.state.textMarkEditorInitialData.color,initialFontSize:this.state.textMarkEditorInitialData.fontSize,initialIsBold:this.state.textMarkEditorInitialData.isBold,initialIsItalic:this.state.textMarkEditorInitialData.isItalic,onSave:this.handleTextMarkEditorSave,onCancel:this.handleTextMarkEditorCancel,i18n:this.props.i18n}),c&&m.jsx(ro,{isOpen:c,onClose:this.handleSubChartSettingClose,onConfirm:this.handleSubChartSettingConfirm,initialParams:d,theme:e,parentRef:this.containerRef,indicatorType:p,i18n:this.props.i18n}),this.state.isImageUploadModalOpen&&m.jsx(na,{isOpen:this.state.isImageUploadModalOpen,onClose:this.handleImageUploadClose,onConfirm:this.handleImageConfirm,theme:e,i18n:this.props.i18n}),u&&m.jsx(yn,{isOpen:u,onClose:this.handleIndicatorsClose,onConfirm:this.handleMainChartIndicatorsSettingConfirm,initialIndicator:this.state.modalEditingChartInfoIndicator,theme:e,parentRef:this.containerRef,indicatorType:this.state.modalEditingChartInfoIndicator?.type||null,i18n:this.props.i18n}),o&&m.jsx(vn,{position:a,selectedDrawing:h,theme:e,onClose:this.closeTextMarkToolBar,onDelete:this.handleDeleteTextEditMark,onChangeTextColor:this.handleChangeTextMarkFontColor,onChangeTextStyle:this.handleChangeTextMarkStyle,onChangeTextSize:this.handleChangeTextMarkFontSize,onDragStart:this.handleTextMarkToolBarDrag,isDragging:r,getToolName:this.getToolName,isShowGrapTool:this.state.isShowGrapTool,onChangeGraphColor:this.handleChangeTextMarkGraphColor,onChangeGraphStyle:this.handleChangeTextMarkGraphLineStyle,onChangeGraphLineWidth:this.handleChangeTextMarkGraphLineWidth,i18n:this.props.i18n}),n&&m.jsx(xn,{position:a,selectedDrawing:g,theme:e,onClose:this.closeGraphMarkToolBar,onDelete:this.handleDeleteGraphMark,onChangeColor:this.handleChangeGraphMarkColor,onChangeStyle:this.handleChangeGraphMarkStyle,onChangeWidth:this.handleChangeGraphMarkWidth,onDragStart:this.handleGraphToolbarDrag,isDragging:!1,getToolName:this.getToolName,i18n:this.props.i18n})]})]})})}}class To{constructor(t,e,i,r,n="en"){this.series=null,this.locale=n,this.chart=q.createChart(t,{width:e,height:i,layout:r.layout,grid:{vertLines:{color:r.grid.vertLines.color+"30",style:1,visible:!0},horzLines:{color:r.grid.horzLines.color+"30",style:1,visible:!0}},crosshair:{mode:0},timeScale:{timeVisible:!0,secondsVisible:!1,borderColor:r.grid.vertLines.color},rightPriceScale:{borderColor:r.grid.horzLines.color,scaleMargins:{top:.1,bottom:.1},entireTextOnly:!1},handleScale:{axisPressedMouseMove:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0},localization:{locale:this.locale}})}getChart(){return this.chart}getSeries(){return this.series}getLocale(){return this.locale}}const Co=M=>[{id:"smileys",name:M?.emoji?.categories?.smileys||"表情",getName:t=>t?.emoji?.categories?.smileys||"表情"},{id:"people",name:M?.emoji?.categories?.people||"人物",getName:t=>t?.emoji?.categories?.people||"人物"},{id:"animals",name:M?.emoji?.categories?.animals||"动物",getName:t=>t?.emoji?.categories?.animals||"动物"},{id:"food",name:M?.emoji?.categories?.food||"食物",getName:t=>t?.emoji?.categories?.food||"食物"},{id:"activities",name:M?.emoji?.categories?.activities||"活动",getName:t=>t?.emoji?.categories?.activities||"活动"},{id:"travel",name:M?.emoji?.categories?.travel||"旅行",getName:t=>t?.emoji?.categories?.travel||"旅行"},{id:"objects",name:M?.emoji?.categories?.objects||"物品",getName:t=>t?.emoji?.categories?.objects||"物品"},{id:"symbols",name:M?.emoji?.categories?.symbols||"符号",getName:t=>t?.emoji?.categories?.symbols||"符号"},{id:"flags",name:M?.emoji?.categories?.flags||"旗帜",getName:t=>t?.emoji?.categories?.flags||"旗帜"}],wo=[{character:"😀",name:"笑脸",category:"smileys"},{character:"😃",name:"大笑",category:"smileys"},{character:"😄",name:"微笑",category:"smileys"},{character:"😁",name:"笑嘻嘻",category:"smileys"},{character:"😆",name:"哈哈笑",category:"smileys"},{character:"😅",name:"流汗笑",category:"smileys"},{character:"😂",name:"笑哭",category:"smileys"},{character:"🤣",name:"打滚笑",category:"smileys"},{character:"😊",name:"微笑脸",category:"smileys"},{character:"😇",name:"天使",category:"smileys"},{character:"🙂",name:"微微笑",category:"smileys"},{character:"🙃",name:"倒脸",category:"smileys"},{character:"😉",name:"眨眼",category:"smileys"},{character:"😍",name:"爱心眼",category:"smileys"},{character:"🥰",name:"微笑爱心",category:"smileys"},{character:"😘",name:"飞吻",category:"smileys"},{character:"😋",name:"美味",category:"smileys"},{character:"😎",name:"墨镜",category:"smileys"},{character:"🤩",name:"星星眼",category:"smileys"},{character:"🥳",name:"派对",category:"smileys"},{character:"😏",name:"得意",category:"smileys"},{character:"😢",name:"哭泣",category:"smileys"},{character:"😭",name:"大哭",category:"smileys"},{character:"😡",name:"愤怒",category:"smileys"},{character:"🤯",name:"爆炸头",category:"smileys"},{character:"🥺",name:"恳求脸",category:"smileys"},{character:"😱",name:"尖叫",category:"smileys"},{character:"🤔",name:"思考",category:"smileys"},{character:"😴",name:"睡觉",category:"smileys"},{character:"😷",name:"口罩",category:"smileys"},{character:"🤒",name:"生病",category:"smileys"},{character:"🤕",name:"受伤",category:"smileys"},{character:"🥶",name:"冷脸",category:"smileys"},{character:"🥵",name:"热脸",category:"smileys"},{character:"😈",name:"小恶魔",category:"smileys"},{character:"👿",name:"恶魔",category:"smileys"},{character:"💀",name:"骷髅",category:"smileys"},{character:"👻",name:"鬼魂",category:"smileys"},{character:"👽",name:"外星人",category:"smileys"},{character:"🤖",name:"机器人",category:"smileys"},{character:"👶",name:"婴儿",category:"people"},{character:"👧",name:"女孩",category:"people"},{character:"👦",name:"男孩",category:"people"},{character:"👩",name:"女人",category:"people"},{character:"👨",name:"男人",category:"people"},{character:"👵",name:"老奶奶",category:"people"},{character:"👴",name:"老爷爷",category:"people"},{character:"👮♀️",name:"女警察",category:"people"},{character:"👮♂️",name:"男警察",category:"people"},{character:"👷♀️",name:"女建筑工人",category:"people"},{character:"👷♂️",name:"男建筑工人",category:"people"},{character:"👩⚕️",name:"女医生",category:"people"},{character:"👨⚕️",name:"男医生",category:"people"},{character:"👩🍳",name:"女厨师",category:"people"},{character:"👨🍳",name:"男厨师",category:"people"},{character:"👩🎓",name:"女学生",category:"people"},{character:"👨🎓",name:"男学生",category:"people"},{character:"👸",name:"公主",category:"people"},{character:"🤴",name:"王子",category:"people"},{character:"🦸♀️",name:"女超级英雄",category:"people"},{character:"🦸♂️",name:"男超级英雄",category:"people"},{character:"🦹♀️",name:"女超级反派",category:"people"},{character:"🦹♂️",name:"男超级反派",category:"people"},{character:"🧙♀️",name:"女法师",category:"people"},{character:"🧙♂️",name:"男法师",category:"people"},{character:"🧚♀️",name:"仙女",category:"people"},{character:"🧚♂️",name:"精灵",category:"people"},{character:"🧛♀️",name:"女吸血鬼",category:"people"},{character:"🧛♂️",name:"男吸血鬼",category:"people"},{character:"🧜♀️",name:"美人鱼",category:"people"},{character:"🧜♂️",name:"男人鱼",category:"people"},{character:"🧝♀️",name:"女精灵",category:"people"},{character:"🧝♂️",name:"男精灵",category:"people"},{character:"👼",name:"天使宝宝",category:"people"},{character:"💁♀️",name:"女信息台",category:"people"},{character:"💁♂️",name:"男信息台",category:"people"},{character:"🙅♀️",name:"女禁止",category:"people"},{character:"🙅♂️",name:"男禁止",category:"people"},{character:"💆♀️",name:"女按摩",category:"people"},{character:"💆♂️",name:"男按摩",category:"people"},{character:"🐵",name:"猴脸",category:"animals"},{character:"🐒",name:"猴子",category:"animals"},{character:"🐶",name:"狗脸",category:"animals"},{character:"🐕",name:"狗",category:"animals"},{character:"🐩",name:"贵宾犬",category:"animals"},{character:"🐺",name:"狼",category:"animals"},{character:"🦊",name:"狐狸",category:"animals"},{character:"🐱",name:"猫脸",category:"animals"},{character:"🐈",name:"猫",category:"animals"},{character:"🦁",name:"狮子",category:"animals"},{character:"🐯",name:"老虎脸",category:"animals"},{character:"🐴",name:"马脸",category:"animals"},{character:"🦄",name:"独角兽",category:"animals"},{character:"🦓",name:"斑马",category:"animals"},{character:"🐮",name:"牛脸",category:"animals"},{character:"🐷",name:"猪脸",category:"animals"},{character:"🐭",name:"老鼠脸",category:"animals"},{character:"🐹",name:"仓鼠",category:"animals"},{character:"🐰",name:"兔子脸",category:"animals"},{character:"🐻",name:"熊",category:"animals"},{character:"🐨",name:"考拉",category:"animals"},{character:"🐼",name:"熊猫",category:"animals"},{character:"🐔",name:"鸡",category:"animals"},{character:"🐦",name:"鸟",category:"animals"},{character:"🐧",name:"企鹅",category:"animals"},{character:"🦅",name:"鹰",category:"animals"},{character:"🦆",name:"鸭",category:"animals"},{character:"🦉",name:"猫头鹰",category:"animals"},{character:"🦇",name:"蝙蝠",category:"animals"},{character:"🐸",name:"青蛙",category:"animals"},{character:"🐢",name:"乌龟",category:"animals"},{character:"🐍",name:"蛇",category:"animals"},{character:"🐊",name:"鳄鱼",category:"animals"},{character:"🦖",name:"霸王龙",category:"animals"},{character:"🦕",name:"蜥脚类恐龙",category:"animals"},{character:"🐬",name:"海豚",category:"animals"},{character:"🐳",name:"鲸鱼",category:"animals"},{character:"🦭",name:"海豹",category:"animals"},{character:"🐙",name:"章鱼",category:"animals"},{character:"🦑",name:"乌贼",category:"animals"},{character:"🦐",name:"虾",category:"animals"},{character:"🍎",name:"红苹果",category:"food"},{character:"🍐",name:"梨",category:"food"},{character:"🍊",name:"橙子",category:"food"},{character:"🍋",name:"柠檬",category:"food"},{character:"🍌",name:"香蕉",category:"food"},{character:"🍉",name:"西瓜",category:"food"},{character:"🍇",name:"葡萄",category:"food"},{character:"🍓",name:"草莓",category:"food"},{character:"🍑",name:"桃子",category:"food"},{character:"🍍",name:"菠萝",category:"food"},{character:"🥭",name:"芒果",category:"food"},{character:"🥥",name:"椰子",category:"food"},{character:"🥑",name:"牛油果",category:"food"},{character:"🍅",name:"番茄",category:"food"},{character:"🍆",name:"茄子",category:"food"},{character:"🥦",name:"西兰花",category:"food"},{character:"🥕",name:"胡萝卜",category:"food"},{character:"🌽",name:"玉米",category:"food"},{character:"🍞",name:"面包",category:"food"},{character:"🥐",name:"牛角包",category:"food"},{character:"🧀",name:"奶酪",category:"food"},{character:"🍗",name:"鸡腿",category:"food"},{character:"🍔",name:"汉堡",category:"food"},{character:"🍕",name:"披萨",category:"food"},{character:"🌭",name:"热狗",category:"food"},{character:"🥪",name:"三明治",category:"food"},{character:"🌮",name:"墨西哥卷饼",category:"food"},{character:"🌯",name:"墨西哥卷",category:"food"},{character:"🥗",name:"沙拉",category:"food"},{character:"🍲",name:"火锅",category:"food"},{character:"🥣",name:"碗和勺子",category:"food"},{character:"🍛",name:"咖喱饭",category:"food"},{character:"🍜",name:"面条",category:"food"},{character:"🍝",name:"意大利面",category:"food"},{character:"🍣",name:"寿司",category:"food"},{character:"🍤",name:"炸虾",category:"food"},{character:"🍙",name:"饭团",category:"food"},{character:"🍚",name:"米饭",category:"food"},{character:"🍦",name:"冰淇淋",category:"food"},{character:"🍧",name:"刨冰",category:"food"},{character:"⚽",name:"足球",category:"activities"},{character:"🏀",name:"篮球",category:"activities"},{character:"🏈",name:"美式足球",category:"activities"},{character:"⚾",name:"棒球",category:"activities"},{character:"🎾",name:"网球",category:"activities"},{character:"🏐",name:"排球",category:"activities"},{character:"🎱",name:"台球",category:"activities"},{character:"🏓",name:"乒乓球",category:"activities"},{character:"🏸",name:"羽毛球",category:"activities"},{character:"🥊",name:"拳击手套",category:"activities"},{character:"🎯",name:"射箭靶",category:"activities"},{character:"🎳",name:"保龄球",category:"activities"},{character:"🏹",name:"弓和箭",category:"activities"},{character:"🎣",name:"钓鱼竿",category:"activities"},{character:"⛸️",name:"溜冰鞋",category:"activities"},{character:"🎿",name:"滑雪",category:"activities"},{character:"🏒",name:"冰球",category:"activities"},{character:"🏏",name:"板球",category:"activities"},{character:"🏆",name:"奖杯",category:"activities"},{character:"🥇",name:"金牌",category:"activities"},{character:"🥈",name:"银牌",category:"activities"},{character:"🥉",name:"铜牌",category:"activities"},{character:"🎖️",name:"军奖章",category:"activities"},{character:"🏅",name:"运动奖牌",category:"activities"},{character:"🤿",name:"潜水装备",category:"activities"},{character:"🎣",name:"钓鱼竿",category:"activities"},{character:"🎪",name:"马戏团帐篷",category:"activities"},{character:"🎭",name:"表演艺术",category:"activities"},{character:"🎨",name:"艺术家调色板",category:"activities"},{character:"🎬",name:"场记板",category:"activities"},{character:"🎤",name:"麦克风",category:"activities"},{character:"🎧",name:"耳机",category:"activities"},{character:"🎼",name:"乐谱",category:"activities"},{character:"🎹",name:"电子琴",category:"activities"},{character:"🥁",name:"鼓",category:"activities"},{character:"🎷",name:"萨克斯",category:"activities"},{character:"🎺",name:"小号",category:"activities"},{character:"🎸",name:"吉他",category:"activities"},{character:"🪕",name:"班卓琴",category:"activities"},{character:"🎻",name:"小提琴",category:"activities"},{character:"🚗",name:"汽车",category:"travel"},{character:"🚕",name:"出租车",category:"travel"},{character:"🚙",name:"SUV",category:"travel"},{character:"🚌",name:"巴士",category:"travel"},{character:"🚎",name:"电车",category:"travel"},{character:"🏎️",name:"赛车",category:"travel"},{character:"🚓",name:"警车",category:"travel"},{character:"🚑",name:"救护车",category:"travel"},{character:"🚒",name:"消防车",category:"travel"},{character:"🚐",name:"小巴",category:"travel"},{character:"🚚",name:"卡车",category:"travel"},{character:"🚛",name:"铰接式卡车",category:"travel"},{character:"🚲",name:"自行车",category:"travel"},{character:"🛴",name:"滑板车",category:"travel"},{character:"🚁",name:"直升机",category:"travel"},{character:"✈️",name:"飞机",category:"travel"},{character:"🛩️",name:"小飞机",category:"travel"},{character:"🛫",name:"飞机起飞",category:"travel"},{character:"🛬",name:"飞机降落",category:"travel"},{character:"🚀",name:"火箭",category:"travel"},{character:"🛸",name:"飞碟",category:"travel"},{character:"🚂",name:"火车头",category:"travel"},{character:"🚃",name:"火车车厢",category:"travel"},{character:"🚄",name:"高速列车",category:"travel"},{character:"🚅",name:"子弹头列车",category:"travel"},{character:"🚆",name:"火车",category:"travel"},{character:"🚇",name:"地铁",category:"travel"},{character:"🚈",name:"轻轨",category:"travel"},{character:"🚉",name:"车站",category:"travel"},{character:"🚊",name:"电车",category:"travel"},{character:"🚝",name:"单轨铁路",category:"travel"},{character:"🚞",name:"山区铁路",category:"travel"},{character:"🚋",name:"有轨电车",category:"travel"},{character:"🚠",name:"缆车",category:"travel"},{character:"🚡",name:"空中缆车",category:"travel"},{character:"🚢",name:"船",category:"travel"},{character:"⛵",name:"帆船",category:"travel"},{character:"🛶",name:"独木舟",category:"travel"},{character:"🚤",name:"快艇",category:"travel"},{character:"⛴️",name:"渡轮",category:"travel"},{character:"⌚",name:"手表",category:"objects"},{character:"📱",name:"手机",category:"objects"},{character:"📲",name:"手机箭头",category:"objects"},{character:"💻",name:"笔记本电脑",category:"objects"},{character:"⌨️",name:"键盘",category:"objects"},{character:"🖥️",name:"台式电脑",category:"objects"},{character:"🖨️",name:"打印机",category:"objects"},{character:"🖱️",name:"电脑鼠标",category:"objects"},{character:"🕹️",name:"游戏摇杆",category:"objects"},{character:"📷",name:"相机",category:"objects"},{character:"📹",name:"摄像机",category:"objects"},{character:"🎥",name:"电影摄像机",category:"objects"},{character:"📺",name:"电视",category:"objects"},{character:"📻",name:"收音机",category:"objects"},{character:"🎙️",name:"录音麦克风",category:"objects"},{character:"🎚️",name:"音量滑块",category:"objects"},{character:"🎛️",name:"控制旋钮",category:"objects"},{character:"📞",name:"电话听筒",category:"objects"},{character:"📟",name:"寻呼机",category:"objects"},{character:"📠",name:"传真机",category:"objects"},{character:"🔦",name:"手电筒",category:"objects"},{character:"🕯️",name:"蜡烛",category:"objects"},{character:"💡",name:"灯泡",category:"objects"},{character:"🔌",name:"电源插头",category:"objects"},{character:"🔋",name:"电池",category:"objects"},{character:"🪫",name:"低电量",category:"objects"},{character:"💰",name:"钱袋",category:"objects"},{character:"💎",name:"宝石",category:"objects"},{character:"💳",name:"信用卡",category:"objects"},{character:"🧮",name:"算盘",category:"objects"},{character:"📿",name:"念珠",category:"objects"},{character:"🧷",name:"安全别针",category:"objects"},{character:"🔑",name:"钥匙",category:"objects"},{character:"🗝️",name:"老钥匙",category:"objects"},{character:"🛡️",name:"盾牌",category:"objects"},{character:"💊",name:"药丸",category:"objects"},{character:"🧴",name:"乳液瓶",category:"objects"},{character:"🧹",name:"扫帚",category:"objects"},{character:"🧺",name:"篮子",category:"objects"},{character:"🪣",name:"桶",category:"objects"},{character:"❤️",name:"红心",category:"symbols"},{character:"🧡",name:"橙心",category:"symbols"},{character:"💛",name:"黄心",category:"symbols"},{character:"💚",name:"绿心",category:"symbols"},{character:"💙",name:"蓝心",category:"symbols"},{character:"💜",name:"紫心",category:"symbols"},{character:"🖤",name:"黑心",category:"symbols"},{character:"💔",name:"破碎的心",category:"symbols"},{character:"❣️",name:"心叹号",category:"symbols"},{character:"💕",name:"两颗心",category:"symbols"},{character:"💞",name:"旋转的心",category:"symbols"},{character:"💓",name:"跳动的心",category:"symbols"},{character:"💗",name:"长大的心",category:"symbols"},{character:"💖",name:"闪亮的心",category:"symbols"},{character:"💘",name:"箭穿心",category:"symbols"},{character:"💝",name:"丝带心",category:"symbols"},{character:"💟",name:"心形装饰",category:"symbols"},{character:"☮️",name:"和平符号",category:"symbols"},{character:"✝️",name:"拉丁十字架",category:"symbols"},{character:"☪️",name:"星月",category:"symbols"},{character:"🕉️",name:"奥姆符号",category:"symbols"},{character:"✡️",name:"大卫之星",category:"symbols"},{character:"🔯",name:"六角星",category:"symbols"},{character:"🪬",name:"手掌法蒂玛",category:"symbols"},{character:"♈",name:"白羊座",category:"symbols"},{character:"♉",name:"金牛座",category:"symbols"},{character:"♊",name:"双子座",category:"symbols"},{character:"♋",name:"巨蟹座",category:"symbols"},{character:"♌",name:"狮子座",category:"symbols"},{character:"♍",name:"处女座",category:"symbols"},{character:"♎",name:"天秤座",category:"symbols"},{character:"♏",name:"天蝎座",category:"symbols"},{character:"♐",name:"射手座",category:"symbols"},{character:"♑",name:"摩羯座",category:"symbols"},{character:"♒",name:"水瓶座",category:"symbols"},{character:"♓",name:"双鱼座",category:"symbols"},{character:"⛎",name:"蛇夫座",category:"symbols"},{character:"🔀",name:"随机播放",category:"symbols"},{character:"🔁",name:"重复",category:"symbols"},{character:"🔂",name:"重复一次",category:"symbols"},{character:"🏁",name:"方格旗",category:"flags"},{character:"🚩",name:"三角旗",category:"flags"},{character:"🎌",name:"交叉旗",category:"flags"},{character:"🏴",name:"黑旗",category:"flags"},{character:"🏳️",name:"白旗",category:"flags"},{character:"🏳️🌈",name:"彩虹旗",category:"flags"},{character:"🏴☠️",name:"海盗旗",category:"flags"},{character:"🇺🇳",name:"联合国",category:"flags"},{character:"🇺🇸",name:"美国",category:"flags"},{character:"🇬🇧",name:"英国",category:"flags"},{character:"🇨🇳",name:"中国",category:"flags"},{character:"🇯🇵",name:"日本",category:"flags"},{character:"🇰🇷",name:"韩国",category:"flags"},{character:"🇩🇪",name:"德国",category:"flags"},{character:"🇫🇷",name:"法国",category:"flags"},{character:"🇮🇹",name:"意大利",category:"flags"},{character:"🇷🇺",name:"俄罗斯",category:"flags"},{character:"🇨🇦",name:"加拿大",category:"flags"},{character:"🇦🇺",name:"澳大利亚",category:"flags"},{character:"🇧🇷",name:"巴西",category:"flags"},{character:"🇮🇳",name:"印度",category:"flags"},{character:"🇪🇸",name:"西班牙",category:"flags"},{character:"🇲🇽",name:"墨西哥",category:"flags"},{character:"🇮🇩",name:"印度尼西亚",category:"flags"},{character:"🇳🇱",name:"荷兰",category:"flags"},{character:"🇨🇭",name:"瑞士",category:"flags"},{character:"🇸🇪",name:"瑞典",category:"flags"},{character:"🇳🇴",name:"挪威",category:"flags"},{character:"🇩🇰",name:"丹麦",category:"flags"},{character:"🇫🇮",name:"芬兰",category:"flags"},{character:"🇵🇱",name:"波兰",category:"flags"},{character:"🇹🇷",name:"土耳其",category:"flags"},{character:"🇸🇦",name:"沙特阿拉伯",category:"flags"},{character:"🇿🇦",name:"南非",category:"flags"},{character:"🇪🇬",name:"埃及",category:"flags"},{character:"🇳🇬",name:"尼日利亚",category:"flags"},{character:"🇦🇷",name:"阿根廷",category:"flags"},{character:"🇨🇱",name:"智利",category:"flags"},{character:"🇵🇪",name:"秘鲁",category:"flags"},{character:"🇻🇪",name:"委内瑞拉",category:"flags"}],vo=M=>({cursorStyles:[{id:"default",name:M.leftPanel.cursorArrow,description:M.leftPanel.cursorArrowDesc,icon:kr},{id:"crosshair",name:M.leftPanel.cursorCrosshair,description:M.leftPanel.cursorCrosshairDesc,icon:fr},{id:"circle",name:M.leftPanel.cursorCircle,description:M.leftPanel.cursorCircleDesc,icon:Mr},{id:"dot",name:M.leftPanel.cursorDot,description:M.leftPanel.cursorDotDesc,icon:mr},{id:"sparkle",name:M.leftPanel.cursorSparkle,description:M.leftPanel.cursorSparkleDesc,icon:Pr},{id:"emoji",name:M.leftPanel.cursorEmoji,description:M.leftPanel.cursorEmojiDesc,icon:_r}],penTools:[{title:M.leftPanel.penTools,tools:[{id:"pencil",name:M.leftPanel.pencil,description:M.leftPanel.pencilDesc,icon:Si},{id:"pen",name:M.leftPanel.pen,description:M.leftPanel.penDesc,icon:Os},{id:"brush",name:M.leftPanel.brush,description:M.leftPanel.brushDesc,icon:bi},{id:"marker-pen",name:M.leftPanel.markerPen,description:M.leftPanel.markerPenDesc,icon:Is},{id:"eraser",name:M.leftPanel.eraser,description:M.leftPanel.eraserDesc,icon:js}]}],drawingTools:[{title:M.leftPanel.lineTools,tools:[{id:"line-segment",name:M.leftPanel.lineSegment,description:M.leftPanel.lineSegmentDesc,icon:Qr},{id:"horizontal-line",name:M.leftPanel.horizontalLine,description:M.leftPanel.horizontalLineDesc,icon:ts},{id:"vertical-line",name:M.leftPanel.verticalLine,description:M.leftPanel.verticalLineDesc,icon:es}]},{title:M.leftPanel.arrowTools,tools:[{id:"arrow-line",name:M.leftPanel.arrowLine,description:M.leftPanel.arrowLineDesc,icon:is},{id:"thick-arrow-line",name:M.leftPanel.thickArrowLine,description:M.leftPanel.thickArrowLineDesc,icon:rs}]},{title:M.leftPanel.channelTools,tools:[{id:"parallel-channel",name:M.leftPanel.parallelChannel,description:M.leftPanel.parallelChannelDesc,icon:ss},{id:"linear-regression-channel",name:M.leftPanel.linearRegressionChannel,description:M.leftPanel.linearRegressionChannelDesc,icon:as},{id:"equidistant-channel",name:M.leftPanel.equidistantChannel,description:M.leftPanel.equidistantChannelDesc,icon:ns},{id:"disjoint-channel",name:M.leftPanel.disjointChannel,description:M.leftPanel.disjointChannelDesc,icon:os}]},{title:M.leftPanel.pitchforkTools,tools:[{id:"andrew-pitchfork",name:M.leftPanel.andrewPitchfork,description:M.leftPanel.andrewPitchforkDesc,icon:hs},{id:"enhanced-andrew-pitch-fork",name:M.leftPanel.enhancedAndrewPitchfork,description:M.leftPanel.enhancedAndrewPitchforkDesc,icon:ls},{id:"schiff-pitch-fork",name:M.leftPanel.schiffPitchfork,description:M.leftPanel.schiffPitchforkDesc,icon:cs}]}],gannAndFibonacciTools:[{title:M.leftPanel.gannTools,tools:[{id:"gann-fan",name:M.leftPanel.gannFan,description:M.leftPanel.gannFanDesc,icon:lr},{id:"gann-box",name:M.leftPanel.gannBox,description:M.leftPanel.gannBoxDesc,icon:cr},{id:"gann-rectang",name:M.leftPanel.gannRectangle,description:M.leftPanel.gannRectangleDesc,icon:vr}]},{title:M.leftPanel.fibonacciTools,tools:[{id:"fibonacci-time-zoon",name:M.leftPanel.fibonacciTimeZones,description:M.leftPanel.fibonacciTimeZonesDesc,icon:Sr},{id:"fibonacci-retracement",name:M.leftPanel.fibonacciRetracement,description:M.leftPanel.fibonacciRetracementDesc,icon:_i},{id:"fibonacci-arc",name:M.leftPanel.fibonacciArc,description:M.leftPanel.fibonacciArcDesc,icon:br},{id:"fibonacci-circle",name:M.leftPanel.fibonacciCircle,description:M.leftPanel.fibonacciCircleDesc,icon:xr},{id:"fibonacci-spiral",name:M.leftPanel.fibonacciSpiral,description:M.leftPanel.fibonacciSpiralDesc,icon:Cr},{id:"fibonacci-wedge",name:M.leftPanel.fibonacciWedge,description:M.leftPanel.fibonacciWedgeDesc,icon:Tr},{id:"fibonacci-fan",name:M.leftPanel.fibonacciFan,description:M.leftPanel.fibonacciFanDesc,icon:Dr},{id:"fibonacci-channel",name:M.leftPanel.fibonacciChannel,description:M.leftPanel.fibonacciChannelDesc,icon:wr},{id:"fibonacci-extension-base-price",name:M.leftPanel.fibonacciExtensionPrice,description:M.leftPanel.fibonacciExtensionPriceDesc,icon:Fs},{id:"fibonacci-extension-base-time",name:M.leftPanel.fibonacciExtensionTime,description:M.leftPanel.fibonacciExtensionTimeDesc,icon:ys}]}],irregularShapeTools:[{title:M.leftPanel.technicalPatterns,tools:[{id:"xabcd",name:M.leftPanel.xabcdPattern,description:M.leftPanel.xabcdPatternDesc,icon:Er},{id:"head-and-shoulders",name:M.leftPanel.headAndShoulders,description:M.leftPanel.headAndShouldersDesc,icon:yr},{id:"abcd",name:M.leftPanel.abcdPattern,description:M.leftPanel.abcdPatternDesc,icon:Fr},{id:"triangle-abcd",name:M.leftPanel.triangleAbcd,description:M.leftPanel.triangleAbcdDesc,icon:Rr}]},{title:M.leftPanel.elliottWave,tools:[{id:"elliott-lmpulse",name:M.leftPanel.elliottImpulse,description:M.leftPanel.elliottImpulseDesc,icon:Br},{id:"elliott-corrective",name:M.leftPanel.elliottCorrective,description:M.leftPanel.elliottCorrectiveDesc,icon:Ar},{id:"elliott-triangle",name:M.leftPanel.elliottTriangle,description:M.leftPanel.elliottTriangleDesc,icon:Lr},{id:"elliott-double-combo",name:M.leftPanel.elliottDoubleCombo,description:M.leftPanel.elliottDoubleComboDesc,icon:Hr},{id:"elliott-triple-combo",name:M.leftPanel.elliottTripleCombo,description:M.leftPanel.elliottTripleComboDesc,icon:Or}]},{title:M.leftPanel.regularShapes,tools:[{id:"rectangle",name:M.leftPanel.rectangle,description:M.leftPanel.rectangleDesc,icon:sr},{id:"circle",name:M.leftPanel.circle,description:M.leftPanel.circleDesc,icon:nr},{id:"ellipse",name:M.leftPanel.ellipse,description:M.leftPanel.ellipseDesc,icon:dr},{id:"triangle",name:M.leftPanel.triangle,description:M.leftPanel.triangleDesc,icon:or},{id:"sector",name:M.leftPanel.sector,description:M.leftPanel.sectorDesc,icon:Rs},{id:"curve",name:M.leftPanel.curve,description:M.leftPanel.curveDesc,icon:Ir},{id:"double-curve",name:M.leftPanel.doubleCurve,description:M.leftPanel.doubleCurveDesc,icon:jr}]}],projectInfoTools:[{title:M.leftPanel.rangeTools,tools:[{id:"time-range",name:M.leftPanel.timeRange,description:M.leftPanel.timeRangeDesc,icon:Wr},{id:"price-range",name:M.leftPanel.priceRange,description:M.leftPanel.priceRangeDesc,icon:Nr},{id:"time-price-range",name:M.leftPanel.timePriceRange,description:M.leftPanel.timePriceRangeDesc,icon:Ur},{id:"heat-map",name:M.leftPanel.heatMap,description:M.leftPanel.heatMap,icon:ds}]},{title:M.leftPanel.positionTools,tools:[{id:"long-position",name:M.leftPanel.longPosition,description:M.leftPanel.longPositionDesc,icon:Yr},{id:"short-position",name:M.leftPanel.shortPosition,description:M.leftPanel.shortPositionDesc,icon:Xr}]},{title:M.leftPanel.simulationTools,tools:[{id:"mock-kline",name:M.leftPanel.mockKline,description:M.leftPanel.mockKlineDesc,icon:qr}]}],textTools:[{title:M.leftPanel.textTools,tools:[{id:"text",name:M.leftPanel.text,description:M.leftPanel.textDesc,icon:ue},{id:"price-note",name:M.leftPanel.priceNote,description:M.leftPanel.priceNoteDesc,icon:Vr},{id:"bubble-box",name:M.leftPanel.bubbleBox,description:M.leftPanel.bubbleBoxDesc,icon:zr},{id:"pin",name:M.leftPanel.pin,description:M.leftPanel.pinDesc,icon:Gr},{id:"signpost",name:M.leftPanel.signpost,description:M.leftPanel.signpostDesc,icon:$r},{id:"price-label",name:M.leftPanel.priceLabel,description:M.leftPanel.priceLabelDesc,icon:Kr},{id:"flag-mark",name:M.leftPanel.flagMark,description:M.leftPanel.flagMarkDesc,icon:Zr}]},{title:M.leftPanel.contentTools,tools:[{id:"image",name:M.leftPanel.image,description:M.leftPanel.imageDesc,icon:Jr}]}]});class gi{constructor(){this.handleDrawingToolSelect=(t,e)=>{t.setState({isDrawingModalOpen:!t.state.isDrawingModalOpen,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isIrregularShapeModalOpen:!1,isProjectInfoModalOpen:!1}),!t.state.isMarkLocked&&(e==="line-segment"?t.props.drawingLayerRef&&t.props.drawingLayerRef.current&&t.props.drawingLayerRef.current.setLineSegmentMarkMode&&t.props.drawingLayerRef.current.setLineSegmentMarkMode():e==="arrow-line"?t.props.drawingLayerRef&&t.props.drawingLayerRef.current&&t.props.drawingLayerRef.current.setArrowLineMarkMode&&t.props.drawingLayerRef.current.setArrowLineMarkMode():e==="thick-arrow-line"?t.props.drawingLayerRef&&t.props.drawingLayerRef.current&&t.props.drawingLayerRef.current.setThickArrowLineMode&&t.props.drawingLayerRef.current.setThickArrowLineMode():e==="horizontal-line"?t.props.drawingLayerRef?.current?.setHorizontalLineMode&&t.props.drawingLayerRef.current.setHorizontalLineMode():e==="vertical-line"?t.props.drawingLayerRef?.current?.setVerticalLineMode&&t.props.drawingLayerRef.current.setVerticalLineMode():e==="parallel-channel"?t.props.drawingLayerRef?.current?.setParallelChannelMarkMode&&t.props.drawingLayerRef.current.setParallelChannelMarkMode():e==="linear-regression-channel"?t.props.drawingLayerRef?.current?.setLinearRegressionChannelMode&&t.props.drawingLayerRef.current.setLinearRegressionChannelMode():e==="equidistant-channel"?t.props.drawingLayerRef?.current?.setEquidistantChannelMarkMode&&t.props.drawingLayerRef.current.setEquidistantChannelMarkMode():e==="disjoint-channel"?t.props.drawingLayerRef?.current?.setDisjointChannelMarkMode&&t.props.drawingLayerRef.current.setDisjointChannelMarkMode():e==="pitch-fork"?t.props.drawingLayerRef?.current?.setPitchforkMode&&t.props.drawingLayerRef.current.setPitchforkMode():e==="andrew-pitchfork"?t.props.drawingLayerRef?.current?.setAndrewPitchforkMode&&t.props.drawingLayerRef.current.setAndrewPitchforkMode():e==="enhanced-andrew-pitch-fork"?t.props.drawingLayerRef?.current?.setEnhancedAndrewPitchforkMode&&t.props.drawingLayerRef.current.setEnhancedAndrewPitchforkMode():e==="rectangle"?t.props.drawingLayerRef?.current?.setRectangleMarkMode&&t.props.drawingLayerRef.current.setRectangleMarkMode():e==="circle"?t.props.drawingLayerRef?.current?.setCircleMarkMode&&t.props.drawingLayerRef.current.setCircleMarkMode():e==="ellipse"?t.props.drawingLayerRef?.current?.setEllipseMarkMode&&t.props.drawingLayerRef.current.setEllipseMarkMode():e==="triangle"?t.props.drawingLayerRef?.current?.setTriangleMarkMode&&t.props.drawingLayerRef.current.setTriangleMarkMode():e==="gann-fan"?t.props.drawingLayerRef?.current?.setGannFanMode&&t.props.drawingLayerRef.current.setGannFanMode():e==="gann-box"?t.props.drawingLayerRef?.current?.setGannBoxMode&&t.props.drawingLayerRef.current.setGannBoxMode():e==="gann-rectang"?t.props.drawingLayerRef?.current?.setGannRectangleMode&&t.props.drawingLayerRef.current.setGannRectangleMode():e==="fibonacci-time-zoon"?t.props.drawingLayerRef?.current?.setFibonacciTimeZoonMode&&t.props.drawingLayerRef.current.setFibonacciTimeZoonMode():e==="fibonacci-retracement"?t.props.drawingLayerRef?.current?.setFibonacciRetracementMode&&t.props.drawingLayerRef.current.setFibonacciRetracementMode():e==="fibonacci-arc"?t.props.drawingLayerRef?.current?.setFibonacciArcMode&&t.props.drawingLayerRef.current.setFibonacciArcMode():e==="fibonacci-circle"?t.props.drawingLayerRef?.current?.setFibonacciCircleMode&&t.props.drawingLayerRef.current.setFibonacciCircleMode():e==="fibonacci-spiral"?t.props.drawingLayerRef?.current?.setFibonacciSpiralMode&&t.props.drawingLayerRef.current.setFibonacciSpiralMode():e==="fibonacci-wedge"?t.props.drawingLayerRef?.current?.setFibonacciWedgeMode&&t.props.drawingLayerRef.current.setFibonacciWedgeMode():e==="fibonacci-fan"?t.props.drawingLayerRef?.current?.setFibonacciFanMode&&t.props.drawingLayerRef.current.setFibonacciFanMode():e==="fibonacci-channel"?t.props.drawingLayerRef?.current?.setFibonacciChannelMode&&t.props.drawingLayerRef.current.setFibonacciChannelMode():e==="fibonacci-extension-base-price"?t.props.drawingLayerRef?.current?.setFibonacciExtensionBasePriceMode&&t.props.drawingLayerRef.current.setFibonacciExtensionBasePriceMode():e==="fibonacci-extension-base-time"?t.props.drawingLayerRef?.current?.setFibonacciExtensionBaseTimeMode&&t.props.drawingLayerRef.current.setFibonacciExtensionBaseTimeMode():e==="sector"?t.props.drawingLayerRef?.current?.setSectorMode&&t.props.drawingLayerRef.current.setSectorMode():e==="curve"?t.props.drawingLayerRef?.current?.setCurveMode&&t.props.drawingLayerRef.current.setCurveMode():e==="double-curve"?t.props.drawingLayerRef?.current?.setDoubleCurveMode&&t.props.drawingLayerRef.current.setDoubleCurveMode():e==="xabcd"?t.props.drawingLayerRef?.current?.setXABCDMode&&t.props.drawingLayerRef.current.setXABCDMode():e==="head-and-shoulders"?t.props.drawingLayerRef?.current?.setHeadAndShouldersMode&&t.props.drawingLayerRef.current.setHeadAndShouldersMode():e==="abcd"?t.props.drawingLayerRef?.current?.setABCDMode&&t.props.drawingLayerRef.current.setABCDMode():e==="triangle-abcd"?t.props.drawingLayerRef?.current?.setTriangleABCDMode&&t.props.drawingLayerRef.current.setTriangleABCDMode():e==="elliott-lmpulse"?t.props.drawingLayerRef?.current?.setElliottImpulseMode&&t.props.drawingLayerRef.current.setElliottImpulseMode():e==="elliott-corrective"?t.props.drawingLayerRef?.current?.setElliottCorrectiveMode&&t.props.drawingLayerRef.current.setElliottCorrectiveMode():e==="elliott-triangle"?t.props.drawingLayerRef?.current?.setElliottTriangleMode&&t.props.drawingLayerRef.current.setElliottTriangleMode():e==="elliott-double-combo"?t.props.drawingLayerRef?.current?.setElliottDoubleCombinationMode&&t.props.drawingLayerRef.current.setElliottDoubleCombinationMode():e==="elliott-triple-combo"?t.props.drawingLayerRef?.current?.setElliottTripleCombinationMode&&t.props.drawingLayerRef.current.setElliottTripleCombinationMode():e==="time-range"?t.props.drawingLayerRef?.current?.setTimeRangeMarkMode&&t.props.drawingLayerRef.current.setTimeRangeMarkMode():e==="price-range"?t.props.drawingLayerRef?.current?.setPriceRangeMarkMode&&t.props.drawingLayerRef.current.setPriceRangeMarkMode():e==="time-price-range"?t.props.drawingLayerRef?.current?.setTimePriceRangeMarkMode&&t.props.drawingLayerRef.current.setTimePriceRangeMarkMode():e==="text"?t.props.drawingLayerRef?.current?.setTextEditMarkMode&&t.props.drawingLayerRef.current.setTextEditMarkMode():e==="pencil"?t.props.drawingLayerRef?.current?.setPencilMode&&t.props.drawingLayerRef.current.setPencilMode():e==="pen"?t.props.drawingLayerRef?.current?.setPenMode&&t.props.drawingLayerRef.current.setPenMode():e==="brush"?t.props.drawingLayerRef?.current?.setBrushMode&&t.props.drawingLayerRef.current.setBrushMode():e==="marker-pen"?t.props.drawingLayerRef?.current?.setMarkerPenMode&&t.props.drawingLayerRef.current.setMarkerPenMode():e==="eraser"?t.props.drawingLayerRef?.current?.setEraserMode&&t.props.drawingLayerRef.current.setEraserMode():e==="image"?t.props.drawingLayerRef?.current?.setImageMarkMode&&t.props.drawingLayerRef.current.setImageMarkMode():e==="table"?t.props.drawingLayerRef?.current?.setTableMarkMode&&t.props.drawingLayerRef.current.setTableMarkMode():e==="long-position"?t.props.drawingLayerRef?.current?.setLongPositionMarkMode&&t.props.drawingLayerRef.current.setLongPositionMarkMode():e==="short-position"?t.props.drawingLayerRef?.current?.setShortPositionMarkMode&&t.props.drawingLayerRef.current.setShortPositionMarkMode():e==="price-label"?t.props.drawingLayerRef?.current?.setPriceLabelMode&&t.props.drawingLayerRef.current.setPriceLabelMode():e==="flag-mark"?t.props.drawingLayerRef?.current?.setFlagMarkMode&&t.props.drawingLayerRef.current.setFlagMarkMode():e==="price-note"?t.props.drawingLayerRef?.current?.setPriceNoteMarkMode&&t.props.drawingLayerRef.current.setPriceNoteMarkMode():e==="signpost"?t.props.drawingLayerRef?.current?.setSignpostMarkMode&&t.props.drawingLayerRef.current.setSignpostMarkMode():e==="pin"?t.props.drawingLayerRef?.current?.setPinMarkMode&&t.props.drawingLayerRef.current.setPinMarkMode():e==="bubble-box"?t.props.drawingLayerRef?.current?.setBubbleBoxMarkMode&&t.props.drawingLayerRef.current.setBubbleBoxMarkMode():e==="emoji"?t.props.drawingLayerRef?.current?.selectedEmoji&&t.props.drawingLayerRef.current.selectedEmoji():e==="mock-kline"?t.props.drawingLayerRef?.current?.setMockKLineMarkMode&&t.props.drawingLayerRef.current.setMockKLineMarkMode():e==="heat-map"?t.props.drawingLayerRef?.current?.setHeatMapMode&&t.props.drawingLayerRef.current.setHeatMapMode():e==="schiff-pitch-fork"&&t.props.drawingLayerRef?.current?.setSchiffPitchforkMode&&t.props.drawingLayerRef.current.setSchiffPitchforkMode(),t.props.onToolSelect(e),t.setState({isDrawingModalOpen:!1}))}}}class xo extends O.Component{constructor(t){super(t),this.drawingModalRef=O.createRef(),this.emojiPickerRef=O.createRef(),this.cursorModalRef=O.createRef(),this.brushModalRef=O.createRef(),this.rulerModalRef=O.createRef(),this.fibonacciModalRef=O.createRef(),this.gannModalRef=O.createRef(),this.projectInfoModalRef=O.createRef(),this.irregularShapeModalRef=O.createRef(),this.toolManager=new gi,this.functionPopUpWidth="200px",this.emojiSelectPopUpWidth="315px",this.handleToolAction=(e,i)=>{const{lastSelectedTools:r}=this.state,n={isDrawingModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,arrowButtonStates:{}};switch(e){case"toggle-drawing":n.isDrawingModalOpen=!this.state.isDrawingModalOpen,n.arrowButtonStates={drawing:!this.state.isDrawingModalOpen};break;case"toggle-emoji":n.isEmojiSelectPopUpOpen=!this.state.isEmojiSelectPopUpOpen,n.arrowButtonStates={emoji:!this.state.isEmojiSelectPopUpOpen};break;case"toggle-brush":n.isBrushModalOpen=!this.state.isBrushModalOpen,n.arrowButtonStates={brush:!this.state.isBrushModalOpen};break;case"toggle-cursor":n.isCursorModalOpen=!this.state.isCursorModalOpen,n.arrowButtonStates={cursor:!this.state.isCursorModalOpen};break;case"toggle-text":n.isTextToolModalOpen=!this.state.isTextToolModalOpen,n.arrowButtonStates={text:!this.state.isTextToolModalOpen};break;case"toggle-fibonacci":n.isFibonacciModalOpen=!this.state.isFibonacciModalOpen,n.arrowButtonStates={fibonacci:!this.state.isFibonacciModalOpen};break;case"toggle-project-info":n.isProjectInfoModalOpen=!this.state.isProjectInfoModalOpen,n.arrowButtonStates={"project-info":!this.state.isProjectInfoModalOpen};break;case"toggle-irregular-shape":n.isIrregularShapeModalOpen=!this.state.isIrregularShapeModalOpen,n.arrowButtonStates={"irregular-shape":!this.state.isIrregularShapeModalOpen};break;case"select-drawing":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,drawing:i}})),this.toolManager?.handleDrawingToolSelect(this,i),this.props.onToolSelect(i));break;case"select-cursor":i&&(this.setState(s=>({selectedCursor:i,lastSelectedTools:{...s.lastSelectedTools,cursor:i}})),this.handleCursorStyleSelect(i));break;case"select-brush":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,brush:i}})),this.toolManager?.handleDrawingToolSelect(this,i),this.props.onToolSelect(i));break;case"select-text":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,textTool:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-fibonacci":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,fibonacci:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-project-info":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,projectInfo:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-irregular-shape":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,irregularShape:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"activate-tool":if(i){const s=i,a=r[s];this.handleDirectToolActivation(s,a)}break;case"open-system-settings":this.setState({isSystemSettingsModalOpen:!0});break}Object.keys(n).length>0&&this.setState(n)},this.handleDirectToolActivation=(e,i)=>{switch(this.setState({isDrawingModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,arrowButtonStates:{}}),e){case"drawing":this.handleToolAction("select-drawing",i);break;case"brush":this.handleToolAction("select-brush",i);break;case"cursor":this.handleToolAction("select-cursor",i);break;case"fibonacci":this.handleToolAction("select-fibonacci",i);break;case"projectInfo":this.handleToolAction("select-project-info",i);break;case"irregularShape":this.handleToolAction("select-irregular-shape",i);break;case"textTool":this.handleToolAction("select-text",i);break}},this.handleClickOutside=e=>{const i=e.target;if(i.closest(".arrow-button"))return;const n={arrowButtonStates:{}};this.state.isEmojiSelectPopUpOpen&&this.emojiPickerRef.current&&!this.emojiPickerRef.current.contains(i)&&!i.closest(".emoji-button")&&(n.isEmojiSelectPopUpOpen=!1,n.arrowButtonStates.emoji=!1),this.state.isTextToolModalOpen&&this.rulerModalRef.current&&!this.rulerModalRef.current.contains(i)&&!i.closest(".ruler-button")&&(n.isTextToolModalOpen=!1,n.arrowButtonStates.text=!1),this.state.isRulerModalOpen&&this.rulerModalRef.current&&!this.rulerModalRef.current.contains(i)&&!i.closest(".ruler-button")&&(n.isRulerModalOpen=!1,n.arrowButtonStates.ruler=!1),this.state.isDrawingModalOpen&&this.drawingModalRef.current&&!this.drawingModalRef.current.contains(i)&&!i.closest(".drawing-button")&&(n.isDrawingModalOpen=!1,n.arrowButtonStates.drawing=!1),this.state.isEmojiSelectPopUpOpen&&this.emojiPickerRef.current&&!this.emojiPickerRef.current.contains(i)&&!i.closest(".emoji-button")&&(n.isEmojiSelectPopUpOpen=!1),this.state.isBrushModalOpen&&this.brushModalRef.current&&!this.brushModalRef.current.contains(i)&&!i.closest(".brush-button")&&(n.isBrushModalOpen=!1,n.arrowButtonStates.brush=!1),this.state.isCursorModalOpen&&this.cursorModalRef.current&&!this.cursorModalRef.current.contains(i)&&!i.closest(".cursor-button")&&(n.isCursorModalOpen=!1,n.arrowButtonStates.cursor=!1),this.state.isFibonacciModalOpen&&this.fibonacciModalRef.current&&!this.fibonacciModalRef.current.contains(i)&&!i.closest(".fibonacci-button")&&(n.isFibonacciModalOpen=!1,n.arrowButtonStates.fibonacci=!1),this.state.isGannModalOpen&&this.gannModalRef.current&&!this.gannModalRef.current.contains(i)&&!i.closest(".gann-button")&&(n.isGannModalOpen=!1,n.arrowButtonStates.gann=!1),this.state.isProjectInfoModalOpen&&this.projectInfoModalRef.current&&!this.projectInfoModalRef.current.contains(i)&&!i.closest(".project-info-button")&&(n.isProjectInfoModalOpen=!1,n.arrowButtonStates["project-info"]=!1),this.state.isIrregularShapeModalOpen&&this.irregularShapeModalRef.current&&!this.irregularShapeModalRef.current.contains(i)&&!i.closest(".irregular-shape-button")&&(n.isIrregularShapeModalOpen=!1,n.arrowButtonStates["irregular-shape"]=!1),Object.keys(n).length>1&&this.setState(n)},this.handleCursorStyleSelect=e=>{switch(e){case"default":this.props.drawingLayerRef?.current.setCursorType(st.Default);break;case"crosshair":this.props.drawingLayerRef?.current.setCursorType(st.Crosshair);break;case"circle":this.props.drawingLayerRef?.current.setCursorType(st.Circle);break;case"dot":this.props.drawingLayerRef?.current.setCursorType(st.Dot);break;case"sparkle":this.props.drawingLayerRef?.current.setCursorType(st.Crosshair);break;case"emoji":this.props.drawingLayerRef?.current.setCursorType(st.Crosshair);break}},this.handleEmojiSelect=e=>{this.setState({isEmojiSelectPopUpOpen:!1}),!this.state.isMarkLocked&&(this.setState({selectedEmoji:e}),this.props.onEmojiSelect&&this.props.onEmojiSelect(e),this.props.drawingLayerRef&&this.props.drawingLayerRef.current&&this.props.drawingLayerRef.current.setEmojiMarkMode&&this.props.drawingLayerRef.current.setEmojiMarkMode(e),this.props.onToolSelect("emoji"))},this.handleCategorySelect=e=>{this.setState({selectedEmojiCategory:e})},this.renderCursorModal=()=>{const{currentTheme:e,activeTool:i,i18n:r}=this.props,{isCursorModalOpen:n}=this.state,{cursorStyles:s}=this.getToolConfig();return n?m.jsx("div",{ref:this.cursorModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:m.jsx(ft,{title:r.leftPanel.mouseCursor,tools:s,currentTheme:e,activeTool:i,onToolSelect:a=>this.handleToolAction("select-cursor",a),defaultOpen:!0})})}):null},this.renderCursorTools=()=>{const{cursorStyles:e}=this.getToolConfig(),i=e[0],r={id:"cursor",icon:i?.icon||pr,className:"cursor-button",onMainClick:()=>this.handleToolAction("activate-tool","cursor"),onArrowClick:()=>this.handleToolAction("toggle-cursor")};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:this.renderToolButton(r,r.onMainClick,r.onArrowClick,!0,i?.icon)})},this.renderBrushModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isBrushModalOpen:r}=this.state,{penTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.brushModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-brush",o),defaultOpen:!0},s.title))})}):null},this.renderTextToolModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isTextToolModalOpen:r}=this.state,{textTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.rulerModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-text",o),defaultOpen:!0},s.title))})}):null},this.renderEmojiSelectPopUp=()=>{const{currentTheme:e}=this.props,{isEmojiSelectPopUpOpen:i,selectedEmojiCategory:r}=this.state,n=Co(this.props.i18n),s=wo.filter(a=>a.category===r);return i?m.jsxs("div",{ref:this.emojiPickerRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:`${this.emojiSelectPopUpWidth}`,maxHeight:"400px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column",paddingBottom:"0px"},className:"modal-scrollbar",children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0},children:[m.jsx("h3",{style:{margin:0,color:e.layout.textColor,fontSize:"14px",fontWeight:"600"},children:this.props.i18n.leftPanel.selectEmoji}),m.jsx("button",{onClick:()=>this.setState({isEmojiSelectPopUpOpen:!1}),style:{background:"transparent",border:"none",color:e.layout.textColor,cursor:"pointer",fontSize:"16px",padding:"2px 8px",borderRadius:"4px",transition:"background-color 0.2s"},onMouseEnter:a=>{a.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:"×"})]}),m.jsx("div",{style:{display:"flex",flexWrap:"wrap",padding:"8px 12px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,gap:"4px",overflowY:"auto"},className:"custom-scrollbar",children:n.map(a=>m.jsx("button",{onClick:()=>this.handleCategorySelect(a.id),style:{background:r===a.id?e.toolbar.button.active:"transparent",border:`1px solid ${r===a.id?e.toolbar.button.active:e.toolbar.border}`,borderRadius:"6px",padding:"6px 10px",fontSize:"11px",cursor:"pointer",color:e.layout.textColor,whiteSpace:"nowrap",transition:"all 0.2s ease",flexShrink:0,height:"28px"},onMouseEnter:o=>{r!==a.id&&(o.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:o=>{r!==a.id&&(o.currentTarget.style.background="transparent")},children:a.getName?a.getName(this.props.i18n):a.name},a.id))}),m.jsx("div",{style:{flex:1,overflowY:"auto",padding:"12px",maxHeight:"250px"},className:"custom-scrollbar",children:m.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"8px",justifyItems:"center"},children:s.map((a,o)=>m.jsx("button",{onClick:()=>this.handleEmojiSelect(a.character),style:{background:"transparent",border:"1px solid transparent",borderRadius:"6px",padding:"8px",fontSize:"22px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"40px",minWidth:"40px",width:"100%"},onMouseEnter:h=>{h.currentTarget.style.background=e.toolbar.button.hover,h.currentTarget.style.borderColor=e.toolbar.border,h.currentTarget.style.transform="scale(1.1)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent",h.currentTarget.style.borderColor="transparent",h.currentTarget.style.transform="scale(1)"},title:a.getName?a.getName(this.props.i18n):a.name,children:a.character},o))})})]}):null},this.renderDrawingModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isDrawingModalOpen:r}=this.state,{drawingTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.drawingModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-drawing",o),defaultOpen:!0},s.title))})}):null},this.renderToolButton=(e,i,r,n=!1,s)=>{const{currentTheme:a}=this.props,o=s||e.icon,h=this.state.arrowButtonStates[e.id]||!1,l=this.state.toolHoverStates[e.id]||!1;return m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",width:"100%",background:"transparent",transition:"all 0.2s ease"},className:"tool-button-container",onMouseEnter:()=>this.setState(g=>({toolHoverStates:{...g.toolHoverStates,[e.id]:!0}})),onMouseLeave:()=>this.setState(g=>({toolHoverStates:{...g.toolHoverStates,[e.id]:!1}})),children:[m.jsx("button",{title:e.title,onClick:i,className:e.className||"",style:{background:"transparent",border:"none",borderRadius:"0px",padding:"0px",cursor:"pointer",color:a.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"35px",width:n?"35px":"100%",flex:"none"},onMouseEnter:g=>{g.currentTarget.style.background=a.toolbar.button.hover},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:m.jsx(o,{size:23,color:a.toolbar.button.color})},e.id),n&&l&&m.jsx("button",{onClick:g=>{g.stopPropagation(),r()},className:"arrow-button",style:{background:"transparent",border:"none",borderRadius:"0px",cursor:"pointer",color:a.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"35px",width:"13px",flex:"none",fontSize:"12px",fontWeight:"bold",position:"absolute",paddingLeft:"8px",marginLeft:"30px"},onMouseEnter:g=>{g.currentTarget.style.background=a.toolbar.button.hover},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},onMouseDown:g=>{g.currentTarget.style.background=a.toolbar.button.active},onMouseUp:g=>{g.currentTarget.style.background=a.toolbar.button.hover},children:m.jsx("span",{style:{fontSize:"18px"},children:h?"‹":"›"})})]})},this.renderLineTools=()=>{const{drawingTools:e}=this.getToolConfig(),{lastSelectedTools:i}=this.state,r=this.findToolInGroups(e,i.drawing),n={id:"drawing",icon:r?.icon||hr,className:"drawing-button",onMainClick:()=>this.handleToolAction("activate-tool","drawing"),onArrowClick:()=>this.handleToolAction("toggle-drawing")};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px",width:"100%"},children:this.renderToolButton(n,n.onMainClick,n.onArrowClick,!0,r?.icon)})},this.renderFibonacciModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isFibonacciModalOpen:r}=this.state,{gannAndFibonacciTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.fibonacciModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-fibonacci",o),defaultOpen:!0},s.title))})}):null},this.renderProjectInfoModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isProjectInfoModalOpen:r}=this.state,{projectInfoTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.projectInfoModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-project-info",o),defaultOpen:!0},s.title))})}):null},this.renderIrregularShapeModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isIrregularShapeModalOpen:r}=this.state,{irregularShapeTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.irregularShapeModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-irregular-shape",o),defaultOpen:!0},s.title))})}):null},this.renderTecGraphTools=()=>{const{lastSelectedTools:e}=this.state,{irregularShapeTools:i,gannAndFibonacciTools:r,projectInfoTools:n}=this.getToolConfig(),s=this.findToolInGroups(r,e.fibonacci),a=this.findToolInGroups(n,e.projectInfo),o=this.findToolInGroups(i,e.irregularShape),h=[{id:"fibonacci",icon:s?.icon||_i,className:"fibonacci-button",onMainClick:()=>this.handleToolAction("activate-tool","fibonacci"),onArrowClick:()=>this.handleToolAction("toggle-fibonacci")},{id:"project-info",icon:a?.icon||ur,className:"project-info-button",onMainClick:()=>this.handleToolAction("activate-tool","projectInfo"),onArrowClick:()=>this.handleToolAction("toggle-project-info")},{id:"irregular-shape",icon:o?.icon||Si,className:"irregular-shape-button",onMainClick:()=>this.handleToolAction("activate-tool","irregularShape"),onArrowClick:()=>this.handleToolAction("toggle-irregular-shape")}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:h.map(l=>this.renderToolButton(l,l.onMainClick,l.onArrowClick,!0,l.id==="fibonacci"?s?.icon:l.id==="project-info"?a?.icon:o?.icon))})},this.renderTrash=()=>{const{lastSelectedTools:e}=this.state,{penTools:i,textTools:r}=this.getToolConfig(),n=this.findToolInGroups(i,e.brush),s=this.findToolInGroups(r,e.textTool),a=[{id:"clear-all-mark",icon:gr,className:"trash-button",hasArrow:!1,onMainClick:()=>{this.props.drawingLayerRef?.current?.clearAllMark&&this.props.drawingLayerRef.current.clearAllMark()},onArrowClick:()=>{}}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:a.map(o=>this.renderToolButton(o,o.onMainClick,o.onArrowClick,o.hasArrow,o.id==="brush"?n?.icon:o.id==="text"?s?.icon:void 0))})},this.renderMarkTools=()=>{const{lastSelectedTools:e}=this.state,{penTools:i,textTools:r}=this.getToolConfig(),n=this.findToolInGroups(i,e.brush),s=this.findToolInGroups(r,e.textTool),a=[{id:"brush",icon:n?.icon||bi,className:"brush-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","brush"),onArrowClick:()=>this.handleToolAction("toggle-brush")},{id:"text",icon:s?.icon||ue,className:"text-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","textTool"),onArrowClick:()=>this.handleToolAction("toggle-text")},{id:"emoji",icon:ar,className:"emoji-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","emoji"),onArrowClick:()=>this.handleToolAction("toggle-emoji")}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:a.map(o=>this.renderToolButton(o,o.onMainClick,o.onArrowClick,o.hasArrow,o.id==="brush"?n?.icon:o.id==="text"?s?.icon:void 0))})},this.handleSystemSettingsClose=()=>{this.setState({isSystemSettingsModalOpen:!1})},this.handleSystemSettingsConfirm=e=>{this.setState({systemSettings:e,isSystemSettingsModalOpen:!1})},this.renderOtherTools=()=>{const{isMarkLocked:e,isMarkVisibility:i}=this.state,r=[{id:"lock",icon:e?Bs:As,className:"lock-button",onMainClick:()=>{this.setState({isMarkLocked:!e})},onArrowClick:()=>{}},{id:"eye",icon:i?Ls:Hs,className:"eye-button",onMainClick:()=>{const n=!i;this.setState({isMarkVisibility:n}),this.props.drawingLayerRef&&this.props.drawingLayerRef.current&&(n?this.props.drawingLayerRef.current.showAllMark&&this.props.drawingLayerRef.current.showAllMark():this.props.drawingLayerRef.current.hideAllMark&&this.props.drawingLayerRef.current.hideAllMark())},onArrowClick:()=>{}}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:r.map(n=>this.renderToolButton(n,n.onMainClick,n.onArrowClick,!1,void 0))})},this.state={isDrawingModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,selectedEmoji:t.selectedEmoji||"😀",selectedEmojiCategory:"smileys",selectedCursor:"cursor-crosshair",isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,lastSelectedTools:{drawing:"line-segment",brush:"pencil",ruler:"pencil",cursor:"cursor-crosshair",fibonacci:"fibonacci-retracement",projectInfo:"time-range",irregularShape:"rectangle",textTool:"text"},arrowButtonStates:{},toolHoverStates:{},isSystemSettingsModalOpen:!1,systemSettings:{language:"zh-CN",themeMode:"light",autoSave:!0,showGrid:!0,hardwareAcceleration:!0},isMarkLocked:!1,isMarkVisibility:!0},this.toolManager=new gi}componentDidMount(){document.addEventListener("mousedown",t=>this.handleClickOutside(t),!0)}componentWillUnmount(){document.removeEventListener("mousedown",t=>this.handleClickOutside(t),!0)}componentDidUpdate(t){t.selectedEmoji!==this.props.selectedEmoji&&this.props.selectedEmoji&&this.setState({selectedEmoji:this.props.selectedEmoji})}getToolConfig(){return vo(this.props.i18n)}findToolInGroups(t,e){for(const i of t){const r=i.tools.find(n=>n.id===e);if(r)return r}return null}render(){const{showToolbar:t=!0}=this.props;return t?m.jsxs("div",{style:{position:"relative"},children:[m.jsx("div",{style:{background:this.props.currentTheme.panel.backgroundColor,borderRight:`1px solid ${this.props.currentTheme.panel.borderColor}`,display:"flex",flexDirection:"column",width:"50px",boxSizing:"border-box",height:"100%",overflow:"hidden"},children:m.jsxs("div",{style:{flex:1,overflowY:"hidden",overflowX:"hidden",padding:"12px 6px",display:"flex",flexDirection:"column",gap:"0px"},className:"custom-scrollbar",children:[this.renderCursorTools(),this.renderLineTools(),this.renderTecGraphTools(),this.renderMarkTools(),m.jsx("div",{style:{height:"1px",background:this.props.currentTheme.toolbar.border,margin:"10px 0"}}),this.renderOtherTools(),m.jsx("div",{style:{height:"1px",background:this.props.currentTheme.toolbar.border,margin:"10px 0"}}),this.renderTrash()]})}),this.renderDrawingModal(),this.renderBrushModal(),this.renderCursorModal(),this.renderEmojiSelectPopUp(),this.renderFibonacciModal(),this.renderProjectInfoModal(),this.renderIrregularShapeModal(),this.renderTextToolModal()]}):null}}class ft extends O.Component{constructor(t){super(t),this.toggleOpen=()=>{this.setState(e=>({isOpen:!e.isOpen}))},this.state={isOpen:t.defaultOpen||!1}}render(){const{title:t,tools:e,currentTheme:i,activeTool:r,onToolSelect:n}=this.props,{isOpen:s}=this.state;return m.jsxs("div",{style:{borderBottom:`1px solid ${i.toolbar.border}`},children:[m.jsxs("button",{onClick:this.toggleOpen,style:{width:"100%",background:"transparent",border:"none",padding:"12px 12px",color:i.layout.textColor,cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"13px",fontWeight:"600",transition:"background-color 0.2s"},onMouseEnter:a=>{a.currentTarget.style.background=i.toolbar.button.hover},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[m.jsx("span",{children:t}),m.jsx("span",{style:{transform:s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",fontSize:"12px"},children:"▼"})]}),s&&m.jsx("div",{style:{padding:"0px",background:i.toolbar.background},children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:e.map(a=>{const o=a.icon,h=r===a.id;return m.jsxs("button",{onClick:()=>n(a.id),style:{background:h?i.toolbar.button.active:"transparent",border:h?`2px solid ${i.toolbar.button.active}`:"2px solid transparent",padding:"10px 10px",borderRadius:"0px",color:h?i.toolbar.button.activeTextColor||"#FFFFFF":i.layout.textColor,textAlign:"left",cursor:"pointer",fontSize:"12px",fontWeight:"500",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"0px",width:"100%"},onMouseEnter:l=>{h||(l.currentTarget.style.background=i.toolbar.button.hover)},onMouseLeave:l=>{h||(l.currentTarget.style.background="transparent")},children:[m.jsx(o,{size:24,color:h?i.toolbar.button.activeTextColor||i.layout.textColor:i.toolbar.button.color}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,paddingLeft:"5px"},children:[m.jsx("div",{style:{fontWeight:"600",fontSize:"12px",lineHeight:"1.2"},children:a.name}),m.jsx("div",{style:{fontSize:"10px",opacity:.7,lineHeight:"1.2",marginTop:"2px",textAlign:"left"},children:a.description})]})]},a.id)})})})]})}}const re={Indicators:"Indicators",mainChartIndicators:"Main Chart Indicators",subChartIndicators:"Sub Chart Indicators",chartMaps:"Maps",close:"Close",searchIndicators:"Search indicators...",searchChartTypes:"Search chart types...",theme:"Theme",light:"Light",dark:"Dark",timeframe:"Time Frame",chartType:"Chart Type",toolBar:{color:"Color",lineSize:"Line Size",lineStyle:"Line Style",delete:"Delete",close:"Close",fontSize:"Font Size",bold:"Bold",italic:"Italic",selectColor:"Select Color",colorPicker:"Color Picker",solid:"Solid",dashed:"Dashed",dotted:"Dotted",currentColor:"Current Color"},timeframeSections:{second:"Second",minute:"Minute",hour:"Hour",day:"Day",week:"Week",month:"Month"},chartTypes:{candle:"Candlestick",line:"Line",area:"Area",baseline:"Baseline",hollowCandle:"Hollow Candle",heikinAshi:"Heikin Ashi",column:"Column",lineWithMarkers:"Line with Markers",stepLine:"Step Line",bar:"Bar",histogram:"Histogram",pointandfigure:"PointAndFigure",kagi:"Kagi",linebreak:"LineBreak",mountain:"Mountain",baselinearea:"BaseLineArea",highlow:"HighLow",equivolume:"EquiVolume",threelinebreak:"ThreeLineBreak",hlcarea:"HLCArea"},toolbarButtons:{hint:"Hint",replay:"Replay",fullScreen:"Full Screen",screenshot:"Screenshot",contrast:"Contrast"},indicators:{ma:"Moving Average",ema:"Exponential Moving Average",bollinger:"Bollinger Bands",ichimoku:"Ichimoku Cloud",donchian:"Donchian Channel",envelope:"Envelope",vwap:"VWAP",rsi:"RSI",macd:"MACD",volume:"Volume",sar:"Parabolic SAR",kdj:"KDJ",atr:"ATR",stochastic:"Stochastic",cci:"CCI",bbwidth:"BB Width",adx:"ADX",obv:"OBV"},modal:{parameterSettings:"Parameter Settings",parameterName:"Parameter Name",parameterValue:"Value",lineWidth:"Line Width",lineColor:"Color",addParameter:"Add Parameter",deleteParameter:"Delete",keepAtLeastOne:"Keep at least one parameter",maximumParameters:"Maximum 5 parameters allowed",dragToMove:"Drag header to move"},tooltips:{ctrlEnterToConfirm:"Ctrl+Enter: Confirm",escToCancel:"Esc: Cancel",clickToSelectColor:"Click to select color"},emoji:{categories:{smileys:"Smileys & Emotion",people:"People & Body",animals:"Animals & Nature",food:"Food & Drink",activities:"Activities",travel:"Travel & Places",objects:"Objects",symbols:"Symbols",flags:"Flags"},searchPlaceholder:"Search emojis...",selectedEmoji:"Selected",clickToPlace:"Click chart to place emoji"},leftPanel:{cursorCrosshair:"Crosshair",cursorCrosshairDesc:"Crosshair cursor with space",cursorCircle:"Cursor",cursorCircleDesc:"Cursor",cursorDot:"Dot Cursor",cursorDotDesc:"Round dot cursor style",cursorArrow:"Arrow Cursor",cursorArrowDesc:"Arrow pointer style",cursorSparkle:"Sparkle",cursorSparkleDesc:"Sparkle effect cursor",cursorEmoji:"Emoji Cursor",cursorEmojiDesc:"Emoji symbol cursor",pencil:"Pencil",pencilDesc:"Thin line drawing tool",pen:"Pen",penDesc:"Smooth line drawing",brush:"Brush",brushDesc:"Soft brush effect",markerPen:"Marker",markerPenDesc:"Bold marker pen",eraser:"Eraser",eraserDesc:"Erase drawing content",heatMap:"Heat Map",lineTools:"Lines",arrowTools:"Arrows",channelTools:"Channels",pitchforkTools:"Pitchforks",penTools:"Pens",gannTools:"Gann Tools",fibonacciTools:"Fibonacci Tools",technicalPatterns:"Technical Patterns",elliottWave:"Elliott Wave",regularShapes:"Regular Shapes",rangeTools:"Ranges",positionTools:"Positions",simulationTools:"Simulation",textTools:"Text",contentTools:"Content",lineSegment:"Line Segment",lineSegmentDesc:"Draw line segment",horizontalLine:"Horizontal Line",horizontalLineDesc:"Draw horizontal line marker",verticalLine:"Vertical Line",verticalLineDesc:"Draw vertical line marker",arrowLine:"Arrow Line",arrowLineDesc:"Draw arrow line marker",thickArrowLine:"Thick Arrow Line",thickArrowLineDesc:"Draw thick arrow line marker",parallelChannel:"Parallel Channel",parallelChannelDesc:"Draw parallel channel",linearRegressionChannel:"Linear Regression Channel",linearRegressionChannelDesc:"Draw regression channel",equidistantChannel:"Equidistant Channel",equidistantChannelDesc:"Draw equidistant channel",disjointChannel:"Disjoint Channel",disjointChannelDesc:"Draw disjoint channel",andrewPitchfork:"Andrew's Pitchfork",andrewPitchforkDesc:"Draw Andrew's pitchfork",enhancedAndrewPitchfork:"Enhanced Andrew Pitchfork",enhancedAndrewPitchforkDesc:"Draw enhanced pitchfork",schiffPitchfork:"Schiff Pitchfork",schiffPitchforkDesc:"Draw Schiff pitchfork",internalPitchfork:"Internal Pitchfork Lines",internalPitchforkDesc:"Draw internal pitchfork lines",wavePitchfork:"Wave Pitchfork",wavePitchforkDesc:"Draw wave pitchfork",gannFan:"Gann Fan",gannFanDesc:"Gann fan analysis tool",gannBox:"Gann Box",gannBoxDesc:"Gann box analysis tool",gannRectangle:"Gann Rectangle",gannRectangleDesc:"Gann Rectangle analysis",fibonacciTimeZones:"Fibonacci Time Zones",fibonacciTimeZonesDesc:"Fibonacci time zones analysis",fibonacciRetracement:"Fibonacci Retracement",fibonacciRetracementDesc:"Draw Fibonacci retracement lines",fibonacciArc:"Fibonacci Arc",fibonacciArcDesc:"Draw Fibonacci arcs",fibonacciCircle:"Fibonacci Circle",fibonacciCircleDesc:"Fibonacci circle analysis",fibonacciSpiral:"Fibonacci Spiral",fibonacciSpiralDesc:"Fibonacci spiral analysis",fibonacciWedge:"Fibonacci Wedge",fibonacciWedgeDesc:"Fibonacci wedge analysis",fibonacciFan:"Fibonacci Fan",fibonacciFanDesc:"Fibonacci fan analysis",fibonacciChannel:"Fibonacci Channel",fibonacciChannelDesc:"Fibonacci channel analysis",fibonacciExtensionPrice:"Fibonacci Extension (Price)",fibonacciExtensionPriceDesc:"Draw Fibonacci extension lines",fibonacciExtensionTime:"Fibonacci Extension (Time)",fibonacciExtensionTimeDesc:"Draw Fibonacci extension lines",xabcdPattern:"XABCD Pattern",xabcdPatternDesc:"Draw XABCD pattern",headAndShoulders:"Head and Shoulders",headAndShouldersDesc:"Draw head and shoulders pattern",abcdPattern:"ABCD Pattern",abcdPatternDesc:"Draw ABCD pattern",triangleAbcd:"ABCD Triangle",triangleAbcdDesc:"Draw ABCD triangle pattern",elliottImpulse:"Elliott Impulse Wave",elliottImpulseDesc:"Draw Elliott impulse wave",elliottCorrective:"Elliott Corrective Wave",elliottCorrectiveDesc:"Draw Elliott corrective wave",elliottTriangle:"Elliott Triangle Wave",elliottTriangleDesc:"Draw Elliott triangle wave",elliottDoubleCombo:"Elliott Double Combo",elliottDoubleComboDesc:"Draw Elliott double combo wave",elliottTripleCombo:"Elliott Triple Combo",elliottTripleComboDesc:"Draw Elliott triple combo wave",rectangle:"Rectangle",rectangleDesc:"Draw rectangular area",circle:"Circle",circleDesc:"Draw circular area",ellipse:"Ellipse",ellipseDesc:"Draw elliptical area",triangle:"Triangle",triangleDesc:"Draw triangle",sector:"Sector",sectorDesc:"Draw sector",curve:"Curve",curveDesc:"Draw curve",doubleCurve:"Double Curve",doubleCurveDesc:"Draw double curve",timeRange:"Time Range",timeRangeDesc:"Draw time range",priceRange:"Price Range",priceRangeDesc:"Draw price range",timePriceRange:"Time-Price Range",timePriceRangeDesc:"Draw time-price range",longPosition:"Long Position",longPositionDesc:"Long position marker",shortPosition:"Short Position",shortPositionDesc:"Short position marker",mockKline:"Mock K-line",mockKlineDesc:"Simulate K-line data",text:"Text",textDesc:"Text annotation",priceNote:"Price Note",priceNoteDesc:"Price annotation",bubbleBox:"Bubble Box",bubbleBoxDesc:"Bubble annotation box",pin:"Pin",pinDesc:"Pin marker",signpost:"Signpost",signpostDesc:"Signpost marker",priceLabel:"Price Label",priceLabelDesc:"Price label marker",flagMark:"Flag Mark",flagMarkDesc:"Flag marker",image:"Image",imageDesc:"Image annotation",video:"Video",videoDesc:"Video annotation",audio:"Audio",audioDesc:"Audio annotation",idea:"Idea",ideaDesc:"Idea annotation",mouseCursor:"Mouse Cursor",drawingTools:"Drawing Tools",fibonacciToolsTitle:"Fibonacci Tools",projectInfoTools:"Project Info Tools",shapeTools:"Shape Tools",brushTitle:"Brush",textMark:"Text Mark",emojiMark:"Emoji Mark",deleteTool:"Delete Tool",setting:"Setting",selectedTool:"Selected",clickToStartDrawing:"Click chart to start drawing",selectEmoji:"Select Emoji",selectedEmoji:"Selected",clickToPlaceEmoji:"Click chart to place emoji"},systemSettings:{title:"System Settings",general:"General",appearance:"Appearance",chart:"Chart",performance:"Performance",shortcuts:"Shortcuts",saveSettings:"Save Settings",cancel:"Cancel",confirm:"Confirm",language:"Language",timezone:"Timezone",autoSave:"Auto Save",themeMode:"Theme Mode",fontSize:"Font Size",animations:"Animations",defaultTimeframe:"Default Timeframe",pricePrecision:"Price Precision",showGrid:"Show Grid",hardwareAcceleration:"Hardware Acceleration",dataPointLimit:"Data Point Limit",realtimeUpdates:"Real-time Updates",shortcutsTitle:"Keyboard Shortcuts",zoomIn:"Zoom In",zoomOut:"Zoom Out",resetZoom:"Reset Zoom",saveChart:"Save Chart",undo:"Undo",redo:"Redo",setting:"Setting"},settingsDescriptions:{language:"Select interface display language",timezone:"Set timezone for displayed times",autoSave:"Automatically save chart settings and drawings",themeMode:"Choose light or dark theme",fontSize:"Set interface font size",animations:"Enable interface animation effects",defaultTimeframe:"Set default chart display timeframe",pricePrecision:"Set number of decimal places for price display",showGrid:"Display grid lines in chart",hardwareAcceleration:"Enable GPU accelerated rendering (recommended)",dataPointLimit:"Set maximum number of data points to display in chart",realtimeUpdates:"Enable real-time data stream updates"},options:{light:"Light Mode",dark:"Dark Mode",auto:"Follow System",small:"Small",medium:"Medium",large:"Large",zhCN:"Simplified Chinese",enUS:"English",jaJP:"Japanese",beijing:"Beijing Time (UTC+8)",newYork:"New York Time (UTC-5)",london:"London Time (UTC+0)",chicago:"Chicago Time (UTC-6)",denver:"Denver Time (UTC-7)",losAngeles:"Los Angeles Time (UTC-8)",toronto:"Toronto Time (UTC-5)",paris:"Paris Time (UTC+1)",frankfurt:"Frankfurt Time (UTC+1)",zurich:"Zurich Time (UTC+1)",moscow:"Moscow Time (UTC+3)",dubai:"Dubai Time (UTC+4)",karachi:"Karachi Time (UTC+5)",kolkata:"Kolkata Time (UTC+5:30)",shanghai:"Shanghai Time (UTC+8)",hongKong:"Hong Kong Time (UTC+8)",singapore:"Singapore Time (UTC+8)",tokyo:"Tokyo Time (UTC+9)",seoul:"Seoul Time (UTC+9)",sydney:"Sydney Time (UTC+10)",auckland:"Auckland Time (UTC+12)",utc:"UTC Time"},timeframes:{"1s":"1 Second","5s":"5 Seconds","15s":"15 Seconds","30s":"30 Seconds","1m":"1 Minute","3m":"3 Minutes","5m":"5 Minutes","15m":"15 Minutes","30m":"30 Minutes","45m":"45 Minutes","1H":"1 Hour","2H":"2 Hours","3H":"3 Hours","4H":"4 Hours","6H":"6 Hours","8H":"8 Hours","12H":"12 Hours","1D":"1 Day","3D":"3 Days","1W":"1 Week","2W":"2 Weeks","1M":"1 Month","3M":"3 Months","6M":"6 Months"},timezone:"Timezone",timeFormat:"Time Format",closeTime:"Close Time",tradingDay:"Trading Day",searchTimezones:"Search timezones...",timeFormatOptions:{twentyFourHour:"24-Hour Format",twelveHour:"12-Hour Format"},closeTimeOptions:{custom:"Custom Time"},tradingDayOptions:{tradingSession:"Trading Session",calendarDay:"Calendar Day",exchangeHours:"Exchange Hours"}},Do={Indicators:"技术指标",mainChartIndicators:"主图指标",subChartIndicators:"副图指标",chartMaps:"图",close:"关闭",searchIndicators:"搜索指标...",searchChartTypes:"搜索图表类型...",theme:"主题",light:"浅色",dark:"深色",timeframe:"时间框架",chartType:"图表类型",toolBar:{color:"颜色",lineSize:"线条尺寸",lineStyle:"线条样式",delete:"删除",close:"关闭",fontSize:"字体大小",bold:"粗体",italic:"斜体",selectColor:"选择颜色",colorPicker:"拾色器",solid:"实线",dashed:"虚线",dotted:"点状线",currentColor:"当前颜色"},timeframeSections:{second:"秒",minute:"分钟",hour:"小时",day:"天",week:"周",month:"月"},chartTypes:{candle:"蜡烛图",line:"线图",area:"面积图",baseline:"基线图",hollowCandle:"空心蜡烛图",heikinAshi:"平均K线图",column:"柱状图",lineWithMarkers:"带标记线图",stepLine:"阶梯线图",bar:"美国线",histogram:"直方图",pointandfigure:"点线图",kagi:"卡吉图",linebreak:"新价线",mountain:"山脉图",baselinearea:"基准面积图",highlow:"高低图",equivolume:"等量图",threelinebreak:"三线反转图",hlcarea:"HLC区域"},toolbarButtons:{hint:"提示",replay:"回放",fullScreen:"全屏",screenshot:"截图",contrast:"对比"},indicators:{ma:"移动平均线",ema:"指数移动平均线",bollinger:"布林带",ichimoku:"一目均衡表",donchian:"唐奇安通道",envelope:"包络线",vwap:"成交量加权平均价",rsi:"RSI",macd:"MACD",volume:"成交量",sar:"抛物线转向",kdj:"KDJ",atr:"ATR",stochastic:"随机指标",cci:"CCI",bbwidth:"布林带宽度",adx:"ADX",obv:"能量潮"},modal:{parameterSettings:"参数设置",parameterName:"参数名称",parameterValue:"数值",lineWidth:"线宽",lineColor:"颜色",addParameter:"添加参数",deleteParameter:"删除",keepAtLeastOne:"至少保留一个参数",maximumParameters:"最多允许5个参数",dragToMove:"拖动标题栏移动"},tooltips:{ctrlEnterToConfirm:"Ctrl+Enter: 确认",escToCancel:"Esc: 取消",clickToSelectColor:"点击选择颜色"},emoji:{categories:{smileys:"表情与情感",people:"人物与身体",animals:"动物与自然",food:"食物与饮品",activities:"活动",travel:"旅行与地点",objects:"物品",symbols:"符号",flags:"旗帜"},searchPlaceholder:"搜索表情...",selectedEmoji:"已选择",clickToPlace:"点击图表放置表情"},leftPanel:{cursorCrosshair:"十字准星",cursorCrosshairDesc:"带空格的十字准星",cursorCircle:"圆形光标",cursorCircleDesc:"圆形光标",cursorDot:"点状光标",cursorDotDesc:"圆点光标样式",cursorArrow:"箭头光标",cursorArrowDesc:"箭头指示样式",cursorSparkle:"烟花棒",cursorSparkleDesc:"烟花效果光标",cursorEmoji:"表情光标",cursorEmojiDesc:"表情符号光标",pencil:"铅笔",pencilDesc:"细线绘制工具",pen:"钢笔",penDesc:"流畅线条绘制",brush:"刷子",brushDesc:"柔和笔刷效果",markerPen:"马克笔",markerPenDesc:"粗体标记笔",eraser:"橡皮擦",eraserDesc:"擦除绘制内容",lineTools:"线",arrowTools:"箭头",channelTools:"通道",pitchforkTools:"叉",penTools:"画笔",gannTools:"江恩分析工具",fibonacciTools:"斐波那契工具",technicalPatterns:"技术图形",elliottWave:"艾略特波浪",regularShapes:"规则图形",rangeTools:"区间",positionTools:"标尺",simulationTools:"模拟",heatMap:"热力图",textTools:"文本",contentTools:"内容",lineSegment:"线段",lineSegmentDesc:"绘制线段",horizontalLine:"水平线",horizontalLineDesc:"绘制水平线标记",verticalLine:"垂直线",verticalLineDesc:"绘制垂直线标记",arrowLine:"箭头线",arrowLineDesc:"绘制箭头线标记",thickArrowLine:"粗箭头线",thickArrowLineDesc:"绘制箭头线标记",parallelChannel:"并行通道",parallelChannelDesc:"绘制并行通道",linearRegressionChannel:"线性回归通道",linearRegressionChannelDesc:"绘制回归通道",equidistantChannel:"等距通道",equidistantChannelDesc:"绘制等距通道",disjointChannel:"不相交通道",disjointChannelDesc:"绘制不相交通道",andrewPitchfork:"安德鲁干草叉",andrewPitchforkDesc:"绘制安德鲁干草叉",enhancedAndrewPitchfork:"改良安德鲁干草叉",enhancedAndrewPitchforkDesc:"绘制叉子",schiffPitchfork:"希夫干草叉",schiffPitchforkDesc:"绘制希夫干草叉",internalPitchfork:"内部干草叉线",internalPitchforkDesc:"绘制内部干草叉线",wavePitchfork:"波浪干草叉",wavePitchforkDesc:"绘制波浪干草叉",gannFan:"江恩扇",gannFanDesc:"江恩扇形线分析工具",gannBox:"江恩箱",gannBoxDesc:"江恩箱体分析工具",gannRectangle:"江恩正方体",gannRectangleDesc:"江恩正方体分析",fibonacciTimeZones:"斐波那契时间周期",fibonacciTimeZonesDesc:"斐波那契时间周期线分析",fibonacciRetracement:"斐波那契回调",fibonacciRetracementDesc:"绘制斐波那契回调线",fibonacciArc:"斐波那契弧线",fibonacciArcDesc:"绘制斐波那契弧线",fibonacciCircle:"斐波那契圆",fibonacciCircleDesc:"斐波那契圆线分析",fibonacciSpiral:"斐波那契螺旋",fibonacciSpiralDesc:"斐波那契螺旋线分析",fibonacciWedge:"斐波那契楔形",fibonacciWedgeDesc:"斐波那契楔形线分析",fibonacciFan:"斐波那契扇形",fibonacciFanDesc:"斐波那契扇形线分析",fibonacciChannel:"斐波那契通道",fibonacciChannelDesc:"斐波那契通道线分析",fibonacciExtensionPrice:"斐波那契扩展(基于价格)",fibonacciExtensionPriceDesc:"绘制斐波那契扩展线",fibonacciExtensionTime:"斐波那契扩展(基于时间)",fibonacciExtensionTimeDesc:"绘制斐波那契扩展线",xabcdPattern:"XABCD图形",xabcdPatternDesc:"绘制XABCD图形",headAndShoulders:"头肩图形",headAndShouldersDesc:"绘制头肩图形",abcdPattern:"ABCD图形",abcdPatternDesc:"绘制ABCD图形",triangleAbcd:"ABCD三角图形",triangleAbcdDesc:"绘制ABCD三角图形",elliottImpulse:"艾略特脉冲波",elliottImpulseDesc:"绘制艾略特脉冲波",elliottCorrective:"艾略特修正浪",elliottCorrectiveDesc:"绘制艾略特修正浪",elliottTriangle:"艾略特三角波",elliottTriangleDesc:"绘制艾略特三角波",elliottDoubleCombo:"艾略特双重组合波",elliottDoubleComboDesc:"绘制艾略特双重组合波",elliottTripleCombo:"艾略特三重组合波",elliottTripleComboDesc:"绘制艾略特三重组合波",rectangle:"矩形",rectangleDesc:"绘制矩形区域",circle:"圆形",circleDesc:"绘制圆形区域",ellipse:"椭圆",ellipseDesc:"绘制椭圆区域",triangle:"三角形",triangleDesc:"绘制三角形",sector:"扇形",sectorDesc:"绘制扇形",curve:"曲线",curveDesc:"绘制曲线",doubleCurve:"双曲线",doubleCurveDesc:"绘制双曲线",timeRange:"时间区间",timeRangeDesc:"绘制时间区间",priceRange:"价格区间",priceRangeDesc:"绘制价格区间",timePriceRange:"时间价格区间",timePriceRangeDesc:"绘制时间价格区间",longPosition:"多头",longPositionDesc:"多头标记",shortPosition:"空头",shortPositionDesc:"空头标记",mockKline:"模拟K线",mockKlineDesc:"模拟K线数据",text:"文本",textDesc:"文本标注",priceNote:"价格标记",priceNoteDesc:"价格标注",bubbleBox:"气泡框",bubbleBoxDesc:"气泡标注框",pin:"定位",pinDesc:"定位标记",signpost:"路标",signpostDesc:"路标标记",priceLabel:"价格标签",priceLabelDesc:"价格标签标记",flagMark:"旗标",flagMarkDesc:"旗标标记",image:"图片",imageDesc:"图片标注",video:"视频",videoDesc:"视频标注",audio:"音频",audioDesc:"音频标注",idea:"点子",ideaDesc:"点子标注",mouseCursor:"鼠标光标",drawingTools:"绘图工具",fibonacciToolsTitle:"斐波那契工具",projectInfoTools:"项目信息工具",shapeTools:"图形工具",brushTitle:"画笔",textMark:"文字标记",emojiMark:"表情标记",deleteTool:"删除工具",setting:"设置",selectedTool:"已选择",clickToStartDrawing:"点击图表开始绘制",selectEmoji:"选择表情",selectedEmoji:"已选择",clickToPlaceEmoji:"点击图表放置表情"},systemSettings:{title:"系统设置",general:"通用设置",appearance:"外观设置",chart:"图表设置",performance:"性能设置",shortcuts:"快捷键",saveSettings:"保存设置",cancel:"取消",confirm:"确认",language:"语言",timezone:"时区",autoSave:"自动保存",themeMode:"主题模式",fontSize:"字体大小",animations:"动画效果",defaultTimeframe:"默认时间周期",pricePrecision:"价格精度",showGrid:"显示网格",hardwareAcceleration:"硬件加速",dataPointLimit:"数据点限制",realtimeUpdates:"实时数据更新",shortcutsTitle:"键盘快捷键",zoomIn:"放大图表",zoomOut:"缩小图表",resetZoom:"重置缩放",saveChart:"保存图表",undo:"撤销操作",redo:"重做操作",setting:"设置"},settingsDescriptions:{language:"选择界面显示语言",timezone:"设置显示时间的时区",autoSave:"自动保存图表设置和绘图",themeMode:"选择浅色或深色主题",fontSize:"设置界面字体大小",animations:"启用界面动画效果",defaultTimeframe:"设置图表默认显示的时间周期",pricePrecision:"设置价格显示的小数位数",showGrid:"在图表中显示网格线",hardwareAcceleration:"启用GPU加速渲染(推荐)",dataPointLimit:"设置图表显示的最大数据点数量",realtimeUpdates:"启用实时数据流更新"},options:{light:"浅色模式",dark:"深色模式",auto:"跟随系统",small:"小",medium:"中",large:"大",zhCN:"简体中文",enUS:"English",jaJP:"日本語",beijing:"北京时间 (UTC+8)",newYork:"纽约时间 (UTC-5)",london:"伦敦时间 (UTC+0)",chicago:"芝加哥时间 (UTC-6)",denver:"丹佛时间 (UTC-7)",losAngeles:"洛杉矶时间 (UTC-8)",toronto:"多伦多时间 (UTC-5)",paris:"巴黎时间 (UTC+1)",frankfurt:"法兰克福时间 (UTC+1)",zurich:"苏黎世时间 (UTC+1)",moscow:"莫斯科时间 (UTC+3)",dubai:"迪拜时间 (UTC+4)",karachi:"卡拉奇时间 (UTC+5)",kolkata:"加尔各答时间 (UTC+5:30)",shanghai:"上海时间 (UTC+8)",hongKong:"香港时间 (UTC+8)",singapore:"新加坡时间 (UTC+8)",tokyo:"东京时间 (UTC+9)",seoul:"首尔时间 (UTC+9)",sydney:"悉尼时间 (UTC+10)",auckland:"奥克兰时间 (UTC+12)",utc:"UTC时间"},timeframes:{"1s":"1秒","5s":"5秒","15s":"15秒","30s":"30秒","1m":"1分钟","3m":"3分钟","5m":"5分钟","15m":"15分钟","30m":"30分钟","45m":"45分钟","1H":"1小时","2H":"2小时","3H":"3小时","4H":"4小时","6H":"6小时","8H":"8小时","12H":"12小时","1D":"1天","3D":"3天","1W":"1周","2W":"2周","1M":"1月","3M":"3月","6M":"6月"},timezone:"时区",timeFormat:"时间格式",closeTime:"收盘时间",tradingDay:"交易日",searchTimezones:"搜索时区...",timeFormatOptions:{twentyFourHour:"24小时制",twelveHour:"12小时制"},closeTimeOptions:{custom:"自定义时间"},tradingDayOptions:{tradingSession:"交易时段",calendarDay:"日历日",exchangeHours:"交易时间"}};async function se(M,t){const e=M.candleViewContainerRef.current;if(!e){const i={success:!1,error:"Container not found",width:0,height:0,timestamp:Date.now()};return t?.(i),i}try{const i=document.createElement("canvas"),r=i.getContext("2d");if(!r){const u={success:!1,error:"Canvas context not available",width:0,height:0,timestamp:Date.now()};return t?.(u),u}const{width:n,height:s}=e.getBoundingClientRect();i.width=n,i.height=s,r.fillStyle=M.state.currentTheme.layout.background.color,r.fillRect(0,0,n,s);const a=e.querySelectorAll("canvas");Array.from(a).sort((u,c)=>{const d=parseInt(window.getComputedStyle(u).zIndex)||0,p=parseInt(window.getComputedStyle(c).zIndex)||0;return d-p}).forEach(u=>{try{const c=u.getBoundingClientRect(),d=e.getBoundingClientRect(),p=c.left-d.left,f=c.top-d.top;r.drawImage(u,p,f,c.width,c.height)}catch{}}),yo(M,e,r,n,s),Eo(r,n,s,M.state.currentTheme);const h=i.toDataURL("image/png"),l=await new Promise(u=>{i.toBlob(c=>{u(c)},"image/png")}),g={success:!0,dataUrl:h,blob:l,width:n,height:s,timestamp:Date.now()};if(t)t(g);else{const u=document.createElement("a");u.download=`chart-screenshot-${new Date().getTime()}.png`,u.href=h,u.click()}return g}catch(i){const r={success:!1,error:i instanceof Error?i.message:"Unknown error",width:0,height:0,timestamp:Date.now()};return t?.(r),r}}function Eo(M,t,e,i){M.save();const n=i.layout.background.color==="#0F1116"?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.25)";M.fillStyle=n,M.font="bold 60px Arial, sans-serif",M.textAlign="center",M.textBaseline="middle";const s=t/2,a=e/2;M.fillText("CandleView",s,a),M.restore()}function yo(M,t,e,i,r){Array.from(t.querySelectorAll('.chart-info-panel, .toolbar, [candleview-container] > div:not([style*="position: absolute"])')).forEach(s=>{Fo(M,s,e,t)})}function Fo(M,t,e,i){const r=t.getBoundingClientRect(),n=i.getBoundingClientRect(),s=r.left-n.left,a=r.top-n.top,o=document.createElement("canvas"),h=o.getContext("2d");h&&(o.width=r.width,o.height=r.height,Ro(M,t,h,r.width,r.height),e.drawImage(o,s,a,r.width,r.height))}function Ro(M,t,e,i,r){const n=t.textContent||"";n.trim()&&(e.fillStyle=M.state.currentTheme.layout.textColor,e.font="12px Arial",e.textAlign="left",e.textBaseline="top",Bo(M,e,n,i-20).forEach((a,o)=>{e.fillText(a,10,10+o*16)}))}function Bo(M,t,e,i){const r=e.split(" "),n=[];let s=r[0];for(let a=1;a<r.length;a++){const o=r[a];t.measureText(s+" "+o).width<i?s+=" "+o:(n.push(s),s=o)}return n.push(s),n}function Ao(M){return M&&{"1s":x.ONE_SECOND,"5s":x.FIVE_SECONDS,"15s":x.FIFTEEN_SECONDS,"30s":x.THIRTY_SECONDS,"1m":x.ONE_MINUTE,"3m":x.THREE_MINUTES,"5m":x.FIVE_MINUTES,"15m":x.FIFTEEN_MINUTES,"30m":x.THIRTY_MINUTES,"45m":x.FORTY_FIVE_MINUTES,"1H":x.ONE_HOUR,"2H":x.TWO_HOURS,"3H":x.THREE_HOURS,"4H":x.FOUR_HOURS,"6H":x.SIX_HOURS,"8H":x.EIGHT_HOURS,"12H":x.TWELVE_HOURS,"1D":x.ONE_DAY,"3D":x.THREE_DAYS,"1W":x.ONE_WEEK,"2W":x.TWO_WEEKS,"1M":x.ONE_MONTH,"3M":x.THREE_MONTHS,"6M":x.SIX_MONTHS}[M]||null}function Lo(M){return M&&{"America/New_York":A.NEW_YORK,"America/Chicago":A.CHICAGO,"America/Denver":A.DENVER,"America/Los_Angeles":A.LOS_ANGELES,"America/Toronto":A.TORONTO,"Europe/London":A.LONDON,"Europe/Paris":A.PARIS,"Europe/Frankfurt":A.FRANKFURT,"Europe/Zurich":A.ZURICH,"Europe/Moscow":A.MOSCOW,"Asia/Dubai":A.DUBAI,"Asia/Karachi":A.KARACHI,"Asia/Kolkata":A.KOLKATA,"Asia/Shanghai":A.SHANGHAI,"Asia/Hong_Kong":A.HONG_KONG,"Asia/Singapore":A.SINGAPORE,"Asia/Tokyo":A.TOKYO,"Asia/Seoul":A.SEOUL,"Australia/Sydney":A.SYDNEY,"Pacific/Auckland":A.AUCKLAND,UTC:A.UTC}[M]||null}function ae(M,t,e,i){return{timeframe:M.timeframe||x.ONE_DAY,timezone:M.timezone||A.SHANGHAI,shouldExtendVirtualData:!0,virtualDataBeforeCount:e||0,virtualDataAfterCount:i||0,chartType:t}}const ge=class ge{static handleData(t,e,i){if(!t||t.length===0)return[];try{const r=Ys(t,e.timezone),n=qs(r,e.timeframe);return e.shouldExtendVirtualData?this.extendWithVirtualData(n,e):n}catch{return t}}static extendWithVirtualData(t,e){const i=e.virtualDataBeforeCount??this.calculateOptimalVirtualDataCount(e.timeframe,"before"),r=e.virtualDataAfterCount??this.calculateOptimalVirtualDataCount(e.timeframe,"after");return Us(t,i,r,e.timeframe)}static calculateOptimalVirtualDataCount(t,e){const r=[x.ONE_SECOND,x.FIVE_SECONDS,x.FIFTEEN_SECONDS,x.THIRTY_SECONDS].includes(t),n=[x.ONE_MINUTE,x.THREE_MINUTES,x.FIVE_MINUTES,x.FIFTEEN_MINUTES,x.THIRTY_MINUTES,x.FORTY_FIVE_MINUTES].includes(t),s=[x.ONE_HOUR,x.TWO_HOURS,x.THREE_HOURS,x.FOUR_HOURS,x.SIX_HOURS,x.EIGHT_HOURS,x.TWELVE_HOURS].includes(t),a=[x.ONE_DAY,x.THREE_DAYS].includes(t),o=[x.ONE_WEEK,x.TWO_WEEKS].includes(t),h=[x.ONE_MONTH,x.THREE_MONTHS,x.SIX_MONTHS].includes(t);return r?Math.min(100,50):n?Math.min(100,80):s?100:a?200:o?300:h?400:100}static handleChartDisplayData(t,e){if(!t||t.length===0)return[];const i=`${e}-${t.length}-${t[0]?.time}-${t[t.length-1]?.time}`;if(this.formatCache&&this.formatCache.key===i)return this.formatCache.result;let r=[];try{return e===W.Candle||e===W.HollowCandle||e===W.Bar?r=t.map((n,s)=>{const a={time:n.time,open:Number(n.open),high:Number(n.high),low:Number(n.low),close:Number(n.close),volume:Number(n.volume)};return n.isVirtual?{...a,color:"transparent",borderColor:"transparent",wickColor:"transparent"}:a}):e===W.BaseLine?r=t.map(n=>{const s=n.isVirtual||n.volume===-1,a={time:n.time,value:Number(n.close)};return s?{...a,color:"transparent"}:a}):e===W.Line||e===W.Area||e===W.StepLine?r=t.map(n=>{const s=n.isVirtual||n.volume===-1,a={time:n.time,value:Number(n.close)};return s?{...a,color:"transparent"}:a}):e===W.Histogram?r=t.map(n=>{const s=n.isVirtual||n.volume===-1,a={time:n.time,value:n.volume||0};return s?{...a,color:"transparent"}:{...a,color:(n.volume||0)>100?"#26a69a":"#ef5350"}}):r=t.map(n=>{const s=n.isVirtual||n.volume===-1;return{time:n.time,value:Number(n.close),...s&&{color:"transparent"}}}),this.formatCache={key:i,result:r},r}catch{return[]}}static filterRealData(t){return t.filter(e=>!e.isVirtual&&e.volume!==-1&&e.volume!==0)}static getTimeframeConfig(t){return Ti[t]}static validateData(t){return!t||!Array.isArray(t)?!1:t.every(e=>e.time!==void 0&&e.open!==void 0&&e.high!==void 0&&e.low!==void 0&&e.close!==void 0)}static sampleData(t,e=1){if(e>=1||t.length<=1e3)return t;const i=[],r=Math.floor(1/e);for(let n=0;n<t.length;n+=r)n<t.length&&i.push(t[n]);return i}};ge.formatCache=null;let wt=ge;const dt=class dt{static getRealDataRange(t){if(t.length===0)return null;let e=-1,i=-1;for(let r=0;r<t.length;r++)if(!t[r].isVirtual){e=r;break}for(let r=t.length-1;r>=0;r--)if(!t[r].isVirtual){i=r;break}return{firstIndex:e,lastIndex:i}}static checkDataPointPositions(t,e,i){if(!t||!e)return;const{firstIndex:r,lastIndex:n}=e,{from:s,to:a}=t,o=r>=s&&r<=a,h=n>=s&&n<=a,l=r<s,g=r>a,u=n<s,c=n>a,p=(a-s)*.1,f=r>=a-p&&r<=a,k=n>=s&&n<=s+p;!this.lastFirstRealDataLeftViewport&&l&&i.onFirstRealDataExitLeftViewport?.(),!this.lastFirstRealDataRightViewport&&g&&i.onFirstRealDataExitRightViewport?.(),!this.lastLastRealDataLeftViewport&&u&&i.onLastRealDataExitLeftViewport?.(),!this.lastLastRealDataRightViewport&&c&&i.onLastRealDataExitRightViewport?.(),this.lastFirstRealDataLeftViewport&&!l&&o&&i.onFirstRealDataEnterLeftViewport?.(),!this.lastFirstRealDataNearRightViewport&&f&&i.onFirstRealDataNearRightViewport?.(),!this.lastLastRealDataNearLeftViewport&&k&&i.onLastRealDataNearLeftViewport?.(),this.lastFirstRealDataNearRightViewport&&!f&&i.onFirstRealDataLeaveNearRightViewport?.(),this.lastLastRealDataNearLeftViewport&&!k&&i.onLastRealDataLeaveNearLeftViewport?.(),this.lastFirstRealDataInViewport&&!o&&i.onFirstRealDataExitViewport?.(),this.lastLastRealDataInViewport&&!h&&i.onLastRealDataExitViewport?.(),this.lastFirstRealDataInViewport=o,this.lastLastRealDataInViewport=h,this.lastFirstRealDataLeftViewport=l,this.lastFirstRealDataRightViewport=g,this.lastLastRealDataLeftViewport=u,this.lastLastRealDataRightViewport=c,this.lastFirstRealDataNearRightViewport=f,this.lastLastRealDataNearLeftViewport=k}static reset(){this.lastFirstRealDataInViewport=!0,this.lastLastRealDataInViewport=!0,this.lastFirstRealDataLeftViewport=!1,this.lastFirstRealDataRightViewport=!1,this.lastLastRealDataLeftViewport=!1,this.lastLastRealDataRightViewport=!1,this.lastFirstRealDataNearRightViewport=!1,this.lastLastRealDataNearLeftViewport=!1}static getCurrentState(){return{lastFirstRealDataInViewport:this.lastFirstRealDataInViewport,lastLastRealDataInViewport:this.lastLastRealDataInViewport,lastFirstRealDataLeftViewport:this.lastFirstRealDataLeftViewport,lastFirstRealDataRightViewport:this.lastFirstRealDataRightViewport,lastLastRealDataLeftViewport:this.lastLastRealDataLeftViewport,lastLastRealDataRightViewport:this.lastLastRealDataRightViewport,lastFirstRealDataNearRightViewport:this.lastFirstRealDataNearRightViewport,lastLastRealDataNearLeftViewport:this.lastLastRealDataNearLeftViewport}}};dt.lastFirstRealDataInViewport=!0,dt.lastLastRealDataInViewport=!0,dt.lastFirstRealDataLeftViewport=!1,dt.lastFirstRealDataRightViewport=!1,dt.lastLastRealDataLeftViewport=!1,dt.lastLastRealDataRightViewport=!1,dt.lastFirstRealDataNearRightViewport=!1,dt.lastLastRealDataNearLeftViewport=!1;let de=dt;class Ho{constructor(t,e){this.chart=null,this.currentSeries=null,this.beforeViewPortBuffer=100,this.afterViewPortBuffer=0,this.getViewportDataPoints=(i,r)=>{if(!r||r.length===0)return[];const n=i.from-this.beforeViewPortBuffer,s=i.to-this.afterViewPortBuffer;return r.filter(o=>o.time>=n&&o.time<=s)},this.scrollLockState={isScrollLocked:!1,lockDirection:null,safeVisibleRange:null},this.chart=t,this.currentSeries=e}zoomIn(){if(!this.chart)return;const t=this.chart.timeScale(),e=t.getVisibleRange();if(!e)return;const n=(e.to-e.from)*.8,s=(e.from+e.to)/2;t.setVisibleRange({from:s-n/2,to:s+n/2})}zoomOut(){if(!this.chart)return;const t=this.chart.timeScale(),e=t.getVisibleRange();if(!e)return;const n=(e.to-e.from)*1.2,s=(e.from+e.to)/2;t.setVisibleRange({from:s-n/2,to:s+n/2})}scrollChart(t){if(!this.chart)return;const e=this.chart.timeScale(),i=e.getVisibleRange();if(!i)return;const n=(i.to-i.from)*.2;t==="left"?e.setVisibleRange({from:i.from-n,to:i.to-n}):e.setVisibleRange({from:i.from+n,to:i.to+n})}positionChart(t){this.setOptimalBarSpacing(t),this.scrollToRealData()}getVisibleTimeRange(){if(!this.chart)return null;try{const e=this.chart.timeScale().getVisibleRange();return e?{from:e.from,to:e.to}:null}catch(t){return console.error(t),null}}setVisibleTimeRange(t){if(!this.chart||!t)return;const e=this.chart.timeScale();try{e.setVisibleRange({from:t.from,to:t.to})}catch(i){console.error(i),this.scrollToRealData()}}scrollToRealData(){if(this.chart)try{const t=this.chart.timeScale(),e=this.currentSeries?.series?.data||[];if(e.length===0){t.fitContent();return}const{firstIndex:i,lastIndex:r,virtualAfterCount:n}=this.getRealDataRange();if(i===-1||r===-1){t.fitContent();return}const s=Math.min(100,r-i+1+10),a=Math.max(0,i-5),o=Math.min(e.length-1,r+Math.min(10,n));t.setVisibleLogicalRange({from:a,to:o})}catch(t){console.error(t),this.scrollToStablePosition()}}scrollToStablePosition(){if(this.chart)try{const t=this.chart.timeScale(),e=this.currentSeries?.series?.data||[];if(e.length===0){t.fitContent();return}const{lastIndex:i}=this.getRealDataRange();if(i===-1)t.setVisibleLogicalRange({from:Math.max(0,e.length-50),to:e.length-1});else{const n=Math.max(0,i-50+1),s=Math.min(e.length-1,i+5);t.setVisibleLogicalRange({from:n,to:s})}}catch(t){console.error(t),this.chart&&this.chart.timeScale().fitContent()}}getRealDataRange(){const t=this.currentSeries?.series?.data||[];let e=-1,i=-1,r=0,n=0,s=0;for(let a=0;a<t.length;a++){const o=t[a];if(!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0){e=a,n=a;break}}for(let a=t.length-1;a>=0;a--){const o=t[a];if(!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0){i=a,s=t.length-1-a;break}}if(e!==-1&&i!==-1)for(let a=e;a<=i;a++){const o=t[a];!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0&&r++}return{firstIndex:e,lastIndex:i,realDataCount:r,virtualBeforeCount:n,virtualAfterCount:s}}setOptimalBarSpacing(t){if(!this.chart)return;const e=this.chart.timeScale(),r=e.options().barSpacing||10,s={[x.ONE_SECOND]:1,[x.FIVE_SECONDS]:2,[x.FIFTEEN_SECONDS]:3,[x.THIRTY_SECONDS]:4,[x.ONE_MINUTE]:5,[x.THREE_MINUTES]:6,[x.FIVE_MINUTES]:7,[x.FIFTEEN_MINUTES]:8,[x.THIRTY_MINUTES]:9,[x.FORTY_FIVE_MINUTES]:10,[x.ONE_HOUR]:12,[x.TWO_HOURS]:14,[x.THREE_HOURS]:16,[x.FOUR_HOURS]:18,[x.SIX_HOURS]:20,[x.EIGHT_HOURS]:22,[x.TWELVE_HOURS]:24,[x.ONE_DAY]:15,[x.THREE_DAYS]:20,[x.ONE_WEEK]:25,[x.TWO_WEEKS]:30,[x.ONE_MONTH]:35,[x.THREE_MONTHS]:40,[x.SIX_MONTHS]:45}[t]||10;let a=s;Math.abs(r-s)>2&&(a=r);try{e.applyOptions({barSpacing:a,minBarSpacing:.5,maxBarSpacing:50})}catch(o){console.error(o)}}handleChartScrollLock(t,e){const i=this.chart.timeScale(),r=de.getRealDataRange(e);if(!r)return;const{firstIndex:n,lastIndex:s}=r;if(n!==-1&&s!==-1&&e.length>0){const a=i.getVisibleLogicalRange();if(a){const{from:o,to:h}=a,l=n>=h-1,g=s<=o+1;if(this.scrollLockState.isScrollLocked&&this.scrollLockState.safeVisibleRange&&(this.scrollLockState.lockDirection==="right"?t.from>this.scrollLockState.safeVisibleRange.from+2&&!l&&(this.scrollLockState.isScrollLocked=!1,this.scrollLockState.lockDirection=null,this.scrollLockState.safeVisibleRange=null):this.scrollLockState.lockDirection==="left"&&t.from<this.scrollLockState.safeVisibleRange.from-2&&!g&&(this.scrollLockState.isScrollLocked=!1,this.scrollLockState.lockDirection=null,this.scrollLockState.safeVisibleRange=null),this.scrollLockState.isScrollLocked)){i.setVisibleRange(this.scrollLockState.safeVisibleRange);return}this.scrollLockState.isScrollLocked||(l?(this.scrollLockState.isScrollLocked=!0,this.scrollLockState.lockDirection="right",this.scrollLockState.safeVisibleRange={...t},i.setVisibleRange(this.scrollLockState.safeVisibleRange)):g&&(this.scrollLockState.isScrollLocked=!0,this.scrollLockState.lockDirection="left",this.scrollLockState.safeVisibleRange={...t},i.setVisibleRange(this.scrollLockState.safeVisibleRange)))}}}}class pi{static loadData(t){if(t.data&&t.data.length>0)return this.validateAndFormatData(t.data);if(t.jsonFilePath){const e=this.loadFromLocalFile(t.jsonFilePath);if(e.length>0)return e}if(t.url){const e=this.loadFromUrl(t.url);if(e.length>0)return e}return[]}static loadFromLocalFile(t){try{const e=t.startsWith("/")?t:`/${t}`,i=new XMLHttpRequest;if(i.open("GET",e,!1),i.send(),i.status!==200)throw new Error(`Failed to fetch file: ${i.status}`);const r=i.responseText;if(r.trim().startsWith("<!DOCTYPE")||r.trim().startsWith("<html"))throw new Error("Received HTML instead of JSON. Check file path.");const n=JSON.parse(r);return this.parseOHLCData(n)}catch{try{const i=t.replace(/^\.?\//,""),r=require(`../${i}`);return this.parseOHLCData(r)}catch{return[]}}}static loadFromUrl(t){try{const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status!==200)throw new Error(`HTTP error! status: ${e.status}`);const i=e.getResponseHeader("content-type");!i||i.includes("application/json");const r=JSON.parse(e.responseText);return this.parseOHLCData(r)}catch{return[]}}static parseOHLCData(t){return Array.isArray(t)?t.map(e=>({time:e.time,open:Number(e.open),high:Number(e.high),low:Number(e.low),close:Number(e.close),volume:Number(e.volume||0)})).filter(e=>!isNaN(e.time)&&!isNaN(e.open)&&!isNaN(e.high)&&!isNaN(e.low)&&!isNaN(e.close)):t.data&&Array.isArray(t.data)?this.parseOHLCData(t.data):t.ohlc&&Array.isArray(t.ohlc)?this.parseOHLCData(t.ohlc):t.series&&Array.isArray(t.series)?this.parseOHLCData(t.series):t.result&&Array.isArray(t.result)?this.parseOHLCData(t.result):t.values&&Array.isArray(t.values)?this.parseOHLCData(t.values):[]}static validateAndFormatData(t){return t}static validateConfig(t){return[t.data&&t.data.length>0,!!t.jsonFilePath,!!t.url].filter(Boolean).length!==0}static getActiveDataSource(t){return t.data&&t.data.length>0?"data":t.jsonFilePath?"jsonFilePath":t.url?"url":"none"}}const Oo={panel:{backgroundColor:"#1A1D24",borderColor:"#2D323D"},modal:{textColor:"#FFFFFF"},layout:{background:{color:"#0F1116"},textColor:"#E8EAED",attributionLogo:!1},grid:{vertLines:{visible:!1,color:"#2D323D"},horzLines:{visible:!1,color:"#2D323D"}},chart:{candleUpColor:"#26a69a",candleDownColor:"#ef5350",lineColor:"#2962FF",topColor:"rgba(41, 98, 255, 0.4)",bottomColor:"rgba(41, 98, 255, 0)",lineWidth:2,upColor:"#00C087",downColor:"#FF5B5A",background:"#0F1116",baseLineColor:"#FF9800",histogramColor:"#4CAF50",stepLineColor:"#9C27B0",areaTopColor:"rgba(33, 150, 243, 0.4)",areaBottomColor:"rgba(33, 150, 243, 0)",areaLineColor:"#2196F3",volumeColor:"#4CAF50"},toolbar:{background:"#1A1D24",border:"#2D323D",button:{backgroundColor:"#2D323D",background:"transparent",hover:"#2D323D",active:"#2962FF",color:"#E8EAED",activeTextColor:"#FFFFFF",boxShadow:"0 0 0 1px rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.3)"}}},Io={panel:{backgroundColor:"#FFFFFF",borderColor:"#E1E5E9"},modal:{textColor:"#1A1D24"},layout:{background:{color:"#FFFFFF"},textColor:"#1A1D24",attributionLogo:!1},grid:{vertLines:{visible:!1,color:"#E1E5E9"},horzLines:{visible:!1,color:"#E1E5E9"}},chart:{candleUpColor:"#26a69a",candleDownColor:"#ef5350",lineColor:"#2962FF",topColor:"rgba(41, 98, 255, 0.4)",bottomColor:"rgba(41, 98, 255, 0)",lineWidth:2,upColor:"#00C087",downColor:"#FF5B5A",background:"#0F1116",baseLineColor:"#FF9800",histogramColor:"#4CAF50",stepLineColor:"#9C27B0",areaTopColor:"rgba(33, 150, 243, 0.4)",areaBottomColor:"rgba(33, 150, 243, 0)",areaLineColor:"#2196F3",volumeColor:"#4CAF50"},toolbar:{background:"#F8F9FA",border:"#E1E5E9",button:{backgroundColor:"#FFFFFF",background:"transparent",hover:"#E1E5E9",active:"#2962FF",color:"#495057",activeTextColor:"#FFFFFF",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1)"}}};class vi extends O.Component{constructor(t){super({showLeftPanel:!1,showTopPanel:!1,...t}),this.candleViewContainerRef=O.createRef(),this.chartRef=O.createRef(),this.chartContainerRef=O.createRef(),this.drawingLayerRef=O.createRef(),this.chart=null,this.resizeObserver=null,this.realTimeInterval=null,this.currentSeries=null,this.chartManager=null,this.updateTimeout=null,this.viewportManager=null,this.chartEventManager=null,this.preparedData=[],this.originalData=[],this.loadDataAsync=e=>{this.setState({dataLoadProgress:0,isDataLoading:!0}),this.loadExternalData().then(()=>(this.setState({dataLoadProgress:30}),this.loadInternalData())).then(()=>{this.setState({dataLoadProgress:70}),e&&e(),this.setState({dataLoadProgress:100,isDataLoading:!1,loadError:null})}).catch(i=>{this.setState({isDataLoading:!1,loadError:i.message})})},this.loadExternalData=async()=>new Promise((e,i)=>{try{this.setState({dataLoadProgress:10});const r=pi.loadData({jsonFilePath:this.props.jsonFilePath,data:this.props.data,url:this.props.url});this.originalData=r,this.setState({dataLoadProgress:30}),e()}catch(r){i(r)}}),this.loadInternalData=async()=>new Promise(e=>{this.setState({dataLoadProgress:40});const i=wt.handleData(this.originalData,ae({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType);this.setState({dataLoadProgress:50}),setTimeout(()=>{this.preparedData=i,this.setState({dataLoadProgress:60}),this.setState({displayData:i,dataLoadProgress:70},()=>{e()})},50)}),this.handleTimeFormatClick=()=>{this.setState({isTimeFormatModalOpen:!0})},this.handleCloseTimeClick=()=>{this.setState({isCloseTimeModalOpen:!0})},this.handleTradingDayClick=()=>{this.setState({isTradingDayModalOpen:!0})},this.handleTimezoneClick=()=>{this.setState({isTimezoneModalOpen:!0})},this.handleCloseModals=()=>{this.setState({isTimeframeModalOpen:!1,isIndicatorModalOpen:!1,isChartTypeModalOpen:!1,isSubChartModalOpen:!1,isTimezoneModalOpen:!1,isTimeFormatModalOpen:!1,isCloseTimeModalOpen:!1,isTradingDayModalOpen:!1,isMobileMenuOpen:!1})},this.handleTimezoneSelect=e=>{this.setState({currentTimezone:e,timezone:e,isTimezoneModalOpen:!1,isDataLoading:!0,dataLoadProgress:0},()=>{setTimeout(()=>{this.setState({dataLoadProgress:20}),this.loadInternalDataAsync(()=>{this.setState({dataLoadProgress:70}),this.initChart(),this.viewportManager?.positionChart(this.state.activeTimeframe),setTimeout(()=>{this.setState({isDataLoading:!1,dataLoadProgress:100})},50)})},50)})},this.handleTimeframeSelect=e=>{const i=e;this.setState({activeTimeframe:i,timeframe:i,isTimeframeModalOpen:!1,isDataLoading:!0,dataLoadProgress:0},()=>{setTimeout(()=>{this.setState({dataLoadProgress:10}),this.loadInternalDataAsync(()=>{this.setState({dataLoadProgress:60}),this.initChart(),this.viewportManager?.positionChart(this.state.activeTimeframe),setTimeout(()=>{this.setState({isDataLoading:!1,dataLoadProgress:100})},50)})},50)})},this.loadInternalDataAsync=e=>new Promise(i=>{this.state.isDataLoading||this.setState({isDataLoading:!0}),this.setState({dataLoadProgress:10}),setTimeout(()=>{setTimeout(()=>{this.setState({dataLoadProgress:30});const s=wt.handleData(this.originalData,ae({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType);this.setState({dataLoadProgress:50}),setTimeout(()=>{this.preparedData=s,this.setState({displayData:s,dataLoadProgress:60},()=>{e&&e(),i()})},50)},0)},0)}),this.initChart=()=>{if(!(!this.state.displayData||this.state.displayData.length===0||!this.currentSeries||!this.currentSeries.series))try{this.state.isDataLoading&&this.setState({dataLoadProgress:80}),this.currentSeries.series.setData(this.state.displayData),this.state.isDataLoading&&setTimeout(()=>{this.setState({dataLoadProgress:90})},50)}catch{this.setState({isDataLoading:!1,dataLoadProgress:100})}},this.refreshChart=()=>{if(!(!this.state.displayData||this.state.displayData.length===0||!this.currentSeries||!this.currentSeries.series||!this.chart))try{const e=this.chart.timeScale(),i=e.getVisibleRange();this.state.isDataLoading&&this.setState({dataLoadProgress:85}),this.currentSeries.series.setData(this.state.displayData),i&&setTimeout(()=>{try{e.setVisibleRange(i),this.state.isDataLoading&&setTimeout(()=>{this.setState({dataLoadProgress:95})},50)}catch{this.state.isDataLoading&&this.setState({isDataLoading:!1,dataLoadProgress:100})}},10)}catch{this.state.isDataLoading&&this.setState({isDataLoading:!1,dataLoadProgress:100})}},this.handleSelectedSubChartIndicator=e=>{this.setState({selectedSubChartIndicators:e,isSubChartModalOpen:!1})},this.handleRemoveSubChartIndicator=e=>{this.setState(i=>({selectedSubChartIndicators:i.selectedSubChartIndicators.filter(n=>n!==e)}))},this.handleCameraClick=()=>{const{handleScreenshotCapture:e}=this.props;e?se(this,i=>{i.success&&i.dataUrl&&i.blob?e({dataUrl:i.dataUrl,blob:i.blob,width:i.width,height:i.height,timestamp:i.timestamp}):this.fallbackToDownload(i.dataUrl)}):se(this)},this.fallbackToDownload=e=>{if(e){const i=document.createElement("a");i.download=`chart-screenshot-${new Date().getTime()}.png`,i.href=e,i.click()}else se(this)},this.serializeDrawings=()=>this.drawingLayerRef.current?this.drawingLayerRef.current.serializeDrawings():"[]",this.handleSubChartClick=()=>{this.setState({isSubChartModalOpen:!this.state.isSubChartModalOpen})},this.deserializeDrawings=e=>{this.drawingLayerRef.current&&this.drawingLayerRef.current.deserializeDrawings(e)},this.clearAllDrawings=()=>{this.drawingLayerRef.current&&this.drawingLayerRef.current.clearAllDrawings()},this.viewportDataBufferSize=500,this.handleVisibleTimeRangeChange=e=>{if(!e)return;e.from>this.viewportDataBufferSize&&(e.from=e.from-this.viewportDataBufferSize);const i=this.viewportManager?.getViewportDataPoints(e,this.preparedData)||[];this.setState({displayData:i})},this.handleEmojiSelect=e=>{this.setState({selectedEmoji:e})},this.handleThemeToggle=()=>{this.setState(e=>{const i=!e.isDarkTheme,r=i?"dark":"light";return{isDarkTheme:i,currentTheme:this.getThemeConfig(r)}},()=>{this.updateChartTheme()})},this.handleMobileMenuToggle=()=>{this.setState(e=>({isMobileMenuOpen:!e.isMobileMenuOpen}))},this.handleClickOutside=e=>{const i=e.target,r=this.state.isMobileMenuOpen&&!i.closest(".mobile-menu-button")&&!i.closest("[data-mobile-menu-modal]"),n=this.state.isTimeFormatModalOpen&&!i.closest(".time-format-button")&&!i.closest("[data-timeformat-modal]"),s=this.state.isCloseTimeModalOpen&&!i.closest(".close-time-button")&&!i.closest("[data-close-time-modal]"),a=this.state.isTradingDayModalOpen&&!i.closest(".trading-day-button")&&!i.closest("[data-trading-day-modal]"),o=this.state.isTimezoneModalOpen&&!i.closest(".timezone-button")&&!i.closest("[data-timezone-modal]"),h=this.state.isTimeframeModalOpen&&!i.closest(".timeframe-button")&&!i.closest("[data-timeframe-modal]"),l=this.state.isIndicatorModalOpen&&!i.closest(".indicator-button")&&!i.closest("[data-indicator-modal]"),g=this.state.isTradeModalOpen&&!i.closest(".trade-button")&&!i.closest("[data-trade-modal]"),u=this.state.isChartTypeModalOpen&&!i.closest(".chart-type-button")&&!i.closest("[data-chart-type-modal]"),c=this.state.isSubChartModalOpen&&!i.closest(".subchart-button")&&!i.closest("[data-subchart-modal]");r&&this.setState({isMobileMenuOpen:!1}),c&&this.setState({isSubChartModalOpen:!1}),h&&this.setState({isTimeframeModalOpen:!1}),l&&this.setState({isIndicatorModalOpen:!1}),g&&this.setState({isTradeModalOpen:!1}),u&&this.setState({isChartTypeModalOpen:!1}),o&&this.setState({isTimezoneModalOpen:!1}),n&&this.setState({isTimeFormatModalOpen:!1}),s&&this.setState({isCloseTimeModalOpen:!1}),a&&this.setState({isTradingDayModalOpen:!1})},this.handleToolSelect=e=>{this.setState({activeTool:e})},this.handleChartTypeSelect=e=>{this.setState({currentMainChartType:e,isChartTypeModalOpen:!1})},this.handleCloseChartTypeModal=()=>{this.setState({isChartTypeModalOpen:!1})},this.handleCloseDrawing=()=>{this.setState({activeTool:null})},this.handleTimeframeClick=()=>{this.setState({isTimeframeModalOpen:!this.state.isTimeframeModalOpen})},this.handleChartTypeClick=()=>{this.setState({isChartTypeModalOpen:!this.state.isChartTypeModalOpen})},this.handleIndicatorClick=()=>{this.setState({isIndicatorModalOpen:!this.state.isIndicatorModalOpen})},this.handleTradeClick=()=>{this.setState({isTradeModalOpen:!this.state.isTradeModalOpen})},this.handleSelectedMainChartIndicator=e=>{this.setState({selectedMainChartIndicator:e,isIndicatorModalOpen:!1})},this.handleMainChartIndicatorChange=e=>{this.setState({selectedMainChartIndicator:e})},this.handleCloseIndicatorModal=()=>{this.setState({isIndicatorModalOpen:!1})},this.handleCloseTimeframeModal=()=>{this.setState({isTimeframeModalOpen:!1})},this.handleCloseTradeModal=()=>{this.setState({isTradeModalOpen:!1})},this.handleTradeAction=e=>{this.setState({isTradeModalOpen:!1})},this.handleFullscreen=()=>{const e=this.chartContainerRef.current;e&&(document.fullscreenElement?document.exitFullscreen?.():e.requestFullscreen?.())},this.handleCompareClick=()=>{},this.handleReplayClick=()=>{},this.stopRealTimeDataSimulation=()=>{this.realTimeInterval&&(clearInterval(this.realTimeInterval),this.realTimeInterval=null)},this.handleContextMenu=e=>{e.preventDefault(),e.stopPropagation()},this.handleLeftArrowClick=()=>{this.chart&&this.viewportManager&&this.viewportManager.scrollChart("left")},this.handleRightArrowClick=()=>{this.chart&&this.viewportManager&&this.viewportManager.scrollChart("right")},this.handleRefreshClick=()=>{this.setState({isDataLoading:!0,dataLoadProgress:0}),setTimeout(()=>{this.setState({dataLoadProgress:20}),this.refreshExternalData(()=>{this.setState({dataLoadProgress:50}),this.refreshInternalData(()=>{this.setState({dataLoadProgress:80}),this.refreshChart(),this.viewportManager?.positionChart(this.state.activeTimeframe),this.setState({isDataLoading:!1,dataLoadProgress:100})})})},100)},this.handleZoomIn=()=>{this.viewportManager&&this.viewportManager.zoomIn()},this.handleZoomOut=()=>{this.viewportManager&&this.viewportManager.zoomOut()},this.state={isIndicatorModalOpen:!1,isTimeframeModalOpen:!1,isTradeModalOpen:!1,isChartTypeModalOpen:!1,isSubChartModalOpen:!1,isMobileMenuOpen:!1,activeTool:null,currentMainChartType:W.Candle,currentTheme:this.getThemeConfig(t.theme||"dark"),currentI18N:this.getI18nConfig(t.i18n||"zh-cn"),chartInitialized:!1,isDarkTheme:t.theme!=="light",selectedEmoji:"😀",selectedSubChartIndicators:[],selectedMainChartIndicator:null,subChartPanelHeight:200,isResizing:!1,showInfoLayer:!0,isTimezoneModalOpen:!1,currentTimezone:"Asia/Shanghai",isTimeFormatModalOpen:!1,isCloseTimeModalOpen:!1,isTradingDayModalOpen:!1,currentCloseTime:"17:00",currentTradingDayType:"trading-session",activeTimeframe:x.ONE_DAY,timeframe:Ao(t.timeframe)||x.ONE_DAY,timezone:Lo(t.timezone)||A.SHANGHAI,savedVisibleRange:null,virtualDataBeforeCount:500,virtualDataAfterCount:500,displayData:[],isDataLoading:!1,dataLoadProgress:0,loadError:null},this.chartEventManager=new Ci}componentDidMount(){this.chart||(this.setState({isDataLoading:!0}),this.loadDataAsync(()=>{setTimeout(()=>{this.initializeChart()},50)}))}componentDidUpdate(t,e){if(t.theme!==this.props.theme){const r=this.props.theme||"dark";this.setState({currentTheme:this.getThemeConfig(r)}),this.updateChartTheme();return}if(t.data!==this.props.data||t.jsonFilePath!==this.props.jsonFilePath||t.url!==this.props.url){this.setState({isDataLoading:!0,dataLoadProgress:0}),this.loadDataAsync(()=>{this.refreshChart()});return}}componentWillUnmount(){const t=this.viewportManager?.getVisibleTimeRange();if(t)try{localStorage.setItem("candleView_visibleRange",JSON.stringify(t))}catch{}this.updateTimeout&&clearTimeout(this.updateTimeout),this.resizeObserver&&this.chartContainerRef.current&&(this.resizeObserver.unobserve(this.chartContainerRef.current),this.resizeObserver.disconnect()),this.chart&&this.chart.remove(),this.realTimeInterval&&clearInterval(this.realTimeInterval),document.removeEventListener("mousedown",this.handleClickOutside,!0)}initializeChart(){if(!this.chartRef.current||!this.chartContainerRef.current)return;const t=this.chartContainerRef.current,{currentTheme:e,chartInitialized:i}=this.state,r=t.clientWidth,n=t.clientHeight;if(!(r===0||n===0)&&!i)try{this.setState({dataLoadProgress:75}),this.chart&&(this.chart.remove(),this.currentSeries=null),this.chartManager=new To(this.chartRef.current,r,n,e,this.props.i18n),this.chart=this.chartManager.getChart(),this.setState({dataLoadProgress:80}),this.viewportManager=new Ho(this.chart,this.currentSeries),this.chartEventManager?.registerVisibleTimeRangeChangeEvent(this.chart,s=>{this.handleVisibleTimeRangeChange(s)}),this.state.displayData&&this.state.displayData.length>0&&(this.currentSeries=Gi(this.chart,e),this.setState({dataLoadProgress:85}),this.refreshInternalData(()=>{this.initChart(),this.viewportManager?.positionChart(this.state.activeTimeframe),this.setState({dataLoadProgress:90}),this.setupResizeObserver(),this.setState({chartInitialized:!0,dataLoadProgress:95}),setTimeout(()=>{this.setState({dataLoadProgress:100})},50)}))}catch{this.setState({chartInitialized:!1,dataLoadProgress:100})}}refreshExternalData(t){const e=pi.loadData({jsonFilePath:this.props.jsonFilePath,data:this.props.data,url:this.props.url});this.originalData=e,t?.()}refreshInternalData(t){const e=wt.handleData(this.originalData,ae({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType);this.preparedData=e,this.setState({displayData:e},()=>{t?.()})}setupResizeObserver(){this.chartContainerRef.current&&(this.resizeObserver=new zi(t=>{for(const e of t)if(e.target===this.chartContainerRef.current&&this.chart){const{width:i,height:r}=e.contentRect,n=Math.max(i,100),s=Math.max(r,100);requestAnimationFrame(()=>{try{if(this.chart){const a=this.chart.timeScale(),o=a.getVisibleRange();this.chart.applyOptions({width:n,height:s}),o&&setTimeout(()=>{try{a.setVisibleRange(o)}catch{}},10)}}catch{}})}}),this.resizeObserver.observe(this.chartContainerRef.current))}updateChartTheme(){const{currentTheme:t}=this.state;if(this.chart)try{this.chart.applyOptions({layout:t.layout,grid:{vertLines:{color:t.grid.vertLines.color+"30",style:1,visible:!0},horzLines:{color:t.grid.horzLines.color+"30",style:1,visible:!0}}}),this.chart.applyOptions({timeScale:{borderColor:t.grid.vertLines.color},rightPriceScale:{borderColor:t.grid.horzLines.color}})}catch{}this.currentSeries&&rr(this.currentSeries,t)}getThemeConfig(t){return t==="light"?Io:Oo}getI18nConfig(t){return t==="en"?re:Do}render(){const{currentTheme:t,isDataLoading:e}=this.state,{height:i=500,showToolbar:r=!0}=this.props,n=`
|
|
150
|
+
`,J={position:"fixed",left:`${l.x}px`,top:`${l.y}px`,background:r?.toolbar?.background||"#fafafa",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"8px",padding:"0",width:"450px",maxWidth:"90vw",height:"500px",maxHeight:"80vh",zIndex:1e4,boxShadow:"0 8px 24px rgba(0,0,0,0.3)",cursor:u?"grabbing":"default",userSelect:u?"none":"auto",display:"flex",flexDirection:"column"},it={padding:"16px 16px 12px 16px",borderBottom:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,cursor:"grab",userSelect:"none",flexShrink:0},at={fontSize:"14px",fontWeight:"bold",color:r?.layout?.textColor||"#000000",margin:0},y={padding:"16px",flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},V={marginBottom:"16px",flex:1,overflowY:"auto",overflowX:"hidden",...G},Q={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px",padding:"8px",background:r?.toolbar?.background||"#fafafa",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px"},rt={fontSize:"12px",color:r?.layout?.textColor||"#000000",minWidth:"80px",fontWeight:"bold"},K={width:"80px",padding:"4px 8px",background:r?.toolbar?.background||"#fafafa",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",fontSize:"12px"},nt={width:"60px",padding:"4px 8px",background:r?.toolbar?.background||"#fafafa",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",fontSize:"12px"},et={display:"flex",alignItems:"center",gap:"4px",position:"relative"},ot={width:"24px",height:"24px",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",cursor:"pointer"},ut={position:"absolute",top:0,left:0,width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",opacity:0},gt={background:"transparent",border:"none",fontSize:"16px",cursor:"pointer",padding:"0",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",color:r?.chart?.downColor||"#ff4d4f"},mt={...gt,color:`${r?.toolbar?.border||"#d9d9d9"}`,cursor:"not-allowed"},vt={width:"100%",background:"transparent",color:r?.chart?.lineColor||"#2962FF",border:`2px dashed ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",padding:"8px 16px",fontSize:"12px",cursor:"pointer",marginBottom:"16px",flexShrink:0},xt={...vt,color:`${r?.toolbar?.border||"#d9d9d9"}`,cursor:"not-allowed",borderColor:`${r?.toolbar?.border||"#d9d9d9"}`},Kt={display:"flex",justifyContent:"flex-end",gap:"8px",flexShrink:0},Zt={background:"transparent",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},Jt={background:r?.toolbar?.button?.active||"#2962FF",color:r?.toolbar?.button?.activeTextColor||"#ffffff",border:"none",borderRadius:"4px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},Qt={fontSize:"10px",color:`${r?.layout?.textColor||"#000000"}80`,marginTop:"8px",textAlign:"center",flexShrink:0},te={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,background:"transparent"};if(!M||!o)return null;const I=Z(s);return Gt.createPortal(m.jsxs(O.Fragment,{children:[m.jsx("style",{children:L}),m.jsx("div",{style:te,onClick:tt,children:m.jsxs("div",{ref:f,style:J,onClick:B=>B.stopPropagation(),onMouseDown:X,onKeyDown:$,children:[m.jsx("div",{ref:k,style:it,onMouseDown:B=>{B.target===k.current&&B.preventDefault()},children:m.jsxs("div",{style:at,children:[P()," ",a.systemSettings?.setting||"设置"]})}),m.jsxs("div",{style:y,children:[m.jsx("div",{style:V,className:"subchart-scrollbar",children:o.map((B,N)=>m.jsxs("div",{style:Q,children:[m.jsx("div",{style:rt,children:B.paramName}),m.jsx("input",{type:"text",style:K,value:B.paramName,onChange:Y=>b(N,Y.target.value),onClick:Y=>Y.stopPropagation(),placeholder:a.modal?.parameterName||"参数名"}),m.jsx("input",{type:"number",style:K,value:B.paramValue,onChange:Y=>v(N,Number(Y.target.value)),onClick:Y=>Y.stopPropagation(),min:"1",max:"100",placeholder:a.modal?.parameterValue||"数值"}),m.jsxs("select",{style:nt,value:B.lineWidth,onChange:Y=>F(N,Number(Y.target.value)),onClick:Y=>Y.stopPropagation(),children:[m.jsx("option",{value:1,children:"1px"}),m.jsx("option",{value:2,children:"2px"}),m.jsx("option",{value:3,children:"3px"}),m.jsx("option",{value:4,children:"4px"}),m.jsx("option",{value:5,children:"5px"})]}),m.jsxs("div",{style:et,children:[m.jsx("div",{style:{...ot,backgroundColor:B.lineColor},onClick:Y=>{Y.currentTarget.nextSibling?.click()}}),m.jsx("input",{type:"color",style:ut,value:B.lineColor,onChange:Y=>D(N,Y.target.value),onClick:Y=>Y.stopPropagation()})]}),I.allowDelete&&m.jsx("button",{onClick:()=>S(N),style:o.length<=I.minParams?mt:gt,disabled:o.length<=I.minParams,type:"button",title:o.length<=I.minParams?`${a.modal?.keepAtLeastOne||"至少保留"}${I.minParams}${a.modal?.parameterName||"个参数"}`:a.modal?.deleteParameter||"删除",children:"×"})]},`${B.paramName}-${N}`))}),m.jsx("button",{onClick:_,style:o.length>=I.maxParams||!I.allowAdd?xt:vt,disabled:o.length>=I.maxParams||!I.allowAdd,type:"button",title:o.length>=I.maxParams?`${a.modal?.maximumParameters||"最多允许"}${I.maxParams}${a.modal?.parameterName||"个参数"}`:I.allowAdd?a.modal?.addParameter||"添加参数":a.modal?.keepAtLeastOne||"不允许添加参数",children:o.length>=I.maxParams?`${a.modal?.maximumParameters||"已达到最大参数数量"}(${I.maxParams}${a.modal?.parameterName||"个"})`:I.allowAdd?`+ ${a.modal?.addParameter||"添加参数"}`:a.modal?.keepAtLeastOne||"不允许添加参数"}),m.jsxs("div",{style:Kt,children:[m.jsx("button",{onClick:j,style:Zt,type:"button",children:a.systemSettings?.cancel||"取消"}),m.jsx("button",{onClick:H,style:Jt,type:"button",children:a.systemSettings?.confirm||"确定"})]}),m.jsxs("div",{style:Qt,children:[a.tooltips?.ctrlEnterToConfirm||"Ctrl+Enter: 确认",", ",a.tooltips?.escToCancel||"Esc: 取消",", ",a.modal?.dragToMove||"拖动标题栏移动"]})]})]})})]}),document.body)};class so{constructor(t){this.volumeSeries=null,this.refreshData=i=>{if(!this.volumeSeries)return;const r=i.props.chartData.map(n=>n.isVirtual?{time:n.time,value:n.volume,color:"rgba(0, 0, 0, 0)"}:{time:n.time,value:n.volume,color:n.close>=n.open?"rgba(38, 166, 154, 0.8)":"rgba(239, 83, 80, 0.8)"});r.length>0&&this.volumeSeries&&setTimeout(()=>{this.volumeSeries.setData(r)},0)},this.volumeSeries=t.props.chart.addSeries(q.HistogramSeries,{priceScaleId:"volume_bottom",color:"#26a69a"}),t.props.chart.priceScale("volume_bottom").applyOptions({scaleMargins:{top:.9,bottom:0}});const e=t.props.chartData.map(i=>i.isVirtual?{time:i.time,value:i.volume,color:"rgba(0, 0, 0, 0)"}:{time:i.time,value:i.volume,color:i.close>=i.open?"rgba(38, 166, 154, 0.8)":"rgba(239, 83, 80, 0.8)"});e.length>0&&this.volumeSeries&&setTimeout(()=>{this.volumeSeries.setData(e)},0)}}class ui{constructor(t,e){this.candleSeries=null,this.refreshData=r=>{if(!this.candleSeries)return;const n=this.transformToCandlestickData(r.props.chartData);n.length>0&&setTimeout(()=>{this.candleSeries.setData(n)},0)},this.updateStyle=r=>{this.candleSeries&&this.candleSeries.applyOptions(r)},this.destroy=r=>{this.candleSeries&&r.props.chart&&(r.props.chart.removeSeries(this.candleSeries),this.candleSeries=null)},this.candleSeries=t.props.chart.addSeries(q.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToCandlestickData(t.props.chartData);i.length>0&&this.candleSeries&&setTimeout(()=>{this.candleSeries.setData(i)},0)}transformToCandlestickData(t){return t.map(e=>e.isVirtual?{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close,color:"rgba(0, 0, 0, 0)"}:{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close})}getSeries(){return this.candleSeries}}class ao{constructor(t,e){this.barSeries=null,this.theme=null,this.refreshData=r=>{if(!this.barSeries)return;const n=this.transformToBarData(r.props.chartData);n.length>0&&setTimeout(()=>{this.barSeries.setData(n)},0)},this.updateStyle=r=>{this.barSeries&&this.barSeries.applyOptions(r)},this.destroy=r=>{this.barSeries&&r.props.chart&&(r.props.chart.removeSeries(this.barSeries),this.barSeries=null)},this.barSeries=t.props.chart.addSeries(q.BarSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",thinBars:!0,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBarData(t.props.chartData);i.length>0&&this.barSeries&&setTimeout(()=>{this.barSeries.setData(i)},0)}transformToBarData(t){return t.map(e=>{const i={time:e.time,open:Number(e.open),high:Number(e.high),low:Number(e.low),close:Number(e.close)};return e.isVirtual?{...i,color:"transparent",borderColor:"transparent"}:i})}getSeries(){return this.barSeries}}class no{constructor(t,e){this.lineSeries=null,this._lineWidht=2,this.refreshData=r=>{if(!this.lineSeries)return;const n=this.transformToLineData(r.props.chartData);n.length>0&&setTimeout(()=>{this.lineSeries.setData(n)},0)},this.updateStyle=r=>{this.lineSeries&&this.lineSeries.applyOptions(r)},this.destroy=r=>{this.lineSeries&&r.props.chart&&(r.props.chart.removeSeries(this.lineSeries),this.lineSeries=null)},this.lineSeries=t.props.chart.addSeries(q.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:this._lineWidht,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToLineData(t.props.chartData);i.length>0&&this.lineSeries&&setTimeout(()=>{this.lineSeries.setData(i)},0)}transformToLineData(t){return t.map(e=>({time:e.time,value:e.close}))}getSeries(){return this.lineSeries}}class oo{constructor(t,e){this.areaSeries=null,this.theme=null,this.refreshData=r=>{if(!this.areaSeries)return;const n=this.transformToAreaData(r.props.chartData);n.length>0&&setTimeout(()=>{this.areaSeries.setData(n)},0)},this.updateStyle=r=>{this.areaSeries&&this.areaSeries.applyOptions(r)},this.destroy=r=>{this.areaSeries&&r.props.chart&&(r.props.chart.removeSeries(this.areaSeries),this.areaSeries=null)},this.areaSeries=t.props.chart.addSeries(q.AreaSeries,{topColor:e.chart.areaTopColor||"rgba(33, 150, 243, 0.4)",bottomColor:e.chart.areaBottomColor||"rgba(33, 150, 243, 0)",lineColor:e.chart.areaLineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToAreaData(t.props.chartData);i.length>0&&this.areaSeries&&setTimeout(()=>{this.areaSeries.setData(i)},0)}transformToAreaData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent",lineColor:"transparent",topColor:"transparent",bottomColor:"transparent"}:i})}getSeries(){return this.areaSeries}}class lo{constructor(t,e){this.stepLineSeries=null,this.refreshData=r=>{if(!this.stepLineSeries)return;const n=this.transformToStepLineData(r.props.chartData);n.length>0&&setTimeout(()=>{this.stepLineSeries.setData(n)},0)},this.updateStyle=r=>{if(this.stepLineSeries){const n={...r,lineType:1};this.stepLineSeries.applyOptions(n)}},this.destroy=r=>{this.stepLineSeries&&r.props.chart&&(r.props.chart.removeSeries(this.stepLineSeries),this.stepLineSeries=null)},this.stepLineSeries=t.props.chart.addSeries(q.LineSeries,{color:e.chart.stepLineColor||"#9C27B0",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.stepLineSeries.applyOptions({lineType:1}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToStepLineData(t.props.chartData);i.length>0&&this.stepLineSeries&&setTimeout(()=>{this.stepLineSeries.setData(i)},0)}transformToStepLineData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent"}:i})}getSeries(){return this.stepLineSeries}}class ho{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.filter(o=>!o.isVirtual),s=n.length>0?n.reduce((o,h)=>o+h.close,0)/n.length:0;this.series.applyOptions({baseValue:{type:"price",price:s}});const a=r.props.chartData.map(o=>o.isVirtual?{time:o.time,value:o.close,topLineColor:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)"}:{time:o.time,value:o.close});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.BaselineSeries,{baseValue:{type:"price",price:0},topLineColor:e.chart.candleUpColor||"#26a69a",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:e.chart.candleDownColor||"#ef5350",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToBaselineData(t){const e=t.filter(r=>!r.isVirtual),i=e.length>0?e.reduce((r,n)=>r+n.close,0)/e.length:0;return this.series&&this.series.applyOptions({baseValue:{type:"price",price:i}}),t.map(r=>({time:r.time,value:r.close,...r.isVirtual&&{topLineColor:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class co{constructor(t,e){this.histogramSeries=null,this.theme=null,this.refreshData=r=>{if(!this.histogramSeries)return;const n=this.transformToHistogramData(r.props.chartData);n.length>0&&setTimeout(()=>{this.histogramSeries.setData(n)},0)},this.updateStyle=r=>{this.histogramSeries&&this.histogramSeries.applyOptions(r)},this.destroy=r=>{this.histogramSeries&&r.props.chart&&(r.props.chart.removeSeries(this.histogramSeries),this.histogramSeries=null)},this.histogramSeries=t.props.chart.addSeries(q.HistogramSeries,{color:e.chart.histogramColor||"#4CAF50",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHistogramData(t.props.chartData);i.length>0&&this.histogramSeries&&setTimeout(()=>{this.histogramSeries.setData(i)},0)}transformToHistogramData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent"}:{...i,color:e.close>=(e.open||0)?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor}})}getSeries(){return this.histogramSeries}}class uo{constructor(t,e){this.candleSeries=null,this.theme=null,this.refreshData=r=>{if(!this.candleSeries)return;const n=this.transformToHollowCandlestickData(r.props.chartData);n.length>0&&setTimeout(()=>{this.candleSeries.setData(n)},0)},this.updateStyle=r=>{this.candleSeries&&this.candleSeries.applyOptions(r)},this.destroy=r=>{this.candleSeries&&r.props.chart&&(r.props.chart.removeSeries(this.candleSeries),this.candleSeries=null)},this.candleSeries=t.props.chart.addSeries(q.CandlestickSeries,{upColor:"transparent",downColor:"transparent",borderUpColor:e.chart.candleUpColor||"#26a69a",borderDownColor:e.chart.candleDownColor||"#ef5350",wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHollowCandlestickData(t.props.chartData);i.length>0&&this.candleSeries&&setTimeout(()=>{this.candleSeries.setData(i)},0)}transformToHollowCandlestickData(t){return t.map(e=>{const i=e.close>e.open,r={time:e.time,open:e.open,high:e.high,low:e.low,close:e.close};return e.isVirtual?{...r,color:"transparent",borderColor:"transparent",wickColor:"transparent"}:{...r,borderColor:i?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor,wickColor:i?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor}})}getSeries(){return this.candleSeries}}class go{constructor(t,e){this.candleSeries=null,this.refreshData=r=>{if(!this.candleSeries)return;const n=this.transformToHeikinAshiData(r.props.chartData);n.length>0&&setTimeout(()=>{this.candleSeries.setData(n)},0)},this.updateStyle=r=>{this.candleSeries&&this.candleSeries.applyOptions(r)},this.destroy=r=>{this.candleSeries&&r.props.chart&&(r.props.chart.removeSeries(this.candleSeries),this.candleSeries=null)},this.candleSeries=t.props.chart.addSeries(q.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHeikinAshiData(t.props.chartData);i.length>0&&this.candleSeries&&setTimeout(()=>{this.candleSeries.setData(i)},0)}transformToHeikinAshiData(t){if(t.length===0)return[];const e=[];let i=null;for(let r=0;r<t.length;r++){const n=t[r];if(n.isVirtual){e.push({time:n.time,open:n.open,high:n.high,low:n.low,close:n.close,color:"rgba(0, 0, 0, 0)"});continue}let s,a,o,h;i===null?(s=(n.open+n.close)/2,h=(n.open+n.high+n.low+n.close)/4,a=n.high,o=n.low):(s=(i.open+i.close)/2,h=(n.open+n.high+n.low+n.close)/4,a=Math.max(n.high,s,h),o=Math.min(n.low,s,h));const l={time:n.time,open:s,high:a,low:o,close:h};e.push(l),i={open:s,close:h}}return e}getSeries(){return this.candleSeries}}class po{constructor(t,e){this.series=null,this.lineCount=3,this.globalChartData=[],this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.map(s=>s.isVirtual?{time:s.time,value:s.close,color:"rgba(0, 0, 0, 0)"}:{time:s.time,value:s.close});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.globalChartData=t.props.chartData;const i=this.generateLineBreakData(this.globalChartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}generateLineBreakData(t){if(t.length===0)return[];const e=[];let i=[];for(let r=0;r<t.length;r++){const n=t[r].close;if(e.length===0){e.push({time:t[r].time,value:n}),i.push(n);continue}(n>Math.max(...i)||n<Math.min(...i))&&(e.push({time:t[r].time,value:n}),i.push(n),i.length>this.lineCount&&i.shift())}return e}getSeries(){return this.series}setLineCount(t){this.lineCount=t}}class fo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.map(s=>s.isVirtual?{time:s.time,value:s.close,lineColor:"rgba(0, 0, 0, 0)",topColor:"rgba(0, 0, 0, 0)",bottomColor:"rgba(0, 0, 0, 0)"}:{time:s.time,value:s.close});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.AreaSeries,{topColor:e.chart.areaTopColor||"rgba(33, 150, 243, 0.4)",bottomColor:e.chart.areaBottomColor||"rgba(33, 150, 243, 0)",lineColor:e.chart.areaLineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToMountainData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToMountainData(t){return t.map(e=>({time:e.time,value:e.close,...e.isVirtual&&{lineColor:"rgba(0, 0, 0, 0)",topColor:"rgba(0, 0, 0, 0)",bottomColor:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class Mo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.map(s=>{if(s.isVirtual)return{time:s.time,open:s.open,high:s.high,low:s.low,close:s.close,color:"rgba(0, 0, 0, 0)",wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"};{const a=s.close>=s.open,o=a?s.close:s.open,h=a?s.open:s.close;return{time:s.time,open:h,high:s.high,low:s.low,close:o,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderVisible:!1}}});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHighLowData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHighLowData(t){return t.map(e=>{if(e.isVirtual)return{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close,color:"rgba(0, 0, 0, 0)",wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"};{const i=e.close>=e.open,r=i?e.close:e.open,n=i?e.open:e.close;return{time:e.time,open:n,high:e.high,low:e.low,close:r,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderVisible:!1}}})}getSeries(){return this.series}}class mo{constructor(t,e){this.series=null,this._chart=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this.channelWidthPercent=.3,this._timeScale=null,this._lineWidth=2,this.refreshData=r=>{if(!this.series)return;this._chartData=r.props.chartData||[];const n=this.transformToBaselineData(r.props.chartData);n.length>0&&this.series.setData(n),this.requestUpdate()},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(this._isAttached&&r.props.chartSeries&&r.props.chartSeries.series)try{r.props.chartSeries.series.detachPrimitive(this),this._isAttached=!1}catch{}this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this._chartData=t.props.chartData||[],this._chart=t.props.chart,this._timeScale=this._chart.timeScale(),this.series=t.props.chart.addSeries(q.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:this._lineWidth,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.attachChannelRenderer(t),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i),this.requestUpdate()},0)}attachChannelRenderer(t){t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0)}transformToBaselineData(t){return t.filter(i=>!i.isVirtual).map(i=>({time:i.time,value:i.close}))}attached(t){this._chart=t.chart,this.requestUpdate()}updateAllViews(){this.requestUpdate()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&this.drawChannel(e)}}),[{renderer:()=>this._renderer}]}drawChannel(t){if(!this.series||!this._timeScale)return;const e=this._timeScale.getVisibleRange();if(!e)return;const i=this._chartData.filter(o=>!o.isVirtual&&o.time>=e.from&&o.time<=e.to);if(i.length<2)return;const r=i.map(o=>o.close),n=5,s=[];for(let o=0;o<r.length;o++){const h=Math.max(0,o-n+1),l=o+1,g=r.slice(h,l);s.push(g.reduce((u,c)=>u+c,0)/g.length)}const a=(Math.max(...s)-Math.min(...s))*this.channelWidthPercent;this.drawChannelLines(t,i,a)}drawChannelLines(t,e,i){t.save(),t.beginPath(),t.strokeStyle="#26a69a",t.lineWidth=this._lineWidth,t.setLineDash([]);let r=!0;for(const s of e){const a=this._timeScale.timeToCoordinate(s.time),o=s.close+i,h=this.series.priceToCoordinate(o);a===null||h===null||(r?(t.moveTo(a,h),r=!1):t.lineTo(a,h))}t.stroke(),t.restore(),t.save(),t.beginPath(),t.strokeStyle="rgba(255, 0, 0, 0.8)",t.lineWidth=this._lineWidth,t.setLineDash([]);let n=!0;for(const s of e){const a=this._timeScale.timeToCoordinate(s.time),o=s.close-i,h=this.series.priceToCoordinate(o);a===null||h===null||(n?(t.moveTo(a,h),n=!1):t.lineTo(a,h))}t.stroke(),t.restore(),this.drawChannelFill(t,e,i)}drawChannelFill(t,e,i){if(!(e.length<2)){t.save(),t.beginPath();for(let r=0;r<e.length;r++){const n=e[r],s=this._timeScale.timeToCoordinate(n.time),a=n.close+i,o=this.series.priceToCoordinate(a);s===null||o===null||(r===0?t.moveTo(s,o):t.lineTo(s,o))}for(let r=e.length-1;r>=0;r--){const n=e[r],s=this._timeScale.timeToCoordinate(n.time),a=this.series.priceToCoordinate(n.close);s===null||a===null||t.lineTo(s,a)}t.closePath(),t.fillStyle="rgba(38, 166, 154, 0.3)",t.fill(),t.restore(),t.save(),t.beginPath();for(let r=0;r<e.length;r++){const n=e[r],s=this._timeScale.timeToCoordinate(n.time),a=this.series.priceToCoordinate(n.close);s===null||a===null||(r===0?t.moveTo(s,a):t.lineTo(s,a))}for(let r=e.length-1;r>=0;r--){const n=e[r],s=this._timeScale.timeToCoordinate(n.time),a=n.close-i,o=this.series.priceToCoordinate(a);s===null||o===null||t.lineTo(s,o)}t.closePath(),t.fillStyle="rgba(239, 83, 80, 0.3)",t.fill(),t.restore()}}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate()}catch{}}getSeries(){return this.series}setChannelWidth(t){this.channelWidthPercent=Math.max(.01,Math.min(1,t)),this.requestUpdate()}getChannelWidth(){return this.channelWidthPercent}}class ko{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const n=r.props.chartData.filter(o=>!o.isVirtual),s=n.length>0?n.reduce((o,h)=>o+h.close,0)/n.length:0;this.series.applyOptions({baseValue:{type:"price",price:s}});const a=r.props.chartData.map(o=>o.isVirtual?{time:o.time,value:o.close,topLineColor:"rgba(0, 0, 0, 0)",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)"}:{time:o.time,value:o.close});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{this.series&&r.props.chart&&(r.props.chart.removeSeries(this.series),this.series=null)},this.series=t.props.chart.addSeries(q.BaselineSeries,{baseValue:{type:"price",price:0},topLineColor:e.chart.candleUpColor||"#26a69a",topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",bottomLineColor:e.chart.candleDownColor||"#ef5350",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToBaselineData(t){const e=t.filter(r=>!r.isVirtual),i=e.length>0?e.reduce((r,n)=>r+n.close,0)/e.length:0;return this.series&&this.series.applyOptions({baseValue:{type:"price",price:i}}),t.map(r=>({time:r.time,value:r.close,...r.isVirtual&&{topLineColor:"rgba(0, 0, 0, 0)",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class Po{constructor(t,e){this.currentChart=null,this.currentType=null,this.chartLayer=t,this.theme=e}switchChartType(t){if(!(this.currentType===t&&this.currentChart))switch(this.destroyCurrentChart(),this.currentType=t,t){case W.Candle:this.currentChart=new ui(this.chartLayer,this.theme);break;case W.HollowCandle:this.currentChart=new uo(this.chartLayer,this.theme);break;case W.Bar:this.currentChart=new ao(this.chartLayer,this.theme);break;case W.Line:this.currentChart=new no(this.chartLayer,this.theme);break;case W.Area:this.currentChart=new oo(this.chartLayer,this.theme);break;case W.StepLine:this.currentChart=new lo(this.chartLayer,this.theme);break;case W.BaseLine:this.currentChart=new ho(this.chartLayer,this.theme);break;case W.Histogram:this.currentChart=new co(this.chartLayer,this.theme);break;case W.HeikinAshi:this.currentChart=new go(this.chartLayer,this.theme);break;case W.LineBreak:this.currentChart=new po(this.chartLayer,this.theme);break;case W.Mountain:this.currentChart=new fo(this.chartLayer,this.theme);break;case W.BaselineArea:this.currentChart=new ko(this.chartLayer,this.theme);break;case W.HighLow:this.currentChart=new Mo(this.chartLayer,this.theme);break;case W.HLCArea:this.currentChart=new mo(this.chartLayer,this.theme);break;default:console.warn(`Unknown chart type: ${t}`),this.currentChart=new ui(this.chartLayer,this.theme);break}}refreshData(){this.currentChart&&this.currentChart.refreshData(this.chartLayer)}updateStyle(t){this.currentChart&&this.currentChart.updateStyle(t)}getCurrentSeries(){return this.currentChart?this.currentChart.getSeries():null}getCurrentType(){return this.currentType}destroyCurrentChart(){this.currentChart&&(this.currentChart.destroy(this.chartLayer),this.currentChart=null)}destroy(){this.destroyCurrentChart(),this.currentType=null}}class _o{constructor(t,e,i,r){this._chart=null,this._series=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this._menu=null,this._heatMapRect={x:0,y:0,width:0,height:0},this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this.refreshData=n=>{this._chartData=n.props.chartData||[],this.requestUpdate()},this._closeCallBack=r,this.initializeHeatMap(t,e,i)}initializeHeatMap(t,e,i){this._chartData=t.props.chartData||[],this._i18n=e,this._theme=i,t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(t.props.chart))}bindContextMenu(t){const e=t.chartElement();e&&(this._contextMenuHandler=i=>{this.isInHeatMapArea(i.offsetX,i.offsetY)&&(i.preventDefault(),this.showContextMenu(i.clientX,i.clientY))},this._clickHandler=i=>{this._menu&&!this._menu.contains(i.target)&&this.hideContextMenu()},this._resizeHandler=()=>this.updateHeatMapRect(),e.addEventListener("contextmenu",this._contextMenuHandler),document.addEventListener("click",this._clickHandler),window.addEventListener("resize",this._resizeHandler))}isInHeatMapArea(t,e){return this.updateHeatMapRect(),t>=this._heatMapRect.x&&t<=this._heatMapRect.x+this._heatMapRect.width&&e>=this._heatMapRect.y&&e<=this._heatMapRect.y+this._heatMapRect.height}updateHeatMapRect(){if(!this._chart)return;const t=this._chart.chartElement();if(!t)return;const e=t.getBoundingClientRect(),i=e.width*.25,r=e.width-i;this._heatMapRect={x:r,y:0,width:i,height:e.height-29}}showContextMenu(t,e){this.hideContextMenu(),this._menu=document.createElement("div"),this._menu.style.position="fixed",this._menu.style.left=`${t}px`,this._menu.style.top=`${e}px`,this._menu.style.background=this._theme?.panel.backgroundColor||"#FFFFFF",this._menu.style.border=`1px solid ${this._theme?.panel.borderColor||"#E1E5E9"}`,this._menu.style.borderRadius="4px",this._menu.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",this._menu.style.zIndex="1000",this._menu.style.padding="4px 0",this._menu.style.minWidth="120px",this._menu.style.fontFamily="Arial, sans-serif",this._menu.style.fontSize="14px";const i=document.createElement("button");i.textContent=this._i18n?.close||"Close",i.style.background="none",i.style.border="none",i.style.padding="6px 12px",i.style.width="100%",i.style.textAlign="left",i.style.cursor="pointer",i.style.color=this._theme?.modal.textColor||"#2D323D",i.style.transition="background-color 0.2s",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=this._theme?.toolbar.button.hover||"#2D323D"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="transparent"}),i.addEventListener("click",()=>{this.destroy(),this.hideContextMenu()}),this._menu.appendChild(i),document.body.appendChild(this._menu)}hideContextMenu(){this._menu&&(document.body.removeChild(this._menu),this._menu=null)}attached(t){this._chart=t.chart,this._series=t.series,this.requestUpdate(),setTimeout(()=>this.updateHeatMapRect(),0)}updateAllViews(){this.requestUpdate(),this.updateHeatMapRect()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}updateI18n(t){this._i18n=t}updateTheme(t){this._theme=t}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&(this.drawHeatMap(e),this.updateHeatMapRect())}}),[{renderer:()=>this._renderer}]}drawHeatMap(t){const e=this._chartData;if(!e||e.length===0)return;const i=e.filter(d=>!d.isVirtual&&d.volume);if(i.length===0)return;const r=Math.min(...i.map(d=>d.low)),s=Math.max(...i.map(d=>d.high))-r;if(s<=0)return;const a=this._width*.25,o=this._width-a;t.clearRect(o,0,a,this._height);const h=Math.min(200,Math.floor(this._height/2)),l=new Array(h).fill(0);i.forEach(d=>{const p=Math.min(h-1,Math.max(0,Math.floor((d.high-r)/s*h))),f=Math.min(h-1,Math.max(0,Math.floor((d.low-r)/s*h))),k=Math.max(1,p-f+1),P=d.volume/k;for(let _=f;_<=p;_++)l[_]+=P});const g=Math.max(...l);if(g===0)return;const u=2,c=this._height/h;t.save();for(let d=0;d<h;d++){const p=l[d];if(p===0)continue;const f=p/g,P=Math.max(f,.01),_=Math.max(u,a*P),S=Math.pow(P,.5);let b,v,D;if(S<.5){const X=S*2;b=Math.floor(0),v=Math.floor(165*X),D=Math.floor(255*(1-X)+255*X)}else{const X=(S-.5)*2;b=Math.floor(255*X),v=Math.floor(255*(1-X)),D=Math.floor(255*(1-X))}const F=.4+S*.6,R=`rgba(${b}, ${v}, ${D}, ${F})`,H=o+(a-_),j=this._height-(d+1)*c;t.fillStyle=R,t.fillRect(H,j,_,c)}t.restore()}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate(),this._series&&this._series._internal__dataChanged&&this._series._internal__dataChanged()}catch{}}destroy(){const t=this._chart?.chartElement();if(t&&this._contextMenuHandler&&t.removeEventListener("contextmenu",this._contextMenuHandler),this._clickHandler&&document.removeEventListener("click",this._clickHandler),this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),this._series&&this._isAttached)try{this._series.detachPrimitive(this),this._isAttached=!1}catch{}this.hideContextMenu(),this._renderer=null,this._isAttached=!1,this._menu=null,this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this._closeCallBack?.()}reactivate(){if(this._chart&&this._series&&!this._isAttached)try{this._series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(this._chart),this.requestUpdate()}catch{}}}class So{constructor(t,e,i,r){this._chart=null,this._series=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this._cachedProfile=null,this._lastDataHash="",this._widthProportion=.35,this._menu=null,this._profileRect={x:0,y:0,width:0,height:0},this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this.refreshData=n=>{this._chartData=n.props.chartData||[],this._cachedProfile=null,this.requestUpdate()},this._closeCallBack=r,this._config={profileWidth:.15,timeSlotMinutes:30,valueAreaPercent:.7,tickSize:.01,showInitialBalance:!0,showValueArea:!0,maxPriceLevels:80,simplifyTPO:!0},this.initializeMarketProfile(t,e,i)}initializeMarketProfile(t,e,i){this._chartData=t.props.chartData||[],this._i18n=e,this._theme=i,t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(t.props.chart))}bindContextMenu(t){const e=t.chartElement();e&&(this._contextMenuHandler=i=>{this.isInProfileArea(i.offsetX,i.offsetY)&&(i.preventDefault(),this.showContextMenu(i.clientX,i.clientY))},this._clickHandler=i=>{this._menu&&!this._menu.contains(i.target)&&this.hideContextMenu()},this._resizeHandler=()=>this.updateProfileRect(),e.addEventListener("contextmenu",this._contextMenuHandler),document.addEventListener("click",this._clickHandler),window.addEventListener("resize",this._resizeHandler))}isInProfileArea(t,e){return this.updateProfileRect(),t>=this._profileRect.x&&t<=this._profileRect.x+this._profileRect.width&&e>=this._profileRect.y&&e<=this._profileRect.y+this._profileRect.height}updateProfileRect(){if(!this._chart)return;const t=this._chart.chartElement();if(!t)return;const e=t.getBoundingClientRect(),i=e.width*this._widthProportion,r=0;this._profileRect={x:r,y:0,width:i,height:e.height-29}}showContextMenu(t,e){this.hideContextMenu(),this._menu=document.createElement("div"),this._menu.style.position="fixed",this._menu.style.left=`${t}px`,this._menu.style.top=`${e}px`,this._menu.style.background=this._theme?.panel.backgroundColor||"#FFFFFF",this._menu.style.border=`1px solid ${this._theme?.panel.borderColor||"#E1E5E9"}`,this._menu.style.borderRadius="4px",this._menu.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",this._menu.style.zIndex="1000",this._menu.style.padding="4px 0",this._menu.style.minWidth="120px",this._menu.style.fontFamily="Arial, sans-serif",this._menu.style.fontSize="14px";const i=document.createElement("button");i.textContent=this._i18n?.close||"Close",i.style.background="none",i.style.border="none",i.style.padding="6px 12px",i.style.width="100%",i.style.textAlign="left",i.style.cursor="pointer",i.style.color=this._theme?.modal.textColor||"#2D323D",i.style.transition="background-color 0.2s",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=this._theme?.toolbar.button.hover||"#2D323D"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="transparent"}),i.addEventListener("click",()=>{this.destroy(),this.hideContextMenu()}),this._menu.appendChild(i),document.body.appendChild(this._menu)}hideContextMenu(){this._menu&&(document.body.removeChild(this._menu),this._menu=null)}attached(t){this._chart=t.chart,this._series=t.series,this.requestUpdate(),setTimeout(()=>this.updateProfileRect(),0)}updateAllViews(){this.requestUpdate(),this.updateProfileRect()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}updateI18n(t){this._i18n=t}updateTheme(t){this._theme=t}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&(this.drawMarketProfile(e),this.updateProfileRect())}}),[{renderer:()=>this._renderer}]}drawMarketProfile(t){const e=this._chartData;if(!e||e.length===0)return;const i=this.getDataHash(e);if((!this._cachedProfile||this._lastDataHash!==i)&&(this._cachedProfile=this.calculateProfile(e),this._lastDataHash=i),!this._cachedProfile)return;const r=this._width*this._widthProportion;t.clearRect(0,0,r,this._height),this.drawProfileBars(t,this._cachedProfile,r),this._config.showValueArea&&this.drawValueArea(t,this._cachedProfile,r)}getDataHash(t){return t.length===0?"empty":`${t.length}_${t[0].time}_${t[t.length-1].time}`}calculateProfile(t){if(t.length===0)return null;const e=t.filter(u=>!u.isVirtual);if(e.length===0)return null;const i=Math.min(...e.map(u=>u.low)),r=Math.max(...e.map(u=>u.high)),n=r-i;if(n<=0)return null;const s=Math.min(this._config.maxPriceLevels,Math.floor(this._height/3)),a=n/s,o=[];for(let u=0;u<=s;u++)o.push({price:i+u*a,count:0,volume:0});e.forEach(u=>{const c=this.findPriceLevel(o,u.high),d=this.findPriceLevel(o,u.low);for(let p=d;p<=c;p++)o[p].count++,o[p].volume+=u.volume||0});const h=Math.max(...o.map(u=>u.count)),l=o.find(u=>u.count===h),g=this.calculateSimpleValueArea(o,this._config.valueAreaPercent);return{levels:o,minPrice:i,maxPrice:r,priceRange:n,poc:l?l.price:i+n/2,valueAreaHigh:g.high,valueAreaLow:g.low,maxCount:h}}findPriceLevel(t,e){const i=t[0].price,r=t[t.length-1].price,n=r-i;return e<=i?0:e>=r?t.length-1:Math.min(t.length-1,Math.max(0,Math.floor((e-i)/n*t.length)))}calculateSimpleValueArea(t,e){const r=t.reduce((l,g)=>l+g.count,0)*e,n=Math.max(...t.map(l=>l.count)),s=t.findIndex(l=>l.count===n);let a=0,o=s,h=s;for(;a<r&&(o<t.length-1||h>0);){let l=o<t.length-1?t[o+1].count:0,g=h>0?t[h-1].count:0;if(l>=g&&o<t.length-1)o++,a+=t[o].count;else if(h>0)h--,a+=t[h].count;else break}return{high:t[o].price,low:t[h].price}}drawProfileBars(t,e,i){const{levels:r,minPrice:n,maxPrice:s,priceRange:a,maxCount:o}=e;if(a<=0)return;t.save();const h=i,l=this._height/r.length;r.forEach(g=>{if(g.count===0)return;const u=(g.price-n)/a,c=this._height-u*this._height,d=g.count/o,p=l,f=this.getProfileColor(d);t.fillStyle=f;const k=Math.max(2,h*d*.8);t.fillRect(0,c-p/2,k,p)}),t.restore()}drawValueArea(t,e,i){const{valueAreaHigh:r,valueAreaLow:n,minPrice:s,maxPrice:a,priceRange:o,poc:h}=e;if(o<=0)return;const l=(r-s)/o,g=(n-s)/o,u=(h-s)/o,c=this._height-l*this._height,d=this._height-g*this._height,p=this._height-u*this._height;t.save(),t.fillStyle="rgba(255, 215, 0, 0.1)",t.fillRect(0,c,i,d-c),t.strokeStyle="rgba(255, 215, 0, 0.6)",t.lineWidth=1,t.setLineDash([3,2]),t.beginPath(),t.moveTo(0,c),t.lineTo(i,c),t.stroke(),t.beginPath(),t.moveTo(0,d),t.lineTo(i,d),t.stroke(),t.strokeStyle="rgba(255, 0, 0, 0.8)",t.setLineDash([]),t.lineWidth=1,t.beginPath(),t.moveTo(0,p),t.lineTo(i,p),t.stroke(),t.restore()}getProfileColor(t){return t<.3?"rgba(100, 150, 255, 0.4)":t<.6?"rgba(50, 100, 200, 0.6)":"rgba(0, 50, 150, 0.8)"}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate(),this._series&&this._series._internal__dataChanged&&this._series._internal__dataChanged()}catch{}}destroy(){const t=this._chart?.chartElement();if(t&&this._contextMenuHandler&&t.removeEventListener("contextmenu",this._contextMenuHandler),this._clickHandler&&document.removeEventListener("click",this._clickHandler),this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),this._series&&this._isAttached)try{this._series.detachPrimitive(this),this._isAttached=!1}catch{}this.hideContextMenu(),this._renderer=null,this._isAttached=!1,this._menu=null,this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this._closeCallBack?.()}reactivate(){if(this._chart&&this._series&&!this._isAttached)try{this._series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(this._chart),this.requestUpdate()}catch{}}}class bo extends O.Component{constructor(t){super(t),this.canvasRef=O.createRef(),this.containerRef=O.createRef(),this.allDrawings=[],this.doubleClickTimeout=null,this.chartEventManager=null,this.originalChartOptions=null,this.currentMarkSettingsStyle=null,this.chartMarkManager=null,this.chartMarkTextEditManager=null,this.mainChartTechnicalIndicatorManager=null,this.staticMarkManager=null,this.volume=null,this.volumeHeatMap=null,this.marketProfile=null,this.mainChartManager=null,this.swtichMainChartType=()=>{this.mainChartManager?.switchChartType(this.props.currentMainChartType),this.mainChartManager?.refreshData(),this.updateStaticMark()},this.setCursorType=e=>{e&&this.setState({cursorType:e})},this.initializeMainChartIndicators=()=>{if(!this.mainChartTechnicalIndicatorManager)return;const{selectedMainChartIndicator:e}=this.props;e&&this.updateSelectedMainChartIndicators()},this.updateAllMainChartIndicatorData=()=>{const{selectedMainChartIndicators:e}=this.state;e.forEach(i=>{i.type!==null&&this.mainChartTechnicalIndicatorManager?.updateAllMainChartIndicatorData(this,i)})},this.updateMainChartIndicators=()=>{const{selectedMainChartIndicators:e}=this.state;e.forEach(i=>{i.type!==null&&(this.mainChartTechnicalIndicatorManager?.removeIndicator(this.props.chart,i.type),this.mainChartTechnicalIndicatorManager?.updateMainChartIndicator(this,i))})},this.updateSelectedMainChartIndicators=()=>{if(!this.mainChartTechnicalIndicatorManager||!this.props.chartData)return;const{selectedMainChartIndicator:e}=this.props;e&&(E.HEATMAP===e.type||E.MARKETPROFILE===e.type||this.setState(i=>{const r=i.selectedMainChartIndicators.some(o=>o.type===e.type);let n;r?n=i.selectedMainChartIndicators.map(o=>o.type===e.type?e:o):n=[...i.selectedMainChartIndicators,e];const s=n.map(o=>o.type).filter(o=>o!==null),a=Ct().map(o=>{if(o.type&&s.includes(o.type)){const h=n.find(l=>l.type===o.type);return{...o,visible:!0,params:h?.params||o.params}}return{...o,visible:!1}});return{selectedMainChartIndicators:n,selectedMainChartIndicatorTypes:s,modalConfirmChartInfoIndicators:a}},()=>{this.updateMainChartIndicators()}))},this.handleOpenIndicatorSettings=e=>{e.type&&this.setState({modalEditingChartInfoIndicator:e,isMainChartIndicatorsModalOpen:!0})},this.handleMainChartIndicatorsSettingConfirm=e=>{e.params&&(e.params=e.params.filter(i=>i.paramValue!==0));try{this.mainChartTechnicalIndicatorManager?.updateMainChartIndicator(this,e),this.setState(i=>({selectedMainChartIndicators:i.selectedMainChartIndicators.map(r=>r.type===e.type?e:r)})),this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null})}catch{this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null})}},this.handleRemoveIndicator=e=>{!e||!this.mainChartTechnicalIndicatorManager||!this.props.chart||(this.mainChartTechnicalIndicatorManager.removeIndicator(this.props.chart,e),this.setState(i=>({selectedMainChartIndicators:i.selectedMainChartIndicators.filter(r=>r.type!==e),selectedMainChartIndicatorTypes:i.selectedMainChartIndicatorTypes.filter(r=>r!==e)})),this.props.onMainChartIndicatorChange&&this.props.selectedMainChartIndicator?.type===e&&this.props.onMainChartIndicatorChange(null),this.props.onToolSelect&&this.props.selectedMainChartIndicator?.type===e&&this.props.onToolSelect(""))},this.setMockKLineMarkMode=()=>{this.chartMarkManager?.setMockKLineMarkMode(this)},this.initializeGraphManager=()=>{this.chartMarkManager?.initializeMarkManager(this)},this.initializeGraphManagerProps=()=>{this.chartMarkManager?.initializeMarkManagerProps(this)},this.destroyGraphManager=()=>{this.chartMarkManager?.destroyMarkManager()},this.showAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.showAllMarks()},this.hideAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.hideAllMarks()},this.clearAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.deleteAllMark()},this.setSchiffPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSchiffPitchforkMode(this)},this.setHeatMapMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHeatMapMode(this)},this.setTextEditMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTextEditMarkMode(this)},this.setBubbleBoxMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setBubbleBoxMarkMode(this)},this.setPinMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPinMarkMode(this)},this.setEmojiMarkMode=e=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEmojiMarkMode(this,e)},this.setSignpostMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSignpostMarkMode(this)},this.setPriceNoteMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceNoteMarkMode(this)},this.setFlagMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFlagMarkMode(this)},this.setPriceLabelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceLabelMode(this)},this.setShortPositionMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setShortPositionMarkMode(this)},this.setLongPositionMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLongPositionMarkMode(this)},this.setThickArrowLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setThickArrowLineMode(this)},this.setEraserMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEraserMode(this)},this.setMarkerPenMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setMarkerPenMode(this)},this.setBrushMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setBrushMode(this)},this.setPenMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPenMode(this)},this.setPencilMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPencilMode(this)},this.setTimePriceRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTimePriceRangeMarkMode(this)},this.setPriceRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceRangeMarkMode(this)},this.setTimeRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTimeRangeMarkMode(this)},this.setElliottTripleCombinationMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottTripleCombinationMode(this)},this.setElliottDoubleCombinationMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottDoubleCombinationMode(this)},this.setElliottTriangleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottTriangleMode(this)},this.setElliottCorrectiveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottCorrectiveMode(this)},this.setElliottImpulseMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottImpulseMode(this)},this.setTriangleABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTriangleABCDMode(this)},this.setABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setABCDMode(this)},this.setHeadAndShouldersMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHeadAndShouldersMode(this)},this.setXABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setXABCDMode(this)},this.setDoubleCurveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setDoubleCurveMode(this)},this.setCurveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setCurveMode(this)},this.setSectorMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSectorMode(this)},this.setFibonacciExtensionBaseTimeMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciExtensionBaseTimeMode(this)},this.setFibonacciExtensionBasePriceMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciExtensionBasePriceMode(this)},this.setFibonacciChannelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciChannelMode(this)},this.setFibonacciFanMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciFanMode(this)},this.setFibonacciWedgeMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciWedgeMode(this)},this.setFibonacciSpiralMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciSpiralMode(this)},this.setFibonacciCircleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciCircleMode(this)},this.setFibonacciArcMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciArcMode(this)},this.setFibonacciRetracementMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciRetracementMode(this)},this.setFibonacciTimeZoonMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciTimeZoonMode(this)},this.setGannRectangleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannRectangleMode(this)},this.setGannBoxMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannBoxMode(this)},this.setGannFanMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannFanMode(this)},this.setTriangleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTriangleMarkMode(this)},this.setEllipseMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEllipseMarkMode(this)},this.setCircleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setCircleMarkMode(this)},this.setRectangleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setRectangleMarkMode(this)},this.setEnhancedAndrewPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEnhancedAndrewPitchforkMode(this)},this.setAndrewPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setAndrewPitchforkMode(this)},this.setDisjointChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setDisjointChannelMarkMode(this)},this.setEquidistantChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEquidistantChannelMarkMode(this)},this.setLinearRegressionChannelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLinearRegressionChannelMode(this)},this.setLineSegmentMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLineSegmentMarkMode(this)},this.setHorizontalLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHorizontalLineMode(this)},this.setVerticalLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setVerticalLineMode(this)},this.setArrowLineMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setArrowLineMarkMode(this)},this.setParallelChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setParallelChannelMarkMode(this)},this.showGraphMarkToolBar=e=>{if(this.state.selectedGraphMark&&this.state.selectedGraphMark.id===e.id||this.state.selectedGraphMark)return;let i={x:20,y:20};if(e.points.length>0){const r=e.points[0];i={x:Math.max(10,r.x-150),y:Math.max(10,r.y-80)}}this.setState({selectedGraphMark:e,markToolBarPosition:i,showGraphMarkToolBar:!0})},this.closeGraphMarkToolBar=()=>{this.setState({showGraphMarkToolBar:!1})},this.showTableMarkToolBar=e=>{if(this.state.selectedTableMark&&this.state.selectedTableMark.id===e.id||this.state.selectedTableMark)return;let i={x:20,y:20};if(e.points.length>0){const r=e.points[0];i={x:Math.max(10,r.x-150),y:Math.max(10,r.y-80)}}this.setState({selectedTableMark:e,markToolBarPosition:i,showTableMarkToolBar:!0})},this.closeTableMarkToolBar=()=>{this.setState({showTableMarkToolBar:!1})},this.showTextEditMarkToolBar=(e,i)=>{if(this.state.selectedTextEditMark&&this.state.selectedTextEditMark.id===e.id||this.state.selectedTextEditMark)return;let r={x:20,y:20};if(e.points.length>0){const n=e.points[0];r={x:Math.max(10,n.x-150),y:Math.max(10,n.y-80)}}this.setState({selectedTextEditMark:e,markToolBarPosition:r,showTextMarkToolBar:!0,isShowGrapTool:i})},this.closeTextMarkToolBar=()=>{this.setState({showTextMarkToolBar:!1})},this.handleMouseDown=e=>{this.chartEventManager?.mouseDown(this,e)},this.handleMouseUp=e=>{this.chartEventManager?.mouseUp(this,e)},this.handleMouseMove=e=>{this.chartEventManager?.mouseMove(this,e)},this.handleViewportShiftLeft=()=>{this.props.chart&&this.props.viewportManager&&this.props.viewportManager.scrollChart("left")},this.handleViewportShiftRight=()=>{this.props.chart&&this.props.viewportManager&&this.props.viewportManager.scrollChart("right")},this.handleZoomIn=()=>{this.props.viewportManager&&this.props.viewportManager.zoomIn()},this.handleZoomOut=()=>{this.props.viewportManager&&this.props.viewportManager.zoomOut()},this.openIndicatorsModal=()=>{this.setState({isMainChartIndicatorsModalOpen:!0})},this.handleToggleIndicator=e=>{e&&(this.mainChartTechnicalIndicatorManager?.isVisible(e)?this.mainChartTechnicalIndicatorManager?.hideIndicator(e):this.mainChartTechnicalIndicatorManager?.showIndicator(e))},this.renderChartInfo=()=>{const{currentTheme:e,title:i}=this.props,{currentOHLC:r,mousePosition:n,showOHLC:s,maIndicatorValues:a,emaIndicatorValues:o,bollingerBandsValues:h,ichimokuValues:l,donchianChannelValues:g,envelopeValues:u,vwapValue:c,selectedMainChartIndicators:d}=this.state;return m.jsx(En,{currentTheme:e,title:i,currentOHLC:r,mousePosition:n,showOHLC:s,onToggleOHLC:this.toggleOHLCVisibility,onOpenIndicatorsModal:this.openIndicatorsModal,onOpenIndicatorSettings:this.handleOpenIndicatorSettings,onRemoveIndicator:this.handleRemoveIndicator,onToggleIndicator:this.handleToggleIndicator,visibleIndicatorTypes:this.state.selectedMainChartIndicatorTypes,indicators:d,maIndicatorValues:a,emaIndicatorValues:o,bollingerBandsValues:h,ichimokuValues:l,donchianChannelValues:g,envelopeValues:u,vwapValue:c,i18n:this.props.i18n})},this.handleIndicatorsClose=()=>{this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null,selectedMainChartIndicators:[]})},this.setImageMarkMode=()=>{this.chartMarkManager?.imageMarkManager&&this.setState({isImageUploadModalOpen:!0})},this.handleImageConfirm=e=>{if(this.setSelectedImageUrl(e),this.setState({isImageUploadModalOpen:!1}),this.chartMarkManager?.imageMarkManager){this.chartMarkManager?.imageMarkManager.setSelectedImageUrl(e);const i=this.chartMarkManager?.imageMarkManager.startImageMarkMode();this.setState({isImageMarkMode:i.isImageMarkMode,imageMarkStartPoint:i.imageMarkStartPoint,currentImageMark:i.currentImageMark,currentMarkMode:C.Image})}},this.handleImageUploadClose=()=>{this.setState({isImageUploadModalOpen:!1}),this.props.onCloseDrawing&&this.props.onCloseDrawing()},this.setSelectedImageUrl=e=>{this.chartMarkManager?.imageMarkManager&&this.chartMarkManager?.imageMarkManager.setSelectedImageUrl(e),this.setState({selectedImageUrl:e})},this.handleChangeTextMarkFontColor=e=>{this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({color:e})},this.handleChangeTextMarkStyle=e=>{let i=e.isBold,r=e.isItalic;this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({isBold:i,isItalic:r})},this.handleChangeTextMarkFontSize=e=>{this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({fontSize:e})},this.handleChangeTextMarkGraphColor=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphColor:e})},this.handleChangeTextMarkGraphLineStyle=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphLineStyle:e})},this.handleChangeTextMarkGraphLineWidth=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphLineWidth:e})},this.handleDeleteTextEditMark=()=>{if(!this.state.selectedTextEditMark)return;const e=this.state.selectedTextEditMark,i=e.markType;this.chartMarkManager?.deleteMark(i,e.properties.originalMark),this.setState({selectedTextEditMark:null,markToolBarPosition:{x:20,y:20}})},this.handleTextMarkEditorSave=(e,i,r,n,s)=>{if(this.setState({isTextMarkEditorOpen:!1}),!!this.state.selectedTextEditMark&&(i&&this.handleChangeTextMarkFontColor(i),r&&this.handleChangeTextMarkFontSize(r),n&&this.handleChangeTextMarkStyle({isBold:n}),s&&this.handleChangeTextMarkStyle({isItalic:s}),e))switch(this.state.selectedTextEditMark.markType){case C.TextEdit:this.state.selectedTextEditMark.mark.updateText(e);break;case C.BubbleBox:this.state.selectedTextEditMark.mark.updateText(e);break;case C.Pin:this.state.selectedTextEditMark.mark.updateText(e);break;case C.SignPost:this.state.selectedTextEditMark.mark.updateText(e);break}},this.handleTextMarkEditorCancel=()=>{this.setState({isTextMarkEditorOpen:!1}),this.state.selectedTextEditMark},this.handleDeleteGraphMark=()=>{if(!this.state.selectedGraphMark)return;const e=this.state.selectedGraphMark;e.properties?.originalMark&&this.chartMarkManager?.deleteMark(e.markType,e.properties.originalMark),this.closeGraphMarkToolBar()},this.handleChangeGraphMarkColor=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({color:e})},this.handleChangeGraphMarkStyle=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({lineStyle:e})},this.handleChangeGraphMarkWidth=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({lineWidth:e})},this.handleGraphToolbarDrag=e=>{this.setState({isGraphMarkToolbarDragging:!0,graphMarkToolbarDragStartPoint:e});const i=n=>{if(this.state.isGraphMarkToolbarDragging&&this.state.graphMarkToolbarDragStartPoint){const s=n.clientX-this.state.graphMarkToolbarDragStartPoint.x,a=n.clientY-this.state.graphMarkToolbarDragStartPoint.y;this.setState(o=>({markToolBarPosition:{x:Math.max(0,o.markToolBarPosition.x+s),y:Math.max(0,o.markToolBarPosition.y+a)},graphMarkToolbarDragStartPoint:{x:n.clientX,y:n.clientY}}))}},r=()=>{this.setState({isGraphMarkToolbarDragging:!1,graphMarkToolbarDragStartPoint:null}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",r)},this.handleKeyDown=e=>{this.chartEventManager?.handleKeyDown(this,e)},this.handleDocumentMouseUp=e=>{this.chartEventManager?.documentMouseUp(this,e)},this.handleDocumentMouseDown=e=>{this.chartEventManager?.documentMouseDown(this,e)},this.handleDocumentMouseMove=e=>{this.chartEventManager?.documentMouseMove(this,e)},this.handleDocumentMouseWheel=e=>{this.chartEventManager?.documentMouseWheel(this,e)},this.handleTextMarkToolBarDrag=e=>{this.setState({isTextMarkToolbar:!0,dragStartPoint:e});const i=n=>{if(this.state.isTextMarkToolbar&&this.state.dragStartPoint){const s=n.clientX-this.state.dragStartPoint.x,a=n.clientY-this.state.dragStartPoint.y;this.setState(o=>({markToolBarPosition:{x:Math.max(0,o.markToolBarPosition.x+s),y:Math.max(0,o.markToolBarPosition.y+a)},dragStartPoint:{x:n.clientX,y:n.clientY}}))}},r=()=>{this.setState({isTextMarkToolbar:!1,dragStartPoint:null}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",r)},this.getToolName=e=>"",this.toggleOHLCVisibility=()=>{this.setState(e=>({showOHLC:!e.showOHLC}))},this.renderMainChart=()=>m.jsx("canvas",{ref:this.canvasRef,style:{position:"absolute",top:0,left:0,width:"calc(100% - 60px)",height:"calc(100% - 60px)",pointerEvents:"none",zIndex:1}}),this.showSubChartSettingModal=(e=[],i)=>{this.setState({isSubChartIndicatorsSettingModalOpen:!0,subChartIndicatorsSettingModalParams:e,currentSubChartIndicatorType:i})},this.handleSubChartSettingClose=()=>{this.setState({isSubChartIndicatorsSettingModalOpen:!1,subChartIndicatorsSettingModalParams:[],currentSubChartIndicatorType:null})},this.handleSubChartSettingConfirm=e=>{this.state.currentSubChartIndicatorType&&this.chartPanesManager?.updateSettingsBySubChartIndicatorType(this.props.chartData,e,this.state.currentSubChartIndicatorType),this.handleSubChartSettingClose()},this.state={isDrawing:!1,drawingPoints:[],currentDrawing:null,drawingStartPoint:null,drawings:[],selectedTextEditMark:null,selectedTableMark:null,selectedGraphMark:null,markToolBarPosition:{x:20,y:20},isTextMarkToolbar:!1,dragStartPoint:null,history:[],historyIndex:-1,isDragging:!1,isResizing:!1,isRotating:!1,resizeHandle:null,isTextInputActive:!1,textInputPosition:null,textInputValue:"",textInputCursorVisible:!0,textInputCursorTimer:null,activePanel:null,editingTextId:null,isFirstTimeTextMode:!1,isEmojiInputActive:!1,emojiInputPosition:null,editingEmojiId:null,mousePosition:null,currentOHLC:null,showOHLC:!0,pendingEmojiMark:null,isTextMarkEditorOpen:!1,textMarkEditorPosition:{x:0,y:0},textMarkEditorInitialData:{text:"",color:"#000000",fontSize:14,isBold:!1,isItalic:!1},lineSegmentMarkStartPoint:null,arrowLineMarkStartPoint:null,parallelChannelMarkStartPoint:null,currentLineSegmentMark:null,currentArrowLineMark:null,currentParallelChannelMark:null,currentMarkMode:null,showGraphMarkToolBar:!1,showTableMarkToolBar:!1,showTextMarkToolBar:!1,isShowGrapTool:!1,isGraphMarkToolbarDragging:!1,graphMarkToolbarDragStartPoint:null,linearRegressionChannelStartPoint:null,currentLinearRegressionChannel:null,equidistantChannelMarkStartPoint:null,currentEquidistantChannelMark:null,disjointChannelMarkStartPoint:null,currentDisjointChannelMark:null,andrewPitchforkHandlePoint:null,andrewPitchforkBaseStartPoint:null,currentAndrewPitchfork:null,enhancedAndrewPitchforkHandlePoint:null,enhancedAndrewPitchforkBaseStartPoint:null,currentEnhancedAndrewPitchfork:null,rectangleMarkStartPoint:null,currentRectangleMark:null,circleMarkStartPoint:null,currentCircleMark:null,ellipseMarkStartPoint:null,currentEllipseMark:null,triangleMarkStartPoint:null,currentTriangleMark:null,gannFanStartPoint:null,currentGannFan:null,gannBoxStartPoint:null,currentGannBox:null,gannRectangleStartPoint:null,currentGannRectangle:null,fibonacciTimeZoonStartPoint:null,currentFibonacciTimeZoon:null,fibonacciRetracementStartPoint:null,currentFibonacciRetracement:null,fibonacciArcStartPoint:null,currentFibonacciArc:null,fibonacciCircleCenterPoint:null,currentFibonacciCircle:null,fibonacciSpiralCenterPoint:null,currentFibonacciSpiral:null,fibonacciWedgeCenterPoint:null,currentFibonacciWedge:null,fibonacciWedgeDrawingStep:0,fibonacciWedgePoints:[],fibonacciFanStartPoint:null,currentFibonacciFan:null,currentFibonacciChannel:null,isFibonacciChannelMode:!1,fibonacciChannelDrawingStep:0,fibonacciExtensionBasePricePoints:[],currentFibonacciExtensionBasePrice:null,fibonacciExtensionBaseTimePoints:[],currentFibonacciExtensionBaseTime:null,sectorPoints:[],currentSector:null,curveMarkStartPoint:null,currentCurveMark:null,doubleCurveMarkStartPoint:null,currentDoubleCurveMark:null,xabcdPoints:[],currentXABCDMark:null,headAndShouldersPoints:[],currentHeadAndShouldersMark:null,abcdPoints:[],currentABCDMark:null,triangleABCDPoints:[],currentTriangleABCDMark:null,elliottImpulsePoints:[],currentElliottImpulseMark:null,elliottCorrectivePoints:[],currentElliottCorrectiveMark:null,elliottTrianglePoints:[],currentElliottTriangleMark:null,elliottDoubleCombinationPoints:[],currentElliottDoubleCombinationMark:null,elliottTripleCombinationPoints:[],currentElliottTripleCombinationMark:null,timeRangeMarkStartPoint:null,currentTimeRangeMark:null,isTimeRangeMarkMode:!1,priceRangeMarkStartPoint:null,currentPriceRangeMark:null,isPriceRangeMarkMode:!1,timePriceRangeMarkStartPoint:null,currentTimePriceRangeMark:null,isTimePriceRangeMarkMode:!1,isPencilMode:!1,isPencilDrawing:!1,currentPencilMark:null,pencilPoints:[],isPenMode:!1,isPenDrawing:!1,currentPenMark:null,penPoints:[],isBrushMode:!1,isBrushDrawing:!1,currentBrushMark:null,brushPoints:[],isMarkerPenMode:!1,isMarkerPenDrawing:!1,currentMarkerPen:null,markerPenPoints:[],isEraserMode:!1,isErasing:!1,eraserHoveredMark:null,thickArrowLineMarkStartPoint:null,currentThickArrowLineMark:null,isImageMarkMode:!1,imageMarkStartPoint:null,currentImageMark:null,showImageModal:!1,selectedImageUrl:"",isImageUploadModalOpen:!1,isLongPositionMarkMode:!1,longPositionMarkStartPoint:null,currentLongPositionMark:null,longPositionDrawingPhase:"none",isLongPositionDragging:!1,dragTarget:null,dragPoint:null,adjustingMode:null,adjustStartData:null,isShortPositionMarkMode:!1,shortPositionMarkStartPoint:null,currentShortPositionMark:null,shortPositionDrawingPhase:"none",isShortPositionDragging:!1,shortPositionDragTarget:null,shortPositionDragPoint:null,shortPositionAdjustingMode:null,shortPositionAdjustStartData:null,isPriceLabelMarkMode:!1,priceLabelMarkPoint:null,currentPriceLabelMark:null,isPriceLabelDragging:!1,priceLabelDragTarget:null,isFlagMarkMode:!1,flagMarkPoint:null,currentFlagMark:null,isFlagDragging:!1,flagDragTarget:null,isPriceNoteMarkMode:!1,priceNoteMarkStartPoint:null,currentPriceNoteMark:null,isPriceNoteDragging:!1,priceNoteDragTarget:null,priceNoteDragPoint:null,isSignpostMarkMode:!1,signpostMarkPoint:null,currentSignpostMark:null,isSignpostDragging:!1,signpostDragTarget:null,isEmojiMarkMode:!1,emojiMarkStartPoint:null,currentEmojiMark:null,isEmojiDragging:!1,emojiDragTarget:null,emojiDragPoint:null,isPinMarkMode:!1,pinMarkPoint:null,currentPinMark:null,isPinDragging:!1,pinDragTarget:null,isBubbleBoxMarkMode:!1,bubbleBoxMarkPoints:null,currentBubbleBoxMark:null,isBubbleBoxDragging:!1,bubbleBoxDragTarget:null,bubbleBoxDragType:null,isTextEditMarkMode:!1,isTextEditDragging:!1,textEditDragTarget:null,isMainChartIndicatorsModalOpen:!1,selectedMainChartIndicators:[],selectedMainChartIndicatorTypes:[],modalEditingChartInfoIndicator:null,modalConfirmChartInfoIndicators:Ct(),maIndicatorValues:{},emaIndicatorValues:{},bollingerBandsValues:{},ichimokuValues:{},donchianChannelValues:{},envelopeValues:{},vwapValue:null,isSubChartIndicatorsSettingModalOpen:!1,subChartIndicatorsSettingModalParams:[],currentSubChartIndicatorType:null,isMockKLineMarkMode:!1,mockKLineMarkStartPoint:null,currentMockKLineMark:null,isMockKLineDragging:!1,mockKLineDragTarget:null,mockKLineDragPoint:null,isHeatMapMode:!1,heatMapStartPoint:null,currentHeatMap:null,isHeatMapDragging:!1,heatMapDragTarget:null,heatMapDragPoint:null,heatMapDrawingPhase:"none",heatMapAdjustingMode:null,isSchiffPitchforkMode:!1,schiffPitchforkHandlePoint:null,schiffPitchforkBaseStartPoint:null,currentSchiffPitchfork:null,isSchiffPitchforkDragging:!1,schiffPitchforkDragTarget:null,schiffPitchforkDragPoint:null,schiffPitchforkDrawingPhase:"none",schiffPitchforkAdjustingMode:null,cursorType:st.Crosshair},this.chartEventManager=new Ci,this.chartMarkManager=new Cn,this.chartMarkTextEditManager=new wn,this.mainChartTechnicalIndicatorManager=new Dn(this.props.currentTheme),this.initializeGraphManager(),this.staticMarkManager=new Bn,this.chartPanesManager=new io,this.mainChartManager=new Po(this,this.props.currentTheme)}componentDidMount(){this.setupCanvas(),this.setupAllDocumentEvents(),this.setupAllContainerEvents(),this.initializeMainChartIndicators(),this.chartMarkTextEditManager?.setupBubbleBoxMarkEvents(this),this.chartMarkTextEditManager?.setupSignPostMarkEvents(this),this.chartMarkTextEditManager?.setupPinMarkEvents(this),this.chartMarkTextEditManager?.setupTextEditMarkEvents(this),this.initStaticMark(),this.props.chart?this.chartEventManager?.registerCrosshairMoveEvent(this):setTimeout(()=>{this.props.chart&&this.chartEventManager?.registerCrosshairMoveEvent(this)},100),setTimeout(()=>{this.mainChartManager?.switchChartType(W.Candle),this.volume=new so(this),this.props.chart&&this.chartPanesManager?.setChartInstance(this.props.chart)},50)}componentDidUpdate(t){(t.chartSeries!==this.props.chartSeries||t.chart!==this.props.chart)&&this.initializeGraphManagerProps(),t.i18n!==this.props.i18n&&(this.volumeHeatMap?.updateI18n(this.props.i18n),this.marketProfile?.updateI18n(this.props.i18n)),t.currentTheme!==this.props.currentTheme&&(this.volumeHeatMap?.updateTheme(this.props.currentTheme),this.marketProfile?.updateTheme(this.props.currentTheme)),this.hasChartDataChanged(t.chartData,this.props.chartData)?(this.handleUpdateMainChartMaps(),this.updateAllMainChartIndicatorData(),this.chartPanesManager?.updateAllPaneData(this.props.chartData),this.volume?.refreshData(this),this.mainChartManager?.refreshData(),this.volumeHeatMap?.refreshData(this)):this.hasMainChartIndicatorChanged(t.selectedMainChartIndicator,this.props.selectedMainChartIndicator)&&(this.handleInitMainChartMaps(),this.updateSelectedMainChartIndicators(),this.chartPanesManager?.updateAllPaneData(this.props.chartData),this.volume?.refreshData(this),this.mainChartManager?.refreshData()),t.currentMainChartType!==this.props.currentMainChartType&&this.swtichMainChartType(),t.markData!==this.props.markData&&this.updateStaticMark(),t.currentTheme!==this.props.currentTheme&&this.chartPanesManager?.updateAllPaneTheme(this.props.currentTheme),t.selectedSubChartIndicators!==this.props.selectedSubChartIndicators&&(this.chartPanesManager?.removeAllPane(),setTimeout(()=>{this.props.selectedSubChartIndicators.forEach(e=>{this.chartPanesManager?.addSubChart(this,e,i=>{this.showSubChartSettingModal(this.chartPanesManager?.getParamsByIndicatorType(i),i)},i=>{this.chartPanesManager?.removePaneBySubChartIndicatorType(i),this.props.handleRemoveSubChartIndicator&&this.props.handleRemoveSubChartIndicator(i)})})},0))}componentWillUnmount(){this.cleanupAllDocumentEvents(),document.removeEventListener("keydown",this.handleKeyDown),this.doubleClickTimeout&&clearTimeout(this.doubleClickTimeout),this.cleanupAllContainerEvents(),this.destroyGraphManager(),this.chartMarkTextEditManager?.cleanupBubbleBoxMarkEvents(),this.chartMarkTextEditManager?.cleanupSignPostMarkEvents(),this.chartMarkTextEditManager?.cleanupPinMarkEvents(),this.chartMarkTextEditManager?.cleanupTextEditMarkEvents(),this.volumeHeatMap?.destroy(),this.marketProfile?.destroy(),this.mainChartManager?.destroy()}handleInitMainChartMaps(){this.props.selectedMainChartIndicator&&(this.props.selectedMainChartIndicator.type===E.HEATMAP&&(this.volumeHeatMap||(this.volumeHeatMap=new _o(this,this.props.i18n,this.props.currentTheme,()=>{this.volumeHeatMap=null}),this.volumeHeatMap?.refreshData(this))),this.props.selectedMainChartIndicator.type===E.MARKETPROFILE&&(this.marketProfile||(this.marketProfile=new So(this,this.props.i18n,this.props.currentTheme,()=>{this.marketProfile=null}),this.marketProfile?.refreshData(this))))}handleUpdateMainChartMaps(){this.props.selectedMainChartIndicator&&(this.volumeHeatMap&&this.volumeHeatMap?.refreshData(this),this.marketProfile&&this.marketProfile?.refreshData(this))}hasChartDataChanged(t,e){if(t===e)return!1;if(!t||!e||t.length!==e.length)return!0;const i=Math.min(t.length,e.length,5);for(let r=0;r<i;r++)if(t[r].time!==e[r].time)return!0;return!1}hasMainChartIndicatorChanged(t,e){return t===e?!1:!t||!e?!0:t.type!==e.type||t.nonce!==e.nonce||JSON.stringify(t.params)!==JSON.stringify(e.params)}initStaticMark(){setTimeout(()=>{this.props.markData&&this.staticMarkManager?.addMark(this.props.markData,{series:this.mainChartManager?.getCurrentSeries(),type:"mark"})},200)}updateStaticMark(){this.props.markData&&this.staticMarkManager?.addMark(this.props.markData,{series:this.mainChartManager?.getCurrentSeries(),type:"mark"})}setupAllContainerEvents(){if(!this.containerRef.current)return;const t=this.containerRef.current;t.addEventListener("mousedown",this.handleMouseDown),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseup",this.handleMouseUp)}cleanupAllContainerEvents(){if(!this.containerRef.current)return;const t=this.containerRef.current;t.removeEventListener("mousedown",this.handleMouseDown),t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseup",this.handleMouseUp)}setupAllDocumentEvents(){document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("mousemove",this.handleDocumentMouseMove),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("mouseup",this.handleDocumentMouseUp),document.addEventListener("wheel",this.handleDocumentMouseWheel)}cleanupAllDocumentEvents(){document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("mousemove",this.handleDocumentMouseMove),document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("mouseup",this.handleDocumentMouseUp),document.removeEventListener("wheel",this.handleDocumentMouseWheel)}serializeDrawings(){return JSON.stringify(this.allDrawings)}setupCanvas(){const t=this.canvasRef.current,e=this.containerRef.current;if(!t||!e)return;const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height}getDrawingLayerElementsPosition(){const t=[];return this.containerRef.current&&(this.containerRef.current.querySelectorAll(".drawing-text-element").forEach(r=>{const n=r.getAttribute("data-text-id");if(n){const s=r,a=s.getBoundingClientRect(),o=this.containerRef.current.getBoundingClientRect();t.push({id:n,type:"text",position:{x:a.left-o.left,y:a.top-o.top},element:s})}}),this.containerRef.current.querySelectorAll(".drawing-emoji-element").forEach(r=>{const n=r.getAttribute("data-emoji-id");if(n){const s=r,a=s.getBoundingClientRect(),o=this.containerRef.current.getBoundingClientRect();t.push({id:n,type:"emoji",position:{x:a.left-o.left,y:a.top-o.top},element:s})}})),t}setDrawingLayerElementsPosition(t){this.containerRef.current&&t.forEach(e=>{let i=null;if(e.type==="text"?i=this.containerRef.current.querySelector(`[data-text-id="${e.id}"]`):e.type==="emoji"&&(i=this.containerRef.current.querySelector(`[data-emoji-id="${e.id}"]`)),i){i.style.position="absolute",i.style.left=`${e.position.x}px`,i.style.top=`${e.position.y}px`;const r=this.allDrawings.findIndex(n=>n.id===e.id);r!==-1&&this.allDrawings[r].points.length>0&&(this.allDrawings[r].points[0]={...e.position})}})}moveDrawingLayerElements(t,e){if(!this.containerRef.current)return;this.containerRef.current.querySelectorAll(".drawing-text-element").forEach(n=>{const s=n,a=parseInt(s.style.left)||0,o=parseInt(s.style.top)||0;s.style.left=`${a+t}px`,s.style.top=`${o+e}px`}),this.containerRef.current.querySelectorAll(".drawing-emoji-element").forEach(n=>{const s=n,a=parseInt(s.style.left)||0,o=parseInt(s.style.top)||0;s.style.left=`${a+t}px`,s.style.top=`${o+e}px`}),this.allDrawings.forEach(n=>{(n.type==="text"||n.type==="emoji")&&n.points.length>0&&(n.points[0].x+=t,n.points[0].y+=e)})}getDrawingLayerElementsByType(t){const e=[];if(!this.containerRef.current)return e;const i=t==="text"?".drawing-text-element":".drawing-emoji-element",r=t==="text"?"data-text-id":"data-emoji-id";return this.containerRef.current.querySelectorAll(i).forEach(s=>{const a=s,o=a.getAttribute(r);if(o){const h=a.getBoundingClientRect(),l=this.containerRef.current.getBoundingClientRect();e.push({id:o,position:{x:h.left-l.left,y:h.top-l.top},element:a})}}),e}disableChartMovement(){this.props.chart&&(this.originalChartOptions=this.props.chart.options(),this.props.chart.applyOptions({handleScroll:!1,handleScale:!1}))}enableChartMovement(){this.props.chart.applyOptions({handleScroll:!0,handleScale:!0})}render(){const{activeTool:t,currentTheme:e,showInfoLayer:i=!0}=this.props,{isTextMarkToolbar:r,showGraphMarkToolBar:n,showTableMarkToolBar:s,markToolBarPosition:a,showTextMarkToolBar:o,selectedTextEditMark:h,selectedTableMark:l,selectedGraphMark:g,isMainChartIndicatorsModalOpen:u,isSubChartIndicatorsSettingModalOpen:c,subChartIndicatorsSettingModalParams:d,currentSubChartIndicatorType:p}=this.state;return m.jsx("div",{style:{width:"100%"},children:m.jsxs("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:5,pointerEvents:t?"auto":"none",opacity:1,display:"block"},children:[i&&m.jsx("div",{style:{position:"absolute",width:"100%",height:"100%"},children:this.renderChartInfo()}),m.jsx("div",{style:{position:"absolute",width:"100%",height:"100%"},children:this.renderMainChart()}),m.jsxs("div",{ref:this.containerRef,style:{position:"absolute",width:"100%",height:"100%",minHeight:"300px"},children:[this.state.isTextMarkEditorOpen&&m.jsx(aa,{isOpen:this.state.isTextMarkEditorOpen,position:this.state.textMarkEditorPosition,theme:this.props.currentTheme,initialText:this.state.textMarkEditorInitialData.text,initialColor:this.state.textMarkEditorInitialData.color,initialFontSize:this.state.textMarkEditorInitialData.fontSize,initialIsBold:this.state.textMarkEditorInitialData.isBold,initialIsItalic:this.state.textMarkEditorInitialData.isItalic,onSave:this.handleTextMarkEditorSave,onCancel:this.handleTextMarkEditorCancel,i18n:this.props.i18n}),c&&m.jsx(ro,{isOpen:c,onClose:this.handleSubChartSettingClose,onConfirm:this.handleSubChartSettingConfirm,initialParams:d,theme:e,parentRef:this.containerRef,indicatorType:p,i18n:this.props.i18n}),this.state.isImageUploadModalOpen&&m.jsx(na,{isOpen:this.state.isImageUploadModalOpen,onClose:this.handleImageUploadClose,onConfirm:this.handleImageConfirm,theme:e,i18n:this.props.i18n}),u&&m.jsx(yn,{isOpen:u,onClose:this.handleIndicatorsClose,onConfirm:this.handleMainChartIndicatorsSettingConfirm,initialIndicator:this.state.modalEditingChartInfoIndicator,theme:e,parentRef:this.containerRef,indicatorType:this.state.modalEditingChartInfoIndicator?.type||null,i18n:this.props.i18n}),o&&m.jsx(vn,{position:a,selectedDrawing:h,theme:e,onClose:this.closeTextMarkToolBar,onDelete:this.handleDeleteTextEditMark,onChangeTextColor:this.handleChangeTextMarkFontColor,onChangeTextStyle:this.handleChangeTextMarkStyle,onChangeTextSize:this.handleChangeTextMarkFontSize,onDragStart:this.handleTextMarkToolBarDrag,isDragging:r,getToolName:this.getToolName,isShowGrapTool:this.state.isShowGrapTool,onChangeGraphColor:this.handleChangeTextMarkGraphColor,onChangeGraphStyle:this.handleChangeTextMarkGraphLineStyle,onChangeGraphLineWidth:this.handleChangeTextMarkGraphLineWidth,i18n:this.props.i18n}),n&&m.jsx(xn,{position:a,selectedDrawing:g,theme:e,onClose:this.closeGraphMarkToolBar,onDelete:this.handleDeleteGraphMark,onChangeColor:this.handleChangeGraphMarkColor,onChangeStyle:this.handleChangeGraphMarkStyle,onChangeWidth:this.handleChangeGraphMarkWidth,onDragStart:this.handleGraphToolbarDrag,isDragging:!1,getToolName:this.getToolName,i18n:this.props.i18n})]})]})})}}class To{constructor(t,e,i,r,n="en"){this.series=null,this.locale=n,this.chart=q.createChart(t,{width:e,height:i,layout:r.layout,grid:{vertLines:{color:r.grid.vertLines.color+"30",style:1,visible:!0},horzLines:{color:r.grid.horzLines.color+"30",style:1,visible:!0}},crosshair:{mode:0},timeScale:{timeVisible:!0,secondsVisible:!1,borderColor:r.grid.vertLines.color},rightPriceScale:{borderColor:r.grid.horzLines.color,scaleMargins:{top:.1,bottom:.1},entireTextOnly:!1},handleScale:{axisPressedMouseMove:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0},localization:{locale:this.locale}})}getChart(){return this.chart}getSeries(){return this.series}getLocale(){return this.locale}}const Co=M=>[{id:"smileys",name:M?.emoji?.categories?.smileys||"表情",getName:t=>t?.emoji?.categories?.smileys||"表情"},{id:"people",name:M?.emoji?.categories?.people||"人物",getName:t=>t?.emoji?.categories?.people||"人物"},{id:"animals",name:M?.emoji?.categories?.animals||"动物",getName:t=>t?.emoji?.categories?.animals||"动物"},{id:"food",name:M?.emoji?.categories?.food||"食物",getName:t=>t?.emoji?.categories?.food||"食物"},{id:"activities",name:M?.emoji?.categories?.activities||"活动",getName:t=>t?.emoji?.categories?.activities||"活动"},{id:"travel",name:M?.emoji?.categories?.travel||"旅行",getName:t=>t?.emoji?.categories?.travel||"旅行"},{id:"objects",name:M?.emoji?.categories?.objects||"物品",getName:t=>t?.emoji?.categories?.objects||"物品"},{id:"symbols",name:M?.emoji?.categories?.symbols||"符号",getName:t=>t?.emoji?.categories?.symbols||"符号"},{id:"flags",name:M?.emoji?.categories?.flags||"旗帜",getName:t=>t?.emoji?.categories?.flags||"旗帜"}],wo=[{character:"😀",name:"笑脸",category:"smileys"},{character:"😃",name:"大笑",category:"smileys"},{character:"😄",name:"微笑",category:"smileys"},{character:"😁",name:"笑嘻嘻",category:"smileys"},{character:"😆",name:"哈哈笑",category:"smileys"},{character:"😅",name:"流汗笑",category:"smileys"},{character:"😂",name:"笑哭",category:"smileys"},{character:"🤣",name:"打滚笑",category:"smileys"},{character:"😊",name:"微笑脸",category:"smileys"},{character:"😇",name:"天使",category:"smileys"},{character:"🙂",name:"微微笑",category:"smileys"},{character:"🙃",name:"倒脸",category:"smileys"},{character:"😉",name:"眨眼",category:"smileys"},{character:"😍",name:"爱心眼",category:"smileys"},{character:"🥰",name:"微笑爱心",category:"smileys"},{character:"😘",name:"飞吻",category:"smileys"},{character:"😋",name:"美味",category:"smileys"},{character:"😎",name:"墨镜",category:"smileys"},{character:"🤩",name:"星星眼",category:"smileys"},{character:"🥳",name:"派对",category:"smileys"},{character:"😏",name:"得意",category:"smileys"},{character:"😢",name:"哭泣",category:"smileys"},{character:"😭",name:"大哭",category:"smileys"},{character:"😡",name:"愤怒",category:"smileys"},{character:"🤯",name:"爆炸头",category:"smileys"},{character:"🥺",name:"恳求脸",category:"smileys"},{character:"😱",name:"尖叫",category:"smileys"},{character:"🤔",name:"思考",category:"smileys"},{character:"😴",name:"睡觉",category:"smileys"},{character:"😷",name:"口罩",category:"smileys"},{character:"🤒",name:"生病",category:"smileys"},{character:"🤕",name:"受伤",category:"smileys"},{character:"🥶",name:"冷脸",category:"smileys"},{character:"🥵",name:"热脸",category:"smileys"},{character:"😈",name:"小恶魔",category:"smileys"},{character:"👿",name:"恶魔",category:"smileys"},{character:"💀",name:"骷髅",category:"smileys"},{character:"👻",name:"鬼魂",category:"smileys"},{character:"👽",name:"外星人",category:"smileys"},{character:"🤖",name:"机器人",category:"smileys"},{character:"👶",name:"婴儿",category:"people"},{character:"👧",name:"女孩",category:"people"},{character:"👦",name:"男孩",category:"people"},{character:"👩",name:"女人",category:"people"},{character:"👨",name:"男人",category:"people"},{character:"👵",name:"老奶奶",category:"people"},{character:"👴",name:"老爷爷",category:"people"},{character:"👮♀️",name:"女警察",category:"people"},{character:"👮♂️",name:"男警察",category:"people"},{character:"👷♀️",name:"女建筑工人",category:"people"},{character:"👷♂️",name:"男建筑工人",category:"people"},{character:"👩⚕️",name:"女医生",category:"people"},{character:"👨⚕️",name:"男医生",category:"people"},{character:"👩🍳",name:"女厨师",category:"people"},{character:"👨🍳",name:"男厨师",category:"people"},{character:"👩🎓",name:"女学生",category:"people"},{character:"👨🎓",name:"男学生",category:"people"},{character:"👸",name:"公主",category:"people"},{character:"🤴",name:"王子",category:"people"},{character:"🦸♀️",name:"女超级英雄",category:"people"},{character:"🦸♂️",name:"男超级英雄",category:"people"},{character:"🦹♀️",name:"女超级反派",category:"people"},{character:"🦹♂️",name:"男超级反派",category:"people"},{character:"🧙♀️",name:"女法师",category:"people"},{character:"🧙♂️",name:"男法师",category:"people"},{character:"🧚♀️",name:"仙女",category:"people"},{character:"🧚♂️",name:"精灵",category:"people"},{character:"🧛♀️",name:"女吸血鬼",category:"people"},{character:"🧛♂️",name:"男吸血鬼",category:"people"},{character:"🧜♀️",name:"美人鱼",category:"people"},{character:"🧜♂️",name:"男人鱼",category:"people"},{character:"🧝♀️",name:"女精灵",category:"people"},{character:"🧝♂️",name:"男精灵",category:"people"},{character:"👼",name:"天使宝宝",category:"people"},{character:"💁♀️",name:"女信息台",category:"people"},{character:"💁♂️",name:"男信息台",category:"people"},{character:"🙅♀️",name:"女禁止",category:"people"},{character:"🙅♂️",name:"男禁止",category:"people"},{character:"💆♀️",name:"女按摩",category:"people"},{character:"💆♂️",name:"男按摩",category:"people"},{character:"🐵",name:"猴脸",category:"animals"},{character:"🐒",name:"猴子",category:"animals"},{character:"🐶",name:"狗脸",category:"animals"},{character:"🐕",name:"狗",category:"animals"},{character:"🐩",name:"贵宾犬",category:"animals"},{character:"🐺",name:"狼",category:"animals"},{character:"🦊",name:"狐狸",category:"animals"},{character:"🐱",name:"猫脸",category:"animals"},{character:"🐈",name:"猫",category:"animals"},{character:"🦁",name:"狮子",category:"animals"},{character:"🐯",name:"老虎脸",category:"animals"},{character:"🐴",name:"马脸",category:"animals"},{character:"🦄",name:"独角兽",category:"animals"},{character:"🦓",name:"斑马",category:"animals"},{character:"🐮",name:"牛脸",category:"animals"},{character:"🐷",name:"猪脸",category:"animals"},{character:"🐭",name:"老鼠脸",category:"animals"},{character:"🐹",name:"仓鼠",category:"animals"},{character:"🐰",name:"兔子脸",category:"animals"},{character:"🐻",name:"熊",category:"animals"},{character:"🐨",name:"考拉",category:"animals"},{character:"🐼",name:"熊猫",category:"animals"},{character:"🐔",name:"鸡",category:"animals"},{character:"🐦",name:"鸟",category:"animals"},{character:"🐧",name:"企鹅",category:"animals"},{character:"🦅",name:"鹰",category:"animals"},{character:"🦆",name:"鸭",category:"animals"},{character:"🦉",name:"猫头鹰",category:"animals"},{character:"🦇",name:"蝙蝠",category:"animals"},{character:"🐸",name:"青蛙",category:"animals"},{character:"🐢",name:"乌龟",category:"animals"},{character:"🐍",name:"蛇",category:"animals"},{character:"🐊",name:"鳄鱼",category:"animals"},{character:"🦖",name:"霸王龙",category:"animals"},{character:"🦕",name:"蜥脚类恐龙",category:"animals"},{character:"🐬",name:"海豚",category:"animals"},{character:"🐳",name:"鲸鱼",category:"animals"},{character:"🦭",name:"海豹",category:"animals"},{character:"🐙",name:"章鱼",category:"animals"},{character:"🦑",name:"乌贼",category:"animals"},{character:"🦐",name:"虾",category:"animals"},{character:"🍎",name:"红苹果",category:"food"},{character:"🍐",name:"梨",category:"food"},{character:"🍊",name:"橙子",category:"food"},{character:"🍋",name:"柠檬",category:"food"},{character:"🍌",name:"香蕉",category:"food"},{character:"🍉",name:"西瓜",category:"food"},{character:"🍇",name:"葡萄",category:"food"},{character:"🍓",name:"草莓",category:"food"},{character:"🍑",name:"桃子",category:"food"},{character:"🍍",name:"菠萝",category:"food"},{character:"🥭",name:"芒果",category:"food"},{character:"🥥",name:"椰子",category:"food"},{character:"🥑",name:"牛油果",category:"food"},{character:"🍅",name:"番茄",category:"food"},{character:"🍆",name:"茄子",category:"food"},{character:"🥦",name:"西兰花",category:"food"},{character:"🥕",name:"胡萝卜",category:"food"},{character:"🌽",name:"玉米",category:"food"},{character:"🍞",name:"面包",category:"food"},{character:"🥐",name:"牛角包",category:"food"},{character:"🧀",name:"奶酪",category:"food"},{character:"🍗",name:"鸡腿",category:"food"},{character:"🍔",name:"汉堡",category:"food"},{character:"🍕",name:"披萨",category:"food"},{character:"🌭",name:"热狗",category:"food"},{character:"🥪",name:"三明治",category:"food"},{character:"🌮",name:"墨西哥卷饼",category:"food"},{character:"🌯",name:"墨西哥卷",category:"food"},{character:"🥗",name:"沙拉",category:"food"},{character:"🍲",name:"火锅",category:"food"},{character:"🥣",name:"碗和勺子",category:"food"},{character:"🍛",name:"咖喱饭",category:"food"},{character:"🍜",name:"面条",category:"food"},{character:"🍝",name:"意大利面",category:"food"},{character:"🍣",name:"寿司",category:"food"},{character:"🍤",name:"炸虾",category:"food"},{character:"🍙",name:"饭团",category:"food"},{character:"🍚",name:"米饭",category:"food"},{character:"🍦",name:"冰淇淋",category:"food"},{character:"🍧",name:"刨冰",category:"food"},{character:"⚽",name:"足球",category:"activities"},{character:"🏀",name:"篮球",category:"activities"},{character:"🏈",name:"美式足球",category:"activities"},{character:"⚾",name:"棒球",category:"activities"},{character:"🎾",name:"网球",category:"activities"},{character:"🏐",name:"排球",category:"activities"},{character:"🎱",name:"台球",category:"activities"},{character:"🏓",name:"乒乓球",category:"activities"},{character:"🏸",name:"羽毛球",category:"activities"},{character:"🥊",name:"拳击手套",category:"activities"},{character:"🎯",name:"射箭靶",category:"activities"},{character:"🎳",name:"保龄球",category:"activities"},{character:"🏹",name:"弓和箭",category:"activities"},{character:"🎣",name:"钓鱼竿",category:"activities"},{character:"⛸️",name:"溜冰鞋",category:"activities"},{character:"🎿",name:"滑雪",category:"activities"},{character:"🏒",name:"冰球",category:"activities"},{character:"🏏",name:"板球",category:"activities"},{character:"🏆",name:"奖杯",category:"activities"},{character:"🥇",name:"金牌",category:"activities"},{character:"🥈",name:"银牌",category:"activities"},{character:"🥉",name:"铜牌",category:"activities"},{character:"🎖️",name:"军奖章",category:"activities"},{character:"🏅",name:"运动奖牌",category:"activities"},{character:"🤿",name:"潜水装备",category:"activities"},{character:"🎣",name:"钓鱼竿",category:"activities"},{character:"🎪",name:"马戏团帐篷",category:"activities"},{character:"🎭",name:"表演艺术",category:"activities"},{character:"🎨",name:"艺术家调色板",category:"activities"},{character:"🎬",name:"场记板",category:"activities"},{character:"🎤",name:"麦克风",category:"activities"},{character:"🎧",name:"耳机",category:"activities"},{character:"🎼",name:"乐谱",category:"activities"},{character:"🎹",name:"电子琴",category:"activities"},{character:"🥁",name:"鼓",category:"activities"},{character:"🎷",name:"萨克斯",category:"activities"},{character:"🎺",name:"小号",category:"activities"},{character:"🎸",name:"吉他",category:"activities"},{character:"🪕",name:"班卓琴",category:"activities"},{character:"🎻",name:"小提琴",category:"activities"},{character:"🚗",name:"汽车",category:"travel"},{character:"🚕",name:"出租车",category:"travel"},{character:"🚙",name:"SUV",category:"travel"},{character:"🚌",name:"巴士",category:"travel"},{character:"🚎",name:"电车",category:"travel"},{character:"🏎️",name:"赛车",category:"travel"},{character:"🚓",name:"警车",category:"travel"},{character:"🚑",name:"救护车",category:"travel"},{character:"🚒",name:"消防车",category:"travel"},{character:"🚐",name:"小巴",category:"travel"},{character:"🚚",name:"卡车",category:"travel"},{character:"🚛",name:"铰接式卡车",category:"travel"},{character:"🚲",name:"自行车",category:"travel"},{character:"🛴",name:"滑板车",category:"travel"},{character:"🚁",name:"直升机",category:"travel"},{character:"✈️",name:"飞机",category:"travel"},{character:"🛩️",name:"小飞机",category:"travel"},{character:"🛫",name:"飞机起飞",category:"travel"},{character:"🛬",name:"飞机降落",category:"travel"},{character:"🚀",name:"火箭",category:"travel"},{character:"🛸",name:"飞碟",category:"travel"},{character:"🚂",name:"火车头",category:"travel"},{character:"🚃",name:"火车车厢",category:"travel"},{character:"🚄",name:"高速列车",category:"travel"},{character:"🚅",name:"子弹头列车",category:"travel"},{character:"🚆",name:"火车",category:"travel"},{character:"🚇",name:"地铁",category:"travel"},{character:"🚈",name:"轻轨",category:"travel"},{character:"🚉",name:"车站",category:"travel"},{character:"🚊",name:"电车",category:"travel"},{character:"🚝",name:"单轨铁路",category:"travel"},{character:"🚞",name:"山区铁路",category:"travel"},{character:"🚋",name:"有轨电车",category:"travel"},{character:"🚠",name:"缆车",category:"travel"},{character:"🚡",name:"空中缆车",category:"travel"},{character:"🚢",name:"船",category:"travel"},{character:"⛵",name:"帆船",category:"travel"},{character:"🛶",name:"独木舟",category:"travel"},{character:"🚤",name:"快艇",category:"travel"},{character:"⛴️",name:"渡轮",category:"travel"},{character:"⌚",name:"手表",category:"objects"},{character:"📱",name:"手机",category:"objects"},{character:"📲",name:"手机箭头",category:"objects"},{character:"💻",name:"笔记本电脑",category:"objects"},{character:"⌨️",name:"键盘",category:"objects"},{character:"🖥️",name:"台式电脑",category:"objects"},{character:"🖨️",name:"打印机",category:"objects"},{character:"🖱️",name:"电脑鼠标",category:"objects"},{character:"🕹️",name:"游戏摇杆",category:"objects"},{character:"📷",name:"相机",category:"objects"},{character:"📹",name:"摄像机",category:"objects"},{character:"🎥",name:"电影摄像机",category:"objects"},{character:"📺",name:"电视",category:"objects"},{character:"📻",name:"收音机",category:"objects"},{character:"🎙️",name:"录音麦克风",category:"objects"},{character:"🎚️",name:"音量滑块",category:"objects"},{character:"🎛️",name:"控制旋钮",category:"objects"},{character:"📞",name:"电话听筒",category:"objects"},{character:"📟",name:"寻呼机",category:"objects"},{character:"📠",name:"传真机",category:"objects"},{character:"🔦",name:"手电筒",category:"objects"},{character:"🕯️",name:"蜡烛",category:"objects"},{character:"💡",name:"灯泡",category:"objects"},{character:"🔌",name:"电源插头",category:"objects"},{character:"🔋",name:"电池",category:"objects"},{character:"🪫",name:"低电量",category:"objects"},{character:"💰",name:"钱袋",category:"objects"},{character:"💎",name:"宝石",category:"objects"},{character:"💳",name:"信用卡",category:"objects"},{character:"🧮",name:"算盘",category:"objects"},{character:"📿",name:"念珠",category:"objects"},{character:"🧷",name:"安全别针",category:"objects"},{character:"🔑",name:"钥匙",category:"objects"},{character:"🗝️",name:"老钥匙",category:"objects"},{character:"🛡️",name:"盾牌",category:"objects"},{character:"💊",name:"药丸",category:"objects"},{character:"🧴",name:"乳液瓶",category:"objects"},{character:"🧹",name:"扫帚",category:"objects"},{character:"🧺",name:"篮子",category:"objects"},{character:"🪣",name:"桶",category:"objects"},{character:"❤️",name:"红心",category:"symbols"},{character:"🧡",name:"橙心",category:"symbols"},{character:"💛",name:"黄心",category:"symbols"},{character:"💚",name:"绿心",category:"symbols"},{character:"💙",name:"蓝心",category:"symbols"},{character:"💜",name:"紫心",category:"symbols"},{character:"🖤",name:"黑心",category:"symbols"},{character:"💔",name:"破碎的心",category:"symbols"},{character:"❣️",name:"心叹号",category:"symbols"},{character:"💕",name:"两颗心",category:"symbols"},{character:"💞",name:"旋转的心",category:"symbols"},{character:"💓",name:"跳动的心",category:"symbols"},{character:"💗",name:"长大的心",category:"symbols"},{character:"💖",name:"闪亮的心",category:"symbols"},{character:"💘",name:"箭穿心",category:"symbols"},{character:"💝",name:"丝带心",category:"symbols"},{character:"💟",name:"心形装饰",category:"symbols"},{character:"☮️",name:"和平符号",category:"symbols"},{character:"✝️",name:"拉丁十字架",category:"symbols"},{character:"☪️",name:"星月",category:"symbols"},{character:"🕉️",name:"奥姆符号",category:"symbols"},{character:"✡️",name:"大卫之星",category:"symbols"},{character:"🔯",name:"六角星",category:"symbols"},{character:"🪬",name:"手掌法蒂玛",category:"symbols"},{character:"♈",name:"白羊座",category:"symbols"},{character:"♉",name:"金牛座",category:"symbols"},{character:"♊",name:"双子座",category:"symbols"},{character:"♋",name:"巨蟹座",category:"symbols"},{character:"♌",name:"狮子座",category:"symbols"},{character:"♍",name:"处女座",category:"symbols"},{character:"♎",name:"天秤座",category:"symbols"},{character:"♏",name:"天蝎座",category:"symbols"},{character:"♐",name:"射手座",category:"symbols"},{character:"♑",name:"摩羯座",category:"symbols"},{character:"♒",name:"水瓶座",category:"symbols"},{character:"♓",name:"双鱼座",category:"symbols"},{character:"⛎",name:"蛇夫座",category:"symbols"},{character:"🔀",name:"随机播放",category:"symbols"},{character:"🔁",name:"重复",category:"symbols"},{character:"🔂",name:"重复一次",category:"symbols"},{character:"🏁",name:"方格旗",category:"flags"},{character:"🚩",name:"三角旗",category:"flags"},{character:"🎌",name:"交叉旗",category:"flags"},{character:"🏴",name:"黑旗",category:"flags"},{character:"🏳️",name:"白旗",category:"flags"},{character:"🏳️🌈",name:"彩虹旗",category:"flags"},{character:"🏴☠️",name:"海盗旗",category:"flags"},{character:"🇺🇳",name:"联合国",category:"flags"},{character:"🇺🇸",name:"美国",category:"flags"},{character:"🇬🇧",name:"英国",category:"flags"},{character:"🇨🇳",name:"中国",category:"flags"},{character:"🇯🇵",name:"日本",category:"flags"},{character:"🇰🇷",name:"韩国",category:"flags"},{character:"🇩🇪",name:"德国",category:"flags"},{character:"🇫🇷",name:"法国",category:"flags"},{character:"🇮🇹",name:"意大利",category:"flags"},{character:"🇷🇺",name:"俄罗斯",category:"flags"},{character:"🇨🇦",name:"加拿大",category:"flags"},{character:"🇦🇺",name:"澳大利亚",category:"flags"},{character:"🇧🇷",name:"巴西",category:"flags"},{character:"🇮🇳",name:"印度",category:"flags"},{character:"🇪🇸",name:"西班牙",category:"flags"},{character:"🇲🇽",name:"墨西哥",category:"flags"},{character:"🇮🇩",name:"印度尼西亚",category:"flags"},{character:"🇳🇱",name:"荷兰",category:"flags"},{character:"🇨🇭",name:"瑞士",category:"flags"},{character:"🇸🇪",name:"瑞典",category:"flags"},{character:"🇳🇴",name:"挪威",category:"flags"},{character:"🇩🇰",name:"丹麦",category:"flags"},{character:"🇫🇮",name:"芬兰",category:"flags"},{character:"🇵🇱",name:"波兰",category:"flags"},{character:"🇹🇷",name:"土耳其",category:"flags"},{character:"🇸🇦",name:"沙特阿拉伯",category:"flags"},{character:"🇿🇦",name:"南非",category:"flags"},{character:"🇪🇬",name:"埃及",category:"flags"},{character:"🇳🇬",name:"尼日利亚",category:"flags"},{character:"🇦🇷",name:"阿根廷",category:"flags"},{character:"🇨🇱",name:"智利",category:"flags"},{character:"🇵🇪",name:"秘鲁",category:"flags"},{character:"🇻🇪",name:"委内瑞拉",category:"flags"}],vo=M=>({cursorStyles:[{id:"default",name:M.leftPanel.cursorArrow,description:M.leftPanel.cursorArrowDesc,icon:kr},{id:"crosshair",name:M.leftPanel.cursorCrosshair,description:M.leftPanel.cursorCrosshairDesc,icon:fr},{id:"circle",name:M.leftPanel.cursorCircle,description:M.leftPanel.cursorCircleDesc,icon:Mr},{id:"dot",name:M.leftPanel.cursorDot,description:M.leftPanel.cursorDotDesc,icon:mr},{id:"sparkle",name:M.leftPanel.cursorSparkle,description:M.leftPanel.cursorSparkleDesc,icon:Pr},{id:"emoji",name:M.leftPanel.cursorEmoji,description:M.leftPanel.cursorEmojiDesc,icon:_r}],penTools:[{title:M.leftPanel.penTools,tools:[{id:"pencil",name:M.leftPanel.pencil,description:M.leftPanel.pencilDesc,icon:Si},{id:"pen",name:M.leftPanel.pen,description:M.leftPanel.penDesc,icon:Os},{id:"brush",name:M.leftPanel.brush,description:M.leftPanel.brushDesc,icon:bi},{id:"marker-pen",name:M.leftPanel.markerPen,description:M.leftPanel.markerPenDesc,icon:Is},{id:"eraser",name:M.leftPanel.eraser,description:M.leftPanel.eraserDesc,icon:js}]}],drawingTools:[{title:M.leftPanel.lineTools,tools:[{id:"line-segment",name:M.leftPanel.lineSegment,description:M.leftPanel.lineSegmentDesc,icon:Qr},{id:"horizontal-line",name:M.leftPanel.horizontalLine,description:M.leftPanel.horizontalLineDesc,icon:ts},{id:"vertical-line",name:M.leftPanel.verticalLine,description:M.leftPanel.verticalLineDesc,icon:es}]},{title:M.leftPanel.arrowTools,tools:[{id:"arrow-line",name:M.leftPanel.arrowLine,description:M.leftPanel.arrowLineDesc,icon:is},{id:"thick-arrow-line",name:M.leftPanel.thickArrowLine,description:M.leftPanel.thickArrowLineDesc,icon:rs}]},{title:M.leftPanel.channelTools,tools:[{id:"parallel-channel",name:M.leftPanel.parallelChannel,description:M.leftPanel.parallelChannelDesc,icon:ss},{id:"linear-regression-channel",name:M.leftPanel.linearRegressionChannel,description:M.leftPanel.linearRegressionChannelDesc,icon:as},{id:"equidistant-channel",name:M.leftPanel.equidistantChannel,description:M.leftPanel.equidistantChannelDesc,icon:ns},{id:"disjoint-channel",name:M.leftPanel.disjointChannel,description:M.leftPanel.disjointChannelDesc,icon:os}]},{title:M.leftPanel.pitchforkTools,tools:[{id:"andrew-pitchfork",name:M.leftPanel.andrewPitchfork,description:M.leftPanel.andrewPitchforkDesc,icon:hs},{id:"enhanced-andrew-pitch-fork",name:M.leftPanel.enhancedAndrewPitchfork,description:M.leftPanel.enhancedAndrewPitchforkDesc,icon:ls},{id:"schiff-pitch-fork",name:M.leftPanel.schiffPitchfork,description:M.leftPanel.schiffPitchforkDesc,icon:cs}]}],gannAndFibonacciTools:[{title:M.leftPanel.gannTools,tools:[{id:"gann-fan",name:M.leftPanel.gannFan,description:M.leftPanel.gannFanDesc,icon:lr},{id:"gann-box",name:M.leftPanel.gannBox,description:M.leftPanel.gannBoxDesc,icon:cr},{id:"gann-rectang",name:M.leftPanel.gannRectangle,description:M.leftPanel.gannRectangleDesc,icon:vr}]},{title:M.leftPanel.fibonacciTools,tools:[{id:"fibonacci-time-zoon",name:M.leftPanel.fibonacciTimeZones,description:M.leftPanel.fibonacciTimeZonesDesc,icon:Sr},{id:"fibonacci-retracement",name:M.leftPanel.fibonacciRetracement,description:M.leftPanel.fibonacciRetracementDesc,icon:_i},{id:"fibonacci-arc",name:M.leftPanel.fibonacciArc,description:M.leftPanel.fibonacciArcDesc,icon:br},{id:"fibonacci-circle",name:M.leftPanel.fibonacciCircle,description:M.leftPanel.fibonacciCircleDesc,icon:xr},{id:"fibonacci-spiral",name:M.leftPanel.fibonacciSpiral,description:M.leftPanel.fibonacciSpiralDesc,icon:Cr},{id:"fibonacci-wedge",name:M.leftPanel.fibonacciWedge,description:M.leftPanel.fibonacciWedgeDesc,icon:Tr},{id:"fibonacci-fan",name:M.leftPanel.fibonacciFan,description:M.leftPanel.fibonacciFanDesc,icon:Dr},{id:"fibonacci-channel",name:M.leftPanel.fibonacciChannel,description:M.leftPanel.fibonacciChannelDesc,icon:wr},{id:"fibonacci-extension-base-price",name:M.leftPanel.fibonacciExtensionPrice,description:M.leftPanel.fibonacciExtensionPriceDesc,icon:Fs},{id:"fibonacci-extension-base-time",name:M.leftPanel.fibonacciExtensionTime,description:M.leftPanel.fibonacciExtensionTimeDesc,icon:ys}]}],irregularShapeTools:[{title:M.leftPanel.technicalPatterns,tools:[{id:"xabcd",name:M.leftPanel.xabcdPattern,description:M.leftPanel.xabcdPatternDesc,icon:Er},{id:"head-and-shoulders",name:M.leftPanel.headAndShoulders,description:M.leftPanel.headAndShouldersDesc,icon:yr},{id:"abcd",name:M.leftPanel.abcdPattern,description:M.leftPanel.abcdPatternDesc,icon:Fr},{id:"triangle-abcd",name:M.leftPanel.triangleAbcd,description:M.leftPanel.triangleAbcdDesc,icon:Rr}]},{title:M.leftPanel.elliottWave,tools:[{id:"elliott-lmpulse",name:M.leftPanel.elliottImpulse,description:M.leftPanel.elliottImpulseDesc,icon:Br},{id:"elliott-corrective",name:M.leftPanel.elliottCorrective,description:M.leftPanel.elliottCorrectiveDesc,icon:Ar},{id:"elliott-triangle",name:M.leftPanel.elliottTriangle,description:M.leftPanel.elliottTriangleDesc,icon:Lr},{id:"elliott-double-combo",name:M.leftPanel.elliottDoubleCombo,description:M.leftPanel.elliottDoubleComboDesc,icon:Hr},{id:"elliott-triple-combo",name:M.leftPanel.elliottTripleCombo,description:M.leftPanel.elliottTripleComboDesc,icon:Or}]},{title:M.leftPanel.regularShapes,tools:[{id:"rectangle",name:M.leftPanel.rectangle,description:M.leftPanel.rectangleDesc,icon:sr},{id:"circle",name:M.leftPanel.circle,description:M.leftPanel.circleDesc,icon:nr},{id:"ellipse",name:M.leftPanel.ellipse,description:M.leftPanel.ellipseDesc,icon:dr},{id:"triangle",name:M.leftPanel.triangle,description:M.leftPanel.triangleDesc,icon:or},{id:"sector",name:M.leftPanel.sector,description:M.leftPanel.sectorDesc,icon:Rs},{id:"curve",name:M.leftPanel.curve,description:M.leftPanel.curveDesc,icon:Ir},{id:"double-curve",name:M.leftPanel.doubleCurve,description:M.leftPanel.doubleCurveDesc,icon:jr}]}],projectInfoTools:[{title:M.leftPanel.rangeTools,tools:[{id:"time-range",name:M.leftPanel.timeRange,description:M.leftPanel.timeRangeDesc,icon:Wr},{id:"price-range",name:M.leftPanel.priceRange,description:M.leftPanel.priceRangeDesc,icon:Nr},{id:"time-price-range",name:M.leftPanel.timePriceRange,description:M.leftPanel.timePriceRangeDesc,icon:Ur},{id:"heat-map",name:M.leftPanel.heatMap,description:M.leftPanel.heatMap,icon:ds}]},{title:M.leftPanel.positionTools,tools:[{id:"long-position",name:M.leftPanel.longPosition,description:M.leftPanel.longPositionDesc,icon:Yr},{id:"short-position",name:M.leftPanel.shortPosition,description:M.leftPanel.shortPositionDesc,icon:Xr}]},{title:M.leftPanel.simulationTools,tools:[{id:"mock-kline",name:M.leftPanel.mockKline,description:M.leftPanel.mockKlineDesc,icon:qr}]}],textTools:[{title:M.leftPanel.textTools,tools:[{id:"text",name:M.leftPanel.text,description:M.leftPanel.textDesc,icon:ue},{id:"price-note",name:M.leftPanel.priceNote,description:M.leftPanel.priceNoteDesc,icon:Vr},{id:"bubble-box",name:M.leftPanel.bubbleBox,description:M.leftPanel.bubbleBoxDesc,icon:zr},{id:"pin",name:M.leftPanel.pin,description:M.leftPanel.pinDesc,icon:Gr},{id:"signpost",name:M.leftPanel.signpost,description:M.leftPanel.signpostDesc,icon:$r},{id:"price-label",name:M.leftPanel.priceLabel,description:M.leftPanel.priceLabelDesc,icon:Kr},{id:"flag-mark",name:M.leftPanel.flagMark,description:M.leftPanel.flagMarkDesc,icon:Zr}]},{title:M.leftPanel.contentTools,tools:[{id:"image",name:M.leftPanel.image,description:M.leftPanel.imageDesc,icon:Jr}]}]});class gi{constructor(){this.handleDrawingToolSelect=(t,e)=>{t.setState({isDrawingModalOpen:!t.state.isDrawingModalOpen,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isIrregularShapeModalOpen:!1,isProjectInfoModalOpen:!1}),!t.state.isMarkLocked&&(e==="line-segment"?t.props.drawingLayerRef&&t.props.drawingLayerRef.current&&t.props.drawingLayerRef.current.setLineSegmentMarkMode&&t.props.drawingLayerRef.current.setLineSegmentMarkMode():e==="arrow-line"?t.props.drawingLayerRef&&t.props.drawingLayerRef.current&&t.props.drawingLayerRef.current.setArrowLineMarkMode&&t.props.drawingLayerRef.current.setArrowLineMarkMode():e==="thick-arrow-line"?t.props.drawingLayerRef&&t.props.drawingLayerRef.current&&t.props.drawingLayerRef.current.setThickArrowLineMode&&t.props.drawingLayerRef.current.setThickArrowLineMode():e==="horizontal-line"?t.props.drawingLayerRef?.current?.setHorizontalLineMode&&t.props.drawingLayerRef.current.setHorizontalLineMode():e==="vertical-line"?t.props.drawingLayerRef?.current?.setVerticalLineMode&&t.props.drawingLayerRef.current.setVerticalLineMode():e==="parallel-channel"?t.props.drawingLayerRef?.current?.setParallelChannelMarkMode&&t.props.drawingLayerRef.current.setParallelChannelMarkMode():e==="linear-regression-channel"?t.props.drawingLayerRef?.current?.setLinearRegressionChannelMode&&t.props.drawingLayerRef.current.setLinearRegressionChannelMode():e==="equidistant-channel"?t.props.drawingLayerRef?.current?.setEquidistantChannelMarkMode&&t.props.drawingLayerRef.current.setEquidistantChannelMarkMode():e==="disjoint-channel"?t.props.drawingLayerRef?.current?.setDisjointChannelMarkMode&&t.props.drawingLayerRef.current.setDisjointChannelMarkMode():e==="pitch-fork"?t.props.drawingLayerRef?.current?.setPitchforkMode&&t.props.drawingLayerRef.current.setPitchforkMode():e==="andrew-pitchfork"?t.props.drawingLayerRef?.current?.setAndrewPitchforkMode&&t.props.drawingLayerRef.current.setAndrewPitchforkMode():e==="enhanced-andrew-pitch-fork"?t.props.drawingLayerRef?.current?.setEnhancedAndrewPitchforkMode&&t.props.drawingLayerRef.current.setEnhancedAndrewPitchforkMode():e==="rectangle"?t.props.drawingLayerRef?.current?.setRectangleMarkMode&&t.props.drawingLayerRef.current.setRectangleMarkMode():e==="circle"?t.props.drawingLayerRef?.current?.setCircleMarkMode&&t.props.drawingLayerRef.current.setCircleMarkMode():e==="ellipse"?t.props.drawingLayerRef?.current?.setEllipseMarkMode&&t.props.drawingLayerRef.current.setEllipseMarkMode():e==="triangle"?t.props.drawingLayerRef?.current?.setTriangleMarkMode&&t.props.drawingLayerRef.current.setTriangleMarkMode():e==="gann-fan"?t.props.drawingLayerRef?.current?.setGannFanMode&&t.props.drawingLayerRef.current.setGannFanMode():e==="gann-box"?t.props.drawingLayerRef?.current?.setGannBoxMode&&t.props.drawingLayerRef.current.setGannBoxMode():e==="gann-rectang"?t.props.drawingLayerRef?.current?.setGannRectangleMode&&t.props.drawingLayerRef.current.setGannRectangleMode():e==="fibonacci-time-zoon"?t.props.drawingLayerRef?.current?.setFibonacciTimeZoonMode&&t.props.drawingLayerRef.current.setFibonacciTimeZoonMode():e==="fibonacci-retracement"?t.props.drawingLayerRef?.current?.setFibonacciRetracementMode&&t.props.drawingLayerRef.current.setFibonacciRetracementMode():e==="fibonacci-arc"?t.props.drawingLayerRef?.current?.setFibonacciArcMode&&t.props.drawingLayerRef.current.setFibonacciArcMode():e==="fibonacci-circle"?t.props.drawingLayerRef?.current?.setFibonacciCircleMode&&t.props.drawingLayerRef.current.setFibonacciCircleMode():e==="fibonacci-spiral"?t.props.drawingLayerRef?.current?.setFibonacciSpiralMode&&t.props.drawingLayerRef.current.setFibonacciSpiralMode():e==="fibonacci-wedge"?t.props.drawingLayerRef?.current?.setFibonacciWedgeMode&&t.props.drawingLayerRef.current.setFibonacciWedgeMode():e==="fibonacci-fan"?t.props.drawingLayerRef?.current?.setFibonacciFanMode&&t.props.drawingLayerRef.current.setFibonacciFanMode():e==="fibonacci-channel"?t.props.drawingLayerRef?.current?.setFibonacciChannelMode&&t.props.drawingLayerRef.current.setFibonacciChannelMode():e==="fibonacci-extension-base-price"?t.props.drawingLayerRef?.current?.setFibonacciExtensionBasePriceMode&&t.props.drawingLayerRef.current.setFibonacciExtensionBasePriceMode():e==="fibonacci-extension-base-time"?t.props.drawingLayerRef?.current?.setFibonacciExtensionBaseTimeMode&&t.props.drawingLayerRef.current.setFibonacciExtensionBaseTimeMode():e==="sector"?t.props.drawingLayerRef?.current?.setSectorMode&&t.props.drawingLayerRef.current.setSectorMode():e==="curve"?t.props.drawingLayerRef?.current?.setCurveMode&&t.props.drawingLayerRef.current.setCurveMode():e==="double-curve"?t.props.drawingLayerRef?.current?.setDoubleCurveMode&&t.props.drawingLayerRef.current.setDoubleCurveMode():e==="xabcd"?t.props.drawingLayerRef?.current?.setXABCDMode&&t.props.drawingLayerRef.current.setXABCDMode():e==="head-and-shoulders"?t.props.drawingLayerRef?.current?.setHeadAndShouldersMode&&t.props.drawingLayerRef.current.setHeadAndShouldersMode():e==="abcd"?t.props.drawingLayerRef?.current?.setABCDMode&&t.props.drawingLayerRef.current.setABCDMode():e==="triangle-abcd"?t.props.drawingLayerRef?.current?.setTriangleABCDMode&&t.props.drawingLayerRef.current.setTriangleABCDMode():e==="elliott-lmpulse"?t.props.drawingLayerRef?.current?.setElliottImpulseMode&&t.props.drawingLayerRef.current.setElliottImpulseMode():e==="elliott-corrective"?t.props.drawingLayerRef?.current?.setElliottCorrectiveMode&&t.props.drawingLayerRef.current.setElliottCorrectiveMode():e==="elliott-triangle"?t.props.drawingLayerRef?.current?.setElliottTriangleMode&&t.props.drawingLayerRef.current.setElliottTriangleMode():e==="elliott-double-combo"?t.props.drawingLayerRef?.current?.setElliottDoubleCombinationMode&&t.props.drawingLayerRef.current.setElliottDoubleCombinationMode():e==="elliott-triple-combo"?t.props.drawingLayerRef?.current?.setElliottTripleCombinationMode&&t.props.drawingLayerRef.current.setElliottTripleCombinationMode():e==="time-range"?t.props.drawingLayerRef?.current?.setTimeRangeMarkMode&&t.props.drawingLayerRef.current.setTimeRangeMarkMode():e==="price-range"?t.props.drawingLayerRef?.current?.setPriceRangeMarkMode&&t.props.drawingLayerRef.current.setPriceRangeMarkMode():e==="time-price-range"?t.props.drawingLayerRef?.current?.setTimePriceRangeMarkMode&&t.props.drawingLayerRef.current.setTimePriceRangeMarkMode():e==="text"?t.props.drawingLayerRef?.current?.setTextEditMarkMode&&t.props.drawingLayerRef.current.setTextEditMarkMode():e==="pencil"?t.props.drawingLayerRef?.current?.setPencilMode&&t.props.drawingLayerRef.current.setPencilMode():e==="pen"?t.props.drawingLayerRef?.current?.setPenMode&&t.props.drawingLayerRef.current.setPenMode():e==="brush"?t.props.drawingLayerRef?.current?.setBrushMode&&t.props.drawingLayerRef.current.setBrushMode():e==="marker-pen"?t.props.drawingLayerRef?.current?.setMarkerPenMode&&t.props.drawingLayerRef.current.setMarkerPenMode():e==="eraser"?t.props.drawingLayerRef?.current?.setEraserMode&&t.props.drawingLayerRef.current.setEraserMode():e==="image"?t.props.drawingLayerRef?.current?.setImageMarkMode&&t.props.drawingLayerRef.current.setImageMarkMode():e==="table"?t.props.drawingLayerRef?.current?.setTableMarkMode&&t.props.drawingLayerRef.current.setTableMarkMode():e==="long-position"?t.props.drawingLayerRef?.current?.setLongPositionMarkMode&&t.props.drawingLayerRef.current.setLongPositionMarkMode():e==="short-position"?t.props.drawingLayerRef?.current?.setShortPositionMarkMode&&t.props.drawingLayerRef.current.setShortPositionMarkMode():e==="price-label"?t.props.drawingLayerRef?.current?.setPriceLabelMode&&t.props.drawingLayerRef.current.setPriceLabelMode():e==="flag-mark"?t.props.drawingLayerRef?.current?.setFlagMarkMode&&t.props.drawingLayerRef.current.setFlagMarkMode():e==="price-note"?t.props.drawingLayerRef?.current?.setPriceNoteMarkMode&&t.props.drawingLayerRef.current.setPriceNoteMarkMode():e==="signpost"?t.props.drawingLayerRef?.current?.setSignpostMarkMode&&t.props.drawingLayerRef.current.setSignpostMarkMode():e==="pin"?t.props.drawingLayerRef?.current?.setPinMarkMode&&t.props.drawingLayerRef.current.setPinMarkMode():e==="bubble-box"?t.props.drawingLayerRef?.current?.setBubbleBoxMarkMode&&t.props.drawingLayerRef.current.setBubbleBoxMarkMode():e==="emoji"?t.props.drawingLayerRef?.current?.selectedEmoji&&t.props.drawingLayerRef.current.selectedEmoji():e==="mock-kline"?t.props.drawingLayerRef?.current?.setMockKLineMarkMode&&t.props.drawingLayerRef.current.setMockKLineMarkMode():e==="heat-map"?t.props.drawingLayerRef?.current?.setHeatMapMode&&t.props.drawingLayerRef.current.setHeatMapMode():e==="schiff-pitch-fork"&&t.props.drawingLayerRef?.current?.setSchiffPitchforkMode&&t.props.drawingLayerRef.current.setSchiffPitchforkMode(),t.props.onToolSelect(e),t.setState({isDrawingModalOpen:!1}))}}}class xo extends O.Component{constructor(t){super(t),this.drawingModalRef=O.createRef(),this.emojiPickerRef=O.createRef(),this.cursorModalRef=O.createRef(),this.brushModalRef=O.createRef(),this.rulerModalRef=O.createRef(),this.fibonacciModalRef=O.createRef(),this.gannModalRef=O.createRef(),this.projectInfoModalRef=O.createRef(),this.irregularShapeModalRef=O.createRef(),this.toolManager=new gi,this.functionPopUpWidth="200px",this.emojiSelectPopUpWidth="315px",this.handleToolAction=(e,i)=>{const{lastSelectedTools:r}=this.state,n={isDrawingModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,arrowButtonStates:{}};switch(e){case"toggle-drawing":n.isDrawingModalOpen=!this.state.isDrawingModalOpen,n.arrowButtonStates={drawing:!this.state.isDrawingModalOpen};break;case"toggle-emoji":n.isEmojiSelectPopUpOpen=!this.state.isEmojiSelectPopUpOpen,n.arrowButtonStates={emoji:!this.state.isEmojiSelectPopUpOpen};break;case"toggle-brush":n.isBrushModalOpen=!this.state.isBrushModalOpen,n.arrowButtonStates={brush:!this.state.isBrushModalOpen};break;case"toggle-cursor":n.isCursorModalOpen=!this.state.isCursorModalOpen,n.arrowButtonStates={cursor:!this.state.isCursorModalOpen};break;case"toggle-text":n.isTextToolModalOpen=!this.state.isTextToolModalOpen,n.arrowButtonStates={text:!this.state.isTextToolModalOpen};break;case"toggle-fibonacci":n.isFibonacciModalOpen=!this.state.isFibonacciModalOpen,n.arrowButtonStates={fibonacci:!this.state.isFibonacciModalOpen};break;case"toggle-project-info":n.isProjectInfoModalOpen=!this.state.isProjectInfoModalOpen,n.arrowButtonStates={"project-info":!this.state.isProjectInfoModalOpen};break;case"toggle-irregular-shape":n.isIrregularShapeModalOpen=!this.state.isIrregularShapeModalOpen,n.arrowButtonStates={"irregular-shape":!this.state.isIrregularShapeModalOpen};break;case"select-drawing":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,drawing:i}})),this.toolManager?.handleDrawingToolSelect(this,i),this.props.onToolSelect(i));break;case"select-cursor":i&&(this.setState(s=>({selectedCursor:i,lastSelectedTools:{...s.lastSelectedTools,cursor:i}})),this.handleCursorStyleSelect(i));break;case"select-brush":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,brush:i}})),this.toolManager?.handleDrawingToolSelect(this,i),this.props.onToolSelect(i));break;case"select-text":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,textTool:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-fibonacci":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,fibonacci:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-project-info":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,projectInfo:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-irregular-shape":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,irregularShape:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"activate-tool":if(i){const s=i,a=r[s];this.handleDirectToolActivation(s,a)}break;case"open-system-settings":this.setState({isSystemSettingsModalOpen:!0});break}Object.keys(n).length>0&&this.setState(n)},this.handleDirectToolActivation=(e,i)=>{switch(this.setState({isDrawingModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,arrowButtonStates:{}}),e){case"drawing":this.handleToolAction("select-drawing",i);break;case"brush":this.handleToolAction("select-brush",i);break;case"cursor":this.handleToolAction("select-cursor",i);break;case"fibonacci":this.handleToolAction("select-fibonacci",i);break;case"projectInfo":this.handleToolAction("select-project-info",i);break;case"irregularShape":this.handleToolAction("select-irregular-shape",i);break;case"textTool":this.handleToolAction("select-text",i);break}},this.handleClickOutside=e=>{const i=e.target;if(i.closest(".arrow-button"))return;const n={arrowButtonStates:{}};this.state.isEmojiSelectPopUpOpen&&this.emojiPickerRef.current&&!this.emojiPickerRef.current.contains(i)&&!i.closest(".emoji-button")&&(n.isEmojiSelectPopUpOpen=!1,n.arrowButtonStates.emoji=!1),this.state.isTextToolModalOpen&&this.rulerModalRef.current&&!this.rulerModalRef.current.contains(i)&&!i.closest(".ruler-button")&&(n.isTextToolModalOpen=!1,n.arrowButtonStates.text=!1),this.state.isRulerModalOpen&&this.rulerModalRef.current&&!this.rulerModalRef.current.contains(i)&&!i.closest(".ruler-button")&&(n.isRulerModalOpen=!1,n.arrowButtonStates.ruler=!1),this.state.isDrawingModalOpen&&this.drawingModalRef.current&&!this.drawingModalRef.current.contains(i)&&!i.closest(".drawing-button")&&(n.isDrawingModalOpen=!1,n.arrowButtonStates.drawing=!1),this.state.isEmojiSelectPopUpOpen&&this.emojiPickerRef.current&&!this.emojiPickerRef.current.contains(i)&&!i.closest(".emoji-button")&&(n.isEmojiSelectPopUpOpen=!1),this.state.isBrushModalOpen&&this.brushModalRef.current&&!this.brushModalRef.current.contains(i)&&!i.closest(".brush-button")&&(n.isBrushModalOpen=!1,n.arrowButtonStates.brush=!1),this.state.isCursorModalOpen&&this.cursorModalRef.current&&!this.cursorModalRef.current.contains(i)&&!i.closest(".cursor-button")&&(n.isCursorModalOpen=!1,n.arrowButtonStates.cursor=!1),this.state.isFibonacciModalOpen&&this.fibonacciModalRef.current&&!this.fibonacciModalRef.current.contains(i)&&!i.closest(".fibonacci-button")&&(n.isFibonacciModalOpen=!1,n.arrowButtonStates.fibonacci=!1),this.state.isGannModalOpen&&this.gannModalRef.current&&!this.gannModalRef.current.contains(i)&&!i.closest(".gann-button")&&(n.isGannModalOpen=!1,n.arrowButtonStates.gann=!1),this.state.isProjectInfoModalOpen&&this.projectInfoModalRef.current&&!this.projectInfoModalRef.current.contains(i)&&!i.closest(".project-info-button")&&(n.isProjectInfoModalOpen=!1,n.arrowButtonStates["project-info"]=!1),this.state.isIrregularShapeModalOpen&&this.irregularShapeModalRef.current&&!this.irregularShapeModalRef.current.contains(i)&&!i.closest(".irregular-shape-button")&&(n.isIrregularShapeModalOpen=!1,n.arrowButtonStates["irregular-shape"]=!1),Object.keys(n).length>1&&this.setState(n)},this.handleCursorStyleSelect=e=>{switch(e){case"default":this.props.drawingLayerRef?.current.setCursorType(st.Default);break;case"crosshair":this.props.drawingLayerRef?.current.setCursorType(st.Crosshair);break;case"circle":this.props.drawingLayerRef?.current.setCursorType(st.Circle);break;case"dot":this.props.drawingLayerRef?.current.setCursorType(st.Dot);break;case"sparkle":this.props.drawingLayerRef?.current.setCursorType(st.Crosshair);break;case"emoji":this.props.drawingLayerRef?.current.setCursorType(st.Crosshair);break}},this.handleEmojiSelect=e=>{this.setState({isEmojiSelectPopUpOpen:!1}),!this.state.isMarkLocked&&(this.setState({selectedEmoji:e}),this.props.onEmojiSelect&&this.props.onEmojiSelect(e),this.props.drawingLayerRef&&this.props.drawingLayerRef.current&&this.props.drawingLayerRef.current.setEmojiMarkMode&&this.props.drawingLayerRef.current.setEmojiMarkMode(e),this.props.onToolSelect("emoji"))},this.handleCategorySelect=e=>{this.setState({selectedEmojiCategory:e})},this.renderCursorModal=()=>{const{currentTheme:e,activeTool:i,i18n:r}=this.props,{isCursorModalOpen:n}=this.state,{cursorStyles:s}=this.getToolConfig();return n?m.jsx("div",{ref:this.cursorModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:m.jsx(ft,{title:r.leftPanel.mouseCursor,tools:s,currentTheme:e,activeTool:i,onToolSelect:a=>this.handleToolAction("select-cursor",a),defaultOpen:!0})})}):null},this.renderCursorTools=()=>{const{cursorStyles:e}=this.getToolConfig(),i=e[0],r={id:"cursor",icon:i?.icon||pr,className:"cursor-button",onMainClick:()=>this.handleToolAction("activate-tool","cursor"),onArrowClick:()=>this.handleToolAction("toggle-cursor")};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:this.renderToolButton(r,r.onMainClick,r.onArrowClick,!0,i?.icon)})},this.renderBrushModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isBrushModalOpen:r}=this.state,{penTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.brushModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-brush",o),defaultOpen:!0},s.title))})}):null},this.renderTextToolModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isTextToolModalOpen:r}=this.state,{textTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.rulerModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-text",o),defaultOpen:!0},s.title))})}):null},this.renderEmojiSelectPopUp=()=>{const{currentTheme:e}=this.props,{isEmojiSelectPopUpOpen:i,selectedEmojiCategory:r}=this.state,n=Co(this.props.i18n),s=wo.filter(a=>a.category===r);return i?m.jsxs("div",{ref:this.emojiPickerRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:`${this.emojiSelectPopUpWidth}`,maxHeight:"400px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column",paddingBottom:"0px"},className:"modal-scrollbar",children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0},children:[m.jsx("h3",{style:{margin:0,color:e.layout.textColor,fontSize:"14px",fontWeight:"600"},children:this.props.i18n.leftPanel.selectEmoji}),m.jsx("button",{onClick:()=>this.setState({isEmojiSelectPopUpOpen:!1}),style:{background:"transparent",border:"none",color:e.layout.textColor,cursor:"pointer",fontSize:"16px",padding:"2px 8px",borderRadius:"4px",transition:"background-color 0.2s"},onMouseEnter:a=>{a.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:"×"})]}),m.jsx("div",{style:{display:"flex",flexWrap:"wrap",padding:"8px 12px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,gap:"4px",overflowY:"auto"},className:"custom-scrollbar",children:n.map(a=>m.jsx("button",{onClick:()=>this.handleCategorySelect(a.id),style:{background:r===a.id?e.toolbar.button.active:"transparent",border:`1px solid ${r===a.id?e.toolbar.button.active:e.toolbar.border}`,borderRadius:"6px",padding:"6px 10px",fontSize:"11px",cursor:"pointer",color:e.layout.textColor,whiteSpace:"nowrap",transition:"all 0.2s ease",flexShrink:0,height:"28px"},onMouseEnter:o=>{r!==a.id&&(o.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:o=>{r!==a.id&&(o.currentTarget.style.background="transparent")},children:a.getName?a.getName(this.props.i18n):a.name},a.id))}),m.jsx("div",{style:{flex:1,overflowY:"auto",padding:"12px",maxHeight:"250px"},className:"custom-scrollbar",children:m.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"8px",justifyItems:"center"},children:s.map((a,o)=>m.jsx("button",{onClick:()=>this.handleEmojiSelect(a.character),style:{background:"transparent",border:"1px solid transparent",borderRadius:"6px",padding:"8px",fontSize:"22px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"40px",minWidth:"40px",width:"100%"},onMouseEnter:h=>{h.currentTarget.style.background=e.toolbar.button.hover,h.currentTarget.style.borderColor=e.toolbar.border,h.currentTarget.style.transform="scale(1.1)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent",h.currentTarget.style.borderColor="transparent",h.currentTarget.style.transform="scale(1)"},title:a.getName?a.getName(this.props.i18n):a.name,children:a.character},o))})})]}):null},this.renderDrawingModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isDrawingModalOpen:r}=this.state,{drawingTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.drawingModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-drawing",o),defaultOpen:!0},s.title))})}):null},this.renderToolButton=(e,i,r,n=!1,s)=>{const{currentTheme:a}=this.props,o=s||e.icon,h=this.state.arrowButtonStates[e.id]||!1,l=this.state.toolHoverStates[e.id]||!1;return m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",width:"100%",background:"transparent",transition:"all 0.2s ease"},className:"tool-button-container",onMouseEnter:()=>this.setState(g=>({toolHoverStates:{...g.toolHoverStates,[e.id]:!0}})),onMouseLeave:()=>this.setState(g=>({toolHoverStates:{...g.toolHoverStates,[e.id]:!1}})),children:[m.jsx("button",{title:e.title,onClick:i,className:e.className||"",style:{background:"transparent",border:"none",borderRadius:"0px",padding:"0px",cursor:"pointer",color:a.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"35px",width:n?"35px":"100%",flex:"none"},onMouseEnter:g=>{g.currentTarget.style.background=a.toolbar.button.hover},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:m.jsx(o,{size:23,color:a.toolbar.button.color})},e.id),n&&l&&m.jsx("button",{onClick:g=>{g.stopPropagation(),r()},className:"arrow-button",style:{background:"transparent",border:"none",borderRadius:"0px",cursor:"pointer",color:a.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"35px",width:"13px",flex:"none",fontSize:"12px",fontWeight:"bold",position:"absolute",paddingLeft:"8px",marginLeft:"30px"},onMouseEnter:g=>{g.currentTarget.style.background=a.toolbar.button.hover},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},onMouseDown:g=>{g.currentTarget.style.background=a.toolbar.button.active},onMouseUp:g=>{g.currentTarget.style.background=a.toolbar.button.hover},children:m.jsx("span",{style:{fontSize:"18px"},children:h?"‹":"›"})})]})},this.renderLineTools=()=>{const{drawingTools:e}=this.getToolConfig(),{lastSelectedTools:i}=this.state,r=this.findToolInGroups(e,i.drawing),n={id:"drawing",icon:r?.icon||hr,className:"drawing-button",onMainClick:()=>this.handleToolAction("activate-tool","drawing"),onArrowClick:()=>this.handleToolAction("toggle-drawing")};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px",width:"100%"},children:this.renderToolButton(n,n.onMainClick,n.onArrowClick,!0,r?.icon)})},this.renderFibonacciModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isFibonacciModalOpen:r}=this.state,{gannAndFibonacciTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.fibonacciModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-fibonacci",o),defaultOpen:!0},s.title))})}):null},this.renderProjectInfoModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isProjectInfoModalOpen:r}=this.state,{projectInfoTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.projectInfoModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-project-info",o),defaultOpen:!0},s.title))})}):null},this.renderIrregularShapeModal=()=>{const{currentTheme:e,activeTool:i}=this.props,{isIrregularShapeModalOpen:r}=this.state,{irregularShapeTools:n}=this.getToolConfig();return r?m.jsx("div",{ref:this.irregularShapeModalRef,style:{position:"absolute",top:"60px",left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"500px",overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((s,a)=>m.jsx(ft,{title:s.title,tools:s.tools,currentTheme:e,activeTool:i,onToolSelect:o=>this.handleToolAction("select-irregular-shape",o),defaultOpen:!0},s.title))})}):null},this.renderTecGraphTools=()=>{const{lastSelectedTools:e}=this.state,{irregularShapeTools:i,gannAndFibonacciTools:r,projectInfoTools:n}=this.getToolConfig(),s=this.findToolInGroups(r,e.fibonacci),a=this.findToolInGroups(n,e.projectInfo),o=this.findToolInGroups(i,e.irregularShape),h=[{id:"fibonacci",icon:s?.icon||_i,className:"fibonacci-button",onMainClick:()=>this.handleToolAction("activate-tool","fibonacci"),onArrowClick:()=>this.handleToolAction("toggle-fibonacci")},{id:"project-info",icon:a?.icon||ur,className:"project-info-button",onMainClick:()=>this.handleToolAction("activate-tool","projectInfo"),onArrowClick:()=>this.handleToolAction("toggle-project-info")},{id:"irregular-shape",icon:o?.icon||Si,className:"irregular-shape-button",onMainClick:()=>this.handleToolAction("activate-tool","irregularShape"),onArrowClick:()=>this.handleToolAction("toggle-irregular-shape")}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:h.map(l=>this.renderToolButton(l,l.onMainClick,l.onArrowClick,!0,l.id==="fibonacci"?s?.icon:l.id==="project-info"?a?.icon:o?.icon))})},this.renderTrash=()=>{const{lastSelectedTools:e}=this.state,{penTools:i,textTools:r}=this.getToolConfig(),n=this.findToolInGroups(i,e.brush),s=this.findToolInGroups(r,e.textTool),a=[{id:"clear-all-mark",icon:gr,className:"trash-button",hasArrow:!1,onMainClick:()=>{this.props.drawingLayerRef?.current?.clearAllMark&&this.props.drawingLayerRef.current.clearAllMark()},onArrowClick:()=>{}}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:a.map(o=>this.renderToolButton(o,o.onMainClick,o.onArrowClick,o.hasArrow,o.id==="brush"?n?.icon:o.id==="text"?s?.icon:void 0))})},this.renderMarkTools=()=>{const{lastSelectedTools:e}=this.state,{penTools:i,textTools:r}=this.getToolConfig(),n=this.findToolInGroups(i,e.brush),s=this.findToolInGroups(r,e.textTool),a=[{id:"brush",icon:n?.icon||bi,className:"brush-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","brush"),onArrowClick:()=>this.handleToolAction("toggle-brush")},{id:"text",icon:s?.icon||ue,className:"text-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","textTool"),onArrowClick:()=>this.handleToolAction("toggle-text")},{id:"emoji",icon:ar,className:"emoji-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","emoji"),onArrowClick:()=>this.handleToolAction("toggle-emoji")}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:a.map(o=>this.renderToolButton(o,o.onMainClick,o.onArrowClick,o.hasArrow,o.id==="brush"?n?.icon:o.id==="text"?s?.icon:void 0))})},this.handleSystemSettingsClose=()=>{this.setState({isSystemSettingsModalOpen:!1})},this.handleSystemSettingsConfirm=e=>{this.setState({systemSettings:e,isSystemSettingsModalOpen:!1})},this.renderOtherTools=()=>{const{isMarkLocked:e,isMarkVisibility:i}=this.state,r=[{id:"lock",icon:e?Bs:As,className:"lock-button",onMainClick:()=>{this.setState({isMarkLocked:!e})},onArrowClick:()=>{}},{id:"eye",icon:i?Ls:Hs,className:"eye-button",onMainClick:()=>{const n=!i;this.setState({isMarkVisibility:n}),this.props.drawingLayerRef&&this.props.drawingLayerRef.current&&(n?this.props.drawingLayerRef.current.showAllMark&&this.props.drawingLayerRef.current.showAllMark():this.props.drawingLayerRef.current.hideAllMark&&this.props.drawingLayerRef.current.hideAllMark())},onArrowClick:()=>{}}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:r.map(n=>this.renderToolButton(n,n.onMainClick,n.onArrowClick,!1,void 0))})},this.state={isDrawingModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,selectedEmoji:t.selectedEmoji||"😀",selectedEmojiCategory:"smileys",selectedCursor:"cursor-crosshair",isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,lastSelectedTools:{drawing:"line-segment",brush:"pencil",ruler:"pencil",cursor:"cursor-crosshair",fibonacci:"fibonacci-retracement",projectInfo:"time-range",irregularShape:"rectangle",textTool:"text"},arrowButtonStates:{},toolHoverStates:{},isSystemSettingsModalOpen:!1,systemSettings:{language:"zh-CN",themeMode:"light",autoSave:!0,showGrid:!0,hardwareAcceleration:!0},isMarkLocked:!1,isMarkVisibility:!0},this.toolManager=new gi}componentDidMount(){document.addEventListener("mousedown",t=>this.handleClickOutside(t),!0)}componentWillUnmount(){document.removeEventListener("mousedown",t=>this.handleClickOutside(t),!0)}componentDidUpdate(t){t.selectedEmoji!==this.props.selectedEmoji&&this.props.selectedEmoji&&this.setState({selectedEmoji:this.props.selectedEmoji})}getToolConfig(){return vo(this.props.i18n)}findToolInGroups(t,e){for(const i of t){const r=i.tools.find(n=>n.id===e);if(r)return r}return null}render(){const{showToolbar:t=!0}=this.props;return t?m.jsxs("div",{style:{position:"relative"},children:[m.jsx("div",{style:{background:this.props.currentTheme.panel.backgroundColor,borderRight:`1px solid ${this.props.currentTheme.panel.borderColor}`,display:"flex",flexDirection:"column",width:"50px",boxSizing:"border-box",height:"100%",overflow:"hidden"},children:m.jsxs("div",{style:{flex:1,overflowY:"hidden",overflowX:"hidden",padding:"12px 6px",display:"flex",flexDirection:"column",gap:"0px"},className:"custom-scrollbar",children:[this.renderCursorTools(),this.renderLineTools(),this.renderTecGraphTools(),this.renderMarkTools(),m.jsx("div",{style:{height:"1px",background:this.props.currentTheme.toolbar.border,margin:"10px 0"}}),this.renderOtherTools(),m.jsx("div",{style:{height:"1px",background:this.props.currentTheme.toolbar.border,margin:"10px 0"}}),this.renderTrash()]})}),this.renderDrawingModal(),this.renderBrushModal(),this.renderCursorModal(),this.renderEmojiSelectPopUp(),this.renderFibonacciModal(),this.renderProjectInfoModal(),this.renderIrregularShapeModal(),this.renderTextToolModal()]}):null}}class ft extends O.Component{constructor(t){super(t),this.toggleOpen=()=>{this.setState(e=>({isOpen:!e.isOpen}))},this.state={isOpen:t.defaultOpen||!1}}render(){const{title:t,tools:e,currentTheme:i,activeTool:r,onToolSelect:n}=this.props,{isOpen:s}=this.state;return m.jsxs("div",{style:{borderBottom:`1px solid ${i.toolbar.border}`},children:[m.jsxs("button",{onClick:this.toggleOpen,style:{width:"100%",background:"transparent",border:"none",padding:"12px 12px",color:i.layout.textColor,cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"13px",fontWeight:"600",transition:"background-color 0.2s"},onMouseEnter:a=>{a.currentTarget.style.background=i.toolbar.button.hover},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[m.jsx("span",{children:t}),m.jsx("span",{style:{transform:s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",fontSize:"12px"},children:"▼"})]}),s&&m.jsx("div",{style:{padding:"0px",background:i.toolbar.background},children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:e.map(a=>{const o=a.icon,h=r===a.id;return m.jsxs("button",{onClick:()=>n(a.id),style:{background:h?i.toolbar.button.active:"transparent",border:h?`2px solid ${i.toolbar.button.active}`:"2px solid transparent",padding:"10px 10px",borderRadius:"0px",color:h?i.toolbar.button.activeTextColor||"#FFFFFF":i.layout.textColor,textAlign:"left",cursor:"pointer",fontSize:"12px",fontWeight:"500",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"0px",width:"100%"},onMouseEnter:l=>{h||(l.currentTarget.style.background=i.toolbar.button.hover)},onMouseLeave:l=>{h||(l.currentTarget.style.background="transparent")},children:[m.jsx(o,{size:24,color:h?i.toolbar.button.activeTextColor||i.layout.textColor:i.toolbar.button.color}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,paddingLeft:"5px"},children:[m.jsx("div",{style:{fontWeight:"600",fontSize:"12px",lineHeight:"1.2"},children:a.name}),m.jsx("div",{style:{fontSize:"10px",opacity:.7,lineHeight:"1.2",marginTop:"2px",textAlign:"left"},children:a.description})]})]},a.id)})})})]})}}const re={Indicators:"Indicators",mainChartIndicators:"Main Chart Indicators",subChartIndicators:"Sub Chart Indicators",chartMaps:"Maps",close:"Close",searchIndicators:"Search indicators...",searchChartTypes:"Search chart types...",theme:"Theme",light:"Light",dark:"Dark",timeframe:"Time Frame",chartType:"Chart Type",toolBar:{color:"Color",lineSize:"Line Size",lineStyle:"Line Style",delete:"Delete",close:"Close",fontSize:"Font Size",bold:"Bold",italic:"Italic",selectColor:"Select Color",colorPicker:"Color Picker",solid:"Solid",dashed:"Dashed",dotted:"Dotted",currentColor:"Current Color"},timeframeSections:{second:"Second",minute:"Minute",hour:"Hour",day:"Day",week:"Week",month:"Month"},chartTypes:{candle:"Candlestick",line:"Line",area:"Area",baseline:"Baseline",hollowCandle:"Hollow Candle",heikinAshi:"Heikin Ashi",column:"Column",lineWithMarkers:"Line with Markers",stepLine:"Step Line",bar:"Bar",histogram:"Histogram",pointandfigure:"PointAndFigure",kagi:"Kagi",linebreak:"LineBreak",mountain:"Mountain",baselinearea:"BaseLineArea",highlow:"HighLow",equivolume:"EquiVolume",threelinebreak:"ThreeLineBreak",hlcarea:"HLCArea"},toolbarButtons:{hint:"Hint",replay:"Replay",fullScreen:"Full Screen",screenshot:"Screenshot",contrast:"Contrast"},indicators:{ma:"Moving Average",ema:"Exponential Moving Average",bollinger:"Bollinger Bands",ichimoku:"Ichimoku Cloud",donchian:"Donchian Channel",envelope:"Envelope",vwap:"VWAP",rsi:"RSI",macd:"MACD",volume:"Volume",sar:"Parabolic SAR",kdj:"KDJ",atr:"ATR",stochastic:"Stochastic",cci:"CCI",bbwidth:"BB Width",adx:"ADX",obv:"OBV"},modal:{parameterSettings:"Parameter Settings",parameterName:"Parameter Name",parameterValue:"Value",lineWidth:"Line Width",lineColor:"Color",addParameter:"Add Parameter",deleteParameter:"Delete",keepAtLeastOne:"Keep at least one parameter",maximumParameters:"Maximum 5 parameters allowed",dragToMove:"Drag header to move"},tooltips:{ctrlEnterToConfirm:"Ctrl+Enter: Confirm",escToCancel:"Esc: Cancel",clickToSelectColor:"Click to select color"},emoji:{categories:{smileys:"Smileys & Emotion",people:"People & Body",animals:"Animals & Nature",food:"Food & Drink",activities:"Activities",travel:"Travel & Places",objects:"Objects",symbols:"Symbols",flags:"Flags"},searchPlaceholder:"Search emojis...",selectedEmoji:"Selected",clickToPlace:"Click chart to place emoji"},leftPanel:{cursorCrosshair:"Crosshair",cursorCrosshairDesc:"Crosshair cursor with space",cursorCircle:"Cursor",cursorCircleDesc:"Cursor",cursorDot:"Dot Cursor",cursorDotDesc:"Round dot cursor style",cursorArrow:"Arrow Cursor",cursorArrowDesc:"Arrow pointer style",cursorSparkle:"Sparkle",cursorSparkleDesc:"Sparkle effect cursor",cursorEmoji:"Emoji Cursor",cursorEmojiDesc:"Emoji symbol cursor",pencil:"Pencil",pencilDesc:"Thin line drawing tool",pen:"Pen",penDesc:"Smooth line drawing",brush:"Brush",brushDesc:"Soft brush effect",markerPen:"Marker",markerPenDesc:"Bold marker pen",eraser:"Eraser",eraserDesc:"Erase drawing content",heatMap:"Heat Map",lineTools:"Lines",arrowTools:"Arrows",channelTools:"Channels",pitchforkTools:"Pitchforks",penTools:"Pens",gannTools:"Gann Tools",fibonacciTools:"Fibonacci Tools",technicalPatterns:"Technical Patterns",elliottWave:"Elliott Wave",regularShapes:"Regular Shapes",rangeTools:"Ranges",positionTools:"Positions",simulationTools:"Simulation",textTools:"Text",contentTools:"Content",lineSegment:"Line Segment",lineSegmentDesc:"Draw line segment",horizontalLine:"Horizontal Line",horizontalLineDesc:"Draw horizontal line marker",verticalLine:"Vertical Line",verticalLineDesc:"Draw vertical line marker",arrowLine:"Arrow Line",arrowLineDesc:"Draw arrow line marker",thickArrowLine:"Thick Arrow Line",thickArrowLineDesc:"Draw thick arrow line marker",parallelChannel:"Parallel Channel",parallelChannelDesc:"Draw parallel channel",linearRegressionChannel:"Linear Regression Channel",linearRegressionChannelDesc:"Draw regression channel",equidistantChannel:"Equidistant Channel",equidistantChannelDesc:"Draw equidistant channel",disjointChannel:"Disjoint Channel",disjointChannelDesc:"Draw disjoint channel",andrewPitchfork:"Andrew's Pitchfork",andrewPitchforkDesc:"Draw Andrew's pitchfork",enhancedAndrewPitchfork:"Enhanced Andrew Pitchfork",enhancedAndrewPitchforkDesc:"Draw enhanced pitchfork",schiffPitchfork:"Schiff Pitchfork",schiffPitchforkDesc:"Draw Schiff pitchfork",internalPitchfork:"Internal Pitchfork Lines",internalPitchforkDesc:"Draw internal pitchfork lines",wavePitchfork:"Wave Pitchfork",wavePitchforkDesc:"Draw wave pitchfork",gannFan:"Gann Fan",gannFanDesc:"Gann fan analysis tool",gannBox:"Gann Box",gannBoxDesc:"Gann box analysis tool",gannRectangle:"Gann Rectangle",gannRectangleDesc:"Gann Rectangle analysis",fibonacciTimeZones:"Fibonacci Time Zones",fibonacciTimeZonesDesc:"Fibonacci time zones analysis",fibonacciRetracement:"Fibonacci Retracement",fibonacciRetracementDesc:"Draw Fibonacci retracement lines",fibonacciArc:"Fibonacci Arc",fibonacciArcDesc:"Draw Fibonacci arcs",fibonacciCircle:"Fibonacci Circle",fibonacciCircleDesc:"Fibonacci circle analysis",fibonacciSpiral:"Fibonacci Spiral",fibonacciSpiralDesc:"Fibonacci spiral analysis",fibonacciWedge:"Fibonacci Wedge",fibonacciWedgeDesc:"Fibonacci wedge analysis",fibonacciFan:"Fibonacci Fan",fibonacciFanDesc:"Fibonacci fan analysis",fibonacciChannel:"Fibonacci Channel",fibonacciChannelDesc:"Fibonacci channel analysis",fibonacciExtensionPrice:"Fibonacci Extension (Price)",fibonacciExtensionPriceDesc:"Draw Fibonacci extension lines",fibonacciExtensionTime:"Fibonacci Extension (Time)",fibonacciExtensionTimeDesc:"Draw Fibonacci extension lines",xabcdPattern:"XABCD Pattern",xabcdPatternDesc:"Draw XABCD pattern",headAndShoulders:"Head and Shoulders",headAndShouldersDesc:"Draw head and shoulders pattern",abcdPattern:"ABCD Pattern",abcdPatternDesc:"Draw ABCD pattern",triangleAbcd:"ABCD Triangle",triangleAbcdDesc:"Draw ABCD triangle pattern",elliottImpulse:"Elliott Impulse Wave",elliottImpulseDesc:"Draw Elliott impulse wave",elliottCorrective:"Elliott Corrective Wave",elliottCorrectiveDesc:"Draw Elliott corrective wave",elliottTriangle:"Elliott Triangle Wave",elliottTriangleDesc:"Draw Elliott triangle wave",elliottDoubleCombo:"Elliott Double Combo",elliottDoubleComboDesc:"Draw Elliott double combo wave",elliottTripleCombo:"Elliott Triple Combo",elliottTripleComboDesc:"Draw Elliott triple combo wave",rectangle:"Rectangle",rectangleDesc:"Draw rectangular area",circle:"Circle",circleDesc:"Draw circular area",ellipse:"Ellipse",ellipseDesc:"Draw elliptical area",triangle:"Triangle",triangleDesc:"Draw triangle",sector:"Sector",sectorDesc:"Draw sector",curve:"Curve",curveDesc:"Draw curve",doubleCurve:"Double Curve",doubleCurveDesc:"Draw double curve",timeRange:"Time Range",timeRangeDesc:"Draw time range",priceRange:"Price Range",priceRangeDesc:"Draw price range",timePriceRange:"Time-Price Range",timePriceRangeDesc:"Draw time-price range",longPosition:"Long Position",longPositionDesc:"Long position marker",shortPosition:"Short Position",shortPositionDesc:"Short position marker",mockKline:"Mock K-line",mockKlineDesc:"Simulate K-line data",text:"Text",textDesc:"Text annotation",priceNote:"Price Note",priceNoteDesc:"Price annotation",bubbleBox:"Bubble Box",bubbleBoxDesc:"Bubble annotation box",pin:"Pin",pinDesc:"Pin marker",signpost:"Signpost",signpostDesc:"Signpost marker",priceLabel:"Price Label",priceLabelDesc:"Price label marker",flagMark:"Flag Mark",flagMarkDesc:"Flag marker",image:"Image",imageDesc:"Image annotation",video:"Video",videoDesc:"Video annotation",audio:"Audio",audioDesc:"Audio annotation",idea:"Idea",ideaDesc:"Idea annotation",mouseCursor:"Mouse Cursor",drawingTools:"Drawing Tools",fibonacciToolsTitle:"Fibonacci Tools",projectInfoTools:"Project Info Tools",shapeTools:"Shape Tools",brushTitle:"Brush",textMark:"Text Mark",emojiMark:"Emoji Mark",deleteTool:"Delete Tool",setting:"Setting",selectedTool:"Selected",clickToStartDrawing:"Click chart to start drawing",selectEmoji:"Select Emoji",selectedEmoji:"Selected",clickToPlaceEmoji:"Click chart to place emoji"},systemSettings:{title:"System Settings",general:"General",appearance:"Appearance",chart:"Chart",performance:"Performance",shortcuts:"Shortcuts",saveSettings:"Save Settings",cancel:"Cancel",confirm:"Confirm",language:"Language",timezone:"Timezone",autoSave:"Auto Save",themeMode:"Theme Mode",fontSize:"Font Size",animations:"Animations",defaultTimeframe:"Default Timeframe",pricePrecision:"Price Precision",showGrid:"Show Grid",hardwareAcceleration:"Hardware Acceleration",dataPointLimit:"Data Point Limit",realtimeUpdates:"Real-time Updates",shortcutsTitle:"Keyboard Shortcuts",zoomIn:"Zoom In",zoomOut:"Zoom Out",resetZoom:"Reset Zoom",saveChart:"Save Chart",undo:"Undo",redo:"Redo",setting:"Setting"},settingsDescriptions:{language:"Select interface display language",timezone:"Set timezone for displayed times",autoSave:"Automatically save chart settings and drawings",themeMode:"Choose light or dark theme",fontSize:"Set interface font size",animations:"Enable interface animation effects",defaultTimeframe:"Set default chart display timeframe",pricePrecision:"Set number of decimal places for price display",showGrid:"Display grid lines in chart",hardwareAcceleration:"Enable GPU accelerated rendering (recommended)",dataPointLimit:"Set maximum number of data points to display in chart",realtimeUpdates:"Enable real-time data stream updates"},options:{light:"Light Mode",dark:"Dark Mode",auto:"Follow System",small:"Small",medium:"Medium",large:"Large",zhCN:"Simplified Chinese",enUS:"English",jaJP:"Japanese",beijing:"Beijing Time (UTC+8)",newYork:"New York Time (UTC-5)",london:"London Time (UTC+0)",chicago:"Chicago Time (UTC-6)",denver:"Denver Time (UTC-7)",losAngeles:"Los Angeles Time (UTC-8)",toronto:"Toronto Time (UTC-5)",paris:"Paris Time (UTC+1)",frankfurt:"Frankfurt Time (UTC+1)",zurich:"Zurich Time (UTC+1)",moscow:"Moscow Time (UTC+3)",dubai:"Dubai Time (UTC+4)",karachi:"Karachi Time (UTC+5)",kolkata:"Kolkata Time (UTC+5:30)",shanghai:"Shanghai Time (UTC+8)",hongKong:"Hong Kong Time (UTC+8)",singapore:"Singapore Time (UTC+8)",tokyo:"Tokyo Time (UTC+9)",seoul:"Seoul Time (UTC+9)",sydney:"Sydney Time (UTC+10)",auckland:"Auckland Time (UTC+12)",utc:"UTC Time"},timeframes:{"1s":"1 Second","5s":"5 Seconds","15s":"15 Seconds","30s":"30 Seconds","1m":"1 Minute","3m":"3 Minutes","5m":"5 Minutes","15m":"15 Minutes","30m":"30 Minutes","45m":"45 Minutes","1H":"1 Hour","2H":"2 Hours","3H":"3 Hours","4H":"4 Hours","6H":"6 Hours","8H":"8 Hours","12H":"12 Hours","1D":"1 Day","3D":"3 Days","1W":"1 Week","2W":"2 Weeks","1M":"1 Month","3M":"3 Months","6M":"6 Months"},timezone:"Timezone",timeFormat:"Time Format",closeTime:"Close Time",tradingDay:"Trading Day",searchTimezones:"Search timezones...",timeFormatOptions:{twentyFourHour:"24-Hour Format",twelveHour:"12-Hour Format"},closeTimeOptions:{custom:"Custom Time"},tradingDayOptions:{tradingSession:"Trading Session",calendarDay:"Calendar Day",exchangeHours:"Exchange Hours"}},Do={Indicators:"技术指标",mainChartIndicators:"主图指标",subChartIndicators:"副图指标",chartMaps:"图",close:"关闭",searchIndicators:"搜索指标...",searchChartTypes:"搜索图表类型...",theme:"主题",light:"浅色",dark:"深色",timeframe:"时间框架",chartType:"图表类型",toolBar:{color:"颜色",lineSize:"线条尺寸",lineStyle:"线条样式",delete:"删除",close:"关闭",fontSize:"字体大小",bold:"粗体",italic:"斜体",selectColor:"选择颜色",colorPicker:"拾色器",solid:"实线",dashed:"虚线",dotted:"点状线",currentColor:"当前颜色"},timeframeSections:{second:"秒",minute:"分钟",hour:"小时",day:"天",week:"周",month:"月"},chartTypes:{candle:"蜡烛图",line:"线图",area:"面积图",baseline:"基线图",hollowCandle:"空心蜡烛图",heikinAshi:"平均K线图",column:"柱状图",lineWithMarkers:"带标记线图",stepLine:"阶梯线图",bar:"美国线",histogram:"直方图",pointandfigure:"点线图",kagi:"卡吉图",linebreak:"新价线",mountain:"山脉图",baselinearea:"基准面积图",highlow:"高低图",equivolume:"等量图",threelinebreak:"三线反转图",hlcarea:"HLC区域"},toolbarButtons:{hint:"提示",replay:"回放",fullScreen:"全屏",screenshot:"截图",contrast:"对比"},indicators:{ma:"移动平均线",ema:"指数移动平均线",bollinger:"布林带",ichimoku:"一目均衡表",donchian:"唐奇安通道",envelope:"包络线",vwap:"成交量加权平均价",rsi:"RSI",macd:"MACD",volume:"成交量",sar:"抛物线转向",kdj:"KDJ",atr:"ATR",stochastic:"随机指标",cci:"CCI",bbwidth:"布林带宽度",adx:"ADX",obv:"能量潮"},modal:{parameterSettings:"参数设置",parameterName:"参数名称",parameterValue:"数值",lineWidth:"线宽",lineColor:"颜色",addParameter:"添加参数",deleteParameter:"删除",keepAtLeastOne:"至少保留一个参数",maximumParameters:"最多允许5个参数",dragToMove:"拖动标题栏移动"},tooltips:{ctrlEnterToConfirm:"Ctrl+Enter: 确认",escToCancel:"Esc: 取消",clickToSelectColor:"点击选择颜色"},emoji:{categories:{smileys:"表情与情感",people:"人物与身体",animals:"动物与自然",food:"食物与饮品",activities:"活动",travel:"旅行与地点",objects:"物品",symbols:"符号",flags:"旗帜"},searchPlaceholder:"搜索表情...",selectedEmoji:"已选择",clickToPlace:"点击图表放置表情"},leftPanel:{cursorCrosshair:"十字准星",cursorCrosshairDesc:"带空格的十字准星",cursorCircle:"圆形光标",cursorCircleDesc:"圆形光标",cursorDot:"点状光标",cursorDotDesc:"圆点光标样式",cursorArrow:"箭头光标",cursorArrowDesc:"箭头指示样式",cursorSparkle:"烟花棒",cursorSparkleDesc:"烟花效果光标",cursorEmoji:"表情光标",cursorEmojiDesc:"表情符号光标",pencil:"铅笔",pencilDesc:"细线绘制工具",pen:"钢笔",penDesc:"流畅线条绘制",brush:"刷子",brushDesc:"柔和笔刷效果",markerPen:"马克笔",markerPenDesc:"粗体标记笔",eraser:"橡皮擦",eraserDesc:"擦除绘制内容",lineTools:"线",arrowTools:"箭头",channelTools:"通道",pitchforkTools:"叉",penTools:"画笔",gannTools:"江恩分析工具",fibonacciTools:"斐波那契工具",technicalPatterns:"技术图形",elliottWave:"艾略特波浪",regularShapes:"规则图形",rangeTools:"区间",positionTools:"标尺",simulationTools:"模拟",heatMap:"热力图",textTools:"文本",contentTools:"内容",lineSegment:"线段",lineSegmentDesc:"绘制线段",horizontalLine:"水平线",horizontalLineDesc:"绘制水平线标记",verticalLine:"垂直线",verticalLineDesc:"绘制垂直线标记",arrowLine:"箭头线",arrowLineDesc:"绘制箭头线标记",thickArrowLine:"粗箭头线",thickArrowLineDesc:"绘制箭头线标记",parallelChannel:"并行通道",parallelChannelDesc:"绘制并行通道",linearRegressionChannel:"线性回归通道",linearRegressionChannelDesc:"绘制回归通道",equidistantChannel:"等距通道",equidistantChannelDesc:"绘制等距通道",disjointChannel:"不相交通道",disjointChannelDesc:"绘制不相交通道",andrewPitchfork:"安德鲁干草叉",andrewPitchforkDesc:"绘制安德鲁干草叉",enhancedAndrewPitchfork:"改良安德鲁干草叉",enhancedAndrewPitchforkDesc:"绘制叉子",schiffPitchfork:"希夫干草叉",schiffPitchforkDesc:"绘制希夫干草叉",internalPitchfork:"内部干草叉线",internalPitchforkDesc:"绘制内部干草叉线",wavePitchfork:"波浪干草叉",wavePitchforkDesc:"绘制波浪干草叉",gannFan:"江恩扇",gannFanDesc:"江恩扇形线分析工具",gannBox:"江恩箱",gannBoxDesc:"江恩箱体分析工具",gannRectangle:"江恩正方体",gannRectangleDesc:"江恩正方体分析",fibonacciTimeZones:"斐波那契时间周期",fibonacciTimeZonesDesc:"斐波那契时间周期线分析",fibonacciRetracement:"斐波那契回调",fibonacciRetracementDesc:"绘制斐波那契回调线",fibonacciArc:"斐波那契弧线",fibonacciArcDesc:"绘制斐波那契弧线",fibonacciCircle:"斐波那契圆",fibonacciCircleDesc:"斐波那契圆线分析",fibonacciSpiral:"斐波那契螺旋",fibonacciSpiralDesc:"斐波那契螺旋线分析",fibonacciWedge:"斐波那契楔形",fibonacciWedgeDesc:"斐波那契楔形线分析",fibonacciFan:"斐波那契扇形",fibonacciFanDesc:"斐波那契扇形线分析",fibonacciChannel:"斐波那契通道",fibonacciChannelDesc:"斐波那契通道线分析",fibonacciExtensionPrice:"斐波那契扩展(基于价格)",fibonacciExtensionPriceDesc:"绘制斐波那契扩展线",fibonacciExtensionTime:"斐波那契扩展(基于时间)",fibonacciExtensionTimeDesc:"绘制斐波那契扩展线",xabcdPattern:"XABCD图形",xabcdPatternDesc:"绘制XABCD图形",headAndShoulders:"头肩图形",headAndShouldersDesc:"绘制头肩图形",abcdPattern:"ABCD图形",abcdPatternDesc:"绘制ABCD图形",triangleAbcd:"ABCD三角图形",triangleAbcdDesc:"绘制ABCD三角图形",elliottImpulse:"艾略特脉冲波",elliottImpulseDesc:"绘制艾略特脉冲波",elliottCorrective:"艾略特修正浪",elliottCorrectiveDesc:"绘制艾略特修正浪",elliottTriangle:"艾略特三角波",elliottTriangleDesc:"绘制艾略特三角波",elliottDoubleCombo:"艾略特双重组合波",elliottDoubleComboDesc:"绘制艾略特双重组合波",elliottTripleCombo:"艾略特三重组合波",elliottTripleComboDesc:"绘制艾略特三重组合波",rectangle:"矩形",rectangleDesc:"绘制矩形区域",circle:"圆形",circleDesc:"绘制圆形区域",ellipse:"椭圆",ellipseDesc:"绘制椭圆区域",triangle:"三角形",triangleDesc:"绘制三角形",sector:"扇形",sectorDesc:"绘制扇形",curve:"曲线",curveDesc:"绘制曲线",doubleCurve:"双曲线",doubleCurveDesc:"绘制双曲线",timeRange:"时间区间",timeRangeDesc:"绘制时间区间",priceRange:"价格区间",priceRangeDesc:"绘制价格区间",timePriceRange:"时间价格区间",timePriceRangeDesc:"绘制时间价格区间",longPosition:"多头",longPositionDesc:"多头标记",shortPosition:"空头",shortPositionDesc:"空头标记",mockKline:"模拟K线",mockKlineDesc:"模拟K线数据",text:"文本",textDesc:"文本标注",priceNote:"价格标记",priceNoteDesc:"价格标注",bubbleBox:"气泡框",bubbleBoxDesc:"气泡标注框",pin:"定位",pinDesc:"定位标记",signpost:"路标",signpostDesc:"路标标记",priceLabel:"价格标签",priceLabelDesc:"价格标签标记",flagMark:"旗标",flagMarkDesc:"旗标标记",image:"图片",imageDesc:"图片标注",video:"视频",videoDesc:"视频标注",audio:"音频",audioDesc:"音频标注",idea:"点子",ideaDesc:"点子标注",mouseCursor:"鼠标光标",drawingTools:"绘图工具",fibonacciToolsTitle:"斐波那契工具",projectInfoTools:"项目信息工具",shapeTools:"图形工具",brushTitle:"画笔",textMark:"文字标记",emojiMark:"表情标记",deleteTool:"删除工具",setting:"设置",selectedTool:"已选择",clickToStartDrawing:"点击图表开始绘制",selectEmoji:"选择表情",selectedEmoji:"已选择",clickToPlaceEmoji:"点击图表放置表情"},systemSettings:{title:"系统设置",general:"通用设置",appearance:"外观设置",chart:"图表设置",performance:"性能设置",shortcuts:"快捷键",saveSettings:"保存设置",cancel:"取消",confirm:"确认",language:"语言",timezone:"时区",autoSave:"自动保存",themeMode:"主题模式",fontSize:"字体大小",animations:"动画效果",defaultTimeframe:"默认时间周期",pricePrecision:"价格精度",showGrid:"显示网格",hardwareAcceleration:"硬件加速",dataPointLimit:"数据点限制",realtimeUpdates:"实时数据更新",shortcutsTitle:"键盘快捷键",zoomIn:"放大图表",zoomOut:"缩小图表",resetZoom:"重置缩放",saveChart:"保存图表",undo:"撤销操作",redo:"重做操作",setting:"设置"},settingsDescriptions:{language:"选择界面显示语言",timezone:"设置显示时间的时区",autoSave:"自动保存图表设置和绘图",themeMode:"选择浅色或深色主题",fontSize:"设置界面字体大小",animations:"启用界面动画效果",defaultTimeframe:"设置图表默认显示的时间周期",pricePrecision:"设置价格显示的小数位数",showGrid:"在图表中显示网格线",hardwareAcceleration:"启用GPU加速渲染(推荐)",dataPointLimit:"设置图表显示的最大数据点数量",realtimeUpdates:"启用实时数据流更新"},options:{light:"浅色模式",dark:"深色模式",auto:"跟随系统",small:"小",medium:"中",large:"大",zhCN:"简体中文",enUS:"English",jaJP:"日本語",beijing:"北京时间 (UTC+8)",newYork:"纽约时间 (UTC-5)",london:"伦敦时间 (UTC+0)",chicago:"芝加哥时间 (UTC-6)",denver:"丹佛时间 (UTC-7)",losAngeles:"洛杉矶时间 (UTC-8)",toronto:"多伦多时间 (UTC-5)",paris:"巴黎时间 (UTC+1)",frankfurt:"法兰克福时间 (UTC+1)",zurich:"苏黎世时间 (UTC+1)",moscow:"莫斯科时间 (UTC+3)",dubai:"迪拜时间 (UTC+4)",karachi:"卡拉奇时间 (UTC+5)",kolkata:"加尔各答时间 (UTC+5:30)",shanghai:"上海时间 (UTC+8)",hongKong:"香港时间 (UTC+8)",singapore:"新加坡时间 (UTC+8)",tokyo:"东京时间 (UTC+9)",seoul:"首尔时间 (UTC+9)",sydney:"悉尼时间 (UTC+10)",auckland:"奥克兰时间 (UTC+12)",utc:"UTC时间"},timeframes:{"1s":"1秒","5s":"5秒","15s":"15秒","30s":"30秒","1m":"1分钟","3m":"3分钟","5m":"5分钟","15m":"15分钟","30m":"30分钟","45m":"45分钟","1H":"1小时","2H":"2小时","3H":"3小时","4H":"4小时","6H":"6小时","8H":"8小时","12H":"12小时","1D":"1天","3D":"3天","1W":"1周","2W":"2周","1M":"1月","3M":"3月","6M":"6月"},timezone:"时区",timeFormat:"时间格式",closeTime:"收盘时间",tradingDay:"交易日",searchTimezones:"搜索时区...",timeFormatOptions:{twentyFourHour:"24小时制",twelveHour:"12小时制"},closeTimeOptions:{custom:"自定义时间"},tradingDayOptions:{tradingSession:"交易时段",calendarDay:"日历日",exchangeHours:"交易时间"}};async function se(M,t){const e=M.candleViewContainerRef.current;if(!e){const i={success:!1,error:"Container not found",width:0,height:0,timestamp:Date.now()};return t?.(i),i}try{const i=document.createElement("canvas"),r=i.getContext("2d");if(!r){const u={success:!1,error:"Canvas context not available",width:0,height:0,timestamp:Date.now()};return t?.(u),u}const{width:n,height:s}=e.getBoundingClientRect();i.width=n,i.height=s,r.fillStyle=M.state.currentTheme.layout.background.color,r.fillRect(0,0,n,s);const a=e.querySelectorAll("canvas");Array.from(a).sort((u,c)=>{const d=parseInt(window.getComputedStyle(u).zIndex)||0,p=parseInt(window.getComputedStyle(c).zIndex)||0;return d-p}).forEach(u=>{try{const c=u.getBoundingClientRect(),d=e.getBoundingClientRect(),p=c.left-d.left,f=c.top-d.top;r.drawImage(u,p,f,c.width,c.height)}catch{}}),yo(M,e,r,n,s),Eo(r,n,s,M.state.currentTheme);const h=i.toDataURL("image/png"),l=await new Promise(u=>{i.toBlob(c=>{u(c)},"image/png")}),g={success:!0,dataUrl:h,blob:l,width:n,height:s,timestamp:Date.now()};if(t)t(g);else{const u=document.createElement("a");u.download=`chart-screenshot-${new Date().getTime()}.png`,u.href=h,u.click()}return g}catch(i){const r={success:!1,error:i instanceof Error?i.message:"Unknown error",width:0,height:0,timestamp:Date.now()};return t?.(r),r}}function Eo(M,t,e,i){M.save();const n=i.layout.background.color==="#0F1116"?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.25)";M.fillStyle=n,M.font="bold 60px Arial, sans-serif",M.textAlign="center",M.textBaseline="middle";const s=t/2,a=e/2;M.fillText("CandleView",s,a),M.restore()}function yo(M,t,e,i,r){Array.from(t.querySelectorAll('.chart-info-panel, .toolbar, [candleview-container] > div:not([style*="position: absolute"])')).forEach(s=>{Fo(M,s,e,t)})}function Fo(M,t,e,i){const r=t.getBoundingClientRect(),n=i.getBoundingClientRect(),s=r.left-n.left,a=r.top-n.top,o=document.createElement("canvas"),h=o.getContext("2d");h&&(o.width=r.width,o.height=r.height,Ro(M,t,h,r.width,r.height),e.drawImage(o,s,a,r.width,r.height))}function Ro(M,t,e,i,r){const n=t.textContent||"";n.trim()&&(e.fillStyle=M.state.currentTheme.layout.textColor,e.font="12px Arial",e.textAlign="left",e.textBaseline="top",Bo(M,e,n,i-20).forEach((a,o)=>{e.fillText(a,10,10+o*16)}))}function Bo(M,t,e,i){const r=e.split(" "),n=[];let s=r[0];for(let a=1;a<r.length;a++){const o=r[a];t.measureText(s+" "+o).width<i?s+=" "+o:(n.push(s),s=o)}return n.push(s),n}function Ao(M){return M&&{"1s":x.ONE_SECOND,"5s":x.FIVE_SECONDS,"15s":x.FIFTEEN_SECONDS,"30s":x.THIRTY_SECONDS,"1m":x.ONE_MINUTE,"3m":x.THREE_MINUTES,"5m":x.FIVE_MINUTES,"15m":x.FIFTEEN_MINUTES,"30m":x.THIRTY_MINUTES,"45m":x.FORTY_FIVE_MINUTES,"1H":x.ONE_HOUR,"2H":x.TWO_HOURS,"3H":x.THREE_HOURS,"4H":x.FOUR_HOURS,"6H":x.SIX_HOURS,"8H":x.EIGHT_HOURS,"12H":x.TWELVE_HOURS,"1D":x.ONE_DAY,"3D":x.THREE_DAYS,"1W":x.ONE_WEEK,"2W":x.TWO_WEEKS,"1M":x.ONE_MONTH,"3M":x.THREE_MONTHS,"6M":x.SIX_MONTHS}[M]||null}function Lo(M){return M&&{"America/New_York":A.NEW_YORK,"America/Chicago":A.CHICAGO,"America/Denver":A.DENVER,"America/Los_Angeles":A.LOS_ANGELES,"America/Toronto":A.TORONTO,"Europe/London":A.LONDON,"Europe/Paris":A.PARIS,"Europe/Frankfurt":A.FRANKFURT,"Europe/Zurich":A.ZURICH,"Europe/Moscow":A.MOSCOW,"Asia/Dubai":A.DUBAI,"Asia/Karachi":A.KARACHI,"Asia/Kolkata":A.KOLKATA,"Asia/Shanghai":A.SHANGHAI,"Asia/Hong_Kong":A.HONG_KONG,"Asia/Singapore":A.SINGAPORE,"Asia/Tokyo":A.TOKYO,"Asia/Seoul":A.SEOUL,"Australia/Sydney":A.SYDNEY,"Pacific/Auckland":A.AUCKLAND,UTC:A.UTC}[M]||null}function ae(M,t,e,i){return{timeframe:M.timeframe||x.ONE_DAY,timezone:M.timezone||A.SHANGHAI,shouldExtendVirtualData:!0,virtualDataBeforeCount:e||0,virtualDataAfterCount:i||0,chartType:t}}const ge=class ge{static handleData(t,e,i){if(!t||t.length===0)return[];try{const r=Ys(t,e.timezone),n=qs(r,e.timeframe);return e.shouldExtendVirtualData?this.extendWithVirtualData(n,e):n}catch{return t}}static extendWithVirtualData(t,e){const i=e.virtualDataBeforeCount??this.calculateOptimalVirtualDataCount(e.timeframe,"before"),r=e.virtualDataAfterCount??this.calculateOptimalVirtualDataCount(e.timeframe,"after");return Us(t,i,r,e.timeframe)}static calculateOptimalVirtualDataCount(t,e){const r=[x.ONE_SECOND,x.FIVE_SECONDS,x.FIFTEEN_SECONDS,x.THIRTY_SECONDS].includes(t),n=[x.ONE_MINUTE,x.THREE_MINUTES,x.FIVE_MINUTES,x.FIFTEEN_MINUTES,x.THIRTY_MINUTES,x.FORTY_FIVE_MINUTES].includes(t),s=[x.ONE_HOUR,x.TWO_HOURS,x.THREE_HOURS,x.FOUR_HOURS,x.SIX_HOURS,x.EIGHT_HOURS,x.TWELVE_HOURS].includes(t),a=[x.ONE_DAY,x.THREE_DAYS].includes(t),o=[x.ONE_WEEK,x.TWO_WEEKS].includes(t),h=[x.ONE_MONTH,x.THREE_MONTHS,x.SIX_MONTHS].includes(t);return r?Math.min(100,50):n?Math.min(100,80):s?100:a?200:o?300:h?400:100}static handleChartDisplayData(t,e){if(!t||t.length===0)return[];const i=`${e}-${t.length}-${t[0]?.time}-${t[t.length-1]?.time}`;if(this.formatCache&&this.formatCache.key===i)return this.formatCache.result;let r=[];try{return e===W.Candle||e===W.HollowCandle||e===W.Bar?r=t.map((n,s)=>{const a={time:n.time,open:Number(n.open),high:Number(n.high),low:Number(n.low),close:Number(n.close),volume:Number(n.volume)};return n.isVirtual?{...a,color:"transparent",borderColor:"transparent",wickColor:"transparent"}:a}):e===W.BaseLine?r=t.map(n=>{const s=n.isVirtual||n.volume===-1,a={time:n.time,value:Number(n.close)};return s?{...a,color:"transparent"}:a}):e===W.Line||e===W.Area||e===W.StepLine?r=t.map(n=>{const s=n.isVirtual||n.volume===-1,a={time:n.time,value:Number(n.close)};return s?{...a,color:"transparent"}:a}):e===W.Histogram?r=t.map(n=>{const s=n.isVirtual||n.volume===-1,a={time:n.time,value:n.volume||0};return s?{...a,color:"transparent"}:{...a,color:(n.volume||0)>100?"#26a69a":"#ef5350"}}):r=t.map(n=>{const s=n.isVirtual||n.volume===-1;return{time:n.time,value:Number(n.close),...s&&{color:"transparent"}}}),this.formatCache={key:i,result:r},r}catch{return[]}}static filterRealData(t){return t.filter(e=>!e.isVirtual&&e.volume!==-1&&e.volume!==0)}static getTimeframeConfig(t){return Ti[t]}static validateData(t){return!t||!Array.isArray(t)?!1:t.every(e=>e.time!==void 0&&e.open!==void 0&&e.high!==void 0&&e.low!==void 0&&e.close!==void 0)}static sampleData(t,e=1){if(e>=1||t.length<=1e3)return t;const i=[],r=Math.floor(1/e);for(let n=0;n<t.length;n+=r)n<t.length&&i.push(t[n]);return i}};ge.formatCache=null;let wt=ge;const dt=class dt{static getRealDataRange(t){if(t.length===0)return null;let e=-1,i=-1;for(let r=0;r<t.length;r++)if(!t[r].isVirtual){e=r;break}for(let r=t.length-1;r>=0;r--)if(!t[r].isVirtual){i=r;break}return{firstIndex:e,lastIndex:i}}static checkDataPointPositions(t,e,i){if(!t||!e)return;const{firstIndex:r,lastIndex:n}=e,{from:s,to:a}=t,o=r>=s&&r<=a,h=n>=s&&n<=a,l=r<s,g=r>a,u=n<s,c=n>a,p=(a-s)*.1,f=r>=a-p&&r<=a,k=n>=s&&n<=s+p;!this.lastFirstRealDataLeftViewport&&l&&i.onFirstRealDataExitLeftViewport?.(),!this.lastFirstRealDataRightViewport&&g&&i.onFirstRealDataExitRightViewport?.(),!this.lastLastRealDataLeftViewport&&u&&i.onLastRealDataExitLeftViewport?.(),!this.lastLastRealDataRightViewport&&c&&i.onLastRealDataExitRightViewport?.(),this.lastFirstRealDataLeftViewport&&!l&&o&&i.onFirstRealDataEnterLeftViewport?.(),!this.lastFirstRealDataNearRightViewport&&f&&i.onFirstRealDataNearRightViewport?.(),!this.lastLastRealDataNearLeftViewport&&k&&i.onLastRealDataNearLeftViewport?.(),this.lastFirstRealDataNearRightViewport&&!f&&i.onFirstRealDataLeaveNearRightViewport?.(),this.lastLastRealDataNearLeftViewport&&!k&&i.onLastRealDataLeaveNearLeftViewport?.(),this.lastFirstRealDataInViewport&&!o&&i.onFirstRealDataExitViewport?.(),this.lastLastRealDataInViewport&&!h&&i.onLastRealDataExitViewport?.(),this.lastFirstRealDataInViewport=o,this.lastLastRealDataInViewport=h,this.lastFirstRealDataLeftViewport=l,this.lastFirstRealDataRightViewport=g,this.lastLastRealDataLeftViewport=u,this.lastLastRealDataRightViewport=c,this.lastFirstRealDataNearRightViewport=f,this.lastLastRealDataNearLeftViewport=k}static reset(){this.lastFirstRealDataInViewport=!0,this.lastLastRealDataInViewport=!0,this.lastFirstRealDataLeftViewport=!1,this.lastFirstRealDataRightViewport=!1,this.lastLastRealDataLeftViewport=!1,this.lastLastRealDataRightViewport=!1,this.lastFirstRealDataNearRightViewport=!1,this.lastLastRealDataNearLeftViewport=!1}static getCurrentState(){return{lastFirstRealDataInViewport:this.lastFirstRealDataInViewport,lastLastRealDataInViewport:this.lastLastRealDataInViewport,lastFirstRealDataLeftViewport:this.lastFirstRealDataLeftViewport,lastFirstRealDataRightViewport:this.lastFirstRealDataRightViewport,lastLastRealDataLeftViewport:this.lastLastRealDataLeftViewport,lastLastRealDataRightViewport:this.lastLastRealDataRightViewport,lastFirstRealDataNearRightViewport:this.lastFirstRealDataNearRightViewport,lastLastRealDataNearLeftViewport:this.lastLastRealDataNearLeftViewport}}};dt.lastFirstRealDataInViewport=!0,dt.lastLastRealDataInViewport=!0,dt.lastFirstRealDataLeftViewport=!1,dt.lastFirstRealDataRightViewport=!1,dt.lastLastRealDataLeftViewport=!1,dt.lastLastRealDataRightViewport=!1,dt.lastFirstRealDataNearRightViewport=!1,dt.lastLastRealDataNearLeftViewport=!1;let de=dt;class Ho{constructor(t,e){this.chart=null,this.currentSeries=null,this.beforeViewPortBuffer=100,this.afterViewPortBuffer=0,this.getViewportDataPoints=(i,r)=>{if(!r||r.length===0)return[];const n=i.from-this.beforeViewPortBuffer,s=i.to-this.afterViewPortBuffer;return r.filter(o=>o.time>=n&&o.time<=s)},this.scrollLockState={isScrollLocked:!1,lockDirection:null,safeVisibleRange:null},this.chart=t,this.currentSeries=e}zoomIn(){if(!this.chart)return;const t=this.chart.timeScale(),e=t.getVisibleRange();if(!e)return;const n=(e.to-e.from)*.8,s=(e.from+e.to)/2;t.setVisibleRange({from:s-n/2,to:s+n/2})}zoomOut(){if(!this.chart)return;const t=this.chart.timeScale(),e=t.getVisibleRange();if(!e)return;const n=(e.to-e.from)*1.2,s=(e.from+e.to)/2;t.setVisibleRange({from:s-n/2,to:s+n/2})}scrollChart(t){if(!this.chart)return;const e=this.chart.timeScale(),i=e.getVisibleRange();if(!i)return;const n=(i.to-i.from)*.2;t==="left"?e.setVisibleRange({from:i.from-n,to:i.to-n}):e.setVisibleRange({from:i.from+n,to:i.to+n})}positionChart(t){this.setOptimalBarSpacing(t),this.scrollToRealData()}getVisibleTimeRange(){if(!this.chart)return null;try{const e=this.chart.timeScale().getVisibleRange();return e?{from:e.from,to:e.to}:null}catch(t){return console.error(t),null}}setVisibleTimeRange(t){if(!this.chart||!t)return;const e=this.chart.timeScale();try{e.setVisibleRange({from:t.from,to:t.to})}catch(i){console.error(i),this.scrollToRealData()}}scrollToRealData(){if(this.chart)try{const t=this.chart.timeScale(),e=this.currentSeries?.series?.data||[];if(e.length===0){t.fitContent();return}const{firstIndex:i,lastIndex:r,virtualAfterCount:n}=this.getRealDataRange();if(i===-1||r===-1){t.fitContent();return}const s=Math.min(100,r-i+1+10),a=Math.max(0,i-5),o=Math.min(e.length-1,r+Math.min(10,n));t.setVisibleLogicalRange({from:a,to:o})}catch(t){console.error(t),this.scrollToStablePosition()}}scrollToStablePosition(){if(this.chart)try{const t=this.chart.timeScale(),e=this.currentSeries?.series?.data||[];if(e.length===0){t.fitContent();return}const{lastIndex:i}=this.getRealDataRange();if(i===-1)t.setVisibleLogicalRange({from:Math.max(0,e.length-50),to:e.length-1});else{const n=Math.max(0,i-50+1),s=Math.min(e.length-1,i+5);t.setVisibleLogicalRange({from:n,to:s})}}catch(t){console.error(t),this.chart&&this.chart.timeScale().fitContent()}}getRealDataRange(){const t=this.currentSeries?.series?.data||[];let e=-1,i=-1,r=0,n=0,s=0;for(let a=0;a<t.length;a++){const o=t[a];if(!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0){e=a,n=a;break}}for(let a=t.length-1;a>=0;a--){const o=t[a];if(!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0){i=a,s=t.length-1-a;break}}if(e!==-1&&i!==-1)for(let a=e;a<=i;a++){const o=t[a];!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0&&r++}return{firstIndex:e,lastIndex:i,realDataCount:r,virtualBeforeCount:n,virtualAfterCount:s}}setOptimalBarSpacing(t){if(!this.chart)return;const e=this.chart.timeScale(),r=e.options().barSpacing||10,s={[x.ONE_SECOND]:1,[x.FIVE_SECONDS]:2,[x.FIFTEEN_SECONDS]:3,[x.THIRTY_SECONDS]:4,[x.ONE_MINUTE]:5,[x.THREE_MINUTES]:6,[x.FIVE_MINUTES]:7,[x.FIFTEEN_MINUTES]:8,[x.THIRTY_MINUTES]:9,[x.FORTY_FIVE_MINUTES]:10,[x.ONE_HOUR]:12,[x.TWO_HOURS]:14,[x.THREE_HOURS]:16,[x.FOUR_HOURS]:18,[x.SIX_HOURS]:20,[x.EIGHT_HOURS]:22,[x.TWELVE_HOURS]:24,[x.ONE_DAY]:15,[x.THREE_DAYS]:20,[x.ONE_WEEK]:25,[x.TWO_WEEKS]:30,[x.ONE_MONTH]:35,[x.THREE_MONTHS]:40,[x.SIX_MONTHS]:45}[t]||10;let a=s;Math.abs(r-s)>2&&(a=r);try{e.applyOptions({barSpacing:a,minBarSpacing:.5,maxBarSpacing:50})}catch(o){console.error(o)}}handleChartScrollLock(t,e){const i=this.chart.timeScale(),r=de.getRealDataRange(e);if(!r)return;const{firstIndex:n,lastIndex:s}=r;if(n!==-1&&s!==-1&&e.length>0){const a=i.getVisibleLogicalRange();if(a){const{from:o,to:h}=a,l=n>=h-1,g=s<=o+1;if(this.scrollLockState.isScrollLocked&&this.scrollLockState.safeVisibleRange&&(this.scrollLockState.lockDirection==="right"?t.from>this.scrollLockState.safeVisibleRange.from+2&&!l&&(this.scrollLockState.isScrollLocked=!1,this.scrollLockState.lockDirection=null,this.scrollLockState.safeVisibleRange=null):this.scrollLockState.lockDirection==="left"&&t.from<this.scrollLockState.safeVisibleRange.from-2&&!g&&(this.scrollLockState.isScrollLocked=!1,this.scrollLockState.lockDirection=null,this.scrollLockState.safeVisibleRange=null),this.scrollLockState.isScrollLocked)){i.setVisibleRange(this.scrollLockState.safeVisibleRange);return}this.scrollLockState.isScrollLocked||(l?(this.scrollLockState.isScrollLocked=!0,this.scrollLockState.lockDirection="right",this.scrollLockState.safeVisibleRange={...t},i.setVisibleRange(this.scrollLockState.safeVisibleRange)):g&&(this.scrollLockState.isScrollLocked=!0,this.scrollLockState.lockDirection="left",this.scrollLockState.safeVisibleRange={...t},i.setVisibleRange(this.scrollLockState.safeVisibleRange)))}}}}class pi{static loadData(t){if(t.data&&t.data.length>0)return this.validateAndFormatData(t.data);if(t.url){const e=this.loadFromUrl(t.url);if(e.length>0)return e}return[]}static loadFromLocalFile(t){try{const e=t.startsWith("/")?t:`/${t}`,i=new XMLHttpRequest;if(i.open("GET",e,!1),i.send(),i.status!==200)throw new Error(`Failed to fetch file: ${i.status}`);const r=i.responseText;if(r.trim().startsWith("<!DOCTYPE")||r.trim().startsWith("<html"))throw new Error("Received HTML instead of JSON. Check file path.");const n=JSON.parse(r);return this.parseOHLCData(n)}catch{try{const i=t.replace(/^\.?\//,""),r=require(`../${i}`);return this.parseOHLCData(r)}catch{return[]}}}static loadFromUrl(t){try{const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status!==200)throw new Error(`HTTP error! status: ${e.status}`);const i=e.getResponseHeader("content-type");!i||i.includes("application/json");const r=JSON.parse(e.responseText);return this.parseOHLCData(r)}catch{return[]}}static parseOHLCData(t){return Array.isArray(t)?t.map(e=>({time:e.time,open:Number(e.open),high:Number(e.high),low:Number(e.low),close:Number(e.close),volume:Number(e.volume||0)})).filter(e=>!isNaN(e.time)&&!isNaN(e.open)&&!isNaN(e.high)&&!isNaN(e.low)&&!isNaN(e.close)):t.data&&Array.isArray(t.data)?this.parseOHLCData(t.data):t.ohlc&&Array.isArray(t.ohlc)?this.parseOHLCData(t.ohlc):t.series&&Array.isArray(t.series)?this.parseOHLCData(t.series):t.result&&Array.isArray(t.result)?this.parseOHLCData(t.result):t.values&&Array.isArray(t.values)?this.parseOHLCData(t.values):[]}static validateAndFormatData(t){return t}static validateConfig(t){return[t.data&&t.data.length>0,!!t.url].filter(Boolean).length!==0}static getActiveDataSource(t){return t.data&&t.data.length>0?"data":t.url?"url":"none"}}const Oo={panel:{backgroundColor:"#1A1D24",borderColor:"#2D323D"},modal:{textColor:"#FFFFFF"},layout:{background:{color:"#0F1116"},textColor:"#E8EAED",attributionLogo:!1},grid:{vertLines:{visible:!1,color:"#2D323D"},horzLines:{visible:!1,color:"#2D323D"}},chart:{candleUpColor:"#26a69a",candleDownColor:"#ef5350",lineColor:"#2962FF",topColor:"rgba(41, 98, 255, 0.4)",bottomColor:"rgba(41, 98, 255, 0)",lineWidth:2,upColor:"#00C087",downColor:"#FF5B5A",background:"#0F1116",baseLineColor:"#FF9800",histogramColor:"#4CAF50",stepLineColor:"#9C27B0",areaTopColor:"rgba(33, 150, 243, 0.4)",areaBottomColor:"rgba(33, 150, 243, 0)",areaLineColor:"#2196F3",volumeColor:"#4CAF50"},toolbar:{background:"#1A1D24",border:"#2D323D",button:{backgroundColor:"#2D323D",background:"transparent",hover:"#2D323D",active:"#2962FF",color:"#E8EAED",activeTextColor:"#FFFFFF",boxShadow:"0 0 0 1px rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.3)"}}},Io={panel:{backgroundColor:"#FFFFFF",borderColor:"#E1E5E9"},modal:{textColor:"#1A1D24"},layout:{background:{color:"#FFFFFF"},textColor:"#1A1D24",attributionLogo:!1},grid:{vertLines:{visible:!1,color:"#E1E5E9"},horzLines:{visible:!1,color:"#E1E5E9"}},chart:{candleUpColor:"#26a69a",candleDownColor:"#ef5350",lineColor:"#2962FF",topColor:"rgba(41, 98, 255, 0.4)",bottomColor:"rgba(41, 98, 255, 0)",lineWidth:2,upColor:"#00C087",downColor:"#FF5B5A",background:"#0F1116",baseLineColor:"#FF9800",histogramColor:"#4CAF50",stepLineColor:"#9C27B0",areaTopColor:"rgba(33, 150, 243, 0.4)",areaBottomColor:"rgba(33, 150, 243, 0)",areaLineColor:"#2196F3",volumeColor:"#4CAF50"},toolbar:{background:"#F8F9FA",border:"#E1E5E9",button:{backgroundColor:"#FFFFFF",background:"transparent",hover:"#E1E5E9",active:"#2962FF",color:"#495057",activeTextColor:"#FFFFFF",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1)"}}};class vi extends O.Component{constructor(t){super({showLeftPanel:!1,showTopPanel:!1,...t}),this.candleViewContainerRef=O.createRef(),this.chartRef=O.createRef(),this.chartContainerRef=O.createRef(),this.drawingLayerRef=O.createRef(),this.chart=null,this.resizeObserver=null,this.realTimeInterval=null,this.currentSeries=null,this.chartManager=null,this.updateTimeout=null,this.viewportManager=null,this.chartEventManager=null,this.preparedData=[],this.originalData=[],this.loadDataAsync=e=>{this.setState({dataLoadProgress:0,isDataLoading:!0}),this.loadExternalData().then(()=>(this.setState({dataLoadProgress:30}),this.loadInternalData())).then(()=>{this.setState({dataLoadProgress:70}),e&&e(),this.setState({dataLoadProgress:100,isDataLoading:!1,loadError:null})}).catch(i=>{this.setState({isDataLoading:!1,loadError:i.message})})},this.loadExternalData=async()=>new Promise((e,i)=>{try{this.setState({dataLoadProgress:10});const r=pi.loadData({data:this.props.data,url:this.props.url});this.originalData=r,this.setState({dataLoadProgress:30}),e()}catch(r){i(r)}}),this.loadInternalData=async()=>new Promise(e=>{this.setState({dataLoadProgress:40});const i=wt.handleData(this.originalData,ae({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType);this.setState({dataLoadProgress:50}),setTimeout(()=>{this.preparedData=i,this.setState({dataLoadProgress:60}),this.setState({displayData:i,dataLoadProgress:70},()=>{e()})},50)}),this.handleTimeFormatClick=()=>{this.setState({isTimeFormatModalOpen:!0})},this.handleCloseTimeClick=()=>{this.setState({isCloseTimeModalOpen:!0})},this.handleTradingDayClick=()=>{this.setState({isTradingDayModalOpen:!0})},this.handleTimezoneClick=()=>{this.setState({isTimezoneModalOpen:!0})},this.handleCloseModals=()=>{this.setState({isTimeframeModalOpen:!1,isIndicatorModalOpen:!1,isChartTypeModalOpen:!1,isSubChartModalOpen:!1,isTimezoneModalOpen:!1,isTimeFormatModalOpen:!1,isCloseTimeModalOpen:!1,isTradingDayModalOpen:!1,isMobileMenuOpen:!1})},this.handleTimezoneSelect=e=>{this.setState({currentTimezone:e,timezone:e,isTimezoneModalOpen:!1,isDataLoading:!0,dataLoadProgress:0},()=>{setTimeout(()=>{this.setState({dataLoadProgress:20}),this.loadInternalDataAsync(()=>{this.setState({dataLoadProgress:70}),this.initChart(),this.viewportManager?.positionChart(this.state.activeTimeframe),setTimeout(()=>{this.setState({isDataLoading:!1,dataLoadProgress:100})},50)})},50)})},this.handleTimeframeSelect=e=>{const i=e;this.setState({activeTimeframe:i,timeframe:i,isTimeframeModalOpen:!1,isDataLoading:!0,dataLoadProgress:0},()=>{setTimeout(()=>{this.setState({dataLoadProgress:10}),this.loadInternalDataAsync(()=>{this.setState({dataLoadProgress:60}),this.initChart(),this.viewportManager?.positionChart(this.state.activeTimeframe),setTimeout(()=>{this.setState({isDataLoading:!1,dataLoadProgress:100})},50)})},50)})},this.loadInternalDataAsync=e=>new Promise(i=>{this.state.isDataLoading||this.setState({isDataLoading:!0}),this.setState({dataLoadProgress:10}),setTimeout(()=>{setTimeout(()=>{this.setState({dataLoadProgress:30});const s=wt.handleData(this.originalData,ae({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType);this.setState({dataLoadProgress:50}),setTimeout(()=>{this.preparedData=s,this.setState({displayData:s,dataLoadProgress:60},()=>{e&&e(),i()})},50)},0)},0)}),this.initChart=()=>{if(!(!this.state.displayData||this.state.displayData.length===0||!this.currentSeries||!this.currentSeries.series))try{this.state.isDataLoading&&this.setState({dataLoadProgress:80}),this.currentSeries.series.setData(this.state.displayData),this.state.isDataLoading&&setTimeout(()=>{this.setState({dataLoadProgress:90})},50)}catch{this.setState({isDataLoading:!1,dataLoadProgress:100})}},this.refreshChart=()=>{if(!(!this.state.displayData||this.state.displayData.length===0||!this.currentSeries||!this.currentSeries.series||!this.chart))try{const e=this.chart.timeScale(),i=e.getVisibleRange();this.state.isDataLoading&&this.setState({dataLoadProgress:85}),this.currentSeries.series.setData(this.state.displayData),i&&setTimeout(()=>{try{e.setVisibleRange(i),this.state.isDataLoading&&setTimeout(()=>{this.setState({dataLoadProgress:95})},50)}catch{this.state.isDataLoading&&this.setState({isDataLoading:!1,dataLoadProgress:100})}},10)}catch{this.state.isDataLoading&&this.setState({isDataLoading:!1,dataLoadProgress:100})}},this.handleSelectedSubChartIndicator=e=>{this.setState({selectedSubChartIndicators:e,isSubChartModalOpen:!1})},this.handleRemoveSubChartIndicator=e=>{this.setState(i=>({selectedSubChartIndicators:i.selectedSubChartIndicators.filter(n=>n!==e)}))},this.handleCameraClick=()=>{const{handleScreenshotCapture:e}=this.props;e?se(this,i=>{i.success&&i.dataUrl&&i.blob?e({dataUrl:i.dataUrl,blob:i.blob,width:i.width,height:i.height,timestamp:i.timestamp}):this.fallbackToDownload(i.dataUrl)}):se(this)},this.fallbackToDownload=e=>{if(e){const i=document.createElement("a");i.download=`chart-screenshot-${new Date().getTime()}.png`,i.href=e,i.click()}else se(this)},this.serializeDrawings=()=>this.drawingLayerRef.current?this.drawingLayerRef.current.serializeDrawings():"[]",this.handleSubChartClick=()=>{this.setState({isSubChartModalOpen:!this.state.isSubChartModalOpen})},this.deserializeDrawings=e=>{this.drawingLayerRef.current&&this.drawingLayerRef.current.deserializeDrawings(e)},this.clearAllDrawings=()=>{this.drawingLayerRef.current&&this.drawingLayerRef.current.clearAllDrawings()},this.viewportDataBufferSize=500,this.handleVisibleTimeRangeChange=e=>{if(!e)return;e.from>this.viewportDataBufferSize&&(e.from=e.from-this.viewportDataBufferSize);const i=this.viewportManager?.getViewportDataPoints(e,this.preparedData)||[];this.setState({displayData:i})},this.handleEmojiSelect=e=>{this.setState({selectedEmoji:e})},this.handleThemeToggle=()=>{this.setState(e=>{const i=!e.isDarkTheme,r=i?"dark":"light";return{isDarkTheme:i,currentTheme:this.getThemeConfig(r)}},()=>{this.updateChartTheme()})},this.handleMobileMenuToggle=()=>{this.setState(e=>({isMobileMenuOpen:!e.isMobileMenuOpen}))},this.handleClickOutside=e=>{const i=e.target,r=this.state.isMobileMenuOpen&&!i.closest(".mobile-menu-button")&&!i.closest("[data-mobile-menu-modal]"),n=this.state.isTimeFormatModalOpen&&!i.closest(".time-format-button")&&!i.closest("[data-timeformat-modal]"),s=this.state.isCloseTimeModalOpen&&!i.closest(".close-time-button")&&!i.closest("[data-close-time-modal]"),a=this.state.isTradingDayModalOpen&&!i.closest(".trading-day-button")&&!i.closest("[data-trading-day-modal]"),o=this.state.isTimezoneModalOpen&&!i.closest(".timezone-button")&&!i.closest("[data-timezone-modal]"),h=this.state.isTimeframeModalOpen&&!i.closest(".timeframe-button")&&!i.closest("[data-timeframe-modal]"),l=this.state.isIndicatorModalOpen&&!i.closest(".indicator-button")&&!i.closest("[data-indicator-modal]"),g=this.state.isTradeModalOpen&&!i.closest(".trade-button")&&!i.closest("[data-trade-modal]"),u=this.state.isChartTypeModalOpen&&!i.closest(".chart-type-button")&&!i.closest("[data-chart-type-modal]"),c=this.state.isSubChartModalOpen&&!i.closest(".subchart-button")&&!i.closest("[data-subchart-modal]");r&&this.setState({isMobileMenuOpen:!1}),c&&this.setState({isSubChartModalOpen:!1}),h&&this.setState({isTimeframeModalOpen:!1}),l&&this.setState({isIndicatorModalOpen:!1}),g&&this.setState({isTradeModalOpen:!1}),u&&this.setState({isChartTypeModalOpen:!1}),o&&this.setState({isTimezoneModalOpen:!1}),n&&this.setState({isTimeFormatModalOpen:!1}),s&&this.setState({isCloseTimeModalOpen:!1}),a&&this.setState({isTradingDayModalOpen:!1})},this.handleToolSelect=e=>{this.setState({activeTool:e})},this.handleChartTypeSelect=e=>{this.setState({currentMainChartType:e,isChartTypeModalOpen:!1})},this.handleCloseChartTypeModal=()=>{this.setState({isChartTypeModalOpen:!1})},this.handleCloseDrawing=()=>{this.setState({activeTool:null})},this.handleTimeframeClick=()=>{this.setState({isTimeframeModalOpen:!this.state.isTimeframeModalOpen})},this.handleChartTypeClick=()=>{this.setState({isChartTypeModalOpen:!this.state.isChartTypeModalOpen})},this.handleIndicatorClick=()=>{this.setState({isIndicatorModalOpen:!this.state.isIndicatorModalOpen})},this.handleTradeClick=()=>{this.setState({isTradeModalOpen:!this.state.isTradeModalOpen})},this.handleSelectedMainChartIndicator=e=>{this.setState({selectedMainChartIndicator:e,isIndicatorModalOpen:!1})},this.handleMainChartIndicatorChange=e=>{this.setState({selectedMainChartIndicator:e})},this.handleCloseIndicatorModal=()=>{this.setState({isIndicatorModalOpen:!1})},this.handleCloseTimeframeModal=()=>{this.setState({isTimeframeModalOpen:!1})},this.handleCloseTradeModal=()=>{this.setState({isTradeModalOpen:!1})},this.handleTradeAction=e=>{this.setState({isTradeModalOpen:!1})},this.handleFullscreen=()=>{const e=this.chartContainerRef.current;e&&(document.fullscreenElement?document.exitFullscreen?.():e.requestFullscreen?.())},this.handleCompareClick=()=>{},this.handleReplayClick=()=>{},this.stopRealTimeDataSimulation=()=>{this.realTimeInterval&&(clearInterval(this.realTimeInterval),this.realTimeInterval=null)},this.handleContextMenu=e=>{e.preventDefault(),e.stopPropagation()},this.handleLeftArrowClick=()=>{this.chart&&this.viewportManager&&this.viewportManager.scrollChart("left")},this.handleRightArrowClick=()=>{this.chart&&this.viewportManager&&this.viewportManager.scrollChart("right")},this.handleRefreshClick=()=>{this.setState({isDataLoading:!0,dataLoadProgress:0}),setTimeout(()=>{this.setState({dataLoadProgress:20}),this.refreshExternalData(()=>{this.setState({dataLoadProgress:50}),this.refreshInternalData(()=>{this.setState({dataLoadProgress:80}),this.refreshChart(),this.viewportManager?.positionChart(this.state.activeTimeframe),this.setState({isDataLoading:!1,dataLoadProgress:100})})})},100)},this.handleZoomIn=()=>{this.viewportManager&&this.viewportManager.zoomIn()},this.handleZoomOut=()=>{this.viewportManager&&this.viewportManager.zoomOut()},this.state={isIndicatorModalOpen:!1,isTimeframeModalOpen:!1,isTradeModalOpen:!1,isChartTypeModalOpen:!1,isSubChartModalOpen:!1,isMobileMenuOpen:!1,activeTool:null,currentMainChartType:W.Candle,currentTheme:this.getThemeConfig(t.theme||"dark"),currentI18N:this.getI18nConfig(t.i18n||"zh-cn"),chartInitialized:!1,isDarkTheme:t.theme!=="light",selectedEmoji:"😀",selectedSubChartIndicators:[],selectedMainChartIndicator:null,subChartPanelHeight:200,isResizing:!1,showInfoLayer:!0,isTimezoneModalOpen:!1,currentTimezone:"Asia/Shanghai",isTimeFormatModalOpen:!1,isCloseTimeModalOpen:!1,isTradingDayModalOpen:!1,currentCloseTime:"17:00",currentTradingDayType:"trading-session",activeTimeframe:x.ONE_DAY,timeframe:Ao(t.timeframe)||x.ONE_DAY,timezone:Lo(t.timezone)||A.SHANGHAI,savedVisibleRange:null,virtualDataBeforeCount:500,virtualDataAfterCount:500,displayData:[],isDataLoading:!1,dataLoadProgress:0,loadError:null},this.chartEventManager=new Ci}componentDidMount(){this.chart||(this.setState({isDataLoading:!0}),this.loadDataAsync(()=>{setTimeout(()=>{this.initializeChart()},50)}))}componentDidUpdate(t,e){if(t.theme!==this.props.theme){const r=this.props.theme||"dark";this.setState({currentTheme:this.getThemeConfig(r)}),this.updateChartTheme();return}if(t.data!==this.props.data||t.url!==this.props.url){this.setState({isDataLoading:!0,dataLoadProgress:0}),this.loadDataAsync(()=>{this.refreshChart()});return}}componentWillUnmount(){const t=this.viewportManager?.getVisibleTimeRange();if(t)try{localStorage.setItem("candleView_visibleRange",JSON.stringify(t))}catch{}this.updateTimeout&&clearTimeout(this.updateTimeout),this.resizeObserver&&this.chartContainerRef.current&&(this.resizeObserver.unobserve(this.chartContainerRef.current),this.resizeObserver.disconnect()),this.chart&&this.chart.remove(),this.realTimeInterval&&clearInterval(this.realTimeInterval),document.removeEventListener("mousedown",this.handleClickOutside,!0)}initializeChart(){if(!this.chartRef.current||!this.chartContainerRef.current)return;const t=this.chartContainerRef.current,{currentTheme:e,chartInitialized:i}=this.state,r=t.clientWidth,n=t.clientHeight;if(!(r===0||n===0)&&!i)try{this.setState({dataLoadProgress:75}),this.chart&&(this.chart.remove(),this.currentSeries=null),this.chartManager=new To(this.chartRef.current,r,n,e,this.props.i18n),this.chart=this.chartManager.getChart(),this.setState({dataLoadProgress:80}),this.viewportManager=new Ho(this.chart,this.currentSeries),this.chartEventManager?.registerVisibleTimeRangeChangeEvent(this.chart,s=>{this.handleVisibleTimeRangeChange(s)}),this.state.displayData&&this.state.displayData.length>0&&(this.currentSeries=Gi(this.chart,e),this.setState({dataLoadProgress:85}),this.refreshInternalData(()=>{this.initChart(),this.viewportManager?.positionChart(this.state.activeTimeframe),this.setState({dataLoadProgress:90}),this.setupResizeObserver(),this.setState({chartInitialized:!0,dataLoadProgress:95}),setTimeout(()=>{this.setState({dataLoadProgress:100})},50)}))}catch{this.setState({chartInitialized:!1,dataLoadProgress:100})}}refreshExternalData(t){const e=pi.loadData({data:this.props.data,url:this.props.url});this.originalData=e,t?.()}refreshInternalData(t){const e=wt.handleData(this.originalData,ae({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType);this.preparedData=e,this.setState({displayData:e},()=>{t?.()})}setupResizeObserver(){this.chartContainerRef.current&&(this.resizeObserver=new zi(t=>{for(const e of t)if(e.target===this.chartContainerRef.current&&this.chart){const{width:i,height:r}=e.contentRect,n=Math.max(i,100),s=Math.max(r,100);requestAnimationFrame(()=>{try{if(this.chart){const a=this.chart.timeScale(),o=a.getVisibleRange();this.chart.applyOptions({width:n,height:s}),o&&setTimeout(()=>{try{a.setVisibleRange(o)}catch{}},10)}}catch{}})}}),this.resizeObserver.observe(this.chartContainerRef.current))}updateChartTheme(){const{currentTheme:t}=this.state;if(this.chart)try{this.chart.applyOptions({layout:t.layout,grid:{vertLines:{color:t.grid.vertLines.color+"30",style:1,visible:!0},horzLines:{color:t.grid.horzLines.color+"30",style:1,visible:!0}}}),this.chart.applyOptions({timeScale:{borderColor:t.grid.vertLines.color},rightPriceScale:{borderColor:t.grid.horzLines.color}})}catch{}this.currentSeries&&rr(this.currentSeries,t)}getThemeConfig(t){return t==="light"?Io:Oo}getI18nConfig(t){return t==="en"?re:Do}render(){const{currentTheme:t,isDataLoading:e}=this.state,{height:i=500,showToolbar:r=!0}=this.props,n=`
|
|
151
151
|
.custom-scrollbar::-webkit-scrollbar {
|
|
152
152
|
width: 6px;
|
|
153
153
|
}
|