lightweight-charts-react-components 0.4.0 → 0.4.1

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**!
3
- * lightweight-charts-react-components v0.4.0
3
+ * lightweight-charts-react-components v0.4.1
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE.md file in the root directory of this source tree.
@@ -9,5 +9,5 @@
9
9
  */
10
10
 
11
11
  /*! For license information please see lightweight-charts-react-components.standalone.js.LICENSE.txt */
12
- !function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("React")):"function"==typeof define&&define.amd?define(["React"],i):"object"==typeof exports?exports.LightweightChartsReactComponents=i(require("React")):t.LightweightChartsReactComponents=i(t.React)}(self,function(t){return function(){"use strict";var i={"../node_modules/react/cjs/react-jsx-runtime.production.js":function(t,i){var e=Symbol.for("react.transitional.element");Symbol.for("react.fragment");i.jsx=function(t,i,s){var h=null;if(void 0!==s&&(h=""+s),void 0!==i.key&&(h=""+i.key),"key"in i)for(var r in s={},i)"key"!==r&&(s[r]=i[r]);else s=i;return{$$typeof:e,type:t,key:h,ref:void 0!==(i=s.ref)?i:null,props:s}}},"../node_modules/react/jsx-runtime.js":function(t,i,e){t.exports=e("../node_modules/react/cjs/react-jsx-runtime.production.js")},react:function(i){i.exports=t}},e={};function s(t){var h=e[t];if(void 0!==h)return h.exports;var r=e[t]={exports:{}};return i[t](r,r.exports,s),r.exports}s.d=function(t,i){for(var e in i)s.o(i,e)&&!s.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:i[e]})},s.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var h={};return!function(){s.r(h),s.d(h,{CustomSeries:function(){return hL},Chart:function(){return he},BaselineSeries:function(){return hj},LineSeries:function(){return hk},PriceLine:function(){return hN},TimeScaleFitContentTrigger:function(){return hw},WatermarkImage:function(){return hZ},WatermarkText:function(){return hU},BarSeries:function(){return hT},CandlestickSeries:function(){return hY},HistogramSeries:function(){return hz},Markers:function(){return hW},SeriesPrimitive:function(){return hG},AreaSeries:function(){return hE},TimeScale:function(){return hm},PriceScale:function(){return hv}});var t,i,e,r,n,l,o,a,u,c,f,d,p,m,g,v,b,y,w,M,_=s("../node_modules/react/jsx-runtime.js"),S=s("react"),x=(0,S.createContext)(null);function O(t){var i=t.width,e=t.height;if(i<0)throw Error("Negative width is not allowed for Size");if(e<0)throw Error("Negative height is not allowed for Size");return{width:i,height:e}}function P(t,i){return t.width===i.width&&t.height===i.height}x.displayName="ChartContext";var C=function(){function t(t){var i=this;this._resolutionListener=function(){return i._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=t,this._installResolutionListener()}return t.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(t.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),t.prototype.subscribe=function(t){var i=this,e={next:t};return this._observers.push(e),{unsubscribe:function(){i._observers=i._observers.filter(function(t){return t!==e})}}},t.prototype._installResolutionListener=function(){if(null!==this._resolutionMediaQueryList)throw Error("Resolution listener is already installed");var t=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(t,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){null!==this._resolutionMediaQueryList&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){var t=this;this._observers.forEach(function(i){return i.next(t._window.devicePixelRatio)}),this._reinstallResolutionListener()},t}(),R=function(){function t(t,i,e){var s;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=t,this._canvasElementClientSize=O({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=null!=i?i:function(t){return t},this._allowResizeObserver=null===(s=null==e?void 0:e.allowResizeObserver)||void 0===s||s,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var t,i;if(null===this._canvasElement)throw Error("Object is disposed");null===(t=this._canvasElementResizeObserver)||void 0===t||t.disconnect(),this._canvasElementResizeObserver=null,null===(i=this._devicePixelRatioObservable)||void 0===i||i.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(null===this._canvasElement)throw Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return O({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(t){this._canvasElementClientSize=O(t),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(i){return i!==t})},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(i){return i!==t})},t.prototype.applySuggestedBitmapSize=function(){if(null!==this._suggestedBitmapSize){var t=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(t),this._emitSuggestedBitmapSizeChanged(t,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(t){var i=this.bitmapSize;P(i,t)||(this.canvasElement.width=t.width,this.canvasElement.height=t.height,this._emitBitmapSizeChanged(i,t))},t.prototype._emitBitmapSizeChanged=function(t,i){var e=this;this._bitmapSizeChangedListeners.forEach(function(s){return s.call(e,t,i)})},t.prototype._suggestNewBitmapSize=function(t){var i=this._suggestedBitmapSize,e=O(this._transformBitmapSize(t,this._canvasElementClientSize)),s=P(this.bitmapSize,e)?null:e;(null!==i||null!==s)&&(null!==i&&null!==s&&P(i,s)||(this._suggestedBitmapSize=s,this._emitSuggestedBitmapSizeChanged(i,s)))},t.prototype._emitSuggestedBitmapSizeChanged=function(t,i){var e=this;this._suggestedBitmapSizeChangedListeners.forEach(function(s){return s.call(e,t,i)})},t.prototype._chooseAndInitObserver=function(){var t=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}new Promise(function(t){var i=new ResizeObserver(function(e){t(e.every(function(t){return"devicePixelContentBoxSize"in t})),i.disconnect()});i.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1}).then(function(i){return i?t._initResizeObserver():t._initDevicePixelRatioObservable()})},t.prototype._initDevicePixelRatioObservable=function(){var t=this;if(null!==this._canvasElement){var i=k(this._canvasElement);if(null===i)throw Error("No window is associated with the canvas");this._devicePixelRatioObservable=new C(i),this._devicePixelRatioObservable.subscribe(function(){return t._invalidateBitmapSize()}),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){if(null!==this._canvasElement){var t,i,e=k(this._canvasElement);if(null!==e){var s,h,r=null!==(i=null===(t=this._devicePixelRatioObservable)||void 0===t?void 0:t.value)&&void 0!==i?i:e.devicePixelRatio,n=this._canvasElement.getClientRects(),l=void 0!==n[0]?(s=n[0],h=r,O({width:Math.round(s.left*h+s.width*h)-Math.round(s.left*h),height:Math.round(s.top*h+s.height*h)-Math.round(s.top*h)})):O({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(l)}}},t.prototype._initResizeObserver=function(){var t=this;null!==this._canvasElement&&(this._canvasElementResizeObserver=new ResizeObserver(function(i){var e=i.find(function(i){return i.target===t._canvasElement});if(e&&e.devicePixelContentBoxSize&&e.devicePixelContentBoxSize[0]){var s=e.devicePixelContentBoxSize[0],h=O({width:s.inlineSize,height:s.blockSize});t._suggestNewBitmapSize(h)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function k(t){return t.ownerDocument.defaultView}var z=function(){function t(t,i,e){if(0===i.width||0===i.height)throw TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=i,0===e.width||0===e.height)throw TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=e,this._context=t}return t.prototype.useMediaCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),t({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),t({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t}();function Y(t,i){var e=t.canvasElementClientSize;if(0===e.width||0===e.height)return null;var s=t.bitmapSize;if(0===s.width||0===s.height)return null;var h=t.canvasElement.getContext("2d",i);return null===h?null:new z(h,e,s)}let E={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};function j(t,i){let e={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[i];t.setLineDash(e)}function T(t,i,e,s){t.beginPath();let h=t.lineWidth%2?.5:0;t.moveTo(e,i+h),t.lineTo(s,i+h),t.stroke()}function L(t,i){if(!t)throw Error("Assertion failed"+(i?": "+i:""))}function V(t){if(void 0===t)throw Error("Value is undefined");return t}function N(t){if(null===t)throw Error("Value is null");return t}function D(t){return N(V(t))}(t=f||(f={}))[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved",(i=d||(d={}))[i.Solid=0]="Solid",i[i.Dotted=1]="Dotted",i[i.Dashed=2]="Dashed",i[i.LargeDashed=3]="LargeDashed",i[i.SparseDotted=4]="SparseDotted";class B{constructor(){this.t=[]}i(t,i,e){this.t.push({h:t,l:i,o:!0===e})}_(t){let i=this.t.findIndex(i=>t===i.h);i>-1&&this.t.splice(i,1)}u(t){this.t=this.t.filter(i=>i.l!==t)}p(t,i,e){let s=[...this.t];this.t=this.t.filter(t=>!t.o),s.forEach(s=>s.h(t,i,e))}v(){return this.t.length>0}m(){this.t=[]}}function W(t,...i){for(let e of i)for(let i in e)void 0!==e[i]&&Object.prototype.hasOwnProperty.call(e,i)&&!["__proto__","constructor","prototype"].includes(i)&&("object"!=typeof e[i]||void 0===t[i]||Array.isArray(e[i])?t[i]=e[i]:W(t[i],e[i]));return t}function F(t){return"number"==typeof t&&isFinite(t)}function A(t){return"number"==typeof t&&t%1==0}function I(t){return"string"==typeof t}function Q(t){return"boolean"==typeof t}function J(t){let i,e,s;if(!t||"object"!=typeof t)return t;for(e in i=Array.isArray(t)?[]:{},t)t.hasOwnProperty(e)&&(s=t[e],i[e]=s&&"object"==typeof s?J(s):s);return i}function $(t){return null!==t}function U(t){return null===t?void 0:t}let Z="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function H(t,i,e){return void 0===i&&(i=Z),`${e=void 0!==e?`${e} `:""}${t}px ${i}`}class G{constructor(t){this.M={S:1,C:5,P:NaN,k:"",T:"",R:"",D:"",V:0,I:0,B:0,A:0,L:0},this.O=t}N(){let t=this.M,i=this.W(),e=this.F();return t.P===i&&t.T===e||(t.P=i,t.T=e,t.k=H(i,e),t.A=2.5/12*i,t.V=t.A,t.I=i/12*t.C,t.B=i/12*t.C,t.L=0),t.R=this.H(),t.D=this.U(),this.M}H(){return this.O.N().layout.textColor}U(){return this.O.$()}W(){return this.O.N().layout.fontSize}F(){return this.O.N().layout.fontFamily}}function K(t){return t<0?0:t>255?255:Math.round(t)||0}function X(t){return .199*t[0]+.687*t[1]+.114*t[2]}class q{constructor(t,i){this.q=new Map,this.Y=t,i&&(this.q=i)}j(t,i){if("transparent"===t)return t;let e=this.Z(t),s=e[3];return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${i*s})`}K(t){let i=this.Z(t);return{X:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,G:X(i)>160?"black":"white"}}J(t){return X(this.Z(t))}tt(t,i,e){var s;let[h,r,n,l]=this.Z(t),[o,a,u,c]=this.Z(i),f=[K(h+e*(o-h)),K(r+e*(a-r)),K(n+e*(u-n)),(s=l+e*(c-l))<=0||s>1?Math.min(Math.max(s,0),1):Math.round(1e4*s)/1e4];return`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${f[3]})`}Z(t){let i=this.q.get(t);if(i)return i;let e=(function(t){let i=document.createElement("div");i.style.display="none",document.body.appendChild(i),i.style.color=t;let e=window.getComputedStyle(i).color;return document.body.removeChild(i),e})(t).match(/^rgba?\s*\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d+))?\)$/);if(!e){if(this.Y.length)for(let i of this.Y){let e=i(t);if(e)return this.q.set(t,e),e}throw Error(`Failed to parse color: ${t}`)}let s=[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10),e[4]?parseFloat(e[4]):1];return this.q.set(t,s),s}}class tt{constructor(){this.it=[]}st(t){this.it=t}nt(t,i,e){this.it.forEach(s=>{s.nt(t,i,e)})}}class ti{nt(t,i,e){t.useBitmapCoordinateSpace(t=>this.et(t,i,e))}}class te extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.rt||null===this.rt.lt)return;let s=this.rt.lt,h=this.rt,r=Math.max(1,Math.floor(i))%2/2,n=n=>{t.beginPath();for(let l=s.to-1;l>=s.from;--l){let s=h.ot[l],o=Math.round(s._t*i)+r,a=s.ut*e,u=n*e+r;t.moveTo(o,a),t.arc(o,a,u,0,2*Math.PI)}t.fill()};h.ct>0&&(t.fillStyle=h.dt,n(h.ft+h.ct)),t.fillStyle=h.vt,n(h.ft)}}function ts(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:"",dt:"",ft:0,ct:0,lt:null}}let th={from:0,to:1};class tr{constructor(t,i,e){this.Mt=new tt,this.bt=[],this.xt=[],this.St=!0,this.O=t,this.Ct=i,this.yt=e,this.Mt.st(this.bt)}Pt(t){this.kt(),this.St=!0}Tt(){return this.St&&(this.Rt(),this.St=!1),this.Mt}kt(){let t=this.yt.Dt();t.length!==this.bt.length&&(this.xt=t.map(ts),this.bt=this.xt.map(t=>{let i=new te;return i.ht(t),i}),this.Mt.st(this.bt))}Rt(){let t=2===this.Ct.N().mode||!this.Ct.Vt(),i=this.yt.It(),e=this.Ct.Bt(),s=this.O.At();this.kt(),i.forEach((i,h)=>{let r=this.xt[h],n=i.Et(e),l=i.zt();!t&&null!==n&&i.Vt()&&null!==l?(r.vt=n.Lt,r.ft=n.ft,r.ct=n.Ot,r.ot[0].gt=n.gt,r.ot[0].ut=i.Wt().Nt(n.gt,l.Ft),r.dt=n.Ht??this.O.Ut(r.ot[0].ut/i.Wt().$t()),r.ot[0].wt=e,r.ot[0]._t=s.qt(e),r.lt=th):r.lt=null})}}class tn extends ti{constructor(t){super(),this.Yt=t}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(null===this.Yt)return;let h=this.Yt.jt.Vt,r=this.Yt.Zt.Vt;if(!h&&!r)return;let n=Math.round(this.Yt._t*e),l=Math.round(this.Yt.ut*s);t.lineCap="butt",h&&n>=0&&(t.lineWidth=Math.floor(this.Yt.jt.ct*e),t.strokeStyle=this.Yt.jt.R,t.fillStyle=this.Yt.jt.R,j(t,this.Yt.jt.Kt),function(t,i,e,s){t.beginPath();let h=t.lineWidth%2?.5:0;t.moveTo(i+h,0),t.lineTo(i+h,s),t.stroke()}(t,n,0,i.height)),r&&l>=0&&(t.lineWidth=Math.floor(this.Yt.Zt.ct*s),t.strokeStyle=this.Yt.Zt.R,t.fillStyle=this.Yt.Zt.R,j(t,this.Yt.Zt.Kt),T(t,l,0,i.width))}}class tl{constructor(t,i){this.St=!0,this.Xt={jt:{ct:1,Kt:0,R:"",Vt:!1},Zt:{ct:1,Kt:0,R:"",Vt:!1},_t:0,ut:0},this.Gt=new tn(this.Xt),this.Jt=t,this.yt=i}Pt(){this.St=!0}Tt(t){return this.St&&(this.Rt(),this.St=!1),this.Gt}Rt(){let t=this.Jt.Vt(),i=this.yt.Qt().N().crosshair,e=this.Xt;if(2===i.mode)return e.Zt.Vt=!1,void(e.jt.Vt=!1);e.Zt.Vt=t&&this.Jt.ti(this.yt),e.jt.Vt=t&&this.Jt.ii(),e.Zt.ct=i.horzLine.width,e.Zt.Kt=i.horzLine.style,e.Zt.R=i.horzLine.color,e.jt.ct=i.vertLine.width,e.jt.Kt=i.vertLine.style,e.jt.R=i.vertLine.color,e._t=this.Jt.si(),e.ut=this.Jt.ni()}}function to(t,i,e,s,h,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,e,s,h),t.restore()}function ta(t,i,e,s,h,r){t.beginPath(),t.roundRect?t.roundRect(i,e,s,h,r):(t.lineTo(i+s-r[1],e),0!==r[1]&&t.arcTo(i+s,e,i+s,e+r[1],r[1]),t.lineTo(i+s,e+h-r[2]),0!==r[2]&&t.arcTo(i+s,e+h,i+s-r[2],e+h,r[2]),t.lineTo(i+r[3],e+h),0!==r[3]&&t.arcTo(i,e+h,i,e+h-r[3],r[3]),t.lineTo(i,e+r[0]),0!==r[0]&&t.arcTo(i,e,i+r[0],e,r[0]))}function tu(t,i,e,s,h,r,n=0,l=[0,0,0,0],o=""){var a;if(t.save(),!n||!o||o===r)return ta(t,i,e,s,h,l),t.fillStyle=r,t.fill(),void t.restore();let u=n/2;ta(t,i+u,e+u,s-n,h-n,(a=-u,l.map(t=>0===t?t:t+a))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==o&&(t.lineWidth=n,t.strokeStyle=o,t.closePath(),t.stroke()),t.restore()}function tc(t,i,e,s,h,r,n){t.save(),t.globalCompositeOperation="copy";let l=t.createLinearGradient(0,0,0,h);l.addColorStop(0,r),l.addColorStop(1,n),t.fillStyle=l,t.fillRect(i,e,s,h),t.restore()}class tf{constructor(t,i){this.ht(t,i)}ht(t,i){this.Yt=t,this.ei=i}$t(t,i){return this.Yt.Vt?t.P+t.A+t.V:0}nt(t,i,e,s){if(!this.Yt.Vt||0===this.Yt.ri.length)return;let h=this.Yt.R,r=this.ei.X,n=t.useBitmapCoordinateSpace(t=>{let n=t.context;n.font=i.k;let l=this.hi(t,i,e,s),o=l.ai;return l.li?tu(n,o.oi,o._i,o.ui,o.ci,r,o.di,[o.ft,0,0,o.ft],r):tu(n,o.fi,o._i,o.ui,o.ci,r,o.di,[0,o.ft,o.ft,0],r),this.Yt.pi&&(n.fillStyle=h,n.fillRect(o.fi,o.mi,o.wi-o.fi,o.gi)),this.Yt.Mi&&(n.fillStyle=i.D,n.fillRect(l.li?o.bi-o.di:0,o._i,o.di,o.xi-o._i)),l});t.useMediaCoordinateSpace(({context:t})=>{let e=n.Si;t.font=i.k,t.textAlign=n.li?"right":"left",t.textBaseline="middle",t.fillStyle=h,t.fillText(this.Yt.ri,e.Ci,(e._i+e.xi)/2+e.yi)})}hi(t,i,e,s){let h,r,n,{context:l,bitmapSize:o,mediaSize:a,horizontalPixelRatio:u,verticalPixelRatio:c}=t,f=this.Yt.pi||!this.Yt.Pi?i.C:0,d=this.Yt.ki?i.S:0,p=i.A+this.ei.Ti,m=i.V+this.ei.Ri,g=i.I,v=i.B,b=this.Yt.ri,y=i.P,w=e.Di(l,b),M=Math.ceil(e.Vi(l,b)),_=i.S+g+v+M+f,S=Math.max(1,Math.floor(c)),x=Math.round((y+p+m)*c);x%2!=S%2&&(x+=1);let O=d>0?Math.max(1,Math.floor(d*u)):0,P=Math.round(_*u),C=Math.round(f*u),R=Math.round((this.ei.Ii??this.ei.Bi)*c)-Math.floor(.5*c),k=Math.floor(R+S/2-x/2),z=k+x,Y="right"===s,E=Y?a.width-d:d,j=Y?o.width-O:O;return Y?(h=j-P,r=j-C,n=E-f-g-d):(h=j+P,r=j+C,n=E+f+g),{li:Y,ai:{_i:k,mi:R,xi:z,ui:P,ci:x,ft:2*u,di:O,oi:h,fi:j,wi:r,gi:S,bi:o.width},Si:{_i:k/c,xi:z/c,Ci:n,yi:w}}}}class td{constructor(t){this.Ai={Bi:0,X:"#000",Ri:0,Ti:0},this.Ei={ri:"",Vt:!1,pi:!0,Pi:!1,Ht:"",R:"#FFF",Mi:!1,ki:!1},this.zi={ri:"",Vt:!1,pi:!1,Pi:!0,Ht:"",R:"#FFF",Mi:!0,ki:!0},this.St=!0,this.Li=new(t||tf)(this.Ei,this.Ai),this.Oi=new(t||tf)(this.zi,this.Ai)}ri(){return this.Ni(),this.Ei.ri}Bi(){return this.Ni(),this.Ai.Bi}Pt(){this.St=!0}$t(t,i=!1){return Math.max(this.Li.$t(t,i),this.Oi.$t(t,i))}Wi(){return this.Ai.Ii||0}Fi(t){this.Ai.Ii=t}Hi(){return this.Ni(),this.Ei.Vt||this.zi.Vt}Ui(){return this.Ni(),this.Ei.Vt}Tt(t){return this.Ni(),this.Ei.pi=this.Ei.pi&&t.N().ticksVisible,this.zi.pi=this.zi.pi&&t.N().ticksVisible,this.Li.ht(this.Ei,this.Ai),this.Oi.ht(this.zi,this.Ai),this.Li}$i(){return this.Ni(),this.Li.ht(this.Ei,this.Ai),this.Oi.ht(this.zi,this.Ai),this.Oi}Ni(){this.St&&(this.Ei.pi=!0,this.zi.pi=!1,this.qi(this.Ei,this.zi,this.Ai))}}class tp extends td{constructor(t,i,e){super(),this.Jt=t,this.Yi=i,this.ji=e}qi(t,i,e){if(t.Vt=!1,2===this.Jt.N().mode)return;let s=this.Jt.N().horzLine;if(!s.labelVisible)return;let h=this.Yi.zt();if(!this.Jt.Vt()||this.Yi.Zi()||null===h)return;let r=this.Yi.Ki().K(s.labelBackgroundColor);e.X=r.X,t.R=r.G;let n=2/12*this.Yi.P();e.Ti=n,e.Ri=n;let l=this.ji(this.Yi);e.Bi=l.Bi,t.ri=this.Yi.Xi(l.gt,h),t.Vt=!0}}let tm=/[1-9]/g;class tg{constructor(){this.Yt=null}ht(t){this.Yt=t}nt(t,i){if(null===this.Yt||!1===this.Yt.Vt||0===this.Yt.ri.length)return;let e=t.useMediaCoordinateSpace(({context:t})=>(t.font=i.k,Math.round(i.Gi.Vi(t,N(this.Yt).ri,tm))));if(e<=0)return;let s=i.Ji,h=e+2*s,r=h/2,n=this.Yt.Qi,l=this.Yt.Bi,o=Math.floor(l-r)+.5;o<0?(l+=Math.abs(0-o),o=Math.floor(l-r)+.5):o+h>n&&(l-=Math.abs(n-(o+h)),o=Math.floor(l-r)+.5);let a=o+h,u=Math.ceil(0+i.S+i.C+i.A+i.P+i.V);t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:e,verticalPixelRatio:s})=>{let h=N(this.Yt);t.fillStyle=h.X;let r=Math.round(o*e),n=Math.round(0*s),l=Math.round(a*e),c=Math.round(u*s),f=Math.round(2*e);if(t.beginPath(),t.moveTo(r,n),t.lineTo(r,c-f),t.arcTo(r,c,r+f,c,f),t.lineTo(l-f,c),t.arcTo(l,c,l,c-f,f),t.lineTo(l,n),t.fill(),h.pi){let r=Math.round(h.Bi*e),l=Math.round((n+i.C)*s);t.fillStyle=h.R;let o=Math.max(1,Math.floor(e)),a=Math.floor(.5*e);t.fillRect(r-a,n,o,l-n)}}),t.useMediaCoordinateSpace(({context:t})=>{let e=N(this.Yt),h=0+i.S+i.C+i.A+i.P/2;t.font=i.k,t.textAlign="left",t.textBaseline="middle",t.fillStyle=e.R;let r=i.Gi.Di(t,"Apr0");t.translate(o+s,h+r),t.fillText(e.ri,0,0)})}}class tv{constructor(t,i,e){this.St=!0,this.Gt=new tg,this.Xt={Vt:!1,X:"#4c525e",R:"white",ri:"",Qi:0,Bi:NaN,pi:!0},this.Ct=t,this.ts=i,this.ji=e}Pt(){this.St=!0}Tt(){return this.St&&(this.Rt(),this.St=!1),this.Gt.ht(this.Xt),this.Gt}Rt(){let t=this.Xt;if(t.Vt=!1,2===this.Ct.N().mode)return;let i=this.Ct.N().vertLine;if(!i.labelVisible)return;let e=this.ts.At();if(e.Zi())return;t.Qi=e.Qi();let s=this.ji();if(null===s)return;t.Bi=s.Bi;let h=e.ss(this.Ct.Bt());t.ri=e.ns(N(h)),t.Vt=!0;let r=this.ts.Ki().K(i.labelBackgroundColor);t.X=r.X,t.R=r.G,t.pi=e.N().ticksVisible}}class tb{constructor(){this.es=null,this.rs=0}hs(){return this.rs}ls(t){this.rs=t}Wt(){return this.es}_s(t){this.es=t}us(t){return[]}cs(){return[]}Vt(){return!0}}(e=p||(p={}))[e.Normal=0]="Normal",e[e.Magnet=1]="Magnet",e[e.Hidden=2]="Hidden",e[e.MagnetOHLC=3]="MagnetOHLC";class ty extends tb{constructor(t,i){let e,s,h,r;super(),this.yt=null,this.ds=NaN,this.fs=0,this.ps=!1,this.vs=new Map,this.ws=!1,this.gs=new WeakMap,this.Ms=new WeakMap,this.bs=NaN,this.xs=NaN,this.Ss=NaN,this.Cs=NaN,this.ts=t,this.ys=i,this.Ps=(e=()=>this.ds,s=()=>this.xs,t=>{let i=s(),h=e();if(t===N(this.yt).ks())return{gt:h,Bi:i};{let e=N(t.zt());return{gt:t.Ts(i,e),Bi:i}}});let n=(h=()=>this.fs,r=()=>this.si(),()=>{let t=this.ts.At().Rs(h()),i=r();return t&&Number.isFinite(i)?{wt:t,Bi:i}:null});this.Ds=new tv(this,t,n)}N(){return this.ys}Vs(t,i){this.Ss=t,this.Cs=i}Is(){this.Ss=NaN,this.Cs=NaN}Bs(){return this.Ss}As(){return this.Cs}Es(t,i,e){this.ws||(this.ws=!0),this.ps=!0,this.zs(t,i,e)}Bt(){return this.fs}si(){return this.bs}ni(){return this.xs}Vt(){return this.ps}Ls(){this.ps=!1,this.Os(),this.ds=NaN,this.bs=NaN,this.xs=NaN,this.yt=null,this.Is(),this.Ns()}Ws(t){let i=this.gs.get(t);i||(i=new tl(this,t),this.gs.set(t,i));let e=this.Ms.get(t);return e||(e=new tr(this.ts,this,t),this.Ms.set(t,e)),[i,e]}ti(t){return t===this.yt&&this.ys.horzLine.visible}ii(){return this.ys.vertLine.visible}Fs(t,i){this.ps&&this.yt===t||this.vs.clear();let e=[];return this.yt===t&&e.push(this.Hs(this.vs,i,this.Ps)),e}cs(){return this.ps?[this.Ds]:[]}Us(){return this.yt}Ns(){this.ts.$s().forEach(t=>{this.gs.get(t)?.Pt(),this.Ms.get(t)?.Pt()}),this.vs.forEach(t=>t.Pt()),this.Ds.Pt()}qs(t){return t&&!t.ks().Zi()?t.ks():null}zs(t,i,e){this.Ys(t,i,e)&&this.Ns()}Ys(t,i,e){let s=this.bs,h=this.xs,r=this.ds,n=this.fs,l=this.yt,o=this.qs(e);this.fs=t,this.bs=isNaN(t)?NaN:this.ts.At().qt(t),this.yt=e;let a=null!==o?o.zt():null;return null!==o&&null!==a?(this.ds=i,this.xs=o.Nt(i,a)):(this.ds=NaN,this.xs=NaN),s!==this.bs||h!==this.xs||n!==this.fs||r!==this.ds||l!==this.yt}Os(){let t=this.ts.js().map(t=>t.Ks().Zs()).filter($),i=0===t.length?null:Math.max(...t);this.fs=null!==i?i:NaN}Hs(t,i,e){let s=t.get(i);return void 0===s&&(s=new tp(this,i,e),t.set(i,s)),s}}function tw(t){return"left"===t||"right"===t}class tM{constructor(t){this.Xs=new Map,this.Gs=[],this.Js=t}Qs(t,i){var e;let s=(e=this.Xs.get(t),void 0===e?i:{tn:Math.max(e.tn,i.tn),sn:e.sn||i.sn});this.Xs.set(t,s)}nn(){return this.Js}en(t){let i=this.Xs.get(t);return void 0===i?{tn:this.Js}:{tn:Math.max(this.Js,i.tn),sn:i.sn}}rn(){this.hn(),this.Gs=[{an:0}]}ln(t){this.hn(),this.Gs=[{an:1,Ft:t}]}_n(t){this.un(),this.Gs.push({an:5,Ft:t})}hn(){this.un(),this.Gs.push({an:6})}cn(){this.hn(),this.Gs=[{an:4}]}dn(t){this.hn(),this.Gs.push({an:2,Ft:t})}fn(t){this.hn(),this.Gs.push({an:3,Ft:t})}pn(){return this.Gs}vn(t){for(let i of t.Gs)this.mn(i);this.Js=Math.max(this.Js,t.Js),t.Xs.forEach((t,i)=>{this.Qs(i,t)})}static wn(){return new tM(2)}static gn(){return new tM(3)}mn(t){switch(t.an){case 0:this.rn();break;case 1:this.ln(t.Ft);break;case 2:this.dn(t.Ft);break;case 3:this.fn(t.Ft);break;case 4:this.cn();break;case 5:this._n(t.Ft);break;case 6:this.un()}}un(){let t=this.Gs.findIndex(t=>5===t.an);-1!==t&&this.Gs.splice(t,1)}}function t_(t,i){if(!F(t))return"n/a";if(!A(i)||i<0||i>16)throw TypeError("invalid length");return 0===i?t.toString():("0000000000000000"+t.toString()).slice(-i)}class tS{constructor(t,i){if(i||(i=1),F(t)&&A(t)||(t=100),t<0)throw TypeError("invalid base");this.Yi=t,this.Mn=i,this.bn()}format(t){let i=t<0?"−":"";return t=Math.abs(t),i+this.xn(t)}bn(){if(this.Sn=0,this.Yi>0&&this.Mn>0){let t=this.Yi;for(;t>1;)t/=10,this.Sn++}}xn(t){let i=this.Yi/this.Mn,e=Math.floor(t),s="",h=void 0!==this.Sn?this.Sn:NaN;if(i>1){let r=+(Math.round(t*i)-e*i).toFixed(this.Sn);r>=i&&(r-=i,e+=1),s="."+t_(+r.toFixed(this.Sn)*this.Mn,h)}else e=Math.round(e*i)/i,h>0&&(s="."+t_(0,h));return e.toFixed(0)+s}}class tx extends tS{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class tO{constructor(t){this.Cn=t}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.yn(t):t<999995?i+this.yn(t/1e3)+"K":t<0x3b9ac9fb?(t=1e3*Math.round(t/1e3),i+this.yn(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.yn(t/1e9)+"B")}yn(t){let i=Math.pow(10,this.Cn);return((t=Math.round(t*i)/i)>=1e-15&&t<1?t.toFixed(this.Cn).replace(/\.?0+$/,""):String(t)).replace(/(\.[1-9]*)0+$/,(t,i)=>i)}}let tP=/[2-9]/g;class tC{constructor(t=50){this.Pn=0,this.kn=1,this.Tn=1,this.Rn={},this.Dn=new Map,this.Vn=t}In(){this.Pn=0,this.Dn.clear(),this.kn=1,this.Tn=1,this.Rn={}}Vi(t,i,e){return this.Bn(t,i,e).width}Di(t,i,e){let s=this.Bn(t,i,e);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}Bn(t,i,e){let s=String(i).replace(e||tP,"0");if(this.Dn.has(s))return V(this.Dn.get(s)).An;if(this.Pn===this.Vn){let t=this.Rn[this.Tn];delete this.Rn[this.Tn],this.Dn.delete(t),this.Tn++,this.Pn--}t.save(),t.textBaseline="middle";let h=t.measureText(s);return t.restore(),0===h.width&&i.length||(this.Dn.set(s,{An:h,En:this.kn}),this.Rn[this.kn]=s,this.Pn++,this.kn++),h}}class tR{constructor(t){this.zn=null,this.M=null,this.Ln="right",this.On=t}Nn(t,i,e){this.zn=t,this.M=i,this.Ln=e}nt(t){null!==this.M&&null!==this.zn&&this.zn.nt(t,this.M,this.On,this.Ln)}}class tk{constructor(t,i,e){this.Wn=t,this.On=new tC(50),this.Fn=i,this.O=e,this.W=-1,this.Gt=new tR(this.On)}Tt(){let t=this.O.Hn(this.Fn);if(null===t)return null;let i=t.Un(this.Fn)?t.$n():this.Fn.Wt();if(null===i)return null;let e=t.qn(i);if("overlay"===e)return null;let s=this.O.Yn();return s.P!==this.W&&(this.W=s.P,this.On.In()),this.Gt.Nn(this.Wn.$i(),s,e),this.Gt}}class tz extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}jn(t,i){if(!this.Yt?.Vt)return null;let{ut:e,ct:s,Zn:h}=this.Yt;return i>=e-s-7&&i<=e+s+7?{Kn:this.Yt,Zn:h}:null}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(null===this.Yt||!1===this.Yt.Vt)return;let h=Math.round(this.Yt.ut*s);h<0||h>i.height||(t.lineCap="butt",t.strokeStyle=this.Yt.R,t.lineWidth=Math.floor(this.Yt.ct*e),j(t,this.Yt.Kt),T(t,h,0,i.width))}}class tY{constructor(t){this.Xn={ut:0,R:"rgba(0, 0, 0, 0)",ct:1,Kt:0,Vt:!1},this.Gn=new tz,this.St=!0,this.Jn=t,this.Qn=t.Qt(),this.Gn.ht(this.Xn)}Pt(){this.St=!0}Tt(){return this.Jn.Vt()?(this.St&&(this.te(),this.St=!1),this.Gn):null}}class tE extends tY{constructor(t){super(t)}te(){this.Xn.Vt=!1;let t=this.Jn.Wt(),i=t.ie().ie;if(2!==i&&3!==i)return;let e=this.Jn.N();if(!e.baseLineVisible||!this.Jn.Vt())return;let s=this.Jn.zt();null!==s&&(this.Xn.Vt=!0,this.Xn.ut=t.Nt(s.Ft,s.Ft),this.Xn.R=e.baseLineColor,this.Xn.ct=e.baseLineWidth,this.Xn.Kt=e.baseLineStyle)}}class tj extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}se(){return this.Yt}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){let s=this.Yt;if(null===s)return;let h=Math.max(1,Math.floor(i)),r=h%2/2,n=Math.round(s.ne.x*i)+r,l=s.ne.y*e;t.fillStyle=s.ee,t.beginPath();let o=Math.max(2,1.5*s.re)*i;t.arc(n,l,o,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.he,t.beginPath(),t.arc(n,l,s.ft*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=h,t.strokeStyle=s.ae,t.beginPath(),t.arc(n,l,s.ft*i+h/2,0,2*Math.PI,!1),t.stroke()}}let tT=[{le:0,oe:.25,_e:4,ue:10,ce:.25,de:0,fe:.4,pe:.8},{le:.25,oe:.525,_e:10,ue:14,ce:0,de:0,fe:.8,pe:0},{le:.525,oe:1,_e:14,ue:14,ce:0,de:0,fe:0,pe:0}];class tL{constructor(t){this.Gt=new tj,this.St=!0,this.ve=!0,this.me=performance.now(),this.we=this.me-1,this.ge=t}Me(){this.we=this.me-1,this.Pt()}be(){if(this.Pt(),2===this.ge.N().lastPriceAnimation){let t=performance.now(),i=this.we-t;if(i>0)return void(i<650&&(this.we+=2600));this.me=t,this.we=t+2600}}Pt(){this.St=!0}xe(){this.ve=!0}Vt(){return 0!==this.ge.N().lastPriceAnimation}Se(){switch(this.ge.N().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.we}}Tt(){return this.St?(this.Rt(),this.St=!1,this.ve=!1):this.ve&&(this.Ce(),this.ve=!1),this.Gt}Rt(){this.Gt.ht(null);let t=this.ge.Qt().At(),i=t.ye(),e=this.ge.zt();if(null===i||null===e)return;let s=this.ge.Pe(!0);if(s.ke||!i.Te(s.Re))return;let h={x:t.qt(s.Re),y:this.ge.Wt().Nt(s.gt,e.Ft)},r=s.R,n=this.ge.N().lineWidth,l=this.De(this.Ve(),r);this.Gt.ht({ee:r,re:n,he:l.he,ae:l.ae,ft:l.ft,ne:h})}Ce(){let t=this.Gt.se();if(null!==t){let i=this.De(this.Ve(),t.ee);t.he=i.he,t.ae=i.ae,t.ft=i.ft}}Ve(){return this.Se()?performance.now()-this.me:2599}Ie(t,i,e,s){return this.ge.Qt().Ki().j(t,e+(s-e)*i)}De(t,i){var e;let s,h=t%2600/2600;for(let t of tT)if(h>=t.le&&h<=t.oe){s=t;break}L(void 0!==s,"Last price animation internal logic error");let r=(h-s.le)/(s.oe-s.le);return{he:this.Ie(i,r,s.ce,s.de),ae:this.Ie(i,r,s.fe,s.pe),ft:(e=s._e)+(s.ue-e)*r}}}class tV extends tY{constructor(t){super(t)}te(){let t=this.Xn;t.Vt=!1;let i=this.Jn.N();if(!i.priceLineVisible||!this.Jn.Vt())return;let e=this.Jn.Pe(0===i.priceLineSource);e.ke||(t.Vt=!0,t.ut=e.Bi,t.R=this.Jn.Be(e.R),t.ct=i.priceLineWidth,t.Kt=i.priceLineStyle)}}class tN extends td{constructor(t){super(),this.Jt=t}qi(t,i,e){t.Vt=!1,i.Vt=!1;let s=this.Jt;if(!s.Vt())return;let h=s.N(),r=h.lastValueVisible,n=""!==s.Ae(),l=0===h.seriesLastValueMode,o=s.Pe(!1);if(o.ke)return;r&&(t.ri=this.Ee(o,r,l),t.Vt=0!==t.ri.length),(n||l)&&(i.ri=this.ze(o,r,n,l),i.Vt=i.ri.length>0);let a=s.Be(o.R),u=this.Jt.Qt().Ki().K(a);e.X=u.X,e.Bi=o.Bi,i.Ht=s.Qt().Ut(o.Bi/s.Wt().$t()),t.Ht=a,t.R=u.G,i.R=u.G}ze(t,i,e,s){let h="",r=this.Jt.Ae();return e&&0!==r.length&&(h+=`${r} `),i&&s&&(h+=this.Jt.Wt().Le()?t.Oe:t.Ne),h.trim()}Ee(t,i,e){return i?e?this.Jt.Wt().Le()?t.Ne:t.Oe:t.ri:""}}function tD(t,i,e,s){let h=Number.isFinite(i),r=Number.isFinite(e);return h&&r?t(i,e):h||r?h?i:e:s}class tB{constructor(t,i){this.We=t,this.Fe=i}He(t){return null!==t&&this.We===t.We&&this.Fe===t.Fe}Ue(){return new tB(this.We,this.Fe)}$e(){return this.We}qe(){return this.Fe}Ye(){return this.Fe-this.We}Zi(){return this.Fe===this.We||Number.isNaN(this.Fe)||Number.isNaN(this.We)}vn(t){return null===t?this:new tB(tD(Math.min,this.$e(),t.$e(),-1/0),tD(Math.max,this.qe(),t.qe(),1/0))}je(t){if(!F(t)||0==this.Fe-this.We)return;let i=.5*(this.Fe+this.We),e=this.Fe-i,s=this.We-i;e*=t,s*=t,this.Fe=i+e,this.We=i+s}Ze(t){F(t)&&(this.Fe+=t,this.We+=t)}Ke(){return{minValue:this.We,maxValue:this.Fe}}static Xe(t){return null===t?null:new tB(t.minValue,t.maxValue)}}class tW{constructor(t,i){this.Ge=t,this.Je=i||null}Qe(){return this.Ge}tr(){return this.Je}Ke(){return{priceRange:null===this.Ge?null:this.Ge.Ke(),margins:this.Je||void 0}}static Xe(t){return null===t?null:new tW(tB.Xe(t.priceRange),t.margins)}}class tF extends tY{constructor(t,i){super(t),this.ir=i}te(){let t=this.Xn;t.Vt=!1;let i=this.ir.N();if(!this.Jn.Vt()||!i.lineVisible)return;let e=this.ir.sr();null!==e&&(t.Vt=!0,t.ut=e,t.R=i.color,t.ct=i.lineWidth,t.Kt=i.lineStyle,t.Zn=this.ir.N().id)}}class tA extends td{constructor(t,i){super(),this.ge=t,this.ir=i}qi(t,i,e){t.Vt=!1,i.Vt=!1;let s=this.ir.N(),h=s.axisLabelVisible,r=""!==s.title,n=this.ge;if(!h||!n.Vt())return;let l=this.ir.sr();if(null===l)return;r&&(i.ri=s.title,i.Vt=!0),i.Ht=n.Qt().Ut(l/n.Wt().$t()),t.ri=this.nr(s.price),t.Vt=!0;let o=this.ge.Qt().Ki().K(s.axisLabelColor||s.color);e.X=o.X;let a=s.axisLabelTextColor||o.G;t.R=a,i.R=a,e.Bi=l}nr(t){let i=this.ge.zt();return null===i?"":this.ge.Wt().Xi(t,i.Ft)}}class tI{constructor(t,i){this.ge=t,this.ys=i,this.er=new tF(t,this),this.Wn=new tA(t,this),this.rr=new tk(this.Wn,t,t.Qt())}hr(t){W(this.ys,t),this.Pt(),this.ge.Qt().ar()}N(){return this.ys}lr(){return this.er}_r(){return this.rr}ur(){return this.Wn}Pt(){this.er.Pt(),this.Wn.Pt()}sr(){let t=this.ge,i=t.Wt();if(t.Qt().At().Zi()||i.Zi())return null;let e=t.zt();return null===e?null:i.Nt(this.ys.price,e.Ft)}}class tQ extends tb{constructor(t){super(),this.ts=t}Qt(){return this.ts}}let tJ={Bar:(t,i,e,s)=>{let h=i.upColor,r=i.downColor,n=N(t(e,s)),l=D(n.Ft[0])<=D(n.Ft[3]);return{cr:n.R??(l?h:r)}},Candlestick:(t,i,e,s)=>{let h=i.upColor,r=i.downColor,n=i.borderUpColor,l=i.borderDownColor,o=i.wickUpColor,a=i.wickDownColor,u=N(t(e,s)),c=D(u.Ft[0])<=D(u.Ft[3]);return{cr:u.R??(c?h:r),dr:u.Ht??(c?n:l),pr:u.vr??(c?o:a)}},Custom:(t,i,e,s)=>({cr:N(t(e,s)).R??i.color}),Area:(t,i,e,s)=>{let h=N(t(e,s));return{cr:h.vt??i.lineColor,vt:h.vt??i.lineColor,mr:h.mr??i.topColor,wr:h.wr??i.bottomColor}},Baseline:(t,i,e,s)=>{let h=N(t(e,s));return{cr:h.Ft[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,gr:h.gr??i.topLineColor,Mr:h.Mr??i.bottomLineColor,br:h.br??i.topFillColor1,Sr:h.Sr??i.topFillColor2,Cr:h.Cr??i.bottomFillColor1,yr:h.yr??i.bottomFillColor2}},Line:(t,i,e,s)=>{let h=N(t(e,s));return{cr:h.R??i.color,vt:h.R??i.color}},Histogram:(t,i,e,s)=>({cr:N(t(e,s)).R??i.color})};class t${constructor(t){this.Pr=(t,i)=>void 0!==i?i.Ft:this.ge.Ks().kr(t),this.ge=t,this.Tr=tJ[t.Rr()]}Dr(t,i){return this.Tr(this.Pr,this.ge.N(),t,i)}}function tU(t,i,e,s,h=0,r=i.length){let n=r-h;for(;0<n;){let r=n>>1,l=h+r;s(i[l],e)===t?(h=l+1,n-=r+1):n=r}return h}let tZ=tU.bind(null,!0),tH=tU.bind(null,!1);(r=m||(m={}))[r.NearestLeft=-1]="NearestLeft",r[r.None=0]="None",r[r.NearestRight=1]="NearestRight";class tG{constructor(){this.Vr=[],this.Ir=new Map,this.Br=new Map,this.Ar=[]}Er(){return this.zr()>0?this.Vr[this.Vr.length-1]:null}Lr(){return this.zr()>0?this.Or(0):null}Zs(){return this.zr()>0?this.Or(this.Vr.length-1):null}zr(){return this.Vr.length}Zi(){return 0===this.zr()}Te(t){return null!==this.Nr(t,0)}kr(t){return this.Wr(t)}Wr(t,i=0){let e=this.Nr(t,i);return null===e?null:{...this.Fr(e),Re:this.Or(e)}}Hr(){return this.Vr}Ur(t,i,e){if(this.Zi())return null;let s=null;for(let h of e)s=tK(s,this.$r(t,i,h));return s}ht(t){this.Br.clear(),this.Ir.clear(),this.Vr=t,this.Ar=t.map(t=>t.Re)}qr(){return this.Ar}Or(t){return this.Vr[t].Re}Fr(t){return this.Vr[t]}Nr(t,i){let e=this.Yr(t);if(null===e&&0!==i)switch(i){case -1:return this.jr(t);case 1:return this.Zr(t);default:throw TypeError("Unknown search mode")}return e}jr(t){let i=this.Kr(t);return i>0&&(i-=1),i!==this.Vr.length&&this.Or(i)<t?i:null}Zr(t){let i=this.Xr(t);return i!==this.Vr.length&&t<this.Or(i)?i:null}Yr(t){let i=this.Kr(t);return i===this.Vr.length||t<this.Vr[i].Re?null:i}Kr(t){return tZ(this.Vr,t,(t,i)=>t.Re<i)}Xr(t){return tH(this.Vr,t,(t,i)=>t.Re>i)}Gr(t,i,e){let s=null;for(let h=t;h<i;h++){let t=this.Vr[h].Ft[e];Number.isNaN(t)||(null===s?s={Jr:t,Qr:t}:(t<s.Jr&&(s.Jr=t),t>s.Qr&&(s.Qr=t)))}return s}$r(t,i,e){if(this.Zi())return null;let s=null,h=N(this.Lr()),r=N(this.Zs()),n=Math.max(t,h),l=Math.min(i,r),o=30*Math.ceil(n/30),a=Math.max(o,30*Math.floor(l/30));{let t=this.Kr(n),h=this.Xr(Math.min(l,o,i));s=tK(s,this.Gr(t,h,e))}let u=this.Ir.get(e);void 0===u&&(u=new Map,this.Ir.set(e,u));for(let t=Math.max(o+1,n);t<a;t+=30){let i=Math.floor(t/30),h=u.get(i);if(void 0===h){let t=this.Kr(30*i),s=this.Xr((i+1)*30-1);h=this.Gr(t,s,e),u.set(i,h)}s=tK(s,h)}{let t=this.Kr(a),i=this.Xr(l);s=tK(s,this.Gr(t,i,e))}return s}}function tK(t,i){return null===t?i:null===i?t:{Jr:Math.min(t.Jr,i.Jr),Qr:Math.max(t.Qr,i.Qr)}}class tX{constructor(t){this.th=t}nt(t,i,e){this.th.draw(t)}ih(t,i,e){this.th.drawBackground?.(t)}}class tq{constructor(t){this.Dn=null,this.sh=t}Tt(){let t=this.sh.renderer();if(null===t)return null;if(this.Dn?.nh===t)return this.Dn.eh;let i=new tX(t);return this.Dn={nh:t,eh:i},i}rh(){return this.sh.zOrder?.()??"normal"}}class t0{constructor(t){this.hh=null,this.ah=t}oh(){return this.ah}Ns(){this.ah.updateAllViews?.()}Ws(){let t=this.ah.paneViews?.()??[];if(this.hh?.nh===t)return this.hh.eh;let i=t.map(t=>new tq(t));return this.hh={nh:t,eh:i},i}jn(t,i){return this.ah.hitTest?.(t,i)??null}}let t1=class extends t0{us(){return[]}};class t2{constructor(t){this.th=t}nt(t,i,e){this.th.draw(t)}ih(t,i,e){this.th.drawBackground?.(t)}}class t3{constructor(t){this.Dn=null,this.sh=t}Tt(){let t=this.sh.renderer();if(null===t)return null;if(this.Dn?.nh===t)return this.Dn.eh;let i=new t2(t);return this.Dn={nh:t,eh:i},i}rh(){return this.sh.zOrder?.()??"normal"}}function t5(t){return{ri:t.text(),Bi:t.coordinate(),Ii:t.fixedCoordinate?.(),R:t.textColor(),X:t.backColor(),Vt:t.visible?.()??!0,pi:t.tickVisible?.()??!0}}class t6{constructor(t,i){this.Gt=new tg,this._h=t,this.uh=i}Tt(){return this.Gt.ht({Qi:this.uh.Qi(),...t5(this._h)}),this.Gt}}class t4 extends td{constructor(t,i){super(),this._h=t,this.Yi=i}qi(t,i,e){let s=t5(this._h);e.X=s.X,t.R=s.R;let h=2/12*this.Yi.P();e.Ti=h,e.Ri=h,e.Bi=s.Bi,e.Ii=s.Ii,t.ri=s.ri,t.Vt=s.Vt,t.pi=s.pi}}class t9 extends t0{constructor(t,i){super(t),this.dh=null,this.fh=null,this.ph=null,this.mh=null,this.ge=i}cs(){let t=this.ah.timeAxisViews?.()??[];if(this.dh?.nh===t)return this.dh.eh;let i=this.ge.Qt().At(),e=t.map(t=>new t6(t,i));return this.dh={nh:t,eh:e},e}Fs(){let t=this.ah.priceAxisViews?.()??[];if(this.fh?.nh===t)return this.fh.eh;let i=this.ge.Wt(),e=t.map(t=>new t4(t,i));return this.fh={nh:t,eh:e},e}wh(){let t=this.ah.priceAxisPaneViews?.()??[];if(this.ph?.nh===t)return this.ph.eh;let i=t.map(t=>new t3(t));return this.ph={nh:t,eh:i},i}gh(){let t=this.ah.timeAxisPaneViews?.()??[];if(this.mh?.nh===t)return this.mh.eh;let i=t.map(t=>new t3(t));return this.mh={nh:t,eh:i},i}Mh(t,i){return this.ah.autoscaleInfo?.(t,i)??null}}function t8(t,i,e,s){t.forEach(t=>{i(t).forEach(t=>{t.rh()===e&&s.push(t)})})}function t7(t){return t.Ws()}function it(t){return t.wh()}function ii(t){return t.gh()}let ie=["Area","Line","Baseline"];class is extends tQ{constructor(t,i,e,s,h){super(t),this.Yt=new tG,this.er=new tV(this),this.bh=[],this.xh=new tE(this),this.Sh=null,this.Ch=null,this.yh=null,this.Ph=[],this.ys=e,this.kh=i;let r=new tN(this);this.vs=[r],this.rr=new tk(r,this,t),ie.includes(this.kh)&&(this.Sh=new tL(this)),this.Th(),this.sh=s(this,this.Qt(),h)}m(){null!==this.yh&&clearTimeout(this.yh)}Be(t){return this.ys.priceLineColor||t}Pe(t){let i,e,s={ke:!0},h=this.Wt();if(this.Qt().At().Zi()||h.Zi()||this.Yt.Zi())return s;let r=this.Qt().At().ye(),n=this.zt();if(null===r||null===n)return s;if(t){let t=this.Yt.Er();if(null===t)return s;i=t,e=t.Re}else{let t=this.Yt.Wr(r.bi(),-1);if(null===t||null===(i=this.Yt.kr(t.Re)))return s;e=t.Re}let l=i.Ft[3],o=this.Rh().Dr(e,{Ft:i}),a=h.Nt(l,n.Ft);return{ke:!1,gt:l,ri:h.Xi(l,n.Ft),Oe:h.Dh(l),Ne:h.Vh(l,n.Ft),R:o.cr,Bi:a,Re:e}}Rh(){return null!==this.Ch||(this.Ch=new t$(this)),this.Ch}N(){return this.ys}hr(t){let i=t.priceScaleId;void 0!==i&&i!==this.ys.priceScaleId&&this.Qt().Ih(this,i),W(this.ys,t),void 0!==t.priceFormat&&(this.Th(),this.Qt().Bh()),this.Qt().Ah(this),this.Qt().Eh(),this.sh.Pt("options")}ht(t,i){this.Yt.ht(t),this.sh.Pt("data"),null!==this.Sh&&(i&&i.zh?this.Sh.be():0===t.length&&this.Sh.Me());let e=this.Qt().Hn(this);this.Qt().Lh(e),this.Qt().Ah(this),this.Qt().Eh(),this.Qt().ar()}Oh(t){let i=new tI(this,t);return this.bh.push(i),this.Qt().Ah(this),i}Nh(t){let i=this.bh.indexOf(t);-1!==i&&this.bh.splice(i,1),this.Qt().Ah(this)}Wh(){return this.bh}Rr(){return this.kh}zt(){let t=this.Fh();return null===t?null:{Ft:t.Ft[3],Hh:t.wt}}Fh(){let t=this.Qt().At().ye();if(null===t)return null;let i=t.Uh();return this.Yt.Wr(i,1)}Ks(){return this.Yt}$h(t){let i=this.Yt.kr(t);return null===i?null:"Bar"===this.kh||"Candlestick"===this.kh||"Custom"===this.kh?{qh:i.Ft[0],Yh:i.Ft[1],jh:i.Ft[2],Zh:i.Ft[3]}:i.Ft[3]}Kh(t){let i=[];t8(this.Ph,t7,"top",i);let e=this.Sh;return null!==e&&e.Vt()&&(null===this.yh&&e.Se()&&(this.yh=setTimeout(()=>{this.yh=null,this.Qt().Xh()},0)),e.xe(),i.unshift(e)),i}Ws(){let t=[];this.Gh()||t.push(this.xh),t.push(this.sh,this.er);let i=this.bh.map(t=>t.lr());return t.push(...i),t8(this.Ph,t7,"normal",t),t}Jh(){return this.Qh(t7,"bottom")}ta(t){return this.Qh(it,t)}ia(t){return this.Qh(ii,t)}sa(t,i){return this.Ph.map(e=>e.jn(t,i)).filter(t=>null!==t)}us(){return[this.rr,...this.bh.map(t=>t._r())]}Fs(t,i){if(i!==this.es&&!this.Gh())return[];let e=[...this.vs];for(let t of this.bh)e.push(t.ur());return this.Ph.forEach(t=>{e.push(...t.Fs())}),e}cs(){let t=[];return this.Ph.forEach(i=>{t.push(...i.cs())}),t}Mh(t,i){if(void 0!==this.ys.autoscaleInfoProvider){let e=this.ys.autoscaleInfoProvider(()=>{let e=this.na(t,i);return null===e?null:e.Ke()});return tW.Xe(e)}return this.na(t,i)}ea(){return this.ys.priceFormat.minMove}ra(){return this.ha}Ns(){for(let t of(this.sh.Pt(),this.vs))t.Pt();for(let t of this.bh)t.Pt();this.er.Pt(),this.xh.Pt(),this.Sh?.Pt(),this.Ph.forEach(t=>t.Ns())}Wt(){return N(super.Wt())}Et(t){if(!(("Line"===this.kh||"Area"===this.kh||"Baseline"===this.kh)&&this.ys.crosshairMarkerVisible))return null;let i=this.Yt.kr(t);return null===i?null:{gt:i.Ft[3],ft:this.aa(),Ht:this.la(),Ot:this.oa(),Lt:this._a(t)}}Ae(){return this.ys.title}Vt(){return this.ys.visible}ua(t){this.Ph.push(new t9(t,this))}ca(t){this.Ph=this.Ph.filter(i=>i.oh()!==t)}da(){if("Custom"===this.kh)return t=>this.sh.fa(t)}pa(){if("Custom"===this.kh)return t=>this.sh.va(t)}ma(){return this.Yt.qr()}Gh(){return!tw(this.Wt().wa())}na(t,i){if(!A(t)||!A(i)||this.Yt.Zi())return null;let e="Line"===this.kh||"Area"===this.kh||"Baseline"===this.kh||"Histogram"===this.kh?[3]:[2,1],s=this.Yt.Ur(t,i,e),h=null!==s?new tB(s.Jr,s.Qr):null,r=null;if("Histogram"===this.Rr()){let t=this.ys.base,i=new tB(t,t);h=null!==h?h.vn(i):i}return this.Ph.forEach(e=>{let s=e.Mh(t,i);if(s?.priceRange){let t=new tB(s.priceRange.minValue,s.priceRange.maxValue);h=null!==h?h.vn(t):t}s?.margins&&(r=s.margins)}),new tW(h,r)}aa(){switch(this.kh){case"Line":case"Area":case"Baseline":return this.ys.crosshairMarkerRadius}return 0}la(){switch(this.kh){case"Line":case"Area":case"Baseline":{let t=this.ys.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}oa(){switch(this.kh){case"Line":case"Area":case"Baseline":return this.ys.crosshairMarkerBorderWidth}return 0}_a(t){switch(this.kh){case"Line":case"Area":case"Baseline":{let t=this.ys.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.Rh().Dr(t).cr}Th(){switch(this.ys.priceFormat.type){case"custom":this.ha={format:this.ys.priceFormat.formatter};break;case"volume":this.ha=new tO(this.ys.priceFormat.precision);break;case"percent":this.ha=new tx(this.ys.priceFormat.precision);break;default:{let t=Math.pow(10,this.ys.priceFormat.precision);this.ha=new tS(t,this.ys.priceFormat.minMove*t)}}null!==this.es&&this.es.ga()}Qh(t,i){let e=[];return t8(this.Ph,t,i,e),e}}let ih=[3],ir=[0,1,2,3];class il{constructor(t){this.ys=t}Ma(t,i,e){if(0===this.ys.mode)return t;let s=e.ks(),h=s.zt();if(null===h)return t;let r=s.Nt(t,h),n=e.ba().filter(t=>t instanceof is).reduce((t,s)=>{if(e.Un(s)||!s.Vt())return t;let h=s.Wt(),r=s.Ks();if(h.Zi()||!r.Te(i))return t;let n=r.kr(i);if(null===n)return t;let l=D(s.zt()),o=3===this.ys.mode?ir:ih;return t.concat(o.map(t=>h.Nt(n.Ft[t],l.Ft)))},[]);if(0===n.length)return t;n.sort((t,i)=>Math.abs(t-r)-Math.abs(i-r));let l=n[0];return s.Ts(l,h)}}class io extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(null===this.Yt)return;let h=Math.max(1,Math.floor(e));t.lineWidth=h,t.save(),t.lineWidth%2&&t.translate(.5,.5),(()=>{let r=N(this.Yt);if(r.xa){for(let s of(t.strokeStyle=r.Sa,j(t,r.Ca),t.beginPath(),r.ya)){let r=Math.round(s.Pa*e);t.moveTo(r,-h),t.lineTo(r,i.height+h)}t.stroke()}if(r.ka){for(let e of(t.strokeStyle=r.Ta,j(t,r.Ra),t.beginPath(),r.Da)){let r=Math.round(e.Pa*s);t.moveTo(-h,r),t.lineTo(i.width+h,r)}t.stroke()}})(),t.restore()}}class ia{constructor(t){this.Gt=new io,this.St=!0,this.yt=t}Pt(){this.St=!0}Tt(){if(this.St){let t=this.yt.Qt().N().grid,i={ka:t.horzLines.visible,xa:t.vertLines.visible,Ta:t.horzLines.color,Sa:t.vertLines.color,Ra:t.horzLines.style,Ca:t.vertLines.style,Da:this.yt.ks().Va(),ya:(this.yt.Qt().At().Va()||[]).map(t=>({Pa:t.coord}))};this.Gt.ht(i),this.St=!1}return this.Gt}}class iu{constructor(t){this.sh=new ia(t)}lr(){return this.sh}}let ic={Ia:4,Ba:1e-4};function id(t,i){let e=100*(t-i)/i;return i<0?-e:e}function ip(t,i){let e=100*(t-i)/i+100;return i<0?-e:e}function im(t,i){let e=Math.abs(t);if(e<1e-15)return 0;let s=Math.log10(e+i.Ba)+i.Ia;return t<0?-s:s}function ig(t,i){let e=Math.abs(t);if(e<1e-15)return 0;let s=Math.pow(10,e-i.Ia)-i.Ba;return t<0?-s:s}function iv(t,i){return null===t?null:new tB(im(t.$e(),i),im(t.qe(),i))}function ib(t,i){return null===t?null:new tB(ig(t.$e(),i),ig(t.qe(),i))}function iy(t){if(null===t)return ic;let i=Math.abs(t.qe()-t.$e());if(i>=1||i<1e-15)return ic;let e=Math.ceil(Math.abs(Math.log10(i))),s=ic.Ia+e;return{Ia:s,Ba:1/Math.pow(10,s)}}function iw(t,i,e){return Math.min(Math.max(t,i),e)}function iM(t){let i=Math.ceil(t);return i%2==0?i-1:i}class i_{constructor(t,i){if(this.Aa=t,this.Ea=i,function(t){if(t<0)return!1;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0}(this.Aa))this.za=[2,2.5,2];else{this.za=[];for(let t=this.Aa;1!==t;){if(t%2==0)this.za.push(2),t/=2;else{if(t%5!=0)throw Error("unexpected base");this.za.push(2,2.5),t/=5}if(this.za.length>100)throw Error("something wrong with base")}}}La(t,i,e){let s=0===this.Aa?0:1/this.Aa,h=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,n=this.Ea[0];for(;;){let t=s-h<=1e-14&&h>s+1e-14,i=e*n-h<=1e-14,l=1-h<=1e-14;if(!(t&&i&&l))break;h/=n,n=this.Ea[++r%this.Ea.length]}if(h<=s+1e-14&&(h=s),h=Math.max(1,h),this.za.length>0&&1e-14>Math.abs(h-1))for(r=0,n=this.za[0];e*n-h<=1e-14&&h>s+1e-14;)h/=n,n=this.za[++r%this.za.length];return h}}class iS{constructor(t,i,e,s){this.Oa=[],this.Yi=t,this.Aa=i,this.Na=e,this.Wa=s}La(t,i){if(t<i)throw Error("high < low");let e=this.Yi.$t(),s=(t-i)*this.Fa()/e,h=new i_(this.Aa,[2,2.5,2]),r=new i_(this.Aa,[2,2,2.5]),n=new i_(this.Aa,[2.5,2,2]),l=[];return l.push(h.La(t,i,s),r.La(t,i,s),n.La(t,i,s)),function(t){if(t.length<1)throw Error("array is empty");let i=t[0];for(let e=1;e<t.length;++e)t[e]<i&&(i=t[e]);return i}(l)}Ha(){let t=this.Yi,i=t.zt();if(null===i)return void(this.Oa=[]);let e=t.$t(),s=this.Na(e-1,i),h=this.Na(0,i),r=this.Yi.N().entireTextOnly?this.Ua()/2:0,n=e-1-r,l=Math.max(s,h),o=Math.min(s,h);if(l===o)return void(this.Oa=[]);let a=this.La(l,o),u=l%a;u+=u<0?a:0;let c=l>=o?1:-1,f=null,d=0;for(let e=l-u;e>o;e-=a){let s=this.Wa(e,i,!0);null!==f&&Math.abs(s-f)<this.Fa()||s<r||s>n||(d<this.Oa.length?(this.Oa[d].Pa=s,this.Oa[d].$a=t.qa(e)):this.Oa.push({Pa:s,$a:t.qa(e)}),d++,f=s,t.Ya()&&(a=this.La(e*c,o)))}this.Oa.length=d}Va(){return this.Oa}Ua(){return this.Yi.P()}Fa(){return Math.ceil(2.5*this.Ua())}}function ix(t){return t.slice().sort((t,i)=>N(t.hs())-N(i.hs()))}(n=g||(g={}))[n.Normal=0]="Normal",n[n.Logarithmic=1]="Logarithmic",n[n.Percentage=2]="Percentage",n[n.IndexedTo100=3]="IndexedTo100";let iO=new tx,iP=new tS(100,1);class iC{constructor(t,i,e,s,h){this.ja=0,this.Za=null,this.Ge=null,this.Ka=null,this.Xa={Ga:!1,Ja:null},this.Qa=0,this.tl=0,this.il=new B,this.sl=new B,this.nl=[],this.el=null,this.rl=null,this.hl=null,this.al=null,this.ha=iP,this.ll=iy(null),this.ol=t,this.ys=i,this._l=e,this.ul=s,this.cl=h,this.dl=new iS(this,100,this.fl.bind(this),this.pl.bind(this))}wa(){return this.ol}N(){return this.ys}hr(t){if(W(this.ys,t),this.ga(),void 0!==t.mode&&this.vl({ie:t.mode}),void 0!==t.scaleMargins){let i=V(t.scaleMargins.top),e=V(t.scaleMargins.bottom);if(i<0||i>1)throw Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(e<0||e>1)throw Error(`Invalid bottom margin - expect value between 0 and 1, given=${e}`);if(i+e>1)throw Error(`Invalid margins - sum of margins must be less than 1, given=${i+e}`);this.ml(),this.rl=null}}wl(){return this.ys.autoScale}Ya(){return 1===this.ys.mode}Le(){return 2===this.ys.mode}gl(){return 3===this.ys.mode}ie(){return{sn:this.ys.autoScale,Ml:this.ys.invertScale,ie:this.ys.mode}}vl(t){let i=this.ie(),e=null;void 0!==t.sn&&(this.ys.autoScale=t.sn),void 0!==t.ie&&(this.ys.mode=t.ie,2!==t.ie&&3!==t.ie||(this.ys.autoScale=!0),this.Xa.Ga=!1),1===i.ie&&t.ie!==i.ie&&(function(t,i){if(null===t)return!1;let e=ig(t.$e(),i),s=ig(t.qe(),i);return isFinite(e)&&isFinite(s)}(this.Ge,this.ll)?null!==(e=ib(this.Ge,this.ll))&&this.bl(e):this.ys.autoScale=!0),1===t.ie&&t.ie!==i.ie&&null!==(e=iv(this.Ge,this.ll))&&this.bl(e);let s=i.ie!==this.ys.mode;s&&(2===i.ie||this.Le())&&this.ga(),s&&(3===i.ie||this.gl())&&this.ga(),void 0!==t.Ml&&i.Ml!==t.Ml&&(this.ys.invertScale=t.Ml,this.xl()),this.sl.p(i,this.ie())}Sl(){return this.sl}P(){return this._l.fontSize}$t(){return this.ja}Cl(t){this.ja!==t&&(this.ja=t,this.ml(),this.rl=null)}yl(){if(this.Za)return this.Za;let t=this.$t()-this.Pl()-this.kl();return this.Za=t,t}Qe(){return this.Tl(),this.Ge}bl(t,i){let e=this.Ge;(i||null===e&&null!==t||null!==e&&!e.He(t))&&(this.rl=null,this.Ge=t)}Zi(){return this.Tl(),0===this.ja||!this.Ge||this.Ge.Zi()}Rl(t){return this.Ml()?t:this.$t()-1-t}Nt(t,i){return this.Le()?t=id(t,i):this.gl()&&(t=ip(t,i)),this.pl(t,i)}Dl(t,i,e){this.Tl();let s=this.kl(),h=N(this.Qe()),r=h.$e(),n=h.qe(),l=this.yl()-1,o=this.Ml(),a=l/(n-r),u=void 0===e?0:e.from,c=void 0===e?t.length:e.to,f=this.Vl();for(let e=u;e<c;e++){let h=t[e],n=h.gt;if(isNaN(n))continue;let l=n;null!==f&&(l=f(h.gt,i));let u=s+a*(l-r);h.ut=o?u:this.ja-1-u}}Il(t,i,e){this.Tl();let s=this.kl(),h=N(this.Qe()),r=h.$e(),n=h.qe(),l=this.yl()-1,o=this.Ml(),a=l/(n-r),u=void 0===e?0:e.from,c=void 0===e?t.length:e.to,f=this.Vl();for(let e=u;e<c;e++){let h=t[e],n=h.qh,l=h.Yh,u=h.jh,c=h.Zh;null!==f&&(n=f(h.qh,i),l=f(h.Yh,i),u=f(h.jh,i),c=f(h.Zh,i));let d=s+a*(n-r),p=o?d:this.ja-1-d;h.Bl=p,d=s+a*(l-r),h.Al=p=o?d:this.ja-1-d,d=s+a*(u-r),h.El=p=o?d:this.ja-1-d,d=s+a*(c-r),h.zl=p=o?d:this.ja-1-d}}Ts(t,i){let e=this.fl(t,i);return this.Ll(e,i)}Ll(t,i){var e,s;let h=t;return this.Le()?(e=h,i<0&&(e=-e),h=e/100*i+i):this.gl()&&(s=h-100,i<0&&(s=-s),h=s/100*i+i),h}ba(){return this.nl}Dt(){if(this.el)return this.el;let t=[];for(let i=0;i<this.nl.length;i++){let e=this.nl[i];null===e.hs()&&e.ls(i+1),t.push(e)}return t=ix(t),this.el=t,this.el}Ol(t){-1===this.nl.indexOf(t)&&(this.nl.push(t),this.ga(),this.Nl())}Wl(t){let i=this.nl.indexOf(t);if(-1===i)throw Error("source is not attached to scale");this.nl.splice(i,1),0===this.nl.length&&(this.vl({sn:!0}),this.bl(null)),this.ga(),this.Nl()}zt(){let t=null;for(let i of this.nl){let e=i.zt();null!==e&&(null===t||e.Hh<t.Hh)&&(t=e)}return null===t?null:t.Ft}Ml(){return this.ys.invertScale}Va(){let t=null===this.zt();if(null!==this.rl&&(t||this.rl.Fl===t))return this.rl.Va;this.dl.Ha();let i=this.dl.Va();return this.rl={Va:i,Fl:t},this.il.p(),i}Hl(){return this.il}Ul(t){this.Le()||this.gl()||null===this.hl&&null===this.Ka&&(this.Zi()||(this.hl=this.ja-t,this.Ka=N(this.Qe()).Ue()))}$l(t){if(this.Le()||this.gl()||null===this.hl)return;this.vl({sn:!1}),(t=this.ja-t)<0&&(t=0);let i=(this.hl+.2*(this.ja-1))/(t+.2*(this.ja-1)),e=N(this.Ka).Ue();i=Math.max(i,.1),e.je(i),this.bl(e)}ql(){this.Le()||this.gl()||(this.hl=null,this.Ka=null)}Yl(t){this.wl()||null===this.al&&null===this.Ka&&(this.Zi()||(this.al=t,this.Ka=N(this.Qe()).Ue()))}jl(t){if(this.wl()||null===this.al)return;let i=N(this.Qe()).Ye()/(this.yl()-1),e=t-this.al;this.Ml()&&(e*=-1);let s=e*i,h=N(this.Ka).Ue();h.Ze(s),this.bl(h,!0),this.rl=null}Zl(){this.wl()||null!==this.al&&(this.al=null,this.Ka=null)}ra(){return this.ha||this.ga(),this.ha}Xi(t,i){switch(this.ys.mode){case 2:return this.Kl(id(t,i));case 3:return this.ra().format(ip(t,i));default:return this.nr(t)}}qa(t){switch(this.ys.mode){case 2:return this.Kl(t);case 3:return this.ra().format(t);default:return this.nr(t)}}Dh(t){return this.nr(t,N(this.Xl()).ra())}Vh(t,i){return t=id(t,i),this.Kl(t,iO)}Gl(){return this.nl}Jl(t){this.Xa={Ja:t,Ga:!1}}Ns(){this.nl.forEach(t=>t.Ns())}ga(){this.rl=null;let t=this.Xl(),i=100;null!==t&&(i=Math.round(1/t.ea())),this.ha=iP,this.Le()?(this.ha=iO,i=100):this.gl()?(this.ha=new tS(100,1),i=100):null!==t&&(this.ha=t.ra()),this.dl=new iS(this,i,this.fl.bind(this),this.pl.bind(this)),this.dl.Ha()}Nl(){this.el=null}Ki(){return this.cl}Xl(){return this.nl[0]||null}Pl(){return this.Ml()?this.ys.scaleMargins.bottom*this.$t()+this.tl:this.ys.scaleMargins.top*this.$t()+this.Qa}kl(){return this.Ml()?this.ys.scaleMargins.top*this.$t()+this.Qa:this.ys.scaleMargins.bottom*this.$t()+this.tl}Tl(){this.Xa.Ga||(this.Xa.Ga=!0,this.Ql())}ml(){this.Za=null}pl(t,i){if(this.Tl(),this.Zi())return 0;t=this.Ya()&&t?im(t,this.ll):t;let e=N(this.Qe()),s=this.kl()+(this.yl()-1)*(t-e.$e())/e.Ye();return this.Rl(s)}fl(t,i){if(this.Tl(),this.Zi())return 0;let e=this.Rl(t),s=N(this.Qe()),h=s.$e()+s.Ye()*((e-this.kl())/(this.yl()-1));return this.Ya()?ig(h,this.ll):h}xl(){this.rl=null,this.dl.Ha()}Ql(){var t,i,e,s,h;let r=this.Xa.Ja;if(null===r)return;let n=null,l=this.Gl(),o=0,a=0;for(let t of l){if(!t.Vt())continue;let l=t.zt();if(null===l)continue;let u=t.Mh(r.Uh(),r.bi()),c=u&&u.Qe();if(null!==c){switch(this.ys.mode){case 1:c=iv(c,this.ll);break;case 2:i=c,e=l.Ft,c=new tB(id(i.$e(),e),id(i.qe(),e));break;case 3:s=c,h=l.Ft,c=new tB(ip(s.$e(),h),ip(s.qe(),h))}if(n=null===n?c:n.vn(N(c)),null!==u){let t=u.tr();null!==t&&(o=Math.max(o,t.above),a=Math.max(a,t.below))}}}if(o===this.Qa&&a===this.tl||(this.Qa=o,this.tl=a,this.rl=null,this.ml()),null!==n){if(n.$e()===n.qe()){let t=this.Xl(),i=5*(null===t||this.Le()||this.gl()?1:t.ea());this.Ya()&&(n=ib(n,this.ll)),n=new tB(n.$e()-i,n.qe()+i),this.Ya()&&(n=iv(n,this.ll))}if(this.Ya()){let i=ib(n,this.ll),e=iy(i);if(t=this.ll,e.Ia!==t.Ia||e.Ba!==t.Ba){let t=null!==this.Ka?ib(this.Ka,this.ll):null;this.ll=e,n=iv(i,e),null!==t&&(this.Ka=iv(t,e))}}this.bl(n)}else null===this.Ge&&(this.bl(new tB(-.5,.5)),this.ll=iy(null));this.Xa.Ga=!0}Vl(){return this.Le()?id:this.gl()?ip:this.Ya()?t=>im(t,this.ll):null}io(t,i,e){return void 0===i?(void 0===e&&(e=this.ra()),e.format(t)):i(t)}nr(t,i){return this.io(t,this.ul.priceFormatter,i)}Kl(t,i){return this.io(t,this.ul.percentageFormatter,i)}}function iR(t){return t instanceof is}class ik{constructor(t,i){this.nl=[],this.so=new Map,this.ja=0,this.no=0,this.eo=1e3,this.el=null,this.ro=new B,this.Ph=[],this.uh=t,this.ts=i,this.ho=new iu(this);let e=i.N();this.ao=this.lo("left",e.leftPriceScale),this.oo=this.lo("right",e.rightPriceScale),this.ao.Sl().i(this._o.bind(this,this.ao),this),this.oo.Sl().i(this._o.bind(this,this.oo),this),this.uo(e)}uo(t){if(t.leftPriceScale&&this.ao.hr(t.leftPriceScale),t.rightPriceScale&&this.oo.hr(t.rightPriceScale),t.localization&&(this.ao.ga(),this.oo.ga()),t.overlayPriceScales)for(let i of Array.from(this.so.values())){let e=N(i[0].Wt());e.hr(t.overlayPriceScales),t.localization&&e.ga()}}co(t){switch(t){case"left":return this.ao;case"right":return this.oo}return this.so.has(t)?V(this.so.get(t))[0].Wt():null}m(){this.Qt().do().u(this),this.ao.Sl().u(this),this.oo.Sl().u(this),this.nl.forEach(t=>{t.m&&t.m()}),this.Ph=this.Ph.filter(t=>{let i=t.oh();return i.detached&&i.detached(),!1}),this.ro.p()}fo(){return this.eo}po(t){this.eo=t}Qt(){return this.ts}Qi(){return this.no}$t(){return this.ja}vo(t){this.no=t,this.mo()}Cl(t){this.ja=t,this.ao.Cl(t),this.oo.Cl(t),this.nl.forEach(i=>{if(this.Un(i)){let e=i.Wt();null!==e&&e.Cl(t)}}),this.mo()}wo(){return this.nl.filter(iR)}ba(){return this.nl}Un(t){let i=t.Wt();return null===i||this.ao!==i&&this.oo!==i}Ol(t,i,e){let s=void 0!==e?e:this.bo().Mo+1;this.xo(t,i,s)}Wl(t){let i=this.nl.indexOf(t);L(-1!==i,"removeDataSource: invalid data source"),this.nl.splice(i,1);let e=N(t.Wt()).wa();if(this.so.has(e)){let i=V(this.so.get(e)),s=i.indexOf(t);-1!==s&&(i.splice(s,1),0===i.length&&this.so.delete(e))}let s=t.Wt();s&&s.ba().indexOf(t)>=0&&s.Wl(t),null!==s&&(s.Nl(),this.So(s)),this.el=null}qn(t){return t===this.ao?"left":t===this.oo?"right":"overlay"}Co(){return this.ao}yo(){return this.oo}Po(t,i){t.Ul(i)}ko(t,i){t.$l(i),this.mo()}To(t){t.ql()}Ro(t,i){t.Yl(i)}Do(t,i){t.jl(i),this.mo()}Vo(t){t.Zl()}mo(){this.nl.forEach(t=>{t.Ns()})}ks(){let t=null;return this.ts.N().rightPriceScale.visible&&0!==this.oo.ba().length?t=this.oo:this.ts.N().leftPriceScale.visible&&0!==this.ao.ba().length?t=this.ao:0!==this.nl.length&&(t=this.nl[0].Wt()),null===t&&(t=this.oo),t}$n(){let t=null;return this.ts.N().rightPriceScale.visible?t=this.oo:this.ts.N().leftPriceScale.visible&&(t=this.ao),t}So(t){null!==t&&t.wl()&&this.Io(t)}Bo(t){let i=this.uh.ye();t.vl({sn:!0}),null!==i&&t.Jl(i),this.mo()}Ao(){this.Io(this.ao),this.Io(this.oo)}Eo(){this.So(this.ao),this.So(this.oo),this.nl.forEach(t=>{this.Un(t)&&this.So(t.Wt())}),this.mo(),this.ts.ar()}Dt(){return null===this.el&&(this.el=ix(this.nl)),this.el}It(){return this.Dt().filter(iR)}zo(){return this.ro}Lo(){return this.ho}ua(t){this.Ph.push(new t1(t))}ca(t){this.Ph=this.Ph.filter(i=>i.oh()!==t),t.detached&&t.detached(),this.ts.ar()}Oo(){return this.Ph}sa(t,i){return this.Ph.map(e=>e.jn(t,i)).filter(t=>null!==t)}Io(t){let i=t.Gl();if(i&&i.length>0&&!this.uh.Zi()){let i=this.uh.ye();null!==i&&t.Jl(i)}t.Ns()}bo(){let t=this.Dt();if(0===t.length)return{No:0,Mo:0};let i=0,e=0;for(let s=0;s<t.length;s++){let h=t[s].hs();null!==h&&(h<i&&(i=h),h>e&&(e=h))}return{No:i,Mo:e}}xo(t,i,e){let s=this.co(i);if(null===s&&(s=this.lo(i,this.ts.N().overlayPriceScales)),this.nl.push(t),!tw(i)){let e=this.so.get(i)||[];e.push(t),this.so.set(i,e)}s.Ol(t),t._s(s),t.ls(e),this.So(s),this.el=null}_o(t,i,e){i.ie!==e.ie&&this.Io(t)}lo(t,i){let e=new iC(t,{visible:!0,autoScale:!0,...J(i)},this.ts.N().layout,this.ts.N().localization,this.ts.Ki());return e.Cl(this.$t()),e}}function iz(t){return{Wo:t.Wo,Fo:{Zn:t.Ho.externalId},Uo:t.Ho.cursorStyle}}function iY(t,i,e){let s=[t,...t.Dt()],h=function(t,i,e){var s,h;let r,n;for(let l of t)for(let t of l.sa?.(i,e)??[])s=t.zOrder,(h=r?.zOrder)&&("top"!==s||"top"===h)&&("normal"!==s||"bottom"!==h)||(r=t,n=l);return r&&n?{Ho:r,Wo:n}:null}(s,i,e);if("top"===h?.Ho.zOrder)return iz(h);for(let r of s){if(h&&h.Wo===r&&"bottom"!==h.Ho.zOrder&&!h.Ho.isBackground)return iz(h);if(void 0!==r.Ws){let s=function(t,i,e,s){for(let h of t){let t=h.Tt(s);if(null!==t&&t.jn){let s=t.jn(i,e);if(null!==s)return{$o:h,Fo:s}}}return null}(r.Ws(t),i,e,t);if(null!==s)return{Wo:r,$o:s.$o,Fo:s.Fo}}if(h&&h.Wo===r&&"bottom"!==h.Ho.zOrder&&h.Ho.isBackground)return iz(h)}return h?.Ho?iz(h):null}class iE{constructor(t,i,e=50){this.Pn=0,this.kn=1,this.Tn=1,this.Dn=new Map,this.Rn=new Map,this.qo=t,this.Yo=i,this.Vn=e}jo(t){let i=t.time,e=this.Yo.cacheKey(i),s=this.Dn.get(e);if(void 0!==s)return s.Zo;if(this.Pn===this.Vn){let t=this.Rn.get(this.Tn);this.Rn.delete(this.Tn),this.Dn.delete(V(t)),this.Tn++,this.Pn--}let h=this.qo(t);return this.Dn.set(e,{Zo:h,En:this.kn}),this.Rn.set(this.kn,e),this.Pn++,this.kn++,h}}class ij{constructor(t,i){L(t<=i,"right should be >= left"),this.Ko=t,this.Xo=i}Uh(){return this.Ko}bi(){return this.Xo}Go(){return this.Xo-this.Ko+1}Te(t){return this.Ko<=t&&t<=this.Xo}He(t){return this.Ko===t.Uh()&&this.Xo===t.bi()}}function iT(t,i){return null===t||null===i?t===i:t.He(i)}class iL{constructor(){this.Jo=new Map,this.Dn=null,this.Qo=!1}t_(t){this.Qo=t,this.Dn=null}i_(t,i){this.s_(i),this.Dn=null;for(let e=i;e<t.length;++e){let i=t[e],s=this.Jo.get(i.timeWeight);void 0===s&&(s=[],this.Jo.set(i.timeWeight,s)),s.push({index:e,time:i.time,weight:i.timeWeight,originalTime:i.originalTime})}}n_(t,i,e,s,h){let r=Math.ceil(i/t);return null!==this.Dn&&this.Dn.e_===r&&h===this.Dn.r_&&e===this.Dn.h_||(this.Dn={r_:h,h_:e,Va:this.a_(r,e,s),e_:r}),this.Dn.Va}s_(t){if(0===t)return void this.Jo.clear();let i=[];for(let e of(this.Jo.forEach((e,s)=>{t<=e[0].index?i.push(s):e.splice(tZ(e,t,i=>i.index<t),1/0)}),i))this.Jo.delete(e)}a_(t,i,e){let s=[],h=t=>!i||e.has(t.index);for(let i of Array.from(this.Jo.keys()).sort((t,i)=>i-t)){if(!this.Jo.get(i))continue;let e=s;s=[];let r=e.length,n=0,l=V(this.Jo.get(i)),o=l.length,a=1/0,u=-1/0;for(let i=0;i<o;i++){let o=l[i],c=o.index;for(;n<r;){let t=e[n],i=t.index;if(!(i<c&&h(t))){a=i;break}n++,s.push(t),u=i,a=1/0}if(a-c>=t&&c-u>=t&&h(o))s.push(o),u=c;else if(this.Qo)return e}for(;n<r;n++)h(e[n])&&s.push(e[n])}return s}}class iV{constructor(t){this.l_=t}o_(){return null===this.l_?null:new ij(Math.floor(this.l_.Uh()),Math.ceil(this.l_.bi()))}__(){return this.l_}static u_(){return new iV(null)}}function iN(t,i){return t.weight>i.weight?t:i}class iD{constructor(t,i,e,s){this.no=0,this.c_=null,this.d_=[],this.al=null,this.hl=null,this.f_=new iL,this.p_=new Map,this.v_=iV.u_(),this.m_=!0,this.w_=new B,this.g_=new B,this.M_=new B,this.b_=null,this.x_=null,this.S_=new Map,this.C_=-1,this.y_=[],this.ys=i,this.ul=e,this.P_=i.rightOffset,this.k_=i.barSpacing,this.ts=t,this.Yo=s,this.T_(),this.f_.t_(i.uniformDistribution),this.R_()}N(){return this.ys}D_(t){W(this.ul,t),this.V_(),this.T_()}hr(t,i){W(this.ys,t),this.ys.fixLeftEdge&&this.I_(),this.ys.fixRightEdge&&this.B_(),void 0!==t.barSpacing&&this.ts.dn(t.barSpacing),void 0!==t.rightOffset&&this.ts.fn(t.rightOffset),void 0===t.minBarSpacing&&void 0===t.maxBarSpacing||this.ts.dn(t.barSpacing??this.k_),void 0!==t.ignoreWhitespaceIndices&&t.ignoreWhitespaceIndices!==this.ys.ignoreWhitespaceIndices&&this.R_(),this.V_(),this.T_(),this.M_.p()}Rs(t){return this.d_[t]?.time??null}ss(t){return this.d_[t]??null}A_(t,i){if(this.d_.length<1)return null;if(this.Yo.key(t)>this.Yo.key(this.d_[this.d_.length-1].time))return i?this.d_.length-1:null;let e=tZ(this.d_,this.Yo.key(t),(t,i)=>this.Yo.key(t.time)<i);return this.Yo.key(t)<this.Yo.key(this.d_[e].time)?i?e:null:e}Zi(){return 0===this.no||0===this.d_.length||null===this.c_}E_(){return this.d_.length>0}ye(){return this.z_(),this.v_.o_()}L_(){return this.z_(),this.v_.__()}O_(){let t=this.ye();if(null===t)return null;let i={from:t.Uh(),to:t.bi()};return this.N_(i)}N_(t){let i=Math.round(t.from),e=Math.round(t.to),s=N(this.W_()),h=N(this.F_());return{from:N(this.ss(Math.max(s,i))),to:N(this.ss(Math.min(h,e)))}}H_(t){return{from:N(this.A_(t.from,!0)),to:N(this.A_(t.to,!0))}}Qi(){return this.no}vo(t){if(!isFinite(t)||t<=0||this.no===t)return;let i=this.L_(),e=this.no;if(this.no=t,this.m_=!0,this.ys.lockVisibleTimeRangeOnResize&&0!==e){let i=this.k_*t/e;this.k_=i}this.ys.fixLeftEdge&&null!==i&&0>=i.Uh()&&(this.P_-=Math.round((e-t)/this.k_)+1,this.m_=!0),this.U_(),this.q_()}qt(t){if(this.Zi()||!A(t))return 0;let i=this.Y_()+this.P_-t;return this.no-(i+.5)*this.k_-1}j_(t,i){let e=this.Y_(),s=void 0===i?0:i.from,h=void 0===i?t.length:i.to;for(let i=s;i<h;i++){let s=t[i].wt,h=e+this.P_-s,r=this.no-(h+.5)*this.k_-1;t[i]._t=r}}Z_(t,i){let e=Math.ceil(this.K_(t));return i&&this.ys.ignoreWhitespaceIndices&&!this.X_(e)?this.G_(e):e}fn(t){this.m_=!0,this.P_=t,this.q_(),this.ts.J_(),this.ts.ar()}Q_(){return this.k_}dn(t){this.tu(t),this.q_(),this.ts.J_(),this.ts.ar()}iu(){return this.P_}Va(){if(this.Zi())return null;if(null!==this.x_)return this.x_;let t=this.k_,i=5*(this.ts.N().layout.fontSize+4)/8*(this.ys.tickMarkMaxCharacterLength||8),e=Math.round(i/t),s=N(this.ye()),h=Math.max(s.Uh(),s.Uh()-e),r=Math.max(s.bi(),s.bi()-e),n=this.f_.n_(t,i,this.ys.ignoreWhitespaceIndices,this.S_,this.C_),l=this.W_()+e,o=this.F_()-e,a=this.su(),u=this.ys.fixLeftEdge||a,c=this.ys.fixRightEdge||a,f=0;for(let t of n){let e;h<=t.index&&t.index<=r&&(f<this.y_.length?((e=this.y_[f]).coord=this.qt(t.index),e.label=this.nu(t),e.weight=t.weight):(e={needAlignCoordinate:!1,coord:this.qt(t.index),label:this.nu(t),weight:t.weight},this.y_.push(e)),this.k_>i/2&&!a?e.needAlignCoordinate=!1:e.needAlignCoordinate=u&&t.index<=l||c&&t.index>=o,f++)}return this.y_.length=f,this.x_=this.y_,this.y_}eu(){this.m_=!0,this.dn(this.ys.barSpacing),this.fn(this.ys.rightOffset)}ru(t){this.m_=!0,this.c_=t,this.q_(),this.I_()}hu(t,i){let e=this.K_(t),s=this.Q_();this.dn(s+s/10*i),this.ys.rightBarStaysOnScroll||this.fn(this.iu()+(e-this.K_(t)))}Ul(t){this.al&&this.Zl(),null===this.hl&&null===this.b_&&(this.Zi()||(this.hl=t,this.au()))}$l(t){if(null===this.b_)return;let i=iw(this.no-t,0,this.no),e=iw(this.no-N(this.hl),0,this.no);0!==i&&0!==e&&this.dn(this.b_.Q_*i/e)}ql(){null!==this.hl&&(this.hl=null,this.lu())}Yl(t){null===this.al&&null===this.b_&&(this.Zi()||(this.al=t,this.au()))}jl(t){if(null===this.al)return;let i=(this.al-t)/this.Q_();this.P_=N(this.b_).iu+i,this.m_=!0,this.q_()}Zl(){null!==this.al&&(this.al=null,this.lu())}ou(){this._u(this.ys.rightOffset)}_u(t,i=400){if(!isFinite(t))throw RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw RangeError("animationDuration (optional) must be finite positive number");let e=this.P_,s=performance.now();this.ts._n({uu:t=>(t-s)/i>=1,cu:h=>{let r=(h-s)/i;return r>=1?t:e+(t-e)*r}})}Pt(t,i){this.m_=!0,this.d_=t,this.f_.i_(t,i),this.q_()}du(){return this.w_}fu(){return this.g_}pu(){return this.M_}Y_(){return this.c_||0}vu(t){let i=t.Go();this.tu(this.no/i),this.P_=t.bi()-this.Y_(),this.q_(),this.m_=!0,this.ts.J_(),this.ts.ar()}mu(){let t=this.W_(),i=this.F_();null!==t&&null!==i&&this.vu(new ij(t,i+this.ys.rightOffset))}wu(t){let i=new ij(t.from,t.to);this.vu(i)}ns(t){return void 0!==this.ul.timeFormatter?this.ul.timeFormatter(t.originalTime):this.Yo.formatHorzItem(t.time)}R_(){if(this.ys.ignoreWhitespaceIndices){for(let t of(this.S_.clear(),this.ts.js()))for(let i of t.ma())this.S_.set(i,!0);this.C_++}}su(){let t=this.ts.N().handleScroll,i=this.ts.N().handleScale;return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||i.axisDoubleClickReset.time||i.axisPressedMouseMove.time||i.mouseWheel||i.pinch)}W_(){return 0===this.d_.length?null:0}F_(){return 0===this.d_.length?null:this.d_.length-1}gu(t){return(this.no-1-t)/this.k_}K_(t){let i=this.gu(t);return Math.round(1e6*(this.Y_()+this.P_-i))/1e6}tu(t){let i=this.k_;this.k_=t,this.U_(),i!==this.k_&&(this.m_=!0,this.Mu())}z_(){if(!this.m_)return;if(this.m_=!1,this.Zi())return void this.bu(iV.u_());let t=this.Y_(),i=this.no/this.k_,e=this.P_+t,s=new ij(e-i+1,e);this.bu(new iV(s))}U_(){let t=iw(this.k_,this.xu(),this.Su());this.k_!==t&&(this.k_=t,this.m_=!0)}Su(){return this.ys.maxBarSpacing>0?this.ys.maxBarSpacing:.5*this.no}xu(){return this.ys.fixLeftEdge&&this.ys.fixRightEdge&&0!==this.d_.length?this.no/this.d_.length:this.ys.minBarSpacing}q_(){let t=this.Cu();null!==t&&this.P_<t&&(this.P_=t,this.m_=!0);let i=this.yu();this.P_>i&&(this.P_=i,this.m_=!0)}Cu(){let t=this.W_(),i=this.c_;return null===t||null===i?null:t-i-1+(this.ys.fixLeftEdge?this.no/this.k_:Math.min(2,this.d_.length))}yu(){return this.ys.fixRightEdge?0:this.no/this.k_-Math.min(2,this.d_.length)}au(){this.b_={Q_:this.Q_(),iu:this.iu()}}lu(){this.b_=null}nu(t){let i=this.p_.get(t.weight);return void 0===i&&(i=new iE(t=>this.Pu(t),this.Yo),this.p_.set(t.weight,i)),i.jo(t)}Pu(t){return this.Yo.formatTickmark(t,this.ul)}bu(t){let i=this.v_;this.v_=t,iT(i.o_(),this.v_.o_())||this.w_.p(),iT(i.__(),this.v_.__())||this.g_.p(),this.Mu()}Mu(){this.x_=null}V_(){this.Mu(),this.p_.clear()}T_(){this.Yo.updateFormatter(this.ul)}I_(){if(!this.ys.fixLeftEdge)return;let t=this.W_();if(null===t)return;let i=this.ye();if(null===i)return;let e=i.Uh()-t;if(e<0){let t=this.P_-e-1;this.fn(t)}this.U_()}B_(){this.q_(),this.U_()}X_(t){return!this.ys.ignoreWhitespaceIndices||this.S_.get(t)||!1}G_(t){let i=function*(t){let i=Math.round(t),e=i<t,s=1;for(;;)e?(yield i+s,yield i-s):(yield i-s,yield i+s),s++}(t),e=this.F_();for(;e;){let t=i.next().value;if(this.S_.get(t))return t;if(t<0||t>e)break}return t}}(l=v||(v={}))[l.OnTouchEnd=0]="OnTouchEnd",l[l.OnNextTap=1]="OnNextTap";class iB{constructor(t,i,e){this.ku=[],this.Tu=[],this.no=0,this.Ru=null,this.Du=new B,this.Vu=new B,this.Iu=null,this.Bu=t,this.ys=i,this.Yo=e,this.cl=new q(this.ys.layout.colorParsers),this.Au=new G(this),this.uh=new iD(this,i.timeScale,this.ys.localization,e),this.Ct=new ty(this,i.crosshair),this.Eu=new il(i.crosshair),this.zu(0),this.ku[0].po(2e3),this.Lu=this.Ou(0),this.Nu=this.Ou(1)}Bh(){this.Wu(tM.gn())}ar(){this.Wu(tM.wn())}Xh(){this.Wu(new tM(1))}Ah(t){let i=this.Fu(t);this.Wu(i)}Hu(){return this.Ru}Uu(t){if(this.Ru?.Wo===t?.Wo&&this.Ru?.Fo?.Zn===t?.Fo?.Zn)return;let i=this.Ru;this.Ru=t,null!==i&&this.Ah(i.Wo),null!==t&&t.Wo!==i?.Wo&&this.Ah(t.Wo)}N(){return this.ys}hr(t){W(this.ys,t),this.ku.forEach(i=>i.uo(t)),void 0!==t.timeScale&&this.uh.hr(t.timeScale),void 0!==t.localization&&this.uh.D_(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Du.p(),this.Lu=this.Ou(0),this.Nu=this.Ou(1),this.Bh()}$u(t,i,e=0){let s=this.ku[e];if(void 0===s)return;if("left"===t)return W(this.ys,{leftPriceScale:i}),s.uo({leftPriceScale:i}),this.Du.p(),void this.Bh();if("right"===t)return W(this.ys,{rightPriceScale:i}),s.uo({rightPriceScale:i}),this.Du.p(),void this.Bh();let h=this.qu(t,e);null!==h&&(h.Wt.hr(i),this.Du.p())}qu(t,i){let e=this.ku[i];if(void 0===e)return null;let s=e.co(t);return null!==s?{Us:e,Wt:s}:null}At(){return this.uh}$s(){return this.ku}Yu(){return this.Ct}ju(){return this.Vu}Zu(t,i){t.Cl(i),this.J_()}vo(t){this.no=t,this.uh.vo(this.no),this.ku.forEach(i=>i.vo(t)),this.J_()}Ku(t){1!==this.ku.length&&(L(t>=0&&t<this.ku.length,"Invalid pane index"),this.ku.splice(t,1),this.Bh())}Xu(t,i){if(this.ku.length<2)return;L(t>=0&&t<this.ku.length,"Invalid pane index");let e=this.ku[t],s=this.ku.reduce((t,i)=>t+i.fo(),0),h=this.ku.reduce((t,i)=>t+i.$t(),0),r=h-30*(this.ku.length-1);i=Math.min(r,Math.max(30,i));let n=s/h,l=e.$t();e.po(i*n);let o=i-l,a=this.ku.length-1;for(let t of this.ku)if(t!==e){let i=Math.min(r,Math.max(30,t.$t()-o/a));o-=t.$t()-i,a-=1;let e=i*n;t.po(e)}this.Bh()}Gu(t,i){L(t>=0&&t<this.ku.length&&i>=0&&i<this.ku.length,"Invalid pane index");let e=this.ku[t],s=this.ku[i];this.ku[t]=s,this.ku[i]=e,this.Bh()}Po(t,i,e){t.Po(i,e)}ko(t,i,e){t.ko(i,e),this.Eh(),this.Wu(this.Ju(t,2))}To(t,i){t.To(i),this.Wu(this.Ju(t,2))}Ro(t,i,e){i.wl()||t.Ro(i,e)}Do(t,i,e){i.wl()||(t.Do(i,e),this.Eh(),this.Wu(this.Ju(t,2)))}Vo(t,i){i.wl()||(t.Vo(i),this.Wu(this.Ju(t,2)))}Bo(t,i){t.Bo(i),this.Wu(this.Ju(t,2))}Qu(t){this.uh.Ul(t)}tc(t,i){let e=this.At();if(e.Zi()||0===i)return;let s=e.Qi();t=Math.max(1,Math.min(t,s)),e.hu(t,i),this.J_()}sc(t){this.nc(0),this.ec(t),this.rc()}hc(t){this.uh.$l(t),this.J_()}ac(){this.uh.ql(),this.ar()}nc(t){this.uh.Yl(t)}ec(t){this.uh.jl(t),this.J_()}rc(){this.uh.Zl(),this.ar()}js(){return this.Tu}lc(t,i,e,s,h){this.Ct.Vs(t,i);let r=NaN,n=this.uh.Z_(t,!0),l=this.uh.ye();null!==l&&(n=Math.min(Math.max(l.Uh(),n),l.bi()));let o=s.ks(),a=o.zt();if(null!==a&&(r=o.Ts(i,a)),r=this.Eu.Ma(r,n,s),this.Ct.Es(n,r,s),this.Xh(),!h){let h=iY(s,t,i);this.Uu(h&&{Wo:h.Wo,Fo:h.Fo,Uo:h.Uo||null}),this.Vu.p(this.Ct.Bt(),{x:t,y:i},e)}}oc(t,i,e){let s=e.ks(),h=s.zt(),r=s.Nt(t,N(h)),n=this.uh.A_(i,!0),l=this.uh.qt(N(n));this.lc(l,r,null,e,!0)}_c(t){this.Yu().Ls(),this.Xh(),t||this.Vu.p(null,null,null)}Eh(){let t=this.Ct.Us();if(null!==t){let i=this.Ct.Bs(),e=this.Ct.As();this.lc(i,e,null,t)}this.Ct.Ns()}uc(t,i,e){let s=this.uh.Rs(0);void 0!==i&&void 0!==e&&this.uh.Pt(i,e);let h=this.uh.Rs(0),r=this.uh.Y_(),n=this.uh.ye();if(null!==n&&null!==s&&null!==h){let i=n.Te(r),l=this.Yo.key(s)>this.Yo.key(h),o=null!==t&&t>r&&!l,a=this.uh.N().allowShiftVisibleRangeOnWhitespaceReplacement,u=i&&(void 0!==e||a)&&this.uh.N().shiftVisibleRangeOnNewBar;if(o&&!u){let i=t-r;this.uh.fn(this.uh.iu()-i)}}this.uh.ru(t)}Lh(t){null!==t&&t.Eo()}Hn(t){if(t instanceof ik)return t;let i=this.ku.find(i=>i.Dt().includes(t));return void 0===i?null:i}J_(){this.ku.forEach(t=>t.Eo()),this.Eh()}m(){this.ku.forEach(t=>t.m()),this.ku.length=0,this.ys.localization.priceFormatter=void 0,this.ys.localization.percentageFormatter=void 0,this.ys.localization.timeFormatter=void 0}cc(){return this.Au}Yn(){return this.Au.N()}do(){return this.Du}dc(t,i){let e=this.zu(i);this.fc(t,e),this.Tu.push(t),1===this.Tu.length?this.Bh():this.ar()}vc(t){let i=this.Hn(t),e=this.Tu.indexOf(t);L(-1!==e,"Series not found");let s=N(i);this.Tu.splice(e,1),s.Wl(t),t.m&&t.m(),this.uh.R_(),this.mc(s)}Ih(t,i){let e=N(this.Hn(t));e.Wl(t),e.Ol(t,i,N(t.hs()))}mu(){let t=tM.wn();t.rn(),this.Wu(t)}wc(t){let i=tM.wn();i.ln(t),this.Wu(i)}cn(){let t=tM.wn();t.cn(),this.Wu(t)}dn(t){let i=tM.wn();i.dn(t),this.Wu(i)}fn(t){let i=tM.wn();i.fn(t),this.Wu(i)}_n(t){let i=tM.wn();i._n(t),this.Wu(i)}hn(){let t=tM.wn();t.hn(),this.Wu(t)}gc(){return this.ys.rightPriceScale.visible?"right":"left"}Mc(t,i){if(L(i>=0,"Index should be greater or equal to 0"),i===this.bc(t))return;let e=N(this.Hn(t));e.Wl(t);let s=this.zu(i);this.fc(t,s),0===e.ba().length&&this.mc(e)}xc(){return this.Nu}$(){return this.Lu}Ut(t){let i=this.Nu,e=this.Lu;if(i===e)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Iu||this.Iu.mr!==e||this.Iu.wr!==i)this.Iu={mr:e,wr:i,Sc:new Map};else{let i=this.Iu.Sc.get(t);if(void 0!==i)return i}let s=this.cl.tt(e,i,t/100);return this.Iu.Sc.set(t,s),s}Cc(t){return this.ku.indexOf(t)}Ki(){return this.cl}zu(t){if(L(t>=0,"Index should be greater or equal to 0"),(t=Math.min(this.ku.length,t))<this.ku.length)return this.ku[t];let i=new ik(this.uh,this);this.ku.push(i);let e=tM.gn();return e.Qs(t,{tn:0,sn:!0}),this.Wu(e),i}bc(t){return this.ku.findIndex(i=>i.wo().includes(t))}Ju(t,i){let e=new tM(i);if(null!==t){let s=this.ku.indexOf(t);e.Qs(s,{tn:i})}return e}Fu(t,i){return void 0===i&&(i=2),this.Ju(this.Hn(t),i)}Wu(t){this.Bu&&this.Bu(t),this.ku.forEach(t=>t.Lo().lr().Pt())}fc(t,i){let e=t.N().priceScaleId,s=void 0!==e?e:this.gc();i.Ol(t,s),tw(s)||t.hr(t.N())}Ou(t){let i=this.ys.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}mc(t){0===t.ba().length&&this.ku.length>1&&(this.ku.splice(this.Cc(t),1),this.Bh())}}function iW(t){return!F(t)&&!I(t)}(o=b||(b={}))[o.Disabled=0]="Disabled",o[o.Continuous=1]="Continuous",o[o.OnDataUpdate=2]="OnDataUpdate",(a=y||(y={}))[a.LastBar=0]="LastBar",a[a.LastVisible=1]="LastVisible",(u=w||(w={})).Solid="solid",u.VerticalGradient="gradient",(c=M||(M={}))[c.Year=0]="Year",c[c.Month=1]="Month",c[c.DayOfMonth=2]="DayOfMonth",c[c.Time=3]="Time",c[c.TimeWithSeconds=4]="TimeWithSeconds";let iF=t=>t.getUTCFullYear();class iA{constructor(t="yyyy-MM-dd",i="default"){this.yc=t,this.Pc=i}jo(t){return function(t,i,e){return i.replace(/yyyy/g,t_(iF(t),4)).replace(/yy/g,t_(iF(t)%100,2)).replace(/MMMM/g,new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"long"})).replace(/MMM/g,new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"short"})).replace(/MM/g,t_(t.getUTCMonth()+1,2)).replace(/dd/g,t_(t.getUTCDate(),2))}(t,this.yc,this.Pc)}}class iI{constructor(t){this.kc=t||"%h:%m:%s"}jo(t){return this.kc.replace("%h",t_(t.getUTCHours(),2)).replace("%m",t_(t.getUTCMinutes(),2)).replace("%s",t_(t.getUTCSeconds(),2))}}let iQ={Tc:"yyyy-MM-dd",Rc:"%h:%m:%s",Dc:" ",Vc:"default"};class iJ{constructor(t={}){let i={...iQ,...t};this.Ic=new iA(i.Tc,i.Vc),this.Bc=new iI(i.Rc),this.Ac=i.Dc}jo(t){return`${this.Ic.jo(t)}${this.Ac}${this.Bc.jo(t)}`}}function i$(t){return 60*t*6e4}function iU(t){return 60*t*1e3}let iZ=[{Ec:1e3,zc:10},{Ec:iU(1),zc:20},{Ec:iU(5),zc:21},{Ec:iU(30),zc:22},{Ec:i$(1),zc:30},{Ec:i$(3),zc:31},{Ec:i$(6),zc:32},{Ec:i$(12),zc:33}];function iH(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let e=iZ.length-1;e>=0;--e)if(Math.floor(i.getTime()/iZ[e].Ec)!==Math.floor(t.getTime()/iZ[e].Ec))return iZ[e].zc;return 0}function iG(t){let i=t;if(I(t)&&(i=iX(t)),!iW(i))throw Error("time must be of type BusinessDay");return{Lc:Math.round(new Date(Date.UTC(i.year,i.month-1,i.day,0,0,0,0)).getTime()/1e3),Oc:i}}function iK(t){if(!F(t))throw Error("time must be of type isUTCTimestamp");return{Lc:t}}function iX(t){let i=new Date(t);if(isNaN(i.getTime()))throw Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function iq(t){I(t.time)&&(t.time=iX(t.time))}class i0{options(){return this.ys}setOptions(t){this.ys=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?function(t){t.forEach(iq)}(t):iq(t)}createConverterToInternalObj(t){return N(0===t.length?null:iW(t[0].time)||I(t[0].time)?iG:iK)}key(t){return"object"==typeof t&&"Lc"in t?t.Lc:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){return void 0===t.Oc?new Date(1e3*t.Lc).getTime():new Date(Date.UTC(t.Oc.year,t.Oc.month-1,t.Oc.day)).getTime()}convertHorzItemToInternal(t){return F(t)?iK(t):iW(t)?iG(t):iG(iX(t))}updateFormatter(t){if(!this.ys)return;let i=t.dateFormat;this.ys.timeScale.timeVisible?this.Nc=new iJ({Tc:i,Rc:this.ys.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",Dc:" ",Vc:t.locale}):this.Nc=new iA(i,t.locale)}formatHorzItem(t){return this.Nc.jo(new Date(1e3*t.Lc))}formatTickmark(t,i){let e=function(t,i,e){switch(t){case 0:case 10:return i?e?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.ys.timeScale.timeVisible,this.ys.timeScale.secondsVisible),s=this.ys.timeScale;if(void 0!==s.tickMarkFormatter){let h=s.tickMarkFormatter(t.originalTime,e,i.locale);if(null!==h)return h}return function(t,i,e){let s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=!1,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=!1,s.hour="2-digit",s.minute="2-digit",s.second="2-digit"}let h=new Date(void 0===t.Oc?1e3*t.Lc:Date.UTC(t.Oc.year,t.Oc.month-1,t.Oc.day));return new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()).toLocaleString(e,s)}(t.time,e,i.locale)}maxTickMarkWeight(t){let i=t.reduce(iN,t[0]).weight;return i>30&&i<50&&(i=30),i}fillWeightsForPoints(t,i){!function(t,i=0){if(0===t.length)return;let e=0===i?null:t[i-1].time.Lc,s=null!==e?new Date(1e3*e):null,h=0;for(let r=i;r<t.length;++r){let i=t[r],n=new Date(1e3*i.time.Lc);null!==s&&(i.timeWeight=iH(n,s)),h+=i.time.Lc-(e||i.time.Lc),e=i.time.Lc,s=n}if(0===i&&t.length>1){let i=Math.ceil(h/(t.length-1)),e=new Date(1e3*(t[0].time.Lc-i));t[0].timeWeight=iH(new Date(1e3*t[0].time.Lc),e)}}(t,i)}static Wc(t){return W({localization:{dateFormat:"dd MMM 'yy"}},t??{})}}let i1="undefined"!=typeof window;function i2(){return!!i1&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function i3(){return!!i1&&/iPhone|iPad|iPod/.test(window.navigator.platform)}class i5{constructor(t,i,e){this.Fc=0,this.Hc=null,this.Uc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.$c=0,this.qc=null,this.Yc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.jc=null,this.Zc=!1,this.Kc=null,this.Xc=null,this.Gc=!1,this.Jc=!1,this.Qc=!1,this.td=null,this.sd=null,this.nd=null,this.ed=null,this.rd=null,this.hd=null,this.ad=null,this.ld=0,this.od=!1,this._d=!1,this.ud=!1,this.dd=0,this.fd=null,this.pd=!i3(),this.vd=t=>{this.md(t)},this.wd=t=>{if(this.gd(t)){let i=this.Md(t);if(++this.$c,this.qc&&this.$c>1){let{bd:e}=this.xd(i9(t),this.Yc);e<30&&!this.Qc&&this.Sd(i,this.yd.Cd),this.Pd()}}else{let i=this.Md(t);if(++this.Fc,this.Hc&&this.Fc>1){let{bd:e}=this.xd(i9(t),this.Uc);e<5&&!this.Jc&&this.kd(i,this.yd.Td),this.Rd()}}},this.Dd=t,this.yd=i,this.ys=e,this.Vd()}m(){null!==this.td&&(this.td(),this.td=null),null!==this.sd&&(this.sd(),this.sd=null),null!==this.ed&&(this.ed(),this.ed=null),null!==this.rd&&(this.rd(),this.rd=null),null!==this.hd&&(this.hd(),this.hd=null),null!==this.nd&&(this.nd(),this.nd=null),this.Id(),this.Rd()}Bd(t){this.ed&&this.ed();let i=this.Ad.bind(this);if(this.ed=()=>{this.Dd.removeEventListener("mousemove",i)},this.Dd.addEventListener("mousemove",i),this.gd(t))return;let e=this.Md(t);this.kd(e,this.yd.Ed),this.pd=!0}Rd(){null!==this.Hc&&clearTimeout(this.Hc),this.Fc=0,this.Hc=null,this.Uc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}Pd(){null!==this.qc&&clearTimeout(this.qc),this.$c=0,this.qc=null,this.Yc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}Ad(t){if(this.ud||null!==this.Xc||this.gd(t))return;let i=this.Md(t);this.kd(i,this.yd.zd),this.pd=!0}Ld(t){let i=i7(t.changedTouches,N(this.fd));if(null===i||(this.dd=i8(t),null!==this.ad)||this._d)return;this.od=!0;let{Od:e,Nd:s,bd:h}=this.xd(i9(i),N(this.Xc));if(this.Gc||!(h<5)){if(!this.Gc){let t=.5*e,i=s>=t&&!this.ys.Wd(),h=t>s&&!this.ys.Fd();i||h||(this._d=!0),this.Gc=!0,this.Qc=!0,this.Id(),this.Pd()}if(!this._d){let e=this.Md(t,i);this.Sd(e,this.yd.Hd),i4(t)}}}Ud(t){if(0!==t.button)return;let{bd:i}=this.xd(i9(t),N(this.Kc));if(i>=5&&(this.Jc=!0,this.Rd()),this.Jc){let i=this.Md(t);this.kd(i,this.yd.$d)}}xd(t,i){let e=Math.abs(i._t-t._t),s=Math.abs(i.ut-t.ut);return{Od:e,Nd:s,bd:e+s}}qd(t){let i=i7(t.changedTouches,N(this.fd));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.fd=null,this.dd=i8(t),this.Id(),this.Xc=null,this.hd&&(this.hd(),this.hd=null);let e=this.Md(t,i);if(this.Sd(e,this.yd.Yd),++this.$c,this.qc&&this.$c>1){let{bd:t}=this.xd(i9(i),this.Yc);t<30&&!this.Qc&&this.Sd(e,this.yd.Cd),this.Pd()}else this.Qc||(this.Sd(e,this.yd.jd),this.yd.jd&&i4(t));0===this.$c&&i4(t),0===t.touches.length&&this.Zc&&(this.Zc=!1,i4(t))}md(t){if(0!==t.button)return;let i=this.Md(t);if(this.Kc=null,this.ud=!1,this.rd&&(this.rd(),this.rd=null),i2()&&this.Dd.ownerDocument.documentElement.removeEventListener("mouseleave",this.vd),!this.gd(t))if(this.kd(i,this.yd.Zd),++this.Fc,this.Hc&&this.Fc>1){let{bd:e}=this.xd(i9(t),this.Uc);e<5&&!this.Jc&&this.kd(i,this.yd.Td),this.Rd()}else this.Jc||this.kd(i,this.yd.Kd)}Id(){null!==this.jc&&(clearTimeout(this.jc),this.jc=null)}Xd(t){if(null!==this.fd)return;let i=t.changedTouches[0];this.fd=i.identifier,this.dd=i8(t);let e=this.Dd.ownerDocument.documentElement;this.Qc=!1,this.Gc=!1,this._d=!1,this.Xc=i9(i),this.hd&&(this.hd(),this.hd=null);{let i=this.Ld.bind(this),s=this.qd.bind(this);this.hd=()=>{e.removeEventListener("touchmove",i),e.removeEventListener("touchend",s)},e.addEventListener("touchmove",i,{passive:!1}),e.addEventListener("touchend",s,{passive:!1}),this.Id(),this.jc=setTimeout(this.Gd.bind(this,t),240)}let s=this.Md(t,i);this.Sd(s,this.yd.Jd),this.qc||(this.$c=0,this.qc=setTimeout(this.Pd.bind(this),500),this.Yc=i9(i))}Qd(t){if(0!==t.button)return;let i=this.Dd.ownerDocument.documentElement;i2()&&i.addEventListener("mouseleave",this.vd),this.Jc=!1,this.Kc=i9(t),this.rd&&(this.rd(),this.rd=null);{let t=this.Ud.bind(this),e=this.md.bind(this);this.rd=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",e)},i.addEventListener("mousemove",t),i.addEventListener("mouseup",e)}if(this.ud=!0,this.gd(t))return;let e=this.Md(t);this.kd(e,this.yd.tf),this.Hc||(this.Fc=0,this.Hc=setTimeout(this.Rd.bind(this),500),this.Uc=i9(t))}Vd(){var t;this.Dd.addEventListener("mouseenter",this.Bd.bind(this)),this.Dd.addEventListener("touchcancel",this.Id.bind(this));{let t=this.Dd.ownerDocument,i=t=>{this.yd.if&&(t.composed&&this.Dd.contains(t.composedPath()[0])||t.target&&this.Dd.contains(t.target)||this.yd.if())};this.sd=()=>{t.removeEventListener("touchstart",i)},this.td=()=>{t.removeEventListener("mousedown",i)},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0})}i3()&&(this.nd=()=>{this.Dd.removeEventListener("dblclick",this.wd)},this.Dd.addEventListener("dblclick",this.wd)),this.Dd.addEventListener("mouseleave",this.sf.bind(this)),this.Dd.addEventListener("touchstart",this.Xd.bind(this),{passive:!0}),t=this.Dd,i1&&void 0!==window.chrome&&t.addEventListener("mousedown",t=>{if(1===t.button)return t.preventDefault(),!1}),this.Dd.addEventListener("mousedown",this.Qd.bind(this)),this.nf(),this.Dd.addEventListener("touchmove",()=>{},{passive:!1})}nf(){void 0===this.yd.ef&&void 0===this.yd.rf&&void 0===this.yd.hf||(this.Dd.addEventListener("touchstart",t=>this.af(t.touches),{passive:!0}),this.Dd.addEventListener("touchmove",t=>{if(2===t.touches.length&&null!==this.ad&&void 0!==this.yd.rf){let i=i6(t.touches[0],t.touches[1])/this.ld;this.yd.rf(this.ad,i),i4(t)}},{passive:!1}),this.Dd.addEventListener("touchend",t=>{this.af(t.touches)}))}af(t){1===t.length&&(this.od=!1),2!==t.length||this.od||this.Zc?this.lf():this._f(t)}_f(t){let i=this.Dd.getBoundingClientRect()||{left:0,top:0};this.ad={_t:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,ut:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.ld=i6(t[0],t[1]),void 0!==this.yd.ef&&this.yd.ef(),this.Id()}lf(){null!==this.ad&&(this.ad=null,void 0!==this.yd.hf&&this.yd.hf())}sf(t){if(this.ed&&this.ed(),this.gd(t)||!this.pd)return;let i=this.Md(t);this.kd(i,this.yd.uf),this.pd=!i3()}Gd(t){let i=i7(t.touches,N(this.fd));if(null===i)return;let e=this.Md(t,i);this.Sd(e,this.yd.cf),this.Qc=!0,this.Zc=!0}gd(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:i8(t)<this.dd+500}Sd(t,i){i&&i.call(this.yd,t)}kd(t,i){i&&i.call(this.yd,t)}Md(t,i){let e=i||t,s=this.Dd.getBoundingClientRect()||{left:0,top:0};return{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,localX:e.clientX-s.left,localY:e.clientY-s.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,df:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,ff:t.type,pf:e.target,$o:t.view,vf:()=>{"touchstart"!==t.type&&i4(t)}}}}function i6(t,i){let e=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(e*e+s*s)}function i4(t){t.cancelable&&t.preventDefault()}function i9(t){return{_t:t.pageX,ut:t.pageY}}function i8(t){return t.timeStamp||performance.now()}function i7(t,i){for(let e=0;e<t.length;++e)if(t[e].identifier===i)return t[e];return null}class et{constructor(t,i,e){this.mf=null,this.wf=null,this.gf=!0,this.Mf=null,this.bf=t,this.xf=t.Sf()[i],this.Cf=t.Sf()[e],this.yf=document.createElement("tr"),this.yf.style.height="1px",this.Pf=document.createElement("td"),this.Pf.style.position="relative",this.Pf.style.padding="0",this.Pf.style.margin="0",this.Pf.setAttribute("colspan","3"),this.kf(),this.yf.appendChild(this.Pf),this.gf=this.bf.N().layout.panes.enableResize,this.gf?this.Tf():(this.mf=null,this.wf=null)}m(){null!==this.wf&&this.wf.m()}Rf(){return this.yf}Df(){return O({width:this.xf.Df().width,height:1})}Vf(){return O({width:this.xf.Vf().width,height:+window.devicePixelRatio})}If(t,i,e){let s=this.Vf();t.fillStyle=this.bf.N().layout.panes.separatorColor,t.fillRect(i,e,s.width,s.height)}Pt(){this.kf(),this.bf.N().layout.panes.enableResize!==this.gf&&(this.gf=this.bf.N().layout.panes.enableResize,this.gf?this.Tf():(null!==this.mf&&(this.Pf.removeChild(this.mf.Bf),this.Pf.removeChild(this.mf.Af),this.mf=null),null!==this.wf&&(this.wf.m(),this.wf=null)))}Tf(){let t=document.createElement("div"),i=t.style;i.position="fixed",i.display="none",i.zIndex="49",i.top="0",i.left="0",i.width="100%",i.height="100%",i.cursor="row-resize",this.Pf.appendChild(t);let e=document.createElement("div"),s=e.style;s.position="absolute",s.zIndex="50",s.top="-4px",s.height="9px",s.width="100%",s.backgroundColor="",s.cursor="row-resize",this.Pf.appendChild(e);let h={Ed:this.Ef.bind(this),uf:this.zf.bind(this),tf:this.Lf.bind(this),Jd:this.Lf.bind(this),$d:this.Of.bind(this),Hd:this.Of.bind(this),Zd:this.Nf.bind(this),Yd:this.Nf.bind(this)};this.wf=new i5(e,h,{Wd:()=>!1,Fd:()=>!0}),this.mf={Af:e,Bf:t}}kf(){this.Pf.style.background=this.bf.N().layout.panes.separatorColor}Ef(t){null!==this.mf&&(this.mf.Af.style.backgroundColor=this.bf.N().layout.panes.separatorHoverColor)}zf(t){null!==this.mf&&null===this.Mf&&(this.mf.Af.style.backgroundColor="")}Lf(t){if(null===this.mf)return;let i=this.xf.Wf().fo()+this.Cf.Wf().fo(),e=i/(this.xf.Df().height+this.Cf.Df().height),s=30*e;i<=2*s||(this.Mf={Ff:t.pageY,Hf:this.xf.Wf().fo(),Uf:i-s,$f:i,qf:e,Yf:s},this.mf.Bf.style.display="block")}Of(t){let i=this.Mf;if(null===i)return;let e=(t.pageY-i.Ff)*i.qf,s=iw(i.Hf+e,i.Yf,i.Uf);this.xf.Wf().po(s),this.Cf.Wf().po(i.$f-s),this.bf.Qt().Bh()}Nf(t){null!==this.Mf&&null!==this.mf&&(this.Mf=null,this.mf.Bf.style.display="none")}}function ei(t,i,e){let s=(t.jf-i.jf)/(t.wt-i.wt);return Math.sign(s)*Math.min(Math.abs(s),e)}class ee{constructor(t,i,e,s){this.Zf=null,this.Kf=null,this.Xf=null,this.Gf=null,this.Jf=null,this.Qf=0,this.tp=0,this.ip=t,this.sp=i,this.np=e,this.Mn=s}ep(t,i){if(null!==this.Zf){if(this.Zf.wt===i)return void(this.Zf.jf=t);if(Math.abs(this.Zf.jf-t)<this.Mn)return}this.Gf=this.Xf,this.Xf=this.Kf,this.Kf=this.Zf,this.Zf={wt:i,jf:t}}le(t,i){var e,s,h,r,n,l;if(null===this.Zf||null===this.Kf||i-this.Zf.wt>50)return;let o=0,a=ei(this.Zf,this.Kf,this.sp),u=(e=this.Zf,s=this.Kf,e.jf-s.jf),c=[a],f=[u];if(o+=u,null!==this.Xf){let t=ei(this.Kf,this.Xf,this.sp);if(Math.sign(t)===Math.sign(a)){let i=(h=this.Kf,r=this.Xf,h.jf-r.jf);if(c.push(t),f.push(i),o+=i,null!==this.Gf){let t=ei(this.Xf,this.Gf,this.sp);if(Math.sign(t)===Math.sign(a)){let i=(n=this.Xf,l=this.Gf,n.jf-l.jf);c.push(t),f.push(i),o+=i}}}}let d=0;for(let t=0;t<c.length;++t)d+=f[t]/o*c[t];Math.abs(d)<this.ip||(this.Jf={jf:t,wt:i},this.tp=d,this.Qf=function(t,i){let e=Math.log(i);return Math.log(-(+e/t))/e}(Math.abs(d),this.np))}cu(t){let i=N(this.Jf),e=t-i.wt;return i.jf+this.tp*(Math.pow(this.np,e)-1)/Math.log(this.np)}uu(t){return null===this.Jf||this.rp(t)===this.Qf}rp(t){return Math.min(t-N(this.Jf).wt,this.Qf)}}class es{constructor(t,i){this.hp=void 0,this.ap=void 0,this.lp=void 0,this.ps=!1,this.op=t,this._p=i,this.up()}Pt(){this.up()}cp(){this.hp&&this.op.removeChild(this.hp),this.ap&&this.op.removeChild(this.ap),this.hp=void 0,this.ap=void 0}dp(){return this.ps!==this.fp()||this.lp!==this.pp()}pp(){return this._p.Qt().Ki().J(this._p.N().layout.textColor)>160?"dark":"light"}fp(){return this._p.N().layout.attributionLogo}vp(){let t=new URL(location.href);return t.hostname?"&utm_source="+t.hostname+t.pathname:""}up(){this.dp()&&(this.cp(),this.ps=this.fp(),this.ps&&(this.lp=this.pp(),this.ap=document.createElement("style"),this.ap.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.hp=document.createElement("a"),this.hp.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.vp()}`,this.hp.title="Charting by TradingView",this.hp.id="tv-attr-logo",this.hp.target="_blank",this.hp.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.hp.toggleAttribute("data-dark","dark"===this.lp),this.op.appendChild(this.ap),this.op.appendChild(this.hp)))}}function eh(t,i){let e=N(t.ownerDocument).createElement("canvas");t.appendChild(e);let s=function(t,i){if("device-pixel-content-box"===i.type)return new R(t,i.transform,i.options);throw Error("Unsupported binding target")}(e,{type:"device-pixel-content-box",options:{allowResizeObserver:!0},transform:(t,i)=>({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return s.resizeCanvasElement(i),s}function er(t){t.width=1,t.height=1,t.getContext("2d")?.clearRect(0,0,1,1)}function en(t,i,e,s){t.ih&&t.ih(i,e,s)}function el(t,i,e,s){t.nt(i,e,s)}function eo(t,i,e,s){for(let h of t(e,s)){let t=h.Tt(s);null!==t&&i(t)}}function ea(t,i){return e=>void 0===e.Wt||(e.Wt()?.wa()??"")!==i?[]:e.ta?.(t)??[]}function eu(t,i,e,s){if(!t.length)return;let h=0,r=t[0].$t(s,!0),n=1===i?e/2-(t[0].Wi()-r/2):t[0].Wi()-r/2-e/2;n=Math.max(0,n);for(let r=1;r<t.length;r++){let l=t[r],o=t[r-1],a=o.$t(s,!1),u=l.Wi(),c=o.Wi();if(1===i?u>c-a:u<c+a){let s=c-a*i;l.Fi(s);let r=s-i*a/2;if((1===i?r<0:r>e)&&n>0){let s=Math.min(1===i?-1-r:r-e,n);for(let e=h;e<t.length;e++)t[e].Fi(t[e].Wi()+i*s);n-=s}}else h=r,n=1===i?c-a-u:u-(c+a)}}class ec{constructor(t,i,e,s){this.Yi=null,this.mp=null,this.wp=!1,this.gp=new tC(200),this.Mp=null,this.bp=0,this.xp=!1,this.Sp=()=>{this.xp||this.yt.Cp().Qt().ar()},this.yp=()=>{this.xp||this.yt.Cp().Qt().ar()},this.yt=t,this.ys=i,this._l=i.layout,this.Au=e,this.Pp="left"===s,this.kp=ea("normal",s),this.Tp=ea("top",s),this.Rp=ea("bottom",s),this.Pf=document.createElement("div"),this.Pf.style.height="100%",this.Pf.style.overflow="hidden",this.Pf.style.width="25px",this.Pf.style.left="0",this.Pf.style.position="relative",this.Dp=eh(this.Pf,O({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let h=this.Dp.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this.Vp=eh(this.Pf,O({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let r=this.Vp.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0";let n={tf:this.Lf.bind(this),Jd:this.Lf.bind(this),$d:this.Of.bind(this),Hd:this.Of.bind(this),if:this.Ip.bind(this),Zd:this.Nf.bind(this),Yd:this.Nf.bind(this),Td:this.Bp.bind(this),Cd:this.Bp.bind(this),Ed:this.Ap.bind(this),uf:this.zf.bind(this)};this.wf=new i5(this.Vp.canvasElement,n,{Wd:()=>!this.ys.handleScroll.vertTouchDrag,Fd:()=>!0})}m(){this.wf.m(),this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose(),null!==this.Yi&&this.Yi.Hl().u(this),this.Yi=null}Rf(){return this.Pf}P(){return this._l.fontSize}Ep(){let t=this.Au.N();return this.Mp!==t.k&&(this.gp.In(),this.Mp=t.k),t}zp(){var t,i;if(null===this.Yi)return 0;let e=0,s=this.Ep(),h=N(this.Dp.canvasElement.getContext("2d",{colorSpace:this.yt.Cp().N().layout.colorSpace}));h.save();let r=this.Yi.Va();h.font=this.Lp(),r.length>0&&(e=Math.max(this.gp.Vi(h,r[0].$a),this.gp.Vi(h,r[r.length-1].$a)));let n=this.Op();for(let t=n.length;t--;){let i=this.gp.Vi(h,n[t].ri());i>e&&(e=i)}let l=this.Yi.zt();if(null!==l&&null!==this.mp&&2!==(t=this.ys.crosshair).mode&&t.horzLine.visible&&t.horzLine.labelVisible){let t=this.Yi.Ts(1,l),i=this.Yi.Ts(this.mp.height-2,l);e=Math.max(e,this.gp.Vi(h,this.Yi.Xi(Math.floor(Math.min(t,i))+.11111111111111,l)),this.gp.Vi(h,this.Yi.Xi(Math.ceil(Math.max(t,i))-.11111111111111,l)))}h.restore();let o=e||34;return(i=Math.ceil(s.S+s.C+s.I+s.B+5+o))+i%2}Np(t){null!==this.mp&&P(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`)}Wp(){return N(this.mp).width}_s(t){this.Yi!==t&&(null!==this.Yi&&this.Yi.Hl().u(this),this.Yi=t,t.Hl().i(this.il.bind(this),this))}Wt(){return this.Yi}In(){let t=this.yt.Wf();this.yt.Cp().Qt().Bo(t,N(this.Wt()))}Fp(t){if(null===this.mp)return;let i={colorSpace:this.yt.Cp().N().layout.colorSpace};if(1!==t){this.Hp(),this.Dp.applySuggestedBitmapSize();let t=Y(this.Dp,i);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t)}),this.yt.qp(t,this.Rp),this.Yp(t),this.yt.qp(t,this.kp),this.jp(t))}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.Zp(e),this.yt.qp(e,this.Tp))}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Pt(){this.Yi?.Va()}Lf(t){if(null===this.Yi||this.Yi.Zi()||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf();this.wp=!0,i.Po(e,this.Yi,t.localY)}Of(t){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf(),s=this.Yi;i.ko(e,s,t.localY)}Ip(){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let t=this.yt.Cp().Qt(),i=this.yt.Wf(),e=this.Yi;this.wp&&(this.wp=!1,t.To(i,e))}Nf(t){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf();this.wp=!1,i.To(e,this.Yi)}Bp(t){this.ys.handleScale.axisDoubleClickReset.price&&this.In()}Ap(t){null!==this.Yi&&(!this.yt.Cp().Qt().N().handleScale.axisPressedMouseMove.price||this.Yi.Le()||this.Yi.gl()||this.Kp(1))}zf(t){this.Kp(0)}Op(){let t=[],i=null===this.Yi?void 0:this.Yi;return(e=>{for(let s=0;s<e.length;++s){let h=e[s].Fs(this.yt.Wf(),i);for(let i=0;i<h.length;i++)t.push(h[i])}})(this.yt.Wf().Dt()),t}Up({context:t,bitmapSize:i}){let{width:e,height:s}=i,h=this.yt.Wf().Qt(),r=h.$(),n=h.xc();r===n?to(t,0,0,e,s,r):tc(t,0,0,e,s,r,n)}$p({context:t,bitmapSize:i,horizontalPixelRatio:e}){let s;if(null===this.mp||null===this.Yi||!this.Yi.N().borderVisible)return;t.fillStyle=this.Yi.N().borderColor;let h=Math.max(1,Math.floor(this.Ep().S*e));s=this.Pp?i.width-h:0,t.fillRect(s,0,h,i.height)}Yp(t){if(null===this.mp||null===this.Yi)return;let i=this.Yi.Va(),e=this.Yi.N(),s=this.Ep(),h=this.Pp?this.mp.width-s.C:0;e.borderVisible&&e.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:r,verticalPixelRatio:n})=>{t.fillStyle=e.borderColor;let l=Math.max(1,Math.floor(n)),o=Math.floor(.5*n),a=Math.round(s.C*r);for(let e of(t.beginPath(),i))t.rect(Math.floor(h*r),Math.round(e.Pa*n)-o,a,l);t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{t.font=this.Lp(),t.fillStyle=e.textColor??this._l.textColor,t.textAlign=this.Pp?"right":"left",t.textBaseline="middle";let r=this.Pp?Math.round(h-s.I):Math.round(h+s.C+s.I),n=i.map(i=>this.gp.Di(t,i.$a));for(let e=i.length;e--;){let s=i[e];t.fillText(s.$a,r,s.Pa+n[e])}})}Hp(){if(null===this.mp||null===this.Yi)return;let t=this.mp.height/2,i=[],e=this.Yi.Dt().slice(),s=this.yt.Wf(),h=this.Ep();this.Yi===s.$n()&&this.yt.Wf().Dt().forEach(t=>{s.Un(t)&&e.push(t)});let r=this.Yi.ba()[0],n=this.Yi;e.forEach(e=>{let h=e.Fs(s,n);h.forEach(t=>{t.Fi(null),t.Hi()&&i.push(t)}),r===e&&h.length>0&&(t=h[0].Bi())}),i.forEach(t=>t.Fi(t.Bi())),this.Yi.N().alignLabels&&this.Xp(i,h,t)}Xp(t,i,e){if(null===this.mp)return;let s=t.filter(t=>t.Bi()<=e),h=t.filter(t=>t.Bi()>e);for(let e of(s.sort((t,i)=>i.Bi()-t.Bi()),s.length&&h.length&&h.push(s[0]),h.sort((t,i)=>t.Bi()-i.Bi()),t)){let t=Math.floor(e.$t(i)/2),s=e.Bi();s>-t&&s<t&&e.Fi(t),s>this.mp.height-t&&s<this.mp.height+t&&e.Fi(this.mp.height-t)}eu(s,1,this.mp.height,i),eu(h,-1,this.mp.height,i)}jp(t){if(null===this.mp)return;let i=this.Op(),e=this.Ep(),s=this.Pp?"right":"left";i.forEach(i=>{i.Ui()&&i.Tt(N(this.Yi)).nt(t,e,this.gp,s)})}Zp(t){if(null===this.mp||null===this.Yi)return;let i=this.yt.Cp().Qt(),e=[],s=this.yt.Wf(),h=i.Yu().Fs(s,this.Yi);h.length&&e.push(h);let r=this.Ep(),n=this.Pp?"right":"left";e.forEach(i=>{i.forEach(i=>{i.Tt(N(this.Yi)).nt(t,r,this.gp,n)})})}Kp(t){this.Pf.style.cursor=1===t?"ns-resize":"default"}il(){let t=this.zp();this.bp<t&&this.yt.Cp().Qt().Bh(),this.bp=t}Lp(){return H(this._l.fontSize,this._l.fontFamily)}}function ef(t,i){return t.Jh?.(i)??[]}function ed(t,i){return t.Ws?.(i)??[]}function ep(t,i){return t.us?.(i)??[]}function em(t,i){return t.Kh?.(i)??[]}class eg{constructor(t,i){this.mp=O({width:0,height:0}),this.Gp=null,this.Jp=null,this.Qp=null,this.tv=null,this.iv=!1,this.sv=new B,this.nv=new B,this.ev=0,this.rv=!1,this.hv=null,this.av=!1,this.lv=null,this.ov=null,this.xp=!1,this.Sp=()=>{this.xp||null===this._v||this.ts().ar()},this.yp=()=>{this.xp||null===this._v||this.ts().ar()},this._p=t,this._v=i,this._v.zo().i(this.uv.bind(this),this,!0),this.cv=document.createElement("td"),this.cv.style.padding="0",this.cv.style.position="relative";let e=document.createElement("div");e.style.width="100%",e.style.height="100%",e.style.position="relative",e.style.overflow="hidden",this.dv=document.createElement("td"),this.dv.style.padding="0",this.fv=document.createElement("td"),this.fv.style.padding="0",this.cv.appendChild(e),this.Dp=eh(e,O({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let s=this.Dp.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Vp=eh(e,O({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let h=this.Vp.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",this.yf=document.createElement("tr"),this.yf.appendChild(this.dv),this.yf.appendChild(this.cv),this.yf.appendChild(this.fv),this.pv(),this.wf=new i5(this.Vp.canvasElement,this,{Wd:()=>null===this.hv&&!this._p.N().handleScroll.vertTouchDrag,Fd:()=>null===this.hv&&!this._p.N().handleScroll.horzTouchDrag})}m(){null!==this.Gp&&this.Gp.m(),null!==this.Jp&&this.Jp.m(),this.Qp=null,this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose(),null!==this._v&&(this._v.zo().u(this),this._v.m()),this.wf.m()}Wf(){return N(this._v)}vv(t){null!==this._v&&this._v.zo().u(this),this._v=t,null!==this._v&&this._v.zo().i(eg.prototype.uv.bind(this),this,!0),this.pv(),this._p.Sf().indexOf(this)===this._p.Sf().length-1?(this.Qp=this.Qp??new es(this.cv,this._p),this.Qp.Pt()):(this.Qp?.cp(),this.Qp=null)}Cp(){return this._p}Rf(){return this.yf}pv(){if(null!==this._v&&(this.mv(),0!==this.ts().js().length)){if(null!==this.Gp){let t=this._v.Co();this.Gp._s(N(t))}if(null!==this.Jp){let t=this._v.yo();this.Jp._s(N(t))}}}wv(){null!==this.Gp&&this.Gp.Pt(),null!==this.Jp&&this.Jp.Pt()}fo(){return null!==this._v?this._v.fo():0}po(t){this._v&&this._v.po(t)}Ed(t){if(!this._v)return;this.gv();let i=t.localX,e=t.localY;this.Mv(i,e,t)}tf(t){this.gv(),this.bv(),this.Mv(t.localX,t.localY,t)}zd(t){if(!this._v)return;this.gv();let i=t.localX,e=t.localY;this.Mv(i,e,t)}Kd(t){null!==this._v&&(this.gv(),this.xv(t))}Td(t){null!==this._v&&this.Sv(this.nv,t)}Cd(t){this.Td(t)}$d(t){this.gv(),this.Cv(t),this.Mv(t.localX,t.localY,t)}Zd(t){null!==this._v&&(this.gv(),this.rv=!1,this.yv(t))}jd(t){null!==this._v&&this.xv(t)}cf(t){if(this.rv=!0,null===this.hv){let i={x:t.localX,y:t.localY};this.Pv(i,i,t)}}uf(t){null!==this._v&&(this.gv(),this._v.Qt().Uu(null),this.kv())}Tv(){return this.sv}Rv(){return this.nv}ef(){this.ev=1,this.ts().hn()}rf(t,i){if(!this._p.N().handleScale.pinch)return;let e=5*(i-this.ev);this.ev=i,this.ts().tc(t._t,e)}Jd(t){this.rv=!1,this.av=null!==this.hv,this.bv();let i=this.ts().Yu();null!==this.hv&&i.Vt()&&(this.lv={x:i.si(),y:i.ni()},this.hv={x:t.localX,y:t.localY})}Hd(t){if(null===this._v)return;let i=t.localX,e=t.localY;if(null===this.hv)this.Cv(t);else{this.av=!1;let s=N(this.lv),h=s.x+(i-this.hv.x),r=s.y+(e-this.hv.y);this.Mv(h,r,t)}}Yd(t){0===this.Cp().N().trackingMode.exitMode&&(this.av=!0),this.Dv(),this.yv(t)}jn(t,i){let e=this._v;return null===e?null:iY(e,t,i)}Vv(t,i){N("left"===i?this.Gp:this.Jp).Np(O({width:t,height:this.mp.height}))}Df(){return this.mp}Np(t){P(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.cv.style.width=t.width+"px",this.cv.style.height=t.height+"px")}Iv(){let t=N(this._v);for(let i of(t.So(t.Co()),t.So(t.yo()),t.ba()))if(t.Un(i)){let e=i.Wt();null!==e&&t.So(e),i.Ns()}for(let i of t.Oo())i.Ns()}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Fp(t){if(0===t||null===this._v)return;t>1&&this.Iv(),null!==this.Gp&&this.Gp.Fp(t),null!==this.Jp&&this.Jp.Fp(t);let i={colorSpace:this._p.N().layout.colorSpace};if(1!==t){this.Dp.applySuggestedBitmapSize();let t=Y(this.Dp,i);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.Up(t)}),this._v&&(this.Bv(t,ef),this.Av(t),this.Bv(t,ed),this.Bv(t,ep)))}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.Ev(e),this.Bv(e,em),this.Bv(e,ep))}zv(){return this.Gp}Lv(){return this.Jp}qp(t,i){this.Bv(t,i)}uv(){null!==this._v&&this._v.zo().u(this),this._v=null}xv(t){this.Sv(this.sv,t)}Sv(t,i){let e=i.localX,s=i.localY;t.v()&&t.p(this.ts().At().Z_(e),{x:e,y:s},i)}Up({context:t,bitmapSize:i}){let{width:e,height:s}=i,h=this.ts(),r=h.$(),n=h.xc();r===n?to(t,0,0,e,s,n):tc(t,0,0,e,s,r,n)}Av(t){let i=N(this._v),e=i.Lo().lr().Tt(i);null!==e&&e.nt(t,!1)}Ev(t){this.Ov(t,ed,el,this.ts().Yu())}Bv(t,i){let e=N(this._v),s=e.Dt(),h=e.Oo();for(let e of h)this.Ov(t,i,en,e);for(let e of s)this.Ov(t,i,en,e);for(let e of h)this.Ov(t,i,el,e);for(let e of s)this.Ov(t,i,el,e)}Ov(t,i,e,s){let h=N(this._v),r=h.Qt().Hu(),n=null!==r&&r.Wo===s,l=null!==r&&n&&void 0!==r.Fo?r.Fo.Kn:void 0;eo(i,i=>e(i,t,n,l),s,h)}mv(){if(null===this._v)return;let t=this._p,i=this._v.Co().N().visible,e=this._v.yo().N().visible;i||null===this.Gp||(this.dv.removeChild(this.Gp.Rf()),this.Gp.m(),this.Gp=null),e||null===this.Jp||(this.fv.removeChild(this.Jp.Rf()),this.Jp.m(),this.Jp=null);let s=t.Qt().cc();i&&null===this.Gp&&(this.Gp=new ec(this,t.N(),s,"left"),this.dv.appendChild(this.Gp.Rf())),e&&null===this.Jp&&(this.Jp=new ec(this,t.N(),s,"right"),this.fv.appendChild(this.Jp.Rf()))}Nv(t){return t.df&&this.rv||null!==this.hv}Wv(t){return Math.max(0,Math.min(t,this.mp.width-1))}Fv(t){return Math.max(0,Math.min(t,this.mp.height-1))}Mv(t,i,e){this.ts().lc(this.Wv(t),this.Fv(i),e,N(this._v))}kv(){this.ts()._c()}Dv(){this.av&&(this.hv=null,this.kv())}Pv(t,i,e){this.hv=t,this.av=!1,this.Mv(i.x,i.y,e);let s=this.ts().Yu();this.lv={x:s.si(),y:s.ni()}}ts(){return this._p.Qt()}yv(t){if(!this.iv)return;let i=this.ts(),e=this.Wf();if(i.Vo(e,e.ks()),this.tv=null,this.iv=!1,i.rc(),null!==this.ov){let t=performance.now(),e=i.At();this.ov.le(e.iu(),t),this.ov.uu(t)||i._n(this.ov)}}gv(){this.hv=null}bv(){if(this._v){if(this.ts().hn(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)N(document.activeElement).blur();else{let t=document.getSelection();null!==t&&t.removeAllRanges()}this._v.ks().Zi()||this.ts().At().Zi()}}Cv(t){if(null===this._v)return;let i=this.ts(),e=i.At();if(e.Zi())return;let s=this._p.N(),h=s.handleScroll,r=s.kineticScroll;if((!h.pressedMouseMove||t.df)&&(!h.horzTouchDrag&&!h.vertTouchDrag||!t.df))return;let n=this._v.ks(),l=performance.now();if(null!==this.tv||this.Nv(t)||(this.tv={x:t.clientX,y:t.clientY,Lc:l,Hv:t.localX,Uv:t.localY}),null!==this.tv&&!this.iv&&(this.tv.x!==t.clientX||this.tv.y!==t.clientY)){if(t.df&&r.touch||!t.df&&r.mouse){let t=e.Q_();this.ov=new ee(.2/t,7/t,.997,15/t),this.ov.ep(e.iu(),this.tv.Lc)}else this.ov=null;n.Zi()||i.Ro(this._v,n,t.localY),i.nc(t.localX),this.iv=!0}this.iv&&(n.Zi()||i.Do(this._v,n,t.localY),i.ec(t.localX),null!==this.ov&&this.ov.ep(e.iu(),l))}}class ev{constructor(t,i,e,s,h){this.St=!0,this.mp=O({width:0,height:0}),this.Sp=()=>this.Fp(3),this.Pp="left"===t,this.Au=e.cc,this.ys=i,this.$v=s,this.qv=h,this.Pf=document.createElement("div"),this.Pf.style.width="25px",this.Pf.style.height="100%",this.Pf.style.overflow="hidden",this.Dp=eh(this.Pf,O({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp)}m(){this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose()}Rf(){return this.Pf}Df(){return this.mp}Np(t){P(this.mp,t)||(this.mp=t,this.Dp.resizeCanvasElement(t),this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`,this.St=!0)}Fp(t){if(t<3&&!this.St||0===this.mp.width||0===this.mp.height)return;this.St=!1,this.Dp.applySuggestedBitmapSize();let i=Y(this.Dp,{colorSpace:this.ys.layout.colorSpace});null!==i&&i.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t)})}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}$p({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(!this.$v())return;t.fillStyle=this.ys.timeScale.borderColor;let h=Math.floor(this.Au.N().S*e),r=Math.floor(this.Au.N().S*s),n=this.Pp?i.width-h:0;t.fillRect(n,0,h,r)}Up({context:t,bitmapSize:i}){to(t,0,0,i.width,i.height,this.qv())}}function eb(t){return i=>i.ia?.(t)??[]}let ey=eb("normal"),ew=eb("top"),eM=eb("bottom");class e_{constructor(t,i){this.Yv=null,this.jv=null,this.M=null,this.Zv=!1,this.mp=O({width:0,height:0}),this.Kv=new B,this.gp=new tC(5),this.xp=!1,this.Sp=()=>{this.xp||this._p.Qt().ar()},this.yp=()=>{this.xp||this._p.Qt().ar()},this._p=t,this.Yo=i,this.ys=t.N().layout,this.hp=document.createElement("tr"),this.Xv=document.createElement("td"),this.Xv.style.padding="0",this.Gv=document.createElement("td"),this.Gv.style.padding="0",this.Pf=document.createElement("td"),this.Pf.style.height="25px",this.Pf.style.padding="0",this.Jv=document.createElement("div"),this.Jv.style.width="100%",this.Jv.style.height="100%",this.Jv.style.position="relative",this.Jv.style.overflow="hidden",this.Pf.appendChild(this.Jv),this.Dp=eh(this.Jv,O({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let e=this.Dp.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Vp=eh(this.Jv,O({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let s=this.Vp.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.hp.appendChild(this.Xv),this.hp.appendChild(this.Pf),this.hp.appendChild(this.Gv),this.Qv(),this._p.Qt().do().i(this.Qv.bind(this),this),this.wf=new i5(this.Vp.canvasElement,this,{Wd:()=>!0,Fd:()=>!this._p.N().handleScroll.horzTouchDrag})}m(){this.wf.m(),null!==this.Yv&&this.Yv.m(),null!==this.jv&&this.jv.m(),this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose()}Rf(){return this.hp}tm(){return this.Yv}im(){return this.jv}tf(t){if(this.Zv)return;this.Zv=!0;let i=this._p.Qt();!i.At().Zi()&&this._p.N().handleScale.axisPressedMouseMove.time&&i.Qu(t.localX)}Jd(t){this.tf(t)}if(){let t=this._p.Qt();!t.At().Zi()&&this.Zv&&(this.Zv=!1,this._p.N().handleScale.axisPressedMouseMove.time&&t.ac())}$d(t){let i=this._p.Qt();!i.At().Zi()&&this._p.N().handleScale.axisPressedMouseMove.time&&i.hc(t.localX)}Hd(t){this.$d(t)}Zd(){this.Zv=!1;let t=this._p.Qt();t.At().Zi()&&!this._p.N().handleScale.axisPressedMouseMove.time||t.ac()}Yd(){this.Zd()}Td(){this._p.N().handleScale.axisDoubleClickReset.time&&this._p.Qt().cn()}Cd(){this.Td()}Ed(){this._p.Qt().N().handleScale.axisPressedMouseMove.time&&this.Kp(1)}uf(){this.Kp(0)}Df(){return this.mp}sm(){return this.Kv}nm(t,i,e){P(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`,this.Kv.p(t)),null!==this.Yv&&this.Yv.Np(O({width:i,height:t.height})),null!==this.jv&&this.jv.Np(O({width:e,height:t.height}))}rm(){let t=this.hm();return Math.ceil(t.S+t.C+t.P+t.A+t.V+t.am)}Pt(){this._p.Qt().At().Va()}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Fp(t){if(0===t)return;let i={colorSpace:this.ys.colorSpace};if(1!==t){this.Dp.applySuggestedBitmapSize();let e=Y(this.Dp,i);null!==e&&(e.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t),this.lm(e,eM)}),this.Yp(e),this.lm(e,ey)),null!==this.Yv&&this.Yv.Fp(t),null!==this.jv&&this.jv.Fp(t)}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.om([...this._p.Qt().js(),this._p.Qt().Yu()],e),this.lm(e,ew))}lm(t,i){let e=this._p.Qt().js();for(let s of e)eo(i,i=>en(i,t,!1,void 0),s,void 0);for(let s of e)eo(i,i=>el(i,t,!1,void 0),s,void 0)}Up({context:t,bitmapSize:i}){to(t,0,0,i.width,i.height,this._p.Qt().xc())}$p({context:t,bitmapSize:i,verticalPixelRatio:e}){if(this._p.N().timeScale.borderVisible){t.fillStyle=this._m();let s=Math.max(1,Math.floor(this.hm().S*e));t.fillRect(0,0,i.width,s)}}Yp(t){let i=this._p.Qt().At(),e=i.Va();if(!e||0===e.length)return;let s=this.Yo.maxTickMarkWeight(e),h=this.hm(),r=i.N();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this._m(),t.fillStyle=this._m();let r=Math.max(1,Math.floor(i)),n=Math.floor(.5*i);t.beginPath();let l=Math.round(h.C*s);for(let s=e.length;s--;){let h=Math.round(e[s].coord*i);t.rect(h-n,0,r,l)}t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{let i=h.S+h.C+h.A+h.P/2;for(let h of(t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.H(),t.font=this.Lp(),e))if(h.weight<s){let e=h.needAlignCoordinate?this.um(t,h.coord,h.label):h.coord;t.fillText(h.label,e,i)}for(let h of(this._p.N().timeScale.allowBoldLabels&&(t.font=this.dm()),e))if(h.weight>=s){let e=h.needAlignCoordinate?this.um(t,h.coord,h.label):h.coord;t.fillText(h.label,e,i)}})}um(t,i,e){let s=this.gp.Vi(t,e),h=Math.floor(i-s/2)+.5;return h<0?i+=Math.abs(0-h):h+s>this.mp.width&&(i-=Math.abs(this.mp.width-(h+s))),i}om(t,i){let e=this.hm();for(let s of t)for(let t of s.cs())t.Tt().nt(i,e)}_m(){return this._p.N().timeScale.borderColor}H(){return this.ys.textColor}W(){return this.ys.fontSize}Lp(){return H(this.W(),this.ys.fontFamily)}dm(){return H(this.W(),this.ys.fontFamily,"bold")}hm(){null===this.M&&(this.M={S:1,L:NaN,A:NaN,V:NaN,Ji:NaN,C:5,P:NaN,k:"",Gi:new tC,am:0});let t=this.M,i=this.Lp();if(t.k!==i){let e=this.W();t.P=e,t.k=i,t.A=3*e/12,t.V=3*e/12,t.Ji=9*e/12,t.L=0,t.am=4*e/12,t.Gi.In()}return this.M}Kp(t){this.Pf.style.cursor=1===t?"ew-resize":"default"}Qv(){let t=this._p.Qt(),i=t.N();i.leftPriceScale.visible||null===this.Yv||(this.Xv.removeChild(this.Yv.Rf()),this.Yv.m(),this.Yv=null),i.rightPriceScale.visible||null===this.jv||(this.Gv.removeChild(this.jv.Rf()),this.jv.m(),this.jv=null);let e={cc:this._p.Qt().cc()},s=()=>i.leftPriceScale.borderVisible&&t.At().N().borderVisible,h=()=>t.xc();i.leftPriceScale.visible&&null===this.Yv&&(this.Yv=new ev("left",i,e,s,h),this.Xv.appendChild(this.Yv.Rf())),i.rightPriceScale.visible&&null===this.jv&&(this.jv=new ev("right",i,e,s,h),this.Gv.appendChild(this.jv.Rf()))}}let eS=!!i1&&!!navigator.userAgentData&&navigator.userAgentData.brands.some(t=>t.brand.includes("Chromium"))&&!!i1&&(navigator?.userAgentData?.platform?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);class ex{constructor(t,i,e){var s;this.fm=[],this.pm=[],this.vm=0,this.ja=0,this.no=0,this.wm=0,this.gm=0,this.Mm=null,this.bm=!1,this.sv=new B,this.nv=new B,this.Vu=new B,this.xm=null,this.Sm=null,this.op=t,this.ys=i,this.Yo=e,this.hp=document.createElement("div"),this.hp.classList.add("tv-lightweight-charts"),this.hp.style.overflow="hidden",this.hp.style.direction="ltr",this.hp.style.width="100%",this.hp.style.height="100%",(s=this.hp).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.Cm=document.createElement("table"),this.Cm.setAttribute("cellspacing","0"),this.hp.appendChild(this.Cm),this.ym=this.Pm.bind(this),eO(this.ys)&&this.km(!0),this.ts=new iB(this.Bu.bind(this),this.ys,e),this.Qt().ju().i(this.Tm.bind(this),this),this.Rm=new e_(this,this.Yo),this.Cm.appendChild(this.Rm.Rf());let h=i.autoSize&&this.Dm(),r=this.ys.width,n=this.ys.height;if(h||0===r||0===n){let i=t.getBoundingClientRect();r=r||i.width,n=n||i.height}this.Vm(r,n),this.Im(),t.appendChild(this.hp),this.Bm(),this.ts.At().pu().i(this.ts.Bh.bind(this.ts),this),this.ts.do().i(this.ts.Bh.bind(this.ts),this)}Qt(){return this.ts}N(){return this.ys}Sf(){return this.fm}Am(){return this.Rm}m(){for(let t of(this.km(!1),0!==this.vm&&window.cancelAnimationFrame(this.vm),this.ts.ju().u(this),this.ts.At().pu().u(this),this.ts.do().u(this),this.ts.m(),this.fm))this.Cm.removeChild(t.Rf()),t.Tv().u(this),t.Rv().u(this),t.m();for(let t of(this.fm=[],this.pm))this.Em(t);this.pm=[],N(this.Rm).m(),null!==this.hp.parentElement&&this.hp.parentElement.removeChild(this.hp),this.Vu.m(),this.sv.m(),this.nv.m(),this.zm()}Vm(t,i,e=!1){if(this.ja===i&&this.no===t)return;let s=function(t){let i=Math.floor(t.width),e=Math.floor(t.height);return O({width:i-i%2,height:e-e%2})}(O({width:t,height:i}));this.ja=s.height,this.no=s.width;let h=this.ja+"px",r=this.no+"px";N(this.hp).style.height=h,N(this.hp).style.width=r,this.Cm.style.height=h,this.Cm.style.width=r,e?this.Lm(tM.gn(),performance.now()):this.ts.Bh()}Fp(t){void 0===t&&(t=tM.gn());for(let i=0;i<this.fm.length;i++)this.fm[i].Fp(t.en(i).tn);this.ys.timeScale.visible&&this.Rm.Fp(t.nn())}hr(t){let i=eO(this.ys);this.ts.hr(t);let e=eO(this.ys);e!==i&&this.km(e),t.layout?.panes&&this.Om(),this.Bm(),this.Nm(t)}Tv(){return this.sv}Rv(){return this.nv}ju(){return this.Vu}Wm(){null!==this.Mm&&(this.Lm(this.Mm,performance.now()),this.Mm=null);let t=this.Fm(null),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let e=N(i.getContext("2d"));return this.Fm(e),i}Hm(t){return("left"!==t||this.Um())&&("right"!==t||this.$m())&&0!==this.fm.length?N("left"===t?this.fm[0].zv():this.fm[0].Lv()).Wp():0}qm(){return this.ys.autoSize&&null!==this.xm}Af(){return this.hp}Ym(t){this.Sm=t,this.Sm?this.Af().style.setProperty("cursor",t):this.Af().style.removeProperty("cursor")}jm(){return this.Sm}Zm(t){return V(this.fm[t]).Df()}Om(){this.pm.forEach(t=>{t.Pt()})}Nm(t){(void 0!==t.autoSize||!this.xm||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.xm&&this.Dm(),!1===t.autoSize&&null!==this.xm&&this.zm(),t.autoSize||void 0===t.width&&void 0===t.height||this.Vm(t.width||this.no,t.height||this.ja))}Fm(t){let i=0,e=0,s=this.fm[0],h=(i,e)=>{let s=0;for(let h=0;h<this.fm.length;h++){let r=this.fm[h],n=N("left"===i?r.zv():r.Lv()),l=n.Vf();if(null!==t&&n.If(t,e,s),s+=l.height,h<this.fm.length-1){let i=this.pm[h],r=i.Vf();null!==t&&i.If(t,e,s),s+=r.height}}};this.Um()&&(h("left",0),i+=N(s.zv()).Vf().width);for(let s=0;s<this.fm.length;s++){let h=this.fm[s],r=h.Vf();if(null!==t&&h.If(t,i,e),e+=r.height,s<this.fm.length-1){let h=this.pm[s],r=h.Vf();null!==t&&h.If(t,i,e),e+=r.height}}i+=s.Vf().width,this.$m()&&(h("right",i),i+=N(s.Lv()).Vf().width);let r=(i,e,s)=>{N("left"===i?this.Rm.tm():this.Rm.im()).If(N(t),e,s)};if(this.ys.timeScale.visible){let i=this.Rm.Vf();if(null!==t){let h=0;this.Um()&&(r("left",h,e),h=N(s.zv()).Vf().width),this.Rm.If(t,h,e),h+=i.width,this.$m()&&r("right",h,e)}e+=i.height}return O({width:i,height:e})}Km(){var t,i,e;let s=0,h=0,r=0;for(let t of this.fm)this.Um()&&(h=Math.max(h,N(t.zv()).zp(),this.ys.leftPriceScale.minimumWidth)),this.$m()&&(r=Math.max(r,N(t.Lv()).zp(),this.ys.rightPriceScale.minimumWidth)),s+=t.fo();h=(i=h)+i%2,r=(e=r)+e%2;let n=this.no,l=this.ja,o=Math.max(n-h-r,0),a=+this.pm.length,u=this.ys.timeScale.visible,c=u?Math.max(this.Rm.rm(),this.ys.timeScale.minimumHeight):0,f=a+(c=(t=c)+t%2),d=l<f?0:l-f,p=d/s,m=0,g=window.devicePixelRatio||1;for(let t=0;t<this.fm.length;++t){let i=this.fm[t];i.vv(this.ts.$s()[t]);let e=0,s=0;e=Math.max(t===this.fm.length-1?Math.ceil((d-m)*g)/g:Math.round(i.fo()*p*g)/g,2),m+=e,i.Np(O({width:o,height:e})),this.Um()&&i.Vv(h,"left"),this.$m()&&i.Vv(r,"right"),i.Wf()&&this.ts.Zu(i.Wf(),e)}this.Rm.nm(O({width:u?o:0,height:c}),u?h:0,u?r:0),this.ts.vo(o),this.wm!==h&&(this.wm=h),this.gm!==r&&(this.gm=r)}km(t){t?this.hp.addEventListener("wheel",this.ym,{passive:!1}):this.hp.removeEventListener("wheel",this.ym)}Xm(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return eS?1/window.devicePixelRatio:1}Pm(t){if(!(0!==t.deltaX&&this.ys.handleScroll.mouseWheel||0!==t.deltaY&&this.ys.handleScale.mouseWheel))return;let i=this.Xm(t),e=i*t.deltaX/100,s=-i*t.deltaY/100;if(t.cancelable&&t.preventDefault(),0!==s&&this.ys.handleScale.mouseWheel){let i=Math.sign(s)*Math.min(1,Math.abs(s)),e=t.clientX-this.hp.getBoundingClientRect().left;this.Qt().tc(e,i)}0!==e&&this.ys.handleScroll.mouseWheel&&this.Qt().sc(-80*e)}Lm(t,i){let e=t.nn();3===e&&this.Gm(),3!==e&&2!==e||(this.Jm(t),this.Qm(t,i),this.Rm.Pt(),this.fm.forEach(t=>{t.wv()}),3===this.Mm?.nn()&&(this.Mm.vn(t),this.Gm(),this.Jm(this.Mm),this.Qm(this.Mm,i),t=this.Mm,this.Mm=null)),this.Fp(t)}Qm(t,i){for(let e of t.pn())this.mn(e,i)}Jm(t){let i=this.ts.$s();for(let e=0;e<i.length;e++)t.en(e).sn&&i[e].Ao()}mn(t,i){let e=this.ts.At();switch(t.an){case 0:e.mu();break;case 1:e.wu(t.Ft);break;case 2:e.dn(t.Ft);break;case 3:e.fn(t.Ft);break;case 4:e.eu();break;case 5:t.Ft.uu(i)||e.fn(t.Ft.cu(i))}}Bu(t){null!==this.Mm?this.Mm.vn(t):this.Mm=t,this.bm||(this.bm=!0,this.vm=window.requestAnimationFrame(t=>{if(this.bm=!1,this.vm=0,null!==this.Mm){let i=this.Mm;for(let e of(this.Mm=null,this.Lm(i,t),i.pn()))if(5===e.an&&!e.Ft.uu(t)){this.Qt()._n(e.Ft);break}}}))}Gm(){this.Im()}Em(t){this.Cm.removeChild(t.Rf()),t.m()}Im(){let t=this.ts.$s(),i=t.length,e=this.fm.length;for(let t=i;t<e;t++){let t=V(this.fm.pop());this.Cm.removeChild(t.Rf()),t.Tv().u(this),t.Rv().u(this),t.m();let i=this.pm.pop();void 0!==i&&this.Em(i)}for(let s=e;s<i;s++){let i=new eg(this,t[s]);if(i.Tv().i(this.tw.bind(this,i),this),i.Rv().i(this.iw.bind(this,i),this),this.fm.push(i),s>0){let t=new et(this,s-1,s);this.pm.push(t),this.Cm.insertBefore(t.Rf(),this.Rm.Rf())}this.Cm.insertBefore(i.Rf(),this.Rm.Rf())}for(let e=0;e<i;e++){let i=t[e],s=this.fm[e];s.Wf()!==i?s.vv(i):s.pv()}this.Bm(),this.Km()}sw(t,i,e,s){let h,r=new Map;if(null!==t&&this.ts.js().forEach(i=>{let e=i.Ks().Wr(t);null!==e&&r.set(i,e)}),null!==t){let i=this.ts.At().ss(t)?.originalTime;void 0!==i&&(h=i)}let n=this.Qt().Hu(),l=null!==n&&n.Wo instanceof is?n.Wo:void 0,o=null!==n&&void 0!==n.Fo?n.Fo.Zn:void 0,a=this.nw(s);return{ew:h,Re:t??void 0,rw:i??void 0,hw:-1!==a?a:void 0,aw:l,lw:r,ow:o,_w:e??void 0}}nw(t){let i=-1;if(t)i=this.fm.indexOf(t);else{let t=this.Qt().Yu().Us();null!==t&&(i=this.Qt().$s().indexOf(t))}return i}tw(t,i,e,s){this.sv.p(()=>this.sw(i,e,s,t))}iw(t,i,e,s){this.nv.p(()=>this.sw(i,e,s,t))}Tm(t,i,e){this.Ym(this.Qt().Hu()?.Uo??null),this.Vu.p(()=>this.sw(t,i,e))}Bm(){let t=this.ys.timeScale.visible?"":"none";this.Rm.Rf().style.display=t}Um(){return this.fm[0].Wf().Co().N().visible}$m(){return this.fm[0].Wf().yo().N().visible}Dm(){return"ResizeObserver"in window&&(this.xm=new ResizeObserver(t=>{let i=t[t.length-1];i&&this.Vm(i.contentRect.width,i.contentRect.height)}),this.xm.observe(this.op,{box:"border-box"}),!0)}zm(){null!==this.xm&&this.xm.disconnect(),this.xm=null}}function eO(t){return!!(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function eP(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.color&&(r.R=e.color),r}function eC(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.lineColor&&(r.vt=e.lineColor),void 0!==e.topColor&&(r.mr=e.topColor),void 0!==e.bottomColor&&(r.wr=e.bottomColor),r}function eR(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.topLineColor&&(r.gr=e.topLineColor),void 0!==e.bottomLineColor&&(r.Mr=e.bottomLineColor),void 0!==e.topFillColor1&&(r.br=e.topFillColor1),void 0!==e.topFillColor2&&(r.Sr=e.topFillColor2),void 0!==e.bottomFillColor1&&(r.Cr=e.bottomFillColor1),void 0!==e.bottomFillColor2&&(r.yr=e.bottomFillColor2),r}function ek(t,i,e,s){let h={Re:i,wt:t,Ft:[e.open,e.high,e.low,e.close],ew:s};return void 0!==e.color&&(h.R=e.color),h}function ez(t,i,e,s){let h={Re:i,wt:t,Ft:[e.open,e.high,e.low,e.close],ew:s};return void 0!==e.color&&(h.R=e.color),void 0!==e.borderColor&&(h.Ht=e.borderColor),void 0!==e.wickColor&&(h.vr=e.wickColor),h}function eY(t,i,e,s,h){let r=V(h)(e),n=Math.max(...r),l=Math.min(...r),o=r[r.length-1],{time:a,color:u,...c}=e;return{Re:i,wt:t,Ft:[o,n,l,o],ew:s,se:c,R:u}}function eE(t){return void 0!==t.Ft}function ej(t,i){return void 0!==i.customValues&&(t.uw=i.customValues),t}function eT(t){return(i,e,s,h,r,n)=>(n?n(s):void 0===s.open&&void 0===s.value)?ej({wt:i,Re:e,ew:h},s):ej(t(i,e,s,h,r),s)}function eL(t){return({Candlestick:eT(ez),Bar:eT(ek),Area:eT(eC),Baseline:eT(eR),Histogram:eT(eP),Line:eT(eP),Custom:eT(eY)})[t]}function eV(t){return{Re:0,cw:new Map,Hh:t}}function eN(t,i){if(void 0!==t&&0!==t.length)return{dw:i.key(t[0].wt),fw:i.key(t[t.length-1].wt)}}function eD(t){let i;return t.forEach(t=>{void 0===i&&(i=t.ew)}),V(i)}class eB{constructor(t){this.pw=new Map,this.mw=new Map,this.ww=new Map,this.gw=[],this.Yo=t}m(){this.pw.clear(),this.mw.clear(),this.ww.clear(),this.gw=[]}Mw(t,i){let e=0!==this.pw.size,s=!1,h=this.mw.get(t);if(void 0!==h)if(1===this.mw.size)e=!1,s=!0,this.pw.clear();else for(let i of this.gw)i.pointData.cw.delete(t)&&(s=!0);let r=[];if(0!==i.length){let e=i.map(t=>t.time),h=this.Yo.createConverterToInternalObj(i),n=eL(t.Rr()),l=t.da(),o=t.pa();r=i.map((i,r)=>{let a=h(i.time),u=this.Yo.key(a),c=this.pw.get(u);void 0===c&&(c=eV(a),this.pw.set(u,c),s=!0);let f=n(a,c.Re,i,e[r],l,o);return c.cw.set(t,f),f})}e&&this.bw(),this.xw(t,r);let n=-1;if(s){let t=[];this.pw.forEach(i=>{t.push({timeWeight:0,time:i.Hh,pointData:i,originalTime:eD(i.cw)})}),t.sort((t,i)=>this.Yo.key(t.time)-this.Yo.key(i.time)),n=this.Sw(t)}return this.Cw(t,n,function(t,i,e){let s=eN(t,e),h=eN(i,e);if(void 0!==s&&void 0!==h)return{yw:!1,zh:s.fw>=h.fw&&s.dw>=h.dw}}(this.mw.get(t),h,this.Yo))}vc(t){return this.Mw(t,[])}Pw(t,i,e){void 0===i.ew&&(i.ew=i.time),this.Yo.preprocessData(i);let s=this.Yo.createConverterToInternalObj([i])(i.time),h=this.ww.get(t);if(!e&&void 0!==h&&this.Yo.key(s)<this.Yo.key(h))throw Error(`Cannot update oldest data, last time=${h}, new time=${s}`);let r=this.pw.get(this.Yo.key(s));if(e&&void 0===r)throw Error("Cannot update non-existing data point when historicalUpdate is true");let n=void 0===r;void 0===r&&(r=eV(s),this.pw.set(this.Yo.key(s),r));let l=eL(t.Rr()),o=t.da(),a=t.pa(),u=l(s,r.Re,i,i.ew,o,a);r.cw.set(t,u),e?this.kw(t,u,r.Re):this.Tw(t,u);let c={zh:eE(u),yw:e};if(!n)return this.Cw(t,-1,c);let f={timeWeight:0,time:r.Hh,pointData:r,originalTime:eD(r.cw)},d=tZ(this.gw,this.Yo.key(f.time),(t,i)=>this.Yo.key(t.time)<i);this.gw.splice(d,0,f);for(let t=d;t<this.gw.length;++t)eW(this.gw[t].pointData,t);return this.Yo.fillWeightsForPoints(this.gw,d),this.Cw(t,d,c)}Tw(t,i){let e=this.mw.get(t);void 0===e&&(e=[],this.mw.set(t,e));let s=0!==e.length?e[e.length-1]:null;null===s||this.Yo.key(i.wt)>this.Yo.key(s.wt)?eE(i)&&e.push(i):eE(i)?e[e.length-1]=i:e.splice(-1,1),this.ww.set(t,i.wt)}kw(t,i,e){let s=this.mw.get(t);if(void 0===s)return;let h=tZ(s,e,(t,i)=>t.Re<i);eE(i)?s[h]=i:s.splice(h,1)}xw(t,i){0!==i.length?(this.mw.set(t,i.filter(eE)),this.ww.set(t,i[i.length-1].wt)):(this.mw.delete(t),this.ww.delete(t))}bw(){for(let t of this.gw)0===t.pointData.cw.size&&this.pw.delete(this.Yo.key(t.time))}Sw(t){let i=-1;for(let e=0;e<this.gw.length&&e<t.length;++e){let s=this.gw[e],h=t[e];if(this.Yo.key(s.time)!==this.Yo.key(h.time)){i=e;break}h.timeWeight=s.timeWeight,eW(h.pointData,e)}if(-1===i&&this.gw.length!==t.length&&(i=Math.min(this.gw.length,t.length)),-1===i)return -1;for(let e=i;e<t.length;++e)eW(t[e].pointData,e);return this.Yo.fillWeightsForPoints(t,i),this.gw=t,i}Rw(){if(0===this.mw.size)return null;let t=0;return this.mw.forEach(i=>{0!==i.length&&(t=Math.max(t,i[i.length-1].Re))}),t}Cw(t,i,e){let s={wo:new Map,At:{Y_:this.Rw()}};if(-1!==i)this.mw.forEach((i,h)=>{s.wo.set(h,{se:i,Dw:h===t?e:void 0})}),this.mw.has(t)||s.wo.set(t,{se:[],Dw:e}),s.At.Vw=this.gw,s.At.Iw=i;else{let i=this.mw.get(t);s.wo.set(t,{se:i||[],Dw:e})}return s}}function eW(t,i){t.Re=i,t.cw.forEach(t=>{t.Re=i})}function eF(t,i){return t.wt<i}function eA(t,i){return i<t.wt}function eI(t,i,e){let s=i.Uh(),h=i.bi(),r=tZ(t,s,eF),n=tH(t,h,eA);if(!e)return{from:r,to:n};let l=r,o=n;return r>0&&r<t.length&&t[r].wt>=s&&(l=r-1),n>0&&n<t.length&&t[n-1].wt<=h&&(o=n+1),{from:l,to:o}}class eQ{constructor(t,i,e){this.Bw=!0,this.Aw=!0,this.Ew=!0,this.zw=[],this.Lw=null,this.Jn=t,this.Qn=i,this.Ow=e}Pt(t){this.Bw=!0,"data"===t&&(this.Aw=!0),"options"===t&&(this.Ew=!0)}Tt(){return this.Jn.Vt()?(this.Nw(),null===this.Lw?null:this.Ww):null}Fw(){this.zw=this.zw.map(t=>({...t,...this.Jn.Rh().Dr(t.wt)}))}Hw(){this.Lw=null}Nw(){this.Aw&&(this.Uw(),this.Aw=!1),this.Ew&&(this.Fw(),this.Ew=!1),this.Bw&&(this.$w(),this.Bw=!1)}$w(){let t=this.Jn.Wt(),i=this.Qn.At();if(this.Hw(),i.Zi()||t.Zi())return;let e=i.ye();if(null===e||0===this.Jn.Ks().zr())return;let s=this.Jn.zt();null!==s&&(this.Lw=eI(this.zw,e,this.Ow),this.qw(t,i,s.Ft),this.Yw())}}class eJ{constructor(t,i){this.jw=t,this.Yi=i}nt(t,i,e){this.jw.draw(t,this.Yi,i,e)}}class e$ extends eQ{constructor(t,i,e){super(t,i,!1),this.sh=e,this.Ww=new eJ(this.sh.renderer(),i=>{let e=t.zt();return null===e?null:t.Wt().Nt(i,e.Ft)})}fa(t){return this.sh.priceValueBuilder(t)}va(t){return this.sh.isWhitespace(t)}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>({wt:i.Re,_t:NaN,...t.Dr(i.Re),Zw:i.se}))}qw(t,i){i.j_(this.zw,U(this.Lw))}Yw(){this.sh.update({bars:this.zw.map(eU),barSpacing:this.Qn.At().Q_(),visibleRange:this.Lw},this.Jn.N())}}function eU(t){return{x:t._t,time:t.wt,originalData:t.Zw,barColor:t.cr}}let eZ={color:"#2196f3"},eH=(t,i,e)=>new e$(t,i,D(e));function eG(t){let i={value:t.Ft[3],time:t.ew};return void 0!==t.uw&&(i.customValues=t.uw),i}function eK(t){let i=eG(t);return void 0!==t.R&&(i.color=t.R),i}function eX(t){let i=eG(t);return void 0!==t.vt&&(i.lineColor=t.vt),void 0!==t.mr&&(i.topColor=t.mr),void 0!==t.wr&&(i.bottomColor=t.wr),i}function eq(t){let i=eG(t);return void 0!==t.gr&&(i.topLineColor=t.gr),void 0!==t.Mr&&(i.bottomLineColor=t.Mr),void 0!==t.br&&(i.topFillColor1=t.br),void 0!==t.Sr&&(i.topFillColor2=t.Sr),void 0!==t.Cr&&(i.bottomFillColor1=t.Cr),void 0!==t.yr&&(i.bottomFillColor2=t.yr),i}function e0(t){let i={open:t.Ft[0],high:t.Ft[1],low:t.Ft[2],close:t.Ft[3],time:t.ew};return void 0!==t.uw&&(i.customValues=t.uw),i}function e1(t){let i=e0(t);return void 0!==t.R&&(i.color=t.R),i}function e2(t){let i=e0(t),{R:e,Ht:s,vr:h}=t;return void 0!==e&&(i.color=e),void 0!==s&&(i.borderColor=s),void 0!==h&&(i.wickColor=h),i}function e3(t){return({Area:eX,Line:eK,Baseline:eq,Histogram:eK,Bar:e1,Candlestick:e2,Custom:e5})[t]}function e5(t){let i=t.ew;return{...t.se,time:i}}let e6={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},e4={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},e9={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Z,panes:{enableResize:!0,separatorColor:"#E0E3EB",separatorHoverColor:"rgba(178, 181, 189, 0.2)"},attributionLogo:!0,colorSpace:"srgb",colorParsers:[]},e8={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0},e7={rightOffset:0,barSpacing:6,minBarSpacing:.5,maxBarSpacing:0,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0,ignoreWhitespaceIndices:!1};function st(){return{width:0,height:0,autoSize:!1,layout:e9,crosshair:e6,grid:e4,overlayPriceScales:{...e8},leftPriceScale:{...e8,visible:!1},rightPriceScale:{...e8,visible:!0},timeScale:e7,localization:{locale:i1?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class si{constructor(t,i,e){this.bf=t,this.Kw=i,this.Xw=e??0}applyOptions(t){this.bf.Qt().$u(this.Kw,t,this.Xw)}options(){return this.Yi().N()}width(){return tw(this.Kw)?this.bf.Hm(this.Kw):0}Yi(){return N(this.bf.Qt().qu(this.Kw,this.Xw)).Wt}}class se{constructor(t,i,e,s){this.bf=t,this.yt=e,this.Gw=i,this.Jw=s}getHeight(){return this.yt.$t()}setHeight(t){let i=this.bf.Qt(),e=i.Cc(this.yt);i.Xu(e,t)}paneIndex(){return this.bf.Qt().Cc(this.yt)}moveTo(t){let i=this.paneIndex();i!==t&&(L(t>=0&&t<this.bf.Sf().length,"Invalid pane index"),this.bf.Qt().Gu(i,t))}getSeries(){return this.yt.wo().map(t=>this.Gw(t))??[]}getHTMLElement(){return this.bf.Sf()[this.paneIndex()].Rf()}attachPrimitive(t){this.yt.ua(t),t.attached&&t.attached({chart:this.Jw,requestUpdate:()=>this.yt.Qt().Bh()})}detachPrimitive(t){this.yt.ca(t)}priceScale(t){if(null===this.yt.co(t))throw Error(`Cannot find price scale with id: ${t}`);return new si(this.bf,t,this.paneIndex())}}let ss={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class sh{constructor(t){this.ir=t}applyOptions(t){this.ir.hr(t)}options(){return this.ir.N()}Qw(){return this.ir}}class sr{constructor(t,i,e,s,h,r){this.tg=new B,this.Jn=t,this.ig=i,this.sg=e,this.Yo=h,this.Jw=s,this.ng=r}m(){this.tg.m()}priceFormatter(){return this.Jn.ra()}priceToCoordinate(t){let i=this.Jn.zt();return null===i?null:this.Jn.Wt().Nt(t,i.Ft)}coordinateToPrice(t){let i=this.Jn.zt();return null===i?null:this.Jn.Wt().Ts(t,i.Ft)}barsInLogicalRange(t){if(null===t)return null;let i=new iV(new ij(t.from,t.to)).o_(),e=this.Jn.Ks();if(e.Zi())return null;let s=e.Wr(i.Uh(),1),h=e.Wr(i.bi(),-1),r=N(e.Lr()),n=N(e.Zs());if(null!==s&&null!==h&&s.Re>h.Re)return{barsBefore:t.from-r,barsAfter:n-t.to};let l={barsBefore:null===s||s.Re===r?t.from-r:s.Re-r,barsAfter:null===h||h.Re===n?n-t.to:n-h.Re};return null!==s&&null!==h&&(l.from=s.ew,l.to=h.ew),l}setData(t){this.Yo,this.Jn.Rr(),this.ig.eg(this.Jn,t),this.rg("full")}update(t,i=!1){this.Jn.Rr(),this.ig.hg(this.Jn,t,i),this.rg("update")}dataByIndex(t,i){let e=this.Jn.Ks().Wr(t,i);return null===e?null:e3(this.seriesType())(e)}data(){let t=e3(this.seriesType());return this.Jn.Ks().Hr().map(i=>t(i))}subscribeDataChanged(t){this.tg.i(t)}unsubscribeDataChanged(t){this.tg._(t)}applyOptions(t){this.Jn.hr(t)}options(){return J(this.Jn.N())}priceScale(){return this.sg.priceScale(this.Jn.Wt().wa(),this.getPane().paneIndex())}createPriceLine(t){let i=W(J(ss),t);return new sh(this.Jn.Oh(i))}removePriceLine(t){this.Jn.Nh(t.Qw())}priceLines(){return this.Jn.Wh().map(t=>new sh(t))}seriesType(){return this.Jn.Rr()}attachPrimitive(t){this.Jn.ua(t),t.attached&&t.attached({chart:this.Jw,series:this,requestUpdate:()=>this.Jn.Qt().Bh(),horzScaleBehavior:this.Yo})}detachPrimitive(t){this.Jn.ca(t),t.detached&&t.detached(),this.Jn.Qt().Bh()}getPane(){let t=this.Jn,i=N(this.Jn.Qt().Hn(t));return this.ng(i)}moveToPane(t){this.Jn.Qt().Mc(this.Jn,t)}rg(t){this.tg.v()&&this.tg.p(t)}}class sn{constructor(t,i,e){this.ag=new B,this.g_=new B,this.Kv=new B,this.ts=t,this.uh=t.At(),this.Rm=i,this.uh.du().i(this.lg.bind(this)),this.uh.fu().i(this.og.bind(this)),this.Rm.sm().i(this._g.bind(this)),this.Yo=e}m(){this.uh.du().u(this),this.uh.fu().u(this),this.Rm.sm().u(this),this.ag.m(),this.g_.m(),this.Kv.m()}scrollPosition(){return this.uh.iu()}scrollToPosition(t,i){i?this.uh._u(t,1e3):this.ts.fn(t)}scrollToRealTime(){this.uh.ou()}getVisibleRange(){let t=this.uh.O_();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){let i={from:this.Yo.convertHorzItemToInternal(t.from),to:this.Yo.convertHorzItemToInternal(t.to)},e=this.uh.H_(i);this.ts.wc(e)}getVisibleLogicalRange(){let t=this.uh.L_();return null===t?null:{from:t.Uh(),to:t.bi()}}setVisibleLogicalRange(t){L(t.from<=t.to,"The from index cannot be after the to index."),this.ts.wc(t)}resetTimeScale(){this.ts.cn()}fitContent(){this.ts.mu()}logicalToCoordinate(t){let i=this.ts.At();return i.Zi()?null:i.qt(t)}coordinateToLogical(t){return this.uh.Zi()?null:this.uh.Z_(t)}timeToIndex(t,i){let e=this.Yo.convertHorzItemToInternal(t);return this.uh.A_(e,i)}timeToCoordinate(t){let i=this.timeToIndex(t,!1);return null===i?null:this.uh.qt(i)}coordinateToTime(t){let i=this.ts.At(),e=i.Z_(t),s=i.ss(e);return null===s?null:s.originalTime}width(){return this.Rm.Df().width}height(){return this.Rm.Df().height}subscribeVisibleTimeRangeChange(t){this.ag.i(t)}unsubscribeVisibleTimeRangeChange(t){this.ag._(t)}subscribeVisibleLogicalRangeChange(t){this.g_.i(t)}unsubscribeVisibleLogicalRangeChange(t){this.g_._(t)}subscribeSizeChange(t){this.Kv.i(t)}unsubscribeSizeChange(t){this.Kv._(t)}applyOptions(t){this.uh.hr(t)}options(){return{...J(this.uh.N()),barSpacing:this.uh.Q_()}}lg(){this.ag.v()&&this.ag.p(this.getVisibleRange())}og(){this.g_.v()&&this.g_.p(this.getVisibleLogicalRange())}_g(t){this.Kv.p(t.width,t.height)}}function sl(t){return function(t){if(Q(t.handleScale)){let i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(void 0!==t.handleScale){let{axisPressedMouseMove:i,axisDoubleClickReset:e}=t.handleScale;Q(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),Q(e)&&(t.handleScale.axisDoubleClickReset={time:e,price:e})}let i=t.handleScroll;Q(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i})}(t),t}class so{constructor(t,i,e){this.ug=new Map,this.cg=new Map,this.dg=new B,this.fg=new B,this.pg=new B,this.ku=new WeakMap,this.vg=new eB(i);let s=void 0===e?J(st()):W(J(st()),sl(e));this.mg=i,this.bf=new ex(t,s,i),this.bf.Tv().i(t=>{this.dg.v()&&this.dg.p(this.wg(t()))},this),this.bf.Rv().i(t=>{this.fg.v()&&this.fg.p(this.wg(t()))},this),this.bf.ju().i(t=>{this.pg.v()&&this.pg.p(this.wg(t()))},this);let h=this.bf.Qt();this.gg=new sn(h,this.bf.Am(),this.mg)}remove(){this.bf.Tv().u(this),this.bf.Rv().u(this),this.bf.ju().u(this),this.gg.m(),this.bf.m(),this.ug.clear(),this.cg.clear(),this.dg.m(),this.fg.m(),this.pg.m(),this.vg.m()}resize(t,i,e){this.autoSizeActive()||this.bf.Vm(t,i,e)}addCustomSeries(t,i={},e=0){let s,h=(s=D(t),{type:"Custom",isBuiltIn:!1,defaultOptions:{...eZ,...s.defaultOptions()},Mg:eH,bg:s});return this.xg(h,i,e)}addSeries(t,i={},e=0){return this.xg(t,i,e)}removeSeries(t){let i=V(this.ug.get(t)),e=this.vg.vc(i);this.bf.Qt().vc(i),this.Sg(e),this.ug.delete(t),this.cg.delete(i)}eg(t,i){this.Sg(this.vg.Mw(t,i))}hg(t,i,e){this.Sg(this.vg.Pw(t,i,e))}subscribeClick(t){this.dg.i(t)}unsubscribeClick(t){this.dg._(t)}subscribeCrosshairMove(t){this.pg.i(t)}unsubscribeCrosshairMove(t){this.pg._(t)}subscribeDblClick(t){this.fg.i(t)}unsubscribeDblClick(t){this.fg._(t)}priceScale(t,i=0){return new si(this.bf,t,i)}timeScale(){return this.gg}applyOptions(t){this.bf.hr(sl(t))}options(){return this.bf.N()}takeScreenshot(){return this.bf.Wm()}removePane(t){this.bf.Qt().Ku(t)}swapPanes(t,i){this.bf.Qt().Gu(t,i)}autoSizeActive(){return this.bf.qm()}chartElement(){return this.bf.Af()}panes(){return this.bf.Qt().$s().map(t=>this.Cg(t))}paneSize(t=0){let i=this.bf.Zm(t);return{height:i.height,width:i.width}}setCrosshairPosition(t,i,e){let s=this.ug.get(e);if(void 0===s)return;let h=this.bf.Qt().Hn(s);null!==h&&this.bf.Qt().oc(t,i,h)}clearCrosshairPosition(){this.bf.Qt()._c(!0)}horzBehaviour(){return this.mg}xg(t,i={},e=0){var s;L(void 0!==t.Mg),void 0!==(s=i.priceFormat)&&"custom"!==s.type&&void 0!==s.minMove&&void 0===s.precision&&(s.precision=function(t){if(t>=1)return 0;let i=0;for(;i<8&&!(1e-8>Math.abs(Math.round(t)-t));i++)t*=10;return i}(s.minMove)),"Candlestick"===t.type&&(void 0!==i.borderColor&&(i.borderUpColor=i.borderColor,i.borderDownColor=i.borderColor),void 0!==i.wickColor&&(i.wickUpColor=i.wickColor,i.wickDownColor=i.wickColor));let h=W(J(E),J(t.defaultOptions),i),r=t.Mg,n=new is(this.bf.Qt(),t.type,h,r,t.bg);this.bf.Qt().dc(n,e);let l=new sr(n,this,this,this,this.mg,t=>this.Cg(t));return this.ug.set(l,n),this.cg.set(n,l),l}Sg(t){let i=this.bf.Qt();i.uc(t.At.Y_,t.At.Vw,t.At.Iw),t.wo.forEach((t,i)=>i.ht(t.se,t.Dw)),i.At().R_(),i.J_()}yg(t){return V(this.cg.get(t))}wg(t){let i=new Map;t.lw.forEach((t,e)=>{let s=e.Rr(),h=e3(s)(t);if("Custom"!==s){var r;L(void 0!==(r=h).open||void 0!==r.value)}else{let t=e.pa();L(!t||!1===t(h))}i.set(this.yg(e),h)});let e=void 0!==t.aw&&this.cg.has(t.aw)?this.yg(t.aw):void 0;return{time:t.ew,logical:t.Re,point:t.rw,paneIndex:t.hw,hoveredSeries:e,hoveredObjectId:t.ow,seriesData:i,sourceEvent:t._w}}Cg(t){let i=this.ku.get(t);return i||(i=new se(this.bf,t=>this.yg(t),t,this),this.ku.set(t,i)),i}}class sa extends eQ{constructor(t,i){super(t,i,!0)}qw(t,i,e){i.j_(this.zw,U(this.Lw)),t.Dl(this.zw,e,U(this.Lw))}Pg(t,i){return{wt:t,gt:i,_t:NaN,ut:NaN}}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>{let e=i.Ft[3];return this.kg(i.Re,e,t)})}}function su(t,i,e,s,h,r,n){if(0===i.length||s.from>=i.length||s.to<=0)return;let{context:l,horizontalPixelRatio:o,verticalPixelRatio:a}=t,u=i[s.from],c=r(t,u),f=u;if(s.to-s.from<2){let i=h/2;l.beginPath();let e={_t:u._t-i,ut:u.ut},s={_t:u._t+i,ut:u.ut};l.moveTo(e._t*o,e.ut*a),l.lineTo(s._t*o,s.ut*a),n(t,c,e,s)}else{let h=(i,e)=>{n(t,c,f,e),l.beginPath(),c=i,f=e},d=f;l.beginPath(),l.moveTo(u._t*o,u.ut*a);for(let n=s.from+1;n<s.to;++n){let s=r(t,d=i[n]);switch(e){case 0:l.lineTo(d._t*o,d.ut*a);break;case 1:l.lineTo(d._t*o,i[n-1].ut*a),s!==c&&(h(s,d),l.lineTo(d._t*o,i[n-1].ut*a)),l.lineTo(d._t*o,d.ut*a);break;case 2:{let[t,e]=function(t,i,e){var s,h;let r=Math.max(0,i-1),n=Math.min(t.length-1,e+1);return[(s=t[i],h=sf(sc(t[e],t[r]),6),{_t:s._t+h._t,ut:s.ut+h.ut}),sc(t[e],sf(sc(t[n],t[i]),6))]}(i,n-1,n);l.bezierCurveTo(t._t*o,t.ut*a,e._t*o,e.ut*a,d._t*o,d.ut*a)}}1!==e&&s!==c&&(h(s,d),l.moveTo(d._t*o,d.ut*a))}(f!==d||f===d&&1===e)&&n(t,c,f,d)}}function sc(t,i){return{_t:t._t-i._t,ut:t.ut-i.ut}}function sf(t,i){return{_t:t._t/i,ut:t.ut/i}}function sd(t,i){let e=t.context;e.strokeStyle=i,e.stroke()}class sp extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et(t){if(null===this.rt)return;let{ot:i,lt:e,Tg:s,Rg:h,ct:r,Kt:n,Dg:l}=this.rt;if(null===e)return;let o=t.context;o.lineCap="butt",o.lineWidth=r*t.verticalPixelRatio,j(o,n),o.lineJoin="round";let a=this.Vg.bind(this);void 0!==h&&su(t,i,h,e,s,a,sd),l&&function(t,i,e,s,h){if(s.to-s.from<=0)return;let{horizontalPixelRatio:r,verticalPixelRatio:n,context:l}=t,o=null,a=Math.max(1,Math.floor(r))%2/2,u=e*n+a;for(let e=s.to-1;e>=s.from;--e){let s=i[e];if(s){let i=h(t,s);i!==o&&(l.beginPath(),null!==o&&l.fill(),l.fillStyle=i,o=i);let e=Math.round(s._t*r)+a,c=s.ut*n;l.moveTo(e,c),l.arc(e,c,u,0,2*Math.PI)}}l.fill()}(t,i,l,e,a)}}class sm extends sp{Vg(t,i){return i.vt}}class sg extends sa{constructor(){super(...arguments),this.Ww=new sm}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t=this.Jn.N(),i={ot:this.zw,Kt:t.lineStyle,Rg:t.lineVisible?t.lineType:void 0,ct:t.lineWidth,Dg:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,lt:this.Lw,Tg:this.Qn.At().Q_()};this.Ww.ht(i)}}function sv(t,i,e,s,h){let{context:r,horizontalPixelRatio:n,verticalPixelRatio:l}=i;r.lineTo(h._t*n,t*l),r.lineTo(s._t*n,t*l),r.closePath(),r.fillStyle=e,r.fill()}class sb extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et(t){if(null===this.rt)return;let{ot:i,lt:e,Tg:s,ct:h,Kt:r,Rg:n}=this.rt,l=this.rt.Og??(this.rt.Ng?0:t.mediaSize.height);if(null===e)return;let o=t.context;o.lineCap="butt",o.lineJoin="round",o.lineWidth=h,j(o,r),o.lineWidth=1,su(t,i,n,e,s,this.Wg.bind(this),sv.bind(null,l))}}class sy{Fg(t,i){let e=this.Hg,{Ug:s,$g:h,qg:r,Yg:n,Og:l,jg:o,Zg:a}=i;if(void 0===this.Kg||void 0===e||e.Ug!==s||e.$g!==h||e.qg!==r||e.Yg!==n||e.Og!==l||e.jg!==o||e.Zg!==a){let{verticalPixelRatio:e}=t,u=l||o>0?e:1,c=o*u,f=a===t.bitmapSize.height?a:a*u,d=t.context.createLinearGradient(0,c,0,f);if(d.addColorStop(0,s),null!=l){let t=iw(((l??0)*u-c)/(f-c),0,1);d.addColorStop(t,h),d.addColorStop(t,r)}d.addColorStop(1,n),this.Kg=d,this.Hg=i}return this.Kg}}class sw extends sb{constructor(){super(...arguments),this.Xg=new sy}Wg(t,i){let e=this.rt;return this.Xg.Fg(t,{Ug:i.br,$g:i.Sr,qg:i.Cr,Yg:i.yr,Og:e.Og,jg:e.jg??0,Zg:e.Zg??t.bitmapSize.height})}}class sM extends sp{constructor(){super(...arguments),this.Gg=new sy}Vg(t,i){let e=this.rt;return this.Gg.Fg(t,{Ug:i.gr,$g:i.gr,qg:i.Mr,Yg:i.Mr,Og:e.Og,jg:e.jg??0,Zg:e.Zg??t.bitmapSize.height})}}class s_ extends sa{constructor(t,i){super(t,i),this.Ww=new tt,this.Jg=new sw,this.Qg=new sM,this.Ww.st([this.Jg,this.Qg])}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t,i,e=this.Jn.zt();if(null===e)return;let s=this.Jn.N(),h=this.Jn.Wt().Nt(s.baseValue.price,e.Ft),r=this.Qn.At().Q_();if(null!==this.Lw&&0!==this.zw.length){if(s.relativeGradient){t=this.zw[this.Lw.from].ut,i=this.zw[this.Lw.from].ut;for(let e=this.Lw.from;e<this.Lw.to;e++){let s=this.zw[e];s.ut<t&&(t=s.ut),s.ut>i&&(i=s.ut)}}this.Jg.ht({ot:this.zw,ct:s.lineWidth,Kt:s.lineStyle,Rg:s.lineType,Og:h,jg:t,Zg:i,Ng:!1,lt:this.Lw,Tg:r}),this.Qg.ht({ot:this.zw,ct:s.lineWidth,Kt:s.lineStyle,Rg:s.lineVisible?s.lineType:void 0,Dg:s.pointMarkersVisible?s.pointMarkersRadius||s.lineWidth/2+2:void 0,Og:h,jg:t,Zg:i,lt:this.Lw,Tg:r})}}}class sS extends sb{constructor(){super(...arguments),this.Xg=new sy}Wg(t,i){return this.Xg.Fg(t,{Ug:i.mr,$g:"",qg:"",Yg:i.wr,jg:this.rt?.jg??0,Zg:t.bitmapSize.height})}}class sx extends sa{constructor(t,i){super(t,i),this.Ww=new tt,this.tM=new sS,this.iM=new sm,this.Ww.st([this.tM,this.iM])}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t,i=this.Jn.N();if(null!==this.Lw&&0!==this.zw.length){if(i.relativeGradient){t=this.zw[this.Lw.from].ut;for(let i=this.Lw.from;i<this.Lw.to;i++){let e=this.zw[i];e.ut<t&&(t=e.ut)}}this.tM.ht({Rg:i.lineType,ot:this.zw,Kt:i.lineStyle,ct:i.lineWidth,Og:null,jg:t,Ng:i.invertFilledArea,lt:this.Lw,Tg:this.Qn.At().Q_()}),this.iM.ht({Rg:i.lineVisible?i.lineType:void 0,ot:this.zw,Kt:i.lineStyle,ct:i.lineWidth,lt:this.Lw,Tg:this.Qn.At().Q_(),Dg:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0})}}}class sO extends ti{constructor(){super(...arguments),this.Yt=null,this.sM=0,this.nM=0}ht(t){this.Yt=t}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.Yt||0===this.Yt.Ks.length||null===this.Yt.lt)return;this.sM=this.eM(i),this.sM>=2&&Math.max(1,Math.floor(i))%2!=this.sM%2&&this.sM--,this.nM=this.Yt.rM?Math.min(this.sM,Math.floor(i)):this.sM;let s=null,h=this.nM<=this.sM&&this.Yt.Q_>=Math.floor(1.5*i);for(let r=this.Yt.lt.from;r<this.Yt.lt.to;++r){let n=this.Yt.Ks[r];s!==n.cr&&(t.fillStyle=n.cr,s=n.cr);let l=Math.floor(.5*this.nM),o=Math.round(n._t*i),a=o-l,u=this.nM,c=a+u-1,f=Math.min(n.Al,n.El),d=Math.max(n.Al,n.El),p=Math.round(f*e)-l,m=Math.max(Math.round(d*e)+l-p,this.nM);t.fillRect(a,p,u,m);let g=Math.ceil(1.5*this.sM);if(h){if(this.Yt.hM){let i=o-g,s=Math.max(p,Math.round(n.Bl*e)-l),h=s+u-1;h>p+m-1&&(s=(h=p+m-1)-u+1),t.fillRect(i,s,a-i,h-s+1)}let i=o+g,s=Math.max(p,Math.round(n.zl*e)-l),h=s+u-1;h>p+m-1&&(s=(h=p+m-1)-u+1),t.fillRect(c+1,s,i-c,h-s+1)}}}eM(t){return Math.max(Math.floor(t),Math.floor(Math.floor(.3*N(this.Yt).Q_*t)))}}class sP extends eQ{constructor(t,i){super(t,i,!1)}qw(t,i,e){i.j_(this.zw,U(this.Lw)),t.Il(this.zw,e,U(this.Lw))}aM(t,i,e){return{wt:t,qh:i.Ft[0],Yh:i.Ft[1],jh:i.Ft[2],Zh:i.Ft[3],_t:NaN,Bl:NaN,Al:NaN,El:NaN,zl:NaN}}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>this.kg(i.Re,i,t))}}class sC extends sP{constructor(){super(...arguments),this.Ww=new sO}kg(t,i,e){return{...this.aM(t,i,e),...e.Dr(t)}}Yw(){let t=this.Jn.N();this.Ww.ht({Ks:this.zw,Q_:this.Qn.At().Q_(),hM:t.openVisible,rM:t.thinBars,lt:this.Lw})}}class sR extends ti{constructor(){super(...arguments),this.Yt=null,this.sM=0}ht(t){this.Yt=t}et(t){if(null===this.Yt||0===this.Yt.Ks.length||null===this.Yt.lt)return;let{horizontalPixelRatio:i}=t;this.sM=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);let e=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.min(Math.floor(t*e*i),Math.floor(t*i));return Math.max(Math.floor(i),s)}(this.Yt.Q_,i),this.sM>=2&&Math.floor(i)%2!=this.sM%2&&this.sM--;let e=this.Yt.Ks;this.Yt.lM&&this.oM(t,e,this.Yt.lt),this.Yt.Mi&&this.$p(t,e,this.Yt.lt);let s=this._M(i);(!this.Yt.Mi||this.sM>2*s)&&this.uM(t,e,this.Yt.lt)}oM(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=Math.min(Math.floor(h),Math.floor(this.Yt.Q_*h)),o=Math.floor(.5*(l=Math.max(Math.floor(h),Math.min(l,this.sM)))),a=null;for(let t=e.from;t<e.to;t++){let e=i[t];e.pr!==n&&(s.fillStyle=e.pr,n=e.pr);let u=Math.round(Math.min(e.Bl,e.zl)*r),c=Math.round(Math.max(e.Bl,e.zl)*r),f=Math.round(e.Al*r),d=Math.round(e.El*r),p=Math.round(h*e._t)-o,m=p+l-1;null!==a&&(p=Math.min(p=Math.max(a+1,p),m));let g=m-p+1;s.fillRect(p,f,g,u-f),s.fillRect(p,c+1,g,d-c),a=m}}_M(t){let i=Math.floor(+t);this.sM<=2*i&&(i=Math.floor(.5*(this.sM-1)));let e=Math.max(Math.floor(t),i);return this.sM<=2*e?Math.max(Math.floor(t),Math.floor(+t)):e}$p(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=this._M(h),o=null;for(let t=e.from;t<e.to;t++){let e=i[t];e.dr!==n&&(s.fillStyle=e.dr,n=e.dr);let f=Math.round(e._t*h)-Math.floor(.5*this.sM),d=f+this.sM-1,p=Math.round(Math.min(e.Bl,e.zl)*r),m=Math.round(Math.max(e.Bl,e.zl)*r);if(null!==o&&(f=Math.min(f=Math.max(o+1,f),d)),this.Yt.Q_*h>2*l){var a,u,c;a=f,u=d-f+1,c=m-p+1,s.fillRect(a+l,p,u-2*l,l),s.fillRect(a+l,p+c-l,u-2*l,l),s.fillRect(a,p,l,c),s.fillRect(a+u-l,p,l,c)}else{let t=d-f+1;s.fillRect(f,p,t,m-p+1)}o=d}}uM(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=this._M(h);for(let t=e.from;t<e.to;t++){let e=i[t],o=Math.round(Math.min(e.Bl,e.zl)*r),a=Math.round(Math.max(e.Bl,e.zl)*r),u=Math.round(e._t*h)-Math.floor(.5*this.sM),c=u+this.sM-1;if(e.cr!==n){let t=e.cr;s.fillStyle=t,n=t}this.Yt.Mi&&(u+=l,o+=l,c-=l,a-=l),o>a||s.fillRect(u,o,c-u+1,a-o+1)}}}class sk extends sP{constructor(){super(...arguments),this.Ww=new sR}kg(t,i,e){return{...this.aM(t,i,e),...e.Dr(t)}}Yw(){let t=this.Jn.N();this.Ww.ht({Ks:this.zw,Q_:this.Qn.At().Q_(),lM:t.wickVisible,Mi:t.borderVisible,lt:this.Lw})}}class sz extends ti{constructor(){super(...arguments),this.Yt=null,this.cM=[]}ht(t){this.Yt=t,this.cM=[]}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.Yt||0===this.Yt.ot.length||null===this.Yt.lt)return;this.cM.length||this.dM(i);let s=Math.max(1,Math.floor(e)),h=Math.round(this.Yt.fM*e)-Math.floor(s/2),r=h+s;for(let i=this.Yt.lt.from;i<this.Yt.lt.to;i++){let n,l,o=this.Yt.ot[i],a=this.cM[i-this.Yt.lt.from],u=Math.round(o.ut*e);t.fillStyle=o.cr,u<=h?(n=u,l=r):(n=h,l=u-Math.floor(s/2)+s),t.fillRect(a.Uh,n,a.bi-a.Uh+1,l-n)}}dM(t){if(null===this.Yt||0===this.Yt.ot.length||null===this.Yt.lt)return void(this.cM=[]);let i=1>=Math.ceil(this.Yt.Q_*t)?0:Math.max(1,Math.floor(t)),e=Math.round(this.Yt.Q_*t)-i;this.cM=Array(this.Yt.lt.to-this.Yt.lt.from);for(let i=this.Yt.lt.from;i<this.Yt.lt.to;i++){let s,h,r=this.Yt.ot[i],n=Math.round(r._t*t);if(e%2){let t=(e-1)/2;s=n-t,h=n+t}else{let t=e/2;s=n-t,h=n+t-1}this.cM[i-this.Yt.lt.from]={Uh:s,bi:h,pM:n,ne:r._t*t,wt:r.wt}}for(let t=this.Yt.lt.from+1;t<this.Yt.lt.to;t++){let e=this.cM[t-this.Yt.lt.from],s=this.cM[t-this.Yt.lt.from-1];e.wt===s.wt+1&&e.Uh-s.bi!==i+1&&(s.pM>s.ne?s.bi=e.Uh-i-1:e.Uh=s.bi+i+1)}let s=Math.ceil(this.Yt.Q_*t);for(let t=this.Yt.lt.from;t<this.Yt.lt.to;t++){let i=this.cM[t-this.Yt.lt.from];i.bi<i.Uh&&(i.bi=i.Uh),s=Math.min(i.bi-i.Uh+1,s)}if(i>0&&s<4)for(let t=this.Yt.lt.from;t<this.Yt.lt.to;t++){let i=this.cM[t-this.Yt.lt.from];i.bi-i.Uh+1>s&&(i.pM>i.ne?i.bi-=1:i.Uh+=1)}}}class sY extends sa{constructor(){super(...arguments),this.Ww=new sz}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t={ot:this.zw,Q_:this.Qn.At().Q_(),lt:this.Lw,fM:this.Jn.Wt().Nt(this.Jn.N().base,N(this.Jn.zt()).Ft)};this.Ww.ht(t)}}class sE{constructor(t,i){this.yt=t,this.vM=i,this.mM()}detach(){this.yt.detachPrimitive(this.vM)}getPane(){return this.yt}applyOptions(t){this.vM.hr?.(t)}mM(){this.yt.attachPrimitive(this.vM)}}let sj={visible:!0,horzAlign:"center",vertAlign:"center",lines:[]},sT={color:"rgba(0, 0, 0, 0.5)",fontSize:48,fontFamily:Z,fontStyle:"",text:""};class sL{constructor(t){this.wM=new Map,this.Yt=t}draw(t){t.useMediaCoordinateSpace(t=>{if(!this.Yt.visible)return;let{context:i,mediaSize:e}=t,s=0;for(let t of this.Yt.lines){if(0===t.text.length)continue;i.font=t.k;let h=this.gM(i,t.text);h>e.width?t.hu=e.width/h:t.hu=1,s+=t.lineHeight*t.hu}let h=0;switch(this.Yt.vertAlign){case"top":h=0;break;case"center":h=Math.max((e.height-s)/2,0);break;case"bottom":h=Math.max(e.height-s,0)}for(let t of this.Yt.lines){i.save(),i.fillStyle=t.color;let s=0;switch(this.Yt.horzAlign){case"left":i.textAlign="left",s=t.lineHeight/2;break;case"center":i.textAlign="center",s=e.width/2;break;case"right":i.textAlign="right",s=e.width-1-t.lineHeight/2}i.translate(s,h),i.textBaseline="top",i.font=t.k,i.scale(t.hu,t.hu),i.fillText(t.text,0,t.MM),i.restore(),h+=t.lineHeight*t.hu}})}gM(t,i){let e=this.bM(t.font),s=e.get(i);return void 0===s&&(s=t.measureText(i).width,e.set(i,s)),s}bM(t){let i=this.wM.get(t);return void 0===i&&(i=new Map,this.wM.set(t,i)),i}}class sV{constructor(t){this.ys=sD(t)}Pt(t){this.ys=sD(t)}renderer(){return new sL(this.ys)}}function sN(t){return{...t,k:H(t.fontSize,t.fontFamily,t.fontStyle),lineHeight:t.lineHeight||1.2*t.fontSize,MM:0,hu:0}}function sD(t){return{...t,lines:t.lines.map(sN)}}function sB(t){return{...sT,...t}}function sW(t){return{...sj,...t,lines:t.lines?.map(sB)??[]}}class sF{constructor(t){this.ys=sW(t),this.xM=[new sV(this.ys)]}updateAllViews(){this.xM.forEach(t=>t.Pt(this.ys))}paneViews(){return this.xM}attached({requestUpdate:t}){this.SM=t}detached(){this.SM=void 0}hr(t){this.ys=sW({...this.ys,...t}),this.SM&&this.SM()}}let sA={alpha:1,padding:0};class sI{constructor(t){this.Yt=t}draw(t){t.useMediaCoordinateSpace(t=>{let i=t.context,e=this.CM(this.Yt,t.mediaSize);e&&this.Yt.yM&&(i.globalAlpha=this.Yt.alpha??1,i.drawImage(this.Yt.yM,e._t,e.ut,e.Qi,e.$t))})}CM(t,i){let{maxHeight:e,maxWidth:s,PM:h,kM:r,padding:n}=t,l=Math.round(i.width/2),o=Math.round(i.height/2),a=n??0,u=i.width-2*a,c=i.height-2*a;e&&(c=Math.min(c,e)),s&&(u=Math.min(u,s));let f=Math.min(u/r,c/h),d=r*f,p=h*f;return{_t:l-.5*d,ut:o-.5*p,$t:p,Qi:d}}}class sQ{constructor(t){this.TM=null,this.RM=0,this.DM=0,this.ys=t,this.M=sJ(this.ys,this.TM,this.RM,this.DM)}VM(t){void 0!==t.IM&&(this.RM=t.IM),void 0!==t.BM&&(this.DM=t.BM),void 0!==t.AM&&(this.TM=t.AM),this.Pt()}EM(t){this.ys=t,this.Pt()}zOrder(){return"bottom"}Pt(){this.M=sJ(this.ys,this.TM,this.RM,this.DM)}renderer(){return new sI(this.M)}}function sJ(t,i,e,s){return{...t,yM:i,kM:e,PM:s}}class s${constructor(t,i){this.zM=null,this.LM=t,this.ys={...sA,...i},this.xM=[new sQ(this.ys)]}updateAllViews(){this.xM.forEach(t=>t.Pt())}paneViews(){return this.xM}attached(t){let{requestUpdate:i}=t;this.OM=i,this.zM=new Image,this.zM.onload=()=>{let t=this.zM?.naturalHeight??1,i=this.zM?.naturalWidth??1;this.xM.forEach(e=>e.VM({BM:t,IM:i,AM:this.zM})),this.OM&&this.OM()},this.zM.src=this.LM}detached(){this.OM=void 0,this.zM=null}hr(t){var i;this.ys=(i={...this.ys,...t},{...sA,...i}),this.NM(),this.SM&&this.SM()}SM(){this.OM&&this.OM()}NM(){this.xM.forEach(t=>t.EM(this.ys))}}class sU{constructor(t,i){this.Jn=t,this.ah=i,this.mM()}detach(){this.Jn.detachPrimitive(this.ah)}getSeries(){return this.Jn}applyOptions(t){this.ah&&this.ah.hr&&this.ah.hr(t)}mM(){this.Jn.attachPrimitive(this.ah)}}function sZ(t,i){return iM(Math.min(Math.max(t,12),30)*i)}function sH(t,i){switch(t){case"arrowDown":case"arrowUp":return sZ(i,1);case"circle":return sZ(i,.8);case"square":return sZ(i,.7)}}function sG(t){let i=Math.ceil(sZ(t,1));return i%2!=0?i-1:i}function sK(t){return Math.max(sZ(t,.1),3)}function sX(t,i,e){return i?t:e?Math.ceil(t/2):0}function sq(t,i,e,s){let h=(sH("arrowUp",s)-1)/2*e.WM,r=(iM(s/2)-1)/2*e.WM;i.beginPath(),t?(i.moveTo(e._t-h,e.ut),i.lineTo(e._t,e.ut-h),i.lineTo(e._t+h,e.ut),i.lineTo(e._t+r,e.ut),i.lineTo(e._t+r,e.ut+h),i.lineTo(e._t-r,e.ut+h)):(i.moveTo(e._t-h,e.ut),i.lineTo(e._t,e.ut+h),i.lineTo(e._t+h,e.ut),i.lineTo(e._t+r,e.ut),i.lineTo(e._t+r,e.ut-h),i.lineTo(e._t-r,e.ut-h)),i.lineTo(e._t-r,e.ut),i.fill()}function s0(t,i,e,s,h,r){let n=(sH("arrowUp",s)-1)/2,l=(iM(s/2)-1)/2;return h>=i-l-2&&h<=i+l+2&&r>=(t?e:e-n)-2&&r<=(t?e+n:e)+2||!(h<i-n-3)&&!(h>i+n+3)&&!(r<(t?e-n-3:e))&&!(r>(t?e:e+n+3))&&Math.abs(r-e)+3>=Math.abs(h-i)/2}class s1{constructor(){this.Yt=null,this.On=new tC,this.W=-1,this.F="",this.Mp=""}ht(t){this.Yt=t}Nn(t,i){this.W===t&&this.F===i||(this.W=t,this.F=i,this.Mp=H(t,i),this.On.In())}jn(t,i){if(null===this.Yt||null===this.Yt.lt)return null;for(let r=this.Yt.lt.from;r<this.Yt.lt.to;r++){var e,s,h;let n=this.Yt.ot[r];if(n&&(e=n,s=t,h=i,!(void 0===e.ri||!function(t,i,e,s,h,r){let n=s/2;return h>=t&&h<=t+e&&r>=i-n&&r<=i+n}(e.ri._t,e.ri.ut,e.ri.Qi,e.ri.$t,s,h))||function(t,i,e){if(0===t.zr)return!1;switch(t.HM){case"arrowDown":return s0(!0,t._t,t.ut,t.zr,i,e);case"arrowUp":return s0(!1,t._t,t.ut,t.zr,i,e);case"circle":return function(t,i,e,s,h){let r=2+sH("circle",e)/2,n=t-s,l=i-h;return Math.sqrt(n*n+l*l)<=r}(t._t,t.ut,t.zr,i,e);case"square":return function(t,i,e,s,h){let r=sH("square",e),n=(r-1)/2,l=t-n,o=i-n;return s>=l&&s<=l+r&&h>=o&&h<=o+r}(t._t,t.ut,t.zr,i,e)}}(e,s,h)))return{zOrder:"normal",externalId:n.Zn??""}}return null}draw(t){t.useBitmapCoordinateSpace(t=>{this.et(t)})}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null!==this.Yt&&null!==this.Yt.lt){t.textBaseline="middle",t.font=this.Mp;for(let s=this.Yt.lt.from;s<this.Yt.lt.to;s++){let h=this.Yt.ot[s];void 0!==h.ri&&(h.ri.Qi=this.On.Vi(t,h.ri.FM),h.ri.$t=this.W,h.ri._t=h._t-h.ri.Qi/2),function(t,i,e,s){var h,r,n;i.fillStyle=t.R,void 0!==t.ri&&(h=t.ri.FM,r=t.ri._t,n=t.ri.ut,i.save(),i.scale(e,s),i.fillText(h,r,n),i.restore()),function(t,i,e){if(0!==t.zr){switch(t.HM){case"arrowDown":return sq(!1,i,e,t.zr);case"arrowUp":return sq(!0,i,e,t.zr);case"circle":let s=(sH("circle",t.zr)-1)/2;i.beginPath(),i.arc(e._t,e.ut,s*e.WM,0,2*Math.PI,!1),i.fill();return;case"square":return function(t,i,e){let s=sH("square",e),h=(s-1)*i.WM/2,r=i._t-h,n=i.ut-h;t.fillRect(r,n,s*i.WM,s*i.WM)}(i,e,t.zr)}t.HM}}(t,i,function(t,i,e){let s=Math.max(1,Math.floor(i))%2/2;return{_t:Math.round(t._t*i)+s,ut:t.ut*e,WM:i}}(t,e,s))}(h,t,i,e)}}}}function s2(t){return"atPriceTop"===t||"atPriceBottom"===t||"atPriceMiddle"===t}class s3{constructor(t,i){this.qM=[],this.St=!0,this.YM=!0,this.Gt=new s1,this.ge=t,this._p=i,this.Yt={ot:[],lt:null}}renderer(){if(!this.ge.options().visible)return null;this.St&&this.jM();let t=this._p.options().layout;return this.Gt.Nn(t.fontSize,t.fontFamily),this.Gt.ht(this.Yt),this.Gt}ZM(t){this.qM=t,this.Pt("data")}Pt(t){this.St=!0,"data"===t&&(this.YM=!0)}jM(){let t=this._p.timeScale(),i=this.qM;this.YM&&(this.Yt.ot=i.map(t=>({wt:t.time,_t:0,ut:0,zr:0,HM:t.shape,R:t.color,Zn:t.id,KM:t.KM,ri:void 0})),this.YM=!1);let e=this._p.options().layout;this.Yt.lt=null;let s=t.getVisibleLogicalRange();if(null===s)return;let h=new ij(Math.floor(s.from),Math.ceil(s.to));if(null===this.ge.data()[0]||0===this.Yt.ot.length)return;let r=NaN,n=sK(t.options().barSpacing),l={UM:n,$M:n};this.Yt.lt=eI(this.Yt.ot,h,!0);for(let s=this.Yt.lt.from;s<this.Yt.lt.to;s++){let h=i[s];h.time!==r&&(l.UM=n,l.$M=n,r=h.time);let o=this.Yt.ot[s];o._t=N(t.logicalToCoordinate(h.time)),void 0!==h.text&&h.text.length>0&&(o.ri={FM:h.text,_t:0,ut:0,Qi:0,$t:0});let a=this.ge.dataByIndex(h.time,0);null!==a&&function(t,i,e,s,h,r,n,l){let o=function(t,i){if(s2(i.position)&&void 0!==i.price)return i.price;if("value"in t&&"number"==typeof t.value)return t.value;if("open"in t&&"high"in t&&"low"in t&&"close"in t){if("inBar"===i.position)return t.close;if("aboveBar"===i.position)return t.high;if("belowBar"===i.position)return t.low}}(e,i);if(void 0===o)return;let a=s2(i.position),u=l.timeScale(),c=F(i.size)?Math.max(i.size,0):1,f=sG(u.options().barSpacing)*c,d=f/2;switch(t.zr=f,i.position){case"inBar":case"atPriceMiddle":return t.ut=N(n.priceToCoordinate(o)),void 0!==t.ri&&(t.ri.ut=t.ut+d+r+.6*h);case"aboveBar":case"atPriceTop":{let i=a?0:s.UM;return t.ut=N(n.priceToCoordinate(o))-d-i,void 0!==t.ri&&(t.ri.ut=t.ut-d-.6*h,s.UM+=1.2*h),a||(s.UM+=f+r)}case"belowBar":case"atPriceBottom":{let i=a?0:s.$M;return t.ut=N(n.priceToCoordinate(o))+d+i,void 0!==t.ri&&(t.ri.ut=t.ut+d+r+.6*h,s.$M+=1.2*h),a||(s.$M+=f+r)}}}(o,h,a,l,e.fontSize,n,this.ge,this._p)}this.St=!1}}class s5{constructor(){this.sh=null,this.qM=[],this.XM=[],this.GM=null,this.ge=null,this._p=null,this.JM=!0,this.QM=null,this.tb=null,this.ib=null,this.sb=!0}attached(t){this.nb(),this._p=t.chart,this.ge=t.series,this.sh=new s3(this.ge,N(this._p)),this.OM=t.requestUpdate,this.ge.subscribeDataChanged(t=>this.rg(t)),this.sb=!0,this.SM()}SM(){this.OM&&this.OM()}detached(){this.ge&&this.GM&&this.ge.unsubscribeDataChanged(this.GM),this._p=null,this.ge=null,this.sh=null,this.GM=null}ZM(t){this.sb=!0,this.qM=t,this.nb(),this.JM=!0,this.tb=null,this.SM()}eb(){return this.qM}paneViews(){return this.sh?[this.sh]:[]}updateAllViews(){this.rb()}hitTest(t,i){return this.sh?this.sh.renderer()?.jn(t,i)??null:null}autoscaleInfo(t,i){if(this.sh){let t=this.hb();if(t)return{priceRange:null,margins:t}}return null}hb(){let t=N(this._p).timeScale().options().barSpacing;if(this.JM||t!==this.ib){if(this.ib=t,this.qM.length>0){let i=sK(t),e=1.5*sG(t)+2*i,s=this.ab();this.QM={above:sX(e,s.aboveBar,s.inBar),below:sX(e,s.belowBar,s.inBar)}}else this.QM=null;this.JM=!1}return this.QM}ab(){return null===this.tb&&(this.tb=this.qM.reduce((t,i)=>(t[i.position]||(t[i.position]=!0),t),{inBar:!1,aboveBar:!1,belowBar:!1,atPriceTop:!1,atPriceBottom:!1,atPriceMiddle:!1})),this.tb}nb(){if(!this.sb||!this._p||!this.ge)return;let t=this._p.timeScale(),i=this.ge?.data();if(null==t.getVisibleLogicalRange()||!this.ge||0===i.length)return void(this.XM=[]);let e=t.timeToIndex(N(i[0].time),!0);this.XM=this.qM.map((i,s)=>{let h=t.timeToIndex(i.time,!0),r=N(this.ge).dataByIndex(h,h<e?1:-1),n={time:t.timeToIndex(N(r).time,!1),position:i.position,shape:i.shape,color:i.color,id:i.id,KM:s,text:i.text,size:i.size,price:i.price,ew:i.time};if(("atPriceTop"===i.position||"atPriceBottom"===i.position||"atPriceMiddle"===i.position)&&void 0===i.price)throw Error(`Price is required for position ${i.position}`);return{...n,position:i.position,price:i.price}}),this.sb=!1}rb(t){this.sh&&(this.nb(),this.sh.ZM(this.XM),this.sh.Pt(t))}rg(t){this.sb=!0,this.SM()}}class s6 extends sU{constructor(t,i,e){super(t,i),e&&this.setMarkers(e)}setMarkers(t){this.ah.ZM(t)}markers(){return this.ah.eb()}}function s4(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}({...E,color:"#2196f3"});var s9=function(t){var i,e=t.container,s=t.onClick,h=t.onCrosshairMove,r=t.onInit,n=t.options,l=void 0===n?{}:n,o=t.onDblClick,a=(i=(0,S.useState)(!1),function(t){if(Array.isArray(t))return t}(i)||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(i,2)||function(t,i){if(t){if("string"==typeof t)return s4(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return s4(t,i)}}(i,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=a[0],c=a[1],f=(0,S.useRef)({_chart:null,api:function(){return this._chart},init:function(){if(null===this._chart)this._chart=function(t,i,e){let s=new so(function(t){if(I(t)){let i=document.getElementById(t);return L(null!==i,`Cannot find element in DOM with id=${t}`),i}return t}(t),i,e);return i.setOptions(s.options()),s}(e,new i0,i0.Wc(l)),r&&r(this._chart);return u||c(!0),this._chart},clear:function(){null!==this._chart&&(c(!1),this._chart.remove(),this._chart=null)}});return(0,S.useLayoutEffect)(function(){return f.current.init(),function(){f.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(e){if(s){var t;null===(t=f.current.api())||void 0===t||t.subscribeClick(s)}return function(){if(s){var t;null===(t=f.current.api())||void 0===t||t.unsubscribeClick(s)}}}},[s]),(0,S.useLayoutEffect)(function(){if(e){if(h){var t;null===(t=f.current.api())||void 0===t||t.subscribeCrosshairMove(h)}return function(){if(h){var t;null===(t=f.current.api())||void 0===t||t.unsubscribeCrosshairMove(h)}}}},[h]),(0,S.useLayoutEffect)(function(){if(e){if(o){var t;null===(t=f.current.api())||void 0===t||t.subscribeDblClick(o)}return function(){if(o){var t;null===(t=f.current.api())||void 0===t||t.unsubscribeDblClick(o)}}}},[o]),(0,S.useLayoutEffect)(function(){var t;e&&(null===(t=f.current.api())||void 0===t||t.applyOptions(l))},[l]),{chartApiRef:f,isReady:u}},s8=function(t){var i=t.children,e=s9({container:t.container,onClick:t.onClick,onCrosshairMove:t.onCrosshairMove,onInit:t.onInit,options:t.options}),s=e.chartApiRef.current,h=e.isReady;return(0,_.jsx)(x.Provider,{value:{chartApiRef:s,isReady:h},children:i})};function s7(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}function ht(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}function hi(t,i){return i=null!=i?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t}var he=(0,S.forwardRef)(function(t,i){var e,s=t.children,h=t.containerProps,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children","containerProps"]),n=(e=(0,S.useState)(),function(t){if(Array.isArray(t))return t}(e)||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(e,2)||function(t,i){if(t){if("string"==typeof t)return s7(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return s7(t,i)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=n[0],o=n[1],a=(0,S.useCallback)(function(t){o(t),i&&("function"==typeof i?a(t):i.current=t)},[i]);return(0,_.jsx)("div",hi(ht({ref:a},h),{children:!!l&&(0,_.jsx)(s8,hi(ht({container:l},r),{children:s}))}))});he.displayName="ChartWrapper";var hs=(0,S.createContext)(null);hs.displayName="TimeScaleContext";var hh={i8:"0.4.0"};function hr(t,i,e){return(hr=hu()?Reflect.construct:function(t,i,e){var s=[null];s.push.apply(s,i);var h=new(Function.bind.apply(t,s));return e&&ho(h,e.prototype),h}).apply(null,arguments)}function hn(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function hl(t){return(hl=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ho(t,i){return(ho=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,i)}function ha(t){var i="function"==typeof Map?new Map:void 0;return(ha=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(t))return i.get(t);i.set(t,e)}function e(){return hr(t,arguments,hl(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),ho(e,t)})(t)}function hu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(hu=function(){return!!t})()}var hc=function(t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function i(t){var e,s,h,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=n.isOperational,o=n.cause,a=n.docsPath;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,s=[t],e=hl(e),hn(h=function(t,i){var e;if(i&&("object"==((e=i)&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)||"function"==typeof i))return i;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,hu()?Reflect.construct(e,s||[],hl(this).constructor):e.apply(this,s)),"isOperational",void 0),hn(h,"cause",void 0),h.name=null!==(r=h.constructor.name)&&void 0!==r?r:"InternalError",h.isOperational=void 0===l||l,h.cause=o,h.message="".concat(null!=t?t:"An error occurred"),a&&(h.message="".concat(h.message,"\n Docs: see ").concat("https://tradingview.github.io/lightweight-charts/docs"+a)),hh.i8&&(h.message="".concat(h.message,"\n Version: lightweight-charts-react-components/").concat(hh.i8)),Object.setPrototypeOf(h,i.prototype),h}return i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&ho(i,t),i}(ha(Error)),hf=function(t,i){var e=(0,S.useContext)(t);if(!e){var s,h,r=null!==(h=null!==(s=t.name)&&void 0!==s?s:t.displayName)&&void 0!==h?h:"Context";throw new hc(null!=i?i:"".concat(r," not found."),{isOperational:!0})}return e};function hd(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}var hp=function(t){var i,e=t.onVisibleTimeRangeChange,s=t.onVisibleLogicalRangeChange,h=t.onSizeChange,r=t.visibleRange,n=t.visibleLogicalRange,l=t.options,o=void 0===l?{}:l,a=hf(x),u=a.isReady,c=a.chartApiRef,f=(i=(0,S.useState)(!1),function(t){if(Array.isArray(t))return t}(i)||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(i,2)||function(t,i){if(t){if("string"==typeof t)return hd(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return hd(t,i)}}(i,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=f[0],p=f[1],m=(0,S.useRef)({_timeScale:null,api:function(){return this._timeScale},init:function(){if(this._timeScale)return this._timeScale;var t=null==c?void 0:c.api();return t?(this._timeScale=t.timeScale(),this._timeScale.applyOptions(o),r&&this._timeScale.setVisibleRange(r),n&&this._timeScale.setVisibleLogicalRange(n),e&&this._timeScale.subscribeVisibleTimeRangeChange(e),s&&this._timeScale.subscribeVisibleLogicalRangeChange(s),h&&this._timeScale.subscribeSizeChange(h),p(!0),this._timeScale):null},clear:function(){this._timeScale=null,p(!1)}});return(0,S.useLayoutEffect)(function(){u&&m.current.init()},[u]),(0,S.useLayoutEffect)(function(){return function(){m.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(c&&o){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.applyOptions(o)}},[o]),(0,S.useLayoutEffect)(function(){if(c){if(h){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.subscribeSizeChange(h)}return function(){if(h){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.unsubscribeSizeChange(h)}}}},[h]),(0,S.useLayoutEffect)(function(){if(c){if(s){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.subscribeVisibleLogicalRangeChange(s)}return function(){if(s){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.unsubscribeVisibleLogicalRangeChange(s)}}}},[s]),(0,S.useLayoutEffect)(function(){if(c){if(e){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.subscribeVisibleTimeRangeChange(e)}return function(){if(e){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.unsubscribeVisibleTimeRangeChange(e)}}}},[e]),(0,S.useLayoutEffect)(function(){if(c&&r){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.setVisibleRange(r)}},[r]),(0,S.useLayoutEffect)(function(){if(c&&n){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.setVisibleLogicalRange(n)}},[n]),{timeScaleApiRef:m,isReady:d}},hm=(0,S.forwardRef)(function(t,i){var e=t.children,s=hp(function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"])),h=s.timeScaleApiRef.current,r=s.isReady;return(0,S.useImperativeHandle)(i,function(){return h},[h]),(0,_.jsx)(hs.Provider,{value:{timeScaleApiRef:h,isReady:r},children:e})});hm.displayName="TimeScale";var hg=function(t){var i=t.options,e=void 0===i?{}:i,s=t.id,h=hf(x),r=h.isReady,n=h.chartApiRef,l=(0,S.useRef)({_priceScale:null,api:function(){return this._priceScale},init:function(){if(!this._priceScale){var t=null==n?void 0:n.api();if(!t)return null;this._priceScale=t.priceScale(s),this._priceScale.applyOptions(e)}return this._priceScale},setId:function(t){null!==this._priceScale&&null!==n&&(this._priceScale=n.api().priceScale(t),this._priceScale.applyOptions(e))},clear:function(){this._priceScale=null}});return(0,S.useLayoutEffect)(function(){r&&l.current.init()},[r]),(0,S.useLayoutEffect)(function(){return function(){l.current.clear()}},[]),(0,S.useLayoutEffect)(function(){var t;n&&(null===(t=l.current)||void 0===t||t.setId(s))},[s]),(0,S.useLayoutEffect)(function(){if(n&&e){var t,i;null===(i=l.current)||void 0===i||null===(t=i.api())||void 0===t||t.applyOptions(e)}},[e]),l},hv=(0,S.forwardRef)(function(t,i){var e=hg(t);return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null});function hb(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}hv.displayName="PriceScale";var hy=function(t){var i=t.deps,e=hf(hs),s=e.timeScaleApiRef,h=e.isReady;(0,S.useLayoutEffect)(function(){if(h&&s){var t=s.api();queueMicrotask(function(){t&&t.fitContent()})}},((function(t){if(Array.isArray(t))return hb(t)})(i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,i){if(t){if("string"==typeof t)return hb(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return hb(t,i)}}(i)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([h]))},hw=function(t){return hy({deps:t.deps}),null},hM=(0,S.createContext)({seriesApiRef:null,isReady:!1});hM.displayName="SeriesContext";var h_=0,hS=function(){return h_+=1},hx=function(){return 0!==h_&&(h_-=1),h_};function hO(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}var hP=function(t){var i,e=t.type,s=t.data,h=t.options,r=void 0===h?{}:h,n=t.reactive,l=void 0===n||n,o=t.isPane,a=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["type","data","options","reactive","isPane"]),u=hf(x),c=u.isReady,f=u.chartApiRef,d=(i=(0,S.useState)(!1),function(t){if(Array.isArray(t))return t}(i)||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(i,2)||function(t,i){if(t){if("string"==typeof t)return hO(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return hO(t,i)}}(i,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=d[0],m=d[1],g=(0,S.useRef)({_series:null,api:function(){return this._series},init:function(){if(!this._series){var t,i=null==f?void 0:f.api();if(!i)return null;if("Custom"===e){var h=a.plugin;if(!h)throw new hc("Custom series requires a plugin to be defined");this._series=i.addCustomSeries(h,r,o?h_:0)}else this._series=i.addSeries(hC[e],r,o?h_:0);m(!0),null===(t=this._series)||void 0===t||t.setData(s),o&&hS()}return this._series},clear:function(){if(null!==this._series){var t;null==f||null===(t=f.api())||void 0===t||t.removeSeries(this._series),this._series=null,m(!1),o&&hx()}}});return(0,S.useLayoutEffect)(function(){c&&g.current.init()},[c]),(0,S.useLayoutEffect)(function(){return function(){g.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(f&&s&&l){var t;null===(t=g.current.api())||void 0===t||t.setData(s)}},[s,l]),(0,S.useLayoutEffect)(function(){if(f&&r){var t;null===(t=g.current.api())||void 0===t||t.applyOptions(r)}},[r]),(0,S.useLayoutEffect)(function(){var t,i;f&&void 0!==o&&(o?(hS(),null===(t=g.current.api())||void 0===t||t.moveToPane(h_)):(hx(),null===(i=g.current.api())||void 0===i||i.moveToPane(0)))},[o]),{isReady:p,seriesApiRef:g}},hC={Line:{type:"Line",isBuiltIn:!0,defaultOptions:{color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new sg(t,i)},Candlestick:{type:"Candlestick",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Mg:(t,i)=>new sk(t,i)},Histogram:{type:"Histogram",isBuiltIn:!0,defaultOptions:{color:"#26a69a",base:0},Mg:(t,i)=>new sY(t,i)},Area:{type:"Area",isBuiltIn:!0,defaultOptions:{topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,relativeGradient:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new sx(t,i)},Baseline:{type:"Baseline",isBuiltIn:!0,defaultOptions:{baseValue:{type:"price",price:0},relativeGradient:!1,topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new s_(t,i)},Bar:{type:"Bar",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Mg:(t,i)=>new sC(t,i)}},hR=(0,S.forwardRef)(function(t,i){var e=t.children,s=hP(function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"])),h=s.seriesApiRef.current,r=s.isReady;return(0,S.useImperativeHandle)(i,function(){return h},[h]),(0,_.jsx)(hM.Provider,{value:{seriesApiRef:h,isReady:r},children:e})});hR.displayName="SeriesTemplate";var hk=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hR,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Line",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hk.displayName="LineSeries";var hz=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hR,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Histogram",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hz.displayName="HistogramSeries";var hY=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hR,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Candlestick",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hY.displayName="CandlestickSeries";var hE=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hR,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Area",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hE.displayName="AreaSeries";var hj=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hR,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Baseline",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hj.displayName="BaselineSeries";var hT=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hR,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Bar",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hT.displayName="BarSeries";var hL=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hR,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Custom",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hL.displayName="CustomSeries";var hV=function(t){var i=t.options,e=t.price,s=hf(hM),h=s.isReady,r=s.seriesApiRef,n=(0,S.useRef)({_priceLine:null,api:function(){return this._priceLine},init:function(){if(!this._priceLine){var t=null==r?void 0:r.api();if(!t)return null;this._priceLine=t.createPriceLine(function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({price:e},i))}return this._priceLine},clear:function(){if(null!==this._priceLine){var t;null==r||null===(t=r.api())||void 0===t||t.removePriceLine(this._priceLine),this._priceLine=null}}});return(0,S.useLayoutEffect)(function(){h&&n.current.init()},[h]),(0,S.useLayoutEffect)(function(){return function(){n.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(r&&i){var t;null===(t=n.current.api())||void 0===t||t.applyOptions(i)}},[i]),(0,S.useLayoutEffect)(function(){if(r&&e){var t;null===(t=n.current.api())||void 0===t||t.applyOptions({price:e})}},[e]),n},hN=(0,S.forwardRef)(function(t,i){var e=hV(t);return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null});hN.displayName="PriceLine";var hD=function(t){var i=t.reactive,e=void 0===i||i,s=t.markers,h=hf(hM),r=h.isReady,n=h.seriesApiRef,l=(0,S.useRef)({_markers:null,api:function(){return this._markers},init:function(){if(null===this._markers){var t=null==n?void 0:n.api();if(!t)return null;this._markers=function(t,i){let e=new s6(t,new s5);return i&&e.setMarkers(i),e}(t,s)}return this._markers},clear:function(){null!==this._markers&&(this._markers.detach(),this._markers=null)}});return(0,S.useLayoutEffect)(function(){r&&l.current.init()},[r]),(0,S.useLayoutEffect)(function(){return function(){l.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(n&&s&&e){var t;null===(t=l.current.api())||void 0===t||t.setMarkers(s)}},[s,e]),l};function hB(){return(hB=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t}).apply(this,arguments)}var hW=(0,S.forwardRef)(function(t,i){var e=hD(hB({},function(t){if(null==t)throw TypeError("Cannot destructure "+t);return t}(t)));return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null});function hF(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}hW.displayName="Markers";var hA=function(t){var i=hf(x),e=i.isReady,s=i.chartApiRef,h=(0,S.useRef)({_watermark:null,api:function(){return this._watermark},init:function(){if(null===this._watermark){var i=null==s?void 0:s.api(),e=null==i?void 0:i.panes()[0];if(!i||!e)return null;if(hI(t)){t.type;var h=hF(t,["type"]);this._watermark=new sE(e,new sF(h))}else{t.type;var r=t.src,n=hF(t,["type","src"]);this._watermark=new sE(e,new s$(r,n))}}return this._watermark},clear:function(){null!==this._watermark&&(this._watermark.detach(),this._watermark=null)}});return(0,S.useLayoutEffect)(function(){e&&h.current.init()},[e]),(0,S.useLayoutEffect)(function(){return function(){h.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(s&&t){t.type;var i,e=hF(t,["type"]);null===(i=h.current.api())||void 0===i||i.applyOptions(e)}},[t]),h},hI=function(t){return"text"===t.type};function hQ(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}function hJ(t,i){return i=null!=i?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t}var h$=function(t,i){var e=hA(t);return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null},hU=(0,S.forwardRef)(function(t,i){return h$(hJ(hQ({},t),{type:"text"}),i)}),hZ=(0,S.forwardRef)(function(t,i){return h$(hJ(hQ({},t),{type:"image"}),i)});hU.displayName="WatermarkText",hZ.displayName="WatermarkImage";var hH=function(t){var i=t.render,e=t.plugin,s=hf(x),h=s.isReady,r=s.chartApiRef,n=hf(hM),l=n.isReady,o=n.seriesApiRef,a=(0,S.useRef)({_primitive:null,api:function(){return this._primitive},init:function(){if(!this._primitive){var t=null==o?void 0:o.api(),s=null==r?void 0:r.api();if(!s||!t)return null;var h=e||i({chart:s,series:t});t.attachPrimitive(h),this._primitive=h}return this._primitive},clear:function(){if(null!==this._primitive){var t;null==o||null===(t=o.api())||void 0===t||t.detachPrimitive(this._primitive),this._primitive=null}}});return(0,S.useLayoutEffect)(function(){h&&l&&a.current.init()},[l,h]),(0,S.useLayoutEffect)(function(){return function(){a.current.clear()}},[]),a},hG=(0,S.forwardRef)(function(t,i){var e=hH(t);return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null});hG.displayName="SeriesPrimitive"}(),h}()});
12
+ !function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("React")):"function"==typeof define&&define.amd?define(["React"],i):"object"==typeof exports?exports.LightweightChartsReactComponents=i(require("React")):t.LightweightChartsReactComponents=i(t.React)}(self,function(t){return function(){"use strict";var i={react:function(i){i.exports=t}},e={};function s(t){var h=e[t];if(void 0!==h)return h.exports;var r=e[t]={exports:{}};return i[t](r,r.exports,s),r.exports}s.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(i,{a:i}),i},s.d=function(t,i){for(var e in i)s.o(i,e)&&!s.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:i[e]})},s.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var h={};return!function(){s.r(h),s.d(h,{CustomSeries:function(){return hL},Chart:function(){return hi},BaselineSeries:function(){return hE},LineSeries:function(){return hO},PriceLine:function(){return hN},TimeScaleFitContentTrigger:function(){return hy},WatermarkImage:function(){return hU},WatermarkText:function(){return h$},BarSeries:function(){return hT},CandlestickSeries:function(){return hz},HistogramSeries:function(){return hk},Markers:function(){return hW},SeriesPrimitive:function(){return hH},AreaSeries:function(){return hY},TimeScale:function(){return hp},PriceScale:function(){return hg}});var t,i,e,r,n,l,o,a,u,c,f,d,p,m,g,v,b,y,w,M,_=s("react"),S=s.n(_),x=(0,_.createContext)(null);function C(t){var i=t.width,e=t.height;if(i<0)throw Error("Negative width is not allowed for Size");if(e<0)throw Error("Negative height is not allowed for Size");return{width:i,height:e}}function P(t,i){return t.width===i.width&&t.height===i.height}x.displayName="ChartContext";var R=function(){function t(t){var i=this;this._resolutionListener=function(){return i._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=t,this._installResolutionListener()}return t.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(t.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),t.prototype.subscribe=function(t){var i=this,e={next:t};return this._observers.push(e),{unsubscribe:function(){i._observers=i._observers.filter(function(t){return t!==e})}}},t.prototype._installResolutionListener=function(){if(null!==this._resolutionMediaQueryList)throw Error("Resolution listener is already installed");var t=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(t,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){null!==this._resolutionMediaQueryList&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){var t=this;this._observers.forEach(function(i){return i.next(t._window.devicePixelRatio)}),this._reinstallResolutionListener()},t}(),O=function(){function t(t,i,e){var s;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=t,this._canvasElementClientSize=C({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=null!=i?i:function(t){return t},this._allowResizeObserver=null===(s=null==e?void 0:e.allowResizeObserver)||void 0===s||s,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var t,i;if(null===this._canvasElement)throw Error("Object is disposed");null===(t=this._canvasElementResizeObserver)||void 0===t||t.disconnect(),this._canvasElementResizeObserver=null,null===(i=this._devicePixelRatioObservable)||void 0===i||i.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(null===this._canvasElement)throw Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return C({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(t){this._canvasElementClientSize=C(t),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(i){return i!==t})},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(i){return i!==t})},t.prototype.applySuggestedBitmapSize=function(){if(null!==this._suggestedBitmapSize){var t=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(t),this._emitSuggestedBitmapSizeChanged(t,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(t){var i=this.bitmapSize;P(i,t)||(this.canvasElement.width=t.width,this.canvasElement.height=t.height,this._emitBitmapSizeChanged(i,t))},t.prototype._emitBitmapSizeChanged=function(t,i){var e=this;this._bitmapSizeChangedListeners.forEach(function(s){return s.call(e,t,i)})},t.prototype._suggestNewBitmapSize=function(t){var i=this._suggestedBitmapSize,e=C(this._transformBitmapSize(t,this._canvasElementClientSize)),s=P(this.bitmapSize,e)?null:e;(null!==i||null!==s)&&(null!==i&&null!==s&&P(i,s)||(this._suggestedBitmapSize=s,this._emitSuggestedBitmapSizeChanged(i,s)))},t.prototype._emitSuggestedBitmapSizeChanged=function(t,i){var e=this;this._suggestedBitmapSizeChangedListeners.forEach(function(s){return s.call(e,t,i)})},t.prototype._chooseAndInitObserver=function(){var t=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}new Promise(function(t){var i=new ResizeObserver(function(e){t(e.every(function(t){return"devicePixelContentBoxSize"in t})),i.disconnect()});i.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1}).then(function(i){return i?t._initResizeObserver():t._initDevicePixelRatioObservable()})},t.prototype._initDevicePixelRatioObservable=function(){var t=this;if(null!==this._canvasElement){var i=k(this._canvasElement);if(null===i)throw Error("No window is associated with the canvas");this._devicePixelRatioObservable=new R(i),this._devicePixelRatioObservable.subscribe(function(){return t._invalidateBitmapSize()}),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){if(null!==this._canvasElement){var t,i,e=k(this._canvasElement);if(null!==e){var s,h,r=null!==(i=null===(t=this._devicePixelRatioObservable)||void 0===t?void 0:t.value)&&void 0!==i?i:e.devicePixelRatio,n=this._canvasElement.getClientRects(),l=void 0!==n[0]?(s=n[0],h=r,C({width:Math.round(s.left*h+s.width*h)-Math.round(s.left*h),height:Math.round(s.top*h+s.height*h)-Math.round(s.top*h)})):C({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(l)}}},t.prototype._initResizeObserver=function(){var t=this;null!==this._canvasElement&&(this._canvasElementResizeObserver=new ResizeObserver(function(i){var e=i.find(function(i){return i.target===t._canvasElement});if(e&&e.devicePixelContentBoxSize&&e.devicePixelContentBoxSize[0]){var s=e.devicePixelContentBoxSize[0],h=C({width:s.inlineSize,height:s.blockSize});t._suggestNewBitmapSize(h)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function k(t){return t.ownerDocument.defaultView}var z=function(){function t(t,i,e){if(0===i.width||0===i.height)throw TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=i,0===e.width||0===e.height)throw TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=e,this._context=t}return t.prototype.useMediaCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),t({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),t({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t}();function Y(t,i){var e=t.canvasElementClientSize;if(0===e.width||0===e.height)return null;var s=t.bitmapSize;if(0===s.width||0===s.height)return null;var h=t.canvasElement.getContext("2d",i);return null===h?null:new z(h,e,s)}let E={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};function T(t,i){let e={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[i];t.setLineDash(e)}function L(t,i,e,s){t.beginPath();let h=t.lineWidth%2?.5:0;t.moveTo(e,i+h),t.lineTo(s,i+h),t.stroke()}function V(t,i){if(!t)throw Error("Assertion failed"+(i?": "+i:""))}function N(t){if(void 0===t)throw Error("Value is undefined");return t}function B(t){if(null===t)throw Error("Value is null");return t}function D(t){return B(N(t))}(t=f||(f={}))[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved",(i=d||(d={}))[i.Solid=0]="Solid",i[i.Dotted=1]="Dotted",i[i.Dashed=2]="Dashed",i[i.LargeDashed=3]="LargeDashed",i[i.SparseDotted=4]="SparseDotted";class W{constructor(){this.t=[]}i(t,i,e){this.t.push({h:t,l:i,o:!0===e})}_(t){let i=this.t.findIndex(i=>t===i.h);i>-1&&this.t.splice(i,1)}u(t){this.t=this.t.filter(i=>i.l!==t)}p(t,i,e){let s=[...this.t];this.t=this.t.filter(t=>!t.o),s.forEach(s=>s.h(t,i,e))}v(){return this.t.length>0}m(){this.t=[]}}function j(t,...i){for(let e of i)for(let i in e)void 0!==e[i]&&Object.prototype.hasOwnProperty.call(e,i)&&!["__proto__","constructor","prototype"].includes(i)&&("object"!=typeof e[i]||void 0===t[i]||Array.isArray(e[i])?t[i]=e[i]:j(t[i],e[i]));return t}function F(t){return"number"==typeof t&&isFinite(t)}function A(t){return"number"==typeof t&&t%1==0}function I(t){return"string"==typeof t}function Q(t){return"boolean"==typeof t}function J(t){let i,e,s;if(!t||"object"!=typeof t)return t;for(e in i=Array.isArray(t)?[]:{},t)t.hasOwnProperty(e)&&(s=t[e],i[e]=s&&"object"==typeof s?J(s):s);return i}function $(t){return null!==t}function U(t){return null===t?void 0:t}let Z="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function H(t,i,e){return void 0===i&&(i=Z),`${e=void 0!==e?`${e} `:""}${t}px ${i}`}class G{constructor(t){this.M={S:1,C:5,P:NaN,k:"",T:"",R:"",D:"",V:0,I:0,B:0,A:0,L:0},this.O=t}N(){let t=this.M,i=this.W(),e=this.F();return t.P===i&&t.T===e||(t.P=i,t.T=e,t.k=H(i,e),t.A=2.5/12*i,t.V=t.A,t.I=i/12*t.C,t.B=i/12*t.C,t.L=0),t.R=this.H(),t.D=this.U(),this.M}H(){return this.O.N().layout.textColor}U(){return this.O.$()}W(){return this.O.N().layout.fontSize}F(){return this.O.N().layout.fontFamily}}function K(t){return t<0?0:t>255?255:Math.round(t)||0}function X(t){return .199*t[0]+.687*t[1]+.114*t[2]}class q{constructor(t,i){this.q=new Map,this.Y=t,i&&(this.q=i)}j(t,i){if("transparent"===t)return t;let e=this.Z(t),s=e[3];return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${i*s})`}K(t){let i=this.Z(t);return{X:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,G:X(i)>160?"black":"white"}}J(t){return X(this.Z(t))}tt(t,i,e){var s;let[h,r,n,l]=this.Z(t),[o,a,u,c]=this.Z(i),f=[K(h+e*(o-h)),K(r+e*(a-r)),K(n+e*(u-n)),(s=l+e*(c-l))<=0||s>1?Math.min(Math.max(s,0),1):Math.round(1e4*s)/1e4];return`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${f[3]})`}Z(t){let i=this.q.get(t);if(i)return i;let e=(function(t){let i=document.createElement("div");i.style.display="none",document.body.appendChild(i),i.style.color=t;let e=window.getComputedStyle(i).color;return document.body.removeChild(i),e})(t).match(/^rgba?\s*\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d+))?\)$/);if(!e){if(this.Y.length)for(let i of this.Y){let e=i(t);if(e)return this.q.set(t,e),e}throw Error(`Failed to parse color: ${t}`)}let s=[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10),e[4]?parseFloat(e[4]):1];return this.q.set(t,s),s}}class tt{constructor(){this.it=[]}st(t){this.it=t}nt(t,i,e){this.it.forEach(s=>{s.nt(t,i,e)})}}class ti{nt(t,i,e){t.useBitmapCoordinateSpace(t=>this.et(t,i,e))}}class te extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.rt||null===this.rt.lt)return;let s=this.rt.lt,h=this.rt,r=Math.max(1,Math.floor(i))%2/2,n=n=>{t.beginPath();for(let l=s.to-1;l>=s.from;--l){let s=h.ot[l],o=Math.round(s._t*i)+r,a=s.ut*e,u=n*e+r;t.moveTo(o,a),t.arc(o,a,u,0,2*Math.PI)}t.fill()};h.ct>0&&(t.fillStyle=h.dt,n(h.ft+h.ct)),t.fillStyle=h.vt,n(h.ft)}}function ts(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:"",dt:"",ft:0,ct:0,lt:null}}let th={from:0,to:1};class tr{constructor(t,i,e){this.Mt=new tt,this.bt=[],this.xt=[],this.St=!0,this.O=t,this.Ct=i,this.yt=e,this.Mt.st(this.bt)}Pt(t){this.kt(),this.St=!0}Tt(){return this.St&&(this.Rt(),this.St=!1),this.Mt}kt(){let t=this.yt.Dt();t.length!==this.bt.length&&(this.xt=t.map(ts),this.bt=this.xt.map(t=>{let i=new te;return i.ht(t),i}),this.Mt.st(this.bt))}Rt(){let t=2===this.Ct.N().mode||!this.Ct.Vt(),i=this.yt.It(),e=this.Ct.Bt(),s=this.O.At();this.kt(),i.forEach((i,h)=>{let r=this.xt[h],n=i.Et(e),l=i.zt();!t&&null!==n&&i.Vt()&&null!==l?(r.vt=n.Lt,r.ft=n.ft,r.ct=n.Ot,r.ot[0].gt=n.gt,r.ot[0].ut=i.Wt().Nt(n.gt,l.Ft),r.dt=n.Ht??this.O.Ut(r.ot[0].ut/i.Wt().$t()),r.ot[0].wt=e,r.ot[0]._t=s.qt(e),r.lt=th):r.lt=null})}}class tn extends ti{constructor(t){super(),this.Yt=t}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(null===this.Yt)return;let h=this.Yt.jt.Vt,r=this.Yt.Zt.Vt;if(!h&&!r)return;let n=Math.round(this.Yt._t*e),l=Math.round(this.Yt.ut*s);t.lineCap="butt",h&&n>=0&&(t.lineWidth=Math.floor(this.Yt.jt.ct*e),t.strokeStyle=this.Yt.jt.R,t.fillStyle=this.Yt.jt.R,T(t,this.Yt.jt.Kt),function(t,i,e,s){t.beginPath();let h=t.lineWidth%2?.5:0;t.moveTo(i+h,0),t.lineTo(i+h,s),t.stroke()}(t,n,0,i.height)),r&&l>=0&&(t.lineWidth=Math.floor(this.Yt.Zt.ct*s),t.strokeStyle=this.Yt.Zt.R,t.fillStyle=this.Yt.Zt.R,T(t,this.Yt.Zt.Kt),L(t,l,0,i.width))}}class tl{constructor(t,i){this.St=!0,this.Xt={jt:{ct:1,Kt:0,R:"",Vt:!1},Zt:{ct:1,Kt:0,R:"",Vt:!1},_t:0,ut:0},this.Gt=new tn(this.Xt),this.Jt=t,this.yt=i}Pt(){this.St=!0}Tt(t){return this.St&&(this.Rt(),this.St=!1),this.Gt}Rt(){let t=this.Jt.Vt(),i=this.yt.Qt().N().crosshair,e=this.Xt;if(2===i.mode)return e.Zt.Vt=!1,void(e.jt.Vt=!1);e.Zt.Vt=t&&this.Jt.ti(this.yt),e.jt.Vt=t&&this.Jt.ii(),e.Zt.ct=i.horzLine.width,e.Zt.Kt=i.horzLine.style,e.Zt.R=i.horzLine.color,e.jt.ct=i.vertLine.width,e.jt.Kt=i.vertLine.style,e.jt.R=i.vertLine.color,e._t=this.Jt.si(),e.ut=this.Jt.ni()}}function to(t,i,e,s,h,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,e,s,h),t.restore()}function ta(t,i,e,s,h,r){t.beginPath(),t.roundRect?t.roundRect(i,e,s,h,r):(t.lineTo(i+s-r[1],e),0!==r[1]&&t.arcTo(i+s,e,i+s,e+r[1],r[1]),t.lineTo(i+s,e+h-r[2]),0!==r[2]&&t.arcTo(i+s,e+h,i+s-r[2],e+h,r[2]),t.lineTo(i+r[3],e+h),0!==r[3]&&t.arcTo(i,e+h,i,e+h-r[3],r[3]),t.lineTo(i,e+r[0]),0!==r[0]&&t.arcTo(i,e,i+r[0],e,r[0]))}function tu(t,i,e,s,h,r,n=0,l=[0,0,0,0],o=""){var a;if(t.save(),!n||!o||o===r)return ta(t,i,e,s,h,l),t.fillStyle=r,t.fill(),void t.restore();let u=n/2;ta(t,i+u,e+u,s-n,h-n,(a=-u,l.map(t=>0===t?t:t+a))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==o&&(t.lineWidth=n,t.strokeStyle=o,t.closePath(),t.stroke()),t.restore()}function tc(t,i,e,s,h,r,n){t.save(),t.globalCompositeOperation="copy";let l=t.createLinearGradient(0,0,0,h);l.addColorStop(0,r),l.addColorStop(1,n),t.fillStyle=l,t.fillRect(i,e,s,h),t.restore()}class tf{constructor(t,i){this.ht(t,i)}ht(t,i){this.Yt=t,this.ei=i}$t(t,i){return this.Yt.Vt?t.P+t.A+t.V:0}nt(t,i,e,s){if(!this.Yt.Vt||0===this.Yt.ri.length)return;let h=this.Yt.R,r=this.ei.X,n=t.useBitmapCoordinateSpace(t=>{let n=t.context;n.font=i.k;let l=this.hi(t,i,e,s),o=l.ai;return l.li?tu(n,o.oi,o._i,o.ui,o.ci,r,o.di,[o.ft,0,0,o.ft],r):tu(n,o.fi,o._i,o.ui,o.ci,r,o.di,[0,o.ft,o.ft,0],r),this.Yt.pi&&(n.fillStyle=h,n.fillRect(o.fi,o.mi,o.wi-o.fi,o.gi)),this.Yt.Mi&&(n.fillStyle=i.D,n.fillRect(l.li?o.bi-o.di:0,o._i,o.di,o.xi-o._i)),l});t.useMediaCoordinateSpace(({context:t})=>{let e=n.Si;t.font=i.k,t.textAlign=n.li?"right":"left",t.textBaseline="middle",t.fillStyle=h,t.fillText(this.Yt.ri,e.Ci,(e._i+e.xi)/2+e.yi)})}hi(t,i,e,s){let h,r,n,{context:l,bitmapSize:o,mediaSize:a,horizontalPixelRatio:u,verticalPixelRatio:c}=t,f=this.Yt.pi||!this.Yt.Pi?i.C:0,d=this.Yt.ki?i.S:0,p=i.A+this.ei.Ti,m=i.V+this.ei.Ri,g=i.I,v=i.B,b=this.Yt.ri,y=i.P,w=e.Di(l,b),M=Math.ceil(e.Vi(l,b)),_=i.S+g+v+M+f,S=Math.max(1,Math.floor(c)),x=Math.round((y+p+m)*c);x%2!=S%2&&(x+=1);let C=d>0?Math.max(1,Math.floor(d*u)):0,P=Math.round(_*u),R=Math.round(f*u),O=Math.round((this.ei.Ii??this.ei.Bi)*c)-Math.floor(.5*c),k=Math.floor(O+S/2-x/2),z=k+x,Y="right"===s,E=Y?a.width-d:d,T=Y?o.width-C:C;return Y?(h=T-P,r=T-R,n=E-f-g-d):(h=T+P,r=T+R,n=E+f+g),{li:Y,ai:{_i:k,mi:O,xi:z,ui:P,ci:x,ft:2*u,di:C,oi:h,fi:T,wi:r,gi:S,bi:o.width},Si:{_i:k/c,xi:z/c,Ci:n,yi:w}}}}class td{constructor(t){this.Ai={Bi:0,X:"#000",Ri:0,Ti:0},this.Ei={ri:"",Vt:!1,pi:!0,Pi:!1,Ht:"",R:"#FFF",Mi:!1,ki:!1},this.zi={ri:"",Vt:!1,pi:!1,Pi:!0,Ht:"",R:"#FFF",Mi:!0,ki:!0},this.St=!0,this.Li=new(t||tf)(this.Ei,this.Ai),this.Oi=new(t||tf)(this.zi,this.Ai)}ri(){return this.Ni(),this.Ei.ri}Bi(){return this.Ni(),this.Ai.Bi}Pt(){this.St=!0}$t(t,i=!1){return Math.max(this.Li.$t(t,i),this.Oi.$t(t,i))}Wi(){return this.Ai.Ii||0}Fi(t){this.Ai.Ii=t}Hi(){return this.Ni(),this.Ei.Vt||this.zi.Vt}Ui(){return this.Ni(),this.Ei.Vt}Tt(t){return this.Ni(),this.Ei.pi=this.Ei.pi&&t.N().ticksVisible,this.zi.pi=this.zi.pi&&t.N().ticksVisible,this.Li.ht(this.Ei,this.Ai),this.Oi.ht(this.zi,this.Ai),this.Li}$i(){return this.Ni(),this.Li.ht(this.Ei,this.Ai),this.Oi.ht(this.zi,this.Ai),this.Oi}Ni(){this.St&&(this.Ei.pi=!0,this.zi.pi=!1,this.qi(this.Ei,this.zi,this.Ai))}}class tp extends td{constructor(t,i,e){super(),this.Jt=t,this.Yi=i,this.ji=e}qi(t,i,e){if(t.Vt=!1,2===this.Jt.N().mode)return;let s=this.Jt.N().horzLine;if(!s.labelVisible)return;let h=this.Yi.zt();if(!this.Jt.Vt()||this.Yi.Zi()||null===h)return;let r=this.Yi.Ki().K(s.labelBackgroundColor);e.X=r.X,t.R=r.G;let n=2/12*this.Yi.P();e.Ti=n,e.Ri=n;let l=this.ji(this.Yi);e.Bi=l.Bi,t.ri=this.Yi.Xi(l.gt,h),t.Vt=!0}}let tm=/[1-9]/g;class tg{constructor(){this.Yt=null}ht(t){this.Yt=t}nt(t,i){if(null===this.Yt||!1===this.Yt.Vt||0===this.Yt.ri.length)return;let e=t.useMediaCoordinateSpace(({context:t})=>(t.font=i.k,Math.round(i.Gi.Vi(t,B(this.Yt).ri,tm))));if(e<=0)return;let s=i.Ji,h=e+2*s,r=h/2,n=this.Yt.Qi,l=this.Yt.Bi,o=Math.floor(l-r)+.5;o<0?(l+=Math.abs(0-o),o=Math.floor(l-r)+.5):o+h>n&&(l-=Math.abs(n-(o+h)),o=Math.floor(l-r)+.5);let a=o+h,u=Math.ceil(0+i.S+i.C+i.A+i.P+i.V);t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:e,verticalPixelRatio:s})=>{let h=B(this.Yt);t.fillStyle=h.X;let r=Math.round(o*e),n=Math.round(0*s),l=Math.round(a*e),c=Math.round(u*s),f=Math.round(2*e);if(t.beginPath(),t.moveTo(r,n),t.lineTo(r,c-f),t.arcTo(r,c,r+f,c,f),t.lineTo(l-f,c),t.arcTo(l,c,l,c-f,f),t.lineTo(l,n),t.fill(),h.pi){let r=Math.round(h.Bi*e),l=Math.round((n+i.C)*s);t.fillStyle=h.R;let o=Math.max(1,Math.floor(e)),a=Math.floor(.5*e);t.fillRect(r-a,n,o,l-n)}}),t.useMediaCoordinateSpace(({context:t})=>{let e=B(this.Yt),h=0+i.S+i.C+i.A+i.P/2;t.font=i.k,t.textAlign="left",t.textBaseline="middle",t.fillStyle=e.R;let r=i.Gi.Di(t,"Apr0");t.translate(o+s,h+r),t.fillText(e.ri,0,0)})}}class tv{constructor(t,i,e){this.St=!0,this.Gt=new tg,this.Xt={Vt:!1,X:"#4c525e",R:"white",ri:"",Qi:0,Bi:NaN,pi:!0},this.Ct=t,this.ts=i,this.ji=e}Pt(){this.St=!0}Tt(){return this.St&&(this.Rt(),this.St=!1),this.Gt.ht(this.Xt),this.Gt}Rt(){let t=this.Xt;if(t.Vt=!1,2===this.Ct.N().mode)return;let i=this.Ct.N().vertLine;if(!i.labelVisible)return;let e=this.ts.At();if(e.Zi())return;t.Qi=e.Qi();let s=this.ji();if(null===s)return;t.Bi=s.Bi;let h=e.ss(this.Ct.Bt());t.ri=e.ns(B(h)),t.Vt=!0;let r=this.ts.Ki().K(i.labelBackgroundColor);t.X=r.X,t.R=r.G,t.pi=e.N().ticksVisible}}class tb{constructor(){this.es=null,this.rs=0}hs(){return this.rs}ls(t){this.rs=t}Wt(){return this.es}_s(t){this.es=t}us(t){return[]}cs(){return[]}Vt(){return!0}}(e=p||(p={}))[e.Normal=0]="Normal",e[e.Magnet=1]="Magnet",e[e.Hidden=2]="Hidden",e[e.MagnetOHLC=3]="MagnetOHLC";class ty extends tb{constructor(t,i){let e,s,h,r;super(),this.yt=null,this.ds=NaN,this.fs=0,this.ps=!1,this.vs=new Map,this.ws=!1,this.gs=new WeakMap,this.Ms=new WeakMap,this.bs=NaN,this.xs=NaN,this.Ss=NaN,this.Cs=NaN,this.ts=t,this.ys=i,this.Ps=(e=()=>this.ds,s=()=>this.xs,t=>{let i=s(),h=e();if(t===B(this.yt).ks())return{gt:h,Bi:i};{let e=B(t.zt());return{gt:t.Ts(i,e),Bi:i}}});let n=(h=()=>this.fs,r=()=>this.si(),()=>{let t=this.ts.At().Rs(h()),i=r();return t&&Number.isFinite(i)?{wt:t,Bi:i}:null});this.Ds=new tv(this,t,n)}N(){return this.ys}Vs(t,i){this.Ss=t,this.Cs=i}Is(){this.Ss=NaN,this.Cs=NaN}Bs(){return this.Ss}As(){return this.Cs}Es(t,i,e){this.ws||(this.ws=!0),this.ps=!0,this.zs(t,i,e)}Bt(){return this.fs}si(){return this.bs}ni(){return this.xs}Vt(){return this.ps}Ls(){this.ps=!1,this.Os(),this.ds=NaN,this.bs=NaN,this.xs=NaN,this.yt=null,this.Is(),this.Ns()}Ws(t){let i=this.gs.get(t);i||(i=new tl(this,t),this.gs.set(t,i));let e=this.Ms.get(t);return e||(e=new tr(this.ts,this,t),this.Ms.set(t,e)),[i,e]}ti(t){return t===this.yt&&this.ys.horzLine.visible}ii(){return this.ys.vertLine.visible}Fs(t,i){this.ps&&this.yt===t||this.vs.clear();let e=[];return this.yt===t&&e.push(this.Hs(this.vs,i,this.Ps)),e}cs(){return this.ps?[this.Ds]:[]}Us(){return this.yt}Ns(){this.ts.$s().forEach(t=>{this.gs.get(t)?.Pt(),this.Ms.get(t)?.Pt()}),this.vs.forEach(t=>t.Pt()),this.Ds.Pt()}qs(t){return t&&!t.ks().Zi()?t.ks():null}zs(t,i,e){this.Ys(t,i,e)&&this.Ns()}Ys(t,i,e){let s=this.bs,h=this.xs,r=this.ds,n=this.fs,l=this.yt,o=this.qs(e);this.fs=t,this.bs=isNaN(t)?NaN:this.ts.At().qt(t),this.yt=e;let a=null!==o?o.zt():null;return null!==o&&null!==a?(this.ds=i,this.xs=o.Nt(i,a)):(this.ds=NaN,this.xs=NaN),s!==this.bs||h!==this.xs||n!==this.fs||r!==this.ds||l!==this.yt}Os(){let t=this.ts.js().map(t=>t.Ks().Zs()).filter($),i=0===t.length?null:Math.max(...t);this.fs=null!==i?i:NaN}Hs(t,i,e){let s=t.get(i);return void 0===s&&(s=new tp(this,i,e),t.set(i,s)),s}}function tw(t){return"left"===t||"right"===t}class tM{constructor(t){this.Xs=new Map,this.Gs=[],this.Js=t}Qs(t,i){var e;let s=(e=this.Xs.get(t),void 0===e?i:{tn:Math.max(e.tn,i.tn),sn:e.sn||i.sn});this.Xs.set(t,s)}nn(){return this.Js}en(t){let i=this.Xs.get(t);return void 0===i?{tn:this.Js}:{tn:Math.max(this.Js,i.tn),sn:i.sn}}rn(){this.hn(),this.Gs=[{an:0}]}ln(t){this.hn(),this.Gs=[{an:1,Ft:t}]}_n(t){this.un(),this.Gs.push({an:5,Ft:t})}hn(){this.un(),this.Gs.push({an:6})}cn(){this.hn(),this.Gs=[{an:4}]}dn(t){this.hn(),this.Gs.push({an:2,Ft:t})}fn(t){this.hn(),this.Gs.push({an:3,Ft:t})}pn(){return this.Gs}vn(t){for(let i of t.Gs)this.mn(i);this.Js=Math.max(this.Js,t.Js),t.Xs.forEach((t,i)=>{this.Qs(i,t)})}static wn(){return new tM(2)}static gn(){return new tM(3)}mn(t){switch(t.an){case 0:this.rn();break;case 1:this.ln(t.Ft);break;case 2:this.dn(t.Ft);break;case 3:this.fn(t.Ft);break;case 4:this.cn();break;case 5:this._n(t.Ft);break;case 6:this.un()}}un(){let t=this.Gs.findIndex(t=>5===t.an);-1!==t&&this.Gs.splice(t,1)}}function t_(t,i){if(!F(t))return"n/a";if(!A(i)||i<0||i>16)throw TypeError("invalid length");return 0===i?t.toString():("0000000000000000"+t.toString()).slice(-i)}class tS{constructor(t,i){if(i||(i=1),F(t)&&A(t)||(t=100),t<0)throw TypeError("invalid base");this.Yi=t,this.Mn=i,this.bn()}format(t){let i=t<0?"−":"";return t=Math.abs(t),i+this.xn(t)}bn(){if(this.Sn=0,this.Yi>0&&this.Mn>0){let t=this.Yi;for(;t>1;)t/=10,this.Sn++}}xn(t){let i=this.Yi/this.Mn,e=Math.floor(t),s="",h=void 0!==this.Sn?this.Sn:NaN;if(i>1){let r=+(Math.round(t*i)-e*i).toFixed(this.Sn);r>=i&&(r-=i,e+=1),s="."+t_(+r.toFixed(this.Sn)*this.Mn,h)}else e=Math.round(e*i)/i,h>0&&(s="."+t_(0,h));return e.toFixed(0)+s}}class tx extends tS{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class tC{constructor(t){this.Cn=t}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.yn(t):t<999995?i+this.yn(t/1e3)+"K":t<0x3b9ac9fb?(t=1e3*Math.round(t/1e3),i+this.yn(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.yn(t/1e9)+"B")}yn(t){let i=Math.pow(10,this.Cn);return((t=Math.round(t*i)/i)>=1e-15&&t<1?t.toFixed(this.Cn).replace(/\.?0+$/,""):String(t)).replace(/(\.[1-9]*)0+$/,(t,i)=>i)}}let tP=/[2-9]/g;class tR{constructor(t=50){this.Pn=0,this.kn=1,this.Tn=1,this.Rn={},this.Dn=new Map,this.Vn=t}In(){this.Pn=0,this.Dn.clear(),this.kn=1,this.Tn=1,this.Rn={}}Vi(t,i,e){return this.Bn(t,i,e).width}Di(t,i,e){let s=this.Bn(t,i,e);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}Bn(t,i,e){let s=String(i).replace(e||tP,"0");if(this.Dn.has(s))return N(this.Dn.get(s)).An;if(this.Pn===this.Vn){let t=this.Rn[this.Tn];delete this.Rn[this.Tn],this.Dn.delete(t),this.Tn++,this.Pn--}t.save(),t.textBaseline="middle";let h=t.measureText(s);return t.restore(),0===h.width&&i.length||(this.Dn.set(s,{An:h,En:this.kn}),this.Rn[this.kn]=s,this.Pn++,this.kn++),h}}class tO{constructor(t){this.zn=null,this.M=null,this.Ln="right",this.On=t}Nn(t,i,e){this.zn=t,this.M=i,this.Ln=e}nt(t){null!==this.M&&null!==this.zn&&this.zn.nt(t,this.M,this.On,this.Ln)}}class tk{constructor(t,i,e){this.Wn=t,this.On=new tR(50),this.Fn=i,this.O=e,this.W=-1,this.Gt=new tO(this.On)}Tt(){let t=this.O.Hn(this.Fn);if(null===t)return null;let i=t.Un(this.Fn)?t.$n():this.Fn.Wt();if(null===i)return null;let e=t.qn(i);if("overlay"===e)return null;let s=this.O.Yn();return s.P!==this.W&&(this.W=s.P,this.On.In()),this.Gt.Nn(this.Wn.$i(),s,e),this.Gt}}class tz extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}jn(t,i){if(!this.Yt?.Vt)return null;let{ut:e,ct:s,Zn:h}=this.Yt;return i>=e-s-7&&i<=e+s+7?{Kn:this.Yt,Zn:h}:null}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(null===this.Yt||!1===this.Yt.Vt)return;let h=Math.round(this.Yt.ut*s);h<0||h>i.height||(t.lineCap="butt",t.strokeStyle=this.Yt.R,t.lineWidth=Math.floor(this.Yt.ct*e),T(t,this.Yt.Kt),L(t,h,0,i.width))}}class tY{constructor(t){this.Xn={ut:0,R:"rgba(0, 0, 0, 0)",ct:1,Kt:0,Vt:!1},this.Gn=new tz,this.St=!0,this.Jn=t,this.Qn=t.Qt(),this.Gn.ht(this.Xn)}Pt(){this.St=!0}Tt(){return this.Jn.Vt()?(this.St&&(this.te(),this.St=!1),this.Gn):null}}class tE extends tY{constructor(t){super(t)}te(){this.Xn.Vt=!1;let t=this.Jn.Wt(),i=t.ie().ie;if(2!==i&&3!==i)return;let e=this.Jn.N();if(!e.baseLineVisible||!this.Jn.Vt())return;let s=this.Jn.zt();null!==s&&(this.Xn.Vt=!0,this.Xn.ut=t.Nt(s.Ft,s.Ft),this.Xn.R=e.baseLineColor,this.Xn.ct=e.baseLineWidth,this.Xn.Kt=e.baseLineStyle)}}class tT extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}se(){return this.Yt}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){let s=this.Yt;if(null===s)return;let h=Math.max(1,Math.floor(i)),r=h%2/2,n=Math.round(s.ne.x*i)+r,l=s.ne.y*e;t.fillStyle=s.ee,t.beginPath();let o=Math.max(2,1.5*s.re)*i;t.arc(n,l,o,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.he,t.beginPath(),t.arc(n,l,s.ft*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=h,t.strokeStyle=s.ae,t.beginPath(),t.arc(n,l,s.ft*i+h/2,0,2*Math.PI,!1),t.stroke()}}let tL=[{le:0,oe:.25,_e:4,ue:10,ce:.25,de:0,fe:.4,pe:.8},{le:.25,oe:.525,_e:10,ue:14,ce:0,de:0,fe:.8,pe:0},{le:.525,oe:1,_e:14,ue:14,ce:0,de:0,fe:0,pe:0}];class tV{constructor(t){this.Gt=new tT,this.St=!0,this.ve=!0,this.me=performance.now(),this.we=this.me-1,this.ge=t}Me(){this.we=this.me-1,this.Pt()}be(){if(this.Pt(),2===this.ge.N().lastPriceAnimation){let t=performance.now(),i=this.we-t;if(i>0)return void(i<650&&(this.we+=2600));this.me=t,this.we=t+2600}}Pt(){this.St=!0}xe(){this.ve=!0}Vt(){return 0!==this.ge.N().lastPriceAnimation}Se(){switch(this.ge.N().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.we}}Tt(){return this.St?(this.Rt(),this.St=!1,this.ve=!1):this.ve&&(this.Ce(),this.ve=!1),this.Gt}Rt(){this.Gt.ht(null);let t=this.ge.Qt().At(),i=t.ye(),e=this.ge.zt();if(null===i||null===e)return;let s=this.ge.Pe(!0);if(s.ke||!i.Te(s.Re))return;let h={x:t.qt(s.Re),y:this.ge.Wt().Nt(s.gt,e.Ft)},r=s.R,n=this.ge.N().lineWidth,l=this.De(this.Ve(),r);this.Gt.ht({ee:r,re:n,he:l.he,ae:l.ae,ft:l.ft,ne:h})}Ce(){let t=this.Gt.se();if(null!==t){let i=this.De(this.Ve(),t.ee);t.he=i.he,t.ae=i.ae,t.ft=i.ft}}Ve(){return this.Se()?performance.now()-this.me:2599}Ie(t,i,e,s){return this.ge.Qt().Ki().j(t,e+(s-e)*i)}De(t,i){var e;let s,h=t%2600/2600;for(let t of tL)if(h>=t.le&&h<=t.oe){s=t;break}V(void 0!==s,"Last price animation internal logic error");let r=(h-s.le)/(s.oe-s.le);return{he:this.Ie(i,r,s.ce,s.de),ae:this.Ie(i,r,s.fe,s.pe),ft:(e=s._e)+(s.ue-e)*r}}}class tN extends tY{constructor(t){super(t)}te(){let t=this.Xn;t.Vt=!1;let i=this.Jn.N();if(!i.priceLineVisible||!this.Jn.Vt())return;let e=this.Jn.Pe(0===i.priceLineSource);e.ke||(t.Vt=!0,t.ut=e.Bi,t.R=this.Jn.Be(e.R),t.ct=i.priceLineWidth,t.Kt=i.priceLineStyle)}}class tB extends td{constructor(t){super(),this.Jt=t}qi(t,i,e){t.Vt=!1,i.Vt=!1;let s=this.Jt;if(!s.Vt())return;let h=s.N(),r=h.lastValueVisible,n=""!==s.Ae(),l=0===h.seriesLastValueMode,o=s.Pe(!1);if(o.ke)return;r&&(t.ri=this.Ee(o,r,l),t.Vt=0!==t.ri.length),(n||l)&&(i.ri=this.ze(o,r,n,l),i.Vt=i.ri.length>0);let a=s.Be(o.R),u=this.Jt.Qt().Ki().K(a);e.X=u.X,e.Bi=o.Bi,i.Ht=s.Qt().Ut(o.Bi/s.Wt().$t()),t.Ht=a,t.R=u.G,i.R=u.G}ze(t,i,e,s){let h="",r=this.Jt.Ae();return e&&0!==r.length&&(h+=`${r} `),i&&s&&(h+=this.Jt.Wt().Le()?t.Oe:t.Ne),h.trim()}Ee(t,i,e){return i?e?this.Jt.Wt().Le()?t.Ne:t.Oe:t.ri:""}}function tD(t,i,e,s){let h=Number.isFinite(i),r=Number.isFinite(e);return h&&r?t(i,e):h||r?h?i:e:s}class tW{constructor(t,i){this.We=t,this.Fe=i}He(t){return null!==t&&this.We===t.We&&this.Fe===t.Fe}Ue(){return new tW(this.We,this.Fe)}$e(){return this.We}qe(){return this.Fe}Ye(){return this.Fe-this.We}Zi(){return this.Fe===this.We||Number.isNaN(this.Fe)||Number.isNaN(this.We)}vn(t){return null===t?this:new tW(tD(Math.min,this.$e(),t.$e(),-1/0),tD(Math.max,this.qe(),t.qe(),1/0))}je(t){if(!F(t)||0==this.Fe-this.We)return;let i=.5*(this.Fe+this.We),e=this.Fe-i,s=this.We-i;e*=t,s*=t,this.Fe=i+e,this.We=i+s}Ze(t){F(t)&&(this.Fe+=t,this.We+=t)}Ke(){return{minValue:this.We,maxValue:this.Fe}}static Xe(t){return null===t?null:new tW(t.minValue,t.maxValue)}}class tj{constructor(t,i){this.Ge=t,this.Je=i||null}Qe(){return this.Ge}tr(){return this.Je}Ke(){return{priceRange:null===this.Ge?null:this.Ge.Ke(),margins:this.Je||void 0}}static Xe(t){return null===t?null:new tj(tW.Xe(t.priceRange),t.margins)}}class tF extends tY{constructor(t,i){super(t),this.ir=i}te(){let t=this.Xn;t.Vt=!1;let i=this.ir.N();if(!this.Jn.Vt()||!i.lineVisible)return;let e=this.ir.sr();null!==e&&(t.Vt=!0,t.ut=e,t.R=i.color,t.ct=i.lineWidth,t.Kt=i.lineStyle,t.Zn=this.ir.N().id)}}class tA extends td{constructor(t,i){super(),this.ge=t,this.ir=i}qi(t,i,e){t.Vt=!1,i.Vt=!1;let s=this.ir.N(),h=s.axisLabelVisible,r=""!==s.title,n=this.ge;if(!h||!n.Vt())return;let l=this.ir.sr();if(null===l)return;r&&(i.ri=s.title,i.Vt=!0),i.Ht=n.Qt().Ut(l/n.Wt().$t()),t.ri=this.nr(s.price),t.Vt=!0;let o=this.ge.Qt().Ki().K(s.axisLabelColor||s.color);e.X=o.X;let a=s.axisLabelTextColor||o.G;t.R=a,i.R=a,e.Bi=l}nr(t){let i=this.ge.zt();return null===i?"":this.ge.Wt().Xi(t,i.Ft)}}class tI{constructor(t,i){this.ge=t,this.ys=i,this.er=new tF(t,this),this.Wn=new tA(t,this),this.rr=new tk(this.Wn,t,t.Qt())}hr(t){j(this.ys,t),this.Pt(),this.ge.Qt().ar()}N(){return this.ys}lr(){return this.er}_r(){return this.rr}ur(){return this.Wn}Pt(){this.er.Pt(),this.Wn.Pt()}sr(){let t=this.ge,i=t.Wt();if(t.Qt().At().Zi()||i.Zi())return null;let e=t.zt();return null===e?null:i.Nt(this.ys.price,e.Ft)}}class tQ extends tb{constructor(t){super(),this.ts=t}Qt(){return this.ts}}let tJ={Bar:(t,i,e,s)=>{let h=i.upColor,r=i.downColor,n=B(t(e,s)),l=D(n.Ft[0])<=D(n.Ft[3]);return{cr:n.R??(l?h:r)}},Candlestick:(t,i,e,s)=>{let h=i.upColor,r=i.downColor,n=i.borderUpColor,l=i.borderDownColor,o=i.wickUpColor,a=i.wickDownColor,u=B(t(e,s)),c=D(u.Ft[0])<=D(u.Ft[3]);return{cr:u.R??(c?h:r),dr:u.Ht??(c?n:l),pr:u.vr??(c?o:a)}},Custom:(t,i,e,s)=>({cr:B(t(e,s)).R??i.color}),Area:(t,i,e,s)=>{let h=B(t(e,s));return{cr:h.vt??i.lineColor,vt:h.vt??i.lineColor,mr:h.mr??i.topColor,wr:h.wr??i.bottomColor}},Baseline:(t,i,e,s)=>{let h=B(t(e,s));return{cr:h.Ft[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,gr:h.gr??i.topLineColor,Mr:h.Mr??i.bottomLineColor,br:h.br??i.topFillColor1,Sr:h.Sr??i.topFillColor2,Cr:h.Cr??i.bottomFillColor1,yr:h.yr??i.bottomFillColor2}},Line:(t,i,e,s)=>{let h=B(t(e,s));return{cr:h.R??i.color,vt:h.R??i.color}},Histogram:(t,i,e,s)=>({cr:B(t(e,s)).R??i.color})};class t${constructor(t){this.Pr=(t,i)=>void 0!==i?i.Ft:this.ge.Ks().kr(t),this.ge=t,this.Tr=tJ[t.Rr()]}Dr(t,i){return this.Tr(this.Pr,this.ge.N(),t,i)}}function tU(t,i,e,s,h=0,r=i.length){let n=r-h;for(;0<n;){let r=n>>1,l=h+r;s(i[l],e)===t?(h=l+1,n-=r+1):n=r}return h}let tZ=tU.bind(null,!0),tH=tU.bind(null,!1);(r=m||(m={}))[r.NearestLeft=-1]="NearestLeft",r[r.None=0]="None",r[r.NearestRight=1]="NearestRight";class tG{constructor(){this.Vr=[],this.Ir=new Map,this.Br=new Map,this.Ar=[]}Er(){return this.zr()>0?this.Vr[this.Vr.length-1]:null}Lr(){return this.zr()>0?this.Or(0):null}Zs(){return this.zr()>0?this.Or(this.Vr.length-1):null}zr(){return this.Vr.length}Zi(){return 0===this.zr()}Te(t){return null!==this.Nr(t,0)}kr(t){return this.Wr(t)}Wr(t,i=0){let e=this.Nr(t,i);return null===e?null:{...this.Fr(e),Re:this.Or(e)}}Hr(){return this.Vr}Ur(t,i,e){if(this.Zi())return null;let s=null;for(let h of e)s=tK(s,this.$r(t,i,h));return s}ht(t){this.Br.clear(),this.Ir.clear(),this.Vr=t,this.Ar=t.map(t=>t.Re)}qr(){return this.Ar}Or(t){return this.Vr[t].Re}Fr(t){return this.Vr[t]}Nr(t,i){let e=this.Yr(t);if(null===e&&0!==i)switch(i){case -1:return this.jr(t);case 1:return this.Zr(t);default:throw TypeError("Unknown search mode")}return e}jr(t){let i=this.Kr(t);return i>0&&(i-=1),i!==this.Vr.length&&this.Or(i)<t?i:null}Zr(t){let i=this.Xr(t);return i!==this.Vr.length&&t<this.Or(i)?i:null}Yr(t){let i=this.Kr(t);return i===this.Vr.length||t<this.Vr[i].Re?null:i}Kr(t){return tZ(this.Vr,t,(t,i)=>t.Re<i)}Xr(t){return tH(this.Vr,t,(t,i)=>t.Re>i)}Gr(t,i,e){let s=null;for(let h=t;h<i;h++){let t=this.Vr[h].Ft[e];Number.isNaN(t)||(null===s?s={Jr:t,Qr:t}:(t<s.Jr&&(s.Jr=t),t>s.Qr&&(s.Qr=t)))}return s}$r(t,i,e){if(this.Zi())return null;let s=null,h=B(this.Lr()),r=B(this.Zs()),n=Math.max(t,h),l=Math.min(i,r),o=30*Math.ceil(n/30),a=Math.max(o,30*Math.floor(l/30));{let t=this.Kr(n),h=this.Xr(Math.min(l,o,i));s=tK(s,this.Gr(t,h,e))}let u=this.Ir.get(e);void 0===u&&(u=new Map,this.Ir.set(e,u));for(let t=Math.max(o+1,n);t<a;t+=30){let i=Math.floor(t/30),h=u.get(i);if(void 0===h){let t=this.Kr(30*i),s=this.Xr((i+1)*30-1);h=this.Gr(t,s,e),u.set(i,h)}s=tK(s,h)}{let t=this.Kr(a),i=this.Xr(l);s=tK(s,this.Gr(t,i,e))}return s}}function tK(t,i){return null===t?i:null===i?t:{Jr:Math.min(t.Jr,i.Jr),Qr:Math.max(t.Qr,i.Qr)}}class tX{constructor(t){this.th=t}nt(t,i,e){this.th.draw(t)}ih(t,i,e){this.th.drawBackground?.(t)}}class tq{constructor(t){this.Dn=null,this.sh=t}Tt(){let t=this.sh.renderer();if(null===t)return null;if(this.Dn?.nh===t)return this.Dn.eh;let i=new tX(t);return this.Dn={nh:t,eh:i},i}rh(){return this.sh.zOrder?.()??"normal"}}class t0{constructor(t){this.hh=null,this.ah=t}oh(){return this.ah}Ns(){this.ah.updateAllViews?.()}Ws(){let t=this.ah.paneViews?.()??[];if(this.hh?.nh===t)return this.hh.eh;let i=t.map(t=>new tq(t));return this.hh={nh:t,eh:i},i}jn(t,i){return this.ah.hitTest?.(t,i)??null}}let t1=class extends t0{us(){return[]}};class t2{constructor(t){this.th=t}nt(t,i,e){this.th.draw(t)}ih(t,i,e){this.th.drawBackground?.(t)}}class t3{constructor(t){this.Dn=null,this.sh=t}Tt(){let t=this.sh.renderer();if(null===t)return null;if(this.Dn?.nh===t)return this.Dn.eh;let i=new t2(t);return this.Dn={nh:t,eh:i},i}rh(){return this.sh.zOrder?.()??"normal"}}function t5(t){return{ri:t.text(),Bi:t.coordinate(),Ii:t.fixedCoordinate?.(),R:t.textColor(),X:t.backColor(),Vt:t.visible?.()??!0,pi:t.tickVisible?.()??!0}}class t6{constructor(t,i){this.Gt=new tg,this._h=t,this.uh=i}Tt(){return this.Gt.ht({Qi:this.uh.Qi(),...t5(this._h)}),this.Gt}}class t4 extends td{constructor(t,i){super(),this._h=t,this.Yi=i}qi(t,i,e){let s=t5(this._h);e.X=s.X,t.R=s.R;let h=2/12*this.Yi.P();e.Ti=h,e.Ri=h,e.Bi=s.Bi,e.Ii=s.Ii,t.ri=s.ri,t.Vt=s.Vt,t.pi=s.pi}}class t9 extends t0{constructor(t,i){super(t),this.dh=null,this.fh=null,this.ph=null,this.mh=null,this.ge=i}cs(){let t=this.ah.timeAxisViews?.()??[];if(this.dh?.nh===t)return this.dh.eh;let i=this.ge.Qt().At(),e=t.map(t=>new t6(t,i));return this.dh={nh:t,eh:e},e}Fs(){let t=this.ah.priceAxisViews?.()??[];if(this.fh?.nh===t)return this.fh.eh;let i=this.ge.Wt(),e=t.map(t=>new t4(t,i));return this.fh={nh:t,eh:e},e}wh(){let t=this.ah.priceAxisPaneViews?.()??[];if(this.ph?.nh===t)return this.ph.eh;let i=t.map(t=>new t3(t));return this.ph={nh:t,eh:i},i}gh(){let t=this.ah.timeAxisPaneViews?.()??[];if(this.mh?.nh===t)return this.mh.eh;let i=t.map(t=>new t3(t));return this.mh={nh:t,eh:i},i}Mh(t,i){return this.ah.autoscaleInfo?.(t,i)??null}}function t8(t,i,e,s){t.forEach(t=>{i(t).forEach(t=>{t.rh()===e&&s.push(t)})})}function t7(t){return t.Ws()}function it(t){return t.wh()}function ii(t){return t.gh()}let ie=["Area","Line","Baseline"];class is extends tQ{constructor(t,i,e,s,h){super(t),this.Yt=new tG,this.er=new tN(this),this.bh=[],this.xh=new tE(this),this.Sh=null,this.Ch=null,this.yh=null,this.Ph=[],this.ys=e,this.kh=i;let r=new tB(this);this.vs=[r],this.rr=new tk(r,this,t),ie.includes(this.kh)&&(this.Sh=new tV(this)),this.Th(),this.sh=s(this,this.Qt(),h)}m(){null!==this.yh&&clearTimeout(this.yh)}Be(t){return this.ys.priceLineColor||t}Pe(t){let i,e,s={ke:!0},h=this.Wt();if(this.Qt().At().Zi()||h.Zi()||this.Yt.Zi())return s;let r=this.Qt().At().ye(),n=this.zt();if(null===r||null===n)return s;if(t){let t=this.Yt.Er();if(null===t)return s;i=t,e=t.Re}else{let t=this.Yt.Wr(r.bi(),-1);if(null===t||null===(i=this.Yt.kr(t.Re)))return s;e=t.Re}let l=i.Ft[3],o=this.Rh().Dr(e,{Ft:i}),a=h.Nt(l,n.Ft);return{ke:!1,gt:l,ri:h.Xi(l,n.Ft),Oe:h.Dh(l),Ne:h.Vh(l,n.Ft),R:o.cr,Bi:a,Re:e}}Rh(){return null!==this.Ch||(this.Ch=new t$(this)),this.Ch}N(){return this.ys}hr(t){let i=t.priceScaleId;void 0!==i&&i!==this.ys.priceScaleId&&this.Qt().Ih(this,i),j(this.ys,t),void 0!==t.priceFormat&&(this.Th(),this.Qt().Bh()),this.Qt().Ah(this),this.Qt().Eh(),this.sh.Pt("options")}ht(t,i){this.Yt.ht(t),this.sh.Pt("data"),null!==this.Sh&&(i&&i.zh?this.Sh.be():0===t.length&&this.Sh.Me());let e=this.Qt().Hn(this);this.Qt().Lh(e),this.Qt().Ah(this),this.Qt().Eh(),this.Qt().ar()}Oh(t){let i=new tI(this,t);return this.bh.push(i),this.Qt().Ah(this),i}Nh(t){let i=this.bh.indexOf(t);-1!==i&&this.bh.splice(i,1),this.Qt().Ah(this)}Wh(){return this.bh}Rr(){return this.kh}zt(){let t=this.Fh();return null===t?null:{Ft:t.Ft[3],Hh:t.wt}}Fh(){let t=this.Qt().At().ye();if(null===t)return null;let i=t.Uh();return this.Yt.Wr(i,1)}Ks(){return this.Yt}$h(t){let i=this.Yt.kr(t);return null===i?null:"Bar"===this.kh||"Candlestick"===this.kh||"Custom"===this.kh?{qh:i.Ft[0],Yh:i.Ft[1],jh:i.Ft[2],Zh:i.Ft[3]}:i.Ft[3]}Kh(t){let i=[];t8(this.Ph,t7,"top",i);let e=this.Sh;return null!==e&&e.Vt()&&(null===this.yh&&e.Se()&&(this.yh=setTimeout(()=>{this.yh=null,this.Qt().Xh()},0)),e.xe(),i.unshift(e)),i}Ws(){let t=[];this.Gh()||t.push(this.xh),t.push(this.sh,this.er);let i=this.bh.map(t=>t.lr());return t.push(...i),t8(this.Ph,t7,"normal",t),t}Jh(){return this.Qh(t7,"bottom")}ta(t){return this.Qh(it,t)}ia(t){return this.Qh(ii,t)}sa(t,i){return this.Ph.map(e=>e.jn(t,i)).filter(t=>null!==t)}us(){return[this.rr,...this.bh.map(t=>t._r())]}Fs(t,i){if(i!==this.es&&!this.Gh())return[];let e=[...this.vs];for(let t of this.bh)e.push(t.ur());return this.Ph.forEach(t=>{e.push(...t.Fs())}),e}cs(){let t=[];return this.Ph.forEach(i=>{t.push(...i.cs())}),t}Mh(t,i){if(void 0!==this.ys.autoscaleInfoProvider){let e=this.ys.autoscaleInfoProvider(()=>{let e=this.na(t,i);return null===e?null:e.Ke()});return tj.Xe(e)}return this.na(t,i)}ea(){return this.ys.priceFormat.minMove}ra(){return this.ha}Ns(){for(let t of(this.sh.Pt(),this.vs))t.Pt();for(let t of this.bh)t.Pt();this.er.Pt(),this.xh.Pt(),this.Sh?.Pt(),this.Ph.forEach(t=>t.Ns())}Wt(){return B(super.Wt())}Et(t){if(!(("Line"===this.kh||"Area"===this.kh||"Baseline"===this.kh)&&this.ys.crosshairMarkerVisible))return null;let i=this.Yt.kr(t);return null===i?null:{gt:i.Ft[3],ft:this.aa(),Ht:this.la(),Ot:this.oa(),Lt:this._a(t)}}Ae(){return this.ys.title}Vt(){return this.ys.visible}ua(t){this.Ph.push(new t9(t,this))}ca(t){this.Ph=this.Ph.filter(i=>i.oh()!==t)}da(){if("Custom"===this.kh)return t=>this.sh.fa(t)}pa(){if("Custom"===this.kh)return t=>this.sh.va(t)}ma(){return this.Yt.qr()}Gh(){return!tw(this.Wt().wa())}na(t,i){if(!A(t)||!A(i)||this.Yt.Zi())return null;let e="Line"===this.kh||"Area"===this.kh||"Baseline"===this.kh||"Histogram"===this.kh?[3]:[2,1],s=this.Yt.Ur(t,i,e),h=null!==s?new tW(s.Jr,s.Qr):null,r=null;if("Histogram"===this.Rr()){let t=this.ys.base,i=new tW(t,t);h=null!==h?h.vn(i):i}return this.Ph.forEach(e=>{let s=e.Mh(t,i);if(s?.priceRange){let t=new tW(s.priceRange.minValue,s.priceRange.maxValue);h=null!==h?h.vn(t):t}s?.margins&&(r=s.margins)}),new tj(h,r)}aa(){switch(this.kh){case"Line":case"Area":case"Baseline":return this.ys.crosshairMarkerRadius}return 0}la(){switch(this.kh){case"Line":case"Area":case"Baseline":{let t=this.ys.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}oa(){switch(this.kh){case"Line":case"Area":case"Baseline":return this.ys.crosshairMarkerBorderWidth}return 0}_a(t){switch(this.kh){case"Line":case"Area":case"Baseline":{let t=this.ys.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.Rh().Dr(t).cr}Th(){switch(this.ys.priceFormat.type){case"custom":this.ha={format:this.ys.priceFormat.formatter};break;case"volume":this.ha=new tC(this.ys.priceFormat.precision);break;case"percent":this.ha=new tx(this.ys.priceFormat.precision);break;default:{let t=Math.pow(10,this.ys.priceFormat.precision);this.ha=new tS(t,this.ys.priceFormat.minMove*t)}}null!==this.es&&this.es.ga()}Qh(t,i){let e=[];return t8(this.Ph,t,i,e),e}}let ih=[3],ir=[0,1,2,3];class il{constructor(t){this.ys=t}Ma(t,i,e){if(0===this.ys.mode)return t;let s=e.ks(),h=s.zt();if(null===h)return t;let r=s.Nt(t,h),n=e.ba().filter(t=>t instanceof is).reduce((t,s)=>{if(e.Un(s)||!s.Vt())return t;let h=s.Wt(),r=s.Ks();if(h.Zi()||!r.Te(i))return t;let n=r.kr(i);if(null===n)return t;let l=D(s.zt()),o=3===this.ys.mode?ir:ih;return t.concat(o.map(t=>h.Nt(n.Ft[t],l.Ft)))},[]);if(0===n.length)return t;n.sort((t,i)=>Math.abs(t-r)-Math.abs(i-r));let l=n[0];return s.Ts(l,h)}}class io extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(null===this.Yt)return;let h=Math.max(1,Math.floor(e));t.lineWidth=h,t.save(),t.lineWidth%2&&t.translate(.5,.5),(()=>{let r=B(this.Yt);if(r.xa){for(let s of(t.strokeStyle=r.Sa,T(t,r.Ca),t.beginPath(),r.ya)){let r=Math.round(s.Pa*e);t.moveTo(r,-h),t.lineTo(r,i.height+h)}t.stroke()}if(r.ka){for(let e of(t.strokeStyle=r.Ta,T(t,r.Ra),t.beginPath(),r.Da)){let r=Math.round(e.Pa*s);t.moveTo(-h,r),t.lineTo(i.width+h,r)}t.stroke()}})(),t.restore()}}class ia{constructor(t){this.Gt=new io,this.St=!0,this.yt=t}Pt(){this.St=!0}Tt(){if(this.St){let t=this.yt.Qt().N().grid,i={ka:t.horzLines.visible,xa:t.vertLines.visible,Ta:t.horzLines.color,Sa:t.vertLines.color,Ra:t.horzLines.style,Ca:t.vertLines.style,Da:this.yt.ks().Va(),ya:(this.yt.Qt().At().Va()||[]).map(t=>({Pa:t.coord}))};this.Gt.ht(i),this.St=!1}return this.Gt}}class iu{constructor(t){this.sh=new ia(t)}lr(){return this.sh}}let ic={Ia:4,Ba:1e-4};function id(t,i){let e=100*(t-i)/i;return i<0?-e:e}function ip(t,i){let e=100*(t-i)/i+100;return i<0?-e:e}function im(t,i){let e=Math.abs(t);if(e<1e-15)return 0;let s=Math.log10(e+i.Ba)+i.Ia;return t<0?-s:s}function ig(t,i){let e=Math.abs(t);if(e<1e-15)return 0;let s=Math.pow(10,e-i.Ia)-i.Ba;return t<0?-s:s}function iv(t,i){return null===t?null:new tW(im(t.$e(),i),im(t.qe(),i))}function ib(t,i){return null===t?null:new tW(ig(t.$e(),i),ig(t.qe(),i))}function iy(t){if(null===t)return ic;let i=Math.abs(t.qe()-t.$e());if(i>=1||i<1e-15)return ic;let e=Math.ceil(Math.abs(Math.log10(i))),s=ic.Ia+e;return{Ia:s,Ba:1/Math.pow(10,s)}}function iw(t,i,e){return Math.min(Math.max(t,i),e)}function iM(t){let i=Math.ceil(t);return i%2==0?i-1:i}class i_{constructor(t,i){if(this.Aa=t,this.Ea=i,function(t){if(t<0)return!1;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0}(this.Aa))this.za=[2,2.5,2];else{this.za=[];for(let t=this.Aa;1!==t;){if(t%2==0)this.za.push(2),t/=2;else{if(t%5!=0)throw Error("unexpected base");this.za.push(2,2.5),t/=5}if(this.za.length>100)throw Error("something wrong with base")}}}La(t,i,e){let s=0===this.Aa?0:1/this.Aa,h=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,n=this.Ea[0];for(;;){let t=s-h<=1e-14&&h>s+1e-14,i=e*n-h<=1e-14,l=1-h<=1e-14;if(!(t&&i&&l))break;h/=n,n=this.Ea[++r%this.Ea.length]}if(h<=s+1e-14&&(h=s),h=Math.max(1,h),this.za.length>0&&1e-14>Math.abs(h-1))for(r=0,n=this.za[0];e*n-h<=1e-14&&h>s+1e-14;)h/=n,n=this.za[++r%this.za.length];return h}}class iS{constructor(t,i,e,s){this.Oa=[],this.Yi=t,this.Aa=i,this.Na=e,this.Wa=s}La(t,i){if(t<i)throw Error("high < low");let e=this.Yi.$t(),s=(t-i)*this.Fa()/e,h=new i_(this.Aa,[2,2.5,2]),r=new i_(this.Aa,[2,2,2.5]),n=new i_(this.Aa,[2.5,2,2]),l=[];return l.push(h.La(t,i,s),r.La(t,i,s),n.La(t,i,s)),function(t){if(t.length<1)throw Error("array is empty");let i=t[0];for(let e=1;e<t.length;++e)t[e]<i&&(i=t[e]);return i}(l)}Ha(){let t=this.Yi,i=t.zt();if(null===i)return void(this.Oa=[]);let e=t.$t(),s=this.Na(e-1,i),h=this.Na(0,i),r=this.Yi.N().entireTextOnly?this.Ua()/2:0,n=e-1-r,l=Math.max(s,h),o=Math.min(s,h);if(l===o)return void(this.Oa=[]);let a=this.La(l,o),u=l%a;u+=u<0?a:0;let c=l>=o?1:-1,f=null,d=0;for(let e=l-u;e>o;e-=a){let s=this.Wa(e,i,!0);null!==f&&Math.abs(s-f)<this.Fa()||s<r||s>n||(d<this.Oa.length?(this.Oa[d].Pa=s,this.Oa[d].$a=t.qa(e)):this.Oa.push({Pa:s,$a:t.qa(e)}),d++,f=s,t.Ya()&&(a=this.La(e*c,o)))}this.Oa.length=d}Va(){return this.Oa}Ua(){return this.Yi.P()}Fa(){return Math.ceil(2.5*this.Ua())}}function ix(t){return t.slice().sort((t,i)=>B(t.hs())-B(i.hs()))}(n=g||(g={}))[n.Normal=0]="Normal",n[n.Logarithmic=1]="Logarithmic",n[n.Percentage=2]="Percentage",n[n.IndexedTo100=3]="IndexedTo100";let iC=new tx,iP=new tS(100,1);class iR{constructor(t,i,e,s,h){this.ja=0,this.Za=null,this.Ge=null,this.Ka=null,this.Xa={Ga:!1,Ja:null},this.Qa=0,this.tl=0,this.il=new W,this.sl=new W,this.nl=[],this.el=null,this.rl=null,this.hl=null,this.al=null,this.ha=iP,this.ll=iy(null),this.ol=t,this.ys=i,this._l=e,this.ul=s,this.cl=h,this.dl=new iS(this,100,this.fl.bind(this),this.pl.bind(this))}wa(){return this.ol}N(){return this.ys}hr(t){if(j(this.ys,t),this.ga(),void 0!==t.mode&&this.vl({ie:t.mode}),void 0!==t.scaleMargins){let i=N(t.scaleMargins.top),e=N(t.scaleMargins.bottom);if(i<0||i>1)throw Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(e<0||e>1)throw Error(`Invalid bottom margin - expect value between 0 and 1, given=${e}`);if(i+e>1)throw Error(`Invalid margins - sum of margins must be less than 1, given=${i+e}`);this.ml(),this.rl=null}}wl(){return this.ys.autoScale}Ya(){return 1===this.ys.mode}Le(){return 2===this.ys.mode}gl(){return 3===this.ys.mode}ie(){return{sn:this.ys.autoScale,Ml:this.ys.invertScale,ie:this.ys.mode}}vl(t){let i=this.ie(),e=null;void 0!==t.sn&&(this.ys.autoScale=t.sn),void 0!==t.ie&&(this.ys.mode=t.ie,2!==t.ie&&3!==t.ie||(this.ys.autoScale=!0),this.Xa.Ga=!1),1===i.ie&&t.ie!==i.ie&&(function(t,i){if(null===t)return!1;let e=ig(t.$e(),i),s=ig(t.qe(),i);return isFinite(e)&&isFinite(s)}(this.Ge,this.ll)?null!==(e=ib(this.Ge,this.ll))&&this.bl(e):this.ys.autoScale=!0),1===t.ie&&t.ie!==i.ie&&null!==(e=iv(this.Ge,this.ll))&&this.bl(e);let s=i.ie!==this.ys.mode;s&&(2===i.ie||this.Le())&&this.ga(),s&&(3===i.ie||this.gl())&&this.ga(),void 0!==t.Ml&&i.Ml!==t.Ml&&(this.ys.invertScale=t.Ml,this.xl()),this.sl.p(i,this.ie())}Sl(){return this.sl}P(){return this._l.fontSize}$t(){return this.ja}Cl(t){this.ja!==t&&(this.ja=t,this.ml(),this.rl=null)}yl(){if(this.Za)return this.Za;let t=this.$t()-this.Pl()-this.kl();return this.Za=t,t}Qe(){return this.Tl(),this.Ge}bl(t,i){let e=this.Ge;(i||null===e&&null!==t||null!==e&&!e.He(t))&&(this.rl=null,this.Ge=t)}Zi(){return this.Tl(),0===this.ja||!this.Ge||this.Ge.Zi()}Rl(t){return this.Ml()?t:this.$t()-1-t}Nt(t,i){return this.Le()?t=id(t,i):this.gl()&&(t=ip(t,i)),this.pl(t,i)}Dl(t,i,e){this.Tl();let s=this.kl(),h=B(this.Qe()),r=h.$e(),n=h.qe(),l=this.yl()-1,o=this.Ml(),a=l/(n-r),u=void 0===e?0:e.from,c=void 0===e?t.length:e.to,f=this.Vl();for(let e=u;e<c;e++){let h=t[e],n=h.gt;if(isNaN(n))continue;let l=n;null!==f&&(l=f(h.gt,i));let u=s+a*(l-r);h.ut=o?u:this.ja-1-u}}Il(t,i,e){this.Tl();let s=this.kl(),h=B(this.Qe()),r=h.$e(),n=h.qe(),l=this.yl()-1,o=this.Ml(),a=l/(n-r),u=void 0===e?0:e.from,c=void 0===e?t.length:e.to,f=this.Vl();for(let e=u;e<c;e++){let h=t[e],n=h.qh,l=h.Yh,u=h.jh,c=h.Zh;null!==f&&(n=f(h.qh,i),l=f(h.Yh,i),u=f(h.jh,i),c=f(h.Zh,i));let d=s+a*(n-r),p=o?d:this.ja-1-d;h.Bl=p,d=s+a*(l-r),h.Al=p=o?d:this.ja-1-d,d=s+a*(u-r),h.El=p=o?d:this.ja-1-d,d=s+a*(c-r),h.zl=p=o?d:this.ja-1-d}}Ts(t,i){let e=this.fl(t,i);return this.Ll(e,i)}Ll(t,i){var e,s;let h=t;return this.Le()?(e=h,i<0&&(e=-e),h=e/100*i+i):this.gl()&&(s=h-100,i<0&&(s=-s),h=s/100*i+i),h}ba(){return this.nl}Dt(){if(this.el)return this.el;let t=[];for(let i=0;i<this.nl.length;i++){let e=this.nl[i];null===e.hs()&&e.ls(i+1),t.push(e)}return t=ix(t),this.el=t,this.el}Ol(t){-1===this.nl.indexOf(t)&&(this.nl.push(t),this.ga(),this.Nl())}Wl(t){let i=this.nl.indexOf(t);if(-1===i)throw Error("source is not attached to scale");this.nl.splice(i,1),0===this.nl.length&&(this.vl({sn:!0}),this.bl(null)),this.ga(),this.Nl()}zt(){let t=null;for(let i of this.nl){let e=i.zt();null!==e&&(null===t||e.Hh<t.Hh)&&(t=e)}return null===t?null:t.Ft}Ml(){return this.ys.invertScale}Va(){let t=null===this.zt();if(null!==this.rl&&(t||this.rl.Fl===t))return this.rl.Va;this.dl.Ha();let i=this.dl.Va();return this.rl={Va:i,Fl:t},this.il.p(),i}Hl(){return this.il}Ul(t){this.Le()||this.gl()||null===this.hl&&null===this.Ka&&(this.Zi()||(this.hl=this.ja-t,this.Ka=B(this.Qe()).Ue()))}$l(t){if(this.Le()||this.gl()||null===this.hl)return;this.vl({sn:!1}),(t=this.ja-t)<0&&(t=0);let i=(this.hl+.2*(this.ja-1))/(t+.2*(this.ja-1)),e=B(this.Ka).Ue();i=Math.max(i,.1),e.je(i),this.bl(e)}ql(){this.Le()||this.gl()||(this.hl=null,this.Ka=null)}Yl(t){this.wl()||null===this.al&&null===this.Ka&&(this.Zi()||(this.al=t,this.Ka=B(this.Qe()).Ue()))}jl(t){if(this.wl()||null===this.al)return;let i=B(this.Qe()).Ye()/(this.yl()-1),e=t-this.al;this.Ml()&&(e*=-1);let s=e*i,h=B(this.Ka).Ue();h.Ze(s),this.bl(h,!0),this.rl=null}Zl(){this.wl()||null!==this.al&&(this.al=null,this.Ka=null)}ra(){return this.ha||this.ga(),this.ha}Xi(t,i){switch(this.ys.mode){case 2:return this.Kl(id(t,i));case 3:return this.ra().format(ip(t,i));default:return this.nr(t)}}qa(t){switch(this.ys.mode){case 2:return this.Kl(t);case 3:return this.ra().format(t);default:return this.nr(t)}}Dh(t){return this.nr(t,B(this.Xl()).ra())}Vh(t,i){return t=id(t,i),this.Kl(t,iC)}Gl(){return this.nl}Jl(t){this.Xa={Ja:t,Ga:!1}}Ns(){this.nl.forEach(t=>t.Ns())}ga(){this.rl=null;let t=this.Xl(),i=100;null!==t&&(i=Math.round(1/t.ea())),this.ha=iP,this.Le()?(this.ha=iC,i=100):this.gl()?(this.ha=new tS(100,1),i=100):null!==t&&(this.ha=t.ra()),this.dl=new iS(this,i,this.fl.bind(this),this.pl.bind(this)),this.dl.Ha()}Nl(){this.el=null}Ki(){return this.cl}Xl(){return this.nl[0]||null}Pl(){return this.Ml()?this.ys.scaleMargins.bottom*this.$t()+this.tl:this.ys.scaleMargins.top*this.$t()+this.Qa}kl(){return this.Ml()?this.ys.scaleMargins.top*this.$t()+this.Qa:this.ys.scaleMargins.bottom*this.$t()+this.tl}Tl(){this.Xa.Ga||(this.Xa.Ga=!0,this.Ql())}ml(){this.Za=null}pl(t,i){if(this.Tl(),this.Zi())return 0;t=this.Ya()&&t?im(t,this.ll):t;let e=B(this.Qe()),s=this.kl()+(this.yl()-1)*(t-e.$e())/e.Ye();return this.Rl(s)}fl(t,i){if(this.Tl(),this.Zi())return 0;let e=this.Rl(t),s=B(this.Qe()),h=s.$e()+s.Ye()*((e-this.kl())/(this.yl()-1));return this.Ya()?ig(h,this.ll):h}xl(){this.rl=null,this.dl.Ha()}Ql(){var t,i,e,s,h;let r=this.Xa.Ja;if(null===r)return;let n=null,l=this.Gl(),o=0,a=0;for(let t of l){if(!t.Vt())continue;let l=t.zt();if(null===l)continue;let u=t.Mh(r.Uh(),r.bi()),c=u&&u.Qe();if(null!==c){switch(this.ys.mode){case 1:c=iv(c,this.ll);break;case 2:i=c,e=l.Ft,c=new tW(id(i.$e(),e),id(i.qe(),e));break;case 3:s=c,h=l.Ft,c=new tW(ip(s.$e(),h),ip(s.qe(),h))}if(n=null===n?c:n.vn(B(c)),null!==u){let t=u.tr();null!==t&&(o=Math.max(o,t.above),a=Math.max(a,t.below))}}}if(o===this.Qa&&a===this.tl||(this.Qa=o,this.tl=a,this.rl=null,this.ml()),null!==n){if(n.$e()===n.qe()){let t=this.Xl(),i=5*(null===t||this.Le()||this.gl()?1:t.ea());this.Ya()&&(n=ib(n,this.ll)),n=new tW(n.$e()-i,n.qe()+i),this.Ya()&&(n=iv(n,this.ll))}if(this.Ya()){let i=ib(n,this.ll),e=iy(i);if(t=this.ll,e.Ia!==t.Ia||e.Ba!==t.Ba){let t=null!==this.Ka?ib(this.Ka,this.ll):null;this.ll=e,n=iv(i,e),null!==t&&(this.Ka=iv(t,e))}}this.bl(n)}else null===this.Ge&&(this.bl(new tW(-.5,.5)),this.ll=iy(null));this.Xa.Ga=!0}Vl(){return this.Le()?id:this.gl()?ip:this.Ya()?t=>im(t,this.ll):null}io(t,i,e){return void 0===i?(void 0===e&&(e=this.ra()),e.format(t)):i(t)}nr(t,i){return this.io(t,this.ul.priceFormatter,i)}Kl(t,i){return this.io(t,this.ul.percentageFormatter,i)}}function iO(t){return t instanceof is}class ik{constructor(t,i){this.nl=[],this.so=new Map,this.ja=0,this.no=0,this.eo=1e3,this.el=null,this.ro=new W,this.Ph=[],this.uh=t,this.ts=i,this.ho=new iu(this);let e=i.N();this.ao=this.lo("left",e.leftPriceScale),this.oo=this.lo("right",e.rightPriceScale),this.ao.Sl().i(this._o.bind(this,this.ao),this),this.oo.Sl().i(this._o.bind(this,this.oo),this),this.uo(e)}uo(t){if(t.leftPriceScale&&this.ao.hr(t.leftPriceScale),t.rightPriceScale&&this.oo.hr(t.rightPriceScale),t.localization&&(this.ao.ga(),this.oo.ga()),t.overlayPriceScales)for(let i of Array.from(this.so.values())){let e=B(i[0].Wt());e.hr(t.overlayPriceScales),t.localization&&e.ga()}}co(t){switch(t){case"left":return this.ao;case"right":return this.oo}return this.so.has(t)?N(this.so.get(t))[0].Wt():null}m(){this.Qt().do().u(this),this.ao.Sl().u(this),this.oo.Sl().u(this),this.nl.forEach(t=>{t.m&&t.m()}),this.Ph=this.Ph.filter(t=>{let i=t.oh();return i.detached&&i.detached(),!1}),this.ro.p()}fo(){return this.eo}po(t){this.eo=t}Qt(){return this.ts}Qi(){return this.no}$t(){return this.ja}vo(t){this.no=t,this.mo()}Cl(t){this.ja=t,this.ao.Cl(t),this.oo.Cl(t),this.nl.forEach(i=>{if(this.Un(i)){let e=i.Wt();null!==e&&e.Cl(t)}}),this.mo()}wo(){return this.nl.filter(iO)}ba(){return this.nl}Un(t){let i=t.Wt();return null===i||this.ao!==i&&this.oo!==i}Ol(t,i,e){let s=void 0!==e?e:this.bo().Mo+1;this.xo(t,i,s)}Wl(t){let i=this.nl.indexOf(t);V(-1!==i,"removeDataSource: invalid data source"),this.nl.splice(i,1);let e=B(t.Wt()).wa();if(this.so.has(e)){let i=N(this.so.get(e)),s=i.indexOf(t);-1!==s&&(i.splice(s,1),0===i.length&&this.so.delete(e))}let s=t.Wt();s&&s.ba().indexOf(t)>=0&&s.Wl(t),null!==s&&(s.Nl(),this.So(s)),this.el=null}qn(t){return t===this.ao?"left":t===this.oo?"right":"overlay"}Co(){return this.ao}yo(){return this.oo}Po(t,i){t.Ul(i)}ko(t,i){t.$l(i),this.mo()}To(t){t.ql()}Ro(t,i){t.Yl(i)}Do(t,i){t.jl(i),this.mo()}Vo(t){t.Zl()}mo(){this.nl.forEach(t=>{t.Ns()})}ks(){let t=null;return this.ts.N().rightPriceScale.visible&&0!==this.oo.ba().length?t=this.oo:this.ts.N().leftPriceScale.visible&&0!==this.ao.ba().length?t=this.ao:0!==this.nl.length&&(t=this.nl[0].Wt()),null===t&&(t=this.oo),t}$n(){let t=null;return this.ts.N().rightPriceScale.visible?t=this.oo:this.ts.N().leftPriceScale.visible&&(t=this.ao),t}So(t){null!==t&&t.wl()&&this.Io(t)}Bo(t){let i=this.uh.ye();t.vl({sn:!0}),null!==i&&t.Jl(i),this.mo()}Ao(){this.Io(this.ao),this.Io(this.oo)}Eo(){this.So(this.ao),this.So(this.oo),this.nl.forEach(t=>{this.Un(t)&&this.So(t.Wt())}),this.mo(),this.ts.ar()}Dt(){return null===this.el&&(this.el=ix(this.nl)),this.el}It(){return this.Dt().filter(iO)}zo(){return this.ro}Lo(){return this.ho}ua(t){this.Ph.push(new t1(t))}ca(t){this.Ph=this.Ph.filter(i=>i.oh()!==t),t.detached&&t.detached(),this.ts.ar()}Oo(){return this.Ph}sa(t,i){return this.Ph.map(e=>e.jn(t,i)).filter(t=>null!==t)}Io(t){let i=t.Gl();if(i&&i.length>0&&!this.uh.Zi()){let i=this.uh.ye();null!==i&&t.Jl(i)}t.Ns()}bo(){let t=this.Dt();if(0===t.length)return{No:0,Mo:0};let i=0,e=0;for(let s=0;s<t.length;s++){let h=t[s].hs();null!==h&&(h<i&&(i=h),h>e&&(e=h))}return{No:i,Mo:e}}xo(t,i,e){let s=this.co(i);if(null===s&&(s=this.lo(i,this.ts.N().overlayPriceScales)),this.nl.push(t),!tw(i)){let e=this.so.get(i)||[];e.push(t),this.so.set(i,e)}s.Ol(t),t._s(s),t.ls(e),this.So(s),this.el=null}_o(t,i,e){i.ie!==e.ie&&this.Io(t)}lo(t,i){let e=new iR(t,{visible:!0,autoScale:!0,...J(i)},this.ts.N().layout,this.ts.N().localization,this.ts.Ki());return e.Cl(this.$t()),e}}function iz(t){return{Wo:t.Wo,Fo:{Zn:t.Ho.externalId},Uo:t.Ho.cursorStyle}}function iY(t,i,e){let s=[t,...t.Dt()],h=function(t,i,e){var s,h;let r,n;for(let l of t)for(let t of l.sa?.(i,e)??[])s=t.zOrder,(h=r?.zOrder)&&("top"!==s||"top"===h)&&("normal"!==s||"bottom"!==h)||(r=t,n=l);return r&&n?{Ho:r,Wo:n}:null}(s,i,e);if("top"===h?.Ho.zOrder)return iz(h);for(let r of s){if(h&&h.Wo===r&&"bottom"!==h.Ho.zOrder&&!h.Ho.isBackground)return iz(h);if(void 0!==r.Ws){let s=function(t,i,e,s){for(let h of t){let t=h.Tt(s);if(null!==t&&t.jn){let s=t.jn(i,e);if(null!==s)return{$o:h,Fo:s}}}return null}(r.Ws(t),i,e,t);if(null!==s)return{Wo:r,$o:s.$o,Fo:s.Fo}}if(h&&h.Wo===r&&"bottom"!==h.Ho.zOrder&&h.Ho.isBackground)return iz(h)}return h?.Ho?iz(h):null}class iE{constructor(t,i,e=50){this.Pn=0,this.kn=1,this.Tn=1,this.Dn=new Map,this.Rn=new Map,this.qo=t,this.Yo=i,this.Vn=e}jo(t){let i=t.time,e=this.Yo.cacheKey(i),s=this.Dn.get(e);if(void 0!==s)return s.Zo;if(this.Pn===this.Vn){let t=this.Rn.get(this.Tn);this.Rn.delete(this.Tn),this.Dn.delete(N(t)),this.Tn++,this.Pn--}let h=this.qo(t);return this.Dn.set(e,{Zo:h,En:this.kn}),this.Rn.set(this.kn,e),this.Pn++,this.kn++,h}}class iT{constructor(t,i){V(t<=i,"right should be >= left"),this.Ko=t,this.Xo=i}Uh(){return this.Ko}bi(){return this.Xo}Go(){return this.Xo-this.Ko+1}Te(t){return this.Ko<=t&&t<=this.Xo}He(t){return this.Ko===t.Uh()&&this.Xo===t.bi()}}function iL(t,i){return null===t||null===i?t===i:t.He(i)}class iV{constructor(){this.Jo=new Map,this.Dn=null,this.Qo=!1}t_(t){this.Qo=t,this.Dn=null}i_(t,i){this.s_(i),this.Dn=null;for(let e=i;e<t.length;++e){let i=t[e],s=this.Jo.get(i.timeWeight);void 0===s&&(s=[],this.Jo.set(i.timeWeight,s)),s.push({index:e,time:i.time,weight:i.timeWeight,originalTime:i.originalTime})}}n_(t,i,e,s,h){let r=Math.ceil(i/t);return null!==this.Dn&&this.Dn.e_===r&&h===this.Dn.r_&&e===this.Dn.h_||(this.Dn={r_:h,h_:e,Va:this.a_(r,e,s),e_:r}),this.Dn.Va}s_(t){if(0===t)return void this.Jo.clear();let i=[];for(let e of(this.Jo.forEach((e,s)=>{t<=e[0].index?i.push(s):e.splice(tZ(e,t,i=>i.index<t),1/0)}),i))this.Jo.delete(e)}a_(t,i,e){let s=[],h=t=>!i||e.has(t.index);for(let i of Array.from(this.Jo.keys()).sort((t,i)=>i-t)){if(!this.Jo.get(i))continue;let e=s;s=[];let r=e.length,n=0,l=N(this.Jo.get(i)),o=l.length,a=1/0,u=-1/0;for(let i=0;i<o;i++){let o=l[i],c=o.index;for(;n<r;){let t=e[n],i=t.index;if(!(i<c&&h(t))){a=i;break}n++,s.push(t),u=i,a=1/0}if(a-c>=t&&c-u>=t&&h(o))s.push(o),u=c;else if(this.Qo)return e}for(;n<r;n++)h(e[n])&&s.push(e[n])}return s}}class iN{constructor(t){this.l_=t}o_(){return null===this.l_?null:new iT(Math.floor(this.l_.Uh()),Math.ceil(this.l_.bi()))}__(){return this.l_}static u_(){return new iN(null)}}function iB(t,i){return t.weight>i.weight?t:i}class iD{constructor(t,i,e,s){this.no=0,this.c_=null,this.d_=[],this.al=null,this.hl=null,this.f_=new iV,this.p_=new Map,this.v_=iN.u_(),this.m_=!0,this.w_=new W,this.g_=new W,this.M_=new W,this.b_=null,this.x_=null,this.S_=new Map,this.C_=-1,this.y_=[],this.ys=i,this.ul=e,this.P_=i.rightOffset,this.k_=i.barSpacing,this.ts=t,this.Yo=s,this.T_(),this.f_.t_(i.uniformDistribution),this.R_()}N(){return this.ys}D_(t){j(this.ul,t),this.V_(),this.T_()}hr(t,i){j(this.ys,t),this.ys.fixLeftEdge&&this.I_(),this.ys.fixRightEdge&&this.B_(),void 0!==t.barSpacing&&this.ts.dn(t.barSpacing),void 0!==t.rightOffset&&this.ts.fn(t.rightOffset),void 0===t.minBarSpacing&&void 0===t.maxBarSpacing||this.ts.dn(t.barSpacing??this.k_),void 0!==t.ignoreWhitespaceIndices&&t.ignoreWhitespaceIndices!==this.ys.ignoreWhitespaceIndices&&this.R_(),this.V_(),this.T_(),this.M_.p()}Rs(t){return this.d_[t]?.time??null}ss(t){return this.d_[t]??null}A_(t,i){if(this.d_.length<1)return null;if(this.Yo.key(t)>this.Yo.key(this.d_[this.d_.length-1].time))return i?this.d_.length-1:null;let e=tZ(this.d_,this.Yo.key(t),(t,i)=>this.Yo.key(t.time)<i);return this.Yo.key(t)<this.Yo.key(this.d_[e].time)?i?e:null:e}Zi(){return 0===this.no||0===this.d_.length||null===this.c_}E_(){return this.d_.length>0}ye(){return this.z_(),this.v_.o_()}L_(){return this.z_(),this.v_.__()}O_(){let t=this.ye();if(null===t)return null;let i={from:t.Uh(),to:t.bi()};return this.N_(i)}N_(t){let i=Math.round(t.from),e=Math.round(t.to),s=B(this.W_()),h=B(this.F_());return{from:B(this.ss(Math.max(s,i))),to:B(this.ss(Math.min(h,e)))}}H_(t){return{from:B(this.A_(t.from,!0)),to:B(this.A_(t.to,!0))}}Qi(){return this.no}vo(t){if(!isFinite(t)||t<=0||this.no===t)return;let i=this.L_(),e=this.no;if(this.no=t,this.m_=!0,this.ys.lockVisibleTimeRangeOnResize&&0!==e){let i=this.k_*t/e;this.k_=i}this.ys.fixLeftEdge&&null!==i&&0>=i.Uh()&&(this.P_-=Math.round((e-t)/this.k_)+1,this.m_=!0),this.U_(),this.q_()}qt(t){if(this.Zi()||!A(t))return 0;let i=this.Y_()+this.P_-t;return this.no-(i+.5)*this.k_-1}j_(t,i){let e=this.Y_(),s=void 0===i?0:i.from,h=void 0===i?t.length:i.to;for(let i=s;i<h;i++){let s=t[i].wt,h=e+this.P_-s,r=this.no-(h+.5)*this.k_-1;t[i]._t=r}}Z_(t,i){let e=Math.ceil(this.K_(t));return i&&this.ys.ignoreWhitespaceIndices&&!this.X_(e)?this.G_(e):e}fn(t){this.m_=!0,this.P_=t,this.q_(),this.ts.J_(),this.ts.ar()}Q_(){return this.k_}dn(t){this.tu(t),this.q_(),this.ts.J_(),this.ts.ar()}iu(){return this.P_}Va(){if(this.Zi())return null;if(null!==this.x_)return this.x_;let t=this.k_,i=5*(this.ts.N().layout.fontSize+4)/8*(this.ys.tickMarkMaxCharacterLength||8),e=Math.round(i/t),s=B(this.ye()),h=Math.max(s.Uh(),s.Uh()-e),r=Math.max(s.bi(),s.bi()-e),n=this.f_.n_(t,i,this.ys.ignoreWhitespaceIndices,this.S_,this.C_),l=this.W_()+e,o=this.F_()-e,a=this.su(),u=this.ys.fixLeftEdge||a,c=this.ys.fixRightEdge||a,f=0;for(let t of n){let e;h<=t.index&&t.index<=r&&(f<this.y_.length?((e=this.y_[f]).coord=this.qt(t.index),e.label=this.nu(t),e.weight=t.weight):(e={needAlignCoordinate:!1,coord:this.qt(t.index),label:this.nu(t),weight:t.weight},this.y_.push(e)),this.k_>i/2&&!a?e.needAlignCoordinate=!1:e.needAlignCoordinate=u&&t.index<=l||c&&t.index>=o,f++)}return this.y_.length=f,this.x_=this.y_,this.y_}eu(){this.m_=!0,this.dn(this.ys.barSpacing),this.fn(this.ys.rightOffset)}ru(t){this.m_=!0,this.c_=t,this.q_(),this.I_()}hu(t,i){let e=this.K_(t),s=this.Q_();this.dn(s+s/10*i),this.ys.rightBarStaysOnScroll||this.fn(this.iu()+(e-this.K_(t)))}Ul(t){this.al&&this.Zl(),null===this.hl&&null===this.b_&&(this.Zi()||(this.hl=t,this.au()))}$l(t){if(null===this.b_)return;let i=iw(this.no-t,0,this.no),e=iw(this.no-B(this.hl),0,this.no);0!==i&&0!==e&&this.dn(this.b_.Q_*i/e)}ql(){null!==this.hl&&(this.hl=null,this.lu())}Yl(t){null===this.al&&null===this.b_&&(this.Zi()||(this.al=t,this.au()))}jl(t){if(null===this.al)return;let i=(this.al-t)/this.Q_();this.P_=B(this.b_).iu+i,this.m_=!0,this.q_()}Zl(){null!==this.al&&(this.al=null,this.lu())}ou(){this._u(this.ys.rightOffset)}_u(t,i=400){if(!isFinite(t))throw RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw RangeError("animationDuration (optional) must be finite positive number");let e=this.P_,s=performance.now();this.ts._n({uu:t=>(t-s)/i>=1,cu:h=>{let r=(h-s)/i;return r>=1?t:e+(t-e)*r}})}Pt(t,i){this.m_=!0,this.d_=t,this.f_.i_(t,i),this.q_()}du(){return this.w_}fu(){return this.g_}pu(){return this.M_}Y_(){return this.c_||0}vu(t){let i=t.Go();this.tu(this.no/i),this.P_=t.bi()-this.Y_(),this.q_(),this.m_=!0,this.ts.J_(),this.ts.ar()}mu(){let t=this.W_(),i=this.F_();null!==t&&null!==i&&this.vu(new iT(t,i+this.ys.rightOffset))}wu(t){let i=new iT(t.from,t.to);this.vu(i)}ns(t){return void 0!==this.ul.timeFormatter?this.ul.timeFormatter(t.originalTime):this.Yo.formatHorzItem(t.time)}R_(){if(this.ys.ignoreWhitespaceIndices){for(let t of(this.S_.clear(),this.ts.js()))for(let i of t.ma())this.S_.set(i,!0);this.C_++}}su(){let t=this.ts.N().handleScroll,i=this.ts.N().handleScale;return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||i.axisDoubleClickReset.time||i.axisPressedMouseMove.time||i.mouseWheel||i.pinch)}W_(){return 0===this.d_.length?null:0}F_(){return 0===this.d_.length?null:this.d_.length-1}gu(t){return(this.no-1-t)/this.k_}K_(t){let i=this.gu(t);return Math.round(1e6*(this.Y_()+this.P_-i))/1e6}tu(t){let i=this.k_;this.k_=t,this.U_(),i!==this.k_&&(this.m_=!0,this.Mu())}z_(){if(!this.m_)return;if(this.m_=!1,this.Zi())return void this.bu(iN.u_());let t=this.Y_(),i=this.no/this.k_,e=this.P_+t,s=new iT(e-i+1,e);this.bu(new iN(s))}U_(){let t=iw(this.k_,this.xu(),this.Su());this.k_!==t&&(this.k_=t,this.m_=!0)}Su(){return this.ys.maxBarSpacing>0?this.ys.maxBarSpacing:.5*this.no}xu(){return this.ys.fixLeftEdge&&this.ys.fixRightEdge&&0!==this.d_.length?this.no/this.d_.length:this.ys.minBarSpacing}q_(){let t=this.Cu();null!==t&&this.P_<t&&(this.P_=t,this.m_=!0);let i=this.yu();this.P_>i&&(this.P_=i,this.m_=!0)}Cu(){let t=this.W_(),i=this.c_;return null===t||null===i?null:t-i-1+(this.ys.fixLeftEdge?this.no/this.k_:Math.min(2,this.d_.length))}yu(){return this.ys.fixRightEdge?0:this.no/this.k_-Math.min(2,this.d_.length)}au(){this.b_={Q_:this.Q_(),iu:this.iu()}}lu(){this.b_=null}nu(t){let i=this.p_.get(t.weight);return void 0===i&&(i=new iE(t=>this.Pu(t),this.Yo),this.p_.set(t.weight,i)),i.jo(t)}Pu(t){return this.Yo.formatTickmark(t,this.ul)}bu(t){let i=this.v_;this.v_=t,iL(i.o_(),this.v_.o_())||this.w_.p(),iL(i.__(),this.v_.__())||this.g_.p(),this.Mu()}Mu(){this.x_=null}V_(){this.Mu(),this.p_.clear()}T_(){this.Yo.updateFormatter(this.ul)}I_(){if(!this.ys.fixLeftEdge)return;let t=this.W_();if(null===t)return;let i=this.ye();if(null===i)return;let e=i.Uh()-t;if(e<0){let t=this.P_-e-1;this.fn(t)}this.U_()}B_(){this.q_(),this.U_()}X_(t){return!this.ys.ignoreWhitespaceIndices||this.S_.get(t)||!1}G_(t){let i=function*(t){let i=Math.round(t),e=i<t,s=1;for(;;)e?(yield i+s,yield i-s):(yield i-s,yield i+s),s++}(t),e=this.F_();for(;e;){let t=i.next().value;if(this.S_.get(t))return t;if(t<0||t>e)break}return t}}(l=v||(v={}))[l.OnTouchEnd=0]="OnTouchEnd",l[l.OnNextTap=1]="OnNextTap";class iW{constructor(t,i,e){this.ku=[],this.Tu=[],this.no=0,this.Ru=null,this.Du=new W,this.Vu=new W,this.Iu=null,this.Bu=t,this.ys=i,this.Yo=e,this.cl=new q(this.ys.layout.colorParsers),this.Au=new G(this),this.uh=new iD(this,i.timeScale,this.ys.localization,e),this.Ct=new ty(this,i.crosshair),this.Eu=new il(i.crosshair),this.zu(0),this.ku[0].po(2e3),this.Lu=this.Ou(0),this.Nu=this.Ou(1)}Bh(){this.Wu(tM.gn())}ar(){this.Wu(tM.wn())}Xh(){this.Wu(new tM(1))}Ah(t){let i=this.Fu(t);this.Wu(i)}Hu(){return this.Ru}Uu(t){if(this.Ru?.Wo===t?.Wo&&this.Ru?.Fo?.Zn===t?.Fo?.Zn)return;let i=this.Ru;this.Ru=t,null!==i&&this.Ah(i.Wo),null!==t&&t.Wo!==i?.Wo&&this.Ah(t.Wo)}N(){return this.ys}hr(t){j(this.ys,t),this.ku.forEach(i=>i.uo(t)),void 0!==t.timeScale&&this.uh.hr(t.timeScale),void 0!==t.localization&&this.uh.D_(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Du.p(),this.Lu=this.Ou(0),this.Nu=this.Ou(1),this.Bh()}$u(t,i,e=0){let s=this.ku[e];if(void 0===s)return;if("left"===t)return j(this.ys,{leftPriceScale:i}),s.uo({leftPriceScale:i}),this.Du.p(),void this.Bh();if("right"===t)return j(this.ys,{rightPriceScale:i}),s.uo({rightPriceScale:i}),this.Du.p(),void this.Bh();let h=this.qu(t,e);null!==h&&(h.Wt.hr(i),this.Du.p())}qu(t,i){let e=this.ku[i];if(void 0===e)return null;let s=e.co(t);return null!==s?{Us:e,Wt:s}:null}At(){return this.uh}$s(){return this.ku}Yu(){return this.Ct}ju(){return this.Vu}Zu(t,i){t.Cl(i),this.J_()}vo(t){this.no=t,this.uh.vo(this.no),this.ku.forEach(i=>i.vo(t)),this.J_()}Ku(t){1!==this.ku.length&&(V(t>=0&&t<this.ku.length,"Invalid pane index"),this.ku.splice(t,1),this.Bh())}Xu(t,i){if(this.ku.length<2)return;V(t>=0&&t<this.ku.length,"Invalid pane index");let e=this.ku[t],s=this.ku.reduce((t,i)=>t+i.fo(),0),h=this.ku.reduce((t,i)=>t+i.$t(),0),r=h-30*(this.ku.length-1);i=Math.min(r,Math.max(30,i));let n=s/h,l=e.$t();e.po(i*n);let o=i-l,a=this.ku.length-1;for(let t of this.ku)if(t!==e){let i=Math.min(r,Math.max(30,t.$t()-o/a));o-=t.$t()-i,a-=1;let e=i*n;t.po(e)}this.Bh()}Gu(t,i){V(t>=0&&t<this.ku.length&&i>=0&&i<this.ku.length,"Invalid pane index");let e=this.ku[t],s=this.ku[i];this.ku[t]=s,this.ku[i]=e,this.Bh()}Po(t,i,e){t.Po(i,e)}ko(t,i,e){t.ko(i,e),this.Eh(),this.Wu(this.Ju(t,2))}To(t,i){t.To(i),this.Wu(this.Ju(t,2))}Ro(t,i,e){i.wl()||t.Ro(i,e)}Do(t,i,e){i.wl()||(t.Do(i,e),this.Eh(),this.Wu(this.Ju(t,2)))}Vo(t,i){i.wl()||(t.Vo(i),this.Wu(this.Ju(t,2)))}Bo(t,i){t.Bo(i),this.Wu(this.Ju(t,2))}Qu(t){this.uh.Ul(t)}tc(t,i){let e=this.At();if(e.Zi()||0===i)return;let s=e.Qi();t=Math.max(1,Math.min(t,s)),e.hu(t,i),this.J_()}sc(t){this.nc(0),this.ec(t),this.rc()}hc(t){this.uh.$l(t),this.J_()}ac(){this.uh.ql(),this.ar()}nc(t){this.uh.Yl(t)}ec(t){this.uh.jl(t),this.J_()}rc(){this.uh.Zl(),this.ar()}js(){return this.Tu}lc(t,i,e,s,h){this.Ct.Vs(t,i);let r=NaN,n=this.uh.Z_(t,!0),l=this.uh.ye();null!==l&&(n=Math.min(Math.max(l.Uh(),n),l.bi()));let o=s.ks(),a=o.zt();if(null!==a&&(r=o.Ts(i,a)),r=this.Eu.Ma(r,n,s),this.Ct.Es(n,r,s),this.Xh(),!h){let h=iY(s,t,i);this.Uu(h&&{Wo:h.Wo,Fo:h.Fo,Uo:h.Uo||null}),this.Vu.p(this.Ct.Bt(),{x:t,y:i},e)}}oc(t,i,e){let s=e.ks(),h=s.zt(),r=s.Nt(t,B(h)),n=this.uh.A_(i,!0),l=this.uh.qt(B(n));this.lc(l,r,null,e,!0)}_c(t){this.Yu().Ls(),this.Xh(),t||this.Vu.p(null,null,null)}Eh(){let t=this.Ct.Us();if(null!==t){let i=this.Ct.Bs(),e=this.Ct.As();this.lc(i,e,null,t)}this.Ct.Ns()}uc(t,i,e){let s=this.uh.Rs(0);void 0!==i&&void 0!==e&&this.uh.Pt(i,e);let h=this.uh.Rs(0),r=this.uh.Y_(),n=this.uh.ye();if(null!==n&&null!==s&&null!==h){let i=n.Te(r),l=this.Yo.key(s)>this.Yo.key(h),o=null!==t&&t>r&&!l,a=this.uh.N().allowShiftVisibleRangeOnWhitespaceReplacement,u=i&&(void 0!==e||a)&&this.uh.N().shiftVisibleRangeOnNewBar;if(o&&!u){let i=t-r;this.uh.fn(this.uh.iu()-i)}}this.uh.ru(t)}Lh(t){null!==t&&t.Eo()}Hn(t){if(t instanceof ik)return t;let i=this.ku.find(i=>i.Dt().includes(t));return void 0===i?null:i}J_(){this.ku.forEach(t=>t.Eo()),this.Eh()}m(){this.ku.forEach(t=>t.m()),this.ku.length=0,this.ys.localization.priceFormatter=void 0,this.ys.localization.percentageFormatter=void 0,this.ys.localization.timeFormatter=void 0}cc(){return this.Au}Yn(){return this.Au.N()}do(){return this.Du}dc(t,i){let e=this.zu(i);this.fc(t,e),this.Tu.push(t),1===this.Tu.length?this.Bh():this.ar()}vc(t){let i=this.Hn(t),e=this.Tu.indexOf(t);V(-1!==e,"Series not found");let s=B(i);this.Tu.splice(e,1),s.Wl(t),t.m&&t.m(),this.uh.R_(),this.mc(s)}Ih(t,i){let e=B(this.Hn(t));e.Wl(t),e.Ol(t,i,B(t.hs()))}mu(){let t=tM.wn();t.rn(),this.Wu(t)}wc(t){let i=tM.wn();i.ln(t),this.Wu(i)}cn(){let t=tM.wn();t.cn(),this.Wu(t)}dn(t){let i=tM.wn();i.dn(t),this.Wu(i)}fn(t){let i=tM.wn();i.fn(t),this.Wu(i)}_n(t){let i=tM.wn();i._n(t),this.Wu(i)}hn(){let t=tM.wn();t.hn(),this.Wu(t)}gc(){return this.ys.rightPriceScale.visible?"right":"left"}Mc(t,i){if(V(i>=0,"Index should be greater or equal to 0"),i===this.bc(t))return;let e=B(this.Hn(t));e.Wl(t);let s=this.zu(i);this.fc(t,s),0===e.ba().length&&this.mc(e)}xc(){return this.Nu}$(){return this.Lu}Ut(t){let i=this.Nu,e=this.Lu;if(i===e)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Iu||this.Iu.mr!==e||this.Iu.wr!==i)this.Iu={mr:e,wr:i,Sc:new Map};else{let i=this.Iu.Sc.get(t);if(void 0!==i)return i}let s=this.cl.tt(e,i,t/100);return this.Iu.Sc.set(t,s),s}Cc(t){return this.ku.indexOf(t)}Ki(){return this.cl}zu(t){if(V(t>=0,"Index should be greater or equal to 0"),(t=Math.min(this.ku.length,t))<this.ku.length)return this.ku[t];let i=new ik(this.uh,this);this.ku.push(i);let e=tM.gn();return e.Qs(t,{tn:0,sn:!0}),this.Wu(e),i}bc(t){return this.ku.findIndex(i=>i.wo().includes(t))}Ju(t,i){let e=new tM(i);if(null!==t){let s=this.ku.indexOf(t);e.Qs(s,{tn:i})}return e}Fu(t,i){return void 0===i&&(i=2),this.Ju(this.Hn(t),i)}Wu(t){this.Bu&&this.Bu(t),this.ku.forEach(t=>t.Lo().lr().Pt())}fc(t,i){let e=t.N().priceScaleId,s=void 0!==e?e:this.gc();i.Ol(t,s),tw(s)||t.hr(t.N())}Ou(t){let i=this.ys.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}mc(t){0===t.ba().length&&this.ku.length>1&&(this.ku.splice(this.Cc(t),1),this.Bh())}}function ij(t){return!F(t)&&!I(t)}(o=b||(b={}))[o.Disabled=0]="Disabled",o[o.Continuous=1]="Continuous",o[o.OnDataUpdate=2]="OnDataUpdate",(a=y||(y={}))[a.LastBar=0]="LastBar",a[a.LastVisible=1]="LastVisible",(u=w||(w={})).Solid="solid",u.VerticalGradient="gradient",(c=M||(M={}))[c.Year=0]="Year",c[c.Month=1]="Month",c[c.DayOfMonth=2]="DayOfMonth",c[c.Time=3]="Time",c[c.TimeWithSeconds=4]="TimeWithSeconds";let iF=t=>t.getUTCFullYear();class iA{constructor(t="yyyy-MM-dd",i="default"){this.yc=t,this.Pc=i}jo(t){return function(t,i,e){return i.replace(/yyyy/g,t_(iF(t),4)).replace(/yy/g,t_(iF(t)%100,2)).replace(/MMMM/g,new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"long"})).replace(/MMM/g,new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"short"})).replace(/MM/g,t_(t.getUTCMonth()+1,2)).replace(/dd/g,t_(t.getUTCDate(),2))}(t,this.yc,this.Pc)}}class iI{constructor(t){this.kc=t||"%h:%m:%s"}jo(t){return this.kc.replace("%h",t_(t.getUTCHours(),2)).replace("%m",t_(t.getUTCMinutes(),2)).replace("%s",t_(t.getUTCSeconds(),2))}}let iQ={Tc:"yyyy-MM-dd",Rc:"%h:%m:%s",Dc:" ",Vc:"default"};class iJ{constructor(t={}){let i={...iQ,...t};this.Ic=new iA(i.Tc,i.Vc),this.Bc=new iI(i.Rc),this.Ac=i.Dc}jo(t){return`${this.Ic.jo(t)}${this.Ac}${this.Bc.jo(t)}`}}function i$(t){return 60*t*6e4}function iU(t){return 60*t*1e3}let iZ=[{Ec:1e3,zc:10},{Ec:iU(1),zc:20},{Ec:iU(5),zc:21},{Ec:iU(30),zc:22},{Ec:i$(1),zc:30},{Ec:i$(3),zc:31},{Ec:i$(6),zc:32},{Ec:i$(12),zc:33}];function iH(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let e=iZ.length-1;e>=0;--e)if(Math.floor(i.getTime()/iZ[e].Ec)!==Math.floor(t.getTime()/iZ[e].Ec))return iZ[e].zc;return 0}function iG(t){let i=t;if(I(t)&&(i=iX(t)),!ij(i))throw Error("time must be of type BusinessDay");return{Lc:Math.round(new Date(Date.UTC(i.year,i.month-1,i.day,0,0,0,0)).getTime()/1e3),Oc:i}}function iK(t){if(!F(t))throw Error("time must be of type isUTCTimestamp");return{Lc:t}}function iX(t){let i=new Date(t);if(isNaN(i.getTime()))throw Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function iq(t){I(t.time)&&(t.time=iX(t.time))}class i0{options(){return this.ys}setOptions(t){this.ys=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?function(t){t.forEach(iq)}(t):iq(t)}createConverterToInternalObj(t){return B(0===t.length?null:ij(t[0].time)||I(t[0].time)?iG:iK)}key(t){return"object"==typeof t&&"Lc"in t?t.Lc:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){return void 0===t.Oc?new Date(1e3*t.Lc).getTime():new Date(Date.UTC(t.Oc.year,t.Oc.month-1,t.Oc.day)).getTime()}convertHorzItemToInternal(t){return F(t)?iK(t):ij(t)?iG(t):iG(iX(t))}updateFormatter(t){if(!this.ys)return;let i=t.dateFormat;this.ys.timeScale.timeVisible?this.Nc=new iJ({Tc:i,Rc:this.ys.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",Dc:" ",Vc:t.locale}):this.Nc=new iA(i,t.locale)}formatHorzItem(t){return this.Nc.jo(new Date(1e3*t.Lc))}formatTickmark(t,i){let e=function(t,i,e){switch(t){case 0:case 10:return i?e?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.ys.timeScale.timeVisible,this.ys.timeScale.secondsVisible),s=this.ys.timeScale;if(void 0!==s.tickMarkFormatter){let h=s.tickMarkFormatter(t.originalTime,e,i.locale);if(null!==h)return h}return function(t,i,e){let s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=!1,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=!1,s.hour="2-digit",s.minute="2-digit",s.second="2-digit"}let h=new Date(void 0===t.Oc?1e3*t.Lc:Date.UTC(t.Oc.year,t.Oc.month-1,t.Oc.day));return new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()).toLocaleString(e,s)}(t.time,e,i.locale)}maxTickMarkWeight(t){let i=t.reduce(iB,t[0]).weight;return i>30&&i<50&&(i=30),i}fillWeightsForPoints(t,i){!function(t,i=0){if(0===t.length)return;let e=0===i?null:t[i-1].time.Lc,s=null!==e?new Date(1e3*e):null,h=0;for(let r=i;r<t.length;++r){let i=t[r],n=new Date(1e3*i.time.Lc);null!==s&&(i.timeWeight=iH(n,s)),h+=i.time.Lc-(e||i.time.Lc),e=i.time.Lc,s=n}if(0===i&&t.length>1){let i=Math.ceil(h/(t.length-1)),e=new Date(1e3*(t[0].time.Lc-i));t[0].timeWeight=iH(new Date(1e3*t[0].time.Lc),e)}}(t,i)}static Wc(t){return j({localization:{dateFormat:"dd MMM 'yy"}},t??{})}}let i1="undefined"!=typeof window;function i2(){return!!i1&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function i3(){return!!i1&&/iPhone|iPad|iPod/.test(window.navigator.platform)}class i5{constructor(t,i,e){this.Fc=0,this.Hc=null,this.Uc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.$c=0,this.qc=null,this.Yc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.jc=null,this.Zc=!1,this.Kc=null,this.Xc=null,this.Gc=!1,this.Jc=!1,this.Qc=!1,this.td=null,this.sd=null,this.nd=null,this.ed=null,this.rd=null,this.hd=null,this.ad=null,this.ld=0,this.od=!1,this._d=!1,this.ud=!1,this.dd=0,this.fd=null,this.pd=!i3(),this.vd=t=>{this.md(t)},this.wd=t=>{if(this.gd(t)){let i=this.Md(t);if(++this.$c,this.qc&&this.$c>1){let{bd:e}=this.xd(i9(t),this.Yc);e<30&&!this.Qc&&this.Sd(i,this.yd.Cd),this.Pd()}}else{let i=this.Md(t);if(++this.Fc,this.Hc&&this.Fc>1){let{bd:e}=this.xd(i9(t),this.Uc);e<5&&!this.Jc&&this.kd(i,this.yd.Td),this.Rd()}}},this.Dd=t,this.yd=i,this.ys=e,this.Vd()}m(){null!==this.td&&(this.td(),this.td=null),null!==this.sd&&(this.sd(),this.sd=null),null!==this.ed&&(this.ed(),this.ed=null),null!==this.rd&&(this.rd(),this.rd=null),null!==this.hd&&(this.hd(),this.hd=null),null!==this.nd&&(this.nd(),this.nd=null),this.Id(),this.Rd()}Bd(t){this.ed&&this.ed();let i=this.Ad.bind(this);if(this.ed=()=>{this.Dd.removeEventListener("mousemove",i)},this.Dd.addEventListener("mousemove",i),this.gd(t))return;let e=this.Md(t);this.kd(e,this.yd.Ed),this.pd=!0}Rd(){null!==this.Hc&&clearTimeout(this.Hc),this.Fc=0,this.Hc=null,this.Uc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}Pd(){null!==this.qc&&clearTimeout(this.qc),this.$c=0,this.qc=null,this.Yc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}Ad(t){if(this.ud||null!==this.Xc||this.gd(t))return;let i=this.Md(t);this.kd(i,this.yd.zd),this.pd=!0}Ld(t){let i=i7(t.changedTouches,B(this.fd));if(null===i||(this.dd=i8(t),null!==this.ad)||this._d)return;this.od=!0;let{Od:e,Nd:s,bd:h}=this.xd(i9(i),B(this.Xc));if(this.Gc||!(h<5)){if(!this.Gc){let t=.5*e,i=s>=t&&!this.ys.Wd(),h=t>s&&!this.ys.Fd();i||h||(this._d=!0),this.Gc=!0,this.Qc=!0,this.Id(),this.Pd()}if(!this._d){let e=this.Md(t,i);this.Sd(e,this.yd.Hd),i4(t)}}}Ud(t){if(0!==t.button)return;let{bd:i}=this.xd(i9(t),B(this.Kc));if(i>=5&&(this.Jc=!0,this.Rd()),this.Jc){let i=this.Md(t);this.kd(i,this.yd.$d)}}xd(t,i){let e=Math.abs(i._t-t._t),s=Math.abs(i.ut-t.ut);return{Od:e,Nd:s,bd:e+s}}qd(t){let i=i7(t.changedTouches,B(this.fd));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.fd=null,this.dd=i8(t),this.Id(),this.Xc=null,this.hd&&(this.hd(),this.hd=null);let e=this.Md(t,i);if(this.Sd(e,this.yd.Yd),++this.$c,this.qc&&this.$c>1){let{bd:t}=this.xd(i9(i),this.Yc);t<30&&!this.Qc&&this.Sd(e,this.yd.Cd),this.Pd()}else this.Qc||(this.Sd(e,this.yd.jd),this.yd.jd&&i4(t));0===this.$c&&i4(t),0===t.touches.length&&this.Zc&&(this.Zc=!1,i4(t))}md(t){if(0!==t.button)return;let i=this.Md(t);if(this.Kc=null,this.ud=!1,this.rd&&(this.rd(),this.rd=null),i2()&&this.Dd.ownerDocument.documentElement.removeEventListener("mouseleave",this.vd),!this.gd(t))if(this.kd(i,this.yd.Zd),++this.Fc,this.Hc&&this.Fc>1){let{bd:e}=this.xd(i9(t),this.Uc);e<5&&!this.Jc&&this.kd(i,this.yd.Td),this.Rd()}else this.Jc||this.kd(i,this.yd.Kd)}Id(){null!==this.jc&&(clearTimeout(this.jc),this.jc=null)}Xd(t){if(null!==this.fd)return;let i=t.changedTouches[0];this.fd=i.identifier,this.dd=i8(t);let e=this.Dd.ownerDocument.documentElement;this.Qc=!1,this.Gc=!1,this._d=!1,this.Xc=i9(i),this.hd&&(this.hd(),this.hd=null);{let i=this.Ld.bind(this),s=this.qd.bind(this);this.hd=()=>{e.removeEventListener("touchmove",i),e.removeEventListener("touchend",s)},e.addEventListener("touchmove",i,{passive:!1}),e.addEventListener("touchend",s,{passive:!1}),this.Id(),this.jc=setTimeout(this.Gd.bind(this,t),240)}let s=this.Md(t,i);this.Sd(s,this.yd.Jd),this.qc||(this.$c=0,this.qc=setTimeout(this.Pd.bind(this),500),this.Yc=i9(i))}Qd(t){if(0!==t.button)return;let i=this.Dd.ownerDocument.documentElement;i2()&&i.addEventListener("mouseleave",this.vd),this.Jc=!1,this.Kc=i9(t),this.rd&&(this.rd(),this.rd=null);{let t=this.Ud.bind(this),e=this.md.bind(this);this.rd=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",e)},i.addEventListener("mousemove",t),i.addEventListener("mouseup",e)}if(this.ud=!0,this.gd(t))return;let e=this.Md(t);this.kd(e,this.yd.tf),this.Hc||(this.Fc=0,this.Hc=setTimeout(this.Rd.bind(this),500),this.Uc=i9(t))}Vd(){var t;this.Dd.addEventListener("mouseenter",this.Bd.bind(this)),this.Dd.addEventListener("touchcancel",this.Id.bind(this));{let t=this.Dd.ownerDocument,i=t=>{this.yd.if&&(t.composed&&this.Dd.contains(t.composedPath()[0])||t.target&&this.Dd.contains(t.target)||this.yd.if())};this.sd=()=>{t.removeEventListener("touchstart",i)},this.td=()=>{t.removeEventListener("mousedown",i)},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0})}i3()&&(this.nd=()=>{this.Dd.removeEventListener("dblclick",this.wd)},this.Dd.addEventListener("dblclick",this.wd)),this.Dd.addEventListener("mouseleave",this.sf.bind(this)),this.Dd.addEventListener("touchstart",this.Xd.bind(this),{passive:!0}),t=this.Dd,i1&&void 0!==window.chrome&&t.addEventListener("mousedown",t=>{if(1===t.button)return t.preventDefault(),!1}),this.Dd.addEventListener("mousedown",this.Qd.bind(this)),this.nf(),this.Dd.addEventListener("touchmove",()=>{},{passive:!1})}nf(){void 0===this.yd.ef&&void 0===this.yd.rf&&void 0===this.yd.hf||(this.Dd.addEventListener("touchstart",t=>this.af(t.touches),{passive:!0}),this.Dd.addEventListener("touchmove",t=>{if(2===t.touches.length&&null!==this.ad&&void 0!==this.yd.rf){let i=i6(t.touches[0],t.touches[1])/this.ld;this.yd.rf(this.ad,i),i4(t)}},{passive:!1}),this.Dd.addEventListener("touchend",t=>{this.af(t.touches)}))}af(t){1===t.length&&(this.od=!1),2!==t.length||this.od||this.Zc?this.lf():this._f(t)}_f(t){let i=this.Dd.getBoundingClientRect()||{left:0,top:0};this.ad={_t:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,ut:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.ld=i6(t[0],t[1]),void 0!==this.yd.ef&&this.yd.ef(),this.Id()}lf(){null!==this.ad&&(this.ad=null,void 0!==this.yd.hf&&this.yd.hf())}sf(t){if(this.ed&&this.ed(),this.gd(t)||!this.pd)return;let i=this.Md(t);this.kd(i,this.yd.uf),this.pd=!i3()}Gd(t){let i=i7(t.touches,B(this.fd));if(null===i)return;let e=this.Md(t,i);this.Sd(e,this.yd.cf),this.Qc=!0,this.Zc=!0}gd(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:i8(t)<this.dd+500}Sd(t,i){i&&i.call(this.yd,t)}kd(t,i){i&&i.call(this.yd,t)}Md(t,i){let e=i||t,s=this.Dd.getBoundingClientRect()||{left:0,top:0};return{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,localX:e.clientX-s.left,localY:e.clientY-s.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,df:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,ff:t.type,pf:e.target,$o:t.view,vf:()=>{"touchstart"!==t.type&&i4(t)}}}}function i6(t,i){let e=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(e*e+s*s)}function i4(t){t.cancelable&&t.preventDefault()}function i9(t){return{_t:t.pageX,ut:t.pageY}}function i8(t){return t.timeStamp||performance.now()}function i7(t,i){for(let e=0;e<t.length;++e)if(t[e].identifier===i)return t[e];return null}class et{constructor(t,i,e){this.mf=null,this.wf=null,this.gf=!0,this.Mf=null,this.bf=t,this.xf=t.Sf()[i],this.Cf=t.Sf()[e],this.yf=document.createElement("tr"),this.yf.style.height="1px",this.Pf=document.createElement("td"),this.Pf.style.position="relative",this.Pf.style.padding="0",this.Pf.style.margin="0",this.Pf.setAttribute("colspan","3"),this.kf(),this.yf.appendChild(this.Pf),this.gf=this.bf.N().layout.panes.enableResize,this.gf?this.Tf():(this.mf=null,this.wf=null)}m(){null!==this.wf&&this.wf.m()}Rf(){return this.yf}Df(){return C({width:this.xf.Df().width,height:1})}Vf(){return C({width:this.xf.Vf().width,height:+window.devicePixelRatio})}If(t,i,e){let s=this.Vf();t.fillStyle=this.bf.N().layout.panes.separatorColor,t.fillRect(i,e,s.width,s.height)}Pt(){this.kf(),this.bf.N().layout.panes.enableResize!==this.gf&&(this.gf=this.bf.N().layout.panes.enableResize,this.gf?this.Tf():(null!==this.mf&&(this.Pf.removeChild(this.mf.Bf),this.Pf.removeChild(this.mf.Af),this.mf=null),null!==this.wf&&(this.wf.m(),this.wf=null)))}Tf(){let t=document.createElement("div"),i=t.style;i.position="fixed",i.display="none",i.zIndex="49",i.top="0",i.left="0",i.width="100%",i.height="100%",i.cursor="row-resize",this.Pf.appendChild(t);let e=document.createElement("div"),s=e.style;s.position="absolute",s.zIndex="50",s.top="-4px",s.height="9px",s.width="100%",s.backgroundColor="",s.cursor="row-resize",this.Pf.appendChild(e);let h={Ed:this.Ef.bind(this),uf:this.zf.bind(this),tf:this.Lf.bind(this),Jd:this.Lf.bind(this),$d:this.Of.bind(this),Hd:this.Of.bind(this),Zd:this.Nf.bind(this),Yd:this.Nf.bind(this)};this.wf=new i5(e,h,{Wd:()=>!1,Fd:()=>!0}),this.mf={Af:e,Bf:t}}kf(){this.Pf.style.background=this.bf.N().layout.panes.separatorColor}Ef(t){null!==this.mf&&(this.mf.Af.style.backgroundColor=this.bf.N().layout.panes.separatorHoverColor)}zf(t){null!==this.mf&&null===this.Mf&&(this.mf.Af.style.backgroundColor="")}Lf(t){if(null===this.mf)return;let i=this.xf.Wf().fo()+this.Cf.Wf().fo(),e=i/(this.xf.Df().height+this.Cf.Df().height),s=30*e;i<=2*s||(this.Mf={Ff:t.pageY,Hf:this.xf.Wf().fo(),Uf:i-s,$f:i,qf:e,Yf:s},this.mf.Bf.style.display="block")}Of(t){let i=this.Mf;if(null===i)return;let e=(t.pageY-i.Ff)*i.qf,s=iw(i.Hf+e,i.Yf,i.Uf);this.xf.Wf().po(s),this.Cf.Wf().po(i.$f-s),this.bf.Qt().Bh()}Nf(t){null!==this.Mf&&null!==this.mf&&(this.Mf=null,this.mf.Bf.style.display="none")}}function ei(t,i,e){let s=(t.jf-i.jf)/(t.wt-i.wt);return Math.sign(s)*Math.min(Math.abs(s),e)}class ee{constructor(t,i,e,s){this.Zf=null,this.Kf=null,this.Xf=null,this.Gf=null,this.Jf=null,this.Qf=0,this.tp=0,this.ip=t,this.sp=i,this.np=e,this.Mn=s}ep(t,i){if(null!==this.Zf){if(this.Zf.wt===i)return void(this.Zf.jf=t);if(Math.abs(this.Zf.jf-t)<this.Mn)return}this.Gf=this.Xf,this.Xf=this.Kf,this.Kf=this.Zf,this.Zf={wt:i,jf:t}}le(t,i){var e,s,h,r,n,l;if(null===this.Zf||null===this.Kf||i-this.Zf.wt>50)return;let o=0,a=ei(this.Zf,this.Kf,this.sp),u=(e=this.Zf,s=this.Kf,e.jf-s.jf),c=[a],f=[u];if(o+=u,null!==this.Xf){let t=ei(this.Kf,this.Xf,this.sp);if(Math.sign(t)===Math.sign(a)){let i=(h=this.Kf,r=this.Xf,h.jf-r.jf);if(c.push(t),f.push(i),o+=i,null!==this.Gf){let t=ei(this.Xf,this.Gf,this.sp);if(Math.sign(t)===Math.sign(a)){let i=(n=this.Xf,l=this.Gf,n.jf-l.jf);c.push(t),f.push(i),o+=i}}}}let d=0;for(let t=0;t<c.length;++t)d+=f[t]/o*c[t];Math.abs(d)<this.ip||(this.Jf={jf:t,wt:i},this.tp=d,this.Qf=function(t,i){let e=Math.log(i);return Math.log(-(+e/t))/e}(Math.abs(d),this.np))}cu(t){let i=B(this.Jf),e=t-i.wt;return i.jf+this.tp*(Math.pow(this.np,e)-1)/Math.log(this.np)}uu(t){return null===this.Jf||this.rp(t)===this.Qf}rp(t){return Math.min(t-B(this.Jf).wt,this.Qf)}}class es{constructor(t,i){this.hp=void 0,this.ap=void 0,this.lp=void 0,this.ps=!1,this.op=t,this._p=i,this.up()}Pt(){this.up()}cp(){this.hp&&this.op.removeChild(this.hp),this.ap&&this.op.removeChild(this.ap),this.hp=void 0,this.ap=void 0}dp(){return this.ps!==this.fp()||this.lp!==this.pp()}pp(){return this._p.Qt().Ki().J(this._p.N().layout.textColor)>160?"dark":"light"}fp(){return this._p.N().layout.attributionLogo}vp(){let t=new URL(location.href);return t.hostname?"&utm_source="+t.hostname+t.pathname:""}up(){this.dp()&&(this.cp(),this.ps=this.fp(),this.ps&&(this.lp=this.pp(),this.ap=document.createElement("style"),this.ap.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.hp=document.createElement("a"),this.hp.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.vp()}`,this.hp.title="Charting by TradingView",this.hp.id="tv-attr-logo",this.hp.target="_blank",this.hp.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.hp.toggleAttribute("data-dark","dark"===this.lp),this.op.appendChild(this.ap),this.op.appendChild(this.hp)))}}function eh(t,i){let e=B(t.ownerDocument).createElement("canvas");t.appendChild(e);let s=function(t,i){if("device-pixel-content-box"===i.type)return new O(t,i.transform,i.options);throw Error("Unsupported binding target")}(e,{type:"device-pixel-content-box",options:{allowResizeObserver:!0},transform:(t,i)=>({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return s.resizeCanvasElement(i),s}function er(t){t.width=1,t.height=1,t.getContext("2d")?.clearRect(0,0,1,1)}function en(t,i,e,s){t.ih&&t.ih(i,e,s)}function el(t,i,e,s){t.nt(i,e,s)}function eo(t,i,e,s){for(let h of t(e,s)){let t=h.Tt(s);null!==t&&i(t)}}function ea(t,i){return e=>void 0===e.Wt||(e.Wt()?.wa()??"")!==i?[]:e.ta?.(t)??[]}function eu(t,i,e,s){if(!t.length)return;let h=0,r=t[0].$t(s,!0),n=1===i?e/2-(t[0].Wi()-r/2):t[0].Wi()-r/2-e/2;n=Math.max(0,n);for(let r=1;r<t.length;r++){let l=t[r],o=t[r-1],a=o.$t(s,!1),u=l.Wi(),c=o.Wi();if(1===i?u>c-a:u<c+a){let s=c-a*i;l.Fi(s);let r=s-i*a/2;if((1===i?r<0:r>e)&&n>0){let s=Math.min(1===i?-1-r:r-e,n);for(let e=h;e<t.length;e++)t[e].Fi(t[e].Wi()+i*s);n-=s}}else h=r,n=1===i?c-a-u:u-(c+a)}}class ec{constructor(t,i,e,s){this.Yi=null,this.mp=null,this.wp=!1,this.gp=new tR(200),this.Mp=null,this.bp=0,this.xp=!1,this.Sp=()=>{this.xp||this.yt.Cp().Qt().ar()},this.yp=()=>{this.xp||this.yt.Cp().Qt().ar()},this.yt=t,this.ys=i,this._l=i.layout,this.Au=e,this.Pp="left"===s,this.kp=ea("normal",s),this.Tp=ea("top",s),this.Rp=ea("bottom",s),this.Pf=document.createElement("div"),this.Pf.style.height="100%",this.Pf.style.overflow="hidden",this.Pf.style.width="25px",this.Pf.style.left="0",this.Pf.style.position="relative",this.Dp=eh(this.Pf,C({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let h=this.Dp.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this.Vp=eh(this.Pf,C({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let r=this.Vp.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0";let n={tf:this.Lf.bind(this),Jd:this.Lf.bind(this),$d:this.Of.bind(this),Hd:this.Of.bind(this),if:this.Ip.bind(this),Zd:this.Nf.bind(this),Yd:this.Nf.bind(this),Td:this.Bp.bind(this),Cd:this.Bp.bind(this),Ed:this.Ap.bind(this),uf:this.zf.bind(this)};this.wf=new i5(this.Vp.canvasElement,n,{Wd:()=>!this.ys.handleScroll.vertTouchDrag,Fd:()=>!0})}m(){this.wf.m(),this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose(),null!==this.Yi&&this.Yi.Hl().u(this),this.Yi=null}Rf(){return this.Pf}P(){return this._l.fontSize}Ep(){let t=this.Au.N();return this.Mp!==t.k&&(this.gp.In(),this.Mp=t.k),t}zp(){var t,i;if(null===this.Yi)return 0;let e=0,s=this.Ep(),h=B(this.Dp.canvasElement.getContext("2d",{colorSpace:this.yt.Cp().N().layout.colorSpace}));h.save();let r=this.Yi.Va();h.font=this.Lp(),r.length>0&&(e=Math.max(this.gp.Vi(h,r[0].$a),this.gp.Vi(h,r[r.length-1].$a)));let n=this.Op();for(let t=n.length;t--;){let i=this.gp.Vi(h,n[t].ri());i>e&&(e=i)}let l=this.Yi.zt();if(null!==l&&null!==this.mp&&2!==(t=this.ys.crosshair).mode&&t.horzLine.visible&&t.horzLine.labelVisible){let t=this.Yi.Ts(1,l),i=this.Yi.Ts(this.mp.height-2,l);e=Math.max(e,this.gp.Vi(h,this.Yi.Xi(Math.floor(Math.min(t,i))+.11111111111111,l)),this.gp.Vi(h,this.Yi.Xi(Math.ceil(Math.max(t,i))-.11111111111111,l)))}h.restore();let o=e||34;return(i=Math.ceil(s.S+s.C+s.I+s.B+5+o))+i%2}Np(t){null!==this.mp&&P(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`)}Wp(){return B(this.mp).width}_s(t){this.Yi!==t&&(null!==this.Yi&&this.Yi.Hl().u(this),this.Yi=t,t.Hl().i(this.il.bind(this),this))}Wt(){return this.Yi}In(){let t=this.yt.Wf();this.yt.Cp().Qt().Bo(t,B(this.Wt()))}Fp(t){if(null===this.mp)return;let i={colorSpace:this.yt.Cp().N().layout.colorSpace};if(1!==t){this.Hp(),this.Dp.applySuggestedBitmapSize();let t=Y(this.Dp,i);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t)}),this.yt.qp(t,this.Rp),this.Yp(t),this.yt.qp(t,this.kp),this.jp(t))}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.Zp(e),this.yt.qp(e,this.Tp))}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Pt(){this.Yi?.Va()}Lf(t){if(null===this.Yi||this.Yi.Zi()||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf();this.wp=!0,i.Po(e,this.Yi,t.localY)}Of(t){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf(),s=this.Yi;i.ko(e,s,t.localY)}Ip(){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let t=this.yt.Cp().Qt(),i=this.yt.Wf(),e=this.Yi;this.wp&&(this.wp=!1,t.To(i,e))}Nf(t){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf();this.wp=!1,i.To(e,this.Yi)}Bp(t){this.ys.handleScale.axisDoubleClickReset.price&&this.In()}Ap(t){null!==this.Yi&&(!this.yt.Cp().Qt().N().handleScale.axisPressedMouseMove.price||this.Yi.Le()||this.Yi.gl()||this.Kp(1))}zf(t){this.Kp(0)}Op(){let t=[],i=null===this.Yi?void 0:this.Yi;return(e=>{for(let s=0;s<e.length;++s){let h=e[s].Fs(this.yt.Wf(),i);for(let i=0;i<h.length;i++)t.push(h[i])}})(this.yt.Wf().Dt()),t}Up({context:t,bitmapSize:i}){let{width:e,height:s}=i,h=this.yt.Wf().Qt(),r=h.$(),n=h.xc();r===n?to(t,0,0,e,s,r):tc(t,0,0,e,s,r,n)}$p({context:t,bitmapSize:i,horizontalPixelRatio:e}){let s;if(null===this.mp||null===this.Yi||!this.Yi.N().borderVisible)return;t.fillStyle=this.Yi.N().borderColor;let h=Math.max(1,Math.floor(this.Ep().S*e));s=this.Pp?i.width-h:0,t.fillRect(s,0,h,i.height)}Yp(t){if(null===this.mp||null===this.Yi)return;let i=this.Yi.Va(),e=this.Yi.N(),s=this.Ep(),h=this.Pp?this.mp.width-s.C:0;e.borderVisible&&e.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:r,verticalPixelRatio:n})=>{t.fillStyle=e.borderColor;let l=Math.max(1,Math.floor(n)),o=Math.floor(.5*n),a=Math.round(s.C*r);for(let e of(t.beginPath(),i))t.rect(Math.floor(h*r),Math.round(e.Pa*n)-o,a,l);t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{t.font=this.Lp(),t.fillStyle=e.textColor??this._l.textColor,t.textAlign=this.Pp?"right":"left",t.textBaseline="middle";let r=this.Pp?Math.round(h-s.I):Math.round(h+s.C+s.I),n=i.map(i=>this.gp.Di(t,i.$a));for(let e=i.length;e--;){let s=i[e];t.fillText(s.$a,r,s.Pa+n[e])}})}Hp(){if(null===this.mp||null===this.Yi)return;let t=this.mp.height/2,i=[],e=this.Yi.Dt().slice(),s=this.yt.Wf(),h=this.Ep();this.Yi===s.$n()&&this.yt.Wf().Dt().forEach(t=>{s.Un(t)&&e.push(t)});let r=this.Yi.ba()[0],n=this.Yi;e.forEach(e=>{let h=e.Fs(s,n);h.forEach(t=>{t.Fi(null),t.Hi()&&i.push(t)}),r===e&&h.length>0&&(t=h[0].Bi())}),i.forEach(t=>t.Fi(t.Bi())),this.Yi.N().alignLabels&&this.Xp(i,h,t)}Xp(t,i,e){if(null===this.mp)return;let s=t.filter(t=>t.Bi()<=e),h=t.filter(t=>t.Bi()>e);for(let e of(s.sort((t,i)=>i.Bi()-t.Bi()),s.length&&h.length&&h.push(s[0]),h.sort((t,i)=>t.Bi()-i.Bi()),t)){let t=Math.floor(e.$t(i)/2),s=e.Bi();s>-t&&s<t&&e.Fi(t),s>this.mp.height-t&&s<this.mp.height+t&&e.Fi(this.mp.height-t)}eu(s,1,this.mp.height,i),eu(h,-1,this.mp.height,i)}jp(t){if(null===this.mp)return;let i=this.Op(),e=this.Ep(),s=this.Pp?"right":"left";i.forEach(i=>{i.Ui()&&i.Tt(B(this.Yi)).nt(t,e,this.gp,s)})}Zp(t){if(null===this.mp||null===this.Yi)return;let i=this.yt.Cp().Qt(),e=[],s=this.yt.Wf(),h=i.Yu().Fs(s,this.Yi);h.length&&e.push(h);let r=this.Ep(),n=this.Pp?"right":"left";e.forEach(i=>{i.forEach(i=>{i.Tt(B(this.Yi)).nt(t,r,this.gp,n)})})}Kp(t){this.Pf.style.cursor=1===t?"ns-resize":"default"}il(){let t=this.zp();this.bp<t&&this.yt.Cp().Qt().Bh(),this.bp=t}Lp(){return H(this._l.fontSize,this._l.fontFamily)}}function ef(t,i){return t.Jh?.(i)??[]}function ed(t,i){return t.Ws?.(i)??[]}function ep(t,i){return t.us?.(i)??[]}function em(t,i){return t.Kh?.(i)??[]}class eg{constructor(t,i){this.mp=C({width:0,height:0}),this.Gp=null,this.Jp=null,this.Qp=null,this.tv=null,this.iv=!1,this.sv=new W,this.nv=new W,this.ev=0,this.rv=!1,this.hv=null,this.av=!1,this.lv=null,this.ov=null,this.xp=!1,this.Sp=()=>{this.xp||null===this._v||this.ts().ar()},this.yp=()=>{this.xp||null===this._v||this.ts().ar()},this._p=t,this._v=i,this._v.zo().i(this.uv.bind(this),this,!0),this.cv=document.createElement("td"),this.cv.style.padding="0",this.cv.style.position="relative";let e=document.createElement("div");e.style.width="100%",e.style.height="100%",e.style.position="relative",e.style.overflow="hidden",this.dv=document.createElement("td"),this.dv.style.padding="0",this.fv=document.createElement("td"),this.fv.style.padding="0",this.cv.appendChild(e),this.Dp=eh(e,C({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let s=this.Dp.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Vp=eh(e,C({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let h=this.Vp.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",this.yf=document.createElement("tr"),this.yf.appendChild(this.dv),this.yf.appendChild(this.cv),this.yf.appendChild(this.fv),this.pv(),this.wf=new i5(this.Vp.canvasElement,this,{Wd:()=>null===this.hv&&!this._p.N().handleScroll.vertTouchDrag,Fd:()=>null===this.hv&&!this._p.N().handleScroll.horzTouchDrag})}m(){null!==this.Gp&&this.Gp.m(),null!==this.Jp&&this.Jp.m(),this.Qp=null,this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose(),null!==this._v&&(this._v.zo().u(this),this._v.m()),this.wf.m()}Wf(){return B(this._v)}vv(t){null!==this._v&&this._v.zo().u(this),this._v=t,null!==this._v&&this._v.zo().i(eg.prototype.uv.bind(this),this,!0),this.pv(),this._p.Sf().indexOf(this)===this._p.Sf().length-1?(this.Qp=this.Qp??new es(this.cv,this._p),this.Qp.Pt()):(this.Qp?.cp(),this.Qp=null)}Cp(){return this._p}Rf(){return this.yf}pv(){if(null!==this._v&&(this.mv(),0!==this.ts().js().length)){if(null!==this.Gp){let t=this._v.Co();this.Gp._s(B(t))}if(null!==this.Jp){let t=this._v.yo();this.Jp._s(B(t))}}}wv(){null!==this.Gp&&this.Gp.Pt(),null!==this.Jp&&this.Jp.Pt()}fo(){return null!==this._v?this._v.fo():0}po(t){this._v&&this._v.po(t)}Ed(t){if(!this._v)return;this.gv();let i=t.localX,e=t.localY;this.Mv(i,e,t)}tf(t){this.gv(),this.bv(),this.Mv(t.localX,t.localY,t)}zd(t){if(!this._v)return;this.gv();let i=t.localX,e=t.localY;this.Mv(i,e,t)}Kd(t){null!==this._v&&(this.gv(),this.xv(t))}Td(t){null!==this._v&&this.Sv(this.nv,t)}Cd(t){this.Td(t)}$d(t){this.gv(),this.Cv(t),this.Mv(t.localX,t.localY,t)}Zd(t){null!==this._v&&(this.gv(),this.rv=!1,this.yv(t))}jd(t){null!==this._v&&this.xv(t)}cf(t){if(this.rv=!0,null===this.hv){let i={x:t.localX,y:t.localY};this.Pv(i,i,t)}}uf(t){null!==this._v&&(this.gv(),this._v.Qt().Uu(null),this.kv())}Tv(){return this.sv}Rv(){return this.nv}ef(){this.ev=1,this.ts().hn()}rf(t,i){if(!this._p.N().handleScale.pinch)return;let e=5*(i-this.ev);this.ev=i,this.ts().tc(t._t,e)}Jd(t){this.rv=!1,this.av=null!==this.hv,this.bv();let i=this.ts().Yu();null!==this.hv&&i.Vt()&&(this.lv={x:i.si(),y:i.ni()},this.hv={x:t.localX,y:t.localY})}Hd(t){if(null===this._v)return;let i=t.localX,e=t.localY;if(null===this.hv)this.Cv(t);else{this.av=!1;let s=B(this.lv),h=s.x+(i-this.hv.x),r=s.y+(e-this.hv.y);this.Mv(h,r,t)}}Yd(t){0===this.Cp().N().trackingMode.exitMode&&(this.av=!0),this.Dv(),this.yv(t)}jn(t,i){let e=this._v;return null===e?null:iY(e,t,i)}Vv(t,i){B("left"===i?this.Gp:this.Jp).Np(C({width:t,height:this.mp.height}))}Df(){return this.mp}Np(t){P(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.cv.style.width=t.width+"px",this.cv.style.height=t.height+"px")}Iv(){let t=B(this._v);for(let i of(t.So(t.Co()),t.So(t.yo()),t.ba()))if(t.Un(i)){let e=i.Wt();null!==e&&t.So(e),i.Ns()}for(let i of t.Oo())i.Ns()}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Fp(t){if(0===t||null===this._v)return;t>1&&this.Iv(),null!==this.Gp&&this.Gp.Fp(t),null!==this.Jp&&this.Jp.Fp(t);let i={colorSpace:this._p.N().layout.colorSpace};if(1!==t){this.Dp.applySuggestedBitmapSize();let t=Y(this.Dp,i);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.Up(t)}),this._v&&(this.Bv(t,ef),this.Av(t),this.Bv(t,ed),this.Bv(t,ep)))}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.Ev(e),this.Bv(e,em),this.Bv(e,ep))}zv(){return this.Gp}Lv(){return this.Jp}qp(t,i){this.Bv(t,i)}uv(){null!==this._v&&this._v.zo().u(this),this._v=null}xv(t){this.Sv(this.sv,t)}Sv(t,i){let e=i.localX,s=i.localY;t.v()&&t.p(this.ts().At().Z_(e),{x:e,y:s},i)}Up({context:t,bitmapSize:i}){let{width:e,height:s}=i,h=this.ts(),r=h.$(),n=h.xc();r===n?to(t,0,0,e,s,n):tc(t,0,0,e,s,r,n)}Av(t){let i=B(this._v),e=i.Lo().lr().Tt(i);null!==e&&e.nt(t,!1)}Ev(t){this.Ov(t,ed,el,this.ts().Yu())}Bv(t,i){let e=B(this._v),s=e.Dt(),h=e.Oo();for(let e of h)this.Ov(t,i,en,e);for(let e of s)this.Ov(t,i,en,e);for(let e of h)this.Ov(t,i,el,e);for(let e of s)this.Ov(t,i,el,e)}Ov(t,i,e,s){let h=B(this._v),r=h.Qt().Hu(),n=null!==r&&r.Wo===s,l=null!==r&&n&&void 0!==r.Fo?r.Fo.Kn:void 0;eo(i,i=>e(i,t,n,l),s,h)}mv(){if(null===this._v)return;let t=this._p,i=this._v.Co().N().visible,e=this._v.yo().N().visible;i||null===this.Gp||(this.dv.removeChild(this.Gp.Rf()),this.Gp.m(),this.Gp=null),e||null===this.Jp||(this.fv.removeChild(this.Jp.Rf()),this.Jp.m(),this.Jp=null);let s=t.Qt().cc();i&&null===this.Gp&&(this.Gp=new ec(this,t.N(),s,"left"),this.dv.appendChild(this.Gp.Rf())),e&&null===this.Jp&&(this.Jp=new ec(this,t.N(),s,"right"),this.fv.appendChild(this.Jp.Rf()))}Nv(t){return t.df&&this.rv||null!==this.hv}Wv(t){return Math.max(0,Math.min(t,this.mp.width-1))}Fv(t){return Math.max(0,Math.min(t,this.mp.height-1))}Mv(t,i,e){this.ts().lc(this.Wv(t),this.Fv(i),e,B(this._v))}kv(){this.ts()._c()}Dv(){this.av&&(this.hv=null,this.kv())}Pv(t,i,e){this.hv=t,this.av=!1,this.Mv(i.x,i.y,e);let s=this.ts().Yu();this.lv={x:s.si(),y:s.ni()}}ts(){return this._p.Qt()}yv(t){if(!this.iv)return;let i=this.ts(),e=this.Wf();if(i.Vo(e,e.ks()),this.tv=null,this.iv=!1,i.rc(),null!==this.ov){let t=performance.now(),e=i.At();this.ov.le(e.iu(),t),this.ov.uu(t)||i._n(this.ov)}}gv(){this.hv=null}bv(){if(this._v){if(this.ts().hn(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)B(document.activeElement).blur();else{let t=document.getSelection();null!==t&&t.removeAllRanges()}this._v.ks().Zi()||this.ts().At().Zi()}}Cv(t){if(null===this._v)return;let i=this.ts(),e=i.At();if(e.Zi())return;let s=this._p.N(),h=s.handleScroll,r=s.kineticScroll;if((!h.pressedMouseMove||t.df)&&(!h.horzTouchDrag&&!h.vertTouchDrag||!t.df))return;let n=this._v.ks(),l=performance.now();if(null!==this.tv||this.Nv(t)||(this.tv={x:t.clientX,y:t.clientY,Lc:l,Hv:t.localX,Uv:t.localY}),null!==this.tv&&!this.iv&&(this.tv.x!==t.clientX||this.tv.y!==t.clientY)){if(t.df&&r.touch||!t.df&&r.mouse){let t=e.Q_();this.ov=new ee(.2/t,7/t,.997,15/t),this.ov.ep(e.iu(),this.tv.Lc)}else this.ov=null;n.Zi()||i.Ro(this._v,n,t.localY),i.nc(t.localX),this.iv=!0}this.iv&&(n.Zi()||i.Do(this._v,n,t.localY),i.ec(t.localX),null!==this.ov&&this.ov.ep(e.iu(),l))}}class ev{constructor(t,i,e,s,h){this.St=!0,this.mp=C({width:0,height:0}),this.Sp=()=>this.Fp(3),this.Pp="left"===t,this.Au=e.cc,this.ys=i,this.$v=s,this.qv=h,this.Pf=document.createElement("div"),this.Pf.style.width="25px",this.Pf.style.height="100%",this.Pf.style.overflow="hidden",this.Dp=eh(this.Pf,C({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp)}m(){this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose()}Rf(){return this.Pf}Df(){return this.mp}Np(t){P(this.mp,t)||(this.mp=t,this.Dp.resizeCanvasElement(t),this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`,this.St=!0)}Fp(t){if(t<3&&!this.St||0===this.mp.width||0===this.mp.height)return;this.St=!1,this.Dp.applySuggestedBitmapSize();let i=Y(this.Dp,{colorSpace:this.ys.layout.colorSpace});null!==i&&i.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t)})}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}$p({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(!this.$v())return;t.fillStyle=this.ys.timeScale.borderColor;let h=Math.floor(this.Au.N().S*e),r=Math.floor(this.Au.N().S*s),n=this.Pp?i.width-h:0;t.fillRect(n,0,h,r)}Up({context:t,bitmapSize:i}){to(t,0,0,i.width,i.height,this.qv())}}function eb(t){return i=>i.ia?.(t)??[]}let ey=eb("normal"),ew=eb("top"),eM=eb("bottom");class e_{constructor(t,i){this.Yv=null,this.jv=null,this.M=null,this.Zv=!1,this.mp=C({width:0,height:0}),this.Kv=new W,this.gp=new tR(5),this.xp=!1,this.Sp=()=>{this.xp||this._p.Qt().ar()},this.yp=()=>{this.xp||this._p.Qt().ar()},this._p=t,this.Yo=i,this.ys=t.N().layout,this.hp=document.createElement("tr"),this.Xv=document.createElement("td"),this.Xv.style.padding="0",this.Gv=document.createElement("td"),this.Gv.style.padding="0",this.Pf=document.createElement("td"),this.Pf.style.height="25px",this.Pf.style.padding="0",this.Jv=document.createElement("div"),this.Jv.style.width="100%",this.Jv.style.height="100%",this.Jv.style.position="relative",this.Jv.style.overflow="hidden",this.Pf.appendChild(this.Jv),this.Dp=eh(this.Jv,C({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let e=this.Dp.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Vp=eh(this.Jv,C({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let s=this.Vp.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.hp.appendChild(this.Xv),this.hp.appendChild(this.Pf),this.hp.appendChild(this.Gv),this.Qv(),this._p.Qt().do().i(this.Qv.bind(this),this),this.wf=new i5(this.Vp.canvasElement,this,{Wd:()=>!0,Fd:()=>!this._p.N().handleScroll.horzTouchDrag})}m(){this.wf.m(),null!==this.Yv&&this.Yv.m(),null!==this.jv&&this.jv.m(),this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose()}Rf(){return this.hp}tm(){return this.Yv}im(){return this.jv}tf(t){if(this.Zv)return;this.Zv=!0;let i=this._p.Qt();!i.At().Zi()&&this._p.N().handleScale.axisPressedMouseMove.time&&i.Qu(t.localX)}Jd(t){this.tf(t)}if(){let t=this._p.Qt();!t.At().Zi()&&this.Zv&&(this.Zv=!1,this._p.N().handleScale.axisPressedMouseMove.time&&t.ac())}$d(t){let i=this._p.Qt();!i.At().Zi()&&this._p.N().handleScale.axisPressedMouseMove.time&&i.hc(t.localX)}Hd(t){this.$d(t)}Zd(){this.Zv=!1;let t=this._p.Qt();t.At().Zi()&&!this._p.N().handleScale.axisPressedMouseMove.time||t.ac()}Yd(){this.Zd()}Td(){this._p.N().handleScale.axisDoubleClickReset.time&&this._p.Qt().cn()}Cd(){this.Td()}Ed(){this._p.Qt().N().handleScale.axisPressedMouseMove.time&&this.Kp(1)}uf(){this.Kp(0)}Df(){return this.mp}sm(){return this.Kv}nm(t,i,e){P(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`,this.Kv.p(t)),null!==this.Yv&&this.Yv.Np(C({width:i,height:t.height})),null!==this.jv&&this.jv.Np(C({width:e,height:t.height}))}rm(){let t=this.hm();return Math.ceil(t.S+t.C+t.P+t.A+t.V+t.am)}Pt(){this._p.Qt().At().Va()}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Fp(t){if(0===t)return;let i={colorSpace:this.ys.colorSpace};if(1!==t){this.Dp.applySuggestedBitmapSize();let e=Y(this.Dp,i);null!==e&&(e.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t),this.lm(e,eM)}),this.Yp(e),this.lm(e,ey)),null!==this.Yv&&this.Yv.Fp(t),null!==this.jv&&this.jv.Fp(t)}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.om([...this._p.Qt().js(),this._p.Qt().Yu()],e),this.lm(e,ew))}lm(t,i){let e=this._p.Qt().js();for(let s of e)eo(i,i=>en(i,t,!1,void 0),s,void 0);for(let s of e)eo(i,i=>el(i,t,!1,void 0),s,void 0)}Up({context:t,bitmapSize:i}){to(t,0,0,i.width,i.height,this._p.Qt().xc())}$p({context:t,bitmapSize:i,verticalPixelRatio:e}){if(this._p.N().timeScale.borderVisible){t.fillStyle=this._m();let s=Math.max(1,Math.floor(this.hm().S*e));t.fillRect(0,0,i.width,s)}}Yp(t){let i=this._p.Qt().At(),e=i.Va();if(!e||0===e.length)return;let s=this.Yo.maxTickMarkWeight(e),h=this.hm(),r=i.N();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this._m(),t.fillStyle=this._m();let r=Math.max(1,Math.floor(i)),n=Math.floor(.5*i);t.beginPath();let l=Math.round(h.C*s);for(let s=e.length;s--;){let h=Math.round(e[s].coord*i);t.rect(h-n,0,r,l)}t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{let i=h.S+h.C+h.A+h.P/2;for(let h of(t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.H(),t.font=this.Lp(),e))if(h.weight<s){let e=h.needAlignCoordinate?this.um(t,h.coord,h.label):h.coord;t.fillText(h.label,e,i)}for(let h of(this._p.N().timeScale.allowBoldLabels&&(t.font=this.dm()),e))if(h.weight>=s){let e=h.needAlignCoordinate?this.um(t,h.coord,h.label):h.coord;t.fillText(h.label,e,i)}})}um(t,i,e){let s=this.gp.Vi(t,e),h=Math.floor(i-s/2)+.5;return h<0?i+=Math.abs(0-h):h+s>this.mp.width&&(i-=Math.abs(this.mp.width-(h+s))),i}om(t,i){let e=this.hm();for(let s of t)for(let t of s.cs())t.Tt().nt(i,e)}_m(){return this._p.N().timeScale.borderColor}H(){return this.ys.textColor}W(){return this.ys.fontSize}Lp(){return H(this.W(),this.ys.fontFamily)}dm(){return H(this.W(),this.ys.fontFamily,"bold")}hm(){null===this.M&&(this.M={S:1,L:NaN,A:NaN,V:NaN,Ji:NaN,C:5,P:NaN,k:"",Gi:new tR,am:0});let t=this.M,i=this.Lp();if(t.k!==i){let e=this.W();t.P=e,t.k=i,t.A=3*e/12,t.V=3*e/12,t.Ji=9*e/12,t.L=0,t.am=4*e/12,t.Gi.In()}return this.M}Kp(t){this.Pf.style.cursor=1===t?"ew-resize":"default"}Qv(){let t=this._p.Qt(),i=t.N();i.leftPriceScale.visible||null===this.Yv||(this.Xv.removeChild(this.Yv.Rf()),this.Yv.m(),this.Yv=null),i.rightPriceScale.visible||null===this.jv||(this.Gv.removeChild(this.jv.Rf()),this.jv.m(),this.jv=null);let e={cc:this._p.Qt().cc()},s=()=>i.leftPriceScale.borderVisible&&t.At().N().borderVisible,h=()=>t.xc();i.leftPriceScale.visible&&null===this.Yv&&(this.Yv=new ev("left",i,e,s,h),this.Xv.appendChild(this.Yv.Rf())),i.rightPriceScale.visible&&null===this.jv&&(this.jv=new ev("right",i,e,s,h),this.Gv.appendChild(this.jv.Rf()))}}let eS=!!i1&&!!navigator.userAgentData&&navigator.userAgentData.brands.some(t=>t.brand.includes("Chromium"))&&!!i1&&(navigator?.userAgentData?.platform?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);class ex{constructor(t,i,e){var s;this.fm=[],this.pm=[],this.vm=0,this.ja=0,this.no=0,this.wm=0,this.gm=0,this.Mm=null,this.bm=!1,this.sv=new W,this.nv=new W,this.Vu=new W,this.xm=null,this.Sm=null,this.op=t,this.ys=i,this.Yo=e,this.hp=document.createElement("div"),this.hp.classList.add("tv-lightweight-charts"),this.hp.style.overflow="hidden",this.hp.style.direction="ltr",this.hp.style.width="100%",this.hp.style.height="100%",(s=this.hp).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.Cm=document.createElement("table"),this.Cm.setAttribute("cellspacing","0"),this.hp.appendChild(this.Cm),this.ym=this.Pm.bind(this),eC(this.ys)&&this.km(!0),this.ts=new iW(this.Bu.bind(this),this.ys,e),this.Qt().ju().i(this.Tm.bind(this),this),this.Rm=new e_(this,this.Yo),this.Cm.appendChild(this.Rm.Rf());let h=i.autoSize&&this.Dm(),r=this.ys.width,n=this.ys.height;if(h||0===r||0===n){let i=t.getBoundingClientRect();r=r||i.width,n=n||i.height}this.Vm(r,n),this.Im(),t.appendChild(this.hp),this.Bm(),this.ts.At().pu().i(this.ts.Bh.bind(this.ts),this),this.ts.do().i(this.ts.Bh.bind(this.ts),this)}Qt(){return this.ts}N(){return this.ys}Sf(){return this.fm}Am(){return this.Rm}m(){for(let t of(this.km(!1),0!==this.vm&&window.cancelAnimationFrame(this.vm),this.ts.ju().u(this),this.ts.At().pu().u(this),this.ts.do().u(this),this.ts.m(),this.fm))this.Cm.removeChild(t.Rf()),t.Tv().u(this),t.Rv().u(this),t.m();for(let t of(this.fm=[],this.pm))this.Em(t);this.pm=[],B(this.Rm).m(),null!==this.hp.parentElement&&this.hp.parentElement.removeChild(this.hp),this.Vu.m(),this.sv.m(),this.nv.m(),this.zm()}Vm(t,i,e=!1){if(this.ja===i&&this.no===t)return;let s=function(t){let i=Math.floor(t.width),e=Math.floor(t.height);return C({width:i-i%2,height:e-e%2})}(C({width:t,height:i}));this.ja=s.height,this.no=s.width;let h=this.ja+"px",r=this.no+"px";B(this.hp).style.height=h,B(this.hp).style.width=r,this.Cm.style.height=h,this.Cm.style.width=r,e?this.Lm(tM.gn(),performance.now()):this.ts.Bh()}Fp(t){void 0===t&&(t=tM.gn());for(let i=0;i<this.fm.length;i++)this.fm[i].Fp(t.en(i).tn);this.ys.timeScale.visible&&this.Rm.Fp(t.nn())}hr(t){let i=eC(this.ys);this.ts.hr(t);let e=eC(this.ys);e!==i&&this.km(e),t.layout?.panes&&this.Om(),this.Bm(),this.Nm(t)}Tv(){return this.sv}Rv(){return this.nv}ju(){return this.Vu}Wm(){null!==this.Mm&&(this.Lm(this.Mm,performance.now()),this.Mm=null);let t=this.Fm(null),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let e=B(i.getContext("2d"));return this.Fm(e),i}Hm(t){return("left"!==t||this.Um())&&("right"!==t||this.$m())&&0!==this.fm.length?B("left"===t?this.fm[0].zv():this.fm[0].Lv()).Wp():0}qm(){return this.ys.autoSize&&null!==this.xm}Af(){return this.hp}Ym(t){this.Sm=t,this.Sm?this.Af().style.setProperty("cursor",t):this.Af().style.removeProperty("cursor")}jm(){return this.Sm}Zm(t){return N(this.fm[t]).Df()}Om(){this.pm.forEach(t=>{t.Pt()})}Nm(t){(void 0!==t.autoSize||!this.xm||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.xm&&this.Dm(),!1===t.autoSize&&null!==this.xm&&this.zm(),t.autoSize||void 0===t.width&&void 0===t.height||this.Vm(t.width||this.no,t.height||this.ja))}Fm(t){let i=0,e=0,s=this.fm[0],h=(i,e)=>{let s=0;for(let h=0;h<this.fm.length;h++){let r=this.fm[h],n=B("left"===i?r.zv():r.Lv()),l=n.Vf();if(null!==t&&n.If(t,e,s),s+=l.height,h<this.fm.length-1){let i=this.pm[h],r=i.Vf();null!==t&&i.If(t,e,s),s+=r.height}}};this.Um()&&(h("left",0),i+=B(s.zv()).Vf().width);for(let s=0;s<this.fm.length;s++){let h=this.fm[s],r=h.Vf();if(null!==t&&h.If(t,i,e),e+=r.height,s<this.fm.length-1){let h=this.pm[s],r=h.Vf();null!==t&&h.If(t,i,e),e+=r.height}}i+=s.Vf().width,this.$m()&&(h("right",i),i+=B(s.Lv()).Vf().width);let r=(i,e,s)=>{B("left"===i?this.Rm.tm():this.Rm.im()).If(B(t),e,s)};if(this.ys.timeScale.visible){let i=this.Rm.Vf();if(null!==t){let h=0;this.Um()&&(r("left",h,e),h=B(s.zv()).Vf().width),this.Rm.If(t,h,e),h+=i.width,this.$m()&&r("right",h,e)}e+=i.height}return C({width:i,height:e})}Km(){var t,i,e;let s=0,h=0,r=0;for(let t of this.fm)this.Um()&&(h=Math.max(h,B(t.zv()).zp(),this.ys.leftPriceScale.minimumWidth)),this.$m()&&(r=Math.max(r,B(t.Lv()).zp(),this.ys.rightPriceScale.minimumWidth)),s+=t.fo();h=(i=h)+i%2,r=(e=r)+e%2;let n=this.no,l=this.ja,o=Math.max(n-h-r,0),a=+this.pm.length,u=this.ys.timeScale.visible,c=u?Math.max(this.Rm.rm(),this.ys.timeScale.minimumHeight):0,f=a+(c=(t=c)+t%2),d=l<f?0:l-f,p=d/s,m=0,g=window.devicePixelRatio||1;for(let t=0;t<this.fm.length;++t){let i=this.fm[t];i.vv(this.ts.$s()[t]);let e=0,s=0;e=Math.max(t===this.fm.length-1?Math.ceil((d-m)*g)/g:Math.round(i.fo()*p*g)/g,2),m+=e,i.Np(C({width:o,height:e})),this.Um()&&i.Vv(h,"left"),this.$m()&&i.Vv(r,"right"),i.Wf()&&this.ts.Zu(i.Wf(),e)}this.Rm.nm(C({width:u?o:0,height:c}),u?h:0,u?r:0),this.ts.vo(o),this.wm!==h&&(this.wm=h),this.gm!==r&&(this.gm=r)}km(t){t?this.hp.addEventListener("wheel",this.ym,{passive:!1}):this.hp.removeEventListener("wheel",this.ym)}Xm(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return eS?1/window.devicePixelRatio:1}Pm(t){if(!(0!==t.deltaX&&this.ys.handleScroll.mouseWheel||0!==t.deltaY&&this.ys.handleScale.mouseWheel))return;let i=this.Xm(t),e=i*t.deltaX/100,s=-i*t.deltaY/100;if(t.cancelable&&t.preventDefault(),0!==s&&this.ys.handleScale.mouseWheel){let i=Math.sign(s)*Math.min(1,Math.abs(s)),e=t.clientX-this.hp.getBoundingClientRect().left;this.Qt().tc(e,i)}0!==e&&this.ys.handleScroll.mouseWheel&&this.Qt().sc(-80*e)}Lm(t,i){let e=t.nn();3===e&&this.Gm(),3!==e&&2!==e||(this.Jm(t),this.Qm(t,i),this.Rm.Pt(),this.fm.forEach(t=>{t.wv()}),3===this.Mm?.nn()&&(this.Mm.vn(t),this.Gm(),this.Jm(this.Mm),this.Qm(this.Mm,i),t=this.Mm,this.Mm=null)),this.Fp(t)}Qm(t,i){for(let e of t.pn())this.mn(e,i)}Jm(t){let i=this.ts.$s();for(let e=0;e<i.length;e++)t.en(e).sn&&i[e].Ao()}mn(t,i){let e=this.ts.At();switch(t.an){case 0:e.mu();break;case 1:e.wu(t.Ft);break;case 2:e.dn(t.Ft);break;case 3:e.fn(t.Ft);break;case 4:e.eu();break;case 5:t.Ft.uu(i)||e.fn(t.Ft.cu(i))}}Bu(t){null!==this.Mm?this.Mm.vn(t):this.Mm=t,this.bm||(this.bm=!0,this.vm=window.requestAnimationFrame(t=>{if(this.bm=!1,this.vm=0,null!==this.Mm){let i=this.Mm;for(let e of(this.Mm=null,this.Lm(i,t),i.pn()))if(5===e.an&&!e.Ft.uu(t)){this.Qt()._n(e.Ft);break}}}))}Gm(){this.Im()}Em(t){this.Cm.removeChild(t.Rf()),t.m()}Im(){let t=this.ts.$s(),i=t.length,e=this.fm.length;for(let t=i;t<e;t++){let t=N(this.fm.pop());this.Cm.removeChild(t.Rf()),t.Tv().u(this),t.Rv().u(this),t.m();let i=this.pm.pop();void 0!==i&&this.Em(i)}for(let s=e;s<i;s++){let i=new eg(this,t[s]);if(i.Tv().i(this.tw.bind(this,i),this),i.Rv().i(this.iw.bind(this,i),this),this.fm.push(i),s>0){let t=new et(this,s-1,s);this.pm.push(t),this.Cm.insertBefore(t.Rf(),this.Rm.Rf())}this.Cm.insertBefore(i.Rf(),this.Rm.Rf())}for(let e=0;e<i;e++){let i=t[e],s=this.fm[e];s.Wf()!==i?s.vv(i):s.pv()}this.Bm(),this.Km()}sw(t,i,e,s){let h,r=new Map;if(null!==t&&this.ts.js().forEach(i=>{let e=i.Ks().Wr(t);null!==e&&r.set(i,e)}),null!==t){let i=this.ts.At().ss(t)?.originalTime;void 0!==i&&(h=i)}let n=this.Qt().Hu(),l=null!==n&&n.Wo instanceof is?n.Wo:void 0,o=null!==n&&void 0!==n.Fo?n.Fo.Zn:void 0,a=this.nw(s);return{ew:h,Re:t??void 0,rw:i??void 0,hw:-1!==a?a:void 0,aw:l,lw:r,ow:o,_w:e??void 0}}nw(t){let i=-1;if(t)i=this.fm.indexOf(t);else{let t=this.Qt().Yu().Us();null!==t&&(i=this.Qt().$s().indexOf(t))}return i}tw(t,i,e,s){this.sv.p(()=>this.sw(i,e,s,t))}iw(t,i,e,s){this.nv.p(()=>this.sw(i,e,s,t))}Tm(t,i,e){this.Ym(this.Qt().Hu()?.Uo??null),this.Vu.p(()=>this.sw(t,i,e))}Bm(){let t=this.ys.timeScale.visible?"":"none";this.Rm.Rf().style.display=t}Um(){return this.fm[0].Wf().Co().N().visible}$m(){return this.fm[0].Wf().yo().N().visible}Dm(){return"ResizeObserver"in window&&(this.xm=new ResizeObserver(t=>{let i=t[t.length-1];i&&this.Vm(i.contentRect.width,i.contentRect.height)}),this.xm.observe(this.op,{box:"border-box"}),!0)}zm(){null!==this.xm&&this.xm.disconnect(),this.xm=null}}function eC(t){return!!(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function eP(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.color&&(r.R=e.color),r}function eR(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.lineColor&&(r.vt=e.lineColor),void 0!==e.topColor&&(r.mr=e.topColor),void 0!==e.bottomColor&&(r.wr=e.bottomColor),r}function eO(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.topLineColor&&(r.gr=e.topLineColor),void 0!==e.bottomLineColor&&(r.Mr=e.bottomLineColor),void 0!==e.topFillColor1&&(r.br=e.topFillColor1),void 0!==e.topFillColor2&&(r.Sr=e.topFillColor2),void 0!==e.bottomFillColor1&&(r.Cr=e.bottomFillColor1),void 0!==e.bottomFillColor2&&(r.yr=e.bottomFillColor2),r}function ek(t,i,e,s){let h={Re:i,wt:t,Ft:[e.open,e.high,e.low,e.close],ew:s};return void 0!==e.color&&(h.R=e.color),h}function ez(t,i,e,s){let h={Re:i,wt:t,Ft:[e.open,e.high,e.low,e.close],ew:s};return void 0!==e.color&&(h.R=e.color),void 0!==e.borderColor&&(h.Ht=e.borderColor),void 0!==e.wickColor&&(h.vr=e.wickColor),h}function eY(t,i,e,s,h){let r=N(h)(e),n=Math.max(...r),l=Math.min(...r),o=r[r.length-1],{time:a,color:u,...c}=e;return{Re:i,wt:t,Ft:[o,n,l,o],ew:s,se:c,R:u}}function eE(t){return void 0!==t.Ft}function eT(t,i){return void 0!==i.customValues&&(t.uw=i.customValues),t}function eL(t){return(i,e,s,h,r,n)=>(n?n(s):void 0===s.open&&void 0===s.value)?eT({wt:i,Re:e,ew:h},s):eT(t(i,e,s,h,r),s)}function eV(t){return({Candlestick:eL(ez),Bar:eL(ek),Area:eL(eR),Baseline:eL(eO),Histogram:eL(eP),Line:eL(eP),Custom:eL(eY)})[t]}function eN(t){return{Re:0,cw:new Map,Hh:t}}function eB(t,i){if(void 0!==t&&0!==t.length)return{dw:i.key(t[0].wt),fw:i.key(t[t.length-1].wt)}}function eD(t){let i;return t.forEach(t=>{void 0===i&&(i=t.ew)}),N(i)}class eW{constructor(t){this.pw=new Map,this.mw=new Map,this.ww=new Map,this.gw=[],this.Yo=t}m(){this.pw.clear(),this.mw.clear(),this.ww.clear(),this.gw=[]}Mw(t,i){let e=0!==this.pw.size,s=!1,h=this.mw.get(t);if(void 0!==h)if(1===this.mw.size)e=!1,s=!0,this.pw.clear();else for(let i of this.gw)i.pointData.cw.delete(t)&&(s=!0);let r=[];if(0!==i.length){let e=i.map(t=>t.time),h=this.Yo.createConverterToInternalObj(i),n=eV(t.Rr()),l=t.da(),o=t.pa();r=i.map((i,r)=>{let a=h(i.time),u=this.Yo.key(a),c=this.pw.get(u);void 0===c&&(c=eN(a),this.pw.set(u,c),s=!0);let f=n(a,c.Re,i,e[r],l,o);return c.cw.set(t,f),f})}e&&this.bw(),this.xw(t,r);let n=-1;if(s){let t=[];this.pw.forEach(i=>{t.push({timeWeight:0,time:i.Hh,pointData:i,originalTime:eD(i.cw)})}),t.sort((t,i)=>this.Yo.key(t.time)-this.Yo.key(i.time)),n=this.Sw(t)}return this.Cw(t,n,function(t,i,e){let s=eB(t,e),h=eB(i,e);if(void 0!==s&&void 0!==h)return{yw:!1,zh:s.fw>=h.fw&&s.dw>=h.dw}}(this.mw.get(t),h,this.Yo))}vc(t){return this.Mw(t,[])}Pw(t,i,e){void 0===i.ew&&(i.ew=i.time),this.Yo.preprocessData(i);let s=this.Yo.createConverterToInternalObj([i])(i.time),h=this.ww.get(t);if(!e&&void 0!==h&&this.Yo.key(s)<this.Yo.key(h))throw Error(`Cannot update oldest data, last time=${h}, new time=${s}`);let r=this.pw.get(this.Yo.key(s));if(e&&void 0===r)throw Error("Cannot update non-existing data point when historicalUpdate is true");let n=void 0===r;void 0===r&&(r=eN(s),this.pw.set(this.Yo.key(s),r));let l=eV(t.Rr()),o=t.da(),a=t.pa(),u=l(s,r.Re,i,i.ew,o,a);r.cw.set(t,u),e?this.kw(t,u,r.Re):this.Tw(t,u);let c={zh:eE(u),yw:e};if(!n)return this.Cw(t,-1,c);let f={timeWeight:0,time:r.Hh,pointData:r,originalTime:eD(r.cw)},d=tZ(this.gw,this.Yo.key(f.time),(t,i)=>this.Yo.key(t.time)<i);this.gw.splice(d,0,f);for(let t=d;t<this.gw.length;++t)ej(this.gw[t].pointData,t);return this.Yo.fillWeightsForPoints(this.gw,d),this.Cw(t,d,c)}Tw(t,i){let e=this.mw.get(t);void 0===e&&(e=[],this.mw.set(t,e));let s=0!==e.length?e[e.length-1]:null;null===s||this.Yo.key(i.wt)>this.Yo.key(s.wt)?eE(i)&&e.push(i):eE(i)?e[e.length-1]=i:e.splice(-1,1),this.ww.set(t,i.wt)}kw(t,i,e){let s=this.mw.get(t);if(void 0===s)return;let h=tZ(s,e,(t,i)=>t.Re<i);eE(i)?s[h]=i:s.splice(h,1)}xw(t,i){0!==i.length?(this.mw.set(t,i.filter(eE)),this.ww.set(t,i[i.length-1].wt)):(this.mw.delete(t),this.ww.delete(t))}bw(){for(let t of this.gw)0===t.pointData.cw.size&&this.pw.delete(this.Yo.key(t.time))}Sw(t){let i=-1;for(let e=0;e<this.gw.length&&e<t.length;++e){let s=this.gw[e],h=t[e];if(this.Yo.key(s.time)!==this.Yo.key(h.time)){i=e;break}h.timeWeight=s.timeWeight,ej(h.pointData,e)}if(-1===i&&this.gw.length!==t.length&&(i=Math.min(this.gw.length,t.length)),-1===i)return -1;for(let e=i;e<t.length;++e)ej(t[e].pointData,e);return this.Yo.fillWeightsForPoints(t,i),this.gw=t,i}Rw(){if(0===this.mw.size)return null;let t=0;return this.mw.forEach(i=>{0!==i.length&&(t=Math.max(t,i[i.length-1].Re))}),t}Cw(t,i,e){let s={wo:new Map,At:{Y_:this.Rw()}};if(-1!==i)this.mw.forEach((i,h)=>{s.wo.set(h,{se:i,Dw:h===t?e:void 0})}),this.mw.has(t)||s.wo.set(t,{se:[],Dw:e}),s.At.Vw=this.gw,s.At.Iw=i;else{let i=this.mw.get(t);s.wo.set(t,{se:i||[],Dw:e})}return s}}function ej(t,i){t.Re=i,t.cw.forEach(t=>{t.Re=i})}function eF(t,i){return t.wt<i}function eA(t,i){return i<t.wt}function eI(t,i,e){let s=i.Uh(),h=i.bi(),r=tZ(t,s,eF),n=tH(t,h,eA);if(!e)return{from:r,to:n};let l=r,o=n;return r>0&&r<t.length&&t[r].wt>=s&&(l=r-1),n>0&&n<t.length&&t[n-1].wt<=h&&(o=n+1),{from:l,to:o}}class eQ{constructor(t,i,e){this.Bw=!0,this.Aw=!0,this.Ew=!0,this.zw=[],this.Lw=null,this.Jn=t,this.Qn=i,this.Ow=e}Pt(t){this.Bw=!0,"data"===t&&(this.Aw=!0),"options"===t&&(this.Ew=!0)}Tt(){return this.Jn.Vt()?(this.Nw(),null===this.Lw?null:this.Ww):null}Fw(){this.zw=this.zw.map(t=>({...t,...this.Jn.Rh().Dr(t.wt)}))}Hw(){this.Lw=null}Nw(){this.Aw&&(this.Uw(),this.Aw=!1),this.Ew&&(this.Fw(),this.Ew=!1),this.Bw&&(this.$w(),this.Bw=!1)}$w(){let t=this.Jn.Wt(),i=this.Qn.At();if(this.Hw(),i.Zi()||t.Zi())return;let e=i.ye();if(null===e||0===this.Jn.Ks().zr())return;let s=this.Jn.zt();null!==s&&(this.Lw=eI(this.zw,e,this.Ow),this.qw(t,i,s.Ft),this.Yw())}}class eJ{constructor(t,i){this.jw=t,this.Yi=i}nt(t,i,e){this.jw.draw(t,this.Yi,i,e)}}class e$ extends eQ{constructor(t,i,e){super(t,i,!1),this.sh=e,this.Ww=new eJ(this.sh.renderer(),i=>{let e=t.zt();return null===e?null:t.Wt().Nt(i,e.Ft)})}fa(t){return this.sh.priceValueBuilder(t)}va(t){return this.sh.isWhitespace(t)}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>({wt:i.Re,_t:NaN,...t.Dr(i.Re),Zw:i.se}))}qw(t,i){i.j_(this.zw,U(this.Lw))}Yw(){this.sh.update({bars:this.zw.map(eU),barSpacing:this.Qn.At().Q_(),visibleRange:this.Lw},this.Jn.N())}}function eU(t){return{x:t._t,time:t.wt,originalData:t.Zw,barColor:t.cr}}let eZ={color:"#2196f3"},eH=(t,i,e)=>new e$(t,i,D(e));function eG(t){let i={value:t.Ft[3],time:t.ew};return void 0!==t.uw&&(i.customValues=t.uw),i}function eK(t){let i=eG(t);return void 0!==t.R&&(i.color=t.R),i}function eX(t){let i=eG(t);return void 0!==t.vt&&(i.lineColor=t.vt),void 0!==t.mr&&(i.topColor=t.mr),void 0!==t.wr&&(i.bottomColor=t.wr),i}function eq(t){let i=eG(t);return void 0!==t.gr&&(i.topLineColor=t.gr),void 0!==t.Mr&&(i.bottomLineColor=t.Mr),void 0!==t.br&&(i.topFillColor1=t.br),void 0!==t.Sr&&(i.topFillColor2=t.Sr),void 0!==t.Cr&&(i.bottomFillColor1=t.Cr),void 0!==t.yr&&(i.bottomFillColor2=t.yr),i}function e0(t){let i={open:t.Ft[0],high:t.Ft[1],low:t.Ft[2],close:t.Ft[3],time:t.ew};return void 0!==t.uw&&(i.customValues=t.uw),i}function e1(t){let i=e0(t);return void 0!==t.R&&(i.color=t.R),i}function e2(t){let i=e0(t),{R:e,Ht:s,vr:h}=t;return void 0!==e&&(i.color=e),void 0!==s&&(i.borderColor=s),void 0!==h&&(i.wickColor=h),i}function e3(t){return({Area:eX,Line:eK,Baseline:eq,Histogram:eK,Bar:e1,Candlestick:e2,Custom:e5})[t]}function e5(t){let i=t.ew;return{...t.se,time:i}}let e6={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},e4={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},e9={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Z,panes:{enableResize:!0,separatorColor:"#E0E3EB",separatorHoverColor:"rgba(178, 181, 189, 0.2)"},attributionLogo:!0,colorSpace:"srgb",colorParsers:[]},e8={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0},e7={rightOffset:0,barSpacing:6,minBarSpacing:.5,maxBarSpacing:0,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0,ignoreWhitespaceIndices:!1};function st(){return{width:0,height:0,autoSize:!1,layout:e9,crosshair:e6,grid:e4,overlayPriceScales:{...e8},leftPriceScale:{...e8,visible:!1},rightPriceScale:{...e8,visible:!0},timeScale:e7,localization:{locale:i1?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class si{constructor(t,i,e){this.bf=t,this.Kw=i,this.Xw=e??0}applyOptions(t){this.bf.Qt().$u(this.Kw,t,this.Xw)}options(){return this.Yi().N()}width(){return tw(this.Kw)?this.bf.Hm(this.Kw):0}Yi(){return B(this.bf.Qt().qu(this.Kw,this.Xw)).Wt}}class se{constructor(t,i,e,s){this.bf=t,this.yt=e,this.Gw=i,this.Jw=s}getHeight(){return this.yt.$t()}setHeight(t){let i=this.bf.Qt(),e=i.Cc(this.yt);i.Xu(e,t)}paneIndex(){return this.bf.Qt().Cc(this.yt)}moveTo(t){let i=this.paneIndex();i!==t&&(V(t>=0&&t<this.bf.Sf().length,"Invalid pane index"),this.bf.Qt().Gu(i,t))}getSeries(){return this.yt.wo().map(t=>this.Gw(t))??[]}getHTMLElement(){return this.bf.Sf()[this.paneIndex()].Rf()}attachPrimitive(t){this.yt.ua(t),t.attached&&t.attached({chart:this.Jw,requestUpdate:()=>this.yt.Qt().Bh()})}detachPrimitive(t){this.yt.ca(t)}priceScale(t){if(null===this.yt.co(t))throw Error(`Cannot find price scale with id: ${t}`);return new si(this.bf,t,this.paneIndex())}}let ss={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class sh{constructor(t){this.ir=t}applyOptions(t){this.ir.hr(t)}options(){return this.ir.N()}Qw(){return this.ir}}class sr{constructor(t,i,e,s,h,r){this.tg=new W,this.Jn=t,this.ig=i,this.sg=e,this.Yo=h,this.Jw=s,this.ng=r}m(){this.tg.m()}priceFormatter(){return this.Jn.ra()}priceToCoordinate(t){let i=this.Jn.zt();return null===i?null:this.Jn.Wt().Nt(t,i.Ft)}coordinateToPrice(t){let i=this.Jn.zt();return null===i?null:this.Jn.Wt().Ts(t,i.Ft)}barsInLogicalRange(t){if(null===t)return null;let i=new iN(new iT(t.from,t.to)).o_(),e=this.Jn.Ks();if(e.Zi())return null;let s=e.Wr(i.Uh(),1),h=e.Wr(i.bi(),-1),r=B(e.Lr()),n=B(e.Zs());if(null!==s&&null!==h&&s.Re>h.Re)return{barsBefore:t.from-r,barsAfter:n-t.to};let l={barsBefore:null===s||s.Re===r?t.from-r:s.Re-r,barsAfter:null===h||h.Re===n?n-t.to:n-h.Re};return null!==s&&null!==h&&(l.from=s.ew,l.to=h.ew),l}setData(t){this.Yo,this.Jn.Rr(),this.ig.eg(this.Jn,t),this.rg("full")}update(t,i=!1){this.Jn.Rr(),this.ig.hg(this.Jn,t,i),this.rg("update")}dataByIndex(t,i){let e=this.Jn.Ks().Wr(t,i);return null===e?null:e3(this.seriesType())(e)}data(){let t=e3(this.seriesType());return this.Jn.Ks().Hr().map(i=>t(i))}subscribeDataChanged(t){this.tg.i(t)}unsubscribeDataChanged(t){this.tg._(t)}applyOptions(t){this.Jn.hr(t)}options(){return J(this.Jn.N())}priceScale(){return this.sg.priceScale(this.Jn.Wt().wa(),this.getPane().paneIndex())}createPriceLine(t){let i=j(J(ss),t);return new sh(this.Jn.Oh(i))}removePriceLine(t){this.Jn.Nh(t.Qw())}priceLines(){return this.Jn.Wh().map(t=>new sh(t))}seriesType(){return this.Jn.Rr()}attachPrimitive(t){this.Jn.ua(t),t.attached&&t.attached({chart:this.Jw,series:this,requestUpdate:()=>this.Jn.Qt().Bh(),horzScaleBehavior:this.Yo})}detachPrimitive(t){this.Jn.ca(t),t.detached&&t.detached(),this.Jn.Qt().Bh()}getPane(){let t=this.Jn,i=B(this.Jn.Qt().Hn(t));return this.ng(i)}moveToPane(t){this.Jn.Qt().Mc(this.Jn,t)}rg(t){this.tg.v()&&this.tg.p(t)}}class sn{constructor(t,i,e){this.ag=new W,this.g_=new W,this.Kv=new W,this.ts=t,this.uh=t.At(),this.Rm=i,this.uh.du().i(this.lg.bind(this)),this.uh.fu().i(this.og.bind(this)),this.Rm.sm().i(this._g.bind(this)),this.Yo=e}m(){this.uh.du().u(this),this.uh.fu().u(this),this.Rm.sm().u(this),this.ag.m(),this.g_.m(),this.Kv.m()}scrollPosition(){return this.uh.iu()}scrollToPosition(t,i){i?this.uh._u(t,1e3):this.ts.fn(t)}scrollToRealTime(){this.uh.ou()}getVisibleRange(){let t=this.uh.O_();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){let i={from:this.Yo.convertHorzItemToInternal(t.from),to:this.Yo.convertHorzItemToInternal(t.to)},e=this.uh.H_(i);this.ts.wc(e)}getVisibleLogicalRange(){let t=this.uh.L_();return null===t?null:{from:t.Uh(),to:t.bi()}}setVisibleLogicalRange(t){V(t.from<=t.to,"The from index cannot be after the to index."),this.ts.wc(t)}resetTimeScale(){this.ts.cn()}fitContent(){this.ts.mu()}logicalToCoordinate(t){let i=this.ts.At();return i.Zi()?null:i.qt(t)}coordinateToLogical(t){return this.uh.Zi()?null:this.uh.Z_(t)}timeToIndex(t,i){let e=this.Yo.convertHorzItemToInternal(t);return this.uh.A_(e,i)}timeToCoordinate(t){let i=this.timeToIndex(t,!1);return null===i?null:this.uh.qt(i)}coordinateToTime(t){let i=this.ts.At(),e=i.Z_(t),s=i.ss(e);return null===s?null:s.originalTime}width(){return this.Rm.Df().width}height(){return this.Rm.Df().height}subscribeVisibleTimeRangeChange(t){this.ag.i(t)}unsubscribeVisibleTimeRangeChange(t){this.ag._(t)}subscribeVisibleLogicalRangeChange(t){this.g_.i(t)}unsubscribeVisibleLogicalRangeChange(t){this.g_._(t)}subscribeSizeChange(t){this.Kv.i(t)}unsubscribeSizeChange(t){this.Kv._(t)}applyOptions(t){this.uh.hr(t)}options(){return{...J(this.uh.N()),barSpacing:this.uh.Q_()}}lg(){this.ag.v()&&this.ag.p(this.getVisibleRange())}og(){this.g_.v()&&this.g_.p(this.getVisibleLogicalRange())}_g(t){this.Kv.p(t.width,t.height)}}function sl(t){return function(t){if(Q(t.handleScale)){let i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(void 0!==t.handleScale){let{axisPressedMouseMove:i,axisDoubleClickReset:e}=t.handleScale;Q(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),Q(e)&&(t.handleScale.axisDoubleClickReset={time:e,price:e})}let i=t.handleScroll;Q(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i})}(t),t}class so{constructor(t,i,e){this.ug=new Map,this.cg=new Map,this.dg=new W,this.fg=new W,this.pg=new W,this.ku=new WeakMap,this.vg=new eW(i);let s=void 0===e?J(st()):j(J(st()),sl(e));this.mg=i,this.bf=new ex(t,s,i),this.bf.Tv().i(t=>{this.dg.v()&&this.dg.p(this.wg(t()))},this),this.bf.Rv().i(t=>{this.fg.v()&&this.fg.p(this.wg(t()))},this),this.bf.ju().i(t=>{this.pg.v()&&this.pg.p(this.wg(t()))},this);let h=this.bf.Qt();this.gg=new sn(h,this.bf.Am(),this.mg)}remove(){this.bf.Tv().u(this),this.bf.Rv().u(this),this.bf.ju().u(this),this.gg.m(),this.bf.m(),this.ug.clear(),this.cg.clear(),this.dg.m(),this.fg.m(),this.pg.m(),this.vg.m()}resize(t,i,e){this.autoSizeActive()||this.bf.Vm(t,i,e)}addCustomSeries(t,i={},e=0){let s,h=(s=D(t),{type:"Custom",isBuiltIn:!1,defaultOptions:{...eZ,...s.defaultOptions()},Mg:eH,bg:s});return this.xg(h,i,e)}addSeries(t,i={},e=0){return this.xg(t,i,e)}removeSeries(t){let i=N(this.ug.get(t)),e=this.vg.vc(i);this.bf.Qt().vc(i),this.Sg(e),this.ug.delete(t),this.cg.delete(i)}eg(t,i){this.Sg(this.vg.Mw(t,i))}hg(t,i,e){this.Sg(this.vg.Pw(t,i,e))}subscribeClick(t){this.dg.i(t)}unsubscribeClick(t){this.dg._(t)}subscribeCrosshairMove(t){this.pg.i(t)}unsubscribeCrosshairMove(t){this.pg._(t)}subscribeDblClick(t){this.fg.i(t)}unsubscribeDblClick(t){this.fg._(t)}priceScale(t,i=0){return new si(this.bf,t,i)}timeScale(){return this.gg}applyOptions(t){this.bf.hr(sl(t))}options(){return this.bf.N()}takeScreenshot(){return this.bf.Wm()}removePane(t){this.bf.Qt().Ku(t)}swapPanes(t,i){this.bf.Qt().Gu(t,i)}autoSizeActive(){return this.bf.qm()}chartElement(){return this.bf.Af()}panes(){return this.bf.Qt().$s().map(t=>this.Cg(t))}paneSize(t=0){let i=this.bf.Zm(t);return{height:i.height,width:i.width}}setCrosshairPosition(t,i,e){let s=this.ug.get(e);if(void 0===s)return;let h=this.bf.Qt().Hn(s);null!==h&&this.bf.Qt().oc(t,i,h)}clearCrosshairPosition(){this.bf.Qt()._c(!0)}horzBehaviour(){return this.mg}xg(t,i={},e=0){var s;V(void 0!==t.Mg),void 0!==(s=i.priceFormat)&&"custom"!==s.type&&void 0!==s.minMove&&void 0===s.precision&&(s.precision=function(t){if(t>=1)return 0;let i=0;for(;i<8&&!(1e-8>Math.abs(Math.round(t)-t));i++)t*=10;return i}(s.minMove)),"Candlestick"===t.type&&(void 0!==i.borderColor&&(i.borderUpColor=i.borderColor,i.borderDownColor=i.borderColor),void 0!==i.wickColor&&(i.wickUpColor=i.wickColor,i.wickDownColor=i.wickColor));let h=j(J(E),J(t.defaultOptions),i),r=t.Mg,n=new is(this.bf.Qt(),t.type,h,r,t.bg);this.bf.Qt().dc(n,e);let l=new sr(n,this,this,this,this.mg,t=>this.Cg(t));return this.ug.set(l,n),this.cg.set(n,l),l}Sg(t){let i=this.bf.Qt();i.uc(t.At.Y_,t.At.Vw,t.At.Iw),t.wo.forEach((t,i)=>i.ht(t.se,t.Dw)),i.At().R_(),i.J_()}yg(t){return N(this.cg.get(t))}wg(t){let i=new Map;t.lw.forEach((t,e)=>{let s=e.Rr(),h=e3(s)(t);if("Custom"!==s){var r;V(void 0!==(r=h).open||void 0!==r.value)}else{let t=e.pa();V(!t||!1===t(h))}i.set(this.yg(e),h)});let e=void 0!==t.aw&&this.cg.has(t.aw)?this.yg(t.aw):void 0;return{time:t.ew,logical:t.Re,point:t.rw,paneIndex:t.hw,hoveredSeries:e,hoveredObjectId:t.ow,seriesData:i,sourceEvent:t._w}}Cg(t){let i=this.ku.get(t);return i||(i=new se(this.bf,t=>this.yg(t),t,this),this.ku.set(t,i)),i}}class sa extends eQ{constructor(t,i){super(t,i,!0)}qw(t,i,e){i.j_(this.zw,U(this.Lw)),t.Dl(this.zw,e,U(this.Lw))}Pg(t,i){return{wt:t,gt:i,_t:NaN,ut:NaN}}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>{let e=i.Ft[3];return this.kg(i.Re,e,t)})}}function su(t,i,e,s,h,r,n){if(0===i.length||s.from>=i.length||s.to<=0)return;let{context:l,horizontalPixelRatio:o,verticalPixelRatio:a}=t,u=i[s.from],c=r(t,u),f=u;if(s.to-s.from<2){let i=h/2;l.beginPath();let e={_t:u._t-i,ut:u.ut},s={_t:u._t+i,ut:u.ut};l.moveTo(e._t*o,e.ut*a),l.lineTo(s._t*o,s.ut*a),n(t,c,e,s)}else{let h=(i,e)=>{n(t,c,f,e),l.beginPath(),c=i,f=e},d=f;l.beginPath(),l.moveTo(u._t*o,u.ut*a);for(let n=s.from+1;n<s.to;++n){let s=r(t,d=i[n]);switch(e){case 0:l.lineTo(d._t*o,d.ut*a);break;case 1:l.lineTo(d._t*o,i[n-1].ut*a),s!==c&&(h(s,d),l.lineTo(d._t*o,i[n-1].ut*a)),l.lineTo(d._t*o,d.ut*a);break;case 2:{let[t,e]=function(t,i,e){var s,h;let r=Math.max(0,i-1),n=Math.min(t.length-1,e+1);return[(s=t[i],h=sf(sc(t[e],t[r]),6),{_t:s._t+h._t,ut:s.ut+h.ut}),sc(t[e],sf(sc(t[n],t[i]),6))]}(i,n-1,n);l.bezierCurveTo(t._t*o,t.ut*a,e._t*o,e.ut*a,d._t*o,d.ut*a)}}1!==e&&s!==c&&(h(s,d),l.moveTo(d._t*o,d.ut*a))}(f!==d||f===d&&1===e)&&n(t,c,f,d)}}function sc(t,i){return{_t:t._t-i._t,ut:t.ut-i.ut}}function sf(t,i){return{_t:t._t/i,ut:t.ut/i}}function sd(t,i){let e=t.context;e.strokeStyle=i,e.stroke()}class sp extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et(t){if(null===this.rt)return;let{ot:i,lt:e,Tg:s,Rg:h,ct:r,Kt:n,Dg:l}=this.rt;if(null===e)return;let o=t.context;o.lineCap="butt",o.lineWidth=r*t.verticalPixelRatio,T(o,n),o.lineJoin="round";let a=this.Vg.bind(this);void 0!==h&&su(t,i,h,e,s,a,sd),l&&function(t,i,e,s,h){if(s.to-s.from<=0)return;let{horizontalPixelRatio:r,verticalPixelRatio:n,context:l}=t,o=null,a=Math.max(1,Math.floor(r))%2/2,u=e*n+a;for(let e=s.to-1;e>=s.from;--e){let s=i[e];if(s){let i=h(t,s);i!==o&&(l.beginPath(),null!==o&&l.fill(),l.fillStyle=i,o=i);let e=Math.round(s._t*r)+a,c=s.ut*n;l.moveTo(e,c),l.arc(e,c,u,0,2*Math.PI)}}l.fill()}(t,i,l,e,a)}}class sm extends sp{Vg(t,i){return i.vt}}class sg extends sa{constructor(){super(...arguments),this.Ww=new sm}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t=this.Jn.N(),i={ot:this.zw,Kt:t.lineStyle,Rg:t.lineVisible?t.lineType:void 0,ct:t.lineWidth,Dg:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,lt:this.Lw,Tg:this.Qn.At().Q_()};this.Ww.ht(i)}}function sv(t,i,e,s,h){let{context:r,horizontalPixelRatio:n,verticalPixelRatio:l}=i;r.lineTo(h._t*n,t*l),r.lineTo(s._t*n,t*l),r.closePath(),r.fillStyle=e,r.fill()}class sb extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et(t){if(null===this.rt)return;let{ot:i,lt:e,Tg:s,ct:h,Kt:r,Rg:n}=this.rt,l=this.rt.Og??(this.rt.Ng?0:t.mediaSize.height);if(null===e)return;let o=t.context;o.lineCap="butt",o.lineJoin="round",o.lineWidth=h,T(o,r),o.lineWidth=1,su(t,i,n,e,s,this.Wg.bind(this),sv.bind(null,l))}}class sy{Fg(t,i){let e=this.Hg,{Ug:s,$g:h,qg:r,Yg:n,Og:l,jg:o,Zg:a}=i;if(void 0===this.Kg||void 0===e||e.Ug!==s||e.$g!==h||e.qg!==r||e.Yg!==n||e.Og!==l||e.jg!==o||e.Zg!==a){let{verticalPixelRatio:e}=t,u=l||o>0?e:1,c=o*u,f=a===t.bitmapSize.height?a:a*u,d=t.context.createLinearGradient(0,c,0,f);if(d.addColorStop(0,s),null!=l){let t=iw(((l??0)*u-c)/(f-c),0,1);d.addColorStop(t,h),d.addColorStop(t,r)}d.addColorStop(1,n),this.Kg=d,this.Hg=i}return this.Kg}}class sw extends sb{constructor(){super(...arguments),this.Xg=new sy}Wg(t,i){let e=this.rt;return this.Xg.Fg(t,{Ug:i.br,$g:i.Sr,qg:i.Cr,Yg:i.yr,Og:e.Og,jg:e.jg??0,Zg:e.Zg??t.bitmapSize.height})}}class sM extends sp{constructor(){super(...arguments),this.Gg=new sy}Vg(t,i){let e=this.rt;return this.Gg.Fg(t,{Ug:i.gr,$g:i.gr,qg:i.Mr,Yg:i.Mr,Og:e.Og,jg:e.jg??0,Zg:e.Zg??t.bitmapSize.height})}}class s_ extends sa{constructor(t,i){super(t,i),this.Ww=new tt,this.Jg=new sw,this.Qg=new sM,this.Ww.st([this.Jg,this.Qg])}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t,i,e=this.Jn.zt();if(null===e)return;let s=this.Jn.N(),h=this.Jn.Wt().Nt(s.baseValue.price,e.Ft),r=this.Qn.At().Q_();if(null!==this.Lw&&0!==this.zw.length){if(s.relativeGradient){t=this.zw[this.Lw.from].ut,i=this.zw[this.Lw.from].ut;for(let e=this.Lw.from;e<this.Lw.to;e++){let s=this.zw[e];s.ut<t&&(t=s.ut),s.ut>i&&(i=s.ut)}}this.Jg.ht({ot:this.zw,ct:s.lineWidth,Kt:s.lineStyle,Rg:s.lineType,Og:h,jg:t,Zg:i,Ng:!1,lt:this.Lw,Tg:r}),this.Qg.ht({ot:this.zw,ct:s.lineWidth,Kt:s.lineStyle,Rg:s.lineVisible?s.lineType:void 0,Dg:s.pointMarkersVisible?s.pointMarkersRadius||s.lineWidth/2+2:void 0,Og:h,jg:t,Zg:i,lt:this.Lw,Tg:r})}}}class sS extends sb{constructor(){super(...arguments),this.Xg=new sy}Wg(t,i){return this.Xg.Fg(t,{Ug:i.mr,$g:"",qg:"",Yg:i.wr,jg:this.rt?.jg??0,Zg:t.bitmapSize.height})}}class sx extends sa{constructor(t,i){super(t,i),this.Ww=new tt,this.tM=new sS,this.iM=new sm,this.Ww.st([this.tM,this.iM])}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t,i=this.Jn.N();if(null!==this.Lw&&0!==this.zw.length){if(i.relativeGradient){t=this.zw[this.Lw.from].ut;for(let i=this.Lw.from;i<this.Lw.to;i++){let e=this.zw[i];e.ut<t&&(t=e.ut)}}this.tM.ht({Rg:i.lineType,ot:this.zw,Kt:i.lineStyle,ct:i.lineWidth,Og:null,jg:t,Ng:i.invertFilledArea,lt:this.Lw,Tg:this.Qn.At().Q_()}),this.iM.ht({Rg:i.lineVisible?i.lineType:void 0,ot:this.zw,Kt:i.lineStyle,ct:i.lineWidth,lt:this.Lw,Tg:this.Qn.At().Q_(),Dg:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0})}}}class sC extends ti{constructor(){super(...arguments),this.Yt=null,this.sM=0,this.nM=0}ht(t){this.Yt=t}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.Yt||0===this.Yt.Ks.length||null===this.Yt.lt)return;this.sM=this.eM(i),this.sM>=2&&Math.max(1,Math.floor(i))%2!=this.sM%2&&this.sM--,this.nM=this.Yt.rM?Math.min(this.sM,Math.floor(i)):this.sM;let s=null,h=this.nM<=this.sM&&this.Yt.Q_>=Math.floor(1.5*i);for(let r=this.Yt.lt.from;r<this.Yt.lt.to;++r){let n=this.Yt.Ks[r];s!==n.cr&&(t.fillStyle=n.cr,s=n.cr);let l=Math.floor(.5*this.nM),o=Math.round(n._t*i),a=o-l,u=this.nM,c=a+u-1,f=Math.min(n.Al,n.El),d=Math.max(n.Al,n.El),p=Math.round(f*e)-l,m=Math.max(Math.round(d*e)+l-p,this.nM);t.fillRect(a,p,u,m);let g=Math.ceil(1.5*this.sM);if(h){if(this.Yt.hM){let i=o-g,s=Math.max(p,Math.round(n.Bl*e)-l),h=s+u-1;h>p+m-1&&(s=(h=p+m-1)-u+1),t.fillRect(i,s,a-i,h-s+1)}let i=o+g,s=Math.max(p,Math.round(n.zl*e)-l),h=s+u-1;h>p+m-1&&(s=(h=p+m-1)-u+1),t.fillRect(c+1,s,i-c,h-s+1)}}}eM(t){return Math.max(Math.floor(t),Math.floor(Math.floor(.3*B(this.Yt).Q_*t)))}}class sP extends eQ{constructor(t,i){super(t,i,!1)}qw(t,i,e){i.j_(this.zw,U(this.Lw)),t.Il(this.zw,e,U(this.Lw))}aM(t,i,e){return{wt:t,qh:i.Ft[0],Yh:i.Ft[1],jh:i.Ft[2],Zh:i.Ft[3],_t:NaN,Bl:NaN,Al:NaN,El:NaN,zl:NaN}}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>this.kg(i.Re,i,t))}}class sR extends sP{constructor(){super(...arguments),this.Ww=new sC}kg(t,i,e){return{...this.aM(t,i,e),...e.Dr(t)}}Yw(){let t=this.Jn.N();this.Ww.ht({Ks:this.zw,Q_:this.Qn.At().Q_(),hM:t.openVisible,rM:t.thinBars,lt:this.Lw})}}class sO extends ti{constructor(){super(...arguments),this.Yt=null,this.sM=0}ht(t){this.Yt=t}et(t){if(null===this.Yt||0===this.Yt.Ks.length||null===this.Yt.lt)return;let{horizontalPixelRatio:i}=t;this.sM=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);let e=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.min(Math.floor(t*e*i),Math.floor(t*i));return Math.max(Math.floor(i),s)}(this.Yt.Q_,i),this.sM>=2&&Math.floor(i)%2!=this.sM%2&&this.sM--;let e=this.Yt.Ks;this.Yt.lM&&this.oM(t,e,this.Yt.lt),this.Yt.Mi&&this.$p(t,e,this.Yt.lt);let s=this._M(i);(!this.Yt.Mi||this.sM>2*s)&&this.uM(t,e,this.Yt.lt)}oM(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=Math.min(Math.floor(h),Math.floor(this.Yt.Q_*h)),o=Math.floor(.5*(l=Math.max(Math.floor(h),Math.min(l,this.sM)))),a=null;for(let t=e.from;t<e.to;t++){let e=i[t];e.pr!==n&&(s.fillStyle=e.pr,n=e.pr);let u=Math.round(Math.min(e.Bl,e.zl)*r),c=Math.round(Math.max(e.Bl,e.zl)*r),f=Math.round(e.Al*r),d=Math.round(e.El*r),p=Math.round(h*e._t)-o,m=p+l-1;null!==a&&(p=Math.min(p=Math.max(a+1,p),m));let g=m-p+1;s.fillRect(p,f,g,u-f),s.fillRect(p,c+1,g,d-c),a=m}}_M(t){let i=Math.floor(+t);this.sM<=2*i&&(i=Math.floor(.5*(this.sM-1)));let e=Math.max(Math.floor(t),i);return this.sM<=2*e?Math.max(Math.floor(t),Math.floor(+t)):e}$p(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=this._M(h),o=null;for(let t=e.from;t<e.to;t++){let e=i[t];e.dr!==n&&(s.fillStyle=e.dr,n=e.dr);let f=Math.round(e._t*h)-Math.floor(.5*this.sM),d=f+this.sM-1,p=Math.round(Math.min(e.Bl,e.zl)*r),m=Math.round(Math.max(e.Bl,e.zl)*r);if(null!==o&&(f=Math.min(f=Math.max(o+1,f),d)),this.Yt.Q_*h>2*l){var a,u,c;a=f,u=d-f+1,c=m-p+1,s.fillRect(a+l,p,u-2*l,l),s.fillRect(a+l,p+c-l,u-2*l,l),s.fillRect(a,p,l,c),s.fillRect(a+u-l,p,l,c)}else{let t=d-f+1;s.fillRect(f,p,t,m-p+1)}o=d}}uM(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=this._M(h);for(let t=e.from;t<e.to;t++){let e=i[t],o=Math.round(Math.min(e.Bl,e.zl)*r),a=Math.round(Math.max(e.Bl,e.zl)*r),u=Math.round(e._t*h)-Math.floor(.5*this.sM),c=u+this.sM-1;if(e.cr!==n){let t=e.cr;s.fillStyle=t,n=t}this.Yt.Mi&&(u+=l,o+=l,c-=l,a-=l),o>a||s.fillRect(u,o,c-u+1,a-o+1)}}}class sk extends sP{constructor(){super(...arguments),this.Ww=new sO}kg(t,i,e){return{...this.aM(t,i,e),...e.Dr(t)}}Yw(){let t=this.Jn.N();this.Ww.ht({Ks:this.zw,Q_:this.Qn.At().Q_(),lM:t.wickVisible,Mi:t.borderVisible,lt:this.Lw})}}class sz extends ti{constructor(){super(...arguments),this.Yt=null,this.cM=[]}ht(t){this.Yt=t,this.cM=[]}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.Yt||0===this.Yt.ot.length||null===this.Yt.lt)return;this.cM.length||this.dM(i);let s=Math.max(1,Math.floor(e)),h=Math.round(this.Yt.fM*e)-Math.floor(s/2),r=h+s;for(let i=this.Yt.lt.from;i<this.Yt.lt.to;i++){let n,l,o=this.Yt.ot[i],a=this.cM[i-this.Yt.lt.from],u=Math.round(o.ut*e);t.fillStyle=o.cr,u<=h?(n=u,l=r):(n=h,l=u-Math.floor(s/2)+s),t.fillRect(a.Uh,n,a.bi-a.Uh+1,l-n)}}dM(t){if(null===this.Yt||0===this.Yt.ot.length||null===this.Yt.lt)return void(this.cM=[]);let i=1>=Math.ceil(this.Yt.Q_*t)?0:Math.max(1,Math.floor(t)),e=Math.round(this.Yt.Q_*t)-i;this.cM=Array(this.Yt.lt.to-this.Yt.lt.from);for(let i=this.Yt.lt.from;i<this.Yt.lt.to;i++){let s,h,r=this.Yt.ot[i],n=Math.round(r._t*t);if(e%2){let t=(e-1)/2;s=n-t,h=n+t}else{let t=e/2;s=n-t,h=n+t-1}this.cM[i-this.Yt.lt.from]={Uh:s,bi:h,pM:n,ne:r._t*t,wt:r.wt}}for(let t=this.Yt.lt.from+1;t<this.Yt.lt.to;t++){let e=this.cM[t-this.Yt.lt.from],s=this.cM[t-this.Yt.lt.from-1];e.wt===s.wt+1&&e.Uh-s.bi!==i+1&&(s.pM>s.ne?s.bi=e.Uh-i-1:e.Uh=s.bi+i+1)}let s=Math.ceil(this.Yt.Q_*t);for(let t=this.Yt.lt.from;t<this.Yt.lt.to;t++){let i=this.cM[t-this.Yt.lt.from];i.bi<i.Uh&&(i.bi=i.Uh),s=Math.min(i.bi-i.Uh+1,s)}if(i>0&&s<4)for(let t=this.Yt.lt.from;t<this.Yt.lt.to;t++){let i=this.cM[t-this.Yt.lt.from];i.bi-i.Uh+1>s&&(i.pM>i.ne?i.bi-=1:i.Uh+=1)}}}class sY extends sa{constructor(){super(...arguments),this.Ww=new sz}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t={ot:this.zw,Q_:this.Qn.At().Q_(),lt:this.Lw,fM:this.Jn.Wt().Nt(this.Jn.N().base,B(this.Jn.zt()).Ft)};this.Ww.ht(t)}}class sE{constructor(t,i){this.yt=t,this.vM=i,this.mM()}detach(){this.yt.detachPrimitive(this.vM)}getPane(){return this.yt}applyOptions(t){this.vM.hr?.(t)}mM(){this.yt.attachPrimitive(this.vM)}}let sT={visible:!0,horzAlign:"center",vertAlign:"center",lines:[]},sL={color:"rgba(0, 0, 0, 0.5)",fontSize:48,fontFamily:Z,fontStyle:"",text:""};class sV{constructor(t){this.wM=new Map,this.Yt=t}draw(t){t.useMediaCoordinateSpace(t=>{if(!this.Yt.visible)return;let{context:i,mediaSize:e}=t,s=0;for(let t of this.Yt.lines){if(0===t.text.length)continue;i.font=t.k;let h=this.gM(i,t.text);h>e.width?t.hu=e.width/h:t.hu=1,s+=t.lineHeight*t.hu}let h=0;switch(this.Yt.vertAlign){case"top":h=0;break;case"center":h=Math.max((e.height-s)/2,0);break;case"bottom":h=Math.max(e.height-s,0)}for(let t of this.Yt.lines){i.save(),i.fillStyle=t.color;let s=0;switch(this.Yt.horzAlign){case"left":i.textAlign="left",s=t.lineHeight/2;break;case"center":i.textAlign="center",s=e.width/2;break;case"right":i.textAlign="right",s=e.width-1-t.lineHeight/2}i.translate(s,h),i.textBaseline="top",i.font=t.k,i.scale(t.hu,t.hu),i.fillText(t.text,0,t.MM),i.restore(),h+=t.lineHeight*t.hu}})}gM(t,i){let e=this.bM(t.font),s=e.get(i);return void 0===s&&(s=t.measureText(i).width,e.set(i,s)),s}bM(t){let i=this.wM.get(t);return void 0===i&&(i=new Map,this.wM.set(t,i)),i}}class sN{constructor(t){this.ys=sD(t)}Pt(t){this.ys=sD(t)}renderer(){return new sV(this.ys)}}function sB(t){return{...t,k:H(t.fontSize,t.fontFamily,t.fontStyle),lineHeight:t.lineHeight||1.2*t.fontSize,MM:0,hu:0}}function sD(t){return{...t,lines:t.lines.map(sB)}}function sW(t){return{...sL,...t}}function sj(t){return{...sT,...t,lines:t.lines?.map(sW)??[]}}class sF{constructor(t){this.ys=sj(t),this.xM=[new sN(this.ys)]}updateAllViews(){this.xM.forEach(t=>t.Pt(this.ys))}paneViews(){return this.xM}attached({requestUpdate:t}){this.SM=t}detached(){this.SM=void 0}hr(t){this.ys=sj({...this.ys,...t}),this.SM&&this.SM()}}let sA={alpha:1,padding:0};class sI{constructor(t){this.Yt=t}draw(t){t.useMediaCoordinateSpace(t=>{let i=t.context,e=this.CM(this.Yt,t.mediaSize);e&&this.Yt.yM&&(i.globalAlpha=this.Yt.alpha??1,i.drawImage(this.Yt.yM,e._t,e.ut,e.Qi,e.$t))})}CM(t,i){let{maxHeight:e,maxWidth:s,PM:h,kM:r,padding:n}=t,l=Math.round(i.width/2),o=Math.round(i.height/2),a=n??0,u=i.width-2*a,c=i.height-2*a;e&&(c=Math.min(c,e)),s&&(u=Math.min(u,s));let f=Math.min(u/r,c/h),d=r*f,p=h*f;return{_t:l-.5*d,ut:o-.5*p,$t:p,Qi:d}}}class sQ{constructor(t){this.TM=null,this.RM=0,this.DM=0,this.ys=t,this.M=sJ(this.ys,this.TM,this.RM,this.DM)}VM(t){void 0!==t.IM&&(this.RM=t.IM),void 0!==t.BM&&(this.DM=t.BM),void 0!==t.AM&&(this.TM=t.AM),this.Pt()}EM(t){this.ys=t,this.Pt()}zOrder(){return"bottom"}Pt(){this.M=sJ(this.ys,this.TM,this.RM,this.DM)}renderer(){return new sI(this.M)}}function sJ(t,i,e,s){return{...t,yM:i,kM:e,PM:s}}class s${constructor(t,i){this.zM=null,this.LM=t,this.ys={...sA,...i},this.xM=[new sQ(this.ys)]}updateAllViews(){this.xM.forEach(t=>t.Pt())}paneViews(){return this.xM}attached(t){let{requestUpdate:i}=t;this.OM=i,this.zM=new Image,this.zM.onload=()=>{let t=this.zM?.naturalHeight??1,i=this.zM?.naturalWidth??1;this.xM.forEach(e=>e.VM({BM:t,IM:i,AM:this.zM})),this.OM&&this.OM()},this.zM.src=this.LM}detached(){this.OM=void 0,this.zM=null}hr(t){var i;this.ys=(i={...this.ys,...t},{...sA,...i}),this.NM(),this.SM&&this.SM()}SM(){this.OM&&this.OM()}NM(){this.xM.forEach(t=>t.EM(this.ys))}}class sU{constructor(t,i){this.Jn=t,this.ah=i,this.mM()}detach(){this.Jn.detachPrimitive(this.ah)}getSeries(){return this.Jn}applyOptions(t){this.ah&&this.ah.hr&&this.ah.hr(t)}mM(){this.Jn.attachPrimitive(this.ah)}}function sZ(t,i){return iM(Math.min(Math.max(t,12),30)*i)}function sH(t,i){switch(t){case"arrowDown":case"arrowUp":return sZ(i,1);case"circle":return sZ(i,.8);case"square":return sZ(i,.7)}}function sG(t){let i=Math.ceil(sZ(t,1));return i%2!=0?i-1:i}function sK(t){return Math.max(sZ(t,.1),3)}function sX(t,i,e){return i?t:e?Math.ceil(t/2):0}function sq(t,i,e,s){let h=(sH("arrowUp",s)-1)/2*e.WM,r=(iM(s/2)-1)/2*e.WM;i.beginPath(),t?(i.moveTo(e._t-h,e.ut),i.lineTo(e._t,e.ut-h),i.lineTo(e._t+h,e.ut),i.lineTo(e._t+r,e.ut),i.lineTo(e._t+r,e.ut+h),i.lineTo(e._t-r,e.ut+h)):(i.moveTo(e._t-h,e.ut),i.lineTo(e._t,e.ut+h),i.lineTo(e._t+h,e.ut),i.lineTo(e._t+r,e.ut),i.lineTo(e._t+r,e.ut-h),i.lineTo(e._t-r,e.ut-h)),i.lineTo(e._t-r,e.ut),i.fill()}function s0(t,i,e,s,h,r){let n=(sH("arrowUp",s)-1)/2,l=(iM(s/2)-1)/2;return h>=i-l-2&&h<=i+l+2&&r>=(t?e:e-n)-2&&r<=(t?e+n:e)+2||!(h<i-n-3)&&!(h>i+n+3)&&!(r<(t?e-n-3:e))&&!(r>(t?e:e+n+3))&&Math.abs(r-e)+3>=Math.abs(h-i)/2}class s1{constructor(){this.Yt=null,this.On=new tR,this.W=-1,this.F="",this.Mp=""}ht(t){this.Yt=t}Nn(t,i){this.W===t&&this.F===i||(this.W=t,this.F=i,this.Mp=H(t,i),this.On.In())}jn(t,i){if(null===this.Yt||null===this.Yt.lt)return null;for(let r=this.Yt.lt.from;r<this.Yt.lt.to;r++){var e,s,h;let n=this.Yt.ot[r];if(n&&(e=n,s=t,h=i,!(void 0===e.ri||!function(t,i,e,s,h,r){let n=s/2;return h>=t&&h<=t+e&&r>=i-n&&r<=i+n}(e.ri._t,e.ri.ut,e.ri.Qi,e.ri.$t,s,h))||function(t,i,e){if(0===t.zr)return!1;switch(t.HM){case"arrowDown":return s0(!0,t._t,t.ut,t.zr,i,e);case"arrowUp":return s0(!1,t._t,t.ut,t.zr,i,e);case"circle":return function(t,i,e,s,h){let r=2+sH("circle",e)/2,n=t-s,l=i-h;return Math.sqrt(n*n+l*l)<=r}(t._t,t.ut,t.zr,i,e);case"square":return function(t,i,e,s,h){let r=sH("square",e),n=(r-1)/2,l=t-n,o=i-n;return s>=l&&s<=l+r&&h>=o&&h<=o+r}(t._t,t.ut,t.zr,i,e)}}(e,s,h)))return{zOrder:"normal",externalId:n.Zn??""}}return null}draw(t){t.useBitmapCoordinateSpace(t=>{this.et(t)})}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null!==this.Yt&&null!==this.Yt.lt){t.textBaseline="middle",t.font=this.Mp;for(let s=this.Yt.lt.from;s<this.Yt.lt.to;s++){let h=this.Yt.ot[s];void 0!==h.ri&&(h.ri.Qi=this.On.Vi(t,h.ri.FM),h.ri.$t=this.W,h.ri._t=h._t-h.ri.Qi/2),function(t,i,e,s){var h,r,n;i.fillStyle=t.R,void 0!==t.ri&&(h=t.ri.FM,r=t.ri._t,n=t.ri.ut,i.save(),i.scale(e,s),i.fillText(h,r,n),i.restore()),function(t,i,e){if(0!==t.zr){switch(t.HM){case"arrowDown":return sq(!1,i,e,t.zr);case"arrowUp":return sq(!0,i,e,t.zr);case"circle":let s=(sH("circle",t.zr)-1)/2;i.beginPath(),i.arc(e._t,e.ut,s*e.WM,0,2*Math.PI,!1),i.fill();return;case"square":return function(t,i,e){let s=sH("square",e),h=(s-1)*i.WM/2,r=i._t-h,n=i.ut-h;t.fillRect(r,n,s*i.WM,s*i.WM)}(i,e,t.zr)}t.HM}}(t,i,function(t,i,e){let s=Math.max(1,Math.floor(i))%2/2;return{_t:Math.round(t._t*i)+s,ut:t.ut*e,WM:i}}(t,e,s))}(h,t,i,e)}}}}function s2(t){return"atPriceTop"===t||"atPriceBottom"===t||"atPriceMiddle"===t}class s3{constructor(t,i){this.qM=[],this.St=!0,this.YM=!0,this.Gt=new s1,this.ge=t,this._p=i,this.Yt={ot:[],lt:null}}renderer(){if(!this.ge.options().visible)return null;this.St&&this.jM();let t=this._p.options().layout;return this.Gt.Nn(t.fontSize,t.fontFamily),this.Gt.ht(this.Yt),this.Gt}ZM(t){this.qM=t,this.Pt("data")}Pt(t){this.St=!0,"data"===t&&(this.YM=!0)}jM(){let t=this._p.timeScale(),i=this.qM;this.YM&&(this.Yt.ot=i.map(t=>({wt:t.time,_t:0,ut:0,zr:0,HM:t.shape,R:t.color,Zn:t.id,KM:t.KM,ri:void 0})),this.YM=!1);let e=this._p.options().layout;this.Yt.lt=null;let s=t.getVisibleLogicalRange();if(null===s)return;let h=new iT(Math.floor(s.from),Math.ceil(s.to));if(null===this.ge.data()[0]||0===this.Yt.ot.length)return;let r=NaN,n=sK(t.options().barSpacing),l={UM:n,$M:n};this.Yt.lt=eI(this.Yt.ot,h,!0);for(let s=this.Yt.lt.from;s<this.Yt.lt.to;s++){let h=i[s];h.time!==r&&(l.UM=n,l.$M=n,r=h.time);let o=this.Yt.ot[s];o._t=B(t.logicalToCoordinate(h.time)),void 0!==h.text&&h.text.length>0&&(o.ri={FM:h.text,_t:0,ut:0,Qi:0,$t:0});let a=this.ge.dataByIndex(h.time,0);null!==a&&function(t,i,e,s,h,r,n,l){let o=function(t,i){if(s2(i.position)&&void 0!==i.price)return i.price;if("value"in t&&"number"==typeof t.value)return t.value;if("open"in t&&"high"in t&&"low"in t&&"close"in t){if("inBar"===i.position)return t.close;if("aboveBar"===i.position)return t.high;if("belowBar"===i.position)return t.low}}(e,i);if(void 0===o)return;let a=s2(i.position),u=l.timeScale(),c=F(i.size)?Math.max(i.size,0):1,f=sG(u.options().barSpacing)*c,d=f/2;switch(t.zr=f,i.position){case"inBar":case"atPriceMiddle":return t.ut=B(n.priceToCoordinate(o)),void 0!==t.ri&&(t.ri.ut=t.ut+d+r+.6*h);case"aboveBar":case"atPriceTop":{let i=a?0:s.UM;return t.ut=B(n.priceToCoordinate(o))-d-i,void 0!==t.ri&&(t.ri.ut=t.ut-d-.6*h,s.UM+=1.2*h),a||(s.UM+=f+r)}case"belowBar":case"atPriceBottom":{let i=a?0:s.$M;return t.ut=B(n.priceToCoordinate(o))+d+i,void 0!==t.ri&&(t.ri.ut=t.ut+d+r+.6*h,s.$M+=1.2*h),a||(s.$M+=f+r)}}}(o,h,a,l,e.fontSize,n,this.ge,this._p)}this.St=!1}}class s5{constructor(){this.sh=null,this.qM=[],this.XM=[],this.GM=null,this.ge=null,this._p=null,this.JM=!0,this.QM=null,this.tb=null,this.ib=null,this.sb=!0}attached(t){this.nb(),this._p=t.chart,this.ge=t.series,this.sh=new s3(this.ge,B(this._p)),this.OM=t.requestUpdate,this.ge.subscribeDataChanged(t=>this.rg(t)),this.sb=!0,this.SM()}SM(){this.OM&&this.OM()}detached(){this.ge&&this.GM&&this.ge.unsubscribeDataChanged(this.GM),this._p=null,this.ge=null,this.sh=null,this.GM=null}ZM(t){this.sb=!0,this.qM=t,this.nb(),this.JM=!0,this.tb=null,this.SM()}eb(){return this.qM}paneViews(){return this.sh?[this.sh]:[]}updateAllViews(){this.rb()}hitTest(t,i){return this.sh?this.sh.renderer()?.jn(t,i)??null:null}autoscaleInfo(t,i){if(this.sh){let t=this.hb();if(t)return{priceRange:null,margins:t}}return null}hb(){let t=B(this._p).timeScale().options().barSpacing;if(this.JM||t!==this.ib){if(this.ib=t,this.qM.length>0){let i=sK(t),e=1.5*sG(t)+2*i,s=this.ab();this.QM={above:sX(e,s.aboveBar,s.inBar),below:sX(e,s.belowBar,s.inBar)}}else this.QM=null;this.JM=!1}return this.QM}ab(){return null===this.tb&&(this.tb=this.qM.reduce((t,i)=>(t[i.position]||(t[i.position]=!0),t),{inBar:!1,aboveBar:!1,belowBar:!1,atPriceTop:!1,atPriceBottom:!1,atPriceMiddle:!1})),this.tb}nb(){if(!this.sb||!this._p||!this.ge)return;let t=this._p.timeScale(),i=this.ge?.data();if(null==t.getVisibleLogicalRange()||!this.ge||0===i.length)return void(this.XM=[]);let e=t.timeToIndex(B(i[0].time),!0);this.XM=this.qM.map((i,s)=>{let h=t.timeToIndex(i.time,!0),r=B(this.ge).dataByIndex(h,h<e?1:-1),n={time:t.timeToIndex(B(r).time,!1),position:i.position,shape:i.shape,color:i.color,id:i.id,KM:s,text:i.text,size:i.size,price:i.price,ew:i.time};if(("atPriceTop"===i.position||"atPriceBottom"===i.position||"atPriceMiddle"===i.position)&&void 0===i.price)throw Error(`Price is required for position ${i.position}`);return{...n,position:i.position,price:i.price}}),this.sb=!1}rb(t){this.sh&&(this.nb(),this.sh.ZM(this.XM),this.sh.Pt(t))}rg(t){this.sb=!0,this.SM()}}class s6 extends sU{constructor(t,i,e){super(t,i),e&&this.setMarkers(e)}setMarkers(t){this.ah.ZM(t)}markers(){return this.ah.eb()}}function s4(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}({...E,color:"#2196f3"});var s9=function(t){var i,e=t.container,s=t.onClick,h=t.onCrosshairMove,r=t.onInit,n=t.options,l=void 0===n?{}:n,o=t.onDblClick,a=(i=(0,_.useState)(!1),function(t){if(Array.isArray(t))return t}(i)||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(i,2)||function(t,i){if(t){if("string"==typeof t)return s4(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return s4(t,i)}}(i,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=a[0],c=a[1],f=(0,_.useRef)({_chart:null,api:function(){return this._chart},init:function(){if(null===this._chart)this._chart=function(t,i,e){let s=new so(function(t){if(I(t)){let i=document.getElementById(t);return V(null!==i,`Cannot find element in DOM with id=${t}`),i}return t}(t),i,e);return i.setOptions(s.options()),s}(e,new i0,i0.Wc(l)),r&&r(this._chart);return u||c(!0),this._chart},clear:function(){null!==this._chart&&(c(!1),this._chart.remove(),this._chart=null)}});return(0,_.useLayoutEffect)(function(){return f.current.init(),function(){f.current.clear()}},[]),(0,_.useLayoutEffect)(function(){if(e){if(s){var t;null===(t=f.current.api())||void 0===t||t.subscribeClick(s)}return function(){if(s){var t;null===(t=f.current.api())||void 0===t||t.unsubscribeClick(s)}}}},[s]),(0,_.useLayoutEffect)(function(){if(e){if(h){var t;null===(t=f.current.api())||void 0===t||t.subscribeCrosshairMove(h)}return function(){if(h){var t;null===(t=f.current.api())||void 0===t||t.unsubscribeCrosshairMove(h)}}}},[h]),(0,_.useLayoutEffect)(function(){if(e){if(o){var t;null===(t=f.current.api())||void 0===t||t.subscribeDblClick(o)}return function(){if(o){var t;null===(t=f.current.api())||void 0===t||t.unsubscribeDblClick(o)}}}},[o]),(0,_.useLayoutEffect)(function(){var t;e&&(null===(t=f.current.api())||void 0===t||t.applyOptions(l))},[l]),{chartApiRef:f,isReady:u}},s8=function(t){var i=t.children,e=s9({container:t.container,onClick:t.onClick,onCrosshairMove:t.onCrosshairMove,onInit:t.onInit,options:t.options}),s=e.chartApiRef.current,h=e.isReady;return S().createElement(x.Provider,{value:{chartApiRef:s,isReady:h}},i)};function s7(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}function ht(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}var hi=(0,_.forwardRef)(function(t,i){var e,s=t.children,h=t.containerProps,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children","containerProps"]),n=(e=(0,_.useState)(),function(t){if(Array.isArray(t))return t}(e)||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(e,2)||function(t,i){if(t){if("string"==typeof t)return s7(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return s7(t,i)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=n[0],o=n[1],a=(0,_.useCallback)(function(t){o(t),i&&("function"==typeof i?a(t):i.current=t)},[i]);return S().createElement("div",ht({ref:a},h),!!l&&S().createElement(s8,ht({container:l},r),s))});hi.displayName="ChartWrapper";var he=(0,_.createContext)(null);he.displayName="TimeScaleContext";var hs="0.4.1";function hh(t,i,e){return(hh=ha()?Reflect.construct:function(t,i,e){var s=[null];s.push.apply(s,i);var h=new(Function.bind.apply(t,s));return e&&hl(h,e.prototype),h}).apply(null,arguments)}function hr(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function hn(t){return(hn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function hl(t,i){return(hl=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,i)}function ho(t){var i="function"==typeof Map?new Map:void 0;return(ho=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(t))return i.get(t);i.set(t,e)}function e(){return hh(t,arguments,hn(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),hl(e,t)})(t)}function ha(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ha=function(){return!!t})()}var hu=function(t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function i(t){var e,s,h,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=n.isOperational,o=n.cause,a=n.docsPath;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,s=[t],e=hn(e),hr(h=function(t,i){var e;if(i&&("object"==((e=i)&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)||"function"==typeof i))return i;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,ha()?Reflect.construct(e,s||[],hn(this).constructor):e.apply(this,s)),"isOperational",void 0),hr(h,"cause",void 0),h.name=null!==(r=h.constructor.name)&&void 0!==r?r:"InternalError",h.isOperational=void 0===l||l,h.cause=o,h.message="".concat(null!=t?t:"An error occurred"),a&&(h.message="".concat(h.message,"\n Docs: see ").concat("https://tradingview.github.io/lightweight-charts/docs"+a)),hs&&(h.message="".concat(h.message,"\n Version: lightweight-charts-react-components/").concat(hs)),Object.setPrototypeOf(h,i.prototype),h}return i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&hl(i,t),i}(ho(Error)),hc=function(t,i){var e=(0,_.useContext)(t);if(!e){var s,h,r=null!==(h=null!==(s=t.name)&&void 0!==s?s:t.displayName)&&void 0!==h?h:"Context";throw new hu(null!=i?i:"".concat(r," not found."),{isOperational:!0})}return e};function hf(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}var hd=function(t){var i,e=t.onVisibleTimeRangeChange,s=t.onVisibleLogicalRangeChange,h=t.onSizeChange,r=t.visibleRange,n=t.visibleLogicalRange,l=t.options,o=void 0===l?{}:l,a=hc(x),u=a.isReady,c=a.chartApiRef,f=(i=(0,_.useState)(!1),function(t){if(Array.isArray(t))return t}(i)||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(i,2)||function(t,i){if(t){if("string"==typeof t)return hf(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return hf(t,i)}}(i,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=f[0],p=f[1],m=(0,_.useRef)({_timeScale:null,api:function(){return this._timeScale},init:function(){if(this._timeScale)return this._timeScale;var t=null==c?void 0:c.api();return t?(this._timeScale=t.timeScale(),this._timeScale.applyOptions(o),r&&this._timeScale.setVisibleRange(r),n&&this._timeScale.setVisibleLogicalRange(n),e&&this._timeScale.subscribeVisibleTimeRangeChange(e),s&&this._timeScale.subscribeVisibleLogicalRangeChange(s),h&&this._timeScale.subscribeSizeChange(h),p(!0),this._timeScale):null},clear:function(){this._timeScale=null,p(!1)}});return(0,_.useLayoutEffect)(function(){u&&m.current.init()},[u]),(0,_.useLayoutEffect)(function(){return function(){m.current.clear()}},[]),(0,_.useLayoutEffect)(function(){if(c&&o){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.applyOptions(o)}},[o]),(0,_.useLayoutEffect)(function(){if(c){if(h){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.subscribeSizeChange(h)}return function(){if(h){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.unsubscribeSizeChange(h)}}}},[h]),(0,_.useLayoutEffect)(function(){if(c){if(s){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.subscribeVisibleLogicalRangeChange(s)}return function(){if(s){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.unsubscribeVisibleLogicalRangeChange(s)}}}},[s]),(0,_.useLayoutEffect)(function(){if(c){if(e){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.subscribeVisibleTimeRangeChange(e)}return function(){if(e){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.unsubscribeVisibleTimeRangeChange(e)}}}},[e]),(0,_.useLayoutEffect)(function(){if(c&&r){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.setVisibleRange(r)}},[r]),(0,_.useLayoutEffect)(function(){if(c&&n){var t,i;null===(i=m.current)||void 0===i||null===(t=i.api())||void 0===t||t.setVisibleLogicalRange(n)}},[n]),{timeScaleApiRef:m,isReady:d}},hp=(0,_.forwardRef)(function(t,i){var e=t.children,s=hd(function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"])),h=s.timeScaleApiRef.current,r=s.isReady;return(0,_.useImperativeHandle)(i,function(){return h},[h]),S().createElement(he.Provider,{value:{timeScaleApiRef:h,isReady:r}},e)});hp.displayName="TimeScale";var hm=function(t){var i=t.options,e=void 0===i?{}:i,s=t.id,h=hc(x),r=h.isReady,n=h.chartApiRef,l=(0,_.useRef)({_priceScale:null,api:function(){return this._priceScale},init:function(){if(!this._priceScale){var t=null==n?void 0:n.api();if(!t)return null;this._priceScale=t.priceScale(s),this._priceScale.applyOptions(e)}return this._priceScale},setId:function(t){null!==this._priceScale&&null!==n&&(this._priceScale=n.api().priceScale(t),this._priceScale.applyOptions(e))},clear:function(){this._priceScale=null}});return(0,_.useLayoutEffect)(function(){r&&l.current.init()},[r]),(0,_.useLayoutEffect)(function(){return function(){l.current.clear()}},[]),(0,_.useLayoutEffect)(function(){var t;n&&(null===(t=l.current)||void 0===t||t.setId(s))},[s]),(0,_.useLayoutEffect)(function(){if(n&&e){var t,i;null===(i=l.current)||void 0===i||null===(t=i.api())||void 0===t||t.applyOptions(e)}},[e]),l},hg=(0,_.forwardRef)(function(t,i){var e=hm(t);return(0,_.useImperativeHandle)(i,function(){return e.current},[e]),null});function hv(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}hg.displayName="PriceScale";var hb=function(t){var i=t.deps,e=hc(he),s=e.timeScaleApiRef,h=e.isReady;(0,_.useLayoutEffect)(function(){if(h&&s){var t=s.api();queueMicrotask(function(){t&&t.fitContent()})}},((function(t){if(Array.isArray(t))return hv(t)})(i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,i){if(t){if("string"==typeof t)return hv(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return hv(t,i)}}(i)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([h]))},hy=function(t){return hb({deps:t.deps}),null},hw=(0,_.createContext)({seriesApiRef:null,isReady:!1});hw.displayName="SeriesContext";var hM=0,h_=function(){return hM+=1},hS=function(){return 0!==hM&&(hM-=1),hM};function hx(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}var hC=function(t){var i,e=t.type,s=t.data,h=t.options,r=void 0===h?{}:h,n=t.reactive,l=void 0===n||n,o=t.isPane,a=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["type","data","options","reactive","isPane"]),u=hc(x),c=u.isReady,f=u.chartApiRef,d=(i=(0,_.useState)(!1),function(t){if(Array.isArray(t))return t}(i)||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(i,2)||function(t,i){if(t){if("string"==typeof t)return hx(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return hx(t,i)}}(i,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=d[0],m=d[1],g=(0,_.useRef)({_series:null,api:function(){return this._series},init:function(){if(!this._series){var t,i=null==f?void 0:f.api();if(!i)return null;if("Custom"===e){var h=a.plugin;if(!h)throw new hu("Custom series requires a plugin to be defined");this._series=i.addCustomSeries(h,r,o?hM:0)}else this._series=i.addSeries(hP[e],r,o?hM:0);m(!0),null===(t=this._series)||void 0===t||t.setData(s),o&&h_()}return this._series},clear:function(){if(null!==this._series){var t;null==f||null===(t=f.api())||void 0===t||t.removeSeries(this._series),this._series=null,m(!1),o&&hS()}}});return(0,_.useLayoutEffect)(function(){c&&g.current.init()},[c]),(0,_.useLayoutEffect)(function(){return function(){g.current.clear()}},[]),(0,_.useLayoutEffect)(function(){if(f&&s&&l){var t;null===(t=g.current.api())||void 0===t||t.setData(s)}},[s,l]),(0,_.useLayoutEffect)(function(){if(f&&r){var t;null===(t=g.current.api())||void 0===t||t.applyOptions(r)}},[r]),(0,_.useLayoutEffect)(function(){var t,i;f&&void 0!==o&&(o?(h_(),null===(t=g.current.api())||void 0===t||t.moveToPane(hM)):(hS(),null===(i=g.current.api())||void 0===i||i.moveToPane(0)))},[o]),{isReady:p,seriesApiRef:g}},hP={Line:{type:"Line",isBuiltIn:!0,defaultOptions:{color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new sg(t,i)},Candlestick:{type:"Candlestick",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Mg:(t,i)=>new sk(t,i)},Histogram:{type:"Histogram",isBuiltIn:!0,defaultOptions:{color:"#26a69a",base:0},Mg:(t,i)=>new sY(t,i)},Area:{type:"Area",isBuiltIn:!0,defaultOptions:{topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,relativeGradient:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new sx(t,i)},Baseline:{type:"Baseline",isBuiltIn:!0,defaultOptions:{baseValue:{type:"price",price:0},relativeGradient:!1,topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new s_(t,i)},Bar:{type:"Bar",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Mg:(t,i)=>new sR(t,i)}},hR=(0,_.forwardRef)(function(t,i){var e=t.children,s=hC(function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"])),h=s.seriesApiRef.current,r=s.isReady;return(0,_.useImperativeHandle)(i,function(){return h},[h]),S().createElement(hw.Provider,{value:{seriesApiRef:h,isReady:r}},e)});hR.displayName="SeriesTemplate";var hO=(0,_.forwardRef)(function(t,i){var e=t.children,s=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return S().createElement(hR,function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Line",ref:i},s),e)});hO.displayName="LineSeries";var hk=(0,_.forwardRef)(function(t,i){var e=t.children,s=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return S().createElement(hR,function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Histogram",ref:i},s),e)});hk.displayName="HistogramSeries";var hz=(0,_.forwardRef)(function(t,i){var e=t.children,s=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return S().createElement(hR,function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Candlestick",ref:i},s),e)});hz.displayName="CandlestickSeries";var hY=(0,_.forwardRef)(function(t,i){var e=t.children,s=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return S().createElement(hR,function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Area",ref:i},s),e)});hY.displayName="AreaSeries";var hE=(0,_.forwardRef)(function(t,i){var e=t.children,s=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return S().createElement(hR,function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Baseline",ref:i},s),e)});hE.displayName="BaselineSeries";var hT=(0,_.forwardRef)(function(t,i){var e=t.children,s=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return S().createElement(hR,function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Bar",ref:i},s),e)});hT.displayName="BarSeries";var hL=(0,_.forwardRef)(function(t,i){var e=t.children,s=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return S().createElement(hR,function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Custom",ref:i},s),e)});hL.displayName="CustomSeries";var hV=function(t){var i=t.options,e=t.price,s=hc(hw),h=s.isReady,r=s.seriesApiRef,n=(0,_.useRef)({_priceLine:null,api:function(){return this._priceLine},init:function(){if(!this._priceLine){var t=null==r?void 0:r.api();if(!t)return null;this._priceLine=t.createPriceLine(function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({price:e},i))}return this._priceLine},clear:function(){if(null!==this._priceLine){var t;null==r||null===(t=r.api())||void 0===t||t.removePriceLine(this._priceLine),this._priceLine=null}}});return(0,_.useLayoutEffect)(function(){h&&n.current.init()},[h]),(0,_.useLayoutEffect)(function(){return function(){n.current.clear()}},[]),(0,_.useLayoutEffect)(function(){if(r&&i){var t;null===(t=n.current.api())||void 0===t||t.applyOptions(i)}},[i]),(0,_.useLayoutEffect)(function(){if(r&&e){var t;null===(t=n.current.api())||void 0===t||t.applyOptions({price:e})}},[e]),n},hN=(0,_.forwardRef)(function(t,i){var e=hV(t);return(0,_.useImperativeHandle)(i,function(){return e.current},[e]),null});hN.displayName="PriceLine";var hB=function(t){var i=t.reactive,e=void 0===i||i,s=t.markers,h=hc(hw),r=h.isReady,n=h.seriesApiRef,l=(0,_.useRef)({_markers:null,api:function(){return this._markers},init:function(){if(null===this._markers){var t=null==n?void 0:n.api();if(!t)return null;this._markers=function(t,i){let e=new s6(t,new s5);return i&&e.setMarkers(i),e}(t,s)}return this._markers},clear:function(){null!==this._markers&&(this._markers.detach(),this._markers=null)}});return(0,_.useLayoutEffect)(function(){r&&l.current.init()},[r]),(0,_.useLayoutEffect)(function(){return function(){l.current.clear()}},[]),(0,_.useLayoutEffect)(function(){if(n&&s&&e){var t;null===(t=l.current.api())||void 0===t||t.setMarkers(s)}},[s,e]),l};function hD(){return(hD=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t}).apply(this,arguments)}var hW=(0,_.forwardRef)(function(t,i){var e=hB(hD({},function(t){if(null==t)throw TypeError("Cannot destructure "+t);return t}(t)));return(0,_.useImperativeHandle)(i,function(){return e.current},[e]),null});function hj(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}hW.displayName="Markers";var hF=function(t){var i=hc(x),e=i.isReady,s=i.chartApiRef,h=(0,_.useRef)({_watermark:null,api:function(){return this._watermark},init:function(){if(null===this._watermark){var i=null==s?void 0:s.api(),e=null==i?void 0:i.panes()[0];if(!i||!e)return null;if(hA(t)){t.type;var h=hj(t,["type"]);this._watermark=new sE(e,new sF(h))}else{t.type;var r=t.src,n=hj(t,["type","src"]);this._watermark=new sE(e,new s$(r,n))}}return this._watermark},clear:function(){null!==this._watermark&&(this._watermark.detach(),this._watermark=null)}});return(0,_.useLayoutEffect)(function(){e&&h.current.init()},[e]),(0,_.useLayoutEffect)(function(){return function(){h.current.clear()}},[]),(0,_.useLayoutEffect)(function(){if(s&&t){t.type;var i,e=hj(t,["type"]);null===(i=h.current.api())||void 0===i||i.applyOptions(e)}},[t]),h},hA=function(t){return"text"===t.type};function hI(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}function hQ(t,i){return i=null!=i?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t}var hJ=function(t,i){var e=hF(t);return(0,_.useImperativeHandle)(i,function(){return e.current},[e]),null},h$=(0,_.forwardRef)(function(t,i){return hJ(hQ(hI({},t),{type:"text"}),i)}),hU=(0,_.forwardRef)(function(t,i){return hJ(hQ(hI({},t),{type:"image"}),i)});h$.displayName="WatermarkText",hU.displayName="WatermarkImage";var hZ=function(t){var i=t.render,e=t.plugin,s=hc(x),h=s.isReady,r=s.chartApiRef,n=hc(hw),l=n.isReady,o=n.seriesApiRef,a=(0,_.useRef)({_primitive:null,api:function(){return this._primitive},init:function(){if(!this._primitive){var t=null==o?void 0:o.api(),s=null==r?void 0:r.api();if(!s||!t)return null;var h=e||i({chart:s,series:t});t.attachPrimitive(h),this._primitive=h}return this._primitive},clear:function(){if(null!==this._primitive){var t;null==o||null===(t=o.api())||void 0===t||t.detachPrimitive(this._primitive),this._primitive=null}}});return(0,_.useLayoutEffect)(function(){h&&l&&a.current.init()},[l,h]),(0,_.useLayoutEffect)(function(){return function(){a.current.clear()}},[]),a},hH=(0,_.forwardRef)(function(t,i){var e=hZ(t);return(0,_.useImperativeHandle)(i,function(){return e.current},[e]),null});hH.displayName="SeriesPrimitive"}(),h}()});
13
13
  //# sourceMappingURL=lightweight-charts-react-components.standalone.js.map