@tradecanvas/chart 1.69.0 → 1.70.0
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/Chart.d.ts +15 -96
- package/dist/Chart.d.ts.map +1 -1
- package/dist/DataManager.d.ts +7 -0
- package/dist/DataManager.d.ts.map +1 -1
- package/dist/{LayoutSession-CoCMrrbh.js → LayoutSession-Bcy79w0l.js} +1030 -829
- package/dist/LayoutSession-Bcy79w0l.js.map +1 -0
- package/dist/LayoutSession-D7S6GZgJ.cjs +2 -0
- package/dist/LayoutSession-D7S6GZgJ.cjs.map +1 -0
- package/dist/SeriesStore.d.ts +2 -0
- package/dist/SeriesStore.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/model/DisplaySeries.d.ts +50 -0
- package/dist/model/DisplaySeries.d.ts.map +1 -0
- package/dist/model/DrawingPanes.d.ts +24 -0
- package/dist/model/DrawingPanes.d.ts.map +1 -0
- package/dist/model/IndicatorHistory.d.ts +52 -0
- package/dist/model/IndicatorHistory.d.ts.map +1 -0
- package/dist/model/IndicatorPanes.d.ts +76 -0
- package/dist/model/IndicatorPanes.d.ts.map +1 -0
- package/dist/model/IndicatorSetup.d.ts +34 -0
- package/dist/model/IndicatorSetup.d.ts.map +1 -0
- package/dist/model/PaneLayout.d.ts +55 -0
- package/dist/model/PaneLayout.d.ts.map +1 -0
- package/dist/model/PriceFit.d.ts +75 -0
- package/dist/model/PriceFit.d.ts.map +1 -0
- package/dist/model/SymbolRequests.d.ts +34 -0
- package/dist/model/SymbolRequests.d.ts.map +1 -0
- package/dist/widget/index.cjs +1 -1
- package/dist/widget/index.js +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-BWC7O5R9.cjs +0 -2
- package/dist/LayoutSession-BWC7O5R9.cjs.map +0 -1
- package/dist/LayoutSession-CoCMrrbh.js.map +0 -1
- package/dist/PaneManager.d.ts +0 -19
- package/dist/PaneManager.d.ts.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { DataSeries, ViewportState } from '@tradecanvas/commons';
|
|
2
|
+
export interface PriceRange {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
}
|
|
6
|
+
/** The part of the viewport a fit writes to. */
|
|
7
|
+
export interface FitTarget {
|
|
8
|
+
isInvertScale(): boolean;
|
|
9
|
+
setScaleMargins(margins: {
|
|
10
|
+
top: number;
|
|
11
|
+
bottom: number;
|
|
12
|
+
}): void;
|
|
13
|
+
fitToPrices(min: number, max: number): void;
|
|
14
|
+
}
|
|
15
|
+
/** What else is on the price scale besides the bars, read at fit time. */
|
|
16
|
+
export interface FitSources {
|
|
17
|
+
/** Overlay indicators (Bollinger, Ichimoku…) over the bars from `from` to `to`. */
|
|
18
|
+
overlayRange(from: number, to: number): PriceRange | null;
|
|
19
|
+
/** The compare lines on view, or null when none are drawn. */
|
|
20
|
+
compareRange(data: DataSeries, vs: ViewportState): PriceRange | null;
|
|
21
|
+
/** The volume band's share of the plot when volume is on view, else null. */
|
|
22
|
+
volumeRatio(data: DataSeries, from: number, to: number): number | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* When the main price scale is fitted to the bars, and what it is fitted to.
|
|
26
|
+
* No DOM: the chart hands it the viewport and the other ranges on the scale.
|
|
27
|
+
*
|
|
28
|
+
* Auto-scale on fits every frame. Off, a new series (the first bars,
|
|
29
|
+
* `setData`'s, a symbol or timeframe switch) is still fitted once, then held:
|
|
30
|
+
* otherwise a chart would keep its empty 0 to 1, or the last symbol's prices.
|
|
31
|
+
* Bars that come one by one into an empty chart are fitted until they fill it.
|
|
32
|
+
*/
|
|
33
|
+
export declare class PriceFit {
|
|
34
|
+
private auto;
|
|
35
|
+
/**
|
|
36
|
+
* The `autoScale` asked for (the option, or `setAutoScale`), which a new
|
|
37
|
+
* series goes back to. `auto` alone is also turned off by a drag of the
|
|
38
|
+
* price axis or a vertical pan, which hold the range for this series only.
|
|
39
|
+
*/
|
|
40
|
+
private preferred;
|
|
41
|
+
/** A new series whose prices aren't on the axis yet. */
|
|
42
|
+
private pending;
|
|
43
|
+
/** The series began with no bars, so they come one by one: see `settle`. */
|
|
44
|
+
private arriving;
|
|
45
|
+
constructor(autoScale: boolean);
|
|
46
|
+
isAuto(): boolean;
|
|
47
|
+
/** Whether this frame fits the scale. */
|
|
48
|
+
shouldFit(): boolean;
|
|
49
|
+
/** The host's choice, kept by the series that come after. */
|
|
50
|
+
setAuto(enabled: boolean, hasBars: boolean): void;
|
|
51
|
+
/** A drag of the price axis or a vertical pan: the range on screen is the user's, held from here. */
|
|
52
|
+
hold(): void;
|
|
53
|
+
/** Auto-scale back on (a double-click of the price axis, a replay), the preference left as it is. */
|
|
54
|
+
resume(): void;
|
|
55
|
+
/** A new series replaced the bars: it goes back to the preference and is fitted once. */
|
|
56
|
+
newSeries(empty: boolean): void;
|
|
57
|
+
/**
|
|
58
|
+
* After a frame was fitted: the new series' prices are on the axis once
|
|
59
|
+
* some of its bars were on a plot with room for them, so auto-scale off
|
|
60
|
+
* holds them from here. A chart with no size yet (a hidden tab or panel)
|
|
61
|
+
* has none on view and fits them once it gets one.
|
|
62
|
+
*/
|
|
63
|
+
settle(vs: ViewportState, shown: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* Fit the scale to the bars on view, the overlay indicators and the compare
|
|
66
|
+
* lines, in margins of φ⁻⁵ above and below; with volume on view, the band
|
|
67
|
+
* at the bottom is left to it.
|
|
68
|
+
*/
|
|
69
|
+
fit(target: FitTarget, data: DataSeries, vs: ViewportState, sources: FitSources): void;
|
|
70
|
+
}
|
|
71
|
+
/** Whether any bar from `from` to `to` traded. */
|
|
72
|
+
export declare function hasVolume(data: DataSeries, from: number, to: number): boolean;
|
|
73
|
+
/** Both ranges in one (either may be null). */
|
|
74
|
+
export declare function joinRanges(a: PriceRange | null, b: PriceRange | null): PriceRange | null;
|
|
75
|
+
//# sourceMappingURL=PriceFit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PriceFit.d.ts","sourceRoot":"","sources":["../../src/model/PriceFit.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMnG,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,gDAAgD;AAChD,MAAM,WAAW,SAAS;IACxB,aAAa,IAAI,OAAO,CAAC;IACzB,eAAe,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChE,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC;IAC1D,8DAA8D;IAC9D,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,aAAa,GAAG,UAAU,GAAG,IAAI,CAAC;IACrE,6EAA6E;IAC7E,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACxE;AAED;;;;;;;;GAQG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,IAAI,CAAU;IACtB;;;;OAIG;IACH,OAAO,CAAC,SAAS,CAAU;IAC3B,wDAAwD;IACxD,OAAO,CAAC,OAAO,CAAQ;IACvB,4EAA4E;IAC5E,OAAO,CAAC,QAAQ,CAAQ;gBAEZ,SAAS,EAAE,OAAO;IAK9B,MAAM,IAAI,OAAO;IAIjB,yCAAyC;IACzC,SAAS,IAAI,OAAO;IAIpB,6DAA6D;IAC7D,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAOjD,qGAAqG;IACrG,IAAI,IAAI,IAAI;IAKZ,qGAAqG;IACrG,MAAM,IAAI,IAAI;IAId,yFAAyF;IACzF,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAM/B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAM9C;;;;OAIG;IACH,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI;CAgBvF;AAED,kDAAkD;AAClD,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAG7E;AAED,+CAA+C;AAC/C,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,EAAE,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAIxF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IndicatorEngine } from '@tradecanvas/core';
|
|
2
|
+
/** What the requests read of the indicators. */
|
|
3
|
+
export type SymbolReaders = Pick<IndicatorEngine, 'getActiveIndicators' | 'getIndicatorConfig'>;
|
|
4
|
+
/** The other symbols' bars the chart holds. */
|
|
5
|
+
export interface HeldSymbols {
|
|
6
|
+
has(symbol: string): boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The other symbols the indicators read, and which of them the chart has
|
|
10
|
+
* asked its app for (`symbolSeriesRequest`) and not been given yet: each
|
|
11
|
+
* is asked for once. No DOM.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SymbolRequests {
|
|
14
|
+
private readonly readers;
|
|
15
|
+
private readonly held;
|
|
16
|
+
private readonly asked;
|
|
17
|
+
constructor(readers: SymbolReaders, held: HeldSymbols);
|
|
18
|
+
/** The symbols the indicators read, whether their bars are here or not. */
|
|
19
|
+
required(): string[];
|
|
20
|
+
/** The indicators reading `symbol`. */
|
|
21
|
+
readersOf(symbol: string): string[];
|
|
22
|
+
/** The bars of `symbol` came: it is no longer waited for. */
|
|
23
|
+
given(symbol: string): void;
|
|
24
|
+
/** A symbol no indicator reads any more may be asked for again later. */
|
|
25
|
+
forgetUnread(): void;
|
|
26
|
+
/**
|
|
27
|
+
* The symbol to ask for once for the indicator just added or changed: the
|
|
28
|
+
* one it reads, when the chart hasn't got it and hasn't asked (not those
|
|
29
|
+
* other indicators read: one whose fetch failed is asked for again only
|
|
30
|
+
* by an indicator on it). Null when there is nothing to ask.
|
|
31
|
+
*/
|
|
32
|
+
toAsk(instanceId: string): string | null;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=SymbolRequests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SymbolRequests.d.ts","sourceRoot":"","sources":["../../src/model/SymbolRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/E,gDAAgD;AAChD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,qBAAqB,GAAG,oBAAoB,CAAC,CAAC;AAEhG,+CAA+C;AAC/C,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B;AAQD;;;;GAIG;AACH,qBAAa,cAAc;IAIvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;gBAGxB,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,WAAW;IAGpC,2EAA2E;IAC3E,QAAQ,IAAI,MAAM,EAAE;IASpB,uCAAuC;IACvC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;IAOnC,6DAA6D;IAC7D,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI3B,yEAAyE;IACzE,YAAY,IAAI,IAAI;IAKpB;;;;;OAKG;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAQzC"}
|
package/dist/widget/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../LayoutSession-BWC7O5R9.cjs`),t=require(`../i18n-BsstZ9md.cjs`);let n=require(`@tradecanvas/commons`),r=require(`@tradecanvas/core`);function i(e,t,r={}){return(0,n.resampleBars)(e,t,{weekStartsOn:r.weekStartsOn??1,timeZone:r.timeZone})}function a(e){if(e.length<2)return 0;let t=[];for(let n=1;n<e.length;n++){let r=e[n].time-e[n-1].time;r>0&&t.push(r)}return t.length===0?0:(t.sort((e,t)=>e-t),t[Math.floor(t.length/2)])}var o=[{zone:`Pacific/Honolulu`,city:`Honolulu`},{zone:`America/Los_Angeles`,city:`Los Angeles`},{zone:`America/Denver`,city:`Denver`},{zone:`America/Chicago`,city:`Chicago`},{zone:`America/New_York`,city:`New York`},{zone:`America/Toronto`,city:`Toronto`},{zone:`America/Sao_Paulo`,city:`São Paulo`},{zone:`UTC`,city:`UTC`},{zone:`Europe/London`,city:`London`},{zone:`Europe/Berlin`,city:`Frankfurt`},{zone:`Europe/Paris`,city:`Paris`},{zone:`Europe/Zurich`,city:`Zurich`},{zone:`Africa/Johannesburg`,city:`Johannesburg`},{zone:`Europe/Istanbul`,city:`Istanbul`},{zone:`Europe/Moscow`,city:`Moscow`},{zone:`Asia/Dubai`,city:`Dubai`},{zone:`Asia/Kolkata`,city:`Mumbai`},{zone:`Asia/Bangkok`,city:`Bangkok`},{zone:`Asia/Ho_Chi_Minh`,city:`Ho Chi Minh City`},{zone:`Asia/Jakarta`,city:`Jakarta`},{zone:`Asia/Singapore`,city:`Singapore`},{zone:`Asia/Hong_Kong`,city:`Hong Kong`},{zone:`Asia/Shanghai`,city:`Shanghai`},{zone:`Asia/Taipei`,city:`Taipei`},{zone:`Asia/Seoul`,city:`Seoul`},{zone:`Asia/Tokyo`,city:`Tokyo`},{zone:`Australia/Sydney`,city:`Sydney`},{zone:`Pacific/Auckland`,city:`Auckland`}],s=/^-?\d+$/,c=840;function l(e){if(!s.test(e))return null;let t=Number(e);return Math.abs(t)<=c?t:null}function u(e){return!e||e===`local`?null:e===`exchange`?`exchange`:s.test(e)?l(e):(0,n.isValidTimeZone)(e)?e:null}function d(e){return e===null?`local`:String(e)}function f(e,t,r,i){let a=(0,n.offsetAt)(null,t),s=o.filter(({zone:e})=>(0,n.isValidTimeZone)(e)).map(({zone:e,city:r})=>{let i=(0,n.offsetAt)(e,t);return{value:e,label:e===`UTC`?`UTC`:`(${(0,n.tzLabel)(i)}) ${r}`,offset:i}}),c=u(e);typeof c==`number`&&s.push({value:e,label:(0,n.tzLabel)(c),offset:c}),s.sort((e,t)=>e.offset-t.offset);let l=[{value:`local`,label:`${r} (${(0,n.tzLabel)(a)})`,offset:a}];if(i){let e=(0,n.offsetAt)(i.zone&&(0,n.isValidTimeZone)(i.zone)?i.zone:`UTC`,t);l.push({value:`exchange`,label:`${i.label} (${(0,n.tzLabel)(e)})`,offset:e})}return[...l,...s]}var p=6,m=8,h=120;function g(e,t,n=`left`){let r=e.style,i=t.getBoundingClientRect();r.position=`fixed`,r.margin=`0`,r.top=r.bottom=r.left=r.right=``;let a=window.innerHeight-i.bottom-p-m,o=i.top-p-m;e.scrollHeight<=a||a>=o?(r.top=`${i.bottom+p}px`,r.bottom=`auto`,r.maxHeight=`${Math.max(h,a)}px`):(r.top=`auto`,r.bottom=`${window.innerHeight-i.top+p}px`,r.maxHeight=`${Math.max(h,o)}px`);let s=getComputedStyle(t).direction===`rtl`,c=n===`right`!==s,l=e.offsetWidth,u=c?i.right-l:i.left;r.left=`${Math.max(m,Math.min(u,window.innerWidth-l-m))}px`}var ee=700,_=class{select=null;panel=null;rows=[];active=-1;typed=``;typedAt=0;onOutside=e=>{let t=e.target;this.panel?.contains(t)||this.select?.contains(t)||this.close(!1)};onAway=()=>this.close(!1);onScroll=e=>{e.target instanceof Node&&this.panel?.contains(e.target)||this.close(!1)};watch=new MutationObserver(()=>{this.select&&!this.select.isConnected&&this.close(!1)});constructor(e){this.layer=e}isOpenFor(e){return this.select===e}owns(e){return e!==null&&(e===this.select||this.panel?.contains(e)===!0)}open(e){this.close(!1),this.select=e;let t=document.createElement(`div`);t.className=`tcw-dropdown tcw-select-menu`,t.setAttribute(`role`,`listbox`),t.id=`tcw-select-menu-${Math.random().toString(36).slice(2,9)}`;let n=e.getAttribute(`aria-label`)??e.labels?.[0]?.textContent??``;n&&t.setAttribute(`aria-label`,n.trim()),t.style.minWidth=`${e.getBoundingClientRect().width}px`,this.rows=[];for(let n of e.children)if(n instanceof HTMLOptGroupElement){let e=document.createElement(`div`);e.className=`tcw-select-group`,e.textContent=n.label,t.appendChild(e);for(let e of n.querySelectorAll(`option`))this.addRow(t,e,n.disabled)}else n instanceof HTMLOptionElement&&this.addRow(t,n,!1);t.addEventListener(`mousedown`,e=>e.preventDefault());let r=e=>this.rows.findIndex(t=>t.el.contains(e.target));t.addEventListener(`click`,e=>{let t=r(e);t>=0&&this.pick(t)}),t.addEventListener(`mousemove`,e=>{let t=r(e);t>=0&&t!==this.active&&this.enabled(t)&&this.setActive(t,!1)}),this.layer().appendChild(t),this.panel=t,g(t,e),e.setAttribute(`aria-expanded`,`true`),e.setAttribute(`aria-controls`,t.id),this.setActive(this.rows.findIndex(e=>e.option.selected)),document.addEventListener(`pointerdown`,this.onOutside,!0),window.addEventListener(`resize`,this.onAway),document.addEventListener(`scroll`,this.onScroll,{capture:!0,passive:!0}),this.watch.observe(document.documentElement,{childList:!0,subtree:!0})}close(e){let t=this.select;t&&(document.removeEventListener(`pointerdown`,this.onOutside,!0),window.removeEventListener(`resize`,this.onAway),document.removeEventListener(`scroll`,this.onScroll,{capture:!0}),this.watch.disconnect(),this.panel?.remove(),this.panel=null,this.rows=[],this.select=null,t.setAttribute(`aria-expanded`,`false`),t.removeAttribute(`aria-controls`),t.removeAttribute(`aria-activedescendant`),e&&t.isConnected&&t.focus())}key(e){if(!this.select)return!1;switch(e.key){case`ArrowDown`:return this.step(1),!0;case`ArrowUp`:return this.step(-1),!0;case`Home`:return this.setActive(this.nextEnabled(-1,1)),!0;case`End`:return this.setActive(this.nextEnabled(this.rows.length,-1)),!0;case`PageDown`:return this.step(8),!0;case`PageUp`:return this.step(-8),!0;case` `:return this.typed&&Date.now()-this.typedAt<=ee?(this.typeahead(` `),!0):(this.active>=0?this.pick(this.active):this.close(!0),!0);case`Enter`:return this.active>=0?this.pick(this.active):this.close(!0),!0;case`Escape`:return this.close(!0),!0;case`Tab`:return this.close(!1),!1;default:return e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey?(this.typeahead(e.key),!0):!1}}destroy(){this.close(!1)}addRow(e,t,n){let r=document.createElement(`div`);r.className=`tcw-select-option`,r.id=`${e.id}-${this.rows.length}`,r.setAttribute(`role`,`option`),r.setAttribute(`aria-selected`,String(t.selected)),(t.disabled||n)&&r.setAttribute(`aria-disabled`,`true`);let i=document.createElement(`span`);i.className=`tcw-select-option-text`,i.textContent=t.label||t.textContent||``,t.dir&&(i.dir=t.dir);let a=document.createElement(`span`);a.className=`tcw-select-check`,a.setAttribute(`aria-hidden`,`true`),r.append(a,i),e.appendChild(r),this.rows.push({option:t,el:r})}enabled(e){return this.rows[e]?.el.getAttribute(`aria-disabled`)!==`true`}nextEnabled(e,t){for(let n=e+t;n>=0&&n<this.rows.length;n+=t)if(this.enabled(n))return n;return-1}step(e){let t=e>0?1:-1,n=this.active;for(let r=0;r<Math.abs(e);r++){let e=this.nextEnabled(n,t);if(e<0)break;n=e}n>=0&&this.setActive(n)}setActive(e,t=!0){this.rows[this.active]?.el.classList.remove(`tcw-active`),this.active=e;let n=this.rows[e];n&&(n.el.classList.add(`tcw-active`),this.select?.setAttribute(`aria-activedescendant`,n.el.id),t&&n.el.scrollIntoView?.({block:`nearest`}))}typeahead(e){let t=Date.now();this.typed=t-this.typedAt>ee?e.toLowerCase():this.typed+e.toLowerCase(),this.typedAt=t;let n=e=>this.enabled(e)&&(this.rows[e].el.textContent??``).trim().toLowerCase().startsWith(this.typed),r=this.typed.length===1?this.active+1:Math.max(0,this.active);for(let e=0;e<this.rows.length;e++){let t=(r+e)%this.rows.length;if(n(t)){this.setActive(t);return}}}pick(e){let t=this.select,n=this.rows[e];if(!t||!n||!this.enabled(e))return;let r=!n.option.selected;n.option.selected=!0,this.close(!0),r&&(t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}},v=42,y=7,b=new Set([`US`,`CA`,`MX`,`BR`,`JP`,`KR`,`TW`,`HK`,`IL`,`PH`,`IN`,`ZA`,`AU`,`TH`,`SA`,`PE`,`CO`]);function x(e){try{let t=new Intl.Locale(e),n=t.getWeekInfo?.()??t.weekInfo;return n?n.firstDay===7?0:1:+!b.has(t.maximize().region??``)}catch{return 1}}function te(e,t,n){let r=(new Date(Date.UTC(e,t,1)).getUTCDay()-n+y)%y,i=[];for(let n=0;n<v;n++){let a=new Date(Date.UTC(e,t,1-r+n));i.push({year:a.getUTCFullYear(),month:a.getUTCMonth(),day:a.getUTCDate()})}return i}var ne=e=>String(e).padStart(2,`0`),S=e=>`${String(e.year).padStart(4,`0`)}-${ne(e.month+1)}-${ne(e.day)}`;function re(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e??``);return t?{year:Number(t[1]),month:Number(t[2])-1,day:Number(t[3])}:null}function ie(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth(),day:e.getDate()}}function ae(e,t){let n=new Date(Date.UTC(e.year,e.month,e.day+t));return{year:n.getUTCFullYear(),month:n.getUTCMonth(),day:n.getUTCDate()}}var oe=class{element;grid;titleEl;chosen=``;limits={};today=S(ie());view={year:0,month:0};focusDay=ie();constructor(e,t,n){this.locale=t,this.onPick=n;let r=document.createElement(`div`);r.className=`tcw-calendar`;let i=document.createElement(`div`);i.className=`tcw-calendar-head`;let a=document.createElement(`div`);a.className=`tcw-calendar-title`,a.setAttribute(`aria-live`,`polite`),i.append(this.navButton(e.prevMonth,-1),a,this.navButton(e.nextMonth,1));let o=document.createElement(`div`);o.className=`tcw-calendar-weekdays`,o.setAttribute(`aria-hidden`,`true`);let s=x(t),c=new Intl.DateTimeFormat(t,{weekday:`narrow`,timeZone:`UTC`});for(let e=0;e<y;e++){let t=document.createElement(`span`);t.className=`tcw-calendar-weekday`,t.textContent=c.format(new Date(Date.UTC(2023,0,1+(s+e)%y))),o.appendChild(t)}let l=document.createElement(`div`);l.className=`tcw-calendar-grid`,l.setAttribute(`role`,`grid`),l.addEventListener(`keydown`,e=>this.onKey(e)),l.addEventListener(`click`,e=>{let t=e.target.closest(`.tcw-calendar-day`);t&&!t.disabled&&t.dataset.date&&this.pick(t.dataset.date)});let u=document.createElement(`div`);u.className=`tcw-calendar-foot`;let d=document.createElement(`button`);d.type=`button`,d.className=`tcw-calendar-today`,d.textContent=e.today,d.addEventListener(`click`,()=>this.pick(this.today)),u.appendChild(d),r.append(i,o,l,u),this.element=r,this.grid=l,this.titleEl=a}show(e,t={}){this.chosen=e,this.limits=t,this.today=re(t.today)?t.today:S(ie());let n=this.clamp(re(e)??re(this.today));this.focusDay=n,this.view={year:n.year,month:n.month},this.render()}focusGrid(){this.grid.querySelector(`[tabindex="0"]`)?.focus()}navButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-calendar-nav`,n.setAttribute(`aria-label`,e),n.innerHTML=t<0?`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5L5.5 8l4.5 4.5"/></svg>`:`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5L10.5 8 6 12.5"/></svg>`,n.addEventListener(`click`,()=>this.turn(t)),n}turn(e){let t=new Date(Date.UTC(this.view.year,this.view.month+e,1));this.view={year:t.getUTCFullYear(),month:t.getUTCMonth()};let n=new Date(Date.UTC(this.view.year,this.view.month+1,0)).getUTCDate();this.focusDay=this.clamp({...this.view,day:Math.min(this.focusDay.day,n)}),this.view={year:this.focusDay.year,month:this.focusDay.month},this.render()}clamp(e){let t=S(e),n=re(this.limits.min),r=re(this.limits.max);return n&&t<S(n)?n:r&&t>S(r)?r:e}allowed(e){let{min:t,max:n}=this.limits;return!(t&&e<t)&&!(n&&e>n)}render(){let e=this.locale;this.titleEl.textContent=new Intl.DateTimeFormat(e,{month:`long`,year:`numeric`,timeZone:`UTC`}).format(new Date(Date.UTC(this.view.year,this.view.month,1)));let t=this.today,n=S(this.focusDay),r=new Intl.DateTimeFormat(e,{dateStyle:`full`,timeZone:`UTC`});this.grid.textContent=``;let i=null;for(let[a,o]of te(this.view.year,this.view.month,x(e)).entries()){a%y===0&&(i=document.createElement(`div`),i.className=`tcw-calendar-week`,i.setAttribute(`role`,`row`),this.grid.appendChild(i));let e=S(o),s=document.createElement(`button`);s.type=`button`,s.className=`tcw-calendar-day`,s.dataset.date=e,s.setAttribute(`role`,`gridcell`),s.textContent=String(o.day),s.setAttribute(`aria-label`,r.format(new Date(Date.UTC(o.year,o.month,o.day)))),s.setAttribute(`aria-selected`,String(e===this.chosen)),s.tabIndex=e===n?0:-1,o.month!==this.view.month&&s.classList.add(`tcw-outside`),e===t&&s.classList.add(`tcw-today`),this.allowed(e)||(s.disabled=!0),i?.appendChild(s)}}onKey(e){let t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-y,ArrowDown:y},n=this.element.isConnected&&getComputedStyle(this.element).direction===`rtl`;if(e.key in t){let r=n&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)?-t[e.key]:t[e.key];this.moveFocus(ae(this.focusDay,r))}else if(e.key===`PageUp`||e.key===`PageDown`)this.turn(e.key===`PageUp`?-1:1),this.focusGrid();else if(e.key===`Home`||e.key===`End`){let t=new Date(Date.UTC(this.view.year,this.view.month+1,0)).getUTCDate();this.moveFocus({...this.view,day:e.key===`Home`?1:t})}else if(e.key===`Enter`||e.key===` `)this.pick(S(this.focusDay));else return;e.preventDefault()}moveFocus(e){let t=this.clamp(e);this.focusDay=t,(t.year!==this.view.year||t.month!==this.view.month)&&(this.view={year:t.year,month:t.month}),this.render(),this.focusGrid()}pick(e){this.allowed(e)&&this.onPick(e)}},se=class{input=null;view=null;onOutside=e=>{let t=e.target;this.view?.element.contains(t)||this.input?.contains(t)||this.close(!1)};onAway=()=>this.close(!1);onScroll=e=>{e.target instanceof Node&&this.view?.element.contains(e.target)||this.close(!1)};watch=new MutationObserver(()=>{this.input&&!this.input.isConnected&&this.close(!1)});constructor(e,t,n){this.layer=e,this.labels=t,this.locale=n}isOpenFor(e){return this.input===e}owns(e){return e!==null&&(e===this.input||this.view?.element.contains(e)===!0)}open(e){this.close(!1),this.input=e;let t=new oe(this.labels(),this.locale(),e=>this.pick(e));t.show(e.value,{min:e.min||void 0,max:e.max||void 0});let n=t.element;n.setAttribute(`role`,`dialog`);let r=e.getAttribute(`aria-label`)??e.labels?.[0]?.textContent??``;r&&n.setAttribute(`aria-label`,r.trim()),n.addEventListener(`mousedown`,e=>{e.target.closest(`button`)||e.preventDefault()}),n.addEventListener(`keydown`,e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),this.close(!0))}),this.view=t,this.layer().appendChild(n),g(n,e),document.addEventListener(`pointerdown`,this.onOutside,!0),window.addEventListener(`resize`,this.onAway),document.addEventListener(`scroll`,this.onScroll,{capture:!0,passive:!0}),this.watch.observe(document.documentElement,{childList:!0,subtree:!0})}close(e){let t=this.input;t&&(document.removeEventListener(`pointerdown`,this.onOutside,!0),window.removeEventListener(`resize`,this.onAway),document.removeEventListener(`scroll`,this.onScroll,{capture:!0}),this.watch.disconnect(),this.view?.element.remove(),this.view=null,this.input=null,e&&t.isConnected&&t.focus())}focusGrid(){this.view?.focusGrid()}destroy(){this.close(!1)}pick(e){let t=this.input;if(!t)return;let n=t.value!==e;t.value=e,this.close(!0),n&&(t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}},ce=()=>typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches,le=()=>typeof CSS>`u`||typeof CSS.supports!=`function`||CSS.supports(`selector(::-webkit-calendar-picker-indicator)`);function ue(e){if(!(e instanceof Element))return null;let t=e.closest(`select`);return!t||t.matches(`:disabled`)||t.multiple||t.size>1?null:t}function de(e){return!(e instanceof HTMLInputElement)||e.type!==`date`||e.dataset.tcwCalendar===`inline`||e.matches(`:disabled`)||e.readOnly?null:e}function fe(e,t){let n=new _(t.layer),r=new se(t.layer,t.labels,t.locale),i=t.native??ce,a=t.calendar??le,o=new WeakSet,s=e=>o.has(e)?!1:(o.add(e),!0),c=e=>{if(e.button!==0||i()||!s(e))return;let t=ue(e.target);if(t){if(e.preventDefault(),n.isOpenFor(t)){n.close(!0);return}t.focus(),n.open(t)}},l=e=>{if(i()||!a()||!s(e))return;let t=de(e.target);t&&(e.preventDefault(),r.isOpenFor(t)||r.open(t))},u=e=>{if(i()||!s(e))return;let t=ue(e.target);if(t){if(n.isOpenFor(t)){n.key(e)&&(e.preventDefault(),e.stopPropagation());return}(e.key===`Enter`||e.key===` `||e.altKey&&(e.key===`ArrowDown`||e.key===`ArrowUp`)||e.key===`F4`)&&(e.preventDefault(),e.stopPropagation(),n.open(t));return}let o=de(e.target);!o||!a()||(e.key===`Escape`&&r.isOpenFor(o)?(e.preventDefault(),e.stopPropagation(),r.close(!0)):(e.altKey&&e.key===`ArrowDown`||e.key===`F4`)&&(e.preventDefault(),r.isOpenFor(o)||r.open(o),r.focusGrid()))},d=e=>{if(!s(e))return;let t=e.target instanceof Node?e.target:null,i=e.relatedTarget instanceof Node?e.relatedTarget:null;n.owns(t)&&!n.owns(i)&&n.close(!1),r.owns(t)&&!r.owns(i)&&r.close(!1)};for(let t of e)t.addEventListener(`mousedown`,c,!0),t.addEventListener(`click`,l,!0),t.addEventListener(`keydown`,u,!0),t.addEventListener(`focusout`,d,!0);return()=>{for(let t of e)t.removeEventListener(`mousedown`,c,!0),t.removeEventListener(`click`,l,!0),t.removeEventListener(`keydown`,u,!0),t.removeEventListener(`focusout`,d,!0);n.destroy(),r.destroy()}}var pe=[{label:`Candlestick`,value:`candlestick`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Bar`,value:`bar`},{label:`Heikin-Ashi`,value:`heikinAshi`},{label:`Hollow Candle`,value:`hollowCandle`},{label:`Baseline`,value:`baseline`},{label:`Volume Candles`,value:`volumeCandles`},{label:`Equivolume`,value:`equivolume`},{label:`HLC Area`,value:`hlcArea`},{label:`Step Line`,value:`stepLine`},{label:`Line + Markers`,value:`lineWithMarkers`},{label:`High-Low`,value:`hiLo`},{label:`Renko`,value:`renko`},{label:`Line Break`,value:`lineBreak`},{label:`Kagi`,value:`kagi`},{label:`Point & Figure`,value:`pointAndFigure`},{label:`Range Bars`,value:`rangeBars`}],me=[{label:`Lines`,section:`lines`,tools:[{label:`Trend Line`,value:`trendLine`},{label:`Ray`,value:`ray`},{label:`Extended Line`,value:`extendedLine`},{label:`Info Line`,value:`infoLine`},{label:`Trend Angle`,value:`trendAngle`}]},{label:`Horizontal/Vertical`,section:`lines`,tools:[{label:`Horizontal Line`,value:`horizontalLine`},{label:`Horizontal Ray`,value:`horizontalRay`},{label:`Vertical Line`,value:`verticalLine`},{label:`Cross Line`,value:`crossLine`}]},{label:`Channels`,section:`lines`,tools:[{label:`Parallel Channel`,value:`parallelChannel`},{label:`Regression Channel`,value:`regressionChannel`}]},{label:`Fibonacci`,section:`fibonacci`,tools:[{label:`Fib Retracement`,value:`fibRetracement`},{label:`Fib Extension`,value:`fibExtension`},{label:`Fib Channel`,value:`fibChannel`},{label:`Fib Time Zones`,value:`fibTimeZones`},{label:`Fib Speed Resistance Fan`,value:`fibSpeedResistanceFan`},{label:`Fib Speed Resistance Arcs`,value:`fibArcs`},{label:`Fib Circles`,value:`fibCircles`},{label:`Fib Spiral`,value:`fibSpiral`},{label:`Fib Wedge`,value:`fibWedge`}]},{label:`Gann & Pitchforks`,section:`fibonacci`,tools:[{label:`Pitchfork`,value:`pitchfork`},{label:`Schiff Pitchfork`,value:`schiffPitchfork`},{label:`Modified Schiff Pitchfork`,value:`modifiedSchiffPitchfork`},{label:`Gann Fan`,value:`gannFan`},{label:`Gann Box`,value:`gannBox`},{label:`Gann Square`,value:`gannSquare`},{label:`Pitchfan`,value:`pitchfan`}]},{label:`Cycles`,section:`fibonacci`,tools:[{label:`Cyclic Lines`,value:`cyclicLines`},{label:`Time Cycles`,value:`timeCycles`},{label:`Sine Line`,value:`sineLine`}]},{label:`Patterns`,section:`patterns`,tools:[{label:`XABCD Pattern`,value:`xabcdPattern`},{label:`ABCD Pattern`,value:`abcdPattern`},{label:`Head and Shoulders`,value:`headAndShoulders`},{label:`Cypher Pattern`,value:`cypherPattern`},{label:`Three Drives Pattern`,value:`threeDrives`}]},{label:`Elliott Waves`,section:`patterns`,tools:[{label:`Elliott Wave`,value:`elliottWave`},{label:`Elliott Impulse Wave`,value:`elliottImpulse`},{label:`Elliott Correction Wave`,value:`elliottCorrection`},{label:`Elliott Triangle Wave`,value:`elliottTriangle`},{label:`Elliott Double Combo Wave`,value:`elliottDoubleCombo`},{label:`Elliott Triple Combo Wave`,value:`elliottTripleCombo`}]},{label:`Forecasting`,section:`forecasting`,tools:[{label:`Long/Short Position`,value:`riskReward`},{label:`Anchored VWAP`,value:`anchoredVWAP`},{label:`Fixed Range Volume Profile`,value:`volumeProfileRange`},{label:`Forecast`,value:`forecast`},{label:`Projection`,value:`projection`},{label:`Bars Pattern`,value:`barsPattern`}]},{label:`Measure`,section:`forecasting`,tools:[{label:`Price Range`,value:`priceRange`},{label:`Date Range`,value:`dateRange`},{label:`Date and Price Range`,value:`dateAndPriceRange`},{label:`Measure`,value:`measure`}]},{label:`Shapes`,section:`annotation`,tools:[{label:`Rectangle`,value:`rectangle`},{label:`Circle`,value:`circle`},{label:`Ellipse`,value:`ellipse`},{label:`Triangle`,value:`triangle`},{label:`Polyline`,value:`polyline`},{label:`Curve`,value:`curve`},{label:`Arc`,value:`arc`}]},{label:`Brushes`,section:`annotation`,tools:[{label:`Brush`,value:`brush`},{label:`Highlighter`,value:`highlighter`},{label:`Path`,value:`path`}]},{label:`Annotation`,section:`annotation`,tools:[{label:`Text`,value:`text`},{label:`Price Label`,value:`priceLabel`},{label:`Arrow`,value:`arrow`},{label:`Note`,value:`note`},{label:`Callout`,value:`callout`},{label:`Flag Mark`,value:`flag`},{label:`Arrow Mark`,value:`arrowMark`},{label:`Icon`,value:`icon`},{label:`Signpost`,value:`signpost`},{label:`Balloon`,value:`balloon`},{label:`Anchored Text`,value:`anchoredText`},{label:`Anchored Note`,value:`anchoredNote`}]}],he=[`BTCUSDT`,`ETHUSDT`,`SOLUSDT`,`BNBUSDT`],ge={gridVisible:!0,volumeVisible:!0,volumeProfileVisible:!1,marketProfileVisible:!1,marketProfileSplit:!1,marketProfileLetters:!1,marketProfileBuckets:48,marketProfileOpacity:.32,depthHeatmapVisible:!1,depthHeatmapOpacity:.7,sessionShadingVisible:!1,pivotMarkersVisible:!1,pivotStrength:5,pivotStructureLabels:!1,periodLevelsVisible:!1,periodLevelsPeriod:`day`,legendVisible:!0,barCountdown:!0,indicatorValueLabels:!1,alignAxisLabels:!0,logScale:!1,scaleMode:`regular`,autoScale:!0,invertScale:!1,leftPriceScale:!1,crosshairMode:`magnet`,numberLocale:`en-US`,timezone:`local`,highLowLines:!1,mainSeriesVisible:!0,extendedHours:!0,chartTypeOptions:{}},C=(e,...t)=>({label:e,keys:t}),w=(e,t,n={})=>({label:e,keys:[t],auto:n}),T=e=>({hint:e}),_e={from:`panes.titleColor`},ve={title:`settings.section.lastPrice`,rows:[C(`settings.priceLine`,`lastPrice.visible`),C(`settings.up`,`lastPrice.upColor`),C(`settings.down`,`lastPrice.downColor`),C(`drawingSettings.lineStyle`,`lastPrice.style`),C(`drawingSettings.lineWidth`,`lastPrice.width`)]},ye={title:`settings.volume`,rows:[C(`settings.up`,`volume.upColor`),C(`settings.down`,`volume.downColor`)]},be={title:`settings.highLowLines`,rows:[w(`drawingSettings.color`,`highLow.color`,_e)]},xe=[ve,ye,be],Se=[C(`settings.legendText`,`legend.textColor`),C(`settings.legendLabels`,`legend.labelColor`)],Ce=[...Se,C(`settings.paneTitles`,`panes.titleColor`)],we=[C(`drawingSettings.text`,`axis.price.textColor`,`axis.time.textColor`),C(`settings.scaleLines`,`axis.price.lineColor`,`axis.time.lineColor`)],Te=[{title:`settings.section.background`,rows:[C(`settings.background`,`background.color`),C(`settings.paneBackground`,`panes.background`),C(`settings.paneSeparator`,`panes.separatorColor`),w(`settings.watermark`,`watermark.color`,_e)]},{title:`settings.gridLines`,rows:[C(`settings.horizontal`,`grid.horizontal.visible`),C(`settings.vertical`,`grid.vertical.visible`),C(`drawingSettings.color`,`grid.horizontal.color`,`grid.vertical.color`),C(`drawingSettings.lineStyle`,`grid.horizontal.style`,`grid.vertical.style`),C(`drawingSettings.lineWidth`,`grid.horizontal.width`,`grid.vertical.width`)]},{title:`settings.crosshairMode`,rows:[C(`settings.horizontal`,`crosshair.horizontal.visible`),C(`settings.vertical`,`crosshair.vertical.visible`),C(`drawingSettings.color`,`crosshair.horizontal.color`,`crosshair.vertical.color`),C(`drawingSettings.lineStyle`,`crosshair.horizontal.style`,`crosshair.vertical.style`),C(`drawingSettings.lineWidth`,`crosshair.horizontal.width`,`crosshair.vertical.width`),C(`settings.labelBackground`,`crosshair.labelBackground`),C(`settings.labelText`,`crosshair.labelTextColor`)]},{title:`settings.sessionBreaks`,rows:[w(`drawingSettings.color`,`sessionBreaks.color`,{from:`axis.price.lineColor`}),w(`drawingSettings.lineStyle`,`sessionBreaks.style`),w(`drawingSettings.lineWidth`,`sessionBreaks.width`)]},{title:`objects.drawings`,rows:[w(`settings.handles`,`drawings.handleColor`,T(`#ffffff`))]}],Ee=[{title:`settings.section.orders`,trading:!0,rows:[w(`ticket.buy`,`trading.buyColor`,T(n.DEFAULT_TRADING_CONFIG.orderColors?.buy)),w(`ticket.sell`,`trading.sellColor`,T(n.DEFAULT_TRADING_CONFIG.orderColors?.sell)),w(`settings.profit`,`trading.profitColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.profit)),w(`settings.loss`,`trading.lossColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.loss)),w(`account.entry`,`trading.entryColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.entry))]},{title:`settings.section.signals`,rows:[w(`account.long`,`markers.longColor`,T(n.DEFAULT_SIGNAL_STYLE.longColor)),w(`account.short`,`markers.shortColor`,T(n.DEFAULT_SIGNAL_STYLE.shortColor)),w(`markers.neutral`,`markers.neutralColor`,T(n.DEFAULT_SIGNAL_STYLE.neutralColor))]},{title:`settings.section.tradeZones`,rows:[w(`settings.profit`,`tradeZones.profitColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.profitColor)),w(`settings.loss`,`tradeZones.lossColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.lossColor)),w(`settings.openTrade`,`tradeZones.activeColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.activeColor))]}],De={upColor:`settings.up`,downColor:`settings.down`,wickUpColor:`settings.upWick`,wickDownColor:`settings.downWick`,color:`drawingSettings.color`,lineColor:`drawingSettings.color`,lineWidth:`drawingSettings.lineWidth`,topColor:`settings.areaTop`,bottomColor:`settings.areaBottom`},Oe=new Set([`candlestick`,`heikinAshi`,`volumeCandles`,`equivolume`]);function ke(e){let t=`series.${e}.`;return Object.keys(n.CHART_STYLE_KEYS).filter(e=>e.startsWith(t)).map(n=>{let r=n.slice(t.length),i=De[r]??`drawingSettings.color`;return Oe.has(e)&&r===`upColor`&&(i=`settings.upBody`),Oe.has(e)&&r===`downColor`&&(i=`settings.downBody`),e===`baseline`&&r===`upColor`&&(i=`settings.aboveBase`),e===`baseline`&&r===`downColor`&&(i=`settings.belowBase`),C(i,n)})}var E=[...new Set([...Object.keys(n.CHART_STYLE_KEYS).filter(e=>e.startsWith(`series.`)),...[...xe,...Te,...Ee].flatMap(e=>e.rows.flatMap(e=>e.keys)),...[...Ce,...we].flatMap(e=>e.keys)])],Ae=`/* === TradeCanvas Widget — Premium Styles === */
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../LayoutSession-D7S6GZgJ.cjs`),t=require(`../i18n-BsstZ9md.cjs`);let n=require(`@tradecanvas/commons`),r=require(`@tradecanvas/core`);function i(e,t,r={}){return(0,n.resampleBars)(e,t,{weekStartsOn:r.weekStartsOn??1,timeZone:r.timeZone})}function a(e){if(e.length<2)return 0;let t=[];for(let n=1;n<e.length;n++){let r=e[n].time-e[n-1].time;r>0&&t.push(r)}return t.length===0?0:(t.sort((e,t)=>e-t),t[Math.floor(t.length/2)])}var o=[{zone:`Pacific/Honolulu`,city:`Honolulu`},{zone:`America/Los_Angeles`,city:`Los Angeles`},{zone:`America/Denver`,city:`Denver`},{zone:`America/Chicago`,city:`Chicago`},{zone:`America/New_York`,city:`New York`},{zone:`America/Toronto`,city:`Toronto`},{zone:`America/Sao_Paulo`,city:`São Paulo`},{zone:`UTC`,city:`UTC`},{zone:`Europe/London`,city:`London`},{zone:`Europe/Berlin`,city:`Frankfurt`},{zone:`Europe/Paris`,city:`Paris`},{zone:`Europe/Zurich`,city:`Zurich`},{zone:`Africa/Johannesburg`,city:`Johannesburg`},{zone:`Europe/Istanbul`,city:`Istanbul`},{zone:`Europe/Moscow`,city:`Moscow`},{zone:`Asia/Dubai`,city:`Dubai`},{zone:`Asia/Kolkata`,city:`Mumbai`},{zone:`Asia/Bangkok`,city:`Bangkok`},{zone:`Asia/Ho_Chi_Minh`,city:`Ho Chi Minh City`},{zone:`Asia/Jakarta`,city:`Jakarta`},{zone:`Asia/Singapore`,city:`Singapore`},{zone:`Asia/Hong_Kong`,city:`Hong Kong`},{zone:`Asia/Shanghai`,city:`Shanghai`},{zone:`Asia/Taipei`,city:`Taipei`},{zone:`Asia/Seoul`,city:`Seoul`},{zone:`Asia/Tokyo`,city:`Tokyo`},{zone:`Australia/Sydney`,city:`Sydney`},{zone:`Pacific/Auckland`,city:`Auckland`}],s=/^-?\d+$/,c=840;function l(e){if(!s.test(e))return null;let t=Number(e);return Math.abs(t)<=c?t:null}function u(e){return!e||e===`local`?null:e===`exchange`?`exchange`:s.test(e)?l(e):(0,n.isValidTimeZone)(e)?e:null}function d(e){return e===null?`local`:String(e)}function f(e,t,r,i){let a=(0,n.offsetAt)(null,t),s=o.filter(({zone:e})=>(0,n.isValidTimeZone)(e)).map(({zone:e,city:r})=>{let i=(0,n.offsetAt)(e,t);return{value:e,label:e===`UTC`?`UTC`:`(${(0,n.tzLabel)(i)}) ${r}`,offset:i}}),c=u(e);typeof c==`number`&&s.push({value:e,label:(0,n.tzLabel)(c),offset:c}),s.sort((e,t)=>e.offset-t.offset);let l=[{value:`local`,label:`${r} (${(0,n.tzLabel)(a)})`,offset:a}];if(i){let e=(0,n.offsetAt)(i.zone&&(0,n.isValidTimeZone)(i.zone)?i.zone:`UTC`,t);l.push({value:`exchange`,label:`${i.label} (${(0,n.tzLabel)(e)})`,offset:e})}return[...l,...s]}var p=6,m=8,h=120;function g(e,t,n=`left`){let r=e.style,i=t.getBoundingClientRect();r.position=`fixed`,r.margin=`0`,r.top=r.bottom=r.left=r.right=``;let a=window.innerHeight-i.bottom-p-m,o=i.top-p-m;e.scrollHeight<=a||a>=o?(r.top=`${i.bottom+p}px`,r.bottom=`auto`,r.maxHeight=`${Math.max(h,a)}px`):(r.top=`auto`,r.bottom=`${window.innerHeight-i.top+p}px`,r.maxHeight=`${Math.max(h,o)}px`);let s=getComputedStyle(t).direction===`rtl`,c=n===`right`!==s,l=e.offsetWidth,u=c?i.right-l:i.left;r.left=`${Math.max(m,Math.min(u,window.innerWidth-l-m))}px`}var ee=700,_=class{select=null;panel=null;rows=[];active=-1;typed=``;typedAt=0;onOutside=e=>{let t=e.target;this.panel?.contains(t)||this.select?.contains(t)||this.close(!1)};onAway=()=>this.close(!1);onScroll=e=>{e.target instanceof Node&&this.panel?.contains(e.target)||this.close(!1)};watch=new MutationObserver(()=>{this.select&&!this.select.isConnected&&this.close(!1)});constructor(e){this.layer=e}isOpenFor(e){return this.select===e}owns(e){return e!==null&&(e===this.select||this.panel?.contains(e)===!0)}open(e){this.close(!1),this.select=e;let t=document.createElement(`div`);t.className=`tcw-dropdown tcw-select-menu`,t.setAttribute(`role`,`listbox`),t.id=`tcw-select-menu-${Math.random().toString(36).slice(2,9)}`;let n=e.getAttribute(`aria-label`)??e.labels?.[0]?.textContent??``;n&&t.setAttribute(`aria-label`,n.trim()),t.style.minWidth=`${e.getBoundingClientRect().width}px`,this.rows=[];for(let n of e.children)if(n instanceof HTMLOptGroupElement){let e=document.createElement(`div`);e.className=`tcw-select-group`,e.textContent=n.label,t.appendChild(e);for(let e of n.querySelectorAll(`option`))this.addRow(t,e,n.disabled)}else n instanceof HTMLOptionElement&&this.addRow(t,n,!1);t.addEventListener(`mousedown`,e=>e.preventDefault());let r=e=>this.rows.findIndex(t=>t.el.contains(e.target));t.addEventListener(`click`,e=>{let t=r(e);t>=0&&this.pick(t)}),t.addEventListener(`mousemove`,e=>{let t=r(e);t>=0&&t!==this.active&&this.enabled(t)&&this.setActive(t,!1)}),this.layer().appendChild(t),this.panel=t,g(t,e),e.setAttribute(`aria-expanded`,`true`),e.setAttribute(`aria-controls`,t.id),this.setActive(this.rows.findIndex(e=>e.option.selected)),document.addEventListener(`pointerdown`,this.onOutside,!0),window.addEventListener(`resize`,this.onAway),document.addEventListener(`scroll`,this.onScroll,{capture:!0,passive:!0}),this.watch.observe(document.documentElement,{childList:!0,subtree:!0})}close(e){let t=this.select;t&&(document.removeEventListener(`pointerdown`,this.onOutside,!0),window.removeEventListener(`resize`,this.onAway),document.removeEventListener(`scroll`,this.onScroll,{capture:!0}),this.watch.disconnect(),this.panel?.remove(),this.panel=null,this.rows=[],this.select=null,t.setAttribute(`aria-expanded`,`false`),t.removeAttribute(`aria-controls`),t.removeAttribute(`aria-activedescendant`),e&&t.isConnected&&t.focus())}key(e){if(!this.select)return!1;switch(e.key){case`ArrowDown`:return this.step(1),!0;case`ArrowUp`:return this.step(-1),!0;case`Home`:return this.setActive(this.nextEnabled(-1,1)),!0;case`End`:return this.setActive(this.nextEnabled(this.rows.length,-1)),!0;case`PageDown`:return this.step(8),!0;case`PageUp`:return this.step(-8),!0;case` `:return this.typed&&Date.now()-this.typedAt<=ee?(this.typeahead(` `),!0):(this.active>=0?this.pick(this.active):this.close(!0),!0);case`Enter`:return this.active>=0?this.pick(this.active):this.close(!0),!0;case`Escape`:return this.close(!0),!0;case`Tab`:return this.close(!1),!1;default:return e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey?(this.typeahead(e.key),!0):!1}}destroy(){this.close(!1)}addRow(e,t,n){let r=document.createElement(`div`);r.className=`tcw-select-option`,r.id=`${e.id}-${this.rows.length}`,r.setAttribute(`role`,`option`),r.setAttribute(`aria-selected`,String(t.selected)),(t.disabled||n)&&r.setAttribute(`aria-disabled`,`true`);let i=document.createElement(`span`);i.className=`tcw-select-option-text`,i.textContent=t.label||t.textContent||``,t.dir&&(i.dir=t.dir);let a=document.createElement(`span`);a.className=`tcw-select-check`,a.setAttribute(`aria-hidden`,`true`),r.append(a,i),e.appendChild(r),this.rows.push({option:t,el:r})}enabled(e){return this.rows[e]?.el.getAttribute(`aria-disabled`)!==`true`}nextEnabled(e,t){for(let n=e+t;n>=0&&n<this.rows.length;n+=t)if(this.enabled(n))return n;return-1}step(e){let t=e>0?1:-1,n=this.active;for(let r=0;r<Math.abs(e);r++){let e=this.nextEnabled(n,t);if(e<0)break;n=e}n>=0&&this.setActive(n)}setActive(e,t=!0){this.rows[this.active]?.el.classList.remove(`tcw-active`),this.active=e;let n=this.rows[e];n&&(n.el.classList.add(`tcw-active`),this.select?.setAttribute(`aria-activedescendant`,n.el.id),t&&n.el.scrollIntoView?.({block:`nearest`}))}typeahead(e){let t=Date.now();this.typed=t-this.typedAt>ee?e.toLowerCase():this.typed+e.toLowerCase(),this.typedAt=t;let n=e=>this.enabled(e)&&(this.rows[e].el.textContent??``).trim().toLowerCase().startsWith(this.typed),r=this.typed.length===1?this.active+1:Math.max(0,this.active);for(let e=0;e<this.rows.length;e++){let t=(r+e)%this.rows.length;if(n(t)){this.setActive(t);return}}}pick(e){let t=this.select,n=this.rows[e];if(!t||!n||!this.enabled(e))return;let r=!n.option.selected;n.option.selected=!0,this.close(!0),r&&(t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}},v=42,y=7,b=new Set([`US`,`CA`,`MX`,`BR`,`JP`,`KR`,`TW`,`HK`,`IL`,`PH`,`IN`,`ZA`,`AU`,`TH`,`SA`,`PE`,`CO`]);function x(e){try{let t=new Intl.Locale(e),n=t.getWeekInfo?.()??t.weekInfo;return n?n.firstDay===7?0:1:+!b.has(t.maximize().region??``)}catch{return 1}}function te(e,t,n){let r=(new Date(Date.UTC(e,t,1)).getUTCDay()-n+y)%y,i=[];for(let n=0;n<v;n++){let a=new Date(Date.UTC(e,t,1-r+n));i.push({year:a.getUTCFullYear(),month:a.getUTCMonth(),day:a.getUTCDate()})}return i}var ne=e=>String(e).padStart(2,`0`),S=e=>`${String(e.year).padStart(4,`0`)}-${ne(e.month+1)}-${ne(e.day)}`;function re(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e??``);return t?{year:Number(t[1]),month:Number(t[2])-1,day:Number(t[3])}:null}function ie(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth(),day:e.getDate()}}function ae(e,t){let n=new Date(Date.UTC(e.year,e.month,e.day+t));return{year:n.getUTCFullYear(),month:n.getUTCMonth(),day:n.getUTCDate()}}var oe=class{element;grid;titleEl;chosen=``;limits={};today=S(ie());view={year:0,month:0};focusDay=ie();constructor(e,t,n){this.locale=t,this.onPick=n;let r=document.createElement(`div`);r.className=`tcw-calendar`;let i=document.createElement(`div`);i.className=`tcw-calendar-head`;let a=document.createElement(`div`);a.className=`tcw-calendar-title`,a.setAttribute(`aria-live`,`polite`),i.append(this.navButton(e.prevMonth,-1),a,this.navButton(e.nextMonth,1));let o=document.createElement(`div`);o.className=`tcw-calendar-weekdays`,o.setAttribute(`aria-hidden`,`true`);let s=x(t),c=new Intl.DateTimeFormat(t,{weekday:`narrow`,timeZone:`UTC`});for(let e=0;e<y;e++){let t=document.createElement(`span`);t.className=`tcw-calendar-weekday`,t.textContent=c.format(new Date(Date.UTC(2023,0,1+(s+e)%y))),o.appendChild(t)}let l=document.createElement(`div`);l.className=`tcw-calendar-grid`,l.setAttribute(`role`,`grid`),l.addEventListener(`keydown`,e=>this.onKey(e)),l.addEventListener(`click`,e=>{let t=e.target.closest(`.tcw-calendar-day`);t&&!t.disabled&&t.dataset.date&&this.pick(t.dataset.date)});let u=document.createElement(`div`);u.className=`tcw-calendar-foot`;let d=document.createElement(`button`);d.type=`button`,d.className=`tcw-calendar-today`,d.textContent=e.today,d.addEventListener(`click`,()=>this.pick(this.today)),u.appendChild(d),r.append(i,o,l,u),this.element=r,this.grid=l,this.titleEl=a}show(e,t={}){this.chosen=e,this.limits=t,this.today=re(t.today)?t.today:S(ie());let n=this.clamp(re(e)??re(this.today));this.focusDay=n,this.view={year:n.year,month:n.month},this.render()}focusGrid(){this.grid.querySelector(`[tabindex="0"]`)?.focus()}navButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-calendar-nav`,n.setAttribute(`aria-label`,e),n.innerHTML=t<0?`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5L5.5 8l4.5 4.5"/></svg>`:`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5L10.5 8 6 12.5"/></svg>`,n.addEventListener(`click`,()=>this.turn(t)),n}turn(e){let t=new Date(Date.UTC(this.view.year,this.view.month+e,1));this.view={year:t.getUTCFullYear(),month:t.getUTCMonth()};let n=new Date(Date.UTC(this.view.year,this.view.month+1,0)).getUTCDate();this.focusDay=this.clamp({...this.view,day:Math.min(this.focusDay.day,n)}),this.view={year:this.focusDay.year,month:this.focusDay.month},this.render()}clamp(e){let t=S(e),n=re(this.limits.min),r=re(this.limits.max);return n&&t<S(n)?n:r&&t>S(r)?r:e}allowed(e){let{min:t,max:n}=this.limits;return!(t&&e<t)&&!(n&&e>n)}render(){let e=this.locale;this.titleEl.textContent=new Intl.DateTimeFormat(e,{month:`long`,year:`numeric`,timeZone:`UTC`}).format(new Date(Date.UTC(this.view.year,this.view.month,1)));let t=this.today,n=S(this.focusDay),r=new Intl.DateTimeFormat(e,{dateStyle:`full`,timeZone:`UTC`});this.grid.textContent=``;let i=null;for(let[a,o]of te(this.view.year,this.view.month,x(e)).entries()){a%y===0&&(i=document.createElement(`div`),i.className=`tcw-calendar-week`,i.setAttribute(`role`,`row`),this.grid.appendChild(i));let e=S(o),s=document.createElement(`button`);s.type=`button`,s.className=`tcw-calendar-day`,s.dataset.date=e,s.setAttribute(`role`,`gridcell`),s.textContent=String(o.day),s.setAttribute(`aria-label`,r.format(new Date(Date.UTC(o.year,o.month,o.day)))),s.setAttribute(`aria-selected`,String(e===this.chosen)),s.tabIndex=e===n?0:-1,o.month!==this.view.month&&s.classList.add(`tcw-outside`),e===t&&s.classList.add(`tcw-today`),this.allowed(e)||(s.disabled=!0),i?.appendChild(s)}}onKey(e){let t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-y,ArrowDown:y},n=this.element.isConnected&&getComputedStyle(this.element).direction===`rtl`;if(e.key in t){let r=n&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)?-t[e.key]:t[e.key];this.moveFocus(ae(this.focusDay,r))}else if(e.key===`PageUp`||e.key===`PageDown`)this.turn(e.key===`PageUp`?-1:1),this.focusGrid();else if(e.key===`Home`||e.key===`End`){let t=new Date(Date.UTC(this.view.year,this.view.month+1,0)).getUTCDate();this.moveFocus({...this.view,day:e.key===`Home`?1:t})}else if(e.key===`Enter`||e.key===` `)this.pick(S(this.focusDay));else return;e.preventDefault()}moveFocus(e){let t=this.clamp(e);this.focusDay=t,(t.year!==this.view.year||t.month!==this.view.month)&&(this.view={year:t.year,month:t.month}),this.render(),this.focusGrid()}pick(e){this.allowed(e)&&this.onPick(e)}},se=class{input=null;view=null;onOutside=e=>{let t=e.target;this.view?.element.contains(t)||this.input?.contains(t)||this.close(!1)};onAway=()=>this.close(!1);onScroll=e=>{e.target instanceof Node&&this.view?.element.contains(e.target)||this.close(!1)};watch=new MutationObserver(()=>{this.input&&!this.input.isConnected&&this.close(!1)});constructor(e,t,n){this.layer=e,this.labels=t,this.locale=n}isOpenFor(e){return this.input===e}owns(e){return e!==null&&(e===this.input||this.view?.element.contains(e)===!0)}open(e){this.close(!1),this.input=e;let t=new oe(this.labels(),this.locale(),e=>this.pick(e));t.show(e.value,{min:e.min||void 0,max:e.max||void 0});let n=t.element;n.setAttribute(`role`,`dialog`);let r=e.getAttribute(`aria-label`)??e.labels?.[0]?.textContent??``;r&&n.setAttribute(`aria-label`,r.trim()),n.addEventListener(`mousedown`,e=>{e.target.closest(`button`)||e.preventDefault()}),n.addEventListener(`keydown`,e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),this.close(!0))}),this.view=t,this.layer().appendChild(n),g(n,e),document.addEventListener(`pointerdown`,this.onOutside,!0),window.addEventListener(`resize`,this.onAway),document.addEventListener(`scroll`,this.onScroll,{capture:!0,passive:!0}),this.watch.observe(document.documentElement,{childList:!0,subtree:!0})}close(e){let t=this.input;t&&(document.removeEventListener(`pointerdown`,this.onOutside,!0),window.removeEventListener(`resize`,this.onAway),document.removeEventListener(`scroll`,this.onScroll,{capture:!0}),this.watch.disconnect(),this.view?.element.remove(),this.view=null,this.input=null,e&&t.isConnected&&t.focus())}focusGrid(){this.view?.focusGrid()}destroy(){this.close(!1)}pick(e){let t=this.input;if(!t)return;let n=t.value!==e;t.value=e,this.close(!0),n&&(t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}},ce=()=>typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches,le=()=>typeof CSS>`u`||typeof CSS.supports!=`function`||CSS.supports(`selector(::-webkit-calendar-picker-indicator)`);function ue(e){if(!(e instanceof Element))return null;let t=e.closest(`select`);return!t||t.matches(`:disabled`)||t.multiple||t.size>1?null:t}function de(e){return!(e instanceof HTMLInputElement)||e.type!==`date`||e.dataset.tcwCalendar===`inline`||e.matches(`:disabled`)||e.readOnly?null:e}function fe(e,t){let n=new _(t.layer),r=new se(t.layer,t.labels,t.locale),i=t.native??ce,a=t.calendar??le,o=new WeakSet,s=e=>o.has(e)?!1:(o.add(e),!0),c=e=>{if(e.button!==0||i()||!s(e))return;let t=ue(e.target);if(t){if(e.preventDefault(),n.isOpenFor(t)){n.close(!0);return}t.focus(),n.open(t)}},l=e=>{if(i()||!a()||!s(e))return;let t=de(e.target);t&&(e.preventDefault(),r.isOpenFor(t)||r.open(t))},u=e=>{if(i()||!s(e))return;let t=ue(e.target);if(t){if(n.isOpenFor(t)){n.key(e)&&(e.preventDefault(),e.stopPropagation());return}(e.key===`Enter`||e.key===` `||e.altKey&&(e.key===`ArrowDown`||e.key===`ArrowUp`)||e.key===`F4`)&&(e.preventDefault(),e.stopPropagation(),n.open(t));return}let o=de(e.target);!o||!a()||(e.key===`Escape`&&r.isOpenFor(o)?(e.preventDefault(),e.stopPropagation(),r.close(!0)):(e.altKey&&e.key===`ArrowDown`||e.key===`F4`)&&(e.preventDefault(),r.isOpenFor(o)||r.open(o),r.focusGrid()))},d=e=>{if(!s(e))return;let t=e.target instanceof Node?e.target:null,i=e.relatedTarget instanceof Node?e.relatedTarget:null;n.owns(t)&&!n.owns(i)&&n.close(!1),r.owns(t)&&!r.owns(i)&&r.close(!1)};for(let t of e)t.addEventListener(`mousedown`,c,!0),t.addEventListener(`click`,l,!0),t.addEventListener(`keydown`,u,!0),t.addEventListener(`focusout`,d,!0);return()=>{for(let t of e)t.removeEventListener(`mousedown`,c,!0),t.removeEventListener(`click`,l,!0),t.removeEventListener(`keydown`,u,!0),t.removeEventListener(`focusout`,d,!0);n.destroy(),r.destroy()}}var pe=[{label:`Candlestick`,value:`candlestick`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Bar`,value:`bar`},{label:`Heikin-Ashi`,value:`heikinAshi`},{label:`Hollow Candle`,value:`hollowCandle`},{label:`Baseline`,value:`baseline`},{label:`Volume Candles`,value:`volumeCandles`},{label:`Equivolume`,value:`equivolume`},{label:`HLC Area`,value:`hlcArea`},{label:`Step Line`,value:`stepLine`},{label:`Line + Markers`,value:`lineWithMarkers`},{label:`High-Low`,value:`hiLo`},{label:`Renko`,value:`renko`},{label:`Line Break`,value:`lineBreak`},{label:`Kagi`,value:`kagi`},{label:`Point & Figure`,value:`pointAndFigure`},{label:`Range Bars`,value:`rangeBars`}],me=[{label:`Lines`,section:`lines`,tools:[{label:`Trend Line`,value:`trendLine`},{label:`Ray`,value:`ray`},{label:`Extended Line`,value:`extendedLine`},{label:`Info Line`,value:`infoLine`},{label:`Trend Angle`,value:`trendAngle`}]},{label:`Horizontal/Vertical`,section:`lines`,tools:[{label:`Horizontal Line`,value:`horizontalLine`},{label:`Horizontal Ray`,value:`horizontalRay`},{label:`Vertical Line`,value:`verticalLine`},{label:`Cross Line`,value:`crossLine`}]},{label:`Channels`,section:`lines`,tools:[{label:`Parallel Channel`,value:`parallelChannel`},{label:`Regression Channel`,value:`regressionChannel`}]},{label:`Fibonacci`,section:`fibonacci`,tools:[{label:`Fib Retracement`,value:`fibRetracement`},{label:`Fib Extension`,value:`fibExtension`},{label:`Fib Channel`,value:`fibChannel`},{label:`Fib Time Zones`,value:`fibTimeZones`},{label:`Fib Speed Resistance Fan`,value:`fibSpeedResistanceFan`},{label:`Fib Speed Resistance Arcs`,value:`fibArcs`},{label:`Fib Circles`,value:`fibCircles`},{label:`Fib Spiral`,value:`fibSpiral`},{label:`Fib Wedge`,value:`fibWedge`}]},{label:`Gann & Pitchforks`,section:`fibonacci`,tools:[{label:`Pitchfork`,value:`pitchfork`},{label:`Schiff Pitchfork`,value:`schiffPitchfork`},{label:`Modified Schiff Pitchfork`,value:`modifiedSchiffPitchfork`},{label:`Gann Fan`,value:`gannFan`},{label:`Gann Box`,value:`gannBox`},{label:`Gann Square`,value:`gannSquare`},{label:`Pitchfan`,value:`pitchfan`}]},{label:`Cycles`,section:`fibonacci`,tools:[{label:`Cyclic Lines`,value:`cyclicLines`},{label:`Time Cycles`,value:`timeCycles`},{label:`Sine Line`,value:`sineLine`}]},{label:`Patterns`,section:`patterns`,tools:[{label:`XABCD Pattern`,value:`xabcdPattern`},{label:`ABCD Pattern`,value:`abcdPattern`},{label:`Head and Shoulders`,value:`headAndShoulders`},{label:`Cypher Pattern`,value:`cypherPattern`},{label:`Three Drives Pattern`,value:`threeDrives`}]},{label:`Elliott Waves`,section:`patterns`,tools:[{label:`Elliott Wave`,value:`elliottWave`},{label:`Elliott Impulse Wave`,value:`elliottImpulse`},{label:`Elliott Correction Wave`,value:`elliottCorrection`},{label:`Elliott Triangle Wave`,value:`elliottTriangle`},{label:`Elliott Double Combo Wave`,value:`elliottDoubleCombo`},{label:`Elliott Triple Combo Wave`,value:`elliottTripleCombo`}]},{label:`Forecasting`,section:`forecasting`,tools:[{label:`Long/Short Position`,value:`riskReward`},{label:`Anchored VWAP`,value:`anchoredVWAP`},{label:`Fixed Range Volume Profile`,value:`volumeProfileRange`},{label:`Forecast`,value:`forecast`},{label:`Projection`,value:`projection`},{label:`Bars Pattern`,value:`barsPattern`}]},{label:`Measure`,section:`forecasting`,tools:[{label:`Price Range`,value:`priceRange`},{label:`Date Range`,value:`dateRange`},{label:`Date and Price Range`,value:`dateAndPriceRange`},{label:`Measure`,value:`measure`}]},{label:`Shapes`,section:`annotation`,tools:[{label:`Rectangle`,value:`rectangle`},{label:`Circle`,value:`circle`},{label:`Ellipse`,value:`ellipse`},{label:`Triangle`,value:`triangle`},{label:`Polyline`,value:`polyline`},{label:`Curve`,value:`curve`},{label:`Arc`,value:`arc`}]},{label:`Brushes`,section:`annotation`,tools:[{label:`Brush`,value:`brush`},{label:`Highlighter`,value:`highlighter`},{label:`Path`,value:`path`}]},{label:`Annotation`,section:`annotation`,tools:[{label:`Text`,value:`text`},{label:`Price Label`,value:`priceLabel`},{label:`Arrow`,value:`arrow`},{label:`Note`,value:`note`},{label:`Callout`,value:`callout`},{label:`Flag Mark`,value:`flag`},{label:`Arrow Mark`,value:`arrowMark`},{label:`Icon`,value:`icon`},{label:`Signpost`,value:`signpost`},{label:`Balloon`,value:`balloon`},{label:`Anchored Text`,value:`anchoredText`},{label:`Anchored Note`,value:`anchoredNote`}]}],he=[`BTCUSDT`,`ETHUSDT`,`SOLUSDT`,`BNBUSDT`],ge={gridVisible:!0,volumeVisible:!0,volumeProfileVisible:!1,marketProfileVisible:!1,marketProfileSplit:!1,marketProfileLetters:!1,marketProfileBuckets:48,marketProfileOpacity:.32,depthHeatmapVisible:!1,depthHeatmapOpacity:.7,sessionShadingVisible:!1,pivotMarkersVisible:!1,pivotStrength:5,pivotStructureLabels:!1,periodLevelsVisible:!1,periodLevelsPeriod:`day`,legendVisible:!0,barCountdown:!0,indicatorValueLabels:!1,alignAxisLabels:!0,logScale:!1,scaleMode:`regular`,autoScale:!0,invertScale:!1,leftPriceScale:!1,crosshairMode:`magnet`,numberLocale:`en-US`,timezone:`local`,highLowLines:!1,mainSeriesVisible:!0,extendedHours:!0,chartTypeOptions:{}},C=(e,...t)=>({label:e,keys:t}),w=(e,t,n={})=>({label:e,keys:[t],auto:n}),T=e=>({hint:e}),_e={from:`panes.titleColor`},ve={title:`settings.section.lastPrice`,rows:[C(`settings.priceLine`,`lastPrice.visible`),C(`settings.up`,`lastPrice.upColor`),C(`settings.down`,`lastPrice.downColor`),C(`drawingSettings.lineStyle`,`lastPrice.style`),C(`drawingSettings.lineWidth`,`lastPrice.width`)]},ye={title:`settings.volume`,rows:[C(`settings.up`,`volume.upColor`),C(`settings.down`,`volume.downColor`)]},be={title:`settings.highLowLines`,rows:[w(`drawingSettings.color`,`highLow.color`,_e)]},xe=[ve,ye,be],Se=[C(`settings.legendText`,`legend.textColor`),C(`settings.legendLabels`,`legend.labelColor`)],Ce=[...Se,C(`settings.paneTitles`,`panes.titleColor`)],we=[C(`drawingSettings.text`,`axis.price.textColor`,`axis.time.textColor`),C(`settings.scaleLines`,`axis.price.lineColor`,`axis.time.lineColor`)],Te=[{title:`settings.section.background`,rows:[C(`settings.background`,`background.color`),C(`settings.paneBackground`,`panes.background`),C(`settings.paneSeparator`,`panes.separatorColor`),w(`settings.watermark`,`watermark.color`,_e)]},{title:`settings.gridLines`,rows:[C(`settings.horizontal`,`grid.horizontal.visible`),C(`settings.vertical`,`grid.vertical.visible`),C(`drawingSettings.color`,`grid.horizontal.color`,`grid.vertical.color`),C(`drawingSettings.lineStyle`,`grid.horizontal.style`,`grid.vertical.style`),C(`drawingSettings.lineWidth`,`grid.horizontal.width`,`grid.vertical.width`)]},{title:`settings.crosshairMode`,rows:[C(`settings.horizontal`,`crosshair.horizontal.visible`),C(`settings.vertical`,`crosshair.vertical.visible`),C(`drawingSettings.color`,`crosshair.horizontal.color`,`crosshair.vertical.color`),C(`drawingSettings.lineStyle`,`crosshair.horizontal.style`,`crosshair.vertical.style`),C(`drawingSettings.lineWidth`,`crosshair.horizontal.width`,`crosshair.vertical.width`),C(`settings.labelBackground`,`crosshair.labelBackground`),C(`settings.labelText`,`crosshair.labelTextColor`)]},{title:`settings.sessionBreaks`,rows:[w(`drawingSettings.color`,`sessionBreaks.color`,{from:`axis.price.lineColor`}),w(`drawingSettings.lineStyle`,`sessionBreaks.style`),w(`drawingSettings.lineWidth`,`sessionBreaks.width`)]},{title:`objects.drawings`,rows:[w(`settings.handles`,`drawings.handleColor`,T(`#ffffff`))]}],Ee=[{title:`settings.section.orders`,trading:!0,rows:[w(`ticket.buy`,`trading.buyColor`,T(n.DEFAULT_TRADING_CONFIG.orderColors?.buy)),w(`ticket.sell`,`trading.sellColor`,T(n.DEFAULT_TRADING_CONFIG.orderColors?.sell)),w(`settings.profit`,`trading.profitColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.profit)),w(`settings.loss`,`trading.lossColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.loss)),w(`account.entry`,`trading.entryColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.entry))]},{title:`settings.section.signals`,rows:[w(`account.long`,`markers.longColor`,T(n.DEFAULT_SIGNAL_STYLE.longColor)),w(`account.short`,`markers.shortColor`,T(n.DEFAULT_SIGNAL_STYLE.shortColor)),w(`markers.neutral`,`markers.neutralColor`,T(n.DEFAULT_SIGNAL_STYLE.neutralColor))]},{title:`settings.section.tradeZones`,rows:[w(`settings.profit`,`tradeZones.profitColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.profitColor)),w(`settings.loss`,`tradeZones.lossColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.lossColor)),w(`settings.openTrade`,`tradeZones.activeColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.activeColor))]}],De={upColor:`settings.up`,downColor:`settings.down`,wickUpColor:`settings.upWick`,wickDownColor:`settings.downWick`,color:`drawingSettings.color`,lineColor:`drawingSettings.color`,lineWidth:`drawingSettings.lineWidth`,topColor:`settings.areaTop`,bottomColor:`settings.areaBottom`},Oe=new Set([`candlestick`,`heikinAshi`,`volumeCandles`,`equivolume`]);function ke(e){let t=`series.${e}.`;return Object.keys(n.CHART_STYLE_KEYS).filter(e=>e.startsWith(t)).map(n=>{let r=n.slice(t.length),i=De[r]??`drawingSettings.color`;return Oe.has(e)&&r===`upColor`&&(i=`settings.upBody`),Oe.has(e)&&r===`downColor`&&(i=`settings.downBody`),e===`baseline`&&r===`upColor`&&(i=`settings.aboveBase`),e===`baseline`&&r===`downColor`&&(i=`settings.belowBase`),C(i,n)})}var E=[...new Set([...Object.keys(n.CHART_STYLE_KEYS).filter(e=>e.startsWith(`series.`)),...[...xe,...Te,...Ee].flatMap(e=>e.rows.flatMap(e=>e.keys)),...[...Ce,...we].flatMap(e=>e.keys)])],Ae=`/* === TradeCanvas Widget — Premium Styles === */
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The HTML \`hidden\` attribute only sets \`display: none\` via the UA stylesheet,
|
package/dist/widget/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as e, a as t, c as n, d as r, f as i, i as a, n as o, o as s, r as c, t as l } from "../LayoutSession-
|
|
1
|
+
import { O as e, a as t, c as n, d as r, f as i, i as a, n as o, o as s, r as c, t as l } from "../LayoutSession-Bcy79w0l.js";
|
|
2
2
|
import { a as u, c as d, i as f, n as p, o as m, r as h, s as ee, t as g } from "../i18n-DUmd4Z_r.js";
|
|
3
3
|
import { CHART_STYLE_KEYS as _, CHART_TYPE_ICONS as v, DARK_THEME as y, DEFAULT_SIGNAL_STYLE as b, DEFAULT_TRADE_ZONE_STYLE as x, DEFAULT_TRADING_CONFIG as S, DRAWING_TOOL_ICONS as te, LIGHT_THEME as ne, PHI as re, PRICE_SOURCES as ie, SANS_FONT_FAMILY as ae, UI_ICONS as oe, barTimeUnit as se, formatPrice as ce, formatVolumeLoc as le, iconSvg as ue, indicatorSource as de, isTimeFrame as fe, isValidTimeZone as pe, marketStatus as me, offsetAt as he, parseIndicatorSource as ge, phiStep as _e, readChartStyleOverrides as ve, readChartTypeOptions as ye, readIndicatorPlotStyles as be, readNews as xe, readQuote as Se, resampleBars as Ce, sanitizeDrawingOptions as we, sanitizeDrawingStyle as Te, stepDecimals as Ee, symbolTimeZone as De, tickBarCount as Oe, timeParts as ke, timeframeFollowsDays as Ae, timeframeToMs as C, tzLabel as je, wallToUtc as Me, zoneOffsetMinutes as Ne, zonedDateFormatter as Pe } from "@tradecanvas/commons";
|
|
4
4
|
import { ChartStateManager as Fe, INDICATOR_CATEGORIES as Ie, INTERVAL_LIMITS as Le, INTERVAL_UNITS as Re, MAX_ALERT_BARS as ze, MIN_ALERT_BARS as Be, RANGE_PRESETS as Ve, ResamplingAdapter as He, SYMBOL_INDICATOR_IDS as Ue, adapterFromFeed as We, indicatorCategory as Ge, indicatorValuePrecision as Ke, isSeriesPalette as qe, plotColor as Je, plotShown as Ye, rangePresetStart as Xe, servesTimeframe as Ze, sourceParam as Qe, withResampling as $e } from "@tradecanvas/core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradecanvas/chart",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.70.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "High-performance canvas trading chart with built-in indicators, drawing tools, and real-time streaming. Zero external dependencies.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"README.md"
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@tradecanvas/commons": "1.
|
|
67
|
-
"@tradecanvas/core": "1.
|
|
66
|
+
"@tradecanvas/commons": "1.70.0",
|
|
67
|
+
"@tradecanvas/core": "1.70.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"jsdom": "^25.0.1",
|