BarterDEX/gui/js/charts/StockChartX-Light.min.js

3004 lines
477 KiB
JavaScript

/* Your license agreement requires the use of the Modulus LicensePing.com licensing mechanism. The mechanism monitors the usage and distribution patterns of our intellectual property. If the usage or distribution patterns indicate that our licensing mechanism has either been removed, altered, tampered with or that our intellectual property may be misused in any form, our legal team may initiate contact with you to investigate the matter further. Removal or modification of this license mechanism by any means whatsoever (editing the code, removing the LicensePing.com URL reference, etc.) constitutes willful and criminal copyright infringement in addition to giving rise to claims by Modulus Financial Engineering, Inc. against you, as the developer, and your company as a whole for, among others: (1) Copyright Infringement; (2) False Designation of Origin; (3) Breach of Contract; (4) Misappropriation of Trade Secrets; (5) Interference with Contract; and (6) Interference with Prospective Business Relations. 17 USC 506 - Criminal offenses (a) Criminal Infringement. Any person who willfully infringes a copyright shall be punished as provided under section 2319 of title 18, if the infringement was committed for purposes of commercial advantage or private financial gain. 18 USC 2319 - Criminal infringement of a copyright (a) Any person who commits an offense under section 506 (a)(1)(A) of title 17 shall be imprisoned not more than 5 years, or fined in the amount set forth in this title (up to $150,000), or both, if the offense consists of the reproduction or distribution, including by electronic means, during any 180-day period, of at least 10 copies, of 1 or more copyrighted works, which have a total retail value of more than $2,500. For more information, review the license agreement associated with this software and source code at http://www.modulusfe.com/support/license.pdf or contact us at [email protected].*/
var TASdk
!function(e){e.Const={nullValue:-987653421,mA_START:0,mA_END:7,simpleMovingAverage:0,exponentialMovingAverage:1,timeSeriesMovingAverage:2,triangularMovingAverage:3,variableMovingAverage:4,VIDYA:5,wellesWilderSmoothing:6,weightedMovingAverage:7},e.Unknown=-1,e.FirstIndicator=-1,e.SimpleMovingAverage=0,e.ExponentialMovingAverage=1,e.TimeSeriesMovingAverage=2,e.TriangularMovingAverage=3,e.VariableMovingAverage=4,e.VIDYA=5,e.WellesWilderSmoothing=6,e.WeightedMovingAverage=7,e.WilliamsPctR=8,e.WilliamsAccumulationDistribution=9,e.VolumeOscillator=10,e.VerticalHorizontalFilter=11,e.UltimateOscillator=12,e.TrueRange=13,e.AverageTrueRange=14,e.RainbowOscillator=15,e.PriceOscillator=16,e.ParabolicSAR=17,e.MomentumOscillator=18,e.MACD=19,e.EaseOfMovement=20,e.DirectionalMovementSystem=21,e.DetrendedPriceOscillator=22,e.ChandeMomentumOscillator=23,e.ChaikinVolatility=24,e.Aroon=25,e.AroonOscillator=26,e.LinearRegressionRSquared=27,e.LinearRegressionForecast=28,e.LinearRegressionSlope=29,e.LinearRegressionIntercept=30,e.PriceVolumeTrend=31,e.PerformanceIndex=32,e.CommodityChannelIndex=33,e.ChaikinMoneyFlow=34,e.WeightedClose=35,e.VolumeROC=36,e.TypicalPrice=37,e.StandardDeviation=38,e.PriceROC=39,e.MedianPrice=40,e.HighMinusLow=41,e.BollingerBands=42,e.FractalChaosBands=43,e.HighLowBands=44,e.MovingAverageEnvelope=45,e.SwingIndex=46,e.AccumulativeSwingIndex=47,e.ComparativeRelativeStrength=48,e.MassIndex=49,e.MoneyFlowIndex=50,e.NegativeVolumeIndex=51,e.OnBalanceVolume=52,e.PositiveVolumeIndex=53,e.RelativeStrengthIndex=54,e.TradeVolumeIndex=55,e.StochasticOscillator=56,e.StochasticMomentumIndex=57,e.FractalChaosOscillator=58,e.PrimeNumberOscillator=59,e.PrimeNumberBands=60,e.HistoricalVolatility=61,e.MACDHistogram=62,e.HHV=63,e.LLV=64,e.TimeSeriesForecast=65,e.TRIX=66,e.ElderRay=67,e.ElderForceIndex=68,e.ElderThermometer=69,e.EhlerFisherTransform=70,e.KeltnerChannel=71,e.MarketFacilitationIndex=72,e.SchaffTrendCycle=73,e.QStick=74,e.STARC=75,e.CenterOfGravity=76,e.CoppockCurve=77,e.ChandeForecastOscillator=78,e.GopalakrishnanRangeIndex=79,e.IntradayMomentumIndex=80,e.KlingerVolumeOscillator=81,e.PrettyGoodOscillator=82,e.RAVI=83,e.RandomWalkIndex=84,e.TwiggsMoneyFlow=85,e.LastIndicator=86,e.IchimokuCloud=87,e.indicatorToString=function(t){switch(t){case e.SimpleMovingAverage:return"Simple Moving Average"
case e.ExponentialMovingAverage:return"Exponential Moving Average"
case e.TimeSeriesMovingAverage:return"Time Series Moving Average"
case e.TriangularMovingAverage:return"Triangular Moving Average"
case e.VariableMovingAverage:return"Variable Moving Average"
case e.VIDYA:return"Volatility Index Dynamic Average"
case e.WellesWilderSmoothing:return"Welles Wilder Smoothing"
case e.WeightedMovingAverage:return"Weighted Moving Average"
case e.WilliamsPctR:return"Williams %R"
case e.WilliamsAccumulationDistribution:return"Williams Accumulation Distribution"
case e.VolumeOscillator:return"Volume Oscillator"
case e.VerticalHorizontalFilter:return"Vertical Horizontal Filter"
case e.UltimateOscillator:return"Ultimate Oscillator"
case e.TrueRange:return"True Range"
case e.AverageTrueRange:return"Average True Range"
case e.TRIX:return"TRIX"
case e.RainbowOscillator:return"Rainbow Oscillator"
case e.PriceOscillator:return"Price Oscillator"
case e.ParabolicSAR:return"Parabolic SAR"
case e.MomentumOscillator:return"Momentum Oscillator"
case e.MACD:return"MACD"
case e.EaseOfMovement:return"Ease of Movement"
case e.DirectionalMovementSystem:return"Directional Movement System"
case e.DetrendedPriceOscillator:return"Detrended Price Oscillator"
case e.ChandeMomentumOscillator:return"Chande Momentum Oscillator"
case e.ChaikinVolatility:return"Chaikin Volatility"
case e.Aroon:return"Aroon"
case e.AroonOscillator:return"Aroon Oscillator"
case e.LinearRegressionRSquared:return"Linear Regression R2"
case e.LinearRegressionForecast:return"Linear Regression Forecast"
case e.LinearRegressionSlope:return"Linear Regression Slope"
case e.LinearRegressionIntercept:return"Linear Regression Intercept"
case e.PriceVolumeTrend:return"Price Volume Trend"
case e.PerformanceIndex:return"Performance Index"
case e.CommodityChannelIndex:return"Commodity Channel Index"
case e.ChaikinMoneyFlow:return"Chaikin Money Flow"
case e.WeightedClose:return"Weighted Close"
case e.VolumeROC:return"Volume Rate of Change"
case e.TypicalPrice:return"Typical Price"
case e.StandardDeviation:return"Standard Deviation"
case e.PriceROC:return"Price Rate of Change"
case e.MedianPrice:return"Median Price"
case e.HighMinusLow:return"High Minus Low"
case e.BollingerBands:return"Bollinger Bands"
case e.FractalChaosBands:return"Fractal Chaos Bands"
case e.HighLowBands:return"High Low Bands"
case e.MovingAverageEnvelope:return"Moving Average Envelope"
case e.SwingIndex:return"Swing Index"
case e.AccumulativeSwingIndex:return"Accumulative Swing Index"
case e.ComparativeRelativeStrength:return"Comparative Relative Strength"
case e.MassIndex:return"Mass Index"
case e.MoneyFlowIndex:return"Money Flow Index"
case e.NegativeVolumeIndex:return"Negative Volume Index"
case e.OnBalanceVolume:return"On Balance Volume"
case e.PositiveVolumeIndex:return"Positive Volume Index"
case e.RelativeStrengthIndex:return"Relative Strength Index"
case e.TradeVolumeIndex:return"Trade Volume Index"
case e.StochasticOscillator:return"Stochastic Oscillator"
case e.StochasticMomentumIndex:return"Stochastic Momentum Index"
case e.FractalChaosOscillator:return"Fractal Chaos Oscillator"
case e.PrimeNumberOscillator:return"Prime Number Oscillator"
case e.PrimeNumberBands:return"Prime Number Bands"
case e.HistoricalVolatility:return"Historical Volatility"
case e.MACDHistogram:return"MACD Histogram"
case e.HHV:return"Highest High Value"
case e.LLV:return"Lowest Low Value"
case e.TimeSeriesForecast:return"Time Series Forecast"
case e.ElderRay:return"Elder Ray"
case e.ElderForceIndex:return"Elder Force Index"
case e.ElderThermometer:return"Elder Thermometer"
case e.EhlerFisherTransform:return"Ehler Fisher Transform"
case e.KeltnerChannel:return"Keltner Channel"
case e.MarketFacilitationIndex:return"Market Facilitation Index"
case e.SchaffTrendCycle:return"Schaff Trend Cycle"
case e.QStick:return"QStick"
case e.STARC:return"Stoller Average Range Channel"
case e.CenterOfGravity:return"Center Of Gravity"
case e.CoppockCurve:return"Coppock Curve"
case e.ChandeForecastOscillator:return"Chande Forecast Oscillator"
case e.GopalakrishnanRangeIndex:return"Gopalakrishnan Range Index"
case e.IntradayMomentumIndex:return"Intraday Momentum Index"
case e.KlingerVolumeOscillator:return"Klinger Volume Oscillator"
case e.PrettyGoodOscillator:return"Pretty Good Oscillator"
case e.RAVI:return"RAVI"
case e.RandomWalkIndex:return"Random Walk Index"
case e.TwiggsMoneyFlow:return"Twiggs Money Flow"
case e.IchimokuCloud:return"Ichimoku Cloud"
case e.Unknown:return""}}}(TASdk||(TASdk={})),function(e){var t=function(){function t(){this._m_values=[],this.recordCount=0}return t.prototype.initialize=function(e,t){this.name=t,this.recordCount=e,this._m_values=Array(e+1)
for(var i=0;i<this._m_values.length;i++)this._m_values[i]=0},t.prototype.setValue=function(e,t){this._m_values[e]=t},t.prototype.value=function(t){return 0<t&&t<this._m_values.length?this._m_values[t]:e.Const.nullValue},t}()
e.Field=t}(TASdk||(TASdk={})),function(e){var t=function(){function t(){this._m_FieldNav=[]}return t.prototype.addField=function(e){this._m_FieldNav.push(e)},t.prototype.getIndex=function(e){for(var t=0;t<this._m_FieldNav.length;t++)if(this._m_FieldNav[t].name===e)return t
return-1},t.prototype.renameField=function(e,t){var i=this.getIndex(e);-1!==i&&(this._m_FieldNav[i].name=t)},t.prototype.removeField=function(e){-1!==(e=this.getIndex(e))&&this._m_FieldNav.splice(e,1)},t.prototype.value=function(e,t){var i=this.getIndex(e)
return-1!==i?this._m_FieldNav[i].value(t):-1},t.prototype.getField=function(t){return t=this.getIndex(t),-1!==t?this._m_FieldNav[t]:new e.Field},t.prototype.getFieldByIndex=function(t){return-1!==t&&t<this._m_FieldNav.length?this._m_FieldNav[t]:new e.Field},t.prototype.copyField=function(e,t){var i=this.getIndex(t)
if(-1!==i)for(var i=this._m_FieldNav[i],r=i.recordCount,n=1;n<r+1;n++)e.setValue(n,i.value(n))},t.prototype.getName=function(e){return 0<=e&&e<this._m_FieldNav.length?this._m_FieldNav[e].name:""},t}()
e.Recordset=t}(TASdk||(TASdk={})),function(e){var t=function(){function t(){}return t.prototype.simpleMovingAverage=function(t,i,r){var n,o,a,s=new e.Recordset,l=t.recordCount
n=new e.Field,n.initialize(l,r)
for(var c=r=o=i+1;c<l+1;c++){for(o=0,a=1;a<i+1;a++)o+=t.value(r),r--
r+=i,o/=i,n.setValue(r,o),r++}return s.addField(n),s},t.prototype.timeSeriesMovingAverage=function(t,i,r){var n,o=new e.LinearRegression,a=t.recordCount
for(n=new e.Field,n.initialize(a,r),i=o.regression(t,i),r=1;r<a+1;r++)t=i.value("Forecast",r),n.setValue(r,t)
return i.addField(n),i},t.prototype.variableMovingAverage=function(t,i,r){var n,o,a,s=new e.Oscillator,l=t.recordCount
for(i=new e.Field,i.initialize(l,r),r=s.chandeMomentumOscillator(t,9,"CMO"),s=2;s<l+1;s++)o=i.value(s-1),n=r.value("CMO",s)/100,a=t.value(s),0>n&&(n*=-1),n=n*a+(1-n)*o,i.setValue(s,n)
return r.addField(i),r},t.prototype.triangularMovingAverage=function(t,i,r){var n,o,a,s,l,c=0,h=0,u=new e.Recordset
a=t.recordCount,n=new e.Field,n.initialize(a,"MA1"),o=new e.Field,o.initialize(a,r),0<i%2?(c=parseInt(i/2)+1,h=c):(c=i/2,h=c+1)
var d=r=i+1
for(i=r;i<a+1;i++){for(l=0,s=1;s<c+1;s++)l+=t.value(d),d--
d+=parseInt(c),l/=c,n.setValue(d,l),d++}for(i=d=r;i<a+1;i++){for(l=0,s=1;s<h+1;s++)l+=n.value(d),d--
d+=parseInt(h),l/=h,o.setValue(d,l),d++}return u.addField(o),u},t.prototype.weightedMovingAverage=function(t,i,r){var n,o,a,s,l,c=0,h=new e.Recordset
for(l=t.recordCount,n=new e.Field,n.initialize(l,r),a=1;a<i+1;a++)c+=a
for(s=r=o=i+1;s<l+1;s++){for(o=0,a=i;0<a;a--)o+=a*t.value(r),r--
r+=i,o/=c,n.setValue(r,o),r++}return h.addField(n),h},t.prototype.VIDYA=function(t,i,r,n){var o,a,s,l
s=new e.LinearRegression,a=t.recordCount,o=new e.Field,o.initialize(a,n),i=s.regression(t,i)
var c=2
for(n=2;n<a+1;n++)l=t.value(c-1),s=i.value("RSquared",c)*r,o.setValue(c,s*t.value(c)+(1-s)*l),c++
return i.addField(o),i},t.prototype.wellesWilderSmoothing=function(t,i,r){var n,o,a,s=new e.Recordset
for(o=t.recordCount,n=new e.Field,n.initialize(o,r),r=2;r<o+1;++r)a=n.value(r-1)+1/i*(t.value(r)-n.value(r-1)),n.setValue(r,a)
return s.addField(n),s},t.prototype.movingAverageSwitch=function(e,t,i,r){var n=null
switch(i){case 0:n=this.simpleMovingAverage(e,t,r)
break
case 1:n=this.exponentialMovingAverage(e,t,r)
break
case 2:n=this.timeSeriesMovingAverage(e,t,r)
break
case 3:n=this.triangularMovingAverage(e,t,r)
break
case 4:n=this.variableMovingAverage(e,t,r)
break
case 7:n=this.weightedMovingAverage(e,t,r)
break
case 5:n=this.VIDYA(e,t,.65,r)
break
case 6:n=this.wellesWilderSmoothing(e,t,r)}return n},t}()
e.MovingAverage=t}(TASdk||(TASdk={})),function(e){var t=function(){function t(){}return t.prototype.movingAverageEnvelope=function(t,i,r,n){var o,a,s,l=new e.MovingAverage
if(s=t.recordCount,r<e.Const.mA_START||r>e.Const.mA_END||1>i||i>s||0>n||100<n)return null
for(o=new e.Field,o.initialize(s,"Envelope Top"),a=new e.Field,a.initialize(s,"Envelope Bottom"),t=l.movingAverageSwitch(t,i,r,"Envelope Median"),l=1,n/=100,i=1;i<s+1;i++)r=t.value("Envelope Median",l),o.setValue(l,r+r*n),r=t.value("Envelope Median",l),a.setValue(l,r-r*n),l++
return null!=t&&(t.addField(o),t.addField(a)),t},t.prototype.highLowBands=function(t,i,r,n){var o,a,s,l=new e.MovingAverage,c=new e.Recordset
return 6>n||n>t.recordCount?null:(o=l.VIDYA(t,n,.8,"High Low Bands Top"),a=l.VIDYA(r,parseInt(n/2),.8,"High Low Bands Median"),s=l.VIDYA(i,n,.8,"High Low Bands Bottom"),c.addField(o.getField("High Low Bands Top")),c.addField(a.getField("High Low Bands Median")),c.addField(s.getField("High Low Bands Bottom")),o.removeField("High Low Bands Top"),a.removeField("High Low Bands Median"),s.removeField("High Low Bands Bottom"),c)},t.prototype.fractalChaosBands=function(t,i){var r,n=new e.MovingAverage,o=new e.Recordset,a=t.getFieldByIndex(0).recordCount
1>i&&(i=100)
var s=new e.Field
s.initialize(a,"Fractal High")
var l=new e.Field
l.initialize(a,"Low High"),(new e.Field).initialize(a,"HLM")
var c=t.getField("High"),h=t.getField("Low"),u=new e.Field
u.initialize(a,"FR")
var d=new e.Field
d.initialize(a,"High 1")
var p=new e.Field
p.initialize(a,"High 2")
var f=new e.Field
f.initialize(a,"High 3")
var m=new e.Field
m.initialize(a,"High 4")
var v=new e.Field
v.initialize(a,"Low 1")
var g=new e.Field
g.initialize(a,"Low 2")
var y=new e.Field
y.initialize(a,"Low 3")
var _=new e.Field
for(_.initialize(a,"Low 4"),r=5;r<a+1;++r)d.setValue(r,c.value(r-4)),v.setValue(r,h.value(r-4)),p.setValue(r,c.value(r-3)),g.setValue(r,h.value(r-3)),f.setValue(r,c.value(r-2)),y.setValue(r,h.value(r-2)),m.setValue(r,c.value(r-1)),_.setValue(r,h.value(r-1))
for(r=1;r<a+1;++r)s.setValue(r,(c.value(r)+h.value(r))/3)
for(r=n.simpleMovingAverage(s,i,"Fractal High"),s=r.getField("Fractal High"),r.removeField("Fractal High"),r=n.simpleMovingAverage(l,i,"Fractal Low"),l=r.getField("Fractal Low"),r.removeField("Fractal Low"),r=1;r<a+1;++r)s.setValue(r,f.value(r)+s.value(r)),l.setValue(r,y.value(r)-l.value(r))
for(r=2;r<a+1;++r)f.value(r)>d.value(r)&&f.value(r)>p.value(r)&&f.value(r)>=m.value(r)&&f.value(r)>=c.value(r)?u.setValue(r,s.value(r)):u.setValue(r,0),u.value(r)||(y.value(r)<v.value(r)&&y.value(r)<g.value(r)&&y.value(r)<=_.value(r)&&y.value(r)<=h.value(r)?u.setValue(r,l.value(r)):u.setValue(r,0)),s.value(r)===u.value(r)?s.setValue(r,f.value(r)):s.setValue(r,s.value(r-1)),l.value(r)===u.value(r)?l.setValue(r,y.value(r)):l.setValue(r,l.value(r-1))
for(r=2;r<a+1;++r)l.value(r)||l.setValue(r,e.Const.nullValue),s.value(r)||s.setValue(r,e.Const.nullValue)
return o.addField(s),o.addField(l),o},t.prototype.primeNumberBands=function(t,i){var r,n=new e.Recordset,o=t.recordCount,a=new e.Field
a.initialize(o,"Prime Bands Top")
var s=new e.Field
s.initialize(o,"Prime Bands Bottom")
var l,c,h=new e.General,u=0,d=0
for(r=1;r<=o;++r){for(l=c=i.value(r);1<l;--l)if(h.isPrime(l)){d=l
break}for(s.setValue(r,d),l=c=t.value(r);l<2*c;++l)if(h.isPrime(l)){u=l
break}a.setValue(r,u)}return n.addField(a),n.addField(s),n},t.prototype.keltner=function(t,i,r,n,o){var a=new e.Recordset,s=t.getFieldByIndex(0).recordCount,l=new e.Field
l.initialize(s,o+" Top")
var c=new e.Field
c.initialize(s,o+" Bottom")
var h=(new e.Oscillator).trueRange(t,"atr").getField("atr"),u=new e.MovingAverage,h=u.simpleMovingAverage(h,i,"atr").getField("atr")
for(t=u.movingAverageSwitch(t.getField("Close"),i,n,o+" Median").getField(o+" Median"),i=1;i<s+1;i++)n=r*h.value(i),l.setValue(i,t.value(i)+n),c.setValue(i,t.value(i)-n)
return a.addField(l),a.addField(t),a.addField(c),a},t.prototype.ichimoku=function(t,i,r,n){var o=new e.Recordset,a=t.getFieldByIndex(0).recordCount,s=new e.Field,l=new e.Field,c=new e.Field,h=new e.Field,u=new e.Field,d=t.getField("High"),p=t.getField("Low")
for(t=t.getField("Close"),s.initialize(a,"Ichimoku Tenkan Sen"),l.initialize(a,"Ichimoku Kijun Sen"),c.initialize(a,"Ichimoku Chikou Span"),h.initialize(a,"Ichimoku Senkou Span B"),u.initialize(a,"Ichimoku Senkou Span A"),a+=1;0<=a;a--){for(var f=p.value(a),m=d.value(a),v=t.value(a),g=null,y=null,_=null,S=0;S<n&&0<=a-S;S++)var b=S+1,f=Math.min(f,p.value(a-S)),m=Math.max(m,d.value(a-S)),g=b===i?(f+m)/2:g,y=b===r?(f+m)/2:y,_=b===n?(f+m)/2:_
f=null!==g&&null!==y?(g+y)/2:null,s.setValue(a,g),l.setValue(a,y),c.setValue(a,v),h.setValue(a,_),u.setValue(a,f)}return o.addField(s),o.addField(l),o.addField(c),o.addField(h),o.addField(u),o},t.prototype.bollingerBands=function(t,i,r,n){var o,a,s,l,c,h,u,d=new e.MovingAverage
if(l=t.recordCount,n<e.Const.mA_START||n>e.Const.mA_END||1>i||i>l||0>r||100<r)return null
for(o=new e.Field,o.initialize(l,"Bollinger Band Bottom"),a=new e.Field,a.initialize(l,"Bollinger Band Top"),n=d.movingAverageSwitch(t,i,n,"Bollinger Band Median"),c=d=s=i+1;c<l+1;c++){for(h=0,u=n.value("Bollinger Band Median",d),s=1;s<i+1;s++)h+=(t.value(d)-u)*(t.value(d)-u),d--
d+=i,u=r*Math.sqrt(h/i),o.setValue(d,n.value("Bollinger Band Median",d)-u),a.setValue(d,n.value("Bollinger Band Median",d)+u),d++}return null!=n&&(n.addField(o),n.addField(a)),n},t}()
e.Bands=t}(TASdk||(TASdk={})),function(e){var t=function(){function t(){}return t.prototype.regression=function(t,i){var r,n,o,a,s,l,c,h,u=0,d=new e.Recordset,p=t.recordCount,f=new e.Field
f.initialize(p,"Slope")
var m=new e.Field
m.initialize(p,"Intercept")
var v=new e.Field
v.initialize(p,"Forecast")
var g=new e.Field
g.initialize(p,"RSquared")
for(var y=i;y<p+1;y++){for(r=i,n=Array(r+1),a=y-i+1,l=1;l<i+1;l++)o=t.value(a),n[l]=o,a++
for(h=a=c=l=s=0,o=1;o<r+1;o++)s+=o,l+=n[o],c+=o*o,a+=n[o]*n[o],h+=n[o]*o
o=r,r=h-s*l/o,n=c-s*s/o,a-=l*l/o,s=r/n,l=1/o*l-parseInt(o/2)*s,o=o*s+l,r*r&&n*a&&(u=r*r/(n*a)),y>i&&(f.setValue(y,s),m.setValue(y,l),v.setValue(y,o),g.setValue(y,u))}return d.addField(f),d.addField(m),d.addField(v),d.addField(g),d},t.prototype.timeSeriesForecast=function(e,t,i){var r
return r=this.regression(e,t),r.renameField("Forecast",i),r.removeField("Slope"),r.removeField("Intercept"),r.removeField("RSquared"),r},t}()
e.LinearRegression=t}(TASdk||(TASdk={})),function(e){var t=function(){function t(){}return t.prototype.chandeMomentumOscillator=function(t,i,r){var n,o,a,s,l,c,h,u=new e.Recordset
o=t.recordCount,n=new e.Field,n.initialize(o,r)
var d
for(r=i+2;r<o+2;r++){for(d=r-i,h=c=0,a=1;a<i+1;a++)l=t.value(d-1),s=t.value(d),s>l?c+=s-l:s<l&&(h+=l-s),d++
a=c+h?100*(c-h)/(c+h):e.Const.nullValue,n.setValue(d-1,a)}return u.addField(n),u},t.prototype.TRIX=function(t,i,r){var n,o,a=new e.MovingAverage,s=new e.Recordset
for(n=a.exponentialMovingAverage(t,i,"EMA1"),o=n.getField("EMA1"),n.removeField("EMA1"),n=a.exponentialMovingAverage(o,i,"EMA2"),o=n.getField("EMA2"),n.removeField("EMA2"),n=a.exponentialMovingAverage(o,i,"EMA3"),o=n.getField("EMA3"),n.removeField("EMA3"),i=t.recordCount,t=new e.Field,t.initialize(i,r),r=a=2;r<i+1;r++)(n=o.value(a-1))&&(n=(o.value(a)-n)/n*100,t.setValue(a,n)),a++
return s.addField(t),s},t.prototype.ultimateOscillator=function(t,i,r,n,o){var a,s,l,c,h,u,d,p,f,m,v,g=new e.Recordset
s=t.getFieldByIndex(0).recordCount,a=new e.Field,a.initialize(s,o),o=i,r>o&&(o=r),n>o&&(o=n)
var y
for(o+=2;o<s+2;o++){for(v=m=f=p=d=u=0,y=o-i,l=1;l<i+1;l++)c=t.getField("Low").value(y)<t.getField("Close").value(y-1)?t.getField("Low").value(y):t.getField("Close").value(y-1),c=t.getField("Close").value(y)-c,h=t.getField("High").value(y)-t.getField("Low").value(y),h<t.getField("High").value(y)-t.getField("Close").value(y-1)&&(h=t.getField("High").value(y)-t.getField("Close").value(y-1)),h<t.getField("Close").value(y-1)-t.getField("Low").value(y)&&(h=t.getField("Close").value(y-1)-t.getField("Low").value(y)),u+=c,f+=h,y++
for(y-=r,l=1;l<r+1;l++)c=t.getField("Low").value(y)<t.getField("Close").value(y-1)?t.getField("Low").value(y):t.getField("Close").value(y-1),c=t.getField("Close").value(y)-c,h=t.getField("High").value(y)-t.getField("Low").value(y),h<t.getField("High").value(y)-t.getField("Close").value(y-1)&&(h=t.getField("High").value(y)-t.getField("Close").value(y-1)),h<t.getField("Close").value(y-1)-t.getField("Low").value(y)&&(h=t.getField("Close").value(y-1)-t.getField("Low").value(y)),d+=c,m+=h,y++
for(y-=n,l=1;l<n+1;l++)c=t.getField("Low").value(y)<t.getField("Close").value(y-1)?t.getField("Low").value(y):t.getField("Close").value(y-1),c=t.getField("Close").value(y)-c,h=t.getField("High").value(y)-t.getField("Low").value(y),h<t.getField("High").value(y)-t.getField("Close").value(y-1)&&(h=t.getField("High").value(y)-t.getField("Close").value(y-1)),h<t.getField("Close").value(y-1)-t.getField("Low").value(y)&&(h=t.getField("Close").value(y-1)-t.getField("Low").value(y)),p+=c,v+=h,y++
l=(u/f*4+d/m*2+p/v)/7*100,a.setValue(y-1,l)}return g.addField(a),g},t.prototype.verticalHorizontalFilter=function(t,i,r){var n,o,a,s,l,c,h,u,d=new e.Recordset
for(a=t.recordCount,n=new e.Field,n.initialize(a,r),r=o=i+2;o<a+2;o++){for(l=0,c=t.value(r),r=o-i,s=1;s<i+1;s++)t.value(r)<c?c=t.value(r):t.value(r)>l&&(l=t.value(r)),r++
for(h=0,r=o-i,s=1;s<i+1;s++)u=t.value(r)-t.value(r-1),0>u&&(u*=-1),h+=u,r++
u=(l-c)/h,0>u&&(u*=-1),n.setValue(r-1,u)}return d.addField(n),d},t.prototype.williamsPctR=function(t,i,r){var n,o,a,s,l,c,h=new e.Recordset
for(a=t.getFieldByIndex(0).recordCount,n=new e.Field,n.initialize(a,r),r=o=i+2;o<a+2;o++){for(l=0,c=t.getField("Low").value(r),r=o-i,s=1;s<i+1;s++)t.getField("High").value(r)>l&&(l=t.getField("High").value(r)),t.getField("Low").value(r)<c&&(c=t.getField("Low").value(r)),r++
n.setValue(r-1,(l-t.getField("Close").value(r-1))/(l-c)*-100)}return h.addField(n),h},t.prototype.williamsAccumulationDistribution=function(t,i){var r,n,o,a,s,l=new e.Recordset
n=t.getFieldByIndex(0).recordCount,r=new e.Field,r.initialize(n,i)
var c=2
for(o=1;o<n;o++)a=t.getField("Close").value(c-1),t.getField("High").value(c)>a&&(a=t.getField("High").value(c)),s=t.getField("Close").value(c-1),t.getField("Low").value(c)<s&&(s=t.getField("Low").value(c)),a=t.getField("Close").value(c)>t.getField("Close").value(c-1)?t.getField("Close").value(c)-s:t.getField("Close").value(c)<t.getField("Close").value(c-1)?t.getField("Close").value(c)-a:0,r.setValue(c,a+r.value(c-1)),c++
return l.addField(r),l},t.prototype.volumeOscillator=function(t,i,r,n,o){var a,s,l=new e.MovingAverage,c=new e.Recordset,h=0
for(s=t.recordCount,a=new e.Field,a.initialize(s,o),i=l.simpleMovingAverage(t,i,"MA1"),t=l.simpleMovingAverage(t,r,"MA2"),r=l=1;r<s+1;r++)1===n?h=i.getField("MA1").value(l)-t.getField("MA2").value(l):2===n&&0<t.getField("MA2").value(l)&&(h=(i.getField("MA1").value(l)-t.getField("MA2").value(l))/t.getField("MA2").value(l)*100),a.setValue(r,h),l++
return c.addField(a),c},t.prototype.chaikinVolatility=function(t,i,r,n,o){var a,s,l,c,h=new e.MovingAverage,u=new e.Recordset,d=0
for(c=t.getFieldByIndex(0).recordCount,a=new e.Field,a.initialize(c,o),s=new e.Field,s.initialize(c,"HL"),l=o=1;l<c+1;l++)s.setValue(o,t.getField("High").value(o)-t.getField("Low").value(o)),o++
for(t=h.movingAverageSwitch(s,i,n,"HLMA"),o=l=r+1;l<c+1;l++)i=t.getField("HLMA").value(o-r),n=t.getField("HLMA").value(o),i&&n&&(d=(i-n)/i*-100),a.setValue(l,d),o++
return u.addField(a),u},t.prototype.stochasticOscillator=function(t,i,r,n,o){var a,s,l,c,h,u,d=new e.MovingAverage,p=null,f=new e.Recordset
l=t.getFieldByIndex(0).recordCount,a=new e.Field,a.initialize(l,"%K")
var m
for(s=i+2;s<l+2;s++){for(m=s-i,u=t.getField("High").value(m),h=t.getField("Low").value(m),c=1;c<i+1;c++)t.getField("High").value(m)>u&&(u=t.getField("High").value(m)),t.getField("Low").value(m)<h&&(h=t.getField("Low").value(m)),m++
c=(t.getField("Close").value(m-1)-h)/(u-h)*100,a.setValue(m-1,c)}return 1<r?f=d.movingAverageSwitch(a,r,o,"%K"):f.addField(a),a=f.getField("%K"),p=d.movingAverageSwitch(a,n,o,"%D"),null!=p&&(f.addField(p.getField("%D")),p.removeField("%D")),f},t.prototype.priceOscillator=function(t,i,r,n,o){var a,s,l=new e.Recordset,c=new e.MovingAverage
if(i<=r)return l
for(s=t.recordCount,a=new e.Field,a.initialize(s,o),o=c.movingAverageSwitch(t,i,n,"MA"),t=c.movingAverageSwitch(t,r,n,"MA"),i=r=i>r?i:r>i?r:i;r<s+1;r++)n=o.value("MA",i),n=0==n?0:(t.value("MA",i)-o.value("MA",i))/n*100,a.setValue(i,n),i++
return l.addField(a),l},t.prototype.easeOfMovement=function(t,i,r,n){var o,a,s,l,c,h=new e.MovingAverage,u=new e.Recordset,d=null,p=0
a=t.getFieldByIndex(0).recordCount,o=new e.Field,o.initialize(a,n)
var f=2
for(s=2;s<a+1;s++)l=(t.value("High",f)+t.value("Low",f))/2-(t.value("High",f-1)+t.value("Low",f-1))/2,(c=t.value("High",f)-t.value("Low",f))&&(p=t.value("Volume",f)/c),l/=p,o.setValue(f,1e4*l),f++
return d=h.movingAverageSwitch(o,i,r,"MA"),null!=d&&(o=d.getField("MA"),o.name=n,d.removeField(n)),u.addField(o),u},t.prototype.detrendedPriceOscillator=function(t,i,r,n){var o,a,s=new e.MovingAverage,l=new e.Recordset
for(a=t.recordCount,o=new e.Field,o.initialize(a,n),r=s.movingAverageSwitch(t,i,r,"MA"),n=s=i+1;s<a+1;s++)o.setValue(n,t.value(n)-r.value("MA",n-(i/2+1))),n++
return l.addField(o),l},t.prototype.parabolicSAR=function(t,i,r,n,o){var a,s,l,c,h,u,d,p,f,m=new e.Recordset,v=0,g=0
for(s=t.recordCount,a=new e.Field,a.initialize(s,o),c=t.value(1),l=i.value(1),t.value(2)-t.value(1)<i.value(2)-i.value(1)?(g=c,v=-1):(g=l,v=1),o=r,h=g,d=l,p=c,f=d,u=r,l=2;l<s+1;++l)1===v?(t.value(l)>c&&(c=t.value(l),u<n&&(u+=r)),h=g+o*(p-g),i.value(l)<h&&(v=-1,u=r,h=p,c=0,d=i.value(l))):-1===v&&(i.value(l)<d&&(d=i.value(l),u<n&&(u+=r)),h=g+o*(f-g),t.value(l)>h&&(v=1,u=r,h=f,d=0,c=t.value(l))),p=c,f=d,g=h,o=u,a.setValue(l,h)
return m.addField(a),m},t.prototype.directionalMovementSystem=function(t,i){var r,n,o,a,s,l
r=new e.MovingAverage
var c,h,u,d,p=new e.Recordset,f=new e.Recordset
for(u=t.getFieldByIndex(0).recordCount,s=this.trueRange(t,"TR"),a=s.getField("TR"),s.removeField("TR"),l=r.wellesWilderSmoothing(a,i,"TRSum"),o=new e.Field,o.initialize(u,"UpDMI"),n=new e.Field,n.initialize(u,"DnDMI"),a=new e.Field,a.initialize(u,"DI-"),s=new e.Field,s.initialize(u,"DI+"),d=2;d<u+1;++d)c=t.value("High",d)-t.value("High",d-1),h=t.value("Low",d-1)-t.value("Low",d),0>c&&0>h||c===h?(o.setValue(d,0),n.setValue(d,0)):c>h?(o.setValue(d,c),n.setValue(d,0)):c<h&&(o.setValue(d,0),n.setValue(d,h))
for(o=r.wellesWilderSmoothing(o,i,"DM+Sum"),r=r.wellesWilderSmoothing(n,i,"DM-Sum"),d=2;d<u+1;++d)s.setValue(d,100*o.value("DM+Sum",d)/l.value("TRSum",d)),a.setValue(d,100*r.value("DM-Sum",d)/l.value("TRSum",d))
for(r=new e.Field,r.initialize(u,"DX"),d=2;d<u+1;++d)n=Math.abs(parseInt(s.value(d)-a.value(d))),o=s.value(d)+a.value(d),0<n&&0<o&&r.setValue(d,n/o*100)
for(n=new e.Field,n.initialize(u,"ADX"),f.addField(n),o=0,d=i+1;d<u+1&&d<=2*i;++d)o+=r.value(d)
for(n.setValue(2*i,o/i),d=2*i+1;d<u+1;++d)o=(n.value(d-1)*(i-1)+r.value(d))/i,n.setValue(d,o)
for(n=new e.Field,n.initialize(u,"ADXR"),d=2*i+1;d<u+1;++d)n.setValue(d,(f.value("ADX",d)+f.value("ADX",d-1))/2)
return p.addField(f.getField("ADX")),p.addField(n),p.addField(r),p.addField(l.getField("TRSum")),p.addField(a),p.addField(s),f.removeField("ADX"),f.removeField("ADXF"),l.removeField("TRSum"),p},t.prototype.rainbowOscillator=function(t,i,r,n){var o,a,s,l,c,h=new e.MovingAverage,u=new e.Recordset
for(a=t.recordCount,o=new e.Field,o.initialize(a,n),l=2;l<i+1;++l)for(n=h.movingAverageSwitch(t,i,r,"MA"),s=1;s<a+1;++s)c=n.value("MA",s),o.setValue(s,t.value(s)-c+o.value(s))
for(s=1;s<a+1;++s)o.value(s),o.setValue(s,o.value(s)/i)
return u.addField(o),u},t.prototype.fractalChaosOscillator=function(t,i,r){i=new e.Recordset
var n=t.getFieldByIndex(0).recordCount,o=t.getField("High"),a=t.getField("Low"),s=new e.Field
s.initialize(n,"FR")
var l=new e.Field
l.initialize(n,"High 1")
var c=new e.Field
c.initialize(n,"High 2")
var h=new e.Field
h.initialize(n,"High 3")
var u=new e.Field
u.initialize(n,"High 4")
var d=new e.Field
d.initialize(n,"Low 1")
var p=new e.Field
p.initialize(n,"Low 2")
var f=new e.Field
f.initialize(n,"Low 3")
var m=new e.Field
for(m.initialize(n,"Low 4"),t=5;t<n+1;++t)l.setValue(t,o.value(t-4)),d.setValue(t,a.value(t-4)),c.setValue(t,o.value(t-3)),p.setValue(t,a.value(t-3)),h.setValue(t,o.value(t-2)),f.setValue(t,a.value(t-2)),u.setValue(t,o.value(t-1)),m.setValue(t,a.value(t-1))
for(t=2;t<n+1;++t)h.value(t)>l.value(t)&&h.value(t)>c.value(t)&&h.value(t)>=u.value(t)&&h.value(t)>=o.value(t)&&s.setValue(t,1),f.value(t)<d.value(t)&&f.value(t)<p.value(t)&&f.value(t)<=m.value(t)&&f.value(t)<=a.value(t)&&s.setValue(t,-1)
return s.name=r,i.addField(s),i},t.prototype.primeNumberOscillator=function(t,i){var r,n=new e.Recordset,o=t.recordCount,a=new e.Field
a.initialize(o,i)
var s,l,c=new e.General,h=0,u=0
for(r=1;r<o+1;++r){for(l=t.value(r),10>l&&(l*=10),s=l;1<s;--s)if(c.isPrime(s)){u=s
break}for(s=l;s<2*l;++s)if(c.isPrime(s)){h=s
break}Math.abs(l-h)<Math.abs(l-u)?a.setValue(r,l-h):a.setValue(r,l-u)}return n.addField(a),n},t.prototype.elderRay=function(t,i,r,n){var o=new e.Recordset,a=t.getFieldByIndex(0).recordCount
1>i&&(i=13)
var s=new e.Field,l=new e.Field
s.initialize(a,n+" Bull Power"),l.initialize(a,n+" Bear Power")
var c=t.getField("Close")
for(n=t.getField("High"),t=t.getField("Low"),r=(new e.MovingAverage).movingAverageSwitch(c,i,r,"ema").getField("ema"),i+=1;i<a+1;i++)s.setValue(i,n.value(i)-r.value(i)),l.setValue(i,r.value(i)-t.value(i))
return o.addField(s),o.addField(l),o},t.prototype.ehlerFisherTransform=function(t,i,r){var n=new e.Recordset
1>i&&(i=10)
var o=t.getFieldByIndex(0).recordCount,a=new e.Field
a.initialize(o,r)
var s=new e.Field
s.initialize(o,r+" Trigger")
var l=new e.General
t=l.medianPrice(t,"price").getField("price"),r=l.HHV(t,i,"maxh").getField("maxh"),i=l.LLV(t,i,"minl").getField("minl")
for(var c,l=c=0,h=1;h<o+1;h++){var u=r.value(h),d=i.value(h)
c=u!==d?.66*((t.value(h)-d)/(u-d)-.5)+.67*c:0,.99<c&&(c=.999),-.99>c&&(c=-.999),u=.5*Math.log((1+c)/(1-c))+.5*l,a.setValue(h,u),s.setValue(h,l),l=u}return n.addField(a),n.addField(s),n},t.prototype.schaffTrendCycle=function(i,r,n,o,a,s){var l=new e.Recordset,c=i.recordCount,h=new e.Field
h.initialize(c,"x")
var u=new e.Field
u.initialize(c,"x")
var d=new e.Field
d.initialize(c,"x")
var p=new e.Field
for(p.initialize(c,s),s=new e.General,o=(new t).MACD(i,2,o,n,a,"x").getField("x"),a=s.LLV(o,r,"x").getField("x"),i=s.HHV(o,r,"x").getField("x"),n=1;n<c+1;++n)i.setValue(n,i.value(n)-a.value(n))
for(n=2;n<c+1;++n)0<i.value(n)?h.setValue(n,(o.value(n)-a.value(n))/i.value(n)*100):h.setValue(n,h.value(n-1)),d.setValue(n,d.value(n-1)+.5*(h.value(n)-d.value(n-1)))
for(h=s.LLV(d,r,"x").getField("x"),r=s.HHV(d,r,"x").getField("x"),n=1;n<c+1;++n)r.setValue(n,r.value(n)-h.value(n))
for(n=2;n<c+1;++n)0<i.value(n)?u.setValue(n,(d.value(n)-h.value(n))/r.value(n)*100):u.setValue(n,u.value(n-1)),p.setValue(n,p.value(n-1)+.5*(u.value(n)-p.value(n-1)))
return l.addField(p),l},t.prototype.centerOfGravity=function(t,i,r){var n=new e.Recordset,o=t.recordCount,a=new e.Field
for(a.initialize(o,r),r=i+1;r<o+1;++r){for(var s=0,l=0,c=1,h=r-1;h>r-i;--h)s+=t.value(h)*(c+1),l+=t.value(h),c++
a.setValue(r,-1*s/l)}return n.addField(a),n},t.prototype.coppockCurve=function(t,i){var r=(new e.Recordset,t.recordCount),n=new e.Field
n.initialize(r,i)
for(var o=new e.General,a=o.priceROC(t,14,"x").getField("x"),o=o.priceROC(t,11,"x").getField("x"),s=1;s<r+1;++s)n.setValue(s,a.value(s)+o.value(s))
return(new e.MovingAverage).weightedMovingAverage(n,10,i)},t.prototype.chandeForecastOscillator=function(t,i,r){var n=new e.Recordset,o=t.recordCount,a=new e.Field
a.initialize(o,r),r=(new e.LinearRegression).timeSeriesForecast(t,i,"x").getField("x")
for(var s=1;s<o+1;++s)a.setValue(s,(t.value(s)-r.value(s))/t.value(s)*100)
for(s=1;s<i+1;++s)a.setValue(s,0)
return n.addField(a),n},t.prototype.klingerVolumeOscillator=function(i,r,n,o,a,s){var l=(new e.Recordset,i.getFieldByIndex(0).recordCount);(new e.Field).initialize(l,s)
var c=i.getField("Volume")
i=(new e.General).typicalPrice(i,"x").getField("x")
var h=new e.Field
h.initialize(l,"sv")
for(var u=2;u<l+1;u++)i.value(u)>=i.value(u-1)?h.setValue(u,c.value(u)):h.setValue(u,-1*c.value(u))
return(new t).MACD(h,r,n,o,a,s)},t.prototype.prettyGoodOscillator=function(t,i,r){var n=new e.Recordset,o=t.getFieldByIndex(0).recordCount,a=new e.Field
a.initialize(o,r),r=t.getField("Close"),(new e.Field).initialize(o,"sv")
var s=new e.MovingAverage,l=s.simpleMovingAverage(t.getField("Close"),i,"x").getField("x")
for(t=this.trueRange(t,"x").getField("x"),t=s.exponentialMovingAverage(t,i,"x").getField("x"),s=2;s<o+1;s++)0!=t.value(s)?a.setValue(s,(r.value(s)-l.value(s))/t.value(s)):a.setValue(0,null)
for(s=1;s<i+1;++s)a.setValue(s,0)
return n.addField(a),n},t.prototype.momentum=function(t,i,r){var n,o,a,s,l=new e.Recordset
for(o=t.recordCount,n=new e.Field,n.initialize(o,r),r=a=i+2;a<o+1;a++)s=t.value(r-i),s=100+(t.value(r)-s)/s*100,n.setValue(r,s),r++
return l.addField(n),l},t.prototype.aroon=function(t,i){var r,n,o,a,s,l,c,h,u,d,p=new e.Recordset
for(a=t.getFieldByIndex(0).recordCount,r=new e.Field,r.initialize(a,"Aroon Up"),n=new e.Field,n.initialize(a,"Aroon Down"),o=new e.Field,o.initialize(a,"Aroon Oscillator"),s=i+1;s<a+1;++s){for(c=t.value("High",s),h=t.value("Low",s),d=u=s,l=s-i;l<s;++l)t.value("High",l)>c&&(c=t.value("High",l),u=l),t.value("Low",l)<h&&(h=t.value("Low",l),d=l)
r.setValue(s,(i-(s-u))/i*100),n.setValue(s,(i-(s-d))/i*100),o.setValue(s,r.value(s)-n.value(s))}return p.addField(r),p.addField(n),p.addField(o),p},t.prototype.trueRange=function(t,i){var r,n,o,a,s,l,c,h=new e.Recordset
for(n=t.getFieldByIndex(0).recordCount,r=new e.Field,r.initialize(n,i),o=2;o<n+1;++o)a=t.value("High",o)-t.value("Low",o),s=Math.abs(t.value("High",o)-t.value("Close",o-1)),l=Math.abs(t.value("Close",o-1)-t.value("Low",o)),c=0,a>c&&(c=a),s>c&&(c=s),l>c&&(c=l),r.setValue(o,c)
return r.name=i,h.addField(r),h},t.prototype.MACD=function(t,i,r,n,o,a){var s,l,c,h,u=new e.Recordset,d=new e.MovingAverage
for(c=t.recordCount,s=new e.Field,s.initialize(c,a),r=d.movingAverageSwitch(t,r,o,"MA"),t=d.movingAverageSwitch(t,n,o,"MA"),n=1;n<c+1;n++)h=t.value("MA",n)-r.value("MA",n),s.setValue(n,h)
return r=d.movingAverageSwitch(s,i,o,"MA"),l=r.getField("MA"),l.name=a+"Signal",u.addField(s),u.addField(l),r.removeField(a+"Signal"),u},t.prototype.macdHistogram=function(t,i,r,n,o,a){var s,l,c,h=new e.Recordset,u=new e.MovingAverage
for(c=t.recordCount,s=new e.Field,s.initialize(c,a),r=u.movingAverageSwitch(t,r,o,"MA"),l=u.movingAverageSwitch(t,n,o,"MA"),t=1;t<c+1;t++)n=l.value("MA",t)-r.value("MA",t),s.setValue(t,n)
for(r=u.movingAverageSwitch(s,i,o,"MA"),i=r.getField("MA"),i.name=a+"Signal",o=new e.Field,o.initialize(c,a),t=1;t<c+1;t++)n=s.value(t)-i.value(t),o.setValue(t,n)
return h.addField(o),r.removeField(a+"Signal"),h},t}()
e.Oscillator=t}(TASdk||(TASdk={})),function(e){var t=function(){function t(){}return t.prototype.highMinusLow=function(t,i){var r,n,o,a,s=new e.Recordset
for(o=t.getFieldByIndex(0).recordCount,r=new e.Field,r.initialize(o,i),n=1;n<o+1;n++)a=t.getField("High").value(n)-t.getField("Low").value(n),r.setValue(n,a)
return s.addField(r),s},t.prototype.medianPrice=function(t,i){var r,n,o,a,s=new e.Recordset
for(o=t.getFieldByIndex(0).recordCount,r=new e.Field,r.initialize(o,i),n=1;n<o+1;n++)a=(t.getField("High").value(n)+t.getField("Low").value(n))/2,r.setValue(n,a)
return s.addField(r),s},t.prototype.typicalPrice=function(t,i){var r,n,o,a,s=new e.Recordset
for(o=t.getFieldByIndex(0).recordCount,r=new e.Field,r.initialize(o,i),n=1;n<o+1;n++)a=(t.getField("High").value(n)+t.getField("Low").value(n)+t.getField("Close").value(n))/3,r.setValue(n,a)
return s.addField(r),s},t.prototype.weightedClose=function(t,i){var r,n,o,a,s=new e.Recordset
for(o=t.getFieldByIndex(0).recordCount,r=new e.Field,r.initialize(o,i),n=1;n<o+1;n++)a=(t.getField("High").value(n)+t.getField("Low").value(n)+2*t.getField("Close").value(n))/4,r.setValue(n,a)
return s.addField(r),s},t.prototype.volumeROC=function(t,i,r){var n,o,a,s,l=new e.Recordset,c=0
for(a=t.recordCount,n=new e.Field,n.initialize(a,r),r=o=i+1;o<a+1;o++)(s=t.value(r-i))&&(c=(t.value(r)-s)/s*100),n.setValue(o,c),r++
return l.addField(n),l},t.prototype.priceROC=function(t,i,r){var n,o,a,s,l=new e.Recordset
for(a=t.recordCount,n=new e.Field,n.initialize(a,r),r=o=i+1;o<a+1;o++)s=t.value(r-i),s=(t.value(r)-s)/s*100,n.setValue(o,s),r++
return l.addField(n),l},t.prototype.correlationAnalysis=function(e,t){var i,r,n,o,a=0
for(r=e.recordCount,i=2;i<r+1;i++)n=e.value(i)-e.value(i-1),o=t.value(i)-t.value(i-1),0>n&&(n*=-1),0>o&&(o*=-1),a+=n*o
return 1-(a/=r-2)},t.prototype.HHV=function(t,i,r){var n,o,a=new e.Recordset
new e.MovingAverage
var s
for(o=t.recordCount,n=new e.Field,n.initialize(o,r),r=i+1;r<=o;++r){s=t.value(r)
for(var l=r;l>r-i-1;--l)t.value(l)>s&&(s=t.value(l))
n.setValue(r,s)}return a.addField(n),a},t.prototype.LLV=function(t,i,r){var n,o,a=new e.Recordset
new e.MovingAverage
var s
for(o=t.recordCount,n=new e.Field,n.initialize(o,r),r=i+1;r<=o;++r){s=t.value(r)
for(var l=r;l>r-i-1;--l)t.value(l)<s&&(s=t.value(l))
n.setValue(r,s)}return a.addField(n),a},t.prototype.isPrime=function(e){var t,i,r
if(3<e&&!(e%2&&e%3))return!1
for(t=5,i=2,r=Math.sqrt(e)+1;t<=r;){if(!(e%t))return!1
t+=i,i=6-i}return!0},t.prototype.standardDeviation=function(t,i,r,n,o){var a,s,l,c,h,u=new e.MovingAverage
for(s=t.recordCount,a=new e.Field,a.initialize(s,o),n=u.movingAverageSwitch(t,i,n,"Temp"),l=o=u=i+1;l<s+1;l++){for(c=0,h=n.value("Temp",o),u=1;u<i+1;u++)c+=(t.value(o)-h)*(t.value(o)-h),o--
o+=i,h=r*Math.sqrt(c/i),a.setValue(o,h),o++}return null!=n&&n.addField(a),n.removeField("Temp"),n},t}()
e.General=t}(TASdk||(TASdk={})),function(e){var t=function(){function t(){}return t.prototype.moneyFlowIndex=function(t,i,r){var n,o,a,s,l,c,h,u=new e.Recordset,d=0,p=0,f=0
if(d=t.getFieldByIndex(0).recordCount,1>i||i>d)return null
n=new e.Field,n.initialize(d,r)
var m
for(r=i+2;r<d+2;r++){for(h=c=0,m=r-i,o=1;o<i+1;o++)m--,a=(t.getField("High").value(m)+t.getField("Low").value(m)+t.getField("Close").value(m))/3,m++,l=t.getField("Volume").value(m),1>l&&(l=1),s=(t.getField("High").value(m)+t.getField("Low").value(m)+t.getField("Close").value(m))/3,s>a?c+=s*l:s<a&&(h+=s*l),m++
m--,c&&h&&(f=c/h,p=100-100/(1+f),n.setValue(m,p))}return u.addField(n),u},t.prototype.tradeVolumeIndex=function(t,i,r,n){var o,a,s,l=new e.Recordset,c=0,h=0,u=0
a=t.recordCount,o=new e.Field,o.initialize(a,n)
var d=2
for(n=2;n<a+1;n++)s=t.value(d)-t.value(d-1),s>r?c=1:s<-r&&(c=-1),s<=r&&s>=-r&&(c=h),h=c,1===c?u+=i.value(d):-1===c&&(u-=i.value(d)),u/=1e4,o.setValue(d,u),d++
return l.addField(o),l},t.prototype.swingIndex=function(t,i,r){var n,o,a,s,l,c,h,u,d,p,f,m,v=new e.Recordset,g=0
if(o=t.getFieldByIndex(0).recordCount,0>=i)return null
n=new e.Field,n.initialize(o,r)
var y=2
for(r=2;r<o+1;r++)l=t.getField("Open").value(y-1),c=t.getField("Open").value(y),t.getField("High").value(y-1),h=t.getField("High").value(y),t.getField("Low").value(y-1),u=t.getField("Low").value(y),a=t.getField("Close").value(y-1),s=t.getField("Close").value(y),d=Math.abs(h-a)>Math.abs(u-a)?Math.abs(h-a):Math.abs(u-a)>Math.abs(h-a)?Math.abs(u-a):Math.abs(h-a),p=Math.abs(h-a),f=Math.abs(u-a),m=Math.abs(h-u),p>f&&p>m?g=Math.abs(h-a)-.5*Math.abs(u-a)+.25*Math.abs(a-l):f>p&&f>m?g=Math.abs(u-a)-.5*Math.abs(h-a)+.25*Math.abs(a-l):m>p&&m>f&&(g=Math.abs(h-u)+.25*Math.abs(a-l)),a=0<g&&0<i?50*(s-a+.5*(s-c)+.25*(a-l))/g*d/i:0,n.setValue(y,a),y++
return v.addField(n),v},t.prototype.accumulativeSwingIndex=function(i,r,n){var o,a=new e.Recordset,s=new t
o=i.getFieldByIndex(0).recordCount,i=s.swingIndex(i,r,"SI"),r=new e.Field,r.initialize(o,n)
var l=2
for(n=2;n<o+1;n++)s=i.value("SI",l)+r.value(l-1),r.setValue(l,s),l++
return a.addField(r),a},t.prototype.comparativeRelativeStrength=function(t,i,r){var n,o,a,s=new e.Recordset
o=t.recordCount,n=new e.Field,n.initialize(o,r)
var l=1
for(r=1;r<o+1;r++)a=t.value(l)/i.value(l),1===a&&(a=e.Const.nullValue),n.setValue(l,a),l++
return s.addField(n),s},t.prototype.priceVolumeTrend=function(t,i,r){var n,o,a,s=new e.Recordset
o=t.recordCount,n=new e.Field,n.initialize(o,r)
var l=2
for(r=2;r<o+1;r++)a=(t.value(l)-t.value(l-1))/t.value(l-1)*i.value(l)+n.value(l-1),a/=1e4,n.setValue(l,a),l++
return s.addField(n),s},t.prototype.positiveVolumeIndex=function(t,i,r){var n,o,a,s=new e.Recordset
o=t.recordCount,n=new e.Field,n.initialize(o,r)
var l=2
for(n.setValue(1,1),r=2;r<o+1;r++)a=i.value(l)>i.value(l-1)?n.value(l-1)+(t.value(l)-t.value(l-1))/t.value(l-1)*n.value(l-1):n.value(l-1),n.setValue(l,a),l++
return s.addField(n),s},t.prototype.negativeVolumeIndex=function(t,i,r){var n,o,a,s=new e.Recordset
o=t.recordCount,n=new e.Field,n.initialize(o,r)
var l=2
for(n.setValue(1,1),r=2;r<o+1;r++)a=i.value(l)<i.value(l-1)?n.value(l-1)+(t.value(l)-t.value(l-1))/t.value(l-1)*n.value(l-1):n.value(l-1),n.setValue(l,a),l++
return s.addField(n),s},t.prototype.performance=function(t,i){var r,n,o,a,s,l=new e.Recordset
n=t.recordCount,r=new e.Field,r.initialize(n,i)
var c=2
for(a=t.value(1),o=2;o<n+1;o++)s=(t.value(c)-a)/a*100,r.setValue(c,s),c++
return l.addField(r),l},t.prototype.massIndex=function(t,i,r){var n,o,a=new e.Recordset,s=new e.General
o=new e.MovingAverage
var l,c=0
if(c=t.getFieldByIndex(0).recordCount,1>i||i>c)return null
n=new e.Field,n.initialize(c,r),r=s.highMinusLow(t,"HML").getField("HML"),t=o.exponentialMovingAverage(r,9,"EMA"),r=t.getField("EMA"),o=o.exponentialMovingAverage(r,9,"EMA")
var h
for(r=2*i+1;r<c+2;r++){for(l=0,h=r-i,s=1;s<i+1;s++){var u=o.value("EMA",h)
0!=u&&(l+=t.value("EMA",h)/u),h++}h--,n.setValue(h,l)}return a.addField(n),a},t.prototype.chaikinMoneyFlow=function(t,i,r){var n,o,a,s,l,c,h,u=new e.Recordset
for(o=t.getFieldByIndex(0).recordCount,n=new e.Field,n.initialize(o,r),r=i+1;r<o+1;r++){for(var d=a=s=l=0;d<i;++d)c=t.value("Close",r-d)-t.value("Low",r-d)-(t.value("High",r-d)-t.value("Close",r-d)),h=t.value("High",r-d)-t.value("Low",r-d),0!=c&&0!=h&&(a=c/h),s+=a*t.value("Volume",r-d),l+=t.value("Volume",r-d)
a=s/l,n.setValue(r,a)}return u.addField(n),u},t.prototype.commodityChannelIndex=function(t,i,r){var n,o,a=new e.General
n=new e.MovingAverage
var s,l,c,h=new e.Recordset
for(l=t.getFieldByIndex(0).recordCount,o=new e.Field,o.initialize(l,r),t=a.typicalPrice(t,"TP"),n=n.simpleMovingAverage(t.getField("TP"),i,"TPMA"),c=1;c<2*i+1;++c)o.setValue(c,0)
for(c=2*i;c<l+1;++c){for(r=0,s=c-i+1;s<c+1;++s)a=Math.abs(t.getField("TP").value(s)-n.getField("TPMA").value(c)),r+=a
r/=i,a=(t.getField("TP").value(c)-n.getField("TPMA").value(c))/(.015*r),o.setValue(c,a)}return h.addField(o),h},t.prototype.stochasticMomentumIndex=function(t,i,r,n,o,a,s){s=new e.MovingAverage
var l,c,h,u,d,p,f,m=new e.Recordset,v=new e.General,g=0,y=null
for(r+=1,c=t.getFieldByIndex(0).recordCount,f=new e.Field,f.initialize(c,"%K"),l=v.HHV(t.getField("High"),i,"HHV"),u=new e.Field,u.initialize(c,"HHV"),l.copyField(u,"HHV"),l=v.LLV(t.getField("Low"),i,"LLV"),h=new e.Field,h.initialize(c,"LLV"),l.copyField(h,"LLV"),p=new e.Field,p.initialize(c,"HHLL"),v=1;v<c+1;++v)g=u.value(v)-h.value(v),p.setValue(v,g)
for(d=new e.Field,d.initialize(c,"CHHLL"),v=1;v<c+1;++v)g=t.value("Close",v)-.5*(u.value(v)+h.value(v)),d.setValue(v,g)
for(1<r&&(l=s.movingAverageSwitch(d,r,a,"CHHLL"),l.copyField(d,"CHHLL")),1<n&&(l=s.movingAverageSwitch(d,n,a,"CHHLL"),l.copyField(d,"CHHLL")),1<r&&(l=s.movingAverageSwitch(p,r,a,"HHLL"),l.copyField(p,"HHLL")),1<n&&(l=s.movingAverageSwitch(p,n,a,"HHLL"),l.copyField(p,"HHLL")),v=i+1;v<c+1;++v)d.value(v),p.value(v),t=d.value(v),i=.5*p.value(v),t!==i&&i&&(g=t/i*100),f.setValue(v,g)
return 1<o&&(l=s.movingAverageSwitch(f,o,a,"%D"),y=new e.Field,y.initialize(c,"%D"),l.copyField(y,"%D"),m.addField(y)),m.addField(f),m},t.prototype.elderForceIndex=function(t,i){var r=new e.Recordset,n=t.getFieldByIndex(0).recordCount,o=new e.Field
o.initialize(n,i)
for(var a=t.getField("Close"),s=t.getField("Volume"),l=2;l<n+1;l++)o.setValue(l,(a.value(l-1)-a.value(l))*s.value(l))
return r.addField(o),r},t.prototype.elderThermometer=function(t,i){var r=new e.Recordset,n=t.getFieldByIndex(0).recordCount,o=new e.Field
o.initialize(n,i)
for(var a=t.getField("High"),s=t.getField("Low"),l=2;l<n+1;l++){var c=Math.abs(a.value(l)-a.value(l-1)),h=Math.abs(s.value(l-1)-s.value(l))
o.setValue(l,Math.max(c,h))}return r.addField(o),r},t.prototype.marketFacilitationIndex=function(t,i){var r=new e.Recordset,n=t.getFieldByIndex(0).recordCount,o=new e.Field
o.initialize(n,i)
for(var a=t.getField("High"),s=t.getField("Low"),l=t.getField("Volume"),c=2;c<n+1;c++)o.setValue(c,(a.value(c)-s.value(c))/(l.value(c)/1e8))
return r.addField(o),r},t.prototype.qStick=function(t,i,r,n){var o=(new e.Recordset,t.getFieldByIndex(0).recordCount),a=new e.Field
a.initialize(o,n)
var s=t.getField("High")
t=t.getField("Low")
for(var l=1;l<o+1;l++)a.setValue(l,s.value(l)-t.value(l))
return(new e.MovingAverage).movingAverageSwitch(a,i,r,n)},t.prototype.gopalakrishnanRangeIndex=function(t,i,r){var n=new e.Recordset,o=t.getFieldByIndex(0).recordCount,a=new e.Field
a.initialize(o,r)
var s=new e.General
for(r=s.HHV(t.getField("High"),i,"x").getField("x"),t=s.LLV(t.getField("Low"),i,"x").getField("x"),s=1;s<o+1;s++)a.setValue(s,Math.log(r.value(s)-t.value(s))/Math.log(i))
for(s=1;s<i+1;s++)a.setValue(s,0)
return n.addField(a),n},t.prototype.intradayMomentumIndex=function(t,i){var r=new e.Recordset,n=t.getFieldByIndex(0).recordCount,o=new e.Field
o.initialize(n,i)
for(var a=t.getField("Open"),s=t.getField("Close"),l=0,c=0,h=0,u=0,d=2;d<n+1;d++)s.value(d)>a.value(d)?l=h+(s.value(d)-a.value(d)):c=u+(a.value(d)-s.value(d)),o.setValue(d,l/(l+c)*100),h=l,u=c
return r.addField(o),r},t.prototype.RAVI=function(t,i,r,n){var o=new e.Recordset,a=t.recordCount,s=new e.Field
for(s.initialize(a,n),n=new e.MovingAverage,i=n.VIDYA(t,i,.65,"x").getField("x"),t=n.VIDYA(t,r,.65,"x").getField("x"),n=1;n<a+1;n++)s.setValue(n,Math.abs(i.value(n)-t.value(n))/t.value(n)*100)
for(n=1;n<r+1;n++)s.setValue(n,0)
return o.addField(s),o},t.prototype.randomWalkIndex=function(t,i,r){var n=new e.Recordset,o=t.getFieldByIndex(0).recordCount,a=new e.Field
a.initialize(o,r+" High")
var s=new e.Field
s.initialize(o,r+" Low"),r=t.getField("High")
var l=t.getField("Low"),c=new e.MovingAverage,h=new e.Oscillator
for(t=c.simpleMovingAverage(h.trueRange(t,"x").getField("x"),i,"x").getField("x"),c=i;c<o+1;c++)for(h=c-1;h>c-i;--h)a.setValue(c,(r.value(c)-l.value(h))/(t.value(h)*Math.sqrt(h))),s.setValue(c,(r.value(h)-l.value(c))/(t.value(h)*Math.sqrt(h)))
for(c=1;c<2*i;c++)a.setValue(c,0),s.setValue(c,0)
return n.addField(a),n.addField(s),n},t.prototype.trendIntensityIndex=function(t,i,r,n){var o=new e.Recordset,a=t.recordCount,s=new e.Field
for(s.initialize(a,n),n=new e.MovingAverage,i=n.VIDYA(t,i,.65,"x").getField("x"),t=n.VIDYA(t,r,.65,"x").getField("x"),n=1;n<a+1;n++)s.setValue(n,Math.abs(i.value(n)-t.value(n))/t.value(n)*100)
for(n=1;n<r+1;n++)s.setValue(n,0)
return o.addField(s),o},t.prototype.twiggsMoneyFlow=function(t,i,r){var n=new e.Recordset,o=t.getFieldByIndex(0).recordCount,a=new e.Field
a.initialize(o,r)
var s=t.getField("High"),l=t.getField("Low"),c=t.getField("Close"),h=t.getField("Volume"),u=new e.MovingAverage
t=u.exponentialMovingAverage(t.getField("Volume"),i,"x").getField("x")
var d=new e.Field,p=new e.Field
p.initialize(o,"x"),d.initialize(o,"x")
for(var f=2;f<o+1;f++)d.setValue(f,Math.max(s.value(f),c.value(f-1))),p.setValue(f,Math.min(l.value(f),c.value(f-1)))
for(f=2;f<o+1;f++)a.setValue(f,(c.value(f)-p.value(f)-(d.value(f)-c.value(f)))/(d.value(f)-p.value(f))*h.value(f))
for(a=u.exponentialMovingAverage(a,i,r).getField(r),f=2;f<o+1;f++)a.setValue(f,a.value(f)/t.value(f))
for(f=1;f<i+1;f++)a.setValue(f,0)
return n.addField(a),n},t.prototype.onBalanceVolume=function(t,i,r){var n,o,a,s=new e.Recordset
o=t.recordCount,n=new e.Field,n.initialize(o,r)
var l=2
for(r=2;r<o+1;r++)a=t.value(l-1)<t.value(l)?n.value(l-1)+i.value(l):t.value(l)<t.value(l-1)?n.value(l-1)-i.value(l):n.value(l-1),n.setValue(l,a),l++
return s.addField(n),s},t.prototype.historicalVolatility=function(t,i,r,n,o){var a,s,l,c,h=new e.Recordset,u=new e.General
for(s=t.recordCount,a=new e.Field,a.initialize(s,"TEMP"),l=2;l<s+1;l++)c=Math.log(t.value(l)/t.value(l-1)),a.setValue(l,c)
for(t=u.standardDeviation(a,i,n,0,"STDV"),l=2;l<s+1;l++)c=t.value("STDV",l)*Math.sqrt(r),a.setValue(l,c)
return a.name=o,h.addField(a),h},t.prototype.relativeStrengthIndex=function(t,i,r){var n,o,a,s,l,c=new e.Recordset,h=0,u=0,d=0,p=0,f=0
a=t.recordCount,n=new e.Field,n.initialize(a,r),r=new e.Field,r.initialize(a,"AU"),o=new e.Field,o.initialize(a,"AD")
var m=2
for(l=1;l<i+1;l++)u=h=0,f!==e.Const.nullValue&&(f>t.value(m-1)?(h=t.value(m)-t.value(m-1),d+=h):t.value(m)<t.value(m-1)&&(u=t.value(m-1)-t.value(m),p+=u)),m++
for(m--,r.setValue(m,d/i),o.setValue(m,p/i),s=i+3;s<a+2;s++){for(m=s-i,p=d=0,l=1;l<i+1;l++)u=h=0,f=t.value(m),f!==e.Const.nullValue&&(f>t.value(m-1)?(h=t.value(m)-t.value(m-1),d+=h):t.value(m)<t.value(m-1)&&(u=t.value(m-1)-t.value(m),p+=u)),m++
m--,d=(r.value(m-1)*(i-1)+h)/i,p=(o.value(m-1)*(i-1)+u)/i,r.setValue(m,d),o.setValue(m,p),p||(p=d),d/=p,d=100-100/(1+d),n.setValue(m,d)}return c.addField(n),c},t}()
e.Index=t}(TASdk||(TASdk={}))
var StockChartX
!function(e){var t=["LOCALHOST","127.0.0.1","DEMO.MAGNISE.COM"]
!function(){var e=window.location.hostname.toUpperCase()
if(!(0<=t.indexOf(e))){var i=new Image
i.onload=function(){if(1<i.width)throw window.StockChartX=void 0,window.TASdk=void 0,alert("Invalid license - contact [email protected]"),Error("Invalid StockChartX license.")},i.src="https://modulusglobal.com/licenseping/ping.ashx?&cid=supernet.org&asm=supernet.org&vr=3072&img=1&t="+Math.random()}}()}(StockChartX||(StockChartX={})),function(e){var t=e.Browser||(e.Browser={})
switch(t[t.UNKNOWN=0]="UNKNOWN",t[t.ie=1]="ie",t[t.firefox=2]="firefox",t[t.opera=3]="opera",t[t.konqueror=4]="konqueror",t[t.iron=5]="iron",t[t.safari=6]="safari",t[t.chrome=7]="chrome",t[t.edge=8]="edge",t=e.Browser,e.Environment={isMobile:!1,isPhone:!1,isIOS:!1,isAndroid:!1,osVersion:"0",browser:t.UNKNOWN,browserVersion:"0"},Detectizr.detect({detectDeviceMode:!1,detectScreen:!1,detectOS:!0,detectBrowser:!0,detectPlugins:!1}),Detectizr.os.name){case"ios":e.Environment.isIOS=!0
break
case"android":e.Environment.isAndroid=!0}switch(e.Environment.osVersion=Detectizr.os.major+"."+Detectizr.os.minor,e.Environment.browserVersion=Detectizr.browser.major,Detectizr.browser.name){case"ie":e.Environment.browser=t.ie
break
case"firefox":e.Environment.browser=t.firefox
break
case"opera":e.Environment.browser=t.opera
break
case"konqueror":e.Environment.browser=t.konqueror
break
case"iron":e.Environment.browser=t.iron
break
case"safari":e.Environment.browser=t.safari
break
case"chrome":e.Environment.browser=t.chrome
break
case"edge":e.Environment.browser=t.edge}switch(Detectizr.device.type){case"mobile":e.Environment.isPhone=!0
break
case"tablet":e.Environment.isMobile=!0
break
default:e.Environment.isMobile=!1}Object.freeze(e.Environment)}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(e){if(this._length=0,this._dict={},e)if(Array.isArray(e))for(var t=0;t<e.length;t++){var i=e[t]
this.add(i.key,i.value)}else this.add(e.key,e.value)}return Object.defineProperty(e.prototype,"count",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t){if(this.containsKey(e))throw Error("An item with the same key already exists.")
this._dict[e]=t,this._length++},e.prototype.remove=function(e){return!!this.containsKey(e)&&(delete this._dict[e],this._length--,!0)},e.prototype.containsKey=function(e){return void 0!==this._dict[e]},e.prototype.get=function(e){return this.containsKey(e)?this._dict[e]:null},e}()
e.Dictionary=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(){this._constructors={}}return Object.defineProperty(e.prototype,"registeredItems",{get:function(){return this._constructors},enumerable:!0,configurable:!0}),e.prototype.register=function(e,t){if(!e)throw Error("Class name is not specified.")
if(!t)throw Error("Constructor is not specified.")
if(this._constructors[e])throw Error("'"+e+"' already registered.")
this._constructors[e]=t},e.prototype.resolve=function(e){if(!e)throw Error("Class name is not specified.")
return this._constructors[e]},e.prototype.createInstance=function(e){var t=this.resolve(e)
if(!t)throw Error("'"+e+"' is not registered.")
return new t},e}()
e.ClassRegistrar=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(){}return e.isNumber=function(e){return"number"==typeof e},e.isFiniteNumber=function(e){return this.isNumber(e)&&isFinite(e)},e.isFiniteNumberOrNaN=function(e){return this.isNumber(e)&&(isFinite(e)||isNaN(e))},e.isPositiveNumber=function(e){return this.isFiniteNumber(e)&&0<e},e.isNegativeNumber=function(e){return this.isFiniteNumber(e)&&0>e},e.isPositiveNumberOrNaN=function(e){return this.isNumber(e)&&(isNaN(e)||0<e&&isFinite(e))},e.isFunction=function(e){return!!(e&&e.constructor&&e.call&&e.apply)},e.clone=function(e){e=jQuery.extend(!0,{},e)
for(var t in e)if(e.hasOwnProperty(t)){var i=e[t]
if(Array.isArray(i))for(var r=0,n=i.length;r<n;r++)"object"==typeof i[r]&&(i[r]=this.clone(i[r]))}return e},e.extend=function(e,t){var i=e.prototype,r=function(){}
r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e
for(var n in i)e.prototype[n]=i[n]},e.applyMixins=function(e,t){t.forEach(function(t){Object.getOwnPropertyNames(t).forEach(function(i){Object.getOwnPropertyDescriptor(t,i).enumerable&&"constructor"!==i&&(e[i]=t[i])}),Object.getOwnPropertyNames(t.prototype).forEach(function(i){"constructor"!==i&&(e.prototype[i]=t.prototype[i])})})},e.padStr=function(e,t){for(var i=t.width-e.length,r=0;r<i;r++)e=t.alignLeft?e+t.padding:t.padding+e
return e},e.filterText=function(e){return $("<div></div>").text(e).html().trim()},e.flattenArray=function(e){var t=this
return e.reduce(function(e,i){return Array.isArray(i)?e.concat(t.flattenArray(i)):e.concat(i)},[])},e}()
e.JsUtil=t,Math.roundToDecimals=function(e,t){return Number(Math.round(e+"E"+t)+"E-"+t)},Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)})}(StockChartX||(StockChartX={})),StockChartX||(StockChartX={}),function(e){e.TimeSpan={MILLISECONDS_IN_YEAR:31556926e3,MILLISECONDS_IN_MONTH:2629743830,MILLISECONDS_IN_WEEK:6048e5,MILLISECONDS_IN_DAY:864e5,MILLISECONDS_IN_HOUR:36e5,MILLISECONDS_IN_MINUTE:6e4,MILLISECONDS_IN_SECOND:1e3},Object.freeze(e.TimeSpan),e.Periodicity={TICK:"t",SECOND:"s",MINUTE:"",HOUR:"h",DAY:"d",WEEK:"w",MONTH:"m",YEAR:"y"},Object.freeze(e.Periodicity)
var t=function(){function t(t,i){this.periodicity=t||e.Periodicity.MINUTE,this.interval=e.JsUtil.isFiniteNumber(i)?i:1}return t.prototype.toString=function(){return this.interval+" "+t.periodicityToString(this.periodicity)},t.prototype.toShortString=function(){return this.interval+" "+t.periodicityToShortString(this.periodicity)},t.periodicityToString=function(t){switch(t){case e.Periodicity.TICK:return"tick"
case e.Periodicity.SECOND:return"second"
case e.Periodicity.MINUTE:return"minute"
case e.Periodicity.HOUR:return"hour"
case e.Periodicity.DAY:return"day"
case e.Periodicity.WEEK:return"week"
case e.Periodicity.MONTH:return"month"
case e.Periodicity.YEAR:return"year"
default:throw Error("Unsupported periodicity: "+t)}},t.periodicityToShortString=function(t){switch(t){case e.Periodicity.TICK:return"tick"
case e.Periodicity.SECOND:return"sec"
case e.Periodicity.MINUTE:return"min"
case e.Periodicity.HOUR:return"hr"
case e.Periodicity.DAY:return"day"
case e.Periodicity.WEEK:return"wk"
case e.Periodicity.MONTH:return"mo"
case e.Periodicity.YEAR:return"yr"
default:throw Error("Unsupported periodicity: "+t)}},t.timeFrameToTimeInterval=function(t,i){switch(i){case e.Periodicity.TICK:return t
case e.Periodicity.SECOND:return t*e.TimeSpan.MILLISECONDS_IN_SECOND
case e.Periodicity.MINUTE:return t*e.TimeSpan.MILLISECONDS_IN_MINUTE
case e.Periodicity.HOUR:return t*e.TimeSpan.MILLISECONDS_IN_HOUR
case e.Periodicity.DAY:return t*e.TimeSpan.MILLISECONDS_IN_DAY
case e.Periodicity.WEEK:return t*e.TimeSpan.MILLISECONDS_IN_WEEK
case e.Periodicity.MONTH:return t*e.TimeSpan.MILLISECONDS_IN_MONTH
case e.Periodicity.YEAR:return t*e.TimeSpan.MILLISECONDS_IN_YEAR}return 0},t.timeIntervalToTimeFrame=function(i){if(i>=e.TimeSpan.MILLISECONDS_IN_YEAR)return new t(e.Periodicity.YEAR,i/e.TimeSpan.MILLISECONDS_IN_YEAR)
if(i>=e.TimeSpan.MILLISECONDS_IN_MONTH)return new t(e.Periodicity.MONTH,i/e.TimeSpan.MILLISECONDS_IN_MONTH)
if(i>=e.TimeSpan.MILLISECONDS_IN_WEEK&&0==i%e.TimeSpan.MILLISECONDS_IN_WEEK)return new t(e.Periodicity.WEEK,i/e.TimeSpan.MILLISECONDS_IN_WEEK)
if(i>=e.TimeSpan.MILLISECONDS_IN_DAY)return new t(e.Periodicity.DAY,i/e.TimeSpan.MILLISECONDS_IN_DAY)
if(i>=e.TimeSpan.MILLISECONDS_IN_HOUR)return new t(e.Periodicity.HOUR,i/e.TimeSpan.MILLISECONDS_IN_HOUR)
if(i>=e.TimeSpan.MILLISECONDS_IN_MINUTE)return new t(e.Periodicity.MINUTE,i/e.TimeSpan.MILLISECONDS_IN_MINUTE)
if(i>=e.TimeSpan.MILLISECONDS_IN_SECOND)return new t(e.Periodicity.SECOND,i/e.TimeSpan.MILLISECONDS_IN_SECOND)
throw Error("Unsupported time interval: "+i)},t}()
e.TimeFrame=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t,"registeredFormatters",{get:function(){return this._formatters.registeredItems},enumerable:!0,configurable:!0}),t.register=function(e,t){"string"==typeof e?this._formatters.register(e,t):this._formatters.register(e.className,e)},t.deserialize=function(e){if(!e)return null
var t=this._formatters.createInstance(e.className)
return t.loadState(e),t},t._formatters=new e.ClassRegistrar,t}(),i=function(){function e(e){this._locale=e}return Object.defineProperty(e,"className",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"locale",{get:function(){return this._locale},set:function(e){this._locale!==e&&(this._locale=e,this._onLocaleChanged())},enumerable:!0,configurable:!0}),e.prototype._onLocaleChanged=function(){},e.prototype.saveState=function(){return{className:this.constructor.className,locale:this.locale}},e.prototype.loadState=function(e){this._locale=e&&e.locale},e}()
e.NumberFormat=i,e.JsUtil.applyMixins(i,[t])}(StockChartX||(StockChartX={}))
var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}
!function(e){var t=function(t){function i(e,i){t.call(this,e),this._createFormat(i)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.IntlNumberFormat"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"options",{get:function(){return this._numberFormat.resolvedOptions()},set:function(e){this._createFormat(e)},enumerable:!0,configurable:!0}),i.prototype._onLocaleChanged=function(){this._createFormat()},i.prototype._createFormat=function(e){var t=this.locale||"en"
e||(e=this._numberFormat&&this._numberFormat.resolvedOptions()),this._numberFormat=new Intl.NumberFormat(t,e||void 0)},i.prototype.format=function(e){return this._numberFormat.format(e)},i.prototype.setDecimalDigits=function(t){if(e.JsUtil.isNegativeNumber(t))throw Error("Value must be greater or equal to zero.")
var i=this._numberFormat.resolvedOptions()
i.minimumFractionDigits=i.maximumFractionDigits=t,this._createFormat(i)},i.prototype.saveState=function(){var i=t.prototype.saveState.call(this)
return i.options=e.JsUtil.clone(this.options),i},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this._createFormat(e&&e.options)},i}(e.NumberFormat)
e.IntlNumberFormat=t,e.NumberFormat.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this),this.formatString=e||"%f"}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.CustomNumberFormat"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"formatString",{get:function(){return this._formatString},set:function(e){this._formatString=e,this._parseFormat()},enumerable:!0,configurable:!0}),i.prototype._parseFormat=function(){var e=this.formatString
if(!e||"string"!=typeof e)throw new TypeError("Format specifier must be a string.")
e=/%(\+)?([0 ]|'(.))?(-)?([0-9]+)?(\.([0-9]+))?([bcdfoxXeEgG])/g.exec(e),this._options={sign:"+"===e[1],padding:null==e[2]?" ":"'"===e[2].substring(0,1)?e[3]:e[2],alignLeft:"-"===e[4],width:null!=e[5]&&e[5],precision:null!=e[7]&&e[7],type:e[8]}},i.prototype.format=function(t){var i,r=Number(t),n=this._options
switch(n.type){case"b":i=r.toString(2)
break
case"c":i=String.fromCharCode(r)
break
case"d":i=parseInt(r,10).toString()
break
case"f":i=!1===n.precision?t.toString():r.toFixed(n.precision)
break
case"o":i=r.toString(8)
break
case"x":i=r.toString(16).toLowerCase()
break
case"X":i=r.toString(16).toUpperCase()
break
case"e":case"E":i=!1===n.precision?r.toExponential():r.toExponential(n.precision),i="e"===n.type?i.toLowerCase():i.toUpperCase()
break
case"g":case"G":i=!1===n.precision?t.toString():r.toFixed(n.precision),r=!1===n.precision?r.toExponential():r.toExponential(n.precision),i=i.length<r.length?i:r,i="g"===n.type?i.toLowerCase():i.toUpperCase()
break
default:throw'Unknown value type "'+n.type+'" detected.'}switch(r=!1!==n.width&&n.width>i.length,r&&!n.alignLeft&&" "!==n.padding&&(i=e.JsUtil.padStr(i,n),r=!1),n.type){case"d":case"f":case"e":case"E":case"g":case"G":0>t?"-"!==i[0]&&(i="-"+i):n.sign&&(i="+"+i)}return r&&(i=e.JsUtil.padStr(i,n)),i},i.prototype.saveState=function(){var e=t.prototype.saveState.call(this)
return e.formatString=this.formatString,e},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this.formatString=e&&e.formatString},i}(e.NumberFormat)
e.CustomNumberFormat=t,e.NumberFormat.register(t)}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t,"registeredFormatters",{get:function(){return this._formatters.registeredItems},enumerable:!0,configurable:!0}),t.register=function(e,t){"string"==typeof e?this._formatters.register(e,t):this._formatters.register(e.className,e)},t.deserialize=function(e){if(!e)return null
var t=this._formatters.createInstance(e.className)
return t.loadState(e),t},t._formatters=new e.ClassRegistrar,t}(),i=function(){function e(){}return Object.defineProperty(e,"className",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"locale",{get:function(){return this._locale},set:function(e){this._locale!==e&&(this._locale=e,this._onLocaleChanged())},enumerable:!0,configurable:!0}),e.prototype._onLocaleChanged=function(){},e.prototype.saveState=function(){return{className:this.constructor.className,locale:this.locale}},e.prototype.loadState=function(e){this.locale=e.locale},e}()
e.DateTimeFormat=i,e.JsUtil.applyMixins(i,[t])}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(t){e.call(this),this.formatString=t}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"StockChartX.CustomDateTimeFormat"},enumerable:!0,configurable:!0}),t.prototype.format=function(e){return e=moment(e),moment.locale(this.locale),e.format(this.formatString)},t.prototype.saveState=function(){var t=e.prototype.saveState.call(this)
return t.formatString=this.formatString,t},t.prototype.loadState=function(t){e.prototype.loadState.call(this,t),this.formatString=t.formatString},t}(e.DateTimeFormat)
e.CustomDateTimeFormat=t,e.DateTimeFormat.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.DateTimeFormatName={YEAR_MONTH:"year-month",MONTH_DAY:"month-day",DATE:"date",SHORT_DATE_TIME:"short_date_time",LONG_DATE_TIME:"long_date_time",SHORT_TIME:"short_time",LONG_TIME:"long_time"}
var t=function(t){function i(e){t.call(this),this._formatters={},this._timeInterval=e}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.TimeIntervalDateTimeFormat"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"timeInterval",{get:function(){return this._timeInterval},set:function(e){this._timeInterval=e},enumerable:!0,configurable:!0}),i.prototype._onLocaleChanged=function(){this._clearFormatters()},i.prototype._clearFormatters=function(){this._formatters={}},i.prototype._createFormatter=function(e){return new IntlPolyfill.DateTimeFormat(this.locale||"en",e)},i.prototype.format=function(t){var i=this._timeInterval
if(i>=e.TimeSpan.MILLISECONDS_IN_YEAR)return t.getFullYear().toString()
var r=e.DateTimeFormatName
return i>=e.TimeSpan.MILLISECONDS_IN_MONTH?this.formatter(r.YEAR_MONTH).format(t):i>=e.TimeSpan.MILLISECONDS_IN_DAY?this.formatter(r.DATE).format(t):i>=e.TimeSpan.MILLISECONDS_IN_MINUTE?this.formatter(r.SHORT_DATE_TIME).format(t):i>=e.TimeSpan.MILLISECONDS_IN_SECOND?this.formatter(r.SHORT_DATE_TIME).format(t):this.formatter(r.LONG_DATE_TIME).format(t)},i.prototype.formatWithFormatter=function(e,t){return this.formatter(t).format(e)},i.prototype.formatter=function(t){var i=this._formatters[t]
if(i)return i
switch(i=e.DateTimeFormatName,t){case i.YEAR_MONTH:i=this._createFormatter({year:"numeric",month:"short"})
break
case i.MONTH_DAY:i=this._createFormatter({month:"short",day:"2-digit"})
break
case i.DATE:i=this._createFormatter({year:"numeric",month:"short",day:"2-digit"})
break
case i.SHORT_DATE_TIME:i=this._createFormatter({year:"numeric",month:"short",day:"2-digit",hour:"2-digit",hour12:!1,minute:"2-digit"})
break
case i.LONG_DATE_TIME:i=this._createFormatter({year:"numeric",month:"short",day:"2-digit",hour:"2-digit",hour12:!1,minute:"2-digit",second:"2-digit"})
break
case i.SHORT_TIME:i=this._createFormatter({hour:"2-digit",hour12:!1,minute:"2-digit"})
break
case i.LONG_TIME:i=this._createFormatter({hour:"2-digit",hour12:!1,minute:"2-digit",second:"2-digit"})
break
default:throw Error("Unknown formatter name: "+t)}return this._formatters[t]=i,i},i.prototype.saveState=function(){var e=t.prototype.saveState.call(this)
return e.timeInterval=this.timeInterval,e},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this.timeInterval=e&&e.timeInterval},i}(e.DateTimeFormat)
e.TimeIntervalDateTimeFormat=t,e.DateTimeFormat.register(t)}(StockChartX||(StockChartX={}))
var Chart=StockChartX.Chart
!function(e){var t=jQuery
t.fn.extend({scxGetFrame:function(t){var i=this.outerWidth(),r=this.outerHeight()
if(t){var n=t.offset()
t=this.offset(),t.left-=n.left,t.top-=n.top}else t=this.position()
return new e.Rect({left:t.left,top:t.top,width:i,height:r})},scxSize:function(){return{width:this.outerWidth(),height:this.outerHeight()}},scxContentSize:function(){return{width:this.innerWidth(),height:this.innerHeight()}},scxAppendCanvas:function(){return t("<canvas></canvas>").css("position","absolute").appendTo(this)},scxAppend:function(e,i){var r=t("<"+e+"></"+e+">").appendTo(this)
if(i)if("string"==typeof i)r.addClass(i)
else for(var n=0;n<i.length;n++)r.addClass(i[n])
return r},scxFrame:function(e){this.css("left",e.left).css("top",e.top).outerWidth(e.width).outerHeight(e.height)},scxPosition:function(e,t){return this.css("left",e).css("top",t),this},scxClientToLocalPoint:function(e,t){var i=this.offset()
return{x:Math.round(e-i.left),y:Math.round(t-i.top)}},scxLocalToClientPoint:function(e,t){var i=this.offset()
return{x:Math.round(e+i.left),y:Math.round(t+i.top)}},scxTextStyle:function(e){return this.css("color",e.fillColor).css("font-size",e.fontSize+"px").css("font-family",e.fontFamily).css("font-style",e.fontStyle)},scxBorder:function(e,t){return this.css(e,t.width+"px "+t.lineStyle+" "+t.strokeColor)},scxFill:function(e){return!1===e.fillEnabled?this:this.css("background-color",e.fillColor)}})}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(){}return e.getLineWidth=function(e){return e&&!1===e.strokeEnabled?0:e&&e.width||1},e.getFontSize=function(e){return e&&e.fontSize||12},e.isDarkColor=function(e){return tinycolor(e).isDark()},e.toRgbString=function(e){return tinycolor(e).toRgbString()},e.toRgba=function(e){return tinycolor(e).toRgb()},e.toHexString=function(e){return tinycolor(e).toHexString()},e.lighten=function(t,i){void 0===i&&(i=0)
var r=e.toRgbString(t).replace(/[^0-9a-f]/gi,"")
6>r.length&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2])
for(var n,o="#",a=0;3>a;a++)n=parseInt(r.substr(2*a,2),16),n=Math.round(Math.min(Math.max(0,n+255*i),255)).toString(16),o+=("00"+n).substr(n.length)
return o},e.setVisibility=function(e,t){e.css("visibility",t?"visible":"hidden")},e.isFullScreenAllowed=function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled},e.isFullScreenEnabled=function(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)},e.goFullScreen=function(e){e=e||document.body,e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)},e.exitFullScreen=function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},e.setGradientBackground=function(t,i){var r="startColorstr="+e.toHexString(i[1]),n="endColorstr="+e.toHexString(i[0])
t.css("background","-webkit-gradient(linear,left bottom,left top,color-stop(0, "+i[0]+"), color-stop(1, "+i[1]+"))").css("background","linear-gradient(to top, "+i[0]+", "+i[1]+")").css("filter","progid:DXImageTransform.Microsoft.gradient(GradientType=0, "+r+", "+n+")")},e.setBackgroundColor=function(e,t){e.css("background-color",t)},e.removeUnsecureTags=function(e){e=$(e)
for(var t=0,i="script embed object applet iframe frame frameset".split(" ");t<i.length;t++)e.find(i[t]).remove()
return e},e}()
e.HtmlUtil=t}(StockChartX||(StockChartX={})),function(e){e.StrokePriority={COLOR:"color"},Object.freeze(e.StrokePriority),e.FillPriority={COLOR:"color"},Object.freeze(e.FillPriority),e.LineStyle={SOLID:"solid",DASH:"dash",DOT:"dot",DASH_DOT:"dash-dot"},Object.freeze(e.LineStyle),e.FontDefaults={fontFamily:"Arial",fontSize:12,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal"},e.StrokeDefaults={strokePriority:"color",strokeColor:"black",width:1,lineStyle:e.LineStyle.SOLID,lineJoin:"miter",lineCap:"butt"},e.DashArray={DOT:[1,7],DASH:[7,7],DASH_DOT:[7,7,1,7]},e.Theme={Dark:{name:"Dark",chart:{background:["rgb(0, 0, 0)","rgb(46, 46, 46)"],border:{width:1,strokeColor:"grey",lineStyle:"solid"},instrumentWatermark:{symbol:{fontFamily:"Arial",fontSize:70,fontStyle:"normal",fillColor:"white"},details:{fontFamily:"Arial",fontSize:40,fontStyle:"normal",fillColor:"white"}}},splitter:{fillColor:"grey",hoverFillColor:"white"},chartPanel:{grid:{width:1,strokeColor:"#505050"},title:{fontFamily:"Calibri",fontSize:11,fontStyle:"normal",fillColor:"white"}},valueScale:{text:{fontFamily:"Calibri",fontSize:11,fontStyle:"normal",fillColor:"white"},line:{width:1,strokeColor:"#505050"},border:{width:1,strokeColor:"darkgray",lineStyle:"solid"},valueMarker:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},fill:{fillColor:"green"}}},dateScale:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"#FFFFFF"},line:{width:1,strokeColor:"#505050"},border:{width:1,strokeColor:"darkgray",lineStyle:"solid"},dateMarker:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"#FFFFFF"},fill:{fillColor:"green"},stroke:{strokePriority:"color",strokeColor:"#696969",width:1,lineStyle:e.LineStyle.SOLID,lineJoin:"miter",lineCap:"butt"}}},crossHair:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},line:{width:1,strokeColor:"darkgray",lineStyle:"dashed"},fill:{fillColor:"white"}},zoomIn:{border:{width:1,strokeColor:"white",lineStyle:"solid"},fill:{fillColor:"rgba(255, 255, 255, 0.5)"}},plot:{point:{dot:{fill:{fillColor:"white"}}},line:{simple:{width:1,strokeColor:"white"},mountain:{line:{width:1,strokeColor:"white"},fill:{fillColor:"rgba(0, 0, 255, 0.5)"}},step:{width:1,strokeColor:"white"}},histogram:{line:{width:1,strokeColor:"white"},coloredLine:{upBar:{width:1,strokeColor:"green"},downBar:{width:1,strokeColor:"red"}},column:{line:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"blue"}},coloredColumn:{upBar:{line:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"green"}},downBar:{line:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"red"}}}},bar:{OHLC:{width:1,strokeColor:"white"},HLC:{width:1,strokeColor:"white"},HL:{width:1,strokeColor:"white"},coloredOHLC:{upBar:{width:1,strokeColor:"green"},downBar:{width:1,strokeColor:"red"}},coloredHLC:{upBar:{width:1,strokeColor:"green"},downBar:{width:1,strokeColor:"red"}},coloredHL:{upBar:{width:1,strokeColor:"green"},downBar:{width:1,strokeColor:"red"}},candle:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"green"},wick:{width:1,strokeColor:"white"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"red"},wick:{width:1,strokeColor:"white"}}},heikinAshi:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"green"},wick:{width:1,strokeColor:"white"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"red"},wick:{width:1,strokeColor:"white"}}},renko:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"green"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"red"}}},lineBreak:{upCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"green"},fill:{fillEnabled:!1,fillColor:"green"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"red"},fill:{fillEnabled:!0,fillColor:"red"}}},hollowCandle:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"green"},wick:{width:1,strokeColor:"white"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"white"},fill:{fillColor:"red"},wick:{width:1,strokeColor:"white"}},upHollowCandle:{border:{width:1,strokeColor:"green"},wick:{width:1,strokeColor:"green"}},downHollowCandle:{border:{width:1,strokeColor:"red"},wick:{width:1,strokeColor:"red"}}},pointAndFigure:{upCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"green"}},downCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"red"}}},kagi:{upCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"green"}},downCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"red"}}}}},selectionMarker:{line:{strokeColor:"white",width:1},fill:{fillColor:"black"}},tooltip:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"white"},border:{width:1,strokeColor:"white",strokeEnabled:!0,lineStyle:e.LineStyle.SOLID},fill:{fillEnabled:!0,fillColor:"rgba(0, 0, 0, 0.5)"}},drawing:{note:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"white"},fill:{fillColor:"orange"},centerPointFill:{fillColor:"rgb(68, 68, 68)"},tooltip:{text:{fontFamily:"Calibri",fontSize:12,fillColor:"white",fontWeight:"normal",fontStyle:"normal",decoration:""},border:{enabled:!0,width:1,color:"orange",lineStyle:e.LineStyle.SOLID},fill:{enabled:!0,color:"rgb(44, 44, 44)"}}},measure:{line:{width:1,strokeColor:"white",strokeEnabled:!0,lineStyle:e.LineStyle.DASH},border:{width:1,strokeColor:"white",strokeEnabled:!0,lineStyle:e.LineStyle.DASH},fill:{fillEnabled:!0,fillColor:"rgba(255, 255, 255, 0.5)"},balloon:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"white"},border:{width:1,strokeColor:"darkgray",strokeEnabled:!0,lineStyle:e.LineStyle.SOLID},fill:{fillEnabled:!0,fillColor:"rgba(255, 255, 255, 0.5)"}}},measureTool:{line:{width:1,strokeColor:"white"},text:{fontFamily:"Calibri",fontSize:11,fillColor:"white"},fill:{fillColor:"rgba(0, 0, 0, 0.8)"}},abstract:{line:{strokeColor:"white",width:1},fill:{fillColor:"rgba(255, 255, 255, 0.3)"},text:{fontFamily:"Calibri",fontSize:12,fillColor:"white",decoration:""}},abstractMarker:{fill:{fillColor:"white"}},fibonacci:{trendLine:{strokeColor:"white",width:1,lineStyle:"dash"},line:{strokeColor:"white",width:1},fill:{fillColor:"rgba(255, 255, 255, 0.3)"},text:{fontFamily:"Calibri",fontSize:12,fillColor:"white"}},arrowUp:{fill:{fillColor:"limegreen"}},arrowDown:{fill:{fillColor:"red"}},text:{text:{fontFamily:"Calibri",fontSize:12,fillColor:"#FFFFFF",decoration:""}},image:{noImage:{line:{strokeColor:"red",width:1}}}}},Light:{name:"Light",chart:{background:["rgb(243, 243, 243)","rgb(243, 243, 243)"],border:{width:1,strokeColor:"grey",lineStyle:"solid"},instrumentWatermark:{symbol:{fontFamily:"Arial",fontSize:70,fontStyle:"normal",fillColor:"#333"},details:{fontFamily:"Arial",fontSize:40,fontStyle:"normal",fillColor:"#333"}}},splitter:{fillColor:"#999",hoverFillColor:"#DDD"},chartPanel:{grid:{width:1,strokeColor:"#CCC"},title:{fontFamily:"Calibri",fontSize:11,fontStyle:"normal",fillColor:"#333"}},valueScale:{text:{fontFamily:"Calibri",fontSize:11,fontStyle:"normal",fillColor:"#333"},line:{width:1,strokeColor:"#CCC"},border:{width:1,strokeColor:"#CCC",lineStyle:"solid"},valueMarker:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},fill:{fillColor:"green"}}},dateScale:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"#333"},line:{width:1,strokeColor:"#CCC"},border:{width:1,strokeColor:"#CCC",lineStyle:"solid"},dateMarker:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},fill:{fillColor:"green"},stroke:{strokePriority:"color",strokeColor:"#696969",width:1,lineStyle:e.LineStyle.SOLID,lineJoin:"miter",lineCap:"butt"}}},crossHair:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},line:{width:1,strokeColor:"#333",lineStyle:"dashed"},fill:{fillColor:"#DDD"}},zoomIn:{border:{width:1,strokeColor:"darkgray",lineStyle:"solid"},fill:{fillColor:"rgba(0, 0, 255, 0.5)"}},plot:{point:{dot:{fill:{fillColor:"#555"}}},line:{simple:{width:1,strokeColor:"#555"},mountain:{line:{width:1,strokeColor:"#555"},fill:{fillColor:"rgba(0, 0, 255, 0.5)"}},step:{width:1,strokeColor:"#555"}},histogram:{line:{width:1,strokeColor:"#555"},coloredLine:{upBar:{width:1,strokeColor:"green"},downBar:{width:1,strokeColor:"red"}},column:{line:{strokeEnabled:!1,width:1,strokeColor:"#555"},fill:{fillColor:"blue"}},coloredColumn:{upBar:{line:{strokeEnabled:!1,width:1,strokeColor:"#555"},fill:{fillColor:"green"}},downBar:{line:{strokeEnabled:!1,width:1,strokeColor:"#555"},fill:{fillColor:"red"}}}},bar:{OHLC:{width:1,strokeColor:"#555"},HLC:{width:1,strokeColor:"#555"},HL:{width:1,strokeColor:"#555"},coloredOHLC:{upBar:{width:1,strokeColor:"green"},downBar:{width:1,strokeColor:"red"}},coloredHLC:{upBar:{width:1,strokeColor:"green"},downBar:{width:1,strokeColor:"red"}},coloredHL:{upBar:{width:1,strokeColor:"green"},downBar:{width:1,strokeColor:"red"}},candle:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"#CCC"},fill:{fillColor:"green"},wick:{width:1,strokeColor:"#555"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"#CCC"},fill:{fillColor:"red"},wick:{width:1,strokeColor:"#555"}}},heikinAshi:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"#CCC"},fill:{fillColor:"green"},wick:{width:1,strokeColor:"#555"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"#CCC"},fill:{fillColor:"red"},wick:{width:1,strokeColor:"#555"}}},renko:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"#CCC"},fill:{fillColor:"green"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"#CCC"},fill:{fillColor:"red"}}},lineBreak:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"green"},fill:{fillColor:"green"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"red"},fill:{fillColor:"red"}}},hollowCandle:{upCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"#CCC"},fill:{fillColor:"green"},wick:{width:1,strokeColor:"#555"}},downCandle:{border:{strokeEnabled:!1,width:1,strokeColor:"#CCC"},fill:{fillColor:"red"},wick:{width:1,strokeColor:"#555"}},upHollowCandle:{border:{width:1,strokeColor:"green"},wick:{width:1,strokeColor:"green"}},downHollowCandle:{border:{width:1,strokeColor:"red"},wick:{width:1,strokeColor:"red"}}},pointAndFigure:{upCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"green"}},downCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"red"}}},kagi:{upCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"green"}},downCandle:{border:{strokeEnabled:!0,width:1,strokeColor:"red"}}}}},selectionMarker:{line:{strokeColor:"#777",width:1},fill:{fillColor:"black"}},drawing:{note:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},fill:{fillColor:"#15C"},centerPointFill:{fillColor:"white"},tooltip:{text:{fontFamily:"Calibri",fontSize:12,fillColor:"black",fontWeight:"normal",fontStyle:"normal",decoration:""},border:{enabled:!0,width:1,color:"#15C",lineStyle:e.LineStyle.SOLID},fill:{enabled:!0,color:"white"}}},measure:{line:{width:1,strokeColor:"white",strokeEnabled:!0,lineStyle:e.LineStyle.DASH},border:{width:1,strokeColor:"white",strokeEnabled:!0,lineStyle:e.LineStyle.DASH},fill:{fillEnabled:!0,fillColor:"rgba(0, 0, 255, 0.5)"},balloon:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},border:{width:1,strokeColor:"darkgray",strokeEnabled:!0,lineStyle:e.LineStyle.SOLID},fill:{fillEnabled:!0,fillColor:"rgba(0, 0, 255, 0.5)"}}},measureTool:{line:{width:1,strokeColor:"black"},text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},fill:{fillColor:"rgba(255, 255, 255, 0.8)"}},abstract:{line:{strokeColor:"#555",width:1},fill:{fillColor:"rgba(255, 255, 255, 0.3)"},text:{fontFamily:"Calibri",fontSize:12,fillColor:"#555",decoration:""}},abstractMarker:{fill:{fillColor:"#555"}},fibonacci:{trendLine:{strokeColor:"black",width:1,lineStyle:"dash"},line:{strokeColor:"black",width:1},fill:{fillColor:"rgba(0, 0, 0, 0.3)"},text:{fontFamily:"Calibri",fontSize:12,fillColor:"black"}},arrowUp:{fill:{fillColor:"limegreen"}},arrowDown:{fill:{fillColor:"red"}},text:{text:{fontFamily:"Calibri",fontSize:12,fillColor:"#555",decoration:""}},image:{noImage:{line:{strokeColor:"red",width:1}}}},tooltip:{text:{fontFamily:"Calibri",fontSize:11,fillColor:"black"},border:{width:1,strokeColor:"black",strokeEnabled:!0,lineStyle:e.LineStyle.SOLID},fill:{fillEnabled:!0,fillColor:"rgba(0, 0, 255, 0.5)"}}}}}(StockChartX||(StockChartX={})),function(e){function t(){return i||(i=this.setLineDash?function(e){this.setLineDash(e)}:"mozDash"in this?function(e){this.mozDash=e}:"webkitLineDash"in this?function(e){this.webkitLineDash=e}:function(e){}),i}var i
jQuery.extend(CanvasRenderingContext2D.prototype,{scxApplyStrokeTheme:function(i){if(!i||!1===i.strokeEnabled)return this
switch(i.strokePriority||e.StrokeDefaults.strokePriority){case e.StrokePriority.COLOR:this.strokeStyle=i.strokeColor||e.StrokeDefaults.strokeColor}switch(this.lineCap=i.lineCap||e.StrokeDefaults.lineCap,this.lineJoin=i.lineJoin||e.StrokeDefaults.lineJoin,this.lineWidth=i.width||e.StrokeDefaults.width,i.lineStyle||e.StrokeDefaults.lineStyle){case e.LineStyle.DASH:i=e.DashArray.DASH
break
case e.LineStyle.DOT:i=e.DashArray.DOT
break
case e.LineStyle.DASH_DOT:i=e.DashArray.DASH_DOT
break
default:i=[]}return t.call(this).call(this,i),this},scxApplyFillTheme:function(e){return e&&e.fillColor&&(this.fillStyle=e.fillColor||"black"),this},scxApplyTextTheme:function(t){var i
return i=t?(t.fontStyle||e.FontDefaults.fontStyle)+" "+(t.fontVariant||e.FontDefaults.fontVariant)+" "+(t.fontWeight||e.FontDefaults.fontWeight)+" "+(t.fontSize||e.FontDefaults.fontSize)+"px "+(t.fontFamily||e.FontDefaults.fontFamily):e.FontDefaults.fontSize+"px "+e.FontDefaults.fontFamily,this.font=i,t&&!1===t.fillEnabled||this.scxApplyFillTheme(t),t&&!1===t.strokeEnabled||this.scxApplyStrokeTheme(t),this},scxFill:function(e,t){return(t||e&&!1!==e.fillEnabled)&&(this.scxApplyFillTheme(e),this.fill()),this},scxStroke:function(e,t){return(t||e&&!1!==e.strokeEnabled)&&(this.scxApplyStrokeTheme(e),this.stroke()),this},scxFillStroke:function(e,t){return this.scxFill(e),this.scxStroke(t),this},scxStrokePolyline:function(e,t){var i=e.length
if(2>i)throw Error("Not enough points.")
this.beginPath(),this.moveTo(e[0].x,e[0].y)
for(var r=1;r<i;r++)this.lineTo(e[r].x,e[r].y)
return this.scxStroke(t),this}})}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(e){this.height=this.width=this.top=this.left=null,e=e||{},this.left=e.left||0,this.top=e.top||0,this.width=e.width||0,this.height=e.height||0}return Object.defineProperty(e.prototype,"bottom",{get:function(){return this.top+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.left+this.width},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this)},e.prototype.equals=function(e){return e&&this.left===e.left&&this.top===e.top&&this.width===e.width&&this.height===e.height},e.prototype.toString=function(){return"[left: "+this.left+", top: "+this.top+", width: "+this.width+", height: "+this.height+"]"},e.prototype.containsPoint=function(e){return e.x>=this.left&&e.x<=this.right&&e.y>=this.top&&e.y<=this.bottom},e.prototype.cropLeft=function(e){e=e.right,this.left<e&&(this.width=this.right-e,this.left=e)},e.prototype.cropRight=function(e){this.right>=e.left&&(this.width=e.left-1-this.left)},e.prototype.cropTop=function(e){e=e.bottom,this.top<e&&(this.height=this.bottom-e,this.top=e)},e.prototype.cropBottom=function(e){this.bottom>e.top&&(this.height=e.top-this.top)},e.prototype.copyFrom=function(e){this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height},e.prototype.applyPadding=function(e){e.left&&(this.left+=e.left,this.width-=e.left),e.top&&(this.top+=e.top,this.height-=e.top),e.right&&(this.width-=e.right),e.bottom&&(this.height-=e.bottom)},e}()
e.Rect=t}(StockChartX||(StockChartX={})),function(e){!function(t){t.DEVIATION=e.Environment.isMobile?20:5,t.length=function(e,t){var i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y)
return Math.round(Math.sqrt(i*i+r*r))},t.xProjectionLength=function(e,t){return Math.abs(e.x-t.x)},t.yProjectionLength=function(e,t){return Math.abs(e.y-t.y)},t.isValueNearValue=function(e,t){return Math.abs(e-t)<=this.DEVIATION},t.isValueBetweenOrNearValues=function(e,t,i){return e>=Math.min(t,i)-this.DEVIATION&&e<=Math.max(t,i)+this.DEVIATION},t.isPointNearPoint=function(e,t){if(Array.isArray(t)){for(var i=0;i<t.length;i++)if(this.isPointNearPoint(e,t[i]))return!0
return!1}return this.isValueNearValue(e.x,t.x)&&this.isValueNearValue(e.y,t.y)},t.isPointNearRectPoints=function(e,t,i){var r=Math.min(t.x,i.x),n=Math.max(t.x,i.x),o=Math.min(t.y,i.y)
return t=Math.max(t.y,i.y),!!this.isPointNearLine(e,{x:r,y:t},{x:r,y:o})||!!this.isPointNearLine(e,{x:r,y:o},{x:n,y:o})||!!this.isPointNearLine(e,{x:n,y:o},{x:n,y:t})||this.isPointNearLine(e,{x:n,y:t},{x:r,y:t})},t.isPointInsideOrNearRect=function(e,t){return this.isValueBetweenOrNearValues(e.x,t.left,t.left+t.width)&&this.isValueBetweenOrNearValues(e.y,t.top,t.top+t.height)},t.isPointInsideOrNearRectPoints=function(e,t,i){var r=Math.min(t.y,i.y),n=Math.max(t.y,i.y)
return this.isValueBetweenOrNearValues(e.x,Math.min(t.x,i.x),Math.max(t.x,i.x))&&this.isValueBetweenOrNearValues(e.y,r,n)},t.isPointNearCircle=function(e,t,i){return e=this.length(t,e),t="number"==typeof i?i:this.length(t,i),this.isValueNearValue(e,t)},t.isPointInsideOrNearCircle=function(e,t,i){return e=this.length(t,e),t="number"==typeof i?i:this.length(t,i),this.isValueBetweenOrNearValues(e,0,t)},t.isPointNearPolygon=function(e,t){if(2>t.length)return!1
for(var i=0;i<t.length-1;i++)if(this.isPointNearLine(e,t[i],t[i+1]))return!0
return this.isPointNearLine(e,t[t.length-1],t[0])},t.isPointNearLine=function(e,t,i){if(!this.isPointInsideOrNearRectPoints(e,t,i))return!1
if(Math.abs(t.x-i.x)<=this.DEVIATION)return!0
i=(t.y-i.y)/(t.x-i.x)
var r=Math.abs(180*Math.atan(i)/Math.PI)
return 10>=Math.abs(r-90)||10>=Math.abs(r-270)?this.isValueNearValue((e.y-(t.y-t.x*i))/i,e.x):this.isValueNearValue(t.y+i*(e.x-t.x),e.y)},t.isPointNearPolyline=function(e,t){for(var i=0,r=t.length;i<r-1;i++)if(this.isPointNearLine(e,t[i],t[i+1]))return!0
return!1},t.isPointNearEllipse=function(e,t,i){return this.isPointNearEllipseWithRadiuses(e,t,Math.abs(i.x-t.x),Math.abs(i.y-t.y))},t.isPointNearEllipseWithRadiuses=function(e,t,i,r){var n=e.x-t.x
return e=e.y-t.y,.8<(i=n*n/(i*i)+e*e/(r*r))&&1.3>i}}(e.Geometry||(e.Geometry={}))}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){this._eventsDispatcher=new e.EventsDispatcher,this._suppressEvents=!1,this._event={type:null,sender:this,target:this,value:void 0,oldValue:void 0}}return t.prototype.suppressEvents=function(e){var t=this._suppressEvents
return this._suppressEvents=null==e||e,t},t.prototype.on=function(e,t,i){return this._eventsDispatcher.on(e,t,i),this},t.prototype.off=function(e,t){return this._eventsDispatcher.off(e,t),this},t.prototype.fire=function(e,t){this._suppressEvents||(t&&(t.sender=this),this._eventsDispatcher.fire(e,t))},t.prototype.fireValueChanged=function(e,t,i){this.fireTargetValueChanged(this,e,t,i)},t.prototype.fireTargetValueChanged=function(e,t,i,r){if(!this._suppressEvents){var n=this._event
n.target=e||this,n.value=i,n.oldValue=r,this.fire(t,n)}},t}()
e.EventableObject=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(){this._listeners={}}return e.prototype.on=function(e,t,i){e=e.split(" ")
for(var r=this._listeners,n=0;n<e.length;n++){var o=e[n]
if(o){var a=o.split("."),o=a[0],a=a[1]||""
r[o]||(r[o]=[]),r[o].push({name:a,handler:t,target:i})}}},e.prototype.off=function(e,t){for(var i=0,r=e.split(" ");i<r.length;i++){var n=r[i]
if(n){var o=n.split("."),n=o[0],o=o[1]||""
if(n)this._off(n,o,t)
else{var a,n=this._listeners
for(a in n)n.hasOwnProperty(a)&&this._off(a,o,t)}}}},e.prototype._off=function(e,t,i){t=t||""
var r=this._listeners[e]
if(r){for(var n=0;n<r.length;n++)r[n].name!==t||i&&i!==r[n].target||(r.splice(n,1),n--)
0===r.length&&delete this._listeners[e]}},e.prototype.fire=function(e,t){var i=this._listeners[e]
if(i){t=t||{},t.type=e
for(var r=0;r<i.length;r++)i[r].handler(t)}},e}()
e.EventsDispatcher=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(){this._suppressEvents=!1}return e.prototype.suppressEvents=function(e){var t=this._suppressEvents
return this._suppressEvents=null==e||e,t},e.prototype.fire=function(e,t,i){var r=this.chart
r&&!this._suppressEvents&&r.fireTargetValueChanged(this,e,t,i)},e}()
e.ChartEventsExtender=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=jQuery
e.ViewsPath="view/",e.ChartState={NORMAL:0,RESIZING_PANELS:1,USER_DRAWING:2,ZOOM_IN:3},Object.freeze(e.ChartState),e.ChartEvent={WINDOW_MODE_CHANGED:"chartWindowModeChanged",TOOLBAR_LOADED:"chartToolbarLoaded",STATE_CHANGED:"chartStateChanged",TIME_INTERVAL_CHANGED:"chartTimeIntervalChanged",INDICATOR_ADDED:"chartIndicatorAdded",INDICATOR_REMOVED:"chartIndicatorRemoved",THEME_CHANGED:"chartThemeChanged",GLOBAL_THEME_CHANGED:"chartGlobalThemeChanged",PRICE_STYLE_CHANGED:"chartPriceStyleChanged",HOVER_RECORD_CHANGED:"chartHoverRecordChanged",INSTRUMENT_CHANGED:"chartInstrumentChanged",SYMBOL_ENTERED:"chartSymbolEntered",TIME_FRAME_CHANGED:"chartTimeFrameChanged",CROSS_HAIR_CHANGED:"chartCrossHairChanged",STATE_LOADED:"chartStateLoaded",LOCALE_CHANGED:"chartLocaleChanged",ENABLE_KEYBOARD_EVENTS_CHANGED:"chartEnableKeyboardEventsChanged",ENABLE_MOUSE_EVENTS_CHANGED:"chartEnableMouseEventsChanged",VALUE_SCALE_ADDED:"chartValueScaleAdded",VALUE_SCALE_REMOVED:"chartValueScaleRemoved",USER_DRAWING_STARTED:"chartUserDrawingStarted",USER_DRAWING_FINISHED:"chartUserDrawingFinished",USER_DRAWING_CANCELLED:"chartUserDrawingCancelled",PANEL_ADDED:"chartPanelAdded",PANEL_REMOVED:"chartPanelRemoved",DATE_SCALE_THEME_CHANGED:"dateScaleThemeChanged",FIRST_VISIBLE_RECORD_CHANGED:"firstVisibleRecordChanged",LAST_VISIBLE_RECORD_CHANGED:"lastVisibleRecordChanged",MORE_HISTORY_REQUESTED:"chartMoreHistoryRequested",ZOOM_IN_STARTED:"chartZoomInStarted",ZOOM_IN_FINISHED:"chartZoomInFinished",ZOOM_IN_CANCELLED:"chartZoomInCancelled"},Object.freeze(e.ChartEvent),e.getAllInstruments=function(){return[]}
var i=e.TimeSpan.MILLISECONDS_IN_MINUTE,r=function(r){function n(n){if(r.call(this),this._valueScales=[],this._chartPanelsFrame=new e.Rect,this._indicators=[],this._options={},this._showDrawings=!0,this._showDrawingTooltips=!0,this._stayInDrawingMode=!1,this._state=e.ChartState.NORMAL,this._updateAnimation=new e.Animation({context:this,recurring:!1,callback:this._onUpdateAnimationCallback}),this._wasInFullWindowMode=!1,this._isInFullScreenMode=!1,"object"!=typeof n)throw Error("Config must be an object.")
if(!n.container)throw Error("Chart container is not specified.")
if(this._container=t(n.container),0===this._container.length)throw Error("Unable to find HTML element by selector '"+n.container+'".')
var o=n.width||800
if(0>=o)throw Error("Width must be a positive number.")
var a=n.height||600
if(0>=a)throw Error("Height must be a positive number.")
this._instrument=n.instrument,this.timeInterval=n.timeInterval||i,this._loadOptionsState(n),this._valueMarker=new e.ValueMarker,this._dateMarker=new e.DateMarker,this._selectionMarker=new e.SelectionMarker({chart:this}),this._layoutHtmlElements(o,a),this._applyTheme(),this._dataManager=new e.DataManager,this._dataManager.addBarDataSeries(),this._dateScale=new e.DateScale({chart:this}),this.valueScales.push(new e.ValueScale({chart:this})),this._chartPanelsContainer=new e.ChartPanelsContainer({chart:this}),this._crossHair=new e.CrossHair({chart:this}),null!=n.crossHair&&(this.crossHairType=n.crossHair),this._priceStyle=new e.CandlePriceStyle({chart:this}),this._priceStyle.apply(),null!=n.priceStyle&&(this.priceStyleKind=n.priceStyle),this._subscribeEvents(),this.layout(),!1!==n.showToolbar&&(e.JsUtil.isFunction(n.onToolbarLoaded)&&this.on(e.ChartEvent.TOOLBAR_LOADED,n.onToolbarLoaded),this._container.scx().toolbar(this)),!1!==n.showNavigation&&this._rootDiv.scx().chartNavigation(this),n.fullWindowMode&&this.toggleFullWindow(),this._trackFullScreen()}return __extends(n,r),Object.defineProperty(n,"version",{get:function(){return"2.15.3"},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"container",{get:function(){return this._container},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"rootDiv",{get:function(){return this._rootDiv},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"dateScale",{get:function(){return this._dateScale},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"valueScales",{get:function(){return this._valueScales},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"valueScale",{get:function(){return this._valueScales[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"chartPanelsContainer",{get:function(){return this._chartPanelsContainer},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"dataManager",{get:function(){return this._dataManager},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"timeInterval",{get:function(){return this._timeInterval},set:function(t){t=parseInt(t,10)
var i=this._timeInterval
if(i!=t){if(!isFinite(t)||0>=t)throw Error("Time interval must be greater than 0.")
this._timeInterval=t,this.fireValueChanged(e.ChartEvent.TIME_INTERVAL_CHANGED,t,i)}},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"chartPanelsFrame",{get:function(){return this._chartPanelsFrame},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"instrument",{get:function(){return this._instrument},set:function(t){this._instrument=t,this.fireValueChanged(e.ChartEvent.INSTRUMENT_CHANGED,t,t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"indicators",{get:function(){return this._indicators},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"valueMarker",{get:function(){return this._valueMarker},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"dateMarker",{get:function(){return this._dateMarker},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"locale",{get:function(){return this._options.locale},set:function(t){var i=this._options.locale
i!=t&&(this._options.locale=t,this.fireValueChanged(e.ChartEvent.LOCALE_CHANGED,t,i))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"keyboardEventsEnabled",{get:function(){return this._options.enableKeyboardEvents},set:function(t){this._options.enableKeyboardEvents=!!t,this.fireValueChanged(e.ChartEvent.ENABLE_KEYBOARD_EVENTS_CHANGED,this._options.enableKeyboardEvents)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"mouseEventsEnabled",{get:function(){return this._options.enableMouseEvents},set:function(t){this._options.enableMouseEvents=!!t,this.fireValueChanged(e.ChartEvent.ENABLE_MOUSE_EVENTS_CHANGED,this._options.enableMouseEvents)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"theme",{get:function(){return this._options.theme},set:function(t){var i=this._options.theme
this._options.theme=t,this._applyTheme(),this.updateIndicators(),this.fireValueChanged(e.ChartEvent.THEME_CHANGED,t,i)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showBarInfoInTitle",{get:function(){return this._options.showBarInfoInTitle},set:function(e){this._options.showBarInfoInTitle=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"priceStyle",{get:function(){return this._priceStyle},set:function(t){var i=this.priceStyle
if(i!==t){var r=this.dateRange()
this._priceStyle.destroy(),t.chart=this,this._priceStyle=t,this._priceStyle.apply()
var n=this.dateScale,o=n.projection,a=o.recordByX(o.xByDate(r.startDate,!1),!1),r=o.recordByX(o.xByDate(r.endDate,!1),!1)
n.canSetVisibleRecord(a)&&n.canSetVisibleRecord(r)?(this.firstVisibleRecord=a,this.lastVisibleRecord=r-1,this.lastVisibleRecord-this.firstVisibleRecord<n.minVisibleRecords?this.setNeedsAutoScaleAll():this.setNeedsAutoScale()):this.setNeedsAutoScaleAll(),this.fireValueChanged(e.ChartEvent.PRICE_STYLE_CHANGED,t,i)}},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"priceStyleKind",{get:function(){var e=this.priceStyle
return e&&e.constructor.className},set:function(t){this.priceStyle=e.PriceStyle.create(t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hoveredRecord",{get:function(){return this._hoverRecord},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"crossHair",{get:function(){return this._crossHair},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectedObject",{get:function(){return this._selectedObject},set:function(e){this._selectedObject=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"selectionMarker",{get:function(){return this._selectionMarker},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showDrawings",{get:function(){return this._showDrawings},set:function(e){this._showDrawings=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showDrawingTooltips",{get:function(){return this._showDrawingTooltips},set:function(e){this._showDrawingTooltips=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"stayInDrawingMode",{get:function(){return this._stayInDrawingMode},set:function(e){this._stayInDrawingMode=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"state",{get:function(){return this._state},set:function(t){var i=this._state
i!==t&&(this._state=t,this.fireValueChanged(e.ChartEvent.STATE_CHANGED,t,i))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return{width:this._rootDiv.width(),height:this._rootDiv.height()}},set:function(e){this._container.css("width","auto").css("height","auto"),this._rootDiv.width(e.width).height(e.height),this._rootDiv.find(".scxBackground").width(e.width).height(e.height)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"mainPanel",{get:function(){return this._priceStyle.chartPanel||this._chartPanelsContainer.panels[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"recordCount",{get:function(){return this.primaryDataSeries(e.DataSeriesSuffix.DATE).length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"firstVisibleRecord",{get:function(){return this._dateScale.firstVisibleRecord},set:function(e){this._dateScale.firstVisibleRecord=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"lastVisibleRecord",{get:function(){return this._dateScale.lastVisibleRecord},set:function(e){this._dateScale.lastVisibleRecord=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"firstVisibleIndex",{get:function(){return this._dateScale.firstVisibleIndex},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"lastVisibleIndex",{get:function(){return this._dateScale.lastVisibleIndex},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"chartPanels",{get:function(){return this._chartPanelsContainer.panels},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"crossHairType",{get:function(){return this._crossHair.crossHairType},set:function(e){this._crossHair.crossHairType=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"zoomInView",{get:function(){return this._zoomInView},set:function(e){this._zoomInView=e},enumerable:!0,configurable:!0}),n.prototype.getBounds=function(){return new e.Rect({left:0,top:0,width:this._rootDiv.width(),height:this._rootDiv.height()})},n.prototype.selectObject=function(e){var t=this._selectedObject
return!(!t&&!e||t===e&&e.selected||(t&&(t.selected=!1),e&&(e.selected=!0),this.selectedObject=e,this.setNeedsUpdate(),0))},n.prototype.addValueScale=function(t){var i=this.valueScales
if(t){for(var r=0;r<i.length;r++)if(i[r]===t)throw Error("Value scale has been added already.")}else t=new e.ValueScale({chart:this})
return i.push(t),this.fireValueChanged(e.ChartEvent.VALUE_SCALE_ADDED,t),t},n.prototype.removeValueScale=function(t){var i
if(Array.isArray(t))for(i=0;i<t.length;i++)this.removeValueScale(t[i])
else{var r=this.valueScales
for(i=0;i<r.length;i++)if(r[i]===t){if(0===i)throw Error("Cannot remove main scale.")
r.splice(i,1),this.fireValueChanged(e.ChartEvent.VALUE_SCALE_REMOVED,i)
break}}},n.prototype.addIndicators=function(i){if(Array.isArray(i)){for(var r=[],n=0;n<i.length;n++){var o=i[n]
r.push(this.addIndicators(o))}return r}if(e.JsUtil.isNumber(i))return this.addIndicators(new e.TAIndicator({taIndicator:i}))
if(i instanceof e.Indicator){for(r=this._indicators,n=0;n<r.length;n++)if((o=r[n])===i)return i
return i.chart=this,r.push(i),i.update(),this.fireValueChanged(e.ChartEvent.INDICATOR_ADDED,i),i}if("object"==typeof i)return o=t.extend(!0,{chart:this},i),i=e.Indicator.deserialize(o),this.addIndicators(i)
throw new TypeError("Unknown indicator.")},n.prototype.removeIndicators=function(t,i){var r=this
if(void 0===i&&(i=!0),Array.isArray(t))for(var n=0;n<t.length;n++){var o=t[n]
o&&this.removeIndicators(o,i)}else for(var n=this._indicators,a=function(t){var n=t.chartPanel
n&&(n.removePlot(t.plots),i&&0==n.plots.length&&n!==r.mainPanel&&n.chartPanelsContainer.removePanel(n)),t.destroy(),r.fireValueChanged(e.ChartEvent.INDICATOR_REMOVED,t)},s=0;s<n.length;s++)if(t){if(n[s]===t){n.splice(s,1),a(t)
break}}else o=n[s],n.splice(s,1),a(o),s--},n.prototype.updateIndicators=function(){for(var e=0,t=this._indicators;e<t.length;e++)t[e].update()},n.prototype.saveIndicatorsState=function(){for(var e=[],t=this._indicators,i=0,r=this.chartPanels;i<r.length;i++)for(var n=r[i],o=0,a=t;o<a.length;o++){var s=a[o]
s.chartPanel===n&&e.push(s.serialize())}return e},n.prototype.loadIndicatorsState=function(e){"string"==typeof e&&(e=JSON.parse(e)),this.removeIndicators(),e&&this.addIndicators(e)},n.prototype.saveDrawingsState=function(){for(var e=[],t=0,i=this._chartPanelsContainer.panels;t<i.length;t++)for(var r=0,n=i[t].drawings;r<n.length;r++)e.push(n[r].saveState())
return e},n.prototype.loadDrawingsState=function(t){if("string"==typeof t&&(t=JSON.parse(t)),this.removeDrawings(),t)for(var i=this._chartPanelsContainer.panels,r=0;r<t.length;r++){var n=t[r],o=i[n.panelIndex]
o&&(n=e.Drawing.deserialize(n))&&o.addDrawings(n)}},n.prototype.removeDrawings=function(){for(var e=0,t=this._chartPanelsContainer.panels;e<t.length;e++)t[e].removeDrawings()},n.prototype.saveState=function(){for(var e=[],i=0,r=this.valueScales;i<r.length;i++)e.push(r[i].saveState())
return{chart:t.extend(!0,{},this._options),priceStyle:this._priceStyle.saveState(),dateScale:this._dateScale.saveState(),valueScales:e,crossHair:this._crossHair.saveState(),chartPanelsContainer:this._chartPanelsContainer.saveState(),indicators:this.saveIndicatorsState(),drawings:this.saveDrawingsState()}},n.prototype.loadState=function(t){"string"==typeof t&&(t=JSON.parse(t)),t=t||{},this.suppressEvents(),this.removeIndicators(),this._loadOptionsState(t.chart),this._dateScale.loadState(t.dateScale),this._restoreValueScales(t),this._crossHair.loadState(t.crossHair),this._chartPanelsContainer.loadState(t.chartPanelsContainer),this._priceStyle=e.PriceStyle.deserialize(t.priceStyle),this._priceStyle.chart=this,this._priceStyle.apply(),this.layout(),this.loadIndicatorsState(t.indicators),this.loadDrawingsState(t.drawings),this.suppressEvents(!1),this.fireValueChanged(e.ChartEvent.STATE_LOADED)},n.prototype._restoreValueScales=function(t){for(var i=this.valueScales,r=0;r<i.length;r++)i[r].destroy()
for(r=t.valueScales||[t.valueScale],t=i.length=0;t<r.length;t++){var n=new e.ValueScale({chart:this})
i.push(n),n.loadState(r[t])}0===i.length&&i.push(new e.ValueScale({chart:this}))},n.prototype.startUserDrawing=function(t){switch(this.state){case e.ChartState.USER_DRAWING:this.cancelUserDrawing()
break
case e.ChartState.NORMAL:break
default:throw Error("Unable to start user drawing in this chart state.")}this.state=e.ChartState.USER_DRAWING,this.selectObject(null),this.addCssClass(e.DrawingCursorClass.CREATE),t.startUserDrawing(),this.selectedObject=t,this.fireValueChanged(e.ChartEvent.USER_DRAWING_STARTED,t)},n.prototype.cancelUserDrawing=function(){if(this.state===e.ChartState.USER_DRAWING){var t=this._selectedObject.chartPanel
t&&t.removeDrawings(this._selectedObject),this.selectObject(null),this.removeCssClass(e.DrawingCursorClass.CREATE),this.state=e.ChartState.NORMAL,this.fireValueChanged(e.ChartEvent.USER_DRAWING_CANCELLED)}},n.prototype._finishUserDrawing=function(){if(this.removeCssClass(e.DrawingCursorClass.CREATE),this.state=e.ChartState.NORMAL,this.fireValueChanged(e.ChartEvent.USER_DRAWING_FINISHED,this._selectedObject),this.stayInDrawingMode){var t=e.Drawing.deserialize({className:this._selectedObject.className})
this.startUserDrawing(t)}},n.prototype.startZoomIn=function(t){this.zoomInView=new e.ZoomInView,this.zoomInView.zoomMode=t,this.state=e.ChartState.ZOOM_IN,this.fireValueChanged(e.ChartEvent.ZOOM_IN_STARTED)},n.prototype.cancelZoomIn=function(){this.zoomInView&&this.state===e.ChartState.ZOOM_IN&&(this.state=e.ChartState.NORMAL,this.fireValueChanged(e.ChartEvent.ZOOM_IN_CANCELLED),this.zoomInView.cancelDraw())},n.prototype.setNeedsAutoScaleAll=function(){this._dateScale.setNeedsAutoScale(),this._chartPanelsContainer.setNeedsAutoScale()},Object.defineProperty(n.prototype,"isInFullWindowMode",{get:function(){return!!this._preFullWindowSize},enumerable:!0,configurable:!0}),n.prototype.toggleFullWindow=function(){this.isInFullWindowMode?(this._container.removeClass("scxFullWindow"),this.size=this._preFullWindowSize,this._preFullWindowSize=null,this.setNeedsUpdate()):(this._preFullWindowSize=this.size,this._container.addClass("scxFullWindow"),this._handleFullWindowResize()),t(window).trigger("scxFullWindowChange",this)},Object.defineProperty(n.prototype,"isInFullScreenMode",{get:function(){return this._isInFullScreenMode},enumerable:!0,configurable:!0}),n.prototype.toggleFullScreen=function(){return e.HtmlUtil.isFullScreenAllowed()?void(this.isInFullScreenMode?(e.HtmlUtil.exitFullScreen(),t(document).trigger("scxFullscreenChange",this)):e.HtmlUtil.isFullScreenEnabled()||(e.HtmlUtil.goFullScreen(this._container[0]),t(document).trigger("scxFullscreenChange",this))):void e.UI.Notification.warning("Fullscreen mode is not supported in your browser")},n.prototype._onBrowserFullScreenChange=function(i){var r=i.data,n=t(i.target)
e.Environment.browser!==e.Browser.firefox&&e.Environment.browser!==e.Browser.ie||null==(n=e.Environment.browser===e.Browser.firefox?i.target.mozFullScreenElement:i.target.msFullscreenElement)&&(r._isInFullScreenMode=!1,t("body").removeClass("scxFullScreen"),r._wasInFullWindowMode!==r.isInFullWindowMode&&r.toggleFullWindow(),t(window).trigger("scxFullScreenChange",r)),t(n).is(r._container)&&(r._isInFullScreenMode=!r._isInFullScreenMode,r._isInFullScreenMode?(r._wasInFullWindowMode=r.isInFullWindowMode,r.isInFullWindowMode||r.toggleFullWindow(),t("body").addClass("scxFullScreen")):(t("body").removeClass("scxFullScreen"),r._wasInFullWindowMode!==r.isInFullWindowMode&&r.toggleFullWindow()),t(window).trigger("scxFullScreenChange",r))},n.prototype._trackFullScreen=function(){t(document).on("webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",this,this._onBrowserFullScreenChange)},n.prototype._unTrackFullScreen=function(){t(document).off("webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",this._onBrowserFullScreenChange)},n.prototype.setNeedsLayout=function(){this.layout()},n.prototype.layout=function(){var t=this.getBounds(),i=this._dateScale.layoutScalePanel(t)
this._chartPanelsFrame=this._chartPanelsContainer.layoutScalePanel(i),i=new e.Rect({left:i.left,top:t.top,width:i.width,height:t.height}),t=new e.Rect({left:this._chartPanelsFrame.left,top:t.top,width:this._chartPanelsFrame.width,height:t.height}),this._dateScale.layout(i,t),this._chartPanelsContainer.layout(this._chartPanelsFrame),this._crossHair.layout()},n.prototype.draw=function(){this._dateScale.draw(),this._chartPanelsContainer.draw()},n.prototype.update=function(){this.layout(),this.draw()},n.prototype.setNeedsUpdate=function(e){e&&this.setNeedsAutoScale(),this._updateAnimation.start()},n.prototype._onUpdateAnimationCallback=function(){this.update()},n.prototype.updateSplitter=function(e){this._chartPanelsContainer.layoutSplitterPanels(e)},n.prototype.destroy=function(){this._container&&this._container.remove(),t(window).off("resize.scx keydown.scx"),this._unTrackFullScreen()},n.prototype.showWaitingBar=function(e){this._waitingBar||(this._waitingBar=this._container.scx().waitingBar()),this._waitingBar.show(e)},n.prototype.hideWaitingBar=function(e){this._waitingBar&&this._waitingBar.hide(e)},n.prototype._handleWindowResize=function(e){e=e.data,e.isInFullWindowMode&&e._handleFullWindowResize()},n.prototype._handleKeyDown=function(e){var i=e.data,r=e.ctrlKey||e.metaKey
if(i.keyboardEventsEnabled&&e.target===document.activeElement&&!t(e.target).hasClass("modal-open")&&!t(e.target).hasClass("form-control")){switch(e.keyCode){case 107:i.zoomOnPixels(.05*i.size.width),i.setNeedsUpdate(!0)
break
case 109:i.zoomOnPixels(-.05*i.size.width),i.setNeedsUpdate(!0)
break
case 37:i.scrollOnPixels(.05*i.size.width),i.setNeedsUpdate(!0)
break
case 39:i.scrollOnPixels(-.05*i.size.width),i.setNeedsUpdate(!0)
break
case 46:if(!(r=(i=i.selectedObject)&&i.chartPanel))return
i.tooltip.hide(),r.removeDrawings(i)
break
case 67:r&&i._copyDrawing()
break
case 86:r&&i._pasteDrawing()
break
default:return}e.preventDefault()}},n.prototype._copyDrawing=function(){for(var e,t=0,i=this.chartPanels;t<i.length;t++){for(var r=0,n=i[t].drawings;r<n.length;r++){var o=n[r]
if(o.selected){e=o
break}}if(e)break}e&&(this._copyBuffer=e.clone())},n.prototype._pasteDrawing=function(){if(this._copyBuffer){for(var e=this._copyBuffer.chartPanel,t=0,i=this.chartPanels;t<i.length;t++)if(i[t]===e)return t=this._copyBuffer.clone(),e.addDrawings(t),t.translate(0,-30),void e.setNeedsUpdate()
this._copyBuffer=null}},n.prototype._handleMouseEvents=function(e){var i=e.data,r=e.originalEvent,n=void 0!==e.pageX?e.pageX:r.pageX,o=void 0!==e.pageY?e.pageY:r.pageY,r=r&&r.changedTouches
if(i.mouseEventsEnabled&&(!n&&!o&&r&&0<r.length&&(o=r[r.length-1],n=o.pageX,o=o.pageY),n={pointerPosition:i._rootDiv.scxClientToLocalPoint(n,o),evt:e},i._updateHoverRecord.call(i,n.pointerPosition.x),!e.toElement||!t(e.toElement).hasClass("scxTooltip"))){switch(i._dateScale.handleEvent(n)||i._chartPanelsContainer.handleEvent(n),e.type){case"click":case"mousedown":case"touchstart":case"touchend":if(!n.stopPropagation)return}return e.preventDefault(),e.stopPropagation(),!1}},n.prototype.saveImage=function(e){html2canvas(this._rootDiv,{onrendered:function(t){if(e)e(t)
else if(t.msToBlob)navigator.msSaveBlob(t.msToBlob(),"Chart.png")
else{t=t.toDataURL().replace(/^data:image\/[^;]/,"data:application/octet-stream")
var i=document.createElement("a")
i.download="Chart.png",i.href=t,document.body.appendChild(i),i.click(),document.body.removeChild(i)}}})},n.prototype._loadOptionsState=function(t){t=t||{},this._options={theme:t.theme||e.Theme.Light,locale:t.locale||"en-US",enableKeyboardEvents:void 0===t.enableKeyboardEvents||!!t.enableKeyboardEvents,enableMouseEvents:void 0===t.enableMouseEvents||!!t.enableMouseEvents,showBarInfoInTitle:void 0===t.showBarInfoInTitle||!!t.showBarInfoInTitle,priceStyle:e.CandlePriceStyle.className}},n.prototype._layoutHtmlElements=function(e,t){this._container.addClass("scxRootContainer"),this._rootDiv=this._container.scxAppend("div","scxContainer").addClass("scxUnSelective").width(e).height(t),this._rootDiv.scxAppend("div","scxBackground").width(e).height(t)},n.prototype._applyTheme=function(){var e=this.theme,t=e.chart
this._applyChartBackground(t.background),t=t.border,this._container.find(".scxContainer").css("border",t.width+"px "+t.lineStyle+" "+t.strokeColor),this._valueMarker.theme=e.valueScale.valueMarker,this._dateMarker.theme=e.dateScale.dateMarker},n.prototype._applyChartBackground=function(t){var i=this._container.find(".scxBackground")
if(Array.isArray(t)){if(0===t.length)throw Error("Invalid theme: 'background' must be a color or array of colors.")
1===t.length?e.HtmlUtil.setBackgroundColor(i,t[0]):e.HtmlUtil.setGradientBackground(i,t)}else e.HtmlUtil.setBackgroundColor(i,t)},n.prototype._subscribeEvents=function(){this._rootDiv.on("mouseenter mouseleave mousedown mousemove mouseup click dblclick mousewheel DOMMouseScroll contextmenu touchstart touchmove touchend ".split(" ").join(".scx, "),this,this._handleMouseEvents),t(window).on("resize.scx",this,this._handleWindowResize).on("keydown.scx",this,this._handleKeyDown)},n.prototype._updateHoverRecord=function(t){(t=this._dateScale.projection.recordByX(t))!=this._hoverRecord&&(this._hoverRecord=t,this.fireValueChanged(e.ChartEvent.HOVER_RECORD_CHANGED,t))},n.prototype._handleFullWindowResize=function(){this._container.outerWidth(window.innerWidth-3).outerHeight(window.innerHeight-3),this.size={width:this._container.innerWidth()-1,height:this._container.innerHeight()-this._rootDiv.position().top-1},this.setNeedsUpdate()},n.prototype.barDataSeries=function(){return this._dataManager.barDataSeries()},n.prototype.getCommonDataSeries=function(){return this.barDataSeries()},n.prototype.addDataSeries=function(e,t){return this._dataManager.addDataSeries(e,t)},n.prototype.removeDataSeries=function(e){this._dataManager.removeDataSeries(e)},n.prototype.clearDataSeries=function(e){this._dataManager.clearDataSeries(e)
for(var t=0,i=this._indicators;t<i.length;t++)i[t].clearDataSeries(e)},n.prototype.trimDataSeries=function(e){this.dataManager.trimDataSeries(e)},n.prototype.getDataSeries=function(e){return this._dataManager.getDataSeries(e)},n.prototype.primaryDataSeries=function(e,t){void 0===t&&(t="")
var i=this.priceStyle.primaryDataSeriesSuffix(e)
return this.getDataSeries(t+i+e)},n.prototype.primaryBarDataSeries=function(t){var i=e.DataSeriesSuffix
return{date:this.primaryDataSeries(i.DATE,t),open:this.primaryDataSeries(i.OPEN,t),high:this.primaryDataSeries(i.HIGH,t),low:this.primaryDataSeries(i.LOW,t),close:this.primaryDataSeries(i.CLOSE,t),volume:this.primaryDataSeries(i.VOLUME,t)}},n.prototype.findDataSeries=function(e){return this._dataManager.findDataSeries(e)},n.prototype.appendBars=function(e){this._dataManager.appendBars(e)},n.prototype.addChartPanel=function(e,t,i){return this._chartPanelsContainer.addPanel(e,t,i)},n.prototype.findPanelAt=function(e){return this._chartPanelsContainer.findPanelAt(e)},n.prototype.setNeedsAutoScale=function(){this._chartPanelsContainer.setNeedsAutoScale()},n.prototype.scrollOnPixels=function(e){this._dateScale.scrollOnPixels(e)},n.prototype.scrollOnRecords=function(e){this._dateScale.scrollOnRecords(e)},n.prototype.zoomOnPixels=function(e){this._dateScale.zoomOnPixels(e)},n.prototype.zoomOnRecords=function(e){this._dateScale.zoomOnRecords(e)},n.prototype.recordRange=function(t,i){if(null==t&&null==i)return{firstVisibleRecord:this.firstVisibleRecord,lastVisibleRecord:this.lastVisibleRecord}
var r=this.recordCount
if(null==i){if(!e.JsUtil.isFiniteNumber(t)||0>=t)throw new TypeError("Positive number expected.")
this.firstVisibleRecord=Math.max(r-t,0),this.lastVisibleRecord=r-1}else{if(!e.JsUtil.isFiniteNumber(t)||0>t)throw new TypeError("First record must be a positive number or 0.")
if(!e.JsUtil.isFiniteNumber(i))throw new TypeError("Last record must be a positive number.")
if(i<=t)throw Error("Last record must be greater than first record.")
this.firstVisibleRecord=t,this.lastVisibleRecord=i}},n.prototype.barsBetweenPoints=function(t,i){var r=this.dateScale.projection,n=0,o=this.primaryDataSeries(e.DataSeriesSuffix.CLOSE).length
return 0<o&&(n=new e.ChartPoint(t).getRecord(r),r=new e.ChartPoint(i).getRecord(r),n=0<=n&&n<o||0<=r&&r<o?Math.trunc(Math.min(Math.max(r,0),o-1))-Math.trunc(Math.min(Math.max(n,0),o-1))+(r>=n?1:-1):0>=n&&r>=o?o:0>=r&&n>=o?-o:0),n},n.prototype.dateRange=function(e,t){var i=this.dateScale,r=i.projection
if(!e&&!t)return i=i.projectionFrame,{startDate:r.dateByX(i.left),endDate:r.dateByX(i.right)}
i=r.recordByX(r.xByDate(e,!1),!1),r=r.recordByX(r.xByDate(t,!1),!1),this.firstVisibleRecord=i,this.lastVisibleRecord=r-1},n.prototype.updateComputedDataSeries=function(){this.priceStyle.updateComputedDataSeries()},n.prototype.addCssClass=function(e){this.rootDiv.addClass(e)},n.prototype.removeCssClass=function(e){this.rootDiv.removeClass(e)},n}(e.EventableObject)
e.Chart=r}(StockChartX||(StockChartX={})),function(e){jQuery.fn.StockChartX=function(t){return t=t||{},t.container=this,new e.Chart(t)}}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(e){var t=this
this._maxChartsCountY=this._maxChartsCountX=1,this._chartsItems=[],this._displacement={width:2,height:20},this._isFullScreenMode=this._isFullWindowMode=!1,this._parent=e,$(window).resize(function(){return t.resizeCharts()}),$(window).on("scxFullScreenChange",this,function(e,i){return t._fullScreenChange(e,i)}),$(window).on("scxFullWindowChange",this,function(e,i){return t._fullWindowChange(e,i)})}return Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toolbar",{get:function(){return this._toolbar},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"containerDisplacement",{get:function(){return this._displacement},set:function(e){this._displacement=e},enumerable:!0,configurable:!0}),t.prototype.addChart=function(){var t,i,r,n,o=this,a=this,s=$('<div class="scxChartContainer scxNonActiveBorder"></div>').appendTo(this._parent),l=s.StockChartX({width:0,height:0,showToolbar:!1}),c=l.keyboardEventsEnabled,h=l.mouseEventsEnabled
return l.keyboardEventsEnabled=!1,l.mouseEventsEnabled=!1,l.on(e.ChartEvent.ENABLE_KEYBOARD_EVENTS_CHANGED+".chartsContainer",function(e){t=e.target,i=e.value}).on(e.ChartEvent.ENABLE_MOUSE_EVENTS_CHANGED+".chartsContainer",function(e){r=e.target,n=e.value}),this._toolbar||(this._toolbar=new e.UI.Toolbar({parent:this._parent.parent(),chart:l}),s.removeClass("scxNonActiveBorder"),s.addClass("scxActiveBorder"),l===t&&(c=i),c&&(l.keyboardEventsEnabled=!0),l===r&&(h=n),h&&(l.mouseEventsEnabled=!0)),s.mousedown(function(s){s=$(s.currentTarget)
for(var l=0,c=o._chartsItems;l<c.length;l++){var h=c[l]
h.chart.off(".chartsContainer"),s.is(h.container)?(h.container.addClass("scxActiveBorder"),h.container.removeClass("scxNonActiveBorder"),h.chart===t&&(h.keyboardEventsEnabled=i),h.keyboardEventsEnabled&&(h.chart.keyboardEventsEnabled=!0),h.chart===r&&(h.mouseEventsEnabled=n),h.mouseEventsEnabled&&(h.chart.mouseEventsEnabled=!0),a._toolbar.chart=h.chart):(h.container.removeClass("scxActiveBorder"),h.container.addClass("scxNonActiveBorder"),h.chart===t&&(h.keyboardEventsEnabled=i),h.keyboardEventsEnabled&&(h.chart.keyboardEventsEnabled=!1),h.chart===r&&(h.mouseEventsEnabled=n),h.mouseEventsEnabled&&(h.chart.mouseEventsEnabled=!1)),h.chart.on(e.ChartEvent.ENABLE_KEYBOARD_EVENTS_CHANGED+".chartsContainer",function(e){t=e.target,i=e.value}).on(e.ChartEvent.ENABLE_MOUSE_EVENTS_CHANGED+".chartsContainer",function(e){r=e.target,n=e.value})}}),this._chartsItems.push({container:s,chart:l,keyboardEventsEnabled:c,mouseEventsEnabled:h}),s.css("float","left"),this._parent.css({top:0,left:0,height:"100%",width:"100%",display:"block",clear:"both",overflow:"hidden"}),this._parent.parent().css({height:"100%",width:"100%",clear:"both",overflow:"hidden"}),l},t.prototype.resizeCharts=function(){if(!this._isFullWindowMode){var e=this
switch(this._chartsItems.length){case 1:this._maxChartsCountY=this._maxChartsCountX=1
break
case 2:this._maxChartsCountX=1,this._maxChartsCountY=2
break
case 3:this._maxChartsCountX=1,this._maxChartsCountY=3
break
default:this._maxChartsCountY=this._maxChartsCountX=2}var t=this._parent.parent().parent(),i=t.height()/this._maxChartsCountY-2,r=t.width()/this._maxChartsCountX-2
$.each(this._chartsItems,function(t,n){n.chart.size={width:r-e.containerDisplacement.width,height:i-e.containerDisplacement.height},n.chart.setNeedsAutoScale(),n.chart.setNeedsUpdate()}),this._parent.parent().width(t.width()).height(t.height())}},t.prototype._fullScreenChange=function(e,t){t.isInFullScreenMode?(this.toolbar.prependTo(t.container),this.parent.parent().parent().css({width:window.outerWidth,height:window.outerHeight}),this._isFullScreenMode=!0):(this._isFullWindowMode||this.toolbar.prependTo(this._parent.parent()),this.parent.parent().parent().css({width:"100%",height:"100%"}),this._isFullScreenMode=!1,this.resizeCharts())},t.prototype._fullWindowChange=function(e,t){t.isInFullWindowMode?(this._isFullWindowMode=!0,this.toolbar.prependTo(t.container),this.containerDisplacement.width=6,this.containerDisplacement.height=42,t.container.css({"z-index":"1",position:"absolute","background-color":$("body").css("background-color")}),this._parent.parent().css({width:"100%",height:"100%"}),t.size={width:this._parent.width()-this.containerDisplacement.width,height:this._parent.height()-this.containerDisplacement.height},t.setNeedsAutoScale(),t.setNeedsUpdate()):(this._isFullWindowMode=!1,this._isFullScreenMode||(this.toolbar.prependTo(this._parent.parent()),t.container.css("background-color","transparent")),this.containerDisplacement.width=2,this.containerDisplacement.height=20,t.container.css("top","0"),t.container.css("z-index","auto"),t.container.css("position","relative"),this.resizeCharts())},t}()
e.ChartsContainer=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t,"registeredPriceStyles",{get:function(){return this._priceStyles.registeredItems},enumerable:!0,configurable:!0}),t.register=function(e,t){"string"==typeof e?this._priceStyles.register(e,t):this._priceStyles.register(e.className,e)},t.create=function(e){return this._priceStyles.createInstance(e)},t.deserialize=function(e){if(!e)return null
var t=this._priceStyles.createInstance(e.className)
return t.loadState(e),t},t._priceStyles=new e.ClassRegistrar,t}(),i=function(){function t(e){e&&(this.chart=e.chart)}return Object.defineProperty(t,"className",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"plot",{get:function(){return this._plot},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"chart",{get:function(){return this._chart},set:function(e){this._chart!==e&&(this.destroy(),this._chart=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"chartPanel",{get:function(){return this._plot&&this._plot.chartPanel},enumerable:!0,configurable:!0}),t.prototype.saveState=function(){return{className:this.constructor.className}},t.prototype.loadState=function(e){},t.prototype.apply=function(){var t=this._chart
if(t){var i=this._plot
if(i||(this._plot=i=this.createPlot()),!i)throw Error("Price style plot is not created.")
this.updateComputedDataSeries(),t.updateIndicators()
var r=e.DataSeriesSuffix
i.dataSeries=[t.primaryDataSeries(r.CLOSE),t.primaryDataSeries(r.OPEN),t.primaryDataSeries(r.HIGH),t.primaryDataSeries(r.LOW)],t.mainPanel.addPlot(i),t.setNeedsUpdate(!0)}},t.prototype.createPlot=function(){return null},t.prototype.dataSeriesSuffix=function(){return""},t.prototype.primaryDataSeriesSuffix=function(t){var i=e.DataSeriesSuffix
switch(t){case i.OPEN:case i.HIGH:case i.LOW:case i.CLOSE:return this.dataSeriesSuffix()
default:return""}},t.prototype.removeComputedDataSeries=function(){var t=this._chart
if(t){var i=this.dataSeriesSuffix(),r=e.DataSeriesSuffix
i&&(t.removeDataSeries(i+r.DATE),t.removeDataSeries(i+r.OPEN),t.removeDataSeries(i+r.HIGH),t.removeDataSeries(i+r.LOW),t.removeDataSeries(i+r.CLOSE),t.removeDataSeries(i+r.VOLUME))}},t.prototype.updateComputedDataSeries=function(){},t.prototype._calculateAtr=function(t){var i=new e.TAIndicator({taIndicator:TASdk.AverageTrueRange,chart:this.chart})
return i.setParameterValue(e.IndicatorParam.PERIODS,t),i._usePrimaryDataSeries=!1,t=i.calculate(),t.recordSet?(i=t.recordSet.getField(e.IndicatorField.INDICATOR),i&&(t=e.DataSeries.fromField(i,t.startIndex).lastValue)?Math.roundToDecimals(t,5):null):null},t.prototype.destroy=function(){var e=this._plot
e&&e.chartPanel&&e.chartPanel.removePlot(e),this.removeComputedDataSeries()},t}()
e.PriceStyle=i,e.JsUtil.applyMixins(i,[t])}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"bar"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.OHLC,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.BarPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"HLBar"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.HL,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.HLBarPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"HLCBar"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.HLC,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.HLCBarPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"coloredHLBar"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.COLORED_HL,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.ColoredHLBarPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"coloredHLCBar"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.COLORED_HLC,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.ColoredHLCBarPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"candle"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.CANDLE,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.CandlePriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"coloredBar"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.COLORED_OHLC,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.ColoredBarPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"heikinAshi"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.CANDLE,plotType:e.PlotType.PRICE_STYLE})},i.prototype.dataSeriesSuffix=function(){return e.DataSeriesSuffix.HEIKIN_ASHI},i.prototype.updateComputedDataSeries=function(){var t=this.chart.dataManager,i=t.ohlcDataSeries(e.DataSeriesSuffix.HEIKIN_ASHI,!0)
e.BarConverter.convertToHeikinAshi(t.ohlcDataSeries(),i)},i}(e.PriceStyle)
e.HeikinAshiPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"hollowCandle"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.HOLLOW_CANDLE,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.HollowCandlePriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.KagiReversalKind={ATR:"atr",FIXED:"fixed"},Object.freeze(e.KagiReversalKind)
var t=function(t){function i(e){t.call(this,e),this.loadState(e)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"kagi"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"reversal",{get:function(){return this._reversal},set:function(e){this._reversal=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"reversalValue",{get:function(){return this._reversalValue},enumerable:!0,configurable:!0}),i.prototype.saveState=function(){var i=t.prototype.saveState.call(this)
return i.reversal=e.JsUtil.clone(this._reversal),i},i.prototype.loadState=function(r){t.prototype.loadState.call(this,r),this.reversal=r&&r.reversal||e.JsUtil.clone(i.defaults.reversal)},i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.KAGI,plotType:e.PlotType.PRICE_STYLE})},i.prototype.dataSeriesSuffix=function(){return e.DataSeriesSuffix.KAGI},i.prototype.primaryDataSeriesSuffix=function(i){var r=t.prototype.primaryDataSeriesSuffix.call(this,i)
if(r)return r
switch(i){case e.DataSeriesSuffix.DATE:case e.DataSeriesSuffix.VOLUME:return this.dataSeriesSuffix()
default:return""}},i.prototype._calculateReversalValue=function(){var t
switch(t=this.reversal,t.kind){case e.KagiReversalKind.ATR:t=this._calculateAtr(t.value)
break
case e.KagiReversalKind.FIXED:t=t.value
break
default:throw Error("Unknown reversal amount kind: "+t.kind)}return this._reversalValue=t,t},i.prototype.updateComputedDataSeries=function(){var t=this.chart.dataManager,i=t.barDataSeries(e.DataSeriesSuffix.KAGI,!0),r=this._calculateReversalValue()
r&&e.BarConverter.convertToKagi(t.barDataSeries(),r,i)},i.defaults={reversal:{kind:e.KagiReversalKind.ATR,value:20}},i}(e.PriceStyle)
e.KagiPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this.loadState(e)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"lineBreak"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lines",{get:function(){return this._lines},set:function(e){this._lines=e},enumerable:!0,configurable:!0}),i.prototype.saveState=function(){var e=t.prototype.saveState.call(this)
return e.lines=this.lines,e},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this.lines=e&&e.lines||i.defaults.lines},i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.CANDLE,plotType:e.PlotType.PRICE_STYLE})},i.prototype.dataSeriesSuffix=function(){return e.DataSeriesSuffix.LINE_BREAK},i.prototype.primaryDataSeriesSuffix=function(i){var r=t.prototype.primaryDataSeriesSuffix.call(this,i)
if(r)return r
switch(i){case e.DataSeriesSuffix.DATE:case e.DataSeriesSuffix.VOLUME:return this.dataSeriesSuffix()
default:return""}},i.prototype.updateComputedDataSeries=function(){var t=this.chart.dataManager,i=t.barDataSeries(e.DataSeriesSuffix.LINE_BREAK,!0)
e.BarConverter.convertToLineBreak(t.barDataSeries(),this.lines,i)},i.defaults={lines:3},i}(e.PriceStyle)
e.LineBreakPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"line"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.LinePlot({plotStyle:e.LinePlot.Style.SIMPLE,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.LinePriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"mountain"},enumerable:!0,configurable:!0}),i.prototype.createPlot=function(){return new e.LinePlot({plotStyle:e.LinePlot.Style.MOUNTAIN,plotType:e.PlotType.PRICE_STYLE})},i}(e.PriceStyle)
e.MountainPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.PointAndFigureBoxSizeKind={ATR:"atr",FIXED:"fixed"},Object.freeze(e.PointAndFigureBoxSizeKind),e.PointAndFigureSource={CLOSE:"close",HIGH_LOW:"highLow"},Object.freeze(e.PointAndFigureSource)
var t=function(t){function i(e){t.call(this,e),this.loadState(e)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"pointAndFigure"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"source",{get:function(){return this._source},set:function(e){this._source=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boxSize",{get:function(){return this._boxSize},set:function(e){this._boxSize=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"reversal",{get:function(){return this._reversal},set:function(t){if(null!=t&&!e.JsUtil.isPositiveNumber(t))throw new TypeError("Reversal must be a positive number.")
this._reversal=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boxSizeValue",{get:function(){return this._boxSizeValue},enumerable:!0,configurable:!0}),i.prototype.saveState=function(){var i=t.prototype.saveState.call(this)
return i.boxSize=e.JsUtil.clone(this._boxSize),i.reversal=this._reversal,i.source=this._source,i},i.prototype.loadState=function(r){t.prototype.loadState.call(this,r),this.boxSize=r&&r.boxSize||e.JsUtil.clone(i.defaults.boxSize),this.reversal=r&&r.reversal||i.defaults.reversal,this.source=r&&r.source||i.defaults.source},i.prototype.createPlot=function(){var t=new e.PointAndFigurePlot({plotStyle:e.BarPlot.Style.POINT_AND_FIGURE,plotType:e.PlotType.PRICE_STYLE})
return t.boxSize=this._boxSizeValue,t},i.prototype.dataSeriesSuffix=function(){return e.DataSeriesSuffix.POINT_AND_FIGURE},i.prototype.primaryDataSeriesSuffix=function(i){var r=t.prototype.primaryDataSeriesSuffix.call(this,i)
if(r)return r
switch(i){case e.DataSeriesSuffix.DATE:case e.DataSeriesSuffix.VOLUME:return this.dataSeriesSuffix()
default:return""}},i.prototype._calculateBoxSizeValue=function(){var t
switch(t=this.boxSize,t.kind){case e.PointAndFigureBoxSizeKind.ATR:t=this._calculateAtr(t.value)
break
case e.PointAndFigureBoxSizeKind.FIXED:t=t.value
break
default:throw Error("Unknown box size kind: "+t.kind)}return this._boxSizeValue=t,t},i.prototype.updateComputedDataSeries=function(){var t=this.chart.dataManager,i=t.barDataSeries(e.DataSeriesSuffix.POINT_AND_FIGURE,!0),r=this._calculateBoxSizeValue()
if(r){var n=this._plot
n&&(n.boxSize=r),e.BarConverter.convertToPointAndFigure(t.barDataSeries(),r,this.reversal,this.source,i)}},i.defaults={source:e.PointAndFigureSource.CLOSE,boxSize:{kind:e.PointAndFigureBoxSizeKind.ATR,value:20},reversal:3},i}(e.PriceStyle)
e.PointAndFigurePriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.RenkoBoxSizeKind={FIXED:"fixed",ATR:"atr"},Object.freeze(e.RenkoBoxSizeKind)
var t=function(t){function i(e){t.call(this,e),this.loadState(e)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"renko"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boxSize",{get:function(){return this._boxSize},set:function(e){this._boxSize=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boxSizeValue",{get:function(){return this._boxSizeValue},enumerable:!0,configurable:!0}),i.prototype.saveState=function(){var i=t.prototype.saveState.call(this)
return i.boxSize=e.JsUtil.clone(this._boxSize),i},i.prototype.loadState=function(r){t.prototype.loadState.call(this,r),this.boxSize=r&&r.boxSize||e.JsUtil.clone(i.defaults.boxSize)},i.prototype.createPlot=function(){return new e.BarPlot({plotStyle:e.BarPlot.Style.RENKO,plotType:e.PlotType.PRICE_STYLE})},i.prototype.dataSeriesSuffix=function(){return e.DataSeriesSuffix.RENKO},i.prototype.primaryDataSeriesSuffix=function(i){var r=t.prototype.primaryDataSeriesSuffix.call(this,i)
if(r)return r
switch(i){case e.DataSeriesSuffix.DATE:case e.DataSeriesSuffix.VOLUME:return this.dataSeriesSuffix()
default:return""}},i.prototype._calculateBoxSizeValue=function(){var t
switch(t=this.boxSize,t.kind){case e.RenkoBoxSizeKind.ATR:t=this._calculateAtr(t.value)
break
case e.RenkoBoxSizeKind.FIXED:t=t.value
break
default:throw Error("Unknown box size kind: "+t.kind)}return this._boxSizeValue=t,t},i.prototype.updateComputedDataSeries=function(){var t=this.chart.dataManager,i=t.barDataSeries(e.DataSeriesSuffix.RENKO,!0),r=this._calculateBoxSizeValue()
r&&e.BarConverter.convertToRenko(t.barDataSeries(),r,i)},i.defaults={boxSize:{kind:e.RenkoBoxSizeKind.ATR,value:20}},i}(e.PriceStyle)
e.RenkoPriceStyle=t,e.PriceStyle.register(t)}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(e){this._isStarted=!1,this.context=null,this._recurring=!0,e&&(this.context=e.context,null!=e.recurring&&(this.recurring=e.recurring),this.callback=e.callback)}return Object.defineProperty(t.prototype,"callback",{get:function(){return this._callback},set:function(t){if(null!=t&&!e.JsUtil.isFunction(t))throw new TypeError("Callback must be a function.")
this._callback=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"started",{get:function(){return this._isStarted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurring",{get:function(){return this._recurring},set:function(e){this._recurring=e},enumerable:!0,configurable:!0}),t.prototype.start=function(){if(!this.callback)throw Error("Callback is not assigned.")
return!this._isStarted&&!!e.AnimationController.add(this)&&(this._isStarted=!0,!0)},t.prototype.stop=function(){e.AnimationController.remove(this),this._isStarted=!1},t.prototype.handleAnimationFrame=function(){this.callback.call(this.context)},t}()
e.Animation=t}(StockChartX||(StockChartX={})),function(e){function t(e){return setTimeout(e,n)}function i(){var e=r
if(Date.now()-e._prevStartTime>=n){for(var t=e._animations,o=0;o<t.length;o++){var a=t[o]
a.handleAnimationFrame(),a.recurring||(a.stop(),o--)}e._prevStartTime=Date.now()}e.hasAnimationsToRun()&&requestAnimationFrame(i)}window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||t
var r,n=1e3/(e.Environment.isMobile?20:40)
!function(e){e._animations=[],e._prevStartTime=Date.now(),e.hasAnimationsToRun=function(){return 0<this._animations.length},e.contains=function(e){for(var t=0,i=this._animations;t<i.length;t++)if(i[t]===e)return!0
return!1},e.add=function(e){if(this.contains(e))return!1
var t=this.hasAnimationsToRun()
return this._animations.push(e),t||requestAnimationFrame(i),!0},e.remove=function(e){for(var t=this._animations,i=0,r=t.length;i<r;i++)if(t[i]===e)return t.splice(i,1),!0
return!1}}(r=e.AnimationController||(e.AnimationController={}))}(StockChartX||(StockChartX={})),function(e){!function(e){e[e.LEFT=1]="LEFT",e[e.SCROLL=2]="SCROLL",e[e.RIGHT=3]="RIGHT"}(e.MouseButton||(e.MouseButton={}))
var t=e.MouseButton
e.MouseEvent={ENTER:"mouseenter",LEAVE:"mouseleave",MOVE:"mousemove",DOWN:"mousedown",UP:"mouseup",CLICK:"click",DOUBLE_CLICK:"dblclick",CONTEXT_MENU:"contextmenu",WHEEL:"mousewheel",SCROLL:"DOMMouseScroll"},Object.freeze(e.MouseEvent),e.TouchEvent={START:"touchstart",MOVE:"touchmove",END:"touchend"},Object.freeze(e.TouchEvent),e.GestureState={NONE:0,STARTED:1,CONTINUED:2,FINISHED:3},Object.freeze(e.GestureState)
var i=function(){function i(t){this.button=this.context=this.hitTest=this.handler=null,this._state=e.GestureState.NONE,t||(t={}),this.handler=t.handler,this.hitTest=t.hitTest,this.context=t.context,this.button=t.button}return Object.defineProperty(i.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),i.prototype.handleEvent=function(e){return!1},i.prototype._checkButton=function(i){var r=this.button
return null==r||!(r!==t.LEFT||!e.Environment.isPhone&&!e.Environment.isMobile)||i.evt.which===r},i.prototype._checkHit=function(t){if(t.evt.type===e.MouseEvent.LEAVE)return!1
var i=this.hitTest
return!!i&&i.call(this.context,t.pointerPosition)},i.prototype._invokeHandler=function(e){var t=this.handler
t&&t.call(this.context,this,e)},i.prototype.isActive=function(){var t=this._state
return t===e.GestureState.STARTED||t===e.GestureState.CONTINUED},i}()
e.Gesture=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this.leaveEnabled=this.hoverEnabled=this.enterEnabled=!0,e&&(null!=e.enterEventEnabled&&(this.enterEnabled=!!e.enterEventEnabled),null!=e.hoverEventEnabled&&(this.hoverEnabled=!!e.hoverEventEnabled),null!=e.leaveEventEnabled&&(this.leaveEnabled=!!e.leaveEventEnabled))}return __extends(i,t),i.prototype.handleEvent=function(t){switch(t.evt.type){case e.MouseEvent.ENTER:case e.MouseEvent.MOVE:case e.TouchEvent.START:case e.TouchEvent.MOVE:if(this._checkHit(t))return this.isActive()?(this._state=e.GestureState.CONTINUED,this.hoverEnabled&&this._invokeHandler(t)):(this._state=e.GestureState.STARTED,this.enterEnabled&&this._invokeHandler(t)),!0
if(this.isActive())return this._checkHit(t)||(this._state=e.GestureState.FINISHED,this.leaveEnabled&&this._invokeHandler(t)),!0
break
case e.MouseEvent.LEAVE:case e.TouchEvent.END:if(this.isActive())return this._state=e.GestureState.FINISHED,this.leaveEnabled&&this._invokeHandler(t),!0}return!1},i}(e.Gesture)
e.MouseHoverGesture=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=jQuery,i=function(i){function r(t){i.call(this,t),this.moveOffset={x:0,y:0},this._minMoveDistance=1,this.verticalMoveEnabled=this.horizontalMoveEnabled=!0,this._lastPoint=this._prevPoint=null,this._animation=new e.Animation({context:this,recurring:!1}),this._which=0,t&&(null!=t.minMoveDistance&&(this.minMoveDistance=t.minMoveDistance),null!=t.horizontalMoveEnabled&&(this.horizontalMoveEnabled=!!t.horizontalMoveEnabled),t.verticalMoveEnabled&&(this.verticalMoveEnabled=!!t.verticalMoveEnabled))}return __extends(r,i),Object.defineProperty(r.prototype,"minMoveDistance",{get:function(){return this._minMoveDistance},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("minMoveDistance must be a positive number.")
this._minMoveDistance=t},enumerable:!0,configurable:!0}),r.prototype.handleEvent=function(i){var r=this._lastPoint={x:i.pointerPosition.x,y:i.pointerPosition.y}
switch(i.evt.type){case e.MouseEvent.DOWN:case e.TouchEvent.START:if(this._checkButton(i)&&this._checkHit(i))return this._prevPoint={x:r.x,y:r.y},this._which=i.evt.type===e.TouchEvent.START?1:i.evt.which,this._state=e.GestureState.STARTED,this._invokeHandler(i),!0
break
case e.MouseEvent.MOVE:case e.TouchEvent.MOVE:var n=this.moveOffset
if(this.isActive()){if(n.x=r.x-this._prevPoint.x,n.y=r.y-this._prevPoint.y,r=this.minMoveDistance,(this.horizontalMoveEnabled&&Math.abs(n.x)>=r||this.verticalMoveEnabled&&Math.abs(n.y)>=r)&&(n=this._animation,this._state=e.GestureState.CONTINUED,!n.started)){var o=t.extend(!0,{},i)
n.callback=function(){this._prevPoint=this._lastPoint,o.evt.which=this._which,this._invokeHandler(o)},n.start()}return!0}break
case e.MouseEvent.UP:case e.MouseEvent.LEAVE:case e.TouchEvent.END:if(this.isActive())return this._animation.stop(),this._state=e.GestureState.FINISHED,this._invokeHandler(i),!0}return!1},r}(e.Gesture)
e.PanGesture=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=jQuery,i=function(i){function r(t){i.call(this,t),this._lastScale=this._prevScale=this.delta=0,this._scaleThreshold=.005,this._animation=new e.Animation({context:this,recurring:!1})}return __extends(r,i),r.prototype.handleEvent=function(i){var n=i.evt,o=n.originalEvent
switch(n.type){case e.MouseEvent.WHEEL:case e.MouseEvent.SCROLL:if(this._checkHit(i))return n.type===e.MouseEvent.SCROLL?this.delta=0<o.detail?1:-1:this.delta=0>o.wheelDelta?1:-1,this._state=e.GestureState.FINISHED,this._invokeHandler(i),!0
break
case e.TouchEvent.START:if(!this.isActive()&&2===o.touches.length)return this._prevScale=this._lastScale=o.scale,(void 0!==this._prevScale||(this._prevScale=this._lastScale=r._calculateScale(o.touches),void 0!==this._prevScale))&&(this._state=e.GestureState.STARTED,!0)
break
case e.TouchEvent.MOVE:if(this.isActive()){if(void 0===(n=this._lastScale=o.scale)){if(o=o.touches,2!==o.length)return!0
n=this._lastScale=r._calculateScale(o)}if(o=n-this._prevScale,Math.abs(o)>=(0<this._prevScale&&0>n||0>this._prevScale&&0<n?2:1)*this._scaleThreshold&&(this.delta=0>o?1:-1,this._state=e.GestureState.CONTINUED,o=this._animation,!o.started)){var a=t.extend(!0,{},i)
o.callback=function(){this._prevScale=this._lastScale,this._invokeHandler(a)},o.start()}return!0}break
case e.TouchEvent.END:if(this.isActive())return this._state=e.GestureState.FINISHED,!0}return!1},r._calculateScale=function(e){var t=e[0].pageX-e[1].pageX
return e=e[0].pageY-e[1].pageY,Math.sqrt(t*t+e*e)/Math.max(window.innerWidth,window.innerHeight)},r}(e.Gesture)
e.MouseWheelGesture=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._maxTouchOffset=10,this._maxTouchInterval=500,e&&(e.maxTouchOffset&&(this.maxTouchOffset=e.maxTouchOffset),e.maxTouchInterval&&(this.maxTouchInterval=e.maxTouchInterval))}return __extends(i,t),Object.defineProperty(i.prototype,"maxTouchOffset",{get:function(){return this._maxTouchOffset},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch offset must be a number greater than 0.")
this._maxTouchOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxTouchInterval",{get:function(){return this._maxTouchInterval},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch interval must be a number greater than 0.")
this._maxTouchInterval=t},enumerable:!0,configurable:!0}),i.prototype.handleEvent=function(t){switch(t.evt.type){case e.MouseEvent.CLICK:if(!this._isTouch&&this._finishGesture(t))return!0
break
case e.TouchEvent.START:this._isTouch=!0,this._checkHit(t)&&(this._startPoint=t.pointerPosition,this._startDate=new Date,this._state=e.GestureState.STARTED)
break
case e.TouchEvent.END:if(this.isActive()){var i=Math.abs(t.pointerPosition.y-this._startPoint.y),r=new Date
if(Math.abs(t.pointerPosition.x-this._startPoint.x)<=this._maxTouchOffset&&i<=this._maxTouchOffset&&r-this._startDate<=this._maxTouchInterval&&this._finishGesture(t))return!0
this._state=e.GestureState.NONE}}return!1},i.prototype._finishGesture=function(t){if(this._checkButton(t)&&this._checkHit(t))return this._state=e.GestureState.FINISHED,this._invokeHandler(t),!0},i}(e.Gesture)
e.ClickGesture=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._maxTouchOffset=10,this._maxTouchInterval=2500,e&&(e.maxTouchOffset&&(this.maxTouchOffset=e.maxTouchOffset),e.maxTouchInterval&&(this.maxTouchInterval=e.maxTouchInterval))}return __extends(i,t),Object.defineProperty(i.prototype,"maxTouchOffset",{get:function(){return this._maxTouchOffset},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch offset must be a number greater than 0.")
this._maxTouchOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxTouchInterval",{get:function(){return this._maxTouchInterval},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch interval must be a number greater than 0.")
this._maxTouchInterval=t},enumerable:!0,configurable:!0}),i.prototype.handleEvent=function(t){switch(t.evt.type){case e.MouseEvent.DOUBLE_CLICK:if(this._finishGesture(t))return!0
break
case e.TouchEvent.START:if(this.isActive())return this._isSecondTouch=!0,!0
if(this._checkHit(t))return this._startPoint=t.pointerPosition,this._startDate=new Date,this._isSecondTouch=!1,this._state=e.GestureState.STARTED,!0
this._state=e.GestureState.NONE
break
case e.TouchEvent.END:if(this._isSecondTouch){var i=Math.abs(t.pointerPosition.y-this._startPoint.y),r=new Date
if(Math.abs(t.pointerPosition.x-this._startPoint.x)<=this._maxTouchOffset&&i<=this._maxTouchOffset&&r-this._startDate<=this._maxTouchInterval){if(this._finishGesture(t))return!0}else this._state=e.GestureState.NONE}}return!1},i.prototype._finishGesture=function(t){return!(!this._checkButton(t)||!this._checkHit(t)||(this._state=e.GestureState.FINISHED,this._invokeHandler(t),t.stopPropagation=!0,0))},i}(e.Gesture)
e.DoubleClickGesture=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._maxTouchOffset=10,this._touchInterval=2e3,e&&(e.maxTouchOffset&&(this.maxTouchOffset=e.maxTouchOffset),e.touchInterval&&(this.touchInterval=e.touchInterval))}return __extends(i,t),Object.defineProperty(i.prototype,"maxTouchOffset",{get:function(){return this._maxTouchOffset},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Max touch offset must be a number greater than 0.")
this._maxTouchOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"touchInterval",{get:function(){return this._touchInterval},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Touch interval must be a number greater than 0.")
this._touchInterval=t},enumerable:!0,configurable:!0}),i.prototype.handleEvent=function(t){switch(t.evt.type){case e.MouseEvent.CONTEXT_MENU:if(this._isTouch=!1,this._finishGesture(t))return!0
break
case e.TouchEvent.START:this._isTouch=!0,this._checkHit(t)&&(this._startPoint=t.pointerPosition,this._lastEvent=e.JsUtil.clone(t),this._state=e.GestureState.STARTED,this._startTimeout())
break
case e.TouchEvent.MOVE:this.isActive()&&(this._lastEvent=e.JsUtil.clone(t))
break
case e.TouchEvent.END:if(this._stopTimeout(),this._lastEvent)return this._lastEvent=null,t.stopPropagation=!0,!0}return!1},i.prototype._startTimeout=function(){var t=this
this._timeoutId=setTimeout(function(){if(t.isActive()){var i=t._lastEvent,r=Math.abs(i.pointerPosition.y-t._startPoint.y)
return!!(Math.abs(i.pointerPosition.x-t._startPoint.x)<=t._maxTouchOffset&&r<=t._maxTouchOffset&&t._finishGesture(i))||void(t._state=e.GestureState.NONE)}},this._touchInterval)},i.prototype._stopTimeout=function(){this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=null)},i.prototype._finishGesture=function(t){if(this._checkHit(t))return this._state=e.GestureState.FINISHED,this._invokeHandler(t),!0},i}(e.Gesture)
e.ContextMenuGesture=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(e,t,i){if(this._gestures=[],e&&(this.add(e),t||i)){e=0
for(var r=this.gestures;e<r.length;e++){var n=r[e]
n.context||(n.context=t),n.hitTest||(n.hitTest=i)}}}return Object.defineProperty(t.prototype,"gestures",{get:function(){return this._gestures},enumerable:!0,configurable:!0}),t.prototype.add=function(){for(var t=[],i=0;i<arguments.length;i++)t[i-0]=arguments[i]
for(i=0,t=e.JsUtil.flattenArray(t);i<t.length;i++){var r=t[i]
if(!(r instanceof e.Gesture))throw new TypeError("An instance of StockChartX.Gesture expected.")
this.contains(r)||this._gestures.push(r)}},t.prototype.remove=function(){for(var t=[],i=0;i<arguments.length;i++)t[i-0]=arguments[i]
for(var t=e.JsUtil.flattenArray(t),i=this._gestures,r=0;r<t.length;r++)for(var n=t[r],o=0;o<i.length;o++)if(i[o]===n){i.splice(o,1)
break}},t.prototype.contains=function(e){for(var t=0,i=this._gestures;t<i.length;t++)if(i[t]===e)return!0
return!1},t.prototype.handleEvent=function(e){for(var t=!1,i=0,r=this._gestures;i<r.length;i++)r[i].handleEvent(e)&&(t=!0)
return t},t}()
e.GestureArray=t}(StockChartX||(StockChartX={})),function(e){var t,i=jQuery,r=function(){function r(){}return Object.defineProperty(r,"context",{get:function(){return t||(t=i("<canvas></canvas>")[0].getContext("2d")),t},enumerable:!0,configurable:!0}),r.applyTextTheme=function(e){this.context.scxApplyTextTheme(e)},r.textWidth=function(e,t){var i=this.context
return t&&i.scxApplyTextTheme(t),i.measureText(e).width},r.measureText=function(t,i){return{width:this.textWidth(t,i),height:e.HtmlUtil.getFontSize(i)+1}},r}()
e.DummyCanvasContext=r}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(){}return e.calculateLinearRegression=function(e){for(var t=0,i=0,r=e.length,n=0;n<r;n++)t+=n,i+=e[n]
for(var t=0===r?0:t/r,i=0===r?0:i/r,o=0,a=0,n=0;n<r;n++)o+=(n-t)*(e[n]-i),a+=Math.pow(n-t,2)
return e=0===a?0:o/a,{slope:e,firstValue:i-e*t}},e}()
e.DrawingCalculationUtil=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(e,t){this._dateScale=e,this._valueScale=t}return Object.defineProperty(e.prototype,"dateScale",{get:function(){return this._dateScale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valueScale",{get:function(){return this._valueScale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canResolveX",{get:function(){return!!this._dateScale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canResolveY",{get:function(){return!!this._valueScale},enumerable:!0,configurable:!0}),e.prototype.columnByRecord=function(e,t){var i=e-Math.trunc(this._dateScale.firstVisibleRecord)
return!1!==t&&(i=Math.trunc(i)),i},e.prototype.recordByColumn=function(e,t){var i=e+Math.trunc(this._dateScale.firstVisibleRecord)
return!1!==t&&(i=Math.trunc(i)),i},e.prototype.xByColumn=function(e,t,i){var r=this._dateScale,n=r.columnWidth,o=r.firstVisibleRecord
return e=r.projectionFrame.left-(o-Math.trunc(o))*n+e*n,!1!==t&&(e+=n/2),!1!==i?Math.round(e):e},e.prototype.columnByX=function(e,t){var i=this._dateScale,r=i.firstVisibleRecord,n=i.columnWidth,i=(e-i.projectionFrame.left+(r-Math.trunc(r))*n)/n
return!1!==t?Math.floor(i):i},e.prototype.xByRecord=function(e,t,i){return this.xByColumn(this.columnByRecord(e,t),t,i)},e.prototype.recordByX=function(e,t){return this.recordByColumn(this.columnByX(e,t),t)},e.prototype.dateByRecord=function(e){var t,i=this._dateScale.getDateDataSeries().values
return 0===i.length?new Date(0):0>e?(t=i[0].getTime()+e*this._dateScale.chart.timeInterval,new Date(t)):e>=i.length?(t=i[i.length-1].getTime()+(e-i.length+1)*this._dateScale.chart.timeInterval,new Date(t)):i[e]},e.prototype.recordByDate=function(e){var t=this._dateScale,i=t.getDateDataSeries()
if(0===i.length)return-1
var r=i.floorIndex(e)
return 0>r?(i=e.getTime()-i.firstValue.getTime(),r=Math.floor(i/t.chart.timeInterval)):r>=i.length&&(e=e.getTime()-i.lastValue.getTime(),r=i.length-1+Math.floor(e/t.chart.timeInterval)),r},e.prototype.dateByColumn=function(e){return e=this.recordByColumn(e),this.dateByRecord(e)},e.prototype.columnByDate=function(e){return e=this.xByDate(e,!1),this.columnByX(e)},e.prototype.dateByX=function(e){e=Math.round(e)
var t=this.columnByX(e),i=this.xByColumn(t,!0,!1),r=this.dateByColumn(t)
if(e===i)return r
var t=e<i?t-1:t+1,n=this.xByColumn(t,!0,!1),t=this.dateByColumn(t)
return e=(e-i)/(i-n),r=r.getTime(),r+=(r-t.getTime())*e,new Date(r)},e.prototype.xByDate=function(e,t){var i=this.recordByDate(e),r=this.xByRecord(i,!0,!1),n=this.dateByRecord(i),o=i+1,i=this.xByRecord(o,!0,!1),a=this.dateByRecord(o),o=n.getTime(),n=a.getTime()-n.getTime(),n=(e.getTime()-o)/n,r=r+(i-r)*n
return!1!==t?Math.round(r):r},e.prototype.yByValue=function(e){var t=this._valueScale,i=t.projectionFrame,r=t.maxVisibleValue
return Math.round(i.top+i.height/(r-t.minVisibleValue)*(r-e))},e.prototype.valueByY=function(e){var t=this._valueScale,i=t.projectionFrame,r=t.maxVisibleValue
return r-(r-t.minVisibleValue)/i.height*(e-i.top)},e}()
e.Projection=t}(StockChartX||(StockChartX={})),function(e){e.DataSeriesSuffix={DATE:".date",OPEN:".open",HIGH:".high",LOW:".low",CLOSE:".close",VOLUME:".volume",HEIKIN_ASHI:".heikin_ashi",RENKO:".renko",LINE_BREAK:".line_break",POINT_AND_FIGURE:".point_and_figure",KAGI:"kagi"},Object.freeze(e.DataSeriesSuffix)
var t=function(){function t(e){var t,i
if(e)if("string"==typeof e)t=e
else{if("object"!=typeof e)throw new TypeError("Unknown config.")
t=e.name,i=e.values}this.name=t,this.values=i||[]}return Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e||""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){return this._values},set:function(e){if(!Array.isArray(e))throw new TypeError("An array of values expected.")
this._values=e||[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._values.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nameSuffix",{get:function(){var e=this.name,t=e.lastIndexOf(".")
return 0<=t?e.substr(t):null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isValueDataSeries",{get:function(){return this.nameSuffix!==e.DataSeriesSuffix.DATE},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDateDataSeries",{get:function(){return this.nameSuffix===e.DataSeriesSuffix.DATE},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstValue",{get:function(){return this._values[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastValue",{get:function(){var e=this._values
return 0<e.length?e[e.length-1]:null},enumerable:!0,configurable:!0}),t.prototype.valueAtIndex=function(e,t){var i=this._values,r=i[e]
return void 0!==t&&(i[e]=t),r},t.prototype.add=function(e){var t=this._values
Array.isArray(e)?this._values=t.concat(e):t.push(e)},t.prototype.updateLast=function(e){var t=this._values
0<t.length&&(t[t.length-1]=e)},t.prototype.clear=function(){this._values.length=0},t.prototype.trim=function(e){var t=this._values
return e=t.length-e,0<e?t.splice(0,e):e=0,e},t.prototype.itemsCountBetweenValues=function(e,t){for(var i=0,r=0,n=this._values;r<n.length;r++){var o=n[r]
null!=o&&o>=e&&o<=t&&i++}return i},t.prototype.minMaxValues=function(e,t){var i=this._values;(null==e||0>e)&&(e=0),null==t&&(t=i.length-e)
for(var r,n=Math.min(e+t-1,i.length-1),o={min:1/0,max:-1/0},a=e;a<=n;a++)null!=(r=i[a])&&(r<o.min&&(o.min=r),r>o.max&&(o.max=r))
return o},t.prototype.floorIndex=function(e){var t=this.binaryIndexOf(e)
if(0===t){var i=this._values
if(0===i.length||i[0]>e)return-1}return 0<=t?t:~t},t.prototype.ceilIndex=function(e){return e=this.binaryIndexOf(e),0<=e?e:1+~e},t.prototype.binaryIndexOf=function(e){for(var t,i,r=this._values,n=0,o=r.length-1;n<=o;)if(t=(n+o)/2|0,(i=r[t])<e)n=t+1
else{if(!(i>e))return t
o=t-1}return~o},t.prototype.leftNearestVisibleValueIndex=function(e){var t=this._values
for(e=Math.min(e,t.length-1);0<=e;e--)if(null!=t[e])return e
return 0},t.prototype.rightNearestVisibleValueIndex=function(e){for(var t=this._values,i=t.length;e<i;e++)if(null!=t[e])return e
return i-1},t.fromField=function(e,i){var r=new t
return r.fromField(e,i),r},t.prototype.toField=function(e){var t=new TASdk.Field
return t.name=e||this.name,t.recordCount=this._values.length,t._m_values=[0].concat(this._values),t._m_values.push(0),t},t.prototype.fromField=function(e,t){var i,r=e.recordCount,n=e._m_values.slice(1,t+r)
for(i=0;i<t-1;i++)n[i]=null
for(;i<r;)n[i]===TASdk.Const.nullValue&&(n[i]=null),i++
this._values=n},t}()
e.DataSeries=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){this._dataSeries={}}return Object.defineProperty(t.prototype,"dateDataSeries",{get:function(){return this.getDataSeries(e.DataSeriesSuffix.DATE)},enumerable:!0,configurable:!0}),t.prototype.findDataSeries=function(e){var t,i=this._dataSeries
for(t in i)if(i.hasOwnProperty(t)){var r=t.lastIndexOf(e)
if(0<=r&&r===t.length-e.length)return i[t]}return null},t.prototype.getDataSeries=function(e,t){void 0===t&&(t=!1)
var i=this._dataSeries[e]
return i||(t?this.addDataSeries(e):null)},t.prototype.clearDataSeries=function(e){var t
if(e)"string"==typeof e?(t=this.getDataSeries(e))&&t.clear():e.clear()
else{t=this._dataSeries
for(var i in t)t.hasOwnProperty(i)&&t[i].clear()}},t.prototype.trimDataSeries=function(e){var t,i=this._dataSeries
for(t in i)i.hasOwnProperty(t)&&i[t].trim(e)},t.prototype.addBarDataSeries=function(t){void 0===t&&(t="")
var i=e.DataSeriesSuffix
return{date:this.addDataSeries(t+i.DATE),open:this.addDataSeries(t+i.OPEN),high:this.addDataSeries(t+i.HIGH),low:this.addDataSeries(t+i.LOW),close:this.addDataSeries(t+i.CLOSE),volume:this.addDataSeries(t+i.VOLUME)}},t.prototype.barDataSeries=function(t,i){void 0===t&&(t=""),void 0===i&&(i=!1)
var r=e.DataSeriesSuffix
return{date:this.getDataSeries(t+r.DATE,i),open:this.getDataSeries(t+r.OPEN,i),high:this.getDataSeries(t+r.HIGH,i),low:this.getDataSeries(t+r.LOW,i),close:this.getDataSeries(t+r.CLOSE,i),volume:this.getDataSeries(t+r.VOLUME,i)}},t.prototype.ohlcDataSeries=function(t,i){void 0===t&&(t=""),void 0===i&&(i=!1)
var r=e.DataSeriesSuffix
return{open:this.getDataSeries(t+r.OPEN,i),high:this.getDataSeries(t+r.HIGH,i),low:this.getDataSeries(t+r.LOW,i),close:this.getDataSeries(t+r.CLOSE,i)}},t.prototype.addDataSeries=function(t,i){if(void 0===i&&(i=!1),!t)throw Error("Data series is not specified.")
if("string"==typeof t)return this.addDataSeries(new e.DataSeries(t),i)
if(!(t instanceof e.DataSeries))throw new TypeError("Invalid data series. Name or data series object expected.")
var r=t.name
if(!r||"string"!=typeof r)throw new TypeError("Data series name must be non-empty string.")
if(this.getDataSeries(r)&&!i)throw Error("Data series '"+r+"' exists already.")
return this._dataSeries[r]=t,t},t.prototype.removeDataSeries=function(e){e?delete this._dataSeries["string"==typeof e?e:e.name]:this._dataSeries={}},t.prototype.appendBars=function(e){var t=this.barDataSeries(),i=function(e){t.date.add(e.date),t.open.add(e.open),t.high.add(e.high),t.low.add(e.low),t.close.add(e.close),t.volume.add(e.volume)}
if(Array.isArray(e))for(var r=0;r<e.length;r++)i(e[r])
else i(e)},t.prototype.bar=function(e){var t=this.barDataSeries()
return{date:t.date.valueAtIndex(e),open:t.open.valueAtIndex(e),high:t.high.valueAtIndex(e),low:t.low.valueAtIndex(e),close:t.close.valueAtIndex(e),volume:t.volume.valueAtIndex(e)}},t}()
e.DataManager=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return t._setupOhlcDataSeries=function(t,i){var r=e.DataSeriesSuffix
return i=i||{open:new e.DataSeries(t+r.OPEN),high:new e.DataSeries(t+r.HIGH),low:new e.DataSeries(t+r.LOW),close:new e.DataSeries(t+r.CLOSE)},i.open.clear(),i.high.clear(),i.low.clear(),i.close.clear(),i},t._setupBarDataSeries=function(t,i){var r=e.DataSeriesSuffix
return i=this._setupOhlcDataSeries(t,i),i.date?i.date.clear():i.date=new e.DataSeries(t+r.DATE),i.volume?i.volume.clear():i.volume=new e.DataSeries(t+r.VOLUME),i},t.convertToHeikinAshi=function(t,i){i=this._setupOhlcDataSeries(e.DataSeriesSuffix.HEIKIN_ASHI,i)
for(var r=t.open.values,n=t.high.values,o=t.low.values,a=t.close.values,s=a.length,l=i.open.values,c=i.high.values,h=i.low.values,u=i.close.values,d=0;d<s;d++){var p=0<d?(l[d-1]+u[d-1])/2:r[d],f=(r[d]+n[d]+o[d]+a[d])/4,m=Math.max(p,f,n[d]),v=Math.min(p,f,o[d])
l.push(p),c.push(m),h.push(v),u.push(f)}return i},t.convertToRenko=function(t,i,r){r=this._setupBarDataSeries(e.DataSeriesSuffix.RENKO,r)
var n=t.date.values,o=t.close.values,a=t.volume.values,s=o.length,l=r.date.values,c=r.open.values,h=r.high.values,u=r.low.values,d=r.close.values,p=r.volume.values
if(0===s)return r
var f=null
t=Math.floor(t.open.values[0]/i)*i+i
for(var m=t-i,v=0,g=0;g<s;g++){v+=a[g],f||(f=new Date(n[g].getTime()))
var y=o[g]
if(y-m>=i){for(var y=Math.trunc((y-m)/i),_=0;_<y;_++)t=m,m+=i,l.push(f),c.push(t),h.push(m),u.push(t),d.push(m),p.push(v),f=new Date(f.getTime()+1e3)
v=0,f=null}else if(t-y>=i){for(y=Math.trunc((t-y)/i),_=0;_<y;_++)m=t,t-=i,l.push(f),c.push(m),h.push(m),u.push(t),d.push(t),p.push(v),f=new Date(f.getTime()+1e3)
v=0,f=null}}return r},t.convertToLineBreak=function(t,i,r){r=this._setupBarDataSeries(e.DataSeriesSuffix.LINE_BREAK,r)
var n=t.date.values,o=t.open.values,a=t.close.values
t=t.volume.values
var s=a.length,l=r.date.values,c=r.open.values,h=r.high.values,u=r.low.values,d=r.close.values,p=r.volume.values
if(0===s)return r
for(var f=null,m=o[0],o=o[0],v=0,g=0;g<s;g++){v+=t[g],null==f&&(f=new Date(n[g].getTime()))
var y=a[g],_=y>o,S=y<m
if(_||S){var b=m,P=d.length
if(0<P&&(b=_?h[P-1]:u[P-1]),c.push(b),h.push(Math.max(b,y)),u.push(Math.min(b,y)),d.push(y),l.push(f),p.push(v),_)for(o=y,f=P-1;f>=P-i&&d[f]>c[f];f--)m=u[f]
if(S)for(m=y,f=P-1;f>=P-i&&d[f]<c[f];f--)o=h[f]
f=v=null}}return r},t.convertToPointAndFigure=function(t,i,r,n,o){o=this._setupBarDataSeries(e.DataSeriesSuffix.LINE_BREAK,o)
var a=t.date.values,s=(t.open.values,t.high.values),l=t.low.values,c=t.close.values
t=t.volume.values
var h=c.length,u=o.date.values,d=o.open.values,p=o.high.values,f=o.low.values,m=o.close.values,v=o.volume.values
if(0===h)return o
var g=null
r*=i
var y=!1,_=c[0]+i/2,S=_-i,b=0,P=n===e.PointAndFigureSource.HIGH_LOW
for(n=0;n<h;n++){var w=P?s[n]:c[n]
if(w>_){y=!0
break}var C=P?l[n]:c[n]
if(C<S){y=!1
break}}for(;n<h;n++)b+=t[n],null==g&&(g=new Date(a[n].getTime())),w=P?s[n]:c[n],C=P?l[n]:c[n],y?w>_?_+=Math.round((w-_)/i)*i:C<_-r&&(w=_-i,C=S-Math.round((S-C)/i)*i,1e-4<Math.abs(w-C)&&(d.push(S),p.push(_),f.push(S),m.push(_),v.push(b),u.push(g),S=C,_=w,b=0,g=null,y=!1)):C<S?S-=Math.round((S-C)/i)*i:w>S+r&&(C=S+i,w=_+Math.round((w-_)/i)*i,1e-4<Math.abs(w-C)&&(d.push(_),p.push(_),f.push(S),m.push(S),v.push(b),u.push(g),S=C,_=w,b=0,g=null,y=!0))
return g&&(u.push(g),d.push(y?S:_),p.push(_),f.push(S),m.push(y?_:S),v.push(b)),o},t.convertToKagi=function(t,i,r){r=this._setupBarDataSeries(e.DataSeriesSuffix.LINE_BREAK,r)
var n=t.date.values,o=t.close.values,a=t.volume.values,s=o.length,l=r.date.values,c=r.open.values,h=r.high.values,u=r.low.values,d=r.close.values,p=r.volume.values
if(0===s)return r
var f=null,m=0,v=o[0]
t=t.open.values[0]
for(var g=v>=t,y=0;y<s;y++){f||(f=new Date(n[y].getTime()))
var _=o[y],S=_-v
g!=0<=S&&Math.abs(S)>=i?(l.push(f),c.push(t),h.push(Math.max(t,v)),u.push(Math.min(t,v)),d.push(v),p.push(m),t=v,v=_,g=!g,f=null,m=0):(v=g?Math.max(v,_):Math.min(v,_),m+=a[0])}return r},t}()
e.BarConverter=t}(StockChartX||(StockChartX={})),function(e){var t=function(){return function(){}}()
e.Component=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){if(t.call(this),!(i.chart instanceof e.Chart))throw new TypeError("Invalid chart type.")
this._chart=i.chart,this._subscribeEvents()}return __extends(i,t),Object.defineProperty(i.prototype,"chart",{get:function(){return this._chart},enumerable:!0,configurable:!0}),i.prototype._subscribeEvents=function(){},i.prototype._unsubscribeEvents=function(){},i.prototype.destroy=function(){this._unsubscribeEvents()},i}(e.Component)
e.ChartComponent=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.call(this),this._gestures=this._initGestures()||new e.GestureArray}return __extends(i,t),i.prototype._initGestures=function(){return null},i.prototype.hitTest=function(e){return!1},i.prototype.layout=function(e){},i.prototype.handleEvent=function(e){return this._gestures.handleEvent(e)},i.prototype.draw=function(){},i.prototype.destroy=function(){},i}(e.Component)
e.Control=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments),this._frame=new e.Rect}return __extends(i,t),Object.defineProperty(i.prototype,"rootDiv",{get:function(){return this._rootDiv},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"frame",{get:function(){return this._frame},enumerable:!0,configurable:!0}),i.prototype.hitTest=function(t){return e.Geometry.isPointInsideOrNearRect(t,this._frame)},i.prototype.layout=function(e){this._rootDiv||(this._rootDiv=this._createRootDiv()),this._rootDiv.scxFrame(e),this._frame.copyFrom(e)},i.prototype._createRootDiv=function(){return null},i.prototype.destroy=function(){this._rootDiv&&this._rootDiv.remove(),t.prototype.destroy.call(this)},i}(e.Control)
e.FrameControl=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){if(t.call(this),!i)throw new TypeError("Config is not specified.")
if(!(i.chart instanceof e.Chart))throw new TypeError("'config.chart' must be an instance of StockChartX.Chart.")
this._chart=i.chart}return __extends(i,t),Object.defineProperty(i.prototype,"chart",{get:function(){return this._chart},enumerable:!0,configurable:!0}),i.prototype._subscribeEvents=function(){},i.prototype._unsubscribeEvents=function(){},i.prototype.destroy=function(){this._unsubscribeEvents(),t.prototype.destroy.call(this)},i}(e.FrameControl)
e.ChartFrameControl=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.DateScaleScrollKind={NORMAL:"normal",AUTOSCALED:"autoscaled"},Object.freeze(e.DateScaleScrollKind),e.DateScaleZoomKind={NORMAL:"normal",AUTOSCALED:"autoscaled"},Object.freeze(e.DateScaleZoomKind),e.DateScaleZoomMode={PIN_CENTER:"pin_center",PIN_LEFT:"pin_left",PIN_RIGHT:"pin_right"},Object.freeze(e.DateScaleZoomMode)
var t=function(t){function i(i){t.call(this,i),this._updateAnimation=new e.Animation({context:this,recurring:!1,callback:this._onUpdateAnimationCallback}),this._projectionFrame=new e.Rect,this._columnWidth=0,this._formatter=new e.TimeIntervalDateTimeFormat,this._moreHistoryRequested=!1,this._projection=new e.Projection(this),this._topPanel=new e.DateScalePanel({dateScale:this,cssClass:"scxTopDateScale",visible:!1}),this._bottomPanel=new e.DateScalePanel({dateScale:this,cssClass:"scxBottomDateScale"}),this.loadState(i)}return __extends(i,t),Object.defineProperty(i.prototype,"topPanel",{get:function(){return this._topPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomPanel",{get:function(){return this._bottomPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"topPanelCssClass",{get:function(){return"scxTopDateScale"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomPanelCssClass",{get:function(){return"scxBottomDateScale"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"topPanelVisible",{get:function(){return this._topPanel.visible},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomPanelVisible",{get:function(){return this._bottomPanel.visible},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projection",{get:function(){return this._projection},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projectionFrame",{get:function(){return this._projectionFrame},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"calibrator",{get:function(){return this._calibrator},set:function(e){this._calibrator=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"firstVisibleIndex",{get:function(){return this._firstVisibleIndex},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastVisibleIndex",{get:function(){return this._lastVisibleIndex},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"firstVisibleRecord",{get:function(){return this._options.firstVisibleRecord},set:function(t){this.allowPartialRecords||(t=Math.trunc(t))
var i=this._options.firstVisibleRecord
i!==t&&(this._options.firstVisibleRecord=t,this._firstVisibleIndex=Math.floor(t),this.chart.fireValueChanged(e.ChartEvent.FIRST_VISIBLE_RECORD_CHANGED,i,t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastVisibleRecord",{get:function(){return this._options.lastVisibleRecord},set:function(t){this.allowPartialRecords||(t=Math.trunc(t))
var i=this._options.lastVisibleRecord
i!==t&&(this._options.lastVisibleRecord=t,this._lastVisibleIndex=Math.ceil(t),this.chart.fireValueChanged(e.ChartEvent.LAST_VISIBLE_RECORD_CHANGED,i,t))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visibleDateRange",{get:function(){var e=this.projectionFrame
return{min:this.projection.dateByX(e.left),max:this.projection.dateByX(e.right)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"useManualHeight",{get:function(){return this._options.useManualHeight},set:function(e){this._options.useManualHeight=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"manualHeight",{get:function(){return this._options.height},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Height must be a positive number.")
this._options.height=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minVisibleRecords",{get:function(){return this._options.minVisibleRecords},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Records must be a finite number greater than 0.")
this._options.minVisibleRecords=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rightAdditionalSpaceRatio",{get:function(){return this._options.rightAdditionalSpaceRatio},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw new TypeError("Ratio must be a positive number.")
this._options.rightAdditionalSpaceRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scrollKind",{get:function(){return this._options.scrollKind},set:function(e){this._options.scrollKind=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"zoomKind",{get:function(){return this._options.zoomKind},set:function(e){this._options.zoomKind=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"zoomMode",{get:function(){return this._options.zoomMode},set:function(e){this._options.zoomMode=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"theme",{get:function(){return this._options.theme},set:function(t){var i=this._options.theme
this._options.theme=t,this.chart.fireValueChanged(e.ChartEvent.DATE_SCALE_THEME_CHANGED,i,t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"actualTheme",{get:function(){return this._options.theme||this.chart.theme.dateScale},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"columnsCount",{get:function(){return this.needsAutoScale()?0:this._options.lastVisibleRecord-this._options.firstVisibleRecord+1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"columnWidth",{get:function(){return this._columnWidth},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxAllowedRecord",{get:function(){var e=this._projectionFrame.width*this.rightAdditionalSpaceRatio/this._columnWidth
return this.getDateDataSeries().length-1+e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTickMarkLength",{get:function(){return this._options.majorTickMarkLength},set:function(e){this._options.majorTickMarkLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTickMarkLength",{get:function(){return this._options.minorTickMarkLength},set:function(e){this._options.minorTickMarkLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textPadding",{get:function(){return this._options.textPadding},set:function(e){this._options.textPadding=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"allowPartialRecords",{get:function(){return this._options.allowPartialRecords},set:function(e){this._options.allowPartialRecords!==e&&(this._options.allowPartialRecords=e,this.firstVisibleRecord=this.firstVisibleRecord,this.lastVisibleRecord=this.lastVisibleRecord)},enumerable:!0,configurable:!0}),i.prototype._subscribeEvents=function(){var t=this
this.chart.on(e.ChartEvent.LOCALE_CHANGED+".scxDateScale",function(e){t._formatter.locale=e.value})},i.prototype._unsubscribeEvents=function(){this.chart.off(".scxDateScale")},i.prototype._calculateProjectionMetrics=function(){this._columnWidth=this._projectionFrame.width/this.columnsCount},i.prototype.setNeedsAutoScale=function(){this.lastVisibleRecord=this.firstVisibleRecord=null},i.prototype.needsAutoScale=function(){return null==this.firstVisibleRecord||null==this.lastVisibleRecord},i.prototype.autoScale=function(){var e=this.chart.recordCount
this.firstVisibleRecord=0<e?0:null,this.lastVisibleRecord=0<e?e-1:null},i.prototype.getDateDataSeries=function(){return this.chart.primaryDataSeries(e.DataSeriesSuffix.DATE)},i.prototype.handleEvent=function(e){return this._bottomPanel.handleEvent(e)||this._topPanel.handleEvent(e)},i.prototype.formatDate=function(e){return this._formatter.format(e,this.chart.timeInterval)},i.prototype.scrollOnPixels=function(e){if(!isFinite(e))throw Error("Finite number expected.")
if(3>Math.abs(e))return!1
var t=Math.abs(e)/this.columnWidth
return this.allowPartialRecords||(t=Math.ceil(t)),this.scrollOnRecords(0<=e?t:-t)},i.prototype.scrollOnRecords=function(e){if(0===e)return!1
var t=this.firstVisibleRecord,i=this.lastVisibleRecord,r=t-e
return e=i-e,this.allowPartialRecords||(r=Math.round(r),e=Math.round(e)),!!(this.canSetVisibleRecord(r)&&this.canSetVisibleRecord(e)||!(0<=r)&&(r=0,e=i-t,this.canSetVisibleRecord(r)&&this.canSetVisibleRecord(e)))&&(this.firstVisibleRecord=r,this.lastVisibleRecord=e,this._requestMoreHistoryIfNeed(),!0)},i.prototype.zoomOnPixels=function(e,t){if(null==t&&(t=e),!isFinite(e)||!isFinite(t))throw Error("Pixels must be a finite number.")
if(3>Math.abs(e)&&3>Math.abs(t))return!1
var i=this.columnWidth,r=Math.abs(e)/i,i=Math.abs(t)/i
return this.allowPartialRecords||(r=Math.ceil(r),i=Math.ceil(i)),this.zoomOnRecords(0<e?r:-r,0<t?i:-i)},i.prototype.zoomOnRecords=function(e,t){if(null==t&&(t=e),0===e&&0===t)return!1
var i=this.firstVisibleRecord,r=this.lastVisibleRecord,n=i+e,o=r-t
this.allowPartialRecords||(n=Math.round(n),o=Math.round(o)),n>o&&(n=o=Math.max(o,r)),this.canSetVisibleRecord(n)||(n=0),this.canSetVisibleRecord(o)||(o=this.maxAllowedRecord)
var a=n!==i||o!==r
if(a){var s=o-n+1
if(s<r-i+1&&s<this.minVisibleRecords||n>=this.getDateDataSeries().length)return!1
this.firstVisibleRecord=n,this.lastVisibleRecord=o,this._requestMoreHistoryIfNeed()}return a},i.prototype._handleZoom=function(t){switch(this.zoomMode){case e.DateScaleZoomMode.PIN_CENTER:this.zoomOnPixels(t)
break
case e.DateScaleZoomMode.PIN_LEFT:this.zoomOnPixels(0,t)
break
case e.DateScaleZoomMode.PIN_RIGHT:this.zoomOnPixels(t,0)
break
default:throw Error("Unknown zoom mode: "+this.zoomMode)}t=!1,this.zoomKind===e.DateScaleZoomKind.AUTOSCALED&&(t=!0),this.chart.setNeedsUpdate(t)},i.prototype._requestMoreHistoryIfNeed=function(){var t=this.chart
0<t.firstVisibleIndex?this._moreHistoryRequested=!1:this._moreHistoryRequested||(t.fireValueChanged(e.ChartEvent.MORE_HISTORY_REQUESTED),this._moreHistoryRequested=!0)},i.prototype.saveState=function(){var t=e.JsUtil.clone(this._options)
return t.formatter=this._formatter.saveState(),t.calibrator=this._calibrator.saveState(),t},i.prototype.loadState=function(t){t=t||{},this._options={},this.theme=t.theme,this.firstVisibleRecord=null!=t.firstVisibleRecord?t.firstVisibleRecord:null,this.lastVisibleRecord=null!=t.lastVisibleRecord?t.lastVisibleRecord:null,this.minVisibleRecords=t.minVisibleRecords||5,this.textPadding=t.textPadding||{left:3,top:null,right:3,bottom:3},this.manualHeight=t.height||15,this.useManualHeight=null!=t.useManualHeight&&t.useManualHeight,this.scrollKind=t.scrollKind||e.DateScaleScrollKind.AUTOSCALED,this.zoomKind=t.zoomKind||e.DateScaleZoomKind.AUTOSCALED,this.zoomMode=t.zoomMode||e.DateScaleZoomMode.PIN_CENTER,this.rightAdditionalSpaceRatio=t.rightAdditionalSpaceRatio||.5,t.formatter&&(this._formatter=e.DateTimeFormat.deserialize(t.formatter)),this._formatter.locale=this.chart.locale,this.majorTickMarkLength=t.majorTickMarkLength||5,this.minorTickMarkLength=t.minorTickMarkLength||3,this.allowPartialRecords=null==t.allowPartialRecords||!!t.allowPartialRecords,t.calibrator?this._calibrator=e.DateScaleCalibrator.deserialize(t.calibrator):this._calibrator=new e.AutoDateScaleCalibrator},i.prototype.canSetVisibleRecord=function(e){return 0<=e&&e<=this.maxAllowedRecord},i.prototype._onUpdateAnimationCallback=function(){this.layoutScalePanel(this.chart.getBounds()),this.draw()},i.prototype.setNeedsUpdate=function(e){e&&this.setNeedsAutoScale(),this._updateAnimation.start()},i.prototype.layoutScalePanel=function(e){this.needsAutoScale()&&this.autoScale()
var t=this._topPanel.layoutPanel(e,!0),i=this._bottomPanel.layoutPanel(e,!1)
return e=e.clone(),t&&e.cropTop(t),i&&e.cropBottom(i),e},i.prototype.layout=function(e,t){this.needsAutoScale()&&this.autoScale(),this._projectionFrame.copyFrom(t),this._projectionFrame.applyPadding(this.chart.chartPanelsContainer.panelPadding),this._calculateProjectionMetrics(),this._calibrator.calibrate(this),this._topPanel.layout(e,!0),this._bottomPanel.layout(e,!1)},i.prototype._canvasStartX=function(){return this._projectionFrame.left-this.chart.chartPanelsFrame.left-this.chart.chartPanelsContainer.panelPadding.left},i.prototype._textDrawBounds=function(){return{left:this.textPadding.left,top:null,width:this.chart.chartPanelsContainer.frame.width,height:null}},i.prototype.clear=function(){this._topPanel.clearPanel(),this._bottomPanel.clearPanel()},i.prototype.draw=function(){this._topPanel.draw(),this._bottomPanel.draw()
for(var e=0,t=this.chart.chartPanels;e<t.length;e++)for(var i=0,r=t[e].drawings;i<r.length;i++){var n=r[i]
this.chart.showDrawings&&(n.selected||n.drawDateMarkers())}},i}(e.ChartComponent)
e.DateScale=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){var r=this
if(t.call(this),this._isVisible=!0,"object"!=typeof i)throw new TypeError("Config must be an object.")
if(!(i.dateScale instanceof e.DateScale))throw new TypeError("'config.dateScale' must be an instance of StockChartX.DateScale.")
if(this._dateScale=i.dateScale,null==i.cssClass)throw Error("'config.cssClass' is not specified.")
this._cssClass=i.cssClass,this._isVisible=null==i.visible||!!i.visible,this._initGestures(),this.chart.on(e.ChartEvent.THEME_CHANGED+".scxDateScalePanel",function(){r.applyTheme()})}return __extends(i,t),Object.defineProperty(i.prototype,"dateScale",{get:function(){return this._dateScale},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chart",{get:function(){return this._dateScale&&this._dateScale.chart},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cssClass",{get:function(){return this._cssClass},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._isVisible},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"layer",{get:function(){return this._layer},enumerable:!0,configurable:!0}),i.prototype._initGestures=function(){return new e.GestureArray([new e.DoubleClickGesture({handler:this._handleDoubleClickGesture}),new e.PanGesture({handler:this._handlePanGesture,verticalMoveEnabled:!1}),new e.MouseWheelGesture({handler:this._handleMouseWheel})],this,this.hitTest)},i.prototype._handleDoubleClickGesture=function(){this.chart.setNeedsUpdate(!0)},i.prototype._handlePanGesture=function(t,i){var r=this.chart
switch(t.state){case e.GestureState.STARTED:r.rootDiv.addClass("scxDateScaleScroll")
break
case e.GestureState.FINISHED:r.rootDiv.removeClass("scxDateScaleScroll")
break
case e.GestureState.CONTINUED:var n=t.moveOffset.x,o=!1,a=!1
1==i.evt.which?(o=this._dateScale.scrollOnPixels(n),a=o&&this._dateScale.scrollKind==e.DateScaleScrollKind.AUTOSCALED):(o=this._dateScale.zoomOnPixels(n),a=o&&this._dateScale.zoomKind==e.DateScaleZoomKind.AUTOSCALED),o&&r.setNeedsUpdate(a)}},i.prototype._handleMouseWheel=function(e){this._dateScale._handleZoom(.05*-e.delta*this.frame.width)},i.prototype.applyTheme=function(){if(this.rootDiv){var e=this._dateScale.actualTheme.border
this.rootDiv.css(this._cssClass==this._dateScale.topPanelCssClass?"border-bottom":"border-top",e.width+"px "+e.lineStyle+" "+e.strokeColor)}},i.prototype._getClientHeight=function(){var t=this._dateScale
return t.useManualHeight?t.manualHeight:e.HtmlUtil.getFontSize(t.actualTheme)+t.textPadding.bottom+t.majorTickMarkLength+1},i.prototype.hitTest=function(t){var i=this.frame
return!!i&&e.Geometry.isPointInsideOrNearRect(t,i)},i.prototype.layoutPanel=function(e,t){var i=this._rootDiv,r=null
return this._isVisible?(i||(this._rootDiv=i=this.chart.rootDiv.scxAppend("div","scxDateScale").addClass(this._cssClass),this.applyTheme()),i.outerWidth(e.width).innerHeight(this._getClientHeight()),r=this.frame,r.left=e.left,r.width=e.width,r.height=i.outerHeight(),r.top=t?0:e.bottom-r.height,i.css("left",r.left).css("top",r.top)):null!=i&&(i.remove(),this._rootDiv=null),r},i.prototype.layout=function(t,i){this.layoutPanel(t,i),this._isVisible?(this._layer||(this._layer=new e.Layer({parent:this._rootDiv})),this._layer.size={width:this._rootDiv.width(),height:this._rootDiv.height()}):this._layer&&(this._layer.canvas.remove(),this._layer.canvas=this._layer.context=null)},i.prototype.clearPanel=function(){this._layer&&this._layer.canvas&&this._layer.context.clearRect(0,0,this._layer.size.width,this._layer.size.height)},i.prototype.draw=function(){if(this._isVisible){var e=this._layer.context,t=this._dateScale,i=t.actualTheme,r=this._layer.size.height-t.textPadding.bottom
this.clearPanel(),e.save(),e.translate(.5,.5),e.scxApplyTextTheme(i.text),e.textBaseline="bottom",e.beginPath()
for(var n=0,o=t.calibrator.majorTicks;n<o.length;n++){var a=o[n]
e.moveTo(a.x,0),e.lineTo(a.x,t.majorTickMarkLength),e.textAlign=a.textAlign,e.fillText(a.text,a.textX,r)}for(r=0,n=t.calibrator.minorTicks;r<n.length;r++)o=n[r],e.moveTo(o.x,0),e.lineTo(o.x,t.minorTickMarkLength)
e.scxApplyStrokeTheme(i.line),e.stroke(),e.restore()}},i}(e.FrameControl)
e.DateScalePanel=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t,"registeredCalibrators",{get:function(){return this._calibrators.registeredItems},enumerable:!0,configurable:!0}),t.register=function(e,t){"string"==typeof e?this._calibrators.register(e,t):this._calibrators.register(e.className,e)},t.deserialize=function(e){if(!e)return null
var t=this._calibrators.createInstance(e.className)
return t.loadState(e),t},t._calibrators=new e.ClassRegistrar,t}(),i=function(){function t(e){this._majorTicks=[],this._minorTicks=[],this._options={},e&&this.loadState({options:e})}return Object.defineProperty(t,"className",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"majorTicks",{get:function(){return this._majorTicks},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minorTicks",{get:function(){return this._minorTicks},enumerable:!0,configurable:!0}),t.prototype.calibrate=function(e){this._majorTicks.length=0,this._minorTicks.length=0},t.prototype._calibrateMinorTicks=function(e){for(var t=this.majorTicks,i=0,r=t.length;i<r-1;i++)for(var n=t[i],o=(t[i+1].x-n.x)/(e+1),a=1;a<=e;a++)this.minorTicks.push({x:Math.round(n.x+a*o)})},t.prototype.saveState=function(){return{className:this.constructor.className,options:e.JsUtil.clone(this._options)}},t.prototype.loadState=function(t){this._options=t&&e.JsUtil.clone(t.options)||{}},t}()
e.DateScaleCalibrator=i,e.JsUtil.applyMixins(i,[t])}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){t.call(this,i),this._formatter=new e.TimeIntervalDateTimeFormat}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.AutoDateScaleCalibrator"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minLabelsOffset",{get:function(){var e=this._options.majorTicks
return e&&null!=e.minOffset?e.minOffset:i.defaults.majorTicks.minOffset},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Min labels offset must be greater or equal to 0.")
var i=this._options;(i.majorTicks||(i.majorTicks={})).minOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTicksCount",{get:function(){var e=this._options.minorTicks
return e&&null!=e.count?e.count:i.defaults.minorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Ticks count must be a positive number or 0.")
var i=this._options;(i.minorTicks||(i.minorTicks={})).count=t},enumerable:!0,configurable:!0}),i.prototype.calibrate=function(e){t.prototype.calibrate.call(this,e),this._calibrateMajorTicks(e),this._calibrateMinorTicks(this.minorTicksCount)},i.prototype._calibrateMajorTicks=function(t){var i=t.getDateDataSeries().values,r=t.chart,n=t.projectionFrame,o=t.projection,a=o.recordByColumn(0),s=t.maxAllowedRecord,l=this.minLabelsOffset,c=t._textDrawBounds(),h=c.left,c=c.left+c.width,u=new Date(0),d=null,p=-1/0,f=e.DummyCanvasContext
for(this._formatter.timeInterval=r.timeInterval,this._formatter.locale=r.locale,f.applyTextTheme(t.actualTheme.text),t=f.textWidth("9");a<=s;){var r=0<=a&&a<i.length?i[a]:o.dateByRecord(a),m=this._labelDateString(r,u)
if(m&&m!==d){var v=o.xByRecord(a)
if(v<n.left)a++
else{if(v>=n.right)break
var g=m.length*t,y=v-g/2
if(y<p?v=p+g/2:(g=f.textWidth(m),(y=v-g/2)<p?v=p+g/2:(u=v,d="center",y<h?(y=u=h,d="left"):y+g>c&&(u=c,y=u-g,d="right"),this.majorTicks.push({x:v,textX:u,textAlign:d,date:r,text:m}),p=y+g+l,v=Math.ceil(p),u=r,d=m)),v>n.right)break
r=o.recordByX(v)+1,a=r>a?r:a+1}}else a++}},i.prototype._labelDateString=function(t,i){if(t<=i)return null
var r=e.TimeSpan,n=this._formatter,o=n.timeInterval,a=t.getFullYear(),s=i.getFullYear()
if(o>=r.MILLISECONDS_IN_YEAR)return a!==s?a.toString():null
var l=e.DateTimeFormatName,c=t.getMonth()+1,h=i.getMonth()+1
if(o>=r.MILLISECONDS_IN_MONTH)return a!==s?n.formatWithFormatter(t,l.YEAR_MONTH):c!==h?n.formatWithFormatter(t,l.YEAR_MONTH):null
var u=t.getDate(),d=i.getDate()
if(o>=r.MILLISECONDS_IN_DAY)return a!==s?n.formatWithFormatter(t,l.DATE):c!==h||u!==d?n.formatWithFormatter(t,l.MONTH_DAY):null
var p=t.getHours(),f=i.getHours(),m=t.getMinutes(),v=i.getMinutes()
if(o>=r.MILLISECONDS_IN_MINUTE)return a!==s?n.formatWithFormatter(t,l.SHORT_DATE_TIME):c!==h||u!==d?n.formatWithFormatter(t,l.SHORT_DATE_TIME):p!==f||m!==v?n.formatWithFormatter(t,l.SHORT_TIME):null
var g=t.getSeconds(),y=i.getSeconds()
return o>=r.MILLISECONDS_IN_SECOND?a!==s?n.formatWithFormatter(t,l.SHORT_DATE_TIME):c!==h||u!==d?n.formatWithFormatter(t,l.SHORT_DATE_TIME):p!==f||m!==v?n.formatWithFormatter(t,l.LONG_TIME):g!==y?n.formatWithFormatter(t,l.LONG_TIME):null:(r=t.getMilliseconds(),o=i.getMilliseconds(),a!==s?n.formatWithFormatter(t,l.LONG_DATE_TIME):c!==h||u!==d?n.formatWithFormatter(t,l.LONG_DATE_TIME):p!==f||m!==v?n.formatWithFormatter(t,l.LONG_TIME):g!==y||r!==o?n.formatWithFormatter(t,l.LONG_TIME):null)},i.defaults={majorTicks:{minOffset:30},minorTicks:{count:0}},i}(e.DateScaleCalibrator)
e.AutoDateScaleCalibrator=t,e.DateScaleCalibrator.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){t.call(this,i),this._formatter=new e.CustomDateTimeFormat}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.FixedDateScaleCalibrator"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTicksCount",{get:function(){var e=this._options.majorTicks
return e&&null!=e.count?e.count:i.defaults.majorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Ticks count must be a positive number.")
var i=this._options;(i.majorTicks||(i.majorTicks={})).count=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTicksCount",{get:function(){var e=this._options.minorTicks
return e&&null!=e.count?e.count:i.defaults.minorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Ticks count must be a positive number.")
var i=this._options;(i.minorTicks||(i.minorTicks={})).count=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTicksFormat",{get:function(){var e=this._options.majorTicks
return e&&e.format||i.defaults.majorTicks.format},set:function(e){var t=this._options;(t.majorTicks||(t.majorTicks={})).format=e},enumerable:!0,configurable:!0}),i.prototype.calibrate=function(e){t.prototype.calibrate.call(this,e),this._calibrateMajorTicks(e),this._calibrateMinorTicks(this.minorTicksCount)},i.prototype._calibrateMajorTicks=function(t){var r=t.projectionFrame,n=t._textDrawBounds(),o=n.left,n=n.left+n.width,a=t.projection,s=t.chart.chartPanelsContainer.panelPadding,l=r.left-s.left,c=e.DummyCanvasContext,h=this.majorTicksCount,r=(r.right+s.right-l)/(h-1)
for((s=this.majorTicksFormat)||(s={}),s.other||(s.other=i._createAutoFormat(t.chart)),c.applyTextTheme(t.actualTheme.text),t=0;t<h;t++){var u=l+t*r
this._updateFormatterForLabel(t,t===h-1,s)
var d=a.dateByX(u),p=this._formatter.format(d),f=c.textWidth(p),m="center",v=u
v-f/2<o?m="left":v+f/2>n&&(m="right"),this.majorTicks.push({x:u,textX:u,textAlign:m,date:d,text:p})}},i.prototype._updateFormatterForLabel=function(e,t,i){this._formatter.formatString=t?i.last||i.other:0===e?i.first||i.other:i.other},i._createAutoFormat=function(t){return t=t.timeInterval,t>=e.TimeSpan.MILLISECONDS_IN_YEAR?"YYYY":t>=e.TimeSpan.MILLISECONDS_IN_MONTH?"YYYY MMM":t>=e.TimeSpan.MILLISECONDS_IN_DAY?"YYYY-MM-DD":t>=e.TimeSpan.MILLISECONDS_IN_MINUTE?"YYYY-MM-DD HH:mm":t>=e.TimeSpan.MILLISECONDS_IN_SECOND?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm:ss.SSS"},i.defaults={majorTicks:{count:3},minorTicks:{count:0}},i}(e.DateScaleCalibrator)
e.FixedDateScaleCalibrator=t,e.DateScaleCalibrator.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=jQuery,i=function(i){function r(t){i.call(this,t),this._options=null,this._leftPanel=new e.ValueScalePanel({valueScale:this,cssClass:"scxLeftValueScale"}),this._rightPanel=new e.ValueScalePanel({valueScale:this,cssClass:"scxRightValueScale"}),this.loadState(t)}return __extends(r,i),Object.defineProperty(r.prototype,"leftPanel",{get:function(){return this._leftPanel},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rightPanel",{get:function(){return this._rightPanel},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"leftPanelCssClass",{get:function(){return"scxLeftValueScale"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rightPanelCssClass",{get:function(){return"scxRightValueScale"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"useManualWidth",{get:function(){return this._options.useManualWidth},set:function(e){this._options.useManualWidth=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"manualWidth",{get:function(){return this._options.width},set:function(t){if(!e.JsUtil.isFiniteNumber(t)||0>=t)throw Error("Width must be greater than 0.")
this._options.width=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"leftPanelVisible",{get:function(){return this._options.showLeftPanel},set:function(e){this._leftPanel.visible=this._options.showLeftPanel=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rightPanelVisible",{get:function(){return this._options.showRightPanel},set:function(e){this._rightPanel.visible=this._options.showRightPanel=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"index",{get:function(){return this.chart.valueScales.indexOf(this)},enumerable:!0,configurable:!0}),r.prototype.saveState=function(){return t.extend(!0,{},this._options)},r.prototype.loadState=function(e){e=e||{},this._options={},this.leftPanelVisible=void 0!==e.showLeftPanel&&!!e.showLeftPanel,this.rightPanelVisible=void 0===e.showRightPanel||!!e.showRightPanel,this.manualWidth=e.width||100,this.useManualWidth=void 0!==e.useManualWidth&&!!e.useManualWidth},r.prototype.layout=function(e){var t=this._leftPanel.layout(e,!0),i=this._rightPanel.layout(e,!1)
return e=e.clone(),t&&e.cropLeft(t),i&&e.cropRight(i),e},r.prototype.draw=function(){},r.prototype.destroy=function(){this.leftPanel.destroy(),this.rightPanel.destroy(),i.prototype.destroy.call(this)},r}(e.ChartComponent)
e.ValueScale=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){var r=this
if(t.call(this),this._isVisible=!0,!i)throw Error("Config is not specified.")
if(!(i.valueScale instanceof e.ValueScale))throw new TypeError("Config.valueScale must be an instance of StockChartX.ValueScale")
if(this._valueScale=i.valueScale,!i.cssClass)throw Error("'config.cssClass' is not specified.")
this._cssClass=i.cssClass,this._isVisible=null==i.visible||!!i.visible,this.chart.on(e.ChartEvent.THEME_CHANGED+".scxValueScalePanel",function(){r.applyTheme()})}return __extends(i,t),Object.defineProperty(i.prototype,"valueScale",{get:function(){return this._valueScale},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cssClass",{get:function(){return this._cssClass},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._isVisible},set:function(e){this._isVisible=!!e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chart",{get:function(){return this._valueScale&&this._valueScale.chart},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){var e=this.rootDiv
return e&&e.scxSize()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"contentSize",{get:function(){var e=this.rootDiv
return e&&e.scxContentSize()},enumerable:!0,configurable:!0}),i.prototype.layout=function(e,t){var i=this.rootDiv,r=null
return this._isVisible?(i||(this._rootDiv=i=this.chart.chartPanelsContainer.rootDiv.scxAppend("div","scxValueScale").addClass(this._cssClass),this.applyTheme()),i.width(this.getWidth()).outerHeight(e.height),r=this.frame,r.width=i.outerWidth(),r.left=t?e.left:e.right-r.width,r.height=e.height,i.css("left",r.left)):i&&(i.remove(),this._rootDiv=null),r},i.prototype.getWidth=function(){var e=this._valueScale
if(e.useManualWidth)return e.manualWidth
for(var t=e=0,i=this.chart.chartPanels;t<i.length;t++)e=Math.max(i[t].preferredValueScaleWidth(this._valueScale),e)
return e},i.prototype.applyTheme=function(){if(this.rootDiv){var e=this.chart.theme.valueScale.border
this.rootDiv.css(this._cssClass===this._valueScale.leftPanelCssClass?"border-right":"border-left",e.width+"px "+e.lineStyle+" "+e.strokeColor)}},i}(e.FrameControl)
e.ValueScalePanel=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t,"registeredCalibrators",{get:function(){return this._calibrators.registeredItems},enumerable:!0,configurable:!0}),t.register=function(e,t){"string"==typeof e?this._calibrators.register(e,t):this._calibrators.register(e.className,e)},t.deserialize=function(e){if(!e)return null
var t=this._calibrators.createInstance(e.className)
return t.loadState(e),t},t._calibrators=new e.ClassRegistrar,t}(),i=function(){function t(e){this._majorTicks=[],this._minorTicks=[],this._options={},e&&this.loadState({options:e})}return Object.defineProperty(t,"className",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"majorTicks",{get:function(){return this._majorTicks},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minorTicks",{get:function(){return this._minorTicks},enumerable:!0,configurable:!0}),t.prototype.calibrate=function(e){this._majorTicks.length=0,this._minorTicks.length=0},t.prototype._calibrateMinorTicks=function(e){for(var t=this.majorTicks,i=0,r=t.length;i<r-1;i++)for(var n=t[i],o=(t[i+1].y-n.y)/(e+1),a=1;a<=e;a++)this.minorTicks.push({y:Math.round(n.y+a*o)})},t.prototype.saveState=function(){return{className:this.constructor.className,options:e.JsUtil.clone(this._options)}},t.prototype.loadState=function(t){this._options=t&&e.JsUtil.clone(t.options)||{}},t}()
e.ValueScaleCalibrator=i,e.JsUtil.applyMixins(i,[t])}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.AutoValueScaleCalibrator"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minValuesOffset",{get:function(){var e=this._options.majorTicks
return null!=e&&null!=e.minOffset?e.minOffset:i.defaults.majorTicks.minOffset},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Values offset must be a value greater or equal to 0.")
var i=this._options;(i.majorTicks||(i.majorTicks={})).minOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTicksCount",{get:function(){var e=this._options.minorTicks
return e&&null!=e.count?e.count:i.defaults.minorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Tick count must be greater or equal to 0.")
var i=this._options;(i.minorTicks||(i.minorTicks={})).count=t},enumerable:!0,configurable:!0}),i.prototype.calibrate=function(e){t.prototype.calibrate.call(this,e),this._calibrateMajorTicks(e),this._calibrateMinorTicks(this.minorTicksCount)},i.prototype._calibrateMajorTicks=function(t){for(var i=e.HtmlUtil.getFontSize(t.actualTheme.text),r=this.minValuesOffset,n=t.padding,o=Math.round(Math.max(n.top,t.chartPanel.chartPanelsContainer.panelPadding.top)+i/2),n=t.chartPanel.layer.canvas.height()-n.bottom-i/2,a=t.projection,s=null;o<n;){var l=a.valueByY(o),c=t.formatValue(l)
c!==s&&(this.majorTicks.push({y:o,value:l,text:c}),s=c),o+=i+r}},i.defaults={majorTicks:{minOffset:10},minorTicks:{count:0}},i}(e.ValueScaleCalibrator)
e.AutoValueScaleCalibrator=t,e.ValueScaleCalibrator.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.FixedValueScaleCalibrator"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTicksCount",{get:function(){var e=this._options.majorTicks
return e&&null!=e.count?e.count:i.defaults.majorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Tick count must be greater or equal to 0.")
var i=this._options;(i.majorTicks||(i.majorTicks={})).count=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTicksCount",{get:function(){var e=this._options.minorTicks
return e&&null!=e.count?e.count:i.defaults.minorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Tick count must be greater or equal to 0.")
var i=this._options;(i.minorTicks||(i.minorTicks={})).count=t},enumerable:!0,configurable:!0}),i.prototype.calibrate=function(e){t.prototype.calibrate.call(this,e),this._calibrateMajorTicks(e),this._calibrateMinorTicks(this.minorTicksCount)},i.prototype._calibrateMajorTicks=function(e){for(var t=e.padding,i=e.chartPanel.chartPanelsContainer.panelPadding,r=Math.max(t.top,i.top),n=e.chartPanel.layer.canvas.height()-Math.max(t.bottom,i.bottom)-r,t=e.projection,i=this.majorTicksCount,n=n/(i-1),o=0;o<i;o++){var a=Math.round(r+o*n),s=t.valueByY(a)
this.majorTicks.push({y:a,value:s,text:e.formatValue(s)})}},i.defaults={majorTicks:{count:3},minorTicks:{count:0}},i}(e.ValueScaleCalibrator)
e.FixedValueScaleCalibrator=t,e.ValueScaleCalibrator.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"StockChartX.IntervalValueScaleCalibrator"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"interval",{get:function(){var e=this._options.majorTicks
return e&&e.interval?e.interval:i.defaults.majorTicks.interval},set:function(t){if(null!=t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Interval must be a value greater than 0.")
if(1e-8>t)throw Error("Interval is too small.")}var i=this._options;(i.majorTicks||(i.majorTicks={})).interval=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minValuesOffset",{get:function(){var e=this._options.majorTicks
return e&&null!=e.minOffset?e.minOffset:i.defaults.majorTicks.minOffset},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Values offset must be a value greater or equal to 0.")
var i=this._options;(i.majorTicks||(i.majorTicks={})).minOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTicksCount",{get:function(){var e=this._options.minorTicks
return e&&null!=e.count?e.count:i.defaults.minorTicks.count},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Tick count must be greater or equal to 0.")
var i=this._options;(i.minorTicks||(i.minorTicks={})).count=t},enumerable:!0,configurable:!0}),i.prototype.calibrate=function(e){t.prototype.calibrate.call(this,e),this._calibrateIntervalMajorTicks(e),1>=this.majorTicks.length&&(this.majorTicks.length=0,this._calibrateRangeMajorTicks(e)),this._calibrateMinorTicks(this.minorTicksCount)},i.prototype._calibrateIntervalMajorTicks=function(t){var i=this.interval
if(!(1e-8>i||t.maxVisibleValue-t.minVisibleValue<=i))for(var r,n=e.HtmlUtil.getFontSize(t.actualTheme.text),o=n+this.minValuesOffset,a=t.padding,s=t.chartPanel.layer.size.height-a.bottom-n/2,l=t.projection,c=l.valueByY(0),a=n=Math.round(a.top+n/2),h=null;n<s;){var u=a
do{if(r=i*Math.trunc(l.valueByY(n)/i),r>=c&&(r=c-i),c=r,(n=Math.round(l.yByValue(r)))>=a)break
u=n=u+1}while(n<s)
if(a=n+o,n>=s)break
u=t.formatValue(r),u!==h&&(this.majorTicks.push({y:n,value:r,text:u}),h=u),n=a}},i.prototype._calibrateRangeMajorTicks=function(t){var i=e.HtmlUtil.getFontSize(t.actualTheme.text),r=i/2,n=t.padding,o=t.chartPanel.layer.size.height,a=n.top+r,r=o-n.bottom-r,n=t.projection
r-a<i+this.minValuesOffset?(a=o/2,i=n.valueByY(a),this.majorTicks.push({y:a,value:i,text:t.formatValue(i)})):(i=n.valueByY(a),this.majorTicks.push({y:a,value:i,text:t.formatValue(i)}),a=n.valueByY(r),this.majorTicks.push({y:r,value:a,text:t.formatValue(a)}))},i.defaults={majorTicks:{interval:.005,minOffset:10},minorTicks:{count:0}},i}(e.ValueScaleCalibrator)
e.IntervalValueScaleCalibrator=t,e.ValueScaleCalibrator.register(t)}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t.prototype,"textOffset",{get:function(){var e=this._textOffset
return null!=e?e:t.defaults.textOffset},set:function(t){if(null!=t&&e.JsUtil.isNegativeNumber(t))throw Error("Text offset must be greater or equal to 0.")
this._textOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"theme",{get:function(){return this._theme},set:function(e){this._theme=e},enumerable:!0,configurable:!0}),t.prototype.draw=function(e,t){var i=t.leftFrame,r=t.rightFrame
if(i||r){var n=t.chartPanel.layer.context,o=t.formatValue(e),a=t.projection.yByValue(e),s=this.theme,l=this.textOffset,c=s.text.fontSize/2+1
if(n.save(),t.clip(),n.textBaseline="middle",n.beginPath(),i){var h=i.right-1
n.moveTo(h,a),n.lineTo(h-c,a+c),n.lineTo(i.left,a+c),n.lineTo(i.left,a-c),n.lineTo(h-c,a-c),n.closePath(),n.scxFillStroke(s.fill,s.line),n.scxApplyTextTheme(s.text),n.textAlign="right",n.fillText(o,i.right-l,a)}r&&(h=r.right-1,n.moveTo(r.left,a),n.lineTo(r.left+c,a-c),n.lineTo(h,a-c),n.lineTo(h,a+c),n.lineTo(r.left+c,a+c),n.closePath(),n.scxFillStroke(s.fill,s.line),n.scxApplyTextTheme(s.text),n.textAlign="left",n.fillText(o,r.left+l,a)),n.restore()}},t.defaults={textOffset:8},t}()
e.ValueMarker=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(){}return Object.defineProperty(t.prototype,"theme",{get:function(){return this._theme},set:function(e){this._theme=e},enumerable:!0,configurable:!0}),t.prototype.draw=function(t,i){var r=this,n=i.formatDate(t),o=this.theme,a=e.DummyCanvasContext.measureText(n,o.text),s=i.projection.xByDate(t)-a.width/2,l=s-5,c=a.width+10,h=function(e){var t=e.layer.context
t.textBaseline="middle",t.beginPath(),t.rect(l,0,c,e.frame.height),t.scxFillStroke(o.fill,o.stroke),t.scxFill(r.theme.fill),t.scxApplyTextTheme(o.text),t.textAlign="left",t.fillText(n,s,e.frame.height-a.height)}
i.bottomPanelVisible&&h(i.bottomPanel),i.topPanelVisible&&h(i.topPanel)},t}()
e.DateMarker=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){t.call(this),this._options={},this._tooltip=new e.UI.Tooltip({parent:this}),this.loadState(i)}return __extends(i,t),Object.defineProperty(i.prototype,"tooltip",{get:function(){return this._tooltip},set:function(e){if(null!=e)return this._tooltip=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chartPanel",{get:function(){return this._panel},set:function(t){var i=this._panel
if(i!==t){if(t&&!(t instanceof e.ChartPanel))throw new TypeError("Panel must be an instance of StockChartX.ChartPanel.")
this._panel=t,this._onChartPanelChanged(i),t&&!this._valueScale&&(t=this._options.valueScaleIndex)&&(this.valueScale=this.chart.valueScales[t])}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"context",{get:function(){return this._panel.layer.context},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chart",{get:function(){var e=this._panel
return e&&e.chart},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"valueScale",{get:function(){return this._valueScale||this.chart.valueScale},set:function(t){if(t&&!(t instanceof e.ValueScale))throw new TypeError("Value scale must be an instance of StockChartX.ValueScale.")
var i=this._valueScale
i!==t&&(this._valueScale=t,this._onValueScaleChanged(i))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"panelValueScale",{get:function(){return this._panel.getValueScale(this.valueScale)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projection",{get:function(){return this._panel&&this._panel.getProjection(this.valueScale)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._options.visible},set:function(e){var t=this.visible
t!==e&&(this._options.visible=e,this._onVisibleChanged(t))},enumerable:!0,configurable:!0}),i.prototype._setOption=function(e,t,i){var r=this._options,n=r[e]
n!==t&&(r[e]=t,i&&this.fire(i,t,n))},i.prototype._onChartPanelChanged=function(e){},i.prototype._onValueScaleChanged=function(e){},i.prototype._onVisibleChanged=function(e){},i.prototype.addChartCssClass=function(e){var t=this.chart
t&&t.addCssClass(e)},i.prototype.removeChartCssClass=function(e){var t=this.chart
t&&t.removeCssClass(e)},i.prototype.changeCursor=function(e){this._prevCursor&&this.removeChartCssClass(this._prevCursor),e&&this.addChartCssClass(e),this._prevCursor=e},i.prototype.saveState=function(){var t={options:e.JsUtil.clone(this._options),tooltip:this.tooltip.saveState()}
return this.chartPanel&&(t.panelIndex=this.chartPanel.getIndex()),this.valueScale&&(t.valueScaleIndex=this.valueScale.index),t},i.prototype.loadState=function(e){var t=this.suppressEvents()
e=e||{},this._options=e.options||{},this.tooltip.loadState(e.tooltip),this.suppressEvents(t)},i.prototype.draw=function(){},i.prototype.showTooltip=function(e){if(e){var t=this.chartPanel
e=t.rootDiv.scxLocalToClientPoint(e.x,e.y)
var i=this.tooltip
i.layoutRect={top:this.chart.rootDiv.offset().top,left:t.rootDiv.offset().left+t.contentFrame.left,width:t.contentFrame.width,height:this.chart.getBounds().height},i.theme=i.actualTheme,i.visible?i.moveTo(e):i.show(e)}},i.prototype.hideTooltip=function(){this.tooltip.hide()},i.prototype.destroy=function(){this.tooltip&&this.tooltip.destroy()},i}(e.ChartEventsExtender)
e.ChartPanelObject=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=jQuery,i=function(i){function r(t){i.call(this,t),this._panels=[],this._splitters=[],this._options={},this._panelsContentFrame=new e.Rect,this.loadState(t),0===this._panels.length&&this._panels.push(new e.ChartPanel({chartPanelsContainer:this}))}return __extends(r,i),Object.defineProperty(r.prototype,"panels",{get:function(){return this._panels},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"newPanelHeightRatio",{get:function(){return this._options.newPanelHeightRatio},set:function(t){if(!e.JsUtil.isPositiveNumber(t)||1<=t)throw Error("Ratio must be a number in range (0..1)")
this._options.newPanelHeightRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"panelPadding",{get:function(){return this._options.panelPadding},set:function(e){this._options.panelPadding=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"panelsContentFrame",{get:function(){return this._panelsContentFrame},enumerable:!0,configurable:!0}),r.prototype._initGestures=function(){return new e.GestureArray([new e.MouseHoverGesture({handler:this._handleMouseHoverGesture,hitTest:this._mouseHoverHitTest})],this)},r.prototype._subscribeEvents=function(){var t=this
this.chart.on(e.ChartEvent.THEME_CHANGED+".scxPanelsContainer",function(){for(var e=0,i=t._splitters;e<i.length;e++)i[e].invalidateTheme()})},r.prototype._unsubscribeEvents=function(){this.chart.off(".scxPanelsContainer")},r.prototype.handleEvent=function(e){for(var t=0,r=this._splitters;t<r.length;t++)if(r[t].handleEvent(e))return!0
for(i.prototype.handleEvent.call(this,e),e.pointerPosition.x-=this.frame.left,e.pointerPosition.y-=this.frame.top,t=0,r=this._panels;t<r.length;t++)if(r[t].handleEvent(e))return!0
return!1},r.prototype._handleMouseHoverGesture=function(e,t){this.chart.crossHair.handleMouseHoverGesture(e,t)},r.prototype._mouseHoverHitTest=function(e){return this._panelsContentFrame.containsPoint(e)},r.prototype.addPanel=function(t,i,r){var n=this._panels,o=i||this.newPanelHeightRatio
i=new e.ChartPanel({chartPanelsContainer:this,options:{heightRatio:o}})
try{if(r&&0<n.length){var a=this.chart.mainPanel,s=a.heightRatio-o
s>=a.minHeightRatio?a.heightRatio=s:this._adjustHeightRatiosToEncloseNewRatio(o)}else this._adjustHeightRatiosToEncloseNewRatio(o)}catch(e){if(!(0<(r=this._availableHeightRatio())&&r>=i.minHeightRatio))throw e
i.heightRatio=r}return null==t?n.push(i):n.splice(t,0,i),this._updateSplitters(),this.chart.fireValueChanged(e.ChartEvent.PANEL_ADDED,i),i},r.prototype.removePanel=function(t){t="number"==typeof t?this._panels[t]:t
var i=this.chart,r=i.mainPanel
if(t===r)throw Error("Main panel cannot be removed.")
for(var n=this._panels,o=0;o<n.length;o++)if(n[o]===t){i.removeIndicators(t.indicators,!1),r.heightRatio=Math.min(Math.roundToDecimals(r.heightRatio+t.heightRatio,8),1),n.splice(o,1),t.destroy(),this._updateSplitters(),i.fireValueChanged(e.ChartEvent.PANEL_REMOVED,t)
break}},r.prototype.movePanel=function(t,i){if(!e.JsUtil.isFiniteNumber(i))throw new TypeError("Offset must be a number.")
for(var r=this._panels,n=0;n<r.length;n++)if(r[n]===t){var o=Math.min(Math.max(n-i,0),r.length-1)
o!==n&&(r.splice(n,1),r.splice(o,0,t))
break}this._updateSplitters()},r.prototype.totalPanelsHeight=function(){var t=this.rootDiv.scxContentSize(),i=e.ChartPanelSplitter.getHeight()
return t.height-i*(this._panels.length-1)},r.prototype.findPanelAt=function(e){e-=this.frame.top
for(var t=0,i=this._panels;t<i.length;t++){var r=i[t],n=r.frame
if(e>=n.top&&e<=n.bottom)return r}return null},r.prototype.setPanelHeightRatio=function(e,t){var i=this.chart.mainPanel
if(e===i)e.heightRatio=t
else{var r=e.heightRatio
e.heightRatio=t,i.heightRatio-=e.heightRatio-r}},r.prototype._availableHeightRatio=function(){return 1-this._panels.reduce(function(e,t){return e+t.heightRatio},0)},r.prototype._adjustHeightRatiosToEncloseNewRatio=function(e){for(var t=this._panels,i=t.map(function(e){return e.heightRatio});;){var r=e-this._availableHeightRatio()
if(1e-5>=r)break
for(var n=!1,o=0,a=t;o<a.length;o++){var s=a[o],l=s.heightRatio-r*s.heightRatio
l>=s.minHeightRatio&&(s.heightRatio=l,n=!0)}if(!n){for(e=0;e<i.length;e++)t[e].heightRatio=i[e]
throw Error("Insufficient height. Other panels use too much height. You have to update minimum height weight of existing panels to free some space.")}}},r.prototype._updateSplitters=function(){var t=this._panels,i=this._splitters,r=t.length-1,n=i.length-1-r
if(0<=n){for(var o=0;o<i.length;o++)i[o].destroy()
i.splice(n,i.length-n)}for(n=0;n<r;n++){var a=(o=n>=i.length)?new e.ChartPanelSplitter:i[n]
a.setPanels(n,t[n],t[n+1]),o&&i.push(a)}},r.prototype.saveState=function(){var t=e.JsUtil.clone(this._options)
t.panels=[]
for(var i=0,r=this._panels;i<r.length;i++)t.panels.push(r[i].saveState())
return t},r.prototype.loadState=function(i){i=i||{},this._options={},this.newPanelHeightRatio=i.newPanelHeightRatio||.2,this.panelPadding=i.panelPadding||{left:5,top:10,right:5,bottom:10}
for(var r=this._panels,n=0;n<r.length;n++){var o=r[n]
o.destroy()}if(r.length=0,i.panels)for(n=0,i=i.panels;n<i.length;n++)o=t.extend({chartPanelsContainer:this},i[n]),o=new e.ChartPanel(o),r.push(o)
this._updateSplitters()},r.prototype._createRootDiv=function(){return this.chart.rootDiv.scxAppend("div","scxPanelsContainer")},r.prototype.setNeedsAutoScale=function(){for(var e=0,t=this._panels;e<t.length;e++)t[e].setNeedsAutoScale()},r.prototype.layoutScalePanel=function(t){i.prototype.layout.call(this,t)
var r=this.rootDiv.scxContentSize(),n=this._panelsContentFrame
n.left=t.left,n.top=t.top,n.width=r.width,n.height=r.height
for(var r=this.chart.valueScales,o=r.length-1;0<=o;o--)n=r[o].layout(n)
return this._panelsContentFrame=n,new e.Rect({left:n.left,top:n.top,width:n.width,height:t.height})},r.prototype.layout=function(t){t=this.rootDiv.scxContentSize()
for(var i=e.ChartPanelSplitter.getHeight(),r=this._panels.length,n=this.totalPanelsHeight(),o=0,a=0;a<r;a++){var s=this._panels[a],l=Math.round(n*s.heightRatio),c=new e.Rect({left:0,top:o,width:t.width,height:l})
o+=l,s.layout(c),a<r-1&&(s=new e.Rect({left:0,top:o,width:t.width,height:i}),this._splitters[a].layout(s),o+=i)}},r.prototype.layoutSplitterPanels=function(t){var i=this.totalPanelsHeight(),r=function(e){e.frame.height=Math.round(i*e.heightRatio),e.setNeedsUpdate()},n=t.topPanel
r(n)
var o=t.frame
o.top=n.frame.bottom,t.layout(o),t=t.bottomPanel,t.frame.top=o.top+e.ChartPanelSplitter.getHeight(),r(t)},r.prototype.draw=function(){for(var e=0,t=this._panels;e<t.length;e++)t[e].draw()},r.prototype.destroy=function(){for(var e=0,t=this._panels;e<t.length;e++)t[e].destroy()
for(e=0,t=this._splitters;e<t.length;e++)t[e].destroy()
i.prototype.destroy.call(this)},r}(e.ChartFrameControl)
e.ChartPanelsContainer=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.PanelMoveDirection={NONE:"none",HORIZONTAL:"horizontal",VERTICAL:"vertical",ANY:"any"},Object.freeze(e.PanelMoveDirection),e.PanelMoveKind={NORMAL:"normal",AUTOSCALED:"autoscaled"},Object.freeze(e.PanelMoveKind),e.PanelEvent={THEME_CHANGED:"panelThemeChanged",X_GRID_VISIBLE_CHANGED:"panelXGridVisibleChanged",Y_GRID_VISIBLE_CHANGED:"panelYGridVisibleChanged",PLOT_ADDED:"panelPlotAdded",PLOT_REMOVED:"panelPlotRemoved",DOUBLE_CLICKED:"panelDoubleClicked"},Object.freeze(e.PanelEvent)
var t=function(t){function i(i){if(t.call(this),this._valueScales=[],this._plots=[],this._drawings=[],this._contentFrame=new e.Rect,this._controls={title:null,options:null,watermark:null,moveUp:null,moveDown:null,close:null},this._barInfoControls=null,this._updateAnimation=new e.Animation({context:this,recurring:!1,callback:this._onUpdateAnimationCallback}),!(i.chartPanelsContainer instanceof e.ChartPanelsContainer))throw new TypeError("Invalid chart panels container.")
this._panelsContainer=i.chartPanelsContainer,this.loadState(i)}return __extends(i,t),Object.defineProperty(i.prototype,"chartPanelsContainer",{get:function(){return this._panelsContainer},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chart",{get:function(){return this._panelsContainer._chart},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"valueScales",{get:function(){return this._valueScales},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"valueScale",{get:function(){return this._valueScales[0]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"formatter",{get:function(){return this.valueScale.formatter},set:function(e){this.valueScale.formatter=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"layer",{get:function(){return this._layer},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"heightRatio",{get:function(){return this._options.heightRatio},set:function(t){if(!e.JsUtil.isFiniteNumber(t)||t<this._options.minHeightRatio||t>this._options.maxHeightRatio)throw Error("Height ratio must be a number in range [minHeightRatio..maxHeightRatio]")
this._options.heightRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minHeightRatio",{get:function(){return this._options.minHeightRatio},set:function(t){if(!e.JsUtil.isFiniteNumber(t)||0>t||t>this._options.maxHeightRatio)throw Error("Min height ratio must be a number in range [0..maxHeightRatio].")
this._options.minHeightRatio=t,this._options.heightRatio<t&&(this._options.heightRatio=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxHeightRatio",{get:function(){return this._options.maxHeightRatio},set:function(t){if(!e.JsUtil.isFiniteNumber(t)||t<this.minHeightRatio||1<t)throw Error("Max height ratio must be a number in range [minHeightRatio..1]")
this._options.maxHeightRatio=t,this.heightRatio>t&&(this._options.heightRatio=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"moveDirection",{get:function(){return this._options.moveDirection},set:function(e){this._options.moveDirection=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"moveKind",{get:function(){return this._options.moveKind},set:function(e){this._options.moveKind=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"xGridVisible",{get:function(){return this._options.showXGrid},set:function(t){t=!!t
var i=this._options.showXGrid
i!==t&&(this._options.showXGrid=t,this._fire(e.PanelEvent.X_GRID_VISIBLE_CHANGED,t,i))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"yGridVisible",{get:function(){return this._options.showYGrid},set:function(t){t=!!t
var i=this._options.showYGrid
i!==t&&(this._options.showYGrid=t,this._fire(e.PanelEvent.Y_GRID_VISIBLE_CHANGED,t,i))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"plots",{get:function(){return this._plots},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"drawings",{get:function(){return this._drawings},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"theme",{get:function(){return this._options.theme},set:function(t){var i=this._options.theme
this._options.theme=t,this._fire(e.PanelEvent.THEME_CHANGED,t,i)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"actualTheme",{get:function(){return this._options.theme||this.chart.theme.chartPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projection",{get:function(){return this.valueScale.projection},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"titleDiv",{get:function(){return this._controls.title},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"indicators",{get:function(){var e=this
return this.chart.indicators.filter(function(t){return t.chartPanel===e})},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"contentFrame",{get:function(){return this._contentFrame},enumerable:!0,configurable:!0}),i.prototype._fire=function(e,t,i){var r=this.chart
r&&r.fireTargetValueChanged(this,e,t,i)},i.prototype.getIndex=function(){return this._panelsContainer.panels.indexOf(this)},i.prototype.getProjection=function(e){return this.valueScales[e?e.index:0].projection},i.prototype.getValueScale=function(e){return this.valueScales[e?e.index:0]},i.prototype.setHeightRatio=function(e){this._panelsContainer.setPanelHeightRatio(this,e)},i.prototype.setNeedsAutoScale=function(){for(var e=0,t=this._valueScales;e<t.length;e++)t[e].setNeedsAutoScale()},i.prototype.containsPlot=function(e){for(var t=0,i=this._plots;t<i.length;t++)if(i[t]===e)return!0
return!1},i.prototype.addPlot=function(){for(var t=[],i=0;i<arguments.length;i++)t[i-0]=arguments[i]
for(i=0,t=e.JsUtil.flattenArray(t);i<t.length;i++){var r=t[i]
if(!(r instanceof e.Plot))throw new TypeError("Plot must be an instance of StockChartX.Plot.")
this.containsPlot(r)||(r.chartPanel=this,this._plots.push(r),this._fire(e.PanelEvent.PLOT_ADDED,r))}},i.prototype.removePlot=function(){for(var t=[],i=0;i<arguments.length;i++)t[i-0]=arguments[i]
for(i=0,t=t&&0<t.length?e.JsUtil.flattenArray(t):this._plots.slice(0);i<t.length;i++)for(var r=t[i],n=0;n<this._plots.length;n++)if(this._plots[n]===r){this._plots.splice(n,1),this._fire(e.PanelEvent.PLOT_REMOVED,r)
break}},i.prototype.containsDrawing=function(e){for(var t=0,i=this._drawings;t<i.length;t++)if(i[t]===e)return!0
return!1},i.prototype.addDrawings=function(){for(var t=[],i=0;i<arguments.length;i++)t[i-0]=arguments[i]
for(i=0,t=e.JsUtil.flattenArray(t);i<t.length;i++){var r=t[i]
if(!(r instanceof e.Drawing))throw new TypeError("Drawing is not an instance of StockChartX.Drawing.")
if(this.containsDrawing(r))throw Error("Drawing already added.")
r.chartPanel=this,this._drawings.push(r)}},i.prototype.removeDrawings=function(){for(var t=[],i=0;i<arguments.length;i++)t[i-0]=arguments[i]
for(var i=this._drawings,r=this.chart,n=null,o=0,t=t&&0<t.length?e.JsUtil.flattenArray(t):i.slice(0);o<t.length;o++){var a=t[o]
if(a.removable)for(var s=0;s<i.length;s++)if(i[s]===a){r.selectedObject===a&&(r.state===e.ChartState.USER_DRAWING?n=r.selectedObject:r.selectObject(null)),a.destroy(),i.splice(s,1)
break}}n&&r.cancelUserDrawing()},i.prototype.handleEvent=function(i){var r=i.pointerPosition,n=this.chart
if(n.state===e.ChartState.ZOOM_IN)return n.zoomInView.panel=this,n.zoomInView.handleEvent(i)
var o={x:r.x-this.frame.left,y:r.y-this.frame.top}
i.pointerPosition=o
for(var a=0,s=this._valueScales;a<s.length;a++)if(s[a].handleEvent(i))return!0
a=this.hitTest(r)
try{if(n.state===e.ChartState.USER_DRAWING){if(!a)return!1
var l=n.selectedObject,c=l.chartPanel
return c&&c!==this?void 0:(i.pointerPosition=o,i.chartPanel=this,l.handleEvent(i),$(".scxPanelTitle").css("pointer-events","none"),$(".scxNavigation").css("pointer-events","none"),!0)}$(".scxPanelTitle").css("pointer-events","all"),$(".scxNavigation").css("pointer-events","all")
var h=this._drawings
if(!a){for(var u=h.length-1;0<=u;u--)h[u].hideTooltip()
return!1}for(u=h.length-1;0<=u;u--)if(h[u].handleEvent(i))return!0}finally{i.pointerPosition=r}return t.prototype.handleEvent.call(this,i)},i.prototype.minMaxValues=function(e,t,i){for(var r=1/0,n=-1/0,o=0,a=this._plots;o<a.length;o++){var s=a[o]
i&&s.valueScale!==i||(s=s.minMaxValues(e,t),s.min<r&&(r=s.min),s.max>n&&(n=s.max))}return isFinite(r)||(r=-1),isFinite(n)||(n=1),r===n&&(r--,n++),{min:r,max:n}},i.prototype.autoScaledMinMaxValues=function(e){var t=this.chart.dateScale,i=t.firstVisibleIndex
return this.minMaxValues(i,t.lastVisibleIndex-i+1,e)},i.prototype.formatValue=function(e){return this.valueScale.formatValue(e)},i.prototype.hitTest=function(e){return this._contentFrame.containsPoint(e)},i.prototype.saveState=function(){for(var t={options:e.JsUtil.clone(this._options),valueScales:[]},i=0,r=this._valueScales;i<r.length;i++)t.valueScales.push(r[i].saveState())
return t},i.prototype.loadState=function(t){t=t||{}
var i=t.options||{}
this._options={},this.minHeightRatio=void 0!==i.minHeightRatio?i.minHeightRatio:.05,this.maxHeightRatio=i.maxHeightRatio||1,this.heightRatio=i.heightRatio||1,this.xGridVisible=void 0===i.showXGrid||!!i.showXGrid,this.yGridVisible=void 0===i.showYGrid||!!i.showYGrid,this.moveDirection=i.moveDirection||e.PanelMoveDirection.HORIZONTAL,this.moveKind=i.moveKind||e.PanelMoveKind.AUTOSCALED,i=this._valueScales=[],t=t.valueScales||[t.valueScale]
for(var r=0,n=this.chart.valueScales.length;r<n;r++){var o=new e.ChartPanelValueScale({chartPanel:this})
i.push(o),o.loadState(t[r])}},i.prototype.preferredValueScaleWidth=function(e){for(var t=0,i=0,r=this._valueScales;i<r.length;i++){var n=r[i]
n.chartValueScale===e&&(t=Math.max(t,n.preferredWidth()))}return t},i.prototype.layout=function(e){this._layoutHtmlElements(e)
for(var t=0,i=this._valueScales;t<i.length;t++)i[t].layout(e)},i.prototype.draw=function(){var e=this._layer.context,t=this._layer.size.width,i=this._layer.size.height
for(e.save(),e.clearRect(0,0,t,i),e.translate(.5,.5),this.drawGridLines(),t=0,i=this._valueScales;t<i.length;t++)i[t].draw()
for(var i=0,r=this._plots;i<r.length;i++)t=r[i],t.drawValueMarkers()
for(i=0,r=this._drawings;i<r.length;i++)t=r[i],t.drawValueMarkers()
for(t=this._contentFrame,e.beginPath(),e.rect(t.left,0,t.width,t.height),e.clip(),i=0,r=this._plots;i<r.length;i++)t=r[i],t.draw()
for(t=0,i=this.chart.indicators;t<i.length;t++)r=i[t],r.chartPanel===this&&r.draw()
for(i=0,r=this._drawings;i<r.length;i++)t=r[i],this.chart.showDrawings?(t.draw(),t.selected&&t.drawDateMarkers()):t.tooltip.hide()
e.restore(),this.updateHoverRecord()},i.prototype.drawGridLines=function(){var e=this._options
if(e.showXGrid||e.showYGrid){var t=this._contentFrame,i=this._layer.context
if(i.scxApplyStrokeTheme(this.actualTheme.grid),i.beginPath(),e.showXGrid)for(var r=this.chart.dateScale.calibrator.majorTicks,n=0,o=r;n<o.length;n++)r=o[n],i.moveTo(r.x,0),i.lineTo(r.x,t.height)
if(e.showYGrid)for(r=this.valueScale.calibrator.majorTicks,e=0,n=r;e<n.length;e++)r=n[e],i.moveTo(t.left,r.y),i.lineTo(t.left+t.width,r.y)
i.stroke()}},i.prototype.update=function(){this.layout(this.frame),this.draw()},i.prototype.setNeedsUpdate=function(e){e&&this.setNeedsAutoScale(),this._updateAnimation.start()},i.prototype._onUpdateAnimationCallback=function(){this.update()},i.prototype.destroy=function(){this._unSubscribeEvents(),t.prototype.destroy.call(this)},i.prototype._initInstrumentPanelTitle=function(){var t=this,i={chart:this.chart,showOnClick:!0,onItemSelected:function(i){switch(i.data("id")){case e.UI.ChartContextMenu.MenuItem.FORMAT:t.showPriceStyleFormatDialog()}}},r=this._controls.title.scxAppend("div"),n=r.scxAppend("span","scxPanelTitleCaption"),o=r.scxAppend("span","scxPanelTitleValue")
r.scxAppend("span","scxPanelTitleValue").text("O:")
var a=r.scxAppend("span","scxPanelTitleValue")
r.scxAppend("span","scxPanelTitleValue").text("H: ")
var s=r.scxAppend("span","scxPanelTitleValue")
r.scxAppend("span","scxPanelTitleValue").text("L: ")
var l=r.scxAppend("span","scxPanelTitleValue")
r.scxAppend("span","scxPanelTitleValue").text("C: ")
var c=r.scxAppend("span","scxPanelTitleValue")
this._barInfoControls={rootDiv:r,symbol:n,date:o,open:a,high:s,low:l,close:c,series:this.chart.barDataSeries()},this._titleNeedsUpdate=!0,this._updateInstrument(),this.updateHoverRecord(),n.scx().chartContextMenu(i)},i.prototype.showPriceStyleFormatDialog=function(){var t=this
e.UI.ViewLoader.priceStyleSettingsDialog(function(e){e.show({chart:t.chart,priceStyle:t.chart.priceStyle})})},i.prototype.updateHoverRecord=function(t){if(this._barInfoControls){var i=this._barInfoControls.series,r=i.close.length
if(!(0>=r)){null==t&&(t=this.chart.hoveredRecord),(null==t||0>t||t>=r||isNaN(t))&&(t=r-1)
var r=this._barInfoControls,n=i.open.valueAtIndex(t),o=i.close.valueAtIndex(t),a=this.chart.theme,s=a.plot.bar.candle,s=(o>=n?s.upCandle:s.downCandle).fill.fillColor,l=this.chart.dateScale.formatDate(i.date.valueAtIndex(t))
r.date.text(l),r.open.text(this.formatValue(n)).css("color",s),r.high.text(this.formatValue(i.high.valueAtIndex(t))).css("color",s),r.low.text(this.formatValue(i.low.valueAtIndex(t))).css("color",s),r.close.text(this.formatValue(o)).css("color",s),e.Environment.isMobile||e.Environment.isPhone||!this._titleNeedsUpdate||(t=e.DummyCanvasContext.textWidth(l,a.valueScale.text)+15,i=r.date.width(),(i<t||i>1.3*t)&&r.date.width("auto").width(t),this._titleNeedsUpdate=!1)}}},i.prototype._subscribeEvents=function(){var t=this,i=this.chart
i.on(e.ChartEvent.THEME_CHANGED+".scxPanel",function(){t._applyTheme()},this),i.mainPanel===this&&(i.on(e.ChartEvent.HOVER_RECORD_CHANGED+".scxPanel",function(e){t.updateHoverRecord(e.value)},this),i.on(e.ChartEvent.INSTRUMENT_CHANGED+".scxPanel",function(){t._updateWatermark(),t._updateInstrument()},this)),i.on(e.ChartEvent.VALUE_SCALE_ADDED+".scxPanel",function(){t._valueScales.push(new e.ChartPanelValueScale({chartPanel:t}))},this),i.on(e.ChartEvent.VALUE_SCALE_REMOVED+".scxPanel",function(e){t._valueScales.splice(e.value,1)},this),i.on(e.ChartEvent.PRICE_STYLE_CHANGED+".scxPanel",function(e){t._barInfoControls&&(t._barInfoControls.series=t.chart.primaryBarDataSeries())},this)},i.prototype._unSubscribeEvents=function(){var t=this.chart
t&&t.off(e.ChartEvent.THEME_CHANGED+".scxPanel",this).off(e.ChartEvent.HOVER_RECORD_CHANGED+".scxPanel",this).off(e.ChartEvent.VALUE_SCALE_ADDED+".scxPanel",this).off(e.ChartEvent.VALUE_SCALE_REMOVED+".scxPanel",this)},i.prototype._initGestures=function(){return new e.GestureArray([new e.PanGesture({handler:this._handlePanGesture,hitTest:this._panGestureHitTest}),new e.MouseWheelGesture({handler:this._handleMouseWheel,hitTest:this.hitTest}),new e.ClickGesture({handler:this._handleClickGesture,hitTest:this.hitTest}),new e.DoubleClickGesture({handler:this._handleDoubleClickGesture,hitTest:this.hitTest})],this)},i.prototype._panGestureHitTest=function(t){return this.moveDirection!==e.PanelMoveDirection.NONE&&this.hitTest(t)},i.prototype._handlePanGesture=function(t){var i=this.chart
switch(t.state){case e.GestureState.STARTED:i.rootDiv.addClass("scxPanelScroll")
break
case e.GestureState.FINISHED:i.rootDiv.removeClass("scxPanelScroll")
break
case e.GestureState.CONTINUED:t=t.moveOffset
var r,n
switch(this.moveDirection){case e.PanelMoveDirection.HORIZONTAL:i.dateScale.scrollOnPixels(t.x)&&(t=this.moveKind===e.PanelMoveKind.AUTOSCALED,i.setNeedsUpdate(t))
break
case e.PanelMoveDirection.VERTICAL:for(r=0,n=this.valueScales;r<n.length;r++)n[r]._zoomOrScrollWithUpdate(t.y,this.valueScale.scrollOnPixels)
break
case e.PanelMoveDirection.ANY:if(i.dateScale.scrollOnPixels(t.x)||this.moveKind===e.PanelMoveKind.AUTOSCALED){for(r=0,n=this.valueScales;r<n.length;r++)n[r].scrollOnPixels(t.y)
t=this.moveKind===e.PanelMoveKind.AUTOSCALED,i.setNeedsUpdate(t)}else for(r=0,n=this.valueScales;r<n.length;r++)n[r]._zoomOrScrollWithUpdate(t.y,this.valueScale.scrollOnPixels)}}},i.prototype._handleMouseWheel=function(e){this.chart.dateScale._handleZoom(.05*-e.delta*this.frame.width)},i.prototype._handleClickGesture=function(){var e=this.chart,t=e.selectedObject
t&&(e.selectObject(null),this.containsDrawing(t)?this.setNeedsUpdate():e.setNeedsUpdate())},i.prototype._handleDoubleClickGesture=function(){this._fire(e.PanelEvent.DOUBLE_CLICKED,this)},i.prototype._createRootDiv=function(){var t=this.chartPanelsContainer.rootDiv.scxAppend("div","scxChartPanel"),i=this===this.chart.mainPanel
if(i){var r=(this._controls.watermark=t.scxAppend("div","scxWatermark")).scxAppend("div","scxWatermarkContent")
r.scxAppend("div","scxWatermarkSymbol"),r.scxAppend("div","scxWatermarkInfo"),this._updateWatermark()}return this._layer=new e.Layer({parent:t}),this._controls.title=t.scxAppend("div","scxPanelTitle"),i&&this._initInstrumentPanelTitle(),this._applyTheme(),this._subscribeEvents(),t},i.prototype._layoutHtmlElements=function(e){t.prototype.layout.call(this,e)
var i=this._panelsContainer.panelsContentFrame
this._contentFrame.copyFrom(e),this._contentFrame.left=i.left,this._contentFrame.width=i.width,i=this===this.chart.mainPanel,this._layer.size={width:this.rootDiv.width(),height:this.rootDiv.height()},i&&(this._controls.watermark.scxFrame(e),this._barInfoControls.rootDiv.css("display",this.chart.showBarInfoInTitle?"block":"none")),e=this._controls.title,e.scxPosition(this._contentFrame.left,0).outerWidth(this._contentFrame.width),this._layoutOptions(e,i)},i.prototype._layoutOptions=function(e,t){var i=this
if(!t){var r=this._controls
if(!r.options){var n=r.options=e.scxAppend("div","scxPanelOptions")
r.moveUp=n.scxAppend("span",["scxPanelTitleIcon","scxPanelMoveUp"]).attr("title","Move Panel Up").on("click",function(){1<i.getIndex()&&(i._panelsContainer.movePanel(i,1),i.chart.setNeedsUpdate())}),r.moveDown=n.scxAppend("span",["scxPanelTitleIcon","scxPanelMoveDown"]).attr("title","Move Panel Down").on("click",function(){i._panelsContainer.movePanel(i,-1),i.chart.setNeedsUpdate()}),r.close=n.scxAppend("span",["scxPanelTitleIcon","scxPanelClose"]).attr("title","Close Panel").on("click",function(){i._panelsContainer.removePanel(i),i.chart.setNeedsUpdate()})}n=this.getIndex(),r.moveUp.css("display",1<n?"inline-block":"none"),r.moveDown.css("display",n===this._panelsContainer.panels.length-1?"none":"inline-block")}},i.prototype._updateInstrument=function(){if(this._barInfoControls){var e=this.chart.instrument
e&&this._barInfoControls.symbol.text(e.symbol)}},i.prototype._applyTheme=function(){var e=this.titleDiv
if(e){this._titleNeedsUpdate=!0
var t=this._controls.watermark
e.scxTextStyle(this.actualTheme.title),t&&(e=this.chart.theme.chart.instrumentWatermark,t.find(".scxWatermarkSymbol").scxTextStyle(e.symbol),t.find(".scxWatermarkInfo").scxTextStyle(e.details))}},i.prototype._updateWatermark=function(){var e=this._controls.watermark
if(e){var t=this.chart.instrument
if(t){e.find(".scxWatermarkSymbol").text(t.symbol)
var i=t.company
t.exchange&&(i+=" - "+t.exchange),e.find(".scxWatermarkInfo").text(i)}}},i}(e.FrameControl)
e.ChartPanel=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e&&{options:e})}return __extends(i,t),Object.defineProperty(i.prototype,"point",{get:function(){return this._options.point},set:function(e){this._setOption("point",e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"extended",{get:function(){return this._options.extended},set:function(e){this._setOption("extended",e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"theme",{get:function(){return this._options.theme},set:function(e){this._setOption("theme",e)},enumerable:!0,configurable:!0}),i.prototype.loadState=function(i){if(t.prototype.loadState.call(this,i),i&&i.options){var r=i.options
r&&(i=this.suppressEvents(),(r=r.point)&&(this.point=new e.ChartPoint(r)),this.suppressEvents(i))}},i.prototype.draw=function(){if(this.visible){var e=this.point.toPoint(this.projection),t=this.chartPanel.contentFrame,i=this.panelValueScale,r=this.context
r.beginPath(),null!=i.leftFrame&&(r.moveTo(t.left,e.y),r.lineTo(this.extended?t.right:e.x,e.y)),null!=i.rightFrame&&(r.moveTo(this.extended?t.left:e.x,e.y),r.lineTo(t.right,e.y)),r.scxStroke(this.theme)}},i}(e.ChartPanelObject)
e.ValueLine=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(i){var r=this
if(t.call(this),this._projectionFrame=new e.Rect,this.range={},!i)throw Error("Config is not specified.")
if(!(i.chartPanel instanceof e.ChartPanel))throw new TypeError("Config.chartPanel must be an instance of StockChartX.ChartPanel.")
this._panel=i.chartPanel,this._projection=new e.Projection(this.chart.dateScale,this),this.loadState(i),this._updateFormatter(),this._initGestures(),this.chart.on(e.ChartEvent.LOCALE_CHANGED+".scxValueScale",function(){r._updateFormatter()},this)}return __extends(i,t),Object.defineProperty(i.prototype,"chartPanel",{get:function(){return this._panel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chart",{get:function(){return this._panel.chart},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projectionFrame",{get:function(){return this._projectionFrame},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leftFrame",{get:function(){return this._leftFrame},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rightFrame",{get:function(){return this._rightFrame},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"formatter",{get:function(){return this._formatter},set:function(t){if(!t||!e.JsUtil.isFunction(t.format))throw new TypeError("Invalid formatter.")
this._formatter=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minVisibleValue",{get:function(){return this._options.minVisibleValue},set:function(t){if(!e.JsUtil.isFiniteNumberOrNaN(t))throw new TypeError("Value must be a number.")
this._setMinVisibleValue(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxVisibleValue",{get:function(){return this._options.maxVisibleValue},set:function(t){if(!e.JsUtil.isFiniteNumberOrNaN(t))throw new TypeError("Value must be a number.")
this._setMaxVisibleValue(t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minAllowedValue",{get:function(){return this._options.minAllowedValue},set:function(t){if(!e.JsUtil.isNumber(t))throw new TypeError("Value must be a number.")
this._options.minAllowedValue=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxAllowedValue",{get:function(){return this._options.maxAllowedValue},set:function(t){if(!e.JsUtil.isNumber(t))throw new TypeError("Value must be a number.")
this._options.maxAllowedValue=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minAllowedValueRatio",{get:function(){return this._options.minAllowedValueRatio},set:function(t){if(!e.JsUtil.isPositiveNumberOrNaN(t))throw Error("Ratio must be a positive number.")
this._options.minAllowedValueRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxAllowedValueRatio",{get:function(){return this._options.maxAllowedValueRatio},set:function(t){if(!e.JsUtil.isPositiveNumberOrNaN(t))throw Error("Ratio must be a positive number or NaN.")
this._options.maxAllowedValueRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minValueRangeRatio",{get:function(){return this._options.minValueRangeRatio},set:function(t){if(!e.JsUtil.isPositiveNumberOrNaN(t)||1<t)throw Error("Ratio must be in range (0..1]")
this._options.minValueRangeRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"maxValueRangeRatio",{get:function(){return this._options.maxValueRangeRatio},set:function(t){if(!e.JsUtil.isPositiveNumberOrNaN(t)||1>t)throw Error("Ratio must be greater or equal to 1.")
this._options.maxValueRangeRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"theme",{get:function(){return this._options.theme},set:function(e){this._options.theme=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"majorTickMarkLength",{get:function(){return this._options.majorTickMarkLength},set:function(e){this._options.majorTickMarkLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"minorTickMarkLength",{get:function(){return this._options.minorTickMarkLength},set:function(e){this._options.minorTickMarkLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"projection",{get:function(){return this._projection},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"padding",{get:function(){return this._options.padding},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"calibrator",{get:function(){return this._calibrator},set:function(e){this._calibrator=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"actualTheme",{get:function(){return this._options.theme||this.chart.theme.valueScale},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chartValueScale",{get:function(){var e=this._index()
return 0<=e?this.chart.valueScales[e]:null},enumerable:!0,configurable:!0}),i.prototype._initGestures=function(){return new e.GestureArray([new e.DoubleClickGesture({handler:this._handleDoubleClickGesture}),new e.PanGesture({handler:this._handlePanGesture,horizontalMoveEnabled:!1}),new e.MouseWheelGesture({handler:this._handleMouseWheelGesture})],this,this.hitTest)},i.prototype._updateFormatter=function(){var t=this.chart.locale,i=this.formatter
i?i.locale=t:this.formatter=new e.IntlNumberFormat(t,{minimumFractionDigits:3,maximumFractionDigits:3})},i.prototype._setMinVisibleValue=function(e){this._options.minVisibleValue=e},i.prototype._setMaxVisibleValue=function(e){this._options.maxVisibleValue=e},i.prototype._index=function(){for(var e=this._panel.valueScales,t=0;t<e.length;t++)if(e[t]===this)return t
return-1},i.prototype.needsAutoScale=function(){return isNaN(this._options.minVisibleValue)||isNaN(this._options.maxVisibleValue)},i.prototype.setNeedsAutoScale=function(){this.maxVisibleValue=this.minVisibleValue=NaN},i.prototype.autoScale=function(){for(var e=this.chart.dateScale,t=e.firstVisibleIndex,i=e.lastVisibleIndex-t+1,e=1/0,r=-1/0,n=this.chartValueScale,o=0,a=this._panel.plots;o<a.length;o++){var s=a[o]
s.valueScale===n&&(s=s.minMaxValues(t,i),s.min<e&&(e=s.min),s.max>r&&(r=s.max))}isFinite(e)||(e=-1),isFinite(r)||(r=1),e===r&&(e--,r++),(t=this.range)&&(null!=t.min&&e>t.min&&(e=t.min),null!=t.max&&r<t.max&&(r=t.max)),this._setMinVisibleValue(e),this._setMaxVisibleValue(r)},i.prototype.formatValue=function(e){return this.formatter.format(e)},i.prototype.preferredWidth=function(){this.needsAutoScale()&&this.autoScale()
var t=this._options,i=this.actualTheme.text,r=this.formatValue(t.minVisibleValue),n=this.formatValue(t.maxVisibleValue),r=e.DummyCanvasContext.measureText(r,i).width,i=e.DummyCanvasContext.measureText(n,i).width,t=t.padding
return Math.max(r,i)+t.left+t.right},i.prototype.hitTest=function(t){var i=this._leftContentFrame,r=this._rightContentFrame
return i&&e.Geometry.isPointInsideOrNearRect(t,i)||r&&e.Geometry.isPointInsideOrNearRect(t,r)},i.prototype.scrollOnPixels=function(e){if(!isFinite(e))throw Error("Finite number expected.")
return!!e&&(e=this._valueOffset(e),this.scrollOnValue(e))},i.prototype.scrollOnValue=function(e){if(!e)return!1
var t=this.minVisibleValue+e
e=this.maxVisibleValue+e
var i=this.range
return i&&(null!=i.min&&t>i.min&&(t=i.min),null!=i.max&&e<i.max&&(e=i.max)),!!this._canSetVisibleValueRange(t,e)&&(this._setMinVisibleValue(t),this._setMaxVisibleValue(e),!0)},i.prototype.zoomOnPixels=function(e){if(!isFinite(e))throw Error("Finite number expected.")
return!!e&&(e=this._valueOffset(e),this.zoomOnValue(e))},i.prototype.zoomOnValue=function(e){if(!e)return!1
var t=this.minVisibleValue,i=this.maxVisibleValue,r=t-e
e=i+e
var n=this.range
if(!this._canSetVisibleValueRange(r,e))if(this._canSetVisibleValueRange(t,e))r=t
else if(this._canSetVisibleValueRange(r,i))e=i
else if(!n)return!1
return n&&(null!=n.min&&r>n.min&&(r=n.min),null!=n.max&&e<n.max&&(e=n.max)),(r!==t||e!==i)&&.1<=e-r&&(this._setMinVisibleValue(r),this._setMaxVisibleValue(e),!0)},i.prototype._zoomOrScrollWithUpdate=function(e,t){var i=this.chartValueScale.useManualWidth,r=i||this.preferredWidth(),n=t.call(this,e),i=i||this.preferredWidth()
return n&&(r===i?this._panel.setNeedsUpdate():this.chart.setNeedsUpdate()),n},i.prototype.saveState=function(){return{options:e.JsUtil.clone(this._options),formatter:this.formatter.saveState(),calibrator:this.calibrator.saveState()}},i.prototype.loadState=function(t){t=t||{}
var i=t.options||{}
this._options={},this._options.minVisibleValue=null!=i.minVisibleValue?i.minVisibleValue:NaN,this._options.maxVisibleValue=null!=i.maxVisibleValue?i.maxVisibleValue:NaN,this.minAllowedValue=null!=i.minAllowedValue?i.minAllowedValue:NaN,this.maxAllowedValue=null!=i.maxAllowedValue?i.maxAllowedValue:NaN,this.minAllowedValueRatio=i.minAllowedValue||.8,this.maxAllowedValueRatio=i.maxAllowedValueRatio||.8,this.minValueRangeRatio=i.minValueRangeRatio||.1,this.maxValueRangeRatio=i.maxValueRangeRatio||5,this.majorTickMarkLength=i.majorTickMarkLength||3,this.minorTickMarkLength=i.minorTickMarkLength||3,this._options.padding=i.padding||{left:6,top:3,right:3,bottom:3},this.range=i.range||{},t.formatter?this.formatter=e.NumberFormat.deserialize(t.formatter):(this.formatter=new e.IntlNumberFormat,this.formatter.setDecimalDigits(3)),this.calibrator=t.calibrator?e.ValueScaleCalibrator.deserialize(t.calibrator):new e.IntervalValueScaleCalibrator},i.prototype.layout=function(e){this.needsAutoScale()?this.autoScale():.1>this.maxVisibleValue-this.minVisibleValue&&this.autoScale(),e=this._projectionFrame,e.left=0,e.top=0,e.width=this._panel.layer.size.width,e.height=this._panel.layer.size.height,e.applyPadding(this._panel.chartPanelsContainer.panelPadding),this._calibrator.calibrate(this),this._layoutContentFrames()},i.prototype._layoutContentFrames=function(){var t=this._panel,i=this.chartValueScale,r=i.rightPanelVisible,n=this._options.padding
if(i.leftPanelVisible){var o=i.leftPanel,a=parseFloat(o.rootDiv.css("border-left-width")),s=parseFloat(t.rootDiv.css("border-left-width")),l=o.contentSize.width,c=Math.round(Math.max(a-s,0));(o=this._leftFrame)||(o=this._leftFrame=new e.Rect),o.left=c,o.top=0,o.width=l-Math.max(s-a),o.height=t.rootDiv.height(),(a=this._leftContentFrame)||(a=this._leftContentFrame=new e.Rect),a.left=o.left+n.right,a.top=o.top,a.width=o.width-n.left-n.right,a.height=o.height}else this._leftFrame=this._leftContentFrame=null
r?(r=i.rightPanel,a=parseFloat(r.rootDiv.css("border-left-width")),i=r.contentSize.width,a=r.frame.left+a,(r=this._rightFrame)||(r=this._rightFrame=new e.Rect),r.left=a,r.top=0,r.width=i,r.height=t.rootDiv.height(),(t=this._rightContentFrame)||(t=this._rightContentFrame=new e.Rect),t.left=r.left+n.left,t.top=r.top,t.width=r.width-n.left-n.right,t.height=r.height):this._rightFrame=this._rightContentFrame=null},i.prototype.clip=function(){var e=this._leftFrame,t=this._rightFrame
if(!e&&!t)return!1
var i=this._panel.layer.context
return e&&i.rect(e.left,e.top,e.width,e.height),t&&i.rect(t.left,t.top,t.width,t.height),i.clip(),!0},i.prototype.draw=function(){var e=this._panel.layer.context
if(e.save(),this.clip()){var t=this.actualTheme,i=this._leftContentFrame,r=this._rightContentFrame,n=this._leftFrame,o=this._rightFrame,a=n&&n.right-1,s=this.majorTickMarkLength,l=this.minorTickMarkLength
e.scxApplyTextTheme(t.text),e.textBaseline="middle",e.beginPath()
for(var c=0,h=this.calibrator.majorTicks;c<h.length;c++){var u=h[c]
i&&(e.moveTo(a,u.y),e.lineTo(a-s,u.y),e.textAlign="right",e.fillText(u.text,i.right,u.y)),r&&(e.moveTo(o.left,u.y),e.lineTo(o.left+s,u.y),e.textAlign="left",e.fillText(u.text,r.left,u.y))}for(i=0,r=this.calibrator.minorTicks;i<r.length;i++)u=r[i],n&&(e.moveTo(a,u.y),e.lineTo(a-l,u.y)),o&&(e.moveTo(o.left,u.y),e.lineTo(o.left+l,u.y))
e.scxApplyStrokeTheme(t.line),e.stroke()}e.restore()},i.prototype._handleDoubleClickGesture=function(){var e=this.chartValueScale.useManualWidth,t=e||this.preferredWidth()
this.autoScale(),e=e||this.preferredWidth(),t===e?this._panel.setNeedsUpdate():this.chart.setNeedsUpdate()},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:this.chart.rootDiv.addClass("scxValueScaleScroll")
break
case e.GestureState.FINISHED:this.chart.rootDiv.removeClass("scxValueScaleScroll")
break
case e.GestureState.CONTINUED:this._zoomOrScrollWithUpdate(t.moveOffset.y,1===i.evt.which?this.scrollOnPixels:this.zoomOnPixels)}},i.prototype._handleMouseWheelGesture=function(e){this._zoomOrScrollWithUpdate(.05*e.delta*this._panel.frame.height,this.zoomOnPixels)},i.prototype._valueOffset=function(e){return(this.maxVisibleValue-this.minVisibleValue)/this._panel.contentFrame.height*e},i.prototype._canSetVisibleValueRange=function(e,t){var i=t-e
if(.1>i)return!1
var r=this.minAllowedValue
if(!isNaN(r)&&e<r)return!1
if(r=this.maxAllowedValue,!isNaN(r)&&t>r)return!1
var n,r=this._panel.autoScaledMinMaxValues(this.chartValueScale),o=this.minAllowedValueRatio,a=this.maxAllowedValueRatio
return!(!isNaN(o)&&(n=(r.min-e)/i)>o||!isNaN(a)&&(n=(t-r.max)/i)>a)&&(o=this.minValueRangeRatio,n=(r.max-r.min)/i,!(!isNaN(o)&&n<o||(o=this.maxValueRangeRatio,!isNaN(o)&&n>o)))},i}(e.Control)
e.ChartPanelValueScale=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments),this._index=null,this._needsSetTheme=this._isMoving=!1}return __extends(i,t),Object.defineProperty(i.prototype,"topPanel",{get:function(){return this._topPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomPanel",{get:function(){return this._bottomPanel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chart",{get:function(){return this._topPanel&&this._topPanel.chart},enumerable:!0,configurable:!0}),i.getHeight=function(){return 1},i.prototype._initGestures=function(){return new e.GestureArray([new e.MouseHoverGesture({handler:this._handleMouseHoverGesture,hoverEventEnabled:!1}),new e.PanGesture({handler:this._handlePanGesture,horizontalMoveEnabled:!1})],this,this.hitTest)},i.prototype._handlePanGesture=function(t){if(this.chart.state!==e.ChartState.ZOOM_IN)switch(t.state){case e.GestureState.STARTED:this._isMoving=!0,this.chart.state=e.ChartState.RESIZING_PANELS,this._startMove()
break
case e.GestureState.CONTINUED:this.move(t.moveOffset.y)&&this.chart.updateSplitter(this)
break
case e.GestureState.FINISHED:this._isMoving=!1,this.chart.state=e.ChartState.NORMAL}},i.prototype._handleMouseHoverGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:this._startMove()
break
case e.GestureState.FINISHED:this._stopMove(),this.chart.crossHair.setPosition(i.pointerPosition)}},i.prototype._startMove=function(){this.chart.rootDiv.addClass("scxSplitterMove"),this.rootDiv.addClass("scxHover"),this._applyTheme(!0),this.chart.crossHair.hide()},i.prototype._stopMove=function(){this.chart.rootDiv.removeClass("scxSplitterMove"),this.rootDiv.removeClass("scxHover"),this._applyTheme(!1),this.chart.crossHair.show()},i.prototype.setPanels=function(e,t,i){this._index=e,this._topPanel=t,this._bottomPanel=i},i.prototype.invalidateTheme=function(){this._needsSetTheme=!1},i.prototype._applyTheme=function(e){var t=this.chart.theme.splitter
this.rootDiv.css("background-color",e?t.hoverFillColor:t.fillColor),this._needsSetTheme=!0},i.prototype.move=function(e){if(0===e)return!1
var t=this._topPanel,i=this._bottomPanel
e=t.frame.height+e
var r=t.chart.chartPanelsContainer.totalPanelsHeight()
return e/=r,r=i.heightRatio+(t.heightRatio-e),!(e<t.minHeightRatio||e>t.maxHeightRatio||r<i.minHeightRatio||r>i.maxHeightRatio||(t.heightRatio=e,i.heightRatio=r,0))},i.prototype.hitTest=function(e){return!!this._isMoving||t.prototype.hitTest.call(this,e)},i.prototype._createRootDiv=function(){return this.chart.chartPanelsContainer.rootDiv.scxAppend("div","scxPanelSplitter")},i.prototype.layout=function(e){t.prototype.layout.call(this,e),this.frame.top+=this._topPanel.chartPanelsContainer.frame.top,this._needsSetTheme||this._applyTheme(!1)},i}(e.FrameControl)
e.ChartPanelSplitter=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.PlotType={INDICATOR:"indicator",PRICE_STYLE:"priceStyle",USER:"user"},Object.freeze(e.PlotType)
var t
!function(e){e.DATA_SERIES_CHANGED="plotDataSeriesChanged",e.PANEL_CHANGED="plotPanelChanged",e.THEME_CHANGED="plotThemeChanged",e.STYLE_CHANGED="plotStyleChanged",e.SHOW_VALUE_MARKERS_CHANGED="plotShowValueMarkersChanged",e.SHOW_VALUE_LINES_CHANGED="plotShowValueLinesChanged",e.EXTEND_VALUE_LINES_CHANGED="plotExtendValueLinesChanged",e.VISIBLE_CHANGED="plotVisibleChanged",e.VALUE_SCALE_CHANGED="plotValueScaleChanged",e.BASE_VALUE_CHANGED="plotBaseValueChanged"}(t=e.PlotEvent||(e.PlotEvent={}))
var i=function(i){function r(t){i.call(this,t),this._plotThemeKey="",this._dataSeries=[],this._plotType=e.PlotType.USER
var r=this.suppressEvents(!0)
t&&(null!=t.dataSeries&&this.setDataSeries(t.dataSeries),null!=t.chartPanel&&(this.chartPanel=t.chartPanel),null!=t.theme&&(this.theme=t.theme),t.plotType&&(this._plotType=t.plotType),t.options&&(this._options=t.options),t.valueScale&&(this.valueScale=t.valueScale),this.plotStyle=t.plotStyle),t=this._options,null==t.showValueMarkers&&(t.showValueMarkers=!0),null==t.visible&&(t.visible=!0),this.suppressEvents(r)}return __extends(r,i),Object.defineProperty(r.prototype,"dataSeries",{get:function(){return this._dataSeries},set:function(e){this.setDataSeries(e)},enumerable:!0,configurable:!0}),r.prototype.setDataSeries=function(i){if(i instanceof e.DataSeries)i=[i]
else if(!Array.isArray(i))throw new TypeError("Single data series or an array of data series expected.")
var r=this._dataSeries
r!==i&&(this._dataSeries=i,this.fire(t.DATA_SERIES_CHANGED,i,r))},Object.defineProperty(r.prototype,"theme",{get:function(){return this._theme},set:function(e){var i=this._theme
this._theme=e,this.fire(t.THEME_CHANGED,e,i)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"actualTheme",{get:function(){return this._theme?this._theme:this.chart.theme.plot[this._plotThemeKey][this.plotStyle]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"plotStyle",{get:function(){var e=this._options.plotStyle
return e||(e=this.constructor.defaults)&&e.plotStyle},set:function(e){this._setOption("plotStyle",e,t.STYLE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"showValueMarkers",{get:function(){return this._options.showValueMarkers},set:function(e){this._setOption("showValueMarkers",!!e,t.SHOW_VALUE_MARKERS_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"showValueLines",{get:function(){return this._options.showValueLines},set:function(e){this._setOption("showValueLines",!!e,t.SHOW_VALUE_LINES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"extendValueLines",{get:function(){return this._options.extendValueLines},set:function(e){this._setOption("extendValueLines",e,t.EXTEND_VALUE_LINES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"plotType",{get:function(){return this._plotType},enumerable:!0,configurable:!0}),r.prototype._onChartPanelChanged=function(e){this.fire(t.PANEL_CHANGED,this.chartPanel,e)},r.prototype._onValueScaleChanged=function(e){this.fire(t.VALUE_SCALE_CHANGED,this.valueScale,e)},r.prototype._onVisibleChanged=function(e){this.fire(t.VISIBLE_CHANGED,this.visible,e)},r.prototype.findDataSeries=function(e){for(var t=0,i=this._dataSeries;t<i.length;t++){var r=i[t]
if(r.nameSuffix===e)return r}return null},r.prototype.minMaxValues=function(e,t){for(var i=1/0,r=-1/0,n=0,o=this._dataSeries;n<o.length;n++){var a=o[n]
a.isValueDataSeries&&(a=a.minMaxValues(e,t),a.min<i&&(i=a.min),a.max>r&&(r=a.max))}return{min:i,max:r}},r.prototype._valueDrawParams=function(){var t,i
i=this.chart
var r=this._dataSeries[0],n=this.findDataSeries(e.DataSeriesSuffix.DATE),o=this.projection
n?(i=i.dateScale.visibleDateRange,t=n.floorIndex(i.min),i=n.ceilIndex(i.max)):(t=i.firstVisibleIndex,i=i.lastVisibleIndex),t=Math.max(r.leftNearestVisibleValueIndex(t)-1,0),i=Math.min(r.rightNearestVisibleValueIndex(i)+1,r.length-1)
var a=n?0:o.columnByRecord(t)
return{context:this.context,projection:o,dates:n&&n.values,values:r.values,startIndex:t,endIndex:i,startColumn:a,theme:this.actualTheme}},r.prototype._barDrawParams=function(){var t,i
i=this.chart
var r=this._dataSeries,n=this.projection,o=null,a=null,s=null,l=null,c=null
for(t=0;t<r.length;t++){var h=r[t]
switch(h.nameSuffix){case e.DataSeriesSuffix.DATE:o=h
break
case e.DataSeriesSuffix.OPEN:a=h
break
case e.DataSeriesSuffix.HIGH:s=h
break
case e.DataSeriesSuffix.LOW:l=h
break
case e.DataSeriesSuffix.CLOSE:c=h}}return o?(i=i.dateScale.visibleDateRange,t=o.floorIndex(i.min),i=o.ceilIndex(i.max)):(t=i.firstVisibleIndex,i=i.lastVisibleIndex),t=Math.max(r[0].leftNearestVisibleValueIndex(t)-1,0),r=Math.min(r[0].rightNearestVisibleValueIndex(i)+1,r[0].length-1),i=o?0:n.columnByRecord(t),{context:this.context,projection:n,values:this._dataSeries[0].values,dates:o&&o.values,open:a&&a.values,high:s&&s.values,low:l&&l.values,close:c&&c.values,startIndex:t,endIndex:r,startColumn:i,theme:this.actualTheme}},r.prototype.drawValueMarkers=function(){if(this.showValueMarkers){var t,i=this.chart.valueMarker,r=this._dataSeries[0].lastValue,n=i.theme
t=this.actualTheme,t=t.strokeColor&&!1!==t.strokeEnabled?t.strokeColor:t.fill&&!1!==t.fill.fillEnabled?t.fill.fillColor:t.line&&!1!==t.line.strokeEnabled?t.line.strokeColor:n.fill.fillColor,n.fill.fillColor=t,n.text.fillColor=e.HtmlUtil.isDarkColor(t)?"white":"black",i.draw(r,this.panelValueScale),i=this._dataSeries[0].length-1,this.showValueLines&&null!=r&&(r=new e.ValueLine({point:{record:i+.5,value:r},theme:{strokeColor:n.fill.fillColor},extended:this.extendValueLines,visible:this.showValueLines}),r.chartPanel=this.chartPanel,r.valueScale=this.valueScale,r.draw())}},r}(e.ChartPanelObject)
e.Plot=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t
!function(e){e.COLUMN_WIDTH_RATIO_CHANGED="plotColumnWidthRatioChanged",e.MIN_WIDTH_CHANGED="plotMinWidthChanged"}(t=e.PlotEvent||(e.PlotEvent={}))
var i={OHLC:"OHLC",COLORED_OHLC:"coloredOHLC",HLC:"HLC",COLORED_HLC:"coloredHLC",HL:"HL",COLORED_HL:"coloredHL",CANDLE:"candle",HOLLOW_CANDLE:"hollowCandle",HEIKIN_ASHI:"heikinAshi",RENKO:"renko",LINE_BREAK:"lineBreak",POINT_AND_FIGURE:"pointAndFigure",KAGI:"kagi"}
Object.freeze(i)
var r=function(r){function n(e){r.call(this,e),this._plotThemeKey="bar"}return __extends(n,r),Object.defineProperty(n.prototype,"columnWidthRatio",{get:function(){return this._options.columnWidthRatio||n.defaults.columnWidthRatio},set:function(i){if(e.JsUtil.isNegativeNumber(i)||1<i)throw Error("Ratio must be in range [0..1]")
this._setOption("columnWidthRatio",i,t.COLUMN_WIDTH_RATIO_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"minWidth",{get:function(){return this._options.minWidth||n.defaults.minWidth},set:function(i){if(!e.JsUtil.isPositiveNumber(i))throw Error("Min width must be greater than 0.")
this._setOption("minWidth",i,t.MIN_WIDTH_CHANGED)},enumerable:!0,configurable:!0}),n.prototype.draw=function(){if(this.visible)switch(this.plotStyle){case i.OHLC:case i.HLC:case i.HL:this._drawBars()
break
case i.COLORED_OHLC:case i.COLORED_HLC:case i.COLORED_HL:this._drawColoredBars()
break
case i.HOLLOW_CANDLE:this._drawHollowCandles()
break
case i.RENKO:case i.LINE_BREAK:this._drawBricks()
break
case i.KAGI:this._drawKagi()
break
default:this._drawCandles()}},n.prototype.drawValueMarkers=function(){if(this.showValueMarkers){var t=this.chart.valueMarker,r=t.theme,n=this._barDrawParams()
if(0!==n.values.length){var o,a=n.values.length-1
switch(o=n.close[a]>=n.open[a],this.plotStyle){case i.OHLC:case i.HLC:case i.HL:o=n.theme.strokeColor
break
case i.COLORED_OHLC:case i.COLORED_HLC:case i.COLORED_HL:o=n.theme[o?"upBar":"downBar"].strokeColor
break
case i.CANDLE:case i.HOLLOW_CANDLE:case i.HEIKIN_ASHI:case i.RENKO:o=n.theme[o?"upCandle":"downCandle"].fill.fillColor
break
case i.LINE_BREAK:o=o?n.theme.upCandle.border.strokeColor:n.theme.downCandle.fill.fillColor
break
case i.POINT_AND_FIGURE:case i.KAGI:o=n.theme[o?"upCandle":"downCandle"].border.strokeColor
break
default:return}r.fill.fillColor=o,r.text.fillColor=e.HtmlUtil.isDarkColor(o)?"white":"black",n=n.close[a],t.draw(n,this.panelValueScale),this.showValueLines&&null!=n&&(t=new e.ValueLine({point:{record:a+.5,value:n},theme:{strokeColor:r.fill.fillColor},extended:this.extendValueLines,visible:this.showValueLines}),t.chartPanel=this.chartPanel,t.valueScale=this.valueScale,t.draw())}}},n.prototype._drawBars=function(){var e=this._barDrawParams()
if(0!==e.values.length){var t=e.context,i=e.projection,r=e.dates,o=0,a=this.plotStyle,s=a===n.Style.OHLC,a=a===n.Style.HLC;(s||a)&&(o=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth)/2)),t.beginPath()
for(var l=e.startIndex,c=e.startColumn;l<=e.endIndex;l++,c++){var h=e.open[l],u=e.high[l],d=e.low[l],p=e.close[l]
if(null!=h&&null!=u&&null!=d&&null!=p){var f=r?i.xByDate(r[l]):i.xByColumn(c),u=i.yByValue(u),d=i.yByValue(d)
s&&(h=i.yByValue(h),t.moveTo(f,h),t.lineTo(f-o,h)),(s||a)&&(p=i.yByValue(p),t.moveTo(f,p),t.lineTo(f+o,p)),u===d&&d--,t.moveTo(f,u),t.lineTo(f,d)}}t.scxApplyStrokeTheme(e.theme),t.stroke()}},n.prototype._drawColoredBars=function(){var e=this._barDrawParams()
0!==e.values.length&&(this._drawColoredBarItems(e,!0,e.theme.upBar),this._drawColoredBarItems(e,!1,e.theme.downBar))},n.prototype._drawColoredBarItems=function(e,t,i){var r=e.context,o=e.projection,a=this.plotStyle,s=a===n.Style.COLORED_OHLC,a=a===n.Style.COLORED_HLC,l=0;(s||a)&&(l=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth)/2)),r.beginPath()
for(var c=e.startIndex,h=e.startColumn;c<=e.endIndex;c++,h++){var u=e.open[c],d=e.high[c],p=e.low[c],f=e.close[c],m=f>=u
null!=u&&null!=d&&null!=p&&null!=f&&t===m&&(m=e.dates?o.xByDate(e.dates[c]):o.xByColumn(h),d=o.yByValue(d),p=o.yByValue(p),s&&(u=o.yByValue(u),r.moveTo(m,u),r.lineTo(m-l,u)),(s||a)&&(f=o.yByValue(f),r.moveTo(m,f),r.lineTo(m+l,f)),d===p&&p--,r.moveTo(m,d),r.lineTo(m,p))}r.scxApplyStrokeTheme(i),r.stroke()},n.prototype._drawCandles=function(){var e=this._barDrawParams()
if(0!==e.values.length){var t=e.context,i=e.theme.upCandle,r=e.theme.downCandle
this._drawCandleItems(e,!0,!0),t.scxFillStroke(i.fill,i.border),this._drawCandleItems(e,!1,!0),t.scxFillStroke(r.fill,r.border),this._drawCandleItems(e,!0,!1),t.scxStroke(i.wick),this._drawCandleItems(e,!1,!1),t.scxStroke(r.wick)}},n.prototype._drawCandleItems=function(e,t,i){var r=e.context,n=e.projection,o=Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth),a=Math.round(o/2),o=2*a
r.beginPath()
for(var s=e.startIndex,l=e.startColumn;s<=e.endIndex;s++,l++){var c=e.open[s],h=e.high[s],u=e.low[s],d=e.close[s],p=d>=c
null!=c&&null!=h&&null!=u&&null!=d&&t===p&&(p=e.dates?n.xByDate(e.dates[s]):n.xByColumn(l),c=n.yByValue(c),d=n.yByValue(d),i?r.rect(p-a,Math.min(c,d),o,Math.max(Math.abs(c-d),1)):(h=n.yByValue(h),u=n.yByValue(u),r.moveTo(p,Math.min(c,d)),r.lineTo(p,h),r.moveTo(p,Math.max(c,d)),r.lineTo(p,u)))}},n.prototype._drawHollowCandles=function(){var e=this._barDrawParams()
if(0!==e.values.length){var t=e.context,i=e.theme.upCandle,r=e.theme.downCandle,n=e.theme.upHollowCandle,o=e.theme.downHollowCandle
this._drawHollowCandleItems(e,!0,!0,!1),t.scxStroke(n.border),this._drawHollowCandleItems(e,!0,!0,!0),t.scxStroke(n.wick),this._drawHollowCandleItems(e,!0,!1,!1),t.scxFillStroke(i.fill,i.border),this._drawHollowCandleItems(e,!0,!1,!0),t.scxStroke(i.wick),this._drawHollowCandleItems(e,!1,!0,!1),t.scxStroke(o.border),this._drawHollowCandleItems(e,!1,!0,!0),t.scxStroke(o.wick),this._drawHollowCandleItems(e,!1,!1,!1),t.scxFillStroke(r.fill,r.border),this._drawHollowCandleItems(e,!1,!1,!0),t.scxStroke(r.wick)}},n.prototype._drawHollowCandleItems=function(e,t,i,r){for(var n=e.context,o=e.projection,a=null,s=Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth),l=Math.round(s/2),s=2*l,c=e.startIndex-1;0<=c;c--)if(null==e.open[c]&&null==e.high[c]&&null==e.low[c]&&null==e.close[c]){a=e.close[c]
break}n.beginPath()
for(var c=e.startIndex,h=e.startColumn;c<=e.endIndex;c++,h++){var u=e.open[c],d=e.high[c],p=e.low[c],f=e.close[c]
if(null!=u&&null!=d&&null!=p&&null!=f){null==a&&(a=u)
var m=f>=a,v=f>u
a=f,t===m&&i===v&&(m=e.dates?o.xByDate(e.dates[c]):o.xByColumn(h),u=o.yByValue(u),f=o.yByValue(f),r?(d=o.yByValue(d),p=o.yByValue(p),n.moveTo(m,Math.min(u,f)),n.lineTo(m,d),n.moveTo(m,Math.max(u,f)),n.lineTo(m,p)):n.rect(m-l,Math.min(u,f),s,Math.max(Math.abs(u-f),1)))}}},n.prototype._drawBricks=function(){var e=this._barDrawParams()
0!==e.values.length&&(this._drawBrickItems(e,!0),this._drawBrickItems(e,!1))},n.prototype._drawBrickItems=function(e,t){var i=e.context,r=e.projection,n=Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth),o=Math.round(n/2)
i.beginPath()
for(var a=e.startIndex,s=e.startColumn;a<=e.endIndex;a++,s++){var l=e.open[a],c=e.close[a],h=c>=l
n=2*o,null==l||null==c||t&&!h||!t&&h||(h=e.dates?r.xByDate(e.dates[a]):r.xByColumn(s),l=r.yByValue(l),c=r.yByValue(c),i.rect(h-o,Math.min(l,c),n,Math.max(Math.abs(l-c),1)))}r=t?e.theme.upCandle:e.theme.downCandle,i.scxFillStroke(r.fill,r.border)},n.prototype._drawKagi=function(){var e=this._barDrawParams()
0!==e.values.length&&(this._drawKagiItems(e,!0),this._drawKagiItems(e,!1))},n.prototype._drawKagiItems=function(e,t){var i=e.context,r=e.projection,n=null,o=null,a=!1,s=null
i.beginPath()
for(var l=0;l<=e.endIndex;l++){var c=e.open[l],h=e.close[l],u=c,d=h,p=!0
null!=c&&null!=h&&(null===o?(o=h>=c,p=!1):o?h<s&&(a=!0,p=t,u=t?c:s,d=t?s:h):h>s&&(a=!0,p=!t,u=t?s:c,d=t?h:s),s=e.dates?r.xByDate(e.dates[l]):r.xByRecord(l),l>=e.startIndex&&(o===t||a)&&(u=r.yByValue(u),d=r.yByValue(d),p?(i.moveTo(n,u),i.lineTo(s,u)):i.moveTo(s,u),i.lineTo(s,d)),n=s,s=o?a?Math.max(c,h):Math.min(c,h):a?Math.min(c,h):Math.max(c,h),a&&(o=!o,a=!1))}i.scxStroke(e.theme[t?"upCandle":"downCandle"].border)},n.Style=i,n.defaults={plotStyle:i.CANDLE,minWidth:3,columnWidthRatio:.8},n}(e.Plot)
e.BarPlot=r}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t={LINE:"line",COLORED_LINE:"coloredLine",COLUMN:"column",COLORED_COLUMN:"coloredColumn"}
Object.freeze(t)
var i=function(i){function r(e){i.call(this,e),this._plotThemeKey="histogram"}return __extends(r,i),Object.defineProperty(r.prototype,"baseValue",{get:function(){var e=this._options.baseValue
return null!=e?e:r.defaults.baseValue},set:function(t){if(!e.JsUtil.isFiniteNumber(t))throw new TypeError("Value must be a finite number.")
this._setOption("baseValue",t,e.PlotEvent.BASE_VALUE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"columnWidthRatio",{get:function(){return this._options.columnWidthRatio||r.defaults.columnWidthRatio},set:function(t){if(e.JsUtil.isNegativeNumber(t)||1<t)throw Error("Ratio must be in range (0..1]")
this._setOption("columnWidthRatio",t,e.PlotEvent.COLUMN_WIDTH_RATIO_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"minColumnWidth",{get:function(){return this._options.minColumnWidth||r.defaults.minWidth},set:function(t){if(!e.JsUtil.isPositiveNumber(t))throw Error("Min width must be a positive number.")
this._setOption("minColumnWidth",t,e.PlotEvent.MIN_WIDTH_CHANGED)},enumerable:!0,configurable:!0}),r.prototype.draw=function(){if(this.visible)switch(this.plotStyle){case t.COLORED_LINE:this._drawColoredLines()
break
case t.COLUMN:this._drawColumns()
break
case t.COLORED_COLUMN:this._drawColoredColumns()
break
default:this._drawLines()}},r.prototype._drawLines=function(){var e=this._valueDrawParams()
if(0!==e.values.length){var t=e.context,i=e.projection,r=e.dates,n=i.yByValue(this.baseValue),o=null,a=-1/0
t.beginPath()
for(var s=e.startIndex,l=e.startColumn;s<=e.endIndex;s++,l++){var c=e.values[s]
if(null!=c){var h=r?i.xByDate(r[s]):i.xByColumn(l)
h===o?a=Math.max(a,c):(null!==o&&(t.moveTo(o,i.yByValue(a)),t.lineTo(o,n)),a=c,o=h)}}t.moveTo(o,i.yByValue(a)),t.lineTo(o,n),t.scxApplyStrokeTheme(e.theme),t.stroke()}},r.prototype._drawColoredLines=function(){var e=this._barDrawParams()
if(0!==e.values.length){var t=e.context,i=e.projection,r=e.dates,n=i.yByValue(this.baseValue),o=function(o,a){var s=null,l=-1/0
t.beginPath()
for(var c=e.startIndex,h=e.startColumn;c<=e.endIndex;c++,h++){var u=e.values[c]
if(!(null==u||o&&e.close[c]<e.open[c]||!o&&e.close[c]>=e.open[c])){var d=r?i.xByDate(r[c]):i.xByColumn(h)
d===s?l=Math.max(l,u):(null!==s&&(t.moveTo(d,i.yByValue(u)),t.lineTo(d,n)),l=u,s=d)}}t.moveTo(s,i.yByValue(l)),t.lineTo(s,n),t.scxApplyStrokeTheme(a),t.stroke()}
o(!0,e.theme.upBar),o(!1,e.theme.downBar)}},r.prototype._drawColumns=function(){var e=this._barDrawParams()
if(0!==e.values.length){var t,i=e.context,r=e.projection,n=e.dates,o=r.yByValue(this.baseValue),a=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minColumnWidth)/2),s=2*a,l=null,c=-1/0
i.beginPath()
for(var h=e.startIndex,u=e.startColumn;h<=e.endIndex;h++,u++){var d=e.values[h]
if(null!=d){var p=n?r.xByDate(n[h]):r.xByColumn(u)
p===l?c=Math.max(c,d):(null!==l&&(t=r.yByValue(c),i.rect(l-a,Math.min(t,o),s,Math.max(Math.abs(t-o),1))),c=d,l=p)}}t=r.yByValue(c),i.rect(l-a,Math.min(t,o),s,Math.max(Math.abs(t-o),1)),e=e.theme,i.scxFillStroke(e.fill,e.line)}},r.prototype._drawColoredColumns=function(){var e=this._barDrawParams()
if(0!==e.values.length){var t,i=e.context,r=e.projection,n=e.dates,o=r.yByValue(this.baseValue),a=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minColumnWidth)/2),s=2*a,l=function(l,c){var h=null,u=-1/0
i.beginPath()
for(var d=e.startIndex,p=e.startColumn;d<=e.endIndex;d++,p++){var f=e.values[d]
if(!(null==f||l&&e.close[d]<e.open[d]||!l&&e.close[d]>=e.open[d])){var m=n?r.xByDate(n[d]):r.xByColumn(p)
m===h?u=Math.max(u,f):(null!==h&&(t=r.yByValue(u),i.rect(h-a,Math.min(t,o),s,Math.max(Math.abs(t-o),1))),u=f,h=m)}}t=r.yByValue(u),i.rect(h-a,Math.min(t,o),s,Math.max(Math.abs(t-o),1)),i.scxFillStroke(c.fill,c.line)}
l(!0,e.theme.upCandle),l(!1,e.theme.downCandle)}},r.Style=t,r.defaults={plotStyle:t.LINE,baseValue:0,columnWidthRatio:.5,minWidth:3},r}(e.Plot)
e.HistogramPlot=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t={SIMPLE:"simple",MOUNTAIN:"mountain",STEP:"step"}
Object.freeze(t)
var i=function(e){function i(t){e.call(this,t),this._plotThemeKey="line"}return __extends(i,e),i.prototype.draw=function(){if(this.visible)switch(this.plotStyle){case t.MOUNTAIN:this._drawMountainLine()
break
case t.STEP:this._drawStepLine()
break
default:this._drawSimpleLine()}},i.prototype._drawSimpleLine=function(){var e=this._valueDrawParams()
if(0!==e.values.length){var t=e.context,i=e.projection,r=e.dates,n=null,o=null,a=1/0,s=-1/0,l=!0,c=null
t.beginPath()
for(var h=e.startIndex,u=e.startColumn;h<=e.endIndex;h++,u++){var d=e.values[h]
if(null!=d){var p=d!==d
if(!p||!l){var f=r?i.xByDate(r[h]):i.xByColumn(u)
if(l)t.moveTo(f,i.yByValue(d)),l=!1
else if(p&&(l=!0),l||f!=n){if(a!==1/0){var m=i.yByValue(a),v=1.8<Math.abs(c-m)
1e-5>Math.abs(s-a)?v&&t.lineTo(n,m):(p=i.yByValue(s),1.8>Math.abs(p-m)?v&&t.lineTo(n,m):(v&&t.moveTo(n,m),t.lineTo(n,p),1e-5<Math.abs(o-s)&&(m=i.yByValue(o),1.8<Math.abs(m-p)&&t.moveTo(n,m))))}l?(a=1/0,s=o=-1/0,c=null):(c=i.yByValue(d),t.lineTo(f,c),a=s=o=d),n=f}else a=Math.min(a,d),s=Math.max(s,d),o=d}}}a!==1/0&&a!==s&&(t.moveTo(n,i.yByValue(a)),t.lineTo(n,i.yByValue(s))),t.scxApplyStrokeTheme(e.theme.line||e.theme),t.stroke()}},i.prototype._drawMountainLine=function(){var e=this._valueDrawParams()
if(0!==e.values.length){var t=e.context,i=e.projection,r=null,n=null,o=1/0,a=!0,s=this.chartPanel.layer.size.height
t.scxApplyFillTheme(e.theme.fill)
for(var l=e.startIndex,c=e.startColumn;l<=e.endIndex;l++,c++){var h=e.values[l]
if(null!=h){var u=h!==h
if(!u||!a){var d=i.xByColumn(c)
a?(t.beginPath(),t.moveTo(d,i.yByValue(h)),r=n=d,a=!1):(u&&(a=!0),a||d!==n?(o!==1/0&&t.lineTo(n,i.yByValue(o)),a?(o=1/0,t.lineTo(n,s),t.lineTo(r,s),t.closePath(),t.fill(),r=d):(t.lineTo(d,i.yByValue(h)),o=h),n=d):o=Math.min(o,h))}}}o!==1/0&&t.lineTo(n,i.yByValue(o)),t.lineTo(n,s),t.lineTo(r,s),t.closePath(),t.fill(),this._drawSimpleLine()}},i.prototype._drawStepLine=function(){var e=this._valueDrawParams()
if(0!==e.values.length){var t,i=e.context,r=e.projection,n=e.dates,o=null,a=null,s=null,l=1/0,c=-1/0,h=!0
i.beginPath()
for(var u=e.startIndex,d=e.startColumn;u<=e.endIndex;u++,d++){var p=e.values[u]
if(null!=p){var f=p!==p
f&&h||(t=n?r.xByDate(n[u]):r.xByColumn(d),h?(o=t,a=r.yByValue(p),i.moveTo(t,a),l=c=p,h=!1):(f&&(h=!0),h||t!==o?(h?(l=1/0,c=s=-1/0):(i.lineTo(o,a),f=r.yByValue(l),1e-5>Math.abs(c-l)?(i.lineTo(o,f),a=f):(l=r.yByValue(c),1.8>Math.abs(l-f)?(i.lineTo(o,f),a=f):(i.moveTo(o,f),i.lineTo(o,l),a=r.yByValue(s),i.moveTo(o,a))),l=c=s=p),o=t):(l=Math.min(l,p),c=Math.max(c,p),s=p)))}}null!=s&&s!==-1/0&&(i.lineTo(t,a),i.lineTo(t,r.yByValue(s))),i.scxApplyStrokeTheme(e.theme.line||e.theme),i.stroke()}},i.Style=t,i.defaults={plotStyle:t.SIMPLE},i}(e.Plot)
e.LinePlot=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t;(t=e.PlotEvent||(e.PlotEvent={})).POINT_SIZE_CHANGED="plotPointSizeChanged"
var i={DOT:"dot"}
Object.freeze(i)
var r=function(r){function n(e){r.call(this,e),this._plotThemeKey="point"}return __extends(n,r),Object.defineProperty(n.prototype,"pointSize",{get:function(){return this._options.pointSize||n.defaults.pointSize},set:function(i){if(e.JsUtil.isNegativeNumber(i))throw new TypeError("Value must be a positive number.")
this._setOption("pointSize",i,t.POINT_SIZE_CHANGED)},enumerable:!0,configurable:!0}),n.prototype.draw=function(){if(this.visible){var e=this._valueDrawParams()
if(0!==e.values.length){var t,i=e.context,r=e.projection,n=e.dates,o=this.pointSize,a=null,s=[],l=[],c=function(e){for(var t=0,r=l.length;t<r;t++)i.beginPath(),i.arc(e,l[t],o,0,2*Math.PI),i.fill()}
i.scxApplyFillTheme(e.theme.fill?e.theme.fill:e.theme)
for(var h=e.startIndex,u=e.startColumn;h<=e.endIndex;h++,u++){var d=e.values[h]
if(null!=d)if((t=n?r.xByDate(n[h]):r.xByColumn(u))!==a)null!=a&&(c(a),l.length=s.length=0),a=t,s.push(d),l.push(r.yByValue(d))
else if(!(0<=s.indexOf(d))){var p=r.yByValue(d)
0<=l.indexOf(p)||(s.push(d),l.push(p))}}c(t)}}},n.Style=i,n.defaults={plotStyle:n.Style.DOT,pointSize:2},n}(e.Plot)
e.PointPlot=r}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.draw=function(){if(this.visible){var e=this._barDrawParams()
if(0!==e.values.length){var t,i,r,n=this.context,o=this.projection
n.beginPath(),r=this.dataSeries[0].values[e.startIndex],t=o.xByRecord(e.startIndex),i=o.yByValue(r),n.moveTo(t,i)
for(var a=e.startIndex+1;a<=e.endIndex;a++)null!=(r=this.dataSeries[0].values[a])&&(t=o.xByRecord(a),i=o.yByValue(r),n.lineTo(t,i))
for(r=this.dataSeries[1].values[e.endIndex+1],null==r&&(r=this.dataSeries[1].values[this.getLastNotNullValueIndex(this.dataSeries[1])],e.endIndex=this.getLastNotNullValueIndex(this.dataSeries[0])),t=o.xByRecord(e.endIndex),i=o.yByValue(r),n.lineTo(t,i),a=e.endIndex;a>=e.startIndex;a--)null!=(r=this.dataSeries[1].values[a])&&(t=o.xByRecord(a),i=o.yByValue(r),n.lineTo(t,i))
r=this.dataSeries[0].values[e.startIndex],null==r&&(r=this.dataSeries[0].values[this.getFirstNotNullValueIndex(this.dataSeries[0])],e.startIndex=this.getFirstNotNullValueIndex(this.dataSeries[0])),t=o.xByRecord(e.startIndex),i=o.yByValue(r),n.lineTo(t,i),n.scxFill(e.theme)}}},t.prototype.getFirstNotNullValueIndex=function(e){for(var t=0,i=!0;i&&t<e.length;)null==e.values[t]?t++:i=!1
return t},t.prototype.getLastNotNullValueIndex=function(e){for(var t=e.length,i=!0;i&&0<t;)null==e.values[t]?t--:i=!1
return t},t}(e.Plot)
e.KumoPlot=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),Object.defineProperty(t.prototype,"boxSize",{get:function(){return this._boxSize},set:function(e){this._boxSize=e},enumerable:!0,configurable:!0}),t.prototype.draw=function(){if(this.visible){var e=this._barDrawParams()
0!==e.values.length&&(e.context.beginPath(),this._drawColumns(e,!0),e.context.scxStroke(e.theme.upCandle.border),this._drawColumns(e,!1))}},t.prototype._drawColumns=function(e,t){for(var i=e.context,r=e.projection,n=this.boxSize,o=Math.round(Math.max(this.chart.dateScale.columnWidth*this.columnWidthRatio,this.minWidth)/2),a=t?null:e.theme.downCandle.border,s=e.startIndex,l=e.startColumn;s<=e.endIndex;s++,l++){var c=e.open[s],h=e.close[s]
if(null!=c&&null!=h&&t===h>=c)for(var c=e.dates?r.xByDate(e.dates[s]):r.xByColumn(l),h=e.low[s],u=e.high[s];1e-6<u-h;){var d=r.yByValue(h),p=r.yByValue(h+n)
if(t)i.moveTo(c-o,d),i.lineTo(c+o,p),i.moveTo(c-o,p),i.lineTo(c+o,d)
else{var f=o,m=(p-d)/2
i.beginPath(),i.save(),i.translate(c,(d+p)/2),f!==m&&i.scale(1,m/f),i.arc(0,0,f,0,2*Math.PI),i.restore(),i.closePath(),i.scxStroke(a)}h+=n}}},t}(e.BarPlot)
e.PointAndFigurePlot=t}(StockChartX||(StockChartX={})),function(e){var t=jQuery
e.VolumeIndicator=1e3,e.ColoredVolumeIndicator=1001,e.IndicatorParam={SOURCE:"Source",SOURCE2:"Source 2",PERIODS:"Periods",STANDARD_DEVIATIONS:"Standard Deviations",MA_TYPE:"Moving Average Type",SHIFT:"Shift",MIN_TICK:"Min Tick Value",LIMIT_MOVE:"Limit Move Value",PCT_K_PERIODS:"%K Periods",PCT_K_SMOOTHING:"%K Smoothing",PCT_K_DOUBLE_SMOOTHING:"%K Double Smoothing",PCT_D_PERIODS:"%D Periods",PCT_D_MA_TYPE:"%D Moving Average Type",BAR_HISTORY:"Bar History",R2_SCALE:"R2 Scale",CYCLE_1:"Cycle 1",CYCLE_2:"Cycle 2",CYCLE_3:"Cycle 3",SHORT_TERM:"Short Term",LONG_TERM:"Long Term",POINTS_OR_PERCENT:"Points or Percent",RATE_OF_CHANGE:"Rate of Change",SHORT_CYCLE:"Short Cycle",LONG_CYCLE:"Long Cycle",SIGNAL_PERIODS:"Signal Periods",MIN_AF:"Min AF",MAX_AF:"Max AF",LEVELS:"Levels",LINE_WIDTH:"Line Width",LINE_STYLE:"Line Style",LINE_COLOR:"Line Color",LINE2_WIDTH:"Line 2 Width",LINE2_STYLE:"Line 2 Style",LINE2_COLOR:"Line 2 Color",LINE3_WIDTH:"Line 3 Width",LINE3_STYLE:"Line 3 Style",LINE3_COLOR:"Line 3 Color"},Object.freeze(e.IndicatorParam)
var i=function(){function i(e){if(this._isOverlay=!1,this._plotItems=[],this._options={},this._usePrimaryDataSeries=!0,this._collapseIndicatorTitle=!1,!e||"object"!=typeof e)throw new TypeError("Config expected.")
if(this._chart=e.chart,this._options={panelHeightRatio:e.panelHeightRatio,showParamsInTitle:!0,showValueMarkers:!0,showValuesInTitle:!0,showNameInTitle:!0,allowSettingsDialog:!0,visible:!0},this.allowSettingsDialog=void 0===e.allowSettingsDialog||e.allowSettingsDialog,this.showParamsInTitle=void 0===e.showParamsInTitle||e.showParamsInTitle,this.showValueMarkers=void 0===e.showValueMarkers||e.showValueMarkers,this.showValuesInTitle=void 0===e.showValuesInTitle||e.showValuesInTitle,this.showNameInTitle=void 0===e.showNameInTitle||e.showNameInTitle,this.visible=void 0===e.visible||e.visible,this.coloredVolumeTheme=void 0!==e.coloredVolumeTheme?e.coloredVolumeTheme:null,this._options.valueScaleIndex=e.valueScaleIndex,this._chart&&(null!=e.panelIndex&&(this._panel=this._chart.chartPanelsContainer.panels[e.panelIndex]),e.valueScaleIndex&&(this.valueScale=this._chart.valueScales[e.valueScaleIndex])),this._initIndicator(e),e.parameters)for(var t in e.parameters)e.parameters.hasOwnProperty(t)&&this.setParameterValue(t,e.parameters[t])}return Object.defineProperty(i.prototype,"chart",{get:function(){return this._chart},set:function(t){if(t&&!(t instanceof e.Chart))throw new TypeError("Chart must be an instance of StockChartX.Chart.")
this.destroy(),(this._chart=t)&&this._options.valueScaleIndex&&(this.valueScale=this._chart.valueScales[this._options.valueScaleIndex])},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chartPanel",{get:function(){return this._panel},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"valueScale",{get:function(){return this._valueScale},set:function(t){if(t&&!(t instanceof e.ValueScale))throw new TypeError("Value scale must be an instance of StockChartX.ValueScale.")
this._valueScale=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isOverlay",{get:function(){return this._isOverlay},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"panelHeightRatio",{get:function(){return this._options.panelHeightRatio},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"showValueMarkers",{get:function(){return this._options.showValueMarkers},set:function(e){e=!!e,this._options.showValueMarkers!==e&&(this._options.showValueMarkers=e,this.updateTitleControlsVisibility())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"coloredVolumeTheme",{get:function(){return this._options.coloredVolumeTheme},set:function(e){this._options.coloredVolumeTheme=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"showValuesInTitle",{get:function(){return this._options.showValuesInTitle},set:function(e){e=!!e,this._options.showValuesInTitle!==e&&(this._options.showValuesInTitle=e,this.updateTitleControlsVisibility())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"showNameInTitle",{get:function(){return this._options.showNameInTitle},set:function(e){e=!!e,this._options.showNameInTitle!==e&&(this._options.showNameInTitle=e,this.updateTitleControlsVisibility(),this._collapseIndicatorName(this._options.showNameInTitle))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"showParamsInTitle",{get:function(){return this._options.showParamsInTitle},set:function(e){e=!!e,this._options.showParamsInTitle!==e&&(this._options.showParamsInTitle=e,this.updateTitleControlsVisibility())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"allowSettingsDialog",{get:function(){return this._options.allowSettingsDialog},set:function(e){e=!!e,this._options.allowSettingsDialog!==e&&(this._options.allowSettingsDialog=e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parameters",{get:function(){return this._options.parameters},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fieldNames",{get:function(){return this._fieldNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"plots",{get:function(){for(var e=[],t=0,i=this._plotItems;t<i.length;t++)e.push(i[t].plot)
return e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._options.visible},set:function(e){e=!!e,this._options.visible=e
for(var t=0,i=this._plotItems.length;t<i;t++){var r=this._plotItems[t].plot
r&&(r.visible=e)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isInitialized",{get:function(){return 0<this._plotItems.length},enumerable:!0,configurable:!0}),i.prototype.hasParameter=function(e){return void 0!==this._options.parameters[e]},i.prototype.getParameterValue=function(e){return this._options.parameters[e]},i.prototype.setParameterValue=function(e,t){this._options.parameters[e]=t},i.prototype.getName=function(){return""},i.prototype.getShortName=function(){return""},i.prototype.getPlotName=function(e){return""},i.prototype.getPlots=function(){return this._plotItems.map(function(e){return e.plot})},i.prototype.serialize=function(){var e=this._panel
e&&(this._options.panelHeightRatio=e.heightRatio),this.valueScale?this._options.valueScaleIndex=this.valueScale.index:delete this._options.valueScaleIndex
var i=t.extend(!0,{},this._options)
return e&&(i.panelIndex=e.getIndex()),i},i.prototype.calculate=function(){},i.prototype._initPanel=function(){},i.prototype._updatePlotItem=function(e){return!1},i.prototype.clearDataSeries=function(e){},i.prototype.update=function(){var t=this.calculate(),i=this.getShortName(),r=t.parameters?"("+t.parameters+")":"",n=i+r
for(this._panel||(this._isOverlay?this._panel=this._chart.mainPanel:(this._panel=this._chart.addChartPanel(this._chart.chartPanels.length,this.panelHeightRatio,!0),this._initPanel(),this._chart.layout(),this._panel.setNeedsAutoScale())),this._initPanelTitle(),this._titleControls.name.text(i),this._titleControls.parameters.text(r),i=0;i<this._plotItems.length;i++)(r=this._plotItems[i].plot)&&this._panel.removePlot(r)
for(i=0;i<this._fieldNames.length;i++){var r=this._plotItems[i],o=void 0,a=void 0
if(!this._updatePlotItem(i)){var o=this._fieldNames[i],a=this.getPlotName(o),s=t.recordSet&&t.recordSet.getField(o),s=s?e.DataSeries.fromField(s,t.startIndex):new e.DataSeries(o)
r.dataSeries=s,1!==this._fieldNames.length&&a?s.name=n+"."+a:s.name=n,this._chart.dataManager.addDataSeries(s,!0)
var l
switch(o){case e.IndicatorField.INDICATOR_HISTOGRAM:l=this._getHistogramTheme(i),r.plot=new e.HistogramPlot({plotStyle:e.HistogramPlot.Style.COLUMN,dataSeries:s,theme:l}),r.color=l.fill.fillColor
break
default:l=this._getLineTheme(i),r.plot=new e.LinePlot({dataSeries:s,theme:this._getLineTheme(i)}),r.color=l.strokeColor}}r.plot._plotType=e.PlotType.INDICATOR,r.plot.showValueMarkers=this.showValueMarkers,r.plot.visible=this.visible,r.plot.valueScale=this._valueScale,this._panel.addPlot(r.plot),r.titlePlotSpan.css("color",r.color).text(a?a+":":""),r.titleValueSpan.css("color",r.color).attr("title",o!==e.IndicatorField.INDICATOR?o:this.getName())}this.updateHoverRecord()},i.prototype._getHistogramTheme=function(t){switch(t){case 0:t=e.IndicatorParam.LINE_COLOR
break
case 1:t=e.IndicatorParam.LINE2_COLOR
break
case 2:t=e.IndicatorParam.LINE3_COLOR
break
default:return null}return{line:{strokeEnabled:!1},fill:{fillEnabled:!0,fillColor:this.getParameterValue(t)}}},i.prototype._getLineTheme=function(t){var i,r
switch(t){case 0:t=e.IndicatorParam.LINE_COLOR,i=e.IndicatorParam.LINE_WIDTH,r=e.IndicatorParam.LINE_STYLE
break
case 1:t=e.IndicatorParam.LINE2_COLOR,i=e.IndicatorParam.LINE2_WIDTH,r=e.IndicatorParam.LINE2_STYLE
break
case 2:t=e.IndicatorParam.LINE3_COLOR,i=e.IndicatorParam.LINE3_WIDTH,r=e.IndicatorParam.LINE3_STYLE
break
default:return null}return{strokeEnabled:!0,width:this.getParameterValue(i),strokeColor:this.getParameterValue(t),lineStyle:this.getParameterValue(r)}},i.prototype.draw=function(){},i.prototype.destroy=function(){this._titleControls&&(this._unSubscribeEvents(),this._titleControls.rootDiv.remove(),this._titleControls=null)},i.prototype.getInfoAbout=function(){return""},i.prototype.showInfoDialog=function(){var t=this
e.UI.ViewLoader.indicatorInfoDialog(function(e){e.show({chart:t.chart,indicator:t})})},i.prototype.showSettingsDialog=function(){var t=this
e.UI.ViewLoader.indicatorSettingsDialog(function(e){e.show({chart:t.chart,indicator:t,done:function(){t.update(),t._panel.setNeedsUpdate(!0)}})})},i.prototype.updateHoverRecord=function(e){if(this.showValuesInTitle&&this.showNameInTitle){null==e&&(e=this._chart.hoveredRecord)
for(var t=0;t<this._plotItems.length;t++){var i=this._plotItems[t],r=i.dataSeries?i.dataSeries.length:0
0>=r||((null==e||0>e||e>=r)&&(e=r-1),r=i.dataSeries.valueAtIndex(e),r=this._panel.formatValue(r),i.titleValueSpan.text(r))}}},i.prototype._addPlot=function(e,t){this._panel.addPlot(e),this._initPanelTitle()
for(var i=this._plotItems,r=0;r<i.length;r++){var n=i[r]
if(!n.plot)return n.plot=e,n.dataSeries=e.dataSeries[0],n.color=t,this._updatePanelTitle(),n}},i.prototype._initPanelTitle=function(){var t=this
if(!this._titleControls){var i={menuContainer:null,showOnClick:!0,indicator:this,onItemSelected:function(i,r){switch(i.data("id")){case e.UI.IndicatorContextMenu.MenuItem.ABOUT:t.showInfoDialog()
break
case e.UI.IndicatorContextMenu.MenuItem.SETTINGS:t.showSettingsDialog()
break
case e.UI.IndicatorContextMenu.MenuItem.SHOW_PARAMS:t.showParamsInTitle=r,t._panel.setNeedsUpdate()
break
case e.UI.IndicatorContextMenu.MenuItem.SHOW_MARKERS:t.showValueMarkers=r,t._panel.setNeedsUpdate()
break
case e.UI.IndicatorContextMenu.MenuItem.SHOW_VALUES:t.showValuesInTitle=r,t._panel.setNeedsUpdate()
break
case e.UI.IndicatorContextMenu.MenuItem.VISIBLE:t.visible=r,t._panel.setNeedsUpdate()
break
case e.UI.IndicatorContextMenu.MenuItem.DELETE:t._remove()}}},r=this._titleControls={},n=r.rootDiv=this._panel.titleDiv.scxAppend("div")
for(r.name=n.scxAppend("div","scxPanelTitleCaption").text(this.getShortName()),r.name.scx().indicatorContextMenu(i),r.parameters=n.scxAppend("div","scxPanelTitleCaption"),r.parameters.scx().indicatorContextMenu(i),this._collapseIndicatorIcon=n.scxAppend("span",["scxPanelTitleIcon","scxIndicatorCollapseHide"]).attr("title","Show/Hide Indicator`s Title").on("click",function(){t.showNameInTitle=t._collapseIndicatorTitle}),n.scxAppend("span",["scxPanelTitleIcon","scxIndicatorRemoveIcon"]).attr("title","Remove indicator").on("click",function(){t._remove()}),i=0,r=this._fieldNames.length;i<r;i++)this._plotItems.push({titlePlotSpan:n.scxAppend("span","scxPanelTitleValue"),titleValueSpan:n.scxAppend("span","scxPanelTitleValue")})
this.updateTitleControlsVisibility(),this._subscribeEvents()}},i.prototype.getParametersString=function(){return null},i.prototype._updatePanelTitle=function(){this._titleControls.name.text(this.getShortName()),this._titleControls.parameters.text(this.getParametersString())
for(var e=0;e<this._plotItems.length;e++){var t=this._plotItems[e],i=this._fieldNames[e]
t.titlePlotSpan.css("color",t.color).text(i?i+":":""),t.titleValueSpan.css("color",t.color).attr("title",i)}},i.prototype.updateTitleControlsVisibility=function(){var e=this.showValueMarkers,t=this.showValuesInTitle?"inline-block":"none",i=this._titleControls
i&&i.parameters.css("display",this.showParamsInTitle?"inline-block":"none"),i.name.css("display",this.showNameInTitle?"inline-block":"none")
for(var i=0,r=this._plotItems;i<r.length;i++){var n=r[i]
n.plot&&(n.plot.showValueMarkers=e),n.titlePlotSpan.css("display",t),n.titleValueSpan.css("display",t)}},i.prototype._initIndicator=function(e){this._isOverlay=!1,this._options.parameters={}},i.prototype._subscribeEvents=function(){var t=this
this._chart.on(e.ChartEvent.HOVER_RECORD_CHANGED+".scxIndicator",function(e){t.updateHoverRecord(e.value)},this)},i.prototype._unSubscribeEvents=function(){this._chart&&this._chart.off(e.ChartEvent.HOVER_RECORD_CHANGED+".scxIndicator",this)},i.prototype._remove=function(){this._chart.removeIndicators(this),this._chart.setNeedsUpdate(!0)},i.prototype._collapseIndicatorName=function(e){(this._collapseIndicatorTitle=!e)?this._collapseIndicatorIcon.removeClass("scxIndicatorCollapseHide").addClass("scxIndicatorCollapseShow"):this._collapseIndicatorIcon.removeClass("scxIndicatorCollapseShow").addClass("scxIndicatorCollapseHide"),this._panel.setNeedsUpdate()},i.prototype._getMaTypeString=function(e){switch(e){case TASdk.Const.simpleMovingAverage:return"Simple"
case TASdk.Const.exponentialMovingAverage:return"Exponential"
case TASdk.Const.triangularMovingAverage:return"Triangular"
case TASdk.Const.timeSeriesMovingAverage:return"Time Series"
case TASdk.Const.variableMovingAverage:return"Variable"
case TASdk.Const.VIDYA:return"VIDYA"
case TASdk.Const.wellesWilderSmoothing:return"Welles Wilder"
case TASdk.Const.weightedMovingAverage:return"Weighted"
default:return""}},i.deserialize=function(t){return t.isIchimokuIndicator?new e.IchimokuIndicator(t):new e.TAIndicator(t)},i.allIndicators=function(){return this.bands().concat(this.general(),this.indices(),this.regressions(),this.movingAverages(),this.oscillators())},i.bands=function(){return[TASdk.BollingerBands,TASdk.MovingAverageEnvelope,TASdk.HighLowBands,TASdk.FractalChaosBands,TASdk.PrimeNumberBands,TASdk.KeltnerChannel,TASdk.STARC,TASdk.IchimokuCloud]},i.general=function(){return[TASdk.HighMinusLow,TASdk.MedianPrice,TASdk.TypicalPrice,TASdk.WeightedClose,TASdk.VolumeROC,TASdk.PriceROC,TASdk.StandardDeviation,TASdk.HHV,TASdk.LLV,e.ColoredVolumeIndicator,e.VolumeIndicator]},i.indices=function(){return[TASdk.HistoricalVolatility,TASdk.OnBalanceVolume,TASdk.MoneyFlowIndex,TASdk.TradeVolumeIndex,TASdk.SwingIndex,TASdk.AccumulativeSwingIndex,TASdk.ComparativeRelativeStrength,TASdk.PriceVolumeTrend,TASdk.PositiveVolumeIndex,TASdk.NegativeVolumeIndex,TASdk.PerformanceIndex,TASdk.MassIndex,TASdk.ChaikinMoneyFlow,TASdk.CommodityChannelIndex,TASdk.StochasticMomentumIndex,TASdk.ElderForceIndex,TASdk.ElderThermometer,TASdk.MarketFacilitationIndex,TASdk.QStick,TASdk.GopalakrishnanRangeIndex,TASdk.IntradayMomentumIndex,TASdk.RAVI,TASdk.RandomWalkIndex,TASdk.TwiggsMoneyFlow,TASdk.RelativeStrengthIndex]},i.regressions=function(){return[TASdk.LinearRegressionRSquared,TASdk.LinearRegressionForecast,TASdk.LinearRegressionSlope,TASdk.LinearRegressionIntercept,TASdk.TimeSeriesForecast]},i.movingAverages=function(){return[TASdk.ExponentialMovingAverage,TASdk.TimeSeriesMovingAverage,TASdk.VariableMovingAverage,TASdk.TriangularMovingAverage,TASdk.WeightedMovingAverage,TASdk.VIDYA,TASdk.WellesWilderSmoothing,TASdk.SimpleMovingAverage]},i.oscillators=function(){return[TASdk.Aroon,TASdk.MomentumOscillator,TASdk.AverageTrueRange,TASdk.ChandeMomentumOscillator,TASdk.TRIX,TASdk.UltimateOscillator,TASdk.VerticalHorizontalFilter,TASdk.WilliamsPctR,TASdk.WilliamsAccumulationDistribution,TASdk.VolumeOscillator,TASdk.ChaikinVolatility,TASdk.StochasticOscillator,TASdk.PriceOscillator,TASdk.MACDHistogram,TASdk.EaseOfMovement,TASdk.DetrendedPriceOscillator,TASdk.ParabolicSAR,TASdk.DirectionalMovementSystem,TASdk.TrueRange,TASdk.AroonOscillator,TASdk.RainbowOscillator,TASdk.FractalChaosOscillator,TASdk.PrimeNumberOscillator,TASdk.ElderRay,TASdk.EhlerFisherTransform,TASdk.SchaffTrendCycle,TASdk.CenterOfGravity,TASdk.CoppockCurve,TASdk.ChandeForecastOscillator,TASdk.KlingerVolumeOscillator,TASdk.PrettyGoodOscillator,TASdk.MACD]},i}()
e.Indicator=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.IndicatorField={OPEN:"Open",HIGH:"High",LOW:"Low",CLOSE:"Close",VOLUME:"Volume",INDICATOR:"Indicator",INDICATOR_HIGH:"Indicator High",INDICATOR_LOW:"Indicator Low",INDICATOR_SIGNAL:"Indicator Signal",INDICATORSIGNAL:"IndicatorSignal",INDICATOR_HISTOGRAM:"Indicator Histogram",BOLLINGER_BAND_TOP:"Bollinger Band Top",BOLLINGER_BAND_MEDIAN:"Bollinger Band Median",BOLLINGER_BAND_BOTTOM:"Bollinger Band Bottom",ENVELOPE_TOP:"Envelope Top",ENVELOPE_MEDIAN:"Envelope Median",ENVELOPE_BOTTOM:"Envelope Bottom",HIGH_LOW_BANDS_TOP:"High Low Bands Top",HIGH_LOW_BANDS_MEDIAN:"High Low Bands Median",HIGH_LOW_BANDS_BOTTOM:"High Low Bands Bottom",FRACTAL_HIGH:"Fractal High",FRACTAL_LOW:"Fractal Low",PRIME_BANDS_TOP:"Prime Bands Top",PRIME_BANDS_BOTTOM:"Prime Bands Bottom",KELTNER_CHANNEL_TOP:"Keltner Top",KELTNER_CHANNEL_MEDIAN:"Keltner Median",KELTNER_CHANNEL_BOTTOM:"Keltner Bottom",STARC_CHANNEL_TOP:"STARC Top",STARC_CHANNEL_MEDIAN:"STARC Median",STARC_CHANNEL_BOTTOM:"STARC Bottom",PCT_D:"%D",PCT_K:"%K",RSQUARED:"RSquared",FORECAST:"Forecast",SLOPE:"Slope",INTERCEPT:"Intercept",SIGNAL:"Signal",HISTOGRAM:"Histogram",ADX:"ADX",DI_PLUS:"DI+",DI_MINUS:"DI-",AROON_UP:"Aroon Up",AROON_DOWN:"Aroon Down",AROON_OSCILLATOR:"Aroon Oscillator",BULL_POWER:"Indicator Bull Power",BEAR_POWER:"Indicator Bear Power",TRIGGER:"Indicator Trigger"},Object.freeze(e.IndicatorField),e.IndicatorParamValue={POINT:1,PERCENT:2},Object.freeze(e.IndicatorParamValue)
var t=function(t){function i(e){t.call(this,e),this._options.taIndicator=null!=e.taIndicator?e.taIndicator:TASdk.Unknown}return __extends(i,t),Object.defineProperty(i.prototype,"taIndicator",{get:function(){return this._options.taIndicator},enumerable:!0,configurable:!0}),i.prototype.getName=function(){return TASdk.indicatorToString(this.taIndicator)},i.prototype.getShortName=function(){switch(this.taIndicator){case TASdk.SimpleMovingAverage:return"SMA"
case TASdk.ExponentialMovingAverage:return"EMA"
case TASdk.TimeSeriesMovingAverage:return"TSMA"
case TASdk.TriangularMovingAverage:return"TMA"
case TASdk.VariableMovingAverage:return"VMA"
case TASdk.VIDYA:return"VIDYA"
case TASdk.WellesWilderSmoothing:return"Welles Wilder Smoothing"
case TASdk.WeightedMovingAverage:return"WMA"
case TASdk.WilliamsPctR:return"Williams %R"
case TASdk.WilliamsAccumulationDistribution:return"Williams Accumulation Distribution"
case TASdk.VolumeOscillator:return"Volume Oscillator"
case TASdk.VerticalHorizontalFilter:return"Vertical Horizontal Filter"
case TASdk.UltimateOscillator:return"Ultimate Oscillator"
case TASdk.TrueRange:return"True Range"
case TASdk.AverageTrueRange:return"ATR"
case TASdk.TRIX:return"TRIX"
case TASdk.RainbowOscillator:return"Rainbow Oscillator"
case TASdk.PriceOscillator:return"Price Oscillator"
case TASdk.ParabolicSAR:return"PSAR"
case TASdk.MomentumOscillator:return"Momentum Oscillator"
case TASdk.MACD:return"MACD"
case TASdk.EaseOfMovement:return"Ease of Movement"
case TASdk.DirectionalMovementSystem:return"Directional Movement System"
case TASdk.DetrendedPriceOscillator:return"Detrended Price Oscillator"
case TASdk.ChandeMomentumOscillator:return"Chande Momentum Oscillator"
case TASdk.ChaikinVolatility:return"Chaikin Volatility"
case TASdk.Aroon:return"Aroon"
case TASdk.AroonOscillator:return"Aroon Oscillator"
case TASdk.LinearRegressionRSquared:return"Linear Regression R2"
case TASdk.LinearRegressionForecast:return"Linear Regression Forecast"
case TASdk.LinearRegressionSlope:return"Linear Regression Slope"
case TASdk.LinearRegressionIntercept:return"Linear Regression Intercept"
case TASdk.PriceVolumeTrend:return"Price Volume Trend"
case TASdk.PerformanceIndex:return"Performance Index"
case TASdk.CommodityChannelIndex:return"Commodity Channel Index"
case TASdk.ChaikinMoneyFlow:return"Chaikin Money Flow"
case TASdk.WeightedClose:return"Weighted Close"
case TASdk.VolumeROC:return"Volume ROC"
case TASdk.TypicalPrice:return"Typical Price"
case TASdk.StandardDeviation:return"Standard Deviation"
case TASdk.PriceROC:return"Price ROC"
case TASdk.MedianPrice:return"Median Price"
case TASdk.HighMinusLow:return"High Minus Low"
case TASdk.BollingerBands:return"Bollinger"
case TASdk.FractalChaosBands:return"Fractal Chaos Bands"
case TASdk.HighLowBands:return"High Low Bands"
case TASdk.MovingAverageEnvelope:return"MA Env"
case TASdk.SwingIndex:return"Swing Index"
case TASdk.AccumulativeSwingIndex:return"Accumulative Swing Index"
case TASdk.ComparativeRelativeStrength:return"Comparative Relative Strength"
case TASdk.MassIndex:return"Mass Index"
case TASdk.MoneyFlowIndex:return"Money Flow Index"
case TASdk.NegativeVolumeIndex:return"Negative Volume Index"
case TASdk.OnBalanceVolume:return"On Balance Volume"
case TASdk.PositiveVolumeIndex:return"Positive Volume Index"
case TASdk.RelativeStrengthIndex:return"RSI"
case TASdk.TradeVolumeIndex:return"Trade Volume Index"
case TASdk.StochasticOscillator:return"Stochastic Oscillator"
case TASdk.StochasticMomentumIndex:return"Stochastic Momentum Index"
case TASdk.FractalChaosOscillator:return"Fractal Chaos Oscillator"
case TASdk.PrimeNumberOscillator:return"Prime Number Oscillator"
case TASdk.PrimeNumberBands:return"Prime Number Bands"
case TASdk.HistoricalVolatility:return"Historical Volatility"
case TASdk.MACDHistogram:return"MACD Histogram"
case TASdk.HHV:return"Highest High Value"
case TASdk.LLV:return"Lowest Low Value"
case TASdk.TimeSeriesForecast:return"TSF"
case TASdk.ElderRay:return"Elder Ray"
case TASdk.ElderForceIndex:return"Elder Force Index"
case TASdk.ElderThermometer:return"Elder Thermometer"
case TASdk.EhlerFisherTransform:return"Ehler Fisher Transform"
case TASdk.KeltnerChannel:return"Keltner Channel"
case TASdk.MarketFacilitationIndex:return"Market Facilitation Index"
case TASdk.SchaffTrendCycle:return"Schaff Trend Cycle"
case TASdk.QStick:return"QStick"
case TASdk.STARC:return"STARC"
case TASdk.CenterOfGravity:return"Center Of Gravity"
case TASdk.CoppockCurve:return"Coppock Curve"
case TASdk.ChandeForecastOscillator:return"Chande Forecast Oscillator"
case TASdk.GopalakrishnanRangeIndex:return"Gopalakrishnan Range Index"
case TASdk.IntradayMomentumIndex:return"Intraday Momentum Index"
case TASdk.KlingerVolumeOscillator:return"Klinger Volume Oscillator"
case TASdk.PrettyGoodOscillator:return"Pretty Good Oscillator"
case TASdk.RAVI:return"RAVI"
case TASdk.RandomWalkIndex:return"Random Walk Index"
case TASdk.TwiggsMoneyFlow:return"Twiggs Money Flow"
case e.VolumeIndicator:return"Volume"
case e.ColoredVolumeIndicator:return"Colored Volume"
default:return""}},i.prototype.getPlotName=function(t){switch(t){case e.IndicatorField.INDICATOR_HIGH:case e.IndicatorField.FRACTAL_HIGH:return"High"
case e.IndicatorField.INDICATOR_LOW:case e.IndicatorField.FRACTAL_LOW:return"Low"
case e.IndicatorField.INDICATOR_SIGNAL:case e.IndicatorField.INDICATORSIGNAL:return"Signal"
case e.IndicatorField.INDICATOR_HISTOGRAM:return"Histogram"
case e.IndicatorField.BOLLINGER_BAND_TOP:case e.IndicatorField.ENVELOPE_TOP:case e.IndicatorField.HIGH_LOW_BANDS_TOP:case e.IndicatorField.PRIME_BANDS_TOP:case e.IndicatorField.KELTNER_CHANNEL_TOP:case e.IndicatorField.STARC_CHANNEL_TOP:return"Top"
case e.IndicatorField.BOLLINGER_BAND_MEDIAN:case e.IndicatorField.ENVELOPE_MEDIAN:case e.IndicatorField.HIGH_LOW_BANDS_MEDIAN:case e.IndicatorField.KELTNER_CHANNEL_MEDIAN:case e.IndicatorField.STARC_CHANNEL_MEDIAN:return"Median"
case e.IndicatorField.BOLLINGER_BAND_BOTTOM:case e.IndicatorField.ENVELOPE_BOTTOM:case e.IndicatorField.HIGH_LOW_BANDS_BOTTOM:case e.IndicatorField.PRIME_BANDS_BOTTOM:case e.IndicatorField.KELTNER_CHANNEL_BOTTOM:case e.IndicatorField.STARC_CHANNEL_BOTTOM:return"Bottom"
case e.IndicatorField.PCT_D:case e.IndicatorField.PCT_K:case e.IndicatorField.ADX:case e.IndicatorField.DI_PLUS:case e.IndicatorField.DI_MINUS:return t
case e.IndicatorField.AROON_UP:return"Up"
case e.IndicatorField.AROON_DOWN:return"Down"
case e.IndicatorField.BULL_POWER:return"Bull Power"
case e.IndicatorField.BEAR_POWER:return"Bear Power"
case e.IndicatorField.TRIGGER:return"Trigger"
case e.IndicatorField.VOLUME:return"Volume"
default:return""}},i.prototype._initIndicator=function(i){t.prototype._initIndicator.call(this,i)
var r=this._options.parameters,n=e.DataSeriesSuffix,o=e.IndicatorParam,a=e.IndicatorField
switch(this._options.taIndicator=null!=i.taIndicator?i.taIndicator:TASdk.Unknown,this.taIndicator){case TASdk.BollingerBands:this._isOverlay=!0,this._fieldNames=[a.BOLLINGER_BAND_TOP,a.BOLLINGER_BAND_MEDIAN,a.BOLLINGER_BAND_BOTTOM],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14,r[o.STANDARD_DEVIATIONS]=2,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.MovingAverageEnvelope:this._isOverlay=!0,this._fieldNames=[a.ENVELOPE_TOP,a.ENVELOPE_MEDIAN,a.ENVELOPE_BOTTOM],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14,r[o.SHIFT]=5,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.HighLowBands:this._isOverlay=!0,this._fieldNames=[a.HIGH_LOW_BANDS_TOP,a.HIGH_LOW_BANDS_MEDIAN,a.HIGH_LOW_BANDS_BOTTOM],r[o.PERIODS]=14
break
case TASdk.FractalChaosBands:this._isOverlay=!0,this._fieldNames=[a.FRACTAL_HIGH,a.FRACTAL_LOW],r[o.PERIODS]=14
break
case TASdk.PrimeNumberBands:this._isOverlay=!0,this._fieldNames=[a.PRIME_BANDS_TOP,a.PRIME_BANDS_BOTTOM]
break
case TASdk.KeltnerChannel:this._isOverlay=!0,this._fieldNames=[a.KELTNER_CHANNEL_TOP,a.KELTNER_CHANNEL_MEDIAN,a.KELTNER_CHANNEL_BOTTOM],r[o.PERIODS]=14,r[o.SHIFT]=5,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.STARC:this._isOverlay=!0,this._fieldNames=[a.STARC_CHANNEL_TOP,a.STARC_CHANNEL_MEDIAN,a.STARC_CHANNEL_BOTTOM],r[o.PERIODS]=14,r[o.SHIFT]=5,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.HighMinusLow:this._fieldNames=[a.INDICATOR]
break
case TASdk.MedianPrice:case TASdk.TypicalPrice:case TASdk.WeightedClose:this._isOverlay=!0,this._fieldNames=[a.INDICATOR]
break
case TASdk.VolumeROC:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.VOLUME,r[o.PERIODS]=14
break
case TASdk.PriceROC:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.StandardDeviation:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14,r[o.STANDARD_DEVIATIONS]=2,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.HHV:case TASdk.LLV:this._isOverlay=!0,this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14
break
case TASdk.MoneyFlowIndex:this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14
break
case TASdk.TradeVolumeIndex:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.MIN_TICK]=.5
break
case TASdk.SwingIndex:case TASdk.AccumulativeSwingIndex:this._fieldNames=[a.INDICATOR],r[o.LIMIT_MOVE]=.5
break
case TASdk.RelativeStrengthIndex:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.ComparativeRelativeStrength:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.SOURCE2]=n.OPEN
break
case TASdk.PriceVolumeTrend:case TASdk.PositiveVolumeIndex:case TASdk.NegativeVolumeIndex:case TASdk.PerformanceIndex:case TASdk.OnBalanceVolume:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE
break
case TASdk.MassIndex:case TASdk.ChaikinMoneyFlow:case TASdk.CommodityChannelIndex:this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14
break
case TASdk.StochasticMomentumIndex:this._fieldNames=[a.PCT_D,a.PCT_K],r[o.PCT_K_PERIODS]=13,r[o.PCT_K_SMOOTHING]=25,r[o.PCT_K_DOUBLE_SMOOTHING]=2,r[o.PCT_D_PERIODS]=9,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage,r[o.PCT_D_MA_TYPE]=TASdk.Const.VIDYA
break
case TASdk.HistoricalVolatility:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14,r[o.BAR_HISTORY]=10,r[o.STANDARD_DEVIATIONS]=2
break
case TASdk.ElderForceIndex:this._fieldNames=[a.INDICATOR,a.INDICATOR_SIGNAL]
break
case TASdk.ElderThermometer:case TASdk.MarketFacilitationIndex:this._fieldNames=[a.INDICATOR]
break
case TASdk.QStick:this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.GopalakrishnanRangeIndex:this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14
break
case TASdk.IntradayMomentumIndex:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.RAVI:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.SHORT_CYCLE]=9,r[o.LONG_CYCLE]=14
break
case TASdk.RandomWalkIndex:this._fieldNames=[a.INDICATOR_HIGH,a.INDICATOR_LOW],r[o.PERIODS]=14
break
case TASdk.TwiggsMoneyFlow:this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14
break
case TASdk.LinearRegressionRSquared:this._fieldNames=[a.RSQUARED],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.LinearRegressionForecast:this._isOverlay=!0,this._fieldNames=[a.FORECAST],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.LinearRegressionSlope:this._fieldNames=[a.SLOPE],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.LinearRegressionIntercept:this._isOverlay=!0,this._fieldNames=[a.INTERCEPT],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.TimeSeriesForecast:this._isOverlay=!0,this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.SimpleMovingAverage:case TASdk.ExponentialMovingAverage:case TASdk.TimeSeriesMovingAverage:case TASdk.VariableMovingAverage:case TASdk.TriangularMovingAverage:case TASdk.WeightedMovingAverage:case TASdk.WellesWilderSmoothing:this._isOverlay=!0,this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.VIDYA:this._isOverlay=!0,this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14,r[o.R2_SCALE]=.65
break
case TASdk.MomentumOscillator:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.ChandeMomentumOscillator:case TASdk.TRIX:case TASdk.VerticalHorizontalFilter:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.UltimateOscillator:this._fieldNames=[a.INDICATOR],r[o.CYCLE_1]=3,r[o.CYCLE_2]=8,r[o.CYCLE_3]=14
break
case TASdk.AverageTrueRange:case TASdk.FractalChaosOscillator:case TASdk.PrettyGoodOscillator:case TASdk.WilliamsPctR:this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14
break
case TASdk.WilliamsAccumulationDistribution:this._fieldNames=[a.INDICATOR]
break
case TASdk.VolumeOscillator:this._fieldNames=[a.INDICATOR],r[o.SHORT_TERM]=8,r[o.LONG_TERM]=14,r[o.POINTS_OR_PERCENT]=e.IndicatorParamValue.PERCENT
break
case TASdk.ChaikinVolatility:this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14,r[o.RATE_OF_CHANGE]=2,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.StochasticOscillator:this._fieldNames=[a.PCT_K,a.PCT_D],r[o.PCT_K_PERIODS]=13,r[o.PCT_K_SMOOTHING]=25,r[o.PCT_D_PERIODS]=9,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.PriceOscillator:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.SHORT_CYCLE]=3,r[o.LONG_CYCLE]=8,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.MACD:this._fieldNames=[a.INDICATOR,a.INDICATORSIGNAL,a.INDICATOR_HISTOGRAM],r[o.SOURCE]=n.CLOSE,r[o.SIGNAL_PERIODS]=3,r[o.LONG_CYCLE]=25,r[o.SHORT_CYCLE]=13,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.MACDHistogram:this._fieldNames=[a.INDICATOR_HISTOGRAM],r[o.SOURCE]=n.CLOSE,r[o.SIGNAL_PERIODS]=3,r[o.LONG_CYCLE]=25,r[o.SHORT_CYCLE]=13,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.EaseOfMovement:this._fieldNames=[a.INDICATOR],r[o.PERIODS]=14,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.DetrendedPriceOscillator:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.ParabolicSAR:this._isOverlay=!0,this._fieldNames=[a.INDICATOR],r[o.MIN_AF]=.02,r[o.MAX_AF]=3
break
case TASdk.DirectionalMovementSystem:this._fieldNames=[a.ADX,a.DI_PLUS,a.DI_MINUS],r[o.PERIODS]=14
break
case TASdk.TrueRange:this._fieldNames=[a.INDICATOR]
break
case TASdk.Aroon:this._fieldNames=[a.AROON_UP,a.AROON_DOWN],r[o.PERIODS]=14
break
case TASdk.AroonOscillator:this._fieldNames=[a.AROON_OSCILLATOR],r[o.PERIODS]=14
break
case TASdk.RainbowOscillator:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.LEVELS]=3,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.PrimeNumberOscillator:this._fieldNames=[a.INDICATOR]
break
case TASdk.ElderRay:this._fieldNames=[a.BULL_POWER,a.BEAR_POWER],r[o.PERIODS]=14,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.EhlerFisherTransform:this._fieldNames=[a.INDICATOR,a.TRIGGER],r[o.PERIODS]=14
break
case TASdk.SchaffTrendCycle:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14,r[o.SHORT_CYCLE]=13,r[o.LONG_CYCLE]=25,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case TASdk.CenterOfGravity:case TASdk.ChandeForecastOscillator:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE,r[o.PERIODS]=14
break
case TASdk.CoppockCurve:this._fieldNames=[a.INDICATOR],r[o.SOURCE]=n.CLOSE
break
case TASdk.KlingerVolumeOscillator:this._fieldNames=[a.INDICATOR,a.INDICATORSIGNAL],r[o.PERIODS]=13,r[o.LONG_CYCLE]=55,r[o.SHORT_CYCLE]=34,r[o.MA_TYPE]=TASdk.Const.simpleMovingAverage
break
case e.VolumeIndicator:case e.ColoredVolumeIndicator:this._fieldNames=[a.VOLUME]
break
default:throw Error("Unknown indicator: "+this.taIndicator)}switch(this._fieldNames.length){case 1:r[o.LINE_COLOR]=this.taIndicator===e.VolumeIndicator?"#0000FF":"#FFFFFF"
break
case 2:r[o.LINE_COLOR]="#FF0000",r[o.LINE2_COLOR]="#32CD32"
break
case 3:r[o.LINE_COLOR]="#FF0000",r[o.LINE2_COLOR]="#FFFFFF",r[o.LINE3_COLOR]="#32CD32"}0<this._fieldNames.length&&(r[o.LINE_WIDTH]=1,r[o.LINE_STYLE]=e.LineStyle.SOLID),1<this._fieldNames.length&&(r[o.LINE2_WIDTH]=1,r[o.LINE2_STYLE]=e.LineStyle.SOLID),2<this._fieldNames.length&&(r[o.LINE3_WIDTH]=1,r[o.LINE3_STYLE]=e.LineStyle.SOLID)},i.prototype._initPanel=function(){if(this.taIndicator===e.VolumeIndicator||this.taIndicator===e.ColoredVolumeIndicator){var t=this._panel.valueScale.formatter
t instanceof e.IntlNumberFormat&&t.setDecimalDigits(0)}},i.prototype.calculate=function(){var t,i,r=this.getParameterValue(e.IndicatorParam.SOURCE),n=this._createField(r),o=this.getParameterValue(e.IndicatorParam.PERIODS),a=e.IndicatorField.INDICATOR,s=this.getParameterValue(e.IndicatorParam.MA_TYPE),r=o+1,l=TASdk.Bands.prototype,c=TASdk.General.prototype,h=TASdk.LinearRegression.prototype,u=TASdk.Oscillator.prototype,d=TASdk.Index.prototype
switch(this.taIndicator){case TASdk.BollingerBands:u=this.getParameterValue(e.IndicatorParam.STANDARD_DEVIATIONS),t=[n.name,o,u,this._getMaTypeString(s)],i=l.bollingerBands(n,o,u,s)
break
case TASdk.MovingAverageEnvelope:a=this.getParameterValue(e.IndicatorParam.SHIFT),t=[n.name,o,a,this._getMaTypeString(s)],i=l.movingAverageEnvelope(n,o,s,a)
break
case TASdk.HighLowBands:t=[o],i=l.highLowBands(this._createHighField(),this._createLowField(),this._createCloseField(),o)
break
case TASdk.FractalChaosBands:t=[o],i=l.fractalChaosBands(this._createRecordset(),o)
break
case TASdk.PrimeNumberBands:r=1,i=l.primeNumberBands(this._createHighField(),this._createLowField())
break
case TASdk.KeltnerChannel:a=this.getParameterValue(e.IndicatorParam.SHIFT),t=[o,a,this._getMaTypeString(s)],i=l.keltner(this._createRecordset(),o,a,s,"Keltner")
break
case TASdk.STARC:a=this.getParameterValue(e.IndicatorParam.SHIFT),t=[o,a,this._getMaTypeString(s)],i=l.keltner(this._createRecordset(),o,a,s,"STARC")
break
case TASdk.HighMinusLow:r=1,i=c.highMinusLow(this._createRecordset(),a)
break
case TASdk.MedianPrice:r=1,i=c.medianPrice(this._createRecordset(),a)
break
case TASdk.TypicalPrice:r=1,i=c.typicalPrice(this._createRecordset(),a)
break
case TASdk.WeightedClose:r=1,i=c.weightedClose(this._createRecordset(),a)
break
case TASdk.VolumeROC:t=[n.name,o],i=c.volumeROC(n,o,a)
break
case TASdk.PriceROC:t=[n.name,o],i=c.priceROC(n,o,a)
break
case TASdk.StandardDeviation:u=this.getParameterValue(e.IndicatorParam.STANDARD_DEVIATIONS),t=[n.name,o,u,this._getMaTypeString(s)],i=c.standardDeviation(n,o,u,s,a)
break
case TASdk.HHV:t=[o],i=c.HHV(this._createHighField(),o,a)
break
case TASdk.LLV:t=[o],i=c.LLV(this._createLowField(),o,a)
break
case TASdk.MoneyFlowIndex:t=[o],i=d.moneyFlowIndex(this._createRecordset(),o,a)
break
case TASdk.TradeVolumeIndex:u=this.getParameterValue(e.IndicatorParam.MIN_TICK),r=1,t=[n.name,u],i=d.tradeVolumeIndex(n,this._createVolumeField(),u,a)
break
case TASdk.SwingIndex:u=this.getParameterValue(e.IndicatorParam.LIMIT_MOVE),r=1,t=[u],i=d.swingIndex(this._createRecordset(),u,a)
break
case TASdk.AccumulativeSwingIndex:u=this.getParameterValue(e.IndicatorParam.LIMIT_MOVE),r=1,t=[u],i=d.accumulativeSwingIndex(this._createRecordset(),u,a)
break
case TASdk.RelativeStrengthIndex:r=o+2,t=[n.name,o],i=d.relativeStrengthIndex(n,o,a)
break
case TASdk.ComparativeRelativeStrength:u=this._createField(this.getParameterValue(e.IndicatorParam.SOURCE2)),r=1,t=[n.name,u.name],i=d.comparativeRelativeStrength(n,u,a)
break
case TASdk.PriceVolumeTrend:r=1,t=[n.name],i=d.priceVolumeTrend(n,this._createVolumeField(),a)
break
case TASdk.PositiveVolumeIndex:r=1,t=[n.name],i=d.positiveVolumeIndex(n,this._createVolumeField(),a)
break
case TASdk.NegativeVolumeIndex:r=1,t=[n.name],i=d.negativeVolumeIndex(n,this._createVolumeField(),a)
break
case TASdk.PerformanceIndex:r=1,t=[n.name],i=d.performance(n,a)
break
case TASdk.OnBalanceVolume:r=1,t=[n.name],i=d.onBalanceVolume(n,this._createVolumeField(),a)
break
case TASdk.MassIndex:r=Math.floor(3*o),t=[o],i=d.massIndex(this._createRecordset(),o,a)
break
case TASdk.ChaikinMoneyFlow:t=[o],i=d.chaikinMoneyFlow(this._createRecordset(),o,a)
break
case TASdk.CommodityChannelIndex:r=Math.floor(2*o),t=[o],i=d.commodityChannelIndex(this._createRecordset(),o,a)
break
case TASdk.StochasticMomentumIndex:a=this.getParameterValue(e.IndicatorParam.PCT_K_PERIODS),u=this.getParameterValue(e.IndicatorParam.PCT_K_SMOOTHING),o=this.getParameterValue(e.IndicatorParam.PCT_K_DOUBLE_SMOOTHING),n=this.getParameterValue(e.IndicatorParam.PCT_D_PERIODS),i=this.getParameterValue(e.IndicatorParam.PCT_D_MA_TYPE),r=a+u+n,t=[a,u,o,n,this._getMaTypeString(s),this._getMaTypeString(i)],i=d.stochasticMomentumIndex(this._createRecordset(),a,u,o,n,s,i)
break
case TASdk.HistoricalVolatility:s=this.getParameterValue(e.IndicatorParam.BAR_HISTORY),u=this.getParameterValue(e.IndicatorParam.STANDARD_DEVIATIONS),t=[n.name,o,s,u],i=d.historicalVolatility(n,o,s,u,a)
break
case TASdk.ElderForceIndex:r=7,i=d.elderForceIndex(this._createRecordset(),a),a=TASdk.MovingAverage.prototype.exponentialMovingAverage(i.getField(a),2,a+" Signal").getField(a+" Signal"),i.addField(a)
break
case TASdk.ElderThermometer:r=2,i=d.elderThermometer(this._createRecordset(),a)
break
case TASdk.MarketFacilitationIndex:r=2,i=d.marketFacilitationIndex(this._createRecordset(),a)
break
case TASdk.QStick:t=[o,this._getMaTypeString(s)],i=d.qStick(this._createRecordset(),o,s,a)
break
case TASdk.GopalakrishnanRangeIndex:t=[o],i=d.gopalakrishnanRangeIndex(this._createRecordset(),o,a)
break
case TASdk.IntradayMomentumIndex:r=3,i=d.intradayMomentumIndex(this._createRecordset(),a)
break
case TASdk.RAVI:l=this.getParameterValue(e.IndicatorParam.SHORT_CYCLE),c=this.getParameterValue(e.IndicatorParam.LONG_CYCLE),r=c+2,t=[n.name,l,c],i=d.RAVI(n,l,c,a)
break
case TASdk.RandomWalkIndex:r=2*o,t=[o],i=d.randomWalkIndex(this._createRecordset(),o,a)
break
case TASdk.TwiggsMoneyFlow:t=[o],i=d.twiggsMoneyFlow(this._createRecordset(),o,a)
break
case TASdk.LinearRegressionRSquared:case TASdk.LinearRegressionForecast:case TASdk.LinearRegressionSlope:case TASdk.LinearRegressionIntercept:t=[n.name,o],i=h.regression(n,o)
break
case TASdk.TimeSeriesForecast:t=[n.name,o],i=h.timeSeriesForecast(n,o,a)
break
case TASdk.SimpleMovingAverage:t=[n.name,o],i=TASdk.MovingAverage.prototype.simpleMovingAverage(n,o,a)
break
case TASdk.ExponentialMovingAverage:t=[n.name,o],i=TASdk.MovingAverage.prototype.exponentialMovingAverage(n,o,a)
break
case TASdk.TimeSeriesMovingAverage:t=[n.name,o],i=TASdk.MovingAverage.prototype.timeSeriesMovingAverage(n,o,a)
break
case TASdk.VariableMovingAverage:r=Math.floor(2*o),t=[n.name,o],i=TASdk.MovingAverage.prototype.variableMovingAverage(n,o,a)
break
case TASdk.TriangularMovingAverage:r=Math.floor(2*o),t=[n.name,o],i=TASdk.MovingAverage.prototype.triangularMovingAverage(n,o,a)
break
case TASdk.WeightedMovingAverage:t=[n.name,o],i=TASdk.MovingAverage.prototype.weightedMovingAverage(n,o,a)
break
case TASdk.VIDYA:u=this.getParameterValue(e.IndicatorParam.R2_SCALE),r=2,t=[n.name,o,u],i=TASdk.MovingAverage.prototype.VIDYA(n,o,u,a)
break
case TASdk.WellesWilderSmoothing:r=Math.floor(2*o),t=[n.name,o],i=TASdk.MovingAverage.prototype.wellesWilderSmoothing(n,o,a)
break
case TASdk.ChandeMomentumOscillator:t=[n.name,o],i=u.chandeMomentumOscillator(n,o,a)
break
case TASdk.MomentumOscillator:r=o+2,t=[n.name,o],i=u.momentum(n,o,a)
break
case TASdk.TRIX:r=Math.floor(2*o),t=[n.name,o],i=u.TRIX(n,o,a)
break
case TASdk.UltimateOscillator:s=this.getParameterValue(e.IndicatorParam.CYCLE_1),d=this.getParameterValue(e.IndicatorParam.CYCLE_2),n=this.getParameterValue(e.IndicatorParam.CYCLE_3),r=Math.max(s,d,n)+1,t=[s,d,n],i=u.ultimateOscillator(this._createRecordset(),s,d,n,a)
break
case TASdk.VerticalHorizontalFilter:t=[n.name,o],i=u.verticalHorizontalFilter(n,o,a)
break
case TASdk.WilliamsPctR:r=Math.floor(2*o),t=[o],i=u.williamsPctR(this._createRecordset(),o,a)
break
case TASdk.WilliamsAccumulationDistribution:r=1,i=u.williamsAccumulationDistribution(this._createRecordset(),a)
break
case TASdk.VolumeOscillator:s=this.getParameterValue(e.IndicatorParam.SHORT_TERM),d=this.getParameterValue(e.IndicatorParam.LONG_TERM),n=this.getParameterValue(e.IndicatorParam.POINTS_OR_PERCENT),r=Math.max(s,d)+1,t=[s,d],i=u.volumeOscillator(this._createVolumeField(),s,d,n,a)
break
case TASdk.ChaikinVolatility:d=this.getParameterValue(e.IndicatorParam.RATE_OF_CHANGE),r=Math.floor(1.5*o),t=[o,d,this._getMaTypeString(s)],i=u.chaikinVolatility(this._createRecordset(),o,d,s,a)
break
case TASdk.StochasticOscillator:d=this.getParameterValue(e.IndicatorParam.PCT_K_SMOOTHING),a=this.getParameterValue(e.IndicatorParam.PCT_K_PERIODS),n=this.getParameterValue(e.IndicatorParam.PCT_D_PERIODS),r=Math.max(a,n,d)+1,t=[a,d,n,this._getMaTypeString(s)],i=u.stochasticOscillator(this._createRecordset(),a,d,n,s)
break
case TASdk.PriceOscillator:c=this.getParameterValue(e.IndicatorParam.LONG_CYCLE),l=this.getParameterValue(e.IndicatorParam.SHORT_CYCLE),r=Math.max(c,l)+1,t=[n.name,c,l,this._getMaTypeString(s)],i=u.priceOscillator(n,c,l,s,a)
break
case TASdk.MACD:d=this.getParameterValue(e.IndicatorParam.SIGNAL_PERIODS),c=this.getParameterValue(e.IndicatorParam.LONG_CYCLE),l=this.getParameterValue(e.IndicatorParam.SHORT_CYCLE),r=Math.trunc(2.25*Math.max(c,l)),t=[n.name,d,l,c,this._getMaTypeString(s)],i=u.MACD(n,d,c,l,s,a),a=u.macdHistogram(n,d,c,l,s,a+" Histogram").getField(a+" Histogram"),i.addField(a)
break
case TASdk.MACDHistogram:d=this.getParameterValue(e.IndicatorParam.SIGNAL_PERIODS),c=this.getParameterValue(e.IndicatorParam.LONG_CYCLE),l=this.getParameterValue(e.IndicatorParam.SHORT_CYCLE),r=Math.trunc(2.25*Math.max(c,l)),t=[n.name,d,l,c,this._getMaTypeString(s)],i=u.macdHistogram(n,d,c,l,s,a+" Histogram")
break
case TASdk.EaseOfMovement:t=[o,this._getMaTypeString(s)],i=u.easeOfMovement(this._createRecordset(),o,s,a)
break
case TASdk.DetrendedPriceOscillator:r=2*o,t=[n.name,o,this._getMaTypeString(s)],i=u.detrendedPriceOscillator(n,o,s,a)
break
case TASdk.ParabolicSAR:s=this.getParameterValue(e.IndicatorParam.MIN_AF),d=this.getParameterValue(e.IndicatorParam.MAX_AF),r=2,t=[s,d],i=u.parabolicSAR(this._createHighField(),this._createLowField(),s,d,a)
break
case TASdk.DirectionalMovementSystem:t=[o],i=u.directionalMovementSystem(this._createRecordset(),o)
break
case TASdk.TrueRange:r=2,i=u.trueRange(this._createRecordset(),a)
break
case TASdk.AverageTrueRange:t=[o],i=u.trueRange(this._createRecordset(),a),u=i.getField(a),i=TASdk.MovingAverage.prototype.simpleMovingAverage(u,o,a)
break
case TASdk.Aroon:case TASdk.AroonOscillator:t=[o],i=u.aroon(this._createRecordset(),o)
break
case TASdk.RainbowOscillator:d=this.getParameterValue(e.IndicatorParam.LEVELS),r=d+1,t=[n.name,d,this._getMaTypeString(s)],i=u.rainbowOscillator(n,d,s,a)
break
case TASdk.FractalChaosOscillator:t=[o],i=u.fractalChaosOscillator(this._createRecordset(),o,a)
break
case TASdk.PrimeNumberOscillator:r=1,i=u.primeNumberOscillator(this._createCloseField(),a)
break
case TASdk.ElderRay:t=[o,this._getMaTypeString(s)],i=u.elderRay(this._createRecordset(),o,s,a)
break
case TASdk.EhlerFisherTransform:r=o+2,t=[o],i=u.ehlerFisherTransform(this._createRecordset(),o,a)
break
case TASdk.SchaffTrendCycle:l=this.getParameterValue(e.IndicatorParam.SHORT_CYCLE),c=this.getParameterValue(e.IndicatorParam.LONG_CYCLE),t=[n.name,o,l,c,this._getMaTypeString(s)],i=u.schaffTrendCycle(n,o,l,c,s,a)
break
case TASdk.CenterOfGravity:t=[n.name,o],i=u.centerOfGravity(n,o,a)
break
case TASdk.CoppockCurve:r=12,t=[n.name],i=u.coppockCurve(n,a)
break
case TASdk.ChandeForecastOscillator:t=[n.name,o],i=u.chandeForecastOscillator(n,o,a)
break
case TASdk.KlingerVolumeOscillator:c=this.getParameterValue(e.IndicatorParam.LONG_CYCLE),l=this.getParameterValue(e.IndicatorParam.SHORT_CYCLE),r=Math.max(o,l)+1,t=[o,l,c,this._getMaTypeString(s)],i=u.klingerVolumeOscillator(this._createRecordset(),o,c,l,s,a)
break
case TASdk.PrettyGoodOscillator:t=[o],i=u.prettyGoodOscillator(this._createRecordset(),o,a)
break
case e.VolumeIndicator:case e.ColoredVolumeIndicator:break
default:throw Error("Unsupported indicator: "+this.taIndicator)}return{parameters:t?t.join(", "):"",recordSet:i,startIndex:r}},i.prototype._createField=function(t,i){if(!t)return null
if(void 0===i)switch(t){case e.DataSeriesSuffix.OPEN:i=e.IndicatorField.OPEN
break
case e.DataSeriesSuffix.HIGH:i=e.IndicatorField.HIGH
break
case e.DataSeriesSuffix.LOW:i=e.IndicatorField.LOW
break
case e.DataSeriesSuffix.CLOSE:i=e.IndicatorField.CLOSE
break
case e.DataSeriesSuffix.VOLUME:i=e.IndicatorField.VOLUME}var r=this._usePrimaryDataSeries?this._chart.primaryDataSeries(t):this._chart.getDataSeries(t)
return r?r.toField(i):null},i.prototype._createOpenField=function(){return this._createField(e.DataSeriesSuffix.OPEN,e.IndicatorField.OPEN)},i.prototype._createHighField=function(){return this._createField(e.DataSeriesSuffix.HIGH,e.IndicatorField.HIGH)},i.prototype._createLowField=function(){return this._createField(e.DataSeriesSuffix.LOW,e.IndicatorField.LOW)},i.prototype._createCloseField=function(){return this._createField(e.DataSeriesSuffix.CLOSE,e.IndicatorField.CLOSE)},i.prototype._createVolumeField=function(){return this._createField(e.DataSeriesSuffix.VOLUME,e.IndicatorField.VOLUME)},i.prototype._createRecordset=function(){var e=new TASdk.Recordset
return e.addField(this._createOpenField()),e.addField(this._createHighField()),e.addField(this._createLowField()),e.addField(this._createCloseField()),e},i.prototype._updatePlotItem=function(t){return this.taIndicator===e.VolumeIndicator?(this._updateVolumeIndicator(this._plotItems[t]),!0):this.taIndicator===e.ColoredVolumeIndicator&&(this._updateColoredVolumeIndicator(this._plotItems[t]),!0)},i.prototype._updateVolumeIndicator=function(t){var i=this._getLineTheme(0)
t.dataSeries=this._usePrimaryDataSeries?this._chart.primaryDataSeries(e.DataSeriesSuffix.VOLUME):this._chart.getDataSeries(e.DataSeriesSuffix.VOLUME),t.plot=new e.HistogramPlot({dataSeries:t.dataSeries,theme:i,plotStyle:e.HistogramPlot.Style.LINE}),t.color=e.HtmlUtil.isDarkColor(this._chart.theme.plot.line.simple.strokeColor)?"rgb(51, 51, 51)":"white"},i.prototype._updateColoredVolumeIndicator=function(t){var i=null!=this.coloredVolumeTheme?this.coloredVolumeTheme:e.JsUtil.clone(this.chart.theme.plot.bar.candle)
if(!this.coloredVolumeTheme){var r=e.HtmlUtil.toRgba(i.upCandle.fill.fillColor),n=e.HtmlUtil.toRgba(i.downCandle.fill.fillColor)
r.a=.4,n.a=.4,i.upCandle.fill.fillColor=e.HtmlUtil.toRgbString(r),i.downCandle.fill.fillColor=e.HtmlUtil.toRgbString(n)}this.coloredVolumeTheme=i,r=this._usePrimaryDataSeries?this._chart.primaryDataSeries(e.DataSeriesSuffix.OPEN):this._chart.getDataSeries(e.DataSeriesSuffix.OPEN),n=this._usePrimaryDataSeries?this._chart.primaryDataSeries(e.DataSeriesSuffix.CLOSE):this._chart.getDataSeries(e.DataSeriesSuffix.CLOSE),t.dataSeries=this._usePrimaryDataSeries?this._chart.primaryDataSeries(e.DataSeriesSuffix.VOLUME):this._chart.getDataSeries(e.DataSeriesSuffix.VOLUME),t.plot=new e.HistogramPlot({dataSeries:[t.dataSeries,r,n],theme:i,plotStyle:e.HistogramPlot.Style.COLORED_COLUMN}),t.color=e.HtmlUtil.isDarkColor(this._chart.theme.plot.line.simple.strokeColor)?"rgba(51, 51, 51, 0.3)":"white"},i}(e.Indicator)
e.TAIndicator=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,{taIndicator:TASdk.IchimokuCloud}),this._parameters="(params)",this._conversionLinePeriods=9,this._baseLinePeriods=26,this._loggingSpan2Periods=52,this._displacement=26,this._kumoPlotItem=this._senkouSpanBPlotItem=this._senkouSpanAPlotItem=this._chikouSpanPlotItem=this._kijunSenPlotItem=this._tenkanSenPlotItem=this._senkouSpanBDataseries=this._senkouSpanADataseries=this._chikouSpanDataseries=this._kijunSenDataseries=this._tenkanSenDataseries=null,this._lines=[],this._tenkanSenLine={visible:!0,priceLine:!1,theme:{strokeColor:"rgb(4, 150, 255)",width:1,lineStyle:"solid"}},this._kijunSenLine={visible:!0,priceLine:!1,theme:{strokeColor:"rgb(153, 21, 21)",width:1,lineStyle:"solid"}},this._chikouSpanLine={visible:!0,priceLine:!1,theme:{strokeColor:"rgb(69, 153, 21)",width:1,lineStyle:"solid"}},this._senkouSpanALine={visible:!0,priceLine:!1,theme:{strokeColor:"rgb(0, 128, 0)",width:1,lineStyle:"solid"}},this._senkouSpanBLine={visible:!0,priceLine:!1,theme:{strokeColor:"rgb(255, 0, 0)",width:1,lineStyle:"solid"}},this._kumo={visible:!0,theme:{fillColor:"rgba(0, 127, 255, 0.5)"}},e&&(this._conversionLinePeriods=e.conversionLinePeriods||9,this._baseLinePeriods=e.baseLinePeriods||26,this._loggingSpan2Periods=e.loggingSpan2Periods||52,this._displacement=e.displacement||26,this._tenkanSenLine=e.tenkanSenLine||this._tenkanSenLine,this._kijunSenLine=e.kijunSenLine||this._kijunSenLine,this._chikouSpanLine=e.chikouSpanLine||this._chikouSpanLine,this._senkouSpanALine=e.senkouSpanALine||this._senkouSpanALine,this._senkouSpanBLine=e.senkouSpanBLine||this._senkouSpanBLine,this._kumo=e.kumo||this._kumo),this._lines.push(this._tenkanSenLine),this._lines.push(this._kijunSenLine),this._lines.push(this._chikouSpanLine),this._lines.push(this._senkouSpanALine),this._lines.push(this._senkouSpanBLine),this._lines.push(this._kumo)}return __extends(i,t),Object.defineProperty(i.prototype,"lines",{get:function(){return this._lines},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"conversionLinePeriods",{get:function(){return this._conversionLinePeriods},set:function(e){this._conversionLinePeriods=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"baseLinePeriods",{get:function(){return this._baseLinePeriods},set:function(e){this._baseLinePeriods=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"loggingSpan2Periods",{get:function(){return this._loggingSpan2Periods},set:function(e){this._loggingSpan2Periods=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displacement",{get:function(){return this._displacement},set:function(e){this._displacement=e},enumerable:!0,configurable:!0}),i.prototype.getName=function(){return"Ichimoku Kinko Hyo"},i.prototype.getShortName=function(){return"Ichimoku Kinko Hyo"},i.prototype.getParametersString=function(){return this._parameters},i.prototype.serialize=function(){var e=t.prototype.serialize.call(this)
return e.isIchimokuIndicator=!0,$.extend(!0,{conversionLinePeriods:this._conversionLinePeriods,baseLinePeriods:this._baseLinePeriods,loggingSpan2Periods:this._loggingSpan2Periods,displacement:this._displacement,tenkanSenLine:this._tenkanSenLine,kijunSenLine:this._kijunSenLine,chikouSpanLine:this._chikouSpanLine,senkouSpanALine:this._senkouSpanALine,senkouSpanBLine:this._senkouSpanBLine,kumo:this._kumo},e)},i.prototype._initIndicator=function(){this._options.parameters={},this._isOverlay=!0,this._fieldNames="Tenkan Sen;Kijun Sen;Chikou Span;Senkou Span A;Senkou Span B;Kumo".split(";")},i.prototype.calculate=function(){var e=TASdk.Bands.prototype,t=[this._conversionLinePeriods,this._baseLinePeriods,this._loggingSpan2Periods,this._displacement]
return{parameters:t?t.join(", "):"",recordSet:e.ichimoku(this._createRecordset(),this._conversionLinePeriods,this._baseLinePeriods,this._loggingSpan2Periods),startIndex:1}},i.prototype.fixFirstNotNullIncorrectValue=function(e){if(!e)return e
for(var t=0,i=!0;i&&t<e.length;)null!=e.values[t]&&(e.values[t]=null,i=!1),t++
return e},i.prototype.getDataserieFromRecordSet=function(t,i,r){return t=t&&t.getField(i),this.fixFirstNotNullIncorrectValue(t?e.DataSeries.fromField(t,r):new e.DataSeries(i))},i.prototype.shiftInToThePast=function(t,i){if(t.values.length<=i)return t
for(var r=0;r<i;r++)t.add(null)
var r=new e.DataSeries(t.name),n=t.values
return n.splice(0,i),r.add(n),r},i.prototype.shiftInToTheFuture=function(t,i){for(var r=new e.DataSeries(t.name),n=0;n<=t.length+i;n++)n<i?r.add(null):r.add(t.values[n-i])
return r},i.prototype.hidePlotItem=function(e){e.plot.visible=!1,e.titlePlotSpan.hide(),e.titleValueSpan.hide()},i.prototype.showPlotItem=function(e){e.plot.visible=!0,e.titlePlotSpan.show(),e.titleValueSpan.show()},i.prototype.update=function(){if(!this.isInitialized){this.showValuesInTitle=!0,this._tenkanSenDataseries=new e.DataSeries(this.getName()+" Ichimoku Tenkan Sen"),this._kijunSenDataseries=new e.DataSeries(this.getName()+" Ichimoku Kijun Sen"),this._chikouSpanDataseries=new e.DataSeries(this.getName()+" Ichimoku Chikou Span"),this._senkouSpanADataseries=new e.DataSeries(this.getName()+" Ichimoku Senkou Span A"),this._senkouSpanBDataseries=new e.DataSeries(this.getName()+" Ichimoku Senkou Span B"),this._panel||(this._panel=this._chart.mainPanel,this._initPanelTitle())
var t=new e.LinePlot({dataSeries:this._tenkanSenDataseries,theme:this._lines[0].theme}),i=new e.LinePlot({dataSeries:this._kijunSenDataseries,theme:this._lines[1].theme}),r=new e.LinePlot({dataSeries:this._chikouSpanDataseries,theme:this._lines[2].theme}),n=new e.LinePlot({dataSeries:this._senkouSpanADataseries,theme:this._lines[3].theme}),o=new e.LinePlot({dataSeries:this._senkouSpanBDataseries,theme:this._lines[4].theme}),a=new e.KumoPlot({dataSeries:[this._senkouSpanADataseries,this._senkouSpanBDataseries],theme:this._lines[5].theme})
this._tenkanSenPlotItem=this._addPlot(t,this._tenkanSenLine.theme.strokeColor),this._kijunSenPlotItem=this._addPlot(i,this._kijunSenLine.theme.strokeColor),this._chikouSpanPlotItem=this._addPlot(r,this._chikouSpanLine.theme.strokeColor),this._senkouSpanAPlotItem=this._addPlot(n,this._senkouSpanALine.theme.strokeColor),this._senkouSpanBPlotItem=this._addPlot(o,this._senkouSpanBLine.theme.strokeColor),this._kumoPlotItem=this._addPlot(a,"transparent")}this._tenkanSenDataseries.clear(),this._kijunSenDataseries.clear(),this._chikouSpanDataseries.clear(),this._senkouSpanADataseries.clear(),this._senkouSpanBDataseries.clear(),this._tenkanSenPlotItem.color=this._tenkanSenLine.theme.strokeColor,this._kijunSenPlotItem.color=this._kijunSenLine.theme.strokeColor,this._chikouSpanPlotItem.color=this._chikouSpanLine.theme.strokeColor,this._senkouSpanAPlotItem.color=this._senkouSpanALine.theme.strokeColor,this._senkouSpanBPlotItem.color=this._senkouSpanBLine.theme.strokeColor,this.visible&&(this._tenkanSenLine.visible?this.showPlotItem(this._tenkanSenPlotItem):this.hidePlotItem(this._tenkanSenPlotItem),this._kijunSenLine.visible?this.showPlotItem(this._kijunSenPlotItem):this.hidePlotItem(this._kijunSenPlotItem),this._chikouSpanLine.visible?this.showPlotItem(this._chikouSpanPlotItem):this.hidePlotItem(this._chikouSpanPlotItem),this._senkouSpanALine.visible?this.showPlotItem(this._senkouSpanAPlotItem):this.hidePlotItem(this._senkouSpanAPlotItem),this._senkouSpanBLine.visible?this.showPlotItem(this._senkouSpanBPlotItem):this.hidePlotItem(this._senkouSpanBPlotItem),this._kumo.visible?this.showPlotItem(this._kumoPlotItem):this.hidePlotItem(this._kumoPlotItem)),t=this.calculate(),this._parameters=t.parameters?"("+t.parameters+")":"",this._tenkanSenDataseries.add(this.getDataserieFromRecordSet(t.recordSet,"Ichimoku Tenkan Sen",t.startIndex).values),this._kijunSenDataseries.add(this.getDataserieFromRecordSet(t.recordSet,"Ichimoku Kijun Sen",t.startIndex).values),this._chikouSpanDataseries.add(this.shiftInToThePast(this.getDataserieFromRecordSet(t.recordSet,"Ichimoku Chikou Span",t.startIndex),this._displacement).values),this._senkouSpanADataseries.add(this.shiftInToTheFuture(this.getDataserieFromRecordSet(t.recordSet,"Ichimoku Senkou Span A",t.startIndex),this._displacement).values),this._senkouSpanBDataseries.add(this.shiftInToTheFuture(this.getDataserieFromRecordSet(t.recordSet,"Ichimoku Senkou Span B",t.startIndex),this._displacement).values),this._updatePanelTitle(),this.updateHoverRecord(),this._panel.update()},i.prototype.showSettingsDialog=function(){var t=this
e.UI.ViewLoader.ichimokuIndicatorSettingsDialog(function(e){e.show({chart:t.chart,ichimokuIndicator:t})})},i.prototype.clearDataSeries=function(e){for(var t=0,i=[this._tenkanSenDataseries,this._kijunSenDataseries,this._chikouSpanDataseries,this._senkouSpanADataseries,this._senkouSpanBDataseries];t<i.length;t++){var r=i[t]
!r||e&&r!==e&&r.name!==e||r.clear()}},i}(e.TAIndicator)
e.IchimokuIndicator=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.CrossHairType={NONE:"none",MARKERS:"markers",CROSS:"cross",CROSS_BARS:"crossBars"},Object.freeze(e.CrossHairType)
var t=function(t){function i(i){t.call(this,i),this._view=new e.CrossHairView(this),this._visible=!0,this.loadState(i)}return __extends(i,t),Object.defineProperty(i.prototype,"crossHairType",{get:function(){return this._options.crossHairType},set:function(t){var i=this._options.crossHairType
i!==t&&(this._options.crossHairType=t,this._view.updateVisibility(),this.chart.fireValueChanged(e.ChartEvent.CROSS_HAIR_CHANGED,t,i))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(e){this._visible=e},enumerable:!0,configurable:!0}),i.prototype._subscribeEvents=function(){var i=this
t.prototype._subscribeEvents.call(this),this.chart.on(e.ChartEvent.THEME_CHANGED+".scxCrossHair",function(){i.applyTheme()}).on(e.ChartEvent.LOCALE_CHANGED+".scxCrossHair",function(){i.update()}).on(e.ChartEvent.TIME_INTERVAL_CHANGED+".scxCrossHair",function(){i.update()})},i.prototype._unsubscribeEvents=function(){this.chart.off(".scxCrossHair"),t.prototype._unsubscribeEvents.call(this)},i.prototype.layout=function(){this._view.layout()},i.prototype.applyTheme=function(){this._view.applyTheme(this.chart.theme.crossHair)},i.prototype.update=function(){this._view.updateMarkers(),this._view.updatePosition(!0)},i.prototype.show=function(){this.visible=!0,this._view.updatePosition(!0),this._view.updateVisibility(!0)},i.prototype.hide=function(){this.visible=!1,this._view.updateVisibility(!1)},i.prototype.saveState=function(){return e.JsUtil.clone(this._options)},i.prototype.loadState=function(t){this._options={},this.crossHairType=t&&t.crossHairType||e.CrossHairType.NONE},i.prototype.setPosition=function(e,t){this._view.setPosition(e,t)},i.prototype.handleMouseHoverGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:this._view.updateVisibility(!0)
break
case e.GestureState.FINISHED:this._view.updateVisibility(!1)
break
case e.GestureState.CONTINUED:this.crossHairType!==e.CrossHairType.NONE&&this.setPosition(i.pointerPosition)}},i.prototype.draw=function(){},i.prototype.destroy=function(){this._view.destroy(),t.prototype.destroy.call(this)},i}(e.ChartComponent)
e.CrossHair=t}(StockChartX||(StockChartX={})),function(e){var t={HOR_LINE:"scxCrossHairHorLine",VER_LINE:"scxCrossHairVerLine",NOTE:"scxCrossHairMarker",DATE_MARKER:"scxCrossHairDateMarker",VALUE_MARKER:"scxCrossHairValueMarker",CROSS_HAIR:"scxCrossHair"}
Object.freeze(t)
var i=function(){function i(t){this._position=null,this._prevPosition={},this._positionAnimation=new e.Animation({callback:this.updatePosition}),this._crossHair=t}return Object.defineProperty(i.prototype,"chart",{get:function(){return this._crossHair.chart},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rootDiv",{get:function(){return this.chart.rootDiv},enumerable:!0,configurable:!0}),i._applyMarkerTheme=function(e,t){e.scxTextStyle(t.text).scxFill(t.fill)},i._updateValueMarkerMetrics=function(e){var t=e.$control
t.text()||t.text("1"),e.halfHeight=t.height()/2},i._updateDateMarkerMetrics=function(e,t){var i=e.$control
i.text(t).width("auto")
var r=Math.round(1.2*i.width())
e.halfWidth=Math.round(r/2),i.width(r)},i.prototype._createValueMarker=function(){return{visible:!0,halfHeight:0,$control:this.rootDiv.scxAppend("span",[t.NOTE,t.VALUE_MARKER])}},i.prototype._createControls=function(){var e=this.rootDiv
this._controls={lines:{visible:!0,$horLine:e.scxAppend("div",t.HOR_LINE),$verLine:e.scxAppend("div",t.VER_LINE)},leftMarkers:[],rightMarkers:[],topMarker:{visible:!0,halfWidth:0,$control:e.scxAppend("span",[t.NOTE,t.DATE_MARKER])},bottomMarker:{visible:!0,halfWidth:0,$control:e.scxAppend("span",[t.NOTE,t.DATE_MARKER])}},this._crossHair.applyTheme(),this.updateVisibility(!1)},i.prototype._syncValueMarkers=function(){var e=this._controls.leftMarkers,t=this._controls.rightMarkers,i=e.length-this.chart.valueScales.length
if(0<i)e.splice(-i,i),t.splice(-i,i)
else if(0>i){for(var r=0;r<-i;r++)e.push(this._createValueMarker()),t.push(this._createValueMarker())
this._crossHair.applyTheme(),this.updateVisibility(!1)}},i.prototype.layout=function(){var e=this.chart
this._controls||this._createControls(),this._syncValueMarkers()
var t=this._controls,i=e.chartPanelsContainer.panelsContentFrame
t.lines.$horLine.css("left",i.left).width(i.width),t.lines.$verLine.css("top",i.top).height(i.height)
for(var i=e.valueScales,r=0;r<i.length;r++){var n=i[r].leftPanel.frame
n&&t.leftMarkers[r].$control.css("left",n.left+1).outerWidth(n.width-2),(n=i[r].rightPanel.frame)&&t.rightMarkers[r].$control.css("left",n.left+1).outerWidth(n.width-2)}e=e.dateScale,(i=e.topPanel.frame)&&t.topMarker.$control.css("top",i.top+1).outerHeight(i.height-2).css("line-height",i.height-2+"px"),(e=e.bottomPanel.frame)&&t.bottomMarker.$control.css("top",e.top+1).outerHeight(e.height-2).css("line-height",e.height-2+"px")},i.prototype.applyTheme=function(e){var t=this._controls
t.lines.$horLine.scxBorder("border-top",e.line),t.lines.$verLine.scxBorder("border-left",e.line)
for(var r=0,n=t.leftMarkers;r<n.length;r++){var o=n[r]
i._applyMarkerTheme(o.$control,e)}for(r=0,n=t.rightMarkers;r<n.length;r++)o=n[r],i._applyMarkerTheme(o.$control,e)
i._applyMarkerTheme(t.topMarker.$control,e),i._applyMarkerTheme(t.bottomMarker.$control,e),this.updateMarkers()},i.prototype.updateVisibility=function(i){var r=this._controls
if(r){var n=this._crossHair.crossHairType
i=this._crossHair.visible&&!!i&&n!==e.CrossHairType.NONE,!i||n!==e.CrossHairType.CROSS&&n!==e.CrossHairType.CROSS_BARS?this.rootDiv.removeClass(t.CROSS_HAIR):this.rootDiv.addClass(t.CROSS_HAIR)
for(var o=i&&n!==e.CrossHairType.NONE,a=this.chart.valueScales,s=0;s<a.length&&!(s>=r.leftMarkers.length);s++){var l=o&&a[s].leftPanelVisible,c=o&&a[s].rightPanelVisible
r.leftMarkers[s].visible=l,r.rightMarkers[s].visible=c,e.HtmlUtil.setVisibility(r.leftMarkers[s].$control,l),e.HtmlUtil.setVisibility(r.rightMarkers[s].$control,c)}n=n===e.CrossHairType.CROSS||n===e.CrossHairType.CROSS_BARS,i=r.lines.visible=i&&n,e.HtmlUtil.setVisibility(r.lines.$horLine,i),e.HtmlUtil.setVisibility(r.lines.$verLine,i),n=this.chart.dateScale,i=r.topMarker.visible=o&&n.topPanelVisible,o=r.bottomMarker.visible=o&&n.bottomPanelVisible,e.HtmlUtil.setVisibility(r.topMarker.$control,i),e.HtmlUtil.setVisibility(r.bottomMarker.$control,o)}},i.prototype.setPosition=function(e,t){this._position=e,t?this._positionAnimation.start():this.updatePosition()},i.prototype.updatePosition=function(t){if(this._positionAnimation){this._positionAnimation.stop()
var i=this._position
if(i){var r=this.chart,n=r.findPanelAt(i.y)
if(n){var o=this._controls,a=this._prevPosition,s=this._crossHair.crossHairType
if(a.x!==i.x||!0===t){a.x=i.x
var l=r.dateScale,c=l.projection
s===e.CrossHairType.CROSS_BARS&&(i.x=c.xByRecord(c.recordByX(i.x,!0))),o.lines.visible&&o.lines.$verLine.css("left",i.x)
var s=o.topMarker,h=o.bottomMarker;(s.visible||h.visible)&&(c=c.dateByColumn(c.columnByX(i.x)),l=l.formatDate(c),this._updateDateMarker(s,l),this._updateDateMarker(h,l))}if(a.y!==i.y||!0===t)for(a.y=i.y,o.lines.visible&&o.lines.$horLine.css("top",i.y),t=r.valueScales,i=i.y-n.frame.top-r.chartPanelsContainer.frame.top,r=0;r<t.length;r++)a=o.leftMarkers[r],l=o.rightMarkers[r],(a.visible||l.visible)&&(s=n.valueScales[r],h=s.projection.valueByY(i),s=s.formatValue(h),this._updateValueMarker(a,s),this._updateValueMarker(l,s))}}}},i.prototype.updateMarkers=function(){var e=this._controls
if(e){for(var t=0,r=e.leftMarkers;t<r.length;t++){var n=r[t]
i._updateValueMarkerMetrics(n)}for(t=0,r=e.rightMarkers;t<r.length;t++)n=r[t],i._updateValueMarkerMetrics(n)
n=this.chart.dateScale.formatDate(new Date(0)),i._updateDateMarkerMetrics(e.topMarker,n),i._updateDateMarkerMetrics(e.bottomMarker,n)}},i.prototype._updateValueMarker=function(e,t){e.visible&&e.$control.text(t).css("top",this._position.y-e.halfHeight)},i.prototype._updateDateMarker=function(e,t){if(e.visible){var i=this.rootDiv.width(),i=this._position.x>i-e.halfWidth?i-2*e.halfWidth:this._position.x-e.halfWidth
e.$control.text(t).css("left",Math.max(i,0))}},i.prototype.destroy=function(){var e=this._controls
e.lines.$horLine.remove(),e.lines.$verLine.remove(),e.topMarker.$control.remove(),e.bottomMarker.$control.remove()
for(var t=0,i=e.leftMarkers;t<i.length;t++){var r=i[t]
r.$control.remove()}for(t=0,e=e.rightMarkers;t<e.length;t++)r=e[t],r.$control.remove()
this._controls=null},i}()
e.CrossHairView=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.ZoomInMode={DATE_RANGE:"dateRange",RECT:"rect"},Object.freeze(e.ZoomInMode)
var t={ZOOM_RECTANGLE:"scxZoomRectangle",ZOOM_IN:"scxZoomIn"}
Object.freeze(t)
var i=function(i){function r(){i.call(this),this._positionAnimation=new e.Animation({callback:this.draw}),this._zoomMode=e.ZoomInMode.DATE_RANGE,this._panelHeight=this._panelTop=0}return __extends(r,i),Object.defineProperty(r.prototype,"zoomMode",{get:function(){return this._zoomMode},set:function(e){this._zoomMode=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"panel",{get:function(){return this._panel},set:function(e){this._panel=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"theme",{get:function(){return this._theme||this.chart.theme.zoomIn},set:function(e){this._theme=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rootDiv",{get:function(){return this.panel.rootDiv},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"chart",{get:function(){return this.panel.chart},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"panelTop",{get:function(){return this._panelTop},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"panelHeight",{get:function(){return this._panelHeight},enumerable:!0,configurable:!0}),r.prototype._initGestures=function(){return new e.GestureArray([new e.ClickGesture({handler:this._handleMouseClickGesture,hitTest:this.hitTest}),new e.MouseHoverGesture({handler:this._handleMouseMoveGesture,hitTest:this.hitTest})],this)},r.prototype._handleMouseClickGesture=function(t,i){if(this.chart.state===e.ChartState.ZOOM_IN){if(this._panelTop=this.panel.frame.top,this._panelHeight=this.panel.frame.height,this._addPoint({x:i.pointerPosition.x,y:i.pointerPosition.y-this.panelTop}),1===this._points.length)this._createControls()
else if(2===this._points.length)return void this.finishDraw()
this.updateVisibility(!0),this.setPosition()}},r.prototype._handleMouseMoveGesture=function(e,t){null!=this._startPoint&&this.movePosition({x:t.pointerPosition.x,y:t.pointerPosition.y-this.panelTop})},r.prototype.hitTest=function(e){return this.panel.contentFrame.containsPoint(e)},r.prototype._createControls=function(){this.panel&&(this._controls={rectangle:this.rootDiv.scxAppend("div",t.ZOOM_RECTANGLE)},this.applyTheme(),this.updateVisibility(!1))},r.prototype._addPoint=function(e){null==this._points&&(this._points=[]),this._points.push(e)},r.prototype.finishDraw=function(){var i=this.chart,r=i.dateScale.projection,n=this._points
i.state=e.ChartState.NORMAL,this.updateVisibility(!1)
var o=r.recordByX(Math.min(n[0].x,n[1].x)),r=r.recordByX(Math.max(n[0].x,n[1].x))
r>o&&(i.recordRange(o,r),i.setNeedsUpdate(),this._zoomMode===e.ZoomInMode.RECT?this._setScalesValues(n[0].y,n[1].y):i.setNeedsAutoScale()),this._points=null,this.rootDiv.find("."+t.ZOOM_RECTANGLE).remove(),i.fireValueChanged(e.ChartEvent.ZOOM_IN_FINISHED)},r.prototype.cancelDraw=function(){this._points=null,this.panel&&(this.updateVisibility(!1),this.rootDiv.find("."+t.ZOOM_RECTANGLE).remove())},r.prototype.applyTheme=function(){var e=this.theme
this._controls.rectangle.scxBorder("border",e.border).scxFill(e.fill)},r.prototype.updateVisibility=function(i){var r=this._controls
this._controls&&(i?this.rootDiv.addClass(t.ZOOM_IN):this.rootDiv.removeClass(t.ZOOM_IN),e.HtmlUtil.setVisibility(r.rectangle,i))},r.prototype.setPosition=function(e){this._startPoint=this._points[0],e?this._positionAnimation.start():this.draw()},r.prototype.movePosition=function(e,t){this._movePoint=e,t?this._positionAnimation.start():this.draw()},r.prototype.draw=function(){if(this._positionAnimation){this._positionAnimation.stop()
var t=this._startPoint
if(t){var i=null==this._movePoint?t:this._movePoint,r=0,n=0,o=0,a=0
this.zoomMode===e.ZoomInMode.DATE_RANGE?(n=0,o=Math.abs(i.x-t.x),a=this.panelHeight,r=t.x>i.x?i.x:t.x):(o=Math.abs(i.x-t.x),a=Math.abs(i.y-t.y),t.x<=i.x?(r=t.x,n=t.y<=i.y?t.y:i.y):(r=i.x,n=t.y<=i.y?i.y-a:i.y)),t=this._controls.rectangle,t.scxFrame({left:r,top:n,width:o,height:a}),t.css("position","absolute")}}},r.prototype._setScalesValues=function(e,t){for(var i=0,r=this.chart.chartPanels;i<r.length;i++)for(var n=0,o=r[i].valueScales;n<o.length;n++){var a=o[n],s=a.projection.valueByY(e),l=a.projection.valueByY(t)
a.minVisibleValue=Math.min(s,l),a.maxVisibleValue=Math.max(s,l)}},r.prototype.destroy=function(){this._controls.rectangle.remove(),this._controls=null},r}(e.Control)
e.ZoomInView=i}(StockChartX||(StockChartX={})),function(e){e.XPointBehavior={X:"x",RECORD:"record",DATE:"date"},Object.freeze(e.XPointBehavior),e.YPointBehavior={Y:"y",VALUE:"value"},Object.freeze(e.YPointBehavior)
var t=function(){function t(e){e=e||{},null!=e.x&&(this.x=e.x),null!=e.y&&(this.y=e.y),null!=e.date&&(this.date="string"==typeof e.date?new Date(e.date):e.date),null!=e.value&&(this.value=e.value),null!=e.record&&(this.record=e.record)}return t.convert=function(i,r,n){var o={}
switch(r.x){case e.XPointBehavior.X:o.x=i.x
break
case e.XPointBehavior.RECORD:o.record=n.recordByX(i.x,!1)
break
case e.XPointBehavior.DATE:o.date=n.dateByX(i.x)
break
default:throw Error("Unknown X point behavior: "+r.x)}switch(r.y){case e.YPointBehavior.Y:o.y=i.y
break
case e.YPointBehavior.VALUE:o.value=n.valueByY(i.y)
break
default:throw Error("Unknown Y point behavior: "+r.y)}return new t(o)},t.prototype.clear=function(){null!=this.x&&(this.x=void 0),null!=this.y&&(this.y=void 0),null!=this.date&&(this.date=void 0),null!=this.value&&(this.value=void 0),null!=this.record&&(this.record=void 0)},t.prototype.getX=function(e){if(null!=this.x)return this.x
if(null!=this.date)return e.xByDate(this.date)
if(null!=this.record)return e.xByRecord(this.record,!1)
throw Error("Point is not initialized.")},t.prototype.getDate=function(e){if(null!=this.x)return e.dateByX(this.x)
if(null!=this.date)return this.date
if(null!=this.record)return e.dateByX(e.xByRecord(this.record,!1))
throw Error("Point is not initialized.")},t.prototype.getRecord=function(e){if(null!=this.x)return e.recordByX(this.x,!1)
if(null!=this.date)return e.recordByX(e.xByDate(this.date,!1),!1)
if(null!=this.record)return this.record
throw Error("Point is not initialized.")},t.prototype.getY=function(e){if(null!=this.y)return this.y
if(null!=this.value)return e.yByValue(this.value)
throw Error("Point is not initialized.")},t.prototype.getValue=function(e){if(null!=this.value)return this.value
if(null!=this.y)return e.valueByY(this.y)
throw Error("Point is not initialized.")},t.prototype.toPoint=function(e){return{x:this.getX(e),y:this.getY(e)}},t.prototype.moveTo=function(e,t,i){return this.moveToX(e,i).moveToY(t,i)},t.prototype.moveToPoint=function(e,t){return this.moveTo(e.x,e.y,t)},t.prototype.moveToX=function(e,t){if(null!=this.x)this.x=e
else if(null!=this.date)this.date=t.dateByX(e)
else{if(null==this.record)throw Error("Point is not initialized.")
this.record=t.recordByX(e,!1)}return this},t.prototype.moveToY=function(e,t){if(null!=this.y)this.y=e
else{if(null==this.value)throw Error("Point is not initialized.")
this.value=t.valueByY(e)}return this},t.prototype.translate=function(e,t,i){return e=this.getX(i)+e,t=this.getY(i)+t,this.moveTo(e,t,i)},t}()
e.ChartPoint=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(t){e.call(this),t&&(this._parent=t.parent,this.setup(this._parent),t.size&&(this.size=t.size))}return __extends(t,e),Object.defineProperty(t.prototype,"canvas",{get:function(){return this._canvas},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"context",{get:function(){return this._context},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return{width:this._canvas.width(),height:this._canvas.height()}},set:function(e){var t=this._canvas
t.width()!==e.width&&t.attr("width",e.width),t.height()!==e.height&&t.attr("height",e.height)},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this._parent&&(this._parent.remove(),this._parent=null),this._context=this._canvas=null},t.prototype.setup=function(e){this._canvas=e.scxAppendCanvas(),this._context=this._canvas[0].getContext("2d")},t}(e.Component)
e.Layer=t}(StockChartX||(StockChartX={})),function(e){var t=function(){function e(e){this.width=this.theme=null,e=e||{},this._chart=e.chart,this.theme=e.theme,this.width=e.width}return Object.defineProperty(e.prototype,"chart",{get:function(){return this._chart},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"actualTheme",{get:function(){return this.theme||this.chart.theme.selectionMarker},enumerable:!0,configurable:!0}),e.prototype.draw=function(e,t){var i=this.actualTheme,r=this.width
if(Array.isArray(t))for(e.scxApplyFillTheme(i.fill).scxApplyStrokeTheme(i.line),i=0;i<t.length;i++){var n=t[i]
e.beginPath(),e.arc(n.x,n.y,r,0,2*Math.PI),e.fill(),e.stroke()}else e.beginPath(),e.arc(t.x,t.y,r,0,2*Math.PI),e.scxFill(i.fill).scxStroke(i.line)},e}()
e.SelectionMarker=t}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t
!function(e){e.PANEL_CHANGED="drawingPanelChanged",e.VALUE_SCALE_CHANGED="drawingValueScaleChanged",e.VISIBLE_CHANGED="drawingVisibleChanged",e.POINTS_CHANGED="drawingPointsChanged",e.LOCKED_CHANGED="drawingLockedChanged",e.RESIZABLE_CHANGED="drawingResizableChanged",e.SELECTABLE_CHANGED="drawingSelectableChanged",e.SELECTED_CHANGED="drawingSelectedChanged",e.THEME_CHANGED="drawingThemeChanged",e.DRAG_STARTED="chartUserDrawingDragStarted",e.DRAG_FINISHED="chartUserDrawingDragFinished",e.DOUBLE_CLICK="chartDrawingDoubleClick",e.CONTEXT_MENU="chartDrawingContextMenu"}(t=e.DrawingEvent||(e.DrawingEvent={})),e.DrawingDragPoint={NONE:null,ALL:-1,MOVE_POINT1:1,MOVE_POINT2:2},e.DrawingCursorClass={CREATE:"scxDrawingCreate",MOVE:"scxDrawingMove",RESIZE:"scxDrawingResize",RESIZE_EW:"scxDrawingResizeEW",RESIZE_NS:"scxDrawingResizeNS",RESIZE_NESW:"scxDrawingResizeNESW",RESIZE_NWSE:"scxDrawingResizeNWSE"}
var i=function(){function t(){}return Object.defineProperty(t,"registeredDrawings",{get:function(){return this._drawings.registeredItems},enumerable:!0,configurable:!0}),t.register=function(e){this._drawings.register(e.className,e)},t.deserialize=function(e){if(!e)return null
e="string"==typeof e?JSON.parse(e):e
var t=this._drawings.createInstance(e.className)
return t.loadState(e),t},t._drawings=new e.ClassRegistrar,t}(),r=function(i){function r(t){var r=this
i.call(this,t),this._drawingState=0,this._selected=!1,this._dragPoint=e.DrawingDragPoint.NONE,this.loadState(t),this._initGestures(),this._contextMenu=new e.UI.DrawingContextMenu({drawing:this,onItemSelected:function(t,i){switch(t.data("id")){case e.UI.DrawingContextMenu.MenuItem.SETTINGS:r._showSettingsDialog()
break
case e.UI.DrawingContextMenu.MenuItem.CLONE:r.chart._copyDrawing(),r.chart._pasteDrawing()
break
case e.UI.DrawingContextMenu.MenuItem.DELETE:r.remove()}}})}return __extends(r,i),Object.defineProperty(r,"subClassName",{get:function(){return"abstract"},enumerable:!0,configurable:!0}),Object.defineProperty(r,"className",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_defaults",{get:function(){return this.constructor.defaults},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"className",{get:function(){return this.constructor.className},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"chartPoints",{get:function(){var e=this._options.points
return this._lastCreatePoint?e.concat(this._lastCreatePoint):e},set:function(e){this.setChartPoints(e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"locked",{get:function(){return this._options.locked},set:function(e){this._setOption("locked",!!e,t.LOCKED_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"resizable",{get:function(){return this._options.resizable},set:function(e){this._setOption("resizable",!!e,t.RESIZABLE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"selectable",{get:function(){return this._options.selectable},set:function(e){this._setOption("selectable",!!e,t.SELECTABLE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"removable",{get:function(){return this.selectable},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"theme",{get:function(){return this._options.theme},set:function(e){this._options.theme=e,this.fire(t.THEME_CHANGED,e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"actualTheme",{get:function(){var e=this._options.theme
return e||this.defaultTheme},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"defaultTheme",{get:function(){var e=this.chart
return e?(e=e.theme.drawing,e[this.className]||e[this.constructor.subClassName]):null},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"createPointBehavior",{get:function(){return this._options.createPointBehavior},set:function(e){this._options.createPointBehavior=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"selected",{get:function(){return this._selected},set:function(e){e=!!e
var i=this._selected
if(i!==e){this._selected=e
var r=this.chart
r&&(e?r.selectedObject=this:this===r.selectedObject&&(r.selectedObject=null)),this._onSelectedChanged(),this.fire(t.SELECTED_CHANGED,e,i)}},enumerable:!0,configurable:!0}),r.prototype._onSelectedChanged=function(){},Object.defineProperty(r.prototype,"canSelect",{get:function(){return this.selectable},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"canMove",{get:function(){return this.selectable&&!this.locked},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"canResize",{get:function(){return this.selectable&&this.resizable&&!this.locked},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"pointsNeeded",{get:function(){return 1},enumerable:!0,configurable:!0}),r.prototype._onChartPanelChanged=function(e){this.fire(t.PANEL_CHANGED,this.chartPanel,e)},r.prototype._onValueScaleChanged=function(e){this.fire(t.VALUE_SCALE_CHANGED,this.valueScale,e)},r.prototype._onVisibleChanged=function(e){this.fire(t.VISIBLE_CHANGED,this.visible,e)},r.prototype._optionValue=function(e){var t=this._options[e]
return null!=t?t:this._defaults[e]},r.prototype._initGestures=function(){this._gestures=new e.GestureArray([new e.ClickGesture({handler:this._handleClickGesture,hitTest:this._clickGestureHitTest}),new e.DoubleClickGesture({handler:this._handleDoubleClickGesture,hitTest:this.hitTest}),new e.ContextMenuGesture({handler:this._handleContextMenuGesture,hitTest:this._clickGestureHitTest}),new e.PanGesture({handler:this._handlePanGestureInternal,hitTest:this._panGestureHitTest,button:e.MouseButton.LEFT}),new e.MouseHoverGesture({handler:this._handleMouseHoverGestureInternal,enterEventEnabled:!0,hoverEventEnabled:!0,leaveEventEnabled:!0,hitTest:this.hitTest})],this)},r.prototype._handleMouseHoverGestureInternal=function(t,i){var r=this.tooltip
if(!this.chart.showDrawingTooltips||1===this._drawingState)return void r.hide()
if(!this._handleMouseHoverGesture(t,i))switch(t.state){case e.GestureState.STARTED:case e.GestureState.CONTINUED:this.showTooltip(i.pointerPosition)
break
case e.GestureState.FINISHED:this.hideTooltip()}},r.prototype._handleMouseHoverGesture=function(e,t){},r.prototype._clickGestureHitTest=function(e){return this.canSelect&&this.hitTest(e)},r.prototype._panGestureHitTest=function(e){return this.canMove&&this.hitTest(e)},r.prototype._handlePanGestureInternal=function(t,i){if(this._drawingState=t.state!==e.GestureState.FINISHED?1:0,this._contextMenu&&t.state===e.GestureState.CONTINUED&&this._contextMenu.hide(),this.tooltip.hide(),!this.canResize||!this._handlePanGesture(t,i))switch(t.state){case e.GestureState.STARTED:var r=this.chart,n=r.selectedObject
if(this._setDragPoint(e.DrawingDragPoint.ALL),this.changeCursor(e.DrawingCursorClass.MOVE),n!==this)return void r.setNeedsUpdate()
break
case e.GestureState.FINISHED:this._setDragPoint(e.DrawingDragPoint.NONE)
break
case e.GestureState.CONTINUED:if(this._dragPoint===e.DrawingDragPoint.ALL)for(var r=this.projection,n=t.moveOffset,o=0,a=this.chartPoints;o<a.length;o++)a[o].translate(n.x,n.y,r)}t.state===e.GestureState.FINISHED&&this.changeCursor(),this.chartPanel.setNeedsUpdate()},r.prototype._handleClickGesture=function(){!this.selected&&this.canSelect&&(this.select(),this.chart.setNeedsUpdate())},r.prototype._handleDoubleClickGesture=function(){this.fire(t.DOUBLE_CLICK,this),this.selectable&&this._showSettingsDialog()},r.prototype._handleContextMenuGesture=function(e,i){this.fire(t.CONTEXT_MENU,this),this.selectable&&this._contextMenu.show(i.evt)},r.prototype._handleUserDrawingPoint=function(e){return!1},r.prototype._handleUserDrawingClickGesture=function(e,t){this.chartPanel||t.chartPanel.addDrawings(this)
var i=this._normalizeUserDrawingPoint(t.pointerPosition)
this._lastCreatePoint=null,this._handleUserDrawingPoint(i)||this.appendChartPoint(i),this.chartPoints.length>=this.pointsNeeded&&this._finishUserDrawing(),(i=this.chartPanel)&&i.setNeedsUpdate()},r.prototype._handleUserDrawingMoveGesture=function(e,t){0<this.chartPoints.length&&(this._lastCreatePoint=this._normalizeUserDrawingPoint(t.pointerPosition),this.chartPanel.setNeedsUpdate())},r.prototype._normalizeUserDrawingPoint=function(t){return e.ChartPoint.convert(t,this.createPointBehavior,this.projection)},r.prototype._showSettingsDialog=function(){var t=this
e.UI.ViewLoader.drawingSettingsDialog(function(e){e.show({chart:t.chart,drawing:t})})},r.prototype.setChartPoints=function(i){var r
if(i instanceof e.ChartPoint)r=[i]
else if(Array.isArray(i)){r=[]
for(var n=0;n<i.length;n++)r.push(new e.ChartPoint(i[n]))}else r=[new e.ChartPoint(i)]
this._setOption("points",r,t.POINTS_CHANGED)},r.prototype.appendChartPoint=function(t){var i=this._options.points
return i.push(new e.ChartPoint(t)),i},r.prototype.cartesianPoint=function(e){return(e=this.chartPoints[e])&&e.toPoint(this.projection)},r.prototype.cartesianPoints=function(){var e=this.projection
return this.chartPoints.map(function(t){return t.toPoint(e)})},r.prototype.select=function(){!this.selected&&this.canSelect&&this.chart.selectObject(this)},r.prototype.translate=function(e,t){for(var i=this.projection,r=0,n=this.chartPoints;r<n.length;r++)n[r].translate(e,t,i)},r.prototype.bounds=function(){return null},r.prototype.startUserDrawing=function(){this._createClickGesture=new e.ClickGesture({hitTest:function(){return!0},handler:this._handleUserDrawingClickGesture,context:this}),this._createMoveGesture=new e.MouseHoverGesture({enterEventEnabled:!1,leaveEventEnabled:!1,hitTest:function(){return!0},handler:this._handleUserDrawingMoveGesture,context:this}),this.chartPoints=[],this.selected=!0,this.remove()},r.prototype._finishUserDrawing=function(){this._lastCreatePoint=this._createMoveGesture=this._createClickGesture=null,this.tooltip.applyTheme(),this.chart._finishUserDrawing()},r.prototype.hitTest=function(e){return!1},r.prototype.handleEvent=function(e){return this._createClickGesture?this._createClickGesture.handleEvent(e)||this._createMoveGesture.handleEvent(e):this._gestures.handleEvent(e)},r.prototype._handlePanGesture=function(e,t){return!1},r.prototype._setDragPoint=function(i){this._dragPoint!==i&&(this._dragPoint=i,this._dragPoint===e.DrawingDragPoint.NONE?this.fire(t.DRAG_FINISHED):(this.fire(t.DRAG_STARTED),this.select()))},r.prototype._getSelectionMarkerWidth=function(e){return(e&&e.line&&e.line.width||1)+2},r.prototype._drawSelectionMarkers=function(e){if(e){var t=this.chart.selectionMarker
if(t.width=this._getSelectionMarkerWidth(this.actualTheme),Array.isArray(e))for(var i=0;i<e.length;i++)t.draw(this.context,e[i])
else t.draw(this.context,e)}},r.prototype.saveState=function(){var e=i.prototype.saveState.call(this)
return e.className=this.className,e},r.prototype.loadState=function(e){e=e||{},i.prototype.loadState.call(this,e)
var t=e
e=e.options||{}
var n=this.suppressEvents(!0)
this.createPointBehavior||(this.createPointBehavior=t.createPointBehavior||this._defaults.createPointBehavior||r.defaults.createPointBehavior),this.chartPoints=t.point||t.points||e&&e.points,null==e.visible&&(this.visible=null==t.visible||t.visible),null==e.selectable&&(this.selectable=null==t.selectable||t.selectable),null==e.locked&&(this.locked=null!=t.locked&&t.locked),null==e.resizable&&(this.resizable=null==t.resizable||t.resizable),null==e.theme&&(this.theme=t.theme),this.suppressEvents(n)},r.prototype.drawValueMarkers=function(){},r.prototype.drawDateMarkers=function(){},r.prototype.clone=function(){var e=r.deserialize(this.saveState())
return e.chartPanel=this.chartPanel,e},r.prototype.remove=function(){var e=this.chartPanel
return!!e&&(e.removeDrawings(this),e.setNeedsUpdate(),this.chartPanel=null,!0)},r.defaults={createPointBehavior:{x:e.XPointBehavior.DATE,y:e.YPointBehavior.VALUE}},r}(e.ChartPanelObject)
e.Drawing=r,e.JsUtil.applyMixins(r,[i])}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t;(t=e.DrawingEvent||(e.DrawingEvent={})).DOT_RADIUS_CHANGED="drawingDotRadiusChanged"
var i=function(i){function r(e){i.call(this,e)}return __extends(r,i),Object.defineProperty(r,"className",{get:function(){return"dot"},enumerable:!0,configurable:!0}),Object.defineProperty(r,"subClassName",{get:function(){return"abstractMarker"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"radius",{get:function(){return this._options.radius||this._defaults.radius||r.defaults.radius},set:function(i){if(e.JsUtil.isNegativeNumber(i))throw new TypeError("Radius must be a positive number.")
this._setOption("radius",i,t.DOT_RADIUS_CHANGED)},enumerable:!0,configurable:!0}),r.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.radius
return{left:e.x-t,top:e.y-t,width:2*t,height:2*t}},r.prototype.hitTest=function(t){var i=this.cartesianPoint(0)
return!!i&&e.Geometry.isPointInsideOrNearCircle(t,i,this.radius)},r.prototype.draw=function(){if(this.visible){var e=this.cartesianPoint(0)
if(e){var t=this.context,i=this.actualTheme
t.beginPath(),t.arc(e.x,e.y,this.radius,0,2*Math.PI),t.scxFillStroke(i.fill,i.stroke),this.selected&&this._drawSelectionMarkers(e)}}},r.defaults={radius:5},r}(e.Drawing)
e.DotDrawing=i,e.Drawing.register(i)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._radius=12}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"note"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"label",{get:function(){return this._options.label||this._defaults.label||""},set:function(e){0!=e.length&&(this._options.label=e[0])},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this._radius
return{left:e.x-t,top:e.y-t-18,width:2*t,height:2*t+5}},i.prototype.hitTest=function(t){var i=this.cartesianPoint(0)
return!!i&&(e.Geometry.isPointInsideOrNearCircle(t,{x:i.x,y:i.y-20},this._radius)||e.Geometry.isPointNearPoint(t,i))},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoint(0)
if(e){var t=this.context,i=this.actualTheme,r=e.x,n=e.y-20
t.beginPath(),t.moveTo(r-this._radius/2,n),t.lineTo(r+this._radius/2,n),t.arc(r,n,this._radius,0,2*Math.PI),t.moveTo(r+this._radius/2+6,n+2),t.bezierCurveTo(r+this._radius/2+6,n,r+10,n+12,r,n+18),t.bezierCurveTo(r,n+18,r-10,n+12,r-this._radius/2-6,n),t.scxFillStroke(i.fill,i.stroke),t.beginPath(),t.moveTo(r-(this._radius-1.5),n),t.lineTo(r+(this._radius-1.5),n),t.arc(r,n,this._radius-3,0,2*Math.PI),t.scxFillStroke(i.centerPointFill,i.stroke),t.scxApplyTextTheme(i.text),t.textAlign="center",t.textBaseline="middle",t.fillText(this.label,r,n),this.selected&&this._drawSelectionMarkers(e)}}},i.defaults={label:"N"},i}(e.Drawing)
e.NoteDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t;(t=e.DrawingEvent||(e.DrawingEvent={})).SIZE_CHANGED="drawingSizeChanged"
var i=function(i){function r(e){i.call(this,e)}return __extends(r,i),Object.defineProperty(r,"subClassName",{get:function(){return"abstractMarker"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"size",{get:function(){return this._options.size||this._defaults.size||r.defaults.size},set:function(e){this._setOption("size",e,t.SIZE_CHANGED)},enumerable:!0,configurable:!0}),r.prototype.hitTest=function(t){var i=this.bounds()
return i&&e.Geometry.isPointInsideOrNearRect(t,i)},r.defaults={size:{width:14,height:14}},r}(e.Drawing)
e.GeometricMarkerDrawingBase=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"square"},enumerable:!0,configurable:!0}),t.prototype.bounds=function(){var e=this.cartesianPoint(0),t=this.size
return e?{left:Math.round(e.x-t.width/2),top:Math.round(e.y-t.height/2),width:t.width,height:t.height}:null},t.prototype.draw=function(){if(this.visible){var e=this.bounds()
if(e){var t=this.context,i=this.actualTheme
t.beginPath(),t.rect(e.left,e.top,e.width,e.height),t.scxFillStroke(i.fill,i.stroke),this.selected&&this._drawSelectionMarkers(this.cartesianPoint(0))}}},t.defaults={size:{width:10,height:10}},t}(e.GeometricMarkerDrawingBase)
e.SquareDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"diamond"},enumerable:!0,configurable:!0}),t.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.size
return{left:Math.round(e.x-t.width/2),top:Math.round(e.y-t.height/2),width:t.width,height:t.height}},t.prototype.draw=function(){if(this.visible){var e=this.cartesianPoint(0)
if(e){var t=this.context,i=this.actualTheme,r=this.size,n=Math.round(r.width/2),r=Math.round(r.height/2)
t.beginPath(),t.moveTo(e.x-n,e.y),t.lineTo(e.x,e.y-r),t.lineTo(e.x+n,e.y),t.lineTo(e.x,e.y+r),t.closePath(),t.scxFillStroke(i.fill,i.stroke),this.selected&&this._drawSelectionMarkers(e)}}},t.defaults={size:{width:10,height:10}},t}(e.GeometricMarkerDrawingBase)
e.DiamondDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t
!function(e){e.ARROW_HEAD_RATIO_CHANGED="drawingArrowHeadRatioChanged",e.ARROW_TAIL_RATIO_CHANGED="drawingArrowTailRatioChanged"}(t=e.DrawingEvent||(e.DrawingEvent={}))
var i=function(i){function r(e){i.call(this,e),this._angle=0}return __extends(r,i),Object.defineProperty(r.prototype,"headRatio",{get:function(){return this._options.headRatio||this._defaults.headRatio||r.defaults.headRatio},set:function(i){if(!e.JsUtil.isPositiveNumber(i)||1<=i)throw Error("Value must be in range (0..1).")
this._setOption("headRatio",i,t.ARROW_HEAD_RATIO_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"tailRatio",{get:function(){return this._options.tailRatio||this._defaults.tailRatio||r.defaults.tailRatio},set:function(i){if(!e.JsUtil.isPositiveNumber(i)||1<=i)throw Error("Value must be in range (0..1).")
this._setOption("tailRatio",i,t.ARROW_TAIL_RATIO_CHANGED)},enumerable:!0,configurable:!0}),r.prototype.draw=function(){if(this.visible){var e=this.cartesianPoint(0)
if(e){var t=this.context,i=this.actualTheme,r=this.size,n=r.width/2,o=r.width*this.tailRatio/2,a=r.height*this.headRatio
t.save(),t.translate(e.x,e.y),t.rotate(this._angle*Math.PI/180),t.beginPath(),t.moveTo(0,0),t.lineTo(-n,-a),t.lineTo(-o,-a),t.lineTo(-o,-r.height),t.lineTo(o,-r.height),t.lineTo(o,-a),t.lineTo(n,-a),t.closePath(),t.scxFillStroke(i.fill,i.stroke),this.selected&&this._drawSelectionMarkers({x:0,y:0}),t.restore()}}},r.defaults={size:null,headRatio:.5,tailRatio:.5},r}(e.GeometricMarkerDrawingBase)
e.ArrowDrawingBase=i}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(t){e.call(this,t),this._angle=180}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"arrowUp"},enumerable:!0,configurable:!0}),t.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.size
return{left:Math.round(e.x-t.width/2),top:e.y,width:t.width,height:t.height}},t}(e.ArrowDrawingBase)
e.ArrowUpDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"arrowDown"},enumerable:!0,configurable:!0}),t.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.size
return{left:Math.round(e.x-t.width/2),top:Math.round(e.y-t.height),width:t.width,height:t.height}},t}(e.ArrowDrawingBase)
e.ArrowDownDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(t){e.call(this,t),this._angle=90}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"arrowLeft"},enumerable:!0,configurable:!0}),t.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.size
return{left:e.x,top:Math.round(e.y-t.height/2),width:t.width,height:t.height}},t}(e.ArrowDrawingBase)
e.ArrowLeftDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(t){e.call(this,t),this._angle=-90}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"arrowRight"},enumerable:!0,configurable:!0}),t.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.size
return{left:e.x-t.width,top:Math.round(e.y-t.height/2),width:t.width,height:t.height}},t}(e.ArrowDrawingBase)
e.ArrowRightDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"arrow"},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:Math.min(e[0].x,e[1].x),top:Math.min(e[0].y,e[1].y),width:Math.abs(e[0].x-e[1].x),height:Math.abs(e[0].y-e[1].y)}},Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.hitTest=function(t){var i=this.cartesianPoints()
return 1<i.length&&e.Geometry.isPointNearPolyline(t,i)},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this.cartesianPoint(0),i.pointerPosition))this._setDragPoint(0)
else{if(!e.Geometry.isPointNearPoint(this.cartesianPoint(1),i.pointerPosition))break
this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints()
if(2===t.length){var i=t[0].x,r=t[0].y,n=t[1].x,o=t[1].y,a=Math.acos(((n-i)*(i-i)+(o-r)*(o-r))/(Math.sqrt((n-i)*(n-i)+(o-r)*(o-r))*Math.sqrt((i-i)*(i-i)+(o-r)*(o-r)))),s=this.context,l=this.actualTheme,c=e.Geometry.length({x:i,y:r},{x:n,y:o}),h=50*this.tailRatio/2,u=c*this.headRatio
s.save(),s.translate(i,r),n<=i&&o<=r&&(o==r?s.rotate(-Math.PI/2):s.rotate(-a)),n>=i&&o<=r&&(o==r?s.rotate(Math.PI/2):s.rotate(a)),n>=i&&o>=r&&(n==i?s.rotate(2*Math.PI):s.rotate(Math.PI-a)),n<=i&&o>=r&&s.rotate(Math.PI+a),s.beginPath(),s.lineTo(0,0),s.lineTo(0,-c),s.lineTo(-25,-u),s.lineTo(-h,-u),s.lineTo(-h,0),s.lineTo(h,0),s.lineTo(h,-u),s.lineTo(25,-u),s.lineTo(0,-c),s.closePath(),s.scxFillStroke(l.fill,l.stroke),s.restore(),this.selected&&this._drawSelectionMarkers(t)}}},i}(e.ArrowDrawingBase)
e.Arrow=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"lineSegment"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:Math.min(e[0].x,e[1].x),top:Math.min(e[0].y,e[1].y),width:Math.abs(e[0].x-e[1].x),height:Math.abs(e[0].y-e[1].y)}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
return 1<i.length&&e.Geometry.isPointNearPolyline(t,i)},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this.cartesianPoint(0),i.pointerPosition))this._setDragPoint(0)
else{if(!e.Geometry.isPointNearPoint(this.cartesianPoint(1),i.pointerPosition))break
this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
1<e.length&&this.context.scxStrokePolyline(e,this.actualTheme.line),this.selected&&this._drawSelectionMarkers(e)}},i}(e.Drawing)
e.LineSegmentDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"rectangle"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:Math.min(e[0].x,e[1].x),top:Math.min(e[0].y,e[1].y),width:Math.abs(e[0].x-e[1].x),height:Math.abs(e[0].y-e[1].y)}},i.prototype._markerPoints=function(e){if(e||(e=this.bounds()),!e)return(e=this.cartesianPoint(0))&&[e]
var t=Math.round(e.left+e.width/2),i=Math.round(e.top+e.height/2),r=e.left+e.width,n=e.top+e.height
return[{x:e.left,y:e.top},{x:t,y:e.top},{x:r,y:e.top},{x:r,y:i},{x:r,y:n},{x:t,y:n},{x:e.left,y:n},{x:e.left,y:i}]},i.prototype._normalizePoints=function(){var e=this.bounds()
if(e){var t=this.projection,i=this.chartPoints
i[0].moveTo(e.left,e.top,t),i[1].moveTo(e.left+e.width,e.top+e.height,t)}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
return 1<i.length&&e.Geometry.isPointNearRectPoints(t,i[0],i[1])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:this._normalizePoints()
var r=this._markerPoints()
if(r&&1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this._updateCursor(),!0
break
case e.GestureState.CONTINUED:if(!(0>this._dragPoint)){var r=this.projection,n=this.chartPoints,o=i.pointerPosition
switch(this._dragPoint){case 0:n[0].moveTo(o.x,o.y,r)
break
case 1:n[0].moveToY(o.y,r)
break
case 2:n[0].moveToY(o.y,r),n[1].moveToX(o.x,r)
break
case 3:n[1].moveToX(o.x,r)
break
case 4:n[1].moveTo(o.x,o.y,r)
break
case 5:n[1].moveToY(o.y,r)
break
case 6:n[0].moveToX(o.x,r),n[1].moveToY(o.y,r)
break
case 7:n[0].moveToX(o.x,r)}return!0}}return!1},i.prototype._updateCursor=function(){var t
switch(this._dragPoint){case 0:case 4:t=e.DrawingCursorClass.RESIZE_NWSE
break
case 1:case 5:t=e.DrawingCursorClass.RESIZE_NS
break
case 2:case 6:t=e.DrawingCursorClass.RESIZE_NESW
break
case 3:case 7:t=e.DrawingCursorClass.RESIZE_EW}t&&this.changeCursor(t)},i.prototype.draw=function(){if(this.visible){var e=this.bounds(),t=this.context,i=this.actualTheme
e&&(t.beginPath(),t.rect(e.left,e.top,e.width,e.height),t.scxFillStroke(i.fill,i.line)),this.selected&&(e=this._markerPoints(e),this._drawSelectionMarkers(e))}},i}(e.Drawing)
e.RectangleDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"triangle"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 3},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
if(e.length<this.pointsNeeded)return null
var t=Math.min(e[0].x,e[1].x,e[2].x),i=Math.min(e[0].y,e[1].y,e[2].y)
return{left:t,top:i,width:Math.max(e[0].x,e[1].x,e[2].x)-t,height:Math.max(e[0].y,e[1].y,e[2].y)-i}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
return 1<i.length&&e.Geometry.isPointNearPolygon(t,i)},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:for(var r=this.cartesianPoints(),n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints(),t=this.context,i=this.actualTheme
if(1<e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y)
for(var r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y)
t.closePath(),t.scxFillStroke(i.fill,i.line)}this.selected&&this._drawSelectionMarkers(e)}},i}(e.Drawing)
e.TriangleDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"circle"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var t=this.cartesianPoints()
if(t.length<this.pointsNeeded)return null
var i=e.Geometry.length(t[0],t[1])
return{left:t[0].x-i,top:t[0].y-i,width:2*i,height:2*i}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
return 1<i.length&&e.Geometry.isPointNearCircle(t,i[0],i[1])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this._markerPoints()
if(r&&1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this._updateCursor(),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[1].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype._updateCursor=function(){var t
switch(this._dragPoint){case 0:case 2:t=e.DrawingCursorClass.RESIZE_EW
break
case 1:case 3:t=e.DrawingCursorClass.RESIZE_NS}t&&this.changeCursor(t)},i.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints(),i=this.context,r=this.actualTheme
if(1<t.length){var n=e.Geometry.length(t[0],t[1]),o=this._markerPoints(t)
i.beginPath(),i.arc(t[0].x,t[0].y,n,0,2*Math.PI),i.scxFillStroke(r.fill,r.line),this.selected&&this._drawSelectionMarkers(o)}}},i.prototype._markerPoints=function(t){if(t=t||this.cartesianPoints(),0===t.length)return null
var i=t[0]
return 1===t.length?[{x:i.x,y:i.y}]:(t=e.Geometry.length(t[0],t[1]),[{x:i.x-t,y:i.y},{x:i.x,y:i.y-t},{x:i.x+t,y:i.y},{x:i.x,y:i.y+t}])},i}(e.Drawing)
e.CircleDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"ellipse"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype._markerPoints=function(t){if(t=t||this.cartesianPoints(),0===t.length)return null
var i=t[0]
if(1===t.length)return[{x:i.x,y:i.y}]
var r=e.Geometry.xProjectionLength(t[0],t[1])
return t=e.Geometry.yProjectionLength(t[0],t[1]),[{x:i.x-r,y:i.y},{x:i.x,y:i.y-t},{x:i.x+r,y:i.y},{x:i.x,y:i.y+t}]},i.prototype.bounds=function(){var t=this.cartesianPoints()
if(t.length<this.pointsNeeded)return null
var i=e.Geometry.xProjectionLength(t[0],t[1]),r=e.Geometry.yProjectionLength(t[0],t[1])
return{left:t[0].x-i,top:t[0].y-r,width:2*i,height:2*r}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
return 1<i.length&&e.Geometry.isPointNearEllipse(t,i[0],i[1])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this._markerPoints()
if(r&&1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this._updateCursor(),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint){switch(this._dragPoint){case 0:case 2:this.chartPoints[1].moveToX(i.pointerPosition.x,this.projection)
break
case 1:case 3:this.chartPoints[1].moveToY(i.pointerPosition.y,this.projection)}return!0}}return!1},i.prototype._updateCursor=function(){var t
switch(this._dragPoint){case 0:case 2:t=e.DrawingCursorClass.RESIZE_EW
break
case 1:case 3:t=e.DrawingCursorClass.RESIZE_NS}t&&this.changeCursor(t)},i.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints(),i=this.context,r=this.actualTheme
if(1<t.length){var n=e.Geometry.xProjectionLength(t[0],t[1]),o=e.Geometry.yProjectionLength(t[0],t[1]),a=this._markerPoints(t)
i.beginPath(),i.save(),i.translate(t[0].x,t[0].y),n!==o&&i.scale(1,o/n),i.arc(0,0,n,0,2*Math.PI),i.restore(),i.closePath(),i.scxFillStroke(r.fill,r.line),this.selected&&this._drawSelectionMarkers(a)}}},i}(e.Drawing)
e.EllipseDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"horizontalLine"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"showValueMarker",{get:function(){var e=this._options.showValueMarker
return null!=e?e:i.defaults.showValueMarker},set:function(e){this._options.showValueMarker=!!e},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.chartPanel.contentFrame
return{left:t.left,top:e.y,width:t.width,height:1}},i.prototype.hitTest=function(t){var i=this.cartesianPoint(0)
return t&&e.Geometry.isValueNearValue(t.y,i.y)},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoint(0)
if(e){var t=this.context,i=this.chartPanel.contentFrame
t.beginPath(),t.moveTo(i.left,e.y),t.lineTo(i.right,e.y),t.scxStroke(this.actualTheme.line),t=Math.round(i.left+i.width/2),this.selected&&this._drawSelectionMarkers({x:t,y:e.y})}}},i.prototype.drawValueMarkers=function(){if(this.showValueMarker){var t=this.chartPoints[0]
if(t){var i=this.chart.valueMarker,r=this.actualTheme.line.strokeColor,n=this.panelValueScale,t=t.getValue(n.projection)
i.theme.fill.fillColor=r,i.theme.text.fillColor=e.HtmlUtil.isDarkColor(r)?"white":"black",i.draw(t,n)}}},i.defaults={showValueMarker:!0},i}(e.Drawing)
e.HorizontalLineDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"verticalLine"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"showDateMarker",{get:function(){var e=this._options.showDateMarker
return null!=e?e:i.defaults.showDateMarker},set:function(e){this._options.showDateMarker=!!e},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.chartPanel.contentFrame
return{left:e.x,top:t.top,width:1,height:t.height}},i.prototype.hitTest=function(t){var i=this.cartesianPoint(0)
return t&&e.Geometry.isValueNearValue(t.x,i.x)},i.prototype._handlePanGesture=function(e,t){return this.showDateMarker&&this.chart.dateScale.setNeedsUpdate(),!1},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoint(0)
if(e){var t=this.context,i=this.chartPanel.contentFrame
t.beginPath(),t.moveTo(e.x,0),t.lineTo(e.x,i.bottom-i.top),t.scxStroke(this.actualTheme.line),this.selected&&this._drawSelectionMarkers({x:e.x,y:Math.round(i.height/2)})}}},i.prototype.drawDateMarkers=function(){if(this.showDateMarker){var t=this.chartPoints[0]
if(t){var i=this.chart.dateMarker,t=t.getDate(this.projection),r=this.actualTheme.line.strokeColor,n=this.chart.dateScale
i.theme.fill.fillColor=r,i.theme.text.fillColor=e.HtmlUtil.isDarkColor(r)?"white":"black",i.theme.stroke.strokeColor=e.HtmlUtil.isDarkColor(r)?e.HtmlUtil.lighten(r,.5):e.HtmlUtil.lighten(r,-.5),i.draw(t,n)}}},i.defaults={showDateMarker:!0},i}(e.Drawing)
e.VerticalLineDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments),this._pointsNeeded=Number.MAX_VALUE}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"polygon"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return this._pointsNeeded},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
if(2>e.length)return null
var t=Math.max.apply(Math,e.map(function(e){return e.x})),i=Math.min.apply(Math,e.map(function(e){return e.x})),r=Math.max.apply(Math,e.map(function(e){return e.y})),e=Math.min.apply(Math,e.map(function(e){return e.y}))
return{left:i,top:r,width:Math.abs(t-i),height:Math.abs(r-e)}},i.prototype.hitTest=function(t){return e.Geometry.isPointNearPolygon(t,this.cartesianPoints())},i.prototype._handleUserDrawingPoint=function(t){var i=this.chartPoints.length
if(1<i){var i=this.cartesianPoint(i-1),r=new e.ChartPoint(t).toPoint(this.projection)
if(e.Geometry.isPointNearPoint(r,i))return this._finishUserDrawing(),!0}return this.appendChartPoint(t),!0},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:for(var r=this.cartesianPoints(),n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints(),t=this.context,i=this.actualTheme
if(1<e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y)
for(var r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y)
t.closePath(),t.scxFillStroke(i.fill,i.line)}this.selected&&this._drawSelectionMarkers(e)}},i}(e.Drawing)
e.PolygonDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"polyline"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return Number.MAX_VALUE},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
if(2>e.length)return null
var t=Math.max.apply(Math,e.map(function(e){return e.x})),i=Math.min.apply(Math,e.map(function(e){return e.x})),r=Math.max.apply(Math,e.map(function(e){return e.y})),e=Math.min.apply(Math,e.map(function(e){return e.y}))
return{left:i,top:r,width:Math.abs(t-i),height:Math.abs(r-e)}},i.prototype.hitTest=function(t){return e.Geometry.isPointNearPolyline(t,this.cartesianPoints())},i.prototype._handleUserDrawingPoint=function(t){var i=this.chartPoints.length
if(1<i){var i=this.cartesianPoint(i-1),r=new e.ChartPoint(t).toPoint(this.projection)
if(e.Geometry.isPointNearPoint(r,i))return this._finishUserDrawing(),!0}return this.appendChartPoint(t),!0},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:for(var r=this.cartesianPoints(),n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints(),t=this.context,i=this.actualTheme
if(1<e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y)
for(var r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y)
t.scxStroke(i.line)}this.selected&&this._drawSelectionMarkers(e)}},i}(e.Drawing)
e.PolylineDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments),this._drawingPoints=0}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"freeHand"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return Number.MAX_VALUE},enumerable:!0,configurable:!0}),i.prototype._handleUserDrawingPoint=function(e){return this._drawingPoints++,this.appendChartPoint(e),2<=this._drawingPoints&&this._finishUserDrawing(),!0},i.prototype._handleUserDrawingMoveGesture=function(e,t){var i=this.chartPoints.length
if(0<i){var r=t.pointerPosition,n=this._normalizeUserDrawingPoint(r),i=this.chartPoints[i-1]
Math.round(n.value)===Math.round(i.value)&&r.x===i.x||(this.appendChartPoint(n),this.chartPanel.setNeedsUpdate())}},i.prototype.bounds=function(){var e=this.cartesianPoints()
if(2>e.length)return null
var t=e.reduce(function(e,t){return Math.max(e,t.x)},-1/0),i=e.reduce(function(e,t){return Math.min(e,t.x)},1/0),r=e.reduce(function(e,t){return Math.max(e,t.y)},-1/0),e=e.reduce(function(e,t){return Math.min(e,t.y)},1/0)
return{left:i,top:e,width:Math.abs(t-i),height:Math.abs(r-e)}},i.prototype.hitTest=function(t){return e.Geometry.isPointNearPolyline(t,this.cartesianPoints())},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints(),t=this.context,i=this.actualTheme
t.beginPath(),t.moveTo(e[0].x,e[0].y)
for(var r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y)
t.scxStroke(i.line),this.selected&&this._drawSelectionMarkers([e[0],e[e.length-1]])}},i}(e.Drawing)
e.FreeHandDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t;(t=e.DrawingEvent||(e.DrawingEvent={})).TEXT_CHANGED="drawingTextChanged"
var i=function(i){function r(e){i.call(this,e),this._lines=[]}return __extends(r,i),Object.defineProperty(r,"className",{get:function(){return"text"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"text",{get:function(){return this._options.text||""},set:function(e){this._setOption("text",e||"",t.TEXT_CHANGED),this._updateLines()},enumerable:!0,configurable:!0}),r.prototype._updateLines=function(){this._lines=this.text.split("\n")},r.prototype.bounds=function(){var t=this.cartesianPoint(0)
if(!t)return null
var i=this._lines.reduce(function(e,t){return e.length>=t.length?e:t}),i=e.DummyCanvasContext.measureText(i,this.actualTheme.text)
return{left:t.x,top:t.y,width:i.width,height:i.height*this._lines.length}},r.prototype._finishUserDrawing=function(){var t=this
e.Drawing.prototype._finishUserDrawing.call(this),e.UI.ViewLoader.drawingSettingsDialog(function(e){e.show({chart:t.chart,drawing:t,cancel:function(){t.chartPanel.removeDrawings(t)},always:function(){t.chartPanel.setNeedsUpdate()}})})},r.prototype.hitTest=function(t){var i=this.bounds()
return i&&e.Geometry.isPointInsideOrNearRect(t,i)},r.prototype.loadState=function(e){i.prototype.loadState.call(this,e),this._updateLines()},r.prototype.draw=function(){if(this.visible){var t=this._lines
if(0!==t.length){var i=this.cartesianPoint(0)
if(i){var r=this.context,n=this.actualTheme.text
r.scxApplyTextTheme(n),r.textBaseline="middle",r.textAlign="left"
for(var o=this.bounds(),a=e.DummyCanvasContext.measureText(t[0],n).height,s=Math.round(a/2),l=i.y,c=0;c<t.length;c++)r.fillText(t[c],i.x,l),l+=s,"underline"===n.decoration&&(r.strokeStyle=n.fillColor,r.beginPath(),r.moveTo(i.x,l),r.lineTo(i.x+o.width,l),r.stroke()),l+=s
this.selected&&(l=(i.y+(i.y+o.height-a))/2,this._drawSelectionMarkers([{x:i.x-5,y:l},{x:i.x+o.width+5,y:l}]))}}}},r}(e.Drawing)
e.TextDrawing=i,e.Drawing.register(i)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t;(t=e.DrawingEvent||(e.DrawingEvent={})).URL_CHANGED="drawingUrlChanged"
var i=function(i){function r(e){var t=this
i.call(this,e),this._image=new Image,this._image.onload=function(){var e=t.chartPanel
e&&e.setNeedsUpdate()},this.url=e&&e.url}return __extends(r,i),Object.defineProperty(r,"className",{get:function(){return"image"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"url",{get:function(){return this._options.url||""},set:function(e){this._setOption("url",e,t.URL_CHANGED),this._reloadImage()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"size",{get:function(){return this._options.size},set:function(e){this._setOption("size",e,t.SIZE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"actualSize",{get:function(){var e=this.size
return e||((e=this._image)?{width:e.width,height:e.height}:null)},enumerable:!0,configurable:!0}),r.prototype._reloadImage=function(){this._image&&(this._image.src=this.url)},r.prototype.bounds=function(){var e=this.cartesianPoint(0)
if(!e)return null
var t=this.actualSize
return t?{left:e.x,top:e.y,width:t.width||10,height:t.height||10}:null},r.prototype._markerPoints=function(e){e||(e=this.cartesianPoint(0))
var t=e.x,i=e.y
if(0>=this._image.width)return{x:Math.round(t+5),y:Math.round(i+5)}
var r=this.actualSize,n=t+r.width,r=i+r.height,o=Math.round((t+n)/2),a=Math.round((i+r)/2)
return[e,{x:o,y:i},{x:n,y:i},{x:n,y:a},{x:n,y:r},{x:o,y:r},{x:t,y:r},{x:t,y:a}]},r.prototype._finishUserDrawing=function(){var t=this
i.prototype._finishUserDrawing.call(this),e.UI.ViewLoader.drawingSettingsDialog(function(e){e.show({chart:t.chart,drawing:t,cancel:function(){t.chartPanel.removeDrawings(t)},always:function(){t.chartPanel.setNeedsUpdate()}})})},r.prototype.hitTest=function(t){var i=this.bounds()
return i&&e.Geometry.isPointInsideOrNearRect(t,i)},r.prototype.loadState=function(e){i.prototype.loadState.call(this,e),this._reloadImage()},r.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this._markerPoints()
if(r&&1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this._updateCursor(),!0
break
case e.GestureState.CONTINUED:if(!(0>this._dragPoint)){var r=this.projection,n=this.chartPoints[0],o=i.pointerPosition,a=this.actualSize,s=t.moveOffset,l=n.toPoint(r)
switch(this._dragPoint){case 0:n.moveTo(o.x,o.y,r),a&&(a.width-=n.getX(r)-l.x,a.height-=n.getY(r)-l.y)
break
case 1:n.moveToY(o.y,r),a&&(a.height-=n.getY(r)-l.y)
break
case 2:n.moveToY(o.y,r),a&&(a.width+=s.x,a.height-=n.getY(r)-l.y)
break
case 3:a&&(a.width+=s.x)
break
case 4:a&&(a.width+=s.x,a.height+=s.y)
break
case 5:a&&(a.height+=s.y)
break
case 6:n.moveToX(o.x,r),a&&(a.width-=n.getX(r)-l.x,a.height+=s.y)
break
case 7:n.moveToX(o.x,r),a&&(a.width-=n.getX(r)-l.x)
break
default:return!0}return this.size=a,!0}}return!1},r.prototype._updateCursor=function(){var t
switch(this._dragPoint){case 0:case 4:t=e.DrawingCursorClass.RESIZE_NWSE
break
case 1:case 5:t=e.DrawingCursorClass.RESIZE_NS
break
case 2:case 6:t=e.DrawingCursorClass.RESIZE_NESW
break
case 3:case 7:t=e.DrawingCursorClass.RESIZE_EW}t&&this.changeCursor(t)},r.prototype.draw=function(){if(this.visible){var e=this.cartesianPoint(0)
if(e){var t=this.context,i=e.x,r=e.y
if(0<this._image.width){var n=this.size
n?(0>n.width&&(i+=n.width),0>n.height&&(r+=n.height),t.drawImage(this._image,i,r,Math.abs(n.width),Math.abs(n.height))):t.drawImage(this._image,i,r)}else t.beginPath(),t.rect(i,r,10,10),t.moveTo(i,r),t.lineTo(i+10,r+10),t.moveTo(i,r+10),t.lineTo(i+10,r),t.scxStroke({strokeColor:"red",width:1})
this.selected&&this._drawSelectionMarkers(this._markerPoints(e))}}},r}(e.Drawing)
e.ImageDrawing=i,e.Drawing.register(i)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(e){t.call(this,e),this._lines=[]}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"balloon"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){return this._options.text||""},set:function(t){this._setOption("text",t||"",e.DrawingEvent.TEXT_CHANGED),this._updateLines()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cornerRadius",{get:function(){return this._options.cornerRadius||this._defaults.corderRadius||i.defaults.corderRadius},set:function(t){if(t&&!e.JsUtil.isPositiveNumber(t))throw Error("Corder radius must be a positive number.")
this._options.cornerRadius=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"anchorSize",{get:function(){return this._options.anchorSize||this._defaults.anchorSize||i.defaults.anchorSize},set:function(e){this._options.anchorSize=e},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){if(!this._leftTopPoint||!this.cartesianPoint(0))return null
var e=this._leftTopPoint.x,t=this._leftTopPoint.y
return{left:e,top:t,width:Math.abs(this._rightBottomPoint.x-e),height:Math.abs(this._rightBottomPoint.y-t)}},i.prototype._finishUserDrawing=function(){var i=this
t.prototype._finishUserDrawing.call(this),e.UI.ViewLoader.drawingSettingsDialog(function(e){e.show({chart:i.chart,drawing:i,cancel:function(){i.chartPanel.removeDrawings(i)},always:function(){i.chartPanel.setNeedsUpdate()}})})},i.prototype.hitTest=function(t){var i=this.bounds()
return i&&e.Geometry.isPointInsideOrNearRect(t,i)},i.prototype.loadState=function(e){t.prototype.loadState.call(this,e),this._updateLines()},i.prototype.draw=function(){if(this.visible){var t=this.cartesianPoint(0)
if(t){var i=this._lines,r=i.reduce(function(e,t){return e.length>=t.length?e:t}),n=this.context,o=this.actualTheme,a=o.text,r=e.DummyCanvasContext.measureText(r,o.text),s=Math.ceil(r.width/2),l=this.cornerRadius,c=s+l,h=Math.ceil(this.anchorSize.width/2),u=this.anchorSize.height,d=t.y-u,u=d-r.height*i.length-u
n.beginPath(),n.moveTo(t.x,t.y),n.lineTo(t.x-h,d),n.lineTo(t.x-s,d)
var p=t.x-c
for(n.quadraticCurveTo(p,d,p,d-l),n.lineTo(p,u+l),n.quadraticCurveTo(p,u,t.x-s,u),n.lineTo(t.x+s,u),c=t.x+c,n.quadraticCurveTo(c,u,c,u+l),n.lineTo(c,d-l),n.quadraticCurveTo(c,d,t.x+s,d),n.lineTo(t.x+h,d),n.closePath(),n.scxFillStroke(o.fill,o.line),this._leftTopPoint={x:p,y:u},this._rightBottomPoint={x:c,y:t.y},n.scxApplyTextTheme(o.text),n.textBaseline="middle",n.textAlign="left",o=Math.round(u+2*r.height/3+1),l=0;l<i.length;l++)n.fillText(i[l],t.x-s,o),"underline"===a.decoration&&(n.strokeStyle=a.fillColor,n.beginPath(),n.moveTo(t.x-s,o+5*r.height/9-1),n.lineTo(t.x+s,o+5*r.height/9-1),n.stroke()),o+=r.height
this.selected&&this._drawSelectionMarkers(t)}}},i.prototype._updateLines=function(){this._lines=this.text.split("\n")},i.defaults={corderRadius:5,anchorSize:{width:10,height:10}},i}(e.Drawing)
e.BalloonDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.MeasureArrowDrawingMode={START:"start",END:"end",BOTH:"both"}
var t=function(t){function i(){t.apply(this,arguments),this._isYDirectionInverted=this._isXDirectionInverted=!1,this._yDirection=this._xDirection=1}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"measure"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cornerRadius",{get:function(){var e=this._options.cornerRadius
return null!=e?e:i.defaults.cornerRadius},set:function(t){if(t&&!e.JsUtil.isPositiveNumber(t))throw Error("Corder radius must be a positive number.")
this._options.cornerRadius=t},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:Math.min(e[0].x,e[1].x),top:Math.min(e[0].y,e[1].y),width:Math.abs(e[0].x-e[1].x),height:Math.abs(e[0].y-e[1].y)}},i.prototype._markerPoints=function(e){if(e||(e=this.bounds()),!e)return(e=this.cartesianPoint(0))&&[e]
var t=Math.round(e.left+e.width/2),i=Math.round(e.top+e.height/2),r=e.left+e.width,n=e.top+e.height
return[{x:e.left,y:e.top},{x:t,y:e.top},{x:r,y:e.top},{x:r,y:i},{x:r,y:n},{x:t,y:n},{x:e.left,y:n},{x:e.left,y:i}]},i.prototype._normalizePoints=function(){var e=this.bounds()
if(e){var t=this.projection,i=this.chartPoints
i[0].moveTo(e.left,e.top,t),i[1].moveTo(e.left+e.width,e.top+e.height,t)}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
return 1<i.length&&e.Geometry.isPointNearRectPoints(t,i[0],i[1])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this._markerPoints()
if(r&&1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._isXDirectionInverted=-1===this._xDirection,this._isYDirectionInverted=1===this._yDirection,this._normalizePoints(),this._setDragPoint(n),this._updateCursor(),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint){var r=this.projection,n=this.chartPoints,o=i.pointerPosition
switch(this._dragPoint){case 0:n[0].moveTo(o.x,o.y,r)
break
case 1:n[0].moveToY(o.y,r)
break
case 2:n[0].moveToY(o.y,r),n[1].moveToX(o.x,r)
break
case 3:n[1].moveToX(o.x,r)
break
case 4:n[1].moveTo(o.x,o.y,r)
break
case 5:n[1].moveToY(o.y,r)
break
case 6:n[0].moveToX(o.x,r),n[1].moveToY(o.y,r)
break
case 7:n[0].moveToX(o.x,r)}return!0}}return!1},i.prototype._updateCursor=function(){var t
switch(this._dragPoint){case 0:case 4:t=e.DrawingCursorClass.RESIZE_NWSE
break
case 1:case 5:t=e.DrawingCursorClass.RESIZE_NS
break
case 2:case 6:t=e.DrawingCursorClass.RESIZE_NESW
break
case 3:case 7:t=e.DrawingCursorClass.RESIZE_EW}t&&this.changeCursor(t)},i.prototype._duration=function(){var e=this.bounds()
if(!e)return""
var t=moment(this.projection.dateByX(e.left)),e=moment(this.projection.dateByX(e.left+e.width)),i="years",r=e.diff(t,i)
return 0===r&&(i="months",r=e.diff(t,i)),0===r&&(i="weeks",r=e.diff(t,i)),0===r&&(i="days",r=e.diff(t,i)),0===r&&(i="hours",r=e.diff(t,i)),0===r&&(i="minutes",r=e.diff(t,i)),0===r&&(i="seconds",r=e.diff(t,i)),r*=this._xDirection,moment.duration(r,i).humanize(!0).replace("in","")},i.prototype.draw=function(){if(this.visible){var t=this.bounds()
if(t){var i=Math.round(t.left+t.width/2),r=Math.round(t.top+t.height/2),n=this.context,o={x:t.left,y:r},a={x:t.left+t.width,y:r},s={x:i,y:t.top},r={x:i,y:t.top+t.height},i=this.actualTheme
n.beginPath(),n.rect(t.left,t.top,t.width,t.height),n.scxFillStroke(i.fill,i.border)
var l=this.chartPoints[0],c=this.chartPoints[1],h=this._isYDirectionInverted?l.y>c.y:l.y<c.y
this._xDirection=(this._isXDirectionInverted?l.x<c.x:l.x>c.x)?-1:1,this._yDirection=h?-1:1,h=1===this._yDirection?e.MeasureArrowDrawingMode.START:e.MeasureArrowDrawingMode.END,this._drawArrowHeadLine(o,a,1===this._xDirection?e.MeasureArrowDrawingMode.END:e.MeasureArrowDrawingMode.START),this._drawArrowHeadLine(s,r,h)
var a=this.projection,o=l.getValue(a),a=c.getValue(a),s=this.chart.barsBetweenPoints(l,c),l=this.panelValueScale.formatValue((o-a)*this._yDirection),c=e.DummyCanvasContext.measureText(l,i.balloon.text),o=(s*this._xDirection).toFixed()+" bars, "+this._duration(),a=e.DummyCanvasContext.measureText(o,i.balloon.text),s=Math.max(c.width,a.width)+2,r=r.x-s/2,h=t.top+t.height+4,u=h+c.height,d=u+c.height
this._drawRoundRect(r,h,s,c.height+a.height+2),n.scxApplyTextTheme(i.balloon.text),n.textBaseline="alphabetic",n.textAlign="left",n.fillText(l,r+3,u),n.fillText(o,r+3,d),this.selected&&this._drawSelectionMarkers(this._markerPoints(t))}}},i.prototype._drawArrowHeadLine=function(t,i,r){var n
n=this.context
var o=this.actualTheme
n.beginPath(),n.moveTo(t.x,t.y),n.lineTo(i.x,i.y),n.scxStroke(o.line),n=i.x-t.x
var o=i.y-t.y,a=(i.x>t.x?-90:90)*Math.PI/180
switch(r){case e.MeasureArrowDrawingMode.BOTH:r=Math.atan(o/n)+a,r===Math.PI&&(r=0),n=Math.atan(o/n)-a,0===n&&(n=Math.PI),this._drawArrow(t,r),this._drawArrow(i,n)
break
case e.MeasureArrowDrawingMode.START:r=Math.atan(o/n)+a,r===Math.PI&&(r=0),this._drawArrow(t,r)
break
case e.MeasureArrowDrawingMode.END:n=Math.atan(o/n)-a,0===n&&(n=Math.PI),this._drawArrow(i,n)}},i.prototype._drawArrow=function(e,t){var i=this.context,r=this.actualTheme
i.save(),i.beginPath(),i.translate(e.x,e.y),i.rotate(t),i.moveTo(0,0),i.lineTo(5,5),i.moveTo(0,0),i.lineTo(-5,5),i.closePath(),i.scxStroke(r.line),i.restore()},i.prototype._drawRoundRect=function(e,t,i,r,n){null==n&&(n=this.cornerRadius)
var o=this.context
i=e+(i+n),r=t+(r+n),o.beginPath(),o.moveTo(e+n,t),o.lineTo(i-n,t),o.quadraticCurveTo(i,t,i,t+n),o.lineTo(i,r-n),o.quadraticCurveTo(i,r,i-n,r),o.lineTo(e+n,r),o.quadraticCurveTo(e,r,e,r-n),o.lineTo(e,t+n),o.quadraticCurveTo(e,t,e+n,t),o.closePath(),e=this.actualTheme.balloon,o.scxFillStroke(e.fill,e.border)},i.defaults={cornerRadius:5},i}(e.Drawing)
e.MeasureDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),Object.defineProperty(t,"className",{get:function(){return"measureTool"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),t.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:Math.min(e[0].x,e[1].x),top:Math.min(e[0].y,e[1].y),width:Math.abs(e[0].x-e[1].x),height:Math.abs(e[0].y-e[1].y)}},t.prototype._createInfoControls=function(){if(!this._infoControls){var e=this.chartPanel.rootDiv.scxAppend("div","scxMeasureTool")
this._infoControls={rootDiv:e,firstPoint:e.scxAppend("div"),lastPoint:e.scxAppend("div"),range:e.scxAppend("div"),bars:e.scxAppend("div")}}},t.prototype._finishUserDrawing=function(){e.prototype._finishUserDrawing.call(this),this.remove()},t.prototype.remove=function(){return this._infoControls&&(this._infoControls.rootDiv.remove(),this._infoControls=null),e.prototype.remove.call(this)},t.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
0!==e.length&&(1<e.length&&this.context.scxStrokePolyline(e,this.actualTheme.line),this.selected&&this._drawSelectionMarkers(e),this._drawValues(e),this._drawInfo())}},t.prototype._drawValues=function(e){var t=this.context,i=this.projection,r=this.actualTheme,n=this._getSelectionMarkerWidth(r)+5,o=this.chartPoints,a=o[0].getValue(i),a=this.chartPanel.formatValue(a)
t.textBaseline="bottom",t.scxApplyTextTheme(r.text),t.fillText(a,e[0].x,e[0].y-n),1<o.length&&(i=o[1].getValue(i),i=this.chartPanel.formatValue(i),t.fillText(i,e[1].x,e[1].y-n))},t.prototype._drawInfo=function(){this._createInfoControls()
var e=this.actualTheme,t=this.projection,i=this._infoControls,r=this.chartPoints,n=this.chartPanel,o=n.chart.dateScale,a=r[0].getDate(t),s=r[0].getValue(t)
i.firstPoint.text(o.formatDate(a)+" "+n.formatValue(s)),1<r.length&&(a=r[1].getDate(t),t=r[1].getValue(t),i.lastPoint.text(o.formatDate(a)+" "+n.formatValue(t)),o=this.chart.instrument,s=t-s,o&&o.tickSize?i.range.text("Range (Pips) "+n.formatValue(s/o.tickSize)):i.range.text("Range "+n.formatValue(s)),r=this.chart.barsBetweenPoints(r[0],r[1]),i.bars.text("Bars "+r)),i.rootDiv.scxPosition(this.chartPanel.contentFrame.left,0).scxTextStyle(e.text).scxFill(e.fill)},t}(e.Drawing)
e.MeasureToolDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){e.FibonacciLevelTextHorPosition={LEFT:"left",CENTER:"center",RIGHT:"right"},e.FibonacciLevelTextVerPosition={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},e.FibonacciLevelLineExtension={NONE:"none",LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",BOTH:"both"}
var t,i={createPointBehavior:null,levels:[{value:.382},{value:.5},{value:.618},{value:1}],showTrendLine:!0,showLevelLines:!0,showLevelBackgrounds:!0,showLevelValues:!0,showLevelPrices:!0,showLevelPercents:!0,levelTextHorPosition:e.FibonacciLevelTextHorPosition.RIGHT,levelTextVerPosition:e.FibonacciLevelTextVerPosition.BOTTOM}
!function(e){e.LEVELS_CHANGED="drawingLevelsChanged",e.SHOW_TREND_LINE_CHANGED="drawingShowTrendLineChanged",e.SHOW_LEVEL_LINES_CHANGED="drawingShowLevelLinesChanged",e.SHOW_LEVEL_BACKGROUNDS_CHANGED="drawingShowLevelBackgroundsChanged",e.SHOW_LEVEL_VALUES_CHANGED="drawingShowLevelValuesChanged",e.SHOW_LEVEL_PRICES_CHANGED="drawingShowLevelPricesChanged",e.SHOW_LEVEL_PERCENTS_CHANGED="drawingShowLevelPercentsChanged",e.LEVEL_TEXT_HOR_POSITION_CHANGED="drawingLevelTextHorPositionChanged",e.LEVEL_TEXT_VER_POSITION_CHANGED="drawingLevelTextVerPositionChanged",e.LEVEL_LINES_EXTENSION_CHANGED="drawingLevelLinesExtensionChanged",e.REVERSE_CHANGED="drawingReverseChanged"}(t=e.DrawingEvent||(e.DrawingEvent={}))
var r=function(r){function n(e){r.call(this,e),this._textOffset=2}return __extends(n,r),Object.defineProperty(n,"subClassName",{get:function(){return"fibonacci"},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"levels",{get:function(){return this._optionValue("levels")||n.defaults.levels},set:function(e){if(null!=e&&!Array.isArray(e))throw new TypeError("Levels must be an array of numbers.")
for(var i=0,r=e.length;i<r-1;i++)for(var n=i+1;n<r;n++)if(e[i].value>e[n].value){var o=e[i]
e[i]=e[n],e[n]=o}this._options.levels=e,this.fire(t.LEVELS_CHANGED,e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showTrendLine",{get:function(){var e=this._optionValue("showTrendLine")
return null!=e?e:n.defaults.showTrendLine},set:function(e){this._setOption("showTrendLine",e,t.SHOW_TREND_LINE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelLines",{get:function(){var e=this._optionValue("showLevelLines")
return null!=e?e:n.defaults.showLevelLines},set:function(e){this._setOption("showLevelLines",e,t.SHOW_LEVEL_LINES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelBackgrounds",{get:function(){var e=this._optionValue("showLevelBackgrounds")
return null!=e?e:n.defaults.showLevelBackgrounds},set:function(e){this._setOption("showLevelBackgrounds",e,t.SHOW_LEVEL_BACKGROUNDS_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelValues",{get:function(){var e=this._optionValue("showLevelValues")
return null!=e?e:n.defaults.showLevelValues},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevels",{set:function(e){this._setOption("showLevelValues",e,t.SHOW_LEVEL_VALUES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelPrices",{get:function(){var e=this._optionValue("showLevelPrices")
return null!=e?e:n.defaults.showLevelPrices},set:function(e){this._setOption("showLevelPrices",e,t.SHOW_LEVEL_PRICES_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showLevelPercents",{get:function(){var e=this._optionValue("showLevelPercents")
return null!=e?e:n.defaults.showLevelPercents},set:function(e){this._setOption("showLevelPercents",e,t.SHOW_LEVEL_PERCENTS_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"levelTextHorPosition",{get:function(){var e=this._optionValue("levelTextHorPosition")
return null!=e?e:n.defaults.levelTextHorPosition},set:function(e){this._setOption("levelTextHorPosition",e,t.LEVEL_TEXT_HOR_POSITION_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"levelTextVerPosition",{get:function(){var e=this._optionValue("levelTextVerPosition")
return null!=e?e:n.defaults.levelTextVerPosition},set:function(e){this._setOption("levelTextVerPosition",e,t.LEVEL_TEXT_VER_POSITION_CHANGED)},enumerable:!0,configurable:!0}),n.prototype._showSettingsDialog=function(){var t=this
e.UI.ViewLoader.fibonacciDrawingSettingsDialog(function(e){e.show({chart:t.chart,drawing:t})})},n.prototype._applyTextPosition=function(){var t,i,r=this.context
switch(this.levelTextVerPosition){case e.FibonacciLevelTextVerPosition.MIDDLE:t="middle"
break
case e.FibonacciLevelTextVerPosition.TOP:t="bottom"
break
case e.FibonacciLevelTextVerPosition.BOTTOM:t="top"
break
default:throw Error("Unsupported level text vertical position: "+this.levelTextVerPosition)}switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.CENTER:i="center"
break
case e.FibonacciLevelTextHorPosition.LEFT:i="right"
break
case e.FibonacciLevelTextHorPosition.RIGHT:i="left"
break
default:throw Error("Unsupported level text horizontal position: "+this.levelTextHorPosition)}r.textBaseline=t,r.textAlign=i},n.prototype._isLevelVisible=function(e){return null==e.visible||e.visible},n.prototype._adjustXWithTextOffset=function(t){switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.LEFT:return t-this._textOffset
case e.FibonacciLevelTextHorPosition.RIGHT:return t+this._textOffset
default:return t}},n.prototype._adjustYWithTextOffset=function(t){switch(this.levelTextVerPosition){case e.FibonacciLevelTextVerPosition.TOP:return t-this._textOffset
case e.FibonacciLevelTextVerPosition.BOTTOM:return t+this._textOffset
default:return t}},n.defaults=i,n}(e.Drawing)
e.FibonacciDrawingBase=r}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"fibonacciArcs"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var t=this.cartesianPoints()
if(t.length<this.pointsNeeded)return null
var i=e.Geometry.length(t[0],t[1])
return{left:t[0].x-i,top:t[0].y-i,width:2*i,height:2*i}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
if(i.length<this.pointsNeeded)return!1
if(this.showTrendLine&&e.Geometry.isPointNearPolyline(t,i))return!0
if(this.showLevelLines||this.showLevelBackgrounds)for(var r=e.Geometry.length(i[0],i[1]),n=0,o=this.levels;n<o.length;n++){var a=o[n]
if(this._isLevelVisible(a)&&e.Geometry.isPointNearCircle(t,i[0],Math.round(r*a.value)))return!0}return this.selected&&e.Geometry.isPointNearPoint(t,i)},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoint(1)
if(r&&e.Geometry.isPointNearPoint(i.pointerPosition,r))return this._setDragPoint(1),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(1===this._dragPoint)return this.chartPoints[1].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints()
if(0!==t.length){var i=this.context,r=this.actualTheme
if(1<t.length){var n=e.Geometry.length(t[0],t[1]),o=t[0].x,a=t[0].y,s=void 0
this._applyTextPosition()
for(var l=0,c=this.levels;l<c.length;l++){var h=c[l]
if(this._isLevelVisible(h)){var u=h.theme?h.theme:r,d=Math.round(n*h.value)
if(this.showLevelBackgrounds){var p=u.fill||r.fill
i.beginPath(),i.arc(o,a,d,0,2*Math.PI,!0),s?(i.arc(o,a,s,0,2*Math.PI,!0),i.scxApplyFillTheme(p),i.fill("evenodd")):i.scxFill(p)}this.showLevelLines&&(i.beginPath(),i.arc(o,a,d,0,2*Math.PI),i.scxStroke(u.line||r.line)),this.showLevelValues&&(s=this.showLevelPercents?Number(100*h.value).toFixed(2)+"%":Number(h.value).toFixed(3),i.scxApplyTextTheme(u.text||r.text),i.fillText(s,o,a+d)),s=d}}this.showTrendLine&&i.scxStrokePolyline(t,r.trendLine)}this.selected&&this._drawSelectionMarkers(t)}}},i}(e.FibonacciDrawingBase)
e.FibonacciArcsDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"fibonacciEllipses"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var t=this.cartesianPoints()
if(t.length<this.pointsNeeded)return null
var i=e.Geometry.xProjectionLength(t[0],t[1]),r=e.Geometry.yProjectionLength(t[0],t[1])
return{left:t[0].x-i,top:t[0].y-r,width:2*i,height:2*r}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
if(i.length<this.pointsNeeded)return!1
if(this.showTrendLine&&e.Geometry.isPointNearPolyline(t,i))return!0
if(this.showLevelLines||this.showLevelBackgrounds)for(var r=e.Geometry.xProjectionLength(i[0],i[1]),n=e.Geometry.yProjectionLength(i[0],i[1]),o=0,a=this.levels;o<a.length;o++){var s=a[o]
if(this._isLevelVisible(s)&&e.Geometry.isPointNearEllipseWithRadiuses(t,i[0],Math.round(r*s.value),Math.round(n*s.value)))return!0}return this.selected&&e.Geometry.isPointNearPoint(t,i)},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoint(1)
if(r&&e.Geometry.isPointNearPoint(i.pointerPosition,r))return this._setDragPoint(1),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(1===this._dragPoint)return this.chartPoints[1].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints()
if(0!==t.length){var i=this.context,r=this.actualTheme
if(1<t.length){var n=t[0].x,o=t[0].y,a=e.Geometry.xProjectionLength(t[0],t[1]),s=e.Geometry.yProjectionLength(t[0],t[1]),l=void 0
this._applyTextPosition()
for(var c=0,h=this.levels;c<h.length;c++){var u=h[c]
if(this._isLevelVisible(u)){var d=u.theme?u.theme:r,p=Math.round(a*u.value),f=Math.round(s*u.value)
if(this.showLevelBackgrounds){var m=d.fill||r.fill
i.save(),i.beginPath(),i.translate(n,o),p!==f&&i.scale(1,f/p),i.arc(0,0,p,0,2*Math.PI,!1),l?(i.arc(0,0,l,0,2*Math.PI,!1),i.scxApplyFillTheme(m),i.fill("evenodd")):i.scxFill(m),i.restore(),l=p}this.showLevelLines&&(i.beginPath(),i.save(),i.translate(n,o),p!==f&&i.scale(1,f/p),i.arc(0,0,p,0,2*Math.PI),i.restore(),i.scxStroke(d.line||r.line)),this.showLevelValues&&(u=this.showLevelPercents?Number(100*u.value).toFixed(2)+"%":Number(u.value).toFixed(3),i.scxApplyTextTheme(d.text||r.text),i.fillText(u,n,o+f))}}this.showTrendLine&&i.scxStrokePolyline(t,r.trendLine)}this.selected&&this._drawSelectionMarkers(t)}}},i}(e.FibonacciDrawingBase)
e.FibonacciEllipsesDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t={levels:[{value:0},{value:.2361},{value:.382},{value:.5},{value:.618},{value:.764},{value:1}],reverse:!1,levelTextVerPosition:e.FibonacciLevelTextVerPosition.MIDDLE,levelLinesExtension:e.FibonacciLevelLineExtension.NONE},i=function(i){function r(){i.apply(this,arguments)}return __extends(r,i),Object.defineProperty(r,"className",{get:function(){return"fibonacciRetracements"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"reverse",{get:function(){var e=this._optionValue("reverse")
return null!=e?e:r.defaults.reverse},set:function(t){this._setOption("reverse",t,e.DrawingEvent.REVERSE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"levelLinesExtension",{get:function(){var e=this._optionValue("levelLinesExtension")
return null!=e?e:r.defaults.levelLinesExtension},set:function(t){this._setOption("levelLinesExtension",t,e.DrawingEvent.LEVEL_LINES_EXTENSION_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),r.prototype.bounds=function(){var t=this.cartesianPoints()
if(t.length<this.pointsNeeded)return null
var i=e.Geometry.length(t[0],t[1])
return{left:t[0].x-i,top:t[0].y-i,width:2*i,height:2*i}},r.prototype.hitTest=function(t){var i=this.cartesianPoints()
if(i.length<this.pointsNeeded)return!1
if(this.showTrendLine&&e.Geometry.isPointNearPolyline(t,i))return!0
if(this.showLevelLines||this.showLevelBackgrounds)for(var r=this._linesXRange(i),n=0,o=this.levels;n<o.length;n++){var a=o[n]
if(this._isLevelVisible(a)&&(a=this.reverse?Math.round((i[0].y-i[1].y)*a.value+i[1].y):Math.round((i[1].y-i[0].y)*a.value+i[0].y),e.Geometry.isPointNearLine(t,{x:r.min,y:a},{x:r.max,y:a})))return!0}return this.selected&&e.Geometry.isPointNearPoint(t,i)},r.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoints()
if(1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},r.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints()
if(0!==t.length){var i=this.context,r=this.actualTheme
if(1<t.length){var n=this._linesXRange(t),o=void 0,a=void 0
if(this.showLevelValues){switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.CENTER:a=(n.min+n.max)/2
break
case e.FibonacciLevelTextHorPosition.LEFT:a=n.min
break
case e.FibonacciLevelTextHorPosition.RIGHT:a=n.max
break
default:throw Error("Unknown text horizontal position: "+this.levelTextHorPosition)}a=this._adjustXWithTextOffset(a),this._applyTextPosition()}for(var s=0,l=this.levels;s<l.length;s++){var c=l[s]
if(this._isLevelVisible(c)){var h=c.theme?c.theme:r,u=this.reverse?Math.round((t[0].y-t[1].y)*c.value+t[1].y):Math.round((t[1].y-t[0].y)*c.value+t[0].y)
if(this.showLevelBackgrounds&&(o&&(i.beginPath(),i.moveTo(n.min,o),i.lineTo(n.max,o),i.lineTo(n.max,u),i.lineTo(n.min,u),i.closePath(),i.scxFill(h.fill||r.fill)),o=u),this.showLevelLines&&(i.beginPath(),i.moveTo(n.min,u),i.lineTo(n.max,u),i.scxStroke(h.line||r.line)),this.showLevelValues){if(c=this.showLevelPercents?Number(100*c.value).toFixed(2)+"%":Number(c.value).toFixed(3),this.showLevelPrices)var d=Number(this.projection.valueByY(u)).toFixed(3),c=c+" ("+d+")"
switch(i.scxApplyTextTheme(h.text||r.text),h=this.levelLinesExtension,d=e.FibonacciLevelLineExtension,this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.RIGHT:h!==d.RIGHT&&h!==d.BOTH||(i.textAlign=e.FibonacciLevelTextHorPosition.RIGHT)
break
case e.FibonacciLevelTextHorPosition.LEFT:h!==d.LEFT&&h!==d.BOTH||(i.textAlign=e.FibonacciLevelTextHorPosition.LEFT)}i.fillText(c,a,this._adjustYWithTextOffset(u))}}}}1<t.length&&this.showTrendLine&&i.scxStrokePolyline(t,r.trendLine),this.selected&&this._drawSelectionMarkers(t)}}},r.prototype._linesXRange=function(t){var i=this.chartPanel.contentFrame,r=Math.min(t[0].x,t[1].x)
switch(t=Math.max(t[0].x,t[1].x),this.levelLinesExtension){case e.FibonacciLevelLineExtension.NONE:break
case e.FibonacciLevelLineExtension.LEFT:r=i.left
break
case e.FibonacciLevelLineExtension.RIGHT:t=i.right
break
case e.FibonacciLevelLineExtension.BOTH:r=i.left,t=i.right
break
default:throw Error("Unknown level lines extension: "+this.levelLinesExtension)}return{min:r,max:t}},r.prototype._adjustXWithTextOffset=function(t){var i=e.FibonacciLevelLineExtension,r=this.levelLinesExtension
switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.LEFT:t=r===i.LEFT||r===i.BOTH?t+this._textOffset:t-this._textOffset
break
case e.FibonacciLevelTextHorPosition.RIGHT:t=r===i.RIGHT||r===i.BOTH?t-this._textOffset:t+this._textOffset}return t},r.defaults=t,r}(e.FibonacciDrawingBase)
e.FibonacciRetracementsDrawing=i,e.Drawing.register(i)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}
!function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"fibonacciFan"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:e[0].x,top:e[0].y,width:e[1].x-e[0].x,height:e[1].y-e[0].y}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
if(i.length<this.pointsNeeded)return!1
var r=i[0].x,n=i[0].y,o=i[1].x,a=i[1].y,s=this.chartPanel.contentFrame.right
if(this.showTrendLine&&e.Geometry.isPointNearPolyline(t,i))return!0
if(this.showLevelLines||this.showLevelBackgrounds)for(var l=0,c=this.levels;l<c.length;l++){var h=c[l]
if(this._isLevelVisible(h)&&e.Geometry.isPointNearLine(t,{x:r,y:n},{x:s,y:Math.round(n+(s-r)*(Math.round((n-a)*h.value+a)-n)/(o-r))}))return!0}return this.selected&&e.Geometry.isPointNearPoint(t,i[1])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoints()
if(1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints()
if(0!==t.length){var i=this.context,r=this.actualTheme
if(1<t.length){var n=t[0].x,o=t[0].y,a=t[1].x,s=t[1].y,l=this.chartPanel.contentFrame,c=n>a,l=c?l.left:l.right,h=[]
switch(this.levelTextVerPosition){case e.FibonacciLevelTextVerPosition.MIDDLE:i.textBaseline="middle"
break
case e.FibonacciLevelTextVerPosition.TOP:i.textBaseline="bottom"
break
case e.FibonacciLevelTextVerPosition.BOTTOM:i.textBaseline="top"
break
default:throw Error("Unsupported level text vertical position: "+this.levelTextVerPosition)}i.textAlign=c?"left":"right"
for(var u=0,d=this.levels;u<d.length;u++){var p=d[u]
if(this._isLevelVisible(p)){var f=p.theme?p.theme:r,m=Math.round(o+(l-n)*(Math.round((o-s)*p.value+s)-o)/(a-n))
if(this.showLevelBackgrounds&&(2===h.length?(i.beginPath(),i.moveTo(h[0].x,h[0].y),i.lineTo(h[1].x,h[1].y),i.lineTo(n,o),i.lineTo(l,m),i.closePath(),i.scxFill(f.fill||r.fill),h[0]={x:l,y:m},h[1]={x:n,y:o}):(h.push({x:l,y:m}),h.push({x:n,y:o}))),this.showLevelLines&&(i.beginPath(),i.moveTo(n,o),i.lineTo(l,m),i.scxStroke(f.line||r.line)),this.showLevelValues){var p=this.showLevelPercents?Number(100*p.value).toFixed(2)+"%":Number(p.value).toFixed(3),v=c?l+3:l-3
if(this.showLevelPrices)var g=Number(this.projection.valueByY(m)).toFixed(3),p=p+" ("+g+")"
i.scxApplyTextTheme(f.text||r.text),i.fillText(p,v,m)}}}}1<t.length&&this.showTrendLine&&i.scxStrokePolyline(t,r.trendLine),this.selected&&this._drawSelectionMarkers(t)}}},i.defaults={levels:[{value:.382},{value:.5},{value:.618}],levelTextVerPosition:e.FibonacciLevelTextVerPosition.MIDDLE},i}(e.FibonacciDrawingBase)
e.FibonacciFanDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t={levels:[{value:0},{value:1},{value:2},{value:3},{value:8},{value:8},{value:21},{value:34},{value:55},{value:89}],levelLinesExtension:e.FibonacciLevelLineExtension.BOTH},i=function(i){function r(){i.apply(this,arguments)}return __extends(r,i),Object.defineProperty(r,"className",{get:function(){return"fibonacciTimeZones"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"levelLinesExtension",{get:function(){var e=this._optionValue("levelLinesExtension")
return null!=e?e:r.defaults.levelLinesExtension},set:function(t){this._setOption("levelLinesExtension",t,e.DrawingEvent.LEVEL_LINES_EXTENSION_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),r.prototype.bounds=function(){var t=this.cartesianPoints()
if(t.length<this.pointsNeeded)return null
var i=e.Geometry.length(t[0],t[1])
return{left:t[0].x-i,top:t[0].y-i,width:2*i,height:2*i}},r.prototype.hitTest=function(t){var i=this.cartesianPoints()
if(2>i.length)return!1
if(this.showTrendLine&&e.Geometry.isPointNearPolyline(t,i))return!0
if(this.showLevelLines||this.showLevelBackgrounds)for(var r=this._linesYRange(i),n=0,o=this.levels;n<o.length;n++){var a=o[n]
if(this._isLevelVisible(a)&&(a=Math.round((i[1].x-i[0].x)*a.value+i[0].x),e.Geometry.isPointNearLine(t,{x:a,y:r.max},{x:a,y:r.min})))return!0}return this.selected&&e.Geometry.isPointNearPoint(t,i)},r.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoints()
if(1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},r.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints()
if(0!==t.length){var i=this.context,r=this.actualTheme
if(1<t.length){var n=this._linesYRange(t),o=void 0,a=void 0
if(this.showLevelValues)switch(this._applyTextPosition(),this.levelTextVerPosition){case e.FibonacciLevelTextVerPosition.MIDDLE:a=(n.min+n.max)/2
break
case e.FibonacciLevelTextVerPosition.TOP:a=n.min,i.textBaseline="top"
break
case e.FibonacciLevelTextVerPosition.BOTTOM:a=n.max,i.textBaseline="bottom"}for(var s=0,l=this.levels;s<l.length;s++){var c=l[s]
if(this._isLevelVisible(c)){var h=c.theme?c.theme:r,u=Math.round((t[1].x-t[0].x)*c.value+t[0].x)
this.showLevelBackgrounds&&(o&&(i.beginPath(),i.moveTo(o,n.min),i.lineTo(o,n.max),i.lineTo(u,n.max),i.lineTo(u,n.min),i.closePath(),i.scxFill(h.fill||r.fill)),o=u),this.showLevelLines&&(i.beginPath(),i.moveTo(u,n.min),i.lineTo(u,n.max),i.scxStroke(h.line||r.line)),this.showLevelValues&&(c=Number(c.value).toFixed(0),i.scxApplyTextTheme(h.text||r.text),i.fillText(c,this._adjustXWithTextOffset(u),a))}}}1<t.length&&this.showTrendLine&&i.scxStrokePolyline(t,r.trendLine),this.selected&&this._drawSelectionMarkers(t)}}},r.prototype._linesYRange=function(t){var i=this.chartPanel.contentFrame,r=Math.max(t[0].y,t[1].y)
switch(t=Math.min(t[0].y,t[1].y),this.levelLinesExtension){case e.FibonacciLevelLineExtension.NONE:break
case e.FibonacciLevelLineExtension.TOP:t=0
break
case e.FibonacciLevelLineExtension.BOTTOM:r=i.height
break
case e.FibonacciLevelLineExtension.BOTH:t=0,r=i.height
break
default:throw Error("Unknown level lines extension: "+this.levelLinesExtension)}return{min:t,max:r}},r.defaults=t,r}(e.FibonacciDrawingBase)
e.FibonacciTimeZonesDrawing=i,e.Drawing.register(i)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t={levels:[{value:0},{value:.2361},{value:.382},{value:.5},{value:.618},{value:.764},{value:1},{value:1.618},{value:2.618},{value:3.618},{value:4.236}],reverse:!1,levelTextVerPosition:e.FibonacciLevelTextVerPosition.MIDDLE,levelLinesExtension:e.FibonacciLevelLineExtension.NONE},i=function(i){function r(){i.apply(this,arguments)}return __extends(r,i),Object.defineProperty(r,"className",{get:function(){return"fibonacciExtensions"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"reverse",{get:function(){var e=this._optionValue("reverse")
return null!=e?e:r.defaults.reverse},set:function(t){this._setOption("reverse",t,e.DrawingEvent.REVERSE_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"levelLinesExtension",{get:function(){var e=this._optionValue("levelLinesExtension")
return null!=e?e:r.defaults.levelLinesExtension},set:function(t){this._setOption("levelLinesExtension",t,e.DrawingEvent.LEVEL_LINES_EXTENSION_CHANGED)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"pointsNeeded",{get:function(){return 3},enumerable:!0,configurable:!0}),r.prototype.bounds=function(){var t=this.cartesianPoints()
if(t.length<this.pointsNeeded)return null
var i=e.Geometry.length(t[0],t[1])
return{left:t[1].x-i,top:t[1].y-i,width:2*i,height:2*i}},r.prototype.hitTest=function(t){var i=this.cartesianPoints()
if(i.length<this.pointsNeeded)return!1
if(this.showTrendLine&&e.Geometry.isPointNearPolyline(t,i))return!0
if(this.showLevelLines||this.showLevelBackgrounds)for(var r=this._linesXRange(i),n=0,o=this.levels;n<o.length;n++){var a=o[n]
if(this._isLevelVisible(a)&&(a=this.reverse?Math.round((i[0].y-i[1].y)*a.value+i[2].y):Math.round((i[1].y-i[0].y)*a.value+i[2].y),e.Geometry.isPointNearLine(t,{x:r.min,y:a},{x:r.max,y:a})))return!0}return this.selected&&e.Geometry.isPointNearPoint(t,i)},r.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoints()
if(1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},r.prototype.draw=function(){if(this.visible){var t=this.cartesianPoints()
if(0!==t.length){var i=this.context,r=this.actualTheme
if(2<t.length){var n=this._linesXRange(t),o=void 0,a=void 0
if(this.showLevelValues){switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.CENTER:o=(n.min+n.max)/2
break
case e.FibonacciLevelTextHorPosition.LEFT:o=n.min
break
case e.FibonacciLevelTextHorPosition.RIGHT:o=n.max
break
default:throw Error("Unknown text horizontal position: "+this.levelTextHorPosition)}o=this._adjustXWithTextOffset(o),this._applyTextPosition()}for(var s=0,l=this.levels;s<l.length;s++){var c=l[s]
if(this._isLevelVisible(c)){var h=c.theme?c.theme:r,u=this.reverse?Math.round((t[0].y-t[1].y)*c.value+t[2].y):Math.round((t[1].y-t[0].y)*c.value+t[2].y)
if(this.showLevelBackgrounds&&(a&&(i.beginPath(),i.moveTo(n.min,a),i.lineTo(n.max,a),i.lineTo(n.max,u),i.lineTo(n.min,u),i.closePath(),i.scxFill(h.fill||r.fill)),a=u),this.showLevelLines&&(i.beginPath(),i.moveTo(n.min,u),i.lineTo(n.max,u),i.scxStroke(h.line||r.line)),this.showLevelValues){if(c=this.showLevelPercents?Number(100*c.value).toFixed(2)+"%":Number(c.value).toFixed(3),this.showLevelPrices)var d=Number(this.projection.valueByY(u)).toFixed(3),c=c+" ("+d+")"
var d=this.levelLinesExtension,p=e.FibonacciLevelLineExtension
switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.RIGHT:d!==p.RIGHT&&d!==p.BOTH||(i.textAlign=e.FibonacciLevelTextHorPosition.RIGHT)
break
case e.FibonacciLevelTextHorPosition.LEFT:d!==p.LEFT&&d!==p.BOTH||(i.textAlign=e.FibonacciLevelTextHorPosition.LEFT)}i.scxApplyTextTheme(h.text||r.text),i.fillText(c,o,this._adjustYWithTextOffset(u))}}}}1<t.length&&this.showTrendLine&&i.scxStrokePolyline(t,r.trendLine),this.selected&&this._drawSelectionMarkers(t)}}},r.prototype._linesXRange=function(t){var i=this.chartPanel.contentFrame,r=Math.min(t[1].x,t[2].x)
switch(t=Math.max(t[1].x,t[2].x),this.levelLinesExtension){case e.FibonacciLevelLineExtension.NONE:break
case e.FibonacciLevelLineExtension.LEFT:r=i.left
break
case e.FibonacciLevelLineExtension.RIGHT:t=i.right
break
case e.FibonacciLevelLineExtension.BOTH:r=i.left,t=i.right
break
default:throw Error("Unknown level lines extension: "+this.levelLinesExtension)}return{min:r,max:t}},r.prototype._adjustXWithTextOffset=function(t){var i=e.FibonacciLevelLineExtension,r=this.levelLinesExtension
switch(this.levelTextHorPosition){case e.FibonacciLevelTextHorPosition.LEFT:t=r===i.LEFT||r===i.BOTH?t+this._textOffset:t-this._textOffset
break
case e.FibonacciLevelTextHorPosition.RIGHT:t=r===i.RIGHT||r===i.BOTH?t-this._textOffset:t+this._textOffset}return t},r.defaults=t,r}(e.FibonacciDrawingBase)
e.FibonacciExtensionsDrawing=i,e.Drawing.register(i)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"andrewsPitchfork"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 3},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:e[0].x,top:e[0].y,width:e[1].x-e[0].x,height:e[1].y-e[0].y}},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
if(3>i.length)return!1
var r=i[0],n=i[1],i=i[2],o=r.x,a=r.y,s=n.x,l=n.y,c=i.x,h=i.y,u=(c-s)/2+s,d=(h-l)/2+l,p=s-(o-u),f=l-(a-d),m=c-(o-u),v=h-(a-d),g=Math.sqrt(o*u+a*d),o={x:o+(u-o)*g,y:a+(d-a)*g},a=Math.sqrt(s*p+l*f),s={x:s+(p-s)*a,y:l+(f-l)*a},l=Math.sqrt(c*m+h*v),c={x:c+(m-c)*l,y:h+(v-h)*l}
return e.Geometry.isPointNearLine(t,n,i)||e.Geometry.isPointNearLine(t,r,o)||e.Geometry.isPointNearLine(t,n,s)||e.Geometry.isPointNearLine(t,i,c)},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoints()
if(1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
if(0!==e.length){var t=this.context,i=this.actualTheme
if(2<e.length){var r=e[0].x,n=e[0].y,o=e[1].x,a=e[1].y,s=e[2].x,l=e[2].y,c=(s-o)/2+o,h=(l-a)/2+a,u=o-(r-c),d=a-(n-h),p=s-(r-c),f=l-(n-h),m=Math.sqrt(r*c+n*h),c=r+(c-r)*m,h=n+(h-n)*m,m=Math.sqrt(o*u+a*d),u=o+(u-o)*m,d=a+(d-a)*m,m=Math.sqrt(s*p+l*f),p=s+(p-s)*m,f=l+(f-l)*m
t.beginPath(),t.moveTo(r,n),t.lineTo(c,h),t.moveTo(o,a),t.lineTo(u,d),t.moveTo(s,l),t.lineTo(p,f),t.moveTo(o,a),t.lineTo(s,l),t.scxStroke(i.line)}else 1<e.length&&t.scxStrokePolyline(e,i.line)
this.selected&&this._drawSelectionMarkers(e)}}},i}(e.Drawing)
e.AndrewsPitchforkDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"trendChannel"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:e[0].x,top:e[0].y,width:e[1].x-e[0].x,height:e[1].y-e[0].y}},i.prototype._finishUserDrawing=function(){t.prototype._finishUserDrawing.call(this)
var i=this.cartesianPoints(),i=e.ChartPoint.convert({x:i[0].x,y:i[0].y-20},this.createPointBehavior,this.projection)
this.appendChartPoint(i)},i.prototype.hitTest=function(t){var i=this.cartesianPoints()
if(i.length<this.pointsNeeded)return!1
var r=i[0].x,n=i[0].y,o=i[1].x,a=i[1].y,s=i[2].x,i=i[2].y,l=s+(o-r),c=a+(i-n),h=r-(s-r),u=n-(i-n),d=h+(o-r),p=a-(i-n),f=Math.sqrt(r*o+n*a),m=Math.sqrt(s*l+i*c),l=Math.round(s+(l-s)*m),c=Math.round(i+(c-i)*m),m=Math.sqrt(h*d+u*p),d=Math.round(h+(d-h)*m),p=Math.round(u+(p-u)*m)
return e.Geometry.isPointNearLine(t,{x:r,y:n},{x:Math.round(r+(o-r)*f),y:Math.round(n+(a-n)*f)})||e.Geometry.isPointNearLine(t,{x:s,y:i},{x:l,y:c})||e.Geometry.isPointNearLine(t,{x:h,y:u},{x:d,y:p})},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:var r=this.cartesianPoints()
if(1<r.length)for(var n=0;n<r.length;n++)if(e.Geometry.isPointNearPoint(i.pointerPosition,r[n]))return this._setDragPoint(n),this.changeCursor(e.DrawingCursorClass.RESIZE),!0
break
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),0===this._dragPoint&&this.chartPoints[2].translate(t.moveOffset.x,t.moveOffset.y,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
if(0!==e.length){var t=this.context,i=this.actualTheme
if(2<e.length){var r=e[0].x,n=e[0].y,o=e[1].x,a=e[1].y,s=e[2].x,l=e[2].y,c=s+(o-r),h=a+(l-n),u=r-(s-r),d=n-(l-n),p=u+(o-r),f=a-(l-n),m=Math.sqrt(r*o+n*a),o=Math.round(r+(o-r)*m),a=Math.round(n+(a-n)*m),m=Math.sqrt(s*c+l*h),c=Math.round(s+(c-s)*m),h=Math.round(l+(h-l)*m),m=Math.sqrt(u*p+d*f),p=Math.round(u+(p-u)*m),f=Math.round(d+(f-d)*m)
t.beginPath(),t.moveTo(r,n),t.lineTo(o,a),t.moveTo(s,l),t.lineTo(c,h),t.moveTo(u,d),t.lineTo(p,f),t.scxStroke(i.line)}else 1<e.length&&t.scxStrokePolyline(e,i.line)
this.selected&&this._drawSelectionMarkers(e)}}},i}(e.Drawing)
e.TrendChannelDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"errorChannel"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this._drawingPoints
return!e||6>e.length?null:{left:Math.min(e[0].x,e[1].x),top:Math.max(e[0].y,e[1].y),width:Math.abs(e[1].x-e[0].x),height:Math.abs(e[1].y-e[0].y)}},i.prototype.hitTest=function(t){if(this.chartPoints.length<this.pointsNeeded)return!1
var i=this._drawingPoints
return e.Geometry.isPointNearLine(t,i[0],i[1])||e.Geometry.isPointNearLine(t,i[2],i[3])||e.Geometry.isPointNearLine(t,i[4],i[5])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this.cartesianPoint(0),i.pointerPosition))this._setDragPoint(0)
else{if(!e.Geometry.isPointNearPoint(this.cartesianPoint(1),i.pointerPosition))break
this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype._finishUserDrawing=function(){t.prototype._finishUserDrawing.call(this)
var e=this.cartesianPoints()
2>e.length||(e[0].x>e[1].x&&(this.chartPoints[0].moveToPoint(e[1],this.projection),this.chartPoints[1].moveToPoint(e[0],this.projection)),this._drawingPoints=this._calculateDrawingPoints(e))},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
if(0!==e.length){var t=this.context,i=this.actualTheme
1<e.length&&(t.beginPath(),e=this._drawingPoints=this._calculateDrawingPoints(e),this._moveMainLineYPoint(e[2].y,e[3].y),t.moveTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y),t.moveTo(e[2].x,e[2].y),t.lineTo(e[3].x,e[3].y),t.moveTo(e[4].x,e[4].y),t.lineTo(e[5].x,e[5].y),t.scxStroke(i.line),e=this._getMainLinePoints()),this.selected&&this._drawSelectionMarkers(e)}}},i.prototype._calculateDrawingPoints=function(t){var i=t[0]
t=t[1]
for(var r=this.projection,n=this.chart.primaryBarDataSeries(),o=r.recordByX(i.x),a=r.recordByX(t.x),s=Math.min(o,a),l=Math.max(o,a),c=n.high,o=0,a=s;a<=l;a++)c.valueAtIndex(a)>o&&(o=c.valueAtIndex(a))
for(var c=n.low,h=o,a=s;a<=l;a++)c.valueAtIndex(a)<h&&(h=c.valueAtIndex(a))
for(o=.5*(o-h),l=l-s+1,c=[],a=0;a<l;a++)c.push(n.low.valueAtIndex(s+a))
return s=e.DrawingCalculationUtil.calculateLinearRegression(c),n=s.firstValue,h=n+s.slope*(l-1),s=r.yByValue(n+o),a=r.yByValue(h+o),l=r.yByValue(n),c=r.yByValue(h),n=r.yByValue(n-o),r=r.yByValue(h-o),[{x:i.x,y:s},{x:t.x,y:a},{x:i.x,y:l},{x:t.x,y:c},{x:i.x,y:n},{x:t.x,y:r}]},i.prototype._getMainLinePoints=function(){return[this._drawingPoints[2],this._drawingPoints[3]]},i.prototype._moveMainLineYPoint=function(e,t){this.chartPoints[0].moveToY(e,this.projection),this.chartPoints[1].moveToY(t,this.projection)},i}(e.Drawing)
e.ErrorChannelDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"quadrantLines"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:Math.min(e[0].x,e[1].x),top:Math.min(e[0].y,e[1].y),width:Math.abs(e[0].x-e[1].x),height:Math.abs(e[0].y-e[1].y)}},i.prototype.hitTest=function(t){if(2>this.chartPoints.length)return!1
for(var i=this._drawingPoints,r=0;5>r;r++)if(e.Geometry.isPointNearLine(t,i[r][0],i[r][1]))return!0
return!1},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this.cartesianPoint(0),i.pointerPosition))this._setDragPoint(0)
else{if(!e.Geometry.isPointNearPoint(this.cartesianPoint(1),i.pointerPosition))break
this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype._finishUserDrawing=function(){t.prototype._finishUserDrawing.call(this)
var e=this.cartesianPoints()
e[0].x>e[1].x&&(this.chartPoints[0].moveToPoint(e[1],this.projection),this.chartPoints[1].moveToPoint(e[0],this.projection)),this._drawingPoints=this._calculateDrawingPoints(e)},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
if(0!==e.length){var t=this.context,i=this.actualTheme
if(1<e.length){t.beginPath(),e=this._drawingPoints=this._calculateDrawingPoints(e),this._moveMainLineYPoint(e[2][0].y,e[2][1].y)
for(var r=0;5>r;r++)t.moveTo(e[r][0].x,e[r][0].y),t.lineTo(e[r][1].x,e[r][1].y),t.scxStroke(i.line)}this.selected&&this._drawSelectionMarkers(this.cartesianPoints())}}},i.prototype._calculateDrawingPoints=function(t){var i=t[0]
t=t[1]
for(var r=this.projection,n=r.recordByX(i.x),o=r.recordByX(t.x),a=Math.min(n,o),s=Math.max(n,o),n=0,l=this.chart.primaryDataSeries(e.DataSeriesSuffix.HIGH),o=a;o<=s;o++){var c=l.valueAtIndex(o)
c>n&&(n=c)}for(l=n,c=this.chart.primaryDataSeries(e.DataSeriesSuffix.LOW),o=a;o<=s;o++)(a=c.valueAtIndex(o))<l&&(l=a)
for(a=n+(n-l)/4,s=[],o=0;5>o;o++)a-=(n-l)/4,c=r.yByValue(a),s.push([{x:i.x,y:c},{x:t.x,y:c}])
return s},i.prototype._moveMainLineYPoint=function(e,t){this.chartPoints[0].moveToY(e,this.projection),this.chartPoints[1].moveToY(t,this.projection)},i}(e.Drawing)
e.QuadrantLinesDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"raffRegression"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this._drawingPoints
return!e||6>e.length?null:{left:Math.min(e[0].x,e[1].x),top:Math.max(e[0].y,e[1].y),width:Math.abs(e[1].x-e[0].x),height:i._calculateBoundsHeight(e)}},i.prototype.hitTest=function(t){if(this.chartPoints.length<this.pointsNeeded)return!1
var i=this._drawingPoints
return e.Geometry.isPointNearLine(t,i[0],i[1])||e.Geometry.isPointNearLine(t,i[2],i[3])||e.Geometry.isPointNearLine(t,i[4],i[5])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this.cartesianPoint(0),i.pointerPosition))this._setDragPoint(0)
else{if(!e.Geometry.isPointNearPoint(this.cartesianPoint(1),i.pointerPosition))break
this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype._finishUserDrawing=function(){t.prototype._finishUserDrawing.call(this)
var e=this.cartesianPoints()
e[0]>e[1]&&(this.chartPoints[0].moveToPoint(e[1],this.projection),this.chartPoints[1].moveToPoint(e[0],this.projection)),this._drawingPoints=this._calculateDrawingPoints(e)},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
if(!(1>e.length)){if(e[0].x>e[1].x){var t=e[1]
e[1]=e[0],e[0]=t}var t=this.context,i=this.actualTheme
1<e.length&&(t.beginPath(),e=this._drawingPoints=this._calculateDrawingPoints(e),this._moveMainLineYPoint(e[2].y,e[3].y),t.moveTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y),t.moveTo(e[2].x,e[2].y),t.lineTo(e[3].x,e[3].y),t.moveTo(e[4].x,e[4].y),t.lineTo(e[5].x,e[5].y),e=this._getMainLinePoints(),t.scxStroke(i.line)),this.selected&&this._drawSelectionMarkers(e)}}},i.prototype._calculateDrawingPoints=function(t){var i=t[0]
t=t[1]
for(var r=this.projection,n=r.recordByX(i.x),o=r.recordByX(t.x),a=this.chart.primaryBarDataSeries(),s=Math.min(n,o),l=Math.min(Math.max(n,o),a.date.length-1),o=l-s+1,n=[],c=0;c<o;c++)n.push(a.close.valueAtIndex(s+c))
for(var n=e.DrawingCalculationUtil.calculateLinearRegression(n),h=n.slope,n=n.firstValue,o=n+h*(o-1),u=0,d=0,c=s,s=0;c<=l;c++,s++){var p=n+h*s,f=a.high.valueAtIndex(c)-p,p=p-a.low.valueAtIndex(c)
0<f&&f>u&&(u=f),0<p&&p>d&&(d=p)}return s=Math.max(u,d),a=r.yByValue(n+s),l=r.yByValue(o+s),c=r.yByValue(n),h=r.yByValue(o),n=r.yByValue(n-s),r=r.yByValue(o-s),[{x:i.x,y:a},{x:t.x,y:l},{x:i.x,y:c},{x:t.x,y:h},{x:i.x,y:n},{x:t.x,y:r}]},i.prototype._getMainLinePoints=function(){return[this._drawingPoints[2],this._drawingPoints[3]]},i.prototype._moveMainLineYPoint=function(e,t){this.chartPoints[0].moveToY(e,this.projection),this.chartPoints[1].moveToY(t,this.projection)},i._calculateBoundsHeight=function(e){return Math.abs(Math.max(e[0].y,e[1].y)-Math.min(e[4].y,e[5].y))},i}(e.Drawing)
e.RaffRegressionDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments)}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"tironeLevels"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this.cartesianPoints()
return e.length<this.pointsNeeded?null:{left:e[0].x,top:e[0].y,width:e[1].x-e[0].x,height:e[1].y-e[0].y}},i.prototype.hitTest=function(t){if(this.chartPoints.length<this.pointsNeeded)return!1
var i=this._drawingPoints
return e.Geometry.isPointNearLine(t,i[0],i[1])||e.Geometry.isPointNearLine(t,i[2],i[3])||e.Geometry.isPointNearLine(t,i[4],i[5])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this.cartesianPoint(0),i.pointerPosition))this._setDragPoint(0)
else{if(!e.Geometry.isPointNearPoint(this.cartesianPoint(1),i.pointerPosition))break
this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype._finishUserDrawing=function(){t.prototype._finishUserDrawing.call(this)
var e=this.cartesianPoints()
e[0].x>e[1].x&&(this.chartPoints[0].moveToPoint(e[1],this.projection),this.chartPoints[1].moveToPoint(e[0],this.projection)),this._drawingPoints=this._calculateDrawingPoints(e)},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
if(0!==e.length){var t=this.context,i=this.actualTheme
1<e.length&&(t.beginPath(),e=this._drawingPoints=this._calculateDrawingPoints(e),this._moveMainLineYPoint(e[2].y,e[3].y),t.moveTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y),t.moveTo(e[2].x,e[2].y),t.lineTo(e[3].x,e[3].y),t.moveTo(e[4].x,e[4].y),t.lineTo(e[5].x,e[5].y),t.scxStroke(i.line),e=this._getMainLinePoints()),this.selected&&this._drawSelectionMarkers(e)}}},i.prototype._calculateDrawingPoints=function(t){var i=t[0]
t=t[1]
for(var r=this.projection,n=r.recordByX(i.x),o=r.recordByX(t.x),a=Math.min(n,o),o=Math.max(n,o),s=this.chart.primaryDataSeries(e.DataSeriesSuffix.HIGH),n=0,l=a;l<=o;l++){var c=s.valueAtIndex(l)
c>n&&(n=c)}for(c=this.chart.primaryDataSeries(e.DataSeriesSuffix.LOW),s=n,l=a;l<=o;l++)(a=c.valueAtIndex(l))<s&&(s=a)
return a=r.yByValue(n-(n-s)/3),o=r.yByValue(s+(n-s)/2),r=r.yByValue(s+(n-s)/3),[{x:i.x,y:a},{x:t.x,y:a},{x:i.x,y:o},{x:t.x,y:o},{x:i.x,y:r},{x:t.x,y:r}]},i.prototype._getMainLinePoints=function(){return[this._drawingPoints[2],this._drawingPoints[3]]},i.prototype._moveMainLineYPoint=function(e,t){this.chartPoints[0].moveToY(e,this.projection),this.chartPoints[1].moveToY(t,this.projection)},i}(e.Drawing)
e.TironeLevelsDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t=function(t){function i(){t.apply(this,arguments),this._extend=!0}return __extends(i,t),Object.defineProperty(i,"className",{get:function(){return"speedLines"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"extend",{get:function(){return this._extend},set:function(e){this._extend=e},enumerable:!0,configurable:!0}),i.prototype.bounds=function(){var e=this._markersPoints
return!e||2>e.length?null:{left:Math.min(e[0].x,e[1].x),top:Math.max(e[0].y,e[1].y),width:Math.abs(e[1].x-e[0].x),height:Math.abs(e[1].y-e[0].y)}},i.prototype.hitTest=function(t){if(this.chartPoints.length<this.pointsNeeded)return!1
var i=this._drawingPoints
return e.Geometry.isPointNearLine(t,i[0],i[1])||e.Geometry.isPointNearLine(t,i[2],i[3])||e.Geometry.isPointNearLine(t,i[4],i[5])},i.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this._markersPoints[0],i.pointerPosition))this._setDragPoint(0)
else{if(!e.Geometry.isPointNearPoint(this._markersPoints[1],i.pointerPosition))break
this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},i.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
if(0!==e.length){var t=this.context,i=this.actualTheme
1<e.length&&(t.beginPath(),e=this._drawingPoints=this._calculateDrawingPoints(e),t.moveTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y),t.moveTo(e[2].x,e[2].y),t.lineTo(e[3].x,e[3].y),t.moveTo(e[4].x,e[4].y),t.lineTo(e[5].x,e[5].y),t.scxStroke(i.line),e=this._markersPoints),this.selected&&this._drawSelectionMarkers(e)}}},i.prototype._calculateDrawingPoints=function(e){var t=e[0].x,i=e[0].y,r=e[1].x,n=e[1].y,o=this.chart.primaryBarDataSeries(),a=o.high,s=o.low,o=a.valueAtIndex(this.projection.recordByX(t)),l=s.valueAtIndex(this.projection.recordByX(t)),a=a.valueAtIndex(this.projection.recordByX(r)),s=s.valueAtIndex(this.projection.recordByX(r)),c=a>l
return c&&s<o&&(c=i>n),c?(i=this.projection.yByValue(l),n=this.projection.yByValue(a),c=l+.333*(a-l),o=this.projection.yByValue(l+.667*(a-l))):(i=this.projection.yByValue(o),n=this.projection.yByValue(s),c=o-.333*(o-s),o=this.projection.yByValue(o-.667*(o-s))),l=this.projection.yByValue(c),t=this.projection.xByRecord(this.projection.recordByX(e[0].x)),r=this.projection.xByRecord(this.projection.recordByX(e[1].x)),this._markersPoints=[{x:t,y:i},{x:r,y:n}],this.extend&&(e=Math.sqrt(t*r+i*n),r=Math.round(t+(r-t)*e),n=Math.round(i-(i-n)*e),o=Math.round(i-(i-o)*e),l=Math.round(i-(i-l)*e)),[{x:t,y:i},{x:r,y:n},{x:t,y:i},{x:r,y:o},{x:t,y:i},{x:r,y:l}]},i}(e.Drawing)
e.SpeedLinesDrawing=t,e.Drawing.register(t)}(StockChartX||(StockChartX={})),__extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])
e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},function(e){var t
!function(e){e.ANGLES_CHANGED="drawingAnglesChanged",e.SHOW_ANGLE_LINE_CHANGED="drawingShowAngleLineChanged"}(t=e.DrawingEvent||(e.DrawingEvent={}))
var i=function(i){function r(){i.apply(this,arguments)}return __extends(r,i),Object.defineProperty(r,"className",{get:function(){return"gannFan"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"angles",{get:function(){return this._optionValue("angles")||r.defaults.angles},set:function(e){if(null!=e&&!Array.isArray(e))throw new TypeError("Angles must be an array of numbers.")
this._options.angles=e,this.fire(t.ANGLES_CHANGED,e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"pointsNeeded",{get:function(){return 2},enumerable:!0,configurable:!0}),r.prototype.bounds=function(){var e=this.cartesianPoints()
return 2>e.length?null:{left:Math.min(e[0].x,e[1].x),top:Math.max(e[0].y,e[1].y),width:Math.abs(e[1].x-e[0].x),height:Math.abs(e[1].y-e[0].y)}},r.prototype.hitTest=function(t){if(this.cartesianPoints().length<this.pointsNeeded)return!1
for(var i=this._drawingPoints,r=0;r<i.length;r++)if(e.Geometry.isPointNearLine(t,i[r][0],i[r][1]))return!0
return!1},r.prototype._handlePanGesture=function(t,i){switch(t.state){case e.GestureState.STARTED:if(e.Geometry.isPointNearPoint(this.cartesianPoint(0),i.pointerPosition))this._setDragPoint(0)
else{if(!e.Geometry.isPointNearPoint(this.cartesianPoint(1),i.pointerPosition))break
this._setDragPoint(1)}return this.changeCursor(e.DrawingCursorClass.RESIZE),!0
case e.GestureState.CONTINUED:if(0<=this._dragPoint)return this.chartPoints[this._dragPoint].moveToPoint(i.pointerPosition,this.projection),!0}return!1},r.prototype.draw=function(){if(this.visible){var e=this.cartesianPoints()
if(0!==e.length){var t=this.context,i=this.actualTheme
if(1<e.length){t.beginPath()
for(var r=this._drawingPoints=this._calculateDrawingPoints(e),n=0;n<r.length;n++)t.moveTo(r[n][0].x,r[n][0].y),t.lineTo(r[n][1].x,r[n][1].y),t.scxStroke(i.line)}this.selected&&this._drawSelectionMarkers(e)}}},r.prototype._calculateDrawingPoints=function(e){var t,i=e[0].x,r=e[0].y,n=e[1].x
t=this.chartPanel.contentFrame
for(var o=i>n?t.left:t.right,a=[],s=0,l=this.angles;s<l.length;s++)t=r-Math.round(r-e[1].y)*l[s].value,a.push([{x:i,y:r},{x:n,y:t}])
for(e=0;e<a.length;e++)r=a[e][0].y,t=a[e][1].y,i=a[e][0].x,n=a[e][1].x,a[e][1].x=o,a[e][1].y=Math.round(r+(o-i)*(t-r)/(n-i))
return a},r.defaults={angles:[{value:.125},{value:.25},{value:.3333},{value:.5},{value:1},{value:2},{value:3},{value:4},{value:8}]},r}(e.Drawing)
e.GannFanDrawing=i,e.Drawing.register(i)}(StockChartX||(StockChartX={})),function(e){var t=function(){function t(e){this._textLines=[],this._image=new Image,this._imageOpacity=.5,this._panelObject=e}return Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text=e,this._updateLines()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(e){this._imageUrl=e,this._reloadImage()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageOpacity",{get:function(){return this._imageOpacity},set:function(e){this._imageOpacity=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"theme",{get:function(){return this._theme||this.panelObject.chart.theme.tooltip},set:function(e){this._theme=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"panelObject",{get:function(){return this._panelObject},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"chartPanel",{get:function(){return this.panelObject.chartPanel},enumerable:!0,configurable:!0}),t.prototype.show=function(e){this.text?this.drawText(e):this.imageUrl&&this.drawImage(e)},t.prototype.hide=function(){this.chartPanel.rootDiv.find(".scxTooltip").remove()},t.prototype.saveState=function(){return{text:this.text,imageUrl:this.imageUrl}},t.prototype.loadState=function(e){e=e||{},this.text=e.text,this.imageUrl=e.imageUrl},t.prototype.drawText=function(t){if(this.text){var i=this.theme,r=this._textLines,n=r.reduce(function(e,t){return e.length>=t.length?e:t}),n=e.DummyCanvasContext.measureText(n,i.text),i=n.width+5,r=n.height*r.length+10
this._showTextDOM({left:t.x-i,top:t.y-r,width:i,height:r})}},t.prototype.drawImage=function(e){var t=this._image,i=t.width,t=t.height,r=e.x-i
e=e.y-t,0<i&&this._showImageDOM({top:e,left:r,width:i,height:t})},t.prototype._showTextDOM=function(e){e=this._createTooltipDOMRoot(e)
var t=this.theme
e.scxBorder("border",t.border).scxFill(t.fill),e.scxTextStyle(t.text),t=document.createElement("span"),t.textContent=this.text,e.append(t)},t.prototype._showImageDOM=function(e){e=this._createTooltipDOMRoot(e)
var t=document.createElement("img")
t.style.opacity=this.imageOpacity.toString(),t.src=this.imageUrl,e.append(t)},t.prototype._createTooltipDOMRoot=function(e){var t=this.chartPanel.rootDiv.scxAppend("div","scxTooltip").css("position","absolute")
return t.scxFrame(e),t},t.prototype._reloadImage=function(){this._image&&this.imageUrl&&(this._image.src=this.imageUrl)},t.prototype._updateLines=function(){this.text&&(this._textLines=this.text.split("\n"))},t}()
e.ChartPanelObjectTooltip=t}(StockChartX||(StockChartX={}))