"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;ep&&(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.timen.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;eo(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;ne.showInObjectTree()&&(t||e.isVisible())));return"all"===l?s:s.filter((e=>l.includes(e.id())))}}}]);