"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9498],{99992:(e,l,t)=>{t.r(l),t.d(l,{exportData:()=>g});var s=t(11542),i=t(50151),n=t(19466),o=t(79036),u=t(91988),d=t(8025),a=t(68805),r=t(94113),c=t(41991),f=t(9859),h=t(17730);const p={includeTime:!0,includeUserTime:!1,includeSeries:!0,includeDisplayedValues:!1,includedStudies:"all",includeOffsetStudyValues:!1,includeOHLCValuesForSingleValuePlots:!1,includeHiddenStudies:!1};function m(e,l){const t={schema:[],data:[],displayedData:[],indexes:[]},s=e.timeScale().points(),n=e.mainSeries(),r=n.style(),p=!l.includeOHLCValuesForSingleValuePlots&&(0,a.isSingleValueBasedStyle)(r),m=(0,i.ensureNotNull)(n.symbolInfo()),g=(0,h.getChartWidgetApiTimeConverter)(n.interval(),m,e),P=!l.includeOHLCValuesForSingleValuePlots&&(0,a.isCloseBasedSymbol)(m),V=v(e,l.includedStudies,l.includeHiddenStudies),I=[];for(const e of V){const t=(0,o.isOverlayStudy)(e)?T(e,l):S(e);I.push(t)}const O=V.map((e=>e.data()));(l.includeSeries||0===O.length)&&O.push(n.bars());const b=function(e,l,t,s,n){const o=(0,i.ensureNotNull)(e.range().value(),"time scale points range"),a=function(e,l,t,s){const n=s.from,o=s.to,a=e.range().value(),r=(0,i.ensureNotNull)(void 0!==n?e.indexOf(n,!0):(0,i.ensureNotNull)(a).firstIndex),c=(0,i.ensureNotNull)(void 0!==o?e.indexOf(o,!0):(0,i.ensureNotNull)(a).lastIndex);let h=c,p=r;for(let e=0;e<l.length;e++){const i=l[e],n=s.includeOffsetStudyValues?(0,f.max)(t[e]?.fieldPlotOffsets??[0]):0,o=i.search(r,d.PlotRowSearchMode.NearestRight);null!==o&&o.index<h&&(h=o.index);const u=i.search(c,d.PlotRowSearchMode.NearestLeft);null!==u&&u.index+n>p&&(p=u.index+n)}return(0,i.assert)(h<=p,"Range must contain at least 1 time point"),new u.BarsRange(h,p)}(e,l,t,n),r=a.firstBar(),c=a.lastBar(),h=[];for(let e=r;e<=c;e++){const l={index:e,time:(0,i.ensureNotNull)(s.convertTimePointIndexToInternalTime(e)),publicTime:(0,i.ensureNotNull)(s.convertTimePointIndexToPublicTime(e))};if(!(void 0!==n.from&&l.time<n.from)){if(void 0!==n.to&&l.time>n.to)break;if(!n.includeOffsetStudyValues&&e>o.lastIndex)break;h.push(l)}}return h.length>0?new y(h):null}(s,O,I,g,l);if(null===b)return t;const w=b.firstBar(),D=b.lastBar();l.includeTime&&t.schema.push({type:"time"});const F=t.schema.length;l.includeUserTime&&t.schema.push({type:"userTime"});const C=t.schema.length;if(l.includeSeries){const e=n.statusProvider({hideResolution:!0}).getSplitTitle(),l=Object.values(e).filter((e=>""!==e)).join(", ");t.schema.push(...function(e,l,t,s,n){const o=[];t?o.push(x("close",e)):s?o.push(x((0,i.ensureNotNull)(n),e)):12===l?o.push(x("high",e),x("low",e)):16===l||21===l?o.push(x("high",e),x("low",e),x("close",e)):o.push(x("open",e),x("high",e),x("low",e),x("close",e));return o}(l,r,P,p,n.priceSource()))}let _=t.schema.length;for(const e of I)t.schema.push(...e.fields);const B=t.schema.length;if(0===B)return t;for(let e=w;e<=D;++e){const s=new Float64Array(B);s.fill(NaN),t.data.push(s),t.indexes.push(e),l.includeDisplayedValues&&t.displayedData.push(new Array(B).fill(""))}
if(l.includeTime||l.includeUserTime){const s=e.dateTimeFormatter();for(let e=w;e<=D;++e){const n=b.item(e),o=n.time,u=n.publicTime,d=new Date(1e3*(0,i.ensureNotNull)(u));if(l.includeTime&&(t.data[e-w][0]=(0,i.ensureNotNull)(o)),l.includeUserTime&&(t.data[e-w][F]=d.getTime()/1e3),l.includeDisplayedValues){const i=s.format(d);l.includeTime&&(t.displayedData[e-w][0]=i),l.includeUserTime&&(t.displayedData[e-w][F]=i)}}}if(l.includeSeries){const e=n.bars().range(w,D),s=(0,c.getPriceValueFormatterForSource)(n),i=e=>s(e,{ignoreLocaleNumberFormat:!0}),o=n.barFunction();e.each(((e,s)=>{const n=t.data[e-w],u=N(s[4]);if(P){if(n[C]=u,l.includeDisplayedValues){t.displayedData[e-w][C]=i(u)}}else if(p){const u=o(s);if(n[C]=u,l.includeDisplayedValues){t.displayedData[e-w][C]=i(u)}}else{const o=N(s[1]),d=N(s[2]),a=N(s[3]);if(12===r?(n[C]=d,n[C+1]=a):16===r||21===r?(n[C]=d,n[C+1]=a,n[C+2]=u):(n[C]=o,n[C+1]=d,n[C+2]=a,n[C+3]=u),l.includeDisplayedValues){const l=t.displayedData[e-w];12===r?(l[C]=i(d),l[C+1]=i(a)):16===r||21===r?(l[C]=i(d),l[C+1]=i(a),l[C+2]=i(u)):(l[C]=i(o),l[C+1]=i(d),l[C+2]=i(a),l[C+3]=i(u))}}return!1}))}for(let e=0;e<V.length;++e){const s=V[e],n=I[e];let u,d=!1,r=!1;(0,o.isOverlayStudy)(s)&&(u=s.barFunction(),d=!l.includeOHLCValuesForSingleValuePlots&&(0,a.isCloseBasedSymbol)(s.symbolInfo()),r=!l.includeOHLCValuesForSingleValuePlots&&(0,a.isSingleValueBasedStyle)(s.style()));for(let e=0;e<n.fields.length;++e){const o=(0,c.getPriceValueFormatterForStudy)(s,n.fields[e].plotId),a=e=>o(e,{ignoreLocaleNumberFormat:!0}),f=n.fieldPlotOffsets[e],h=n.fieldToPlotIndex[e],p=w-f,m=D-f,g=_+e;s.data().range(p,m).each(((e,s)=>{const n=t.data[e-p];let o;return o=d?N(s[4]):r?(0,i.ensureDefined)(u)(s):N(s[h]),n[g]=o,l.includeDisplayedValues&&(t.displayedData[e-p][g]=a(o)),!1}))}_+=n.fields.length}return t}function g(e,l={}){const t={...p,...l};if(t.includeHiddenStudies){const l=v(e,t.includedStudies,t.includeHiddenStudies),s=[],i=[];for(const e of l)e.isVisible()||(s.push(e),i.push(e.start(!0,!0)));return(async()=>{i.length>0&&(await Promise.all(i),await new Promise((e=>{setTimeout((()=>e()))})))})().then((()=>m(e,t))).finally((()=>{for(const e of s)e.stop()}))}return m(e,t)}class y{constructor(e){this._items=e,this._firstIndex=this._items[0].index,this._lastIndex=this._items[this._items.length-1].index}firstBar(){return this._firstIndex}lastBar(){return this._lastIndex}item(e){return this._items[e-this._firstIndex]}}function S(e){const l=e.metaInfo(),o={fieldToPlotIndex:[],fieldPlotOffsets:[],fields:[]},u=e.id(),d=e.properties().childs(),a=e.title(n.TitleDisplayTarget.StatusLine,!1,void 0,!1);for(let n=0;n<l.plots.length;++n){const c=l.plots[n];let f,h="";if((0,r.isPlotSupportDisplay)(c)){const e=d.styles.childs()[c.id];if(void 0!==e&&0===e.childs().display.value())continue;f=(0,i.ensureDefined)(l.styles)[c.id]}else if((0,r.isOhlcPlot)(c)){const e=d.ohlcPlots.childs()[c.target];if(void 0!==e&&0===e.childs().display.value())continue;switch(f=l.ohlcPlots&&l.ohlcPlots[c.target],c.type){case"ohlc_open":h=` (${s.t(null,void 0,t(16610))})`
;break;case"ohlc_high":h=` (${s.t(null,void 0,t(78254))}`;break;case"ohlc_low":h=` (${s.t(null,void 0,t(65318))})`;break;case"ohlc_close":h=` (${s.t(null,void 0,t(62578))})`}}if(void 0===f||void 0===f.title)continue;const p=`${f.title}${h}`;o.fields.push(P(u,a,p,c.id)),o.fieldToPlotIndex.push(n+1),o.fieldPlotOffsets.push(e.offset(c.id))}return o}function T(e,l){const t={fieldToPlotIndex:[],fieldPlotOffsets:[],fields:[]},s=e.id(),o=e.title(n.TitleDisplayTarget.StatusLine,!1,void 0,!1),u=e.style(),d=!l.includeOHLCValuesForSingleValuePlots&&(0,a.isCloseBasedSymbol)(e.symbolInfo()),r=!l.includeOHLCValuesForSingleValuePlots&&(0,a.isSingleValueBasedStyle)(u);if(d)t.fields.push(P(s,o,"close","close")),t.fieldToPlotIndex.push(4),t.fieldPlotOffsets.push(0);else if(r){const l=(0,i.ensureNotNull)(e.priceSource());t.fields.push(P(s,o,l,l)),t.fieldToPlotIndex.push(1),t.fieldPlotOffsets.push(0)}else 12===u?(t.fields.push(P(s,o,"high","high"),P(s,o,"low","low")),t.fieldToPlotIndex.push(3,2),t.fieldPlotOffsets.push(0,0)):16===u||21===u?(t.fields.push(P(s,o,"high","high"),P(s,o,"low","low"),P(s,o,"close","close")),t.fieldToPlotIndex.push(2,3,4),t.fieldPlotOffsets.push(0,0,0)):(t.fields.push(P(s,o,"open","open"),P(s,o,"high","high"),P(s,o,"low","low"),P(s,o,"close","close")),t.fieldToPlotIndex.push(1,2,3,4),t.fieldPlotOffsets.push(0,0,0,0));return t}function P(e,l,t,s){return{type:"value",sourceType:"study",sourceId:e,sourceTitle:l,plotTitle:t,plotId:s}}function x(e,l){return{type:"value",sourceType:"series",plotTitle:e,sourceTitle:l}}function N(e){return null!=e?e:NaN}function v(e,l,t){const s=e.allStudies().filter((e=>e.showInObjectTree()&&(t||e.isVisible())));return"all"===l?s:s.filter((e=>l.includes(e.id())))}}}]);