@chartspire/chartspire-chart 10.0.0-alpha2 → 10.0.0-alpha3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,4 +4,4 @@
4
4
  * Copyright (c) 2019 lihu.
5
5
  * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
6
6
  */
7
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).klinecharts={})}(this,(function(t){"use strict";var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},e(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n,o,r,a,s,l,u,c=function(){return c=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},c.apply(this,arguments)};function h(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}function d(t,e,i,n){return new(i||(i=Promise))((function(o,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function s(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))}function p(t,e){var i,n,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(i=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,n=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(t){s=[6,t],n=0}finally{i=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function g(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,o,r=i.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=r.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return a}function f(t,e,i){if(i||2===arguments.length)for(var n,o=0,r=e.length;o<r;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError,t.LineType=void 0,(n=t.LineType||(t.LineType={})).Dashed="dashed",n.Solid="solid",t.PolygonType=void 0,(o=t.PolygonType||(t.PolygonType={})).Stroke="stroke",o.Fill="fill",o.StrokeFill="stroke_fill",t.TooltipShowRule=void 0,(r=t.TooltipShowRule||(t.TooltipShowRule={})).Always="always",r.FollowCross="follow_cross",r.None="none",t.TooltipShowType=void 0,(a=t.TooltipShowType||(t.TooltipShowType={})).Standard="standard",a.Rect="rect",t.TooltipIconPosition=void 0,(s=t.TooltipIconPosition||(t.TooltipIconPosition={})).Left="left",s.Middle="middle",s.Right="right",t.CandleTooltipRectPosition=void 0,(l=t.CandleTooltipRectPosition||(t.CandleTooltipRectPosition={})).Fixed="fixed",l.Pointer="pointer",t.CandleType=void 0,(u=t.CandleType||(t.CandleType={})).HeikinAshi="heikin_ashi",u.CandleSolid="candle_solid",u.CandleStroke="candle_stroke",u.CandleUpStroke="candle_up_stroke",u.CandleDownStroke="candle_down_stroke",u.Ohlc="ohlc",u.Area="area";var y="#F92855",m="rgba(249, 40, 85, .7)",_="#2DC08E",x="rgba(45, 192, 142, .7)",C="#888888",b="#FFFFFF",T="#1677FF",w="#76808F",S="#DDDDDD";function E(t){return"rgba(22, 119, 255, ".concat(t,")")}function P(){function e(){return{show:!0,size:1,color:"#EDEDED",style:t.LineType.Dashed,dashedValue:[2,2]}}return{show:!0,horizontal:e(),vertical:e()}}function I(){return{show:!0,size:"auto",axisLine:{show:!0,color:S,size:1},tickText:{show:!0,color:w,size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:6},tickLine:{show:!0,size:1,length:3,color:S}}}function k(){function e(){return{show:!0,line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,2],size:1,color:w},text:{show:!0,style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:w,borderRadius:2,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:w}}}return{show:!0,horizontal:e(),vertical:e()}}function M(t,e){if(B(t)||B(e))for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=t[i],o=e[i];B(o)&&B(n)?M(n,o):L(e[i])&&(t[i]=D(e[i]))}}function D(t){if(!B(t))return t;var e=null;for(var i in e=A(t)?[]:{},t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];B(n)?e[i]=D(n):e[i]=n}return e}function A(t){return"[object Array]"===Object.prototype.toString.call(t)}function F(t){return"function"==typeof t}function B(t){return"object"==typeof t&&L(t)}function R(t){return"number"==typeof t&&Number.isFinite(t)}function L(t){return null!=t}function O(t){return"boolean"==typeof t}function W(t){return"string"==typeof t}var z=/\\(\\)?/g,V=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g");function N(t,e,i){if(L(t)){var n=[];e.replace(V,(function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var o=t;return L(e[1])?o=e[2].replace(z,"$1"):L(e[0])&&(o=e[0].trim()),n.push(o),""}));for(var o=t,r=0,a=n.length;L(o)&&r<a;)o=null==o?void 0:o[n[r++]];return L(o)?o:null!=i?i:"--"}return null!=i?i:"--"}function Y(t,e){var i={};return t.formatToParts(new Date(e)).forEach((function(t){var e=t.type,n=t.value;switch(e){case"year":i.YYYY=n;break;case"month":i.MM=n;break;case"day":i.DD=n;break;case"hour":i.HH="24"===n?"00":n;break;case"minute":i.mm=n;break;case"second":i.ss=n}})),i}function H(t,e,i){var n=Y(t,e);return i.replace(/YYYY|MM|DD|HH|mm|ss/g,(function(t){return n[t]}))}function X(t,e){var i=+t;return R(i)?i.toFixed(null!=e?e:2):"".concat(t)}function G(t){var e=+t;if(R(e)){if(e>1e9)return"".concat(+(e/1e9).toFixed(3),"B");if(e>1e6)return"".concat(+(e/1e6).toFixed(3),"M");if(e>1e3)return"".concat(+(e/1e3).toFixed(3),"K")}return"".concat(t)}function K(t,e){var i="".concat(t);if(0===e.length)return i;if(i.includes(".")){var n=i.split(".");return"".concat(n[0].replace(/(\d)(?=(\d{3})+$)/g,(function(t){return"".concat(t).concat(e)})),".").concat(n[1])}return i.replace(/(\d)(?=(\d{3})+$)/g,(function(t){return"".concat(t).concat(e)}))}function U(t,e){var i="".concat(t);if(new RegExp("\\.0{"+e+",}[1-9][0-9]*$").test(i)){var n=i.split("."),o=n.length-1,r=n[o],a=/0*/.exec(r);if(L(a)){var s=a[0].length;return n[o]=r.replace(/0*/,"0{".concat(s,"}")),n.join(".")}}return i}var j,Z=null;function q(t){var e,i;return null!==(i=null===(e=t.ownerDocument.defaultView)||void 0===e?void 0:e.devicePixelRatio)&&void 0!==i?i:1}function J(t,e,i){return"".concat(null!=e?e:"normal"," ").concat(null!=t?t:12,"px ").concat(null!=i?i:"Helvetica Neue")}function Q(t,e,i,n){if(!L(Z)){var o=document.createElement("canvas"),r=q(o);(Z=o.getContext("2d")).scale(r,r)}return Z.font=J(e,i,n),Math.round(Z.measureText(t).width)}t.ActionType=void 0,(j=t.ActionType||(t.ActionType={})).OnZoom="onZoom",j.OnScroll="onScroll",j.OnVisibleRangeChange="onVisibleRangeChange",j.OnTooltipIconClick="onTooltipIconClick",j.OnCrosshairChange="onCrosshairChange",j.OnCandleBarClick="onCandleBarClick",j.OnPaneDrag="onPaneDrag";var $,tt,et=function(){function t(){this._callbacks=[]}return t.prototype.subscribe=function(t){this._callbacks.indexOf(t)<0&&this._callbacks.push(t)},t.prototype.unsubscribe=function(t){if(F(t)){var e=this._callbacks.indexOf(t);e>-1&&this._callbacks.splice(e,1)}else this._callbacks=[]},t.prototype.execute=function(t){this._callbacks.forEach((function(e){e(t)}))},t.prototype.isEmpty=function(){return 0===this._callbacks.length},t}();function it(t,e,i,n){var o,r=t.result,a=t.figures,s=t.styles,l=N(s,"circles",i.circles),u=l.length,h=N(s,"bars",i.bars),d=h.length,p=N(s,"lines",i.lines),g=p.length,v=0,f=0,y=0,m=0;a.forEach((function(a){var s;switch(a.type){case"circle":m=v;var _=l[v%u];o=c(c({},_),{color:_.noChangeColor}),v++;break;case"bar":m=f;var x=h[f%d];o=c(c({},x),{color:x.noChangeColor}),f++;break;case"line":m=y,o=p[y%g],y++}if(L(a.type)){var C=null===(s=a.styles)||void 0===s?void 0:s.call(a,{data:{prev:r[e-1],current:r[e],next:r[e+1]},indicator:t,defaultStyles:i});n(a,c(c({},o),C),m)}}))}t.IndicatorSeries=void 0,($=t.IndicatorSeries||(t.IndicatorSeries={})).Normal="normal",$.Price="price",$.Volume="volume",function(t){t.Loading="loading",t.Error="error",t.Ready="ready"}(tt||(tt={}));var nt,ot=function(){function e(e){this.precision=4,this.calcParams=[],this.shouldOhlc=!1,this.shouldFormatBigNumber=!1,this.visible=!0,this.zLevel=0,this.series=t.IndicatorSeries.Normal,this.figures=[],this.minValue=null,this.maxValue=null,this.styles=null,this.shouldUpdate=function(t,e){var i=JSON.stringify(t.calcParams)!==JSON.stringify(e.calcParams)||t.figures!==e.figures||t.calc!==e.calc;return{calc:i,draw:i||t.shortName!==e.shortName||t.series!==e.series||t.minValue!==e.minValue||t.maxValue!==e.maxValue||t.precision!==e.precision||t.shouldOhlc!==e.shouldOhlc||t.shouldFormatBigNumber!==e.shouldFormatBigNumber||t.visible!==e.visible||t.zLevel!==e.zLevel||t.extendData!==e.extendData||t.regenerateFigures!==e.regenerateFigures||t.createTooltipDataSource!==e.createTooltipDataSource||t.draw!==e.draw}},this.calc=function(){return[]},this.regenerateFigures=null,this.createTooltipDataSource=null,this.draw=null,this.onDataStateChange=null,this.result=[],this._lockSeriesPrecision=!1,this.override(e),this._lockSeriesPrecision=!1}return e.prototype.override=function(t){var e,i,n=this.result,o=h(this,["result"]);this._prevIndicator=c(c({},D(o)),{result:n});var r=t.name,a=t.shortName,s=t.precision,l=t.styles,u=t.figures,d=t.calcParams,p=h(t,["name","shortName","precision","styles","figures","calcParams"]);W(this.name)||(this.name=null!=r?r:""),this.shortName=null!==(e=null!=a?a:this.shortName)&&void 0!==e?e:this.name,R(s)&&(this.precision=s,this._lockSeriesPrecision=!0),L(l)&&(null!==(i=this.styles)&&void 0!==i||(this.styles={}),M(this.styles,l)),M(this,p),L(d)&&(this.calcParams=d,F(this.regenerateFigures)&&(this.figures=this.regenerateFigures(this.calcParams))),this.figures=null!=u?u:this.figures},e.prototype.setSeriesPrecision=function(t){this._lockSeriesPrecision||(this.precision=t)},e.prototype.shouldUpdateImp=function(){var t=this._prevIndicator.zLevel!==this.zLevel,e=this.shouldUpdate(this._prevIndicator,this);return O(e)?{calc:e,draw:e,sort:t}:c(c({},e),{sort:t})},e.prototype.calcImp=function(t){return d(this,void 0,void 0,(function(){var e;return p(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.calc(t,this)];case 1:return e=i.sent(),this.result=e,[2,!0];case 2:return i.sent(),[2,!1];case 3:return[2]}}))}))},e.extend=function(t){return function(e){function n(){return e.call(this,t)||this}return i(n,e),n}(e)},e}();t.OverlayMode=void 0,(nt=t.OverlayMode||(t.OverlayMode={})).Normal="normal",nt.WeakMagnet="weak_magnet",nt.StrongMagnet="strong_magnet";var rt,at="overlay_figure_",st=function(){function e(e){this.groupId="",this.totalStep=1,this.currentStep=1,this.lock=!1,this.visible=!0,this.zLevel=0,this.needDefaultPointFigure=!1,this.needDefaultXAxisFigure=!1,this.needDefaultYAxisFigure=!1,this.mode=t.OverlayMode.Normal,this.modeSensitivity=8,this.points=[],this.extendData=null,this.styles=null,this.createPointFigures=null,this.createXAxisFigures=null,this.createYAxisFigures=null,this.performEventPressedMove=null,this.performEventMoveForDrawing=null,this.onDrawStart=null,this.onDrawing=null,this.onDrawEnd=null,this.onClick=null,this.onDoubleClick=null,this.onRightClick=null,this.onPressedMoveStart=null,this.onPressedMoving=null,this.onPressedMoveEnd=null,this.onMouseEnter=null,this.onMouseLeave=null,this.onRemoved=null,this.onSelected=null,this.onDeselected=null,this._prevPressedPoint=null,this._prevPressedPoints=[],this.override(e)}return e.prototype.override=function(t){var e,i;this._prevOverlay=D(this);var n=t.id,o=t.name;t.currentStep;var r=t.points,a=t.styles;if(M(this,h(t,["id","name","currentStep","points","styles"])),W(this.name)||(this.name=null!=o?o:""),!W(this.id)&&W(n)&&(this.id=n),L(a)&&(null!==(e=this.styles)&&void 0!==e||(this.styles={}),M(this.styles,a)),A(r)&&r.length>0){var s=0;if(this.points=f([],v(r),!1),r.length>=this.totalStep-1?(this.currentStep=-1,s=this.totalStep-1):(this.currentStep=r.length+1,s=r.length),F(this.performEventMoveForDrawing))for(var l=0;l<s;l++)this.performEventMoveForDrawing({currentStep:l+2,mode:this.mode,points:this.points,performPointIndex:l,performPoint:this.points[l]});-1===this.currentStep&&(null===(i=this.performEventPressedMove)||void 0===i||i.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:this.points.length-1,performPoint:this.points[this.points.length-1]}))}},e.prototype.shouldUpdate=function(){var t=this._prevOverlay.zLevel!==this.zLevel;return{sort:t,draw:t||JSON.stringify(this._prevOverlay)!==JSON.stringify(this.points)||this._prevOverlay.visible!==this.visible||this._prevOverlay.extendData!==this.extendData||this._prevOverlay.styles!==this.styles}},e.prototype.nextStep=function(){this.currentStep===this.totalStep-1?this.currentStep=-1:this.currentStep++},e.prototype.forceComplete=function(){this.currentStep=-1},e.prototype.isDrawing=function(){return-1!==this.currentStep},e.prototype.isStart=function(){return 1===this.currentStep},e.prototype.eventMoveForDrawing=function(t){var e,i=this.currentStep-1,n={};R(t.timestamp)&&(n.timestamp=t.timestamp),R(t.dataIndex)&&(n.dataIndex=t.dataIndex),R(t.value)&&(n.value=t.value),this.points[i]=n,null===(e=this.performEventMoveForDrawing)||void 0===e||e.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:i,performPoint:n})},e.prototype.eventPressedPointMove=function(t,e){var i;this.points[e].timestamp=t.timestamp,R(t.value)&&(this.points[e].value=t.value),null===(i=this.performEventPressedMove)||void 0===i||i.call(this,{currentStep:this.currentStep,points:this.points,mode:this.mode,performPointIndex:e,performPoint:this.points[e]})},e.prototype.startPressedMove=function(t){this._prevPressedPoint=c({},t),this._prevPressedPoints=D(this.points)},e.prototype.eventPressedOtherMove=function(t,e){if(null!==this._prevPressedPoint){var i=null;R(t.dataIndex)&&R(this._prevPressedPoint.dataIndex)&&(i=t.dataIndex-this._prevPressedPoint.dataIndex);var n=null;R(t.value)&&R(this._prevPressedPoint.value)&&(n=t.value-this._prevPressedPoint.value),this.points=this._prevPressedPoints.map((function(t){var o;R(t.timestamp)&&(t.dataIndex=e.timestampToDataIndex(t.timestamp));var r=c({},t);return R(i)&&R(t.dataIndex)&&(r.dataIndex=t.dataIndex+i,r.timestamp=null!==(o=e.dataIndexToTimestamp(r.dataIndex))&&void 0!==o?o:void 0),R(n)&&R(t.value)&&(r.value=t.value+n),r}))}},e.extend=function(t){return function(e){function n(){return e.call(this,t)||this}return i(n,e),n}(e)},e}();function lt(t){var e={width:0,height:0,left:0,right:0,top:0,bottom:0};return L(t)&&M(e,t),e}t.FormatDateType=void 0,(rt=t.FormatDateType||(t.FormatDateType={}))[rt.Tooltip=0]="Tooltip",rt[rt.Crosshair=1]="Crosshair",rt[rt.XAxis=2]="XAxis";var ut=-1;function ct(t){return F(window.requestAnimationFrame)?window.requestAnimationFrame(t):window.setTimeout(t,20)}function ht(t){F(window.cancelAnimationFrame)?window.cancelAnimationFrame(t):window.clearTimeout(t)}function dt(t){if(F(window.requestIdleCallback))return window.requestIdleCallback(t);var e=performance.now();return window.setTimeout((function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(performance.now()-e))}})}),1)}var pt,gt=function(){function t(t){this._options={duration:500,iterationCount:1},this._currentIterationCount=0,this._running=!1,this._time=0,M(this._options,t)}return t.prototype._loop=function(){var t=this;this._running=!0;var e=function(){var i;if(t._running){var n=(new Date).getTime()-t._time;n<t._options.duration?(null===(i=t._doFrameCallback)||void 0===i||i.call(t,n),ct(e)):(t.stop(),t._currentIterationCount++,t._currentIterationCount<t._options.iterationCount&&t.start())}};ct(e)},t.prototype.doFrame=function(t){return this._doFrameCallback=t,this},t.prototype.setDuration=function(t){return this._options.duration=t,this},t.prototype.setIterationCount=function(t){return this._options.iterationCount=t,this},t.prototype.start=function(){this._running||(this._time=(new Date).getTime(),this._loop())},t.prototype.stop=function(){var t;this._running&&(null===(t=this._doFrameCallback)||void 0===t||t.call(this,this._options.duration)),this._running=!1},t}(),vt=1,ft=(new Date).getTime();function yt(t){var e=(new Date).getTime();return e===ft?++vt:vt=1,ft=e,"".concat(null!=t?t:"").concat(e,"_").concat(vt)}function mt(t,e){var i,n=document.createElement(t),o=null!=e?e:{};for(var r in o)n.style[r]=null!==(i=o[r])&&void 0!==i?i:"";return n}function _t(t,e,i){var n=0,o=0;for(o=t.length-1;n!==o;){var r=Math.floor((o+n)/2),a=o-n,s=t[r][e];if(i===t[n][e])return n;if(i===t[o][e])return o;if(i===s)return r;if(i>s?n=r:o=r,a<=2)break}return n}function xt(t,e){e=Math.max(0,null!=e?e:0);var i=Math.pow(10,e);return Math.round(t*i)/i}function Ct(t,e,i){for(var n,o,r=[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],a=t.length,s=0;s<a;){var l=t[s];r[0]=Math.max(null!==(n=l[e])&&void 0!==n?n:Number.MIN_SAFE_INTEGER,r[0]),r[1]=Math.min(null!==(o=l[i])&&void 0!==o?o:Number.MAX_SAFE_INTEGER,r[1]),++s}return r}function bt(t){return 0===t?0:Math.log10(t)}function Tt(t){return Math.pow(10,t)}function wt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.join("_")}!function(t){t.Init="init",t.Forward="forward",t.Backward="backward",t.Update="update"}(pt||(pt={}));var St=function(){function t(t){this._requestIdleCallbackId=ut,this._tasks=null!=t?t:[],this._operateTasks()}return t.prototype._operateTasks=function(t){var e,i=this;this._requestIdleCallbackId!==ut&&(e=this._requestIdleCallbackId,F(window.cancelIdleCallback)?window.cancelIdleCallback(e):window.clearTimeout(e),this._requestIdleCallbackId=ut),null==t||t(),this._requestIdleCallbackId=dt((function(t){i._runTasks(t)}))},t.prototype._runTasks=function(t){for(var e=this;t.timeRemaining()>0&&this._tasks.length>0;){var i=this._tasks.shift();null==i||i.handler()}this._tasks.length>0&&(this._requestIdleCallbackId=dt((function(t){e._runTasks(t)})))},t.prototype.addTask=function(t){var e=this;return this._operateTasks((function(){var i=e._tasks.findIndex((function(e){return e.id===t.id}));i>-1?e._tasks[i]=t:e._tasks.push(t)})),this},t.prototype.removeTask=function(t){var e=this;return this._operateTasks((function(){var i=e._tasks.findIndex((function(e){return e.id===t}));i>-1&&e._tasks.splice(i,1)})),this},t}(),Et=31536e3,Pt=2592e3,It=86400,kt=3600,Mt=60,Dt=1;function At(t,e,i,n,o,r){var a;void 0===n&&(n=0);for(var s=null,l=null!=r?r:null,u=0;u<e.length;u++){var c=e[u].timestamp,h=Dt,d=Y(i,c);L(s)&&(h=d.YYYY!==s.YYYY?Et:d.MM!==s.MM?Pt:d.DD!==s.DD?It:d.HH!==s.HH?kt:d.mm!==s.mm?Mt:Dt),R(l)&&R(null==o?void 0:o.value)&&(o.value=Math.min(o.value,c-l));var p=null!==(a=t.get(h))&&void 0!==a?a:[];p.push({dataIndex:u+n,weight:h,timestamp:c}),t.set(h,p),s=d,l=c}}function Ft(t,e){var i=Math.max(Q("0000-00-00 00:00:00",e.size,e.weight,e.family),146);return Math.ceil(i/t)}function Bt(t,e,i){var n=Ft(e,i),o=[];return Array.from(t.keys()).sort((function(t,e){return e-t})).forEach((function(e){var i=t.get(e),r=o;o=[];for(var a=r.length,s=0,l=i.length,u=1/0,c=-1/0,h=0;h<l;h++){for(var d=i[h],p=d.dataIndex;s<a;){var g=r[s],v=g.dataIndex;if(!(v<p)){u=v;break}s++,o.push(g),c=v,u=1/0}u-p>=n&&p-c>=n&&(o.push(d),c=p)}for(;s<a;s++)o.push(r[s])})),o}var Rt={name:"AVP",shortName:"AVP",series:t.IndicatorSeries.Price,precision:2,styles:{lines:[{color:"#A020F0",size:1}]},figures:[{key:"avp",title:"AVP: ",type:"line"}],calc:function(t){var e=0,i=0;return t.map((function(t){var n,o,r={},a=null!==(n=t.turnover)&&void 0!==n?n:0,s=null!==(o=t.volume)&&void 0!==o?o:0;return e+=a,0!==(i+=s)&&(r.avp=e/i),r}))}},Lt={name:"AO",shortName:"AO",calcParams:[5,34],figures:[{key:"ao",title:"AO: ",type:"bar",baseValue:0,styles:function(e){var i,n,o=e.data,r=e.indicator,a=e.defaultStyles,s=o.prev,l=o.current,u=null!==(i=null==s?void 0:s.ao)&&void 0!==i?i:Number.MIN_SAFE_INTEGER,c=null!==(n=null==l?void 0:l.ao)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,h="";return{color:h=c>u?N(r.styles,"bars[0].upColor",a.bars[0].upColor):N(r.styles,"bars[0].downColor",a.bars[0].downColor),style:c>u?t.PolygonType.Stroke:t.PolygonType.Fill,borderColor:h}}}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),o=0,r=0,a=0,s=0;return t.map((function(e,l){var u={},c=(e.low+e.high)/2;if(o+=c,r+=c,l>=i[0]-1){a=o/i[0];var h=t[l-(i[0]-1)];o-=(h.low+h.high)/2}if(l>=i[1]-1){s=r/i[1];h=t[l-(i[1]-1)];r-=(h.low+h.high)/2}return l>=n-1&&(u.ao=a-s),u}))}};var Ot={name:"BOLL",shortName:"BOLL",series:t.IndicatorSeries.Price,calcParams:[20,2],precision:2,shouldOhlc:!0,styles:{lines:[{color:"#FF6E6E",size:1},{color:"#FFD700",size:1},{color:"#00CD00",size:1}]},figures:[{key:"up",title:"UP: ",type:"line"},{key:"mid",title:"MID: ",type:"line"},{key:"dn",title:"DN: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,o=0;return t.map((function(e,r){var a=e.close,s={};if(o+=a,r>=n){s.mid=o/i[0];var l=function(t,e){var i=t.length,n=0;return t.forEach((function(t){var i=t.close-e;n+=i*i})),n=Math.abs(n),Math.sqrt(n/i)}(t.slice(r-n,r+1),s.mid);s.up=s.mid+i[1]*l,s.dn=s.mid-i[1]*l,o-=t[r-n].close}return s}))}},Wt={name:"BBI",shortName:"BBI",series:t.IndicatorSeries.Price,precision:2,calcParams:[3,6,12,24],shouldOhlc:!0,styles:{lines:[{color:"#A020F0"}]},figures:[{key:"bbi",title:"BBI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max.apply(Math,f([],v(i),!1)),o=[],r=[];return t.map((function(e,a){var s={},l=e.close;if(i.forEach((function(e,i){var n;o[i]=(null!==(n=o[i])&&void 0!==n?n:0)+l,a>=e-1&&(r[i]=o[i]/e,o[i]-=t[a-(e-1)].close)})),a>=n-1){var u=0;r.forEach((function(t){u+=t})),s.bbi=u/4}return s}))}},zt={name:"CCI",shortName:"CCI",calcParams:[20],styles:{lines:[{color:"#007FFF",size:1}]},figures:[{key:"cci",title:"CCI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,o=0,r=[];return t.map((function(e,a){var s={},l=(e.high+e.low+e.close)/3;if(o+=l,r.push(l),a>=n){var u=o/i[0],c=r.slice(a-n,a+1),h=0;c.forEach((function(t){h+=Math.abs(t-u)}));var d=h/i[0];s.cci=0!==d?(l-u)/d/.015:0;var p=(t[a-n].high+t[a-n].low+t[a-n].close)/3;o-=p}return s}))}},Vt={name:"CR",shortName:"CR",calcParams:[26,10,20,40,60],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#FFFF00",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"cr",title:"CR: ",type:"line"},{key:"ma1",title:"MA1: ",type:"line"},{key:"ma2",title:"MA2: ",type:"line"},{key:"ma3",title:"MA3: ",type:"line"},{key:"ma4",title:"MA4: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.ceil(i[1]/2.5+1),o=Math.ceil(i[2]/2.5+1),r=Math.ceil(i[3]/2.5+1),a=Math.ceil(i[4]/2.5+1),s=0,l=[],u=0,c=[],h=0,d=[],p=0,g=[],v=[];return t.forEach((function(e,f){var y,m,_,x,C,b={},T=null!==(y=t[f-1])&&void 0!==y?y:e,w=(T.high+T.close+T.low+T.open)/4,S=Math.max(0,e.high-w),E=Math.max(0,w-e.low);f>=i[0]-1&&(b.cr=0!==E?S/E*100:0,s+=b.cr,u+=b.cr,h+=b.cr,p+=b.cr,f>=i[0]+i[1]-2&&(l.push(s/i[1]),f>=i[0]+i[1]+n-3&&(b.ma1=l[l.length-1-n]),s-=null!==(m=v[f-(i[1]-1)].cr)&&void 0!==m?m:0),f>=i[0]+i[2]-2&&(c.push(u/i[2]),f>=i[0]+i[2]+o-3&&(b.ma2=c[c.length-1-o]),u-=null!==(_=v[f-(i[2]-1)].cr)&&void 0!==_?_:0),f>=i[0]+i[3]-2&&(d.push(h/i[3]),f>=i[0]+i[3]+r-3&&(b.ma3=d[d.length-1-r]),h-=null!==(x=v[f-(i[3]-1)].cr)&&void 0!==x?x:0),f>=i[0]+i[4]-2&&(g.push(p/i[4]),f>=i[0]+i[4]+a-3&&(b.ma4=g[g.length-1-a]),p-=null!==(C=v[f-(i[4]-1)].cr)&&void 0!==C?C:0)),v.push(b)})),v}},Nt={name:"DMA",shortName:"DMA",calcParams:[10,50,10],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"dma",title:"DMA: ",type:"line"},{key:"ama",title:"AMA: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),o=0,r=0,a=0,s=[];return t.forEach((function(e,l){var u,c={},h=e.close;o+=h,r+=h;var d=0,p=0;if(l>=i[0]-1&&(d=o/i[0],o-=t[l-(i[0]-1)].close),l>=i[1]-1&&(p=r/i[1],r-=t[l-(i[1]-1)].close),l>=n-1){var g=d-p;c.dma=g,a+=g,l>=n+i[2]-2&&(c.ama=a/i[2],a-=null!==(u=s[l-(i[2]-1)].dma)&&void 0!==u?u:0)}s.push(c)})),s}},Yt={name:"DMI",shortName:"DMI",calcParams:[14,6],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"pdi",title:"PDI: ",type:"line"},{key:"mdi",title:"MDI: ",type:"line"},{key:"adx",title:"ADX: ",type:"line"},{key:"adxr",title:"ADXR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=0,l=0,u=0,c=0,h=[];return t.forEach((function(e,d){var p,g,v={},f=null!==(p=t[d-1])&&void 0!==p?p:e,y=f.close,m=e.high,_=e.low,x=m-_,C=Math.abs(m-y),b=Math.abs(y-_),T=m-f.high,w=f.low-_,S=Math.max(Math.max(x,C),b),E=T>0&&T>w?T:0,P=w>0&&w>T?w:0;if(n+=S,o+=E,r+=P,d>=i[0]-1){d>i[0]-1?(a=a-a/i[0]+S,s=s-s/i[0]+E,l=l-l/i[0]+P):(a=n,s=o,l=r);var I=0,k=0;0!==a&&(I=100*s/a,k=100*l/a),v.pdi=I,v.mdi=k;var M=0;k+I!==0&&(M=Math.abs(k-I)/(k+I)*100),u+=M,d>=2*i[0]-2&&(c=d>2*i[0]-2?(c*(i[0]-1)+M)/i[0]:u/i[0],v.adx=c,d>=2*i[0]+i[1]-3&&(v.adxr=((null!==(g=h[d-(i[1]-1)].adx)&&void 0!==g?g:0)+c)/2))}h.push(v)})),h}},Ht={name:"EMA",shortName:"EMA",series:t.IndicatorSeries.Price,calcParams:[6,12,20],styles:{lines:[{color:"#FF6E6E",size:1},{color:"#FFD700",size:1},{color:"#00CD00",size:1}]},precision:2,shouldOhlc:!0,figures:[{key:"ema1",title:"EMA6: ",type:"line"},{key:"ema2",title:"EMA12: ",type:"line"},{key:"ema3",title:"EMA20: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"ema".concat(e+1),title:"EMA".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=0,r=[];return t.map((function(t,e){var a={},s=t.close;return o+=s,i.forEach((function(t,i){e>=t-1&&(r[i]=e>t-1?(2*s+(t-1)*r[i])/(t+1):o/t,a[n[i].key]=r[i])})),a}))}},Xt={name:"MA",shortName:"MA",series:t.IndicatorSeries.Price,calcParams:[5,10,30,60],precision:2,shouldOhlc:!0,figures:[{key:"ma1",title:"MA5: ",type:"line"},{key:"ma2",title:"MA10: ",type:"line"},{key:"ma3",title:"MA30: ",type:"line"},{key:"ma4",title:"MA60: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=[];return t.map((function(e,r){var a={},s=e.close;return i.forEach((function(e,i){var l;o[i]=(null!==(l=o[i])&&void 0!==l?l:0)+s,r>=e-1&&(a[n[i].key]=o[i]/e,o[i]-=t[r-(e-1)].close)})),a}))}},Gt={name:"MACD",shortName:"MACD",calcParams:[12,26,9],figures:[{key:"dif",title:"DIF: ",type:"line"},{key:"dea",title:"DEA: ",type:"line"},{key:"macd",title:"MACD: ",type:"bar",baseValue:0,styles:function(e){var i,n,o=e.data,r=e.indicator,a=e.defaultStyles,s=o.prev,l=o.current,u=null!==(i=null==s?void 0:s.macd)&&void 0!==i?i:Number.MIN_SAFE_INTEGER,c=null!==(n=null==l?void 0:l.macd)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,h="";return h=c>0?N(r.styles,"bars[0].upColor",a.bars[0].upColor):c<0?N(r.styles,"bars[0].downColor",a.bars[0].downColor):N(r.styles,"bars[0].noChangeColor",a.bars[0].noChangeColor),{style:u<c?t.PolygonType.Stroke:t.PolygonType.Fill,color:h,borderColor:h}}}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=0,l=0,u=Math.max(i[0],i[1]);return t.map((function(t,e){var c={},h=t.close;return n+=h,e>=i[0]-1&&(o=e>i[0]-1?(2*h+(i[0]-1)*o)/(i[0]+1):n/i[0]),e>=i[1]-1&&(r=e>i[1]-1?(2*h+(i[1]-1)*r)/(i[1]+1):n/i[1]),e>=u-1&&(a=o-r,c.dif=a,s+=a,e>=u+i[2]-2&&(l=e>u+i[2]-2?(2*a+l*(i[2]-1))/(i[2]+1):s/i[2],c.macd=2*(a-l),c.dea=l)),c}))}},Kt={name:"RSI",shortName:"RSI",calcParams:[6,12,24],figures:[{key:"rsi1",title:"RSI1: ",type:"line"},{key:"rsi2",title:"RSI2: ",type:"line"},{key:"rsi3",title:"RSI3: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){var i=e+1;return{key:"rsi".concat(i),title:"RSI".concat(i,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i,r=[],a=[];return t.map((function(e,i){var s,l={},u=(null!==(s=t[i-1])&&void 0!==s?s:e).close,c=e.close-u;return o.forEach((function(e,o){var s,u,h;if(c>0?r[o]=(null!==(s=r[o])&&void 0!==s?s:0)+c:a[o]=(null!==(u=a[o])&&void 0!==u?u:0)+Math.abs(c),i>=e-1){0!==a[o]?l[n[o].key]=100-100/(1+r[o]/a[o]):l[n[o].key]=0;var d=t[i-(e-1)],p=null!==(h=t[i-e])&&void 0!==h?h:d,g=d.close-p.close;g>0?r[o]-=g:a[o]-=Math.abs(g)}})),l}))}},Ut={name:"SMA",shortName:"SMA",series:t.IndicatorSeries.Price,calcParams:[12,2],precision:2,styles:{lines:[{color:"#A020F0"}]},figures:[{key:"sma",title:"SMA: ",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams,n=0,o=0;return t.map((function(t,e){var r={},a=t.close;return n+=a,e>=i[0]-1&&(o=e>i[0]-1?(a*i[1]+o*(i[0]-i[1]+1))/(i[0]+1):n/i[0],r.sma=o),r}))}},jt={name:"KDJ",shortName:"KDJ",calcParams:[9,3,3],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"k",title:"K: ",type:"line"},{key:"d",title:"D: ",type:"line"},{key:"j",title:"J: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=[];return t.forEach((function(e,o){var r,a,s,l,u={},c=e.close;if(o>=i[0]-1){var h=Ct(t.slice(o-(i[0]-1),o+1),"high","low"),d=h[0],p=h[1],g=d-p,v=(c-p)/(0===g?1:g)*100;u.k=((i[1]-1)*(null!==(a=null===(r=n[o-1])||void 0===r?void 0:r.k)&&void 0!==a?a:50)+v)/i[1],u.d=((i[2]-1)*(null!==(l=null===(s=n[o-1])||void 0===s?void 0:s.d)&&void 0!==l?l:50)+u.k)/i[2],u.j=3*u.k-2*u.d}n.push(u)})),n}},Zt={name:"SAR",shortName:"SAR",series:t.IndicatorSeries.Price,calcParams:[2,2,20],precision:2,shouldOhlc:!0,styles:{circles:[{upColor:"#FF7F50",downColor:"#A020F0",noChangeColor:"#A8A8A8"}]},figures:[{key:"sar",title:"SAR: ",type:"circle",styles:function(t){var e,i,n,o=t.data,r=t.indicator,a=t.defaultStyles,s=o.current;return{color:(null!==(e=null==s?void 0:s.sar)&&void 0!==e?e:Number.MIN_SAFE_INTEGER)<((null!==(i=null==s?void 0:s.high)&&void 0!==i?i:0)+(null!==(n=null==s?void 0:s.low)&&void 0!==n?n:0))/2?N(r.styles,"circles[0].upColor",a.circles[0].upColor):N(r.styles,"circles[0].downColor",a.circles[0].downColor)}}}],calc:function(t,e){var i=e.calcParams,n=i[0]/100,o=i[1]/100,r=i[2]/100,a=n,s=-100,l=!1,u=0;return t.map((function(e,i){var c=u,h=e.high,d=e.low;if(l){(-100===s||s<h)&&(s=h,a=Math.min(a+o,r)),u=c+a*(s-c);var p=Math.min(t[Math.max(1,i)-1].low,d);u>e.low?(u=s,a=n,s=-100,l=!l):u>p&&(u=p)}else{(-100===s||s>d)&&(s=d,a=Math.min(a+o,r)),u=c+a*(s-c);var g=Math.max(t[Math.max(1,i)-1].high,h);u<e.high?(u=s,a=0,s=-100,l=!l):u<g&&(u=g)}return{high:h,low:d,sar:u}}))}};function qt(){return{key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t){var e=t.data,i=t.indicator,n=t.defaultStyles,o=e.current,r=N(i.styles,"bars[0].noChangeColor",n.bars[0].noChangeColor);return L(o)&&(o.close>o.open?r=N(i.styles,"bars[0].upColor",n.bars[0].upColor):o.close<o.open&&(r=N(i.styles,"bars[0].downColor",n.bars[0].downColor))),{color:r}}}}var Jt={name:"VOL",shortName:"VOL",series:t.IndicatorSeries.Volume,calcParams:[5,10,20],shouldFormatBigNumber:!0,precision:0,minValue:0,figures:[{key:"ma1",title:"MA5: ",type:"line"},{key:"ma2",title:"MA10: ",type:"line"},{key:"ma3",title:"MA20: ",type:"line"},qt()],regenerateFigures:function(t){var e=t.map((function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}}));return e.push(qt()),e},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i,r=[];return t.map((function(e,i){var a,s=null!==(a=e.volume)&&void 0!==a?a:0,l={volume:s,open:e.open,close:e.close};return o.forEach((function(e,o){var a,u;r[o]=(null!==(a=r[o])&&void 0!==a?a:0)+s,i>=e-1&&(l[n[o].key]=r[o]/e,r[o]-=null!==(u=t[i-(e-1)].volume)&&void 0!==u?u:0)})),l}))}},Qt={name:"WR",shortName:"WR",calcParams:[6,10,14],styles:{lines:[{color:"#A020F0",size:1},{color:"#FFD700",size:1},{color:"#FF6E6E",size:1}]},figures:[{key:"wr1",title:"WR1: ",type:"line"},{key:"wr2",title:"WR2: ",type:"line"},{key:"wr3",title:"WR3: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"wr".concat(e+1),title:"WR".concat(e+1,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i;return t.map((function(e,i){var r={},a=e.close;return o.forEach((function(e,o){var s=e-1;if(i>=s){var l=Ct(t.slice(i-s,i+1),"high","low"),u=l[0],c=u-l[1];r[n[o].key]=0===c?0:(a-u)/c*100}})),r}))}},$t={},te=[Rt,Lt,{name:"BIAS",shortName:"BIAS",calcParams:[6,12,24],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#ff0000",size:1}]},figures:[{key:"bias1",title:"BIAS6: ",type:"line"},{key:"bias2",title:"BIAS12: ",type:"line"},{key:"bias3",title:"BIAS24: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"bias".concat(e+1),title:"BIAS".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i,r=[];return t.map((function(e,i){var a={},s=e.close;return o.forEach((function(e,l){var u;if(r[l]=(null!==(u=r[l])&&void 0!==u?u:0)+s,i>=e-1){var c=r[l]/o[l];a[n[l].key]=(s-c)/c*100,r[l]-=t[i-(e-1)].close}})),a}))}},Ot,{name:"BRAR",shortName:"BRAR",calcParams:[26],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"br",title:"BR: ",type:"line"},{key:"ar",title:"AR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0;return t.map((function(e,s){var l,u,c={},h=e.high,d=e.low,p=e.open,g=(null!==(l=t[s-1])&&void 0!==l?l:e).close;if(r+=h-p,a+=p-d,n+=h-g,o+=g-d,s>=i[0]-1){c.ar=0!==a?r/a*100:0,c.br=0!==o?n/o*100:0;var v=t[s-(i[0]-1)],f=v.high,y=v.low,m=v.open,_=(null!==(u=t[s-i[0]])&&void 0!==u?u:t[s-(i[0]-1)]).close;n-=f-_,o-=_-y,r-=f-m,a-=m-y}return c}))}},Wt,zt,Vt,Nt,Yt,{name:"EMV",shortName:"EMV",calcParams:[14,9],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"emv",title:"EMV: ",type:"line"},{key:"maEmv",title:"MAEMV: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=[];return t.map((function(e,r){var a,s={};if(r>0){var l=t[r-1],u=e.high,c=e.low,h=null!==(a=e.volume)&&void 0!==a?a:0,d=(u+c)/2-(l.high+l.low)/2;if(0===h||u-c==0)s.emv=0;else{var p=h/1e8/(u-c);s.emv=d/p}n+=s.emv,o.push(s.emv),r>=i[0]&&(s.maEmv=n/i[0],n-=o[r-i[0]])}return s}))}},Ht,{name:"MTM",shortName:"MTM",calcParams:[12,6],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"mtm",title:"MTM: ",type:"line"},{key:"maMtm",title:"MAMTM: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=[];return t.forEach((function(e,r){var a,s={};if(r>=i[0]){var l=e.close,u=t[r-i[0]].close;s.mtm=l-u,n+=s.mtm,r>=i[0]+i[1]-1&&(s.maMtm=n/i[1],n-=null!==(a=o[r-(i[1]-1)].mtm)&&void 0!==a?a:0)}o.push(s)})),o}},Xt,Gt,{name:"OBV",shortName:"OBV",calcParams:[30],styles:{lines:[{color:"#A020F0",size:1},{color:"#007FFF",size:1}]},figures:[{key:"obv",title:"OBV: ",type:"line"},{key:"maObv",title:"MAOBV: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=[];return t.forEach((function(e,a){var s,l,u,c,h=null!==(s=t[a-1])&&void 0!==s?s:e;e.close<h.close?o-=null!==(l=e.volume)&&void 0!==l?l:0:e.close>h.close&&(o+=null!==(u=e.volume)&&void 0!==u?u:0);var d={obv:o};n+=o,a>=i[0]-1&&(d.maObv=n/i[0],n-=null!==(c=r[a-(i[0]-1)].obv)&&void 0!==c?c:0),r.push(d)})),r}},{name:"PVT",shortName:"PVT",styles:{lines:[{color:"#ff0000",size:1}]},figures:[{key:"pvt",title:"PVT: ",type:"line"}],calc:function(t){var e=0;return t.map((function(i,n){var o,r,a={},s=i.close,l=null!==(o=i.volume)&&void 0!==o?o:1,u=(null!==(r=t[n-1])&&void 0!==r?r:i).close,c=0,h=u*l;return 0!==h&&(c=(s-u)/h),e+=c,a.pvt=e,a}))}},{name:"PSY",shortName:"PSY",calcParams:[12,6],styles:{lines:[{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"psy",title:"PSY: ",type:"line"},{key:"maPsy",title:"MAPSY: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=[],a=[];return t.forEach((function(e,s){var l,u,c={},h=(null!==(l=t[s-1])&&void 0!==l?l:e).close,d=e.close-h>0?1:0;r.push(d),n+=d,s>=i[0]-1&&(c.psy=n/i[0]*100,o+=c.psy,s>=i[0]+i[1]-2&&(c.maPsy=o/i[1],o-=null!==(u=a[s-(i[1]-1)].psy)&&void 0!==u?u:0),n-=r[s-(i[0]-1)]),a.push(c)})),a}},{name:"ROC",shortName:"ROC",calcParams:[12,6],styles:{lines:[{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"roc",title:"ROC: ",type:"line"},{key:"maRoc",title:"MAROC: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=[],o=0;return t.forEach((function(e,r){var a,s,l={};if(r>=i[0]-1){var u=e.close,c=(null!==(a=t[r-i[0]])&&void 0!==a?a:t[r-(i[0]-1)]).close;l.roc=0!==c?(u-c)/c*100:0,o+=l.roc,r>=i[0]-1+i[1]-1&&(l.maRoc=o/i[1],o-=null!==(s=n[r-(i[1]-1)].roc)&&void 0!==s?s:0)}n.push(l)})),n}},Kt,Ut,jt,Zt,{name:"TRIX",shortName:"TRIX",calcParams:[12,9],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"trix",title:"TRIX: ",type:"line"},{key:"maTrix",title:"MATRIX: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=0,l=0,u=0,c=[];return t.forEach((function(t,e){var h,d={},p=t.close;if(n+=p,e>=i[0]-1&&(o=e>i[0]-1?(2*p+(i[0]-1)*o)/(i[0]+1):n/i[0],s+=o,e>=2*i[0]-2&&(r=e>2*i[0]-2?(2*o+(i[0]-1)*r)/(i[0]+1):s/i[0],l+=r,e>=3*i[0]-3))){var g=0,v=0;e>3*i[0]-3?v=((g=(2*r+(i[0]-1)*a)/(i[0]+1))-a)/a*100:g=l/i[0],a=g,d.trix=v,u+=v,e>=3*i[0]+i[1]-4&&(d.maTrix=u/i[1],u-=null!==(h=c[e-(i[1]-1)].trix)&&void 0!==h?h:0)}c.push(d)})),c}},Jt,{name:"VR",shortName:"VR",calcParams:[26,6],styles:{lines:[{color:"#FF6E6E",size:2},{color:"#FFD700",size:4}]},figures:[{key:"vr",title:"VR: ",type:"line"},{key:"maVr",title:"MAVR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=[];return t.forEach((function(e,l){var u,c,h,d,p,g={},v=e.close,f=(null!==(u=t[l-1])&&void 0!==u?u:e).close,y=null!==(c=e.volume)&&void 0!==c?c:0;if(v>f?n+=y:v<f?o+=y:r+=y,l>=i[0]-1){var m=r/2;g.vr=o+m===0?0:(n+m)/(o+m)*100,a+=g.vr,l>=i[0]+i[1]-2&&(g.maVr=a/i[1],a-=null!==(h=s[l-(i[1]-1)].vr)&&void 0!==h?h:0);var _=t[l-(i[0]-1)],x=null!==(d=t[l-i[0]])&&void 0!==d?d:_,C=_.close,b=null!==(p=_.volume)&&void 0!==p?p:0;C>x.close?n-=b:C<x.close?o-=b:r-=b}s.push(g)})),s}},Qt];function ee(t){var e;return null!==(e=$t[t])&&void 0!==e?e:null}te.forEach((function(t){$t[t.name]=ot.extend(t)}));var ie={name:"fibonacciLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,i,n=t.chart,o=t.coordinates,r=t.bounding,a=t.overlay,s=t.yAxis,l=a.points;if(o.length>0){var u=0;if(null===(e=null==s?void 0:s.isInCandle())||void 0===e||e)u=n.getPrecision().price;else(null!==(i=n.getIndicators({paneId:a.paneId}).get(a.paneId))&&void 0!==i?i:[]).forEach((function(t){u=Math.max(u,t.precision)}));var c=[],h=[],d=r.width;if(o.length>1&&R(l[0].value)&&R(l[1].value)){var p=o[0].y-o[1].y,g=l[0].value-l[1].value;[1,.786,.618,.5,.382,.236,0].forEach((function(t){var e,i=o[1].y+p*t,r=n.getDecimalFold().format(n.getThousandsSeparator().format(((null!==(e=l[1].value)&&void 0!==e?e:0)+g*t).toFixed(u)));c.push({coordinates:[{x:0,y:i},{x:d,y:i}]}),h.push({x:0,y:i,text:"".concat(r," (").concat((100*t).toFixed(1),"%)"),baseline:"bottom"})}))}return[{type:"line",attrs:c},{type:"text",isCheckEvent:!1,attrs:h}]}return[]}},ne={name:"horizontalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n={x:0,y:e[0].y};return L(e[1])&&e[0].x<e[1].x&&(n.x=i.width),[{type:"line",attrs:{coordinates:[e[0],n]}}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},oe=function(){function t(){this._children=[],this._callbacks=new Map}return t.prototype.registerEvent=function(t,e){return this._callbacks.set(t,e),this},t.prototype.onEvent=function(t,e,i){var n=this._callbacks.get(t);return!(!L(n)||!this.checkEventOn(e))&&n(e,i)},t.prototype.checkEventOn=function(t){var e,i;try{for(var n=g(this._children),o=n.next();!o.done;o=n.next()){if(o.value.checkEventOn(t))return!0}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}return!1},t.prototype.dispatchEvent=function(t,e,i){var n=this._children.length-1;if(n>-1)for(var o=n;o>-1;o--)if(this._children[o].dispatchEvent(t,e,i))return!0;return this.onEvent(t,e,i)},t.prototype.addChild=function(t){return this._children.push(t),this},t.prototype.clear=function(){this._children=[]},t}(),re=function(t){function e(e){var i=t.call(this)||this;return i.attrs=e.attrs,i.styles=e.styles,i}return i(e,t),e.prototype.checkEventOn=function(t){return this.checkEventOnImp(t,this.attrs,this.styles)},e.prototype.setAttrs=function(t){return this.attrs=t,this},e.prototype.setStyles=function(t){return this.styles=t,this},e.prototype.draw=function(t){this.drawImp(t,this.attrs,this.styles)},e.extend=function(t){var n=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.checkEventOnImp=function(e,i,n){return t.checkEventOn(e,i,n)},n.prototype.drawImp=function(e,i,n){t.draw(e,i,n)},n}(e);return n},e}(oe);function ae(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value.coordinates;if(s.length>1)for(var l=1;l<s.length;l++){var u=s[l-1],c=s[l];if(u.x===c.x){if(Math.abs(u.y-t.y)+Math.abs(c.y-t.y)-Math.abs(u.y-c.y)<4&&Math.abs(t.x-u.x)<2)return!0}else{var h=ue(u,c),d=se(h,t),p=Math.abs(d-t.y);if(Math.abs(u.x-t.x)+Math.abs(c.x-t.x)-Math.abs(u.x-c.x)<4&&p*p/(h[0]*h[0]+1)<4)return!0}}}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}function se(t,e){return null!==t?e.x*t[0]+t[1]:e.y}function le(t,e,i){return se(ue(t,e),i)}function ue(t,e){var i=t.x-e.x;if(0!==i){var n=(t.y-e.y)/i;return[n,t.y-n*t.x]}return null}function ce(t,e,i){var n=e.length,o=R(i)?i>0&&i<1?i:0:i?.5:0;if(o>0&&n>2){for(var r=e[0].x,a=e[0].y,s=1;s<n-1;s++){var l=e[s-1],u=e[s],c=e[s+1],h=u.x-l.x,d=u.y-l.y,p=c.x-u.x,g=c.y-u.y,v=c.x-l.x,f=c.y-l.y,y=Math.sqrt(h*h+d*d),m=Math.sqrt(p*p+g*g),_=m/(m+y),x=u.x+v*o*_,C=u.y+f*o*_;x=Math.min(x,Math.max(c.x,u.x)),C=Math.min(C,Math.max(c.y,u.y)),x=Math.max(x,Math.min(c.x,u.x)),C=Math.max(C,Math.min(c.y,u.y)),v=x-u.x,f=C-u.y;var b=u.x-v*y/m,T=u.y-f*y/m;b=Math.min(b,Math.max(l.x,u.x)),T=Math.min(T,Math.max(l.y,u.y)),b=Math.max(b,Math.min(l.x,u.x)),T=Math.max(T,Math.min(l.y,u.y)),v=u.x-b,f=u.y-T,x=u.x+v*m/y,C=u.y+f*m/y,t.bezierCurveTo(r,a,b,T,u.x,u.y),r=x,a=C}var w=e[n-1];t.bezierCurveTo(r,a,w.x,w.y,w.x,w.y)}else for(s=1;s<n;s++)t.lineTo(e[s].x,e[s].y)}var he={name:"line",checkEventOn:ae,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.LineType.Solid:r,s=n.smooth,l=void 0!==s&&s,u=n.size,c=void 0===u?1:u,h=n.color,d=void 0===h?"currentColor":h,p=n.dashedValue,g=void 0===p?[2,2]:p;e.lineWidth=c,e.strokeStyle=d,a===t.LineType.Dashed?e.setLineDash(g):e.setLineDash([]);var v=c%2==1?.5:0;o.forEach((function(t){var i=t.coordinates;i.length>1&&(2!==i.length||i[0].x!==i[1].x&&i[0].y!==i[1].y?(e.save(),c%2==1&&e.translate(.5,.5),e.beginPath(),e.moveTo(i[0].x,i[0].y),ce(e,i,l),e.stroke(),e.closePath(),e.restore()):(e.beginPath(),i[0].x===i[1].x?(e.moveTo(i[0].x+v,i[0].y),e.lineTo(i[1].x+v,i[1].y)):(e.moveTo(i[0].x,i[0].y+v),e.lineTo(i[1].x,i[1].y+v)),e.stroke(),e.closePath()))}))}(e,i,n)}};function de(t,e,i){var n=null!=i?i:0,o=[];if(t.length>1)if(t[0].x===t[1].x){var r=e.height;if(o.push({coordinates:[{x:t[0].x,y:0},{x:t[0].x,y:r}]}),t.length>2){o.push({coordinates:[{x:t[2].x,y:0},{x:t[2].x,y:r}]});for(var a=t[0].x-t[2].x,s=0;s<n;s++){var l=a*(s+1);o.push({coordinates:[{x:t[0].x+l,y:0},{x:t[0].x+l,y:r}]})}}}else{var u=e.width,c=ue(t[0],t[1]),h=c[0],d=c[1];if(o.push({coordinates:[{x:0,y:0*h+d},{x:u,y:u*h+d}]}),t.length>2){var p=t[2].y-h*t[2].x;o.push({coordinates:[{x:0,y:0*h+p},{x:u,y:u*h+p}]});for(a=d-p,s=0;s<n;s++){var g=d+a*(s+1);o.push({coordinates:[{x:0,y:0*h+g},{x:u,y:u*h+g}]})}}}return o}var pe={name:"parallelStraightLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:de(t.coordinates,t.bounding)}]}},ge={name:"priceChannelLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:de(t.coordinates,t.bounding,1)}]}},ve={name:"priceLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,i,n=t.chart,o=t.coordinates,r=t.bounding,a=t.overlay,s=t.yAxis,l=0;null===(e=null==s?void 0:s.isInCandle())||void 0===e||e?l=n.getPrecision().price:(null!==(i=n.getIndicators({paneId:a.paneId}).get(a.paneId))&&void 0!==i?i:[]).forEach((function(t){l=Math.max(l,t.precision)}));var u=a.points[0].value,c=void 0===u?0:u;return[{type:"line",attrs:{coordinates:[o[0],{x:r.width,y:o[0].y}]}},{type:"text",ignoreEvent:!0,attrs:{x:o[0].x,y:o[0].y,text:n.getDecimalFold().format(n.getThousandsSeparator().format(c.toFixed(l))),baseline:"bottom"}}]}};function fe(t,e){if(t.length>1){var i={x:0,y:0};return i=t[0].x===t[1].x&&t[0].y!==t[1].y?t[0].y<t[1].y?{x:t[0].x,y:e.height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:le(t[0],t[1],{x:0,y:t[0].y})}:{x:e.width,y:le(t[0],t[1],{x:e.width,y:t[0].y})},{coordinates:[t[0],i]}}return[]}var ye={name:"rayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:fe(t.coordinates,t.bounding)}]}},me={name:"straightLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return 2===e.length?e[0].x===e[1].x?[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]:[{type:"line",attrs:{coordinates:[{x:0,y:le(e[0],e[1],{x:0,y:e[0].y})},{x:i.width,y:le(e[0],e[1],{x:i.width,y:e[0].y})}]}}]:[]}},_e={name:"simpleAnnotation",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e,i=t.overlay,n=t.coordinates,o="";L(i.extendData)&&(o=F(i.extendData)?i.extendData(i):null!==(e=i.extendData)&&void 0!==e?e:"");var r=n[0].x,a=n[0].y-6,s=a-50,l=s-5;return[{type:"line",attrs:{coordinates:[{x:r,y:a},{x:r,y:s}]},ignoreEvent:!0},{type:"polygon",attrs:{coordinates:[{x:r,y:s},{x:r-4,y:l},{x:r+4,y:l}]},ignoreEvent:!0},{type:"text",attrs:{x:r,y:l,text:o,align:"center",baseline:"bottom"},ignoreEvent:!0}]}},xe={name:"simpleTag",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e=t.bounding,i=t.coordinates;return{type:"line",attrs:{coordinates:[{x:0,y:i[0].y},{x:e.width,y:i[0].y}]},ignoreEvent:!0}},createYAxisFigures:function(t){var e,i,n=t.chart,o=t.overlay,r=t.coordinates,a=t.bounding,s=t.yAxis,l="left",u=0;null!==(e=null==s?void 0:s.isFromZero())&&void 0!==e&&e?(l="left",u=0):(l="right",u=a.width);var c="";return L(o.extendData)&&(c=F(o.extendData)?o.extendData(o):null!==(i=o.extendData)&&void 0!==i?i:""),!L(c)&&R(o.points[0].value)&&(c=X(o.points[0].value,n.getPrecision().price)),{type:"text",attrs:{x:u,y:r[0].y,text:c,align:l,baseline:"middle"}}}},Ce={};function be(t){var e;return null!==(e=Ce[t])&&void 0!==e?e:null}[ie,ne,{name:"horizontalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=[];return 2===e.length&&i.push({coordinates:e}),[{type:"line",attrs:i}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},{name:"horizontalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:0,y:e[0].y},{x:i.width,y:e[0].y}]}}]}},pe,ge,ve,ye,{name:"segment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]}},me,{name:"verticalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;if(2===e.length){var n={x:e[0].x,y:0};return e[0].y<e[1].y&&(n.y=i.height),[{type:"line",attrs:{coordinates:[e[0],n]}}]}return[]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex,e[1].timestamp=i.timestamp,e[1].dataIndex=i.dataIndex},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.dataIndex)}},{name:"verticalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex,e[1].timestamp=i.timestamp,e[1].dataIndex=i.dataIndex},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.dataIndex)}},{name:"verticalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]}},_e,xe].forEach((function(t){Ce[t.name]=st.extend(t)}));var Te={light:{grid:{horizontal:{color:"#EDEDED"},vertical:{color:"#EDEDED"}},candle:{priceMark:{high:{color:"#76808F"},low:{color:"#76808F"}},tooltip:{rect:{color:"#FEFEFE",borderColor:"#F2F3F5"},text:{color:"#76808F"}}},indicator:{tooltip:{text:{color:"#76808F"}}},xAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},yAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},separator:{color:"#DDDDDD"},crosshair:{horizontal:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}},vertical:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}}}},dark:{grid:{horizontal:{color:"#292929"},vertical:{color:"#292929"}},candle:{priceMark:{high:{color:"#929AA5"},low:{color:"#929AA5"}},tooltip:{rect:{color:"rgba(10, 10, 10, .6)",borderColor:"rgba(10, 10, 10, .6)"},text:{color:"#929AA5"}}},indicator:{tooltip:{text:{color:"#929AA5"}}},xAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},yAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},separator:{color:"#333333"},crosshair:{horizontal:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}},vertical:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}}}}};function we(t){var e;return null!==(e=Te[t])&&void 0!==e?e:null}var Se="candle_pane",Ee="indicator_pane_",Pe="x_axis_pane",Ie=1,ke=50,Me=function(){function e(e,i){var n,o,r,a,s=this;this._styles={grid:P(),candle:(a={show:!0,color:w,textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"},{type:t.CandleType.CandleSolid,bar:{upColor:_,downColor:y,noChangeColor:C,upBorderColor:_,downBorderColor:y,noChangeBorderColor:C,upWickColor:_,downWickColor:y,noChangeWickColor:C},area:{lineSize:2,lineColor:T,smooth:!1,value:"close",backgroundColor:[{offset:0,color:E(.01)},{offset:1,color:E(.2)}],point:{show:!0,color:T,radius:4,rippleColor:E(.3),rippleRadius:8,animation:!0,animationDuration:1e3}},priceMark:{show:!0,high:c({},a),low:c({},a),last:{show:!0,upColor:_,downColor:y,noChangeColor:C,line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,4],size:1},text:{show:!0,style:t.PolygonType.Fill,size:12,paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderColor:"transparent",borderStyle:t.LineType.Solid,borderSize:0,borderDashedValue:[2,2],color:b,family:"Helvetica Neue",weight:"normal",borderRadius:2}}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,custom:[{title:"time",value:"{time}"},{title:"open",value:"{open}"},{title:"high",value:"{high}"},{title:"low",value:"{low}"},{title:"close",value:"{close}"},{title:"volume",value:"{volume}"}],defaultValue:"n/a",rect:{position:t.CandleTooltipRectPosition.Fixed,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,offsetLeft:4,offsetTop:4,offsetRight:4,offsetBottom:4,borderRadius:4,borderSize:1,borderColor:"#F2F3F5",color:"#FEFEFE"},text:{size:12,family:"Helvetica Neue",weight:"normal",color:w,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]}}),indicator:(r=["#FF9600","#935EBD",T,"#E11D74","#01C5C4"].map((function(e){return{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:e}})),{ohlc:{upColor:x,downColor:m,noChangeColor:C},bars:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:x,downColor:m,noChangeColor:C}],lines:r,circles:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:x,downColor:m,noChangeColor:C}],lastValueMark:{show:!1,text:{show:!1,style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderColor:"transparent",borderSize:0,borderDashedValue:[2,2],paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderRadius:2}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:"Helvetica Neue",weight:"normal",color:w,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]}}),xAxis:I(),yAxis:I(),separator:{size:1,color:S,fill:!0,activeBackgroundColor:E(.08)},crosshair:k(),overlay:(n=E(.35),o=E(.25),{point:{color:T,borderColor:n,borderSize:1,radius:5,activeColor:T,activeBorderColor:n,activeBorderSize:3,activeRadius:5},line:{style:t.LineType.Solid,smooth:!1,color:T,size:1,dashedValue:[2,2]},rect:{style:t.PolygonType.Fill,color:o,borderColor:T,borderSize:1,borderRadius:0,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},polygon:{style:t.PolygonType.Fill,color:T,borderColor:T,borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},circle:{style:t.PolygonType.Fill,color:o,borderColor:T,borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},arc:{style:t.LineType.Solid,color:T,size:1,dashedValue:[2,2]},text:{style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:T,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:T}})},this._customApi={formatDate:function(t,e){return H(s._dateTimeFormat,t,e)},formatBigNumber:G},this._locale="en-US",this._thousandsSeparator={sign:",",format:function(t){return K(t,s._thousandsSeparator.sign)}},this._decimalFold={threshold:3,format:function(t){return U(t,s._decimalFold.threshold)}},this._precision={price:2,volume:0},this._dataList=[],this._loadMoreDataCallback=null,this._loading=!0,this._loadDataMore={forward:!1,backward:!1},this._zoomEnabled=!0,this._scrollEnabled=!0,this._totalBarSpace=0,this._barSpace=10,this._offsetRightDistance=80,this._startLastBarRightSideDiffBarCount=0,this._scrollLimitRole=0,this._minVisibleBarCount={left:2,right:2},this._maxOffsetDistance={left:50,right:50},this._visibleRange={from:0,to:0,realFrom:0,realTo:0},this._timeWeightTickMap=new Map,this._timeWeightTickList=[],this._minTimeDifference=Number.MAX_SAFE_INTEGER,this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}],this._crosshair={},this._activeTooltipIcon=null,this._actions=new Map,this._indicators=new Map,this._taskScheduler=new St,this._overlays=new Map,this._progressOverlayInfo=null,this._pressedOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._hoverOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._clickOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._chart=e,this._calcOptimalBarSpace(),this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace;var l=null!=i?i:{},u=l.styles,h=l.locale,d=l.timezone,p=l.customApi,g=l.thousandsSeparator,v=l.decimalFold;L(u)&&this.setStyles(u),W(h)&&this.setLocale(h),this.setTimezone(null!=d?d:""),L(p)&&this.setCustomApi(p),L(g)&&this.setThousandsSeparator(g),L(v)&&this.setDecimalFold(v)}return e.prototype.setStyles=function(t){var e,i,n=null;n=W(t)?we(t):t,M(this._styles,n),A(null===(i=null===(e=null==n?void 0:n.candle)||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.custom)&&(this._styles.candle.tooltip.custom=n.candle.tooltip.custom)},e.prototype.getStyles=function(){return this._styles},e.prototype.setCustomApi=function(t){M(this._customApi,t)},e.prototype.getCustomApi=function(){return this._customApi},e.prototype.setLocale=function(t){this._locale=t},e.prototype.getLocale=function(){return this._locale},e.prototype.setTimezone=function(t){if(!L(this._dateTimeFormat)||this.getTimezone()!==t){var e={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"};t.length>0&&(e.timeZone=t);var i=null;try{i=new Intl.DateTimeFormat("en",e)}catch(t){}null!==i&&(this._classifyTimeWeightTicks(this._dataList),this._dateTimeFormat=i)}},e.prototype.getTimezone=function(){return this._dateTimeFormat.resolvedOptions().timeZone},e.prototype.getDateTimeFormat=function(){return this._dateTimeFormat},e.prototype.setThousandsSeparator=function(t){M(this._thousandsSeparator,t)},e.prototype.getThousandsSeparator=function(){return this._thousandsSeparator},e.prototype.setDecimalFold=function(t){M(this._decimalFold,t)},e.prototype.getDecimalFold=function(){return this._decimalFold},e.prototype.getPrecision=function(){return this._precision},e.prototype.setPrecision=function(t){M(this._precision,t),this._synchronizeIndicatorSeriesPrecision()},e.prototype.getDataList=function(){return this._dataList},e.prototype.getVisibleRangeDataList=function(){return this._visibleRangeDataList},e.prototype.getVisibleRangeHighLowPrice=function(){return this._visibleRangeHighLowPrice},e.prototype.addData=function(t,e,i){var n,o,r,a,s=this,l=!1,u=!1,c=0;if(A(t)){switch(c=t.length,e){case pt.Init:this.clearData(),this._dataList=t,this._loadDataMore.backward=null!==(n=null==i?void 0:i.forward)&&void 0!==n&&n,this._loadDataMore.forward=null!==(o=null==i?void 0:i.forward)&&void 0!==o&&o,this._classifyTimeWeightTicks(this._dataList),this.setOffsetRightDistance(this._offsetRightDistance),u=!0;break;case pt.Backward:this._classifyTimeWeightTicks(t,!0),this._dataList=this._dataList.concat(t),this._loadDataMore.backward=null!==(r=null==i?void 0:i.backward)&&void 0!==r&&r,u=c>0;break;case pt.Forward:this._dataList=t.concat(this._dataList),this._classifyTimeWeightTicks(this._dataList),this._loadDataMore.forward=null!==(a=null==i?void 0:i.forward)&&void 0!==a&&a,u=c>0}this._loading=!1,l=!0}else{var h=this._dataList.length,d=t.timestamp,p=N(this._dataList[h-1],"timestamp",0);if(d>p){this._classifyTimeWeightTicks([t],!0),this._dataList.push(t);var g=this.getLastBarRightSideDiffBarCount();g<0&&this.setLastBarRightSideDiffBarCount(--g),c=1,l=!0,u=!0}else d===p&&(this._dataList[h-1]=t,l=!0,u=!0)}l&&(u&&(this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this.getIndicatorsByFilter({}).forEach((function(t,i){t.forEach((function(t){s._addIndicatorCalcTask(i,t,e)}))})),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})))},e.prototype.setLoadMoreDataCallback=function(t){this._loadMoreDataCallback=t},e.prototype._calcOptimalBarSpace=function(){var t=1-.2*Math.atan(Math.max(4,this._barSpace)-4)/(.5*Math.PI),e=Math.min(Math.floor(this._barSpace*t),Math.floor(this._barSpace));e%2==0&&e+2>=this._barSpace&&--e,this._gapBarSpace=Math.max(1,e)},e.prototype._classifyTimeWeightTicks=function(t,e){var i=0,n=null;null!=e&&e?(i=this._dataList.length,n=this._dataList[i-1].timestamp):(this._timeWeightTickMap.clear(),this._minTimeDifference=Number.MAX_SAFE_INTEGER);var o={value:this._minTimeDifference};At(this._timeWeightTickMap,t,this._dateTimeFormat,i,o,n),this._minTimeDifference=o.value,this._timeWeightTickList=Bt(this._timeWeightTickMap,this._barSpace,this._styles.xAxis.tickText)},e.prototype.getTimeWeightTickList=function(){return this._timeWeightTickList},e.prototype._adjustVisibleRange=function(){var e,i,n=this,o=this._dataList.length,r=this._totalBarSpace/this._barSpace,a=0,s=0;1===this._scrollLimitRole?(a=(this._totalBarSpace-this._maxOffsetDistance.right)/this._barSpace,s=(this._totalBarSpace-this._maxOffsetDistance.left)/this._barSpace):(a=this._minVisibleBarCount.left,s=this._minVisibleBarCount.right),a=Math.max(0,a),s=Math.max(0,s);var l=r-Math.min(a,o);this._lastBarRightSideDiffBarCount>l&&(this._lastBarRightSideDiffBarCount=l);var u=-o+Math.min(s,o);this._lastBarRightSideDiffBarCount<u&&(this._lastBarRightSideDiffBarCount=u);var c=Math.round(this._lastBarRightSideDiffBarCount+o+.5),h=c;c>o&&(c=o);var d=Math.round(c-r)-1;d<0&&(d=0);var p=this._lastBarRightSideDiffBarCount>0?Math.round(o+this._lastBarRightSideDiffBarCount-r)-1:d;this._visibleRange={from:d,to:c,realFrom:p,realTo:h},this.executeAction(t.ActionType.OnVisibleRangeChange,this._visibleRange),this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}];for(var g=p;g<h;g++){var v=this._dataList[g],f=this.dataIndexToCoordinate(g);this._visibleRangeDataList.push({dataIndex:g,x:f,data:v}),L(v)&&(this._visibleRangeHighLowPrice[0].price<v.high&&(this._visibleRangeHighLowPrice[0].price=v.high,this._visibleRangeHighLowPrice[0].x=f),this._visibleRangeHighLowPrice[1].price>v.low&&(this._visibleRangeHighLowPrice[1].price=v.low,this._visibleRangeHighLowPrice[1].x=f))}if(!this._loading&&L(this._loadMoreDataCallback)){var y=null;0===d?this._loadDataMore.forward&&(this._loading=!0,y={type:pt.Forward,data:null!==(e=this._dataList[0])&&void 0!==e?e:null,callback:function(t,e){n.addData(t,pt.Forward,{forward:null!=e&&e,backward:null!=e&&e})}}):c===o&&this._loadDataMore.backward&&(this._loading=!0,y={type:pt.Backward,data:null!==(i=this._dataList[o-1])&&void 0!==i?i:null,callback:function(t,e){n.addData(t,pt.Backward,{forward:null!=e&&e,backward:null!=e&&e})}}),L(y)&&this._loadMoreDataCallback(y)}},e.prototype.getBarSpace=function(){return{bar:this._barSpace,halfBar:this._barSpace/2,gapBar:this._gapBarSpace,halfGapBar:Math.floor(this._gapBarSpace/2)}},e.prototype.setBarSpace=function(t,e){t<Ie||t>ke||this._barSpace===t||(this._barSpace=t,this._timeWeightTickList=Bt(this._timeWeightTickMap,this._barSpace,this._styles.xAxis.tickText),this._calcOptimalBarSpace(),null==e||e(),this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}))},e.prototype.setTotalBarSpace=function(t){this._totalBarSpace!==t&&(this._totalBarSpace=t,this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0))},e.prototype.setOffsetRightDistance=function(t,e){return this._offsetRightDistance=1===this._scrollLimitRole?Math.min(this._maxOffsetDistance.right,t):t,this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace,null!=e&&e&&(this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})),this},e.prototype.getInitialOffsetRightDistance=function(){return this._offsetRightDistance},e.prototype.getOffsetRightDistance=function(){return Math.max(0,this._lastBarRightSideDiffBarCount*this._barSpace)},e.prototype.getLastBarRightSideDiffBarCount=function(){return this._lastBarRightSideDiffBarCount},e.prototype.setLastBarRightSideDiffBarCount=function(t){this._lastBarRightSideDiffBarCount=t},e.prototype.setMaxOffsetLeftDistance=function(t){this._scrollLimitRole=1,this._maxOffsetDistance.left=t},e.prototype.setMaxOffsetRightDistance=function(t){this._scrollLimitRole=1,this._maxOffsetDistance.right=t},e.prototype.setLeftMinVisibleBarCount=function(t){this._scrollLimitRole=0,this._minVisibleBarCount.left=t},e.prototype.setRightMinVisibleBarCount=function(t){this._scrollLimitRole=0,this._minVisibleBarCount.right=t},e.prototype.getVisibleRange=function(){return this._visibleRange},e.prototype.startScroll=function(){this._startLastBarRightSideDiffBarCount=this._lastBarRightSideDiffBarCount},e.prototype.scroll=function(e){if(this._scrollEnabled){var i=e/this._barSpace,n=this._lastBarRightSideDiffBarCount*this._barSpace;this._lastBarRightSideDiffBarCount=this._startLastBarRightSideDiffBarCount-i,this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0});var o=Math.round(n-this._lastBarRightSideDiffBarCount*this._barSpace);0!==o&&this.executeAction(t.ActionType.OnScroll,{distance:o})}},e.prototype.getDataByDataIndex=function(t){var e;return null!==(e=this._dataList[t])&&void 0!==e?e:null},e.prototype.coordinateToFloatIndex=function(t){var e=this._dataList.length,i=(this._totalBarSpace-t)/this._barSpace,n=e+this._lastBarRightSideDiffBarCount-i;return Math.round(1e6*n)/1e6},e.prototype.dataIndexToTimestamp=function(t){var e=this._dataList.length;if(0===e)return null;var i=this.getDataByDataIndex(t);if(L(i))return i.timestamp;var n=e-1;return t>n?this._dataList[n].timestamp+this._minTimeDifference*(t-n):t<0?this._dataList[0].timestamp-this._minTimeDifference*Math.abs(t):null},e.prototype.timestampToDataIndex=function(t){var e=this._dataList.length;if(0===e)return 0;var i=e-1,n=this._dataList[i].timestamp;if(t>n)return i+Math.floor((t-n)/this._minTimeDifference);var o=this._dataList[0].timestamp;return t<o?Math.floor((t-o)/this._minTimeDifference):_t(this._dataList,"timestamp",t)},e.prototype.dataIndexToCoordinate=function(t){var e=this._dataList.length+this._lastBarRightSideDiffBarCount-t;return Math.floor(this._totalBarSpace-(e-.5)*this._barSpace+.5)},e.prototype.coordinateToDataIndex=function(t){return Math.ceil(this.coordinateToFloatIndex(t))-1},e.prototype.zoom=function(e,i){var n,o=this;if(this._zoomEnabled){var r=null!=i?i:null;R(null==r?void 0:r.x)||(r={x:null!==(n=this._crosshair.x)&&void 0!==n?n:this._totalBarSpace/2});var a=r.x,s=this.coordinateToFloatIndex(a),l=this._barSpace,u=this._barSpace+e*(this._barSpace/10);this.setBarSpace(u,(function(){o._lastBarRightSideDiffBarCount+=s-o.coordinateToFloatIndex(a)}));var c=this._barSpace/l;1!==c&&this.executeAction(t.ActionType.OnZoom,{scale:c})}},e.prototype.setZoomEnabled=function(t){this._zoomEnabled=t},e.prototype.isZoomEnabled=function(){return this._zoomEnabled},e.prototype.setScrollEnabled=function(t){this._scrollEnabled=t},e.prototype.isScrollEnabled=function(){return this._scrollEnabled},e.prototype.setCrosshair=function(t,e){var i,n=null!=t?t:{},o=0,r=0;r=R(n.x)?(o=this.coordinateToDataIndex(n.x))<0?0:o>this._dataList.length-1?this._dataList.length-1:o:o=this._dataList.length-1;var a=this._dataList[r],s=this.dataIndexToCoordinate(o),l=this._crosshair.x,u=this._crosshair.y,h=this._crosshair.paneId;this._crosshair=c(c({},n),{realX:s,kLineData:a,realDataIndex:o,dataIndex:r,timestamp:null!==(i=this.dataIndexToTimestamp(o))&&void 0!==i?i:void 0}),l===n.x&&u===n.y&&h===n.paneId||(L(a)&&this._chart.crosshairChange(this._crosshair),null!=e&&e||this._chart.updatePane(1))},e.prototype.getCrosshair=function(){return this._crosshair},e.prototype.setActiveTooltipIcon=function(t){this._activeTooltipIcon=null!=t?t:null},e.prototype.getActiveTooltipIcon=function(){return this._activeTooltipIcon},e.prototype.executeAction=function(t,e){var i;null===(i=this._actions.get(t))||void 0===i||i.execute(e)},e.prototype.subscribeAction=function(t,e){var i;this._actions.has(t)||this._actions.set(t,new et),null===(i=this._actions.get(t))||void 0===i||i.subscribe(e)},e.prototype.unsubscribeAction=function(t,e){var i=this._actions.get(t);L(i)&&(i.unsubscribe(e),i.isEmpty()&&this._actions.delete(t))},e.prototype.hasAction=function(t){var e=this._actions.get(t);return L(e)&&!e.isEmpty()},e.prototype._sortIndicators=function(t){var e;W(t)?null===(e=this._indicators.get(t))||void 0===e||e.sort((function(t,e){return t.zLevel-e.zLevel})):this._indicators.forEach((function(t){t.sort((function(t,e){return t.zLevel-e.zLevel}))}))},e.prototype._addIndicatorCalcTask=function(t,e,i){var n=this;this._taskScheduler.addTask({id:wt(t,e.name),handler:function(){var t;null===(t=e.onDataStateChange)||void 0===t||t.call(e,{state:tt.Loading,type:i,indicator:e}),e.calcImp(n._dataList).then((function(t){var o;t&&(n._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}),null===(o=e.onDataStateChange)||void 0===o||o.call(e,{state:tt.Ready,type:i,indicator:e}))})).catch((function(){var t;null===(t=e.onDataStateChange)||void 0===t||t.call(e,{state:tt.Error,type:i,indicator:e})}))}})},e.prototype.addIndicator=function(t,e,i){var n=t.name,o=this._indicators.get(e);if(L(o)&&L(o.find((function(t){return t.name===n}))))return!1;L(o)||(o=[]);var r=new(ee(n));return this._synchronizeIndicatorSeriesPrecision(r),r.override(t),i||(this.removeIndicator({paneId:e}),o=[]),o.push(r),this._indicators.set(e,o),this._sortIndicators(e),this._addIndicatorCalcTask(e,r,pt.Init),!0},e.prototype.getIndicatorsByPaneId=function(t){var e;return null!==(e=this._indicators.get(t))&&void 0!==e?e:[]},e.prototype.getIndicatorsByFilter=function(t){var e=function(t,e){return t.filter((function(t){return!L(e)||t.name===e}))},i=t.paneId,n=t.name,o=new Map;if(L(i)){var r=this.getIndicatorsByPaneId(i);o.set(i,e(r,n))}else L(n)?this._indicators.forEach((function(t,i){o.set(i,e(t,n))})):this._indicators.forEach((function(t,i){o.set(i,e(t))}));return o},e.prototype.removeIndicator=function(t){var e=this,i=!1;return this.getIndicatorsByFilter(t).forEach((function(t,n){var o=e.getIndicatorsByPaneId(n);t.forEach((function(t){var r=o.findIndex((function(e){return e.name===t.name}));r>-1&&(e._taskScheduler.removeTask(wt(n,t.name)),o.splice(r,1),i=!0)})),0===o.length&&e._indicators.delete(n)})),i},e.prototype.hasIndicators=function(t){return this._indicators.has(t)},e.prototype._synchronizeIndicatorSeriesPrecision=function(e){var i=this._precision,n=i.price,o=i.volume,r=function(e){switch(e.series){case t.IndicatorSeries.Price:e.setSeriesPrecision(n);break;case t.IndicatorSeries.Volume:e.setSeriesPrecision(o)}};L(e)?r(e):this._indicators.forEach((function(t){t.forEach((function(t){r(t)}))}))},e.prototype.overrideIndicator=function(t,e){var i=this,n=t.name,o=new Map;if(L(e)){var r=this._indicators.get(e);L(r)&&o.set(e,r)}else o=this._indicators;var a=!1,s=!1;return o.forEach((function(e,o){var r=e.find((function(t){return t.name===n}));if(L(r)){r.override(t);var l=r.shouldUpdateImp(),u=l.calc,c=l.draw;l.sort&&(s=!0),u?i._addIndicatorCalcTask(o,r,pt.Update):c&&(a=!0)}})),s&&this._sortIndicators(),!!a&&(this._chart.layout({update:!0}),!0)},e.prototype.getOverlaysByFilter=function(t){var e,i,n=t.id,o=t.groupId,r=t.paneId,a=t.name,s=function(t){return t.filter((function(t){return L(n)?t.id===n:L(o)?t.groupId===o&&(!L(a)||t.name===a):!L(a)||t.name===a}))},l=new Map;if(L(r)){var u=this.getOverlaysByPaneId(r);l.set(r,s(u))}else this._overlays.forEach((function(t,e){l.set(e,s(t))}));var c=null===(e=this._progressOverlayInfo)||void 0===e?void 0:e.overlay;if(L(c)){var h=null!==(i=l.get(c.paneId))&&void 0!==i?i:[];h.push(c),l.set(c.paneId,h)}return l},e.prototype.getOverlaysByPaneId=function(t){var e;if(!W(t)){var i=[];return this._overlays.forEach((function(t){i=i.concat(t)})),i}return null!==(e=this._overlays.get(t))&&void 0!==e?e:[]},e.prototype._sortOverlays=function(t){var e;W(t)?null===(e=this._overlays.get(t))||void 0===e||e.sort((function(t,e){return t.zLevel-e.zLevel})):this._overlays.forEach((function(t){t.sort((function(t,e){return t.zLevel-e.zLevel}))}))},e.prototype.addOverlays=function(t,e){var i=this,n=[],o=t.map((function(t,o){var r,a,s,l,u,c;if(L(t.id)){var h=null;try{for(var d=g(i._overlays),p=d.next();!p.done;p=d.next()){if(L(m=v(p.value,2)[1].find((function(e){return e.id===t.id})))){h=m;break}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(r)throw r.error}}if(L(h))return t.id}var f=be(t.name);if(L(f)){var y=null!==(s=t.id)&&void 0!==s?s:yt("overlay_"),m=new f;t.id=y,null!==(l=t.groupId)&&void 0!==l||(t.groupId=y),m.override(t);var _=m.paneId;return n.includes(_)||n.push(_),m.isDrawing()?i._progressOverlayInfo={paneId:_,overlay:m,appointPaneFlag:e[o]}:(i._overlays.has(_)||i._overlays.set(_,[]),null===(u=i._overlays.get(_))||void 0===u||u.push(m)),m.isStart()&&(null===(c=m.onDrawStart)||void 0===c||c.call(m,{overlay:m,chart:i._chart})),y}return null}));return n.length>0&&(this._sortOverlays(),n.forEach((function(t){i._chart.updatePane(1,t)})),this._chart.updatePane(1,Pe)),o},e.prototype.getProgressOverlayInfo=function(){return this._progressOverlayInfo},e.prototype.progressOverlayComplete=function(){var t;if(null!==this._progressOverlayInfo){var e=this._progressOverlayInfo,i=e.overlay,n=e.paneId;i.isDrawing()||(this._overlays.has(n)||this._overlays.set(n,[]),null===(t=this._overlays.get(n))||void 0===t||t.push(i),this._sortOverlays(n),this._progressOverlayInfo=null)}},e.prototype.updateProgressOverlayInfo=function(t,e){null!==this._progressOverlayInfo&&(O(e)&&e&&(this._progressOverlayInfo.appointPaneFlag=e),this._progressOverlayInfo.paneId=t,this._progressOverlayInfo.overlay.override({paneId:t}))},e.prototype.overrideOverlay=function(t){var e=this,i=!1,n=[];return this.getOverlaysByFilter(t).forEach((function(e,o){e.forEach((function(e){e.override(t);var r=e.shouldUpdate(),a=r.sort,s=r.draw;a&&(i=!0),(a||s)&&(n.includes(o)||n.push(o))}))})),i&&this._sortOverlays(),n.length>0&&(n.forEach((function(t){e._chart.updatePane(1,t)})),this._chart.updatePane(1,Pe),!0)},e.prototype.removeOverlay=function(t){var e=this,i=[];return this.getOverlaysByFilter(t).forEach((function(t,n){var o=e.getOverlaysByPaneId(n);t.forEach((function(t){var r;if(null===(r=t.onRemoved)||void 0===r||r.call(t,{overlay:t,chart:e._chart}),i.includes(n)||i.push(n),t.isDrawing())e._progressOverlayInfo=null;else{var a=o.findIndex((function(e){return e.id===t.id}));a>-1&&o.splice(a,1)}0===o.length&&e._overlays.delete(n)}))})),i.length>0&&(i.forEach((function(t){e._chart.updatePane(1,t)})),this._chart.updatePane(1,Pe),!0)},e.prototype.setPressedOverlayInfo=function(t){this._pressedOverlayInfo=t},e.prototype.getPressedOverlayInfo=function(){return this._pressedOverlayInfo},e.prototype.setHoverOverlayInfo=function(t,e){var i=this._hoverOverlayInfo,n=i.overlay,o=i.figureType,r=i.figureKey,a=i.figureIndex,s=t.overlay;if(((null==n?void 0:n.id)!==(null==s?void 0:s.id)||o!==t.figureType||a!==t.figureIndex)&&(this._hoverOverlayInfo=t,(null==n?void 0:n.id)!==(null==s?void 0:s.id))){var l=!1,u=!1;null!==n&&(u=!0,F(n.onMouseLeave)&&(n.onMouseLeave(c({chart:this._chart,overlay:n,figureKey:r,figureIndex:a},e)),l=!0)),null!==s&&(u=!0,F(s.onMouseEnter)&&(s.onMouseEnter(c({chart:this._chart,overlay:s,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),l=!0)),u&&this._sortOverlays(),l||this._chart.updatePane(1)}},e.prototype.getHoverOverlayInfo=function(){return this._hoverOverlayInfo},e.prototype.setClickOverlayInfo=function(t,e){var i,n,o,r,a=this._clickOverlayInfo,s=a.paneId,l=a.overlay,u=a.figureType,h=a.figureKey,d=a.figureIndex,p=t.overlay;null!==(i=null==p?void 0:p.isDrawing())&&void 0!==i&&i||null===(n=null==p?void 0:p.onClick)||void 0===n||n.call(p,c({chart:this._chart,overlay:p,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),(null==l?void 0:l.id)===(null==p?void 0:p.id)&&u===t.figureType&&d===t.figureIndex||(this._clickOverlayInfo=t,(null==l?void 0:l.id)!==(null==p?void 0:p.id)&&(null===(o=null==l?void 0:l.onDeselected)||void 0===o||o.call(l,c({chart:this._chart,overlay:l,figureKey:h,figureIndex:d},e)),null===(r=null==p?void 0:p.onSelected)||void 0===r||r.call(p,c({chart:this._chart,overlay:p,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),this._chart.updatePane(1,t.paneId),s!==t.paneId&&this._chart.updatePane(1,s),this._chart.updatePane(1,Pe)))},e.prototype.getClickOverlayInfo=function(){return this._clickOverlayInfo},e.prototype.isOverlayEmpty=function(){return 0===this._overlays.size&&null===this._progressOverlayInfo},e.prototype.isOverlayDrawing=function(){var t,e;return null!==(e=null===(t=this._progressOverlayInfo)||void 0===t?void 0:t.overlay.isDrawing())&&void 0!==e&&e},e.prototype.clearData=function(){this._loadDataMore.backward=!1,this._loadDataMore.forward=!1,this._loading=!0,this._dataList=[],this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}],this._visibleRange={from:0,to:0,realFrom:0,realTo:0},this._timeWeightTickMap.clear(),this._timeWeightTickList=[],this._crosshair={},this._activeTooltipIcon=null},e.prototype.getChart=function(){return this._chart},e}(),De="main",Ae="xAxis",Fe="yAxis",Be="separator";var Re=function(){function t(t,e){var i=this;this._supportedDevicePixelContentBox=!1,this._width=0,this._height=0,this._pixelWidth=0,this._pixelHeight=0,this._nextPixelWidth=0,this._nextPixelHeight=0,this._requestAnimationId=ut,this._mediaQueryListener=function(){var t=q(i._element);i._nextPixelWidth=Math.round(i._element.clientWidth*t),i._nextPixelHeight=Math.round(i._element.clientHeight*t),i._resetPixelRatio()},this._listener=e,this._element=mt("canvas",t),this._ctx=this._element.getContext("2d"),function(){return d(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var e=new ResizeObserver((function(i){t(i.every((function(t){return"devicePixelContentBoxSize"in t}))),e.disconnect()}));e.observe(document.body,{box:"device-pixel-content-box"})})).catch((function(){return!1}))];case 1:return[2,t.sent()]}}))}))}().then((function(t){i._supportedDevicePixelContentBox=t,t?(i._resizeObserver=new ResizeObserver((function(t){var e=t.find((function(t){return t.target===i._element})),n=null==e?void 0:e.devicePixelContentBoxSize[0];L(n)&&(i._nextPixelWidth=n.inlineSize,i._nextPixelHeight=n.blockSize,i._pixelWidth===i._nextPixelWidth&&i._pixelHeight===i._nextPixelHeight||i._resetPixelRatio())})),i._resizeObserver.observe(i._element,{box:"device-pixel-content-box"})):(i._mediaQueryList=window.matchMedia("(resolution: ".concat(q(i._element),"dppx)")),i._mediaQueryList.addListener(i._mediaQueryListener))})).catch((function(t){return!1}))}return t.prototype._resetPixelRatio=function(){var t=this;this._executeListener((function(){var e=t._element.clientWidth,i=t._element.clientHeight;t._width=e,t._height=i,t._pixelWidth=t._nextPixelWidth,t._pixelHeight=t._nextPixelHeight,t._element.width=t._nextPixelWidth,t._element.height=t._nextPixelHeight;var n=t._nextPixelWidth/e,o=t._nextPixelHeight/i;t._ctx.scale(n,o)}))},t.prototype._executeListener=function(t){var e=this;this._requestAnimationId===ut&&(this._requestAnimationId=ct((function(){e._ctx.clearRect(0,0,e._width,e._height),null==t||t(),e._listener(),e._requestAnimationId=ut})))},t.prototype.update=function(t,e){if(this._width!==t||this._height!==e){if(this._element.style.width="".concat(t,"px"),this._element.style.height="".concat(e,"px"),!this._supportedDevicePixelContentBox){var i=q(this._element);this._nextPixelWidth=Math.round(t*i),this._nextPixelHeight=Math.round(e*i),this._resetPixelRatio()}}else this._executeListener()},t.prototype.getElement=function(){return this._element},t.prototype.getContext=function(){return this._ctx},t.prototype.destroy=function(){L(this._resizeObserver)&&this._resizeObserver.unobserve(this._element),L(this._mediaQueryList)&&this._mediaQueryList.removeListener(this._mediaQueryListener)},t}(),Le=function(t){function e(e,i){var n=t.call(this)||this;return n._bounding=lt(),n._pane=i,n._rootContainer=e,n._container=n.createContainer(),e.appendChild(n._container),n}return i(e,t),e.prototype.setBounding=function(t){return M(this._bounding,t),this},e.prototype.getContainer=function(){return this._container},e.prototype.getBounding=function(){return this._bounding},e.prototype.getPane=function(){return this._pane},e.prototype.update=function(t){this.updateImp(this._container,this._bounding,null!=t?t:3)},e.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},e}(oe),Oe=function(t){function e(e,i){var n=t.call(this,e,i)||this;n._mainCanvas=new Re({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},(function(){n.updateMain(n._mainCanvas.getContext())})),n._overlayCanvas=new Re({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},(function(){n.updateOverlay(n._overlayCanvas.getContext())}));var o=n.getContainer();return o.appendChild(n._mainCanvas.getElement()),o.appendChild(n._overlayCanvas.getElement()),n}return i(e,t),e.prototype.createContainer=function(){return mt("div",{margin:"0",padding:"0",position:"absolute",top:"0",overflow:"hidden",boxSizing:"border-box",zIndex:"1"})},e.prototype.updateImp=function(t,e,i){var n=e.width,o=e.height,r=e.left;t.style.left="".concat(r,"px");var a=i,s=t.clientWidth,l=t.clientHeight;switch(n===s&&o===l||(t.style.width="".concat(n,"px"),t.style.height="".concat(o,"px"),a=3),a){case 0:this._mainCanvas.update(n,o);break;case 1:this._overlayCanvas.update(n,o);break;case 3:case 4:this._mainCanvas.update(n,o),this._overlayCanvas.update(n,o)}},e.prototype.destroy=function(){this._mainCanvas.destroy(),this._overlayCanvas.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=q(o);return o.width=i*a,o.height=n*a,r.scale(a,a),r.drawImage(this._mainCanvas.getElement(),0,0,i,n),t&&r.drawImage(this._overlayCanvas.getElement(),0,0,i,n),o},e}(Le);function We(t){return"transparent"===t||"none"===t||/^[rR][gG][Bb][Aa]\(([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\s]*,){3}[\s]*0[\s]*\)$/.test(t)||/^[hH][Ss][Ll][Aa]\(([\s]*(360|3[0-5][0-9]|[012]?[0-9][0-9]?)[\s]*,)([\s]*((100|[0-9][0-9]?)%|0)[\s]*,){2}([\s]*0[\s]*)\)$/.test(t)}function ze(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value,l=s.x,u=s.y,c=s.r,h=t.x-l,d=t.y-u;if(!(h*h+d*d>c*c))return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}var Ve={name:"circle",checkEventOn:ze,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"currentColor":s,u=n.borderSize,c=void 0===u?1:u,h=n.borderColor,d=void 0===h?"currentColor":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderDashedValue,f=void 0===v?[2,2]:v,y=!(a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&We(l));y&&(e.fillStyle=l,o.forEach((function(t){var i=t.x,n=t.y,o=t.r;e.beginPath(),e.arc(i,n,o,0,2*Math.PI),e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&c>0&&!We(d)&&(e.strokeStyle=d,e.lineWidth=c,g===t.LineType.Dashed?e.setLineDash(f):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.r;(!y||o>c)&&(e.beginPath(),e.arc(i,n,o,0,2*Math.PI),e.closePath(),e.stroke())})))}(e,i,n)}};function Ne(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){for(var s=a.value,l=!1,u=s.coordinates,c=0,h=u.length-1;c<u.length;h=c++)u[c].y>t.y!=u[h].y>t.y&&t.x<(u[h].x-u[c].x)*(t.y-u[c].y)/(u[h].y-u[c].y)+u[c].x&&(l=!l);if(l)return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}var Ye={name:"polygon",checkEventOn:Ne,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"currentColor":s,u=n.borderSize,c=void 0===u?1:u,h=n.borderColor,d=void 0===h?"currentColor":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderDashedValue,f=void 0===v?[2,2]:v;a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&We(l)||(e.fillStyle=l,o.forEach((function(t){var i=t.coordinates;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(var n=1;n<i.length;n++)e.lineTo(i[n].x,i[n].y);e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&c>0&&!We(d)&&(e.strokeStyle=d,e.lineWidth=c,g===t.LineType.Dashed?e.setLineDash(f):e.setLineDash([]),o.forEach((function(t){var i=t.coordinates;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(var n=1;n<i.length;n++)e.lineTo(i[n].x,i[n].y);e.closePath(),e.stroke()})))}(e,i,n)}};function He(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value,l=s.x,u=s.width;u<4&&(l-=2,u=4);var c=s.y,h=s.height;if(h<4&&(c-=2,h=4),t.x>=l&&t.x<=l+u&&t.y>=c&&t.y<=c+h)return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}function Xe(e,i,n){var o,r=[];r=r.concat(i);var a=n.style,s=void 0===a?t.PolygonType.Fill:a,l=n.color,u=void 0===l?"transparent":l,c=n.borderSize,h=void 0===c?1:c,d=n.borderColor,p=void 0===d?"transparent":d,g=n.borderStyle,v=void 0===g?t.LineType.Solid:g,f=n.borderRadius,y=void 0===f?0:f,m=n.borderDashedValue,_=void 0===m?[2,2]:m,x=null!==(o=e.roundRect)&&void 0!==o?o:e.rect,C=!(s!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(u)&&We(u));if(C&&(e.fillStyle=u,r.forEach((function(t){var i=t.x,n=t.y,o=t.width,r=t.height;e.beginPath(),x.call(e,i,n,o,r,y),e.closePath(),e.fill()}))),(s===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&h>0&&!We(p)){e.strokeStyle=p,e.fillStyle=p,e.lineWidth=h,v===t.LineType.Dashed?e.setLineDash(_):e.setLineDash([]);var b=h%2==1?.5:0,T=Math.round(2*b);r.forEach((function(t){var i=t.x,n=t.y,o=t.width,r=t.height;o>2*h&&r>2*h?(e.beginPath(),x.call(e,i+b,n+b,o-T,r-T,y),e.closePath(),e.stroke()):C||e.fillRect(i,n,o,r)}))}}var Ge={name:"rect",checkEventOn:He,draw:function(t,e,i){Xe(t,e,i)}};function Ke(t,e){var i=e.size,n=void 0===i?12:i,o=e.paddingLeft,r=void 0===o?0:o,a=e.paddingTop,s=void 0===a?0:a,l=e.paddingRight,u=void 0===l?0:l,c=e.paddingBottom,h=void 0===c?0:c,d=e.weight,p=void 0===d?"normal":d,g=e.family,v=t.x,f=t.y,y=t.text,m=t.align,_=void 0===m?"left":m,x=t.baseline,C=void 0===x?"top":x,b=t.width,T=t.height,w=null!=b?b:r+Q(y,n,p,g)+u,S=null!=T?T:s+n+h,E=0;switch(_){case"left":case"start":E=v;break;case"right":case"end":E=v-w;break;default:E=v-w/2}var P=0;switch(C){case"top":case"hanging":P=f;break;case"bottom":case"ideographic":case"alphabetic":P=f-S;break;default:P=f-S/2}return{x:E,y:P,width:w,height:S}}function Ue(t,e,i){var n,o,r=[];r=r.concat(e);try{for(var a=g(r),s=a.next();!s.done;s=a.next()){var l=Ke(s.value,i),u=l.x,c=l.y,h=l.width,d=l.height;if(t.x>=u&&t.x<=u+h&&t.y>=c&&t.y<=c+d)return!0}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return!1}var je={name:"text",checkEventOn:Ue,draw:function(t,e,i){!function(t,e,i){var n=[];n=n.concat(e);var o=i.color,r=void 0===o?"currentColor":o,a=i.size,s=void 0===a?12:a,l=i.family,u=i.weight,h=i.paddingLeft,d=void 0===h?0:h,p=i.paddingTop,g=void 0===p?0:p,v=i.paddingRight,f=void 0===v?0:v,y=n.map((function(t){return Ke(t,i)}));Xe(t,y,c(c({},i),{color:i.backgroundColor})),t.textAlign="left",t.textBaseline="top",t.font=J(s,u,l),t.fillStyle=r,n.forEach((function(e,i){var n=y[i];t.fillText(e.text,n.x+d,n.y+g,n.width-d-f)}))}(t,e,i)}};function Ze(t,e){var i,n,o,r,a,s,l=[];l=l.concat(e);try{for(var u=g(l),c=u.next();!c.done;c=u.next()){var h=c.value;if(Math.abs((r=h,a=void 0,s=void 0,a=(o=t).x-r.x,s=o.y-r.y,Math.sqrt(a*a+s*s)-h.r))<2){var d=h.r,p=h.startAngle,v=h.endAngle,f=d*Math.cos(p)+h.x,y=d*Math.sin(p)+h.y,m=d*Math.cos(v)+h.x,_=d*Math.sin(v)+h.y;if(t.x<=Math.max(f,m)+2&&t.x>=Math.min(f,m)-2&&t.y<=Math.max(y,_)+2&&t.y>=Math.min(y,_)-2)return!0}}}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return!1}var qe={name:"arc",checkEventOn:Ze,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.LineType.Solid:r,s=n.size,l=void 0===s?1:s,u=n.color,c=void 0===u?"currentColor":u,h=n.dashedValue,d=void 0===h?[2,2]:h;e.lineWidth=l,e.strokeStyle=c,a===t.LineType.Dashed?e.setLineDash(d):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.r,r=t.startAngle,a=t.endAngle;e.beginPath(),e.arc(i,n,o,r,a),e.stroke(),e.closePath()}))}(e,i,n)}},Je={};[Ve,he,Ye,Ge,je,qe].forEach((function(t){Je[t.name]=re.extend(t)}));var Qe,$e=function(t){function e(e){var i=t.call(this)||this;return i._widget=e,i}return i(e,t),e.prototype.getWidget=function(){return this._widget},e.prototype.createFigure=function(t,e){var i,n,o=(i=t.name,null!==(n=Je[i])&&void 0!==n?n:null);if(null!==o){var r=new o(t);if(L(e)){for(var a in e)e.hasOwnProperty(a)&&r.registerEvent(a,e[a]);this.addChild(r)}return r}return null},e.prototype.draw=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this.clear(),this.drawImp(t,e)},e}(oe),ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i,n=this.getWidget(),o=this.getWidget().getPane(),r=o.getChart(),a=n.getBounding(),s=r.getStyles().grid;if(s.show){t.save(),t.globalCompositeOperation="destination-over";var l=s.horizontal;if(l.show){var u=o.getAxisComponent().getTicks().map((function(t){return{coordinates:[{x:0,y:t.coord},{x:a.width,y:t.coord}]}}));null===(e=this.createFigure({name:"line",attrs:u,styles:l}))||void 0===e||e.draw(t)}var c=s.vertical;if(c.show){u=r.getXAxisPane().getAxisComponent().getTicks().map((function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:a.height}]}}));null===(i=this.createFigure({name:"line",attrs:u,styles:c}))||void 0===i||i.draw(t)}t.restore()}},e}($e),ei=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.eachChildren=function(t){for(var e=this.getWidget().getPane().getChart().getChartStore(),i=e.getVisibleRangeDataList(),n=e.getBarSpace(),o=i.length,r=0;r<o;)t(i[r],n,r),++r},e}($e),ii=function(e){function n(){var i=e.apply(this,f([],v(arguments),!1))||this;return i._boundCandleBarClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().executeAction(t.ActionType.OnCandleBarClick,e),!1}},i}return i(n,e),n.prototype.drawImp=function(e){var i=this,n=this.getWidget().getPane(),o=n.getId()===Se,r=n.getChart().getChartStore(),a=this.getCandleBarOptions();if(null!==a){var s=0,l=0;if(a.type===t.CandleType.Ohlc){var u=r.getBarSpace().gapBar;(s=Math.min(Math.max(Math.round(.2*u),1),8))>2&&s%2==1&&s--,l=Math.floor(l/2)}var c=n.getAxisComponent();this.eachChildren((function(n,r){var u=n.data,h=n.x;if(L(u)){var d=u.open,p=u.high,g=u.low,v=u.close,f=a.type,y=a.styles,m=[];v>d?(m[0]=y.upColor,m[1]=y.upBorderColor,m[2]=y.upWickColor):v<d?(m[0]=y.downColor,m[1]=y.downBorderColor,m[2]=y.downWickColor):(m[0]=y.noChangeColor,m[1]=y.noChangeBorderColor,m[2]=y.noChangeWickColor);var _=c.convertToPixel(d),x=c.convertToPixel(v),C=[_,x,c.convertToPixel(p),c.convertToPixel(g)];C.sort((function(t,e){return t-e}));var b=r.gapBar%2==0?1:0,T=[];switch(f){case t.CandleType.CandleSolid:T=i._createSolidBar(h,C,r,m,b);break;case t.CandleType.CandleStroke:T=i._createStrokeBar(h,C,r,m,b);break;case t.CandleType.CandleUpStroke:T=v>d?i._createStrokeBar(h,C,r,m,b):i._createSolidBar(h,C,r,m,b);break;case t.CandleType.CandleDownStroke:T=d>v?i._createStrokeBar(h,C,r,m,b):i._createSolidBar(h,C,r,m,b);break;case t.CandleType.Ohlc:T=[{name:"rect",attrs:[{x:h-l,y:C[0],width:s,height:C[3]-C[0]},{x:h-r.halfGapBar,y:_+s>C[3]?C[3]-s:_,width:r.halfGapBar,height:s},{x:h+l,y:x+s>C[3]?C[3]-s:x,width:r.halfGapBar-l,height:s}],styles:{color:m[0]}}];break;case t.CandleType.HeikinAshi:var w=i._calculateHeikinAshi(n);T=i._createSolidBar(h,w.priceY,r,m,b)}T.forEach((function(t){var r,a=null;o&&(a={mouseClickEvent:i._boundCandleBarClickEvent(n)}),null===(r=i.createFigure(t,null!=a?a:void 0))||void 0===r||r.draw(e)}))}}))}},n.prototype.getCandleBarOptions=function(){var t=this.getWidget().getPane().getChart().getStyles().candle;return{type:t.type,styles:t.bar}},n.prototype._createSolidBar=function(e,i,n,o,r){return[{name:"rect",attrs:{x:e,y:i[0],width:1,height:i[3]-i[0]},styles:{color:o[2]}},{name:"rect",attrs:{x:e-n.halfGapBar,y:i[1],width:n.gapBar+r,height:Math.max(1,i[2]-i[1])},styles:{style:t.PolygonType.StrokeFill,color:o[0],borderColor:o[1]}}]},n.prototype._createStrokeBar=function(e,i,n,o,r){return[{name:"rect",attrs:[{x:e,y:i[0],width:1,height:i[1]-i[0]},{x:e,y:i[2],width:1,height:i[3]-i[2]}],styles:{color:o[2]}},{name:"rect",attrs:{x:e-n.halfGapBar,y:i[1],width:n.gapBar+r,height:Math.max(1,i[2]-i[1])},styles:{style:t.PolygonType.Stroke,borderColor:o[1]}}]},n.prototype._calculateHeikinAshi=function(t){var e=t.data,i=t.dataIndex,n=e,o=n.open,r=n.high,a=n.low,s=n.close,l=this.getPreviousData(i),u=null!=l?l.close:s,c=(o+r+a+s)/4,h=((null!=l?l.open:o)+u)/2,d=Math.max(r,h,c),p=Math.min(a,h,c),g=this.getWidget().getPane().getAxisComponent(),v=[g.convertToPixel(h),g.convertToPixel(c),g.convertToPixel(d),g.convertToPixel(p)];return v.sort((function(t,e){return t-e})),{priceY:v}},n.prototype.getPreviousData=function(t){var e=this.getWidget().getPane().getChart().getChartStore().getDataList();return t<=0||t>=e.length?null:t>0&&t<e.length?e[t-1]:null},n}(ei),ni=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.getCandleBarOptions=function(){var e,i,n=this.getWidget().getPane();if(!n.getAxisComponent().isInCandle()){var o=n.getChart().getChartStore(),r=o.getIndicatorsByPaneId(n.getId());try{for(var a=g(r),s=a.next();!s.done;s=a.next()){var l=s.value;if(l.shouldOhlc&&l.visible){var u=l.styles,c=o.getStyles().indicator,h=N(u,"ohlc.upColor",c.ohlc.upColor),d=N(u,"ohlc.downColor",c.ohlc.downColor),p=N(u,"ohlc.noChangeColor",c.ohlc.noChangeColor);return{type:t.CandleType.Ohlc,styles:{upColor:h,downColor:d,noChangeColor:p,upBorderColor:h,downBorderColor:d,noChangeBorderColor:p,upWickColor:h,downWickColor:d,noChangeWickColor:p}}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}}return null},n.prototype.drawImp=function(t){var i=this;e.prototype.drawImp.call(this,t);var n=this.getWidget(),o=n.getPane(),r=o.getChart(),a=n.getBounding(),s=r.getXAxisPane().getAxisComponent(),l=o.getAxisComponent(),u=r.getChartStore(),c=u.getIndicatorsByPaneId(o.getId()),h=u.getStyles().indicator;t.save(),c.forEach((function(e){if(e.visible){e.zLevel<0?t.globalCompositeOperation="destination-over":t.globalCompositeOperation="source-over";var n=!1;if(null!==e.draw&&(t.save(),n=e.draw({ctx:t,chart:r,indicator:e,bounding:a,xAxis:s,yAxis:l}),t.restore()),!n){var o=e.result,u=[];i.eachChildren((function(n,r){var c,d,p,g=r.halfGapBar,v=n.dataIndex,f=n.x,y=s.convertToPixel(v-1),m=s.convertToPixel(v+1),_=null!==(c=o[v-1])&&void 0!==c?c:null,x=null!==(d=o[v])&&void 0!==d?d:null,C=null!==(p=o[v+1])&&void 0!==p?p:null,b={x:y},T={x:f},w={x:m};e.figures.forEach((function(t){var e=t.key,i=null==_?void 0:_[e];R(i)&&(b[e]=l.convertToPixel(i));var n=null==x?void 0:x[e];R(n)&&(T[e]=l.convertToPixel(n));var o=null==C?void 0:C[e];R(o)&&(w[e]=l.convertToPixel(o))})),it(e,v,h,(function(e,n,o){var c,h,d;if(L(null==x?void 0:x[e.key])){var p=T[e.key],v=null===(c=e.attrs)||void 0===c?void 0:c.call(e,{data:{prev:_,current:x,next:C},coordinate:{prev:b,current:T,next:w},bounding:a,barSpace:r,xAxis:s,yAxis:l});if(!L(v))switch(e.type){case"circle":v={x:f,y:p,r:Math.max(1,g)};break;case"rect":case"bar":var y=null!==(h=e.baseValue)&&void 0!==h?h:l.getRange().from,m=l.convertToPixel(y),S=Math.abs(m-p);y!==(null==x?void 0:x[e.key])&&(S=Math.max(1,S));v={x:f-g,y:p>m?m:p,width:Math.max(1,2*g),height:S};break;case"line":L(u[o])||(u[o]=[]),R(T[e.key])&&R(w[e.key])&&u[o].push({coordinates:[{x:T.x,y:T[e.key]},{x:w.x,y:w[e.key]}],styles:n})}var E=e.type;L(v)&&"line"!==E&&(null===(d=i.createFigure({name:"bar"===E?"rect":E,attrs:v,styles:n}))||void 0===d||d.draw(t))}}))})),u.forEach((function(e){var n,o,r,a;if(e.length>1){for(var s=[{coordinates:[e[0].coordinates[0],e[0].coordinates[1]],styles:e[0].styles}],l=1;l<e.length;l++){var u=s[s.length-1],c=e[l],h=u.coordinates[u.coordinates.length-1];h.x===c.coordinates[0].x&&h.y===c.coordinates[0].y&&u.styles.style===c.styles.style&&u.styles.color===c.styles.color&&u.styles.size===c.styles.size&&u.styles.smooth===c.styles.smooth&&(null===(n=u.styles.dashedValue)||void 0===n?void 0:n[0])===(null===(o=c.styles.dashedValue)||void 0===o?void 0:o[0])&&(null===(r=u.styles.dashedValue)||void 0===r?void 0:r[1])===(null===(a=c.styles.dashedValue)||void 0===a?void 0:a[1])?u.coordinates.push(c.coordinates[1]):s.push({coordinates:[c.coordinates[0],c.coordinates[1]],styles:c.styles})}s.forEach((function(e){var n,o=e.coordinates,r=e.styles;null===(n=i.createFigure({name:"line",attrs:{coordinates:o},styles:r}))||void 0===n||n.draw(t)}))}}))}}})),t.restore()},n}(ii),oi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=e.getBounding(),o=e.getPane().getChart().getChartStore(),r=o.getCrosshair(),a=o.getStyles().crosshair;if(W(r.paneId)&&a.show){if(r.paneId===i.getId()){var s=r.y;this._drawLine(t,[{x:0,y:s},{x:n.width,y:s}],a.horizontal)}var l=r.realX;this._drawLine(t,[{x:l,y:0},{x:l,y:n.height}],a.vertical)}},e.prototype._drawLine=function(t,e,i){var n;if(i.show){var o=i.line;o.show&&(null===(n=this.createFigure({name:"line",attrs:{coordinates:e},styles:o}))||void 0===n||n.draw(t))}},e}($e),ri=function(e){function n(){var i=e.apply(this,f([],v(arguments),!1))||this;return i._boundIconClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().executeAction(t.ActionType.OnTooltipIconClick,c({},e)),!0}},i._boundIconMouseMoveEvent=function(t){return function(){return i.getWidget().getPane().getChart().getChartStore().setActiveTooltipIcon(c({},t)),!0}},i}return i(n,e),n.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane().getChart().getChartStore();if(L(i.getCrosshair().kLineData)){var n=e.getBounding(),o=i.getStyles().indicator.tooltip,r=o.offsetLeft,a=o.offsetTop,s=o.offsetRight;this.drawIndicatorTooltip(t,r,a,n.width-s)}},n.prototype.drawIndicatorTooltip=function(t,e,i,n){var o=this,r=this.getWidget().getPane(),a=r.getChart().getChartStore(),s=a.getStyles().indicator.tooltip;if(this.isDrawTooltip(a.getCrosshair(),s)){var l=a.getIndicatorsByPaneId(r.getId()),u=s.text;l.forEach((function(r){var a=0,l={x:e,y:i},c=o.getIndicatorTooltipData(r),h=c.name,d=c.calcParamsText,p=c.legends,g=c.icons,f=h.length>0,y=p.length>0;if(f||y){var m=v(o.classifyTooltipIcons(g),3),_=m[0],x=m[1],C=m[2];if(a=o.drawStandardTooltipIcons(t,_,l,r.name,e,a,n),f){var b=h;d.length>0&&(b="".concat(b).concat(d)),a=o.drawStandardTooltipLegends(t,[{title:{text:"",color:u.color},value:{text:b,color:u.color}}],l,e,a,n,u)}a=o.drawStandardTooltipIcons(t,x,l,r.name,e,a,n),y&&(a=o.drawStandardTooltipLegends(t,p,l,e,a,n,s.text)),a=o.drawStandardTooltipIcons(t,C,l,r.name,e,a,n),i=l.y+a}}))}return i},n.prototype.drawStandardTooltipIcons=function(t,e,i,n,o,r,a){var s=this;if(e.length>0){var l=0,u=0;e.forEach((function(e){var i=e.marginLeft,n=void 0===i?0:i,o=e.marginTop,r=void 0===o?0:o,a=e.marginRight,s=void 0===a?0:a,c=e.marginBottom,h=void 0===c?0:c,d=e.paddingLeft,p=void 0===d?0:d,g=e.paddingTop,v=void 0===g?0:g,f=e.paddingRight,y=void 0===f?0:f,m=e.paddingBottom,_=void 0===m?0:m,x=e.size,C=e.fontFamily,b=e.icon;t.font=J(x,"normal",C),l+=n+p+t.measureText(b).width+y+s,u=Math.max(u,r+v+x+_+h)})),i.x+l>a?(i.x=o,i.y+=r,r=u):r=Math.max(r,u);var c=this.getWidget().getPane(),h=c.getId(),d=c.getChart().getChartStore().getActiveTooltipIcon();e.forEach((function(e){var o,r=e.marginLeft,a=void 0===r?0:r,l=e.marginTop,u=void 0===l?0:l,c=e.marginRight,p=void 0===c?0:c,g=e.paddingLeft,v=void 0===g?0:g,f=e.paddingTop,y=void 0===f?0:f,m=e.paddingRight,_=void 0===m?0:m,x=e.paddingBottom,C=void 0===x?0:x,b=e.color,T=e.activeColor,w=e.size,S=e.fontFamily,E=e.icon,P=e.backgroundColor,I=e.activeBackgroundColor,k=(null==d?void 0:d.paneId)===h&&d.indicatorName===n&&d.iconId===e.id;null===(o=s.createFigure({name:"text",attrs:{text:E,x:i.x+a,y:i.y+u},styles:{paddingLeft:v,paddingTop:y,paddingRight:_,paddingBottom:C,color:k?T:b,size:w,family:S,backgroundColor:k?I:P}},{mouseClickEvent:s._boundIconClickEvent({paneId:h,indicatorName:n,iconId:e.id}),mouseMoveEvent:s._boundIconMouseMoveEvent({paneId:h,indicatorName:n,iconId:e.id})}))||void 0===o||o.draw(t),i.x+=a+v+t.measureText(E).width+_+p}))}return r},n.prototype.drawStandardTooltipLegends=function(t,e,i,n,o,r,a){var s=this;if(e.length>0){var l=a.marginLeft,u=a.marginTop,c=a.marginRight,h=a.marginBottom,d=a.size,p=a.family,g=a.weight;t.font=J(d,g,p),e.forEach((function(e){var a,v,f=e.title,y=e.value,m=t.measureText(f.text).width,_=m+t.measureText(y.text).width,x=u+d+h;i.x+l+_+c>r?(i.x=n,i.y+=o,o=x):o=Math.max(o,x),f.text.length>0&&(null===(a=s.createFigure({name:"text",attrs:{x:i.x+l,y:i.y+u,text:f.text},styles:{color:f.color,size:d,family:p,weight:g}}))||void 0===a||a.draw(t)),null===(v=s.createFigure({name:"text",attrs:{x:i.x+l+m,y:i.y+u,text:y.text},styles:{color:y.color,size:d,family:p,weight:g}}))||void 0===v||v.draw(t),i.x+=l+_+c}))}return o},n.prototype.isDrawTooltip=function(e,i){var n=i.showRule;return n===t.TooltipShowRule.Always||n===t.TooltipShowRule.FollowCross&&W(e.paneId)},n.prototype.getIndicatorTooltipData=function(t){var e,i,n=this.getWidget().getPane().getChart().getChartStore(),o=n.getStyles().indicator,r=o.tooltip,a=r.showName?t.shortName:"",s="",l=t.calcParams;l.length>0&&r.showParams&&(s="(".concat(l.join(","),")"));var u={name:a,calcParamsText:s,legends:[],icons:r.icons},c=n.getCrosshair().dataIndex,h=t.result,d=n.getCustomApi(),p=n.getDecimalFold(),g=n.getThousandsSeparator(),v=[];if(t.visible){var f=null!==(i=null!==(e=h[c])&&void 0!==e?e:h[c-1])&&void 0!==i?i:{};it(t,c,o,(function(e,i){if(W(e.title)){var n=i.color,o=f[e.key];R(o)&&(o=X(o,t.precision),t.shouldFormatBigNumber&&(o=d.formatBigNumber(o)),o=p.format(g.format(o))),v.push({title:{text:e.title,color:n},value:{text:null!=o?o:r.defaultValue,color:n}})}})),u.legends=v}if(F(t.createTooltipDataSource)){var y=this.getWidget(),m=y.getPane(),_=m.getChart(),x=t.createTooltipDataSource({chart:_,indicator:t,crosshair:n.getCrosshair(),bounding:y.getBounding(),xAxis:m.getChart().getXAxisPane().getAxisComponent(),yAxis:m.getAxisComponent()}),C=x.name,b=x.calcParamsText,T=x.legends,w=x.icons;if(W(C)&&r.showName&&(u.name=C),W(b)&&r.showParams&&(u.calcParamsText=b),L(w)&&(u.icons=w),L(T)&&t.visible){var S=[],E=o.tooltip.text.color;T.forEach((function(t){var e={text:"",color:E};B(t.title)?e=t.title:e.text=t.title;var i={text:"",color:E};B(t.value)?i=t.value:i.text=t.value,R(Number(i.text))&&(i.text=p.format(g.format(i.text))),S.push({title:e,value:i})})),u.legends=S}}return u},n.prototype.classifyTooltipIcons=function(e){var i=[],n=[],o=[];return e.forEach((function(e){switch(e.position){case t.TooltipIconPosition.Left:i.push(e);break;case t.TooltipIconPosition.Middle:n.push(e);break;case t.TooltipIconPosition.Right:o.push(e)}})),[i,n,o]},n}($e),ai=function(e){function n(t){var i=e.call(this,t)||this;return i._initEvent(),i}return i(n,e),n.prototype._initEvent=function(){var t=this,e=this.getWidget().getPane(),i=e.getId(),n=e.getChart(),o=n.getChartStore();this.registerEvent("mouseMoveEvent",(function(e){var r,a=o.getProgressOverlayInfo();if(null!==a){var s=a.overlay,l=a.paneId;s.isStart()&&(o.updateProgressOverlayInfo(i),l=i);var u=s.points.length-1,h="".concat(at,"point_").concat(u);return s.isDrawing()&&l===i&&(s.eventMoveForDrawing(t._coordinateToPoint(s,e)),null===(r=s.onDrawing)||void 0===r||r.call(s,c({chart:n,overlay:s,figureKey:h,figureIndex:u},e))),t._figureMouseMoveEvent(s,1,h,u,0)(e)}return o.setHoverOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1})).registerEvent("mouseClickEvent",(function(e){var r,a,s=o.getProgressOverlayInfo();if(null!==s){var l=s.overlay,u=s.paneId;l.isStart()&&(o.updateProgressOverlayInfo(i,!0),u=i);var h=l.points.length-1,d="".concat(at,"point_").concat(h);return l.isDrawing()&&u===i&&(l.eventMoveForDrawing(t._coordinateToPoint(l,e)),null===(r=l.onDrawing)||void 0===r||r.call(l,c({chart:n,overlay:l,figureKey:d,figureIndex:h},e)),l.nextStep(),l.isDrawing()||(o.progressOverlayComplete(),null===(a=l.onDrawEnd)||void 0===a||a.call(l,c({chart:n,overlay:l,figureKey:d,figureIndex:h},e)))),t._figureMouseClickEvent(l,1,d,h,0)(e)}return o.setClickOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1})).registerEvent("mouseDoubleClickEvent",(function(e){var r,a=o.getProgressOverlayInfo();if(null!==a){var s=a.overlay,l=a.paneId;if(s.isDrawing()&&l===i&&(s.forceComplete(),!s.isDrawing())){o.progressOverlayComplete();var u=s.points.length-1,h="".concat(at,"point_").concat(u);null===(r=s.onDrawEnd)||void 0===r||r.call(s,c({chart:n,overlay:s,figureKey:h,figureIndex:u},e))}var d=s.points.length-1;return t._figureMouseClickEvent(s,1,"".concat(at,"point_").concat(d),d,0)(e)}return!1})).registerEvent("mouseRightClickEvent",(function(e){var i=o.getProgressOverlayInfo();if(null!==i){var n=i.overlay;if(n.isDrawing()){var r=n.points.length-1;return t._figureMouseRightClickEvent(n,1,"".concat(at,"point_").concat(r),r,0)(e)}}return!1})).registerEvent("mouseUpEvent",(function(t){var e,r=o.getPressedOverlayInfo(),a=r.overlay,s=r.figureIndex,l=r.figureKey;return null!==a&&(null===(e=a.onPressedMoveEnd)||void 0===e||e.call(a,c({chart:n,overlay:a,figureKey:l,figureIndex:s},t))),o.setPressedOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1}),!1})).registerEvent("pressedMouseMoveEvent",(function(e){var i,r,a=o.getPressedOverlayInfo(),s=a.overlay,l=a.figureType,u=a.figureIndex,h=a.figureKey;if(null!==s){if(!(s.lock||null!==(r=null===(i=s.onPressedMoving)||void 0===i?void 0:i.call(s,c({chart:n,overlay:s,figureIndex:u,figureKey:h},e)))&&void 0!==r&&r)){var d=t._coordinateToPoint(s,e);1===l?s.eventPressedPointMove(d,u):s.eventPressedOtherMove(d,t.getWidget().getPane().getChart().getChartStore())}return!0}return!1}))},n.prototype._createFigureEvents=function(t,e,i,n,o,r){var a=null;if(!t.isDrawing()){var s=[];if(L(r)&&(O(r)?r&&(s=["mouseClickEvent","mouseDoubleClickEvent","mouseRightClickEvent","tapEvent","doubleTapEvent","mouseDownEvent","touchStartEvent","mouseMoveEvent","touchMoveEvent"]):s=r),0===s.length)return{mouseMoveEvent:this._figureMouseMoveEvent(t,e,i,n,o),mouseDownEvent:this._figureMouseDownEvent(t,e,i,n,o),mouseClickEvent:this._figureMouseClickEvent(t,e,i,n,o),mouseRightClickEvent:this._figureMouseRightClickEvent(t,e,i,n,o),mouseDoubleClickEvent:this._figureMouseDoubleClickEvent(t,e,i,n,o)};a={},s.includes("mouseMoveEvent")||s.includes("touchMoveEvent")||(a.mouseMoveEvent=this._figureMouseMoveEvent(t,e,i,n,o)),s.includes("mouseDownEvent")||s.includes("touchStartEvent")||(a.mouseDownEvent=this._figureMouseDownEvent(t,e,i,n,o)),s.includes("mouseClickEvent")||s.includes("tapEvent")||(a.mouseClickEvent=this._figureMouseClickEvent(t,e,i,n,o)),s.includes("mouseDoubleClickEvent")||s.includes("doubleTapEvent")||(a.mouseDoubleClickEvent=this._figureMouseDoubleClickEvent(t,e,i,n,o)),s.includes("mouseRightClickEvent")||(a.mouseRightClickEvent=this._figureMouseRightClickEvent(t,e,i,n,o))}return null!=a?a:void 0},n.prototype._figureMouseMoveEvent=function(t,e,i,n,o){var r=this;return function(a){var s=r.getWidget().getPane();return s.getChart().getChartStore().setHoverOverlayInfo({paneId:s.getId(),overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o},a),!0}},n.prototype._figureMouseDownEvent=function(t,e,i,n,o){var r=this;return function(a){var s,l=r.getWidget().getPane(),u=l.getId();return t.startPressedMove(r._coordinateToPoint(t,a)),null===(s=t.onPressedMoveStart)||void 0===s||s.call(t,c({chart:l.getChart(),overlay:t,figureIndex:n,figureKey:i},a)),l.getChart().getChartStore().setPressedOverlayInfo({paneId:u,overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o}),!0}},n.prototype._figureMouseClickEvent=function(t,e,i,n,o){var r=this;return function(a){var s=r.getWidget().getPane(),l=s.getId();return s.getChart().getChartStore().setClickOverlayInfo({paneId:l,overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o},a),!0}},n.prototype._figureMouseDoubleClickEvent=function(t,e,i,n,o){var r=this;return function(e){var o;return null===(o=t.onDoubleClick)||void 0===o||o.call(t,c(c({},e),{chart:r.getWidget().getPane().getChart(),figureIndex:n,figureKey:i,overlay:t})),!0}},n.prototype._figureMouseRightClickEvent=function(t,e,i,n,o){var r=this;return function(e){var o,a;return null!==(a=null===(o=t.onRightClick)||void 0===o?void 0:o.call(t,c({chart:r.getWidget().getPane().getChart(),overlay:t,figureIndex:n,figureKey:i},e)))&&void 0!==a&&a||r.getWidget().getPane().getChart().getChartStore().removeOverlay(t),!0}},n.prototype._coordinateToPoint=function(e,i){var n,o={},r=this.getWidget().getPane(),a=r.getChart(),s=r.getId(),l=a.getChartStore();if(this.coordinateToPointTimestampDataIndexFlag()){var u=a.getXAxisPane().getAxisComponent().convertFromPixel(i.x),c=null!==(n=l.dataIndexToTimestamp(u))&&void 0!==n?n:void 0;o.timestamp=c,o.dataIndex=u}if(this.coordinateToPointValueFlag()){var h=r.getAxisComponent(),d=h.convertFromPixel(i.y);if(e.mode!==t.OverlayMode.Normal&&s===Se&&R(o.dataIndex)){var p=l.getDataByDataIndex(o.dataIndex);if(null!==p){var g=e.modeSensitivity;if(d>p.high)if(e.mode===t.OverlayMode.WeakMagnet){var v=h.convertToPixel(p.high);d<h.convertFromPixel(v-g)&&(d=p.high)}else d=p.high;else if(d<p.low)if(e.mode===t.OverlayMode.WeakMagnet){var f=h.convertToPixel(p.low);d>h.convertFromPixel(f-g)&&(d=p.low)}else d=p.low;else{var y=Math.max(p.open,p.close),m=Math.min(p.open,p.close);d=d>y?d-y<p.high-d?y:p.high:d<m?d-p.low<m-d?p.low:m:y-d<d-m?y:m}}}o.value=d}return o},n.prototype.coordinateToPointValueFlag=function(){return!0},n.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},n.prototype.dispatchEvent=function(t,i,n){return this.getWidget().getPane().getChart().getChartStore().isOverlayDrawing()?this.onEvent(t,i,n):e.prototype.dispatchEvent.call(this,t,i,n)},n.prototype.checkEventOn=function(){return!0},n.prototype.drawImp=function(t){var e=this;this.getCompleteOverlays().forEach((function(i){i.visible&&e._drawOverlay(t,i)}));var i=this.getProgressOverlay();L(i)&&i.visible&&this._drawOverlay(t,i)},n.prototype._drawOverlay=function(t,e){var i=e.points,n=this.getWidget().getPane(),o=n.getChart(),r=o.getChartStore(),a=n.getAxisComponent(),s=o.getXAxisPane().getAxisComponent(),l=i.map((function(t){var e,i=null;R(t.timestamp)&&(i=r.timestampToDataIndex(t.timestamp));var n={x:0,y:0};return R(i)&&(n.x=s.convertToPixel(i)),R(t.value)&&(n.y=null!==(e=null==a?void 0:a.convertToPixel(t.value))&&void 0!==e?e:0),n}));if(l.length>0){var u=[].concat(this.getFigures(e,l));this.drawFigures(t,e,u)}this.drawDefaultFigures(t,e,l)},n.prototype.drawFigures=function(t,e,i){var n=this,o=this.getWidget().getPane().getChart().getStyles().overlay;i.forEach((function(i,r){var a=i.type,s=i.styles,l=i.attrs,u=i.ignoreEvent;[].concat(l).forEach((function(l,h){var d,p,g,v=n._createFigureEvents(e,2,null!==(d=i.key)&&void 0!==d?d:"",r,h,u),f=c(c(c({},o[a]),null===(p=e.styles)||void 0===p?void 0:p[a]),s);null===(g=n.createFigure({name:a,attrs:l,styles:f},v))||void 0===g||g.draw(t)}))}))},n.prototype.getCompleteOverlays=function(){var t=this.getWidget().getPane();return t.getChart().getChartStore().getOverlaysByPaneId(t.getId())},n.prototype.getProgressOverlay=function(){var t=this.getWidget().getPane(),e=t.getChart().getChartStore().getProgressOverlayInfo();return L(e)&&e.paneId===t.getId()?e.overlay:null},n.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createPointFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},n.prototype.drawDefaultFigures=function(t,e,i){var n,o,r=this;if(e.needDefaultPointFigure){var a=this.getWidget().getPane().getChart().getChartStore(),s=a.getHoverOverlayInfo(),l=a.getClickOverlayInfo();if((null===(n=s.overlay)||void 0===n?void 0:n.id)===e.id&&0!==s.figureType||(null===(o=l.overlay)||void 0===o?void 0:o.id)===e.id&&0!==l.figureType){var u=a.getStyles().overlay,h=e.styles,d=c(c({},u.point),null==h?void 0:h.point);i.forEach((function(i,n){var o,a,l,u=i.x,c=i.y,h=d.radius,p=d.color,g=d.borderColor,v=d.borderSize;(null===(o=s.overlay)||void 0===o?void 0:o.id)===e.id&&1===s.figureType&&s.figureIndex===n&&(h=d.activeRadius,p=d.activeColor,g=d.activeBorderColor,v=d.activeBorderSize),null===(a=r.createFigure({name:"circle",attrs:{x:u,y:c,r:h+v},styles:{color:g}},r._createFigureEvents(e,1,"".concat(at,"point_").concat(n),n,0)))||void 0===a||a.draw(t),null===(l=r.createFigure({name:"circle",attrs:{x:u,y:c,r:h},styles:{color:p}}))||void 0===l||l.draw(t)}))}}},n}($e),si=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._gridView=new ti(n),n._indicatorView=new ni(n),n._crosshairLineView=new oi(n),n._tooltipView=n.createTooltipView(),n._overlayView=new ai(n),n.addChild(n._tooltipView),n.addChild(n._overlayView),n.getContainer().style.cursor="crosshair",n.registerEvent("mouseMoveEvent",(function(){return i.getChart().getChartStore().setActiveTooltipIcon(),!1})),n}return i(e,t),e.prototype.getName=function(){return De},e.prototype.updateMain=function(t){"minimize"!==this.getPane().getOptions().state&&(this.updateMainContent(t),this._indicatorView.draw(t),this._gridView.draw(t))},e.prototype.createTooltipView=function(){return new ri(this)},e.prototype.updateMainContent=function(t){},e.prototype.updateOverlay=function(t){"minimize"!==this.getPane().getOptions().state&&(this._overlayView.draw(t),this._crosshairLineView.draw(t)),this._tooltipView.draw(t)},e}(Oe),li=function(t){function e(){var e=t.apply(this,f([],v(arguments),!1))||this;return e._ripplePoint=e.createFigure({name:"circle",attrs:{x:0,y:0,r:0},styles:{style:"fill"}}),e._animationFrameTime=0,e._animation=new gt({iterationCount:1/0}).doFrame((function(t){e._animationFrameTime=t;var i=e.getWidget().getPane();i.getChart().updatePane(0,i.getId())})),e}return i(e,t),e.prototype.drawImp=function(t){var e,i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=a.getDataList().length-1,l=o.getBounding(),u=r.getAxisComponent(),c=a.getStyles().candle.area,h=[],d=Number.MAX_SAFE_INTEGER,p=Number.MIN_SAFE_INTEGER,g=null;if(this.eachChildren((function(t){var e=t.data,i=t.x,n=null==e?void 0:e[c.value];if(R(n)){var o=u.convertToPixel(n);p===Number.MIN_SAFE_INTEGER&&(p=i),h.push({x:i,y:o}),d=Math.min(d,o),t.dataIndex===s&&(g={x:i,y:o})}})),h.length>0){null===(e=this.createFigure({name:"line",attrs:{coordinates:h},styles:{color:c.lineColor,size:c.lineSize,smooth:c.smooth}}))||void 0===e||e.draw(t);var v=c.backgroundColor,f="";if(A(v)){var y=t.createLinearGradient(0,l.height,0,d);try{v.forEach((function(t){var e=t.offset,i=t.color;y.addColorStop(e,i)}))}catch(t){}f=y}else f=v;t.fillStyle=f,t.beginPath(),t.moveTo(p,l.height),t.lineTo(h[0].x,h[0].y),ce(t,h,c.smooth),t.lineTo(h[h.length-1].x,l.height),t.closePath(),t.fill()}var m=c.point;if(m.show&&L(g)){null===(i=this.createFigure({name:"circle",attrs:{x:g.x,y:g.y,r:m.radius},styles:{style:"fill",color:m.color}}))||void 0===i||i.draw(t);var _=m.rippleRadius;m.animation&&(_=m.radius+this._animationFrameTime/m.animationDuration*(m.rippleRadius-m.radius),this._animation.setDuration(m.animationDuration).start()),null===(n=this._ripplePoint)||void 0===n||n.setAttrs({x:g.x,y:g.y,r:_}).setStyles({style:"fill",color:m.rippleColor}).draw(t)}else this.stopAnimation()},e.prototype.stopAnimation=function(){this._animation.stop()},e}(ei),ui=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e=this.getWidget().getPane(),i=e.getChart().getChartStore(),n=i.getStyles().candle.priceMark,o=n.high,r=n.low;if(n.show&&(o.show||r.show)){var a=i.getVisibleRangeHighLowPrice(),s=i.getPrecision(),l=e.getAxisComponent(),u=a[0],c=u.price,h=u.x,d=a[1],p=d.price,g=d.x,v=l.convertToPixel(c),f=l.convertToPixel(p),y=i.getDecimalFold(),m=i.getThousandsSeparator();o.show&&c!==Number.MIN_SAFE_INTEGER&&this._drawMark(t,y.format(m.format(X(c,s.price))),{x:h,y:v},v<f?[-2,-5]:[2,5],o),r.show&&p!==Number.MAX_SAFE_INTEGER&&this._drawMark(t,y.format(m.format(X(p,s.price))),{x:g,y:f},v<f?[2,5]:[-2,-5],r)}},e.prototype._drawMark=function(t,e,i,n,o){var r,a,s,l=i.x,u=i.y+n[0];null===(r=this.createFigure({name:"line",attrs:{coordinates:[{x:l-2,y:u+n[0]},{x:l,y:u},{x:l+2,y:u+n[0]}]},styles:{color:o.color}}))||void 0===r||r.draw(t);var c=0,h=0,d="left";l>this.getWidget().getBounding().width/2?(h=(c=l-5)-o.textOffset,d="right"):(d="left",h=(c=l+5)+o.textOffset);var p=u+n[1];null===(a=this.createFigure({name:"line",attrs:{coordinates:[{x:l,y:u},{x:l,y:p},{x:c,y:p}]},styles:{color:o.color}}))||void 0===a||a.draw(t),null===(s=this.createFigure({name:"text",attrs:{x:h,y:p,text:e,align:d,baseline:"middle"},styles:{color:o.color,size:o.textSize,family:o.textFamily,weight:o.textWeight}}))||void 0===s||s.draw(t)},e}($e),ci=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=n.getChart().getChartStore(),a=r.getStyles().candle.priceMark,s=a.last,l=s.line;if(a.show&&s.show&&l.show){var u=n.getAxisComponent(),c=r.getDataList(),h=c[c.length-1];if(L(h)){var d=h.close,p=h.open,g=u.convertToNicePixel(d),v="";v=d>p?s.upColor:d<p?s.downColor:s.noChangeColor,null===(e=this.createFigure({name:"line",attrs:{coordinates:[{x:0,y:g},{x:o.width,y:g}]},styles:{style:l.style,color:v,size:l.size,dashedValue:l.dashedValue}}))||void 0===e||e.draw(t)}}},e}($e);!function(t){t.Left="left",t.Right="right"}(Qe||(Qe={}));var hi=function(){function t(t){this.scrollZoomEnabled=!0,this._range={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0,displayFrom:0,displayTo:0,displayRange:0},this._prevRange={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0,displayFrom:0,displayTo:0,displayRange:0},this._ticks=[],this._autoCalcTickFlag=!0,this._parent=t}return t.prototype.getParent=function(){return this._parent},t.prototype.buildTicks=function(t){return this._autoCalcTickFlag&&(this._range=this.createRangeImp()),!(this._prevRange.from===this._range.from&&this._prevRange.to===this._range.to&&!t)&&(this._prevRange=this._range,this._ticks=this.createTicksImp(),!0)},t.prototype.getTicks=function(){return this._ticks},t.prototype.setRange=function(t){this._autoCalcTickFlag=!1,this._range=t},t.prototype.getRange=function(){return this._range},t.prototype.setAutoCalcTickFlag=function(t){this._autoCalcTickFlag=t},t.prototype.getAutoCalcTickFlag=function(){return this._autoCalcTickFlag},t}(),di={"zh-CN":{time:"时间:",open:"开:",high:"高:",low:"低:",close:"收:",volume:"成交量:",turnover:"成交额:",change:"涨幅:"},"en-US":{time:"Time: ",open:"Open: ",high:"High: ",low:"Low: ",close:"Close: ",volume:"Volume: ",turnover:"Turnover: ",change:"Change: "}};var pi=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.drawImp=function(e){var i=this.getWidget(),n=i.getPane().getChart().getChartStore(),o=n.getCrosshair();if(L(o.kLineData)){var r=i.getBounding(),a=n.getStyles(),s=a.candle,l=a.indicator;if(s.tooltip.showType===t.TooltipShowType.Rect&&l.tooltip.showType===t.TooltipShowType.Rect){var u=this.isDrawTooltip(o,s.tooltip),c=this.isDrawTooltip(o,l.tooltip);this._drawRectTooltip(e,u,c,s.tooltip.offsetTop)}else if(s.tooltip.showType===t.TooltipShowType.Standard&&l.tooltip.showType===t.TooltipShowType.Standard){var h=s.tooltip,d=h.offsetLeft,p=h.offsetTop,g=h.offsetRight,v=r.width-g,f=this._drawCandleStandardTooltip(e,d,p,v);this.drawIndicatorTooltip(e,d,f,v)}else if(s.tooltip.showType===t.TooltipShowType.Rect&&l.tooltip.showType===t.TooltipShowType.Standard){var y=s.tooltip,m=(d=y.offsetLeft,p=y.offsetTop,g=y.offsetRight,v=r.width-g,this.drawIndicatorTooltip(e,d,p,v));u=this.isDrawTooltip(o,s.tooltip);this._drawRectTooltip(e,u,!1,m)}else{var _=s.tooltip,x=(d=_.offsetLeft,p=_.offsetTop,g=_.offsetRight,v=r.width-g,this._drawCandleStandardTooltip(e,d,p,v));c=this.isDrawTooltip(o,l.tooltip);this._drawRectTooltip(e,!1,c,x)}}},n.prototype._drawCandleStandardTooltip=function(t,e,i,n){var o=this.getWidget().getPane().getChart().getChartStore(),r=o.getStyles().candle.tooltip,a=r.text,s=0,l={x:e,y:i},u=o.getCrosshair();if(this.isDrawTooltip(u,r)){var c=this._getCandleTooltipLegends(),h=v(this.classifyTooltipIcons(r.icons),3),d=h[0],p=h[1],g=h[2];s=this.drawStandardTooltipIcons(t,d,l,"",e,s,n),s=this.drawStandardTooltipIcons(t,p,l,"",e,s,n),c.length>0&&(s=this.drawStandardTooltipLegends(t,c,l,e,s,n,a)),s=this.drawStandardTooltipIcons(t,g,l,"",e,s,n)}return l.y+s},n.prototype._drawRectTooltip=function(e,i,n,o){var r,a,s=this,l=this.getWidget(),u=l.getPane(),c=u.getChart().getChartStore(),h=c.getStyles(),d=h.candle,p=h.indicator,g=d.tooltip,v=p.tooltip;if(i||n){var f=this._getCandleTooltipLegends(),y=g.offsetLeft,m=g.offsetTop,_=g.offsetRight,x=g.offsetBottom,C=g.text,b=C.marginLeft,T=C.marginRight,w=C.marginTop,S=C.marginBottom,E=C.size,P=C.weight,I=C.family,k=g.rect,M=k.position,D=k.paddingLeft,A=k.paddingRight,F=k.paddingTop,B=k.paddingBottom,R=k.offsetLeft,L=k.offsetRight,O=k.offsetTop,W=k.offsetBottom,z=k.borderSize,V=k.borderRadius,N=k.borderColor,Y=k.color,H=0,X=0,G=0;i&&(e.font=J(E,P,I),f.forEach((function(t){var i=t.title,n=t.value,o="".concat(i.text).concat(n.text),r=e.measureText(o).width+b+T;H=Math.max(H,r)})),G+=(S+w+E)*f.length);var K=v.text,U=K.marginLeft,j=K.marginRight,Z=K.marginTop,q=K.marginBottom,Q=K.size,$=K.weight,tt=K.family,et=[];if(n){var it=c.getIndicatorsByPaneId(u.getId());e.font=J(Q,$,tt),it.forEach((function(t){var i=s.getIndicatorTooltipData(t).legends;et.push(i),i.forEach((function(t){var i=t.title,n=t.value,o="".concat(i.text).concat(n.text),r=e.measureText(o).width+U+j;H=Math.max(H,r),G+=Z+q+Q}))}))}if(0!==(X+=H)&&0!==G){var nt=c.getCrosshair(),ot=l.getBounding(),rt=u.getYAxisWidget().getBounding();X+=2*z+D+A,G+=2*z+F+B;var at=ot.width/2,st=M===t.CandleTooltipRectPosition.Pointer&&nt.paneId===Se,lt=(null!==(r=nt.realX)&&void 0!==r?r:0)>at,ut=0;if(st){var ct=nt.realX;ut=lt?ct-L-X:ct+R}else{var ht=this.getWidget().getPane().getAxisComponent();lt?(ut=R+y,ht.inside&&ht.position===Qe.Left&&(ut+=rt.width)):(ut=ot.width-L-X-_,ht.inside&&ht.position===Qe.Right&&(ut-=rt.width))}var dt=o+O;if(st)(dt=nt.y-G/2)+G>ot.height-W-x&&(dt=ot.height-W-G-x),dt<o+O&&(dt=o+O+m);null===(a=this.createFigure({name:"rect",attrs:{x:ut,y:dt,width:X,height:G},styles:{style:t.PolygonType.StrokeFill,color:Y,borderColor:N,borderSize:z,borderRadius:V}}))||void 0===a||a.draw(e);var pt=ut+z+D+b,gt=dt+z+F;if(i&&f.forEach((function(t){var i,n;gt+=w;var o=t.title;null===(i=s.createFigure({name:"text",attrs:{x:pt,y:gt,text:o.text},styles:{color:o.color,size:E,family:I,weight:P}}))||void 0===i||i.draw(e);var r=t.value;null===(n=s.createFigure({name:"text",attrs:{x:ut+X-z-T-A,y:gt,text:r.text,align:"right"},styles:{color:r.color,size:E,family:I,weight:P}}))||void 0===n||n.draw(e),gt+=E+S})),n){var vt=ut+z+D+U;et.forEach((function(t){t.forEach((function(t){var i,n;gt+=Z;var o=t.title,r=t.value;null===(i=s.createFigure({name:"text",attrs:{x:vt,y:gt,text:o.text},styles:{color:o.color,size:Q,family:tt,weight:$}}))||void 0===i||i.draw(e),null===(n=s.createFigure({name:"text",attrs:{x:ut+X-z-j-A,y:gt,text:r.text,align:"right"},styles:{color:r.color,size:Q,family:tt,weight:$}}))||void 0===n||n.draw(e),gt+=Q+q}))}))}}}},n.prototype._getCandleTooltipLegends=function(){var e,i,n,o,r,a,s=this.getWidget().getPane().getChart().getChartStore(),l=s.getStyles().candle,u=s.getDataList(),h=s.getCustomApi(),d=s.getDecimalFold(),p=s.getThousandsSeparator(),g=s.getLocale(),v=s.getPrecision(),f=v.price,y=v.volume,m=null!==(e=s.getCrosshair().dataIndex)&&void 0!==e?e:0,_=l.tooltip,x=_.text.color,C=null!==(i=u[m-1])&&void 0!==i?i:null,b=u[m],T=null!==(n=null==C?void 0:C.close)&&void 0!==n?n:b.close,w=b.close-T,S={"{time}":h.formatDate(b.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Tooltip),"{open}":d.format(p.format(X(b.open,f))),"{high}":d.format(p.format(X(b.high,f))),"{low}":d.format(p.format(X(b.low,f))),"{close}":d.format(p.format(X(b.close,f))),"{volume}":d.format(p.format(h.formatBigNumber(X(null!==(o=b.volume)&&void 0!==o?o:_.defaultValue,y)))),"{turnover}":d.format(p.format(X(null!==(r=b.turnover)&&void 0!==r?r:_.defaultValue,f))),"{change}":0===T?_.defaultValue:"".concat(p.format(X(w/T*100)),"%")};return(F(_.custom)?_.custom({prev:C,current:b,next:null!==(a=u[m+1])&&void 0!==a?a:null},l):_.custom).map((function(t){var e,i=t.title,n=t.value,o={text:"",color:x};B(i)?o=c({},i):o.text=i,o.text=function(t,e){var i;return null!==(i=di[e][t])&&void 0!==i?i:t}(o.text,g);var r={text:_.defaultValue,color:x};B(n)?r=c({},n):r.text=n;var a=/{(\S*)}/.exec(r.text);if(null!==a&&a.length>1){var s="{".concat(a[1],"}");r.text=r.text.replace(s,null!==(e=S[s])&&void 0!==e?e:_.defaultValue),"{change}"===s&&(r.color=0===w?l.priceMark.last.noChangeColor:w>0?l.priceMark.last.upColor:l.priceMark.last.downColor)}return{title:o,value:r}}))},n}(ri),gi=function(e){function n(t,i){var n=e.call(this,t,i)||this;return n._candleBarView=new ii(n),n._candleAreaView=new li(n),n._candleHighLowPriceView=new ui(n),n._candleLastPriceLineView=new ci(n),n.addChild(n._candleBarView),n}return i(n,e),n.prototype.updateMainContent=function(e){this.getPane().getChart().getStyles().candle.type!==t.CandleType.Area?(this._candleBarView.draw(e),this._candleHighLowPriceView.draw(e),this._candleAreaView.stopAnimation()):this._candleAreaView.draw(e),this._candleLastPriceLineView.draw(e)},n.prototype.createTooltipView=function(){return new pi(this)},n}(si),vi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t,e){var i,n,o=this,r=this.getWidget(),a=r.getPane(),s=r.getBounding(),l=a.getAxisComponent(),u=this.getAxisStyles(a.getChart().getStyles());if(u.show&&(u.axisLine.show&&(null===(i=this.createFigure({name:"line",attrs:this.createAxisLine(s,u),styles:u.axisLine}))||void 0===i||i.draw(t)),!e[0])){var c=l.getTicks();if(u.tickLine.show)this.createTickLines(c,s,u).forEach((function(e){var i;null===(i=o.createFigure({name:"line",attrs:e,styles:u.tickLine}))||void 0===i||i.draw(t)}));if(u.tickText.show){var h=this.createTickTexts(c,s,u);null===(n=this.createFigure({name:"text",attrs:h,styles:u.tickText}))||void 0===n||n.draw(t)}}},e}($e),fi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.getAxisStyles=function(t){return t.yAxis},e.prototype.createAxisLine=function(t,e){var i=this.getWidget().getPane().getAxisComponent(),n=e.axisLine.size,o=0;return{coordinates:[{x:o=i.isFromZero()?0:t.width-n,y:0},{x:o,y:t.height}]}},e.prototype.createTickLines=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),o=i.axisLine,r=i.tickLine,a=0,s=0;return n.isFromZero()?(a=0,o.show&&(a+=o.size),s=a+r.length):(a=e.width,o.show&&(a-=o.size),s=a-r.length),t.map((function(t){return{coordinates:[{x:a,y:t.coord},{x:s,y:t.coord}]}}))},e.prototype.createTickTexts=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),o=i.axisLine,r=i.tickLine,a=i.tickText,s=0;n.isFromZero()?(s=a.marginStart,o.show&&(s+=o.size),r.show&&(s+=r.length)):(s=e.width-a.marginEnd,o.show&&(s-=o.size),r.show&&(s-=r.length));var l=this.getWidget().getPane().getAxisComponent().isFromZero()?"left":"right";return t.map((function(t){return{x:s,y:t.coord,text:t.text,align:l,baseline:"middle"}}))},e}(vi),yi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=n.getChart().getChartStore(),a=r.getStyles().candle.priceMark,s=a.last,l=s.text;if(a.show&&s.show&&l.show){var u=r.getPrecision(),h=n.getAxisComponent(),d=r.getDataList(),p=d[d.length-1];if(L(p)){var g=p.close,v=p.open,f=h.convertToNicePixel(g),y="";y=g>v?s.upColor:g<v?s.downColor:s.noChangeColor;var m=h.getRange(),_=h.displayValueToText(h.realValueToDisplayValue(h.valueToRealValue(g,{range:m}),{range:m}),u.price);_=r.getDecimalFold().format(r.getThousandsSeparator().format(_));var x=0,C="left";h.isFromZero()?(x=0,C="left"):(x=o.width,C="right"),null===(e=this.createFigure({name:"text",attrs:{x:x,y:f,text:_,align:C,baseline:"middle"},styles:c(c({},l),{backgroundColor:y})}))||void 0===e||e.draw(t)}}},e}($e),mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e=this,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=n.getChart().getChartStore(),a=r.getStyles().indicator,s=a.lastValueMark,l=s.text;if(s.show){var u=n.getAxisComponent(),h=u.getRange(),d=r.getDataList().length-1,p=r.getIndicatorsByPaneId(n.getId()),g=r.getCustomApi(),v=r.getDecimalFold(),f=r.getThousandsSeparator();p.forEach((function(i){var n,r,s=i.result,p=null!==(r=null!==(n=s[d])&&void 0!==n?n:s[d-1])&&void 0!==r?r:{};if(L(p)&&i.visible){var y=i.precision;it(i,d,a,(function(n,r){var a,s=p[n.key];if(R(s)){var d=u.convertToNicePixel(s),m=u.displayValueToText(u.realValueToDisplayValue(u.valueToRealValue(s,{range:h}),{range:h}),y);i.shouldFormatBigNumber&&(m=g.formatBigNumber(m)),m=v.format(f.format(m));var _=0,x="left";u.isFromZero()?(_=0,x="left"):(_=o.width,x="right"),null===(a=e.createFigure({name:"text",attrs:{x:_,y:d,text:m,align:x,baseline:"middle"},styles:c(c({},l),{backgroundColor:r.color})}))||void 0===a||a.draw(t)}}))}}))}},e}($e),_i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!1},e.prototype.drawDefaultFigures=function(t,e,i){this.drawFigures(t,e,this.getDefaultFigures(e,i))},e.prototype.getDefaultFigures=function(t,e){var i,n=this.getWidget(),o=n.getPane(),r=o.getChart().getChartStore(),a=r.getClickOverlayInfo(),s=[];if(t.needDefaultYAxisFigure&&t.id===(null===(i=a.overlay)||void 0===i?void 0:i.id)&&a.paneId===o.getId()){var l=o.getAxisComponent(),u=n.getBounding(),c=Number.MAX_SAFE_INTEGER,h=Number.MIN_SAFE_INTEGER,d=l.isFromZero(),p="left",g=0;d?(p="left",g=0):(p="right",g=u.width);var v=r.getDecimalFold(),f=r.getThousandsSeparator();e.forEach((function(e,i){var n=t.points[i];if(R(n.value)){c=Math.min(c,e.y),h=Math.max(h,e.y);var o=v.format(f.format(X(n.value,r.getPrecision().price)));s.push({type:"text",attrs:{x:g,y:e.y,text:o,align:p,baseline:"middle"},ignoreEvent:!0})}})),e.length>1&&s.unshift({type:"rect",attrs:{x:0,y:c,width:u.width,height:h-c},ignoreEvent:!0})}return s},e.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createYAxisFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},e}(ai),xi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=i.getPane().getChart().getChartStore(),a=r.getCrosshair(),s=r.getStyles().crosshair;if(W(a.paneId)&&this.compare(a,n.getId())&&s.show){var l=this.getDirectionStyles(s),u=l.text;if(l.show&&u.show){var c=n.getAxisComponent(),h=this.getText(a,r,c);t.font=J(u.size,u.weight,u.family),null===(e=this.createFigure({name:"text",attrs:this.getTextAttrs(h,t.measureText(h).width,a,o,c,u),styles:u}))||void 0===e||e.draw(t)}}},e.prototype.compare=function(t,e){return t.paneId===e},e.prototype.getDirectionStyles=function(t){return t.horizontal},e.prototype.getText=function(t,e,i){var n=i,o=i.convertFromPixel(t.y),r=0,a=!1;n.isInCandle()?r=e.getPrecision().price:e.getIndicatorsByPaneId(t.paneId).forEach((function(t){r=Math.max(t.precision,r),a||(a=t.shouldFormatBigNumber)}));var s=n.getRange(),l=n.displayValueToText(n.realValueToDisplayValue(n.valueToRealValue(o,{range:s}),{range:s}),r);return a&&(l=e.getCustomApi().formatBigNumber(l)),e.getDecimalFold().format(e.getThousandsSeparator().format(l))},e.prototype.getTextAttrs=function(t,e,i,n,o,r){var a=0,s="left";return o.isFromZero()?(a=0,s="left"):(a=n.width,s="right"),{x:a,y:i.y,text:t,align:s,baseline:"middle"}},e}($e),Ci=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._yAxisView=new fi(n),n._candleLastPriceLabelView=new yi(n),n._indicatorLastValueView=new mi(n),n._overlayYAxisView=new _i(n),n._crosshairHorizontalLabelView=new xi(n),n.getContainer().style.cursor="ns-resize",n.addChild(n._overlayYAxisView),n}return i(e,t),e.prototype.getName=function(){return Fe},e.prototype.updateMain=function(t){var e="minimize"===this.getPane().getOptions().state;this._yAxisView.draw(t,e),e||(this.getPane().getAxisComponent().isInCandle()&&this._candleLastPriceLabelView.draw(t),this._indicatorLastValueView.draw(t))},e.prototype.updateOverlay=function(t){"minimize"!==this.getPane().getOptions().state&&(this._overlayYAxisView.draw(t),this._crosshairHorizontalLabelView.draw(t))},e}(Oe),bi=function(e){function n(t,i){var n=e.call(this,t)||this;return n.reverse=!1,n.inside=!1,n.position=Qe.Right,n.gap={top:.2,bottom:.1},n.createRange=function(t){return t.defaultRange},n.minSpan=function(t){return Tt(-t)},n.valueToRealValue=function(t){return t},n.realValueToDisplayValue=function(t){return t},n.displayValueToRealValue=function(t){return t},n.realValueToValue=function(t){return t},n.displayValueToText=function(t,e){return X(t,e)},n.override(i),n}return i(n,e),n.prototype.override=function(t){var e=t.name,i=t.gap,n=h(t,["name","gap"]);W(this.name)||(this.name=e),M(this.gap,i),M(this,n)},n.prototype.createRangeImp=function(){var e=this.getParent(),i=e.getChart(),n=i.getChartStore(),o=e.getId(),r=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER,s=!1,l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,h=n.getIndicatorsByPaneId(o);h.forEach((function(t){s||(s=t.shouldOhlc),c=Math.min(c,t.precision),R(t.minValue)&&(l=Math.min(l,t.minValue)),R(t.maxValue)&&(u=Math.max(u,t.maxValue))}));var d=4,p=this.isInCandle();if(p){var g=n.getPrecision().price;d=c!==Number.MAX_SAFE_INTEGER?Math.min(c,g):g}else c!==Number.MAX_SAFE_INTEGER&&(d=c);var v=n.getVisibleRangeDataList(),f=i.getStyles().candle,y=f.type===t.CandleType.Area,m=f.area.value,_=p&&!y||!p&&s;v.forEach((function(t){var e=t.dataIndex,i=t.data;if(L(i)&&(_&&(r=Math.min(r,i.low),a=Math.max(a,i.high)),p&&y)){var n=i[m];R(n)&&(r=Math.min(r,n),a=Math.max(a,n))}h.forEach((function(t){var i,n=t.result,o=t.figures,s=null!==(i=n[e])&&void 0!==i?i:{};o.forEach((function(t){var e=s[t.key];R(e)&&(r=Math.min(r,e),a=Math.max(a,e))}))}))})),r!==Number.MAX_SAFE_INTEGER&&a!==Number.MIN_SAFE_INTEGER?(r=Math.min(l,r),a=Math.max(u,a)):(r=0,a=10);var x=a-r,C={from:r,to:a,range:x,realFrom:r,realTo:a,realRange:x,displayFrom:r,displayTo:a,displayRange:x},b=this.createRange({chart:i,paneId:o,defaultRange:C}),T=b.realFrom,w=b.realTo,S=b.realRange,E=this.minSpan(d);if(T===w||S<E){var P=l===T,I=u===w;T=P?T:I?T-8*E:T-4*E,w=I?w:P?w+8*E:w+4*E}var k=this.getBounding().height,M=this.gap,D=M.top;D>=1&&(D/=k);var A=M.bottom;A>=1&&(A/=k),T-=(S=w-T)*A,w+=S*D;var F=this.realValueToValue(T,{range:b}),B=this.realValueToValue(w,{range:b}),O=this.realValueToDisplayValue(T,{range:b}),W=this.realValueToDisplayValue(w,{range:b});return{from:F,to:B,range:B-F,realFrom:T,realTo:w,realRange:w-T,displayFrom:O,displayTo:W,displayRange:W-O}},n.prototype.isInCandle=function(){return this.getParent().getId()===Se},n.prototype.isFromZero=function(){return this.position===Qe.Left&&this.inside||this.position===Qe.Right&&!this.inside},n.prototype.createTicksImp=function(){var t,e,i=this,n=this.getRange(),o=n.displayFrom,r=n.displayTo,a=n.displayRange,s=[];if(a>=0){var l=function(t){var e=Math.floor(bt(t)),i=Tt(e),n=t/i;return+(t=(n<1.5?1:n<2.5?2:n<3.5?3:n<4.5?4:n<5.5?5:n<6.5?6:8)*i).toFixed(Math.abs(e))}(a/8),u=function(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var o=e.indexOf(".");return o<0?0:e.length-1-o}(l),c=xt(Math.ceil(o/l)*l,u),h=xt(Math.floor(r/l)*l,u),d=0,p=c;if(0!==l)for(;p<=h;){var g=p.toFixed(u);s[d]={text:g,coord:0,value:g},++d,p+=l}}var v=this.getParent(),f=null!==(e=null===(t=v.getYAxisWidget())||void 0===t?void 0:t.getBounding().height)&&void 0!==e?e:0,y=v.getChart().getChartStore(),m=[],_=y.getIndicatorsByPaneId(v.getId()),x=y.getStyles(),C=0,b=!1;this.isInCandle()?C=y.getPrecision().price:_.forEach((function(t){C=Math.max(C,t.precision),b||(b=t.shouldFormatBigNumber)}));var T=y.getCustomApi(),w=y.getThousandsSeparator(),S=y.getDecimalFold(),E=x.xAxis.tickText.size,P=NaN;return s.forEach((function(t){var e=t.value,o=i.displayValueToText(+e,C),r=i.convertToPixel(i.realValueToValue(i.displayValueToRealValue(+e,{range:n}),{range:n}));b&&(o=T.formatBigNumber(e)),o=S.format(w.format(o));var a=R(P);r>E&&r<f-E&&(a&&Math.abs(P-r)>2*E||!a)&&(m.push({text:o,coord:r,value:e}),P=r)})),F(this.createTicks)?this.createTicks({range:this.getRange(),bounding:this.getBounding(),defaultTicks:m}):m},n.prototype.getAutoSize=function(){var t=this.getParent(),e=t.getChart().getChartStore(),i=e.getStyles(),n=i.yAxis,o=n.size;if("auto"!==o)return o;var r=0;if(n.show&&(n.axisLine.show&&(r+=n.axisLine.size),n.tickLine.show&&(r+=n.tickLine.length),n.tickText.show)){var a=0;this.getTicks().forEach((function(t){a=Math.max(a,Q(t.text,n.tickText.size,n.tickText.weight,n.tickText.family))})),r+=n.tickText.marginStart+n.tickText.marginEnd+a}var s=i.crosshair,l=0;if(s.show&&s.horizontal.show&&s.horizontal.text.show){var u=e.getIndicatorsByPaneId(t.getId()),c=0,h=!1;u.forEach((function(t){c=Math.max(t.precision,c),h||(h=t.shouldFormatBigNumber)}));var d=2;if(this.isInCandle()){var p=e.getPrecision().price,g=i.indicator.lastValueMark;d=g.show&&g.text.show?Math.max(c,p):p}else d=c;var v=X(this.getRange().displayTo,d);h&&(v=e.getCustomApi().formatBigNumber(v)),v=e.getDecimalFold().format(v),l+=s.horizontal.text.paddingLeft+s.horizontal.text.paddingRight+2*s.horizontal.text.borderSize+Q(v,s.horizontal.text.size,s.horizontal.text.weight,s.horizontal.text.family)}return Math.max(r,l)},n.prototype.getBounding=function(){return this.getParent().getYAxisWidget().getBounding()},n.prototype.convertFromPixel=function(t){var e=this.getBounding().height,i=this.getRange(),n=i.realFrom,o=i.realRange,r=(this.reverse?t/e:1-t/e)*o+n;return this.realValueToValue(r,{range:i})},n.prototype.convertToPixel=function(t){var e,i,n=this.getRange(),o=this.valueToRealValue(t,{range:n}),r=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,a=(o-n.realFrom)/n.realRange;return this.reverse?Math.round(a*r):Math.round((1-a)*r)},n.prototype.convertToNicePixel=function(t){var e,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,o=this.convertToPixel(t);return Math.round(Math.max(.05*n,Math.min(o,.98*n)))},n.extend=function(t){var e=function(e){function n(i){return e.call(this,i,t)||this}return i(n,e),n}(n);return e},n}(hi),Ti={name:"percentage",minSpan:function(){return Math.pow(10,-2)},displayValueToText:function(t){return"".concat(X(t,2),"%")},valueToRealValue:function(t,e){var i=e.range;return(t-i.from)/i.range*i.realRange+i.realFrom},realValueToValue:function(t,e){var i=e.range;return(t-i.realFrom)/i.realRange*i.range+i.from},createRange:function(t){var e=t.chart,i=t.defaultRange,n=e.getDataList()[e.getVisibleRange().from];if(L(n)){var o=i.from,r=i.to,a=i.range,s=(i.from-n.close)/n.close*100,l=(i.to-n.close)/n.close*100,u=l-s;return{from:o,to:r,range:a,realFrom:s,realTo:l,realRange:u,displayFrom:s,displayTo:l,displayRange:u}}return i}},wi={name:"logarithm",minSpan:function(t){return.05*Tt(-t)},valueToRealValue:function(t){return t<0?-bt(Math.abs(t)):bt(t)},realValueToDisplayValue:function(t){return t<0?-Tt(Math.abs(t)):Tt(t)},displayValueToRealValue:function(t){return t<0?-bt(Math.abs(t)):bt(t)},realValueToValue:function(t){return t<0?-Tt(Math.abs(t)):Tt(t)},createRange:function(t){var e=t.defaultRange,i=e.from,n=e.to,o=e.range,r=i<0?-bt(Math.abs(i)):bt(i),a=n<0?-bt(Math.abs(n)):bt(n);return{from:i,to:n,range:o,realFrom:r,realTo:a,realRange:a-r,displayFrom:i,displayTo:n,displayRange:o}}},Si={normal:bi.extend({name:"normal"}),percentage:bi.extend(Ti),logarithm:bi.extend(wi)};var Ei=function(){function t(t,e,i,n){this._bounding=lt(),this._originalBounding=lt(),this._visible=!0,this._chart=i,this._id=n,this._init(t,e)}return t.prototype._init=function(t,e){this._rootContainer=t,this._container=mt("div",{width:"100%",margin:"0",padding:"0",position:"relative",overflow:"hidden",boxSizing:"border-box"}),null!==e?t.insertBefore(this._container,e):t.appendChild(this._container)},t.prototype.getContainer=function(){return this._container},t.prototype.setVisible=function(t){this._visible!==t&&(this._container.style.display=t?"block":"none",this._visible=t)},t.prototype.getVisible=function(){return this._visible},t.prototype.getId=function(){return this._id},t.prototype.getChart=function(){return this._chart},t.prototype.getBounding=function(){return this._bounding},t.prototype.setOriginalBounding=function(t){M(this._originalBounding,t)},t.prototype.getOriginalBounding=function(){return this._originalBounding},t.prototype.update=function(t){this._bounding.height!==this._container.clientHeight&&(this._container.style.height="".concat(this._bounding.height,"px")),this.updateImp(null!=t?t:3,this._container,this._bounding)},t.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},t}(),Pi=function(t){function e(e,i,n,o,r){var a=t.call(this,e,i,n,o)||this;a._yAxisWidget=null,a._options={id:"",minHeight:30,dragEnabled:!0,order:0,height:100,state:"normal",axis:{name:"normal",scrollZoomEnabled:!0}};var s=a.getContainer();return a._mainWidget=a.createMainWidget(s),a._yAxisWidget=a.createYAxisWidget(s),a.setOptions(r),a}return i(e,t),e.prototype.setOptions=function(t){var e,i,n,o,r,a=this.getId();if(a===Se||a===Pe){var s=null===(e=t.axis)||void 0===e?void 0:e.name;(!L(this._axis)||L(s)&&this._options.axis.name!==s)&&(this._axis=this.createAxisComponent(null!=s?s:"normal"))}else L(this._axis)||(this._axis=this.createAxisComponent("normal"));this._axis instanceof bi&&this._axis.setAutoCalcTickFlag(!0),M(this._options,t),this._axis.override(c(c({},this._options.axis),{name:null!==(n=null===(i=t.axis)||void 0===i?void 0:i.name)&&void 0!==n?n:"normal"}));var l=null,u="default";return this.getId()===Pe?(l=this.getMainWidget().getContainer(),u="ew-resize"):(l=this.getYAxisWidget().getContainer(),u="ns-resize"),null===(r=null===(o=t.axis)||void 0===o?void 0:o.scrollZoomEnabled)||void 0===r||r?l.style.cursor=u:l.style.cursor="default",this},e.prototype.getOptions=function(){return this._options},e.prototype.getAxisComponent=function(){return this._axis},e.prototype.setBounding=function(t,e,i,n){var o,r,a,s;M(this.getBounding(),t);var l={};L(t.height)&&(l.height=t.height),L(t.top)&&(l.top=t.top),this._mainWidget.setBounding(l);var u=L(e);(u&&this._mainWidget.setBounding(e),L(this._yAxisWidget))&&(this._yAxisWidget.setBounding(l),this._axis.position===Qe.Left?L(i)&&this._yAxisWidget.setBounding(c(c({},i),{left:0})):L(n)&&(this._yAxisWidget.setBounding(n),u&&this._yAxisWidget.setBounding({left:(null!==(o=e.left)&&void 0!==o?o:0)+(null!==(r=e.width)&&void 0!==r?r:0)+(null!==(a=e.right)&&void 0!==a?a:0)-(null!==(s=n.width)&&void 0!==s?s:0)})));return this},e.prototype.getMainWidget=function(){return this._mainWidget},e.prototype.getYAxisWidget=function(){return this._yAxisWidget},e.prototype.updateImp=function(t){var e;this._mainWidget.update(t),null===(e=this._yAxisWidget)||void 0===e||e.update(t)},e.prototype.destroy=function(){var e;t.prototype.destroy.call(this),this._mainWidget.destroy(),null===(e=this._yAxisWidget)||void 0===e||e.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=q(o);o.width=i*a,o.height=n*a,r.scale(a,a);var s=this._mainWidget.getBounding();if(r.drawImage(this._mainWidget.getImage(t),s.left,0,s.width,s.height),null!==this._yAxisWidget){var l=this._yAxisWidget.getBounding();r.drawImage(this._yAxisWidget.getImage(t),l.left,0,l.width,l.height)}return o},e.prototype.createYAxisWidget=function(t){return null},e}(Ei),Ii=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createAxisComponent=function(t){var e=function(t){var e;return null!==(e=Si[t])&&void 0!==e?e:Si.normal}(null!=t?t:"default");return new e(this)},e.prototype.createMainWidget=function(t){return new si(t,this)},e.prototype.createYAxisWidget=function(t){return new Ci(t,this)},e}(Pi),ki=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createMainWidget=function(t){return new gi(t,this)},e}(Ii),Mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.getAxisStyles=function(t){return t.xAxis},e.prototype.createAxisLine=function(t){return{coordinates:[{x:0,y:0},{x:t.width,y:0}]}},e.prototype.createTickLines=function(t,e,i){var n=i.tickLine,o=i.axisLine.size;return t.map((function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:o+n.length}]}}))},e.prototype.createTickTexts=function(t,e,i){var n=i.tickText,o=i.axisLine.size,r=i.tickLine.length;return t.map((function(t){return{x:t.coord,y:o+r+n.marginStart,text:t.text,align:"center",baseline:"top"}}))},e}(vi),Di=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},n.prototype.coordinateToPointValueFlag=function(){return!1},n.prototype.getCompleteOverlays=function(){return this.getWidget().getPane().getChart().getChartStore().getOverlaysByPaneId()},n.prototype.getProgressOverlay=function(){var t,e;return null!==(e=null===(t=this.getWidget().getPane().getChart().getChartStore().getProgressOverlayInfo())||void 0===t?void 0:t.overlay)&&void 0!==e?e:null},n.prototype.getDefaultFigures=function(e,i){var n,o=[],r=this.getWidget(),a=r.getPane().getChart().getChartStore(),s=a.getClickOverlayInfo();if(e.needDefaultXAxisFigure&&e.id===(null===(n=s.overlay)||void 0===n?void 0:n.id)){var l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;i.forEach((function(i,n){l=Math.min(l,i.x),u=Math.max(u,i.x);var r=e.points[n];if(R(r.timestamp)){var s=a.getCustomApi().formatDate(r.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair);o.push({type:"text",attrs:{x:i.x,y:0,text:s,align:"center"},ignoreEvent:!0})}})),i.length>1&&o.unshift({type:"rect",attrs:{x:l,y:0,width:u-l,height:r.getBounding().height},ignoreEvent:!0})}return o},n.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createXAxisFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},n}(_i),Ai=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.compare=function(t){return L(t.timestamp)},n.prototype.getDirectionStyles=function(t){return t.vertical},n.prototype.getText=function(e,i){var n=e.timestamp;return i.getCustomApi().formatDate(n,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair)},n.prototype.getTextAttrs=function(t,e,i,n,o,r){var a=i.realX,s=0,l="center";return a-e/2-r.paddingLeft<0?(s=0,l="left"):a+e/2+r.paddingRight>n.width?(s=n.width,l="right"):s=a,{x:s,y:0,text:t,align:l,baseline:"top"}},n}(xi),Fi=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._xAxisView=new Mi(n),n._overlayXAxisView=new Di(n),n._crosshairVerticalLabelView=new Ai(n),n.getContainer().style.cursor="ew-resize",n.addChild(n._overlayXAxisView),n}return i(e,t),e.prototype.getName=function(){return Ae},e.prototype.updateMain=function(t){this._xAxisView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayXAxisView.draw(t),this._crosshairVerticalLabelView.draw(t)},e}(Oe),Bi=function(e){function n(t,i){var n=e.call(this,t)||this;return n.override(i),n}return i(n,e),n.prototype.override=function(t){var e=t.name,i=t.scrollZoomEnabled,n=t.createTicks;W(this.name)||(this.name=e),this.scrollZoomEnabled=null!=i?i:this.scrollZoomEnabled,this.createTicks=null!=n?n:this.createTicks},n.prototype.createRangeImp=function(){var t=this.getParent().getChart().getChartStore().getVisibleRange(),e=t.realFrom,i=t.realTo,n=i-e+1;return{from:e,to:i,range:n,realFrom:e,realTo:i,realRange:n,displayFrom:e,displayTo:i,displayRange:n}},n.prototype.createTicksImp=function(){var e=this,i=this.getRange(),n=i.realFrom,o=i.realTo,r=this.getParent().getChart().getChartStore(),a=r.getCustomApi().formatDate,s=r.getTimeWeightTickList(),l=[],u=function(i,n){var r,s;try{for(var u=g(i),c=u.next();!c.done;c=u.next()){var h=c.value;if(h.dataIndex>=n&&h.dataIndex<o){var d=h.timestamp,p=h.weight,v=h.dataIndex,f="";switch(p){case Et:f=a(d,"YYYY",t.FormatDateType.XAxis);break;case Pt:f=a(d,"YYYY-MM",t.FormatDateType.XAxis);break;case It:f=a(d,"MM-DD",t.FormatDateType.XAxis);break;case kt:case Mt:f=a(d,"HH:mm",t.FormatDateType.XAxis);break;case Dt:f=a(d,"mm:ss",t.FormatDateType.XAxis);break;default:f=a(d,"YYYY-MM-DD HH:mm",t.FormatDateType.XAxis)}l.push({coord:e.convertToPixel(v),value:d,text:f})}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}};if(u(s,n),s.length>0){for(var c=r.getBarSpace().bar,h=r.getStyles().xAxis.tickText,d=Ft(c,h),p=s[s.length-1].dataIndex+d-1,v=[],f=p;f<o;f++){var y=r.dataIndexToTimestamp(f);R(y)&&v.push({timestamp:y})}if(v.length>0){var m=new Map;At(m,v,r.getDateTimeFormat(),p),u(Bt(m,c,h),p)}}return F(this.createTicks)?this.createTicks({range:this.getRange(),bounding:this.getBounding(),defaultTicks:l}):l},n.prototype.getAutoSize=function(){var t=this.getParent().getChart().getStyles(),e=t.xAxis,i=e.size;if("auto"!==i)return i;var n=t.crosshair,o=0;e.show&&(e.axisLine.show&&(o+=e.axisLine.size),e.tickLine.show&&(o+=e.tickLine.length),e.tickText.show&&(o+=e.tickText.marginStart+e.tickText.marginEnd+e.tickText.size));var r=0;return n.show&&n.vertical.show&&n.vertical.text.show&&(r+=n.vertical.text.paddingTop+n.vertical.text.paddingBottom+2*n.vertical.text.borderSize+n.vertical.text.size),Math.max(o,r)},n.prototype.getBounding=function(){return this.getParent().getMainWidget().getBounding()},n.prototype.convertTimestampFromPixel=function(t){var e=this.getParent().getChart().getChartStore(),i=e.coordinateToDataIndex(t);return e.dataIndexToTimestamp(i)},n.prototype.convertTimestampToPixel=function(t){var e=this.getParent().getChart().getChartStore(),i=e.timestampToDataIndex(t);return e.dataIndexToCoordinate(i)},n.prototype.convertFromPixel=function(t){return this.getParent().getChart().getChartStore().coordinateToDataIndex(t)},n.prototype.convertToPixel=function(t){return this.getParent().getChart().getChartStore().dataIndexToCoordinate(t)},n.extend=function(t){var e=function(e){function n(i){return e.call(this,i,t)||this}return i(n,e),n}(n);return e},n}(hi),Ri={normal:Bi.extend({name:"normal"})};var Li=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createAxisComponent=function(t){var e=function(t){var e;return null!==(e=Ri[t])&&void 0!==e?e:Ri.normal}(t);return new e(this)},e.prototype.createMainWidget=function(t){return new Fi(t,this)},e}(Pi);var Oi=function(e){function n(t,i){var n,o,r,a=e.call(this,t,i)||this;return a._dragFlag=!1,a._dragStartY=0,a._topPaneHeight=0,a._bottomPaneHeight=0,a._topPane=null,a._bottomPane=null,a._pressedMouseMoveEvent=(n=a._pressedTouchMouseMoveEvent,o=20,r=0,function(){var t=Date.now();t-r>o&&(n.apply(this,arguments),r=t)}),a.registerEvent("touchStartEvent",a._mouseDownEvent.bind(a)).registerEvent("touchMoveEvent",a._pressedMouseMoveEvent.bind(a)).registerEvent("touchEndEvent",a._mouseUpEvent.bind(a)).registerEvent("mouseDownEvent",a._mouseDownEvent.bind(a)).registerEvent("mouseUpEvent",a._mouseUpEvent.bind(a)).registerEvent("pressedMouseMoveEvent",a._pressedMouseMoveEvent.bind(a)).registerEvent("mouseEnterEvent",a._mouseEnterEvent.bind(a)).registerEvent("mouseLeaveEvent",a._mouseLeaveEvent.bind(a)),a}return i(n,e),n.prototype.getName=function(){return Be},n.prototype.checkEventOn=function(){return!0},n.prototype._mouseDownEvent=function(t){var e=this;this._dragFlag=!0,this._dragStartY=t.pageY;var i=this.getPane(),n=i.getChart();this._topPane=i.getTopPane(),this._bottomPane=i.getBottomPane();var o=n.getDrawPanes();if("minimize"===this._topPane.getOptions().state)for(var r=o.findIndex((function(t){var i;return t.getId()===(null===(i=e._topPane)||void 0===i?void 0:i.getId())})),a=r-1;a>-1;a--){var s=o[a];if("minimize"!==s.getOptions().state){this._topPane=s;break}}if("minimize"===this._bottomPane.getOptions().state)for(r=o.findIndex((function(t){var i;return t.getId()===(null===(i=e._bottomPane)||void 0===i?void 0:i.getId())})),a=r+1;a<o.length;a++){var l=o[a];if("minimize"!==l.getOptions().state){this._bottomPane=l;break}}return this._topPaneHeight=this._topPane.getBounding().height,this._bottomPaneHeight=this._bottomPane.getBounding().height,!0},n.prototype._mouseUpEvent=function(){return this._dragFlag=!1,this._topPane=null,this._bottomPane=null,this._topPaneHeight=0,this._bottomPaneHeight=0,this._mouseLeaveEvent()},n.prototype._pressedTouchMouseMoveEvent=function(e){var i=e.pageY-this._dragStartY,n=i<0;if(L(this._topPane)&&L(this._bottomPane)){var o=this._bottomPane.getOptions();if("minimize"!==this._topPane.getOptions().state&&"minimize"!==o.state&&o.dragEnabled){var r=null,a=null,s=0,l=0;n?(r=this._topPane,a=this._bottomPane,s=this._topPaneHeight,l=this._bottomPaneHeight):(r=this._bottomPane,a=this._topPane,s=this._bottomPaneHeight,l=this._topPaneHeight);var u=r.getOptions().minHeight;if(s>u){var c=Math.max(s-Math.abs(i),u),h=s-c;r.setBounding({height:c}),a.setBounding({height:l+h});var d=this.getPane(),p=d.getChart();p.getChartStore().executeAction(t.ActionType.OnPaneDrag,{paneId:d.getId()}),p.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})}}}return!0},n.prototype._mouseEnterEvent=function(){var t=this.getPane();if(t.getBottomPane().getOptions().dragEnabled){var e=t.getChart().getStyles().separator;return this.getContainer().style.background=e.activeBackgroundColor,!0}return!1},n.prototype._mouseLeaveEvent=function(){return!this._dragFlag&&(this.getContainer().style.background="transparent",!0)},n.prototype.createContainer=function(){return mt("div",{width:"100%",height:"".concat(7,"px"),margin:"0",padding:"0",position:"absolute",top:"-3px",zIndex:"20",boxSizing:"border-box",cursor:"ns-resize"})},n.prototype.updateImp=function(t,e,i){if(4===i||2===i){var n=this.getPane().getChart().getStyles().separator;t.style.top="".concat(-Math.floor((7-n.size)/2),"px"),t.style.height="".concat(7,"px")}},n}(Le),Wi=function(t){function e(e,i,n,o,r,a){var s=t.call(this,e,i,n,o)||this;return s.getContainer().style.overflow="",s._topPane=r,s._bottomPane=a,s._separatorWidget=new Oi(s.getContainer(),s),s}return i(e,t),e.prototype.setBounding=function(t){return M(this.getBounding(),t),this},e.prototype.getTopPane=function(){return this._topPane},e.prototype.setTopPane=function(t){return this._topPane=t,this},e.prototype.getBottomPane=function(){return this._bottomPane},e.prototype.setBottomPane=function(t){return this._bottomPane=t,this},e.prototype.getWidget=function(){return this._separatorWidget},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=this.getChart().getStyles().separator,r=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),s=q(r);return r.width=i*s,r.height=n*s,a.scale(s,s),a.fillStyle=o.color,a.fillRect(0,0,i,n),r},e.prototype.updateImp=function(t,e,i){if(4===t||2===t){var n=this.getChart().getStyles().separator;e.style.backgroundColor=n.color,e.style.height="".concat(i.height,"px"),e.style.marginLeft="".concat(i.left,"px"),e.style.width="".concat(i.width,"px"),this._separatorWidget.update(t)}},e}(Ei);function zi(){return"undefined"!=typeof window&&window.navigator.userAgent.toLowerCase().includes("firefox")}function Vi(){return"undefined"!=typeof window&&/iPhone|iPad|iPod|iOS/.test(window.navigator.userAgent)}var Ni,Yi=5,Hi=5,Xi=5,Gi=30,Ki=0,Ui=1,ji=2,Zi=function(){function t(t,e,i){var n=this;this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartCoordinate=null,this._touchMoveStartCoordinate=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeMouseWheel=null,this._unsubscribeContextMenu=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._startPinchMiddleCoordinate=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!Vi(),this._onFirefoxOutsideMouseUp=function(t){n._mouseUpHandler(t)},this._onMobileSafariDoubleClick=function(t){n._firesTouchEvents(t)?(++n._tapCount,null!==n._tapTimeoutId&&n._tapCount>1&&(n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._tapCoordinate).manhattanDistance<Gi&&!n._cancelTap&&n._processEvent(n._makeCompatEvent(t),n._handler.doubleTapEvent),n._resetTapTimeout())):(++n._clickCount,null!==n._clickTimeoutId&&n._clickCount>1&&(n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._clickCoordinate).manhattanDistance<Xi&&!n._cancelClick&&n._processEvent(n._makeCompatEvent(t),n._handler.mouseDoubleClickEvent),n._resetClickTimeout()))},this._target=t,this._handler=e,this._options=i,this._init()}return t.prototype.destroy=function(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeMouseWheel&&(this._unsubscribeMouseWheel(),this._unsubscribeMouseWheel=null),null!==this._unsubscribeContextMenu&&(this._unsubscribeContextMenu(),this._unsubscribeContextMenu=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()},t.prototype._mouseEnterHandler=function(t){var e,i,n,o=this;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this);var r=this._mouseMoveHandler.bind(this);this._unsubscribeMousemove=function(){o._target.removeEventListener("mousemove",r)},this._target.addEventListener("mousemove",r);var a=this._mouseWheelHandler.bind(this);this._unsubscribeMouseWheel=function(){o._target.removeEventListener("wheel",a)},this._target.addEventListener("wheel",a,{passive:!1});var s=this._contextMenuHandler.bind(this);this._unsubscribeContextMenu=function(){o._target.removeEventListener("contextmenu",s)},this._target.addEventListener("contextmenu",s,{passive:!1}),this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseEnterEvent),this._acceptMouseLeave=!0)},t.prototype._resetClickTimeout=function(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._resetTapTimeout=function(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._mouseMoveHandler=function(t){this._mousePressed||null!==this._touchMoveStartCoordinate||this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseMoveEvent),this._acceptMouseLeave=!0)},t.prototype._mouseWheelHandler=function(t){if(Math.abs(t.deltaX)>Math.abs(t.deltaY)){if(!L(this._handler.mouseWheelHortEvent))return;if(this._preventDefault(t),0===Math.abs(t.deltaX))return;this._handler.mouseWheelHortEvent(this._makeCompatEvent(t),-t.deltaX)}else{if(!L(this._handler.mouseWheelVertEvent))return;var e=-t.deltaY/100;if(0===e)return;switch(this._preventDefault(t),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._handler.mouseWheelVertEvent(this._makeCompatEvent(t),i)}}},t.prototype._contextMenuHandler=function(t){this._preventDefault(t)},t.prototype._touchMoveHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null!==e&&(this._lastTouchEventTimeStamp=this._eventTimeStamp(t),null===this._startPinchMiddleCoordinate&&!this._preventTouchDragProcess)){this._pinchPrevented=!0;var i=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._touchMoveStartCoordinate),n=i.xOffset,o=i.yOffset,r=i.manhattanDistance;if(this._touchMoveExceededManhattanDistance||!(r<Hi)){if(!this._touchMoveExceededManhattanDistance){var a=.5*n,s=o>=a&&!this._options.treatVertDragAsPageScroll(),l=a>o&&!this._options.treatHorzDragAsPageScroll();s||l||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}this._preventTouchDragProcess||this._processEvent(this._makeCompatEvent(t,e),this._handler.touchMoveEvent)}}},t.prototype._mouseMoveWithDownHandler=function(t){t.button===Ki&&(this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._mouseMoveStartCoordinate).manhattanDistance>=Yi&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick&&this._processEvent(this._makeCompatEvent(t),this._handler.pressedMouseMoveEvent))},t.prototype._mouseTouchMoveWithDownInfo=function(t,e){var i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return{xOffset:i,yOffset:n,manhattanDistance:i+n}},t.prototype._touchEndHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null===e&&0===t.touches.length&&(e=t.changedTouches[0]),null!==e){this._activeTouchId=null,this._lastTouchEventTimeStamp=this._eventTimeStamp(t),this._clearLongTapTimeout(),this._touchMoveStartCoordinate=null,null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var i=this._makeCompatEvent(t,e);if(this._processEvent(i,this._handler.touchEndEvent),++this._tapCount,null!==this._tapTimeoutId&&this._tapCount>1)this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._tapCoordinate).manhattanDistance<Gi&&!this._cancelTap&&this._processEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout();else this._cancelTap||(this._processEvent(i,this._handler.tapEvent),L(this._handler.tapEvent)&&this._preventDefault(t));0===this._tapCount&&this._preventDefault(t),0===t.touches.length&&this._longTapActive&&(this._longTapActive=!1,this._preventDefault(t))}},t.prototype._mouseUpHandler=function(t){if(t.button===Ki){var e=this._makeCompatEvent(t);if(this._mouseMoveStartCoordinate=null,this._mousePressed=!1,null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),zi())this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp);if(!this._firesTouchEvents(t))if(this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,null!==this._clickTimeoutId&&this._clickCount>1)this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._clickCoordinate).manhattanDistance<Xi&&!this._cancelClick&&this._processEvent(e,this._handler.mouseDoubleClickEvent),this._resetClickTimeout();else this._cancelClick||this._processEvent(e,this._handler.mouseClickEvent)}},t.prototype._clearLongTapTimeout=function(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)},t.prototype._touchStartHandler=function(t){if(null===this._activeTouchId){var e=t.changedTouches[0];this._activeTouchId=e.identifier,this._lastTouchEventTimeStamp=this._eventTimeStamp(t);var i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartCoordinate=this._getCoordinate(e),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var n=this._touchMoveHandler.bind(this),o=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=function(){i.removeEventListener("touchmove",n),i.removeEventListener("touchend",o)},i.addEventListener("touchmove",n,{passive:!1}),i.addEventListener("touchend",o,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),500),this._processEvent(this._makeCompatEvent(t,e),this._handler.touchStartEvent),null===this._tapTimeoutId&&(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapCoordinate=this._getCoordinate(e))}},t.prototype._mouseDownHandler=function(t){if(t.button===ji)return this._preventDefault(t),void this._processEvent(this._makeCompatEvent(t),this._handler.mouseRightClickEvent);if(t.button===Ki){var e=this._target.ownerDocument.documentElement;zi()&&e.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartCoordinate=this._getCoordinate(t),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);var i=this._mouseMoveWithDownHandler.bind(this),n=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=function(){e.removeEventListener("mousemove",i),e.removeEventListener("mouseup",n)},e.addEventListener("mousemove",i),e.addEventListener("mouseup",n),this._mousePressed=!0,this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseDownEvent),null===this._clickTimeoutId&&(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickCoordinate=this._getCoordinate(t)))}},t.prototype._init=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){null!=t._handler.mouseDownOutsideEvent&&(e.composed&&t._target.contains(e.composedPath()[0])||null!==e.target&&t._target.contains(e.target)||t._handler.mouseDownOutsideEvent({x:0,y:0,pageX:0,pageY:0}))};this._unsubscribeOutsideTouchEvents=function(){e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=function(){e.removeEventListener("mousedown",i)},e.addEventListener("mousedown",i),e.addEventListener("touchstart",i,{passive:!0}),Vi()&&(this._unsubscribeMobileSafariEvents=function(){t._target.removeEventListener("dblclick",t._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),this._target.addEventListener("mousedown",(function(t){if(t.button===Ui)return t.preventDefault(),!1})),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(function(){}),{passive:!1})},t.prototype._initPinch=function(){var t=this;(L(this._handler.pinchStartEvent)||L(this._handler.pinchEvent)||L(this._handler.pinchEndEvent))&&(this._target.addEventListener("touchstart",(function(e){t._checkPinchState(e.touches)}),{passive:!0}),this._target.addEventListener("touchmove",(function(e){if(2===e.touches.length&&null!==t._startPinchMiddleCoordinate&&L(t._handler.pinchEvent)){var i=t._getTouchDistance(e.touches[0],e.touches[1])/t._startPinchDistance;t._handler.pinchEvent(c(c({},t._startPinchMiddleCoordinate),{pageX:0,pageY:0}),i),t._preventDefault(e)}}),{passive:!1}),this._target.addEventListener("touchend",(function(e){t._checkPinchState(e.touches)})))},t.prototype._checkPinchState=function(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)},t.prototype._startPinch=function(t){var e=this._target.getBoundingClientRect();this._startPinchMiddleCoordinate={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=this._getTouchDistance(t[0],t[1]),L(this._handler.pinchStartEvent)&&this._handler.pinchStartEvent({x:0,y:0,pageX:0,pageY:0}),this._clearLongTapTimeout()},t.prototype._stopPinch=function(){null!==this._startPinchMiddleCoordinate&&(this._startPinchMiddleCoordinate=null,L(this._handler.pinchEndEvent)&&this._handler.pinchEndEvent({x:0,y:0,pageX:0,pageY:0}))},t.prototype._mouseLeaveHandler=function(t){var e,i,n;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this),this._firesTouchEvents(t)||this._acceptMouseLeave&&(this._processEvent(this._makeCompatEvent(t),this._handler.mouseLeaveEvent),this._acceptMouseLeave=!Vi())},t.prototype._longTapHandler=function(t){var e=this._touchWithId(t.touches,this._activeTouchId);null!==e&&(this._processEvent(this._makeCompatEvent(t,e),this._handler.longTapEvent),this._cancelTap=!0,this._longTapActive=!0)},t.prototype._firesTouchEvents=function(t){var e;return L(null===(e=t.sourceCapabilities)||void 0===e?void 0:e.firesTouchEvents)?t.sourceCapabilities.firesTouchEvents:this._eventTimeStamp(t)<this._lastTouchEventTimeStamp+500},t.prototype._processEvent=function(t,e){null==e||e.call(this._handler,t)},t.prototype._makeCompatEvent=function(t,e){var i=this,n=null!=e?e:t,o=this._target.getBoundingClientRect();return{x:n.clientX-o.left,y:n.clientY-o.top,pageX:n.pageX,pageY:n.pageY,isTouch:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type&&"wheel"!==t.type,preventDefault:function(){"touchstart"!==t.type&&i._preventDefault(t)}}},t.prototype._getTouchDistance=function(t,e){var i=t.clientX-e.clientX,n=t.clientY-e.clientY;return Math.sqrt(i*i+n*n)},t.prototype._preventDefault=function(t){t.cancelable&&t.preventDefault()},t.prototype._getCoordinate=function(t){return{x:t.pageX,y:t.pageY}},t.prototype._eventTimeStamp=function(t){var e;return null!==(e=t.timeStamp)&&void 0!==e?e:performance.now()},t.prototype._touchWithId=function(t,e){for(var i=0;i<t.length;++i)if(t[i].identifier===e)return t[i];return null},t}(),qi=function(){function t(t,e){var i=this;this._flingStartTime=(new Date).getTime(),this._flingScrollRequestId=null,this._startScrollCoordinate=null,this._touchCoordinate=null,this._touchCancelCrosshair=!1,this._touchZoomed=!1,this._pinchScale=1,this._mouseDownWidget=null,this._prevYAxisRange=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,this._mouseMoveTriggerWidgetInfo={pane:null,widget:null},this._boundKeyBoardDownEvent=function(t){if(t.shiftKey)switch(t.code){case"Equal":i._chart.getChartStore().zoom(.5);break;case"Minus":i._chart.getChartStore().zoom(-.5);break;case"ArrowLeft":(e=i._chart.getChartStore()).startScroll(),e.scroll(-3*e.getBarSpace().bar);break;case"ArrowRight":var e;(e=i._chart.getChartStore()).startScroll(),e.scroll(3*e.getBarSpace().bar)}},this._container=t,this._chart=e,this._event=new Zi(t,this,{treatVertDragAsPageScroll:function(){return!1},treatHorzDragAsPageScroll:function(){return!1}}),t.addEventListener("keydown",this._boundKeyBoardDownEvent)}return t.prototype.pinchStartEvent=function(){return this._touchZoomed=!0,this._pinchScale=1,!0},t.prototype.pinchEvent=function(t,e){var i=this._findWidgetByEvent(t),n=i.pane,o=i.widget;if((null==n?void 0:n.getId())!==Pe&&(null==o?void 0:o.getName())===De){var r=this._makeWidgetEvent(t,o),a=5*(e-this._pinchScale);return this._pinchScale=e,this._chart.getChartStore().zoom(a,{x:r.x,y:r.y}),!0}return!1},t.prototype.mouseWheelHortEvent=function(t,e){var i=this._chart.getChartStore();return i.startScroll(),i.scroll(e),!0},t.prototype.mouseWheelVertEvent=function(t,e){var i=this._findWidgetByEvent(t).widget,n=this._makeWidgetEvent(t,i);return(null==i?void 0:i.getName())===De&&(this._chart.getChartStore().zoom(e,{x:n.x,y:n.y}),!0)},t.prototype.mouseDownEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(this._mouseDownWidget=n,null!==n){var o=this._makeWidgetEvent(t,n);switch(n.getName()){case Be:return n.dispatchEvent("mouseDownEvent",o);case De:var r=i.getAxisComponent().getRange();return this._prevYAxisRange=c({},r),this._startScrollCoordinate={x:o.x,y:o.y},this._chart.getChartStore().startScroll(),n.dispatchEvent("mouseDownEvent",o);case Ae:return(a=n.dispatchEvent("mouseDownEvent",o))&&this._chart.updatePane(1),this._xAxisStartScaleCoordinate={x:o.x,y:o.y},this._xAxisStartScaleDistance=o.pageX,a;case Fe:var a;(a=n.dispatchEvent("mouseDownEvent",o))&&this._chart.updatePane(1);r=i.getAxisComponent().getRange();return this._prevYAxisRange=c({},r),this._yAxisStartScaleDistance=o.pageY,a}}return!1},t.prototype.mouseMoveEvent=function(t){var e,i,n,o=this._findWidgetByEvent(t),r=o.pane,a=o.widget,s=this._makeWidgetEvent(t,a);if((null===(e=this._mouseMoveTriggerWidgetInfo.pane)||void 0===e?void 0:e.getId())===(null==r?void 0:r.getId())&&(null===(i=this._mouseMoveTriggerWidgetInfo.widget)||void 0===i?void 0:i.getName())===(null==a?void 0:a.getName())||(null==a||a.dispatchEvent("mouseEnterEvent",s),null===(n=this._mouseMoveTriggerWidgetInfo.widget)||void 0===n||n.dispatchEvent("mouseLeaveEvent",s),this._mouseMoveTriggerWidgetInfo={pane:r,widget:a}),null!==a)switch(a.getName()){case De:var l=a.dispatchEvent("mouseMoveEvent",s),u=this._chart.getChartStore(),c={x:s.x,y:s.y,paneId:null==r?void 0:r.getId()};return l&&null!==u.getActiveTooltipIcon()&&(c=void 0,a.getContainer().style.cursor="pointer"),this._chart.getChartStore().setCrosshair(c),l;case Be:case Ae:case Fe:l=a.dispatchEvent("mouseMoveEvent",s);return this._chart.getChartStore().setCrosshair(),l}return!1},t.prototype.pressedMouseMoveEvent=function(t){var e,i,n;if(null!==this._mouseDownWidget&&this._mouseDownWidget.getName()===Be)return this._mouseDownWidget.dispatchEvent("pressedMouseMoveEvent",t);var o=this._findWidgetByEvent(t),r=o.pane,a=o.widget;if(null!==a&&(null===(e=this._mouseDownWidget)||void 0===e?void 0:e.getPane().getId())===(null==r?void 0:r.getId())&&(null===(i=this._mouseDownWidget)||void 0===i?void 0:i.getName())===a.getName()){var s=this._makeWidgetEvent(t,a);switch(a.getName()){case De:var l=a.getBounding();if(!(b=a.dispatchEvent("pressedMouseMoveEvent",s))&&null!==this._startScrollCoordinate){var u=r.getAxisComponent();if(null!==this._prevYAxisRange&&!u.getAutoCalcTickFlag()&&u.scrollZoomEnabled){var c=this._prevYAxisRange,h=c.from,d=c.to,p=h+(w=(T=c.range)*(x=(u.reverse?this._startScrollCoordinate.y-s.y:s.y-this._startScrollCoordinate.y)/l.height)),g=d+w,v=u.valueToRealValue(p,{range:this._prevYAxisRange}),f=u.valueToRealValue(g,{range:this._prevYAxisRange}),y=u.realValueToDisplayValue(v,{range:this._prevYAxisRange}),m=u.realValueToDisplayValue(f,{range:this._prevYAxisRange});u.setRange({from:p,to:g,range:g-p,realFrom:v,realTo:f,realRange:f-v,displayFrom:y,displayTo:m,displayRange:m-y})}var _=s.x-this._startScrollCoordinate.x;this._chart.getChartStore().scroll(_)}return this._chart.getChartStore().setCrosshair({x:s.x,y:s.y,paneId:null==r?void 0:r.getId()}),b;case Ae:if(b=a.dispatchEvent("pressedMouseMoveEvent",s))this._chart.updatePane(1);else if(r.getAxisComponent().scrollZoomEnabled){var x=this._xAxisStartScaleDistance/s.pageX;if(Number.isFinite(x)){var C=10*(x-this._xAxisScale);this._xAxisScale=x,this._chart.getChartStore().zoom(C,null!==(n=this._xAxisStartScaleCoordinate)&&void 0!==n?n:void 0)}}return b;case Fe:var b;if(b=a.dispatchEvent("pressedMouseMoveEvent",s))this._chart.updatePane(1);else{u=r.getAxisComponent();if(null!==this._prevYAxisRange&&u.scrollZoomEnabled){var T,w,S=this._prevYAxisRange,E=(h=S.from,d=S.to,(T=S.range)*(x=s.pageY/this._yAxisStartScaleDistance));p=h-(w=(E-T)/2),g=d+w,v=u.valueToRealValue(p,{range:this._prevYAxisRange}),f=u.valueToRealValue(g,{range:this._prevYAxisRange}),y=u.realValueToDisplayValue(v,{range:this._prevYAxisRange}),m=u.realValueToDisplayValue(f,{range:this._prevYAxisRange});u.setRange({from:p,to:g,range:E,realFrom:v,realTo:f,realRange:f-v,displayFrom:y,displayTo:m,displayRange:m-y}),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})}}return b}}return!1},t.prototype.mouseUpEvent=function(t){var e=this._findWidgetByEvent(t).widget,i=!1;if(null!==e){var n=this._makeWidgetEvent(t,e);switch(e.getName()){case De:case Be:case Ae:case Fe:i=e.dispatchEvent("mouseUpEvent",n)}i&&this._chart.updatePane(1)}return this._mouseDownWidget=null,this._startScrollCoordinate=null,this._prevYAxisRange=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,i},t.prototype.mouseClickEvent=function(t){var e=this._findWidgetByEvent(t).widget;if(null!==e){var i=this._makeWidgetEvent(t,e);return e.dispatchEvent("mouseClickEvent",i)}return!1},t.prototype.mouseRightClickEvent=function(t){var e=this._findWidgetByEvent(t).widget,i=!1;if(null!==e){var n=this._makeWidgetEvent(t,e);switch(e.getName()){case De:case Ae:case Fe:i=e.dispatchEvent("mouseRightClickEvent",n)}i&&this._chart.updatePane(1)}return!1},t.prototype.mouseDoubleClickEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n)switch(n.getName()){case De:var o=this._makeWidgetEvent(t,n);return n.dispatchEvent("mouseDoubleClickEvent",o);case Fe:var r=i.getAxisComponent();if(!r.getAutoCalcTickFlag())return r.setAutoCalcTickFlag(!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}),!0}return!1},t.prototype.mouseLeaveEvent=function(){return this._chart.getChartStore().setCrosshair(),!0},t.prototype.touchStartEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n){var o=this._makeWidgetEvent(t,n);switch(n.getName()){case De:var r=this._chart.getChartStore();if(n.dispatchEvent("mouseDownEvent",o))return this._touchCancelCrosshair=!0,this._touchCoordinate=null,r.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._flingScrollRequestId&&(ht(this._flingScrollRequestId),this._flingScrollRequestId=null),this._flingStartTime=(new Date).getTime(),this._startScrollCoordinate={x:o.x,y:o.y},r.startScroll(),this._touchZoomed=!1,null!==this._touchCoordinate){var a=o.x-this._touchCoordinate.x,s=o.y-this._touchCoordinate.y;Math.sqrt(a*a+s*s)<10?(this._touchCoordinate={x:o.x,y:o.y},r.setCrosshair({x:o.x,y:o.y,paneId:null==i?void 0:i.getId()})):(this._touchCoordinate=null,this._touchCancelCrosshair=!0,r.setCrosshair())}return!0;case Ae:case Fe:var l=n.dispatchEvent("mouseDownEvent",o);return l&&this._chart.updatePane(1),l}}return!1},t.prototype.touchMoveEvent=function(t){var e,i,n,o=this._findWidgetByEvent(t),r=o.pane,a=o.widget;if(null!==a){var s=this._makeWidgetEvent(t,a),l=a.getName(),u=this._chart.getChartStore();switch(l){case De:if(a.dispatchEvent("pressedMouseMoveEvent",s))return null===(e=s.preventDefault)||void 0===e||e.call(s),u.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._touchCoordinate)null===(i=s.preventDefault)||void 0===i||i.call(s),u.setCrosshair({x:s.x,y:s.y,paneId:null==r?void 0:r.getId()});else if(null!==this._startScrollCoordinate&&Math.abs(this._startScrollCoordinate.x-s.x)>this._startScrollCoordinate.y-s.y){var c=s.x-this._startScrollCoordinate.x;u.scroll(c)}return!0;case Ae:case Fe:var h=a.dispatchEvent("pressedMouseMoveEvent",s);return h&&(null===(n=s.preventDefault)||void 0===n||n.call(s),this._chart.updatePane(1)),h}}return!1},t.prototype.touchEndEvent=function(t){var e=this,i=this._findWidgetByEvent(t).widget;if(null!==i){var n=this._makeWidgetEvent(t,i);switch(i.getName()){case De:if(i.dispatchEvent("mouseUpEvent",n),null!==this._startScrollCoordinate){var o=(new Date).getTime()-this._flingStartTime,r=(n.x-this._startScrollCoordinate.x)/(o>0?o:1)*20;if(o<200&&Math.abs(r)>0){var a=this._chart.getChartStore(),s=function(){e._flingScrollRequestId=ct((function(){a.startScroll(),a.scroll(r),r*=.975,Math.abs(r)<1?null!==e._flingScrollRequestId&&(ht(e._flingScrollRequestId),e._flingScrollRequestId=null):s()}))};s()}}return!0;case Ae:case Fe:i.dispatchEvent("mouseUpEvent",n)&&this._chart.updatePane(1)}}return!1},t.prototype.tapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget,o=!1;if(null!==n){var r=this._makeWidgetEvent(t,n),a=n.dispatchEvent("mouseClickEvent",r);if(n.getName()===De){var s=this._makeWidgetEvent(t,n),l=this._chart.getChartStore();a?(this._touchCancelCrosshair=!0,this._touchCoordinate=null,l.setCrosshair(void 0,!0),o=!0):(this._touchCancelCrosshair||this._touchZoomed||(this._touchCoordinate={x:s.x,y:s.y},l.setCrosshair({x:s.x,y:s.y,paneId:null==i?void 0:i.getId()},!0),o=!0),this._touchCancelCrosshair=!1)}(o||a)&&this._chart.updatePane(1)}return o},t.prototype.doubleTapEvent=function(t){return this.mouseDoubleClickEvent(t)},t.prototype.longTapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n&&n.getName()===De){var o=this._makeWidgetEvent(t,n);return this._touchCoordinate={x:o.x,y:o.y},this._chart.getChartStore().setCrosshair({x:o.x,y:o.y,paneId:null==i?void 0:i.getId()}),!0}return!1},t.prototype._findWidgetByEvent=function(t){var e,i,n,o,r=t.x,a=t.y,s=this._chart.getSeparatorPanes(),l=this._chart.getStyles().separator.size;try{for(var u=g(s),c=u.next();!c.done;c=u.next()){var h=v(c.value,2)[1],d=(_=h.getBounding()).top-Math.round((7-l)/2);if(r>=_.left&&r<=_.left+_.width&&a>=d&&a<=d+7)return{pane:h,widget:h.getWidget()}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}var p=this._chart.getDrawPanes(),f=null;try{for(var y=g(p),m=y.next();!m.done;m=y.next()){var _,x=m.value;if(r>=(_=x.getBounding()).left&&r<=_.left+_.width&&a>=_.top&&a<=_.top+_.height){f=x;break}}}catch(t){n={error:t}}finally{try{m&&!m.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}var C=null;if(null!==f){if(!L(C)){var b=f.getMainWidget(),T=b.getBounding();r>=T.left&&r<=T.left+T.width&&a>=T.top&&a<=T.top+T.height&&(C=b)}if(!L(C)){var w=f.getYAxisWidget();if(null!==w){var S=w.getBounding();r>=S.left&&r<=S.left+S.width&&a>=S.top&&a<=S.top+S.height&&(C=w)}}}return{pane:f,widget:C}},t.prototype._makeWidgetEvent=function(t,e){var i,n,o,r=null!==(i=null==e?void 0:e.getBounding())&&void 0!==i?i:null;return c(c({},t),{x:t.x-(null!==(n=null==r?void 0:r.left)&&void 0!==n?n:0),y:t.y-(null!==(o=null==r?void 0:r.top)&&void 0!==o?o:0)})},t.prototype.destroy=function(){this._container.removeEventListener("keydown",this._boundKeyBoardDownEvent),this._event.destroy()},t}();t.DomPosition=void 0,(Ni=t.DomPosition||(t.DomPosition={})).Root="root",Ni.Main="main",Ni.YAxis="yAxis";var Ji=function(){function e(t,e){this._chartBounding=lt(),this._drawPanes=[],this._separatorPanes=new Map,this._layoutOptions={measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!1,forceBuildYAxisTick:!1},this._layoutPending=!1,this._initContainer(t),this._chartEvent=new qi(this._chartContainer,this),this._chartStore=new Me(this,e),this._initPanes(e),this._layout()}return e.prototype._initContainer=function(t){this._container=t,this._chartContainer=mt("div",{position:"relative",width:"100%",height:"100%",outline:"none",borderStyle:"none",cursor:"crosshair",boxSizing:"border-box",userSelect:"none",webkitUserSelect:"none",overflow:"hidden",msUserSelect:"none",MozUserSelect:"none",webkitTapHighlightColor:"transparent"}),this._chartContainer.tabIndex=1,t.appendChild(this._chartContainer),this._cacheChartBounding()},e.prototype._cacheChartBounding=function(){this._chartBounding.width=Math.floor(this._chartContainer.clientWidth),this._chartBounding.height=Math.floor(this._chartContainer.clientHeight)},e.prototype._initPanes=function(t){var e,i=this,n=null!==(e=null==t?void 0:t.layout)&&void 0!==e?e:[{type:"candle"}],o=function(t){var e,n;if(!L(i._candlePane)){var o=null!==(e=t.options)&&void 0!==e?e:{};M(o,{id:Se}),i._candlePane=i._createPane(ki,Se,o),(null!==(n=t.content)&&void 0!==n?n:[]).forEach((function(t){i.createIndicator(t,!0,o)}))}},r=function(t){if(!L(i._xAxisPane)){var e=i._createPane(Li,Pe,null!=t?t:{});i._xAxisPane=e}};n.forEach((function(t){var e;switch(t.type){case"candle":o(t);break;case"indicator":var n=null!==(e=t.content)&&void 0!==e?e:[];if(n.length>0){var a=null;n.forEach((function(e){L(a)?i.createIndicator(e,!0,{id:a}):a=i.createIndicator(e,!0,t.options)}))}break;case"xAxis":r(t.options)}})),o({type:"candle"}),r({order:Number.MAX_SAFE_INTEGER})},e.prototype._createPane=function(t,e,i){var n,o,r,a=null,s=null,l=null!==(n=null==i?void 0:i.order)&&void 0!==n?n:0;if(this._drawPanes.length>0&&(l<this._drawPanes[0].getOptions().order&&(s=new t(this._chartContainer,this._drawPanes[0].getContainer(),this,e,null!=i?i:{}),a=0),!L(s)))for(var u=1;u<this._drawPanes.length;u++){var c=this._drawPanes[u-1],h=this._drawPanes[u];if(l>=c.getOptions().order&&l<h.getOptions().order){var d=null;d=h.getId()!==Pe?null!==(r=null===(o=this._separatorPanes.get(h))||void 0===o?void 0:o.getContainer())&&void 0!==r?r:null:h.getContainer(),s=new t(this._chartContainer,d,this,e,null!=i?i:{}),a=u;break}}L(s)||(s=new t(this._chartContainer,null,this,e,null!=i?i:{}));var p=0;if(R(a)?(this._drawPanes.splice(a,0,s),p=a):(this._drawPanes.push(s),p=this._drawPanes.length-1),s.getId()!==Pe){var g=this._drawPanes[p+1];if(L(g)&&g.getId()===Pe&&(g=this._drawPanes[p+2]),L(g))L(v=this._separatorPanes.get(g))?v.setTopPane(s):(v=new Wi(this._chartContainer,g.getContainer(),this,"",s,g),this._separatorPanes.set(g,v));if(L(c=this._drawPanes[p-1])&&c.getId()===Pe&&(c=this._drawPanes[p-2]),L(c)){var v=new Wi(this._chartContainer,s.getContainer(),this,"",c,s);this._separatorPanes.set(s,v)}}return s},e.prototype._recalculatePaneHeight=function(t,e,i){if(0===i)return!1;var n=this._drawPanes.filter((function(e){var i=e.getId();return"normal"===e.getOptions().state&&i!==t.getId()&&i!==Pe})),o=n.length;if(0===o)return!1;if(t.getId()!==Se&&L(this._candlePane)&&"normal"===this._candlePane.getOptions().state){var r=this._candlePane.getBounding().height;if(r>0){var a=this._candlePane.getOptions().minHeight,s=r+i;s<a&&(e-=r+i-(s=a)),this._candlePane.setBounding({height:s})}}else{var l=i,u=Math.floor(i/o);n.forEach((function(t,e){var i=t.getBounding().height,n=0;(n=e===o-1?i+l:i+u)<t.getOptions().minHeight&&(n=t.getOptions().minHeight),t.setBounding({height:n}),l-=n-i})),Math.abs(l)>0&&(e-=l)}return t.setBounding({height:e}),!0},e.prototype.getDrawPaneById=function(t){if(t===Se)return this._candlePane;if(t===Pe)return this._xAxisPane;var e=this._drawPanes.find((function(e){return e.getId()===t}));return null!=e?e:null},e.prototype.getContainer=function(){return this._container},e.prototype.getChartStore=function(){return this._chartStore},e.prototype.getXAxisPane=function(){return this._xAxisPane},e.prototype.getDrawPanes=function(){return this._drawPanes},e.prototype.getSeparatorPanes=function(){return this._separatorPanes},e.prototype.layout=function(t){var e,i,n,o,r,a=this;null!==(e=t.measureHeight)&&void 0!==e&&e&&(this._layoutOptions.measureHeight=t.measureHeight),null!==(i=t.measureWidth)&&void 0!==i&&i&&(this._layoutOptions.measureWidth=t.measureWidth),null!==(n=t.update)&&void 0!==n&&n&&(this._layoutOptions.update=t.update),null!==(o=t.buildYAxisTick)&&void 0!==o&&o&&(this._layoutOptions.buildYAxisTick=t.buildYAxisTick),null!==(r=t.buildYAxisTick)&&void 0!==r&&r&&(this._layoutOptions.forceBuildYAxisTick=t.forceBuildYAxisTick),this._layoutPending||(this._layoutPending=!0,Promise.resolve().then((function(t){a._layout(),a._layoutPending=!1})).catch((function(t){})))},e.prototype._layout=function(){var t=this,e=this._layoutOptions,i=e.measureHeight,n=e.measureWidth,o=e.update,r=e.buildYAxisTick,a=e.forceBuildYAxisTick;if(i){var s=this._chartBounding.height,l=this.getStyles().separator.size,u=this._xAxisPane.getAxisComponent().getAutoSize(),c=s-u;c<0&&(c=0),this._drawPanes.forEach((function(e){var i=e.getId();if(L(t._separatorPanes.get(e))&&(c-=l),i!==Pe&&i!==Se&&e.getVisible()){var n=e.getBounding().height;n>c?(n=c,c=0):c-=n,e.setBounding({height:n})}})),this._candlePane.setBounding({height:Math.max(c,0)}),this._xAxisPane.setBounding({height:u});var h=0;this._drawPanes.forEach((function(e){var i=t._separatorPanes.get(e);L(i)&&(i.setBounding({height:l,top:h}),h+=l),e.setBounding({top:h}),h+=e.getBounding().height}))}var d=n;if((r||a)&&this._drawPanes.forEach((function(t){var e=t.getAxisComponent().buildTicks(a);d||(d=e)})),d){var p=this._chartBounding.width,g=this.getStyles(),v=0,f=!0,y=0,m=!0;this._drawPanes.forEach((function(t){if(t.getId()!==Pe){var e=t.getAxisComponent(),i=e.inside,n=e.getAutoSize();e.position===Qe.Left?(v=Math.max(v,n),i&&(f=!1)):(y=Math.max(y,n),i&&(m=!1))}}));var _=p,x=0,C=0;f&&(_-=v,x=v),m&&(_-=y,C=y),this._chartStore.setTotalBarSpace(_);var b={width:p},T={width:_,left:x,right:C},w={width:v},S={width:y},E=g.separator.fill,P={};P=E?b:T,this._drawPanes.forEach((function(e){var i;null===(i=t._separatorPanes.get(e))||void 0===i||i.setBounding(P),e.setBounding(b,T,w,S)}))}o&&(this._xAxisPane.getAxisComponent().buildTicks(!0),this.updatePane(4)),this._layoutOptions={measureHeight:!1,measureWidth:!1,update:!1,buildYAxisTick:!1,forceBuildYAxisTick:!1}},e.prototype.updatePane=function(t,e){var i=this;if(L(e)){var n=this.getDrawPaneById(e);null==n||n.update(t)}else this._drawPanes.forEach((function(e){var n;e.update(t),null===(n=i._separatorPanes.get(e))||void 0===n||n.update(t)}))},e.prototype.crosshairChange=function(e){var i=this;if(this._chartStore.hasAction(t.ActionType.OnCrosshairChange)){var n={};this._drawPanes.forEach((function(t){var o=t.getId(),r={};i._chartStore.getIndicatorsByPaneId(o).forEach((function(t){var i,n=t.result;r[t.name]=n[null!==(i=e.dataIndex)&&void 0!==i?i:n.length-1]})),n[o]=r})),W(e.paneId)&&this._chartStore.executeAction(t.ActionType.OnCrosshairChange,c(c({},e),{indicatorData:n}))}},e.prototype.getDom=function(e,i){var n,o;if(!L(e))return this._chartContainer;var r=this.getDrawPaneById(e);if(L(r))switch(null!=i?i:t.DomPosition.Root){case t.DomPosition.Root:return r.getContainer();case t.DomPosition.Main:return r.getMainWidget().getContainer();case t.DomPosition.YAxis:return null!==(o=null===(n=r.getYAxisWidget())||void 0===n?void 0:n.getContainer())&&void 0!==o?o:null}return null},e.prototype.getSize=function(e,i){var n,o;if(!L(e))return this._chartBounding;var r=this.getDrawPaneById(e);if(L(r))switch(null!=i?i:t.DomPosition.Root){case t.DomPosition.Root:return r.getBounding();case t.DomPosition.Main:return r.getMainWidget().getBounding();case t.DomPosition.YAxis:return null!==(o=null===(n=r.getYAxisWidget())||void 0===n?void 0:n.getBounding())&&void 0!==o?o:null}return null},e.prototype.setPrecision=function(t){this._chartStore.setPrecision(t)},e.prototype.getPrecision=function(){return this._chartStore.getPrecision()},e.prototype.setStyles=function(t){var e=this;this._setOptions((function(){e._chartStore.setStyles(t)}))},e.prototype.getStyles=function(){return this._chartStore.getStyles()},e.prototype.setCustomApi=function(t){var e=this;this._setOptions((function(){e._chartStore.setCustomApi(t)}))},e.prototype.getCustomApi=function(){return this._chartStore.getCustomApi()},e.prototype.setLocale=function(t){var e=this;this._setOptions((function(){e._chartStore.setLocale(t)}))},e.prototype.getLocale=function(){return this._chartStore.getLocale()},e.prototype.setTimezone=function(t){var e=this;this._setOptions((function(){e._chartStore.setTimezone(t)}))},e.prototype.getTimezone=function(){return this._chartStore.getTimezone()},e.prototype.setThousandsSeparator=function(t){var e=this;this._setOptions((function(){e._chartStore.setThousandsSeparator(t)}))},e.prototype.getThousandsSeparator=function(){return this._chartStore.getThousandsSeparator()},e.prototype.setDecimalFold=function(t){var e=this;this._setOptions((function(){e._chartStore.setDecimalFold(t)}))},e.prototype.getDecimalFold=function(){return this._chartStore.getDecimalFold()},e.prototype._setOptions=function(t){t(),this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.setOffsetRightDistance=function(t){this._chartStore.setOffsetRightDistance(t,!0)},e.prototype.getOffsetRightDistance=function(){return this._chartStore.getOffsetRightDistance()},e.prototype.setMaxOffsetLeftDistance=function(t){t<0||this._chartStore.setMaxOffsetLeftDistance(t)},e.prototype.setMaxOffsetRightDistance=function(t){t<0||this._chartStore.setMaxOffsetRightDistance(t)},e.prototype.setLeftMinVisibleBarCount=function(t){t<0||this._chartStore.setLeftMinVisibleBarCount(Math.ceil(t))},e.prototype.setRightMinVisibleBarCount=function(t){t<0||this._chartStore.setRightMinVisibleBarCount(Math.ceil(t))},e.prototype.setBarSpace=function(t){this._chartStore.setBarSpace(t)},e.prototype.getBarSpace=function(){return this._chartStore.getBarSpace()},e.prototype.getVisibleRange=function(){return this._chartStore.getVisibleRange()},e.prototype.clearData=function(){this._chartStore.clearData()},e.prototype.getDataList=function(){return this._chartStore.getDataList()},e.prototype.applyNewData=function(t,e){this._drawPanes.forEach((function(t){t.getAxisComponent().setAutoCalcTickFlag(!0)}));var i={forward:!1,backward:!1};O(e)?(i.forward=e,i.backward=e):i=c(c({},i),e),this._chartStore.addData(t,pt.Init,i)},e.prototype.updateData=function(t){this._chartStore.addData(t,pt.Update)},e.prototype.setLoadMoreDataCallback=function(t){this._chartStore.setLoadMoreDataCallback(t)},e.prototype.createIndicator=function(t,e,i){var n,o=W(t)?{name:t}:t;if(null===ee(o.name))return null;var r=c({},i);W(r.id)||(r.id=yt(Ee));var a=this.getDrawPaneById(r.id);return L(a)||(a=this._createPane(Ii,r.id,r),null!==(n=r.height)&&void 0!==n||(r.height=100)),this.setPaneOptions(r),this._chartStore.addIndicator(o,r.id,null!=e&&e)&&this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0}),r.id},e.prototype.overrideIndicator=function(t,e){return this._chartStore.overrideIndicator(t,e)},e.prototype.getIndicators=function(t){return this._chartStore.getIndicatorsByFilter(null!=t?t:{})},e.prototype.removeIndicator=function(t){var e=this,i=this._chartStore.removeIndicator(null!=t?t:{});if(i){var n=!1,o=[];this._drawPanes.forEach((function(t){var e=t.getId();e!==Se&&e!==Pe&&o.push(e)})),o.forEach((function(t){var i,o,r;if(!e._chartStore.hasIndicators(t)){var a=e._drawPanes.findIndex((function(e){return e.getId()===t})),s=e._drawPanes[a];if(L(s)){n=!0;var l=e._separatorPanes.get(s);if(L(l)){var u=l.getTopPane();try{for(var c=g(e._separatorPanes),h=c.next();!h.done;h=c.next()){var d=h.value;if(d[1].getTopPane().getId()===t){d[1].setTopPane(u);break}}}catch(t){i={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}l.destroy(),e._separatorPanes.delete(s)}e._recalculatePaneHeight(s,0,s.getBounding().height),e._drawPanes.splice(a,1),s.destroy();var p=e._drawPanes[0];L(p)&&p.getId()===Pe&&(p=e._drawPanes[1]),null===(r=e._separatorPanes.get(p))||void 0===r||r.destroy(),e._separatorPanes.delete(p)}}})),2===this._drawPanes.length&&(this._candlePane.setVisible(!0),this._candlePane.setBounding({height:this._chartBounding.height-this._xAxisPane.getBounding().height})),this.layout({measureHeight:n,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})}return i},e.prototype.createOverlay=function(t){var e=this,i=[],n=[],o=function(t){L(t.paneId)&&null!==e.getDrawPaneById(t.paneId)?n.push(!0):(t.paneId=Se,n.push(!1)),i.push(t)};W(t)?o({name:t}):A(t)?t.forEach((function(t){var e=null;e=W(t)?{name:t}:t,o(e)})):o(t);var r=this._chartStore.addOverlays(i,n);return A(t)?r:r[0]},e.prototype.getOverlays=function(t){return this._chartStore.getOverlaysByFilter(null!=t?t:{})},e.prototype.overrideOverlay=function(t){return this._chartStore.overrideOverlay(t)},e.prototype.removeOverlay=function(t){return this._chartStore.removeOverlay(null!=t?t:{})},e.prototype.setPaneOptions=function(t){var e,i,n,o=this,r=!1,a=!1,s=L(t.id),l=function(e){var i=e.getId();if(s&&t.id===i||!s){if(i!==Pe){if(R(t.height)&&t.height>0){var l=Math.max(null!==(n=t.minHeight)&&void 0!==n?n:e.getOptions().minHeight,0),h=Math.max(l,t.height);a=!0,r=!0,e.setOriginalBounding({height:h}),u._recalculatePaneHeight(e,h,-h)}if(L(t.state)&&e.getOptions().state!==t.state){r=!0,a=!0;var d=t.state;switch(d){case"maximize":if(!L(u._drawPanes.find((function(t){var e=t.getId();return"maximize"===t.getOptions().state&&e!==Pe})))){"normal"===e.getOptions().state&&e.setOriginalBounding({height:e.getBounding().height}),e.setOptions({state:d});var p=u._chartBounding.height;e.setBounding({height:p-u._xAxisPane.getBounding().height}),u._drawPanes.forEach((function(t){var e;t.getId()!==Pe&&t.getId()!==i&&(t.setBounding({height:t.getOriginalBounding().height}),t.setVisible(!1),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!1))}))}break;case"minimize":h=e.getBounding().height;var g=e.getOptions().state,v=h-30;"maximize"===g&&(v=e.getOriginalBounding().height-30),u._recalculatePaneHeight(e,30,v)&&("normal"===g&&e.setOriginalBounding({height:h}),e.setOptions({state:d})),u._drawPanes.forEach((function(t){var e;t.getId()!==Pe&&(t.setVisible(!0),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!0))}));break;default:h=e.getOriginalBounding().height;u._recalculatePaneHeight(e,h,e.getBounding().height-h)&&e.setOptions({state:d}),u._drawPanes.forEach((function(t){var e;t.getId()!==Pe&&(t.setVisible(!0),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!0))}))}}}L(t.axis)&&(a=!0);var f=c({},t);if(delete f.state,e.setOptions(f),i===t.id)return"break"}},u=this;try{for(var h=g(this._drawPanes),d=h.next();!d.done;d=h.next()){if("break"===l(d.value))break}}catch(t){e={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}a&&this.layout({measureHeight:r,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.getPaneOptions=function(t){var e;if(L(t)){var i=this.getDrawPaneById(t);return null!==(e=null==i?void 0:i.getOptions())&&void 0!==e?e:null}return this._drawPanes.map((function(t){return t.getOptions()}))},e.prototype.setZoomEnabled=function(t){this._chartStore.setZoomEnabled(t)},e.prototype.isZoomEnabled=function(){return this._chartStore.isZoomEnabled()},e.prototype.setScrollEnabled=function(t){this._chartStore.setScrollEnabled(t)},e.prototype.isScrollEnabled=function(){return this._chartStore.isScrollEnabled()},e.prototype.scrollByDistance=function(t,e){var i=this,n=R(e)&&e>0?e:0;if(this._chartStore.startScroll(),n>0){var o=new gt({duration:n});o.doFrame((function(e){var o=t*(e/n);i._chartStore.scroll(o)})),o.start()}else this._chartStore.scroll(t)},e.prototype.scrollToRealTime=function(t){var e=this._chartStore.getBarSpace().bar,i=(this._chartStore.getLastBarRightSideDiffBarCount()-this._chartStore.getInitialOffsetRightDistance()/e)*e;this.scrollByDistance(i,t)},e.prototype.scrollToDataIndex=function(t,e){var i=(this._chartStore.getLastBarRightSideDiffBarCount()+(this.getDataList().length-1-t))*this._chartStore.getBarSpace().bar;this.scrollByDistance(i,e)},e.prototype.scrollToTimestamp=function(t,e){var i=_t(this.getDataList(),"timestamp",t);this.scrollToDataIndex(i,e)},e.prototype.zoomAtCoordinate=function(t,e,i){var n=this,o=R(i)&&i>0?i:0,r=this._chartStore.getBarSpace().bar,a=r*t-r;if(o>0){var s=0,l=new gt({duration:o});l.doFrame((function(t){var i=a*(t/o),r=(i-s)/n._chartStore.getBarSpace().bar*10;n._chartStore.zoom(r,e),s=i})),l.start()}else this._chartStore.zoom(a/r*10,e)},e.prototype.zoomAtDataIndex=function(t,e,i){var n=this._chartStore.dataIndexToCoordinate(e);this.zoomAtCoordinate(t,{x:n,y:0},i)},e.prototype.zoomAtTimestamp=function(t,e,i){var n=_t(this.getDataList(),"timestamp",e);this.zoomAtDataIndex(t,n,i)},e.prototype.convertToPixel=function(t,e){var i,n=this,o=null!=e?e:{},r=o.paneId,a=void 0===r?Se:r,s=o.absolute,l=void 0!==s&&s,u=[];if(a!==Pe){var c=this.getDrawPaneById(a);if(null!==c){var h=c.getBounding(),d=[].concat(t),p=this._xAxisPane.getAxisComponent(),g=c.getAxisComponent();u=d.map((function(t){var e={},i=t.dataIndex;if(R(t.timestamp)&&(i=n._chartStore.timestampToDataIndex(t.timestamp)),R(i)&&(e.x=p.convertToPixel(i)),R(t.value)){var o=g.convertToPixel(t.value);e.y=l?h.top+o:o}return e}))}}return A(t)?u:null!==(i=u[0])&&void 0!==i?i:{}},e.prototype.convertFromPixel=function(t,e){var i,n=this,o=null!=e?e:{},r=o.paneId,a=void 0===r?Se:r,s=o.absolute,l=void 0!==s&&s,u=[];if(a!==Pe){var c=this.getDrawPaneById(a);if(null!==c){var h=c.getBounding(),d=[].concat(t),p=this._xAxisPane.getAxisComponent(),g=c.getAxisComponent();u=d.map((function(t){var e,i={};if(R(t.x)){var o=p.convertFromPixel(t.x);i.dataIndex=o,i.timestamp=null!==(e=n._chartStore.dataIndexToTimestamp(o))&&void 0!==e?e:void 0}if(R(t.y)){var r=l?t.y-h.top:t.y;i.value=g.convertFromPixel(r)}return i}))}}return A(t)?u:null!==(i=u[0])&&void 0!==i?i:{}},e.prototype.executeAction=function(e,i){var n;if(e===t.ActionType.OnCrosshairChange){var o=c({},i);null!==(n=o.paneId)&&void 0!==n||(o.paneId=Se),this._chartStore.setCrosshair(o)}},e.prototype.subscribeAction=function(t,e){this._chartStore.subscribeAction(t,e)},e.prototype.unsubscribeAction=function(t,e){this._chartStore.unsubscribeAction(t,e)},e.prototype.getConvertPictureUrl=function(t,e,i){var n=this,o=this._chartBounding,r=o.width,a=o.height,s=mt("canvas",{width:"".concat(r,"px"),height:"".concat(a,"px"),boxSizing:"border-box"}),l=s.getContext("2d"),u=q(s);s.width=r*u,s.height=a*u,l.scale(u,u),l.fillStyle=null!=i?i:"#FFFFFF",l.fillRect(0,0,r,a);var c=null!=t&&t;return this._drawPanes.forEach((function(t){var e=n._separatorPanes.get(t);if(L(e)){var i=e.getBounding();l.drawImage(e.getImage(c),i.left,i.top,i.width,i.height)}var o=t.getBounding();l.drawImage(t.getImage(c),0,o.top,r,o.height)})),s.toDataURL("image/".concat(null!=e?e:"jpeg"))},e.prototype.resize=function(){this._cacheChartBounding(),this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.destroy=function(){var t=this;this._chartEvent.destroy(),this._drawPanes.forEach((function(e){var i;e.destroy(),null===(i=t._separatorPanes.get(e))||void 0===i||i.destroy()})),this._drawPanes=[],this._separatorPanes.clear(),this._container.removeChild(this._chartContainer)},e}(),Qi=new Map,$i=1;var tn={clone:D,merge:M,isString:W,isNumber:R,isValid:L,isObject:B,isArray:A,isFunction:F,isBoolean:O,formatValue:N,formatPrecision:X,formatBigNumber:G,formatDate:H,formatThousands:K,formatFoldDecimal:U,calcTextWidth:Q,getLinearSlopeIntercept:ue,getLinearYFromSlopeIntercept:se,getLinearYFromCoordinates:le,checkCoordinateOnArc:Ze,checkCoordinateOnCircle:ze,checkCoordinateOnLine:ae,checkCoordinateOnPolygon:Ne,checkCoordinateOnRect:He,checkCoordinateOnText:Ue};t.dispose=function(t){var e,i,n=null;if(t instanceof Ji)n=t.id;else{var o=null;n=null!==(e=null==(o=W(t)?document.getElementById(t):t)?void 0:o.getAttribute("k-line-chart-id"))&&void 0!==e?e:null}null!==n&&(null===(i=Qi.get(n))||void 0===i||i.destroy(),Qi.delete(n))},t.getFigureClass=function(t){var e;return null!==(e=Je[t])&&void 0!==e?e:null},t.getOverlayClass=function(t){var e;return null!==(e=Ce[t])&&void 0!==e?e:null},t.getSupportedFigures=function(){return Object.keys(Je)},t.getSupportedIndicators=function(){return Object.keys($t)},t.getSupportedLocales=function(){return Object.keys(di)},t.getSupportedOverlays=function(){return Object.keys(Ce)},t.init=function(t,e){var i=null;if(null===(i=W(t)?document.getElementById(t):t))return null;var n=Qi.get(i.id);if(L(n))return n;var o="k_line_chart_".concat($i++);return(n=new Ji(i,e)).id=o,i.setAttribute("k-line-chart-id",o),Qi.set(o,n),n},t.registerFigure=function(t){Je[t.name]=re.extend(t)},t.registerIndicator=function(t){$t[t.name]=ot.extend(t)},t.registerLocale=function(t,e){di[t]=c(c({},di[t]),e)},t.registerOverlay=function(t){Ce[t.name]=st.extend(t)},t.registerStyles=function(t,e){Te[t]=e},t.registerXAxis=function(t){Ri[t.name]=Bi.extend(t)},t.registerYAxis=function(t){Si[t.name]=bi.extend(t)},t.utils=tn,t.version=function(){return"10.0.0-alpha2"}}));
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).klinecharts={})}(this,(function(t){"use strict";var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},e(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n,o,r,a,s,l,u,c=function(){return c=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},c.apply(this,arguments)};function h(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}function d(t,e,i,n){return new(i||(i=Promise))((function(o,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function s(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))}function p(t,e){var i,n,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(i=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,n=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(6===s[0]&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(t){s=[6,t],n=0}finally{i=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function g(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,o,r=i.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=r.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return a}function f(t,e,i){if(i||2===arguments.length)for(var n,o=0,r=e.length;o<r;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError,t.LineType=void 0,(n=t.LineType||(t.LineType={})).Dashed="dashed",n.Solid="solid",t.PolygonType=void 0,(o=t.PolygonType||(t.PolygonType={})).Stroke="stroke",o.Fill="fill",o.StrokeFill="stroke_fill",t.TooltipShowRule=void 0,(r=t.TooltipShowRule||(t.TooltipShowRule={})).Always="always",r.FollowCross="follow_cross",r.None="none",t.TooltipShowType=void 0,(a=t.TooltipShowType||(t.TooltipShowType={})).Standard="standard",a.Rect="rect",t.TooltipIconPosition=void 0,(s=t.TooltipIconPosition||(t.TooltipIconPosition={})).Left="left",s.Middle="middle",s.Right="right",t.CandleTooltipRectPosition=void 0,(l=t.CandleTooltipRectPosition||(t.CandleTooltipRectPosition={})).Fixed="fixed",l.Pointer="pointer",t.CandleType=void 0,(u=t.CandleType||(t.CandleType={})).HeikinAshi="heikin_ashi",u.CandleSolid="candle_solid",u.CandleStroke="candle_stroke",u.CandleUpStroke="candle_up_stroke",u.CandleDownStroke="candle_down_stroke",u.Ohlc="ohlc",u.Area="area";var y="#F92855",m="rgba(249, 40, 85, .7)",_="#2DC08E",x="rgba(45, 192, 142, .7)",C="#888888",b="#FFFFFF",T="#1677FF",w="#76808F",S="#DDDDDD";function P(t){return"rgba(22, 119, 255, ".concat(t,")")}function E(){function e(){return{show:!0,size:1,color:"#EDEDED",style:t.LineType.Dashed,dashedValue:[2,2]}}return{show:!0,horizontal:e(),vertical:e()}}function I(){return{show:!0,size:"auto",axisLine:{show:!0,color:S,size:1},tickText:{show:!0,color:w,size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:6},tickLine:{show:!0,size:1,length:3,color:S}}}function k(){function e(){return{show:!0,line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,2],size:1,color:w},text:{show:!0,style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:w,borderRadius:2,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:w}}}return{show:!0,horizontal:e(),vertical:e()}}function M(t,e){if(B(t)||B(e))for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=t[i],o=e[i];B(o)&&B(n)?M(n,o):L(e[i])&&(t[i]=D(e[i]))}}function D(t){if(!B(t))return t;var e=null;for(var i in e=A(t)?[]:{},t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];B(n)?e[i]=D(n):e[i]=n}return e}function A(t){return"[object Array]"===Object.prototype.toString.call(t)}function F(t){return"function"==typeof t}function B(t){return"object"==typeof t&&L(t)}function R(t){return"number"==typeof t&&Number.isFinite(t)}function L(t){return null!=t}function O(t){return"boolean"==typeof t}function W(t){return"string"==typeof t}var z=/\\(\\)?/g,V=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g");function N(t,e,i){if(L(t)){var n=[];e.replace(V,(function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var o=t;return L(e[1])?o=e[2].replace(z,"$1"):L(e[0])&&(o=e[0].trim()),n.push(o),""}));for(var o=t,r=0,a=n.length;L(o)&&r<a;)o=null==o?void 0:o[n[r++]];return L(o)?o:null!=i?i:"--"}return null!=i?i:"--"}function Y(t,e){var i={};return t.formatToParts(new Date(e)).forEach((function(t){var e=t.type,n=t.value;switch(e){case"year":i.YYYY=n;break;case"month":i.MM=n;break;case"day":i.DD=n;break;case"hour":i.HH="24"===n?"00":n;break;case"minute":i.mm=n;break;case"second":i.ss=n}})),i}function H(t,e,i){var n=Y(t,e);return i.replace(/YYYY|MM|DD|HH|mm|ss/g,(function(t){return n[t]}))}function X(t,e){var i=+t;return R(i)?i.toFixed(null!=e?e:2):"".concat(t)}function G(t){var e=+t;if(R(e)){if(e>1e9)return"".concat(+(e/1e9).toFixed(3),"B");if(e>1e6)return"".concat(+(e/1e6).toFixed(3),"M");if(e>1e3)return"".concat(+(e/1e3).toFixed(3),"K")}return"".concat(t)}function K(t,e){var i="".concat(t);if(0===e.length)return i;if(i.includes(".")){var n=i.split(".");return"".concat(n[0].replace(/(\d)(?=(\d{3})+$)/g,(function(t){return"".concat(t).concat(e)})),".").concat(n[1])}return i.replace(/(\d)(?=(\d{3})+$)/g,(function(t){return"".concat(t).concat(e)}))}function U(t,e){var i="".concat(t);if(new RegExp("\\.0{"+e+",}[1-9][0-9]*$").test(i)){var n=i.split("."),o=n.length-1,r=n[o],a=/0*/.exec(r);if(L(a)){var s=a[0].length;return n[o]=r.replace(/0*/,"0{".concat(s,"}")),n.join(".")}}return i}var j,Z=null;function q(t){var e,i;return null!==(i=null===(e=t.ownerDocument.defaultView)||void 0===e?void 0:e.devicePixelRatio)&&void 0!==i?i:1}function J(t,e,i){return"".concat(null!=e?e:"normal"," ").concat(null!=t?t:12,"px ").concat(null!=i?i:"Helvetica Neue")}function Q(t,e,i,n){if(!L(Z)){var o=document.createElement("canvas"),r=q(o);(Z=o.getContext("2d")).scale(r,r)}return Z.font=J(e,i,n),Math.round(Z.measureText(t).width)}t.ActionType=void 0,(j=t.ActionType||(t.ActionType={})).OnZoom="onZoom",j.OnScroll="onScroll",j.OnVisibleRangeChange="onVisibleRangeChange",j.OnTooltipIconClick="onTooltipIconClick",j.OnCrosshairChange="onCrosshairChange",j.OnCandleBarClick="onCandleBarClick",j.OnPaneDrag="onPaneDrag";var $,tt,et=function(){function t(){this._callbacks=[]}return t.prototype.subscribe=function(t){this._callbacks.indexOf(t)<0&&this._callbacks.push(t)},t.prototype.unsubscribe=function(t){if(F(t)){var e=this._callbacks.indexOf(t);e>-1&&this._callbacks.splice(e,1)}else this._callbacks=[]},t.prototype.execute=function(t){this._callbacks.forEach((function(e){e(t)}))},t.prototype.isEmpty=function(){return 0===this._callbacks.length},t}();function it(t,e,i,n){var o,r=t.result,a=t.figures,s=t.styles,l=N(s,"circles",i.circles),u=l.length,h=N(s,"bars",i.bars),d=h.length,p=N(s,"lines",i.lines),g=p.length,v=0,f=0,y=0,m=0;a.forEach((function(a){var s;switch(a.type){case"circle":m=v;var _=l[v%u];o=c(c({},_),{color:_.noChangeColor}),v++;break;case"bar":m=f;var x=h[f%d];o=c(c({},x),{color:x.noChangeColor}),f++;break;case"line":m=y,o=p[y%g],y++}if(L(a.type)){var C=null===(s=a.styles)||void 0===s?void 0:s.call(a,{data:{prev:r[e-1],current:r[e],next:r[e+1]},indicator:t,defaultStyles:i});n(a,c(c({},o),C),m)}}))}t.IndicatorSeries=void 0,($=t.IndicatorSeries||(t.IndicatorSeries={})).Normal="normal",$.Price="price",$.Volume="volume",function(t){t.Loading="loading",t.Error="error",t.Ready="ready"}(tt||(tt={}));var nt,ot=function(){function e(e){this.precision=4,this.calcParams=[],this.shouldOhlc=!1,this.shouldFormatBigNumber=!1,this.visible=!0,this.zLevel=0,this.series=t.IndicatorSeries.Normal,this.figures=[],this.minValue=null,this.maxValue=null,this.styles=null,this.shouldUpdate=function(t,e){var i=JSON.stringify(t.calcParams)!==JSON.stringify(e.calcParams)||t.figures!==e.figures||t.calc!==e.calc;return{calc:i,draw:i||t.shortName!==e.shortName||t.series!==e.series||t.minValue!==e.minValue||t.maxValue!==e.maxValue||t.precision!==e.precision||t.shouldOhlc!==e.shouldOhlc||t.shouldFormatBigNumber!==e.shouldFormatBigNumber||t.visible!==e.visible||t.zLevel!==e.zLevel||t.extendData!==e.extendData||t.regenerateFigures!==e.regenerateFigures||t.createTooltipDataSource!==e.createTooltipDataSource||t.draw!==e.draw}},this.calc=function(){return[]},this.regenerateFigures=null,this.createTooltipDataSource=null,this.draw=null,this.onDataStateChange=null,this.result=[],this._lockSeriesPrecision=!1,this.override(e),this._lockSeriesPrecision=!1}return e.prototype.override=function(t){var e,i,n=this.result,o=h(this,["result"]);this._prevIndicator=c(c({},D(o)),{result:n});var r=t.name,a=t.shortName,s=t.precision,l=t.styles,u=t.figures,d=t.calcParams,p=h(t,["name","shortName","precision","styles","figures","calcParams"]);W(this.name)||(this.name=null!=r?r:""),this.shortName=null!==(e=null!=a?a:this.shortName)&&void 0!==e?e:this.name,R(s)&&(this.precision=s,this._lockSeriesPrecision=!0),L(l)&&(null!==(i=this.styles)&&void 0!==i||(this.styles={}),M(this.styles,l)),M(this,p),L(d)&&(this.calcParams=d,F(this.regenerateFigures)&&(this.figures=this.regenerateFigures(this.calcParams))),this.figures=null!=u?u:this.figures},e.prototype.setSeriesPrecision=function(t){this._lockSeriesPrecision||(this.precision=t)},e.prototype.shouldUpdateImp=function(){var t=this._prevIndicator.zLevel!==this.zLevel,e=this.shouldUpdate(this._prevIndicator,this);return O(e)?{calc:e,draw:e,sort:t}:c(c({},e),{sort:t})},e.prototype.calcImp=function(t){return d(this,void 0,void 0,(function(){var e;return p(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.calc(t,this)];case 1:return e=i.sent(),this.result=e,[2,!0];case 2:return i.sent(),[2,!1];case 3:return[2]}}))}))},e.extend=function(t){return function(e){function n(){return e.call(this,t)||this}return i(n,e),n}(e)},e}();t.OverlayMode=void 0,(nt=t.OverlayMode||(t.OverlayMode={})).Normal="normal",nt.WeakMagnet="weak_magnet",nt.StrongMagnet="strong_magnet";var rt,at="overlay_figure_",st=function(){function e(e){this.groupId="",this.totalStep=1,this.currentStep=1,this.lock=!1,this.visible=!0,this.zLevel=0,this.needDefaultPointFigure=!1,this.needDefaultXAxisFigure=!1,this.needDefaultYAxisFigure=!1,this.mode=t.OverlayMode.Normal,this.modeSensitivity=8,this.points=[],this.extendData=null,this.styles=null,this.createPointFigures=null,this.createXAxisFigures=null,this.createYAxisFigures=null,this.performEventPressedMove=null,this.performEventMoveForDrawing=null,this.onDrawStart=null,this.onDrawing=null,this.onDrawEnd=null,this.onClick=null,this.onDoubleClick=null,this.onRightClick=null,this.onPressedMoveStart=null,this.onPressedMoving=null,this.onPressedMoveEnd=null,this.onMouseEnter=null,this.onMouseLeave=null,this.onRemoved=null,this.onSelected=null,this.onDeselected=null,this._prevPressedPoint=null,this._prevPressedPoints=[],this.override(e)}return e.prototype.override=function(t){var e,i;this._prevOverlay=D(this);var n=t.id,o=t.name;t.currentStep;var r=t.points,a=t.styles;if(M(this,h(t,["id","name","currentStep","points","styles"])),W(this.name)||(this.name=null!=o?o:""),!W(this.id)&&W(n)&&(this.id=n),L(a)&&(null!==(e=this.styles)&&void 0!==e||(this.styles={}),M(this.styles,a)),A(r)&&r.length>0){var s=0;if(this.points=f([],v(r),!1),r.length>=this.totalStep-1?(this.currentStep=-1,s=this.totalStep-1):(this.currentStep=r.length+1,s=r.length),F(this.performEventMoveForDrawing))for(var l=0;l<s;l++)this.performEventMoveForDrawing({currentStep:l+2,mode:this.mode,points:this.points,performPointIndex:l,performPoint:this.points[l]});-1===this.currentStep&&(null===(i=this.performEventPressedMove)||void 0===i||i.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:this.points.length-1,performPoint:this.points[this.points.length-1]}))}},e.prototype.shouldUpdate=function(){var t=this._prevOverlay.zLevel!==this.zLevel;return{sort:t,draw:t||JSON.stringify(this._prevOverlay)!==JSON.stringify(this.points)||this._prevOverlay.visible!==this.visible||this._prevOverlay.extendData!==this.extendData||this._prevOverlay.styles!==this.styles}},e.prototype.nextStep=function(){this.currentStep===this.totalStep-1?this.currentStep=-1:this.currentStep++},e.prototype.forceComplete=function(){this.currentStep=-1},e.prototype.isDrawing=function(){return-1!==this.currentStep},e.prototype.isStart=function(){return 1===this.currentStep},e.prototype.eventMoveForDrawing=function(t){var e,i=this.currentStep-1,n={};R(t.timestamp)&&(n.timestamp=t.timestamp),R(t.dataIndex)&&(n.dataIndex=t.dataIndex),R(t.value)&&(n.value=t.value),this.points[i]=n,null===(e=this.performEventMoveForDrawing)||void 0===e||e.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:i,performPoint:n})},e.prototype.eventPressedPointMove=function(t,e){var i;this.points[e].timestamp=t.timestamp,R(t.value)&&(this.points[e].value=t.value),null===(i=this.performEventPressedMove)||void 0===i||i.call(this,{currentStep:this.currentStep,points:this.points,mode:this.mode,performPointIndex:e,performPoint:this.points[e]})},e.prototype.startPressedMove=function(t){this._prevPressedPoint=c({},t),this._prevPressedPoints=D(this.points)},e.prototype.eventPressedOtherMove=function(t,e){if(null!==this._prevPressedPoint){var i=null;R(t.dataIndex)&&R(this._prevPressedPoint.dataIndex)&&(i=t.dataIndex-this._prevPressedPoint.dataIndex);var n=null;R(t.value)&&R(this._prevPressedPoint.value)&&(n=t.value-this._prevPressedPoint.value),this.points=this._prevPressedPoints.map((function(t){var o;R(t.timestamp)&&(t.dataIndex=e.timestampToDataIndex(t.timestamp));var r=c({},t);return R(i)&&R(t.dataIndex)&&(r.dataIndex=t.dataIndex+i,r.timestamp=null!==(o=e.dataIndexToTimestamp(r.dataIndex))&&void 0!==o?o:void 0),R(n)&&R(t.value)&&(r.value=t.value+n),r}))}},e.extend=function(t){return function(e){function n(){return e.call(this,t)||this}return i(n,e),n}(e)},e}();function lt(t){var e={width:0,height:0,left:0,right:0,top:0,bottom:0};return L(t)&&M(e,t),e}t.FormatDateType=void 0,(rt=t.FormatDateType||(t.FormatDateType={}))[rt.Tooltip=0]="Tooltip",rt[rt.Crosshair=1]="Crosshair",rt[rt.XAxis=2]="XAxis";var ut=-1;function ct(t){return F(window.requestAnimationFrame)?window.requestAnimationFrame(t):window.setTimeout(t,20)}function ht(t){F(window.cancelAnimationFrame)?window.cancelAnimationFrame(t):window.clearTimeout(t)}function dt(t){if(F(window.requestIdleCallback))return window.requestIdleCallback(t);var e=performance.now();return window.setTimeout((function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(performance.now()-e))}})}),1)}var pt,gt=function(){function t(t){this._options={duration:500,iterationCount:1},this._currentIterationCount=0,this._running=!1,this._time=0,M(this._options,t)}return t.prototype._loop=function(){var t=this;this._running=!0;var e=function(){var i;if(t._running){var n=(new Date).getTime()-t._time;n<t._options.duration?(null===(i=t._doFrameCallback)||void 0===i||i.call(t,n),ct(e)):(t.stop(),t._currentIterationCount++,t._currentIterationCount<t._options.iterationCount&&t.start())}};ct(e)},t.prototype.doFrame=function(t){return this._doFrameCallback=t,this},t.prototype.setDuration=function(t){return this._options.duration=t,this},t.prototype.setIterationCount=function(t){return this._options.iterationCount=t,this},t.prototype.start=function(){this._running||(this._time=(new Date).getTime(),this._loop())},t.prototype.stop=function(){var t;this._running&&(null===(t=this._doFrameCallback)||void 0===t||t.call(this,this._options.duration)),this._running=!1},t}(),vt=1,ft=(new Date).getTime();function yt(t){var e=(new Date).getTime();return e===ft?++vt:vt=1,ft=e,"".concat(null!=t?t:"").concat(e,"_").concat(vt)}function mt(t,e){var i,n=document.createElement(t),o=null!=e?e:{};for(var r in o)n.style[r]=null!==(i=o[r])&&void 0!==i?i:"";return n}function _t(t,e,i){var n=0,o=0;for(o=t.length-1;n!==o;){var r=Math.floor((o+n)/2),a=o-n,s=t[r][e];if(i===t[n][e])return n;if(i===t[o][e])return o;if(i===s)return r;if(i>s?n=r:o=r,a<=2)break}return n}function xt(t,e){e=Math.max(0,null!=e?e:0);var i=Math.pow(10,e);return Math.round(t*i)/i}function Ct(t,e,i){for(var n,o,r=[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],a=t.length,s=0;s<a;){var l=t[s];r[0]=Math.max(null!==(n=l[e])&&void 0!==n?n:Number.MIN_SAFE_INTEGER,r[0]),r[1]=Math.min(null!==(o=l[i])&&void 0!==o?o:Number.MAX_SAFE_INTEGER,r[1]),++s}return r}function bt(t){return 0===t?0:Math.log10(t)}function Tt(t){return Math.pow(10,t)}function wt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.join("_")}!function(t){t.Init="init",t.Forward="forward",t.Backward="backward",t.Update="update"}(pt||(pt={}));var St=function(){function t(t){this._requestIdleCallbackId=ut,this._tasks=null!=t?t:[],this._operateTasks()}return t.prototype._operateTasks=function(t){var e,i=this;this._requestIdleCallbackId!==ut&&(e=this._requestIdleCallbackId,F(window.cancelIdleCallback)?window.cancelIdleCallback(e):window.clearTimeout(e),this._requestIdleCallbackId=ut),null==t||t(),this._requestIdleCallbackId=dt((function(t){i._runTasks(t)}))},t.prototype._runTasks=function(t){for(var e=this;t.timeRemaining()>0&&this._tasks.length>0;){var i=this._tasks.shift();null==i||i.handler()}this._tasks.length>0&&(this._requestIdleCallbackId=dt((function(t){e._runTasks(t)})))},t.prototype.addTask=function(t){var e=this;return this._operateTasks((function(){var i=e._tasks.findIndex((function(e){return e.id===t.id}));i>-1?e._tasks[i]=t:e._tasks.push(t)})),this},t.prototype.removeTask=function(t){var e=this;return this._operateTasks((function(){var i=e._tasks.findIndex((function(e){return e.id===t}));i>-1&&e._tasks.splice(i,1)})),this},t}(),Pt=31536e3,Et=2592e3,It=86400,kt=3600,Mt=60,Dt=1;function At(t,e,i,n,o,r){var a;void 0===n&&(n=0);for(var s=null,l=null!=r?r:null,u=0;u<e.length;u++){var c=e[u].timestamp,h=Dt,d=Y(i,c);L(s)&&(h=d.YYYY!==s.YYYY?Pt:d.MM!==s.MM?Et:d.DD!==s.DD?It:d.HH!==s.HH?kt:d.mm!==s.mm?Mt:Dt),R(l)&&R(null==o?void 0:o.value)&&(o.value=Math.min(o.value,c-l));var p=null!==(a=t.get(h))&&void 0!==a?a:[];p.push({dataIndex:u+n,weight:h,timestamp:c}),t.set(h,p),s=d,l=c}}function Ft(t,e){var i=Math.max(Q("0000-00-00 00:00:00",e.size,e.weight,e.family),146);return Math.ceil(i/t)}function Bt(t,e,i){var n=Ft(e,i),o=[];return Array.from(t.keys()).sort((function(t,e){return e-t})).forEach((function(e){var i=t.get(e),r=o;o=[];for(var a=r.length,s=0,l=i.length,u=1/0,c=-1/0,h=0;h<l;h++){for(var d=i[h],p=d.dataIndex;s<a;){var g=r[s],v=g.dataIndex;if(!(v<p)){u=v;break}s++,o.push(g),c=v,u=1/0}u-p>=n&&p-c>=n&&(o.push(d),c=p)}for(;s<a;s++)o.push(r[s])})),o}var Rt={name:"AVP",shortName:"AVP",series:t.IndicatorSeries.Price,precision:2,styles:{lines:[{color:"#A020F0",size:1}]},figures:[{key:"avp",title:"AVP: ",type:"line"}],calc:function(t){var e=0,i=0;return t.map((function(t){var n,o,r={},a=null!==(n=t.turnover)&&void 0!==n?n:0,s=null!==(o=t.volume)&&void 0!==o?o:0;return e+=a,0!==(i+=s)&&(r.avp=e/i),r}))}},Lt={name:"AO",shortName:"AO",calcParams:[5,34],figures:[{key:"ao",title:"AO: ",type:"bar",baseValue:0,styles:function(e){var i,n,o=e.data,r=e.indicator,a=e.defaultStyles,s=o.prev,l=o.current,u=null!==(i=null==s?void 0:s.ao)&&void 0!==i?i:Number.MIN_SAFE_INTEGER,c=null!==(n=null==l?void 0:l.ao)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,h="";return{color:h=c>u?N(r.styles,"bars[0].upColor",a.bars[0].upColor):N(r.styles,"bars[0].downColor",a.bars[0].downColor),style:c>u?t.PolygonType.Stroke:t.PolygonType.Fill,borderColor:h}}}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),o=0,r=0,a=0,s=0;return t.map((function(e,l){var u={},c=(e.low+e.high)/2;if(o+=c,r+=c,l>=i[0]-1){a=o/i[0];var h=t[l-(i[0]-1)];o-=(h.low+h.high)/2}if(l>=i[1]-1){s=r/i[1];h=t[l-(i[1]-1)];r-=(h.low+h.high)/2}return l>=n-1&&(u.ao=a-s),u}))}};var Ot={name:"BOLL",shortName:"BOLL",series:t.IndicatorSeries.Price,calcParams:[20,2],precision:2,shouldOhlc:!0,styles:{lines:[{color:"#FF6E6E",size:1},{color:"#FFD700",size:1},{color:"#00CD00",size:1}]},figures:[{key:"up",title:"UP: ",type:"line"},{key:"mid",title:"MID: ",type:"line"},{key:"dn",title:"DN: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,o=0;return t.map((function(e,r){var a=e.close,s={};if(o+=a,r>=n){s.mid=o/i[0];var l=function(t,e){var i=t.length,n=0;return t.forEach((function(t){var i=t.close-e;n+=i*i})),n=Math.abs(n),Math.sqrt(n/i)}(t.slice(r-n,r+1),s.mid);s.up=s.mid+i[1]*l,s.dn=s.mid-i[1]*l,o-=t[r-n].close}return s}))}},Wt={name:"BBI",shortName:"BBI",series:t.IndicatorSeries.Price,precision:2,calcParams:[3,6,12,24],shouldOhlc:!0,styles:{lines:[{color:"#A020F0"}]},figures:[{key:"bbi",title:"BBI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max.apply(Math,f([],v(i),!1)),o=[],r=[];return t.map((function(e,a){var s={},l=e.close;if(i.forEach((function(e,i){var n;o[i]=(null!==(n=o[i])&&void 0!==n?n:0)+l,a>=e-1&&(r[i]=o[i]/e,o[i]-=t[a-(e-1)].close)})),a>=n-1){var u=0;r.forEach((function(t){u+=t})),s.bbi=u/4}return s}))}},zt={name:"CCI",shortName:"CCI",calcParams:[20],styles:{lines:[{color:"#007FFF",size:1}]},figures:[{key:"cci",title:"CCI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,o=0,r=[];return t.map((function(e,a){var s={},l=(e.high+e.low+e.close)/3;if(o+=l,r.push(l),a>=n){var u=o/i[0],c=r.slice(a-n,a+1),h=0;c.forEach((function(t){h+=Math.abs(t-u)}));var d=h/i[0];s.cci=0!==d?(l-u)/d/.015:0;var p=(t[a-n].high+t[a-n].low+t[a-n].close)/3;o-=p}return s}))}},Vt={name:"CR",shortName:"CR",calcParams:[26,10,20,40,60],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#FFFF00",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"cr",title:"CR: ",type:"line"},{key:"ma1",title:"MA1: ",type:"line"},{key:"ma2",title:"MA2: ",type:"line"},{key:"ma3",title:"MA3: ",type:"line"},{key:"ma4",title:"MA4: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.ceil(i[1]/2.5+1),o=Math.ceil(i[2]/2.5+1),r=Math.ceil(i[3]/2.5+1),a=Math.ceil(i[4]/2.5+1),s=0,l=[],u=0,c=[],h=0,d=[],p=0,g=[],v=[];return t.forEach((function(e,f){var y,m,_,x,C,b={},T=null!==(y=t[f-1])&&void 0!==y?y:e,w=(T.high+T.close+T.low+T.open)/4,S=Math.max(0,e.high-w),P=Math.max(0,w-e.low);f>=i[0]-1&&(b.cr=0!==P?S/P*100:0,s+=b.cr,u+=b.cr,h+=b.cr,p+=b.cr,f>=i[0]+i[1]-2&&(l.push(s/i[1]),f>=i[0]+i[1]+n-3&&(b.ma1=l[l.length-1-n]),s-=null!==(m=v[f-(i[1]-1)].cr)&&void 0!==m?m:0),f>=i[0]+i[2]-2&&(c.push(u/i[2]),f>=i[0]+i[2]+o-3&&(b.ma2=c[c.length-1-o]),u-=null!==(_=v[f-(i[2]-1)].cr)&&void 0!==_?_:0),f>=i[0]+i[3]-2&&(d.push(h/i[3]),f>=i[0]+i[3]+r-3&&(b.ma3=d[d.length-1-r]),h-=null!==(x=v[f-(i[3]-1)].cr)&&void 0!==x?x:0),f>=i[0]+i[4]-2&&(g.push(p/i[4]),f>=i[0]+i[4]+a-3&&(b.ma4=g[g.length-1-a]),p-=null!==(C=v[f-(i[4]-1)].cr)&&void 0!==C?C:0)),v.push(b)})),v}},Nt={name:"DMA",shortName:"DMA",calcParams:[10,50,10],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"dma",title:"DMA: ",type:"line"},{key:"ama",title:"AMA: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),o=0,r=0,a=0,s=[];return t.forEach((function(e,l){var u,c={},h=e.close;o+=h,r+=h;var d=0,p=0;if(l>=i[0]-1&&(d=o/i[0],o-=t[l-(i[0]-1)].close),l>=i[1]-1&&(p=r/i[1],r-=t[l-(i[1]-1)].close),l>=n-1){var g=d-p;c.dma=g,a+=g,l>=n+i[2]-2&&(c.ama=a/i[2],a-=null!==(u=s[l-(i[2]-1)].dma)&&void 0!==u?u:0)}s.push(c)})),s}},Yt={name:"DMI",shortName:"DMI",calcParams:[14,6],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"pdi",title:"PDI: ",type:"line"},{key:"mdi",title:"MDI: ",type:"line"},{key:"adx",title:"ADX: ",type:"line"},{key:"adxr",title:"ADXR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=0,l=0,u=0,c=0,h=[];return t.forEach((function(e,d){var p,g,v={},f=null!==(p=t[d-1])&&void 0!==p?p:e,y=f.close,m=e.high,_=e.low,x=m-_,C=Math.abs(m-y),b=Math.abs(y-_),T=m-f.high,w=f.low-_,S=Math.max(Math.max(x,C),b),P=T>0&&T>w?T:0,E=w>0&&w>T?w:0;if(n+=S,o+=P,r+=E,d>=i[0]-1){d>i[0]-1?(a=a-a/i[0]+S,s=s-s/i[0]+P,l=l-l/i[0]+E):(a=n,s=o,l=r);var I=0,k=0;0!==a&&(I=100*s/a,k=100*l/a),v.pdi=I,v.mdi=k;var M=0;k+I!==0&&(M=Math.abs(k-I)/(k+I)*100),u+=M,d>=2*i[0]-2&&(c=d>2*i[0]-2?(c*(i[0]-1)+M)/i[0]:u/i[0],v.adx=c,d>=2*i[0]+i[1]-3&&(v.adxr=((null!==(g=h[d-(i[1]-1)].adx)&&void 0!==g?g:0)+c)/2))}h.push(v)})),h}},Ht={name:"EMA",shortName:"EMA",series:t.IndicatorSeries.Price,calcParams:[6,12,20],styles:{lines:[{color:"#FF6E6E",size:1},{color:"#FFD700",size:1},{color:"#00CD00",size:1}]},precision:2,shouldOhlc:!0,figures:[{key:"ema1",title:"EMA6: ",type:"line"},{key:"ema2",title:"EMA12: ",type:"line"},{key:"ema3",title:"EMA20: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"ema".concat(e+1),title:"EMA".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=0,r=[];return t.map((function(t,e){var a={},s=t.close;return o+=s,i.forEach((function(t,i){e>=t-1&&(r[i]=e>t-1?(2*s+(t-1)*r[i])/(t+1):o/t,a[n[i].key]=r[i])})),a}))}},Xt={name:"MA",shortName:"MA",series:t.IndicatorSeries.Price,calcParams:[5,10,30,60],precision:2,shouldOhlc:!0,figures:[{key:"ma1",title:"MA5: ",type:"line"},{key:"ma2",title:"MA10: ",type:"line"},{key:"ma3",title:"MA30: ",type:"line"},{key:"ma4",title:"MA60: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=[];return t.map((function(e,r){var a={},s=e.close;return i.forEach((function(e,i){var l;o[i]=(null!==(l=o[i])&&void 0!==l?l:0)+s,r>=e-1&&(a[n[i].key]=o[i]/e,o[i]-=t[r-(e-1)].close)})),a}))}},Gt={name:"MACD",shortName:"MACD",calcParams:[12,26,9],figures:[{key:"dif",title:"DIF: ",type:"line"},{key:"dea",title:"DEA: ",type:"line"},{key:"macd",title:"MACD: ",type:"bar",baseValue:0,styles:function(e){var i,n,o=e.data,r=e.indicator,a=e.defaultStyles,s=o.prev,l=o.current,u=null!==(i=null==s?void 0:s.macd)&&void 0!==i?i:Number.MIN_SAFE_INTEGER,c=null!==(n=null==l?void 0:l.macd)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,h="";return h=c>0?N(r.styles,"bars[0].upColor",a.bars[0].upColor):c<0?N(r.styles,"bars[0].downColor",a.bars[0].downColor):N(r.styles,"bars[0].noChangeColor",a.bars[0].noChangeColor),{style:u<c?t.PolygonType.Stroke:t.PolygonType.Fill,color:h,borderColor:h}}}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=0,l=0,u=Math.max(i[0],i[1]);return t.map((function(t,e){var c={},h=t.close;return n+=h,e>=i[0]-1&&(o=e>i[0]-1?(2*h+(i[0]-1)*o)/(i[0]+1):n/i[0]),e>=i[1]-1&&(r=e>i[1]-1?(2*h+(i[1]-1)*r)/(i[1]+1):n/i[1]),e>=u-1&&(a=o-r,c.dif=a,s+=a,e>=u+i[2]-2&&(l=e>u+i[2]-2?(2*a+l*(i[2]-1))/(i[2]+1):s/i[2],c.macd=2*(a-l),c.dea=l)),c}))}},Kt={name:"RSI",shortName:"RSI",calcParams:[6,12,24],figures:[{key:"rsi1",title:"RSI1: ",type:"line"},{key:"rsi2",title:"RSI2: ",type:"line"},{key:"rsi3",title:"RSI3: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){var i=e+1;return{key:"rsi".concat(i),title:"RSI".concat(i,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i,r=[],a=[];return t.map((function(e,i){var s,l={},u=(null!==(s=t[i-1])&&void 0!==s?s:e).close,c=e.close-u;return o.forEach((function(e,o){var s,u,h;if(c>0?r[o]=(null!==(s=r[o])&&void 0!==s?s:0)+c:a[o]=(null!==(u=a[o])&&void 0!==u?u:0)+Math.abs(c),i>=e-1){0!==a[o]?l[n[o].key]=100-100/(1+r[o]/a[o]):l[n[o].key]=0;var d=t[i-(e-1)],p=null!==(h=t[i-e])&&void 0!==h?h:d,g=d.close-p.close;g>0?r[o]-=g:a[o]-=Math.abs(g)}})),l}))}},Ut={name:"SMA",shortName:"SMA",series:t.IndicatorSeries.Price,calcParams:[12,2],precision:2,styles:{lines:[{color:"#A020F0"}]},figures:[{key:"sma",title:"SMA: ",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams,n=0,o=0;return t.map((function(t,e){var r={},a=t.close;return n+=a,e>=i[0]-1&&(o=e>i[0]-1?(a*i[1]+o*(i[0]-i[1]+1))/(i[0]+1):n/i[0],r.sma=o),r}))}},jt={name:"KDJ",shortName:"KDJ",calcParams:[9,3,3],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"k",title:"K: ",type:"line"},{key:"d",title:"D: ",type:"line"},{key:"j",title:"J: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=[];return t.forEach((function(e,o){var r,a,s,l,u={},c=e.close;if(o>=i[0]-1){var h=Ct(t.slice(o-(i[0]-1),o+1),"high","low"),d=h[0],p=h[1],g=d-p,v=(c-p)/(0===g?1:g)*100;u.k=((i[1]-1)*(null!==(a=null===(r=n[o-1])||void 0===r?void 0:r.k)&&void 0!==a?a:50)+v)/i[1],u.d=((i[2]-1)*(null!==(l=null===(s=n[o-1])||void 0===s?void 0:s.d)&&void 0!==l?l:50)+u.k)/i[2],u.j=3*u.k-2*u.d}n.push(u)})),n}},Zt={name:"SAR",shortName:"SAR",series:t.IndicatorSeries.Price,calcParams:[2,2,20],precision:2,shouldOhlc:!0,styles:{circles:[{upColor:"#FF7F50",downColor:"#A020F0",noChangeColor:"#A8A8A8"}]},figures:[{key:"sar",title:"SAR: ",type:"circle",styles:function(t){var e,i,n,o=t.data,r=t.indicator,a=t.defaultStyles,s=o.current;return{color:(null!==(e=null==s?void 0:s.sar)&&void 0!==e?e:Number.MIN_SAFE_INTEGER)<((null!==(i=null==s?void 0:s.high)&&void 0!==i?i:0)+(null!==(n=null==s?void 0:s.low)&&void 0!==n?n:0))/2?N(r.styles,"circles[0].upColor",a.circles[0].upColor):N(r.styles,"circles[0].downColor",a.circles[0].downColor)}}}],calc:function(t,e){var i=e.calcParams,n=i[0]/100,o=i[1]/100,r=i[2]/100,a=n,s=-100,l=!1,u=0;return t.map((function(e,i){var c=u,h=e.high,d=e.low;if(l){(-100===s||s<h)&&(s=h,a=Math.min(a+o,r)),u=c+a*(s-c);var p=Math.min(t[Math.max(1,i)-1].low,d);u>e.low?(u=s,a=n,s=-100,l=!l):u>p&&(u=p)}else{(-100===s||s>d)&&(s=d,a=Math.min(a+o,r)),u=c+a*(s-c);var g=Math.max(t[Math.max(1,i)-1].high,h);u<e.high?(u=s,a=0,s=-100,l=!l):u<g&&(u=g)}return{high:h,low:d,sar:u}}))}};function qt(){return{key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t){var e=t.data,i=t.indicator,n=t.defaultStyles,o=e.current,r=N(i.styles,"bars[0].noChangeColor",n.bars[0].noChangeColor);return L(o)&&(o.close>o.open?r=N(i.styles,"bars[0].upColor",n.bars[0].upColor):o.close<o.open&&(r=N(i.styles,"bars[0].downColor",n.bars[0].downColor))),{color:r}}}}var Jt={name:"VOL",shortName:"VOL",series:t.IndicatorSeries.Volume,calcParams:[5,10,20],shouldFormatBigNumber:!0,precision:0,minValue:0,figures:[{key:"ma1",title:"MA5: ",type:"line"},{key:"ma2",title:"MA10: ",type:"line"},{key:"ma3",title:"MA20: ",type:"line"},qt()],regenerateFigures:function(t){var e=t.map((function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}}));return e.push(qt()),e},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i,r=[];return t.map((function(e,i){var a,s=null!==(a=e.volume)&&void 0!==a?a:0,l={volume:s,open:e.open,close:e.close};return o.forEach((function(e,o){var a,u;r[o]=(null!==(a=r[o])&&void 0!==a?a:0)+s,i>=e-1&&(l[n[o].key]=r[o]/e,r[o]-=null!==(u=t[i-(e-1)].volume)&&void 0!==u?u:0)})),l}))}},Qt={name:"WR",shortName:"WR",calcParams:[6,10,14],styles:{lines:[{color:"#A020F0",size:1},{color:"#FFD700",size:1},{color:"#FF6E6E",size:1}]},figures:[{key:"wr1",title:"WR1: ",type:"line"},{key:"wr2",title:"WR2: ",type:"line"},{key:"wr3",title:"WR3: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"wr".concat(e+1),title:"WR".concat(e+1,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i;return t.map((function(e,i){var r={},a=e.close;return o.forEach((function(e,o){var s=e-1;if(i>=s){var l=Ct(t.slice(i-s,i+1),"high","low"),u=l[0],c=u-l[1];r[n[o].key]=0===c?0:(a-u)/c*100}})),r}))}},$t={},te=[Rt,Lt,{name:"BIAS",shortName:"BIAS",calcParams:[6,12,24],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#ff0000",size:1}]},figures:[{key:"bias1",title:"BIAS6: ",type:"line"},{key:"bias2",title:"BIAS12: ",type:"line"},{key:"bias3",title:"BIAS24: ",type:"line"}],regenerateFigures:function(t){return t.map((function(t,e){return{key:"bias".concat(e+1),title:"BIAS".concat(t,": "),type:"line"}}))},calc:function(t,e){var i=e.calcParams,n=e.figures,o=i,r=[];return t.map((function(e,i){var a={},s=e.close;return o.forEach((function(e,l){var u;if(r[l]=(null!==(u=r[l])&&void 0!==u?u:0)+s,i>=e-1){var c=r[l]/o[l];a[n[l].key]=(s-c)/c*100,r[l]-=t[i-(e-1)].close}})),a}))}},Ot,{name:"BRAR",shortName:"BRAR",calcParams:[26],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"br",title:"BR: ",type:"line"},{key:"ar",title:"AR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0;return t.map((function(e,s){var l,u,c={},h=e.high,d=e.low,p=e.open,g=(null!==(l=t[s-1])&&void 0!==l?l:e).close;if(r+=h-p,a+=p-d,n+=h-g,o+=g-d,s>=i[0]-1){c.ar=0!==a?r/a*100:0,c.br=0!==o?n/o*100:0;var v=t[s-(i[0]-1)],f=v.high,y=v.low,m=v.open,_=(null!==(u=t[s-i[0]])&&void 0!==u?u:t[s-(i[0]-1)]).close;n-=f-_,o-=_-y,r-=f-m,a-=m-y}return c}))}},Wt,zt,Vt,Nt,Yt,{name:"EMV",shortName:"EMV",calcParams:[14,9],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"emv",title:"EMV: ",type:"line"},{key:"maEmv",title:"MAEMV: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=[];return t.map((function(e,r){var a,s={};if(r>0){var l=t[r-1],u=e.high,c=e.low,h=null!==(a=e.volume)&&void 0!==a?a:0,d=(u+c)/2-(l.high+l.low)/2;if(0===h||u-c==0)s.emv=0;else{var p=h/1e8/(u-c);s.emv=d/p}n+=s.emv,o.push(s.emv),r>=i[0]&&(s.maEmv=n/i[0],n-=o[r-i[0]])}return s}))}},Ht,{name:"MTM",shortName:"MTM",calcParams:[12,6],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1},{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"mtm",title:"MTM: ",type:"line"},{key:"maMtm",title:"MAMTM: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=[];return t.forEach((function(e,r){var a,s={};if(r>=i[0]){var l=e.close,u=t[r-i[0]].close;s.mtm=l-u,n+=s.mtm,r>=i[0]+i[1]-1&&(s.maMtm=n/i[1],n-=null!==(a=o[r-(i[1]-1)].mtm)&&void 0!==a?a:0)}o.push(s)})),o}},Xt,Gt,{name:"OBV",shortName:"OBV",calcParams:[30],styles:{lines:[{color:"#A020F0",size:1},{color:"#007FFF",size:1}]},figures:[{key:"obv",title:"OBV: ",type:"line"},{key:"maObv",title:"MAOBV: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=[];return t.forEach((function(e,a){var s,l,u,c,h=null!==(s=t[a-1])&&void 0!==s?s:e;e.close<h.close?o-=null!==(l=e.volume)&&void 0!==l?l:0:e.close>h.close&&(o+=null!==(u=e.volume)&&void 0!==u?u:0);var d={obv:o};n+=o,a>=i[0]-1&&(d.maObv=n/i[0],n-=null!==(c=r[a-(i[0]-1)].obv)&&void 0!==c?c:0),r.push(d)})),r}},{name:"PVT",shortName:"PVT",styles:{lines:[{color:"#ff0000",size:1}]},figures:[{key:"pvt",title:"PVT: ",type:"line"}],calc:function(t){var e=0;return t.map((function(i,n){var o,r,a={},s=i.close,l=null!==(o=i.volume)&&void 0!==o?o:1,u=(null!==(r=t[n-1])&&void 0!==r?r:i).close,c=0,h=u*l;return 0!==h&&(c=(s-u)/h),e+=c,a.pvt=e,a}))}},{name:"PSY",shortName:"PSY",calcParams:[12,6],styles:{lines:[{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"psy",title:"PSY: ",type:"line"},{key:"maPsy",title:"MAPSY: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=[],a=[];return t.forEach((function(e,s){var l,u,c={},h=(null!==(l=t[s-1])&&void 0!==l?l:e).close,d=e.close-h>0?1:0;r.push(d),n+=d,s>=i[0]-1&&(c.psy=n/i[0]*100,o+=c.psy,s>=i[0]+i[1]-2&&(c.maPsy=o/i[1],o-=null!==(u=a[s-(i[1]-1)].psy)&&void 0!==u?u:0),n-=r[s-(i[0]-1)]),a.push(c)})),a}},{name:"ROC",shortName:"ROC",calcParams:[12,6],styles:{lines:[{color:"#007FFF",size:1},{color:"#ff0000",size:1}]},figures:[{key:"roc",title:"ROC: ",type:"line"},{key:"maRoc",title:"MAROC: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=[],o=0;return t.forEach((function(e,r){var a,s,l={};if(r>=i[0]-1){var u=e.close,c=(null!==(a=t[r-i[0]])&&void 0!==a?a:t[r-(i[0]-1)]).close;l.roc=0!==c?(u-c)/c*100:0,o+=l.roc,r>=i[0]-1+i[1]-1&&(l.maRoc=o/i[1],o-=null!==(s=n[r-(i[1]-1)].roc)&&void 0!==s?s:0)}n.push(l)})),n}},Kt,Ut,jt,Zt,{name:"TRIX",shortName:"TRIX",calcParams:[12,9],styles:{lines:[{color:"#FF7F50",size:1},{color:"#A020F0",size:1}]},figures:[{key:"trix",title:"TRIX: ",type:"line"},{key:"maTrix",title:"MATRIX: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=0,l=0,u=0,c=[];return t.forEach((function(t,e){var h,d={},p=t.close;if(n+=p,e>=i[0]-1&&(o=e>i[0]-1?(2*p+(i[0]-1)*o)/(i[0]+1):n/i[0],s+=o,e>=2*i[0]-2&&(r=e>2*i[0]-2?(2*o+(i[0]-1)*r)/(i[0]+1):s/i[0],l+=r,e>=3*i[0]-3))){var g=0,v=0;e>3*i[0]-3?v=((g=(2*r+(i[0]-1)*a)/(i[0]+1))-a)/a*100:g=l/i[0],a=g,d.trix=v,u+=v,e>=3*i[0]+i[1]-4&&(d.maTrix=u/i[1],u-=null!==(h=c[e-(i[1]-1)].trix)&&void 0!==h?h:0)}c.push(d)})),c}},Jt,{name:"VR",shortName:"VR",calcParams:[26,6],styles:{lines:[{color:"#FF6E6E",size:2},{color:"#FFD700",size:4}]},figures:[{key:"vr",title:"VR: ",type:"line"},{key:"maVr",title:"MAVR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,o=0,r=0,a=0,s=[];return t.forEach((function(e,l){var u,c,h,d,p,g={},v=e.close,f=(null!==(u=t[l-1])&&void 0!==u?u:e).close,y=null!==(c=e.volume)&&void 0!==c?c:0;if(v>f?n+=y:v<f?o+=y:r+=y,l>=i[0]-1){var m=r/2;g.vr=o+m===0?0:(n+m)/(o+m)*100,a+=g.vr,l>=i[0]+i[1]-2&&(g.maVr=a/i[1],a-=null!==(h=s[l-(i[1]-1)].vr)&&void 0!==h?h:0);var _=t[l-(i[0]-1)],x=null!==(d=t[l-i[0]])&&void 0!==d?d:_,C=_.close,b=null!==(p=_.volume)&&void 0!==p?p:0;C>x.close?n-=b:C<x.close?o-=b:r-=b}s.push(g)})),s}},Qt];function ee(t){var e;return null!==(e=$t[t])&&void 0!==e?e:null}te.forEach((function(t){$t[t.name]=ot.extend(t)}));var ie={name:"fibonacciLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,i,n=t.chart,o=t.coordinates,r=t.bounding,a=t.overlay,s=t.yAxis,l=a.points;if(o.length>0){var u=0;if(null===(e=null==s?void 0:s.isInCandle())||void 0===e||e)u=n.getPrecision().price;else(null!==(i=n.getIndicators({paneId:a.paneId}).get(a.paneId))&&void 0!==i?i:[]).forEach((function(t){u=Math.max(u,t.precision)}));var c=[],h=[],d=r.width;if(o.length>1&&R(l[0].value)&&R(l[1].value)){var p=o[0].y-o[1].y,g=l[0].value-l[1].value;[1,.786,.618,.5,.382,.236,0].forEach((function(t){var e,i=o[1].y+p*t,r=n.getDecimalFold().format(n.getThousandsSeparator().format(((null!==(e=l[1].value)&&void 0!==e?e:0)+g*t).toFixed(u)));c.push({coordinates:[{x:0,y:i},{x:d,y:i}]}),h.push({x:0,y:i,text:"".concat(r," (").concat((100*t).toFixed(1),"%)"),baseline:"bottom"})}))}return[{type:"line",attrs:c},{type:"text",isCheckEvent:!1,attrs:h}]}return[]}},ne={name:"horizontalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n={x:0,y:e[0].y};return L(e[1])&&e[0].x<e[1].x&&(n.x=i.width),[{type:"line",attrs:{coordinates:[e[0],n]}}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},oe=function(){function t(){this._children=[],this._callbacks=new Map}return t.prototype.registerEvent=function(t,e){return this._callbacks.set(t,e),this},t.prototype.onEvent=function(t,e,i){var n=this._callbacks.get(t);return!(!L(n)||!this.checkEventOn(e))&&n(e,i)},t.prototype.checkEventOn=function(t){var e,i;try{for(var n=g(this._children),o=n.next();!o.done;o=n.next()){if(o.value.checkEventOn(t))return!0}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}return!1},t.prototype.dispatchEvent=function(t,e,i){var n=this._children.length-1;if(n>-1)for(var o=n;o>-1;o--)if(this._children[o].dispatchEvent(t,e,i))return!0;return this.onEvent(t,e,i)},t.prototype.addChild=function(t){return this._children.push(t),this},t.prototype.clear=function(){this._children=[]},t}(),re=function(t){function e(e){var i=t.call(this)||this;return i.attrs=e.attrs,i.styles=e.styles,i}return i(e,t),e.prototype.checkEventOn=function(t){return this.checkEventOnImp(t,this.attrs,this.styles)},e.prototype.setAttrs=function(t){return this.attrs=t,this},e.prototype.setStyles=function(t){return this.styles=t,this},e.prototype.draw=function(t){this.drawImp(t,this.attrs,this.styles)},e.extend=function(t){var n=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.checkEventOnImp=function(e,i,n){return t.checkEventOn(e,i,n)},n.prototype.drawImp=function(e,i,n){t.draw(e,i,n)},n}(e);return n},e}(oe);function ae(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value.coordinates;if(s.length>1)for(var l=1;l<s.length;l++){var u=s[l-1],c=s[l];if(u.x===c.x){if(Math.abs(u.y-t.y)+Math.abs(c.y-t.y)-Math.abs(u.y-c.y)<4&&Math.abs(t.x-u.x)<2)return!0}else{var h=ue(u,c),d=se(h,t),p=Math.abs(d-t.y);if(Math.abs(u.x-t.x)+Math.abs(c.x-t.x)-Math.abs(u.x-c.x)<4&&p*p/(h[0]*h[0]+1)<4)return!0}}}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}function se(t,e){return null!==t?e.x*t[0]+t[1]:e.y}function le(t,e,i){return se(ue(t,e),i)}function ue(t,e){var i=t.x-e.x;if(0!==i){var n=(t.y-e.y)/i;return[n,t.y-n*t.x]}return null}function ce(t,e,i){var n=e.length,o=R(i)?i>0&&i<1?i:0:i?.5:0;if(o>0&&n>2){for(var r=e[0].x,a=e[0].y,s=1;s<n-1;s++){var l=e[s-1],u=e[s],c=e[s+1],h=u.x-l.x,d=u.y-l.y,p=c.x-u.x,g=c.y-u.y,v=c.x-l.x,f=c.y-l.y,y=Math.sqrt(h*h+d*d),m=Math.sqrt(p*p+g*g),_=m/(m+y),x=u.x+v*o*_,C=u.y+f*o*_;x=Math.min(x,Math.max(c.x,u.x)),C=Math.min(C,Math.max(c.y,u.y)),x=Math.max(x,Math.min(c.x,u.x)),C=Math.max(C,Math.min(c.y,u.y)),v=x-u.x,f=C-u.y;var b=u.x-v*y/m,T=u.y-f*y/m;b=Math.min(b,Math.max(l.x,u.x)),T=Math.min(T,Math.max(l.y,u.y)),b=Math.max(b,Math.min(l.x,u.x)),T=Math.max(T,Math.min(l.y,u.y)),v=u.x-b,f=u.y-T,x=u.x+v*m/y,C=u.y+f*m/y,t.bezierCurveTo(r,a,b,T,u.x,u.y),r=x,a=C}var w=e[n-1];t.bezierCurveTo(r,a,w.x,w.y,w.x,w.y)}else for(s=1;s<n;s++)t.lineTo(e[s].x,e[s].y)}var he={name:"line",checkEventOn:ae,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.LineType.Solid:r,s=n.smooth,l=void 0!==s&&s,u=n.size,c=void 0===u?1:u,h=n.color,d=void 0===h?"currentColor":h,p=n.dashedValue,g=void 0===p?[2,2]:p;e.lineWidth=c,e.strokeStyle=d,a===t.LineType.Dashed?e.setLineDash(g):e.setLineDash([]);var v=c%2==1?.5:0;o.forEach((function(t){var i=t.coordinates;i.length>1&&(2!==i.length||i[0].x!==i[1].x&&i[0].y!==i[1].y?(e.save(),c%2==1&&e.translate(.5,.5),e.beginPath(),e.moveTo(i[0].x,i[0].y),ce(e,i,l),e.stroke(),e.closePath(),e.restore()):(e.beginPath(),i[0].x===i[1].x?(e.moveTo(i[0].x+v,i[0].y),e.lineTo(i[1].x+v,i[1].y)):(e.moveTo(i[0].x,i[0].y+v),e.lineTo(i[1].x,i[1].y+v)),e.stroke(),e.closePath()))}))}(e,i,n)}};function de(t,e,i){var n=null!=i?i:0,o=[];if(t.length>1)if(t[0].x===t[1].x){var r=e.height;if(o.push({coordinates:[{x:t[0].x,y:0},{x:t[0].x,y:r}]}),t.length>2){o.push({coordinates:[{x:t[2].x,y:0},{x:t[2].x,y:r}]});for(var a=t[0].x-t[2].x,s=0;s<n;s++){var l=a*(s+1);o.push({coordinates:[{x:t[0].x+l,y:0},{x:t[0].x+l,y:r}]})}}}else{var u=e.width,c=ue(t[0],t[1]),h=c[0],d=c[1];if(o.push({coordinates:[{x:0,y:0*h+d},{x:u,y:u*h+d}]}),t.length>2){var p=t[2].y-h*t[2].x;o.push({coordinates:[{x:0,y:0*h+p},{x:u,y:u*h+p}]});for(a=d-p,s=0;s<n;s++){var g=d+a*(s+1);o.push({coordinates:[{x:0,y:0*h+g},{x:u,y:u*h+g}]})}}}return o}var pe={name:"parallelStraightLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:de(t.coordinates,t.bounding)}]}},ge={name:"priceChannelLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:de(t.coordinates,t.bounding,1)}]}},ve={name:"priceLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,i,n=t.chart,o=t.coordinates,r=t.bounding,a=t.overlay,s=t.yAxis,l=0;null===(e=null==s?void 0:s.isInCandle())||void 0===e||e?l=n.getPrecision().price:(null!==(i=n.getIndicators({paneId:a.paneId}).get(a.paneId))&&void 0!==i?i:[]).forEach((function(t){l=Math.max(l,t.precision)}));var u=a.points[0].value,c=void 0===u?0:u;return[{type:"line",attrs:{coordinates:[o[0],{x:r.width,y:o[0].y}]}},{type:"text",ignoreEvent:!0,attrs:{x:o[0].x,y:o[0].y,text:n.getDecimalFold().format(n.getThousandsSeparator().format(c.toFixed(l))),baseline:"bottom"}}]}};function fe(t,e){if(t.length>1){var i={x:0,y:0};return i=t[0].x===t[1].x&&t[0].y!==t[1].y?t[0].y<t[1].y?{x:t[0].x,y:e.height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:le(t[0],t[1],{x:0,y:t[0].y})}:{x:e.width,y:le(t[0],t[1],{x:e.width,y:t[0].y})},{coordinates:[t[0],i]}}return[]}var ye={name:"rayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){return[{type:"line",attrs:fe(t.coordinates,t.bounding)}]}},me={name:"straightLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return 2===e.length?e[0].x===e[1].x?[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]:[{type:"line",attrs:{coordinates:[{x:0,y:le(e[0],e[1],{x:0,y:e[0].y})},{x:i.width,y:le(e[0],e[1],{x:i.width,y:e[0].y})}]}}]:[]}},_e={name:"simpleAnnotation",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e,i=t.overlay,n=t.coordinates,o="";L(i.extendData)&&(o=F(i.extendData)?i.extendData(i):null!==(e=i.extendData)&&void 0!==e?e:"");var r=n[0].x,a=n[0].y-6,s=a-50,l=s-5;return[{type:"line",attrs:{coordinates:[{x:r,y:a},{x:r,y:s}]},ignoreEvent:!0},{type:"polygon",attrs:{coordinates:[{x:r,y:s},{x:r-4,y:l},{x:r+4,y:l}]},ignoreEvent:!0},{type:"text",attrs:{x:r,y:l,text:o,align:"center",baseline:"bottom"},ignoreEvent:!0}]}},xe={name:"simpleTag",totalStep:2,styles:{line:{style:t.LineType.Dashed}},createPointFigures:function(t){var e=t.bounding,i=t.coordinates;return{type:"line",attrs:{coordinates:[{x:0,y:i[0].y},{x:e.width,y:i[0].y}]},ignoreEvent:!0}},createYAxisFigures:function(t){var e,i,n=t.chart,o=t.overlay,r=t.coordinates,a=t.bounding,s=t.yAxis,l="left",u=0;null!==(e=null==s?void 0:s.isFromZero())&&void 0!==e&&e?(l="left",u=0):(l="right",u=a.width);var c="";return L(o.extendData)&&(c=F(o.extendData)?o.extendData(o):null!==(i=o.extendData)&&void 0!==i?i:""),!L(c)&&R(o.points[0].value)&&(c=X(o.points[0].value,n.getPrecision().price)),{type:"text",attrs:{x:u,y:r[0].y,text:c,align:l,baseline:"middle"}}}},Ce={};function be(t){var e;return null!==(e=Ce[t])&&void 0!==e?e:null}[ie,ne,{name:"horizontalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=[];return 2===e.length&&i.push({coordinates:e}),[{type:"line",attrs:i}]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].value=i.value,e[1].value=i.value},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].value=n.value)}},{name:"horizontalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:0,y:e[0].y},{x:i.width,y:e[0].y}]}}]}},pe,ge,ve,ye,{name:"segment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]}},me,{name:"verticalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;if(2===e.length){var n={x:e[0].x,y:0};return e[0].y<e[1].y&&(n.y=i.height),[{type:"line",attrs:{coordinates:[e[0],n]}}]}return[]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex,e[1].timestamp=i.timestamp,e[1].dataIndex=i.dataIndex},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.dataIndex)}},{name:"verticalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]},performEventPressedMove:function(t){var e=t.points,i=t.performPoint;e[0].timestamp=i.timestamp,e[0].dataIndex=i.dataIndex,e[1].timestamp=i.timestamp,e[1].dataIndex=i.dataIndex},performEventMoveForDrawing:function(t){var e=t.currentStep,i=t.points,n=t.performPoint;2===e&&(i[0].timestamp=n.timestamp,i[0].dataIndex=n.dataIndex)}},{name:"verticalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:i.height}]}}]}},_e,xe].forEach((function(t){Ce[t.name]=st.extend(t)}));var Te={light:{grid:{horizontal:{color:"#EDEDED"},vertical:{color:"#EDEDED"}},candle:{priceMark:{high:{color:"#76808F"},low:{color:"#76808F"}},tooltip:{rect:{color:"#FEFEFE",borderColor:"#F2F3F5"},text:{color:"#76808F"}}},indicator:{tooltip:{text:{color:"#76808F"}}},xAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},yAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},separator:{color:"#DDDDDD"},crosshair:{horizontal:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}},vertical:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}}}},dark:{grid:{horizontal:{color:"#292929"},vertical:{color:"#292929"}},candle:{priceMark:{high:{color:"#929AA5"},low:{color:"#929AA5"}},tooltip:{rect:{color:"rgba(10, 10, 10, .6)",borderColor:"rgba(10, 10, 10, .6)"},text:{color:"#929AA5"}}},indicator:{tooltip:{text:{color:"#929AA5"}}},xAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},yAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},separator:{color:"#333333"},crosshair:{horizontal:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}},vertical:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}}}}};function we(t){var e;return null!==(e=Te[t])&&void 0!==e?e:null}var Se="candle_pane",Pe="indicator_pane_",Ee="x_axis_pane",Ie=1,ke=50,Me=function(){function e(e,i){var n,o,r,a,s=this;this._styles={grid:E(),candle:(a={show:!0,color:w,textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"},{type:t.CandleType.CandleSolid,bar:{upColor:_,downColor:y,noChangeColor:C,upBorderColor:_,downBorderColor:y,noChangeBorderColor:C,upWickColor:_,downWickColor:y,noChangeWickColor:C},area:{lineSize:2,lineColor:T,smooth:!1,value:"close",backgroundColor:[{offset:0,color:P(.01)},{offset:1,color:P(.2)}],point:{show:!0,color:T,radius:4,rippleColor:P(.3),rippleRadius:8,animation:!0,animationDuration:1e3}},priceMark:{show:!0,high:c({},a),low:c({},a),last:{show:!0,upColor:_,downColor:y,noChangeColor:C,line:{show:!0,style:t.LineType.Dashed,dashedValue:[4,4],size:1},text:{show:!0,style:t.PolygonType.Fill,size:12,paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderColor:"transparent",borderStyle:t.LineType.Solid,borderSize:0,borderDashedValue:[2,2],color:b,family:"Helvetica Neue",weight:"normal",borderRadius:2}}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,custom:[{title:"time",value:"{time}"},{title:"open",value:"{open}"},{title:"high",value:"{high}"},{title:"low",value:"{low}"},{title:"close",value:"{close}"},{title:"volume",value:"{volume}"}],defaultValue:"n/a",rect:{position:t.CandleTooltipRectPosition.Fixed,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,offsetLeft:4,offsetTop:4,offsetRight:4,offsetBottom:4,borderRadius:4,borderSize:1,borderColor:"#F2F3F5",color:"#FEFEFE"},text:{size:12,family:"Helvetica Neue",weight:"normal",color:w,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]},renko:{brick:{size:10}}}),indicator:(r=["#FF9600","#935EBD",T,"#E11D74","#01C5C4"].map((function(e){return{style:t.LineType.Solid,smooth:!1,size:1,dashedValue:[2,2],color:e}})),{ohlc:{upColor:x,downColor:m,noChangeColor:C},bars:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:x,downColor:m,noChangeColor:C}],lines:r,circles:[{style:t.PolygonType.Fill,borderStyle:t.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:x,downColor:m,noChangeColor:C}],lastValueMark:{show:!1,text:{show:!1,style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderColor:"transparent",borderSize:0,borderDashedValue:[2,2],paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderRadius:2}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:t.TooltipShowRule.Always,showType:t.TooltipShowType.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:"Helvetica Neue",weight:"normal",color:w,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]}}),xAxis:I(),yAxis:I(),separator:{size:1,color:S,fill:!0,activeBackgroundColor:P(.08)},crosshair:k(),overlay:(n=P(.35),o=P(.25),{point:{color:T,borderColor:n,borderSize:1,radius:5,activeColor:T,activeBorderColor:n,activeBorderSize:3,activeRadius:5},line:{style:t.LineType.Solid,smooth:!1,color:T,size:1,dashedValue:[2,2]},rect:{style:t.PolygonType.Fill,color:o,borderColor:T,borderSize:1,borderRadius:0,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},polygon:{style:t.PolygonType.Fill,color:T,borderColor:T,borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},circle:{style:t.PolygonType.Fill,color:o,borderColor:T,borderSize:1,borderStyle:t.LineType.Solid,borderDashedValue:[2,2]},arc:{style:t.LineType.Solid,color:T,size:1,dashedValue:[2,2]},text:{style:t.PolygonType.Fill,color:b,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:t.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:T,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:T}})},this._customApi={formatDate:function(t,e){return H(s._dateTimeFormat,t,e)},formatBigNumber:G},this._locale="en-US",this._thousandsSeparator={sign:",",format:function(t){return K(t,s._thousandsSeparator.sign)}},this._decimalFold={threshold:3,format:function(t){return U(t,s._decimalFold.threshold)}},this._precision={price:2,volume:0},this._dataList=[],this._loadMoreDataCallback=null,this._loading=!0,this._loadDataMore={forward:!1,backward:!1},this._zoomEnabled=!0,this._scrollEnabled=!0,this._totalBarSpace=0,this._barSpace=10,this._offsetRightDistance=80,this._startLastBarRightSideDiffBarCount=0,this._scrollLimitRole=0,this._minVisibleBarCount={left:2,right:2},this._maxOffsetDistance={left:50,right:50},this._visibleRange={from:0,to:0,realFrom:0,realTo:0},this._timeWeightTickMap=new Map,this._timeWeightTickList=[],this._minTimeDifference=Number.MAX_SAFE_INTEGER,this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}],this._crosshair={},this._activeTooltipIcon=null,this._actions=new Map,this._indicators=new Map,this._taskScheduler=new St,this._overlays=new Map,this._progressOverlayInfo=null,this._pressedOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._hoverOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._clickOverlayInfo={paneId:"",overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._chart=e,this._calcOptimalBarSpace(),this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace;var l=null!=i?i:{},u=l.styles,h=l.locale,d=l.timezone,p=l.customApi,g=l.thousandsSeparator,v=l.decimalFold;L(u)&&this.setStyles(u),W(h)&&this.setLocale(h),this.setTimezone(null!=d?d:""),L(p)&&this.setCustomApi(p),L(g)&&this.setThousandsSeparator(g),L(v)&&this.setDecimalFold(v)}return e.prototype.setStyles=function(t){var e,i,n=null;n=W(t)?we(t):t,M(this._styles,n),A(null===(i=null===(e=null==n?void 0:n.candle)||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.custom)&&(this._styles.candle.tooltip.custom=n.candle.tooltip.custom)},e.prototype.getStyles=function(){return this._styles},e.prototype.setCustomApi=function(t){M(this._customApi,t)},e.prototype.getCustomApi=function(){return this._customApi},e.prototype.setLocale=function(t){this._locale=t},e.prototype.getLocale=function(){return this._locale},e.prototype.setTimezone=function(t){if(!L(this._dateTimeFormat)||this.getTimezone()!==t){var e={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"};t.length>0&&(e.timeZone=t);var i=null;try{i=new Intl.DateTimeFormat("en",e)}catch(t){}null!==i&&(this._classifyTimeWeightTicks(this._dataList),this._dateTimeFormat=i)}},e.prototype.getTimezone=function(){return this._dateTimeFormat.resolvedOptions().timeZone},e.prototype.getDateTimeFormat=function(){return this._dateTimeFormat},e.prototype.setThousandsSeparator=function(t){M(this._thousandsSeparator,t)},e.prototype.getThousandsSeparator=function(){return this._thousandsSeparator},e.prototype.setDecimalFold=function(t){M(this._decimalFold,t)},e.prototype.getDecimalFold=function(){return this._decimalFold},e.prototype.getPrecision=function(){return this._precision},e.prototype.setPrecision=function(t){M(this._precision,t),this._synchronizeIndicatorSeriesPrecision()},e.prototype.getDataList=function(){return this._dataList},e.prototype.getVisibleRangeDataList=function(){return this._visibleRangeDataList},e.prototype.getVisibleRangeHighLowPrice=function(){return this._visibleRangeHighLowPrice},e.prototype.addData=function(t,e,i){var n,o,r,a,s=this,l=!1,u=!1,c=0;if(A(t)){switch(c=t.length,e){case pt.Init:this.clearData(),this._dataList=t,this._loadDataMore.backward=null!==(n=null==i?void 0:i.forward)&&void 0!==n&&n,this._loadDataMore.forward=null!==(o=null==i?void 0:i.forward)&&void 0!==o&&o,this._classifyTimeWeightTicks(this._dataList),this.setOffsetRightDistance(this._offsetRightDistance),u=!0;break;case pt.Backward:this._classifyTimeWeightTicks(t,!0),this._dataList=this._dataList.concat(t),this._loadDataMore.backward=null!==(r=null==i?void 0:i.backward)&&void 0!==r&&r,u=c>0;break;case pt.Forward:this._dataList=t.concat(this._dataList),this._classifyTimeWeightTicks(this._dataList),this._loadDataMore.forward=null!==(a=null==i?void 0:i.forward)&&void 0!==a&&a,u=c>0}this._loading=!1,l=!0}else{var h=this._dataList.length,d=t.timestamp,p=N(this._dataList[h-1],"timestamp",0);if(d>p){this._classifyTimeWeightTicks([t],!0),this._dataList.push(t);var g=this.getLastBarRightSideDiffBarCount();g<0&&this.setLastBarRightSideDiffBarCount(--g),c=1,l=!0,u=!0}else d===p&&(this._dataList[h-1]=t,l=!0,u=!0)}l&&(u&&(this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this.getIndicatorsByFilter({}).forEach((function(t,i){t.forEach((function(t){s._addIndicatorCalcTask(i,t,e)}))})),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})))},e.prototype.setLoadMoreDataCallback=function(t){this._loadMoreDataCallback=t},e.prototype._calcOptimalBarSpace=function(){var t=1-.2*Math.atan(Math.max(4,this._barSpace)-4)/(.5*Math.PI),e=Math.min(Math.floor(this._barSpace*t),Math.floor(this._barSpace));e%2==0&&e+2>=this._barSpace&&--e,this._gapBarSpace=Math.max(1,e)},e.prototype._classifyTimeWeightTicks=function(t,e){var i=0,n=null;null!=e&&e?(i=this._dataList.length,n=this._dataList[i-1].timestamp):(this._timeWeightTickMap.clear(),this._minTimeDifference=Number.MAX_SAFE_INTEGER);var o={value:this._minTimeDifference};At(this._timeWeightTickMap,t,this._dateTimeFormat,i,o,n),this._minTimeDifference=o.value,this._timeWeightTickList=Bt(this._timeWeightTickMap,this._barSpace,this._styles.xAxis.tickText)},e.prototype.getTimeWeightTickList=function(){return this._timeWeightTickList},e.prototype._adjustVisibleRange=function(){var e,i,n=this,o=this._dataList.length,r=this._totalBarSpace/this._barSpace,a=0,s=0;1===this._scrollLimitRole?(a=(this._totalBarSpace-this._maxOffsetDistance.right)/this._barSpace,s=(this._totalBarSpace-this._maxOffsetDistance.left)/this._barSpace):(a=this._minVisibleBarCount.left,s=this._minVisibleBarCount.right),a=Math.max(0,a),s=Math.max(0,s);var l=r-Math.min(a,o);this._lastBarRightSideDiffBarCount>l&&(this._lastBarRightSideDiffBarCount=l);var u=-o+Math.min(s,o);this._lastBarRightSideDiffBarCount<u&&(this._lastBarRightSideDiffBarCount=u);var c=Math.round(this._lastBarRightSideDiffBarCount+o+.5),h=c;c>o&&(c=o);var d=Math.round(c-r)-1;d<0&&(d=0);var p=this._lastBarRightSideDiffBarCount>0?Math.round(o+this._lastBarRightSideDiffBarCount-r)-1:d;this._visibleRange={from:d,to:c,realFrom:p,realTo:h},this.executeAction(t.ActionType.OnVisibleRangeChange,this._visibleRange),this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}];for(var g=p;g<h;g++){var v=this._dataList[g],f=this.dataIndexToCoordinate(g);this._visibleRangeDataList.push({dataIndex:g,x:f,data:v}),L(v)&&(this._visibleRangeHighLowPrice[0].price<v.high&&(this._visibleRangeHighLowPrice[0].price=v.high,this._visibleRangeHighLowPrice[0].x=f),this._visibleRangeHighLowPrice[1].price>v.low&&(this._visibleRangeHighLowPrice[1].price=v.low,this._visibleRangeHighLowPrice[1].x=f))}if(!this._loading&&L(this._loadMoreDataCallback)){var y=null;0===d?this._loadDataMore.forward&&(this._loading=!0,y={type:pt.Forward,data:null!==(e=this._dataList[0])&&void 0!==e?e:null,callback:function(t,e){n.addData(t,pt.Forward,{forward:null!=e&&e,backward:null!=e&&e})}}):c===o&&this._loadDataMore.backward&&(this._loading=!0,y={type:pt.Backward,data:null!==(i=this._dataList[o-1])&&void 0!==i?i:null,callback:function(t,e){n.addData(t,pt.Backward,{forward:null!=e&&e,backward:null!=e&&e})}}),L(y)&&this._loadMoreDataCallback(y)}},e.prototype.getBarSpace=function(){return{bar:this._barSpace,halfBar:this._barSpace/2,gapBar:this._gapBarSpace,halfGapBar:Math.floor(this._gapBarSpace/2)}},e.prototype.setBarSpace=function(t,e){t<Ie||t>ke||this._barSpace===t||(this._barSpace=t,this._timeWeightTickList=Bt(this._timeWeightTickMap,this._barSpace,this._styles.xAxis.tickText),this._calcOptimalBarSpace(),null==e||e(),this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}))},e.prototype.setTotalBarSpace=function(t){this._totalBarSpace!==t&&(this._totalBarSpace=t,this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0))},e.prototype.setOffsetRightDistance=function(t,e){return this._offsetRightDistance=1===this._scrollLimitRole?Math.min(this._maxOffsetDistance.right,t):t,this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace,null!=e&&e&&(this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})),this},e.prototype.getInitialOffsetRightDistance=function(){return this._offsetRightDistance},e.prototype.getOffsetRightDistance=function(){return Math.max(0,this._lastBarRightSideDiffBarCount*this._barSpace)},e.prototype.getLastBarRightSideDiffBarCount=function(){return this._lastBarRightSideDiffBarCount},e.prototype.setLastBarRightSideDiffBarCount=function(t){this._lastBarRightSideDiffBarCount=t},e.prototype.setMaxOffsetLeftDistance=function(t){this._scrollLimitRole=1,this._maxOffsetDistance.left=t},e.prototype.setMaxOffsetRightDistance=function(t){this._scrollLimitRole=1,this._maxOffsetDistance.right=t},e.prototype.setLeftMinVisibleBarCount=function(t){this._scrollLimitRole=0,this._minVisibleBarCount.left=t},e.prototype.setRightMinVisibleBarCount=function(t){this._scrollLimitRole=0,this._minVisibleBarCount.right=t},e.prototype.getVisibleRange=function(){return this._visibleRange},e.prototype.startScroll=function(){this._startLastBarRightSideDiffBarCount=this._lastBarRightSideDiffBarCount},e.prototype.scroll=function(e){if(this._scrollEnabled){var i=e/this._barSpace,n=this._lastBarRightSideDiffBarCount*this._barSpace;this._lastBarRightSideDiffBarCount=this._startLastBarRightSideDiffBarCount-i,this._adjustVisibleRange(),this.setCrosshair(this._crosshair,!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0});var o=Math.round(n-this._lastBarRightSideDiffBarCount*this._barSpace);0!==o&&this.executeAction(t.ActionType.OnScroll,{distance:o})}},e.prototype.getDataByDataIndex=function(t){var e;return null!==(e=this._dataList[t])&&void 0!==e?e:null},e.prototype.coordinateToFloatIndex=function(t){var e=this._dataList.length,i=(this._totalBarSpace-t)/this._barSpace,n=e+this._lastBarRightSideDiffBarCount-i;return Math.round(1e6*n)/1e6},e.prototype.dataIndexToTimestamp=function(t){var e=this._dataList.length;if(0===e)return null;var i=this.getDataByDataIndex(t);if(L(i))return i.timestamp;var n=e-1;return t>n?this._dataList[n].timestamp+this._minTimeDifference*(t-n):t<0?this._dataList[0].timestamp-this._minTimeDifference*Math.abs(t):null},e.prototype.timestampToDataIndex=function(t){var e=this._dataList.length;if(0===e)return 0;var i=e-1,n=this._dataList[i].timestamp;if(t>n)return i+Math.floor((t-n)/this._minTimeDifference);var o=this._dataList[0].timestamp;return t<o?Math.floor((t-o)/this._minTimeDifference):_t(this._dataList,"timestamp",t)},e.prototype.dataIndexToCoordinate=function(t){var e=this._dataList.length+this._lastBarRightSideDiffBarCount-t;return Math.floor(this._totalBarSpace-(e-.5)*this._barSpace+.5)},e.prototype.coordinateToDataIndex=function(t){return Math.ceil(this.coordinateToFloatIndex(t))-1},e.prototype.zoom=function(e,i){var n,o=this;if(this._zoomEnabled){var r=null!=i?i:null;R(null==r?void 0:r.x)||(r={x:null!==(n=this._crosshair.x)&&void 0!==n?n:this._totalBarSpace/2});var a=r.x,s=this.coordinateToFloatIndex(a),l=this._barSpace,u=this._barSpace+e*(this._barSpace/10);this.setBarSpace(u,(function(){o._lastBarRightSideDiffBarCount+=s-o.coordinateToFloatIndex(a)}));var c=this._barSpace/l;1!==c&&this.executeAction(t.ActionType.OnZoom,{scale:c})}},e.prototype.setZoomEnabled=function(t){this._zoomEnabled=t},e.prototype.isZoomEnabled=function(){return this._zoomEnabled},e.prototype.setScrollEnabled=function(t){this._scrollEnabled=t},e.prototype.isScrollEnabled=function(){return this._scrollEnabled},e.prototype.setCrosshair=function(t,e){var i,n=null!=t?t:{},o=0,r=0;r=R(n.x)?(o=this.coordinateToDataIndex(n.x))<0?0:o>this._dataList.length-1?this._dataList.length-1:o:o=this._dataList.length-1;var a=this._dataList[r],s=this.dataIndexToCoordinate(o),l=this._crosshair.x,u=this._crosshair.y,h=this._crosshair.paneId;this._crosshair=c(c({},n),{realX:s,kLineData:a,realDataIndex:o,dataIndex:r,timestamp:null!==(i=this.dataIndexToTimestamp(o))&&void 0!==i?i:void 0}),l===n.x&&u===n.y&&h===n.paneId||(L(a)&&this._chart.crosshairChange(this._crosshair),null!=e&&e||this._chart.updatePane(1))},e.prototype.getCrosshair=function(){return this._crosshair},e.prototype.setActiveTooltipIcon=function(t){this._activeTooltipIcon=null!=t?t:null},e.prototype.getActiveTooltipIcon=function(){return this._activeTooltipIcon},e.prototype.executeAction=function(t,e){var i;null===(i=this._actions.get(t))||void 0===i||i.execute(e)},e.prototype.subscribeAction=function(t,e){var i;this._actions.has(t)||this._actions.set(t,new et),null===(i=this._actions.get(t))||void 0===i||i.subscribe(e)},e.prototype.unsubscribeAction=function(t,e){var i=this._actions.get(t);L(i)&&(i.unsubscribe(e),i.isEmpty()&&this._actions.delete(t))},e.prototype.hasAction=function(t){var e=this._actions.get(t);return L(e)&&!e.isEmpty()},e.prototype._sortIndicators=function(t){var e;W(t)?null===(e=this._indicators.get(t))||void 0===e||e.sort((function(t,e){return t.zLevel-e.zLevel})):this._indicators.forEach((function(t){t.sort((function(t,e){return t.zLevel-e.zLevel}))}))},e.prototype._addIndicatorCalcTask=function(t,e,i){var n=this;this._taskScheduler.addTask({id:wt(t,e.name),handler:function(){var t;null===(t=e.onDataStateChange)||void 0===t||t.call(e,{state:tt.Loading,type:i,indicator:e}),e.calcImp(n._dataList).then((function(t){var o;t&&(n._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}),null===(o=e.onDataStateChange)||void 0===o||o.call(e,{state:tt.Ready,type:i,indicator:e}))})).catch((function(){var t;null===(t=e.onDataStateChange)||void 0===t||t.call(e,{state:tt.Error,type:i,indicator:e})}))}})},e.prototype.addIndicator=function(t,e,i){var n=t.name,o=this._indicators.get(e);if(L(o)&&L(o.find((function(t){return t.name===n}))))return!1;L(o)||(o=[]);var r=new(ee(n));return this._synchronizeIndicatorSeriesPrecision(r),r.override(t),i||(this.removeIndicator({paneId:e}),o=[]),o.push(r),this._indicators.set(e,o),this._sortIndicators(e),this._addIndicatorCalcTask(e,r,pt.Init),!0},e.prototype.getIndicatorsByPaneId=function(t){var e;return null!==(e=this._indicators.get(t))&&void 0!==e?e:[]},e.prototype.getIndicatorsByFilter=function(t){var e=function(t,e){return t.filter((function(t){return!L(e)||t.name===e}))},i=t.paneId,n=t.name,o=new Map;if(L(i)){var r=this.getIndicatorsByPaneId(i);o.set(i,e(r,n))}else L(n)?this._indicators.forEach((function(t,i){o.set(i,e(t,n))})):this._indicators.forEach((function(t,i){o.set(i,e(t))}));return o},e.prototype.removeIndicator=function(t){var e=this,i=!1;return this.getIndicatorsByFilter(t).forEach((function(t,n){var o=e.getIndicatorsByPaneId(n);t.forEach((function(t){var r=o.findIndex((function(e){return e.name===t.name}));r>-1&&(e._taskScheduler.removeTask(wt(n,t.name)),o.splice(r,1),i=!0)})),0===o.length&&e._indicators.delete(n)})),i},e.prototype.hasIndicators=function(t){return this._indicators.has(t)},e.prototype._synchronizeIndicatorSeriesPrecision=function(e){var i=this._precision,n=i.price,o=i.volume,r=function(e){switch(e.series){case t.IndicatorSeries.Price:e.setSeriesPrecision(n);break;case t.IndicatorSeries.Volume:e.setSeriesPrecision(o)}};L(e)?r(e):this._indicators.forEach((function(t){t.forEach((function(t){r(t)}))}))},e.prototype.overrideIndicator=function(t,e){var i=this,n=t.name,o=new Map;if(L(e)){var r=this._indicators.get(e);L(r)&&o.set(e,r)}else o=this._indicators;var a=!1,s=!1;return o.forEach((function(e,o){var r=e.find((function(t){return t.name===n}));if(L(r)){r.override(t);var l=r.shouldUpdateImp(),u=l.calc,c=l.draw;l.sort&&(s=!0),u?i._addIndicatorCalcTask(o,r,pt.Update):c&&(a=!0)}})),s&&this._sortIndicators(),!!a&&(this._chart.layout({update:!0}),!0)},e.prototype.getOverlaysByFilter=function(t){var e,i,n=t.id,o=t.groupId,r=t.paneId,a=t.name,s=function(t){return t.filter((function(t){return L(n)?t.id===n:L(o)?t.groupId===o&&(!L(a)||t.name===a):!L(a)||t.name===a}))},l=new Map;if(L(r)){var u=this.getOverlaysByPaneId(r);l.set(r,s(u))}else this._overlays.forEach((function(t,e){l.set(e,s(t))}));var c=null===(e=this._progressOverlayInfo)||void 0===e?void 0:e.overlay;if(L(c)){var h=null!==(i=l.get(c.paneId))&&void 0!==i?i:[];h.push(c),l.set(c.paneId,h)}return l},e.prototype.getOverlaysByPaneId=function(t){var e;if(!W(t)){var i=[];return this._overlays.forEach((function(t){i=i.concat(t)})),i}return null!==(e=this._overlays.get(t))&&void 0!==e?e:[]},e.prototype._sortOverlays=function(t){var e;W(t)?null===(e=this._overlays.get(t))||void 0===e||e.sort((function(t,e){return t.zLevel-e.zLevel})):this._overlays.forEach((function(t){t.sort((function(t,e){return t.zLevel-e.zLevel}))}))},e.prototype.addOverlays=function(t,e){var i=this,n=[],o=t.map((function(t,o){var r,a,s,l,u,c;if(L(t.id)){var h=null;try{for(var d=g(i._overlays),p=d.next();!p.done;p=d.next()){if(L(m=v(p.value,2)[1].find((function(e){return e.id===t.id})))){h=m;break}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(r)throw r.error}}if(L(h))return t.id}var f=be(t.name);if(L(f)){var y=null!==(s=t.id)&&void 0!==s?s:yt("overlay_"),m=new f;t.id=y,null!==(l=t.groupId)&&void 0!==l||(t.groupId=y),m.override(t);var _=m.paneId;return n.includes(_)||n.push(_),m.isDrawing()?i._progressOverlayInfo={paneId:_,overlay:m,appointPaneFlag:e[o]}:(i._overlays.has(_)||i._overlays.set(_,[]),null===(u=i._overlays.get(_))||void 0===u||u.push(m)),m.isStart()&&(null===(c=m.onDrawStart)||void 0===c||c.call(m,{overlay:m,chart:i._chart})),y}return null}));return n.length>0&&(this._sortOverlays(),n.forEach((function(t){i._chart.updatePane(1,t)})),this._chart.updatePane(1,Ee)),o},e.prototype.getProgressOverlayInfo=function(){return this._progressOverlayInfo},e.prototype.progressOverlayComplete=function(){var t;if(null!==this._progressOverlayInfo){var e=this._progressOverlayInfo,i=e.overlay,n=e.paneId;i.isDrawing()||(this._overlays.has(n)||this._overlays.set(n,[]),null===(t=this._overlays.get(n))||void 0===t||t.push(i),this._sortOverlays(n),this._progressOverlayInfo=null)}},e.prototype.updateProgressOverlayInfo=function(t,e){null!==this._progressOverlayInfo&&(O(e)&&e&&(this._progressOverlayInfo.appointPaneFlag=e),this._progressOverlayInfo.paneId=t,this._progressOverlayInfo.overlay.override({paneId:t}))},e.prototype.overrideOverlay=function(t){var e=this,i=!1,n=[];return this.getOverlaysByFilter(t).forEach((function(e,o){e.forEach((function(e){e.override(t);var r=e.shouldUpdate(),a=r.sort,s=r.draw;a&&(i=!0),(a||s)&&(n.includes(o)||n.push(o))}))})),i&&this._sortOverlays(),n.length>0&&(n.forEach((function(t){e._chart.updatePane(1,t)})),this._chart.updatePane(1,Ee),!0)},e.prototype.removeOverlay=function(t){var e=this,i=[];return this.getOverlaysByFilter(t).forEach((function(t,n){var o=e.getOverlaysByPaneId(n);t.forEach((function(t){var r;if(null===(r=t.onRemoved)||void 0===r||r.call(t,{overlay:t,chart:e._chart}),i.includes(n)||i.push(n),t.isDrawing())e._progressOverlayInfo=null;else{var a=o.findIndex((function(e){return e.id===t.id}));a>-1&&o.splice(a,1)}0===o.length&&e._overlays.delete(n)}))})),i.length>0&&(i.forEach((function(t){e._chart.updatePane(1,t)})),this._chart.updatePane(1,Ee),!0)},e.prototype.setPressedOverlayInfo=function(t){this._pressedOverlayInfo=t},e.prototype.getPressedOverlayInfo=function(){return this._pressedOverlayInfo},e.prototype.setHoverOverlayInfo=function(t,e){var i=this._hoverOverlayInfo,n=i.overlay,o=i.figureType,r=i.figureKey,a=i.figureIndex,s=t.overlay;if(((null==n?void 0:n.id)!==(null==s?void 0:s.id)||o!==t.figureType||a!==t.figureIndex)&&(this._hoverOverlayInfo=t,(null==n?void 0:n.id)!==(null==s?void 0:s.id))){var l=!1,u=!1;null!==n&&(u=!0,F(n.onMouseLeave)&&(n.onMouseLeave(c({chart:this._chart,overlay:n,figureKey:r,figureIndex:a},e)),l=!0)),null!==s&&(u=!0,F(s.onMouseEnter)&&(s.onMouseEnter(c({chart:this._chart,overlay:s,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),l=!0)),u&&this._sortOverlays(),l||this._chart.updatePane(1)}},e.prototype.getHoverOverlayInfo=function(){return this._hoverOverlayInfo},e.prototype.setClickOverlayInfo=function(t,e){var i,n,o,r,a=this._clickOverlayInfo,s=a.paneId,l=a.overlay,u=a.figureType,h=a.figureKey,d=a.figureIndex,p=t.overlay;null!==(i=null==p?void 0:p.isDrawing())&&void 0!==i&&i||null===(n=null==p?void 0:p.onClick)||void 0===n||n.call(p,c({chart:this._chart,overlay:p,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),(null==l?void 0:l.id)===(null==p?void 0:p.id)&&u===t.figureType&&d===t.figureIndex||(this._clickOverlayInfo=t,(null==l?void 0:l.id)!==(null==p?void 0:p.id)&&(null===(o=null==l?void 0:l.onDeselected)||void 0===o||o.call(l,c({chart:this._chart,overlay:l,figureKey:h,figureIndex:d},e)),null===(r=null==p?void 0:p.onSelected)||void 0===r||r.call(p,c({chart:this._chart,overlay:p,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),this._chart.updatePane(1,t.paneId),s!==t.paneId&&this._chart.updatePane(1,s),this._chart.updatePane(1,Ee)))},e.prototype.getClickOverlayInfo=function(){return this._clickOverlayInfo},e.prototype.isOverlayEmpty=function(){return 0===this._overlays.size&&null===this._progressOverlayInfo},e.prototype.isOverlayDrawing=function(){var t,e;return null!==(e=null===(t=this._progressOverlayInfo)||void 0===t?void 0:t.overlay.isDrawing())&&void 0!==e&&e},e.prototype.clearData=function(){this._loadDataMore.backward=!1,this._loadDataMore.forward=!1,this._loading=!0,this._dataList=[],this._visibleRangeDataList=[],this._visibleRangeHighLowPrice=[{x:0,price:Number.MIN_SAFE_INTEGER},{x:0,price:Number.MAX_SAFE_INTEGER}],this._visibleRange={from:0,to:0,realFrom:0,realTo:0},this._timeWeightTickMap.clear(),this._timeWeightTickList=[],this._crosshair={},this._activeTooltipIcon=null},e.prototype.getChart=function(){return this._chart},e}(),De="main",Ae="xAxis",Fe="yAxis",Be="separator";var Re=function(){function t(t,e){var i=this;this._supportedDevicePixelContentBox=!1,this._width=0,this._height=0,this._pixelWidth=0,this._pixelHeight=0,this._nextPixelWidth=0,this._nextPixelHeight=0,this._requestAnimationId=ut,this._mediaQueryListener=function(){var t=q(i._element);i._nextPixelWidth=Math.round(i._element.clientWidth*t),i._nextPixelHeight=Math.round(i._element.clientHeight*t),i._resetPixelRatio()},this._listener=e,this._element=mt("canvas",t),this._ctx=this._element.getContext("2d"),function(){return d(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var e=new ResizeObserver((function(i){t(i.every((function(t){return"devicePixelContentBoxSize"in t}))),e.disconnect()}));e.observe(document.body,{box:"device-pixel-content-box"})})).catch((function(){return!1}))];case 1:return[2,t.sent()]}}))}))}().then((function(t){i._supportedDevicePixelContentBox=t,t?(i._resizeObserver=new ResizeObserver((function(t){var e=t.find((function(t){return t.target===i._element})),n=null==e?void 0:e.devicePixelContentBoxSize[0];L(n)&&(i._nextPixelWidth=n.inlineSize,i._nextPixelHeight=n.blockSize,i._pixelWidth===i._nextPixelWidth&&i._pixelHeight===i._nextPixelHeight||i._resetPixelRatio())})),i._resizeObserver.observe(i._element,{box:"device-pixel-content-box"})):(i._mediaQueryList=window.matchMedia("(resolution: ".concat(q(i._element),"dppx)")),i._mediaQueryList.addListener(i._mediaQueryListener))})).catch((function(t){return!1}))}return t.prototype._resetPixelRatio=function(){var t=this;this._executeListener((function(){var e=t._element.clientWidth,i=t._element.clientHeight;t._width=e,t._height=i,t._pixelWidth=t._nextPixelWidth,t._pixelHeight=t._nextPixelHeight,t._element.width=t._nextPixelWidth,t._element.height=t._nextPixelHeight;var n=t._nextPixelWidth/e,o=t._nextPixelHeight/i;t._ctx.scale(n,o)}))},t.prototype._executeListener=function(t){var e=this;this._requestAnimationId===ut&&(this._requestAnimationId=ct((function(){e._ctx.clearRect(0,0,e._width,e._height),null==t||t(),e._listener(),e._requestAnimationId=ut})))},t.prototype.update=function(t,e){if(this._width!==t||this._height!==e){if(this._element.style.width="".concat(t,"px"),this._element.style.height="".concat(e,"px"),!this._supportedDevicePixelContentBox){var i=q(this._element);this._nextPixelWidth=Math.round(t*i),this._nextPixelHeight=Math.round(e*i),this._resetPixelRatio()}}else this._executeListener()},t.prototype.getElement=function(){return this._element},t.prototype.getContext=function(){return this._ctx},t.prototype.destroy=function(){L(this._resizeObserver)&&this._resizeObserver.unobserve(this._element),L(this._mediaQueryList)&&this._mediaQueryList.removeListener(this._mediaQueryListener)},t}(),Le=function(t){function e(e,i){var n=t.call(this)||this;return n._bounding=lt(),n._pane=i,n._rootContainer=e,n._container=n.createContainer(),e.appendChild(n._container),n}return i(e,t),e.prototype.setBounding=function(t){return M(this._bounding,t),this},e.prototype.getContainer=function(){return this._container},e.prototype.getBounding=function(){return this._bounding},e.prototype.getPane=function(){return this._pane},e.prototype.update=function(t){this.updateImp(this._container,this._bounding,null!=t?t:3)},e.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},e}(oe),Oe=function(t){function e(e,i){var n=t.call(this,e,i)||this;n._mainCanvas=new Re({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},(function(){n.updateMain(n._mainCanvas.getContext())})),n._overlayCanvas=new Re({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},(function(){n.updateOverlay(n._overlayCanvas.getContext())}));var o=n.getContainer();return o.appendChild(n._mainCanvas.getElement()),o.appendChild(n._overlayCanvas.getElement()),n}return i(e,t),e.prototype.createContainer=function(){return mt("div",{margin:"0",padding:"0",position:"absolute",top:"0",overflow:"hidden",boxSizing:"border-box",zIndex:"1"})},e.prototype.updateImp=function(t,e,i){var n=e.width,o=e.height,r=e.left;t.style.left="".concat(r,"px");var a=i,s=t.clientWidth,l=t.clientHeight;switch(n===s&&o===l||(t.style.width="".concat(n,"px"),t.style.height="".concat(o,"px"),a=3),a){case 0:this._mainCanvas.update(n,o);break;case 1:this._overlayCanvas.update(n,o);break;case 3:case 4:this._mainCanvas.update(n,o),this._overlayCanvas.update(n,o)}},e.prototype.destroy=function(){this._mainCanvas.destroy(),this._overlayCanvas.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=q(o);return o.width=i*a,o.height=n*a,r.scale(a,a),r.drawImage(this._mainCanvas.getElement(),0,0,i,n),t&&r.drawImage(this._overlayCanvas.getElement(),0,0,i,n),o},e}(Le);function We(t){return"transparent"===t||"none"===t||/^[rR][gG][Bb][Aa]\(([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\s]*,){3}[\s]*0[\s]*\)$/.test(t)||/^[hH][Ss][Ll][Aa]\(([\s]*(360|3[0-5][0-9]|[012]?[0-9][0-9]?)[\s]*,)([\s]*((100|[0-9][0-9]?)%|0)[\s]*,){2}([\s]*0[\s]*)\)$/.test(t)}function ze(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value,l=s.x,u=s.y,c=s.r,h=t.x-l,d=t.y-u;if(!(h*h+d*d>c*c))return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}var Ve={name:"circle",checkEventOn:ze,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"currentColor":s,u=n.borderSize,c=void 0===u?1:u,h=n.borderColor,d=void 0===h?"currentColor":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderDashedValue,f=void 0===v?[2,2]:v,y=!(a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&We(l));y&&(e.fillStyle=l,o.forEach((function(t){var i=t.x,n=t.y,o=t.r;e.beginPath(),e.arc(i,n,o,0,2*Math.PI),e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&c>0&&!We(d)&&(e.strokeStyle=d,e.lineWidth=c,g===t.LineType.Dashed?e.setLineDash(f):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.r;(!y||o>c)&&(e.beginPath(),e.arc(i,n,o,0,2*Math.PI),e.closePath(),e.stroke())})))}(e,i,n)}};function Ne(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){for(var s=a.value,l=!1,u=s.coordinates,c=0,h=u.length-1;c<u.length;h=c++)u[c].y>t.y!=u[h].y>t.y&&t.x<(u[h].x-u[c].x)*(t.y-u[c].y)/(u[h].y-u[c].y)+u[c].x&&(l=!l);if(l)return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}var Ye={name:"polygon",checkEventOn:Ne,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.PolygonType.Fill:r,s=n.color,l=void 0===s?"currentColor":s,u=n.borderSize,c=void 0===u?1:u,h=n.borderColor,d=void 0===h?"currentColor":h,p=n.borderStyle,g=void 0===p?t.LineType.Solid:p,v=n.borderDashedValue,f=void 0===v?[2,2]:v;a!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(l)&&We(l)||(e.fillStyle=l,o.forEach((function(t){var i=t.coordinates;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(var n=1;n<i.length;n++)e.lineTo(i[n].x,i[n].y);e.closePath(),e.fill()}))),(a===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&c>0&&!We(d)&&(e.strokeStyle=d,e.lineWidth=c,g===t.LineType.Dashed?e.setLineDash(f):e.setLineDash([]),o.forEach((function(t){var i=t.coordinates;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(var n=1;n<i.length;n++)e.lineTo(i[n].x,i[n].y);e.closePath(),e.stroke()})))}(e,i,n)}};function He(t,e){var i,n,o=[];o=o.concat(e);try{for(var r=g(o),a=r.next();!a.done;a=r.next()){var s=a.value,l=s.x,u=s.width;u<4&&(l-=2,u=4);var c=s.y,h=s.height;if(h<4&&(c-=2,h=4),t.x>=l&&t.x<=l+u&&t.y>=c&&t.y<=c+h)return!0}}catch(t){i={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return!1}function Xe(e,i,n){var o,r=[];r=r.concat(i);var a=n.style,s=void 0===a?t.PolygonType.Fill:a,l=n.color,u=void 0===l?"transparent":l,c=n.borderSize,h=void 0===c?1:c,d=n.borderColor,p=void 0===d?"transparent":d,g=n.borderStyle,v=void 0===g?t.LineType.Solid:g,f=n.borderRadius,y=void 0===f?0:f,m=n.borderDashedValue,_=void 0===m?[2,2]:m,x=null!==(o=e.roundRect)&&void 0!==o?o:e.rect,C=!(s!==t.PolygonType.Fill&&n.style!==t.PolygonType.StrokeFill||W(u)&&We(u));if(C&&(e.fillStyle=u,r.forEach((function(t){var i=t.x,n=t.y,o=t.width,r=t.height;e.beginPath(),x.call(e,i,n,o,r,y),e.closePath(),e.fill()}))),(s===t.PolygonType.Stroke||n.style===t.PolygonType.StrokeFill)&&h>0&&!We(p)){e.strokeStyle=p,e.fillStyle=p,e.lineWidth=h,v===t.LineType.Dashed?e.setLineDash(_):e.setLineDash([]);var b=h%2==1?.5:0,T=Math.round(2*b);r.forEach((function(t){var i=t.x,n=t.y,o=t.width,r=t.height;o>2*h&&r>2*h?(e.beginPath(),x.call(e,i+b,n+b,o-T,r-T,y),e.closePath(),e.stroke()):C||e.fillRect(i,n,o,r)}))}}var Ge={name:"rect",checkEventOn:He,draw:function(t,e,i){Xe(t,e,i)}};function Ke(t,e){var i=e.size,n=void 0===i?12:i,o=e.paddingLeft,r=void 0===o?0:o,a=e.paddingTop,s=void 0===a?0:a,l=e.paddingRight,u=void 0===l?0:l,c=e.paddingBottom,h=void 0===c?0:c,d=e.weight,p=void 0===d?"normal":d,g=e.family,v=t.x,f=t.y,y=t.text,m=t.align,_=void 0===m?"left":m,x=t.baseline,C=void 0===x?"top":x,b=t.width,T=t.height,w=null!=b?b:r+Q(y,n,p,g)+u,S=null!=T?T:s+n+h,P=0;switch(_){case"left":case"start":P=v;break;case"right":case"end":P=v-w;break;default:P=v-w/2}var E=0;switch(C){case"top":case"hanging":E=f;break;case"bottom":case"ideographic":case"alphabetic":E=f-S;break;default:E=f-S/2}return{x:P,y:E,width:w,height:S}}function Ue(t,e,i){var n,o,r=[];r=r.concat(e);try{for(var a=g(r),s=a.next();!s.done;s=a.next()){var l=Ke(s.value,i),u=l.x,c=l.y,h=l.width,d=l.height;if(t.x>=u&&t.x<=u+h&&t.y>=c&&t.y<=c+d)return!0}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return!1}var je={name:"text",checkEventOn:Ue,draw:function(t,e,i){!function(t,e,i){var n=[];n=n.concat(e);var o=i.color,r=void 0===o?"currentColor":o,a=i.size,s=void 0===a?12:a,l=i.family,u=i.weight,h=i.paddingLeft,d=void 0===h?0:h,p=i.paddingTop,g=void 0===p?0:p,v=i.paddingRight,f=void 0===v?0:v,y=n.map((function(t){return Ke(t,i)}));Xe(t,y,c(c({},i),{color:i.backgroundColor})),t.textAlign="left",t.textBaseline="top",t.font=J(s,u,l),t.fillStyle=r,n.forEach((function(e,i){var n=y[i];t.fillText(e.text,n.x+d,n.y+g,n.width-d-f)}))}(t,e,i)}};function Ze(t,e){var i,n,o,r,a,s,l=[];l=l.concat(e);try{for(var u=g(l),c=u.next();!c.done;c=u.next()){var h=c.value;if(Math.abs((r=h,a=void 0,s=void 0,a=(o=t).x-r.x,s=o.y-r.y,Math.sqrt(a*a+s*s)-h.r))<2){var d=h.r,p=h.startAngle,v=h.endAngle,f=d*Math.cos(p)+h.x,y=d*Math.sin(p)+h.y,m=d*Math.cos(v)+h.x,_=d*Math.sin(v)+h.y;if(t.x<=Math.max(f,m)+2&&t.x>=Math.min(f,m)-2&&t.y<=Math.max(y,_)+2&&t.y>=Math.min(y,_)-2)return!0}}}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return!1}var qe={name:"arc",checkEventOn:Ze,draw:function(e,i,n){!function(e,i,n){var o=[];o=o.concat(i);var r=n.style,a=void 0===r?t.LineType.Solid:r,s=n.size,l=void 0===s?1:s,u=n.color,c=void 0===u?"currentColor":u,h=n.dashedValue,d=void 0===h?[2,2]:h;e.lineWidth=l,e.strokeStyle=c,a===t.LineType.Dashed?e.setLineDash(d):e.setLineDash([]),o.forEach((function(t){var i=t.x,n=t.y,o=t.r,r=t.startAngle,a=t.endAngle;e.beginPath(),e.arc(i,n,o,r,a),e.stroke(),e.closePath()}))}(e,i,n)}},Je={};[Ve,he,Ye,Ge,je,qe].forEach((function(t){Je[t.name]=re.extend(t)}));var Qe,$e=function(t){function e(e){var i=t.call(this)||this;return i._widget=e,i}return i(e,t),e.prototype.getWidget=function(){return this._widget},e.prototype.createFigure=function(t,e){var i,n,o=(i=t.name,null!==(n=Je[i])&&void 0!==n?n:null);if(null!==o){var r=new o(t);if(L(e)){for(var a in e)e.hasOwnProperty(a)&&r.registerEvent(a,e[a]);this.addChild(r)}return r}return null},e.prototype.draw=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this.clear(),this.drawImp(t,e)},e}(oe),ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i,n=this.getWidget(),o=this.getWidget().getPane(),r=o.getChart(),a=n.getBounding(),s=r.getStyles().grid;if(s.show){t.save(),t.globalCompositeOperation="destination-over";var l=s.horizontal;if(l.show){var u=o.getAxisComponent().getTicks().map((function(t){return{coordinates:[{x:0,y:t.coord},{x:a.width,y:t.coord}]}}));null===(e=this.createFigure({name:"line",attrs:u,styles:l}))||void 0===e||e.draw(t)}var c=s.vertical;if(c.show){u=r.getXAxisPane().getAxisComponent().getTicks().map((function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:a.height}]}}));null===(i=this.createFigure({name:"line",attrs:u,styles:c}))||void 0===i||i.draw(t)}t.restore()}},e}($e),ei=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.eachChildren=function(t){for(var e=this.getWidget().getPane().getChart().getChartStore(),i=e.getVisibleRangeDataList(),n=e.getBarSpace(),o=i.length,r=0;r<o;)t(i[r],n,r),++r},e}($e),ii=function(e){function n(){var i=e.apply(this,f([],v(arguments),!1))||this;return i._heikinAshiCache=new Map,i._boundCandleBarClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().executeAction(t.ActionType.OnCandleBarClick,e),!1}},i}return i(n,e),n.prototype.drawImp=function(e){var i=this,n=this.getWidget().getPane(),o=n.getId()===Se,r=n.getChart().getChartStore(),a=this.getCandleBarOptions();if(null!==a){var s=0,l=0;if(a.type===t.CandleType.Ohlc){var u=r.getBarSpace().gapBar;(s=Math.min(Math.max(Math.round(.2*u),1),8))>2&&s%2==1&&s--,l=Math.floor(l/2)}a.type!==t.CandleType.HeikinAshi&&this._heikinAshiCache.clear();var c=n.getAxisComponent();this.eachChildren((function(n,r){var u=n.data,h=n.x;if(L(u)){var d=u.open,p=u.high,g=u.low,v=u.close,f=a.type,y=a.styles,m=[];v>d?(m[0]=y.upColor,m[1]=y.upBorderColor,m[2]=y.upWickColor):v<d?(m[0]=y.downColor,m[1]=y.downBorderColor,m[2]=y.downWickColor):(m[0]=y.noChangeColor,m[1]=y.noChangeBorderColor,m[2]=y.noChangeWickColor);var _=c.convertToPixel(d),x=c.convertToPixel(v),C=[_,x,c.convertToPixel(p),c.convertToPixel(g)];C.sort((function(t,e){return t-e}));var b=r.gapBar%2==0?1:0,T=[];switch(f){case t.CandleType.CandleSolid:T=i._createSolidBar(h,C,r,m,b);break;case t.CandleType.CandleStroke:T=i._createStrokeBar(h,C,r,m,b);break;case t.CandleType.CandleUpStroke:T=v>d?i._createStrokeBar(h,C,r,m,b):i._createSolidBar(h,C,r,m,b);break;case t.CandleType.CandleDownStroke:T=d>v?i._createStrokeBar(h,C,r,m,b):i._createSolidBar(h,C,r,m,b);break;case t.CandleType.Ohlc:T=[{name:"rect",attrs:[{x:h-l,y:C[0],width:s,height:C[3]-C[0]},{x:h-r.halfGapBar,y:_+s>C[3]?C[3]-s:_,width:r.halfGapBar,height:s},{x:h+l,y:x+s>C[3]?C[3]-s:x,width:r.halfGapBar-l,height:s}],styles:{color:m[0]}}];break;case t.CandleType.HeikinAshi:var w=i._calculateHeikinAshi(n);m=i._getHeikinAshiColors(w.haValues.open,w.haValues.close,d,v,y),T=i._createSolidBar(h,w.priceY,r,m,b)}T.forEach((function(t){var r,a=null;o&&(a={mouseClickEvent:i._boundCandleBarClickEvent(n)}),null===(r=i.createFigure(t,null!=a?a:void 0))||void 0===r||r.draw(e)}))}}))}},n.prototype.getCandleBarOptions=function(){var t=this.getWidget().getPane().getChart().getStyles().candle;return{type:t.type,styles:t.bar}},n.prototype._createSolidBar=function(e,i,n,o,r){return[{name:"rect",attrs:{x:e,y:i[0],width:1,height:i[3]-i[0]},styles:{color:o[2]}},{name:"rect",attrs:{x:e-n.halfGapBar,y:i[1],width:n.gapBar+r,height:Math.max(1,i[2]-i[1])},styles:{style:t.PolygonType.StrokeFill,color:o[0],borderColor:o[1]}}]},n.prototype._createStrokeBar=function(e,i,n,o,r){return[{name:"rect",attrs:[{x:e,y:i[0],width:1,height:i[1]-i[0]},{x:e,y:i[2],width:1,height:i[3]-i[2]}],styles:{color:o[2]}},{name:"rect",attrs:{x:e-n.halfGapBar,y:i[1],width:n.gapBar+r,height:Math.max(1,i[2]-i[1])},styles:{style:t.PolygonType.Stroke,borderColor:o[1]}}]},n.prototype._calculateHeikinAshi=function(t){var e=t.data,i=t.dataIndex,n=e,o=n.open,r=n.high,a=n.low,s=n.close,l=this._heikinAshiCache.get(i);if(void 0!==l){var u=this.getWidget().getPane().getAxisComponent(),c=[u.convertToPixel(l.open),u.convertToPixel(l.close),u.convertToPixel(l.high),u.convertToPixel(l.low)];return c.sort((function(t,e){return t-e})),{priceY:c,haValues:l}}var h=(o+r+a+s)/4,d=0;if(i>0){var p=this._getHeikinAshiValues(i-1);if(null!==p)d=(p.open+p.close)/2;else{var g=this.getPreviousData(i);d=null!==g?(g.open+g.close)/2:o}}else d=(o+s)/2;var v=Math.max(r,d,h),f=Math.min(a,d,h),y={open:d,high:v,low:f,close:h};this._heikinAshiCache.set(i,y);var m=this.getWidget().getPane().getAxisComponent(),_=[m.convertToPixel(d),m.convertToPixel(h),m.convertToPixel(v),m.convertToPixel(f)];return _.sort((function(t,e){return t-e})),{priceY:_,haValues:y}},n.prototype._getHeikinAshiValues=function(t){var e=this._heikinAshiCache.get(t);if(void 0!==e)return e;var i=this.getWidget().getPane().getChart().getChartStore().getDataList();if(t<0||t>=i.length)return null;var n=i[t],o=null;t>0&&(o=this._getHeikinAshiValues(t-1));var r=n.open,a=n.high,s=n.low,l=n.close,u=(r+a+s+l)/4,c=0,h={open:c=null!==o?(o.open+o.close)/2:(r+l)/2,high:Math.max(a,c,u),low:Math.min(s,c,u),close:u};return this._heikinAshiCache.set(t,h),h},n.prototype.getPreviousData=function(t){var e=this.getWidget().getPane().getChart().getChartStore().getDataList();return t<=0||t>=e.length?null:t>0&&t<e.length?e[t-1]:null},n.prototype._getHeikinAshiColors=function(t,e,i,n,o){var r=[],a=e-t;return a>1e-6?(r[0]=o.upColor,r[1]=o.upBorderColor,r[2]=o.upWickColor):a<-1e-6?(r[0]=o.downColor,r[1]=o.downBorderColor,r[2]=o.downWickColor):n>i?(r[0]=o.upColor,r[1]=o.upBorderColor,r[2]=o.upWickColor):n<i?(r[0]=o.downColor,r[1]=o.downBorderColor,r[2]=o.downWickColor):(r[0]=o.noChangeColor,r[1]=o.noChangeBorderColor,r[2]=o.noChangeWickColor),r},n}(ei),ni=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.getCandleBarOptions=function(){var e,i,n=this.getWidget().getPane();if(!n.getAxisComponent().isInCandle()){var o=n.getChart().getChartStore(),r=o.getIndicatorsByPaneId(n.getId());try{for(var a=g(r),s=a.next();!s.done;s=a.next()){var l=s.value;if(l.shouldOhlc&&l.visible){var u=l.styles,c=o.getStyles().indicator,h=N(u,"ohlc.upColor",c.ohlc.upColor),d=N(u,"ohlc.downColor",c.ohlc.downColor),p=N(u,"ohlc.noChangeColor",c.ohlc.noChangeColor);return{type:t.CandleType.Ohlc,styles:{upColor:h,downColor:d,noChangeColor:p,upBorderColor:h,downBorderColor:d,noChangeBorderColor:p,upWickColor:h,downWickColor:d,noChangeWickColor:p}}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}}return null},n.prototype.drawImp=function(t){var i=this;e.prototype.drawImp.call(this,t);var n=this.getWidget(),o=n.getPane(),r=o.getChart(),a=n.getBounding(),s=r.getXAxisPane().getAxisComponent(),l=o.getAxisComponent(),u=r.getChartStore(),c=u.getIndicatorsByPaneId(o.getId()),h=u.getStyles().indicator;t.save(),c.forEach((function(e){if(e.visible){e.zLevel<0?t.globalCompositeOperation="destination-over":t.globalCompositeOperation="source-over";var n=!1;if(null!==e.draw&&(t.save(),n=e.draw({ctx:t,chart:r,indicator:e,bounding:a,xAxis:s,yAxis:l}),t.restore()),!n){var o=e.result,u=[];i.eachChildren((function(n,r){var c,d,p,g=r.halfGapBar,v=n.dataIndex,f=n.x,y=s.convertToPixel(v-1),m=s.convertToPixel(v+1),_=null!==(c=o[v-1])&&void 0!==c?c:null,x=null!==(d=o[v])&&void 0!==d?d:null,C=null!==(p=o[v+1])&&void 0!==p?p:null,b={x:y},T={x:f},w={x:m};e.figures.forEach((function(t){var e=t.key,i=null==_?void 0:_[e];R(i)&&(b[e]=l.convertToPixel(i));var n=null==x?void 0:x[e];R(n)&&(T[e]=l.convertToPixel(n));var o=null==C?void 0:C[e];R(o)&&(w[e]=l.convertToPixel(o))})),it(e,v,h,(function(e,n,o){var c,h,d;if(L(null==x?void 0:x[e.key])){var p=T[e.key],v=null===(c=e.attrs)||void 0===c?void 0:c.call(e,{data:{prev:_,current:x,next:C},coordinate:{prev:b,current:T,next:w},bounding:a,barSpace:r,xAxis:s,yAxis:l});if(!L(v))switch(e.type){case"circle":v={x:f,y:p,r:Math.max(1,g)};break;case"rect":case"bar":var y=null!==(h=e.baseValue)&&void 0!==h?h:l.getRange().from,m=l.convertToPixel(y),S=Math.abs(m-p);y!==(null==x?void 0:x[e.key])&&(S=Math.max(1,S));v={x:f-g,y:p>m?m:p,width:Math.max(1,2*g),height:S};break;case"line":L(u[o])||(u[o]=[]),R(T[e.key])&&R(w[e.key])&&u[o].push({coordinates:[{x:T.x,y:T[e.key]},{x:w.x,y:w[e.key]}],styles:n})}var P=e.type;L(v)&&"line"!==P&&(null===(d=i.createFigure({name:"bar"===P?"rect":P,attrs:v,styles:n}))||void 0===d||d.draw(t))}}))})),u.forEach((function(e){var n,o,r,a;if(e.length>1){for(var s=[{coordinates:[e[0].coordinates[0],e[0].coordinates[1]],styles:e[0].styles}],l=1;l<e.length;l++){var u=s[s.length-1],c=e[l],h=u.coordinates[u.coordinates.length-1];h.x===c.coordinates[0].x&&h.y===c.coordinates[0].y&&u.styles.style===c.styles.style&&u.styles.color===c.styles.color&&u.styles.size===c.styles.size&&u.styles.smooth===c.styles.smooth&&(null===(n=u.styles.dashedValue)||void 0===n?void 0:n[0])===(null===(o=c.styles.dashedValue)||void 0===o?void 0:o[0])&&(null===(r=u.styles.dashedValue)||void 0===r?void 0:r[1])===(null===(a=c.styles.dashedValue)||void 0===a?void 0:a[1])?u.coordinates.push(c.coordinates[1]):s.push({coordinates:[c.coordinates[0],c.coordinates[1]],styles:c.styles})}s.forEach((function(e){var n,o=e.coordinates,r=e.styles;null===(n=i.createFigure({name:"line",attrs:{coordinates:o},styles:r}))||void 0===n||n.draw(t)}))}}))}}})),t.restore()},n}(ii),oi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=e.getBounding(),o=e.getPane().getChart().getChartStore(),r=o.getCrosshair(),a=o.getStyles().crosshair;if(W(r.paneId)&&a.show){if(r.paneId===i.getId()){var s=r.y;this._drawLine(t,[{x:0,y:s},{x:n.width,y:s}],a.horizontal)}var l=r.realX;this._drawLine(t,[{x:l,y:0},{x:l,y:n.height}],a.vertical)}},e.prototype._drawLine=function(t,e,i){var n;if(i.show){var o=i.line;o.show&&(null===(n=this.createFigure({name:"line",attrs:{coordinates:e},styles:o}))||void 0===n||n.draw(t))}},e}($e),ri=function(e){function n(){var i=e.apply(this,f([],v(arguments),!1))||this;return i._boundIconClickEvent=function(e){return function(){return i.getWidget().getPane().getChart().getChartStore().executeAction(t.ActionType.OnTooltipIconClick,c({},e)),!0}},i._boundIconMouseMoveEvent=function(t){return function(){return i.getWidget().getPane().getChart().getChartStore().setActiveTooltipIcon(c({},t)),!0}},i}return i(n,e),n.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane().getChart().getChartStore();if(L(i.getCrosshair().kLineData)){var n=e.getBounding(),o=i.getStyles().indicator.tooltip,r=o.offsetLeft,a=o.offsetTop,s=o.offsetRight;this.drawIndicatorTooltip(t,r,a,n.width-s)}},n.prototype.drawIndicatorTooltip=function(t,e,i,n){var o=this,r=this.getWidget().getPane(),a=r.getChart().getChartStore(),s=a.getStyles().indicator.tooltip;if(this.isDrawTooltip(a.getCrosshair(),s)){var l=a.getIndicatorsByPaneId(r.getId()),u=s.text;l.forEach((function(r){var a=0,l={x:e,y:i},c=o.getIndicatorTooltipData(r),h=c.name,d=c.calcParamsText,p=c.legends,g=c.icons,f=h.length>0,y=p.length>0;if(f||y){var m=v(o.classifyTooltipIcons(g),3),_=m[0],x=m[1],C=m[2];if(a=o.drawStandardTooltipIcons(t,_,l,r.name,e,a,n),f){var b=h;d.length>0&&(b="".concat(b).concat(d)),a=o.drawStandardTooltipLegends(t,[{title:{text:"",color:u.color},value:{text:b,color:u.color}}],l,e,a,n,u)}a=o.drawStandardTooltipIcons(t,x,l,r.name,e,a,n),y&&(a=o.drawStandardTooltipLegends(t,p,l,e,a,n,s.text)),a=o.drawStandardTooltipIcons(t,C,l,r.name,e,a,n),i=l.y+a}}))}return i},n.prototype.drawStandardTooltipIcons=function(t,e,i,n,o,r,a){var s=this;if(e.length>0){var l=0,u=0;e.forEach((function(e){var i=e.marginLeft,n=void 0===i?0:i,o=e.marginTop,r=void 0===o?0:o,a=e.marginRight,s=void 0===a?0:a,c=e.marginBottom,h=void 0===c?0:c,d=e.paddingLeft,p=void 0===d?0:d,g=e.paddingTop,v=void 0===g?0:g,f=e.paddingRight,y=void 0===f?0:f,m=e.paddingBottom,_=void 0===m?0:m,x=e.size,C=e.fontFamily,b=e.icon;t.font=J(x,"normal",C),l+=n+p+t.measureText(b).width+y+s,u=Math.max(u,r+v+x+_+h)})),i.x+l>a?(i.x=o,i.y+=r,r=u):r=Math.max(r,u);var c=this.getWidget().getPane(),h=c.getId(),d=c.getChart().getChartStore().getActiveTooltipIcon();e.forEach((function(e){var o,r=e.marginLeft,a=void 0===r?0:r,l=e.marginTop,u=void 0===l?0:l,c=e.marginRight,p=void 0===c?0:c,g=e.paddingLeft,v=void 0===g?0:g,f=e.paddingTop,y=void 0===f?0:f,m=e.paddingRight,_=void 0===m?0:m,x=e.paddingBottom,C=void 0===x?0:x,b=e.color,T=e.activeColor,w=e.size,S=e.fontFamily,P=e.icon,E=e.backgroundColor,I=e.activeBackgroundColor,k=(null==d?void 0:d.paneId)===h&&d.indicatorName===n&&d.iconId===e.id;null===(o=s.createFigure({name:"text",attrs:{text:P,x:i.x+a,y:i.y+u},styles:{paddingLeft:v,paddingTop:y,paddingRight:_,paddingBottom:C,color:k?T:b,size:w,family:S,backgroundColor:k?I:E}},{mouseClickEvent:s._boundIconClickEvent({paneId:h,indicatorName:n,iconId:e.id}),mouseMoveEvent:s._boundIconMouseMoveEvent({paneId:h,indicatorName:n,iconId:e.id})}))||void 0===o||o.draw(t),i.x+=a+v+t.measureText(P).width+_+p}))}return r},n.prototype.drawStandardTooltipLegends=function(t,e,i,n,o,r,a){var s=this;if(e.length>0){var l=a.marginLeft,u=a.marginTop,c=a.marginRight,h=a.marginBottom,d=a.size,p=a.family,g=a.weight;t.font=J(d,g,p),e.forEach((function(e){var a,v,f=e.title,y=e.value,m=t.measureText(f.text).width,_=m+t.measureText(y.text).width,x=u+d+h;i.x+l+_+c>r?(i.x=n,i.y+=o,o=x):o=Math.max(o,x),f.text.length>0&&(null===(a=s.createFigure({name:"text",attrs:{x:i.x+l,y:i.y+u,text:f.text},styles:{color:f.color,size:d,family:p,weight:g}}))||void 0===a||a.draw(t)),null===(v=s.createFigure({name:"text",attrs:{x:i.x+l+m,y:i.y+u,text:y.text},styles:{color:y.color,size:d,family:p,weight:g}}))||void 0===v||v.draw(t),i.x+=l+_+c}))}return o},n.prototype.isDrawTooltip=function(e,i){var n=i.showRule;return n===t.TooltipShowRule.Always||n===t.TooltipShowRule.FollowCross&&W(e.paneId)},n.prototype.getIndicatorTooltipData=function(t){var e,i,n=this.getWidget().getPane().getChart().getChartStore(),o=n.getStyles().indicator,r=o.tooltip,a=r.showName?t.shortName:"",s="",l=t.calcParams;l.length>0&&r.showParams&&(s="(".concat(l.join(","),")"));var u={name:a,calcParamsText:s,legends:[],icons:r.icons},c=n.getCrosshair().dataIndex,h=t.result,d=n.getCustomApi(),p=n.getDecimalFold(),g=n.getThousandsSeparator(),v=[];if(t.visible){var f=null!==(i=null!==(e=h[c])&&void 0!==e?e:h[c-1])&&void 0!==i?i:{};it(t,c,o,(function(e,i){if(W(e.title)){var n=i.color,o=f[e.key];R(o)&&(o=X(o,t.precision),t.shouldFormatBigNumber&&(o=d.formatBigNumber(o)),o=p.format(g.format(o))),v.push({title:{text:e.title,color:n},value:{text:null!=o?o:r.defaultValue,color:n}})}})),u.legends=v}if(F(t.createTooltipDataSource)){var y=this.getWidget(),m=y.getPane(),_=m.getChart(),x=t.createTooltipDataSource({chart:_,indicator:t,crosshair:n.getCrosshair(),bounding:y.getBounding(),xAxis:m.getChart().getXAxisPane().getAxisComponent(),yAxis:m.getAxisComponent()}),C=x.name,b=x.calcParamsText,T=x.legends,w=x.icons;if(W(C)&&r.showName&&(u.name=C),W(b)&&r.showParams&&(u.calcParamsText=b),L(w)&&(u.icons=w),L(T)&&t.visible){var S=[],P=o.tooltip.text.color;T.forEach((function(t){var e={text:"",color:P};B(t.title)?e=t.title:e.text=t.title;var i={text:"",color:P};B(t.value)?i=t.value:i.text=t.value,R(Number(i.text))&&(i.text=p.format(g.format(i.text))),S.push({title:e,value:i})})),u.legends=S}}return u},n.prototype.classifyTooltipIcons=function(e){var i=[],n=[],o=[];return e.forEach((function(e){switch(e.position){case t.TooltipIconPosition.Left:i.push(e);break;case t.TooltipIconPosition.Middle:n.push(e);break;case t.TooltipIconPosition.Right:o.push(e)}})),[i,n,o]},n}($e),ai=function(e){function n(t){var i=e.call(this,t)||this;return i._initEvent(),i}return i(n,e),n.prototype._initEvent=function(){var t=this,e=this.getWidget().getPane(),i=e.getId(),n=e.getChart(),o=n.getChartStore();this.registerEvent("mouseMoveEvent",(function(e){var r,a=o.getProgressOverlayInfo();if(null!==a){var s=a.overlay,l=a.paneId;s.isStart()&&(o.updateProgressOverlayInfo(i),l=i);var u=s.points.length-1,h="".concat(at,"point_").concat(u);return s.isDrawing()&&l===i&&(s.eventMoveForDrawing(t._coordinateToPoint(s,e)),null===(r=s.onDrawing)||void 0===r||r.call(s,c({chart:n,overlay:s,figureKey:h,figureIndex:u},e))),t._figureMouseMoveEvent(s,1,h,u,0)(e)}return o.setHoverOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1})).registerEvent("mouseClickEvent",(function(e){var r,a,s=o.getProgressOverlayInfo();if(null!==s){var l=s.overlay,u=s.paneId;l.isStart()&&(o.updateProgressOverlayInfo(i,!0),u=i);var h=l.points.length-1,d="".concat(at,"point_").concat(h);return l.isDrawing()&&u===i&&(l.eventMoveForDrawing(t._coordinateToPoint(l,e)),null===(r=l.onDrawing)||void 0===r||r.call(l,c({chart:n,overlay:l,figureKey:d,figureIndex:h},e)),l.nextStep(),l.isDrawing()||(o.progressOverlayComplete(),null===(a=l.onDrawEnd)||void 0===a||a.call(l,c({chart:n,overlay:l,figureKey:d,figureIndex:h},e)))),t._figureMouseClickEvent(l,1,d,h,0)(e)}return o.setClickOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1})).registerEvent("mouseDoubleClickEvent",(function(e){var r,a=o.getProgressOverlayInfo();if(null!==a){var s=a.overlay,l=a.paneId;if(s.isDrawing()&&l===i&&(s.forceComplete(),!s.isDrawing())){o.progressOverlayComplete();var u=s.points.length-1,h="".concat(at,"point_").concat(u);null===(r=s.onDrawEnd)||void 0===r||r.call(s,c({chart:n,overlay:s,figureKey:h,figureIndex:u},e))}var d=s.points.length-1;return t._figureMouseClickEvent(s,1,"".concat(at,"point_").concat(d),d,0)(e)}return!1})).registerEvent("mouseRightClickEvent",(function(e){var i=o.getProgressOverlayInfo();if(null!==i){var n=i.overlay;if(n.isDrawing()){var r=n.points.length-1;return t._figureMouseRightClickEvent(n,1,"".concat(at,"point_").concat(r),r,0)(e)}}return!1})).registerEvent("mouseUpEvent",(function(t){var e,r=o.getPressedOverlayInfo(),a=r.overlay,s=r.figureIndex,l=r.figureKey;return null!==a&&(null===(e=a.onPressedMoveEnd)||void 0===e||e.call(a,c({chart:n,overlay:a,figureKey:l,figureIndex:s},t))),o.setPressedOverlayInfo({paneId:i,overlay:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1}),!1})).registerEvent("pressedMouseMoveEvent",(function(e){var i,r,a=o.getPressedOverlayInfo(),s=a.overlay,l=a.figureType,u=a.figureIndex,h=a.figureKey;if(null!==s){if(!(s.lock||null!==(r=null===(i=s.onPressedMoving)||void 0===i?void 0:i.call(s,c({chart:n,overlay:s,figureIndex:u,figureKey:h},e)))&&void 0!==r&&r)){var d=t._coordinateToPoint(s,e);1===l?s.eventPressedPointMove(d,u):s.eventPressedOtherMove(d,t.getWidget().getPane().getChart().getChartStore())}return!0}return!1}))},n.prototype._createFigureEvents=function(t,e,i,n,o,r){var a=null;if(!t.isDrawing()){var s=[];if(L(r)&&(O(r)?r&&(s=["mouseClickEvent","mouseDoubleClickEvent","mouseRightClickEvent","tapEvent","doubleTapEvent","mouseDownEvent","touchStartEvent","mouseMoveEvent","touchMoveEvent"]):s=r),0===s.length)return{mouseMoveEvent:this._figureMouseMoveEvent(t,e,i,n,o),mouseDownEvent:this._figureMouseDownEvent(t,e,i,n,o),mouseClickEvent:this._figureMouseClickEvent(t,e,i,n,o),mouseRightClickEvent:this._figureMouseRightClickEvent(t,e,i,n,o),mouseDoubleClickEvent:this._figureMouseDoubleClickEvent(t,e,i,n,o)};a={},s.includes("mouseMoveEvent")||s.includes("touchMoveEvent")||(a.mouseMoveEvent=this._figureMouseMoveEvent(t,e,i,n,o)),s.includes("mouseDownEvent")||s.includes("touchStartEvent")||(a.mouseDownEvent=this._figureMouseDownEvent(t,e,i,n,o)),s.includes("mouseClickEvent")||s.includes("tapEvent")||(a.mouseClickEvent=this._figureMouseClickEvent(t,e,i,n,o)),s.includes("mouseDoubleClickEvent")||s.includes("doubleTapEvent")||(a.mouseDoubleClickEvent=this._figureMouseDoubleClickEvent(t,e,i,n,o)),s.includes("mouseRightClickEvent")||(a.mouseRightClickEvent=this._figureMouseRightClickEvent(t,e,i,n,o))}return null!=a?a:void 0},n.prototype._figureMouseMoveEvent=function(t,e,i,n,o){var r=this;return function(a){var s=r.getWidget().getPane();return s.getChart().getChartStore().setHoverOverlayInfo({paneId:s.getId(),overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o},a),!0}},n.prototype._figureMouseDownEvent=function(t,e,i,n,o){var r=this;return function(a){var s,l=r.getWidget().getPane(),u=l.getId();return t.startPressedMove(r._coordinateToPoint(t,a)),null===(s=t.onPressedMoveStart)||void 0===s||s.call(t,c({chart:l.getChart(),overlay:t,figureIndex:n,figureKey:i},a)),l.getChart().getChartStore().setPressedOverlayInfo({paneId:u,overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o}),!0}},n.prototype._figureMouseClickEvent=function(t,e,i,n,o){var r=this;return function(a){var s=r.getWidget().getPane(),l=s.getId();return s.getChart().getChartStore().setClickOverlayInfo({paneId:l,overlay:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:o},a),!0}},n.prototype._figureMouseDoubleClickEvent=function(t,e,i,n,o){var r=this;return function(e){var o;return null===(o=t.onDoubleClick)||void 0===o||o.call(t,c(c({},e),{chart:r.getWidget().getPane().getChart(),figureIndex:n,figureKey:i,overlay:t})),!0}},n.prototype._figureMouseRightClickEvent=function(t,e,i,n,o){var r=this;return function(e){var o,a;return null!==(a=null===(o=t.onRightClick)||void 0===o?void 0:o.call(t,c({chart:r.getWidget().getPane().getChart(),overlay:t,figureIndex:n,figureKey:i},e)))&&void 0!==a&&a||r.getWidget().getPane().getChart().getChartStore().removeOverlay(t),!0}},n.prototype._coordinateToPoint=function(e,i){var n,o={},r=this.getWidget().getPane(),a=r.getChart(),s=r.getId(),l=a.getChartStore();if(this.coordinateToPointTimestampDataIndexFlag()){var u=a.getXAxisPane().getAxisComponent().convertFromPixel(i.x),c=null!==(n=l.dataIndexToTimestamp(u))&&void 0!==n?n:void 0;o.timestamp=c,o.dataIndex=u}if(this.coordinateToPointValueFlag()){var h=r.getAxisComponent(),d=h.convertFromPixel(i.y);if(e.mode!==t.OverlayMode.Normal&&s===Se&&R(o.dataIndex)){var p=l.getDataByDataIndex(o.dataIndex);if(null!==p){var g=e.modeSensitivity;if(d>p.high)if(e.mode===t.OverlayMode.WeakMagnet){var v=h.convertToPixel(p.high);d<h.convertFromPixel(v-g)&&(d=p.high)}else d=p.high;else if(d<p.low)if(e.mode===t.OverlayMode.WeakMagnet){var f=h.convertToPixel(p.low);d>h.convertFromPixel(f-g)&&(d=p.low)}else d=p.low;else{var y=Math.max(p.open,p.close),m=Math.min(p.open,p.close);d=d>y?d-y<p.high-d?y:p.high:d<m?d-p.low<m-d?p.low:m:y-d<d-m?y:m}}}o.value=d}return o},n.prototype.coordinateToPointValueFlag=function(){return!0},n.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},n.prototype.dispatchEvent=function(t,i,n){return this.getWidget().getPane().getChart().getChartStore().isOverlayDrawing()?this.onEvent(t,i,n):e.prototype.dispatchEvent.call(this,t,i,n)},n.prototype.checkEventOn=function(){return!0},n.prototype.drawImp=function(t){var e=this;this.getCompleteOverlays().forEach((function(i){i.visible&&e._drawOverlay(t,i)}));var i=this.getProgressOverlay();L(i)&&i.visible&&this._drawOverlay(t,i)},n.prototype._drawOverlay=function(t,e){var i=e.points,n=this.getWidget().getPane(),o=n.getChart(),r=o.getChartStore(),a=n.getAxisComponent(),s=o.getXAxisPane().getAxisComponent(),l=i.map((function(t){var e,i=null;R(t.timestamp)&&(i=r.timestampToDataIndex(t.timestamp));var n={x:0,y:0};return R(i)&&(n.x=s.convertToPixel(i)),R(t.value)&&(n.y=null!==(e=null==a?void 0:a.convertToPixel(t.value))&&void 0!==e?e:0),n}));if(l.length>0){var u=[].concat(this.getFigures(e,l));this.drawFigures(t,e,u)}this.drawDefaultFigures(t,e,l)},n.prototype.drawFigures=function(t,e,i){var n=this,o=this.getWidget().getPane().getChart().getStyles().overlay;i.forEach((function(i,r){var a=i.type,s=i.styles,l=i.attrs,u=i.ignoreEvent;[].concat(l).forEach((function(l,h){var d,p,g,v=n._createFigureEvents(e,2,null!==(d=i.key)&&void 0!==d?d:"",r,h,u),f=c(c(c({},o[a]),null===(p=e.styles)||void 0===p?void 0:p[a]),s);null===(g=n.createFigure({name:a,attrs:l,styles:f},v))||void 0===g||g.draw(t)}))}))},n.prototype.getCompleteOverlays=function(){var t=this.getWidget().getPane();return t.getChart().getChartStore().getOverlaysByPaneId(t.getId())},n.prototype.getProgressOverlay=function(){var t=this.getWidget().getPane(),e=t.getChart().getChartStore().getProgressOverlayInfo();return L(e)&&e.paneId===t.getId()?e.overlay:null},n.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createPointFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},n.prototype.drawDefaultFigures=function(t,e,i){var n,o,r=this;if(e.needDefaultPointFigure){var a=this.getWidget().getPane().getChart().getChartStore(),s=a.getHoverOverlayInfo(),l=a.getClickOverlayInfo();if((null===(n=s.overlay)||void 0===n?void 0:n.id)===e.id&&0!==s.figureType||(null===(o=l.overlay)||void 0===o?void 0:o.id)===e.id&&0!==l.figureType){var u=a.getStyles().overlay,h=e.styles,d=c(c({},u.point),null==h?void 0:h.point);i.forEach((function(i,n){var o,a,l,u=i.x,c=i.y,h=d.radius,p=d.color,g=d.borderColor,v=d.borderSize;(null===(o=s.overlay)||void 0===o?void 0:o.id)===e.id&&1===s.figureType&&s.figureIndex===n&&(h=d.activeRadius,p=d.activeColor,g=d.activeBorderColor,v=d.activeBorderSize),null===(a=r.createFigure({name:"circle",attrs:{x:u,y:c,r:h+v},styles:{color:g}},r._createFigureEvents(e,1,"".concat(at,"point_").concat(n),n,0)))||void 0===a||a.draw(t),null===(l=r.createFigure({name:"circle",attrs:{x:u,y:c,r:h},styles:{color:p}}))||void 0===l||l.draw(t)}))}}},n}($e),si=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._gridView=new ti(n),n._indicatorView=new ni(n),n._crosshairLineView=new oi(n),n._tooltipView=n.createTooltipView(),n._overlayView=new ai(n),n.addChild(n._tooltipView),n.addChild(n._overlayView),n.getContainer().style.cursor="crosshair",n.registerEvent("mouseMoveEvent",(function(){return i.getChart().getChartStore().setActiveTooltipIcon(),!1})),n}return i(e,t),e.prototype.getName=function(){return De},e.prototype.updateMain=function(t){"minimize"!==this.getPane().getOptions().state&&(this.updateMainContent(t),this._indicatorView.draw(t),this._gridView.draw(t))},e.prototype.createTooltipView=function(){return new ri(this)},e.prototype.updateMainContent=function(t){},e.prototype.updateOverlay=function(t){"minimize"!==this.getPane().getOptions().state&&(this._overlayView.draw(t),this._crosshairLineView.draw(t)),this._tooltipView.draw(t)},e}(Oe),li=function(t){function e(){var e=t.apply(this,f([],v(arguments),!1))||this;return e._ripplePoint=e.createFigure({name:"circle",attrs:{x:0,y:0,r:0},styles:{style:"fill"}}),e._animationFrameTime=0,e._animation=new gt({iterationCount:1/0}).doFrame((function(t){e._animationFrameTime=t;var i=e.getWidget().getPane();i.getChart().updatePane(0,i.getId())})),e}return i(e,t),e.prototype.drawImp=function(t){var e,i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=a.getDataList().length-1,l=o.getBounding(),u=r.getAxisComponent(),c=a.getStyles().candle.area,h=[],d=Number.MAX_SAFE_INTEGER,p=Number.MIN_SAFE_INTEGER,g=null;if(this.eachChildren((function(t){var e=t.data,i=t.x,n=null==e?void 0:e[c.value];if(R(n)){var o=u.convertToPixel(n);p===Number.MIN_SAFE_INTEGER&&(p=i),h.push({x:i,y:o}),d=Math.min(d,o),t.dataIndex===s&&(g={x:i,y:o})}})),h.length>0){null===(e=this.createFigure({name:"line",attrs:{coordinates:h},styles:{color:c.lineColor,size:c.lineSize,smooth:c.smooth}}))||void 0===e||e.draw(t);var v=c.backgroundColor,f="";if(A(v)){var y=t.createLinearGradient(0,l.height,0,d);try{v.forEach((function(t){var e=t.offset,i=t.color;y.addColorStop(e,i)}))}catch(t){}f=y}else f=v;t.fillStyle=f,t.beginPath(),t.moveTo(p,l.height),t.lineTo(h[0].x,h[0].y),ce(t,h,c.smooth),t.lineTo(h[h.length-1].x,l.height),t.closePath(),t.fill()}var m=c.point;if(m.show&&L(g)){null===(i=this.createFigure({name:"circle",attrs:{x:g.x,y:g.y,r:m.radius},styles:{style:"fill",color:m.color}}))||void 0===i||i.draw(t);var _=m.rippleRadius;m.animation&&(_=m.radius+this._animationFrameTime/m.animationDuration*(m.rippleRadius-m.radius),this._animation.setDuration(m.animationDuration).start()),null===(n=this._ripplePoint)||void 0===n||n.setAttrs({x:g.x,y:g.y,r:_}).setStyles({style:"fill",color:m.rippleColor}).draw(t)}else this.stopAnimation()},e.prototype.stopAnimation=function(){this._animation.stop()},e}(ei),ui=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e=this.getWidget().getPane(),i=e.getChart().getChartStore(),n=i.getStyles().candle.priceMark,o=n.high,r=n.low;if(n.show&&(o.show||r.show)){var a=i.getVisibleRangeHighLowPrice(),s=i.getPrecision(),l=e.getAxisComponent(),u=a[0],c=u.price,h=u.x,d=a[1],p=d.price,g=d.x,v=l.convertToPixel(c),f=l.convertToPixel(p),y=i.getDecimalFold(),m=i.getThousandsSeparator();o.show&&c!==Number.MIN_SAFE_INTEGER&&this._drawMark(t,y.format(m.format(X(c,s.price))),{x:h,y:v},v<f?[-2,-5]:[2,5],o),r.show&&p!==Number.MAX_SAFE_INTEGER&&this._drawMark(t,y.format(m.format(X(p,s.price))),{x:g,y:f},v<f?[2,5]:[-2,-5],r)}},e.prototype._drawMark=function(t,e,i,n,o){var r,a,s,l=i.x,u=i.y+n[0];null===(r=this.createFigure({name:"line",attrs:{coordinates:[{x:l-2,y:u+n[0]},{x:l,y:u},{x:l+2,y:u+n[0]}]},styles:{color:o.color}}))||void 0===r||r.draw(t);var c=0,h=0,d="left";l>this.getWidget().getBounding().width/2?(h=(c=l-5)-o.textOffset,d="right"):(d="left",h=(c=l+5)+o.textOffset);var p=u+n[1];null===(a=this.createFigure({name:"line",attrs:{coordinates:[{x:l,y:u},{x:l,y:p},{x:c,y:p}]},styles:{color:o.color}}))||void 0===a||a.draw(t),null===(s=this.createFigure({name:"text",attrs:{x:h,y:p,text:e,align:d,baseline:"middle"},styles:{color:o.color,size:o.textSize,family:o.textFamily,weight:o.textWeight}}))||void 0===s||s.draw(t)},e}($e),ci=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=n.getChart().getChartStore(),a=r.getStyles().candle.priceMark,s=a.last,l=s.line;if(a.show&&s.show&&l.show){var u=n.getAxisComponent(),c=r.getDataList(),h=c[c.length-1];if(L(h)){var d=h.close,p=h.open,g=u.convertToNicePixel(d),v="";v=d>p?s.upColor:d<p?s.downColor:s.noChangeColor,null===(e=this.createFigure({name:"line",attrs:{coordinates:[{x:0,y:g},{x:o.width,y:g}]},styles:{style:l.style,color:v,size:l.size,dashedValue:l.dashedValue}}))||void 0===e||e.draw(t)}}},e}($e);!function(t){t.Left="left",t.Right="right"}(Qe||(Qe={}));var hi=function(){function t(t){this.scrollZoomEnabled=!0,this._range={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0,displayFrom:0,displayTo:0,displayRange:0},this._prevRange={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0,displayFrom:0,displayTo:0,displayRange:0},this._ticks=[],this._autoCalcTickFlag=!0,this._parent=t}return t.prototype.getParent=function(){return this._parent},t.prototype.buildTicks=function(t){return this._autoCalcTickFlag&&(this._range=this.createRangeImp()),!(this._prevRange.from===this._range.from&&this._prevRange.to===this._range.to&&!t)&&(this._prevRange=this._range,this._ticks=this.createTicksImp(),!0)},t.prototype.getTicks=function(){return this._ticks},t.prototype.setRange=function(t){this._autoCalcTickFlag=!1,this._range=t},t.prototype.getRange=function(){return this._range},t.prototype.setAutoCalcTickFlag=function(t){this._autoCalcTickFlag=t},t.prototype.getAutoCalcTickFlag=function(){return this._autoCalcTickFlag},t}(),di={"zh-CN":{time:"时间:",open:"开:",high:"高:",low:"低:",close:"收:",volume:"成交量:",turnover:"成交额:",change:"涨幅:"},"en-US":{time:"Time: ",open:"Open: ",high:"High: ",low:"Low: ",close:"Close: ",volume:"Volume: ",turnover:"Turnover: ",change:"Change: "}};var pi=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.drawImp=function(e){var i=this.getWidget(),n=i.getPane().getChart().getChartStore(),o=n.getCrosshair();if(L(o.kLineData)){var r=i.getBounding(),a=n.getStyles(),s=a.candle,l=a.indicator;if(s.tooltip.showType===t.TooltipShowType.Rect&&l.tooltip.showType===t.TooltipShowType.Rect){var u=this.isDrawTooltip(o,s.tooltip),c=this.isDrawTooltip(o,l.tooltip);this._drawRectTooltip(e,u,c,s.tooltip.offsetTop)}else if(s.tooltip.showType===t.TooltipShowType.Standard&&l.tooltip.showType===t.TooltipShowType.Standard){var h=s.tooltip,d=h.offsetLeft,p=h.offsetTop,g=h.offsetRight,v=r.width-g,f=this._drawCandleStandardTooltip(e,d,p,v);this.drawIndicatorTooltip(e,d,f,v)}else if(s.tooltip.showType===t.TooltipShowType.Rect&&l.tooltip.showType===t.TooltipShowType.Standard){var y=s.tooltip,m=(d=y.offsetLeft,p=y.offsetTop,g=y.offsetRight,v=r.width-g,this.drawIndicatorTooltip(e,d,p,v));u=this.isDrawTooltip(o,s.tooltip);this._drawRectTooltip(e,u,!1,m)}else{var _=s.tooltip,x=(d=_.offsetLeft,p=_.offsetTop,g=_.offsetRight,v=r.width-g,this._drawCandleStandardTooltip(e,d,p,v));c=this.isDrawTooltip(o,l.tooltip);this._drawRectTooltip(e,!1,c,x)}}},n.prototype._drawCandleStandardTooltip=function(t,e,i,n){var o=this.getWidget().getPane().getChart().getChartStore(),r=o.getStyles().candle.tooltip,a=r.text,s=0,l={x:e,y:i},u=o.getCrosshair();if(this.isDrawTooltip(u,r)){var c=this._getCandleTooltipLegends(),h=v(this.classifyTooltipIcons(r.icons),3),d=h[0],p=h[1],g=h[2];s=this.drawStandardTooltipIcons(t,d,l,"",e,s,n),s=this.drawStandardTooltipIcons(t,p,l,"",e,s,n),c.length>0&&(s=this.drawStandardTooltipLegends(t,c,l,e,s,n,a)),s=this.drawStandardTooltipIcons(t,g,l,"",e,s,n)}return l.y+s},n.prototype._drawRectTooltip=function(e,i,n,o){var r,a,s=this,l=this.getWidget(),u=l.getPane(),c=u.getChart().getChartStore(),h=c.getStyles(),d=h.candle,p=h.indicator,g=d.tooltip,v=p.tooltip;if(i||n){var f=this._getCandleTooltipLegends(),y=g.offsetLeft,m=g.offsetTop,_=g.offsetRight,x=g.offsetBottom,C=g.text,b=C.marginLeft,T=C.marginRight,w=C.marginTop,S=C.marginBottom,P=C.size,E=C.weight,I=C.family,k=g.rect,M=k.position,D=k.paddingLeft,A=k.paddingRight,F=k.paddingTop,B=k.paddingBottom,R=k.offsetLeft,L=k.offsetRight,O=k.offsetTop,W=k.offsetBottom,z=k.borderSize,V=k.borderRadius,N=k.borderColor,Y=k.color,H=0,X=0,G=0;i&&(e.font=J(P,E,I),f.forEach((function(t){var i=t.title,n=t.value,o="".concat(i.text).concat(n.text),r=e.measureText(o).width+b+T;H=Math.max(H,r)})),G+=(S+w+P)*f.length);var K=v.text,U=K.marginLeft,j=K.marginRight,Z=K.marginTop,q=K.marginBottom,Q=K.size,$=K.weight,tt=K.family,et=[];if(n){var it=c.getIndicatorsByPaneId(u.getId());e.font=J(Q,$,tt),it.forEach((function(t){var i=s.getIndicatorTooltipData(t).legends;et.push(i),i.forEach((function(t){var i=t.title,n=t.value,o="".concat(i.text).concat(n.text),r=e.measureText(o).width+U+j;H=Math.max(H,r),G+=Z+q+Q}))}))}if(0!==(X+=H)&&0!==G){var nt=c.getCrosshair(),ot=l.getBounding(),rt=u.getYAxisWidget().getBounding();X+=2*z+D+A,G+=2*z+F+B;var at=ot.width/2,st=M===t.CandleTooltipRectPosition.Pointer&&nt.paneId===Se,lt=(null!==(r=nt.realX)&&void 0!==r?r:0)>at,ut=0;if(st){var ct=nt.realX;ut=lt?ct-L-X:ct+R}else{var ht=this.getWidget().getPane().getAxisComponent();lt?(ut=R+y,ht.inside&&ht.position===Qe.Left&&(ut+=rt.width)):(ut=ot.width-L-X-_,ht.inside&&ht.position===Qe.Right&&(ut-=rt.width))}var dt=o+O;if(st)(dt=nt.y-G/2)+G>ot.height-W-x&&(dt=ot.height-W-G-x),dt<o+O&&(dt=o+O+m);null===(a=this.createFigure({name:"rect",attrs:{x:ut,y:dt,width:X,height:G},styles:{style:t.PolygonType.StrokeFill,color:Y,borderColor:N,borderSize:z,borderRadius:V}}))||void 0===a||a.draw(e);var pt=ut+z+D+b,gt=dt+z+F;if(i&&f.forEach((function(t){var i,n;gt+=w;var o=t.title;null===(i=s.createFigure({name:"text",attrs:{x:pt,y:gt,text:o.text},styles:{color:o.color,size:P,family:I,weight:E}}))||void 0===i||i.draw(e);var r=t.value;null===(n=s.createFigure({name:"text",attrs:{x:ut+X-z-T-A,y:gt,text:r.text,align:"right"},styles:{color:r.color,size:P,family:I,weight:E}}))||void 0===n||n.draw(e),gt+=P+S})),n){var vt=ut+z+D+U;et.forEach((function(t){t.forEach((function(t){var i,n;gt+=Z;var o=t.title,r=t.value;null===(i=s.createFigure({name:"text",attrs:{x:vt,y:gt,text:o.text},styles:{color:o.color,size:Q,family:tt,weight:$}}))||void 0===i||i.draw(e),null===(n=s.createFigure({name:"text",attrs:{x:ut+X-z-j-A,y:gt,text:r.text,align:"right"},styles:{color:r.color,size:Q,family:tt,weight:$}}))||void 0===n||n.draw(e),gt+=Q+q}))}))}}}},n.prototype._getCandleTooltipLegends=function(){var e,i,n,o,r,a,s=this.getWidget().getPane().getChart().getChartStore(),l=s.getStyles().candle,u=s.getDataList(),h=s.getCustomApi(),d=s.getDecimalFold(),p=s.getThousandsSeparator(),g=s.getLocale(),v=s.getPrecision(),f=v.price,y=v.volume,m=null!==(e=s.getCrosshair().dataIndex)&&void 0!==e?e:0,_=l.tooltip,x=_.text.color,C=null!==(i=u[m-1])&&void 0!==i?i:null,b=u[m],T=null!==(n=null==C?void 0:C.close)&&void 0!==n?n:b.close,w=b.close-T,S={"{time}":h.formatDate(b.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Tooltip),"{open}":d.format(p.format(X(b.open,f))),"{high}":d.format(p.format(X(b.high,f))),"{low}":d.format(p.format(X(b.low,f))),"{close}":d.format(p.format(X(b.close,f))),"{volume}":d.format(p.format(h.formatBigNumber(X(null!==(o=b.volume)&&void 0!==o?o:_.defaultValue,y)))),"{turnover}":d.format(p.format(X(null!==(r=b.turnover)&&void 0!==r?r:_.defaultValue,f))),"{change}":0===T?_.defaultValue:"".concat(p.format(X(w/T*100)),"%")};return(F(_.custom)?_.custom({prev:C,current:b,next:null!==(a=u[m+1])&&void 0!==a?a:null},l):_.custom).map((function(t){var e,i=t.title,n=t.value,o={text:"",color:x};B(i)?o=c({},i):o.text=i,o.text=function(t,e){var i;return null!==(i=di[e][t])&&void 0!==i?i:t}(o.text,g);var r={text:_.defaultValue,color:x};B(n)?r=c({},n):r.text=n;var a=/{(\S*)}/.exec(r.text);if(null!==a&&a.length>1){var s="{".concat(a[1],"}");r.text=r.text.replace(s,null!==(e=S[s])&&void 0!==e?e:_.defaultValue),"{change}"===s&&(r.color=0===w?l.priceMark.last.noChangeColor:w>0?l.priceMark.last.upColor:l.priceMark.last.downColor)}return{title:o,value:r}}))},n}(ri),gi=function(e){function n(t,i){var n=e.call(this,t,i)||this;return n._candleBarView=new ii(n),n._candleAreaView=new li(n),n._candleHighLowPriceView=new ui(n),n._candleLastPriceLineView=new ci(n),n.addChild(n._candleBarView),n}return i(n,e),n.prototype.updateMainContent=function(e){this.getPane().getChart().getStyles().candle.type!==t.CandleType.Area?(this._candleBarView.draw(e),this._candleHighLowPriceView.draw(e),this._candleAreaView.stopAnimation()):this._candleAreaView.draw(e),this._candleLastPriceLineView.draw(e)},n.prototype.createTooltipView=function(){return new pi(this)},n}(si),vi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t,e){var i,n,o=this,r=this.getWidget(),a=r.getPane(),s=r.getBounding(),l=a.getAxisComponent(),u=this.getAxisStyles(a.getChart().getStyles());if(u.show&&(u.axisLine.show&&(null===(i=this.createFigure({name:"line",attrs:this.createAxisLine(s,u),styles:u.axisLine}))||void 0===i||i.draw(t)),!e[0])){var c=l.getTicks();if(u.tickLine.show)this.createTickLines(c,s,u).forEach((function(e){var i;null===(i=o.createFigure({name:"line",attrs:e,styles:u.tickLine}))||void 0===i||i.draw(t)}));if(u.tickText.show){var h=this.createTickTexts(c,s,u);null===(n=this.createFigure({name:"text",attrs:h,styles:u.tickText}))||void 0===n||n.draw(t)}}},e}($e),fi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.getAxisStyles=function(t){return t.yAxis},e.prototype.createAxisLine=function(t,e){var i=this.getWidget().getPane().getAxisComponent(),n=e.axisLine.size,o=0;return{coordinates:[{x:o=i.isFromZero()?0:t.width-n,y:0},{x:o,y:t.height}]}},e.prototype.createTickLines=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),o=i.axisLine,r=i.tickLine,a=0,s=0;return n.isFromZero()?(a=0,o.show&&(a+=o.size),s=a+r.length):(a=e.width,o.show&&(a-=o.size),s=a-r.length),t.map((function(t){return{coordinates:[{x:a,y:t.coord},{x:s,y:t.coord}]}}))},e.prototype.createTickTexts=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),o=i.axisLine,r=i.tickLine,a=i.tickText,s=0;n.isFromZero()?(s=a.marginStart,o.show&&(s+=o.size),r.show&&(s+=r.length)):(s=e.width-a.marginEnd,o.show&&(s-=o.size),r.show&&(s-=r.length));var l=this.getWidget().getPane().getAxisComponent().isFromZero()?"left":"right";return t.map((function(t){return{x:s,y:t.coord,text:t.text,align:l,baseline:"middle"}}))},e}(vi),yi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=n.getChart().getChartStore(),a=r.getStyles().candle.priceMark,s=a.last,l=s.text;if(a.show&&s.show&&l.show){var u=r.getPrecision(),h=n.getAxisComponent(),d=r.getDataList(),p=d[d.length-1];if(L(p)){var g=p.close,v=p.open,f=h.convertToNicePixel(g),y="";y=g>v?s.upColor:g<v?s.downColor:s.noChangeColor;var m=h.getRange(),_=h.displayValueToText(h.realValueToDisplayValue(h.valueToRealValue(g,{range:m}),{range:m}),u.price);_=r.getDecimalFold().format(r.getThousandsSeparator().format(_));var x=0,C="left";h.isFromZero()?(x=0,C="left"):(x=o.width,C="right"),null===(e=this.createFigure({name:"text",attrs:{x:x,y:f,text:_,align:C,baseline:"middle"},styles:c(c({},l),{backgroundColor:y})}))||void 0===e||e.draw(t)}}},e}($e),mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e=this,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=n.getChart().getChartStore(),a=r.getStyles().indicator,s=a.lastValueMark,l=s.text;if(s.show){var u=n.getAxisComponent(),h=u.getRange(),d=r.getDataList().length-1,p=r.getIndicatorsByPaneId(n.getId()),g=r.getCustomApi(),v=r.getDecimalFold(),f=r.getThousandsSeparator();p.forEach((function(i){var n,r,s=i.result,p=null!==(r=null!==(n=s[d])&&void 0!==n?n:s[d-1])&&void 0!==r?r:{};if(L(p)&&i.visible){var y=i.precision;it(i,d,a,(function(n,r){var a,s=p[n.key];if(R(s)){var d=u.convertToNicePixel(s),m=u.displayValueToText(u.realValueToDisplayValue(u.valueToRealValue(s,{range:h}),{range:h}),y);i.shouldFormatBigNumber&&(m=g.formatBigNumber(m)),m=v.format(f.format(m));var _=0,x="left";u.isFromZero()?(_=0,x="left"):(_=o.width,x="right"),null===(a=e.createFigure({name:"text",attrs:{x:_,y:d,text:m,align:x,baseline:"middle"},styles:c(c({},l),{backgroundColor:r.color})}))||void 0===a||a.draw(t)}}))}}))}},e}($e),_i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!1},e.prototype.drawDefaultFigures=function(t,e,i){this.drawFigures(t,e,this.getDefaultFigures(e,i))},e.prototype.getDefaultFigures=function(t,e){var i,n=this.getWidget(),o=n.getPane(),r=o.getChart().getChartStore(),a=r.getClickOverlayInfo(),s=[];if(t.needDefaultYAxisFigure&&t.id===(null===(i=a.overlay)||void 0===i?void 0:i.id)&&a.paneId===o.getId()){var l=o.getAxisComponent(),u=n.getBounding(),c=Number.MAX_SAFE_INTEGER,h=Number.MIN_SAFE_INTEGER,d=l.isFromZero(),p="left",g=0;d?(p="left",g=0):(p="right",g=u.width);var v=r.getDecimalFold(),f=r.getThousandsSeparator();e.forEach((function(e,i){var n=t.points[i];if(R(n.value)){c=Math.min(c,e.y),h=Math.max(h,e.y);var o=v.format(f.format(X(n.value,r.getPrecision().price)));s.push({type:"text",attrs:{x:g,y:e.y,text:o,align:p,baseline:"middle"},ignoreEvent:!0})}})),e.length>1&&s.unshift({type:"rect",attrs:{x:0,y:c,width:u.width,height:h-c},ignoreEvent:!0})}return s},e.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createYAxisFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},e}(ai),xi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),o=i.getBounding(),r=i.getPane().getChart().getChartStore(),a=r.getCrosshair(),s=r.getStyles().crosshair;if(W(a.paneId)&&this.compare(a,n.getId())&&s.show){var l=this.getDirectionStyles(s),u=l.text;if(l.show&&u.show){var c=n.getAxisComponent(),h=this.getText(a,r,c);t.font=J(u.size,u.weight,u.family),null===(e=this.createFigure({name:"text",attrs:this.getTextAttrs(h,t.measureText(h).width,a,o,c,u),styles:u}))||void 0===e||e.draw(t)}}},e.prototype.compare=function(t,e){return t.paneId===e},e.prototype.getDirectionStyles=function(t){return t.horizontal},e.prototype.getText=function(t,e,i){var n=i,o=i.convertFromPixel(t.y),r=0,a=!1;n.isInCandle()?r=e.getPrecision().price:e.getIndicatorsByPaneId(t.paneId).forEach((function(t){r=Math.max(t.precision,r),a||(a=t.shouldFormatBigNumber)}));var s=n.getRange(),l=n.displayValueToText(n.realValueToDisplayValue(n.valueToRealValue(o,{range:s}),{range:s}),r);return a&&(l=e.getCustomApi().formatBigNumber(l)),e.getDecimalFold().format(e.getThousandsSeparator().format(l))},e.prototype.getTextAttrs=function(t,e,i,n,o,r){var a=0,s="left";return o.isFromZero()?(a=0,s="left"):(a=n.width,s="right"),{x:a,y:i.y,text:t,align:s,baseline:"middle"}},e}($e),Ci=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._yAxisView=new fi(n),n._candleLastPriceLabelView=new yi(n),n._indicatorLastValueView=new mi(n),n._overlayYAxisView=new _i(n),n._crosshairHorizontalLabelView=new xi(n),n.getContainer().style.cursor="ns-resize",n.addChild(n._overlayYAxisView),n}return i(e,t),e.prototype.getName=function(){return Fe},e.prototype.updateMain=function(t){var e="minimize"===this.getPane().getOptions().state;this._yAxisView.draw(t,e),e||(this.getPane().getAxisComponent().isInCandle()&&this._candleLastPriceLabelView.draw(t),this._indicatorLastValueView.draw(t))},e.prototype.updateOverlay=function(t){"minimize"!==this.getPane().getOptions().state&&(this._overlayYAxisView.draw(t),this._crosshairHorizontalLabelView.draw(t))},e}(Oe),bi=function(e){function n(t,i){var n=e.call(this,t)||this;return n.reverse=!1,n.inside=!1,n.position=Qe.Right,n.gap={top:.2,bottom:.1},n.createRange=function(t){return t.defaultRange},n.minSpan=function(t){return Tt(-t)},n.valueToRealValue=function(t){return t},n.realValueToDisplayValue=function(t){return t},n.displayValueToRealValue=function(t){return t},n.realValueToValue=function(t){return t},n.displayValueToText=function(t,e){return X(t,e)},n.override(i),n}return i(n,e),n.prototype.override=function(t){var e=t.name,i=t.gap,n=h(t,["name","gap"]);W(this.name)||(this.name=e),M(this.gap,i),M(this,n)},n.prototype.createRangeImp=function(){var e=this.getParent(),i=e.getChart(),n=i.getChartStore(),o=e.getId(),r=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER,s=!1,l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,h=n.getIndicatorsByPaneId(o);h.forEach((function(t){s||(s=t.shouldOhlc),c=Math.min(c,t.precision),R(t.minValue)&&(l=Math.min(l,t.minValue)),R(t.maxValue)&&(u=Math.max(u,t.maxValue))}));var d=4,p=this.isInCandle();if(p){var g=n.getPrecision().price;d=c!==Number.MAX_SAFE_INTEGER?Math.min(c,g):g}else c!==Number.MAX_SAFE_INTEGER&&(d=c);var v=n.getVisibleRangeDataList(),f=i.getStyles().candle,y=f.type===t.CandleType.Area,m=f.area.value,_=p&&!y||!p&&s;v.forEach((function(t){var e=t.dataIndex,i=t.data;if(L(i)&&(_&&(r=Math.min(r,i.low),a=Math.max(a,i.high)),p&&y)){var n=i[m];R(n)&&(r=Math.min(r,n),a=Math.max(a,n))}h.forEach((function(t){var i,n=t.result,o=t.figures,s=null!==(i=n[e])&&void 0!==i?i:{};o.forEach((function(t){var e=s[t.key];R(e)&&(r=Math.min(r,e),a=Math.max(a,e))}))}))})),r!==Number.MAX_SAFE_INTEGER&&a!==Number.MIN_SAFE_INTEGER?(r=Math.min(l,r),a=Math.max(u,a)):(r=0,a=10);var x=a-r,C={from:r,to:a,range:x,realFrom:r,realTo:a,realRange:x,displayFrom:r,displayTo:a,displayRange:x},b=this.createRange({chart:i,paneId:o,defaultRange:C}),T=b.realFrom,w=b.realTo,S=b.realRange,P=this.minSpan(d);if(T===w||S<P){var E=l===T,I=u===w;T=E?T:I?T-8*P:T-4*P,w=I?w:E?w+8*P:w+4*P}var k=this.getBounding().height,M=this.gap,D=M.top;D>=1&&(D/=k);var A=M.bottom;A>=1&&(A/=k),T-=(S=w-T)*A,w+=S*D;var F=this.realValueToValue(T,{range:b}),B=this.realValueToValue(w,{range:b}),O=this.realValueToDisplayValue(T,{range:b}),W=this.realValueToDisplayValue(w,{range:b});return{from:F,to:B,range:B-F,realFrom:T,realTo:w,realRange:w-T,displayFrom:O,displayTo:W,displayRange:W-O}},n.prototype.isInCandle=function(){return this.getParent().getId()===Se},n.prototype.isFromZero=function(){return this.position===Qe.Left&&this.inside||this.position===Qe.Right&&!this.inside},n.prototype.createTicksImp=function(){var t,e,i=this,n=this.getRange(),o=n.displayFrom,r=n.displayTo,a=n.displayRange,s=[];if(a>=0){var l=function(t){var e=Math.floor(bt(t)),i=Tt(e),n=t/i;return+(t=(n<1.5?1:n<2.5?2:n<3.5?3:n<4.5?4:n<5.5?5:n<6.5?6:8)*i).toFixed(Math.abs(e))}(a/8),u=function(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var o=e.indexOf(".");return o<0?0:e.length-1-o}(l),c=xt(Math.ceil(o/l)*l,u),h=xt(Math.floor(r/l)*l,u),d=0,p=c;if(0!==l)for(;p<=h;){var g=p.toFixed(u);s[d]={text:g,coord:0,value:g},++d,p+=l}}var v=this.getParent(),f=null!==(e=null===(t=v.getYAxisWidget())||void 0===t?void 0:t.getBounding().height)&&void 0!==e?e:0,y=v.getChart().getChartStore(),m=[],_=y.getIndicatorsByPaneId(v.getId()),x=y.getStyles(),C=0,b=!1;this.isInCandle()?C=y.getPrecision().price:_.forEach((function(t){C=Math.max(C,t.precision),b||(b=t.shouldFormatBigNumber)}));var T=y.getCustomApi(),w=y.getThousandsSeparator(),S=y.getDecimalFold(),P=x.xAxis.tickText.size,E=NaN;return s.forEach((function(t){var e=t.value,o=i.displayValueToText(+e,C),r=i.convertToPixel(i.realValueToValue(i.displayValueToRealValue(+e,{range:n}),{range:n}));b&&(o=T.formatBigNumber(e)),o=S.format(w.format(o));var a=R(E);r>P&&r<f-P&&(a&&Math.abs(E-r)>2*P||!a)&&(m.push({text:o,coord:r,value:e}),E=r)})),F(this.createTicks)?this.createTicks({range:this.getRange(),bounding:this.getBounding(),defaultTicks:m}):m},n.prototype.getAutoSize=function(){var t=this.getParent(),e=t.getChart().getChartStore(),i=e.getStyles(),n=i.yAxis,o=n.size;if("auto"!==o)return o;var r=0;if(n.show&&(n.axisLine.show&&(r+=n.axisLine.size),n.tickLine.show&&(r+=n.tickLine.length),n.tickText.show)){var a=0;this.getTicks().forEach((function(t){a=Math.max(a,Q(t.text,n.tickText.size,n.tickText.weight,n.tickText.family))})),r+=n.tickText.marginStart+n.tickText.marginEnd+a}var s=i.crosshair,l=0;if(s.show&&s.horizontal.show&&s.horizontal.text.show){var u=e.getIndicatorsByPaneId(t.getId()),c=0,h=!1;u.forEach((function(t){c=Math.max(t.precision,c),h||(h=t.shouldFormatBigNumber)}));var d=2;if(this.isInCandle()){var p=e.getPrecision().price,g=i.indicator.lastValueMark;d=g.show&&g.text.show?Math.max(c,p):p}else d=c;var v=X(this.getRange().displayTo,d);h&&(v=e.getCustomApi().formatBigNumber(v)),v=e.getDecimalFold().format(v),l+=s.horizontal.text.paddingLeft+s.horizontal.text.paddingRight+2*s.horizontal.text.borderSize+Q(v,s.horizontal.text.size,s.horizontal.text.weight,s.horizontal.text.family)}return Math.max(r,l)},n.prototype.getBounding=function(){return this.getParent().getYAxisWidget().getBounding()},n.prototype.convertFromPixel=function(t){var e=this.getBounding().height,i=this.getRange(),n=i.realFrom,o=i.realRange,r=(this.reverse?t/e:1-t/e)*o+n;return this.realValueToValue(r,{range:i})},n.prototype.convertToPixel=function(t){var e,i,n=this.getRange(),o=this.valueToRealValue(t,{range:n}),r=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,a=(o-n.realFrom)/n.realRange;return this.reverse?Math.round(a*r):Math.round((1-a)*r)},n.prototype.convertToNicePixel=function(t){var e,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,o=this.convertToPixel(t);return Math.round(Math.max(.05*n,Math.min(o,.98*n)))},n.extend=function(t){var e=function(e){function n(i){return e.call(this,i,t)||this}return i(n,e),n}(n);return e},n}(hi),Ti={name:"percentage",minSpan:function(){return Math.pow(10,-2)},displayValueToText:function(t){return"".concat(X(t,2),"%")},valueToRealValue:function(t,e){var i=e.range;return(t-i.from)/i.range*i.realRange+i.realFrom},realValueToValue:function(t,e){var i=e.range;return(t-i.realFrom)/i.realRange*i.range+i.from},createRange:function(t){var e=t.chart,i=t.defaultRange,n=e.getDataList()[e.getVisibleRange().from];if(L(n)){var o=i.from,r=i.to,a=i.range,s=(i.from-n.close)/n.close*100,l=(i.to-n.close)/n.close*100,u=l-s;return{from:o,to:r,range:a,realFrom:s,realTo:l,realRange:u,displayFrom:s,displayTo:l,displayRange:u}}return i}},wi={name:"logarithm",minSpan:function(t){return.05*Tt(-t)},valueToRealValue:function(t){return t<0?-bt(Math.abs(t)):bt(t)},realValueToDisplayValue:function(t){return t<0?-Tt(Math.abs(t)):Tt(t)},displayValueToRealValue:function(t){return t<0?-bt(Math.abs(t)):bt(t)},realValueToValue:function(t){return t<0?-Tt(Math.abs(t)):Tt(t)},createRange:function(t){var e=t.defaultRange,i=e.from,n=e.to,o=e.range,r=i<0?-bt(Math.abs(i)):bt(i),a=n<0?-bt(Math.abs(n)):bt(n);return{from:i,to:n,range:o,realFrom:r,realTo:a,realRange:a-r,displayFrom:i,displayTo:n,displayRange:o}}},Si={normal:bi.extend({name:"normal"}),percentage:bi.extend(Ti),logarithm:bi.extend(wi)};var Pi=function(){function t(t,e,i,n){this._bounding=lt(),this._originalBounding=lt(),this._visible=!0,this._chart=i,this._id=n,this._init(t,e)}return t.prototype._init=function(t,e){this._rootContainer=t,this._container=mt("div",{width:"100%",margin:"0",padding:"0",position:"relative",overflow:"hidden",boxSizing:"border-box"}),null!==e?t.insertBefore(this._container,e):t.appendChild(this._container)},t.prototype.getContainer=function(){return this._container},t.prototype.setVisible=function(t){this._visible!==t&&(this._container.style.display=t?"block":"none",this._visible=t)},t.prototype.getVisible=function(){return this._visible},t.prototype.getId=function(){return this._id},t.prototype.getChart=function(){return this._chart},t.prototype.getBounding=function(){return this._bounding},t.prototype.setOriginalBounding=function(t){M(this._originalBounding,t)},t.prototype.getOriginalBounding=function(){return this._originalBounding},t.prototype.update=function(t){this._bounding.height!==this._container.clientHeight&&(this._container.style.height="".concat(this._bounding.height,"px")),this.updateImp(null!=t?t:3,this._container,this._bounding)},t.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},t}(),Ei=function(t){function e(e,i,n,o,r){var a=t.call(this,e,i,n,o)||this;a._yAxisWidget=null,a._options={id:"",minHeight:30,dragEnabled:!0,order:0,height:100,state:"normal",axis:{name:"normal",scrollZoomEnabled:!0}};var s=a.getContainer();return a._mainWidget=a.createMainWidget(s),a._yAxisWidget=a.createYAxisWidget(s),a.setOptions(r),a}return i(e,t),e.prototype.setOptions=function(t){var e,i,n,o,r,a=this.getId();if(a===Se||a===Ee){var s=null===(e=t.axis)||void 0===e?void 0:e.name;(!L(this._axis)||L(s)&&this._options.axis.name!==s)&&(this._axis=this.createAxisComponent(null!=s?s:"normal"))}else L(this._axis)||(this._axis=this.createAxisComponent("normal"));this._axis instanceof bi&&this._axis.setAutoCalcTickFlag(!0),M(this._options,t),this._axis.override(c(c({},this._options.axis),{name:null!==(n=null===(i=t.axis)||void 0===i?void 0:i.name)&&void 0!==n?n:"normal"}));var l=null,u="default";return this.getId()===Ee?(l=this.getMainWidget().getContainer(),u="ew-resize"):(l=this.getYAxisWidget().getContainer(),u="ns-resize"),null===(r=null===(o=t.axis)||void 0===o?void 0:o.scrollZoomEnabled)||void 0===r||r?l.style.cursor=u:l.style.cursor="default",this},e.prototype.getOptions=function(){return this._options},e.prototype.getAxisComponent=function(){return this._axis},e.prototype.setBounding=function(t,e,i,n){var o,r,a,s;M(this.getBounding(),t);var l={};L(t.height)&&(l.height=t.height),L(t.top)&&(l.top=t.top),this._mainWidget.setBounding(l);var u=L(e);(u&&this._mainWidget.setBounding(e),L(this._yAxisWidget))&&(this._yAxisWidget.setBounding(l),this._axis.position===Qe.Left?L(i)&&this._yAxisWidget.setBounding(c(c({},i),{left:0})):L(n)&&(this._yAxisWidget.setBounding(n),u&&this._yAxisWidget.setBounding({left:(null!==(o=e.left)&&void 0!==o?o:0)+(null!==(r=e.width)&&void 0!==r?r:0)+(null!==(a=e.right)&&void 0!==a?a:0)-(null!==(s=n.width)&&void 0!==s?s:0)})));return this},e.prototype.getMainWidget=function(){return this._mainWidget},e.prototype.getYAxisWidget=function(){return this._yAxisWidget},e.prototype.updateImp=function(t){var e;this._mainWidget.update(t),null===(e=this._yAxisWidget)||void 0===e||e.update(t)},e.prototype.destroy=function(){var e;t.prototype.destroy.call(this),this._mainWidget.destroy(),null===(e=this._yAxisWidget)||void 0===e||e.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),r=o.getContext("2d"),a=q(o);o.width=i*a,o.height=n*a,r.scale(a,a);var s=this._mainWidget.getBounding();if(r.drawImage(this._mainWidget.getImage(t),s.left,0,s.width,s.height),null!==this._yAxisWidget){var l=this._yAxisWidget.getBounding();r.drawImage(this._yAxisWidget.getImage(t),l.left,0,l.width,l.height)}return o},e.prototype.createYAxisWidget=function(t){return null},e}(Pi),Ii=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createAxisComponent=function(t){var e=function(t){var e;return null!==(e=Si[t])&&void 0!==e?e:Si.normal}(null!=t?t:"default");return new e(this)},e.prototype.createMainWidget=function(t){return new si(t,this)},e.prototype.createYAxisWidget=function(t){return new Ci(t,this)},e}(Ei),ki=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createMainWidget=function(t){return new gi(t,this)},e}(Ii),Mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.getAxisStyles=function(t){return t.xAxis},e.prototype.createAxisLine=function(t){return{coordinates:[{x:0,y:0},{x:t.width,y:0}]}},e.prototype.createTickLines=function(t,e,i){var n=i.tickLine,o=i.axisLine.size;return t.map((function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:o+n.length}]}}))},e.prototype.createTickTexts=function(t,e,i){var n=i.tickText,o=i.axisLine.size,r=i.tickLine.length;return t.map((function(t){return{x:t.coord,y:o+r+n.marginStart,text:t.text,align:"center",baseline:"top"}}))},e}(vi),Di=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},n.prototype.coordinateToPointValueFlag=function(){return!1},n.prototype.getCompleteOverlays=function(){return this.getWidget().getPane().getChart().getChartStore().getOverlaysByPaneId()},n.prototype.getProgressOverlay=function(){var t,e;return null!==(e=null===(t=this.getWidget().getPane().getChart().getChartStore().getProgressOverlayInfo())||void 0===t?void 0:t.overlay)&&void 0!==e?e:null},n.prototype.getDefaultFigures=function(e,i){var n,o=[],r=this.getWidget(),a=r.getPane().getChart().getChartStore(),s=a.getClickOverlayInfo();if(e.needDefaultXAxisFigure&&e.id===(null===(n=s.overlay)||void 0===n?void 0:n.id)){var l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;i.forEach((function(i,n){l=Math.min(l,i.x),u=Math.max(u,i.x);var r=e.points[n];if(R(r.timestamp)){var s=a.getCustomApi().formatDate(r.timestamp,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair);o.push({type:"text",attrs:{x:i.x,y:0,text:s,align:"center"},ignoreEvent:!0})}})),i.length>1&&o.unshift({type:"rect",attrs:{x:l,y:0,width:u-l,height:r.getBounding().height},ignoreEvent:!0})}return o},n.prototype.getFigures=function(t,e){var i,n,o=this.getWidget(),r=o.getPane(),a=r.getChart(),s=r.getAxisComponent(),l=a.getXAxisPane().getAxisComponent(),u=o.getBounding();return null!==(n=null===(i=t.createXAxisFigures)||void 0===i?void 0:i.call(t,{chart:a,overlay:t,coordinates:e,bounding:u,xAxis:l,yAxis:s}))&&void 0!==n?n:[]},n}(_i),Ai=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return i(n,e),n.prototype.compare=function(t){return L(t.timestamp)},n.prototype.getDirectionStyles=function(t){return t.vertical},n.prototype.getText=function(e,i){var n=e.timestamp;return i.getCustomApi().formatDate(n,"YYYY-MM-DD HH:mm",t.FormatDateType.Crosshair)},n.prototype.getTextAttrs=function(t,e,i,n,o,r){var a=i.realX,s=0,l="center";return a-e/2-r.paddingLeft<0?(s=0,l="left"):a+e/2+r.paddingRight>n.width?(s=n.width,l="right"):s=a,{x:s,y:0,text:t,align:l,baseline:"top"}},n}(xi),Fi=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._xAxisView=new Mi(n),n._overlayXAxisView=new Di(n),n._crosshairVerticalLabelView=new Ai(n),n.getContainer().style.cursor="ew-resize",n.addChild(n._overlayXAxisView),n}return i(e,t),e.prototype.getName=function(){return Ae},e.prototype.updateMain=function(t){this._xAxisView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayXAxisView.draw(t),this._crosshairVerticalLabelView.draw(t)},e}(Oe),Bi=function(e){function n(t,i){var n=e.call(this,t)||this;return n.override(i),n}return i(n,e),n.prototype.override=function(t){var e=t.name,i=t.scrollZoomEnabled,n=t.createTicks;W(this.name)||(this.name=e),this.scrollZoomEnabled=null!=i?i:this.scrollZoomEnabled,this.createTicks=null!=n?n:this.createTicks},n.prototype.createRangeImp=function(){var t=this.getParent().getChart().getChartStore().getVisibleRange(),e=t.realFrom,i=t.realTo,n=i-e+1;return{from:e,to:i,range:n,realFrom:e,realTo:i,realRange:n,displayFrom:e,displayTo:i,displayRange:n}},n.prototype.createTicksImp=function(){var e=this,i=this.getRange(),n=i.realFrom,o=i.realTo,r=this.getParent().getChart().getChartStore(),a=r.getCustomApi().formatDate,s=r.getTimeWeightTickList(),l=[],u=function(i,n){var r,s;try{for(var u=g(i),c=u.next();!c.done;c=u.next()){var h=c.value;if(h.dataIndex>=n&&h.dataIndex<o){var d=h.timestamp,p=h.weight,v=h.dataIndex,f="";switch(p){case Pt:f=a(d,"YYYY",t.FormatDateType.XAxis);break;case Et:f=a(d,"YYYY-MM",t.FormatDateType.XAxis);break;case It:f=a(d,"MM-DD",t.FormatDateType.XAxis);break;case kt:case Mt:f=a(d,"HH:mm",t.FormatDateType.XAxis);break;case Dt:f=a(d,"mm:ss",t.FormatDateType.XAxis);break;default:f=a(d,"YYYY-MM-DD HH:mm",t.FormatDateType.XAxis)}l.push({coord:e.convertToPixel(v),value:d,text:f})}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}};if(u(s,n),s.length>0){for(var c=r.getBarSpace().bar,h=r.getStyles().xAxis.tickText,d=Ft(c,h),p=s[s.length-1].dataIndex+d-1,v=[],f=p;f<o;f++){var y=r.dataIndexToTimestamp(f);R(y)&&v.push({timestamp:y})}if(v.length>0){var m=new Map;At(m,v,r.getDateTimeFormat(),p),u(Bt(m,c,h),p)}}return F(this.createTicks)?this.createTicks({range:this.getRange(),bounding:this.getBounding(),defaultTicks:l}):l},n.prototype.getAutoSize=function(){var t=this.getParent().getChart().getStyles(),e=t.xAxis,i=e.size;if("auto"!==i)return i;var n=t.crosshair,o=0;e.show&&(e.axisLine.show&&(o+=e.axisLine.size),e.tickLine.show&&(o+=e.tickLine.length),e.tickText.show&&(o+=e.tickText.marginStart+e.tickText.marginEnd+e.tickText.size));var r=0;return n.show&&n.vertical.show&&n.vertical.text.show&&(r+=n.vertical.text.paddingTop+n.vertical.text.paddingBottom+2*n.vertical.text.borderSize+n.vertical.text.size),Math.max(o,r)},n.prototype.getBounding=function(){return this.getParent().getMainWidget().getBounding()},n.prototype.convertTimestampFromPixel=function(t){var e=this.getParent().getChart().getChartStore(),i=e.coordinateToDataIndex(t);return e.dataIndexToTimestamp(i)},n.prototype.convertTimestampToPixel=function(t){var e=this.getParent().getChart().getChartStore(),i=e.timestampToDataIndex(t);return e.dataIndexToCoordinate(i)},n.prototype.convertFromPixel=function(t){return this.getParent().getChart().getChartStore().coordinateToDataIndex(t)},n.prototype.convertToPixel=function(t){return this.getParent().getChart().getChartStore().dataIndexToCoordinate(t)},n.extend=function(t){var e=function(e){function n(i){return e.call(this,i,t)||this}return i(n,e),n}(n);return e},n}(hi),Ri={normal:Bi.extend({name:"normal"})};var Li=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.createAxisComponent=function(t){var e=function(t){var e;return null!==(e=Ri[t])&&void 0!==e?e:Ri.normal}(t);return new e(this)},e.prototype.createMainWidget=function(t){return new Fi(t,this)},e}(Ei);var Oi=function(e){function n(t,i){var n,o,r,a=e.call(this,t,i)||this;return a._dragFlag=!1,a._dragStartY=0,a._topPaneHeight=0,a._bottomPaneHeight=0,a._topPane=null,a._bottomPane=null,a._pressedMouseMoveEvent=(n=a._pressedTouchMouseMoveEvent,o=20,r=0,function(){var t=Date.now();t-r>o&&(n.apply(this,arguments),r=t)}),a.registerEvent("touchStartEvent",a._mouseDownEvent.bind(a)).registerEvent("touchMoveEvent",a._pressedMouseMoveEvent.bind(a)).registerEvent("touchEndEvent",a._mouseUpEvent.bind(a)).registerEvent("mouseDownEvent",a._mouseDownEvent.bind(a)).registerEvent("mouseUpEvent",a._mouseUpEvent.bind(a)).registerEvent("pressedMouseMoveEvent",a._pressedMouseMoveEvent.bind(a)).registerEvent("mouseEnterEvent",a._mouseEnterEvent.bind(a)).registerEvent("mouseLeaveEvent",a._mouseLeaveEvent.bind(a)),a}return i(n,e),n.prototype.getName=function(){return Be},n.prototype.checkEventOn=function(){return!0},n.prototype._mouseDownEvent=function(t){var e=this;this._dragFlag=!0,this._dragStartY=t.pageY;var i=this.getPane(),n=i.getChart();this._topPane=i.getTopPane(),this._bottomPane=i.getBottomPane();var o=n.getDrawPanes();if("minimize"===this._topPane.getOptions().state)for(var r=o.findIndex((function(t){var i;return t.getId()===(null===(i=e._topPane)||void 0===i?void 0:i.getId())})),a=r-1;a>-1;a--){var s=o[a];if("minimize"!==s.getOptions().state){this._topPane=s;break}}if("minimize"===this._bottomPane.getOptions().state)for(r=o.findIndex((function(t){var i;return t.getId()===(null===(i=e._bottomPane)||void 0===i?void 0:i.getId())})),a=r+1;a<o.length;a++){var l=o[a];if("minimize"!==l.getOptions().state){this._bottomPane=l;break}}return this._topPaneHeight=this._topPane.getBounding().height,this._bottomPaneHeight=this._bottomPane.getBounding().height,!0},n.prototype._mouseUpEvent=function(){return this._dragFlag=!1,this._topPane=null,this._bottomPane=null,this._topPaneHeight=0,this._bottomPaneHeight=0,this._mouseLeaveEvent()},n.prototype._pressedTouchMouseMoveEvent=function(e){var i=e.pageY-this._dragStartY,n=i<0;if(L(this._topPane)&&L(this._bottomPane)){var o=this._bottomPane.getOptions();if("minimize"!==this._topPane.getOptions().state&&"minimize"!==o.state&&o.dragEnabled){var r=null,a=null,s=0,l=0;n?(r=this._topPane,a=this._bottomPane,s=this._topPaneHeight,l=this._bottomPaneHeight):(r=this._bottomPane,a=this._topPane,s=this._bottomPaneHeight,l=this._topPaneHeight);var u=r.getOptions().minHeight;if(s>u){var c=Math.max(s-Math.abs(i),u),h=s-c;r.setBounding({height:c}),a.setBounding({height:l+h});var d=this.getPane(),p=d.getChart();p.getChartStore().executeAction(t.ActionType.OnPaneDrag,{paneId:d.getId()}),p.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})}}}return!0},n.prototype._mouseEnterEvent=function(){var t=this.getPane();if(t.getBottomPane().getOptions().dragEnabled){var e=t.getChart().getStyles().separator;return this.getContainer().style.background=e.activeBackgroundColor,!0}return!1},n.prototype._mouseLeaveEvent=function(){return!this._dragFlag&&(this.getContainer().style.background="transparent",!0)},n.prototype.createContainer=function(){return mt("div",{width:"100%",height:"".concat(7,"px"),margin:"0",padding:"0",position:"absolute",top:"-3px",zIndex:"20",boxSizing:"border-box",cursor:"ns-resize"})},n.prototype.updateImp=function(t,e,i){if(4===i||2===i){var n=this.getPane().getChart().getStyles().separator;t.style.top="".concat(-Math.floor((7-n.size)/2),"px"),t.style.height="".concat(7,"px")}},n}(Le),Wi=function(t){function e(e,i,n,o,r,a){var s=t.call(this,e,i,n,o)||this;return s.getContainer().style.overflow="",s._topPane=r,s._bottomPane=a,s._separatorWidget=new Oi(s.getContainer(),s),s}return i(e,t),e.prototype.setBounding=function(t){return M(this.getBounding(),t),this},e.prototype.getTopPane=function(){return this._topPane},e.prototype.setTopPane=function(t){return this._topPane=t,this},e.prototype.getBottomPane=function(){return this._bottomPane},e.prototype.setBottomPane=function(t){return this._bottomPane=t,this},e.prototype.getWidget=function(){return this._separatorWidget},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,o=this.getChart().getStyles().separator,r=mt("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),s=q(r);return r.width=i*s,r.height=n*s,a.scale(s,s),a.fillStyle=o.color,a.fillRect(0,0,i,n),r},e.prototype.updateImp=function(t,e,i){if(4===t||2===t){var n=this.getChart().getStyles().separator;e.style.backgroundColor=n.color,e.style.height="".concat(i.height,"px"),e.style.marginLeft="".concat(i.left,"px"),e.style.width="".concat(i.width,"px"),this._separatorWidget.update(t)}},e}(Pi);function zi(){return"undefined"!=typeof window&&window.navigator.userAgent.toLowerCase().includes("firefox")}function Vi(){return"undefined"!=typeof window&&/iPhone|iPad|iPod|iOS/.test(window.navigator.userAgent)}var Ni,Yi=5,Hi=5,Xi=5,Gi=30,Ki=0,Ui=1,ji=2,Zi=function(){function t(t,e,i){var n=this;this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartCoordinate=null,this._touchMoveStartCoordinate=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeMouseWheel=null,this._unsubscribeContextMenu=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._startPinchMiddleCoordinate=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!Vi(),this._onFirefoxOutsideMouseUp=function(t){n._mouseUpHandler(t)},this._onMobileSafariDoubleClick=function(t){n._firesTouchEvents(t)?(++n._tapCount,null!==n._tapTimeoutId&&n._tapCount>1&&(n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._tapCoordinate).manhattanDistance<Gi&&!n._cancelTap&&n._processEvent(n._makeCompatEvent(t),n._handler.doubleTapEvent),n._resetTapTimeout())):(++n._clickCount,null!==n._clickTimeoutId&&n._clickCount>1&&(n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._clickCoordinate).manhattanDistance<Xi&&!n._cancelClick&&n._processEvent(n._makeCompatEvent(t),n._handler.mouseDoubleClickEvent),n._resetClickTimeout()))},this._target=t,this._handler=e,this._options=i,this._init()}return t.prototype.destroy=function(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeMouseWheel&&(this._unsubscribeMouseWheel(),this._unsubscribeMouseWheel=null),null!==this._unsubscribeContextMenu&&(this._unsubscribeContextMenu(),this._unsubscribeContextMenu=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()},t.prototype._mouseEnterHandler=function(t){var e,i,n,o=this;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this);var r=this._mouseMoveHandler.bind(this);this._unsubscribeMousemove=function(){o._target.removeEventListener("mousemove",r)},this._target.addEventListener("mousemove",r);var a=this._mouseWheelHandler.bind(this);this._unsubscribeMouseWheel=function(){o._target.removeEventListener("wheel",a)},this._target.addEventListener("wheel",a,{passive:!1});var s=this._contextMenuHandler.bind(this);this._unsubscribeContextMenu=function(){o._target.removeEventListener("contextmenu",s)},this._target.addEventListener("contextmenu",s,{passive:!1}),this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseEnterEvent),this._acceptMouseLeave=!0)},t.prototype._resetClickTimeout=function(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._resetTapTimeout=function(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._mouseMoveHandler=function(t){this._mousePressed||null!==this._touchMoveStartCoordinate||this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseMoveEvent),this._acceptMouseLeave=!0)},t.prototype._mouseWheelHandler=function(t){if(Math.abs(t.deltaX)>Math.abs(t.deltaY)){if(!L(this._handler.mouseWheelHortEvent))return;if(this._preventDefault(t),0===Math.abs(t.deltaX))return;this._handler.mouseWheelHortEvent(this._makeCompatEvent(t),-t.deltaX)}else{if(!L(this._handler.mouseWheelVertEvent))return;var e=-t.deltaY/100;if(0===e)return;switch(this._preventDefault(t),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._handler.mouseWheelVertEvent(this._makeCompatEvent(t),i)}}},t.prototype._contextMenuHandler=function(t){this._preventDefault(t)},t.prototype._touchMoveHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null!==e&&(this._lastTouchEventTimeStamp=this._eventTimeStamp(t),null===this._startPinchMiddleCoordinate&&!this._preventTouchDragProcess)){this._pinchPrevented=!0;var i=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._touchMoveStartCoordinate),n=i.xOffset,o=i.yOffset,r=i.manhattanDistance;if(this._touchMoveExceededManhattanDistance||!(r<Hi)){if(!this._touchMoveExceededManhattanDistance){var a=.5*n,s=o>=a&&!this._options.treatVertDragAsPageScroll(),l=a>o&&!this._options.treatHorzDragAsPageScroll();s||l||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}this._preventTouchDragProcess||this._processEvent(this._makeCompatEvent(t,e),this._handler.touchMoveEvent)}}},t.prototype._mouseMoveWithDownHandler=function(t){t.button===Ki&&(this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._mouseMoveStartCoordinate).manhattanDistance>=Yi&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick&&this._processEvent(this._makeCompatEvent(t),this._handler.pressedMouseMoveEvent))},t.prototype._mouseTouchMoveWithDownInfo=function(t,e){var i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return{xOffset:i,yOffset:n,manhattanDistance:i+n}},t.prototype._touchEndHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null===e&&0===t.touches.length&&(e=t.changedTouches[0]),null!==e){this._activeTouchId=null,this._lastTouchEventTimeStamp=this._eventTimeStamp(t),this._clearLongTapTimeout(),this._touchMoveStartCoordinate=null,null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var i=this._makeCompatEvent(t,e);if(this._processEvent(i,this._handler.touchEndEvent),++this._tapCount,null!==this._tapTimeoutId&&this._tapCount>1)this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._tapCoordinate).manhattanDistance<Gi&&!this._cancelTap&&this._processEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout();else this._cancelTap||(this._processEvent(i,this._handler.tapEvent),L(this._handler.tapEvent)&&this._preventDefault(t));0===this._tapCount&&this._preventDefault(t),0===t.touches.length&&this._longTapActive&&(this._longTapActive=!1,this._preventDefault(t))}},t.prototype._mouseUpHandler=function(t){if(t.button===Ki){var e=this._makeCompatEvent(t);if(this._mouseMoveStartCoordinate=null,this._mousePressed=!1,null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),zi())this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp);if(!this._firesTouchEvents(t))if(this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,null!==this._clickTimeoutId&&this._clickCount>1)this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._clickCoordinate).manhattanDistance<Xi&&!this._cancelClick&&this._processEvent(e,this._handler.mouseDoubleClickEvent),this._resetClickTimeout();else this._cancelClick||this._processEvent(e,this._handler.mouseClickEvent)}},t.prototype._clearLongTapTimeout=function(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)},t.prototype._touchStartHandler=function(t){if(null===this._activeTouchId){var e=t.changedTouches[0];this._activeTouchId=e.identifier,this._lastTouchEventTimeStamp=this._eventTimeStamp(t);var i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartCoordinate=this._getCoordinate(e),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var n=this._touchMoveHandler.bind(this),o=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=function(){i.removeEventListener("touchmove",n),i.removeEventListener("touchend",o)},i.addEventListener("touchmove",n,{passive:!1}),i.addEventListener("touchend",o,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),500),this._processEvent(this._makeCompatEvent(t,e),this._handler.touchStartEvent),null===this._tapTimeoutId&&(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapCoordinate=this._getCoordinate(e))}},t.prototype._mouseDownHandler=function(t){if(t.button===ji)return this._preventDefault(t),void this._processEvent(this._makeCompatEvent(t),this._handler.mouseRightClickEvent);if(t.button===Ki){var e=this._target.ownerDocument.documentElement;zi()&&e.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartCoordinate=this._getCoordinate(t),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);var i=this._mouseMoveWithDownHandler.bind(this),n=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=function(){e.removeEventListener("mousemove",i),e.removeEventListener("mouseup",n)},e.addEventListener("mousemove",i),e.addEventListener("mouseup",n),this._mousePressed=!0,this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseDownEvent),null===this._clickTimeoutId&&(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickCoordinate=this._getCoordinate(t)))}},t.prototype._init=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){null!=t._handler.mouseDownOutsideEvent&&(e.composed&&t._target.contains(e.composedPath()[0])||null!==e.target&&t._target.contains(e.target)||t._handler.mouseDownOutsideEvent({x:0,y:0,pageX:0,pageY:0}))};this._unsubscribeOutsideTouchEvents=function(){e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=function(){e.removeEventListener("mousedown",i)},e.addEventListener("mousedown",i),e.addEventListener("touchstart",i,{passive:!0}),Vi()&&(this._unsubscribeMobileSafariEvents=function(){t._target.removeEventListener("dblclick",t._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),this._target.addEventListener("mousedown",(function(t){if(t.button===Ui)return t.preventDefault(),!1})),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(function(){}),{passive:!1})},t.prototype._initPinch=function(){var t=this;(L(this._handler.pinchStartEvent)||L(this._handler.pinchEvent)||L(this._handler.pinchEndEvent))&&(this._target.addEventListener("touchstart",(function(e){t._checkPinchState(e.touches)}),{passive:!0}),this._target.addEventListener("touchmove",(function(e){if(2===e.touches.length&&null!==t._startPinchMiddleCoordinate&&L(t._handler.pinchEvent)){var i=t._getTouchDistance(e.touches[0],e.touches[1])/t._startPinchDistance;t._handler.pinchEvent(c(c({},t._startPinchMiddleCoordinate),{pageX:0,pageY:0}),i),t._preventDefault(e)}}),{passive:!1}),this._target.addEventListener("touchend",(function(e){t._checkPinchState(e.touches)})))},t.prototype._checkPinchState=function(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)},t.prototype._startPinch=function(t){var e=this._target.getBoundingClientRect();this._startPinchMiddleCoordinate={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=this._getTouchDistance(t[0],t[1]),L(this._handler.pinchStartEvent)&&this._handler.pinchStartEvent({x:0,y:0,pageX:0,pageY:0}),this._clearLongTapTimeout()},t.prototype._stopPinch=function(){null!==this._startPinchMiddleCoordinate&&(this._startPinchMiddleCoordinate=null,L(this._handler.pinchEndEvent)&&this._handler.pinchEndEvent({x:0,y:0,pageX:0,pageY:0}))},t.prototype._mouseLeaveHandler=function(t){var e,i,n;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this),this._firesTouchEvents(t)||this._acceptMouseLeave&&(this._processEvent(this._makeCompatEvent(t),this._handler.mouseLeaveEvent),this._acceptMouseLeave=!Vi())},t.prototype._longTapHandler=function(t){var e=this._touchWithId(t.touches,this._activeTouchId);null!==e&&(this._processEvent(this._makeCompatEvent(t,e),this._handler.longTapEvent),this._cancelTap=!0,this._longTapActive=!0)},t.prototype._firesTouchEvents=function(t){var e;return L(null===(e=t.sourceCapabilities)||void 0===e?void 0:e.firesTouchEvents)?t.sourceCapabilities.firesTouchEvents:this._eventTimeStamp(t)<this._lastTouchEventTimeStamp+500},t.prototype._processEvent=function(t,e){null==e||e.call(this._handler,t)},t.prototype._makeCompatEvent=function(t,e){var i=this,n=null!=e?e:t,o=this._target.getBoundingClientRect();return{x:n.clientX-o.left,y:n.clientY-o.top,pageX:n.pageX,pageY:n.pageY,isTouch:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type&&"wheel"!==t.type,preventDefault:function(){"touchstart"!==t.type&&i._preventDefault(t)}}},t.prototype._getTouchDistance=function(t,e){var i=t.clientX-e.clientX,n=t.clientY-e.clientY;return Math.sqrt(i*i+n*n)},t.prototype._preventDefault=function(t){t.cancelable&&t.preventDefault()},t.prototype._getCoordinate=function(t){return{x:t.pageX,y:t.pageY}},t.prototype._eventTimeStamp=function(t){var e;return null!==(e=t.timeStamp)&&void 0!==e?e:performance.now()},t.prototype._touchWithId=function(t,e){for(var i=0;i<t.length;++i)if(t[i].identifier===e)return t[i];return null},t}(),qi=function(){function t(t,e){var i=this;this._flingStartTime=(new Date).getTime(),this._flingScrollRequestId=null,this._startScrollCoordinate=null,this._touchCoordinate=null,this._touchCancelCrosshair=!1,this._touchZoomed=!1,this._pinchScale=1,this._mouseDownWidget=null,this._prevYAxisRange=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,this._mouseMoveTriggerWidgetInfo={pane:null,widget:null},this._boundKeyBoardDownEvent=function(t){if(t.shiftKey)switch(t.code){case"Equal":i._chart.getChartStore().zoom(.5);break;case"Minus":i._chart.getChartStore().zoom(-.5);break;case"ArrowLeft":(e=i._chart.getChartStore()).startScroll(),e.scroll(-3*e.getBarSpace().bar);break;case"ArrowRight":var e;(e=i._chart.getChartStore()).startScroll(),e.scroll(3*e.getBarSpace().bar)}},this._container=t,this._chart=e,this._event=new Zi(t,this,{treatVertDragAsPageScroll:function(){return!1},treatHorzDragAsPageScroll:function(){return!1}}),t.addEventListener("keydown",this._boundKeyBoardDownEvent)}return t.prototype.pinchStartEvent=function(){return this._touchZoomed=!0,this._pinchScale=1,!0},t.prototype.pinchEvent=function(t,e){var i=this._findWidgetByEvent(t),n=i.pane,o=i.widget;if((null==n?void 0:n.getId())!==Ee&&(null==o?void 0:o.getName())===De){var r=this._makeWidgetEvent(t,o),a=5*(e-this._pinchScale);return this._pinchScale=e,this._chart.getChartStore().zoom(a,{x:r.x,y:r.y}),!0}return!1},t.prototype.mouseWheelHortEvent=function(t,e){var i=this._chart.getChartStore();return i.startScroll(),i.scroll(e),!0},t.prototype.mouseWheelVertEvent=function(t,e){var i=this._findWidgetByEvent(t).widget,n=this._makeWidgetEvent(t,i);return(null==i?void 0:i.getName())===De&&(this._chart.getChartStore().zoom(e,{x:n.x,y:n.y}),!0)},t.prototype.mouseDownEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(this._mouseDownWidget=n,null!==n){var o=this._makeWidgetEvent(t,n);switch(n.getName()){case Be:return n.dispatchEvent("mouseDownEvent",o);case De:var r=i.getAxisComponent().getRange();return this._prevYAxisRange=c({},r),this._startScrollCoordinate={x:o.x,y:o.y},this._chart.getChartStore().startScroll(),n.dispatchEvent("mouseDownEvent",o);case Ae:return(a=n.dispatchEvent("mouseDownEvent",o))&&this._chart.updatePane(1),this._xAxisStartScaleCoordinate={x:o.x,y:o.y},this._xAxisStartScaleDistance=o.pageX,a;case Fe:var a;(a=n.dispatchEvent("mouseDownEvent",o))&&this._chart.updatePane(1);r=i.getAxisComponent().getRange();return this._prevYAxisRange=c({},r),this._yAxisStartScaleDistance=o.pageY,a}}return!1},t.prototype.mouseMoveEvent=function(t){var e,i,n,o=this._findWidgetByEvent(t),r=o.pane,a=o.widget,s=this._makeWidgetEvent(t,a);if((null===(e=this._mouseMoveTriggerWidgetInfo.pane)||void 0===e?void 0:e.getId())===(null==r?void 0:r.getId())&&(null===(i=this._mouseMoveTriggerWidgetInfo.widget)||void 0===i?void 0:i.getName())===(null==a?void 0:a.getName())||(null==a||a.dispatchEvent("mouseEnterEvent",s),null===(n=this._mouseMoveTriggerWidgetInfo.widget)||void 0===n||n.dispatchEvent("mouseLeaveEvent",s),this._mouseMoveTriggerWidgetInfo={pane:r,widget:a}),null!==a)switch(a.getName()){case De:var l=a.dispatchEvent("mouseMoveEvent",s),u=this._chart.getChartStore(),c={x:s.x,y:s.y,paneId:null==r?void 0:r.getId()};return l&&null!==u.getActiveTooltipIcon()&&(c=void 0,a.getContainer().style.cursor="pointer"),this._chart.getChartStore().setCrosshair(c),l;case Be:case Ae:case Fe:l=a.dispatchEvent("mouseMoveEvent",s);return this._chart.getChartStore().setCrosshair(),l}return!1},t.prototype.pressedMouseMoveEvent=function(t){var e,i,n;if(null!==this._mouseDownWidget&&this._mouseDownWidget.getName()===Be)return this._mouseDownWidget.dispatchEvent("pressedMouseMoveEvent",t);var o=this._findWidgetByEvent(t),r=o.pane,a=o.widget;if(null!==a&&(null===(e=this._mouseDownWidget)||void 0===e?void 0:e.getPane().getId())===(null==r?void 0:r.getId())&&(null===(i=this._mouseDownWidget)||void 0===i?void 0:i.getName())===a.getName()){var s=this._makeWidgetEvent(t,a);switch(a.getName()){case De:var l=a.getBounding();if(!(b=a.dispatchEvent("pressedMouseMoveEvent",s))&&null!==this._startScrollCoordinate){var u=r.getAxisComponent();if(null!==this._prevYAxisRange&&!u.getAutoCalcTickFlag()&&u.scrollZoomEnabled){var c=this._prevYAxisRange,h=c.from,d=c.to,p=h+(w=(T=c.range)*(x=(u.reverse?this._startScrollCoordinate.y-s.y:s.y-this._startScrollCoordinate.y)/l.height)),g=d+w,v=u.valueToRealValue(p,{range:this._prevYAxisRange}),f=u.valueToRealValue(g,{range:this._prevYAxisRange}),y=u.realValueToDisplayValue(v,{range:this._prevYAxisRange}),m=u.realValueToDisplayValue(f,{range:this._prevYAxisRange});u.setRange({from:p,to:g,range:g-p,realFrom:v,realTo:f,realRange:f-v,displayFrom:y,displayTo:m,displayRange:m-y})}var _=s.x-this._startScrollCoordinate.x;this._chart.getChartStore().scroll(_)}return this._chart.getChartStore().setCrosshair({x:s.x,y:s.y,paneId:null==r?void 0:r.getId()}),b;case Ae:if(b=a.dispatchEvent("pressedMouseMoveEvent",s))this._chart.updatePane(1);else if(r.getAxisComponent().scrollZoomEnabled){var x=this._xAxisStartScaleDistance/s.pageX;if(Number.isFinite(x)){var C=10*(x-this._xAxisScale);this._xAxisScale=x,this._chart.getChartStore().zoom(C,null!==(n=this._xAxisStartScaleCoordinate)&&void 0!==n?n:void 0)}}return b;case Fe:var b;if(b=a.dispatchEvent("pressedMouseMoveEvent",s))this._chart.updatePane(1);else{u=r.getAxisComponent();if(null!==this._prevYAxisRange&&u.scrollZoomEnabled){var T,w,S=this._prevYAxisRange,P=(h=S.from,d=S.to,(T=S.range)*(x=s.pageY/this._yAxisStartScaleDistance));p=h-(w=(P-T)/2),g=d+w,v=u.valueToRealValue(p,{range:this._prevYAxisRange}),f=u.valueToRealValue(g,{range:this._prevYAxisRange}),y=u.realValueToDisplayValue(v,{range:this._prevYAxisRange}),m=u.realValueToDisplayValue(f,{range:this._prevYAxisRange});u.setRange({from:p,to:g,range:P,realFrom:v,realTo:f,realRange:f-v,displayFrom:y,displayTo:m,displayRange:m-y}),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0})}}return b}}return!1},t.prototype.mouseUpEvent=function(t){var e=this._findWidgetByEvent(t).widget,i=!1;if(null!==e){var n=this._makeWidgetEvent(t,e);switch(e.getName()){case De:case Be:case Ae:case Fe:i=e.dispatchEvent("mouseUpEvent",n)}i&&this._chart.updatePane(1)}return this._mouseDownWidget=null,this._startScrollCoordinate=null,this._prevYAxisRange=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,i},t.prototype.mouseClickEvent=function(t){var e=this._findWidgetByEvent(t).widget;if(null!==e){var i=this._makeWidgetEvent(t,e);return e.dispatchEvent("mouseClickEvent",i)}return!1},t.prototype.mouseRightClickEvent=function(t){var e=this._findWidgetByEvent(t).widget,i=!1;if(null!==e){var n=this._makeWidgetEvent(t,e);switch(e.getName()){case De:case Ae:case Fe:i=e.dispatchEvent("mouseRightClickEvent",n)}i&&this._chart.updatePane(1)}return!1},t.prototype.mouseDoubleClickEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n)switch(n.getName()){case De:var o=this._makeWidgetEvent(t,n);return n.dispatchEvent("mouseDoubleClickEvent",o);case Fe:var r=i.getAxisComponent();if(!r.getAutoCalcTickFlag())return r.setAutoCalcTickFlag(!0),this._chart.layout({measureWidth:!0,update:!0,buildYAxisTick:!0}),!0}return!1},t.prototype.mouseLeaveEvent=function(){return this._chart.getChartStore().setCrosshair(),!0},t.prototype.touchStartEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n){var o=this._makeWidgetEvent(t,n);switch(n.getName()){case De:var r=this._chart.getChartStore();if(n.dispatchEvent("mouseDownEvent",o))return this._touchCancelCrosshair=!0,this._touchCoordinate=null,r.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._flingScrollRequestId&&(ht(this._flingScrollRequestId),this._flingScrollRequestId=null),this._flingStartTime=(new Date).getTime(),this._startScrollCoordinate={x:o.x,y:o.y},r.startScroll(),this._touchZoomed=!1,null!==this._touchCoordinate){var a=o.x-this._touchCoordinate.x,s=o.y-this._touchCoordinate.y;Math.sqrt(a*a+s*s)<10?(this._touchCoordinate={x:o.x,y:o.y},r.setCrosshair({x:o.x,y:o.y,paneId:null==i?void 0:i.getId()})):(this._touchCoordinate=null,this._touchCancelCrosshair=!0,r.setCrosshair())}return!0;case Ae:case Fe:var l=n.dispatchEvent("mouseDownEvent",o);return l&&this._chart.updatePane(1),l}}return!1},t.prototype.touchMoveEvent=function(t){var e,i,n,o=this._findWidgetByEvent(t),r=o.pane,a=o.widget;if(null!==a){var s=this._makeWidgetEvent(t,a),l=a.getName(),u=this._chart.getChartStore();switch(l){case De:if(a.dispatchEvent("pressedMouseMoveEvent",s))return null===(e=s.preventDefault)||void 0===e||e.call(s),u.setCrosshair(void 0,!0),this._chart.updatePane(1),!0;if(null!==this._touchCoordinate)null===(i=s.preventDefault)||void 0===i||i.call(s),u.setCrosshair({x:s.x,y:s.y,paneId:null==r?void 0:r.getId()});else if(null!==this._startScrollCoordinate&&Math.abs(this._startScrollCoordinate.x-s.x)>this._startScrollCoordinate.y-s.y){var c=s.x-this._startScrollCoordinate.x;u.scroll(c)}return!0;case Ae:case Fe:var h=a.dispatchEvent("pressedMouseMoveEvent",s);return h&&(null===(n=s.preventDefault)||void 0===n||n.call(s),this._chart.updatePane(1)),h}}return!1},t.prototype.touchEndEvent=function(t){var e=this,i=this._findWidgetByEvent(t).widget;if(null!==i){var n=this._makeWidgetEvent(t,i);switch(i.getName()){case De:if(i.dispatchEvent("mouseUpEvent",n),null!==this._startScrollCoordinate){var o=(new Date).getTime()-this._flingStartTime,r=(n.x-this._startScrollCoordinate.x)/(o>0?o:1)*20;if(o<200&&Math.abs(r)>0){var a=this._chart.getChartStore(),s=function(){e._flingScrollRequestId=ct((function(){a.startScroll(),a.scroll(r),r*=.975,Math.abs(r)<1?null!==e._flingScrollRequestId&&(ht(e._flingScrollRequestId),e._flingScrollRequestId=null):s()}))};s()}}return!0;case Ae:case Fe:i.dispatchEvent("mouseUpEvent",n)&&this._chart.updatePane(1)}}return!1},t.prototype.tapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget,o=!1;if(null!==n){var r=this._makeWidgetEvent(t,n),a=n.dispatchEvent("mouseClickEvent",r);if(n.getName()===De){var s=this._makeWidgetEvent(t,n),l=this._chart.getChartStore();a?(this._touchCancelCrosshair=!0,this._touchCoordinate=null,l.setCrosshair(void 0,!0),o=!0):(this._touchCancelCrosshair||this._touchZoomed||(this._touchCoordinate={x:s.x,y:s.y},l.setCrosshair({x:s.x,y:s.y,paneId:null==i?void 0:i.getId()},!0),o=!0),this._touchCancelCrosshair=!1)}(o||a)&&this._chart.updatePane(1)}return o},t.prototype.doubleTapEvent=function(t){return this.mouseDoubleClickEvent(t)},t.prototype.longTapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n&&n.getName()===De){var o=this._makeWidgetEvent(t,n);return this._touchCoordinate={x:o.x,y:o.y},this._chart.getChartStore().setCrosshair({x:o.x,y:o.y,paneId:null==i?void 0:i.getId()}),!0}return!1},t.prototype._findWidgetByEvent=function(t){var e,i,n,o,r=t.x,a=t.y,s=this._chart.getSeparatorPanes(),l=this._chart.getStyles().separator.size;try{for(var u=g(s),c=u.next();!c.done;c=u.next()){var h=v(c.value,2)[1],d=(_=h.getBounding()).top-Math.round((7-l)/2);if(r>=_.left&&r<=_.left+_.width&&a>=d&&a<=d+7)return{pane:h,widget:h.getWidget()}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}var p=this._chart.getDrawPanes(),f=null;try{for(var y=g(p),m=y.next();!m.done;m=y.next()){var _,x=m.value;if(r>=(_=x.getBounding()).left&&r<=_.left+_.width&&a>=_.top&&a<=_.top+_.height){f=x;break}}}catch(t){n={error:t}}finally{try{m&&!m.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}var C=null;if(null!==f){if(!L(C)){var b=f.getMainWidget(),T=b.getBounding();r>=T.left&&r<=T.left+T.width&&a>=T.top&&a<=T.top+T.height&&(C=b)}if(!L(C)){var w=f.getYAxisWidget();if(null!==w){var S=w.getBounding();r>=S.left&&r<=S.left+S.width&&a>=S.top&&a<=S.top+S.height&&(C=w)}}}return{pane:f,widget:C}},t.prototype._makeWidgetEvent=function(t,e){var i,n,o,r=null!==(i=null==e?void 0:e.getBounding())&&void 0!==i?i:null;return c(c({},t),{x:t.x-(null!==(n=null==r?void 0:r.left)&&void 0!==n?n:0),y:t.y-(null!==(o=null==r?void 0:r.top)&&void 0!==o?o:0)})},t.prototype.destroy=function(){this._container.removeEventListener("keydown",this._boundKeyBoardDownEvent),this._event.destroy()},t}();t.DomPosition=void 0,(Ni=t.DomPosition||(t.DomPosition={})).Root="root",Ni.Main="main",Ni.YAxis="yAxis";var Ji=function(){function e(t,e){this._chartBounding=lt(),this._drawPanes=[],this._separatorPanes=new Map,this._layoutOptions={measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!1,forceBuildYAxisTick:!1},this._layoutPending=!1,this._initContainer(t),this._chartEvent=new qi(this._chartContainer,this),this._chartStore=new Me(this,e),this._initPanes(e),this._layout()}return e.prototype._initContainer=function(t){this._container=t,this._chartContainer=mt("div",{position:"relative",width:"100%",height:"100%",outline:"none",borderStyle:"none",cursor:"crosshair",boxSizing:"border-box",userSelect:"none",webkitUserSelect:"none",overflow:"hidden",msUserSelect:"none",MozUserSelect:"none",webkitTapHighlightColor:"transparent"}),this._chartContainer.tabIndex=1,t.appendChild(this._chartContainer),this._cacheChartBounding()},e.prototype._cacheChartBounding=function(){this._chartBounding.width=Math.floor(this._chartContainer.clientWidth),this._chartBounding.height=Math.floor(this._chartContainer.clientHeight)},e.prototype._initPanes=function(t){var e,i=this,n=null!==(e=null==t?void 0:t.layout)&&void 0!==e?e:[{type:"candle"}],o=function(t){var e,n;if(!L(i._candlePane)){var o=null!==(e=t.options)&&void 0!==e?e:{};M(o,{id:Se}),i._candlePane=i._createPane(ki,Se,o),(null!==(n=t.content)&&void 0!==n?n:[]).forEach((function(t){i.createIndicator(t,!0,o)}))}},r=function(t){if(!L(i._xAxisPane)){var e=i._createPane(Li,Ee,null!=t?t:{});i._xAxisPane=e}};n.forEach((function(t){var e;switch(t.type){case"candle":o(t);break;case"indicator":var n=null!==(e=t.content)&&void 0!==e?e:[];if(n.length>0){var a=null;n.forEach((function(e){L(a)?i.createIndicator(e,!0,{id:a}):a=i.createIndicator(e,!0,t.options)}))}break;case"xAxis":r(t.options)}})),o({}),r({order:Number.MAX_SAFE_INTEGER})},e.prototype._createPane=function(t,e,i){var n,o,r,a=null,s=null,l=null!==(n=null==i?void 0:i.order)&&void 0!==n?n:0;if(this._drawPanes.length>0&&(l<this._drawPanes[0].getOptions().order&&(s=new t(this._chartContainer,this._drawPanes[0].getContainer(),this,e,null!=i?i:{}),a=0),!L(s)))for(var u=1;u<this._drawPanes.length;u++){var c=this._drawPanes[u-1],h=this._drawPanes[u];if(l>=c.getOptions().order&&l<h.getOptions().order){var d=null;d=h.getId()!==Ee?null!==(r=null===(o=this._separatorPanes.get(h))||void 0===o?void 0:o.getContainer())&&void 0!==r?r:null:h.getContainer(),s=new t(this._chartContainer,d,this,e,null!=i?i:{}),a=u;break}}L(s)||(s=new t(this._chartContainer,null,this,e,null!=i?i:{}));var p=0;if(R(a)?(this._drawPanes.splice(a,0,s),p=a):(this._drawPanes.push(s),p=this._drawPanes.length-1),s.getId()!==Ee){var g=this._drawPanes[p+1];if(L(g)&&g.getId()===Ee&&(g=this._drawPanes[p+2]),L(g))L(v=this._separatorPanes.get(g))?v.setTopPane(s):(v=new Wi(this._chartContainer,g.getContainer(),this,"",s,g),this._separatorPanes.set(g,v));if(L(c=this._drawPanes[p-1])&&c.getId()===Ee&&(c=this._drawPanes[p-2]),L(c)){var v=new Wi(this._chartContainer,s.getContainer(),this,"",c,s);this._separatorPanes.set(s,v)}}return s},e.prototype._recalculatePaneHeight=function(t,e,i){if(0===i)return!1;var n=this._drawPanes.filter((function(e){var i=e.getId();return"normal"===e.getOptions().state&&i!==t.getId()&&i!==Ee})),o=n.length;if(0===o)return!1;if(t.getId()!==Se&&L(this._candlePane)&&"normal"===this._candlePane.getOptions().state){var r=this._candlePane.getBounding().height;if(r>0){var a=this._candlePane.getOptions().minHeight,s=r+i;s<a&&(e-=r+i-(s=a)),this._candlePane.setBounding({height:s})}}else{var l=i,u=Math.floor(i/o);n.forEach((function(t,e){var i=t.getBounding().height,n=0;(n=e===o-1?i+l:i+u)<t.getOptions().minHeight&&(n=t.getOptions().minHeight),t.setBounding({height:n}),l-=n-i})),Math.abs(l)>0&&(e-=l)}return t.setBounding({height:e}),!0},e.prototype.getDrawPaneById=function(t){if(t===Se)return this._candlePane;if(t===Ee)return this._xAxisPane;var e=this._drawPanes.find((function(e){return e.getId()===t}));return null!=e?e:null},e.prototype.getContainer=function(){return this._container},e.prototype.getChartStore=function(){return this._chartStore},e.prototype.getXAxisPane=function(){return this._xAxisPane},e.prototype.getDrawPanes=function(){return this._drawPanes},e.prototype.getSeparatorPanes=function(){return this._separatorPanes},e.prototype.layout=function(t){var e,i,n,o,r,a=this;null!==(e=t.measureHeight)&&void 0!==e&&e&&(this._layoutOptions.measureHeight=t.measureHeight),null!==(i=t.measureWidth)&&void 0!==i&&i&&(this._layoutOptions.measureWidth=t.measureWidth),null!==(n=t.update)&&void 0!==n&&n&&(this._layoutOptions.update=t.update),null!==(o=t.buildYAxisTick)&&void 0!==o&&o&&(this._layoutOptions.buildYAxisTick=t.buildYAxisTick),null!==(r=t.buildYAxisTick)&&void 0!==r&&r&&(this._layoutOptions.forceBuildYAxisTick=t.forceBuildYAxisTick),this._layoutPending||(this._layoutPending=!0,Promise.resolve().then((function(t){a._layout(),a._layoutPending=!1})).catch((function(t){})))},e.prototype._layout=function(){var t=this,e=this._layoutOptions,i=e.measureHeight,n=e.measureWidth,o=e.update,r=e.buildYAxisTick,a=e.forceBuildYAxisTick;if(i){var s=this._chartBounding.height,l=this.getStyles().separator.size,u=this._xAxisPane.getAxisComponent().getAutoSize(),c=s-u;c<0&&(c=0),this._drawPanes.forEach((function(e){var i=e.getId();if(L(t._separatorPanes.get(e))&&(c-=l),i!==Ee&&i!==Se&&e.getVisible()){var n=e.getBounding().height;n>c?(n=c,c=0):c-=n,e.setBounding({height:n})}})),this._candlePane.setBounding({height:Math.max(c,0)}),this._xAxisPane.setBounding({height:u});var h=0;this._drawPanes.forEach((function(e){var i=t._separatorPanes.get(e);L(i)&&(i.setBounding({height:l,top:h}),h+=l),e.setBounding({top:h}),h+=e.getBounding().height}))}var d=n;if((r||a)&&this._drawPanes.forEach((function(t){var e=t.getAxisComponent().buildTicks(a);d||(d=e)})),d){var p=this._chartBounding.width,g=this.getStyles(),v=0,f=!0,y=0,m=!0;this._drawPanes.forEach((function(t){if(t.getId()!==Ee){var e=t.getAxisComponent(),i=e.inside,n=e.getAutoSize();e.position===Qe.Left?(v=Math.max(v,n),i&&(f=!1)):(y=Math.max(y,n),i&&(m=!1))}}));var _=p,x=0,C=0;f&&(_-=v,x=v),m&&(_-=y,C=y),this._chartStore.setTotalBarSpace(_);var b={width:p},T={width:_,left:x,right:C},w={width:v},S={width:y},P=g.separator.fill,E={};E=P?b:T,this._drawPanes.forEach((function(e){var i;null===(i=t._separatorPanes.get(e))||void 0===i||i.setBounding(E),e.setBounding(b,T,w,S)}))}o&&(this._xAxisPane.getAxisComponent().buildTicks(!0),this.updatePane(4)),this._layoutOptions={measureHeight:!1,measureWidth:!1,update:!1,buildYAxisTick:!1,forceBuildYAxisTick:!1}},e.prototype.updatePane=function(t,e){var i=this;if(L(e)){var n=this.getDrawPaneById(e);null==n||n.update(t)}else this._drawPanes.forEach((function(e){var n;e.update(t),null===(n=i._separatorPanes.get(e))||void 0===n||n.update(t)}))},e.prototype.crosshairChange=function(e){var i=this;if(this._chartStore.hasAction(t.ActionType.OnCrosshairChange)){var n={};this._drawPanes.forEach((function(t){var o=t.getId(),r={};i._chartStore.getIndicatorsByPaneId(o).forEach((function(t){var i,n=t.result;r[t.name]=n[null!==(i=e.dataIndex)&&void 0!==i?i:n.length-1]})),n[o]=r})),W(e.paneId)&&this._chartStore.executeAction(t.ActionType.OnCrosshairChange,c(c({},e),{indicatorData:n}))}},e.prototype.getDom=function(e,i){var n,o;if(!L(e))return this._chartContainer;var r=this.getDrawPaneById(e);if(L(r))switch(null!=i?i:t.DomPosition.Root){case t.DomPosition.Root:return r.getContainer();case t.DomPosition.Main:return r.getMainWidget().getContainer();case t.DomPosition.YAxis:return null!==(o=null===(n=r.getYAxisWidget())||void 0===n?void 0:n.getContainer())&&void 0!==o?o:null}return null},e.prototype.getSize=function(e,i){var n,o;if(!L(e))return this._chartBounding;var r=this.getDrawPaneById(e);if(L(r))switch(null!=i?i:t.DomPosition.Root){case t.DomPosition.Root:return r.getBounding();case t.DomPosition.Main:return r.getMainWidget().getBounding();case t.DomPosition.YAxis:return null!==(o=null===(n=r.getYAxisWidget())||void 0===n?void 0:n.getBounding())&&void 0!==o?o:null}return null},e.prototype.setPrecision=function(t){this._chartStore.setPrecision(t)},e.prototype.getPrecision=function(){return this._chartStore.getPrecision()},e.prototype.setStyles=function(t){var e=this;this._setOptions((function(){e._chartStore.setStyles(t)}))},e.prototype.getStyles=function(){return this._chartStore.getStyles()},e.prototype.setCustomApi=function(t){var e=this;this._setOptions((function(){e._chartStore.setCustomApi(t)}))},e.prototype.getCustomApi=function(){return this._chartStore.getCustomApi()},e.prototype.setLocale=function(t){var e=this;this._setOptions((function(){e._chartStore.setLocale(t)}))},e.prototype.getLocale=function(){return this._chartStore.getLocale()},e.prototype.setTimezone=function(t){var e=this;this._setOptions((function(){e._chartStore.setTimezone(t)}))},e.prototype.getTimezone=function(){return this._chartStore.getTimezone()},e.prototype.setThousandsSeparator=function(t){var e=this;this._setOptions((function(){e._chartStore.setThousandsSeparator(t)}))},e.prototype.getThousandsSeparator=function(){return this._chartStore.getThousandsSeparator()},e.prototype.setDecimalFold=function(t){var e=this;this._setOptions((function(){e._chartStore.setDecimalFold(t)}))},e.prototype.getDecimalFold=function(){return this._chartStore.getDecimalFold()},e.prototype._setOptions=function(t){t(),this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.setOffsetRightDistance=function(t){this._chartStore.setOffsetRightDistance(t,!0)},e.prototype.getOffsetRightDistance=function(){return this._chartStore.getOffsetRightDistance()},e.prototype.setMaxOffsetLeftDistance=function(t){t<0||this._chartStore.setMaxOffsetLeftDistance(t)},e.prototype.setMaxOffsetRightDistance=function(t){t<0||this._chartStore.setMaxOffsetRightDistance(t)},e.prototype.setLeftMinVisibleBarCount=function(t){t<0||this._chartStore.setLeftMinVisibleBarCount(Math.ceil(t))},e.prototype.setRightMinVisibleBarCount=function(t){t<0||this._chartStore.setRightMinVisibleBarCount(Math.ceil(t))},e.prototype.setBarSpace=function(t){this._chartStore.setBarSpace(t)},e.prototype.getBarSpace=function(){return this._chartStore.getBarSpace()},e.prototype.getVisibleRange=function(){return this._chartStore.getVisibleRange()},e.prototype.clearData=function(){this._chartStore.clearData()},e.prototype.getDataList=function(){return this._chartStore.getDataList()},e.prototype.applyNewData=function(t,e){this._drawPanes.forEach((function(t){t.getAxisComponent().setAutoCalcTickFlag(!0)}));var i={forward:!1,backward:!1};O(e)?(i.forward=e,i.backward=e):i=c(c({},i),e),this._chartStore.addData(t,pt.Init,i)},e.prototype.updateData=function(t){this._chartStore.addData(t,pt.Update)},e.prototype.setLoadMoreDataCallback=function(t){this._chartStore.setLoadMoreDataCallback(t)},e.prototype.createIndicator=function(t,e,i){var n,o=W(t)?{name:t}:t;if(null===ee(o.name))return null;var r=c({},i);W(r.id)||(r.id=yt(Pe));var a=this.getDrawPaneById(r.id);return L(a)||(a=this._createPane(Ii,r.id,r),null!==(n=r.height)&&void 0!==n||(r.height=100)),this.setPaneOptions(r),this._chartStore.addIndicator(o,r.id,null!=e&&e)&&this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0}),r.id},e.prototype.overrideIndicator=function(t,e){return this._chartStore.overrideIndicator(t,e)},e.prototype.getIndicators=function(t){return this._chartStore.getIndicatorsByFilter(null!=t?t:{})},e.prototype.removeIndicator=function(t){var e=this,i=this._chartStore.removeIndicator(null!=t?t:{});if(i){var n=!1,o=[];this._drawPanes.forEach((function(t){var e=t.getId();e!==Se&&e!==Ee&&o.push(e)})),o.forEach((function(t){var i,o,r;if(!e._chartStore.hasIndicators(t)){var a=e._drawPanes.findIndex((function(e){return e.getId()===t})),s=e._drawPanes[a];if(L(s)){n=!0;var l=e._separatorPanes.get(s);if(L(l)){var u=l.getTopPane();try{for(var c=g(e._separatorPanes),h=c.next();!h.done;h=c.next()){var d=h.value;if(d[1].getTopPane().getId()===t){d[1].setTopPane(u);break}}}catch(t){i={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}l.destroy(),e._separatorPanes.delete(s)}e._recalculatePaneHeight(s,0,s.getBounding().height),e._drawPanes.splice(a,1),s.destroy();var p=e._drawPanes[0];L(p)&&p.getId()===Ee&&(p=e._drawPanes[1]),null===(r=e._separatorPanes.get(p))||void 0===r||r.destroy(),e._separatorPanes.delete(p)}}})),2===this._drawPanes.length&&(this._candlePane.setVisible(!0),this._candlePane.setBounding({height:this._chartBounding.height-this._xAxisPane.getBounding().height})),this.layout({measureHeight:n,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})}return i},e.prototype.createOverlay=function(t){var e=this,i=[],n=[],o=function(t){L(t.paneId)&&null!==e.getDrawPaneById(t.paneId)?n.push(!0):(t.paneId=Se,n.push(!1)),i.push(t)};W(t)?o({name:t}):A(t)?t.forEach((function(t){var e=null;e=W(t)?{name:t}:t,o(e)})):o(t);var r=this._chartStore.addOverlays(i,n);return A(t)?r:r[0]},e.prototype.getOverlays=function(t){return this._chartStore.getOverlaysByFilter(null!=t?t:{})},e.prototype.overrideOverlay=function(t){return this._chartStore.overrideOverlay(t)},e.prototype.removeOverlay=function(t){return this._chartStore.removeOverlay(null!=t?t:{})},e.prototype.setPaneOptions=function(t){var e,i,n,o=this,r=!1,a=!1,s=L(t.id),l=function(e){var i=e.getId();if(s&&t.id===i||!s){if(i!==Ee){if(R(t.height)&&t.height>0){var l=Math.max(null!==(n=t.minHeight)&&void 0!==n?n:e.getOptions().minHeight,0),h=Math.max(l,t.height);a=!0,r=!0,e.setOriginalBounding({height:h}),u._recalculatePaneHeight(e,h,-h)}if(L(t.state)&&e.getOptions().state!==t.state){r=!0,a=!0;var d=t.state;switch(d){case"maximize":if(!L(u._drawPanes.find((function(t){var e=t.getId();return"maximize"===t.getOptions().state&&e!==Ee})))){"normal"===e.getOptions().state&&e.setOriginalBounding({height:e.getBounding().height}),e.setOptions({state:d});var p=u._chartBounding.height;e.setBounding({height:p-u._xAxisPane.getBounding().height}),u._drawPanes.forEach((function(t){var e;t.getId()!==Ee&&t.getId()!==i&&(t.setBounding({height:t.getOriginalBounding().height}),t.setVisible(!1),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!1))}))}break;case"minimize":h=e.getBounding().height;var g=e.getOptions().state,v=h-30;"maximize"===g&&(v=e.getOriginalBounding().height-30),u._recalculatePaneHeight(e,30,v)&&("normal"===g&&e.setOriginalBounding({height:h}),e.setOptions({state:d})),u._drawPanes.forEach((function(t){var e;t.getId()!==Ee&&(t.setVisible(!0),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!0))}));break;default:h=e.getOriginalBounding().height;u._recalculatePaneHeight(e,h,e.getBounding().height-h)&&e.setOptions({state:d}),u._drawPanes.forEach((function(t){var e;t.getId()!==Ee&&(t.setVisible(!0),null===(e=o._separatorPanes.get(t))||void 0===e||e.setVisible(!0))}))}}}L(t.axis)&&(a=!0);var f=c({},t);if(delete f.state,e.setOptions(f),i===t.id)return"break"}},u=this;try{for(var h=g(this._drawPanes),d=h.next();!d.done;d=h.next()){if("break"===l(d.value))break}}catch(t){e={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}a&&this.layout({measureHeight:r,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.getPaneOptions=function(t){var e;if(L(t)){var i=this.getDrawPaneById(t);return null!==(e=null==i?void 0:i.getOptions())&&void 0!==e?e:null}return this._drawPanes.map((function(t){return t.getOptions()}))},e.prototype.setZoomEnabled=function(t){this._chartStore.setZoomEnabled(t)},e.prototype.isZoomEnabled=function(){return this._chartStore.isZoomEnabled()},e.prototype.setScrollEnabled=function(t){this._chartStore.setScrollEnabled(t)},e.prototype.isScrollEnabled=function(){return this._chartStore.isScrollEnabled()},e.prototype.scrollByDistance=function(t,e){var i=this,n=R(e)&&e>0?e:0;if(this._chartStore.startScroll(),n>0){var o=new gt({duration:n});o.doFrame((function(e){var o=t*(e/n);i._chartStore.scroll(o)})),o.start()}else this._chartStore.scroll(t)},e.prototype.scrollToRealTime=function(t){var e=this._chartStore.getBarSpace().bar,i=(this._chartStore.getLastBarRightSideDiffBarCount()-this._chartStore.getInitialOffsetRightDistance()/e)*e;this.scrollByDistance(i,t)},e.prototype.scrollToDataIndex=function(t,e){var i=(this._chartStore.getLastBarRightSideDiffBarCount()+(this.getDataList().length-1-t))*this._chartStore.getBarSpace().bar;this.scrollByDistance(i,e)},e.prototype.scrollToTimestamp=function(t,e){var i=_t(this.getDataList(),"timestamp",t);this.scrollToDataIndex(i,e)},e.prototype.zoomAtCoordinate=function(t,e,i){var n=this,o=R(i)&&i>0?i:0,r=this._chartStore.getBarSpace().bar,a=r*t-r;if(o>0){var s=0,l=new gt({duration:o});l.doFrame((function(t){var i=a*(t/o),r=(i-s)/n._chartStore.getBarSpace().bar*10;n._chartStore.zoom(r,e),s=i})),l.start()}else this._chartStore.zoom(a/r*10,e)},e.prototype.zoomAtDataIndex=function(t,e,i){var n=this._chartStore.dataIndexToCoordinate(e);this.zoomAtCoordinate(t,{x:n,y:0},i)},e.prototype.zoomAtTimestamp=function(t,e,i){var n=_t(this.getDataList(),"timestamp",e);this.zoomAtDataIndex(t,n,i)},e.prototype.convertToPixel=function(t,e){var i,n=this,o=null!=e?e:{},r=o.paneId,a=void 0===r?Se:r,s=o.absolute,l=void 0!==s&&s,u=[];if(a!==Ee){var c=this.getDrawPaneById(a);if(null!==c){var h=c.getBounding(),d=[].concat(t),p=this._xAxisPane.getAxisComponent(),g=c.getAxisComponent();u=d.map((function(t){var e={},i=t.dataIndex;if(R(t.timestamp)&&(i=n._chartStore.timestampToDataIndex(t.timestamp)),R(i)&&(e.x=p.convertToPixel(i)),R(t.value)){var o=g.convertToPixel(t.value);e.y=l?h.top+o:o}return e}))}}return A(t)?u:null!==(i=u[0])&&void 0!==i?i:{}},e.prototype.convertFromPixel=function(t,e){var i,n=this,o=null!=e?e:{},r=o.paneId,a=void 0===r?Se:r,s=o.absolute,l=void 0!==s&&s,u=[];if(a!==Ee){var c=this.getDrawPaneById(a);if(null!==c){var h=c.getBounding(),d=[].concat(t),p=this._xAxisPane.getAxisComponent(),g=c.getAxisComponent();u=d.map((function(t){var e,i={};if(R(t.x)){var o=p.convertFromPixel(t.x);i.dataIndex=o,i.timestamp=null!==(e=n._chartStore.dataIndexToTimestamp(o))&&void 0!==e?e:void 0}if(R(t.y)){var r=l?t.y-h.top:t.y;i.value=g.convertFromPixel(r)}return i}))}}return A(t)?u:null!==(i=u[0])&&void 0!==i?i:{}},e.prototype.executeAction=function(e,i){var n;if(e===t.ActionType.OnCrosshairChange){var o=c({},i);null!==(n=o.paneId)&&void 0!==n||(o.paneId=Se),this._chartStore.setCrosshair(o)}},e.prototype.subscribeAction=function(t,e){this._chartStore.subscribeAction(t,e)},e.prototype.unsubscribeAction=function(t,e){this._chartStore.unsubscribeAction(t,e)},e.prototype.getConvertPictureUrl=function(t,e,i){var n=this,o=this._chartBounding,r=o.width,a=o.height,s=mt("canvas",{width:"".concat(r,"px"),height:"".concat(a,"px"),boxSizing:"border-box"}),l=s.getContext("2d"),u=q(s);s.width=r*u,s.height=a*u,l.scale(u,u),l.fillStyle=null!=i?i:"#FFFFFF",l.fillRect(0,0,r,a);var c=null!=t&&t;return this._drawPanes.forEach((function(t){var e=n._separatorPanes.get(t);if(L(e)){var i=e.getBounding();l.drawImage(e.getImage(c),i.left,i.top,i.width,i.height)}var o=t.getBounding();l.drawImage(t.getImage(c),0,o.top,r,o.height)})),s.toDataURL("image/".concat(null!=e?e:"jpeg"))},e.prototype.resize=function(){this._cacheChartBounding(),this.layout({measureHeight:!0,measureWidth:!0,update:!0,buildYAxisTick:!0,forceBuildYAxisTick:!0})},e.prototype.destroy=function(){var t=this;this._chartEvent.destroy(),this._drawPanes.forEach((function(e){var i;e.destroy(),null===(i=t._separatorPanes.get(e))||void 0===i||i.destroy()})),this._drawPanes=[],this._separatorPanes.clear(),this._container.removeChild(this._chartContainer)},e}(),Qi=new Map,$i=1;var tn={clone:D,merge:M,isString:W,isNumber:R,isValid:L,isObject:B,isArray:A,isFunction:F,isBoolean:O,formatValue:N,formatPrecision:X,formatBigNumber:G,formatDate:H,formatThousands:K,formatFoldDecimal:U,calcTextWidth:Q,getLinearSlopeIntercept:ue,getLinearYFromSlopeIntercept:se,getLinearYFromCoordinates:le,checkCoordinateOnArc:Ze,checkCoordinateOnCircle:ze,checkCoordinateOnLine:ae,checkCoordinateOnPolygon:Ne,checkCoordinateOnRect:He,checkCoordinateOnText:Ue};t.dispose=function(t){var e,i,n=null;if(t instanceof Ji)n=t.id;else{var o=null;n=null!==(e=null==(o=W(t)?document.getElementById(t):t)?void 0:o.getAttribute("k-line-chart-id"))&&void 0!==e?e:null}null!==n&&(null===(i=Qi.get(n))||void 0===i||i.destroy(),Qi.delete(n))},t.getFigureClass=function(t){var e;return null!==(e=Je[t])&&void 0!==e?e:null},t.getOverlayClass=function(t){var e;return null!==(e=Ce[t])&&void 0!==e?e:null},t.getSupportedFigures=function(){return Object.keys(Je)},t.getSupportedIndicators=function(){return Object.keys($t)},t.getSupportedLocales=function(){return Object.keys(di)},t.getSupportedOverlays=function(){return Object.keys(Ce)},t.init=function(t,e){var i=null;if(null===(i=W(t)?document.getElementById(t):t))return null;var n=Qi.get(i.id);if(L(n))return n;var o="k_line_chart_".concat($i++);return(n=new Ji(i,e)).id=o,i.setAttribute("k-line-chart-id",o),Qi.set(o,n),n},t.registerFigure=function(t){Je[t.name]=re.extend(t)},t.registerIndicator=function(t){$t[t.name]=ot.extend(t)},t.registerLocale=function(t,e){di[t]=c(c({},di[t]),e)},t.registerOverlay=function(t){Ce[t.name]=st.extend(t)},t.registerStyles=function(t,e){Te[t]=e},t.registerXAxis=function(t){Ri[t.name]=Bi.extend(t)},t.registerYAxis=function(t){Si[t.name]=bi.extend(t)},t.utils=tn,t.version=function(){return"10.0.0-alpha2"}}));