"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[76792],{196726:(t,e,i)=>{i.d(e,{preventDefault:()=>s,preventScrollByWheelClick:()=>a,wrapHandlerWithPreventEvent:()=>o});var n=i(638456);function s(t){t.cancelable&&t.preventDefault()}function o(t){return e=>{s(e),t()}}function a(t){n.isChrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),!1}))}},431912:(t,e,i)=>{i.d(e,{MouseEventHandler:()=>v,defaultPreventedHandler:()=>_,ignoreClickOrTapOnDblClickOrDblTapHandlers:()=>f,isTouchMouseEvent:()=>d});var n=i(895171),s=i(650151),o=i(638456),a=i(389137),r=i(196726),h=i(86121);let l=2;const u=o.isSafari?"click":"auxclick",c={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1,ignoreClickAndTapOnDblClickOrDblTap:!1};function d(t){return"isTouch"in t&&"stylus"in t}function _(t){return e=>{e.preventDefault(),t(e)}}function f(t){let e=!1;return{clickOrTap:i=>{e=!1,setTimeout((()=>!e&&t.clickOrTap(i)),501)},doubleClickOrDoubleTap:i=>{var n;e=!0,null===(n=t.doubleClickOrDoubleTap)||void 0===n||n.call(t,i)}}}class v{constructor(t,e,i){if(this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._touchMoveStartPosition=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._pinchInfo=null,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!o.CheckMobile.iOS(),this._onFirefoxOutsideMouseUp=t=>{this._mouseUpHandler(t)},this._onMobileSafariDoubleClick=t=>{if(this._firesTouchEvents(t)){const e=this._makeCompatEvent(t);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(g(t),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(e,this._handlers.doubleTapEvent),this._resetTapTimeout()}}else{const e=this._makeCompatEvent(t);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(g(t),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(e,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=t,this._options=(0,a.merge)((0,a.clone)(c),i||{}),this._options.ignoreClickAndTapOnDblClickOrDblTap){if(e.mouseClickEvent&&e.mouseDoubleClickEvent){const t=f({clickOrTap:e.mouseClickEvent.bind(e),doubleClickOrDoubleTap:e.mouseDoubleClickEvent.bind(e)});e.mouseClickEvent=t.clickOrTap,e.mouseDoubleClickEvent=t.doubleClickOrDoubleTap} if(e.tapEvent&&e.doubleTapEvent){const t=f({clickOrTap:e.tapEvent.bind(e),doubleClickOrDoubleTap:e.doubleTapEvent.bind(e)});e.tapEvent=t.clickOrTap,e.doubleTapEvent=t.doubleClickOrDoubleTap}}this._handlers=e,this._init()}destroy(){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._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()}_mouseEnterHandler(t){this._unsubscribeMousemove&&this._unsubscribeMousemove();const e=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",e)},this._target.addEventListener("mousemove",e),this._firesTouchEvents(t))return;const i=this._makeCompatEvent(t);this._processMouseEvent(i,this._handlers.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(t){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(t))return;const e=this._makeCompatEvent(t);this._processMouseEvent(e,this._handlers.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(t){const e=T(t.changedTouches,(0,s.ensureNotNull)(this._activeTouchId));if(null===e)return;if(this._lastTouchEventTimeStamp=m(t),null!==this._pinchInfo)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(g(e),(0,s.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:n,yOffset:o,manhattanDistance:a}=i;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){const t=.5*n,e=o>=t&&!this._options.treatVertTouchDragAsPageScroll,i=t>o&&!this._options.treatHorzTouchDragAsPageScroll;e||i||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(t,e);this._processTouchEvent(i,this._handlers.touchMoveEvent),(0,r.preventDefault)(t)}}}_mouseMoveWithDownHandler(t){if(0!==t.button)return;const e=this._touchMouseMoveWithDownInfo(g(t),(0, s.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=e;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const e=this._makeCompatEvent(t);this._processMouseEvent(e,this._handlers.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(t,e){const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return{xOffset:i,yOffset:n,manhattanDistance:i+n}}_touchEndHandler(t){let e=T(t.changedTouches,(0,s.ensureNotNull)(this._activeTouchId));if(null===e&&0===t.touches.length&&(e=t.changedTouches[0]),null===e)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=m(t),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(t,e);if(this._processTouchEvent(i,this._handlers.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:t}=this._touchMouseMoveWithDownInfo(g(e),this._tapPosition);t<30&&!this._cancelTap&&this._processTouchEvent(i,this._handlers.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(i,this._handlers.tapEvent),this._handlers.tapEvent&&(0,r.preventDefault)(t));0===this._tapCount&&(0,r.preventDefault)(t),0===t.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,r.preventDefault)(t))}_touchCancelHandler(t){this._touchEndHandler(t)}_mouseUpHandler(t){if(0!==t.button)return;const e=this._makeCompatEvent(t);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),o.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(t))if(this._processMouseEvent(e,this._handlers.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(g(t),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(e,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(e,this._handlers.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(t){if(null!==this._activeTouchId)return this._clearLongTapTimeout(),void this._resetTapTimeout();const e=t.changedTouches[0];this._activeTouchId=e.identifier,this._lastTouchEventTimeStamp=m(t);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=g(e),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const e=this._touchMoveHandler.bind(this),n=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",e),i.removeEventListener("touchend",n)},i.addEventListener("touchmove",e,{passive:!1}), i.addEventListener("touchend",n,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),240)}const n=this._makeCompatEvent(t,e);this._processTouchEvent(n,this._handlers.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=g(e))}_wheelClickHandler(t){if(1!==t.button)return;if(this._firesTouchEvents(t))return;const e=this._makeCompatEvent(t);this._processMouseEvent(e,this._handlers.wheelClickEvent)}_mouseDownHandler(t){if(0!==t.button)return;const e=this._target.ownerDocument.documentElement;o.isFF&&e.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=g(t),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const t=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{e.removeEventListener("mousemove",t),e.removeEventListener("mouseup",i)},e.addEventListener("mousemove",t),e.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(t))return;const i=this._makeCompatEvent(t);this._processMouseEvent(i,this._handlers.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=g(t))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._touchCancelHandler.bind(this));{const t=this._target.ownerDocument,e=t=>!t.target||!this._target.contains(t.target),i=t=>{if(!e(t))return;const i=t.changedTouches[0];this._lastTouchEventTimeStamp=m(t),this._processTouchEvent(this._makeCompatEvent(t,i),this._handlers.touchStartOutsideEvent)},n=t=>{e(t)&&!this._firesTouchEvents(t)&&this._processMouseEvent(this._makeCompatEvent(t),this._handlers.mouseDownOutsideEvent)};this._unsubscribeOutsideTouchEvents=()=>{t.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{t.removeEventListener("mousedown",n)},t.addEventListener("mousedown",n),t.addEventListener("touchstart",i,{passive:!0})}o.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("contextmenu",this._contextMenuHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),(0,r.preventScrollByWheelClick)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(u,this._wheelClickHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(()=>{}),{passive:!1})}_initPinch(){ void 0===this._handlers.pinchStartEvent&&void 0===this._handlers.pinchEvent&&void 0===this._handlers.pinchEndEvent||(this._target.addEventListener("touchstart",(t=>this._checkPinchState(t.touches)),{passive:!0}),this._target.addEventListener("touchmove",(t=>{if(null===this._pinchInfo)return;const e=T(t.touches,(0,s.ensureNotNull)(this._activeTouchId)),i=T(t.touches,this._pinchInfo.secondTouchId);if(e&&i&&void 0!==this._handlers.pinchEvent){const{startPinchDistance:n,startPinchMiddlePoint:s}=this._pinchInfo,o=b(e,i)/n,a=p(this._target);this._handlers.pinchEvent(s,{x:e.clientX-a.left,y:e.clientY-a.top},{x:i.clientX-a.left,y:i.clientY-a.top},o),(0,r.preventDefault)(t)}}),{passive:!1}),this._target.addEventListener("touchend",(t=>{this._checkPinchState(t.touches)})))}_checkPinchState(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)}_startPinch(t){if(void 0!==this._handlers.pinchStartEvent&&null===this._pinchInfo){const e=p(this._target);let i,n;t[0].identifier===this._activeTouchId?(i=t[0],n=t[1]):(i=t[1],n=t[0]);const s={x:i.clientX-e.left,y:i.clientY-e.top},o={x:n.clientX-e.left,y:n.clientY-e.top},a={x:(s.x+o.x)/2,y:(s.y+o.y)/2};this._handlers.pinchStartEvent(a,s,o,{bothPointsOnTargetElement:this._target.contains(n.target)})&&(this._pinchInfo={startPinchDistance:b(i,n),startPinchMiddlePoint:a,secondTouchId:n.identifier})}this._clearLongTapTimeout()}_stopPinch(){var t,e;null!==this._pinchInfo&&(this._pinchInfo=null,null===(e=(t=this._handlers).pinchEndEvent)||void 0===e||e.call(t))}_mouseLeaveHandler(t){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(t))return;if(!this._acceptMouseLeave)return;const e=this._makeCompatEvent(t);this._processMouseEvent(e,this._handlers.mouseLeaveEvent),this._acceptMouseLeave=!o.CheckMobile.iOS()}_longTapHandler(t){const e=T(t.touches,(0,s.ensureNotNull)(this._activeTouchId));if(null===e)return;const i=this._makeCompatEvent(t,e);this._processTouchEvent(i,this._handlers.longTapEvent),this._processTouchEvent(i,this._handlers.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(t){if((0,r.preventDefault)(t),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(t))return;const e=this._makeCompatEvent(t);this._processMouseEvent(e,this._handlers.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:m(t)0?l--:("mouseleave"!==t.srcType&&(0,h.setLastMouseOrTouchEventInfo)(t),e&&e.call(this._handlers,t))}_makeCompatEvent(t,e){const i=e||t,s=(0,n.default)((()=>this._target.getBoundingClientRect()||{left:0,top:0}));return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX, screenY:i.screenY,get localX(){return i.clientX-s().left},get localY(){return i.clientY-s().top},ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,isTouch:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,stylus:"stylus"===(null==e?void 0:e.touchType),srcType:t.type,target:i.target,view:t.view,preventDefault:()=>{"touchstart"!==t.type&&(0,r.preventDefault)(t)}}}}function p(t){return t.getBoundingClientRect()||{left:0,top:0}}function g(t){return{x:t.pageX,y:t.pageY}}function b(t,e){const i=t.clientX-e.clientX,n=t.clientY-e.clientY;return Math.sqrt(i*i+n*n)}function m(t){return t.timeStamp||performance.now()}function T(t,e){for(let i=0;i{i.d(e,{drawSelection:()=>o,getSymbolCoordinatesInfo:()=>s});var n=i(199471);function s(t,e,i,s,o){let a=0,r=0,l=0,u=0;for(let c=0;c{i.d(e,{TextRenderer:()=>S,calculateLabelPosition:()=>_,fontSize:()=>k,getTextBoundaries:()=>f,needTextExclusionPath:()=>v,wordWrap:()=>p});var n=i(86441),s=i(650151),o=i(934026),a=i(31341),r=i(315801),h=i(787123),l=i(253972),u=i(389137),c=i(199471),d=i(458963);function _(t,e,i,s,o){const a=.5*(e.x+i.x);let r=i.y;return e.y>i.y?(r-=t.height/2+s.y,r=Math.max(t.height/2,r)):(r+=t.height/2+s.y,r=Math.min(o-t.height/2,r)),new n.Point(a,r)}function f(t,e,i){if(t.isOutOfScreen(e,i))return null;const n=t.getPolygonPoints();return 0===n.length?null:n}function v(t){const e=t.getLinesInfo().lines;if(e.length%2==0)return!1;if(""===e[Math.floor(e.length/2)].trim())return!1;return!0}function p(t,e,i=!0,n){n=(0,u.isString)(n)?parseInt(n):n,t+="";const s=!(0,u.isNumber)(n)||!isFinite(n)||n<=0?t.split(/\r\n|\r|\n|$/):t.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/),o=t.charAt(t.length-1);if(!i&&("\n"===o||"\r"===o||"\r\n"===o)||s[s.length-1]||s.pop(),!(0,u.isNumber)(n)||!isFinite(n)||n<=0)return s;const a=[];for(let t=0;t0&&(0,c.measureText)(r.slice(0,3*--t-1).join(""),e).width>n;);if(t>0)a.push(r.slice(0,3*t-1).join("")),r.splice(0,3*t);else{const t=r[0]+(r[1]||"");if(h=1===h?1:~~(n/(0,c.measureText)(t,e).width*t.length),(0,c.measureText)(t.substring(0,h),e).width<=n)for(;(0,c.measureText)(t.substring(0,h+1),e).width<=n;)h++;else for(;h>1&&(0,c.measureText)(t.substring(0,--h),e).width>n;);h<1&&(h=1),a.push(t.substring(0,h)),r[0]=t.substring(h),r[1]=""}if((0,c.measureText)(r.join(""),e).width<=n){a.push(r.join(""));break}}}return a}function g(t,e,i){if(0===i)return t.clone();const s=(t.x-e.x)*Math.cos(i)-(t.y-e.y)*Math.sin(i)+e.x,o=(t.x-e.x)*Math.sin(i)+(t.y-e.y)*Math.cos(i)+e.y;return new n.Point(s,o)}function b(t,e){const i=Math.round(e+2*M(t)+2*x(t));return i%2?i+1:i}function m(t,e){return k(t)*e+P(t)*(e-1)+2*E(t)+2*T(t)}function T(t){return void 0!==t.boxPaddingVert?t.boxPaddingVert*w(t):void 0!==t.boxPadding?t.boxPadding*w(t):k(t)/3}function x(t){return void 0!==t.boxPaddingHorz?t.boxPaddingHorz*w(t):void 0!==t.boxPadding?t.boxPadding*w(t):k(t)/3}function E(t){return(t.backgroundVertInflate||0)*w(t)}function M(t){return(t.backgroundHorzInflate||0)*w(t)}function P(t){return(t.padding||0)*w(t)}function k(t){return Math.ceil(I(t)*w(t))}function I(t){return t.fontsize||t.fontSize||30}function w(t){const e=Math.min(1,Math.max(.2,Math.min(t.scaleX||1,t.scaleY||1)));if(1===e)return e;const i=I(t);return Math.ceil(e*i)/i}class S{constructor(t,e){this._data=null,this._internalData=null,this._boxSize=null,this._polygonPoints=null,this._linesInfo=null,this._fontInfo=null,this._hittest=e||new r.HitTestResult(r.HitTarget.MovePoint,{areaName:r.AreaName.Text}),void 0!==t&&this.setData(t)}data(){return this._data}setData(t){null!==t?(t.horzTextAlign||(t.horzTextAlign=t.horzAlign),!function(t,e){if(null===t||null===e)return null===t==(null===e);if(void 0===t.points!=(void 0===e.points))return!1;if(void 0!==t.points&&void 0!==e.points){if(t.points.length!==e.points.length)return!1;for(let s=0;st){const i=(0,n.box)(new n.Point(0,0),new n.Point(t,e));return this.getPolygonPoints().every((t=>!(0,o.pointInBox)(t,i)))}return!1}setPoints(t,e){(0,s.ensureNotNull)(this._data).points=t,this._hittest=e||new r.HitTestResult(r.HitTarget.MovePoint)}fontStyle(t){return null===this._data?"":this._getFontInfo().fontStyle}lineHeight(){return null===this._data?0:k(this._data)}lineSpacing(){return null===this._data?0:P(this._data)}wordWrap(t,e,i){return p(t,i||this.fontStyle(),!0,e)}draw(t,e){if(null===this._data||void 0===this._data.points||0===this._data.points.length)return;const{mediaSize:i,horizontalPixelRatio:s,verticalPixelRatio:o}=e;if(this.isOutOfScreen(i.width,i.height))return;const a=this._getInternalData(),r=this._getRotationPoint(),l=(0,n.point)(r.x*s,r.y*o);t.save(),t.translate(l.x,l.y),t.rotate(this._data.angle||0),t.translate(-l.x,-l.y);const u=this._getFontInfo().fontSize;t.textBaseline=a.textBaseLine,t.textAlign=a.textAlign,t.font=this.fontStyle();const{scaledLeft:_,scaledRight:f,scaledTop:v,scaledBottom:p}=function(t,e){const{horizontalPixelRatio:i,verticalPixelRatio:n}=e,s=Math.round(t.boxLeft*i),o=Math.round(t.boxTop*n);return{scaledLeft:s,scaledRight:s+Math.round(t.boxWidth*i),scaledTop:o,scaledBottom:o+Math.round(t.boxHeight*n)}}(a,e) ;if(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){const e=this._data.borderWidth||Math.max(u/12,1),i=Math.round(e*s),n=i/2;let o=!1;if(this._data.boxShadow){t.save();const{shadowColor:e,shadowBlur:i,shadowOffsetX:n=0,shadowOffsetY:s=0}=this._data.boxShadow;t.shadowColor=e,t.shadowBlur=i,t.shadowOffsetX=n,t.shadowOffsetY=s,o=!0}if(this._data.backgroundRoundRect)this._data.backgroundColor&&((0,h.drawRoundRect)(t,_,v,f-_,p-v,this._data.backgroundRoundRect*s),t.fillStyle=this._data.backgroundColor,t.fill(),o&&(t.restore(),o=!1)),this._data.borderColor&&((0,h.drawRoundRect)(t,_-n,v-n,f-_+i,p-v+i,this._data.backgroundRoundRect*s+i),t.strokeStyle=this._data.borderColor,t.lineWidth=i,t.stroke(),o&&(t.restore(),o=!1));else if(this._data.backgroundColor&&(t.fillStyle=this._data.backgroundColor,t.fillRect(_,v,f-_,p-v),o&&(t.restore(),o=!1)),this._data.borderColor||this._data.highlightBorder){let e;this._data.borderColor?(t.strokeStyle=this._data.borderColor,e=i):(t.strokeStyle=this._data.highlightBorderColor||this._data.color,(0,h.setLineStyle)(t,d.LINESTYLE_DASHED),e=Math.max(1,Math.floor(s))),t.lineWidth=e,t.beginPath(),t.moveTo(_-e/2,v-e/2),t.lineTo(_-e/2,p+e/2),t.lineTo(f+e/2,p+e/2),t.lineTo(f+e/2,v-e/2),t.lineTo(_-e/2,v-e/2),t.stroke(),o&&t.restore()}}this._drawSelectionIfNeeded(t,e),t.fillStyle=this._data.color;const g=(_+Math.round(a.textStart*s))/s,b=.05*u;let m=(v+Math.round((a.textTop+b)*o))/o;const T=P(this._data),x=this.getLinesInfo();for(const e of x.lines)(0,c.drawScaled)(t,s,o,(()=>t.fillText(e,g,m))),m+=u+T;t.restore()}getPolygonPoints(){if(null!==this._polygonPoints)return this._polygonPoints;if(null===this._data)return[];const t=this._data.angle||0,{boxLeft:e,boxTop:i,boxWidth:s,boxHeight:o}=this._getInternalData(),a=this._getRotationPoint();return this._polygonPoints=[g(new n.Point(e,i),a,t),g(new n.Point(e+s,i),a,t),g(new n.Point(e+s,i+o),a,t),g(new n.Point(e,i+o),a,t)],this._polygonPoints}getLinesInfo(){if(null===this._linesInfo){const t=(0,s.ensureNotNull)(this._data);let e=this.wordWrap(t.text,t.wordWrapWidth);if(void 0!==t.maxHeight){const i=function(t){const e=(0,s.ensureDefined)(t.maxHeight),i=k(t),n=P(t);return Math.floor((e+n)/(i+n))}(t);e.length>i&&(e=e.slice(0,i))}this._linesInfo={linesMaxWidth:this._getLinesMaxWidth(e),lines:e}}return this._linesInfo}positionToCoordinate(t){const e=(0,s.ensureNotNull)(this._data),i=this._getInternalData(),n=this.getLinesInfo(),o=E(e)+T(e),{x:a,y:r,lineNumber:h}=(0,l.getSymbolCoordinatesInfo)(t,n.lines,e.text,k(e),this.fontStyle());return{x:a+i.boxLeft+i.textStart,y:r+i.boxTop+o,lineNumber:h}}_getInternalData(){if(null!==this._internalData)return this._internalData;const t=(0,s.ensureNotNull)(this._data),e=this._getBoxSize(),i=e.boxWidth,n=e.boxHeight,o=(0,s.ensureDefined)(t.points)[0];let r=o.y;switch(t.vertAlign){case"bottom":r-=n+t.offsetY;break;case"middle":r-=n/2;break;case"top":r+=t.offsetY}let h=o.x;const l=x(t),u=T(t),c=M(t)+l;let d;const _=r+(E(t)+u)+k(t)/2;let f;switch(t.horzAlign){case"left": h+=t.offsetX;break;case"center":h-=i/2;break;case"right":h-=i+t.offsetX}switch((0,s.ensureDefined)(t.horzTextAlign)){case"left":f="start",d=h+c,(0,a.isRtl)()&&(t.forceTextAlign?f="left":(d=h+i-c,f="right"));break;case"center":f="center",d=h+i/2;break;case"right":f="end",d=h+i-c,(0,a.isRtl)()&&t.forceTextAlign&&(f="right")}return this._internalData={boxLeft:h,boxTop:r,boxWidth:i,boxHeight:n,textStart:d-h,textTop:_-r,textAlign:f,textBaseLine:"middle"},this._internalData}_getFontInfo(){if(null===this._fontInfo){const t=(0,s.ensureNotNull)(this._data),e=k(t),i=(t.bold?"bold ":"")+(t.italic?"italic ":"")+e+"px "+t.font;this._fontInfo={fontStyle:i,fontSize:e}}return this._fontInfo}_drawSelectionIfNeeded(t,e){const i=(0,s.ensureNotNull)(this._data),n=k((0,s.ensureNotNull)(this._data));if(i.selectionHighlight){const s=this.positionToCoordinate(i.selectionHighlight.start),o=this.positionToCoordinate(i.selectionHighlight.end),a=this._getInternalData();(0,l.drawSelection)(t,e,{lines:this.getLinesInfo().lines,text:i.text,leftTop:s,rightTop:o,firstLineStart:a.boxLeft+a.textStart,lastLineEnd:a.boxLeft+a.textStart,color:i.selectionHighlight.color,font:this.fontStyle(),lineHeight:n})}}_getLinesMaxWidth(t){const e=this.fontStyle();if(null!==this._data&&this._data.wordWrapWidth&&!this._data.forceCalculateMaxLineWidth)return this._data.wordWrapWidth*w(this._data);let i=0;for(const n of t)i=Math.max(i,(0,c.measureText)(n,e).width);return i}_getBoxSize(){if(null===this._boxSize){const t=this.getLinesInfo(),e=(0,s.ensureNotNull)(this._data);this._boxSize={boxWidth:b(e,t.linesMaxWidth),boxHeight:m(e,t.lines.length)}}return this._boxSize}_getRotationPoint(){const{boxLeft:t,boxTop:e,boxWidth:i,boxHeight:o}=this._getInternalData(),{horzAlign:a,vertAlign:r}=(0,s.ensureNotNull)(this._data);let h,l;switch(a){case"center":h=t+i/2;break;case"left":h=t;break;case"right":h=t+i}switch(r){case"middle":l=e+o/2;break;case"top":l=e;break;case"bottom":l=e+o}return new n.Point(h,l)}}},541801:(t,e,i)=>{i.d(e,{TrendLineRenderer:()=>_,drawArrow:()=>d});var n=i(650151),s=i(204652),o=i(855152),a=i(315801),r=i(787123),h=i(9640),l=i(199471),u=i(458963);function c(t,e,i,n,s){e.save(),e.fillStyle="#000000",e.beginPath(),e.arc(t.x*s,t.y*s,i*s,0,2*Math.PI,!1),e.fill(),n.strokeWidth&&(e.lineWidth=n.strokeWidth,e.stroke()),e.restore()}function d(t,e,i,n,s,o=!1){if(e.subtract(t).length()<1)return;const a=(0,h.getArrowPoints)(t,e,n,o,!0).slice(0,2);let r=null;const{horizontalPixelRatio:l,verticalPixelRatio:u}=s;for(let t=0;t1)&&i.moveTo(e.x*l,e.y*u),i.lineTo(n.x*l,n.y*u),r=n}}class _{constructor(){this._data=null,this._hittest=new a.HitTestResult(a.HitTarget.MovePoint)}setData(t){this._data=t}setHitTest(t){this._hittest=t}draw(t,e){const i=this._data;if(null===i)return;if("points"in i&&i.points.length<2)return;const{horizontalPixelRatio:n}=e;void 0!==i.excludeBoundaries&&(t.save(),(0,l.addExclusionArea)(t,e,i.excludeBoundaries));const{linestyle:s,lineCap:o=(s===u.LINESTYLE_SOLID?"round":"butt")}=i ;t.lineCap=o,t.lineJoin="round",t.strokeStyle=i.color,t.lineWidth=Math.max(1,Math.floor(i.linewidth*n)),(0,r.setLineStyle)(t,s);const a=i.points[0],h=i.points[1];let c=[];t.beginPath(),i.overlayLineEndings?c=[a.clone(),h.clone()]:this._drawEnds(t,[a,h],i.linewidth,e);const d=this._extendAndClipLineSegment(a,h,e);null!==d&&i.linewidth>0&&(0,r.addPixelPerfectLineToPath)(t,d[0].x,d[0].y,d[1].x,d[1].y,e),i.overlayLineEndings&&this._drawEnds(t,c,i.linewidth,e),t.stroke(),void 0!==i.excludeBoundaries&&t.restore()}hitTest(t,e){const i=this._data;if(null===i)return null;if("points"in i&&i.points.length<2)return null;const n=(0,h.interactionTolerance)().line,o=i.points[0],a=i.points[1],r=this._extendAndClipLineSegment(o,a,e);if(null!==r){if((0,s.distanceToSegment)(r[0],r[1],t).distance<=n)return this._hittest}return null}_extendAndClipLineSegment(t,e,i){const s=(0,n.ensureNotNull)(this._data);return(0,h.extendAndClipLineSegment)(t,e,i.mediaSize.width,i.mediaSize.height,s.extendleft,s.extendright)}_drawEnds(t,e,i,s){const a=e[0],r=e[1],h=(0,n.ensureNotNull)(this._data);switch(h.leftend){case o.LineEnd.Arrow:d(r,a,t,i,s);break;case o.LineEnd.Circle:c(a,t,i,(0,n.ensureDefined)(h.endstyle),s.horizontalPixelRatio)}switch(h.rightend){case o.LineEnd.Arrow:d(a,r,t,i,s);break;case o.LineEnd.Circle:c(r,t,i,(0,n.ensureDefined)(h.endstyle),s.horizontalPixelRatio)}}}},758363:(t,e,i)=>{i.d(e,{VerticalLineRenderer:()=>h});var n=i(315801),s=i(787123),o=i(9640),a=i(199471),r=i(43192);class h extends r.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._hitTest=new n.HitTestResult(n.HitTarget.MovePoint)}setData(t){this._data=t}setHitTest(t){this._hitTest=t}hitTest(t){if(null===this._data||null===this._hitTest)return null;const e=(0,o.interactionTolerance)().line,i=Math.abs(t.x-this._data.x)<=e+this._data.linewidth/2,n=void 0===this._data.top||this._data.top-t.y<=e,s=void 0===this._data.bottom||t.y-this._data.bottom<=e;return i&&n&&s?this._hitTest:null}_drawImpl(t){if(null===this._data||this._data.linewidth<=0)return;const{context:e,horizontalPixelRatio:i,verticalPixelRatio:n,mediaSize:o}=t;if(this._data.x<-this._data.linewidth/2||this._data.x>o.width+this._data.linewidth/2)return;e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=Math.max(1,Math.floor(this._data.linewidth*i)),void 0!==this._data.linestyle&&(0,s.setLineStyle)(e,this._data.linestyle);const r=void 0!==this._data.top?Math.max(this._data.top,0):0,h=void 0!==this._data.bottom?Math.min(this._data.bottom,o.height):o.height,l=Math.round(this._data.x*i),u=Math.floor(r*n),c=Math.ceil(h*n),d=this._data.excludeBoundaries;void 0!==d&&(0,a.addExclusionAreaByScope)(t,d),(0,s.drawVerticalLine)(e,l,u,c)}}},740086:(t,e,i)=>{i.d(e,{fromIndexedTo100:()=>l,fromLog:()=>_,fromPercent:()=>a,getCurrentModePriceText:()=>p,getOppositeModePriceText:()=>g,logFormulaForPriceRange:()=>f,logFormulasAreSame:()=>v,toIndexedTo100:()=>u,toIndexedTo100Range:()=>c,toLog:()=>d,toPercent:()=>r,toPercentRange:()=>h});var n=i(291784),s=i(678515);const o={logicalOffset:4, coordOffset:1e-4};function a(t,e){return e<0&&(t=-t),t/100*e+e}function r(t,e){const i=100*(t-e)/(e||1);return e<0?-i:i}function h(t,e){const i=r(t.minValue(),e),s=r(t.maxValue(),e);return new n.PriceRange(i,s)}function l(t,e){return e<0&&(t=-t),(t-=100)/100*e+e}function u(t,e){const i=100*(t-e)/e+100;return e<0?-i:i}function c(t,e){const i=u(t.minValue(),e),s=u(t.maxValue(),e);return new n.PriceRange(i,s)}function d(t,e){const i=Math.min(10**305-e.coordOffset,Math.abs(t));if(i<1e-25)return 0;const n=(0,s.log10)(i+e.coordOffset)+e.logicalOffset;return t<0?-n:n}function _(t,e){const i=Math.abs(t);if(i<1e-15)return 0;const n=Math.pow(10,Math.min(i-e.logicalOffset,305))-e.coordOffset;return t<0?-n:n}function f(t){if(null===t)return o;const e=Math.abs(t.maxValue()-t.minValue());if(e>=1||e<1e-15)return o;const i=Math.ceil(Math.abs(Math.log10(e))),n=o.logicalOffset+i;return{logicalOffset:n,coordOffset:1/Math.pow(10,n)}}function v(t,e){return t.logicalOffset===e.logicalOffset&&t.coordOffset===e.coordOffset}function p(t,e){return t.isPercentage()?e.formattedPricePercentage:t.isIndexedTo100()?e.formattedPriceIndexedTo100:e.formattedPriceAbsolute}function g(t,e){return t.isPercentage()||t.isIndexedTo100()?e.formattedPriceAbsolute:e.formattedPricePercentage}}}]);