diff --git a/.travis.yml b/.travis.yml index 40d9ded16..752df2af1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "node" + - "12.9.1" branches: only: - master diff --git a/dist/klinecharts.development.js b/dist/klinecharts.development.js index 5732cd651..adefa795b 100644 --- a/dist/klinecharts.development.js +++ b/dist/klinecharts.development.js @@ -10973,7 +10973,7 @@ var CHART_NAME_PREFIX = 'k_line_chart_'; */ function version() { - return '5.2.0'; + return '5.2.1'; } /** * 初始化 @@ -10985,7 +10985,7 @@ function version() { function init(ds) { var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var errorMessage = 'Chart version is 5.2.0. Root dom is null, can not initialize the chart!!!'; + var errorMessage = 'Chart version is 5.2.1. Root dom is null, can not initialize the chart!!!'; var container = ds; if (!container) { diff --git a/dist/klinecharts.production.min.js b/dist/klinecharts.production.min.js index 8cb7251cc..e4839693b 100644 --- a/dist/klinecharts.production.min.js +++ b/dist/klinecharts.production.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).klinecharts={})}(this,(function(t){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;e.length>i;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function n(t,e,i){return e&&a(t.prototype,e),i&&a(t,i),t}function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?l(t):e}function _(t){return function(){var e,i=o(t);if(h()){var a=o(this).constructor;e=Reflect.construct(i,arguments,a)}else e=i.apply(this,arguments);return u(this,e)}}function d(t,e,i){return(d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var a=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=o(t)););return t}(t,e);if(a){var n=Object.getOwnPropertyDescriptor(a,e);return n.get?n.get.call(i):n.value}})(t,e,i||t)}function v(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){if(t){if("string"==typeof t)return p(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=Array(e);e>i;i++)a[i]=t[i];return a}function y(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=f(t))){var e=0,i=function(){};return{s:i,n:function(){return t.length>e?{done:!1,value:t[e++]}:{done:!0}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,n,r=!0,s=!1;return{s:function(){a=t[Symbol.iterator]()},n:function(){var t=a.next();return r=t.done,t},e:function(t){s=!0,n=t},f:function(){try{r||null==a.return||a.return()}finally{if(s)throw n}}}}function x(t,e){if(M(t)&&M(e))for(var i in e)if(t.hasOwnProperty(i)){var a=t[i],n=e[i];M(n)&&M(a)&&!g(n)&&!g(a)?x(a,n):(e[i]||0===e[i]||!1===e[i])&&(t[i]=e[i])}}function m(t){if(!t||!M(t))return t;var e,i,a;for(i in e=g(t)?[]:{},t)t.hasOwnProperty(i)&&(e[i]=(a=t[i])&&M(a)?m(a):a);return e}function g(t){return"[object Array]"===Object.prototype.toString.call(t)}function k(t){return"function"==typeof t}function M(t){var i=e(t);return"function"===i||!!t&&"object"===i}function D(t){return"number"==typeof t&&!isNaN(t)}function w(t){return"boolean"==typeof t}var S,b,T="dash",P="left",A="right",C="percentage",E="inside",L="outside",I="real_time",R="candle_stick",z="solid",O="stroke",H="up_stroke",V="down_stroke",B="ohlc",Y="always",G="follow_cross",F="standard",W={grid:{display:!0,horizontal:{display:!0,size:1,color:"#393939",style:T,dashValue:[2,2]},vertical:{display:!1,size:1,color:"#393939",style:T,dashValue:[2,2]}},candleStick:{bar:{style:z,upColor:"#26A69A",downColor:"#EF5350",noChangeColor:"#666666"},priceMark:{display:!0,high:{display:!0,color:"#D9D9D9",textMargin:5,textSize:10,textFamily:"Arial"},low:{display:!0,color:"#D9D9D9",textMargin:5,textSize:10,textFamily:"Arial"},last:{display:!0,upColor:"#26A69A",downColor:"#EF5350",noChangeColor:"#666666",line:{display:!0,style:T,dashValue:[4,4],size:1},text:{display:!0,size:12,paddingLeft:2,paddingTop:2,paddingRight:2,paddingBottom:2,color:"#FFFFFF",family:"Arial"}}}},realTime:{timeLine:{color:"#1e88e5",size:1,areaFillColor:"rgba(30, 136, 229, 0.08)"},averageLine:{display:!0,color:"#F5A623",size:1}},technicalIndicator:{bar:{upColor:"#26A69A",downColor:"#EF5350",noChangeColor:"#666666"},line:{size:1,colors:["#D9D9D9","#F5A623","#F601FF","#1587DD","#1e88e5"]},lastValueMark:{display:!1,textColor:"#ffffff",textSize:12,textFamily:"Arial",textPaddingLeft:3,textPaddingTop:2,textPaddingRight:3,textPaddingBottom:2}},xAxis:{display:!0,maxHeight:50,minHeight:30,axisLine:{display:!0,color:"#888888",size:1},tickText:{display:!0,color:"#D9D9D9",size:12,family:"Arial",margin:3},tickLine:{display:!0,size:1,length:3,color:"#888888"}},yAxis:{display:!0,maxWidth:100,minWidth:60,type:"normal",position:A,axisLine:{display:!0,color:"#888888",size:1},tickText:{position:L,display:!0,color:"#D9D9D9",size:12,family:"Arial",margin:3},tickLine:{display:!0,size:1,length:3,color:"#888888"}},separator:{size:1,color:"#888888",fill:!0},floatLayer:{crossHair:{display:!0,horizontal:{display:!0,line:{display:!0,style:T,dashValue:[4,2],size:1,color:"#888888"},text:{display:!0,color:"#D9D9D9",size:12,family:"Arial",paddingLeft:2,paddingRight:2,paddingTop:2,paddingBottom:2,borderSize:1,borderColor:"#505050",backgroundColor:"#505050"}},vertical:{display:!0,line:{display:!0,style:T,dashValue:[4,2],size:1,color:"#888888"},text:{display:!0,color:"#D9D9D9",size:12,family:"Arial",paddingLeft:2,paddingRight:2,paddingTop:2,paddingBottom:2,borderSize:1,borderColor:"#505050",backgroundColor:"#505050"}}},prompt:{displayRule:Y,candleStick:{showType:F,labels:["时间","开","收","高","低","成交量"],values:null,rect:{paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:6,left:8,top:8,right:8,borderRadius:4,borderSize:1,borderColor:"#3f4254",fillColor:"rgba(17, 17, 17, .3)"},text:{size:12,family:"Arial",color:"#D9D9D9",marginLeft:8,marginTop:6,marginRight:8,marginBottom:0}},technicalIndicator:{text:{size:12,family:"Arial",color:"#D9D9D9",marginTop:6,marginRight:8,marginBottom:0,marginLeft:8},point:{display:!0,radius:3}}}},graphicMark:{line:{color:"#1e88e5",size:1},point:{backgroundColor:"#1e88e5",borderColor:"#1e88e5",borderSize:1,radius:4,activeBackgroundColor:"#1e88e5",activeBorderColor:"#1e88e5",activeBorderSize:1,activeRadius:6},text:{color:"#1e88e5",size:12,family:"Arial",marginLeft:2,marginRight:2,marginTop:2,marginBottom:6}}},X={NO:"NO",AVERAGE:"AVERAGE",MA:"MA",EMA:"EMA",VOL:"VOL",MACD:"MACD",BOLL:"BOLL",KDJ:"KDJ",RSI:"RSI",BIAS:"BIAS",BRAR:"BRAR",CCI:"CCI",DMI:"DMI",CR:"CR",PSY:"PSY",DMA:"DMA",TRIX:"TRIX",OBV:"OBV",VR:"VR",WR:"WR",MTM:"MTM",EMV:"EMV",SAR:"SAR"},j=(r(S={},X.MA,[5,10,30,60]),r(S,X.EMA,[6,12,20]),r(S,X.VOL,[5,10,20]),r(S,X.MACD,[12,26,9]),r(S,X.BOLL,[20]),r(S,X.KDJ,[9,3,3]),r(S,X.RSI,[6,12,24]),r(S,X.BIAS,[6,12,24]),r(S,X.BRAR,[26]),r(S,X.CCI,[13]),r(S,X.DMI,[14,6]),r(S,X.CR,[26,10,20,40,60]),r(S,X.PSY,[12]),r(S,X.DMA,[10,50,10]),r(S,X.TRIX,[12,20]),r(S,X.OBV,[30]),r(S,X.VR,[24,30]),r(S,X.WR,[13,34,89]),r(S,X.MTM,[6,10]),r(S,X.EMV,[14,9]),r(S,X.SAR,[2,2,20]),S);function N(t,e,i){var a=i[e]||[],n=(t||{})[e.toLowerCase()]||{},r=[],s=[];switch(e){case X.MA:a.forEach((function(t){var e="ma".concat(t);r.push(e),s.push(n[e])}));break;case X.EMA:a.forEach((function(t){var e="ema".concat(t);r.push(e),s.push(n[e])}));break;case X.MACD:r=["diff","dea","macd"],s=[n.diff,n.dea,n.macd];break;case X.VOL:a.forEach((function(t){var e="ma".concat(t);r.push(e),s.push(n[e])})),r.push("num"),s.push(n.num);break;case X.BOLL:r=["up","mid","dn"],s=[n.up,n.mid,n.dn];break;case X.BIAS:a.forEach((function(t){var e="bias".concat(t);r.push(e),s.push(n[e])}));break;case X.BRAR:r=["br","ar"],s=[n.br,n.ar];break;case X.CCI:r=["cci"],s=[n.cci];break;case X.CR:r=["cr","ma1","ma2","ma3","ma4"],s=[n.cr,n.ma1,n.ma2,n.ma3,n.ma4];break;case X.DMA:r=["dif","difMa"],s=[n.dif,n.difMa];break;case X.DMI:r=["mdi","pdi","adx","adxr"],s=[n.mdi,n.pdi,n.adx,n.adxr];break;case X.KDJ:r=["k","d","j"],s=[n.k,n.d,n.j];break;case X.RSI:a.forEach((function(t){var e="rsi".concat(t);r.push(e),s.push(n[e])}));break;case X.PSY:r=["psy"],s=[n.psy];break;case X.TRIX:r=["trix","maTrix"],s=[n.trix,n.maTrix];break;case X.OBV:r=["obv","maObv"],s=[n.obv,n.maObv];break;case X.VR:r=["vr","maVr"],s=[n.vr,n.maVr];break;case X.WR:r=["wr1","wr2","wr3"],s=[n.wr1,n.wr2,n.wr3];break;case X.MTM:r=["mtm","mtmMa"],s=[n.mtm,n.mtmMa];break;case X.EMV:r=["emv","maEmv"],s=[n.emv,n.maEmv];break;case X.SAR:r=["sar"],s=[n.sar]}return{keys:r,values:s}}var K=(r(b={price:2,volume:0},X.NO,2),r(b,X.MA,2),r(b,X.EMA,2),r(b,X.VOL,0),r(b,X.MACD,2),r(b,X.BOLL,2),r(b,X.KDJ,2),r(b,X.RSI,2),r(b,X.BIAS,2),r(b,X.BRAR,4),r(b,X.CCI,4),r(b,X.DMI,4),r(b,X.CR,2),r(b,X.PSY,2),r(b,X.DMA,4),r(b,X.TRIX,4),r(b,X.OBV,4),r(b,X.VR,4),r(b,X.WR,4),r(b,X.MTM,4),r(b,X.EMV,4),r(b,X.SAR,2),b),U={};function Z(t,e){for(var i=t.length,a=0;i>a;a++)e(a);return t}function q(t,e){for(var i=0,a=0;t.length>a;a++){var n=t[a].close-e;i+=n*n}var r=i>0,s=Math.sqrt((i=Math.abs(i))/t.length);return r?s:-1*s}function J(t){var e=0;if(t&&t.length>0){var i=t.length;e=t[0].high;for(var a=1;i>a;a++)e=Math.max(t[a].high,e)}return e}function $(t){var e=0;if(t&&t.length>0){var i=t.length;e=t[0].low;for(var a=1;i>a;a++)e=Math.min(t[a].low,e)}return e}function Q(t){var e=0,i=0;if(t&&t.length>0){var a=t.length;e=t[0].high,i=t[0].low;for(var n=1;a>n;n++)e=Math.max(t[n].high,e),i=Math.min(t[n].low,i)}return[e,i]}function tt(t){return t&&g(t)}function et(t,e){return tt(t)&&t.length===e}function it(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"--";if(t&&M(t)){var a=t[e];if(a||0===a||!1===a)return a}return i}U[X.AVERAGE]=function(t){var e=0,i=0;return Z(t,(function(a){e+=t[a].turnover||0,t[a].average=0!==(i+=t[a].volume||0)?e/i:0}))},U[X.MA]=function(t,e){if(!tt(e))return t;var i=[],a=e.length;return Z(t,(function(n){for(var r={},s=t[n].close,o=0;a>o;o++){i[o]=(i[o]||0)+s;var c=e[o];c>n?r["ma".concat(c)]=i[o]/(n+1):(i[o]-=t[n-c].close,r["ma".concat(c)]=i[o]/c)}t[n].ma=r}))},U[X.EMA]=function(t,e){if(!tt(e))return t;var i=[],a=e.length;return Z(t,(function(n){for(var r={},s=t[n].close,o=0;a>o;o++){var c=void 0;c=0===n?s:(2*s+(e[o]-1)*i[o])/(e[o]+1),r["ema".concat(e[o])]=c,i[o]=c}t[n].ema=r}))},U[X.VOL]=function(t,e){if(!tt(e))return t;var i=[],a=e.length;return Z(t,(function(n){for(var r=t[n].volume,s={},o=0;a>o;o++){i[o]=(i[o]||0)+r;var c=e[o];c>n?s["ma".concat(c)]=i[o]/(n+1):(i[o]-=t[n-c].volume,s["ma".concat(c)]=i[o]/c)}s.num=r,t[n].vol=s}))},U[X.MACD]=function(t,e){if(!et(e,3))return t;var i,a,n=0,r=0,s=0,o=0,c=0;return Z(t,(function(h){var l=t[h].close;0===h?(i=l,a=l):(i=(2*l+(e[0]-1)*n)/(e[0]+1),a=(2*l+(e[1]-1)*r)/(e[1]+1)),n=i,r=a,c=o=(2*(s=i-a)+c*(e[2]-1))/(e[2]+1),t[h].macd={diff:s,dea:o,macd:2*(s-o)}}))},U[X.BOLL]=function(t,e){if(!et(e,1))return t;var i,a,n=0;return Z(t,(function(r){n+=t[r].close,e[0]>r?(i=n/(r+1),a=q(t.slice(0,r+1),i)):(i=(n-=t[r-e[0]].close)/e[0],a=q(t.slice(r-(e[0]-1),r+1),i)),t[r].boll={up:i+2*a,mid:i,dn:i-2*a}}))},U[X.KDJ]=function(t,e){return et(e,3)?Z(t,(function(s){var o=t[s].close;e[0]-1>s?(n=$(t.slice(0,s+1)),r=J(t.slice(0,s+1))):(n=$(t.slice(s-(e[0]-1),s+1)),r=J(t.slice(s-(e[0]-1),s+1))),t[s].kdj={k:i=(e[1]-1)/e[1]*(e[0]-1>s?50:t[s-1].kdj.k)+1/e[1]*((o-n)/(r-n==0?1:r-n)*100),d:a=(e[2]-1)/e[2]*(e[0]-1>s?50:t[s-1].kdj.d)+1/e[2]*i,j:3*i-2*a}})):t;var i,a,n,r},U[X.RSI]=function(t,e){if(!et(e,3))return t;var i,a,n,s,o,c,h=0,l=0,u=0,_=0,d=0,v=0;return Z(t,(function(f){var p,y=(r(p={},"rsi".concat(e[0]),0),r(p,"rsi".concat(e[1]),0),r(p,"rsi".concat(e[2]),0),p);if(f>0){var x=t[f].close-t[f-1].close;if(x>0)h+=x,u+=x,d+=x;else{var m=Math.abs(x);l+=m,_+=m,v+=m}if(e[0]>f)i=h/(f+1),a=(h+l)/(f+1);else{if(f>e[0]){var g=t[f-e[0]].close-t[f-e[0]-1].close;g>0?h-=g:l-=Math.abs(g)}i=h/e[0],a=(h+l)/e[0]}if(y["rsi".concat(e[0])]=0!==a?i/a*100:0,e[1]>f)n=u/(f+1),s=(u+_)/(f+1);else{if(f>e[1]){var k=t[f-e[1]].close-t[f-e[1]-1].close;k>0?u-=k:_-=Math.abs(k)}n=u/e[1],s=(u+_)/e[1]}if(y["rsi".concat(e[1])]=0!==s?n/s*100:0,e[2]>f)o=d/(f+1),c=(d+v)/(f+1);else{if(f>e[2]){var M=t[f-e[2]].close-t[f-e[2]-1].close;M>0?d-=M:v-=Math.abs(M)}o=d/e[2],c=(d+v)/e[2]}y["rsi".concat(e[2])]=0!==c?o/c*100:0}t[f].rsi=y}))},U[X.BIAS]=function(t,e){if(!et(e,3))return t;var i,a,n,r=0,s=0,o=0;return Z(t,(function(c){var h={},l=t[c].close;r+=l,s+=l,o+=l,i=e[0]>c?r/(c+1):(r-=t[c-e[0]].close)/e[0],h["bias".concat(e[0])]=(l-i)/i*100,a=e[1]>c?s/(c+1):(s-=t[c-e[1]].close)/e[1],h["bias".concat(e[1])]=(l-a)/a*100,n=e[2]>c?o/(c+1):(o-=t[c-e[2]].close)/e[2],h["bias".concat(e[2])]=(l-n)/n*100,t[c].bias=h}))},U[X.BRAR]=function(t,e){if(!et(e,1))return t;var i=0,a=0,n=0,r=0,s=0,o=0;return Z(t,(function(c){var h=t[c].high,l=t[c].low,u=t[c].open;if(s+=h-u,o+=u-l,c>0){var _=t[c-1].close;if(n+=h-_,r+=_-l,c>e[0]-1){var d=t[c-e[0]].high,v=t[c-e[0]].low,f=t[c-e[0]].open;if(c>e[0]){var p=t[c-e[0]-1].close;n-=d-p,r-=p-v}s-=d-f,o-=f-v}a=0!==o?s/o*100:0,i=0!==r?n/r*100:0}t[c].brar={br:i,ar:a}}))},U[X.CCI]=function(t,e){if(!et(e,1))return t;var i,a,n=0,r=[],s=0;return Z(t,(function(o){var c=t[o].close;n+=c;var h=(t[o].high+t[o].low+c)/3;if(e[0]>o)s+=Math.abs((i=n/(o+1))-c),r.push(i),a=s/(o+1);else{var l=t[o-e[0]].close;r.push(i=(n-=l)/e[0]),s+=Math.abs(i-c),a=(s-=Math.abs(r[o-e[0]]-l))/e[0]}t[o].cci={cci:0!==a?(h-i)/a/.015:0}}))},U[X.DMI]=function(t,e){if(!et(e,2))return t;var i=0,a=0,n=0,r=0,s=[0],o=0,c=[0],h=0,l=[0],u=0,_=[0],d=0;return Z(t,(function(v){if(v>0){var f=t[v-1].close,p=t[v].high,y=t[v].low,x=p-y,m=Math.abs(p-f),g=Math.abs(y-f),k=p-t[v-1].high,M=t[v-1].low-y,D=Math.max(Math.max(x,m),g);o+=D,s.push(D);var w=k>0&&k>M?k:0;h+=w,c.push(w);var S=M>0&&M>k?M:0;u+=S,l.push(S),v>e[0]-1&&(o-=s[v-e[0]],h-=c[v-e[0]],u-=l[v-e[0]]),0===o?(i=0,a=0):(i=100*h/o,a=100*u/o);var b=Math.abs(a-i)/(a+i)*100;if(d+=b,_.push(b),e[1]>v)r=n=d/(v+1);else{var T=_[v-e[1]];r=((n=(d-=T)/e[1])+T)/2}}t[v].dmi={pdi:i,mdi:a,adx:n,adxr:r}}))},U[X.CR]=function(t,e){if(!et(e,5))return t;var i,a,n,r,s=0,o=0,c=0,h=0,l=[],u=0,_=[],d=0,v=[],f=0,p=[];return Z(t,(function(y){if(y>0){var x=(t[y-1].high+t[y-1].close+t[y-1].low+t[y-1].open)/4,m=t[y].high-x;0>m&&(m=0),o+=m;var g=x-t[y].low;if(0>g&&(g=0),c+=g,y>e[0]){var k=(t[y-e[0]-1].high+t[y-e[0]-1].low+t[y-e[0]-1].close+t[y-e[0]-1].open)/4,M=t[y-e[0]].high-k;0>M&&(M=0);var D=k-t[y-e[0]].low;0>D&&(D=0),o-=M,c-=D}0!==c&&(s=o/c*100);var w=(t[y-1].high+t[y-1].low+t[y-1].close)/3,S=t[y].high-w;o+=S>0?S:0;var b=w-t[y].low;c+=b>0?b:0}h+=s,u+=s,d+=s,f+=s,i=e[1]>y?h/(y+1):(h-=t[y-e[1]].cr.cr)/e[1],l.push(i),a=e[2]>y?u/(y+1):(u-=t[y-e[2]].cr.cr)/e[2],_.push(a),n=e[3]>y?d/(y+1):(d-=t[y-e[3]].cr.cr)/e[3],v.push(n),r=e[4]>y?f/(y+1):(f-=t[y-e[4]].cr.cr)/e[4],p.push(r),t[y].cr={cr:s,ma1:5>y?l[0]:l[y-5],ma2:9>y?_[0]:_[y-9],ma3:17>y?v[0]:v[y-17],ma4:25>y?p[0]:p[y-25]}}))},U[X.PSY]=function(t,e){if(!et(e,1))return t;var i=0,a=0;return Z(t,(function(n){n>0&&(a+=t[n].close-t[n-1].close>0?1:0,e[0]>n?i=a/(n+1)*100:(n>e[0]&&(a-=t[n-e[0]+1].close-t[n-e[0]].close>0?1:0),i=a/e[0]*100)),t[n].psy={psy:i}}))},U[X.DMA]=function(t,e){if(!et(e,3))return t;var i,a,n,r,s=0,o=0,c=0;return Z(t,(function(h){var l=t[h].close;s+=l,o+=l,n=e[0]>h?s/(h+1):(s-=t[h-e[0]].close)/e[0],r=e[1]>h?o/(h+1):(o-=t[h-e[1]].close)/e[1],c+=i=n-r,a=e[2]>h?c/(h+1):(c-=t[h-e[2]].dma.dif)/e[2],t[h].dma={dif:i,difMa:a}}))},U[X.TRIX]=function(t,e){if(!et(e,2))return t;var i,a,n,r,s=0,o=0,c=0,h=0,l=0,u=[];return Z(t,(function(_){var d=t[_].close;if(0===_)r=n=a=d;else{r=(2*(n=(2*(a=(2*d+(e[0]-1)*c)/(e[0]+1))+(e[0]-1)*h)/(e[0]+1))+(e[0]-1)*l)/(e[0]+1);var v=u[_-1];s=0===v?0:(r-v)/v*100}c=a,h=n,l=r,u.push(r),o+=s,i=e[1]>_?o/(_+1):(o-=t[_-e[1]].trix.trix)/e[1],t[_].trix={trix:s,maTrix:i}}))},U[X.OBV]=function(t,e){if(!et(e,1))return t;var i,a,n=0,r=0;return Z(t,(function(s){var o=t[s].volume;if(0===s)i=o,r+=o;else{var c=t[s-1].close,h=t[s].close;r+=h>c?o:-o,i=h===c?0:r}n+=i,a=e[0]>s?n/(s+1):(n-=t[s-e[0]].obv.obv)/e[0],t[s].obv={obv:i,maObv:a}}))},U[X.VR]=function(t,e){if(!et(e,2))return t;var i,a=0,n=0,r=0,s=0,o=0;return Z(t,(function(c){var h=t[c].close,l=t[c].open,u=t[c].volume;if(h>l?a+=u:l>h?n+=u:r+=u,c>e[0]-1){var _=t[c-e[0]].close,d=t[c-e[0]].open,v=t[c-e[0]].volume;_>d?a-=v:d>_?n-=v:r-=v}var f=n+.5*r;0!==f&&(s=(a+.5*r)/f*100),o+=s,i=e[1]>c?o/(c+1):(o-=t[c-e[1]].vr.vr)/e[1],t[c].vr={vr:s,maVr:i}}))},U[X.WR]=function(t,e){if(!et(e,3))return t;var i,a,n,r,s,o=Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,h=Number.MIN_SAFE_INTEGER,l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,_=Number.MAX_SAFE_INTEGER;return Z(t,(function(d){var v=t[d].close,f=t[d].high,p=t[d].low;if(e[0]>d)o=Math.max(f,o),c=Math.min(p,c);else{var y=Q(t.slice(d-e[0],d));o=y[0],c=y[1]}if(i=0!==(n=o-c)?(o-v)/n*100:0,e[1]>d)h=Math.max(f,h),l=Math.min(p,l);else{var x=Q(t.slice(d-e[1],d));h=x[0],l=x[1]}if(a=0!==(r=h-l)?(h-v)/r*100:0,e[2]>d)u=Math.max(f,u),_=Math.min(p,_);else{var m=Q(t.slice(d-e[2],d));u=m[0],_=m[1]}t[d].wr={wr1:i,wr2:a,wr3:0!==(s=u-_)?(u-v)/s*100:0}}))},U[X.MTM]=function(t,e){if(!et(e,2))return t;var i,a,n=0;return Z(t,(function(r){e[0]>r?(i=0,a=0):(n+=i=t[r].close-t[r-e[0]].close,e[0]+e[1]>r?a=n/(r-e[0]+1):(a=n/e[1],n-=t[r-e[1]].mtm.mtm));t[r].mtm={mtm:i,mtmMa:a}}))},U[X.EMV]=function(t,e){if(!et(e,2))return t;var i,a=0,n=0,r=0,s=[];return Z(t,(function(o){if(o>0){var c=t[o].high,h=t[o].low;r=((c+h)/2-(t[o-1].high+t[o-1].low)/2)*(c-h)/t[o].turnover}s.push(r),e[0]>o?a+=r:a-=s[o-e[0]],n+=a,i=e[1]>o?n/(o+1):(n-=t[o-e[1]].emv.emv)/e[1],t[o].emv={emv:a,maEmv:i}}))},U[X.SAR]=function(t,e){if(!et(e,3))return t;var i=e[0]/100,a=e[1]/100,n=e[2]/100,r=i,s=-100,o=!1,c=0;return Z(t,(function(e){var h=c,l=t[e].high,u=t[e].low;if(o){(-100===s||l>s)&&(s=l,r=Math.min(r+a,n)),c=h+r*(s-h);var _=Math.min(t[Math.max(1,e)-1].low,u);c>t[e].low?(c=s,r=i,s=-100,o=!o):c>_&&(c=_)}else{(-100===s||s>u)&&(s=u,r=Math.min(r+a,n)),c=h+r*(s-h);var d=Math.max(t[Math.max(1,e)-1].high,l);t[e].high>c?(c=s,r=0,s=-100,o=!o):d>c&&(c=d)}t[e].sar={sar:c}}))};function at(t,e,i){if(t&&D(t)){var a,n=new Date(t);try{a=new Intl.DateTimeFormat("en-us",{hour12:!1,timeZone:i,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}).format(n)}catch(t){a=new Intl.DateTimeFormat("en-us",{hour12:!1,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}).format(n)}var r=a.match(/^[\d]{1,2}\/[\d]{1,2}\/[\d]{4}/)[0].split("/"),s="".concat(1===r[0].length?"0".concat(r[0]):r[0]),o="".concat(1===r[1].length?"0".concat(r[1]):r[1]),c=a.match(/[\d]{2}:[\d]{2}$/)[0];switch("24"===c.match(/^[\d]{2}/)[0]&&(c=c.replace(/^[\d]{2}/,"00")),e){case"YYYY":return r[2];case"YYYY-MM":return"".concat(r[2],"-").concat(s);case"YYYY-MM-DD":return"".concat(r[2],"-").concat(s,"-").concat(o);case"YYYY-MM-DD hh:mm":return"".concat(r[2],"-").concat(s,"-").concat(o," ").concat(c);case"MM-DD":return"".concat(s,"-").concat(o);case"hh:mm":return c;default:return"".concat(s,"-").concat(o," ").concat(c)}}return"--"}function nt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=+t;return(i||0===i)&&D(i)?t.toFixed(e):"".concat(i)}function rt(t){return D(+t)?t>1e9?"".concat(+(t/1e9).toFixed(3),"B"):t>1e6?"".concat(+(t/1e6).toFixed(3),"M"):t>1e3?"".concat(+(t/1e3).toFixed(3),"K"):t:"--"}var st=0,ot=1,ct=2,ht=3,lt=4,ut="none",_t="horizontalStraightLine",dt="verticalStraightLine",vt="straightLine",ft="horizontalRayLine",pt="verticalRayLine",yt="rayLine",xt="horizontalSegmentLine",mt="verticalSegmentLine",gt="segmentLine",kt="priceLine",Mt="priceChannelLine",Dt="parallelStraightLine",wt="fibonacciLine",St=function(){function t(e,a){i(this,t),this._invalidateHandler=a,this._styleOptions=m(W),x(this._styleOptions,e),this._technicalIndicatorParamOptions=m(j),this._precisionOptions=m(K),this._timezone=null,this._dataList=[],this._loading=!0,this._loadMoreCallback=null,this._more=!0,this._totalDataSpace=0,this._dataSpace=6,this._barSpace=this._calcBarSpace(),this._offsetRightBarCount=50/this._dataSpace,this._leftMinVisibleBarCount=2,this._rightMinVisibleBarCount=2,this._from=0,this._to=0,this._crossHairPoint=null,this._crossHairSeriesTag=null,this._preOffsetRightBarCount=0,this._graphicMarkType=ut,this._graphicMarkPoint=null,this._dragGraphicMarkFlag=!1,this._graphicMarkDatas={horizontalStraightLine:[],verticalStraightLine:[],straightLine:[],horizontalRayLine:[],verticalRayLine:[],rayLine:[],horizontalSegmentLine:[],verticalSegmentLine:[],segmentLine:[],priceLine:[],parallelStraightLine:[],priceChannelLine:[],fibonacciLine:[]}}return n(t,[{key:"_loadMoreHandler",value:function(){this._more&&!this._loading&&this._loadMoreCallback&&k(this._loadMoreCallback)&&(this._loading=!0,this._loadMoreCallback(it(this._dataList[0],"timestamp")))}},{key:"_calcBarSpace",value:function(){return Math.max(1,Math.min(Math.floor(.8*this._dataSpace),Math.floor(this._dataSpace)-1))}},{key:"_innerSetDataSpace",value:function(t){return!(!t||3>t||t>30||this._dataSpace===t)&&(this._dataSpace=t,this._barSpace=this._calcBarSpace(),!0)}},{key:"styleOptions",value:function(){return this._styleOptions}},{key:"applyStyleOptions",value:function(t){x(this._styleOptions,t)}},{key:"technicalIndicatorParamOptions",value:function(){return this._technicalIndicatorParamOptions}},{key:"applyTechnicalIndicatorParams",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._technicalIndicatorParamOptions.hasOwnProperty(t)&&(this._technicalIndicatorParamOptions[t]=e)}},{key:"precisionOptions",value:function(){return this._precisionOptions}},{key:"setTimezone",value:function(t){this._timezone=t}},{key:"timezone",value:function(){return this._timezone}},{key:"applyPrecision",value:function(t,e){!t&&0!==t||0>t||(this._precisionOptions.price=t,this._precisionOptions[X.MA]=t,this._precisionOptions[X.BOLL]=t,this._precisionOptions[X.SAR]=t),!e&&0!==e||0>e||(this._precisionOptions.volume=e,this._precisionOptions[X.VOL]=e)}},{key:"calcTechnicalIndicator",value:function(t,e){var i=this;new Promise((function(t,a){if(e===X.NO)t(!0);else{var n=U[e];n?(i._dataList=n(i._dataList,i._technicalIndicatorParamOptions[e]),t(!0)):a(Error("Technical indicator type is error!"))}})).then((function(e){if(g(t)){var i,a=y(t);try{for(a.s();!(i=a.n()).done;){i.value.invalidate(lt)}}catch(t){a.e(t)}finally{a.f()}}else t.invalidate(lt)})).catch((function(t){}))}},{key:"dataList",value:function(){return this._dataList}},{key:"clearDataList",value:function(){this._more=!0,this._loading=!0,this._dataList=[],this._from=0,this._to=0}},{key:"addData",value:function(t,e,i){M(t)&&(g(t)?(this._loading=!1,this._more=!w(i)||i,this._dataList=t.concat(this._dataList),this.adjustOffsetBarCount()):this._dataList.length>e?this._dataList[e]=t:(this._dataList.push(t),0>this._offsetRightBarCount&&(this._offsetRightBarCount-=1),this.adjustOffsetBarCount()))}},{key:"dataSpace",value:function(){return this._dataSpace}},{key:"barSpace",value:function(){return this._barSpace}},{key:"offsetRightBarCount",value:function(){return this._offsetRightBarCount}},{key:"setDataSpace",value:function(t){this._innerSetDataSpace(t)&&(this.adjustOffsetBarCount(),this._invalidateHandler())}},{key:"setTotalDataSpace",value:function(t){this._totalDataSpace!==t&&(this._totalDataSpace=t,this.adjustOffsetBarCount())}},{key:"setOffsetRightSpace",value:function(t){this._offsetRightBarCount=t/this._dataSpace,this.adjustOffsetBarCount()}},{key:"setLeftMinVisibleBarCount",value:function(t){D(t)&&t>0&&(this._leftMinVisibleBarCount=Math.ceil(t))}},{key:"setRightMinVisibleBarCount",value:function(t){D(t)&&t>0&&(this._rightMinVisibleBarCount=Math.ceil(t))}},{key:"from",value:function(){return this._from}},{key:"to",value:function(){return this._to}},{key:"crossHairPoint",value:function(){return this._crossHairPoint}},{key:"crossHairSeriesTag",value:function(){return this._crossHairSeriesTag}},{key:"setCrossHairSeriesTag",value:function(t){this._crossHairSeriesTag=t,this._invalidateHandler(ct)}},{key:"setCrossHairPoint",value:function(t){this._crossHairPoint=t}},{key:"startScroll",value:function(){this._preOffsetRightBarCount=this._offsetRightBarCount}},{key:"scroll",value:function(t){var e=t/this._dataSpace;this._offsetRightBarCount=this._preOffsetRightBarCount-e,this.adjustOffsetBarCount(),e>0&&0===this._from&&this._loadMoreHandler(),this._invalidateHandler()}},{key:"coordinateToFloatIndex",value:function(t){return Math.round(1e6*(this._dataList.length+this._offsetRightBarCount-(this._totalDataSpace-t)/this._dataSpace))/1e6}},{key:"zoom",value:function(t,e){var i=this.coordinateToFloatIndex(e.x);this._innerSetDataSpace(this._dataSpace+t*(this._dataSpace/10))&&(this._offsetRightBarCount+=i-this.coordinateToFloatIndex(e.x),this.adjustOffsetBarCount(),this._invalidateHandler())}},{key:"adjustOffsetBarCount",value:function(){var t=this._dataList.length,e=this._totalDataSpace/this._dataSpace,i=1-this._barSpace/2/this._dataSpace,a=e-Math.min(this._leftMinVisibleBarCount,t)+i;this._offsetRightBarCount>a&&(this._offsetRightBarCount=a);var n=1-t+Math.min(this._rightMinVisibleBarCount,t)-i;n>this._offsetRightBarCount&&(this._offsetRightBarCount=n),this._to=Math.round(this._offsetRightBarCount+t),this._from=Math.floor(this._to-e)-1,this._to>t&&(this._to=t),0>this._from&&(this._from=0)}},{key:"graphicMarkType",value:function(){return this._graphicMarkType}},{key:"setGraphicMarkType",value:function(t){this._graphicMarkType=t}},{key:"dragGraphicMarkFlag",value:function(){return this._dragGraphicMarkFlag}},{key:"setDragGraphicMarkFlag",value:function(t){this._dragGraphicMarkFlag=t}},{key:"graphicMarkPoint",value:function(){return this._graphicMarkPoint}},{key:"setGraphicMarkPoint",value:function(t){this._graphicMarkPoint=t}},{key:"graphicMarkData",value:function(){return m(this._graphicMarkDatas)}},{key:"setGraphicMarkData",value:function(t){var e=this.shouldInvalidateGraphicMark();this._graphicMarkDatas=m(t),(e||this.shouldInvalidateGraphicMark())&&this._invalidateHandler(ot)}},{key:"loadMore",value:function(t){this._loadMoreCallback=t}},{key:"shouldInvalidateGraphicMark",value:function(){if(this._graphicMarkType!==ut)return!0;for(var t in this._graphicMarkDatas)if(this._graphicMarkDatas[t].length>0)return!0;return!1}}]),t}();function bt(t){return(window.devicePixelRatio||1)/(t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}function Tt(t,e){return t.measureText(e).width}function Pt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Arial";return"".concat(t,"px ").concat(e)}function At(t,e,i,a){t.beginPath();var n=t.lineWidth%2?.5:0;t.moveTo(i,e+n),t.lineTo(a,e+n),t.stroke(),t.closePath()}function Ct(t,e,i,a){t.beginPath();var n=t.lineWidth%2?.5:0;t.moveTo(e+n,i),t.lineTo(e+n,a),t.stroke(),t.closePath()}function Et(t,e){t.save(),t.lineWidth%2&&t.translate(.5,.5),e(),t.restore()}var Lt=function(){function t(e){i(this,t),this._container=e.container,this._chartData=e.chartData,this._width=-1,this._height=-1,this._initBefore(e),this._initElement(),this._mainWidget=this._createMainWidget(this._mainWidgetCell,e),this._yAxisWidget=this._createYAxisWidget(this._yAxisWidgetCell,e)}return n(t,[{key:"_initBefore",value:function(t){}},{key:"_initElement",value:function(){this._element=document.createElement("div"),this._element.style.margin="0",this._element.style.padding="0",this._element.style.position="relative",this._element.style.overflow="hidden",this._element.style.width="100%",this._mainWidgetCell=this._createCell(),this._yAxisWidgetCell=this._createCell(),this._element.appendChild(this._mainWidgetCell),this._element.appendChild(this._yAxisWidgetCell);var t=this._container.lastChild;t?this._container.insertBefore(this._element,t):this._container.appendChild(this._element)}},{key:"_createCell",value:function(){var t=document.createElement("div");return t.style.display="table-cell",t.style.position="absolute",t.style.margin="0",t.style.padding="0",t.style.top="0",t.style.zIndex="1",t}},{key:"_createMainWidget",value:function(t,e){}},{key:"_createYAxisWidget",value:function(t,e){}},{key:"_setCellSize",value:function(t,e){t.style.left="".concat(e.left,"px"),t.style.width="".concat(e.width,"px"),t.style.height="".concat(e.height,"px")}},{key:"_computeAxis",value:function(){}},{key:"width",value:function(){return this._element.offsetWidth}},{key:"height",value:function(){return this._height}},{key:"setHeight",value:function(t){this._height=t}},{key:"setSize",value:function(t,e){this._height=t.height,this._element.style.height="".concat(t.height,"px"),this._setCellSize(this._mainWidgetCell,t),this._setCellSize(this._yAxisWidgetCell,e),this._mainWidget.setSize(t.width,this._height),this._yAxisWidget&&this._yAxisWidget.setSize(e.width,e.height)}},{key:"invalidate",value:function(t){t===lt&&this._computeAxis(),this._yAxisWidget&&this._yAxisWidget.invalidate(t),this._mainWidget.invalidate(t)}},{key:"getImage",value:function(t,e){var i=document.createElement("canvas"),a=i.getContext("2d"),n=bt(a),r=this._element.offsetWidth,s=this._element.offsetHeight;i.style.width="".concat(r,"px"),i.style.height="".concat(s,"px"),i.width=r*n,i.height=s*n,a.scale(n,n);var o=this._mainWidgetCell.offsetWidth,c=this._mainWidgetCell.offsetHeight,h=parseInt(this._mainWidgetCell.style.left,10),l=this._yAxisWidgetCell.offsetWidth,u=this._yAxisWidgetCell.offsetHeight,_=parseInt(this._yAxisWidgetCell.style.left,10);return a.drawImage(this._mainWidget.getImage(t,e),h,0,o,c),this._yAxisWidget&&a.drawImage(this._yAxisWidget.getImage(t),_,0,l,u),i}},{key:"destroy",value:function(){this._container.removeChild(this._element)}}]),t}(),It=function(){function t(e){i(this,t),this._width=0,this._height=0,this._initElement(e.container),this._mainView=this._createMainView(this._element,e),this._expandView=this._createExpandView(this._element,e),this._floatLayerView=this._createFloatLayerView(this._element,e)}return n(t,[{key:"_initElement",value:function(t){this._element=document.createElement("div"),this._element.style.margin="0",this._element.style.padding="0",this._element.style.width="100%",this._element.style.height="100%",this._element.style.position="relative",this._element.style.overflow="hidden",t.appendChild(this._element)}},{key:"_createMainView",value:function(t,e){}},{key:"_createExpandView",value:function(t,e){}},{key:"_createFloatLayerView",value:function(t,e){}},{key:"setSize",value:function(t,e){this._width=t,this._height=e,this._mainView.setSize(t,e),this._floatLayerView.setSize(t,e)}},{key:"invalidate",value:function(t){switch(t){case ct:this._floatLayerView.flush();break;case ht:case lt:this._mainView.flush(),this._floatLayerView.flush()}}},{key:"getImage",value:function(t,e){var i=document.createElement("canvas"),a=i.getContext("2d"),n=bt(a);return i.style.width="".concat(this._width,"px"),i.style.height="".concat(this._height,"px"),i.width=this._width*n,i.height=this._height*n,a.scale(n,n),a.drawImage(this._mainView.getImage(),0,0,this._width,this._height),e&&this._expandView&&a.drawImage(this._expandView.getImage(),0,0,this._width,this._height),t&&a.drawImage(this._floatLayerView.getImage(),0,0,this._width,this._height),i}}]),t}();var Rt=function(){function t(e,a){i(this,t),this._chartData=a,this._initCanvas(e)}return n(t,[{key:"_initCanvas",value:function(t){this._canvas=document.createElement("canvas"),this._canvas.style.position="absolute",this._canvas.style.right="0",this._canvas.style.left="0",this._canvas.style.zIndex="2",this._ctx=this._canvas.getContext("2d"),t.appendChild(this._canvas)}},{key:"_redraw",value:function(t){this._ctx.clearRect(0,0,this._width,this._height),t&&t(),this._draw()}},{key:"_draw",value:function(){}},{key:"setSize",value:function(t,e){var i=this;this._redraw((function(){var a=bt(i._ctx);i._width=t,i._height=e,i._canvas.style.top="0",i._canvas.style.width="".concat(t,"px"),i._canvas.style.height="".concat(e,"px"),i._canvas.width=t*a,i._canvas.height=e*a,i._ctx.scale(a,a)}))}},{key:"flush",value:function(){var t,e,i=this;this.requestAnimationId&&(t=this.requestAnimationId,window.cancelAnimationFrame||clearTimeout(t),window.cancelAnimationFrame(t)),this.requestAnimationId=(e=function(){i._redraw()},window.requestAnimationFrame?window.requestAnimationFrame(e):window.setTimeout((function(){e()}),1e3/60))}},{key:"getImage",value:function(){return this._canvas}}]),t}(),zt=function(t){s(a,t);var e=_(a);function a(t,n,r,s,o){var c;return i(this,a),(c=e.call(this,t,n))._xAxis=r,c._yAxis=s,c._additionalDataProvider=o,c}return n(a,[{key:"_draw",value:function(){this._drawGrid(),this._drawTechnicalIndicator()}},{key:"_drawGrid",value:function(){var t=this,e=this._chartData.styleOptions().grid;if(e.display){var i=e.horizontal;i.display&&(this._ctx.strokeStyle=i.color,this._ctx.lineWidth=i.size,i.style===T&&this._ctx.setLineDash(i.dashValue),this._yAxis.ticks().forEach((function(e){At(t._ctx,e.y,0,t._width)})));var a=e.vertical;a.display&&(this._ctx.strokeStyle=a.color,this._ctx.lineWidth=a.size,this._ctx.setLineDash(a.style===T?a.dashValue:[]),this._xAxis.ticks().forEach((function(e){Ct(t._ctx,e.x,0,t._height)}))),this._ctx.setLineDash([])}}},{key:"_drawTechnicalIndicator",value:function(){var t=this,e=this._additionalDataProvider.technicalIndicatorType(),i=this._chartData.technicalIndicatorParamOptions(),a=[],n=this._chartData.styleOptions().technicalIndicator,r=this._chartData.dataList();this._drawGraphics((function(s,o,c,h){var l=N(c,e,i).values,u=v(l);switch(e){case X.MA:case X.EMA:case X.BOLL:t._drawTechnicalIndicatorOhlc(o,s,h,n,c,t._yAxis.isCandleStickYAxis());break;case X.MACD:u.splice(u.length-1,1);var _=l[l.length-1];_>0?(t._ctx.strokeStyle=n.bar.upColor,t._ctx.fillStyle=n.bar.upColor):0>_?(t._ctx.strokeStyle=n.bar.downColor,t._ctx.fillStyle=n.bar.downColor):(t._ctx.strokeStyle=n.bar.noChangeColor,t._ctx.fillStyle=n.bar.noChangeColor);var d=it(r,o-1,{}),f=it(d,"macd",{}).macd;t._drawBars(s,h,_,!((f||0===f)&&_>f));break;case X.VOL:u.splice(u.length-1,1);var p=c.close,y=c.open;t._ctx.fillStyle=p>y?n.bar.upColor:y>p?n.bar.downColor:n.bar.noChangeColor,t._drawBars(s,h,l[l.length-1],!0);break;case X.SAR:u.splice(0,1);var x=l[0];if(x||0===x){var m=t._yAxis.convertToPixel(x);t._ctx.strokeStyle=(c.high+c.low)/2>x?n.bar.upColor:n.bar.downColor,t._ctx.beginPath(),t._ctx.arc(s,m,h,2*Math.PI,0,!0),t._ctx.stroke(),t._ctx.closePath()}t._drawTechnicalIndicatorOhlc(o,s,h,n,c,t._yAxis.isCandleStickYAxis())}t._prepareLinePoints(s,u,a)}),(function(){t._drawLines(a,n)}))}},{key:"_drawTechnicalIndicatorOhlc",value:function(t,e,i,a,n,r){r||this._drawOhlc(i,e,n,a.bar.upColor,a.bar.downColor,a.bar.noChangeColor)}},{key:"_prepareLinePoints",value:function(t,e,i){for(var a=0;e.length>a;a++){var n=this._yAxis.convertToPixel(e[a]);i[a]?i[a].push({x:t,y:n}):i[a]=[{x:t,y:n}]}}},{key:"_drawLines",value:function(t,e){var i=this,a=e.line.colors,n=t.length,r=(a||[]).length;this._ctx.lineWidth=e.line.size,Et(this._ctx,(function(){for(var e=0;n>e;e++){var s=t[e];if(s.length>0){i._ctx.strokeStyle=a[e%r],i._ctx.beginPath(),i._ctx.moveTo(s[0].x,s[0].y);for(var o=1;s.length>o;o++)i._ctx.lineTo(s[o].x,s[o].y);i._ctx.stroke(),i._ctx.closePath()}}}))}},{key:"_drawBars",value:function(t,e,i,a){if(i||0===i){this._ctx.lineWidth=1;var n=this._yAxis.convertToPixel(i),r=this._yAxis.convertToPixel(0),s=n;0>i&&(s=r);var o=Math.abs(r-n);1>o&&(o=1,s=0>i?s+1:s-1),a?this._ctx.fillRect(t-e,s,2*e,o):this._ctx.strokeRect(t-e+.5,s,2*e-1,o)}}},{key:"_drawOhlc",value:function(t,e,i,a,n,r){var s=i.open,o=i.close,c=this._yAxis.convertToPixel(s),h=this._yAxis.convertToPixel(o),l=this._yAxis.convertToPixel(i.high),u=this._yAxis.convertToPixel(i.low);this._ctx.fillStyle=o>s?a:s>o?n:r,this._ctx.fillRect(e-.5,l,1,u-l),this._ctx.fillRect(e-t,c-.5,t,1),this._ctx.fillRect(e,h-.5,t,1)}},{key:"_drawGraphics",value:function(t,e){for(var i=this._chartData.dataList(),a=i.length,n=this._chartData.barSpace(),r=this._chartData.dataSpace(),s=n/2,o=this._chartData.offsetRightBarCount(),c=this._chartData.to(),h=this._chartData.from();c>h;h++){t(this._width-(a+o-h-.5)*r+s,h,i[h],s,n)}e&&e()}}]),a}(Rt),Ot=function(t){s(a,t);var e=_(a);function a(t,n,r,s,o){var c;return i(this,a),(c=e.call(this,t,n))._xAxis=r,c._yAxis=s,c._additionalDataProvider=o,c}return n(a,[{key:"_draw",value:function(){var t,e=this._chartData.crossHairPoint(),i=this._chartData.dataList(),a=i[t=e?this._xAxis.convertFromPixel(e.x):i.length-1];if(!a){var n=this._chartData.to();t>n-1?a=i[n-1]:0>t&&(a=i[0])}if(a){var r=this._xAxis.convertToPixel(t);this._drawCrossHairHorizontalLine(),this._drawCrossHairVerticalLine(a,r);var s=this._chartData.styleOptions().floatLayer.prompt.displayRule;if(s===Y||s===G&&this._chartData.crossHairSeriesTag())this._drawPrompt(a,r,t>0&&i.length>t)}}},{key:"_drawPrompt",value:function(t,e,i){this._drawTechnicalIndicatorPrompt(t,e,i)}},{key:"_drawCrossHairHorizontalLine",value:function(){if(this._chartData.crossHairSeriesTag()===this._additionalDataProvider.tag()){var t=this._chartData.styleOptions().floatLayer.crossHair,e=t.horizontal,i=e.line;if(t.display&&e.display&&i.display){var a=this._chartData.crossHairPoint();a&&(this._ctx.lineWidth=i.size,this._ctx.strokeStyle=i.color,i.style===T&&this._ctx.setLineDash(i.dashValue),At(this._ctx,a.y,0,this._width),this._ctx.setLineDash([]))}}}},{key:"_drawCrossHairVerticalLine",value:function(t,e){if(this._chartData.crossHairSeriesTag()){var i=this._chartData.styleOptions().floatLayer.crossHair,a=i.vertical,n=a.line;i.display&&a.display&&n.display&&(this._ctx.lineWidth=n.size,this._ctx.strokeStyle=n.color,n.style===T&&this._ctx.setLineDash(n.dashValue),Ct(this._ctx,e,0,this._height),this._ctx.setLineDash([]))}}},{key:"_drawTechnicalIndicatorPrompt",value:function(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=this._chartData.styleOptions().technicalIndicator,r=this._getTechnicalIndicatorPromptData(t),s=n.line.colors;this._drawTechnicalIndicatorPromptText(r,s,a),this._drawTechnicalIndicatorPromptPoint(r.values,s,e,i)}},{key:"_drawTechnicalIndicatorPromptText",value:function(t,e,i){var a=this._chartData.styleOptions().floatLayer.prompt.technicalIndicator.text,n=t.name,r=t.labels,s=t.values,o=a.marginLeft,c=a.marginRight,h=o,l=a.marginTop+i,u=a.size,_=a.color,d=e.length;this._ctx.textBaseline="top",this._ctx.font=Pt(u,a.family);var v=Tt(this._ctx,n);this._ctx.fillStyle=_,this._ctx.fillText(n,h,l),h+=o+v;for(var f=this._additionalDataProvider.technicalIndicatorType()===X.VOL,p=0;r.length>p;p++){var y="".concat(r[p].toUpperCase(),": ").concat((f?rt(s[p]):s[p])||"--"),x=Tt(this._ctx,y);this._ctx.fillStyle=e[p%d]||_,this._ctx.fillText(y,h,l),h+=o+c+x}}},{key:"_drawTechnicalIndicatorPromptPoint",value:function(t,e,i,a){var n=this._chartData.styleOptions().floatLayer.prompt.technicalIndicator.point;if(n.display){var r=this._additionalDataProvider.technicalIndicatorType();if(this._chartData.crossHairSeriesTag()&&r!==X.SAR&&a)for(var s=e.length,o=r===X.MACD||r===X.VOL?t.length-1:t.length,c=n.radius,h=0;o>h;h++){var l=t[h];if(l||0===l){var u=this._yAxis.convertToPixel(l);this._ctx.fillStyle=e[h%s],this._ctx.beginPath(),this._ctx.arc(i,u,c,0,2*Math.PI),this._ctx.closePath(),this._ctx.fill()}}}}},{key:"_getTechnicalIndicatorPromptData",value:function(t){var e=this._chartData.technicalIndicatorParamOptions(),i=this._additionalDataProvider.technicalIndicatorType(),a=N(t,i,e),n=this._chartData.technicalIndicatorParamOptions()[i]||[],r=a.keys,s=a.values,o="";if(r.length>0){o="".concat(i),n&&g(n)&&n.length>0&&(o="".concat(o,"(").concat(n.join(","),")"));var c=this._chartData.precisionOptions()[i];s.forEach((function(t,e){s[e]=nt(t,c)}))}return{labels:r,values:s,name:o}}}]),a}(Rt),Ht=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_createMainView",value:function(t,e){return new zt(t,e.chartData,e.xAxis,e.yAxis,e.additionalDataProvider)}},{key:"_createFloatLayerView",value:function(t,e){return new Ot(t,e.chartData,e.xAxis,e.yAxis,e.additionalDataProvider)}}]),a}(It),Vt=function(t){s(a,t);var e=_(a);function a(t,n,r,s){var o;return i(this,a),(o=e.call(this,t,n))._yAxis=r,o._additionalDataProvider=s,o}return n(a,[{key:"_draw",value:function(){var t=this._chartData.styleOptions().yAxis;t.display&&(this._drawAxisLine(t),this._drawTickLines(t),this._drawTickLabels(t),this._drawTechnicalIndicatorLastValue(t),this._drawLastPriceLabel(t))}},{key:"_drawAxisLine",value:function(t){var e,i=t.axisLine;i.display&&(this._ctx.strokeStyle=i.color,this._ctx.lineWidth=i.size,e=this._isDrawFromStart(t)?0:this._width-1,Ct(this._ctx,e,0,this._height))}},{key:"_drawTickLines",value:function(t){var e=this,i=t.tickLine;if(i.display){this._ctx.lineWidth=i.size,this._ctx.strokeStyle=i.color;var a,n,r=i.length;this._isDrawFromStart(t)?(a=0,t.axisLine.display&&(a+=t.axisLine.size),n=a+r):(a=this._width,t.axisLine.display&&(a-=t.axisLine.size),n=a-r),this._yAxis.ticks().forEach((function(t){At(e._ctx,t.y,a,n)}))}}},{key:"_drawTickLabels",value:function(t){var e=this,i=t.tickText;if(i.display){var a,n=t.tickLine,r=n.display,s=n.length,o=i.margin;this._isDrawFromStart(t)?(a=o,t.axisLine.display&&(a+=t.axisLine.size),r&&(a+=s),this._ctx.textAlign="left"):(a=this._width-o,t.axisLine.display&&(a-=t.axisLine.size),r&&(a-=s),this._ctx.textAlign="right"),this._ctx.textBaseline="middle",this._ctx.font=Pt(i.size,i.family),this._ctx.fillStyle=i.color;var c=this._additionalDataProvider.technicalIndicatorType()===X.VOL;this._yAxis.ticks().forEach((function(t){e._ctx.fillText(c?rt(t.v):t.v,a,t.y)})),this._ctx.textAlign="left"}}},{key:"_drawTechnicalIndicatorLastValue",value:function(t){var e=this._chartData.styleOptions().technicalIndicator,i=e.lastValueMark,a=this._chartData.dataList(),n=a[a.length-1];if(i.display&&n)for(var r=this._chartData.technicalIndicatorParamOptions(),s=this._additionalDataProvider.technicalIndicatorType(),o=N(n,s,r).values,c=e.line.colors||[],h=c.length,l=o.length,u=0;l>u;u++){var _=c[u%h];this._drawMarkLabel(t,o[u],this._chartData.precisionOptions()[s],i.textSize,i.textFamily,i.textColor,_,i.textPaddingLeft,i.textPaddingTop,i.textPaddingRight,i.textPaddingBottom)}}},{key:"_drawLastPriceLabel",value:function(t){if(this._yAxis.isCandleStickYAxis()){var e=this._chartData.styleOptions().candleStick.priceMark,i=e.last,a=this._chartData.dataList(),n=a.length;if(e.display&&i.display&&i.text.display&&0!==n){var r,s=a[n-1],o=s.close,c=s.open;r=o>c?i.upColor:c>o?i.downColor:i.noChangeColor;var h=i.text;this._drawMarkLabel(t,o,this._chartData.precisionOptions().price,h.size,h.family,h.color,r,h.paddingLeft,h.paddingTop,h.paddingRight,h.paddingBottom)}}}},{key:"_drawMarkLabel",value:function(t,e,i,a,n,r,s,o,c,h,l){var u,_=this._yAxis.convertToPixel(e);if(_=+Math.max(.05*this._height,Math.min(_,.98*this._height)).toFixed(0),this._yAxis.isPercentageYAxis()){var d=this._chartData.dataList()[this._chartData.from()].close;u="".concat(((e-d)/d*100).toFixed(2),"%")}else u=nt(e,i),this._additionalDataProvider.technicalIndicatorType()===X.VOL&&(u=rt(u));this._ctx.font=Pt(a,n);var v,f=Tt(this._ctx,u)+o+h,p=c+a+l;v=this._isDrawFromStart(t)?0:this._width-f,this._ctx.fillStyle=s,this._ctx.fillRect(v,_-c-a/2,f,p),this._ctx.fillStyle=r,this._ctx.textBaseline="middle",this._ctx.fillText(u,v+o,_)}},{key:"_isDrawFromStart",value:function(t){return t.position===P&&t.tickText.position===E||t.position===A&&t.tickText.position===L}}]),a}(Rt),Bt=function(t){s(a,t);var e=_(a);function a(t,n,r,s){var o;return i(this,a),(o=e.call(this,t,n))._yAxis=r,o._additionalDataProvider=s,o}return n(a,[{key:"_draw",value:function(){this._drawCrossHairLabel()}},{key:"_drawCrossHairLabel",value:function(){if(this._chartData.crossHairSeriesTag()===this._additionalDataProvider.tag()&&0!==this._chartData.dataList().length){var t=this._chartData.styleOptions().floatLayer.crossHair,e=t.horizontal,i=e.text;if(t.display&&e.display&&i.display){var a=this._chartData.crossHairPoint();if(a){var n,r=this._yAxis.convertFromPixel(a.y);if(this._yAxis.isPercentageYAxis()){var s=this._chartData.dataList()[this._chartData.from()].close;n="".concat(((r-s)/s*100).toFixed(2),"%")}else{var o=this._additionalDataProvider.technicalIndicatorType();n=nt(r,this._chartData.precisionOptions()[this._yAxis.isCandleStickYAxis()?"price":o]),o===X.VOL&&(n=rt(n))}var c=i.size;this._ctx.font=Pt(c,i.family);var h,l=Tt(this._ctx,n),u=i.paddingLeft,_=i.paddingTop,d=i.borderSize,v=l+2*d+u+i.paddingRight,f=c+2*d+_+i.paddingBottom,p=this._chartData.styleOptions().yAxis;h=p.position===P&&p.tickText.position===E||p.position===A&&p.tickText.position===L?0:this._width-v;var y=a.y-d-_-c/2;this._ctx.fillStyle=i.backgroundColor,this._ctx.fillRect(h,y,v,f),this._ctx.lineWidth=d,this._ctx.strokeStyle=i.borderColor,this._ctx.strokeRect(h,y,v,f),this._ctx.textBaseline="middle",this._ctx.fillStyle=i.color,this._ctx.fillText(n,h+d+u,a.y)}}}}}]),a}(Rt),Yt=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_createMainView",value:function(t,e){return new Vt(t,e.chartData,e.yAxis,e.additionalDataProvider)}},{key:"_createFloatLayerView",value:function(t,e){return new Bt(t,e.chartData,e.yAxis,e.additionalDataProvider)}}]),a}(It),Gt=function(){function t(e){i(this,t),this._chartData=e,this._width=0,this._height=0,this._minValue=0,this._maxValue=0,this._range=0,this._ticks=[]}return n(t,[{key:"setSize",value:function(t,e){this._width=t,this._height=e}},{key:"ticks",value:function(){return this._ticks}},{key:"computeAxis",value:function(){var t=this._computeMinMaxValue(),e=t.max,i=t.range;this._minValue=t.min,this._maxValue=e,this._range=i,this._ticks=this._computeOptimalTicks(this._computeTicks())}},{key:"_computeMinMaxValue",value:function(){}},{key:"_computeOptimalTicks",value:function(t){}},{key:"_computeTicks",value:function(){var t=[];if(this._range>=0){var e=+this._nice(this._range/6),i=this._getIntervalPrecision(e),a=+this._round(Math.ceil(this._minValue/e)*e,i),n=+this._round(Math.floor(this._maxValue/e)*e,i),r=0,s=a;if(0!==e)for(;n>=s;)t[r]={v:s.toFixed(i)},++r,s+=e}return t}},{key:"_nice",value:function(t){var e=Math.floor(Math.log(t)/Math.LN10),i=Math.pow(10,e),a=t/i;return t=(1.5>a?1:2.5>a?2:3.5>a?3:4.5>a?4:5.5>a?5:6.5>a?6:8)*i,-20>e?t:+t.toFixed(0>e?-e:0)}},{key:"_getIntervalPrecision",value:function(t){var e=""+t,i=e.indexOf("e");if(i>0){var a=+e.slice(i+1);return 0>a?-a:0}var n=e.indexOf(".");return 0>n?0:e.length-1-n}},{key:"_round",value:function(t,e){return null==e&&(e=10),t=(+t).toFixed(e=Math.min(Math.max(0,e),20))}}]),t}(),Ft=function(t){s(a,t);var e=_(a);function a(t,n){var r;return i(this,a),(r=e.call(this,t))._isCandleStickYAxis=n,r}return n(a,[{key:"_compareMinMax",value:function(t,e,i){var a=it(t,e.toLowerCase(),{});return Object.keys(a).forEach((function(t){var e=a[t];(e||0===e)&&(i[0]=Math.min(i[0],e),i[1]=Math.max(i[1],e))})),e!==X.BOLL&&e!==X.SAR||(i[0]=Math.min(i[0],t.low),i[1]=Math.max(i[1],t.high)),i}},{key:"_computeMinMaxValue",value:function(){var t=this._minValue,e=this._maxValue;if(t===1/0||e===-1/0)return{min:0,max:0,range:0};var i=Math.abs(e-t);return{min:t-=i/100*10,max:e+=i/100*20,range:i=Math.abs(e-t)}}},{key:"_computeOptimalTicks",value:function(t){var e=[],i=t.length;if(i>0){var a=this._chartData.styleOptions().xAxis.tickText.size,n=this._innerConvertToPixel(+t[0].v),r=1;if(i>1){var s=this._innerConvertToPixel(+t[1].v),o=Math.abs(s-n);2*a>o&&(r=Math.ceil(2*a/o))}for(var c=this.isPercentageYAxis(),h=0;i>h;h+=r){var l=t[h].v,u=this._innerConvertToPixel(+(l=0==+l?"0":l));u>a&&this._height-a>u&&e.push({v:c?"".concat((+l).toFixed(2),"%"):l,y:u})}}return e}},{key:"calcMinMaxValue",value:function(t,e){var i=this._chartData.dataList(),a=this._chartData.from(),n=this._chartData.to(),r=this._chartData.styleOptions().realTime.averageLine.display,s=[1/0,-1/0];if(e)for(var o=a;n>o;o++){var c=i[o],h=[c.close,s[0]],l=[c.close,s[1]];r&&(h.push(c.average),l.push(c.average)),s[0]=Math.min.apply(null,h),s[1]=Math.max.apply(null,l)}else{for(var u=a;n>u;u++){var _=i[u];this._compareMinMax(_,t,s),this._isCandleStickYAxis&&(s[0]=Math.min(_.low,s[0]),s[1]=Math.max(_.high,s[1]))}t===X.VOL&&(s[0]=0)}if(s[0]!==1/0&&s[1]!==-1/0)if(this.isPercentageYAxis()){var d=i[a].close;this._minValue=(s[0]-d)/d*100,this._maxValue=(s[1]-d)/d*100,this._minValue===this._maxValue&&(this._minValue-=10,this._maxValue+=10)}else this._minValue=s[0],this._maxValue=s[1],this._minValue===this._maxValue&&(this._minValue-=1,0>this._minValue?(this._minValue=0,this._maxValue=Math.max(1,2*this._maxValue)):this._maxValue+=1)}},{key:"_innerConvertToPixel",value:function(t){return Math.round((1-(t-this._minValue)/this._range)*this._height)}},{key:"isCandleStickYAxis",value:function(){return this._isCandleStickYAxis}},{key:"isPercentageYAxis",value:function(){return this._isCandleStickYAxis&&this._chartData.styleOptions().yAxis.type===C}},{key:"convertFromPixel",value:function(t){var e=(1-t/this._height)*this._range+this._minValue;if(this.isPercentageYAxis()){var i=this._chartData.dataList()[this._chartData.from()].close;return i*e/100+i}return e}},{key:"convertToPixel",value:function(t){var e=t;if(this.isPercentageYAxis()){var i=this._chartData.dataList()[this._chartData.from()].close;e=(t-i)/i*100}return this._innerConvertToPixel(e)}}]),a}(Gt),Wt=function(t){s(a,t);var e=_(a);function a(t){var n;return i(this,a),(n=e.call(this,t))._technicalIndicatorType=t.technicalIndicatorType||X.MACD,n._chartData.calcTechnicalIndicator(l(n),n._technicalIndicatorType),n}return n(a,[{key:"_initBefore",value:function(t){this._tag=t.tag,this._yAxis=this._createYAxis(t)}},{key:"_createYAxis",value:function(t){return new Ft(t.chartData,!1)}},{key:"_createMainWidget",value:function(t,e){return new Ht({container:t,chartData:e.chartData,xAxis:e.xAxis,yAxis:this._yAxis,additionalDataProvider:{technicalIndicatorType:this.technicalIndicatorType.bind(this),tag:this.tag.bind(this)}})}},{key:"_createYAxisWidget",value:function(t,e){return new Yt({container:t,chartData:e.chartData,yAxis:this._yAxis,additionalDataProvider:{technicalIndicatorType:this.technicalIndicatorType.bind(this),tag:this.tag.bind(this)}})}},{key:"_computeAxis",value:function(){this._yAxis.calcMinMaxValue(this._technicalIndicatorType,this._isRealTime()),this._yAxis.computeAxis()}},{key:"_isRealTime",value:function(){return!1}},{key:"tag",value:function(){return this._tag}},{key:"setSize",value:function(t,e){this._yAxis.setSize(e.width,e.height),this._computeAxis(),d(o(a.prototype),"setSize",this).call(this,t,e)}},{key:"yAxis",value:function(){return this._yAxis}},{key:"technicalIndicatorType",value:function(){return this._technicalIndicatorType}},{key:"setTechnicalIndicatorType",value:function(t){this._technicalIndicatorType!==t&&(this._technicalIndicatorType=t,this._chartData.calcTechnicalIndicator(this,this._technicalIndicatorType))}}]),a}(Lt),Xt=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_draw",value:function(){this._drawGrid(),this._additionalDataProvider.chartType()===I?this._drawRealTime():(this._drawCandleStick(),this._drawTechnicalIndicator(),this._drawHighestPriceMark(),this._drawLowestPriceMark()),this._drawLastPriceLine()}},{key:"_drawRealTime",value:function(){var t=this,e=[],i=[],a=[],n=this._chartData.from();this._drawGraphics((function(r,s,o,c){var h=o.average,l=t._yAxis.convertToPixel(o.close),u=t._yAxis.convertToPixel(h);if((h||0===h)&&a.push({x:r,y:u}),s===n){var _=r-c;i.push({x:_,y:t._height}),i.push({x:_,y:l}),e.push({x:_,y:l})}e.push({x:r,y:l}),i.push({x:r,y:l})}),(function(){var n=i.length;if(n>0){var r=i[n-1],s=t._chartData.barSpace()/2,o=r.x+s;e.push({x:o,y:r.y}),i.push({x:o,y:r.y}),i.push({x:o,y:t._height})}var c=t._chartData.styleOptions().realTime,h=c.timeLine;if(e.length>0&&(t._ctx.lineWidth=h.size,t._ctx.strokeStyle=h.color,Et(t._ctx,(function(){t._ctx.beginPath(),t._ctx.moveTo(e[0].x,e[0].y);for(var i=1;e.length>i;i++)t._ctx.lineTo(e[i].x,e[i].y);t._ctx.stroke(),t._ctx.closePath()}))),i.length>0){t._ctx.fillStyle=h.areaFillColor,t._ctx.beginPath(),t._ctx.moveTo(i[0].x,i[0].y);for(var l=1;i.length>l;l++)t._ctx.lineTo(i[l].x,i[l].y);t._ctx.closePath(),t._ctx.fill()}var u=c.averageLine;u.display&&a.length>0&&(t._ctx.lineWidth=u.size,t._ctx.strokeStyle=u.color,Et(t._ctx,(function(){t._ctx.beginPath(),t._ctx.moveTo(a[0].x,a[0].y);for(var e=1;a.length>e;e++)t._ctx.lineTo(a[e].x,a[e].y);t._ctx.stroke(),t._ctx.closePath()})))}))}},{key:"_drawCandleStick",value:function(){var t=this,e=[],i=-1/0,a=-1,n=1/0,r=-1,s=this._chartData.styleOptions().candleStick;this._drawGraphics((function(o,c,h,l,u){var _=h.open,d=h.close,v=h.high,f=h.low;if(v>i&&(i=v,a=o),n>f&&(n=f,r=o),s.bar.style!==B){d>_?(t._ctx.strokeStyle=s.bar.upColor,t._ctx.fillStyle=s.bar.upColor):_>d?(t._ctx.strokeStyle=s.bar.downColor,t._ctx.fillStyle=s.bar.downColor):(t._ctx.strokeStyle=s.bar.noChangeColor,t._ctx.fillStyle=s.bar.noChangeColor);var p=t._yAxis.convertToPixel(_),y=t._yAxis.convertToPixel(d),x=t._yAxis.convertToPixel(v),m=t._yAxis.convertToPixel(f),g=[],k=[];switch(g[0]=x,k[1]=m,p>y?(g[1]=y,k[0]=p,e=[o-l,y,u,p-y]):y>p?(g[1]=p,k[0]=y,e=[o-l,p,u,y-p]):(g[1]=p,k[0]=y,e=[o-l,p,u,1]),t._ctx.fillRect(o-.5,g[0],1,g[1]-g[0]),t._ctx.fillRect(o-.5,k[0],1,k[1]-k[0]),1>e[3]&&(e[3]=1),s.bar.style){case z:t._ctx.fillRect(e[0],e[1],e[2],e[3]);break;case O:t._ctx.strokeRect(e[0]+.5,e[1],e[2]-1,e[3]);break;case H:d>_?t._ctx.strokeRect(e[0]+.5,e[1],e[2]-1,e[3]):t._ctx.fillRect(e[0],e[1],e[2],e[3]);break;case V:d>_?t._ctx.fillRect(e[0],e[1],e[2],e[3]):t._ctx.strokeRect(e[0],e[1],e[2],e[3])}}else t._drawOhlc(l,o,h,s.bar.upColor,s.bar.downColor,s.bar.noChangeColor)})),this._highestMarkData={x:a,price:i},this._lowestMarkData={x:r,price:n}}},{key:"_drawHighestPriceMark",value:function(t){if(this._highestMarkData){var e=this._highestMarkData.price,i=this._chartData.styleOptions().candleStick.priceMark,a=i.high;e!==-1/0&&i.display&&a.display&&this._drawLowestHighestPriceMark(a,this._highestMarkData.x,e,!0,this._chartData.precisionOptions().price)}}},{key:"_drawLowestPriceMark",value:function(){if(this._lowestMarkData){var t=this._lowestMarkData.price,e=this._chartData.styleOptions().candleStick.priceMark,i=e.low;t!==1/0&&e.display&&i.display&&this._drawLowestHighestPriceMark(i,this._lowestMarkData.x,t,!1,this._chartData.precisionOptions().price)}}},{key:"_drawLowestHighestPriceMark",value:function(t,e,i,a,n){var r=this,s=this._yAxis.convertToPixel(i),o=e,c=s+(a?-2:2);this._ctx.textAlign="left",this._ctx.lineWidth=1,this._ctx.strokeStyle=t.color,this._ctx.fillStyle=t.color,Et(this._ctx,(function(){r._ctx.beginPath(),r._ctx.moveTo(o,c),r._ctx.lineTo(o-2,c+(a?-2:2)),r._ctx.stroke(),r._ctx.closePath(),r._ctx.beginPath(),r._ctx.moveTo(o,c),r._ctx.lineTo(o+2,c+(a?-2:2)),r._ctx.stroke(),r._ctx.closePath()}));var h=c+(a?-5:5);Ct(this._ctx,o,c,h),At(this._ctx,h,o,o+5),this._ctx.font=Pt(t.textSize,t.textFamily);var l=nt(i,n);this._ctx.textBaseline="middle",this._ctx.fillText(l,o+5+t.textMargin,h)}},{key:"_drawLastPriceLine",value:function(){var t=this._chartData.dataList(),e=t.length,i=this._chartData.styleOptions().candleStick.priceMark,a=i.last;if(i.display&&a.display&&a.line.display&&0!==e){var n=t[e-1],r=n.close,s=n.open,o=this._yAxis.convertToPixel(r);o=+Math.max(.05*this._height,Math.min(o,.98*this._height)).toFixed(0);var c=a.line;this._ctx.strokeStyle=r>s?a.upColor:s>r?a.downColor:a.noChangeColor,this._ctx.lineWidth=c.size,c.style===T&&this._ctx.setLineDash(c.dashValue),At(this._ctx,o,0,this._width),this._ctx.setLineDash([])}}}]),a}(zt),jt=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_drawPrompt",value:function(t,e,i){var a=this._chartData.styleOptions().floatLayer.prompt.candleStick,n=this._getCandleStickPromptData(t,a);a.showType===F?(this._drawCandleStickStandardPromptText(a,n),this._additionalDataProvider.chartType()===R&&this._drawTechnicalIndicatorPrompt(t,e,i,a.text.size+a.text.marginTop)):this._drawCandleStickRectPromptText(t,e,a,n)}},{key:"_drawCandleStickStandardPromptText",value:function(t,e){var i=this,a=e,n=t.text.marginLeft,r=t.text.marginRight,s=t.text.size,o=t.text.color,c=t.labels;this._ctx.textBaseline="top",this._ctx.font=Pt(s,t.text.family);var h=n,l=t.text.marginTop;c.forEach((function(t,e){var s=t?"".concat(t,": "):"",c=Tt(i._ctx,s);i._ctx.fillStyle=o,i._ctx.fillText(s,h,l),h+=c;var u,_=a[e]||"--";M(_)?(u=_.value||"--",i._ctx.fillStyle=_.color||o):(i._ctx.fillStyle=o,u=_);var d=Tt(i._ctx,u);i._ctx.fillText(u,h,l),h+=d+n+r}))}},{key:"_drawCandleStickRectPromptText",value:function(t,e,i,a){var n=this,r=i.labels,s=a,o=i.text.marginLeft,c=i.text.marginRight,h=i.text.marginTop,l=i.text.marginBottom,u=i.text.size,_=i.text.color;this._ctx.textBaseline="top",this._ctx.font=Pt(u,i.text.family);var d=0;r.forEach((function(t,e){var i=s[e]||"--",a=i;M(i)&&(a=i.value||"--");var r="".concat(t,": ").concat(a),h=Tt(n._ctx,r)+o+c;d=Math.max(d,h)}));var v=i.rect,f=v.borderSize,p=v.paddingLeft,y=v.paddingRight,x=v.paddingTop,m=v.left,g=v.right,k=2*f+x+v.paddingBottom+(l+h+u)*r.length,D=this._getTechnicalIndicatorPromptData(t),w=this._chartData.styleOptions().floatLayer.prompt.technicalIndicator,S=w.text.marginLeft,b=w.text.marginRight,T=w.text.marginTop,P=w.text.marginBottom,A=w.text.size,C=this._additionalDataProvider.chartType()===R,E=D.labels||[],L=D.values||[];C&&(this._ctx.font=Pt(A,w.text.family),E.forEach((function(t,e){var i=L[e]||"--",a="".concat(t,": ").concat(i),r=Tt(n._ctx,a)+S+b;d=Math.max(d,r)})),k+=(T+P+A)*E.length);var I,z=2*f+d+p+y;I=this._width/2>e?this._width-g-z:m;var O=v.top,H=v.borderRadius;this._ctx.lineWidth=f,this._ctx.strokeStyle=v.borderColor,this._ctx.fillStyle=v.fillColor,this._drawRoundRect(I,O,z,k,H),this._ctx.stroke(),this._drawRoundRect(I,O,z,k,H),this._ctx.fill();var V=I+f+p+o,B=O+f+x;if(this._ctx.font=Pt(u,i.text.family),r.forEach((function(t,e){B+=h,n._ctx.textAlign="left",n._ctx.fillStyle=_,n._ctx.fillText("".concat(t,": "),V,B);var i,a=s[e]||"--";n._ctx.fillStyle=a.color||_,i=M(a)?a.value||"--":a,n._ctx.textAlign="right",n._ctx.fillText(i,I+z-f-c-y,B),B+=u+l})),C){var Y=this._chartData.styleOptions().technicalIndicator,G=Y.line.colors,F=I+f+p+S,W=G.length;this._ctx.font=Pt(A,w.text.family),E.forEach((function(t,e){B+=T,n._ctx.textAlign="left",n._ctx.fillStyle=G[e%W]||Y.text.color,n._ctx.fillText("".concat(t.toUpperCase(),": "),F,B),n._ctx.textAlign="right",n._ctx.fillText(L[e]||"--",I+z-f-b-y,B),B+=A+P}))}this._ctx.textAlign="left"}},{key:"_drawRoundRect",value:function(t,e,i,a,n){this._ctx.beginPath(),this._ctx.moveTo(t+n,e),this._ctx.arcTo(t+i,e,t+i,e+a,n),this._ctx.arcTo(t+i,e+a,t,e+a,n),this._ctx.arcTo(t,e+a,t,e,n),this._ctx.arcTo(t,e,t+i,e,n),this._ctx.closePath()}},{key:"_getCandleStickPromptData",value:function(t,e){var i=this,a=e.values,n=[];if(a)n=k(a)?a(t)||[]:a;else{var r=this._chartData.precisionOptions();(n=[it(t,"timestamp"),it(t,"open"),it(t,"close"),it(t,"high"),it(t,"low"),it(t,"volume")]).forEach((function(t,e){switch(e){case 0:n[e]=at(t,"YYYY-MM-DD hh:mm",i._chartData.timezone());break;case n.length-1:n[e]=rt(nt(t,r.volume));break;default:n[e]=nt(t,r.price)}}))}return n}}]),a}(Ot);function Nt(t,e,i){var a=[];if(t&&e&&i.length>0){var n=t.x-e.x;if(0===n)i.forEach((function(t){a.push(t.y)}));else{var r=(t.y-e.y)/n,s=t.y-r*t.x;i.forEach((function(t){a.push(t.x*r+s)}))}}return a}function Kt(t,e,i){return!!(i&&t&&e)&&(t.x===e.x?1>Math.abs(i.x-t.x):t.y===e.y?1>Math.abs(i.y-t.y):1>Math.abs(i.y-Nt(t,e,[i])[0]))}function Ut(t,e,i){return!!(i&&t&&e)&&(!!Kt(t,e,i)&&(t.x===e.x?e.y>t.y?i.y>t.y-2:t.y+2>i.y:e.x>t.x?i.x>t.x-2:t.x+2>i.x))}function Zt(t,e,i){return!!(i&&t&&e)&&(!!Kt(t,e,i)&&2>Math.abs(Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))+Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))-Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))))}function qt(t,e,i){if(!i)return!1;var a=i.x-t.x,n=i.y-t.y;return!(a*a+n*n>e*e)}function Jt(t,e,i){var a=[];if(t.length>1)if(t[0].x===t[1].x){var n=e.height;if(a.push([{x:t[0].x,y:0},{x:t[0].x,y:n}]),t.length>2&&(a.push([{x:t[2].x,y:0},{x:t[2].x,y:n}]),i)){var r=t[0].x-t[2].x;a.push([{x:t[0].x+r,y:0},{x:t[0].x+r,y:n}])}}else{var s=e.width;if(t[0].y===t[1].y){if(a.push([{x:0,y:t[0].y},{x:s,y:t[0].y}]),t.length>2&&(a.push([{x:0,y:t[2].y},{x:s,y:t[2].y}]),i)){var o=t[0].y-t[2].y;a.push([{x:0,y:t[0].y+o},{x:s,y:t[0].y+o}])}}else{var c=(t[0].y-t[1].y)/(t[0].x-t[1].x),h=t[0].y-c*t[0].x;if(a.push([{x:0,y:0*c+h},{x:s,y:s*c+h}]),t.length>2){var l=t[2].y-c*t[2].x;if(a.push([{x:0,y:0*c+l},{x:s,y:s*c+l}]),i){var u=h+(h-l);a.push([{x:0,y:0*c+u},{x:s,y:s*c+u}])}}}}return a}function $t(t,e){var i=[];if(t.length>0){var a=e.width;if(i.push([{x:0,y:t[0].y},{x:a,y:t[0].y}]),t.length>1){var n=t[0].y-t[1].y;i.push([{x:0,y:t[1].y+.786*n},{x:a,y:t[1].y+.786*n}]),i.push([{x:0,y:t[1].y+.618*n},{x:a,y:t[1].y+.618*n}]),i.push([{x:0,y:t[1].y+.5*n},{x:a,y:t[1].y+.5*n}]),i.push([{x:0,y:t[1].y+.382*n},{x:a,y:t[1].y+.382*n}]),i.push([{x:0,y:t[1].y+.236*n},{x:a,y:t[1].y+.236*n}]),i.push([{x:0,y:t[1].y},{x:a,y:t[1].y}])}}return i}var Qt=0,te=2;function ee(t){return t.getBoundingClientRect()||{left:0,top:0}}function ie(t){return!!t.touches}function ae(t){t.cancelable&&t.preventDefault()}var ne=!!navigator.maxTouchPoints||!!navigator.msMaxTouchPoints||"ontouchstart"in window||!!(window.DocumentTouch&&document instanceof window.DocumentTouch),re="onorientationchange"in window&≠function se(t,e){var i=t.clientX-e.clientX,a=t.clientY-e.clientY;return Math.sqrt(i*i+a*a)}var oe="mouse",ce="touch",he=function(){function t(e,a,n){i(this,t),this._target=e,this._handler=a,this._options=n,this._clickCount=0,this._clickTimeoutId=null,this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._moveExceededManhattanDistance=!1,this._cancelClick=!1,this._unsubscribeOutsideEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRoot=null,this._startPinchMiddlePoint=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventDragProcess=!1,this._mousePressed=!1,this._init()}return n(t,[{key:"destroy",value:function(){null!==this._unsubscribeOutsideEvents&&(this._unsubscribeOutsideEvents(),this._unsubscribeOutsideEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRoot&&(this._unsubscribeRoot(),this._unsubscribeRoot=null),this._clearLongTapTimeout(),this._resetClickTimeout()}},{key:"_mouseEnterHandler",value:function(t){var e=this;this._unsubscribeMousemove&&this._unsubscribeMousemove();var i=this._mouseMoveHandler.bind(this),a=this._mouseWheelHandler.bind(this);this._unsubscribeMousemove=function(){e._target.removeEventListener("mousemove",i),e._target.removeEventListener("wheel",a)},this._target.addEventListener("mousemove",i),this._target.addEventListener("wheel",a,{passive:!1}),ie(t)&&this._mouseMoveHandler(t);var n=this._makeCompatEvent(t);this._processEvent(n,this._handler.mouseEnterEvent)}},{key:"_resetClickTimeout",value:function(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null}},{key:"_mouseMoveHandler",value:function(t){if(!this._mousePressed||ie(t)){var e=this._makeCompatEvent(t);this._processEvent(e,this._handler.mouseMoveEvent)}}},{key:"_mouseWheelHandler",value:function(t){var e=this._makeCompatEvent(t);t.localX=e.localX,t.localY=e.localY,this._processEvent(t,this._handler.mouseWheelEvent)}},{key:"_mouseMoveWithDownHandler",value:function(t){if((!("button"in t)||t.button===Qt)&&null===this._startPinchMiddlePoint){var e=ie(t);if(!this._preventDragProcess||!e){this._pinchPrevented=!0;var i=this._makeCompatEvent(t),a=this._mouseMoveStartPosition,n=Math.abs(a.x-i.pageX),r=Math.abs(a.y-i.pageY),s=n+r>5;if(s||!e){if(s&&!this._moveExceededManhattanDistance&&e){var o=.5*n;r>=o&&!this._options.treatVertTouchDragAsPageScroll||o>r&&!this._options.treatHorzTouchDragAsPageScroll||(this._preventDragProcess=!0)}s&&(this._moveExceededManhattanDistance=!0,this._cancelClick=!0,e&&this._clearLongTapTimeout()),this._preventDragProcess||(this._processEvent(i,this._handler.pressedMouseMoveEvent),e&&ae(t))}}}}},{key:"_mouseUpHandler",value:function(t){if(!("button"in t)||t.button===Qt){var e=this._makeCompatEvent(t);this._clearLongTapTimeout(),this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRoot&&(this._unsubscribeRoot(),this._unsubscribeRoot=null),ie(t)&&this._mouseLeaveHandler(t),this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1?(this._processEvent(e,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()):this._cancelClick||this._processEvent(e,this._handler.mouseClickEvent),ie(t)&&(ae(t),this._mouseLeaveHandler(t),0===t.touches.length&&(this._longTapActive=!1))}}},{key:"_clearLongTapTimeout",value:function(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}},{key:"_mouseDownHandler",value:function(t){if(!("button"in t)||t.button===Qt||t.button===te){var e=this._makeCompatEvent(t);if("button"in t&&t.button===te)this._processEvent(e,this._handler.mouseRightDownEvent);else{this._cancelClick=!1,this._moveExceededManhattanDistance=!1,this._preventDragProcess=!1,ie(t)&&this._mouseEnterHandler(t),this._mouseMoveStartPosition={x:e.pageX,y:e.pageY},this._unsubscribeRoot&&(this._unsubscribeRoot(),this._unsubscribeRoot=null);var i=this._mouseMoveWithDownHandler.bind(this),a=this._mouseUpHandler.bind(this),n=this._target.ownerDocument.documentElement;this._unsubscribeRoot=function(){n.removeEventListener("touchmove",i),n.removeEventListener("touchend",a),n.removeEventListener("mousemove",i),n.removeEventListener("mouseup",a)},n.addEventListener("touchmove",i,{passive:!1}),n.addEventListener("touchend",a,{passive:!1}),this._clearLongTapTimeout(),ie(t)&&1===t.touches.length?this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),600):(n.addEventListener("mousemove",i),n.addEventListener("mouseup",a)),this._mousePressed=!0,this._processEvent(e,this._handler.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500))}}}},{key:"_init",value:function(){var t=this;this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));var e=this._target.ownerDocument,i=function(e){t._handler.mouseDownOutsideEvent&&(e.target&&t._target.contains(e.target)||t._handler.mouseDownOutsideEvent())};this._unsubscribeOutsideEvents=function(){e.removeEventListener("mousedown",i),e.removeEventListener("touchstart",i)},e.addEventListener("mousedown",i),e.addEventListener("touchstart",i,{passive:!0}),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._mouseDownHandler.bind(this),{passive:!0}),re||this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(function(){}),{passive:!1})}},{key:"_initPinch",value:function(){var t=this;void 0===this._handler.pinchStartEvent&&void 0===this._handler.pinchEvent&&void 0===this._handler.pinchEndEvent||(this._target.addEventListener("touchstart",(function(e){return t._checkPinchState(e.touches)}),{passive:!0}),this._target.addEventListener("touchmove",(function(e){if(2===e.touches.length&&null!==t._startPinchMiddlePoint&&void 0!==t._handler.pinchEvent){var i=se(e.touches[0],e.touches[1]);t._handler.pinchEvent(t._startPinchMiddlePoint,i/t._startPinchDistance),ae(e)}}),{passive:!1}),this._target.addEventListener("touchend",(function(e){t._checkPinchState(e.touches)})))}},{key:"_checkPinchState",value:function(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)}},{key:"_startPinch",value:function(t){var e=ee(this._target);this._startPinchMiddlePoint={x:(t[0].clientX-e.left+(t[1].clientX-e.left))/2,y:(t[0].clientY-e.top+(t[1].clientY-e.top))/2},this._startPinchDistance=se(t[0],t[1]),void 0!==this._handler.pinchStartEvent&&this._handler.pinchStartEvent(),this._clearLongTapTimeout()}},{key:"_stopPinch",value:function(){null!==this._startPinchMiddlePoint&&(this._startPinchMiddlePoint=null,void 0!==this._handler.pinchEndEvent&&this._handler.pinchEndEvent())}},{key:"_mouseLeaveHandler",value:function(t){this._unsubscribeMousemove&&this._unsubscribeMousemove();var e=this._makeCompatEvent(t);this._processEvent(e,this._handler.mouseLeaveEvent)}},{key:"_longTapHandler",value:function(t){var e=this._makeCompatEvent(t);this._processEvent(e,this._handler.longTapEvent),this._cancelClick=!0,this._longTapActive=!0}},{key:"_processEvent",value:function(t,e){e&&e.call(this._handler,t)}},{key:"_makeCompatEvent",value:function(t){var e;e="touches"in t&&t.touches.length?t.touches[0]:"changedTouches"in t&&t.changedTouches.length?t.changedTouches[0]:t;var i=ee(this._target);return{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,localX:e.clientX-i.left,localY:e.clientY-i.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,type:t.type.startsWith("mouse")?oe:ce,target:e.target,view:t.view}}}]),t}();function le(t){return t.type===ce}function ue(t){return t.type===oe}var _e=function(){function t(e){i(this,t),this._chartData=e,this._seriesSize={}}return n(t,[{key:"_checkEventPointX",value:function(t){return t>0&&this._seriesSize.contentRight-this._seriesSize.contentLeft>t}},{key:"setSeriesSize",value:function(t){this._seriesSize=t}}]),t}(),de="step_1",ve="step_2",fe="step_3",pe="step_done",ye=function(t){s(r,t);var a=_(r);function r(t,e,n){var s;return i(this,r),(s=a.call(this,t))._xAxis=e,s._yAxis=n,s._noneGraphicMarkMouseDownFlag=!1,s._noneGraphicMarkMouseDownActiveData={markKey:null,dataIndex:-1,onLine:!1,onCircle:!1,pointIndex:-1},s}return n(r,[{key:"mouseUpEvent",value:function(t){this._chartData.setDragGraphicMarkFlag(!1),this._noneGraphicMarkMouseDownFlag=!1,this._noneGraphicMarkMouseDownActiveData={markKey:null,dataIndex:-1,onLine:!1,onCircle:!1,pointIndex:-1}}},{key:"mouseDownEvent",value:function(t){if(this._checkEventPointX(t.localX)&&this._checkEventPointY(t.localY)){this._chartData.setGraphicMarkPoint({x:t.localX,y:t.localY});var e=this._chartData.graphicMarkType();switch(e){case _t:case dt:case vt:case ft:case pt:case yt:case xt:case mt:case gt:case kt:case wt:this._twoStepGraphicMarkMouseDown(t,e);break;case Mt:case Dt:this._threeStepGraphicMarkMouseDown(t,e);break;case ut:this._noneGraphicMarkMouseLeftDown(t)}}}},{key:"mouseRightDownEvent",value:function(t){if(this._chartData.graphicMarkType()===ut){this._findNoneGraphicMarkMouseDownActiveData(t);var e=this._noneGraphicMarkMouseDownActiveData.markKey,i=this._noneGraphicMarkMouseDownActiveData.dataIndex;if(e&&-1!==i){var a=this._chartData.graphicMarkData(),n=a[e];n.splice(i,1),a[e]=n,this._chartData.setGraphicMarkData(a),this.mouseUpEvent(t)}}}},{key:"_twoStepGraphicMarkMouseDown",value:function(t,e){var i=this;this._graphicMarkMouseDown(t,e,(function(t){switch(t.drawStep){case de:t.drawStep=ve;break;case ve:t.drawStep=pe,i._chartData.setGraphicMarkType(ut)}}))}},{key:"_threeStepGraphicMarkMouseDown",value:function(t,e){var i=this;this._graphicMarkMouseDown(t,e,(function(t){switch(t.drawStep){case de:t.drawStep=ve;break;case ve:t.drawStep=fe;break;case fe:t.drawStep=pe,i._chartData.setGraphicMarkType(ut)}}))}},{key:"_graphicMarkMouseDown",value:function(t,e,i){var a=this._chartData.graphicMarkData(),n=a[e];if(2===t.button)n.splice(n.length-1,1),this._chartData.setGraphicMarkType(ut);else{var r=n[n.length-1];i(r),n[n.length-1]=r}a[e]=n,this._chartData.setGraphicMarkData(a)}},{key:"_noneGraphicMarkMouseLeftDown",value:function(t){this._findNoneGraphicMarkMouseDownActiveData(t),this._noneGraphicMarkMouseDownActiveData.markKey&&-1!==this._noneGraphicMarkMouseDownActiveData.dataIndex&&this._noneGraphicMarkMouseDownActiveData.onCircle&&(this._noneGraphicMarkMouseDownFlag=!0,this._chartData.setDragGraphicMarkFlag(!0))}},{key:"_findNoneGraphicMarkMouseDownActiveData",value:function(t){for(var i=this,a={x:t.localX,y:t.localY},n=Object.keys(this._chartData.graphicMarkData()),r=function(t){var e=n[t];switch(e){case _t:case kt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Kt(t[0],{x:i._seriesSize.contentRight,y:t[0].y},a)})))return{v:void 0};break;case dt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Kt(t[0],{x:t[0].x,y:i._seriesSize.tags[Ie].contentBottom},a)})))return{v:void 0};break;case vt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Kt(t[0],t[1],a)})))return{v:void 0};break;case ft:case pt:case yt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Ut(t[0],t[1],a)})))return{v:void 0};break;case xt:case mt:case gt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Zt(t[0],t[1],a)})))return{v:void 0};break;case Mt:case Dt:case wt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){var n=[],r={width:i._seriesSize.contentRight,height:i._seriesSize.tags[Ie].contentBottom-i._seriesSize.tags[Ie].contentTop};switch(e){case Mt:n=Jt(t,r,!0);break;case Dt:n=Jt(t,r);break;case wt:n=$t(t,r)}for(var s=!1,o=0;n.length>o;o++){var c=n[o];if(s=Kt(c[0],c[1],a))return s}return s})))return{v:void 0}}},s=0;n.length>s;s++){var o=r(s);if("object"===e(o))return o.v}}},{key:"_realFindNoneGraphicMarkMouseDownActiveData",value:function(t,e,i){var a=this,n=this._chartData.graphicMarkData()[t],r=this._chartData.styleOptions().graphicMark;return n.forEach((function(n,s){var o=[],c=!1,h=-1;n.points.forEach((function(t,i){var n=a._xAxis.convertToPixel(t.xPos),s=a._yAxis.convertToPixel(t.price);o.push({x:n,y:s});var l=qt({x:n,y:s},r.point.radius,e);l&&(h=i),c||(c=l)}));var l=i(o,e);if(l||c)return a._noneGraphicMarkMouseDownActiveData={markKey:t,dataIndex:s,onLine:l,onCircle:c,pointIndex:h},!0})),!1}},{key:"mouseMoveEvent",value:function(t){if(this._checkEventPointX(t.localX)&&this._checkEventPointY(t.localY)){var e={x:t.localX,y:t.localY};if(this._chartData.setGraphicMarkPoint(e),!this._waitingForMouseMoveAnimationFrame){this._waitingForMouseMoveAnimationFrame=!0;var i=this._chartData.graphicMarkType();switch(i){case _t:case dt:case kt:this._onePointGraphicMarkMouseMove(e,i);break;case vt:case yt:case gt:case wt:this._twoPointGraphicMarkMouseMove(e,i);break;case ft:case xt:this._twoPointGraphicMarkMouseMove(e,i,(function(t,e){t.points[0].price=e.price}));break;case pt:case mt:this._twoPointGraphicMarkMouseMove(e,i,(function(t,e){t.points[0].xPos=e.xPos}));break;case Mt:case Dt:this._threePointGraphicMarkMouseMove(e,i);break;case ut:this._chartData.setGraphicMarkData(this._chartData.graphicMarkData())}this._waitingForMouseMoveAnimationFrame=!1}}}},{key:"pressedMouseMoveEvent",value:function(t){var e=this._noneGraphicMarkMouseDownActiveData.markKey,i=this._noneGraphicMarkMouseDownActiveData.dataIndex;if(e&&-1!==i){var a=this._chartData.graphicMarkData(),n=a[e],r={x:t.localX,y:t.localY};switch(e){case _t:case dt:case kt:case vt:case yt:case gt:case Mt:case Dt:case wt:var s=this._noneGraphicMarkMouseDownActiveData.pointIndex;-1!==s&&(n[i].points[s].xPos=this._xAxis.convertFromPixel(r.x),n[i].points[s].price=this._yAxis.convertFromPixel(r.y));break;case ft:case xt:var o=this._noneGraphicMarkMouseDownActiveData.pointIndex;if(-1!==o){var c=this._yAxis.convertFromPixel(r.y);n[i].points[o].xPos=this._xAxis.convertFromPixel(r.x),n[i].points[0].price=c,n[i].points[1].price=c}break;case pt:case mt:var h=this._noneGraphicMarkMouseDownActiveData.pointIndex;if(-1!==h){var l=this._xAxis.convertFromPixel(r.x);n[i].points[0].xPos=l,n[i].points[1].xPos=l,n[i].points[h].price=this._yAxis.convertFromPixel(r.y)}}a[e]=n,this._chartData.setGraphicMarkPoint({x:t.localX,y:t.localY}),this._chartData.setGraphicMarkData(a)}}},{key:"_onePointGraphicMarkMouseMove",value:function(t,e){var i=this;this._graphicMarkMouseMove(t,e,(function(e,a){var n=i._xAxis.convertFromPixel(t.x),r=i._yAxis.convertFromPixel(t.y);switch(a.drawStep){case pe:e.push({points:[{xPos:n,price:r}],drawStep:de});break;case de:case ve:a.points[0].xPos=n,a.points[0].price=r,e[e.length-1]=a}}))}},{key:"_twoPointGraphicMarkMouseMove",value:function(t,e,i){var a=this;this._graphicMarkMouseMove(t,e,(function(e,n){var r=a._xAxis.convertFromPixel(t.x),s=a._yAxis.convertFromPixel(t.y);switch(n.drawStep){case pe:e.push({points:[{xPos:r,price:s},{xPos:r,price:s}],drawStep:de});break;case de:n.points[0]={xPos:r,price:s},n.points[1]={xPos:r,price:s},e[e.length-1]=n;break;case ve:n.points[1]={xPos:r,price:s},k(i)&&i(n,{xPos:r,price:s}),e[e.length-1]=n}}))}},{key:"_threePointGraphicMarkMouseMove",value:function(t,e,i){var a=this;this._graphicMarkMouseMove(t,e,(function(e,n){var r=a._xAxis.convertFromPixel(t.x),s=a._yAxis.convertFromPixel(t.y);switch(n.drawStep){case pe:e.push({points:[{xPos:r,price:s},{xPos:r,price:s}],drawStep:de});break;case de:n.points[0]={xPos:r,price:s},n.points[1]={xPos:r,price:s},e[e.length-1]=n;break;case ve:k(i)&&i(n,{xPos:r,price:s}),n.points[1]={xPos:r,price:s},e[e.length-1]=n;break;case fe:n.points[2]={xPos:r,price:s},e[e.length-1]=n}}))}},{key:"_graphicMarkMouseMove",value:function(t,e,i){var a=this._chartData.graphicMarkData(),n=a[e];i(n,n[n.length-1]||{drawStep:pe}),a[e]=n,this._chartData.setGraphicMarkData(a)}},{key:"_checkEventPointY",value:function(t){var e=this._seriesSize.tags[Ie];return t>e.contentTop&&e.contentBottom>t}}]),r}(_e),xe=0,me=1,ge=2,ke=function(t){s(a,t);var e=_(a);function a(t,n,r,s){var o;return i(this,a),(o=e.call(this,t,n))._xAxis=r,o._yAxis=s,o}return n(a,[{key:"_draw",value:function(){var t=this._chartData.styleOptions().graphicMark,e=this._chartData.precisionOptions().price;this._drawHorizontalStraightLine(t),this._drawVerticalStraightLine(t),this._drawStraightLine(t),this._drawHorizontalRayLine(t),this._drawVerticalRayLine(t),this._drawRayLine(t),this._drawSegmentLine(t),this._drawPriceLine(t,e),this._drawPriceChannelLine(t),this._drawParallelStraightLine(t),this._drawFibonacciLine(t,e)}},{key:"_drawHorizontalStraightLine",value:function(t){var e=this;this._drawPointGraphicMark(_t,t,Kt,(function(t){return[[{x:0,y:t[0].y},{x:e._width,y:t[0].y}]]}))}},{key:"_drawVerticalStraightLine",value:function(t){var e=this;this._drawPointGraphicMark(dt,t,Kt,(function(t){return[[{x:t[0].x,y:0},{x:t[0].x,y:e._height}]]}))}},{key:"_drawStraightLine",value:function(t){var e=this;this._drawPointGraphicMark(vt,t,Kt,(function(t){if(t[0].x===t[1].x)return[[{x:t[0].x,y:0},{x:t[0].x,y:e._height}]];var i=Nt(t[0],t[1],[{x:0,y:t[0].y},{x:e._width,y:t[0].y}]);return[[{x:0,y:i[0]},{x:e._width,y:i[1]}]]}))}},{key:"_drawHorizontalRayLine",value:function(t){var e=this;this._drawPointGraphicMark(ft,t,Ut,(function(t){var i={x:0,y:t[0].y};return t[1].x>t[0].x&&(i.x=e._width),[[t[0],i]]}))}},{key:"_drawVerticalRayLine",value:function(t){var e=this;this._drawPointGraphicMark(pt,t,Ut,(function(t){var i={x:t[0].x,y:0};return t[1].y>t[0].y&&(i.y=e._height),[[t[0],i]]}))}},{key:"_drawRayLine",value:function(t){var e=this;this._drawPointGraphicMark(yt,t,Ut,(function(t){var i;return i=t[0].x===t[1].x&&t[0].y!==t[1].y?t[1].y>t[0].y?{x:t[0].x,y:e._height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:Nt(t[0],t[1],[{x:0,y:t[0].y}])[0]}:{x:e._width,y:Nt(t[0],t[1],[{x:e._width,y:t[0].y}])[0]},[[t[0],i]]}))}},{key:"_drawSegmentLine",value:function(t){this._drawPointGraphicMark(xt,t,Zt),this._drawPointGraphicMark(mt,t,Zt),this._drawPointGraphicMark(gt,t,Zt)}},{key:"_drawPriceLine",value:function(t,e){var i=this;this._drawPointGraphicMark(kt,t,Ut,(function(t){return[[t[0],{x:i._width,y:t[0].y}]]}),!0,e)}},{key:"_drawPriceChannelLine",value:function(t){var e=this;this._drawPointGraphicMark(Mt,t,Kt,(function(t){return Jt(t,{width:e._width,height:e._height},!0)}))}},{key:"_drawParallelStraightLine",value:function(t){var e=this;this._drawPointGraphicMark(Dt,t,Kt,(function(t){return Jt(t,{width:e._width,height:e._height})}))}},{key:"_drawFibonacciLine",value:function(t,e){var i=this;this._drawPointGraphicMark(wt,t,Kt,(function(t){return $t(t,{width:i._width,height:i._height})}),!0,e,["(100.0%)","(78.6%)","(61.8%)","(50.0%)","(38.2%)","(23.6%)","(0.0%)"])}},{key:"_drawPointGraphicMark",value:function(t,e,i,a,n,r,s){var o=this;this._chartData.graphicMarkData()[t].forEach((function(t){var c=t.drawStep,h=[];t.points.forEach((function(t){var e=t.price,i=o._xAxis.convertToPixel(t.xPos),a=o._yAxis.convertToPixel(e);h.push({x:i,y:a})}));var l=a?a(h):[h];o._drawGraphicMark(e,l,h,c,i,n,r,s)}))}},{key:"_drawGraphicMark",value:function(t,e,i,a,n,r,s){var o=this,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],h=this._chartData.graphicMarkPoint(),l=!1;e.forEach((function(e,i){if(e.length>1){var u=n(e[0],e[1],h);if(l||(l=u),a!==de){switch(o._ctx.strokeStyle=t.line.color,o._ctx.lineWidth=t.line.size,o._getLineType(e[0],e[1])){case xe:Et(o._ctx,(function(){o._ctx.beginPath(),o._ctx.moveTo(e[0].x,e[0].y),o._ctx.lineTo(e[1].x,e[1].y),o._ctx.stroke(),o._ctx.closePath()}));break;case me:At(o._ctx,e[0].y,e[0].x,e[1].x);break;case ge:Ct(o._ctx,e[0].x,e[0].y,e[1].y)}if(r){var _=nt(o._yAxis.convertFromPixel(e[0].y),s);o._ctx.font=Pt(t.text.size,t.text.family),o._ctx.fillStyle=t.text.color,o._ctx.fillText("".concat(_," ").concat(c[i]||""),e[0].x+t.text.marginLeft,e[0].y-t.text.marginBottom)}}}}));for(var u=t.point.radius,_=!1,d=0;i.length>d&&!(_=qt(i[d],u,h));d++);i.forEach((function(e){var i=qt(e,u,h);if(_||l){var a=u,n=t.point.backgroundColor,r=t.point.borderColor,s=t.point.borderSize;i&&(a=t.point.activeRadius,n=t.point.activeBackgroundColor,r=t.point.activeBorderColor,s=t.point.activeBorderSize),o._ctx.fillStyle=n,o._ctx.beginPath(),o._ctx.arc(e.x,e.y,a,0,2*Math.PI),o._ctx.closePath(),o._ctx.fill(),o._ctx.lineWidth=s,o._ctx.strokeStyle=r,o._ctx.beginPath(),o._ctx.arc(e.x,e.y,a,0,2*Math.PI),o._ctx.closePath(),o._ctx.stroke()}}))}},{key:"_getLineType",value:function(t,e){return t.x===e.x?ge:t.y===e.y?me:xe}}]),a}(Rt),Me=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_createMainView",value:function(t,e){return new Xt(t,e.chartData,e.xAxis,e.yAxis,e.additionalDataProvider)}},{key:"_createExpandView",value:function(t,e){return new ke(t,e.chartData,e.xAxis,e.yAxis)}},{key:"_createFloatLayerView",value:function(t,e){return new jt(t,e.chartData,e.xAxis,e.yAxis,e.additionalDataProvider)}},{key:"invalidate",value:function(t){t!==ot&&d(o(a.prototype),"invalidate",this).call(this,t),this._expandView.flush()}},{key:"setSize",value:function(t,e){d(o(a.prototype),"setSize",this).call(this,t,e),this._expandView.setSize(t,e)}}]),a}(Ht),De=function(t){s(a,t);var e=_(a);function a(t){var n;return i(this,a),(n=e.call(this,t))._chartType=R,n}return n(a,[{key:"_createYAxis",value:function(t){return new Ft(t.chartData,!0)}},{key:"_createMainWidget",value:function(t,e){return new Me({container:t,chartData:e.chartData,xAxis:e.xAxis,yAxis:this._yAxis,additionalDataProvider:{technicalIndicatorType:this.technicalIndicatorType.bind(this),chartType:this.chartType.bind(this),tag:this.tag.bind(this)}})}},{key:"_isRealTime",value:function(){return this._chartType===I}},{key:"chartType",value:function(){return this._chartType}},{key:"setChartType",value:function(t){this._chartType!==t&&(this._chartType=t,this._chartData.calcTechnicalIndicator(this,X.AVERAGE))}}]),a}(Wt),we=function(t){s(a,t);var e=_(a);function a(t,n,r){var s;return i(this,a),(s=e.call(this,t,n))._xAxis=r,s}return n(a,[{key:"_draw",value:function(){var t=this._chartData.styleOptions().xAxis;t.display&&(this._drawAxisLine(t),this._drawTickLines(t),this._drawTickLabels(t))}},{key:"_drawAxisLine",value:function(t){var e=t.axisLine;e.display&&(this._ctx.strokeStyle=e.color,this._ctx.lineWidth=e.size,At(this._ctx,0,0,this._width))}},{key:"_drawTickLines",value:function(t){var e=this,i=t.tickLine;if(i.display){this._ctx.lineWidth=i.size,this._ctx.strokeStyle=i.color;var a=t.axisLine.display?t.axisLine.size:0,n=a+i.length;this._xAxis.ticks().forEach((function(t){Ct(e._ctx,t.x,a,n)}))}}},{key:"_drawTickLabels",value:function(t){var e=t.tickText;if(e.display){var i=t.tickLine;this._ctx.textBaseline="top",this._ctx.font=Pt(e.size,e.family),this._ctx.textAlign="center",this._ctx.fillStyle=e.color;var a=e.margin;t.axisLine.display&&(a+=t.axisLine.size),i.display&&(a+=i.length);for(var n=this._xAxis.ticks(),r=n.length,s=0;r>s;s++)this._ctx.fillText(n[s].v,n[s].x,a)}}}]),a}(Rt),Se=function(t){s(a,t);var e=_(a);function a(t,n,r){var s;return i(this,a),(s=e.call(this,t,n))._xAxis=r,s}return n(a,[{key:"_draw",value:function(){this._drawCrossHairLabel()}},{key:"_drawCrossHairLabel",value:function(){if(this._chartData.crossHairSeriesTag()){var t=this._chartData.styleOptions().floatLayer.crossHair,e=t.vertical,i=e.text;if(t.display&&e.display&&i.display){var a,n=this._chartData.dataList(),r=this._chartData.crossHairPoint(),s=n[a=r?this._xAxis.convertFromPixel(r.x):n.length-1];if(s){var o=this._xAxis.convertToPixel(a),c=at(s.timestamp,"YYYY-MM-DD hh:mm",this._chartData.timezone()),h=i.size;this._ctx.font=Pt(h,i.family);var l=Tt(this._ctx,c),u=o-l/2,_=i.paddingLeft,d=i.paddingRight,v=i.paddingTop,f=i.borderSize;_+f>u?u=_+f:u>this._width-l-f-d&&(u=this._width-l-f-d);var p=u-f-_,y=u+l+f+d,x=0+h+2*f+v+i.paddingBottom;this._ctx.fillStyle=i.backgroundColor,this._ctx.fillRect(p,0,y-p,x-0),this._ctx.lineWidth=f,this._ctx.strokeStyle=i.borderColor,this._ctx.strokeRect(p,0,y-p,x-0),this._ctx.textBaseline="top",this._ctx.fillStyle=i.color,this._ctx.fillText(c,u,f+v)}}}}}]),a}(Rt),be=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_createMainView",value:function(t,e){return new we(t,e.chartData,e.xAxis)}},{key:"_createFloatLayerView",value:function(t,e){return new Se(t,e.chartData,e.xAxis)}}]),a}(It),Te=function(t){s(a,t);var e=_(a);function a(t){var n;return i(this,a),(n=e.call(this,t))._initMeasureCanvas(),n}return n(a,[{key:"_initMeasureCanvas",value:function(){var t=document.createElement("canvas");this._measureCtx=t.getContext("2d");var e=bt(this._measureCtx);this._measureCtx.scale(e,e)}},{key:"_computeMinMaxValue",value:function(){var t=this._chartData.from(),e=this._chartData.to()-1;return{min:t,max:e,range:e-t+1}}},{key:"_computeOptimalTicks",value:function(t){var e=[],i=t.length,a=this._chartData.dataList();if(i>0){var n=this._chartData.timezone(),r=this._chartData.styleOptions().xAxis.tickText;this._measureCtx.font=Pt(r.size,r.family);var s=Tt(this._measureCtx,"00-00 00:00"),o=this.convertToPixel(parseInt(t[0].v,10)),c=1;if(i>1){var h=this.convertToPixel(parseInt(t[1].v,10)),l=Math.abs(h-o);s>l&&(c=Math.ceil(s/l))}for(var u=0;i>u;u+=c){var _=parseInt(t[u].v,10),d=a[_].timestamp,v=at(d,"hh:mm",n);if(0!==u)v=this._optimalTickLabel(d,a[parseInt(t[u-c].v,10)].timestamp,n)||v;var f=this.convertToPixel(_);e.push({v:v,x:f,oV:d})}if(1===e.length)e[0].v=at(e[0].oV,"YYYY-MM-DD hh:mm",n);else{var p=e[0].oV,y=e[1].oV;if(e[2]){var x=e[2].v;/^[0-9]{2}-[0-9]{2}$/.test(x)?e[0].v=at(p,"MM-DD",n):/^[0-9]{4}-[0-9]{2}$/.test(x)?e[0].v=at(p,"YYYY-MM",n):/^[0-9]{4}$/.test(x)&&(e[0].v=at(p,"YYYY",n))}else e[0].v=this._optimalTickLabel(p,y,n)||e[0].v}}return e}},{key:"_optimalTickLabel",value:function(t,e,i){var a=at(t,"YYYY",i),n=at(t,"YYYY-MM",i),r=at(t,"MM-DD",i);return a!==at(e,"YYYY",i)?a:n!==at(e,"YYYY-MM",i)?n:r!==at(e,"MM-DD",i)?r:null}},{key:"convertFromPixel",value:function(t){return Math.round(this._chartData.coordinateToFloatIndex(t))-1}},{key:"convertToPixel",value:function(t){var e=this._chartData.dataList().length,i=this._chartData.dataSpace(),a=e+this._chartData.offsetRightBarCount()-t;return this._width-(a-.5)*i+this._chartData.barSpace()/2}}]),a}(Gt),Pe=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_initBefore",value:function(){this._xAxis=new Te(this._chartData)}},{key:"_createMainWidget",value:function(t,e){return new be({container:t,chartData:e.chartData,xAxis:this._xAxis})}},{key:"_computeAxis",value:function(){this._xAxis.computeAxis()}},{key:"xAxis",value:function(){return this._xAxis}},{key:"setSize",value:function(t,e){this._xAxis.setSize(t.width,t.height),this._computeAxis(),d(o(a.prototype),"setSize",this).call(this,t,e)}}]),a}(Lt),Ae=function(){function t(e,a,n,r,s){i(this,t),this._chartData=a,this._seriesIndex=n,this._width=0,this._offsetLeft=0,this._dragEventHandler=s,this._initElement(e,r)}return n(t,[{key:"_initElement",value:function(t,e){this._container=t,this._wrapper=document.createElement("div"),this._wrapper.style.margin="0",this._wrapper.style.padding="0",this._wrapper.style.overflow="hidden",this._element=document.createElement("div"),this._element.style.margin="0",this._element.style.padding="0",this._element.style.width="100%",this._element.style.position="absolute",this._element.style.zIndex="20",this._element.style.height="5px",e&&(this._element.style.cursor="ns-resize",this._dragEvent=new he(this._element,{mouseDownEvent:this._mouseDownEvent.bind(this),pressedMouseMoveEvent:this._pressedMouseMoveEvent.bind(this)},{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0})),this._wrapper.appendChild(this._element);var i=t.lastChild;i?t.insertBefore(this._wrapper,i):t.appendChild(this._wrapper)}},{key:"_mouseDownEvent",value:function(t){this._startY=t.pageY,this._dragEventHandler.startDrag(this._seriesIndex)}},{key:"_pressedMouseMoveEvent",value:function(t){this._dragEventHandler.drag(t.pageY-this._startY,this._seriesIndex)}},{key:"height",value:function(){return this._wrapper.offsetHeight}},{key:"setSize",value:function(t,e){this._offsetLeft=t,this._width=e,this.invalidate()}},{key:"updateSeriesIndex",value:function(t){this._seriesIndex=t}},{key:"invalidate",value:function(){var t=this._chartData.styleOptions().separator;this._wrapper.style.backgroundColor=t.color,this._wrapper.style.height="".concat(t.size,"px"),this._wrapper.style.marginLeft="".concat(t.fill?0:this._offsetLeft,"px"),this._wrapper.style.width=t.fill?"100%":"".concat(this._width,"px")}},{key:"getImage",value:function(){var t=this._chartData.styleOptions().separator,e=document.createElement("canvas"),i=e.getContext("2d"),a=bt(i),n=this._wrapper.offsetWidth,r=t.size;return e.style.width="".concat(n,"px"),e.style.height="".concat(r,"px"),e.width=n*a,e.height=r*a,i.scale(a,a),i.fillStyle=t.color,i.fillRect(this._offsetLeft,0,n,r),e}},{key:"destroy",value:function(){this._dragEvent&&this._dragEvent.destroy(),this._container.removeChild(this._wrapper)}}]),t}(),Ce=function(t){s(a,t);var e=_(a);function a(t){var n;return i(this,a),(n=e.call(this,t))._startScrollPoint={},n._touchPoint={},n._touchCancelCrossHair=!1,n._touchZoomed=!1,n._pinchScale=1,n}return n(a,[{key:"pinchStartEvent",value:function(){this._pinchScale=1,this._touchZoomed=!0}},{key:"pinchEvent",value:function(t,e){var i=5*(e-this._pinchScale);this._pinchScale=e,this._chartData.zoom(i,t)}},{key:"mouseLeaveEvent",value:function(t){ue(t)&&this._chartData.setCrossHairSeriesTag(null)}},{key:"mouseMoveEvent",value:function(t){if(ue(t))if(this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);e?(this._chartData.setCrossHairPoint({x:t.localX,y:e.y}),this._chartData.setCrossHairSeriesTag(e.tag)):this._chartData.setCrossHairSeriesTag(null)}else this._chartData.setCrossHairSeriesTag(null)}},{key:"mouseWheelEvent",value:function(t){if(this._checkEventPointX(t.localX)){var e=-t.deltaY/100;if(0!==e){switch(t.cancelable&&t.preventDefault(),t.deltaMode){case t.DOM_DELTA_PAGE:e*=120;break;case t.DOM_DELTA_LINE:e*=32}if(0!==e){var i=Math.sign(e)*Math.min(1,Math.abs(e));this._chartData.zoom(i,{x:t.localX,y:t.localY})}}}}},{key:"mouseClickEvent",value:function(t){if(le(t)&&this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);e&&(this._touchPoint||this._touchCancelCrossHair||this._touchZoomed||(this._touchPoint={x:t.localX,y:t.localY},this._chartData.setCrossHairPoint({x:t.localX,y:e.y}),this._chartData.setCrossHairSeriesTag(e.tag)))}}},{key:"mouseDownEvent",value:function(t){if(this._startScrollPoint={x:t.localX,y:t.localY},this._chartData.startScroll(),le(t)&&this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);if(e){var i={x:t.localX,y:e.y};if(this._touchZoomed=!1,this._touchPoint){var a=t.localX-this._touchPoint.x,n=t.localY-this._touchPoint.y;10>Math.sqrt(a*a+n*n)?(this._touchPoint={x:t.localX,y:t.localY},this._chartData.setCrossHairPoint(i),this._chartData.setCrossHairSeriesTag(e.tag)):(this._touchCancelCrossHair=!0,this._touchPoint=null,this._chartData.setCrossHairPoint(i),this._chartData.setCrossHairSeriesTag(null))}else this._touchCancelCrossHair=!1}}}},{key:"pressedMouseMoveEvent",value:function(t){if(this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);if(e){var i={x:t.localX,y:e.y};if(le(t)&&this._touchPoint)return this._touchPoint={x:t.localX,y:t.localY},this._chartData.setCrossHairPoint(i),void this._chartData.setCrossHairSeriesTag(e.tag);var a=t.localX-this._startScrollPoint.x;this._chartData.setCrossHairPoint(i),this._chartData.scroll(a)}}}},{key:"longTapEvent",value:function(t){if(le(t)&&this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);e&&(this._touchPoint={x:t.localX,y:t.localY},this._chartData.setCrossHairPoint({x:t.localX,y:e.y}),this._chartData.setCrossHairSeriesTag(e.tag))}}},{key:"_translateCrossHairRealY",value:function(t){var e=this._seriesSize.tags||{};for(var i in e){var a=e[i];if(t>a.contentTop&&a.contentBottom>t)return{tag:i,y:t-a.contentTop}}return null}}]),a}(_e),Ee=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"keyBoardDownEvent",value:function(t){if(t.shiftKey)switch(t.code){case"ArrowUp":this._chartData.zoom(-.5,this._chartData.crossHairPoint());break;case"ArrowDown":this._chartData.zoom(.5,this._chartData.crossHairPoint());break;case"ArrowLeft":this._chartData.startScroll(),this._chartData.scroll(-this._chartData.dataSpace());break;case"ArrowRight":this._chartData.startScroll(),this._chartData.scroll(this._chartData.dataSpace())}}}]),a}(_e),Le=function(){function t(e,a,n,r){i(this,t),this._target=e,this._chartData=a,this._seriesSize={},this._event=new he(this._target,{pinchStartEvent:this._pinchStartEvent.bind(this),pinchEvent:this._pinchEvent.bind(this),mouseUpEvent:this._mouseUpEvent.bind(this),mouseClickEvent:this._mouseClickEvent.bind(this),mouseDownEvent:this._mouseDownEvent.bind(this),mouseRightDownEvent:this._mouseRightDownEvent.bind(this),mouseLeaveEvent:this._mouseLeaveEvent.bind(this),mouseMoveEvent:this._mouseMoveEvent.bind(this),mouseWheelEvent:this._mouseWheelEvent.bind(this),pressedMouseMoveEvent:this._pressedMouseMoveEvent.bind(this),longTapEvent:this._longTapEvent.bind(this)},{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1}),this._boundKeyBoardDownEvent=this._keyBoardDownEvent.bind(this),this._target.addEventListener("keydown",this._boundKeyBoardDownEvent),this._boundContextMenuEvent=function(t){t.preventDefault()},this._target.addEventListener("contextmenu",this._boundContextMenuEvent,!1),this._zoomScrollEventHandler=new Ce(a),this._graphicMarkEventHandler=new ye(a,n,r),this._keyBoardEventHandler=new Ee(a)}return n(t,[{key:"_keyBoardDownEvent",value:function(t){this._keyBoardEventHandler.keyBoardDownEvent(t)}},{key:"_pinchStartEvent",value:function(){this._zoomScrollEventHandler.pinchStartEvent()}},{key:"_pinchEvent",value:function(t,e){this._zoomScrollEventHandler.pinchEvent(t,e)}},{key:"_mouseUpEvent",value:function(t){this._target.style.cursor="crosshair",t.localX-=this._seriesSize.contentLeft,this._graphicMarkEventHandler.mouseUpEvent(t)}},{key:"_mouseLeaveEvent",value:function(t){this._checkZoomScroll()&&(t.localX-=this._seriesSize.contentLeft,this._zoomScrollEventHandler.mouseLeaveEvent(t))}},{key:"_mouseMoveEvent",value:function(t){t.localX-=this._seriesSize.contentLeft,this._chartData.shouldInvalidateGraphicMark()&&this._graphicMarkEventHandler.mouseMoveEvent(t),this._checkZoomScroll()&&this._zoomScrollEventHandler.mouseMoveEvent(t)}},{key:"_mouseWheelEvent",value:function(t){this._checkZoomScroll()&&this._zoomScrollEventHandler.mouseWheelEvent(t)}},{key:"_mouseClickEvent",value:function(t){this._checkZoomScroll()&&(t.localX-=this._seriesSize.contentLeft,this._zoomScrollEventHandler.mouseClickEvent(t))}},{key:"_mouseDownEvent",value:function(t){this._target.style.cursor="pointer",t.localX-=this._seriesSize.contentLeft,this._graphicMarkEventHandler.mouseDownEvent(t),this._checkZoomScroll()&&this._zoomScrollEventHandler.mouseDownEvent(t)}},{key:"_mouseRightDownEvent",value:function(t){t.localX-=this._seriesSize.contentLeft,this._graphicMarkEventHandler.mouseRightDownEvent(t)}},{key:"_pressedMouseMoveEvent",value:function(t){t.localX-=this._seriesSize.contentLeft,this._chartData.dragGraphicMarkFlag()&&(this._graphicMarkEventHandler.pressedMouseMoveEvent(t),null!==this._chartData.crossHairSeriesTag()&&this._chartData.setCrossHairSeriesTag(null)),this._checkZoomScroll()&&this._zoomScrollEventHandler.pressedMouseMoveEvent(t)}},{key:"_longTapEvent",value:function(t){this._checkZoomScroll()&&(t.localX-=this._seriesSize.contentLeft,this._zoomScrollEventHandler.longTapEvent(t))}},{key:"_checkZoomScroll",value:function(){return!this._chartData.dragGraphicMarkFlag()&&this._chartData.graphicMarkType()===ut}},{key:"setSeriesSize",value:function(t){this._seriesSize=t,this._zoomScrollEventHandler.setSeriesSize(t),this._graphicMarkEventHandler.setSeriesSize(t)}},{key:"destroy",value:function(){this._event.destroy(),this._target.removeEventListener("keydown",this._boundKeyBoardDownEvent),this._target.removeEventListener("contextmenu",this._boundContextMenuEvent)}}]),t}(),Ie="candle_stick_series_tag",Re=function(){function t(e,a){i(this,t),this._initChartContainer(e),this._technicalIndicatorBaseId=0,this._technicalIndicatorSeries=[],this._separatorSeries=[],this._separatorDragStartTechnicalIndicatorHeight=0,this._chartData=new St(a,this._updateSeries.bind(this)),this._xAxisSeries=new Pe({container:this._chartContainer,chartData:this._chartData}),this._candleStickSeries=new De({container:this._chartContainer,chartData:this._chartData,xAxis:this._xAxisSeries.xAxis(),technicalIndicatorType:X.MA,tag:Ie}),this._chartEvent=new Le(this._chartContainer,this._chartData,this._xAxisSeries.xAxis(),this._candleStickSeries.yAxis()),this.measureSeriesSize()}return n(t,[{key:"_initChartContainer",value:function(t){this._container=t,this._chartContainer=document.createElement("div"),this._chartContainer.style.position="relative",this._chartContainer.style.outline="none",this._chartContainer.style.borderStyle="none",this._chartContainer.style.width="100%",this._chartContainer.style.cursor="crosshair",this._chartContainer.tabIndex=1,t.appendChild(this._chartContainer)}},{key:"_separatorStartDrag",value:function(t){this._separatorDragStartTechnicalIndicatorHeight=this._technicalIndicatorSeries[t].height()}},{key:"_separatorDrag",value:function(t,e){var i=this._separatorDragStartTechnicalIndicatorHeight-t;0>i&&(i=0),this._technicalIndicatorSeries[e].setHeight(i),this.measureSeriesSize()}},{key:"_measureXAxisHeight",value:function(){var t=this._chartData.styleOptions().xAxis,e=t.axisLine,i=t.tickText,a=t.tickLine,n=0;return t.display&&(e.display&&(n+=e.size),a.display&&(n+=a.length),i.display&&(n+=i.size+i.margin)),n>0&&(n=Math.ceil(Math.max(t.minHeight,Math.min(n,t.maxHeight)))),n}},{key:"_measureYAxisWidth",value:function(){var t=this._chartData.styleOptions().yAxis,e=t.tickText,i=0;return t.display&&(t.axisLine.display&&(i+=t.axisLine.size),t.tickLine.display&&(i+=t.tickLine.length),t.tickText.display&&(i+=e.margin+6*(e.size-2))),i>0&&(i=Math.ceil(Math.max(t.minWidth,Math.min(i,t.maxWidth)))),i}},{key:"_measureSeparatorHeight",value:function(){return this._chartData.styleOptions().separator.size*this._separatorSeries.length}},{key:"_updateSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lt;if(t!==ot){this._xAxisSeries.invalidate(t);var e,i=y(this._technicalIndicatorSeries);try{for(i.s();!(e=i.n()).done;){var a=e.value;a.invalidate(t)}}catch(t){i.e(t)}finally{i.f()}}this._candleStickSeries.invalidate(t)}},{key:"_calcAllSeriesTechnicalIndicator",value:function(){var t,e=[];this._candleStickSeries.chartType()===R?(t=this._candleStickSeries.technicalIndicatorType(),e.push(t)):t=X.AVERAGE,this._chartData.calcTechnicalIndicator(this._candleStickSeries,t);var i,a=y(this._technicalIndicatorSeries);try{for(a.s();!(i=a.n()).done;){var n=i.value,r=n.technicalIndicatorType();0>e.indexOf(r)?(e.push(r),this._chartData.calcTechnicalIndicator(n,r)):n.invalidate(lt)}}catch(t){a.e(t)}finally{a.f()}}},{key:"chartData",value:function(){return this._chartData}},{key:"measureSeriesSize",value:function(){var t=this._chartData.styleOptions().yAxis,e=t.position===P,i=t.tickText.position===L,a=this._container.offsetWidth,n=this._container.offsetHeight,r=this._measureSeparatorHeight(),s=this._measureXAxisHeight(),o=this._measureYAxisWidth(),c=n-s-r,h=a-(i?o:0),l=a-o,u=0;e&&(l=0,i&&(u=o));var _,d=0,v=y(this._technicalIndicatorSeries);try{for(v.s();!(_=v.n()).done;){var f=_.value,p=f.height();if((d+=p)>c){var x=d-c;d=c,f.setHeight(p-x)}}}catch(t){v.e(t)}finally{v.f()}var m=c-d;this._chartData.setTotalDataSpace(h);var g={};g.contentLeft=u,g.contentRight=u+h;var k={};k[Ie]={contentTop:0,contentBottom:m};var M=m,D=m;this._candleStickSeries.setSize({left:u,width:h,height:m},{left:l,width:o,height:m});for(var w=0;this._technicalIndicatorSeries.length>w;w++){var S=this._technicalIndicatorSeries[w],b=this._separatorSeries[w],T=S.height();S.setSize({left:u,width:h,height:T},{left:l,width:o,height:T}),b.setSize(u,h),D+=T,k[S.tag()]={contentTop:M,contentBottom:D},M=D}g.tags=k,this._xAxisSeries.setSize({left:u,width:h,height:s},{left:l,width:o,height:s}),this._chartEvent.setSeriesSize(g)}},{key:"applyTechnicalIndicatorParams",value:function(t,e){this._chartData.applyTechnicalIndicatorParams(t,e);var i=[];this._candleStickSeries.technicalIndicatorType()===t&&i.push(this._candleStickSeries);var a,n=y(this._technicalIndicatorSeries);try{for(n.s();!(a=n.n()).done;){var r=a.value;r.technicalIndicatorType()===t&&i.push(r)}}catch(t){n.e(t)}finally{n.f()}this._chartData.calcTechnicalIndicator(i,t)}},{key:"_applyDataList",value:function(t,e,i){g(t)&&(k(i)&&i(),this._chartData.addData(t,0,e),this._xAxisSeries.invalidate(lt),this._calcAllSeriesTechnicalIndicator())}},{key:"applyNewData",value:function(t,e){var i=this;this._applyDataList(t,e,(function(){i._chartData.clearDataList()}))}},{key:"applyMoreData",value:function(t,e){this._applyDataList(t,e)}},{key:"updateData",value:function(t){if(M(t)&&!g(t)){var e=this._chartData.dataList(),i=e.length,a=i;+it(t,"timestamp",0)===+it(e[i-1],"timestamp",0)&&(a=i-1),this._chartData.addData(t,a),this._xAxisSeries.invalidate(a===i-1?st:lt),this._calcAllSeriesTechnicalIndicator()}}},{key:"setCandleStickSeriesType",value:function(t){this._candleStickSeries.setChartType(t)}},{key:"createTechnicalIndicator",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i=arguments.length>2?arguments[2]:void 0;t&&X.hasOwnProperty(t)&&t!==X.NO&&t!==X.AVERAGE||(t=X.MACD);var a=this._technicalIndicatorSeries.length,n=!w(i)||i;this._separatorSeries.push(new Ae(this._chartContainer,this._chartData,a,n,{startDrag:this._separatorStartDrag.bind(this),drag:this._separatorDrag.bind(this)})),this._technicalIndicatorBaseId++;var r="".concat("technical_indicator_").concat(this._technicalIndicatorBaseId),s=new Wt({container:this._chartContainer,chartData:this._chartData,xAxis:this._xAxisSeries.xAxis(),technicalIndicatorType:t,tag:r});return s.setHeight(e),this._technicalIndicatorSeries.push(s),this.measureSeriesSize(),r}},{key:"removeTechnicalIndicator",value:function(t){for(var e=-1,i=0;this._technicalIndicatorSeries.length>i;i++){if(this._technicalIndicatorSeries[i].tag()===t){e=i;break}}if(-1!==e){this._technicalIndicatorSeries[e].destroy(),this._separatorSeries[e].destroy(),this._technicalIndicatorSeries.splice(e,1),this._separatorSeries.splice(e,1);for(var a=0;this._separatorSeries.length>a;a++)this._separatorSeries[a].updateSeriesIndex(a);this.measureSeriesSize()}}},{key:"setTechnicalIndicatorType",value:function(t,e){if(t===Ie)this._candleStickSeries.setTechnicalIndicatorType(e);else{var i,a,n=y(this._technicalIndicatorSeries);try{for(n.s();!(a=n.n()).done;){var r=a.value;if(r.tag()===t){i=r;break}}}catch(t){n.e(t)}finally{n.f()}i&&(e===X.NO?this.removeTechnicalIndicator(t):i.setTechnicalIndicatorType(e))}}},{key:"setTimezone",value:function(t){this._chartData.setTimezone(t),this._xAxisSeries.invalidate(lt)}},{key:"getConvertPictureUrl",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"jpeg",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#333333";if("png"!==i&&"jpeg"!==i&&"bmp"!==i)throw Error("Picture format only supports jpeg, png and bmp!!!");var n=document.createElement("canvas"),r=n.getContext("2d"),s=bt(r),o=this._chartContainer.offsetWidth,c=this._chartContainer.offsetHeight;n.style.width="".concat(o,"px"),n.style.height="".concat(c,"px"),n.width=o*s,n.height=c*s,r.scale(s,s),r.fillStyle=a,r.fillRect(0,0,o,c);var h=0,l=this._candleStickSeries.height();r.drawImage(this._candleStickSeries.getImage(t,e),0,h,o,l),h+=l;for(var u=0;this._separatorSeries.length>u;u++){var _=this._separatorSeries[u],d=_.height(),v=this._technicalIndicatorSeries[u],f=v.height();r.drawImage(_.getImage(),0,h,o,d),h+=d,r.drawImage(v.getImage(t),0,h,o,f),h+=f}return r.drawImage(this._xAxisSeries.getImage(t),0,h,o,this._xAxisSeries.height()),n.toDataURL("image/".concat(i))}},{key:"destroy",value:function(){this._candleStickSeries.destroy(),this._technicalIndicatorSeries.forEach((function(t){t.destroy()})),this._separatorSeries.forEach((function(t){t.destroy()})),this._xAxisSeries.destroy(),this._container.removeChild(this._chartContainer),this._chartEvent.destroy()}}]),t}(),ze=function(){function t(e,a){i(this,t),this._chartSeries=new Re(e,a)}return n(t,[{key:"setStyleOptions",value:function(t){this._chartSeries.chartData().applyStyleOptions(t),this._chartSeries.measureSeriesSize()}},{key:"getStyleOptions",value:function(){return m(this._chartSeries.chartData().styleOptions())}},{key:"setTechnicalIndicatorParams",value:function(t,e){this._chartSeries.applyTechnicalIndicatorParams(t,e)}},{key:"getTechnicalIndicatorParamOptions",value:function(){return m(this._chartSeries.chartData().technicalIndicatorParamOptions())}},{key:"setPrecision",value:function(t,e){this._chartSeries.chartData().applyPrecision(t,e)}},{key:"setTimezone",value:function(t){this._chartSeries.setTimezone(t)}},{key:"resize",value:function(){this._chartSeries.measureSeriesSize()}},{key:"setOffsetRightSpace",value:function(t){this._chartSeries.chartData().setOffsetRightSpace(t)}},{key:"setLeftMinVisibleBarCount",value:function(t){this._chartSeries.chartData().setLeftMinVisibleBarCount(t)}},{key:"setRightMinVisibleBarCount",value:function(t){this._chartSeries.chartData().setRightMinVisibleBarCount(t)}},{key:"setDataSpace",value:function(t){this._chartSeries.chartData().setDataSpace(t)}},{key:"clearData",value:function(){this._chartSeries.chartData().clearDataList()}},{key:"getDataList",value:function(){return this._chartSeries.chartData().dataList()}},{key:"applyNewData",value:function(t,e){this._chartSeries.applyNewData(t,e)}},{key:"applyMoreData",value:function(t,e){this._chartSeries.applyMoreData(t,e)}},{key:"updateData",value:function(t){this._chartSeries.updateData(t)}},{key:"loadMore",value:function(t){this._chartSeries.chartData().loadMore(t)}},{key:"setCandleStickChartType",value:function(t){this._chartSeries.setCandleStickSeriesType(t)}},{key:"setCandleStickTechnicalIndicatorType",value:function(t){this._chartSeries.setTechnicalIndicatorType(Ie,t)}},{key:"setTechnicalIndicatorType",value:function(t,e){this._chartSeries.setTechnicalIndicatorType(t,e)}},{key:"addTechnicalIndicator",value:function(t,e,i){return this._chartSeries.createTechnicalIndicator(t,e,i)}},{key:"removeTechnicalIndicator",value:function(t){this._chartSeries.removeTechnicalIndicator(t)}},{key:"addGraphicMark",value:function(t){var e=this._chartSeries.chartData().graphicMarkType();if(e!==t){var i=this._chartSeries.chartData().graphicMarkData(),a=i[e];a&&g(a)&&(a.splice(a.length-1,1),i[e]=a),i.hasOwnProperty(t)||(t=ut),this._chartSeries.chartData().setGraphicMarkType(t),this._chartSeries.chartData().setGraphicMarkData(i)}}},{key:"removeAllGraphicMark",value:function(){var t=this._chartSeries.chartData().graphicMarkData(),e={};Object.keys(t).forEach((function(t){e[t]=[]})),this._chartSeries.chartData().setGraphicMarkType(ut),this._chartSeries.chartData().setGraphicMarkData(e)}},{key:"getConvertPictureUrl",value:function(t,e,i,a){return this._chartSeries.getConvertPictureUrl(t,e,i,a)}},{key:"destroy",value:function(){this._chartSeries.destroy()}}]),t}(),Oe={},He=1;t.dispose=function(t){var e;t&&("string"==typeof t&&(e=(t=document.getElementById(t)||document.getElementsByClassName(t)).chartId),e||(e=t.chartId),!e&&t instanceof ze&&(e=t.id),e&&(Oe[e].destroy(),delete Oe[e]))},t.init=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="Chart version is 5.2.0. Root dom is null, can not initialize the chart!!!",a=t;if(!a)throw Error(i);if("string"==typeof a&&(a=document.getElementById(t)||document.getElementsByClassName(t)),!a)throw Error(i);var n=Oe[a.chartId||""];if(n)return n;var r="".concat("k_line_chart_").concat(He++),s=new ze(a,e);return s.id=r,a.chartId=r,Oe[r]=s,s},t.version=function(){return"5.2.0"},Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).klinecharts={})}(this,(function(t){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;e.length>i;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function n(t,e,i){return e&&a(t.prototype,e),i&&a(t,i),t}function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?l(t):e}function _(t){return function(){var e,i=o(t);if(h()){var a=o(this).constructor;e=Reflect.construct(i,arguments,a)}else e=i.apply(this,arguments);return u(this,e)}}function d(t,e,i){return(d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var a=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=o(t)););return t}(t,e);if(a){var n=Object.getOwnPropertyDescriptor(a,e);return n.get?n.get.call(i):n.value}})(t,e,i||t)}function v(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){if(t){if("string"==typeof t)return p(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=Array(e);e>i;i++)a[i]=t[i];return a}function y(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=f(t))){var e=0,i=function(){};return{s:i,n:function(){return t.length>e?{done:!1,value:t[e++]}:{done:!0}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,n,r=!0,s=!1;return{s:function(){a=t[Symbol.iterator]()},n:function(){var t=a.next();return r=t.done,t},e:function(t){s=!0,n=t},f:function(){try{r||null==a.return||a.return()}finally{if(s)throw n}}}}function x(t,e){if(M(t)&&M(e))for(var i in e)if(t.hasOwnProperty(i)){var a=t[i],n=e[i];M(n)&&M(a)&&!g(n)&&!g(a)?x(a,n):(e[i]||0===e[i]||!1===e[i])&&(t[i]=e[i])}}function m(t){if(!t||!M(t))return t;var e,i,a;for(i in e=g(t)?[]:{},t)t.hasOwnProperty(i)&&(e[i]=(a=t[i])&&M(a)?m(a):a);return e}function g(t){return"[object Array]"===Object.prototype.toString.call(t)}function k(t){return"function"==typeof t}function M(t){var i=e(t);return"function"===i||!!t&&"object"===i}function D(t){return"number"==typeof t&&!isNaN(t)}function w(t){return"boolean"==typeof t}var S,b,T="dash",P="left",A="right",C="percentage",E="inside",L="outside",I="real_time",R="candle_stick",z="solid",O="stroke",H="up_stroke",V="down_stroke",B="ohlc",Y="always",G="follow_cross",F="standard",W={grid:{display:!0,horizontal:{display:!0,size:1,color:"#393939",style:T,dashValue:[2,2]},vertical:{display:!1,size:1,color:"#393939",style:T,dashValue:[2,2]}},candleStick:{bar:{style:z,upColor:"#26A69A",downColor:"#EF5350",noChangeColor:"#666666"},priceMark:{display:!0,high:{display:!0,color:"#D9D9D9",textMargin:5,textSize:10,textFamily:"Arial"},low:{display:!0,color:"#D9D9D9",textMargin:5,textSize:10,textFamily:"Arial"},last:{display:!0,upColor:"#26A69A",downColor:"#EF5350",noChangeColor:"#666666",line:{display:!0,style:T,dashValue:[4,4],size:1},text:{display:!0,size:12,paddingLeft:2,paddingTop:2,paddingRight:2,paddingBottom:2,color:"#FFFFFF",family:"Arial"}}}},realTime:{timeLine:{color:"#1e88e5",size:1,areaFillColor:"rgba(30, 136, 229, 0.08)"},averageLine:{display:!0,color:"#F5A623",size:1}},technicalIndicator:{bar:{upColor:"#26A69A",downColor:"#EF5350",noChangeColor:"#666666"},line:{size:1,colors:["#D9D9D9","#F5A623","#F601FF","#1587DD","#1e88e5"]},lastValueMark:{display:!1,textColor:"#ffffff",textSize:12,textFamily:"Arial",textPaddingLeft:3,textPaddingTop:2,textPaddingRight:3,textPaddingBottom:2}},xAxis:{display:!0,maxHeight:50,minHeight:30,axisLine:{display:!0,color:"#888888",size:1},tickText:{display:!0,color:"#D9D9D9",size:12,family:"Arial",margin:3},tickLine:{display:!0,size:1,length:3,color:"#888888"}},yAxis:{display:!0,maxWidth:100,minWidth:60,type:"normal",position:A,axisLine:{display:!0,color:"#888888",size:1},tickText:{position:L,display:!0,color:"#D9D9D9",size:12,family:"Arial",margin:3},tickLine:{display:!0,size:1,length:3,color:"#888888"}},separator:{size:1,color:"#888888",fill:!0},floatLayer:{crossHair:{display:!0,horizontal:{display:!0,line:{display:!0,style:T,dashValue:[4,2],size:1,color:"#888888"},text:{display:!0,color:"#D9D9D9",size:12,family:"Arial",paddingLeft:2,paddingRight:2,paddingTop:2,paddingBottom:2,borderSize:1,borderColor:"#505050",backgroundColor:"#505050"}},vertical:{display:!0,line:{display:!0,style:T,dashValue:[4,2],size:1,color:"#888888"},text:{display:!0,color:"#D9D9D9",size:12,family:"Arial",paddingLeft:2,paddingRight:2,paddingTop:2,paddingBottom:2,borderSize:1,borderColor:"#505050",backgroundColor:"#505050"}}},prompt:{displayRule:Y,candleStick:{showType:F,labels:["时间","开","收","高","低","成交量"],values:null,rect:{paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:6,left:8,top:8,right:8,borderRadius:4,borderSize:1,borderColor:"#3f4254",fillColor:"rgba(17, 17, 17, .3)"},text:{size:12,family:"Arial",color:"#D9D9D9",marginLeft:8,marginTop:6,marginRight:8,marginBottom:0}},technicalIndicator:{text:{size:12,family:"Arial",color:"#D9D9D9",marginTop:6,marginRight:8,marginBottom:0,marginLeft:8},point:{display:!0,radius:3}}}},graphicMark:{line:{color:"#1e88e5",size:1},point:{backgroundColor:"#1e88e5",borderColor:"#1e88e5",borderSize:1,radius:4,activeBackgroundColor:"#1e88e5",activeBorderColor:"#1e88e5",activeBorderSize:1,activeRadius:6},text:{color:"#1e88e5",size:12,family:"Arial",marginLeft:2,marginRight:2,marginTop:2,marginBottom:6}}},X={NO:"NO",AVERAGE:"AVERAGE",MA:"MA",EMA:"EMA",VOL:"VOL",MACD:"MACD",BOLL:"BOLL",KDJ:"KDJ",RSI:"RSI",BIAS:"BIAS",BRAR:"BRAR",CCI:"CCI",DMI:"DMI",CR:"CR",PSY:"PSY",DMA:"DMA",TRIX:"TRIX",OBV:"OBV",VR:"VR",WR:"WR",MTM:"MTM",EMV:"EMV",SAR:"SAR"},j=(r(S={},X.MA,[5,10,30,60]),r(S,X.EMA,[6,12,20]),r(S,X.VOL,[5,10,20]),r(S,X.MACD,[12,26,9]),r(S,X.BOLL,[20]),r(S,X.KDJ,[9,3,3]),r(S,X.RSI,[6,12,24]),r(S,X.BIAS,[6,12,24]),r(S,X.BRAR,[26]),r(S,X.CCI,[13]),r(S,X.DMI,[14,6]),r(S,X.CR,[26,10,20,40,60]),r(S,X.PSY,[12]),r(S,X.DMA,[10,50,10]),r(S,X.TRIX,[12,20]),r(S,X.OBV,[30]),r(S,X.VR,[24,30]),r(S,X.WR,[13,34,89]),r(S,X.MTM,[6,10]),r(S,X.EMV,[14,9]),r(S,X.SAR,[2,2,20]),S);function N(t,e,i){var a=i[e]||[],n=(t||{})[e.toLowerCase()]||{},r=[],s=[];switch(e){case X.MA:a.forEach((function(t){var e="ma".concat(t);r.push(e),s.push(n[e])}));break;case X.EMA:a.forEach((function(t){var e="ema".concat(t);r.push(e),s.push(n[e])}));break;case X.MACD:r=["diff","dea","macd"],s=[n.diff,n.dea,n.macd];break;case X.VOL:a.forEach((function(t){var e="ma".concat(t);r.push(e),s.push(n[e])})),r.push("num"),s.push(n.num);break;case X.BOLL:r=["up","mid","dn"],s=[n.up,n.mid,n.dn];break;case X.BIAS:a.forEach((function(t){var e="bias".concat(t);r.push(e),s.push(n[e])}));break;case X.BRAR:r=["br","ar"],s=[n.br,n.ar];break;case X.CCI:r=["cci"],s=[n.cci];break;case X.CR:r=["cr","ma1","ma2","ma3","ma4"],s=[n.cr,n.ma1,n.ma2,n.ma3,n.ma4];break;case X.DMA:r=["dif","difMa"],s=[n.dif,n.difMa];break;case X.DMI:r=["mdi","pdi","adx","adxr"],s=[n.mdi,n.pdi,n.adx,n.adxr];break;case X.KDJ:r=["k","d","j"],s=[n.k,n.d,n.j];break;case X.RSI:a.forEach((function(t){var e="rsi".concat(t);r.push(e),s.push(n[e])}));break;case X.PSY:r=["psy"],s=[n.psy];break;case X.TRIX:r=["trix","maTrix"],s=[n.trix,n.maTrix];break;case X.OBV:r=["obv","maObv"],s=[n.obv,n.maObv];break;case X.VR:r=["vr","maVr"],s=[n.vr,n.maVr];break;case X.WR:r=["wr1","wr2","wr3"],s=[n.wr1,n.wr2,n.wr3];break;case X.MTM:r=["mtm","mtmMa"],s=[n.mtm,n.mtmMa];break;case X.EMV:r=["emv","maEmv"],s=[n.emv,n.maEmv];break;case X.SAR:r=["sar"],s=[n.sar]}return{keys:r,values:s}}var K=(r(b={price:2,volume:0},X.NO,2),r(b,X.MA,2),r(b,X.EMA,2),r(b,X.VOL,0),r(b,X.MACD,2),r(b,X.BOLL,2),r(b,X.KDJ,2),r(b,X.RSI,2),r(b,X.BIAS,2),r(b,X.BRAR,4),r(b,X.CCI,4),r(b,X.DMI,4),r(b,X.CR,2),r(b,X.PSY,2),r(b,X.DMA,4),r(b,X.TRIX,4),r(b,X.OBV,4),r(b,X.VR,4),r(b,X.WR,4),r(b,X.MTM,4),r(b,X.EMV,4),r(b,X.SAR,2),b),U={};function Z(t,e){for(var i=t.length,a=0;i>a;a++)e(a);return t}function q(t,e){for(var i=0,a=0;t.length>a;a++){var n=t[a].close-e;i+=n*n}var r=i>0,s=Math.sqrt((i=Math.abs(i))/t.length);return r?s:-1*s}function J(t){var e=0;if(t&&t.length>0){var i=t.length;e=t[0].high;for(var a=1;i>a;a++)e=Math.max(t[a].high,e)}return e}function $(t){var e=0;if(t&&t.length>0){var i=t.length;e=t[0].low;for(var a=1;i>a;a++)e=Math.min(t[a].low,e)}return e}function Q(t){var e=0,i=0;if(t&&t.length>0){var a=t.length;e=t[0].high,i=t[0].low;for(var n=1;a>n;n++)e=Math.max(t[n].high,e),i=Math.min(t[n].low,i)}return[e,i]}function tt(t){return t&&g(t)}function et(t,e){return tt(t)&&t.length===e}function it(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"--";if(t&&M(t)){var a=t[e];if(a||0===a||!1===a)return a}return i}U[X.AVERAGE]=function(t){var e=0,i=0;return Z(t,(function(a){e+=t[a].turnover||0,t[a].average=0!==(i+=t[a].volume||0)?e/i:0}))},U[X.MA]=function(t,e){if(!tt(e))return t;var i=[],a=e.length;return Z(t,(function(n){for(var r={},s=t[n].close,o=0;a>o;o++){i[o]=(i[o]||0)+s;var c=e[o];c>n?r["ma".concat(c)]=i[o]/(n+1):(i[o]-=t[n-c].close,r["ma".concat(c)]=i[o]/c)}t[n].ma=r}))},U[X.EMA]=function(t,e){if(!tt(e))return t;var i=[],a=e.length;return Z(t,(function(n){for(var r={},s=t[n].close,o=0;a>o;o++){var c=void 0;c=0===n?s:(2*s+(e[o]-1)*i[o])/(e[o]+1),r["ema".concat(e[o])]=c,i[o]=c}t[n].ema=r}))},U[X.VOL]=function(t,e){if(!tt(e))return t;var i=[],a=e.length;return Z(t,(function(n){for(var r=t[n].volume,s={},o=0;a>o;o++){i[o]=(i[o]||0)+r;var c=e[o];c>n?s["ma".concat(c)]=i[o]/(n+1):(i[o]-=t[n-c].volume,s["ma".concat(c)]=i[o]/c)}s.num=r,t[n].vol=s}))},U[X.MACD]=function(t,e){if(!et(e,3))return t;var i,a,n=0,r=0,s=0,o=0,c=0;return Z(t,(function(h){var l=t[h].close;0===h?(i=l,a=l):(i=(2*l+(e[0]-1)*n)/(e[0]+1),a=(2*l+(e[1]-1)*r)/(e[1]+1)),n=i,r=a,c=o=(2*(s=i-a)+c*(e[2]-1))/(e[2]+1),t[h].macd={diff:s,dea:o,macd:2*(s-o)}}))},U[X.BOLL]=function(t,e){if(!et(e,1))return t;var i,a,n=0;return Z(t,(function(r){n+=t[r].close,e[0]>r?(i=n/(r+1),a=q(t.slice(0,r+1),i)):(i=(n-=t[r-e[0]].close)/e[0],a=q(t.slice(r-(e[0]-1),r+1),i)),t[r].boll={up:i+2*a,mid:i,dn:i-2*a}}))},U[X.KDJ]=function(t,e){return et(e,3)?Z(t,(function(s){var o=t[s].close;e[0]-1>s?(n=$(t.slice(0,s+1)),r=J(t.slice(0,s+1))):(n=$(t.slice(s-(e[0]-1),s+1)),r=J(t.slice(s-(e[0]-1),s+1))),t[s].kdj={k:i=(e[1]-1)/e[1]*(e[0]-1>s?50:t[s-1].kdj.k)+1/e[1]*((o-n)/(r-n==0?1:r-n)*100),d:a=(e[2]-1)/e[2]*(e[0]-1>s?50:t[s-1].kdj.d)+1/e[2]*i,j:3*i-2*a}})):t;var i,a,n,r},U[X.RSI]=function(t,e){if(!et(e,3))return t;var i,a,n,s,o,c,h=0,l=0,u=0,_=0,d=0,v=0;return Z(t,(function(f){var p,y=(r(p={},"rsi".concat(e[0]),0),r(p,"rsi".concat(e[1]),0),r(p,"rsi".concat(e[2]),0),p);if(f>0){var x=t[f].close-t[f-1].close;if(x>0)h+=x,u+=x,d+=x;else{var m=Math.abs(x);l+=m,_+=m,v+=m}if(e[0]>f)i=h/(f+1),a=(h+l)/(f+1);else{if(f>e[0]){var g=t[f-e[0]].close-t[f-e[0]-1].close;g>0?h-=g:l-=Math.abs(g)}i=h/e[0],a=(h+l)/e[0]}if(y["rsi".concat(e[0])]=0!==a?i/a*100:0,e[1]>f)n=u/(f+1),s=(u+_)/(f+1);else{if(f>e[1]){var k=t[f-e[1]].close-t[f-e[1]-1].close;k>0?u-=k:_-=Math.abs(k)}n=u/e[1],s=(u+_)/e[1]}if(y["rsi".concat(e[1])]=0!==s?n/s*100:0,e[2]>f)o=d/(f+1),c=(d+v)/(f+1);else{if(f>e[2]){var M=t[f-e[2]].close-t[f-e[2]-1].close;M>0?d-=M:v-=Math.abs(M)}o=d/e[2],c=(d+v)/e[2]}y["rsi".concat(e[2])]=0!==c?o/c*100:0}t[f].rsi=y}))},U[X.BIAS]=function(t,e){if(!et(e,3))return t;var i,a,n,r=0,s=0,o=0;return Z(t,(function(c){var h={},l=t[c].close;r+=l,s+=l,o+=l,i=e[0]>c?r/(c+1):(r-=t[c-e[0]].close)/e[0],h["bias".concat(e[0])]=(l-i)/i*100,a=e[1]>c?s/(c+1):(s-=t[c-e[1]].close)/e[1],h["bias".concat(e[1])]=(l-a)/a*100,n=e[2]>c?o/(c+1):(o-=t[c-e[2]].close)/e[2],h["bias".concat(e[2])]=(l-n)/n*100,t[c].bias=h}))},U[X.BRAR]=function(t,e){if(!et(e,1))return t;var i=0,a=0,n=0,r=0,s=0,o=0;return Z(t,(function(c){var h=t[c].high,l=t[c].low,u=t[c].open;if(s+=h-u,o+=u-l,c>0){var _=t[c-1].close;if(n+=h-_,r+=_-l,c>e[0]-1){var d=t[c-e[0]].high,v=t[c-e[0]].low,f=t[c-e[0]].open;if(c>e[0]){var p=t[c-e[0]-1].close;n-=d-p,r-=p-v}s-=d-f,o-=f-v}a=0!==o?s/o*100:0,i=0!==r?n/r*100:0}t[c].brar={br:i,ar:a}}))},U[X.CCI]=function(t,e){if(!et(e,1))return t;var i,a,n=0,r=[],s=0;return Z(t,(function(o){var c=t[o].close;n+=c;var h=(t[o].high+t[o].low+c)/3;if(e[0]>o)s+=Math.abs((i=n/(o+1))-c),r.push(i),a=s/(o+1);else{var l=t[o-e[0]].close;r.push(i=(n-=l)/e[0]),s+=Math.abs(i-c),a=(s-=Math.abs(r[o-e[0]]-l))/e[0]}t[o].cci={cci:0!==a?(h-i)/a/.015:0}}))},U[X.DMI]=function(t,e){if(!et(e,2))return t;var i=0,a=0,n=0,r=0,s=[0],o=0,c=[0],h=0,l=[0],u=0,_=[0],d=0;return Z(t,(function(v){if(v>0){var f=t[v-1].close,p=t[v].high,y=t[v].low,x=p-y,m=Math.abs(p-f),g=Math.abs(y-f),k=p-t[v-1].high,M=t[v-1].low-y,D=Math.max(Math.max(x,m),g);o+=D,s.push(D);var w=k>0&&k>M?k:0;h+=w,c.push(w);var S=M>0&&M>k?M:0;u+=S,l.push(S),v>e[0]-1&&(o-=s[v-e[0]],h-=c[v-e[0]],u-=l[v-e[0]]),0===o?(i=0,a=0):(i=100*h/o,a=100*u/o);var b=Math.abs(a-i)/(a+i)*100;if(d+=b,_.push(b),e[1]>v)r=n=d/(v+1);else{var T=_[v-e[1]];r=((n=(d-=T)/e[1])+T)/2}}t[v].dmi={pdi:i,mdi:a,adx:n,adxr:r}}))},U[X.CR]=function(t,e){if(!et(e,5))return t;var i,a,n,r,s=0,o=0,c=0,h=0,l=[],u=0,_=[],d=0,v=[],f=0,p=[];return Z(t,(function(y){if(y>0){var x=(t[y-1].high+t[y-1].close+t[y-1].low+t[y-1].open)/4,m=t[y].high-x;0>m&&(m=0),o+=m;var g=x-t[y].low;if(0>g&&(g=0),c+=g,y>e[0]){var k=(t[y-e[0]-1].high+t[y-e[0]-1].low+t[y-e[0]-1].close+t[y-e[0]-1].open)/4,M=t[y-e[0]].high-k;0>M&&(M=0);var D=k-t[y-e[0]].low;0>D&&(D=0),o-=M,c-=D}0!==c&&(s=o/c*100);var w=(t[y-1].high+t[y-1].low+t[y-1].close)/3,S=t[y].high-w;o+=S>0?S:0;var b=w-t[y].low;c+=b>0?b:0}h+=s,u+=s,d+=s,f+=s,i=e[1]>y?h/(y+1):(h-=t[y-e[1]].cr.cr)/e[1],l.push(i),a=e[2]>y?u/(y+1):(u-=t[y-e[2]].cr.cr)/e[2],_.push(a),n=e[3]>y?d/(y+1):(d-=t[y-e[3]].cr.cr)/e[3],v.push(n),r=e[4]>y?f/(y+1):(f-=t[y-e[4]].cr.cr)/e[4],p.push(r),t[y].cr={cr:s,ma1:5>y?l[0]:l[y-5],ma2:9>y?_[0]:_[y-9],ma3:17>y?v[0]:v[y-17],ma4:25>y?p[0]:p[y-25]}}))},U[X.PSY]=function(t,e){if(!et(e,1))return t;var i=0,a=0;return Z(t,(function(n){n>0&&(a+=t[n].close-t[n-1].close>0?1:0,e[0]>n?i=a/(n+1)*100:(n>e[0]&&(a-=t[n-e[0]+1].close-t[n-e[0]].close>0?1:0),i=a/e[0]*100)),t[n].psy={psy:i}}))},U[X.DMA]=function(t,e){if(!et(e,3))return t;var i,a,n,r,s=0,o=0,c=0;return Z(t,(function(h){var l=t[h].close;s+=l,o+=l,n=e[0]>h?s/(h+1):(s-=t[h-e[0]].close)/e[0],r=e[1]>h?o/(h+1):(o-=t[h-e[1]].close)/e[1],c+=i=n-r,a=e[2]>h?c/(h+1):(c-=t[h-e[2]].dma.dif)/e[2],t[h].dma={dif:i,difMa:a}}))},U[X.TRIX]=function(t,e){if(!et(e,2))return t;var i,a,n,r,s=0,o=0,c=0,h=0,l=0,u=[];return Z(t,(function(_){var d=t[_].close;if(0===_)r=n=a=d;else{r=(2*(n=(2*(a=(2*d+(e[0]-1)*c)/(e[0]+1))+(e[0]-1)*h)/(e[0]+1))+(e[0]-1)*l)/(e[0]+1);var v=u[_-1];s=0===v?0:(r-v)/v*100}c=a,h=n,l=r,u.push(r),o+=s,i=e[1]>_?o/(_+1):(o-=t[_-e[1]].trix.trix)/e[1],t[_].trix={trix:s,maTrix:i}}))},U[X.OBV]=function(t,e){if(!et(e,1))return t;var i,a,n=0,r=0;return Z(t,(function(s){var o=t[s].volume;if(0===s)i=o,r+=o;else{var c=t[s-1].close,h=t[s].close;r+=h>c?o:-o,i=h===c?0:r}n+=i,a=e[0]>s?n/(s+1):(n-=t[s-e[0]].obv.obv)/e[0],t[s].obv={obv:i,maObv:a}}))},U[X.VR]=function(t,e){if(!et(e,2))return t;var i,a=0,n=0,r=0,s=0,o=0;return Z(t,(function(c){var h=t[c].close,l=t[c].open,u=t[c].volume;if(h>l?a+=u:l>h?n+=u:r+=u,c>e[0]-1){var _=t[c-e[0]].close,d=t[c-e[0]].open,v=t[c-e[0]].volume;_>d?a-=v:d>_?n-=v:r-=v}var f=n+.5*r;0!==f&&(s=(a+.5*r)/f*100),o+=s,i=e[1]>c?o/(c+1):(o-=t[c-e[1]].vr.vr)/e[1],t[c].vr={vr:s,maVr:i}}))},U[X.WR]=function(t,e){if(!et(e,3))return t;var i,a,n,r,s,o=Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,h=Number.MIN_SAFE_INTEGER,l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,_=Number.MAX_SAFE_INTEGER;return Z(t,(function(d){var v=t[d].close,f=t[d].high,p=t[d].low;if(e[0]>d)o=Math.max(f,o),c=Math.min(p,c);else{var y=Q(t.slice(d-e[0],d));o=y[0],c=y[1]}if(i=0!==(n=o-c)?(o-v)/n*100:0,e[1]>d)h=Math.max(f,h),l=Math.min(p,l);else{var x=Q(t.slice(d-e[1],d));h=x[0],l=x[1]}if(a=0!==(r=h-l)?(h-v)/r*100:0,e[2]>d)u=Math.max(f,u),_=Math.min(p,_);else{var m=Q(t.slice(d-e[2],d));u=m[0],_=m[1]}t[d].wr={wr1:i,wr2:a,wr3:0!==(s=u-_)?(u-v)/s*100:0}}))},U[X.MTM]=function(t,e){if(!et(e,2))return t;var i,a,n=0;return Z(t,(function(r){e[0]>r?(i=0,a=0):(n+=i=t[r].close-t[r-e[0]].close,e[0]+e[1]>r?a=n/(r-e[0]+1):(a=n/e[1],n-=t[r-e[1]].mtm.mtm));t[r].mtm={mtm:i,mtmMa:a}}))},U[X.EMV]=function(t,e){if(!et(e,2))return t;var i,a=0,n=0,r=0,s=[];return Z(t,(function(o){if(o>0){var c=t[o].high,h=t[o].low;r=((c+h)/2-(t[o-1].high+t[o-1].low)/2)*(c-h)/t[o].turnover}s.push(r),e[0]>o?a+=r:a-=s[o-e[0]],n+=a,i=e[1]>o?n/(o+1):(n-=t[o-e[1]].emv.emv)/e[1],t[o].emv={emv:a,maEmv:i}}))},U[X.SAR]=function(t,e){if(!et(e,3))return t;var i=e[0]/100,a=e[1]/100,n=e[2]/100,r=i,s=-100,o=!1,c=0;return Z(t,(function(e){var h=c,l=t[e].high,u=t[e].low;if(o){(-100===s||l>s)&&(s=l,r=Math.min(r+a,n)),c=h+r*(s-h);var _=Math.min(t[Math.max(1,e)-1].low,u);c>t[e].low?(c=s,r=i,s=-100,o=!o):c>_&&(c=_)}else{(-100===s||s>u)&&(s=u,r=Math.min(r+a,n)),c=h+r*(s-h);var d=Math.max(t[Math.max(1,e)-1].high,l);t[e].high>c?(c=s,r=0,s=-100,o=!o):d>c&&(c=d)}t[e].sar={sar:c}}))};function at(t,e,i){if(t&&D(t)){var a,n=new Date(t);try{a=new Intl.DateTimeFormat("en-us",{hour12:!1,timeZone:i,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}).format(n)}catch(t){a=new Intl.DateTimeFormat("en-us",{hour12:!1,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}).format(n)}var r=a.match(/^[\d]{1,2}\/[\d]{1,2}\/[\d]{4}/)[0].split("/"),s="".concat(1===r[0].length?"0".concat(r[0]):r[0]),o="".concat(1===r[1].length?"0".concat(r[1]):r[1]),c=a.match(/[\d]{2}:[\d]{2}$/)[0];switch("24"===c.match(/^[\d]{2}/)[0]&&(c=c.replace(/^[\d]{2}/,"00")),e){case"YYYY":return r[2];case"YYYY-MM":return"".concat(r[2],"-").concat(s);case"YYYY-MM-DD":return"".concat(r[2],"-").concat(s,"-").concat(o);case"YYYY-MM-DD hh:mm":return"".concat(r[2],"-").concat(s,"-").concat(o," ").concat(c);case"MM-DD":return"".concat(s,"-").concat(o);case"hh:mm":return c;default:return"".concat(s,"-").concat(o," ").concat(c)}}return"--"}function nt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=+t;return(i||0===i)&&D(i)?t.toFixed(e):"".concat(i)}function rt(t){return D(+t)?t>1e9?"".concat(+(t/1e9).toFixed(3),"B"):t>1e6?"".concat(+(t/1e6).toFixed(3),"M"):t>1e3?"".concat(+(t/1e3).toFixed(3),"K"):t:"--"}var st=0,ot=1,ct=2,ht=3,lt=4,ut="none",_t="horizontalStraightLine",dt="verticalStraightLine",vt="straightLine",ft="horizontalRayLine",pt="verticalRayLine",yt="rayLine",xt="horizontalSegmentLine",mt="verticalSegmentLine",gt="segmentLine",kt="priceLine",Mt="priceChannelLine",Dt="parallelStraightLine",wt="fibonacciLine",St=function(){function t(e,a){i(this,t),this._invalidateHandler=a,this._styleOptions=m(W),x(this._styleOptions,e),this._technicalIndicatorParamOptions=m(j),this._precisionOptions=m(K),this._timezone=null,this._dataList=[],this._loading=!0,this._loadMoreCallback=null,this._more=!0,this._totalDataSpace=0,this._dataSpace=6,this._barSpace=this._calcBarSpace(),this._offsetRightBarCount=50/this._dataSpace,this._leftMinVisibleBarCount=2,this._rightMinVisibleBarCount=2,this._from=0,this._to=0,this._crossHairPoint=null,this._crossHairSeriesTag=null,this._preOffsetRightBarCount=0,this._graphicMarkType=ut,this._graphicMarkPoint=null,this._dragGraphicMarkFlag=!1,this._graphicMarkDatas={horizontalStraightLine:[],verticalStraightLine:[],straightLine:[],horizontalRayLine:[],verticalRayLine:[],rayLine:[],horizontalSegmentLine:[],verticalSegmentLine:[],segmentLine:[],priceLine:[],parallelStraightLine:[],priceChannelLine:[],fibonacciLine:[]}}return n(t,[{key:"_loadMoreHandler",value:function(){this._more&&!this._loading&&this._loadMoreCallback&&k(this._loadMoreCallback)&&(this._loading=!0,this._loadMoreCallback(it(this._dataList[0],"timestamp")))}},{key:"_calcBarSpace",value:function(){return Math.max(1,Math.min(Math.floor(.8*this._dataSpace),Math.floor(this._dataSpace)-1))}},{key:"_innerSetDataSpace",value:function(t){return!(!t||3>t||t>30||this._dataSpace===t)&&(this._dataSpace=t,this._barSpace=this._calcBarSpace(),!0)}},{key:"styleOptions",value:function(){return this._styleOptions}},{key:"applyStyleOptions",value:function(t){x(this._styleOptions,t)}},{key:"technicalIndicatorParamOptions",value:function(){return this._technicalIndicatorParamOptions}},{key:"applyTechnicalIndicatorParams",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._technicalIndicatorParamOptions.hasOwnProperty(t)&&(this._technicalIndicatorParamOptions[t]=e)}},{key:"precisionOptions",value:function(){return this._precisionOptions}},{key:"setTimezone",value:function(t){this._timezone=t}},{key:"timezone",value:function(){return this._timezone}},{key:"applyPrecision",value:function(t,e){!t&&0!==t||0>t||(this._precisionOptions.price=t,this._precisionOptions[X.MA]=t,this._precisionOptions[X.BOLL]=t,this._precisionOptions[X.SAR]=t),!e&&0!==e||0>e||(this._precisionOptions.volume=e,this._precisionOptions[X.VOL]=e)}},{key:"calcTechnicalIndicator",value:function(t,e){var i=this;new Promise((function(t,a){if(e===X.NO)t(!0);else{var n=U[e];n?(i._dataList=n(i._dataList,i._technicalIndicatorParamOptions[e]),t(!0)):a(Error("Technical indicator type is error!"))}})).then((function(e){if(g(t)){var i,a=y(t);try{for(a.s();!(i=a.n()).done;){i.value.invalidate(lt)}}catch(t){a.e(t)}finally{a.f()}}else t.invalidate(lt)})).catch((function(t){}))}},{key:"dataList",value:function(){return this._dataList}},{key:"clearDataList",value:function(){this._more=!0,this._loading=!0,this._dataList=[],this._from=0,this._to=0}},{key:"addData",value:function(t,e,i){M(t)&&(g(t)?(this._loading=!1,this._more=!w(i)||i,this._dataList=t.concat(this._dataList),this.adjustOffsetBarCount()):this._dataList.length>e?this._dataList[e]=t:(this._dataList.push(t),0>this._offsetRightBarCount&&(this._offsetRightBarCount-=1),this.adjustOffsetBarCount()))}},{key:"dataSpace",value:function(){return this._dataSpace}},{key:"barSpace",value:function(){return this._barSpace}},{key:"offsetRightBarCount",value:function(){return this._offsetRightBarCount}},{key:"setDataSpace",value:function(t){this._innerSetDataSpace(t)&&(this.adjustOffsetBarCount(),this._invalidateHandler())}},{key:"setTotalDataSpace",value:function(t){this._totalDataSpace!==t&&(this._totalDataSpace=t,this.adjustOffsetBarCount())}},{key:"setOffsetRightSpace",value:function(t){this._offsetRightBarCount=t/this._dataSpace,this.adjustOffsetBarCount()}},{key:"setLeftMinVisibleBarCount",value:function(t){D(t)&&t>0&&(this._leftMinVisibleBarCount=Math.ceil(t))}},{key:"setRightMinVisibleBarCount",value:function(t){D(t)&&t>0&&(this._rightMinVisibleBarCount=Math.ceil(t))}},{key:"from",value:function(){return this._from}},{key:"to",value:function(){return this._to}},{key:"crossHairPoint",value:function(){return this._crossHairPoint}},{key:"crossHairSeriesTag",value:function(){return this._crossHairSeriesTag}},{key:"setCrossHairSeriesTag",value:function(t){this._crossHairSeriesTag=t,this._invalidateHandler(ct)}},{key:"setCrossHairPoint",value:function(t){this._crossHairPoint=t}},{key:"startScroll",value:function(){this._preOffsetRightBarCount=this._offsetRightBarCount}},{key:"scroll",value:function(t){var e=t/this._dataSpace;this._offsetRightBarCount=this._preOffsetRightBarCount-e,this.adjustOffsetBarCount(),e>0&&0===this._from&&this._loadMoreHandler(),this._invalidateHandler()}},{key:"coordinateToFloatIndex",value:function(t){return Math.round(1e6*(this._dataList.length+this._offsetRightBarCount-(this._totalDataSpace-t)/this._dataSpace))/1e6}},{key:"zoom",value:function(t,e){var i=this.coordinateToFloatIndex(e.x);this._innerSetDataSpace(this._dataSpace+t*(this._dataSpace/10))&&(this._offsetRightBarCount+=i-this.coordinateToFloatIndex(e.x),this.adjustOffsetBarCount(),this._invalidateHandler())}},{key:"adjustOffsetBarCount",value:function(){var t=this._dataList.length,e=this._totalDataSpace/this._dataSpace,i=1-this._barSpace/2/this._dataSpace,a=e-Math.min(this._leftMinVisibleBarCount,t)+i;this._offsetRightBarCount>a&&(this._offsetRightBarCount=a);var n=1-t+Math.min(this._rightMinVisibleBarCount,t)-i;n>this._offsetRightBarCount&&(this._offsetRightBarCount=n),this._to=Math.round(this._offsetRightBarCount+t),this._from=Math.floor(this._to-e)-1,this._to>t&&(this._to=t),0>this._from&&(this._from=0)}},{key:"graphicMarkType",value:function(){return this._graphicMarkType}},{key:"setGraphicMarkType",value:function(t){this._graphicMarkType=t}},{key:"dragGraphicMarkFlag",value:function(){return this._dragGraphicMarkFlag}},{key:"setDragGraphicMarkFlag",value:function(t){this._dragGraphicMarkFlag=t}},{key:"graphicMarkPoint",value:function(){return this._graphicMarkPoint}},{key:"setGraphicMarkPoint",value:function(t){this._graphicMarkPoint=t}},{key:"graphicMarkData",value:function(){return m(this._graphicMarkDatas)}},{key:"setGraphicMarkData",value:function(t){var e=this.shouldInvalidateGraphicMark();this._graphicMarkDatas=m(t),(e||this.shouldInvalidateGraphicMark())&&this._invalidateHandler(ot)}},{key:"loadMore",value:function(t){this._loadMoreCallback=t}},{key:"shouldInvalidateGraphicMark",value:function(){if(this._graphicMarkType!==ut)return!0;for(var t in this._graphicMarkDatas)if(this._graphicMarkDatas[t].length>0)return!0;return!1}}]),t}();function bt(t){return(window.devicePixelRatio||1)/(t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}function Tt(t,e){return t.measureText(e).width}function Pt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Arial";return"".concat(t,"px ").concat(e)}function At(t,e,i,a){t.beginPath();var n=t.lineWidth%2?.5:0;t.moveTo(i,e+n),t.lineTo(a,e+n),t.stroke(),t.closePath()}function Ct(t,e,i,a){t.beginPath();var n=t.lineWidth%2?.5:0;t.moveTo(e+n,i),t.lineTo(e+n,a),t.stroke(),t.closePath()}function Et(t,e){t.save(),t.lineWidth%2&&t.translate(.5,.5),e(),t.restore()}var Lt=function(){function t(e){i(this,t),this._container=e.container,this._chartData=e.chartData,this._width=-1,this._height=-1,this._initBefore(e),this._initElement(),this._mainWidget=this._createMainWidget(this._mainWidgetCell,e),this._yAxisWidget=this._createYAxisWidget(this._yAxisWidgetCell,e)}return n(t,[{key:"_initBefore",value:function(t){}},{key:"_initElement",value:function(){this._element=document.createElement("div"),this._element.style.margin="0",this._element.style.padding="0",this._element.style.position="relative",this._element.style.overflow="hidden",this._element.style.width="100%",this._mainWidgetCell=this._createCell(),this._yAxisWidgetCell=this._createCell(),this._element.appendChild(this._mainWidgetCell),this._element.appendChild(this._yAxisWidgetCell);var t=this._container.lastChild;t?this._container.insertBefore(this._element,t):this._container.appendChild(this._element)}},{key:"_createCell",value:function(){var t=document.createElement("div");return t.style.display="table-cell",t.style.position="absolute",t.style.margin="0",t.style.padding="0",t.style.top="0",t.style.zIndex="1",t}},{key:"_createMainWidget",value:function(t,e){}},{key:"_createYAxisWidget",value:function(t,e){}},{key:"_setCellSize",value:function(t,e){t.style.left="".concat(e.left,"px"),t.style.width="".concat(e.width,"px"),t.style.height="".concat(e.height,"px")}},{key:"_computeAxis",value:function(){}},{key:"width",value:function(){return this._element.offsetWidth}},{key:"height",value:function(){return this._height}},{key:"setHeight",value:function(t){this._height=t}},{key:"setSize",value:function(t,e){this._height=t.height,this._element.style.height="".concat(t.height,"px"),this._setCellSize(this._mainWidgetCell,t),this._setCellSize(this._yAxisWidgetCell,e),this._mainWidget.setSize(t.width,this._height),this._yAxisWidget&&this._yAxisWidget.setSize(e.width,e.height)}},{key:"invalidate",value:function(t){t===lt&&this._computeAxis(),this._yAxisWidget&&this._yAxisWidget.invalidate(t),this._mainWidget.invalidate(t)}},{key:"getImage",value:function(t,e){var i=document.createElement("canvas"),a=i.getContext("2d"),n=bt(a),r=this._element.offsetWidth,s=this._element.offsetHeight;i.style.width="".concat(r,"px"),i.style.height="".concat(s,"px"),i.width=r*n,i.height=s*n,a.scale(n,n);var o=this._mainWidgetCell.offsetWidth,c=this._mainWidgetCell.offsetHeight,h=parseInt(this._mainWidgetCell.style.left,10),l=this._yAxisWidgetCell.offsetWidth,u=this._yAxisWidgetCell.offsetHeight,_=parseInt(this._yAxisWidgetCell.style.left,10);return a.drawImage(this._mainWidget.getImage(t,e),h,0,o,c),this._yAxisWidget&&a.drawImage(this._yAxisWidget.getImage(t),_,0,l,u),i}},{key:"destroy",value:function(){this._container.removeChild(this._element)}}]),t}(),It=function(){function t(e){i(this,t),this._width=0,this._height=0,this._initElement(e.container),this._mainView=this._createMainView(this._element,e),this._expandView=this._createExpandView(this._element,e),this._floatLayerView=this._createFloatLayerView(this._element,e)}return n(t,[{key:"_initElement",value:function(t){this._element=document.createElement("div"),this._element.style.margin="0",this._element.style.padding="0",this._element.style.width="100%",this._element.style.height="100%",this._element.style.position="relative",this._element.style.overflow="hidden",t.appendChild(this._element)}},{key:"_createMainView",value:function(t,e){}},{key:"_createExpandView",value:function(t,e){}},{key:"_createFloatLayerView",value:function(t,e){}},{key:"setSize",value:function(t,e){this._width=t,this._height=e,this._mainView.setSize(t,e),this._floatLayerView.setSize(t,e)}},{key:"invalidate",value:function(t){switch(t){case ct:this._floatLayerView.flush();break;case ht:case lt:this._mainView.flush(),this._floatLayerView.flush()}}},{key:"getImage",value:function(t,e){var i=document.createElement("canvas"),a=i.getContext("2d"),n=bt(a);return i.style.width="".concat(this._width,"px"),i.style.height="".concat(this._height,"px"),i.width=this._width*n,i.height=this._height*n,a.scale(n,n),a.drawImage(this._mainView.getImage(),0,0,this._width,this._height),e&&this._expandView&&a.drawImage(this._expandView.getImage(),0,0,this._width,this._height),t&&a.drawImage(this._floatLayerView.getImage(),0,0,this._width,this._height),i}}]),t}();var Rt=function(){function t(e,a){i(this,t),this._chartData=a,this._initCanvas(e)}return n(t,[{key:"_initCanvas",value:function(t){this._canvas=document.createElement("canvas"),this._canvas.style.position="absolute",this._canvas.style.right="0",this._canvas.style.left="0",this._canvas.style.zIndex="2",this._ctx=this._canvas.getContext("2d"),t.appendChild(this._canvas)}},{key:"_redraw",value:function(t){this._ctx.clearRect(0,0,this._width,this._height),t&&t(),this._draw()}},{key:"_draw",value:function(){}},{key:"setSize",value:function(t,e){var i=this;this._redraw((function(){var a=bt(i._ctx);i._width=t,i._height=e,i._canvas.style.top="0",i._canvas.style.width="".concat(t,"px"),i._canvas.style.height="".concat(e,"px"),i._canvas.width=t*a,i._canvas.height=e*a,i._ctx.scale(a,a)}))}},{key:"flush",value:function(){var t,e,i=this;this.requestAnimationId&&(t=this.requestAnimationId,window.cancelAnimationFrame||clearTimeout(t),window.cancelAnimationFrame(t)),this.requestAnimationId=(e=function(){i._redraw()},window.requestAnimationFrame?window.requestAnimationFrame(e):window.setTimeout((function(){e()}),1e3/60))}},{key:"getImage",value:function(){return this._canvas}}]),t}(),zt=function(t){s(a,t);var e=_(a);function a(t,n,r,s,o){var c;return i(this,a),(c=e.call(this,t,n))._xAxis=r,c._yAxis=s,c._additionalDataProvider=o,c}return n(a,[{key:"_draw",value:function(){this._drawGrid(),this._drawTechnicalIndicator()}},{key:"_drawGrid",value:function(){var t=this,e=this._chartData.styleOptions().grid;if(e.display){var i=e.horizontal;i.display&&(this._ctx.strokeStyle=i.color,this._ctx.lineWidth=i.size,i.style===T&&this._ctx.setLineDash(i.dashValue),this._yAxis.ticks().forEach((function(e){At(t._ctx,e.y,0,t._width)})));var a=e.vertical;a.display&&(this._ctx.strokeStyle=a.color,this._ctx.lineWidth=a.size,this._ctx.setLineDash(a.style===T?a.dashValue:[]),this._xAxis.ticks().forEach((function(e){Ct(t._ctx,e.x,0,t._height)}))),this._ctx.setLineDash([])}}},{key:"_drawTechnicalIndicator",value:function(){var t=this,e=this._additionalDataProvider.technicalIndicatorType(),i=this._chartData.technicalIndicatorParamOptions(),a=[],n=this._chartData.styleOptions().technicalIndicator,r=this._chartData.dataList();this._drawGraphics((function(s,o,c,h){var l=N(c,e,i).values,u=v(l);switch(e){case X.MA:case X.EMA:case X.BOLL:t._drawTechnicalIndicatorOhlc(o,s,h,n,c,t._yAxis.isCandleStickYAxis());break;case X.MACD:u.splice(u.length-1,1);var _=l[l.length-1];_>0?(t._ctx.strokeStyle=n.bar.upColor,t._ctx.fillStyle=n.bar.upColor):0>_?(t._ctx.strokeStyle=n.bar.downColor,t._ctx.fillStyle=n.bar.downColor):(t._ctx.strokeStyle=n.bar.noChangeColor,t._ctx.fillStyle=n.bar.noChangeColor);var d=it(r,o-1,{}),f=it(d,"macd",{}).macd;t._drawBars(s,h,_,!((f||0===f)&&_>f));break;case X.VOL:u.splice(u.length-1,1);var p=c.close,y=c.open;t._ctx.fillStyle=p>y?n.bar.upColor:y>p?n.bar.downColor:n.bar.noChangeColor,t._drawBars(s,h,l[l.length-1],!0);break;case X.SAR:u.splice(0,1);var x=l[0];if(x||0===x){var m=t._yAxis.convertToPixel(x);t._ctx.strokeStyle=(c.high+c.low)/2>x?n.bar.upColor:n.bar.downColor,t._ctx.beginPath(),t._ctx.arc(s,m,h,2*Math.PI,0,!0),t._ctx.stroke(),t._ctx.closePath()}t._drawTechnicalIndicatorOhlc(o,s,h,n,c,t._yAxis.isCandleStickYAxis())}t._prepareLinePoints(s,u,a)}),(function(){t._drawLines(a,n)}))}},{key:"_drawTechnicalIndicatorOhlc",value:function(t,e,i,a,n,r){r||this._drawOhlc(i,e,n,a.bar.upColor,a.bar.downColor,a.bar.noChangeColor)}},{key:"_prepareLinePoints",value:function(t,e,i){for(var a=0;e.length>a;a++){var n=this._yAxis.convertToPixel(e[a]);i[a]?i[a].push({x:t,y:n}):i[a]=[{x:t,y:n}]}}},{key:"_drawLines",value:function(t,e){var i=this,a=e.line.colors,n=t.length,r=(a||[]).length;this._ctx.lineWidth=e.line.size,Et(this._ctx,(function(){for(var e=0;n>e;e++){var s=t[e];if(s.length>0){i._ctx.strokeStyle=a[e%r],i._ctx.beginPath(),i._ctx.moveTo(s[0].x,s[0].y);for(var o=1;s.length>o;o++)i._ctx.lineTo(s[o].x,s[o].y);i._ctx.stroke(),i._ctx.closePath()}}}))}},{key:"_drawBars",value:function(t,e,i,a){if(i||0===i){this._ctx.lineWidth=1;var n=this._yAxis.convertToPixel(i),r=this._yAxis.convertToPixel(0),s=n;0>i&&(s=r);var o=Math.abs(r-n);1>o&&(o=1,s=0>i?s+1:s-1),a?this._ctx.fillRect(t-e,s,2*e,o):this._ctx.strokeRect(t-e+.5,s,2*e-1,o)}}},{key:"_drawOhlc",value:function(t,e,i,a,n,r){var s=i.open,o=i.close,c=this._yAxis.convertToPixel(s),h=this._yAxis.convertToPixel(o),l=this._yAxis.convertToPixel(i.high),u=this._yAxis.convertToPixel(i.low);this._ctx.fillStyle=o>s?a:s>o?n:r,this._ctx.fillRect(e-.5,l,1,u-l),this._ctx.fillRect(e-t,c-.5,t,1),this._ctx.fillRect(e,h-.5,t,1)}},{key:"_drawGraphics",value:function(t,e){for(var i=this._chartData.dataList(),a=i.length,n=this._chartData.barSpace(),r=this._chartData.dataSpace(),s=n/2,o=this._chartData.offsetRightBarCount(),c=this._chartData.to(),h=this._chartData.from();c>h;h++){t(this._width-(a+o-h-.5)*r+s,h,i[h],s,n)}e&&e()}}]),a}(Rt),Ot=function(t){s(a,t);var e=_(a);function a(t,n,r,s,o){var c;return i(this,a),(c=e.call(this,t,n))._xAxis=r,c._yAxis=s,c._additionalDataProvider=o,c}return n(a,[{key:"_draw",value:function(){var t,e=this._chartData.crossHairPoint(),i=this._chartData.dataList(),a=i[t=e?this._xAxis.convertFromPixel(e.x):i.length-1];if(!a){var n=this._chartData.to();t>n-1?a=i[n-1]:0>t&&(a=i[0])}if(a){var r=this._xAxis.convertToPixel(t);this._drawCrossHairHorizontalLine(),this._drawCrossHairVerticalLine(a,r);var s=this._chartData.styleOptions().floatLayer.prompt.displayRule;if(s===Y||s===G&&this._chartData.crossHairSeriesTag())this._drawPrompt(a,r,t>0&&i.length>t)}}},{key:"_drawPrompt",value:function(t,e,i){this._drawTechnicalIndicatorPrompt(t,e,i)}},{key:"_drawCrossHairHorizontalLine",value:function(){if(this._chartData.crossHairSeriesTag()===this._additionalDataProvider.tag()){var t=this._chartData.styleOptions().floatLayer.crossHair,e=t.horizontal,i=e.line;if(t.display&&e.display&&i.display){var a=this._chartData.crossHairPoint();a&&(this._ctx.lineWidth=i.size,this._ctx.strokeStyle=i.color,i.style===T&&this._ctx.setLineDash(i.dashValue),At(this._ctx,a.y,0,this._width),this._ctx.setLineDash([]))}}}},{key:"_drawCrossHairVerticalLine",value:function(t,e){if(this._chartData.crossHairSeriesTag()){var i=this._chartData.styleOptions().floatLayer.crossHair,a=i.vertical,n=a.line;i.display&&a.display&&n.display&&(this._ctx.lineWidth=n.size,this._ctx.strokeStyle=n.color,n.style===T&&this._ctx.setLineDash(n.dashValue),Ct(this._ctx,e,0,this._height),this._ctx.setLineDash([]))}}},{key:"_drawTechnicalIndicatorPrompt",value:function(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=this._chartData.styleOptions().technicalIndicator,r=this._getTechnicalIndicatorPromptData(t),s=n.line.colors;this._drawTechnicalIndicatorPromptText(r,s,a),this._drawTechnicalIndicatorPromptPoint(r.values,s,e,i)}},{key:"_drawTechnicalIndicatorPromptText",value:function(t,e,i){var a=this._chartData.styleOptions().floatLayer.prompt.technicalIndicator.text,n=t.name,r=t.labels,s=t.values,o=a.marginLeft,c=a.marginRight,h=o,l=a.marginTop+i,u=a.size,_=a.color,d=e.length;this._ctx.textBaseline="top",this._ctx.font=Pt(u,a.family);var v=Tt(this._ctx,n);this._ctx.fillStyle=_,this._ctx.fillText(n,h,l),h+=o+v;for(var f=this._additionalDataProvider.technicalIndicatorType()===X.VOL,p=0;r.length>p;p++){var y="".concat(r[p].toUpperCase(),": ").concat((f?rt(s[p]):s[p])||"--"),x=Tt(this._ctx,y);this._ctx.fillStyle=e[p%d]||_,this._ctx.fillText(y,h,l),h+=o+c+x}}},{key:"_drawTechnicalIndicatorPromptPoint",value:function(t,e,i,a){var n=this._chartData.styleOptions().floatLayer.prompt.technicalIndicator.point;if(n.display){var r=this._additionalDataProvider.technicalIndicatorType();if(this._chartData.crossHairSeriesTag()&&r!==X.SAR&&a)for(var s=e.length,o=r===X.MACD||r===X.VOL?t.length-1:t.length,c=n.radius,h=0;o>h;h++){var l=t[h];if(l||0===l){var u=this._yAxis.convertToPixel(l);this._ctx.fillStyle=e[h%s],this._ctx.beginPath(),this._ctx.arc(i,u,c,0,2*Math.PI),this._ctx.closePath(),this._ctx.fill()}}}}},{key:"_getTechnicalIndicatorPromptData",value:function(t){var e=this._chartData.technicalIndicatorParamOptions(),i=this._additionalDataProvider.technicalIndicatorType(),a=N(t,i,e),n=this._chartData.technicalIndicatorParamOptions()[i]||[],r=a.keys,s=a.values,o="";if(r.length>0){o="".concat(i),n&&g(n)&&n.length>0&&(o="".concat(o,"(").concat(n.join(","),")"));var c=this._chartData.precisionOptions()[i];s.forEach((function(t,e){s[e]=nt(t,c)}))}return{labels:r,values:s,name:o}}}]),a}(Rt),Ht=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_createMainView",value:function(t,e){return new zt(t,e.chartData,e.xAxis,e.yAxis,e.additionalDataProvider)}},{key:"_createFloatLayerView",value:function(t,e){return new Ot(t,e.chartData,e.xAxis,e.yAxis,e.additionalDataProvider)}}]),a}(It),Vt=function(t){s(a,t);var e=_(a);function a(t,n,r,s){var o;return i(this,a),(o=e.call(this,t,n))._yAxis=r,o._additionalDataProvider=s,o}return n(a,[{key:"_draw",value:function(){var t=this._chartData.styleOptions().yAxis;t.display&&(this._drawAxisLine(t),this._drawTickLines(t),this._drawTickLabels(t),this._drawTechnicalIndicatorLastValue(t),this._drawLastPriceLabel(t))}},{key:"_drawAxisLine",value:function(t){var e,i=t.axisLine;i.display&&(this._ctx.strokeStyle=i.color,this._ctx.lineWidth=i.size,e=this._isDrawFromStart(t)?0:this._width-1,Ct(this._ctx,e,0,this._height))}},{key:"_drawTickLines",value:function(t){var e=this,i=t.tickLine;if(i.display){this._ctx.lineWidth=i.size,this._ctx.strokeStyle=i.color;var a,n,r=i.length;this._isDrawFromStart(t)?(a=0,t.axisLine.display&&(a+=t.axisLine.size),n=a+r):(a=this._width,t.axisLine.display&&(a-=t.axisLine.size),n=a-r),this._yAxis.ticks().forEach((function(t){At(e._ctx,t.y,a,n)}))}}},{key:"_drawTickLabels",value:function(t){var e=this,i=t.tickText;if(i.display){var a,n=t.tickLine,r=n.display,s=n.length,o=i.margin;this._isDrawFromStart(t)?(a=o,t.axisLine.display&&(a+=t.axisLine.size),r&&(a+=s),this._ctx.textAlign="left"):(a=this._width-o,t.axisLine.display&&(a-=t.axisLine.size),r&&(a-=s),this._ctx.textAlign="right"),this._ctx.textBaseline="middle",this._ctx.font=Pt(i.size,i.family),this._ctx.fillStyle=i.color;var c=this._additionalDataProvider.technicalIndicatorType()===X.VOL;this._yAxis.ticks().forEach((function(t){e._ctx.fillText(c?rt(t.v):t.v,a,t.y)})),this._ctx.textAlign="left"}}},{key:"_drawTechnicalIndicatorLastValue",value:function(t){var e=this._chartData.styleOptions().technicalIndicator,i=e.lastValueMark,a=this._chartData.dataList(),n=a[a.length-1];if(i.display&&n)for(var r=this._chartData.technicalIndicatorParamOptions(),s=this._additionalDataProvider.technicalIndicatorType(),o=N(n,s,r).values,c=e.line.colors||[],h=c.length,l=o.length,u=0;l>u;u++){var _=c[u%h];this._drawMarkLabel(t,o[u],this._chartData.precisionOptions()[s],i.textSize,i.textFamily,i.textColor,_,i.textPaddingLeft,i.textPaddingTop,i.textPaddingRight,i.textPaddingBottom)}}},{key:"_drawLastPriceLabel",value:function(t){if(this._yAxis.isCandleStickYAxis()){var e=this._chartData.styleOptions().candleStick.priceMark,i=e.last,a=this._chartData.dataList(),n=a.length;if(e.display&&i.display&&i.text.display&&0!==n){var r,s=a[n-1],o=s.close,c=s.open;r=o>c?i.upColor:c>o?i.downColor:i.noChangeColor;var h=i.text;this._drawMarkLabel(t,o,this._chartData.precisionOptions().price,h.size,h.family,h.color,r,h.paddingLeft,h.paddingTop,h.paddingRight,h.paddingBottom)}}}},{key:"_drawMarkLabel",value:function(t,e,i,a,n,r,s,o,c,h,l){var u,_=this._yAxis.convertToPixel(e);if(_=+Math.max(.05*this._height,Math.min(_,.98*this._height)).toFixed(0),this._yAxis.isPercentageYAxis()){var d=this._chartData.dataList()[this._chartData.from()].close;u="".concat(((e-d)/d*100).toFixed(2),"%")}else u=nt(e,i),this._additionalDataProvider.technicalIndicatorType()===X.VOL&&(u=rt(u));this._ctx.font=Pt(a,n);var v,f=Tt(this._ctx,u)+o+h,p=c+a+l;v=this._isDrawFromStart(t)?0:this._width-f,this._ctx.fillStyle=s,this._ctx.fillRect(v,_-c-a/2,f,p),this._ctx.fillStyle=r,this._ctx.textBaseline="middle",this._ctx.fillText(u,v+o,_)}},{key:"_isDrawFromStart",value:function(t){return t.position===P&&t.tickText.position===E||t.position===A&&t.tickText.position===L}}]),a}(Rt),Bt=function(t){s(a,t);var e=_(a);function a(t,n,r,s){var o;return i(this,a),(o=e.call(this,t,n))._yAxis=r,o._additionalDataProvider=s,o}return n(a,[{key:"_draw",value:function(){this._drawCrossHairLabel()}},{key:"_drawCrossHairLabel",value:function(){if(this._chartData.crossHairSeriesTag()===this._additionalDataProvider.tag()&&0!==this._chartData.dataList().length){var t=this._chartData.styleOptions().floatLayer.crossHair,e=t.horizontal,i=e.text;if(t.display&&e.display&&i.display){var a=this._chartData.crossHairPoint();if(a){var n,r=this._yAxis.convertFromPixel(a.y);if(this._yAxis.isPercentageYAxis()){var s=this._chartData.dataList()[this._chartData.from()].close;n="".concat(((r-s)/s*100).toFixed(2),"%")}else{var o=this._additionalDataProvider.technicalIndicatorType();n=nt(r,this._chartData.precisionOptions()[this._yAxis.isCandleStickYAxis()?"price":o]),o===X.VOL&&(n=rt(n))}var c=i.size;this._ctx.font=Pt(c,i.family);var h,l=Tt(this._ctx,n),u=i.paddingLeft,_=i.paddingTop,d=i.borderSize,v=l+2*d+u+i.paddingRight,f=c+2*d+_+i.paddingBottom,p=this._chartData.styleOptions().yAxis;h=p.position===P&&p.tickText.position===E||p.position===A&&p.tickText.position===L?0:this._width-v;var y=a.y-d-_-c/2;this._ctx.fillStyle=i.backgroundColor,this._ctx.fillRect(h,y,v,f),this._ctx.lineWidth=d,this._ctx.strokeStyle=i.borderColor,this._ctx.strokeRect(h,y,v,f),this._ctx.textBaseline="middle",this._ctx.fillStyle=i.color,this._ctx.fillText(n,h+d+u,a.y)}}}}}]),a}(Rt),Yt=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_createMainView",value:function(t,e){return new Vt(t,e.chartData,e.yAxis,e.additionalDataProvider)}},{key:"_createFloatLayerView",value:function(t,e){return new Bt(t,e.chartData,e.yAxis,e.additionalDataProvider)}}]),a}(It),Gt=function(){function t(e){i(this,t),this._chartData=e,this._width=0,this._height=0,this._minValue=0,this._maxValue=0,this._range=0,this._ticks=[]}return n(t,[{key:"setSize",value:function(t,e){this._width=t,this._height=e}},{key:"ticks",value:function(){return this._ticks}},{key:"computeAxis",value:function(){var t=this._computeMinMaxValue(),e=t.max,i=t.range;this._minValue=t.min,this._maxValue=e,this._range=i,this._ticks=this._computeOptimalTicks(this._computeTicks())}},{key:"_computeMinMaxValue",value:function(){}},{key:"_computeOptimalTicks",value:function(t){}},{key:"_computeTicks",value:function(){var t=[];if(this._range>=0){var e=+this._nice(this._range/6),i=this._getIntervalPrecision(e),a=+this._round(Math.ceil(this._minValue/e)*e,i),n=+this._round(Math.floor(this._maxValue/e)*e,i),r=0,s=a;if(0!==e)for(;n>=s;)t[r]={v:s.toFixed(i)},++r,s+=e}return t}},{key:"_nice",value:function(t){var e=Math.floor(Math.log(t)/Math.LN10),i=Math.pow(10,e),a=t/i;return t=(1.5>a?1:2.5>a?2:3.5>a?3:4.5>a?4:5.5>a?5:6.5>a?6:8)*i,-20>e?t:+t.toFixed(0>e?-e:0)}},{key:"_getIntervalPrecision",value:function(t){var e=""+t,i=e.indexOf("e");if(i>0){var a=+e.slice(i+1);return 0>a?-a:0}var n=e.indexOf(".");return 0>n?0:e.length-1-n}},{key:"_round",value:function(t,e){return null==e&&(e=10),t=(+t).toFixed(e=Math.min(Math.max(0,e),20))}}]),t}(),Ft=function(t){s(a,t);var e=_(a);function a(t,n){var r;return i(this,a),(r=e.call(this,t))._isCandleStickYAxis=n,r}return n(a,[{key:"_compareMinMax",value:function(t,e,i){var a=it(t,e.toLowerCase(),{});return Object.keys(a).forEach((function(t){var e=a[t];(e||0===e)&&(i[0]=Math.min(i[0],e),i[1]=Math.max(i[1],e))})),e!==X.BOLL&&e!==X.SAR||(i[0]=Math.min(i[0],t.low),i[1]=Math.max(i[1],t.high)),i}},{key:"_computeMinMaxValue",value:function(){var t=this._minValue,e=this._maxValue;if(t===1/0||e===-1/0)return{min:0,max:0,range:0};var i=Math.abs(e-t);return{min:t-=i/100*10,max:e+=i/100*20,range:i=Math.abs(e-t)}}},{key:"_computeOptimalTicks",value:function(t){var e=[],i=t.length;if(i>0){var a=this._chartData.styleOptions().xAxis.tickText.size,n=this._innerConvertToPixel(+t[0].v),r=1;if(i>1){var s=this._innerConvertToPixel(+t[1].v),o=Math.abs(s-n);2*a>o&&(r=Math.ceil(2*a/o))}for(var c=this.isPercentageYAxis(),h=0;i>h;h+=r){var l=t[h].v,u=this._innerConvertToPixel(+(l=0==+l?"0":l));u>a&&this._height-a>u&&e.push({v:c?"".concat((+l).toFixed(2),"%"):l,y:u})}}return e}},{key:"calcMinMaxValue",value:function(t,e){var i=this._chartData.dataList(),a=this._chartData.from(),n=this._chartData.to(),r=this._chartData.styleOptions().realTime.averageLine.display,s=[1/0,-1/0];if(e)for(var o=a;n>o;o++){var c=i[o],h=[c.close,s[0]],l=[c.close,s[1]];r&&(h.push(c.average),l.push(c.average)),s[0]=Math.min.apply(null,h),s[1]=Math.max.apply(null,l)}else{for(var u=a;n>u;u++){var _=i[u];this._compareMinMax(_,t,s),this._isCandleStickYAxis&&(s[0]=Math.min(_.low,s[0]),s[1]=Math.max(_.high,s[1]))}t===X.VOL&&(s[0]=0)}if(s[0]!==1/0&&s[1]!==-1/0)if(this.isPercentageYAxis()){var d=i[a].close;this._minValue=(s[0]-d)/d*100,this._maxValue=(s[1]-d)/d*100,this._minValue===this._maxValue&&(this._minValue-=10,this._maxValue+=10)}else this._minValue=s[0],this._maxValue=s[1],this._minValue===this._maxValue&&(this._minValue-=1,0>this._minValue?(this._minValue=0,this._maxValue=Math.max(1,2*this._maxValue)):this._maxValue+=1)}},{key:"_innerConvertToPixel",value:function(t){return Math.round((1-(t-this._minValue)/this._range)*this._height)}},{key:"isCandleStickYAxis",value:function(){return this._isCandleStickYAxis}},{key:"isPercentageYAxis",value:function(){return this._isCandleStickYAxis&&this._chartData.styleOptions().yAxis.type===C}},{key:"convertFromPixel",value:function(t){var e=(1-t/this._height)*this._range+this._minValue;if(this.isPercentageYAxis()){var i=this._chartData.dataList()[this._chartData.from()].close;return i*e/100+i}return e}},{key:"convertToPixel",value:function(t){var e=t;if(this.isPercentageYAxis()){var i=this._chartData.dataList()[this._chartData.from()].close;e=(t-i)/i*100}return this._innerConvertToPixel(e)}}]),a}(Gt),Wt=function(t){s(a,t);var e=_(a);function a(t){var n;return i(this,a),(n=e.call(this,t))._technicalIndicatorType=t.technicalIndicatorType||X.MACD,n._chartData.calcTechnicalIndicator(l(n),n._technicalIndicatorType),n}return n(a,[{key:"_initBefore",value:function(t){this._tag=t.tag,this._yAxis=this._createYAxis(t)}},{key:"_createYAxis",value:function(t){return new Ft(t.chartData,!1)}},{key:"_createMainWidget",value:function(t,e){return new Ht({container:t,chartData:e.chartData,xAxis:e.xAxis,yAxis:this._yAxis,additionalDataProvider:{technicalIndicatorType:this.technicalIndicatorType.bind(this),tag:this.tag.bind(this)}})}},{key:"_createYAxisWidget",value:function(t,e){return new Yt({container:t,chartData:e.chartData,yAxis:this._yAxis,additionalDataProvider:{technicalIndicatorType:this.technicalIndicatorType.bind(this),tag:this.tag.bind(this)}})}},{key:"_computeAxis",value:function(){this._yAxis.calcMinMaxValue(this._technicalIndicatorType,this._isRealTime()),this._yAxis.computeAxis()}},{key:"_isRealTime",value:function(){return!1}},{key:"tag",value:function(){return this._tag}},{key:"setSize",value:function(t,e){this._yAxis.setSize(e.width,e.height),this._computeAxis(),d(o(a.prototype),"setSize",this).call(this,t,e)}},{key:"yAxis",value:function(){return this._yAxis}},{key:"technicalIndicatorType",value:function(){return this._technicalIndicatorType}},{key:"setTechnicalIndicatorType",value:function(t){this._technicalIndicatorType!==t&&(this._technicalIndicatorType=t,this._chartData.calcTechnicalIndicator(this,this._technicalIndicatorType))}}]),a}(Lt),Xt=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_draw",value:function(){this._drawGrid(),this._additionalDataProvider.chartType()===I?this._drawRealTime():(this._drawCandleStick(),this._drawTechnicalIndicator(),this._drawHighestPriceMark(),this._drawLowestPriceMark()),this._drawLastPriceLine()}},{key:"_drawRealTime",value:function(){var t=this,e=[],i=[],a=[],n=this._chartData.from();this._drawGraphics((function(r,s,o,c){var h=o.average,l=t._yAxis.convertToPixel(o.close),u=t._yAxis.convertToPixel(h);if((h||0===h)&&a.push({x:r,y:u}),s===n){var _=r-c;i.push({x:_,y:t._height}),i.push({x:_,y:l}),e.push({x:_,y:l})}e.push({x:r,y:l}),i.push({x:r,y:l})}),(function(){var n=i.length;if(n>0){var r=i[n-1],s=t._chartData.barSpace()/2,o=r.x+s;e.push({x:o,y:r.y}),i.push({x:o,y:r.y}),i.push({x:o,y:t._height})}var c=t._chartData.styleOptions().realTime,h=c.timeLine;if(e.length>0&&(t._ctx.lineWidth=h.size,t._ctx.strokeStyle=h.color,Et(t._ctx,(function(){t._ctx.beginPath(),t._ctx.moveTo(e[0].x,e[0].y);for(var i=1;e.length>i;i++)t._ctx.lineTo(e[i].x,e[i].y);t._ctx.stroke(),t._ctx.closePath()}))),i.length>0){t._ctx.fillStyle=h.areaFillColor,t._ctx.beginPath(),t._ctx.moveTo(i[0].x,i[0].y);for(var l=1;i.length>l;l++)t._ctx.lineTo(i[l].x,i[l].y);t._ctx.closePath(),t._ctx.fill()}var u=c.averageLine;u.display&&a.length>0&&(t._ctx.lineWidth=u.size,t._ctx.strokeStyle=u.color,Et(t._ctx,(function(){t._ctx.beginPath(),t._ctx.moveTo(a[0].x,a[0].y);for(var e=1;a.length>e;e++)t._ctx.lineTo(a[e].x,a[e].y);t._ctx.stroke(),t._ctx.closePath()})))}))}},{key:"_drawCandleStick",value:function(){var t=this,e=[],i=-1/0,a=-1,n=1/0,r=-1,s=this._chartData.styleOptions().candleStick;this._drawGraphics((function(o,c,h,l,u){var _=h.open,d=h.close,v=h.high,f=h.low;if(v>i&&(i=v,a=o),n>f&&(n=f,r=o),s.bar.style!==B){d>_?(t._ctx.strokeStyle=s.bar.upColor,t._ctx.fillStyle=s.bar.upColor):_>d?(t._ctx.strokeStyle=s.bar.downColor,t._ctx.fillStyle=s.bar.downColor):(t._ctx.strokeStyle=s.bar.noChangeColor,t._ctx.fillStyle=s.bar.noChangeColor);var p=t._yAxis.convertToPixel(_),y=t._yAxis.convertToPixel(d),x=t._yAxis.convertToPixel(v),m=t._yAxis.convertToPixel(f),g=[],k=[];switch(g[0]=x,k[1]=m,p>y?(g[1]=y,k[0]=p,e=[o-l,y,u,p-y]):y>p?(g[1]=p,k[0]=y,e=[o-l,p,u,y-p]):(g[1]=p,k[0]=y,e=[o-l,p,u,1]),t._ctx.fillRect(o-.5,g[0],1,g[1]-g[0]),t._ctx.fillRect(o-.5,k[0],1,k[1]-k[0]),1>e[3]&&(e[3]=1),s.bar.style){case z:t._ctx.fillRect(e[0],e[1],e[2],e[3]);break;case O:t._ctx.strokeRect(e[0]+.5,e[1],e[2]-1,e[3]);break;case H:d>_?t._ctx.strokeRect(e[0]+.5,e[1],e[2]-1,e[3]):t._ctx.fillRect(e[0],e[1],e[2],e[3]);break;case V:d>_?t._ctx.fillRect(e[0],e[1],e[2],e[3]):t._ctx.strokeRect(e[0],e[1],e[2],e[3])}}else t._drawOhlc(l,o,h,s.bar.upColor,s.bar.downColor,s.bar.noChangeColor)})),this._highestMarkData={x:a,price:i},this._lowestMarkData={x:r,price:n}}},{key:"_drawHighestPriceMark",value:function(t){if(this._highestMarkData){var e=this._highestMarkData.price,i=this._chartData.styleOptions().candleStick.priceMark,a=i.high;e!==-1/0&&i.display&&a.display&&this._drawLowestHighestPriceMark(a,this._highestMarkData.x,e,!0,this._chartData.precisionOptions().price)}}},{key:"_drawLowestPriceMark",value:function(){if(this._lowestMarkData){var t=this._lowestMarkData.price,e=this._chartData.styleOptions().candleStick.priceMark,i=e.low;t!==1/0&&e.display&&i.display&&this._drawLowestHighestPriceMark(i,this._lowestMarkData.x,t,!1,this._chartData.precisionOptions().price)}}},{key:"_drawLowestHighestPriceMark",value:function(t,e,i,a,n){var r=this,s=this._yAxis.convertToPixel(i),o=e,c=s+(a?-2:2);this._ctx.textAlign="left",this._ctx.lineWidth=1,this._ctx.strokeStyle=t.color,this._ctx.fillStyle=t.color,Et(this._ctx,(function(){r._ctx.beginPath(),r._ctx.moveTo(o,c),r._ctx.lineTo(o-2,c+(a?-2:2)),r._ctx.stroke(),r._ctx.closePath(),r._ctx.beginPath(),r._ctx.moveTo(o,c),r._ctx.lineTo(o+2,c+(a?-2:2)),r._ctx.stroke(),r._ctx.closePath()}));var h=c+(a?-5:5);Ct(this._ctx,o,c,h),At(this._ctx,h,o,o+5),this._ctx.font=Pt(t.textSize,t.textFamily);var l=nt(i,n);this._ctx.textBaseline="middle",this._ctx.fillText(l,o+5+t.textMargin,h)}},{key:"_drawLastPriceLine",value:function(){var t=this._chartData.dataList(),e=t.length,i=this._chartData.styleOptions().candleStick.priceMark,a=i.last;if(i.display&&a.display&&a.line.display&&0!==e){var n=t[e-1],r=n.close,s=n.open,o=this._yAxis.convertToPixel(r);o=+Math.max(.05*this._height,Math.min(o,.98*this._height)).toFixed(0);var c=a.line;this._ctx.strokeStyle=r>s?a.upColor:s>r?a.downColor:a.noChangeColor,this._ctx.lineWidth=c.size,c.style===T&&this._ctx.setLineDash(c.dashValue),At(this._ctx,o,0,this._width),this._ctx.setLineDash([])}}}]),a}(zt),jt=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_drawPrompt",value:function(t,e,i){var a=this._chartData.styleOptions().floatLayer.prompt.candleStick,n=this._getCandleStickPromptData(t,a);a.showType===F?(this._drawCandleStickStandardPromptText(a,n),this._additionalDataProvider.chartType()===R&&this._drawTechnicalIndicatorPrompt(t,e,i,a.text.size+a.text.marginTop)):this._drawCandleStickRectPromptText(t,e,a,n)}},{key:"_drawCandleStickStandardPromptText",value:function(t,e){var i=this,a=e,n=t.text.marginLeft,r=t.text.marginRight,s=t.text.size,o=t.text.color,c=t.labels;this._ctx.textBaseline="top",this._ctx.font=Pt(s,t.text.family);var h=n,l=t.text.marginTop;c.forEach((function(t,e){var s=t?"".concat(t,": "):"",c=Tt(i._ctx,s);i._ctx.fillStyle=o,i._ctx.fillText(s,h,l),h+=c;var u,_=a[e]||"--";M(_)?(u=_.value||"--",i._ctx.fillStyle=_.color||o):(i._ctx.fillStyle=o,u=_);var d=Tt(i._ctx,u);i._ctx.fillText(u,h,l),h+=d+n+r}))}},{key:"_drawCandleStickRectPromptText",value:function(t,e,i,a){var n=this,r=i.labels,s=a,o=i.text.marginLeft,c=i.text.marginRight,h=i.text.marginTop,l=i.text.marginBottom,u=i.text.size,_=i.text.color;this._ctx.textBaseline="top",this._ctx.font=Pt(u,i.text.family);var d=0;r.forEach((function(t,e){var i=s[e]||"--",a=i;M(i)&&(a=i.value||"--");var r="".concat(t,": ").concat(a),h=Tt(n._ctx,r)+o+c;d=Math.max(d,h)}));var v=i.rect,f=v.borderSize,p=v.paddingLeft,y=v.paddingRight,x=v.paddingTop,m=v.left,g=v.right,k=2*f+x+v.paddingBottom+(l+h+u)*r.length,D=this._getTechnicalIndicatorPromptData(t),w=this._chartData.styleOptions().floatLayer.prompt.technicalIndicator,S=w.text.marginLeft,b=w.text.marginRight,T=w.text.marginTop,P=w.text.marginBottom,A=w.text.size,C=this._additionalDataProvider.chartType()===R,E=D.labels||[],L=D.values||[];C&&(this._ctx.font=Pt(A,w.text.family),E.forEach((function(t,e){var i=L[e]||"--",a="".concat(t,": ").concat(i),r=Tt(n._ctx,a)+S+b;d=Math.max(d,r)})),k+=(T+P+A)*E.length);var I,z=2*f+d+p+y;I=this._width/2>e?this._width-g-z:m;var O=v.top,H=v.borderRadius;this._ctx.lineWidth=f,this._ctx.strokeStyle=v.borderColor,this._ctx.fillStyle=v.fillColor,this._drawRoundRect(I,O,z,k,H),this._ctx.stroke(),this._drawRoundRect(I,O,z,k,H),this._ctx.fill();var V=I+f+p+o,B=O+f+x;if(this._ctx.font=Pt(u,i.text.family),r.forEach((function(t,e){B+=h,n._ctx.textAlign="left",n._ctx.fillStyle=_,n._ctx.fillText("".concat(t,": "),V,B);var i,a=s[e]||"--";n._ctx.fillStyle=a.color||_,i=M(a)?a.value||"--":a,n._ctx.textAlign="right",n._ctx.fillText(i,I+z-f-c-y,B),B+=u+l})),C){var Y=this._chartData.styleOptions().technicalIndicator,G=Y.line.colors,F=I+f+p+S,W=G.length;this._ctx.font=Pt(A,w.text.family),E.forEach((function(t,e){B+=T,n._ctx.textAlign="left",n._ctx.fillStyle=G[e%W]||Y.text.color,n._ctx.fillText("".concat(t.toUpperCase(),": "),F,B),n._ctx.textAlign="right",n._ctx.fillText(L[e]||"--",I+z-f-b-y,B),B+=A+P}))}this._ctx.textAlign="left"}},{key:"_drawRoundRect",value:function(t,e,i,a,n){this._ctx.beginPath(),this._ctx.moveTo(t+n,e),this._ctx.arcTo(t+i,e,t+i,e+a,n),this._ctx.arcTo(t+i,e+a,t,e+a,n),this._ctx.arcTo(t,e+a,t,e,n),this._ctx.arcTo(t,e,t+i,e,n),this._ctx.closePath()}},{key:"_getCandleStickPromptData",value:function(t,e){var i=this,a=e.values,n=[];if(a)n=k(a)?a(t)||[]:a;else{var r=this._chartData.precisionOptions();(n=[it(t,"timestamp"),it(t,"open"),it(t,"close"),it(t,"high"),it(t,"low"),it(t,"volume")]).forEach((function(t,e){switch(e){case 0:n[e]=at(t,"YYYY-MM-DD hh:mm",i._chartData.timezone());break;case n.length-1:n[e]=rt(nt(t,r.volume));break;default:n[e]=nt(t,r.price)}}))}return n}}]),a}(Ot);function Nt(t,e,i){var a=[];if(t&&e&&i.length>0){var n=t.x-e.x;if(0===n)i.forEach((function(t){a.push(t.y)}));else{var r=(t.y-e.y)/n,s=t.y-r*t.x;i.forEach((function(t){a.push(t.x*r+s)}))}}return a}function Kt(t,e,i){return!!(i&&t&&e)&&(t.x===e.x?1>Math.abs(i.x-t.x):t.y===e.y?1>Math.abs(i.y-t.y):1>Math.abs(i.y-Nt(t,e,[i])[0]))}function Ut(t,e,i){return!!(i&&t&&e)&&(!!Kt(t,e,i)&&(t.x===e.x?e.y>t.y?i.y>t.y-2:t.y+2>i.y:e.x>t.x?i.x>t.x-2:t.x+2>i.x))}function Zt(t,e,i){return!!(i&&t&&e)&&(!!Kt(t,e,i)&&2>Math.abs(Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))+Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))-Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))))}function qt(t,e,i){if(!i)return!1;var a=i.x-t.x,n=i.y-t.y;return!(a*a+n*n>e*e)}function Jt(t,e,i){var a=[];if(t.length>1)if(t[0].x===t[1].x){var n=e.height;if(a.push([{x:t[0].x,y:0},{x:t[0].x,y:n}]),t.length>2&&(a.push([{x:t[2].x,y:0},{x:t[2].x,y:n}]),i)){var r=t[0].x-t[2].x;a.push([{x:t[0].x+r,y:0},{x:t[0].x+r,y:n}])}}else{var s=e.width;if(t[0].y===t[1].y){if(a.push([{x:0,y:t[0].y},{x:s,y:t[0].y}]),t.length>2&&(a.push([{x:0,y:t[2].y},{x:s,y:t[2].y}]),i)){var o=t[0].y-t[2].y;a.push([{x:0,y:t[0].y+o},{x:s,y:t[0].y+o}])}}else{var c=(t[0].y-t[1].y)/(t[0].x-t[1].x),h=t[0].y-c*t[0].x;if(a.push([{x:0,y:0*c+h},{x:s,y:s*c+h}]),t.length>2){var l=t[2].y-c*t[2].x;if(a.push([{x:0,y:0*c+l},{x:s,y:s*c+l}]),i){var u=h+(h-l);a.push([{x:0,y:0*c+u},{x:s,y:s*c+u}])}}}}return a}function $t(t,e){var i=[];if(t.length>0){var a=e.width;if(i.push([{x:0,y:t[0].y},{x:a,y:t[0].y}]),t.length>1){var n=t[0].y-t[1].y;i.push([{x:0,y:t[1].y+.786*n},{x:a,y:t[1].y+.786*n}]),i.push([{x:0,y:t[1].y+.618*n},{x:a,y:t[1].y+.618*n}]),i.push([{x:0,y:t[1].y+.5*n},{x:a,y:t[1].y+.5*n}]),i.push([{x:0,y:t[1].y+.382*n},{x:a,y:t[1].y+.382*n}]),i.push([{x:0,y:t[1].y+.236*n},{x:a,y:t[1].y+.236*n}]),i.push([{x:0,y:t[1].y},{x:a,y:t[1].y}])}}return i}var Qt=0,te=2;function ee(t){return t.getBoundingClientRect()||{left:0,top:0}}function ie(t){return!!t.touches}function ae(t){t.cancelable&&t.preventDefault()}var ne=!!navigator.maxTouchPoints||!!navigator.msMaxTouchPoints||"ontouchstart"in window||!!(window.DocumentTouch&&document instanceof window.DocumentTouch),re="onorientationchange"in window&≠function se(t,e){var i=t.clientX-e.clientX,a=t.clientY-e.clientY;return Math.sqrt(i*i+a*a)}var oe="mouse",ce="touch",he=function(){function t(e,a,n){i(this,t),this._target=e,this._handler=a,this._options=n,this._clickCount=0,this._clickTimeoutId=null,this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._moveExceededManhattanDistance=!1,this._cancelClick=!1,this._unsubscribeOutsideEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRoot=null,this._startPinchMiddlePoint=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventDragProcess=!1,this._mousePressed=!1,this._init()}return n(t,[{key:"destroy",value:function(){null!==this._unsubscribeOutsideEvents&&(this._unsubscribeOutsideEvents(),this._unsubscribeOutsideEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRoot&&(this._unsubscribeRoot(),this._unsubscribeRoot=null),this._clearLongTapTimeout(),this._resetClickTimeout()}},{key:"_mouseEnterHandler",value:function(t){var e=this;this._unsubscribeMousemove&&this._unsubscribeMousemove();var i=this._mouseMoveHandler.bind(this),a=this._mouseWheelHandler.bind(this);this._unsubscribeMousemove=function(){e._target.removeEventListener("mousemove",i),e._target.removeEventListener("wheel",a)},this._target.addEventListener("mousemove",i),this._target.addEventListener("wheel",a,{passive:!1}),ie(t)&&this._mouseMoveHandler(t);var n=this._makeCompatEvent(t);this._processEvent(n,this._handler.mouseEnterEvent)}},{key:"_resetClickTimeout",value:function(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null}},{key:"_mouseMoveHandler",value:function(t){if(!this._mousePressed||ie(t)){var e=this._makeCompatEvent(t);this._processEvent(e,this._handler.mouseMoveEvent)}}},{key:"_mouseWheelHandler",value:function(t){var e=this._makeCompatEvent(t);t.localX=e.localX,t.localY=e.localY,this._processEvent(t,this._handler.mouseWheelEvent)}},{key:"_mouseMoveWithDownHandler",value:function(t){if((!("button"in t)||t.button===Qt)&&null===this._startPinchMiddlePoint){var e=ie(t);if(!this._preventDragProcess||!e){this._pinchPrevented=!0;var i=this._makeCompatEvent(t),a=this._mouseMoveStartPosition,n=Math.abs(a.x-i.pageX),r=Math.abs(a.y-i.pageY),s=n+r>5;if(s||!e){if(s&&!this._moveExceededManhattanDistance&&e){var o=.5*n;r>=o&&!this._options.treatVertTouchDragAsPageScroll||o>r&&!this._options.treatHorzTouchDragAsPageScroll||(this._preventDragProcess=!0)}s&&(this._moveExceededManhattanDistance=!0,this._cancelClick=!0,e&&this._clearLongTapTimeout()),this._preventDragProcess||(this._processEvent(i,this._handler.pressedMouseMoveEvent),e&&ae(t))}}}}},{key:"_mouseUpHandler",value:function(t){if(!("button"in t)||t.button===Qt){var e=this._makeCompatEvent(t);this._clearLongTapTimeout(),this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRoot&&(this._unsubscribeRoot(),this._unsubscribeRoot=null),ie(t)&&this._mouseLeaveHandler(t),this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1?(this._processEvent(e,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()):this._cancelClick||this._processEvent(e,this._handler.mouseClickEvent),ie(t)&&(ae(t),this._mouseLeaveHandler(t),0===t.touches.length&&(this._longTapActive=!1))}}},{key:"_clearLongTapTimeout",value:function(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}},{key:"_mouseDownHandler",value:function(t){if(!("button"in t)||t.button===Qt||t.button===te){var e=this._makeCompatEvent(t);if("button"in t&&t.button===te)this._processEvent(e,this._handler.mouseRightDownEvent);else{this._cancelClick=!1,this._moveExceededManhattanDistance=!1,this._preventDragProcess=!1,ie(t)&&this._mouseEnterHandler(t),this._mouseMoveStartPosition={x:e.pageX,y:e.pageY},this._unsubscribeRoot&&(this._unsubscribeRoot(),this._unsubscribeRoot=null);var i=this._mouseMoveWithDownHandler.bind(this),a=this._mouseUpHandler.bind(this),n=this._target.ownerDocument.documentElement;this._unsubscribeRoot=function(){n.removeEventListener("touchmove",i),n.removeEventListener("touchend",a),n.removeEventListener("mousemove",i),n.removeEventListener("mouseup",a)},n.addEventListener("touchmove",i,{passive:!1}),n.addEventListener("touchend",a,{passive:!1}),this._clearLongTapTimeout(),ie(t)&&1===t.touches.length?this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),600):(n.addEventListener("mousemove",i),n.addEventListener("mouseup",a)),this._mousePressed=!0,this._processEvent(e,this._handler.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500))}}}},{key:"_init",value:function(){var t=this;this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));var e=this._target.ownerDocument,i=function(e){t._handler.mouseDownOutsideEvent&&(e.target&&t._target.contains(e.target)||t._handler.mouseDownOutsideEvent())};this._unsubscribeOutsideEvents=function(){e.removeEventListener("mousedown",i),e.removeEventListener("touchstart",i)},e.addEventListener("mousedown",i),e.addEventListener("touchstart",i,{passive:!0}),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._mouseDownHandler.bind(this),{passive:!0}),re||this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(function(){}),{passive:!1})}},{key:"_initPinch",value:function(){var t=this;void 0===this._handler.pinchStartEvent&&void 0===this._handler.pinchEvent&&void 0===this._handler.pinchEndEvent||(this._target.addEventListener("touchstart",(function(e){return t._checkPinchState(e.touches)}),{passive:!0}),this._target.addEventListener("touchmove",(function(e){if(2===e.touches.length&&null!==t._startPinchMiddlePoint&&void 0!==t._handler.pinchEvent){var i=se(e.touches[0],e.touches[1]);t._handler.pinchEvent(t._startPinchMiddlePoint,i/t._startPinchDistance),ae(e)}}),{passive:!1}),this._target.addEventListener("touchend",(function(e){t._checkPinchState(e.touches)})))}},{key:"_checkPinchState",value:function(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)}},{key:"_startPinch",value:function(t){var e=ee(this._target);this._startPinchMiddlePoint={x:(t[0].clientX-e.left+(t[1].clientX-e.left))/2,y:(t[0].clientY-e.top+(t[1].clientY-e.top))/2},this._startPinchDistance=se(t[0],t[1]),void 0!==this._handler.pinchStartEvent&&this._handler.pinchStartEvent(),this._clearLongTapTimeout()}},{key:"_stopPinch",value:function(){null!==this._startPinchMiddlePoint&&(this._startPinchMiddlePoint=null,void 0!==this._handler.pinchEndEvent&&this._handler.pinchEndEvent())}},{key:"_mouseLeaveHandler",value:function(t){this._unsubscribeMousemove&&this._unsubscribeMousemove();var e=this._makeCompatEvent(t);this._processEvent(e,this._handler.mouseLeaveEvent)}},{key:"_longTapHandler",value:function(t){var e=this._makeCompatEvent(t);this._processEvent(e,this._handler.longTapEvent),this._cancelClick=!0,this._longTapActive=!0}},{key:"_processEvent",value:function(t,e){e&&e.call(this._handler,t)}},{key:"_makeCompatEvent",value:function(t){var e;e="touches"in t&&t.touches.length?t.touches[0]:"changedTouches"in t&&t.changedTouches.length?t.changedTouches[0]:t;var i=ee(this._target);return{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,localX:e.clientX-i.left,localY:e.clientY-i.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,type:t.type.startsWith("mouse")?oe:ce,target:e.target,view:t.view}}}]),t}();function le(t){return t.type===ce}function ue(t){return t.type===oe}var _e=function(){function t(e){i(this,t),this._chartData=e,this._seriesSize={}}return n(t,[{key:"_checkEventPointX",value:function(t){return t>0&&this._seriesSize.contentRight-this._seriesSize.contentLeft>t}},{key:"setSeriesSize",value:function(t){this._seriesSize=t}}]),t}(),de="step_1",ve="step_2",fe="step_3",pe="step_done",ye=function(t){s(r,t);var a=_(r);function r(t,e,n){var s;return i(this,r),(s=a.call(this,t))._xAxis=e,s._yAxis=n,s._noneGraphicMarkMouseDownFlag=!1,s._noneGraphicMarkMouseDownActiveData={markKey:null,dataIndex:-1,onLine:!1,onCircle:!1,pointIndex:-1},s}return n(r,[{key:"mouseUpEvent",value:function(t){this._chartData.setDragGraphicMarkFlag(!1),this._noneGraphicMarkMouseDownFlag=!1,this._noneGraphicMarkMouseDownActiveData={markKey:null,dataIndex:-1,onLine:!1,onCircle:!1,pointIndex:-1}}},{key:"mouseDownEvent",value:function(t){if(this._checkEventPointX(t.localX)&&this._checkEventPointY(t.localY)){this._chartData.setGraphicMarkPoint({x:t.localX,y:t.localY});var e=this._chartData.graphicMarkType();switch(e){case _t:case dt:case vt:case ft:case pt:case yt:case xt:case mt:case gt:case kt:case wt:this._twoStepGraphicMarkMouseDown(t,e);break;case Mt:case Dt:this._threeStepGraphicMarkMouseDown(t,e);break;case ut:this._noneGraphicMarkMouseLeftDown(t)}}}},{key:"mouseRightDownEvent",value:function(t){if(this._chartData.graphicMarkType()===ut){this._findNoneGraphicMarkMouseDownActiveData(t);var e=this._noneGraphicMarkMouseDownActiveData.markKey,i=this._noneGraphicMarkMouseDownActiveData.dataIndex;if(e&&-1!==i){var a=this._chartData.graphicMarkData(),n=a[e];n.splice(i,1),a[e]=n,this._chartData.setGraphicMarkData(a),this.mouseUpEvent(t)}}}},{key:"_twoStepGraphicMarkMouseDown",value:function(t,e){var i=this;this._graphicMarkMouseDown(t,e,(function(t){switch(t.drawStep){case de:t.drawStep=ve;break;case ve:t.drawStep=pe,i._chartData.setGraphicMarkType(ut)}}))}},{key:"_threeStepGraphicMarkMouseDown",value:function(t,e){var i=this;this._graphicMarkMouseDown(t,e,(function(t){switch(t.drawStep){case de:t.drawStep=ve;break;case ve:t.drawStep=fe;break;case fe:t.drawStep=pe,i._chartData.setGraphicMarkType(ut)}}))}},{key:"_graphicMarkMouseDown",value:function(t,e,i){var a=this._chartData.graphicMarkData(),n=a[e];if(2===t.button)n.splice(n.length-1,1),this._chartData.setGraphicMarkType(ut);else{var r=n[n.length-1];i(r),n[n.length-1]=r}a[e]=n,this._chartData.setGraphicMarkData(a)}},{key:"_noneGraphicMarkMouseLeftDown",value:function(t){this._findNoneGraphicMarkMouseDownActiveData(t),this._noneGraphicMarkMouseDownActiveData.markKey&&-1!==this._noneGraphicMarkMouseDownActiveData.dataIndex&&this._noneGraphicMarkMouseDownActiveData.onCircle&&(this._noneGraphicMarkMouseDownFlag=!0,this._chartData.setDragGraphicMarkFlag(!0))}},{key:"_findNoneGraphicMarkMouseDownActiveData",value:function(t){for(var i=this,a={x:t.localX,y:t.localY},n=Object.keys(this._chartData.graphicMarkData()),r=function(t){var e=n[t];switch(e){case _t:case kt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Kt(t[0],{x:i._seriesSize.contentRight,y:t[0].y},a)})))return{v:void 0};break;case dt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Kt(t[0],{x:t[0].x,y:i._seriesSize.tags[Ie].contentBottom},a)})))return{v:void 0};break;case vt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Kt(t[0],t[1],a)})))return{v:void 0};break;case ft:case pt:case yt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Ut(t[0],t[1],a)})))return{v:void 0};break;case xt:case mt:case gt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){return Zt(t[0],t[1],a)})))return{v:void 0};break;case Mt:case Dt:case wt:if(i._realFindNoneGraphicMarkMouseDownActiveData(e,a,(function(t){var n=[],r={width:i._seriesSize.contentRight,height:i._seriesSize.tags[Ie].contentBottom-i._seriesSize.tags[Ie].contentTop};switch(e){case Mt:n=Jt(t,r,!0);break;case Dt:n=Jt(t,r);break;case wt:n=$t(t,r)}for(var s=!1,o=0;n.length>o;o++){var c=n[o];if(s=Kt(c[0],c[1],a))return s}return s})))return{v:void 0}}},s=0;n.length>s;s++){var o=r(s);if("object"===e(o))return o.v}}},{key:"_realFindNoneGraphicMarkMouseDownActiveData",value:function(t,e,i){var a=this,n=this._chartData.graphicMarkData()[t],r=this._chartData.styleOptions().graphicMark;return n.forEach((function(n,s){var o=[],c=!1,h=-1;n.points.forEach((function(t,i){var n=a._xAxis.convertToPixel(t.xPos),s=a._yAxis.convertToPixel(t.price);o.push({x:n,y:s});var l=qt({x:n,y:s},r.point.radius,e);l&&(h=i),c||(c=l)}));var l=i(o,e);if(l||c)return a._noneGraphicMarkMouseDownActiveData={markKey:t,dataIndex:s,onLine:l,onCircle:c,pointIndex:h},!0})),!1}},{key:"mouseMoveEvent",value:function(t){if(this._checkEventPointX(t.localX)&&this._checkEventPointY(t.localY)){var e={x:t.localX,y:t.localY};if(this._chartData.setGraphicMarkPoint(e),!this._waitingForMouseMoveAnimationFrame){this._waitingForMouseMoveAnimationFrame=!0;var i=this._chartData.graphicMarkType();switch(i){case _t:case dt:case kt:this._onePointGraphicMarkMouseMove(e,i);break;case vt:case yt:case gt:case wt:this._twoPointGraphicMarkMouseMove(e,i);break;case ft:case xt:this._twoPointGraphicMarkMouseMove(e,i,(function(t,e){t.points[0].price=e.price}));break;case pt:case mt:this._twoPointGraphicMarkMouseMove(e,i,(function(t,e){t.points[0].xPos=e.xPos}));break;case Mt:case Dt:this._threePointGraphicMarkMouseMove(e,i);break;case ut:this._chartData.setGraphicMarkData(this._chartData.graphicMarkData())}this._waitingForMouseMoveAnimationFrame=!1}}}},{key:"pressedMouseMoveEvent",value:function(t){var e=this._noneGraphicMarkMouseDownActiveData.markKey,i=this._noneGraphicMarkMouseDownActiveData.dataIndex;if(e&&-1!==i){var a=this._chartData.graphicMarkData(),n=a[e],r={x:t.localX,y:t.localY};switch(e){case _t:case dt:case kt:case vt:case yt:case gt:case Mt:case Dt:case wt:var s=this._noneGraphicMarkMouseDownActiveData.pointIndex;-1!==s&&(n[i].points[s].xPos=this._xAxis.convertFromPixel(r.x),n[i].points[s].price=this._yAxis.convertFromPixel(r.y));break;case ft:case xt:var o=this._noneGraphicMarkMouseDownActiveData.pointIndex;if(-1!==o){var c=this._yAxis.convertFromPixel(r.y);n[i].points[o].xPos=this._xAxis.convertFromPixel(r.x),n[i].points[0].price=c,n[i].points[1].price=c}break;case pt:case mt:var h=this._noneGraphicMarkMouseDownActiveData.pointIndex;if(-1!==h){var l=this._xAxis.convertFromPixel(r.x);n[i].points[0].xPos=l,n[i].points[1].xPos=l,n[i].points[h].price=this._yAxis.convertFromPixel(r.y)}}a[e]=n,this._chartData.setGraphicMarkPoint({x:t.localX,y:t.localY}),this._chartData.setGraphicMarkData(a)}}},{key:"_onePointGraphicMarkMouseMove",value:function(t,e){var i=this;this._graphicMarkMouseMove(t,e,(function(e,a){var n=i._xAxis.convertFromPixel(t.x),r=i._yAxis.convertFromPixel(t.y);switch(a.drawStep){case pe:e.push({points:[{xPos:n,price:r}],drawStep:de});break;case de:case ve:a.points[0].xPos=n,a.points[0].price=r,e[e.length-1]=a}}))}},{key:"_twoPointGraphicMarkMouseMove",value:function(t,e,i){var a=this;this._graphicMarkMouseMove(t,e,(function(e,n){var r=a._xAxis.convertFromPixel(t.x),s=a._yAxis.convertFromPixel(t.y);switch(n.drawStep){case pe:e.push({points:[{xPos:r,price:s},{xPos:r,price:s}],drawStep:de});break;case de:n.points[0]={xPos:r,price:s},n.points[1]={xPos:r,price:s},e[e.length-1]=n;break;case ve:n.points[1]={xPos:r,price:s},k(i)&&i(n,{xPos:r,price:s}),e[e.length-1]=n}}))}},{key:"_threePointGraphicMarkMouseMove",value:function(t,e,i){var a=this;this._graphicMarkMouseMove(t,e,(function(e,n){var r=a._xAxis.convertFromPixel(t.x),s=a._yAxis.convertFromPixel(t.y);switch(n.drawStep){case pe:e.push({points:[{xPos:r,price:s},{xPos:r,price:s}],drawStep:de});break;case de:n.points[0]={xPos:r,price:s},n.points[1]={xPos:r,price:s},e[e.length-1]=n;break;case ve:k(i)&&i(n,{xPos:r,price:s}),n.points[1]={xPos:r,price:s},e[e.length-1]=n;break;case fe:n.points[2]={xPos:r,price:s},e[e.length-1]=n}}))}},{key:"_graphicMarkMouseMove",value:function(t,e,i){var a=this._chartData.graphicMarkData(),n=a[e];i(n,n[n.length-1]||{drawStep:pe}),a[e]=n,this._chartData.setGraphicMarkData(a)}},{key:"_checkEventPointY",value:function(t){var e=this._seriesSize.tags[Ie];return t>e.contentTop&&e.contentBottom>t}}]),r}(_e),xe=0,me=1,ge=2,ke=function(t){s(a,t);var e=_(a);function a(t,n,r,s){var o;return i(this,a),(o=e.call(this,t,n))._xAxis=r,o._yAxis=s,o}return n(a,[{key:"_draw",value:function(){var t=this._chartData.styleOptions().graphicMark,e=this._chartData.precisionOptions().price;this._drawHorizontalStraightLine(t),this._drawVerticalStraightLine(t),this._drawStraightLine(t),this._drawHorizontalRayLine(t),this._drawVerticalRayLine(t),this._drawRayLine(t),this._drawSegmentLine(t),this._drawPriceLine(t,e),this._drawPriceChannelLine(t),this._drawParallelStraightLine(t),this._drawFibonacciLine(t,e)}},{key:"_drawHorizontalStraightLine",value:function(t){var e=this;this._drawPointGraphicMark(_t,t,Kt,(function(t){return[[{x:0,y:t[0].y},{x:e._width,y:t[0].y}]]}))}},{key:"_drawVerticalStraightLine",value:function(t){var e=this;this._drawPointGraphicMark(dt,t,Kt,(function(t){return[[{x:t[0].x,y:0},{x:t[0].x,y:e._height}]]}))}},{key:"_drawStraightLine",value:function(t){var e=this;this._drawPointGraphicMark(vt,t,Kt,(function(t){if(t[0].x===t[1].x)return[[{x:t[0].x,y:0},{x:t[0].x,y:e._height}]];var i=Nt(t[0],t[1],[{x:0,y:t[0].y},{x:e._width,y:t[0].y}]);return[[{x:0,y:i[0]},{x:e._width,y:i[1]}]]}))}},{key:"_drawHorizontalRayLine",value:function(t){var e=this;this._drawPointGraphicMark(ft,t,Ut,(function(t){var i={x:0,y:t[0].y};return t[1].x>t[0].x&&(i.x=e._width),[[t[0],i]]}))}},{key:"_drawVerticalRayLine",value:function(t){var e=this;this._drawPointGraphicMark(pt,t,Ut,(function(t){var i={x:t[0].x,y:0};return t[1].y>t[0].y&&(i.y=e._height),[[t[0],i]]}))}},{key:"_drawRayLine",value:function(t){var e=this;this._drawPointGraphicMark(yt,t,Ut,(function(t){var i;return i=t[0].x===t[1].x&&t[0].y!==t[1].y?t[1].y>t[0].y?{x:t[0].x,y:e._height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:Nt(t[0],t[1],[{x:0,y:t[0].y}])[0]}:{x:e._width,y:Nt(t[0],t[1],[{x:e._width,y:t[0].y}])[0]},[[t[0],i]]}))}},{key:"_drawSegmentLine",value:function(t){this._drawPointGraphicMark(xt,t,Zt),this._drawPointGraphicMark(mt,t,Zt),this._drawPointGraphicMark(gt,t,Zt)}},{key:"_drawPriceLine",value:function(t,e){var i=this;this._drawPointGraphicMark(kt,t,Ut,(function(t){return[[t[0],{x:i._width,y:t[0].y}]]}),!0,e)}},{key:"_drawPriceChannelLine",value:function(t){var e=this;this._drawPointGraphicMark(Mt,t,Kt,(function(t){return Jt(t,{width:e._width,height:e._height},!0)}))}},{key:"_drawParallelStraightLine",value:function(t){var e=this;this._drawPointGraphicMark(Dt,t,Kt,(function(t){return Jt(t,{width:e._width,height:e._height})}))}},{key:"_drawFibonacciLine",value:function(t,e){var i=this;this._drawPointGraphicMark(wt,t,Kt,(function(t){return $t(t,{width:i._width,height:i._height})}),!0,e,["(100.0%)","(78.6%)","(61.8%)","(50.0%)","(38.2%)","(23.6%)","(0.0%)"])}},{key:"_drawPointGraphicMark",value:function(t,e,i,a,n,r,s){var o=this;this._chartData.graphicMarkData()[t].forEach((function(t){var c=t.drawStep,h=[];t.points.forEach((function(t){var e=t.price,i=o._xAxis.convertToPixel(t.xPos),a=o._yAxis.convertToPixel(e);h.push({x:i,y:a})}));var l=a?a(h):[h];o._drawGraphicMark(e,l,h,c,i,n,r,s)}))}},{key:"_drawGraphicMark",value:function(t,e,i,a,n,r,s){var o=this,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],h=this._chartData.graphicMarkPoint(),l=!1;e.forEach((function(e,i){if(e.length>1){var u=n(e[0],e[1],h);if(l||(l=u),a!==de){switch(o._ctx.strokeStyle=t.line.color,o._ctx.lineWidth=t.line.size,o._getLineType(e[0],e[1])){case xe:Et(o._ctx,(function(){o._ctx.beginPath(),o._ctx.moveTo(e[0].x,e[0].y),o._ctx.lineTo(e[1].x,e[1].y),o._ctx.stroke(),o._ctx.closePath()}));break;case me:At(o._ctx,e[0].y,e[0].x,e[1].x);break;case ge:Ct(o._ctx,e[0].x,e[0].y,e[1].y)}if(r){var _=nt(o._yAxis.convertFromPixel(e[0].y),s);o._ctx.font=Pt(t.text.size,t.text.family),o._ctx.fillStyle=t.text.color,o._ctx.fillText("".concat(_," ").concat(c[i]||""),e[0].x+t.text.marginLeft,e[0].y-t.text.marginBottom)}}}}));for(var u=t.point.radius,_=!1,d=0;i.length>d&&!(_=qt(i[d],u,h));d++);i.forEach((function(e){var i=qt(e,u,h);if(_||l){var a=u,n=t.point.backgroundColor,r=t.point.borderColor,s=t.point.borderSize;i&&(a=t.point.activeRadius,n=t.point.activeBackgroundColor,r=t.point.activeBorderColor,s=t.point.activeBorderSize),o._ctx.fillStyle=n,o._ctx.beginPath(),o._ctx.arc(e.x,e.y,a,0,2*Math.PI),o._ctx.closePath(),o._ctx.fill(),o._ctx.lineWidth=s,o._ctx.strokeStyle=r,o._ctx.beginPath(),o._ctx.arc(e.x,e.y,a,0,2*Math.PI),o._ctx.closePath(),o._ctx.stroke()}}))}},{key:"_getLineType",value:function(t,e){return t.x===e.x?ge:t.y===e.y?me:xe}}]),a}(Rt),Me=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_createMainView",value:function(t,e){return new Xt(t,e.chartData,e.xAxis,e.yAxis,e.additionalDataProvider)}},{key:"_createExpandView",value:function(t,e){return new ke(t,e.chartData,e.xAxis,e.yAxis)}},{key:"_createFloatLayerView",value:function(t,e){return new jt(t,e.chartData,e.xAxis,e.yAxis,e.additionalDataProvider)}},{key:"invalidate",value:function(t){t!==ot&&d(o(a.prototype),"invalidate",this).call(this,t),this._expandView.flush()}},{key:"setSize",value:function(t,e){d(o(a.prototype),"setSize",this).call(this,t,e),this._expandView.setSize(t,e)}}]),a}(Ht),De=function(t){s(a,t);var e=_(a);function a(t){var n;return i(this,a),(n=e.call(this,t))._chartType=R,n}return n(a,[{key:"_createYAxis",value:function(t){return new Ft(t.chartData,!0)}},{key:"_createMainWidget",value:function(t,e){return new Me({container:t,chartData:e.chartData,xAxis:e.xAxis,yAxis:this._yAxis,additionalDataProvider:{technicalIndicatorType:this.technicalIndicatorType.bind(this),chartType:this.chartType.bind(this),tag:this.tag.bind(this)}})}},{key:"_isRealTime",value:function(){return this._chartType===I}},{key:"chartType",value:function(){return this._chartType}},{key:"setChartType",value:function(t){this._chartType!==t&&(this._chartType=t,this._chartData.calcTechnicalIndicator(this,X.AVERAGE))}}]),a}(Wt),we=function(t){s(a,t);var e=_(a);function a(t,n,r){var s;return i(this,a),(s=e.call(this,t,n))._xAxis=r,s}return n(a,[{key:"_draw",value:function(){var t=this._chartData.styleOptions().xAxis;t.display&&(this._drawAxisLine(t),this._drawTickLines(t),this._drawTickLabels(t))}},{key:"_drawAxisLine",value:function(t){var e=t.axisLine;e.display&&(this._ctx.strokeStyle=e.color,this._ctx.lineWidth=e.size,At(this._ctx,0,0,this._width))}},{key:"_drawTickLines",value:function(t){var e=this,i=t.tickLine;if(i.display){this._ctx.lineWidth=i.size,this._ctx.strokeStyle=i.color;var a=t.axisLine.display?t.axisLine.size:0,n=a+i.length;this._xAxis.ticks().forEach((function(t){Ct(e._ctx,t.x,a,n)}))}}},{key:"_drawTickLabels",value:function(t){var e=t.tickText;if(e.display){var i=t.tickLine;this._ctx.textBaseline="top",this._ctx.font=Pt(e.size,e.family),this._ctx.textAlign="center",this._ctx.fillStyle=e.color;var a=e.margin;t.axisLine.display&&(a+=t.axisLine.size),i.display&&(a+=i.length);for(var n=this._xAxis.ticks(),r=n.length,s=0;r>s;s++)this._ctx.fillText(n[s].v,n[s].x,a)}}}]),a}(Rt),Se=function(t){s(a,t);var e=_(a);function a(t,n,r){var s;return i(this,a),(s=e.call(this,t,n))._xAxis=r,s}return n(a,[{key:"_draw",value:function(){this._drawCrossHairLabel()}},{key:"_drawCrossHairLabel",value:function(){if(this._chartData.crossHairSeriesTag()){var t=this._chartData.styleOptions().floatLayer.crossHair,e=t.vertical,i=e.text;if(t.display&&e.display&&i.display){var a,n=this._chartData.dataList(),r=this._chartData.crossHairPoint(),s=n[a=r?this._xAxis.convertFromPixel(r.x):n.length-1];if(s){var o=this._xAxis.convertToPixel(a),c=at(s.timestamp,"YYYY-MM-DD hh:mm",this._chartData.timezone()),h=i.size;this._ctx.font=Pt(h,i.family);var l=Tt(this._ctx,c),u=o-l/2,_=i.paddingLeft,d=i.paddingRight,v=i.paddingTop,f=i.borderSize;_+f>u?u=_+f:u>this._width-l-f-d&&(u=this._width-l-f-d);var p=u-f-_,y=u+l+f+d,x=0+h+2*f+v+i.paddingBottom;this._ctx.fillStyle=i.backgroundColor,this._ctx.fillRect(p,0,y-p,x-0),this._ctx.lineWidth=f,this._ctx.strokeStyle=i.borderColor,this._ctx.strokeRect(p,0,y-p,x-0),this._ctx.textBaseline="top",this._ctx.fillStyle=i.color,this._ctx.fillText(c,u,f+v)}}}}}]),a}(Rt),be=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_createMainView",value:function(t,e){return new we(t,e.chartData,e.xAxis)}},{key:"_createFloatLayerView",value:function(t,e){return new Se(t,e.chartData,e.xAxis)}}]),a}(It),Te=function(t){s(a,t);var e=_(a);function a(t){var n;return i(this,a),(n=e.call(this,t))._initMeasureCanvas(),n}return n(a,[{key:"_initMeasureCanvas",value:function(){var t=document.createElement("canvas");this._measureCtx=t.getContext("2d");var e=bt(this._measureCtx);this._measureCtx.scale(e,e)}},{key:"_computeMinMaxValue",value:function(){var t=this._chartData.from(),e=this._chartData.to()-1;return{min:t,max:e,range:e-t+1}}},{key:"_computeOptimalTicks",value:function(t){var e=[],i=t.length,a=this._chartData.dataList();if(i>0){var n=this._chartData.timezone(),r=this._chartData.styleOptions().xAxis.tickText;this._measureCtx.font=Pt(r.size,r.family);var s=Tt(this._measureCtx,"00-00 00:00"),o=this.convertToPixel(parseInt(t[0].v,10)),c=1;if(i>1){var h=this.convertToPixel(parseInt(t[1].v,10)),l=Math.abs(h-o);s>l&&(c=Math.ceil(s/l))}for(var u=0;i>u;u+=c){var _=parseInt(t[u].v,10),d=a[_].timestamp,v=at(d,"hh:mm",n);if(0!==u)v=this._optimalTickLabel(d,a[parseInt(t[u-c].v,10)].timestamp,n)||v;var f=this.convertToPixel(_);e.push({v:v,x:f,oV:d})}if(1===e.length)e[0].v=at(e[0].oV,"YYYY-MM-DD hh:mm",n);else{var p=e[0].oV,y=e[1].oV;if(e[2]){var x=e[2].v;/^[0-9]{2}-[0-9]{2}$/.test(x)?e[0].v=at(p,"MM-DD",n):/^[0-9]{4}-[0-9]{2}$/.test(x)?e[0].v=at(p,"YYYY-MM",n):/^[0-9]{4}$/.test(x)&&(e[0].v=at(p,"YYYY",n))}else e[0].v=this._optimalTickLabel(p,y,n)||e[0].v}}return e}},{key:"_optimalTickLabel",value:function(t,e,i){var a=at(t,"YYYY",i),n=at(t,"YYYY-MM",i),r=at(t,"MM-DD",i);return a!==at(e,"YYYY",i)?a:n!==at(e,"YYYY-MM",i)?n:r!==at(e,"MM-DD",i)?r:null}},{key:"convertFromPixel",value:function(t){return Math.round(this._chartData.coordinateToFloatIndex(t))-1}},{key:"convertToPixel",value:function(t){var e=this._chartData.dataList().length,i=this._chartData.dataSpace(),a=e+this._chartData.offsetRightBarCount()-t;return this._width-(a-.5)*i+this._chartData.barSpace()/2}}]),a}(Gt),Pe=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"_initBefore",value:function(){this._xAxis=new Te(this._chartData)}},{key:"_createMainWidget",value:function(t,e){return new be({container:t,chartData:e.chartData,xAxis:this._xAxis})}},{key:"_computeAxis",value:function(){this._xAxis.computeAxis()}},{key:"xAxis",value:function(){return this._xAxis}},{key:"setSize",value:function(t,e){this._xAxis.setSize(t.width,t.height),this._computeAxis(),d(o(a.prototype),"setSize",this).call(this,t,e)}}]),a}(Lt),Ae=function(){function t(e,a,n,r,s){i(this,t),this._chartData=a,this._seriesIndex=n,this._width=0,this._offsetLeft=0,this._dragEventHandler=s,this._initElement(e,r)}return n(t,[{key:"_initElement",value:function(t,e){this._container=t,this._wrapper=document.createElement("div"),this._wrapper.style.margin="0",this._wrapper.style.padding="0",this._wrapper.style.overflow="hidden",this._element=document.createElement("div"),this._element.style.margin="0",this._element.style.padding="0",this._element.style.width="100%",this._element.style.position="absolute",this._element.style.zIndex="20",this._element.style.height="5px",e&&(this._element.style.cursor="ns-resize",this._dragEvent=new he(this._element,{mouseDownEvent:this._mouseDownEvent.bind(this),pressedMouseMoveEvent:this._pressedMouseMoveEvent.bind(this)},{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0})),this._wrapper.appendChild(this._element);var i=t.lastChild;i?t.insertBefore(this._wrapper,i):t.appendChild(this._wrapper)}},{key:"_mouseDownEvent",value:function(t){this._startY=t.pageY,this._dragEventHandler.startDrag(this._seriesIndex)}},{key:"_pressedMouseMoveEvent",value:function(t){this._dragEventHandler.drag(t.pageY-this._startY,this._seriesIndex)}},{key:"height",value:function(){return this._wrapper.offsetHeight}},{key:"setSize",value:function(t,e){this._offsetLeft=t,this._width=e,this.invalidate()}},{key:"updateSeriesIndex",value:function(t){this._seriesIndex=t}},{key:"invalidate",value:function(){var t=this._chartData.styleOptions().separator;this._wrapper.style.backgroundColor=t.color,this._wrapper.style.height="".concat(t.size,"px"),this._wrapper.style.marginLeft="".concat(t.fill?0:this._offsetLeft,"px"),this._wrapper.style.width=t.fill?"100%":"".concat(this._width,"px")}},{key:"getImage",value:function(){var t=this._chartData.styleOptions().separator,e=document.createElement("canvas"),i=e.getContext("2d"),a=bt(i),n=this._wrapper.offsetWidth,r=t.size;return e.style.width="".concat(n,"px"),e.style.height="".concat(r,"px"),e.width=n*a,e.height=r*a,i.scale(a,a),i.fillStyle=t.color,i.fillRect(this._offsetLeft,0,n,r),e}},{key:"destroy",value:function(){this._dragEvent&&this._dragEvent.destroy(),this._container.removeChild(this._wrapper)}}]),t}(),Ce=function(t){s(a,t);var e=_(a);function a(t){var n;return i(this,a),(n=e.call(this,t))._startScrollPoint={},n._touchPoint={},n._touchCancelCrossHair=!1,n._touchZoomed=!1,n._pinchScale=1,n}return n(a,[{key:"pinchStartEvent",value:function(){this._pinchScale=1,this._touchZoomed=!0}},{key:"pinchEvent",value:function(t,e){var i=5*(e-this._pinchScale);this._pinchScale=e,this._chartData.zoom(i,t)}},{key:"mouseLeaveEvent",value:function(t){ue(t)&&this._chartData.setCrossHairSeriesTag(null)}},{key:"mouseMoveEvent",value:function(t){if(ue(t))if(this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);e?(this._chartData.setCrossHairPoint({x:t.localX,y:e.y}),this._chartData.setCrossHairSeriesTag(e.tag)):this._chartData.setCrossHairSeriesTag(null)}else this._chartData.setCrossHairSeriesTag(null)}},{key:"mouseWheelEvent",value:function(t){if(this._checkEventPointX(t.localX)){var e=-t.deltaY/100;if(0!==e){switch(t.cancelable&&t.preventDefault(),t.deltaMode){case t.DOM_DELTA_PAGE:e*=120;break;case t.DOM_DELTA_LINE:e*=32}if(0!==e){var i=Math.sign(e)*Math.min(1,Math.abs(e));this._chartData.zoom(i,{x:t.localX,y:t.localY})}}}}},{key:"mouseClickEvent",value:function(t){if(le(t)&&this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);e&&(this._touchPoint||this._touchCancelCrossHair||this._touchZoomed||(this._touchPoint={x:t.localX,y:t.localY},this._chartData.setCrossHairPoint({x:t.localX,y:e.y}),this._chartData.setCrossHairSeriesTag(e.tag)))}}},{key:"mouseDownEvent",value:function(t){if(this._startScrollPoint={x:t.localX,y:t.localY},this._chartData.startScroll(),le(t)&&this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);if(e){var i={x:t.localX,y:e.y};if(this._touchZoomed=!1,this._touchPoint){var a=t.localX-this._touchPoint.x,n=t.localY-this._touchPoint.y;10>Math.sqrt(a*a+n*n)?(this._touchPoint={x:t.localX,y:t.localY},this._chartData.setCrossHairPoint(i),this._chartData.setCrossHairSeriesTag(e.tag)):(this._touchCancelCrossHair=!0,this._touchPoint=null,this._chartData.setCrossHairPoint(i),this._chartData.setCrossHairSeriesTag(null))}else this._touchCancelCrossHair=!1}}}},{key:"pressedMouseMoveEvent",value:function(t){if(this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);if(e){var i={x:t.localX,y:e.y};if(le(t)&&this._touchPoint)return this._touchPoint={x:t.localX,y:t.localY},this._chartData.setCrossHairPoint(i),void this._chartData.setCrossHairSeriesTag(e.tag);var a=t.localX-this._startScrollPoint.x;this._chartData.setCrossHairPoint(i),this._chartData.scroll(a)}}}},{key:"longTapEvent",value:function(t){if(le(t)&&this._checkEventPointX(t.localX)){var e=this._translateCrossHairRealY(t.localY);e&&(this._touchPoint={x:t.localX,y:t.localY},this._chartData.setCrossHairPoint({x:t.localX,y:e.y}),this._chartData.setCrossHairSeriesTag(e.tag))}}},{key:"_translateCrossHairRealY",value:function(t){var e=this._seriesSize.tags||{};for(var i in e){var a=e[i];if(t>a.contentTop&&a.contentBottom>t)return{tag:i,y:t-a.contentTop}}return null}}]),a}(_e),Ee=function(t){s(a,t);var e=_(a);function a(){return i(this,a),e.apply(this,arguments)}return n(a,[{key:"keyBoardDownEvent",value:function(t){if(t.shiftKey)switch(t.code){case"ArrowUp":this._chartData.zoom(-.5,this._chartData.crossHairPoint());break;case"ArrowDown":this._chartData.zoom(.5,this._chartData.crossHairPoint());break;case"ArrowLeft":this._chartData.startScroll(),this._chartData.scroll(-this._chartData.dataSpace());break;case"ArrowRight":this._chartData.startScroll(),this._chartData.scroll(this._chartData.dataSpace())}}}]),a}(_e),Le=function(){function t(e,a,n,r){i(this,t),this._target=e,this._chartData=a,this._seriesSize={},this._event=new he(this._target,{pinchStartEvent:this._pinchStartEvent.bind(this),pinchEvent:this._pinchEvent.bind(this),mouseUpEvent:this._mouseUpEvent.bind(this),mouseClickEvent:this._mouseClickEvent.bind(this),mouseDownEvent:this._mouseDownEvent.bind(this),mouseRightDownEvent:this._mouseRightDownEvent.bind(this),mouseLeaveEvent:this._mouseLeaveEvent.bind(this),mouseMoveEvent:this._mouseMoveEvent.bind(this),mouseWheelEvent:this._mouseWheelEvent.bind(this),pressedMouseMoveEvent:this._pressedMouseMoveEvent.bind(this),longTapEvent:this._longTapEvent.bind(this)},{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1}),this._boundKeyBoardDownEvent=this._keyBoardDownEvent.bind(this),this._target.addEventListener("keydown",this._boundKeyBoardDownEvent),this._boundContextMenuEvent=function(t){t.preventDefault()},this._target.addEventListener("contextmenu",this._boundContextMenuEvent,!1),this._zoomScrollEventHandler=new Ce(a),this._graphicMarkEventHandler=new ye(a,n,r),this._keyBoardEventHandler=new Ee(a)}return n(t,[{key:"_keyBoardDownEvent",value:function(t){this._keyBoardEventHandler.keyBoardDownEvent(t)}},{key:"_pinchStartEvent",value:function(){this._zoomScrollEventHandler.pinchStartEvent()}},{key:"_pinchEvent",value:function(t,e){this._zoomScrollEventHandler.pinchEvent(t,e)}},{key:"_mouseUpEvent",value:function(t){this._target.style.cursor="crosshair",t.localX-=this._seriesSize.contentLeft,this._graphicMarkEventHandler.mouseUpEvent(t)}},{key:"_mouseLeaveEvent",value:function(t){this._checkZoomScroll()&&(t.localX-=this._seriesSize.contentLeft,this._zoomScrollEventHandler.mouseLeaveEvent(t))}},{key:"_mouseMoveEvent",value:function(t){t.localX-=this._seriesSize.contentLeft,this._chartData.shouldInvalidateGraphicMark()&&this._graphicMarkEventHandler.mouseMoveEvent(t),this._checkZoomScroll()&&this._zoomScrollEventHandler.mouseMoveEvent(t)}},{key:"_mouseWheelEvent",value:function(t){this._checkZoomScroll()&&this._zoomScrollEventHandler.mouseWheelEvent(t)}},{key:"_mouseClickEvent",value:function(t){this._checkZoomScroll()&&(t.localX-=this._seriesSize.contentLeft,this._zoomScrollEventHandler.mouseClickEvent(t))}},{key:"_mouseDownEvent",value:function(t){this._target.style.cursor="pointer",t.localX-=this._seriesSize.contentLeft,this._graphicMarkEventHandler.mouseDownEvent(t),this._checkZoomScroll()&&this._zoomScrollEventHandler.mouseDownEvent(t)}},{key:"_mouseRightDownEvent",value:function(t){t.localX-=this._seriesSize.contentLeft,this._graphicMarkEventHandler.mouseRightDownEvent(t)}},{key:"_pressedMouseMoveEvent",value:function(t){t.localX-=this._seriesSize.contentLeft,this._chartData.dragGraphicMarkFlag()&&(this._graphicMarkEventHandler.pressedMouseMoveEvent(t),null!==this._chartData.crossHairSeriesTag()&&this._chartData.setCrossHairSeriesTag(null)),this._checkZoomScroll()&&this._zoomScrollEventHandler.pressedMouseMoveEvent(t)}},{key:"_longTapEvent",value:function(t){this._checkZoomScroll()&&(t.localX-=this._seriesSize.contentLeft,this._zoomScrollEventHandler.longTapEvent(t))}},{key:"_checkZoomScroll",value:function(){return!this._chartData.dragGraphicMarkFlag()&&this._chartData.graphicMarkType()===ut}},{key:"setSeriesSize",value:function(t){this._seriesSize=t,this._zoomScrollEventHandler.setSeriesSize(t),this._graphicMarkEventHandler.setSeriesSize(t)}},{key:"destroy",value:function(){this._event.destroy(),this._target.removeEventListener("keydown",this._boundKeyBoardDownEvent),this._target.removeEventListener("contextmenu",this._boundContextMenuEvent)}}]),t}(),Ie="candle_stick_series_tag",Re=function(){function t(e,a){i(this,t),this._initChartContainer(e),this._technicalIndicatorBaseId=0,this._technicalIndicatorSeries=[],this._separatorSeries=[],this._separatorDragStartTechnicalIndicatorHeight=0,this._chartData=new St(a,this._updateSeries.bind(this)),this._xAxisSeries=new Pe({container:this._chartContainer,chartData:this._chartData}),this._candleStickSeries=new De({container:this._chartContainer,chartData:this._chartData,xAxis:this._xAxisSeries.xAxis(),technicalIndicatorType:X.MA,tag:Ie}),this._chartEvent=new Le(this._chartContainer,this._chartData,this._xAxisSeries.xAxis(),this._candleStickSeries.yAxis()),this.measureSeriesSize()}return n(t,[{key:"_initChartContainer",value:function(t){this._container=t,this._chartContainer=document.createElement("div"),this._chartContainer.style.position="relative",this._chartContainer.style.outline="none",this._chartContainer.style.borderStyle="none",this._chartContainer.style.width="100%",this._chartContainer.style.cursor="crosshair",this._chartContainer.tabIndex=1,t.appendChild(this._chartContainer)}},{key:"_separatorStartDrag",value:function(t){this._separatorDragStartTechnicalIndicatorHeight=this._technicalIndicatorSeries[t].height()}},{key:"_separatorDrag",value:function(t,e){var i=this._separatorDragStartTechnicalIndicatorHeight-t;0>i&&(i=0),this._technicalIndicatorSeries[e].setHeight(i),this.measureSeriesSize()}},{key:"_measureXAxisHeight",value:function(){var t=this._chartData.styleOptions().xAxis,e=t.axisLine,i=t.tickText,a=t.tickLine,n=0;return t.display&&(e.display&&(n+=e.size),a.display&&(n+=a.length),i.display&&(n+=i.size+i.margin)),n>0&&(n=Math.ceil(Math.max(t.minHeight,Math.min(n,t.maxHeight)))),n}},{key:"_measureYAxisWidth",value:function(){var t=this._chartData.styleOptions().yAxis,e=t.tickText,i=0;return t.display&&(t.axisLine.display&&(i+=t.axisLine.size),t.tickLine.display&&(i+=t.tickLine.length),t.tickText.display&&(i+=e.margin+6*(e.size-2))),i>0&&(i=Math.ceil(Math.max(t.minWidth,Math.min(i,t.maxWidth)))),i}},{key:"_measureSeparatorHeight",value:function(){return this._chartData.styleOptions().separator.size*this._separatorSeries.length}},{key:"_updateSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lt;if(t!==ot){this._xAxisSeries.invalidate(t);var e,i=y(this._technicalIndicatorSeries);try{for(i.s();!(e=i.n()).done;){var a=e.value;a.invalidate(t)}}catch(t){i.e(t)}finally{i.f()}}this._candleStickSeries.invalidate(t)}},{key:"_calcAllSeriesTechnicalIndicator",value:function(){var t,e=[];this._candleStickSeries.chartType()===R?(t=this._candleStickSeries.technicalIndicatorType(),e.push(t)):t=X.AVERAGE,this._chartData.calcTechnicalIndicator(this._candleStickSeries,t);var i,a=y(this._technicalIndicatorSeries);try{for(a.s();!(i=a.n()).done;){var n=i.value,r=n.technicalIndicatorType();0>e.indexOf(r)?(e.push(r),this._chartData.calcTechnicalIndicator(n,r)):n.invalidate(lt)}}catch(t){a.e(t)}finally{a.f()}}},{key:"chartData",value:function(){return this._chartData}},{key:"measureSeriesSize",value:function(){var t=this._chartData.styleOptions().yAxis,e=t.position===P,i=t.tickText.position===L,a=this._container.offsetWidth,n=this._container.offsetHeight,r=this._measureSeparatorHeight(),s=this._measureXAxisHeight(),o=this._measureYAxisWidth(),c=n-s-r,h=a-(i?o:0),l=a-o,u=0;e&&(l=0,i&&(u=o));var _,d=0,v=y(this._technicalIndicatorSeries);try{for(v.s();!(_=v.n()).done;){var f=_.value,p=f.height();if((d+=p)>c){var x=d-c;d=c,f.setHeight(p-x)}}}catch(t){v.e(t)}finally{v.f()}var m=c-d;this._chartData.setTotalDataSpace(h);var g={};g.contentLeft=u,g.contentRight=u+h;var k={};k[Ie]={contentTop:0,contentBottom:m};var M=m,D=m;this._candleStickSeries.setSize({left:u,width:h,height:m},{left:l,width:o,height:m});for(var w=0;this._technicalIndicatorSeries.length>w;w++){var S=this._technicalIndicatorSeries[w],b=this._separatorSeries[w],T=S.height();S.setSize({left:u,width:h,height:T},{left:l,width:o,height:T}),b.setSize(u,h),D+=T,k[S.tag()]={contentTop:M,contentBottom:D},M=D}g.tags=k,this._xAxisSeries.setSize({left:u,width:h,height:s},{left:l,width:o,height:s}),this._chartEvent.setSeriesSize(g)}},{key:"applyTechnicalIndicatorParams",value:function(t,e){this._chartData.applyTechnicalIndicatorParams(t,e);var i=[];this._candleStickSeries.technicalIndicatorType()===t&&i.push(this._candleStickSeries);var a,n=y(this._technicalIndicatorSeries);try{for(n.s();!(a=n.n()).done;){var r=a.value;r.technicalIndicatorType()===t&&i.push(r)}}catch(t){n.e(t)}finally{n.f()}this._chartData.calcTechnicalIndicator(i,t)}},{key:"_applyDataList",value:function(t,e,i){g(t)&&(k(i)&&i(),this._chartData.addData(t,0,e),this._xAxisSeries.invalidate(lt),this._calcAllSeriesTechnicalIndicator())}},{key:"applyNewData",value:function(t,e){var i=this;this._applyDataList(t,e,(function(){i._chartData.clearDataList()}))}},{key:"applyMoreData",value:function(t,e){this._applyDataList(t,e)}},{key:"updateData",value:function(t){if(M(t)&&!g(t)){var e=this._chartData.dataList(),i=e.length,a=i;+it(t,"timestamp",0)===+it(e[i-1],"timestamp",0)&&(a=i-1),this._chartData.addData(t,a),this._xAxisSeries.invalidate(a===i-1?st:lt),this._calcAllSeriesTechnicalIndicator()}}},{key:"setCandleStickSeriesType",value:function(t){this._candleStickSeries.setChartType(t)}},{key:"createTechnicalIndicator",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i=arguments.length>2?arguments[2]:void 0;t&&X.hasOwnProperty(t)&&t!==X.NO&&t!==X.AVERAGE||(t=X.MACD);var a=this._technicalIndicatorSeries.length,n=!w(i)||i;this._separatorSeries.push(new Ae(this._chartContainer,this._chartData,a,n,{startDrag:this._separatorStartDrag.bind(this),drag:this._separatorDrag.bind(this)})),this._technicalIndicatorBaseId++;var r="".concat("technical_indicator_").concat(this._technicalIndicatorBaseId),s=new Wt({container:this._chartContainer,chartData:this._chartData,xAxis:this._xAxisSeries.xAxis(),technicalIndicatorType:t,tag:r});return s.setHeight(e),this._technicalIndicatorSeries.push(s),this.measureSeriesSize(),r}},{key:"removeTechnicalIndicator",value:function(t){for(var e=-1,i=0;this._technicalIndicatorSeries.length>i;i++){if(this._technicalIndicatorSeries[i].tag()===t){e=i;break}}if(-1!==e){this._technicalIndicatorSeries[e].destroy(),this._separatorSeries[e].destroy(),this._technicalIndicatorSeries.splice(e,1),this._separatorSeries.splice(e,1);for(var a=0;this._separatorSeries.length>a;a++)this._separatorSeries[a].updateSeriesIndex(a);this.measureSeriesSize()}}},{key:"setTechnicalIndicatorType",value:function(t,e){if(t===Ie)this._candleStickSeries.setTechnicalIndicatorType(e);else{var i,a,n=y(this._technicalIndicatorSeries);try{for(n.s();!(a=n.n()).done;){var r=a.value;if(r.tag()===t){i=r;break}}}catch(t){n.e(t)}finally{n.f()}i&&(e===X.NO?this.removeTechnicalIndicator(t):i.setTechnicalIndicatorType(e))}}},{key:"setTimezone",value:function(t){this._chartData.setTimezone(t),this._xAxisSeries.invalidate(lt)}},{key:"getConvertPictureUrl",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"jpeg",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#333333";if("png"!==i&&"jpeg"!==i&&"bmp"!==i)throw Error("Picture format only supports jpeg, png and bmp!!!");var n=document.createElement("canvas"),r=n.getContext("2d"),s=bt(r),o=this._chartContainer.offsetWidth,c=this._chartContainer.offsetHeight;n.style.width="".concat(o,"px"),n.style.height="".concat(c,"px"),n.width=o*s,n.height=c*s,r.scale(s,s),r.fillStyle=a,r.fillRect(0,0,o,c);var h=0,l=this._candleStickSeries.height();r.drawImage(this._candleStickSeries.getImage(t,e),0,h,o,l),h+=l;for(var u=0;this._separatorSeries.length>u;u++){var _=this._separatorSeries[u],d=_.height(),v=this._technicalIndicatorSeries[u],f=v.height();r.drawImage(_.getImage(),0,h,o,d),h+=d,r.drawImage(v.getImage(t),0,h,o,f),h+=f}return r.drawImage(this._xAxisSeries.getImage(t),0,h,o,this._xAxisSeries.height()),n.toDataURL("image/".concat(i))}},{key:"destroy",value:function(){this._candleStickSeries.destroy(),this._technicalIndicatorSeries.forEach((function(t){t.destroy()})),this._separatorSeries.forEach((function(t){t.destroy()})),this._xAxisSeries.destroy(),this._container.removeChild(this._chartContainer),this._chartEvent.destroy()}}]),t}(),ze=function(){function t(e,a){i(this,t),this._chartSeries=new Re(e,a)}return n(t,[{key:"setStyleOptions",value:function(t){this._chartSeries.chartData().applyStyleOptions(t),this._chartSeries.measureSeriesSize()}},{key:"getStyleOptions",value:function(){return m(this._chartSeries.chartData().styleOptions())}},{key:"setTechnicalIndicatorParams",value:function(t,e){this._chartSeries.applyTechnicalIndicatorParams(t,e)}},{key:"getTechnicalIndicatorParamOptions",value:function(){return m(this._chartSeries.chartData().technicalIndicatorParamOptions())}},{key:"setPrecision",value:function(t,e){this._chartSeries.chartData().applyPrecision(t,e)}},{key:"setTimezone",value:function(t){this._chartSeries.setTimezone(t)}},{key:"resize",value:function(){this._chartSeries.measureSeriesSize()}},{key:"setOffsetRightSpace",value:function(t){this._chartSeries.chartData().setOffsetRightSpace(t)}},{key:"setLeftMinVisibleBarCount",value:function(t){this._chartSeries.chartData().setLeftMinVisibleBarCount(t)}},{key:"setRightMinVisibleBarCount",value:function(t){this._chartSeries.chartData().setRightMinVisibleBarCount(t)}},{key:"setDataSpace",value:function(t){this._chartSeries.chartData().setDataSpace(t)}},{key:"clearData",value:function(){this._chartSeries.chartData().clearDataList()}},{key:"getDataList",value:function(){return this._chartSeries.chartData().dataList()}},{key:"applyNewData",value:function(t,e){this._chartSeries.applyNewData(t,e)}},{key:"applyMoreData",value:function(t,e){this._chartSeries.applyMoreData(t,e)}},{key:"updateData",value:function(t){this._chartSeries.updateData(t)}},{key:"loadMore",value:function(t){this._chartSeries.chartData().loadMore(t)}},{key:"setCandleStickChartType",value:function(t){this._chartSeries.setCandleStickSeriesType(t)}},{key:"setCandleStickTechnicalIndicatorType",value:function(t){this._chartSeries.setTechnicalIndicatorType(Ie,t)}},{key:"setTechnicalIndicatorType",value:function(t,e){this._chartSeries.setTechnicalIndicatorType(t,e)}},{key:"addTechnicalIndicator",value:function(t,e,i){return this._chartSeries.createTechnicalIndicator(t,e,i)}},{key:"removeTechnicalIndicator",value:function(t){this._chartSeries.removeTechnicalIndicator(t)}},{key:"addGraphicMark",value:function(t){var e=this._chartSeries.chartData().graphicMarkType();if(e!==t){var i=this._chartSeries.chartData().graphicMarkData(),a=i[e];a&&g(a)&&(a.splice(a.length-1,1),i[e]=a),i.hasOwnProperty(t)||(t=ut),this._chartSeries.chartData().setGraphicMarkType(t),this._chartSeries.chartData().setGraphicMarkData(i)}}},{key:"removeAllGraphicMark",value:function(){var t=this._chartSeries.chartData().graphicMarkData(),e={};Object.keys(t).forEach((function(t){e[t]=[]})),this._chartSeries.chartData().setGraphicMarkType(ut),this._chartSeries.chartData().setGraphicMarkData(e)}},{key:"getConvertPictureUrl",value:function(t,e,i,a){return this._chartSeries.getConvertPictureUrl(t,e,i,a)}},{key:"destroy",value:function(){this._chartSeries.destroy()}}]),t}(),Oe={},He=1;t.dispose=function(t){var e;t&&("string"==typeof t&&(e=(t=document.getElementById(t)||document.getElementsByClassName(t)).chartId),e||(e=t.chartId),!e&&t instanceof ze&&(e=t.id),e&&(Oe[e].destroy(),delete Oe[e]))},t.init=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="Chart version is 5.2.1. Root dom is null, can not initialize the chart!!!",a=t;if(!a)throw Error(i);if("string"==typeof a&&(a=document.getElementById(t)||document.getElementsByClassName(t)),!a)throw Error(i);var n=Oe[a.chartId||""];if(n)return n;var r="".concat("k_line_chart_").concat(He++),s=new ze(a,e);return s.id=r,a.chartId=r,Oe[r]=s,s},t.version=function(){return"5.2.1"},Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/package.json b/package.json index 1bbd2d0bb..98ede1dd5 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,18 @@ { "name": "klinecharts", - "version": "5.2.0", + "version": "5.2.1", "description": "Lightweight k-line chart built with html5 canvas", "main": "index.js", "types": "./types/index.d.ts", "files": [ "LICENSE", "README.md", - "docs/STYLE-CONFIG-DETAIL.md", + "docs/", "index.js", "types/index.d.ts", - "dist/" + "dist/", + "licenses/", + "NOTICE" ], "repository": { "type": "git",