acttrader-charts 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MACD-DZxpf0eQ.d.cts → MACD-DGFPNwy9.d.cts} +27 -0
- package/dist/{MACD-DZxpf0eQ.d.ts → MACD-DGFPNwy9.d.ts} +27 -0
- package/dist/index.cjs +508 -168
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +103 -5
- package/dist/index.d.ts +103 -5
- package/dist/index.js +508 -168
- package/dist/index.js.map +1 -1
- package/dist/indicators/index.d.cts +2 -2
- package/dist/indicators/index.d.ts +2 -2
- package/dist/webview/chart.html +7 -7
- package/package.json +1 -1
package/dist/webview/chart.html
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</head>
|
|
32
32
|
<body>
|
|
33
33
|
<div id="chart"></div>
|
|
34
|
-
<script>(function(){var e=`data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cmask%20id='mask0'%20mask-type='alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='32'%20height='32'%3e%3crect%20width='32'%20height='32'%20fill='%23C4C4C4'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0)'%3e%3crect%20width='82.6667'%20height='32'%20fill='url(%23pattern0)'/%3e%3c/g%3e%3cdefs%3e%3cpattern%20id='pattern0'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0'%20transform='translate(0%20-0.015879)%20scale(0.00304878%200.00787602)'/%3e%3c/pattern%3e%3cimage%20id='image0'%20width='328'%20height='131'%20xlink:href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAACDCAYAAADvTILwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVF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0XvGSLLe89oEhKYCE3rPa8X4rPtT5OJ2nvmnbZP1mEeLJtO1rBrFYrSFlY0Ab3Wevl3h7WB1zNf6YsvFOYreJtYo6KuuM++DY7cWY8ntPlp72RiB14YtDWi4Zit6+5cI6FxYXGR2RAE2ksaxWAY1YTcHu661Nehnwd/ENAf65xGsdSNNTJEBLePmyWQOgaATUxNJNLdVo693DmvXq9+59oaG1Cfv7b6L81xFefsS/OWuZDprjdlt+szKfZ2rc+BC7It5Om9FaXvQ0TKbXLf2W/pgsYKvXaDLx37/7mXsgaNnONfzGb04h/CkC3wcr2H5mMtLck/N/2OvYWawFb5wRY4VgDy7wZwj158GpO5GacjIvgtsR9tSJq1Hl3GanC8wMTAc0I77fGyn7wWAPOM9NRcEXAHHK3es3PuzG6Paw1pbxhr1dfZl5l/IMV0GkM3ab+bOc585zdY5jYsbhP5eu6c5S9lfp5UH5cplkPtWLsPKWBml4/8LMACJdZs7j1kabAAAAABJRU5ErkJggg=='/%3e%3c/defs%3e%3c/svg%3e`,t=class{constructor(){this.bars=[]}set(e){this.bars=[...e].sort((e,t)=>e.time-t.time)}get all(){return this.bars}get length(){return this.bars.length}getVisible(e){let t=Math.max(0,Math.floor(e.startIndex)),n=Math.min(this.bars.length-1,Math.ceil(e.endIndex));return this.bars.slice(t,n+1)}getPriceRange(e,t=.05){let n=this.getVisible(e);if(n.length===0)return{min:0,max:1};let r=1/0,i=-1/0;for(let e of n)e.low<r&&(r=e.low),e.high>i&&(i=e.high);let a=i-r;return{min:r-a*t,max:i+a*t}}getVolumeRange(e){let t=this.getVisible(e);return t.length===0?{min:0,max:1}:{min:0,max:Math.max(...t.map(e=>{var t;return(t=e.volume)==null?0:t}))}}get hasVolumeData(){return this.bars.some(e=>{var t;return`volume`in e&&((t=e.volume)==null?0:t)>0})}getPricePrecision(){let e=2;for(let t of this.bars)for(let n of[t.open,t.high,t.low,t.close]){let t=n.toString(),r=t.indexOf(`.`);if(r!==-1){let n=t.length-r-1;n>e&&(e=n)}}return Math.min(e,8)}prepend(e){var t,n;let r=(t=(n=this.bars[0])==null?void 0:n.time)==null?1/0:t,i=e.filter(e=>e.time<r).sort((e,t)=>e.time-t.time);return i.length===0?0:(this.bars=[...i,...this.bars],i.length)}},n,r=class e{xToPixel(e,t,n){let r=n/Math.max(1,t.endIndex-t.startIndex);return(e-t.startIndex)*r+r/2}pixelToBarIndex(e,t,n){let r=n/Math.max(1,t.endIndex-t.startIndex);return t.startIndex+e/r-.5}candleBodyWidth(e,t){let n=t/Math.max(1,e.endIndex-e.startIndex)*.7;return Math.max(1,Math.min(n,40))}yToPixel(t,n,r){let{min:i,max:a}=n,o=e.VERTICAL_PADDING_PX,s=r-2*o;return o+s-(t-i)/(a-i)*s}pixelToPrice(t,n,r){let{min:i,max:a}=n,o=e.VERTICAL_PADDING_PX,s=r-2*o;return a-(t-o)/s*(a-i)}volumeToPixel(e,t,n){return n-e/t*n*.9}};n=r,n.VERTICAL_PADDING_PX=20;function i(e){if(!isFinite(e)||e<=0)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<1.5?1:n<3.5?2:n<7.5?5:10)*t}function a(e,t,n=48){let{min:r,max:a}=e;if(!isFinite(r)||!isFinite(a)||a<=r)return[r];let o=Math.max(2,Math.floor(t/n)),s=i((a-r)/o),c=Math.ceil(r/s)*s,l=[],u=s*1e-6;for(let e=c;e<=a+u;e+=s)l.push(e);return l}function o(e,t=0){return!isFinite(e)||e<=0?t:Math.max(t,-Math.floor(Math.log10(e)))}var s=class{constructor(){this.listeners=new Map}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}off(e,t){var n;(n=this.listeners.get(e))==null||n.delete(t)}emit(e,t){var n;(n=this.listeners.get(e))==null||n.forEach(e=>e(t))}};function c(e,t){var n,r,i,a,o,s;return t?{background:(n=t.background)==null?e.background:n,grid:(r=t.grid)==null?e.grid:r,axisText:(i=t.axisText)==null?e.axisText:i,axisBorder:(a=t.axisBorder)==null?e.axisBorder:a,crosshair:(o=t.crosshair)==null?e.crosshair:o,tooltip:{...e.tooltip,...t.tooltip},candle:{...e.candle,...t.candle},volume:{...e.volume,...t.volume},ui:{...e.ui,...t.ui,stream:{...e.ui.stream,...(s=t.ui)==null?void 0:s.stream}},drawingToolbar:{...e.drawingToolbar,...t.drawingToolbar},topBar:{...e.topBar,...t.topBar},bottomBar:{...e.bottomBar,...t.bottomBar},indicatorOverlay:{...e.indicatorOverlay,...t.indicatorOverlay},tradeLevels:{...e.tradeLevels,...t.tradeLevels},tradePanel:{...e.tradePanel,...t.tradePanel}}:e}function l(e,t){let n=document.createElement(`div`);n.style.display=`none`,t.appendChild(n);let r=e=>e.includes(`var(`)?(e=e.replace(/rgba\(\s*(var\([^)]+\))\s*,\s*([0-9.]+)\s*\)/g,`rgb($1 / $2)`),n.style.color=``,n.style.color=e,getComputedStyle(n).color||e):e,i={background:r(e.background),grid:r(e.grid),axisText:r(e.axisText),axisBorder:r(e.axisBorder),crosshair:r(e.crosshair),tooltip:{background:r(e.tooltip.background),text:r(e.tooltip.text),border:r(e.tooltip.border)},candle:{up:r(e.candle.up),down:r(e.candle.down),wickUp:r(e.candle.wickUp),wickDown:r(e.candle.wickDown),...e.candle.borderUp!==void 0&&{borderUp:r(e.candle.borderUp)},...e.candle.borderDown!==void 0&&{borderDown:r(e.candle.borderDown)}},volume:{up:r(e.volume.up),down:r(e.volume.down)},ui:{accent:r(e.ui.accent),accentText:r(e.ui.accentText),accentBg:r(e.ui.accentBg),accentBgStrong:r(e.ui.accentBgStrong),disabledText:r(e.ui.disabledText),soonBadgeText:r(e.ui.soonBadgeText),stream:{connected:r(e.ui.stream.connected),reconnecting:r(e.ui.stream.reconnecting),disconnected:r(e.ui.stream.disconnected)}},drawingToolbar:{iconColor:r(e.drawingToolbar.iconColor),activeIconColor:r(e.drawingToolbar.activeIconColor),flyoutLabelColor:r(e.drawingToolbar.flyoutLabelColor),flyoutHeadingColor:r(e.drawingToolbar.flyoutHeadingColor)},topBar:{btnColor:r(e.topBar.btnColor),activeBtnColor:r(e.topBar.activeBtnColor),flyoutRowColor:r(e.topBar.flyoutRowColor),flyoutCategoryColor:r(e.topBar.flyoutCategoryColor)},bottomBar:{btnColor:r(e.bottomBar.btnColor),activeBtnBg:r(e.bottomBar.activeBtnBg),activeBtnText:r(e.bottomBar.activeBtnText),activeBtnBorder:r(e.bottomBar.activeBtnBorder)},indicatorOverlay:{pillBg:r(e.indicatorOverlay.pillBg),iconColor:r(e.indicatorOverlay.iconColor),dropdownHoverBg:r(e.indicatorOverlay.dropdownHoverBg)},tradeLevels:{tradeLine:r(e.tradeLevels.tradeLine),positionLine:r(e.tradeLevels.positionLine),pendingBuyLine:r(e.tradeLevels.pendingBuyLine),pendingSellLine:r(e.tradeLevels.pendingSellLine),labelText:r(e.tradeLevels.labelText),closeBtn:r(e.tradeLevels.closeBtn),closeBtnText:r(e.tradeLevels.closeBtnText),boxBg:r(e.tradeLevels.boxBg),boxBgHover:r(e.tradeLevels.boxBgHover),dragHandle:r(e.tradeLevels.dragHandle),dragHandleHover:r(e.tradeLevels.dragHandleHover)},tradePanel:{background:r(e.tradePanel.background),border:r(e.tradePanel.border),headerBg:r(e.tradePanel.headerBg),tabActive:r(e.tradePanel.tabActive),tabInactive:r(e.tradePanel.tabInactive),rowHoverBg:r(e.tradePanel.rowHoverBg),rowText:r(e.tradePanel.rowText),rowSubText:r(e.tradePanel.rowSubText)}};return t.removeChild(n),i}var u={background:`#141d22`,grid:`#243344`,axisText:`#a8bac8`,axisBorder:`#1c2a35`,crosshair:`rgba(255,255,255,0.4)`,tooltip:{background:`#1c2a35`,text:`#e8eef2`,border:`#1c2a35`},candle:{up:`#5caf79`,down:`#DF6868`,wickUp:`#5caf79`,wickDown:`#DF6868`},volume:{up:`rgba(92,175,121,0.4)`,down:`rgba(223,104,104,0.4)`},ui:{accent:`#398dff`,accentText:`#93bcff`,accentBg:`rgba(57,141,255,0.15)`,accentBgStrong:`rgba(57,141,255,0.22)`,disabledText:`#484f58`,soonBadgeText:`#30363d`,stream:{connected:`#5caf79`,reconnecting:`#e8b84b`,disconnected:`#555555`}},drawingToolbar:{iconColor:`#e8eef2`,activeIconColor:`#93bcff`,flyoutLabelColor:`#a8bac8`,flyoutHeadingColor:`#a8bac8`},topBar:{btnColor:`#a8bac8`,activeBtnColor:`#93bcff`,flyoutRowColor:`#a8bac8`,flyoutCategoryColor:`#a8bac8`},bottomBar:{btnColor:`#a8bac8`,activeBtnBg:`#5caf79`,activeBtnText:`#ffffff`,activeBtnBorder:`#5caf79`},indicatorOverlay:{pillBg:`rgba(28,42,53,0.73)`,iconColor:`#a8bac8`,dropdownHoverBg:`#1c2a35`},tradeLevels:{tradeLine:`#5caf79`,positionLine:`#7b61ff`,pendingBuyLine:`rgba(92,175,121,0.75)`,pendingSellLine:`rgba(223,104,104,0.75)`,labelText:`#ffffff`,closeBtn:`rgba(255,255,255,0.18)`,closeBtnText:`#ffffff`,boxBg:`rgba(20, 24, 36, 0.92)`,boxBgHover:`rgba(35, 40, 58, 0.97)`,dragHandle:`rgba(255,255,255,0.3)`,dragHandleHover:`#9ca3af`},tradePanel:{background:`#1c2a35`,border:`#243344`,headerBg:`#151f28`,tabActive:`#93bcff`,tabInactive:`#a8bac8`,rowHoverBg:`rgba(255,255,255,0.04)`,rowText:`#e8eef2`,rowSubText:`#9ca3af`}},d={background:`#ffffff`,grid:`#efefef`,axisText:`#666666`,axisBorder:`#cccccc`,crosshair:`#999999`,tooltip:{background:`#f8f8f8`,text:`#333333`,border:`#cccccc`},candle:{up:`#5caf79`,down:`#DF6868`,wickUp:`#5caf79`,wickDown:`#DF6868`},volume:{up:`rgba(92,175,121,0.6)`,down:`rgba(223,104,104,0.6)`},ui:{accent:`#398dff`,accentText:`#2a7aff`,accentBg:`rgba(57,141,255,0.10)`,accentBgStrong:`rgba(57,141,255,0.18)`,disabledText:`#94a3b8`,soonBadgeText:`#cbd5e1`,stream:{connected:`#5caf79`,reconnecting:`#d97706`,disconnected:`#94a3b8`}},drawingToolbar:{iconColor:`#333333`,activeIconColor:`#398dff`,flyoutLabelColor:`#666666`,flyoutHeadingColor:`#666666`},topBar:{btnColor:`#666666`,activeBtnColor:`#398dff`,flyoutRowColor:`#666666`,flyoutCategoryColor:`#666666`},bottomBar:{btnColor:`#666666`,activeBtnBg:`#5caf79`,activeBtnText:`#ffffff`,activeBtnBorder:`#5caf79`},indicatorOverlay:{pillBg:`rgba(248,248,248,0.85)`,iconColor:`#666666`,dropdownHoverBg:`#f0f0f0`},tradeLevels:{tradeLine:`#5caf79`,positionLine:`#6d28d9`,pendingBuyLine:`rgba(92,175,121,0.75)`,pendingSellLine:`rgba(223,104,104,0.75)`,labelText:`#ffffff`,closeBtn:`rgba(0,0,0,0.15)`,closeBtnText:`#ffffff`,boxBg:`rgba(240, 244, 252, 0.95)`,boxBgHover:`rgba(255, 255, 255, 0.99)`,dragHandle:`#94a3b8`,dragHandleHover:`#475569`},tradePanel:{background:`#f8f8f8`,border:`#cccccc`,headerBg:`#f0f0f0`,tabActive:`#398dff`,tabInactive:`#666666`,rowHoverBg:`rgba(0,0,0,0.03)`,rowText:`#333333`,rowSubText:`#666666`}},f=`'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif`,p={iconBtnSize:40,iconFontSize:`20px`,iconFontFamily:f,flyoutLabelFontSize:`12px`,flyoutLabelFontFamily:f,shortcutFontSize:`9px`,soonBadgeFontSize:`9px`,flyoutHeadingFontSize:`10px`,flyoutHeadingLetterSpacing:`0.08em`,scrollBtnHeight:20,scrollBtnFontSize:`9px`,barPadding:7,btnGap:4,mobileBreakpoint:480},m={height:`36px`,dropBtnFontSize:`11px`,dropBtnFontFamily:f,drawBtnSize:`26px`,drawBtnIconFontSize:`14px`,iconBtnSize:`26px`,mobileIconBtnSize:`28px`,mobileDrawBtnIconSize:`16px`,flyoutRowFontSize:`12px`,flyoutRowFontFamily:f,flyoutCategoryFontSize:`10px`,flyoutCategoryLetterSpacing:`0.08em`,flyoutCheckFontSize:`11px`,streamDotSize:`7px`},h={height:`32px`,btnFontSize:`11px`,btnFontFamily:f},g={fontSize:`11px`,fontFamily:f},_={fontSize:`11px`,fontFamily:f},v={labelHeight:18,labelPaddingX:4,fontSize:`11px`,fontFamily:f},y={pillFontSize:`13px`,pillFontFamily:f,dotFontSize:`8px`,pillIconFontSize:`12px`,collapseBtnFontSize:`13px`,collapseBtnFontFamily:f,dropdownRowFontSize:`11px`,dropdownRowFontFamily:f,dropdownIconFontSize:`10px`},b={size:22,mobileSize:24,iconSize:14,mobileIconSize:16},x={drawingToolbar:p,topBar:m,bottomBar:h,priceAxis:g,timeAxis:_,crosshair:v,indicatorOverlay:y,tradeButton:b};function S(e){return e?{drawingToolbar:{...p,...e.drawingToolbar},topBar:{...m,...e.topBar},bottomBar:{...h,...e.bottomBar},priceAxis:{...g,...e.priceAxis},timeAxis:{..._,...e.timeAxis},crosshair:{...v,...e.crosshair},indicatorOverlay:{...y,...e.indicatorOverlay},tradeButton:{...b,...e.tradeButton}}:x}var C={topBar:{series:{candlestick:`Candles`,hollow:`Hollow`,ohlc:`OHLC`,line:`Line`,area:`Area`,heikinashi:`Heikin Ashi`,volumecandles:`Volume Candles`,linemarkers:`Line with Markers`,step:`Step Line`,hlcarea:`HLC Area`,baseline:`Baseline`,columns:`Columns`,highlow:`High-low`},timeframes:{"1m":`1m`,"5m":`5m`,"15m":`15m`,"30m":`30m`,"1h":`1h`,"2h":`2h`,"4h":`4h`,"8h":`8h`,"1D":`1D`,"1W":`1W`,"1M":`1M`},indicatorsBtn:`Indicators`,indicatorsBtnActive:`Indicators ({count})`,toggleDrawingTitle:`Toggle Drawing Tools`,toggleFullscreenTitle:`Toggle Fullscreen`,exitFullscreenTitle:`Exit Fullscreen`,settingsTitle:`Settings`,tfcToggleTitle:`Trade from Charts`},bottomBar:{durations:{"1D":`1D`,"5D":`5D`,"1M":`1M`,"3M":`3M`,"6M":`6M`,"1Y":`1Y`,"5Y":`5Y`,All:`All`}},drawingToolbar:{categories:{trendLines:`Trend Lines & Channels`,fibonacci:`Fibonacci & Gann Tools`,shapes:`Geometric Shapes`,measurements:`Measurement Tools`,pitchforks:`Pitchfork Tools`,volume:`Volume & Statistical Tools`,annotations:`Annotation Tools`,patterns:`Pattern Recognition`,elliott:`Elliott Wave Tools`,brushes:`Brush & Highlighter`,advanced:`Advanced Tools`,priceProjection:`Price Projection Tools`},tools:{horizontalLine:`Horizontal Line`,verticalLine:`Vertical Line`,trendLine:`Trend Line`,trendAngle:`Trend Angle`,crossLine:`Cross Line`,parallelChannel:`Parallel Channel`,flatChannel:`Flat Top/Bottom Channel`,disjointChannel:`Disjoint Channel`,fibRetracement:`Fibonacci Retracement`,fibExtension:`Fibonacci Extension`,fibChannel:`Fibonacci Channel`,fibTimezone:`Fibonacci Timezone`,fibCircles:`Fibonacci Circles`,fibSpiral:`Fibonacci Spiral`,fibFan:`Fibonacci Speed Resistance Fan`,fibProjection:`Fibonacci Projection`,gannFan:`Gann Fan`,gannSquare:`Gann Square`,gannBox:`Gann Box`,rectangle:`Rectangle`,rotatedRectangle:`Rotated Rectangle`,ellipse:`Ellipse`,triangle:`Triangle`,circle:`Circle`,arc:`Arc`,polyline:`Polyline`,path:`Path`,priceRange:`Price Range`,dateRange:`Date Range`,datePriceRange:`Date & Price Range`,ruler:`Ruler`,pitchfork:`Pitchfork`,schiffPitchfork:`Schiff Pitchfork`,modifiedSchiff:`Modified Schiff Pitchfork`,insidePitchfork:`Inside Pitchfork`,fixedRangeVP:`Fixed Range Volume Profile`,anchoredVP:`Anchored Volume Profile`,volumeProfile:`Volume Profile`,regressionTrend:`Regression Trend`,text:`Text`,callout:`Callout`,priceLabel:`Price Label`,arrowMarker:`Arrow Marker`,flag:`Flag`,priceNote:`Price Note`,anchoredNote:`Anchored Note`,arrowUp:`Arrow Up`,arrowDown:`Arrow Down`,headShoulders:`Head & Shoulders`,trianglePattern:`Triangle Pattern`,threeDrives:`3 Drives Pattern`,abcdPattern:`ABCD Pattern`,cypherPattern:`Cypher Pattern`,butterflyPattern:`Butterfly Pattern`,batPattern:`Bat Pattern`,gartleyPattern:`Gartley Pattern`,crabPattern:`Crab Pattern`,sharkPattern:`Shark Pattern`,elliottImpulse:`Elliott Impulse (12345)`,elliottCorrective:`Elliott Corrective (ABC)`,elliottTriangle:`Elliott Wave Triangle`,elliottCombination:`Elliott Wave Combination`,elliottWxy:`Elliott Double Three (WXY)`,brush:`Brush`,highlighter:`Highlighter`,ghostFeed:`Ghost Feed`,projection:`Projection`,sineLine:`Sine Line`,cyclicLines:`Cyclic Lines`,timeCycles:`Time Cycles`,priceProjection:`Price Projection`},actions:{undo:`Undo (Ctrl+Z)`,redo:`Redo (Ctrl+Y)`,deleteSelected:`Delete Selected (Del)`,clearAll:`Clear All`,showAll:`Show All`,hideAll:`Hide All`,lockAll:`Lock All`,unlockAll:`Unlock All`,moreActions:`Actions`},soonBadge:`soon`,scrollUp:`Scroll up`,scrollDown:`Scroll down`},ohlc:{open:`O`,high:`H`,low:`L`,close:`C`,volume:`V`},trade:{buy:`Buy`,sell:`Sell`,limit:`Limit`,stop:`Stop`,market:`Market`,qty:`Qty`,placeOrderTitle:`Place order at this price`},dialogs:{settings:{title:`Chart Settings`,tfcSection:`Trade from Charts`,showLabel:`Show`,positionStyleLabel:`Position Style`,showAll:`All`,showPositions:`Positions Only`,showOrders:`Orders Only`,showNone:`None`,styleLine:`Full Line`,styleDot:`Dot`,resetBtn:`Reset to Defaults`},indicator:{titleSuffix:`Settings`,noParams:`No configurable parameters.`}},chart:{loading:`Loading…`,noData:`No data available`,scrollToLatest:`Scroll to latest`,nIndicators:`{count} indicators`}};function w(e){var t,n,r,i,a,o,s,c;if(!e)return C;let l=C;return{topBar:{...l.topBar,...e.topBar,series:{...l.topBar.series,...(t=e.topBar)==null?void 0:t.series},timeframes:{...l.topBar.timeframes,...(n=e.topBar)==null?void 0:n.timeframes}},bottomBar:{durations:{...l.bottomBar.durations,...(r=e.bottomBar)==null?void 0:r.durations}},drawingToolbar:{...l.drawingToolbar,...e.drawingToolbar,categories:{...l.drawingToolbar.categories,...(i=e.drawingToolbar)==null?void 0:i.categories},tools:{...l.drawingToolbar.tools,...(a=e.drawingToolbar)==null?void 0:a.tools},actions:{...l.drawingToolbar.actions,...(o=e.drawingToolbar)==null?void 0:o.actions}},ohlc:{...l.ohlc,...e.ohlc},trade:{...l.trade,...e.trade},dialogs:{settings:{...l.dialogs.settings,...(s=e.dialogs)==null?void 0:s.settings},indicator:{...l.dialogs.indicator,...(c=e.dialogs)==null?void 0:c.indicator}},chart:{...l.chart,...e.chart}}}var T,E=class e{constructor(t,n,r,i,a,o=()=>!1,s,c,l,u){var d,f,p,m;this.canvas=t,this.getViewport=n,this.setViewport=r,this.totalBars=i,this.onUpdate=a,this.isLocked=o,this.panY=s,this.onDragStart=c,this.onDragEnd=l,this.isDragging=!1,this.isTouchDrag=!1,this.lastX=0,this.lastY=0,this.dragStartX=0,this.dragStartY=0,this.hasPanned=!1,this.dragStartFired=!1,this._velBuffer=[],this._momentumRafId=null,this.onMouseDown=e=>{this._stopMomentum(),!this.isLocked()&&(this.isDragging=!0,this.isTouchDrag=!1,this.lastX=e.clientX,this.lastY=e.clientY,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.hasPanned=!1,this._velBuffer.length=0)},this.onTouchStart=e=>{var t;if(e.touches.length!==1){this._stopMomentum();return}this._stopMomentum(),!this.isLocked()&&(this.isDragging=!0,this.isTouchDrag=!0,this.lastX=e.touches[0].clientX,this.lastY=e.touches[0].clientY,this.dragStartX=e.touches[0].clientX,this.dragStartY=e.touches[0].clientY,this.dragStartFired=!0,this._velBuffer.length=0,(t=this.onDragStart)==null||t.call(this))},this.onMouseMove=t=>{if(!this.isDragging)return;if(this.isLocked()){this.isDragging=!1,this.hasPanned=!1;return}let n=t.clientX-this.lastX,r=t.clientY-this.lastY;this.lastX=t.clientX,this.lastY=t.clientY;let i=Math.abs(t.clientX-this.dragStartX),a=Math.abs(t.clientY-this.dragStartY);if(!this.hasPanned&&(i>e.DRAG_THRESHOLD||a>e.DRAG_THRESHOLD)){var o;this.hasPanned=!0,this.dragStartFired=!0,(o=this.onDragStart)==null||o.call(this),this.canvas.style.cursor=`grabbing`}this.hasPanned&&(this._recordVelocitySample(n,performance.now()),this.pan(n),this.panY&&this.panY(r))},this.onTouchMove=e=>{if(!this.isDragging||e.touches.length!==1)return;if(this.isLocked()){this.isDragging=!1;return}e.preventDefault();let t=e.touches[0].clientX-this.lastX,n=e.touches[0].clientY-this.lastY;this._recordVelocitySample(t,performance.now()),this.pan(t),this.panY&&this.panY(n),this.lastX=e.touches[0].clientX,this.lastY=e.touches[0].clientY},this.onMouseUp=()=>{if(this.hasPanned&&(this.canvas.style.cursor=`crosshair`),this.isDragging=!1,this.hasPanned=!1,this.dragStartFired){var e;this.dragStartFired=!1;let t=this._computeReleaseVelocity();this._velBuffer.length=0,this._startMomentum(t)||(e=this.onDragEnd)==null||e.call(this)}},this._momentumEnabled=(d=u==null?void 0:u.enabled)==null?!0:d,this._momentumDecay=Math.min(.99,Math.max(.8,(f=u==null?void 0:u.decay)==null?.95:f)),this._momentumThreshold=(p=u==null?void 0:u.threshold)==null?.3:p,this._momentumMaxVelocity=(m=u==null?void 0:u.maxVelocity)==null?6:m,this.attach()}attach(){this.canvas.addEventListener(`mousedown`,this.onMouseDown),window.addEventListener(`mousemove`,this.onMouseMove),window.addEventListener(`mouseup`,this.onMouseUp),this.canvas.addEventListener(`touchstart`,this.onTouchStart,{passive:!1}),window.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),window.addEventListener(`touchend`,this.onMouseUp)}cancel(){this._stopMomentum(),this.isDragging=!1,this.hasPanned=!1}destroy(){this._stopMomentum(),this.canvas.removeEventListener(`mousedown`,this.onMouseDown),window.removeEventListener(`mousemove`,this.onMouseMove),window.removeEventListener(`mouseup`,this.onMouseUp),this.canvas.removeEventListener(`touchstart`,this.onTouchStart),window.removeEventListener(`touchmove`,this.onTouchMove),window.removeEventListener(`touchend`,this.onMouseUp)}_recordVelocitySample(t,n){this._velBuffer.push({dx:t,t:n});let r=n-e.VEL_WINDOW_MS,i=0;for(;i<this._velBuffer.length&&this._velBuffer[i].t<r;)i++;i>0&&this._velBuffer.splice(0,i)}_computeReleaseVelocity(){let e=this._velBuffer;if(e.length<2)return 0;let t=e.reduce((e,t)=>e+t.dx,0),n=e[e.length-1].t-e[0].t;if(n<=0)return 0;let r=t/n;return Math.sign(r)*Math.min(Math.abs(r),this._momentumMaxVelocity)}_startMomentum(e){if(!this._momentumEnabled||Math.abs(e)<this._momentumThreshold)return!1;let t=null,n=e,r=this._momentumDecay,i=e=>{if(t===null){t=e,this._momentumRafId=requestAnimationFrame(i);return}let a=e-t;t=e,n*=r**(a/16.67);let o=n*a;if(Math.abs(o)<.5){var s;this._stopMomentum(),(s=this.onDragEnd)==null||s.call(this);return}if(this.isLocked()){var c;this._stopMomentum(),(c=this.onDragEnd)==null||c.call(this);return}let l=this.getViewport().startIndex;if(this.pan(o),this.getViewport().startIndex===l){var u;this._stopMomentum(),(u=this.onDragEnd)==null||u.call(this);return}this._momentumRafId=requestAnimationFrame(i)};return this._momentumRafId=requestAnimationFrame(i),!0}_stopMomentum(){this._momentumRafId!==null&&(cancelAnimationFrame(this._momentumRafId),this._momentumRafId=null)}pan(e){let t=this.getViewport(),n=t.endIndex-t.startIndex,r=n/(this.isTouchDrag?this.canvas.clientWidth||this.canvas.width/(window.devicePixelRatio||1):this.canvas.width),i=-e*r,a=Math.max(0,this.totalBars()-Math.floor(n/2)),o=Math.max(0,Math.min(a,t.startIndex+i));this.setViewport({...t,startIndex:o,endIndex:o+n}),this.onUpdate()}};T=E,T.DRAG_THRESHOLD=4,T.VEL_WINDOW_MS=100;var D=10,O=500,k=class{constructor(e,t,n,r,i,a=()=>e.getBoundingClientRect(),o=()=>e.offsetWidth,s){this.canvas=e,this.getViewport=t,this.setViewport=n,this.totalBars=r,this.onUpdate=i,this.getCanvasRect=a,this.getChartWidth=o,this.panByPixelDelta=s,this._pinchStartDist=0,this._pinchStartRatio=0,this._pinchStartViewport=null,this.onWheel=e=>{e.preventDefault();let t=this.getViewport(),n=t.endIndex-t.startIndex,r;if(e.ctrlKey){let t=Math.max(-50,Math.min(50,e.deltaY));r=Math.exp(t*.01)}else{if(e.deltaX!==0&&Math.abs(e.deltaX)>Math.abs(e.deltaY)*.5){this.panByPixelDelta&&this.panByPixelDelta(e.deltaX),this.onUpdate();return}if(e.deltaY===0)return;r=e.deltaY>0?1.1:.9}let i=Math.round(Math.max(D,Math.min(O,n*r)));if(t.endIndex>=this.totalBars()){let e=Math.min(t.endIndex,this.totalBars()+Math.floor(i/2)),n=Math.max(0,e-i);this.setViewport({...t,startIndex:n,endIndex:n+i})}else{let r=e.offsetX/this.getChartWidth(),a=t.startIndex+n*r,o=Math.max(0,a-i*r);this.setViewport({...t,startIndex:o,endIndex:o+i})}this.onUpdate()},this.onTouchStart=e=>{if(e.touches.length!==2)return;this._pinchStartDist=this.pinchDist(e.touches[0],e.touches[1]),this._pinchStartViewport={...this.getViewport()};let t=this.getCanvasRect(),n=(e.touches[0].clientX+e.touches[1].clientX)/2-t.left;this._pinchStartRatio=Math.max(0,Math.min(1,n/this.getChartWidth()))},this.onTouchMove=e=>{if(e.touches.length!==2)return;e.preventDefault();let t=this.pinchDist(e.touches[0],e.touches[1]);if(this._pinchStartDist===0||!this._pinchStartViewport){this._pinchStartDist=t,this._pinchStartViewport={...this.getViewport()};let n=this.getCanvasRect(),r=(e.touches[0].clientX+e.touches[1].clientX)/2;this._pinchStartRatio=Math.max(0,Math.min(1,(r-n.left)/this.getChartWidth()));return}let n=this._pinchStartDist/t,r=this._pinchStartViewport,i=r.endIndex-r.startIndex,a=Math.round(Math.max(D,Math.min(O,i*n))),o=this._pinchStartRatio,s=r.startIndex+i*o,c=Math.max(0,s-a*o);this.setViewport({...r,startIndex:c,endIndex:c+a}),this.onUpdate()},this.onTouchEnd=()=>{this._pinchStartDist=0,this._pinchStartViewport=null},this.attach()}attach(){this.canvas.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.canvas.addEventListener(`touchstart`,this.onTouchStart,{passive:!1}),this.canvas.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),this.canvas.addEventListener(`touchend`,this.onTouchEnd)}destroy(){this.canvas.removeEventListener(`wheel`,this.onWheel),this.canvas.removeEventListener(`touchstart`,this.onTouchStart),this.canvas.removeEventListener(`touchmove`,this.onTouchMove),this.canvas.removeEventListener(`touchend`,this.onTouchEnd)}pinchDist(e,t){let n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}};function A(e,t,n,r,i,a,o,s){let c=i.candleBodyWidth(n,o),l=t.length,u=new Float32Array(l),d=new Float32Array(l),f=new Float32Array(l),p=new Float32Array(l),m=new Float32Array(l),h=new Uint8Array(l),g=Math.floor(n.startIndex);for(let e=0;e<l;e++){let a=t[e];u[e]=i.xToPixel(g+e,n,o),d[e]=i.yToPixel(a.high,r,s),f[e]=i.yToPixel(a.low,r,s),p[e]=i.yToPixel(a.open,r,s),m[e]=i.yToPixel(a.close,r,s),h[e]=a.close>=a.open?1:0}e.lineWidth=1,e.strokeStyle=a.candle.wickUp,e.beginPath();for(let t=0;t<l;t++)h[t]&&(e.moveTo(u[t],d[t]),e.lineTo(u[t],f[t]));e.stroke(),e.strokeStyle=a.candle.wickDown,e.beginPath();for(let t=0;t<l;t++)h[t]||(e.moveTo(u[t],d[t]),e.lineTo(u[t],f[t]));e.stroke();for(let t=0;t<l;t++){var _,v;let n=Math.min(p[t],m[t]),r=Math.max(Math.abs(m[t]-p[t]),1),i=h[t]===1,o=i?a.candle.up:a.candle.down,s=i?(_=a.candle.borderUp)==null?a.candle.up:_:(v=a.candle.borderDown)==null?a.candle.down:v;e.fillStyle=o,e.fillRect(u[t]-c/2,n,c,r),s!==o&&(e.strokeStyle=s,e.lineWidth=1,e.strokeRect(u[t]-c/2,n,c,r))}}function j(e,t,n,r,i,a,o,s){let c=i.candleBodyWidth(n,o),l=Math.floor(n.startIndex);for(let d=0;d<t.length;d++){let f=t[d],p=l+d,m=i.xToPixel(p,n,o),h=f.close>=f.open,g=i.yToPixel(f.open,r,s),_=i.yToPixel(f.close,r,s),v=i.yToPixel(f.high,r,s),y=i.yToPixel(f.low,r,s),b=h?a.candle.up:a.candle.down,x=h?a.candle.wickUp:a.candle.wickDown;e.beginPath(),e.strokeStyle=x,e.lineWidth=1,e.moveTo(m,v),e.lineTo(m,y),e.stroke();let S=Math.min(g,_),C=Math.max(Math.abs(_-g),1);if(h)e.strokeStyle=b,e.lineWidth=1,e.strokeRect(m-c/2,S,c,C);else{var u;let t=(u=a.candle.borderDown)==null?a.candle.down:u;e.fillStyle=b,e.fillRect(m-c/2,S,c,C),t!==b&&(e.strokeStyle=t,e.lineWidth=1,e.strokeRect(m-c/2,S,c,C))}}}function M(e,t){let n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n)return`rgba(${n[1]},${n[2]},${n[3]},${t})`;let r=e.replace(`#`,``),i=r.length===3?r.split(``).map(e=>e+e).join(``):r;return`rgba(${parseInt(i.slice(0,2),16)},${parseInt(i.slice(2,4),16)},${parseInt(i.slice(4,6),16)},${t})`}var N=null;function P(e,t,n,r,i,a,o,s,c=!1){if(t.length===0)return;let l=Math.floor(n.startIndex);if(c){let c=i.xToPixel(l+t.length-1,n,o),u=i.xToPixel(l,n,o);e.beginPath();for(let a=0;a<t.length;a++){let c=i.xToPixel(l+a,n,o),u=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(c,u):e.lineTo(c,u)}if(e.lineTo(c,s),e.lineTo(u,s),e.closePath(),!N||N.height!==s||N.color!==a.candle.up){let t=e.createLinearGradient(0,0,0,s);t.addColorStop(0,M(a.candle.up,.15)),t.addColorStop(1,M(a.candle.up,0)),N={gradient:t,height:s,color:a.candle.up}}e.fillStyle=N.gradient,e.fill()}e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;for(let a=0;a<t.length;a++){let c=i.xToPixel(l+a,n,o),u=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(c,u):e.lineTo(c,u)}e.stroke()}function F(e,t,n,r,i,a,o,s){let c=Math.max(2,i.candleBodyWidth(n,o)*.4),l=Math.floor(n.startIndex);for(let u=0;u<t.length;u++){let d=t[u],f=l+u,p=i.xToPixel(f,n,o),m=d.close>=d.open?a.candle.up:a.candle.down,h=i.yToPixel(d.open,r,s),g=i.yToPixel(d.close,r,s),_=i.yToPixel(d.high,r,s),v=i.yToPixel(d.low,r,s);e.strokeStyle=m,e.lineWidth=1,e.beginPath(),e.moveTo(p,_),e.lineTo(p,v),e.stroke(),e.beginPath(),e.moveTo(p-c,h),e.lineTo(p,h),e.stroke(),e.beginPath(),e.moveTo(p,g),e.lineTo(p+c,g),e.stroke()}}function I(e,t,n,r,i,a,o,s,c){let l=i.candleBodyWidth(n,o),u=Math.floor(n.startIndex);for(let d=0;d<t.length;d++){let f=t[d];if(f.volume==null)continue;let p=u+d,m=i.xToPixel(p,n,o),h=f.close>=f.open,g=s-i.volumeToPixel(f.volume,r,s),_=c+s-g;e.fillStyle=h?a.volume.up:a.volume.down,e.fillRect(m-l/2,_,l,g)}}function L(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=(r.open+r.high+r.low+r.close)/4,a=n===0?(r.open+r.close)/2:(t[n-1].open+t[n-1].close)/2;t.push({time:r.time,open:a,close:i,high:Math.max(r.high,a,i),low:Math.min(r.low,a,i),volume:r.volume})}return t}function ee(e,t,n,r,i,a,o,s){let c=L(t),l=i.candleBodyWidth(n,o),u=Math.floor(n.startIndex);for(let t=0;t<c.length;t++){var d,f;let p=c[t],m=u+t,h=i.xToPixel(m,n,o),g=p.close>=p.open,_=i.yToPixel(p.open,r,s),v=i.yToPixel(p.close,r,s),y=i.yToPixel(p.high,r,s),b=i.yToPixel(p.low,r,s),x=g?a.candle.up:a.candle.down,S=g?a.candle.wickUp:a.candle.wickDown,C=g?(d=a.candle.borderUp)==null?a.candle.up:d:(f=a.candle.borderDown)==null?a.candle.down:f;e.beginPath(),e.strokeStyle=S,e.lineWidth=1,e.moveTo(h,y),e.lineTo(h,b),e.stroke();let w=Math.min(_,v),T=Math.max(Math.abs(v-_),1);e.fillStyle=x,e.fillRect(h-l/2,w,l,T),C!==x&&(e.strokeStyle=C,e.lineWidth=1,e.strokeRect(h-l/2,w,l,T))}}function R(e,t,n,r,i,a,o,s){let c=i.candleBodyWidth(n,o),l=Math.max(...t.map(e=>{var t;return(t=e.volume)==null?0:t}),1),u=Math.floor(n.startIndex);for(let m=0;m<t.length;m++){var d,f,p;let h=t[m],g=u+m,_=i.xToPixel(g,n,o),v=h.close>=h.open,y=l>0?((d=h.volume)==null?l:d)/l:1,b=Math.max(1,y*c),x=i.yToPixel(h.open,r,s),S=i.yToPixel(h.close,r,s),C=i.yToPixel(h.high,r,s),w=i.yToPixel(h.low,r,s),T=v?a.candle.up:a.candle.down,E=v?a.candle.wickUp:a.candle.wickDown,D=v?(f=a.candle.borderUp)==null?a.candle.up:f:(p=a.candle.borderDown)==null?a.candle.down:p;e.beginPath(),e.strokeStyle=E,e.lineWidth=1,e.moveTo(_,C),e.lineTo(_,w),e.stroke();let O=Math.min(x,S),k=Math.max(Math.abs(S-x),1);e.fillStyle=T,e.fillRect(_-b/2,O,b,k),D!==T&&(e.strokeStyle=D,e.lineWidth=1,e.strokeRect(_-b/2,O,b,k))}}function z(e,t,n,r,i,a,o,s){if(t.length===0)return;e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;let c=Math.floor(n.startIndex);for(let a=0;a<t.length;a++){let l=c+a,u=i.xToPixel(l,n,o),d=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(u,d):e.lineTo(u,d)}e.stroke();let l=Math.min(3,i.candleBodyWidth(n,o)*.35);if(!(l<.5)){e.fillStyle=a.candle.up;for(let a=0;a<t.length;a++){let u=c+a,d=i.xToPixel(u,n,o),f=i.yToPixel(t[a].close,r,s);e.beginPath(),e.arc(d,f,l,0,Math.PI*2),e.fill()}}}function B(e,t,n,r,i,a,o,s){if(t.length===0)return;e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;let c=Math.floor(n.startIndex),l=0;for(let a=0;a<t.length;a++){let u=c+a,d=i.xToPixel(u,n,o),f=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(d,f):(e.lineTo(d,l),e.lineTo(d,f)),l=f}e.stroke()}function V(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;return`rgba(${parseInt(r.slice(0,2),16)},${parseInt(r.slice(2,4),16)},${parseInt(r.slice(4,6),16)},${t})`}function te(e,t,n,r,i,a,o,s){if(t.length===0)return;let c=Math.floor(n.startIndex);e.beginPath();for(let a=0;a<t.length;a++){let l=i.xToPixel(c+a,n,o),u=i.yToPixel(t[a].high,r,s);a===0?e.moveTo(l,u):e.lineTo(l,u)}for(let a=t.length-1;a>=0;a--){let l=i.xToPixel(c+a,n,o),u=i.yToPixel(t[a].low,r,s);e.lineTo(l,u)}e.closePath(),e.fillStyle=V(a.candle.up,.12),e.fill(),e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;for(let a=0;a<t.length;a++){let l=i.xToPixel(c+a,n,o),u=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(l,u):e.lineTo(l,u)}e.stroke()}function H(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;return`rgba(${parseInt(r.slice(0,2),16)},${parseInt(r.slice(2,4),16)},${parseInt(r.slice(4,6),16)},${t})`}function U(e,t,n,r,i,a,o,s){if(t.length===0)return;let c=(r.min+r.max)/2,l=i.yToPixel(c,r,s),u=Math.floor(n.startIndex),d=t.map((e,t)=>({x:i.xToPixel(u+t,n,o),y:i.yToPixel(e.close,r,s)})),f=d[0].x,p=d[d.length-1].x,m=()=>{e.beginPath();for(let t=0;t<d.length;t++)t===0?e.moveTo(d[t].x,d[t].y):e.lineTo(d[t].x,d[t].y);e.lineTo(p,l),e.lineTo(f,l),e.closePath()};e.save(),e.beginPath(),e.rect(0,0,o,l),e.clip(),m(),e.fillStyle=H(a.candle.up,.15),e.fill(),e.restore(),e.save(),e.beginPath(),e.rect(0,l,o,s-l),e.clip(),m(),e.fillStyle=H(a.candle.down,.15),e.fill(),e.restore(),e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;for(let t=0;t<d.length;t++)t===0?e.moveTo(d[t].x,d[t].y):e.lineTo(d[t].x,d[t].y);e.stroke(),e.beginPath(),e.strokeStyle=H(a.candle.up,.4),e.lineWidth=1,e.setLineDash([4,4]),e.moveTo(f,l),e.lineTo(p,l),e.stroke(),e.setLineDash([])}function ne(e,t,n,r,i,a,o,s){let c=i.candleBodyWidth(n,o),l=Math.floor(n.startIndex);for(let u=0;u<t.length;u++){let d=t[u],f=l+u,p=i.xToPixel(f,n,o),m=d.close>=d.open,h=i.yToPixel(d.close,r,s),g=Math.max(1,s-h);e.fillStyle=m?a.candle.up:a.candle.down,e.fillRect(p-c/2,h,c,g)}}function re(e,t,n,r,i,a,o,s){e.lineWidth=1.5;let c=Math.floor(n.startIndex);for(let l=0;l<t.length;l++){let u=t[l],d=c+l,f=i.xToPixel(d,n,o),p=u.close>=u.open,m=i.yToPixel(u.high,r,s),h=i.yToPixel(u.low,r,s);e.strokeStyle=p?a.candle.up:a.candle.down,e.beginPath(),e.moveTo(f,m),e.lineTo(f,h),e.stroke()}}function ie(e,t,n,r,i,o,s){if(e.save(),e.globalAlpha=.6,e.strokeStyle=r.grid,e.lineWidth=1,e.beginPath(),s===void 0)for(let r of a(t,o)){let a=Math.round(n.yToPixel(r,t,o))+.5;e.moveTo(0,a),e.lineTo(i,a)}else{let r=(t.max-t.min)/s;for(let a=0;a<=s;a++){let s=t.min+r*a,c=Math.round(n.yToPixel(s,t,o))+.5;e.moveTo(0,c),e.lineTo(i,c)}}e.stroke();let c=Math.max(1,Math.floor(i/80)),l=i/c;e.beginPath();for(let t=1;t<c;t++){let n=Math.round(t*l)+.5;e.moveTo(n,0),e.lineTo(n,o)}e.stroke(),e.restore()}var ae=[`1m`,`5m`,`15m`,`30m`,`1h`,`4h`];function oe(e,t,n=`UTC`){let r=new Date(e);return ae.includes(t)?`${r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`,timeZone:n})} ${r.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1,timeZone:n})}`:t===`1M`?r.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`,timeZone:n}):r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`,timeZone:n})}function se(e,t,n,r,i,a,o,s,c,l,u,d=2,f=v,p=`UTC`){let m=i.xToPixel(t.barIndex,r,o),h=i.yToPixel(t.price,n,s);e.setLineDash([4,4]),e.strokeStyle=a.crosshair,e.lineWidth=1,e.beginPath(),e.moveTo(m,0),e.lineTo(m,l),e.stroke(),e.beginPath(),e.moveTo(0,h),e.lineTo(o,h),e.stroke(),e.setLineDash([]);let g=f.labelHeight,_=f.labelPaddingX;e.font=`${f.fontSize} ${f.fontFamily}`;let y=t.price.toFixed(d);if(e.fillStyle=a.tooltip.background,e.fillRect(o,h-g/2,c,g),e.strokeStyle=a.crosshair,e.lineWidth=1,e.strokeRect(o,h-g/2,c,g),e.fillStyle=a.tooltip.text,e.textAlign=`left`,e.fillText(y,o+_,h+4),t.bar){let n=oe(t.bar.time,u,p),r=e.measureText(n).width+_*2,i=Math.max(0,Math.min(o-r,m-r/2));e.fillStyle=a.tooltip.background,e.fillRect(i,l,r,g),e.strokeStyle=a.crosshair,e.lineWidth=1,e.strokeRect(i,l,r,g),e.fillStyle=a.tooltip.text,e.textAlign=`left`,e.fillText(n,i+_,l+13)}}function ce(e,t,n=new Set){let r=e.filter(e=>!n.has(e.level.label)).sort((e,t)=>e.y-t.y);if(r.length<2)return[];let i=[],a=[r[0]],o=r[0].y;for(let e=1;e<r.length;e++){let n=r[e];n.y-o<=t?a.push(n):(i.push(a),a=[n],o=n.y)}return i.push(a),i.filter(e=>e.length>=2).map(e=>({id:`cluster:`+e.map(e=>e.level.label).sort().join(`|`),members:e,centerY:e.reduce((e,t)=>e+t.y,0)/e.length,centerPrice:e.reduce((e,t)=>e+t.price,0)/e.length}))}function le(e,t,n=4){let r=e.members.length,i=r*t+(r-1)*n,a=e.centerY-i/2,o=[...e.members].sort((e,t)=>e.y-t.y),s=new Map;for(let e=0;e<o.length;e++)s.set(o[e].level.label,a+e*(t+n));return s}function W(e,t,n){let r=e.members.length,i=new Set(e.members.map(e=>e.level.type)),a;if(i.size===1){let e=i.values().next().value;a=e===`position`?`Position`:e===`pending`?`Order`:`Trade`}else a=`Level`;let o=`${r} ${a}${r>1?`s`:``}`,s=12+n.measureText(o).width+16+12;return{badgeX:(t-s)/2,badgeY:e.centerY-24/2,badgeW:s,badgeH:24,text:o}}function ue(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}var de=8,fe=6,pe=6,me=4,he=16,ge=3,_e=1,ve=7,ye=7,be=4,xe=7,Se=4,Ce=6,we=`13px 'Inter', system-ui, sans-serif`,Te=`13px 'Inter', system-ui, sans-serif`,Ee=14,G=1.5,De=1,K=5,Oe=3,ke=he+Oe*2,Ae=`12px 'Inter', system-ui, sans-serif`,je=.68,q=[0,-.08,.08],J=30;function Me(e){return e.type===`position`&&!!e.pnlText}function Ne(e,t,n,r){return e<n+r&&e+t>n}function Pe(e,t,n,r,i){let a=[];e&&a.push(e);for(let e of i)a.push(e);let o=t,s=0,c=a.length+2;for(;s<c&&a.some(e=>Ne(o,n,e.boxY,e.boxH));)o+=r*(n+2),s++;return o}function Fe(e,t,n){var r,i,a;if((r=e.data)!=null&&r._isDraft){let t=e;return`${t.side.charAt(0).toUpperCase()+t.side.slice(1)} ${t.orderType.charAt(0).toUpperCase()+t.orderType.slice(1)}`}if(e.type===`pending`){var o;let r=e,i=r.lots===void 0?``:` ${r.lots}`;return(o=e.text)==null?`${r.side.toUpperCase()}${i} @${t.toFixed(n)}`:o}if(e.type===`position`&&e.entryPriceEditable){var s;let r=e,i=r.side?r.side.toUpperCase():``,a=r.lots===void 0?``:` ${r.lots}`;return(s=e.text)==null?`${i}${a} @${t.toFixed(n)}`:s}return e.type===`position`?(i=e.text)==null?``:i:(a=e.text)==null?e.label:a}function Ie(e,t,n,r,i,a,o,s,c,l=ke){let u=[];for(let i of e){if(i.label!==s&&i.label!==c)continue;let e=i;if(e.stopLossPrice!==void 0){let s=`${i.label}:stopLoss`,c=a===s&&o!==null?o:e.stopLossPrice;u.push({key:s,y:t.yToPixel(c,n,r)})}if(e.takeProfitPrice!==void 0){let s=`${i.label}:takeProfit`,c=a===s&&o!==null?o:e.takeProfitPrice;u.push({key:s,y:t.yToPixel(c,n,r)})}}u.sort((e,t)=>e.y-t.y);let d=i*je,f=q.map(e=>d+e*i),p=f.map(()=>-1/0),m=new Map;for(let e of u){let t=!1;for(let n=0;n<f.length;n++)if(e.y>=p[n]+l){m.set(e.key,f[n]),p[n]=e.y,t=!0;break}if(!t){let t=p.indexOf(Math.min(...p));m.set(e.key,f[t]),p[t]=e.y}}return m}function Le(e){let t=e.trim(),n=-1,r=-1,i=-1;if(t.startsWith(`#`)){let e=t.slice(1);e.length===3||e.length===4?(n=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),i=parseInt(e[2]+e[2],16)):(e.length===6||e.length===8)&&(n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16))}else{let e=t.match(/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i);e&&(n=parseFloat(e[1]),r=parseFloat(e[2]),i=parseFloat(e[3]))}return n<0||r<0||i<0||Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i)?!0:(.2126*n+.7152*r+.0722*i)/255>=.5}function Y(e){return Le(e.background)?`#000000`:`#ffffff`}function Re(e,t){return Le(e.background)?t?`rgb(230,230,230)`:`rgb(255,255,255)`:t?`rgb(30,30,30)`:`rgb(0,0,0)`}function ze(e,t,n){if(e.type===`position`){let r=e;if(r.entryPriceEditable&&r.side)return r.side===`buy`?t.pendingBuyLine:t.pendingSellLine;let i=e.pnl;return i===void 0?t.positionLine:i>=0?n.candle.up:n.candle.down}return e.type===`pending`?e.side===`buy`?t.pendingBuyLine:t.pendingSellLine:t.tradeLine}function Be(e){return e.type===`pending`?!0:e.type===`position`?!!e.entryPriceEditable:!1}function Ve(e,t,n,r,i,a,o,s,c=null,l=null,u=null,d=null,f=new Set,p=`line`,m=!1,h=null,g={},_=new Set,v=0,y=!1,b=null,x=null,S=1){if(t.length===0)return{hitAreas:[],editAreas:[],hoverAreas:[],dragAreas:[],confirmAreas:[],addBracketAreas:[],clusterBadgeAreas:[],clusters:[]};let C=i.tradeLevels,w=Math.min(Math.max(S,1),3),T=ve*w,E=ye*w,D=xe*w,O=be*w,k=Se*w,A=Math.max(T,E,D),j=Math.max(he+me*2,A*2+me*2),M=Math.max(ke,T*2+Oe*2);e.save(),e.font=we;let N=[];for(let i of t){var P,F;let t=l===i.label&&u!==null?u:i.price,a=n.yToPixel(t,r,o);if(a<-40||a>o+40)continue;if(p===`dot`&&i.type===`position`&&i.label!==d){N.push({level:i,price:t,y:a,boxW:0,boxH:0});continue}if(i.type===`pending`&&i.orderType===`market`&&((P=i.data)==null?void 0:P._isDraft)===!0){N.push({level:i,price:t,y:a,boxW:0,boxH:0});continue}let c=Me(i)?i.pnlText:null,h=f.has(i.label),g=Fe(i,t,s),_=c?e.measureText(c).width+Ce:0,v=e.measureText(g).width,b=h&&!m,x=b?(D*2+k)*2:0,S=b||m?0:E*2+O+T*2+de/2,C=((F=i.data)==null?void 0:F._isDraft)===!0,w=i.label===d||h,A=i.type===`position`&&i.entryPriceEditable===!0,M=i.type===`pending`||A,I=i.lots,L=y&&(C||w)&&M&&I!==void 0?String(I):null,ee=de+(L?fe+e.measureText(L).width+fe+pe:0)+_+v+de+x+S;N.push({level:i,price:t,y:a,boxW:ee,boxH:j})}let I=new Set;h&&I.add(h);let L=v>0?ce(N,v,I):[],ee=L.filter(e=>!_.has(e.id)),R=L.filter(e=>_.has(e.id)),z=new Set;for(let e of ee)for(let t of e.members)z.add(t.level.label);let B=new Map;for(let e of R)B.set(e.id,le(e,j,4));let V=new Map;for(let e of R)for(let t of e.members)V.set(t.level.label,e);N.sort((e,t)=>e.y-t.y);let te=[],H=new Map;for(let e of N){if(z.has(e.level.label))continue;let t=V.get(e.level.label);if(t){let n=B.get(t.id),r=n==null?void 0:n.get(e.level.label);if(r!==void 0){te.push({label:e.level.label,boxY:r,boxH:e.boxH}),H.set(e.level.label,{price:e.price,y:e.y,boxY:r,boxW:e.boxW,boxH:e.boxH});continue}}let n=e.y-e.boxH/2,r=0;for(;r<te.length+1&&te.some(t=>Ne(n,e.boxH,t.boxY,t.boxH));)n-=e.boxH+2,r++;te.push({label:e.level.label,boxY:n,boxH:e.boxH}),H.set(e.level.label,{price:e.price,y:e.y,boxY:n,boxW:e.boxW,boxH:e.boxH})}let U=Ie(t,n,r,o,a,l,u,c,d,M),ne=[],re=a*je;for(let e of t){if(e.label!==c&&e.label!==d)continue;let t=e,i=l===e.label;if(t.stopLossPrice!==void 0){var ie;let a=`${e.label}:stopLoss`,s=l===a&&u!==null?u:i&&b!==null?b:t.stopLossPrice;ne.push({key:a,label:e.label,y:n.yToPixel(s,r,o),columnX:(ie=U.get(a))==null?re:ie})}if(t.takeProfitPrice!==void 0){var ae;let a=`${e.label}:takeProfit`,s=l===a&&u!==null?u:i&&x!==null?x:t.takeProfitPrice;ne.push({key:a,label:e.label,y:n.yToPixel(s,r,o),columnX:(ae=U.get(a))==null?re:ae})}}ne.sort((e,t)=>e.y-t.y);let oe=new Map,se=[];for(let e of ne){let t=H.get(e.label),n=e.y-M/2,r=Pe(t?{boxY:t.boxY,boxH:t.boxH}:null,n,M,t&&Math.sign(e.y-t.y)||1,se.filter(t=>t.columnX===e.columnX));oe.set(e.key,r),se.push({columnX:e.columnX,boxY:r,boxH:M})}let W=c==null?d:c,ue=h==null?d:h,ge=N.filter(e=>!z.has(e.level.label)),_e=[...ge.filter(e=>e.level.label!==W),...ge.filter(e=>e.level.label===W)],Te=[],Ee=[],G=[],De=[],K=[],Ae=[],q=[],J=[];for(let t of ee)Ke(e,t,a,i,q);for(let{level:t}of _e){let h=H.get(t.label);h&&(Ye(e,t,h,a,C,i,s,t.label===c,t.label===d,n,r,o,l,u,U,f.has(t.label),p,Te,Ee,G,De,K,Ae,m,t.label===ue?g:void 0,y,J,b,x,S,oe),V.get(t.label)&&h.boxY!==h.y-j/2&&qe(e,h.boxY+j/2,h.y,a,i))}if(d!==null&&!H.has(d)){let c=t.find(e=>e.label===d);if(c){let t=c,d=`${c.label}:stopLoss`,f=`${c.label}:takeProfit`,p=l===c.label,h=p&&b!==null?b:t.stopLossPrice,g=p&&x!==null?x:t.takeProfitPrice;if(h!==void 0){var Le;Ze(e,t,`stopLoss`,h,n,r,o,(Le=U.get(d))==null?re:Le,a,i,s,l,u,Te,De,m,t._slOrderLabel,void 0,S,oe.get(d))}if(g!==void 0){var Y;Ze(e,t,`takeProfit`,g,n,r,o,(Y=U.get(f))==null?re:Y,a,i,s,l,u,Te,De,m,t._tpOrderLabel,void 0,S,oe.get(f))}}}return e.restore(),{hitAreas:Te,editAreas:Ee,hoverAreas:G,dragAreas:De,confirmAreas:K,addBracketAreas:Ae,clusterBadgeAreas:q,clusters:L,draftQtyPillArea:J[0]}}var He=`bold 12px 'Inter', system-ui, sans-serif`,Ue=12,We=24,Ge=12;function Ke(e,t,n,r,i){let a=Y(r),o=!Le(r.background);e.save(),e.strokeStyle=a,e.globalAlpha=.12,e.lineWidth=1,e.setLineDash([4,4]);for(let r of t.members)e.beginPath(),e.moveTo(0,r.y),e.lineTo(n,r.y),e.stroke();e.setLineDash([]),e.restore(),e.save(),e.font=He;let{badgeX:s,badgeY:c,badgeW:l,text:u}=W(t,n,e);e.fillStyle=o?`rgba(40,40,40,0.92)`:`rgba(240,240,240,0.92)`,e.beginPath(),e.roundRect(s,c,l,We,Ge),e.fill(),e.strokeStyle=a,e.globalAlpha=.3,e.lineWidth=1,e.stroke(),e.globalAlpha=1,e.fillStyle=a,e.globalAlpha=.85,e.textBaseline=`middle`,e.textAlign=`left`,e.fillText(u+` ▸`,s+Ue,c+We/2),e.globalAlpha=1,e.restore(),i.push({clusterId:t.id,x:s,y:c,w:l,h:We})}function qe(e,t,n,r,i){if(Math.abs(t-n)<2)return;let a=Y(i);e.save(),e.strokeStyle=a,e.globalAlpha=.25,e.lineWidth=1,e.setLineDash([2,3]);let o=r-8;e.beginPath(),e.moveTo(o,t),e.lineTo(o,n),e.stroke(),e.setLineDash([]),e.beginPath(),e.moveTo(o-4,n),e.lineTo(o+4,n),e.stroke(),e.restore()}function Je(e,t,n,r,i,a,o){let s=t,c=[],l=t;if(s.orderType!==void 0)c.push({label:`Price`,value:t.price.toFixed(o)}),l.stopLossPrice!==void 0&&c.push({label:`SL`,value:l.stopLossPrice.toFixed(o)}),l.takeProfitPrice!==void 0&&c.push({label:`TP`,value:l.takeProfitPrice.toFixed(o)});else{if(s.pnlText!==void 0){let e=s.pnl===void 0?void 0:s.pnl>=0?a.candle.up:a.candle.down;c.push({label:`PnL`,value:s.pnlText,pnlColor:e})}s.side!==void 0&&c.push({label:`Side`,value:s.side===`buy`?`Buy`:`Sell`}),s.lots!==void 0&&c.push({label:`Lots`,value:String(s.lots)}),c.length===0&&c.push({label:`Price`,value:t.price.toFixed(o)})}let u=de,d=me,f=he+3;e.save(),e.font=we;let p=Math.max(...c.map(t=>e.measureText(t.label).width)),m=Math.max(...c.map(t=>e.measureText(t.value).width)),h=u+p+8+m+u,g=d+c.length*f-3+d,_=r-i-8-h,v=n-g/2;e.fillStyle=Re(a,!0),e.strokeStyle=Y(a),e.lineWidth=1,et(e,_,v,h,g,ge),e.fill(),e.stroke(),e.textBaseline=`top`,c.forEach((t,n)=>{var r;let i=v+d+n*f;e.textAlign=`left`,e.fillStyle=Y(a),e.globalAlpha=.55,e.fillText(t.label,_+u,i),e.globalAlpha=1,e.textAlign=`right`,e.fillStyle=(r=t.pnlColor)==null?Y(a):r,e.fillText(t.value,_+u+p+8+m,i)}),e.restore()}function Ye(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C=!1,w,T=!1,E,D=null,O=null,k=1,A){var j,M;let{y:N,boxY:P,boxW:F,boxH:I}=n,L=ze(t,i,a),ee=s||c,R=Math.min(Math.max(k,1),3),z=ve*R,B=ye*R,V=xe*R,te=be*R,H=Se*R;if(g===`dot`&&t.type===`position`&&!c){let n=r-6-4;s&&Je(e,t,N,n,6,a,o),e.save(),e.fillStyle=L,e.globalAlpha=s?1:.75,e.beginPath(),e.arc(n,N,6,0,Math.PI*2),e.fill(),e.globalAlpha=1,e.restore(),y.push({label:t.label,boxX:n-6,boxY:N-6,boxW:12,boxH:12,lineX:n-6,lineY:N-6,lineW:12,lineH:12});return}let U=Me(t)?t.pnlText:null,ne=t.type===`position`?t.pnl:void 0,re=t.type===`pending`,ie=re&&t.orderType===`market`&&((j=t.data)==null?void 0:j._isDraft)===!0,ae=Be(t),oe=(ae?Ee+2:0)+F,se=Math.round((r-oe)/2),ce=ae?se:0,le=ae?se+Ee+2:se,W=t;if(ee||ie){let n=`${t.label}:stopLoss`,i=`${t.label}:takeProfit`,s=f===t.label,h=s&&D!==null?D:W.stopLossPrice,g=s&&O!==null?O:W.takeProfitPrice;if(h!==void 0){var ue;Ze(e,W,`stopLoss`,h,l,u,d,(ue=m.get(n))==null?r*je:ue,r,a,o,f,p,_,b,C,W._slOrderLabel,w==null?void 0:w.sl,k,A==null?void 0:A.get(n))}else f===n&&p!==null&&Ze(e,W,`stopLoss`,p,l,u,d,r*je,r,a,o,f,p,_,b,C,void 0,w==null?void 0:w.sl,k);if(g!==void 0){var me;Ze(e,W,`takeProfit`,g,l,u,d,(me=m.get(i))==null?r*je:me,r,a,o,f,p,_,b,C,W._tpOrderLabel,w==null?void 0:w.tp,k,A==null?void 0:A.get(i))}else f===i&&p!==null&&Ze(e,W,`takeProfit`,p,l,u,d,r*je,r,a,o,f,p,_,b,C,void 0,w==null?void 0:w.tp,k);if(c&&W.side!==void 0){let t=r*je;W.stopLossPrice===void 0&&f!==n&&Xe(e,W,`stopLoss`,N,t,r,d,a,S),W.takeProfitPrice===void 0&&f!==i&&Xe(e,W,`takeProfit`,N,t,r,d,a,S)}}if(ie)return;let he=t.type===`position`&&t.entryPriceEditable===!0;e.save(),e.strokeStyle=L,e.lineWidth=_e,e.globalAlpha=ee?1:.85,(re||he)&&e.setLineDash([5,4]),e.beginPath(),e.moveTo(0,N),e.lineTo(r,N),e.stroke(),e.setLineDash([]),e.globalAlpha=1,e.restore();let G=P+I/2;e.save(),e.fillStyle=Re(a,ee),e.strokeStyle=L,e.lineWidth=1,et(e,le,P,F,I,ge),e.fill(),e.stroke();let De=le+de,K=((M=t.data)==null?void 0:M._isDraft)===!0,Oe=t.type===`pending`||he,ke=t.lots;if(T&&(K||c||h)&&Oe&&ke!==void 0){let n=String(ke);e.font=we;let r=fe+e.measureText(n).width+fe,i=De;e.save(),e.strokeStyle=Y(a),e.globalAlpha=.35,e.lineWidth=1,e.beginPath(),e.moveTo(i+r,P+3),e.lineTo(i+r,P+I-3),e.stroke(),e.restore(),e.fillStyle=Y(a),e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(n,i+fe,G),E==null||E.push({label:t.label,pillX:i,pillY:P,pillW:r,pillH:I}),De+=r+pe}if(U){let t=ne===void 0?Y(a):ne>=0?a.candle.up:a.candle.down;e.font=Te,e.fillStyle=t,e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(U,De,G),De+=e.measureText(U).width+Ce}let Ae=Fe(t,n.price,o);e.font=we,e.fillStyle=Y(a),e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(Ae,De,G);let q=G,J=3.5;if(!C&&h){let n=le+F-de/2-V,r=n-V-H-V;e.fillStyle=a.candle.up,e.beginPath(),e.arc(r,q,V,0,Math.PI*2),e.fill(),e.strokeStyle=a.background,e.lineWidth=1.5,e.lineCap=`round`,e.lineJoin=`round`;let i=3.1;e.beginPath(),e.moveTo(r-i,q),e.lineTo(r-i*.2,q+i*.8),e.lineTo(r+i,q-i*.7),e.stroke(),e.fillStyle=a.candle.down,e.beginPath(),e.arc(n,q,V,0,Math.PI*2),e.fill(),e.strokeStyle=a.background,e.lineWidth=1.5,e.lineCap=`round`,e.beginPath(),e.moveTo(n-J,q-J),e.lineTo(n+J,q+J),e.moveTo(n+J,q-J),e.lineTo(n-J,q+J),e.stroke(),x.push({label:t.label,type:t.type,data:t.data,action:`confirm`,x:r-V,y:q-V,w:V*2,h:V*2}),x.push({label:t.label,type:t.type,data:t.data,action:`cancel`,x:n-V,y:q-V,w:V*2,h:V*2})}else if(!C){let n=le+F-de/2-z,r=n-z-te-B;e.fillStyle=Y(a),e.beginPath(),e.arc(r,q,B,0,Math.PI*2),e.fill();let i=B*.48;e.save(),e.strokeStyle=a.background,e.lineWidth=1.5,e.lineCap=`round`,e.lineJoin=`round`,e.translate(r,q),e.rotate(Math.PI/4),e.beginPath(),e.moveTo(-i*.35,-i),e.lineTo(-i*.35,i*.5),e.lineTo(i*.35,i*.5),e.lineTo(i*.35,-i),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(-i*.35,i*.5),e.lineTo(0,i+i*.45),e.lineTo(i*.35,i*.5),e.stroke(),e.restore(),e.fillStyle=Y(a),e.beginPath(),e.arc(n,q,z,0,Math.PI*2),e.fill(),e.strokeStyle=a.background,e.lineWidth=1.5,e.lineCap=`round`,e.beginPath(),e.moveTo(n-J,q-J),e.lineTo(n+J,q+J),e.moveTo(n+J,q-J),e.lineTo(n-J,q+J),e.stroke(),v.push({label:t.label,type:t.type,data:t.data,x:r-B,y:q-B,w:B*2,h:B*2}),_.push({label:t.label,type:t.type,data:t.data,x:n-z,y:q-z,w:z*2,h:z*2})}if(e.restore(),ae){$e(e,ce,P,I,i,s);let n=C?0:B*2+te+z*2+de/2;b.push({label:t.label,type:t.type,data:t.data,price:t.price,x:ce,y:P,w:Ee+2+F-n,h:I,isBracket:!1,isBox:!0}),b.push({label:t.label,type:t.type,data:t.data,price:t.price,x:0,y:N-4,w:r,h:8,isBracket:!1})}else C&&F>0&&b.push({label:t.label,type:t.type,data:t.data,price:t.price,x:le,y:P,w:F,h:I,isBracket:!1,isBox:!0});y.push({label:t.label,boxX:le,boxY:P,boxW:F,boxH:I,lineX:0,lineY:N-4,lineW:r,lineH:8})}function Xe(e,t,n,r,i,a,o,s,c){let l=r+(t.side===`buy`&&n===`stopLoss`||t.side===`sell`&&n===`takeProfit`?J:-J);if(l<0||l>o)return;e.save(),e.strokeStyle=Y(s),e.lineWidth=.8,e.globalAlpha=.3,e.setLineDash([4,4]),e.beginPath(),e.moveTo(i,l),e.lineTo(a,l),e.stroke(),e.setLineDash([]),e.globalAlpha=1,e.restore();let u=n===`stopLoss`?`+SL`:`+TP`;e.font=Ae;let d=K+e.measureText(u).width+K,f=ke,p=i-d-2,m=l-f/2;e.save(),e.globalAlpha=.75,e.fillStyle=Re(s,!1),e.strokeStyle=Y(s),e.lineWidth=.8,et(e,p,m,d,f,ge),e.fill(),e.stroke(),e.globalAlpha=1,e.fillStyle=Y(s),e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(u,p+K,l),e.restore(),c.push({label:t.label,type:t.type,data:t.data,bracketType:n,x:p,y:m,w:d,h:f})}function Ze(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v=1,y){var b,x;let S=ve*Math.min(Math.max(v,1),3),C=d===`${t.label}:${n}`&&f!==null?f:r,w=i.yToPixel(C,a,o);if(w<-20||w>o+20)return;e.save(),e.strokeStyle=Y(l),e.lineWidth=De,e.globalAlpha=.8,e.beginPath(),e.moveTo(s,w),e.lineTo(c,w),e.stroke(),e.globalAlpha=1;let T=`${n===`stopLoss`?`SL`:`TP`} ${C.toFixed(u)}`;e.font=Ae;let E=e.measureText(T).width,D=_?e.measureText(_).width+K:0,O=h?0:S*2+K/2,k=K+E+D+K+O,A=h?ke:Math.max(ke,S*2+Oe*2),j=s-k-2,M=w-A/2,N=y==null?M:y,P=N+A/2;if(Math.abs(N-M)>=2&&Qe(e,j+k/2,P,w,l),e.fillStyle=Re(l,!1),e.strokeStyle=Y(l),e.lineWidth=.8,et(e,j,N,k,A,ge),e.fill(),e.stroke(),e.fillStyle=Y(l),e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(T,j+K,P),_&&(e.fillStyle=_.trim().startsWith(`-`)?l.candle.down:l.candle.up,e.fillText(_,j+K+E+K,P)),!h){let r=j+k-K/2-S,i=P;e.fillStyle=Y(l),e.beginPath(),e.arc(r,i,S,0,Math.PI*2),e.fill(),e.strokeStyle=l.background,e.lineWidth=1.5,e.lineCap=`round`;let a=3.5;e.beginPath(),e.moveTo(r-a,i-a),e.lineTo(r+a,i+a),e.moveTo(r+a,i-a),e.lineTo(r-a,i+a),e.stroke(),p.push({label:t.label,type:t.type,data:t.data,bracketType:n,bracketOrderLabel:g,x:r-S,y:i-S,w:S*2,h:S*2})}e.restore(),m.push({label:t.label,data:t.data,bracketType:n,price:C,parentPrice:t.price,parentSide:(b=t.side)==null?`buy`:b,bracketOrderLabel:g,x:s,y:w-5,w:c-s,h:10,isBracket:!0});let F=S*2+K/2;m.push({label:t.label,data:t.data,bracketType:n,price:C,parentPrice:t.price,parentSide:(x=t.side)==null?`buy`:x,bracketOrderLabel:g,x:j,y:N,w:k-F,h:A,isBracket:!0})}function Qe(e,t,n,r,i){Math.abs(n-r)<2||(e.save(),e.strokeStyle=Y(i),e.globalAlpha=.35,e.lineWidth=1,e.setLineDash([2,3]),e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.stroke(),e.restore())}function $e(e,t,n,r,i,a){let o=a?i.dragHandleHover:i.dragHandle,s=G*2*2+3,c=G*2*3+6,l=t+(Ee-s)/2+G,u=n+(r-c)/2+G;e.save(),e.fillStyle=o;for(let t=0;t<3;t++)for(let n=0;n<2;n++){let r=l+n*(G*2+3),i=u+t*(G*2+3);e.beginPath(),e.arc(r,i,G,0,Math.PI*2),e.fill()}e.restore()}function et(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.lineTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.closePath()}function tt(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function nt(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function rt(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function it(e,t,n){var r;return(r=n.find(n=>e>=n.boxX&&e<=n.boxX+n.boxW&&t>=n.boxY&&t<=n.boxY+n.boxH||e>=n.lineX&&e<=n.lineX+n.lineW&&t>=n.lineY&&t<=n.lineY+n.lineH))==null?null:r}function at(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function ot(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function st(e,t,n,r,i,a,o,s){let c=[];for(let e of t){if(e.type!==`position`)continue;let t=e;if(t.entryPriceEditable)continue;let a=n.yToPixel(t.price,r,o);a<-16||a>o+16||c.push({y:a,label:t.price.toFixed(s),color:ze(e,i.tradeLevels,i)})}if(c.length===0)return;c.sort((e,t)=>e.y-t.y);let l=-1/0;for(let e of c)e.y-16/2<l&&(e.y=l+16/2),l=e.y+16/2+1;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.textAlign=`left`,e.textBaseline=`middle`;for(let t of c){let n=e.measureText(t.label).width;e.fillStyle=t.color,e.fillRect(a,t.y-16/2,n+12,16),e.fillStyle=`#ffffff`,e.fillText(t.label,a+4,t.y)}e.restore()}function ct(e,t,n){let r=[],i=[],{min:a,max:o}=t;for(let t of e){var s;if(t.label===n||t.type===`pending`&&t.orderType===`market`&&((s=t.data)==null?void 0:s._isDraft)===!0)continue;isFinite(t.price)&&(t.price>o?r.push({price:t.price,label:t.label,kind:`entry`}):t.price<a&&i.push({price:t.price,label:t.label,kind:`entry`}));let e=t.stopLossPrice,c=t.takeProfitPrice;e!==void 0&&isFinite(e)&&(e>o?r.push({price:e,label:t.label,kind:`sl`}):e<a&&i.push({price:e,label:t.label,kind:`sl`})),c!==void 0&&isFinite(c)&&(c>o?r.push({price:c,label:t.label,kind:`tp`}):c<a&&i.push({price:c,label:t.label,kind:`tp`}))}return{above:r,below:i}}function lt(e){let t=0;for(let n of e)n.kind===`entry`&&t++;return t}function ut(e,t){let n=e[0],r=Math.abs(n.price-t);for(let i=1;i<e.length;i++){let a=Math.abs(e[i].price-t);a<r&&(n=e[i],r=a)}return n}var dt=`11px 'Inter', system-ui, sans-serif`,ft=8,pt=8,mt=10,ht=20,gt=10,_t=`▲`,vt=`▼`;function yt(e,t,n,r,i,a,o,s=null){let c=[],l=a-40,u=n.max-n.min,d=l>0?u/l*20:0,{above:f,below:p}=ct(t,{min:n.min-d,max:n.max+d},o);if(f.length===0&&p.length===0)return{hitAreas:c};e.save(),e.font=dt,e.textBaseline=`middle`,e.textAlign=`center`;let m=(t,n,a,o)=>{let s=e.measureText(n).width,l=Math.ceil(s)+ft*2,u=i-pt-l;return e.fillStyle=r.tooltip.background,e.strokeStyle=r.tooltip.border,e.lineWidth=1,St(e,u,a,l,ht,gt),e.fill(),e.stroke(),e.fillStyle=r.tooltip.text,e.fillText(n,u+l/2,a+ht/2+.5),c.push({direction:t,x:u,y:a,w:l,h:ht,targetPrice:o.price,targetLabel:o.label,targetKind:o.kind}),l},h=(e,t,r)=>{if(t.length===0)return;let i=e===`up`?_t:vt,a=e===`up`?n.max:n.min,o=e===`up`?1:-1,c=r,l=lt(t);if(l>0){let n=ut(t.filter(e=>e.kind===`entry`),a);m(e,`${i} ${l}`,c,n),c+=o*(ht+4)}if(s!==null){let n=t.filter(e=>e.kind!==`entry`&&e.label===s);for(let t of n)m(e,`${i} ${t.kind.toUpperCase()}`,c,t),c+=o*(ht+4)}};return h(`up`,f,mt),h(`down`,p,a-mt-ht),e.restore(),{hitAreas:c}}function bt(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function xt(e,t,n){let r=e-t,i=e+t;return n.some(e=>r<e.y+e.h&&i>e.y)}function St(e,t,n,r,i,a){let o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}var Ct=18,wt=6,Tt=3,Et=[`1m`,`5m`,`15m`,`30m`,`1h`,`4h`];function Dt(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:e<604800?`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`:`${Math.floor(e/604800)}w ${Math.floor(e%604800/86400)}d`}function Ot(e,t,n,r,i=`UTC`){let a=new Date(e);if(n&&Et.includes(n)){let e=a.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1,timeZone:i});return r?a.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,timeZone:i})+` `+e:e}return n===`1Y`?a.toLocaleDateString(`en-US`,{year:`numeric`,timeZone:i}):n===`1M`?a.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`,timeZone:i}):t<=365?a.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,timeZone:i}):a.toLocaleDateString(`en-US`,{month:`short`,year:`2-digit`,timeZone:i})}function kt(e,t,n,r,i,a,o,s=8,c=_,l,u,d=`UTC`){var f,p;let m=n.endIndex-n.startIndex,h=t[0],g=t[t.length-1],v=!!h&&!!g&&new Date(h.time).toLocaleDateString(`en-US`,{timeZone:d})!==new Date(g.time).toLocaleDateString(`en-US`,{timeZone:d});e.fillStyle=i.axisText,e.font=`${c.fontSize} ${c.fontFamily}`,e.textAlign=`center`;let y=Ot((f=(p=t[Math.floor(t.length/2)])==null?void 0:p.time)==null?t[0].time:f,m,l,v,d),b=e.measureText(y).width,x=Math.max(1,Math.floor(t.length/s));if(t.length>1){let e=a/Math.max(1,t.length),n=b+24;e*x<n&&(x=Math.ceil(n/e))}for(let i=0;i<t.length;i+=x){let s=n.startIndex+i;if(u!==void 0&&s===u)continue;let c=r.xToPixel(s,n,a),f=Ot(t[i].time,m,l,v,d),p=e.measureText(f).width/2,h=Math.max(p,Math.min(a-p,c));e.fillText(f,h,o+14)}}function At(e,t,n,r,i,a,o,s,c,l=_){let u=Math.max(0,t+n-Date.now()),d=Dt(Math.ceil(u/1e3));e.font=`${l.fontSize} ${l.fontFamily}`;let f=e.measureText(d).width+wt*2,p=Ct,m=a.xToPixel(r,i,s),h=Math.max(f/2,m),g=h-f/2,v=c+1;e.save(),e.beginPath(),e.rect(0,c,s,Ct+4),e.clip(),e.fillStyle=o.axisText,e.beginPath(),e.roundRect(g,v,f,p,Tt),e.fill(),e.fillStyle=o.background,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(d,h,v+p/2),e.textBaseline=`alphabetic`,e.restore()}function jt(e,t,n,r,i,s,c,l,u=2,d=g){if(e.fillStyle=r.axisText,e.font=`${d.fontSize} ${d.fontFamily}`,e.textAlign=`left`,l===void 0){let r=a(t,s),c=o(r.length>=2?r[1]-r[0]:t.max-t.min,u);for(let a of r){let r=n.yToPixel(a,t,s);e.fillText(a.toFixed(c),i+4,r+4)}return}let f=(t.max-t.min)/l;for(let r=0;r<=l;r++){let a=t.min+f*r,o=n.yToPixel(a,t,s),c=a.toFixed(u);e.fillText(c,i+4,o+4)}}function X(e,t){return`<svg viewBox="0 0 16 16" width="${t}" height="${t}" fill="none" xmlns="http://www.w3.org/2000/svg">${e}</svg>`}var Mt=`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 1.5h3l.5 1.8a5.1 5.1 0 0 1 1.24.72l1.76-.56 1.5 2.6-1.38 1.18a5.2 5.2 0 0 1 0 1.44l1.38 1.18-1.5 2.6-1.76-.56A5.1 5.1 0 0 1 10 12.7l-.5 1.8h-3l-.5-1.8a5.1 5.1 0 0 1-1.24-.72l-1.76.56-1.5-2.6L2.88 8.76a5.2 5.2 0 0 1 0-1.44L1.5 6.14l1.5-2.6 1.76.56A5.1 5.1 0 0 1 6 3.38Z" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/><circle cx="8" cy="8" r="2.2" stroke="currentColor" stroke-width="1.3"/></svg>`,Nt=Mt,Pt=`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 2.5a1.5 1.5 0 0 1 2.121 2.121l-8.5 8.5L2.5 13.5l.379-2.621 8.621-8.379Z" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>`,Ft=`<svg viewBox="0 0 16 16" width="10" height="10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 3l10 10M13 3L3 13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>`,It=`<svg viewBox="0 0 16 16" width="15" height="15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.5 6.5V1.5h5M6.5 6.5L1.5 1.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.5 9.5v5h-5M9.5 9.5l5 5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>`,Lt=`<svg viewBox="0 0 16 16" width="15" height="15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 1.5H1.5v5M1.5 1.5l5 5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.5 14.5H14.5v-5M14.5 14.5l-5-5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>`,Rt=`<svg viewBox="0 0 16 16" width="15" height="15" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="3.5,5 4.5,13.5 11.5,13.5 12.5,5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><line x1="2" y1="5" x2="14" y2="5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/><path d="M6 5V3.5C6 3 6.5 2.5 7 2.5h2C9.5 2.5 10 3 10 3.5V5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>`,zt={candlestick:`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
34
|
+
<script>(function(){var e=`data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cmask%20id='mask0'%20mask-type='alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='32'%20height='32'%3e%3crect%20width='32'%20height='32'%20fill='%23C4C4C4'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0)'%3e%3crect%20width='82.6667'%20height='32'%20fill='url(%23pattern0)'/%3e%3c/g%3e%3cdefs%3e%3cpattern%20id='pattern0'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0'%20transform='translate(0%20-0.015879)%20scale(0.00304878%200.00787602)'/%3e%3c/pattern%3e%3cimage%20id='image0'%20width='328'%20height='131'%20xlink:href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAACDCAYAAADvTILwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjI2OEU0MzNCQ0VDMjExRTNCMkRFQjIzMENDRTM5QTg4IiB4bXBNTTpEb2N1bWVudElEPSJ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5MFXgjX6xG5Q6ehQZXdDaxW5EgcLY3qa5XfhvhiFjd/sNm9gn9nHqFQ6PFEIlEiNbXYyKZy5wwb5mDqC+TtLSkieyEKWLDzmZmZeWHXrl2P7Nix44uCIDzAgPFnP/tZomwqY6kvX2pwfPbZZ1sIyNawquUXY/81NTXL3tPHHnuspMy/Zel7fz2W+ddnfVh3lVWOxaC4PbDQA1xYSkAkZpglZih2dSF7rAf2q7uR7afPHZ3I9dH18vlhsYnIp4il1NchPTAMx6p2JE9E4d7Yjfk39mLtD/4Sc8/8jMS8u6QboGIqEqFo9kCjnqIW46fP0XvGSLLe89oEhKYCE3rPa8X4rPtT5OJ2nvmnbZP1mEeLJtO1rBrFYrSFlY0Ab3Wevl3h7WB1zNf6YsvFOYreJtYo6KuuM++DY7cWY8ntPlp72RiB14YtDWi4Zit6+5cI6FxYXGR2RAE2ksaxWAY1YTcHu661Nehnwd/ENAf65xGsdSNNTJEBLePmyWQOgaATUxNJNLdVo693DmvXq9+59oaG1Cfv7b6L81xFefsS/OWuZDprjdlt+szKfZ2rc+BC7It5Om9FaXvQ0TKbXLf2W/pgsYKvXaDLx37/7mXsgaNnONfzGb04h/CkC3wcr2H5mMtLck/N/2OvYWawFb5wRY4VgDy7wZwj158GpO5GacjIvgtsR9tSJq1Hl3GanC8wMTAc0I77fGyn7wWAPOM9NRcEXAHHK3es3PuzG6Paw1pbxhr1dfZl5l/IMV0GkM3ab+bOc585zdY5jYsbhP5eu6c5S9lfp5UH5cplkPtWLsPKWBml4/8LMACJdZs7j1kabAAAAABJRU5ErkJggg=='/%3e%3c/defs%3e%3c/svg%3e`,t=class{constructor(){this.bars=[]}set(e){this.bars=[...e].sort((e,t)=>e.time-t.time)}get all(){return this.bars}get length(){return this.bars.length}getVisible(e){let t=Math.max(0,Math.floor(e.startIndex)),n=Math.min(this.bars.length-1,Math.ceil(e.endIndex));return this.bars.slice(t,n+1)}getPriceRange(e,t=.05){let n=this.getVisible(e);if(n.length===0)return{min:0,max:1};let r=1/0,i=-1/0;for(let e of n)e.low<r&&(r=e.low),e.high>i&&(i=e.high);let a=i-r;return{min:r-a*t,max:i+a*t}}getVolumeRange(e){let t=this.getVisible(e);return t.length===0?{min:0,max:1}:{min:0,max:Math.max(...t.map(e=>{var t;return(t=e.volume)==null?0:t}))}}get hasVolumeData(){return this.bars.some(e=>{var t;return`volume`in e&&((t=e.volume)==null?0:t)>0})}getPricePrecision(){let e=2;for(let t of this.bars)for(let n of[t.open,t.high,t.low,t.close]){let t=n.toString(),r=t.indexOf(`.`);if(r!==-1){let n=t.length-r-1;n>e&&(e=n)}}return Math.min(e,8)}prepend(e){var t,n;let r=(t=(n=this.bars[0])==null?void 0:n.time)==null?1/0:t,i=e.filter(e=>e.time<r).sort((e,t)=>e.time-t.time);return i.length===0?0:(this.bars=[...i,...this.bars],i.length)}},n,r=class e{xToPixel(e,t,n){let r=n/Math.max(1,t.endIndex-t.startIndex);return(e-t.startIndex)*r+r/2}pixelToBarIndex(e,t,n){let r=n/Math.max(1,t.endIndex-t.startIndex);return t.startIndex+e/r-.5}candleBodyWidth(e,t){let n=t/Math.max(1,e.endIndex-e.startIndex)*.7;return Math.max(1,Math.min(n,40))}yToPixel(t,n,r){let{min:i,max:a}=n,o=e.VERTICAL_PADDING_PX,s=r-2*o;return o+s-(t-i)/(a-i)*s}pixelToPrice(t,n,r){let{min:i,max:a}=n,o=e.VERTICAL_PADDING_PX,s=r-2*o;return a-(t-o)/s*(a-i)}volumeToPixel(e,t,n){return n-e/t*n*.9}};n=r,n.VERTICAL_PADDING_PX=20;function i(e){if(!isFinite(e)||e<=0)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<1.5?1:n<3.5?2:n<7.5?5:10)*t}function a(e,t,n=48){let{min:r,max:a}=e;if(!isFinite(r)||!isFinite(a)||a<=r)return[r];let o=Math.max(2,Math.floor(t/n)),s=i((a-r)/o),c=Math.ceil(r/s)*s,l=[],u=s*1e-6;for(let e=c;e<=a+u;e+=s)l.push(e);return l}function o(e,t=0){return!isFinite(e)||e<=0?t:Math.max(t,-Math.floor(Math.log10(e)))}var s=class{constructor(){this.listeners=new Map}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}off(e,t){var n;(n=this.listeners.get(e))==null||n.delete(t)}emit(e,t){var n;(n=this.listeners.get(e))==null||n.forEach(e=>e(t))}};function c(e,t){var n,r,i,a,o,s;return t?{background:(n=t.background)==null?e.background:n,grid:(r=t.grid)==null?e.grid:r,axisText:(i=t.axisText)==null?e.axisText:i,axisBorder:(a=t.axisBorder)==null?e.axisBorder:a,crosshair:(o=t.crosshair)==null?e.crosshair:o,tooltip:{...e.tooltip,...t.tooltip},candle:{...e.candle,...t.candle},volume:{...e.volume,...t.volume},ui:{...e.ui,...t.ui,stream:{...e.ui.stream,...(s=t.ui)==null?void 0:s.stream}},drawingToolbar:{...e.drawingToolbar,...t.drawingToolbar},topBar:{...e.topBar,...t.topBar},bottomBar:{...e.bottomBar,...t.bottomBar},indicatorOverlay:{...e.indicatorOverlay,...t.indicatorOverlay},tradeLevels:{...e.tradeLevels,...t.tradeLevels},tradePanel:{...e.tradePanel,...t.tradePanel}}:e}function l(e,t){let n=document.createElement(`div`);n.style.display=`none`,t.appendChild(n);let r=e=>e.includes(`var(`)?(e=e.replace(/rgba\(\s*(var\([^)]+\))\s*,\s*([0-9.]+)\s*\)/g,`rgb($1 / $2)`),n.style.color=``,n.style.color=e,getComputedStyle(n).color||e):e,i={background:r(e.background),grid:r(e.grid),axisText:r(e.axisText),axisBorder:r(e.axisBorder),crosshair:r(e.crosshair),tooltip:{background:r(e.tooltip.background),text:r(e.tooltip.text),border:r(e.tooltip.border)},candle:{up:r(e.candle.up),down:r(e.candle.down),wickUp:r(e.candle.wickUp),wickDown:r(e.candle.wickDown),...e.candle.borderUp!==void 0&&{borderUp:r(e.candle.borderUp)},...e.candle.borderDown!==void 0&&{borderDown:r(e.candle.borderDown)}},volume:{up:r(e.volume.up),down:r(e.volume.down)},ui:{accent:r(e.ui.accent),accentText:r(e.ui.accentText),accentBg:r(e.ui.accentBg),accentBgStrong:r(e.ui.accentBgStrong),disabledText:r(e.ui.disabledText),soonBadgeText:r(e.ui.soonBadgeText),stream:{connected:r(e.ui.stream.connected),reconnecting:r(e.ui.stream.reconnecting),disconnected:r(e.ui.stream.disconnected)}},drawingToolbar:{iconColor:r(e.drawingToolbar.iconColor),activeIconColor:r(e.drawingToolbar.activeIconColor),flyoutLabelColor:r(e.drawingToolbar.flyoutLabelColor),flyoutHeadingColor:r(e.drawingToolbar.flyoutHeadingColor)},topBar:{btnColor:r(e.topBar.btnColor),activeBtnColor:r(e.topBar.activeBtnColor),flyoutRowColor:r(e.topBar.flyoutRowColor),flyoutCategoryColor:r(e.topBar.flyoutCategoryColor)},bottomBar:{btnColor:r(e.bottomBar.btnColor),activeBtnBg:r(e.bottomBar.activeBtnBg),activeBtnText:r(e.bottomBar.activeBtnText),activeBtnBorder:r(e.bottomBar.activeBtnBorder)},indicatorOverlay:{pillBg:r(e.indicatorOverlay.pillBg),iconColor:r(e.indicatorOverlay.iconColor),dropdownHoverBg:r(e.indicatorOverlay.dropdownHoverBg)},tradeLevels:{buySide:r(e.tradeLevels.buySide),sellSide:r(e.tradeLevels.sellSide),tradeLine:r(e.tradeLevels.tradeLine),positionLine:r(e.tradeLevels.positionLine),pendingBuyLine:r(e.tradeLevels.pendingBuyLine),pendingSellLine:r(e.tradeLevels.pendingSellLine),labelText:r(e.tradeLevels.labelText),closeBtn:r(e.tradeLevels.closeBtn),closeBtnText:r(e.tradeLevels.closeBtnText),boxBg:r(e.tradeLevels.boxBg),boxBgHover:r(e.tradeLevels.boxBgHover),dragHandle:r(e.tradeLevels.dragHandle),dragHandleHover:r(e.tradeLevels.dragHandleHover)},tradePanel:{background:r(e.tradePanel.background),border:r(e.tradePanel.border),headerBg:r(e.tradePanel.headerBg),tabActive:r(e.tradePanel.tabActive),tabInactive:r(e.tradePanel.tabInactive),rowHoverBg:r(e.tradePanel.rowHoverBg),rowText:r(e.tradePanel.rowText),rowSubText:r(e.tradePanel.rowSubText)}};return t.removeChild(n),i}var u={background:`#141d22`,grid:`#243344`,axisText:`#a8bac8`,axisBorder:`#1c2a35`,crosshair:`rgba(255,255,255,0.4)`,tooltip:{background:`#1c2a35`,text:`#e8eef2`,border:`#1c2a35`},candle:{up:`#5caf79`,down:`#DF6868`,wickUp:`#5caf79`,wickDown:`#DF6868`},volume:{up:`rgba(92,175,121,0.4)`,down:`rgba(223,104,104,0.4)`},ui:{accent:`#398dff`,accentText:`#93bcff`,accentBg:`rgba(57,141,255,0.15)`,accentBgStrong:`rgba(57,141,255,0.22)`,disabledText:`#484f58`,soonBadgeText:`#30363d`,stream:{connected:`#5caf79`,reconnecting:`#e8b84b`,disconnected:`#555555`}},drawingToolbar:{iconColor:`#e8eef2`,activeIconColor:`#93bcff`,flyoutLabelColor:`#a8bac8`,flyoutHeadingColor:`#a8bac8`},topBar:{btnColor:`#a8bac8`,activeBtnColor:`#93bcff`,flyoutRowColor:`#a8bac8`,flyoutCategoryColor:`#a8bac8`},bottomBar:{btnColor:`#a8bac8`,activeBtnBg:`#5caf79`,activeBtnText:`#ffffff`,activeBtnBorder:`#5caf79`},indicatorOverlay:{pillBg:`rgba(28,42,53,0.73)`,iconColor:`#a8bac8`,dropdownHoverBg:`#1c2a35`},tradeLevels:{buySide:`#26a69a`,sellSide:`#ef5350`,tradeLine:`#5caf79`,positionLine:`#7b61ff`,pendingBuyLine:`rgba(92,175,121,0.75)`,pendingSellLine:`rgba(223,104,104,0.75)`,labelText:`#ffffff`,closeBtn:`rgba(255,255,255,0.18)`,closeBtnText:`#ffffff`,boxBg:`rgba(20, 24, 36, 0.92)`,boxBgHover:`rgba(35, 40, 58, 0.97)`,dragHandle:`rgba(255,255,255,0.3)`,dragHandleHover:`#9ca3af`},tradePanel:{background:`#1c2a35`,border:`#243344`,headerBg:`#151f28`,tabActive:`#93bcff`,tabInactive:`#a8bac8`,rowHoverBg:`rgba(255,255,255,0.04)`,rowText:`#e8eef2`,rowSubText:`#9ca3af`}},d={background:`#ffffff`,grid:`#efefef`,axisText:`#666666`,axisBorder:`#cccccc`,crosshair:`#999999`,tooltip:{background:`#f8f8f8`,text:`#333333`,border:`#cccccc`},candle:{up:`#5caf79`,down:`#DF6868`,wickUp:`#5caf79`,wickDown:`#DF6868`},volume:{up:`rgba(92,175,121,0.6)`,down:`rgba(223,104,104,0.6)`},ui:{accent:`#398dff`,accentText:`#2a7aff`,accentBg:`rgba(57,141,255,0.10)`,accentBgStrong:`rgba(57,141,255,0.18)`,disabledText:`#94a3b8`,soonBadgeText:`#cbd5e1`,stream:{connected:`#5caf79`,reconnecting:`#d97706`,disconnected:`#94a3b8`}},drawingToolbar:{iconColor:`#333333`,activeIconColor:`#398dff`,flyoutLabelColor:`#666666`,flyoutHeadingColor:`#666666`},topBar:{btnColor:`#666666`,activeBtnColor:`#398dff`,flyoutRowColor:`#666666`,flyoutCategoryColor:`#666666`},bottomBar:{btnColor:`#666666`,activeBtnBg:`#5caf79`,activeBtnText:`#ffffff`,activeBtnBorder:`#5caf79`},indicatorOverlay:{pillBg:`rgba(248,248,248,0.85)`,iconColor:`#666666`,dropdownHoverBg:`#f0f0f0`},tradeLevels:{buySide:`#26a69a`,sellSide:`#ef5350`,tradeLine:`#5caf79`,positionLine:`#6d28d9`,pendingBuyLine:`rgba(92,175,121,0.75)`,pendingSellLine:`rgba(223,104,104,0.75)`,labelText:`#ffffff`,closeBtn:`rgba(0,0,0,0.15)`,closeBtnText:`#ffffff`,boxBg:`rgba(240, 244, 252, 0.95)`,boxBgHover:`rgba(255, 255, 255, 0.99)`,dragHandle:`#94a3b8`,dragHandleHover:`#475569`},tradePanel:{background:`#f8f8f8`,border:`#cccccc`,headerBg:`#f0f0f0`,tabActive:`#398dff`,tabInactive:`#666666`,rowHoverBg:`rgba(0,0,0,0.03)`,rowText:`#333333`,rowSubText:`#666666`}},f=`'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif`,p={iconBtnSize:40,iconFontSize:`20px`,iconFontFamily:f,flyoutLabelFontSize:`12px`,flyoutLabelFontFamily:f,shortcutFontSize:`9px`,soonBadgeFontSize:`9px`,flyoutHeadingFontSize:`10px`,flyoutHeadingLetterSpacing:`0.08em`,scrollBtnHeight:20,scrollBtnFontSize:`9px`,barPadding:7,btnGap:4,mobileBreakpoint:480},m={height:`36px`,dropBtnFontSize:`11px`,dropBtnFontFamily:f,drawBtnSize:`26px`,drawBtnIconFontSize:`14px`,iconBtnSize:`26px`,mobileIconBtnSize:`28px`,mobileDrawBtnIconSize:`16px`,flyoutRowFontSize:`12px`,flyoutRowFontFamily:f,flyoutCategoryFontSize:`10px`,flyoutCategoryLetterSpacing:`0.08em`,flyoutCheckFontSize:`11px`,streamDotSize:`7px`},h={height:`32px`,btnFontSize:`11px`,btnFontFamily:f},g={fontSize:`11px`,fontFamily:f},_={fontSize:`11px`,fontFamily:f},v={labelHeight:18,labelPaddingX:4,fontSize:`11px`,fontFamily:f},y={pillFontSize:`13px`,pillFontFamily:f,dotFontSize:`8px`,pillIconFontSize:`12px`,collapseBtnFontSize:`13px`,collapseBtnFontFamily:f,dropdownRowFontSize:`11px`,dropdownRowFontFamily:f,dropdownIconFontSize:`10px`},b={size:22,mobileSize:24,iconSize:14,mobileIconSize:16},x={drawingToolbar:p,topBar:m,bottomBar:h,priceAxis:g,timeAxis:_,crosshair:v,indicatorOverlay:y,tradeButton:b};function S(e){return e?{drawingToolbar:{...p,...e.drawingToolbar},topBar:{...m,...e.topBar},bottomBar:{...h,...e.bottomBar},priceAxis:{...g,...e.priceAxis},timeAxis:{..._,...e.timeAxis},crosshair:{...v,...e.crosshair},indicatorOverlay:{...y,...e.indicatorOverlay},tradeButton:{...b,...e.tradeButton}}:x}var C={topBar:{series:{candlestick:`Candles`,hollow:`Hollow`,ohlc:`OHLC`,line:`Line`,area:`Area`,heikinashi:`Heikin Ashi`,volumecandles:`Volume Candles`,linemarkers:`Line with Markers`,step:`Step Line`,hlcarea:`HLC Area`,baseline:`Baseline`,columns:`Columns`,highlow:`High-low`},timeframes:{"1m":`1m`,"5m":`5m`,"15m":`15m`,"30m":`30m`,"1h":`1h`,"2h":`2h`,"4h":`4h`,"8h":`8h`,"1D":`1D`,"1W":`1W`,"1M":`1M`},indicatorsBtn:`Indicators`,indicatorsBtnActive:`Indicators ({count})`,toggleDrawingTitle:`Toggle Drawing Tools`,toggleFullscreenTitle:`Toggle Fullscreen`,exitFullscreenTitle:`Exit Fullscreen`,settingsTitle:`Settings`,tfcToggleTitle:`Trade from Charts`},bottomBar:{durations:{"1D":`1D`,"5D":`5D`,"1M":`1M`,"3M":`3M`,"6M":`6M`,"1Y":`1Y`,"5Y":`5Y`,All:`All`}},drawingToolbar:{categories:{trendLines:`Trend Lines & Channels`,fibonacci:`Fibonacci & Gann Tools`,shapes:`Geometric Shapes`,measurements:`Measurement Tools`,pitchforks:`Pitchfork Tools`,volume:`Volume & Statistical Tools`,annotations:`Annotation Tools`,patterns:`Pattern Recognition`,elliott:`Elliott Wave Tools`,brushes:`Brush & Highlighter`,advanced:`Advanced Tools`,priceProjection:`Price Projection Tools`},tools:{horizontalLine:`Horizontal Line`,verticalLine:`Vertical Line`,trendLine:`Trend Line`,trendAngle:`Trend Angle`,crossLine:`Cross Line`,parallelChannel:`Parallel Channel`,flatChannel:`Flat Top/Bottom Channel`,disjointChannel:`Disjoint Channel`,fibRetracement:`Fibonacci Retracement`,fibExtension:`Fibonacci Extension`,fibChannel:`Fibonacci Channel`,fibTimezone:`Fibonacci Timezone`,fibCircles:`Fibonacci Circles`,fibSpiral:`Fibonacci Spiral`,fibFan:`Fibonacci Speed Resistance Fan`,fibProjection:`Fibonacci Projection`,gannFan:`Gann Fan`,gannSquare:`Gann Square`,gannBox:`Gann Box`,rectangle:`Rectangle`,rotatedRectangle:`Rotated Rectangle`,ellipse:`Ellipse`,triangle:`Triangle`,circle:`Circle`,arc:`Arc`,polyline:`Polyline`,path:`Path`,priceRange:`Price Range`,dateRange:`Date Range`,datePriceRange:`Date & Price Range`,ruler:`Ruler`,pitchfork:`Pitchfork`,schiffPitchfork:`Schiff Pitchfork`,modifiedSchiff:`Modified Schiff Pitchfork`,insidePitchfork:`Inside Pitchfork`,fixedRangeVP:`Fixed Range Volume Profile`,anchoredVP:`Anchored Volume Profile`,volumeProfile:`Volume Profile`,regressionTrend:`Regression Trend`,text:`Text`,callout:`Callout`,priceLabel:`Price Label`,arrowMarker:`Arrow Marker`,flag:`Flag`,priceNote:`Price Note`,anchoredNote:`Anchored Note`,arrowUp:`Arrow Up`,arrowDown:`Arrow Down`,headShoulders:`Head & Shoulders`,trianglePattern:`Triangle Pattern`,threeDrives:`3 Drives Pattern`,abcdPattern:`ABCD Pattern`,cypherPattern:`Cypher Pattern`,butterflyPattern:`Butterfly Pattern`,batPattern:`Bat Pattern`,gartleyPattern:`Gartley Pattern`,crabPattern:`Crab Pattern`,sharkPattern:`Shark Pattern`,elliottImpulse:`Elliott Impulse (12345)`,elliottCorrective:`Elliott Corrective (ABC)`,elliottTriangle:`Elliott Wave Triangle`,elliottCombination:`Elliott Wave Combination`,elliottWxy:`Elliott Double Three (WXY)`,brush:`Brush`,highlighter:`Highlighter`,ghostFeed:`Ghost Feed`,projection:`Projection`,sineLine:`Sine Line`,cyclicLines:`Cyclic Lines`,timeCycles:`Time Cycles`,priceProjection:`Price Projection`},actions:{undo:`Undo (Ctrl+Z)`,redo:`Redo (Ctrl+Y)`,deleteSelected:`Delete Selected (Del)`,clearAll:`Clear All`,showAll:`Show All`,hideAll:`Hide All`,lockAll:`Lock All`,unlockAll:`Unlock All`,moreActions:`Actions`},soonBadge:`soon`,scrollUp:`Scroll up`,scrollDown:`Scroll down`},ohlc:{open:`O`,high:`H`,low:`L`,close:`C`,volume:`V`},trade:{buy:`Buy`,sell:`Sell`,limit:`Limit`,stop:`Stop`,market:`Market`,at:`at`,qty:`Qty`,placeOrderTitle:`Place order at this price`},dialogs:{settings:{title:`Chart Settings`,tfcSection:`Trade from Charts`,showLabel:`Show`,positionStyleLabel:`Position Style`,showAll:`All`,showPositions:`Positions Only`,showOrders:`Orders Only`,showNone:`None`,styleLine:`Full Line`,styleDot:`Dot`,resetBtn:`Reset to Defaults`},indicator:{titleSuffix:`Settings`,noParams:`No configurable parameters.`}},chart:{loading:`Loading…`,noData:`No data available`,scrollToLatest:`Scroll to latest`,nIndicators:`{count} indicators`}};function w(e){var t,n,r,i,a,o,s,c;if(!e)return C;let l=C;return{topBar:{...l.topBar,...e.topBar,series:{...l.topBar.series,...(t=e.topBar)==null?void 0:t.series},timeframes:{...l.topBar.timeframes,...(n=e.topBar)==null?void 0:n.timeframes}},bottomBar:{durations:{...l.bottomBar.durations,...(r=e.bottomBar)==null?void 0:r.durations}},drawingToolbar:{...l.drawingToolbar,...e.drawingToolbar,categories:{...l.drawingToolbar.categories,...(i=e.drawingToolbar)==null?void 0:i.categories},tools:{...l.drawingToolbar.tools,...(a=e.drawingToolbar)==null?void 0:a.tools},actions:{...l.drawingToolbar.actions,...(o=e.drawingToolbar)==null?void 0:o.actions}},ohlc:{...l.ohlc,...e.ohlc},trade:{...l.trade,...e.trade},dialogs:{settings:{...l.dialogs.settings,...(s=e.dialogs)==null?void 0:s.settings},indicator:{...l.dialogs.indicator,...(c=e.dialogs)==null?void 0:c.indicator}},chart:{...l.chart,...e.chart}}}var T,E=class e{constructor(t,n,r,i,a,o=()=>!1,s,c,l,u){var d,f,p,m;this.canvas=t,this.getViewport=n,this.setViewport=r,this.totalBars=i,this.onUpdate=a,this.isLocked=o,this.panY=s,this.onDragStart=c,this.onDragEnd=l,this.isDragging=!1,this.isTouchDrag=!1,this.lastX=0,this.lastY=0,this.dragStartX=0,this.dragStartY=0,this.hasPanned=!1,this.dragStartFired=!1,this._velBuffer=[],this._momentumRafId=null,this.onMouseDown=e=>{this._stopMomentum(),!this.isLocked()&&(this.isDragging=!0,this.isTouchDrag=!1,this.lastX=e.clientX,this.lastY=e.clientY,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.hasPanned=!1,this._velBuffer.length=0)},this.onTouchStart=e=>{var t;if(e.touches.length!==1){this._stopMomentum();return}this._stopMomentum(),!this.isLocked()&&(this.isDragging=!0,this.isTouchDrag=!0,this.lastX=e.touches[0].clientX,this.lastY=e.touches[0].clientY,this.dragStartX=e.touches[0].clientX,this.dragStartY=e.touches[0].clientY,this.dragStartFired=!0,this._velBuffer.length=0,(t=this.onDragStart)==null||t.call(this))},this.onMouseMove=t=>{if(!this.isDragging)return;if(this.isLocked()){this.isDragging=!1,this.hasPanned=!1;return}let n=t.clientX-this.lastX,r=t.clientY-this.lastY;this.lastX=t.clientX,this.lastY=t.clientY;let i=Math.abs(t.clientX-this.dragStartX),a=Math.abs(t.clientY-this.dragStartY);if(!this.hasPanned&&(i>e.DRAG_THRESHOLD||a>e.DRAG_THRESHOLD)){var o;this.hasPanned=!0,this.dragStartFired=!0,(o=this.onDragStart)==null||o.call(this),this.canvas.style.cursor=`grabbing`}this.hasPanned&&(this._recordVelocitySample(n,performance.now()),this.pan(n),this.panY&&this.panY(r))},this.onTouchMove=e=>{if(!this.isDragging||e.touches.length!==1)return;if(this.isLocked()){this.isDragging=!1;return}e.preventDefault();let t=e.touches[0].clientX-this.lastX,n=e.touches[0].clientY-this.lastY;this._recordVelocitySample(t,performance.now()),this.pan(t),this.panY&&this.panY(n),this.lastX=e.touches[0].clientX,this.lastY=e.touches[0].clientY},this.onMouseUp=()=>{if(this.hasPanned&&(this.canvas.style.cursor=`crosshair`),this.isDragging=!1,this.hasPanned=!1,this.dragStartFired){var e;this.dragStartFired=!1;let t=this._computeReleaseVelocity();this._velBuffer.length=0,this._startMomentum(t)||(e=this.onDragEnd)==null||e.call(this)}},this._momentumEnabled=(d=u==null?void 0:u.enabled)==null?!0:d,this._momentumDecay=Math.min(.99,Math.max(.8,(f=u==null?void 0:u.decay)==null?.95:f)),this._momentumThreshold=(p=u==null?void 0:u.threshold)==null?.3:p,this._momentumMaxVelocity=(m=u==null?void 0:u.maxVelocity)==null?6:m,this.attach()}attach(){this.canvas.addEventListener(`mousedown`,this.onMouseDown),window.addEventListener(`mousemove`,this.onMouseMove),window.addEventListener(`mouseup`,this.onMouseUp),this.canvas.addEventListener(`touchstart`,this.onTouchStart,{passive:!1}),window.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),window.addEventListener(`touchend`,this.onMouseUp)}cancel(){this._stopMomentum(),this.isDragging=!1,this.hasPanned=!1}destroy(){this._stopMomentum(),this.canvas.removeEventListener(`mousedown`,this.onMouseDown),window.removeEventListener(`mousemove`,this.onMouseMove),window.removeEventListener(`mouseup`,this.onMouseUp),this.canvas.removeEventListener(`touchstart`,this.onTouchStart),window.removeEventListener(`touchmove`,this.onTouchMove),window.removeEventListener(`touchend`,this.onMouseUp)}_recordVelocitySample(t,n){this._velBuffer.push({dx:t,t:n});let r=n-e.VEL_WINDOW_MS,i=0;for(;i<this._velBuffer.length&&this._velBuffer[i].t<r;)i++;i>0&&this._velBuffer.splice(0,i)}_computeReleaseVelocity(){let e=this._velBuffer;if(e.length<2)return 0;let t=e.reduce((e,t)=>e+t.dx,0),n=e[e.length-1].t-e[0].t;if(n<=0)return 0;let r=t/n;return Math.sign(r)*Math.min(Math.abs(r),this._momentumMaxVelocity)}_startMomentum(e){if(!this._momentumEnabled||Math.abs(e)<this._momentumThreshold)return!1;let t=null,n=e,r=this._momentumDecay,i=e=>{if(t===null){t=e,this._momentumRafId=requestAnimationFrame(i);return}let a=e-t;t=e,n*=r**(a/16.67);let o=n*a;if(Math.abs(o)<.5){var s;this._stopMomentum(),(s=this.onDragEnd)==null||s.call(this);return}if(this.isLocked()){var c;this._stopMomentum(),(c=this.onDragEnd)==null||c.call(this);return}let l=this.getViewport().startIndex;if(this.pan(o),this.getViewport().startIndex===l){var u;this._stopMomentum(),(u=this.onDragEnd)==null||u.call(this);return}this._momentumRafId=requestAnimationFrame(i)};return this._momentumRafId=requestAnimationFrame(i),!0}_stopMomentum(){this._momentumRafId!==null&&(cancelAnimationFrame(this._momentumRafId),this._momentumRafId=null)}pan(e){let t=this.getViewport(),n=t.endIndex-t.startIndex,r=n/(this.isTouchDrag?this.canvas.clientWidth||this.canvas.width/(window.devicePixelRatio||1):this.canvas.width),i=-e*r,a=Math.max(0,this.totalBars()-Math.floor(n/2)),o=Math.max(0,Math.min(a,t.startIndex+i));this.setViewport({...t,startIndex:o,endIndex:o+n}),this.onUpdate()}};T=E,T.DRAG_THRESHOLD=4,T.VEL_WINDOW_MS=100;var D=10,O=500,k=class{constructor(e,t,n,r,i,a=()=>e.getBoundingClientRect(),o=()=>e.offsetWidth,s){this.canvas=e,this.getViewport=t,this.setViewport=n,this.totalBars=r,this.onUpdate=i,this.getCanvasRect=a,this.getChartWidth=o,this.panByPixelDelta=s,this._pinchStartDist=0,this._pinchStartRatio=0,this._pinchStartViewport=null,this.onWheel=e=>{e.preventDefault();let t=this.getViewport(),n=t.endIndex-t.startIndex,r;if(e.ctrlKey){let t=Math.max(-50,Math.min(50,e.deltaY));r=Math.exp(t*.01)}else{if(e.deltaX!==0&&Math.abs(e.deltaX)>Math.abs(e.deltaY)*.5){this.panByPixelDelta&&this.panByPixelDelta(e.deltaX),this.onUpdate();return}if(e.deltaY===0)return;r=e.deltaY>0?1.1:.9}let i=Math.round(Math.max(D,Math.min(O,n*r)));if(t.endIndex>=this.totalBars()){let e=Math.min(t.endIndex,this.totalBars()+Math.floor(i/2)),n=Math.max(0,e-i);this.setViewport({...t,startIndex:n,endIndex:n+i})}else{let r=e.offsetX/this.getChartWidth(),a=t.startIndex+n*r,o=Math.max(0,a-i*r);this.setViewport({...t,startIndex:o,endIndex:o+i})}this.onUpdate()},this.onTouchStart=e=>{if(e.touches.length!==2)return;this._pinchStartDist=this.pinchDist(e.touches[0],e.touches[1]),this._pinchStartViewport={...this.getViewport()};let t=this.getCanvasRect(),n=(e.touches[0].clientX+e.touches[1].clientX)/2-t.left;this._pinchStartRatio=Math.max(0,Math.min(1,n/this.getChartWidth()))},this.onTouchMove=e=>{if(e.touches.length!==2)return;e.preventDefault();let t=this.pinchDist(e.touches[0],e.touches[1]);if(this._pinchStartDist===0||!this._pinchStartViewport){this._pinchStartDist=t,this._pinchStartViewport={...this.getViewport()};let n=this.getCanvasRect(),r=(e.touches[0].clientX+e.touches[1].clientX)/2;this._pinchStartRatio=Math.max(0,Math.min(1,(r-n.left)/this.getChartWidth()));return}let n=this._pinchStartDist/t,r=this._pinchStartViewport,i=r.endIndex-r.startIndex,a=Math.round(Math.max(D,Math.min(O,i*n))),o=this._pinchStartRatio,s=r.startIndex+i*o,c=Math.max(0,s-a*o);this.setViewport({...r,startIndex:c,endIndex:c+a}),this.onUpdate()},this.onTouchEnd=()=>{this._pinchStartDist=0,this._pinchStartViewport=null},this.attach()}attach(){this.canvas.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.canvas.addEventListener(`touchstart`,this.onTouchStart,{passive:!1}),this.canvas.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),this.canvas.addEventListener(`touchend`,this.onTouchEnd)}destroy(){this.canvas.removeEventListener(`wheel`,this.onWheel),this.canvas.removeEventListener(`touchstart`,this.onTouchStart),this.canvas.removeEventListener(`touchmove`,this.onTouchMove),this.canvas.removeEventListener(`touchend`,this.onTouchEnd)}pinchDist(e,t){let n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}};function A(e,t,n,r,i,a,o,s){let c=i.candleBodyWidth(n,o),l=t.length,u=new Float32Array(l),d=new Float32Array(l),f=new Float32Array(l),p=new Float32Array(l),m=new Float32Array(l),h=new Uint8Array(l),g=Math.floor(n.startIndex);for(let e=0;e<l;e++){let a=t[e];u[e]=i.xToPixel(g+e,n,o),d[e]=i.yToPixel(a.high,r,s),f[e]=i.yToPixel(a.low,r,s),p[e]=i.yToPixel(a.open,r,s),m[e]=i.yToPixel(a.close,r,s),h[e]=a.close>=a.open?1:0}e.lineWidth=1,e.strokeStyle=a.candle.wickUp,e.beginPath();for(let t=0;t<l;t++)h[t]&&(e.moveTo(u[t],d[t]),e.lineTo(u[t],f[t]));e.stroke(),e.strokeStyle=a.candle.wickDown,e.beginPath();for(let t=0;t<l;t++)h[t]||(e.moveTo(u[t],d[t]),e.lineTo(u[t],f[t]));e.stroke();for(let t=0;t<l;t++){var _,v;let n=Math.min(p[t],m[t]),r=Math.max(Math.abs(m[t]-p[t]),1),i=h[t]===1,o=i?a.candle.up:a.candle.down,s=i?(_=a.candle.borderUp)==null?a.candle.up:_:(v=a.candle.borderDown)==null?a.candle.down:v;e.fillStyle=o,e.fillRect(u[t]-c/2,n,c,r),s!==o&&(e.strokeStyle=s,e.lineWidth=1,e.strokeRect(u[t]-c/2,n,c,r))}}function j(e,t,n,r,i,a,o,s){let c=i.candleBodyWidth(n,o),l=Math.floor(n.startIndex);for(let d=0;d<t.length;d++){let f=t[d],p=l+d,m=i.xToPixel(p,n,o),h=f.close>=f.open,g=i.yToPixel(f.open,r,s),_=i.yToPixel(f.close,r,s),v=i.yToPixel(f.high,r,s),y=i.yToPixel(f.low,r,s),b=h?a.candle.up:a.candle.down,x=h?a.candle.wickUp:a.candle.wickDown;e.beginPath(),e.strokeStyle=x,e.lineWidth=1,e.moveTo(m,v),e.lineTo(m,y),e.stroke();let S=Math.min(g,_),C=Math.max(Math.abs(_-g),1);if(h)e.strokeStyle=b,e.lineWidth=1,e.strokeRect(m-c/2,S,c,C);else{var u;let t=(u=a.candle.borderDown)==null?a.candle.down:u;e.fillStyle=b,e.fillRect(m-c/2,S,c,C),t!==b&&(e.strokeStyle=t,e.lineWidth=1,e.strokeRect(m-c/2,S,c,C))}}}function M(e,t){let n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n)return`rgba(${n[1]},${n[2]},${n[3]},${t})`;let r=e.replace(`#`,``),i=r.length===3?r.split(``).map(e=>e+e).join(``):r;return`rgba(${parseInt(i.slice(0,2),16)},${parseInt(i.slice(2,4),16)},${parseInt(i.slice(4,6),16)},${t})`}var N=null;function P(e,t,n,r,i,a,o,s,c=!1){if(t.length===0)return;let l=Math.floor(n.startIndex);if(c){let c=i.xToPixel(l+t.length-1,n,o),u=i.xToPixel(l,n,o);e.beginPath();for(let a=0;a<t.length;a++){let c=i.xToPixel(l+a,n,o),u=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(c,u):e.lineTo(c,u)}if(e.lineTo(c,s),e.lineTo(u,s),e.closePath(),!N||N.height!==s||N.color!==a.candle.up){let t=e.createLinearGradient(0,0,0,s);t.addColorStop(0,M(a.candle.up,.15)),t.addColorStop(1,M(a.candle.up,0)),N={gradient:t,height:s,color:a.candle.up}}e.fillStyle=N.gradient,e.fill()}e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;for(let a=0;a<t.length;a++){let c=i.xToPixel(l+a,n,o),u=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(c,u):e.lineTo(c,u)}e.stroke()}function F(e,t,n,r,i,a,o,s){let c=Math.max(2,i.candleBodyWidth(n,o)*.4),l=Math.floor(n.startIndex);for(let u=0;u<t.length;u++){let d=t[u],f=l+u,p=i.xToPixel(f,n,o),m=d.close>=d.open?a.candle.up:a.candle.down,h=i.yToPixel(d.open,r,s),g=i.yToPixel(d.close,r,s),_=i.yToPixel(d.high,r,s),v=i.yToPixel(d.low,r,s);e.strokeStyle=m,e.lineWidth=1,e.beginPath(),e.moveTo(p,_),e.lineTo(p,v),e.stroke(),e.beginPath(),e.moveTo(p-c,h),e.lineTo(p,h),e.stroke(),e.beginPath(),e.moveTo(p,g),e.lineTo(p+c,g),e.stroke()}}function I(e,t,n,r,i,a,o,s,c){let l=i.candleBodyWidth(n,o),u=Math.floor(n.startIndex);for(let d=0;d<t.length;d++){let f=t[d];if(f.volume==null)continue;let p=u+d,m=i.xToPixel(p,n,o),h=f.close>=f.open,g=s-i.volumeToPixel(f.volume,r,s),_=c+s-g;e.fillStyle=h?a.volume.up:a.volume.down,e.fillRect(m-l/2,_,l,g)}}function L(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=(r.open+r.high+r.low+r.close)/4,a=n===0?(r.open+r.close)/2:(t[n-1].open+t[n-1].close)/2;t.push({time:r.time,open:a,close:i,high:Math.max(r.high,a,i),low:Math.min(r.low,a,i),volume:r.volume})}return t}function R(e,t,n,r,i,a,o,s){let c=L(t),l=i.candleBodyWidth(n,o),u=Math.floor(n.startIndex);for(let t=0;t<c.length;t++){var d,f;let p=c[t],m=u+t,h=i.xToPixel(m,n,o),g=p.close>=p.open,_=i.yToPixel(p.open,r,s),v=i.yToPixel(p.close,r,s),y=i.yToPixel(p.high,r,s),b=i.yToPixel(p.low,r,s),x=g?a.candle.up:a.candle.down,S=g?a.candle.wickUp:a.candle.wickDown,C=g?(d=a.candle.borderUp)==null?a.candle.up:d:(f=a.candle.borderDown)==null?a.candle.down:f;e.beginPath(),e.strokeStyle=S,e.lineWidth=1,e.moveTo(h,y),e.lineTo(h,b),e.stroke();let w=Math.min(_,v),T=Math.max(Math.abs(v-_),1);e.fillStyle=x,e.fillRect(h-l/2,w,l,T),C!==x&&(e.strokeStyle=C,e.lineWidth=1,e.strokeRect(h-l/2,w,l,T))}}function z(e,t,n,r,i,a,o,s){let c=i.candleBodyWidth(n,o),l=Math.max(...t.map(e=>{var t;return(t=e.volume)==null?0:t}),1),u=Math.floor(n.startIndex);for(let m=0;m<t.length;m++){var d,f,p;let h=t[m],g=u+m,_=i.xToPixel(g,n,o),v=h.close>=h.open,y=l>0?((d=h.volume)==null?l:d)/l:1,b=Math.max(1,y*c),x=i.yToPixel(h.open,r,s),S=i.yToPixel(h.close,r,s),C=i.yToPixel(h.high,r,s),w=i.yToPixel(h.low,r,s),T=v?a.candle.up:a.candle.down,E=v?a.candle.wickUp:a.candle.wickDown,D=v?(f=a.candle.borderUp)==null?a.candle.up:f:(p=a.candle.borderDown)==null?a.candle.down:p;e.beginPath(),e.strokeStyle=E,e.lineWidth=1,e.moveTo(_,C),e.lineTo(_,w),e.stroke();let O=Math.min(x,S),k=Math.max(Math.abs(S-x),1);e.fillStyle=T,e.fillRect(_-b/2,O,b,k),D!==T&&(e.strokeStyle=D,e.lineWidth=1,e.strokeRect(_-b/2,O,b,k))}}function B(e,t,n,r,i,a,o,s){if(t.length===0)return;e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;let c=Math.floor(n.startIndex);for(let a=0;a<t.length;a++){let l=c+a,u=i.xToPixel(l,n,o),d=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(u,d):e.lineTo(u,d)}e.stroke();let l=Math.min(3,i.candleBodyWidth(n,o)*.35);if(!(l<.5)){e.fillStyle=a.candle.up;for(let a=0;a<t.length;a++){let u=c+a,d=i.xToPixel(u,n,o),f=i.yToPixel(t[a].close,r,s);e.beginPath(),e.arc(d,f,l,0,Math.PI*2),e.fill()}}}function V(e,t,n,r,i,a,o,s){if(t.length===0)return;e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;let c=Math.floor(n.startIndex),l=0;for(let a=0;a<t.length;a++){let u=c+a,d=i.xToPixel(u,n,o),f=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(d,f):(e.lineTo(d,l),e.lineTo(d,f)),l=f}e.stroke()}function H(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;return`rgba(${parseInt(r.slice(0,2),16)},${parseInt(r.slice(2,4),16)},${parseInt(r.slice(4,6),16)},${t})`}function ee(e,t,n,r,i,a,o,s){if(t.length===0)return;let c=Math.floor(n.startIndex);e.beginPath();for(let a=0;a<t.length;a++){let l=i.xToPixel(c+a,n,o),u=i.yToPixel(t[a].high,r,s);a===0?e.moveTo(l,u):e.lineTo(l,u)}for(let a=t.length-1;a>=0;a--){let l=i.xToPixel(c+a,n,o),u=i.yToPixel(t[a].low,r,s);e.lineTo(l,u)}e.closePath(),e.fillStyle=H(a.candle.up,.12),e.fill(),e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;for(let a=0;a<t.length;a++){let l=i.xToPixel(c+a,n,o),u=i.yToPixel(t[a].close,r,s);a===0?e.moveTo(l,u):e.lineTo(l,u)}e.stroke()}function te(e,t){let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;return`rgba(${parseInt(r.slice(0,2),16)},${parseInt(r.slice(2,4),16)},${parseInt(r.slice(4,6),16)},${t})`}function U(e,t,n,r,i,a,o,s){if(t.length===0)return;let c=(r.min+r.max)/2,l=i.yToPixel(c,r,s),u=Math.floor(n.startIndex),d=t.map((e,t)=>({x:i.xToPixel(u+t,n,o),y:i.yToPixel(e.close,r,s)})),f=d[0].x,p=d[d.length-1].x,m=()=>{e.beginPath();for(let t=0;t<d.length;t++)t===0?e.moveTo(d[t].x,d[t].y):e.lineTo(d[t].x,d[t].y);e.lineTo(p,l),e.lineTo(f,l),e.closePath()};e.save(),e.beginPath(),e.rect(0,0,o,l),e.clip(),m(),e.fillStyle=te(a.candle.up,.15),e.fill(),e.restore(),e.save(),e.beginPath(),e.rect(0,l,o,s-l),e.clip(),m(),e.fillStyle=te(a.candle.down,.15),e.fill(),e.restore(),e.beginPath(),e.strokeStyle=a.candle.up,e.lineWidth=1.5,e.lineJoin=`round`;for(let t=0;t<d.length;t++)t===0?e.moveTo(d[t].x,d[t].y):e.lineTo(d[t].x,d[t].y);e.stroke(),e.beginPath(),e.strokeStyle=te(a.candle.up,.4),e.lineWidth=1,e.setLineDash([4,4]),e.moveTo(f,l),e.lineTo(p,l),e.stroke(),e.setLineDash([])}function ne(e,t,n,r,i,a,o,s){let c=i.candleBodyWidth(n,o),l=Math.floor(n.startIndex);for(let u=0;u<t.length;u++){let d=t[u],f=l+u,p=i.xToPixel(f,n,o),m=d.close>=d.open,h=i.yToPixel(d.close,r,s),g=Math.max(1,s-h);e.fillStyle=m?a.candle.up:a.candle.down,e.fillRect(p-c/2,h,c,g)}}function re(e,t,n,r,i,a,o,s){e.lineWidth=1.5;let c=Math.floor(n.startIndex);for(let l=0;l<t.length;l++){let u=t[l],d=c+l,f=i.xToPixel(d,n,o),p=u.close>=u.open,m=i.yToPixel(u.high,r,s),h=i.yToPixel(u.low,r,s);e.strokeStyle=p?a.candle.up:a.candle.down,e.beginPath(),e.moveTo(f,m),e.lineTo(f,h),e.stroke()}}function ie(e,t,n,r,i,o,s){if(e.save(),e.globalAlpha=.6,e.strokeStyle=r.grid,e.lineWidth=1,e.beginPath(),s===void 0)for(let r of a(t,o)){let a=Math.round(n.yToPixel(r,t,o))+.5;e.moveTo(0,a),e.lineTo(i,a)}else{let r=(t.max-t.min)/s;for(let a=0;a<=s;a++){let s=t.min+r*a,c=Math.round(n.yToPixel(s,t,o))+.5;e.moveTo(0,c),e.lineTo(i,c)}}e.stroke();let c=Math.max(1,Math.floor(i/80)),l=i/c;e.beginPath();for(let t=1;t<c;t++){let n=Math.round(t*l)+.5;e.moveTo(n,0),e.lineTo(n,o)}e.stroke(),e.restore()}var ae=[`1m`,`5m`,`15m`,`30m`,`1h`,`4h`];function oe(e,t,n=`UTC`){let r=new Date(e);return ae.includes(t)?`${r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`,timeZone:n})} ${r.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1,timeZone:n})}`:t===`1M`?r.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`,timeZone:n}):r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`,timeZone:n})}function se(e,t,n,r,i,a,o,s,c,l,u,d=2,f=v,p=`UTC`){let m=i.xToPixel(t.barIndex,r,o),h=i.yToPixel(t.price,n,s);e.setLineDash([4,4]),e.strokeStyle=a.crosshair,e.lineWidth=1,e.beginPath(),e.moveTo(m,0),e.lineTo(m,l),e.stroke(),e.beginPath(),e.moveTo(0,h),e.lineTo(o,h),e.stroke(),e.setLineDash([]);let g=f.labelHeight,_=f.labelPaddingX;e.font=`${f.fontSize} ${f.fontFamily}`;let y=t.price.toFixed(d);if(e.fillStyle=a.tooltip.background,e.fillRect(o,h-g/2,c,g),e.strokeStyle=a.crosshair,e.lineWidth=1,e.strokeRect(o,h-g/2,c,g),e.fillStyle=a.tooltip.text,e.textAlign=`left`,e.fillText(y,o+_,h+4),t.bar){let n=oe(t.bar.time,u,p),r=e.measureText(n).width+_*2,i=Math.max(0,Math.min(o-r,m-r/2));e.fillStyle=a.tooltip.background,e.fillRect(i,l,r,g),e.strokeStyle=a.crosshair,e.lineWidth=1,e.strokeRect(i,l,r,g),e.fillStyle=a.tooltip.text,e.textAlign=`left`,e.fillText(n,i+_,l+13)}}function ce(e,t,n=new Set){let r=e.filter(e=>!n.has(e.level.label)).sort((e,t)=>e.y-t.y);if(r.length<2)return[];let i=[],a=[r[0]],o=r[0].y;for(let e=1;e<r.length;e++){let n=r[e];n.y-o<=t?a.push(n):(i.push(a),a=[n],o=n.y)}return i.push(a),i.filter(e=>e.length>=2).map(e=>({id:`cluster:`+e.map(e=>e.level.label).sort().join(`|`),members:e,centerY:e.reduce((e,t)=>e+t.y,0)/e.length,centerPrice:e.reduce((e,t)=>e+t.price,0)/e.length}))}function le(e,t,n=4){let r=e.members.length,i=r*t+(r-1)*n,a=e.centerY-i/2,o=[...e.members].sort((e,t)=>e.y-t.y),s=new Map;for(let e=0;e<o.length;e++)s.set(o[e].level.label,a+e*(t+n));return s}function W(e,t,n){let r=e.members.filter(e=>e.level.type===`position`&&!e.level.entryPriceEditable).length,i=e.members.filter(e=>e.level.type===`pending`||e.level.entryPriceEditable===!0).length,a=e.members.filter(e=>e.level.type===`trade`).length,o=[];r>0&&o.push(`${r} Position${r>1?`s`:``}`),i>0&&o.push(`${i} Order${i>1?`s`:``}`),a>0&&o.push(`${a} Trade${a>1?`s`:``}`);let s=o.join(` / `),c=12+n.measureText(s).width+16+12;return{badgeX:(t-c)/2,badgeY:e.centerY-24/2,badgeW:c,badgeH:24,text:s}}function ue(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}var de=8,fe=6,pe=6,me=4,he=16,ge=3,_e=1,ve=7,ye=7,be=4,xe=7,Se=4,Ce=6,we=`13px 'Inter', system-ui, sans-serif`,Te=`13px 'Inter', system-ui, sans-serif`,Ee=14,G=1.5,De=1,K=5,Oe=3,ke=he+Oe*2,Ae=`12px 'Inter', system-ui, sans-serif`,je=.68,Me=[0,-.08,.08],Ne=30;function Pe(e){return e.type===`position`&&!!e.pnlText}function Fe(e,t,n,r){return e<n+r&&e+t>n}function Ie(e,t,n,r,i){let a=[];e&&a.push(e);for(let e of i)a.push(e);let o=t,s=0,c=a.length+2;for(;s<c&&a.some(e=>Fe(o,n,e.boxY,e.boxH));)o+=r*(n+2),s++;return o}function Le(e,t,n){var r,i,a;if((r=e.data)!=null&&r._isDraft){let t=e;return`${t.side.charAt(0).toUpperCase()+t.side.slice(1)} ${t.orderType.charAt(0).toUpperCase()+t.orderType.slice(1)}`}if(e.type===`pending`){var o;let r=e,i=r.lots===void 0?``:` ${r.lots}`;return(o=e.text)==null?`${r.side.toUpperCase()}${i} @${t.toFixed(n)}`:o}if(e.type===`position`&&e.entryPriceEditable){var s;let r=e,i=r.side?r.side.toUpperCase():``,a=r.lots===void 0?``:` ${r.lots}`;return(s=e.text)==null?`${i}${a} @${t.toFixed(n)}`:s}return e.type===`position`?(i=e.text)==null?``:i:(a=e.text)==null?e.label:a}function Re(e,t,n,r,i,a,o,s,c,l=ke){let u=[];for(let i of e){if(i.label!==s&&i.label!==c)continue;let e=i;if(e.stopLossPrice!==void 0){let s=`${i.label}:stopLoss`,c=a===s&&o!==null?o:e.stopLossPrice;u.push({key:s,y:t.yToPixel(c,n,r)})}if(e.takeProfitPrice!==void 0){let s=`${i.label}:takeProfit`,c=a===s&&o!==null?o:e.takeProfitPrice;u.push({key:s,y:t.yToPixel(c,n,r)})}}u.sort((e,t)=>e.y-t.y);let d=i*je,f=Me.map(e=>d+e*i),p=f.map(()=>-1/0),m=new Map;for(let e of u){let t=!1;for(let n=0;n<f.length;n++)if(e.y>=p[n]+l){m.set(e.key,f[n]),p[n]=e.y,t=!0;break}if(!t){let t=p.indexOf(Math.min(...p));m.set(e.key,f[t]),p[t]=e.y}}return m}function ze(e){let t=e.trim(),n=-1,r=-1,i=-1;if(t.startsWith(`#`)){let e=t.slice(1);e.length===3||e.length===4?(n=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),i=parseInt(e[2]+e[2],16)):(e.length===6||e.length===8)&&(n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16))}else{let e=t.match(/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i);e&&(n=parseFloat(e[1]),r=parseFloat(e[2]),i=parseFloat(e[3]))}return n<0||r<0||i<0||Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i)?!0:(.2126*n+.7152*r+.0722*i)/255>=.5}function q(e){return ze(e.background)?`#000000`:`#ffffff`}function Be(e,t){return ze(e.background)?t?`rgb(230,230,230)`:`rgb(255,255,255)`:t?`rgb(30,30,30)`:`rgb(0,0,0)`}function Ve(e,t,n){if(e.type===`position`){let r=e;if(r.entryPriceEditable&&r.side)return r.side===`buy`?t.pendingBuyLine:t.pendingSellLine;let i=e.pnl;return i===void 0?t.positionLine:i>=0?n.candle.up:n.candle.down}return e.type===`pending`?e.side===`buy`?t.pendingBuyLine:t.pendingSellLine:t.tradeLine}function He(e){return e.type===`pending`?!0:e.type===`position`?!!e.entryPriceEditable:!1}function Ue(e,t,n,r,i,a,o,s,c=null,l=null,u=null,d=null,f=new Set,p=`line`,m=!1,h=null,g={},_=new Set,v=0,y=!1,b=null,x=null,S=1){if(t.length===0)return{hitAreas:[],editAreas:[],hoverAreas:[],dragAreas:[],confirmAreas:[],addBracketAreas:[],clusterBadgeAreas:[],clusters:[]};let C=i.tradeLevels,w=Math.min(Math.max(S,1),3),T=ve*w,E=ye*w,D=xe*w,O=be*w,k=Se*w,A=Math.max(T,E,D),j=Math.max(he+me*2,A*2+me*2),M=Math.max(ke,T*2+Oe*2);e.save(),e.font=we;let N=[];for(let i of t){var P,F;let t=l===i.label&&u!==null?u:i.price,a=n.yToPixel(t,r,o);if(a<-40||a>o+40)continue;if(p===`dot`&&i.type===`position`&&i.label!==d){N.push({level:i,price:t,y:a,boxW:0,boxH:0});continue}if(i.type===`pending`&&i.orderType===`market`&&((P=i.data)==null?void 0:P._isDraft)===!0){N.push({level:i,price:t,y:a,boxW:0,boxH:0});continue}let c=Pe(i)?i.pnlText:null,h=f.has(i.label),g=Le(i,t,s),_=c?e.measureText(c).width+Ce:0,v=e.measureText(g).width,b=h&&!m,x=b?(D*2+k)*2:0,S=b||m?0:E*2+O+T*2+de/2,C=((F=i.data)==null?void 0:F._isDraft)===!0,w=i.label===d||h,A=i.type===`position`&&i.entryPriceEditable===!0,M=i.type===`pending`||A,I=i.lots,L=y&&(C||w)&&M&&I!==void 0?String(I):null,R=de+(L?fe+e.measureText(L).width+fe+pe:0)+_+v+de+x+S;N.push({level:i,price:t,y:a,boxW:R,boxH:j})}let I=new Set;h&&I.add(h);let L=v>0?ce(N,v,I):[],R=L.filter(e=>!_.has(e.id)),z=L.filter(e=>_.has(e.id)),B=new Set;for(let e of R)for(let t of e.members)B.add(t.level.label);let V=new Map;for(let e of z)V.set(e.id,le(e,j,4));let H=new Map;for(let e of z)for(let t of e.members)H.set(t.level.label,e);N.sort((e,t)=>e.y-t.y);let ee=[],te=new Map;for(let e of N){if(B.has(e.level.label))continue;let t=H.get(e.level.label);if(t){let n=V.get(t.id),r=n==null?void 0:n.get(e.level.label);if(r!==void 0){ee.push({label:e.level.label,boxY:r,boxH:e.boxH}),te.set(e.level.label,{price:e.price,y:e.y,boxY:r,boxW:e.boxW,boxH:e.boxH});continue}}let n=e.y-e.boxH/2,r=0;for(;r<ee.length+1&&ee.some(t=>Fe(n,e.boxH,t.boxY,t.boxH));)n-=e.boxH+2,r++;ee.push({label:e.level.label,boxY:n,boxH:e.boxH}),te.set(e.level.label,{price:e.price,y:e.y,boxY:n,boxW:e.boxW,boxH:e.boxH})}let U=Re(t,n,r,o,a,l,u,c,d,M),ne=[],re=a*je;for(let e of t){if(e.label!==c&&e.label!==d)continue;let t=e,i=l===e.label;if(t.stopLossPrice!==void 0){var ie;let a=`${e.label}:stopLoss`,s=l===a&&u!==null?u:i&&b!==null?b:t.stopLossPrice;ne.push({key:a,label:e.label,y:n.yToPixel(s,r,o),columnX:(ie=U.get(a))==null?re:ie})}if(t.takeProfitPrice!==void 0){var ae;let a=`${e.label}:takeProfit`,s=l===a&&u!==null?u:i&&x!==null?x:t.takeProfitPrice;ne.push({key:a,label:e.label,y:n.yToPixel(s,r,o),columnX:(ae=U.get(a))==null?re:ae})}}ne.sort((e,t)=>e.y-t.y);let oe=new Map,se=[];for(let e of ne){let t=te.get(e.label),n=e.y-M/2,r=Ie(t?{boxY:t.boxY,boxH:t.boxH}:null,n,M,t&&Math.sign(e.y-t.y)||1,se.filter(t=>t.columnX===e.columnX));oe.set(e.key,r),se.push({columnX:e.columnX,boxY:r,boxH:M})}let W=c==null?d:c,ue=h==null?d:h,ge=N.filter(e=>!B.has(e.level.label)),_e=[...ge.filter(e=>e.level.label!==W),...ge.filter(e=>e.level.label===W)],Te=[],Ee=[],G=[],De=[],Me=[],Ne=[],ze=[],q=[];for(let t of R)Ke(e,t,a,i,ze);for(let{level:t}of _e){let h=te.get(t.label);h&&(Xe(e,t,h,a,C,i,s,t.label===c,t.label===d,n,r,o,l,u,U,f.has(t.label),p,Te,Ee,G,De,Me,Ne,m,t.label===ue?g:void 0,y,q,b,x,S,oe),H.get(t.label)&&h.boxY!==h.y-j/2&&qe(e,h.boxY+j/2,h.y,a,i))}if(d!==null&&!te.has(d)){let c=t.find(e=>e.label===d);if(c){let t=c,d=`${c.label}:stopLoss`,f=`${c.label}:takeProfit`,p=l===c.label,h=p&&b!==null?b:t.stopLossPrice,g=p&&x!==null?x:t.takeProfitPrice;if(h!==void 0&&g!==void 0){var Be,Ve,He,Ue;let t=n.yToPixel(h,r,o),a=n.yToPixel(g,r,o),c=Math.max(ke,ve*2+Oe*2);e.save(),e.font=Ae;let l=ve*2+K/2,u=K+e.measureText(`SL ${h.toFixed(s)}`).width+K+l,p=K+e.measureText(`TP ${g.toFixed(s)}`).width+K+l;e.restore();let m=(((Be=U.get(d))==null?re:Be)-u/2-2+(((Ve=U.get(f))==null?re:Ve)-p/2-2))/2,_=(He=oe.get(d))==null?t-c/2:He,v=(Ue=oe.get(f))==null?a-c/2:Ue,[y,b]=v<_?[v,_]:[_,v];Je(e,m,y+c,b,i)}if(h!==void 0){var We;Qe(e,t,`stopLoss`,h,n,r,o,(We=U.get(d))==null?re:We,a,i,s,l,u,Te,De,m,t._slOrderLabel,void 0,S,oe.get(d))}if(g!==void 0){var J;Qe(e,t,`takeProfit`,g,n,r,o,(J=U.get(f))==null?re:J,a,i,s,l,u,Te,De,m,t._tpOrderLabel,void 0,S,oe.get(f))}}}return e.restore(),{hitAreas:Te,editAreas:Ee,hoverAreas:G,dragAreas:De,confirmAreas:Me,addBracketAreas:Ne,clusterBadgeAreas:ze,clusters:L,draftQtyPillArea:q[0]}}var We=`bold 12px 'Inter', system-ui, sans-serif`,J=12,Y=24,Ge=12;function Ke(e,t,n,r,i){let a=q(r),o=!ze(r.background);e.save(),e.strokeStyle=a,e.globalAlpha=.12,e.lineWidth=1,e.setLineDash([4,4]);for(let r of t.members)e.beginPath(),e.moveTo(0,r.y),e.lineTo(n,r.y),e.stroke();e.setLineDash([]),e.restore(),e.save(),e.font=We;let{badgeX:s,badgeY:c,badgeW:l,text:u}=W(t,n,e);e.fillStyle=o?`rgba(40,40,40,0.92)`:`rgba(240,240,240,0.92)`,e.beginPath(),e.roundRect(s,c,l,Y,Ge),e.fill(),e.strokeStyle=a,e.globalAlpha=.3,e.lineWidth=1,e.stroke(),e.globalAlpha=1,e.fillStyle=a,e.globalAlpha=.85,e.textBaseline=`middle`,e.textAlign=`left`,e.fillText(u+` ▸`,s+J,c+Y/2),e.globalAlpha=1,e.restore(),i.push({clusterId:t.id,x:s,y:c,w:l,h:Y})}function qe(e,t,n,r,i){if(Math.abs(t-n)<2)return;let a=q(i);e.save(),e.strokeStyle=a,e.globalAlpha=.25,e.lineWidth=1,e.setLineDash([2,3]);let o=r-8;e.beginPath(),e.moveTo(o,t),e.lineTo(o,n),e.stroke(),e.setLineDash([]),e.beginPath(),e.moveTo(o-4,n),e.lineTo(o+4,n),e.stroke(),e.restore()}function Je(e,t,n,r,i){r-n<2||(e.save(),e.strokeStyle=q(i),e.globalAlpha=.5,e.lineWidth=1,e.setLineDash([3,4]),e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.stroke(),e.setLineDash([]),e.restore())}function Ye(e,t,n,r,i,a,o){let s=t,c=[],l=t;if(s.orderType!==void 0)c.push({label:`Price`,value:t.price.toFixed(o)}),l.stopLossPrice!==void 0&&c.push({label:`SL`,value:l.stopLossPrice.toFixed(o)}),l.takeProfitPrice!==void 0&&c.push({label:`TP`,value:l.takeProfitPrice.toFixed(o)});else{if(s.pnlText!==void 0){let e=s.pnl===void 0?void 0:s.pnl>=0?a.candle.up:a.candle.down;c.push({label:`PnL`,value:s.pnlText,pnlColor:e})}s.side!==void 0&&c.push({label:`Side`,value:s.side===`buy`?`Buy`:`Sell`}),s.lots!==void 0&&c.push({label:`Lots`,value:String(s.lots)}),c.length===0&&c.push({label:`Price`,value:t.price.toFixed(o)})}let u=de,d=me,f=he+3;e.save(),e.font=we;let p=Math.max(...c.map(t=>e.measureText(t.label).width)),m=Math.max(...c.map(t=>e.measureText(t.value).width)),h=u+p+8+m+u,g=d+c.length*f-3+d,_=r-i-8-h,v=n-g/2;e.fillStyle=Be(a,!0),e.strokeStyle=q(a),e.lineWidth=1,tt(e,_,v,h,g,ge),e.fill(),e.stroke(),e.textBaseline=`top`,c.forEach((t,n)=>{var r;let i=v+d+n*f;e.textAlign=`left`,e.fillStyle=q(a),e.globalAlpha=.55,e.fillText(t.label,_+u,i),e.globalAlpha=1,e.textAlign=`right`,e.fillStyle=(r=t.pnlColor)==null?q(a):r,e.fillText(t.value,_+u+p+8+m,i)}),e.restore()}function Xe(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C=!1,w,T=!1,E,D=null,O=null,k=1,A){var j,M;let{y:N,boxY:P,boxW:F,boxH:I}=n,L=Ve(t,i,a),R=s||c,z=Math.min(Math.max(k,1),3),B=ve*z,V=ye*z,H=xe*z,ee=be*z,te=Se*z;if(g===`dot`&&t.type===`position`&&!c){let n=r-6-4;s&&Ye(e,t,N,n,6,a,o),e.save(),e.fillStyle=L,e.globalAlpha=s?1:.75,e.beginPath(),e.arc(n,N,6,0,Math.PI*2),e.fill(),e.globalAlpha=1,e.restore(),y.push({label:t.label,boxX:n-6,boxY:N-6,boxW:12,boxH:12,lineX:n-6,lineY:N-6,lineW:12,lineH:12});return}let U=Pe(t)?t.pnlText:null,ne=t.type===`position`?t.pnl:void 0,re=t.type===`pending`,ie=re&&t.orderType===`market`&&((j=t.data)==null?void 0:j._isDraft)===!0,ae=He(t),oe=(ae?Ee+2:0)+F,se=Math.round((r-oe)/2),ce=ae?se:0,le=ae?se+Ee+2:se,W=t;if(R||ie){let n=`${t.label}:stopLoss`,i=`${t.label}:takeProfit`,s=f===t.label,h=s&&D!==null?D:W.stopLossPrice,g=s&&O!==null?O:W.takeProfitPrice;if(c&&h!==void 0&&g!==void 0){var ue,me,he,G;let t=l.yToPixel(h,u,d),s=l.yToPixel(g,u,d),c=C?ke:Math.max(ke,B*2+Oe*2);e.save(),e.font=Ae;let f=C?0:B*2+K/2,p=K+e.measureText(`SL ${h.toFixed(o)}`).width+K+f,_=K+e.measureText(`TP ${g.toFixed(o)}`).width+K+f;e.restore();let v=(ue=m.get(n))==null?r*je:ue,y=(me=m.get(i))==null?r*je:me,b=(v-p/2-2+(y-_/2-2))/2,x=(he=A==null?void 0:A.get(n))==null?t-c/2:he,S=(G=A==null?void 0:A.get(i))==null?s-c/2:G,[w,T]=S<x?[S,x]:[x,S];Je(e,b,w+c,T,a)}if(h!==void 0){var De;Qe(e,W,`stopLoss`,h,l,u,d,(De=m.get(n))==null?r*je:De,r,a,o,f,p,_,b,C,W._slOrderLabel,w==null?void 0:w.sl,k,A==null?void 0:A.get(n))}else f===n&&p!==null&&Qe(e,W,`stopLoss`,p,l,u,d,r*je,r,a,o,f,p,_,b,C,void 0,w==null?void 0:w.sl,k);if(g!==void 0){var Me;Qe(e,W,`takeProfit`,g,l,u,d,(Me=m.get(i))==null?r*je:Me,r,a,o,f,p,_,b,C,W._tpOrderLabel,w==null?void 0:w.tp,k,A==null?void 0:A.get(i))}else f===i&&p!==null&&Qe(e,W,`takeProfit`,p,l,u,d,r*je,r,a,o,f,p,_,b,C,void 0,w==null?void 0:w.tp,k);if(c&&W.side!==void 0){let t=r*je;W.stopLossPrice===void 0&&f!==n&&Ze(e,W,`stopLoss`,N,t,r,d,a,S),W.takeProfitPrice===void 0&&f!==i&&Ze(e,W,`takeProfit`,N,t,r,d,a,S)}}if(ie)return;let Ne=t.type===`position`&&t.entryPriceEditable===!0;e.save(),e.strokeStyle=L,e.lineWidth=_e,e.globalAlpha=R?1:.85,(re||Ne)&&e.setLineDash([5,4]),e.beginPath(),e.moveTo(0,N),e.lineTo(r,N),e.stroke(),e.setLineDash([]),e.globalAlpha=1,e.restore();let Fe=P+I/2;e.save(),e.fillStyle=Be(a,R),e.strokeStyle=L,e.lineWidth=1,tt(e,le,P,F,I,ge),e.fill(),e.stroke();let Ie=le+de,Re=((M=t.data)==null?void 0:M._isDraft)===!0,ze=t.type===`pending`||Ne,Ue=t.lots;if(T&&(Re||c||h)&&ze&&Ue!==void 0){let n=String(Ue);e.font=we;let r=fe+e.measureText(n).width+fe,i=Ie;e.save(),e.strokeStyle=q(a),e.globalAlpha=.35,e.lineWidth=1,e.beginPath(),e.moveTo(i+r,P+3),e.lineTo(i+r,P+I-3),e.stroke(),e.restore(),e.fillStyle=q(a),e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(n,i+fe,Fe),E==null||E.push({label:t.label,pillX:i,pillY:P,pillW:r,pillH:I}),Ie+=r+pe}if(U){let t=ne===void 0?q(a):ne>=0?a.candle.up:a.candle.down;e.font=Te,e.fillStyle=t,e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(U,Ie,Fe),Ie+=e.measureText(U).width+Ce}let We=Le(t,n.price,o);e.font=we,e.fillStyle=q(a),e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(We,Ie,Fe);let J=Fe,Y=3.5;if(!C&&h){let n=le+F-de/2-H,r=n-H-te-H;e.fillStyle=a.candle.up,e.beginPath(),e.arc(r,J,H,0,Math.PI*2),e.fill(),e.strokeStyle=a.background,e.lineWidth=1.5,e.lineCap=`round`,e.lineJoin=`round`;let i=3.1;e.beginPath(),e.moveTo(r-i,J),e.lineTo(r-i*.2,J+i*.8),e.lineTo(r+i,J-i*.7),e.stroke(),e.fillStyle=a.candle.down,e.beginPath(),e.arc(n,J,H,0,Math.PI*2),e.fill(),e.strokeStyle=a.background,e.lineWidth=1.5,e.lineCap=`round`,e.beginPath(),e.moveTo(n-Y,J-Y),e.lineTo(n+Y,J+Y),e.moveTo(n+Y,J-Y),e.lineTo(n-Y,J+Y),e.stroke(),x.push({label:t.label,type:t.type,data:t.data,action:`confirm`,x:r-H,y:J-H,w:H*2,h:H*2}),x.push({label:t.label,type:t.type,data:t.data,action:`cancel`,x:n-H,y:J-H,w:H*2,h:H*2})}else if(!C){let n=le+F-de/2-B,r=n-B-ee-V;e.fillStyle=q(a),e.beginPath(),e.arc(r,J,V,0,Math.PI*2),e.fill();let i=V*.48;e.save(),e.strokeStyle=a.background,e.lineWidth=1.5,e.lineCap=`round`,e.lineJoin=`round`,e.translate(r,J),e.rotate(Math.PI/4),e.beginPath(),e.moveTo(-i*.35,-i),e.lineTo(-i*.35,i*.5),e.lineTo(i*.35,i*.5),e.lineTo(i*.35,-i),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(-i*.35,i*.5),e.lineTo(0,i+i*.45),e.lineTo(i*.35,i*.5),e.stroke(),e.restore(),e.fillStyle=q(a),e.beginPath(),e.arc(n,J,B,0,Math.PI*2),e.fill(),e.strokeStyle=a.background,e.lineWidth=1.5,e.lineCap=`round`,e.beginPath(),e.moveTo(n-Y,J-Y),e.lineTo(n+Y,J+Y),e.moveTo(n+Y,J-Y),e.lineTo(n-Y,J+Y),e.stroke(),v.push({label:t.label,type:t.type,data:t.data,x:r-V,y:J-V,w:V*2,h:V*2}),_.push({label:t.label,type:t.type,data:t.data,x:n-B,y:J-B,w:B*2,h:B*2})}if(e.restore(),ae){et(e,ce,P,I,i,s);let n=C?0:V*2+ee+B*2+de/2;b.push({label:t.label,type:t.type,data:t.data,price:t.price,x:ce,y:P,w:Ee+2+F-n,h:I,isBracket:!1,isBox:!0}),b.push({label:t.label,type:t.type,data:t.data,price:t.price,x:0,y:N-4,w:r,h:8,isBracket:!1})}else C&&F>0&&b.push({label:t.label,type:t.type,data:t.data,price:t.price,x:le,y:P,w:F,h:I,isBracket:!1,isBox:!0});y.push({label:t.label,boxX:le,boxY:P,boxW:F,boxH:I,lineX:0,lineY:N-4,lineW:r,lineH:8})}function Ze(e,t,n,r,i,a,o,s,c){let l=r+(t.side===`buy`&&n===`stopLoss`||t.side===`sell`&&n===`takeProfit`?Ne:-Ne);if(l<0||l>o)return;e.save(),e.strokeStyle=q(s),e.lineWidth=.8,e.globalAlpha=.3,e.setLineDash([4,4]),e.beginPath(),e.moveTo(i,l),e.lineTo(a,l),e.stroke(),e.setLineDash([]),e.globalAlpha=1,e.restore();let u=n===`stopLoss`?`+SL`:`+TP`;e.font=Ae;let d=K+e.measureText(u).width+K,f=ke,p=i-d-2,m=l-f/2;e.save(),e.globalAlpha=.75,e.fillStyle=Be(s,!1),e.strokeStyle=q(s),e.lineWidth=.8,tt(e,p,m,d,f,ge),e.fill(),e.stroke(),e.globalAlpha=1,e.fillStyle=q(s),e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(u,p+K,l),e.restore(),c.push({label:t.label,type:t.type,data:t.data,bracketType:n,x:p,y:m,w:d,h:f})}function Qe(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v=1,y){var b,x;let S=ve*Math.min(Math.max(v,1),3),C=d===`${t.label}:${n}`&&f!==null?f:r,w=i.yToPixel(C,a,o);if(w<-20||w>o+20)return;e.save(),e.strokeStyle=q(l),e.lineWidth=De,e.globalAlpha=.8,e.beginPath(),e.moveTo(s,w),e.lineTo(c,w),e.stroke(),e.globalAlpha=1;let T=`${n===`stopLoss`?`SL`:`TP`} ${C.toFixed(u)}`;e.font=Ae;let E=e.measureText(T).width,D=_?e.measureText(_).width+K:0,O=h?0:S*2+K/2,k=K+E+D+K+O,A=h?ke:Math.max(ke,S*2+Oe*2),j=s-k-2,M=w-A/2,N=y==null?M:y,P=N+A/2;if(Math.abs(N-M)>=2&&$e(e,j+k/2,P,w,l),e.fillStyle=Be(l,!1),e.strokeStyle=q(l),e.lineWidth=.8,tt(e,j,N,k,A,ge),e.fill(),e.stroke(),e.fillStyle=q(l),e.textAlign=`left`,e.textBaseline=`middle`,e.fillText(T,j+K,P),_&&(e.fillStyle=_.trim().startsWith(`-`)?l.candle.down:l.candle.up,e.fillText(_,j+K+E+K,P)),!h){let r=j+k-K/2-S,i=P;e.fillStyle=q(l),e.beginPath(),e.arc(r,i,S,0,Math.PI*2),e.fill(),e.strokeStyle=l.background,e.lineWidth=1.5,e.lineCap=`round`;let a=3.5;e.beginPath(),e.moveTo(r-a,i-a),e.lineTo(r+a,i+a),e.moveTo(r+a,i-a),e.lineTo(r-a,i+a),e.stroke(),p.push({label:t.label,type:t.type,data:t.data,bracketType:n,bracketOrderLabel:g,x:r-S,y:i-S,w:S*2,h:S*2})}e.restore(),m.push({label:t.label,data:t.data,bracketType:n,price:C,parentPrice:t.price,parentSide:(b=t.side)==null?`buy`:b,bracketOrderLabel:g,x:s,y:w-5,w:c-s,h:10,isBracket:!0});let F=S*2+K/2;m.push({label:t.label,data:t.data,bracketType:n,price:C,parentPrice:t.price,parentSide:(x=t.side)==null?`buy`:x,bracketOrderLabel:g,x:j,y:N,w:k-F,h:A,isBracket:!0})}function $e(e,t,n,r,i){Math.abs(n-r)<2||(e.save(),e.strokeStyle=q(i),e.globalAlpha=.35,e.lineWidth=1,e.setLineDash([2,3]),e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.stroke(),e.restore())}function et(e,t,n,r,i,a){let o=a?i.dragHandleHover:i.dragHandle,s=G*2*2+3,c=G*2*3+6,l=t+(Ee-s)/2+G,u=n+(r-c)/2+G;e.save(),e.fillStyle=o;for(let t=0;t<3;t++)for(let n=0;n<2;n++){let r=l+n*(G*2+3),i=u+t*(G*2+3);e.beginPath(),e.arc(r,i,G,0,Math.PI*2),e.fill()}e.restore()}function tt(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.lineTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.closePath()}function nt(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function rt(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function it(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function at(e,t,n){var r;return(r=n.find(n=>e>=n.boxX&&e<=n.boxX+n.boxW&&t>=n.boxY&&t<=n.boxY+n.boxH||e>=n.lineX&&e<=n.lineX+n.lineW&&t>=n.lineY&&t<=n.lineY+n.lineH))==null?null:r}function ot(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function st(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function ct(e,t,n,r,i,a,o,s){let c=[];for(let e of t){if(e.type!==`position`)continue;let t=e;if(t.entryPriceEditable)continue;let a=n.yToPixel(t.price,r,o);a<-16||a>o+16||c.push({y:a,label:t.price.toFixed(s),color:Ve(e,i.tradeLevels,i)})}if(c.length===0)return;c.sort((e,t)=>e.y-t.y);let l=-1/0;for(let e of c)e.y-16/2<l&&(e.y=l+16/2),l=e.y+16/2+1;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.textAlign=`left`,e.textBaseline=`middle`;for(let t of c){let n=e.measureText(t.label).width;e.fillStyle=t.color,e.fillRect(a,t.y-16/2,n+12,16),e.fillStyle=`#ffffff`,e.fillText(t.label,a+4,t.y)}e.restore()}function lt(e,t,n){let r=[],i=[],{min:a,max:o}=t;for(let t of e){var s;if(t.label===n||t.type===`pending`&&t.orderType===`market`&&((s=t.data)==null?void 0:s._isDraft)===!0)continue;isFinite(t.price)&&(t.price>o?r.push({price:t.price,label:t.label,kind:`entry`}):t.price<a&&i.push({price:t.price,label:t.label,kind:`entry`}));let e=t.stopLossPrice,c=t.takeProfitPrice;e!==void 0&&isFinite(e)&&(e>o?r.push({price:e,label:t.label,kind:`sl`}):e<a&&i.push({price:e,label:t.label,kind:`sl`})),c!==void 0&&isFinite(c)&&(c>o?r.push({price:c,label:t.label,kind:`tp`}):c<a&&i.push({price:c,label:t.label,kind:`tp`}))}return{above:r,below:i}}function ut(e){let t=0;for(let n of e)n.kind===`entry`&&t++;return t}function dt(e,t){let n=e[0],r=Math.abs(n.price-t);for(let i=1;i<e.length;i++){let a=Math.abs(e[i].price-t);a<r&&(n=e[i],r=a)}return n}var ft=`11px 'Inter', system-ui, sans-serif`,pt=8,mt=8,ht=10,gt=20,_t=10,vt=`▲`,yt=`▼`;function bt(e,t,n,r,i,a,o,s=null){let c=[],l=a-40,u=n.max-n.min,d=l>0?u/l*20:0,{above:f,below:p}=lt(t,{min:n.min-d,max:n.max+d},o);if(f.length===0&&p.length===0)return{hitAreas:c};e.save(),e.font=ft,e.textBaseline=`middle`,e.textAlign=`center`;let m=(t,n,a,o)=>{let s=e.measureText(n).width,l=Math.ceil(s)+pt*2,u=i-mt-l;return e.fillStyle=r.tooltip.background,e.strokeStyle=r.tooltip.border,e.lineWidth=1,Ct(e,u,a,l,gt,_t),e.fill(),e.stroke(),e.fillStyle=r.tooltip.text,e.fillText(n,u+l/2,a+gt/2+.5),c.push({direction:t,x:u,y:a,w:l,h:gt,targetPrice:o.price,targetLabel:o.label,targetKind:o.kind}),l},h=(e,t,r)=>{if(t.length===0)return;let i=e===`up`?vt:yt,a=e===`up`?n.max:n.min,o=e===`up`?1:-1,c=r,l=ut(t);if(l>0){let n=dt(t.filter(e=>e.kind===`entry`),a);m(e,`${i} ${l}`,c,n),c+=o*(gt+4)}if(s!==null){let n=t.filter(e=>e.kind!==`entry`&&e.label===s);for(let t of n)m(e,`${i} ${t.kind.toUpperCase()}`,c,t),c+=o*(gt+4)}};return h(`up`,f,ht),h(`down`,p,a-ht-gt),e.restore(),{hitAreas:c}}function xt(e,t,n){var r;return(r=n.find(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.h))==null?null:r}function St(e,t,n){let r=e-t,i=e+t;return n.some(e=>r<e.y+e.h&&i>e.y)}function Ct(e,t,n,r,i,a){let o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}var wt=18,Tt=6,Et=3,Dt=[`1m`,`5m`,`15m`,`30m`,`1h`,`4h`];function Ot(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:e<604800?`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`:`${Math.floor(e/604800)}w ${Math.floor(e%604800/86400)}d`}function kt(e,t,n,r,i=`UTC`){let a=new Date(e);if(n&&Dt.includes(n)){let e=a.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1,timeZone:i});return r?a.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,timeZone:i})+` `+e:e}return n===`1Y`?a.toLocaleDateString(`en-US`,{year:`numeric`,timeZone:i}):n===`1M`?a.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`,timeZone:i}):t<=365?a.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,timeZone:i}):a.toLocaleDateString(`en-US`,{month:`short`,year:`2-digit`,timeZone:i})}function At(e,t,n,r,i,a,o,s=8,c=_,l,u,d=`UTC`){var f,p;let m=n.endIndex-n.startIndex,h=t[0],g=t[t.length-1],v=!!h&&!!g&&new Date(h.time).toLocaleDateString(`en-US`,{timeZone:d})!==new Date(g.time).toLocaleDateString(`en-US`,{timeZone:d});e.fillStyle=i.axisText,e.font=`${c.fontSize} ${c.fontFamily}`,e.textAlign=`center`;let y=kt((f=(p=t[Math.floor(t.length/2)])==null?void 0:p.time)==null?t[0].time:f,m,l,v,d),b=e.measureText(y).width,x=Math.max(1,Math.floor(t.length/s));if(t.length>1){let e=a/Math.max(1,t.length),n=b+24;e*x<n&&(x=Math.ceil(n/e))}for(let i=0;i<t.length;i+=x){let s=n.startIndex+i;if(u!==void 0&&s===u)continue;let c=r.xToPixel(s,n,a),f=kt(t[i].time,m,l,v,d),p=e.measureText(f).width/2,h=Math.max(p,Math.min(a-p,c));e.fillText(f,h,o+14)}}function jt(e,t,n,r,i,a,o,s,c,l=_){let u=Math.max(0,t+n-Date.now()),d=Ot(Math.ceil(u/1e3));e.font=`${l.fontSize} ${l.fontFamily}`;let f=e.measureText(d).width+Tt*2,p=wt,m=a.xToPixel(r,i,s),h=Math.max(f/2,m),g=h-f/2,v=c+1;e.save(),e.beginPath(),e.rect(0,c,s,wt+4),e.clip(),e.fillStyle=o.axisText,e.beginPath(),e.roundRect(g,v,f,p,Et),e.fill(),e.fillStyle=o.background,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(d,h,v+p/2),e.textBaseline=`alphabetic`,e.restore()}function Mt(e,t,n,r,i,s,c,l,u=2,d=g){if(e.fillStyle=r.axisText,e.font=`${d.fontSize} ${d.fontFamily}`,e.textAlign=`left`,l===void 0){let r=a(t,s),c=o(r.length>=2?r[1]-r[0]:t.max-t.min,u);for(let a of r){let r=n.yToPixel(a,t,s);e.fillText(a.toFixed(c),i+4,r+4)}return}let f=(t.max-t.min)/l;for(let r=0;r<=l;r++){let a=t.min+f*r,o=n.yToPixel(a,t,s),c=a.toFixed(u);e.fillText(c,i+4,o+4)}}function X(e,t){return`<svg viewBox="0 0 16 16" width="${t}" height="${t}" fill="none" xmlns="http://www.w3.org/2000/svg">${e}</svg>`}var Nt=`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 1.5h3l.5 1.8a5.1 5.1 0 0 1 1.24.72l1.76-.56 1.5 2.6-1.38 1.18a5.2 5.2 0 0 1 0 1.44l1.38 1.18-1.5 2.6-1.76-.56A5.1 5.1 0 0 1 10 12.7l-.5 1.8h-3l-.5-1.8a5.1 5.1 0 0 1-1.24-.72l-1.76.56-1.5-2.6L2.88 8.76a5.2 5.2 0 0 1 0-1.44L1.5 6.14l1.5-2.6 1.76.56A5.1 5.1 0 0 1 6 3.38Z" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/><circle cx="8" cy="8" r="2.2" stroke="currentColor" stroke-width="1.3"/></svg>`,Pt=Nt,Ft=`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 2.5a1.5 1.5 0 0 1 2.121 2.121l-8.5 8.5L2.5 13.5l.379-2.621 8.621-8.379Z" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>`,It=`<svg viewBox="0 0 16 16" width="10" height="10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 3l10 10M13 3L3 13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>`,Lt=`<svg viewBox="0 0 16 16" width="15" height="15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.5 6.5V1.5h5M6.5 6.5L1.5 1.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.5 9.5v5h-5M9.5 9.5l5 5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>`,Rt=`<svg viewBox="0 0 16 16" width="15" height="15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 1.5H1.5v5M1.5 1.5l5 5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.5 14.5H14.5v-5M14.5 14.5l-5-5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>`,zt=`<svg viewBox="0 0 16 16" width="15" height="15" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="3.5,5 4.5,13.5 11.5,13.5 12.5,5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><line x1="2" y1="5" x2="14" y2="5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/><path d="M6 5V3.5C6 3 6.5 2.5 7 2.5h2C9.5 2.5 10 3 10 3.5V5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>`,Bt={candlestick:`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
35
35
|
<line x1="3" y1="1.5" x2="3" y2="3.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
36
36
|
<rect x="1.5" y="3.5" width="3" height="5" fill="currentColor" rx="0.5"/>
|
|
37
37
|
<line x1="3" y1="8.5" x2="3" y2="11" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
<line x1="3" y1="2" x2="3" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
112
112
|
<line x1="8" y1="4" x2="8" y2="14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" opacity="0.65"/>
|
|
113
113
|
<line x1="13" y1="1" x2="13" y2="10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
114
|
-
</svg>`},
|
|
114
|
+
</svg>`},Vt={trend_lines:X(`<line x1="2" y1="14" x2="12" y2="4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
115
115
|
<polyline points="7,4 12,4 12,9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>`,18),fibonacci_gann:X(`<line x1="3" y1="3" x2="3" y2="13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
116
116
|
<line x1="3" y1="4" x2="13" y2="4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
117
117
|
<line x1="3" y1="8" x2="13" y2="8" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" opacity="0.7"/>
|
|
@@ -127,16 +127,16 @@
|
|
|
127
127
|
<line x1="9.5" y1="4.5" x2="11.5" y2="6.5" stroke="currentColor" stroke-width="1" stroke-linecap="round" opacity="0.5"/>`,18),advanced_tools:X(`<path d="M1 8 C3 4,5 4,7 8 C9 12,11 12,13 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" fill="none"/>
|
|
128
128
|
<circle cx="14.5" cy="5.5" r="1.5" stroke="currentColor" stroke-width="1.2"/>`,18),price_projections:X(`<line x1="2" y1="11" x2="8" y2="5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
129
129
|
<line x1="8" y1="5" x2="13.5" y2="5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-dasharray="2 1.5"/>
|
|
130
|
-
<polyline points="10.5,2 13.5,5 10.5,8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>`,18)},
|
|
130
|
+
<polyline points="10.5,2 13.5,5 10.5,8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>`,18)},Ht={undo:X(`<path d="M3 8a5 5 0 1 1 1.4 3.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" fill="none"/>
|
|
131
131
|
<polyline points="2,5 3,9 7,8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>`,16),redo:X(`<path d="M13 8a5 5 0 1 0-1.4 3.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" fill="none"/>
|
|
132
132
|
<polyline points="14,5 13,9 9,8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>`,16),delete_selected:X(`<line x1="4" y1="4" x2="12" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
133
133
|
<line x1="12" y1="4" x2="4" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>`,16),clear_all:X(`<polyline points="3.5,5 4.5,13.5 11.5,13.5 12.5,5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
134
134
|
<line x1="2" y1="5" x2="14" y2="5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
|
135
135
|
<path d="M6 5V3.5C6 3 6.5 2.5 7 2.5h2C9.5 2.5 10 3 10 3.5V5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>`,16),toggle_visibility:X(`<path d="M1.5 8C3 5 5.5 3.5 8 3.5S13 5 14.5 8C13 11 10.5 12.5 8 12.5S3 11 1.5 8z" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
|
136
136
|
<circle cx="8" cy="8" r="2" stroke="currentColor" stroke-width="1.4"/>`,16),toggle_lock:X(`<rect x="3.5" y="7.5" width="9" height="7" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
|
|
137
|
-
<path d="M5.5 7.5V5.5a2.5 2.5 0 0 1 5 0" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>`,16)},
|
|
137
|
+
<path d="M5.5 7.5V5.5a2.5 2.5 0 0 1 5 0" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>`,16)},Ut={toggle_visibility:X(`<path d="M1.5 8C3 5 5.5 3.5 8 3.5S13 5 14.5 8C13 11 10.5 12.5 8 12.5S3 11 1.5 8z" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" opacity="0.35"/>
|
|
138
138
|
<line x1="3" y1="3" x2="13" y2="13" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>`,16),toggle_lock:X(`<rect x="3.5" y="7.5" width="9" height="7" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
|
|
139
|
-
<path d="M5.5 7.5V5.5a2.5 2.5 0 0 1 5 0v2" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>`,16)},
|
|
139
|
+
<path d="M5.5 7.5V5.5a2.5 2.5 0 0 1 5 0v2" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>`,16)},Wt=Ht.toggle_visibility,Gt=Ut.toggle_visibility,Kt={trend_line:X(`<line x1="2" y1="14" x2="12" y2="4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
140
140
|
<polyline points="7,4 12,4 12,9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>`,14),trend_angle:X(`<line x1="3" y1="13" x2="13" y2="3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
141
141
|
<path d="M3 13 L9 13" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" opacity="0.6"/>
|
|
142
142
|
<path d="M3 13 A6 6 0 0 0 8.5 8.5" stroke="currentColor" stroke-width="1" fill="none" opacity="0.7"/>`,14),horizontal_line:X(`<line x1="2" y1="8" x2="14" y2="8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>`,14),vertical_line:X(`<line x1="8" y1="2" x2="8" y2="14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>`,14),cross_line:X(`<line x1="8" y1="2" x2="8" y2="14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -227,12 +227,12 @@
|
|
|
227
227
|
<line x1="3" y1="8" x2="13" y2="8" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" opacity="0.7"/>
|
|
228
228
|
<line x1="3" y1="12" x2="13" y2="12" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-dasharray="2 1.5" opacity="0.5"/>`,14),price_projection:X(`<line x1="2" y1="11" x2="8" y2="5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
229
229
|
<line x1="8" y1="5" x2="13.5" y2="5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-dasharray="2 1.5"/>
|
|
230
|
-
<polyline points="10.5,2.5 13.5,5 10.5,7.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>`,14)},
|
|
230
|
+
<polyline points="10.5,2.5 13.5,5 10.5,7.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>`,14)},qt=`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="1.5,12.5 5,9 7,11 14,4" stroke="#26a69a" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><polyline points="10,4 14,4 14,8" stroke="#26a69a" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><polyline points="1.5,3.5 5,7 7,5 14,12" stroke="#ef5350" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><polyline points="10,12 14,12 14,8" stroke="#ef5350" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,Jt=`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="1.5,12.5 5,9 7,11 14,4" stroke="#26a69a" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.3"/><polyline points="10,4 14,4 14,8" stroke="#26a69a" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.3"/><polyline points="1.5,3.5 5,7 7,5 14,12" stroke="#ef5350" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.3"/><polyline points="10,12 14,12 14,8" stroke="#ef5350" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.3"/><line x1="3" y1="3" x2="13" y2="13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>`,Yt=(e,t=16)=>`<svg viewBox="0 0 16 16" width="${t}" height="${t}" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 4L6 8L1 12Z" fill="${e}"/><path d="M6 4L11 8L6 12Z" fill="${e}"/><line x1="13.5" y1="3.5" x2="13.5" y2="12.5" stroke="${e}" stroke-width="2" stroke-linecap="round"/></svg>`,Xt=(e,t=16)=>`<svg viewBox="0 0 16 16" width="${t}" height="${t}" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 2A6 6 0 1 1 2 8" stroke="${e}" stroke-width="1.6" stroke-linecap="round"/><path d="M4 10L2 8L1 10" stroke="${e}" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>`,Zt={appearance:`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.4"/><path d="M8 1v1.5M8 13.5V15M1 8h1.5M13.5 8H15M3.05 3.05l1.06 1.06M11.89 11.89l1.06 1.06M3.05 12.95l1.06-1.06M11.89 4.11l1.06-1.06" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>`,tools:`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 14l4-4M10 2l4 4-7 7-4-4z" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><path d="M13 3l1 1" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>`,trading:`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 12l4-5 3 2 4-6" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><path d="M11 3h4v4" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>`},Qt=`<svg viewBox="0 0 12 12" width="12" height="12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1l10 10M11 1L1 11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>`,$t=`<svg viewBox="0 0 10 10" width="10" height="10" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="5" cy="5" r="4" fill="currentColor"/></svg>`,en=`<svg viewBox="0 0 12 12" width="10" height="10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.5 6l3.5 3.5 5.5-6" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>`,tn=`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="6.5" stroke="currentColor" stroke-width="1.4"/><line x1="8" y1="4.5" x2="8" y2="11.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/><line x1="4.5" y1="8" x2="11.5" y2="8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>`,nn=`<svg viewBox="0 0 10 10" width="10" height="10" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="2,7 5,3 8,7" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,rn=`<svg viewBox="0 0 10 10" width="10" height="10" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="2,3 5,7 8,3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,an=X(`<circle cx="4" cy="8" r="1.3" fill="currentColor"/><circle cx="8" cy="8" r="1.3" fill="currentColor"/><circle cx="12" cy="8" r="1.3" fill="currentColor"/>`,14),on=!1;function sn(){if(on)return;on=!0;let e=navigator.virtualKeyboard;if(e)try{e.overlaysContent=!0}catch(e){}}function cn(e,t){let n=window.visualViewport;if(!n)return()=>{};let r=()=>{if(e.style.display===`none`||!e.isConnected)return;let r=t(),i=e.getBoundingClientRect().height,a=n.offsetTop+n.height,o=r+i<=a-8;e.style.top=o?`${r}px`:`${Math.max(8,a-i-8)}px`};return n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function ln(e){let t=window.visualViewport;if(!t)return()=>{};let n=()=>{if(!e.isConnected||e.offsetParent===null)return;e.style.transform=``;let n=e.getBoundingClientRect(),r=t.offsetTop+t.height,i=n.bottom-(r-8);i>0&&(e.style.transform=`translateY(${-i}px)`)};return t.addEventListener(`resize`,n),t.addEventListener(`scroll`,n),()=>{t.removeEventListener(`resize`,n),t.removeEventListener(`scroll`,n)}}var un=[`1D`,`5D`,`1M`,`3M`,`6M`,`1Y`,`5Y`,`All`],dn=new Set([`VOL`,`VWAP`,`OBV`,`A/D`,`MFI`,`CMF`]);function fn(){if(document.getElementById(`finchart-flyout-scrollbar`))return;let e=document.createElement(`style`);e.id=`finchart-flyout-scrollbar`,e.textContent=`
|
|
231
231
|
.finchart-flyout::-webkit-scrollbar { width: 4px; }
|
|
232
232
|
.finchart-flyout::-webkit-scrollbar-track { background: transparent; }
|
|
233
233
|
.finchart-flyout::-webkit-scrollbar-thumb { background: rgba(120,130,150,0.35); border-radius: 4px; }
|
|
234
234
|
.finchart-flyout::-webkit-scrollbar-thumb:hover { background: rgba(120,130,150,0.6); }
|
|
235
235
|
.finchart-flyout-row:hover { background: var(--finchart-row-hover) !important; }
|
|
236
|
-
`,document.head.appendChild(e)}var fn=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,h,g,_,v,y=m,b=C.topBar,x=null){this.onSeriesChange=e,this.onTimeframeChange=t,this.onAddIndicator=n,this.onDurationChange=r,this.onSettingsClick=i,this.onFullscreenToggle=a,this.onDrawingToolsToggle=o,this.onTfcToggle=f,this.onDropdownChange=x,this.fullscreenBtn=null,this.settingsBtn=null,this.isFullscreen=!1,this.durationBtns=new Map,this.isMobileLayout=!1,this.drawingBtn=null,this.tfcBtn=null,this.tfcActive=!0,this.openDropdown=null,this.disposeFlyoutKbd=()=>{},this.indicatorOptions=[],this.activeIndicators=new Set,this.volHasData=!0,this.theme=v,this.cfg=y,this.labels=b,this.tfcActive=d,this.currentSeries=p,this.currentTf=h,this.activeDuration=g,this.durationMap=_,dn(),this.el=document.createElement(`div`),this.applyBarStyles(v),this.flyout=document.createElement(`div`),this.flyout.classList.add(`finchart-flyout`),this.applyFlyoutStyles(),document.body.appendChild(this.flyout),this.disposeFlyoutKbd=cn(this.flyout),this.leftGroup=document.createElement(`div`),Object.assign(this.leftGroup.style,{display:`flex`,alignItems:`center`,gap:`4px`,flex:`1`,minWidth:`0`,overflow:`hidden`}),s&&(this.drawingBtn=this.makeDrawingBtn(v),this.leftGroup.appendChild(this.drawingBtn)),this.seriesBtn=this.makeSeriesBtn(p,v),this.seriesBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleDropdown(`series`,this.seriesBtn)}),this.addBtnHover(this.seriesBtn),this.tfBtn=this.makeDropBtn(h,v,!1),this.tfBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleDropdown(`timeframe`,this.tfBtn)}),this.addBtnHover(this.tfBtn),this.indBtn=this.makeDropBtn(this.labels.indicatorsBtn,v,!1),this.indBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleDropdown(`indicators`,this.indBtn)}),this.addBtnHover(this.indBtn),this.leftGroup.append(this.seriesBtn,this.tfBtn,this.indBtn),this.rightGroup=document.createElement(`div`),Object.assign(this.rightGroup.style,{display:`flex`,alignItems:`center`,gap:`2px`,flexShrink:`0`}),this.durationDropBtn=this.makeDropBtn(g==null?ln[0]:g,v,!1),this.durationDropBtn.style.display=`none`,this.durationSep=document.createElement(`div`),this.durationSep.style.display=`none`,l&&(this.fullscreenBtn=document.createElement(`button`),this.fullscreenBtn.title=this.labels.toggleFullscreenTitle,this.fullscreenBtn.innerHTML=It,this.applyIconBtnStyles(this.fullscreenBtn,v,!1),this.fullscreenBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.onFullscreenToggle()}),this.addBtnHover(this.fullscreenBtn),this.rightGroup.appendChild(this.fullscreenBtn)),c&&(this.settingsBtn=document.createElement(`button`),this.settingsBtn.title=this.labels.settingsTitle,this.settingsBtn.innerHTML=Mt,this.applyIconBtnStyles(this.settingsBtn,v,!1),this.settingsBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.onSettingsClick()}),this.addBtnHover(this.settingsBtn),this.rightGroup.appendChild(this.settingsBtn)),u&&(this.tfcBtn=document.createElement(`button`),this.tfcBtn.title=this.labels.tfcToggleTitle,this.tfcBtn.innerHTML=this.tfcActive?Kt:qt,this.applyIconBtnStyles(this.tfcBtn,v,this.tfcActive),this.tfcBtn.addEventListener(`click`,e=>{var t;e.stopPropagation(),this.tfcActive=!this.tfcActive,this.tfcBtn.innerHTML=this.tfcActive?Kt:qt,this.applyIconBtnStyles(this.tfcBtn,this.theme,this.tfcActive),(t=this.onTfcToggle)==null||t.call(this,this.tfcActive)}),this.addBtnHover(this.tfcBtn),this.rightGroup.appendChild(this.tfcBtn)),this.el.append(this.leftGroup,this.rightGroup),this.docClickHandler=e=>{!this.el.contains(e.target)&&!this.flyout.contains(e.target)&&this.closeDropdown()},document.addEventListener(`click`,this.docClickHandler,!0)}destroy(){this.disposeFlyoutKbd(),this.flyout.remove(),document.removeEventListener(`click`,this.docClickHandler,!0)}reparentFlyout(e){this.flyout.parentElement!==e&&e.appendChild(this.flyout)}setFullscreen(e){this.isFullscreen=e,this.fullscreenBtn&&(this.fullscreenBtn.innerHTML=e?Lt:It,this.fullscreenBtn.title=e?this.labels.exitFullscreenTitle:this.labels.toggleFullscreenTitle,this.applyIconBtnStyles(this.fullscreenBtn,this.theme,e),this.isMobileLayout&&this.resizeSvg(this.fullscreenBtn,this.getSvgSize(this.fullscreenBtn)+2))}setDrawingsBtnActive(e){this.drawingBtn&&this.applyIconBtnStyles(this.drawingBtn,this.theme,e)}setTfcActive(e){this.tfcBtn&&(this.tfcActive=e,this.tfcBtn.innerHTML=e?Kt:qt,this.applyIconBtnStyles(this.tfcBtn,this.theme,e),this.isMobileLayout&&this.resizeSvg(this.tfcBtn,this.getSvgSize(this.tfcBtn)+2))}setTheme(e){this.theme=e,this.closeDropdown(),this.applyBarStyles(e),this.applyFlyoutStyles(),this.drawingBtn&&this.applyIconBtnStyles(this.drawingBtn,e,!1),this.fullscreenBtn&&this.applyIconBtnStyles(this.fullscreenBtn,e,this.isFullscreen),this.settingsBtn&&this.applyIconBtnStyles(this.settingsBtn,e,!1),this.tfcBtn&&this.applyIconBtnStyles(this.tfcBtn,e,this.tfcActive),this.applySeriesBtnStyles(this.seriesBtn,e,!1),this.applyDropBtnStyles(this.tfBtn,e,!1),this.applyDropBtnStyles(this.indBtn,e,!1);for(let[t,n]of this.durationBtns)this.applyDurationBtnStyles(n,e,t===this.activeDuration);this.durationSep.style.background=e.axisBorder,this.applyDropBtnStyles(this.durationDropBtn,e,!1)}setSeries(e){this.currentSeries=e,this.updateSeriesBtnContent(this.seriesBtn,e)}setTimeframe(e){this.currentTf=e,this.tfBtn.textContent=e}setActiveDuration(e){if(this.activeDuration!==(e==null?null:e)){if(this.activeDuration){let e=this.durationBtns.get(this.activeDuration);e&&this.applyDurationBtnStyles(e,this.theme,!1)}if(this.activeDuration=e==null?null:e,e){let t=this.durationBtns.get(e);t&&this.applyDurationBtnStyles(t,this.theme,!0),this.durationDropBtn.textContent=e}}}setMobileLayout(e){if(this.isMobileLayout===e)return;this.isMobileLayout=e;let t=e?`none`:``;for(let e of this.durationBtns.values())e.style.display=t;this.durationSep.style.display=t,this.durationDropBtn.style.display=e?``:`none`;let n=e?this.cfg.mobileIconBtnSize:this.cfg.iconBtnSize;for(let e of[this.fullscreenBtn,this.settingsBtn,this.drawingBtn,this.tfcBtn])e&&(e.style.width=n,e.style.height=n);let r=e?2:-2;if(this.fullscreenBtn&&this.resizeSvg(this.fullscreenBtn,this.getSvgSize(this.fullscreenBtn)+r),this.settingsBtn&&this.resizeSvg(this.settingsBtn,this.getSvgSize(this.settingsBtn)+r),this.tfcBtn&&this.resizeSvg(this.tfcBtn,this.getSvgSize(this.tfcBtn)+r),this.drawingBtn){let t=parseInt(e?this.cfg.mobileDrawBtnIconSize:this.cfg.drawBtnIconFontSize,10);this.resizeSvg(this.drawingBtn,t)}}setIndicatorOptions(e){this.indicatorOptions=e}setIndicatorOptionActive(e,t){t?this.activeIndicators.add(e):this.activeIndicators.delete(e),this.updateIndBtnLabel()}setVolumeControl(e,t){this.volHasData=t,t&&e?this.activeIndicators.add(`VOL`):this.activeIndicators.delete(`VOL`),this.updateIndBtnLabel()}makeDrawingBtn(e){let t=document.createElement(`button`);return t.title=`Drawing Tools`,t.innerHTML=Pt,this.applyIconBtnStyles(t,e,!1),t.addEventListener(`click`,e=>{var t;e.stopPropagation(),(t=this.onDrawingToolsToggle)==null||t.call(this)}),this.addBtnHover(t),t}makeSeriesBtn(e,t){let n=document.createElement(`button`);return this.applySeriesBtnStyles(n,t,!1),this.updateSeriesBtnContent(n,e),n}updateSeriesBtnContent(e,t){var n;e.title=(n=this.labels.series[t])==null?t:n,e.innerHTML=zt[t]}applySeriesBtnStyles(e,t,n){e.dataset.active=String(n),Object.assign(e.style,{background:n?t.ui.accentBg:`transparent`,color:n?t.ui.accentText:t.topBar.btnColor,border:`1px solid ${n?t.ui.accent:t.axisBorder}`,borderRadius:`5px`,padding:`3px 7px`,cursor:`pointer`,outline:`none`,display:`flex`,alignItems:`center`,gap:`4px`,flexShrink:`0`,height:`24px`,transition:`border-color 0.12s, background 0.12s`})}applyFlyoutStyles(){Object.assign(this.flyout.style,{position:`fixed`,zIndex:`9999`,display:`none`,background:this.theme.tooltip.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`8px`,padding:`4px 0`,minWidth:`168px`,maxHeight:`340px`,overflowY:`auto`,overflowX:`hidden`,boxShadow:`0 8px 24px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.3)`,fontFamily:this.cfg.flyoutRowFontFamily,fontSize:this.cfg.flyoutRowFontSize,scrollbarWidth:`thin`,scrollbarColor:`rgba(120,130,150,0.35) transparent`})}toggleDropdown(e,t){var n;if(this.openDropdown===e){this.closeDropdown();return}let r=this.openDropdown!==null;this.openDropdown=e,this.applySeriesBtnStyles(this.seriesBtn,this.theme,e===`series`),this.applyDropBtnStyles(this.tfBtn,this.theme,e===`timeframe`),this.applyDropBtnStyles(this.indBtn,this.theme,e===`indicators`),this.applyDropBtnStyles(this.durationDropBtn,this.theme,e===`duration`),this.buildDropdownContent(e);let i=t.getBoundingClientRect();Object.assign(this.flyout.style,{display:`block`,left:`${i.left}px`,top:`${i.bottom+6}px`}),requestAnimationFrame(()=>{let e=this.flyout.getBoundingClientRect();e.right>window.innerWidth-8&&(this.flyout.style.left=`${window.innerWidth-e.width-8}px`),e.bottom>window.innerHeight-8&&(this.flyout.style.top=`${i.top-e.height-6}px`)}),r||(n=this.onDropdownChange)==null||n.call(this)}buildDropdownContent(e){if(this.flyout.innerHTML=``,this.flyout.style.minWidth=e===`series`?`152px`:e===`timeframe`?`160px`:e===`duration`?`120px`:`180px`,e===`series`){let e=[{value:`candlestick`,label:this.labels.series.candlestick},{value:`hollow`,label:this.labels.series.hollow},{value:`ohlc`,label:this.labels.series.ohlc},{value:`line`,label:this.labels.series.line},{value:`area`,label:this.labels.series.area},{value:`heikinashi`,label:this.labels.series.heikinashi},{value:`volumecandles`,label:this.labels.series.volumecandles},{value:`linemarkers`,label:this.labels.series.linemarkers},{value:`step`,label:this.labels.series.step},{value:`hlcarea`,label:this.labels.series.hlcarea},{value:`baseline`,label:this.labels.series.baseline},{value:`columns`,label:this.labels.series.columns},{value:`highlow`,label:this.labels.series.highlow}];for(let t of e){let e=this.makeRow(t.label,t.value===this.currentSeries,!1,zt[t.value]);e.addEventListener(`click`,()=>{this.currentSeries=t.value,this.updateSeriesBtnContent(this.seriesBtn,t.value),this.onSeriesChange(t.value),this.closeDropdown()}),this.flyout.appendChild(e)}}else if(e===`timeframe`){let e=[`1m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`8h`],r=[`1D`,`1W`,`1M`];this.flyout.appendChild(this.makeCategoryHeader(`Intraday`));for(let n of e){var t;let e=(t=this.labels.timeframes[n])==null?n:t,r=this.makeRow(e,n===this.currentTf,!1);r.addEventListener(`click`,()=>{this.currentTf=n,this.tfBtn.textContent=e,this.onTimeframeChange(n),this.closeDropdown()}),this.flyout.appendChild(r)}this.flyout.appendChild(this.makeCategoryHeader(`Daily +`));for(let e of r){var n;let t=(n=this.labels.timeframes[e])==null?e:n,r=this.makeRow(t,e===this.currentTf,!1);r.addEventListener(`click`,()=>{this.currentTf=e,this.tfBtn.textContent=t,this.onTimeframeChange(e),this.closeDropdown()}),this.flyout.appendChild(r)}}else if(e===`duration`)for(let e of ln){let t=this.makeRow(e,e===this.activeDuration,!1);t.addEventListener(`click`,()=>{this.setActiveDuration(e),this.onDurationChange(e,this.durationMap[e]),this.closeDropdown()}),this.flyout.appendChild(t)}else{let e=document.createElement(`div`);Object.assign(e.style,{position:`sticky`,top:`0`,zIndex:`1`,padding:`6px 8px`,background:this.theme.tooltip.background,borderBottom:`1px solid ${this.theme.axisBorder}`});let t=document.createElement(`input`);t.type=`text`,t.placeholder=`Search indicators…`,Object.assign(t.style,{width:`100%`,boxSizing:`border-box`,padding:`5px 8px`,background:this.theme.background,color:this.theme.tooltip.text,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`4px`,fontSize:`16px`,outline:`none`}),e.appendChild(t),this.flyout.appendChild(e);let n=document.createElement(`div`);this.flyout.appendChild(n);let i=new Map;for(let e of this.indicatorOptions){var r;let t=(r=e.category)==null?``:r;i.has(t)||i.set(t,[]),i.get(t).push(e)}let a=e=>{n.innerHTML=``;let r=e.trim().toLowerCase();if(r)for(let e of this.indicatorOptions){if(!e.label.toLowerCase().includes(r)&&!e.value.toLowerCase().includes(r))continue;let i=this.activeIndicators.has(e.value),o=un.has(e.value)&&!this.volHasData,s=this.makeRow(e.label,i,o);o||s.addEventListener(`click`,()=>{this.onAddIndicator(e.value),a(t.value)}),n.appendChild(s)}else for(let[e,r]of i){e&&n.appendChild(this.makeCategoryHeader(e));for(let e of r){let r=this.activeIndicators.has(e.value),i=un.has(e.value)&&!this.volHasData,o=this.makeRow(e.label,r,i);i||o.addEventListener(`click`,()=>{this.onAddIndicator(e.value),a(t.value)}),n.appendChild(o)}}};a(``),t.addEventListener(`input`,()=>a(t.value)),requestAnimationFrame(()=>t.focus({preventScroll:!0}))}}makeCategoryHeader(e){let t=document.createElement(`div`);return Object.assign(t.style,{padding:`6px 12px 4px`,fontSize:this.cfg.flyoutCategoryFontSize,fontWeight:`600`,letterSpacing:this.cfg.flyoutCategoryLetterSpacing,color:this.theme.topBar.flyoutCategoryColor,textTransform:`uppercase`,opacity:`0.55`,marginTop:`2px`}),t.textContent=e,t}makeRow(e,t,n,r){let i=document.createElement(`button`),a=this.theme.ui.accentBg,o=this.theme.ui.accentBg;if(Object.assign(i.style,{width:`100%`,padding:`7px 12px`,background:t?o:`transparent`,border:`none`,borderLeft:t?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,color:n?this.theme.ui.disabledText:t?this.theme.ui.accentText:this.theme.topBar.flyoutRowColor,fontSize:this.cfg.flyoutRowFontSize,fontFamily:this.cfg.flyoutRowFontFamily,textAlign:`left`,cursor:n?`not-allowed`:`pointer`,display:`flex`,alignItems:`center`,gap:`8px`,boxSizing:`border-box`,opacity:n?`0.45`:`1`,transition:`background 0.1s`}),!n&&!t&&(i.addEventListener(`mouseenter`,()=>{i.style.background=a}),i.addEventListener(`mouseleave`,()=>{i.style.background=`transparent`})),r){let e=document.createElement(`span`);Object.assign(e.style,{display:`flex`,alignItems:`center`,flexShrink:`0`,opacity:t?`1`:`0.7`}),e.innerHTML=r;let n=e.querySelector(`svg`);n&&(n.setAttribute(`width`,`13`),n.setAttribute(`height`,`13`)),i.appendChild(e)}let s=document.createElement(`span`);if(s.style.flex=`1`,s.textContent=e,i.appendChild(s),t){let e=document.createElement(`span`);Object.assign(e.style,{color:this.theme.ui.accent,fontSize:this.cfg.flyoutCheckFontSize,flexShrink:`0`}),e.innerHTML=$t,i.appendChild(e)}return i}closeDropdown(){var e;let t=this.openDropdown!==null;this.flyout.style.display=`none`,this.openDropdown=null,this.applySeriesBtnStyles(this.seriesBtn,this.theme,!1),this.applyDropBtnStyles(this.tfBtn,this.theme,!1),this.applyDropBtnStyles(this.indBtn,this.theme,!1),this.applyDropBtnStyles(this.durationDropBtn,this.theme,!1),t&&((e=this.onDropdownChange)==null||e.call(this))}get hasOpenDropdown(){return this.openDropdown!==null}updateIndBtnLabel(){let e=this.activeIndicators.size;this.indBtn.textContent=e>0?this.labels.indicatorsBtnActive.replace(`{count}`,String(e)):this.labels.indicatorsBtn}addBtnHover(e){e.addEventListener(`mouseenter`,()=>{e.dataset.active!==`true`&&(e.style.background=this.theme.ui.accentBg)}),e.addEventListener(`mouseleave`,()=>{e.dataset.active!==`true`&&(e.style.background=`transparent`)})}applyBarStyles(e){Object.assign(this.el.style,{display:`flex`,alignItems:`center`,gap:`8px`,height:this.cfg.height,padding:`0 10px`,background:e.background,borderBottom:`1px solid ${e.axisBorder}`,boxSizing:`border-box`,flexShrink:`0`})}makeDropBtn(e,t,n){let r=document.createElement(`button`);return r.textContent=e,this.applyDropBtnStyles(r,t,n),r}applyDropBtnStyles(e,t,n){e.dataset.active=String(n),Object.assign(e.style,{background:n?t.ui.accentBg:`transparent`,color:n?t.ui.accentText:t.topBar.btnColor,border:`1px solid ${n?t.ui.accent:t.axisBorder}`,borderRadius:`5px`,padding:`3px 8px`,height:`24px`,fontSize:this.cfg.dropBtnFontSize,fontFamily:this.cfg.dropBtnFontFamily,cursor:`pointer`,outline:`none`,whiteSpace:`nowrap`,transition:`border-color 0.12s, background 0.12s`})}applyDurationBtnStyles(e,t,n){e.dataset.active=String(n),Object.assign(e.style,{background:n?t.bottomBar.activeBtnBg:`transparent`,color:n?t.bottomBar.activeBtnText:t.bottomBar.btnColor,border:`1px solid ${n?t.bottomBar.activeBtnBorder:`transparent`}`,borderRadius:`4px`,padding:`2px 7px`,fontSize:this.cfg.dropBtnFontSize,fontFamily:this.cfg.dropBtnFontFamily,cursor:`pointer`,outline:`none`,transition:`background 0.15s, color 0.15s`,whiteSpace:`nowrap`})}applyIconBtnStyles(e,t,n){e.dataset.active=String(n);let r=this.isMobileLayout?this.cfg.mobileIconBtnSize:this.cfg.iconBtnSize;Object.assign(e.style,{background:n?t.ui.accentBg:`transparent`,color:n?t.ui.accentText:t.topBar.btnColor,border:`1px solid ${n?t.ui.accent:t.axisBorder}`,borderRadius:`5px`,width:r,height:r,cursor:`pointer`,outline:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0`,flexShrink:`0`,transition:`border-color 0.12s, background 0.12s`})}resizeSvg(e,t){if(!e)return;let n=e.querySelector(`svg`);n&&(n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)))}getSvgSize(e){var t;if(!e)return 0;let n=e.querySelector(`svg`);return n?parseInt((t=n.getAttribute(`width`))==null?`0`:t,10):0}},pn={"1D":`5m`,"5D":`15m`,"1M":`30m`,"3M":`30m`,"6M":`1D`,"1Y":`1D`,"5Y":`1W`,All:`1M`},mn=[`1D`,`5D`,`1M`,`3M`,`6M`,`1Y`,`5Y`,`All`],hn=class{constructor(e,t,n,r,i=h,a=C.bottomBar){this.onDurationChange=e,this.buttons=new Map,this.activeDuration=t,this.theme=n,this.cfg=i,this.labels=a,this.map={...pn,...r},this.el=document.createElement(`div`),this.applyBarStyles(n);for(let e of mn){var o;let r=document.createElement(`button`);r.textContent=(o=this.labels.durations[e])==null?e:o,this.applyButtonStyles(r,n,e===t),r.addEventListener(`click`,()=>{this.setActive(e),this.onDurationChange(e,this.map[e])}),this.buttons.set(e,r),this.el.appendChild(r)}}setTheme(e){this.theme=e,this.applyBarStyles(e);for(let[t,n]of this.buttons)this.applyButtonStyles(n,e,this.activeDuration!==null&&t===this.activeDuration)}setActive(e){if(this.activeDuration!==(e==null?null:e)){if(this.activeDuration){let e=this.buttons.get(this.activeDuration);e&&this.applyButtonStyles(e,this.theme,!1)}if(this.activeDuration=e==null?null:e,e){let t=this.buttons.get(e);t&&this.applyButtonStyles(t,this.theme,!0)}}}applyBarStyles(e){Object.assign(this.el.style,{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,gap:`2px`,height:this.cfg.height,padding:`0 10px`,background:e.background,borderTop:`1px solid ${e.axisBorder}`,boxSizing:`border-box`,flexShrink:`0`})}applyButtonStyles(e,t,n){Object.assign(e.style,{background:n?t.bottomBar.activeBtnBg:`transparent`,color:n?t.bottomBar.activeBtnText:t.bottomBar.btnColor,border:`1px solid ${n?t.bottomBar.activeBtnBorder:`transparent`}`,borderRadius:`3px`,padding:`2px 7px`,fontSize:this.cfg.btnFontSize,fontFamily:this.cfg.btnFontFamily,cursor:`pointer`,outline:`none`,transition:`background 0.15s`})}},gn={horizontal_line:`horizontalLine`,vertical_line:`verticalLine`,trend_line:`trendLine`,trend_angle:`trendAngle`,cross_line:`crossLine`,parallel_channel:`parallelChannel`,disjoint_channel:`disjointChannel`,flat_channel:`flatChannel`,fib_retracement:`fibRetracement`,fib_extension:`fibExtension`,fib_channel:`fibChannel`,fib_timezone:`fibTimezone`,fib_circles:`fibCircles`,fib_spiral:`fibSpiral`,fib_fan:`fibFan`,gann_fan:`gannFan`,gann_square:`gannSquare`,gann_box:`gannBox`,rectangle:`rectangle`,rotated_rectangle:`rotatedRectangle`,ellipse:`ellipse`,triangle:`triangle`,circle:`circle`,arc:`arc`,polyline:`polyline`,path:`path`,price_range:`priceRange`,date_range:`dateRange`,date_price_range:`datePriceRange`,ruler:`ruler`,pitchfork:`pitchfork`,schiff_pitchfork:`schiffPitchfork`,modified_schiff:`modifiedSchiff`,inside_pitchfork:`insidePitchfork`,fixed_range_vp:`fixedRangeVP`,anchored_vp:`anchoredVP`,volume_profile:`volumeProfile`,regression_trend:`regressionTrend`,text:`text`,callout:`callout`,price_label:`priceLabel`,arrow_marker:`arrowMarker`,flag:`flag`,price_note:`priceNote`,anchored_note:`anchoredNote`,arrow_up:`arrowUp`,arrow_down:`arrowDown`,head_shoulders:`headShoulders`,triangle_pattern:`trianglePattern`,three_drives:`threeDrives`,abcd_pattern:`abcdPattern`,cypher_pattern:`cypherPattern`,butterfly_pattern:`butterflyPattern`,bat_pattern:`batPattern`,gartley_pattern:`gartleyPattern`,crab_pattern:`crabPattern`,shark_pattern:`sharkPattern`,elliott_impulse:`elliottImpulse`,elliott_corrective:`elliottCorrective`,elliott_triangle:`elliottTriangle`,elliott_combination:`elliottCombination`,elliott_wxy:`elliottWxy`,brush:`brush`,highlighter:`highlighter`,ghost_feed:`ghostFeed`,projection:`projection`,sine_line:`sineLine`,cyclic_lines:`cyclicLines`,time_cycles:`timeCycles`,fib_projection:`fibProjection`,price_projection:`priceProjection`},_n=[{id:`trend_lines`,name:`Trend Lines & Channels`,icon:`↗`,tools:[{id:`trend_line`,name:`Trend Line`,icon:`↗`,shortcut:`Alt+T`},{id:`trend_angle`,name:`Trend Angle`,icon:`∠`},{id:`horizontal_line`,name:`Horizontal Line`,icon:`—`,shortcut:`Alt+H`},{id:`vertical_line`,name:`Vertical Line`,icon:`⏐`,shortcut:`Alt+V`},{id:`cross_line`,name:`Cross Line`,icon:`✚`},{id:`parallel_channel`,name:`Parallel Channel`,icon:`⫿`},{id:`disjoint_channel`,name:`Disjoint Channel`,icon:`≠`},{id:`flat_channel`,name:`Flat Top/Bottom Channel`,icon:`⊓`}]},{id:`fibonacci_gann`,name:`Fibonacci & Gann Tools`,icon:`φ`,tools:[{id:`fib_retracement`,name:`Fibonacci Retracement`,icon:`φ`,shortcut:`Alt+F`},{id:`fib_extension`,name:`Fibonacci Extension`,icon:`φ`},{id:`fib_channel`,name:`Fibonacci Channel`,icon:`φ`},{id:`fib_timezone`,name:`Fibonacci Timezone`,icon:`φ`},{id:`fib_circles`,name:`Fibonacci Circles`,icon:`⊙`},{id:`fib_spiral`,name:`Fibonacci Spiral`,icon:`@`},{id:`fib_fan`,name:`Fibonacci Speed Resistance Fan`,icon:`⌇`},{id:`gann_fan`,name:`Gann Fan`,icon:`⌇`},{id:`gann_square`,name:`Gann Square`,icon:`⊞`},{id:`gann_box`,name:`Gann Box`,icon:`⊡`}]},{id:`geometric_shapes`,name:`Geometric Shapes`,icon:`▭`,tools:[{id:`rectangle`,name:`Rectangle`,icon:`▭`},{id:`rotated_rectangle`,name:`Rotated Rectangle`,icon:`◇`},{id:`ellipse`,name:`Ellipse`,icon:`⬭`},{id:`triangle`,name:`Triangle`,icon:`△`},{id:`circle`,name:`Circle`,icon:`○`},{id:`arc`,name:`Arc`,icon:`⌒`},{id:`polyline`,name:`Polyline`,icon:`⚡`},{id:`path`,name:`Path`,icon:`〰`}]},{id:`measurement_tools`,name:`Measurement Tools`,icon:`⇕`,tools:[{id:`price_range`,name:`Price Range`,icon:`⇕`},{id:`date_range`,name:`Date Range`,icon:`⇔`},{id:`date_price_range`,name:`Date & Price Range`,icon:`⊞`},{id:`ruler`,name:`Ruler`,icon:`⊢`}]},{id:`pitchfork_tools`,name:`Pitchfork Tools`,icon:`⑁`,tools:[{id:`pitchfork`,name:`Pitchfork`,icon:`⑁`},{id:`schiff_pitchfork`,name:`Schiff Pitchfork`,icon:`⑁`},{id:`modified_schiff`,name:`Modified Schiff Pitchfork`,icon:`⑁`},{id:`inside_pitchfork`,name:`Inside Pitchfork`,icon:`⑁`}]},{id:`volume_statistics`,name:`Volume & Statistical Tools`,icon:`▤`,tools:[{id:`fixed_range_vp`,name:`Fixed Range Volume Profile`,icon:`▤`},{id:`anchored_vp`,name:`Anchored Volume Profile`,icon:`▤`},{id:`volume_profile`,name:`Volume Profile`,icon:`▤`},{id:`regression_trend`,name:`Regression Trend`,icon:`↗`}]},{id:`annotation_tools`,name:`Annotation Tools`,icon:`A`,tools:[{id:`text`,name:`Text`,icon:`A`},{id:`callout`,name:`Callout`,icon:`⬕`},{id:`price_label`,name:`Price Label`,icon:`$`},{id:`arrow_marker`,name:`Arrow Marker`,icon:`→`},{id:`flag`,name:`Flag`,icon:`⚑`},{id:`price_note`,name:`Price Note`,icon:`≡`},{id:`anchored_note`,name:`Anchored Note`,icon:`⊕`},{id:`arrow_up`,name:`Arrow Up`,icon:`↑`},{id:`arrow_down`,name:`Arrow Down`,icon:`↓`}]},{id:`pattern_recognition`,name:`Pattern Recognition`,icon:`◬`,tools:[{id:`head_shoulders`,name:`Head & Shoulders`,icon:`⌢`},{id:`triangle_pattern`,name:`Triangle Pattern`,icon:`◬`},{id:`three_drives`,name:`3 Drives Pattern`,icon:`⋎`},{id:`abcd_pattern`,name:`ABCD Pattern`,icon:`⊿`},{id:`cypher_pattern`,name:`Cypher Pattern`,icon:`C`},{id:`butterfly_pattern`,name:`Butterfly Pattern`,icon:`⋈`},{id:`bat_pattern`,name:`Bat Pattern`,icon:`⌓`},{id:`gartley_pattern`,name:`Gartley Pattern`,icon:`G`},{id:`crab_pattern`,name:`Crab Pattern`,icon:`⊓`},{id:`shark_pattern`,name:`Shark Pattern`,icon:`⊳`}]},{id:`elliott_wave`,name:`Elliott Wave Tools`,icon:`∿`,tools:[{id:`elliott_impulse`,name:`Elliott Impulse (12345)`,icon:`∿`},{id:`elliott_corrective`,name:`Elliott Corrective (ABC)`,icon:`∿`},{id:`elliott_triangle`,name:`Elliott Wave Triangle`,icon:`△`},{id:`elliott_combination`,name:`Elliott Wave Combination`,icon:`∿`},{id:`elliott_wxy`,name:`Elliott Double Three (WXY)`,icon:`∿`}]},{id:`brush_highlighter`,name:`Brush & Highlighter`,icon:`∫`,tools:[{id:`brush`,name:`Brush`,icon:`∫`},{id:`highlighter`,name:`Highlighter`,icon:`▬`}]},{id:`advanced_tools`,name:`Advanced Tools`,icon:`⊛`,tools:[{id:`ghost_feed`,name:`Ghost Feed`,icon:`◑`},{id:`projection`,name:`Projection`,icon:`→`},{id:`sine_line`,name:`Sine Line`,icon:`∿`},{id:`cyclic_lines`,name:`Cyclic Lines`,icon:`⟳`},{id:`time_cycles`,name:`Time Cycles`,icon:`⊙`}]},{id:`price_projections`,name:`Price Projection Tools`,icon:`⊿`,tools:[{id:`fib_projection`,name:`Fibonacci Projection`,icon:`φ`},{id:`price_projection`,name:`Price Projection`,icon:`⊿`}]}],vn=[{id:`undo`,icon:`↶`,title:`Undo (Ctrl+Z)`},{id:`redo`,icon:`↷`,title:`Redo (Ctrl+Y)`},{id:`delete_selected`,icon:`✕`,title:`Delete Selected (Del)`},{id:`clear_all`,icon:`⊡`,title:`Clear All`},{id:`toggle_visibility`,icon:`◌`,title:`Hide All`},{id:`toggle_lock`,icon:`⊠`,title:`Lock All`}],yn=class{constructor(e,t,n,r,i=p,a=C.drawingToolbar){this.onToolChange=e,this.onAction=t,this.onMobileClose=n,this.activeTool=null,this.openCategoryId=null,this.openActionsMenu=!1,this.catButtons=new Map,this.drawingsHidden=!1,this.drawingsLocked=!1,this.mobileMode=!1,this.settingsVisible=!0,this.theme=r,this.cfg=i,this.labels=a,this.el=document.createElement(`div`),this.flyout=document.createElement(`div`),this.applyBarStyles(),this.applyWidth(),this.buildToolbar(),this.buildFlyout(),document.body.appendChild(this.flyout),this.docClickHandler=e=>{!this.el.contains(e.target)&&!this.flyout.contains(e.target)&&this.closeFlyout()},document.addEventListener(`click`,this.docClickHandler,!0)}setTheme(e){this.theme=e,this.closeFlyout(),this.applyBarStyles(),this.applyWidth(),this.buildFlyout(),this.applyScrollBtnStyles(this.scrollUpBtn,`up`),this.applyScrollBtnStyles(this.scrollDownBtn,`down`),this.topSection.innerHTML=``,this.topSection.appendChild(this.buildMobileActionsBtn());for(let[e,n]of this.catButtons){var t;let r=this.activeTool!==null&&((t=_n.find(t=>t.id===e))==null?void 0:t.tools.some(e=>gn[e.id]===this.activeTool))===!0;this.applyCatBtnStyles(n,r)}}setActiveTool(e){if(this.activeTool!==null){let e=_n.find(e=>e.tools.some(e=>gn[e.id]===this.activeTool));e&&this.applyCatBtnStyles(this.catButtons.get(e.id),!1)}if(this.activeTool=e,e!==null){let t=_n.find(t=>t.tools.some(t=>gn[t.id]===e));t&&this.applyCatBtnStyles(this.catButtons.get(t.id),!0)}}setVisible(e){this.settingsVisible=e,this.applyWidth()}setMobileMode(e){if(this.mobileMode===e)return;this.mobileMode=e,this.closeFlyout(),this.topSection.innerHTML=``,this.topSection.appendChild(this.buildMobileActionsBtn()),this.catButtons.clear();let t=this.makeGrid();if(this.populateCategoryGrid(t),this.toolsGrid.replaceWith(t),this.toolsGrid=t,this.activeTool!==null){let e=_n.find(e=>e.tools.some(e=>gn[e.id]===this.activeTool));if(e){let t=this.catButtons.get(e.id);t&&this.applyCatBtnStyles(t,!0)}}e?(Object.assign(this.el.style,{position:`absolute`,left:`0`,top:`0`,height:`100%`,zIndex:`50`}),this.settingsVisible=!1):(Object.assign(this.el.style,{position:``,left:``,top:``,height:``,zIndex:``}),this.settingsVisible=!0),this.applyBarStyles(),this.applyWidth(),requestAnimationFrame(()=>this.updateScrollIndicators())}reparentFlyout(e){this.flyout.parentElement!==e&&e.appendChild(this.flyout)}destroy(){this.flyout.remove(),document.removeEventListener(`click`,this.docClickHandler,!0)}get barWidth(){return this.cfg.barPadding*2+this.cfg.iconBtnSize}applyBarStyles(){Object.assign(this.el.style,{display:`flex`,flexDirection:`column`,flexShrink:`0`,position:`relative`,height:`100%`,background:this.theme.background,borderRight:`1px solid ${this.theme.axisBorder}`,boxSizing:`border-box`,userSelect:`none`,fontFamily:this.cfg.flyoutLabelFontFamily,overflow:`hidden`,transition:`width 0.2s ease`})}applyWidth(){this.settingsVisible?this.el.style.width=`${this.barWidth}px`:this.el.style.width=`0`}buildToolbar(){this.topSection=document.createElement(`div`),Object.assign(this.topSection.style,{borderBottom:`1px solid ${this.theme.axisBorder}`,padding:`10px ${this.cfg.barPadding}px 10px`,boxSizing:`border-box`,flexShrink:`0`}),this.topSection.appendChild(this.buildMobileActionsBtn()),this.el.appendChild(this.topSection),this.scrollUpBtn=document.createElement(`button`),this.applyScrollBtnStyles(this.scrollUpBtn,`up`),this.scrollUpBtn.addEventListener(`click`,()=>{this.toolsArea.scrollBy({top:-(this.cfg.iconBtnSize+this.cfg.btnGap)*3,behavior:`smooth`})}),this.el.appendChild(this.scrollUpBtn),this.toolsArea=document.createElement(`div`),Object.assign(this.toolsArea.style,{flex:`1`,overflowY:`scroll`,padding:`10px ${this.cfg.barPadding}px 4px`,boxSizing:`border-box`,scrollbarWidth:`none`,msOverflowStyle:`none`});let e=document.createElement(`style`);e.textContent=`.lb-tools::-webkit-scrollbar{display:none}`,document.head.appendChild(e),this.toolsArea.classList.add(`lb-tools`),this.toolsGrid=this.makeGrid(),this.populateCategoryGrid(this.toolsGrid),this.toolsArea.appendChild(this.toolsGrid),this.toolsArea.addEventListener(`scroll`,()=>this.updateScrollIndicators()),this.el.appendChild(this.toolsArea),this.scrollDownBtn=document.createElement(`button`),this.applyScrollBtnStyles(this.scrollDownBtn,`down`),this.scrollDownBtn.addEventListener(`click`,()=>{this.toolsArea.scrollBy({top:(this.cfg.iconBtnSize+this.cfg.btnGap)*3,behavior:`smooth`})}),this.el.appendChild(this.scrollDownBtn),requestAnimationFrame(()=>this.updateScrollIndicators())}buildMobileActionsBtn(){let e=document.createElement(`button`);return e.title=this.labels.actions.moreActions,e.innerHTML=rn,this.applyActionBtnStyles(e,!1),this.addBtnHover(e),e.addEventListener(`click`,t=>{t.stopPropagation(),this.toggleActionsFlyout(e)}),e}populateCategoryGrid(e){this.catButtons.clear();for(let n of _n){var t;let r=document.createElement(`button`);r.title=this.getCategoryLabel(n.id),r.innerHTML=(t=Bt[n.id])==null?n.icon:t,this.applyCatBtnStyles(r,!1),this.addBtnHover(r),r.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleCategory(n,r)}),this.catButtons.set(n.id,r),e.appendChild(r)}}updateScrollIndicators(){let{scrollTop:e,scrollHeight:t,clientHeight:n}=this.toolsArea,r=e>2,i=e+n<t-2;this.mobileMode?(this.scrollUpBtn.style.display=`flex`,this.scrollDownBtn.style.display=`flex`,this.scrollUpBtn.style.opacity=r?`0.9`:`0.2`,this.scrollDownBtn.style.opacity=i?`0.9`:`0.2`):(this.scrollUpBtn.style.display=r?`flex`:`none`,this.scrollDownBtn.style.display=i?`flex`:`none`)}buildFlyout(){Object.assign(this.flyout.style,{position:`fixed`,zIndex:`9999`,display:`none`,background:this.theme.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`6px`,padding:`6px 0`,minWidth:`200px`,boxShadow:`0 4px 16px rgba(0,0,0,0.45)`,fontFamily:this.cfg.flyoutLabelFontFamily,fontSize:this.cfg.flyoutLabelFontSize})}makeGrid(e=1){let t=document.createElement(`div`);return Object.assign(t.style,{display:`grid`,gridTemplateColumns:`repeat(${e}, ${this.cfg.iconBtnSize}px)`,gap:`${this.cfg.btnGap}px`}),t}applyScrollBtnStyles(e,t){e.innerHTML=t===`up`?tn:nn,e.title=t===`up`?this.labels.scrollUp:this.labels.scrollDown;let n=e.style.display||`none`;Object.assign(e.style,{display:n,width:`100%`,height:`${this.cfg.scrollBtnHeight}px`,background:this.theme.background,color:this.theme.tooltip.text,border:`none`,borderBottom:t===`up`?`1px solid ${this.theme.axisBorder}`:`none`,borderTop:t===`down`?`1px solid ${this.theme.axisBorder}`:`none`,fontSize:this.cfg.scrollBtnFontSize,cursor:`pointer`,outline:`none`,alignItems:`center`,justifyContent:`center`,flexShrink:`0`,opacity:`0.6`})}toggleCategory(e,t){if(this.openCategoryId===e.id){this.closeFlyout();return}this.openCategoryId=e.id;let n=t.getBoundingClientRect();Object.assign(this.flyout.style,{display:`block`,left:`${n.right+4}px`,top:`${n.top}px`}),this.flyout.innerHTML=``;let r=document.createElement(`div`);Object.assign(r.style,{padding:`4px 12px 8px`,fontSize:this.cfg.flyoutHeadingFontSize,fontWeight:`600`,letterSpacing:this.cfg.flyoutHeadingLetterSpacing,color:this.theme.drawingToolbar.flyoutHeadingColor,textTransform:`uppercase`,borderBottom:`1px solid ${this.theme.axisBorder}`,marginBottom:`4px`,opacity:`0.6`}),r.textContent=this.getCategoryLabel(e.id),this.flyout.appendChild(r);for(let t of e.tools){var i,a;let n=t.id in gn,r=this.activeTool!==null&&gn[t.id]===this.activeTool,o=document.createElement(`button`);Object.assign(o.style,{width:`100%`,padding:`5px 12px`,background:r?this.theme.ui.accentBg:`transparent`,border:`none`,borderLeft:r?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,color:r?this.theme.ui.accentText:n?this.theme.drawingToolbar.flyoutLabelColor:this.theme.ui.disabledText,fontSize:this.cfg.flyoutLabelFontSize,fontFamily:this.cfg.flyoutLabelFontFamily,textAlign:`left`,cursor:n?`pointer`:`default`,display:`flex`,alignItems:`center`,gap:`8px`,boxSizing:`border-box`});let s=document.createElement(`span`);Object.assign(s.style,{width:`16px`,display:`flex`,alignItems:`center`,flexShrink:`0`}),s.innerHTML=(i=(a=Gt[t.id])==null?Bt[e.id]:a)==null?t.icon:i;let c=document.createElement(`span`);if(c.style.flex=`1`,c.textContent=this.getToolLabel(t),o.appendChild(s),o.appendChild(c),t.shortcut&&n){let e=document.createElement(`span`);Object.assign(e.style,{fontSize:this.cfg.shortcutFontSize,color:this.theme.ui.disabledText,flexShrink:`0`}),e.textContent=t.shortcut,o.appendChild(e)}else if(!n){let e=document.createElement(`span`);Object.assign(e.style,{fontSize:this.cfg.soonBadgeFontSize,color:this.theme.ui.soonBadgeText,flexShrink:`0`}),e.textContent=this.labels.soonBadge,o.appendChild(e)}if(n){if(!r){let e=this.theme.ui.accentBg;o.addEventListener(`mouseenter`,()=>{o.style.background=e}),o.addEventListener(`mouseleave`,()=>{o.style.background=`transparent`})}o.addEventListener(`click`,()=>{let e=gn[t.id],n=this.activeTool===e?null:e;if(this.setActiveTool(n),this.onToolChange(n),this.closeFlyout(),this.mobileMode&&n!==null){var r;this.settingsVisible=!1,this.applyWidth(),(r=this.onMobileClose)==null||r.call(this)}})}this.flyout.appendChild(o)}requestAnimationFrame(()=>{let e=this.flyout.getBoundingClientRect();e.bottom>window.innerHeight-8&&(this.flyout.style.top=`${window.innerHeight-e.height-8}px`)})}closeFlyout(){this.flyout.style.display=`none`,this.openCategoryId=null,this.openActionsMenu=!1}toggleActionsFlyout(e){if(this.openActionsMenu){this.closeFlyout();return}this.closeFlyout(),this.openActionsMenu=!0,this.flyout.innerHTML=``;let t=document.createElement(`div`);Object.assign(t.style,{padding:`4px 12px 8px`,fontSize:this.cfg.flyoutHeadingFontSize,fontWeight:`600`,letterSpacing:this.cfg.flyoutHeadingLetterSpacing,color:this.theme.drawingToolbar.flyoutHeadingColor,textTransform:`uppercase`,borderBottom:`1px solid ${this.theme.axisBorder}`,marginBottom:`4px`,opacity:`0.6`}),t.textContent=this.labels.actions.moreActions,this.flyout.appendChild(t);for(let e of vn){var n,r,i;let t=e.id===`toggle_visibility`?this.drawingsHidden:e.id===`toggle_lock`?this.drawingsLocked:!1,a=t?(n=(r=Ht[e.id])==null?Vt[e.id]:r)==null?e.icon:n:(i=Vt[e.id])==null?e.icon:i,o=e.id===`toggle_visibility`?this.drawingsHidden?this.labels.actions.showAll:this.labels.actions.hideAll:e.id===`toggle_lock`?this.drawingsLocked?this.labels.actions.unlockAll:this.labels.actions.lockAll:this.getActionLabel(e.id),s=document.createElement(`button`);Object.assign(s.style,{width:`100%`,padding:`6px 12px`,background:t?this.theme.ui.accentBg:`transparent`,border:`none`,borderLeft:t?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,color:t?this.theme.ui.accentText:this.theme.drawingToolbar.flyoutLabelColor,fontSize:this.cfg.flyoutLabelFontSize,fontFamily:this.cfg.flyoutLabelFontFamily,textAlign:`left`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:`8px`,boxSizing:`border-box`});let c=document.createElement(`span`);Object.assign(c.style,{width:`16px`,display:`flex`,alignItems:`center`,flexShrink:`0`}),c.innerHTML=a;let l=document.createElement(`span`);l.style.flex=`1`,l.textContent=o,s.appendChild(c),s.appendChild(l);let u=this.theme.ui.accentBg;t||(s.addEventListener(`mouseenter`,()=>{s.style.background=u}),s.addEventListener(`mouseleave`,()=>{s.style.background=`transparent`})),s.addEventListener(`click`,()=>{e.id===`toggle_visibility`?(this.drawingsHidden=!this.drawingsHidden,this.onAction(this.drawingsHidden?`hide_all`:`show_all`)):e.id===`toggle_lock`?(this.drawingsLocked=!this.drawingsLocked,this.onAction(this.drawingsLocked?`lock_all`:`unlock_all`)):this.onAction(e.id),this.closeFlyout()}),this.flyout.appendChild(s)}let a=e.getBoundingClientRect(),o=this.el.getBoundingClientRect();Object.assign(this.flyout.style,{display:`block`,left:`${o.right+4}px`,top:`${a.top}px`}),requestAnimationFrame(()=>{let e=this.flyout.getBoundingClientRect();e.bottom>window.innerHeight-8&&(this.flyout.style.top=`${window.innerHeight-e.height-8}px`)})}getCategoryLabel(e){let t={trend_lines:`trendLines`,fibonacci_gann:`fibonacci`,geometric_shapes:`shapes`,measurement_tools:`measurements`,pitchfork_tools:`pitchforks`,volume_statistics:`volume`,annotation_tools:`annotations`,pattern_recognition:`patterns`,elliott_wave:`elliott`,brush_highlighter:`brushes`,advanced_tools:`advanced`,price_projections:`priceProjection`}[e];return t?this.labels.categories[t]:e}getToolLabel(e){let t=gn[e.id];return t&&this.labels.tools[t]?this.labels.tools[t]:e.name}getActionLabel(e){let t={undo:`undo`,redo:`redo`,delete_selected:`deleteSelected`,clear_all:`clearAll`,toggle_visibility:`hideAll`,toggle_lock:`lockAll`}[e];return t?this.labels.actions[t]:e}addBtnHover(e){e.addEventListener(`mouseenter`,()=>{e.dataset.active!==`true`&&(e.style.background=this.theme.ui.accentBg)}),e.addEventListener(`mouseleave`,()=>{e.dataset.active!==`true`&&(e.style.background=`transparent`)})}applyCatBtnStyles(e,t){e.dataset.active=String(t),Object.assign(e.style,{width:`${this.cfg.iconBtnSize}px`,height:`${this.cfg.iconBtnSize}px`,background:t?this.theme.ui.accentBgStrong:`transparent`,color:t?this.theme.drawingToolbar.activeIconColor:this.theme.drawingToolbar.iconColor,border:`1px solid ${t?this.theme.ui.accent:this.theme.axisBorder}`,borderRadius:`5px`,cursor:`pointer`,outline:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0`})}applyActionBtnStyles(e,t){e.dataset.active=String(t),Object.assign(e.style,{width:`${this.cfg.iconBtnSize}px`,height:`${this.cfg.iconBtnSize}px`,background:t?this.theme.ui.accentBg:`transparent`,color:t?this.theme.drawingToolbar.activeIconColor:this.theme.drawingToolbar.iconColor,border:`1px solid ${t?this.theme.ui.accent:this.theme.axisBorder}`,borderRadius:`5px`,cursor:`pointer`,outline:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0`})}},bn=6,xn=class{constructor(e){this.type=`horizontalLine`,this.id=`hl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o,s=2){let c=this.points[0].price,l=t.yToPixel(c,r,a);e.save(),e.strokeStyle=`#e8b84b`,e.lineWidth=o?1.5:1,o||e.setLineDash([6,3]),e.beginPath(),e.moveTo(0,l),e.lineTo(i,l),e.stroke(),e.setLineDash([]);let u=c.toFixed(s);e.font=`10px 'Inter', system-ui, sans-serif`;let d=e.measureText(u).width;e.fillStyle=`#e8b84b`,e.fillText(u,i-d-4,l-3),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.yToPixel(this.points[0].price,i,o);return Math.abs(t-s)<=bn}getHandle(){return null}},Sn=6,Cn=class{constructor(e){this.type=`verticalLine`,this.id=`vl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i);e.save(),e.strokeStyle=`#e8b84b`,e.lineWidth=o?1.5:1,o||e.setLineDash([6,3]),e.beginPath(),e.moveTo(s,0),e.lineTo(s,a),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a);return Math.abs(e-s)<=Sn}getHandle(){return null}},wn=6;function Tn(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var En=class{constructor(e){this.type=`trendLine`,this.id=`tl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.strokeStyle=`#26c6da`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke();for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#26c6da`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return Tn(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=wn}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=wn+2)return{pointIndex:n,cursor:`grab`};return null}},Dn=6;function On(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var kn=class{constructor(e){this.type=`trendAngle`,this.id=`ta_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.atan2(-(f-u),d-l)*180/Math.PI,m=Math.atan2(-(f-u),d-l);e.save(),e.strokeStyle=`#26c6da`,e.fillStyle=`#26c6da`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.beginPath(),e.arc(l,u,28,-m,0,m<0),e.stroke(),e.setLineDash([4,3]),e.globalAlpha=.5,e.beginPath(),e.moveTo(l,u),e.lineTo(l+28+8,u),e.stroke(),e.setLineDash([]),e.globalAlpha=1;let h=l+28+6,g=u-(m>=0?6:-14);if(e.font=`bold 11px 'Inter', system-ui, sans-serif`,e.fillText(`${p.toFixed(1)}°`,h,g),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return On(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=Dn}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Dn+2)return{pointIndex:n,cursor:`grab`};return null}},An=6,jn=class{constructor(e){this.type=`crossLine`,this.id=`xl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=this.points[0],c=t.xToPixel(s.barIndex,n,i),l=t.yToPixel(s.price,r,a);e.save(),e.strokeStyle=`#78909c`,e.lineWidth=o?1.5:1,o||e.setLineDash([6,3]),e.beginPath(),e.moveTo(0,l),e.lineTo(i,l),e.stroke(),e.beginPath(),e.moveTo(c,0),e.lineTo(c,a),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){let s=this.points[0],c=n.xToPixel(s.barIndex,r,a),l=n.yToPixel(s.price,i,o);return Math.abs(t-l)<=An||Math.abs(e-c)<=An}getHandle(){return null}},Mn=6;function Nn(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Pn=class{constructor(e){this.type=`parallelChannel`,this.requiredPoints=3,this.id=`pch_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a),m=0;if(l){let e=(s.price+c.price)/2,n=t.yToPixel(e,r,a);m=t.yToPixel(l.price,r,a)-n}let h=u,g=d+m,_=f,v=p+m;if(e.save(),e.strokeStyle=`#26c6da`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.lineTo(_,v),e.lineTo(h,g),e.closePath(),e.fillStyle=`rgba(38, 198, 218, 0.08)`,e.fill(),e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke(),l&&(e.beginPath(),e.moveTo(h,g),e.lineTo(_,v),e.stroke()),o){let o=[[u,d],[f,p]];if(l){let e=t.xToPixel(l.barIndex,n,i),s=t.yToPixel(l.price,r,a);o.push([e,s])}e.fillStyle=`#26c6da`;for(let[t,n]of o)e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o);if(Nn(e,t,u,d,f,p)<=Mn)return!0;if(l){let r=(s.price+c.price)/2,a=n.yToPixel(r,i,o),m=n.yToPixel(l.price,i,o)-a;if(Nn(e,t,u,d+m,f,p+m)<=Mn)return!0}return!1}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=Mn+2)return{pointIndex:n,cursor:`grab`};return null}},Fn=6;function In(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ln=class{constructor(e){this.type=`flatChannel`,this.requiredPoints=3,this.id=`fch_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(s.price,r,a),p=l?l.price-s.price:0,m=t.yToPixel(s.price+p,r,a);if(e.save(),e.strokeStyle=`#ab47bc`,e.lineWidth=o?1.5:1,e.beginPath(),e.rect(Math.min(u,d),Math.min(f,m),Math.abs(d-u),Math.abs(m-f)),e.fillStyle=`rgba(171, 71, 188, 0.08)`,e.fill(),e.beginPath(),e.moveTo(u,f),e.lineTo(d,f),e.stroke(),l&&(e.beginPath(),e.moveTo(u,m),e.lineTo(d,m),e.stroke()),o){e.fillStyle=`#ab47bc`;let o=[[u,f],[d,f]];if(l){let e=t.xToPixel(l.barIndex,n,i),s=t.yToPixel(l.price,r,a);o.push([e,s])}for(let[t,n]of o)e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(s.price,i,o);if(In(e,t,u,f,d,f)<=Fn)return!0;if(l){let r=l.price-s.price,a=n.yToPixel(s.price+r,i,o);if(In(e,t,u,a,d,a)<=Fn)return!0}return!1}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=Fn+2)return{pointIndex:n,cursor:`grab`};return null}},Rn=6;function zn(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Bn=class{constructor(e){this.type=`disjointChannel`,this.requiredPoints=4,this.id=`dch_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=e=>[t.xToPixel(e.barIndex,n,i),t.yToPixel(e.price,r,a)],[c,l,u,d]=this.points,[f,p]=s(c),[m,h]=s(l);if(e.save(),e.strokeStyle=`#ef9a9a`,e.lineWidth=o?1.5:1,u&&d){let[t,n]=s(u),[r,i]=s(d);if(e.beginPath(),e.moveTo(f,p),e.lineTo(m,h),e.lineTo(r,i),e.lineTo(t,n),e.closePath(),e.fillStyle=`rgba(239, 154, 154, 0.1)`,e.fill(),e.beginPath(),e.moveTo(f,p),e.lineTo(m,h),e.stroke(),e.beginPath(),e.moveTo(t,n),e.lineTo(r,i),e.stroke(),o){e.fillStyle=`#ef9a9a`;for(let[a,o]of[[f,p],[m,h],[t,n],[r,i]])e.beginPath(),e.arc(a,o,4,0,Math.PI*2),e.fill()}}else if(u){let[t,n]=s(u);if(e.beginPath(),e.moveTo(f,p),e.lineTo(m,h),e.stroke(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,n),e.stroke(),o){e.fillStyle=`#ef9a9a`;for(let[r,i]of[[f,p],[m,h],[t,n]])e.beginPath(),e.arc(r,i,4,0,Math.PI*2),e.fill()}}else if(e.beginPath(),e.moveTo(f,p),e.lineTo(m,h),e.stroke(),o){e.fillStyle=`#ef9a9a`;for(let[t,n]of[[f,p],[m,h]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=e=>[n.xToPixel(e.barIndex,r,a),n.yToPixel(e.price,i,o)],[c,l,u,d]=this.points,[f,p]=s(c),[m,h]=s(l);if(zn(e,t,f,p,m,h)<=Rn)return!0;if(u&&d){let[n,r]=s(u),[i,a]=s(d);if(zn(e,t,n,r,i,a)<=Rn)return!0}return!1}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=Rn+2)return{pointIndex:n,cursor:`grab`};return null}},Vn=[0,.236,.382,.5,.618,.786,1],Hn=[`#ef5350`,`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`],Un=6,Wn=class{constructor(e){this.type=`fibRetracement`,this.id=`fib_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=Math.max(c.price,l.price),d=u-Math.min(c.price,l.price),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a),m=t.xToPixel(l.barIndex,n,i),h=t.yToPixel(l.price,r,a),g=Math.min(f,m),_=Math.max(f,m);e.save(),e.font=`10px 'Inter', system-ui, sans-serif`;for(let n=0;n<Vn.length;n++){let i=Vn[n],c=u-d*i,l=t.yToPixel(c,r,a),f=Hn[n],p=o?`cc`:`99`;e.strokeStyle=f+p,e.lineWidth=o?1.5:1,e.setLineDash(i===0||i===1?[]:[4,3]),e.beginPath(),e.moveTo(g,l),e.lineTo(_,l),e.stroke(),e.setLineDash([]);let m=`${`${(i*100).toFixed(1)}%`} ${c.toFixed(s)}`;e.fillStyle=f+p,e.fillText(m,g+4,l-3)}for(let[t,n]of[[f,p],[m,h]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=Math.max(this.points[0].price,this.points[1].price),c=s-Math.min(this.points[0].price,this.points[1].price);for(let e of Vn){let r=s-c*e,a=n.yToPixel(r,i,o);if(Math.abs(t-a)<=Un)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Un+2)return{pointIndex:n,cursor:`grab`};return null}},Gn=6,Kn=[0,.382,.618,1,1.382,1.618,2,2.618],qn=[`#ef5350`,`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`,`#ef5350`],Jn=class{constructor(e){this.type=`fibExtension`,this.requiredPoints=3,this.id=`fext_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){let[c,l,u]=this.points,d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=t.xToPixel(l.barIndex,n,i),m=t.yToPixel(l.price,r,a);if(!u){e.save(),e.strokeStyle=`#888888aa`,e.lineWidth=1,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.setLineDash([]),e.fillStyle=`#e8b84b`,e.beginPath(),e.arc(d,f,3,0,Math.PI*2),e.fill(),e.restore();return}let h=t.xToPixel(u.barIndex,n,i),g=t.yToPixel(u.price,r,a),_=Math.min(d,p,h),v=Math.max(d,p,h),y=l.price-c.price;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.strokeStyle=`#888888aa`,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.beginPath(),e.moveTo(p,m),e.lineTo(h,g),e.stroke(),e.setLineDash([]);for(let n=0;n<Kn.length;n++){let i=Kn[n],c=u.price+i*y,l=t.yToPixel(c,r,a),d=qn[n],f=o?`cc`:`99`;e.strokeStyle=d+f,e.setLineDash(i===0||i===1?[]:[4,3]),e.beginPath(),e.moveTo(_,l),e.lineTo(v,l),e.stroke(),e.setLineDash([]);let p=`${`${(i*100).toFixed(1)}%`} ${c.toFixed(s)}`;e.fillStyle=d+f,e.fillText(p,_+4,l-3)}for(let[t,n]of[[d,f],[p,m],[h,g]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=c.price-s.price;for(let e of Kn){let r=l.price+e*u,a=n.yToPixel(r,i,o);if(Math.abs(t-a)<=Gn)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<3)return null;let s=this.points.map(e=>({px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Gn+2)return{pointIndex:n,cursor:`grab`};return null}},Yn=6,Xn=[0,.236,.382,.5,.618,.786,1],Zn=[`#ef5350`,`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`];function Qn(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var $n=class{constructor(e){this.type=`fibChannel`,this.requiredPoints=3,this.id=`fchann_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){let[c,l,u]=this.points,d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=t.xToPixel(l.barIndex,n,i),m=t.yToPixel(l.price,r,a);if(!u){e.save(),e.strokeStyle=`#888888aa`,e.lineWidth=1,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.setLineDash([]),e.fillStyle=`#e8b84b`,e.beginPath(),e.arc(d,f,3,0,Math.PI*2),e.fill(),e.restore();return}let h=t.xToPixel(u.barIndex,n,i),g=t.yToPixel(u.price,r,a),_=p-d,v=m-f,y=Math.hypot(_,v);if(y===0)return;let b=-v/y,x=_/y,S=(h-d)*b+(g-f)*x;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1;for(let t=0;t<Xn.length;t++){let n=Xn[t],r=n*S,i=d+r*b,a=f+r*x,s=p+r*b,c=m+r*x,l=Zn[t],u=o?`cc`:`99`;e.strokeStyle=l+u,e.setLineDash(n===0||n===1?[]:[4,3]),e.beginPath(),e.moveTo(i,a),e.lineTo(s,c),e.stroke(),e.setLineDash([]);let h=`${(n*100).toFixed(1)}%`;e.fillStyle=l+u,e.fillText(h,s+4,c+3)}e.beginPath(),e.arc(h,g,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();for(let[t,n]of[[d,f],[p,m]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.strokeStyle=`#888888aa`,e.setLineDash([3,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(h,g),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=f-u,_=p-d,v=Math.hypot(g,_);if(v===0)return!1;let y=-_/v,b=g/v,x=(m-u)*y+(h-d)*b;for(let n of Xn){let r=n*x;if(Qn(e,t,u+r*y,d+r*b,f+r*y,p+r*b)<=Yn)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<3)return null;let s=this.points.map(e=>({px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Yn+2)return{pointIndex:n,cursor:`grab`};return null}},er=6,tr=[1,2,3,5,8,13,21,34,55,89],nr=class{constructor(e){this.type=`fibTimezone`,this.id=`ftz_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=c.barIndex-s.barIndex,u=t.xToPixel(s.barIndex,n,i),d=t.xToPixel(c.barIndex,n,i);e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1;let f=`#e8b84b`,p=o?`cc`:`88`;e.strokeStyle=f+p,e.setLineDash([3,3]),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(d,0),e.lineTo(d,a),e.stroke(),e.setLineDash([]);for(let r of tr){let o=s.barIndex+r*l,c=t.xToPixel(o,n,i);c<-50||c>i+50||(e.strokeStyle=f+p,e.setLineDash([5,3]),e.beginPath(),e.moveTo(c,0),e.lineTo(c,a),e.stroke(),e.setLineDash([]),e.fillStyle=f+p,e.fillText(String(r),c+3,12))}let m=t.yToPixel(s.price,r,a),h=t.yToPixel(c.price,r,a);for(let[t,n]of[[u,m],[d,h]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=c.barIndex-s.barIndex,u=n.xToPixel(s.barIndex,r,a);if(Math.abs(e-u)<=er)return!0;for(let t of tr){let i=s.barIndex+t*l,o=n.xToPixel(i,r,a);if(Math.abs(e-o)<=er)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=er+2)return{pointIndex:n,cursor:`grab`};return null}},rr=6,ir=[.236,.382,.5,.618,.786,1,1.618,2.618],ar=[`#ef5350`,`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`,`#ef5350`],or=class{constructor(e){this.type=`fibCircles`,this.id=`fcirc_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.hypot(d-l,f-u);e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1;for(let t=0;t<ir.length;t++){let n=ir[t],r=n*p,i=ar[t%ar.length],a=o?`cc`:`88`;e.strokeStyle=i+a,e.beginPath(),e.arc(l,u,r,0,Math.PI*2),e.stroke(),e.fillStyle=i+a,e.fillText(`${(n*100).toFixed(1)}%`,l+3,u-r+12)}e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill(),e.strokeStyle=`#88888866`,e.setLineDash([3,3]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.hypot(d-l,f-u),m=Math.hypot(e-l,t-u);for(let e of ir){let t=e*p;if(Math.abs(m-t)<=rr)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o),l=n.xToPixel(this.points[1].barIndex,r,a),u=n.yToPixel(this.points[1].price,i,o);return Math.hypot(e-s,t-c)<=rr+2?{pointIndex:0,cursor:`move`}:Math.hypot(e-l,t-u)<=rr+2?{pointIndex:1,cursor:`grab`}:null}},sr=6,cr=[1,1,2,3,5,8,13,21],lr=class{constructor(e){this.type=`fibSpiral`,this.id=`fspi_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}computeArcs(e,t,n,r){let i=Math.hypot(n,r)/cr[cr.length-1],a=Math.atan2(r,n),o=[],s=e,c=t,l=a;for(let e=cr.length-1;e>=0;e--){let t=cr[e]*i,n=l+Math.PI,r=n+Math.PI/2;if(o.unshift({ox:s,oy:c,r:t,startAngle:n,endAngle:r}),e>0){let n=cr[e-1]*i,r=l-Math.PI/2;s+=(t-n)*Math.cos(r),c+=(t-n)*Math.sin(r),l-=Math.PI/2}}return o}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=d-l,m=f-u;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.strokeStyle=o?`#e8b84bcc`:`#e8b84b88`,e.lineWidth=o?1.5:1;let h=this.computeArcs(l,u,p,m);e.beginPath();for(let t=0;t<h.length;t++){let n=h[t];if(t===0){let t=n.ox+n.r*Math.cos(n.startAngle),r=n.oy+n.r*Math.sin(n.startAngle);e.moveTo(t,r)}e.arc(n.ox,n.oy,n.r,n.startAngle,n.endAngle,!1)}e.stroke(),e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill(),e.strokeStyle=`#88888866`,e.setLineDash([3,3]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=d-l,m=f-u,h=this.computeArcs(l,u,p,m);for(let n of h){let r=n.endAngle-n.startAngle;for(let i=0;i<=16;i++){let a=i/16,o=n.startAngle+a*r,s=n.ox+n.r*Math.cos(o),c=n.oy+n.r*Math.sin(o);if(Math.hypot(e-s,t-c)<=sr)return!0}}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o),l=n.xToPixel(this.points[1].barIndex,r,a),u=n.yToPixel(this.points[1].price,i,o);return Math.hypot(e-s,t-c)<=sr+2?{pointIndex:0,cursor:`move`}:Math.hypot(e-l,t-u)<=sr+2?{pointIndex:1,cursor:`grab`}:null}},ur=6,dr=[.236,.382,.5,.618,.786],fr=[`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`];function pr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function mr(e,t,n,r,i,a){let o=n-e,s=r-t;if(o===0&&s===0)return[n,r];let c=1/0;return o>0&&(c=Math.min(c,(i-e)/o)),o<0&&(c=Math.min(c,(0-e)/o)),s>0&&(c=Math.min(c,(a-t)/s)),s<0&&(c=Math.min(c,(0-t)/s)),[e+c*o,t+c*s]}var hr=class{constructor(e){this.type=`fibFan`,this.id=`ffan_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.strokeStyle=`#888888aa`,e.setLineDash([4,3]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([]);let p=c.price-s.price;for(let n=0;n<dr.length;n++){let c=dr[n],f=fr[n],m=o?`cc`:`99`,h=s.price+c*p,[g,_]=mr(l,u,d,t.yToPixel(h,r,a),i,a);e.strokeStyle=f+m,e.beginPath(),e.moveTo(l,u),e.lineTo(g,_),e.stroke(),e.fillStyle=f+m,e.fillText(`${(c*100).toFixed(1)}%`,Math.min(g-32,i-40),_-3)}for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=c.price-s.price;for(let r of dr){let c=s.price+r*f,[p,m]=mr(l,u,d,n.yToPixel(c,i,o),a,o);if(pr(e,t,l,u,p,m)<=ur)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=ur+2)return{pointIndex:n,cursor:`grab`};return null}},gr=6,_r=[0,.618,1,1.272,1.618,2,2.618],vr=[`#ef5350`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`,`#ef5350`],yr=class{constructor(e){this.type=`fibProjection`,this.requiredPoints=3,this.id=`fproj_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){let[c,l,u]=this.points,d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=t.xToPixel(l.barIndex,n,i),m=t.yToPixel(l.price,r,a);if(!u){e.save(),e.strokeStyle=`#888888aa`,e.lineWidth=1,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.setLineDash([]),e.fillStyle=`#e8b84b`,e.beginPath(),e.arc(d,f,3,0,Math.PI*2),e.fill(),e.restore();return}let h=t.xToPixel(u.barIndex,n,i),g=t.yToPixel(u.price,r,a),_=Math.min(d,h),v=Math.max(d,h),y=l.price-c.price;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.strokeStyle=`#888888aa`,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.beginPath(),e.moveTo(p,m),e.lineTo(h,g),e.stroke(),e.setLineDash([]);for(let n=0;n<_r.length;n++){let i=_r[n],c=u.price+i*y,l=t.yToPixel(c,r,a),d=vr[n],f=o?`cc`:`99`;e.strokeStyle=d+f,e.setLineDash(i===0||i===1?[]:[4,3]),e.beginPath(),e.moveTo(_,l),e.lineTo(v,l),e.stroke(),e.setLineDash([]);let p=`${`${(i*100).toFixed(1)}%`} ${c.toFixed(s)}`;e.fillStyle=d+f,e.fillText(p,_+4,l-3)}for(let[t,n]of[[d,f],[p,m],[h,g]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=c.price-s.price;for(let e of _r){let r=l.price+e*u,a=n.yToPixel(r,i,o);if(Math.abs(t-a)<=gr)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<3)return null;let s=this.points.map(e=>({px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=gr+2)return{pointIndex:n,cursor:`grab`};return null}},br=6;function xr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Sr=[[1,8,`1:8`],[1,4,`1:4`],[1,3,`1:3`],[1,2,`1:2`],[1,1,`1:1`],[2,1,`2:1`],[3,1,`3:1`],[4,1,`4:1`],[8,1,`8:1`]],Cr=class{constructor(e){this.type=`gannFan`,this.id=`gfan_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.abs(d-l)||1,m=f-u,h=d>l?1:-1;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,Sr.forEach(([t,n,r],a)=>{var o;let s=t/n*m,c=(i-l)/(p*h),d=l+p*h*c,f=u+s*c,g=`#ffa726`+((o=[`55`,`66`,`77`,`99`,`cc`,`99`,`77`,`66`,`55`][a])==null?`88`:o);e.strokeStyle=g,e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.fillStyle=g;let _=Math.min(d,i-30);e.fillText(r,_,f-3)}),e.fillStyle=`#ffa726`,e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.abs(d-l)||1,m=f-u,h=d>l?1:-1;for(let[n,r]of Sr){let i=n/r*m,o=(a-l)/(p*h);if(xr(e,t,l,u,l+p*h*o,u+i*o)<=br)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}],c=[`move`,`grab`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=br+2)return{pointIndex:n,cursor:c[n]};return null}},wr=6,Tr=class{constructor(e){this.type=`gannSquare`,this.id=`gsq_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.max(l,d),g=Math.max(u,f),_=h-p,v=g-m;e.save(),e.lineWidth=o?1.5:1,e.strokeStyle=`#ab47bc`,e.fillStyle=`#ab47bc0a`,e.fillRect(p,m,_,v),e.strokeRect(p,m,_,v),e.beginPath(),e.moveTo(p,m+v/3),e.lineTo(h,m+v/3),e.moveTo(p,m+2*v/3),e.lineTo(h,m+2*v/3),e.stroke(),e.beginPath(),e.moveTo(p+_/3,m),e.lineTo(p+_/3,g),e.moveTo(p+2*_/3,m),e.lineTo(p+2*_/3,g),e.stroke(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o);return e>=Math.min(l,d)&&e<=Math.max(l,d)&&t>=Math.min(u,f)&&t<=Math.max(u,f)}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=wr+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Er=6,Dr=class{constructor(e){this.type=`gannBox`,this.id=`gbox_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.max(l,d),g=Math.max(u,f),_=h-p,v=g-m,y=p+_/2,b=m+v/2;e.save(),e.lineWidth=o?1.5:1,e.strokeStyle=`#7e57c2`,e.fillStyle=`#7e57c20a`,e.fillRect(p,m,_,v),e.strokeRect(p,m,_,v),e.beginPath(),e.moveTo(p,m),e.lineTo(h,g),e.stroke(),e.beginPath(),e.moveTo(h,m),e.lineTo(p,g),e.stroke(),e.beginPath(),e.moveTo(p,b),e.lineTo(h,b),e.stroke(),e.beginPath(),e.moveTo(y,m),e.lineTo(y,g),e.stroke(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o);return e>=Math.min(l,d)&&e<=Math.max(l,d)&&t>=Math.min(u,f)&&t<=Math.max(u,f)}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Er+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Or=6,kr=class{constructor(e){this.type=`rectangle`,this.id=`rect_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);if(e.save(),e.fillStyle=`#9b59b618`,e.strokeStyle=`#9b59b6`,e.lineWidth=o?1.5:1,e.fillRect(p,m,h,g),e.strokeRect(p,m,h,g),o)for(let[t,n]of[[l,u],[d,u],[l,f],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=`#9b59b6`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-Or,m=Math.min(u,f)-Or,h=Math.abs(d-l)+Or*2,g=Math.abs(f-u)+Or*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=l<=d?u<=f?`nwse-resize`:`nesw-resize`:u<=f?`nesw-resize`:`nwse-resize`,m=[[0,l,u,p],[1,d,f,p]];for(let[n,r,i,a]of m)if(Math.hypot(e-r,t-i)<=Or+2)return{pointIndex:n,cursor:a};return null}},Ar=6;function jr(e,t,n){let r=!1,i=n.length;for(let a=0,o=i-1;a<i;o=a++){let[i,s]=n[a],[c,l]=n[o];s>t!=l>t&&e<(c-i)*(t-s)/(l-s)+i&&(r=!r)}return r}var Mr=class{constructor(e){this.type=`rotatedRectangle`,this.requiredPoints=3,this.id=`rrect_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}getCorners(e,t,n,r,i){let[a,o,s]=this.points,c=e.xToPixel(a.barIndex,t,r),l=e.yToPixel(a.price,n,i),u=e.xToPixel(o.barIndex,t,r),d=e.yToPixel(o.price,n,i),f=e.xToPixel(s.barIndex,t,r),p=e.yToPixel(s.price,n,i),m=Math.hypot(u-c,d-l);if(m<1e-6)return[[c,l],[u,d],[u,d],[c,l]];let h=-(d-l)/m,g=(u-c)/m,_=(f-c)*h+(p-l)*g,v=c,y=l,b=u,x=d,S=b+h*_,C=x+g*_,w=v+h*_,T=y+g*_;return[[v,y],[b,x],[S,C],[w,T]]}render(e,t,n,r,i,a,o){if(this.points.length<3)return;let s=this.getCorners(t,n,r,i,a);e.save(),e.beginPath(),e.moveTo(s[0][0],s[0][1]);for(let t=1;t<s.length;t++)e.lineTo(s[t][0],s[t][1]);e.closePath(),e.fillStyle=`#9c27b018`,e.fill(),e.strokeStyle=`#9c27b0`,e.lineWidth=o?1.5:1,e.stroke(),e.fillStyle=`#9c27b0`;for(let[t,n]of s)e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){return this.points.length<3?!1:jr(e,t,this.getCorners(n,r,i,a,o))}getHandle(e,t,n,r,i,a,o){for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ar+2)return{pointIndex:s,cursor:`grab`}}return null}},Nr=6,Pr=class{constructor(e){this.type=`ellipse`,this.id=`ell_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=(l+d)/2,m=(u+f)/2,h=Math.abs(d-l)/2,g=Math.abs(f-u)/2;if(!(h<1||g<1)){if(e.save(),e.fillStyle=`#2196f318`,e.strokeStyle=`#2196f3`,e.lineWidth=o?1.5:1,e.beginPath(),e.ellipse(p,m,h,g,0,0,Math.PI*2),e.fill(),e.stroke(),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=`#2196f3`,e.fill();e.restore()}}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=(l+d)/2,m=(u+f)/2,h=Math.abs(d-l)/2+Nr,g=Math.abs(f-u)/2+Nr;if(h<1||g<1)return!1;let _=(e-p)/h,v=(t-m)/g;return _*_+v*v<=1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=l<=d?u<=f?`nwse-resize`:`nesw-resize`:u<=f?`nesw-resize`:`nwse-resize`,m=[[0,l,u,p],[1,d,f,p]];for(let[n,r,i,a]of m)if(Math.hypot(e-r,t-i)<=Nr+2)return{pointIndex:n,cursor:a};return null}},Fr=6;function Ir(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Lr=class{constructor(e){this.type=`triangle`,this.requiredPoints=3,this.id=`tri_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a));e.save(),e.strokeStyle=`#ff9800`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<s.length;t++)e.lineTo(s[t],c[t]);if(this.complete&&(e.closePath(),e.fillStyle=`#ff980018`,e.fill()),e.stroke(),o)for(let t=0;t<s.length;t++)e.beginPath(),e.arc(s[t],c[t],4,0,Math.PI*2),e.fillStyle=`#ff9800`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l;n++){let r=(n+1)%l;if(Ir(e,t,s[n],c[n],s[r],c[r])<=Fr)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<3)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Fr+2)return{pointIndex:s,cursor:`grab`}}return null}},Rr=6,zr=class{constructor(e){this.type=`circle`,this.id=`circ_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.hypot(d-l,f-u);p<1||(e.save(),e.fillStyle=`#4caf5018`,e.strokeStyle=`#4caf50`,e.lineWidth=o?1.5:1,e.beginPath(),e.arc(l,u,p,0,Math.PI*2),e.fill(),e.stroke(),o&&(e.beginPath(),e.arc(l,u,3,0,Math.PI*2),e.fillStyle=`#4caf50`,e.fill(),e.beginPath(),e.arc(d,f,3.5,0,Math.PI*2),e.fillStyle=`#4caf50`,e.fill()),e.restore())}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.hypot(d-l,f-u);return Math.hypot(e-l,t-u)<=p+Rr}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o);return Math.hypot(e-l,t-u)<=Rr+2?{pointIndex:0,cursor:`move`}:Math.hypot(e-d,t-f)<=Rr+2?{pointIndex:1,cursor:`grab`}:null}},Br=6;function Vr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Hr=class{constructor(e){this.type=`arc`,this.requiredPoints=3,this.id=`arc_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<3)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a),m=t.xToPixel(l.barIndex,n,i),h=t.yToPixel(l.price,r,a);e.save(),e.strokeStyle=`#26c6da`,e.lineWidth=o?1.5:1;let g=u,_=d,v=f,y=p,b=m,x=h,S=2*(g*(y-x)+v*(x-_)+b*(_-y));if(Math.abs(S)<1e-6)e.beginPath(),e.moveTo(u,d),e.lineTo(m,h),e.stroke();else{let t=g*g,n=_*_,r=v*v,i=y*y,a=b*b,o=x*x,s=((t+n)*(y-x)+(r+i)*(x-_)+(a+o)*(_-y))/S,c=((t+n)*(b-v)+(r+i)*(g-b)+(a+o)*(v-g))/S,l=Math.hypot(g-s,_-c),u=Math.atan2(_-c,g-s),d=Math.atan2(y-c,v-s),f=Math.atan2(x-c,b-s),p=(e,t)=>{let n=e-t;for(;n<0;)n+=Math.PI*2;for(;n>=Math.PI*2;)n-=Math.PI*2;return n},m=p(d,u)>p(f,u);e.beginPath(),e.arc(s,c,l,u,f,m),e.stroke()}let C=[[u,d],[f,p],[m,h]];e.fillStyle=`#26c6da`;for(let[t,n]of C)e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=u,_=d,v=f,y=p,b=m,x=h,S=2*(g*(y-x)+v*(x-_)+b*(_-y));if(Math.abs(S)<1e-6)return Vr(e,t,u,d,m,h)<=Br;let C=g*g,w=_*_,T=v*v,E=y*y,D=b*b,O=x*x,k=((C+w)*(y-x)+(T+E)*(x-_)+(D+O)*(_-y))/S,A=((C+w)*(b-v)+(T+E)*(g-b)+(D+O)*(v-g))/S,j=Math.hypot(g-k,_-A);if(Math.abs(Math.hypot(e-k,t-A)-j)>Br)return!1;let M=Math.atan2(_-A,g-k),N=Math.atan2(y-A,v-k),P=Math.atan2(x-A,b-k),F=Math.atan2(t-A,e-k),I=(e,t)=>{let n=e-t;for(;n<0;)n+=Math.PI*2;for(;n>=Math.PI*2;)n-=Math.PI*2;return n},L=I(N,M),ee=I(P,M),R=I(F,M);return L>ee?R>=ee||R<=0:R<=ee}getHandle(e,t,n,r,i,a,o){for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Br+2)return{pointIndex:s,cursor:`grab`}}return null}},Ur=6;function Wr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Gr=class{constructor(e){this.type=`polyline`,this.openEnded=!0,this.id=`poly_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>({x:t.xToPixel(e.barIndex,n,i),y:t.yToPixel(e.price,r,a)}));e.save(),e.strokeStyle=`#ff7043`,e.lineWidth=o?1.5:1;let c=this.complete?s.length:s.length-1;if(c>=2){e.setLineDash([]),e.beginPath(),e.moveTo(s[0].x,s[0].y);for(let t=1;t<c;t++)e.lineTo(s[t].x,s[t].y);e.stroke()}if(!this.complete&&s.length>=2){let t=s.length-1;e.setLineDash([4,4]),e.beginPath(),e.moveTo(s[t-1].x,s[t-1].y),e.lineTo(s[t].x,s[t].y),e.stroke(),e.setLineDash([])}e.fillStyle=`#ff7043`;let l=this.complete?s.length:s.length-1;for(let t=0;t<l;t++)e.beginPath(),e.arc(s[t].x,s[t].y,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>({x:n.xToPixel(e.barIndex,r,a),y:n.yToPixel(e.price,i,o)})),c=this.complete?s.length-1:s.length-2;for(let n=0;n<c;n++)if(Wr(e,t,s[n].x,s[n].y,s[n+1].x,s[n+1].y)<=Ur)return!0;return!1}getHandle(e,t,n,r,i,a,o){for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ur+2)return{pointIndex:s,cursor:`grab`}}return null}},Kr=6;function qr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Jr=class{constructor(e){this.type=`path`,this.openEnded=!0,this.id=`path_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>({x:t.xToPixel(e.barIndex,n,i),y:t.yToPixel(e.price,r,a)})),c=this.complete?s.length:s.length-1;if(e.save(),e.strokeStyle=`#ec407a`,e.lineWidth=o?1.5:1,c>=2){if(e.setLineDash([]),e.beginPath(),e.moveTo(s[0].x,s[0].y),c===2)e.lineTo(s[1].x,s[1].y);else{for(let t=1;t<c-1;t++){let n=(s[t].x+s[t+1].x)/2,r=(s[t].y+s[t+1].y)/2;e.quadraticCurveTo(s[t].x,s[t].y,n,r)}e.lineTo(s[c-1].x,s[c-1].y)}e.stroke()}if(!this.complete&&s.length>=2){let t=s.length-1;e.setLineDash([4,4]),e.beginPath(),e.moveTo(s[t-1].x,s[t-1].y),e.lineTo(s[t].x,s[t].y),e.stroke(),e.setLineDash([])}e.fillStyle=`#ec407a`;for(let t=0;t<c;t++)e.beginPath(),e.arc(s[t].x,s[t].y,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>({x:n.xToPixel(e.barIndex,r,a),y:n.yToPixel(e.price,i,o)})),c=this.complete?s.length-1:s.length-2;for(let n=0;n<c;n++)if(qr(e,t,s[n].x,s[n].y,s[n+1].x,s[n+1].y)<=Kr)return!0;return!1}getHandle(e,t,n,r,i,a,o){for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Kr+2)return{pointIndex:s,cursor:`grab`}}return null}},Yr=6;function Xr(e,t,n,r,i,a=7){let o=Math.atan2(i-n,r-t);e.beginPath(),e.moveTo(r,i),e.lineTo(r-a*Math.cos(o-Math.PI/6),i-a*Math.sin(o-Math.PI/6)),e.lineTo(r-a*Math.cos(o+Math.PI/6),i-a*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var Zr=class{constructor(e){this.type=`priceRange`,this.id=`pr_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=t.xToPixel(c.barIndex,n,i),d=t.yToPixel(c.price,r,a),f=t.xToPixel(l.barIndex,n,i),p=t.yToPixel(l.price,r,a),m=(u+f)/2,h=(d+p)/2,g=Math.min(d,p),_=Math.max(d,p),v=`#26a69a`;e.save(),e.strokeStyle=v,e.fillStyle=v,e.lineWidth=o?1.5:1,e.font=`10px 'Inter', system-ui, sans-serif`,e.beginPath(),e.moveTo(m,g),e.lineTo(m,_),e.stroke(),Xr(e,m,_,m,g),Xr(e,m,g,m,_),e.beginPath(),e.moveTo(u-10,d),e.lineTo(u+10,d),e.stroke(),e.beginPath(),e.moveTo(f-10,p),e.lineTo(f+10,p),e.stroke();let y=Math.abs(c.price-l.price).toFixed(s),b=((l.price-c.price)/c.price*100).toFixed(2)+`%`,x=y,S=b,C=m+8,w=h-30/2;e.fillStyle=`rgba(0,0,0,0.55)`,e.fillRect(C,w,70,30),e.strokeStyle=v,e.strokeRect(C,w,70,30),e.fillStyle=v,e.fillText(x,C+4,w+4+10),e.fillText(S,C+4,w+4+22),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=(l+d)/2,m=Math.min(u,f),h=Math.max(u,f);return Math.abs(e-p)<=Yr&&t>=m&&t<=h}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Yr+2)return{pointIndex:n,cursor:`ns-resize`};return null}},Qr=6;function $r(e,t,n,r,i,a=7){let o=Math.atan2(i-n,r-t);e.beginPath(),e.moveTo(r,i),e.lineTo(r-a*Math.cos(o-Math.PI/6),i-a*Math.sin(o-Math.PI/6)),e.lineTo(r-a*Math.cos(o+Math.PI/6),i-a*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var ei=class{constructor(e){this.type=`dateRange`,this.id=`dr_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=(u+f)/2,m=Math.min(l,d),h=Math.max(l,d),g=`#42a5f5`;e.save(),e.strokeStyle=g,e.fillStyle=g,e.lineWidth=o?1.5:1,e.font=`10px 'Inter', system-ui, sans-serif`,e.beginPath(),e.moveTo(m,p),e.lineTo(h,p),e.stroke(),$r(e,h,p,m,p),$r(e,m,p,h,p),e.beginPath(),e.moveTo(l,u-10),e.lineTo(l,u+10),e.stroke(),e.beginPath(),e.moveTo(d,f-10),e.lineTo(d,f+10),e.stroke();let _=`${Math.abs(c.barIndex-s.barIndex)} bars`,v=(l+d)/2,y=e.measureText(_).width;e.fillStyle=g,e.fillText(_,v-y/2,p-10),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=(u+n.yToPixel(c.price,i,o))/2,p=Math.min(l,d),m=Math.max(l,d);return Math.abs(t-f)<=Qr&&e>=p&&e<=m}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Qr+2)return{pointIndex:n,cursor:`ew-resize`};return null}},ti=6;function ni(e,t,n,r,i,a=7){let o=Math.atan2(i-n,r-t);e.beginPath(),e.moveTo(r,i),e.lineTo(r-a*Math.cos(o-Math.PI/6),i-a*Math.sin(o-Math.PI/6)),e.lineTo(r-a*Math.cos(o+Math.PI/6),i-a*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var ri=class{constructor(e){this.type=`datePriceRange`,this.id=`dpr_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=t.xToPixel(c.barIndex,n,i),d=t.yToPixel(c.price,r,a),f=t.xToPixel(l.barIndex,n,i),p=t.yToPixel(l.price,r,a),m=Math.min(u,f),h=Math.min(d,p),g=Math.max(u,f),_=Math.max(d,p),v=g-m,y=_-h,b=`#66bb6a`;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.fillStyle=`#66bb6a12`,e.fillRect(m,h,v,y),e.strokeStyle=b,e.setLineDash([5,3]),e.strokeRect(m,h,v,y),e.setLineDash([]),e.strokeStyle=b,e.fillStyle=b,e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke(),ni(e,u,d,f,p);let x=`\u0394${Math.abs(c.price-l.price).toFixed(s)}`;e.fillStyle=b,e.fillText(x,g+4,(h+_)/2);let S=`${Math.abs(l.barIndex-c.barIndex)} bars`,C=e.measureText(S).width;e.fillText(S,m+v/2-C/2,_+12),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-ti,m=Math.min(u,f)-ti,h=Math.max(l,d)+ti,g=Math.max(u,f)+ti;return e>=p&&e<=h&&t>=m&&t<=g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=ti+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},ii=6;function ai(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var oi=class{constructor(e){this.type=`ruler`,this.id=`rul_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=t.xToPixel(c.barIndex,n,i),d=t.yToPixel(c.price,r,a),f=t.xToPixel(l.barIndex,n,i),p=t.yToPixel(l.price,r,a),m=`#ffb300`,h=Math.atan2(p-d,f-u),g=h+Math.PI/2;e.save(),e.strokeStyle=m,e.fillStyle=m,e.lineWidth=2,e.font=`10px 'Inter', system-ui, sans-serif`,e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke(),e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(u-8*Math.cos(g),d-8*Math.sin(g)),e.lineTo(u+8*Math.cos(g),d+8*Math.sin(g)),e.stroke(),e.beginPath(),e.moveTo(f-8*Math.cos(g),p-8*Math.sin(g)),e.lineTo(f+8*Math.cos(g),p+8*Math.sin(g)),e.stroke();let _=(u+f)/2,v=(d+p)/2,y=Math.abs(l.barIndex-c.barIndex),b=(l.price-c.price).toFixed(s),x=`${y} bars`,S=`${b}`,C=-12*Math.sin(h),w=12*Math.cos(h);e.fillStyle=m,e.fillText(x,_+C,v+w-12),e.fillText(S,_+C,v+w),e.beginPath(),e.arc(u,d,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(f,p,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return ai(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=ii}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=ii+2)return{pointIndex:n,cursor:`grab`};return null}},si=6;function ci(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function li(e,t,n,r,i){return n===0?[e,t]:[i,t+(i-e)/n*r]}var ui=class{constructor(e){this.type=`pitchfork`,this.requiredPoints=3,this.id=`pfk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a);if(e.save(),e.strokeStyle=`#ffa726`,e.lineWidth=o?1.5:1,l){let s=t.xToPixel(l.barIndex,n,i),c=t.yToPixel(l.price,r,a),m=(f+s)/2,h=(p+c)/2,g=m-u,_=h-d,[v,y]=li(u,d,g,_,i);e.beginPath(),e.moveTo(u,d),e.lineTo(m,h),e.stroke(),e.beginPath(),e.moveTo(u,d),e.lineTo(v,y),e.stroke();let[b,x]=li(f,p,g,_,i);e.beginPath(),e.moveTo(f,p),e.lineTo(b,x),e.stroke();let[S,C]=li(s,c,g,_,i);if(e.beginPath(),e.moveTo(s,c),e.lineTo(S,C),e.stroke(),o){e.fillStyle=`#ffa726`;for(let[t,n]of[[u,d],[f,p],[s,c]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}}else e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=(f+m)/2,_=(p+h)/2,v=g-u,y=_-d,[b,x]=li(u,d,v,y,a),[S,C]=li(f,p,v,y,a),[w,T]=li(m,h,v,y,a);return ci(e,t,u,d,b,x)<=si||ci(e,t,f,p,S,C)<=si||ci(e,t,m,h,w,T)<=si}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=si+2)return{pointIndex:n,cursor:`grab`};return null}},di=6;function fi(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function pi(e,t,n,r,i){return n===0?[e,t]:[i,t+(i-e)/n*r]}var mi=class{constructor(e){this.type=`schiffPitchfork`,this.requiredPoints=3,this.id=`spfk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a);if(e.save(),e.strokeStyle=`#ff7043`,e.lineWidth=o?1.5:1,l){let s=t.xToPixel(l.barIndex,n,i),c=t.yToPixel(l.price,r,a),m=(u+f)/2,h=(d+p)/2,g=(f+s)/2,_=(p+c)/2,v=g-m,y=_-h,[b,x]=pi(m,h,v,y,i);e.beginPath(),e.moveTo(m,h),e.lineTo(g,_),e.stroke(),e.beginPath(),e.moveTo(m,h),e.lineTo(b,x),e.stroke();let[S,C]=pi(f,p,v,y,i);e.beginPath(),e.moveTo(f,p),e.lineTo(S,C),e.stroke();let[w,T]=pi(s,c,v,y,i);if(e.beginPath(),e.moveTo(s,c),e.lineTo(w,T),e.stroke(),o){e.fillStyle=`#ff7043`;for(let[t,n]of[[u,d],[f,p],[s,c]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}}else e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=(u+f)/2,_=(d+p)/2,v=(f+m)/2,y=(p+h)/2,b=v-g,x=y-_,[S,C]=pi(g,_,b,x,a),[w,T]=pi(f,p,b,x,a),[E,D]=pi(m,h,b,x,a);return fi(e,t,g,_,S,C)<=di||fi(e,t,f,p,w,T)<=di||fi(e,t,m,h,E,D)<=di}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=di+2)return{pointIndex:n,cursor:`grab`};return null}},hi=6;function gi(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function _i(e,t,n,r,i){return n===0?[e,t]:[i,t+(i-e)/n*r]}var vi=class{constructor(e){this.type=`modifiedSchiff`,this.requiredPoints=3,this.id=`mspfk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a);if(e.save(),e.strokeStyle=`#ef5350`,e.lineWidth=o?1.5:1,l){let s=t.xToPixel(l.barIndex,n,i),c=t.yToPixel(l.price,r,a),m=(f+s)/2,h=(p+c)/2,g=(u+m)/2,_=(d+h)/2,v=m-g,y=h-_,[b,x]=_i(g,_,v,y,i);e.beginPath(),e.moveTo(g,_),e.lineTo(m,h),e.stroke(),e.beginPath(),e.moveTo(g,_),e.lineTo(b,x),e.stroke();let[S,C]=_i(f,p,v,y,i);e.beginPath(),e.moveTo(f,p),e.lineTo(S,C),e.stroke();let[w,T]=_i(s,c,v,y,i);if(e.beginPath(),e.moveTo(s,c),e.lineTo(w,T),e.stroke(),o){e.fillStyle=`#ef5350`;for(let[t,n]of[[u,d],[f,p],[s,c]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}}else e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=(f+m)/2,_=(p+h)/2,v=(u+g)/2,y=(d+_)/2,b=g-v,x=_-y,[S,C]=_i(v,y,b,x,a),[w,T]=_i(f,p,b,x,a),[E,D]=_i(m,h,b,x,a);return gi(e,t,v,y,S,C)<=hi||gi(e,t,f,p,w,T)<=hi||gi(e,t,m,h,E,D)<=hi}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=hi+2)return{pointIndex:n,cursor:`grab`};return null}},yi=6;function bi(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function xi(e,t,n,r,i){return n===0?[e,t]:[i,t+(i-e)/n*r]}var Si=class{constructor(e){this.type=`insidePitchfork`,this.requiredPoints=3,this.id=`ipfk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a);if(e.save(),e.strokeStyle=`#ab47bc`,e.lineWidth=o?1.5:1,l){let s=t.xToPixel(l.barIndex,n,i),c=t.yToPixel(l.price,r,a),m=(f+s)/2,h=(p+c)/2,g=m-u,_=h-d;e.beginPath(),e.moveTo(u,d),e.lineTo(m,h),e.stroke();let[v,y]=xi(u,d,g,_,i);e.beginPath(),e.moveTo(u,d),e.lineTo(v,y),e.stroke();let[b,x]=xi(f,p,g,_,i);e.beginPath(),e.moveTo(f,p),e.lineTo(b,x),e.stroke();let[S,C]=xi(s,c,g,_,i);e.beginPath(),e.moveTo(s,c),e.lineTo(S,C),e.stroke();let w=(u+f)/2,T=(d+p)/2,[E,D]=xi(w,T,g,_,i);e.globalAlpha=.55,e.setLineDash([4,3]),e.beginPath(),e.moveTo(w,T),e.lineTo(E,D),e.stroke();let O=(u+s)/2,k=(d+c)/2,[A,j]=xi(O,k,g,_,i);if(e.beginPath(),e.moveTo(O,k),e.lineTo(A,j),e.stroke(),e.setLineDash([]),e.globalAlpha=1,o){e.fillStyle=`#ab47bc`;for(let[t,n]of[[u,d],[f,p],[s,c]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}}else e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=(f+m)/2,_=(p+h)/2,v=g-u,y=_-d,[b,x]=xi(u,d,v,y,a),[S,C]=xi(f,p,v,y,a),[w,T]=xi(m,h,v,y,a);if(bi(e,t,u,d,b,x)<=yi||bi(e,t,f,p,S,C)<=yi||bi(e,t,m,h,w,T)<=yi)return!0;let E=(u+f)/2,D=(d+p)/2,[O,k]=xi(E,D,v,y,a);if(bi(e,t,E,D,O,k)<=yi)return!0;let A=(u+m)/2,j=(d+h)/2,[M,N]=xi(A,j,v,y,a);return bi(e,t,A,j,M,N)<=yi}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=yi+2)return{pointIndex:n,cursor:`grab`};return null}},Ci=6,wi=`#64b5f6`,Ti=[.35,.55,.75,1,1,.75,.55,.35],Ei=class{constructor(e){this.type=`fixedRangeVP`,this.id=`frvp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);e.save(),e.strokeStyle=wi,e.lineWidth=o?1.5:1,e.strokeRect(p,m,h,g);let _=Ti.length,v=g/_,y=h*.6;for(let t=0;t<_;t++){let n=y*Ti[t],r=m+t*v;e.fillStyle=wi+`60`,e.fillRect(p,r,n,v-1)}if(e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=wi,e.fillText(`Volume Profile`,p+4,m+13),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=wi,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-Ci,m=Math.min(u,f)-Ci,h=Math.abs(d-l)+Ci*2,g=Math.abs(f-u)+Ci*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[[0,n.xToPixel(this.points[0].barIndex,r,a),n.yToPixel(this.points[0].price,i,o)],[1,n.xToPixel(this.points[1].barIndex,r,a),n.yToPixel(this.points[1].price,i,o)]];for(let[n,r,i]of s)if(Math.hypot(e-r,t-i)<=Ci+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Di=6,Oi=`#4db6ac`,ki=[.35,.55,.75,1,1,.75,.55,.35],Ai=class{constructor(e){this.type=`anchoredVP`,this.id=`avp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);e.save(),e.strokeStyle=Oi,e.lineWidth=o?1.5:1,e.strokeRect(p,m,h,g);let _=ki.length,v=g/_,y=h*.6;for(let t=0;t<_;t++){let n=y*ki[t],r=m+t*v;e.fillStyle=Oi+`60`,e.fillRect(p,r,n,v-1)}if(e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Oi,e.fillText(`Anchored VP`,p+4,m+13),e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fillStyle=Oi,e.fill(),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=Oi,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-Di,m=Math.min(u,f)-Di,h=Math.abs(d-l)+Di*2,g=Math.abs(f-u)+Di*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[[0,n.xToPixel(this.points[0].barIndex,r,a),n.yToPixel(this.points[0].price,i,o)],[1,n.xToPixel(this.points[1].barIndex,r,a),n.yToPixel(this.points[1].price,i,o)]];for(let[n,r,i]of s)if(Math.hypot(e-r,t-i)<=Di+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},ji=6,Mi=`#26a69a`,Ni=[.25,.45,.65,.85,1,1,.85,.65,.45,.25],Pi=class{constructor(e){this.type=`volumeProfile`,this.id=`vp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);e.save(),e.strokeStyle=Mi,e.lineWidth=o?1.5:1,e.strokeRect(p,m,h,g);let _=Ni.length,v=g/_,y=h*.6;for(let t=0;t<_;t++){let n=y*Ni[t],r=m+t*v;e.fillStyle=Mi+`55`,e.fillRect(p,r,n,v-1)}if(e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Mi,e.fillText(`Volume Profile`,p+4,m+13),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=Mi,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-ji,m=Math.min(u,f)-ji,h=Math.abs(d-l)+ji*2,g=Math.abs(f-u)+ji*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[[0,n.xToPixel(this.points[0].barIndex,r,a),n.yToPixel(this.points[0].price,i,o)],[1,n.xToPixel(this.points[1].barIndex,r,a),n.yToPixel(this.points[1].price,i,o)]];for(let[n,r,i]of s)if(Math.hypot(e-r,t-i)<=ji+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Fi=6;function Ii(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Li=class{constructor(e){this.type=`regressionTrend`,this.id=`reg_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=`#26c6da`,m=Math.hypot(d-l,f-u)||1,h=-(f-u)/m,g=(d-l)/m;e.save(),e.strokeStyle=p,e.fillStyle=p,e.lineWidth=o?1.5:1,e.setLineDash([]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([4,3]),e.beginPath(),e.moveTo(l+h*20,u+g*20),e.lineTo(d+h*20,f+g*20),e.stroke(),e.beginPath(),e.moveTo(l-h*20,u-g*20),e.lineTo(d-h*20,f-g*20),e.stroke(),e.setLineDash([]),e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return Ii(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=Fi}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Fi+2)return{pointIndex:n,cursor:`grab`};return null}},Ri=6,zi=`Text`,Bi=4,Vi=class{constructor(e){this.type=`text`,this.text=``,this.id=`txt_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i),c=t.yToPixel(this.points[0].price,r,a);e.save(),e.font=`13px system-ui, sans-serif`,e.textBaseline=`top`;let l=this.text||zi,u=!this.text,d=e.measureText(l).width;o&&(e.strokeStyle=`#2196f3`,e.lineWidth=1,e.strokeRect(s-2,c-2,d+Bi*2,20)),e.fillStyle=u?`#888`:`#f5f5f5`,e.fillText(l,s+Bi,c),o&&(e.strokeStyle=`#f5f5f5`,e.lineWidth=1,e.beginPath(),e.moveTo(s,c+16),e.lineTo(s+d+Bi*2,c+16),e.stroke()),e.restore()}hitTest(e,t,n,r,i,a,o){var s,c;let l=n.xToPixel(this.points[0].barIndex,r,a),u=n.yToPixel(this.points[0].price,i,o),d=Math.max(40,((s=(c=this.text)==null?void 0:c.length)==null?4:s)*8);return e>=l-Ri&&e<=l+d+Ri&&t>=u-Ri&&t<=u+16+Ri}getHandle(){return null}},Hi=6,Ui=24,Wi=8,Gi=12;function Ki(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function qi(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.lineTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.closePath()}var Ji=class{constructor(e){this.type=`callout`,this.text=``,this.id=`cal_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}getBoxW(e){let t=this.text||`Note`;return Math.max(60,e.measureText(t).width+Gi*2)}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.font=`11px system-ui, sans-serif`,e.lineWidth=o?1.5:1;let p=this.getBoxW(e),m=d-p/2,h=f-Ui/2,g=Math.max(m,Math.min(m+p,l)),_=Math.max(h,Math.min(h+Ui,u)),v=l<m?m:l>m+p?m+p:g,y=u<h?h:u>h+Ui?h+Ui:_;e.strokeStyle=`#546e7a`,e.beginPath(),e.moveTo(v,y),e.lineTo(l,u),e.stroke(),e.fillStyle=`#546e7a`,e.beginPath(),e.arc(l,u,3,0,Math.PI*2),e.fill(),qi(e,m,h,p,Ui,Wi),e.fillStyle=`#37474f`,e.fill(),e.strokeStyle=`#546e7a`,e.stroke();let b=this.text||`Note`;e.fillStyle=this.text?`#f5f5f5`:`#888`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(b,d,f),e.restore()}hitTest(e,t,n,r,i,a,o){var s,c;if(this.points.length<2)return!1;let[l,u]=this.points,d=n.xToPixel(l.barIndex,r,a),f=n.yToPixel(l.price,i,o),p=n.xToPixel(u.barIndex,r,a),m=n.yToPixel(u.price,i,o),h=Math.max(60,((s=(c=this.text)==null?void 0:c.length)==null?4:s)*7+24),g=p-h/2,_=m-Ui/2;return e>=g-Hi&&e<=g+h+Hi&&t>=_-Hi&&t<=_+Ui+Hi||Ki(e,t,d<g?g:d>g+h?g+h:Math.max(g,Math.min(g+h,d)),f<_?_:f>_+Ui?_+Ui:Math.max(_,Math.min(_+Ui,f)),d,f)<=Hi}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}],c=[`grab`,`move`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Hi+4)return{pointIndex:n,cursor:c[n]};return null}},Yi=6,Xi=60,Zi=18,Qi=7,$i=class{constructor(e){this.type=`priceLabel`,this.id=`plbl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o,s=2){let c=t.xToPixel(this.points[0].barIndex,n,i),l=t.yToPixel(this.points[0].price,r,a),u=this.points[0].price;e.save(),e.fillStyle=`#26a69a`,e.beginPath(),e.moveTo(c,l),e.lineTo(c+Qi,l-Zi/2),e.lineTo(c+Qi,l+Zi/2),e.closePath(),e.fill();let d=c+Qi,f=l-Zi/2;e.fillStyle=`#26a69a`,e.beginPath(),e.roundRect(d,f,Xi,Zi,Zi/2),e.fill(),o&&(e.strokeStyle=`#80cbc4`,e.lineWidth=1.5,e.beginPath(),e.roundRect(d-2,f-2,Xi+4,Zi+4,Zi/2+2),e.stroke()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=`#ffffff`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(u.toFixed(s),d+Xi/2,l),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o),l=s+Qi,u=c-Zi/2;return e>=s-Yi&&e<=l+Xi+Yi&&t>=u-Yi&&t<=u+Zi+Yi}getHandle(){return null}},ea=6;function ta(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var na=class{constructor(e){this.type=`arrowMarker`,this.id=`arw_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.strokeStyle=`#ef5350`,e.fillStyle=`#ef5350`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke();let p=Math.atan2(f-u,d-l);if(e.beginPath(),e.moveTo(d,f),e.lineTo(d-10*Math.cos(p-Math.PI/6),f-10*Math.sin(p-Math.PI/6)),e.lineTo(d-10*Math.cos(p+Math.PI/6),f-10*Math.sin(p+Math.PI/6)),e.closePath(),e.fill(),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return ta(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=ea}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=ea+2)return{pointIndex:n,cursor:`grab`};return null}},ra=class{constructor(e){this.type=`flag`,this.id=`flag_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i),c=t.yToPixel(this.points[0].price,r,a);e.save(),e.strokeStyle=`#ef5350`,e.fillStyle=`#ef5350`,e.lineWidth=1.5,e.beginPath(),e.moveTo(s,c+20),e.lineTo(s,c-10),e.stroke();let l=s,u=c-10;e.fillRect(l,u,16,10),e.font=`8px system-ui, sans-serif`,e.fillStyle=`#ffffff`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(`F`,l+8,u+5),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o);return Math.hypot(e-s,t-c)<=20}getHandle(){return null}},ia=6,aa=16,oa=6,sa=10,ca=class{constructor(e){this.type=`priceNote`,this.id=`pnote_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o,s=2){let c=t.xToPixel(this.points[0].barIndex,n,i),l=t.yToPixel(this.points[0].price,r,a),u=this.points[0].price.toFixed(s);e.save(),e.strokeStyle=`#ffa726`,e.lineWidth=1.5,e.beginPath(),e.moveTo(c-sa,l),e.lineTo(c+sa,l),e.stroke(),e.font=`11px 'Inter', system-ui, sans-serif`;let d=e.measureText(u).width+oa*2,f=c+sa+2,p=l-aa/2;e.fillStyle=`#ffa726`,e.beginPath(),e.roundRect(f,p,d,aa,3),e.fill(),e.fillStyle=`#ffffff`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(u,f+d/2,l),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o);return e>=s-sa-ia&&e<=s+sa+ia&&Math.abs(t-c)<=ia}getHandle(){return null}},la=6,ua=20,da=10;function fa(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var pa=class{constructor(e){this.type=`anchoredNote`,this.text=``,this.id=`anote_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}getBadgeW(e){let t=this.text||`Note`;return Math.max(50,e.measureText(t).width+da*2)}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.font=`11px system-ui, sans-serif`,e.lineWidth=o?1.5:1;let p=this.getBadgeW(e),m=d-p/2,h=f-ua/2;e.strokeStyle=`#42a5f5`,e.setLineDash([4,3]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([]),e.fillStyle=`#42a5f5`,e.beginPath(),e.arc(l,u,3,0,Math.PI*2),e.fill(),e.fillStyle=`#37474f`,e.beginPath(),e.roundRect(m,h,p,ua,4),e.fill(),e.strokeStyle=`#42a5f5`,e.lineWidth=o?1.5:1,e.beginPath(),e.roundRect(m,h,p,ua,4),e.stroke();let g=this.text||`Note`;e.fillStyle=this.text?`#f5f5f5`:`#888`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(g,d,f),e.restore()}hitTest(e,t,n,r,i,a,o){var s,c;if(this.points.length<2)return!1;let[l,u]=this.points,d=n.xToPixel(l.barIndex,r,a),f=n.yToPixel(l.price,i,o),p=n.xToPixel(u.barIndex,r,a),m=n.yToPixel(u.price,i,o),h=Math.max(50,((s=(c=this.text)==null?void 0:c.length)==null?4:s)*7+20),g=p-h/2,_=m-ua/2;return e>=g-la&&e<=g+h+la&&t>=_-la&&t<=_+ua+la||fa(e,t,d,f,p,m)<=la}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}],c=[`grab`,`move`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=la+4)return{pointIndex:n,cursor:c[n]};return null}},ma=class{constructor(e){this.type=`arrowUp`,this.id=`awup_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i),c=t.yToPixel(this.points[0].price,r,a);e.save(),e.strokeStyle=`#26a69a`,e.fillStyle=`#26a69a`,e.lineWidth=1.5,e.beginPath(),e.moveTo(s,c+10),e.lineTo(s,c-2),e.stroke();let l=s,u=c-10;e.beginPath(),e.moveTo(l,u),e.lineTo(l-6,u+10),e.lineTo(l+6,u+10),e.closePath(),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o);return Math.hypot(e-s,t-c)<=12}getHandle(){return null}},ha=class{constructor(e){this.type=`arrowDown`,this.id=`awdn_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i),c=t.yToPixel(this.points[0].price,r,a);e.save(),e.strokeStyle=`#ef5350`,e.fillStyle=`#ef5350`,e.lineWidth=1.5,e.beginPath(),e.moveTo(s,c-10),e.lineTo(s,c+2),e.stroke();let l=s,u=c+10;e.beginPath(),e.moveTo(l,u),e.lineTo(l-6,u-10),e.lineTo(l+6,u-10),e.closePath(),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o);return Math.hypot(e-s,t-c)<=12}getHandle(){return null}},ga=6;function _a(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var va=`#ff7043`,ya=class{constructor(e){this.type=`headShoulders`,this.requiredPoints=5,this.id=`hs_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`LS`,`H`,`RS`,`L1`,`L2`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=va,e.lineWidth=o?1.5:1;let d=[0,3,1,4,2].filter(e=>e<u);if(d.length>=2){e.beginPath(),e.moveTo(c[d[0]],l[d[0]]);for(let t=1;t<d.length;t++)e.lineTo(c[d[t]],l[d[t]]);e.stroke()}this.complete&&u===5&&(e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[3],l[3]),e.lineTo(c[1],l[1]),e.lineTo(c[4],l[4]),e.lineTo(c[2],l[2]),e.closePath(),e.fillStyle=va+`10`,e.fill()),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=va,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[3],l[3]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=va;for(let t=0;t<u;t++){var f;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((f=s[t])==null?String(t):f,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length,u=[0,3,1,4,2].filter(e=>e<l);for(let n=0;n<u.length-1;n++){let r=u[n],i=u[n+1];if(_a(e,t,s[r],c[r],s[i],c[i])<=ga)return!0}return l>=5&&_a(e,t,s[3],c[3],s[4],c[4])<=ga}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=ga+2)return{pointIndex:s,cursor:`grab`}}return null}},ba=6;function xa(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Sa=`#ffa726`,Ca=class{constructor(e){this.type=`trianglePattern`,this.requiredPoints=5,this.id=`tpat_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`1`,`2`,`3`,`4`,`5`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Sa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=3&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Sa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[2],l[2]),u>=5&&e.lineTo(c[4],l[4]),e.stroke(),e.restore()),u>=4&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Sa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[1],l[1]),e.lineTo(c[3],l[3]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Sa;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t+1):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(xa(e,t,s[n],c[n],s[n+1],c[n+1])<=ba)return!0;return l>=3&&xa(e,t,s[0],c[0],s[2],c[2])<=ba||l>=5&&xa(e,t,s[2],c[2],s[4],c[4])<=ba||l>=4&&xa(e,t,s[1],c[1],s[3],c[3])<=ba}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=ba+2)return{pointIndex:s,cursor:`grab`}}return null}},wa=6;function Ta(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ea=`#66bb6a`,Da=class{constructor(e){this.type=`threeDrives`,this.requiredPoints=7,this.id=`td_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`O`,`A`,`B`,`C`,`D`,`E`,`F`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Ea,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);if(e.stroke(),this.complete&&u===7){e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.closePath(),e.fillStyle=Ea+`18`,e.fill()}e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Ea;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Ta(e,t,s[n],c[n],s[n+1],c[n+1])<=wa)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=wa+2)return{pointIndex:s,cursor:`grab`}}return null}},Oa=6;function ka(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Aa=`#42a5f5`,ja=class{constructor(e){this.type=`abcdPattern`,this.requiredPoints=4,this.id=`abcd_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Aa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=4&&(e.save(),e.setLineDash([3,4]),e.strokeStyle=Aa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[3],l[3]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Aa;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(ka(e,t,s[n],c[n],s[n+1],c[n+1])<=Oa)return!0;return l>=4&&ka(e,t,s[0],c[0],s[3],c[3])<=Oa}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Oa+2)return{pointIndex:s,cursor:`grab`}}return null}},Ma=6;function Na(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Pa=`#ab47bc`,Fa=class{constructor(e){this.type=`cypherPattern`,this.requiredPoints=5,this.id=`cyp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Pa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);if(e.stroke(),this.complete&&u===5){e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.closePath(),e.fillStyle=Pa+`12`,e.fill()}e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Pa;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Na(e,t,s[n],c[n],s[n+1],c[n+1])<=Ma)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ma+2)return{pointIndex:s,cursor:`grab`}}return null}},Ia=6;function La(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ra=`#ec407a`,za=class{constructor(e){this.type=`butterflyPattern`,this.requiredPoints=5,this.id=`bfly_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Ra,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Ra,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Ra;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(La(e,t,s[n],c[n],s[n+1],c[n+1])<=Ia)return!0;return l>=5&&La(e,t,s[0],c[0],s[4],c[4])<=Ia}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ia+2)return{pointIndex:s,cursor:`grab`}}return null}},Ba=6;function Va(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ha=`#26a69a`,Ua=class{constructor(e){this.type=`batPattern`,this.requiredPoints=5,this.id=`bat_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Ha,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Ha,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Ha;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Va(e,t,s[n],c[n],s[n+1],c[n+1])<=Ba)return!0;return l>=5&&Va(e,t,s[0],c[0],s[4],c[4])<=Ba}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ba+2)return{pointIndex:s,cursor:`grab`}}return null}},Wa=6;function Ga(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ka=`#7986cb`,qa=class{constructor(e){this.type=`gartleyPattern`,this.requiredPoints=5,this.id=`gart_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Ka,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Ka,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Ka;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Ga(e,t,s[n],c[n],s[n+1],c[n+1])<=Wa)return!0;return l>=5&&Ga(e,t,s[0],c[0],s[4],c[4])<=Wa}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Wa+2)return{pointIndex:s,cursor:`grab`}}return null}},Ja=6;function Ya(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Xa=`#ef5350`,Za=class{constructor(e){this.type=`crabPattern`,this.requiredPoints=5,this.id=`crab_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Xa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Xa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Xa;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Ya(e,t,s[n],c[n],s[n+1],c[n+1])<=Ja)return!0;return l>=5&&Ya(e,t,s[0],c[0],s[4],c[4])<=Ja}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ja+2)return{pointIndex:s,cursor:`grab`}}return null}},Qa=6;function $a(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var eo=`#78909c`,to=class{constructor(e){this.type=`sharkPattern`,this.requiredPoints=5,this.id=`shrk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=eo,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=eo,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=eo;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if($a(e,t,s[n],c[n],s[n+1],c[n+1])<=Qa)return!0;return l>=5&&$a(e,t,s[0],c[0],s[4],c[4])<=Qa}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Qa+2)return{pointIndex:s,cursor:`grab`}}return null}},no=6;function ro(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var io=`#29b6f6`,ao=[`0`,`1`,`2`,`3`,`4`,`5`],oo=class{constructor(e){this.type=`elliottImpulse`,this.requiredPoints=6,this.id=`eimp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a)),l=s.length;e.save(),e.lineWidth=o?1.5:1;for(let t=0;t<l-1;t++)e.strokeStyle=t%2==0?io:io+`aa`,e.beginPath(),e.moveTo(s[t],c[t]),e.lineTo(s[t+1],c[t+1]),e.stroke();e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<l;t++){var u;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=io,e.fill(),e.fillStyle=io,e.fillText((u=ao[t])==null?String(t):u,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(ro(e,t,s[n],c[n],s[n+1],c[n+1])<=no)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=no+2)return{pointIndex:s,cursor:`grab`}}return null}},so=6;function co(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var lo=`#ff8a65`,uo=[`0`,`A`,`B`,`C`],fo=class{constructor(e){this.type=`elliottCorrective`,this.requiredPoints=4,this.id=`ecor_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a));e.save(),e.strokeStyle=lo,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<s.length;t++)e.lineTo(s[t],c[t]);e.stroke(),e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<s.length;t++){var l;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=lo,e.fill(),e.fillStyle=lo,e.fillText((l=uo[t])==null?String(t):l,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(co(e,t,s[n],c[n],s[n+1],c[n+1])<=so)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=so+2)return{pointIndex:s,cursor:`grab`}}return null}},po=6;function mo(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var ho=`#aed581`,go=[`A`,`B`,`C`,`D`,`E`,`end`],_o=class{constructor(e){this.type=`elliottTriangle`,this.requiredPoints=6,this.id=`etri_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a)),l=s.length;e.save(),e.strokeStyle=ho,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<l;t++)e.lineTo(s[t],c[t]);e.stroke(),l>=3&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=ho+`aa`,e.lineWidth=1,e.beginPath(),e.moveTo(s[0],c[0]),l>2&&e.lineTo(s[2],c[2]),l>4&&e.lineTo(s[4],c[4]),e.stroke(),e.restore()),l>=4&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=ho+`aa`,e.lineWidth=1,e.beginPath(),e.moveTo(s[1],c[1]),e.lineTo(s[3],c[3]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<l;t++){var u;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=ho,e.fill(),e.fillStyle=ho,e.fillText((u=go[t])==null?String(t):u,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(mo(e,t,s[n],c[n],s[n+1],c[n+1])<=po)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=po+2)return{pointIndex:s,cursor:`grab`}}return null}},vo=6;function yo(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var bo=`#f48fb1`,xo=[`W`,`X`,`Y`,`X2`,`Z`,`X3`,`end`],So=class{constructor(e){this.type=`elliottCombination`,this.requiredPoints=7,this.id=`ecom_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a));e.save(),e.strokeStyle=bo,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<s.length;t++)e.lineTo(s[t],c[t]);e.stroke(),e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<s.length;t++){var l;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=bo,e.fill(),e.fillStyle=bo,e.fillText((l=xo[t])==null?String(t):l,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(yo(e,t,s[n],c[n],s[n+1],c[n+1])<=vo)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=vo+2)return{pointIndex:s,cursor:`grab`}}return null}},Co=6;function wo(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var To=`#80cbc4`,Eo=[`W`,`X`,`Y`,`end`],Do=class{constructor(e){this.type=`elliottWxy`,this.requiredPoints=4,this.id=`ewxy_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a));e.save(),e.strokeStyle=To,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<s.length;t++)e.lineTo(s[t],c[t]);e.stroke(),e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<s.length;t++){var l;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=To,e.fill(),e.fillStyle=To,e.fillText((l=Eo[t])==null?String(t):l,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(wo(e,t,s[n],c[n],s[n+1],c[n+1])<=Co)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Co+2)return{pointIndex:s,cursor:`grab`}}return null}},Oo=8;function ko(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ao=class{constructor(e){this.type=`brush`,this.openEnded=!0,this.id=`brush_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>({x:t.xToPixel(e.barIndex,n,i),y:t.yToPixel(e.price,r,a)})),c=this.complete?s.length:s.length-1;if(e.save(),e.strokeStyle=`#ff5722`,e.lineWidth=o?2.5:2,e.lineCap=`round`,e.lineJoin=`round`,c>=2){e.setLineDash([]),e.beginPath(),e.moveTo(s[0].x,s[0].y);for(let t=1;t<c;t++)e.lineTo(s[t].x,s[t].y);e.stroke()}if(!this.complete&&s.length>=2){let t=s.length-1;e.setLineDash([4,4]),e.beginPath(),e.moveTo(s[t-1].x,s[t-1].y),e.lineTo(s[t].x,s[t].y),e.stroke(),e.setLineDash([])}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>({x:n.xToPixel(e.barIndex,r,a),y:n.yToPixel(e.price,i,o)})),c=this.complete?s.length-1:s.length-2;for(let n=0;n<c;n++)if(ko(e,t,s[n].x,s[n].y,s[n+1].x,s[n+1].y)<=Oo)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length===0)return null;let s=[0,this.points.length-1];for(let c of s){let s=n.xToPixel(this.points[c].barIndex,r,a),l=n.yToPixel(this.points[c].price,i,o);if(Math.hypot(e-s,t-l)<=Oo+2)return{pointIndex:c,cursor:`grab`}}return null}},jo=12;function Mo(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var No=class{constructor(e){this.type=`highlighter`,this.openEnded=!0,this.id=`hl2_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>({x:t.xToPixel(e.barIndex,n,i),y:t.yToPixel(e.price,r,a)})),c=this.complete?s.length:s.length-1;if(e.save(),e.strokeStyle=`#ffeb3b66`,e.lineWidth=12,e.lineCap=`round`,e.lineJoin=`round`,c>=2){e.setLineDash([]),e.beginPath(),e.moveTo(s[0].x,s[0].y);for(let t=1;t<c;t++)e.lineTo(s[t].x,s[t].y);e.stroke()}if(!this.complete&&s.length>=2){let t=s.length-1;e.setLineDash([8,6]),e.beginPath(),e.moveTo(s[t-1].x,s[t-1].y),e.lineTo(s[t].x,s[t].y),e.stroke(),e.setLineDash([])}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>({x:n.xToPixel(e.barIndex,r,a),y:n.yToPixel(e.price,i,o)})),c=this.complete?s.length-1:s.length-2;for(let n=0;n<c;n++)if(Mo(e,t,s[n].x,s[n].y,s[n+1].x,s[n+1].y)<=jo)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length===0)return null;let s=[0,this.points.length-1];for(let c of s){let s=n.xToPixel(this.points[c].barIndex,r,a),l=n.yToPixel(this.points[c].price,i,o);if(Math.hypot(e-s,t-l)<=jo+2)return{pointIndex:c,cursor:`grab`}}return null}},Po=6,Fo=class{constructor(e){this.type=`sineLine`,this.id=`sine_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=d-l,m=Math.abs(f-u)/2,h=(u+f)/2;if(e.save(),e.strokeStyle=`#ce93d8`,e.lineWidth=o?1.5:1,e.beginPath(),Math.abs(p)<1)e.moveTo(l,u),e.lineTo(d,f);else{e.moveTo(l,h+m*Math.sin(0));let t=p>0?1:-1,n=d;for(let r=l+t;p>0?r<=n:r>=n;r+=t){let t=(r-l)/p,n=h+m*Math.sin(2*Math.PI*t);e.lineTo(r,n)}e.lineTo(d,h+m*Math.sin(2*Math.PI))}e.stroke(),e.fillStyle=`#ce93d8`;for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=d-l,m=Math.abs(f-u)/2,h=(u+f)/2;if(Math.abs(p)<1)return Math.hypot(e-l,t-h)<=Po;let g=p>0?5:-5,_=l,v=h+m*Math.sin(0);for(let n=l+g;p>0?n<=d+Math.abs(g):n>=d-Math.abs(g);n+=g){let r=p>0?Math.min(n,d):Math.max(n,d),i=(r-l)/p,a=h+m*Math.sin(2*Math.PI*i);if(Math.hypot(e-r,t-a)<=Po)return!0;let o=r-_,s=a-v,c=o*o+s*s;if(c>0){let n=Math.max(0,Math.min(1,((e-_)*o+(t-v)*s)/c)),r=_+n*o,i=v+n*s;if(Math.hypot(e-r,t-i)<=Po)return!0}if(_=r,v=a,r===d)break}return!1}getHandle(e,t,n,r,i,a,o){let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Po+2)return{pointIndex:n,cursor:`grab`};return null}},Io=6,Lo=class{constructor(e){this.type=`cyclicLines`,this.id=`cyc_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=Math.abs(c.barIndex-s.barIndex);if(l===0)return;let u=t.xToPixel(s.barIndex,n,i),d=`#7986cb`;e.save(),e.strokeStyle=d,e.lineWidth=o?1.5:1,e.setLineDash([4,3]);for(let r=0;r<=8;r++){let o=s.barIndex+l*r,c=t.xToPixel(o,n,i);if(c>i)break;e.beginPath(),e.moveTo(c,0),e.lineTo(c,a),e.stroke()}e.setLineDash([]);let f=t.xToPixel(c.barIndex,n,i);e.fillStyle=d,e.beginPath(),e.arc(u,a/2,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(f,a/2,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=Math.abs(c.barIndex-s.barIndex);if(l===0)return!1;for(let t=0;t<=8;t++){let i=s.barIndex+l*t,o=n.xToPixel(i,r,a);if(o>a)break;if(Math.abs(e-o)<=Io)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:o/2},{px:n.xToPixel(this.points[1].barIndex,r,a),py:o/2}],c=[`move`,`ew-resize`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Io+2)return{pointIndex:n,cursor:c[n]};return null}},Ro=6,zo=class{constructor(e){this.type=`timeCycles`,this.id=`tcy_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=Math.abs(c.barIndex-s.barIndex);if(l===0)return;let u=`#80cbc4`;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1;let d=[];for(let e=0;e<=6;e++){let r=s.barIndex+l*e,a=t.xToPixel(r,n,i);if(a>i)break;d.push(a)}for(let t=0;t+1<d.length;t++)t%2==0&&(e.fillStyle=`#80cbc410`,e.fillRect(d[t],0,d[t+1]-d[t],a));e.strokeStyle=u,e.setLineDash([]);for(let t=0;t<d.length;t++)e.beginPath(),e.moveTo(d[t],0),e.lineTo(d[t],a),e.stroke(),e.fillStyle=u,e.fillText(String(t+1),d[t]+3,14);let f=t.xToPixel(s.barIndex,n,i),p=t.xToPixel(c.barIndex,n,i);e.fillStyle=u,e.beginPath(),e.arc(f,a/2,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(p,a/2,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=Math.abs(c.barIndex-s.barIndex);if(l===0)return!1;for(let t=0;t<=6;t++){let i=s.barIndex+l*t,o=n.xToPixel(i,r,a);if(o>a)break;if(Math.abs(e-o)<=Ro)return!0;if(t<6){let i=s.barIndex+l*(t+1),c=n.xToPixel(i,r,a);if(e>=o&&e<=c)return!0}}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:o/2},{px:n.xToPixel(this.points[1].barIndex,r,a),py:o/2}],c=[`move`,`ew-resize`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Ro+2)return{pointIndex:n,cursor:c[n]};return null}},Bo=6;function Vo(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ho=class{constructor(e){this.type=`projection`,this.id=`proj_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=`#78909c`,m=d-l,h,g;if(Math.abs(m)<.001)h=d,g=f+(f-u);else{let e=(f-u)/m;h=i,g=f+e*(i-d)}e.save(),e.strokeStyle=p,e.fillStyle=p,e.lineWidth=o?1.5:1,e.setLineDash([]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([6,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(h,g),e.stroke(),e.setLineDash([]),e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=d-l,m,h;if(Math.abs(p)<.001)m=d,h=f+(f-u);else{let e=(f-u)/p;m=a,h=f+e*(a-d)}return Vo(e,t,l,u,d,f)<=Bo||Vo(e,t,d,f,m,h)<=Bo}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Bo+2)return{pointIndex:n,cursor:`grab`};return null}},Uo=6;function Wo(e,t,n,r,i,a=7){let o=Math.atan2(i-n,r-t);e.beginPath(),e.moveTo(r,i),e.lineTo(r-a*Math.cos(o-Math.PI/6),i-a*Math.sin(o-Math.PI/6)),e.lineTo(r-a*Math.cos(o+Math.PI/6),i-a*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var Go=class{constructor(e){this.type=`priceProjection`,this.id=`pp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=t.xToPixel(c.barIndex,n,i),d=t.yToPixel(c.price,r,a),f=t.xToPixel(l.barIndex,n,i),p=t.yToPixel(l.price,r,a),m=Math.min(u,f),h=Math.max(u,f),g=Math.min(d,p),_=Math.max(d,p),v=h-m,y=_-g,b=m+v/2;g+y/2;let x=(c.price+l.price)/2,S=`#ef9a9a`;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.fillStyle=`#ef9a9a18`,e.fillRect(m,g,v,y),e.strokeStyle=S,e.beginPath(),e.moveTo(m,d),e.lineTo(h,d),e.stroke();let C=t.yToPixel(x,r,a);e.beginPath(),e.moveTo(m,C),e.lineTo(h,C),e.stroke(),e.beginPath(),e.moveTo(m,p),e.lineTo(h,p),e.stroke(),e.fillStyle=S,e.fillText(c.price.toFixed(s),h+4,d+4),e.fillText(x.toFixed(s),h+4,C+4),e.fillText(l.price.toFixed(s),h+4,p+4),e.fillStyle=S,e.beginPath(),e.moveTo(b,g),e.lineTo(b,_),e.stroke(),Wo(e,b,_,b,g),Wo(e,b,g,b,_),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o);return e>=Math.min(l,d)&&e<=Math.max(l,d)&&t>=Math.min(u,f)&&t<=Math.max(u,f)}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Uo+2)return{pointIndex:n,cursor:`ns-resize`};return null}},Ko=6,qo=`#90a4ae`,Jo=class{constructor(e){this.type=`ghostFeed`,this.id=`gfeed_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);e.save(),e.fillStyle=qo+`08`,e.fillRect(p,m,h,g),e.strokeStyle=qo,e.lineWidth=o?1.5:1,e.setLineDash([6,4]),e.strokeRect(p,m,h,g),e.setLineDash([]),e.save(),e.beginPath(),e.rect(p,m,h,g),e.clip(),e.strokeStyle=qo+`30`,e.lineWidth=1,e.setLineDash([4,4]);let _=h+g;for(let t=-g;t<=_;t+=20){let n=p+t,r=m,i=p+t+g,a=m+g;e.beginPath(),e.moveTo(n,r),e.lineTo(i,a),e.stroke()}if(e.setLineDash([]),e.restore(),e.font=`12px 'Inter', system-ui, sans-serif`,e.fillStyle=qo,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(`Ghost Feed`,p+h/2,m+g/2),o){e.textAlign=`left`,e.textBaseline=`alphabetic`;for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=qo,e.fill()}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-Ko,m=Math.min(u,f)-Ko,h=Math.abs(d-l)+Ko*2,g=Math.abs(f-u)+Ko*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[[0,n.xToPixel(this.points[0].barIndex,r,a),n.yToPixel(this.points[0].price,i,o)],[1,n.xToPixel(this.points[1].barIndex,r,a),n.yToPixel(this.points[1].price,i,o)]];for(let[n,r,i]of s)if(Math.hypot(e-r,t-i)<=Ko+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Yo=new Set([`text`,`callout`,`anchoredNote`]),Xo=class{constructor(){this.drawings=[],this.activeDrawing=null,this.selectedDrawing=null,this.activeTool=null,this.state=`idle`,this.history=[],this.redoStack=[],this.onCompleteCallback=null,this.onDrawingsChange=null,this.onStartTextEdit=null,this.editingText=!1,this.dragDrawing=null,this.dragStartMouse=null,this.dragStartPoints=null,this.resizeDrawing=null,this.resizePointIndex=-1}setOnComplete(e){this.onCompleteCallback=e}setEditingText(e){this.editingText=e}setActiveTool(e){this.state===`placing`&&this.activeDrawing&&this.drawings.pop(),this.activeTool=e,this.state=`idle`,this.activeDrawing=null}getActiveTool(){return this.activeTool}onMouseDown(e){if(!this.activeTool)return!1;if(this.state===`idle`){if(this.snapshot(),this.activeDrawing=this.createDrawing(this.activeTool,e),this.drawings.push(this.activeDrawing),this.activeDrawing.complete){var t;let e=this.activeDrawing;if(this.selectedDrawing=e,this.activeDrawing=null,this.activeTool=null,(t=this.onCompleteCallback)==null||t.call(this),this.notifyChange(),Yo.has(e.type)){var n;(n=this.onStartTextEdit)==null||n.call(this,e)}}else this.state=`placing`;return!0}if(this.state===`placing`&&this.activeDrawing){var r,i,a;if((r=this.activeDrawing.openEnded)!=null&&r){let t=this.activeDrawing.points.length-1;return this.activeDrawing.points[t]={...e},this.activeDrawing.points.push({...e}),!0}let t=(i=this.activeDrawing.requiredPoints)==null?2:i,n=this.activeDrawing.points.length;if(this.activeDrawing.points[n-1]={...e},n<t)return this.activeDrawing.points.push({...e}),!0;this.activeDrawing.complete=!0;let s=this.activeDrawing;if(this.selectedDrawing=s,this.activeDrawing=null,this.state=`idle`,this.activeTool=null,(a=this.onCompleteCallback)==null||a.call(this),this.notifyChange(),Yo.has(s.type)){var o;(o=this.onStartTextEdit)==null||o.call(this,s)}return!0}return!1}onMouseMove(e){if(this.state===`placing`&&this.activeDrawing){let t=this.activeDrawing.points.length-1;this.activeDrawing.points[t]=e}if(this.dragDrawing&&this.dragStartMouse&&this.dragStartPoints){let t=e.barIndex-this.dragStartMouse.barIndex,n=e.price-this.dragStartMouse.price;for(let e=0;e<this.dragDrawing.points.length;e++)this.dragDrawing.points[e]={barIndex:this.dragStartPoints[e].barIndex+t,price:this.dragStartPoints[e].price+n}}this.resizeDrawing&&this.resizePointIndex>=0&&(this.resizeDrawing.points[this.resizePointIndex]={...e})}finalizePlacing(){var e,t;if(!(this.state!==`placing`||!this.activeDrawing)&&(e=this.activeDrawing.openEnded)!=null&&e){if(this.activeDrawing.points.length>2&&this.activeDrawing.points.pop(),this.activeDrawing.points.length<2){this.drawings.pop(),this.activeDrawing=null,this.state=`idle`,this.activeTool=null;return}this.activeDrawing.complete=!0,this.selectedDrawing=this.activeDrawing,this.activeDrawing=null,this.state=`idle`,this.activeTool=null,(t=this.onCompleteCallback)==null||t.call(this),this.notifyChange()}}startDrag(e,t){this.snapshot(),this.dragDrawing=e,this.dragStartMouse={...t},this.dragStartPoints=e.points.map(e=>({...e}))}endDrag(){this.dragDrawing=null,this.dragStartMouse=null,this.dragStartPoints=null,this.notifyChange()}isDraggingDrawing(){return this.dragDrawing!==null}isPlacing(){return this.state===`placing`}startResize(e,t){this.snapshot(),this.resizeDrawing=e,this.resizePointIndex=t}endResize(){this.resizeDrawing=null,this.resizePointIndex=-1,this.notifyChange()}isResizingDrawing(){return this.resizeDrawing!==null}shiftBarIndices(e){for(let t of this.drawings)for(let n of t.points)n.barIndex+=e;if(this.dragStartPoints)for(let t of this.dragStartPoints)t.barIndex+=e}getHandleAtPoint(e,t,n,r,i,a,o){for(let s=this.drawings.length-1;s>=0;s--){let c=this.drawings[s];if(!c.complete||c.visible===!1||c.locked)continue;let l=c.getHandle(e,t,n,r,i,a,o);if(l)return{drawing:c,handle:l}}return null}hitTest(e,t,n,r,i,a,o){for(let s=this.drawings.length-1;s>=0;s--){let c=this.drawings[s];if(!(c.visible===!1||c.locked)&&c.hitTest(e,t,n,r,i,a,o))return c}return null}selectDrawing(e){this.selectedDrawing=e}getSelectedDrawing(){return this.selectedDrawing}onKeyDown(e){return e===`Escape`?(this.state===`placing`&&this.activeDrawing&&(this.drawings.pop(),this.activeDrawing=null,this.state=`idle`),this.activeTool=null,this.selectedDrawing=null,!0):(e===`Delete`||e===`Backspace`)&&this.selectedDrawing&&!this.editingText?(this.deleteSelected(),!0):e===`z`&&this.history.length>0?(this.undo(),!0):!1}deleteSelected(){this.selectedDrawing&&(this.snapshot(),this.drawings=this.drawings.filter(e=>e!==this.selectedDrawing),this.selectedDrawing=null,this.notifyChange())}undo(){let e=this.history.pop();e!==void 0&&(this.redoStack.push(this.cloneDrawings(this.drawings)),this.drawings=e,this.selectedDrawing=null,this.notifyChange())}redo(){let e=this.redoStack.pop();e!==void 0&&(this.history.push(this.cloneDrawings(this.drawings)),this.drawings=e,this.selectedDrawing=null,this.notifyChange())}hideAll(){if(this.drawings.length!==0){this.snapshot();for(let e of this.drawings)e.visible=!1;this.selectedDrawing=null,this.notifyChange()}}showAll(){if(this.drawings.length!==0){this.snapshot();for(let e of this.drawings)e.visible=!0;this.notifyChange()}}lockAll(){if(this.drawings.length!==0){this.snapshot();for(let e of this.drawings)e.locked=!0;this.selectedDrawing=null,this.notifyChange()}}unlockAll(){if(this.drawings.length!==0){this.snapshot();for(let e of this.drawings)e.locked=!1;this.notifyChange()}}render(e,t,n,r,i,a,o=2){if(e.clearRect(0,0,e.canvas.width,e.canvas.height),this.drawings.length===0)return;let s=window.devicePixelRatio||1;e.save(),e.scale(s,s);for(let s of this.drawings)s.visible!==!1&&s.render(e,t,n,r,i,a,s===this.selectedDrawing,o);e.restore()}getDrawings(){return[...this.drawings]}getDrawingsSnapshot(){return this.drawings.map(e=>({id:e.id,type:e.type,points:e.points.map(e=>({...e})),complete:e.complete,...e.visible!==void 0&&{visible:e.visible},...e.locked!==void 0&&{locked:e.locked},...e.text!==void 0&&{text:e.text}}))}loadDrawings(e){this.drawings=e.map(e=>{var t;let n=this.createDrawing(e.type,(t=e.points[0])==null?{barIndex:0,price:0}:t);return n.id=e.id,n.points=e.points.map(e=>({...e})),n.complete=e.complete,e.visible!==void 0&&(n.visible=e.visible),e.locked!==void 0&&(n.locked=e.locked),e.text!==void 0&&(n.text=e.text),n}),this.selectedDrawing=null,this.activeDrawing=null,this.history=[this.drawings.map(e=>({...e,points:e.points.map(e=>({...e}))}))],this.redoStack=[]}clearAll(){this.drawings.length!==0&&(this.snapshot(),this.drawings=[],this.selectedDrawing=null,this.activeDrawing=null,this.notifyChange())}notifyChange(){var e;(e=this.onDrawingsChange)==null||e.call(this)}snapshot(){this.history.push(this.cloneDrawings(this.drawings)),this.history.length>50&&this.history.shift(),this.redoStack=[]}cloneDrawings(e){return e.map(e=>{let t=Object.create(Object.getPrototypeOf(e));return Object.assign(t,e),t.points=e.points.map(e=>({...e})),t})}createDrawing(e,t){switch(e){case`horizontalLine`:return new xn(t);case`verticalLine`:return new Cn(t);case`trendLine`:return new En(t);case`trendAngle`:return new kn(t);case`crossLine`:return new jn(t);case`parallelChannel`:return new Pn(t);case`flatChannel`:return new Ln(t);case`disjointChannel`:return new Bn(t);case`fibRetracement`:return new Wn(t);case`fibExtension`:return new Jn(t);case`fibChannel`:return new $n(t);case`fibTimezone`:return new nr(t);case`fibCircles`:return new or(t);case`fibSpiral`:return new lr(t);case`fibFan`:return new hr(t);case`fibProjection`:return new yr(t);case`gannFan`:return new Cr(t);case`gannSquare`:return new Tr(t);case`gannBox`:return new Dr(t);case`rectangle`:return new kr(t);case`rotatedRectangle`:return new Mr(t);case`ellipse`:return new Pr(t);case`triangle`:return new Lr(t);case`circle`:return new zr(t);case`arc`:return new Hr(t);case`polyline`:return new Gr(t);case`path`:return new Jr(t);case`priceRange`:return new Zr(t);case`dateRange`:return new ei(t);case`datePriceRange`:return new ri(t);case`ruler`:return new oi(t);case`pitchfork`:return new ui(t);case`schiffPitchfork`:return new mi(t);case`modifiedSchiff`:return new vi(t);case`insidePitchfork`:return new Si(t);case`fixedRangeVP`:return new Ei(t);case`anchoredVP`:return new Ai(t);case`volumeProfile`:return new Pi(t);case`regressionTrend`:return new Li(t);case`text`:return new Vi(t);case`callout`:return new Ji(t);case`priceLabel`:return new $i(t);case`arrowMarker`:return new na(t);case`flag`:return new ra(t);case`priceNote`:return new ca(t);case`anchoredNote`:return new pa(t);case`arrowUp`:return new ma(t);case`arrowDown`:return new ha(t);case`headShoulders`:return new ya(t);case`trianglePattern`:return new Ca(t);case`threeDrives`:return new Da(t);case`abcdPattern`:return new ja(t);case`cypherPattern`:return new Fa(t);case`butterflyPattern`:return new za(t);case`batPattern`:return new Ua(t);case`gartleyPattern`:return new qa(t);case`crabPattern`:return new Za(t);case`sharkPattern`:return new to(t);case`elliottImpulse`:return new oo(t);case`elliottCorrective`:return new fo(t);case`elliottTriangle`:return new _o(t);case`elliottCombination`:return new So(t);case`elliottWxy`:return new Do(t);case`brush`:return new Ao(t);case`highlighter`:return new No(t);case`sineLine`:return new Fo(t);case`cyclicLines`:return new Lo(t);case`timeCycles`:return new zo(t);case`projection`:return new Ho(t);case`priceProjection`:return new Go(t);case`ghostFeed`:return new Jo(t);default:return new En(t)}}},Zo=2,Qo=class{constructor(e,t=y,n=C.chart){this.pills=new Map,this.isOpen=!1,this.onDocClick=e=>{this.isOpen&&!this.el.contains(e.target)&&(this.isOpen=!1,this.dropdownPanel.style.display=`none`,this.collapseBtn.textContent=this.labels.nIndicators.replace(`{count}`,String(this.pills.size)))},this.theme=e,this.cfg=t,this.labels=n,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`absolute`,top:`52px`,left:`6px`,zIndex:`10`,display:`none`,alignItems:`center`,gap:`10px`,pointerEvents:`auto`}),this.inlineRow=document.createElement(`div`),Object.assign(this.inlineRow.style,{display:`flex`,alignItems:`center`,gap:`10px`}),this.collapseBtn=document.createElement(`button`),Object.assign(this.collapseBtn.style,{display:`none`,alignItems:`center`,gap:`4px`,background:this.theme.indicatorOverlay.pillBg,color:this.theme.axisText,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`4px`,padding:`2px 8px`,fontSize:this.cfg.collapseBtnFontSize,fontFamily:this.cfg.collapseBtnFontFamily,cursor:`pointer`,outline:`none`}),this.collapseBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleDropdown()}),this.dropdownPanel=document.createElement(`div`),Object.assign(this.dropdownPanel.style,{display:`none`,position:`absolute`,top:`100%`,left:`0`,marginTop:`4px`,background:this.theme.tooltip.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`4px`,padding:`4px 0`,minWidth:`140px`,zIndex:`20`,boxShadow:`0 4px 12px rgba(0,0,0,0.15)`});let r=document.createElement(`div`);Object.assign(r.style,{position:`relative`}),r.append(this.collapseBtn,this.dropdownPanel),this.el.append(this.inlineRow,r),document.addEventListener(`click`,this.onDocClick)}addPill(e,t,n,r=`Chart`,i=!0,a,o=null,s){this.pills.has(e)||(this.pills.set(e,{color:t,label:n,timeframe:r,visible:i,onRemove:a,onEdit:o,onToggleVisibility:s}),this.refresh())}updatePillColor(e,t){let n=this.pills.get(e);n&&(n.color=t,this.refresh())}updatePillLabel(e,t){let n=this.pills.get(e);n&&(n.label=t,this.refresh())}updatePillTimeframe(e,t){let n=this.pills.get(e);n&&(n.timeframe=t,this.refresh())}updatePillVisibility(e,t){let n=this.pills.get(e);n&&(n.visible=t,this.refresh())}removePill(e){this.pills.has(e)&&(this.pills.delete(e),this.refresh())}setTheme(e){this.theme=e,Object.assign(this.collapseBtn.style,{background:e.indicatorOverlay.pillBg,color:e.axisText,border:`1px solid ${e.axisBorder}`}),Object.assign(this.dropdownPanel.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`}),this.refresh()}destroy(){document.removeEventListener(`click`,this.onDocClick)}refresh(){let e=Array.from(this.pills.entries());if(this.inlineRow.innerHTML=``,this.dropdownPanel.innerHTML=``,e.length===0){this.el.style.display=`none`,this.collapseBtn.style.display=`none`;return}if(this.el.style.display=`flex`,e.length<=Zo){this.isOpen=!1,this.dropdownPanel.style.display=`none`,this.collapseBtn.style.display=`none`;for(let[t,n]of e)this.inlineRow.appendChild(this.makePill(t,n))}else{this.collapseBtn.style.display=`inline-flex`,this.collapseBtn.textContent=this.labels.nIndicators.replace(`{count}`,String(e.length));for(let[t,n]of e)this.dropdownPanel.appendChild(this.makeDropdownRow(t,n));this.dropdownPanel.style.display=this.isOpen?`block`:`none`}}makeTimeframeBadge(e){if(!e||e===`Chart`)return null;let t=document.createElement(`span`);return t.textContent=e,Object.assign(t.style,{fontSize:`10px`,padding:`1px 4px`,borderRadius:`3px`,background:`rgba(128,128,128,0.18)`,color:this.theme.axisText,marginLeft:`2px`,lineHeight:`1.4`}),t}makeEyeIcon(e){let t=document.createElement(`span`);return t.innerHTML=e.visible?Ut:Wt,Object.assign(t.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`,opacity:e.visible?`0.6`:`0.4`,lineHeight:`1`}),t.addEventListener(`mouseenter`,()=>{t.style.opacity=`1`}),t.addEventListener(`mouseleave`,()=>{t.style.opacity=e.visible?`0.6`:`0.4`}),t.addEventListener(`click`,t=>{t.stopPropagation(),e.onToggleVisibility()}),t}makePill(e,t){let n=document.createElement(`span`);Object.assign(n.style,{display:`inline-flex`,alignItems:`center`,gap:`4px`,fontSize:this.cfg.pillFontSize,fontFamily:this.cfg.pillFontFamily,color:t.color,whiteSpace:`nowrap`,userSelect:`none`,background:this.theme.indicatorOverlay.pillBg,borderRadius:`4px`,padding:`1px 6px 1px 5px`,opacity:t.visible?`1`:`0.4`});let r=document.createElement(`span`);r.innerHTML=Qt,Object.assign(r.style,{display:`inline-flex`,alignItems:`center`});let i=document.createElement(`span`);i.textContent=t.label;let a=this.makeTimeframeBadge(t.timeframe),o=document.createElement(`span`);if(Object.assign(o.style,{display:`inline-flex`,alignItems:`center`,gap:`8px`,marginLeft:`12px`}),o.appendChild(this.makeEyeIcon(t)),t.onEdit){let e=document.createElement(`span`);e.innerHTML=Nt,Object.assign(e.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`,opacity:`0.6`,lineHeight:`1`}),e.addEventListener(`mouseenter`,()=>{e.style.opacity=`1`}),e.addEventListener(`mouseleave`,()=>{e.style.opacity=`0.6`}),e.addEventListener(`click`,e=>{e.stopPropagation(),t.onEdit()}),o.appendChild(e)}let s=document.createElement(`span`);return s.innerHTML=Ft,Object.assign(s.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`}),s.addEventListener(`click`,e=>{e.stopPropagation(),t.onRemove()}),o.appendChild(s),n.append(r,i),a&&n.appendChild(a),n.appendChild(o),n}makeDropdownRow(e,t){let n=document.createElement(`div`);Object.assign(n.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`8px`,padding:`4px 10px`,fontSize:this.cfg.dropdownRowFontSize,fontFamily:this.cfg.dropdownRowFontFamily,color:t.color,cursor:`default`,opacity:t.visible?`1`:`0.4`}),n.addEventListener(`mouseenter`,()=>{n.style.background=this.theme.indicatorOverlay.dropdownHoverBg}),n.addEventListener(`mouseleave`,()=>{n.style.background=`transparent`});let r=document.createElement(`span`);r.innerHTML=Qt,Object.assign(r.style,{display:`inline-flex`,alignItems:`center`});let i=document.createElement(`span`);Object.assign(i.style,{display:`inline-flex`,alignItems:`center`,gap:`4px`,flex:`1`});let a=document.createElement(`span`);a.textContent=t.label,i.appendChild(a);let o=this.makeTimeframeBadge(t.timeframe);o&&i.appendChild(o);let s=document.createElement(`span`);Object.assign(s.style,{display:`inline-flex`,alignItems:`center`,gap:`4px`});let c=document.createElement(`span`);if(c.innerHTML=t.visible?Ut:Wt,Object.assign(c.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`,opacity:t.visible?`0.6`:`0.4`,lineHeight:`1`}),c.addEventListener(`mouseenter`,()=>{c.style.opacity=`1`}),c.addEventListener(`mouseleave`,()=>{c.style.opacity=t.visible?`0.6`:`0.4`}),c.addEventListener(`click`,e=>{e.stopPropagation(),t.onToggleVisibility()}),s.appendChild(c),t.onEdit){let e=document.createElement(`span`);e.innerHTML=Nt,Object.assign(e.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`,opacity:`0.6`,lineHeight:`1`}),e.addEventListener(`mouseenter`,()=>{e.style.opacity=`1`}),e.addEventListener(`mouseleave`,()=>{e.style.opacity=`0.6`}),e.addEventListener(`click`,e=>{e.stopPropagation(),this.isOpen=!1,this.dropdownPanel.style.display=`none`,t.onEdit()}),s.appendChild(e)}let l=document.createElement(`span`);return l.innerHTML=Ft,Object.assign(l.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`}),l.addEventListener(`click`,e=>{e.stopPropagation(),t.onRemove()}),s.appendChild(l),n.append(r,i,s),n}toggleDropdown(){this.isOpen=!this.isOpen,this.dropdownPanel.style.display=this.isOpen?`block`:`none`,this.collapseBtn.textContent=this.labels.nIndicators.replace(`{count}`,String(this.pills.size))}},$o=class{constructor(e,t=C.dialogs,n){this.schema=null,this.currentParams={},this.onUpdate=null,this.onRemove=null,this.inputRefs=new Map,this.disposeKbd=()=>{},this.theme=e,this.labels=t,this.onVisibilityChange=n,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`fixed`,inset:`0`,background:`rgba(0,0,0,0.5)`,display:`none`,alignItems:`center`,justifyContent:`center`,zIndex:`1000`}),this.el.addEventListener(`mousedown`,e=>{e.target===this.el&&this.hide()}),this.panel=document.createElement(`div`),Object.assign(this.panel.style,{display:`flex`,flexDirection:`column`,minWidth:`300px`,maxWidth:`360px`,background:this.theme.tooltip.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`6px`,boxShadow:`0 8px 32px rgba(0,0,0,0.45)`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:`12px`,overflow:`hidden`}),this.panel.addEventListener(`mousedown`,e=>e.stopPropagation()),this.el.appendChild(this.panel),this.disposeKbd=cn(this.panel)}show(e,t,n,r){var i;let a=this.isVisible;this.schema=e,this.currentParams={...t},this.onUpdate=n,this.onRemove=r,this.rebuild(),this.el.style.display=`flex`,a||(i=this.onVisibilityChange)==null||i.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,this.schema=null,this.onUpdate=null,this.onRemove=null,t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setTheme(e){this.theme=e,Object.assign(this.panel.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`}),this.el.style.display!==`none`&&this.schema&&this.rebuild()}destroy(){this.disposeKbd(),this.el.remove()}rebuild(){this.panel.innerHTML=``,this.inputRefs.clear(),this.schema&&(this.panel.appendChild(this.buildHeader(this.schema.shortName)),this.panel.appendChild(this.buildBody(this.schema.fields)),this.panel.appendChild(this.buildFooter()))}buildHeader(e){let t=document.createElement(`div`);Object.assign(t.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`10px 14px`,borderBottom:`1px solid ${this.theme.axisBorder}`});let n=document.createElement(`span`);n.textContent=`${e} ${this.labels.indicator.titleSuffix}`,Object.assign(n.style,{color:this.theme.tooltip.text,fontWeight:`600`,fontSize:`13px`});let r=document.createElement(`span`);return r.innerHTML=Ft,Object.assign(r.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.axisText,cursor:`pointer`}),r.addEventListener(`mouseenter`,()=>{r.style.color=this.theme.tooltip.text}),r.addEventListener(`mouseleave`,()=>{r.style.color=this.theme.axisText}),r.addEventListener(`click`,()=>this.hide()),t.append(n,r),t}buildBody(e){let t=document.createElement(`div`);if(Object.assign(t.style,{padding:`12px 14px`,display:`flex`,flexDirection:`column`,gap:`8px`}),e.length===0){let e=document.createElement(`span`);return e.textContent=this.labels.indicator.noParams,Object.assign(e.style,{color:this.theme.axisText,fontSize:`11px`}),t.appendChild(e),t}for(let n of e)t.appendChild(this.buildField(n));return t}buildField(e){var t;let n=document.createElement(`div`);Object.assign(n.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`10px`});let r=document.createElement(`label`);r.textContent=e.label,Object.assign(r.style,{color:this.theme.axisText,fontSize:`12px`,flex:`1`});let i=(t=this.currentParams[e.key])==null?e.default:t;if(e.kind===`number`){let t=document.createElement(`input`);t.type=`number`,t.min=String(e.min),t.max=String(e.max),t.step=String(e.step),t.value=String(i),Object.assign(t.style,{width:`80px`,background:this.theme.background,color:this.theme.tooltip.text,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`3px`,padding:`4px 6px`,fontSize:`16px`,fontFamily:`'Inter', system-ui, sans-serif`,outline:`none`,textAlign:`right`}),this.inputRefs.set(e.key,t),n.append(r,t)}else if(e.kind===`select`){let t=document.createElement(`select`);for(let n of e.options){let e=document.createElement(`option`);e.value=n,e.textContent=n,n===String(i)&&(e.selected=!0),t.appendChild(e)}Object.assign(t.style,{minWidth:`120px`,background:this.theme.background,color:this.theme.tooltip.text,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`3px`,padding:`4px 6px`,fontSize:`12px`,fontFamily:`'Inter', system-ui, sans-serif`,outline:`none`,cursor:`pointer`}),this.inputRefs.set(e.key,t),n.append(r,t)}else{let t=document.createElement(`input`);t.type=`color`,t.value=String(i),Object.assign(t.style,{width:`40px`,height:`26px`,border:`none`,padding:`0`,cursor:`pointer`,background:`transparent`,borderRadius:`3px`}),this.inputRefs.set(e.key,t),n.append(r,t)}return n}buildFooter(){let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,gap:`8px`,padding:`10px 14px`,borderTop:`1px solid ${this.theme.axisBorder}`});let t=this.makeButton(`Remove`,`#ef5350`,`transparent`,`#ef5350`);t.addEventListener(`click`,()=>{var e;(e=this.onRemove)==null||e.call(this),this.hide()});let n=this.makeButton(`Update`,`#fff`,`#2196f3`,`#2196f3`);return n.addEventListener(`click`,()=>{if(!this.schema||!this.onUpdate)return;let e={};for(let t of this.schema.fields){let n=this.inputRefs.get(t.key);n&&(e[t.key]=t.kind===`number`?Number(n.value):String(n.value))}this.onUpdate(e),this.hide()}),e.append(t,n),e}makeButton(e,t,n,r){let i=document.createElement(`button`);return i.textContent=e,Object.assign(i.style,{flex:`1`,color:t,background:n,border:`1px solid ${r}`,borderRadius:`4px`,padding:`6px 0`,cursor:`pointer`,fontSize:`12px`,fontFamily:`'Inter', system-ui, sans-serif`,fontWeight:`600`,outline:`none`}),i.addEventListener(`mouseenter`,()=>{i.style.opacity=`0.85`}),i.addEventListener(`mouseleave`,()=>{i.style.opacity=`1`}),i}},es={appearance:`Appearance`,trading:`Trading`},ts=class{constructor(e,t,n=C.dialogs,r=!0,i=!1,a){this.activeTab=`appearance`,this.onChange=null,this.onReset=null,this.tabEls=new Map,this.theme=e,this.labels=n,this.current={...t},this.showTradingTab=r,this.enableThemeToggle=i,this.onVisibilityChange=a,!r&&this.activeTab===`trading`&&(this.activeTab=`appearance`),this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`fixed`,inset:`0`,background:`rgba(0,0,0,0.5)`,display:`none`,alignItems:`center`,justifyContent:`center`,zIndex:`10000`}),this.el.addEventListener(`mousedown`,e=>{e.target===this.el&&this.hide()}),this.panel=document.createElement(`div`),Object.assign(this.panel.style,{display:`flex`,flexDirection:`column`,width:`540px`,minHeight:`340px`,maxWidth:`calc(100vw - 32px)`,maxHeight:`calc(100vh - 48px)`,background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,borderRadius:`10px`,boxShadow:`0 16px 48px rgba(0,0,0,0.55), 0 4px 16px rgba(0,0,0,0.3)`,fontFamily:`'Inter', system-ui, -apple-system, sans-serif`,fontSize:`12px`,overflow:`hidden`}),this.panel.addEventListener(`mousedown`,e=>e.stopPropagation());let o=this.buildHeader();this.panel.appendChild(o);let s=document.createElement(`div`);Object.assign(s.style,{display:`flex`,flex:`1`,overflow:`hidden`}),this.sidebar=this.buildSidebar(),s.appendChild(this.sidebar),this.content=document.createElement(`div`),Object.assign(this.content.style,{flex:`1`,padding:`20px 24px`,overflowY:`auto`,scrollbarWidth:`thin`}),s.appendChild(this.content),this.panel.appendChild(s),this.panel.appendChild(this.buildFooter()),this.el.appendChild(this.panel)}show(e,t,n){var r;let i=this.isVisible;this.current={...e},this.onChange=t,this.onReset=n==null?null:n,this.renderContent(),this.el.style.display=`flex`,i||(r=this.onVisibilityChange)==null||r.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,this.onChange=null,this.onReset=null,t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setTheme(e){this.theme=e,this.applyPanelTheme(),this.el.style.display!==`none`&&this.renderContent()}destroy(){this.el.remove()}emit(){var e;(e=this.onChange)==null||e.call(this,{...this.current})}applyPanelTheme(){Object.assign(this.panel.style,{background:this.theme.tooltip.background,border:`1px solid ${this.theme.axisBorder}`}),this.sidebar.innerHTML=``,this.tabEls.clear(),this.buildSidebarTabs(this.sidebar),this.highlightActiveTab()}buildHeader(){let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`14px 20px 12px`,borderBottom:`1px solid ${this.theme.axisBorder}`,flexShrink:`0`});let t=document.createElement(`span`);t.textContent=this.labels.settings.title,Object.assign(t.style,{color:this.theme.tooltip.text,fontWeight:`600`,fontSize:`14px`,letterSpacing:`-0.01em`});let n=document.createElement(`button`);return n.innerHTML=Zt,Object.assign(n.style,{color:this.theme.axisText,cursor:`pointer`,background:`transparent`,border:`none`,padding:`4px`,borderRadius:`4px`,display:`flex`,alignItems:`center`,justifyContent:`center`,outline:`none`,transition:`color 0.1s, background 0.1s`}),n.addEventListener(`mouseenter`,()=>{n.style.color=this.theme.tooltip.text,n.style.background=this.theme.ui.accentBg}),n.addEventListener(`mouseleave`,()=>{n.style.color=this.theme.axisText,n.style.background=`transparent`}),n.addEventListener(`click`,()=>this.hide()),e.append(t,n),e}buildFooter(){let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:`10px 20px`,borderTop:`1px solid ${this.theme.axisBorder}`,flexShrink:`0`});let t=document.createElement(`button`);return t.textContent=this.labels.settings.resetBtn,Object.assign(t.style,{color:this.theme.axisText,fontSize:`11px`,fontFamily:`'Inter', system-ui, sans-serif`,background:`transparent`,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`5px`,padding:`5px 12px`,cursor:`pointer`,outline:`none`,transition:`color 0.1s, border-color 0.1s, background 0.1s`}),t.addEventListener(`mouseenter`,()=>{t.style.color=this.theme.tooltip.text,t.style.borderColor=this.theme.ui.accent,t.style.background=this.theme.ui.accentBg}),t.addEventListener(`mouseleave`,()=>{t.style.color=this.theme.axisText,t.style.borderColor=this.theme.axisBorder,t.style.background=`transparent`}),t.addEventListener(`click`,()=>{var e;(e=this.onReset)==null||e.call(this),this.hide()}),e.appendChild(t),e}buildSidebar(){let e=document.createElement(`div`);return Object.assign(e.style,{width:`130px`,flexShrink:`0`,borderRight:`1px solid ${this.theme.axisBorder}`,padding:`10px 0`,display:`flex`,flexDirection:`column`,gap:`2px`}),this.buildSidebarTabs(e),e}buildSidebarTabs(e){let t=this.showTradingTab?[`appearance`,`trading`]:[`appearance`];for(let n of t){let t=document.createElement(`button`);Object.assign(t.style,{display:`flex`,alignItems:`center`,gap:`8px`,padding:`8px 14px`,background:`transparent`,border:`none`,borderLeft:`2px solid transparent`,color:this.theme.axisText,fontSize:`12px`,fontFamily:`'Inter', system-ui, sans-serif`,cursor:`pointer`,width:`100%`,textAlign:`left`,outline:`none`,transition:`background 0.1s, color 0.1s`,boxSizing:`border-box`});let r=document.createElement(`span`);r.innerHTML=Xt[n],Object.assign(r.style,{display:`flex`,flexShrink:`0`});let i=document.createElement(`span`);i.textContent=es[n],t.append(r,i),t.addEventListener(`mouseenter`,()=>{this.activeTab!==n&&(t.style.background=this.theme.ui.accentBg,t.style.color=this.theme.tooltip.text)}),t.addEventListener(`mouseleave`,()=>{this.activeTab!==n&&(t.style.background=`transparent`,t.style.color=this.theme.axisText)}),t.addEventListener(`click`,()=>{this.activeTab=n,this.highlightActiveTab(),this.renderContent()}),this.tabEls.set(n,t),e.appendChild(t)}}highlightActiveTab(){for(let[e,t]of this.tabEls){let n=e===this.activeTab;Object.assign(t.style,{background:n?this.theme.ui.accentBg:`transparent`,color:n?this.theme.ui.accentText:this.theme.axisText,borderLeft:n?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,fontWeight:n?`500`:`400`})}}renderContent(){switch(this.content.innerHTML=``,this.highlightActiveTab(),this.activeTab){case`appearance`:this.buildAppearanceSection();break;case`trading`:this.buildTradingSection();break}}buildAppearanceSection(){if(this.enableThemeToggle){let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingBottom:`10px`,borderBottom:`1px solid ${this.theme.axisBorder}`});let t=document.createElement(`span`);t.textContent=`Theme`,Object.assign(t.style,{color:this.theme.tooltip.text,fontSize:`13px`,fontWeight:`600`}),e.append(t,this.makeThemeToggle()),this.content.appendChild(e)}this.content.appendChild(this.makeSectionHeader(`Colors`)),this.content.appendChild(this.buildColorRows())}makeThemeToggle(){let e=this.current.theme===`light`,t=document.createElement(`div`);Object.assign(t.style,{display:`flex`,alignItems:`center`,gap:`8px`});let n=document.createElement(`span`);n.textContent=`Dark`;let r=document.createElement(`span`);r.textContent=`Light`;let i=()=>{Object.assign(n.style,{color:e?this.theme.axisText:this.theme.tooltip.text,fontWeight:e?`400`:`500`,fontSize:`11px`,cursor:`pointer`,userSelect:`none`}),Object.assign(r.style,{color:e?this.theme.tooltip.text:this.theme.axisText,fontWeight:e?`500`:`400`,fontSize:`11px`,cursor:`pointer`,userSelect:`none`})},a=document.createElement(`div`);Object.assign(a.style,{position:`relative`,width:`36px`,height:`20px`,borderRadius:`10px`,cursor:`pointer`,flexShrink:`0`,transition:`background 0.18s`,background:this.theme.axisBorder,border:`1px solid ${this.theme.axisText}50`,boxSizing:`border-box`});let o=document.createElement(`div`);Object.assign(o.style,{position:`absolute`,top:`2px`,left:e?`18px`:`2px`,width:`14px`,height:`14px`,borderRadius:`50%`,background:this.theme.ui.accent,transition:`left 0.18s`,pointerEvents:`none`}),a.appendChild(o);let s=()=>{e=!e,o.style.left=e?`18px`:`2px`,this.current.theme=e?`light`:`dark`,i(),this.emit(),this.renderContent()};return a.addEventListener(`click`,s),n.addEventListener(`click`,()=>{e&&s()}),r.addEventListener(`click`,()=>{e||s()}),i(),t.append(n,a,r),t}buildColorRows(){var e,t,n,r;let i=this.current.theme,a=(e=(t=this.current.canvasColors)==null?void 0:t[i])==null?{}:e,o=document.createElement(`div`);Object.assign(o.style,{display:`grid`,gridTemplateColumns:`max-content 24px 24px`,columnGap:`8px`,rowGap:`8px`,padding:`8px 0 4px`,alignItems:`center`});let s=[{label:`Background`,s1:{field:`background`,fallback:this.theme.background}},{label:`Grid`,s1:{field:`grid`,fallback:this.theme.grid}},{label:`Axis Text`,s1:{field:`axisText`,fallback:this.theme.axisText}},{label:`Axis Border`,s1:{field:`axisBorder`,fallback:this.theme.axisBorder}},{label:`Crosshair`,s1:{field:`crosshair`,fallback:this.theme.crosshair}},{label:`Candle Body`,s1:{field:`candleUp`,fallback:this.theme.candle.up},s2:{field:`candleDown`,fallback:this.theme.candle.down}},{label:`Candle Wick`,s1:{field:`wickUp`,fallback:this.theme.candle.wickUp},s2:{field:`wickDown`,fallback:this.theme.candle.wickDown}},{label:`Candle Border`,s1:{field:`borderUp`,fallback:(n=this.theme.candle.borderUp)==null?this.theme.candle.up:n},s2:{field:`borderDown`,fallback:(r=this.theme.candle.borderDown)==null?this.theme.candle.down:r}},{label:`Volume`,s1:{field:`volumeUp`,fallback:this.theme.volume.up},s2:{field:`volumeDown`,fallback:this.theme.volume.down}}],c=e=>{var t;return this.makeColorSwatch((t=a[e.field])==null?e.fallback:t,t=>{this.current.canvasColors||(this.current.canvasColors={}),this.current.canvasColors[i]||(this.current.canvasColors[i]={}),this.current.canvasColors[i][e.field]=t,this.emit()})};for(let{label:e,s1:t,s2:n}of s){let r=document.createElement(`span`);r.textContent=e,Object.assign(r.style,{color:this.theme.axisText,fontSize:`11px`,paddingRight:`12px`});let i=c(t);i.style.width=`24px`,i.style.height=`24px`;let a;n?(a=c(n),a.style.width=`24px`,a.style.height=`24px`):a=document.createElement(`span`),o.append(r,i,a)}return o}makeColorSwatch(e,t){let n=`${this.theme.axisText}80`,r=document.createElement(`div`);Object.assign(r.style,{position:`relative`,width:`28px`,height:`28px`,borderRadius:`6px`,overflow:`hidden`,cursor:`pointer`,border:`1.5px solid ${n}`,flexShrink:`0`,boxSizing:`border-box`});let i=document.createElement(`div`);Object.assign(i.style,{position:`absolute`,inset:`0`,background:e});let a=document.createElement(`input`);a.type=`color`,a.value=e,Object.assign(a.style,{position:`absolute`,inset:`0`,opacity:`0`,width:`100%`,height:`100%`,cursor:`pointer`,padding:`0`,border:`none`});let o=null;return a.addEventListener(`input`,()=>{i.style.background=a.value,o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,t(a.value)},300)}),r.append(i,a),r}buildTradingSection(){let e=this.labels.settings;this.content.appendChild(this.makeSectionHeader(e.tfcSection)),this.content.appendChild(this.makeVerticalSettingRow(e.showLabel,`Controls which trade levels are displayed on the chart`,this.makeSegmented([{value:`all`,label:e.showAll},{value:`positions`,label:e.showPositions},{value:`orders`,label:e.showOrders},{value:`none`,label:e.showNone}],this.current.tradeDisplayFilter,e=>{this.current.tradeDisplayFilter=e,this.emit()}))),this.content.appendChild(this.makeVerticalSettingRow(e.positionStyleLabel,`How open positions are rendered on the chart`,this.makeSegmented([{value:`line`,label:e.styleLine},{value:`dot`,label:e.styleDot}],this.current.positionRenderStyle,e=>{this.current.positionRenderStyle=e,this.emit()})))}makeSectionHeader(e,t=!1){let n=document.createElement(`div`);return n.textContent=e,Object.assign(n.style,{color:this.theme.tooltip.text,fontSize:`13px`,fontWeight:`600`,paddingBottom:`10px`,marginTop:t?`0`:`20px`,marginBottom:`2px`,borderBottom:`1px solid ${this.theme.axisBorder}`}),n}makeVerticalSettingRow(e,t,n){let r=document.createElement(`div`);Object.assign(r.style,{display:`flex`,flexDirection:`column`,gap:`12px`,padding:`14px 0`,borderBottom:`1px solid ${this.theme.axisBorder}`});let i=document.createElement(`div`);Object.assign(i.style,{display:`flex`,flexDirection:`column`,gap:`0px`});let a=document.createElement(`span`);a.textContent=e,Object.assign(a.style,{color:this.theme.tooltip.text,fontSize:`12px`,fontWeight:`500`});let o=document.createElement(`span`);return o.textContent=t,Object.assign(o.style,{color:this.theme.axisText,fontSize:`10px`}),i.append(a,o),Object.assign(n.style,{width:`fit-content`,border:`1px solid ${this.theme.axisText}`,borderRadius:`6px`,overflow:`hidden`}),r.append(i,n),r}makeSegmented(e,t,n){let r=document.createElement(`div`);Object.assign(r.style,{display:`inline-flex`,borderRadius:`6px`,border:`1px solid ${this.theme.axisText}`,overflow:`hidden`,flexShrink:`0`});let i=[];for(let a of e){let o=document.createElement(`button`),s=a.value===t;Object.assign(o.style,{padding:`5px 14px`,fontSize:`11px`,fontFamily:`'Inter', system-ui, sans-serif`,background:s?this.theme.ui.accent:`transparent`,color:s?`#ffffff`:this.theme.axisText,border:`none`,borderRight:`1px solid ${this.theme.axisText}`,cursor:`pointer`,outline:`none`,transition:`background 0.12s, color 0.12s`,whiteSpace:`nowrap`,textAlign:`center`}),a===e[e.length-1]&&(o.style.borderRight=`none`),o.textContent=a.label,o.addEventListener(`mouseenter`,()=>{t!==a.value&&(o.style.background=this.theme.ui.accentBg,o.style.color=this.theme.ui.accentText)}),o.addEventListener(`mouseleave`,()=>{t!==a.value&&(o.style.background=`transparent`,o.style.color=this.theme.axisText)}),o.addEventListener(`click`,()=>{t=a.value;for(let e of i)e.style.background=`transparent`,e.style.color=this.theme.axisText;o.style.background=this.theme.ui.accent,o.style.color=`#ffffff`,n(a.value)}),i.push(o),r.appendChild(o)}return r}},ns=class{constructor(e,t,n,r=C.trade,i=b){this._visible=!1,this._isMobile=!1,this.theme=e,this.cfg=i,this.el=document.createElement(`button`),this.el.innerHTML=en,this.el.title=r.placeOrderTitle,Object.assign(this.el.style,{position:`absolute`,right:`${t+26}px`,top:`0`,width:`${i.size}px`,height:`${i.size}px`,borderRadius:`50%`,border:`1px solid ${e.axisBorder}`,background:e.tooltip.background,color:e.axisText,fontSize:`14px`,lineHeight:`1`,display:`none`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,padding:`0`,fontFamily:`'Inter', system-ui, sans-serif`,zIndex:`15`,transform:`translateY(-50%)`,transition:`opacity 0.1s`,pointerEvents:`auto`,userSelect:`none`}),this.applyIconSize(i.iconSize),this.el.addEventListener(`click`,e=>{e.stopPropagation(),n()}),this.el.addEventListener(`mouseenter`,()=>{this.el.style.opacity=`1`,Object.assign(this.el.style,{background:e.tooltip.background,color:`#26a69a`,border:`1px solid #26a69a`})}),this.el.addEventListener(`mouseleave`,e=>{var t;Object.assign(this.el.style,{background:this.theme.tooltip.background,color:this.theme.axisText,border:`1px solid ${this.theme.axisBorder}`});let n=e.relatedTarget;(!n||!((t=this.el.parentElement)!=null&&t.contains(n)))&&this.hide()})}setY(e){this.el.style.top=`${e}px`}show(){this._visible||(this._visible=!0,this.el.style.display=`flex`)}hide(){this._visible&&(this._visible=!1,this.el.style.display=`none`)}setTheme(e,t){this.theme=e,Object.assign(this.el.style,{border:`1px solid ${e.axisBorder}`,background:e.tooltip.background,color:e.axisText,right:`${t+26}px`})}setMobileMode(e){if(this._isMobile===e)return;this._isMobile=e;let t=e?this.cfg.mobileSize:this.cfg.size,n=e?this.cfg.mobileIconSize:this.cfg.iconSize;this.el.style.width=`${t}px`,this.el.style.height=`${t}px`,this.applyIconSize(n)}applyIconSize(e){let t=this.el.querySelector(`svg`);t&&(t.setAttribute(`width`,String(e)),t.setAttribute(`height`,String(e)))}},rs=class{constructor(e,t,n,r=C.trade,i){this._price=0,this._pricePrecision=2,this._buyOrderType=`limit`,this._sellOrderType=`limit`,this.onDocMouseDown=e=>{this.isVisible&&!this.el.contains(e.target)&&this.hide()},this.theme=e,this.lots=t,this.onDraftCreate=n,this.labels=r,this.onVisibilityChange=i,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`absolute`,display:`none`,flexDirection:`column`,gap:`1px`,background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,borderRadius:`5px`,padding:`4px`,zIndex:`20`,boxShadow:`0 4px 16px rgba(0,0,0,0.25)`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:`12px`,minWidth:`140px`,pointerEvents:`auto`}),document.addEventListener(`mousedown`,this.onDocMouseDown)}show(e,t,n,r=2,i=`limit`,a=`limit`){var o;let s=this.isVisible;this._price=e,this._pricePrecision=r,this._buyOrderType=i,this._sellOrderType=a,this.rebuild(),this.el.style.display=`flex`,this.el.style.right=`${n}px`,this.el.style.top=`${t-16}px`,this.el.style.width=`145px`,s||(o=this.onVisibilityChange)==null||o.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setLots(e){this.lots=e}setTheme(e){this.theme=e,Object.assign(this.el.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`})}destroy(){document.removeEventListener(`mousedown`,this.onDocMouseDown)}rebuild(){this.el.innerHTML=``,this.el.append(this.makeRow(this.labels.buy,`#26a69a`,`buy`,this._buyOrderType),this.makeRow(this.labels.sell,`#ef5350`,`sell`,this._sellOrderType))}makeRow(e,t,n,r){let i=document.createElement(`button`),a=this._price.toFixed(this._pricePrecision);return i.textContent=`${e} ${r===`limit`?this.labels.limit:this.labels.stop} ${a}`,Object.assign(i.style,{display:`block`,width:`100%`,background:`transparent`,color:t,border:`none`,borderRadius:`3px`,padding:`7px 10px`,textAlign:`left`,cursor:`pointer`,fontSize:`12px`,fontFamily:`'Inter', system-ui, sans-serif`,fontWeight:`600`}),i.addEventListener(`mouseenter`,()=>{i.style.background=t+`22`}),i.addEventListener(`mouseleave`,()=>{i.style.background=`transparent`}),i.addEventListener(`mousedown`,e=>{e.stopPropagation(),this.onDraftCreate(n,this._price,r),this.hide()}),i}},is=class{constructor(e,t,n){this._min=1,this._max=100,this._step=1,this._intendedTop=0,this._disposeKbd=()=>{},this.onDocMouseDown=e=>{this.isVisible&&!this.el.contains(e.target)&&(this.syncIfValid(),this.hide())},this.theme=e,this.onCommit=t,this.onVisibilityChange=n,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`fixed`,display:`none`,flexDirection:`row`,alignItems:`center`,gap:`4px`,background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,borderRadius:`5px`,padding:`5px 7px`,zIndex:`25`,boxShadow:`0 4px 16px rgba(0,0,0,0.3)`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:`13px`,color:e.tooltip.text,pointerEvents:`auto`});let r=this.makeStepBtn(`−`,()=>this.step(-1));this.input=this.makeInput();let i=this.makeStepBtn(`+`,()=>this.step(1));this.el.append(r,this.input,i),this.el.addEventListener(`mousedown`,e=>e.stopPropagation()),this.el.addEventListener(`touchstart`,e=>e.stopPropagation()),document.addEventListener(`mousedown`,this.onDocMouseDown),this._disposeKbd=sn(this.el,()=>this._intendedTop)}show(e,t,n,r,i){var a;let o=this.isVisible;this._min=r,this._max=i,this._step=r,this.input.min=String(r),this.input.max=String(i),this.input.step=String(r),this.input.value=String(n),this._intendedTop=t+4,this.el.style.display=`flex`,this.el.style.left=`${e}px`,this.el.style.top=`${this._intendedTop}px`,o||(a=this.onVisibilityChange)==null||a.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setTheme(e){this.theme=e,Object.assign(this.el.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,color:e.tooltip.text}),this.input.style.borderBottom=`1px solid ${e.axisBorder}`}destroy(){document.removeEventListener(`mousedown`,this.onDocMouseDown),this._disposeKbd()}makeStepBtn(e,t){let n=document.createElement(`button`);return n.textContent=e,Object.assign(n.style,{background:`transparent`,border:`none`,color:`inherit`,cursor:`pointer`,fontSize:`16px`,lineHeight:`1`,padding:`0 4px`,borderRadius:`3px`,opacity:`0.7`}),n.addEventListener(`mouseenter`,()=>{n.style.opacity=`1`}),n.addEventListener(`mouseleave`,()=>{n.style.opacity=`0.7`}),n.addEventListener(`mousedown`,e=>{e.preventDefault(),t()}),n}makeInput(){let e=document.createElement(`input`);return e.type=`number`,Object.assign(e.style,{width:`64px`,background:`transparent`,border:`none`,borderBottom:`1px solid ${this.theme.axisBorder}`,color:`inherit`,font:`16px 'Inter', system-ui, sans-serif`,outline:`none`,textAlign:`center`,padding:`1px 2px`}),e.addEventListener(`focus`,()=>{e.select()}),e.addEventListener(`input`,()=>{this.syncIfValid()}),e.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),this.syncIfValid(),this.hide()):e.key===`Escape`&&(e.preventDefault(),this.hide())}),e.addEventListener(`blur`,()=>{this.isVisible&&(this.syncIfValid(),this.hide())}),e}step(e){let t=parseFloat(this.input.value)||this._min,n=Math.round((t+e*this._step)*1e10)/1e10;this.input.value=String(Math.min(this._max,Math.max(this._min,n))),this.syncIfValid()}syncIfValid(){let e=parseFloat(this.input.value);!isNaN(e)&&e>=this._min&&e<=this._max&&this.onCommit(e)}},as=50,os=20,ss=class{constructor(e,t,n){this.isins=[],this.currentSymbol=``,this.escHandler=null,this.disposeKbd=()=>{},this.theme=e,this.onSelect=t,this.onVisibilityChange=n,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`fixed`,inset:`0`,background:`rgba(0,0,0,0.5)`,display:`none`,alignItems:`center`,justifyContent:`center`,zIndex:`1000`}),this.el.addEventListener(`mousedown`,e=>{e.target===this.el&&this.hide()}),this.panel=document.createElement(`div`),Object.assign(this.panel.style,{display:`flex`,flexDirection:`column`,width:`360px`,maxHeight:`520px`,background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,borderRadius:`6px`,boxShadow:`0 8px 32px rgba(0,0,0,0.45)`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:`12px`,overflow:`hidden`}),this.panel.addEventListener(`mousedown`,e=>e.stopPropagation()),this.el.appendChild(this.panel);let r=document.createElement(`div`);Object.assign(r.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`10px 14px`,borderBottom:`1px solid ${e.axisBorder}`,flexShrink:`0`});let i=document.createElement(`span`);i.textContent=`Select Symbol`,Object.assign(i.style,{color:e.tooltip.text,fontWeight:`600`,fontSize:`13px`});let a=document.createElement(`span`);a.innerHTML=Ft,Object.assign(a.style,{display:`inline-flex`,alignItems:`center`,color:e.axisText,cursor:`pointer`}),a.addEventListener(`mouseenter`,()=>{a.style.color=e.tooltip.text}),a.addEventListener(`mouseleave`,()=>{a.style.color=e.axisText}),a.addEventListener(`click`,()=>this.hide()),r.appendChild(i),r.appendChild(a),this.panel.appendChild(r);let o=document.createElement(`div`);Object.assign(o.style,{padding:`8px 14px`,borderBottom:`1px solid ${e.axisBorder}`,flexShrink:`0`}),this.searchInput=document.createElement(`input`),this.searchInput.type=`text`,this.searchInput.placeholder=`Search symbols…`,Object.assign(this.searchInput.style,{width:`100%`,boxSizing:`border-box`,background:`transparent`,border:`1px solid ${e.axisBorder}`,borderRadius:`4px`,color:e.tooltip.text,fontSize:`16px`,padding:`5px 8px`,outline:`none`}),this.searchInput.addEventListener(`input`,()=>this.renderList()),o.appendChild(this.searchInput),this.panel.appendChild(o),this.listEl=document.createElement(`div`),Object.assign(this.listEl.style,{overflowY:`auto`,flex:`1`,scrollbarWidth:`thin`,scrollbarColor:`rgba(120,130,150,0.35) transparent`}),this.panel.appendChild(this.listEl),this.disposeKbd=cn(this.panel)}show(e,t){var n;let r=this.isVisible;this.isins=e,this.currentSymbol=t,this.searchInput.value=``,this.renderList(),this.el.style.display=`flex`,requestAnimationFrame(()=>this.searchInput.focus({preventScroll:!0})),this.escHandler=e=>{e.key===`Escape`&&this.hide()},document.addEventListener(`keydown`,this.escHandler),r||(n=this.onVisibilityChange)==null||n.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,this.escHandler&&(document.removeEventListener(`keydown`,this.escHandler),this.escHandler=null),t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setCurrentSymbol(e){this.currentSymbol=e,this.el.style.display!==`none`&&this.renderList()}setIsins(e){this.isins=e}setTheme(e){this.theme=e,Object.assign(this.panel.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`})}destroy(){this.escHandler&&document.removeEventListener(`keydown`,this.escHandler),this.disposeKbd(),this.el.remove()}sortWithCurrentFirst(e){if(!this.currentSymbol)return e;let t=e.indexOf(this.currentSymbol);if(t<=0)return e;let n=e.slice();return n.splice(t,1),n.unshift(this.currentSymbol),n}renderList(){let e=this.searchInput.value.trim().toLowerCase(),t=this.sortWithCurrentFirst(e?this.isins.filter(t=>t.toLowerCase().includes(e)).slice(0,os):this.isins.slice(0,as));if(this.listEl.innerHTML=``,t.length===0){let e=document.createElement(`div`);e.textContent=`No symbols found`,Object.assign(e.style,{padding:`16px 14px`,color:this.theme.axisText,textAlign:`center`}),this.listEl.appendChild(e);return}for(let e of t){let t=document.createElement(`div`),n=e===this.currentSymbol;Object.assign(t.style,{padding:`8px 14px`,cursor:`pointer`,color:n?this.theme.ui.accentText:this.theme.tooltip.text,background:n?this.theme.ui.accentBg:`transparent`,fontWeight:n?`600`:`400`,borderLeft:n?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,boxSizing:`border-box`,userSelect:`none`}),t.textContent=e,t.addEventListener(`mouseenter`,()=>{e!==this.currentSymbol&&(t.style.background=this.theme.ui.accentBg)}),t.addEventListener(`mouseleave`,()=>{e!==this.currentSymbol&&(t.style.background=`transparent`)}),t.addEventListener(`click`,()=>{this.onSelect(e),this.hide()}),this.listEl.appendChild(t)}}},cs=class e{constructor(){this._active=!1,this._isDraggingBracket=!1,this._level=null,this._startPrice=0,this._currentPrice=0,this._pixelOffset=0,this._mainMinPrice=-1/0,this._mainMaxPrice=1/0,this._bracketType=null,this._bracketStartPrice=0,this._bracketCurrentPrice=0,this._bracketPixelOffset=0,this._bracketParentPrice=0,this._bracketParentSide=`buy`,this._bracketMarketPrice=0,this._followBrackets=!1}startDrag(e,t,n,r,i,a,o,s,c,l){this._active=!0,this._isDraggingBracket=!1,this._level=e,this._pixelOffset=t-n,this._startPrice=r,this._currentPrice=r,this._bracketType=null,this._followBrackets=l===!0,this._slStartPrice=i,this._tpStartPrice=a,this._derivedSLPrice=i,this._derivedTPPrice=a,this._followBrackets?(this._mainMinPrice=-1/0,this._mainMaxPrice=1/0):i!==void 0||a!==void 0?(o==null?`buy`:o)===`buy`?(this._mainMinPrice=i==null?-1/0:i,this._mainMaxPrice=a==null?1/0:a):(this._mainMinPrice=a==null?-1/0:a,this._mainMaxPrice=i==null?1/0:i):(this._mainMinPrice=-1/0,this._mainMaxPrice=1/0),s&&s>0&&c&&c!==`market`&&o&&(o===`buy`&&c===`limit`||o===`sell`&&c===`stop`?this._mainMaxPrice=Math.min(this._mainMaxPrice,s):this._mainMinPrice=Math.max(this._mainMinPrice,s))}startBracketDrag(e,t,n,r,i,a=0,o){var s;this._active=!0,this._isDraggingBracket=!0,this._level=e,this._bracketType=t,this._bracketStartPrice=n,this._bracketCurrentPrice=n,this._bracketPixelOffset=r-i,this._bracketParentPrice=o==null?e.price:o,this._bracketParentSide=(s=e.side)==null?`buy`:s,this._bracketMarketPrice=a}onMouseMove(e,t,n,r){if(!this._active||!this._level)return null;if(this._isDraggingBracket&&this._bracketType!==null){let i=e-this._bracketPixelOffset,a=t.pixelToPrice(i,n,r),o=this._clampBracketPrice(a,this._bracketType,this._bracketParentPrice,this._bracketParentSide,this._bracketMarketPrice);return this._bracketCurrentPrice=o,{newPrice:o,label:`${this._level.label}:${this._bracketType}`,isBracket:!0}}let i=e-this._pixelOffset,a=t.pixelToPrice(i,n,r),o=Math.max(this._mainMinPrice,Math.min(this._mainMaxPrice,a));if(this._currentPrice=o,this._followBrackets){let e=o-this._startPrice;return this._derivedSLPrice=this._slStartPrice===void 0?void 0:this._slStartPrice+e,this._derivedTPPrice=this._tpStartPrice===void 0?void 0:this._tpStartPrice+e,{newPrice:o,label:this._level.label,isBracket:!1,derivedSLPrice:this._derivedSLPrice,derivedTPPrice:this._derivedTPPrice}}return{newPrice:o,label:this._level.label,isBracket:!1}}endDrag(){if(!this._active||!this._level)return null;let e=this._level,t;return t=this._isDraggingBracket&&this._bracketType!==null?{label:e.label,type:e.type,newPrice:this._bracketCurrentPrice,startPrice:this._bracketStartPrice,data:e.data,bracketType:this._bracketType}:this._followBrackets?{label:e.label,type:e.type,newPrice:this._currentPrice,startPrice:this._startPrice,data:e.data,derivedSLPrice:this._derivedSLPrice,derivedTPPrice:this._derivedTPPrice,slStartPrice:this._slStartPrice,tpStartPrice:this._tpStartPrice}:{label:e.label,type:e.type,newPrice:this._currentPrice,startPrice:this._startPrice,data:e.data},this._reset(),t}cancelDrag(){this._reset()}get active(){return this._active}get dragLabel(){return!this._active||!this._level?null:this._isDraggingBracket&&this._bracketType?`${this._level.label}:${this._bracketType}`:this._level.label}get currentPrice(){return this._active?this._isDraggingBracket?this._bracketCurrentPrice:this._currentPrice:null}static isBracketPriceValid(e,t,n,r,i=0){let a=i>0?r===`buy`?t===`stopLoss`?Math.min(n,i):Math.max(n,i):t===`stopLoss`?Math.max(n,i):Math.min(n,i):n;return r===`buy`?t===`stopLoss`?e<a:e>a:t===`stopLoss`?e>a:e<a}_clampBracketPrice(t,n,r,i,a=0){return e.isBracketPriceValid(t,n,r,i,a)?t:a>0?i===`buy`?n===`stopLoss`?Math.min(r,a):Math.max(r,a):n===`stopLoss`?Math.max(r,a):Math.min(r,a):r}_reset(){this._active=!1,this._isDraggingBracket=!1,this._level=null,this._bracketType=null,this._currentPrice=0,this._pixelOffset=0,this._mainMinPrice=-1/0,this._mainMaxPrice=1/0,this._bracketStartPrice=0,this._bracketCurrentPrice=0,this._bracketPixelOffset=0,this._bracketParentPrice=0,this._bracketParentSide=`buy`,this._bracketMarketPrice=0,this._followBrackets=!1,this._slStartPrice=void 0,this._tpStartPrice=void 0,this._derivedSLPrice=void 0,this._derivedTPPrice=void 0}};function Z(e,t){return e[t]}var ls=class{constructor(e,t=`#F5A623`,n=`MA`,r=`close`){this.period=e,this.source=r,this.name=n,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null};let r=0;for(let t=n-this.period+1;t<=n;t++)r+=Z(e[t],this.source);return{index:n,value:r/this.period}})}render(e,t,n,r,i){var a;let o=us(e);if(!o)return;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let s=!1,c=(a=e.canvas._chartWidth)==null?e.canvas.width:a;for(let a of t){if(a.value===null){s=!1;continue}let t=n.xToPixel(a.index,r,c),l=n.yToPixel(a.value,o,i);s?e.lineTo(t,l):(e.moveTo(t,l),s=!0)}e.stroke()}};function us(e){var t;return(t=e.canvas._priceRange)==null?null:t}var ds=class{constructor(e,t=`#9B59B6`,n=`EMA`,r=`close`){this.period=e,this.source=r,this.name=n,this.color=t}compute(e){let t=2/(this.period+1),n=[],r=null;for(let i=0;i<e.length;i++){if(i<this.period-1){n.push({index:i,value:null});continue}if(r===null){let t=0;for(let n=0;n<this.period;n++)t+=Z(e[i-n],this.source);r=t/this.period}else r=Z(e[i],this.source)*t+r*(1-t);n.push({index:i,value:r})}return n}render(e,t,n,r,i){var a;let o=e.canvas._priceRange;if(!o)return;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let s=!1,c=(a=e.canvas._chartWidth)==null?e.canvas.width:a;for(let a of t){if(a.value===null){s=!1;continue}let t=n.xToPixel(a.index,r,c),l=n.yToPixel(a.value,o,i);s?e.lineTo(t,l):(e.moveTo(t,l),s=!0)}e.stroke()}},fs=class{constructor(e=20,t=`#e91e63`,n=`WMA`,r=`close`){this.period=e,this.source=r,this.name=n,this.color=t}compute(e){let t=this.period*(this.period+1)/2,n=[];for(let r=0;r<e.length;r++){if(r<this.period-1){n.push({index:r,value:null});continue}let i=0;for(let t=0;t<this.period;t++)i+=Z(e[r-(this.period-1-t)],this.source)*(t+1);n.push({index:r,value:i/t})}return n}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let l=!1;for(let a of t){if(a.value===null){l=!1;continue}let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);l?e.lineTo(t,o):(e.moveTo(t,o),l=!0)}e.stroke()}};function ps(e,t){let n=t*(t+1)/2,r=[];for(let i=0;i<e.length;i++){if(i<t-1){r.push(null);continue}let a=0;for(let n=0;n<t;n++)a+=e[i-(t-1-n)]*(n+1);r.push(a/n)}return r}var ms=class{constructor(e=20,t=`#00bcd4`,n=`HMA`,r=`close`){this.period=e,this.source=r,this.name=n,this.color=t}compute(e){let t=e.map(e=>Z(e,this.source)),n=Math.floor(this.period/2),r=Math.floor(Math.sqrt(this.period)),i=ps(t,n),a=ps(t,this.period),o=i.map((e,t)=>{let n=a[t];return e===null||n===null?null:2*e-n}),s=ps(o.map(e=>e===null?0:e),r);return e.map((e,t)=>{let n=t-r+1;return n<0||!(o[n]!==null&&o[t]!==null)||s[t]===null?{index:t,value:null}:{index:t,value:s[t]}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let l=!1;for(let a of t){if(a.value===null){l=!1;continue}let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);l?e.lineTo(t,o):(e.moveTo(t,o),l=!0)}e.stroke()}},hs=[5,10,20,50,100],gs=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#c77dff`],_s=class{constructor(e=`#ffcc80`,t=`close`){this.source=t,this.name=`MARibbon`,this.color=e}compute(e){let t=(t,n)=>{if(t<n-1)return null;let r=0;for(let i=t-n+1;i<=t;i++)r+=Z(e[i],this.source);return r/n};return e.map((e,n)=>({index:n,value:t(n,5),upper:t(n,10),lower:t(n,20),signal:t(n,50),histogram:t(n,100)}))}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let l=[`value`,`upper`,`lower`,`signal`,`histogram`];for(let a=0;a<hs.length;a++){let o=l[a],u=gs[a];e.beginPath(),e.strokeStyle=u;let d=!1;for(let a of t){let t=a[o];if(t==null){d=!1;continue}let l=n.xToPixel(a.index,r,c),u=n.yToPixel(t,s,i);d?e.lineTo(l,u):(e.moveTo(l,u),d=!0)}e.stroke()}}},vs=class{constructor(e=20,t=2,n=`#3B82F6`,r=`BB`,i=`close`){this.period=e,this.stdDevMultiplier=t,this.source=i,this.name=r,this.color=n}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null,upper:null,lower:null};let r=e.slice(n-this.period+1,n+1).map(e=>Z(e,this.source)),i=r.reduce((e,t)=>e+t,0)/this.period,a=r.reduce((e,t)=>e+(t-i)**2,0)/this.period,o=Math.sqrt(a);return{index:n,value:i,upper:i+o*this.stdDevMultiplier,lower:i-o*this.stdDevMultiplier}})}render(e,t,n,r,i){var a;let o=e.canvas._priceRange;if(!o)return;let s=(a=e.canvas._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let c=(a,c=!1)=>{c&&e.setLineDash([4,3]),e.beginPath();let l=!1;for(let c of t){let t=a(c);if(t==null){l=!1;continue}let u=n.xToPixel(c.index,r,s),d=n.yToPixel(t,o,i);l?e.lineTo(u,d):(e.moveTo(u,d),l=!0)}e.stroke(),c&&e.setLineDash([])};e.strokeStyle=this.color,c(e=>e.value),e.strokeStyle=`${this.color}99`,c(e=>e.upper,!0),c(e=>e.lower,!0);let l=[],u=[];for(let e of t){if(e.upper==null||e.lower==null)continue;let t=n.xToPixel(e.index,r,s);l.push([t,n.yToPixel(e.upper,o,i)]),u.push([t,n.yToPixel(e.lower,o,i)])}l.length<2||(e.beginPath(),l.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),u.reverse().forEach(([t,n])=>e.lineTo(t,n)),e.closePath(),e.fillStyle=`${this.color}12`,e.fill())}},ys=class{constructor(e=20,t=2,n=10,r=`#4caf50`,i=`KC`){this.period=e,this.mult=t,this.atrPeriod=n,this.name=i,this.color=r}compute(e){let t=[],n=2/(this.period+1),r=null,i=null;for(let a=0;a<e.length;a++){let o=e[a];if(a<this.period-1){t.push({index:a,value:null,upper:null,lower:null});continue}if(r===null){let t=0;for(let n=0;n<this.period;n++)t+=e[a-n].close;r=t/this.period}else r=o.close*n+r*(1-n);let s=a===0?o.high-o.low:Math.max(o.high-o.low,Math.abs(o.high-e[a-1].close),Math.abs(o.low-e[a-1].close));if(i===null){let t=0;for(let n=0;n<this.atrPeriod;n++){let r=e[a-n],i=a-n>0?e[a-n-1]:null,o=i==null?r.high-r.low:Math.max(r.high-r.low,Math.abs(r.high-i.close),Math.abs(r.low-i.close));t+=o}i=t/this.atrPeriod}else i=(i*(this.atrPeriod-1)+s)/this.atrPeriod;let c=r+this.mult*i,l=r-this.mult*i;t.push({index:a,value:r,upper:c,lower:l})}return t}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let l=(a,o=!1)=>{o&&e.setLineDash([4,3]),e.beginPath();let l=!1;for(let o of t){let t=a(o);if(t==null){l=!1;continue}let u=n.xToPixel(o.index,r,c),d=n.yToPixel(t,s,i);l?e.lineTo(u,d):(e.moveTo(u,d),l=!0)}e.stroke(),o&&e.setLineDash([])};e.strokeStyle=this.color,l(e=>e.value),e.strokeStyle=`${this.color}99`,l(e=>e.upper,!0),l(e=>e.lower,!0);let u=[],d=[];for(let e of t){if(e.upper==null||e.lower==null)continue;let t=n.xToPixel(e.index,r,c);u.push([t,n.yToPixel(e.upper,s,i)]),d.push([t,n.yToPixel(e.lower,s,i)])}u.length<2||(e.beginPath(),u.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),d.reverse().forEach(([t,n])=>e.lineTo(t,n)),e.closePath(),e.fillStyle=`${this.color}12`,e.fill())}},bs=class{constructor(e=20,t=`#26c6da`){this.period=e,this.name=`DC`,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null,upper:null,lower:null};let r=-1/0,i=1/0;for(let t=n-this.period+1;t<=n;t++)e[t].high>r&&(r=e[t].high),e[t].low<i&&(i=e[t].low);return{index:n,value:(r+i)/2,upper:r,lower:i}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let l=(a,o=!1)=>{o&&e.setLineDash([4,3]),e.beginPath();let l=!1;for(let o of t){let t=a(o);if(t==null){l=!1;continue}let u=n.xToPixel(o.index,r,c),d=n.yToPixel(t,s,i);l?e.lineTo(u,d):(e.moveTo(u,d),l=!0)}e.stroke(),o&&e.setLineDash([])};e.strokeStyle=this.color,l(e=>e.value,!0),e.strokeStyle=`${this.color}99`,l(e=>e.upper),l(e=>e.lower);let u=[],d=[];for(let e of t){if(e.upper==null||e.lower==null)continue;let t=n.xToPixel(e.index,r,c);u.push([t,n.yToPixel(e.upper,s,i)]),d.push([t,n.yToPixel(e.lower,s,i)])}u.length<2||(e.beginPath(),u.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),d.slice().reverse().forEach(([t,n])=>e.lineTo(t,n)),e.closePath(),e.fillStyle=`${this.color}14`,e.fill())}},xs=class{constructor(e=14,t=`#ff5722`,n=`ATR`){this.period=e,this.pane=`sub`,this.paneHeight=80,this.name=n,this.color=t}compute(e){let t=[];if(e.length===0)return t;let n=[];for(let t=0;t<e.length;t++)if(t===0)n.push(e[t].high-e[t].low);else{let r=e[t-1].close;n.push(Math.max(e[t].high-e[t].low,Math.abs(e[t].high-r),Math.abs(e[t].low-r)))}if(e.length<this.period)return e.map((e,t)=>({index:t,value:null}));let r=0;for(let e=0;e<this.period;e++)r+=n[e];r/=this.period;for(let e=0;e<this.period-1;e++)t.push({index:e,value:null});t.push({index:this.period-1,value:r});for(let i=this.period;i<e.length;i++)r=(r*(this.period-1)+n[i])/this.period,t.push({index:i,value:r});return t}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,n.value));return{min:0,max:t*1.2}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,e.value));let l=a==null?{min:0,max:c*1.2}:a,u=[];for(let e of t)e.value!=null&&u.push({x:n.xToPixel(e.index,r,s),y:n.yToPixel(e.value,l,i)});if(u.length===0)return;let d=n.yToPixel(0,l,i);e.beginPath(),e.moveTo(u[0].x,d);for(let t of u)e.lineTo(t.x,t.y);e.lineTo(u[u.length-1].x,d),e.closePath(),e.fillStyle=this.color+`33`,e.fill(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let f=!1;for(let a of t){if(a.value==null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke()}},Ss=class{constructor(e=14,t=`#e8b84b`,n=`RSI`,r=`close`){this.period=e,this.source=r,this.pane=`sub`,this.paneHeight=80,this.name=n,this.color=t}compute(e){let t=[];if(e.length<this.period+1)return e.map((e,t)=>({index:t,value:null}));let n=0,r=0;for(let t=1;t<=this.period;t++){let i=Z(e[t],this.source)-Z(e[t-1],this.source);i>0?n+=i:r+=Math.abs(i)}n/=this.period,r/=this.period;for(let e=0;e<this.period;e++)t.push({index:e,value:null});let i=r===0?1/0:n/r;t.push({index:this.period,value:r===0?100:100-100/(1+i)});for(let i=this.period+1;i<e.length;i++){let a=Z(e[i],this.source)-Z(e[i-1],this.source),o=a>0?a:0,s=a<0?Math.abs(a):0;n=(n*(this.period-1)+o)/this.period,r=(r*(this.period-1)+s)/this.period;let c=r===0?1/0:n/r;t.push({index:i,value:r===0?100:100-100/(1+c)})}return t}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a,l=n.yToPixel(70,c,i),u=n.yToPixel(30,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[70,50,30]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}},Cs=class{constructor(e=14,t=3,n=`#e040fb`){this.kPeriod=e,this.dPeriod=t,this.name=`Stoch`,this.pane=`sub`,this.paneHeight=80,this.color=n}compute(e){let t=[],n=[];for(let r=0;r<e.length;r++){if(r<this.kPeriod-1){n.push(null),t.push({index:r,value:null,upper:null});continue}let i=1/0,a=-1/0;for(let t=r-this.kPeriod+1;t<=r;t++)e[t].low<i&&(i=e[t].low),e[t].high>a&&(a=e[t].high);let o=a-i,s=o===0?50:(e[r].close-i)/o*100;n.push(s),t.push({index:r,value:s,upper:null})}for(let r=0;r<e.length;r++){if(n[r]===null)continue;let e=0,i=0;for(let t=r;t>=0&&e<this.dPeriod&&n[t]!==null;t--)i+=n[t],e++;e===this.dPeriod&&(t[r].upper=i/this.dPeriod)}return t}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a,l=n.yToPixel(80,c,i),u=n.yToPixel(20,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[80,50,20]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke(),e.beginPath(),e.strokeStyle=`#ff9800`,e.lineWidth=1,e.lineJoin=`round`,d=!1;for(let a of t){if(a.upper==null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.upper,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}};function ws(e,t){let n=[];for(let r=0;r<e.length;r++){if(r<t-1){n.push(null);continue}let i=0,a=!0;for(let n=r-t+1;n<=r;n++){if(e[n]===null){a=!1;break}i+=e[n]}n.push(a?i/t:null)}return n}var Ts=class{constructor(e=14,t=14,n=3,r=3,i=`#00e5ff`){this.rsiPeriod=e,this.stochPeriod=t,this.kPeriod=n,this.dPeriod=r,this.name=`StochRSI`,this.pane=`sub`,this.paneHeight=80,this.color=i}compute(e){let t=[];if(e.length<this.rsiPeriod+1)return e.map((e,t)=>({index:t,value:null,upper:null}));let n=0,r=0;for(let t=1;t<=this.rsiPeriod;t++){let i=e[t].close-e[t-1].close;i>0?n+=i:r+=Math.abs(i)}n/=this.rsiPeriod,r/=this.rsiPeriod;for(let e=0;e<this.rsiPeriod;e++)t.push(null);let i=r===0?1/0:n/r;t.push(r===0?100:100-100/(1+i));for(let i=this.rsiPeriod+1;i<e.length;i++){let a=e[i].close-e[i-1].close,o=a>0?a:0,s=a<0?Math.abs(a):0;n=(n*(this.rsiPeriod-1)+o)/this.rsiPeriod,r=(r*(this.rsiPeriod-1)+s)/this.rsiPeriod;let c=r===0?1/0:n/r;t.push(r===0?100:100-100/(1+c))}let a=[];for(let n=0;n<e.length;n++){if(t[n]===null){a.push(null);continue}if(n<this.rsiPeriod+this.stochPeriod-1){a.push(null);continue}let e=1/0,r=-1/0,i=!0;for(let a=n-this.stochPeriod+1;a<=n;a++){if(t[a]===null){i=!1;break}let n=t[a];n<e&&(e=n),n>r&&(r=n)}if(!i){a.push(null);continue}let o=r-e,s=o===0?50:(t[n]-e)/o*100;a.push(s)}let o=ws(a,this.kPeriod),s=ws(o,this.dPeriod);return e.map((e,t)=>{var n,r;return{index:t,value:(n=o[t])==null?null:n,upper:(r=s[t])==null?null:r}})}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a,l=n.yToPixel(80,c,i),u=n.yToPixel(20,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[80,50,20]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke(),e.beginPath(),e.strokeStyle=`#ff9800`,e.lineWidth=1,e.lineJoin=`round`,d=!1;for(let a of t){if(a.upper==null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.upper,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}};function Es(e,t){let n=2/(t+1),r=[],i=null;for(let a=0;a<e.length;a++){if(a<t-1){r.push(null);continue}if(i===null){let n=0;for(let r=0;r<t;r++)n+=e[a-r];i=n/t}else i=e[a]*n+i*(1-n);r.push(i)}return r}var Ds=class{constructor(e=12,t=26,n=9,r=`#2196f3`,i=`MACD`,a=`close`){this.fast=e,this.slow=t,this.signal=n,this.source=a,this.pane=`sub`,this.paneHeight=80,this.name=i,this.color=r}compute(e){let t=e.map(e=>Z(e,this.source)),n=Es(t,this.fast),r=Es(t,this.slow),i=t.map((e,t)=>n[t]===null||r[t]===null?null:n[t]-r[t]),a=Es(i.map(e=>e==null?0:e),this.signal);return e.map((e,t)=>{let n=i[t];if(n===null)return{index:t,value:null,upper:null,lower:null,histogram:null};let r=t>=this.slow-1+this.signal-1?a[t]:null;return{index:t,value:n,upper:r,lower:n!==null&&r!==null?n-r:null}})}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,Math.abs(n.value))),n.upper!=null&&(t=Math.max(t,Math.abs(n.upper))),n.lower!=null&&(t=Math.max(t,Math.abs(n.lower)));return{min:-t*1.3,max:t*1.3}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,Math.abs(e.value))),e.upper!=null&&(c=Math.max(c,Math.abs(e.upper))),e.lower!=null&&(c=Math.max(c,Math.abs(e.lower)));let l=a==null?{min:-c*1.3,max:c*1.3}:a,u=n.yToPixel(0,l,i);e.strokeStyle=`rgba(150,150,150,0.3)`,e.lineWidth=1,e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke();let d=Math.max(n.candleBodyWidth(r,s),1);for(let a of t){if(a.lower==null)continue;let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.lower,l,i),c=Math.abs(o-u),f=Math.min(o,u);e.fillStyle=a.lower>=0?`rgba(38,166,154,0.55)`:`rgba(239,83,80,0.55)`,e.fillRect(t-d/2,f,d,c)}e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let f=!1;for(let a of t){if(a.value==null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke(),e.beginPath(),e.strokeStyle=`#ff6b35`,e.lineWidth=1,e.lineJoin=`round`,f=!1;for(let a of t){if(a.upper==null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.upper,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke()}},Os=class{constructor(e=20,t=`#4db6ac`){this.period=e,this.name=`CCI`,this.pane=`sub`,this.paneHeight=80,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null};let r=e.slice(n-this.period+1,n+1).map(e=>(e.high+e.low+e.close)/3),i=r[r.length-1],a=r.reduce((e,t)=>e+t,0)/this.period,o=r.reduce((e,t)=>e+Math.abs(t-a),0)/this.period;return o===0?{index:n,value:0}:{index:n,value:(i-a)/(.015*o)}})}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,Math.abs(n.value)));return{min:-t*1.3,max:t*1.3}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,Math.abs(e.value)));let l=a==null?{min:-c*1.3,max:c*1.3}:a,u=n.yToPixel(100,l,i),d=n.yToPixel(-100,l,i);e.fillStyle=`rgba(239,83,80,0.10)`,e.fillRect(0,0,s,u),e.fillStyle=`rgba(38,166,154,0.10)`,e.fillRect(0,d,s,i-d),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[100,0,-100]){let r=n.yToPixel(t,l,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let f=!1;for(let a of t){if(a.value===null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke()}},ks=class{constructor(e=14,t=`#ff7043`){this.period=e,this.name=`%R`,this.pane=`sub`,this.paneHeight=80,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null};let r=-1/0,i=1/0;for(let t=n-this.period+1;t<=n;t++)e[t].high>r&&(r=e[t].high),e[t].low<i&&(i=e[t].low);let a=r-i;return{index:n,value:a===0?-50:(r-e[n].close)/a*-100}})}getValueRange(e){return{min:-100,max:0}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:-100,max:0}:a,l=n.yToPixel(-20,c,i),u=n.yToPixel(-80,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[-20,-50,-80]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}},As=class{constructor(e=12,t=`#80cbc4`,n=`close`){this.period=e,this.source=n,this.pane=`sub`,this.paneHeight=80,this.name=`ROC`,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period)return{index:n,value:null};let r=Z(e[n-this.period],this.source);return r===0?{index:n,value:null}:{index:n,value:(Z(e[n],this.source)-r)/r*100}})}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,Math.abs(n.value)));return{min:-t*1.3,max:t*1.3}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,Math.abs(e.value)));let l=a==null?{min:-c*1.3,max:c*1.3}:a,u=n.yToPixel(0,l,i),d=[];for(let e of t)e.value!=null&&d.push({x:n.xToPixel(e.index,r,s),y:n.yToPixel(e.value,l,i),value:e.value});if(d.length>=2){e.beginPath(),e.moveTo(d[0].x,u);for(let t of d)e.lineTo(t.x,Math.min(t.y,u));e.lineTo(d[d.length-1].x,u),e.closePath(),e.fillStyle=`rgba(38,166,154,0.05)`,e.fill(),e.beginPath(),e.moveTo(d[0].x,u);for(let t of d)e.lineTo(t.x,Math.max(t.y,u));e.lineTo(d[d.length-1].x,u),e.closePath(),e.fillStyle=`rgba(239,83,80,0.05)`,e.fill()}e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1,e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke(),e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let f=!1;for(let a of t){if(a.value===null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke()}},js=class{constructor(e=`#aed581`){this.name=`OBV`,this.pane=`sub`,this.paneHeight=80,this.color=e}compute(e){let t=[],n=0;for(let o=0;o<e.length;o++){if(o===0){var r;n=(r=e[o].volume)==null?0:r}else if(e[o].close>e[o-1].close){var i;n+=(i=e[o].volume)==null?0:i}else if(e[o].close<e[o-1].close){var a;n-=(a=e[o].volume)==null?0:a}t.push({index:o,value:n})}return t}getValueRange(e){let t=1/0,n=-1/0;for(let r of e)r.value!=null&&(r.value<t&&(t=r.value),r.value>n&&(n=r.value));if(t===1/0)return{min:0,max:1};let r=(n-t)*.1||1;return{min:t-r,max:n+r}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1/0,l=-1/0;for(let e of t)e.value!=null&&(e.value<c&&(c=e.value),e.value>l&&(l=e.value));if(c===1/0)return;let u=(l-c)*.1||1,d=a==null?{min:c-u,max:l+u}:a,f=n.yToPixel(0,d,i),p=[];for(let e of t)e.value!=null&&p.push({x:n.xToPixel(e.index,r,s),y:n.yToPixel(e.value,d,i),value:e.value});if(p.length===0)return;if(e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1,e.beginPath(),e.moveTo(0,f),e.lineTo(s,f),e.stroke(),e.setLineDash([]),e.restore(),p.length>=2){e.beginPath(),e.moveTo(p[0].x,f);for(let t of p)e.lineTo(t.x,t.y);e.lineTo(p[p.length-1].x,f),e.closePath(),e.fillStyle=p[p.length-1].value>=0?`rgba(38,166,154,0.12)`:`rgba(239,83,80,0.12)`,e.fill()}e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let m=!1;for(let a of t){if(a.value==null){m=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,d,i);m?e.lineTo(t,o):(e.moveTo(t,o),m=!0)}e.stroke()}},Ms=class{constructor(e=`#9c27b0`){this.name=`VWAP`,this.color=e}compute(e){let t=[],n=0,r=0;for(let o=0;o<e.length;o++){var i,a;let s=e[o],c=(s.high+s.low+s.close)/3;n+=c*((i=s.volume)==null?0:i),r+=(a=s.volume)==null?0:a,t.push({index:o,value:r===0?null:n/r})}return t}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`,e.setLineDash([4,3]);let l=!1;for(let a of t){if(a.value===null){l=!1;continue}let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);l?e.lineTo(t,o):(e.moveTo(t,o),l=!0)}e.stroke(),e.setLineDash([])}},Ns=class{constructor(e=`#ce93d8`){this.name=`A/D`,this.pane=`sub`,this.paneHeight=80,this.color=e}compute(e){let t=[],n=0;for(let r=0;r<e.length;r++){let{high:i,low:a,close:o,volume:s}=e[r],c=i-a,l=c===0?0:(o-a-(i-o))/c;n+=l*(s==null?0:s),t.push({index:r,value:n})}return t}getValueRange(e){let t=1/0,n=-1/0;for(let r of e)r.value!=null&&(r.value<t&&(t=r.value),r.value>n&&(n=r.value));if(t===1/0)return{min:0,max:1};let r=(n-t)*.1||1;return{min:t-r,max:n+r}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1/0,l=-1/0;for(let e of t)e.value!=null&&(e.value<c&&(c=e.value),e.value>l&&(l=e.value));if(c===1/0)return;let u=(l-c)*.1||1,d=a==null?{min:c-u,max:l+u}:a,f=[];for(let e of t)e.value!=null&&f.push({x:n.xToPixel(e.index,r,s),y:n.yToPixel(e.value,d,i)});if(f.length===0)return;if(f.length>=2){let t=i;e.beginPath(),e.moveTo(f[0].x,t);for(let t of f)e.lineTo(t.x,t.y);e.lineTo(f[f.length-1].x,t),e.closePath(),e.fillStyle=this.color+`20`,e.fill()}e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let p=!1;for(let a of t){if(a.value==null){p=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,d,i);p?e.lineTo(t,o):(e.moveTo(t,o),p=!0)}e.stroke()}},Ps=class{constructor(e=14,t=`#ffab40`){this.period=e,this.pane=`sub`,this.paneHeight=80,this.name=`MFI`,this.color=t}compute(e){let t=[],n=e.map(e=>(e.high+e.low+e.close)/3),r=e.map((e,t)=>{var r;return n[t]*((r=e.volume)==null?0:r)});for(let i=0;i<e.length;i++){if(i<this.period){t.push({index:i,value:null});continue}let e=0,a=0;for(let t=i-this.period+1;t<=i;t++)n[t]>n[t-1]?e+=r[t]:n[t]<n[t-1]&&(a+=r[t]);if(a===0)t.push({index:i,value:100});else{let n=e/a;t.push({index:i,value:100-100/(1+n)})}}return t}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a,l=n.yToPixel(80,c,i),u=n.yToPixel(20,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[80,50,20]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}},Fs=class{constructor(e=20,t=`#80deea`){this.period=e,this.pane=`sub`,this.paneHeight=80,this.name=`CMF`,this.color=t}compute(e){let t=e.map(e=>{var t;let n=e.high-e.low;return(n===0?0:(e.close-e.low-(e.high-e.close))/n)*((t=e.volume)==null?0:t)});return e.map((n,r)=>{if(r<this.period-1)return{index:r,value:null};let i=0,a=0;for(let n=r-this.period+1;n<=r;n++){var o;i+=t[n],a+=(o=e[n].volume)==null?0:o}return{index:r,value:a===0?0:i/a}})}getValueRange(e){return{min:-1,max:1}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:-1,max:1}:a,l=n.yToPixel(0,c,i),u=n.yToPixel(.2,c,i),d=n.yToPixel(-.2,c,i);e.fillStyle=`rgba(38,166,154,0.08)`,e.fillRect(0,0,s,u),e.fillStyle=`rgba(239,83,80,0.08)`,e.fillRect(0,d,s,i-d),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[.2,0,-.2]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore();let f=Math.max(1,s/Math.max(t.length,1)*.6);for(let a of t){if(a.value==null)continue;let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i),u=Math.abs(o-l),d=Math.min(o,l);e.fillStyle=a.value>=0?`rgba(38,166,154,0.45)`:`rgba(239,83,80,0.45)`,e.fillRect(t-f/2,d,f,u)}e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let p=!1;for(let a of t){if(a.value===null){p=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);p?e.lineTo(t,o):(e.moveTo(t,o),p=!0)}e.stroke()}},Is=class{constructor(e=`#ffd54f`){this.name=`Pivot`,this.color=e}compute(e){return e.map((t,n)=>{if(n===0)return{index:n,value:null,upper:null,lower:null,signal:null,histogram:null};let r=e[n-1],i=(r.high+r.low+r.close)/3;return{index:n,value:i,upper:2*i-r.low,lower:2*i-r.high,signal:i+(r.high-r.low),histogram:i-(r.high-r.low)}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a,l=null;for(let e=t.length-1;e>=0;e--)if(t[e].value!==null){l=t[e];break}if(l===null)return;let u=[{value:l.signal,label:`R2`,color:`#b71c1c`},{value:l.upper,label:`R1`,color:`#ef5350`},{value:l.value,label:`PP`,color:`#ffd54f`},{value:l.lower,label:`S1`,color:`#26a69a`},{value:l.histogram,label:`S2`,color:`#1b5e20`}];e.lineWidth=1,e.font=`10px sans-serif`,e.textBaseline=`middle`;for(let t of u){if(t.value==null)continue;let r=n.yToPixel(t.value,s,i);e.beginPath(),e.setLineDash([6,4]),e.strokeStyle=t.color,e.moveTo(0,r),e.lineTo(c,r),e.stroke(),e.setLineDash([]),e.fillStyle=t.color,e.fillText(t.label,c-28,r-6)}}},Ls=[0,.236,.382,.5,.618,.786,1],Rs=[`0%`,`23.6%`,`38.2%`,`50%`,`61.8%`,`78.6%`,`100%`],zs=[`#90a4ae`,`#4d96ff`,`#6bcb77`,`#ffd93d`,`#ff9800`,`#ef5350`,`#90a4ae`],Bs=class{constructor(e=50,t=`#e1bee7`){this.lookback=e,this.name=`Fib`,this.color=t}compute(e){return e.map((t,n)=>{let r=Math.max(0,n-this.lookback+1),i=-1/0,a=1/0;for(let t=r;t<=n;t++)e[t].high>i&&(i=e[t].high),e[t].low<a&&(a=e[t].low);let o=i-a;return{index:n,value:i,upper:a+.618*o,lower:a+.382*o,signal:a+.5*o,histogram:a}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a,l=null;for(let e=t.length-1;e>=0;e--)if(t[e].value!==null){l=t[e];break}if(l===null)return;let u=l.value,d=l.histogram;if(u==null||d==null)return;let f=u-d,p=Ls.map(e=>d+e*f);e.lineWidth=1,e.font=`10px sans-serif`,e.textBaseline=`middle`;for(let t=0;t<Ls.length;t++){let r=p[t],a=n.yToPixel(r,s,i),o=zs[t];e.beginPath(),e.setLineDash([6,4]),e.strokeStyle=o,e.moveTo(0,a),e.lineTo(c,a),e.stroke(),e.setLineDash([]),e.fillStyle=o,e.fillText(Rs[t],c-38,a-6)}}},Vs=class{constructor(e=10,t=3,n=`#26a69a`){this.atrPeriod=e,this.multiplier=t,this.name=`Supertrend`,this.color=n}compute(e){let t=e.length,n=[];if(t===0)return n;let r=Array(t).fill(0);for(let n=0;n<t;n++){let t=e[n].high,i=e[n].low,a=n>0?e[n-1].close:e[n].close;r[n]=Math.max(t-i,Math.abs(t-a),Math.abs(i-a))}let i=Array(t).fill(0);if(t<this.atrPeriod){for(let e=0;e<t;e++)n.push({index:e,value:null,upper:null});return n}let a=0;for(let e=0;e<this.atrPeriod;e++)a+=r[e];i[this.atrPeriod-1]=a/this.atrPeriod;for(let e=this.atrPeriod;e<t;e++)i[e]=(i[e-1]*(this.atrPeriod-1)+r[e])/this.atrPeriod;let o=Array(t).fill(0),s=Array(t).fill(0),c=Array(t).fill(1);for(let r=0;r<t;r++){if(r<this.atrPeriod-1){n.push({index:r,value:null,upper:null});continue}let t=(e[r].high+e[r].low)/2,a=t+this.multiplier*i[r],l=t-this.multiplier*i[r];if(r===this.atrPeriod-1){o[r]=a,s[r]=l,c[r]=1,n.push({index:r,value:s[r],upper:1});continue}let u=e[r-1].close;o[r]=a<o[r-1]||u>o[r-1]?a:o[r-1],s[r]=l>s[r-1]||u<s[r-1]?l:s[r-1],c[r-1]===-1?c[r]=e[r].close>o[r]?1:-1:c[r]=e[r].close<s[r]?-1:1;let d=c[r]===1?s[r]:o[r];n.push({index:r,value:d,upper:c[r]})}return n}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=2,e.lineJoin=`round`;let l=null;e.beginPath(),e.strokeStyle=`#26a69a`;let u=!1;for(let a of t){if(a.value==null||a.upper==null){u=!1;continue}if(!(a.upper>=0)){u=!1;continue}l!==1&&(u=!1);let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);u?e.lineTo(t,o):(e.moveTo(t,o),u=!0),l=1}e.stroke(),e.beginPath(),e.strokeStyle=`#ef5350`;let d=!1;l=null;for(let a of t){if(a.value==null||a.upper==null){d=!1;continue}if(!(a.upper<0)){d=!1;continue}l!==-1&&(d=!1);let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0),l=-1}e.stroke()}},Hs=class{constructor(e=.02,t=.2,n=`#ff6b9d`){this.step=e,this.maxAF=t,this.name=`PSAR`,this.color=n}compute(e){let t=e.length,n=[];if(t<2){for(let e=0;e<t;e++)n.push({index:e,value:null,upper:null});return n}let r=!0,i=this.step,a=e[0].high,o=e[0].low;n.push({index:0,value:null,upper:null});for(let s=1;s<t;s++){let t=o+i*(a-o);if(r){let n=e[s-1].low,o=s>=2?e[s-2].low:e[s-1].low;t=Math.min(t,n,o),t>e[s].low?(r=!1,t=a,a=e[s].low,i=this.step):e[s].high>a&&(a=e[s].high,i=Math.min(i+this.step,this.maxAF))}else{let n=e[s-1].high,o=s>=2?e[s-2].high:e[s-1].high;t=Math.max(t,n,o),t<e[s].high?(r=!0,t=a,a=e[s].high,i=this.step):e[s].low<a&&(a=e[s].low,i=Math.min(i+this.step,this.maxAF))}o=t,n.push({index:s,value:o,upper:r?1:-1})}return n}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;for(let a of t){if(a.value==null||a.upper==null)continue;let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);e.beginPath(),e.arc(t,o,2,0,Math.PI*2),e.fillStyle=a.upper>=0?`#26a69a`:`#ef5350`,e.fill()}}};function Us(e,t,n){if(t<n-1)return null;let r=-1/0,i=1/0;for(let a=t-n+1;a<=t;a++)e[a].high>r&&(r=e[a].high),e[a].low<i&&(i=e[a].low);return{high:r,low:i}}var Ws=class{constructor(e=9,t=26,n=52,r=`#b0bec5`){this.tenkanPeriod=e,this.kijunPeriod=t,this.senkouBPeriod=n,this.name=`Ichimoku`,this.color=r}compute(e){return e.map((t,n)=>{let r=Us(e,n,this.tenkanPeriod),i=r===null?null:(r.high+r.low)/2,a=Us(e,n,this.kijunPeriod),o=a===null?null:(a.high+a.low)/2,s=i!==null&&o!==null?(i+o)/2:null,c=Us(e,n,this.senkouBPeriod);return{index:n,value:i,upper:o,lower:s,signal:c===null?null:(c.high+c.low)/2,histogram:t.close}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let l=(a,o,l=!1)=>{e.strokeStyle=o,l&&e.setLineDash([4,3]),e.beginPath();let u=!1;for(let o of t){let t=a(o);if(t==null){u=!1;continue}let l=n.xToPixel(o.index,r,c),d=n.yToPixel(t,s,i);u?e.lineTo(l,d):(e.moveTo(l,d),u=!0)}e.stroke(),l&&e.setLineDash([])},u=[],d=[];for(let e of t){if(e.lower==null||e.signal==null)continue;let t=n.xToPixel(e.index,r,c);u.push([t,n.yToPixel(e.lower,s,i)]),d.push([t,n.yToPixel(e.signal,s,i)])}for(let t=0;t+1<u.length;t++){let[n,r]=u[t],[i,a]=u[t+1],[,o]=d[t],[,s]=d[t+1],c=r<o;e.beginPath(),e.moveTo(n,r),e.lineTo(i,a),e.lineTo(i,s),e.lineTo(n,o),e.closePath(),e.fillStyle=c?`rgba(38, 166, 154, 0.15)`:`rgba(239, 83, 80, 0.15)`,e.fill()}l(e=>e.lower,`#26a69a`,!0),l(e=>e.signal,`#ef5350`,!0),l(e=>e.value,`#ef9a9a`),l(e=>e.upper,`#90caf9`),e.strokeStyle=`#b0bec5`,e.beginPath();let f=!1;for(let a of t){if(a.histogram==null){f=!1;continue}let t=a.index-this.kijunPeriod;if(t<0){f=!1;continue}let o=n.xToPixel(t,r,c),l=n.yToPixel(a.histogram,s,i);f?e.lineTo(o,l):(e.moveTo(o,l),f=!0)}e.stroke()}},Gs=class{constructor(e=14,t=`#fff176`){this.period=e,this.pane=`sub`,this.paneHeight=80,this.name=`ADX`,this.color=t}compute(e){let t=e.length;if(t<this.period+1)return e.map((e,t)=>({index:t,value:null,upper:null,lower:null}));let n=Array(t).fill(0),r=Array(t).fill(0),i=Array(t).fill(0);n[0]=e[0].high-e[0].low,r[0]=0,i[0]=0;for(let a=1;a<t;a++){let t=e[a-1].close,o=e[a-1].high,s=e[a-1].low,c=e[a].high,l=e[a].low;n[a]=Math.max(c-l,Math.abs(c-t),Math.abs(l-t));let u=c-o,d=s-l;r[a]=u>d&&u>0?u:0,i[a]=d>u&&d>0?d:0}let a=0,o=0,s=0;for(let e=0;e<this.period;e++)a+=n[e],o+=r[e],s+=i[e];let c=[];for(let e=0;e<this.period;e++)c.push({index:e,value:null,upper:null,lower:null});let l=Array(t).fill(0),u=Array(t).fill(0),d=Array(t).fill(0),f=a===0?0:100*o/a,p=a===0?0:100*s/a,m=f+p===0?0:100*Math.abs(f-p)/(f+p);l[this.period-1]=f,u[this.period-1]=p,d[this.period-1]=m,c[this.period-1]={index:this.period-1,value:null,upper:f,lower:p};for(let e=this.period;e<t;e++){a=a-a/this.period+n[e],o=o-o/this.period+r[e],s=s-s/this.period+i[e];let t=a===0?0:100*o/a,f=a===0?0:100*s/a,p=t+f===0?0:100*Math.abs(t-f)/(t+f);l[e]=t,u[e]=f,d[e]=p,c.push({index:e,value:null,upper:t,lower:f})}let h=2*this.period-2;if(h>=t)return c;let g=0;for(let e=this.period-1;e<=h;e++)g+=d[e];g/=this.period,c[h].value=g;for(let e=h+1;e<t;e++)g=(g*(this.period-1)+d[e])/this.period,c[e].value=g;return c}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a;e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;let l=n.yToPixel(25,c,i);e.beginPath(),e.moveTo(0,l),e.lineTo(s,l),e.stroke(),e.setLineDash([]),e.restore();let u=(a,o,l)=>{e.beginPath(),e.strokeStyle=o,e.lineWidth=l,e.lineJoin=`round`;let u=!1;for(let o of t){let t=a(o);if(t==null){u=!1;continue}let l=n.xToPixel(o.index,r,s),d=n.yToPixel(t,c,i);u?e.lineTo(l,d):(e.moveTo(l,d),u=!0)}e.stroke()};u(e=>e.upper,`#26a69a`,1),u(e=>e.lower,`#ef5350`,1),u(e=>e.value,this.color,1.5)}},Ks=class{constructor(e=5,t=34,n=`#b0bec5`){this.fastPeriod=e,this.slowPeriod=t,this.name=`AO`,this.pane=`sub`,this.paneHeight=80,this.color=n}compute(e){let t=e.map(e=>(e.high+e.low)/2),n=(e,t,n)=>{if(t<n-1)return null;let r=0;for(let i=t-n+1;i<=t;i++)r+=e[i];return r/n};return e.map((e,r)=>{let i=n(t,r,this.fastPeriod),a=n(t,r,this.slowPeriod);return i===null||a===null?{index:r,value:null}:{index:r,value:i-a}})}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,Math.abs(n.value)));return{min:-t*1.2,max:t*1.2}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,Math.abs(e.value)));let l=a==null?{min:-c*1.2,max:c*1.2}:a,u=n.yToPixel(0,l,i);e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1,e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke(),e.setLineDash([]),e.restore();let d=Math.max(n.candleBodyWidth(r,s),1),f=null;for(let a of t){if(a.value==null){f=null;continue}let t=f===null?!0:a.value>=f,o=n.xToPixel(a.index,r,s),c=n.yToPixel(a.value,l,i),p=Math.abs(c-u),m=Math.min(c,u);e.fillStyle=t?`rgba(38,166,154,0.70)`:`rgba(239,83,80,0.70)`,e.fillRect(o-d/2,m,d,p),f=a.value}}},qs=class{constructor(e=`#90a4ae`,t=`#26a69a`,n=`#ef5350`){this.name=`HA`,this.color=e,this.upColor=t,this.downColor=n}compute(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i],o=(a.open+a.high+a.low+a.close)/4,s;s=i===0?(a.open+a.close)/2:(n+r)/2;let c=Math.max(a.high,s,o),l=Math.min(a.low,s,o);n=s,r=o,t.push({index:i,value:o,upper:c,lower:l,signal:s})}return t}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a,l=n.candleBodyWidth(r,c),u=l/2;for(let a of t){if(a.value==null||a.upper==null||a.lower==null||a.signal==null)continue;let t=a.value,o=a.upper,d=a.lower,f=a.signal,p=t>=f?this.upColor:this.downColor,m=n.xToPixel(a.index,r,c),h=n.yToPixel(o,s,i),g=n.yToPixel(d,s,i),_=n.yToPixel(f,s,i),v=n.yToPixel(t,s,i),y=Math.min(_,v),b=Math.max(1,Math.max(_,v)-y);e.beginPath(),e.strokeStyle=p,e.lineWidth=1,e.moveTo(m,h),e.lineTo(m,g),e.stroke(),e.fillStyle=p,e.strokeStyle=p,e.lineWidth=1,e.fillRect(m-u,y,l,b),e.strokeRect(m-u,y,l,b)}}},Js=class{constructor(e=`#26a69a`,t=`#ef5350`){this.name=`VOL`,this.pane=`sub`,this.paneHeight=80,this.upColor=e,this.downColor=t,this.color=e}compute(e){return e.map((e,t)=>{var n;return{index:t,value:(n=e.volume)==null?0:n,signal:e.close>=e.open?1:0}})}render(e,t,n,r,i){var a;let o=(a=e.canvas._chartWidth)==null?e.canvas.width:a,s=0;for(let e of t)e.value!=null&&e.value>s&&(s=e.value);if(s===0)return;let c={min:0,max:s*1.1},l=n.yToPixel(0,c,i),u=Math.max(n.candleBodyWidth(r,o),1);for(let a of t){if(a.value==null||a.value===0)continue;let t=n.xToPixel(a.index,r,o),s=n.yToPixel(a.value,c,i),d=Math.abs(l-s);e.fillStyle=a.signal===1?`${this.upColor}99`:`${this.downColor}99`,e.fillRect(t-u/2,s,u,d)}e.fillStyle=this.upColor,e.font=`10px 'Inter', system-ui, sans-serif`,e.fillText(this.name,4,11)}},Ys=class{constructor(e=14,t=`#ff9800`){this.period=e,this.name=`LinReg`,this.color=t}compute(e){let t=this.period,n=[],r=t*(t-1)/2,i=t*(t*(t-1)*(2*t-1)/6)-r*r;for(let a=0;a<e.length;a++){if(a<t-1){n.push({index:a,value:null});continue}let o=0,s=0;for(let n=0;n<t;n++){let r=e[a-(t-1-n)].close;o+=r,s+=n*r}let c=(t*s-r*o)/i,l=(o-c*r)/t+c*(t-1);n.push({index:a,value:l})}return n}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let l=!1;for(let a of t){if(a.value===null){l=!1;continue}let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);l?e.lineTo(t,o):(e.moveTo(t,o),l=!0)}e.stroke()}},Xs=[{name:`Moving Average`,short_name:`MA`,type:`Trend`,enabled:!0},{name:`Exponential Moving Average`,short_name:`EMA`,type:`Trend`,enabled:!0},{name:`Weighted Moving Average`,short_name:`WMA`,type:`Trend`,enabled:!0},{name:`Hull Moving Average`,short_name:`HMA`,type:`Trend`,enabled:!0},{name:`Moving Average Ribbon`,short_name:`MARibbon`,type:`Trend`,enabled:!0},{name:`Bollinger Bands`,short_name:`BB`,type:`Volatility`,enabled:!0},{name:`Keltner Channels`,short_name:`KC`,type:`Volatility`,enabled:!0},{name:`Donchian Channels`,short_name:`DC`,type:`Volatility`,enabled:!0},{name:`Average True Range`,short_name:`ATR`,type:`Volatility`,enabled:!0},{name:`Relative Strength Index`,short_name:`RSI`,type:`Momentum`,enabled:!0},{name:`Stochastic Oscillator`,short_name:`Stoch`,type:`Momentum`,enabled:!0},{name:`Stochastic RSI`,short_name:`StochRSI`,type:`Momentum`,enabled:!0},{name:`MACD`,short_name:`MACD`,type:`Momentum`,enabled:!0},{name:`Commodity Channel Index`,short_name:`CCI`,type:`Momentum`,enabled:!0},{name:`Williams %R`,short_name:`%R`,type:`Momentum`,enabled:!0},{name:`Rate of Change`,short_name:`ROC`,type:`Momentum`,enabled:!0},{name:`On Balance Volume`,short_name:`OBV`,type:`Volume`,enabled:!0},{name:`Volume`,short_name:`VOL`,type:`Volume`,enabled:!0},{name:`Volume Weighted Average Price`,short_name:`VWAP`,type:`Volume`,enabled:!0},{name:`Accumulation/Distribution`,short_name:`A/D`,type:`Volume`,enabled:!0},{name:`Money Flow Index`,short_name:`MFI`,type:`Volume`,enabled:!0},{name:`Chaikin Money Flow`,short_name:`CMF`,type:`Volume`,enabled:!0},{name:`Pivot Points Standard`,short_name:`Pivot`,type:`Support/Resistance`,enabled:!0},{name:`Fibonacci Retracement`,short_name:`Fib`,type:`Support/Resistance`,enabled:!0},{name:`Supertrend`,short_name:`Supertrend`,type:`Trend`,enabled:!0},{name:`Parabolic SAR`,short_name:`PSAR`,type:`Trend`,enabled:!0},{name:`Ichimoku Cloud`,short_name:`Ichimoku`,type:`Trend`,enabled:!0},{name:`ADX`,short_name:`ADX`,type:`Trend Strength`,enabled:!0},{name:`Awesome Oscillator`,short_name:`AO`,type:`Momentum`,enabled:!0},{name:`Heikin Ashi`,short_name:`HA`,type:`Price Transformation`,enabled:!1},{name:`Linear Regression`,short_name:`LinReg`,type:`Trend`,enabled:!0}];function Zs(e,t){if(e.length===0||t<=0)return e;let n=new Map;for(let r of e){let e=Math.floor(r.time/t)*t,i=n.get(e);i?i.push(r):n.set(e,[r])}let r=[];for(let[e,t]of n){let n=t[0].high,a=t[0].low,o=0;for(let e of t){var i;e.high>n&&(n=e.high),e.low<a&&(a=e.low),o+=(i=e.volume)==null?0:i}r.push({time:e,open:t[0].open,high:n,low:a,close:t[t.length-1].close,volume:o})}return r.sort((e,t)=>e.time-t.time),r}var Qs,$s=[{shortName:`MA`,factory:()=>new ls(20)},{shortName:`EMA`,factory:()=>new ds(20)},{shortName:`WMA`,factory:()=>new fs(20)},{shortName:`HMA`,factory:()=>new ms(20)},{shortName:`MARibbon`,factory:()=>new _s},{shortName:`BB`,factory:()=>new vs(20,2)},{shortName:`KC`,factory:()=>new ys(20,2)},{shortName:`DC`,factory:()=>new bs(20)},{shortName:`ATR`,factory:()=>new xs(14)},{shortName:`RSI`,factory:()=>new Ss(14)},{shortName:`Stoch`,factory:()=>new Cs(14,3)},{shortName:`StochRSI`,factory:()=>new Ts(14,14,3,3)},{shortName:`MACD`,factory:()=>new Ds(12,26,9)},{shortName:`CCI`,factory:()=>new Os(20)},{shortName:`%R`,factory:()=>new ks(14)},{shortName:`ROC`,factory:()=>new As(12)},{shortName:`AO`,factory:()=>new Ks},{shortName:`OBV`,factory:()=>new js},{shortName:`VWAP`,factory:()=>new Ms},{shortName:`A/D`,factory:()=>new Ns},{shortName:`MFI`,factory:()=>new Ps(14)},{shortName:`CMF`,factory:()=>new Fs(20)},{shortName:`Pivot`,factory:()=>new Is},{shortName:`Fib`,factory:()=>new Bs(50)},{shortName:`Supertrend`,factory:()=>new Vs(10,3)},{shortName:`PSAR`,factory:()=>new Hs(.02,.2)},{shortName:`Ichimoku`,factory:()=>new Ws(9,26,52)},{shortName:`ADX`,factory:()=>new Gs(14)},{shortName:`HA`,factory:()=>new qs},{shortName:`VOL`,factory:()=>new Js},{shortName:`LinReg`,factory:()=>new Ys(14)}],ec={kind:`select`,key:`timeframe`,label:`Timeframe`,options:[`Chart`,`1m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`8h`,`1D`,`1W`,`1M`],default:`Chart`};function tc(e,t,n){if(!n)return e;let r=n.fields.filter(e=>e.kind===`number`).map(e=>{var n;return(n=t[e.key])==null?e.default:n});return r.length>0?`${e}(${r.join(`, `)})`:e}var nc=[{shortName:`MA`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#F5A623`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new ls(e.period,e.color,`MA`,e.source)},{shortName:`EMA`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#9B59B6`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new ds(e.period,e.color,`EMA`,e.source)},{shortName:`WMA`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#e91e63`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new fs(e.period,e.color,`WMA`,e.source)},{shortName:`HMA`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#00bcd4`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new ms(e.period,e.color,`HMA`,e.source)},{shortName:`MARibbon`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#ffcc80`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new _s(e.color,e.source)},{shortName:`BB`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`number`,key:`stdDev`,label:`Std Dev`,min:.1,max:10,step:.1,default:2},{kind:`color`,key:`color`,label:`Color`,default:`#3B82F6`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new vs(e.period,e.stdDev,e.color,`BB`,e.source)},{shortName:`KC`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`number`,key:`mult`,label:`Multiplier`,min:.1,max:10,step:.1,default:2},{kind:`number`,key:`atrPeriod`,label:`ATR Period`,min:1,max:500,step:1,default:10},{kind:`color`,key:`color`,label:`Color`,default:`#4caf50`}],factory:e=>new ys(e.period,e.mult,e.atrPeriod,e.color)},{shortName:`DC`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#26c6da`}],factory:e=>new bs(e.period,e.color)},{shortName:`ATR`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#ff5722`}],factory:e=>new xs(e.period,e.color)},{shortName:`RSI`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#e8b84b`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new Ss(e.period,e.color,`RSI`,e.source)},{shortName:`Stoch`,fields:[{kind:`number`,key:`kPeriod`,label:`K Period`,min:1,max:500,step:1,default:14},{kind:`number`,key:`dPeriod`,label:`D Period`,min:1,max:100,step:1,default:3},{kind:`color`,key:`color`,label:`Color`,default:`#e040fb`}],factory:e=>new Cs(e.kPeriod,e.dPeriod,e.color)},{shortName:`StochRSI`,fields:[{kind:`number`,key:`rsiPeriod`,label:`RSI Period`,min:1,max:500,step:1,default:14},{kind:`number`,key:`stochPeriod`,label:`Stoch Period`,min:1,max:500,step:1,default:14},{kind:`number`,key:`kPeriod`,label:`K Smooth`,min:1,max:100,step:1,default:3},{kind:`number`,key:`dPeriod`,label:`D Smooth`,min:1,max:100,step:1,default:3},{kind:`color`,key:`color`,label:`Color`,default:`#00e5ff`}],factory:e=>new Ts(e.rsiPeriod,e.stochPeriod,e.kPeriod,e.dPeriod,e.color)},{shortName:`MACD`,fields:[{kind:`number`,key:`fast`,label:`Fast Period`,min:1,max:500,step:1,default:12},{kind:`number`,key:`slow`,label:`Slow Period`,min:1,max:500,step:1,default:26},{kind:`number`,key:`signal`,label:`Signal Period`,min:1,max:100,step:1,default:9},{kind:`color`,key:`color`,label:`Color`,default:`#2196f3`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new Ds(e.fast,e.slow,e.signal,e.color,`MACD`,e.source)},{shortName:`CCI`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#4db6ac`}],factory:e=>new Os(e.period,e.color)},{shortName:`%R`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#ff7043`}],factory:e=>new ks(e.period,e.color)},{shortName:`ROC`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:12},{kind:`color`,key:`color`,label:`Color`,default:`#80cbc4`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new As(e.period,e.color,e.source)},{shortName:`AO`,fields:[{kind:`number`,key:`fastPeriod`,label:`Fast Period`,min:1,max:100,step:1,default:5},{kind:`number`,key:`slowPeriod`,label:`Slow Period`,min:1,max:200,step:1,default:34},{kind:`color`,key:`color`,label:`Color`,default:`#b0bec5`}],factory:e=>new Ks(e.fastPeriod,e.slowPeriod,e.color)},{shortName:`OBV`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#aed581`}],factory:e=>new js(e.color)},{shortName:`VWAP`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#9c27b0`}],factory:e=>new Ms(e.color)},{shortName:`A/D`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#ce93d8`}],factory:e=>new Ns(e.color)},{shortName:`MFI`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#ffab40`}],factory:e=>new Ps(e.period,e.color)},{shortName:`CMF`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#80deea`}],factory:e=>new Fs(e.period,e.color)},{shortName:`Pivot`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#ffd54f`}],factory:e=>new Is(e.color)},{shortName:`Fib`,fields:[{kind:`number`,key:`lookback`,label:`Lookback`,min:1,max:500,step:1,default:50},{kind:`color`,key:`color`,label:`Color`,default:`#e1bee7`}],factory:e=>new Bs(e.lookback,e.color)},{shortName:`Supertrend`,fields:[{kind:`number`,key:`atrPeriod`,label:`ATR Period`,min:1,max:500,step:1,default:10},{kind:`number`,key:`multiplier`,label:`Multiplier`,min:.1,max:20,step:.1,default:3},{kind:`color`,key:`color`,label:`Color`,default:`#26a69a`}],factory:e=>new Vs(e.atrPeriod,e.multiplier,e.color)},{shortName:`PSAR`,fields:[{kind:`number`,key:`step`,label:`Step`,min:.001,max:.1,step:.001,default:.02},{kind:`number`,key:`maxAF`,label:`Max AF`,min:.01,max:1,step:.01,default:.2},{kind:`color`,key:`color`,label:`Color`,default:`#ff6b9d`}],factory:e=>new Hs(e.step,e.maxAF,e.color)},{shortName:`Ichimoku`,fields:[{kind:`number`,key:`tenkan`,label:`Tenkan Period`,min:1,max:100,step:1,default:9},{kind:`number`,key:`kijun`,label:`Kijun Period`,min:1,max:200,step:1,default:26},{kind:`number`,key:`senkouB`,label:`Senkou B Period`,min:1,max:500,step:1,default:52},{kind:`color`,key:`color`,label:`Color`,default:`#b0bec5`}],factory:e=>new Ws(e.tenkan,e.kijun,e.senkouB,e.color)},{shortName:`ADX`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#fff176`}],factory:e=>new Gs(e.period,e.color)},{shortName:`HA`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#90a4ae`},{kind:`color`,key:`upColor`,label:`Up Color`,default:`#26a69a`},{kind:`color`,key:`downColor`,label:`Down Color`,default:`#ef5350`}],factory:e=>new qs(e.color,e.upColor,e.downColor)},{shortName:`VOL`,fields:[{kind:`color`,key:`upColor`,label:`Up Color`,default:`#26a69a`},{kind:`color`,key:`downColor`,label:`Down Color`,default:`#ef5350`}],factory:e=>new Js(e.upColor,e.downColor)},{shortName:`LinReg`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#ff9800`}],factory:e=>new Ys(e.period,e.color)}],rc=70,ic=24,ac=.18,oc=80,sc=1,cc=80,lc=10,uc=.25,dc=.2;function fc(){return typeof window<`u`&&(`ontouchstart`in window||navigator.maxTouchPoints>1)}function pc(e=2,t=!1,n=cc,r,i,a){if(i&&i>0&&a&&a>0){let e=Math.floor(i/a);return Math.max(10,Math.min(500,e))}return!t&&!fc()?n:r===void 0?Math.max(10,Math.round(n/e)):r}var mc=4;function hc(e,t){let n=(e.min+e.max)/2,r=(e.max-e.min)/2;return{min:n-r*t,max:n+r*t}}function gc(e){let t=e.max-e.min;return t>=100?0:t>=10?1:t>=1?2:t>=.1?3:4}var _c=class n{get indicators(){return this.activeIndicators.filter(e=>{if(!e.visible)return!1;let t=e.currentParams.timeframe;return!(t&&t!==`Chart`&&t!==this.timeframe)}).map(e=>e.indicator)}get isFullscreen(){return this._isCssFullscreen||!!document.fullscreenElement}get _isTradingActive(){var e,t,n,r;return((e=(t=this.tradePopover)==null?void 0:t.isVisible)==null?!1:e)||this.draftOrderLabel!==null||((n=(r=this.tradeDragHandler)==null?void 0:r.active)==null?!1:n)||this.pendingLevelDrags.size>0}constructor(i){var a,o,l,f,p,m,h,g,_,v,y,b,x,C,T,D,O,A,j,M;if(this.topBar=null,this.bottomBar=null,this.leftBar=null,this.leftBarVisible=!0,this.drawingToolsEnabled=!0,this.settingsEnabled=!0,this.fullscreenEnabled=!0,this._mobileLayout=!1,this.indicatorOverlay=null,this.subPaneOverlays=new Map,this.isinPickerModal=null,this.isins=[],this.siEl=null,this.siStreamDot=null,this.siSymbolSpan=null,this.siOHLCSpan=null,this.siOHLC2Span=null,this.tickActivityTimer=null,this.tickActivityMs=3e4,this.streamStatus=`disconnected`,this.indicatorSettingsDialog=null,this.chartSettingsDialog=null,this.tradeButton=null,this.tradePopover=null,this.draftOrderLabel=null,this._minLots=1,this._showQuantityField=!1,this._qtyFieldMin=1,this._qtyFieldMax=100,this._draftQtyFlyout=null,this._draftQtyPillArea=void 0,this._activeQtyPillLabel=void 0,this.pendingQtyChanges=new Map,this.originalQtyByLabel=new Map,this._onOrderSubmit=void 0,this.scrollToEndBtn=null,this.scrollToEndVisible=!1,this.scrollAnimId=null,this.resetViewBtn=null,this.resetViewVisible=!1,this._defaultVisibleBars=cc,this.dataStore=new t,this.scaleManager=new r,this.emitter=new s,this.themeName=`dark`,this._debug=!1,this.symbol=``,this.showBidAskLines=!1,this.showActLogo=!1,this.hideLevelConfirmCancel=!1,this.tradeLevelButtonScale=1,this.levelClusteringEnabled=!0,this.clusterThresholdDistance=20,this.enableThemeToggle=!1,this.activeIndicators=[],this.indicatorResults=new Map,this.viewport={startIndex:0,endIndex:pc(),candleWidth:8,candleGap:2},this._targetViewport={startIndex:0,endIndex:pc(),candleWidth:8,candleGap:2},this._isPanning=!1,this.crosshair=null,this.drawingManager=new Xo,this.textInputEl=null,this.textInputDrawing=null,this._pendingDrawDrag=null,this._pendingDrawResize=null,this.paneHeightOverrides=new Map,this.separatorDrag=null,this.priceAxisWidth=rc,this.timeAxisHeight=ic,this.priceScaleFactor=1,this.pricePanOffset=0,this._displayedPriceRange=null,this._lockedAutoFitBase=null,this.axisDrag=null,this.subPaneScaleFactors=new Map,this._mobileCrosshairActive=!1,this._mobileTapStartXY=null,this._longPressTimer=null,this._longPressPoint=null,this._lastTouchTime=0,this._tradeButtonClickData=null,this.disposeVvListener=()=>{},this.rafId=null,this.countdownRafId=null,this.countdownActive=!1,this._cachedWrapRect=null,this._cachedDrawRect=null,this._drawTouchAnchorActive=!1,this._lastDrawingTouchPoint=null,this._drawTouchStartXY=null,this._mobileDrawingFlyout=null,this._isCssFullscreen=!1,this.timezone=`UTC`,this.settingsCanvasColors={},this.streamAdapter=null,this.liveBidAsk=null,this.tickClosePriceSource=`bid`,this._suppressTicks=!1,this.levels=[],this.tradeLevelHitAreas=[],this.offViewportHitAreas=[],this.tradeLevelEditAreas=[],this.tradeHoverAreas=[],this.tradeLevelDragAreas=[],this.tradeLevelConfirmAreas=[],this.tradeAddBracketAreas=[],this.clusterBadgeAreas=[],this.lastClusters=[],this.expandedClusters=new Set,this.hoveredTradeLabel=null,this.selectedTradeLabel=null,this._editOpenLabel=null,this.draftBracketPnl={},this.tradeDragHandler=null,this.tradeDragNewPrice=null,this.tradeDragNewSLPrice=null,this.tradeDragNewTPPrice=null,this._pendingBracketOrderLabel=null,this._slSiblingOrderLabel=null,this._tpSiblingOrderLabel=null,this._isBracketNew=!1,this.pendingLevelDrags=new Map,this.tfcEnabled=!0,this.tfcActive=!0,this.tradeDisplayFilter=`all`,this.positionRenderStyle=`dot`,this.tradesThresholdForHorizontalLine=2,this.positionRenderStyleOverride=null,this.RENDER_STYLE_LS_KEY=`finchart:positionRenderStyle`,this.dataLoader=null,this.isFetching=!1,this.noMoreData=!1,this._loadGeneration=0,this.maxCandles=200,this.minInitialBars=10,this.maxLookbackMs=365*24*60*60*1e3,this.prefetchThreshold=80,this.defaultVisibleBars=cc,this.defaultMobileVisibleBars=void 0,this.mobileBarDivisor=2,this.explicitMobileDivisor=!1,this._autoVisibleBars=!0,this.targetCandleWidth=lc,this.maxSubPanes=3,this.showCandleCountdown=!0,this.loadingOverlayEl=null,this.noDataOverlayEl=null,this.logoImage=null,this.isRestoringState=!1,this.onMouseMove=e=>{var t,r,i,a,o;if(this._mobileCrosshairActive||Date.now()-this._lastTouchTime<500)return;let s=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,c=e.clientX-s.left,l=e.clientY-s.top,{chartW:u,priceH:d}=this.getChartLayout(),f=(r=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):r,p=s.height-this.timeAxisHeight,m=c<u&&l<p,h=this.scaleManager.pixelToBarIndex(c,this.viewport,u),g=this.scaleManager.pixelToPrice(l,f,d),_=Math.max(Math.floor(this.viewport.startIndex),Math.min(Math.ceil(this.viewport.endIndex),Math.round(h))),v=(i=this.dataStore.all[_])==null?null:i;this.crosshair=m&&!((a=this.tradePopover)!=null&&a.isVisible)&&this.selectedTradeLabel===null?{x:c,y:l,barIndex:_,price:g,bar:v}:null,this.crosshair&&this.emitter.emit(`crosshair`,this.crosshair);let y=this.positionRenderStyle===`dot`&&this.hoveredTradeLabel!==null;if(this.tradeButton&&(m&&l>=0&&l<=d&&!this._isTradingActive&&!y?(this.tradeButton.setY(l),xt(l,this.uiConfig.tradeButton.size/2,this.offViewportHitAreas)?this.tradeButton.hide():this.tfcActive&&this.tradeButton.show(),this._tradeButtonClickData={price:g,y:l}):this.tradeButton.hide()),this._pendingDrawResize){let e=c-this._pendingDrawResize.startX,t=l-this._pendingDrawResize.startY;Math.sqrt(e*e+t*t)>n.DRAW_GESTURE_THRESHOLD&&(this.drawingManager.startResize(this._pendingDrawResize.drawing,this._pendingDrawResize.pointIndex),this._pendingDrawResize=null)}if(this._pendingDrawDrag){let e=c-this._pendingDrawDrag.startX,t=l-this._pendingDrawDrag.startY;Math.sqrt(e*e+t*t)>n.DRAW_GESTURE_THRESHOLD&&(this.drawingManager.startDrag(this._pendingDrawDrag.drawing,{barIndex:h,price:g}),this._pendingDrawDrag=null)}if(this.drawingManager.onMouseMove({barIndex:h,price:g}),this.axisDrag){if(this.axisDrag.axis===`price`){let e=l-this.axisDrag.startPos;this.priceScaleFactor=Math.max(.1,Math.min(10,this.axisDrag.startSize*1.005**e))}else if(this.axisDrag.axis===`subpane`&&this.axisDrag.indicatorName){let e=l-this.axisDrag.startPos,t=Math.max(.1,Math.min(20,this.axisDrag.startSize*1.005**e));this.subPaneScaleFactors.set(this.axisDrag.indicatorName,t)}else{let e=c-this.axisDrag.startPos,t=Math.max(10,Math.min(500,Math.round(this.axisDrag.startSize+e*.5))),n=(this.viewport.startIndex+this.viewport.endIndex)/2,r=Math.max(0,n-t/2);this.viewport={...this.viewport,startIndex:r,endIndex:r+t},this._targetViewport={...this.viewport}}this.drawCanvas.style.cursor=this.axisDrag.axis===`time`?`ew-resize`:`ns-resize`,this.scheduleRender();return}if(this.separatorDrag){let e=this.separatorDrag.startY-l,t=Math.max(40,Math.min(300,this.separatorDrag.startH+e));this.paneHeightOverrides.set(this.separatorDrag.indicatorName,t),this.drawCanvas.style.cursor=`ns-resize`,this.scheduleRender();return}if((o=this.tradeDragHandler)!=null&&o.active){var b,x,S;let e=this.tradeDragHandler.onMouseMove(l,this.scaleManager,f,d);if(this.tradeDragNewPrice=(b=e==null?void 0:e.newPrice)==null?null:b,this.tradeDragNewSLPrice=(x=e==null?void 0:e.derivedSLPrice)==null?null:x,this.tradeDragNewTPPrice=(S=e==null?void 0:e.derivedTPPrice)==null?null:S,this.drawCanvas.style.cursor=`ns-resize`,this.renderTradeLayer(),this.tradeDragNewPrice!==null&&e){let t=e.label.indexOf(`:`),n=t===-1?e.label:e.label.slice(0,t),r=t===-1?void 0:e.label.slice(t+1),i=this.levels.find(e=>e.label===n);i&&this.emitter.emit(`tradeLevelDrag`,{label:i.label,newPrice:this.tradeDragNewPrice,data:i.data,bracketType:r,...e.derivedSLPrice===void 0?{}:{derivedSLPrice:e.derivedSLPrice},...e.derivedTPPrice===void 0?{}:{derivedTPPrice:e.derivedTPPrice},isFullscreen:this.isFullscreen})}return}if(!this.drawingManager.getActiveTool()){var C;if(ue(c,l,this.clusterBadgeAreas)||tt(c,l,this.tradeLevelHitAreas)||nt(c,l,this.tradeLevelEditAreas)||rt(c,l,this.tradeLevelConfirmAreas)||bt(c,l,this.offViewportHitAreas)){this.drawCanvas.style.cursor=`pointer`,this.scheduleRender();return}if(at(c,l,this.tradeLevelDragAreas)){this.drawCanvas.style.cursor=`ns-resize`,this.scheduleRender();return}let e=it(c,l,this.tradeHoverAreas),t=(C=e==null?void 0:e.label)==null?null:C;if(t!==this.hoveredTradeLabel&&(this.hoveredTradeLabel=t,this.renderTradeLayer()),this.positionRenderStyle===`dot`&&t!==null){this.crosshair=null,this.drawCanvas.style.cursor=`pointer`,this.scheduleRender();return}if(this.getSeparatorPositions().find(e=>Math.abs(l-e.y)<=4))this.drawCanvas.style.cursor=`ns-resize`;else if(c>=u)this.drawCanvas.style.cursor=`ns-resize`;else if(l>=p)this.drawCanvas.style.cursor=`ew-resize`;else if(this.drawingManager.isDraggingDrawing()||this.drawingManager.isResizingDrawing())this.drawCanvas.style.cursor=`grabbing`;else{let e=this.drawingManager.getHandleAtPoint(c,l,this.scaleManager,this.viewport,f,u,d);if(e)this.drawCanvas.style.cursor=e.handle.cursor;else{let e=this.drawingManager.hitTest(c,l,this.scaleManager,this.viewport,f,u,d);this.drawCanvas.style.cursor=e?`move`:`default`}}}this.scheduleRender()},this.onMouseLeave=e=>{if(!(this.tradeButton&&this.tradeButton.el.contains(e.relatedTarget))&&!this._mobileCrosshairActive){if(this.crosshair=null,!this._isTradingActive){var t;(t=this.tradeButton)==null||t.hide()}this.hoveredTradeLabel!==null&&(this.hoveredTradeLabel=null,this.renderTradeLayer()),this.scheduleRender()}},this.onMouseUp=()=>{var e;if((e=this.tradeDragHandler)!=null&&e.active){let e=this.tradeDragHandler.endDrag();if(e){var t;this._finalizeMainDragWithBrackets(e,(t=this._pendingBracketOrderLabel)==null?void 0:t)}else this.tradeDragNewPrice=null;this._pendingBracketOrderLabel=null,this.drawCanvas.style.cursor=`default`,this.renderTradeLayer();return}this.axisDrag&&(this.axisDrag=null,this.drawCanvas.style.cursor=`default`,this.scheduleRender()),this.separatorDrag&&(this.separatorDrag=null,this.drawCanvas.style.cursor=`default`,this.scheduleRender()),this._pendingDrawDrag=null,this._pendingDrawResize=null,this.drawingManager.isDraggingDrawing()&&(this.drawingManager.endDrag(),this.drawCanvas.style.cursor=`default`,this.scheduleRender()),this.drawingManager.isResizingDrawing()&&(this.drawingManager.endResize(),this.drawCanvas.style.cursor=`default`,this.scheduleRender())},this.onDrawingTouchStart=e=>{var t;if(e.touches.length!==1)return;let n=e.touches[0],r=this.touchToDrawingPoint(n),i=this.drawingManager.getActiveTool(),a=this.drawingManager.isPlacing();if(i!==null||a){e.preventDefault(),this._lastDrawingTouchPoint=r,a?(this._drawTouchAnchorActive=!1,this.drawingManager.onMouseMove(r)):(this.drawingManager.onMouseDown(r),this._drawTouchAnchorActive=this.drawingManager.isPlacing()),this.scheduleRender();return}let o=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,s=n.clientX-o.left,c=n.clientY-o.top,{chartW:l,priceH:u}=this.getChartLayout(),d=this.getScaledPriceRange(this.viewport);if(s>=l){if(e.preventDefault(),c<=u)this.axisDrag={axis:`price`,startPos:c,startSize:this.priceScaleFactor};else{let e=this.activeIndicators.filter(e=>e.indicator.pane===`sub`).map(e=>e.indicator),t=u+sc;for(let n of e){let e=this.paneH(n);if(c>=t&&c<t+e){var f;this.axisDrag={axis:`subpane`,startPos:c,startSize:(f=this.subPaneScaleFactors.get(n.name))==null?1:f,indicatorName:n.name};break}t+=e+sc}}this.scheduleRender();return}let p=o.height-this.timeAxisHeight;if(c>=p){e.preventDefault(),this.axisDrag={axis:`time`,startPos:s,startSize:this.viewport.endIndex-this.viewport.startIndex},this.scheduleRender();return}let m=this.drawingManager.getHandleAtPoint(s,c,this.scaleManager,this.viewport,d,l,u);if(m){e.preventDefault(),this.panHandler.cancel(),this.drawingManager.selectDrawing(m.drawing),this.drawingManager.startResize(m.drawing,m.handle.pointIndex),this.hideMobileDrawingFlyout(),this.scheduleRender();return}let h=this.drawingManager.hitTest(s,c,this.scaleManager,this.viewport,d,l,u);if(h){e.preventDefault(),this.panHandler.cancel(),this.drawingManager.selectDrawing(h),this.drawingManager.startDrag(h,r),this._drawTouchStartXY={x:n.clientX,y:n.clientY},this.hideMobileDrawingFlyout(),this.scheduleRender();return}let g=ue(s,c,this.clusterBadgeAreas);if(g){e.preventDefault(),this.panHandler.cancel(),this.expandedClusters.has(g.clusterId)?this.expandedClusters.delete(g.clusterId):this.expandedClusters.add(g.clusterId),this.renderTradeLayer();return}let _=bt(s,c,this.offViewportHitAreas);if(_){e.preventDefault(),this.panHandler.cancel(),this.scrollToCenterPrice(_.targetPrice);return}let v=rt(s,c,this.tradeLevelConfirmAreas);if(v){e.preventDefault(),v.action===`confirm`?this.applyPendingChanges(v.label):this.revertPendingChanges(v.label);return}if(this._showQuantityField&&this._draftQtyPillArea){let t=this._draftQtyPillArea;if(s>=t.pillX&&s<=t.pillX+t.pillW&&c>=t.pillY&&c<=t.pillY+t.pillH){e.preventDefault(),e.stopPropagation(),this.openDraftQtyFlyout(t);return}}let y=tt(s,c,this.tradeLevelHitAreas);if(y){e.preventDefault(),this._handleTradeLevelClose(y);return}if(!this.drawingManager.getActiveTool()){let t=nt(s,c,this.tradeLevelEditAreas);if(t){e.preventDefault();let n=this.levels.find(e=>e.label===t.label);if(n){this.selectedTradeLabel=n.label,this.renderTradeLayer();let{slPrice:e,tpPrice:t}=this._resolveBracketPrices(n);this._editOpenLabel=n.label,this.emitter.emit(`tradeLevelEditOpen`,{label:n.label,type:n.type,data:n.data,price:n.price,side:n.side,stopLossPrice:e,takeProfitPrice:t,isFullscreen:this.isFullscreen})}return}}if(this.tradeDragHandler&&!this.drawingManager.getActiveTool()){let t=at(s,c,this.tradeLevelDragAreas);if(t){e.preventDefault();let n=this.levels.find(e=>e.label===t.label);if(n){let e=this.selectedTradeLabel===n.label,r=t.isBracket||n.type===`pending`&&n.orderType!==`market`&&(e||!t.isBox);if(this.hideLevelConfirmCancel&&!r){let e=this.pendingLevelDrags.has(n.label);this.selectedTradeLabel===n.label&&!e?this.selectedTradeLabel=null:this.selectedTradeLabel=n.label,this.renderTradeLayer();let{slPrice:t,tpPrice:r}=this._resolveBracketPrices(n);this._editOpenLabel=n.label,this.emitter.emit(`tradeLevelEditOpen`,{label:n.label,type:n.type,data:n.data,price:n.price,side:n.side,stopLossPrice:t,takeProfitPrice:r,isFullscreen:this.isFullscreen});return}this._startTradeDragFromHit(t,n,c),this.scheduleRender();return}}let n=ot(s,c,this.tradeAddBracketAreas);if(n){e.preventDefault(),this._startAddBracketFromHit(n,c),this.scheduleRender();return}}if(this.tradeDragHandler&&!this.drawingManager.getActiveTool()){let t=it(s,c,this.tradeHoverAreas);if(t){e.preventDefault();let n=this.levels.find(e=>e.label===t.label);if(n){let e=this.pendingLevelDrags.has(t.label);this.selectedTradeLabel===t.label&&!e?this.selectedTradeLabel=null:this.selectedTradeLabel=t.label;let{slPrice:r,tpPrice:i}=this._resolveBracketPrices(n);this._editOpenLabel=n.label,this.renderTradeLayer(),this.emitter.emit(`tradeLevelEditOpen`,{label:n.label,type:n.type,data:n.data,price:n.price,side:n.side,stopLossPrice:r,takeProfitPrice:i,isFullscreen:this.isFullscreen});return}}}this.drawingManager.selectDrawing(null),this.hideMobileDrawingFlyout(),this.expandedClusters.size>0&&(this.expandedClusters.clear(),this.renderTradeLayer()),s<l&&c<p&&(this._mobileCrosshairActive?(this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null),this._mobileTapStartXY={x:s,y:c}):(this._longPressTimer!==null&&clearTimeout(this._longPressTimer),this._longPressPoint={x:s,y:c},this._longPressTimer=setTimeout(()=>{this._longPressTimer=null,this._longPressPoint&&(this._activateMobileCrosshair(this._longPressPoint.x,this._longPressPoint.y),this._longPressPoint=null)},500)))},this.onDrawingTouchMove=e=>{var t;if(e.touches.length!==1)return;let n=this.touchToDrawingPoint(e.touches[0]);if(this._lastDrawingTouchPoint=n,this.axisDrag){var r;e.preventDefault();let t=e.touches[0],n=(r=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():r,i=t.clientX-n.left,a=t.clientY-n.top;if(this.axisDrag.axis===`price`){let e=a-this.axisDrag.startPos;this.priceScaleFactor=Math.max(.1,Math.min(10,this.axisDrag.startSize*1.005**e))}else if(this.axisDrag.axis===`subpane`&&this.axisDrag.indicatorName){let e=a-this.axisDrag.startPos,t=Math.max(.1,Math.min(20,this.axisDrag.startSize*1.005**e));this.subPaneScaleFactors.set(this.axisDrag.indicatorName,t)}else{let e=i-this.axisDrag.startPos,t=Math.max(10,Math.min(500,Math.round(this.axisDrag.startSize+e*.5))),n=(this.viewport.startIndex+this.viewport.endIndex)/2,r=Math.max(0,n-t/2);this.viewport={...this.viewport,startIndex:r,endIndex:r+t}}this.scheduleRender();return}if(this.drawingManager.isPlacing()&&!this._drawTouchAnchorActive){e.preventDefault(),this.drawingManager.onMouseMove(n),this.scheduleRender();return}if(this.drawingManager.isDraggingDrawing()||this.drawingManager.isResizingDrawing()){e.preventDefault(),e.stopPropagation(),this.drawingManager.onMouseMove(n),this.scheduleRender();return}if((t=this.tradeDragHandler)!=null&&t.active){var i,a,o,s,c;e.preventDefault();let t=e.touches[0],n=(i=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():i,r=t.clientY-n.top,{priceH:l}=this.getChartLayout(),u=(a=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):a,d=this.tradeDragHandler.onMouseMove(r,this.scaleManager,u,l);if(this.tradeDragNewPrice=(o=d==null?void 0:d.newPrice)==null?null:o,this.tradeDragNewSLPrice=(s=d==null?void 0:d.derivedSLPrice)==null?null:s,this.tradeDragNewTPPrice=(c=d==null?void 0:d.derivedTPPrice)==null?null:c,this.renderTradeLayer(),this.tradeDragNewPrice!==null&&d){let e=d.label.indexOf(`:`),t=e===-1?d.label:d.label.slice(0,e),n=e===-1?void 0:d.label.slice(e+1),r=this.levels.find(e=>e.label===t);r&&this.emitter.emit(`tradeLevelDrag`,{label:r.label,newPrice:this.tradeDragNewPrice,data:r.data,bracketType:n,...d.derivedSLPrice===void 0?{}:{derivedSLPrice:d.derivedSLPrice},...d.derivedTPPrice===void 0?{}:{derivedTPPrice:d.derivedTPPrice},isFullscreen:this.isFullscreen})}return}if(this._mobileTapStartXY||this._longPressTimer!==null){var l,u;let t=e.touches[0],n=(l=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():l,r=(u=this._mobileTapStartXY)==null?this._longPressPoint:u;if(r){let e=t.clientX-n.left-r.x,i=t.clientY-n.top-r.y;Math.sqrt(e*e+i*i)>6&&(this._mobileTapStartXY=null,this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null,this._longPressPoint=null))}}if(this._mobileCrosshairActive){var d,f;e.preventDefault();let t=e.touches[0],n=(d=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():d,r=t.clientX-n.left,i=t.clientY-n.top,{chartW:a,priceH:o}=this.getChartLayout(),s=(f=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):f,c=n.height-this.timeAxisHeight;if(r<a&&i<c){var p;let e=this.scaleManager.pixelToBarIndex(r,this.viewport,a),t=this.scaleManager.pixelToPrice(i,s,o),n=Math.max(Math.floor(this.viewport.startIndex),Math.min(Math.ceil(this.viewport.endIndex),Math.round(e))),c=(p=this.dataStore.all[n])==null?null:p;this.crosshair=this.selectedTradeLabel===null?{x:r,y:i,barIndex:n,price:t,bar:c}:null,this.tradeButton&&(this.tradeButton.setY(i),this._isTradingActive||xt(i,this.uiConfig.tradeButton.size/2,this.offViewportHitAreas)?this.tradeButton.hide():this.tfcActive&&this.tradeButton.show(),this._tradeButtonClickData={price:t,y:i}),this.scheduleRender()}}},this.onDrawingTouchEnd=e=>{var t;if(this._lastTouchTime=Date.now(),this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null,this._longPressPoint=null),(t=this.tradeDragHandler)!=null&&t.active){let e=this.tradeDragHandler.endDrag();if(e){var n;this._finalizeMainDragWithBrackets(e,(n=this._pendingBracketOrderLabel)==null?void 0:n)}else this.tradeDragNewPrice=null;this._pendingBracketOrderLabel=null,this.renderTradeLayer();return}if(this.axisDrag){this.axisDrag=null,this.scheduleRender();return}let r=this._drawTouchAnchorActive;if(this._drawTouchAnchorActive=!1,!r&&this.drawingManager.isPlacing()&&this._lastDrawingTouchPoint){this.drawingManager.onMouseDown(this._lastDrawingTouchPoint),this._lastDrawingTouchPoint=null,this.scheduleRender();return}if(this.drawingManager.isDraggingDrawing()){let t=e.changedTouches[0],n=this._drawTouchStartXY;if(this._drawTouchStartXY=null,this.drawingManager.endDrag(),t&&n&&this.drawingManager.getSelectedDrawing()){let e=t.clientX-n.x,r=t.clientY-n.y;Math.sqrt(e*e+r*r)<8&&this.showMobileDrawingFlyout(t.clientX,t.clientY)}this.scheduleRender()}if(this.drawingManager.isResizingDrawing()&&(this.drawingManager.endResize(),this.scheduleRender()),this._mobileTapStartXY){var i;this._mobileTapStartXY=null,this._mobileCrosshairActive=!1,this.crosshair=null,(i=this.tradeButton)==null||i.hide(),this.scheduleRender()}},this.onCanvasClick=e=>{var t,n;let r=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,i=e.clientX-r.left,a=e.clientY-r.top,{chartW:o,priceH:s}=this.getChartLayout(),c=(n=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):n,l=this.scaleManager.pixelToBarIndex(i,this.viewport,o),u=this.scaleManager.pixelToPrice(a,c,s),d=Math.round(l),f=ue(i,a,this.clusterBadgeAreas);if(f){this.expandedClusters.has(f.clusterId)?this.expandedClusters.delete(f.clusterId):this.expandedClusters.add(f.clusterId),this.renderTradeLayer();return}let p=bt(i,a,this.offViewportHitAreas);if(p){this.scrollToCenterPrice(p.targetPrice);return}let m=rt(i,a,this.tradeLevelConfirmAreas);if(m){m.action===`confirm`?this.applyPendingChanges(m.label):this.revertPendingChanges(m.label);return}if(this._showQuantityField&&this._draftQtyPillArea){let t=this._draftQtyPillArea;if(i>=t.pillX&&i<=t.pillX+t.pillW&&a>=t.pillY&&a<=t.pillY+t.pillH){e.preventDefault(),e.stopPropagation(),this.openDraftQtyFlyout(t);return}}let h=tt(i,a,this.tradeLevelHitAreas);if(h){this._handleTradeLevelClose(h);return}if(!this.drawingManager.getActiveTool()){let e=nt(i,a,this.tradeLevelEditAreas);if(e){let t=this.levels.find(t=>t.label===e.label);if(t){this.selectedTradeLabel=t.label,this.renderTradeLayer();let{slPrice:e,tpPrice:n}=this._resolveBracketPrices(t);this._editOpenLabel=t.label,this.emitter.emit(`tradeLevelEditOpen`,{label:t.label,type:t.type,data:t.data,price:t.price,side:t.side,stopLossPrice:e,takeProfitPrice:n,isFullscreen:this.isFullscreen})}return}}if(this.tradeDragHandler&&!this.drawingManager.getActiveTool()){let e=ot(i,a,this.tradeAddBracketAreas);if(e){this._startAddBracketFromHit(e,a),this.drawCanvas.style.cursor=`ns-resize`;return}}if(this.tradeDragHandler&&!this.drawingManager.getActiveTool()){let e=at(i,a,this.tradeLevelDragAreas);if(e){let t=this.levels.find(t=>t.label===e.label);if(t&&!(this.hideLevelConfirmCancel&&!e.isBracket)){this._startTradeDragFromHit(e,t,a),this.drawCanvas.style.cursor=`ns-resize`;return}}}let g=it(i,a,this.tradeHoverAreas);if(g){let e=this.pendingLevelDrags.has(g.label);if(this.selectedTradeLabel===g.label&&!e?this.selectedTradeLabel=null:this.selectedTradeLabel=g.label,this.renderTradeLayer(),this.hideLevelConfirmCancel){let e=this.levels.find(e=>e.label===g.label);if(e){let{slPrice:t,tpPrice:n}=this._resolveBracketPrices(e);this._editOpenLabel=e.label,this.emitter.emit(`tradeLevelEditOpen`,{label:e.label,type:e.type,data:e.data,price:e.price,side:e.side,stopLossPrice:t,takeProfitPrice:n,isFullscreen:this.isFullscreen})}}return}else if(this.selectedTradeLabel!==null&&!this.hideLevelConfirmCancel){let e=this.selectedTradeLabel,t=this.pendingLevelDrags.get(e),n=this._editOpenLabel===e;if(!t||t.length===0){if(n){let t=this.levels.find(t=>t.label===e);this._editOpenLabel=null,t&&this.emitter.emit(`tradeLevelEditCancelled`,{label:e,type:t.type,isFullscreen:this.isFullscreen})}this.selectedTradeLabel=null,this.renderTradeLayer()}else t.every(e=>e.isNew)&&this.revertPendingChanges(e)}this.expandedClusters.size>0&&(this.expandedClusters.clear(),this.renderTradeLayer());let _=r.height-this.timeAxisHeight;if(i>=o){if(a<=s)this.axisDrag={axis:`price`,startPos:a,startSize:this.priceScaleFactor};else{let e=this.activeIndicators.filter(e=>e.indicator.pane===`sub`).map(e=>e.indicator),t=s+sc;for(let n of e){let e=this.paneH(n);if(a>=t&&a<t+e){var v;this.axisDrag={axis:`subpane`,startPos:a,startSize:(v=this.subPaneScaleFactors.get(n.name))==null?1:v,indicatorName:n.name};break}t+=e+sc}}this.scheduleRender();return}if(a>=_){this.axisDrag={axis:`time`,startPos:i,startSize:this.viewport.endIndex-this.viewport.startIndex},this.scheduleRender();return}let y=this.getSeparatorPositions().find(e=>Math.abs(a-e.y)<=4);if(y){var b,x;let e=this.indicators.find(e=>e.name===y.indicatorName),t=(b=(x=this.paneHeightOverrides.get(y.indicatorName))==null?e==null?void 0:e.paneHeight:x)==null?oc:b;this.separatorDrag={indicatorName:y.indicatorName,startY:a,startH:t},this.scheduleRender();return}if(!this.drawingManager.onMouseDown({barIndex:l,price:u})){var S;let e=this.drawingManager.getHandleAtPoint(i,a,this.scaleManager,this.viewport,c,o,s);if(e)this.drawingManager.selectDrawing(e.drawing),this._pendingDrawResize={drawing:e.drawing,pointIndex:e.handle.pointIndex,startX:i,startY:a};else{let e=this.drawingManager.hitTest(i,a,this.scaleManager,this.viewport,c,o,s);this.drawingManager.selectDrawing(e),e&&(this._pendingDrawDrag={drawing:e,startX:i,startY:a})}let t=(S=this.dataStore.all[d])==null?null:S;this.emitter.emit(`click`,{x:i,y:a,barIndex:d,price:u,bar:t})}this.scheduleRender()},this.onDoubleClick=e=>{var t;this.drawingManager.finalizePlacing();let n=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,r=e.clientX-n.left,i=e.clientY-n.top,{chartW:a,priceH:o}=this.getChartLayout(),s=n.height-this.timeAxisHeight;if(r>=a){this.resetPriceAxis();return}if(i>=s){this.resetTimeAxis();return}let c=new Set([`text`,`callout`,`anchoredNote`]),l=this.drawingManager.getSelectedDrawing();if(l&&c.has(l.type)){let e=this.getScaledPriceRange(this.viewport);if(l.hitTest(r,i,this.scaleManager,this.viewport,e,a,o)){this.showTextInput(l);return}}this.scheduleRender()},this.onKeyDown=e=>{if(e.key===`Escape`&&this.expandedClusters.size>0){this.expandedClusters.clear(),this.renderTradeLayer(),e.preventDefault();return}if(e.key===`Escape`&&this.pendingLevelDrags.size>0){this.revertPendingChanges(),e.preventDefault();return}let t=(e.ctrlKey||e.metaKey)&&e.key===`z`?`z`:e.key;if(this.drawingManager.onKeyDown(t)){var n;e.preventDefault(),this.hideMobileDrawingFlyout(),(n=this.leftBar)==null||n.setActiveTool(this.drawingManager.getActiveTool()),this.drawCanvas.style.cursor=this.drawingManager.getActiveTool()?`crosshair`:`default`,this.scheduleRender()}},this.onTick=e=>{let t=this.dataStore.all;if(t.length===0||this._suppressTicks)return;this.liveBidAsk={bid:e.bid,ask:e.ask},this.setDotTickActive();let n=t[t.length-1],r=this.timeframeToMs(this.timeframe),i=this.tickClosePriceSource===`ask`?e.ask:e.bid;if(e.time<n.time+r){var a;let r={...n,high:Math.max(n.high,i),low:Math.min(n.low,i),close:i,volume:((a=n.volume)==null?0:a)+e.volume};t[t.length-1]=r}else{let a=n,o=Math.floor(e.time/r)*r;t.push({time:o,open:i,high:i,low:i,close:i,volume:e.volume}),this._debug&&console.warn(`[tick] → NEW candle @ ${new Date(o).toISOString()} (closed ${new Date(a.time).toISOString()}) | total bars=${t.length}`);let s=t[t.length-1];this._targetViewport.endIndex>=t.length&&(this._targetViewport={...this._targetViewport,startIndex:this._targetViewport.startIndex+1,endIndex:this._targetViewport.endIndex+1}),this.emitter.emit(`newBar`,{completedBar:a,openingBar:s,intervalMs:r}),this.correctCompletedBar(a.time,r),o>a.time+r&&this.fillTickGap(a.time,o)}this.recomputeIndicators(),this.scheduleRender()},typeof window>`u`||typeof document>`u`)throw Error(`acttrader-charts requires a browser environment`);if(on(),window.visualViewport){let e=window.visualViewport,t=()=>{this._cachedWrapRect=null,this._cachedDrawRect=null};e.addEventListener(`resize`,t),e.addEventListener(`scroll`,t),this.disposeVvListener=()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,t)}}let{container:N,theme:P=`dark`,series:F=`candlestick`,showVolume:I=!0,showUI:L=!0,timeframe:ee=`1D`,duration:R=void 0,symbol:z=``,isins:B,onIsinSelect:V,onSymbolClick:te,onOrderSubmit:H,dataLoader:U,durationTimeframeMap:ne,uiConfig:re,labels:ie,tickActivityMs:ae=3e4,hideSymbolAndTick:oe=!1,showBottomBar:se=!1}=i;if(this.dataLoader=U==null?null:U,this.drawingToolsEnabled=i.showDrawingTools!==!1,this.settingsEnabled=i.showSettings!==!1,this.fullscreenEnabled=i.showFullscreenButton!==!1,this.uiConfig=S(re),this.labels=w(ie),this.tickActivityMs=ae,this.maxCandles=(a=i.maxCandles)==null?200:a,this.minInitialBars=Math.max(0,(o=i.minInitialBars)==null?10:o),this.maxLookbackMs=Math.max(0,(l=i.maxLookbackMs)==null?365*24*60*60*1e3:l),this.prefetchThreshold=(f=i.prefetchThreshold)==null?80:f,this.defaultVisibleBars=(p=i.defaultVisibleBars)==null?cc:p,this.defaultMobileVisibleBars=i.defaultMobileVisibleBars,this.explicitMobileDivisor=i.mobileBarDivisor!==void 0,this.mobileBarDivisor=(m=i.mobileBarDivisor)==null?2:m,this._autoVisibleBars=i.defaultVisibleBars==null&&i.defaultMobileVisibleBars==null,this.targetCandleWidth=(h=i.targetCandleWidth)==null?lc:h,this.viewport={...this.viewport,endIndex:pc(this.mobileBarDivisor,this.explicitMobileDivisor,this.defaultVisibleBars,this.defaultMobileVisibleBars)},this._targetViewport={...this.viewport},this.maxSubPanes=(g=i.maxSubPanes)==null?3:g,this.tickClosePriceSource=(_=i.tickClosePriceSource)==null?`bid`:_,this.tradesThresholdForHorizontalLine=(v=i.tradesThresholdForHorizontalLine)==null?2:v,i.positionRenderStyle===`line`||i.positionRenderStyle===`dot`)this.positionRenderStyleOverride=i.positionRenderStyle;else{let e=localStorage.getItem(this.RENDER_STYLE_LS_KEY);(e===`line`||e===`dot`)&&(this.positionRenderStyleOverride=e)}if(i.tradeDisplayFilter&&(this.tradeDisplayFilter=i.tradeDisplayFilter),i.canvasColors&&(this.settingsCanvasColors=i.canvasColors),this.recomputeRenderStyle(),this.showBidAskLines=(y=i.showBidAskLines)==null?!1:y,this.showActLogo=(b=i.showActLogo)==null?!1:b,this.hideLevelConfirmCancel=(x=i.hideLevelConfirmCancel)==null?!1:x,this.tradeLevelButtonScale=Math.min(Math.max((C=i.tradeLevelButtonScale)==null?1:C,1),3),this.levelClusteringEnabled=(T=i.levelClusteringEnabled)==null?!0:T,this.clusterThresholdDistance=(D=i.clusterThresholdDistance)==null?20:D,this.enableThemeToggle=(O=i.enableThemeToggle)==null?!1:O,this.tfcEnabled=i.tfcEnabled!==!1,this.tfcActive=this.tfcEnabled,this.showCandleCountdown=(A=i.showCandleCountdown)==null?!0:A,this.candleCountdownTimeframes=i.candleCountdownTimeframes,this._onOrderSubmit=H,i.minLots!==void 0&&(console.warn(`[acttrader-charts] ChartConfig.minLots is deprecated. DraftOrderQtyInput has been removed. The value is stored and used as the submitted lot size.`),this._minLots=i.minLots),i.showQuantityField!==void 0&&(this._showQuantityField=i.showQuantityField),i.quantityFieldConfig&&(i.quantityFieldConfig.minLots!==void 0&&(this._qtyFieldMin=i.quantityFieldConfig.minLots),i.quantityFieldConfig.maxLots!==void 0&&(this._qtyFieldMax=i.quantityFieldConfig.maxLots)),i.onLotsChange!==void 0&&console.warn(`[acttrader-charts] ChartConfig.onLotsChange is deprecated. DraftOrderQtyInput has been removed; this callback will never fire.`),i.hideQtyButton!==void 0&&console.warn(`[acttrader-charts] ChartConfig.hideQtyButton is deprecated and is a no-op. DraftOrderQtyInput has been removed.`),this.themeName=P===`dark`?`dark`:`light`,this.themeOverrides=i.themeOverrides,this.timezone=i.timezone===`local`?Intl.DateTimeFormat().resolvedOptions().timeZone:(j=i.timezone)==null?`UTC`:j,this.aggregateFrom=i.aggregateFrom,this.theme=c(this.themeName===`dark`?u:d,(M=this.themeOverrides)==null?void 0:M[this.themeName]),this.series=F,this.showVolume=I,this.timeframe=ee,this.duration=R,this.symbol=z,this.wrapper=document.createElement(`div`),Object.assign(this.wrapper.style,{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,overflow:`hidden`,boxSizing:`border-box`}),L){let e={...pn,...ne};this.topBar=new fn(e=>this.setSeries(e),e=>{this.timeframe=e,this.emitter.emit(`timeframeChange`,{timeframe:e}),this.emitStateChange(),this.updateCountdownState(),this.triggerLoad(`timeframe`)},e=>this.addIndicatorByName(e),(e,t)=>{var n,r;this.duration=e,this.timeframe=t,(n=this.topBar)==null||n.setTimeframe(t),(r=this.bottomBar)==null||r.setActive(e),this.emitter.emit(`durationChange`,{duration:e,timeframe:t}),this.emitStateChange(),this.updateCountdownState(),this.triggerLoad(`duration`)},()=>{this.openChartSettings()},()=>{this.toggleFullscreen()},this.drawingToolsEnabled?()=>this.toggleDrawingTools():null,this.drawingToolsEnabled,this.settingsEnabled,this.fullscreenEnabled,this.tfcEnabled,this.tfcActive,this.tfcEnabled?e=>{this.setTfcActive(e)}:null,this.series,this.timeframe,null,e,this.theme,this.uiConfig.topBar,this.labels.topBar,()=>this.emitUiState()),this.topBar.setIndicatorOptions(Xs.filter(e=>e.enabled).map(e=>({value:e.short_name,label:`${e.name} (${e.short_name})`,category:e.type}))),this.wrapper.appendChild(this.topBar.el),this.topBar.setFullscreen(this.isFullscreen)}let ce=document.createElement(`div`);if(Object.assign(ce.style,{display:`flex`,flex:`1`,minHeight:`0`,overflow:`hidden`,position:`relative`}),L&&this.drawingToolsEnabled&&(this.leftBar=new yn(e=>this.setDrawingTool(e),e=>{switch(e){case`undo`:this.undoDrawing();break;case`redo`:this.redoDrawing();break;case`delete_selected`:this.deleteSelectedDrawing();break;case`clear_all`:this.clearAllDrawings();break;case`hide_all`:this.hideAllDrawings();break;case`show_all`:this.showAllDrawings();break;case`lock_all`:this.lockAllDrawings();break;case`unlock_all`:this.unlockAllDrawings();break}},()=>{var e;this.leftBarVisible=!1,(e=this.topBar)==null||e.setDrawingsBtnActive(!1)},this.theme,this.uiConfig.drawingToolbar,this.labels.drawingToolbar),ce.appendChild(this.leftBar.el)),this.canvasWrap=document.createElement(`div`),Object.assign(this.canvasWrap.style,{flex:`1`,position:`relative`,overflow:`hidden`,touchAction:`none`}),this.canvas=document.createElement(`canvas`),Object.assign(this.canvas.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,pointerEvents:`none`}),this.canvasWrap.appendChild(this.canvas),this.tradeCanvas=document.createElement(`canvas`),Object.assign(this.tradeCanvas.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,pointerEvents:`none`}),this.canvasWrap.appendChild(this.tradeCanvas),this.drawCanvas=document.createElement(`canvas`),Object.assign(this.drawCanvas.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,cursor:`crosshair`,touchAction:`none`,userSelect:`none`}),this.drawCanvas.style.webkitUserSelect=`none`,this.drawCanvas.style.webkitTouchCallout=`none`,this.canvasWrap.appendChild(this.drawCanvas),this.textInputEl=document.createElement(`input`),this.textInputEl.type=`text`,Object.assign(this.textInputEl.style,{position:`absolute`,display:`none`,zIndex:`15`,background:`transparent`,border:`none`,borderBottom:`1px solid #2196f3`,color:`#f5f5f5`,font:`16px system-ui, sans-serif`,outline:`none`,minWidth:`60px`,padding:`0 2px`}),this.canvasWrap.appendChild(this.textInputEl),L){this.loadingOverlayEl=document.createElement(`div`),Object.assign(this.loadingOverlayEl.style,{display:`none`,position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`,zIndex:`20`});let e=document.createElement(`span`);e.textContent=this.labels.chart.loading,Object.assign(e.style,{color:`rgba(200,200,200,0.9)`,fontSize:`13px`,background:`rgba(0,0,0,0.45)`,padding:`4px 12px`,borderRadius:`4px`}),this.loadingOverlayEl.appendChild(e),this.canvasWrap.appendChild(this.loadingOverlayEl),this.noDataOverlayEl=document.createElement(`div`),Object.assign(this.noDataOverlayEl.style,{display:`none`,position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`,zIndex:`19`});let t=document.createElement(`span`);t.textContent=this.labels.chart.noData,Object.assign(t.style,{color:`rgba(200,200,200,0.9)`,fontSize:`13px`,background:`rgba(0,0,0,0.45)`,padding:`4px 12px`,borderRadius:`4px`}),this.noDataOverlayEl.appendChild(t),this.canvasWrap.appendChild(this.noDataOverlayEl)}if(L&&!oe){this.siEl=document.createElement(`div`),Object.assign(this.siEl.style,{position:`absolute`,top:`6px`,left:`6px`,zIndex:`10`,display:`flex`,alignItems:`center`,gap:`8px`,pointerEvents:`none`}),this.siSymbolSpan=document.createElement(`span`),Object.assign(this.siSymbolSpan.style,{color:this.theme.axisText,fontSize:`17px`,fontFamily:`'Inter', system-ui, sans-serif`,fontWeight:`700`,display:z?`inline`:`none`}),this.siSymbolSpan.textContent=z==null?``:z,te?(Object.assign(this.siSymbolSpan.style,{cursor:`pointer`,textDecoration:`underline`,pointerEvents:`auto`}),this.siSymbolSpan.addEventListener(`click`,()=>{var e,t;te((e=(t=this.siSymbolSpan)==null?void 0:t.textContent)==null?``:e)})):V&&(B&&(this.isins=B),this.isinPickerModal=new ss(this.theme,V,()=>this.emitUiState()),this.getFloatingRoot().appendChild(this.isinPickerModal.el),Object.assign(this.siSymbolSpan.style,{cursor:`pointer`,textDecoration:`underline`,pointerEvents:`auto`}),this.siSymbolSpan.addEventListener(`click`,()=>{var e;this.isinPickerModal.show(this.isins,(e=this.siSymbolSpan.textContent)==null?``:e)})),this.siOHLCSpan=document.createElement(`span`),Object.assign(this.siOHLCSpan.style,{fontSize:`14px`,fontFamily:`'Inter', system-ui, sans-serif`,whiteSpace:`nowrap`}),this.siOHLC2Span=document.createElement(`span`),Object.assign(this.siOHLC2Span.style,{fontSize:`14px`,fontFamily:`'Inter', system-ui, sans-serif`,whiteSpace:`nowrap`}),this.siStreamDot=document.createElement(`span`),Object.assign(this.siStreamDot.style,{width:`7px`,height:`7px`,borderRadius:`50%`,background:this.theme.ui.stream.disconnected,display:`inline-block`,flexShrink:`0`});let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,alignItems:`center`,gap:`8px`}),e.append(this.siStreamDot,this.siSymbolSpan,this.siOHLCSpan),this.siEl.append(e,this.siOHLC2Span),this.canvasWrap.appendChild(this.siEl)}if(L&&(this.indicatorOverlay=new Qo(this.theme,this.uiConfig.indicatorOverlay,this.labels.chart),this.canvasWrap.appendChild(this.indicatorOverlay.el),this.indicatorSettingsDialog=new $o(this.theme,this.labels.dialogs,()=>this.emitUiState()),this.getFloatingRoot().appendChild(this.indicatorSettingsDialog.el),this.scrollToEndBtn=document.createElement(`button`),this.scrollToEndBtn.title=this.labels.chart.scrollToLatest,this.applyScrollToEndBtnStyles(),this.scrollToEndBtn.addEventListener(`click`,()=>this.scrollToEnd()),this.canvasWrap.appendChild(this.scrollToEndBtn),this.resetViewBtn=document.createElement(`button`),this.resetViewBtn.title=`Reset view`,this.applyResetViewBtnStyles(),this.resetViewBtn.addEventListener(`click`,()=>this.resetView()),this.canvasWrap.appendChild(this.resetViewBtn)),this.tradeDragHandler=new cs,i.onLevelDragEnd&&this.emitter.on(`tradeLevelDragEnd`,i.onLevelDragEnd),i.onLevelEdit&&this.emitter.on(`tradeLevelEdit`,i.onLevelEdit),H&&(this.tradePopover=new rs(this.theme,.01,(e,t,n)=>{this.createDraftOrder(e,t,n)},this.labels.trade,()=>this.emitUiState()),this.canvasWrap.appendChild(this.tradePopover.el),this.tradeButton=new ns(this.theme,this.priceAxisWidth,()=>{if(this._tradeButtonClickData&&this.tradePopover){var e;(e=this.tradeButton)==null||e.hide();let t=this.priceAxisWidth+10+22+4,{price:n,y:r}=this._tradeButtonClickData;this.tradePopover.show(n,r,t,this.dataStore.getPricePrecision(),this._orderTypeForPrice(`buy`,n),this._orderTypeForPrice(`sell`,n))}},this.labels.trade,this.uiConfig.tradeButton),this.canvasWrap.appendChild(this.tradeButton.el),this.tradeButton.el.addEventListener(`mouseenter`,()=>{this.crosshair=null,this.scheduleRender()}),this.tradeButton.el.addEventListener(`mousemove`,e=>{var t;if(e.buttons!==0)return;let n=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,r=e.clientY-n.top,{priceH:i}=this.getChartLayout();if(xt(r,this.uiConfig.tradeButton.size/2,this.offViewportHitAreas)){var a;(a=this.tradeButton)==null||a.hide();return}if(r>=0&&r<=i){var o,s;(o=this.tradeButton)==null||o.setY(r);let e=(s=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):s;this._tradeButtonClickData={price:this.scaleManager.pixelToPrice(r,e,i),y:r}}})),ce.appendChild(this.canvasWrap),this.wrapper.appendChild(ce),L&&se){var le;let e={...pn,...ne};this.bottomBar=new hn((e,t)=>{var n;this.duration=e,this.timeframe=t,(n=this.topBar)==null||n.setTimeframe(t),this.emitter.emit(`durationChange`,{duration:e,timeframe:t}),this.emitStateChange(),this.updateCountdownState(),this.triggerLoad(`duration`)},(le=this.duration)==null?null:le,this.theme,e,this.uiConfig.bottomBar,this.labels.bottomBar),this.wrapper.appendChild(this.bottomBar.el)}if(N.appendChild(this.wrapper),this.themeOverrides){var W,de,fe,pe;this.theme=this.buildTheme(this.themeName),(W=this.topBar)==null||W.setTheme(this.theme),(de=this.bottomBar)==null||de.setTheme(this.theme),(fe=this.leftBar)==null||fe.setTheme(this.theme),(pe=this.tradeButton)==null||pe.setTheme(this.theme,this.priceAxisWidth)}let me=this.canvas.getContext(`2d`);if(!me)throw Error(`Canvas 2D context unavailable`);this.ctx=me;let he=this.drawCanvas.getContext(`2d`);if(!he)throw Error(`Drawing canvas 2D context unavailable`);this.drawCtx=he;let ge=this.tradeCanvas.getContext(`2d`);if(!ge)throw Error(`Trade canvas 2D context unavailable`);if(this.tradeCtx=ge,this.showActLogo){let t=new Image;t.onload=()=>{this.logoImage=t,this.scheduleRender()},t.src=e}this.drawingManager.setOnComplete(()=>{var e;(e=this.leftBar)==null||e.setActiveTool(null),this.drawCanvas.style.cursor=`default`}),this.drawingManager.onDrawingsChange=()=>this.emitStateChange(),this.drawingManager.onStartTextEdit=e=>this.showTextInput(e),this.panHandler=new E(this.drawCanvas,()=>this._targetViewport,e=>{this._targetViewport=e,this.clearDuration(),this.checkNeedMoreData(),this.scheduleRender()},()=>this.dataStore.length,()=>this.scheduleRender(),()=>{var e,t;return this.drawingManager.getActiveTool()!==null||this.drawingManager.isDraggingDrawing()||this.drawingManager.isResizingDrawing()||this.separatorDrag!==null||this.axisDrag!==null||((e=(t=this.tradeDragHandler)==null?void 0:t.active)==null?!1:e)||this._mobileCrosshairActive},e=>{var t;let{priceH:n}=this.getChartLayout(),r=(t=this._displayedPriceRange)==null?this.getScaledPriceRange(this._targetViewport):t,i=(r.max-r.min)/n;this.pricePanOffset+=e*i,this.scheduleRender()},()=>{this._isPanning=!0},()=>{this._isPanning=!1},{enabled:i.momentumScrollEnabled,decay:i.momentumDecay,threshold:i.momentumThreshold,maxVelocity:i.momentumMaxVelocity}),this.zoomHandler=new k(this.drawCanvas,()=>this._targetViewport,e=>{this._targetViewport=e,this.clearDuration(),this.checkNeedMoreData(),this.scheduleRender()},()=>this.dataStore.length,()=>this.scheduleRender(),()=>{var e;return(e=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():e},()=>this.getChartLayout().chartW,e=>{let t=this._targetViewport,n=t.endIndex-t.startIndex,r=e*(n/this.drawCanvas.width),i=Math.max(0,this.dataStore.length-Math.floor(n/2)),a=Math.max(0,Math.min(i,t.startIndex+r));this._targetViewport={...t,startIndex:a,endIndex:a+n},this.clearDuration(),this.checkNeedMoreData(),this.scheduleRender()}),this.drawCanvas.addEventListener(`mousemove`,this.onMouseMove),this.drawCanvas.addEventListener(`mouseleave`,this.onMouseLeave),this.drawCanvas.addEventListener(`mousedown`,this.onCanvasClick),this.drawCanvas.addEventListener(`dblclick`,this.onDoubleClick),window.addEventListener(`mouseup`,this.onMouseUp),this.drawCanvas.addEventListener(`touchstart`,this.onDrawingTouchStart,{passive:!1}),this.drawCanvas.addEventListener(`touchmove`,this.onDrawingTouchMove,{passive:!1}),this.drawCanvas.addEventListener(`touchend`,this.onDrawingTouchEnd,{passive:!1}),this.drawCanvas.addEventListener(`contextmenu`,e=>e.preventDefault()),document.addEventListener(`keydown`,this.onKeyDown);let _e=()=>{var e;let t=!!document.fullscreenElement;t||(this._isCssFullscreen=!1),(e=this.topBar)==null||e.setFullscreen(t),this.reparentFloatingElements()};this.wrapper.addEventListener(`fullscreenchange`,_e),document.addEventListener(`fullscreenchange`,_e),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this.canvasWrap),this.onResize(),this.dataLoader&&this.triggerLoad(`initial`)}resetData(){return++this._loadGeneration,this.setLoading(!1),this.setNoData(!1),this.drawingManager.clearAll(),this.levels=[],this._draftQtyPillArea=void 0,this._pendingBracketOrderLabel=null,this.loadData([])}loadData(e,t=!1){var n,r,i;this.isFetching=!1,this.noMoreData=!1,this._suppressTicks=!1,e.length>0&&this.setNoData(!1),this.liveBidAsk=null,this.pricePanOffset=0,this.priceScaleFactor=1,this._displayedPriceRange=null,this._lockedAutoFitBase=null,this.dataStore.set(e);let a=((n=(r=this._cachedWrapRect)==null?void 0:r.width)==null?this.canvasWrap.getBoundingClientRect().width:n)-this.priceAxisWidth,o=this._autoVisibleBars&&a>0?a:void 0,s=pc(this.mobileBarDivisor,this.explicitMobileDivisor,this.defaultVisibleBars,this.defaultMobileVisibleBars,o,this.targetCandleWidth);this._defaultVisibleBars=s,this.viewport={...this.viewport,startIndex:t?0:Math.max(0,e.length-s+mc),endIndex:e.length+mc},this._targetViewport={...this.viewport};let c=this.dataStore.hasVolumeData;if(c||(this.showVolume=!1),(i=this.topBar)==null||i.setVolumeControl(this.showVolume,c),this.showVolume&&c){var l;(l=this.indicatorOverlay)==null||l.addPill(`VOL`,this.theme.volume.up,`VOL`,`Chart`,!0,()=>{var e,t;this.setVolume(!1),(e=this.indicatorOverlay)==null||e.removePill(`VOL`),(t=this.topBar)==null||t.setVolumeControl(!1,this.dataStore.hasVolumeData)},null,()=>{var e;this.setVolume(!this.showVolume),(e=this.indicatorOverlay)==null||e.updatePillVisibility(`VOL`,this.showVolume),this.scheduleRender()})}return this.recomputeIndicators(),this.reanchorDrawingsByTimestamp(),this.updateCountdownState(),this.scheduleRender(),this}prependData(e){if(e.length===0)return this.noMoreData=!0,this.isFetching=!1,this;let t=this.dataStore.prepend(e);return t>0&&(this.viewport={...this.viewport,startIndex:this.viewport.startIndex+t,endIndex:this.viewport.endIndex+t},this._targetViewport={...this.viewport},this.drawingManager.shiftBarIndices(t),this.recomputeIndicators(),this.scheduleRender()),this.isFetching=!1,this}setLoading(e){return this.loadingOverlayEl&&(this.loadingOverlayEl.style.display=e?`flex`:`none`),e&&this.setNoData(!1),this}setNoData(e){return this.noDataOverlayEl&&(this.noDataOverlayEl.style.display=e?`flex`:`none`),this}timeframeToMs(e){var t;let n=6e4;return(t={"1m":1*n,"5m":5*n,"15m":15*n,"30m":30*n,"1h":60*n,"2h":120*n,"4h":240*n,"8h":480*n,"1D":1440*n,"1W":10080*n,"1M":43200*n}[e])==null?1440*n:t}getBaseInterval(){var e,t;return(e=(t=this.aggregateFrom)==null?void 0:t[this.timeframe])==null?this.timeframe:e}shouldAggregate(){let e=this.getBaseInterval();return e!==this.timeframe&&this.timeframeToMs(e)<this.timeframeToMs(this.timeframe)}maybeAggregate(e){return this.shouldAggregate()?Zs(e,this.timeframeToMs(this.timeframe)):e}timeframeToInterval(e){var t;return(t={"1m":`1min`,"5m":`5min`,"15m":`15min`,"30m":`30min`,"1h":`1h`,"2h":`2h`,"4h":`4h`,"8h":`8h`,"1D":`1day`,"1W":`1week`,"1M":`1month`}[e])==null?`1day`:t}durationToMs(e){var t;let n=1440*60*1e3;return(t={"1D":1*n,"5D":5*n,"1M":30*n,"3M":90*n,"6M":180*n,"1Y":365*n,"5Y":5*365*n,All:20*365*n}[e])==null?365*n:t}triggerLoad(e){if(!this.dataLoader)return;let t=++this._loadGeneration;this._suppressTicks=!0,this.isFetching=!0,this.noMoreData=!1;let n=new Date,r=this.maxCandles*this.timeframeToMs(this.timeframe),i=this.duration?this.durationToMs(this.duration):r,a=Math.min(i,r),o=this.timeframeToInterval(this.getBaseInterval());this.setLoading(!0);let s=this.dataLoader,c=[1,5,25,125],l=this.minInitialBars,u=this.maxLookbackMs,d=(r,i)=>{s({start:i,end:n,interval:o}).then(s=>{if(t!==this._loadGeneration)return;let f=this.maybeAggregate(s),p=n.getTime()-i.getTime()>=u;if(f.length>=l||r+1>=c.length||p){this.loadData(f,e===`duration`),this.setLoading(!1),f.length===0&&this.setNoData(!0),this.emitter.emit(`dataLoaded`,{timeframe:this.timeframe,interval:o,start:i,end:n});return}let m=Math.min(a*c[r+1],u),h=new Date(n.getTime()-m);d(r+1,h)}).catch(()=>{t===this._loadGeneration&&(this.isFetching=!1,this.setLoading(!1))})},f=Math.min(a*c[0],u);d(0,new Date(n.getTime()-f))}checkNeedMoreData(){if(!this.dataLoader||this.isFetching||this.noMoreData)return;let e=Math.max(20,this.prefetchThreshold);if(this._targetViewport.startIndex>e||this.dataStore.length===0)return;let t=this._loadGeneration;this.isFetching=!0;let n=this.dataStore.all[0].time,r=new Date(n-1),i=this.maxCandles*this.timeframeToMs(this.timeframe),a=this.duration?this.durationToMs(this.duration):i,o=Math.min(a,i),s=this.timeframeToInterval(this.getBaseInterval());this.setLoading(!0);let c=this.dataLoader,l=[1,5,25,125],u=this.minInitialBars,d=this.maxLookbackMs,f=(e,n)=>{c({start:n,end:r,interval:s}).then(i=>{if(t!==this._loadGeneration)return;let a=this.maybeAggregate(i),s=r.getTime()-n.getTime()>=d;if(a.length>=u||e+1>=l.length||s){this.prependData(a),this.setLoading(!1);return}let c=Math.min(o*l[e+1],d),p=new Date(r.getTime()-c);f(e+1,p)}).catch(()=>{t===this._loadGeneration&&(this.isFetching=!1,this.setLoading(!1))})},p=Math.min(o*l[0],d);f(0,new Date(r.getTime()-p))}addIndicator(e){var t;if(e.pane===`sub`&&this.activeIndicators.filter(e=>e.indicator.pane===`sub`).length>=this.maxSubPanes)return this;let n=nc.find(t=>t.shortName===e.name),r=n?Object.fromEntries(n.fields.map(e=>[e.key,e.default])):{};r.timeframe=`Chart`;let i={indicator:e,shortName:e.name,currentParams:r,visible:!0};this.activeIndicators.push(i),this.dataStore.length>0&&this.indicatorResults.set(e.name,e.compute(this.dataStore.all));let a=n!==void 0&&n.fields.length>0,o=tc(e.name,r,n);if(e.pane===`sub`){let t=new Qo(this.theme,this.uiConfig.indicatorOverlay,this.labels.chart);Object.assign(t.el.style,{position:`absolute`,top:`6px`,left:`6px`,zIndex:`10`}),this.canvasWrap.appendChild(t.el),this.subPaneOverlays.set(e.name,t),t.addPill(e.name,e.color,o,`Chart`,!0,()=>this.removeIndicator(e.name),a?()=>this.openIndicatorSettings(e.name):null,()=>{i.visible=!i.visible,t.updatePillVisibility(e.name,i.visible),this.scheduleRender(),this.emitStateChange()})}else{var s;(s=this.indicatorOverlay)==null||s.addPill(e.name,e.color,o,`Chart`,!0,()=>this.removeIndicator(e.name),a?()=>this.openIndicatorSettings(e.name):null,()=>{var t;i.visible=!i.visible,(t=this.indicatorOverlay)==null||t.updatePillVisibility(e.name,i.visible),this.scheduleRender(),this.emitStateChange()})}return(t=this.topBar)==null||t.setIndicatorOptionActive(e.name,!0),this.scheduleRender(),this.emitStateChange(),this}removeIndicator(e){var t;this.activeIndicators=this.activeIndicators.filter(t=>t.indicator.name!==e),this.indicatorResults.delete(e),this.subPaneScaleFactors.delete(e);let n=this.subPaneOverlays.get(e);if(n)n.destroy(),n.el.remove(),this.subPaneOverlays.delete(e);else{var r;(r=this.indicatorOverlay)==null||r.removePill(e)}return(t=this.topBar)==null||t.setIndicatorOptionActive(e,!1),this.scheduleRender(),this.emitStateChange(),this}addIndicatorByName(e){if(e===`VOL`){var t;if(this.setVolume(!this.showVolume),this.showVolume){var n;(n=this.indicatorOverlay)==null||n.addPill(`VOL`,this.theme.volume.up,`VOL`,`Chart`,!0,()=>{var e,t;this.setVolume(!1),(e=this.indicatorOverlay)==null||e.removePill(`VOL`),(t=this.topBar)==null||t.setVolumeControl(!1,this.dataStore.hasVolumeData)},null,()=>{var e;this.setVolume(!this.showVolume),(e=this.indicatorOverlay)==null||e.updatePillVisibility(`VOL`,this.showVolume),this.scheduleRender()})}else{var r;(r=this.indicatorOverlay)==null||r.removePill(`VOL`)}(t=this.topBar)==null||t.setVolumeControl(this.showVolume,this.dataStore.hasVolumeData);return}let i=$s.find(t=>t.shortName===e);if(i){if(this.activeIndicators.some(t=>t.shortName===e)){this.removeIndicator(e);return}this.addIndicator(i.factory())}}openIndicatorSettings(e){var t;let n=this.activeIndicators.find(t=>t.shortName===e);if(!n)return;let r=nc.find(t=>t.shortName===e);if(!r||r.fields.length===0)return;let i={...r,fields:[...r.fields,ec]};(t=this.indicatorSettingsDialog)==null||t.show(i,n.currentParams,t=>this.updateIndicatorParams(e,t),()=>this.removeIndicator(e))}updateIndicatorParams(e,t){var n;let r=this.activeIndicators.findIndex(t=>t.shortName===e);if(r===-1)return;let i=nc.find(t=>t.shortName===e);if(!i)return;let a=this.activeIndicators[r];if(!a)return;let{timeframe:o,...s}=t,c=i.factory(s);a.indicator=c,a.currentParams={...t},this.indicatorResults.delete(e),this.dataStore.length>0&&this.indicatorResults.set(e,c.compute(this.dataStore.all));let l=(n=this.subPaneOverlays.get(e))==null?this.indicatorOverlay:n;l==null||l.updatePillColor(e,c.color),l==null||l.updatePillLabel(e,tc(e,a.currentParams,i)),l==null||l.updatePillTimeframe(e,o==null?`Chart`:o),this.scheduleRender(),this.emitStateChange()}on(e,t){return this.emitter.on(e,t)}buildTheme(e){var t,n,r,i,a,o,s;let f=e===`dark`?u:d,p=this.settingsCanvasColors[e],m=p?{...p.background!==void 0&&{background:p.background},...p.grid!==void 0&&{grid:p.grid},...p.axisText!==void 0&&{axisText:p.axisText},...p.axisBorder!==void 0&&{axisBorder:p.axisBorder},...p.crosshair!==void 0&&{crosshair:p.crosshair},...((t=(n=(r=(i=(a=p.candleUp)==null?p.candleDown:a)==null?p.wickUp:i)==null?p.wickDown:r)==null?p.borderUp:n)==null?p.borderDown:t)!==void 0&&{candle:{...p.candleUp!==void 0&&{up:p.candleUp},...p.candleDown!==void 0&&{down:p.candleDown},...p.wickUp!==void 0&&{wickUp:p.wickUp},...p.wickDown!==void 0&&{wickDown:p.wickDown},...p.borderUp!==void 0&&{borderUp:p.borderUp},...p.borderDown!==void 0&&{borderDown:p.borderDown}}},...((o=p.volumeUp)==null?p.volumeDown:o)!==void 0&&{volume:{...p.volumeUp!==void 0&&{up:p.volumeUp},...p.volumeDown!==void 0&&{down:p.volumeDown}}}}:void 0;return l(c(c(f,(s=this.themeOverrides)==null?void 0:s[e]),m),this.wrapper)}setTheme(e){var t,n,r,i,a,o,s,c;return this.themeName=e,this.theme=this.buildTheme(e),(t=this.topBar)==null||t.setTheme(this.theme),(n=this.bottomBar)==null||n.setTheme(this.theme),(r=this.leftBar)==null||r.setTheme(this.theme),(i=this.tradeButton)==null||i.setTheme(this.theme,this.priceAxisWidth),(a=this.tradePopover)==null||a.setTheme(this.theme),(o=this._draftQtyFlyout)==null||o.setTheme(this.theme),(s=this.indicatorSettingsDialog)==null||s.setTheme(this.theme),(c=this.chartSettingsDialog)==null||c.setTheme(this.theme),this.applyScrollToEndBtnStyles(),this.applyResetViewBtnStyles(),this.applyMobileDrawingFlyoutTheme(),this.siSymbolSpan&&(this.siSymbolSpan.style.color=this.theme.axisText),this.siStreamDot&&(this.siStreamDot.style.background=this.theme.ui.stream.disconnected),this.scheduleRender(),this.emitStateChange(),this}setTimeframe(e){var t;return this.timeframe=e,(t=this.topBar)==null||t.setTimeframe(e),this.emitter.emit(`timeframeChange`,{timeframe:e}),this.emitStateChange(),this.updateCountdownState(),this.triggerLoad(`timeframe`),this}setThemeOverrides(e){var t,n,r,i,a,o,s,c;return this.themeOverrides=e,this.theme=this.buildTheme(this.themeName),(t=this.topBar)==null||t.setTheme(this.theme),(n=this.bottomBar)==null||n.setTheme(this.theme),(r=this.leftBar)==null||r.setTheme(this.theme),(i=this.tradeButton)==null||i.setTheme(this.theme,this.priceAxisWidth),(a=this.tradePopover)==null||a.setTheme(this.theme),(o=this._draftQtyFlyout)==null||o.setTheme(this.theme),(s=this.indicatorSettingsDialog)==null||s.setTheme(this.theme),(c=this.chartSettingsDialog)==null||c.setTheme(this.theme),this.scheduleRender(),this}setTimezone(e){return this.timezone=e===`local`?Intl.DateTimeFormat().resolvedOptions().timeZone:e,this.scheduleRender(),this}setSeries(e){var t;return this.series=e,(t=this.topBar)==null||t.setSeries(e),this.emitter.emit(`seriesChange`,{series:e}),this.scheduleRender(),this.emitStateChange(),this}setTfcActive(e){var t;if(!this.tfcEnabled)return this;if(this.tfcActive=e,(t=this.topBar)==null||t.setTfcActive(e),!e){var n,r;(n=this.tradeButton)==null||n.hide(),(r=this.tradePopover)==null||r.hide(),this.draftOrderLabel!==null&&this.removeDraftOrder()}return this.chartSettingsDialog&&(this.chartSettingsDialog.destroy(),this.chartSettingsDialog=null),this.renderTradeLayer(),this.emitter.emit(`tfcToggle`,{enabled:e}),this.emitStateChange(),this}clearDuration(){var e,t;this.duration!==void 0&&(this.duration=void 0,(e=this.topBar)==null||e.setActiveDuration(void 0),(t=this.bottomBar)==null||t.setActive(void 0),this.emitStateChange())}setVolume(e){return this.showVolume=e,this.scheduleRender(),this.emitStateChange(),this}dismissAllUI(){var e,t,n,r,i,a;return this.isAnyUIOpen()?((e=this._draftQtyFlyout)==null||e.hide(),(t=this.isinPickerModal)==null||t.hide(),(n=this.indicatorSettingsDialog)==null||n.hide(),(r=this.chartSettingsDialog)==null||r.hide(),(i=this.tradePopover)==null||i.hide(),(a=this.topBar)==null||a.closeDropdown(),this.hideMobileDrawingFlyout(),!0):!1}isAnyUIOpen(){var e,t,n,r,i,a,o,s;return((e=this._draftQtyFlyout)==null?void 0:e.isVisible)===!0||((t=this.isinPickerModal)==null?void 0:t.isVisible)===!0||((n=this.indicatorSettingsDialog)==null?void 0:n.isVisible)===!0||((r=this.chartSettingsDialog)==null?void 0:r.isVisible)===!0||((i=this.tradePopover)==null?void 0:i.isVisible)===!0||((a=this.topBar)==null?void 0:a.hasOpenDropdown)===!0||((o=(s=this._mobileDrawingFlyout)==null?void 0:s.style.display)==null?`none`:o)!==`none`}emitUiState(){this.emitter.emit(`uiStateChange`,{hasOpenUI:this.isAnyUIOpen()})}emitStateChange(){this.isRestoringState||this.emitter.emit(`stateChange`,{symbol:this.symbol,state:this.getState()})}getState(){return{symbol:this.symbol,timeframe:this.timeframe,duration:this.duration,series:this.series,showVolume:this.showVolume,theme:this.themeName,indicators:this.activeIndicators.map(e=>({shortName:e.shortName,params:{...e.currentParams},visible:e.visible})),drawings:this.drawingManager.getDrawingsSnapshot().map(e=>({...e,points:e.points.map(e=>{var t;return{...e,timestamp:(t=this.dataStore.all[Math.floor(e.barIndex)])==null?void 0:t.time}})})),positionRenderStyle:this.positionRenderStyle,tradeDisplayFilter:this.tradeDisplayFilter,canvasColors:Object.keys(this.settingsCanvasColors).length>0?{...this.settingsCanvasColors}:void 0,tfcEnabled:this.tfcActive}}setState(e){this.isRestoringState=!0;try{if(this.setSeries(e.series),this.setVolume(e.showVolume),e.theme!=null&&this.setTheme(e.theme),e.timeframe!=null){var t,n,r;this.timeframe=e.timeframe,this.duration=e.duration,(t=this.topBar)==null||t.setTimeframe(e.timeframe),(n=this.topBar)==null||n.setActiveDuration(e.duration),(r=this.bottomBar)==null||r.setActive(e.duration),this.updateCountdownState()}let c=this.activeIndicators.map(e=>e.shortName);for(let e of c)this.removeIndicator(e);for(let t of e.indicators){let e=nc.find(e=>e.shortName===t.shortName);if(e){let n=e.factory(t.params);this.addIndicator(n);let r=this.activeIndicators.findIndex(e=>e.shortName===t.shortName);if(r!==-1){let e=this.activeIndicators[r];if(e){var i,a;if(e.currentParams={...t.params},t.visible===!1){var o;e.visible=!1;let n=(o=this.subPaneOverlays.get(t.shortName))==null?this.indicatorOverlay:o;n==null||n.updatePillVisibility(t.shortName,!1)}let n=(i=t.params.timeframe)==null?`Chart`:i,r=(a=this.subPaneOverlays.get(t.shortName))==null?this.indicatorOverlay:a;r==null||r.updatePillTimeframe(t.shortName,n)}}}}let l=this.dataStore.all,u=e.drawings.map(e=>({...e,points:e.points.map(e=>{if(!e.timestamp||l.length===0)return e;let t=0,n=l.length-1;for(;t<n;){var r,i;let a=t+n>>1;((r=(i=l[a])==null?void 0:i.time)==null?0:r)<e.timestamp?t=a+1:n=a}return{...e,barIndex:t+(e.barIndex-Math.floor(e.barIndex))}})}));if(this.drawingManager.loadDrawings(u),e.positionRenderStyle&&(this.positionRenderStyleOverride=e.positionRenderStyle,this.positionRenderStyle=e.positionRenderStyle),e.tradeDisplayFilter&&(this.tradeDisplayFilter=e.tradeDisplayFilter),e.canvasColors&&(this.settingsCanvasColors=e.canvasColors),e.tfcEnabled!==void 0&&this.tfcEnabled){var s;this.tfcActive=e.tfcEnabled,(s=this.topBar)==null||s.setTfcActive(e.tfcEnabled)}}finally{this.isRestoringState=!1}return this.emitStateChange(),this.scheduleRender(),this}reanchorDrawingsByTimestamp(){let e=this.dataStore.all;if(e.length!==0)for(let r of this.drawingManager.getDrawings())for(let i of r.points){if(!i.timestamp)continue;let r=0,a=e.length-1;for(;r<a;){var t,n;let o=r+a>>1;((t=(n=e[o])==null?void 0:n.time)==null?0:t)<i.timestamp?r=o+1:a=o}i.barIndex=r+(i.barIndex-Math.floor(i.barIndex))}}resetChartSettings(){return this.setState({symbol:this.symbol,series:`candlestick`,theme:`dark`,timeframe:`1D`,duration:void 0,showVolume:!0,indicators:[],drawings:[]}),this.positionRenderStyleOverride=null,localStorage.removeItem(this.RENDER_STYLE_LS_KEY),this.recomputeRenderStyle(),this.settingsCanvasColors={},this.setTheme(`dark`),this.emitStateChange(),this}setSymbol(e){var t;return this.symbol=e,this.siSymbolSpan&&(this.siSymbolSpan.textContent=e,this.siSymbolSpan.style.display=e?`inline`:`none`),(t=this.isinPickerModal)==null||t.setCurrentSymbol(e),this.tickActivityTimer!==null&&(clearTimeout(this.tickActivityTimer),this.tickActivityTimer=null),this.siStreamDot&&(this.siStreamDot.style.background=this.theme.ui.stream[this.streamStatus]),this.liveBidAsk=null,this}setIsins(e){var t;return this.isins=e,(t=this.isinPickerModal)==null||t.setIsins(e),this}renderSymbolInfoOHLC(e){if(!this.siOHLCSpan)return;if(!e){this.siOHLCSpan.innerHTML=``,this.siOHLC2Span&&(this.siOHLC2Span.innerHTML=``);return}let t=e.close>=e.open?this.theme.candle.up:this.theme.candle.down,n=e=>e.toFixed(this.dataStore.getPricePrecision()),r=e=>e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:e.toFixed(0),i=this.labels.ohlc,a=(e,t)=>{e.innerHTML=``;for(let[n,r,i]of t){let t=document.createElement(`span`);t.style.marginRight=`8px`;let a=document.createElement(`span`);a.textContent=n+`\xA0`,a.style.color=this.theme.axisText,a.style.opacity=`0.6`;let o=document.createElement(`span`);o.textContent=r,o.style.color=i,t.append(a,o),e.appendChild(t)}};a(this.siOHLCSpan,[[i.open,n(e.open),this.theme.axisText],[i.high,n(e.high),this.theme.axisText]]),this.siOHLC2Span&&a(this.siOHLC2Span,[[i.low,n(e.low),this.theme.axisText],[i.close,n(e.close),t],...e.volume!=null&&e.volume!==0?[[i.volume,r(e.volume),this.theme.axisText]]:[]])}setMinLots(e){var t;return console.warn(`[acttrader-charts] setMinLots() is deprecated. Pass minLots in the initial ChartConfig instead.`),this._minLots=e,(t=this.tradePopover)==null||t.setLots(e),this}setDraftQty(e){return this.draftOrderLabel&&this.setLevelQty(this.draftOrderLabel,e),this}setLevelQty(e,t){var n,r;let i=this.levels.findIndex(t=>t.label===e);if(i===-1)return;let a=this.levels[i];if(a.lots===t)return;this.originalQtyByLabel.has(e)||this.originalQtyByLabel.set(e,a.lots);let o=(n=(r=this.originalQtyByLabel.get(e))==null?a.lots:r)==null?t:n;this.levels=[...this.levels.slice(0,i),{...a,lots:t},...this.levels.slice(i+1)],e!==this.draftOrderLabel&&this.pendingQtyChanges.set(e,t),this.emitter.emit(`tradeLevelQtyChange`,{label:e,type:e===this.draftOrderLabel?`draft`:a.type,newLots:t,previousLots:o,isFullscreen:this.isFullscreen}),this.renderTradeLayer()}openDraftQtyFlyout(e){var t;this._draftQtyFlyout||(this._draftQtyFlyout=new is(this.theme,e=>{this._activeQtyPillLabel&&this.setLevelQty(this._activeQtyPillLabel,e)},()=>this.emitUiState()),this.getFloatingRoot().appendChild(this._draftQtyFlyout.el)),this._activeQtyPillLabel=e.label;let n=this.levels.find(t=>t.label===e.label),r=(t=n==null?void 0:n.lots)==null?this._qtyFieldMin:t,i=this.canvasWrap.getBoundingClientRect(),a=i.left+e.pillX,o=i.top+e.pillY+e.pillH;this._draftQtyFlyout.show(a,o,r,this._qtyFieldMin,this._qtyFieldMax)}setDraftOrderLabels(e){return console.warn(`[acttrader-charts] setDraftOrderLabels() is deprecated and is a no-op. DraftOrderQtyInput has been removed.`),this}setDrawingTool(e){var t;return this.drawingManager.setActiveTool(e),(t=this.leftBar)==null||t.setActiveTool(e),this.drawCanvas.style.cursor=e?`crosshair`:`default`,this.scheduleRender(),this}undoDrawing(){return this.drawingManager.undo(),this.scheduleRender(),this}redoDrawing(){return this.drawingManager.redo(),this.scheduleRender(),this}hideAllDrawings(){return this.drawingManager.hideAll(),this.scheduleRender(),this}showAllDrawings(){return this.drawingManager.showAll(),this.scheduleRender(),this}lockAllDrawings(){return this.drawingManager.lockAll(),this.scheduleRender(),this}unlockAllDrawings(){return this.drawingManager.unlockAll(),this.scheduleRender(),this}deleteSelectedDrawing(){return this.drawingManager.deleteSelected(),this.hideMobileDrawingFlyout(),this.scheduleRender(),this}clearAllDrawings(){return this.drawingManager.clearAll(),this.scheduleRender(),this}getActiveTool(){return this.drawingManager.getActiveTool()}getDrawings(){return this.drawingManager.getDrawings()}connectStream(e){return this.streamAdapter=e,e.onTick(e=>this.onTick(e)),e.onStatus(e=>{this.streamStatus=e,this.siStreamDot&&(this.siStreamDot.style.background=this.theme.ui.stream[e],this.siStreamDot.title=`Stream ${e}`),this.emitter.emit(`streamStatus`,{status:e})}),e.connect(),this}disconnectStream(){var e;return(e=this.streamAdapter)==null||e.disconnect(),this.streamAdapter=null,this}pushTick(e){let t=e.T==null?Date.now():typeof e.T==`string`?new Date(e.T).getTime():e.T;return this.onTick({time:t,bid:e.B,ask:e.A,volume:0}),this}setLevels(e,t,n,r,i,a){let o=e.map(e=>{if(r===`position`){let r={label:String(e[t]),price:Number(e[n]),type:`position`,data:e};return e.text!==void 0&&(r.text=String(e.text)),i!==void 0&&e[i]!==void 0&&(r.pnl=Number(e[i])),a!==void 0&&e[a]!==void 0&&(r.pnlText=String(e[a])),e.side!==void 0&&(r.side=e.side),e.stopLossPrice!==void 0&&(r.stopLossPrice=Number(e.stopLossPrice)),e.takeProfitPrice!==void 0&&(r.takeProfitPrice=Number(e.takeProfitPrice)),e.entryPriceEditable&&(r.entryPriceEditable=!0),e.orderType!==void 0&&(r.orderType=e.orderType),e.lots!==void 0&&(r.lots=Number(e.lots)),r}if(r===`pending`){var o,s;let r={label:String(e[t]),price:Number(e[n]),type:`pending`,side:(o=e.side)==null?`buy`:o,orderType:(s=e.orderType)==null?`limit`:s,data:e};return e.text!==void 0&&(r.text=String(e.text)),e.lots!==void 0&&(r.lots=Number(e.lots)),e.stopLossPrice!==void 0&&(r.stopLossPrice=Number(e.stopLossPrice)),e.takeProfitPrice!==void 0&&(r.takeProfitPrice=Number(e.takeProfitPrice)),e.ToClose!==void 0&&(r.ToClose=String(e.ToClose)),r}return{label:String(e[t]),price:Number(e[n]),type:`trade`,text:e.text===void 0?void 0:String(e.text),data:e}});if(this.hideLevelConfirmCancel&&this.pendingLevelDrags.size>0)for(let e of o){let t=this.pendingLevelDrags.get(e.label);if(!(t!=null&&t.length))continue;let n=e;t.every(t=>t.isRemoval?t.field===`stopLoss`?n.stopLossPrice===void 0:n.takeProfitPrice===void 0:t.field===`main`?e.price===t.newPrice:t.field===`stopLoss`?n.stopLossPrice===t.newPrice:n.takeProfitPrice===t.newPrice)&&(this.pendingLevelDrags.delete(e.label),this.selectedTradeLabel===e.label&&(this.selectedTradeLabel=null))}if(this.pendingQtyChanges.size>0)for(let e=0;e<o.length;e++){let t=o[e],n=this.pendingQtyChanges.get(t.label);if(n===void 0||t.type!==`pending`&&t.type!==`position`)continue;let r=t;this.originalQtyByLabel.set(t.label,r.lots),o[e]={...r,lots:n}}let s=this.draftOrderLabel===null?void 0:this.levels.find(e=>e.type===r&&e.label===this.draftOrderLabel&&!o.some(t=>t.label===e.label));return this.levels=[...this.levels.filter(e=>e.type!==r),...o,...s?[s]:[]],this.selectedTradeLabel!==null&&!this.levels.some(e=>e.label===this.selectedTradeLabel)&&(this.selectedTradeLabel=null),this.recomputeRenderStyle(),this.renderTradeLayer(),this}removeLevelByLabel(e){return this.levels=this.levels.filter(t=>t.label!==e),this.renderTradeLayer(),this}showDraftOrder(e,t,n){if(this.draftOrderLabel){let e=this.levels.find(e=>e.label===this.draftOrderLabel);if((e==null?void 0:e.side)===t&&(e==null?void 0:e.orderType)===n)return this}return this.clearDraftOrder(),this.createDraftOrder(t,e,n),this}showMarketDraft(e,t){this.clearDraftOrder();let n=`__draft_${Date.now()}`,r={type:`pending`,label:n,side:t,price:e,orderType:`market`,data:{_isDraft:!0}};return this.levels=[...this.levels,r],this.draftOrderLabel=n,this.renderTradeLayer(),this.emitter.emit(`draftInitiated`,{side:t,price:e,orderType:`market`,isFullscreen:this.isFullscreen}),this}clearDraftOrder(){return this.removeDraftOrder(),this}updateLevelBracket(e,t,n){var r;let i=t===`sl`?`stopLoss`:`takeProfit`,a=this.levels.find(t=>t.label===e);if(!a)return this;let o=t===`sl`?a.stopLossPrice:a.takeProfitPrice,s=(r=this.pendingLevelDrags.get(e))==null?[]:r,c=s.find(e=>e.field===i),l=s.filter(e=>e.field!==i);if(this.levels=this.levels.map(r=>{if(r.label!==e)return r;let i=r;return t===`sl`?{...i,stopLossPrice:n==null?void 0:n}:{...i,takeProfitPrice:n==null?void 0:n}}),n===null){if(o!==void 0){var u;let e=(u=c==null?void 0:c.oldPrice)==null?o:u;l.push({field:i,newPrice:o,oldPrice:e,isRemoval:!0})}l.length===0?this.pendingLevelDrags.delete(e):this.pendingLevelDrags.set(e,l)}else{var d;let t=(d=c==null?void 0:c.isNew)==null?o===void 0:d,r=c&&!c.isRemoval?c.oldPrice:o==null?n:o;l.push({field:i,newPrice:n,oldPrice:r,isNew:t}),this.pendingLevelDrags.set(e,l)}return this.renderTradeLayer(),this}addLevelBracket(e,t){var n,r,i,a,o;let s=this.levels.find(t=>t.label===e);if(!s)return this;let c=t===`sl`?`stopLoss`:`takeProfit`,l=t===`sl`?s.stopLossPrice!==void 0:s.takeProfitPrice!==void 0,u=(n=(r=this.pendingLevelDrags.get(e))==null?void 0:r.some(e=>e.field===c&&!e.isRemoval))==null?!1:n;if(l||u)return this;let{priceH:d}=this.getChartLayout(),f=(i=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):i,p=this.scaleManager.yToPixel(s.price,f,d),m=(a=s.side)==null?`buy`:a,h=p+(m===`buy`&&t===`sl`||m===`sell`&&t===`tp`?30:-30),g=this.scaleManager.pixelToPrice(h,f,d);this.updateLevelBracket(e,t,g);let _=((o=this.pendingLevelDrags.get(e))==null?[]:o).filter(e=>e.field!==c);return _.push({field:c,newPrice:g,oldPrice:g,isNew:!0}),this.pendingLevelDrags.set(e,_),this.emitter.emit(`tradeLevelBracketActivated`,{label:e,bracketType:t,price:g,isFullscreen:this.isFullscreen}),this.emitter.emit(`tradeLevelDrag`,{label:e,newPrice:g,data:s.data,bracketType:t===`sl`?`stopLoss`:`takeProfit`,isFullscreen:this.isFullscreen}),this}addBracket(e,t){var n,r;if(t)return this.addLevelBracket(t,e);if(!this.draftOrderLabel)return this;let i=this.draftOrderLabel,a=this.levels.find(e=>e.label===i);if(!a||(e===`sl`?a.stopLossPrice!==void 0:a.takeProfitPrice!==void 0))return this;let{priceH:o}=this.getChartLayout(),s=(n=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):n,c=this.scaleManager.yToPixel(a.price,s,o),l=(r=a.side)==null?`buy`:r,u=c+(l===`buy`&&e===`sl`||l===`sell`&&e===`tp`?30:-30),d=this.scaleManager.pixelToPrice(u,s,o);return this.updateDraftOrderBracket(e,d),this.emitter.emit(`tradeLevelBracketActivated`,{label:``,bracketType:e,price:d,isFullscreen:this.isFullscreen}),this.emitter.emit(`tradeLevelDrag`,{label:i,newPrice:d,data:a.data,bracketType:e===`sl`?`stopLoss`:`takeProfit`,isFullscreen:this.isFullscreen}),this}removeBracket(e,t){if(t){var n,r;let i=e===`sl`?`stopLoss`:`takeProfit`,a=this.levels.find(e=>e.label===t);if(!a)return this;let o=(n=this.pendingLevelDrags.get(t))==null?void 0:n.find(e=>e.field===i),s=o&&!o.isRemoval?o.newPrice:e===`sl`?a.stopLossPrice:a.takeProfitPrice;if(s===void 0)return this;let c=((r=this.pendingLevelDrags.get(t))==null?[]:r).filter(e=>e.field!==i);return c.push({field:i,newPrice:s,oldPrice:s,isRemoval:!0}),this.pendingLevelDrags.set(t,c),this.renderTradeLayer(),this}return e===`sl`?this.draftBracketPnl={...this.draftBracketPnl,sl:void 0}:this.draftBracketPnl={...this.draftBracketPnl,tp:void 0},this.updateDraftOrderBracket(e,null)}updateLevelMainPrice(e,t){var n;let r=this.levels.find(t=>t.label===e);if(!r)return this;let i=(n=this.pendingLevelDrags.get(e))==null?[]:n,a=i.find(e=>e.field===`main`),o=a?a.oldPrice:r.price,s=i.filter(e=>e.field!==`main`);return s.push({field:`main`,newPrice:t,oldPrice:o}),this.pendingLevelDrags.set(e,s),r.price=t,this.renderTradeLayer(),this}setDraftBracketPnl(e,t){return e===`sl`?this.draftBracketPnl={...this.draftBracketPnl,sl:t==null?void 0:t}:this.draftBracketPnl={...this.draftBracketPnl,tp:t==null?void 0:t},this.renderTradeLayer(),this}updateDraftOrderBracket(e,t){return this.draftOrderLabel?(this.levels=this.levels.map(n=>{if(n.label!==this.draftOrderLabel)return n;let r=n;return e===`sl`?{...r,stopLossPrice:t==null?void 0:t}:{...r,takeProfitPrice:t==null?void 0:t}}),this.scheduleRender(),this):this}updateDraftOrderPrice(e){if(!this.draftOrderLabel)return!1;this.levels=this.levels.map(t=>t.label===this.draftOrderLabel?{...t,price:e}:t);let t=this.pendingLevelDrags.get(this.draftOrderLabel);if(t){let n=t.find(e=>e.field===`main`);n&&(n.newPrice=e)}return this.renderTradeLayer(),!0}cancelLevelEdit(e){var t;if(this.undoIsNewBracketMutations(e),this.pendingLevelDrags.delete(e),this.pendingQtyChanges.has(e)){this.pendingQtyChanges.delete(e);let t=this.levels.findIndex(t=>t.label===e);if(t!==-1&&this.originalQtyByLabel.has(e)){let n=this.originalQtyByLabel.get(e),r=this.levels[t];this.levels=[...this.levels.slice(0,t),{...r,lots:n},...this.levels.slice(t+1)]}this.originalQtyByLabel.delete(e)}return e===((t=this.draftOrderLabel)==null?this.selectedTradeLabel:t)&&(this.draftBracketPnl={}),this.selectedTradeLabel===e&&(this.selectedTradeLabel=null),this.renderTradeLayer(),this}cancelCurrentEdit(){return this.draftOrderLabel?this.clearDraftOrder():this.selectedTradeLabel&&this.revertPendingChanges(this.selectedTradeLabel),this}selectLevel(e){if(!this.draftOrderLabel&&e!==this.selectedTradeLabel&&(this.draftBracketPnl={}),this.selectedTradeLabel=e,e!==null){this.crosshair=null;let t=this.lastClusters.find(t=>t.members.some(t=>t.level.label===e));t&&this.expandedClusters.add(t.id)}return this.renderTradeLayer(),this}setLevelClusteringEnabled(e){return this.levelClusteringEnabled=e,this.expandedClusters.clear(),this.renderTradeLayer(),this}setClusterThresholdDistance(e){return this.clusterThresholdDistance=e,this.expandedClusters.clear(),this.renderTradeLayer(),this}setTradeLevelButtonScale(e){return this.tradeLevelButtonScale=Math.min(Math.max(e,1),3),this.renderTradeLayer(),this}destroy(){var e,t,n,r,i,a,o,s,c,l,u;this.panHandler.destroy(),this.zoomHandler.destroy(),this.resizeObserver.disconnect(),this.disposeVvListener(),(e=this.indicatorOverlay)==null||e.destroy();for(let e of this.subPaneOverlays.values())e.destroy();this.subPaneOverlays.clear(),(t=this.indicatorSettingsDialog)==null||t.destroy(),(n=this.chartSettingsDialog)==null||n.destroy(),(r=this.isinPickerModal)==null||r.destroy(),(i=this.tradePopover)==null||i.destroy(),(a=this._draftQtyFlyout)==null||a.destroy(),(o=this.leftBar)==null||o.destroy(),this.drawCanvas.removeEventListener(`mousemove`,this.onMouseMove),this.drawCanvas.removeEventListener(`mouseleave`,this.onMouseLeave),this.drawCanvas.removeEventListener(`mousedown`,this.onCanvasClick),this.drawCanvas.removeEventListener(`dblclick`,this.onDoubleClick),window.removeEventListener(`mouseup`,this.onMouseUp),this.drawCanvas.removeEventListener(`touchstart`,this.onDrawingTouchStart),this.drawCanvas.removeEventListener(`touchmove`,this.onDrawingTouchMove),this.drawCanvas.removeEventListener(`touchend`,this.onDrawingTouchEnd),document.removeEventListener(`keydown`,this.onKeyDown),(s=this.streamAdapter)==null||s.disconnect(),this.rafId!==null&&cancelAnimationFrame(this.rafId),this.scrollAnimId!==null&&cancelAnimationFrame(this.scrollAnimId),this.stopCountdownLoop(),(c=this.resetViewBtn)==null||c.remove(),(l=this.textInputEl)==null||l.remove(),(u=this._mobileDrawingFlyout)==null||u.remove(),this.wrapper.remove()}createMobileDrawingFlyout(){let e=document.createElement(`div`);Object.assign(e.style,{position:`fixed`,display:`none`,alignItems:`center`,gap:`2px`,zIndex:`10000`,background:this.theme.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`8px`,padding:`4px`,boxShadow:`0 4px 16px rgba(0,0,0,0.45)`,pointerEvents:`auto`});let t=(e,t,n)=>{let r=document.createElement(`button`);return r.title=t,r.innerHTML=e,Object.assign(r.style,{display:`flex`,alignItems:`center`,justifyContent:`center`,width:`34px`,height:`34px`,padding:`0`,border:`none`,borderRadius:`6px`,background:`transparent`,color:n?this.theme.candle.down:this.theme.axisText,cursor:`pointer`,flexShrink:`0`}),r.addEventListener(`pointerenter`,()=>{r.style.background=n?`${this.theme.candle.down}22`:this.theme.axisBorder}),r.addEventListener(`pointerleave`,()=>{r.style.background=`transparent`}),r},n=t(Rt,`Delete drawing`,!0);n.addEventListener(`pointerdown`,e=>{e.stopPropagation(),this.deleteSelectedDrawing(),this.hideMobileDrawingFlyout()});let r=t(Ft,`Deselect`,!1);return r.addEventListener(`pointerdown`,e=>{e.stopPropagation(),this.drawingManager.selectDrawing(null),this.hideMobileDrawingFlyout(),this.scheduleRender()}),e.appendChild(n),e.appendChild(r),this.wrapper.appendChild(e),e}showMobileDrawingFlyout(e,t){if(!fc())return;this._mobileDrawingFlyout||(this._mobileDrawingFlyout=this.createMobileDrawingFlyout());let n=this._mobileDrawingFlyout,r=n.style.display!==`none`&&n.style.display!==``;n.style.display=`flex`,requestAnimationFrame(()=>{let r=n.offsetWidth||78,i=n.offsetHeight||42,a=window.innerWidth,o=window.innerHeight,s=Math.min(Math.max(e-r/2,8),a-r-8),c=Math.min(Math.max(t-i-12,8),o-i-8);n.style.left=`${s}px`,n.style.top=`${c}px`}),r||this.emitUiState()}hideMobileDrawingFlyout(){if(this._mobileDrawingFlyout){let e=this._mobileDrawingFlyout.style.display!==`none`&&this._mobileDrawingFlyout.style.display!==``;this._mobileDrawingFlyout.style.display=`none`,e&&this.emitUiState()}}applyMobileDrawingFlyoutTheme(){if(!this._mobileDrawingFlyout)return;let e=this._mobileDrawingFlyout;e.style.background=this.theme.background,e.style.border=`1px solid ${this.theme.axisBorder}`;let[t,n]=Array.from(e.querySelectorAll(`button`));t&&(t.style.color=this.theme.candle.down),n&&(n.style.color=this.theme.axisText)}scheduleRender(){this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.render(),this.renderTradeLayer()}))}startCountdownLoop(){if(this.countdownRafId!==null)return;let e=0,t=n=>{if(!this.countdownActive){this.countdownRafId=null;return}n-e>=1e3&&(e=n,this.scheduleRender()),this.countdownRafId=requestAnimationFrame(t)};this.countdownRafId=requestAnimationFrame(t)}stopCountdownLoop(){this.countdownActive=!1,this.countdownRafId!==null&&(cancelAnimationFrame(this.countdownRafId),this.countdownRafId=null)}updateCountdownState(){var e;let t=this.candleCountdownTimeframes===`all`?!0:((e=this.candleCountdownTimeframes)==null?[`1m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`8h`]:e).includes(this.timeframe),n=this.showCandleCountdown&&t&&this.dataStore.length>0;n&&!this.countdownActive?(this.countdownActive=!0,this.startCountdownLoop()):!n&&this.countdownActive&&this.stopCountdownLoop()}openChartSettings(){this.chartSettingsDialog||(this.chartSettingsDialog=new ts(this.theme,{tradeDisplayFilter:this.tradeDisplayFilter,positionRenderStyle:this.positionRenderStyle,theme:this.themeName},this.labels.dialogs,!!this._onOrderSubmit&&this.tfcActive,this.enableThemeToggle,()=>this.emitUiState()),this.getFloatingRoot().appendChild(this.chartSettingsDialog.el)),this.chartSettingsDialog.show({tradeDisplayFilter:this.tradeDisplayFilter,positionRenderStyle:this.positionRenderStyle,theme:this.themeName,canvasColors:{...this.settingsCanvasColors}},e=>{this.tradeDisplayFilter=e.tradeDisplayFilter,this.positionRenderStyleOverride=e.positionRenderStyle,localStorage.setItem(this.RENDER_STYLE_LS_KEY,e.positionRenderStyle),this.positionRenderStyle=e.positionRenderStyle,e.canvasColors&&(this.settingsCanvasColors=e.canvasColors),this.setTheme(e.theme),this.renderTradeLayer(),this.emitStateChange()},()=>{this.resetChartSettings()})}getFloatingRoot(){var e;return(e=document.fullscreenElement)==null?document.body:e}reparentFloatingElements(){var e,t,n,r,i,a;let o=this.getFloatingRoot();(e=this.topBar)==null||e.reparentFlyout(o),(t=this.leftBar)==null||t.reparentFlyout(o);let s=[(n=this.isinPickerModal)==null?void 0:n.el,(r=this.indicatorSettingsDialog)==null?void 0:r.el,(i=this.chartSettingsDialog)==null?void 0:i.el,(a=this._draftQtyFlyout)==null?void 0:a.el];for(let e of s)e&&e.parentElement!==o&&o.appendChild(e)}toggleDrawingTools(){var e,t;this.leftBarVisible=!this.leftBarVisible,(e=this.leftBar)==null||e.setVisible(this.leftBarVisible),(t=this.topBar)==null||t.setDrawingsBtnActive(this.leftBarVisible)}_applyCssFullscreen(e){var t;this._isCssFullscreen=e,e?Object.assign(this.wrapper.style,{position:`fixed`,inset:`0`,width:`100vw`,height:`100vh`,zIndex:`9999`}):Object.assign(this.wrapper.style,{position:``,inset:``,width:``,height:``,zIndex:``}),(t=this.topBar)==null||t.setFullscreen(e),this.reparentFloatingElements(),requestAnimationFrame(()=>this.onResize())}toggleFullscreen(){let e=!!document.fullscreenElement;!e&&!this._isCssFullscreen?this.wrapper.requestFullscreen?this.wrapper.requestFullscreen().then(()=>{var e;(e=this.topBar)==null||e.setFullscreen(!0)}).catch(()=>{this._applyCssFullscreen(!0)}):this._applyCssFullscreen(!0):e?document.exitFullscreen().catch(()=>{}):this._applyCssFullscreen(!1)}recomputeRenderStyle(){if(this.positionRenderStyleOverride!==null){this.positionRenderStyle=this.positionRenderStyleOverride;return}this.positionRenderStyle=this.levels.filter(e=>e.type===`position`||e.type===`pending`).length>this.tradesThresholdForHorizontalLine?`dot`:`line`}renderTradeLayer(){var e,t,n,r;let i=window.devicePixelRatio||1,{tradeCtx:a,tradeCanvas:o,theme:s,viewport:c}=this;if(a.clearRect(0,0,o.width,o.height),!this.tfcActive||this.levels.length===0||this.dataStore.length===0){this.tradeLevelHitAreas=[],this.tradeLevelEditAreas=[],this.tradeHoverAreas=[],this.tradeAddBracketAreas=[],this.offViewportHitAreas=[];return}let{chartW:l,priceH:u}=this.getChartLayout(),d=this.getScaledPriceRange(c),f=this.levels.filter(e=>e.type===`pending`&&e.ToClose!=null),p=this.levels.filter(e=>!(e.type===`pending`&&e.ToClose!=null)).map(e=>{var t,n,r,i;let a=(t=this.pendingLevelDrags.get(e.label))==null?[]:t,o=a.find(e=>e.field===`stopLoss`),s=a.find(e=>e.field===`takeProfit`),c=o&&!o.isRemoval?o.newPrice:void 0,l=s&&!s.isRemoval?s.newPrice:void 0,u=(n=o==null?void 0:o.isRemoval)==null?!1:n,d=(r=s==null?void 0:s.isRemoval)==null?!1:r,p=(i=a.find(e=>e.field===`main`))==null?void 0:i.newPrice,m=f.filter(t=>t.ToClose===e.label);if(m.length===0&&c===void 0&&l===void 0&&p===void 0&&!u&&!d)return e;let h={...e};if(p!==void 0&&(h.price=p),c===void 0?u&&(h.stopLossPrice=void 0):h.stopLossPrice=c,l===void 0?d&&(h.takeProfitPrice=void 0):h.takeProfitPrice=l,m.length>0){var g;let t=(g=e.side)==null?`buy`:g;for(let n of m)if(t===`buy`?n.price<e.price:n.price>e.price){var _;h.stopLossPrice=u?void 0:(_=c==null?h.stopLossPrice:c)==null?n.price:_,h._slOrderLabel=n.label}else{var v;h.takeProfitPrice=d?void 0:(v=l==null?h.takeProfitPrice:l)==null?n.price:v,h._tpOrderLabel=n.label}}return h});a.save(),a.scale(i,i),a.save(),a.beginPath(),a.rect(0,0,l,u),a.clip();let m=e=>e.type===`position`&&!!e.entryPriceEditable,h=this.selectedTradeLabel===null?this.tradeDisplayFilter===`none`?[]:this.tradeDisplayFilter===`positions`?p.filter(e=>e.type===`position`&&!m(e)):this.tradeDisplayFilter===`orders`?p.filter(e=>e.type===`pending`||m(e)):p:p.filter(e=>e.label===this.selectedTradeLabel),g=this.levelClusteringEnabled?this.clusterThresholdDistance:0,_=Ve(a,h,this.scaleManager,d,s,l,u,this.dataStore.getPricePrecision(),this.hoveredTradeLabel,(e=(t=this.tradeDragHandler)==null?void 0:t.dragLabel)==null?null:e,this.tradeDragNewPrice,this.selectedTradeLabel,new Set(this.pendingLevelDrags.keys()),this.positionRenderStyle,this.hideLevelConfirmCancel,this.draftOrderLabel,this.draftBracketPnl,this.expandedClusters,g,this._showQuantityField,this.tradeDragNewSLPrice,this.tradeDragNewTPPrice,this.tradeLevelButtonScale);if(a.restore(),this.offViewportHitAreas=yt(a,h,d,s,l,u,(n=(r=this.tradeDragHandler)==null?void 0:r.dragLabel)==null?null:n,this.selectedTradeLabel).hitAreas,st(a,h,this.scaleManager,d,s,l,u,this.dataStore.getPricePrecision()),a.restore(),this.tradeLevelHitAreas=_.hitAreas,this.tradeLevelEditAreas=_.editAreas,this.tradeHoverAreas=_.hoverAreas,this.tradeLevelDragAreas=_.dragAreas,this.tradeLevelConfirmAreas=_.confirmAreas,this.tradeAddBracketAreas=_.addBracketAreas,this.clusterBadgeAreas=_.clusterBadgeAreas,this.lastClusters=_.clusters,this._draftQtyPillArea=_.draftQtyPillArea,this.expandedClusters.size>0){let e=new Set(_.clusters.map(e=>e.id));for(let t of this.expandedClusters)e.has(t)||this.expandedClusters.delete(t)}}_effectiveEntryPrice(e,t){var n,r;let i=this.pendingLevelDrags.get(e);return(n=i==null||(r=i.find(e=>e.field===`main`))==null?void 0:r.newPrice)==null?t:n}_effectiveBracketPrice(e,t,n){var r;let i=this.pendingLevelDrags.get(e),a=i==null||(r=i.find(e=>e.field===t))==null?void 0:r.newPrice;return a==null?n:a}_resolveBracketPrices(e){let t=e.stopLossPrice,n=e.takeProfitPrice,r,i;if(t===void 0||n===void 0){let o=this.levels.filter(t=>t.type===`pending`&&t.ToClose===e.label);if(o.length>0){var a;let s=(a=e.side)==null?`buy`:a;for(let a of o){let o=s===`buy`?a.price<e.price:a.price>e.price;o&&t===void 0?(t=a.price,r=a.label):!o&&n===void 0&&(n=a.price,i=a.label)}}}return{slPrice:t,tpPrice:n,slSiblingLabel:r,tpSiblingLabel:i}}_finalizeMainDragWithBrackets(e,t){var n;let r=this.levels.find(t=>t.label===e.label),i=e.derivedSLPrice!==void 0&&e.slStartPrice!==void 0&&e.derivedSLPrice!==e.slStartPrice,a=e.derivedTPPrice!==void 0&&e.tpStartPrice!==void 0&&e.derivedTPPrice!==e.tpStartPrice,o=!i&&!a;if(this.storePendingChange(e,e.startPrice,t,!o),!((n=this.pendingLevelDrags.get(e.label))!=null&&n.some(t=>t.field===`main`&&t.newPrice===e.newPrice))){this.tradeDragNewSLPrice=null,this.tradeDragNewTPPrice=null;return}if(i){var s,c,l;let n=!a,i=r,o=r,u=(s=(c=i==null?void 0:i.stopLossData)==null?o==null?void 0:o.stopLossData:c)==null?e.data:s;this.storePendingChange({label:e.label,type:e.type,newPrice:e.derivedSLPrice,data:u,bracketType:`stopLoss`},e.slStartPrice,(l=this._slSiblingOrderLabel)==null?t:l,!n)}if(a){var u,d,f;let n=r,i=r,a=(u=(d=n==null?void 0:n.takeProfitData)==null?i==null?void 0:i.takeProfitData:d)==null?e.data:u;this.storePendingChange({label:e.label,type:e.type,newPrice:e.derivedTPPrice,data:a,bracketType:`takeProfit`},e.tpStartPrice,(f=this._tpSiblingOrderLabel)==null?t:f,!1)}this.tradeDragNewSLPrice=null,this.tradeDragNewTPPrice=null,this._slSiblingOrderLabel=null,this._tpSiblingOrderLabel=null}storePendingChange(e,t,n,r=!1){var i,a,o,s,c;if(e.bracketType){var l,u,d,f,p;let n=this.levels.find(t=>t.label===e.label),r=(l=n==null?void 0:n.side)==null?`buy`:l,i=this._effectiveEntryPrice(e.label,(u=n==null?void 0:n.price)==null?t:u),a=(n==null?void 0:n.entryPriceEditable)===!0,o=(n==null||(d=n.data)==null?void 0:d._isDraft)===!0,s=this.hideLevelConfirmCancel&&e.type===`pending`&&!o,c=this.dataStore.all,m=a||o||s||(f=(p=c[c.length-1])==null?void 0:p.close)==null?0:f;if(!cs.isBracketPriceValid(e.newPrice,e.bracketType,i,r,m)){this.tradeDragNewPrice=null,this.renderTradeLayer();return}}if(!e.bracketType){let t=this.levels.find(t=>t.label===e.label);if(t!=null&&t.orderType&&t!=null&&t.side){var m,h;let n=this.dataStore.all,r=(m=(h=n[n.length-1])==null?void 0:h.close)==null?0:m;if(r>0&&!(t.side===`buy`&&t.orderType===`limit`||t.side===`sell`&&t.orderType===`stop`?e.newPrice<r:e.newPrice>r)){this.tradeDragNewPrice=null,this.renderTradeLayer();return}}}let g=(i=e.bracketType)==null?`main`:i,_=this._isBracketNew;this._isBracketNew=!1;let v=this.levels.find(t=>t.label===e.label);if((v==null?void 0:v.orderType)===`market`&&(v==null||(a=v.data)==null?void 0:a._isDraft)===!0){g!==`main`&&(this.updateDraftOrderBracket(g===`stopLoss`?`sl`:`tp`,e.newPrice),this.emitter.emit(`tradeLevelDrag`,{label:e.label,newPrice:e.newPrice,data:v==null?void 0:v.data,bracketType:g,isFullscreen:this.isFullscreen})),this.tradeDragNewPrice=null,this.renderTradeLayer();return}if(v!==void 0&&g!==`main`&&(v==null||(o=v.data)==null?void 0:o._isDraft)===!0){this.updateDraftOrderBracket(g===`stopLoss`?`sl`:`tp`,e.newPrice),this.emitter.emit(`tradeLevelDrag`,{label:e.label,newPrice:e.newPrice,data:v==null?void 0:v.data,bracketType:g,isFullscreen:this.isFullscreen}),this.tradeDragNewPrice=null,this.renderTradeLayer();return}if(v!==void 0&&g===`main`&&(v==null||(s=v.data)==null?void 0:s._isDraft)===!0&&v.orderType!==`market`&&this.hideLevelConfirmCancel){this.updateDraftOrderPrice(e.newPrice),this.emitter.emit(`tradeLevelDrag`,{label:e.label,newPrice:e.newPrice,data:v==null?void 0:v.data,bracketType:void 0,isFullscreen:this.isFullscreen}),this.tradeDragNewPrice=null,this.renderTradeLayer();return}let y=((c=this.pendingLevelDrags.get(e.label))==null?[]:c).filter(e=>e.field!==g);if(y.push({field:g,newPrice:e.newPrice,oldPrice:t,isNew:_,bracketOrderLabel:n}),this.pendingLevelDrags.set(e.label,y),this.tradeDragNewPrice=null,this.hideLevelConfirmCancel&&!r){this.applyPendingChanges(e.label);return}this.renderTradeLayer()}_orderTypeForPrice(e,t){let n=this.dataStore.all,r=n.length>0?n[n.length-1].close:t;return e===`buy`?t<r?`limit`:`stop`:t>r?`limit`:`stop`}createDraftOrder(e,t,n){if(this.draftOrderLabel)return;let r=`__draft_${Date.now()}`,i={type:`pending`,label:r,side:e,price:t,orderType:n,lots:this._qtyFieldMin,data:{_isDraft:!0}};this.levels=[...this.levels,i],this.draftOrderLabel=r,this.selectedTradeLabel=r,this.pendingLevelDrags.set(r,[{field:`main`,newPrice:t,oldPrice:t}]),this.crosshair=null,this.renderTradeLayer(),this.emitter.emit(`draftInitiated`,{side:e,price:t,orderType:n,isFullscreen:this.isFullscreen})}removeDraftOrder(){var e;if(!this.draftOrderLabel)return;let t=this.draftOrderLabel;this.levels=this.levels.filter(e=>e.label!==t),this.pendingLevelDrags.delete(t),this.selectedTradeLabel=null,this.draftOrderLabel=null,this.draftBracketPnl={},(e=this._draftQtyFlyout)==null||e.hide(),this._draftQtyPillArea=void 0,this.renderTradeLayer(),this.emitter.emit(`draftCancelled`,{label:t,isFullscreen:this.isFullscreen})}applyPendingChanges(e){let t=this.pendingLevelDrags.get(e);if(!t)return;let n=this.levels.find(t=>t.label===e);if(!n)return;if(this._editOpenLabel===e&&(this._editOpenLabel=null),e===this.draftOrderLabel){var r,i,a;let o=t.find(e=>e.field===`main`),s=n;(r=this._onOrderSubmit)==null||r.call(this,{price:(i=o==null?void 0:o.newPrice)==null?s.price:i,lots:(a=s.lots)==null?this._qtyFieldMin:a,side:s.side,orderType:s.orderType,...s.stopLossPrice===void 0?{}:{stopLoss:s.stopLossPrice},...s.takeProfitPrice===void 0?{}:{takeProfit:s.takeProfitPrice}}),this.emitter.emit(`tradeLevelConfirmed`,{label:e,type:`draft`,isFullscreen:this.isFullscreen}),this.removeDraftOrder();return}let o=this.pendingQtyChanges.get(e);this.pendingQtyChanges.delete(e),this.originalQtyByLabel.delete(e);let s=o!==void 0&&n.data&&typeof n.data==`object`?{...n.data,lots:o}:n.data;this.emitter.emit(`tradeLevelEdit`,{label:e,type:n.type,data:s,isFullscreen:this.isFullscreen,...o===void 0?{}:{newLots:o},changes:t.map(e=>{let t=n.data,r=s;if(e.field===`stopLoss`){var i;r=(i=t.stopLossData)==null?n.data:i}else if(e.field===`takeProfit`){var a;r=(a=t.takeProfitData)==null?n.data:a}if(e.bracketOrderLabel){let t=this.levels.find(t=>t.label===e.bracketOrderLabel);t&&(r=t.data)}let c;return c=e.field===`main`?`MAIN`:e.field===`stopLoss`?e.isRemoval?`REMOVE_SL`:e.isNew?`ADD_SL`:`SL`:e.isRemoval?`REMOVE_TP`:e.isNew?`ADD_TP`:`TP`,{field:c,newPrice:e.newPrice,data:r,...c===`MAIN`&&o!==void 0?{newLots:o}:{},bracketOrderLabel:e.bracketOrderLabel}})}),this.emitter.emit(`tradeLevelConfirmed`,{label:e,type:n.type,isFullscreen:this.isFullscreen}),this.hideLevelConfirmCancel||(this.pendingLevelDrags.delete(e),this.selectedTradeLabel=null,this.draftBracketPnl={}),this.renderTradeLayer()}revertPendingChanges(e){var t;if(e&&e===this.draftOrderLabel){this.removeDraftOrder();return}!e&&this.draftOrderLabel&&this.removeDraftOrder();let n=e?this.pendingLevelDrags.has(e)?[[e,(t=this.pendingLevelDrags.get(e))==null?[]:t]]:[]:[...this.pendingLevelDrags.entries()];for(let[e]of n){if(this.undoIsNewBracketMutations(e),this.pendingLevelDrags.delete(e),this.pendingQtyChanges.has(e)){this.pendingQtyChanges.delete(e);let t=this.levels.findIndex(t=>t.label===e);if(t!==-1&&this.originalQtyByLabel.has(e)){let n=this.originalQtyByLabel.get(e),r=this.levels[t];this.levels=[...this.levels.slice(0,t),{...r,lots:n},...this.levels.slice(t+1)]}this.originalQtyByLabel.delete(e)}let t=this.levels.find(t=>t.label===e);t&&(this._editOpenLabel===e&&(this._editOpenLabel=null),this.emitter.emit(`tradeLevelEditCancelled`,{label:e,type:t.type,isFullscreen:this.isFullscreen}))}this.selectedTradeLabel=null,this.draftBracketPnl={},this.renderTradeLayer()}undoIsNewBracketMutations(e){let t=this.pendingLevelDrags.get(e);if(!t)return;let n=t.some(e=>e.field===`stopLoss`&&e.isNew),r=t.some(e=>e.field===`takeProfit`&&e.isNew);!n&&!r||(this.levels=this.levels.map(t=>{if(t.label!==e)return t;let i={...t};return n&&(i.stopLossPrice=void 0),r&&(i.takeProfitPrice=void 0),i}))}render(){var e,t;let{ctx:n,canvas:r,theme:i,viewport:a}=this,o=window.devicePixelRatio||1,s=r.width,c=r.height,l=s/o-this.priceAxisWidth,u=this.activeIndicators.filter(e=>e.indicator.pane===`sub`),d=u.map(e=>e.indicator).reduce((e,t)=>e+this.paneH(t)+sc,0),f=c/o-this.timeAxisHeight-d;n.clearRect(0,0,s,c),n.fillStyle=i.background,n.fillRect(0,0,s,c);let p=this.dataStore.getVisible(a);if(p.length===0){this.drawCtx.clearRect(0,0,this.drawCanvas.width,this.drawCanvas.height);return}if(this._isPanning)this.viewport={...this._targetViewport};else{let e=this._targetViewport.startIndex-this.viewport.startIndex,t=this._targetViewport.endIndex-this.viewport.endIndex,n=(this._targetViewport.endIndex-this._targetViewport.startIndex)*2e-4;Math.abs(e)<n&&Math.abs(t)<n?this.viewport={...this._targetViewport}:(this.viewport={...this.viewport,startIndex:this.viewport.startIndex+e*dc,endIndex:this.viewport.endIndex+t*dc,candleWidth:this._targetViewport.candleWidth,candleGap:this._targetViewport.candleGap},this.scheduleRender())}if(this.priceScaleFactor!==1||this.pricePanOffset!==0){if(!this._lockedAutoFitBase){var m;this._lockedAutoFitBase=(m=this._displayedPriceRange)==null?this.dataStore.getPriceRange(a):m}let e=this._lockedAutoFitBase,t=(e.min+e.max)/2+this.pricePanOffset,n=e.max===e.min?1:(e.max-e.min)/2;this._displayedPriceRange={min:t-n*this.priceScaleFactor,max:t+n*this.priceScaleFactor}}else{this._lockedAutoFitBase=null;let e=this.getScaledPriceRange(a);if(!this._displayedPriceRange)this._displayedPriceRange=e;else{let t=(e.max-e.min)*1e-4,n=e.min-this._displayedPriceRange.min,r=e.max-this._displayedPriceRange.max;Math.abs(n)<t&&Math.abs(r)<t?this._displayedPriceRange=e:(this._displayedPriceRange={min:this._displayedPriceRange.min+n*uc,max:this._displayedPriceRange.max+r*uc},this.scheduleRender())}}let h=this._displayedPriceRange,g=this.showVolume?this.dataStore.getVolumeRange(a):null,_=r;switch(_._priceRange=h,_._chartWidth=l,n.save(),n.scale(o,o),n.save(),n.beginPath(),n.rect(0,0,l,f),n.clip(),ie(n,h,this.scaleManager,i,l,f),this.series){case`candlestick`:A(n,p,a,h,this.scaleManager,i,l,f);break;case`hollow`:j(n,p,a,h,this.scaleManager,i,l,f);break;case`line`:P(n,p,a,h,this.scaleManager,i,l,f,!1);break;case`area`:P(n,p,a,h,this.scaleManager,i,l,f,!0);break;case`ohlc`:F(n,p,a,h,this.scaleManager,i,l,f);break;case`heikinashi`:ee(n,p,a,h,this.scaleManager,i,l,f);break;case`volumecandles`:R(n,p,a,h,this.scaleManager,i,l,f);break;case`linemarkers`:z(n,p,a,h,this.scaleManager,i,l,f);break;case`step`:B(n,p,a,h,this.scaleManager,i,l,f);break;case`hlcarea`:te(n,p,a,h,this.scaleManager,i,l,f);break;case`baseline`:U(n,p,a,h,this.scaleManager,i,l,f);break;case`columns`:ne(n,p,a,h,this.scaleManager,i,l,f);break;case`highlow`:re(n,p,a,h,this.scaleManager,i,l,f);break}n.save(),n.beginPath(),n.rect(0,0,l,f),n.clip();for(let e of this.indicators.filter(e=>!e.pane||e.pane===`main`)){let t=this.indicatorResults.get(e.name);if(!t)continue;let r=t.slice(Math.floor(a.startIndex),Math.ceil(a.endIndex)+1);e.render(n,r,this.scaleManager,a,f)}n.restore(),n.restore(),jt(n,h,this.scaleManager,i,l,f,this.priceAxisWidth,void 0,this.dataStore.getPricePrecision(),this.uiConfig.priceAxis);let v=this.dataStore.all[this.dataStore.all.length-1];if(v){let e=this.dataStore.getPricePrecision(),t=(t,r,i)=>{let a=this.scaleManager.yToPixel(t,h,f);n.save(),n.strokeStyle=r,n.lineWidth=1,n.setLineDash([3,3]),n.beginPath(),n.moveTo(0,a),n.lineTo(l,a),n.stroke(),n.setLineDash([]);let o=i+t.toFixed(e),s=n.measureText(o).width;n.fillStyle=r,n.fillRect(l,a-16/2,s+12,16),n.fillStyle=`#ffffff`,n.font=`10px 'Inter', system-ui, sans-serif`,n.textAlign=`left`,n.fillText(o,l+4,a+4),n.restore()};if(this.liveBidAsk){let{bid:e,ask:n}=this.liveBidAsk;this.showBidAskLines?(t(e,i.candle.down,``),t(n,i.candle.up,``)):t(this.tickClosePriceSource===`ask`?n:e,this.tickClosePriceSource===`ask`?i.candle.up:i.candle.down,``)}else{let e=v.close>=v.open;t(v.close,e?i.candle.up:i.candle.down,``)}}let y=f;for(let e of u){let t=e.indicator,r=this.paneH(t);if(n.fillStyle=i.axisBorder,n.fillRect(0,y,l+this.priceAxisWidth,sc),y+=sc,n.save(),n.beginPath(),n.rect(0,y,l+this.priceAxisWidth,r),n.clip(),n.translate(0,y),n.fillStyle=i.background,n.fillRect(0,0,l+this.priceAxisWidth,r),e.visible&&(()=>{let t=e.currentParams.timeframe;return!t||t===`Chart`||t===this.timeframe})()){let e=this.indicatorResults.get(t.name);if(e){var b,x;let o=e.slice(Math.floor(a.startIndex),Math.ceil(a.endIndex)+1),s=(b=t.getValueRange)==null?void 0:b.call(t,o),c=(x=this.subPaneScaleFactors.get(t.name))==null?1:x,u=s?hc(s,c):void 0;t.render(n,o,this.scaleManager,a,r,u),u&&jt(n,u,this.scaleManager,i,l,r,this.priceAxisWidth,3,gc(u),this.uiConfig.priceAxis)}}n.restore(),y+=r}if(this.showVolume&&g&&g.max>0){let e=f*ac;I(n,p,a,g.max,this.scaleManager,i,l,e,f-e)}{var S;let e=this.candleCountdownTimeframes===`all`?!0:((S=this.candleCountdownTimeframes)==null?[`1m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`8h`]:S).includes(this.timeframe),t=this.showCandleCountdown&&e&&p.length>0&&a.endIndex>=this.dataStore.length-1,r=t?this.dataStore.length-1:void 0;if(this._debug&&console.log(`[countdown] showCandleCountdown:`,this.showCandleCountdown,`| tf:`,this.timeframe,`| allowed:`,e,`| bars:`,p.length,`| endIndex:`,a.endIndex,`| dataLen:`,this.dataStore.length,`| atLiveEdge:`,a.endIndex>=this.dataStore.length-1),kt(n,p,a,this.scaleManager,i,l,y,fc()?3:void 0,this.uiConfig.timeAxis,this.timeframe,r,this.timezone),t){let e=this.dataStore.all[this.dataStore.length-1],t=this.timeframeToMs(this.timeframe);At(n,e.time,t,this.dataStore.length-1,a,this.scaleManager,i,l,y,this.uiConfig.timeAxis)}}if(this.crosshair&&se(n,this.crosshair,h,a,this.scaleManager,i,l,f,this.priceAxisWidth,y,this.timeframe,this.dataStore.getPricePrecision(),this.uiConfig.crosshair,this.timezone),this.logoImage){let e=f-20-40/2;n.save(),n.globalAlpha=.6,n.beginPath(),n.rect(0,0,l,f),n.clip(),n.beginPath(),n.arc(40,e,40/2,0,Math.PI*2),n.closePath(),n.clip(),n.drawImage(this.logoImage,40-40/2,e-40/2,40,40),n.restore()}n.restore();let C=this.crosshair?(e=this.dataStore.all[this.crosshair.barIndex])==null?null:e:(t=this.dataStore.all[this.dataStore.length-1])==null?null:t;if(this.renderSymbolInfoOHLC(C),this.drawingManager.render(this.drawCtx,this.scaleManager,a,h,l,f,this.dataStore.getPricePrecision()),this.scrollToEndBtn){let e=this.dataStore.length===0||this._targetViewport.endIndex>=this.dataStore.length-.5;e!==!this.scrollToEndVisible&&(this.scrollToEndVisible=!e,this.scrollToEndBtn.style.opacity=e?`0`:`0.85`,this.scrollToEndBtn.style.pointerEvents=e?`none`:`auto`)}if(this.resetViewBtn){let e=this.dataStore.length,t=this._defaultVisibleBars,n=e===0||this._targetViewport.endIndex>=e-.5,r=this._targetViewport.endIndex-this._targetViewport.startIndex,i=Math.abs(r-t)<.5,a=this.priceScaleFactor===1&&this.pricePanOffset===0&&this._lockedAutoFitBase===null,o=e===0||n&&i&&a;o===this.resetViewVisible&&(this.resetViewVisible=!o,this.resetViewBtn.style.opacity=o?`0`:`0.75`,this.resetViewBtn.style.pointerEvents=o?`none`:`auto`)}this.updateSubPaneOverlayPositions()}recomputeIndicators(){for(let e of this.indicators)this.indicatorResults.set(e.name,e.compute(this.dataStore.all))}onResize(){let e=window.devicePixelRatio||1,t=this.canvasWrap.getBoundingClientRect();this._cachedWrapRect=t,this._cachedDrawRect=this.drawCanvas.getBoundingClientRect();for(let n of[this.canvas,this.tradeCanvas,this.drawCanvas])n.width=t.width*e,n.height=t.height*e;let n=this.wrapper.offsetWidth,r=n>0&&n<this.uiConfig.drawingToolbar.mobileBreakpoint;if(r!==this._mobileLayout){var i,a,o;if(this._mobileLayout=r,(i=this.leftBar)==null||i.setMobileMode(r),(a=this.topBar)==null||a.setMobileLayout(r),(o=this.tradeButton)==null||o.setMobileMode(r),this.siEl&&(this.siEl.style.flexDirection=r?`column`:`row`,this.siEl.style.alignItems=r?`flex-start`:`center`,this.siEl.style.gap=r?`2px`:`8px`),r){var s;this.leftBarVisible=!1,(s=this.topBar)==null||s.setDrawingsBtnActive(!1)}else{var c,l;this.leftBarVisible=!0,(c=this.leftBar)==null||c.setVisible(!0),(l=this.topBar)==null||l.setDrawingsBtnActive(!0)}}this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.render(),this.renderTradeLayer()}paneH(e){var t,n;return(t=(n=this.paneHeightOverrides.get(e.name))==null?e.paneHeight:n)==null?oc:t}getChartLayout(){var e;let t=this.activeIndicators.filter(e=>e.indicator.pane===`sub`).map(e=>e.indicator).reduce((e,t)=>e+this.paneH(t)+sc,0),n=(e=this._cachedWrapRect)==null?this.canvasWrap.getBoundingClientRect():e;return{chartW:n.width-this.priceAxisWidth,priceH:n.height-this.timeAxisHeight-t}}updateSubPaneOverlayPositions(){if(this.subPaneOverlays.size===0)return;let e=this.getSeparatorPositions();for(let t of e){let e=this.subPaneOverlays.get(t.indicatorName);e&&(e.el.style.top=`${t.y+sc+6}px`)}}getSeparatorPositions(){let{priceH:e}=this.getChartLayout(),t=this.activeIndicators.filter(e=>e.indicator.pane===`sub`).map(e=>e.indicator),n=[],r=e;for(let e of t)n.push({y:r,indicatorName:e.name}),r+=this.paneH(e)+sc;return n}getScaledPriceRange(e){let t=this.dataStore.getPriceRange(e),n=t.min,r=t.max;for(let t of this.indicators.filter(e=>!e.pane||e.pane===`main`)){let a=this.indicatorResults.get(t.name);if(!a)continue;let o=Math.floor(e.startIndex),s=Math.ceil(e.endIndex)+1;for(let e=o;e<s&&e<a.length;e++){var i;let t=(i=a[e])==null?void 0:i.value;if(t==null)continue;let o=Array.isArray(t)?t.filter(e=>e!==null):[t];for(let e of o)isFinite(e)&&(e<n&&(n=e),e>r&&(r=e))}}let a=(n+r)/2+this.pricePanOffset,o=n===r?1:(r-n)/2;return{min:a-o*this.priceScaleFactor,max:a+o*this.priceScaleFactor}}touchToDrawingPoint(e){var t,n;let r=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,i=e.clientX-r.left,a=e.clientY-r.top,{chartW:o,priceH:s}=this.getChartLayout(),c=(n=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):n;return{barIndex:this.scaleManager.pixelToBarIndex(i,this.viewport,o),price:this.scaleManager.pixelToPrice(a,c,s)}}_handleTradeLevelClose(e){if(e.bracketType){var t,n;let r=this.levels.find(t=>t.label===e.label);if((r==null||(t=r.data)==null?void 0:t._isDraft)===!0&&r){let t=e.bracketType===`stopLoss`?`sl`:`tp`;this.updateDraftOrderBracket(t,null),this.emitter.emit(`tradeLevelEdit`,{label:e.label,type:`pending`,data:r.data,isFullscreen:this.isFullscreen,changes:[{field:e.bracketType===`stopLoss`?`REMOVE_SL`:`REMOVE_TP`,newPrice:0,data:r.data,bracketOrderLabel:void 0}]});return}let i=e.bracketType,a=((n=this.pendingLevelDrags.get(e.label))==null?[]:n).filter(e=>e.field!==i);a.push({field:i,newPrice:0,oldPrice:0,isRemoval:!0,bracketOrderLabel:e.bracketOrderLabel}),this.pendingLevelDrags.set(e.label,a),this.selectedTradeLabel=e.label,this.renderTradeLayer();return}let r=e.label===this.draftOrderLabel,i=this.pendingLevelDrags.get(e.label),a=this._editOpenLabel===e.label,o=!!i&&i.length>0&&i.every(e=>e.isNew),s=!i||i.length===0,c=!r&&a&&(o||s);if(this.revertPendingChanges(e.label),this.pendingLevelDrags.delete(e.label),r)return;if(c){if(s){let t=this.levels.find(t=>t.label===e.label);this._editOpenLabel=null,this.selectedTradeLabel=null,this.renderTradeLayer(),t&&this.emitter.emit(`tradeLevelEditCancelled`,{label:e.label,type:t.type,isFullscreen:this.isFullscreen})}return}this._editOpenLabel===e.label&&(this._editOpenLabel=null);let l=this.levels.find(t=>t.label===e.label),u=(l==null?void 0:l.type)===`position`&&!!l.entryPriceEditable,d=e.type===`position`&&!u?`CLOSED`:`CANCELLED`;this.emitter.emit(`tradeLevelClose`,{label:e.label,type:e.type,action:d,data:e.data,isFullscreen:this.isFullscreen})}_activateMobileCrosshair(e,t){var n,r,i;let a=(n=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():n,{chartW:o,priceH:s}=this.getChartLayout(),c=(r=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):r,l=a.height-this.timeAxisHeight;if(e>=o||t>=l)return;this._mobileCrosshairActive=!0;let u=this.scaleManager.pixelToBarIndex(e,this.viewport,o),d=this.scaleManager.pixelToPrice(t,c,s),f=Math.max(Math.floor(this.viewport.startIndex),Math.min(Math.ceil(this.viewport.endIndex),Math.round(u))),p=(i=this.dataStore.all[f])==null?null:i;this.crosshair=this.selectedTradeLabel===null?{x:e,y:t,barIndex:f,price:d,bar:p}:null,this.tradeButton&&(this.tradeButton.setY(t),this._isTradingActive||xt(t,this.uiConfig.tradeButton.size/2,this.offViewportHitAreas)?this.tradeButton.hide():this.tfcActive&&this.tradeButton.show(),this._tradeButtonClickData={price:d,y:t}),this.scheduleRender()}_startTradeDragFromHit(e,t,n){var r;if(!this.tradeDragHandler)return;let{priceH:i}=this.getChartLayout(),a=(r=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):r,o=this.scaleManager.yToPixel(e.price,a,i);if(e.isBracket){var s,c,l,u;this._pendingBracketOrderLabel=(s=e.bracketOrderLabel)==null?null:s,this._isBracketNew=!1;let r=t.entryPriceEditable===!0,i=((c=t.data)==null?void 0:c._isDraft)===!0,a=this.hideLevelConfirmCancel&&t.type===`pending`&&!i,d=this.dataStore.all,f=r||i||a||(l=(u=d[d.length-1])==null?void 0:u.close)==null?0:l;this.tradeDragHandler.startBracketDrag(t,e.bracketType,e.price,n,o,f,this._effectiveEntryPrice(t.label,t.price)),this.emitter.emit(`tradeLevelDragStart`,{label:t.label,bracketType:e.bracketType,isFullscreen:this.isFullscreen})}else if(this._pendingBracketOrderLabel=null,t.entryPriceEditable===!0){var d,f;this.selectedTradeLabel=e.label;let r=t,i=this.dataStore.all,a=(d=(f=i[i.length-1])==null?void 0:f.close)==null?0:d,s=this._effectiveBracketPrice(t.label,`stopLoss`,r.stopLossPrice),c=this._effectiveBracketPrice(t.label,`takeProfit`,r.takeProfitPrice);this.tradeDragHandler.startDrag(t,n,o,e.price,s,c,r.side,a,r.orderType,!0)}else{var p,m;let r=t,i=this.dataStore.all,a=(p=(m=i[i.length-1])==null?void 0:m.close)==null?0:p,{slPrice:s,tpPrice:c,slSiblingLabel:l,tpSiblingLabel:u}=this._resolveBracketPrices(t);this._slSiblingOrderLabel=l==null?null:l,this._tpSiblingOrderLabel=u==null?null:u;let d=this._effectiveBracketPrice(t.label,`stopLoss`,s),f=this._effectiveBracketPrice(t.label,`takeProfit`,c);this.tradeDragHandler.startDrag(t,n,o,e.price,d,f,r.side,a,r.orderType,!0)}}_startAddBracketFromHit(e,t){var n,r,i;let a=this.levels.find(t=>t.label===e.label);if(!a||!this.tradeDragHandler)return;let{priceH:o}=this.getChartLayout(),s=this.getScaledPriceRange(this.viewport),c=e.y+e.h/2,l=this.scaleManager.pixelToPrice(c,s,o),u=a.entryPriceEditable===!0,d=((n=a.data)==null?void 0:n._isDraft)===!0,f=this.hideLevelConfirmCancel&&a.type===`pending`&&!d,p=this.dataStore.all,m=u||d||f||(r=(i=p[p.length-1])==null?void 0:i.close)==null?0:r;this._pendingBracketOrderLabel=null,this._isBracketNew=!0,this.tradeDragHandler.startBracketDrag(a,e.bracketType,l,t,c,m,this._effectiveEntryPrice(a.label,a.price)),this.emitter.emit(`tradeLevelDragStart`,{label:a.label,bracketType:e.bracketType,isFullscreen:this.isFullscreen})}showTextInput(e){var t;if(!this.textInputEl)return;this.textInputDrawing=e;let{chartW:n,priceH:r}=this.getChartLayout(),i=this.getScaledPriceRange(this.viewport),a,o;if(e.type===`text`)a=this.scaleManager.xToPixel(e.points[0].barIndex,this.viewport,n),o=this.scaleManager.yToPixel(e.points[0].price,i,r);else{var s;let t=(s=e.points[1])==null?e.points[0]:s;a=this.scaleManager.xToPixel(t.barIndex,this.viewport,n)-30,o=this.scaleManager.yToPixel(t.price,i,r)-10}let c=this.textInputEl;c.value=(t=e.text)==null?``:t,c.style.left=`${Math.max(0,a)}px`,c.style.top=`${Math.max(0,o)}px`,c.style.display=`block`,this.drawingManager.setEditingText(!0),c.focus(),c.select();let l=()=>{c.removeEventListener(`keydown`,d),c.removeEventListener(`blur`,f),this.commitTextInput()},u=()=>{c.removeEventListener(`keydown`,d),c.removeEventListener(`blur`,f),this.cancelTextInput()},d=e=>{e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),u())},f=()=>l();c.addEventListener(`keydown`,d),c.addEventListener(`blur`,f,{once:!0})}commitTextInput(){var e,t;!this.textInputEl||!this.textInputDrawing||(this.textInputDrawing.text=this.textInputEl.value,this.textInputEl.style.display=`none`,this.textInputDrawing=null,this.drawingManager.setEditingText(!1),(e=(t=this.drawingManager).onDrawingsChange)==null||e.call(t),this.scheduleRender())}cancelTextInput(){this.textInputEl&&(this.textInputEl.style.display=`none`,this.textInputDrawing=null,this.drawingManager.setEditingText(!1),this.scheduleRender())}setDotTickActive(){this.siStreamDot&&(this.tickActivityTimer!==null&&clearTimeout(this.tickActivityTimer),this.siStreamDot.style.background=this.theme.candle.up,this.tickActivityTimer=setTimeout(()=>{this.tickActivityTimer=null,this.siStreamDot&&(this.siStreamDot.style.background=this.theme.ui.stream[this.streamStatus])},this.tickActivityMs))}fillTickGap(e,t){if(!this.dataLoader||this.isFetching)return;let n=this.timeframeToInterval(this.getBaseInterval());this.dataLoader({start:new Date(e),end:new Date(t),interval:n}).then(e=>{let t=this.maybeAggregate(e);if(t.length===0)return;let n=this.dataStore.all,r=n[n.length-1],i=0;for(let e of t){if(e.time>=r.time)continue;let t=n.findIndex(t=>t.time===e.time);if(t!==-1)n[t]=e;else{let t=n.findIndex(t=>t.time>e.time);n.splice(t===-1?n.length-1:t,0,e),i++}}i>0&&(this.viewport={...this.viewport,startIndex:this.viewport.startIndex+i,endIndex:this.viewport.endIndex+i},this.recomputeIndicators(),this.scheduleRender())}).catch(()=>{})}correctCompletedBar(e,t){if(!this.dataLoader||this.isFetching)return;let n=new Date(e),r=new Date(e+t*3),i=this.timeframeToInterval(this.getBaseInterval());this.dataLoader({start:n,end:r,interval:i}).then(e=>{let t=this.maybeAggregate(e);if(t.length===0)return;let n=this.dataStore.all,r=n.length-1,i=!1;for(let e of t){let t=n.findIndex(t=>t.time===e.time);t!==-1&&t!==r&&(n[t]=e,i=!0)}i&&(this.recomputeIndicators(),this.scheduleRender())}).catch(()=>{})}setDebug(e){return this._debug=e,this}correctBar(e,t){let n=this.dataStore.all,r=n.findIndex(t=>t.time===e);r!==-1&&(n[r]=t,this.recomputeIndicators(),this.scheduleRender())}scrollToEnd(){this.panHandler.cancel(),this.scrollAnimId!==null&&(cancelAnimationFrame(this.scrollAnimId),this.scrollAnimId=null);let e=this.viewport.endIndex-this.viewport.startIndex,t=this.dataStore.length+mc,n=this.viewport.endIndex,r=this.pricePanOffset,i=performance.now(),a=e=>e<.5?2*e*e:-1+(4-2*e)*e,o=s=>{let c=Math.min((s-i)/350,1),l=a(c),u=n+(t-n)*l;this.viewport={...this.viewport,startIndex:u-e,endIndex:u},this._targetViewport={...this.viewport},this.pricePanOffset=r*(1-l),this.render(),c<1?this.scrollAnimId=requestAnimationFrame(o):this.scrollAnimId=null};this.scrollAnimId=requestAnimationFrame(o)}scrollToCenterPrice(e){if(!isFinite(e)||this.dataStore.length===0)return;this.scrollAnimId!==null&&(cancelAnimationFrame(this.scrollAnimId),this.scrollAnimId=null);let t=this.dataStore.getPriceRange(this.viewport),n=(t.min+t.max)/2,r=this.pricePanOffset,i=e-n;if(Math.abs(i-r)<1e-9)return;let a=performance.now(),o=e=>e<.5?2*e*e:-1+(4-2*e)*e,s=e=>{let t=Math.min((e-a)/350,1),n=o(t);this.pricePanOffset=r+(i-r)*n,this.render(),t<1?this.scrollAnimId=requestAnimationFrame(s):this.scrollAnimId=null};this.scrollAnimId=requestAnimationFrame(s)}resetPriceAxis(){this.priceScaleFactor=1,this.pricePanOffset=0,this._lockedAutoFitBase=null,this.scheduleRender()}resetTimeAxis(){this.panHandler.cancel();let e=this.dataStore.length;if(e===0)return;let t=pc(this.mobileBarDivisor,this.explicitMobileDivisor,this.defaultVisibleBars,this.defaultMobileVisibleBars);this._defaultVisibleBars=t;let n=Math.max(0,e-t+mc);this.viewport={...this.viewport,startIndex:n,endIndex:e+mc},this._targetViewport={...this.viewport},this.scheduleRender()}resetView(){this.resetPriceAxis(),this.resetTimeAxis()}applyResetViewBtnStyles(){this.resetViewBtn&&(this.resetViewBtn.innerHTML=Yt(this.theme.axisText,16),Object.assign(this.resetViewBtn.style,{position:`absolute`,bottom:`${this.timeAxisHeight+8}px`,left:`50%`,transform:`translateX(-50%)`,zIndex:`100`,width:`32px`,height:`32px`,padding:`0`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:this.theme.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`50%`,cursor:`pointer`,outline:`none`,boxShadow:`0 2px 6px rgba(0,0,0,0.25)`,opacity:`0`,pointerEvents:`none`,transition:`opacity 0.2s ease`}))}applyScrollToEndBtnStyles(){this.scrollToEndBtn&&(this.scrollToEndBtn.innerHTML=Jt(this.theme.axisText,16),Object.assign(this.scrollToEndBtn.style,{position:`absolute`,bottom:`${this.timeAxisHeight+8}px`,right:`${this.priceAxisWidth+8}px`,zIndex:`100`,width:`32px`,height:`32px`,padding:`0`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:this.theme.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`50%`,cursor:`pointer`,outline:`none`,boxShadow:`0 2px 6px rgba(0,0,0,0.25)`,opacity:`0`,pointerEvents:`none`,transition:`opacity 0.2s ease`}))}};Qs=_c,Qs.DRAW_GESTURE_THRESHOLD=4;var Q=null,vc=new Map,yc=0;function bc(){return`dr_${Date.now()}_${yc++}`}function $(e,t){var n;let r=JSON.stringify({type:e,payload:t});window.ChartAndroidBridge?window.ChartAndroidBridge.postMessage(r):!((n=window.webkit)==null||(n=n.messageHandlers)==null)&&n.chartBridge?window.webkit.messageHandlers.chartBridge.postMessage(r):window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(r)}function xc(e={}){var t;Q==null||Q.destroy();let n=document.getElementById(`chart`),{enableTrading:r,onSymbolClick:i,...a}=e,o=(t=a.timeframe)==null?`1D`:t;Q=new _c({theme:`dark`,...a,container:n,dataLoader:e=>{for(let[,e]of vc)e.reject(Error(`cancelled`));vc.clear();let t=bc(),n=Q==null?void 0:Q.getState();return new Promise((r,i)=>{var a;vc.set(t,{resolve:r,reject:i}),$(`dataRequest`,{requestId:t,timeframe:(a=n==null?void 0:n.timeframe)==null?o:a,interval:e.interval,start:e.start.getTime(),end:e.end.getTime()})})},...r?{onOrderSubmit:e=>{var t;$(`placeOrder`,{price:e.price,side:e.side,orderType:(t=e.orderType)==null?`limit`:t})}}:{},...i?{onSymbolClick:e=>{$(`symbolClick`,{symbol:e})}}:{}}),Q.on(`timeframeChange`,({timeframe:e})=>{o=e}),Q.on(`crosshair`,e=>$(`crosshair`,e)),Q.on(`click`,e=>$(`barClick`,e)),Q.on(`zoom`,({viewport:e})=>$(`viewportChange`,{viewport:e})),Q.on(`pan`,({viewport:e})=>$(`viewportChange`,{viewport:e})),Q.on(`seriesChange`,e=>$(`seriesChange`,e)),Q.on(`timeframeChange`,e=>$(`timeframeChange`,e)),Q.on(`durationChange`,e=>$(`durationChange`,e)),Q.on(`stateChange`,e=>$(`stateChange`,e)),Q.on(`dataLoaded`,e=>$(`dataLoaded`,e)),Q.on(`newBar`,e=>$(`newBar`,e)),Q.on(`streamStatus`,e=>$(`streamStatus`,e)),Q.on(`tradeLevelClose`,e=>$(`tradeLevelClose`,e)),Q.on(`tradeLevelDrag`,e=>$(`tradeLevelDrag`,e)),Q.on(`tradeLevelDragStart`,e=>$(`tradeLevelDragStart`,e)),Q.on(`tradeLevelEdit`,e=>$(`tradeLevelEdit`,e)),Q.on(`tradeLevelQtyChange`,e=>$(`tradeLevelQtyChange`,e)),Q.on(`tradeLevelConfirmed`,e=>$(`tradeLevelConfirmed`,e)),Q.on(`tradeLevelEditOpen`,e=>$(`tradeLevelEditOpen`,e)),Q.on(`tradeLevelBracketActivated`,e=>$(`tradeLevelBracketActivated`,e)),Q.on(`draftInitiated`,e=>$(`draftInitiated`,e)),Q.on(`draftCancelled`,e=>$(`draftCancelled`,e)),Q.on(`uiStateChange`,e=>$(`uiStateChange`,e))}function Sc(e){if(e.type===`init`){xc(e.payload);return}if(!Q){$(`error`,{message:`Engine not initialized. Send an "init" command first.`});return}switch(e.type){case`loadData`:Q.loadData(e.payload.bars,e.payload.fitAll);break;case`pushTick`:Q.pushTick(e.payload);break;case`setTheme`:Q.setTheme(e.payload.theme);break;case`setTimezone`:Q.setTimezone(e.payload.timezone);break;case`setSeries`:Q.setSeries(e.payload.series);break;case`setTimeframe`:Q.setTimeframe(e.payload.timeframe);break;case`setSymbol`:Q.setSymbol(e.payload.symbol);break;case`addIndicator`:Q.addIndicatorByName(e.payload.shortName);break;case`removeIndicator`:Q.removeIndicator(e.payload.name);break;case`setDrawingTool`:Q.setDrawingTool(e.payload.tool);break;case`clearAllDrawings`:Q.clearAllDrawings();break;case`getState`:$(`stateSnapshot`,Q.getState());break;case`setState`:Q.setState(e.payload);break;case`resolveDataRequest`:{let t=vc.get(e.payload.requestId);t&&(vc.delete(e.payload.requestId),t.resolve(e.payload.bars));break}case`setDebug`:Q.setDebug(e.payload.enabled);break;case`destroy`:Q.destroy(),Q=null;break;case`setLevels`:Q.setLevels(e.payload.levels,e.payload.labelKey,e.payload.priceKey,e.payload.type,e.payload.pnlKey,e.payload.pnlTextKey);break;case`removeLevelByLabel`:Q.removeLevelByLabel(e.payload.label);break;case`updateLevelMainPrice`:Q.updateLevelMainPrice(e.payload.label,e.payload.price);break;case`updateLevelBracket`:Q.updateLevelBracket(e.payload.label,e.payload.bracketType.toLowerCase(),e.payload.price);break;case`addLevelBracket`:Q.addLevelBracket(e.payload.label,e.payload.bracketType.toLowerCase());break;case`addBracket`:Q.addBracket(e.payload.bracketType.toLowerCase(),e.payload.label);break;case`removeBracket`:Q.removeBracket(e.payload.bracketType.toLowerCase(),e.payload.label);break;case`cancelLevelEdit`:Q.cancelLevelEdit(e.payload.label);break;case`selectLevel`:Q.selectLevel(e.payload.label);break;case`showDraftOrder`:Q.showDraftOrder(e.payload.price,e.payload.side,e.payload.orderType);break;case`showMarketDraft`:Q.showMarketDraft(e.payload.price,e.payload.side);break;case`clearDraftOrder`:Q.clearDraftOrder();break;case`cancelCurrentEdit`:Q.cancelCurrentEdit();break;case`updateDraftOrderPrice`:Q.updateDraftOrderPrice(e.payload.price);break;case`updateDraftOrderBracket`:Q.updateDraftOrderBracket(e.payload.bracketType,e.payload.price);break;case`setDraftBracketPnl`:Q.setDraftBracketPnl(e.payload.bracketType,e.payload.pnlText);break;case`setVolume`:Q.setVolume(e.payload.show);break;case`setIsins`:Q.setIsins(e.payload.isins);break;case`resetView`:Q.resetView();break;case`resetData`:Q.resetData();break;case`setLoading`:Q.setLoading(e.payload.loading);break;case`setThemeOverrides`:Q.setThemeOverrides(e.payload.overrides);break;case`correctBar`:Q.correctBar(e.payload.barTime,e.payload.bar);break;case`dismissAllUI`:Q.dismissAllUI();break}}document.addEventListener(`DOMContentLoaded`,()=>{window.ChartBridge={send(e){let t;try{t=JSON.parse(e)}catch(t){$(`error`,{message:`Invalid JSON: ${e}`});return}try{Sc(t)}catch(e){$(`error`,{message:String(e)})}}},$(`ready`,{})})})();</script>
|
|
236
|
+
`,document.head.appendChild(e)}var pn=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,h,g,_,v,y=m,b=C.topBar,x=null){this.onSeriesChange=e,this.onTimeframeChange=t,this.onAddIndicator=n,this.onDurationChange=r,this.onSettingsClick=i,this.onFullscreenToggle=a,this.onDrawingToolsToggle=o,this.onTfcToggle=f,this.onDropdownChange=x,this.fullscreenBtn=null,this.settingsBtn=null,this.isFullscreen=!1,this.durationBtns=new Map,this.isMobileLayout=!1,this.drawingBtn=null,this.tfcBtn=null,this.tfcActive=!0,this.openDropdown=null,this.disposeFlyoutKbd=()=>{},this.indicatorOptions=[],this.activeIndicators=new Set,this.volHasData=!0,this.theme=v,this.cfg=y,this.labels=b,this.tfcActive=d,this.currentSeries=p,this.currentTf=h,this.activeDuration=g,this.durationMap=_,fn(),this.el=document.createElement(`div`),this.applyBarStyles(v),this.flyout=document.createElement(`div`),this.flyout.classList.add(`finchart-flyout`),this.applyFlyoutStyles(),document.body.appendChild(this.flyout),this.disposeFlyoutKbd=ln(this.flyout),this.leftGroup=document.createElement(`div`),Object.assign(this.leftGroup.style,{display:`flex`,alignItems:`center`,gap:`4px`,flex:`1`,minWidth:`0`,overflow:`hidden`}),s&&(this.drawingBtn=this.makeDrawingBtn(v),this.leftGroup.appendChild(this.drawingBtn)),this.seriesBtn=this.makeSeriesBtn(p,v),this.seriesBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleDropdown(`series`,this.seriesBtn)}),this.addBtnHover(this.seriesBtn),this.tfBtn=this.makeDropBtn(h,v,!1),this.tfBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleDropdown(`timeframe`,this.tfBtn)}),this.addBtnHover(this.tfBtn),this.indBtn=this.makeDropBtn(this.labels.indicatorsBtn,v,!1),this.indBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleDropdown(`indicators`,this.indBtn)}),this.addBtnHover(this.indBtn),this.leftGroup.append(this.seriesBtn,this.tfBtn,this.indBtn),this.rightGroup=document.createElement(`div`),Object.assign(this.rightGroup.style,{display:`flex`,alignItems:`center`,gap:`2px`,flexShrink:`0`}),this.durationDropBtn=this.makeDropBtn(g==null?un[0]:g,v,!1),this.durationDropBtn.style.display=`none`,this.durationSep=document.createElement(`div`),this.durationSep.style.display=`none`,l&&(this.fullscreenBtn=document.createElement(`button`),this.fullscreenBtn.title=this.labels.toggleFullscreenTitle,this.fullscreenBtn.innerHTML=Lt,this.applyIconBtnStyles(this.fullscreenBtn,v,!1),this.fullscreenBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.onFullscreenToggle()}),this.addBtnHover(this.fullscreenBtn),this.rightGroup.appendChild(this.fullscreenBtn)),c&&(this.settingsBtn=document.createElement(`button`),this.settingsBtn.title=this.labels.settingsTitle,this.settingsBtn.innerHTML=Nt,this.applyIconBtnStyles(this.settingsBtn,v,!1),this.settingsBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.onSettingsClick()}),this.addBtnHover(this.settingsBtn),this.rightGroup.appendChild(this.settingsBtn)),u&&(this.tfcBtn=document.createElement(`button`),this.tfcBtn.title=this.labels.tfcToggleTitle,this.tfcBtn.innerHTML=this.tfcActive?qt:Jt,this.applyIconBtnStyles(this.tfcBtn,v,this.tfcActive),this.tfcBtn.addEventListener(`click`,e=>{var t;e.stopPropagation(),this.tfcActive=!this.tfcActive,this.tfcBtn.innerHTML=this.tfcActive?qt:Jt,this.applyIconBtnStyles(this.tfcBtn,this.theme,this.tfcActive),(t=this.onTfcToggle)==null||t.call(this,this.tfcActive)}),this.addBtnHover(this.tfcBtn),this.rightGroup.appendChild(this.tfcBtn)),this.el.append(this.leftGroup,this.rightGroup),this.docClickHandler=e=>{!this.el.contains(e.target)&&!this.flyout.contains(e.target)&&this.closeDropdown()},document.addEventListener(`click`,this.docClickHandler,!0)}destroy(){this.disposeFlyoutKbd(),this.flyout.remove(),document.removeEventListener(`click`,this.docClickHandler,!0)}reparentFlyout(e){this.flyout.parentElement!==e&&e.appendChild(this.flyout)}setFullscreen(e){this.isFullscreen=e,this.fullscreenBtn&&(this.fullscreenBtn.innerHTML=e?Rt:Lt,this.fullscreenBtn.title=e?this.labels.exitFullscreenTitle:this.labels.toggleFullscreenTitle,this.applyIconBtnStyles(this.fullscreenBtn,this.theme,e),this.isMobileLayout&&this.resizeSvg(this.fullscreenBtn,this.getSvgSize(this.fullscreenBtn)+2))}setDrawingsBtnActive(e){this.drawingBtn&&this.applyIconBtnStyles(this.drawingBtn,this.theme,e)}setTfcActive(e){this.tfcBtn&&(this.tfcActive=e,this.tfcBtn.innerHTML=e?qt:Jt,this.applyIconBtnStyles(this.tfcBtn,this.theme,e),this.isMobileLayout&&this.resizeSvg(this.tfcBtn,this.getSvgSize(this.tfcBtn)+2))}setTheme(e){this.theme=e,this.closeDropdown(),this.applyBarStyles(e),this.applyFlyoutStyles(),this.drawingBtn&&this.applyIconBtnStyles(this.drawingBtn,e,!1),this.fullscreenBtn&&this.applyIconBtnStyles(this.fullscreenBtn,e,this.isFullscreen),this.settingsBtn&&this.applyIconBtnStyles(this.settingsBtn,e,!1),this.tfcBtn&&this.applyIconBtnStyles(this.tfcBtn,e,this.tfcActive),this.applySeriesBtnStyles(this.seriesBtn,e,!1),this.applyDropBtnStyles(this.tfBtn,e,!1),this.applyDropBtnStyles(this.indBtn,e,!1);for(let[t,n]of this.durationBtns)this.applyDurationBtnStyles(n,e,t===this.activeDuration);this.durationSep.style.background=e.axisBorder,this.applyDropBtnStyles(this.durationDropBtn,e,!1)}setSeries(e){this.currentSeries=e,this.updateSeriesBtnContent(this.seriesBtn,e)}setTimeframe(e){this.currentTf=e,this.tfBtn.textContent=e}setActiveDuration(e){if(this.activeDuration!==(e==null?null:e)){if(this.activeDuration){let e=this.durationBtns.get(this.activeDuration);e&&this.applyDurationBtnStyles(e,this.theme,!1)}if(this.activeDuration=e==null?null:e,e){let t=this.durationBtns.get(e);t&&this.applyDurationBtnStyles(t,this.theme,!0),this.durationDropBtn.textContent=e}}}setMobileLayout(e){if(this.isMobileLayout===e)return;this.isMobileLayout=e;let t=e?`none`:``;for(let e of this.durationBtns.values())e.style.display=t;this.durationSep.style.display=t,this.durationDropBtn.style.display=e?``:`none`;let n=e?this.cfg.mobileIconBtnSize:this.cfg.iconBtnSize;for(let e of[this.fullscreenBtn,this.settingsBtn,this.drawingBtn,this.tfcBtn])e&&(e.style.width=n,e.style.height=n);let r=e?2:-2;if(this.fullscreenBtn&&this.resizeSvg(this.fullscreenBtn,this.getSvgSize(this.fullscreenBtn)+r),this.settingsBtn&&this.resizeSvg(this.settingsBtn,this.getSvgSize(this.settingsBtn)+r),this.tfcBtn&&this.resizeSvg(this.tfcBtn,this.getSvgSize(this.tfcBtn)+r),this.drawingBtn){let t=parseInt(e?this.cfg.mobileDrawBtnIconSize:this.cfg.drawBtnIconFontSize,10);this.resizeSvg(this.drawingBtn,t)}}setIndicatorOptions(e){this.indicatorOptions=e}setIndicatorOptionActive(e,t){t?this.activeIndicators.add(e):this.activeIndicators.delete(e),this.updateIndBtnLabel()}setVolumeControl(e,t){this.volHasData=t,t&&e?this.activeIndicators.add(`VOL`):this.activeIndicators.delete(`VOL`),this.updateIndBtnLabel()}makeDrawingBtn(e){let t=document.createElement(`button`);return t.title=`Drawing Tools`,t.innerHTML=Ft,this.applyIconBtnStyles(t,e,!1),t.addEventListener(`click`,e=>{var t;e.stopPropagation(),(t=this.onDrawingToolsToggle)==null||t.call(this)}),this.addBtnHover(t),t}makeSeriesBtn(e,t){let n=document.createElement(`button`);return this.applySeriesBtnStyles(n,t,!1),this.updateSeriesBtnContent(n,e),n}updateSeriesBtnContent(e,t){var n;e.title=(n=this.labels.series[t])==null?t:n,e.innerHTML=Bt[t]}applySeriesBtnStyles(e,t,n){e.dataset.active=String(n),Object.assign(e.style,{background:n?t.ui.accentBg:`transparent`,color:n?t.ui.accentText:t.topBar.btnColor,border:`1px solid ${n?t.ui.accent:t.axisBorder}`,borderRadius:`5px`,padding:`3px 7px`,cursor:`pointer`,outline:`none`,display:`flex`,alignItems:`center`,gap:`4px`,flexShrink:`0`,height:`24px`,transition:`border-color 0.12s, background 0.12s`})}applyFlyoutStyles(){Object.assign(this.flyout.style,{position:`fixed`,zIndex:`9999`,display:`none`,background:this.theme.tooltip.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`8px`,padding:`4px 0`,minWidth:`168px`,maxHeight:`340px`,overflowY:`auto`,overflowX:`hidden`,boxShadow:`0 8px 24px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.3)`,fontFamily:this.cfg.flyoutRowFontFamily,fontSize:this.cfg.flyoutRowFontSize,scrollbarWidth:`thin`,scrollbarColor:`rgba(120,130,150,0.35) transparent`})}toggleDropdown(e,t){var n;if(this.openDropdown===e){this.closeDropdown();return}let r=this.openDropdown!==null;this.openDropdown=e,this.applySeriesBtnStyles(this.seriesBtn,this.theme,e===`series`),this.applyDropBtnStyles(this.tfBtn,this.theme,e===`timeframe`),this.applyDropBtnStyles(this.indBtn,this.theme,e===`indicators`),this.applyDropBtnStyles(this.durationDropBtn,this.theme,e===`duration`),this.buildDropdownContent(e);let i=t.getBoundingClientRect();Object.assign(this.flyout.style,{display:`block`,left:`${i.left}px`,top:`${i.bottom+6}px`}),requestAnimationFrame(()=>{let e=this.flyout.getBoundingClientRect();e.right>window.innerWidth-8&&(this.flyout.style.left=`${window.innerWidth-e.width-8}px`),e.bottom>window.innerHeight-8&&(this.flyout.style.top=`${i.top-e.height-6}px`)}),r||(n=this.onDropdownChange)==null||n.call(this)}buildDropdownContent(e){if(this.flyout.innerHTML=``,this.flyout.style.minWidth=e===`series`?`152px`:e===`timeframe`?`160px`:e===`duration`?`120px`:`180px`,e===`series`){let e=[{value:`candlestick`,label:this.labels.series.candlestick},{value:`hollow`,label:this.labels.series.hollow},{value:`ohlc`,label:this.labels.series.ohlc},{value:`line`,label:this.labels.series.line},{value:`area`,label:this.labels.series.area},{value:`heikinashi`,label:this.labels.series.heikinashi},{value:`volumecandles`,label:this.labels.series.volumecandles},{value:`linemarkers`,label:this.labels.series.linemarkers},{value:`step`,label:this.labels.series.step},{value:`hlcarea`,label:this.labels.series.hlcarea},{value:`baseline`,label:this.labels.series.baseline},{value:`columns`,label:this.labels.series.columns},{value:`highlow`,label:this.labels.series.highlow}];for(let t of e){let e=this.makeRow(t.label,t.value===this.currentSeries,!1,Bt[t.value]);e.addEventListener(`click`,()=>{this.currentSeries=t.value,this.updateSeriesBtnContent(this.seriesBtn,t.value),this.onSeriesChange(t.value),this.closeDropdown()}),this.flyout.appendChild(e)}}else if(e===`timeframe`){let e=[`1m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`8h`],r=[`1D`,`1W`,`1M`];this.flyout.appendChild(this.makeCategoryHeader(`Intraday`));for(let n of e){var t;let e=(t=this.labels.timeframes[n])==null?n:t,r=this.makeRow(e,n===this.currentTf,!1);r.addEventListener(`click`,()=>{this.currentTf=n,this.tfBtn.textContent=e,this.onTimeframeChange(n),this.closeDropdown()}),this.flyout.appendChild(r)}this.flyout.appendChild(this.makeCategoryHeader(`Daily +`));for(let e of r){var n;let t=(n=this.labels.timeframes[e])==null?e:n,r=this.makeRow(t,e===this.currentTf,!1);r.addEventListener(`click`,()=>{this.currentTf=e,this.tfBtn.textContent=t,this.onTimeframeChange(e),this.closeDropdown()}),this.flyout.appendChild(r)}}else if(e===`duration`)for(let e of un){let t=this.makeRow(e,e===this.activeDuration,!1);t.addEventListener(`click`,()=>{this.setActiveDuration(e),this.onDurationChange(e,this.durationMap[e]),this.closeDropdown()}),this.flyout.appendChild(t)}else{let e=document.createElement(`div`);Object.assign(e.style,{position:`sticky`,top:`0`,zIndex:`1`,padding:`6px 8px`,background:this.theme.tooltip.background,borderBottom:`1px solid ${this.theme.axisBorder}`});let t=document.createElement(`input`);t.type=`text`,t.placeholder=`Search indicators…`,Object.assign(t.style,{width:`100%`,boxSizing:`border-box`,padding:`5px 8px`,background:this.theme.background,color:this.theme.tooltip.text,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`4px`,fontSize:`16px`,outline:`none`}),e.appendChild(t),this.flyout.appendChild(e);let n=document.createElement(`div`);this.flyout.appendChild(n);let i=new Map;for(let e of this.indicatorOptions){var r;let t=(r=e.category)==null?``:r;i.has(t)||i.set(t,[]),i.get(t).push(e)}let a=e=>{n.innerHTML=``;let r=e.trim().toLowerCase();if(r)for(let e of this.indicatorOptions){if(!e.label.toLowerCase().includes(r)&&!e.value.toLowerCase().includes(r))continue;let i=this.activeIndicators.has(e.value),o=dn.has(e.value)&&!this.volHasData,s=this.makeRow(e.label,i,o);o||s.addEventListener(`click`,()=>{this.onAddIndicator(e.value),a(t.value)}),n.appendChild(s)}else for(let[e,r]of i){e&&n.appendChild(this.makeCategoryHeader(e));for(let e of r){let r=this.activeIndicators.has(e.value),i=dn.has(e.value)&&!this.volHasData,o=this.makeRow(e.label,r,i);i||o.addEventListener(`click`,()=>{this.onAddIndicator(e.value),a(t.value)}),n.appendChild(o)}}};a(``),t.addEventListener(`input`,()=>a(t.value)),requestAnimationFrame(()=>t.focus({preventScroll:!0}))}}makeCategoryHeader(e){let t=document.createElement(`div`);return Object.assign(t.style,{padding:`6px 12px 4px`,fontSize:this.cfg.flyoutCategoryFontSize,fontWeight:`600`,letterSpacing:this.cfg.flyoutCategoryLetterSpacing,color:this.theme.topBar.flyoutCategoryColor,textTransform:`uppercase`,opacity:`0.55`,marginTop:`2px`}),t.textContent=e,t}makeRow(e,t,n,r){let i=document.createElement(`button`),a=this.theme.ui.accentBg,o=this.theme.ui.accentBg;if(Object.assign(i.style,{width:`100%`,padding:`7px 12px`,background:t?o:`transparent`,border:`none`,borderLeft:t?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,color:n?this.theme.ui.disabledText:t?this.theme.ui.accentText:this.theme.topBar.flyoutRowColor,fontSize:this.cfg.flyoutRowFontSize,fontFamily:this.cfg.flyoutRowFontFamily,textAlign:`left`,cursor:n?`not-allowed`:`pointer`,display:`flex`,alignItems:`center`,gap:`8px`,boxSizing:`border-box`,opacity:n?`0.45`:`1`,transition:`background 0.1s`}),!n&&!t&&(i.addEventListener(`mouseenter`,()=>{i.style.background=a}),i.addEventListener(`mouseleave`,()=>{i.style.background=`transparent`})),r){let e=document.createElement(`span`);Object.assign(e.style,{display:`flex`,alignItems:`center`,flexShrink:`0`,opacity:t?`1`:`0.7`}),e.innerHTML=r;let n=e.querySelector(`svg`);n&&(n.setAttribute(`width`,`13`),n.setAttribute(`height`,`13`)),i.appendChild(e)}let s=document.createElement(`span`);if(s.style.flex=`1`,s.textContent=e,i.appendChild(s),t){let e=document.createElement(`span`);Object.assign(e.style,{color:this.theme.ui.accent,fontSize:this.cfg.flyoutCheckFontSize,flexShrink:`0`}),e.innerHTML=en,i.appendChild(e)}return i}closeDropdown(){var e;let t=this.openDropdown!==null;this.flyout.style.display=`none`,this.openDropdown=null,this.applySeriesBtnStyles(this.seriesBtn,this.theme,!1),this.applyDropBtnStyles(this.tfBtn,this.theme,!1),this.applyDropBtnStyles(this.indBtn,this.theme,!1),this.applyDropBtnStyles(this.durationDropBtn,this.theme,!1),t&&((e=this.onDropdownChange)==null||e.call(this))}get hasOpenDropdown(){return this.openDropdown!==null}updateIndBtnLabel(){let e=this.activeIndicators.size;this.indBtn.textContent=e>0?this.labels.indicatorsBtnActive.replace(`{count}`,String(e)):this.labels.indicatorsBtn}addBtnHover(e){e.addEventListener(`mouseenter`,()=>{e.dataset.active!==`true`&&(e.style.background=this.theme.ui.accentBg)}),e.addEventListener(`mouseleave`,()=>{e.dataset.active!==`true`&&(e.style.background=`transparent`)})}applyBarStyles(e){Object.assign(this.el.style,{display:`flex`,alignItems:`center`,gap:`8px`,height:this.cfg.height,padding:`0 10px`,background:e.background,borderBottom:`1px solid ${e.axisBorder}`,boxSizing:`border-box`,flexShrink:`0`})}makeDropBtn(e,t,n){let r=document.createElement(`button`);return r.textContent=e,this.applyDropBtnStyles(r,t,n),r}applyDropBtnStyles(e,t,n){e.dataset.active=String(n),Object.assign(e.style,{background:n?t.ui.accentBg:`transparent`,color:n?t.ui.accentText:t.topBar.btnColor,border:`1px solid ${n?t.ui.accent:t.axisBorder}`,borderRadius:`5px`,padding:`3px 8px`,height:`24px`,fontSize:this.cfg.dropBtnFontSize,fontFamily:this.cfg.dropBtnFontFamily,cursor:`pointer`,outline:`none`,whiteSpace:`nowrap`,transition:`border-color 0.12s, background 0.12s`})}applyDurationBtnStyles(e,t,n){e.dataset.active=String(n),Object.assign(e.style,{background:n?t.bottomBar.activeBtnBg:`transparent`,color:n?t.bottomBar.activeBtnText:t.bottomBar.btnColor,border:`1px solid ${n?t.bottomBar.activeBtnBorder:`transparent`}`,borderRadius:`4px`,padding:`2px 7px`,fontSize:this.cfg.dropBtnFontSize,fontFamily:this.cfg.dropBtnFontFamily,cursor:`pointer`,outline:`none`,transition:`background 0.15s, color 0.15s`,whiteSpace:`nowrap`})}applyIconBtnStyles(e,t,n){e.dataset.active=String(n);let r=this.isMobileLayout?this.cfg.mobileIconBtnSize:this.cfg.iconBtnSize;Object.assign(e.style,{background:n?t.ui.accentBg:`transparent`,color:n?t.ui.accentText:t.topBar.btnColor,border:`1px solid ${n?t.ui.accent:t.axisBorder}`,borderRadius:`5px`,width:r,height:r,cursor:`pointer`,outline:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0`,flexShrink:`0`,transition:`border-color 0.12s, background 0.12s`})}resizeSvg(e,t){if(!e)return;let n=e.querySelector(`svg`);n&&(n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)))}getSvgSize(e){var t;if(!e)return 0;let n=e.querySelector(`svg`);return n?parseInt((t=n.getAttribute(`width`))==null?`0`:t,10):0}},mn={"1D":`5m`,"5D":`15m`,"1M":`30m`,"3M":`30m`,"6M":`1D`,"1Y":`1D`,"5Y":`1W`,All:`1M`},hn=[`1D`,`5D`,`1M`,`3M`,`6M`,`1Y`,`5Y`,`All`],gn=class{constructor(e,t,n,r,i=h,a=C.bottomBar){this.onDurationChange=e,this.buttons=new Map,this.activeDuration=t,this.theme=n,this.cfg=i,this.labels=a,this.map={...mn,...r},this.el=document.createElement(`div`),this.applyBarStyles(n);for(let e of hn){var o;let r=document.createElement(`button`);r.textContent=(o=this.labels.durations[e])==null?e:o,this.applyButtonStyles(r,n,e===t),r.addEventListener(`click`,()=>{this.setActive(e),this.onDurationChange(e,this.map[e])}),this.buttons.set(e,r),this.el.appendChild(r)}}setTheme(e){this.theme=e,this.applyBarStyles(e);for(let[t,n]of this.buttons)this.applyButtonStyles(n,e,this.activeDuration!==null&&t===this.activeDuration)}setActive(e){if(this.activeDuration!==(e==null?null:e)){if(this.activeDuration){let e=this.buttons.get(this.activeDuration);e&&this.applyButtonStyles(e,this.theme,!1)}if(this.activeDuration=e==null?null:e,e){let t=this.buttons.get(e);t&&this.applyButtonStyles(t,this.theme,!0)}}}applyBarStyles(e){Object.assign(this.el.style,{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,gap:`2px`,height:this.cfg.height,padding:`0 10px`,background:e.background,borderTop:`1px solid ${e.axisBorder}`,boxSizing:`border-box`,flexShrink:`0`})}applyButtonStyles(e,t,n){Object.assign(e.style,{background:n?t.bottomBar.activeBtnBg:`transparent`,color:n?t.bottomBar.activeBtnText:t.bottomBar.btnColor,border:`1px solid ${n?t.bottomBar.activeBtnBorder:`transparent`}`,borderRadius:`3px`,padding:`2px 7px`,fontSize:this.cfg.btnFontSize,fontFamily:this.cfg.btnFontFamily,cursor:`pointer`,outline:`none`,transition:`background 0.15s`})}},_n={horizontal_line:`horizontalLine`,vertical_line:`verticalLine`,trend_line:`trendLine`,trend_angle:`trendAngle`,cross_line:`crossLine`,parallel_channel:`parallelChannel`,disjoint_channel:`disjointChannel`,flat_channel:`flatChannel`,fib_retracement:`fibRetracement`,fib_extension:`fibExtension`,fib_channel:`fibChannel`,fib_timezone:`fibTimezone`,fib_circles:`fibCircles`,fib_spiral:`fibSpiral`,fib_fan:`fibFan`,gann_fan:`gannFan`,gann_square:`gannSquare`,gann_box:`gannBox`,rectangle:`rectangle`,rotated_rectangle:`rotatedRectangle`,ellipse:`ellipse`,triangle:`triangle`,circle:`circle`,arc:`arc`,polyline:`polyline`,path:`path`,price_range:`priceRange`,date_range:`dateRange`,date_price_range:`datePriceRange`,ruler:`ruler`,pitchfork:`pitchfork`,schiff_pitchfork:`schiffPitchfork`,modified_schiff:`modifiedSchiff`,inside_pitchfork:`insidePitchfork`,fixed_range_vp:`fixedRangeVP`,anchored_vp:`anchoredVP`,volume_profile:`volumeProfile`,regression_trend:`regressionTrend`,text:`text`,callout:`callout`,price_label:`priceLabel`,arrow_marker:`arrowMarker`,flag:`flag`,price_note:`priceNote`,anchored_note:`anchoredNote`,arrow_up:`arrowUp`,arrow_down:`arrowDown`,head_shoulders:`headShoulders`,triangle_pattern:`trianglePattern`,three_drives:`threeDrives`,abcd_pattern:`abcdPattern`,cypher_pattern:`cypherPattern`,butterfly_pattern:`butterflyPattern`,bat_pattern:`batPattern`,gartley_pattern:`gartleyPattern`,crab_pattern:`crabPattern`,shark_pattern:`sharkPattern`,elliott_impulse:`elliottImpulse`,elliott_corrective:`elliottCorrective`,elliott_triangle:`elliottTriangle`,elliott_combination:`elliottCombination`,elliott_wxy:`elliottWxy`,brush:`brush`,highlighter:`highlighter`,ghost_feed:`ghostFeed`,projection:`projection`,sine_line:`sineLine`,cyclic_lines:`cyclicLines`,time_cycles:`timeCycles`,fib_projection:`fibProjection`,price_projection:`priceProjection`},vn=[{id:`trend_lines`,name:`Trend Lines & Channels`,icon:`↗`,tools:[{id:`trend_line`,name:`Trend Line`,icon:`↗`,shortcut:`Alt+T`},{id:`trend_angle`,name:`Trend Angle`,icon:`∠`},{id:`horizontal_line`,name:`Horizontal Line`,icon:`—`,shortcut:`Alt+H`},{id:`vertical_line`,name:`Vertical Line`,icon:`⏐`,shortcut:`Alt+V`},{id:`cross_line`,name:`Cross Line`,icon:`✚`},{id:`parallel_channel`,name:`Parallel Channel`,icon:`⫿`},{id:`disjoint_channel`,name:`Disjoint Channel`,icon:`≠`},{id:`flat_channel`,name:`Flat Top/Bottom Channel`,icon:`⊓`}]},{id:`fibonacci_gann`,name:`Fibonacci & Gann Tools`,icon:`φ`,tools:[{id:`fib_retracement`,name:`Fibonacci Retracement`,icon:`φ`,shortcut:`Alt+F`},{id:`fib_extension`,name:`Fibonacci Extension`,icon:`φ`},{id:`fib_channel`,name:`Fibonacci Channel`,icon:`φ`},{id:`fib_timezone`,name:`Fibonacci Timezone`,icon:`φ`},{id:`fib_circles`,name:`Fibonacci Circles`,icon:`⊙`},{id:`fib_spiral`,name:`Fibonacci Spiral`,icon:`@`},{id:`fib_fan`,name:`Fibonacci Speed Resistance Fan`,icon:`⌇`},{id:`gann_fan`,name:`Gann Fan`,icon:`⌇`},{id:`gann_square`,name:`Gann Square`,icon:`⊞`},{id:`gann_box`,name:`Gann Box`,icon:`⊡`}]},{id:`geometric_shapes`,name:`Geometric Shapes`,icon:`▭`,tools:[{id:`rectangle`,name:`Rectangle`,icon:`▭`},{id:`rotated_rectangle`,name:`Rotated Rectangle`,icon:`◇`},{id:`ellipse`,name:`Ellipse`,icon:`⬭`},{id:`triangle`,name:`Triangle`,icon:`△`},{id:`circle`,name:`Circle`,icon:`○`},{id:`arc`,name:`Arc`,icon:`⌒`},{id:`polyline`,name:`Polyline`,icon:`⚡`},{id:`path`,name:`Path`,icon:`〰`}]},{id:`measurement_tools`,name:`Measurement Tools`,icon:`⇕`,tools:[{id:`price_range`,name:`Price Range`,icon:`⇕`},{id:`date_range`,name:`Date Range`,icon:`⇔`},{id:`date_price_range`,name:`Date & Price Range`,icon:`⊞`},{id:`ruler`,name:`Ruler`,icon:`⊢`}]},{id:`pitchfork_tools`,name:`Pitchfork Tools`,icon:`⑁`,tools:[{id:`pitchfork`,name:`Pitchfork`,icon:`⑁`},{id:`schiff_pitchfork`,name:`Schiff Pitchfork`,icon:`⑁`},{id:`modified_schiff`,name:`Modified Schiff Pitchfork`,icon:`⑁`},{id:`inside_pitchfork`,name:`Inside Pitchfork`,icon:`⑁`}]},{id:`volume_statistics`,name:`Volume & Statistical Tools`,icon:`▤`,tools:[{id:`fixed_range_vp`,name:`Fixed Range Volume Profile`,icon:`▤`},{id:`anchored_vp`,name:`Anchored Volume Profile`,icon:`▤`},{id:`volume_profile`,name:`Volume Profile`,icon:`▤`},{id:`regression_trend`,name:`Regression Trend`,icon:`↗`}]},{id:`annotation_tools`,name:`Annotation Tools`,icon:`A`,tools:[{id:`text`,name:`Text`,icon:`A`},{id:`callout`,name:`Callout`,icon:`⬕`},{id:`price_label`,name:`Price Label`,icon:`$`},{id:`arrow_marker`,name:`Arrow Marker`,icon:`→`},{id:`flag`,name:`Flag`,icon:`⚑`},{id:`price_note`,name:`Price Note`,icon:`≡`},{id:`anchored_note`,name:`Anchored Note`,icon:`⊕`},{id:`arrow_up`,name:`Arrow Up`,icon:`↑`},{id:`arrow_down`,name:`Arrow Down`,icon:`↓`}]},{id:`pattern_recognition`,name:`Pattern Recognition`,icon:`◬`,tools:[{id:`head_shoulders`,name:`Head & Shoulders`,icon:`⌢`},{id:`triangle_pattern`,name:`Triangle Pattern`,icon:`◬`},{id:`three_drives`,name:`3 Drives Pattern`,icon:`⋎`},{id:`abcd_pattern`,name:`ABCD Pattern`,icon:`⊿`},{id:`cypher_pattern`,name:`Cypher Pattern`,icon:`C`},{id:`butterfly_pattern`,name:`Butterfly Pattern`,icon:`⋈`},{id:`bat_pattern`,name:`Bat Pattern`,icon:`⌓`},{id:`gartley_pattern`,name:`Gartley Pattern`,icon:`G`},{id:`crab_pattern`,name:`Crab Pattern`,icon:`⊓`},{id:`shark_pattern`,name:`Shark Pattern`,icon:`⊳`}]},{id:`elliott_wave`,name:`Elliott Wave Tools`,icon:`∿`,tools:[{id:`elliott_impulse`,name:`Elliott Impulse (12345)`,icon:`∿`},{id:`elliott_corrective`,name:`Elliott Corrective (ABC)`,icon:`∿`},{id:`elliott_triangle`,name:`Elliott Wave Triangle`,icon:`△`},{id:`elliott_combination`,name:`Elliott Wave Combination`,icon:`∿`},{id:`elliott_wxy`,name:`Elliott Double Three (WXY)`,icon:`∿`}]},{id:`brush_highlighter`,name:`Brush & Highlighter`,icon:`∫`,tools:[{id:`brush`,name:`Brush`,icon:`∫`},{id:`highlighter`,name:`Highlighter`,icon:`▬`}]},{id:`advanced_tools`,name:`Advanced Tools`,icon:`⊛`,tools:[{id:`ghost_feed`,name:`Ghost Feed`,icon:`◑`},{id:`projection`,name:`Projection`,icon:`→`},{id:`sine_line`,name:`Sine Line`,icon:`∿`},{id:`cyclic_lines`,name:`Cyclic Lines`,icon:`⟳`},{id:`time_cycles`,name:`Time Cycles`,icon:`⊙`}]},{id:`price_projections`,name:`Price Projection Tools`,icon:`⊿`,tools:[{id:`fib_projection`,name:`Fibonacci Projection`,icon:`φ`},{id:`price_projection`,name:`Price Projection`,icon:`⊿`}]}],yn=[{id:`undo`,icon:`↶`,title:`Undo (Ctrl+Z)`},{id:`redo`,icon:`↷`,title:`Redo (Ctrl+Y)`},{id:`delete_selected`,icon:`✕`,title:`Delete Selected (Del)`},{id:`clear_all`,icon:`⊡`,title:`Clear All`},{id:`toggle_visibility`,icon:`◌`,title:`Hide All`},{id:`toggle_lock`,icon:`⊠`,title:`Lock All`}],bn=class{constructor(e,t,n,r,i=p,a=C.drawingToolbar){this.onToolChange=e,this.onAction=t,this.onMobileClose=n,this.activeTool=null,this.openCategoryId=null,this.openActionsMenu=!1,this.catButtons=new Map,this.drawingsHidden=!1,this.drawingsLocked=!1,this.mobileMode=!1,this.settingsVisible=!0,this.theme=r,this.cfg=i,this.labels=a,this.el=document.createElement(`div`),this.flyout=document.createElement(`div`),this.applyBarStyles(),this.applyWidth(),this.buildToolbar(),this.buildFlyout(),document.body.appendChild(this.flyout),this.docClickHandler=e=>{!this.el.contains(e.target)&&!this.flyout.contains(e.target)&&this.closeFlyout()},document.addEventListener(`click`,this.docClickHandler,!0)}setTheme(e){this.theme=e,this.closeFlyout(),this.applyBarStyles(),this.applyWidth(),this.buildFlyout(),this.applyScrollBtnStyles(this.scrollUpBtn,`up`),this.applyScrollBtnStyles(this.scrollDownBtn,`down`),this.topSection.innerHTML=``,this.topSection.appendChild(this.buildMobileActionsBtn());for(let[e,n]of this.catButtons){var t;let r=this.activeTool!==null&&((t=vn.find(t=>t.id===e))==null?void 0:t.tools.some(e=>_n[e.id]===this.activeTool))===!0;this.applyCatBtnStyles(n,r)}}setActiveTool(e){if(this.activeTool!==null){let e=vn.find(e=>e.tools.some(e=>_n[e.id]===this.activeTool));e&&this.applyCatBtnStyles(this.catButtons.get(e.id),!1)}if(this.activeTool=e,e!==null){let t=vn.find(t=>t.tools.some(t=>_n[t.id]===e));t&&this.applyCatBtnStyles(this.catButtons.get(t.id),!0)}}setVisible(e){this.settingsVisible=e,this.applyWidth()}setMobileMode(e){if(this.mobileMode===e)return;this.mobileMode=e,this.closeFlyout(),this.topSection.innerHTML=``,this.topSection.appendChild(this.buildMobileActionsBtn()),this.catButtons.clear();let t=this.makeGrid();if(this.populateCategoryGrid(t),this.toolsGrid.replaceWith(t),this.toolsGrid=t,this.activeTool!==null){let e=vn.find(e=>e.tools.some(e=>_n[e.id]===this.activeTool));if(e){let t=this.catButtons.get(e.id);t&&this.applyCatBtnStyles(t,!0)}}e?(Object.assign(this.el.style,{position:`absolute`,left:`0`,top:`0`,height:`100%`,zIndex:`50`}),this.settingsVisible=!1):(Object.assign(this.el.style,{position:``,left:``,top:``,height:``,zIndex:``}),this.settingsVisible=!0),this.applyBarStyles(),this.applyWidth(),requestAnimationFrame(()=>this.updateScrollIndicators())}reparentFlyout(e){this.flyout.parentElement!==e&&e.appendChild(this.flyout)}destroy(){this.flyout.remove(),document.removeEventListener(`click`,this.docClickHandler,!0)}get barWidth(){return this.cfg.barPadding*2+this.cfg.iconBtnSize}applyBarStyles(){Object.assign(this.el.style,{display:`flex`,flexDirection:`column`,flexShrink:`0`,position:`relative`,height:`100%`,background:this.theme.background,borderRight:`1px solid ${this.theme.axisBorder}`,boxSizing:`border-box`,userSelect:`none`,fontFamily:this.cfg.flyoutLabelFontFamily,overflow:`hidden`,transition:`width 0.2s ease`})}applyWidth(){this.settingsVisible?this.el.style.width=`${this.barWidth}px`:this.el.style.width=`0`}buildToolbar(){this.topSection=document.createElement(`div`),Object.assign(this.topSection.style,{borderBottom:`1px solid ${this.theme.axisBorder}`,padding:`10px ${this.cfg.barPadding}px 10px`,boxSizing:`border-box`,flexShrink:`0`}),this.topSection.appendChild(this.buildMobileActionsBtn()),this.el.appendChild(this.topSection),this.scrollUpBtn=document.createElement(`button`),this.applyScrollBtnStyles(this.scrollUpBtn,`up`),this.scrollUpBtn.addEventListener(`click`,()=>{this.toolsArea.scrollBy({top:-(this.cfg.iconBtnSize+this.cfg.btnGap)*3,behavior:`smooth`})}),this.el.appendChild(this.scrollUpBtn),this.toolsArea=document.createElement(`div`),Object.assign(this.toolsArea.style,{flex:`1`,overflowY:`scroll`,padding:`10px ${this.cfg.barPadding}px 4px`,boxSizing:`border-box`,scrollbarWidth:`none`,msOverflowStyle:`none`});let e=document.createElement(`style`);e.textContent=`.lb-tools::-webkit-scrollbar{display:none}`,document.head.appendChild(e),this.toolsArea.classList.add(`lb-tools`),this.toolsGrid=this.makeGrid(),this.populateCategoryGrid(this.toolsGrid),this.toolsArea.appendChild(this.toolsGrid),this.toolsArea.addEventListener(`scroll`,()=>this.updateScrollIndicators()),this.el.appendChild(this.toolsArea),this.scrollDownBtn=document.createElement(`button`),this.applyScrollBtnStyles(this.scrollDownBtn,`down`),this.scrollDownBtn.addEventListener(`click`,()=>{this.toolsArea.scrollBy({top:(this.cfg.iconBtnSize+this.cfg.btnGap)*3,behavior:`smooth`})}),this.el.appendChild(this.scrollDownBtn),requestAnimationFrame(()=>this.updateScrollIndicators())}buildMobileActionsBtn(){let e=document.createElement(`button`);return e.title=this.labels.actions.moreActions,e.innerHTML=an,this.applyActionBtnStyles(e,!1),this.addBtnHover(e),e.addEventListener(`click`,t=>{t.stopPropagation(),this.toggleActionsFlyout(e)}),e}populateCategoryGrid(e){this.catButtons.clear();for(let n of vn){var t;let r=document.createElement(`button`);r.title=this.getCategoryLabel(n.id),r.innerHTML=(t=Vt[n.id])==null?n.icon:t,this.applyCatBtnStyles(r,!1),this.addBtnHover(r),r.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleCategory(n,r)}),this.catButtons.set(n.id,r),e.appendChild(r)}}updateScrollIndicators(){let{scrollTop:e,scrollHeight:t,clientHeight:n}=this.toolsArea,r=e>2,i=e+n<t-2;this.mobileMode?(this.scrollUpBtn.style.display=`flex`,this.scrollDownBtn.style.display=`flex`,this.scrollUpBtn.style.opacity=r?`0.9`:`0.2`,this.scrollDownBtn.style.opacity=i?`0.9`:`0.2`):(this.scrollUpBtn.style.display=r?`flex`:`none`,this.scrollDownBtn.style.display=i?`flex`:`none`)}buildFlyout(){Object.assign(this.flyout.style,{position:`fixed`,zIndex:`9999`,display:`none`,background:this.theme.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`6px`,padding:`6px 0`,minWidth:`200px`,boxShadow:`0 4px 16px rgba(0,0,0,0.45)`,fontFamily:this.cfg.flyoutLabelFontFamily,fontSize:this.cfg.flyoutLabelFontSize})}makeGrid(e=1){let t=document.createElement(`div`);return Object.assign(t.style,{display:`grid`,gridTemplateColumns:`repeat(${e}, ${this.cfg.iconBtnSize}px)`,gap:`${this.cfg.btnGap}px`}),t}applyScrollBtnStyles(e,t){e.innerHTML=t===`up`?nn:rn,e.title=t===`up`?this.labels.scrollUp:this.labels.scrollDown;let n=e.style.display||`none`;Object.assign(e.style,{display:n,width:`100%`,height:`${this.cfg.scrollBtnHeight}px`,background:this.theme.background,color:this.theme.tooltip.text,border:`none`,borderBottom:t===`up`?`1px solid ${this.theme.axisBorder}`:`none`,borderTop:t===`down`?`1px solid ${this.theme.axisBorder}`:`none`,fontSize:this.cfg.scrollBtnFontSize,cursor:`pointer`,outline:`none`,alignItems:`center`,justifyContent:`center`,flexShrink:`0`,opacity:`0.6`})}toggleCategory(e,t){if(this.openCategoryId===e.id){this.closeFlyout();return}this.openCategoryId=e.id;let n=t.getBoundingClientRect();Object.assign(this.flyout.style,{display:`block`,left:`${n.right+4}px`,top:`${n.top}px`}),this.flyout.innerHTML=``;let r=document.createElement(`div`);Object.assign(r.style,{padding:`4px 12px 8px`,fontSize:this.cfg.flyoutHeadingFontSize,fontWeight:`600`,letterSpacing:this.cfg.flyoutHeadingLetterSpacing,color:this.theme.drawingToolbar.flyoutHeadingColor,textTransform:`uppercase`,borderBottom:`1px solid ${this.theme.axisBorder}`,marginBottom:`4px`,opacity:`0.6`}),r.textContent=this.getCategoryLabel(e.id),this.flyout.appendChild(r);for(let t of e.tools){var i,a;let n=t.id in _n,r=this.activeTool!==null&&_n[t.id]===this.activeTool,o=document.createElement(`button`);Object.assign(o.style,{width:`100%`,padding:`5px 12px`,background:r?this.theme.ui.accentBg:`transparent`,border:`none`,borderLeft:r?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,color:r?this.theme.ui.accentText:n?this.theme.drawingToolbar.flyoutLabelColor:this.theme.ui.disabledText,fontSize:this.cfg.flyoutLabelFontSize,fontFamily:this.cfg.flyoutLabelFontFamily,textAlign:`left`,cursor:n?`pointer`:`default`,display:`flex`,alignItems:`center`,gap:`8px`,boxSizing:`border-box`});let s=document.createElement(`span`);Object.assign(s.style,{width:`16px`,display:`flex`,alignItems:`center`,flexShrink:`0`}),s.innerHTML=(i=(a=Kt[t.id])==null?Vt[e.id]:a)==null?t.icon:i;let c=document.createElement(`span`);if(c.style.flex=`1`,c.textContent=this.getToolLabel(t),o.appendChild(s),o.appendChild(c),t.shortcut&&n){let e=document.createElement(`span`);Object.assign(e.style,{fontSize:this.cfg.shortcutFontSize,color:this.theme.ui.disabledText,flexShrink:`0`}),e.textContent=t.shortcut,o.appendChild(e)}else if(!n){let e=document.createElement(`span`);Object.assign(e.style,{fontSize:this.cfg.soonBadgeFontSize,color:this.theme.ui.soonBadgeText,flexShrink:`0`}),e.textContent=this.labels.soonBadge,o.appendChild(e)}if(n){if(!r){let e=this.theme.ui.accentBg;o.addEventListener(`mouseenter`,()=>{o.style.background=e}),o.addEventListener(`mouseleave`,()=>{o.style.background=`transparent`})}o.addEventListener(`click`,()=>{let e=_n[t.id],n=this.activeTool===e?null:e;if(this.setActiveTool(n),this.onToolChange(n),this.closeFlyout(),this.mobileMode&&n!==null){var r;this.settingsVisible=!1,this.applyWidth(),(r=this.onMobileClose)==null||r.call(this)}})}this.flyout.appendChild(o)}requestAnimationFrame(()=>{let e=this.flyout.getBoundingClientRect();e.bottom>window.innerHeight-8&&(this.flyout.style.top=`${window.innerHeight-e.height-8}px`)})}closeFlyout(){this.flyout.style.display=`none`,this.openCategoryId=null,this.openActionsMenu=!1}toggleActionsFlyout(e){if(this.openActionsMenu){this.closeFlyout();return}this.closeFlyout(),this.openActionsMenu=!0,this.flyout.innerHTML=``;let t=document.createElement(`div`);Object.assign(t.style,{padding:`4px 12px 8px`,fontSize:this.cfg.flyoutHeadingFontSize,fontWeight:`600`,letterSpacing:this.cfg.flyoutHeadingLetterSpacing,color:this.theme.drawingToolbar.flyoutHeadingColor,textTransform:`uppercase`,borderBottom:`1px solid ${this.theme.axisBorder}`,marginBottom:`4px`,opacity:`0.6`}),t.textContent=this.labels.actions.moreActions,this.flyout.appendChild(t);for(let e of yn){var n,r,i;let t=e.id===`toggle_visibility`?this.drawingsHidden:e.id===`toggle_lock`?this.drawingsLocked:!1,a=t?(n=(r=Ut[e.id])==null?Ht[e.id]:r)==null?e.icon:n:(i=Ht[e.id])==null?e.icon:i,o=e.id===`toggle_visibility`?this.drawingsHidden?this.labels.actions.showAll:this.labels.actions.hideAll:e.id===`toggle_lock`?this.drawingsLocked?this.labels.actions.unlockAll:this.labels.actions.lockAll:this.getActionLabel(e.id),s=document.createElement(`button`);Object.assign(s.style,{width:`100%`,padding:`6px 12px`,background:t?this.theme.ui.accentBg:`transparent`,border:`none`,borderLeft:t?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,color:t?this.theme.ui.accentText:this.theme.drawingToolbar.flyoutLabelColor,fontSize:this.cfg.flyoutLabelFontSize,fontFamily:this.cfg.flyoutLabelFontFamily,textAlign:`left`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:`8px`,boxSizing:`border-box`});let c=document.createElement(`span`);Object.assign(c.style,{width:`16px`,display:`flex`,alignItems:`center`,flexShrink:`0`}),c.innerHTML=a;let l=document.createElement(`span`);l.style.flex=`1`,l.textContent=o,s.appendChild(c),s.appendChild(l);let u=this.theme.ui.accentBg;t||(s.addEventListener(`mouseenter`,()=>{s.style.background=u}),s.addEventListener(`mouseleave`,()=>{s.style.background=`transparent`})),s.addEventListener(`click`,()=>{e.id===`toggle_visibility`?(this.drawingsHidden=!this.drawingsHidden,this.onAction(this.drawingsHidden?`hide_all`:`show_all`)):e.id===`toggle_lock`?(this.drawingsLocked=!this.drawingsLocked,this.onAction(this.drawingsLocked?`lock_all`:`unlock_all`)):this.onAction(e.id),this.closeFlyout()}),this.flyout.appendChild(s)}let a=e.getBoundingClientRect(),o=this.el.getBoundingClientRect();Object.assign(this.flyout.style,{display:`block`,left:`${o.right+4}px`,top:`${a.top}px`}),requestAnimationFrame(()=>{let e=this.flyout.getBoundingClientRect();e.bottom>window.innerHeight-8&&(this.flyout.style.top=`${window.innerHeight-e.height-8}px`)})}getCategoryLabel(e){let t={trend_lines:`trendLines`,fibonacci_gann:`fibonacci`,geometric_shapes:`shapes`,measurement_tools:`measurements`,pitchfork_tools:`pitchforks`,volume_statistics:`volume`,annotation_tools:`annotations`,pattern_recognition:`patterns`,elliott_wave:`elliott`,brush_highlighter:`brushes`,advanced_tools:`advanced`,price_projections:`priceProjection`}[e];return t?this.labels.categories[t]:e}getToolLabel(e){let t=_n[e.id];return t&&this.labels.tools[t]?this.labels.tools[t]:e.name}getActionLabel(e){let t={undo:`undo`,redo:`redo`,delete_selected:`deleteSelected`,clear_all:`clearAll`,toggle_visibility:`hideAll`,toggle_lock:`lockAll`}[e];return t?this.labels.actions[t]:e}addBtnHover(e){e.addEventListener(`mouseenter`,()=>{e.dataset.active!==`true`&&(e.style.background=this.theme.ui.accentBg)}),e.addEventListener(`mouseleave`,()=>{e.dataset.active!==`true`&&(e.style.background=`transparent`)})}applyCatBtnStyles(e,t){e.dataset.active=String(t),Object.assign(e.style,{width:`${this.cfg.iconBtnSize}px`,height:`${this.cfg.iconBtnSize}px`,background:t?this.theme.ui.accentBgStrong:`transparent`,color:t?this.theme.drawingToolbar.activeIconColor:this.theme.drawingToolbar.iconColor,border:`1px solid ${t?this.theme.ui.accent:this.theme.axisBorder}`,borderRadius:`5px`,cursor:`pointer`,outline:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0`})}applyActionBtnStyles(e,t){e.dataset.active=String(t),Object.assign(e.style,{width:`${this.cfg.iconBtnSize}px`,height:`${this.cfg.iconBtnSize}px`,background:t?this.theme.ui.accentBg:`transparent`,color:t?this.theme.drawingToolbar.activeIconColor:this.theme.drawingToolbar.iconColor,border:`1px solid ${t?this.theme.ui.accent:this.theme.axisBorder}`,borderRadius:`5px`,cursor:`pointer`,outline:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0`})}},xn=6,Sn=class{constructor(e){this.type=`horizontalLine`,this.id=`hl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o,s=2){let c=this.points[0].price,l=t.yToPixel(c,r,a);e.save(),e.strokeStyle=`#e8b84b`,e.lineWidth=o?1.5:1,o||e.setLineDash([6,3]),e.beginPath(),e.moveTo(0,l),e.lineTo(i,l),e.stroke(),e.setLineDash([]);let u=c.toFixed(s);e.font=`10px 'Inter', system-ui, sans-serif`;let d=e.measureText(u).width;e.fillStyle=`#e8b84b`,e.fillText(u,i-d-4,l-3),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.yToPixel(this.points[0].price,i,o);return Math.abs(t-s)<=xn}getHandle(){return null}},Cn=6,wn=class{constructor(e){this.type=`verticalLine`,this.id=`vl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i);e.save(),e.strokeStyle=`#e8b84b`,e.lineWidth=o?1.5:1,o||e.setLineDash([6,3]),e.beginPath(),e.moveTo(s,0),e.lineTo(s,a),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a);return Math.abs(e-s)<=Cn}getHandle(){return null}},Tn=6;function En(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Dn=class{constructor(e){this.type=`trendLine`,this.id=`tl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.strokeStyle=`#26c6da`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke();for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#26c6da`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return En(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=Tn}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Tn+2)return{pointIndex:n,cursor:`grab`};return null}},On=6;function kn(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var An=class{constructor(e){this.type=`trendAngle`,this.id=`ta_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.atan2(-(f-u),d-l)*180/Math.PI,m=Math.atan2(-(f-u),d-l);e.save(),e.strokeStyle=`#26c6da`,e.fillStyle=`#26c6da`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.beginPath(),e.arc(l,u,28,-m,0,m<0),e.stroke(),e.setLineDash([4,3]),e.globalAlpha=.5,e.beginPath(),e.moveTo(l,u),e.lineTo(l+28+8,u),e.stroke(),e.setLineDash([]),e.globalAlpha=1;let h=l+28+6,g=u-(m>=0?6:-14);if(e.font=`bold 11px 'Inter', system-ui, sans-serif`,e.fillText(`${p.toFixed(1)}°`,h,g),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return kn(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=On}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=On+2)return{pointIndex:n,cursor:`grab`};return null}},jn=6,Mn=class{constructor(e){this.type=`crossLine`,this.id=`xl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=this.points[0],c=t.xToPixel(s.barIndex,n,i),l=t.yToPixel(s.price,r,a);e.save(),e.strokeStyle=`#78909c`,e.lineWidth=o?1.5:1,o||e.setLineDash([6,3]),e.beginPath(),e.moveTo(0,l),e.lineTo(i,l),e.stroke(),e.beginPath(),e.moveTo(c,0),e.lineTo(c,a),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){let s=this.points[0],c=n.xToPixel(s.barIndex,r,a),l=n.yToPixel(s.price,i,o);return Math.abs(t-l)<=jn||Math.abs(e-c)<=jn}getHandle(){return null}},Nn=6;function Pn(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Fn=class{constructor(e){this.type=`parallelChannel`,this.requiredPoints=3,this.id=`pch_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a),m=0;if(l){let e=(s.price+c.price)/2,n=t.yToPixel(e,r,a);m=t.yToPixel(l.price,r,a)-n}let h=u,g=d+m,_=f,v=p+m;if(e.save(),e.strokeStyle=`#26c6da`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.lineTo(_,v),e.lineTo(h,g),e.closePath(),e.fillStyle=`rgba(38, 198, 218, 0.08)`,e.fill(),e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke(),l&&(e.beginPath(),e.moveTo(h,g),e.lineTo(_,v),e.stroke()),o){let o=[[u,d],[f,p]];if(l){let e=t.xToPixel(l.barIndex,n,i),s=t.yToPixel(l.price,r,a);o.push([e,s])}e.fillStyle=`#26c6da`;for(let[t,n]of o)e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o);if(Pn(e,t,u,d,f,p)<=Nn)return!0;if(l){let r=(s.price+c.price)/2,a=n.yToPixel(r,i,o),m=n.yToPixel(l.price,i,o)-a;if(Pn(e,t,u,d+m,f,p+m)<=Nn)return!0}return!1}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=Nn+2)return{pointIndex:n,cursor:`grab`};return null}},In=6;function Ln(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Rn=class{constructor(e){this.type=`flatChannel`,this.requiredPoints=3,this.id=`fch_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(s.price,r,a),p=l?l.price-s.price:0,m=t.yToPixel(s.price+p,r,a);if(e.save(),e.strokeStyle=`#ab47bc`,e.lineWidth=o?1.5:1,e.beginPath(),e.rect(Math.min(u,d),Math.min(f,m),Math.abs(d-u),Math.abs(m-f)),e.fillStyle=`rgba(171, 71, 188, 0.08)`,e.fill(),e.beginPath(),e.moveTo(u,f),e.lineTo(d,f),e.stroke(),l&&(e.beginPath(),e.moveTo(u,m),e.lineTo(d,m),e.stroke()),o){e.fillStyle=`#ab47bc`;let o=[[u,f],[d,f]];if(l){let e=t.xToPixel(l.barIndex,n,i),s=t.yToPixel(l.price,r,a);o.push([e,s])}for(let[t,n]of o)e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(s.price,i,o);if(Ln(e,t,u,f,d,f)<=In)return!0;if(l){let r=l.price-s.price,a=n.yToPixel(s.price+r,i,o);if(Ln(e,t,u,a,d,a)<=In)return!0}return!1}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=In+2)return{pointIndex:n,cursor:`grab`};return null}},zn=6;function Bn(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Vn=class{constructor(e){this.type=`disjointChannel`,this.requiredPoints=4,this.id=`dch_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=e=>[t.xToPixel(e.barIndex,n,i),t.yToPixel(e.price,r,a)],[c,l,u,d]=this.points,[f,p]=s(c),[m,h]=s(l);if(e.save(),e.strokeStyle=`#ef9a9a`,e.lineWidth=o?1.5:1,u&&d){let[t,n]=s(u),[r,i]=s(d);if(e.beginPath(),e.moveTo(f,p),e.lineTo(m,h),e.lineTo(r,i),e.lineTo(t,n),e.closePath(),e.fillStyle=`rgba(239, 154, 154, 0.1)`,e.fill(),e.beginPath(),e.moveTo(f,p),e.lineTo(m,h),e.stroke(),e.beginPath(),e.moveTo(t,n),e.lineTo(r,i),e.stroke(),o){e.fillStyle=`#ef9a9a`;for(let[a,o]of[[f,p],[m,h],[t,n],[r,i]])e.beginPath(),e.arc(a,o,4,0,Math.PI*2),e.fill()}}else if(u){let[t,n]=s(u);if(e.beginPath(),e.moveTo(f,p),e.lineTo(m,h),e.stroke(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,n),e.stroke(),o){e.fillStyle=`#ef9a9a`;for(let[r,i]of[[f,p],[m,h],[t,n]])e.beginPath(),e.arc(r,i,4,0,Math.PI*2),e.fill()}}else if(e.beginPath(),e.moveTo(f,p),e.lineTo(m,h),e.stroke(),o){e.fillStyle=`#ef9a9a`;for(let[t,n]of[[f,p],[m,h]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=e=>[n.xToPixel(e.barIndex,r,a),n.yToPixel(e.price,i,o)],[c,l,u,d]=this.points,[f,p]=s(c),[m,h]=s(l);if(Bn(e,t,f,p,m,h)<=zn)return!0;if(u&&d){let[n,r]=s(u),[i,a]=s(d);if(Bn(e,t,n,r,i,a)<=zn)return!0}return!1}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=zn+2)return{pointIndex:n,cursor:`grab`};return null}},Hn=[0,.236,.382,.5,.618,.786,1],Un=[`#ef5350`,`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`],Wn=6,Gn=class{constructor(e){this.type=`fibRetracement`,this.id=`fib_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=Math.max(c.price,l.price),d=u-Math.min(c.price,l.price),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a),m=t.xToPixel(l.barIndex,n,i),h=t.yToPixel(l.price,r,a),g=Math.min(f,m),_=Math.max(f,m);e.save(),e.font=`10px 'Inter', system-ui, sans-serif`;for(let n=0;n<Hn.length;n++){let i=Hn[n],c=u-d*i,l=t.yToPixel(c,r,a),f=Un[n],p=o?`cc`:`99`;e.strokeStyle=f+p,e.lineWidth=o?1.5:1,e.setLineDash(i===0||i===1?[]:[4,3]),e.beginPath(),e.moveTo(g,l),e.lineTo(_,l),e.stroke(),e.setLineDash([]);let m=`${`${(i*100).toFixed(1)}%`} ${c.toFixed(s)}`;e.fillStyle=f+p,e.fillText(m,g+4,l-3)}for(let[t,n]of[[f,p],[m,h]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=Math.max(this.points[0].price,this.points[1].price),c=s-Math.min(this.points[0].price,this.points[1].price);for(let e of Hn){let r=s-c*e,a=n.yToPixel(r,i,o);if(Math.abs(t-a)<=Wn)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Wn+2)return{pointIndex:n,cursor:`grab`};return null}},Kn=6,qn=[0,.382,.618,1,1.382,1.618,2,2.618],Jn=[`#ef5350`,`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`,`#ef5350`],Yn=class{constructor(e){this.type=`fibExtension`,this.requiredPoints=3,this.id=`fext_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){let[c,l,u]=this.points,d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=t.xToPixel(l.barIndex,n,i),m=t.yToPixel(l.price,r,a);if(!u){e.save(),e.strokeStyle=`#888888aa`,e.lineWidth=1,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.setLineDash([]),e.fillStyle=`#e8b84b`,e.beginPath(),e.arc(d,f,3,0,Math.PI*2),e.fill(),e.restore();return}let h=t.xToPixel(u.barIndex,n,i),g=t.yToPixel(u.price,r,a),_=Math.min(d,p,h),v=Math.max(d,p,h),y=l.price-c.price;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.strokeStyle=`#888888aa`,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.beginPath(),e.moveTo(p,m),e.lineTo(h,g),e.stroke(),e.setLineDash([]);for(let n=0;n<qn.length;n++){let i=qn[n],c=u.price+i*y,l=t.yToPixel(c,r,a),d=Jn[n],f=o?`cc`:`99`;e.strokeStyle=d+f,e.setLineDash(i===0||i===1?[]:[4,3]),e.beginPath(),e.moveTo(_,l),e.lineTo(v,l),e.stroke(),e.setLineDash([]);let p=`${`${(i*100).toFixed(1)}%`} ${c.toFixed(s)}`;e.fillStyle=d+f,e.fillText(p,_+4,l-3)}for(let[t,n]of[[d,f],[p,m],[h,g]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=c.price-s.price;for(let e of qn){let r=l.price+e*u,a=n.yToPixel(r,i,o);if(Math.abs(t-a)<=Kn)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<3)return null;let s=this.points.map(e=>({px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Kn+2)return{pointIndex:n,cursor:`grab`};return null}},Xn=6,Zn=[0,.236,.382,.5,.618,.786,1],Qn=[`#ef5350`,`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`];function $n(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var er=class{constructor(e){this.type=`fibChannel`,this.requiredPoints=3,this.id=`fchann_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){let[c,l,u]=this.points,d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=t.xToPixel(l.barIndex,n,i),m=t.yToPixel(l.price,r,a);if(!u){e.save(),e.strokeStyle=`#888888aa`,e.lineWidth=1,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.setLineDash([]),e.fillStyle=`#e8b84b`,e.beginPath(),e.arc(d,f,3,0,Math.PI*2),e.fill(),e.restore();return}let h=t.xToPixel(u.barIndex,n,i),g=t.yToPixel(u.price,r,a),_=p-d,v=m-f,y=Math.hypot(_,v);if(y===0)return;let b=-v/y,x=_/y,S=(h-d)*b+(g-f)*x;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1;for(let t=0;t<Zn.length;t++){let n=Zn[t],r=n*S,i=d+r*b,a=f+r*x,s=p+r*b,c=m+r*x,l=Qn[t],u=o?`cc`:`99`;e.strokeStyle=l+u,e.setLineDash(n===0||n===1?[]:[4,3]),e.beginPath(),e.moveTo(i,a),e.lineTo(s,c),e.stroke(),e.setLineDash([]);let h=`${(n*100).toFixed(1)}%`;e.fillStyle=l+u,e.fillText(h,s+4,c+3)}e.beginPath(),e.arc(h,g,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();for(let[t,n]of[[d,f],[p,m]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.strokeStyle=`#888888aa`,e.setLineDash([3,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(h,g),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=f-u,_=p-d,v=Math.hypot(g,_);if(v===0)return!1;let y=-_/v,b=g/v,x=(m-u)*y+(h-d)*b;for(let n of Zn){let r=n*x;if($n(e,t,u+r*y,d+r*b,f+r*y,p+r*b)<=Xn)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<3)return null;let s=this.points.map(e=>({px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Xn+2)return{pointIndex:n,cursor:`grab`};return null}},tr=6,nr=[1,2,3,5,8,13,21,34,55,89],rr=class{constructor(e){this.type=`fibTimezone`,this.id=`ftz_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=c.barIndex-s.barIndex,u=t.xToPixel(s.barIndex,n,i),d=t.xToPixel(c.barIndex,n,i);e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1;let f=`#e8b84b`,p=o?`cc`:`88`;e.strokeStyle=f+p,e.setLineDash([3,3]),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(d,0),e.lineTo(d,a),e.stroke(),e.setLineDash([]);for(let r of nr){let o=s.barIndex+r*l,c=t.xToPixel(o,n,i);c<-50||c>i+50||(e.strokeStyle=f+p,e.setLineDash([5,3]),e.beginPath(),e.moveTo(c,0),e.lineTo(c,a),e.stroke(),e.setLineDash([]),e.fillStyle=f+p,e.fillText(String(r),c+3,12))}let m=t.yToPixel(s.price,r,a),h=t.yToPixel(c.price,r,a);for(let[t,n]of[[u,m],[d,h]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=c.barIndex-s.barIndex,u=n.xToPixel(s.barIndex,r,a);if(Math.abs(e-u)<=tr)return!0;for(let t of nr){let i=s.barIndex+t*l,o=n.xToPixel(i,r,a);if(Math.abs(e-o)<=tr)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=tr+2)return{pointIndex:n,cursor:`grab`};return null}},ir=6,ar=[.236,.382,.5,.618,.786,1,1.618,2.618],or=[`#ef5350`,`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`,`#ef5350`],sr=class{constructor(e){this.type=`fibCircles`,this.id=`fcirc_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.hypot(d-l,f-u);e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1;for(let t=0;t<ar.length;t++){let n=ar[t],r=n*p,i=or[t%or.length],a=o?`cc`:`88`;e.strokeStyle=i+a,e.beginPath(),e.arc(l,u,r,0,Math.PI*2),e.stroke(),e.fillStyle=i+a,e.fillText(`${(n*100).toFixed(1)}%`,l+3,u-r+12)}e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill(),e.strokeStyle=`#88888866`,e.setLineDash([3,3]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.hypot(d-l,f-u),m=Math.hypot(e-l,t-u);for(let e of ar){let t=e*p;if(Math.abs(m-t)<=ir)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o),l=n.xToPixel(this.points[1].barIndex,r,a),u=n.yToPixel(this.points[1].price,i,o);return Math.hypot(e-s,t-c)<=ir+2?{pointIndex:0,cursor:`move`}:Math.hypot(e-l,t-u)<=ir+2?{pointIndex:1,cursor:`grab`}:null}},cr=6,lr=[1,1,2,3,5,8,13,21],ur=class{constructor(e){this.type=`fibSpiral`,this.id=`fspi_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}computeArcs(e,t,n,r){let i=Math.hypot(n,r)/lr[lr.length-1],a=Math.atan2(r,n),o=[],s=e,c=t,l=a;for(let e=lr.length-1;e>=0;e--){let t=lr[e]*i,n=l+Math.PI,r=n+Math.PI/2;if(o.unshift({ox:s,oy:c,r:t,startAngle:n,endAngle:r}),e>0){let n=lr[e-1]*i,r=l-Math.PI/2;s+=(t-n)*Math.cos(r),c+=(t-n)*Math.sin(r),l-=Math.PI/2}}return o}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=d-l,m=f-u;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.strokeStyle=o?`#e8b84bcc`:`#e8b84b88`,e.lineWidth=o?1.5:1;let h=this.computeArcs(l,u,p,m);e.beginPath();for(let t=0;t<h.length;t++){let n=h[t];if(t===0){let t=n.ox+n.r*Math.cos(n.startAngle),r=n.oy+n.r*Math.sin(n.startAngle);e.moveTo(t,r)}e.arc(n.ox,n.oy,n.r,n.startAngle,n.endAngle,!1)}e.stroke(),e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill(),e.strokeStyle=`#88888866`,e.setLineDash([3,3]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([]),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=d-l,m=f-u,h=this.computeArcs(l,u,p,m);for(let n of h){let r=n.endAngle-n.startAngle;for(let i=0;i<=16;i++){let a=i/16,o=n.startAngle+a*r,s=n.ox+n.r*Math.cos(o),c=n.oy+n.r*Math.sin(o);if(Math.hypot(e-s,t-c)<=cr)return!0}}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o),l=n.xToPixel(this.points[1].barIndex,r,a),u=n.yToPixel(this.points[1].price,i,o);return Math.hypot(e-s,t-c)<=cr+2?{pointIndex:0,cursor:`move`}:Math.hypot(e-l,t-u)<=cr+2?{pointIndex:1,cursor:`grab`}:null}},dr=6,fr=[.236,.382,.5,.618,.786],pr=[`#e8b84b`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`];function mr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function hr(e,t,n,r,i,a){let o=n-e,s=r-t;if(o===0&&s===0)return[n,r];let c=1/0;return o>0&&(c=Math.min(c,(i-e)/o)),o<0&&(c=Math.min(c,(0-e)/o)),s>0&&(c=Math.min(c,(a-t)/s)),s<0&&(c=Math.min(c,(0-t)/s)),[e+c*o,t+c*s]}var gr=class{constructor(e){this.type=`fibFan`,this.id=`ffan_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.strokeStyle=`#888888aa`,e.setLineDash([4,3]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([]);let p=c.price-s.price;for(let n=0;n<fr.length;n++){let c=fr[n],f=pr[n],m=o?`cc`:`99`,h=s.price+c*p,[g,_]=hr(l,u,d,t.yToPixel(h,r,a),i,a);e.strokeStyle=f+m,e.beginPath(),e.moveTo(l,u),e.lineTo(g,_),e.stroke(),e.fillStyle=f+m,e.fillText(`${(c*100).toFixed(1)}%`,Math.min(g-32,i-40),_-3)}for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=c.price-s.price;for(let r of fr){let c=s.price+r*f,[p,m]=hr(l,u,d,n.yToPixel(c,i,o),a,o);if(mr(e,t,l,u,p,m)<=dr)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=dr+2)return{pointIndex:n,cursor:`grab`};return null}},_r=6,vr=[0,.618,1,1.272,1.618,2,2.618],yr=[`#ef5350`,`#26a69a`,`#2196f3`,`#26a69a`,`#e8b84b`,`#ef5350`,`#ef5350`],br=class{constructor(e){this.type=`fibProjection`,this.requiredPoints=3,this.id=`fproj_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){let[c,l,u]=this.points,d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=t.xToPixel(l.barIndex,n,i),m=t.yToPixel(l.price,r,a);if(!u){e.save(),e.strokeStyle=`#888888aa`,e.lineWidth=1,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.setLineDash([]),e.fillStyle=`#e8b84b`,e.beginPath(),e.arc(d,f,3,0,Math.PI*2),e.fill(),e.restore();return}let h=t.xToPixel(u.barIndex,n,i),g=t.yToPixel(u.price,r,a),_=Math.min(d,h),v=Math.max(d,h),y=l.price-c.price;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.strokeStyle=`#888888aa`,e.setLineDash([4,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(p,m),e.stroke(),e.beginPath(),e.moveTo(p,m),e.lineTo(h,g),e.stroke(),e.setLineDash([]);for(let n=0;n<vr.length;n++){let i=vr[n],c=u.price+i*y,l=t.yToPixel(c,r,a),d=yr[n],f=o?`cc`:`99`;e.strokeStyle=d+f,e.setLineDash(i===0||i===1?[]:[4,3]),e.beginPath(),e.moveTo(_,l),e.lineTo(v,l),e.stroke(),e.setLineDash([]);let p=`${`${(i*100).toFixed(1)}%`} ${c.toFixed(s)}`;e.fillStyle=d+f,e.fillText(p,_+4,l-3)}for(let[t,n]of[[d,f],[p,m],[h,g]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fillStyle=`#e8b84b`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=c.price-s.price;for(let e of vr){let r=l.price+e*u,a=n.yToPixel(r,i,o);if(Math.abs(t-a)<=_r)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<3)return null;let s=this.points.map(e=>({px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=_r+2)return{pointIndex:n,cursor:`grab`};return null}},xr=6;function Sr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Cr=[[1,8,`1:8`],[1,4,`1:4`],[1,3,`1:3`],[1,2,`1:2`],[1,1,`1:1`],[2,1,`2:1`],[3,1,`3:1`],[4,1,`4:1`],[8,1,`8:1`]],wr=class{constructor(e){this.type=`gannFan`,this.id=`gfan_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.abs(d-l)||1,m=f-u,h=d>l?1:-1;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,Cr.forEach(([t,n,r],a)=>{var o;let s=t/n*m,c=(i-l)/(p*h),d=l+p*h*c,f=u+s*c,g=`#ffa726`+((o=[`55`,`66`,`77`,`99`,`cc`,`99`,`77`,`66`,`55`][a])==null?`88`:o);e.strokeStyle=g,e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.fillStyle=g;let _=Math.min(d,i-30);e.fillText(r,_,f-3)}),e.fillStyle=`#ffa726`,e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.abs(d-l)||1,m=f-u,h=d>l?1:-1;for(let[n,r]of Cr){let i=n/r*m,o=(a-l)/(p*h);if(Sr(e,t,l,u,l+p*h*o,u+i*o)<=xr)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}],c=[`move`,`grab`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=xr+2)return{pointIndex:n,cursor:c[n]};return null}},Tr=6,Er=class{constructor(e){this.type=`gannSquare`,this.id=`gsq_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.max(l,d),g=Math.max(u,f),_=h-p,v=g-m;e.save(),e.lineWidth=o?1.5:1,e.strokeStyle=`#ab47bc`,e.fillStyle=`#ab47bc0a`,e.fillRect(p,m,_,v),e.strokeRect(p,m,_,v),e.beginPath(),e.moveTo(p,m+v/3),e.lineTo(h,m+v/3),e.moveTo(p,m+2*v/3),e.lineTo(h,m+2*v/3),e.stroke(),e.beginPath(),e.moveTo(p+_/3,m),e.lineTo(p+_/3,g),e.moveTo(p+2*_/3,m),e.lineTo(p+2*_/3,g),e.stroke(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o);return e>=Math.min(l,d)&&e<=Math.max(l,d)&&t>=Math.min(u,f)&&t<=Math.max(u,f)}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Tr+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Dr=6,Or=class{constructor(e){this.type=`gannBox`,this.id=`gbox_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.max(l,d),g=Math.max(u,f),_=h-p,v=g-m,y=p+_/2,b=m+v/2;e.save(),e.lineWidth=o?1.5:1,e.strokeStyle=`#7e57c2`,e.fillStyle=`#7e57c20a`,e.fillRect(p,m,_,v),e.strokeRect(p,m,_,v),e.beginPath(),e.moveTo(p,m),e.lineTo(h,g),e.stroke(),e.beginPath(),e.moveTo(h,m),e.lineTo(p,g),e.stroke(),e.beginPath(),e.moveTo(p,b),e.lineTo(h,b),e.stroke(),e.beginPath(),e.moveTo(y,m),e.lineTo(y,g),e.stroke(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o);return e>=Math.min(l,d)&&e<=Math.max(l,d)&&t>=Math.min(u,f)&&t<=Math.max(u,f)}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Dr+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},kr=6,Ar=class{constructor(e){this.type=`rectangle`,this.id=`rect_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);if(e.save(),e.fillStyle=`#9b59b618`,e.strokeStyle=`#9b59b6`,e.lineWidth=o?1.5:1,e.fillRect(p,m,h,g),e.strokeRect(p,m,h,g),o)for(let[t,n]of[[l,u],[d,u],[l,f],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=`#9b59b6`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-kr,m=Math.min(u,f)-kr,h=Math.abs(d-l)+kr*2,g=Math.abs(f-u)+kr*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=l<=d?u<=f?`nwse-resize`:`nesw-resize`:u<=f?`nesw-resize`:`nwse-resize`,m=[[0,l,u,p],[1,d,f,p]];for(let[n,r,i,a]of m)if(Math.hypot(e-r,t-i)<=kr+2)return{pointIndex:n,cursor:a};return null}},jr=6;function Mr(e,t,n){let r=!1,i=n.length;for(let a=0,o=i-1;a<i;o=a++){let[i,s]=n[a],[c,l]=n[o];s>t!=l>t&&e<(c-i)*(t-s)/(l-s)+i&&(r=!r)}return r}var Nr=class{constructor(e){this.type=`rotatedRectangle`,this.requiredPoints=3,this.id=`rrect_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}getCorners(e,t,n,r,i){let[a,o,s]=this.points,c=e.xToPixel(a.barIndex,t,r),l=e.yToPixel(a.price,n,i),u=e.xToPixel(o.barIndex,t,r),d=e.yToPixel(o.price,n,i),f=e.xToPixel(s.barIndex,t,r),p=e.yToPixel(s.price,n,i),m=Math.hypot(u-c,d-l);if(m<1e-6)return[[c,l],[u,d],[u,d],[c,l]];let h=-(d-l)/m,g=(u-c)/m,_=(f-c)*h+(p-l)*g,v=c,y=l,b=u,x=d,S=b+h*_,C=x+g*_,w=v+h*_,T=y+g*_;return[[v,y],[b,x],[S,C],[w,T]]}render(e,t,n,r,i,a,o){if(this.points.length<3)return;let s=this.getCorners(t,n,r,i,a);e.save(),e.beginPath(),e.moveTo(s[0][0],s[0][1]);for(let t=1;t<s.length;t++)e.lineTo(s[t][0],s[t][1]);e.closePath(),e.fillStyle=`#9c27b018`,e.fill(),e.strokeStyle=`#9c27b0`,e.lineWidth=o?1.5:1,e.stroke(),e.fillStyle=`#9c27b0`;for(let[t,n]of s)e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){return this.points.length<3?!1:Mr(e,t,this.getCorners(n,r,i,a,o))}getHandle(e,t,n,r,i,a,o){for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=jr+2)return{pointIndex:s,cursor:`grab`}}return null}},Pr=6,Fr=class{constructor(e){this.type=`ellipse`,this.id=`ell_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=(l+d)/2,m=(u+f)/2,h=Math.abs(d-l)/2,g=Math.abs(f-u)/2;if(!(h<1||g<1)){if(e.save(),e.fillStyle=`#2196f318`,e.strokeStyle=`#2196f3`,e.lineWidth=o?1.5:1,e.beginPath(),e.ellipse(p,m,h,g,0,0,Math.PI*2),e.fill(),e.stroke(),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=`#2196f3`,e.fill();e.restore()}}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=(l+d)/2,m=(u+f)/2,h=Math.abs(d-l)/2+Pr,g=Math.abs(f-u)/2+Pr;if(h<1||g<1)return!1;let _=(e-p)/h,v=(t-m)/g;return _*_+v*v<=1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=l<=d?u<=f?`nwse-resize`:`nesw-resize`:u<=f?`nesw-resize`:`nwse-resize`,m=[[0,l,u,p],[1,d,f,p]];for(let[n,r,i,a]of m)if(Math.hypot(e-r,t-i)<=Pr+2)return{pointIndex:n,cursor:a};return null}},Ir=6;function Lr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Rr=class{constructor(e){this.type=`triangle`,this.requiredPoints=3,this.id=`tri_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a));e.save(),e.strokeStyle=`#ff9800`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<s.length;t++)e.lineTo(s[t],c[t]);if(this.complete&&(e.closePath(),e.fillStyle=`#ff980018`,e.fill()),e.stroke(),o)for(let t=0;t<s.length;t++)e.beginPath(),e.arc(s[t],c[t],4,0,Math.PI*2),e.fillStyle=`#ff9800`,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l;n++){let r=(n+1)%l;if(Lr(e,t,s[n],c[n],s[r],c[r])<=Ir)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<3)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ir+2)return{pointIndex:s,cursor:`grab`}}return null}},zr=6,Br=class{constructor(e){this.type=`circle`,this.id=`circ_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.hypot(d-l,f-u);p<1||(e.save(),e.fillStyle=`#4caf5018`,e.strokeStyle=`#4caf50`,e.lineWidth=o?1.5:1,e.beginPath(),e.arc(l,u,p,0,Math.PI*2),e.fill(),e.stroke(),o&&(e.beginPath(),e.arc(l,u,3,0,Math.PI*2),e.fillStyle=`#4caf50`,e.fill(),e.beginPath(),e.arc(d,f,3.5,0,Math.PI*2),e.fillStyle=`#4caf50`,e.fill()),e.restore())}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.hypot(d-l,f-u);return Math.hypot(e-l,t-u)<=p+zr}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o);return Math.hypot(e-l,t-u)<=zr+2?{pointIndex:0,cursor:`move`}:Math.hypot(e-d,t-f)<=zr+2?{pointIndex:1,cursor:`grab`}:null}},Vr=6;function Hr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ur=class{constructor(e){this.type=`arc`,this.requiredPoints=3,this.id=`arc_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<3)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a),m=t.xToPixel(l.barIndex,n,i),h=t.yToPixel(l.price,r,a);e.save(),e.strokeStyle=`#26c6da`,e.lineWidth=o?1.5:1;let g=u,_=d,v=f,y=p,b=m,x=h,S=2*(g*(y-x)+v*(x-_)+b*(_-y));if(Math.abs(S)<1e-6)e.beginPath(),e.moveTo(u,d),e.lineTo(m,h),e.stroke();else{let t=g*g,n=_*_,r=v*v,i=y*y,a=b*b,o=x*x,s=((t+n)*(y-x)+(r+i)*(x-_)+(a+o)*(_-y))/S,c=((t+n)*(b-v)+(r+i)*(g-b)+(a+o)*(v-g))/S,l=Math.hypot(g-s,_-c),u=Math.atan2(_-c,g-s),d=Math.atan2(y-c,v-s),f=Math.atan2(x-c,b-s),p=(e,t)=>{let n=e-t;for(;n<0;)n+=Math.PI*2;for(;n>=Math.PI*2;)n-=Math.PI*2;return n},m=p(d,u)>p(f,u);e.beginPath(),e.arc(s,c,l,u,f,m),e.stroke()}let C=[[u,d],[f,p],[m,h]];e.fillStyle=`#26c6da`;for(let[t,n]of C)e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=u,_=d,v=f,y=p,b=m,x=h,S=2*(g*(y-x)+v*(x-_)+b*(_-y));if(Math.abs(S)<1e-6)return Hr(e,t,u,d,m,h)<=Vr;let C=g*g,w=_*_,T=v*v,E=y*y,D=b*b,O=x*x,k=((C+w)*(y-x)+(T+E)*(x-_)+(D+O)*(_-y))/S,A=((C+w)*(b-v)+(T+E)*(g-b)+(D+O)*(v-g))/S,j=Math.hypot(g-k,_-A);if(Math.abs(Math.hypot(e-k,t-A)-j)>Vr)return!1;let M=Math.atan2(_-A,g-k),N=Math.atan2(y-A,v-k),P=Math.atan2(x-A,b-k),F=Math.atan2(t-A,e-k),I=(e,t)=>{let n=e-t;for(;n<0;)n+=Math.PI*2;for(;n>=Math.PI*2;)n-=Math.PI*2;return n},L=I(N,M),R=I(P,M),z=I(F,M);return L>R?z>=R||z<=0:z<=R}getHandle(e,t,n,r,i,a,o){for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Vr+2)return{pointIndex:s,cursor:`grab`}}return null}},Wr=6;function Gr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Kr=class{constructor(e){this.type=`polyline`,this.openEnded=!0,this.id=`poly_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>({x:t.xToPixel(e.barIndex,n,i),y:t.yToPixel(e.price,r,a)}));e.save(),e.strokeStyle=`#ff7043`,e.lineWidth=o?1.5:1;let c=this.complete?s.length:s.length-1;if(c>=2){e.setLineDash([]),e.beginPath(),e.moveTo(s[0].x,s[0].y);for(let t=1;t<c;t++)e.lineTo(s[t].x,s[t].y);e.stroke()}if(!this.complete&&s.length>=2){let t=s.length-1;e.setLineDash([4,4]),e.beginPath(),e.moveTo(s[t-1].x,s[t-1].y),e.lineTo(s[t].x,s[t].y),e.stroke(),e.setLineDash([])}e.fillStyle=`#ff7043`;let l=this.complete?s.length:s.length-1;for(let t=0;t<l;t++)e.beginPath(),e.arc(s[t].x,s[t].y,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>({x:n.xToPixel(e.barIndex,r,a),y:n.yToPixel(e.price,i,o)})),c=this.complete?s.length-1:s.length-2;for(let n=0;n<c;n++)if(Gr(e,t,s[n].x,s[n].y,s[n+1].x,s[n+1].y)<=Wr)return!0;return!1}getHandle(e,t,n,r,i,a,o){for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Wr+2)return{pointIndex:s,cursor:`grab`}}return null}},qr=6;function Jr(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Yr=class{constructor(e){this.type=`path`,this.openEnded=!0,this.id=`path_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>({x:t.xToPixel(e.barIndex,n,i),y:t.yToPixel(e.price,r,a)})),c=this.complete?s.length:s.length-1;if(e.save(),e.strokeStyle=`#ec407a`,e.lineWidth=o?1.5:1,c>=2){if(e.setLineDash([]),e.beginPath(),e.moveTo(s[0].x,s[0].y),c===2)e.lineTo(s[1].x,s[1].y);else{for(let t=1;t<c-1;t++){let n=(s[t].x+s[t+1].x)/2,r=(s[t].y+s[t+1].y)/2;e.quadraticCurveTo(s[t].x,s[t].y,n,r)}e.lineTo(s[c-1].x,s[c-1].y)}e.stroke()}if(!this.complete&&s.length>=2){let t=s.length-1;e.setLineDash([4,4]),e.beginPath(),e.moveTo(s[t-1].x,s[t-1].y),e.lineTo(s[t].x,s[t].y),e.stroke(),e.setLineDash([])}e.fillStyle=`#ec407a`;for(let t=0;t<c;t++)e.beginPath(),e.arc(s[t].x,s[t].y,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>({x:n.xToPixel(e.barIndex,r,a),y:n.yToPixel(e.price,i,o)})),c=this.complete?s.length-1:s.length-2;for(let n=0;n<c;n++)if(Jr(e,t,s[n].x,s[n].y,s[n+1].x,s[n+1].y)<=qr)return!0;return!1}getHandle(e,t,n,r,i,a,o){for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=qr+2)return{pointIndex:s,cursor:`grab`}}return null}},Xr=6;function Zr(e,t,n,r,i,a=7){let o=Math.atan2(i-n,r-t);e.beginPath(),e.moveTo(r,i),e.lineTo(r-a*Math.cos(o-Math.PI/6),i-a*Math.sin(o-Math.PI/6)),e.lineTo(r-a*Math.cos(o+Math.PI/6),i-a*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var Qr=class{constructor(e){this.type=`priceRange`,this.id=`pr_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=t.xToPixel(c.barIndex,n,i),d=t.yToPixel(c.price,r,a),f=t.xToPixel(l.barIndex,n,i),p=t.yToPixel(l.price,r,a),m=(u+f)/2,h=(d+p)/2,g=Math.min(d,p),_=Math.max(d,p),v=`#26a69a`;e.save(),e.strokeStyle=v,e.fillStyle=v,e.lineWidth=o?1.5:1,e.font=`10px 'Inter', system-ui, sans-serif`,e.beginPath(),e.moveTo(m,g),e.lineTo(m,_),e.stroke(),Zr(e,m,_,m,g),Zr(e,m,g,m,_),e.beginPath(),e.moveTo(u-10,d),e.lineTo(u+10,d),e.stroke(),e.beginPath(),e.moveTo(f-10,p),e.lineTo(f+10,p),e.stroke();let y=Math.abs(c.price-l.price).toFixed(s),b=((l.price-c.price)/c.price*100).toFixed(2)+`%`,x=y,S=b,C=m+8,w=h-30/2;e.fillStyle=`rgba(0,0,0,0.55)`,e.fillRect(C,w,70,30),e.strokeStyle=v,e.strokeRect(C,w,70,30),e.fillStyle=v,e.fillText(x,C+4,w+4+10),e.fillText(S,C+4,w+4+22),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=(l+d)/2,m=Math.min(u,f),h=Math.max(u,f);return Math.abs(e-p)<=Xr&&t>=m&&t<=h}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Xr+2)return{pointIndex:n,cursor:`ns-resize`};return null}},$r=6;function ei(e,t,n,r,i,a=7){let o=Math.atan2(i-n,r-t);e.beginPath(),e.moveTo(r,i),e.lineTo(r-a*Math.cos(o-Math.PI/6),i-a*Math.sin(o-Math.PI/6)),e.lineTo(r-a*Math.cos(o+Math.PI/6),i-a*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var ti=class{constructor(e){this.type=`dateRange`,this.id=`dr_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=(u+f)/2,m=Math.min(l,d),h=Math.max(l,d),g=`#42a5f5`;e.save(),e.strokeStyle=g,e.fillStyle=g,e.lineWidth=o?1.5:1,e.font=`10px 'Inter', system-ui, sans-serif`,e.beginPath(),e.moveTo(m,p),e.lineTo(h,p),e.stroke(),ei(e,h,p,m,p),ei(e,m,p,h,p),e.beginPath(),e.moveTo(l,u-10),e.lineTo(l,u+10),e.stroke(),e.beginPath(),e.moveTo(d,f-10),e.lineTo(d,f+10),e.stroke();let _=`${Math.abs(c.barIndex-s.barIndex)} bars`,v=(l+d)/2,y=e.measureText(_).width;e.fillStyle=g,e.fillText(_,v-y/2,p-10),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=(u+n.yToPixel(c.price,i,o))/2,p=Math.min(l,d),m=Math.max(l,d);return Math.abs(t-f)<=$r&&e>=p&&e<=m}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=$r+2)return{pointIndex:n,cursor:`ew-resize`};return null}},ni=6;function ri(e,t,n,r,i,a=7){let o=Math.atan2(i-n,r-t);e.beginPath(),e.moveTo(r,i),e.lineTo(r-a*Math.cos(o-Math.PI/6),i-a*Math.sin(o-Math.PI/6)),e.lineTo(r-a*Math.cos(o+Math.PI/6),i-a*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var ii=class{constructor(e){this.type=`datePriceRange`,this.id=`dpr_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=t.xToPixel(c.barIndex,n,i),d=t.yToPixel(c.price,r,a),f=t.xToPixel(l.barIndex,n,i),p=t.yToPixel(l.price,r,a),m=Math.min(u,f),h=Math.min(d,p),g=Math.max(u,f),_=Math.max(d,p),v=g-m,y=_-h,b=`#66bb6a`;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.fillStyle=`#66bb6a12`,e.fillRect(m,h,v,y),e.strokeStyle=b,e.setLineDash([5,3]),e.strokeRect(m,h,v,y),e.setLineDash([]),e.strokeStyle=b,e.fillStyle=b,e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke(),ri(e,u,d,f,p);let x=`\u0394${Math.abs(c.price-l.price).toFixed(s)}`;e.fillStyle=b,e.fillText(x,g+4,(h+_)/2);let S=`${Math.abs(l.barIndex-c.barIndex)} bars`,C=e.measureText(S).width;e.fillText(S,m+v/2-C/2,_+12),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-ni,m=Math.min(u,f)-ni,h=Math.max(l,d)+ni,g=Math.max(u,f)+ni;return e>=p&&e<=h&&t>=m&&t<=g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=ni+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},ai=6;function oi(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var si=class{constructor(e){this.type=`ruler`,this.id=`rul_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=t.xToPixel(c.barIndex,n,i),d=t.yToPixel(c.price,r,a),f=t.xToPixel(l.barIndex,n,i),p=t.yToPixel(l.price,r,a),m=`#ffb300`,h=Math.atan2(p-d,f-u),g=h+Math.PI/2;e.save(),e.strokeStyle=m,e.fillStyle=m,e.lineWidth=2,e.font=`10px 'Inter', system-ui, sans-serif`,e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke(),e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(u-8*Math.cos(g),d-8*Math.sin(g)),e.lineTo(u+8*Math.cos(g),d+8*Math.sin(g)),e.stroke(),e.beginPath(),e.moveTo(f-8*Math.cos(g),p-8*Math.sin(g)),e.lineTo(f+8*Math.cos(g),p+8*Math.sin(g)),e.stroke();let _=(u+f)/2,v=(d+p)/2,y=Math.abs(l.barIndex-c.barIndex),b=(l.price-c.price).toFixed(s),x=`${y} bars`,S=`${b}`,C=-12*Math.sin(h),w=12*Math.cos(h);e.fillStyle=m,e.fillText(x,_+C,v+w-12),e.fillText(S,_+C,v+w),e.beginPath(),e.arc(u,d,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(f,p,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return oi(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=ai}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=ai+2)return{pointIndex:n,cursor:`grab`};return null}},ci=6;function li(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function ui(e,t,n,r,i){return n===0?[e,t]:[i,t+(i-e)/n*r]}var di=class{constructor(e){this.type=`pitchfork`,this.requiredPoints=3,this.id=`pfk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a);if(e.save(),e.strokeStyle=`#ffa726`,e.lineWidth=o?1.5:1,l){let s=t.xToPixel(l.barIndex,n,i),c=t.yToPixel(l.price,r,a),m=(f+s)/2,h=(p+c)/2,g=m-u,_=h-d,[v,y]=ui(u,d,g,_,i);e.beginPath(),e.moveTo(u,d),e.lineTo(m,h),e.stroke(),e.beginPath(),e.moveTo(u,d),e.lineTo(v,y),e.stroke();let[b,x]=ui(f,p,g,_,i);e.beginPath(),e.moveTo(f,p),e.lineTo(b,x),e.stroke();let[S,C]=ui(s,c,g,_,i);if(e.beginPath(),e.moveTo(s,c),e.lineTo(S,C),e.stroke(),o){e.fillStyle=`#ffa726`;for(let[t,n]of[[u,d],[f,p],[s,c]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}}else e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=(f+m)/2,_=(p+h)/2,v=g-u,y=_-d,[b,x]=ui(u,d,v,y,a),[S,C]=ui(f,p,v,y,a),[w,T]=ui(m,h,v,y,a);return li(e,t,u,d,b,x)<=ci||li(e,t,f,p,S,C)<=ci||li(e,t,m,h,w,T)<=ci}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=ci+2)return{pointIndex:n,cursor:`grab`};return null}},fi=6;function pi(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function mi(e,t,n,r,i){return n===0?[e,t]:[i,t+(i-e)/n*r]}var hi=class{constructor(e){this.type=`schiffPitchfork`,this.requiredPoints=3,this.id=`spfk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a);if(e.save(),e.strokeStyle=`#ff7043`,e.lineWidth=o?1.5:1,l){let s=t.xToPixel(l.barIndex,n,i),c=t.yToPixel(l.price,r,a),m=(u+f)/2,h=(d+p)/2,g=(f+s)/2,_=(p+c)/2,v=g-m,y=_-h,[b,x]=mi(m,h,v,y,i);e.beginPath(),e.moveTo(m,h),e.lineTo(g,_),e.stroke(),e.beginPath(),e.moveTo(m,h),e.lineTo(b,x),e.stroke();let[S,C]=mi(f,p,v,y,i);e.beginPath(),e.moveTo(f,p),e.lineTo(S,C),e.stroke();let[w,T]=mi(s,c,v,y,i);if(e.beginPath(),e.moveTo(s,c),e.lineTo(w,T),e.stroke(),o){e.fillStyle=`#ff7043`;for(let[t,n]of[[u,d],[f,p],[s,c]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}}else e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=(u+f)/2,_=(d+p)/2,v=(f+m)/2,y=(p+h)/2,b=v-g,x=y-_,[S,C]=mi(g,_,b,x,a),[w,T]=mi(f,p,b,x,a),[E,D]=mi(m,h,b,x,a);return pi(e,t,g,_,S,C)<=fi||pi(e,t,f,p,w,T)<=fi||pi(e,t,m,h,E,D)<=fi}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=fi+2)return{pointIndex:n,cursor:`grab`};return null}},gi=6;function _i(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function vi(e,t,n,r,i){return n===0?[e,t]:[i,t+(i-e)/n*r]}var yi=class{constructor(e){this.type=`modifiedSchiff`,this.requiredPoints=3,this.id=`mspfk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a);if(e.save(),e.strokeStyle=`#ef5350`,e.lineWidth=o?1.5:1,l){let s=t.xToPixel(l.barIndex,n,i),c=t.yToPixel(l.price,r,a),m=(f+s)/2,h=(p+c)/2,g=(u+m)/2,_=(d+h)/2,v=m-g,y=h-_,[b,x]=vi(g,_,v,y,i);e.beginPath(),e.moveTo(g,_),e.lineTo(m,h),e.stroke(),e.beginPath(),e.moveTo(g,_),e.lineTo(b,x),e.stroke();let[S,C]=vi(f,p,v,y,i);e.beginPath(),e.moveTo(f,p),e.lineTo(S,C),e.stroke();let[w,T]=vi(s,c,v,y,i);if(e.beginPath(),e.moveTo(s,c),e.lineTo(w,T),e.stroke(),o){e.fillStyle=`#ef5350`;for(let[t,n]of[[u,d],[f,p],[s,c]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}}else e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=(f+m)/2,_=(p+h)/2,v=(u+g)/2,y=(d+_)/2,b=g-v,x=_-y,[S,C]=vi(v,y,b,x,a),[w,T]=vi(f,p,b,x,a),[E,D]=vi(m,h,b,x,a);return _i(e,t,v,y,S,C)<=gi||_i(e,t,f,p,w,T)<=gi||_i(e,t,m,h,E,D)<=gi}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=gi+2)return{pointIndex:n,cursor:`grab`};return null}},bi=6;function xi(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function Si(e,t,n,r,i){return n===0?[e,t]:[i,t+(i-e)/n*r]}var Ci=class{constructor(e){this.type=`insidePitchfork`,this.requiredPoints=3,this.id=`ipfk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c,l]=this.points,u=t.xToPixel(s.barIndex,n,i),d=t.yToPixel(s.price,r,a),f=t.xToPixel(c.barIndex,n,i),p=t.yToPixel(c.price,r,a);if(e.save(),e.strokeStyle=`#ab47bc`,e.lineWidth=o?1.5:1,l){let s=t.xToPixel(l.barIndex,n,i),c=t.yToPixel(l.price,r,a),m=(f+s)/2,h=(p+c)/2,g=m-u,_=h-d;e.beginPath(),e.moveTo(u,d),e.lineTo(m,h),e.stroke();let[v,y]=Si(u,d,g,_,i);e.beginPath(),e.moveTo(u,d),e.lineTo(v,y),e.stroke();let[b,x]=Si(f,p,g,_,i);e.beginPath(),e.moveTo(f,p),e.lineTo(b,x),e.stroke();let[S,C]=Si(s,c,g,_,i);e.beginPath(),e.moveTo(s,c),e.lineTo(S,C),e.stroke();let w=(u+f)/2,T=(d+p)/2,[E,D]=Si(w,T,g,_,i);e.globalAlpha=.55,e.setLineDash([4,3]),e.beginPath(),e.moveTo(w,T),e.lineTo(E,D),e.stroke();let O=(u+s)/2,k=(d+c)/2,[A,j]=Si(O,k,g,_,i);if(e.beginPath(),e.moveTo(O,k),e.lineTo(A,j),e.stroke(),e.setLineDash([]),e.globalAlpha=1,o){e.fillStyle=`#ab47bc`;for(let[t,n]of[[u,d],[f,p],[s,c]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}}else e.beginPath(),e.moveTo(u,d),e.lineTo(f,p),e.stroke();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<3)return!1;let[s,c,l]=this.points,u=n.xToPixel(s.barIndex,r,a),d=n.yToPixel(s.price,i,o),f=n.xToPixel(c.barIndex,r,a),p=n.yToPixel(c.price,i,o),m=n.xToPixel(l.barIndex,r,a),h=n.yToPixel(l.price,i,o),g=(f+m)/2,_=(p+h)/2,v=g-u,y=_-d,[b,x]=Si(u,d,v,y,a),[S,C]=Si(f,p,v,y,a),[w,T]=Si(m,h,v,y,a);if(xi(e,t,u,d,b,x)<=bi||xi(e,t,f,p,S,C)<=bi||xi(e,t,m,h,w,T)<=bi)return!0;let E=(u+f)/2,D=(d+p)/2,[O,k]=Si(E,D,v,y,a);if(xi(e,t,E,D,O,k)<=bi)return!0;let A=(u+m)/2,j=(d+h)/2,[M,N]=Si(A,j,v,y,a);return xi(e,t,A,j,M,N)<=bi}getHandle(e,t,n,r,i,a,o){let s=this.points.map((e,t)=>({i:t,px:n.xToPixel(e.barIndex,r,a),py:n.yToPixel(e.price,i,o)}));for(let{i:n,px:r,py:i}of s)if(Math.hypot(e-r,t-i)<=bi+2)return{pointIndex:n,cursor:`grab`};return null}},wi=6,Ti=`#64b5f6`,Ei=[.35,.55,.75,1,1,.75,.55,.35],Di=class{constructor(e){this.type=`fixedRangeVP`,this.id=`frvp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);e.save(),e.strokeStyle=Ti,e.lineWidth=o?1.5:1,e.strokeRect(p,m,h,g);let _=Ei.length,v=g/_,y=h*.6;for(let t=0;t<_;t++){let n=y*Ei[t],r=m+t*v;e.fillStyle=Ti+`60`,e.fillRect(p,r,n,v-1)}if(e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Ti,e.fillText(`Volume Profile`,p+4,m+13),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=Ti,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-wi,m=Math.min(u,f)-wi,h=Math.abs(d-l)+wi*2,g=Math.abs(f-u)+wi*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[[0,n.xToPixel(this.points[0].barIndex,r,a),n.yToPixel(this.points[0].price,i,o)],[1,n.xToPixel(this.points[1].barIndex,r,a),n.yToPixel(this.points[1].price,i,o)]];for(let[n,r,i]of s)if(Math.hypot(e-r,t-i)<=wi+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Oi=6,ki=`#4db6ac`,Ai=[.35,.55,.75,1,1,.75,.55,.35],ji=class{constructor(e){this.type=`anchoredVP`,this.id=`avp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);e.save(),e.strokeStyle=ki,e.lineWidth=o?1.5:1,e.strokeRect(p,m,h,g);let _=Ai.length,v=g/_,y=h*.6;for(let t=0;t<_;t++){let n=y*Ai[t],r=m+t*v;e.fillStyle=ki+`60`,e.fillRect(p,r,n,v-1)}if(e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=ki,e.fillText(`Anchored VP`,p+4,m+13),e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fillStyle=ki,e.fill(),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=ki,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-Oi,m=Math.min(u,f)-Oi,h=Math.abs(d-l)+Oi*2,g=Math.abs(f-u)+Oi*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[[0,n.xToPixel(this.points[0].barIndex,r,a),n.yToPixel(this.points[0].price,i,o)],[1,n.xToPixel(this.points[1].barIndex,r,a),n.yToPixel(this.points[1].price,i,o)]];for(let[n,r,i]of s)if(Math.hypot(e-r,t-i)<=Oi+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Mi=6,Ni=`#26a69a`,Pi=[.25,.45,.65,.85,1,1,.85,.65,.45,.25],Fi=class{constructor(e){this.type=`volumeProfile`,this.id=`vp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);e.save(),e.strokeStyle=Ni,e.lineWidth=o?1.5:1,e.strokeRect(p,m,h,g);let _=Pi.length,v=g/_,y=h*.6;for(let t=0;t<_;t++){let n=y*Pi[t],r=m+t*v;e.fillStyle=Ni+`55`,e.fillRect(p,r,n,v-1)}if(e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Ni,e.fillText(`Volume Profile`,p+4,m+13),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=Ni,e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-Mi,m=Math.min(u,f)-Mi,h=Math.abs(d-l)+Mi*2,g=Math.abs(f-u)+Mi*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[[0,n.xToPixel(this.points[0].barIndex,r,a),n.yToPixel(this.points[0].price,i,o)],[1,n.xToPixel(this.points[1].barIndex,r,a),n.yToPixel(this.points[1].price,i,o)]];for(let[n,r,i]of s)if(Math.hypot(e-r,t-i)<=Mi+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Ii=6;function Li(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ri=class{constructor(e){this.type=`regressionTrend`,this.id=`reg_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=`#26c6da`,m=Math.hypot(d-l,f-u)||1,h=-(f-u)/m,g=(d-l)/m;e.save(),e.strokeStyle=p,e.fillStyle=p,e.lineWidth=o?1.5:1,e.setLineDash([]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([4,3]),e.beginPath(),e.moveTo(l+h*20,u+g*20),e.lineTo(d+h*20,f+g*20),e.stroke(),e.beginPath(),e.moveTo(l-h*20,u-g*20),e.lineTo(d-h*20,f-g*20),e.stroke(),e.setLineDash([]),e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return Li(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=Ii}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Ii+2)return{pointIndex:n,cursor:`grab`};return null}},zi=6,Bi=`Text`,Vi=4,Hi=class{constructor(e){this.type=`text`,this.text=``,this.id=`txt_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i),c=t.yToPixel(this.points[0].price,r,a);e.save(),e.font=`13px system-ui, sans-serif`,e.textBaseline=`top`;let l=this.text||Bi,u=!this.text,d=e.measureText(l).width;o&&(e.strokeStyle=`#2196f3`,e.lineWidth=1,e.strokeRect(s-2,c-2,d+Vi*2,20)),e.fillStyle=u?`#888`:`#f5f5f5`,e.fillText(l,s+Vi,c),o&&(e.strokeStyle=`#f5f5f5`,e.lineWidth=1,e.beginPath(),e.moveTo(s,c+16),e.lineTo(s+d+Vi*2,c+16),e.stroke()),e.restore()}hitTest(e,t,n,r,i,a,o){var s,c;let l=n.xToPixel(this.points[0].barIndex,r,a),u=n.yToPixel(this.points[0].price,i,o),d=Math.max(40,((s=(c=this.text)==null?void 0:c.length)==null?4:s)*8);return e>=l-zi&&e<=l+d+zi&&t>=u-zi&&t<=u+16+zi}getHandle(){return null}},Ui=6,Wi=24,Gi=8,Ki=12;function qi(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}function Ji(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.lineTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.closePath()}var Yi=class{constructor(e){this.type=`callout`,this.text=``,this.id=`cal_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}getBoxW(e){let t=this.text||`Note`;return Math.max(60,e.measureText(t).width+Ki*2)}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.font=`11px system-ui, sans-serif`,e.lineWidth=o?1.5:1;let p=this.getBoxW(e),m=d-p/2,h=f-Wi/2,g=Math.max(m,Math.min(m+p,l)),_=Math.max(h,Math.min(h+Wi,u)),v=l<m?m:l>m+p?m+p:g,y=u<h?h:u>h+Wi?h+Wi:_;e.strokeStyle=`#546e7a`,e.beginPath(),e.moveTo(v,y),e.lineTo(l,u),e.stroke(),e.fillStyle=`#546e7a`,e.beginPath(),e.arc(l,u,3,0,Math.PI*2),e.fill(),Ji(e,m,h,p,Wi,Gi),e.fillStyle=`#37474f`,e.fill(),e.strokeStyle=`#546e7a`,e.stroke();let b=this.text||`Note`;e.fillStyle=this.text?`#f5f5f5`:`#888`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(b,d,f),e.restore()}hitTest(e,t,n,r,i,a,o){var s,c;if(this.points.length<2)return!1;let[l,u]=this.points,d=n.xToPixel(l.barIndex,r,a),f=n.yToPixel(l.price,i,o),p=n.xToPixel(u.barIndex,r,a),m=n.yToPixel(u.price,i,o),h=Math.max(60,((s=(c=this.text)==null?void 0:c.length)==null?4:s)*7+24),g=p-h/2,_=m-Wi/2;return e>=g-Ui&&e<=g+h+Ui&&t>=_-Ui&&t<=_+Wi+Ui||qi(e,t,d<g?g:d>g+h?g+h:Math.max(g,Math.min(g+h,d)),f<_?_:f>_+Wi?_+Wi:Math.max(_,Math.min(_+Wi,f)),d,f)<=Ui}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}],c=[`grab`,`move`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Ui+4)return{pointIndex:n,cursor:c[n]};return null}},Xi=6,Zi=60,Qi=18,$i=7,ea=class{constructor(e){this.type=`priceLabel`,this.id=`plbl_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o,s=2){let c=t.xToPixel(this.points[0].barIndex,n,i),l=t.yToPixel(this.points[0].price,r,a),u=this.points[0].price;e.save(),e.fillStyle=`#26a69a`,e.beginPath(),e.moveTo(c,l),e.lineTo(c+$i,l-Qi/2),e.lineTo(c+$i,l+Qi/2),e.closePath(),e.fill();let d=c+$i,f=l-Qi/2;e.fillStyle=`#26a69a`,e.beginPath(),e.roundRect(d,f,Zi,Qi,Qi/2),e.fill(),o&&(e.strokeStyle=`#80cbc4`,e.lineWidth=1.5,e.beginPath(),e.roundRect(d-2,f-2,Zi+4,Qi+4,Qi/2+2),e.stroke()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=`#ffffff`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(u.toFixed(s),d+Zi/2,l),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o),l=s+$i,u=c-Qi/2;return e>=s-Xi&&e<=l+Zi+Xi&&t>=u-Xi&&t<=u+Qi+Xi}getHandle(){return null}},ta=6;function na(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var ra=class{constructor(e){this.type=`arrowMarker`,this.id=`arw_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.strokeStyle=`#ef5350`,e.fillStyle=`#ef5350`,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke();let p=Math.atan2(f-u,d-l);if(e.beginPath(),e.moveTo(d,f),e.lineTo(d-10*Math.cos(p-Math.PI/6),f-10*Math.sin(p-Math.PI/6)),e.lineTo(d-10*Math.cos(p+Math.PI/6),f-10*Math.sin(p+Math.PI/6)),e.closePath(),e.fill(),o)for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points;return na(e,t,n.xToPixel(s.barIndex,r,a),n.yToPixel(s.price,i,o),n.xToPixel(c.barIndex,r,a),n.yToPixel(c.price,i,o))<=ta}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=ta+2)return{pointIndex:n,cursor:`grab`};return null}},ia=class{constructor(e){this.type=`flag`,this.id=`flag_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i),c=t.yToPixel(this.points[0].price,r,a);e.save(),e.strokeStyle=`#ef5350`,e.fillStyle=`#ef5350`,e.lineWidth=1.5,e.beginPath(),e.moveTo(s,c+20),e.lineTo(s,c-10),e.stroke();let l=s,u=c-10;e.fillRect(l,u,16,10),e.font=`8px system-ui, sans-serif`,e.fillStyle=`#ffffff`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(`F`,l+8,u+5),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o);return Math.hypot(e-s,t-c)<=20}getHandle(){return null}},aa=6,oa=16,sa=6,ca=10,la=class{constructor(e){this.type=`priceNote`,this.id=`pnote_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o,s=2){let c=t.xToPixel(this.points[0].barIndex,n,i),l=t.yToPixel(this.points[0].price,r,a),u=this.points[0].price.toFixed(s);e.save(),e.strokeStyle=`#ffa726`,e.lineWidth=1.5,e.beginPath(),e.moveTo(c-ca,l),e.lineTo(c+ca,l),e.stroke(),e.font=`11px 'Inter', system-ui, sans-serif`;let d=e.measureText(u).width+sa*2,f=c+ca+2,p=l-oa/2;e.fillStyle=`#ffa726`,e.beginPath(),e.roundRect(f,p,d,oa,3),e.fill(),e.fillStyle=`#ffffff`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(u,f+d/2,l),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o);return e>=s-ca-aa&&e<=s+ca+aa&&Math.abs(t-c)<=aa}getHandle(){return null}},ua=6,da=20,fa=10;function pa(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var ma=class{constructor(e){this.type=`anchoredNote`,this.text=``,this.id=`anote_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}getBadgeW(e){let t=this.text||`Note`;return Math.max(50,e.measureText(t).width+fa*2)}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a);e.save(),e.font=`11px system-ui, sans-serif`,e.lineWidth=o?1.5:1;let p=this.getBadgeW(e),m=d-p/2,h=f-da/2;e.strokeStyle=`#42a5f5`,e.setLineDash([4,3]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([]),e.fillStyle=`#42a5f5`,e.beginPath(),e.arc(l,u,3,0,Math.PI*2),e.fill(),e.fillStyle=`#37474f`,e.beginPath(),e.roundRect(m,h,p,da,4),e.fill(),e.strokeStyle=`#42a5f5`,e.lineWidth=o?1.5:1,e.beginPath(),e.roundRect(m,h,p,da,4),e.stroke();let g=this.text||`Note`;e.fillStyle=this.text?`#f5f5f5`:`#888`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(g,d,f),e.restore()}hitTest(e,t,n,r,i,a,o){var s,c;if(this.points.length<2)return!1;let[l,u]=this.points,d=n.xToPixel(l.barIndex,r,a),f=n.yToPixel(l.price,i,o),p=n.xToPixel(u.barIndex,r,a),m=n.yToPixel(u.price,i,o),h=Math.max(50,((s=(c=this.text)==null?void 0:c.length)==null?4:s)*7+20),g=p-h/2,_=m-da/2;return e>=g-ua&&e<=g+h+ua&&t>=_-ua&&t<=_+da+ua||pa(e,t,d,f,p,m)<=ua}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}],c=[`grab`,`move`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=ua+4)return{pointIndex:n,cursor:c[n]};return null}},ha=class{constructor(e){this.type=`arrowUp`,this.id=`awup_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i),c=t.yToPixel(this.points[0].price,r,a);e.save(),e.strokeStyle=`#26a69a`,e.fillStyle=`#26a69a`,e.lineWidth=1.5,e.beginPath(),e.moveTo(s,c+10),e.lineTo(s,c-2),e.stroke();let l=s,u=c-10;e.beginPath(),e.moveTo(l,u),e.lineTo(l-6,u+10),e.lineTo(l+6,u+10),e.closePath(),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o);return Math.hypot(e-s,t-c)<=12}getHandle(){return null}},ga=class{constructor(e){this.type=`arrowDown`,this.id=`awdn_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e],this.complete=!0}render(e,t,n,r,i,a,o){let s=t.xToPixel(this.points[0].barIndex,n,i),c=t.yToPixel(this.points[0].price,r,a);e.save(),e.strokeStyle=`#ef5350`,e.fillStyle=`#ef5350`,e.lineWidth=1.5,e.beginPath(),e.moveTo(s,c-10),e.lineTo(s,c+2),e.stroke();let l=s,u=c+10;e.beginPath(),e.moveTo(l,u),e.lineTo(l-6,u-10),e.lineTo(l+6,u-10),e.closePath(),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){let s=n.xToPixel(this.points[0].barIndex,r,a),c=n.yToPixel(this.points[0].price,i,o);return Math.hypot(e-s,t-c)<=12}getHandle(){return null}},_a=6;function va(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var ya=`#ff7043`,ba=class{constructor(e){this.type=`headShoulders`,this.requiredPoints=5,this.id=`hs_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`LS`,`H`,`RS`,`L1`,`L2`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=ya,e.lineWidth=o?1.5:1;let d=[0,3,1,4,2].filter(e=>e<u);if(d.length>=2){e.beginPath(),e.moveTo(c[d[0]],l[d[0]]);for(let t=1;t<d.length;t++)e.lineTo(c[d[t]],l[d[t]]);e.stroke()}this.complete&&u===5&&(e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[3],l[3]),e.lineTo(c[1],l[1]),e.lineTo(c[4],l[4]),e.lineTo(c[2],l[2]),e.closePath(),e.fillStyle=ya+`10`,e.fill()),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=ya,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[3],l[3]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=ya;for(let t=0;t<u;t++){var f;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((f=s[t])==null?String(t):f,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length,u=[0,3,1,4,2].filter(e=>e<l);for(let n=0;n<u.length-1;n++){let r=u[n],i=u[n+1];if(va(e,t,s[r],c[r],s[i],c[i])<=_a)return!0}return l>=5&&va(e,t,s[3],c[3],s[4],c[4])<=_a}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=_a+2)return{pointIndex:s,cursor:`grab`}}return null}},xa=6;function Sa(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ca=`#ffa726`,wa=class{constructor(e){this.type=`trianglePattern`,this.requiredPoints=5,this.id=`tpat_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`1`,`2`,`3`,`4`,`5`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Ca,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=3&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Ca,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[2],l[2]),u>=5&&e.lineTo(c[4],l[4]),e.stroke(),e.restore()),u>=4&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Ca,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[1],l[1]),e.lineTo(c[3],l[3]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Ca;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t+1):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Sa(e,t,s[n],c[n],s[n+1],c[n+1])<=xa)return!0;return l>=3&&Sa(e,t,s[0],c[0],s[2],c[2])<=xa||l>=5&&Sa(e,t,s[2],c[2],s[4],c[4])<=xa||l>=4&&Sa(e,t,s[1],c[1],s[3],c[3])<=xa}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=xa+2)return{pointIndex:s,cursor:`grab`}}return null}},Ta=6;function Ea(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Da=`#66bb6a`,Oa=class{constructor(e){this.type=`threeDrives`,this.requiredPoints=7,this.id=`td_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`O`,`A`,`B`,`C`,`D`,`E`,`F`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Da,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);if(e.stroke(),this.complete&&u===7){e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.closePath(),e.fillStyle=Da+`18`,e.fill()}e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Da;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Ea(e,t,s[n],c[n],s[n+1],c[n+1])<=Ta)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ta+2)return{pointIndex:s,cursor:`grab`}}return null}},ka=6;function Aa(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var ja=`#42a5f5`,Ma=class{constructor(e){this.type=`abcdPattern`,this.requiredPoints=4,this.id=`abcd_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=ja,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=4&&(e.save(),e.setLineDash([3,4]),e.strokeStyle=ja,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[3],l[3]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=ja;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Aa(e,t,s[n],c[n],s[n+1],c[n+1])<=ka)return!0;return l>=4&&Aa(e,t,s[0],c[0],s[3],c[3])<=ka}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=ka+2)return{pointIndex:s,cursor:`grab`}}return null}},Na=6;function Pa(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Fa=`#ab47bc`,Ia=class{constructor(e){this.type=`cypherPattern`,this.requiredPoints=5,this.id=`cyp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Fa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);if(e.stroke(),this.complete&&u===5){e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.closePath(),e.fillStyle=Fa+`12`,e.fill()}e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Fa;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Pa(e,t,s[n],c[n],s[n+1],c[n+1])<=Na)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Na+2)return{pointIndex:s,cursor:`grab`}}return null}},La=6;function Ra(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var za=`#ec407a`,Ba=class{constructor(e){this.type=`butterflyPattern`,this.requiredPoints=5,this.id=`bfly_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=za,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=za,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=za;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Ra(e,t,s[n],c[n],s[n+1],c[n+1])<=La)return!0;return l>=5&&Ra(e,t,s[0],c[0],s[4],c[4])<=La}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=La+2)return{pointIndex:s,cursor:`grab`}}return null}},Va=6;function Ha(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Ua=`#26a69a`,Wa=class{constructor(e){this.type=`batPattern`,this.requiredPoints=5,this.id=`bat_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Ua,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Ua,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Ua;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Ha(e,t,s[n],c[n],s[n+1],c[n+1])<=Va)return!0;return l>=5&&Ha(e,t,s[0],c[0],s[4],c[4])<=Va}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Va+2)return{pointIndex:s,cursor:`grab`}}return null}},Ga=6;function Ka(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var qa=`#7986cb`,Ja=class{constructor(e){this.type=`gartleyPattern`,this.requiredPoints=5,this.id=`gart_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=qa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=qa,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=qa;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Ka(e,t,s[n],c[n],s[n+1],c[n+1])<=Ga)return!0;return l>=5&&Ka(e,t,s[0],c[0],s[4],c[4])<=Ga}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ga+2)return{pointIndex:s,cursor:`grab`}}return null}},Ya=6;function Xa(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Za=`#ef5350`,Qa=class{constructor(e){this.type=`crabPattern`,this.requiredPoints=5,this.id=`crab_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=Za,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=Za,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=Za;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(Xa(e,t,s[n],c[n],s[n+1],c[n+1])<=Ya)return!0;return l>=5&&Xa(e,t,s[0],c[0],s[4],c[4])<=Ya}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=Ya+2)return{pointIndex:s,cursor:`grab`}}return null}},$a=6;function eo(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var to=`#78909c`,no=class{constructor(e){this.type=`sharkPattern`,this.requiredPoints=5,this.id=`shrk_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=[`X`,`A`,`B`,`C`,`D`],c=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),l=this.points.map(e=>t.yToPixel(e.price,r,a)),u=c.length;e.save(),e.strokeStyle=to,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]);for(let t=1;t<u;t++)e.lineTo(c[t],l[t]);e.stroke(),u>=5&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=to,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(c[0],l[0]),e.lineTo(c[4],l[4]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`,e.fillStyle=to;for(let t=0;t<u;t++){var d;e.beginPath(),e.arc(c[t],l[t],o?4:3,0,Math.PI*2),e.fill(),e.fillText((d=s[t])==null?String(t):d,c[t]+5,l[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o)),l=s.length;for(let n=0;n<l-1;n++)if(eo(e,t,s[n],c[n],s[n+1],c[n+1])<=$a)return!0;return l>=5&&eo(e,t,s[0],c[0],s[4],c[4])<=$a}getHandle(e,t,n,r,i,a,o){if(this.points.length!==this.requiredPoints)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=$a+2)return{pointIndex:s,cursor:`grab`}}return null}},ro=6;function io(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var ao=`#29b6f6`,oo=[`0`,`1`,`2`,`3`,`4`,`5`],so=class{constructor(e){this.type=`elliottImpulse`,this.requiredPoints=6,this.id=`eimp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a)),l=s.length;e.save(),e.lineWidth=o?1.5:1;for(let t=0;t<l-1;t++)e.strokeStyle=t%2==0?ao:ao+`aa`,e.beginPath(),e.moveTo(s[t],c[t]),e.lineTo(s[t+1],c[t+1]),e.stroke();e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<l;t++){var u;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=ao,e.fill(),e.fillStyle=ao,e.fillText((u=oo[t])==null?String(t):u,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(io(e,t,s[n],c[n],s[n+1],c[n+1])<=ro)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=ro+2)return{pointIndex:s,cursor:`grab`}}return null}},co=6;function lo(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var uo=`#ff8a65`,fo=[`0`,`A`,`B`,`C`],po=class{constructor(e){this.type=`elliottCorrective`,this.requiredPoints=4,this.id=`ecor_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a));e.save(),e.strokeStyle=uo,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<s.length;t++)e.lineTo(s[t],c[t]);e.stroke(),e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<s.length;t++){var l;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=uo,e.fill(),e.fillStyle=uo,e.fillText((l=fo[t])==null?String(t):l,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(lo(e,t,s[n],c[n],s[n+1],c[n+1])<=co)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=co+2)return{pointIndex:s,cursor:`grab`}}return null}},mo=6;function ho(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var go=`#aed581`,_o=[`A`,`B`,`C`,`D`,`E`,`end`],vo=class{constructor(e){this.type=`elliottTriangle`,this.requiredPoints=6,this.id=`etri_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a)),l=s.length;e.save(),e.strokeStyle=go,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<l;t++)e.lineTo(s[t],c[t]);e.stroke(),l>=3&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=go+`aa`,e.lineWidth=1,e.beginPath(),e.moveTo(s[0],c[0]),l>2&&e.lineTo(s[2],c[2]),l>4&&e.lineTo(s[4],c[4]),e.stroke(),e.restore()),l>=4&&(e.save(),e.setLineDash([5,4]),e.strokeStyle=go+`aa`,e.lineWidth=1,e.beginPath(),e.moveTo(s[1],c[1]),e.lineTo(s[3],c[3]),e.stroke(),e.restore()),e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<l;t++){var u;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=go,e.fill(),e.fillStyle=go,e.fillText((u=_o[t])==null?String(t):u,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(ho(e,t,s[n],c[n],s[n+1],c[n+1])<=mo)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=mo+2)return{pointIndex:s,cursor:`grab`}}return null}},yo=6;function bo(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var xo=`#f48fb1`,So=[`W`,`X`,`Y`,`X2`,`Z`,`X3`,`end`],Co=class{constructor(e){this.type=`elliottCombination`,this.requiredPoints=7,this.id=`ecom_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a));e.save(),e.strokeStyle=xo,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<s.length;t++)e.lineTo(s[t],c[t]);e.stroke(),e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<s.length;t++){var l;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=xo,e.fill(),e.fillStyle=xo,e.fillText((l=So[t])==null?String(t):l,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(bo(e,t,s[n],c[n],s[n+1],c[n+1])<=yo)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=yo+2)return{pointIndex:s,cursor:`grab`}}return null}},wo=6;function To(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Eo=`#80cbc4`,Do=[`W`,`X`,`Y`,`end`],Oo=class{constructor(e){this.type=`elliottWxy`,this.requiredPoints=4,this.id=`ewxy_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>t.xToPixel(e.barIndex,n,i)),c=this.points.map(e=>t.yToPixel(e.price,r,a));e.save(),e.strokeStyle=Eo,e.lineWidth=o?1.5:1,e.beginPath(),e.moveTo(s[0],c[0]);for(let t=1;t<s.length;t++)e.lineTo(s[t],c[t]);e.stroke(),e.font=`11px 'Inter', system-ui, sans-serif`;for(let t=0;t<s.length;t++){var l;e.beginPath(),e.arc(s[t],c[t],o?4:3,0,Math.PI*2),e.fillStyle=Eo,e.fill(),e.fillStyle=Eo,e.fillText((l=Do[t])==null?String(t):l,s[t]+5,c[t]-5)}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>n.xToPixel(e.barIndex,r,a)),c=this.points.map(e=>n.yToPixel(e.price,i,o));for(let n=0;n<s.length-1;n++)if(To(e,t,s[n],c[n],s[n+1],c[n+1])<=wo)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(!this.complete)return null;for(let s=0;s<this.points.length;s++){let c=n.xToPixel(this.points[s].barIndex,r,a),l=n.yToPixel(this.points[s].price,i,o);if(Math.hypot(e-c,t-l)<=wo+2)return{pointIndex:s,cursor:`grab`}}return null}},ko=8;function Ao(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var jo=class{constructor(e){this.type=`brush`,this.openEnded=!0,this.id=`brush_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>({x:t.xToPixel(e.barIndex,n,i),y:t.yToPixel(e.price,r,a)})),c=this.complete?s.length:s.length-1;if(e.save(),e.strokeStyle=`#ff5722`,e.lineWidth=o?2.5:2,e.lineCap=`round`,e.lineJoin=`round`,c>=2){e.setLineDash([]),e.beginPath(),e.moveTo(s[0].x,s[0].y);for(let t=1;t<c;t++)e.lineTo(s[t].x,s[t].y);e.stroke()}if(!this.complete&&s.length>=2){let t=s.length-1;e.setLineDash([4,4]),e.beginPath(),e.moveTo(s[t-1].x,s[t-1].y),e.lineTo(s[t].x,s[t].y),e.stroke(),e.setLineDash([])}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>({x:n.xToPixel(e.barIndex,r,a),y:n.yToPixel(e.price,i,o)})),c=this.complete?s.length-1:s.length-2;for(let n=0;n<c;n++)if(Ao(e,t,s[n].x,s[n].y,s[n+1].x,s[n+1].y)<=ko)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length===0)return null;let s=[0,this.points.length-1];for(let c of s){let s=n.xToPixel(this.points[c].barIndex,r,a),l=n.yToPixel(this.points[c].price,i,o);if(Math.hypot(e-s,t-l)<=ko+2)return{pointIndex:c,cursor:`grab`}}return null}},Mo=12;function No(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Po=class{constructor(e){this.type=`highlighter`,this.openEnded=!0,this.id=`hl2_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let s=this.points.map(e=>({x:t.xToPixel(e.barIndex,n,i),y:t.yToPixel(e.price,r,a)})),c=this.complete?s.length:s.length-1;if(e.save(),e.strokeStyle=`#ffeb3b66`,e.lineWidth=12,e.lineCap=`round`,e.lineJoin=`round`,c>=2){e.setLineDash([]),e.beginPath(),e.moveTo(s[0].x,s[0].y);for(let t=1;t<c;t++)e.lineTo(s[t].x,s[t].y);e.stroke()}if(!this.complete&&s.length>=2){let t=s.length-1;e.setLineDash([8,6]),e.beginPath(),e.moveTo(s[t-1].x,s[t-1].y),e.lineTo(s[t].x,s[t].y),e.stroke(),e.setLineDash([])}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let s=this.points.map(e=>({x:n.xToPixel(e.barIndex,r,a),y:n.yToPixel(e.price,i,o)})),c=this.complete?s.length-1:s.length-2;for(let n=0;n<c;n++)if(No(e,t,s[n].x,s[n].y,s[n+1].x,s[n+1].y)<=Mo)return!0;return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length===0)return null;let s=[0,this.points.length-1];for(let c of s){let s=n.xToPixel(this.points[c].barIndex,r,a),l=n.yToPixel(this.points[c].price,i,o);if(Math.hypot(e-s,t-l)<=Mo+2)return{pointIndex:c,cursor:`grab`}}return null}},Fo=6,Io=class{constructor(e){this.type=`sineLine`,this.id=`sine_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=d-l,m=Math.abs(f-u)/2,h=(u+f)/2;if(e.save(),e.strokeStyle=`#ce93d8`,e.lineWidth=o?1.5:1,e.beginPath(),Math.abs(p)<1)e.moveTo(l,u),e.lineTo(d,f);else{e.moveTo(l,h+m*Math.sin(0));let t=p>0?1:-1,n=d;for(let r=l+t;p>0?r<=n:r>=n;r+=t){let t=(r-l)/p,n=h+m*Math.sin(2*Math.PI*t);e.lineTo(r,n)}e.lineTo(d,h+m*Math.sin(2*Math.PI))}e.stroke(),e.fillStyle=`#ce93d8`;for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,o?4:3,0,Math.PI*2),e.fill();e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=d-l,m=Math.abs(f-u)/2,h=(u+f)/2;if(Math.abs(p)<1)return Math.hypot(e-l,t-h)<=Fo;let g=p>0?5:-5,_=l,v=h+m*Math.sin(0);for(let n=l+g;p>0?n<=d+Math.abs(g):n>=d-Math.abs(g);n+=g){let r=p>0?Math.min(n,d):Math.max(n,d),i=(r-l)/p,a=h+m*Math.sin(2*Math.PI*i);if(Math.hypot(e-r,t-a)<=Fo)return!0;let o=r-_,s=a-v,c=o*o+s*s;if(c>0){let n=Math.max(0,Math.min(1,((e-_)*o+(t-v)*s)/c)),r=_+n*o,i=v+n*s;if(Math.hypot(e-r,t-i)<=Fo)return!0}if(_=r,v=a,r===d)break}return!1}getHandle(e,t,n,r,i,a,o){let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Fo+2)return{pointIndex:n,cursor:`grab`};return null}},Lo=6,Ro=class{constructor(e){this.type=`cyclicLines`,this.id=`cyc_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=Math.abs(c.barIndex-s.barIndex);if(l===0)return;let u=t.xToPixel(s.barIndex,n,i),d=`#7986cb`;e.save(),e.strokeStyle=d,e.lineWidth=o?1.5:1,e.setLineDash([4,3]);for(let r=0;r<=8;r++){let o=s.barIndex+l*r,c=t.xToPixel(o,n,i);if(c>i)break;e.beginPath(),e.moveTo(c,0),e.lineTo(c,a),e.stroke()}e.setLineDash([]);let f=t.xToPixel(c.barIndex,n,i);e.fillStyle=d,e.beginPath(),e.arc(u,a/2,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(f,a/2,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=Math.abs(c.barIndex-s.barIndex);if(l===0)return!1;for(let t=0;t<=8;t++){let i=s.barIndex+l*t,o=n.xToPixel(i,r,a);if(o>a)break;if(Math.abs(e-o)<=Lo)return!0}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:o/2},{px:n.xToPixel(this.points[1].barIndex,r,a),py:o/2}],c=[`move`,`ew-resize`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Lo+2)return{pointIndex:n,cursor:c[n]};return null}},zo=6,Bo=class{constructor(e){this.type=`timeCycles`,this.id=`tcy_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=Math.abs(c.barIndex-s.barIndex);if(l===0)return;let u=`#80cbc4`;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1;let d=[];for(let e=0;e<=6;e++){let r=s.barIndex+l*e,a=t.xToPixel(r,n,i);if(a>i)break;d.push(a)}for(let t=0;t+1<d.length;t++)t%2==0&&(e.fillStyle=`#80cbc410`,e.fillRect(d[t],0,d[t+1]-d[t],a));e.strokeStyle=u,e.setLineDash([]);for(let t=0;t<d.length;t++)e.beginPath(),e.moveTo(d[t],0),e.lineTo(d[t],a),e.stroke(),e.fillStyle=u,e.fillText(String(t+1),d[t]+3,14);let f=t.xToPixel(s.barIndex,n,i),p=t.xToPixel(c.barIndex,n,i);e.fillStyle=u,e.beginPath(),e.arc(f,a/2,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(p,a/2,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=Math.abs(c.barIndex-s.barIndex);if(l===0)return!1;for(let t=0;t<=6;t++){let i=s.barIndex+l*t,o=n.xToPixel(i,r,a);if(o>a)break;if(Math.abs(e-o)<=zo)return!0;if(t<6){let i=s.barIndex+l*(t+1),c=n.xToPixel(i,r,a);if(e>=o&&e<=c)return!0}}return!1}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:o/2},{px:n.xToPixel(this.points[1].barIndex,r,a),py:o/2}],c=[`move`,`ew-resize`];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=zo+2)return{pointIndex:n,cursor:c[n]};return null}},Vo=6;function Ho(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c));return Math.hypot(e-(n+l*o),t-(r+l*s))}var Uo=class{constructor(e){this.type=`projection`,this.id=`proj_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=`#78909c`,m=d-l,h,g;if(Math.abs(m)<.001)h=d,g=f+(f-u);else{let e=(f-u)/m;h=i,g=f+e*(i-d)}e.save(),e.strokeStyle=p,e.fillStyle=p,e.lineWidth=o?1.5:1,e.setLineDash([]),e.beginPath(),e.moveTo(l,u),e.lineTo(d,f),e.stroke(),e.setLineDash([6,3]),e.beginPath(),e.moveTo(d,f),e.lineTo(h,g),e.stroke(),e.setLineDash([]),e.beginPath(),e.arc(l,u,o?4:3,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(d,f,o?4:3,0,Math.PI*2),e.fill(),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=d-l,m,h;if(Math.abs(p)<.001)m=d,h=f+(f-u);else{let e=(f-u)/p;m=a,h=f+e*(a-d)}return Ho(e,t,l,u,d,f)<=Vo||Ho(e,t,d,f,m,h)<=Vo}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Vo+2)return{pointIndex:n,cursor:`grab`};return null}},Wo=6;function Go(e,t,n,r,i,a=7){let o=Math.atan2(i-n,r-t);e.beginPath(),e.moveTo(r,i),e.lineTo(r-a*Math.cos(o-Math.PI/6),i-a*Math.sin(o-Math.PI/6)),e.lineTo(r-a*Math.cos(o+Math.PI/6),i-a*Math.sin(o+Math.PI/6)),e.closePath(),e.fill()}var Ko=class{constructor(e){this.type=`priceProjection`,this.id=`pp_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o,s=2){if(this.points.length<2)return;let[c,l]=this.points,u=t.xToPixel(c.barIndex,n,i),d=t.yToPixel(c.price,r,a),f=t.xToPixel(l.barIndex,n,i),p=t.yToPixel(l.price,r,a),m=Math.min(u,f),h=Math.max(u,f),g=Math.min(d,p),_=Math.max(d,p),v=h-m,y=_-g,b=m+v/2;g+y/2;let x=(c.price+l.price)/2,S=`#ef9a9a`;e.save(),e.font=`10px 'Inter', system-ui, sans-serif`,e.lineWidth=o?1.5:1,e.fillStyle=`#ef9a9a18`,e.fillRect(m,g,v,y),e.strokeStyle=S,e.beginPath(),e.moveTo(m,d),e.lineTo(h,d),e.stroke();let C=t.yToPixel(x,r,a);e.beginPath(),e.moveTo(m,C),e.lineTo(h,C),e.stroke(),e.beginPath(),e.moveTo(m,p),e.lineTo(h,p),e.stroke(),e.fillStyle=S,e.fillText(c.price.toFixed(s),h+4,d+4),e.fillText(x.toFixed(s),h+4,C+4),e.fillText(l.price.toFixed(s),h+4,p+4),e.fillStyle=S,e.beginPath(),e.moveTo(b,g),e.lineTo(b,_),e.stroke(),Go(e,b,_,b,g),Go(e,b,g,b,_),e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o);return e>=Math.min(l,d)&&e<=Math.max(l,d)&&t>=Math.min(u,f)&&t<=Math.max(u,f)}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[{px:n.xToPixel(this.points[0].barIndex,r,a),py:n.yToPixel(this.points[0].price,i,o)},{px:n.xToPixel(this.points[1].barIndex,r,a),py:n.yToPixel(this.points[1].price,i,o)}];for(let n=0;n<s.length;n++)if(Math.hypot(e-s[n].px,t-s[n].py)<=Wo+2)return{pointIndex:n,cursor:`ns-resize`};return null}},qo=6,Jo=`#90a4ae`,Yo=class{constructor(e){this.type=`ghostFeed`,this.id=`gfeed_${Date.now()}_${Math.random().toString(36).slice(2)}`,this.points=[e,{...e}],this.complete=!1}render(e,t,n,r,i,a,o){if(this.points.length<2)return;let[s,c]=this.points,l=t.xToPixel(s.barIndex,n,i),u=t.yToPixel(s.price,r,a),d=t.xToPixel(c.barIndex,n,i),f=t.yToPixel(c.price,r,a),p=Math.min(l,d),m=Math.min(u,f),h=Math.abs(d-l),g=Math.abs(f-u);e.save(),e.fillStyle=Jo+`08`,e.fillRect(p,m,h,g),e.strokeStyle=Jo,e.lineWidth=o?1.5:1,e.setLineDash([6,4]),e.strokeRect(p,m,h,g),e.setLineDash([]),e.save(),e.beginPath(),e.rect(p,m,h,g),e.clip(),e.strokeStyle=Jo+`30`,e.lineWidth=1,e.setLineDash([4,4]);let _=h+g;for(let t=-g;t<=_;t+=20){let n=p+t,r=m,i=p+t+g,a=m+g;e.beginPath(),e.moveTo(n,r),e.lineTo(i,a),e.stroke()}if(e.setLineDash([]),e.restore(),e.font=`12px 'Inter', system-ui, sans-serif`,e.fillStyle=Jo,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(`Ghost Feed`,p+h/2,m+g/2),o){e.textAlign=`left`,e.textBaseline=`alphabetic`;for(let[t,n]of[[l,u],[d,f]])e.beginPath(),e.arc(t,n,3.5,0,Math.PI*2),e.fillStyle=Jo,e.fill()}e.restore()}hitTest(e,t,n,r,i,a,o){if(this.points.length<2)return!1;let[s,c]=this.points,l=n.xToPixel(s.barIndex,r,a),u=n.yToPixel(s.price,i,o),d=n.xToPixel(c.barIndex,r,a),f=n.yToPixel(c.price,i,o),p=Math.min(l,d)-qo,m=Math.min(u,f)-qo,h=Math.abs(d-l)+qo*2,g=Math.abs(f-u)+qo*2;return e>=p&&e<=p+h&&t>=m&&t<=m+g}getHandle(e,t,n,r,i,a,o){if(this.points.length<2)return null;let s=[[0,n.xToPixel(this.points[0].barIndex,r,a),n.yToPixel(this.points[0].price,i,o)],[1,n.xToPixel(this.points[1].barIndex,r,a),n.yToPixel(this.points[1].price,i,o)]];for(let[n,r,i]of s)if(Math.hypot(e-r,t-i)<=qo+2)return{pointIndex:n,cursor:`nwse-resize`};return null}},Xo=new Set([`text`,`callout`,`anchoredNote`]),Zo=class{constructor(){this.drawings=[],this.activeDrawing=null,this.selectedDrawing=null,this.activeTool=null,this.state=`idle`,this.history=[],this.redoStack=[],this.onCompleteCallback=null,this.onDrawingsChange=null,this.onStartTextEdit=null,this.onPointsMutated=null,this.editingText=!1,this.dragDrawing=null,this.dragStartMouse=null,this.dragStartPoints=null,this.resizeDrawing=null,this.resizePointIndex=-1}setOnComplete(e){this.onCompleteCallback=e}setEditingText(e){this.editingText=e}setActiveTool(e){this.state===`placing`&&this.activeDrawing&&this.drawings.pop(),this.activeTool=e,this.state=`idle`,this.activeDrawing=null}getActiveTool(){return this.activeTool}onMouseDown(e){if(!this.activeTool)return!1;if(this.state===`idle`){if(this.snapshot(),this.activeDrawing=this.createDrawing(this.activeTool,e),this.drawings.push(this.activeDrawing),this.activeDrawing.complete){var t;let e=this.activeDrawing;if(this.selectedDrawing=e,this.activeDrawing=null,this.activeTool=null,(t=this.onCompleteCallback)==null||t.call(this),this.notifyChange(),Xo.has(e.type)){var n;(n=this.onStartTextEdit)==null||n.call(this,e)}}else this.state=`placing`;return!0}if(this.state===`placing`&&this.activeDrawing){var r,i,a;if((r=this.activeDrawing.openEnded)!=null&&r){let t=this.activeDrawing.points.length-1;return this.activeDrawing.points[t]={...e},this.activeDrawing.points.push({...e}),!0}let t=(i=this.activeDrawing.requiredPoints)==null?2:i,n=this.activeDrawing.points.length;if(this.activeDrawing.points[n-1]={...e},n<t)return this.activeDrawing.points.push({...e}),!0;this.activeDrawing.complete=!0;let s=this.activeDrawing;if(this.selectedDrawing=s,this.activeDrawing=null,this.state=`idle`,this.activeTool=null,(a=this.onCompleteCallback)==null||a.call(this),this.notifyChange(),Xo.has(s.type)){var o;(o=this.onStartTextEdit)==null||o.call(this,s)}return!0}return!1}onMouseMove(e){if(this.state===`placing`&&this.activeDrawing){let t=this.activeDrawing.points.length-1;this.activeDrawing.points[t]=e}if(this.dragDrawing&&this.dragStartMouse&&this.dragStartPoints){var t;let n=e.barIndex-this.dragStartMouse.barIndex,r=e.price-this.dragStartMouse.price;for(let e=0;e<this.dragDrawing.points.length;e++){let t=this.dragStartPoints[e];t&&(this.dragDrawing.points[e]={barIndex:t.barIndex+n,price:t.price+r})}(t=this.onPointsMutated)==null||t.call(this,this.dragDrawing)}if(this.resizeDrawing&&this.resizePointIndex>=0){var n;this.resizeDrawing.points[this.resizePointIndex]={...e},(n=this.onPointsMutated)==null||n.call(this,this.resizeDrawing)}}finalizePlacing(){var e,t;if(!(this.state!==`placing`||!this.activeDrawing)&&(e=this.activeDrawing.openEnded)!=null&&e){if(this.activeDrawing.points.length>2&&this.activeDrawing.points.pop(),this.activeDrawing.points.length<2){this.drawings.pop(),this.activeDrawing=null,this.state=`idle`,this.activeTool=null;return}this.activeDrawing.complete=!0,this.selectedDrawing=this.activeDrawing,this.activeDrawing=null,this.state=`idle`,this.activeTool=null,(t=this.onCompleteCallback)==null||t.call(this),this.notifyChange()}}startDrag(e,t){this.snapshot(),this.dragDrawing=e,this.dragStartMouse={...t},this.dragStartPoints=e.points.map(e=>({...e}))}endDrag(){this.dragDrawing=null,this.dragStartMouse=null,this.dragStartPoints=null,this.notifyChange()}isDraggingDrawing(){return this.dragDrawing!==null}isPlacing(){return this.state===`placing`}startResize(e,t){this.snapshot(),this.resizeDrawing=e,this.resizePointIndex=t}endResize(){this.resizeDrawing=null,this.resizePointIndex=-1,this.notifyChange()}isResizingDrawing(){return this.resizeDrawing!==null}shiftBarIndices(e){for(let t of this.drawings)for(let n of t.points)n.barIndex+=e;if(this.dragStartPoints)for(let t of this.dragStartPoints)t.barIndex+=e}getHandleAtPoint(e,t,n,r,i,a,o){for(let s=this.drawings.length-1;s>=0;s--){let c=this.drawings[s];if(!c.complete||c.visible===!1||c.locked)continue;let l=c.getHandle(e,t,n,r,i,a,o);if(l)return{drawing:c,handle:l}}return null}hitTest(e,t,n,r,i,a,o){for(let s=this.drawings.length-1;s>=0;s--){let c=this.drawings[s];if(!(c.visible===!1||c.locked)&&c.hitTest(e,t,n,r,i,a,o))return c}return null}selectDrawing(e){this.selectedDrawing=e}getSelectedDrawing(){return this.selectedDrawing}onKeyDown(e){return e===`Escape`?(this.state===`placing`&&this.activeDrawing&&(this.drawings.pop(),this.activeDrawing=null,this.state=`idle`),this.activeTool=null,this.selectedDrawing=null,!0):(e===`Delete`||e===`Backspace`)&&this.selectedDrawing&&!this.editingText?(this.deleteSelected(),!0):e===`z`&&this.history.length>0?(this.undo(),!0):!1}deleteSelected(){this.selectedDrawing&&(this.snapshot(),this.drawings=this.drawings.filter(e=>e!==this.selectedDrawing),this.selectedDrawing=null,this.notifyChange())}undo(){let e=this.history.pop();e!==void 0&&(this.redoStack.push(this.cloneDrawings(this.drawings)),this.drawings=e,this.selectedDrawing=null,this.notifyChange())}redo(){let e=this.redoStack.pop();e!==void 0&&(this.history.push(this.cloneDrawings(this.drawings)),this.drawings=e,this.selectedDrawing=null,this.notifyChange())}hideAll(){if(this.drawings.length!==0){this.snapshot();for(let e of this.drawings)e.visible=!1;this.selectedDrawing=null,this.notifyChange()}}showAll(){if(this.drawings.length!==0){this.snapshot();for(let e of this.drawings)e.visible=!0;this.notifyChange()}}lockAll(){if(this.drawings.length!==0){this.snapshot();for(let e of this.drawings)e.locked=!0;this.selectedDrawing=null,this.notifyChange()}}unlockAll(){if(this.drawings.length!==0){this.snapshot();for(let e of this.drawings)e.locked=!1;this.notifyChange()}}render(e,t,n,r,i,a,o=2){if(e.clearRect(0,0,e.canvas.width,e.canvas.height),this.drawings.length===0)return;let s=window.devicePixelRatio||1;e.save(),e.scale(s,s);for(let s of this.drawings)s.visible!==!1&&s.render(e,t,n,r,i,a,s===this.selectedDrawing,o);e.restore()}getDrawings(){return[...this.drawings]}getDrawingsSnapshot(){return this.drawings.map(e=>({id:e.id,type:e.type,points:e.points.map(e=>({...e})),complete:e.complete,...e.visible!==void 0&&{visible:e.visible},...e.locked!==void 0&&{locked:e.locked},...e.text!==void 0&&{text:e.text}}))}loadDrawings(e){this.drawings=e.map(e=>{var t;let n=this.createDrawing(e.type,(t=e.points[0])==null?{barIndex:0,price:0}:t);return n.id=e.id,n.points=e.points.map(e=>({...e})),n.complete=e.complete,e.visible!==void 0&&(n.visible=e.visible),e.locked!==void 0&&(n.locked=e.locked),e.text!==void 0&&(n.text=e.text),n}),this.selectedDrawing=null,this.activeDrawing=null,this.history=[this.drawings.map(e=>({...e,points:e.points.map(e=>({...e}))}))],this.redoStack=[]}clearAll(){this.drawings.length!==0&&(this.snapshot(),this.drawings=[],this.selectedDrawing=null,this.activeDrawing=null,this.notifyChange())}notifyChange(){var e;(e=this.onDrawingsChange)==null||e.call(this)}snapshot(){this.history.push(this.cloneDrawings(this.drawings)),this.history.length>50&&this.history.shift(),this.redoStack=[]}cloneDrawings(e){return e.map(e=>{let t=Object.create(Object.getPrototypeOf(e));return Object.assign(t,e),t.points=e.points.map(e=>({...e})),t})}createDrawing(e,t){switch(e){case`horizontalLine`:return new Sn(t);case`verticalLine`:return new wn(t);case`trendLine`:return new Dn(t);case`trendAngle`:return new An(t);case`crossLine`:return new Mn(t);case`parallelChannel`:return new Fn(t);case`flatChannel`:return new Rn(t);case`disjointChannel`:return new Vn(t);case`fibRetracement`:return new Gn(t);case`fibExtension`:return new Yn(t);case`fibChannel`:return new er(t);case`fibTimezone`:return new rr(t);case`fibCircles`:return new sr(t);case`fibSpiral`:return new ur(t);case`fibFan`:return new gr(t);case`fibProjection`:return new br(t);case`gannFan`:return new wr(t);case`gannSquare`:return new Er(t);case`gannBox`:return new Or(t);case`rectangle`:return new Ar(t);case`rotatedRectangle`:return new Nr(t);case`ellipse`:return new Fr(t);case`triangle`:return new Rr(t);case`circle`:return new Br(t);case`arc`:return new Ur(t);case`polyline`:return new Kr(t);case`path`:return new Yr(t);case`priceRange`:return new Qr(t);case`dateRange`:return new ti(t);case`datePriceRange`:return new ii(t);case`ruler`:return new si(t);case`pitchfork`:return new di(t);case`schiffPitchfork`:return new hi(t);case`modifiedSchiff`:return new yi(t);case`insidePitchfork`:return new Ci(t);case`fixedRangeVP`:return new Di(t);case`anchoredVP`:return new ji(t);case`volumeProfile`:return new Fi(t);case`regressionTrend`:return new Ri(t);case`text`:return new Hi(t);case`callout`:return new Yi(t);case`priceLabel`:return new ea(t);case`arrowMarker`:return new ra(t);case`flag`:return new ia(t);case`priceNote`:return new la(t);case`anchoredNote`:return new ma(t);case`arrowUp`:return new ha(t);case`arrowDown`:return new ga(t);case`headShoulders`:return new ba(t);case`trianglePattern`:return new wa(t);case`threeDrives`:return new Oa(t);case`abcdPattern`:return new Ma(t);case`cypherPattern`:return new Ia(t);case`butterflyPattern`:return new Ba(t);case`batPattern`:return new Wa(t);case`gartleyPattern`:return new Ja(t);case`crabPattern`:return new Qa(t);case`sharkPattern`:return new no(t);case`elliottImpulse`:return new so(t);case`elliottCorrective`:return new po(t);case`elliottTriangle`:return new vo(t);case`elliottCombination`:return new Co(t);case`elliottWxy`:return new Oo(t);case`brush`:return new jo(t);case`highlighter`:return new Po(t);case`sineLine`:return new Io(t);case`cyclicLines`:return new Ro(t);case`timeCycles`:return new Bo(t);case`projection`:return new Uo(t);case`priceProjection`:return new Ko(t);case`ghostFeed`:return new Yo(t);default:return new Dn(t)}}},Qo=2,$o=class{constructor(e,t=y,n=C.chart){this.pills=new Map,this.isOpen=!1,this.onDocClick=e=>{this.isOpen&&!this.el.contains(e.target)&&(this.isOpen=!1,this.dropdownPanel.style.display=`none`,this.collapseBtn.textContent=this.labels.nIndicators.replace(`{count}`,String(this.pills.size)))},this.theme=e,this.cfg=t,this.labels=n,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`absolute`,top:`52px`,left:`6px`,zIndex:`10`,display:`none`,alignItems:`center`,gap:`10px`,pointerEvents:`auto`}),this.inlineRow=document.createElement(`div`),Object.assign(this.inlineRow.style,{display:`flex`,alignItems:`center`,gap:`10px`}),this.collapseBtn=document.createElement(`button`),Object.assign(this.collapseBtn.style,{display:`none`,alignItems:`center`,gap:`4px`,background:this.theme.indicatorOverlay.pillBg,color:this.theme.axisText,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`4px`,padding:`2px 8px`,fontSize:this.cfg.collapseBtnFontSize,fontFamily:this.cfg.collapseBtnFontFamily,cursor:`pointer`,outline:`none`}),this.collapseBtn.addEventListener(`click`,e=>{e.stopPropagation(),this.toggleDropdown()}),this.dropdownPanel=document.createElement(`div`),Object.assign(this.dropdownPanel.style,{display:`none`,position:`absolute`,top:`100%`,left:`0`,marginTop:`4px`,background:this.theme.tooltip.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`4px`,padding:`4px 0`,minWidth:`140px`,zIndex:`20`,boxShadow:`0 4px 12px rgba(0,0,0,0.15)`});let r=document.createElement(`div`);Object.assign(r.style,{position:`relative`}),r.append(this.collapseBtn,this.dropdownPanel),this.el.append(this.inlineRow,r),document.addEventListener(`click`,this.onDocClick)}addPill(e,t,n,r=`Chart`,i=!0,a,o=null,s){this.pills.has(e)||(this.pills.set(e,{color:t,label:n,timeframe:r,visible:i,onRemove:a,onEdit:o,onToggleVisibility:s}),this.refresh())}updatePillColor(e,t){let n=this.pills.get(e);n&&(n.color=t,this.refresh())}updatePillLabel(e,t){let n=this.pills.get(e);n&&(n.label=t,this.refresh())}updatePillTimeframe(e,t){let n=this.pills.get(e);n&&(n.timeframe=t,this.refresh())}updatePillVisibility(e,t){let n=this.pills.get(e);n&&(n.visible=t,this.refresh())}removePill(e){this.pills.has(e)&&(this.pills.delete(e),this.refresh())}setTheme(e){this.theme=e,Object.assign(this.collapseBtn.style,{background:e.indicatorOverlay.pillBg,color:e.axisText,border:`1px solid ${e.axisBorder}`}),Object.assign(this.dropdownPanel.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`}),this.refresh()}destroy(){document.removeEventListener(`click`,this.onDocClick)}refresh(){let e=Array.from(this.pills.entries());if(this.inlineRow.innerHTML=``,this.dropdownPanel.innerHTML=``,e.length===0){this.el.style.display=`none`,this.collapseBtn.style.display=`none`;return}if(this.el.style.display=`flex`,e.length<=Qo){this.isOpen=!1,this.dropdownPanel.style.display=`none`,this.collapseBtn.style.display=`none`;for(let[t,n]of e)this.inlineRow.appendChild(this.makePill(t,n))}else{this.collapseBtn.style.display=`inline-flex`,this.collapseBtn.textContent=this.labels.nIndicators.replace(`{count}`,String(e.length));for(let[t,n]of e)this.dropdownPanel.appendChild(this.makeDropdownRow(t,n));this.dropdownPanel.style.display=this.isOpen?`block`:`none`}}makeTimeframeBadge(e){if(!e||e===`Chart`)return null;let t=document.createElement(`span`);return t.textContent=e,Object.assign(t.style,{fontSize:`10px`,padding:`1px 4px`,borderRadius:`3px`,background:`rgba(128,128,128,0.18)`,color:this.theme.axisText,marginLeft:`2px`,lineHeight:`1.4`}),t}makeEyeIcon(e){let t=document.createElement(`span`);return t.innerHTML=e.visible?Wt:Gt,Object.assign(t.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`,opacity:e.visible?`0.6`:`0.4`,lineHeight:`1`}),t.addEventListener(`mouseenter`,()=>{t.style.opacity=`1`}),t.addEventListener(`mouseleave`,()=>{t.style.opacity=e.visible?`0.6`:`0.4`}),t.addEventListener(`click`,t=>{t.stopPropagation(),e.onToggleVisibility()}),t}makePill(e,t){let n=document.createElement(`span`);Object.assign(n.style,{display:`inline-flex`,alignItems:`center`,gap:`4px`,fontSize:this.cfg.pillFontSize,fontFamily:this.cfg.pillFontFamily,color:t.color,whiteSpace:`nowrap`,userSelect:`none`,background:this.theme.indicatorOverlay.pillBg,borderRadius:`4px`,padding:`1px 6px 1px 5px`,opacity:t.visible?`1`:`0.4`});let r=document.createElement(`span`);r.innerHTML=$t,Object.assign(r.style,{display:`inline-flex`,alignItems:`center`});let i=document.createElement(`span`);i.textContent=t.label;let a=this.makeTimeframeBadge(t.timeframe),o=document.createElement(`span`);if(Object.assign(o.style,{display:`inline-flex`,alignItems:`center`,gap:`8px`,marginLeft:`12px`}),o.appendChild(this.makeEyeIcon(t)),t.onEdit){let e=document.createElement(`span`);e.innerHTML=Pt,Object.assign(e.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`,opacity:`0.6`,lineHeight:`1`}),e.addEventListener(`mouseenter`,()=>{e.style.opacity=`1`}),e.addEventListener(`mouseleave`,()=>{e.style.opacity=`0.6`}),e.addEventListener(`click`,e=>{e.stopPropagation(),t.onEdit()}),o.appendChild(e)}let s=document.createElement(`span`);return s.innerHTML=It,Object.assign(s.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`}),s.addEventListener(`click`,e=>{e.stopPropagation(),t.onRemove()}),o.appendChild(s),n.append(r,i),a&&n.appendChild(a),n.appendChild(o),n}makeDropdownRow(e,t){let n=document.createElement(`div`);Object.assign(n.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`8px`,padding:`4px 10px`,fontSize:this.cfg.dropdownRowFontSize,fontFamily:this.cfg.dropdownRowFontFamily,color:t.color,cursor:`default`,opacity:t.visible?`1`:`0.4`}),n.addEventListener(`mouseenter`,()=>{n.style.background=this.theme.indicatorOverlay.dropdownHoverBg}),n.addEventListener(`mouseleave`,()=>{n.style.background=`transparent`});let r=document.createElement(`span`);r.innerHTML=$t,Object.assign(r.style,{display:`inline-flex`,alignItems:`center`});let i=document.createElement(`span`);Object.assign(i.style,{display:`inline-flex`,alignItems:`center`,gap:`4px`,flex:`1`});let a=document.createElement(`span`);a.textContent=t.label,i.appendChild(a);let o=this.makeTimeframeBadge(t.timeframe);o&&i.appendChild(o);let s=document.createElement(`span`);Object.assign(s.style,{display:`inline-flex`,alignItems:`center`,gap:`4px`});let c=document.createElement(`span`);if(c.innerHTML=t.visible?Wt:Gt,Object.assign(c.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`,opacity:t.visible?`0.6`:`0.4`,lineHeight:`1`}),c.addEventListener(`mouseenter`,()=>{c.style.opacity=`1`}),c.addEventListener(`mouseleave`,()=>{c.style.opacity=t.visible?`0.6`:`0.4`}),c.addEventListener(`click`,e=>{e.stopPropagation(),t.onToggleVisibility()}),s.appendChild(c),t.onEdit){let e=document.createElement(`span`);e.innerHTML=Pt,Object.assign(e.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`,opacity:`0.6`,lineHeight:`1`}),e.addEventListener(`mouseenter`,()=>{e.style.opacity=`1`}),e.addEventListener(`mouseleave`,()=>{e.style.opacity=`0.6`}),e.addEventListener(`click`,e=>{e.stopPropagation(),this.isOpen=!1,this.dropdownPanel.style.display=`none`,t.onEdit()}),s.appendChild(e)}let l=document.createElement(`span`);return l.innerHTML=It,Object.assign(l.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.indicatorOverlay.iconColor,cursor:`pointer`}),l.addEventListener(`click`,e=>{e.stopPropagation(),t.onRemove()}),s.appendChild(l),n.append(r,i,s),n}toggleDropdown(){this.isOpen=!this.isOpen,this.dropdownPanel.style.display=this.isOpen?`block`:`none`,this.collapseBtn.textContent=this.labels.nIndicators.replace(`{count}`,String(this.pills.size))}},es=class{constructor(e,t=C.dialogs,n){this.schema=null,this.currentParams={},this.onUpdate=null,this.onRemove=null,this.inputRefs=new Map,this.disposeKbd=()=>{},this.theme=e,this.labels=t,this.onVisibilityChange=n,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`fixed`,inset:`0`,background:`rgba(0,0,0,0.5)`,display:`none`,alignItems:`center`,justifyContent:`center`,zIndex:`1000`}),this.el.addEventListener(`mousedown`,e=>{e.target===this.el&&this.hide()}),this.panel=document.createElement(`div`),Object.assign(this.panel.style,{display:`flex`,flexDirection:`column`,minWidth:`300px`,maxWidth:`360px`,background:this.theme.tooltip.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`6px`,boxShadow:`0 8px 32px rgba(0,0,0,0.45)`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:`12px`,overflow:`hidden`}),this.panel.addEventListener(`mousedown`,e=>e.stopPropagation()),this.el.appendChild(this.panel),this.disposeKbd=ln(this.panel)}show(e,t,n,r){var i;let a=this.isVisible;this.schema=e,this.currentParams={...t},this.onUpdate=n,this.onRemove=r,this.rebuild(),this.el.style.display=`flex`,a||(i=this.onVisibilityChange)==null||i.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,this.schema=null,this.onUpdate=null,this.onRemove=null,t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setTheme(e){this.theme=e,Object.assign(this.panel.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`}),this.el.style.display!==`none`&&this.schema&&this.rebuild()}destroy(){this.disposeKbd(),this.el.remove()}rebuild(){this.panel.innerHTML=``,this.inputRefs.clear(),this.schema&&(this.panel.appendChild(this.buildHeader(this.schema.shortName)),this.panel.appendChild(this.buildBody(this.schema.fields)),this.panel.appendChild(this.buildFooter()))}buildHeader(e){let t=document.createElement(`div`);Object.assign(t.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`10px 14px`,borderBottom:`1px solid ${this.theme.axisBorder}`});let n=document.createElement(`span`);n.textContent=`${e} ${this.labels.indicator.titleSuffix}`,Object.assign(n.style,{color:this.theme.tooltip.text,fontWeight:`600`,fontSize:`13px`});let r=document.createElement(`span`);return r.innerHTML=It,Object.assign(r.style,{display:`inline-flex`,alignItems:`center`,color:this.theme.axisText,cursor:`pointer`}),r.addEventListener(`mouseenter`,()=>{r.style.color=this.theme.tooltip.text}),r.addEventListener(`mouseleave`,()=>{r.style.color=this.theme.axisText}),r.addEventListener(`click`,()=>this.hide()),t.append(n,r),t}buildBody(e){let t=document.createElement(`div`);if(Object.assign(t.style,{padding:`12px 14px`,display:`flex`,flexDirection:`column`,gap:`8px`}),e.length===0){let e=document.createElement(`span`);return e.textContent=this.labels.indicator.noParams,Object.assign(e.style,{color:this.theme.axisText,fontSize:`11px`}),t.appendChild(e),t}for(let n of e)t.appendChild(this.buildField(n));return t}buildField(e){var t;let n=document.createElement(`div`);Object.assign(n.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`10px`});let r=document.createElement(`label`);r.textContent=e.label,Object.assign(r.style,{color:this.theme.axisText,fontSize:`12px`,flex:`1`});let i=(t=this.currentParams[e.key])==null?e.default:t;if(e.kind===`number`){let t=document.createElement(`input`);t.type=`number`,t.min=String(e.min),t.max=String(e.max),t.step=String(e.step),t.value=String(i),Object.assign(t.style,{width:`80px`,background:this.theme.background,color:this.theme.tooltip.text,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`3px`,padding:`4px 6px`,fontSize:`16px`,fontFamily:`'Inter', system-ui, sans-serif`,outline:`none`,textAlign:`right`}),this.inputRefs.set(e.key,t),n.append(r,t)}else if(e.kind===`select`){let t=document.createElement(`select`);for(let n of e.options){let e=document.createElement(`option`);e.value=n,e.textContent=n,n===String(i)&&(e.selected=!0),t.appendChild(e)}Object.assign(t.style,{minWidth:`120px`,background:this.theme.background,color:this.theme.tooltip.text,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`3px`,padding:`4px 6px`,fontSize:`12px`,fontFamily:`'Inter', system-ui, sans-serif`,outline:`none`,cursor:`pointer`}),this.inputRefs.set(e.key,t),n.append(r,t)}else{let t=document.createElement(`input`);t.type=`color`,t.value=String(i),Object.assign(t.style,{width:`40px`,height:`26px`,border:`none`,padding:`0`,cursor:`pointer`,background:`transparent`,borderRadius:`3px`}),this.inputRefs.set(e.key,t),n.append(r,t)}return n}buildFooter(){let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,gap:`8px`,padding:`10px 14px`,borderTop:`1px solid ${this.theme.axisBorder}`});let t=this.makeButton(`Remove`,`#ef5350`,`transparent`,`#ef5350`);t.addEventListener(`click`,()=>{var e;(e=this.onRemove)==null||e.call(this),this.hide()});let n=this.makeButton(`Update`,`#fff`,`#2196f3`,`#2196f3`);return n.addEventListener(`click`,()=>{if(!this.schema||!this.onUpdate)return;let e={};for(let t of this.schema.fields){let n=this.inputRefs.get(t.key);n&&(e[t.key]=t.kind===`number`?Number(n.value):String(n.value))}this.onUpdate(e),this.hide()}),e.append(t,n),e}makeButton(e,t,n,r){let i=document.createElement(`button`);return i.textContent=e,Object.assign(i.style,{flex:`1`,color:t,background:n,border:`1px solid ${r}`,borderRadius:`4px`,padding:`6px 0`,cursor:`pointer`,fontSize:`12px`,fontFamily:`'Inter', system-ui, sans-serif`,fontWeight:`600`,outline:`none`}),i.addEventListener(`mouseenter`,()=>{i.style.opacity=`0.85`}),i.addEventListener(`mouseleave`,()=>{i.style.opacity=`1`}),i}},ts={appearance:`Appearance`,trading:`Trading`},ns=class{constructor(e,t,n=C.dialogs,r=!0,i=!1,a){this.activeTab=`appearance`,this.onChange=null,this.onReset=null,this.tabEls=new Map,this.theme=e,this.labels=n,this.current={...t},this.showTradingTab=r,this.enableThemeToggle=i,this.onVisibilityChange=a,!r&&this.activeTab===`trading`&&(this.activeTab=`appearance`),this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`fixed`,inset:`0`,background:`rgba(0,0,0,0.5)`,display:`none`,alignItems:`center`,justifyContent:`center`,zIndex:`10000`}),this.el.addEventListener(`mousedown`,e=>{e.target===this.el&&this.hide()}),this.panel=document.createElement(`div`),Object.assign(this.panel.style,{display:`flex`,flexDirection:`column`,width:`540px`,minHeight:`340px`,maxWidth:`calc(100vw - 32px)`,maxHeight:`calc(100vh - 48px)`,background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,borderRadius:`10px`,boxShadow:`0 16px 48px rgba(0,0,0,0.55), 0 4px 16px rgba(0,0,0,0.3)`,fontFamily:`'Inter', system-ui, -apple-system, sans-serif`,fontSize:`12px`,overflow:`hidden`}),this.panel.addEventListener(`mousedown`,e=>e.stopPropagation());let o=this.buildHeader();this.panel.appendChild(o);let s=document.createElement(`div`);Object.assign(s.style,{display:`flex`,flex:`1`,overflow:`hidden`}),this.sidebar=this.buildSidebar(),s.appendChild(this.sidebar),this.content=document.createElement(`div`),Object.assign(this.content.style,{flex:`1`,padding:`20px 24px`,overflowY:`auto`,scrollbarWidth:`thin`}),s.appendChild(this.content),this.panel.appendChild(s),this.panel.appendChild(this.buildFooter()),this.el.appendChild(this.panel)}show(e,t,n){var r;let i=this.isVisible;this.current={...e},this.onChange=t,this.onReset=n==null?null:n,this.renderContent(),this.el.style.display=`flex`,i||(r=this.onVisibilityChange)==null||r.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,this.onChange=null,this.onReset=null,t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setTheme(e){this.theme=e,this.applyPanelTheme(),this.el.style.display!==`none`&&this.renderContent()}destroy(){this.el.remove()}emit(){var e;(e=this.onChange)==null||e.call(this,{...this.current})}applyPanelTheme(){Object.assign(this.panel.style,{background:this.theme.tooltip.background,border:`1px solid ${this.theme.axisBorder}`}),this.sidebar.innerHTML=``,this.tabEls.clear(),this.buildSidebarTabs(this.sidebar),this.highlightActiveTab()}buildHeader(){let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`14px 20px 12px`,borderBottom:`1px solid ${this.theme.axisBorder}`,flexShrink:`0`});let t=document.createElement(`span`);t.textContent=this.labels.settings.title,Object.assign(t.style,{color:this.theme.tooltip.text,fontWeight:`600`,fontSize:`14px`,letterSpacing:`-0.01em`});let n=document.createElement(`button`);return n.innerHTML=Qt,Object.assign(n.style,{color:this.theme.axisText,cursor:`pointer`,background:`transparent`,border:`none`,padding:`4px`,borderRadius:`4px`,display:`flex`,alignItems:`center`,justifyContent:`center`,outline:`none`,transition:`color 0.1s, background 0.1s`}),n.addEventListener(`mouseenter`,()=>{n.style.color=this.theme.tooltip.text,n.style.background=this.theme.ui.accentBg}),n.addEventListener(`mouseleave`,()=>{n.style.color=this.theme.axisText,n.style.background=`transparent`}),n.addEventListener(`click`,()=>this.hide()),e.append(t,n),e}buildFooter(){let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:`10px 20px`,borderTop:`1px solid ${this.theme.axisBorder}`,flexShrink:`0`});let t=document.createElement(`button`);return t.textContent=this.labels.settings.resetBtn,Object.assign(t.style,{color:this.theme.axisText,fontSize:`11px`,fontFamily:`'Inter', system-ui, sans-serif`,background:`transparent`,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`5px`,padding:`5px 12px`,cursor:`pointer`,outline:`none`,transition:`color 0.1s, border-color 0.1s, background 0.1s`}),t.addEventListener(`mouseenter`,()=>{t.style.color=this.theme.tooltip.text,t.style.borderColor=this.theme.ui.accent,t.style.background=this.theme.ui.accentBg}),t.addEventListener(`mouseleave`,()=>{t.style.color=this.theme.axisText,t.style.borderColor=this.theme.axisBorder,t.style.background=`transparent`}),t.addEventListener(`click`,()=>{var e;(e=this.onReset)==null||e.call(this),this.hide()}),e.appendChild(t),e}buildSidebar(){let e=document.createElement(`div`);return Object.assign(e.style,{width:`130px`,flexShrink:`0`,borderRight:`1px solid ${this.theme.axisBorder}`,padding:`10px 0`,display:`flex`,flexDirection:`column`,gap:`2px`}),this.buildSidebarTabs(e),e}buildSidebarTabs(e){let t=this.showTradingTab?[`appearance`,`trading`]:[`appearance`];for(let n of t){let t=document.createElement(`button`);Object.assign(t.style,{display:`flex`,alignItems:`center`,gap:`8px`,padding:`8px 14px`,background:`transparent`,border:`none`,borderLeft:`2px solid transparent`,color:this.theme.axisText,fontSize:`12px`,fontFamily:`'Inter', system-ui, sans-serif`,cursor:`pointer`,width:`100%`,textAlign:`left`,outline:`none`,transition:`background 0.1s, color 0.1s`,boxSizing:`border-box`});let r=document.createElement(`span`);r.innerHTML=Zt[n],Object.assign(r.style,{display:`flex`,flexShrink:`0`});let i=document.createElement(`span`);i.textContent=ts[n],t.append(r,i),t.addEventListener(`mouseenter`,()=>{this.activeTab!==n&&(t.style.background=this.theme.ui.accentBg,t.style.color=this.theme.tooltip.text)}),t.addEventListener(`mouseleave`,()=>{this.activeTab!==n&&(t.style.background=`transparent`,t.style.color=this.theme.axisText)}),t.addEventListener(`click`,()=>{this.activeTab=n,this.highlightActiveTab(),this.renderContent()}),this.tabEls.set(n,t),e.appendChild(t)}}highlightActiveTab(){for(let[e,t]of this.tabEls){let n=e===this.activeTab;Object.assign(t.style,{background:n?this.theme.ui.accentBg:`transparent`,color:n?this.theme.ui.accentText:this.theme.axisText,borderLeft:n?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,fontWeight:n?`500`:`400`})}}renderContent(){switch(this.content.innerHTML=``,this.highlightActiveTab(),this.activeTab){case`appearance`:this.buildAppearanceSection();break;case`trading`:this.buildTradingSection();break}}buildAppearanceSection(){if(this.enableThemeToggle){let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingBottom:`10px`,borderBottom:`1px solid ${this.theme.axisBorder}`});let t=document.createElement(`span`);t.textContent=`Theme`,Object.assign(t.style,{color:this.theme.tooltip.text,fontSize:`13px`,fontWeight:`600`}),e.append(t,this.makeThemeToggle()),this.content.appendChild(e)}this.content.appendChild(this.makeSectionHeader(`Colors`)),this.content.appendChild(this.buildColorRows())}makeThemeToggle(){let e=this.current.theme===`light`,t=document.createElement(`div`);Object.assign(t.style,{display:`flex`,alignItems:`center`,gap:`8px`});let n=document.createElement(`span`);n.textContent=`Dark`;let r=document.createElement(`span`);r.textContent=`Light`;let i=()=>{Object.assign(n.style,{color:e?this.theme.axisText:this.theme.tooltip.text,fontWeight:e?`400`:`500`,fontSize:`11px`,cursor:`pointer`,userSelect:`none`}),Object.assign(r.style,{color:e?this.theme.tooltip.text:this.theme.axisText,fontWeight:e?`500`:`400`,fontSize:`11px`,cursor:`pointer`,userSelect:`none`})},a=document.createElement(`div`);Object.assign(a.style,{position:`relative`,width:`36px`,height:`20px`,borderRadius:`10px`,cursor:`pointer`,flexShrink:`0`,transition:`background 0.18s`,background:this.theme.axisBorder,border:`1px solid ${this.theme.axisText}50`,boxSizing:`border-box`});let o=document.createElement(`div`);Object.assign(o.style,{position:`absolute`,top:`2px`,left:e?`18px`:`2px`,width:`14px`,height:`14px`,borderRadius:`50%`,background:this.theme.ui.accent,transition:`left 0.18s`,pointerEvents:`none`}),a.appendChild(o);let s=()=>{e=!e,o.style.left=e?`18px`:`2px`,this.current.theme=e?`light`:`dark`,i(),this.emit(),this.renderContent()};return a.addEventListener(`click`,s),n.addEventListener(`click`,()=>{e&&s()}),r.addEventListener(`click`,()=>{e||s()}),i(),t.append(n,a,r),t}buildColorRows(){var e,t,n,r;let i=this.current.theme,a=(e=(t=this.current.canvasColors)==null?void 0:t[i])==null?{}:e,o=document.createElement(`div`);Object.assign(o.style,{display:`grid`,gridTemplateColumns:`max-content 24px 24px`,columnGap:`8px`,rowGap:`8px`,padding:`8px 0 4px`,alignItems:`center`});let s=[{label:`Background`,s1:{field:`background`,fallback:this.theme.background}},{label:`Grid`,s1:{field:`grid`,fallback:this.theme.grid}},{label:`Axis Text`,s1:{field:`axisText`,fallback:this.theme.axisText}},{label:`Axis Border`,s1:{field:`axisBorder`,fallback:this.theme.axisBorder}},{label:`Crosshair`,s1:{field:`crosshair`,fallback:this.theme.crosshair}},{label:`Candle Body`,s1:{field:`candleUp`,fallback:this.theme.candle.up},s2:{field:`candleDown`,fallback:this.theme.candle.down}},{label:`Candle Wick`,s1:{field:`wickUp`,fallback:this.theme.candle.wickUp},s2:{field:`wickDown`,fallback:this.theme.candle.wickDown}},{label:`Candle Border`,s1:{field:`borderUp`,fallback:(n=this.theme.candle.borderUp)==null?this.theme.candle.up:n},s2:{field:`borderDown`,fallback:(r=this.theme.candle.borderDown)==null?this.theme.candle.down:r}},{label:`Volume`,s1:{field:`volumeUp`,fallback:this.theme.volume.up},s2:{field:`volumeDown`,fallback:this.theme.volume.down}}],c=e=>{var t;return this.makeColorSwatch((t=a[e.field])==null?e.fallback:t,t=>{this.current.canvasColors||(this.current.canvasColors={}),this.current.canvasColors[i]||(this.current.canvasColors[i]={}),this.current.canvasColors[i][e.field]=t,this.emit()})};for(let{label:e,s1:t,s2:n}of s){let r=document.createElement(`span`);r.textContent=e,Object.assign(r.style,{color:this.theme.axisText,fontSize:`11px`,paddingRight:`12px`});let i=c(t);i.style.width=`24px`,i.style.height=`24px`;let a;n?(a=c(n),a.style.width=`24px`,a.style.height=`24px`):a=document.createElement(`span`),o.append(r,i,a)}return o}makeColorSwatch(e,t){let n=`${this.theme.axisText}80`,r=document.createElement(`div`);Object.assign(r.style,{position:`relative`,width:`28px`,height:`28px`,borderRadius:`6px`,overflow:`hidden`,cursor:`pointer`,border:`1.5px solid ${n}`,flexShrink:`0`,boxSizing:`border-box`});let i=document.createElement(`div`);Object.assign(i.style,{position:`absolute`,inset:`0`,background:e});let a=document.createElement(`input`);a.type=`color`,a.value=e,Object.assign(a.style,{position:`absolute`,inset:`0`,opacity:`0`,width:`100%`,height:`100%`,cursor:`pointer`,padding:`0`,border:`none`});let o=null;return a.addEventListener(`input`,()=>{i.style.background=a.value,o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,t(a.value)},300)}),r.append(i,a),r}buildTradingSection(){let e=this.labels.settings;this.content.appendChild(this.makeSectionHeader(e.tfcSection)),this.content.appendChild(this.makeVerticalSettingRow(e.showLabel,`Controls which trade levels are displayed on the chart`,this.makeSegmented([{value:`all`,label:e.showAll},{value:`positions`,label:e.showPositions},{value:`orders`,label:e.showOrders},{value:`none`,label:e.showNone}],this.current.tradeDisplayFilter,e=>{this.current.tradeDisplayFilter=e,this.emit()}))),this.content.appendChild(this.makeVerticalSettingRow(e.positionStyleLabel,`How open positions are rendered on the chart`,this.makeSegmented([{value:`line`,label:e.styleLine},{value:`dot`,label:e.styleDot}],this.current.positionRenderStyle,e=>{this.current.positionRenderStyle=e,this.emit()})))}makeSectionHeader(e,t=!1){let n=document.createElement(`div`);return n.textContent=e,Object.assign(n.style,{color:this.theme.tooltip.text,fontSize:`13px`,fontWeight:`600`,paddingBottom:`10px`,marginTop:t?`0`:`20px`,marginBottom:`2px`,borderBottom:`1px solid ${this.theme.axisBorder}`}),n}makeVerticalSettingRow(e,t,n){let r=document.createElement(`div`);Object.assign(r.style,{display:`flex`,flexDirection:`column`,gap:`12px`,padding:`14px 0`,borderBottom:`1px solid ${this.theme.axisBorder}`});let i=document.createElement(`div`);Object.assign(i.style,{display:`flex`,flexDirection:`column`,gap:`0px`});let a=document.createElement(`span`);a.textContent=e,Object.assign(a.style,{color:this.theme.tooltip.text,fontSize:`12px`,fontWeight:`500`});let o=document.createElement(`span`);return o.textContent=t,Object.assign(o.style,{color:this.theme.axisText,fontSize:`10px`}),i.append(a,o),Object.assign(n.style,{width:`fit-content`,border:`1px solid ${this.theme.axisText}`,borderRadius:`6px`,overflow:`hidden`}),r.append(i,n),r}makeSegmented(e,t,n){let r=document.createElement(`div`);Object.assign(r.style,{display:`inline-flex`,borderRadius:`6px`,border:`1px solid ${this.theme.axisText}`,overflow:`hidden`,flexShrink:`0`});let i=[];for(let a of e){let o=document.createElement(`button`),s=a.value===t;Object.assign(o.style,{padding:`5px 14px`,fontSize:`11px`,fontFamily:`'Inter', system-ui, sans-serif`,background:s?this.theme.ui.accent:`transparent`,color:s?`#ffffff`:this.theme.axisText,border:`none`,borderRight:`1px solid ${this.theme.axisText}`,cursor:`pointer`,outline:`none`,transition:`background 0.12s, color 0.12s`,whiteSpace:`nowrap`,textAlign:`center`}),a===e[e.length-1]&&(o.style.borderRight=`none`),o.textContent=a.label,o.addEventListener(`mouseenter`,()=>{t!==a.value&&(o.style.background=this.theme.ui.accentBg,o.style.color=this.theme.ui.accentText)}),o.addEventListener(`mouseleave`,()=>{t!==a.value&&(o.style.background=`transparent`,o.style.color=this.theme.axisText)}),o.addEventListener(`click`,()=>{t=a.value;for(let e of i)e.style.background=`transparent`,e.style.color=this.theme.axisText;o.style.background=this.theme.ui.accent,o.style.color=`#ffffff`,n(a.value)}),i.push(o),r.appendChild(o)}return r}},rs=class{constructor(e,t,n,r=C.trade,i=b){this._visible=!1,this._isMobile=!1,this.theme=e,this.cfg=i,this.el=document.createElement(`button`),this.el.innerHTML=tn,this.el.title=r.placeOrderTitle,Object.assign(this.el.style,{position:`absolute`,right:`${t+26}px`,top:`0`,width:`${i.size}px`,height:`${i.size}px`,borderRadius:`50%`,border:`1px solid ${e.axisBorder}`,background:e.tooltip.background,color:e.axisText,fontSize:`14px`,lineHeight:`1`,display:`none`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,padding:`0`,fontFamily:`'Inter', system-ui, sans-serif`,zIndex:`15`,transform:`translateY(-50%)`,transition:`opacity 0.1s`,pointerEvents:`auto`,userSelect:`none`}),this.applyIconSize(i.iconSize),this.el.addEventListener(`click`,e=>{e.stopPropagation(),n()}),this.el.addEventListener(`mouseenter`,()=>{this.el.style.opacity=`1`,Object.assign(this.el.style,{background:e.tooltip.background,color:e.tradeLevels.buySide,border:`1px solid ${e.tradeLevels.buySide}`})}),this.el.addEventListener(`mouseleave`,e=>{var t;Object.assign(this.el.style,{background:this.theme.tooltip.background,color:this.theme.axisText,border:`1px solid ${this.theme.axisBorder}`});let n=e.relatedTarget;(!n||!((t=this.el.parentElement)!=null&&t.contains(n)))&&this.hide()})}setY(e){this.el.style.top=`${e}px`}show(){this._visible||(this._visible=!0,this.el.style.display=`flex`)}hide(){this._visible&&(this._visible=!1,this.el.style.display=`none`)}setTheme(e,t){this.theme=e,Object.assign(this.el.style,{border:`1px solid ${e.axisBorder}`,background:e.tooltip.background,color:e.axisText,right:`${t+26}px`})}setMobileMode(e){if(this._isMobile===e)return;this._isMobile=e;let t=e?this.cfg.mobileSize:this.cfg.size,n=e?this.cfg.mobileIconSize:this.cfg.iconSize;this.el.style.width=`${t}px`,this.el.style.height=`${t}px`,this.applyIconSize(n)}applyIconSize(e){let t=this.el.querySelector(`svg`);t&&(t.setAttribute(`width`,String(e)),t.setAttribute(`height`,String(e)))}},is=class{constructor(e,t,n,r,i=C.trade,a){this._price=0,this._pricePrecision=2,this._buyOrderType=`limit`,this._sellOrderType=`limit`,this._compact=!1,this.onDocMouseDown=e=>{this.isVisible&&!this.el.contains(e.target)&&this.hide()},this.theme=e,this.lots=t,this.symbol=n,this.onDraftCreate=r,this.labels=i,this.onVisibilityChange=a,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`absolute`,display:`none`,flexDirection:`column`,background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,borderRadius:`5px`,padding:`4px`,zIndex:`20`,boxShadow:`0 4px 16px rgba(0,0,0,0.25)`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:`12px`,width:`max-content`,pointerEvents:`auto`}),document.addEventListener(`mousedown`,this.onDocMouseDown)}show(e,t,n,r=2,i=`limit`,a=`limit`){var o;let s=this.isVisible;this._price=e,this._pricePrecision=r,this._buyOrderType=i,this._sellOrderType=a,this.rebuild(),this.el.style.display=`flex`,this.el.style.right=`${n}px`,this.el.style.top=`${t-16}px`,s||(o=this.onVisibilityChange)==null||o.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setLots(e){this.lots=e}setSymbol(e){this.symbol=e}setCompact(e){this._compact=e}setTheme(e){this.theme=e,Object.assign(this.el.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`})}destroy(){document.removeEventListener(`mousedown`,this.onDocMouseDown)}rebuild(){this.el.innerHTML=``;let e=document.createElement(`div`);Object.assign(e.style,{height:`1px`,background:this.theme.axisBorder,margin:`0 8px`}),this.el.append(this.makeRow(this.theme.tradeLevels.sellSide,`sell`,this._sellOrderType),e,this.makeRow(this.theme.tradeLevels.buySide,`buy`,this._buyOrderType))}makeRow(e,t,n){let r=document.createElement(`button`);Object.assign(r.style,{display:`flex`,alignItems:`center`,gap:`8px`,width:`100%`,background:`transparent`,border:`none`,borderRadius:`3px`,padding:this._compact?`5px 8px`:`8px 10px`,cursor:`pointer`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:this._compact?`11px`:`12px`}),r.appendChild(this.makeChevron(e,t));let i=t===`sell`?this.labels.sell:this.labels.buy,a=n===`limit`?this.labels.limit:this.labels.stop,o=this._price.toFixed(this._pricePrecision),s=document.createElement(`span`);s.textContent=`${i} ${a}`,Object.assign(s.style,{color:e,fontWeight:`600`});let c=document.createElement(`span`);return c.textContent=` ${this.lots} ${this.symbol} ${this.labels.at} ${o}`,Object.assign(c.style,{color:`#ffffff`,fontWeight:`400`}),r.append(s,c),r.addEventListener(`mouseenter`,()=>{r.style.background=`rgba(255,255,255,0.06)`}),r.addEventListener(`mouseleave`,()=>{r.style.background=`transparent`}),r.addEventListener(`mousedown`,e=>{e.stopPropagation(),this.onDraftCreate(t,this._price,n),this.hide()}),r}makeChevron(e,t){let n=`http://www.w3.org/2000/svg`,r=document.createElementNS(n,`svg`);r.setAttribute(`width`,`10`),r.setAttribute(`height`,`8`),r.setAttribute(`viewBox`,`0 0 10 8`),r.style.flexShrink=`0`;let i=document.createElementNS(n,`path`);return i.setAttribute(`d`,t===`sell`?`M1 1 L5 7 L9 1`:`M1 7 L5 1 L9 7`),i.setAttribute(`stroke`,e),i.setAttribute(`fill`,`none`),i.setAttribute(`stroke-width`,`1.5`),i.setAttribute(`stroke-linecap`,`round`),i.setAttribute(`stroke-linejoin`,`round`),r.appendChild(i),r}},as=class{constructor(e,t,n){this._min=1,this._max=100,this._step=1,this._intendedTop=0,this._disposeKbd=()=>{},this.onDocMouseDown=e=>{this.isVisible&&!this.el.contains(e.target)&&(this.syncIfValid(),this.hide())},this.theme=e,this.onCommit=t,this.onVisibilityChange=n,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`fixed`,display:`none`,flexDirection:`row`,alignItems:`center`,gap:`4px`,background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,borderRadius:`5px`,padding:`5px 7px`,zIndex:`25`,boxShadow:`0 4px 16px rgba(0,0,0,0.3)`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:`13px`,color:e.tooltip.text,pointerEvents:`auto`});let r=this.makeStepBtn(`−`,()=>this.step(-1));this.input=this.makeInput();let i=this.makeStepBtn(`+`,()=>this.step(1));this.el.append(r,this.input,i),this.el.addEventListener(`mousedown`,e=>e.stopPropagation()),this.el.addEventListener(`touchstart`,e=>e.stopPropagation()),document.addEventListener(`mousedown`,this.onDocMouseDown),this._disposeKbd=cn(this.el,()=>this._intendedTop)}show(e,t,n,r,i){var a;let o=this.isVisible;this._min=r,this._max=i,this._step=r,this.input.min=String(r),this.input.max=String(i),this.input.step=String(r),this.input.value=String(n),this._intendedTop=t+4,this.el.style.display=`flex`,this.el.style.left=`${e}px`,this.el.style.top=`${this._intendedTop}px`,o||(a=this.onVisibilityChange)==null||a.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setTheme(e){this.theme=e,Object.assign(this.el.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,color:e.tooltip.text}),this.input.style.borderBottom=`1px solid ${e.axisBorder}`}destroy(){document.removeEventListener(`mousedown`,this.onDocMouseDown),this._disposeKbd()}makeStepBtn(e,t){let n=document.createElement(`button`);return n.textContent=e,Object.assign(n.style,{background:`transparent`,border:`none`,color:`inherit`,cursor:`pointer`,fontSize:`16px`,lineHeight:`1`,padding:`0 4px`,borderRadius:`3px`,opacity:`0.7`}),n.addEventListener(`mouseenter`,()=>{n.style.opacity=`1`}),n.addEventListener(`mouseleave`,()=>{n.style.opacity=`0.7`}),n.addEventListener(`mousedown`,e=>{e.preventDefault(),t()}),n}makeInput(){let e=document.createElement(`input`);return e.type=`number`,Object.assign(e.style,{width:`64px`,background:`transparent`,border:`none`,borderBottom:`1px solid ${this.theme.axisBorder}`,color:`inherit`,font:`16px 'Inter', system-ui, sans-serif`,outline:`none`,textAlign:`center`,padding:`1px 2px`}),e.addEventListener(`focus`,()=>{e.select()}),e.addEventListener(`input`,()=>{this.syncIfValid()}),e.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),this.syncIfValid(),this.hide()):e.key===`Escape`&&(e.preventDefault(),this.hide())}),e.addEventListener(`blur`,()=>{this.isVisible&&(this.syncIfValid(),this.hide())}),e}step(e){let t=parseFloat(this.input.value)||this._min,n=Math.round((t+e*this._step)*1e10)/1e10;this.input.value=String(Math.min(this._max,Math.max(this._min,n))),this.syncIfValid()}syncIfValid(){let e=parseFloat(this.input.value);!isNaN(e)&&e>=this._min&&e<=this._max&&this.onCommit(e)}},os=50,ss=20,cs=class{constructor(e,t,n){this.isins=[],this.currentSymbol=``,this.escHandler=null,this.disposeKbd=()=>{},this.theme=e,this.onSelect=t,this.onVisibilityChange=n,this.el=document.createElement(`div`),Object.assign(this.el.style,{position:`fixed`,inset:`0`,background:`rgba(0,0,0,0.5)`,display:`none`,alignItems:`center`,justifyContent:`center`,zIndex:`1000`}),this.el.addEventListener(`mousedown`,e=>{e.target===this.el&&this.hide()}),this.panel=document.createElement(`div`),Object.assign(this.panel.style,{display:`flex`,flexDirection:`column`,width:`360px`,maxHeight:`520px`,background:e.tooltip.background,border:`1px solid ${e.axisBorder}`,borderRadius:`6px`,boxShadow:`0 8px 32px rgba(0,0,0,0.45)`,fontFamily:`'Inter', system-ui, sans-serif`,fontSize:`12px`,overflow:`hidden`}),this.panel.addEventListener(`mousedown`,e=>e.stopPropagation()),this.el.appendChild(this.panel);let r=document.createElement(`div`);Object.assign(r.style,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`10px 14px`,borderBottom:`1px solid ${e.axisBorder}`,flexShrink:`0`});let i=document.createElement(`span`);i.textContent=`Select Symbol`,Object.assign(i.style,{color:e.tooltip.text,fontWeight:`600`,fontSize:`13px`});let a=document.createElement(`span`);a.innerHTML=It,Object.assign(a.style,{display:`inline-flex`,alignItems:`center`,color:e.axisText,cursor:`pointer`}),a.addEventListener(`mouseenter`,()=>{a.style.color=e.tooltip.text}),a.addEventListener(`mouseleave`,()=>{a.style.color=e.axisText}),a.addEventListener(`click`,()=>this.hide()),r.appendChild(i),r.appendChild(a),this.panel.appendChild(r);let o=document.createElement(`div`);Object.assign(o.style,{padding:`8px 14px`,borderBottom:`1px solid ${e.axisBorder}`,flexShrink:`0`}),this.searchInput=document.createElement(`input`),this.searchInput.type=`text`,this.searchInput.placeholder=`Search symbols…`,Object.assign(this.searchInput.style,{width:`100%`,boxSizing:`border-box`,background:`transparent`,border:`1px solid ${e.axisBorder}`,borderRadius:`4px`,color:e.tooltip.text,fontSize:`16px`,padding:`5px 8px`,outline:`none`}),this.searchInput.addEventListener(`input`,()=>this.renderList()),o.appendChild(this.searchInput),this.panel.appendChild(o),this.listEl=document.createElement(`div`),Object.assign(this.listEl.style,{overflowY:`auto`,flex:`1`,scrollbarWidth:`thin`,scrollbarColor:`rgba(120,130,150,0.35) transparent`}),this.panel.appendChild(this.listEl),this.disposeKbd=ln(this.panel)}show(e,t){var n;let r=this.isVisible;this.isins=e,this.currentSymbol=t,this.searchInput.value=``,this.renderList(),this.el.style.display=`flex`,requestAnimationFrame(()=>this.searchInput.focus({preventScroll:!0})),this.escHandler=e=>{e.key===`Escape`&&this.hide()},document.addEventListener(`keydown`,this.escHandler),r||(n=this.onVisibilityChange)==null||n.call(this)}hide(){var e;let t=this.isVisible;this.el.style.display=`none`,this.escHandler&&(document.removeEventListener(`keydown`,this.escHandler),this.escHandler=null),t&&((e=this.onVisibilityChange)==null||e.call(this))}get isVisible(){return this.el.style.display!==`none`}setCurrentSymbol(e){this.currentSymbol=e,this.el.style.display!==`none`&&this.renderList()}setIsins(e){this.isins=e}setTheme(e){this.theme=e,Object.assign(this.panel.style,{background:e.tooltip.background,border:`1px solid ${e.axisBorder}`})}destroy(){this.escHandler&&document.removeEventListener(`keydown`,this.escHandler),this.disposeKbd(),this.el.remove()}sortWithCurrentFirst(e){if(!this.currentSymbol)return e;let t=e.indexOf(this.currentSymbol);if(t<=0)return e;let n=e.slice();return n.splice(t,1),n.unshift(this.currentSymbol),n}renderList(){let e=this.searchInput.value.trim().toLowerCase(),t=this.sortWithCurrentFirst(e?this.isins.filter(t=>t.toLowerCase().includes(e)).slice(0,ss):this.isins.slice(0,os));if(this.listEl.innerHTML=``,t.length===0){let e=document.createElement(`div`);e.textContent=`No symbols found`,Object.assign(e.style,{padding:`16px 14px`,color:this.theme.axisText,textAlign:`center`}),this.listEl.appendChild(e);return}for(let e of t){let t=document.createElement(`div`),n=e===this.currentSymbol;Object.assign(t.style,{padding:`8px 14px`,cursor:`pointer`,color:n?this.theme.ui.accentText:this.theme.tooltip.text,background:n?this.theme.ui.accentBg:`transparent`,fontWeight:n?`600`:`400`,borderLeft:n?`2px solid ${this.theme.ui.accent}`:`2px solid transparent`,boxSizing:`border-box`,userSelect:`none`}),t.textContent=e,t.addEventListener(`mouseenter`,()=>{e!==this.currentSymbol&&(t.style.background=this.theme.ui.accentBg)}),t.addEventListener(`mouseleave`,()=>{e!==this.currentSymbol&&(t.style.background=`transparent`)}),t.addEventListener(`click`,()=>{this.onSelect(e),this.hide()}),this.listEl.appendChild(t)}}},ls=class e{constructor(){this._active=!1,this._isDraggingBracket=!1,this._level=null,this._startPrice=0,this._currentPrice=0,this._pixelOffset=0,this._mainMinPrice=-1/0,this._mainMaxPrice=1/0,this._bracketType=null,this._bracketStartPrice=0,this._bracketCurrentPrice=0,this._bracketPixelOffset=0,this._bracketParentPrice=0,this._bracketParentSide=`buy`,this._bracketMarketPrice=0,this._followBrackets=!1}startDrag(e,t,n,r,i,a,o,s,c,l){this._active=!0,this._isDraggingBracket=!1,this._level=e,this._pixelOffset=t-n,this._startPrice=r,this._currentPrice=r,this._bracketType=null,this._followBrackets=l===!0,this._slStartPrice=i,this._tpStartPrice=a,this._derivedSLPrice=i,this._derivedTPPrice=a,this._followBrackets?(this._mainMinPrice=-1/0,this._mainMaxPrice=1/0):i!==void 0||a!==void 0?(o==null?`buy`:o)===`buy`?(this._mainMinPrice=i==null?-1/0:i,this._mainMaxPrice=a==null?1/0:a):(this._mainMinPrice=a==null?-1/0:a,this._mainMaxPrice=i==null?1/0:i):(this._mainMinPrice=-1/0,this._mainMaxPrice=1/0),s&&s>0&&c&&c!==`market`&&o&&(o===`buy`&&c===`limit`||o===`sell`&&c===`stop`?this._mainMaxPrice=Math.min(this._mainMaxPrice,s):this._mainMinPrice=Math.max(this._mainMinPrice,s))}startBracketDrag(e,t,n,r,i,a=0,o){var s;this._active=!0,this._isDraggingBracket=!0,this._level=e,this._bracketType=t,this._bracketStartPrice=n,this._bracketCurrentPrice=n,this._bracketPixelOffset=r-i,this._bracketParentPrice=o==null?e.price:o,this._bracketParentSide=(s=e.side)==null?`buy`:s,this._bracketMarketPrice=a}onMouseMove(e,t,n,r){if(!this._active||!this._level)return null;if(this._isDraggingBracket&&this._bracketType!==null){let i=e-this._bracketPixelOffset,a=t.pixelToPrice(i,n,r),o=this._clampBracketPrice(a,this._bracketType,this._bracketParentPrice,this._bracketParentSide,this._bracketMarketPrice);return this._bracketCurrentPrice=o,{newPrice:o,label:`${this._level.label}:${this._bracketType}`,isBracket:!0}}let i=e-this._pixelOffset,a=t.pixelToPrice(i,n,r),o=Math.max(this._mainMinPrice,Math.min(this._mainMaxPrice,a));if(this._currentPrice=o,this._followBrackets){let e=o-this._startPrice;return this._derivedSLPrice=this._slStartPrice===void 0?void 0:this._slStartPrice+e,this._derivedTPPrice=this._tpStartPrice===void 0?void 0:this._tpStartPrice+e,{newPrice:o,label:this._level.label,isBracket:!1,derivedSLPrice:this._derivedSLPrice,derivedTPPrice:this._derivedTPPrice}}return{newPrice:o,label:this._level.label,isBracket:!1}}endDrag(){if(!this._active||!this._level)return null;let e=this._level,t;return t=this._isDraggingBracket&&this._bracketType!==null?{label:e.label,type:e.type,newPrice:this._bracketCurrentPrice,startPrice:this._bracketStartPrice,data:e.data,bracketType:this._bracketType}:this._followBrackets?{label:e.label,type:e.type,newPrice:this._currentPrice,startPrice:this._startPrice,data:e.data,derivedSLPrice:this._derivedSLPrice,derivedTPPrice:this._derivedTPPrice,slStartPrice:this._slStartPrice,tpStartPrice:this._tpStartPrice}:{label:e.label,type:e.type,newPrice:this._currentPrice,startPrice:this._startPrice,data:e.data},this._reset(),t}cancelDrag(){this._reset()}get active(){return this._active}get dragLabel(){return!this._active||!this._level?null:this._isDraggingBracket&&this._bracketType?`${this._level.label}:${this._bracketType}`:this._level.label}get currentPrice(){return this._active?this._isDraggingBracket?this._bracketCurrentPrice:this._currentPrice:null}static isBracketPriceValid(e,t,n,r,i=0){let a=i>0?r===`buy`?t===`stopLoss`?Math.min(n,i):Math.max(n,i):t===`stopLoss`?Math.max(n,i):Math.min(n,i):n;return r===`buy`?t===`stopLoss`?e<a:e>a:t===`stopLoss`?e>a:e<a}_clampBracketPrice(t,n,r,i,a=0){return e.isBracketPriceValid(t,n,r,i,a)?t:a>0?i===`buy`?n===`stopLoss`?Math.min(r,a):Math.max(r,a):n===`stopLoss`?Math.max(r,a):Math.min(r,a):r}_reset(){this._active=!1,this._isDraggingBracket=!1,this._level=null,this._bracketType=null,this._currentPrice=0,this._pixelOffset=0,this._mainMinPrice=-1/0,this._mainMaxPrice=1/0,this._bracketStartPrice=0,this._bracketCurrentPrice=0,this._bracketPixelOffset=0,this._bracketParentPrice=0,this._bracketParentSide=`buy`,this._bracketMarketPrice=0,this._followBrackets=!1,this._slStartPrice=void 0,this._tpStartPrice=void 0,this._derivedSLPrice=void 0,this._derivedTPPrice=void 0}};function Z(e,t){return e[t]}var us=class{constructor(e,t=`#F5A623`,n=`MA`,r=`close`){this.period=e,this.source=r,this.name=n,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null};let r=0;for(let t=n-this.period+1;t<=n;t++)r+=Z(e[t],this.source);return{index:n,value:r/this.period}})}render(e,t,n,r,i){var a;let o=ds(e);if(!o)return;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let s=!1,c=(a=e.canvas._chartWidth)==null?e.canvas.width:a;for(let a of t){if(a.value===null){s=!1;continue}let t=n.xToPixel(a.index,r,c),l=n.yToPixel(a.value,o,i);s?e.lineTo(t,l):(e.moveTo(t,l),s=!0)}e.stroke()}};function ds(e){var t;return(t=e.canvas._priceRange)==null?null:t}var fs=class{constructor(e,t=`#9B59B6`,n=`EMA`,r=`close`){this.period=e,this.source=r,this.name=n,this.color=t}compute(e){let t=2/(this.period+1),n=[],r=null;for(let i=0;i<e.length;i++){if(i<this.period-1){n.push({index:i,value:null});continue}if(r===null){let t=0;for(let n=0;n<this.period;n++)t+=Z(e[i-n],this.source);r=t/this.period}else r=Z(e[i],this.source)*t+r*(1-t);n.push({index:i,value:r})}return n}render(e,t,n,r,i){var a;let o=e.canvas._priceRange;if(!o)return;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let s=!1,c=(a=e.canvas._chartWidth)==null?e.canvas.width:a;for(let a of t){if(a.value===null){s=!1;continue}let t=n.xToPixel(a.index,r,c),l=n.yToPixel(a.value,o,i);s?e.lineTo(t,l):(e.moveTo(t,l),s=!0)}e.stroke()}},ps=class{constructor(e=20,t=`#e91e63`,n=`WMA`,r=`close`){this.period=e,this.source=r,this.name=n,this.color=t}compute(e){let t=this.period*(this.period+1)/2,n=[];for(let r=0;r<e.length;r++){if(r<this.period-1){n.push({index:r,value:null});continue}let i=0;for(let t=0;t<this.period;t++)i+=Z(e[r-(this.period-1-t)],this.source)*(t+1);n.push({index:r,value:i/t})}return n}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let l=!1;for(let a of t){if(a.value===null){l=!1;continue}let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);l?e.lineTo(t,o):(e.moveTo(t,o),l=!0)}e.stroke()}};function ms(e,t){let n=t*(t+1)/2,r=[];for(let i=0;i<e.length;i++){if(i<t-1){r.push(null);continue}let a=0;for(let n=0;n<t;n++)a+=e[i-(t-1-n)]*(n+1);r.push(a/n)}return r}var hs=class{constructor(e=20,t=`#00bcd4`,n=`HMA`,r=`close`){this.period=e,this.source=r,this.name=n,this.color=t}compute(e){let t=e.map(e=>Z(e,this.source)),n=Math.floor(this.period/2),r=Math.floor(Math.sqrt(this.period)),i=ms(t,n),a=ms(t,this.period),o=i.map((e,t)=>{let n=a[t];return e===null||n===null?null:2*e-n}),s=ms(o.map(e=>e===null?0:e),r);return e.map((e,t)=>{let n=t-r+1;return n<0||!(o[n]!==null&&o[t]!==null)||s[t]===null?{index:t,value:null}:{index:t,value:s[t]}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let l=!1;for(let a of t){if(a.value===null){l=!1;continue}let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);l?e.lineTo(t,o):(e.moveTo(t,o),l=!0)}e.stroke()}},gs=[5,10,20,50,100],_s=[`#ff6b6b`,`#ffd93d`,`#6bcb77`,`#4d96ff`,`#c77dff`],vs=class{constructor(e=`#ffcc80`,t=`close`){this.source=t,this.name=`MARibbon`,this.color=e}compute(e){let t=(t,n)=>{if(t<n-1)return null;let r=0;for(let i=t-n+1;i<=t;i++)r+=Z(e[i],this.source);return r/n};return e.map((e,n)=>({index:n,value:t(n,5),upper:t(n,10),lower:t(n,20),signal:t(n,50),histogram:t(n,100)}))}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let l=[`value`,`upper`,`lower`,`signal`,`histogram`];for(let a=0;a<gs.length;a++){let o=l[a],u=_s[a];e.beginPath(),e.strokeStyle=u;let d=!1;for(let a of t){let t=a[o];if(t==null){d=!1;continue}let l=n.xToPixel(a.index,r,c),u=n.yToPixel(t,s,i);d?e.lineTo(l,u):(e.moveTo(l,u),d=!0)}e.stroke()}}},ys=class{constructor(e=20,t=2,n=`#3B82F6`,r=`BB`,i=`close`){this.period=e,this.stdDevMultiplier=t,this.source=i,this.name=r,this.color=n}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null,upper:null,lower:null};let r=e.slice(n-this.period+1,n+1).map(e=>Z(e,this.source)),i=r.reduce((e,t)=>e+t,0)/this.period,a=r.reduce((e,t)=>e+(t-i)**2,0)/this.period,o=Math.sqrt(a);return{index:n,value:i,upper:i+o*this.stdDevMultiplier,lower:i-o*this.stdDevMultiplier}})}render(e,t,n,r,i){var a;let o=e.canvas._priceRange;if(!o)return;let s=(a=e.canvas._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let c=(a,c=!1)=>{c&&e.setLineDash([4,3]),e.beginPath();let l=!1;for(let c of t){let t=a(c);if(t==null){l=!1;continue}let u=n.xToPixel(c.index,r,s),d=n.yToPixel(t,o,i);l?e.lineTo(u,d):(e.moveTo(u,d),l=!0)}e.stroke(),c&&e.setLineDash([])};e.strokeStyle=this.color,c(e=>e.value),e.strokeStyle=`${this.color}99`,c(e=>e.upper,!0),c(e=>e.lower,!0);let l=[],u=[];for(let e of t){if(e.upper==null||e.lower==null)continue;let t=n.xToPixel(e.index,r,s);l.push([t,n.yToPixel(e.upper,o,i)]),u.push([t,n.yToPixel(e.lower,o,i)])}l.length<2||(e.beginPath(),l.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),u.reverse().forEach(([t,n])=>e.lineTo(t,n)),e.closePath(),e.fillStyle=`${this.color}12`,e.fill())}},bs=class{constructor(e=20,t=2,n=10,r=`#4caf50`,i=`KC`){this.period=e,this.mult=t,this.atrPeriod=n,this.name=i,this.color=r}compute(e){let t=[],n=2/(this.period+1),r=null,i=null;for(let a=0;a<e.length;a++){let o=e[a];if(a<this.period-1){t.push({index:a,value:null,upper:null,lower:null});continue}if(r===null){let t=0;for(let n=0;n<this.period;n++)t+=e[a-n].close;r=t/this.period}else r=o.close*n+r*(1-n);let s=a===0?o.high-o.low:Math.max(o.high-o.low,Math.abs(o.high-e[a-1].close),Math.abs(o.low-e[a-1].close));if(i===null){let t=0;for(let n=0;n<this.atrPeriod;n++){let r=e[a-n],i=a-n>0?e[a-n-1]:null,o=i==null?r.high-r.low:Math.max(r.high-r.low,Math.abs(r.high-i.close),Math.abs(r.low-i.close));t+=o}i=t/this.atrPeriod}else i=(i*(this.atrPeriod-1)+s)/this.atrPeriod;let c=r+this.mult*i,l=r-this.mult*i;t.push({index:a,value:r,upper:c,lower:l})}return t}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let l=(a,o=!1)=>{o&&e.setLineDash([4,3]),e.beginPath();let l=!1;for(let o of t){let t=a(o);if(t==null){l=!1;continue}let u=n.xToPixel(o.index,r,c),d=n.yToPixel(t,s,i);l?e.lineTo(u,d):(e.moveTo(u,d),l=!0)}e.stroke(),o&&e.setLineDash([])};e.strokeStyle=this.color,l(e=>e.value),e.strokeStyle=`${this.color}99`,l(e=>e.upper,!0),l(e=>e.lower,!0);let u=[],d=[];for(let e of t){if(e.upper==null||e.lower==null)continue;let t=n.xToPixel(e.index,r,c);u.push([t,n.yToPixel(e.upper,s,i)]),d.push([t,n.yToPixel(e.lower,s,i)])}u.length<2||(e.beginPath(),u.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),d.reverse().forEach(([t,n])=>e.lineTo(t,n)),e.closePath(),e.fillStyle=`${this.color}12`,e.fill())}},xs=class{constructor(e=20,t=`#26c6da`){this.period=e,this.name=`DC`,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null,upper:null,lower:null};let r=-1/0,i=1/0;for(let t=n-this.period+1;t<=n;t++)e[t].high>r&&(r=e[t].high),e[t].low<i&&(i=e[t].low);return{index:n,value:(r+i)/2,upper:r,lower:i}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let l=(a,o=!1)=>{o&&e.setLineDash([4,3]),e.beginPath();let l=!1;for(let o of t){let t=a(o);if(t==null){l=!1;continue}let u=n.xToPixel(o.index,r,c),d=n.yToPixel(t,s,i);l?e.lineTo(u,d):(e.moveTo(u,d),l=!0)}e.stroke(),o&&e.setLineDash([])};e.strokeStyle=this.color,l(e=>e.value,!0),e.strokeStyle=`${this.color}99`,l(e=>e.upper),l(e=>e.lower);let u=[],d=[];for(let e of t){if(e.upper==null||e.lower==null)continue;let t=n.xToPixel(e.index,r,c);u.push([t,n.yToPixel(e.upper,s,i)]),d.push([t,n.yToPixel(e.lower,s,i)])}u.length<2||(e.beginPath(),u.forEach(([t,n],r)=>r===0?e.moveTo(t,n):e.lineTo(t,n)),d.slice().reverse().forEach(([t,n])=>e.lineTo(t,n)),e.closePath(),e.fillStyle=`${this.color}14`,e.fill())}},Ss=class{constructor(e=14,t=`#ff5722`,n=`ATR`){this.period=e,this.pane=`sub`,this.paneHeight=80,this.name=n,this.color=t}compute(e){let t=[];if(e.length===0)return t;let n=[];for(let t=0;t<e.length;t++)if(t===0)n.push(e[t].high-e[t].low);else{let r=e[t-1].close;n.push(Math.max(e[t].high-e[t].low,Math.abs(e[t].high-r),Math.abs(e[t].low-r)))}if(e.length<this.period)return e.map((e,t)=>({index:t,value:null}));let r=0;for(let e=0;e<this.period;e++)r+=n[e];r/=this.period;for(let e=0;e<this.period-1;e++)t.push({index:e,value:null});t.push({index:this.period-1,value:r});for(let i=this.period;i<e.length;i++)r=(r*(this.period-1)+n[i])/this.period,t.push({index:i,value:r});return t}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,n.value));return{min:0,max:t*1.2}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,e.value));let l=a==null?{min:0,max:c*1.2}:a,u=[];for(let e of t)e.value!=null&&u.push({x:n.xToPixel(e.index,r,s),y:n.yToPixel(e.value,l,i)});if(u.length===0)return;let d=n.yToPixel(0,l,i);e.beginPath(),e.moveTo(u[0].x,d);for(let t of u)e.lineTo(t.x,t.y);e.lineTo(u[u.length-1].x,d),e.closePath(),e.fillStyle=this.color+`33`,e.fill(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let f=!1;for(let a of t){if(a.value==null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke()}},Cs=class{constructor(e=14,t=`#e8b84b`,n=`RSI`,r=`close`){this.period=e,this.source=r,this.pane=`sub`,this.paneHeight=80,this.name=n,this.color=t}compute(e){let t=[];if(e.length<this.period+1)return e.map((e,t)=>({index:t,value:null}));let n=0,r=0;for(let t=1;t<=this.period;t++){let i=Z(e[t],this.source)-Z(e[t-1],this.source);i>0?n+=i:r+=Math.abs(i)}n/=this.period,r/=this.period;for(let e=0;e<this.period;e++)t.push({index:e,value:null});let i=r===0?1/0:n/r;t.push({index:this.period,value:r===0?100:100-100/(1+i)});for(let i=this.period+1;i<e.length;i++){let a=Z(e[i],this.source)-Z(e[i-1],this.source),o=a>0?a:0,s=a<0?Math.abs(a):0;n=(n*(this.period-1)+o)/this.period,r=(r*(this.period-1)+s)/this.period;let c=r===0?1/0:n/r;t.push({index:i,value:r===0?100:100-100/(1+c)})}return t}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a,l=n.yToPixel(70,c,i),u=n.yToPixel(30,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[70,50,30]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}},ws=class{constructor(e=14,t=3,n=`#e040fb`){this.kPeriod=e,this.dPeriod=t,this.name=`Stoch`,this.pane=`sub`,this.paneHeight=80,this.color=n}compute(e){let t=[],n=[];for(let r=0;r<e.length;r++){if(r<this.kPeriod-1){n.push(null),t.push({index:r,value:null,upper:null});continue}let i=1/0,a=-1/0;for(let t=r-this.kPeriod+1;t<=r;t++)e[t].low<i&&(i=e[t].low),e[t].high>a&&(a=e[t].high);let o=a-i,s=o===0?50:(e[r].close-i)/o*100;n.push(s),t.push({index:r,value:s,upper:null})}for(let r=0;r<e.length;r++){if(n[r]===null)continue;let e=0,i=0;for(let t=r;t>=0&&e<this.dPeriod&&n[t]!==null;t--)i+=n[t],e++;e===this.dPeriod&&(t[r].upper=i/this.dPeriod)}return t}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a,l=n.yToPixel(80,c,i),u=n.yToPixel(20,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[80,50,20]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke(),e.beginPath(),e.strokeStyle=`#ff9800`,e.lineWidth=1,e.lineJoin=`round`,d=!1;for(let a of t){if(a.upper==null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.upper,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}};function Ts(e,t){let n=[];for(let r=0;r<e.length;r++){if(r<t-1){n.push(null);continue}let i=0,a=!0;for(let n=r-t+1;n<=r;n++){if(e[n]===null){a=!1;break}i+=e[n]}n.push(a?i/t:null)}return n}var Es=class{constructor(e=14,t=14,n=3,r=3,i=`#00e5ff`){this.rsiPeriod=e,this.stochPeriod=t,this.kPeriod=n,this.dPeriod=r,this.name=`StochRSI`,this.pane=`sub`,this.paneHeight=80,this.color=i}compute(e){let t=[];if(e.length<this.rsiPeriod+1)return e.map((e,t)=>({index:t,value:null,upper:null}));let n=0,r=0;for(let t=1;t<=this.rsiPeriod;t++){let i=e[t].close-e[t-1].close;i>0?n+=i:r+=Math.abs(i)}n/=this.rsiPeriod,r/=this.rsiPeriod;for(let e=0;e<this.rsiPeriod;e++)t.push(null);let i=r===0?1/0:n/r;t.push(r===0?100:100-100/(1+i));for(let i=this.rsiPeriod+1;i<e.length;i++){let a=e[i].close-e[i-1].close,o=a>0?a:0,s=a<0?Math.abs(a):0;n=(n*(this.rsiPeriod-1)+o)/this.rsiPeriod,r=(r*(this.rsiPeriod-1)+s)/this.rsiPeriod;let c=r===0?1/0:n/r;t.push(r===0?100:100-100/(1+c))}let a=[];for(let n=0;n<e.length;n++){if(t[n]===null){a.push(null);continue}if(n<this.rsiPeriod+this.stochPeriod-1){a.push(null);continue}let e=1/0,r=-1/0,i=!0;for(let a=n-this.stochPeriod+1;a<=n;a++){if(t[a]===null){i=!1;break}let n=t[a];n<e&&(e=n),n>r&&(r=n)}if(!i){a.push(null);continue}let o=r-e,s=o===0?50:(t[n]-e)/o*100;a.push(s)}let o=Ts(a,this.kPeriod),s=Ts(o,this.dPeriod);return e.map((e,t)=>{var n,r;return{index:t,value:(n=o[t])==null?null:n,upper:(r=s[t])==null?null:r}})}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a,l=n.yToPixel(80,c,i),u=n.yToPixel(20,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[80,50,20]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke(),e.beginPath(),e.strokeStyle=`#ff9800`,e.lineWidth=1,e.lineJoin=`round`,d=!1;for(let a of t){if(a.upper==null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.upper,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}};function Ds(e,t){let n=2/(t+1),r=[],i=null;for(let a=0;a<e.length;a++){if(a<t-1){r.push(null);continue}if(i===null){let n=0;for(let r=0;r<t;r++)n+=e[a-r];i=n/t}else i=e[a]*n+i*(1-n);r.push(i)}return r}var Os=class{constructor(e=12,t=26,n=9,r=`#2196f3`,i=`MACD`,a=`close`){this.fast=e,this.slow=t,this.signal=n,this.source=a,this.pane=`sub`,this.paneHeight=80,this.name=i,this.color=r}compute(e){let t=e.map(e=>Z(e,this.source)),n=Ds(t,this.fast),r=Ds(t,this.slow),i=t.map((e,t)=>n[t]===null||r[t]===null?null:n[t]-r[t]),a=Ds(i.map(e=>e==null?0:e),this.signal);return e.map((e,t)=>{let n=i[t];if(n===null)return{index:t,value:null,upper:null,lower:null,histogram:null};let r=t>=this.slow-1+this.signal-1?a[t]:null;return{index:t,value:n,upper:r,lower:n!==null&&r!==null?n-r:null}})}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,Math.abs(n.value))),n.upper!=null&&(t=Math.max(t,Math.abs(n.upper))),n.lower!=null&&(t=Math.max(t,Math.abs(n.lower)));return{min:-t*1.3,max:t*1.3}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,Math.abs(e.value))),e.upper!=null&&(c=Math.max(c,Math.abs(e.upper))),e.lower!=null&&(c=Math.max(c,Math.abs(e.lower)));let l=a==null?{min:-c*1.3,max:c*1.3}:a,u=n.yToPixel(0,l,i);e.strokeStyle=`rgba(150,150,150,0.3)`,e.lineWidth=1,e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke();let d=Math.max(n.candleBodyWidth(r,s),1);for(let a of t){if(a.lower==null)continue;let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.lower,l,i),c=Math.abs(o-u),f=Math.min(o,u);e.fillStyle=a.lower>=0?`rgba(38,166,154,0.55)`:`rgba(239,83,80,0.55)`,e.fillRect(t-d/2,f,d,c)}e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let f=!1;for(let a of t){if(a.value==null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke(),e.beginPath(),e.strokeStyle=`#ff6b35`,e.lineWidth=1,e.lineJoin=`round`,f=!1;for(let a of t){if(a.upper==null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.upper,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke()}},ks=class{constructor(e=20,t=`#4db6ac`){this.period=e,this.name=`CCI`,this.pane=`sub`,this.paneHeight=80,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null};let r=e.slice(n-this.period+1,n+1).map(e=>(e.high+e.low+e.close)/3),i=r[r.length-1],a=r.reduce((e,t)=>e+t,0)/this.period,o=r.reduce((e,t)=>e+Math.abs(t-a),0)/this.period;return o===0?{index:n,value:0}:{index:n,value:(i-a)/(.015*o)}})}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,Math.abs(n.value)));return{min:-t*1.3,max:t*1.3}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,Math.abs(e.value)));let l=a==null?{min:-c*1.3,max:c*1.3}:a,u=n.yToPixel(100,l,i),d=n.yToPixel(-100,l,i);e.fillStyle=`rgba(239,83,80,0.10)`,e.fillRect(0,0,s,u),e.fillStyle=`rgba(38,166,154,0.10)`,e.fillRect(0,d,s,i-d),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[100,0,-100]){let r=n.yToPixel(t,l,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let f=!1;for(let a of t){if(a.value===null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke()}},As=class{constructor(e=14,t=`#ff7043`){this.period=e,this.name=`%R`,this.pane=`sub`,this.paneHeight=80,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period-1)return{index:n,value:null};let r=-1/0,i=1/0;for(let t=n-this.period+1;t<=n;t++)e[t].high>r&&(r=e[t].high),e[t].low<i&&(i=e[t].low);let a=r-i;return{index:n,value:a===0?-50:(r-e[n].close)/a*-100}})}getValueRange(e){return{min:-100,max:0}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:-100,max:0}:a,l=n.yToPixel(-20,c,i),u=n.yToPixel(-80,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[-20,-50,-80]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}},js=class{constructor(e=12,t=`#80cbc4`,n=`close`){this.period=e,this.source=n,this.pane=`sub`,this.paneHeight=80,this.name=`ROC`,this.color=t}compute(e){return e.map((t,n)=>{if(n<this.period)return{index:n,value:null};let r=Z(e[n-this.period],this.source);return r===0?{index:n,value:null}:{index:n,value:(Z(e[n],this.source)-r)/r*100}})}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,Math.abs(n.value)));return{min:-t*1.3,max:t*1.3}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,Math.abs(e.value)));let l=a==null?{min:-c*1.3,max:c*1.3}:a,u=n.yToPixel(0,l,i),d=[];for(let e of t)e.value!=null&&d.push({x:n.xToPixel(e.index,r,s),y:n.yToPixel(e.value,l,i),value:e.value});if(d.length>=2){e.beginPath(),e.moveTo(d[0].x,u);for(let t of d)e.lineTo(t.x,Math.min(t.y,u));e.lineTo(d[d.length-1].x,u),e.closePath(),e.fillStyle=`rgba(38,166,154,0.05)`,e.fill(),e.beginPath(),e.moveTo(d[0].x,u);for(let t of d)e.lineTo(t.x,Math.max(t.y,u));e.lineTo(d[d.length-1].x,u),e.closePath(),e.fillStyle=`rgba(239,83,80,0.05)`,e.fill()}e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1,e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke(),e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let f=!1;for(let a of t){if(a.value===null){f=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,l,i);f?e.lineTo(t,o):(e.moveTo(t,o),f=!0)}e.stroke()}},Ms=class{constructor(e=`#aed581`){this.name=`OBV`,this.pane=`sub`,this.paneHeight=80,this.color=e}compute(e){let t=[],n=0;for(let o=0;o<e.length;o++){if(o===0){var r;n=(r=e[o].volume)==null?0:r}else if(e[o].close>e[o-1].close){var i;n+=(i=e[o].volume)==null?0:i}else if(e[o].close<e[o-1].close){var a;n-=(a=e[o].volume)==null?0:a}t.push({index:o,value:n})}return t}getValueRange(e){let t=1/0,n=-1/0;for(let r of e)r.value!=null&&(r.value<t&&(t=r.value),r.value>n&&(n=r.value));if(t===1/0)return{min:0,max:1};let r=(n-t)*.1||1;return{min:t-r,max:n+r}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1/0,l=-1/0;for(let e of t)e.value!=null&&(e.value<c&&(c=e.value),e.value>l&&(l=e.value));if(c===1/0)return;let u=(l-c)*.1||1,d=a==null?{min:c-u,max:l+u}:a,f=n.yToPixel(0,d,i),p=[];for(let e of t)e.value!=null&&p.push({x:n.xToPixel(e.index,r,s),y:n.yToPixel(e.value,d,i),value:e.value});if(p.length===0)return;if(e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1,e.beginPath(),e.moveTo(0,f),e.lineTo(s,f),e.stroke(),e.setLineDash([]),e.restore(),p.length>=2){e.beginPath(),e.moveTo(p[0].x,f);for(let t of p)e.lineTo(t.x,t.y);e.lineTo(p[p.length-1].x,f),e.closePath(),e.fillStyle=p[p.length-1].value>=0?`rgba(38,166,154,0.12)`:`rgba(239,83,80,0.12)`,e.fill()}e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let m=!1;for(let a of t){if(a.value==null){m=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,d,i);m?e.lineTo(t,o):(e.moveTo(t,o),m=!0)}e.stroke()}},Ns=class{constructor(e=`#9c27b0`){this.name=`VWAP`,this.color=e}compute(e){let t=[],n=0,r=0;for(let o=0;o<e.length;o++){var i,a;let s=e[o],c=(s.high+s.low+s.close)/3;n+=c*((i=s.volume)==null?0:i),r+=(a=s.volume)==null?0:a,t.push({index:o,value:r===0?null:n/r})}return t}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`,e.setLineDash([4,3]);let l=!1;for(let a of t){if(a.value===null){l=!1;continue}let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);l?e.lineTo(t,o):(e.moveTo(t,o),l=!0)}e.stroke(),e.setLineDash([])}},Ps=class{constructor(e=`#ce93d8`){this.name=`A/D`,this.pane=`sub`,this.paneHeight=80,this.color=e}compute(e){let t=[],n=0;for(let r=0;r<e.length;r++){let{high:i,low:a,close:o,volume:s}=e[r],c=i-a,l=c===0?0:(o-a-(i-o))/c;n+=l*(s==null?0:s),t.push({index:r,value:n})}return t}getValueRange(e){let t=1/0,n=-1/0;for(let r of e)r.value!=null&&(r.value<t&&(t=r.value),r.value>n&&(n=r.value));if(t===1/0)return{min:0,max:1};let r=(n-t)*.1||1;return{min:t-r,max:n+r}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1/0,l=-1/0;for(let e of t)e.value!=null&&(e.value<c&&(c=e.value),e.value>l&&(l=e.value));if(c===1/0)return;let u=(l-c)*.1||1,d=a==null?{min:c-u,max:l+u}:a,f=[];for(let e of t)e.value!=null&&f.push({x:n.xToPixel(e.index,r,s),y:n.yToPixel(e.value,d,i)});if(f.length===0)return;if(f.length>=2){let t=i;e.beginPath(),e.moveTo(f[0].x,t);for(let t of f)e.lineTo(t.x,t.y);e.lineTo(f[f.length-1].x,t),e.closePath(),e.fillStyle=this.color+`20`,e.fill()}e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let p=!1;for(let a of t){if(a.value==null){p=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,d,i);p?e.lineTo(t,o):(e.moveTo(t,o),p=!0)}e.stroke()}},Fs=class{constructor(e=14,t=`#ffab40`){this.period=e,this.pane=`sub`,this.paneHeight=80,this.name=`MFI`,this.color=t}compute(e){let t=[],n=e.map(e=>(e.high+e.low+e.close)/3),r=e.map((e,t)=>{var r;return n[t]*((r=e.volume)==null?0:r)});for(let i=0;i<e.length;i++){if(i<this.period){t.push({index:i,value:null});continue}let e=0,a=0;for(let t=i-this.period+1;t<=i;t++)n[t]>n[t-1]?e+=r[t]:n[t]<n[t-1]&&(a+=r[t]);if(a===0)t.push({index:i,value:100});else{let n=e/a;t.push({index:i,value:100-100/(1+n)})}}return t}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a,l=n.yToPixel(80,c,i),u=n.yToPixel(20,c,i);e.fillStyle=`rgba(239,83,80,0.06)`,e.fillRect(0,0,s,l),e.fillStyle=`rgba(38,166,154,0.06)`,e.fillRect(0,u,s,i-u),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[80,50,20]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore(),e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let d=!1;for(let a of t){if(a.value===null){d=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0)}e.stroke()}},Is=class{constructor(e=20,t=`#80deea`){this.period=e,this.pane=`sub`,this.paneHeight=80,this.name=`CMF`,this.color=t}compute(e){let t=e.map(e=>{var t;let n=e.high-e.low;return(n===0?0:(e.close-e.low-(e.high-e.close))/n)*((t=e.volume)==null?0:t)});return e.map((n,r)=>{if(r<this.period-1)return{index:r,value:null};let i=0,a=0;for(let n=r-this.period+1;n<=r;n++){var o;i+=t[n],a+=(o=e[n].volume)==null?0:o}return{index:r,value:a===0?0:i/a}})}getValueRange(e){return{min:-1,max:1}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:-1,max:1}:a,l=n.yToPixel(0,c,i),u=n.yToPixel(.2,c,i),d=n.yToPixel(-.2,c,i);e.fillStyle=`rgba(38,166,154,0.08)`,e.fillRect(0,0,s,u),e.fillStyle=`rgba(239,83,80,0.08)`,e.fillRect(0,d,s,i-d),e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;for(let t of[.2,0,-.2]){let r=n.yToPixel(t,c,i);e.beginPath(),e.moveTo(0,r),e.lineTo(s,r),e.stroke()}e.setLineDash([]),e.restore();let f=Math.max(1,s/Math.max(t.length,1)*.6);for(let a of t){if(a.value==null)continue;let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i),u=Math.abs(o-l),d=Math.min(o,l);e.fillStyle=a.value>=0?`rgba(38,166,154,0.45)`:`rgba(239,83,80,0.45)`,e.fillRect(t-f/2,d,f,u)}e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let p=!1;for(let a of t){if(a.value===null){p=!1;continue}let t=n.xToPixel(a.index,r,s),o=n.yToPixel(a.value,c,i);p?e.lineTo(t,o):(e.moveTo(t,o),p=!0)}e.stroke()}},Ls=class{constructor(e=`#ffd54f`){this.name=`Pivot`,this.color=e}compute(e){return e.map((t,n)=>{if(n===0)return{index:n,value:null,upper:null,lower:null,signal:null,histogram:null};let r=e[n-1],i=(r.high+r.low+r.close)/3;return{index:n,value:i,upper:2*i-r.low,lower:2*i-r.high,signal:i+(r.high-r.low),histogram:i-(r.high-r.low)}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a,l=null;for(let e=t.length-1;e>=0;e--)if(t[e].value!==null){l=t[e];break}if(l===null)return;let u=[{value:l.signal,label:`R2`,color:`#b71c1c`},{value:l.upper,label:`R1`,color:`#ef5350`},{value:l.value,label:`PP`,color:`#ffd54f`},{value:l.lower,label:`S1`,color:`#26a69a`},{value:l.histogram,label:`S2`,color:`#1b5e20`}];e.lineWidth=1,e.font=`10px sans-serif`,e.textBaseline=`middle`;for(let t of u){if(t.value==null)continue;let r=n.yToPixel(t.value,s,i);e.beginPath(),e.setLineDash([6,4]),e.strokeStyle=t.color,e.moveTo(0,r),e.lineTo(c,r),e.stroke(),e.setLineDash([]),e.fillStyle=t.color,e.fillText(t.label,c-28,r-6)}}},Rs=[0,.236,.382,.5,.618,.786,1],zs=[`0%`,`23.6%`,`38.2%`,`50%`,`61.8%`,`78.6%`,`100%`],Bs=[`#90a4ae`,`#4d96ff`,`#6bcb77`,`#ffd93d`,`#ff9800`,`#ef5350`,`#90a4ae`],Vs=class{constructor(e=50,t=`#e1bee7`){this.lookback=e,this.name=`Fib`,this.color=t}compute(e){return e.map((t,n)=>{let r=Math.max(0,n-this.lookback+1),i=-1/0,a=1/0;for(let t=r;t<=n;t++)e[t].high>i&&(i=e[t].high),e[t].low<a&&(a=e[t].low);let o=i-a;return{index:n,value:i,upper:a+.618*o,lower:a+.382*o,signal:a+.5*o,histogram:a}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a,l=null;for(let e=t.length-1;e>=0;e--)if(t[e].value!==null){l=t[e];break}if(l===null)return;let u=l.value,d=l.histogram;if(u==null||d==null)return;let f=u-d,p=Rs.map(e=>d+e*f);e.lineWidth=1,e.font=`10px sans-serif`,e.textBaseline=`middle`;for(let t=0;t<Rs.length;t++){let r=p[t],a=n.yToPixel(r,s,i),o=Bs[t];e.beginPath(),e.setLineDash([6,4]),e.strokeStyle=o,e.moveTo(0,a),e.lineTo(c,a),e.stroke(),e.setLineDash([]),e.fillStyle=o,e.fillText(zs[t],c-38,a-6)}}},Hs=class{constructor(e=10,t=3,n=`#26a69a`){this.atrPeriod=e,this.multiplier=t,this.name=`Supertrend`,this.color=n}compute(e){let t=e.length,n=[];if(t===0)return n;let r=Array(t).fill(0);for(let n=0;n<t;n++){let t=e[n].high,i=e[n].low,a=n>0?e[n-1].close:e[n].close;r[n]=Math.max(t-i,Math.abs(t-a),Math.abs(i-a))}let i=Array(t).fill(0);if(t<this.atrPeriod){for(let e=0;e<t;e++)n.push({index:e,value:null,upper:null});return n}let a=0;for(let e=0;e<this.atrPeriod;e++)a+=r[e];i[this.atrPeriod-1]=a/this.atrPeriod;for(let e=this.atrPeriod;e<t;e++)i[e]=(i[e-1]*(this.atrPeriod-1)+r[e])/this.atrPeriod;let o=Array(t).fill(0),s=Array(t).fill(0),c=Array(t).fill(1);for(let r=0;r<t;r++){if(r<this.atrPeriod-1){n.push({index:r,value:null,upper:null});continue}let t=(e[r].high+e[r].low)/2,a=t+this.multiplier*i[r],l=t-this.multiplier*i[r];if(r===this.atrPeriod-1){o[r]=a,s[r]=l,c[r]=1,n.push({index:r,value:s[r],upper:1});continue}let u=e[r-1].close;o[r]=a<o[r-1]||u>o[r-1]?a:o[r-1],s[r]=l>s[r-1]||u<s[r-1]?l:s[r-1],c[r-1]===-1?c[r]=e[r].close>o[r]?1:-1:c[r]=e[r].close<s[r]?-1:1;let d=c[r]===1?s[r]:o[r];n.push({index:r,value:d,upper:c[r]})}return n}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=2,e.lineJoin=`round`;let l=null;e.beginPath(),e.strokeStyle=`#26a69a`;let u=!1;for(let a of t){if(a.value==null||a.upper==null){u=!1;continue}if(!(a.upper>=0)){u=!1;continue}l!==1&&(u=!1);let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);u?e.lineTo(t,o):(e.moveTo(t,o),u=!0),l=1}e.stroke(),e.beginPath(),e.strokeStyle=`#ef5350`;let d=!1;l=null;for(let a of t){if(a.value==null||a.upper==null){d=!1;continue}if(!(a.upper<0)){d=!1;continue}l!==-1&&(d=!1);let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);d?e.lineTo(t,o):(e.moveTo(t,o),d=!0),l=-1}e.stroke()}},Us=class{constructor(e=.02,t=.2,n=`#ff6b9d`){this.step=e,this.maxAF=t,this.name=`PSAR`,this.color=n}compute(e){let t=e.length,n=[];if(t<2){for(let e=0;e<t;e++)n.push({index:e,value:null,upper:null});return n}let r=!0,i=this.step,a=e[0].high,o=e[0].low;n.push({index:0,value:null,upper:null});for(let s=1;s<t;s++){let t=o+i*(a-o);if(r){let n=e[s-1].low,o=s>=2?e[s-2].low:e[s-1].low;t=Math.min(t,n,o),t>e[s].low?(r=!1,t=a,a=e[s].low,i=this.step):e[s].high>a&&(a=e[s].high,i=Math.min(i+this.step,this.maxAF))}else{let n=e[s-1].high,o=s>=2?e[s-2].high:e[s-1].high;t=Math.max(t,n,o),t<e[s].high?(r=!0,t=a,a=e[s].high,i=this.step):e[s].low<a&&(a=e[s].low,i=Math.min(i+this.step,this.maxAF))}o=t,n.push({index:s,value:o,upper:r?1:-1})}return n}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;for(let a of t){if(a.value==null||a.upper==null)continue;let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);e.beginPath(),e.arc(t,o,2,0,Math.PI*2),e.fillStyle=a.upper>=0?`#26a69a`:`#ef5350`,e.fill()}}};function Ws(e,t,n){if(t<n-1)return null;let r=-1/0,i=1/0;for(let a=t-n+1;a<=t;a++)e[a].high>r&&(r=e[a].high),e[a].low<i&&(i=e[a].low);return{high:r,low:i}}var Gs=class{constructor(e=9,t=26,n=52,r=`#b0bec5`){this.tenkanPeriod=e,this.kijunPeriod=t,this.senkouBPeriod=n,this.name=`Ichimoku`,this.color=r}compute(e){return e.map((t,n)=>{let r=Ws(e,n,this.tenkanPeriod),i=r===null?null:(r.high+r.low)/2,a=Ws(e,n,this.kijunPeriod),o=a===null?null:(a.high+a.low)/2,s=i!==null&&o!==null?(i+o)/2:null,c=Ws(e,n,this.senkouBPeriod);return{index:n,value:i,upper:o,lower:s,signal:c===null?null:(c.high+c.low)/2,histogram:t.close}})}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.lineWidth=1,e.lineJoin=`round`;let l=(a,o,l=!1)=>{e.strokeStyle=o,l&&e.setLineDash([4,3]),e.beginPath();let u=!1;for(let o of t){let t=a(o);if(t==null){u=!1;continue}let l=n.xToPixel(o.index,r,c),d=n.yToPixel(t,s,i);u?e.lineTo(l,d):(e.moveTo(l,d),u=!0)}e.stroke(),l&&e.setLineDash([])},u=[],d=[];for(let e of t){if(e.lower==null||e.signal==null)continue;let t=n.xToPixel(e.index,r,c);u.push([t,n.yToPixel(e.lower,s,i)]),d.push([t,n.yToPixel(e.signal,s,i)])}for(let t=0;t+1<u.length;t++){let[n,r]=u[t],[i,a]=u[t+1],[,o]=d[t],[,s]=d[t+1],c=r<o;e.beginPath(),e.moveTo(n,r),e.lineTo(i,a),e.lineTo(i,s),e.lineTo(n,o),e.closePath(),e.fillStyle=c?`rgba(38, 166, 154, 0.15)`:`rgba(239, 83, 80, 0.15)`,e.fill()}l(e=>e.lower,`#26a69a`,!0),l(e=>e.signal,`#ef5350`,!0),l(e=>e.value,`#ef9a9a`),l(e=>e.upper,`#90caf9`),e.strokeStyle=`#b0bec5`,e.beginPath();let f=!1;for(let a of t){if(a.histogram==null){f=!1;continue}let t=a.index-this.kijunPeriod;if(t<0){f=!1;continue}let o=n.xToPixel(t,r,c),l=n.yToPixel(a.histogram,s,i);f?e.lineTo(o,l):(e.moveTo(o,l),f=!0)}e.stroke()}},Ks=class{constructor(e=14,t=`#fff176`){this.period=e,this.pane=`sub`,this.paneHeight=80,this.name=`ADX`,this.color=t}compute(e){let t=e.length;if(t<this.period+1)return e.map((e,t)=>({index:t,value:null,upper:null,lower:null}));let n=Array(t).fill(0),r=Array(t).fill(0),i=Array(t).fill(0);n[0]=e[0].high-e[0].low,r[0]=0,i[0]=0;for(let a=1;a<t;a++){let t=e[a-1].close,o=e[a-1].high,s=e[a-1].low,c=e[a].high,l=e[a].low;n[a]=Math.max(c-l,Math.abs(c-t),Math.abs(l-t));let u=c-o,d=s-l;r[a]=u>d&&u>0?u:0,i[a]=d>u&&d>0?d:0}let a=0,o=0,s=0;for(let e=0;e<this.period;e++)a+=n[e],o+=r[e],s+=i[e];let c=[];for(let e=0;e<this.period;e++)c.push({index:e,value:null,upper:null,lower:null});let l=Array(t).fill(0),u=Array(t).fill(0),d=Array(t).fill(0),f=a===0?0:100*o/a,p=a===0?0:100*s/a,m=f+p===0?0:100*Math.abs(f-p)/(f+p);l[this.period-1]=f,u[this.period-1]=p,d[this.period-1]=m,c[this.period-1]={index:this.period-1,value:null,upper:f,lower:p};for(let e=this.period;e<t;e++){a=a-a/this.period+n[e],o=o-o/this.period+r[e],s=s-s/this.period+i[e];let t=a===0?0:100*o/a,f=a===0?0:100*s/a,p=t+f===0?0:100*Math.abs(t-f)/(t+f);l[e]=t,u[e]=f,d[e]=p,c.push({index:e,value:null,upper:t,lower:f})}let h=2*this.period-2;if(h>=t)return c;let g=0;for(let e=this.period-1;e<=h;e++)g+=d[e];g/=this.period,c[h].value=g;for(let e=h+1;e<t;e++)g=(g*(this.period-1)+d[e])/this.period,c[e].value=g;return c}getValueRange(e){return{min:0,max:100}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=a==null?{min:0,max:100}:a;e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1;let l=n.yToPixel(25,c,i);e.beginPath(),e.moveTo(0,l),e.lineTo(s,l),e.stroke(),e.setLineDash([]),e.restore();let u=(a,o,l)=>{e.beginPath(),e.strokeStyle=o,e.lineWidth=l,e.lineJoin=`round`;let u=!1;for(let o of t){let t=a(o);if(t==null){u=!1;continue}let l=n.xToPixel(o.index,r,s),d=n.yToPixel(t,c,i);u?e.lineTo(l,d):(e.moveTo(l,d),u=!0)}e.stroke()};u(e=>e.upper,`#26a69a`,1),u(e=>e.lower,`#ef5350`,1),u(e=>e.value,this.color,1.5)}},qs=class{constructor(e=5,t=34,n=`#b0bec5`){this.fastPeriod=e,this.slowPeriod=t,this.name=`AO`,this.pane=`sub`,this.paneHeight=80,this.color=n}compute(e){let t=e.map(e=>(e.high+e.low)/2),n=(e,t,n)=>{if(t<n-1)return null;let r=0;for(let i=t-n+1;i<=t;i++)r+=e[i];return r/n};return e.map((e,r)=>{let i=n(t,r,this.fastPeriod),a=n(t,r,this.slowPeriod);return i===null||a===null?{index:r,value:null}:{index:r,value:i-a}})}getValueRange(e){let t=1e-4;for(let n of e)n.value!=null&&(t=Math.max(t,Math.abs(n.value)));return{min:-t*1.2,max:t*1.2}}render(e,t,n,r,i,a){var o;let s=(o=e.canvas._chartWidth)==null?e.canvas.width:o,c=1e-4;for(let e of t)e.value!=null&&(c=Math.max(c,Math.abs(e.value)));let l=a==null?{min:-c*1.2,max:c*1.2}:a,u=n.yToPixel(0,l,i);e.save(),e.setLineDash([4,4]),e.strokeStyle=`rgba(150,150,150,0.35)`,e.lineWidth=1,e.beginPath(),e.moveTo(0,u),e.lineTo(s,u),e.stroke(),e.setLineDash([]),e.restore();let d=Math.max(n.candleBodyWidth(r,s),1),f=null;for(let a of t){if(a.value==null){f=null;continue}let t=f===null?!0:a.value>=f,o=n.xToPixel(a.index,r,s),c=n.yToPixel(a.value,l,i),p=Math.abs(c-u),m=Math.min(c,u);e.fillStyle=t?`rgba(38,166,154,0.70)`:`rgba(239,83,80,0.70)`,e.fillRect(o-d/2,m,d,p),f=a.value}}},Js=class{constructor(e=`#90a4ae`,t=`#26a69a`,n=`#ef5350`){this.name=`HA`,this.color=e,this.upColor=t,this.downColor=n}compute(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i],o=(a.open+a.high+a.low+a.close)/4,s;s=i===0?(a.open+a.close)/2:(n+r)/2;let c=Math.max(a.high,s,o),l=Math.min(a.low,s,o);n=s,r=o,t.push({index:i,value:o,upper:c,lower:l,signal:s})}return t}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a,l=n.candleBodyWidth(r,c),u=l/2;for(let a of t){if(a.value==null||a.upper==null||a.lower==null||a.signal==null)continue;let t=a.value,o=a.upper,d=a.lower,f=a.signal,p=t>=f?this.upColor:this.downColor,m=n.xToPixel(a.index,r,c),h=n.yToPixel(o,s,i),g=n.yToPixel(d,s,i),_=n.yToPixel(f,s,i),v=n.yToPixel(t,s,i),y=Math.min(_,v),b=Math.max(1,Math.max(_,v)-y);e.beginPath(),e.strokeStyle=p,e.lineWidth=1,e.moveTo(m,h),e.lineTo(m,g),e.stroke(),e.fillStyle=p,e.strokeStyle=p,e.lineWidth=1,e.fillRect(m-u,y,l,b),e.strokeRect(m-u,y,l,b)}}},Ys=class{constructor(e=`#26a69a`,t=`#ef5350`){this.name=`VOL`,this.pane=`sub`,this.paneHeight=80,this.upColor=e,this.downColor=t,this.color=e}compute(e){return e.map((e,t)=>{var n;return{index:t,value:(n=e.volume)==null?0:n,signal:e.close>=e.open?1:0}})}render(e,t,n,r,i){var a;let o=(a=e.canvas._chartWidth)==null?e.canvas.width:a,s=0;for(let e of t)e.value!=null&&e.value>s&&(s=e.value);if(s===0)return;let c={min:0,max:s*1.1},l=n.yToPixel(0,c,i),u=Math.max(n.candleBodyWidth(r,o),1);for(let a of t){if(a.value==null||a.value===0)continue;let t=n.xToPixel(a.index,r,o),s=n.yToPixel(a.value,c,i),d=Math.abs(l-s);e.fillStyle=a.signal===1?`${this.upColor}99`:`${this.downColor}99`,e.fillRect(t-u/2,s,u,d)}e.fillStyle=this.upColor,e.font=`10px 'Inter', system-ui, sans-serif`,e.fillText(this.name,4,11)}},Xs=class{constructor(e=14,t=`#ff9800`){this.period=e,this.name=`LinReg`,this.color=t}compute(e){let t=this.period,n=[],r=t*(t-1)/2,i=t*(t*(t-1)*(2*t-1)/6)-r*r;for(let a=0;a<e.length;a++){if(a<t-1){n.push({index:a,value:null});continue}let o=0,s=0;for(let n=0;n<t;n++){let r=e[a-(t-1-n)].close;o+=r,s+=n*r}let c=(t*s-r*o)/i,l=(o-c*r)/t+c*(t-1);n.push({index:a,value:l})}return n}render(e,t,n,r,i){var a;let o=e.canvas,s=o._priceRange;if(!s)return;let c=(a=o._chartWidth)==null?e.canvas.width:a;e.beginPath(),e.strokeStyle=this.color,e.lineWidth=1.5,e.lineJoin=`round`;let l=!1;for(let a of t){if(a.value===null){l=!1;continue}let t=n.xToPixel(a.index,r,c),o=n.yToPixel(a.value,s,i);l?e.lineTo(t,o):(e.moveTo(t,o),l=!0)}e.stroke()}},Zs=[{name:`Moving Average`,short_name:`MA`,type:`Trend`,enabled:!0},{name:`Exponential Moving Average`,short_name:`EMA`,type:`Trend`,enabled:!0},{name:`Weighted Moving Average`,short_name:`WMA`,type:`Trend`,enabled:!0},{name:`Hull Moving Average`,short_name:`HMA`,type:`Trend`,enabled:!0},{name:`Moving Average Ribbon`,short_name:`MARibbon`,type:`Trend`,enabled:!0},{name:`Bollinger Bands`,short_name:`BB`,type:`Volatility`,enabled:!0},{name:`Keltner Channels`,short_name:`KC`,type:`Volatility`,enabled:!0},{name:`Donchian Channels`,short_name:`DC`,type:`Volatility`,enabled:!0},{name:`Average True Range`,short_name:`ATR`,type:`Volatility`,enabled:!0},{name:`Relative Strength Index`,short_name:`RSI`,type:`Momentum`,enabled:!0},{name:`Stochastic Oscillator`,short_name:`Stoch`,type:`Momentum`,enabled:!0},{name:`Stochastic RSI`,short_name:`StochRSI`,type:`Momentum`,enabled:!0},{name:`MACD`,short_name:`MACD`,type:`Momentum`,enabled:!0},{name:`Commodity Channel Index`,short_name:`CCI`,type:`Momentum`,enabled:!0},{name:`Williams %R`,short_name:`%R`,type:`Momentum`,enabled:!0},{name:`Rate of Change`,short_name:`ROC`,type:`Momentum`,enabled:!0},{name:`On Balance Volume`,short_name:`OBV`,type:`Volume`,enabled:!0},{name:`Volume`,short_name:`VOL`,type:`Volume`,enabled:!0},{name:`Volume Weighted Average Price`,short_name:`VWAP`,type:`Volume`,enabled:!0},{name:`Accumulation/Distribution`,short_name:`A/D`,type:`Volume`,enabled:!0},{name:`Money Flow Index`,short_name:`MFI`,type:`Volume`,enabled:!0},{name:`Chaikin Money Flow`,short_name:`CMF`,type:`Volume`,enabled:!0},{name:`Pivot Points Standard`,short_name:`Pivot`,type:`Support/Resistance`,enabled:!0},{name:`Fibonacci Retracement`,short_name:`Fib`,type:`Support/Resistance`,enabled:!0},{name:`Supertrend`,short_name:`Supertrend`,type:`Trend`,enabled:!0},{name:`Parabolic SAR`,short_name:`PSAR`,type:`Trend`,enabled:!0},{name:`Ichimoku Cloud`,short_name:`Ichimoku`,type:`Trend`,enabled:!0},{name:`ADX`,short_name:`ADX`,type:`Trend Strength`,enabled:!0},{name:`Awesome Oscillator`,short_name:`AO`,type:`Momentum`,enabled:!0},{name:`Heikin Ashi`,short_name:`HA`,type:`Price Transformation`,enabled:!1},{name:`Linear Regression`,short_name:`LinReg`,type:`Trend`,enabled:!0}];function Qs(e,t){if(e.length===0||t<=0)return e;let n=new Map;for(let r of e){let e=Math.floor(r.time/t)*t,i=n.get(e);i?i.push(r):n.set(e,[r])}let r=[];for(let[e,t]of n){let n=t[0].high,a=t[0].low,o=0;for(let e of t){var i;e.high>n&&(n=e.high),e.low<a&&(a=e.low),o+=(i=e.volume)==null?0:i}r.push({time:e,open:t[0].open,high:n,low:a,close:t[t.length-1].close,volume:o})}return r.sort((e,t)=>e.time-t.time),r}var $s,ec=[{shortName:`MA`,factory:()=>new us(20)},{shortName:`EMA`,factory:()=>new fs(20)},{shortName:`WMA`,factory:()=>new ps(20)},{shortName:`HMA`,factory:()=>new hs(20)},{shortName:`MARibbon`,factory:()=>new vs},{shortName:`BB`,factory:()=>new ys(20,2)},{shortName:`KC`,factory:()=>new bs(20,2)},{shortName:`DC`,factory:()=>new xs(20)},{shortName:`ATR`,factory:()=>new Ss(14)},{shortName:`RSI`,factory:()=>new Cs(14)},{shortName:`Stoch`,factory:()=>new ws(14,3)},{shortName:`StochRSI`,factory:()=>new Es(14,14,3,3)},{shortName:`MACD`,factory:()=>new Os(12,26,9)},{shortName:`CCI`,factory:()=>new ks(20)},{shortName:`%R`,factory:()=>new As(14)},{shortName:`ROC`,factory:()=>new js(12)},{shortName:`AO`,factory:()=>new qs},{shortName:`OBV`,factory:()=>new Ms},{shortName:`VWAP`,factory:()=>new Ns},{shortName:`A/D`,factory:()=>new Ps},{shortName:`MFI`,factory:()=>new Fs(14)},{shortName:`CMF`,factory:()=>new Is(20)},{shortName:`Pivot`,factory:()=>new Ls},{shortName:`Fib`,factory:()=>new Vs(50)},{shortName:`Supertrend`,factory:()=>new Hs(10,3)},{shortName:`PSAR`,factory:()=>new Us(.02,.2)},{shortName:`Ichimoku`,factory:()=>new Gs(9,26,52)},{shortName:`ADX`,factory:()=>new Ks(14)},{shortName:`HA`,factory:()=>new Js},{shortName:`VOL`,factory:()=>new Ys},{shortName:`LinReg`,factory:()=>new Xs(14)}],tc={kind:`select`,key:`timeframe`,label:`Timeframe`,options:[`Chart`,`1m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`8h`,`1D`,`1W`,`1M`],default:`Chart`};function nc(e,t,n){if(!n)return e;let r=n.fields.filter(e=>e.kind===`number`).map(e=>{var n;return(n=t[e.key])==null?e.default:n});return r.length>0?`${e}(${r.join(`, `)})`:e}var rc=[{shortName:`MA`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#F5A623`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new us(e.period,e.color,`MA`,e.source)},{shortName:`EMA`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#9B59B6`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new fs(e.period,e.color,`EMA`,e.source)},{shortName:`WMA`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#e91e63`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new ps(e.period,e.color,`WMA`,e.source)},{shortName:`HMA`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#00bcd4`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new hs(e.period,e.color,`HMA`,e.source)},{shortName:`MARibbon`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#ffcc80`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new vs(e.color,e.source)},{shortName:`BB`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`number`,key:`stdDev`,label:`Std Dev`,min:.1,max:10,step:.1,default:2},{kind:`color`,key:`color`,label:`Color`,default:`#3B82F6`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new ys(e.period,e.stdDev,e.color,`BB`,e.source)},{shortName:`KC`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`number`,key:`mult`,label:`Multiplier`,min:.1,max:10,step:.1,default:2},{kind:`number`,key:`atrPeriod`,label:`ATR Period`,min:1,max:500,step:1,default:10},{kind:`color`,key:`color`,label:`Color`,default:`#4caf50`}],factory:e=>new bs(e.period,e.mult,e.atrPeriod,e.color)},{shortName:`DC`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#26c6da`}],factory:e=>new xs(e.period,e.color)},{shortName:`ATR`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#ff5722`}],factory:e=>new Ss(e.period,e.color)},{shortName:`RSI`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#e8b84b`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new Cs(e.period,e.color,`RSI`,e.source)},{shortName:`Stoch`,fields:[{kind:`number`,key:`kPeriod`,label:`K Period`,min:1,max:500,step:1,default:14},{kind:`number`,key:`dPeriod`,label:`D Period`,min:1,max:100,step:1,default:3},{kind:`color`,key:`color`,label:`Color`,default:`#e040fb`}],factory:e=>new ws(e.kPeriod,e.dPeriod,e.color)},{shortName:`StochRSI`,fields:[{kind:`number`,key:`rsiPeriod`,label:`RSI Period`,min:1,max:500,step:1,default:14},{kind:`number`,key:`stochPeriod`,label:`Stoch Period`,min:1,max:500,step:1,default:14},{kind:`number`,key:`kPeriod`,label:`K Smooth`,min:1,max:100,step:1,default:3},{kind:`number`,key:`dPeriod`,label:`D Smooth`,min:1,max:100,step:1,default:3},{kind:`color`,key:`color`,label:`Color`,default:`#00e5ff`}],factory:e=>new Es(e.rsiPeriod,e.stochPeriod,e.kPeriod,e.dPeriod,e.color)},{shortName:`MACD`,fields:[{kind:`number`,key:`fast`,label:`Fast Period`,min:1,max:500,step:1,default:12},{kind:`number`,key:`slow`,label:`Slow Period`,min:1,max:500,step:1,default:26},{kind:`number`,key:`signal`,label:`Signal Period`,min:1,max:100,step:1,default:9},{kind:`color`,key:`color`,label:`Color`,default:`#2196f3`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new Os(e.fast,e.slow,e.signal,e.color,`MACD`,e.source)},{shortName:`CCI`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#4db6ac`}],factory:e=>new ks(e.period,e.color)},{shortName:`%R`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#ff7043`}],factory:e=>new As(e.period,e.color)},{shortName:`ROC`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:12},{kind:`color`,key:`color`,label:`Color`,default:`#80cbc4`},{kind:`select`,key:`source`,label:`Source`,options:[`open`,`high`,`low`,`close`],default:`close`}],factory:e=>new js(e.period,e.color,e.source)},{shortName:`AO`,fields:[{kind:`number`,key:`fastPeriod`,label:`Fast Period`,min:1,max:100,step:1,default:5},{kind:`number`,key:`slowPeriod`,label:`Slow Period`,min:1,max:200,step:1,default:34},{kind:`color`,key:`color`,label:`Color`,default:`#b0bec5`}],factory:e=>new qs(e.fastPeriod,e.slowPeriod,e.color)},{shortName:`OBV`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#aed581`}],factory:e=>new Ms(e.color)},{shortName:`VWAP`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#9c27b0`}],factory:e=>new Ns(e.color)},{shortName:`A/D`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#ce93d8`}],factory:e=>new Ps(e.color)},{shortName:`MFI`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#ffab40`}],factory:e=>new Fs(e.period,e.color)},{shortName:`CMF`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:20},{kind:`color`,key:`color`,label:`Color`,default:`#80deea`}],factory:e=>new Is(e.period,e.color)},{shortName:`Pivot`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#ffd54f`}],factory:e=>new Ls(e.color)},{shortName:`Fib`,fields:[{kind:`number`,key:`lookback`,label:`Lookback`,min:1,max:500,step:1,default:50},{kind:`color`,key:`color`,label:`Color`,default:`#e1bee7`}],factory:e=>new Vs(e.lookback,e.color)},{shortName:`Supertrend`,fields:[{kind:`number`,key:`atrPeriod`,label:`ATR Period`,min:1,max:500,step:1,default:10},{kind:`number`,key:`multiplier`,label:`Multiplier`,min:.1,max:20,step:.1,default:3},{kind:`color`,key:`color`,label:`Color`,default:`#26a69a`}],factory:e=>new Hs(e.atrPeriod,e.multiplier,e.color)},{shortName:`PSAR`,fields:[{kind:`number`,key:`step`,label:`Step`,min:.001,max:.1,step:.001,default:.02},{kind:`number`,key:`maxAF`,label:`Max AF`,min:.01,max:1,step:.01,default:.2},{kind:`color`,key:`color`,label:`Color`,default:`#ff6b9d`}],factory:e=>new Us(e.step,e.maxAF,e.color)},{shortName:`Ichimoku`,fields:[{kind:`number`,key:`tenkan`,label:`Tenkan Period`,min:1,max:100,step:1,default:9},{kind:`number`,key:`kijun`,label:`Kijun Period`,min:1,max:200,step:1,default:26},{kind:`number`,key:`senkouB`,label:`Senkou B Period`,min:1,max:500,step:1,default:52},{kind:`color`,key:`color`,label:`Color`,default:`#b0bec5`}],factory:e=>new Gs(e.tenkan,e.kijun,e.senkouB,e.color)},{shortName:`ADX`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#fff176`}],factory:e=>new Ks(e.period,e.color)},{shortName:`HA`,fields:[{kind:`color`,key:`color`,label:`Color`,default:`#90a4ae`},{kind:`color`,key:`upColor`,label:`Up Color`,default:`#26a69a`},{kind:`color`,key:`downColor`,label:`Down Color`,default:`#ef5350`}],factory:e=>new Js(e.color,e.upColor,e.downColor)},{shortName:`VOL`,fields:[{kind:`color`,key:`upColor`,label:`Up Color`,default:`#26a69a`},{kind:`color`,key:`downColor`,label:`Down Color`,default:`#ef5350`}],factory:e=>new Ys(e.upColor,e.downColor)},{shortName:`LinReg`,fields:[{kind:`number`,key:`period`,label:`Period`,min:1,max:500,step:1,default:14},{kind:`color`,key:`color`,label:`Color`,default:`#ff9800`}],factory:e=>new Xs(e.period,e.color)}],ic=70,ac=24,oc=.18,sc=80,cc=1,lc=80,uc=10,dc=.25,fc=.2;function pc(){return typeof window<`u`&&(`ontouchstart`in window||navigator.maxTouchPoints>1)}function mc(e=2,t=!1,n=lc,r,i,a){if(i&&i>0&&a&&a>0){let e=Math.floor(i/a);return Math.max(10,Math.min(500,e))}return!t&&!pc()?n:r===void 0?Math.max(10,Math.round(n/e)):r}var hc=4;function gc(e,t){let n=(e.min+e.max)/2,r=(e.max-e.min)/2;return{min:n-r*t,max:n+r*t}}function _c(e){let t=e.max-e.min;return t>=100?0:t>=10?1:t>=1?2:t>=.1?3:4}var vc=class n{get indicators(){return this.activeIndicators.filter(e=>{if(!e.visible)return!1;let t=e.currentParams.timeframe;return!(t&&t!==`Chart`&&t!==this.timeframe)}).map(e=>e.indicator)}scheduleViewportPersist(){this._viewportPersistTimer&&clearTimeout(this._viewportPersistTimer),this._viewportPersistTimer=setTimeout(()=>{this._viewportPersistTimer=null,this.emitStateChange()},500)}get isFullscreen(){return this._isCssFullscreen||!!document.fullscreenElement}get _isTradingActive(){var e,t,n,r;return((e=(t=this.tradePopover)==null?void 0:t.isVisible)==null?!1:e)||this.draftOrderLabel!==null||((n=(r=this.tradeDragHandler)==null?void 0:r.active)==null?!1:n)||this.pendingLevelDrags.size>0}constructor(i){var a,o,l,f,p,m,h,g,_,v,y,b,x,C,T,D,O,A,j,M;if(this.topBar=null,this.bottomBar=null,this.leftBar=null,this.leftBarVisible=!0,this.drawingToolsEnabled=!0,this.settingsEnabled=!0,this.fullscreenEnabled=!0,this._mobileLayout=!1,this.indicatorOverlay=null,this.subPaneOverlays=new Map,this.isinPickerModal=null,this.isins=[],this.siEl=null,this.siStreamDot=null,this.siSymbolSpan=null,this.siOHLCSpan=null,this.siOHLC2Span=null,this.tickActivityTimer=null,this.tickActivityMs=3e4,this.streamStatus=`disconnected`,this.indicatorSettingsDialog=null,this.chartSettingsDialog=null,this.tradeButton=null,this.tradePopover=null,this.draftOrderLabel=null,this._minLots=1,this._showQuantityField=!1,this._qtyFieldMin=1,this._qtyFieldMax=100,this._draftQtyFlyout=null,this._draftQtyPillArea=void 0,this._activeQtyPillLabel=void 0,this.pendingQtyChanges=new Map,this.originalQtyByLabel=new Map,this._onOrderSubmit=void 0,this.scrollToEndBtn=null,this.scrollToEndVisible=!1,this.scrollAnimId=null,this.resetViewBtn=null,this.resetViewVisible=!1,this._defaultVisibleBars=lc,this.dataStore=new t,this.scaleManager=new r,this.emitter=new s,this.themeName=`dark`,this._debug=!1,this.symbol=``,this.showBidAskLines=!1,this.showActLogo=!1,this.hideLevelConfirmCancel=!1,this.tradeLevelButtonScale=1,this.levelClusteringEnabled=!0,this.clusterThresholdDistance=20,this.enableThemeToggle=!1,this.activeIndicators=[],this.indicatorResults=new Map,this.viewport={startIndex:0,endIndex:mc(),candleWidth:8,candleGap:2},this._targetViewport={startIndex:0,endIndex:mc(),candleWidth:8,candleGap:2},this._isPanning=!1,this.crosshair=null,this.drawingManager=new Zo,this.textInputEl=null,this.textInputDrawing=null,this._pendingDrawDrag=null,this._pendingDrawResize=null,this._pendingTradeDrag=null,this.paneHeightOverrides=new Map,this.separatorDrag=null,this.priceAxisWidth=ic,this.timeAxisHeight=ac,this.priceScaleFactor=1,this.pricePanOffset=0,this._displayedPriceRange=null,this._lockedAutoFitBase=null,this._pendingViewportRestore=null,this._viewportPersistTimer=null,this.axisDrag=null,this.subPaneScaleFactors=new Map,this._mobileCrosshairActive=!1,this._mobileTapStartXY=null,this._longPressTimer=null,this._longPressPoint=null,this._lastTouchTime=0,this._tradeButtonClickData=null,this.disposeVvListener=()=>{},this.rafId=null,this.countdownRafId=null,this.countdownActive=!1,this._cachedWrapRect=null,this._cachedDrawRect=null,this._drawTouchAnchorActive=!1,this._lastDrawingTouchPoint=null,this._drawTouchStartXY=null,this._mobileDrawingFlyout=null,this._isCssFullscreen=!1,this.timezone=`UTC`,this.settingsCanvasColors={},this.streamAdapter=null,this.liveBidAsk=null,this.tickClosePriceSource=`bid`,this._suppressTicks=!1,this.levels=[],this.tradeLevelHitAreas=[],this.offViewportHitAreas=[],this.tradeLevelEditAreas=[],this.tradeHoverAreas=[],this.tradeLevelDragAreas=[],this.tradeLevelConfirmAreas=[],this.tradeAddBracketAreas=[],this.clusterBadgeAreas=[],this.lastClusters=[],this.expandedClusters=new Set,this.hoveredTradeLabel=null,this.selectedTradeLabel=null,this._editOpenLabel=null,this.draftBracketPnl={},this.tradeDragHandler=null,this.tradeDragNewPrice=null,this.tradeDragNewSLPrice=null,this.tradeDragNewTPPrice=null,this._pendingBracketOrderLabel=null,this._slSiblingOrderLabel=null,this._tpSiblingOrderLabel=null,this._isBracketNew=!1,this.pendingLevelDrags=new Map,this.tfcEnabled=!0,this.tfcActive=!0,this.tradeDisplayFilter=`all`,this.positionRenderStyle=`dot`,this.tradesThresholdForHorizontalLine=2,this.positionRenderStyleOverride=null,this.RENDER_STYLE_LS_KEY=`finchart:positionRenderStyle`,this.dataLoader=null,this.isFetching=!1,this.noMoreData=!1,this._loadGeneration=0,this.maxCandles=200,this.minInitialBars=10,this.maxLookbackMs=365*24*60*60*1e3,this.prefetchThreshold=80,this.defaultVisibleBars=lc,this.defaultMobileVisibleBars=void 0,this.mobileBarDivisor=2,this.explicitMobileDivisor=!1,this._autoVisibleBars=!0,this.targetCandleWidth=uc,this.maxSubPanes=3,this.showCandleCountdown=!0,this.loadingOverlayEl=null,this.noDataOverlayEl=null,this.logoImage=null,this.isRestoringState=!1,this.onMouseMove=e=>{var t,r,i,a,o;if(this._mobileCrosshairActive||Date.now()-this._lastTouchTime<500)return;let s=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,c=e.clientX-s.left,l=e.clientY-s.top,{chartW:u,priceH:d}=this.getChartLayout(),f=(r=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):r,p=s.height-this.timeAxisHeight,m=c<u&&l<p,h=this.scaleManager.pixelToBarIndex(c,this.viewport,u),g=this.scaleManager.pixelToPrice(l,f,d),_=Math.max(Math.floor(this.viewport.startIndex),Math.min(Math.ceil(this.viewport.endIndex),Math.round(h))),v=(i=this.dataStore.all[_])==null?null:i;this.crosshair=m&&!((a=this.tradePopover)!=null&&a.isVisible)&&this.selectedTradeLabel===null?{x:c,y:l,barIndex:_,price:g,bar:v}:null,this.crosshair&&this.emitter.emit(`crosshair`,this.crosshair);let y=this.positionRenderStyle===`dot`&&this.hoveredTradeLabel!==null;if(this.tradeButton&&(m&&l>=0&&l<=d&&!this._isTradingActive&&!y?(this.tradeButton.setY(l),St(l,this.uiConfig.tradeButton.size/2,this.offViewportHitAreas)?this.tradeButton.hide():this.tfcActive&&this.tradeButton.show(),this._tradeButtonClickData={price:g,y:l}):this.tradeButton.hide()),this._pendingDrawResize){let e=c-this._pendingDrawResize.startX,t=l-this._pendingDrawResize.startY;Math.sqrt(e*e+t*t)>n.DRAW_GESTURE_THRESHOLD&&(this.drawingManager.startResize(this._pendingDrawResize.drawing,this._pendingDrawResize.pointIndex),this._pendingDrawResize=null)}if(this._pendingDrawDrag){let e=c-this._pendingDrawDrag.startX,t=l-this._pendingDrawDrag.startY;Math.sqrt(e*e+t*t)>n.DRAW_GESTURE_THRESHOLD&&(this.drawingManager.startDrag(this._pendingDrawDrag.drawing,this.makeDrawingPoint(h,g)),this._pendingDrawDrag=null)}if(this.drawingManager.onMouseMove(this.makeDrawingPoint(h,g)),this.axisDrag){if(this.axisDrag.axis===`price`){let e=l-this.axisDrag.startPos;this.priceScaleFactor=Math.max(.1,Math.min(10,this.axisDrag.startSize*1.005**e))}else if(this.axisDrag.axis===`subpane`&&this.axisDrag.indicatorName){let e=l-this.axisDrag.startPos,t=Math.max(.1,Math.min(20,this.axisDrag.startSize*1.005**e));this.subPaneScaleFactors.set(this.axisDrag.indicatorName,t)}else{let e=c-this.axisDrag.startPos,t=Math.max(10,Math.min(500,Math.round(this.axisDrag.startSize+e*.5))),n=(this.viewport.startIndex+this.viewport.endIndex)/2,r=Math.max(0,n-t/2);this.viewport={...this.viewport,startIndex:r,endIndex:r+t},this._targetViewport={...this.viewport}}this.drawCanvas.style.cursor=this.axisDrag.axis===`time`?`ew-resize`:`ns-resize`,this.scheduleRender();return}if(this.separatorDrag){let e=this.separatorDrag.startY-l,t=Math.max(40,Math.min(300,this.separatorDrag.startH+e));this.paneHeightOverrides.set(this.separatorDrag.indicatorName,t),this.drawCanvas.style.cursor=`ns-resize`,this.scheduleRender();return}if(this._pendingTradeDrag){let e=c-this._pendingTradeDrag.startX,t=l-this._pendingTradeDrag.startY;if(Math.sqrt(e*e+t*t)>n.TRADE_DRAG_PIXEL_THRESHOLD){let{dragHit:e,level:t,hitY:n}=this._pendingTradeDrag;this._pendingTradeDrag=null,this._startTradeDragFromHit(e,t,n),this.drawCanvas.style.cursor=`ns-resize`}else return}if((o=this.tradeDragHandler)!=null&&o.active){var b,x,S;let e=this.tradeDragHandler.onMouseMove(l,this.scaleManager,f,d);if(this.tradeDragNewPrice=(b=e==null?void 0:e.newPrice)==null?null:b,this.tradeDragNewSLPrice=(x=e==null?void 0:e.derivedSLPrice)==null?null:x,this.tradeDragNewTPPrice=(S=e==null?void 0:e.derivedTPPrice)==null?null:S,this.drawCanvas.style.cursor=`ns-resize`,this.renderTradeLayer(),this.tradeDragNewPrice!==null&&e){let t=e.label.indexOf(`:`),n=t===-1?e.label:e.label.slice(0,t),r=t===-1?void 0:e.label.slice(t+1),i=this.levels.find(e=>e.label===n);i&&this.emitter.emit(`tradeLevelDrag`,{label:i.label,newPrice:this.tradeDragNewPrice,data:i.data,bracketType:r,...e.derivedSLPrice===void 0?{}:{derivedSLPrice:e.derivedSLPrice},...e.derivedTPPrice===void 0?{}:{derivedTPPrice:e.derivedTPPrice},isFullscreen:this.isFullscreen})}return}if(!this.drawingManager.getActiveTool()){var C;if(ue(c,l,this.clusterBadgeAreas)||nt(c,l,this.tradeLevelHitAreas)||rt(c,l,this.tradeLevelEditAreas)||it(c,l,this.tradeLevelConfirmAreas)||xt(c,l,this.offViewportHitAreas)){this.drawCanvas.style.cursor=`pointer`,this.scheduleRender();return}let e=ot(c,l,this.tradeLevelDragAreas);if(e){this.drawCanvas.style.cursor=`ns-resize`,e.label!==this.hoveredTradeLabel&&(this.hoveredTradeLabel=e.label,this.renderTradeLayer()),this.scheduleRender();return}let t=at(c,l,this.tradeHoverAreas),n=(C=t==null?void 0:t.label)==null?null:C;if(n!==this.hoveredTradeLabel&&(this.hoveredTradeLabel=n,this.renderTradeLayer()),this.positionRenderStyle===`dot`&&n!==null){this.crosshair=null,this.drawCanvas.style.cursor=`pointer`,this.scheduleRender();return}if(this.getSeparatorPositions().find(e=>Math.abs(l-e.y)<=4))this.drawCanvas.style.cursor=`ns-resize`;else if(c>=u)this.drawCanvas.style.cursor=`ns-resize`;else if(l>=p)this.drawCanvas.style.cursor=`ew-resize`;else if(this.drawingManager.isDraggingDrawing()||this.drawingManager.isResizingDrawing())this.drawCanvas.style.cursor=`grabbing`;else{let e=this.drawingManager.getHandleAtPoint(c,l,this.scaleManager,this.viewport,f,u,d);if(e)this.drawCanvas.style.cursor=e.handle.cursor;else{let e=this.drawingManager.hitTest(c,l,this.scaleManager,this.viewport,f,u,d);this.drawCanvas.style.cursor=e?`move`:`default`}}}this.scheduleRender()},this.onMouseLeave=e=>{if(!(this.tradeButton&&this.tradeButton.el.contains(e.relatedTarget))&&!this._mobileCrosshairActive){if(this.crosshair=null,!this._isTradingActive){var t;(t=this.tradeButton)==null||t.hide()}this.hoveredTradeLabel!==null&&(this.hoveredTradeLabel=null,this.renderTradeLayer()),this.scheduleRender()}},this.onMouseUp=()=>{var e;if(this._pendingTradeDrag){let{level:e}=this._pendingTradeDrag;if(this._pendingTradeDrag=null,this._editOpenLabel===e.label&&!this.pendingLevelDrags.has(e.label)){this._cancelEditAndDeselect(e.label);return}this._openTradeLevelEditForm(e);return}if((e=this.tradeDragHandler)!=null&&e.active){let e=this.tradeDragHandler.endDrag();if(e){var t;this._finalizeMainDragWithBrackets(e,(t=this._pendingBracketOrderLabel)==null?void 0:t)}else this.tradeDragNewPrice=null;this._pendingBracketOrderLabel=null,this.drawCanvas.style.cursor=`default`,this.renderTradeLayer();return}if(this.axisDrag){let e=this.axisDrag.axis===`price`||this.axisDrag.axis===`time`;this.axisDrag=null,this.drawCanvas.style.cursor=`default`,this.scheduleRender(),e&&this.scheduleViewportPersist()}this.separatorDrag&&(this.separatorDrag=null,this.drawCanvas.style.cursor=`default`,this.scheduleRender()),this._pendingDrawDrag=null,this._pendingDrawResize=null,this.drawingManager.isDraggingDrawing()&&(this.drawingManager.endDrag(),this.drawCanvas.style.cursor=`default`,this.scheduleRender()),this.drawingManager.isResizingDrawing()&&(this.drawingManager.endResize(),this.drawCanvas.style.cursor=`default`,this.scheduleRender())},this.onDrawingTouchStart=e=>{var t;if(e.touches.length!==1)return;let n=e.touches[0],r=this.touchToDrawingPoint(n),i=this.drawingManager.getActiveTool(),a=this.drawingManager.isPlacing();if(i!==null||a){e.preventDefault(),this._lastDrawingTouchPoint=r,a?(this._drawTouchAnchorActive=!1,this.drawingManager.onMouseMove(r)):(this.drawingManager.onMouseDown(r),this._drawTouchAnchorActive=this.drawingManager.isPlacing()),this.scheduleRender();return}let o=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,s=n.clientX-o.left,c=n.clientY-o.top,{chartW:l,priceH:u}=this.getChartLayout(),d=this.getScaledPriceRange(this.viewport);if(s>=l){if(e.preventDefault(),c<=u)this.axisDrag={axis:`price`,startPos:c,startSize:this.priceScaleFactor};else{let e=this.activeIndicators.filter(e=>e.indicator.pane===`sub`).map(e=>e.indicator),t=u+cc;for(let n of e){let e=this.paneH(n);if(c>=t&&c<t+e){var f;this.axisDrag={axis:`subpane`,startPos:c,startSize:(f=this.subPaneScaleFactors.get(n.name))==null?1:f,indicatorName:n.name};break}t+=e+cc}}this.scheduleRender();return}let p=o.height-this.timeAxisHeight;if(c>=p){e.preventDefault(),this.axisDrag={axis:`time`,startPos:s,startSize:this.viewport.endIndex-this.viewport.startIndex},this.scheduleRender();return}let m=this.drawingManager.getHandleAtPoint(s,c,this.scaleManager,this.viewport,d,l,u);if(m){e.preventDefault(),this.panHandler.cancel(),this.drawingManager.selectDrawing(m.drawing),this.drawingManager.startResize(m.drawing,m.handle.pointIndex),this.hideMobileDrawingFlyout(),this.scheduleRender();return}let h=this.drawingManager.hitTest(s,c,this.scaleManager,this.viewport,d,l,u);if(h){e.preventDefault(),this.panHandler.cancel(),this.drawingManager.selectDrawing(h),this.drawingManager.startDrag(h,r),this._drawTouchStartXY={x:n.clientX,y:n.clientY},this.hideMobileDrawingFlyout(),this.scheduleRender();return}let g=ue(s,c,this.clusterBadgeAreas);if(g){e.preventDefault(),this.panHandler.cancel(),this.expandedClusters.has(g.clusterId)?this.expandedClusters.delete(g.clusterId):this.expandedClusters.add(g.clusterId),this.renderTradeLayer();return}let _=xt(s,c,this.offViewportHitAreas);if(_){e.preventDefault(),this.panHandler.cancel(),this.scrollToCenterPrice(_.targetPrice);return}let v=it(s,c,this.tradeLevelConfirmAreas);if(v){e.preventDefault(),v.action===`confirm`?this.applyPendingChanges(v.label):this.revertPendingChanges(v.label);return}if(this._showQuantityField&&this._draftQtyPillArea){let t=this._draftQtyPillArea;if(s>=t.pillX&&s<=t.pillX+t.pillW&&c>=t.pillY&&c<=t.pillY+t.pillH){e.preventDefault(),e.stopPropagation(),this.openDraftQtyFlyout(t);return}}let y=nt(s,c,this.tradeLevelHitAreas);if(y){e.preventDefault(),this._handleTradeLevelClose(y);return}if(!this.drawingManager.getActiveTool()){let t=rt(s,c,this.tradeLevelEditAreas);if(t){e.preventDefault();let n=this.levels.find(e=>e.label===t.label);n&&this._openTradeLevelEditForm(n);return}}if(this.tradeDragHandler&&!this.drawingManager.getActiveTool()){let t=ot(s,c,this.tradeLevelDragAreas);if(t){e.preventDefault();let n=this.levels.find(e=>e.label===t.label);if(n){let e=this.selectedTradeLabel===n.label,r=t.isBracket||n.type===`pending`&&n.orderType!==`market`&&(e||!t.isBox);if(this.hideLevelConfirmCancel&&!r){let e=this.pendingLevelDrags.has(n.label);if(this.selectedTradeLabel===n.label&&!e){this._cancelEditAndDeselect(n.label);return}this._openTradeLevelEditForm(n);return}this._startTradeDragFromHit(t,n,c),this.scheduleRender();return}}let n=st(s,c,this.tradeAddBracketAreas);if(n){e.preventDefault(),this._startAddBracketFromHit(n,c),this.scheduleRender();return}}if(this.tradeDragHandler&&!this.drawingManager.getActiveTool()){let t=at(s,c,this.tradeHoverAreas);if(t){e.preventDefault();let n=this.levels.find(e=>e.label===t.label);if(n){let e=this.pendingLevelDrags.has(t.label);if(this.selectedTradeLabel===t.label&&!e){this._cancelEditAndDeselect(t.label);return}this._openTradeLevelEditForm(n);return}}}this.drawingManager.selectDrawing(null),this.hideMobileDrawingFlyout(),this.expandedClusters.size>0&&(this.expandedClusters.clear(),this.renderTradeLayer()),s<l&&c<p&&(this._mobileCrosshairActive?(this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null),this._mobileTapStartXY={x:s,y:c}):(this._longPressTimer!==null&&clearTimeout(this._longPressTimer),this._longPressPoint={x:s,y:c},this._longPressTimer=setTimeout(()=>{this._longPressTimer=null,this._longPressPoint&&(this._activateMobileCrosshair(this._longPressPoint.x,this._longPressPoint.y),this._longPressPoint=null)},500)))},this.onDrawingTouchMove=e=>{var t;if(e.touches.length!==1)return;let n=this.touchToDrawingPoint(e.touches[0]);if(this._lastDrawingTouchPoint=n,this.axisDrag){var r;e.preventDefault();let t=e.touches[0],n=(r=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():r,i=t.clientX-n.left,a=t.clientY-n.top;if(this.axisDrag.axis===`price`){let e=a-this.axisDrag.startPos;this.priceScaleFactor=Math.max(.1,Math.min(10,this.axisDrag.startSize*1.005**e))}else if(this.axisDrag.axis===`subpane`&&this.axisDrag.indicatorName){let e=a-this.axisDrag.startPos,t=Math.max(.1,Math.min(20,this.axisDrag.startSize*1.005**e));this.subPaneScaleFactors.set(this.axisDrag.indicatorName,t)}else{let e=i-this.axisDrag.startPos,t=Math.max(10,Math.min(500,Math.round(this.axisDrag.startSize+e*.5))),n=(this.viewport.startIndex+this.viewport.endIndex)/2,r=Math.max(0,n-t/2);this.viewport={...this.viewport,startIndex:r,endIndex:r+t}}this.scheduleRender();return}if(this.drawingManager.isPlacing()&&!this._drawTouchAnchorActive){e.preventDefault(),this.drawingManager.onMouseMove(n),this.scheduleRender();return}if(this.drawingManager.isDraggingDrawing()||this.drawingManager.isResizingDrawing()){e.preventDefault(),e.stopPropagation(),this.drawingManager.onMouseMove(n),this.scheduleRender();return}if((t=this.tradeDragHandler)!=null&&t.active){var i,a,o,s,c;e.preventDefault();let t=e.touches[0],n=(i=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():i,r=t.clientY-n.top,{priceH:l}=this.getChartLayout(),u=(a=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):a,d=this.tradeDragHandler.onMouseMove(r,this.scaleManager,u,l);if(this.tradeDragNewPrice=(o=d==null?void 0:d.newPrice)==null?null:o,this.tradeDragNewSLPrice=(s=d==null?void 0:d.derivedSLPrice)==null?null:s,this.tradeDragNewTPPrice=(c=d==null?void 0:d.derivedTPPrice)==null?null:c,this.renderTradeLayer(),this.tradeDragNewPrice!==null&&d){let e=d.label.indexOf(`:`),t=e===-1?d.label:d.label.slice(0,e),n=e===-1?void 0:d.label.slice(e+1),r=this.levels.find(e=>e.label===t);r&&this.emitter.emit(`tradeLevelDrag`,{label:r.label,newPrice:this.tradeDragNewPrice,data:r.data,bracketType:n,...d.derivedSLPrice===void 0?{}:{derivedSLPrice:d.derivedSLPrice},...d.derivedTPPrice===void 0?{}:{derivedTPPrice:d.derivedTPPrice},isFullscreen:this.isFullscreen})}return}if(this._mobileTapStartXY||this._longPressTimer!==null){var l,u;let t=e.touches[0],n=(l=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():l,r=(u=this._mobileTapStartXY)==null?this._longPressPoint:u;if(r){let e=t.clientX-n.left-r.x,i=t.clientY-n.top-r.y;Math.sqrt(e*e+i*i)>6&&(this._mobileTapStartXY=null,this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null,this._longPressPoint=null))}}if(this._mobileCrosshairActive){var d,f;e.preventDefault();let t=e.touches[0],n=(d=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():d,r=t.clientX-n.left,i=t.clientY-n.top,{chartW:a,priceH:o}=this.getChartLayout(),s=(f=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):f,c=n.height-this.timeAxisHeight;if(r<a&&i<c){var p;let e=this.scaleManager.pixelToBarIndex(r,this.viewport,a),t=this.scaleManager.pixelToPrice(i,s,o),n=Math.max(Math.floor(this.viewport.startIndex),Math.min(Math.ceil(this.viewport.endIndex),Math.round(e))),c=(p=this.dataStore.all[n])==null?null:p;this.crosshair=this.selectedTradeLabel===null?{x:r,y:i,barIndex:n,price:t,bar:c}:null,this.tradeButton&&(this.tradeButton.setY(i),this._isTradingActive||St(i,this.uiConfig.tradeButton.size/2,this.offViewportHitAreas)?this.tradeButton.hide():this.tfcActive&&this.tradeButton.show(),this._tradeButtonClickData={price:t,y:i}),this.scheduleRender()}}},this.onDrawingTouchEnd=e=>{var t;if(this._lastTouchTime=Date.now(),this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null,this._longPressPoint=null),(t=this.tradeDragHandler)!=null&&t.active){let e=this.tradeDragHandler.endDrag();if(e){var n;this._finalizeMainDragWithBrackets(e,(n=this._pendingBracketOrderLabel)==null?void 0:n)}else this.tradeDragNewPrice=null;this._pendingBracketOrderLabel=null,this.renderTradeLayer();return}if(this.axisDrag){let e=this.axisDrag.axis===`price`||this.axisDrag.axis===`time`;this.axisDrag=null,this.scheduleRender(),e&&this.scheduleViewportPersist();return}let r=this._drawTouchAnchorActive;if(this._drawTouchAnchorActive=!1,!r&&this.drawingManager.isPlacing()&&this._lastDrawingTouchPoint){this.drawingManager.onMouseDown(this._lastDrawingTouchPoint),this._lastDrawingTouchPoint=null,this.scheduleRender();return}if(this.drawingManager.isDraggingDrawing()){let t=e.changedTouches[0],n=this._drawTouchStartXY;if(this._drawTouchStartXY=null,this.drawingManager.endDrag(),t&&n&&this.drawingManager.getSelectedDrawing()){let e=t.clientX-n.x,r=t.clientY-n.y;Math.sqrt(e*e+r*r)<8&&this.showMobileDrawingFlyout(t.clientX,t.clientY)}this.scheduleRender()}if(this.drawingManager.isResizingDrawing()&&(this.drawingManager.endResize(),this.scheduleRender()),this._mobileTapStartXY){var i;this._mobileTapStartXY=null,this._mobileCrosshairActive=!1,this.crosshair=null,(i=this.tradeButton)==null||i.hide(),this.scheduleRender()}},this.onCanvasClick=e=>{var t,n;let r=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,i=e.clientX-r.left,a=e.clientY-r.top,{chartW:o,priceH:s}=this.getChartLayout(),c=(n=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):n,l=this.scaleManager.pixelToBarIndex(i,this.viewport,o),u=this.scaleManager.pixelToPrice(a,c,s),d=Math.round(l),f=ue(i,a,this.clusterBadgeAreas);if(f){this.expandedClusters.has(f.clusterId)?this.expandedClusters.delete(f.clusterId):this.expandedClusters.add(f.clusterId),this.renderTradeLayer();return}let p=xt(i,a,this.offViewportHitAreas);if(p){this.scrollToCenterPrice(p.targetPrice);return}let m=it(i,a,this.tradeLevelConfirmAreas);if(m){m.action===`confirm`?this.applyPendingChanges(m.label):this.revertPendingChanges(m.label);return}if(this._showQuantityField&&this._draftQtyPillArea){let t=this._draftQtyPillArea;if(i>=t.pillX&&i<=t.pillX+t.pillW&&a>=t.pillY&&a<=t.pillY+t.pillH){e.preventDefault(),e.stopPropagation(),this.openDraftQtyFlyout(t);return}}let h=nt(i,a,this.tradeLevelHitAreas);if(h){this._handleTradeLevelClose(h);return}if(!this.drawingManager.getActiveTool()){let e=rt(i,a,this.tradeLevelEditAreas);if(e){let t=this.levels.find(t=>t.label===e.label);t&&this._openTradeLevelEditForm(t);return}}if(this.tradeDragHandler&&!this.drawingManager.getActiveTool()){let e=st(i,a,this.tradeAddBracketAreas);if(e){this._startAddBracketFromHit(e,a),this.drawCanvas.style.cursor=`ns-resize`;return}}if(this.tradeDragHandler&&!this.drawingManager.getActiveTool()){let e=ot(i,a,this.tradeLevelDragAreas);if(e){let t=this.levels.find(t=>t.label===e.label);if(t&&!(this.hideLevelConfirmCancel&&!e.isBracket)){this._pendingTradeDrag={dragHit:e,level:t,hitY:a,startX:i,startY:a};return}}}let g=at(i,a,this.tradeHoverAreas);if(g){let e=this.pendingLevelDrags.has(g.label);if(this.selectedTradeLabel===g.label&&!e){this._cancelEditAndDeselect(g.label);return}let t=this.levels.find(e=>e.label===g.label);t?this._openTradeLevelEditForm(t):(this.selectedTradeLabel=g.label,this.renderTradeLayer());return}else if(this.selectedTradeLabel!==null&&!this.hideLevelConfirmCancel){let e=this.selectedTradeLabel,t=this.pendingLevelDrags.get(e);!t||t.length===0?this._cancelEditAndDeselect(e):this.revertPendingChanges(e)}this.expandedClusters.size>0&&(this.expandedClusters.clear(),this.renderTradeLayer());let _=r.height-this.timeAxisHeight;if(i>=o){if(a<=s)this.axisDrag={axis:`price`,startPos:a,startSize:this.priceScaleFactor};else{let e=this.activeIndicators.filter(e=>e.indicator.pane===`sub`).map(e=>e.indicator),t=s+cc;for(let n of e){let e=this.paneH(n);if(a>=t&&a<t+e){var v;this.axisDrag={axis:`subpane`,startPos:a,startSize:(v=this.subPaneScaleFactors.get(n.name))==null?1:v,indicatorName:n.name};break}t+=e+cc}}this.scheduleRender();return}if(a>=_){this.axisDrag={axis:`time`,startPos:i,startSize:this.viewport.endIndex-this.viewport.startIndex},this.scheduleRender();return}let y=this.getSeparatorPositions().find(e=>Math.abs(a-e.y)<=4);if(y){var b,x;let e=this.indicators.find(e=>e.name===y.indicatorName),t=(b=(x=this.paneHeightOverrides.get(y.indicatorName))==null?e==null?void 0:e.paneHeight:x)==null?sc:b;this.separatorDrag={indicatorName:y.indicatorName,startY:a,startH:t},this.scheduleRender();return}if(!this.drawingManager.onMouseDown(this.makeDrawingPoint(l,u))){var S;let e=this.drawingManager.getHandleAtPoint(i,a,this.scaleManager,this.viewport,c,o,s);if(e)this.drawingManager.selectDrawing(e.drawing),this._pendingDrawResize={drawing:e.drawing,pointIndex:e.handle.pointIndex,startX:i,startY:a};else{let e=this.drawingManager.hitTest(i,a,this.scaleManager,this.viewport,c,o,s);this.drawingManager.selectDrawing(e),e&&(this._pendingDrawDrag={drawing:e,startX:i,startY:a})}let t=(S=this.dataStore.all[d])==null?null:S;this.emitter.emit(`click`,{x:i,y:a,barIndex:d,price:u,bar:t})}this.scheduleRender()},this.onDoubleClick=e=>{var t;this.drawingManager.finalizePlacing();let n=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,r=e.clientX-n.left,i=e.clientY-n.top,{chartW:a,priceH:o}=this.getChartLayout(),s=n.height-this.timeAxisHeight;if(r>=a){this.resetPriceAxis();return}if(i>=s){this.resetTimeAxis();return}let c=new Set([`text`,`callout`,`anchoredNote`]),l=this.drawingManager.getSelectedDrawing();if(l&&c.has(l.type)){let e=this.getScaledPriceRange(this.viewport);if(l.hitTest(r,i,this.scaleManager,this.viewport,e,a,o)){this.showTextInput(l);return}}this.scheduleRender()},this.onKeyDown=e=>{if(e.key===`Escape`&&this.expandedClusters.size>0){this.expandedClusters.clear(),this.renderTradeLayer(),e.preventDefault();return}if(e.key===`Escape`&&this.pendingLevelDrags.size>0){this.revertPendingChanges(),e.preventDefault();return}let t=(e.ctrlKey||e.metaKey)&&e.key===`z`?`z`:e.key;if(this.drawingManager.onKeyDown(t)){var n;e.preventDefault(),this.hideMobileDrawingFlyout(),(n=this.leftBar)==null||n.setActiveTool(this.drawingManager.getActiveTool()),this.drawCanvas.style.cursor=this.drawingManager.getActiveTool()?`crosshair`:`default`,this.scheduleRender()}},this.onTick=e=>{let t=this.dataStore.all;if(t.length===0||this._suppressTicks)return;this.liveBidAsk={bid:e.bid,ask:e.ask},this.setDotTickActive();let n=t[t.length-1],r=this.timeframeToMs(this.timeframe),i=this.tickClosePriceSource===`ask`?e.ask:e.bid;if(e.time<n.time+r){var a;let r={...n,high:Math.max(n.high,i),low:Math.min(n.low,i),close:i,volume:((a=n.volume)==null?0:a)+e.volume};t[t.length-1]=r}else{let a=n,o=Math.floor(e.time/r)*r;t.push({time:o,open:i,high:i,low:i,close:i,volume:e.volume}),this._debug&&console.warn(`[tick] → NEW candle @ ${new Date(o).toISOString()} (closed ${new Date(a.time).toISOString()}) | total bars=${t.length}`);let s=t[t.length-1];this._targetViewport.endIndex>=t.length&&(this._targetViewport={...this._targetViewport,startIndex:this._targetViewport.startIndex+1,endIndex:this._targetViewport.endIndex+1}),this.emitter.emit(`newBar`,{completedBar:a,openingBar:s,intervalMs:r}),this.correctCompletedBar(a.time,r),o>a.time+r&&this.fillTickGap(a.time,o)}this.recomputeIndicators(),this.scheduleRender()},typeof window>`u`||typeof document>`u`)throw Error(`acttrader-charts requires a browser environment`);if(sn(),window.visualViewport){let e=window.visualViewport,t=()=>{this._cachedWrapRect=null,this._cachedDrawRect=null};e.addEventListener(`resize`,t),e.addEventListener(`scroll`,t),this.disposeVvListener=()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,t)}}let{container:N,theme:P=`dark`,series:F=`candlestick`,showVolume:I=!0,showUI:L=!0,timeframe:R=`1D`,duration:z=void 0,symbol:B=``,isins:V,onIsinSelect:H,onSymbolClick:ee,onOrderSubmit:te,dataLoader:U,durationTimeframeMap:ne,uiConfig:re,labels:ie,tickActivityMs:ae=3e4,hideSymbolAndTick:oe=!1,showBottomBar:se=!1}=i;if(this.dataLoader=U==null?null:U,this.drawingToolsEnabled=i.showDrawingTools!==!1,this.settingsEnabled=i.showSettings!==!1,this.fullscreenEnabled=i.showFullscreenButton!==!1,this.uiConfig=S(re),this.labels=w(ie),this.tickActivityMs=ae,this.maxCandles=(a=i.maxCandles)==null?200:a,this.minInitialBars=Math.max(0,(o=i.minInitialBars)==null?10:o),this.maxLookbackMs=Math.max(0,(l=i.maxLookbackMs)==null?365*24*60*60*1e3:l),this.prefetchThreshold=(f=i.prefetchThreshold)==null?80:f,this.defaultVisibleBars=(p=i.defaultVisibleBars)==null?lc:p,this.defaultMobileVisibleBars=i.defaultMobileVisibleBars,this.explicitMobileDivisor=i.mobileBarDivisor!==void 0,this.mobileBarDivisor=(m=i.mobileBarDivisor)==null?2:m,this._autoVisibleBars=i.defaultVisibleBars==null&&i.defaultMobileVisibleBars==null,this.targetCandleWidth=(h=i.targetCandleWidth)==null?uc:h,this.viewport={...this.viewport,endIndex:mc(this.mobileBarDivisor,this.explicitMobileDivisor,this.defaultVisibleBars,this.defaultMobileVisibleBars)},this._targetViewport={...this.viewport},this.maxSubPanes=(g=i.maxSubPanes)==null?3:g,this.tickClosePriceSource=(_=i.tickClosePriceSource)==null?`bid`:_,this.tradesThresholdForHorizontalLine=(v=i.tradesThresholdForHorizontalLine)==null?2:v,i.positionRenderStyle===`line`||i.positionRenderStyle===`dot`)this.positionRenderStyleOverride=i.positionRenderStyle;else{let e=localStorage.getItem(this.RENDER_STYLE_LS_KEY);(e===`line`||e===`dot`)&&(this.positionRenderStyleOverride=e)}if(i.tradeDisplayFilter&&(this.tradeDisplayFilter=i.tradeDisplayFilter),i.canvasColors&&(this.settingsCanvasColors=i.canvasColors),this.recomputeRenderStyle(),this.showBidAskLines=(y=i.showBidAskLines)==null?!1:y,this.showActLogo=(b=i.showActLogo)==null?!1:b,this.hideLevelConfirmCancel=(x=i.hideLevelConfirmCancel)==null?!1:x,this.tradeLevelButtonScale=Math.min(Math.max((C=i.tradeLevelButtonScale)==null?1:C,1),3),this.levelClusteringEnabled=(T=i.levelClusteringEnabled)==null?!0:T,this.clusterThresholdDistance=(D=i.clusterThresholdDistance)==null?20:D,this.enableThemeToggle=(O=i.enableThemeToggle)==null?!1:O,this.tfcEnabled=i.tfcEnabled!==!1,this.tfcActive=this.tfcEnabled,this.showCandleCountdown=(A=i.showCandleCountdown)==null?!0:A,this.candleCountdownTimeframes=i.candleCountdownTimeframes,this._onOrderSubmit=te,i.minLots!==void 0&&(console.warn(`[acttrader-charts] ChartConfig.minLots is deprecated. DraftOrderQtyInput has been removed. The value is stored and used as the submitted lot size.`),this._minLots=i.minLots),i.showQuantityField!==void 0&&(this._showQuantityField=i.showQuantityField),i.quantityFieldConfig&&(i.quantityFieldConfig.minLots!==void 0&&(this._qtyFieldMin=i.quantityFieldConfig.minLots),i.quantityFieldConfig.maxLots!==void 0&&(this._qtyFieldMax=i.quantityFieldConfig.maxLots)),i.onLotsChange!==void 0&&console.warn(`[acttrader-charts] ChartConfig.onLotsChange is deprecated. DraftOrderQtyInput has been removed; this callback will never fire.`),i.hideQtyButton!==void 0&&console.warn(`[acttrader-charts] ChartConfig.hideQtyButton is deprecated and is a no-op. DraftOrderQtyInput has been removed.`),this.themeName=P===`dark`?`dark`:`light`,this.themeOverrides=i.themeOverrides,this.timezone=i.timezone===`local`?Intl.DateTimeFormat().resolvedOptions().timeZone:(j=i.timezone)==null?`UTC`:j,this.aggregateFrom=i.aggregateFrom,this.theme=c(this.themeName===`dark`?u:d,(M=this.themeOverrides)==null?void 0:M[this.themeName]),this.series=F,this.showVolume=I,this.timeframe=R,this.duration=z,this.symbol=B,this.wrapper=document.createElement(`div`),Object.assign(this.wrapper.style,{display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,overflow:`hidden`,boxSizing:`border-box`}),L){let e={...mn,...ne};this.topBar=new pn(e=>this.setSeries(e),e=>{this.timeframe=e,this.emitter.emit(`timeframeChange`,{timeframe:e}),this.emitStateChange(),this.updateCountdownState(),this.triggerLoad(`timeframe`)},e=>this.addIndicatorByName(e),(e,t)=>{var n,r;this.duration=e,this.timeframe=t,(n=this.topBar)==null||n.setTimeframe(t),(r=this.bottomBar)==null||r.setActive(e),this.emitter.emit(`durationChange`,{duration:e,timeframe:t}),this.emitStateChange(),this.updateCountdownState(),this.triggerLoad(`duration`)},()=>{this.openChartSettings()},()=>{this.toggleFullscreen()},this.drawingToolsEnabled?()=>this.toggleDrawingTools():null,this.drawingToolsEnabled,this.settingsEnabled,this.fullscreenEnabled,this.tfcEnabled,this.tfcActive,this.tfcEnabled?e=>{this.setTfcActive(e)}:null,this.series,this.timeframe,null,e,this.theme,this.uiConfig.topBar,this.labels.topBar,()=>this.emitUiState()),this.topBar.setIndicatorOptions(Zs.filter(e=>e.enabled).map(e=>({value:e.short_name,label:`${e.name} (${e.short_name})`,category:e.type}))),this.wrapper.appendChild(this.topBar.el),this.topBar.setFullscreen(this.isFullscreen)}let ce=document.createElement(`div`);if(Object.assign(ce.style,{display:`flex`,flex:`1`,minHeight:`0`,overflow:`hidden`,position:`relative`}),L&&this.drawingToolsEnabled&&(this.leftBar=new bn(e=>this.setDrawingTool(e),e=>{switch(e){case`undo`:this.undoDrawing();break;case`redo`:this.redoDrawing();break;case`delete_selected`:this.deleteSelectedDrawing();break;case`clear_all`:this.clearAllDrawings();break;case`hide_all`:this.hideAllDrawings();break;case`show_all`:this.showAllDrawings();break;case`lock_all`:this.lockAllDrawings();break;case`unlock_all`:this.unlockAllDrawings();break}},()=>{var e;this.leftBarVisible=!1,(e=this.topBar)==null||e.setDrawingsBtnActive(!1)},this.theme,this.uiConfig.drawingToolbar,this.labels.drawingToolbar),ce.appendChild(this.leftBar.el)),this.canvasWrap=document.createElement(`div`),Object.assign(this.canvasWrap.style,{flex:`1`,position:`relative`,overflow:`hidden`,touchAction:`none`}),this.canvas=document.createElement(`canvas`),Object.assign(this.canvas.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,pointerEvents:`none`}),this.canvasWrap.appendChild(this.canvas),this.tradeCanvas=document.createElement(`canvas`),Object.assign(this.tradeCanvas.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,pointerEvents:`none`}),this.canvasWrap.appendChild(this.tradeCanvas),this.drawCanvas=document.createElement(`canvas`),Object.assign(this.drawCanvas.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,cursor:`crosshair`,touchAction:`none`,userSelect:`none`}),this.drawCanvas.style.webkitUserSelect=`none`,this.drawCanvas.style.webkitTouchCallout=`none`,this.canvasWrap.appendChild(this.drawCanvas),this.textInputEl=document.createElement(`input`),this.textInputEl.type=`text`,Object.assign(this.textInputEl.style,{position:`absolute`,display:`none`,zIndex:`15`,background:`transparent`,border:`none`,borderBottom:`1px solid #2196f3`,color:`#f5f5f5`,font:`16px system-ui, sans-serif`,outline:`none`,minWidth:`60px`,padding:`0 2px`}),this.canvasWrap.appendChild(this.textInputEl),L){this.loadingOverlayEl=document.createElement(`div`),Object.assign(this.loadingOverlayEl.style,{display:`none`,position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`,zIndex:`20`});let e=document.createElement(`span`);e.textContent=this.labels.chart.loading,Object.assign(e.style,{color:`rgba(200,200,200,0.9)`,fontSize:`13px`,background:`rgba(0,0,0,0.45)`,padding:`4px 12px`,borderRadius:`4px`}),this.loadingOverlayEl.appendChild(e),this.canvasWrap.appendChild(this.loadingOverlayEl),this.noDataOverlayEl=document.createElement(`div`),Object.assign(this.noDataOverlayEl.style,{display:`none`,position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`,zIndex:`19`});let t=document.createElement(`span`);t.textContent=this.labels.chart.noData,Object.assign(t.style,{color:`rgba(200,200,200,0.9)`,fontSize:`13px`,background:`rgba(0,0,0,0.45)`,padding:`4px 12px`,borderRadius:`4px`}),this.noDataOverlayEl.appendChild(t),this.canvasWrap.appendChild(this.noDataOverlayEl)}if(L&&!oe){this.siEl=document.createElement(`div`),Object.assign(this.siEl.style,{position:`absolute`,top:`6px`,left:`6px`,zIndex:`10`,display:`flex`,alignItems:`center`,gap:`8px`,pointerEvents:`none`}),this.siSymbolSpan=document.createElement(`span`),Object.assign(this.siSymbolSpan.style,{color:this.theme.axisText,fontSize:`17px`,fontFamily:`'Inter', system-ui, sans-serif`,fontWeight:`700`,display:B?`inline`:`none`}),this.siSymbolSpan.textContent=B==null?``:B,ee?(Object.assign(this.siSymbolSpan.style,{cursor:`pointer`,textDecoration:`underline`,pointerEvents:`auto`}),this.siSymbolSpan.addEventListener(`click`,()=>{var e,t;ee((e=(t=this.siSymbolSpan)==null?void 0:t.textContent)==null?``:e)})):H&&(V&&(this.isins=V),this.isinPickerModal=new cs(this.theme,H,()=>this.emitUiState()),this.getFloatingRoot().appendChild(this.isinPickerModal.el),Object.assign(this.siSymbolSpan.style,{cursor:`pointer`,textDecoration:`underline`,pointerEvents:`auto`}),this.siSymbolSpan.addEventListener(`click`,()=>{var e;this.isinPickerModal.show(this.isins,(e=this.siSymbolSpan.textContent)==null?``:e)})),this.siOHLCSpan=document.createElement(`span`),Object.assign(this.siOHLCSpan.style,{fontSize:`14px`,fontFamily:`'Inter', system-ui, sans-serif`,whiteSpace:`nowrap`}),this.siOHLC2Span=document.createElement(`span`),Object.assign(this.siOHLC2Span.style,{fontSize:`14px`,fontFamily:`'Inter', system-ui, sans-serif`,whiteSpace:`nowrap`}),this.siStreamDot=document.createElement(`span`),Object.assign(this.siStreamDot.style,{width:`7px`,height:`7px`,borderRadius:`50%`,background:this.theme.ui.stream.disconnected,display:`inline-block`,flexShrink:`0`});let e=document.createElement(`div`);Object.assign(e.style,{display:`flex`,alignItems:`center`,gap:`8px`}),e.append(this.siStreamDot,this.siSymbolSpan,this.siOHLCSpan),this.siEl.append(e,this.siOHLC2Span),this.canvasWrap.appendChild(this.siEl)}if(L&&(this.indicatorOverlay=new $o(this.theme,this.uiConfig.indicatorOverlay,this.labels.chart),this.canvasWrap.appendChild(this.indicatorOverlay.el),this.indicatorSettingsDialog=new es(this.theme,this.labels.dialogs,()=>this.emitUiState()),this.getFloatingRoot().appendChild(this.indicatorSettingsDialog.el),this.scrollToEndBtn=document.createElement(`button`),this.scrollToEndBtn.title=this.labels.chart.scrollToLatest,this.applyScrollToEndBtnStyles(),this.scrollToEndBtn.addEventListener(`click`,()=>this.scrollToEnd()),this.canvasWrap.appendChild(this.scrollToEndBtn),this.resetViewBtn=document.createElement(`button`),this.resetViewBtn.title=`Reset view`,this.applyResetViewBtnStyles(),this.resetViewBtn.addEventListener(`click`,()=>this.resetView()),this.canvasWrap.appendChild(this.resetViewBtn)),this.tradeDragHandler=new ls,i.onLevelDragEnd&&this.emitter.on(`tradeLevelDragEnd`,i.onLevelDragEnd),i.onLevelEdit&&this.emitter.on(`tradeLevelEdit`,i.onLevelEdit),te&&(this.tradePopover=new is(this.theme,.01,this.symbol,(e,t,n)=>{this.createDraftOrder(e,t,n)},this.labels.trade,()=>this.emitUiState()),this.canvasWrap.appendChild(this.tradePopover.el),this.tradeButton=new rs(this.theme,this.priceAxisWidth,()=>{if(this._tradeButtonClickData&&this.tradePopover){var e;(e=this.tradeButton)==null||e.hide();let t=this.priceAxisWidth+10+22+4,{price:n,y:r}=this._tradeButtonClickData;this.tradePopover.show(n,r,t,this.dataStore.getPricePrecision(),this._orderTypeForPrice(`buy`,n),this._orderTypeForPrice(`sell`,n))}},this.labels.trade,this.uiConfig.tradeButton),this.canvasWrap.appendChild(this.tradeButton.el),this.tradeButton.el.addEventListener(`mouseenter`,()=>{this.crosshair=null,this.scheduleRender()}),this.tradeButton.el.addEventListener(`mousemove`,e=>{var t;if(e.buttons!==0)return;let n=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,r=e.clientY-n.top,{priceH:i}=this.getChartLayout();if(St(r,this.uiConfig.tradeButton.size/2,this.offViewportHitAreas)){var a;(a=this.tradeButton)==null||a.hide();return}if(r>=0&&r<=i){var o,s;(o=this.tradeButton)==null||o.setY(r);let e=(s=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):s;this._tradeButtonClickData={price:this.scaleManager.pixelToPrice(r,e,i),y:r}}})),ce.appendChild(this.canvasWrap),this.wrapper.appendChild(ce),L&&se){var le;let e={...mn,...ne};this.bottomBar=new gn((e,t)=>{var n;this.duration=e,this.timeframe=t,(n=this.topBar)==null||n.setTimeframe(t),this.emitter.emit(`durationChange`,{duration:e,timeframe:t}),this.emitStateChange(),this.updateCountdownState(),this.triggerLoad(`duration`)},(le=this.duration)==null?null:le,this.theme,e,this.uiConfig.bottomBar,this.labels.bottomBar),this.wrapper.appendChild(this.bottomBar.el)}if(N.appendChild(this.wrapper),this.themeOverrides){var W,de,fe,pe;this.theme=this.buildTheme(this.themeName),(W=this.topBar)==null||W.setTheme(this.theme),(de=this.bottomBar)==null||de.setTheme(this.theme),(fe=this.leftBar)==null||fe.setTheme(this.theme),(pe=this.tradeButton)==null||pe.setTheme(this.theme,this.priceAxisWidth)}let me=this.canvas.getContext(`2d`);if(!me)throw Error(`Canvas 2D context unavailable`);this.ctx=me;let he=this.drawCanvas.getContext(`2d`);if(!he)throw Error(`Drawing canvas 2D context unavailable`);this.drawCtx=he;let ge=this.tradeCanvas.getContext(`2d`);if(!ge)throw Error(`Trade canvas 2D context unavailable`);if(this.tradeCtx=ge,this.showActLogo){let t=new Image;t.onload=()=>{this.logoImage=t,this.scheduleRender()},t.src=e}this.drawingManager.setOnComplete(()=>{var e;(e=this.leftBar)==null||e.setActiveTool(null),this.drawCanvas.style.cursor=`default`}),this.drawingManager.onDrawingsChange=()=>this.emitStateChange(),this.drawingManager.onPointsMutated=e=>{for(let t of e.points){let e=this.barIndexToTimestamp(t.barIndex);e!=null&&(t.timestamp=e)}},this.drawingManager.onStartTextEdit=e=>this.showTextInput(e),this.panHandler=new E(this.drawCanvas,()=>this._targetViewport,e=>{this._targetViewport=e,this.clearDuration(),this.checkNeedMoreData(),this.scheduleRender(),this.scheduleViewportPersist()},()=>this.dataStore.length,()=>this.scheduleRender(),()=>{var e,t;return this.drawingManager.getActiveTool()!==null||this.drawingManager.isDraggingDrawing()||this.drawingManager.isResizingDrawing()||this.separatorDrag!==null||this.axisDrag!==null||((e=(t=this.tradeDragHandler)==null?void 0:t.active)==null?!1:e)||this._mobileCrosshairActive},e=>{var t;if(this.priceScaleFactor===1)return;let{priceH:n}=this.getChartLayout(),r=(t=this._displayedPriceRange)==null?this.getScaledPriceRange(this._targetViewport):t,i=(r.max-r.min)/n;this.pricePanOffset+=e*i,this.scheduleRender(),this.scheduleViewportPersist()},()=>{this._isPanning=!0},()=>{this._isPanning=!1},{enabled:i.momentumScrollEnabled,decay:i.momentumDecay,threshold:i.momentumThreshold,maxVelocity:i.momentumMaxVelocity}),this.zoomHandler=new k(this.drawCanvas,()=>this._targetViewport,e=>{this._targetViewport=e,this.clearDuration(),this.checkNeedMoreData(),this.scheduleRender(),this.scheduleViewportPersist()},()=>this.dataStore.length,()=>this.scheduleRender(),()=>{var e;return(e=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():e},()=>this.getChartLayout().chartW,e=>{let t=this._targetViewport,n=t.endIndex-t.startIndex,r=e*(n/this.drawCanvas.width),i=Math.max(0,this.dataStore.length-Math.floor(n/2)),a=Math.max(0,Math.min(i,t.startIndex+r));this._targetViewport={...t,startIndex:a,endIndex:a+n},this.clearDuration(),this.checkNeedMoreData(),this.scheduleRender(),this.scheduleViewportPersist()}),this.drawCanvas.addEventListener(`mousemove`,this.onMouseMove),this.drawCanvas.addEventListener(`mouseleave`,this.onMouseLeave),this.drawCanvas.addEventListener(`mousedown`,this.onCanvasClick),this.drawCanvas.addEventListener(`dblclick`,this.onDoubleClick),window.addEventListener(`mouseup`,this.onMouseUp),this.drawCanvas.addEventListener(`touchstart`,this.onDrawingTouchStart,{passive:!1}),this.drawCanvas.addEventListener(`touchmove`,this.onDrawingTouchMove,{passive:!1}),this.drawCanvas.addEventListener(`touchend`,this.onDrawingTouchEnd,{passive:!1}),this.drawCanvas.addEventListener(`contextmenu`,e=>e.preventDefault()),document.addEventListener(`keydown`,this.onKeyDown);let _e=()=>{var e;let t=!!document.fullscreenElement;t||(this._isCssFullscreen=!1),(e=this.topBar)==null||e.setFullscreen(t),this.reparentFloatingElements()};this.wrapper.addEventListener(`fullscreenchange`,_e),document.addEventListener(`fullscreenchange`,_e),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this.canvasWrap),this.onResize(),this.dataLoader&&this.triggerLoad(`initial`)}resetData(){return++this._loadGeneration,this.setLoading(!1),this.setNoData(!1),this.drawingManager.clearAll(),this.levels=[],this._draftQtyPillArea=void 0,this._pendingBracketOrderLabel=null,this.loadData([])}loadData(e,t=!1){var n,r,i;this.isFetching=!1,this.noMoreData=!1,this._suppressTicks=!1,e.length>0&&this.setNoData(!1),this.liveBidAsk=null,this.pricePanOffset=0,this.priceScaleFactor=1,this._displayedPriceRange=null,this._lockedAutoFitBase=null,this.dataStore.set(e);let a=((n=(r=this._cachedWrapRect)==null?void 0:r.width)==null?this.canvasWrap.getBoundingClientRect().width:n)-this.priceAxisWidth,o=this._autoVisibleBars&&a>0?a:void 0,s=mc(this.mobileBarDivisor,this.explicitMobileDivisor,this.defaultVisibleBars,this.defaultMobileVisibleBars,o,this.targetCandleWidth);this._defaultVisibleBars=s,this.viewport={...this.viewport,startIndex:t?0:Math.max(0,e.length-s+hc),endIndex:e.length+hc},this._targetViewport={...this.viewport};let c=this.dataStore.hasVolumeData;if(c||(this.showVolume=!1),(i=this.topBar)==null||i.setVolumeControl(this.showVolume,c),this.showVolume&&c){var l;(l=this.indicatorOverlay)==null||l.addPill(`VOL`,this.theme.volume.up,`VOL`,`Chart`,!0,()=>{var e,t;this.setVolume(!1),(e=this.indicatorOverlay)==null||e.removePill(`VOL`),(t=this.topBar)==null||t.setVolumeControl(!1,this.dataStore.hasVolumeData)},null,()=>{var e;this.setVolume(!this.showVolume),(e=this.indicatorOverlay)==null||e.updatePillVisibility(`VOL`,this.showVolume),this.scheduleRender()})}if(this.recomputeIndicators(),this.reanchorDrawingsByTimestamp(),this._pendingViewportRestore){let e=this._pendingViewportRestore;this._pendingViewportRestore=null,e.priceScale&&(this.priceScaleFactor=e.priceScale.factor,this.pricePanOffset=e.priceScale.panOffset,this._displayedPriceRange=null,this._lockedAutoFitBase=null),e.viewport&&this.applyViewportFromTimestamps(e.viewport.startTime,e.viewport.endTime)}return this.updateCountdownState(),this.scheduleRender(),this}prependData(e){if(e.length===0)return this.noMoreData=!0,this.isFetching=!1,this;let t=this.dataStore.prepend(e);return t>0&&(this.viewport={...this.viewport,startIndex:this.viewport.startIndex+t,endIndex:this.viewport.endIndex+t},this._targetViewport={...this.viewport},this.drawingManager.shiftBarIndices(t),this.reanchorDrawingsByTimestamp(),this.recomputeIndicators(),this.scheduleRender()),this.isFetching=!1,this}setLoading(e){return this.loadingOverlayEl&&(this.loadingOverlayEl.style.display=e?`flex`:`none`),e&&this.setNoData(!1),this}setNoData(e){return this.noDataOverlayEl&&(this.noDataOverlayEl.style.display=e?`flex`:`none`),this}timeframeToMs(e){var t;let n=6e4;return(t={"1m":1*n,"5m":5*n,"15m":15*n,"30m":30*n,"1h":60*n,"2h":120*n,"4h":240*n,"8h":480*n,"1D":1440*n,"1W":10080*n,"1M":43200*n}[e])==null?1440*n:t}getBaseInterval(){var e,t;return(e=(t=this.aggregateFrom)==null?void 0:t[this.timeframe])==null?this.timeframe:e}shouldAggregate(){let e=this.getBaseInterval();return e!==this.timeframe&&this.timeframeToMs(e)<this.timeframeToMs(this.timeframe)}maybeAggregate(e){return this.shouldAggregate()?Qs(e,this.timeframeToMs(this.timeframe)):e}timeframeToInterval(e){var t;return(t={"1m":`1min`,"5m":`5min`,"15m":`15min`,"30m":`30min`,"1h":`1h`,"2h":`2h`,"4h":`4h`,"8h":`8h`,"1D":`1day`,"1W":`1week`,"1M":`1month`}[e])==null?`1day`:t}durationToMs(e){var t;let n=1440*60*1e3;return(t={"1D":1*n,"5D":5*n,"1M":30*n,"3M":90*n,"6M":180*n,"1Y":365*n,"5Y":5*365*n,All:20*365*n}[e])==null?365*n:t}triggerLoad(e){if(!this.dataLoader)return;let t=++this._loadGeneration;this._suppressTicks=!0,this.isFetching=!0,this.noMoreData=!1;let n=new Date,r=this.maxCandles*this.timeframeToMs(this.timeframe),i=this.duration?this.durationToMs(this.duration):r,a=Math.min(i,r),o=this.timeframeToInterval(this.getBaseInterval());this.setLoading(!0);let s=this.dataLoader,c=[1,5,25,125],l=this.minInitialBars,u=this.maxLookbackMs,d=(r,i)=>{s({start:i,end:n,interval:o}).then(s=>{if(t!==this._loadGeneration)return;let f=this.maybeAggregate(s),p=n.getTime()-i.getTime()>=u;if(f.length>=l||r+1>=c.length||p){this.loadData(f,e===`duration`),this.setLoading(!1),f.length===0&&this.setNoData(!0),this.emitter.emit(`dataLoaded`,{timeframe:this.timeframe,interval:o,start:i,end:n});return}let m=Math.min(a*c[r+1],u),h=new Date(n.getTime()-m);d(r+1,h)}).catch(()=>{t===this._loadGeneration&&(this.isFetching=!1,this.setLoading(!1))})},f=Math.min(a*c[0],u);d(0,new Date(n.getTime()-f))}checkNeedMoreData(){if(!this.dataLoader||this.isFetching||this.noMoreData)return;let e=Math.max(20,this.prefetchThreshold);if(this._targetViewport.startIndex>e||this.dataStore.length===0)return;let t=this._loadGeneration;this.isFetching=!0;let n=this.dataStore.all[0].time,r=new Date(n-1),i=this.maxCandles*this.timeframeToMs(this.timeframe),a=this.duration?this.durationToMs(this.duration):i,o=Math.min(a,i),s=this.timeframeToInterval(this.getBaseInterval());this.setLoading(!0);let c=this.dataLoader,l=[1,5,25,125],u=this.minInitialBars,d=this.maxLookbackMs,f=(e,n)=>{c({start:n,end:r,interval:s}).then(i=>{if(t!==this._loadGeneration)return;let a=this.maybeAggregate(i),s=r.getTime()-n.getTime()>=d;if(a.length>=u||e+1>=l.length||s){this.prependData(a),this.setLoading(!1);return}let c=Math.min(o*l[e+1],d),p=new Date(r.getTime()-c);f(e+1,p)}).catch(()=>{t===this._loadGeneration&&(this.isFetching=!1,this.setLoading(!1))})},p=Math.min(o*l[0],d);f(0,new Date(r.getTime()-p))}addIndicator(e){var t;if(e.pane===`sub`&&this.activeIndicators.filter(e=>e.indicator.pane===`sub`).length>=this.maxSubPanes)return this;let n=rc.find(t=>t.shortName===e.name),r=n?Object.fromEntries(n.fields.map(e=>[e.key,e.default])):{};r.timeframe=`Chart`;let i={indicator:e,shortName:e.name,currentParams:r,visible:!0};this.activeIndicators.push(i),this.dataStore.length>0&&this.indicatorResults.set(e.name,e.compute(this.dataStore.all));let a=n!==void 0&&n.fields.length>0,o=nc(e.name,r,n);if(e.pane===`sub`){let t=new $o(this.theme,this.uiConfig.indicatorOverlay,this.labels.chart);Object.assign(t.el.style,{position:`absolute`,top:`6px`,left:`6px`,zIndex:`10`}),this.canvasWrap.appendChild(t.el),this.subPaneOverlays.set(e.name,t),t.addPill(e.name,e.color,o,`Chart`,!0,()=>this.removeIndicator(e.name),a?()=>this.openIndicatorSettings(e.name):null,()=>{i.visible=!i.visible,t.updatePillVisibility(e.name,i.visible),this.scheduleRender(),this.emitStateChange()})}else{var s;(s=this.indicatorOverlay)==null||s.addPill(e.name,e.color,o,`Chart`,!0,()=>this.removeIndicator(e.name),a?()=>this.openIndicatorSettings(e.name):null,()=>{var t;i.visible=!i.visible,(t=this.indicatorOverlay)==null||t.updatePillVisibility(e.name,i.visible),this.scheduleRender(),this.emitStateChange()})}return(t=this.topBar)==null||t.setIndicatorOptionActive(e.name,!0),this.scheduleRender(),this.emitStateChange(),this}removeIndicator(e){var t;this.activeIndicators=this.activeIndicators.filter(t=>t.indicator.name!==e),this.indicatorResults.delete(e),this.subPaneScaleFactors.delete(e);let n=this.subPaneOverlays.get(e);if(n)n.destroy(),n.el.remove(),this.subPaneOverlays.delete(e);else{var r;(r=this.indicatorOverlay)==null||r.removePill(e)}return(t=this.topBar)==null||t.setIndicatorOptionActive(e,!1),this.scheduleRender(),this.emitStateChange(),this}addIndicatorByName(e){if(e===`VOL`){var t;if(this.setVolume(!this.showVolume),this.showVolume){var n;(n=this.indicatorOverlay)==null||n.addPill(`VOL`,this.theme.volume.up,`VOL`,`Chart`,!0,()=>{var e,t;this.setVolume(!1),(e=this.indicatorOverlay)==null||e.removePill(`VOL`),(t=this.topBar)==null||t.setVolumeControl(!1,this.dataStore.hasVolumeData)},null,()=>{var e;this.setVolume(!this.showVolume),(e=this.indicatorOverlay)==null||e.updatePillVisibility(`VOL`,this.showVolume),this.scheduleRender()})}else{var r;(r=this.indicatorOverlay)==null||r.removePill(`VOL`)}(t=this.topBar)==null||t.setVolumeControl(this.showVolume,this.dataStore.hasVolumeData);return}let i=ec.find(t=>t.shortName===e);if(i){if(this.activeIndicators.some(t=>t.shortName===e)){this.removeIndicator(e);return}this.addIndicator(i.factory())}}openIndicatorSettings(e){var t;let n=this.activeIndicators.find(t=>t.shortName===e);if(!n)return;let r=rc.find(t=>t.shortName===e);if(!r||r.fields.length===0)return;let i={...r,fields:[...r.fields,tc]};(t=this.indicatorSettingsDialog)==null||t.show(i,n.currentParams,t=>this.updateIndicatorParams(e,t),()=>this.removeIndicator(e))}updateIndicatorParams(e,t){var n;let r=this.activeIndicators.findIndex(t=>t.shortName===e);if(r===-1)return;let i=rc.find(t=>t.shortName===e);if(!i)return;let a=this.activeIndicators[r];if(!a)return;let{timeframe:o,...s}=t,c=i.factory(s);a.indicator=c,a.currentParams={...t},this.indicatorResults.delete(e),this.dataStore.length>0&&this.indicatorResults.set(e,c.compute(this.dataStore.all));let l=(n=this.subPaneOverlays.get(e))==null?this.indicatorOverlay:n;l==null||l.updatePillColor(e,c.color),l==null||l.updatePillLabel(e,nc(e,a.currentParams,i)),l==null||l.updatePillTimeframe(e,o==null?`Chart`:o),this.scheduleRender(),this.emitStateChange()}on(e,t){return this.emitter.on(e,t)}buildTheme(e){var t,n,r,i,a,o,s;let f=e===`dark`?u:d,p=this.settingsCanvasColors[e],m=p?{...p.background!==void 0&&{background:p.background},...p.grid!==void 0&&{grid:p.grid},...p.axisText!==void 0&&{axisText:p.axisText},...p.axisBorder!==void 0&&{axisBorder:p.axisBorder},...p.crosshair!==void 0&&{crosshair:p.crosshair},...((t=(n=(r=(i=(a=p.candleUp)==null?p.candleDown:a)==null?p.wickUp:i)==null?p.wickDown:r)==null?p.borderUp:n)==null?p.borderDown:t)!==void 0&&{candle:{...p.candleUp!==void 0&&{up:p.candleUp},...p.candleDown!==void 0&&{down:p.candleDown},...p.wickUp!==void 0&&{wickUp:p.wickUp},...p.wickDown!==void 0&&{wickDown:p.wickDown},...p.borderUp!==void 0&&{borderUp:p.borderUp},...p.borderDown!==void 0&&{borderDown:p.borderDown}}},...((o=p.volumeUp)==null?p.volumeDown:o)!==void 0&&{volume:{...p.volumeUp!==void 0&&{up:p.volumeUp},...p.volumeDown!==void 0&&{down:p.volumeDown}}}}:void 0;return l(c(c(f,(s=this.themeOverrides)==null?void 0:s[e]),m),this.wrapper)}setTheme(e){var t,n,r,i,a,o,s,c;return this.themeName=e,this.theme=this.buildTheme(e),(t=this.topBar)==null||t.setTheme(this.theme),(n=this.bottomBar)==null||n.setTheme(this.theme),(r=this.leftBar)==null||r.setTheme(this.theme),(i=this.tradeButton)==null||i.setTheme(this.theme,this.priceAxisWidth),(a=this.tradePopover)==null||a.setTheme(this.theme),(o=this._draftQtyFlyout)==null||o.setTheme(this.theme),(s=this.indicatorSettingsDialog)==null||s.setTheme(this.theme),(c=this.chartSettingsDialog)==null||c.setTheme(this.theme),this.applyScrollToEndBtnStyles(),this.applyResetViewBtnStyles(),this.applyMobileDrawingFlyoutTheme(),this.siSymbolSpan&&(this.siSymbolSpan.style.color=this.theme.axisText),this.siStreamDot&&(this.siStreamDot.style.background=this.theme.ui.stream.disconnected),this.scheduleRender(),this.emitStateChange(),this}setTimeframe(e){var t;return this.timeframe=e,(t=this.topBar)==null||t.setTimeframe(e),this.emitter.emit(`timeframeChange`,{timeframe:e}),this.emitStateChange(),this.updateCountdownState(),this.triggerLoad(`timeframe`),this}setThemeOverrides(e){var t,n,r,i,a,o,s,c;return this.themeOverrides=e,this.theme=this.buildTheme(this.themeName),(t=this.topBar)==null||t.setTheme(this.theme),(n=this.bottomBar)==null||n.setTheme(this.theme),(r=this.leftBar)==null||r.setTheme(this.theme),(i=this.tradeButton)==null||i.setTheme(this.theme,this.priceAxisWidth),(a=this.tradePopover)==null||a.setTheme(this.theme),(o=this._draftQtyFlyout)==null||o.setTheme(this.theme),(s=this.indicatorSettingsDialog)==null||s.setTheme(this.theme),(c=this.chartSettingsDialog)==null||c.setTheme(this.theme),this.scheduleRender(),this}setTimezone(e){return this.timezone=e===`local`?Intl.DateTimeFormat().resolvedOptions().timeZone:e,this.scheduleRender(),this}setSeries(e){var t;return this.series=e,(t=this.topBar)==null||t.setSeries(e),this.emitter.emit(`seriesChange`,{series:e}),this.scheduleRender(),this.emitStateChange(),this}setTfcActive(e){var t;if(!this.tfcEnabled)return this;if(this.tfcActive=e,(t=this.topBar)==null||t.setTfcActive(e),!e){var n,r;(n=this.tradeButton)==null||n.hide(),(r=this.tradePopover)==null||r.hide(),this.draftOrderLabel!==null&&this.removeDraftOrder()}return this.chartSettingsDialog&&(this.chartSettingsDialog.destroy(),this.chartSettingsDialog=null),this.renderTradeLayer(),this.emitter.emit(`tfcToggle`,{enabled:e}),this.emitStateChange(),this}clearDuration(){var e,t;this.duration!==void 0&&(this.duration=void 0,(e=this.topBar)==null||e.setActiveDuration(void 0),(t=this.bottomBar)==null||t.setActive(void 0),this.emitStateChange())}setVolume(e){return this.showVolume=e,this.scheduleRender(),this.emitStateChange(),this}dismissAllUI(){var e,t,n,r,i,a;return this.isAnyUIOpen()?((e=this._draftQtyFlyout)==null||e.hide(),(t=this.isinPickerModal)==null||t.hide(),(n=this.indicatorSettingsDialog)==null||n.hide(),(r=this.chartSettingsDialog)==null||r.hide(),(i=this.tradePopover)==null||i.hide(),(a=this.topBar)==null||a.closeDropdown(),this.hideMobileDrawingFlyout(),!0):!1}isAnyUIOpen(){var e,t,n,r,i,a,o,s;return((e=this._draftQtyFlyout)==null?void 0:e.isVisible)===!0||((t=this.isinPickerModal)==null?void 0:t.isVisible)===!0||((n=this.indicatorSettingsDialog)==null?void 0:n.isVisible)===!0||((r=this.chartSettingsDialog)==null?void 0:r.isVisible)===!0||((i=this.tradePopover)==null?void 0:i.isVisible)===!0||((a=this.topBar)==null?void 0:a.hasOpenDropdown)===!0||((o=(s=this._mobileDrawingFlyout)==null?void 0:s.style.display)==null?`none`:o)!==`none`}emitUiState(){this.emitter.emit(`uiStateChange`,{hasOpenUI:this.isAnyUIOpen()})}emitStateChange(){this.isRestoringState||this.emitter.emit(`stateChange`,{symbol:this.symbol,state:this.getState()})}getState(){return{symbol:this.symbol,timeframe:this.timeframe,duration:this.duration,series:this.series,showVolume:this.showVolume,theme:this.themeName,indicators:this.activeIndicators.map(e=>({shortName:e.shortName,params:{...e.currentParams},visible:e.visible})),drawings:this.drawingManager.getDrawingsSnapshot().map(e=>({...e,points:e.points.map(e=>{var t;return{...e,timestamp:(t=e.timestamp)==null?this.barIndexToTimestamp(e.barIndex):t}})})),positionRenderStyle:this.positionRenderStyle,tradeDisplayFilter:this.tradeDisplayFilter,canvasColors:Object.keys(this.settingsCanvasColors).length>0?{...this.settingsCanvasColors}:void 0,tfcEnabled:this.tfcActive,viewport:this.getViewportTimestamps(),priceScale:this.priceScaleFactor!==1||this.pricePanOffset!==0?{factor:this.priceScaleFactor,panOffset:this.pricePanOffset}:void 0}}getViewportTimestamps(){if(this.dataStore.all.length===0)return;let e=this.barIndexToTimestamp(this.viewport.startIndex),t=this.barIndexToTimestamp(this.viewport.endIndex);if(!(e==null||t==null))return{startTime:e,endTime:t}}applyViewportFromTimestamps(e,t){let n=this.timestampToBarIndex(e),r=this.timestampToBarIndex(t);this.viewport={...this.viewport,startIndex:n,endIndex:r},this._targetViewport={...this.viewport}}setState(e){this.isRestoringState=!0;try{if(this.setSeries(e.series),this.setVolume(e.showVolume),e.theme!=null&&this.setTheme(e.theme),e.timeframe!=null){var t,n,r;this.timeframe=e.timeframe,this.duration=e.duration,(t=this.topBar)==null||t.setTimeframe(e.timeframe),(n=this.topBar)==null||n.setActiveDuration(e.duration),(r=this.bottomBar)==null||r.setActive(e.duration),this.updateCountdownState()}let c=this.activeIndicators.map(e=>e.shortName);for(let e of c)this.removeIndicator(e);for(let t of e.indicators){let e=rc.find(e=>e.shortName===t.shortName);if(e){let n=e.factory(t.params);this.addIndicator(n);let r=this.activeIndicators.findIndex(e=>e.shortName===t.shortName);if(r!==-1){let e=this.activeIndicators[r];if(e){var i,a;if(e.currentParams={...t.params},t.visible===!1){var o;e.visible=!1;let n=(o=this.subPaneOverlays.get(t.shortName))==null?this.indicatorOverlay:o;n==null||n.updatePillVisibility(t.shortName,!1)}let n=(i=t.params.timeframe)==null?`Chart`:i,r=(a=this.subPaneOverlays.get(t.shortName))==null?this.indicatorOverlay:a;r==null||r.updatePillTimeframe(t.shortName,n)}}}}let l=e.drawings.map(e=>({...e,points:e.points.map(e=>e.timestamp==null||this.dataStore.all.length===0?e:{...e,barIndex:this.timestampToBarIndex(e.timestamp)})}));if(this.drawingManager.loadDrawings(l),e.positionRenderStyle&&(this.positionRenderStyleOverride=e.positionRenderStyle,this.positionRenderStyle=e.positionRenderStyle),e.tradeDisplayFilter&&(this.tradeDisplayFilter=e.tradeDisplayFilter),e.canvasColors&&(this.settingsCanvasColors=e.canvasColors),e.tfcEnabled!==void 0&&this.tfcEnabled){var s;this.tfcActive=e.tfcEnabled,(s=this.topBar)==null||s.setTfcActive(e.tfcEnabled)}e.priceScale&&(this.priceScaleFactor=e.priceScale.factor,this.pricePanOffset=e.priceScale.panOffset,this._displayedPriceRange=null,this._lockedAutoFitBase=null),e.viewport&&(this.dataStore.all.length>0?this.applyViewportFromTimestamps(e.viewport.startTime,e.viewport.endTime):this._pendingViewportRestore={viewport:e.viewport,priceScale:e.priceScale})}finally{this.isRestoringState=!1}return this.emitStateChange(),this.scheduleRender(),this}barIndexToTimestamp(e){let t=this.dataStore.all,n=t.length;if(n===0)return;let r=t[0];if(!r)return;if(n===1)return r.time;let i=Math.floor(e),a=e-i;if(i<0){let n=t[1];return n?r.time+e*(n.time-r.time):r.time}if(i>=n-1){let i=t[n-1],a=t[n-2];return!i||!a?r.time:i.time+(e-(n-1))*(i.time-a.time)}let o=t[i],s=t[i+1];return!o||!s?r.time:o.time+a*(s.time-o.time)}timestampToBarIndex(e){let t=this.dataStore.all,n=t.length;if(n===0)return 0;let r=t[0];if(!r||n===1)return 0;if(e<=r.time){let n=t[1];if(!n)return 0;let i=n.time-r.time;return i>0?(e-r.time)/i:0}let i=n-1,a=t[i],o=t[i-1];if(!a||!o)return 0;if(e>=a.time){let t=a.time-o.time;return i+(t>0?(e-a.time)/t:0)}let s=0,c=i;for(;s<c;){var l,u;let n=s+c+1>>1;((l=(u=t[n])==null?void 0:u.time)==null?0:l)<=e?s=n:c=n-1}let d=t[s],f=t[s+1];if(!d||!f)return s;let p=f.time-d.time;return s+(p>0?(e-d.time)/p:0)}reanchorDrawingsByTimestamp(){if(this.dataStore.all.length!==0)for(let e of this.drawingManager.getDrawings())for(let t of e.points){if(t.timestamp==null){let e=this.barIndexToTimestamp(t.barIndex);e!=null&&(t.timestamp=e);continue}t.barIndex=this.timestampToBarIndex(t.timestamp)}}backfillDrawingTimestamps(){if(this.dataStore.all.length!==0)for(let e of this.drawingManager.getDrawings())for(let t of e.points){if(t.timestamp!=null)continue;let e=this.barIndexToTimestamp(t.barIndex);e!=null&&(t.timestamp=e)}}resetChartSettings(){return this.setState({symbol:this.symbol,series:`candlestick`,theme:`dark`,timeframe:`1D`,duration:void 0,showVolume:!0,indicators:[],drawings:[]}),this.positionRenderStyleOverride=null,localStorage.removeItem(this.RENDER_STYLE_LS_KEY),this.recomputeRenderStyle(),this.settingsCanvasColors={},this.setTheme(`dark`),this.emitStateChange(),this}setSymbol(e){var t,n;return this.symbol=e,(t=this.tradePopover)==null||t.setSymbol(e),this.siSymbolSpan&&(this.siSymbolSpan.textContent=e,this.siSymbolSpan.style.display=e?`inline`:`none`),(n=this.isinPickerModal)==null||n.setCurrentSymbol(e),this.tickActivityTimer!==null&&(clearTimeout(this.tickActivityTimer),this.tickActivityTimer=null),this.siStreamDot&&(this.siStreamDot.style.background=this.theme.ui.stream[this.streamStatus]),this.liveBidAsk=null,this}setIsins(e){var t;return this.isins=e,(t=this.isinPickerModal)==null||t.setIsins(e),this}renderSymbolInfoOHLC(e){if(!this.siOHLCSpan)return;if(!e){this.siOHLCSpan.innerHTML=``,this.siOHLC2Span&&(this.siOHLC2Span.innerHTML=``);return}let t=e.close>=e.open?this.theme.candle.up:this.theme.candle.down,n=e=>e.toFixed(this.dataStore.getPricePrecision()),r=e=>e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:e.toFixed(0),i=this.labels.ohlc,a=(e,t)=>{e.innerHTML=``;for(let[n,r,i]of t){let t=document.createElement(`span`);t.style.marginRight=`8px`;let a=document.createElement(`span`);a.textContent=n+`\xA0`,a.style.color=this.theme.axisText,a.style.opacity=`0.6`;let o=document.createElement(`span`);o.textContent=r,o.style.color=i,t.append(a,o),e.appendChild(t)}};a(this.siOHLCSpan,[[i.open,n(e.open),this.theme.axisText],[i.high,n(e.high),this.theme.axisText]]),this.siOHLC2Span&&a(this.siOHLC2Span,[[i.low,n(e.low),this.theme.axisText],[i.close,n(e.close),t],...e.volume!=null&&e.volume!==0?[[i.volume,r(e.volume),this.theme.axisText]]:[]])}setMinLots(e){var t;return console.warn(`[acttrader-charts] setMinLots() is deprecated. Pass minLots in the initial ChartConfig instead.`),this._minLots=e,(t=this.tradePopover)==null||t.setLots(e),this}setDraftQty(e){return this.draftOrderLabel&&this.setLevelQty(this.draftOrderLabel,e),this}setLevelQty(e,t){var n,r;let i=this.levels.findIndex(t=>t.label===e);if(i===-1)return;let a=this.levels[i];if(a.lots===t)return;this.originalQtyByLabel.has(e)||this.originalQtyByLabel.set(e,a.lots);let o=(n=(r=this.originalQtyByLabel.get(e))==null?a.lots:r)==null?t:n;this.levels=[...this.levels.slice(0,i),{...a,lots:t},...this.levels.slice(i+1)],e!==this.draftOrderLabel&&this.pendingQtyChanges.set(e,t),this.emitter.emit(`tradeLevelQtyChange`,{label:e,type:e===this.draftOrderLabel?`draft`:a.type,newLots:t,previousLots:o,isFullscreen:this.isFullscreen}),this.renderTradeLayer()}openDraftQtyFlyout(e){var t;this._draftQtyFlyout||(this._draftQtyFlyout=new as(this.theme,e=>{this._activeQtyPillLabel&&this.setLevelQty(this._activeQtyPillLabel,e)},()=>this.emitUiState()),this.getFloatingRoot().appendChild(this._draftQtyFlyout.el)),this._activeQtyPillLabel=e.label;let n=this.levels.find(t=>t.label===e.label),r=(t=n==null?void 0:n.lots)==null?this._qtyFieldMin:t,i=this.canvasWrap.getBoundingClientRect(),a=i.left+e.pillX,o=i.top+e.pillY+e.pillH;this._draftQtyFlyout.show(a,o,r,this._qtyFieldMin,this._qtyFieldMax)}setDraftOrderLabels(e){return console.warn(`[acttrader-charts] setDraftOrderLabels() is deprecated and is a no-op. DraftOrderQtyInput has been removed.`),this}setDrawingTool(e){var t;return this.drawingManager.setActiveTool(e),(t=this.leftBar)==null||t.setActiveTool(e),this.drawCanvas.style.cursor=e?`crosshair`:`default`,this.scheduleRender(),this}undoDrawing(){return this.drawingManager.undo(),this.scheduleRender(),this}redoDrawing(){return this.drawingManager.redo(),this.scheduleRender(),this}hideAllDrawings(){return this.drawingManager.hideAll(),this.scheduleRender(),this}showAllDrawings(){return this.drawingManager.showAll(),this.scheduleRender(),this}lockAllDrawings(){return this.drawingManager.lockAll(),this.scheduleRender(),this}unlockAllDrawings(){return this.drawingManager.unlockAll(),this.scheduleRender(),this}deleteSelectedDrawing(){return this.drawingManager.deleteSelected(),this.hideMobileDrawingFlyout(),this.scheduleRender(),this}clearAllDrawings(){return this.drawingManager.clearAll(),this.scheduleRender(),this}getActiveTool(){return this.drawingManager.getActiveTool()}getDrawings(){return this.drawingManager.getDrawings()}connectStream(e){return this.streamAdapter=e,e.onTick(e=>this.onTick(e)),e.onStatus(e=>{this.streamStatus=e,this.siStreamDot&&(this.siStreamDot.style.background=this.theme.ui.stream[e],this.siStreamDot.title=`Stream ${e}`),this.emitter.emit(`streamStatus`,{status:e})}),e.connect(),this}disconnectStream(){var e;return(e=this.streamAdapter)==null||e.disconnect(),this.streamAdapter=null,this}pushTick(e){let t=e.T==null?Date.now():typeof e.T==`string`?new Date(e.T).getTime():e.T;return this.onTick({time:t,bid:e.B,ask:e.A,volume:0}),this}setLevels(e,t,n,r,i,a){let o=e.map(e=>{if(r===`position`){let r={label:String(e[t]),price:Number(e[n]),type:`position`,data:e};return e.text!==void 0&&(r.text=String(e.text)),i!==void 0&&e[i]!==void 0&&(r.pnl=Number(e[i])),a!==void 0&&e[a]!==void 0&&(r.pnlText=String(e[a])),e.side!==void 0&&(r.side=e.side),e.stopLossPrice!==void 0&&(r.stopLossPrice=Number(e.stopLossPrice)),e.takeProfitPrice!==void 0&&(r.takeProfitPrice=Number(e.takeProfitPrice)),e.entryPriceEditable&&(r.entryPriceEditable=!0),e.orderType!==void 0&&(r.orderType=e.orderType),e.lots!==void 0&&(r.lots=Number(e.lots)),r}if(r===`pending`){var o,s;let r={label:String(e[t]),price:Number(e[n]),type:`pending`,side:(o=e.side)==null?`buy`:o,orderType:(s=e.orderType)==null?`limit`:s,data:e};return e.text!==void 0&&(r.text=String(e.text)),e.lots!==void 0&&(r.lots=Number(e.lots)),e.stopLossPrice!==void 0&&(r.stopLossPrice=Number(e.stopLossPrice)),e.takeProfitPrice!==void 0&&(r.takeProfitPrice=Number(e.takeProfitPrice)),e.ToClose!==void 0&&(r.ToClose=String(e.ToClose)),r}return{label:String(e[t]),price:Number(e[n]),type:`trade`,text:e.text===void 0?void 0:String(e.text),data:e}});if(this.hideLevelConfirmCancel&&this.pendingLevelDrags.size>0)for(let e of o){let t=this.pendingLevelDrags.get(e.label);if(!(t!=null&&t.length))continue;let n=e;t.every(t=>t.isRemoval?t.field===`stopLoss`?n.stopLossPrice===void 0:n.takeProfitPrice===void 0:t.field===`main`?e.price===t.newPrice:t.field===`stopLoss`?n.stopLossPrice===t.newPrice:n.takeProfitPrice===t.newPrice)&&(this.pendingLevelDrags.delete(e.label),this.selectedTradeLabel===e.label&&(this.selectedTradeLabel=null))}if(this.pendingQtyChanges.size>0)for(let e=0;e<o.length;e++){let t=o[e],n=this.pendingQtyChanges.get(t.label);if(n===void 0||t.type!==`pending`&&t.type!==`position`)continue;let r=t;this.originalQtyByLabel.set(t.label,r.lots),o[e]={...r,lots:n}}let s=this.draftOrderLabel===null?void 0:this.levels.find(e=>e.type===r&&e.label===this.draftOrderLabel&&!o.some(t=>t.label===e.label));return this.levels=[...this.levels.filter(e=>e.type!==r),...o,...s?[s]:[]],this.selectedTradeLabel!==null&&!this.levels.some(e=>e.label===this.selectedTradeLabel)&&(this.selectedTradeLabel=null),this.recomputeRenderStyle(),this.renderTradeLayer(),this}removeLevelByLabel(e){return this.levels=this.levels.filter(t=>t.label!==e),this.renderTradeLayer(),this}showDraftOrder(e,t,n){if(this.draftOrderLabel){let e=this.levels.find(e=>e.label===this.draftOrderLabel);if((e==null?void 0:e.side)===t&&(e==null?void 0:e.orderType)===n)return this}return this.clearDraftOrder(),this.createDraftOrder(t,e,n),this}showMarketDraft(e,t){this.clearDraftOrder();let n=`__draft_${Date.now()}`,r={type:`pending`,label:n,side:t,price:e,orderType:`market`,data:{_isDraft:!0}};return this.levels=[...this.levels,r],this.draftOrderLabel=n,this.renderTradeLayer(),this.emitter.emit(`draftInitiated`,{side:t,price:e,orderType:`market`,isFullscreen:this.isFullscreen}),this}clearDraftOrder(){return this.removeDraftOrder(),this}updateLevelBracket(e,t,n){var r;let i=t===`sl`?`stopLoss`:`takeProfit`,a=this.levels.find(t=>t.label===e);if(!a)return this;let o=t===`sl`?a.stopLossPrice:a.takeProfitPrice,s=(r=this.pendingLevelDrags.get(e))==null?[]:r,c=s.find(e=>e.field===i),l=s.filter(e=>e.field!==i);if(this.levels=this.levels.map(r=>{if(r.label!==e)return r;let i=r;return t===`sl`?{...i,stopLossPrice:n==null?void 0:n}:{...i,takeProfitPrice:n==null?void 0:n}}),n===null){if(o!==void 0){var u;let e=(u=c==null?void 0:c.oldPrice)==null?o:u;l.push({field:i,newPrice:o,oldPrice:e,isRemoval:!0})}l.length===0?this.pendingLevelDrags.delete(e):this.pendingLevelDrags.set(e,l)}else{var d;let t=(d=c==null?void 0:c.isNew)==null?o===void 0:d,r=c&&!c.isRemoval?c.oldPrice:o==null?n:o;l.push({field:i,newPrice:n,oldPrice:r,isNew:t}),this.pendingLevelDrags.set(e,l)}return this.renderTradeLayer(),this}addLevelBracket(e,t){var n,r,i,a,o;let s=this.levels.find(t=>t.label===e);if(!s)return this;let c=t===`sl`?`stopLoss`:`takeProfit`,l=t===`sl`?s.stopLossPrice!==void 0:s.takeProfitPrice!==void 0,u=(n=(r=this.pendingLevelDrags.get(e))==null?void 0:r.some(e=>e.field===c&&!e.isRemoval))==null?!1:n;if(l||u)return this;let{priceH:d}=this.getChartLayout(),f=(i=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):i,p=this.scaleManager.yToPixel(s.price,f,d),m=(a=s.side)==null?`buy`:a,h=p+(m===`buy`&&t===`sl`||m===`sell`&&t===`tp`?30:-30),g=this.scaleManager.pixelToPrice(h,f,d);this.updateLevelBracket(e,t,g);let _=((o=this.pendingLevelDrags.get(e))==null?[]:o).filter(e=>e.field!==c);return _.push({field:c,newPrice:g,oldPrice:g,isNew:!0}),this.pendingLevelDrags.set(e,_),this.emitter.emit(`tradeLevelBracketActivated`,{label:e,bracketType:t,price:g,isFullscreen:this.isFullscreen}),this.emitter.emit(`tradeLevelDrag`,{label:e,newPrice:g,data:s.data,bracketType:t===`sl`?`stopLoss`:`takeProfit`,isFullscreen:this.isFullscreen}),this}addBracket(e,t){var n,r;if(t)return this.addLevelBracket(t,e);if(!this.draftOrderLabel)return this;let i=this.draftOrderLabel,a=this.levels.find(e=>e.label===i);if(!a||(e===`sl`?a.stopLossPrice!==void 0:a.takeProfitPrice!==void 0))return this;let{priceH:o}=this.getChartLayout(),s=(n=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):n,c=this.scaleManager.yToPixel(a.price,s,o),l=(r=a.side)==null?`buy`:r,u=c+(l===`buy`&&e===`sl`||l===`sell`&&e===`tp`?30:-30),d=this.scaleManager.pixelToPrice(u,s,o);return this.updateDraftOrderBracket(e,d),this.emitter.emit(`tradeLevelBracketActivated`,{label:``,bracketType:e,price:d,isFullscreen:this.isFullscreen}),this.emitter.emit(`tradeLevelDrag`,{label:i,newPrice:d,data:a.data,bracketType:e===`sl`?`stopLoss`:`takeProfit`,isFullscreen:this.isFullscreen}),this}removeBracket(e,t){if(t){var n,r;let i=e===`sl`?`stopLoss`:`takeProfit`,a=this.levels.find(e=>e.label===t);if(!a)return this;let o=(n=this.pendingLevelDrags.get(t))==null?void 0:n.find(e=>e.field===i),s=o&&!o.isRemoval?o.newPrice:e===`sl`?a.stopLossPrice:a.takeProfitPrice;if(s===void 0)return this;let c=((r=this.pendingLevelDrags.get(t))==null?[]:r).filter(e=>e.field!==i);return c.push({field:i,newPrice:s,oldPrice:s,isRemoval:!0}),this.pendingLevelDrags.set(t,c),this.renderTradeLayer(),this}return e===`sl`?this.draftBracketPnl={...this.draftBracketPnl,sl:void 0}:this.draftBracketPnl={...this.draftBracketPnl,tp:void 0},this.updateDraftOrderBracket(e,null)}updateLevelMainPrice(e,t){var n;let r=this.levels.find(t=>t.label===e);if(!r)return this;let i=(n=this.pendingLevelDrags.get(e))==null?[]:n,a=i.find(e=>e.field===`main`),o=a?a.oldPrice:r.price,s=i.filter(e=>e.field!==`main`);return s.push({field:`main`,newPrice:t,oldPrice:o}),this.pendingLevelDrags.set(e,s),r.price=t,this.renderTradeLayer(),this}setDraftBracketPnl(e,t){return e===`sl`?this.draftBracketPnl={...this.draftBracketPnl,sl:t==null?void 0:t}:this.draftBracketPnl={...this.draftBracketPnl,tp:t==null?void 0:t},this.renderTradeLayer(),this}updateDraftOrderBracket(e,t){return this.draftOrderLabel?(this.levels=this.levels.map(n=>{if(n.label!==this.draftOrderLabel)return n;let r=n;return e===`sl`?{...r,stopLossPrice:t==null?void 0:t}:{...r,takeProfitPrice:t==null?void 0:t}}),this.scheduleRender(),this):this}updateDraftOrderPrice(e){if(!this.draftOrderLabel)return!1;this.levels=this.levels.map(t=>t.label===this.draftOrderLabel?{...t,price:e}:t);let t=this.pendingLevelDrags.get(this.draftOrderLabel);if(t){let n=t.find(e=>e.field===`main`);n&&(n.newPrice=e)}return this.renderTradeLayer(),!0}cancelLevelEdit(e){var t;if(this.undoIsNewBracketMutations(e),this.pendingLevelDrags.delete(e),this.pendingQtyChanges.has(e)){this.pendingQtyChanges.delete(e);let t=this.levels.findIndex(t=>t.label===e);if(t!==-1&&this.originalQtyByLabel.has(e)){let n=this.originalQtyByLabel.get(e),r=this.levels[t];this.levels=[...this.levels.slice(0,t),{...r,lots:n},...this.levels.slice(t+1)]}this.originalQtyByLabel.delete(e)}return e===((t=this.draftOrderLabel)==null?this.selectedTradeLabel:t)&&(this.draftBracketPnl={}),this.selectedTradeLabel===e&&(this.selectedTradeLabel=null),this.renderTradeLayer(),this}cancelCurrentEdit(){return this.draftOrderLabel?this.clearDraftOrder():this.selectedTradeLabel&&this.revertPendingChanges(this.selectedTradeLabel),this}selectLevel(e){if(!this.draftOrderLabel&&e!==this.selectedTradeLabel&&(this.draftBracketPnl={}),this.selectedTradeLabel=e,e!==null){this.crosshair=null;let t=this.lastClusters.find(t=>t.members.some(t=>t.level.label===e));t&&this.expandedClusters.add(t.id)}return this.renderTradeLayer(),this}setLevelClusteringEnabled(e){return this.levelClusteringEnabled=e,this.expandedClusters.clear(),this.renderTradeLayer(),this}setClusterThresholdDistance(e){return this.clusterThresholdDistance=e,this.expandedClusters.clear(),this.renderTradeLayer(),this}setTradeLevelButtonScale(e){return this.tradeLevelButtonScale=Math.min(Math.max(e,1),3),this.renderTradeLayer(),this}destroy(){var e,t,n,r,i,a,o,s,c,l,u;this.panHandler.destroy(),this.zoomHandler.destroy(),this.resizeObserver.disconnect(),this.disposeVvListener(),(e=this.indicatorOverlay)==null||e.destroy();for(let e of this.subPaneOverlays.values())e.destroy();this.subPaneOverlays.clear(),(t=this.indicatorSettingsDialog)==null||t.destroy(),(n=this.chartSettingsDialog)==null||n.destroy(),(r=this.isinPickerModal)==null||r.destroy(),(i=this.tradePopover)==null||i.destroy(),(a=this._draftQtyFlyout)==null||a.destroy(),(o=this.leftBar)==null||o.destroy(),this.drawCanvas.removeEventListener(`mousemove`,this.onMouseMove),this.drawCanvas.removeEventListener(`mouseleave`,this.onMouseLeave),this.drawCanvas.removeEventListener(`mousedown`,this.onCanvasClick),this.drawCanvas.removeEventListener(`dblclick`,this.onDoubleClick),window.removeEventListener(`mouseup`,this.onMouseUp),this.drawCanvas.removeEventListener(`touchstart`,this.onDrawingTouchStart),this.drawCanvas.removeEventListener(`touchmove`,this.onDrawingTouchMove),this.drawCanvas.removeEventListener(`touchend`,this.onDrawingTouchEnd),document.removeEventListener(`keydown`,this.onKeyDown),(s=this.streamAdapter)==null||s.disconnect(),this.rafId!==null&&cancelAnimationFrame(this.rafId),this.scrollAnimId!==null&&cancelAnimationFrame(this.scrollAnimId),this.stopCountdownLoop(),(c=this.resetViewBtn)==null||c.remove(),(l=this.textInputEl)==null||l.remove(),(u=this._mobileDrawingFlyout)==null||u.remove(),this.wrapper.remove()}createMobileDrawingFlyout(){let e=document.createElement(`div`);Object.assign(e.style,{position:`fixed`,display:`none`,alignItems:`center`,gap:`2px`,zIndex:`10000`,background:this.theme.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`8px`,padding:`4px`,boxShadow:`0 4px 16px rgba(0,0,0,0.45)`,pointerEvents:`auto`});let t=(e,t,n)=>{let r=document.createElement(`button`);return r.title=t,r.innerHTML=e,Object.assign(r.style,{display:`flex`,alignItems:`center`,justifyContent:`center`,width:`34px`,height:`34px`,padding:`0`,border:`none`,borderRadius:`6px`,background:`transparent`,color:n?this.theme.candle.down:this.theme.axisText,cursor:`pointer`,flexShrink:`0`}),r.addEventListener(`pointerenter`,()=>{r.style.background=n?`${this.theme.candle.down}22`:this.theme.axisBorder}),r.addEventListener(`pointerleave`,()=>{r.style.background=`transparent`}),r},n=t(zt,`Delete drawing`,!0);n.addEventListener(`pointerdown`,e=>{e.stopPropagation(),this.deleteSelectedDrawing(),this.hideMobileDrawingFlyout()});let r=t(It,`Deselect`,!1);return r.addEventListener(`pointerdown`,e=>{e.stopPropagation(),this.drawingManager.selectDrawing(null),this.hideMobileDrawingFlyout(),this.scheduleRender()}),e.appendChild(n),e.appendChild(r),this.wrapper.appendChild(e),e}showMobileDrawingFlyout(e,t){if(!pc())return;this._mobileDrawingFlyout||(this._mobileDrawingFlyout=this.createMobileDrawingFlyout());let n=this._mobileDrawingFlyout,r=n.style.display!==`none`&&n.style.display!==``;n.style.display=`flex`,requestAnimationFrame(()=>{let r=n.offsetWidth||78,i=n.offsetHeight||42,a=window.innerWidth,o=window.innerHeight,s=Math.min(Math.max(e-r/2,8),a-r-8),c=Math.min(Math.max(t-i-12,8),o-i-8);n.style.left=`${s}px`,n.style.top=`${c}px`}),r||this.emitUiState()}hideMobileDrawingFlyout(){if(this._mobileDrawingFlyout){let e=this._mobileDrawingFlyout.style.display!==`none`&&this._mobileDrawingFlyout.style.display!==``;this._mobileDrawingFlyout.style.display=`none`,e&&this.emitUiState()}}applyMobileDrawingFlyoutTheme(){if(!this._mobileDrawingFlyout)return;let e=this._mobileDrawingFlyout;e.style.background=this.theme.background,e.style.border=`1px solid ${this.theme.axisBorder}`;let[t,n]=Array.from(e.querySelectorAll(`button`));t&&(t.style.color=this.theme.candle.down),n&&(n.style.color=this.theme.axisText)}scheduleRender(){this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.render(),this.renderTradeLayer()}))}startCountdownLoop(){if(this.countdownRafId!==null)return;let e=0,t=n=>{if(!this.countdownActive){this.countdownRafId=null;return}n-e>=1e3&&(e=n,this.scheduleRender()),this.countdownRafId=requestAnimationFrame(t)};this.countdownRafId=requestAnimationFrame(t)}stopCountdownLoop(){this.countdownActive=!1,this.countdownRafId!==null&&(cancelAnimationFrame(this.countdownRafId),this.countdownRafId=null)}updateCountdownState(){var e;let t=this.candleCountdownTimeframes===`all`?!0:((e=this.candleCountdownTimeframes)==null?[`1m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`8h`]:e).includes(this.timeframe),n=this.showCandleCountdown&&t&&this.dataStore.length>0;n&&!this.countdownActive?(this.countdownActive=!0,this.startCountdownLoop()):!n&&this.countdownActive&&this.stopCountdownLoop()}openChartSettings(){this.chartSettingsDialog||(this.chartSettingsDialog=new ns(this.theme,{tradeDisplayFilter:this.tradeDisplayFilter,positionRenderStyle:this.positionRenderStyle,theme:this.themeName},this.labels.dialogs,!!this._onOrderSubmit&&this.tfcActive,this.enableThemeToggle,()=>this.emitUiState()),this.getFloatingRoot().appendChild(this.chartSettingsDialog.el)),this.chartSettingsDialog.show({tradeDisplayFilter:this.tradeDisplayFilter,positionRenderStyle:this.positionRenderStyle,theme:this.themeName,canvasColors:{...this.settingsCanvasColors}},e=>{this.tradeDisplayFilter=e.tradeDisplayFilter,this.positionRenderStyleOverride=e.positionRenderStyle,localStorage.setItem(this.RENDER_STYLE_LS_KEY,e.positionRenderStyle),this.positionRenderStyle=e.positionRenderStyle,e.canvasColors&&(this.settingsCanvasColors=e.canvasColors),this.setTheme(e.theme),this.renderTradeLayer(),this.emitStateChange()},()=>{this.resetChartSettings()})}getFloatingRoot(){var e;return(e=document.fullscreenElement)==null?document.body:e}reparentFloatingElements(){var e,t,n,r,i,a;let o=this.getFloatingRoot();(e=this.topBar)==null||e.reparentFlyout(o),(t=this.leftBar)==null||t.reparentFlyout(o);let s=[(n=this.isinPickerModal)==null?void 0:n.el,(r=this.indicatorSettingsDialog)==null?void 0:r.el,(i=this.chartSettingsDialog)==null?void 0:i.el,(a=this._draftQtyFlyout)==null?void 0:a.el];for(let e of s)e&&e.parentElement!==o&&o.appendChild(e)}toggleDrawingTools(){var e,t;this.leftBarVisible=!this.leftBarVisible,(e=this.leftBar)==null||e.setVisible(this.leftBarVisible),(t=this.topBar)==null||t.setDrawingsBtnActive(this.leftBarVisible)}_applyCssFullscreen(e){var t;this._isCssFullscreen=e,e?Object.assign(this.wrapper.style,{position:`fixed`,inset:`0`,width:`100vw`,height:`100vh`,zIndex:`9999`}):Object.assign(this.wrapper.style,{position:``,inset:``,width:``,height:``,zIndex:``}),(t=this.topBar)==null||t.setFullscreen(e),this.reparentFloatingElements(),requestAnimationFrame(()=>this.onResize())}toggleFullscreen(){let e=!!document.fullscreenElement;!e&&!this._isCssFullscreen?this.wrapper.requestFullscreen?this.wrapper.requestFullscreen().then(()=>{var e;(e=this.topBar)==null||e.setFullscreen(!0)}).catch(()=>{this._applyCssFullscreen(!0)}):this._applyCssFullscreen(!0):e?document.exitFullscreen().catch(()=>{}):this._applyCssFullscreen(!1)}recomputeRenderStyle(){if(this.positionRenderStyleOverride!==null){this.positionRenderStyle=this.positionRenderStyleOverride;return}this.positionRenderStyle=this.levels.filter(e=>e.type===`position`||e.type===`pending`).length>this.tradesThresholdForHorizontalLine?`dot`:`line`}renderTradeLayer(){var e,t,n,r,i;let a=window.devicePixelRatio||1,{tradeCtx:o,tradeCanvas:s,theme:c,viewport:l}=this;if(o.clearRect(0,0,s.width,s.height),!this.tfcActive||this.levels.length===0||this.dataStore.length===0){this.tradeLevelHitAreas=[],this.tradeLevelEditAreas=[],this.tradeHoverAreas=[],this.tradeAddBracketAreas=[],this.offViewportHitAreas=[];return}let{chartW:u,priceH:d}=this.getChartLayout(),f=(e=this._displayedPriceRange)==null?this.getScaledPriceRange(l):e,p=this.levels.filter(e=>e.type===`pending`&&e.ToClose!=null),m=this.levels.filter(e=>!(e.type===`pending`&&e.ToClose!=null)).map(e=>{var t,n,r,i;let a=(t=this.pendingLevelDrags.get(e.label))==null?[]:t,o=a.find(e=>e.field===`stopLoss`),s=a.find(e=>e.field===`takeProfit`),c=o&&!o.isRemoval?o.newPrice:void 0,l=s&&!s.isRemoval?s.newPrice:void 0,u=(n=o==null?void 0:o.isRemoval)==null?!1:n,d=(r=s==null?void 0:s.isRemoval)==null?!1:r,f=(i=a.find(e=>e.field===`main`))==null?void 0:i.newPrice,m=p.filter(t=>t.ToClose===e.label);if(m.length===0&&c===void 0&&l===void 0&&f===void 0&&!u&&!d)return e;let h={...e};if(f!==void 0&&(h.price=f),c===void 0?u&&(h.stopLossPrice=void 0):h.stopLossPrice=c,l===void 0?d&&(h.takeProfitPrice=void 0):h.takeProfitPrice=l,m.length>0){var g;let t=(g=e.side)==null?`buy`:g;for(let n of m)if(t===`buy`?n.price<e.price:n.price>e.price){var _;h.stopLossPrice=u?void 0:(_=c==null?h.stopLossPrice:c)==null?n.price:_,h._slOrderLabel=n.label}else{var v;h.takeProfitPrice=d?void 0:(v=l==null?h.takeProfitPrice:l)==null?n.price:v,h._tpOrderLabel=n.label}}return h});o.save(),o.scale(a,a),o.save(),o.beginPath(),o.rect(0,0,u,d),o.clip();let h=e=>e.type===`position`&&!!e.entryPriceEditable,g=this.selectedTradeLabel===null?this.tradeDisplayFilter===`none`?[]:this.tradeDisplayFilter===`positions`?m.filter(e=>e.type===`position`&&!h(e)):this.tradeDisplayFilter===`orders`?m.filter(e=>e.type===`pending`||h(e)):m:m.filter(e=>e.label===this.selectedTradeLabel),_=this.levelClusteringEnabled?this.clusterThresholdDistance:0,v=Ue(o,g,this.scaleManager,f,c,u,d,this.dataStore.getPricePrecision(),this.hoveredTradeLabel,(t=(n=this.tradeDragHandler)==null?void 0:n.dragLabel)==null?null:t,this.tradeDragNewPrice,this.selectedTradeLabel,new Set([...this.pendingLevelDrags.keys(),...this._editOpenLabel===null?[]:[this._editOpenLabel]]),this.positionRenderStyle,this.hideLevelConfirmCancel,this.draftOrderLabel,this.draftBracketPnl,this.expandedClusters,_,this._showQuantityField,this.tradeDragNewSLPrice,this.tradeDragNewTPPrice,this.tradeLevelButtonScale);if(o.restore(),this.offViewportHitAreas=bt(o,g,f,c,u,d,(r=(i=this.tradeDragHandler)==null?void 0:i.dragLabel)==null?null:r,this.selectedTradeLabel).hitAreas,ct(o,g,this.scaleManager,f,c,u,d,this.dataStore.getPricePrecision()),o.restore(),this.tradeLevelHitAreas=v.hitAreas,this.tradeLevelEditAreas=v.editAreas,this.tradeHoverAreas=v.hoverAreas,this.tradeLevelDragAreas=v.dragAreas,this.tradeLevelConfirmAreas=v.confirmAreas,this.tradeAddBracketAreas=v.addBracketAreas,this.clusterBadgeAreas=v.clusterBadgeAreas,this.lastClusters=v.clusters,this._draftQtyPillArea=v.draftQtyPillArea,this.expandedClusters.size>0){let e=new Set(v.clusters.map(e=>e.id));for(let t of this.expandedClusters)e.has(t)||this.expandedClusters.delete(t)}}_effectiveEntryPrice(e,t){var n,r;let i=this.pendingLevelDrags.get(e);return(n=i==null||(r=i.find(e=>e.field===`main`))==null?void 0:r.newPrice)==null?t:n}_effectiveBracketPrice(e,t,n){var r;let i=this.pendingLevelDrags.get(e),a=i==null||(r=i.find(e=>e.field===t))==null?void 0:r.newPrice;return a==null?n:a}_resolveBracketPrices(e){let t=e.stopLossPrice,n=e.takeProfitPrice,r,i;if(t===void 0||n===void 0){let o=this.levels.filter(t=>t.type===`pending`&&t.ToClose===e.label);if(o.length>0){var a;let s=(a=e.side)==null?`buy`:a;for(let a of o){let o=s===`buy`?a.price<e.price:a.price>e.price;o&&t===void 0?(t=a.price,r=a.label):!o&&n===void 0&&(n=a.price,i=a.label)}}}return{slPrice:t,tpPrice:n,slSiblingLabel:r,tpSiblingLabel:i}}_finalizeMainDragWithBrackets(e,t){var n;let r=this.levels.find(t=>t.label===e.label),i=e.derivedSLPrice!==void 0&&e.slStartPrice!==void 0&&e.derivedSLPrice!==e.slStartPrice,a=e.derivedTPPrice!==void 0&&e.tpStartPrice!==void 0&&e.derivedTPPrice!==e.tpStartPrice,o=!i&&!a;if(this.storePendingChange(e,e.startPrice,t,!o),!((n=this.pendingLevelDrags.get(e.label))!=null&&n.some(t=>t.field===`main`&&t.newPrice===e.newPrice))){this.tradeDragNewSLPrice=null,this.tradeDragNewTPPrice=null;return}if(i){var s,c,l;let n=!a,i=r,o=r,u=(s=(c=i==null?void 0:i.stopLossData)==null?o==null?void 0:o.stopLossData:c)==null?e.data:s;this.storePendingChange({label:e.label,type:e.type,newPrice:e.derivedSLPrice,data:u,bracketType:`stopLoss`},e.slStartPrice,(l=this._slSiblingOrderLabel)==null?t:l,!n)}if(a){var u,d,f;let n=r,i=r,a=(u=(d=n==null?void 0:n.takeProfitData)==null?i==null?void 0:i.takeProfitData:d)==null?e.data:u;this.storePendingChange({label:e.label,type:e.type,newPrice:e.derivedTPPrice,data:a,bracketType:`takeProfit`},e.tpStartPrice,(f=this._tpSiblingOrderLabel)==null?t:f,!1)}this.tradeDragNewSLPrice=null,this.tradeDragNewTPPrice=null,this._slSiblingOrderLabel=null,this._tpSiblingOrderLabel=null}storePendingChange(e,t,n,r=!1){var i,a,o,s,c;if(e.bracketType){var l,u,d,f,p;let n=this.levels.find(t=>t.label===e.label),r=(l=n==null?void 0:n.side)==null?`buy`:l,i=this._effectiveEntryPrice(e.label,(u=n==null?void 0:n.price)==null?t:u),a=(n==null?void 0:n.entryPriceEditable)===!0,o=(n==null||(d=n.data)==null?void 0:d._isDraft)===!0,s=this.hideLevelConfirmCancel&&e.type===`pending`&&!o,c=this.dataStore.all,m=a||o||s||(f=(p=c[c.length-1])==null?void 0:p.close)==null?0:f;if(!ls.isBracketPriceValid(e.newPrice,e.bracketType,i,r,m)){this.tradeDragNewPrice=null,this.renderTradeLayer();return}}if(!e.bracketType){let t=this.levels.find(t=>t.label===e.label);if(t!=null&&t.orderType&&t!=null&&t.side){var m,h;let n=this.dataStore.all,r=(m=(h=n[n.length-1])==null?void 0:h.close)==null?0:m;if(r>0&&!(t.side===`buy`&&t.orderType===`limit`||t.side===`sell`&&t.orderType===`stop`?e.newPrice<r:e.newPrice>r)){this.tradeDragNewPrice=null,this.renderTradeLayer();return}}}if(e.newPrice===t){this.tradeDragNewPrice=null,this.renderTradeLayer();return}let g=(i=e.bracketType)==null?`main`:i,_=this._isBracketNew;this._isBracketNew=!1;let v=this.levels.find(t=>t.label===e.label);if((v==null?void 0:v.orderType)===`market`&&(v==null||(a=v.data)==null?void 0:a._isDraft)===!0){g!==`main`&&(this.updateDraftOrderBracket(g===`stopLoss`?`sl`:`tp`,e.newPrice),this.emitter.emit(`tradeLevelDrag`,{label:e.label,newPrice:e.newPrice,data:v==null?void 0:v.data,bracketType:g,isFullscreen:this.isFullscreen})),this.tradeDragNewPrice=null,this.renderTradeLayer();return}if(v!==void 0&&g!==`main`&&(v==null||(o=v.data)==null?void 0:o._isDraft)===!0){this.updateDraftOrderBracket(g===`stopLoss`?`sl`:`tp`,e.newPrice),this.emitter.emit(`tradeLevelDrag`,{label:e.label,newPrice:e.newPrice,data:v==null?void 0:v.data,bracketType:g,isFullscreen:this.isFullscreen}),this.tradeDragNewPrice=null,this.renderTradeLayer();return}if(v!==void 0&&g===`main`&&(v==null||(s=v.data)==null?void 0:s._isDraft)===!0&&v.orderType!==`market`&&this.hideLevelConfirmCancel){this.updateDraftOrderPrice(e.newPrice),this.emitter.emit(`tradeLevelDrag`,{label:e.label,newPrice:e.newPrice,data:v==null?void 0:v.data,bracketType:void 0,isFullscreen:this.isFullscreen}),this.tradeDragNewPrice=null,this.renderTradeLayer();return}let y=((c=this.pendingLevelDrags.get(e.label))==null?[]:c).filter(e=>e.field!==g);if(y.push({field:g,newPrice:e.newPrice,oldPrice:t,isNew:_,bracketOrderLabel:n}),this.pendingLevelDrags.set(e.label,y),this.tradeDragNewPrice=null,this.hideLevelConfirmCancel&&!r){this.applyPendingChanges(e.label);return}this.renderTradeLayer()}_orderTypeForPrice(e,t){let n=this.dataStore.all,r=n.length>0?n[n.length-1].close:t;return e===`buy`?t<r?`limit`:`stop`:t>r?`limit`:`stop`}createDraftOrder(e,t,n){if(this.draftOrderLabel)return;let r=`__draft_${Date.now()}`,i={type:`pending`,label:r,side:e,price:t,orderType:n,lots:this._qtyFieldMin,data:{_isDraft:!0}};this.levels=[...this.levels,i],this.draftOrderLabel=r,this.selectedTradeLabel=r,this.pendingLevelDrags.set(r,[{field:`main`,newPrice:t,oldPrice:t}]),this.crosshair=null,this.renderTradeLayer(),this.emitter.emit(`draftInitiated`,{side:e,price:t,orderType:n,isFullscreen:this.isFullscreen})}removeDraftOrder(){var e;if(!this.draftOrderLabel)return;let t=this.draftOrderLabel;this.levels=this.levels.filter(e=>e.label!==t),this.pendingLevelDrags.delete(t),this.selectedTradeLabel=null,this.draftOrderLabel=null,this.draftBracketPnl={},(e=this._draftQtyFlyout)==null||e.hide(),this._draftQtyPillArea=void 0,this.renderTradeLayer(),this.emitter.emit(`draftCancelled`,{label:t,isFullscreen:this.isFullscreen})}applyPendingChanges(e){let t=this.pendingLevelDrags.get(e);if(!t){if(this._editOpenLabel===e){let t=this.levels.find(t=>t.label===e);this._editOpenLabel=null,this.selectedTradeLabel=null,this.renderTradeLayer(),t&&this.emitter.emit(`tradeLevelConfirmed`,{label:e,type:t.type,isFullscreen:this.isFullscreen})}return}let n=this.levels.find(t=>t.label===e);if(!n)return;if(this._editOpenLabel===e&&(this._editOpenLabel=null),e===this.draftOrderLabel){var r,i,a;let o=t.find(e=>e.field===`main`),s=n;(r=this._onOrderSubmit)==null||r.call(this,{price:(i=o==null?void 0:o.newPrice)==null?s.price:i,lots:(a=s.lots)==null?this._qtyFieldMin:a,side:s.side,orderType:s.orderType,...s.stopLossPrice===void 0?{}:{stopLoss:s.stopLossPrice},...s.takeProfitPrice===void 0?{}:{takeProfit:s.takeProfitPrice}}),this.emitter.emit(`tradeLevelConfirmed`,{label:e,type:`draft`,isFullscreen:this.isFullscreen}),this.removeDraftOrder();return}let o=this.pendingQtyChanges.get(e);this.pendingQtyChanges.delete(e),this.originalQtyByLabel.delete(e);let s=o!==void 0&&n.data&&typeof n.data==`object`?{...n.data,lots:o}:n.data;this.emitter.emit(`tradeLevelEdit`,{label:e,type:n.type,data:s,isFullscreen:this.isFullscreen,...o===void 0?{}:{newLots:o},changes:t.map(e=>{let t=n.data,r=s;if(e.field===`stopLoss`){var i;r=(i=t.stopLossData)==null?n.data:i}else if(e.field===`takeProfit`){var a;r=(a=t.takeProfitData)==null?n.data:a}if(e.bracketOrderLabel){let t=this.levels.find(t=>t.label===e.bracketOrderLabel);t&&(r=t.data)}let c;return c=e.field===`main`?`MAIN`:e.field===`stopLoss`?e.isRemoval?`REMOVE_SL`:e.isNew?`ADD_SL`:`SL`:e.isRemoval?`REMOVE_TP`:e.isNew?`ADD_TP`:`TP`,{field:c,newPrice:e.newPrice,data:r,...c===`MAIN`&&o!==void 0?{newLots:o}:{},bracketOrderLabel:e.bracketOrderLabel}})}),this.emitter.emit(`tradeLevelConfirmed`,{label:e,type:n.type,isFullscreen:this.isFullscreen}),this.hideLevelConfirmCancel||(this.pendingLevelDrags.delete(e),this.selectedTradeLabel=null,this.draftBracketPnl={}),this.renderTradeLayer()}revertPendingChanges(e){var t;if(e&&e===this.draftOrderLabel){this.removeDraftOrder();return}if(!e&&this.draftOrderLabel&&this.removeDraftOrder(),e&&!this.pendingLevelDrags.has(e)&&this._editOpenLabel===e){this._cancelEditAndDeselect(e);return}let n=e?this.pendingLevelDrags.has(e)?[[e,(t=this.pendingLevelDrags.get(e))==null?[]:t]]:[]:[...this.pendingLevelDrags.entries()];for(let[e]of n){if(this.undoIsNewBracketMutations(e),this.pendingLevelDrags.delete(e),this.pendingQtyChanges.has(e)){this.pendingQtyChanges.delete(e);let t=this.levels.findIndex(t=>t.label===e);if(t!==-1&&this.originalQtyByLabel.has(e)){let n=this.originalQtyByLabel.get(e),r=this.levels[t];this.levels=[...this.levels.slice(0,t),{...r,lots:n},...this.levels.slice(t+1)]}this.originalQtyByLabel.delete(e)}let t=this.levels.find(t=>t.label===e);t&&(this._editOpenLabel===e&&(this._editOpenLabel=null),this.emitter.emit(`tradeLevelEditCancelled`,{label:e,type:t.type,isFullscreen:this.isFullscreen}))}this.selectedTradeLabel=null,this.draftBracketPnl={},this.renderTradeLayer()}undoIsNewBracketMutations(e){let t=this.pendingLevelDrags.get(e);if(!t)return;let n=t.some(e=>e.field===`stopLoss`&&e.isNew),r=t.some(e=>e.field===`takeProfit`&&e.isNew);!n&&!r||(this.levels=this.levels.map(t=>{if(t.label!==e)return t;let i={...t};return n&&(i.stopLossPrice=void 0),r&&(i.takeProfitPrice=void 0),i}))}render(){var e,t;let{ctx:n,canvas:r,theme:i,viewport:a}=this,o=window.devicePixelRatio||1,s=r.width,c=r.height,l=s/o-this.priceAxisWidth,u=this.activeIndicators.filter(e=>e.indicator.pane===`sub`),d=u.map(e=>e.indicator).reduce((e,t)=>e+this.paneH(t)+cc,0),f=c/o-this.timeAxisHeight-d;n.clearRect(0,0,s,c),n.fillStyle=i.background,n.fillRect(0,0,s,c);let p=this.dataStore.getVisible(a);if(p.length===0){this.drawCtx.clearRect(0,0,this.drawCanvas.width,this.drawCanvas.height);return}if(this._isPanning)this.viewport={...this._targetViewport};else{let e=this._targetViewport.startIndex-this.viewport.startIndex,t=this._targetViewport.endIndex-this.viewport.endIndex,n=(this._targetViewport.endIndex-this._targetViewport.startIndex)*2e-4;Math.abs(e)<n&&Math.abs(t)<n?this.viewport={...this._targetViewport}:(this.viewport={...this.viewport,startIndex:this.viewport.startIndex+e*fc,endIndex:this.viewport.endIndex+t*fc,candleWidth:this._targetViewport.candleWidth,candleGap:this._targetViewport.candleGap},this.scheduleRender())}if(this.priceScaleFactor!==1||this.pricePanOffset!==0){if(!this._lockedAutoFitBase){var m;this._lockedAutoFitBase=(m=this._displayedPriceRange)==null?this.dataStore.getPriceRange(a):m}let e=this._lockedAutoFitBase,t=(e.min+e.max)/2+this.pricePanOffset,n=e.max===e.min?1:(e.max-e.min)/2;this._displayedPriceRange={min:t-n*this.priceScaleFactor,max:t+n*this.priceScaleFactor}}else{this._lockedAutoFitBase=null;let e=this.getScaledPriceRange(a);if(!this._displayedPriceRange)this._displayedPriceRange=e;else{let t=(e.max-e.min)*1e-4,n=e.min-this._displayedPriceRange.min,r=e.max-this._displayedPriceRange.max;Math.abs(n)<t&&Math.abs(r)<t?this._displayedPriceRange=e:(this._displayedPriceRange={min:this._displayedPriceRange.min+n*dc,max:this._displayedPriceRange.max+r*dc},this.scheduleRender())}}let h=this._displayedPriceRange,g=this.showVolume?this.dataStore.getVolumeRange(a):null,_=r;switch(_._priceRange=h,_._chartWidth=l,n.save(),n.scale(o,o),n.save(),n.beginPath(),n.rect(0,0,l,f),n.clip(),ie(n,h,this.scaleManager,i,l,f),this.series){case`candlestick`:A(n,p,a,h,this.scaleManager,i,l,f);break;case`hollow`:j(n,p,a,h,this.scaleManager,i,l,f);break;case`line`:P(n,p,a,h,this.scaleManager,i,l,f,!1);break;case`area`:P(n,p,a,h,this.scaleManager,i,l,f,!0);break;case`ohlc`:F(n,p,a,h,this.scaleManager,i,l,f);break;case`heikinashi`:R(n,p,a,h,this.scaleManager,i,l,f);break;case`volumecandles`:z(n,p,a,h,this.scaleManager,i,l,f);break;case`linemarkers`:B(n,p,a,h,this.scaleManager,i,l,f);break;case`step`:V(n,p,a,h,this.scaleManager,i,l,f);break;case`hlcarea`:ee(n,p,a,h,this.scaleManager,i,l,f);break;case`baseline`:U(n,p,a,h,this.scaleManager,i,l,f);break;case`columns`:ne(n,p,a,h,this.scaleManager,i,l,f);break;case`highlow`:re(n,p,a,h,this.scaleManager,i,l,f);break}n.save(),n.beginPath(),n.rect(0,0,l,f),n.clip();for(let e of this.indicators.filter(e=>!e.pane||e.pane===`main`)){let t=this.indicatorResults.get(e.name);if(!t)continue;let r=t.slice(Math.floor(a.startIndex),Math.ceil(a.endIndex)+1);e.render(n,r,this.scaleManager,a,f)}n.restore(),n.restore(),Mt(n,h,this.scaleManager,i,l,f,this.priceAxisWidth,void 0,this.dataStore.getPricePrecision(),this.uiConfig.priceAxis);let v=this.dataStore.all[this.dataStore.all.length-1];if(v){let e=this.dataStore.getPricePrecision(),t=(t,r,i)=>{let a=this.scaleManager.yToPixel(t,h,f);n.save(),n.strokeStyle=r,n.lineWidth=1,n.setLineDash([3,3]),n.beginPath(),n.moveTo(0,a),n.lineTo(l,a),n.stroke(),n.setLineDash([]);let o=i+t.toFixed(e),s=n.measureText(o).width;n.fillStyle=r,n.fillRect(l,a-16/2,s+12,16),n.fillStyle=`#ffffff`,n.font=`10px 'Inter', system-ui, sans-serif`,n.textAlign=`left`,n.fillText(o,l+4,a+4),n.restore()};if(this.liveBidAsk){let{bid:e,ask:n}=this.liveBidAsk;this.showBidAskLines?(t(e,i.candle.down,``),t(n,i.candle.up,``)):t(this.tickClosePriceSource===`ask`?n:e,this.tickClosePriceSource===`ask`?i.candle.up:i.candle.down,``)}else{let e=v.close>=v.open;t(v.close,e?i.candle.up:i.candle.down,``)}}let y=f;for(let e of u){let t=e.indicator,r=this.paneH(t);if(n.fillStyle=i.axisBorder,n.fillRect(0,y,l+this.priceAxisWidth,cc),y+=cc,n.save(),n.beginPath(),n.rect(0,y,l+this.priceAxisWidth,r),n.clip(),n.translate(0,y),n.fillStyle=i.background,n.fillRect(0,0,l+this.priceAxisWidth,r),e.visible&&(()=>{let t=e.currentParams.timeframe;return!t||t===`Chart`||t===this.timeframe})()){let e=this.indicatorResults.get(t.name);if(e){var b,x;let o=e.slice(Math.floor(a.startIndex),Math.ceil(a.endIndex)+1),s=(b=t.getValueRange)==null?void 0:b.call(t,o),c=(x=this.subPaneScaleFactors.get(t.name))==null?1:x,u=s?gc(s,c):void 0;t.render(n,o,this.scaleManager,a,r,u),u&&Mt(n,u,this.scaleManager,i,l,r,this.priceAxisWidth,3,_c(u),this.uiConfig.priceAxis)}}n.restore(),y+=r}if(this.showVolume&&g&&g.max>0){let e=f*oc;I(n,p,a,g.max,this.scaleManager,i,l,e,f-e)}{var S;let e=this.candleCountdownTimeframes===`all`?!0:((S=this.candleCountdownTimeframes)==null?[`1m`,`5m`,`15m`,`30m`,`1h`,`2h`,`4h`,`8h`]:S).includes(this.timeframe),t=this.showCandleCountdown&&e&&p.length>0&&a.endIndex>=this.dataStore.length-1,r=t?this.dataStore.length-1:void 0;if(this._debug&&console.log(`[countdown] showCandleCountdown:`,this.showCandleCountdown,`| tf:`,this.timeframe,`| allowed:`,e,`| bars:`,p.length,`| endIndex:`,a.endIndex,`| dataLen:`,this.dataStore.length,`| atLiveEdge:`,a.endIndex>=this.dataStore.length-1),At(n,p,a,this.scaleManager,i,l,y,pc()?3:void 0,this.uiConfig.timeAxis,this.timeframe,r,this.timezone),t){let e=this.dataStore.all[this.dataStore.length-1],t=this.timeframeToMs(this.timeframe);jt(n,e.time,t,this.dataStore.length-1,a,this.scaleManager,i,l,y,this.uiConfig.timeAxis)}}if(this.crosshair&&se(n,this.crosshair,h,a,this.scaleManager,i,l,f,this.priceAxisWidth,y,this.timeframe,this.dataStore.getPricePrecision(),this.uiConfig.crosshair,this.timezone),this.logoImage){let e=f-20-40/2;n.save(),n.globalAlpha=.6,n.beginPath(),n.rect(0,0,l,f),n.clip(),n.beginPath(),n.arc(40,e,40/2,0,Math.PI*2),n.closePath(),n.clip(),n.drawImage(this.logoImage,40-40/2,e-40/2,40,40),n.restore()}n.restore();let C=this.crosshair?(e=this.dataStore.all[this.crosshair.barIndex])==null?null:e:(t=this.dataStore.all[this.dataStore.length-1])==null?null:t;if(this.renderSymbolInfoOHLC(C),this.drawingManager.render(this.drawCtx,this.scaleManager,a,h,l,f,this.dataStore.getPricePrecision()),this.scrollToEndBtn){let e=this.dataStore.length===0||this._targetViewport.endIndex>=this.dataStore.length-.5;e!==!this.scrollToEndVisible&&(this.scrollToEndVisible=!e,this.scrollToEndBtn.style.opacity=e?`0`:`0.85`,this.scrollToEndBtn.style.pointerEvents=e?`none`:`auto`)}if(this.resetViewBtn){let e=this.dataStore.length,t=this._defaultVisibleBars,n=e===0||this._targetViewport.endIndex>=e-.5,r=this._targetViewport.endIndex-this._targetViewport.startIndex,i=Math.abs(r-t)<.5,a=this.priceScaleFactor===1&&this.pricePanOffset===0&&this._lockedAutoFitBase===null,o=e===0||n&&i&&a;o===this.resetViewVisible&&(this.resetViewVisible=!o,this.resetViewBtn.style.opacity=o?`0`:`0.75`,this.resetViewBtn.style.pointerEvents=o?`none`:`auto`)}this.updateSubPaneOverlayPositions()}recomputeIndicators(){for(let e of this.indicators)this.indicatorResults.set(e.name,e.compute(this.dataStore.all))}onResize(){let e=window.devicePixelRatio||1,t=this.canvasWrap.getBoundingClientRect();this._cachedWrapRect=t,this._cachedDrawRect=this.drawCanvas.getBoundingClientRect();for(let n of[this.canvas,this.tradeCanvas,this.drawCanvas])n.width=t.width*e,n.height=t.height*e;let n=this.wrapper.offsetWidth,r=n>0&&n<this.uiConfig.drawingToolbar.mobileBreakpoint;if(r!==this._mobileLayout){var i,a,o,s;if(this._mobileLayout=r,(i=this.leftBar)==null||i.setMobileMode(r),(a=this.topBar)==null||a.setMobileLayout(r),(o=this.tradeButton)==null||o.setMobileMode(r),(s=this.tradePopover)==null||s.setCompact(r),this.siEl&&(this.siEl.style.flexDirection=r?`column`:`row`,this.siEl.style.alignItems=r?`flex-start`:`center`,this.siEl.style.gap=r?`2px`:`8px`),r){var c;this.leftBarVisible=!1,(c=this.topBar)==null||c.setDrawingsBtnActive(!1)}else{var l,u;this.leftBarVisible=!0,(l=this.leftBar)==null||l.setVisible(!0),(u=this.topBar)==null||u.setDrawingsBtnActive(!0)}}this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.render(),this.renderTradeLayer()}paneH(e){var t,n;return(t=(n=this.paneHeightOverrides.get(e.name))==null?e.paneHeight:n)==null?sc:t}getChartLayout(){var e;let t=this.activeIndicators.filter(e=>e.indicator.pane===`sub`).map(e=>e.indicator).reduce((e,t)=>e+this.paneH(t)+cc,0),n=(e=this._cachedWrapRect)==null?this.canvasWrap.getBoundingClientRect():e;return{chartW:n.width-this.priceAxisWidth,priceH:n.height-this.timeAxisHeight-t}}updateSubPaneOverlayPositions(){if(this.subPaneOverlays.size===0)return;let e=this.getSeparatorPositions();for(let t of e){let e=this.subPaneOverlays.get(t.indicatorName);e&&(e.el.style.top=`${t.y+cc+6}px`)}}getSeparatorPositions(){let{priceH:e}=this.getChartLayout(),t=this.activeIndicators.filter(e=>e.indicator.pane===`sub`).map(e=>e.indicator),n=[],r=e;for(let e of t)n.push({y:r,indicatorName:e.name}),r+=this.paneH(e)+cc;return n}getScaledPriceRange(e){let t=this.dataStore.getPriceRange(e),n=t.min,r=t.max;for(let t of this.indicators.filter(e=>!e.pane||e.pane===`main`)){let a=this.indicatorResults.get(t.name);if(!a)continue;let o=Math.floor(e.startIndex),s=Math.ceil(e.endIndex)+1;for(let e=o;e<s&&e<a.length;e++){var i;let t=(i=a[e])==null?void 0:i.value;if(t==null)continue;let o=Array.isArray(t)?t.filter(e=>e!==null):[t];for(let e of o)isFinite(e)&&(e<n&&(n=e),e>r&&(r=e))}}let a=(n+r)/2+this.pricePanOffset,o=n===r?1:(r-n)/2;return{min:a-o*this.priceScaleFactor,max:a+o*this.priceScaleFactor}}touchToDrawingPoint(e){var t,n;let r=(t=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():t,i=e.clientX-r.left,a=e.clientY-r.top,{chartW:o,priceH:s}=this.getChartLayout(),c=(n=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):n;return this.makeDrawingPoint(this.scaleManager.pixelToBarIndex(i,this.viewport,o),this.scaleManager.pixelToPrice(a,c,s))}makeDrawingPoint(e,t){let n={barIndex:e,price:t},r=this.barIndexToTimestamp(e);return r!=null&&(n.timestamp=r),n}_handleTradeLevelClose(e){if(e.bracketType){var t,n;let r=this.levels.find(t=>t.label===e.label);if((r==null||(t=r.data)==null?void 0:t._isDraft)===!0&&r){let t=e.bracketType===`stopLoss`?`sl`:`tp`;this.updateDraftOrderBracket(t,null),this.emitter.emit(`tradeLevelEdit`,{label:e.label,type:`pending`,data:r.data,isFullscreen:this.isFullscreen,changes:[{field:e.bracketType===`stopLoss`?`REMOVE_SL`:`REMOVE_TP`,newPrice:0,data:r.data,bracketOrderLabel:void 0}]});return}let i=e.bracketType,a=((n=this.pendingLevelDrags.get(e.label))==null?[]:n).filter(e=>e.field!==i);a.push({field:i,newPrice:0,oldPrice:0,isRemoval:!0,bracketOrderLabel:e.bracketOrderLabel}),this.pendingLevelDrags.set(e.label,a),this.selectedTradeLabel=e.label,this.renderTradeLayer();return}let r=e.label===this.draftOrderLabel,i=this.pendingLevelDrags.get(e.label),a=this._editOpenLabel===e.label,o=!!i&&i.length>0&&i.every(e=>e.isNew),s=!i||i.length===0,c=!r&&a&&(o||s);if(this.revertPendingChanges(e.label),this.pendingLevelDrags.delete(e.label),r)return;if(c){if(s){let t=this.levels.find(t=>t.label===e.label);this._editOpenLabel=null,this.selectedTradeLabel=null,this.renderTradeLayer(),t&&this.emitter.emit(`tradeLevelEditCancelled`,{label:e.label,type:t.type,isFullscreen:this.isFullscreen})}return}this._editOpenLabel===e.label&&(this._editOpenLabel=null);let l=this.levels.find(t=>t.label===e.label),u=(l==null?void 0:l.type)===`position`&&!!l.entryPriceEditable,d=e.type===`position`&&!u?`CLOSED`:`CANCELLED`;this.emitter.emit(`tradeLevelClose`,{label:e.label,type:e.type,action:d,data:e.data,isFullscreen:this.isFullscreen})}_activateMobileCrosshair(e,t){var n,r,i;let a=(n=this._cachedDrawRect)==null?this.drawCanvas.getBoundingClientRect():n,{chartW:o,priceH:s}=this.getChartLayout(),c=(r=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):r,l=a.height-this.timeAxisHeight;if(e>=o||t>=l)return;this._mobileCrosshairActive=!0;let u=this.scaleManager.pixelToBarIndex(e,this.viewport,o),d=this.scaleManager.pixelToPrice(t,c,s),f=Math.max(Math.floor(this.viewport.startIndex),Math.min(Math.ceil(this.viewport.endIndex),Math.round(u))),p=(i=this.dataStore.all[f])==null?null:i;this.crosshair=this.selectedTradeLabel===null?{x:e,y:t,barIndex:f,price:d,bar:p}:null,this.tradeButton&&(this.tradeButton.setY(t),this._isTradingActive||St(t,this.uiConfig.tradeButton.size/2,this.offViewportHitAreas)?this.tradeButton.hide():this.tfcActive&&this.tradeButton.show(),this._tradeButtonClickData={price:d,y:t}),this.scheduleRender()}_cancelEditAndDeselect(e){let t=this._editOpenLabel===e,n=this.levels.find(t=>t.label===e);this._editOpenLabel=null,this.selectedTradeLabel=null,this.draftBracketPnl={},this.renderTradeLayer(),t&&n&&this.emitter.emit(`tradeLevelEditCancelled`,{label:e,type:n.type,isFullscreen:this.isFullscreen})}_openTradeLevelEditForm(e){if(this._editOpenLabel===e.label)return;this.selectedTradeLabel=e.label,this._editOpenLabel=e.label;let{slPrice:t,tpPrice:n}=this._resolveBracketPrices(e);this.renderTradeLayer(),this.emitter.emit(`tradeLevelEditOpen`,{label:e.label,type:e.type,data:e.data,price:e.price,side:e.side,stopLossPrice:t,takeProfitPrice:n,isFullscreen:this.isFullscreen})}_startTradeDragFromHit(e,t,n){var r;if(!this.tradeDragHandler)return;let{priceH:i}=this.getChartLayout(),a=(r=this._displayedPriceRange)==null?this.getScaledPriceRange(this.viewport):r,o=this.scaleManager.yToPixel(e.price,a,i);if(e.isBracket){var s,c,l,u;this._pendingBracketOrderLabel=(s=e.bracketOrderLabel)==null?null:s,this._isBracketNew=!1;let r=t.entryPriceEditable===!0,i=((c=t.data)==null?void 0:c._isDraft)===!0,a=this.hideLevelConfirmCancel&&t.type===`pending`&&!i,d=this.dataStore.all,f=r||i||a||(l=(u=d[d.length-1])==null?void 0:u.close)==null?0:l;this.tradeDragHandler.startBracketDrag(t,e.bracketType,e.price,n,o,f,this._effectiveEntryPrice(t.label,t.price)),this.emitter.emit(`tradeLevelDragStart`,{label:t.label,bracketType:e.bracketType,isFullscreen:this.isFullscreen})}else if(this._pendingBracketOrderLabel=null,t.entryPriceEditable===!0){var d,f;this.selectedTradeLabel=e.label;let r=t,i=this.dataStore.all,a=(d=(f=i[i.length-1])==null?void 0:f.close)==null?0:d,s=this._effectiveBracketPrice(t.label,`stopLoss`,r.stopLossPrice),c=this._effectiveBracketPrice(t.label,`takeProfit`,r.takeProfitPrice);this.tradeDragHandler.startDrag(t,n,o,e.price,s,c,r.side,a,r.orderType,!0)}else{var p,m;let r=t,i=this.dataStore.all,a=(p=(m=i[i.length-1])==null?void 0:m.close)==null?0:p,{slPrice:s,tpPrice:c,slSiblingLabel:l,tpSiblingLabel:u}=this._resolveBracketPrices(t);this._slSiblingOrderLabel=l==null?null:l,this._tpSiblingOrderLabel=u==null?null:u;let d=this._effectiveBracketPrice(t.label,`stopLoss`,s),f=this._effectiveBracketPrice(t.label,`takeProfit`,c);this.tradeDragHandler.startDrag(t,n,o,e.price,d,f,r.side,a,r.orderType,!0)}this._openTradeLevelEditForm(t)}_startAddBracketFromHit(e,t){var n,r,i;let a=this.levels.find(t=>t.label===e.label);if(!a||!this.tradeDragHandler)return;let{priceH:o}=this.getChartLayout(),s=this.getScaledPriceRange(this.viewport),c=e.y+e.h/2,l=this.scaleManager.pixelToPrice(c,s,o),u=a.entryPriceEditable===!0,d=((n=a.data)==null?void 0:n._isDraft)===!0,f=this.hideLevelConfirmCancel&&a.type===`pending`&&!d,p=this.dataStore.all,m=u||d||f||(r=(i=p[p.length-1])==null?void 0:i.close)==null?0:r;this._pendingBracketOrderLabel=null,this._isBracketNew=!0,this.tradeDragHandler.startBracketDrag(a,e.bracketType,l,t,c,m,this._effectiveEntryPrice(a.label,a.price)),this.emitter.emit(`tradeLevelDragStart`,{label:a.label,bracketType:e.bracketType,isFullscreen:this.isFullscreen})}showTextInput(e){var t;if(!this.textInputEl)return;this.textInputDrawing=e;let{chartW:n,priceH:r}=this.getChartLayout(),i=this.getScaledPriceRange(this.viewport),a,o;if(e.type===`text`)a=this.scaleManager.xToPixel(e.points[0].barIndex,this.viewport,n),o=this.scaleManager.yToPixel(e.points[0].price,i,r);else{var s;let t=(s=e.points[1])==null?e.points[0]:s;a=this.scaleManager.xToPixel(t.barIndex,this.viewport,n)-30,o=this.scaleManager.yToPixel(t.price,i,r)-10}let c=this.textInputEl;c.value=(t=e.text)==null?``:t,c.style.left=`${Math.max(0,a)}px`,c.style.top=`${Math.max(0,o)}px`,c.style.display=`block`,this.drawingManager.setEditingText(!0),c.focus(),c.select();let l=()=>{c.removeEventListener(`keydown`,d),c.removeEventListener(`blur`,f),this.commitTextInput()},u=()=>{c.removeEventListener(`keydown`,d),c.removeEventListener(`blur`,f),this.cancelTextInput()},d=e=>{e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),u())},f=()=>l();c.addEventListener(`keydown`,d),c.addEventListener(`blur`,f,{once:!0})}commitTextInput(){var e,t;!this.textInputEl||!this.textInputDrawing||(this.textInputDrawing.text=this.textInputEl.value,this.textInputEl.style.display=`none`,this.textInputDrawing=null,this.drawingManager.setEditingText(!1),(e=(t=this.drawingManager).onDrawingsChange)==null||e.call(t),this.scheduleRender())}cancelTextInput(){this.textInputEl&&(this.textInputEl.style.display=`none`,this.textInputDrawing=null,this.drawingManager.setEditingText(!1),this.scheduleRender())}setDotTickActive(){this.siStreamDot&&(this.tickActivityTimer!==null&&clearTimeout(this.tickActivityTimer),this.siStreamDot.style.background=this.theme.candle.up,this.tickActivityTimer=setTimeout(()=>{this.tickActivityTimer=null,this.siStreamDot&&(this.siStreamDot.style.background=this.theme.ui.stream[this.streamStatus])},this.tickActivityMs))}fillTickGap(e,t){if(!this.dataLoader||this.isFetching)return;let n=this.timeframeToInterval(this.getBaseInterval());this.dataLoader({start:new Date(e),end:new Date(t),interval:n}).then(e=>{let t=this.maybeAggregate(e);if(t.length===0)return;this.backfillDrawingTimestamps();let n=this.dataStore.all,r=n[n.length-1],i=0;for(let e of t){if(e.time>=r.time)continue;let t=n.findIndex(t=>t.time===e.time);if(t!==-1)n[t]=e;else{let t=n.findIndex(t=>t.time>e.time);n.splice(t===-1?n.length-1:t,0,e),i++}}i>0&&(this.viewport={...this.viewport,startIndex:this.viewport.startIndex+i,endIndex:this.viewport.endIndex+i},this.reanchorDrawingsByTimestamp(),this.recomputeIndicators(),this.scheduleRender())}).catch(()=>{})}correctCompletedBar(e,t){if(!this.dataLoader||this.isFetching)return;let n=new Date(e),r=new Date(e+t*3),i=this.timeframeToInterval(this.getBaseInterval());this.dataLoader({start:n,end:r,interval:i}).then(e=>{let t=this.maybeAggregate(e);if(t.length===0)return;let n=this.dataStore.all,r=n.length-1,i=!1;for(let e of t){let t=n.findIndex(t=>t.time===e.time);t!==-1&&t!==r&&(n[t]=e,i=!0)}i&&(this.recomputeIndicators(),this.scheduleRender())}).catch(()=>{})}setDebug(e){return this._debug=e,this}correctBar(e,t){let n=this.dataStore.all,r=n.findIndex(t=>t.time===e);r!==-1&&(n[r]=t,this.recomputeIndicators(),this.scheduleRender())}scrollToEnd(){this.panHandler.cancel(),this.scrollAnimId!==null&&(cancelAnimationFrame(this.scrollAnimId),this.scrollAnimId=null);let e=this.viewport.endIndex-this.viewport.startIndex,t=this.dataStore.length+hc,n=this.viewport.endIndex,r=this.pricePanOffset,i=performance.now(),a=e=>e<.5?2*e*e:-1+(4-2*e)*e,o=s=>{let c=Math.min((s-i)/350,1),l=a(c),u=n+(t-n)*l;this.viewport={...this.viewport,startIndex:u-e,endIndex:u},this._targetViewport={...this.viewport},this.pricePanOffset=r*(1-l),this.render(),c<1?this.scrollAnimId=requestAnimationFrame(o):this.scrollAnimId=null};this.scrollAnimId=requestAnimationFrame(o)}scrollToCenterPrice(e){if(!isFinite(e)||this.dataStore.length===0)return;this.scrollAnimId!==null&&(cancelAnimationFrame(this.scrollAnimId),this.scrollAnimId=null);let t=this.dataStore.getPriceRange(this.viewport),n=(t.min+t.max)/2,r=this.pricePanOffset,i=e-n;if(Math.abs(i-r)<1e-9)return;let a=performance.now(),o=e=>e<.5?2*e*e:-1+(4-2*e)*e,s=e=>{let t=Math.min((e-a)/350,1),n=o(t);this.pricePanOffset=r+(i-r)*n,this.render(),t<1?this.scrollAnimId=requestAnimationFrame(s):this.scrollAnimId=null};this.scrollAnimId=requestAnimationFrame(s)}resetPriceAxis(){this.priceScaleFactor=1,this.pricePanOffset=0,this._lockedAutoFitBase=null,this.scheduleRender()}resetTimeAxis(){this.panHandler.cancel();let e=this.dataStore.length;if(e===0)return;let t=mc(this.mobileBarDivisor,this.explicitMobileDivisor,this.defaultVisibleBars,this.defaultMobileVisibleBars);this._defaultVisibleBars=t;let n=Math.max(0,e-t+hc);this.viewport={...this.viewport,startIndex:n,endIndex:e+hc},this._targetViewport={...this.viewport},this.scheduleRender()}resetView(){this.resetPriceAxis(),this.resetTimeAxis()}applyResetViewBtnStyles(){this.resetViewBtn&&(this.resetViewBtn.innerHTML=Xt(this.theme.axisText,16),Object.assign(this.resetViewBtn.style,{position:`absolute`,bottom:`${this.timeAxisHeight+8}px`,left:`50%`,transform:`translateX(-50%)`,zIndex:`100`,width:`32px`,height:`32px`,padding:`0`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:this.theme.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`50%`,cursor:`pointer`,outline:`none`,boxShadow:`0 2px 6px rgba(0,0,0,0.25)`,opacity:`0`,pointerEvents:`none`,transition:`opacity 0.2s ease`}))}applyScrollToEndBtnStyles(){this.scrollToEndBtn&&(this.scrollToEndBtn.innerHTML=Yt(this.theme.axisText,16),Object.assign(this.scrollToEndBtn.style,{position:`absolute`,bottom:`${this.timeAxisHeight+8}px`,right:`${this.priceAxisWidth+8}px`,zIndex:`100`,width:`32px`,height:`32px`,padding:`0`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:this.theme.background,border:`1px solid ${this.theme.axisBorder}`,borderRadius:`50%`,cursor:`pointer`,outline:`none`,boxShadow:`0 2px 6px rgba(0,0,0,0.25)`,opacity:`0`,pointerEvents:`none`,transition:`opacity 0.2s ease`}))}};$s=vc,$s.DRAW_GESTURE_THRESHOLD=4,$s.TRADE_DRAG_PIXEL_THRESHOLD=3;var Q=null,yc=new Map,bc=0;function xc(){return`dr_${Date.now()}_${bc++}`}function $(e,t){var n;let r=JSON.stringify({type:e,payload:t});window.ChartAndroidBridge?window.ChartAndroidBridge.postMessage(r):!((n=window.webkit)==null||(n=n.messageHandlers)==null)&&n.chartBridge?window.webkit.messageHandlers.chartBridge.postMessage(r):window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(r)}function Sc(e={}){var t;Q==null||Q.destroy();let n=document.getElementById(`chart`),{enableTrading:r,onSymbolClick:i,...a}=e,o=(t=a.timeframe)==null?`1D`:t;Q=new vc({theme:`dark`,...a,container:n,dataLoader:e=>{for(let[,e]of yc)e.reject(Error(`cancelled`));yc.clear();let t=xc(),n=Q==null?void 0:Q.getState();return new Promise((r,i)=>{var a;yc.set(t,{resolve:r,reject:i}),$(`dataRequest`,{requestId:t,timeframe:(a=n==null?void 0:n.timeframe)==null?o:a,interval:e.interval,start:e.start.getTime(),end:e.end.getTime()})})},...r?{onOrderSubmit:e=>{var t;$(`placeOrder`,{price:e.price,side:e.side,orderType:(t=e.orderType)==null?`limit`:t})}}:{},...i?{onSymbolClick:e=>{$(`symbolClick`,{symbol:e})}}:{}}),Q.on(`timeframeChange`,({timeframe:e})=>{o=e}),Q.on(`crosshair`,e=>$(`crosshair`,e)),Q.on(`click`,e=>$(`barClick`,e)),Q.on(`zoom`,({viewport:e})=>$(`viewportChange`,{viewport:e})),Q.on(`pan`,({viewport:e})=>$(`viewportChange`,{viewport:e})),Q.on(`seriesChange`,e=>$(`seriesChange`,e)),Q.on(`timeframeChange`,e=>$(`timeframeChange`,e)),Q.on(`durationChange`,e=>$(`durationChange`,e)),Q.on(`stateChange`,e=>$(`stateChange`,e)),Q.on(`dataLoaded`,e=>$(`dataLoaded`,e)),Q.on(`newBar`,e=>$(`newBar`,e)),Q.on(`streamStatus`,e=>$(`streamStatus`,e)),Q.on(`tradeLevelClose`,e=>$(`tradeLevelClose`,e)),Q.on(`tradeLevelDrag`,e=>$(`tradeLevelDrag`,e)),Q.on(`tradeLevelDragStart`,e=>$(`tradeLevelDragStart`,e)),Q.on(`tradeLevelEdit`,e=>$(`tradeLevelEdit`,e)),Q.on(`tradeLevelQtyChange`,e=>$(`tradeLevelQtyChange`,e)),Q.on(`tradeLevelConfirmed`,e=>$(`tradeLevelConfirmed`,e)),Q.on(`tradeLevelEditOpen`,e=>$(`tradeLevelEditOpen`,e)),Q.on(`tradeLevelBracketActivated`,e=>$(`tradeLevelBracketActivated`,e)),Q.on(`draftInitiated`,e=>$(`draftInitiated`,e)),Q.on(`draftCancelled`,e=>$(`draftCancelled`,e)),Q.on(`uiStateChange`,e=>$(`uiStateChange`,e))}function Cc(e){if(e.type===`init`){Sc(e.payload);return}if(!Q){$(`error`,{message:`Engine not initialized. Send an "init" command first.`});return}switch(e.type){case`loadData`:Q.loadData(e.payload.bars,e.payload.fitAll);break;case`pushTick`:Q.pushTick(e.payload);break;case`setTheme`:Q.setTheme(e.payload.theme);break;case`setTimezone`:Q.setTimezone(e.payload.timezone);break;case`setSeries`:Q.setSeries(e.payload.series);break;case`setTimeframe`:Q.setTimeframe(e.payload.timeframe);break;case`setSymbol`:Q.setSymbol(e.payload.symbol);break;case`addIndicator`:Q.addIndicatorByName(e.payload.shortName);break;case`removeIndicator`:Q.removeIndicator(e.payload.name);break;case`setDrawingTool`:Q.setDrawingTool(e.payload.tool);break;case`clearAllDrawings`:Q.clearAllDrawings();break;case`getState`:$(`stateSnapshot`,Q.getState());break;case`setState`:Q.setState(e.payload);break;case`resolveDataRequest`:{let t=yc.get(e.payload.requestId);t&&(yc.delete(e.payload.requestId),t.resolve(e.payload.bars));break}case`setDebug`:Q.setDebug(e.payload.enabled);break;case`destroy`:Q.destroy(),Q=null;break;case`setLevels`:Q.setLevels(e.payload.levels,e.payload.labelKey,e.payload.priceKey,e.payload.type,e.payload.pnlKey,e.payload.pnlTextKey);break;case`removeLevelByLabel`:Q.removeLevelByLabel(e.payload.label);break;case`updateLevelMainPrice`:Q.updateLevelMainPrice(e.payload.label,e.payload.price);break;case`updateLevelBracket`:Q.updateLevelBracket(e.payload.label,e.payload.bracketType.toLowerCase(),e.payload.price);break;case`addLevelBracket`:Q.addLevelBracket(e.payload.label,e.payload.bracketType.toLowerCase());break;case`addBracket`:Q.addBracket(e.payload.bracketType.toLowerCase(),e.payload.label);break;case`removeBracket`:Q.removeBracket(e.payload.bracketType.toLowerCase(),e.payload.label);break;case`cancelLevelEdit`:Q.cancelLevelEdit(e.payload.label);break;case`selectLevel`:Q.selectLevel(e.payload.label);break;case`showDraftOrder`:Q.showDraftOrder(e.payload.price,e.payload.side,e.payload.orderType);break;case`showMarketDraft`:Q.showMarketDraft(e.payload.price,e.payload.side);break;case`clearDraftOrder`:Q.clearDraftOrder();break;case`cancelCurrentEdit`:Q.cancelCurrentEdit();break;case`updateDraftOrderPrice`:Q.updateDraftOrderPrice(e.payload.price);break;case`updateDraftOrderBracket`:Q.updateDraftOrderBracket(e.payload.bracketType,e.payload.price);break;case`setDraftBracketPnl`:Q.setDraftBracketPnl(e.payload.bracketType,e.payload.pnlText);break;case`setVolume`:Q.setVolume(e.payload.show);break;case`setIsins`:Q.setIsins(e.payload.isins);break;case`resetView`:Q.resetView();break;case`resetData`:Q.resetData();break;case`setLoading`:Q.setLoading(e.payload.loading);break;case`setThemeOverrides`:Q.setThemeOverrides(e.payload.overrides);break;case`correctBar`:Q.correctBar(e.payload.barTime,e.payload.bar);break;case`dismissAllUI`:Q.dismissAllUI();break}}document.addEventListener(`DOMContentLoaded`,()=>{window.ChartBridge={send(e){let t;try{t=JSON.parse(e)}catch(t){$(`error`,{message:`Invalid JSON: ${e}`});return}try{Cc(t)}catch(e){$(`error`,{message:String(e)})}}},$(`ready`,{})})})();</script>
|
|
237
237
|
</body>
|
|
238
238
|
</html>
|